{"version":3,"file":"sweetalert2.a6de33ca.js","sources":["../../../node_modules/sweetalert2/dist/sweetalert2.all.js"],"sourcesContent":["/*!\n* sweetalert2 v11.4.35\n* Released under the MIT License.\n*/\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.Sweetalert2 = factory());\n}(this, function () { 'use strict';\n\n /**\n * This module contains `WeakMap`s for each effectively-\"private property\" that a `Swal` has.\n * For example, to set the private property \"foo\" of `this` to \"bar\", you can `privateProps.foo.set(this, 'bar')`\n * This is the approach that Babel will probably take to implement private methods/fields\n * https://github.com/tc39/proposal-private-methods\n * https://github.com/babel/babel/pull/7555\n * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*\n * then we can use that language feature.\n */\n var privateProps = {\n awaitingPromise: new WeakMap(),\n promise: new WeakMap(),\n innerParams: new WeakMap(),\n domCache: new WeakMap()\n };\n\n const swalPrefix = 'swal2-';\n /**\n * @param {string[]} items\n * @returns {object}\n */\n\n const prefix = items => {\n const result = {};\n\n for (const i in items) {\n result[items[i]] = swalPrefix + items[i];\n }\n\n return result;\n };\n const swalClasses = prefix(['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'show', 'hide', 'close', 'title', 'html-container', 'actions', 'confirm', 'deny', 'cancel', 'default-outline', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'input-label', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loader', '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', 'timer-progress-bar-container', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error', 'no-war']);\n const iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']);\n\n const consolePrefix = 'SweetAlert2:';\n /**\n * Filter the unique values into a new array\n *\n * @param {Array} arr\n * @returns {Array}\n */\n\n const uniqueArray = arr => {\n const result = [];\n\n for (let i = 0; i < arr.length; i++) {\n if (result.indexOf(arr[i]) === -1) {\n result.push(arr[i]);\n }\n }\n\n return result;\n };\n /**\n * Capitalize the first letter of a string\n *\n * @param {string} str\n * @returns {string}\n */\n\n const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1);\n /**\n * Standardize console warnings\n *\n * @param {string | Array} message\n */\n\n const warn = message => {\n console.warn(\"\".concat(consolePrefix, \" \").concat(typeof message === 'object' ? message.join(' ') : message));\n };\n /**\n * Standardize console errors\n *\n * @param {string} message\n */\n\n const error = message => {\n console.error(\"\".concat(consolePrefix, \" \").concat(message));\n };\n /**\n * Private global state for `warnOnce`\n *\n * @type {Array}\n * @private\n */\n\n const previousWarnOnceMessages = [];\n /**\n * Show a console warning, but only if it hasn't already been shown\n *\n * @param {string} message\n */\n\n const warnOnce = message => {\n if (!previousWarnOnceMessages.includes(message)) {\n previousWarnOnceMessages.push(message);\n warn(message);\n }\n };\n /**\n * Show a one-time console warning about deprecated params/methods\n *\n * @param {string} deprecatedParam\n * @param {string} useInstead\n */\n\n const warnAboutDeprecation = (deprecatedParam, useInstead) => {\n warnOnce(\"\\\"\".concat(deprecatedParam, \"\\\" is deprecated and will be removed in the next major release. Please use \\\"\").concat(useInstead, \"\\\" instead.\"));\n };\n /**\n * If `arg` is a function, call it (with no arguments or context) and return the result.\n * Otherwise, just pass the value through\n *\n * @param {Function | any} arg\n * @returns {any}\n */\n\n const callIfFunction = arg => typeof arg === 'function' ? arg() : arg;\n /**\n * @param {any} arg\n * @returns {boolean}\n */\n\n const hasToPromiseFn = arg => arg && typeof arg.toPromise === 'function';\n /**\n * @param {any} arg\n * @returns {Promise}\n */\n\n const asPromise = arg => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg);\n /**\n * @param {any} arg\n * @returns {boolean}\n */\n\n const isPromise = arg => arg && Promise.resolve(arg) === arg;\n /**\n * @param {Array} arr\n * @returns {any}\n */\n\n const getRandomElement = arr => arr[Math.floor(Math.random() * arr.length)];\n\n /**\n * Gets the popup container which contains the backdrop and the popup itself.\n *\n * @returns {HTMLElement | null}\n */\n\n const getContainer = () => document.body.querySelector(\".\".concat(swalClasses.container));\n /**\n * @param {string} selectorString\n * @returns {HTMLElement | null}\n */\n\n const elementBySelector = selectorString => {\n const container = getContainer();\n return container ? container.querySelector(selectorString) : null;\n };\n /**\n * @param {string} className\n * @returns {HTMLElement | null}\n */\n\n const elementByClass = className => {\n return elementBySelector(\".\".concat(className));\n };\n /**\n * @returns {HTMLElement | null}\n */\n\n\n const getPopup = () => elementByClass(swalClasses.popup);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getIcon = () => elementByClass(swalClasses.icon);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getTitle = () => elementByClass(swalClasses.title);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getHtmlContainer = () => elementByClass(swalClasses['html-container']);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getImage = () => elementByClass(swalClasses.image);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getProgressSteps = () => elementByClass(swalClasses['progress-steps']);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getValidationMessage = () => elementByClass(swalClasses['validation-message']);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getConfirmButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.confirm));\n /**\n * @returns {HTMLElement | null}\n */\n\n const getDenyButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.deny));\n /**\n * @returns {HTMLElement | null}\n */\n\n const getInputLabel = () => elementByClass(swalClasses['input-label']);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getLoader = () => elementBySelector(\".\".concat(swalClasses.loader));\n /**\n * @returns {HTMLElement | null}\n */\n\n const getCancelButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.cancel));\n /**\n * @returns {HTMLElement | null}\n */\n\n const getActions = () => elementByClass(swalClasses.actions);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getFooter = () => elementByClass(swalClasses.footer);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getTimerProgressBar = () => elementByClass(swalClasses['timer-progress-bar']);\n /**\n * @returns {HTMLElement | null}\n */\n\n const getCloseButton = () => elementByClass(swalClasses.close); // https://github.com/jkup/focusable/blob/master/index.js\n\n const 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\";\n /**\n * @returns {HTMLElement[]}\n */\n\n const getFocusableElements = () => {\n const focusableElementsWithTabindex = Array.from(getPopup().querySelectorAll('[tabindex]:not([tabindex=\"-1\"]):not([tabindex=\"0\"])')) // sort according to tabindex\n .sort((a, b) => {\n const tabindexA = parseInt(a.getAttribute('tabindex'));\n const tabindexB = parseInt(b.getAttribute('tabindex'));\n\n if (tabindexA > tabindexB) {\n return 1;\n } else if (tabindexA < tabindexB) {\n return -1;\n }\n\n return 0;\n });\n const otherFocusableElements = Array.from(getPopup().querySelectorAll(focusable)).filter(el => el.getAttribute('tabindex') !== '-1');\n return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)).filter(el => isVisible(el));\n };\n /**\n * @returns {boolean}\n */\n\n const isModal = () => {\n return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']);\n };\n /**\n * @returns {boolean}\n */\n\n const isToast = () => {\n return getPopup() && hasClass(getPopup(), swalClasses.toast);\n };\n /**\n * @returns {boolean}\n */\n\n const isLoading = () => {\n return getPopup().hasAttribute('data-loading');\n };\n\n const states = {\n previousBodyPadding: null\n };\n /**\n * Securely set innerHTML of an element\n * https://github.com/sweetalert2/sweetalert2/issues/1926\n *\n * @param {HTMLElement} elem\n * @param {string} html\n */\n\n const setInnerHtml = (elem, html) => {\n elem.textContent = '';\n\n if (html) {\n const parser = new DOMParser();\n const parsed = parser.parseFromString(html, \"text/html\");\n Array.from(parsed.querySelector('head').childNodes).forEach(child => {\n elem.appendChild(child);\n });\n Array.from(parsed.querySelector('body').childNodes).forEach(child => {\n elem.appendChild(child);\n });\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} className\n * @returns {boolean}\n */\n\n const hasClass = (elem, className) => {\n if (!className) {\n return false;\n }\n\n const classList = className.split(/\\s+/);\n\n for (let i = 0; i < classList.length; i++) {\n if (!elem.classList.contains(classList[i])) {\n return false;\n }\n }\n\n return true;\n };\n /**\n * @param {HTMLElement} elem\n * @param {SweetAlertOptions} params\n */\n\n const removeCustomClasses = (elem, params) => {\n Array.from(elem.classList).forEach(className => {\n if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass).includes(className)) {\n elem.classList.remove(className);\n }\n });\n };\n /**\n * @param {HTMLElement} elem\n * @param {SweetAlertOptions} params\n * @param {string} className\n */\n\n\n const applyCustomClass = (elem, params, className) => {\n removeCustomClasses(elem, params);\n\n if (params.customClass && params.customClass[className]) {\n if (typeof params.customClass[className] !== 'string' && !params.customClass[className].forEach) {\n return warn(\"Invalid type of customClass.\".concat(className, \"! Expected string or iterable object, got \\\"\").concat(typeof params.customClass[className], \"\\\"\"));\n }\n\n addClass(elem, params.customClass[className]);\n }\n };\n /**\n * @param {HTMLElement} popup\n * @param {import('./renderers/renderInput').InputClass} inputClass\n * @returns {HTMLInputElement | null}\n */\n\n const getInput = (popup, inputClass) => {\n if (!inputClass) {\n return null;\n }\n\n switch (inputClass) {\n case 'select':\n case 'textarea':\n case 'file':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses[inputClass]));\n\n case 'checkbox':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.checkbox, \" input\"));\n\n case 'radio':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.radio, \" input:checked\")) || popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.radio, \" input:first-child\"));\n\n case 'range':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.range, \" input\"));\n\n default:\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.input));\n }\n };\n /**\n * @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input\n */\n\n const focusInput = input => {\n input.focus(); // place cursor at end of text in text input\n\n if (input.type !== 'file') {\n // http://stackoverflow.com/a/2345915\n const val = input.value;\n input.value = '';\n input.value = val;\n }\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[] | readonly string[]} classList\n * @param {boolean} condition\n */\n\n const toggleClass = (target, classList, condition) => {\n if (!target || !classList) {\n return;\n }\n\n if (typeof classList === 'string') {\n classList = classList.split(/\\s+/).filter(Boolean);\n }\n\n classList.forEach(className => {\n if (Array.isArray(target)) {\n target.forEach(elem => {\n condition ? elem.classList.add(className) : elem.classList.remove(className);\n });\n } else {\n condition ? target.classList.add(className) : target.classList.remove(className);\n }\n });\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[] | readonly string[]} classList\n */\n\n const addClass = (target, classList) => {\n toggleClass(target, classList, true);\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[] | readonly string[]} classList\n */\n\n const removeClass = (target, classList) => {\n toggleClass(target, classList, false);\n };\n /**\n * Get direct child of an element by class name\n *\n * @param {HTMLElement} elem\n * @param {string} className\n * @returns {HTMLElement | null}\n */\n\n const getDirectChildByClass = (elem, className) => {\n const children = Array.from(elem.children);\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n\n if (child instanceof HTMLElement && hasClass(child, className)) {\n return child;\n }\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} property\n * @param {*} value\n */\n\n const applyNumericalStyle = (elem, property, value) => {\n if (value === \"\".concat(parseInt(value))) {\n value = parseInt(value);\n }\n\n if (value || parseInt(value) === 0) {\n elem.style[property] = typeof value === 'number' ? \"\".concat(value, \"px\") : value;\n } else {\n elem.style.removeProperty(property);\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} display\n */\n\n const show = function (elem) {\n let display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex';\n elem.style.display = display;\n };\n /**\n * @param {HTMLElement} elem\n */\n\n const hide = elem => {\n elem.style.display = 'none';\n };\n /**\n * @param {HTMLElement} parent\n * @param {string} selector\n * @param {string} property\n * @param {string} value\n */\n\n const setStyle = (parent, selector, property, value) => {\n /** @type {HTMLElement} */\n const el = parent.querySelector(selector);\n\n if (el) {\n el.style[property] = value;\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {any} condition\n * @param {string} display\n */\n\n const toggle = function (elem, condition) {\n let display = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'flex';\n condition ? show(elem, display) : hide(elem);\n };\n /**\n * borrowed from jquery $(elem).is(':visible') implementation\n *\n * @param {HTMLElement} elem\n * @returns {boolean}\n */\n\n const isVisible = elem => !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));\n /**\n * @returns {boolean}\n */\n\n const allButtonsAreHidden = () => !isVisible(getConfirmButton()) && !isVisible(getDenyButton()) && !isVisible(getCancelButton());\n /**\n * @returns {boolean}\n */\n\n const isScrollable = elem => !!(elem.scrollHeight > elem.clientHeight);\n /**\n * borrowed from https://stackoverflow.com/a/46352119\n *\n * @param {HTMLElement} elem\n * @returns {boolean}\n */\n\n const hasCssAnimation = elem => {\n const style = window.getComputedStyle(elem);\n const animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');\n const transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');\n return animDuration > 0 || transDuration > 0;\n };\n /**\n * @param {number} timer\n * @param {boolean} reset\n */\n\n const animateTimerProgressBar = function (timer) {\n let reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n const timerProgressBar = getTimerProgressBar();\n\n if (isVisible(timerProgressBar)) {\n if (reset) {\n timerProgressBar.style.transition = 'none';\n timerProgressBar.style.width = '100%';\n }\n\n setTimeout(() => {\n timerProgressBar.style.transition = \"width \".concat(timer / 1000, \"s linear\");\n timerProgressBar.style.width = '0%';\n }, 10);\n }\n };\n const stopTimerProgressBar = () => {\n const timerProgressBar = getTimerProgressBar();\n const timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width);\n timerProgressBar.style.removeProperty('transition');\n timerProgressBar.style.width = '100%';\n const timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width);\n const timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100;\n timerProgressBar.style.removeProperty('transition');\n timerProgressBar.style.width = \"\".concat(timerProgressBarPercent, \"%\");\n };\n\n const RESTORE_FOCUS_TIMEOUT = 100;\n\n /** @type {GlobalState} */\n\n const globalState = {};\n\n const focusPreviousActiveElement = () => {\n if (globalState.previousActiveElement instanceof HTMLElement) {\n globalState.previousActiveElement.focus();\n globalState.previousActiveElement = null;\n } else if (document.body) {\n document.body.focus();\n }\n };\n /**\n * Restore previous active (focused) element\n *\n * @param {boolean} returnFocus\n * @returns {Promise}\n */\n\n\n const restoreActiveElement = returnFocus => {\n return new Promise(resolve => {\n if (!returnFocus) {\n return resolve();\n }\n\n const x = window.scrollX;\n const y = window.scrollY;\n globalState.restoreFocusTimeout = setTimeout(() => {\n focusPreviousActiveElement();\n resolve();\n }, RESTORE_FOCUS_TIMEOUT); // issues/900\n\n window.scrollTo(x, y);\n });\n };\n\n /**\n * Detect Node env\n *\n * @returns {boolean}\n */\n const isNodeEnv = () => typeof window === 'undefined' || typeof document === 'undefined';\n\n const 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\").replace(/(^|\\n)\\s*/g, '');\n /**\n * @returns {boolean}\n */\n\n const resetOldContainer = () => {\n const oldContainer = getContainer();\n\n if (!oldContainer) {\n return false;\n }\n\n oldContainer.remove();\n removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]);\n return true;\n };\n\n const resetValidationMessage = () => {\n globalState.currentInstance.resetValidationMessage();\n };\n\n const addInputChangeListeners = () => {\n const popup = getPopup();\n const input = getDirectChildByClass(popup, swalClasses.input);\n const file = getDirectChildByClass(popup, swalClasses.file);\n /** @type {HTMLInputElement} */\n\n const range = popup.querySelector(\".\".concat(swalClasses.range, \" input\"));\n /** @type {HTMLOutputElement} */\n\n const rangeOutput = popup.querySelector(\".\".concat(swalClasses.range, \" output\"));\n const select = getDirectChildByClass(popup, swalClasses.select);\n /** @type {HTMLInputElement} */\n\n const checkbox = popup.querySelector(\".\".concat(swalClasses.checkbox, \" input\"));\n const textarea = getDirectChildByClass(popup, swalClasses.textarea);\n input.oninput = resetValidationMessage;\n file.onchange = resetValidationMessage;\n select.onchange = resetValidationMessage;\n checkbox.onchange = resetValidationMessage;\n textarea.oninput = resetValidationMessage;\n\n range.oninput = () => {\n resetValidationMessage();\n rangeOutput.value = range.value;\n };\n\n range.onchange = () => {\n resetValidationMessage();\n rangeOutput.value = range.value;\n };\n };\n /**\n * @param {string | HTMLElement} target\n * @returns {HTMLElement}\n */\n\n\n const getTarget = target => typeof target === 'string' ? document.querySelector(target) : target;\n /**\n * @param {SweetAlertOptions} params\n */\n\n\n const setupAccessibility = params => {\n const popup = getPopup();\n popup.setAttribute('role', params.toast ? 'alert' : 'dialog');\n popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');\n\n if (!params.toast) {\n popup.setAttribute('aria-modal', 'true');\n }\n };\n /**\n * @param {HTMLElement} targetElement\n */\n\n\n const setupRTL = targetElement => {\n if (window.getComputedStyle(targetElement).direction === 'rtl') {\n addClass(getContainer(), swalClasses.rtl);\n }\n };\n /**\n * Add modal + backdrop + no-war message for Russians to DOM\n *\n * @param {SweetAlertOptions} params\n */\n\n\n const init = params => {\n // Clean up the old popup container if it exists\n const oldContainerExisted = resetOldContainer();\n /* istanbul ignore if */\n\n if (isNodeEnv()) {\n error('SweetAlert2 requires document to initialize');\n return;\n }\n\n const container = document.createElement('div');\n container.className = swalClasses.container;\n\n if (oldContainerExisted) {\n addClass(container, swalClasses['no-transition']);\n }\n\n setInnerHtml(container, sweetHTML);\n const targetElement = getTarget(params.target);\n targetElement.appendChild(container);\n setupAccessibility(params);\n setupRTL(targetElement);\n addInputChangeListeners();\n };\n\n /**\n * @param {HTMLElement | object | string} param\n * @param {HTMLElement} target\n */\n\n const parseHtmlToContainer = (param, target) => {\n // DOM element\n if (param instanceof HTMLElement) {\n target.appendChild(param);\n } // Object\n else if (typeof param === 'object') {\n handleObject(param, target);\n } // Plain string\n else if (param) {\n setInnerHtml(target, param);\n }\n };\n /**\n * @param {object} param\n * @param {HTMLElement} target\n */\n\n const handleObject = (param, target) => {\n // JQuery element(s)\n if (param.jquery) {\n handleJqueryElem(target, param);\n } // For other objects use their string representation\n else {\n setInnerHtml(target, param.toString());\n }\n };\n /**\n * @param {HTMLElement} target\n * @param {HTMLElement} elem\n */\n\n\n const handleJqueryElem = (target, elem) => {\n target.textContent = '';\n\n if (0 in elem) {\n for (let i = 0; (i in elem); i++) {\n target.appendChild(elem[i].cloneNode(true));\n }\n } else {\n target.appendChild(elem.cloneNode(true));\n }\n };\n\n /**\n * @returns {'webkitAnimationEnd' | 'animationend' | false}\n */\n\n const animationEndEvent = (() => {\n // Prevent run in Node env\n\n /* istanbul ignore if */\n if (isNodeEnv()) {\n return false;\n }\n\n const testEl = document.createElement('div');\n const transEndEventNames = {\n WebkitAnimation: 'webkitAnimationEnd',\n // Chrome, Safari and Opera\n animation: 'animationend' // Standard syntax\n\n };\n\n for (const i in transEndEventNames) {\n if (Object.prototype.hasOwnProperty.call(transEndEventNames, i) && typeof testEl.style[i] !== 'undefined') {\n return transEndEventNames[i];\n }\n }\n\n return false;\n })();\n\n /**\n * Measure scrollbar width for padding body during modal show/hide\n * https://github.com/twbs/bootstrap/blob/master/js/src/modal.js\n *\n * @returns {number}\n */\n\n const measureScrollbar = () => {\n const scrollDiv = document.createElement('div');\n scrollDiv.className = swalClasses['scrollbar-measure'];\n document.body.appendChild(scrollDiv);\n const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarWidth;\n };\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderActions = (instance, params) => {\n const actions = getActions();\n const loader = getLoader(); // Actions (buttons) wrapper\n\n if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) {\n hide(actions);\n } else {\n show(actions);\n } // Custom class\n\n\n applyCustomClass(actions, params, 'actions'); // Render all the buttons\n\n renderButtons(actions, loader, params); // Loader\n\n setInnerHtml(loader, params.loaderHtml);\n applyCustomClass(loader, params, 'loader');\n };\n /**\n * @param {HTMLElement} actions\n * @param {HTMLElement} loader\n * @param {SweetAlertOptions} params\n */\n\n function renderButtons(actions, loader, params) {\n const confirmButton = getConfirmButton();\n const denyButton = getDenyButton();\n const cancelButton = getCancelButton(); // Render buttons\n\n renderButton(confirmButton, 'confirm', params);\n renderButton(denyButton, 'deny', params);\n renderButton(cancelButton, 'cancel', params);\n handleButtonsStyling(confirmButton, denyButton, cancelButton, params);\n\n if (params.reverseButtons) {\n if (params.toast) {\n actions.insertBefore(cancelButton, confirmButton);\n actions.insertBefore(denyButton, confirmButton);\n } else {\n actions.insertBefore(cancelButton, loader);\n actions.insertBefore(denyButton, loader);\n actions.insertBefore(confirmButton, loader);\n }\n }\n }\n /**\n * @param {HTMLElement} confirmButton\n * @param {HTMLElement} denyButton\n * @param {HTMLElement} cancelButton\n * @param {SweetAlertOptions} params\n */\n\n\n function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) {\n if (!params.buttonsStyling) {\n return removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled);\n }\n\n addClass([confirmButton, denyButton, cancelButton], swalClasses.styled); // Buttons background colors\n\n if (params.confirmButtonColor) {\n confirmButton.style.backgroundColor = params.confirmButtonColor;\n addClass(confirmButton, swalClasses['default-outline']);\n }\n\n if (params.denyButtonColor) {\n denyButton.style.backgroundColor = params.denyButtonColor;\n addClass(denyButton, swalClasses['default-outline']);\n }\n\n if (params.cancelButtonColor) {\n cancelButton.style.backgroundColor = params.cancelButtonColor;\n addClass(cancelButton, swalClasses['default-outline']);\n }\n }\n /**\n * @param {HTMLElement} button\n * @param {'confirm' | 'deny' | 'cancel'} buttonType\n * @param {SweetAlertOptions} params\n */\n\n\n function renderButton(button, buttonType, params) {\n toggle(button, params[\"show\".concat(capitalizeFirstLetter(buttonType), \"Button\")], 'inline-block');\n setInnerHtml(button, params[\"\".concat(buttonType, \"ButtonText\")]); // Set caption text\n\n button.setAttribute('aria-label', params[\"\".concat(buttonType, \"ButtonAriaLabel\")]); // ARIA label\n // Add buttons custom classes\n\n button.className = swalClasses[buttonType];\n applyCustomClass(button, params, \"\".concat(buttonType, \"Button\"));\n addClass(button, params[\"\".concat(buttonType, \"ButtonClass\")]);\n }\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderCloseButton = (instance, params) => {\n const closeButton = getCloseButton();\n setInnerHtml(closeButton, params.closeButtonHtml); // Custom class\n\n applyCustomClass(closeButton, params, 'closeButton');\n toggle(closeButton, params.showCloseButton);\n closeButton.setAttribute('aria-label', params.closeButtonAriaLabel);\n };\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderContainer = (instance, params) => {\n const container = getContainer();\n\n if (!container) {\n return;\n }\n\n handleBackdropParam(container, params.backdrop);\n handlePositionParam(container, params.position);\n handleGrowParam(container, params.grow); // Custom class\n\n applyCustomClass(container, params, 'container');\n };\n /**\n * @param {HTMLElement} container\n * @param {SweetAlertOptions['backdrop']} backdrop\n */\n\n function handleBackdropParam(container, backdrop) {\n if (typeof backdrop === 'string') {\n container.style.background = backdrop;\n } else if (!backdrop) {\n addClass([document.documentElement, document.body], swalClasses['no-backdrop']);\n }\n }\n /**\n * @param {HTMLElement} container\n * @param {SweetAlertOptions['position']} position\n */\n\n\n function handlePositionParam(container, position) {\n if (position in swalClasses) {\n addClass(container, swalClasses[position]);\n } else {\n warn('The \"position\" parameter is not valid, defaulting to \"center\"');\n addClass(container, swalClasses.center);\n }\n }\n /**\n * @param {HTMLElement} container\n * @param {SweetAlertOptions['grow']} grow\n */\n\n\n function handleGrowParam(container, grow) {\n if (grow && typeof grow === 'string') {\n const growClass = \"grow-\".concat(grow);\n\n if (growClass in swalClasses) {\n addClass(container, swalClasses[growClass]);\n }\n }\n }\n\n /// \n /** @type {InputClass[]} */\n\n const inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderInput = (instance, params) => {\n const popup = getPopup();\n const innerParams = privateProps.innerParams.get(instance);\n const rerender = !innerParams || params.input !== innerParams.input;\n inputClasses.forEach(inputClass => {\n const inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]); // set attributes\n\n setAttributes(inputClass, params.inputAttributes); // set class\n\n inputContainer.className = swalClasses[inputClass];\n\n if (rerender) {\n hide(inputContainer);\n }\n });\n\n if (params.input) {\n if (rerender) {\n showInput(params);\n } // set custom class\n\n\n setCustomClass(params);\n }\n };\n /**\n * @param {SweetAlertOptions} params\n */\n\n const showInput = params => {\n if (!renderInputType[params.input]) {\n return error(\"Unexpected type of input! Expected \\\"text\\\", \\\"email\\\", \\\"password\\\", \\\"number\\\", \\\"tel\\\", \\\"select\\\", \\\"radio\\\", \\\"checkbox\\\", \\\"textarea\\\", \\\"file\\\" or \\\"url\\\", got \\\"\".concat(params.input, \"\\\"\"));\n }\n\n const inputContainer = getInputContainer(params.input);\n const input = renderInputType[params.input](inputContainer, params);\n show(inputContainer); // input autofocus\n\n setTimeout(() => {\n focusInput(input);\n });\n };\n /**\n * @param {HTMLInputElement} input\n */\n\n\n const removeAttributes = input => {\n for (let i = 0; i < input.attributes.length; i++) {\n const attrName = input.attributes[i].name;\n\n if (!['type', 'value', 'style'].includes(attrName)) {\n input.removeAttribute(attrName);\n }\n }\n };\n /**\n * @param {InputClass} inputClass\n * @param {SweetAlertOptions['inputAttributes']} inputAttributes\n */\n\n\n const setAttributes = (inputClass, inputAttributes) => {\n const input = getInput(getPopup(), inputClass);\n\n if (!input) {\n return;\n }\n\n removeAttributes(input);\n\n for (const attr in inputAttributes) {\n input.setAttribute(attr, inputAttributes[attr]);\n }\n };\n /**\n * @param {SweetAlertOptions} params\n */\n\n\n const setCustomClass = params => {\n const inputContainer = getInputContainer(params.input);\n\n if (typeof params.customClass === 'object') {\n addClass(inputContainer, params.customClass.input);\n }\n };\n /**\n * @param {HTMLInputElement | HTMLTextAreaElement} input\n * @param {SweetAlertOptions} params\n */\n\n\n const setInputPlaceholder = (input, params) => {\n if (!input.placeholder || params.inputPlaceholder) {\n input.placeholder = params.inputPlaceholder;\n }\n };\n /**\n * @param {Input} input\n * @param {Input} prependTo\n * @param {SweetAlertOptions} params\n */\n\n\n const setInputLabel = (input, prependTo, params) => {\n if (params.inputLabel) {\n input.id = swalClasses.input;\n const label = document.createElement('label');\n const labelClass = swalClasses['input-label'];\n label.setAttribute('for', input.id);\n label.className = labelClass;\n\n if (typeof params.customClass === 'object') {\n addClass(label, params.customClass.inputLabel);\n }\n\n label.innerText = params.inputLabel;\n prependTo.insertAdjacentElement('beforebegin', label);\n }\n };\n /**\n * @param {SweetAlertOptions['input']} inputType\n * @returns {HTMLElement}\n */\n\n\n const getInputContainer = inputType => {\n return getDirectChildByClass(getPopup(), swalClasses[inputType] || swalClasses.input);\n };\n /**\n * @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input\n * @param {SweetAlertOptions['inputValue']} inputValue\n */\n\n\n const checkAndSetInputValue = (input, inputValue) => {\n if (['string', 'number'].includes(typeof inputValue)) {\n input.value = \"\".concat(inputValue);\n } else if (!isPromise(inputValue)) {\n warn(\"Unexpected type of inputValue! Expected \\\"string\\\", \\\"number\\\" or \\\"Promise\\\", got \\\"\".concat(typeof inputValue, \"\\\"\"));\n }\n };\n /** @type Record Input> */\n\n\n const renderInputType = {};\n /**\n * @param {HTMLInputElement} input\n * @param {SweetAlertOptions} params\n * @returns {HTMLInputElement}\n */\n\n renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = (input, params) => {\n checkAndSetInputValue(input, params.inputValue);\n setInputLabel(input, input, params);\n setInputPlaceholder(input, params);\n input.type = params.input;\n return input;\n };\n /**\n * @param {HTMLInputElement} input\n * @param {SweetAlertOptions} params\n * @returns {HTMLInputElement}\n */\n\n\n renderInputType.file = (input, params) => {\n setInputLabel(input, input, params);\n setInputPlaceholder(input, params);\n return input;\n };\n /**\n * @param {HTMLInputElement} range\n * @param {SweetAlertOptions} params\n * @returns {HTMLInputElement}\n */\n\n\n renderInputType.range = (range, params) => {\n const rangeInput = range.querySelector('input');\n const rangeOutput = range.querySelector('output');\n checkAndSetInputValue(rangeInput, params.inputValue);\n rangeInput.type = params.input;\n checkAndSetInputValue(rangeOutput, params.inputValue);\n setInputLabel(rangeInput, range, params);\n return range;\n };\n /**\n * @param {HTMLSelectElement} select\n * @param {SweetAlertOptions} params\n * @returns {HTMLSelectElement}\n */\n\n\n renderInputType.select = (select, params) => {\n select.textContent = '';\n\n if (params.inputPlaceholder) {\n const placeholder = document.createElement('option');\n setInnerHtml(placeholder, params.inputPlaceholder);\n placeholder.value = '';\n placeholder.disabled = true;\n placeholder.selected = true;\n select.appendChild(placeholder);\n }\n\n setInputLabel(select, select, params);\n return select;\n };\n /**\n * @param {HTMLInputElement} radio\n * @returns {HTMLInputElement}\n */\n\n\n renderInputType.radio = radio => {\n radio.textContent = '';\n return radio;\n };\n /**\n * @param {HTMLLabelElement} checkboxContainer\n * @param {SweetAlertOptions} params\n * @returns {HTMLInputElement}\n */\n\n\n renderInputType.checkbox = (checkboxContainer, params) => {\n const checkbox = getInput(getPopup(), 'checkbox');\n checkbox.value = '1';\n checkbox.id = swalClasses.checkbox;\n checkbox.checked = Boolean(params.inputValue);\n const label = checkboxContainer.querySelector('span');\n setInnerHtml(label, params.inputPlaceholder);\n return checkbox;\n };\n /**\n * @param {HTMLTextAreaElement} textarea\n * @param {SweetAlertOptions} params\n * @returns {HTMLTextAreaElement}\n */\n\n\n renderInputType.textarea = (textarea, params) => {\n checkAndSetInputValue(textarea, params.inputValue);\n setInputPlaceholder(textarea, params);\n setInputLabel(textarea, textarea, params);\n /**\n * @param {HTMLElement} el\n * @returns {number}\n */\n\n const getMargin = el => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight); // https://github.com/sweetalert2/sweetalert2/issues/2291\n\n\n setTimeout(() => {\n // https://github.com/sweetalert2/sweetalert2/issues/1699\n if ('MutationObserver' in window) {\n const initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width);\n\n const textareaResizeHandler = () => {\n const textareaWidth = textarea.offsetWidth + getMargin(textarea);\n\n if (textareaWidth > initialPopupWidth) {\n getPopup().style.width = \"\".concat(textareaWidth, \"px\");\n } else {\n getPopup().style.width = null;\n }\n };\n\n new MutationObserver(textareaResizeHandler).observe(textarea, {\n attributes: true,\n attributeFilter: ['style']\n });\n }\n });\n return textarea;\n };\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderContent = (instance, params) => {\n const htmlContainer = getHtmlContainer();\n applyCustomClass(htmlContainer, params, 'htmlContainer'); // Content as HTML\n\n if (params.html) {\n parseHtmlToContainer(params.html, htmlContainer);\n show(htmlContainer, 'block');\n } // Content as plain text\n else if (params.text) {\n htmlContainer.textContent = params.text;\n show(htmlContainer, 'block');\n } // No content\n else {\n hide(htmlContainer);\n }\n\n renderInput(instance, params);\n };\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderFooter = (instance, params) => {\n const footer = getFooter();\n toggle(footer, params.footer);\n\n if (params.footer) {\n parseHtmlToContainer(params.footer, footer);\n } // Custom class\n\n\n applyCustomClass(footer, params, 'footer');\n };\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderIcon = (instance, params) => {\n const innerParams = privateProps.innerParams.get(instance);\n const icon = getIcon(); // if the given icon already rendered, apply the styling without re-rendering the icon\n\n if (innerParams && params.icon === innerParams.icon) {\n // Custom or default content\n setContent(icon, params);\n applyStyles(icon, params);\n return;\n }\n\n if (!params.icon && !params.iconHtml) {\n hide(icon);\n return;\n }\n\n if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) {\n error(\"Unknown icon! Expected \\\"success\\\", \\\"error\\\", \\\"warning\\\", \\\"info\\\" or \\\"question\\\", got \\\"\".concat(params.icon, \"\\\"\"));\n hide(icon);\n return;\n }\n\n show(icon); // Custom or default content\n\n setContent(icon, params);\n applyStyles(icon, params); // Animate icon\n\n addClass(icon, params.showClass.icon);\n };\n /**\n * @param {HTMLElement} icon\n * @param {SweetAlertOptions} params\n */\n\n const applyStyles = (icon, params) => {\n for (const iconType in iconTypes) {\n if (params.icon !== iconType) {\n removeClass(icon, iconTypes[iconType]);\n }\n }\n\n addClass(icon, iconTypes[params.icon]); // Icon color\n\n setColor(icon, params); // Success icon background color\n\n adjustSuccessIconBackgroundColor(); // Custom class\n\n applyCustomClass(icon, params, 'icon');\n }; // Adjust success icon background color to match the popup background color\n\n\n const adjustSuccessIconBackgroundColor = () => {\n const popup = getPopup();\n const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');\n /** @type {NodeListOf} */\n\n const successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');\n\n for (let i = 0; i < successIconParts.length; i++) {\n successIconParts[i].style.backgroundColor = popupBackgroundColor;\n }\n };\n\n const successIconHtml = \"\\n
\\n \\n
\\n
\\n\";\n const errorIconHtml = \"\\n \\n \\n \\n \\n\";\n /**\n * @param {HTMLElement} icon\n * @param {SweetAlertOptions} params\n */\n\n const setContent = (icon, params) => {\n let oldContent = icon.innerHTML;\n let newContent;\n\n if (params.iconHtml) {\n newContent = iconContent(params.iconHtml);\n } else if (params.icon === 'success') {\n newContent = successIconHtml;\n oldContent = oldContent.replace(/ style=\".*?\"/g, ''); // undo adjustSuccessIconBackgroundColor()\n } else if (params.icon === 'error') {\n newContent = errorIconHtml;\n } else {\n const defaultIconHtml = {\n question: '?',\n warning: '!',\n info: 'i'\n };\n newContent = iconContent(defaultIconHtml[params.icon]);\n }\n\n if (oldContent.trim() !== newContent.trim()) {\n setInnerHtml(icon, newContent);\n }\n };\n /**\n * @param {HTMLElement} icon\n * @param {SweetAlertOptions} params\n */\n\n\n const setColor = (icon, params) => {\n if (!params.iconColor) {\n return;\n }\n\n icon.style.color = params.iconColor;\n icon.style.borderColor = params.iconColor;\n\n for (const sel of ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']) {\n setStyle(icon, sel, 'backgroundColor', params.iconColor);\n }\n\n setStyle(icon, '.swal2-success-ring', 'borderColor', params.iconColor);\n };\n /**\n * @param {string} content\n * @returns {string}\n */\n\n\n const iconContent = content => \"
\").concat(content, \"
\");\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderImage = (instance, params) => {\n const image = getImage();\n\n if (!params.imageUrl) {\n return hide(image);\n }\n\n show(image, ''); // Src, alt\n\n image.setAttribute('src', params.imageUrl);\n image.setAttribute('alt', params.imageAlt); // Width, height\n\n applyNumericalStyle(image, 'width', params.imageWidth);\n applyNumericalStyle(image, 'height', params.imageHeight); // Class\n\n image.className = swalClasses.image;\n applyCustomClass(image, params, 'image');\n };\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderPopup = (instance, params) => {\n const container = getContainer();\n const popup = getPopup(); // Width\n // https://github.com/sweetalert2/sweetalert2/issues/2170\n\n if (params.toast) {\n applyNumericalStyle(container, 'width', params.width);\n popup.style.width = '100%';\n popup.insertBefore(getLoader(), getIcon());\n } else {\n applyNumericalStyle(popup, 'width', params.width);\n } // Padding\n\n\n applyNumericalStyle(popup, 'padding', params.padding); // Color\n\n if (params.color) {\n popup.style.color = params.color;\n } // Background\n\n\n if (params.background) {\n popup.style.background = params.background;\n }\n\n hide(getValidationMessage()); // Classes\n\n addClasses(popup, params);\n };\n /**\n * @param {HTMLElement} popup\n * @param {SweetAlertOptions} params\n */\n\n const addClasses = (popup, params) => {\n // Default Class + showClass when updating Swal.update({})\n popup.className = \"\".concat(swalClasses.popup, \" \").concat(isVisible(popup) ? params.showClass.popup : '');\n\n if (params.toast) {\n addClass([document.documentElement, document.body], swalClasses['toast-shown']);\n addClass(popup, swalClasses.toast);\n } else {\n addClass(popup, swalClasses.modal);\n } // Custom class\n\n\n applyCustomClass(popup, params, 'popup');\n\n if (typeof params.customClass === 'string') {\n addClass(popup, params.customClass);\n } // Icon class (#1842)\n\n\n if (params.icon) {\n addClass(popup, swalClasses[\"icon-\".concat(params.icon)]);\n }\n };\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderProgressSteps = (instance, params) => {\n const progressStepsContainer = getProgressSteps();\n\n if (!params.progressSteps || params.progressSteps.length === 0) {\n return hide(progressStepsContainer);\n }\n\n show(progressStepsContainer);\n progressStepsContainer.textContent = '';\n\n if (params.currentProgressStep >= params.progressSteps.length) {\n warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');\n }\n\n params.progressSteps.forEach((step, index) => {\n const stepEl = createStepElement(step);\n progressStepsContainer.appendChild(stepEl);\n\n if (index === params.currentProgressStep) {\n addClass(stepEl, swalClasses['active-progress-step']);\n }\n\n if (index !== params.progressSteps.length - 1) {\n const lineEl = createLineElement(params);\n progressStepsContainer.appendChild(lineEl);\n }\n });\n };\n /**\n * @param {string} step\n * @returns {HTMLLIElement}\n */\n\n const createStepElement = step => {\n const stepEl = document.createElement('li');\n addClass(stepEl, swalClasses['progress-step']);\n setInnerHtml(stepEl, step);\n return stepEl;\n };\n /**\n * @param {SweetAlertOptions} params\n * @returns {HTMLLIElement}\n */\n\n\n const createLineElement = params => {\n const lineEl = document.createElement('li');\n addClass(lineEl, swalClasses['progress-step-line']);\n\n if (params.progressStepsDistance) {\n applyNumericalStyle(lineEl, 'width', params.progressStepsDistance);\n }\n\n return lineEl;\n };\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const renderTitle = (instance, params) => {\n const title = getTitle();\n toggle(title, params.title || params.titleText, 'block');\n\n if (params.title) {\n parseHtmlToContainer(params.title, title);\n }\n\n if (params.titleText) {\n title.innerText = params.titleText;\n } // Custom class\n\n\n applyCustomClass(title, params, 'title');\n };\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const render = (instance, params) => {\n renderPopup(instance, params);\n renderContainer(instance, params);\n renderProgressSteps(instance, params);\n renderIcon(instance, params);\n renderImage(instance, params);\n renderTitle(instance, params);\n renderCloseButton(instance, params);\n renderContent(instance, params);\n renderActions(instance, params);\n renderFooter(instance, params);\n\n if (typeof params.didRender === 'function') {\n params.didRender(getPopup());\n }\n };\n\n /**\n * Hides loader and shows back the button which was hidden by .showLoading()\n */\n\n function hideLoading() {\n // do nothing if popup is closed\n const innerParams = privateProps.innerParams.get(this);\n\n if (!innerParams) {\n return;\n }\n\n const domCache = privateProps.domCache.get(this);\n hide(domCache.loader);\n\n if (isToast()) {\n if (innerParams.icon) {\n show(getIcon());\n }\n } else {\n showRelatedButton(domCache);\n }\n\n removeClass([domCache.popup, domCache.actions], swalClasses.loading);\n domCache.popup.removeAttribute('aria-busy');\n domCache.popup.removeAttribute('data-loading');\n domCache.confirmButton.disabled = false;\n domCache.denyButton.disabled = false;\n domCache.cancelButton.disabled = false;\n }\n\n const showRelatedButton = domCache => {\n const buttonToReplace = domCache.popup.getElementsByClassName(domCache.loader.getAttribute('data-button-to-replace'));\n\n if (buttonToReplace.length) {\n show(buttonToReplace[0], 'inline-block');\n } else if (allButtonsAreHidden()) {\n hide(domCache.actions);\n }\n };\n\n /**\n * Gets the input DOM node, this method works with input parameter.\n * @returns {HTMLElement | null}\n */\n\n function getInput$1(instance) {\n const innerParams = privateProps.innerParams.get(instance || this);\n const domCache = privateProps.domCache.get(instance || this);\n\n if (!domCache) {\n return null;\n }\n\n return getInput(domCache.popup, innerParams.input);\n }\n\n /*\n * Global function to determine if SweetAlert2 popup is shown\n */\n\n const isVisible$1 = () => {\n return isVisible(getPopup());\n };\n /*\n * Global function to click 'Confirm' button\n */\n\n const clickConfirm = () => getConfirmButton() && getConfirmButton().click();\n /*\n * Global function to click 'Deny' button\n */\n\n const clickDeny = () => getDenyButton() && getDenyButton().click();\n /*\n * Global function to click 'Cancel' button\n */\n\n const clickCancel = () => getCancelButton() && getCancelButton().click();\n\n const DismissReason = Object.freeze({\n cancel: 'cancel',\n backdrop: 'backdrop',\n close: 'close',\n esc: 'esc',\n timer: 'timer'\n });\n\n /**\n * @param {GlobalState} globalState\n */\n\n const removeKeydownHandler = globalState => {\n if (globalState.keydownTarget && globalState.keydownHandlerAdded) {\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n };\n /**\n * @param {SweetAlert2} instance\n * @param {GlobalState} globalState\n * @param {SweetAlertOptions} innerParams\n * @param {*} dismissWith\n */\n\n const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {\n removeKeydownHandler(globalState);\n\n if (!innerParams.toast) {\n globalState.keydownHandler = e => keydownHandler(instance, e, dismissWith);\n\n globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup();\n globalState.keydownListenerCapture = innerParams.keydownListenerCapture;\n globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = true;\n }\n };\n /**\n * @param {SweetAlertOptions} innerParams\n * @param {number} index\n * @param {number} increment\n */\n\n const setFocus = (innerParams, index, increment) => {\n const focusableElements = getFocusableElements(); // search for visible elements and select the next possible match\n\n if (focusableElements.length) {\n index = index + increment; // rollover to first item\n\n if (index === focusableElements.length) {\n index = 0; // go to last item\n } else if (index === -1) {\n index = focusableElements.length - 1;\n }\n\n return focusableElements[index].focus();\n } // no visible focusable elements, focus the popup\n\n\n getPopup().focus();\n };\n const arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];\n const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];\n /**\n * @param {SweetAlert2} instance\n * @param {KeyboardEvent} e\n * @param {function} dismissWith\n */\n\n const keydownHandler = (instance, e, dismissWith) => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams) {\n return; // This instance has already been destroyed\n } // Ignore keydown during IME composition\n // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition\n // https://github.com/sweetalert2/sweetalert2/issues/720\n // https://github.com/sweetalert2/sweetalert2/issues/2406\n\n\n if (e.isComposing || e.keyCode === 229) {\n return;\n }\n\n if (innerParams.stopKeydownPropagation) {\n e.stopPropagation();\n } // ENTER\n\n\n if (e.key === 'Enter') {\n handleEnter(instance, e, innerParams);\n } // TAB\n else if (e.key === 'Tab') {\n handleTab(e, innerParams);\n } // ARROWS - switch focus between buttons\n else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(e.key)) {\n handleArrows(e.key);\n } // ESC\n else if (e.key === 'Escape') {\n handleEsc(e, innerParams, dismissWith);\n }\n };\n /**\n * @param {SweetAlert2} instance\n * @param {KeyboardEvent} e\n * @param {SweetAlertOptions} innerParams\n */\n\n\n const handleEnter = (instance, e, innerParams) => {\n // https://github.com/sweetalert2/sweetalert2/issues/2386\n if (!callIfFunction(innerParams.allowEnterKey)) {\n return;\n }\n\n if (e.target && instance.getInput() && e.target instanceof HTMLElement && e.target.outerHTML === instance.getInput().outerHTML) {\n if (['textarea', 'file'].includes(innerParams.input)) {\n return; // do not submit\n }\n\n clickConfirm();\n e.preventDefault();\n }\n };\n /**\n * @param {KeyboardEvent} e\n * @param {SweetAlertOptions} innerParams\n */\n\n\n const handleTab = (e, innerParams) => {\n const targetElement = e.target;\n const focusableElements = getFocusableElements();\n let btnIndex = -1;\n\n for (let i = 0; i < focusableElements.length; i++) {\n if (targetElement === focusableElements[i]) {\n btnIndex = i;\n break;\n }\n } // Cycle to the next button\n\n\n if (!e.shiftKey) {\n setFocus(innerParams, btnIndex, 1);\n } // Cycle to the prev button\n else {\n setFocus(innerParams, btnIndex, -1);\n }\n\n e.stopPropagation();\n e.preventDefault();\n };\n /**\n * @param {string} key\n */\n\n\n const handleArrows = key => {\n const confirmButton = getConfirmButton();\n const denyButton = getDenyButton();\n const cancelButton = getCancelButton();\n\n if (document.activeElement instanceof HTMLElement && ![confirmButton, denyButton, cancelButton].includes(document.activeElement)) {\n return;\n }\n\n const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';\n let buttonToFocus = document.activeElement;\n\n for (let i = 0; i < getActions().children.length; i++) {\n buttonToFocus = buttonToFocus[sibling];\n\n if (!buttonToFocus) {\n return;\n }\n\n if (buttonToFocus instanceof HTMLButtonElement && isVisible(buttonToFocus)) {\n break;\n }\n }\n\n if (buttonToFocus instanceof HTMLButtonElement) {\n buttonToFocus.focus();\n }\n };\n /**\n * @param {KeyboardEvent} e\n * @param {SweetAlertOptions} innerParams\n * @param {function} dismissWith\n */\n\n\n const handleEsc = (e, innerParams, dismissWith) => {\n if (callIfFunction(innerParams.allowEscapeKey)) {\n e.preventDefault();\n dismissWith(DismissReason.esc);\n }\n };\n\n /**\n * This module contains `WeakMap`s for each effectively-\"private property\" that a `Swal` has.\n * For example, to set the private property \"foo\" of `this` to \"bar\", you can `privateProps.foo.set(this, 'bar')`\n * This is the approach that Babel will probably take to implement private methods/fields\n * https://github.com/tc39/proposal-private-methods\n * https://github.com/babel/babel/pull/7555\n * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*\n * then we can use that language feature.\n */\n var privateMethods = {\n swalPromiseResolve: new WeakMap(),\n swalPromiseReject: new WeakMap()\n };\n\n // Adding aria-hidden=\"true\" to elements outside of the active modal dialog ensures that\n // elements not within the active modal dialog will not be surfaced if a user opens a screen\n // reader’s list of elements (headings, form controls, landmarks, etc.) in the document.\n\n const setAriaHidden = () => {\n const bodyChildren = Array.from(document.body.children);\n bodyChildren.forEach(el => {\n if (el === getContainer() || el.contains(getContainer())) {\n return;\n }\n\n if (el.hasAttribute('aria-hidden')) {\n el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden'));\n }\n\n el.setAttribute('aria-hidden', 'true');\n });\n };\n const unsetAriaHidden = () => {\n const bodyChildren = Array.from(document.body.children);\n bodyChildren.forEach(el => {\n if (el.hasAttribute('data-previous-aria-hidden')) {\n el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden'));\n el.removeAttribute('data-previous-aria-hidden');\n } else {\n el.removeAttribute('aria-hidden');\n }\n });\n };\n\n /* istanbul ignore file */\n\n const iOSfix = () => {\n const iOS = // @ts-ignore\n /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;\n\n if (iOS && !hasClass(document.body, swalClasses.iosfix)) {\n const offset = document.body.scrollTop;\n document.body.style.top = \"\".concat(offset * -1, \"px\");\n addClass(document.body, swalClasses.iosfix);\n lockBodyScroll();\n addBottomPaddingForTallPopups();\n }\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1948\n */\n\n const addBottomPaddingForTallPopups = () => {\n const ua = navigator.userAgent;\n const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i);\n const webkit = !!ua.match(/WebKit/i);\n const iOSSafari = iOS && webkit && !ua.match(/CriOS/i);\n\n if (iOSSafari) {\n const bottomPanelHeight = 44;\n\n if (getPopup().scrollHeight > window.innerHeight - bottomPanelHeight) {\n getContainer().style.paddingBottom = \"\".concat(bottomPanelHeight, \"px\");\n }\n }\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1246\n */\n\n\n const lockBodyScroll = () => {\n const container = getContainer();\n let preventTouchMove;\n /**\n * @param {TouchEvent} e\n */\n\n container.ontouchstart = e => {\n preventTouchMove = shouldPreventTouchMove(e);\n };\n /**\n * @param {TouchEvent} e\n */\n\n\n container.ontouchmove = e => {\n if (preventTouchMove) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n };\n /**\n * @param {TouchEvent} event\n * @returns {boolean}\n */\n\n\n const shouldPreventTouchMove = event => {\n const target = event.target;\n const container = getContainer();\n\n if (isStylus(event) || isZoom(event)) {\n return false;\n }\n\n if (target === container) {\n return true;\n }\n\n if (!isScrollable(container) && target instanceof HTMLElement && target.tagName !== 'INPUT' && // #1603\n target.tagName !== 'TEXTAREA' && // #2266\n !(isScrollable(getHtmlContainer()) && // #1944\n getHtmlContainer().contains(target))) {\n return true;\n }\n\n return false;\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1786\n *\n * @param {*} event\n * @returns {boolean}\n */\n\n\n const isStylus = event => {\n return event.touches && event.touches.length && event.touches[0].touchType === 'stylus';\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1891\n *\n * @param {TouchEvent} event\n * @returns {boolean}\n */\n\n\n const isZoom = event => {\n return event.touches && event.touches.length > 1;\n };\n\n const undoIOSfix = () => {\n if (hasClass(document.body, swalClasses.iosfix)) {\n const offset = parseInt(document.body.style.top, 10);\n removeClass(document.body, swalClasses.iosfix);\n document.body.style.top = '';\n document.body.scrollTop = offset * -1;\n }\n };\n\n const fixScrollbar = () => {\n // for queues, do not do this more than once\n if (states.previousBodyPadding !== null) {\n return;\n } // if the body has overflow\n\n\n if (document.body.scrollHeight > window.innerHeight) {\n // add padding so the content doesn't shift after removal of scrollbar\n states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'));\n document.body.style.paddingRight = \"\".concat(states.previousBodyPadding + measureScrollbar(), \"px\");\n }\n };\n const undoScrollbar = () => {\n if (states.previousBodyPadding !== null) {\n document.body.style.paddingRight = \"\".concat(states.previousBodyPadding, \"px\");\n states.previousBodyPadding = null;\n }\n };\n\n /*\n * Instance method to close sweetAlert\n */\n\n function removePopupAndResetState(instance, container, returnFocus, didClose) {\n if (isToast()) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose));\n removeKeydownHandler(globalState);\n }\n\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // workaround for #2088\n // for some reason removing the container in Safari will scroll the document to bottom\n\n if (isSafari) {\n container.setAttribute('style', 'display:none !important');\n container.removeAttribute('class');\n container.innerHTML = '';\n } else {\n container.remove();\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }\n\n function removeBodyClasses() {\n removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]);\n }\n\n function close(resolveValue) {\n resolveValue = prepareResolveValue(resolveValue);\n const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);\n const didClose = triggerClosePopup(this);\n\n if (this.isAwaitingPromise()) {\n // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335\n if (!resolveValue.isDismissed) {\n handleAwaitingPromise(this);\n swalPromiseResolve(resolveValue);\n }\n } else if (didClose) {\n // Resolve Swal promise\n swalPromiseResolve(resolveValue);\n }\n }\n function isAwaitingPromise() {\n return !!privateProps.awaitingPromise.get(this);\n }\n\n const triggerClosePopup = instance => {\n const popup = getPopup();\n\n if (!popup) {\n return false;\n }\n\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) {\n return false;\n }\n\n removeClass(popup, innerParams.showClass.popup);\n addClass(popup, innerParams.hideClass.popup);\n const backdrop = getContainer();\n removeClass(backdrop, innerParams.showClass.backdrop);\n addClass(backdrop, innerParams.hideClass.backdrop);\n handlePopupAnimation(instance, popup, innerParams);\n return true;\n };\n\n function rejectPromise(error) {\n const rejectPromise = privateMethods.swalPromiseReject.get(this);\n handleAwaitingPromise(this);\n\n if (rejectPromise) {\n // Reject Swal promise\n rejectPromise(error);\n }\n }\n const handleAwaitingPromise = instance => {\n if (instance.isAwaitingPromise()) {\n privateProps.awaitingPromise.delete(instance); // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335\n\n if (!privateProps.innerParams.get(instance)) {\n instance._destroy();\n }\n }\n };\n\n const prepareResolveValue = resolveValue => {\n // When user calls Swal.close()\n if (typeof resolveValue === 'undefined') {\n return {\n isConfirmed: false,\n isDenied: false,\n isDismissed: true\n };\n }\n\n return Object.assign({\n isConfirmed: false,\n isDenied: false,\n isDismissed: false\n }, resolveValue);\n };\n\n const handlePopupAnimation = (instance, popup, innerParams) => {\n const container = getContainer(); // If animation is supported, animate\n\n const animationIsSupported = animationEndEvent && hasCssAnimation(popup);\n\n if (typeof innerParams.willClose === 'function') {\n innerParams.willClose(popup);\n }\n\n if (animationIsSupported) {\n animatePopup(instance, popup, container, innerParams.returnFocus, innerParams.didClose);\n } else {\n // Otherwise, remove immediately\n removePopupAndResetState(instance, container, innerParams.returnFocus, innerParams.didClose);\n }\n };\n\n const animatePopup = (instance, popup, container, returnFocus, didClose) => {\n globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose);\n popup.addEventListener(animationEndEvent, function (e) {\n if (e.target === popup) {\n globalState.swalCloseEventFinishedCallback();\n delete globalState.swalCloseEventFinishedCallback;\n }\n });\n };\n\n const triggerDidCloseAndDispose = (instance, didClose) => {\n setTimeout(() => {\n if (typeof didClose === 'function') {\n didClose.bind(instance.params)();\n }\n\n instance._destroy();\n });\n };\n\n /**\n * @param {SweetAlert2} instance\n * @param {string[]} buttons\n * @param {boolean} disabled\n */\n\n function setButtonsDisabled(instance, buttons, disabled) {\n const domCache = privateProps.domCache.get(instance);\n buttons.forEach(button => {\n domCache[button].disabled = disabled;\n });\n }\n /**\n * @param {HTMLInputElement} input\n * @param {boolean} disabled\n */\n\n\n function setInputDisabled(input, disabled) {\n if (!input) {\n return;\n }\n\n if (input.type === 'radio') {\n const radiosContainer = input.parentNode.parentNode;\n const radios = radiosContainer.querySelectorAll('input');\n\n for (let i = 0; i < radios.length; i++) {\n radios[i].disabled = disabled;\n }\n } else {\n input.disabled = disabled;\n }\n }\n\n function enableButtons() {\n setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false);\n }\n function disableButtons() {\n setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true);\n }\n function enableInput() {\n setInputDisabled(this.getInput(), false);\n }\n function disableInput() {\n setInputDisabled(this.getInput(), true);\n }\n\n function showValidationMessage(error) {\n const domCache = privateProps.domCache.get(this);\n const params = privateProps.innerParams.get(this);\n setInnerHtml(domCache.validationMessage, error);\n domCache.validationMessage.className = swalClasses['validation-message'];\n\n if (params.customClass && params.customClass.validationMessage) {\n addClass(domCache.validationMessage, params.customClass.validationMessage);\n }\n\n show(domCache.validationMessage);\n const input = this.getInput();\n\n if (input) {\n input.setAttribute('aria-invalid', true);\n input.setAttribute('aria-describedby', swalClasses['validation-message']);\n focusInput(input);\n addClass(input, swalClasses.inputerror);\n }\n } // Hide block with validation message\n\n function resetValidationMessage$1() {\n const domCache = privateProps.domCache.get(this);\n\n if (domCache.validationMessage) {\n hide(domCache.validationMessage);\n }\n\n const input = this.getInput();\n\n if (input) {\n input.removeAttribute('aria-invalid');\n input.removeAttribute('aria-describedby');\n removeClass(input, swalClasses.inputerror);\n }\n }\n\n function getProgressSteps$1() {\n const domCache = privateProps.domCache.get(this);\n return domCache.progressSteps;\n }\n\n const defaultParams = {\n title: '',\n titleText: '',\n text: '',\n html: '',\n footer: '',\n icon: undefined,\n iconColor: undefined,\n iconHtml: undefined,\n template: undefined,\n toast: false,\n showClass: {\n popup: 'swal2-show',\n backdrop: 'swal2-backdrop-show',\n icon: 'swal2-icon-show'\n },\n hideClass: {\n popup: 'swal2-hide',\n backdrop: 'swal2-backdrop-hide',\n icon: 'swal2-icon-hide'\n },\n customClass: {},\n target: 'body',\n color: undefined,\n backdrop: true,\n heightAuto: true,\n allowOutsideClick: true,\n allowEscapeKey: true,\n allowEnterKey: true,\n stopKeydownPropagation: true,\n keydownListenerCapture: false,\n showConfirmButton: true,\n showDenyButton: false,\n showCancelButton: false,\n preConfirm: undefined,\n preDeny: undefined,\n confirmButtonText: 'OK',\n confirmButtonAriaLabel: '',\n confirmButtonColor: undefined,\n denyButtonText: 'No',\n denyButtonAriaLabel: '',\n denyButtonColor: undefined,\n cancelButtonText: 'Cancel',\n cancelButtonAriaLabel: '',\n cancelButtonColor: undefined,\n buttonsStyling: true,\n reverseButtons: false,\n focusConfirm: true,\n focusDeny: false,\n focusCancel: false,\n returnFocus: true,\n showCloseButton: false,\n closeButtonHtml: '×',\n closeButtonAriaLabel: 'Close this dialog',\n loaderHtml: '',\n showLoaderOnConfirm: false,\n showLoaderOnDeny: false,\n imageUrl: undefined,\n imageWidth: undefined,\n imageHeight: undefined,\n imageAlt: '',\n timer: undefined,\n timerProgressBar: false,\n width: undefined,\n padding: undefined,\n background: undefined,\n input: undefined,\n inputPlaceholder: '',\n inputLabel: '',\n inputValue: '',\n inputOptions: {},\n inputAutoTrim: true,\n inputAttributes: {},\n inputValidator: undefined,\n returnInputValueOnDeny: false,\n validationMessage: undefined,\n grow: false,\n position: 'center',\n progressSteps: [],\n currentProgressStep: undefined,\n progressStepsDistance: undefined,\n willOpen: undefined,\n didOpen: undefined,\n didRender: undefined,\n willClose: undefined,\n didClose: undefined,\n didDestroy: undefined,\n scrollbarPadding: true\n };\n const updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'willClose'];\n const deprecatedParams = {};\n const toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture'];\n /**\n * Is valid parameter\n *\n * @param {string} paramName\n * @returns {boolean}\n */\n\n const isValidParameter = paramName => {\n return Object.prototype.hasOwnProperty.call(defaultParams, paramName);\n };\n /**\n * Is valid parameter for Swal.update() method\n *\n * @param {string} paramName\n * @returns {boolean}\n */\n\n const isUpdatableParameter = paramName => {\n return updatableParams.indexOf(paramName) !== -1;\n };\n /**\n * Is deprecated parameter\n *\n * @param {string} paramName\n * @returns {string | undefined}\n */\n\n const isDeprecatedParameter = paramName => {\n return deprecatedParams[paramName];\n };\n /**\n * @param {string} param\n */\n\n const checkIfParamIsValid = param => {\n if (!isValidParameter(param)) {\n warn(\"Unknown parameter \\\"\".concat(param, \"\\\"\"));\n }\n };\n /**\n * @param {string} param\n */\n\n\n const checkIfToastParamIsValid = param => {\n if (toastIncompatibleParams.includes(param)) {\n warn(\"The parameter \\\"\".concat(param, \"\\\" is incompatible with toasts\"));\n }\n };\n /**\n * @param {string} param\n */\n\n\n const checkIfParamIsDeprecated = param => {\n if (isDeprecatedParameter(param)) {\n warnAboutDeprecation(param, isDeprecatedParameter(param));\n }\n };\n /**\n * Show relevant warnings for given params\n *\n * @param {SweetAlertOptions} params\n */\n\n\n const showWarningsForParams = params => {\n if (!params.backdrop && params.allowOutsideClick) {\n warn('\"allowOutsideClick\" parameter requires `backdrop` parameter to be set to `true`');\n }\n\n for (const param in params) {\n checkIfParamIsValid(param);\n\n if (params.toast) {\n checkIfToastParamIsValid(param);\n }\n\n checkIfParamIsDeprecated(param);\n }\n };\n\n /**\n * Updates popup parameters.\n */\n\n function update(params) {\n const popup = getPopup();\n const innerParams = privateProps.innerParams.get(this);\n\n if (!popup || hasClass(popup, innerParams.hideClass.popup)) {\n 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.\");\n }\n\n const validUpdatableParams = filterValidParams(params);\n const updatedParams = Object.assign({}, innerParams, validUpdatableParams);\n render(this, updatedParams);\n privateProps.innerParams.set(this, updatedParams);\n Object.defineProperties(this, {\n params: {\n value: Object.assign({}, this.params, params),\n writable: false,\n enumerable: true\n }\n });\n }\n\n const filterValidParams = params => {\n const validUpdatableParams = {};\n Object.keys(params).forEach(param => {\n if (isUpdatableParameter(param)) {\n validUpdatableParams[param] = params[param];\n } else {\n warn(\"Invalid parameter to update: \".concat(param));\n }\n });\n return validUpdatableParams;\n };\n\n function _destroy() {\n const domCache = privateProps.domCache.get(this);\n const innerParams = privateProps.innerParams.get(this);\n\n if (!innerParams) {\n disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335\n\n return; // This instance has already been destroyed\n } // Check if there is another Swal closing\n\n\n if (domCache.popup && globalState.swalCloseEventFinishedCallback) {\n globalState.swalCloseEventFinishedCallback();\n delete globalState.swalCloseEventFinishedCallback;\n }\n\n if (typeof innerParams.didDestroy === 'function') {\n innerParams.didDestroy();\n }\n\n disposeSwal(this);\n }\n /**\n * @param {SweetAlert2} instance\n */\n\n const disposeSwal = instance => {\n disposeWeakMaps(instance); // Unset this.params so GC will dispose it (#1569)\n // @ts-ignore\n\n delete instance.params; // Unset globalState props so GC will dispose globalState (#1569)\n\n delete globalState.keydownHandler;\n delete globalState.keydownTarget; // Unset currentInstance\n\n delete globalState.currentInstance;\n };\n /**\n * @param {SweetAlert2} instance\n */\n\n\n const disposeWeakMaps = instance => {\n // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335\n // @ts-ignore\n if (instance.isAwaitingPromise()) {\n unsetWeakMaps(privateProps, instance);\n privateProps.awaitingPromise.set(instance, true);\n } else {\n unsetWeakMaps(privateMethods, instance);\n unsetWeakMaps(privateProps, instance);\n }\n };\n /**\n * @param {object} obj\n * @param {SweetAlert2} instance\n */\n\n\n const unsetWeakMaps = (obj, instance) => {\n for (const i in obj) {\n obj[i].delete(instance);\n }\n };\n\n\n\n var instanceMethods = /*#__PURE__*/Object.freeze({\n hideLoading: hideLoading,\n disableLoading: hideLoading,\n getInput: getInput$1,\n close: close,\n isAwaitingPromise: isAwaitingPromise,\n rejectPromise: rejectPromise,\n handleAwaitingPromise: handleAwaitingPromise,\n closePopup: close,\n closeModal: close,\n closeToast: close,\n enableButtons: enableButtons,\n disableButtons: disableButtons,\n enableInput: enableInput,\n disableInput: disableInput,\n showValidationMessage: showValidationMessage,\n resetValidationMessage: resetValidationMessage$1,\n getProgressSteps: getProgressSteps$1,\n update: update,\n _destroy: _destroy\n });\n\n /**\n * Shows loader (spinner), this is useful with AJAX requests.\n * By default the loader be shown instead of the \"Confirm\" button.\n */\n\n const showLoading = buttonToReplace => {\n let popup = getPopup();\n\n if (!popup) {\n new Swal(); // eslint-disable-line no-new\n }\n\n popup = getPopup();\n const loader = getLoader();\n\n if (isToast()) {\n hide(getIcon());\n } else {\n replaceButton(popup, buttonToReplace);\n }\n\n show(loader);\n popup.setAttribute('data-loading', 'true');\n popup.setAttribute('aria-busy', 'true');\n popup.focus();\n };\n\n const replaceButton = (popup, buttonToReplace) => {\n const actions = getActions();\n const loader = getLoader();\n\n if (!buttonToReplace && isVisible(getConfirmButton())) {\n buttonToReplace = getConfirmButton();\n }\n\n show(actions);\n\n if (buttonToReplace) {\n hide(buttonToReplace);\n loader.setAttribute('data-button-to-replace', buttonToReplace.className);\n }\n\n loader.parentNode.insertBefore(loader, buttonToReplace);\n addClass([popup, actions], swalClasses.loading);\n };\n\n /**\n * @typedef { string | number | boolean } InputValue\n */\n\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n const handleInputOptionsAndValue = (instance, params) => {\n if (params.input === 'select' || params.input === 'radio') {\n handleInputOptions(instance, params);\n } else if (['text', 'email', 'number', 'tel', 'textarea'].includes(params.input) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) {\n showLoading(getConfirmButton());\n handleInputValue(instance, params);\n }\n };\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} innerParams\n * @returns {string | number | File | FileList | null}\n */\n\n const getInputValue = (instance, innerParams) => {\n const input = instance.getInput();\n\n if (!input) {\n return null;\n }\n\n switch (innerParams.input) {\n case 'checkbox':\n return getCheckboxValue(input);\n\n case 'radio':\n return getRadioValue(input);\n\n case 'file':\n return getFileValue(input);\n\n default:\n return innerParams.inputAutoTrim ? input.value.trim() : input.value;\n }\n };\n /**\n * @param {HTMLInputElement} input\n * @returns {number}\n */\n\n const getCheckboxValue = input => input.checked ? 1 : 0;\n /**\n * @param {HTMLInputElement} input\n * @returns {string | null}\n */\n\n\n const getRadioValue = input => input.checked ? input.value : null;\n /**\n * @param {HTMLInputElement} input\n * @returns {FileList | File | null}\n */\n\n\n const getFileValue = input => input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null;\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n\n const handleInputOptions = (instance, params) => {\n const popup = getPopup();\n /**\n * @param {Record} inputOptions\n */\n\n const processInputOptions = inputOptions => {\n populateInputOptions[params.input](popup, formatInputOptions(inputOptions), params);\n };\n\n if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) {\n showLoading(getConfirmButton());\n asPromise(params.inputOptions).then(inputOptions => {\n instance.hideLoading();\n processInputOptions(inputOptions);\n });\n } else if (typeof params.inputOptions === 'object') {\n processInputOptions(params.inputOptions);\n } else {\n error(\"Unexpected type of inputOptions! Expected object, Map or Promise, got \".concat(typeof params.inputOptions));\n }\n };\n /**\n * @param {SweetAlert2} instance\n * @param {SweetAlertOptions} params\n */\n\n\n const handleInputValue = (instance, params) => {\n const input = instance.getInput();\n hide(input);\n asPromise(params.inputValue).then(inputValue => {\n input.value = params.input === 'number' ? \"\".concat(parseFloat(inputValue) || 0) : \"\".concat(inputValue);\n show(input);\n input.focus();\n instance.hideLoading();\n }).catch(err => {\n error(\"Error in inputValue promise: \".concat(err));\n input.value = '';\n show(input);\n input.focus();\n instance.hideLoading();\n });\n };\n\n const populateInputOptions = {\n /**\n * @param {HTMLElement} popup\n * @param {Record} inputOptions\n * @param {SweetAlertOptions} params\n */\n select: (popup, inputOptions, params) => {\n const select = getDirectChildByClass(popup, swalClasses.select);\n /**\n * @param {HTMLElement} parent\n * @param {string} optionLabel\n * @param {string} optionValue\n */\n\n const renderOption = (parent, optionLabel, optionValue) => {\n const option = document.createElement('option');\n option.value = optionValue;\n setInnerHtml(option, optionLabel);\n option.selected = isSelected(optionValue, params.inputValue);\n parent.appendChild(option);\n };\n\n inputOptions.forEach(inputOption => {\n const optionValue = inputOption[0];\n const optionLabel = inputOption[1]; // spec:\n // https://www.w3.org/TR/html401/interact/forms.html#h-17.6\n // \"...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)...\"\n // check whether this is a \n\n if (Array.isArray(optionLabel)) {\n // if it is an array, then it is an \n const optgroup = document.createElement('optgroup');\n optgroup.label = optionValue;\n optgroup.disabled = false; // not configurable for now\n\n select.appendChild(optgroup);\n optionLabel.forEach(o => renderOption(optgroup, o[1], o[0]));\n } else {\n // case of