PageSourceSearch

https://farmaciaselsol.com/lib/sweetalert2/dist/sweetalert2.js

js farmaciaselsol.com collected 2026-10-02 00:49:35 UTC 91,619 bytes, 2,902 lines download raw bytes

vendor: 4,933 bytes, lines 1-181
1/*!
2* sweetalert2 v8.17.1
3* Released under the MIT License.
4*/
5(function (global, factory) {
6	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
7	typeof define === 'function' && define.amd ? define(factory) :
8	(global.Sweetalert2 = factory());
9}(this, (function () { 'use strict';
10
11function _typeof(obj) {
12  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
13    _typeof = function (obj) {
14      return typeof obj;
15    };
16  } else {
17    _typeof = function (obj) {
18      return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
19    };
20  }
21
22  return _typeof(obj);
23}
24
25function _classCallCheck(instance, Constructor) {
26  if (!(instance instanceof Constructor)) {
27    throw new TypeError("Cannot call a class as a function");
28  }
29}
30
31function _defineProperties(target, props) {
32  for (var i = 0; i < props.length; i++) {
33    var descriptor = props[i];
34    descriptor.enumerable = descriptor.enumerable || false;
35    descriptor.configurable = true;
36    if ("value" in descriptor) descriptor.writable = true;
37    Object.defineProperty(target, descriptor.key, descriptor);
38  }
39}
40
41function _createClass(Constructor, protoProps, staticProps) {
42  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
43  if (staticProps) _defineProperties(Constructor, staticProps);
44  return Constructor;
45}
46
47function _extends() {
48  _extends = Object.assign || function (target) {
49    for (var i = 1; i < arguments.length; i++) {
50      var source = arguments[i];
51
52      for (var key in source) {
53        if (Object.prototype.hasOwnProperty.call(source, key)) {
54          target[key] = source[key];
55        }
56      }
57    }
58
59    return target;
60  };
61
62  return _extends.apply(this, arguments);
63}
64
65function _inherits(subClass, superClass) {
66  if (typeof superClass !== "function" && superClass !== null) {
67    throw new TypeError("Super expression must either be null or a function");
68  }
69
70  subClass.prototype = Object.create(superClass && superClass.prototype, {
71    constructor: {
72      value: subClass,
73      writable: true,
74      configurable: true
75    }
76  });
77  if (superClass) _setPrototypeOf(subClass, superClass);
78}
79
80function _getPrototypeOf(o) {
81  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
82    return o.__proto__ || Object.getPrototypeOf(o);
83  };
84  return _getPrototypeOf(o);
85}
86
87function _setPrototypeOf(o, p) {
88  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
89    o.__proto__ = p;
90    return o;
91  };
92
93  return _setPrototypeOf(o, p);
94}
95
96function isNativeReflectConstruct() {
97  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
98  if (Reflect.construct.sham) return false;
99  if (typeof Proxy === "function") return true;
100
101  try {
102    Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
103    return true;
104  } catch (e) {
105    return false;
106  }
107}
108
109function _construct(Parent, args, Class) {
110  if (isNativeReflectConstruct()) {
111    _construct = Reflect.construct;
112  } else {
113    _construct = function _construct(Parent, args, Class) {
114      var a = [null];
115      a.push.apply(a, args);
116      var Constructor = Function.bind.apply(Parent, a);
117      var instance = new Constructor();
118      if (Class) _setPrototypeOf(instance, Class.prototype);
119      return instance;
120    };
121  }
122
123  return _construct.apply(null, arguments);
124}
125
126function _assertThisInitialized(self) {
127  if (self === void 0) {
128    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
129  }
130
131  return self;
132}
133
134function _possibleConstructorReturn(self, call) {
135  if (call && (typeof call === "object" || typeof call === "function")) {
136    return call;
137  }
138
139  return _assertThisInitialized(self);
140}
141
142function _superPropBase(object, property) {
143  while (!Object.prototype.hasOwnProperty.call(object, property)) {
144    object = _getPrototypeOf(object);
145    if (object === null) break;
146  }
147
148  return object;
149}
150
151function _get(target, property, receiver) {
152  if (typeof Reflect !== "undefined" && Reflect.get) {
153    _get = Reflect.get;
154  } else {
155    _get = function _get(target, property, receiver) {
156      var base = _superPropBase(target, property);
157
158      if (!base) return;
159      var desc = Object.getOwnPropertyDescriptor(base, property);
160
161      if (desc.get) {
162        return desc.get.call(receiver);
163      }
164
165      return desc.value;
166    };
167  }
168
169  return _get(target, property, receiver || target);
170}
171
172var consolePrefix = 'SweetAlert2:';
173/**
174 * Filter the unique values into a new array
175 * @param arr
176 */
177
178var uniqueArray = function uniqueArray(arr) {
179  var result = [];
180
181  for (var i = 0; i < arr.length; i++) {
182    if (result.indexOf(arr[i]) === -1) {
183      result.push(arr[i]);
184    }
185  }
186
187  return result;
188};
189/**
190 * Returns the array ob object values (Object.values isn't supported in IE11)
191 * @param obj
192 */
193
194var objectValues = function objectValues(obj) {
195  return Object.keys(obj).map(function (key) {
196    return obj[key];
197  });
198};
199/**
200 * Convert NodeList to Array
201 * @param nodeList
202 */
203
204var toArray = function toArray(nodeList) {
205  return Array.prototype.slice.call(nodeList);
206};
207/**
208 * Standardise console warnings
209 * @param message
210 */
211
212var warn = function warn(message) {
213  console.warn("".concat(consolePrefix, " ").concat(message));
214};
215/**
216 * Standardise console errors
217 * @param message
218 */
219
220var error = function error(message) {
221  console.error("".concat(consolePrefix, " ").concat(message));
222};
223/**
224 * Private global state for `warnOnce`
225 * @type {Array}
226 * @private
227 */
228
229var previousWarnOnceMessages = [];
230/**
231 * Show a console warning, but only if it hasn't already been shown
232 * @param message
233 */
234
235var warnOnce = function warnOnce(message) {
236  if (!(previousWarnOnceMessages.indexOf(message) !== -1)) {
237    previousWarnOnceMessages.push(message);
238    warn(message);
239  }
240};
241/**
242 * Show a one-time console warning about deprecated params/methods
243 */
244
245var warnAboutDepreation = function warnAboutDepreation(deprecatedParam, useInstead) {
246  warnOnce("\"".concat(deprecatedParam, "\" is deprecated and will be removed in the next major release. Please use \"").concat(useInstead, "\" instead."));
247};
248/**
249 * If `arg` is a function, call it (with no arguments or context) and return the result.
250 * Otherwise, just pass the value through
251 * @param arg
252 */
253
254var callIfFunction = function callIfFunction(arg) {
255  return typeof arg === 'function' ? arg() : arg;
256};
257var isPromise = function isPromise(arg) {
258  return arg && Promise.resolve(arg) === arg;
259};
260
261var DismissReason = Object.freeze({
262  cancel: 'cancel',
263  backdrop: 'backdrop',
264  close: 'close',
265  esc: 'esc',
266  timer: 'timer'
267});
268
269var argsToParams = function argsToParams(args) {
270  var params = {};
271
272  switch (_typeof(args[0])) {
273    case 'object':
274      _extends(params, args[0]);
275
276      break;
277
278    default:
279      ['title', 'html', 'type'].forEach(function (name, index) {
280        switch (_typeof(args[index])) {
281          case 'string':
282            params[name] = args[index];
283            break;
284
285          case 'undefined':
286            break;
287
288          default:
289            error("Unexpected type of ".concat(name, "! Expected \"string\", got ").concat(_typeof(args[index])));
290        }
291      });
292  }
293
294  return params;
295};
296
297var swalPrefix = 'swal2-';
298var prefix = function prefix(items) {
299  var result = {};
300
301  for (var i in items) {
302    result[items[i]] = swalPrefix + items[i];
303  }
304
305  return result;
306};
307var swalClasses = prefix(['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'toast', 'toast-shown', 'toast-column', 'fade', 'show', 'hide', 'noanimation', 'close', 'title', 'header', 'content', 'actions', 'confirm', 'cancel', 'footer', 'icon', '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']);
308var iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']);
309
310var states = {
311  previousBodyPadding: null
312};
313var hasClass = function hasClass(elem, className) {
314  return elem.classList.contains(className);
315};
316var applyCustomClass = function applyCustomClass(elem, customClass, className) {
317  // Clean up previous custom classes
318  toArray(elem.classList).forEach(function (className) {
319    if (!(objectValues(swalClasses).indexOf(className) !== -1) && !(objectValues(iconTypes).indexOf(className) !== -1)) {
320      elem.classList.remove(className);
321    }
322  });
323
324  if (customClass && customClass[className]) {
325    addClass(elem, customClass[className]);
326  }
327};
328function getInput(content, inputType) {
329  if (!inputType) {
330    return null;
331  }
332
333  switch (inputType) {
334    case 'select':
335    case 'textarea':
336    case 'file':
337      return getChildByClass(content, swalClasses[inputType]);
338
339    case 'checkbox':
340      return content.querySelector(".".concat(swalClasses.checkbox, " input"));
341
342    case 'radio':
343      return content.querySelector(".".concat(swalClasses.radio, " input:checked")) || content.querySelector(".".concat(swalClasses.radio, " input:first-child"));
344
345    case 'range':
346      return content.querySelector(".".concat(swalClasses.range, " input"));
347
348    default:
349      return getChildByClass(content, swalClasses.input);
350  }
351}
352var focusInput = function focusInput(input) {
353  input.focus(); // place cursor at end of text in text input
354
355  if (input.type !== 'file') {
356    // http://stackoverflow.com/a/2345915
357    var val = input.value;
358    input.value = '';
359    input.value = val;
360  }
361};
362var toggleClass = function toggleClass(target, classList, condition) {
363  if (!target || !classList) {
364    return;
365  }
366
367  if (typeof classList === 'string') {
368    classList = classList.split(/\s+/).filter(Boolean);
369  }
370
371  classList.forEach(function (className) {
372    if (target.forEach) {
373      target.forEach(function (elem) {
374        condition ? elem.classList.add(className) : elem.classList.remove(className);
375      });
376    } else {
377      condition ? target.classList.add(className) : target.classList.remove(className);
378    }
379  });
380};
381var addClass = function addClass(target, classList) {
382  toggleClass(target, classList, true);
383};
384var removeClass = function removeClass(target, classList) {
385  toggleClass(target, classList, false);
386};
387var getChildByClass = function getChildByClass(elem, className) {
388  for (var i = 0; i < elem.childNodes.length; i++) {
389    if (hasClass(elem.childNodes[i], className)) {
390      return elem.childNodes[i];
391    }
392  }
393};
394var applyNumericalStyle = function applyNumericalStyle(elem, property, value) {
395  if (value || parseInt(value) === 0) {
396    elem.style[property] = typeof value === 'number' ? value + 'px' : value;
397  } else {
398    elem.style.removeProperty(property);
399  }
400};
401var show = function show(elem) {
402  var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex';
403  elem.style.opacity = '';
404  elem.style.display = display;
405};
406var hide = function hide(elem) {
407  elem.style.opacity = '';
408  elem.style.display = 'none';
409};
410var toggle = function toggle(elem, condition, display) {
411  condition ? show(elem, display) : hide(elem);
412}; // borrowed from jquery $(elem).is(':visible') implementation
413
414var isVisible = function isVisible(elem) {
415  return !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));
416};
417var isScrollable = function isScrollable(elem) {
418  return !!(elem.scrollHeight > elem.clientHeight);
419}; // borrowed from https://stackoverflow.com/a/46352119
420
421var hasCssAnimation = function hasCssAnimation(elem) {
422  var style = window.getComputedStyle(elem);
423  var animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');
424  var transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');
425  return animDuration > 0 || transDuration > 0;
426};
427var contains = function contains(haystack, needle) {
428  if (typeof haystack.contains === 'function') {
429    return haystack.contains(needle);
430  }
431};
432
433var getContainer = function getContainer() {
434  return document.body.querySelector('.' + swalClasses.container);
435};
436var elementBySelector = function elementBySelector(selectorString) {
437  var container = getContainer();
438  return container ? container.querySelector(selectorString) : null;
439};
440
441var elementByClass = function elementByClass(className) {
442  return elementBySelector('.' + className);
443};
444
445var getPopup = function getPopup() {
446  return elementByClass(swalClasses.popup);
447};
448var getIcons = function getIcons() {
449  var popup = getPopup();
450  return toArray(popup.querySelectorAll('.' + swalClasses.icon));
451};
452var getIcon = function getIcon() {
453  var visibleIcon = getIcons().filter(function (icon) {
454    return isVisible(icon);
455  });
456  return visibleIcon.length ? visibleIcon[0] : null;
457};
458var getTitle = function getTitle() {
459  return elementByClass(swalClasses.title);
460};
461var getContent = function getContent() {
462  return elementByClass(swalClasses.content);
463};
464var getImage = function getImage() {
465  return elementByClass(swalClasses.image);
466};
467var getProgressSteps = function getProgressSteps() {
468  return elementByClass(swalClasses['progress-steps']);
469};
470var getValidationMessage = function getValidationMessage() {
471  return elementByClass(swalClasses['validation-message']);
472};
473var getConfirmButton = function getConfirmButton() {
474  return elementBySelector('.' + swalClasses.actions + ' .' + swalClasses.confirm);
475};
476var getCancelButton = function getCancelButton() {
477  return elementBySelector('.' + swalClasses.actions + ' .' + swalClasses.cancel);
478};
479var getActions = function getActions() {
480  return elementByClass(swalClasses.actions);
481};
482var getHeader = function getHeader() {
483  return elementByClass(swalClasses.header);
484};
485var getFooter = function getFooter() {
486  return elementByClass(swalClasses.footer);
487};
488var getCloseButton = function getCloseButton() {
489  return elementByClass(swalClasses.close);
490}; // https://github.com/jkup/focusable/blob/master/index.js
491
492var 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";
493var getFocusableElements = function getFocusableElements() {
494  var focusableElementsWithTabindex = toArray(getPopup().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')) // sort according to tabindex
495  .sort(function (a, b) {
496    a = parseInt(a.getAttribute('tabindex'));
497    b = parseInt(b.getAttribute('tabindex'));
498
499    if (a > b) {
500      return 1;
501    } else if (a < b) {
502      return -1;
503    }
504
505    return 0;
506  });
507  var otherFocusableElements = toArray(getPopup().querySelectorAll(focusable)).filter(function (el) {
508    return el.getAttribute('tabindex') !== '-1';
509  });
510  return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)).filter(function (el) {
511    return isVisible(el);
512  });
513};
514var isModal = function isModal() {
515  return !isToast() && !document.body.classList.contains(swalClasses['no-backdrop']);
516};
517var isToast = function isToast() {
518  return document.body.classList.contains(swalClasses['toast-shown']);
519};
520var isLoading = function isLoading() {
521  return getPopup().hasAttribute('data-loading');
522};
523
524// Detect Node env
525var isNodeEnv = function isNodeEnv() {
526  return typeof window === 'undefined' || typeof document === 'undefined';
527};
528
529var sweetHTML = "\n <div aria-labelledby=\"".concat(swalClasses.title, "\" aria-describedby=\"").concat(swalClasses.content, "\" class=\"").concat(swalClasses.popup, "\" tabindex=\"-1\">\n   <div class=\"").concat(swalClasses.header, "\">\n     <ul class=\"").concat(swalClasses['progress-steps'], "\"></ul>\n     <div class=\"").concat(swalClasses.icon, " ").concat(iconTypes.error, "\">\n       <span class=\"swal2-x-mark\"><span class=\"swal2-x-mark-line-left\"></span><span class=\"swal2-x-mark-line-right\"></span></span>\n     </div>\n     <div class=\"").concat(swalClasses.icon, " ").concat(iconTypes.question, "\"></div>\n     <div class=\"").concat(swalClasses.icon, " ").concat(iconTypes.warning, "\"></div>\n     <div class=\"").concat(swalClasses.icon, " ").concat(iconTypes.info, "\"></div>\n     <div class=\"").concat(swalClasses.icon, " ").concat(iconTypes.success, "\">\n       <div class=\"swal2-success-circular-line-left\"></div>\n       <span class=\"swal2-success-line-tip\"></span> <span class=\"swal2-success-line-long\"></span>\n       <div class=\"swal2-success-ring\"></div> <div class=\"swal2-success-fix\"></div>\n       <div class=\"swal2-success-circular-line-right\"></div>\n     </div>\n     <img class=\"").concat(swalClasses.image, "\" />\n     <h2 class=\"").concat(swalClasses.title, "\" id=\"").concat(swalClasses.title, "\"></h2>\n     <button type=\"button\" class=\"").concat(swalClasses.close, "\"></button>\n   </div>\n   <div class=\"").concat(swalClasses.content, "\">\n     <div id=\"").concat(swalClasses.content, "\"></div>\n     <input class=\"").concat(swalClasses.input, "\" />\n     <input type=\"file\" class=\"").concat(swalClasses.file, "\" />\n     <div class=\"").concat(swalClasses.range, "\">\n       <input type=\"range\" />\n       <output></output>\n     </div>\n     <select class=\"").concat(swalClasses.select, "\"></select>\n     <div class=\"").concat(swalClasses.radio, "\"></div>\n     <label for=\"").concat(swalClasses.checkbox, "\" class=\"").concat(swalClasses.checkbox, "\">\n       <input type=\"checkbox\" />\n       <span class=\"").concat(swalClasses.label, "\"></span>\n     </label>\n     <textarea class=\"").concat(swalClasses.textarea, "\"></textarea>\n     <div class=\"").concat(swalClasses['validation-message'], "\" id=\"").concat(swalClasses['validation-message'], "\"></div>\n   </div>\n   <div class=\"").concat(swalClasses.actions, "\">\n     <button type=\"button\" class=\"").concat(swalClasses.confirm, "\">OK</button>\n     <button type=\"button\" class=\"").concat(swalClasses.cancel, "\">Cancel</button>\n   </div>\n   <div class=\"").concat(swalClasses.footer, "\">\n   </div>\n </div>\n").replace(/(^|\n)\s*/g, '');
530
531var resetOldContainer = function resetOldContainer() {
532  var oldContainer = getContainer();
533
534  if (!oldContainer) {
535    return;
536  }
537
538  oldContainer.parentNode.removeChild(oldContainer);
539  removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]);
540};
541
542var oldInputVal; // IE11 workaround, see #1109 for details
543
544var resetValidationMessage = function resetValidationMessage(e) {
545  if (Swal.isVisible() && oldInputVal !== e.target.value) {
546    Swal.resetValidationMessage();
547  }
548
549  oldInputVal = e.target.value;
550};
551
552var addInputChangeListeners = function addInputChangeListeners() {
553  var content = getContent();
554  var input = getChildByClass(content, swalClasses.input);
555  var file = getChildByClass(content, swalClasses.file);
556  var range = content.querySelector(".".concat(swalClasses.range, " input"));
557  var rangeOutput = content.querySelector(".".concat(swalClasses.range, " output"));
558  var select = getChildByClass(content, swalClasses.select);
559  var checkbox = content.querySelector(".".concat(swalClasses.checkbox, " input"));
560  var textarea = getChildByClass(content, swalClasses.textarea);
561  input.oninput = resetValidationMessage;
562  file.onchange = resetValidationMessage;
563  select.onchange = resetValidationMessage;
564  checkbox.onchange = resetValidationMessage;
565  textarea.oninput = resetValidationMessage;
566
567  range.oninput = function (e) {
568    resetValidationMessage(e);
569    rangeOutput.value = range.value;
570  };
571
572  range.onchange = function (e) {
573    resetValidationMessage(e);
574    range.nextSibling.value = range.value;
575  };
576};
577
578var getTarget = function getTarget(target) {
579  return typeof target === 'string' ? document.querySelector(target) : target;
580};
581
582var setupAccessibility = function setupAccessibility(params) {
583  var popup = getPopup();
584  popup.setAttribute('role', params.toast ? 'alert' : 'dialog');
585  popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');
586
587  if (!params.toast) {
588    popup.setAttribute('aria-modal', 'true');
589  }
590};
591
592var setupRTL = function setupRTL(targetElement) {
593  if (window.getComputedStyle(targetElement).direction === 'rtl') {
594    addClass(getContainer(), swalClasses.rtl);
595  }
596};
597/*
598 * Add modal + backdrop to DOM
599 */
600
601
602var init = function init(params) {
603  // Clean up the old popup container if it exists
604  resetOldContainer();
605  /* istanbul ignore if */
606
607  if (isNodeEnv()) {
608    error('SweetAlert2 requires document to initialize');
609    return;
610  }
611
612  var container = document.createElement('div');
613  container.className = swalClasses.container;
614  container.innerHTML = sweetHTML;
615  var targetElement = getTarget(params.target);
616  targetElement.appendChild(container);
617  setupAccessibility(params);
618  setupRTL(targetElement);
619  addInputChangeListeners();
620};
621
622var parseHtmlToContainer = function parseHtmlToContainer(param, target) {
623  // DOM element
624  if (param instanceof HTMLElement) {
625    target.appendChild(param); // JQuery element(s)
626  } else if (_typeof(param) === 'object') {
627    handleJqueryElem(target, param); // Plain string
628  } else if (param) {
629    target.innerHTML = param;
630  }
631};
632
633var handleJqueryElem = function handleJqueryElem(target, elem) {
634  target.innerHTML = '';
635
636  if (0 in elem) {
637    for (var i = 0; i in elem; i++) {
638      target.appendChild(elem[i].cloneNode(true));
639    }
640  } else {
641    target.appendChild(elem.cloneNode(true));
642  }
643};
644
645var animationEndEvent = function () {
646  // Prevent run in Node env
647
648  /* istanbul ignore if */
649  if (isNodeEnv()) {
650    return false;
651  }
652
653  var testEl = document.createElement('div');
654  var transEndEventNames = {
655    WebkitAnimation: 'webkitAnimationEnd',
656    OAnimation: 'oAnimationEnd oanimationend',
657    animation: 'animationend'
658  };
659
660  for (var i in transEndEventNames) {
661    if (Object.prototype.hasOwnProperty.call(transEndEventNames, i) && typeof testEl.style[i] !== 'undefined') {
662      return transEndEventNames[i];
663    }
664  }
665
666  return false;
667}();
668
669// Measure width of scrollbar
670// https://github.com/twbs/bootstrap/blob/master/js/modal.js#L279-L286
671var measureScrollbar = function measureScrollbar() {
672  var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;
673
674  if (supportsTouch) {
675    return 0;
676  }
677
678  var scrollDiv = document.createElement('div');
679  scrollDiv.style.width = '50px';
680  scrollDiv.style.height = '50px';
681  scrollDiv.style.overflow = 'scroll';
682  document.body.appendChild(scrollDiv);
683  var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
684  document.body.removeChild(scrollDiv);
685  return scrollbarWidth;
686};
687
688var renderActions = function renderActions(instance, params) {
689  var actions = getActions();
690  var confirmButton = getConfirmButton();
691  var cancelButton = getCancelButton(); // Actions (buttons) wrapper
692
693  if (!params.showConfirmButton && !params.showCancelButton) {
694    hide(actions);
695  } // Custom class
696
697
698  applyCustomClass(actions, params.customClass, 'actions'); // Render confirm button
699
700  renderButton(confirmButton, 'confirm', params); // render Cancel Button
701
702  renderButton(cancelButton, 'cancel', params);
703
704  if (params.buttonsStyling) {
705    handleButtonsStyling(confirmButton, cancelButton, params);
706  } else {
707    removeClass([confirmButton, cancelButton], swalClasses.styled);
708    confirmButton.style.backgroundColor = confirmButton.style.borderLeftColor = confirmButton.style.borderRightColor = '';
709    cancelButton.style.backgroundColor = cancelButton.style.borderLeftColor = cancelButton.style.borderRightColor = '';
710  }
711
712  if (params.reverseButtons) {
713    confirmButton.parentNode.insertBefore(cancelButton, confirmButton);
714  }
715};
716
717function handleButtonsStyling(confirmButton, cancelButton, params) {
718  addClass([confirmButton, cancelButton], swalClasses.styled); // Buttons background colors
719
720  if (params.confirmButtonColor) {
721    confirmButton.style.backgroundColor = params.confirmButtonColor;
722  }
723
724  if (params.cancelButtonColor) {
725    cancelButton.style.backgroundColor = params.cancelButtonColor;
726  } // Loading state
727
728
729  var confirmButtonBackgroundColor = window.getComputedStyle(confirmButton).getPropertyValue('background-color');
730  confirmButton.style.borderLeftColor = confirmButtonBackgroundColor;
731  confirmButton.style.borderRightColor = confirmButtonBackgroundColor;
732}
733
734function renderButton(button, buttonType, params) {
735  toggle(button, params['showC' + buttonType.substring(1) + 'Button'], 'inline-block');
736  button.innerHTML = params[buttonType + 'ButtonText']; // Set caption text
737
738  button.setAttribute('aria-label', params[buttonType + 'ButtonAriaLabel']); // ARIA label
739  // Add buttons custom classes
740
741  button.className = swalClasses[buttonType];
742  applyCustomClass(button, params.customClass, buttonType + 'Button');
743  addClass(button, params[buttonType + 'ButtonClass']);
744}
745
746function handleBackdropParam(container, backdrop) {
747  if (typeof backdrop === 'string') {
748    container.style.background = backdrop;
749  } else if (!backdrop) {
750    addClass([document.documentElement, document.body], swalClasses['no-backdrop']);
751  }
752}
753
754function handlePositionParam(container, position) {
755  if (position in swalClasses) {
756    addClass(container, swalClasses[position]);
757  } else {
758    warn('The "position" parameter is not valid, defaulting to "center"');
759    addClass(container, swalClasses.center);
760  }
761}
762
763function handleGrowParam(container, grow) {
764  if (grow && typeof grow === 'string') {
765    var growClass = 'grow-' + grow;
766
767    if (growClass in swalClasses) {
768      addClass(container, swalClasses[growClass]);
769    }
770  }
771}
772
773var renderContainer = function renderContainer(instance, params) {
774  var container = getContainer();
775
776  if (!container) {
777    return;
778  }
779
780  handleBackdropParam(container, params.backdrop);
781
782  if (!params.backdrop && params.allowOutsideClick) {
783    warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');
784  }
785
786  handlePositionParam(container, params.position);
787  handleGrowParam(container, params.grow); // Custom class
788
789  applyCustomClass(container, params.customClass, 'container');
790
791  if (params.customContainerClass) {
792    // @deprecated
793    addClass(container, params.customContainerClass);
794  }
795};
796
797/**
798 * This module containts `WeakMap`s for each effectively-"private  property" that a `Swal` has.
799 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
800 * This is the approach that Babel will probably take to implement private methods/fields
801 *   https://github.com/tc39/proposal-private-methods
802 *   https://github.com/babel/babel/pull/7555
803 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*
804 *   then we can use that language feature.
805 */
806var privateProps = {
807  promise: new WeakMap(),
808  innerParams: new WeakMap(),
809  domCache: new WeakMap()
810};
811
812var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];
813var renderInput = function renderInput(instance, params) {
814  var content = getContent();
815  var innerParams = privateProps.innerParams.get(instance);
816  var rerender = !innerParams || params.input !== innerParams.input;
817  inputTypes.forEach(function (inputType) {
818    var inputClass = swalClasses[inputType];
819    var inputContainer = getChildByClass(content, inputClass); // set attributes
820
821    setAttributes(inputType, params.inputAttributes); // set class
822
823    setClass(inputContainer, inputClass, params);
824
825    if (rerender) {
826      hide(inputContainer);
827    }
828  });
829
830  if (params.input && rerender) {
831    showInput(params);
832  }
833};
834
835var showInput = function showInput(params) {
836  if (!renderInputType[params.input]) {
837    return error("Unexpected type of input! Expected \"text\", \"email\", \"password\", \"number\", \"tel\", \"select\", \"radio\", \"checkbox\", \"textarea\", \"file\" or \"url\", got \"".concat(params.input, "\""));
838  }
839
840  var input = renderInputType[params.input](params);
841  show(input); // input autofocus
842
843  setTimeout(function () {
844    focusInput(input);
845  });
846};
847
848var removeAttributes = function removeAttributes(input) {
849  for (var i = 0; i < input.attributes.length; i++) {
850    var attrName = input.attributes[i].name;
851
852    if (!(['type', 'value', 'style'].indexOf(attrName) !== -1)) {
853      input.removeAttribute(attrName);
854    }
855  }
856};
857
858var setAttributes = function setAttributes(inputType, inputAttributes) {
859  var input = getInput(getContent(), inputType);
860
861  if (!input) {
862    return;
863  }
864
865  removeAttributes(input);
866
867  for (var attr in inputAttributes) {
868    // Do not set a placeholder for <input type="range">
869    // it'll crash Edge, #1298
870    if (inputType === 'range' && attr === 'placeholder') {
871      continue;
872    }
873
874    input.setAttribute(attr, inputAttributes[attr]);
875  }
876};
877
878var setClass = function setClass(inputContainer, inputClass, params) {
879  inputContainer.className = inputClass;
880
881  if (params.inputClass) {
882    addClass(inputContainer, params.inputClass);
883  }
884
885  if (params.customClass) {
886    addClass(inputContainer, params.customClass.input);
887  }
888};
889
890var setInputPlaceholder = function setInputPlaceholder(input, params) {
891  if (!input.placeholder || params.inputPlaceholder) {
892    input.placeholder = params.inputPlaceholder;
893  }
894};
895
896var renderInputType = {};
897
898renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = function (params) {
899  var input = getChildByClass(getContent(), swalClasses.input);
900
901  if (typeof params.inputValue === 'string' || typeof params.inputValue === 'number') {
902    input.value = params.inputValue;
903  } else if (!isPromise(params.inputValue)) {
904    warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(_typeof(params.inputValue), "\""));
905  }
906
907  setInputPlaceholder(input, params);
908  input.type = params.input;
909  return input;
910};
911
912renderInputType.file = function (params) {
913  var input = getChildByClass(getContent(), swalClasses.file);
914  setInputPlaceholder(input, params);
915  input.type = params.input;
916  return input;
917};
918
919renderInputType.range = function (params) {
920  var range = getChildByClass(getContent(), swalClasses.range);
921  var rangeInput = range.querySelector('input');
922  var rangeOutput = range.querySelector('output');
923  rangeInput.value = params.inputValue;
924  rangeInput.type = params.input;
925  rangeOutput.value = params.inputValue;
926  return range;
927};
928
929renderInputType.select = function (params) {
930  var select = getChildByClass(getContent(), swalClasses.select);
931  select.innerHTML = '';
932
933  if (params.inputPlaceholder) {
934    var placeholder = document.createElement('option');
935    placeholder.innerHTML = params.inputPlaceholder;
936    placeholder.value = '';
937    placeholder.disabled = true;
938    placeholder.selected = true;
939    select.appendChild(placeholder);
940  }
941
942  return select;
943};
944
945renderInputType.radio = function () {
946  var radio = getChildByClass(getContent(), swalClasses.radio);
947  radio.innerHTML = '';
948  return radio;
949};
950
951renderInputType.checkbox = function (params) {
952  var checkbox = getChildByClass(getContent(), swalClasses.checkbox);
953  var checkboxInput = getInput(getContent(), 'checkbox');
954  checkboxInput.type = 'checkbox';
955  checkboxInput.value = 1;
956  checkboxInput.id = swalClasses.checkbox;
957  checkboxInput.checked = Boolean(params.inputValue);
958  var label = checkbox.querySelector('span');
959  label.innerHTML = params.inputPlaceholder;
960  return checkbox;
961};
962
963renderInputType.textarea = function (params) {
964  var textarea = getChildByClass(getContent(), swalClasses.textarea);
965  textarea.value = params.inputValue;
966  setInputPlaceholder(textarea, params);
967
968  if ('MutationObserver' in window) {
969    // #1699
970    var initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width);
971    var popupPadding = parseInt(window.getComputedStyle(getPopup()).paddingLeft) + parseInt(window.getComputedStyle(getPopup()).paddingRight);
972
973    var outputsize = function outputsize() {
974      var contentWidth = textarea.offsetWidth + popupPadding;
975
976      if (contentWidth > initialPopupWidth) {
977        getPopup().style.width = contentWidth + 'px';
978      } else {
979        getPopup().style.width = null;
980      }
981    };
982
983    new MutationObserver(outputsize).observe(textarea, {
984      attributes: true,
985      attributeFilter: ['style']
986    });
987  }
988
989  return textarea;
990};
991
992var renderContent = function renderContent(instance, params) {
993  var content = getContent().querySelector('#' + swalClasses.content); // Content as HTML
994
995  if (params.html) {
996    parseHtmlToContainer(params.html, content);
997    show(content, 'block'); // Content as plain text
998  } else if (params.text) {
999    content.textContent = params.text;
1000    show(content, 'block'); // No content
1001  } else {
1002    hide(content);
1003  }
1004
1005  renderInput(instance, params); // Custom class
1006
1007  applyCustomClass(getContent(), params.customClass, 'content');
1008};
1009
1010var renderFooter = function renderFooter(instance, params) {
1011  var footer = getFooter();
1012  toggle(footer, params.footer);
1013
1014  if (params.footer) {
1015    parseHtmlToContainer(params.footer, footer);
1016  } // Custom class
1017
1018
1019  applyCustomClass(footer, params.customClass, 'footer');
1020};
1021
1022var renderCloseButton = function renderCloseButton(instance, params) {
1023  var closeButton = getCloseButton();
1024  closeButton.innerHTML = params.closeButtonHtml; // Custom class
1025
1026  applyCustomClass(closeButton, params.customClass, 'closeButton');
1027  toggle(closeButton, params.showCloseButton);
1028  closeButton.setAttribute('aria-label', params.closeButtonAriaLabel);
1029};
1030
1031var renderIcon = function renderIcon(instance, params) {
1032  var innerParams = privateProps.innerParams.get(instance); // if the icon with the given type already rendered,
1033  // apply the custom class without re-rendering the icon
1034
1035  if (innerParams && params.type === innerParams.type && getIcon()) {
1036    applyCustomClass(getIcon(), params.customClass, 'icon');
1037    return;
1038  }
1039
1040  hideAllIcons();
1041
1042  if (!params.type) {
1043    return;
1044  }
1045
1046  adjustSuccessIconBackgoundColor();
1047
1048  if (Object.keys(iconTypes).indexOf(params.type) !== -1) {
1049    var icon = elementBySelector(".".concat(swalClasses.icon, ".").concat(iconTypes[params.type]));
1050    show(icon); // Custom class
1051
1052    applyCustomClass(icon, params.customClass, 'icon'); // Animate icon
1053
1054    toggleClass(icon, "swal2-animate-".concat(params.type, "-icon"), params.animation);
1055  } else {
1056    error("Unknown type! Expected \"success\", \"error\", \"warning\", \"info\" or \"question\", got \"".concat(params.type, "\""));
1057  }
1058};
1059
1060var hideAllIcons = function hideAllIcons() {
1061  var icons = getIcons();
1062
1063  for (var i = 0; i < icons.length; i++) {
1064    hide(icons[i]);
1065  }
1066}; // Adjust success icon background color to match the popup background color
1067
1068
1069var adjustSuccessIconBackgoundColor = function adjustSuccessIconBackgoundColor() {
1070  var popup = getPopup();
1071  var popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');
1072  var successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');
1073
1074  for (var i = 0; i < successIconParts.length; i++) {
1075    successIconParts[i].style.backgroundColor = popupBackgroundColor;
1076  }
1077};
1078
1079var renderImage = function renderImage(instance, params) {
1080  var image = getImage();
1081
1082  if (!params.imageUrl) {
1083    return hide(image);
1084  }
1085
1086  show(image); // Src, alt
1087
1088  image.setAttribute('src', params.imageUrl);
1089  image.setAttribute('alt', params.imageAlt); // Width, height
1090
1091  applyNumericalStyle(image, 'width', params.imageWidth);
1092  applyNumericalStyle(image, 'height', params.imageHeight); // Class
1093
1094  image.className = swalClasses.image;
1095  applyCustomClass(image, params.customClass, 'image');
1096
1097  if (params.imageClass) {
1098    addClass(image, params.imageClass);
1099  }
1100};
1101
1102var createStepElement = function createStepElement(step) {
1103  var stepEl = document.createElement('li');
1104  addClass(stepEl, swalClasses['progress-step']);
1105  stepEl.innerHTML = step;
1106  return stepEl;
1107};
1108
1109var createLineElement = function createLineElement(params) {
1110  var lineEl = document.createElement('li');
1111  addClass(lineEl, swalClasses['progress-step-line']);
1112
1113  if (params.progressStepsDistance) {
1114    lineEl.style.width = params.progressStepsDistance;
1115  }
1116
1117  return lineEl;
1118};
1119
1120var renderProgressSteps = function renderProgressSteps(instance, params) {
1121  var progressStepsContainer = getProgressSteps();
1122
1123  if (!params.progressSteps || params.progressSteps.length === 0) {
1124    return hide(progressStepsContainer);
1125  }
1126
1127  show(progressStepsContainer);
1128  progressStepsContainer.innerHTML = '';
1129  var currentProgressStep = parseInt(params.currentProgressStep === null ? Swal.getQueueStep() : params.currentProgressStep);
1130
1131  if (currentProgressStep >= params.progressSteps.length) {
1132    warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');
1133  }
1134
1135  params.progressSteps.forEach(function (step, index) {
1136    var stepEl = createStepElement(step);
1137    progressStepsContainer.appendChild(stepEl);
1138
1139    if (index === currentProgressStep) {
1140      addClass(stepEl, swalClasses['active-progress-step']);
1141    }
1142
1143    if (index !== params.progressSteps.length - 1) {
1144      var lineEl = createLineElement(step);
1145      progressStepsContainer.appendChild(lineEl);
1146    }
1147  });
1148};
1149
1150var renderTitle = function renderTitle(instance, params) {
1151  var title = getTitle();
1152  toggle(title, params.title || params.titleText);
1153
1154  if (params.title) {
1155    parseHtmlToContainer(params.title, title);
1156  }
1157
1158  if (params.titleText) {
1159    title.innerText = params.titleText;
1160  } // Custom class
1161
1162
1163  applyCustomClass(title, params.customClass, 'title');
1164};
1165
1166var renderHeader = function renderHeader(instance, params) {
1167  var header = getHeader(); // Custom class
1168
1169  applyCustomClass(header, params.customClass, 'header'); // Progress steps
1170
1171  renderProgressSteps(instance, params); // Icon
1172
1173  renderIcon(instance, params); // Image
1174
1175  renderImage(instance, params); // Title
1176
1177  renderTitle(instance, params); // Close button
1178
1179  renderCloseButton(instance, params);
1180};
1181
1182var renderPopup = function renderPopup(instance, params) {
1183  var popup = getPopup(); // Width
1184
1185  applyNumericalStyle(popup, 'width', params.width); // Padding
1186
1187  applyNumericalStyle(popup, 'padding', params.padding); // Background
1188
1189  if (params.background) {
1190    popup.style.background = params.background;
1191  } // Default Class
1192
1193
1194  popup.className = swalClasses.popup;
1195
1196  if (params.toast) {
1197    addClass([document.documentElement, document.body], swalClasses['toast-shown']);
1198    addClass(popup, swalClasses.toast);
1199  } else {
1200    addClass(popup, swalClasses.modal);
1201  } // Custom class
1202
1203
1204  applyCustomClass(popup, params.customClass, 'popup');
1205
1206  if (typeof params.customClass === 'string') {
1207    addClass(popup, params.customClass);
1208  } // CSS animation
1209
1210
1211  toggleClass(popup, swalClasses.noanimation, !params.animation);
1212};
1213
1214var render = function render(instance, params) {
1215  renderPopup(instance, params);
1216  renderContainer(instance, params);
1217  renderHeader(instance, params);
1218  renderContent(instance, params);
1219  renderActions(instance, params);
1220  renderFooter(instance, params);
1221
1222  if (typeof params.onRender === 'function') {
1223    params.onRender(getPopup());
1224  }
1225};
1226
1227/*
1228 * Global function to determine if SweetAlert2 popup is shown
1229 */
1230
1231var isVisible$1 = function isVisible$$1() {
1232  return isVisible(getPopup());
1233};
1234/*
1235 * Global function to click 'Confirm' button
1236 */
1237
1238var clickConfirm = function clickConfirm() {
1239  return getConfirmButton() && getConfirmButton().click();
1240};
1241/*
1242 * Global function to click 'Cancel' button
1243 */
1244
1245var clickCancel = function clickCancel() {
1246  return getCancelButton() && getCancelButton().click();
1247};
1248
1249function fire() {
1250  var Swal = this;
1251
1252  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1253    args[_key] = arguments[_key];
1254  }
1255
1256  return _construct(Swal, args);
1257}
1258
1259/**
1260 * Returns an extended version of `Swal` containing `params` as defaults.
1261 * Useful for reusing Swal configuration.
1262 *
1263 * For example:
1264 *
1265 * Before:
1266 * const textPromptOptions = { input: 'text', showCancelButton: true }
1267 * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' })
1268 * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' })
1269 *
1270 * After:
1271 * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true })
1272 * const {value: firstName} = await TextPrompt('What is your first name?')
1273 * const {value: lastName} = await TextPrompt('What is your last name?')
1274 *
1275 * @param mixinParams
1276 */
1277function mixin(mixinParams) {
1278  var MixinSwal =
1279  /*#__PURE__*/
1280  function (_this) {
1281    _inherits(MixinSwal, _this);
1282
1283    function MixinSwal() {
1284      _classCallCheck(this, MixinSwal);
1285
1286      return _possibleConstructorReturn(this, _getPrototypeOf(MixinSwal).apply(this, arguments));
1287    }
1288
1289    _createClass(MixinSwal, [{
1290      key: "_main",
1291      value: function _main(params) {
1292        return _get(_getPrototypeOf(MixinSwal.prototype), "_main", this).call(this, _extends({}, mixinParams, params));
1293      }
1294    }]);
1295
1296    return MixinSwal;
1297  }(this);
1298
1299  return MixinSwal;
1300}
1301
1302// private global state for the queue feature
1303var currentSteps = [];
1304/*
1305 * Global function for chaining sweetAlert popups
1306 */
1307
1308var queue = function queue(steps) {
1309  var Swal = this;
1310  currentSteps = steps;
1311
1312  var resetAndResolve = function resetAndResolve(resolve, value) {
1313    currentSteps = [];
1314    document.body.removeAttribute('data-swal2-queue-step');
1315    resolve(value);
1316  };
1317
1318  var queueResult = [];
1319  return new Promise(function (resolve) {
1320    (function step(i, callback) {
1321      if (i < currentSteps.length) {
1322        document.body.setAttribute('data-swal2-queue-step', i);
1323        Swal.fire(currentSteps[i]).then(function (result) {
1324          if (typeof result.value !== 'undefined') {
1325            queueResult.push(result.value);
1326            step(i + 1, callback);
1327          } else {
1328            resetAndResolve(resolve, {
1329              dismiss: result.dismiss
1330            });
1331          }
1332        });
1333      } else {
1334        resetAndResolve(resolve, {
1335          value: queueResult
1336        });
1337      }
1338    })(0);
1339  });
1340};
1341/*
1342 * Global function for getting the index of current popup in queue
1343 */
1344
1345var getQueueStep = function getQueueStep() {
1346  return document.body.getAttribute('data-swal2-queue-step');
1347};
1348/*
1349 * Global function for inserting a popup to the queue
1350 */
1351
1352var insertQueueStep = function insertQueueStep(step, index) {
1353  if (index && index < currentSteps.length) {
1354    return currentSteps.splice(index, 0, step);
1355  }
1356
1357  return currentSteps.push(step);
1358};
1359/*
1360 * Global function for deleting a popup from the queue
1361 */
1362
1363var deleteQueueStep = function deleteQueueStep(index) {
1364  if (typeof currentSteps[index] !== 'undefined') {
1365    currentSteps.splice(index, 1);
1366  }
1367};
1368
1369/**
1370 * Show spinner instead of Confirm button and disable Cancel button
1371 */
1372
1373var showLoading = function showLoading() {
1374  var popup = getPopup();
1375
1376  if (!popup) {
1377    Swal.fire('');
1378  }
1379
1380  popup = getPopup();
1381  var actions = getActions();
1382  var confirmButton = getConfirmButton();
1383  var cancelButton = getCancelButton();
1384  show(actions);
1385  show(confirmButton);
1386  addClass([popup, actions], swalClasses.loading);
1387  confirmButton.disabled = true;
1388  cancelButton.disabled = true;
1389  popup.setAttribute('data-loading', true);
1390  popup.setAttribute('aria-busy', true);
1391  popup.focus();
1392};
1393
1394var RESTORE_FOCUS_TIMEOUT = 100;
1395
1396var globalState = {};
1397var focusPreviousActiveElement = function focusPreviousActiveElement() {
1398  if (globalState.previousActiveElement && globalState.previousActiveElement.focus) {
1399    globalState.previousActiveElement.focus();
1400    globalState.previousActiveElement = null;
1401  } else if (document.body) {
1402    document.body.focus();
1403  }
1404}; // Restore previous active (focused) element
1405
1406
1407var restoreActiveElement = function restoreActiveElement() {
1408  return new Promise(function (resolve) {
1409    var x = window.scrollX;
1410    var y = window.scrollY;
1411    globalState.restoreFocusTimeout = setTimeout(function () {
1412      focusPreviousActiveElement();
1413      resolve();
1414    }, RESTORE_FOCUS_TIMEOUT); // issues/900
1415
1416    if (typeof x !== 'undefined' && typeof y !== 'undefined') {
1417      // IE doesn't have scrollX/scrollY support
1418      window.scrollTo(x, y);
1419    }
1420  });
1421};
1422
1423/**
1424 * If `timer` parameter is set, returns number of milliseconds of timer remained.
1425 * Otherwise, returns undefined.
1426 */
1427
1428var getTimerLeft = function getTimerLeft() {
1429  return globalState.timeout && globalState.timeout.getTimerLeft();
1430};
1431/**
1432 * Stop timer. Returns number of milliseconds of timer remained.
1433 * If `timer` parameter isn't set, returns undefined.
1434 */
1435
1436var stopTimer = function stopTimer() {
1437  return globalState.timeout && globalState.timeout.stop();
1438};
1439/**
1440 * Resume timer. Returns number of milliseconds of timer remained.
1441 * If `timer` parameter isn't set, returns undefined.
1442 */
1443
1444var resumeTimer = function resumeTimer() {
1445  return globalState.timeout && globalState.timeout.start();
1446};
1447/**
1448 * Resume timer. Returns number of milliseconds of timer remained.
1449 * If `timer` parameter isn't set, returns undefined.
1450 */
1451
1452var toggleTimer = function toggleTimer() {
1453  var timer = globalState.timeout;
1454  return timer && (timer.running ? timer.stop() : timer.start());
1455};
1456/**
1457 * Increase timer. Returns number of milliseconds of an updated timer.
1458 * If `timer` parameter isn't set, returns undefined.
1459 */
1460
1461var increaseTimer = function increaseTimer(n) {
1462  return globalState.timeout && globalState.timeout.increase(n);
1463};
1464/**
1465 * Check if timer is running. Returns true if timer is running
1466 * or false if timer is paused or stopped.
1467 * If `timer` parameter isn't set, returns undefined
1468 */
1469
1470var isTimerRunning = function isTimerRunning() {
1471  return globalState.timeout && globalState.timeout.isRunning();
1472};
1473
1474var defaultParams = {
1475  title: '',
1476  titleText: '',
1477  text: '',
1478  html: '',
1479  footer: '',
1480  type: null,
1481  toast: false,
1482  customClass: '',
1483  customContainerClass: '',
1484  target: 'body',
1485  backdrop: true,
1486  animation: true,
1487  heightAuto: true,
1488  allowOutsideClick: true,
1489  allowEscapeKey: true,
1490  allowEnterKey: true,
1491  stopKeydownPropagation: true,
1492  keydownListenerCapture: false,
1493  showConfirmButton: true,
1494  showCancelButton: false,
1495  preConfirm: null,
1496  confirmButtonText: 'OK',
1497  confirmButtonAriaLabel: '',
1498  confirmButtonColor: null,
1499  confirmButtonClass: '',
1500  cancelButtonText: 'Cancel',
1501  cancelButtonAriaLabel: '',
1502  cancelButtonColor: null,
1503  cancelButtonClass: '',
1504  buttonsStyling: true,
1505  reverseButtons: false,
1506  focusConfirm: true,
1507  focusCancel: false,
1508  showCloseButton: false,
1509  closeButtonHtml: '&times;',
1510  closeButtonAriaLabel: 'Close this dialog',
1511  showLoaderOnConfirm: false,
1512  imageUrl: null,
1513  imageWidth: null,
1514  imageHeight: null,
1515  imageAlt: '',
1516  imageClass: '',
1517  timer: null,
1518  width: null,
1519  padding: null,
1520  background: null,
1521  input: null,
1522  inputPlaceholder: '',
1523  inputValue: '',
1524  inputOptions: {},
1525  inputAutoTrim: true,
1526  inputClass: '',
1527  inputAttributes: {},
1528  inputValidator: null,
1529  validationMessage: null,
1530  grow: false,
1531  position: 'center',
1532  progressSteps: [],
1533  currentProgressStep: null,
1534  progressStepsDistance: null,
1535  onBeforeOpen: null,
1536  onOpen: null,
1537  onRender: null,
1538  onClose: null,
1539  onAfterClose: null,
1540  scrollbarPadding: true
1541};
1542var updatableParams = ['title', 'titleText', 'text', 'html', 'type', 'customClass', 'showConfirmButton', 'showCancelButton', 'confirmButtonText', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonClass', 'cancelButtonText', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonClass', 'buttonsStyling', 'reverseButtons', 'imageUrl', 'imageWidth', 'imageHeigth', 'imageAlt', 'imageClass', 'progressSteps', 'currentProgressStep'];
1543var deprecatedParams = {
1544  customContainerClass: 'customClass',
1545  confirmButtonClass: 'customClass',
1546  cancelButtonClass: 'customClass',
1547  imageClass: 'customClass',
1548  inputClass: 'customClass'
1549};
1550var toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusCancel', 'he
1550ightAuto', 'keydownListenerCapture'];
1551/**
1552 * Is valid parameter
1553 * @param {String} paramName
1554 */
1555
1556var isValidParameter = function isValidParameter(paramName) {
1557  return Object.prototype.hasOwnProperty.call(defaultParams, paramName);
1558};
1559/**
1560 * Is valid parameter for Swal.update() method
1561 * @param {String} paramName
1562 */
1563
1564var isUpdatableParameter = function isUpdatableParameter(paramName) {
1565  return updatableParams.indexOf(paramName) !== -1;
1566};
1567/**
1568 * Is deprecated parameter
1569 * @param {String} paramName
1570 */
1571
1572var isDeprecatedParameter = function isDeprecatedParameter(paramName) {
1573  return deprecatedParams[paramName];
1574};
1575
1576var checkIfParamIsValid = function checkIfParamIsValid(param) {
1577  if (!isValidParameter(param)) {
1578    warn("Unknown parameter \"".concat(param, "\""));
1579  }
1580};
1581
1582var checkIfToastParamIsValid = function checkIfToastParamIsValid(param) {
1583  if (toastIncompatibleParams.indexOf(param) !== -1) {
1584    warn("The parameter \"".concat(param, "\" is incompatible with toasts"));
1585  }
1586};
1587
1588var checkIfParamIsDeprecated = function checkIfParamIsDeprecated(param) {
1589  if (isDeprecatedParameter(param)) {
1590    warnAboutDepreation(param, isDeprecatedParameter(param));
1591  }
1592};
1593/**
1594 * Show relevant warnings for given params
1595 *
1596 * @param params
1597 */
1598
1599
1600var showWarningsForParams = function showWarningsForParams(params) {
1601  for (var param in params) {
1602    checkIfParamIsValid(param);
1603
1604    if (params.toast) {
1605      checkIfToastParamIsValid(param);
1606    }
1607
1608    checkIfParamIsDeprecated();
1609  }
1610};
1611
1612
1613
1614var staticMethods = Object.freeze({
1615	isValidParameter: isValidParameter,
1616	isUpdatableParameter: isUpdatableParameter,
1617	isDeprecatedParameter: isDeprecatedParameter,
1618	argsToParams: argsToParams,
1619	isVisible: isVisible$1,
1620	clickConfirm: clickConfirm,
1621	clickCancel: clickCancel,
1622	getContainer: getContainer,
1623	getPopup: getPopup,
1624	getTitle: getTitle,
1625	getContent: getContent,
1626	getImage: getImage,
1627	getIcon: getIcon,
1628	getIcons: getIcons,
1629	getCloseButton: getCloseButton,
1630	getActions: getActions,
1631	getConfirmButton: getConfirmButton,
1632	getCancelButton: getCancelButton,
1633	getHeader: getHeader,
1634	getFooter: getFooter,
1635	getFocusableElements: getFocusableElements,
1636	getValidationMessage: getValidationMessage,
1637	isLoading: isLoading,
1638	fire: fire,
1639	mixin: mixin,
1640	queue: queue,
1641	getQueueStep: getQueueStep,
1642	insertQueueStep: insertQueueStep,
1643	deleteQueueStep: deleteQueueStep,
1644	showLoading: showLoading,
1645	enableLoading: showLoading,
1646	getTimerLeft: getTimerLeft,
1647	stopTimer: stopTimer,
1648	resumeTimer: resumeTimer,
1649	toggleTimer: toggleTimer,
1650	increaseTimer: increaseTimer,
1651	isTimerRunning: isTimerRunning
1652});
1653
1654/**
1655 * Enables buttons and hide loader.
1656 */
1657
1658function hideLoading() {
1659  var innerParams = privateProps.innerParams.get(this);
1660  var domCache = privateProps.domCache.get(this);
1661
1662  if (!innerParams.showConfirmButton) {
1663    hide(domCache.confirmButton);
1664
1665    if (!innerParams.showCancelButton) {
1666      hide(domCache.actions);
1667    }
1668  }
1669
1670  removeClass([domCache.popup, domCache.actions], swalClasses.loading);
1671  domCache.popup.removeAttribute('aria-busy');
1672  domCache.popup.removeAttribute('data-loading');
1673  domCache.confirmButton.disabled = false;
1674  domCache.cancelButton.disabled = false;
1675}
1676
1677function getInput$1(instance) {
1678  var innerParams = privateProps.innerParams.get(instance || this);
1679  var domCache = privateProps.domCache.get(instance || this);
1680
1681  if (!domCache) {
1682    return null;
1683  }
1684
1685  return getInput(domCache.content, innerParams.input);
1686}
1687
1688var fixScrollbar = function fixScrollbar() {
1689  // for queues, do not do this more than once
1690  if (states.previousBodyPadding !== null) {
1691    return;
1692  } // if the body has overflow
1693
1694
1695  if (document.body.scrollHeight > window.innerHeight) {
1696    // add padding so the content doesn't shift after removal of scrollbar
1697    states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'));
1698    document.body.style.paddingRight = states.previousBodyPadding + measureScrollbar() + 'px';
1699  }
1700};
1701var undoScrollbar = function undoScrollbar() {
1702  if (states.previousBodyPadding !== null) {
1703    document.body.style.paddingRight = states.previousBodyPadding + 'px';
1704    states.previousBodyPadding = null;
1705  }
1706};
1707
1708/* istanbul ignore next */
1709
1710var iOSfix = function iOSfix() {
1711  var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
1712
1713  if (iOS && !hasClass(document.body, swalClasses.iosfix)) {
1714    var offset = document.body.scrollTop;
1715    document.body.style.top = offset * -1 + 'px';
1716    addClass(document.body, swalClasses.iosfix);
1717    lockBodyScroll();
1718  }
1719};
1720
1721var lockBodyScroll = function lockBodyScroll() {
1722  // #1246
1723  var container = getContainer();
1724  var preventTouchMove;
1725
1726  container.ontouchstart = function (e) {
1727    preventTouchMove = e.target === container || !isScrollable(container) && e.target.tagName !== 'INPUT' // #1603
1728    ;
1729  };
1730
1731  container.ontouchmove = function (e) {
1732    if (preventTouchMove) {
1733      e.preventDefault();
1734      e.stopPropagation();
1735    }
1736  };
1737};
1738/* istanbul ignore next */
1739
1740
1741var undoIOSfix = function undoIOSfix() {
1742  if (hasClass(document.body, swalClasses.iosfix)) {
1743    var offset = parseInt(document.body.style.top, 10);
1744    removeClass(document.body, swalClasses.iosfix);
1745    document.body.style.top = '';
1746    document.body.scrollTop = offset * -1;
1747  }
1748};
1749
1750var isIE11 = function isIE11() {
1751  return !!window.MSInputMethodContext && !!document.documentMode;
1752}; // Fix IE11 centering sweetalert2/issues/933
1753
1754/* istanbul ignore next */
1755
1756
1757var fixVerticalPositionIE = function fixVerticalPositionIE() {
1758  var container = getContainer();
1759  var popup = getPopup();
1760  container.style.removeProperty('align-items');
1761
1762  if (popup.offsetTop < 0) {
1763    container.style.alignItems = 'flex-start';
1764  }
1765};
1766/* istanbul ignore next */
1767
1768
1769var IEfix = function IEfix() {
1770  if (typeof window !== 'undefined' && isIE11()) {
1771    fixVerticalPositionIE();
1772    window.addEventListener('resize', fixVerticalPositionIE);
1773  }
1774};
1775/* istanbul ignore next */
1776
1777var undoIEfix = function undoIEfix() {
1778  if (typeof window !== 'undefined' && isIE11()) {
1779    window.removeEventListener('resize', fixVerticalPositionIE);
1780  }
1781};
1782
1783// Adding aria-hidden="true" to elements outside of the active modal dialog ensures that
1784// elements not within the active modal dialog will not be surfaced if a user opens a screen
1785// reader’s list of elements (headings, form controls, landmarks, etc.) in the document.
1786
1787var setAriaHidden = function setAriaHidden() {
1788  var bodyChildren = toArray(document.body.children);
1789  bodyChildren.forEach(function (el) {
1790    if (el === getContainer() || contains(el, getContainer())) {
1791      return;
1792    }
1793
1794    if (el.hasAttribute('aria-hidden')) {
1795      el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden'));
1796    }
1797
1798    el.setAttribute('aria-hidden', 'true');
1799  });
1800};
1801var unsetAriaHidden = function unsetAriaHidden() {
1802  var bodyChildren = toArray(document.body.children);
1803  bodyChildren.forEach(function (el) {
1804    if (el.hasAttribute('data-previous-aria-hidden')) {
1805      el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden'));
1806      el.removeAttribute('data-previous-aria-hidden');
1807    } else {
1808      el.removeAttribute('aria-hidden');
1809    }
1810  });
1811};
1812
1813/**
1814 * This module containts `WeakMap`s for each effectively-"private  property" that a `Swal` has.
1815 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
1816 * This is the approach that Babel will probably take to implement private methods/fields
1817 *   https://github.com/tc39/proposal-private-methods
1818 *   https://github.com/babel/babel/pull/7555
1819 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*
1820 *   then we can use that language feature.
1821 */
1822var privateMethods = {
1823  swalPromiseResolve: new WeakMap()
1824};
1825
1826/*
1827 * Instance method to close sweetAlert
1828 */
1829
1830function removePopupAndResetState(instance, container, isToast, onAfterClose) {
1831  if (isToast) {
1832    triggerOnAfterCloseAndDispose(instance, onAfterClose);
1833  } else {
1834    restoreActiveElement().then(function () {
1835      return triggerOnAfterCloseAndDispose(instance, onAfterClose);
1836    });
1837    globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
1838      capture: globalState.keydownListenerCapture
1839    });
1840    globalState.keydownHandlerAdded = false;
1841  }
1842
1843  if (container.parentNode) {
1844    container.parentNode.removeChild(container);
1845  }
1846
1847  if (isModal()) {
1848    undoScrollbar();
1849    undoIOSfix();
1850    undoIEfix();
1851    unsetAriaHidden();
1852  }
1853
1854  removeBodyClasses();
1855}
1856
1857function removeBodyClasses() {
1858  removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['toast-column']]);
1859}
1860
1861function disposeSwal(instance) {
1862  // Unset this.params so GC will dispose it (#1569)
1863  delete instance.params; // Unset globalState props so GC will dispose globalState (#1569)
1864
1865  delete globalState.keydownHandler;
1866  delete globalState.keydownTarget; // Unset WeakMaps so GC will be able to dispose them (#1569)
1867
1868  unsetWeakMaps(privateProps);
1869  unsetWeakMaps(privateMethods);
1870}
1871
1872function close(resolveValue) {
1873  var popup = getPopup();
1874
1875  if (!popup || hasClass(popup, swalClasses.hide)) {
1876    return;
1877  }
1878
1879  var innerParams = privateProps.innerParams.get(this);
1880
1881  if (!innerParams) {
1882    return;
1883  }
1884
1885  var swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);
1886  removeClass(popup, swalClasses.show);
1887  addClass(popup, swalClasses.hide);
1888  handlePopupAnimation(this, popup, innerParams); // Resolve Swal promise
1889
1890  swalPromiseResolve(resolveValue || {});
1891}
1892
1893var handlePopupAnimation = function handlePopupAnimation(instance, popup, innerParams) {
1894  var container = getContainer(); // If animation is supported, animate
1895
1896  var animationIsSupported = animationEndEvent && hasCssAnimation(popup);
1897  var onClose = innerParams.onClose,
1898      onAfterClose = innerParams.onAfterClose;
1899
1900  if (onClose !== null && typeof onClose === 'function') {
1901    onClose(popup);
1902  }
1903
1904  if (animationIsSupported) {
1905    animatePopup(instance, popup, container, onAfterClose);
1906  } else {
1907    // Otherwise, remove immediately
1908    removePopupAndResetState(instance, container, isToast(), onAfterClose);
1909  }
1910};
1911
1912var animatePopup = function animatePopup(instance, popup, container, onAfterClose) {
1913  globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, isToast(), onAfterClose);
1914  popup.addEventListener(animationEndEvent, function (e) {
1915    if (e.target === popup) {
1916      globalState.swalCloseEventFinishedCallback();
1917      delete globalState.swalCloseEventFinishedCallback;
1918    }
1919  });
1920};
1921
1922var unsetWeakMaps = function unsetWeakMaps(obj) {
1923  for (var i in obj) {
1924    obj[i] = new WeakMap();
1925  }
1926};
1927
1928var triggerOnAfterCloseAndDispose = function triggerOnAfterCloseAndDispose(instance, onAfterClose) {
1929  setTimeout(function () {
1930    if (onAfterClose !== null && typeof onAfterClose === 'function') {
1931      onAfterClose();
1932    }
1933
1934    if (!getPopup()) {
1935      disposeSwal(instance);
1936    }
1937  });
1938};
1939
1940function setButtonsDisabled(instance, buttons, disabled) {
1941  var domCache = privateProps.domCache.get(instance);
1942  buttons.forEach(function (button) {
1943    domCache[button].disabled = disabled;
1944  });
1945}
1946
1947function setInputDisabled(input, disabled) {
1948  if (!input) {
1949    return false;
1950  }
1951
1952  if (input.type === 'radio') {
1953    var radiosContainer = input.parentNode.parentNode;
1954    var radios = radiosContainer.querySelectorAll('input');
1955
1956    for (var i = 0; i < radios.length; i++) {
1957      radios[i].disabled = disabled;
1958    }
1959  } else {
1960    input.disabled = disabled;
1961  }
1962}
1963
1964function enableButtons() {
1965  setButtonsDisabled(this, ['confirmButton', 'cancelButton'], false);
1966}
1967function disableButtons() {
1968  setButtonsDisabled(this, ['confirmButton', 'cancelButton'], true);
1969} // @deprecated
1970
1971function enableConfirmButton() {
1972  warnAboutDepreation('Swal.enableConfirmButton()', "Swal.getConfirmButton().removeAttribute('disabled')");
1973  setButtonsDisabled(this, ['confirmButton'], false);
1974} // @deprecated
1975
1976function disableConfirmButton() {
1977  warnAboutDepreation('Swal.disableConfirmButton()', "Swal.getConfirmButton().setAttribute('disabled', '')");
1978  setButtonsDisabled(this, ['confirmButton'], true);
1979}
1980function enableInput() {
1981  return setInputDisabled(this.getInput(), false);
1982}
1983function disableInput() {
1984  return setInputDisabled(this.getInput(), true);
1985}
1986
1987function showValidationMessage(error) {
1988  var domCache = privateProps.domCache.get(this);
1989  domCache.validationMessage.innerHTML = error;
1990  var popupComputedStyle = window.getComputedStyle(domCache.popup);
1991  domCache.validationMessage.style.marginLeft = "-".concat(popupComputedStyle.getPropertyValue('padding-left'));
1992  domCache.validationMessage.style.marginRight = "-".concat(popupComputedStyle.getPropertyValue('padding-right'));
1993  show(domCache.validationMessage);
1994  var input = this.getInput();
1995
1996  if (input) {
1997    input.setAttribute('aria-invalid', true);
1998    input.setAttribute('aria-describedBy', swalClasses['validation-message']);
1999    focusInput(input);
2000    addClass(input, swalClasses.inputerror);
2001  }
2002} // Hide block with validation message
2003
2004function resetValidationMessage$1() {
2005  var domCache = privateProps.domCache.get(this);
2006
2007  if (domCache.validationMessage) {
2008    hide(domCache.validationMessage);
2009  }
2010
2011  var input = this.getInput();
2012
2013  if (input) {
2014    input.removeAttribute('aria-invalid');
2015    input.removeAttribute('aria-describedBy');
2016    removeClass(input, swalClasses.inputerror);
2017  }
2018}
2019
2020function getProgressSteps$1() {
2021  warnAboutDepreation('Swal.getProgressSteps()', "const swalInstance = Swal.fire({progressSteps: ['1', '2', '3']}); const progressSteps = swalInstance.params.progressSteps");
2022  var innerParams = privateProps.innerParams.get(this);
2023  return innerParams.progressSteps;
2024}
2025function setProgressSteps(progressSteps) {
2026  warnAboutDepreation('Swal.setProgressSteps()', 'Swal.update()');
2027  var innerParams = privateProps.innerParams.get(this);
2028
2029  var updatedParams = _extends({}, innerParams, {
2030    progressSteps: progressSteps
2031  });
2032
2033  renderProgressSteps(this, updatedParams);
2034  privateProps.innerParams.set(this, updatedParams);
2035}
2036function showProgressSteps() {
2037  var domCache = privateProps.domCache.get(this);
2038  show(domCache.progressSteps);
2039}
2040function hideProgressSteps() {
2041  var domCache = privateProps.domCache.get(this);
2042  hide(domCache.progressSteps);
2043}
2044
2045var Timer =
2046/*#__PURE__*/
2047function () {
2048  function Timer(callback, delay) {
2049    _classCallCheck(this, Timer);
2050
2051    this.callback = callback;
2052    this.remaining = delay;
2053    this.running = false;
2054    this.start();
2055  }
2056
2057  _createClass(Timer, [{
2058    key: "start",
2059    value: function start() {
2060      if (!this.running) {
2061        this.running = true;
2062        this.started = new Date();
2063        this.id = setTimeout(this.callback, this.remaining);
2064      }
2065
2066      return this.remaining;
2067    }
2068  }, {
2069    key: "stop",
2070    value: function stop() {
2071      if (this.running) {
2072        this.running = false;
2073        clearTimeout(this.id);
2074        this.remaining -= new Date() - this.started;
2075      }
2076
2077      return this.remaining;
2078    }
2079  }, {
2080    key: "increase",
2081    value: function increase(n) {
2082      var running = this.running;
2083
2084      if (running) {
2085        this.stop();
2086      }
2087
2088      this.remaining += n;
2089
2090      if (running) {
2091        this.start();
2092      }
2093
2094      return this.remaining;
2095    }
2096  }, {
2097    key: "getTimerLeft",
2098    value: function getTimerLeft() {
2099      if (this.running) {
2100        this.stop();
2101        this.start();
2102      }
2103
2104      return this.remaining;
2105    }
2106  }, {
2107    key: "isRunning",
2108    value: function isRunning() {
2109      return this.running;
2110    }
2111  }]);
2112
2113  return Timer;
2114}();
2115
2116var defaultInputValidators = {
2117  email: function email(string, validationMessage) {
2118    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');
2119  },
2120  url: function url(string, validationMessage) {
2121    // taken from https://stackoverflow.com/a/3809435 with a small change from #1306
2122    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');
2123  }
2124};
2125
2126function setDefaultInputValidators(params) {
2127  // Use default `inputValidator` for supported input types if not provided
2128  if (!params.inputValidator) {
2129    Object.keys(defaultInputValidators).forEach(function (key) {
2130      if (params.input === key) {
2131        params.inputValidator = defaultInputValidators[key];
2132      }
2133    });
2134  }
2135}
2136
2137function validateCustomTargetElement(params) {
2138  // Determine if the custom target element is valid
2139  if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) {
2140    warn('Target parameter is not valid, defaulting to "body"');
2141    params.target = 'body';
2142  }
2143}
2144/**
2145 * Set type, text and actions on popup
2146 *
2147 * @param params
2148 * @returns {boolean}
2149 */
2150
2151
2152function setParameters(params) {
2153  setDefaultInputValidators(params); // showLoaderOnConfirm && preConfirm
2154
2155  if (params.showLoaderOnConfirm && !params.preConfirm) {
2156    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');
2157  } // params.animation will be actually used in renderPopup.js
2158  // but in case when params.animation is a function, we need to call that function
2159  // before popup (re)initialization, so it'll be possible to check Swal.isVisible()
2160  // inside the params.animation function
2161
2162
2163  params.animation = callIfFunction(params.animation);
2164  validateCustomTargetElement(params); // Replace newlines with <br> in title
2165
2166  if (typeof params.title === 'string') {
2167    params.title = params.title.split('\n').join('<br />');
2168  }
2169
2170  init(params);
2171}
2172
2173function swalOpenAnimationFinished(popup, container) {
2174  popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished);
2175  container.style.overflowY = 'auto';
2176}
2177/**
2178 * Open popup, add necessary classes and styles, fix scrollbar
2179 *
2180 * @param {Array} params
2181 */
2182
2183
2184var openPopup = function openPopup(params) {
2185  var container = getContainer();
2186  var popup = getPopup();
2187
2188  if (typeof params.onBeforeOpen === 'function') {
2189    params.onBeforeOpen(popup);
2190  }
2191
2192  addClasses(container, popup, params); // scrolling is 'hidden' until animation is done, after that 'auto'
2193
2194  setScrollingVisibility(container, popup);
2195
2196  if (isModal()) {
2197    fixScrollContainer(container, params.scrollbarPadding);
2198  }
2199
2200  if (!isToast() && !globalState.previousActiveElement) {
2201    globalState.previousActiveElement = document.activeElement;
2202  }
2203
2204  if (typeof params.onOpen === 'function') {
2205    setTimeout(function () {
2206      return params.onOpen(popup);
2207    });
2208  }
2209};
2210
2211var setScrollingVisibility = function setScrollingVisibility(container, popup) {
2212  if (animationEndEvent && hasCssAnimation(popup)) {
2213    container.style.overflowY = 'hidden';
2214    popup.addEventListener(animationEndEvent, swalOpenAnimationFinished.bind(null, popup, container));
2215  } else {
2216    container.style.overflowY = 'auto';
2217  }
2218};
2219
2220var fixScrollContainer = function fixScrollContainer(container, scrollbarPadding) {
2221  iOSfix();
2222  IEfix();
2223  setAriaHidden();
2224
2225  if (scrollbarPadding) {
2226    fixScrollbar();
2227  } // sweetalert2/issues/1247
2228
2229
2230  setTimeout(function () {
2231    container.scrollTop = 0;
2232  });
2233};
2234
2235var addClasses = function addClasses(container, popup, params) {
2236  if (params.animation) {
2237    addClass(popup, swalClasses.show);
2238    addClass(container, swalClasses.fade);
2239  }
2240
2241  show(popup);
2242  addClass([document.documentElement, document.body, container], swalClasses.shown);
2243
2244  if (params.heightAuto && params.backdrop && !params.toast) {
2245    addClass([document.documentElement, document.body], swalClasses['height-auto']);
2246  }
2247};
2248
2249var handleInputOptionsAndValue = function handleInputOptionsAndValue(instance, params) {
2250  if (params.input === 'select' || params.input === 'radio') {
2251    handleInputOptions(instance, params);
2252  } else if (['text', 'email', 'number', 'tel', 'textarea'].indexOf(params.input) !== -1 && isPromise(params.inputValue)) {
2253    handleInputValue(instance, params);
2254  }
2255};
2256
2257var handleInputOptions = function handleInputOptions(instance, params) {
2258  var content = getContent();
2259
2260  var processInputOptions = function processInputOptions(inputOptions) {
2261    return populateInputOptions[params.input](content, formatInputOptions(inputOptions), params);
2262  };
2263
2264  if (isPromise(params.inputOptions)) {
2265    showLoading();
2266    params.inputOptions.then(function (inputOptions) {
2267      instance.hideLoading();
2268      processInputOptions(inputOptions);
2269    });
2270  } else if (_typeof(params.inputOptions) === 'object') {
2271    processInputOptions(params.inputOptions);
2272  } else {
2273    error("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(_typeof(params.inputOptions)));
2274  }
2275};
2276
2277var handleInputValue = function handleInputValue(instance, params) {
2278  var input = instance.getInput();
2279  hide(input);
2280  params.inputValue.then(function (inputValue) {
2281    input.value = params.input === 'number' ? parseFloat(inputValue) || 0 : inputValue + '';
2282    show(input);
2283    input.focus();
2284    instance.hideLoading();
2285  })["catch"](function (err) {
2286    error('Error in inputValue promise: ' + err);
2287    input.value = '';
2288    show(input);
2289    input.focus();
2290    instance.hideLoading();
2291  });
2292};
2293
2294var populateInputOptions = {
2295  select: function select(content, inputOptions, params) {
2296    var select = getChildByClass(content, swalClasses.select);
2297    inputOptions.forEach(function (inputOption) {
2298      var optionValue = inputOption[0];
2299      var optionLabel = inputOption[1];
2300      var option = document.createElement('option');
2301      option.value = optionValue;
2302      option.innerHTML = optionLabel;
2303
2304      if (params.inputValue.toString() === optionValue.toString()) {
2305        option.selected = true;
2306      }
2307
2308      select.appendChild(option);
2309    });
2310    select.focus();
2311  },
2312  radio: function radio(content, inputOptions, params) {
2313    var radio = getChildByClass(content, swalClasses.radio);
2314    inputOptions.forEach(function (inputOption) {
2315      var radioValue = inputOption[0];
2316      var radioLabel = inputOption[1];
2317      var radioInput = document.createElement('input');
2318      var radioLabelElement = document.createElement('label');
2319      radioInput.type = 'radio';
2320      radioInput.name = swalClasses.radio;
2321      radioInput.value = radioValue;
2322
2323      if (params.inputValue.toString() === radioValue.toString()) {
2324        radioInput.checked = true;
2325      }
2326
2327      var label = document.createElement('span');
2328      label.innerHTML = radioLabel;
2329      label.className = swalClasses.label;
2330      radioLabelElement.appendChild(radioInput);
2331      radioLabelElement.appendChild(label);
2332      radio.appendChild(radioLabelElement);
2333    });
2334    var radios = radio.querySelectorAll('input');
2335
2336    if (radios.length) {
2337      radios[0].focus();
2338    }
2339  }
2340  /**
2341   * Converts `inputOptions` into an array of `[value, label]`s
2342   * @param inputOptions
2343   */
2344
2345};
2346
2347var formatInputOptions = function formatInputOptions(inputOptions) {
2348  var result = [];
2349
2350  if (typeof Map !== 'undefined' && inputOptions instanceof Map) {
2351    inputOptions.forEach(function (value, key) {
2352      result.push([key, value]);
2353    });
2354  } else {
2355    Object.keys(inputOptions).forEach(function (key) {
2356      result.push([key, inputOptions[key]]);
2357    });
2358  }
2359
2360  return result;
2361};
2362
2363var handleConfirmButtonClick = function handleConfirmButtonClick(instance, innerParams) {
2364  instance.disableButtons();
2365
2366  if (innerParams.input) {
2367    handleConfirmWithInput(instance, innerParams);
2368  } else {
2369    confirm(instance, innerParams, true);
2370  }
2371};
2372var handleCancelButtonClick = function handleCancelButtonClick(instance, dismissWith) {
2373  instance.disableButtons();
2374  dismissWith(DismissReason.cancel);
2375};
2376
2377var handleConfirmWithInput = function handleConfirmWithInput(instance, innerParams) {
2378  var inputValue = getInputValue(instance, innerParams);
2379
2380  if (innerParams.inputValidator) {
2381    instance.disableInput();
2382    var validationPromise = Promise.resolve().then(function () {
2383      return innerParams.inputValidator(inputValue, innerParams.validationMessage);
2384    });
2385    validationPromise.then(function (validationMessage) {
2386      instance.enableButtons();
2387      instance.enableInput();
2388
2389      if (validationMessage) {
2390        instance.showValidationMessage(validationMessage);
2391      } else {
2392        confirm(instance, innerParams, inputValue);
2393      }
2394    });
2395  } else if (!instance.getInput().checkValidity()) {
2396    instance.enableButtons();
2397    instance.showValidationMessage(innerParams.validationMessage);
2398  } else {
2399    confirm(instance, innerParams, inputValue);
2400  }
2401};
2402
2403var succeedWith = function succeedWith(instance, value) {
2404  instance.closePopup({
2405    value: value
2406  });
2407};
2408
2409var confirm = function confirm(instance, innerParams, value) {
2410  if (innerParams.showLoaderOnConfirm) {
2411    showLoading(); // TODO: make showLoading an *instance* method
2412  }
2413
2414  if (innerParams.preConfirm) {
2415    instance.resetValidationMessage();
2416    var preConfirmPromise = Promise.resolve().then(function () {
2417      return innerParams.preConfirm(value, innerParams.validationMessage);
2418    });
2419    preConfirmPromise.then(function (preConfirmValue) {
2420      if (isVisible(getValidationMessage()) || preConfirmValue === false) {
2421        instance.hideLoading();
2422      } else {
2423        succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue);
2424      }
2425    });
2426  } else {
2427    succeedWith(instance, value);
2428  }
2429};
2430
2431var getInputValue = function getInputValue(instance, innerParams) {
2432  var input = instance.getInput();
2433
2434  if (!input) {
2435    return null;
2436  }
2437
2438  switch (innerParams.input) {
2439    case 'checkbox':
2440      return getCheckboxValue(input);
2441
2442    case 'radio':
2443      return getRadioValue(input);
2444
2445    case 'file':
2446      return getFileValue(input);
2447
2448    default:
2449      return innerParams.inputAutoTrim ? input.value.trim() : input.value;
2450  }
2451};
2452
2453var getCheckboxValue = function getCheckboxValue(input) {
2454  return input.checked ? 1 : 0;
2455};
2456
2457var getRadioValue = function getRadioValue(input) {
2458  return input.checked ? input.value : null;
2459};
2460
2461var getFileValue = function getFileValue(input) {
2462  return input.files.length ? input.files[0] : null;
2463};
2464
2465var addKeydownHandler = function addKeydownHandler(instance, globalState, innerParams, dismissWith) {
2466  if (globalState.keydownTarget && globalState.keydownHandlerAdded) {
2467    globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {
2468      capture: globalState.keydownListenerCapture
2469    });
2470    globalState.keydownHandlerAdded = false;
2471  }
2472
2473  if (!innerParams.toast) {
2474    globalState.keydownHandler = function (e) {
2475      return keydownHandler(instance, e, innerParams, dismissWith);
2476    };
2477
2478    globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup();
2479    globalState.keydownListenerCapture = innerParams.keydownListenerCapture;
2480    globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {
2481      capture: globalState.keydownListenerCapture
2482    });
2483    globalState.keydownHandlerAdded = true;
2484  }
2485}; // Focus handling
2486
2487var setFocus = function setFocus(innerParams, index, increment) {
2488  var focusableElements = getFocusableElements(innerParams.focusCancel); // search for visible elements and select the next possible match
2489
2490  for (var i = 0; i < focusableElements.length; i++) {
2491    index = index + increment; // rollover to first item
2492
2493    if (index === focusableElements.length) {
2494      index = 0; // go to last item
2495    } else if (index === -1) {
2496      index = focusableElements.length - 1;
2497    }
2498
2499    return focusableElements[index].focus();
2500  } // no visible focusable elements, focus the popup
2501
2502
2503  getPopup().focus();
2504};
2505var arrowKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Left', 'Right', 'Up', 'Down' // IE11
2506];
2507var escKeys = ['Escape', 'Esc' // IE11
2508];
2509
2510var keydownHandler = function keydownHandler(instance, e, innerParams, dismissWith) {
2511  if (innerParams.stopKeydownPropagation) {
2512    e.stopPropagation();
2513  } // ENTER
2514
2515
2516  if (e.key === 'Enter') {
2517    handleEnter(instance, e, innerParams); // TAB
2518  } else if (e.key === 'Tab') {
2519    handleTab(e, innerParams); // ARROWS - switch focus between buttons
2520  } else if (arrowKeys.indexOf(e.key) !== -1) {
2521    handleArrows(); // ESC
2522  } else if (escKeys.indexOf(e.key) !== -1) {
2523    handleEsc(e, innerParams, dismissWith);
2524  }
2525};
2526
2527var handleEnter = function handleEnter(instance, e, innerParams) {
2528  // #720 #721
2529  if (e.isComposing) {
2530    return;
2531  }
2532
2533  if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) {
2534    if (['textarea', 'file'].indexOf(innerParams.input) !== -1) {
2535      return; // do not submit
2536    }
2537
2538    clickConfirm();
2539    e.preventDefault();
2540  }
2541};
2542
2543var handleTab = function handleTab(e, innerParams) {
2544  var targetElement = e.target;
2545  var focusableElements = getFocusableElements(innerParams.focusCancel);
2546  var btnIndex = -1;
2547
2548  for (var i = 0; i < focusableElements.length; i++) {
2549    if (targetElement === focusableElements[i]) {
2550      btnIndex = i;
2551      break;
2552    }
2553  }
2554
2555  if (!e.shiftKey) {
2556    // Cycle to the next button
2557    setFocus(innerParams, btnIndex, 1);
2558  } else {
2559    // Cycle to the prev button
2560    setFocus(innerParams, btnIndex, -1);
2561  }
2562
2563  e.stopPropagation();
2564  e.preventDefault();
2565};
2566
2567var handleArrows = function handleArrows() {
2568  var confirmButton = getConfirmButton();
2569  var cancelButton = getCancelButton(); // focus Cancel button if Confirm button is currently focused
2570
2571  if (document.activeElement === confirmButton && isVisible(cancelButton)) {
2572    cancelButton.focus(); // and vice versa
2573  } else if (document.activeElement === cancelButton && isVisible(confirmButton)) {
2574    confirmButton.focus();
2575  }
2576};
2577
2578var handleEsc = function handleEsc(e, innerParams, dismissWith) {
2579  if (callIfFunction(innerParams.allowEscapeKey)) {
2580    e.preventDefault();
2581    dismissWith(DismissReason.esc);
2582  }
2583};
2584
2585var handlePopupClick = function handlePopupClick(domCache, innerParams, dismissWith) {
2586  if (innerParams.toast) {
2587    handleToastClick(domCache, innerParams, dismissWith);
2588  } else {
2589    // Ignore click events that had mousedown on the popup but mouseup on the container
2590    // This can happen when the user drags a slider
2591    handleModalMousedown(domCache); // Ignore click events that had mousedown on the container but mouseup on the popup
2592
2593    handleContainerMousedown(domCache);
2594    handleModalClick(domCache, innerParams, dismissWith);
2595  }
2596};
2597
2598var handleToastClick = function handleToastClick(domCache, innerParams, dismissWith) {
2599  // Closing toast by internal click
2600  domCache.popup.onclick = function () {
2601    if (innerParams.showConfirmButton || innerParams.showCancelButton || innerParams.showCloseButton || innerParams.input) {
2602      return;
2603    }
2604
2605    dismissWith(DismissReason.close);
2606  };
2607};
2608
2609var ignoreOutsideClick = false;
2610
2611var handleModalMousedown = function handleModalMousedown(domCache) {
2612  domCache.popup.onmousedown = function () {
2613    domCache.container.onmouseup = function (e) {
2614      domCache.container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't
2615      // have any other direct children aside of the popup
2616
2617      if (e.target === domCache.container) {
2618        ignoreOutsideClick = true;
2619      }
2620    };
2621  };
2622};
2623
2624var handleContainerMousedown = function handleContainerMousedown(domCache) {
2625  domCache.container.onmousedown = function () {
2626    domCache.popup.onmouseup = function (e) {
2627      domCache.popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup
2628
2629      if (e.target === domCache.popup || domCache.popup.contains(e.target)) {
2630        ignoreOutsideClick = true;
2631      }
2632    };
2633  };
2634};
2635
2636var handleModalClick = function handleModalClick(domCache, innerParams, dismissWith) {
2637  domCache.container.onclick = function (e) {
2638    if (ignoreOutsideClick) {
2639      ignoreOutsideClick = false;
2640      return;
2641    }
2642
2643    if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) {
2644      dismissWith(DismissReason.backdrop);
2645    }
2646  };
2647};
2648
2649function _main(userParams) {
2650  showWarningsForParams(userParams); // Check if there is another Swal closing
2651
2652  if (getPopup() && globalState.swalCloseEventFinishedCallback) {
2653    globalState.swalCloseEventFinishedCallback();
2654    delete globalState.swalCloseEventFinishedCallback;
2655  } // Check if there is a swal disposal defer timer
2656
2657
2658  if (globalState.deferDisposalTimer) {
2659    clearTimeout(globalState.deferDisposalTimer);
2660    delete globalState.deferDisposalTimer;
2661  }
2662
2663  var innerParams = _extends({}, defaultParams, userParams);
2664
2665  setParameters(innerParams);
2666  Object.freeze(innerParams); // clear the previous timer
2667
2668  if (globalState.timeout) {
2669    globalState.timeout.stop();
2670    delete globalState.timeout;
2671  } // clear the restore focus timeout
2672
2673
2674  clearTimeout(globalState.restoreFocusTimeout);
2675  var domCache = populateDomCache(this);
2676  render(this, innerParams);
2677  privateProps.innerParams.set(this, innerParams);
2678  return swalPromise(this, domCache, innerParams);
2679}
2680
2681var swalPromise = function swalPromise(instance, domCache, innerParams) {
2682  return new Promise(function (resolve) {
2683    // functions to handle all closings/dismissals
2684    var dismissWith = function dismissWith(dismiss) {
2685      instance.closePopup({
2686        dismiss: dismiss
2687      });
2688    };
2689
2690    privateMethods.swalPromiseResolve.set(instance, resolve);
2691    setupTimer(globalState, innerParams, dismissWith);
2692
2693    domCache.confirmButton.onclick = function () {
2694      return handleConfirmButtonClick(instance, innerParams);
2695    };
2696
2697    domCache.cancelButton.onclick = function () {
2698      return handleCancelButtonClick(instance, dismissWith);
2699    };
2700
2701    domCache.closeButton.onclick = function () {
2702      return dismissWith(DismissReason.close);
2703    };
2704
2705    handlePopupClick(domCache, innerParams, dismissWith);
2706    addKeydownHandler(instance, globalState, innerParams, dismissWith);
2707
2708    if (innerParams.toast && (innerParams.input || innerParams.footer || innerParams.showCloseButton)) {
2709      addClass(document.body, swalClasses['toast-column']);
2710    } else {
2711      removeClass(document.body, swalClasses['toast-column']);
2712    }
2713
2714    handleInputOptionsAndValue(instance, innerParams);
2715    openPopup(innerParams);
2716    initFocus(domCache, innerParams); // Scroll container to top on open (#1247)
2717
2718    domCache.container.scrollTop = 0;
2719  });
2720};
2721
2722var populateDomCache = function populateDomCache(instance) {
2723  var domCache = {
2724    popup: getPopup(),
2725    container: getContainer(),
2726    content: getContent(),
2727    actions: getActions(),
2728    confirmButton: getConfirmButton(),
2729    cancelButton: getCancelButton(),
2730    closeButton: getCloseButton(),
2731    validationMessage: getValidationMessage(),
2732    progressSteps: getProgressSteps()
2733  };
2734  privateProps.domCache.set(instance, domCache);
2735  return domCache;
2736};
2737
2738var setupTimer = function setupTimer(globalState$$1, innerParams, dismissWith) {
2739  if (innerParams.timer) {
2740    globalState$$1.timeout = new Timer(function () {
2741      dismissWith('timer');
2742      delete globalState$$1.timeout;
2743    }, innerParams.timer);
2744  }
2745};
2746
2747var initFocus = function initFocus(domCache, innerParams) {
2748  if (innerParams.toast) {
2749    return;
2750  }
2751
2752  if (!callIfFunction(innerParams.allowEnterKey)) {
2753    return blurActiveElement();
2754  }
2755
2756  if (innerParams.focusCancel && isVisible(domCache.cancelButton)) {
2757    return domCache.cancelButton.focus();
2758  }
2759
2760  if (innerParams.focusConfirm && isVisible(domCache.confirmButton)) {
2761    return domCache.confirmButton.focus();
2762  }
2763
2764  setFocus(innerParams, -1, 1);
2765};
2766
2767var blurActiveElement = function blurActiveElement() {
2768  if (document.activeElement && typeof document.activeElement.blur === 'function') {
2769    document.activeElement.blur();
2770  }
2771};
2772
2773/**
2774 * Updates popup parameters.
2775 */
2776
2777function update(params) {
2778  var validUpdatableParams = {}; // assign valid params from `params` to `defaults`
2779
2780  Object.keys(params).forEach(function (param) {
2781    if (Swal.isUpdatableParameter(param)) {
2782      validUpdatableParams[param] = params[param];
2783    } else {
2784      warn("Invalid parameter to update: \"".concat(param, "\". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js"));
2785    }
2786  });
2787  var innerParams = privateProps.innerParams.get(this);
2788
2789  var updatedParams = _extends({}, innerParams, validUpdatableParams);
2790
2791  render(this, updatedParams);
2792  privateProps.innerParams.set(this, updatedParams);
2793  Object.defineProperties(this, {
2794    params: {
2795      value: _extends({}, this.params, params),
2796      writable: false,
2797      enumerable: true
2798    }
2799  });
2800}
2801
2802
2803
2804var instanceMethods = Object.freeze({
2805	hideLoading: hideLoading,
2806	disableLoading: hideLoading,
2807	getInput: getInput$1,
2808	close: close,
2809	closePopup: close,
2810	closeModal: close,
2811	closeToast: close,
2812	enableButtons: enableButtons,
2813	disableButtons: disableButtons,
2814	enableConfirmButton: enableConfirmButton,
2815	disableConfirmButton: disableConfirmButton,
2816	enableInput: enableInput,
2817	disableInput: disableInput,
2818	showValidationMessage: showValidationMessage,
2819	resetValidationMessage: resetValidationMessage$1,
2820	getProgressSteps: getProgressSteps$1,
2821	setProgressSteps: setProgressSteps,
2822	showProgressSteps: showProgressSteps,
2823	hideProgressSteps: hideProgressSteps,
2824	_main: _main,
2825	update: update
2826});
2827
2828var currentInstance; // SweetAlert constructor
2829
2830function SweetAlert() {
2831  // Prevent run in Node env
2832
2833  /* istanbul ignore if */
2834  if (typeof window === 'undefined') {
2835    return;
2836  } // Check for the existence of Promise
2837
2838  /* istanbul ignore if */
2839
2840
2841  if (typeof Promise === 'undefined') {
2842    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)');
2843  }
2844
2845  currentInstance = this;
2846
2847  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2848    args[_key] = arguments[_key];
2849  }
2850
2851  var outerParams = Object.freeze(this.constructor.argsToParams(args));
2852  Object.defineProperties(this, {
2853    params: {
2854      value: outerParams,
2855      writable: false,
2856      enumerable: true,
2857      configurable: true
2858    }
2859  });
2860
2861  var promise = this._main(this.params);
2862
2863  privateProps.promise.set(this, promise);
2864} // `catch` cannot be the name of a module export, so we define our thenable methods here instead
2865
2866
2867SweetAlert.prototype.then = function (onFulfilled) {
2868  var promise = privateProps.promise.get(this);
2869  return promise.then(onFulfilled);
2870};
2871
2872SweetAlert.prototype["finally"] = function (onFinally) {
2873  var promise = privateProps.promise.get(this);
2874  return promise["finally"](onFinally);
2875}; // Assign instance methods from src/instanceMethods/*.js to prototype
2876
2877
2878_extends(SweetAlert.prototype, instanceMethods); // Assign static methods from src/staticMethods/*.js to constructor
2879
2880
2881_extends(SweetAlert, staticMethods); // Proxy to instance methods to constructor, for now, for backwards compatibility
2882
2883
2884Object.keys(instanceMethods).forEach(function (key) {
2885  SweetAlert[key] = function () {
2886    if (currentInstance) {
2887      var _currentInstance;
2888
2889      return (_currentInstance = currentInstance)[key].apply(_currentInstance, arguments);
2890    }
2891  };
2892});
2893SweetAlert.DismissReason = DismissReason;
2894SweetAlert.version = '8.17.1';
2895
2896var Swal = SweetAlert;
2897Swal["default"] = Swal;
2898
2899return Swal;
2900
2901})));
2902if (typeof this !== 'undefined' && this.Sweetalert2){  this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.