sweetalert2 11.7.4 → 11.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sweetalert2 v11.7.4
2
+ * sweetalert2 v11.7.6
3
3
  * Released under the MIT License.
4
4
  */
5
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Sweetalert2=t()}(this,(function(){"use strict";var e={awaitingPromise:new WeakMap,promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap};const t=e=>{const t={};for(const n in e)t[e[n]]="swal2-"+e[n];return t},n=t(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","default-outline","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"]),o=t(["success","warning","info","question","error"]),i="SweetAlert2:",s=e=>e.charAt(0).toUpperCase()+e.slice(1),r=e=>{console.warn(`${i} ${"object"==typeof e?e.join(" "):e}`)},a=e=>{console.error(`${i} ${e}`)},l=[],c=(e,t)=>{var n;n=`"${e}" is deprecated and will be removed in the next major release. Please use "${t}" instead.`,l.includes(n)||(l.push(n),r(n))},u=e=>"function"==typeof e?e():e,d=e=>e&&"function"==typeof e.toPromise,p=e=>d(e)?e.toPromise():Promise.resolve(e),m=e=>e&&Promise.resolve(e)===e,g=()=>document.body.querySelector(`.${n.container}`),h=e=>{const t=g();return t?t.querySelector(e):null},f=e=>h(`.${e}`),b=()=>f(n.popup),y=()=>f(n.icon),w=()=>f(n.title),v=()=>f(n["html-container"]),C=()=>f(n.image),A=()=>f(n["progress-steps"]),k=()=>f(n["validation-message"]),B=()=>h(`.${n.actions} .${n.confirm}`),P=()=>h(`.${n.actions} .${n.cancel}`),x=()=>h(`.${n.actions} .${n.deny}`),E=()=>h(`.${n.loader}`),$=()=>f(n.actions),T=()=>f(n.footer),S=()=>f(n["timer-progress-bar"]),L=()=>f(n.close),O=()=>{const e=Array.from(b().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort(((e,t)=>{const n=parseInt(e.getAttribute("tabindex")),o=parseInt(t.getAttribute("tabindex"));return n>o?1:n<o?-1:0})),t=Array.from(b().querySelectorAll('\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')).filter((e=>"-1"!==e.getAttribute("tabindex")));return(e=>{const t=[];for(let n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t})(e.concat(t)).filter((e=>J(e)))},j=()=>D(document.body,n.shown)&&!D(document.body,n["toast-shown"])&&!D(document.body,n["no-backdrop"]),M=()=>b()&&D(b(),n.toast),H={previousBodyPadding:null},I=(e,t)=>{if(e.textContent="",t){const n=(new DOMParser).parseFromString(t,"text/html");Array.from(n.querySelector("head").childNodes).forEach((t=>{e.appendChild(t)})),Array.from(n.querySelector("body").childNodes).forEach((t=>{t instanceof HTMLVideoElement||t instanceof HTMLAudioElement?e.appendChild(t.cloneNode(!0)):e.appendChild(t)}))}},D=(e,t)=>{if(!t)return!1;const n=t.split(/\s+/);for(let t=0;t<n.length;t++)if(!e.classList.contains(n[t]))return!1;return!0},q=(e,t,i)=>{if(((e,t)=>{Array.from(e.classList).forEach((i=>{Object.values(n).includes(i)||Object.values(o).includes(i)||Object.values(t.showClass).includes(i)||e.classList.remove(i)}))})(e,t),t.customClass&&t.customClass[i]){if("string"!=typeof t.customClass[i]&&!t.customClass[i].forEach)return void r(`Invalid type of customClass.${i}! Expected string or iterable object, got "${typeof t.customClass[i]}"`);R(e,t.customClass[i])}},V=(e,t)=>{if(!t)return null;switch(t){case"select":case"textarea":case"file":return e.querySelector(`.${n.popup} > .${n[t]}`);case"checkbox":return e.querySelector(`.${n.popup} > .${n.checkbox} input`);case"radio":return e.querySelector(`.${n.popup} > .${n.radio} input:checked`)||e.querySelector(`.${n.popup} > .${n.radio} input:first-child`);case"range":return e.querySelector(`.${n.popup} > .${n.range} input`);default:return e.querySelector(`.${n.popup} > .${n.input}`)}},N=e=>{if(e.focus(),"file"!==e.type){const t=e.value;e.value="",e.value=t}},F=(e,t,n)=>{e&&t&&("string"==typeof t&&(t=t.split(/\s+/).filter(Boolean)),t.forEach((t=>{Array.isArray(e)?e.forEach((e=>{n?e.classList.add(t):e.classList.remove(t)})):n?e.classList.add(t):e.classList.remove(t)})))},R=(e,t)=>{F(e,t,!0)},U=(e,t)=>{F(e,t,!1)},_=(e,t)=>{const n=Array.from(e.children);for(let e=0;e<n.length;e++){const o=n[e];if(o instanceof HTMLElement&&D(o,t))return o}},W=(e,t,n)=>{n===`${parseInt(n)}`&&(n=parseInt(n)),n||0===parseInt(n)?e.style[t]="number"==typeof n?`${n}px`:n:e.style.removeProperty(t)},z=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"flex";e.style.display=t},K=e=>{e.style.display="none"},Y=(e,t,n,o)=>{const i=e.querySelector(t);i&&(i.style[n]=o)},Z=function(e,t){t?z(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"flex"):K(e)},J=e=>!(!e||!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)),X=e=>!!(e.scrollHeight>e.clientHeight),G=e=>{const t=window.getComputedStyle(e),n=parseFloat(t.getPropertyValue("animation-duration")||"0"),o=parseFloat(t.getPropertyValue("transition-duration")||"0");return n>0||o>0},Q=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=S();J(n)&&(t&&(n.style.transition="none",n.style.width="100%"),setTimeout((()=>{n.style.transition=`width ${e/1e3}s linear`,n.style.width="0%"}),10))},ee={},te=e=>new Promise((t=>{if(!e)return t();const n=window.scrollX,o=window.scrollY;ee.restoreFocusTimeout=setTimeout((()=>{ee.previousActiveElement instanceof HTMLElement?(ee.previousActiveElement.focus(),ee.previousActiveElement=null):document.body&&document.body.focus(),t()}),100),window.scrollTo(n,o)})),ne=()=>"undefined"==typeof window||"undefined"==typeof document,oe=`\n <div aria-labelledby="${n.title}" aria-describedby="${n["html-container"]}" class="${n.popup}" tabindex="-1">\n <button type="button" class="${n.close}"></button>\n <ul class="${n["progress-steps"]}"></ul>\n <div class="${n.icon}"></div>\n <img class="${n.image}" />\n <h2 class="${n.title}" id="${n.title}"></h2>\n <div class="${n["html-container"]}" id="${n["html-container"]}"></div>\n <input class="${n.input}" />\n <input type="file" class="${n.file}" />\n <div class="${n.range}">\n <input type="range" />\n <output></output>\n </div>\n <select class="${n.select}"></select>\n <div class="${n.radio}"></div>\n <label for="${n.checkbox}" class="${n.checkbox}">\n <input type="checkbox" />\n <span class="${n.label}"></span>\n </label>\n <textarea class="${n.textarea}"></textarea>\n <div class="${n["validation-message"]}" id="${n["validation-message"]}"></div>\n <div class="${n.actions}">\n <div class="${n.loader}"></div>\n <button type="button" class="${n.confirm}"></button>\n <button type="button" class="${n.deny}"></button>\n <button type="button" class="${n.cancel}"></button>\n </div>\n <div class="${n.footer}"></div>\n <div class="${n["timer-progress-bar-container"]}">\n <div class="${n["timer-progress-bar"]}"></div>\n </div>\n </div>\n`.replace(/(^|\n)\s*/g,""),ie=()=>{ee.currentInstance.resetValidationMessage()},se=e=>{const t=(()=>{const e=g();return!!e&&(e.remove(),U([document.documentElement,document.body],[n["no-backdrop"],n["toast-shown"],n["has-column"]]),!0)})();if(ne())return void a("SweetAlert2 requires document to initialize");const o=document.createElement("div");o.className=n.container,t&&R(o,n["no-transition"]),I(o,oe);const i="string"==typeof(s=e.target)?document.querySelector(s):s;var s;i.appendChild(o),(e=>{const t=b();t.setAttribute("role",e.toast?"alert":"dialog"),t.setAttribute("aria-live",e.toast?"polite":"assertive"),e.toast||t.setAttribute("aria-modal","true")})(e),(e=>{"rtl"===window.getComputedStyle(e).direction&&R(g(),n.rtl)})(i),(()=>{const e=b(),t=_(e,n.input),o=_(e,n.file),i=e.querySelector(`.${n.range} input`),s=e.querySelector(`.${n.range} output`),r=_(e,n.select),a=e.querySelector(`.${n.checkbox} input`),l=_(e,n.textarea);t.oninput=ie,o.onchange=ie,r.onchange=ie,a.onchange=ie,l.oninput=ie,i.oninput=()=>{ie(),s.value=i.value},i.onchange=()=>{ie(),s.value=i.value}})()},re=(e,t)=>{e instanceof HTMLElement?t.appendChild(e):"object"==typeof e?ae(e,t):e&&I(t,e)},ae=(e,t)=>{e.jquery?le(t,e):I(t,e.toString())},le=(e,t)=>{if(e.textContent="",0 in t)for(let n=0;n in t;n++)e.appendChild(t[n].cloneNode(!0));else e.appendChild(t.cloneNode(!0))},ce=(()=>{if(ne())return!1;const e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",animation:"animationend"};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&void 0!==e.style[n])return t[n];return!1})(),ue=(e,t)=>{const o=$(),i=E();t.showConfirmButton||t.showDenyButton||t.showCancelButton?z(o):K(o),q(o,t,"actions"),function(e,t,o){const i=B(),s=x(),r=P();de(i,"confirm",o),de(s,"deny",o),de(r,"cancel",o),function(e,t,o,i){if(!i.buttonsStyling)return void U([e,t,o],n.styled);R([e,t,o],n.styled),i.confirmButtonColor&&(e.style.backgroundColor=i.confirmButtonColor,R(e,n["default-outline"]));i.denyButtonColor&&(t.style.backgroundColor=i.denyButtonColor,R(t,n["default-outline"]));i.cancelButtonColor&&(o.style.backgroundColor=i.cancelButtonColor,R(o,n["default-outline"]))}(i,s,r,o),o.reverseButtons&&(o.toast?(e.insertBefore(r,i),e.insertBefore(s,i)):(e.insertBefore(r,t),e.insertBefore(s,t),e.insertBefore(i,t)))}(o,i,t),I(i,t.loaderHtml),q(i,t,"loader")};function de(e,t,o){Z(e,o[`show${s(t)}Button`],"inline-block"),I(e,o[`${t}ButtonText`]),e.setAttribute("aria-label",o[`${t}ButtonAriaLabel`]),e.className=n[t],q(e,o,`${t}Button`),R(e,o[`${t}ButtonClass`])}const pe=(e,t)=>{const o=g();o&&(!function(e,t){"string"==typeof t?e.style.background=t:t||R([document.documentElement,document.body],n["no-backdrop"])}(o,t.backdrop),function(e,t){t in n?R(e,n[t]):(r('The "position" parameter is not valid, defaulting to "center"'),R(e,n.center))}(o,t.position),function(e,t){if(t&&"string"==typeof t){const o=`grow-${t}`;o in n&&R(e,n[o])}}(o,t.grow),q(o,t,"container"))};const me=["input","file","range","select","radio","checkbox","textarea"],ge=e=>{if(!Ce[e.input])return void a(`Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "${e.input}"`);const t=we(e.input),n=Ce[e.input](t,e);z(t),e.inputAutoFocus&&setTimeout((()=>{N(n)}))},he=(e,t)=>{const n=V(b(),e);if(n){(e=>{for(let t=0;t<e.attributes.length;t++){const n=e.attributes[t].name;["type","value","style"].includes(n)||e.removeAttribute(n)}})(n);for(const e in t)n.setAttribute(e,t[e])}},fe=e=>{const t=we(e.input);"object"==typeof e.customClass&&R(t,e.customClass.input)},be=(e,t)=>{e.placeholder&&!t.inputPlaceholder||(e.placeholder=t.inputPlaceholder)},ye=(e,t,o)=>{if(o.inputLabel){e.id=n.input;const i=document.createElement("label"),s=n["input-label"];i.setAttribute("for",e.id),i.className=s,"object"==typeof o.customClass&&R(i,o.customClass.inputLabel),i.innerText=o.inputLabel,t.insertAdjacentElement("beforebegin",i)}},we=e=>_(b(),n[e]||n.input),ve=(e,t)=>{["string","number"].includes(typeof t)?e.value=`${t}`:m(t)||r(`Unexpected type of inputValue! Expected "string", "number" or "Promise", got "${typeof t}"`)},Ce={};Ce.text=Ce.email=Ce.password=Ce.number=Ce.tel=Ce.url=(e,t)=>(ve(e,t.inputValue),ye(e,e,t),be(e,t),e.type=t.input,e),Ce.file=(e,t)=>(ye(e,e,t),be(e,t),e),Ce.range=(e,t)=>{const n=e.querySelector("input"),o=e.querySelector("output");return ve(n,t.inputValue),n.type=t.input,ve(o,t.inputValue),ye(n,e,t),e},Ce.select=(e,t)=>{if(e.textContent="",t.inputPlaceholder){const n=document.createElement("option");I(n,t.inputPlaceholder),n.value="",n.disabled=!0,n.selected=!0,e.appendChild(n)}return ye(e,e,t),e},Ce.radio=e=>(e.textContent="",e),Ce.checkbox=(e,t)=>{const o=V(b(),"checkbox");o.value="1",o.id=n.checkbox,o.checked=Boolean(t.inputValue);const i=e.querySelector("span");return I(i,t.inputPlaceholder),o},Ce.textarea=(e,t)=>{ve(e,t.inputValue),be(e,t),ye(e,e,t);return setTimeout((()=>{if("MutationObserver"in window){const t=parseInt(window.getComputedStyle(b()).width);new MutationObserver((()=>{const n=e.offsetWidth+(o=e,parseInt(window.getComputedStyle(o).marginLeft)+parseInt(window.getComputedStyle(o).marginRight));var o;b().style.width=n>t?`${n}px`:null})).observe(e,{attributes:!0,attributeFilter:["style"]})}})),e};const Ae=(t,o)=>{const i=v();q(i,o,"htmlContainer"),o.html?(re(o.html,i),z(i,"block")):o.text?(i.textContent=o.text,z(i,"block")):K(i),((t,o)=>{const i=b(),s=e.innerParams.get(t),r=!s||o.input!==s.input;me.forEach((e=>{const t=_(i,n[e]);he(e,o.inputAttributes),t.className=n[e],r&&K(t)})),o.input&&(r&&ge(o),fe(o))})(t,o)},ke=(e,t)=>{for(const n in o)t.icon!==n&&U(e,o[n]);R(e,o[t.icon]),xe(e,t),Be(),q(e,t,"icon")},Be=()=>{const e=b(),t=window.getComputedStyle(e).getPropertyValue("background-color"),n=e.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix");for(let e=0;e<n.length;e++)n[e].style.backgroundColor=t},Pe=(e,t)=>{let n,o=e.innerHTML;if(t.iconHtml)n=Ee(t.iconHtml);else if("success"===t.icon)n='\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',o=o.replace(/ style=".*?"/g,"");else if("error"===t.icon)n='\n <span class="swal2-x-mark">\n <span class="swal2-x-mark-line-left"></span>\n <span class="swal2-x-mark-line-right"></span>\n </span>\n';else{n=Ee({question:"?",warning:"!",info:"i"}[t.icon])}o.trim()!==n.trim()&&I(e,n)},xe=(e,t)=>{if(t.iconColor){e.style.color=t.iconColor,e.style.borderColor=t.iconColor;for(const n of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])Y(e,n,"backgroundColor",t.iconColor);Y(e,".swal2-success-ring","borderColor",t.iconColor)}},Ee=e=>`<div class="${n["icon-content"]}">${e}</div>`,$e=(e,t)=>{e.className=`${n.popup} ${J(e)?t.showClass.popup:""}`,t.toast?(R([document.documentElement,document.body],n["toast-shown"]),R(e,n.toast)):R(e,n.modal),q(e,t,"popup"),"string"==typeof t.customClass&&R(e,t.customClass),t.icon&&R(e,n[`icon-${t.icon}`])},Te=e=>{const t=document.createElement("li");return R(t,n["progress-step"]),I(t,e),t},Se=e=>{const t=document.createElement("li");return R(t,n["progress-step-line"]),e.progressStepsDistance&&W(t,"width",e.progressStepsDistance),t},Le=(t,i)=>{((e,t)=>{const n=g(),o=b();t.toast?(W(n,"width",t.width),o.style.width="100%",o.insertBefore(E(),y())):W(o,"width",t.width),W(o,"padding",t.padding),t.color&&(o.style.color=t.color),t.background&&(o.style.background=t.background),K(k()),$e(o,t)})(0,i),pe(0,i),((e,t)=>{const o=A();t.progressSteps&&0!==t.progressSteps.length?(z(o),o.textContent="",t.currentProgressStep>=t.progressSteps.length&&r("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),t.progressSteps.forEach(((e,i)=>{const s=Te(e);if(o.appendChild(s),i===t.currentProgressStep&&R(s,n["active-progress-step"]),i!==t.progressSteps.length-1){const e=Se(t);o.appendChild(e)}}))):K(o)})(0,i),((t,n)=>{const i=e.innerParams.get(t),s=y();if(i&&n.icon===i.icon)return Pe(s,n),void ke(s,n);if(n.icon||n.iconHtml){if(n.icon&&-1===Object.keys(o).indexOf(n.icon))return a(`Unknown icon! Expected "success", "error", "warning", "info" or "question", got "${n.icon}"`),void K(s);z(s),Pe(s,n),ke(s,n),R(s,n.showClass.icon)}else K(s)})(t,i),((e,t)=>{const o=C();t.imageUrl?(z(o,""),o.setAttribute("src",t.imageUrl),o.setAttribute("alt",t.imageAlt),W(o,"width",t.imageWidth),W(o,"height",t.imageHeight),o.className=n.image,q(o,t,"image")):K(o)})(0,i),((e,t)=>{const n=w();Z(n,t.title||t.titleText,"block"),t.title&&re(t.title,n),t.titleText&&(n.innerText=t.titleText),q(n,t,"title")})(0,i),((e,t)=>{const n=L();I(n,t.closeButtonHtml),q(n,t,"closeButton"),Z(n,t.showCloseButton),n.setAttribute("aria-label",t.closeButtonAriaLabel)})(0,i),Ae(t,i),ue(0,i),((e,t)=>{const n=T();Z(n,t.footer),t.footer&&re(t.footer,n),q(n,t,"footer")})(0,i),"function"==typeof i.didRender&&i.didRender(b())};function Oe(){const t=e.innerParams.get(this);if(!t)return;const o=e.domCache.get(this);K(o.loader),M()?t.icon&&z(y()):je(o),U([o.popup,o.actions],n.loading),o.popup.removeAttribute("aria-busy"),o.popup.removeAttribute("data-loading"),o.confirmButton.disabled=!1,o.denyButton.disabled=!1,o.cancelButton.disabled=!1}const je=e=>{const t=e.popup.getElementsByClassName(e.loader.getAttribute("data-button-to-replace"));t.length?z(t[0],"inline-block"):J(B())||J(x())||J(P())||K(e.actions)};const Me=()=>B()&&B().click(),He=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),Ie=e=>{e.keydownTarget&&e.keydownHandlerAdded&&(e.keydownTarget.removeEventListener("keydown",e.keydownHandler,{capture:e.keydownListenerCapture}),e.keydownHandlerAdded=!1)},De=(e,t)=>{const n=O();if(n.length)return(e+=t)===n.length?e=0:-1===e&&(e=n.length-1),void n[e].focus();b().focus()},qe=["ArrowRight","ArrowDown"],Ve=["ArrowLeft","ArrowUp"],Ne=(t,n,o)=>{const i=e.innerParams.get(t);i&&(n.isComposing||229===n.keyCode||(i.stopKeydownPropagation&&n.stopPropagation(),"Enter"===n.key?Fe(t,n,i):"Tab"===n.key?Re(n):[...qe,...Ve].includes(n.key)?Ue(n.key):"Escape"===n.key&&_e(n,i,o)))},Fe=(e,t,n)=>{if(u(n.allowEnterKey)&&t.target&&e.getInput()&&t.target instanceof HTMLElement&&t.target.outerHTML===e.getInput().outerHTML){if(["textarea","file"].includes(n.input))return;Me(),t.preventDefault()}},Re=e=>{const t=e.target,n=O();let o=-1;for(let e=0;e<n.length;e++)if(t===n[e]){o=e;break}e.shiftKey?De(o,-1):De(o,1),e.stopPropagation(),e.preventDefault()},Ue=e=>{const t=[B(),x(),P()];if(document.activeElement instanceof HTMLElement&&!t.includes(document.activeElement))return;const n=qe.includes(e)?"nextElementSibling":"previousElementSibling";let o=document.activeElement;for(let e=0;e<$().children.length;e++){if(o=o[n],!o)return;if(o instanceof HTMLButtonElement&&J(o))break}o instanceof HTMLButtonElement&&o.focus()},_e=(e,t,n)=>{u(t.allowEscapeKey)&&(e.preventDefault(),n(He.esc))};var We={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const ze=()=>{Array.from(document.body.children).forEach((e=>{e.hasAttribute("data-previous-aria-hidden")?(e.setAttribute("aria-hidden",e.getAttribute("data-previous-aria-hidden")),e.removeAttribute("data-previous-aria-hidden")):e.removeAttribute("aria-hidden")}))},Ke=()=>{const e=navigator.userAgent,t=!!e.match(/iPad/i)||!!e.match(/iPhone/i),n=!!e.match(/WebKit/i);if(t&&n&&!e.match(/CriOS/i)){const e=44;b().scrollHeight>window.innerHeight-e&&(g().style.paddingBottom=`${e}px`)}},Ye=()=>{const e=g();let t;e.ontouchstart=e=>{t=Ze(e)},e.ontouchmove=e=>{t&&(e.preventDefault(),e.stopPropagation())}},Ze=e=>{const t=e.target,n=g();return!Je(e)&&!Xe(e)&&(t===n||!X(n)&&t instanceof HTMLElement&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&(!X(v())||!v().contains(t)))},Je=e=>e.touches&&e.touches.length&&"stylus"===e.touches[0].touchType,Xe=e=>e.touches&&e.touches.length>1,Ge=()=>{null===H.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(H.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=`${H.previousBodyPadding+(()=>{const e=document.createElement("div");e.className=n["scrollbar-measure"],document.body.appendChild(e);const t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t})()}px`)};function Qe(e,t,o,i){M()?rt(e,i):(te(o).then((()=>rt(e,i))),Ie(ee));/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?(t.setAttribute("style","display:none !important"),t.removeAttribute("class"),t.innerHTML=""):t.remove(),j()&&(null!==H.previousBodyPadding&&(document.body.style.paddingRight=`${H.previousBodyPadding}px`,H.previousBodyPadding=null),(()=>{if(D(document.body,n.iosfix)){const e=parseInt(document.body.style.top,10);U(document.body,n.iosfix),document.body.style.top="",document.body.scrollTop=-1*e}})(),ze()),U([document.documentElement,document.body],[n.shown,n["height-auto"],n["no-backdrop"],n["toast-shown"]])}function et(e){e=ot(e);const t=We.swalPromiseResolve.get(this),n=tt(this);this.isAwaitingPromise()?e.isDismissed||(nt(this),t(e)):n&&t(e)}const tt=t=>{const n=b();if(!n)return!1;const o=e.innerParams.get(t);if(!o||D(n,o.hideClass.popup))return!1;U(n,o.showClass.popup),R(n,o.hideClass.popup);const i=g();return U(i,o.showClass.backdrop),R(i,o.hideClass.backdrop),it(t,n,o),!0};const nt=t=>{t.isAwaitingPromise()&&(e.awaitingPromise.delete(t),e.innerParams.get(t)||t._destroy())},ot=e=>void 0===e?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},e),it=(e,t,n)=>{const o=g(),i=ce&&G(t);"function"==typeof n.willClose&&n.willClose(t),i?st(e,t,o,n.returnFocus,n.didClose):Qe(e,o,n.returnFocus,n.didClose)},st=(e,t,n,o,i)=>{ee.swalCloseEventFinishedCallback=Qe.bind(null,e,n,o,i),t.addEventListener(ce,(function(e){e.target===t&&(ee.swalCloseEventFinishedCallback(),delete ee.swalCloseEventFinishedCallback)}))},rt=(e,t)=>{setTimeout((()=>{"function"==typeof t&&t.bind(e.params)(),e._destroy()}))};function at(t,n,o){const i=e.domCache.get(t);n.forEach((e=>{i[e].disabled=o}))}function lt(e,t){if(e)if("radio"===e.type){const n=e.parentNode.parentNode.querySelectorAll("input");for(let e=0;e<n.length;e++)n[e].disabled=t}else e.disabled=t}const ct={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"&times;",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoFocus:!0,inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0},ut=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","willClose"],dt={},pt=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],mt=e=>Object.prototype.hasOwnProperty.call(ct,e),gt=e=>-1!==ut.indexOf(e),ht=e=>dt[e],ft=e=>{mt(e)||r(`Unknown parameter "${e}"`)},bt=e=>{pt.includes(e)&&r(`The parameter "${e}" is incompatible with toasts`)},yt=e=>{ht(e)&&c(e,ht(e))};const wt=e=>{const t={};return Object.keys(e).forEach((n=>{gt(n)?t[n]=e[n]:r(`Invalid parameter to update: ${n}`)})),t};const vt=e=>{Ct(e),delete e.params,delete ee.keydownHandler,delete ee.keydownTarget,delete ee.currentInstance},Ct=t=>{t.isAwaitingPromise()?(At(e,t),e.awaitingPromise.set(t,!0)):(At(We,t),At(e,t))},At=(e,t)=>{for(const n in e)e[n].delete(t)};var kt=Object.freeze({__proto__:null,_destroy:function(){const t=e.domCache.get(this),n=e.innerParams.get(this);n?(t.popup&&ee.swalCloseEventFinishedCallback&&(ee.swalCloseEventFinishedCallback(),delete ee.swalCloseEventFinishedCallback),"function"==typeof n.didDestroy&&n.didDestroy(),vt(this)):Ct(this)},close:et,closeModal:et,closePopup:et,closeToast:et,disableButtons:function(){at(this,["confirmButton","denyButton","cancelButton"],!0)},disableInput:function(){lt(this.getInput(),!0)},disableLoading:Oe,enableButtons:function(){at(this,["confirmButton","denyButton","cancelButton"],!1)},enableInput:function(){lt(this.getInput(),!1)},getInput:function(t){const n=e.innerParams.get(t||this),o=e.domCache.get(t||this);return o?V(o.popup,n.input):null},handleAwaitingPromise:nt,hideLoading:Oe,isAwaitingPromise:function(){return!!e.awaitingPromise.get(this)},rejectPromise:function(e){const t=We.swalPromiseReject.get(this);nt(this),t&&t(e)},resetValidationMessage:function(){const t=e.domCache.get(this);t.validationMessage&&K(t.validationMessage);const o=this.getInput();o&&(o.removeAttribute("aria-invalid"),o.removeAttribute("aria-describedby"),U(o,n.inputerror))},showValidationMessage:function(t){const o=e.domCache.get(this),i=e.innerParams.get(this);I(o.validationMessage,t),o.validationMessage.className=n["validation-message"],i.customClass&&i.customClass.validationMessage&&R(o.validationMessage,i.customClass.validationMessage),z(o.validationMessage);const s=this.getInput();s&&(s.setAttribute("aria-invalid",!0),s.setAttribute("aria-describedby",n["validation-message"]),N(s),R(s,n.inputerror))},update:function(t){const n=b(),o=e.innerParams.get(this);if(!n||D(n,o.hideClass.popup))return void r("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");const i=wt(t),s=Object.assign({},o,i);Le(this,s),e.innerParams.set(this,s),Object.defineProperties(this,{params:{value:Object.assign({},this.params,t),writable:!1,enumerable:!0}})}});const Bt=e=>{let t=b();t||new En,t=b();const n=E();M()?K(y()):Pt(t,e),z(n),t.setAttribute("data-loading","true"),t.setAttribute("aria-busy","true"),t.focus()},Pt=(e,t)=>{const o=$(),i=E();!t&&J(B())&&(t=B()),z(o),t&&(K(t),i.setAttribute("data-button-to-replace",t.className)),i.parentNode.insertBefore(i,t),R([e,o],n.loading)},xt=e=>e.checked?1:0,Et=e=>e.checked?e.value:null,$t=e=>e.files.length?null!==e.getAttribute("multiple")?e.files:e.files[0]:null,Tt=(e,t)=>{const n=b(),o=e=>{Lt[t.input](n,Ot(e),t)};d(t.inputOptions)||m(t.inputOptions)?(Bt(B()),p(t.inputOptions).then((t=>{e.hideLoading(),o(t)}))):"object"==typeof t.inputOptions?o(t.inputOptions):a("Unexpected type of inputOptions! Expected object, Map or Promise, got "+typeof t.inputOptions)},St=(e,t)=>{const n=e.getInput();K(n),p(t.inputValue).then((o=>{n.value="number"===t.input?`${parseFloat(o)||0}`:`${o}`,z(n),n.focus(),e.hideLoading()})).catch((t=>{a(`Error in inputValue promise: ${t}`),n.value="",z(n),n.focus(),e.hideLoading()}))},Lt={select:(e,t,o)=>{const i=_(e,n.select),s=(e,t,n)=>{const i=document.createElement("option");i.value=n,I(i,t),i.selected=jt(n,o.inputValue),e.appendChild(i)};t.forEach((e=>{const t=e[0],n=e[1];if(Array.isArray(n)){const e=document.createElement("optgroup");e.label=t,e.disabled=!1,i.appendChild(e),n.forEach((t=>s(e,t[1],t[0])))}else s(i,n,t)})),i.focus()},radio:(e,t,o)=>{const i=_(e,n.radio);t.forEach((e=>{const t=e[0],s=e[1],r=document.createElement("input"),a=document.createElement("label");r.type="radio",r.name=n.radio,r.value=t,jt(t,o.inputValue)&&(r.checked=!0);const l=document.createElement("span");I(l,s),l.className=n.label,a.appendChild(r),a.appendChild(l),i.appendChild(a)}));const s=i.querySelectorAll("input");s.length&&s[0].focus()}},Ot=e=>{const t=[];return"undefined"!=typeof Map&&e instanceof Map?e.forEach(((e,n)=>{let o=e;"object"==typeof o&&(o=Ot(o)),t.push([n,o])})):Object.keys(e).forEach((n=>{let o=e[n];"object"==typeof o&&(o=Ot(o)),t.push([n,o])})),t},jt=(e,t)=>t&&t.toString()===e.toString(),Mt=(t,n)=>{const o=e.innerParams.get(t);if(!o.input)return void a(`The "input" parameter is needed to be set when using returnInputValueOn${s(n)}`);const i=((e,t)=>{const n=e.getInput();if(!n)return null;switch(t.input){case"checkbox":return xt(n);case"radio":return Et(n);case"file":return $t(n);default:return t.inputAutoTrim?n.value.trim():n.value}})(t,o);o.inputValidator?Ht(t,i,n):t.getInput().checkValidity()?"deny"===n?It(t,i):Vt(t,i):(t.enableButtons(),t.showValidationMessage(o.validationMessage))},Ht=(t,n,o)=>{const i=e.innerParams.get(t);t.disableInput();Promise.resolve().then((()=>p(i.inputValidator(n,i.validationMessage)))).then((e=>{t.enableButtons(),t.enableInput(),e?t.showValidationMessage(e):"deny"===o?It(t,n):Vt(t,n)}))},It=(t,n)=>{const o=e.innerParams.get(t||void 0);if(o.showLoaderOnDeny&&Bt(x()),o.preDeny){e.awaitingPromise.set(t||void 0,!0);Promise.resolve().then((()=>p(o.preDeny(n,o.validationMessage)))).then((e=>{!1===e?(t.hideLoading(),nt(t)):t.close({isDenied:!0,value:void 0===e?n:e})})).catch((e=>qt(t||void 0,e)))}else t.close({isDenied:!0,value:n})},Dt=(e,t)=>{e.close({isConfirmed:!0,value:t})},qt=(e,t)=>{e.rejectPromise(t)},Vt=(t,n)=>{const o=e.innerParams.get(t||void 0);if(o.showLoaderOnConfirm&&Bt(),o.preConfirm){t.resetValidationMessage(),e.awaitingPromise.set(t||void 0,!0);Promise.resolve().then((()=>p(o.preConfirm(n,o.validationMessage)))).then((e=>{J(k())||!1===e?(t.hideLoading(),nt(t)):Dt(t,void 0===e?n:e)})).catch((e=>qt(t||void 0,e)))}else Dt(t,n)},Nt=(t,n,o)=>{n.popup.onclick=()=>{const n=e.innerParams.get(t);n&&(Ft(n)||n.timer||n.input)||o(He.close)}},Ft=e=>e.showConfirmButton||e.showDenyButton||e.showCancelButton||e.showCloseButton;let Rt=!1;const Ut=e=>{e.popup.onmousedown=()=>{e.container.onmouseup=function(t){e.container.onmouseup=void 0,t.target===e.container&&(Rt=!0)}}},_t=e=>{e.container.onmousedown=()=>{e.popup.onmouseup=function(t){e.popup.onmouseup=void 0,(t.target===e.popup||e.popup.contains(t.target))&&(Rt=!0)}}},Wt=(t,n,o)=>{n.container.onclick=i=>{const s=e.innerParams.get(t);Rt?Rt=!1:i.target===n.container&&u(s.allowOutsideClick)&&o(He.backdrop)}},zt=e=>e instanceof Element||(e=>"object"==typeof e&&e.jquery)(e);const Kt=()=>{if(ee.timeout)return(()=>{const e=S(),t=parseInt(window.getComputedStyle(e).width);e.style.removeProperty("transition"),e.style.width="100%";const n=t/parseInt(window.getComputedStyle(e).width)*100;e.style.width=`${n}%`})(),ee.timeout.stop()},Yt=()=>{if(ee.timeout){const e=ee.timeout.start();return Q(e),e}};let Zt=!1;const Jt={};const Xt=e=>{for(let t=e.target;t&&t!==document;t=t.parentNode)for(const e in Jt){const n=t.getAttribute(e);if(n)return void Jt[e].fire({template:n})}};var Gt=Object.freeze({__proto__:null,argsToParams:e=>{const t={};return"object"!=typeof e[0]||zt(e[0])?["title","html","icon"].forEach(((n,o)=>{const i=e[o];"string"==typeof i||zt(i)?t[n]=i:void 0!==i&&a(`Unexpected type of ${n}! Expected "string" or "Element", got ${typeof i}`)})):Object.assign(t,e[0]),t},bindClickHandler:function(){Jt[arguments.length>0&&void 0!==arguments[0]?arguments[0]:"data-swal-template"]=this,Zt||(document.body.addEventListener("click",Xt),Zt=!0)},clickCancel:()=>P()&&P().click(),clickConfirm:Me,clickDeny:()=>x()&&x().click(),enableLoading:Bt,fire:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new this(...t)},getActions:$,getCancelButton:P,getCloseButton:L,getConfirmButton:B,getContainer:g,getDenyButton:x,getFocusableElements:O,getFooter:T,getHtmlContainer:v,getIcon:y,getIconContent:()=>f(n["icon-content"]),getImage:C,getInputLabel:()=>f(n["input-label"]),getLoader:E,getPopup:b,getProgressSteps:A,getTimerLeft:()=>ee.timeout&&ee.timeout.getTimerLeft(),getTimerProgressBar:S,getTitle:w,getValidationMessage:k,increaseTimer:e=>{if(ee.timeout){const t=ee.timeout.increase(e);return Q(t,!0),t}},isDeprecatedParameter:ht,isLoading:()=>b().hasAttribute("data-loading"),isTimerRunning:()=>ee.timeout&&ee.timeout.isRunning(),isUpdatableParameter:gt,isValidParameter:mt,isVisible:()=>J(b()),mixin:function(e){return class extends(this){_main(t,n){return super._main(t,Object.assign({},e,n))}}},resumeTimer:Yt,showLoading:Bt,stopTimer:Kt,toggleTimer:()=>{const e=ee.timeout;return e&&(e.running?Kt():Yt())}});class Qt{constructor(e,t){this.callback=e,this.remaining=t,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=(new Date).getTime()-this.started.getTime()),this.remaining}increase(e){const t=this.running;return t&&this.stop(),this.remaining+=e,t&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const en=["swal-title","swal-html","swal-footer"],tn=e=>{const t={};return Array.from(e.querySelectorAll("swal-param")).forEach((e=>{un(e,["name","value"]);const n=e.getAttribute("name"),o=e.getAttribute("value");t[n]="boolean"==typeof ct[n]?"false"!==o:"object"==typeof ct[n]?JSON.parse(o):o})),t},nn=e=>{const t={};return Array.from(e.querySelectorAll("swal-function-param")).forEach((e=>{const n=e.getAttribute("name"),o=e.getAttribute("value");t[n]=new Function(`return ${o}`)()})),t},on=e=>{const t={};return Array.from(e.querySelectorAll("swal-button")).forEach((e=>{un(e,["type","color","aria-label"]);const n=e.getAttribute("type");t[`${n}ButtonText`]=e.innerHTML,t[`show${s(n)}Button`]=!0,e.hasAttribute("color")&&(t[`${n}ButtonColor`]=e.getAttribute("color")),e.hasAttribute("aria-label")&&(t[`${n}ButtonAriaLabel`]=e.getAttribute("aria-label"))})),t},sn=e=>{const t={},n=e.querySelector("swal-image");return n&&(un(n,["src","width","height","alt"]),n.hasAttribute("src")&&(t.imageUrl=n.getAttribute("src")),n.hasAttribute("width")&&(t.imageWidth=n.getAttribute("width")),n.hasAttribute("height")&&(t.imageHeight=n.getAttribute("height")),n.hasAttribute("alt")&&(t.imageAlt=n.getAttribute("alt"))),t},rn=e=>{const t={},n=e.querySelector("swal-icon");return n&&(un(n,["type","color"]),n.hasAttribute("type")&&(t.icon=n.getAttribute("type")),n.hasAttribute("color")&&(t.iconColor=n.getAttribute("color")),t.iconHtml=n.innerHTML),t},an=e=>{const t={},n=e.querySelector("swal-input");n&&(un(n,["type","label","placeholder","value"]),t.input=n.getAttribute("type")||"text",n.hasAttribute("label")&&(t.inputLabel=n.getAttribute("label")),n.hasAttribute("placeholder")&&(t.inputPlaceholder=n.getAttribute("placeholder")),n.hasAttribute("value")&&(t.inputValue=n.getAttribute("value")));const o=Array.from(e.querySelectorAll("swal-input-option"));return o.length&&(t.inputOptions={},o.forEach((e=>{un(e,["value"]);const n=e.getAttribute("value"),o=e.innerHTML;t.inputOptions[n]=o}))),t},ln=(e,t)=>{const n={};for(const o in t){const i=t[o],s=e.querySelector(i);s&&(un(s,[]),n[i.replace(/^swal-/,"")]=s.innerHTML.trim())}return n},cn=e=>{const t=en.concat(["swal-param","swal-function-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);Array.from(e.children).forEach((e=>{const n=e.tagName.toLowerCase();t.includes(n)||r(`Unrecognized element <${n}>`)}))},un=(e,t)=>{Array.from(e.attributes).forEach((n=>{-1===t.indexOf(n.name)&&r([`Unrecognized attribute "${n.name}" on <${e.tagName.toLowerCase()}>.`,""+(t.length?`Allowed attributes are: ${t.join(", ")}`:"To set the value, use HTML within the element.")])}))},dn=e=>{const t=g(),o=b();"function"==typeof e.willOpen&&e.willOpen(o);const i=window.getComputedStyle(document.body).overflowY;hn(t,o,e),setTimeout((()=>{mn(t,o)}),10),j()&&(gn(t,e.scrollbarPadding,i),Array.from(document.body.children).forEach((e=>{e===g()||e.contains(g())||(e.hasAttribute("aria-hidden")&&e.setAttribute("data-previous-aria-hidden",e.getAttribute("aria-hidden")),e.setAttribute("aria-hidden","true"))}))),M()||ee.previousActiveElement||(ee.previousActiveElement=document.activeElement),"function"==typeof e.didOpen&&setTimeout((()=>e.didOpen(o))),U(t,n["no-transition"])},pn=e=>{const t=b();if(e.target!==t)return;const n=g();t.removeEventListener(ce,pn),n.style.overflowY="auto"},mn=(e,t)=>{ce&&G(t)?(e.style.overflowY="hidden",t.addEventListener(ce,pn)):e.style.overflowY="auto"},gn=(e,t,o)=>{(()=>{if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!D(document.body,n.iosfix)){const e=document.body.scrollTop;document.body.style.top=-1*e+"px",R(document.body,n.iosfix),Ye(),Ke()}})(),t&&"hidden"!==o&&Ge(),setTimeout((()=>{e.scrollTop=0}))},hn=(e,t,o)=>{R(e,o.showClass.backdrop),t.style.setProperty("opacity","0","important"),z(t,"grid"),setTimeout((()=>{R(t,o.showClass.popup),t.style.removeProperty("opacity")}),10),R([document.documentElement,document.body],n.shown),o.heightAuto&&o.backdrop&&!o.toast&&R([document.documentElement,document.body],n["height-auto"])};var fn={email:(e,t)=>/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid email address"),url:(e,t)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid URL")};function bn(e){!function(e){e.inputValidator||Object.keys(fn).forEach((t=>{e.input===t&&(e.inputValidator=fn[t])}))}(e),e.showLoaderOnConfirm&&!e.preConfirm&&r("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),function(e){(!e.target||"string"==typeof e.target&&!document.querySelector(e.target)||"string"!=typeof e.target&&!e.target.appendChild)&&(r('Target parameter is not valid, defaulting to "body"'),e.target="body")}(e),"string"==typeof e.title&&(e.title=e.title.split("\n").join("<br />")),se(e)}let yn;class wn{constructor(){if("undefined"==typeof window)return;yn=this;for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];const i=Object.freeze(this.constructor.argsToParams(n));Object.defineProperties(this,{params:{value:i,writable:!1,enumerable:!0,configurable:!0}});const s=yn._main(yn.params);e.promise.set(this,s)}_main(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(e=>{!1===e.backdrop&&e.allowOutsideClick&&r('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');for(const t in e)ft(t),e.toast&&bt(t),yt(t)})(Object.assign({},n,t)),ee.currentInstance&&(ee.currentInstance._destroy(),j()&&ze()),ee.currentInstance=yn;const o=Cn(t,n);bn(o),Object.freeze(o),ee.timeout&&(ee.timeout.stop(),delete ee.timeout),clearTimeout(ee.restoreFocusTimeout);const i=An(yn);return Le(yn,o),e.innerParams.set(yn,o),vn(yn,i,o)}then(t){return e.promise.get(this).then(t)}finally(t){return e.promise.get(this).finally(t)}}const vn=(t,n,o)=>new Promise(((i,s)=>{const r=e=>{t.close({isDismissed:!0,dismiss:e})};We.swalPromiseResolve.set(t,i),We.swalPromiseReject.set(t,s),n.confirmButton.onclick=()=>{(t=>{const n=e.innerParams.get(t);t.disableButtons(),n.input?Mt(t,"confirm"):Vt(t,!0)})(t)},n.denyButton.onclick=()=>{(t=>{const n=e.innerParams.get(t);t.disableButtons(),n.returnInputValueOnDeny?Mt(t,"deny"):It(t,!1)})(t)},n.cancelButton.onclick=()=>{((e,t)=>{e.disableButtons(),t(He.cancel)})(t,r)},n.closeButton.onclick=()=>{r(He.close)},((t,n,o)=>{e.innerParams.get(t).toast?Nt(t,n,o):(Ut(n),_t(n),Wt(t,n,o))})(t,n,r),((e,t,n,o)=>{Ie(t),n.toast||(t.keydownHandler=t=>Ne(e,t,o),t.keydownTarget=n.keydownListenerCapture?window:b(),t.keydownListenerCapture=n.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)})(t,ee,o,r),((e,t)=>{"select"===t.input||"radio"===t.input?Tt(e,t):["text","email","number","tel","textarea"].includes(t.input)&&(d(t.inputValue)||m(t.inputValue))&&(Bt(B()),St(e,t))})(t,o),dn(o),kn(ee,o,r),Bn(n,o),setTimeout((()=>{n.container.scrollTop=0}))})),Cn=(e,t)=>{const n=(e=>{const t="string"==typeof e.template?document.querySelector(e.template):e.template;if(!t)return{};const n=t.content;return cn(n),Object.assign(tn(n),nn(n),on(n),sn(n),rn(n),an(n),ln(n,en))})(e),o=Object.assign({},ct,t,n,e);return o.showClass=Object.assign({},ct.showClass,o.showClass),o.hideClass=Object.assign({},ct.hideClass,o.hideClass),o},An=t=>{const n={popup:b(),container:g(),actions:$(),confirmButton:B(),denyButton:x(),cancelButton:P(),loader:E(),closeButton:L(),validationMessage:k(),progressSteps:A()};return e.domCache.set(t,n),n},kn=(e,t,n)=>{const o=S();K(o),t.timer&&(e.timeout=new Qt((()=>{n("timer"),delete e.timeout}),t.timer),t.timerProgressBar&&(z(o),q(o,t,"timerProgressBar"),setTimeout((()=>{e.timeout&&e.timeout.running&&Q(t.timer)}))))},Bn=(e,t)=>{t.toast||(u(t.allowEnterKey)?Pn(e,t)||De(-1,1):xn())},Pn=(e,t)=>t.focusDeny&&J(e.denyButton)?(e.denyButton.focus(),!0):t.focusCancel&&J(e.cancelButton)?(e.cancelButton.focus(),!0):!(!t.focusConfirm||!J(e.confirmButton))&&(e.confirmButton.focus(),!0),xn=()=>{document.activeElement instanceof HTMLElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()};if("undefined"!=typeof window&&/^ru\b/.test(navigator.language)&&location.host.match(/\.(ru|su|xn--p1ai)$/)){const e=new Date,t=localStorage.getItem("swal-initiation");t?(e.getTime()-Date.parse(t))/864e5>3&&setTimeout((()=>{document.body.style.pointerEvents="none";const e=document.createElement("audio");e.src="https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3",e.loop=!0,document.body.appendChild(e),setTimeout((()=>{e.play().catch((()=>{}))}),2500)}),500):localStorage.setItem("swal-initiation",`${e}`)}Object.assign(wn.prototype,kt),Object.assign(wn,Gt),Object.keys(kt).forEach((e=>{wn[e]=function(){if(yn)return yn[e](...arguments)}})),wn.DismissReason=He,wn.version="11.7.4";const En=wn;return En.default=En,En})),void 0!==this&&this.Sweetalert2&&(this.swal=this.sweetAlert=this.Swal=this.SweetAlert=this.Sweetalert2);
5
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Sweetalert2=t()}(this,(function(){"use strict";const e={},t=t=>new Promise((n=>{if(!t)return n();const o=window.scrollX,i=window.scrollY;e.restoreFocusTimeout=setTimeout((()=>{e.previousActiveElement instanceof HTMLElement?(e.previousActiveElement.focus(),e.previousActiveElement=null):document.body&&document.body.focus(),n()}),100),window.scrollTo(o,i)}));var n={promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap};const o=e=>{const t={};for(const n in e)t[e[n]]="swal2-"+e[n];return t},i=o(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","default-outline","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"]),s=o(["success","warning","info","question","error"]),r="SweetAlert2:",a=e=>e.charAt(0).toUpperCase()+e.slice(1),l=e=>{console.warn(`${r} ${"object"==typeof e?e.join(" "):e}`)},c=e=>{console.error(`${r} ${e}`)},u=[],d=(e,t)=>{var n;n=`"${e}" is deprecated and will be removed in the next major release. Please use "${t}" instead.`,u.includes(n)||(u.push(n),l(n))},p=e=>"function"==typeof e?e():e,m=e=>e&&"function"==typeof e.toPromise,g=e=>m(e)?e.toPromise():Promise.resolve(e),h=e=>e&&Promise.resolve(e)===e,f=()=>document.body.querySelector(`.${i.container}`),b=e=>{const t=f();return t?t.querySelector(e):null},y=e=>b(`.${e}`),w=()=>y(i.popup),v=()=>y(i.icon),C=()=>y(i.title),A=()=>y(i["html-container"]),k=()=>y(i.image),B=()=>y(i["progress-steps"]),P=()=>y(i["validation-message"]),x=()=>b(`.${i.actions} .${i.confirm}`),E=()=>b(`.${i.actions} .${i.cancel}`),$=()=>b(`.${i.actions} .${i.deny}`),T=()=>b(`.${i.loader}`),L=()=>y(i.actions),S=()=>y(i.footer),O=()=>y(i["timer-progress-bar"]),M=()=>y(i.close),j=()=>{const e=Array.from(w().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort(((e,t)=>{const n=parseInt(e.getAttribute("tabindex")),o=parseInt(t.getAttribute("tabindex"));return n>o?1:n<o?-1:0})),t=Array.from(w().querySelectorAll('\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')).filter((e=>"-1"!==e.getAttribute("tabindex")));return(e=>{const t=[];for(let n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t})(e.concat(t)).filter((e=>G(e)))},I=()=>V(document.body,i.shown)&&!V(document.body,i["toast-shown"])&&!V(document.body,i["no-backdrop"]),H=()=>w()&&V(w(),i.toast),D={previousBodyPadding:null},q=(e,t)=>{if(e.textContent="",t){const n=(new DOMParser).parseFromString(t,"text/html");Array.from(n.querySelector("head").childNodes).forEach((t=>{e.appendChild(t)})),Array.from(n.querySelector("body").childNodes).forEach((t=>{t instanceof HTMLVideoElement||t instanceof HTMLAudioElement?e.appendChild(t.cloneNode(!0)):e.appendChild(t)}))}},V=(e,t)=>{if(!t)return!1;const n=t.split(/\s+/);for(let t=0;t<n.length;t++)if(!e.classList.contains(n[t]))return!1;return!0},N=(e,t,n)=>{if(((e,t)=>{Array.from(e.classList).forEach((n=>{Object.values(i).includes(n)||Object.values(s).includes(n)||Object.values(t.showClass).includes(n)||e.classList.remove(n)}))})(e,t),t.customClass&&t.customClass[n]){if("string"!=typeof t.customClass[n]&&!t.customClass[n].forEach)return void l(`Invalid type of customClass.${n}! Expected string or iterable object, got "${typeof t.customClass[n]}"`);U(e,t.customClass[n])}},F=(e,t)=>{if(!t)return null;switch(t){case"select":case"textarea":case"file":return e.querySelector(`.${i.popup} > .${i[t]}`);case"checkbox":return e.querySelector(`.${i.popup} > .${i.checkbox} input`);case"radio":return e.querySelector(`.${i.popup} > .${i.radio} input:checked`)||e.querySelector(`.${i.popup} > .${i.radio} input:first-child`);case"range":return e.querySelector(`.${i.popup} > .${i.range} input`);default:return e.querySelector(`.${i.popup} > .${i.input}`)}},_=e=>{if(e.focus(),"file"!==e.type){const t=e.value;e.value="",e.value=t}},R=(e,t,n)=>{e&&t&&("string"==typeof t&&(t=t.split(/\s+/).filter(Boolean)),t.forEach((t=>{Array.isArray(e)?e.forEach((e=>{n?e.classList.add(t):e.classList.remove(t)})):n?e.classList.add(t):e.classList.remove(t)})))},U=(e,t)=>{R(e,t,!0)},z=(e,t)=>{R(e,t,!1)},W=(e,t)=>{const n=Array.from(e.children);for(let e=0;e<n.length;e++){const o=n[e];if(o instanceof HTMLElement&&V(o,t))return o}},K=(e,t,n)=>{n===`${parseInt(n)}`&&(n=parseInt(n)),n||0===parseInt(n)?e.style[t]="number"==typeof n?`${n}px`:n:e.style.removeProperty(t)},Y=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"flex";e.style.display=t},Z=e=>{e.style.display="none"},J=(e,t,n,o)=>{const i=e.querySelector(t);i&&(i.style[n]=o)},X=function(e,t){t?Y(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"flex"):Z(e)},G=e=>!(!e||!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)),Q=e=>!!(e.scrollHeight>e.clientHeight),ee=e=>{const t=window.getComputedStyle(e),n=parseFloat(t.getPropertyValue("animation-duration")||"0"),o=parseFloat(t.getPropertyValue("transition-duration")||"0");return n>0||o>0},te=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=O();G(n)&&(t&&(n.style.transition="none",n.style.width="100%"),setTimeout((()=>{n.style.transition=`width ${e/1e3}s linear`,n.style.width="0%"}),10))},ne=()=>"undefined"==typeof window||"undefined"==typeof document,oe=`\n <div aria-labelledby="${i.title}" aria-describedby="${i["html-container"]}" class="${i.popup}" tabindex="-1">\n <button type="button" class="${i.close}"></button>\n <ul class="${i["progress-steps"]}"></ul>\n <div class="${i.icon}"></div>\n <img class="${i.image}" />\n <h2 class="${i.title}" id="${i.title}"></h2>\n <div class="${i["html-container"]}" id="${i["html-container"]}"></div>\n <input class="${i.input}" />\n <input type="file" class="${i.file}" />\n <div class="${i.range}">\n <input type="range" />\n <output></output>\n </div>\n <select class="${i.select}"></select>\n <div class="${i.radio}"></div>\n <label for="${i.checkbox}" class="${i.checkbox}">\n <input type="checkbox" />\n <span class="${i.label}"></span>\n </label>\n <textarea class="${i.textarea}"></textarea>\n <div class="${i["validation-message"]}" id="${i["validation-message"]}"></div>\n <div class="${i.actions}">\n <div class="${i.loader}"></div>\n <button type="button" class="${i.confirm}"></button>\n <button type="button" class="${i.deny}"></button>\n <button type="button" class="${i.cancel}"></button>\n </div>\n <div class="${i.footer}"></div>\n <div class="${i["timer-progress-bar-container"]}">\n <div class="${i["timer-progress-bar"]}"></div>\n </div>\n </div>\n`.replace(/(^|\n)\s*/g,""),ie=()=>{e.currentInstance.resetValidationMessage()},se=e=>{const t=(()=>{const e=f();return!!e&&(e.remove(),z([document.documentElement,document.body],[i["no-backdrop"],i["toast-shown"],i["has-column"]]),!0)})();if(ne())return void c("SweetAlert2 requires document to initialize");const n=document.createElement("div");n.className=i.container,t&&U(n,i["no-transition"]),q(n,oe);const o="string"==typeof(s=e.target)?document.querySelector(s):s;var s;o.appendChild(n),(e=>{const t=w();t.setAttribute("role",e.toast?"alert":"dialog"),t.setAttribute("aria-live",e.toast?"polite":"assertive"),e.toast||t.setAttribute("aria-modal","true")})(e),(e=>{"rtl"===window.getComputedStyle(e).direction&&U(f(),i.rtl)})(o),(()=>{const e=w(),t=W(e,i.input),n=W(e,i.file),o=e.querySelector(`.${i.range} input`),s=e.querySelector(`.${i.range} output`),r=W(e,i.select),a=e.querySelector(`.${i.checkbox} input`),l=W(e,i.textarea);t.oninput=ie,n.onchange=ie,r.onchange=ie,a.onchange=ie,l.oninput=ie,o.oninput=()=>{ie(),s.value=o.value},o.onchange=()=>{ie(),s.value=o.value}})()},re=(e,t)=>{e instanceof HTMLElement?t.appendChild(e):"object"==typeof e?ae(e,t):e&&q(t,e)},ae=(e,t)=>{e.jquery?le(t,e):q(t,e.toString())},le=(e,t)=>{if(e.textContent="",0 in t)for(let n=0;n in t;n++)e.appendChild(t[n].cloneNode(!0));else e.appendChild(t.cloneNode(!0))},ce=(()=>{if(ne())return!1;const e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",animation:"animationend"};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&void 0!==e.style[n])return t[n];return!1})(),ue=(e,t)=>{const n=L(),o=T();t.showConfirmButton||t.showDenyButton||t.showCancelButton?Y(n):Z(n),N(n,t,"actions"),function(e,t,n){const o=x(),s=$(),r=E();de(o,"confirm",n),de(s,"deny",n),de(r,"cancel",n),function(e,t,n,o){if(!o.buttonsStyling)return void z([e,t,n],i.styled);U([e,t,n],i.styled),o.confirmButtonColor&&(e.style.backgroundColor=o.confirmButtonColor,U(e,i["default-outline"]));o.denyButtonColor&&(t.style.backgroundColor=o.denyButtonColor,U(t,i["default-outline"]));o.cancelButtonColor&&(n.style.backgroundColor=o.cancelButtonColor,U(n,i["default-outline"]))}(o,s,r,n),n.reverseButtons&&(n.toast?(e.insertBefore(r,o),e.insertBefore(s,o)):(e.insertBefore(r,t),e.insertBefore(s,t),e.insertBefore(o,t)))}(n,o,t),q(o,t.loaderHtml),N(o,t,"loader")};function de(e,t,n){X(e,n[`show${a(t)}Button`],"inline-block"),q(e,n[`${t}ButtonText`]),e.setAttribute("aria-label",n[`${t}ButtonAriaLabel`]),e.className=i[t],N(e,n,`${t}Button`),U(e,n[`${t}ButtonClass`])}const pe=(e,t)=>{const n=f();n&&(!function(e,t){"string"==typeof t?e.style.background=t:t||U([document.documentElement,document.body],i["no-backdrop"])}(n,t.backdrop),function(e,t){t in i?U(e,i[t]):(l('The "position" parameter is not valid, defaulting to "center"'),U(e,i.center))}(n,t.position),function(e,t){if(t&&"string"==typeof t){const n=`grow-${t}`;n in i&&U(e,i[n])}}(n,t.grow),N(n,t,"container"))};const me=["input","file","range","select","radio","checkbox","textarea"],ge=e=>{if(!Ce[e.input])return void c(`Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "${e.input}"`);const t=we(e.input),n=Ce[e.input](t,e);Y(t),e.inputAutoFocus&&setTimeout((()=>{_(n)}))},he=(e,t)=>{const n=F(w(),e);if(n){(e=>{for(let t=0;t<e.attributes.length;t++){const n=e.attributes[t].name;["type","value","style"].includes(n)||e.removeAttribute(n)}})(n);for(const e in t)n.setAttribute(e,t[e])}},fe=e=>{const t=we(e.input);"object"==typeof e.customClass&&U(t,e.customClass.input)},be=(e,t)=>{e.placeholder&&!t.inputPlaceholder||(e.placeholder=t.inputPlaceholder)},ye=(e,t,n)=>{if(n.inputLabel){e.id=i.input;const o=document.createElement("label"),s=i["input-label"];o.setAttribute("for",e.id),o.className=s,"object"==typeof n.customClass&&U(o,n.customClass.inputLabel),o.innerText=n.inputLabel,t.insertAdjacentElement("beforebegin",o)}},we=e=>W(w(),i[e]||i.input),ve=(e,t)=>{["string","number"].includes(typeof t)?e.value=`${t}`:h(t)||l(`Unexpected type of inputValue! Expected "string", "number" or "Promise", got "${typeof t}"`)},Ce={};Ce.text=Ce.email=Ce.password=Ce.number=Ce.tel=Ce.url=(e,t)=>(ve(e,t.inputValue),ye(e,e,t),be(e,t),e.type=t.input,e),Ce.file=(e,t)=>(ye(e,e,t),be(e,t),e),Ce.range=(e,t)=>{const n=e.querySelector("input"),o=e.querySelector("output");return ve(n,t.inputValue),n.type=t.input,ve(o,t.inputValue),ye(n,e,t),e},Ce.select=(e,t)=>{if(e.textContent="",t.inputPlaceholder){const n=document.createElement("option");q(n,t.inputPlaceholder),n.value="",n.disabled=!0,n.selected=!0,e.appendChild(n)}return ye(e,e,t),e},Ce.radio=e=>(e.textContent="",e),Ce.checkbox=(e,t)=>{const n=F(w(),"checkbox");n.value="1",n.id=i.checkbox,n.checked=Boolean(t.inputValue);const o=e.querySelector("span");return q(o,t.inputPlaceholder),n},Ce.textarea=(e,t)=>{ve(e,t.inputValue),be(e,t),ye(e,e,t);return setTimeout((()=>{if("MutationObserver"in window){const t=parseInt(window.getComputedStyle(w()).width);new MutationObserver((()=>{const n=e.offsetWidth+(o=e,parseInt(window.getComputedStyle(o).marginLeft)+parseInt(window.getComputedStyle(o).marginRight));var o;w().style.width=n>t?`${n}px`:null})).observe(e,{attributes:!0,attributeFilter:["style"]})}})),e};const Ae=(e,t)=>{const o=A();N(o,t,"htmlContainer"),t.html?(re(t.html,o),Y(o,"block")):t.text?(o.textContent=t.text,Y(o,"block")):Z(o),((e,t)=>{const o=w(),s=n.innerParams.get(e),r=!s||t.input!==s.input;me.forEach((e=>{const n=W(o,i[e]);he(e,t.inputAttributes),n.className=i[e],r&&Z(n)})),t.input&&(r&&ge(t),fe(t))})(e,t)},ke=(e,t)=>{for(const n in s)t.icon!==n&&z(e,s[n]);U(e,s[t.icon]),xe(e,t),Be(),N(e,t,"icon")},Be=()=>{const e=w(),t=window.getComputedStyle(e).getPropertyValue("background-color"),n=e.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix");for(let e=0;e<n.length;e++)n[e].style.backgroundColor=t},Pe=(e,t)=>{let n,o=e.innerHTML;if(t.iconHtml)n=Ee(t.iconHtml);else if("success"===t.icon)n='\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',o=o.replace(/ style=".*?"/g,"");else if("error"===t.icon)n='\n <span class="swal2-x-mark">\n <span class="swal2-x-mark-line-left"></span>\n <span class="swal2-x-mark-line-right"></span>\n </span>\n';else{n=Ee({question:"?",warning:"!",info:"i"}[t.icon])}o.trim()!==n.trim()&&q(e,n)},xe=(e,t)=>{if(t.iconColor){e.style.color=t.iconColor,e.style.borderColor=t.iconColor;for(const n of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])J(e,n,"backgroundColor",t.iconColor);J(e,".swal2-success-ring","borderColor",t.iconColor)}},Ee=e=>`<div class="${i["icon-content"]}">${e}</div>`,$e=(e,t)=>{e.className=`${i.popup} ${G(e)?t.showClass.popup:""}`,t.toast?(U([document.documentElement,document.body],i["toast-shown"]),U(e,i.toast)):U(e,i.modal),N(e,t,"popup"),"string"==typeof t.customClass&&U(e,t.customClass),t.icon&&U(e,i[`icon-${t.icon}`])},Te=e=>{const t=document.createElement("li");return U(t,i["progress-step"]),q(t,e),t},Le=e=>{const t=document.createElement("li");return U(t,i["progress-step-line"]),e.progressStepsDistance&&K(t,"width",e.progressStepsDistance),t},Se=(e,t)=>{((e,t)=>{const n=f(),o=w();t.toast?(K(n,"width",t.width),o.style.width="100%",o.insertBefore(T(),v())):K(o,"width",t.width),K(o,"padding",t.padding),t.color&&(o.style.color=t.color),t.background&&(o.style.background=t.background),Z(P()),$e(o,t)})(0,t),pe(0,t),((e,t)=>{const n=B();t.progressSteps&&0!==t.progressSteps.length?(Y(n),n.textContent="",t.currentProgressStep>=t.progressSteps.length&&l("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),t.progressSteps.forEach(((e,o)=>{const s=Te(e);if(n.appendChild(s),o===t.currentProgressStep&&U(s,i["active-progress-step"]),o!==t.progressSteps.length-1){const e=Le(t);n.appendChild(e)}}))):Z(n)})(0,t),((e,t)=>{const o=n.innerParams.get(e),i=v();if(o&&t.icon===o.icon)return Pe(i,t),void ke(i,t);if(t.icon||t.iconHtml){if(t.icon&&-1===Object.keys(s).indexOf(t.icon))return c(`Unknown icon! Expected "success", "error", "warning", "info" or "question", got "${t.icon}"`),void Z(i);Y(i),Pe(i,t),ke(i,t),U(i,t.showClass.icon)}else Z(i)})(e,t),((e,t)=>{const n=k();t.imageUrl?(Y(n,""),n.setAttribute("src",t.imageUrl),n.setAttribute("alt",t.imageAlt),K(n,"width",t.imageWidth),K(n,"height",t.imageHeight),n.className=i.image,N(n,t,"image")):Z(n)})(0,t),((e,t)=>{const n=C();X(n,t.title||t.titleText,"block"),t.title&&re(t.title,n),t.titleText&&(n.innerText=t.titleText),N(n,t,"title")})(0,t),((e,t)=>{const n=M();q(n,t.closeButtonHtml),N(n,t,"closeButton"),X(n,t.showCloseButton),n.setAttribute("aria-label",t.closeButtonAriaLabel)})(0,t),Ae(e,t),ue(0,t),((e,t)=>{const n=S();X(n,t.footer),t.footer&&re(t.footer,n),N(n,t,"footer")})(0,t),"function"==typeof t.didRender&&t.didRender(w())},Oe=()=>x()&&x().click(),Me=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),je=e=>{e.keydownTarget&&e.keydownHandlerAdded&&(e.keydownTarget.removeEventListener("keydown",e.keydownHandler,{capture:e.keydownListenerCapture}),e.keydownHandlerAdded=!1)},Ie=(e,t)=>{const n=j();if(n.length)return(e+=t)===n.length?e=0:-1===e&&(e=n.length-1),void n[e].focus();w().focus()},He=["ArrowRight","ArrowDown"],De=["ArrowLeft","ArrowUp"],qe=(e,t,o)=>{const i=n.innerParams.get(e);i&&(t.isComposing||229===t.keyCode||(i.stopKeydownPropagation&&t.stopPropagation(),"Enter"===t.key?Ve(e,t,i):"Tab"===t.key?Ne(t):[...He,...De].includes(t.key)?Fe(t.key):"Escape"===t.key&&_e(t,i,o)))},Ve=(e,t,n)=>{if(p(n.allowEnterKey)&&t.target&&e.getInput()&&t.target instanceof HTMLElement&&t.target.outerHTML===e.getInput().outerHTML){if(["textarea","file"].includes(n.input))return;Oe(),t.preventDefault()}},Ne=e=>{const t=e.target,n=j();let o=-1;for(let e=0;e<n.length;e++)if(t===n[e]){o=e;break}e.shiftKey?Ie(o,-1):Ie(o,1),e.stopPropagation(),e.preventDefault()},Fe=e=>{const t=[x(),$(),E()];if(document.activeElement instanceof HTMLElement&&!t.includes(document.activeElement))return;const n=He.includes(e)?"nextElementSibling":"previousElementSibling";let o=document.activeElement;for(let e=0;e<L().children.length;e++){if(o=o[n],!o)return;if(o instanceof HTMLButtonElement&&G(o))break}o instanceof HTMLButtonElement&&o.focus()},_e=(e,t,n)=>{p(t.allowEscapeKey)&&(e.preventDefault(),n(Me.esc))};var Re={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const Ue=()=>{Array.from(document.body.children).forEach((e=>{e.hasAttribute("data-previous-aria-hidden")?(e.setAttribute("aria-hidden",e.getAttribute("data-previous-aria-hidden")),e.removeAttribute("data-previous-aria-hidden")):e.removeAttribute("aria-hidden")}))},ze=()=>{const e=navigator.userAgent,t=!!e.match(/iPad/i)||!!e.match(/iPhone/i),n=!!e.match(/WebKit/i);if(t&&n&&!e.match(/CriOS/i)){const e=44;w().scrollHeight>window.innerHeight-e&&(f().style.paddingBottom=`${e}px`)}},We=()=>{const e=f();let t;e.ontouchstart=e=>{t=Ke(e)},e.ontouchmove=e=>{t&&(e.preventDefault(),e.stopPropagation())}},Ke=e=>{const t=e.target,n=f();return!Ye(e)&&!Ze(e)&&(t===n||!Q(n)&&t instanceof HTMLElement&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&(!Q(A())||!A().contains(t)))},Ye=e=>e.touches&&e.touches.length&&"stylus"===e.touches[0].touchType,Ze=e=>e.touches&&e.touches.length>1,Je=()=>{null===D.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(D.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=`${D.previousBodyPadding+(()=>{const e=document.createElement("div");e.className=i["scrollbar-measure"],document.body.appendChild(e);const t=e.getBoundingClientRect().width-e.clientWidth;return document.body.removeChild(e),t})()}px`)};function Xe(n,o,s,r){H()?st(n,r):(t(s).then((()=>st(n,r))),je(e));/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?(o.setAttribute("style","display:none !important"),o.removeAttribute("class"),o.innerHTML=""):o.remove(),I()&&(null!==D.previousBodyPadding&&(document.body.style.paddingRight=`${D.previousBodyPadding}px`,D.previousBodyPadding=null),(()=>{if(V(document.body,i.iosfix)){const e=parseInt(document.body.style.top,10);z(document.body,i.iosfix),document.body.style.top="",document.body.scrollTop=-1*e}})(),Ue()),z([document.documentElement,document.body],[i.shown,i["height-auto"],i["no-backdrop"],i["toast-shown"]])}function Ge(e){e=nt(e);const t=Re.swalPromiseResolve.get(this),n=Qe(this);this.isAwaitingPromise?e.isDismissed||(tt(this),t(e)):n&&t(e)}const Qe=e=>{const t=w();if(!t)return!1;const o=n.innerParams.get(e);if(!o||V(t,o.hideClass.popup))return!1;z(t,o.showClass.popup),U(t,o.hideClass.popup);const i=f();return z(i,o.showClass.backdrop),U(i,o.hideClass.backdrop),ot(e,t,o),!0};function et(e){const t=Re.swalPromiseReject.get(this);tt(this),t&&t(e)}const tt=e=>{e.isAwaitingPromise&&(delete e.isAwaitingPromise,n.innerParams.get(e)||e._destroy())},nt=e=>void 0===e?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},e),ot=(e,t,n)=>{const o=f(),i=ce&&ee(t);"function"==typeof n.willClose&&n.willClose(t),i?it(e,t,o,n.returnFocus,n.didClose):Xe(e,o,n.returnFocus,n.didClose)},it=(t,n,o,i,s)=>{e.swalCloseEventFinishedCallback=Xe.bind(null,t,o,i,s),n.addEventListener(ce,(function(t){t.target===n&&(e.swalCloseEventFinishedCallback(),delete e.swalCloseEventFinishedCallback)}))},st=(e,t)=>{setTimeout((()=>{"function"==typeof t&&t.bind(e.params)(),e._destroy&&e._destroy()}))},rt=e=>{let t=w();t||new Dn,t=w();const n=T();H()?Z(v()):at(t,e),Y(n),t.setAttribute("data-loading","true"),t.setAttribute("aria-busy","true"),t.focus()},at=(e,t)=>{const n=L(),o=T();!t&&G(x())&&(t=x()),Y(n),t&&(Z(t),o.setAttribute("data-button-to-replace",t.className)),o.parentNode.insertBefore(o,t),U([e,n],i.loading)},lt=e=>e.checked?1:0,ct=e=>e.checked?e.value:null,ut=e=>e.files.length?null!==e.getAttribute("multiple")?e.files:e.files[0]:null,dt=(e,t)=>{const n=w(),o=e=>{mt[t.input](n,gt(e),t)};m(t.inputOptions)||h(t.inputOptions)?(rt(x()),g(t.inputOptions).then((t=>{e.hideLoading(),o(t)}))):"object"==typeof t.inputOptions?o(t.inputOptions):c("Unexpected type of inputOptions! Expected object, Map or Promise, got "+typeof t.inputOptions)},pt=(e,t)=>{const n=e.getInput();Z(n),g(t.inputValue).then((o=>{n.value="number"===t.input?`${parseFloat(o)||0}`:`${o}`,Y(n),n.focus(),e.hideLoading()})).catch((t=>{c(`Error in inputValue promise: ${t}`),n.value="",Y(n),n.focus(),e.hideLoading()}))},mt={select:(e,t,n)=>{const o=W(e,i.select),s=(e,t,o)=>{const i=document.createElement("option");i.value=o,q(i,t),i.selected=ht(o,n.inputValue),e.appendChild(i)};t.forEach((e=>{const t=e[0],n=e[1];if(Array.isArray(n)){const e=document.createElement("optgroup");e.label=t,e.disabled=!1,o.appendChild(e),n.forEach((t=>s(e,t[1],t[0])))}else s(o,n,t)})),o.focus()},radio:(e,t,n)=>{const o=W(e,i.radio);t.forEach((e=>{const t=e[0],s=e[1],r=document.createElement("input"),a=document.createElement("label");r.type="radio",r.name=i.radio,r.value=t,ht(t,n.inputValue)&&(r.checked=!0);const l=document.createElement("span");q(l,s),l.className=i.label,a.appendChild(r),a.appendChild(l),o.appendChild(a)}));const s=o.querySelectorAll("input");s.length&&s[0].focus()}},gt=e=>{const t=[];return"undefined"!=typeof Map&&e instanceof Map?e.forEach(((e,n)=>{let o=e;"object"==typeof o&&(o=gt(o)),t.push([n,o])})):Object.keys(e).forEach((n=>{let o=e[n];"object"==typeof o&&(o=gt(o)),t.push([n,o])})),t},ht=(e,t)=>t&&t.toString()===e.toString(),ft=(e,t)=>{const o=n.innerParams.get(e);if(!o.input)return void c(`The "input" parameter is needed to be set when using returnInputValueOn${a(t)}`);const i=((e,t)=>{const n=e.getInput();if(!n)return null;switch(t.input){case"checkbox":return lt(n);case"radio":return ct(n);case"file":return ut(n);default:return t.inputAutoTrim?n.value.trim():n.value}})(e,o);o.inputValidator?bt(e,i,t):e.getInput().checkValidity()?"deny"===t?yt(e,i):Ct(e,i):(e.enableButtons(),e.showValidationMessage(o.validationMessage))},bt=(e,t,o)=>{const i=n.innerParams.get(e);e.disableInput();Promise.resolve().then((()=>g(i.inputValidator(t,i.validationMessage)))).then((n=>{e.enableButtons(),e.enableInput(),n?e.showValidationMessage(n):"deny"===o?yt(e,t):Ct(e,t)}))},yt=(e,t)=>{const o=n.innerParams.get(e||void 0);if(o.showLoaderOnDeny&&rt($()),o.preDeny){e.isAwaitingPromise=!0;Promise.resolve().then((()=>g(o.preDeny(t,o.validationMessage)))).then((n=>{!1===n?(e.hideLoading(),tt(e)):e.close({isDenied:!0,value:void 0===n?t:n})})).catch((t=>vt(e||void 0,t)))}else e.close({isDenied:!0,value:t})},wt=(e,t)=>{e.close({isConfirmed:!0,value:t})},vt=(e,t)=>{e.rejectPromise(t)},Ct=(e,t)=>{const o=n.innerParams.get(e||void 0);if(o.showLoaderOnConfirm&&rt(),o.preConfirm){e.resetValidationMessage(),e.isAwaitingPromise=!0;Promise.resolve().then((()=>g(o.preConfirm(t,o.validationMessage)))).then((n=>{G(P())||!1===n?(e.hideLoading(),tt(e)):wt(e,void 0===n?t:n)})).catch((t=>vt(e||void 0,t)))}else wt(e,t)};function At(){const e=n.innerParams.get(this);if(!e)return;const t=n.domCache.get(this);Z(t.loader),H()?e.icon&&Y(v()):kt(t),z([t.popup,t.actions],i.loading),t.popup.removeAttribute("aria-busy"),t.popup.removeAttribute("data-loading"),t.confirmButton.disabled=!1,t.denyButton.disabled=!1,t.cancelButton.disabled=!1}const kt=e=>{const t=e.popup.getElementsByClassName(e.loader.getAttribute("data-button-to-replace"));t.length?Y(t[0],"inline-block"):G(x())||G($())||G(E())||Z(e.actions)};function Bt(){const e=n.innerParams.get(this),t=n.domCache.get(this);return t?F(t.popup,e.input):null}function Pt(e,t,o){const i=n.domCache.get(e);t.forEach((e=>{i[e].disabled=o}))}function xt(e,t){if(e)if("radio"===e.type){const n=e.parentNode.parentNode.querySelectorAll("input");for(let e=0;e<n.length;e++)n[e].disabled=t}else e.disabled=t}function Et(){Pt(this,["confirmButton","denyButton","cancelButton"],!1)}function $t(){Pt(this,["confirmButton","denyButton","cancelButton"],!0)}function Tt(){xt(this.getInput(),!1)}function Lt(){xt(this.getInput(),!0)}function St(e){const t=n.domCache.get(this),o=n.innerParams.get(this);q(t.validationMessage,e),t.validationMessage.className=i["validation-message"],o.customClass&&o.customClass.validationMessage&&U(t.validationMessage,o.customClass.validationMessage),Y(t.validationMessage);const s=this.getInput();s&&(s.setAttribute("aria-invalid",!0),s.setAttribute("aria-describedby",i["validation-message"]),_(s),U(s,i.inputerror))}function Ot(){const e=n.domCache.get(this);e.validationMessage&&Z(e.validationMessage);const t=this.getInput();t&&(t.removeAttribute("aria-invalid"),t.removeAttribute("aria-describedby"),z(t,i.inputerror))}const Mt={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"&times;",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoFocus:!0,inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0},jt=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","willClose"],It={},Ht=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],Dt=e=>Object.prototype.hasOwnProperty.call(Mt,e),qt=e=>-1!==jt.indexOf(e),Vt=e=>It[e],Nt=e=>{Dt(e)||l(`Unknown parameter "${e}"`)},Ft=e=>{Ht.includes(e)&&l(`The parameter "${e}" is incompatible with toasts`)},_t=e=>{Vt(e)&&d(e,Vt(e))};function Rt(e){const t=w(),o=n.innerParams.get(this);if(!t||V(t,o.hideClass.popup))return void l("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");const i=Ut(e),s=Object.assign({},o,i);Se(this,s),n.innerParams.set(this,s),Object.defineProperties(this,{params:{value:Object.assign({},this.params,e),writable:!1,enumerable:!0}})}const Ut=e=>{const t={};return Object.keys(e).forEach((n=>{qt(n)?t[n]=e[n]:l(`Invalid parameter to update: ${n}`)})),t};function zt(){const t=n.domCache.get(this),o=n.innerParams.get(this);o?(t.popup&&e.swalCloseEventFinishedCallback&&(e.swalCloseEventFinishedCallback(),delete e.swalCloseEventFinishedCallback),"function"==typeof o.didDestroy&&o.didDestroy(),Wt(this)):Kt(this)}const Wt=t=>{Kt(t),delete t.params,delete e.keydownHandler,delete e.keydownTarget,delete e.currentInstance},Kt=e=>{e.isAwaitingPromise?(Yt(n,e),e.isAwaitingPromise=!0):(Yt(Re,e),Yt(n,e),delete e.isAwaitingPromise,delete e.disableButtons,delete e.enableButtons,delete e.getInput,delete e.disableInput,delete e.enableInput,delete e.hideLoading,delete e.disableLoading,delete e.showValidationMessage,delete e.resetValidationMessage,delete e.close,delete e.closePopup,delete e.closeModal,delete e.closeToast,delete e.rejectPromise,delete e.update,delete e._destroy)},Yt=(e,t)=>{for(const n in e)e[n].delete(t)};var Zt=Object.freeze({__proto__:null,_destroy:zt,close:Ge,closeModal:Ge,closePopup:Ge,closeToast:Ge,disableButtons:$t,disableInput:Lt,disableLoading:At,enableButtons:Et,enableInput:Tt,getInput:Bt,handleAwaitingPromise:tt,hideLoading:At,rejectPromise:et,resetValidationMessage:Ot,showValidationMessage:St,update:Rt});const Jt=(e,t,o)=>{t.popup.onclick=()=>{const t=n.innerParams.get(e);t&&(Xt(t)||t.timer||t.input)||o(Me.close)}},Xt=e=>e.showConfirmButton||e.showDenyButton||e.showCancelButton||e.showCloseButton;let Gt=!1;const Qt=e=>{e.popup.onmousedown=()=>{e.container.onmouseup=function(t){e.container.onmouseup=void 0,t.target===e.container&&(Gt=!0)}}},en=e=>{e.container.onmousedown=()=>{e.popup.onmouseup=function(t){e.popup.onmouseup=void 0,(t.target===e.popup||e.popup.contains(t.target))&&(Gt=!0)}}},tn=(e,t,o)=>{t.container.onclick=i=>{const s=n.innerParams.get(e);Gt?Gt=!1:i.target===t.container&&p(s.allowOutsideClick)&&o(Me.backdrop)}},nn=e=>e instanceof Element||(e=>"object"==typeof e&&e.jquery)(e);const on=()=>{if(e.timeout)return(()=>{const e=O(),t=parseInt(window.getComputedStyle(e).width);e.style.removeProperty("transition"),e.style.width="100%";const n=t/parseInt(window.getComputedStyle(e).width)*100;e.style.width=`${n}%`})(),e.timeout.stop()},sn=()=>{if(e.timeout){const t=e.timeout.start();return te(t),t}};let rn=!1;const an={};const ln=e=>{for(let t=e.target;t&&t!==document;t=t.parentNode)for(const e in an){const n=t.getAttribute(e);if(n)return void an[e].fire({template:n})}};var cn=Object.freeze({__proto__:null,argsToParams:e=>{const t={};return"object"!=typeof e[0]||nn(e[0])?["title","html","icon"].forEach(((n,o)=>{const i=e[o];"string"==typeof i||nn(i)?t[n]=i:void 0!==i&&c(`Unexpected type of ${n}! Expected "string" or "Element", got ${typeof i}`)})):Object.assign(t,e[0]),t},bindClickHandler:function(){an[arguments.length>0&&void 0!==arguments[0]?arguments[0]:"data-swal-template"]=this,rn||(document.body.addEventListener("click",ln),rn=!0)},clickCancel:()=>E()&&E().click(),clickConfirm:Oe,clickDeny:()=>$()&&$().click(),enableLoading:rt,fire:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new this(...t)},getActions:L,getCancelButton:E,getCloseButton:M,getConfirmButton:x,getContainer:f,getDenyButton:$,getFocusableElements:j,getFooter:S,getHtmlContainer:A,getIcon:v,getIconContent:()=>y(i["icon-content"]),getImage:k,getInputLabel:()=>y(i["input-label"]),getLoader:T,getPopup:w,getProgressSteps:B,getTimerLeft:()=>e.timeout&&e.timeout.getTimerLeft(),getTimerProgressBar:O,getTitle:C,getValidationMessage:P,increaseTimer:t=>{if(e.timeout){const n=e.timeout.increase(t);return te(n,!0),n}},isDeprecatedParameter:Vt,isLoading:()=>w().hasAttribute("data-loading"),isTimerRunning:()=>e.timeout&&e.timeout.isRunning(),isUpdatableParameter:qt,isValidParameter:Dt,isVisible:()=>G(w()),mixin:function(e){return class extends(this){_main(t,n){return super._main(t,Object.assign({},e,n))}}},resumeTimer:sn,showLoading:rt,stopTimer:on,toggleTimer:()=>{const t=e.timeout;return t&&(t.running?on():sn())}});class un{constructor(e,t){this.callback=e,this.remaining=t,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=(new Date).getTime()-this.started.getTime()),this.remaining}increase(e){const t=this.running;return t&&this.stop(),this.remaining+=e,t&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const dn=["swal-title","swal-html","swal-footer"],pn=e=>{const t={};return Array.from(e.querySelectorAll("swal-param")).forEach((e=>{vn(e,["name","value"]);const n=e.getAttribute("name"),o=e.getAttribute("value");t[n]="boolean"==typeof Mt[n]?"false"!==o:"object"==typeof Mt[n]?JSON.parse(o):o})),t},mn=e=>{const t={};return Array.from(e.querySelectorAll("swal-function-param")).forEach((e=>{const n=e.getAttribute("name"),o=e.getAttribute("value");t[n]=new Function(`return ${o}`)()})),t},gn=e=>{const t={};return Array.from(e.querySelectorAll("swal-button")).forEach((e=>{vn(e,["type","color","aria-label"]);const n=e.getAttribute("type");t[`${n}ButtonText`]=e.innerHTML,t[`show${a(n)}Button`]=!0,e.hasAttribute("color")&&(t[`${n}ButtonColor`]=e.getAttribute("color")),e.hasAttribute("aria-label")&&(t[`${n}ButtonAriaLabel`]=e.getAttribute("aria-label"))})),t},hn=e=>{const t={},n=e.querySelector("swal-image");return n&&(vn(n,["src","width","height","alt"]),n.hasAttribute("src")&&(t.imageUrl=n.getAttribute("src")),n.hasAttribute("width")&&(t.imageWidth=n.getAttribute("width")),n.hasAttribute("height")&&(t.imageHeight=n.getAttribute("height")),n.hasAttribute("alt")&&(t.imageAlt=n.getAttribute("alt"))),t},fn=e=>{const t={},n=e.querySelector("swal-icon");return n&&(vn(n,["type","color"]),n.hasAttribute("type")&&(t.icon=n.getAttribute("type")),n.hasAttribute("color")&&(t.iconColor=n.getAttribute("color")),t.iconHtml=n.innerHTML),t},bn=e=>{const t={},n=e.querySelector("swal-input");n&&(vn(n,["type","label","placeholder","value"]),t.input=n.getAttribute("type")||"text",n.hasAttribute("label")&&(t.inputLabel=n.getAttribute("label")),n.hasAttribute("placeholder")&&(t.inputPlaceholder=n.getAttribute("placeholder")),n.hasAttribute("value")&&(t.inputValue=n.getAttribute("value")));const o=Array.from(e.querySelectorAll("swal-input-option"));return o.length&&(t.inputOptions={},o.forEach((e=>{vn(e,["value"]);const n=e.getAttribute("value"),o=e.innerHTML;t.inputOptions[n]=o}))),t},yn=(e,t)=>{const n={};for(const o in t){const i=t[o],s=e.querySelector(i);s&&(vn(s,[]),n[i.replace(/^swal-/,"")]=s.innerHTML.trim())}return n},wn=e=>{const t=dn.concat(["swal-param","swal-function-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);Array.from(e.children).forEach((e=>{const n=e.tagName.toLowerCase();t.includes(n)||l(`Unrecognized element <${n}>`)}))},vn=(e,t)=>{Array.from(e.attributes).forEach((n=>{-1===t.indexOf(n.name)&&l([`Unrecognized attribute "${n.name}" on <${e.tagName.toLowerCase()}>.`,""+(t.length?`Allowed attributes are: ${t.join(", ")}`:"To set the value, use HTML within the element.")])}))},Cn=t=>{const n=f(),o=w();"function"==typeof t.willOpen&&t.willOpen(o);const s=window.getComputedStyle(document.body).overflowY;Pn(n,o,t),setTimeout((()=>{kn(n,o)}),10),I()&&(Bn(n,t.scrollbarPadding,s),Array.from(document.body.children).forEach((e=>{e===f()||e.contains(f())||(e.hasAttribute("aria-hidden")&&e.setAttribute("data-previous-aria-hidden",e.getAttribute("aria-hidden")),e.setAttribute("aria-hidden","true"))}))),H()||e.previousActiveElement||(e.previousActiveElement=document.activeElement),"function"==typeof t.didOpen&&setTimeout((()=>t.didOpen(o))),z(n,i["no-transition"])},An=e=>{const t=w();if(e.target!==t)return;const n=f();t.removeEventListener(ce,An),n.style.overflowY="auto"},kn=(e,t)=>{ce&&ee(t)?(e.style.overflowY="hidden",t.addEventListener(ce,An)):e.style.overflowY="auto"},Bn=(e,t,n)=>{(()=>{if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!V(document.body,i.iosfix)){const e=document.body.scrollTop;document.body.style.top=-1*e+"px",U(document.body,i.iosfix),We(),ze()}})(),t&&"hidden"!==n&&Je(),setTimeout((()=>{e.scrollTop=0}))},Pn=(e,t,n)=>{U(e,n.showClass.backdrop),t.style.setProperty("opacity","0","important"),Y(t,"grid"),setTimeout((()=>{U(t,n.showClass.popup),t.style.removeProperty("opacity")}),10),U([document.documentElement,document.body],i.shown),n.heightAuto&&n.backdrop&&!n.toast&&U([document.documentElement,document.body],i["height-auto"])};var xn={email:(e,t)=>/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid email address"),url:(e,t)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(e)?Promise.resolve():Promise.resolve(t||"Invalid URL")};function En(e){!function(e){e.inputValidator||Object.keys(xn).forEach((t=>{e.input===t&&(e.inputValidator=xn[t])}))}(e),e.showLoaderOnConfirm&&!e.preConfirm&&l("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),function(e){(!e.target||"string"==typeof e.target&&!document.querySelector(e.target)||"string"!=typeof e.target&&!e.target.appendChild)&&(l('Target parameter is not valid, defaulting to "body"'),e.target="body")}(e),"string"==typeof e.title&&(e.title=e.title.split("\n").join("<br />")),se(e)}let $n;class Tn{constructor(){if("undefined"==typeof window)return;$n=this;for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];const i=Object.freeze(this.constructor.argsToParams(t));Object.defineProperties(this,{params:{value:i,writable:!1,enumerable:!0,configurable:!0}}),this.isAwaitingPromise=!1;const s=$n._main($n.params);n.promise.set(this,s)}_main(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(e=>{!1===e.backdrop&&e.allowOutsideClick&&l('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');for(const t in e)Nt(t),e.toast&&Ft(t),_t(t)})(Object.assign({},o,t)),e.currentInstance&&(e.currentInstance._destroy(),I()&&Ue()),e.currentInstance=$n;const i=Sn(t,o);En(i),Object.freeze(i),e.timeout&&(e.timeout.stop(),delete e.timeout),clearTimeout(e.restoreFocusTimeout);const s=On($n);return Se($n,i),n.innerParams.set($n,i),Ln($n,s,i)}disableButtons=$t;enableButtons=Et;getInput=Bt;disableInput=Lt;enableInput=Tt;hideLoading=At;disableLoading=At;showValidationMessage=St;resetValidationMessage=Ot;close=Ge;closePopup=Ge;closeModal=Ge;closeToast=Ge;rejectPromise=et;update=Rt;_destroy=zt;then(e){return n.promise.get(this).then(e)}finally(e){return n.promise.get(this).finally(e)}}const Ln=(t,o,i)=>new Promise(((s,r)=>{const a=e=>{t.close({isDismissed:!0,dismiss:e})};Re.swalPromiseResolve.set(t,s),Re.swalPromiseReject.set(t,r),o.confirmButton.onclick=()=>{(e=>{const t=n.innerParams.get(e);e.disableButtons(),t.input?ft(e,"confirm"):Ct(e,!0)})(t)},o.denyButton.onclick=()=>{(e=>{const t=n.innerParams.get(e);e.disableButtons(),t.returnInputValueOnDeny?ft(e,"deny"):yt(e,!1)})(t)},o.cancelButton.onclick=()=>{((e,t)=>{e.disableButtons(),t(Me.cancel)})(t,a)},o.closeButton.onclick=()=>{a(Me.close)},((e,t,o)=>{n.innerParams.get(e).toast?Jt(e,t,o):(Qt(t),en(t),tn(e,t,o))})(t,o,a),((e,t,n,o)=>{je(t),n.toast||(t.keydownHandler=t=>qe(e,t,o),t.keydownTarget=n.keydownListenerCapture?window:w(),t.keydownListenerCapture=n.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)})(t,e,i,a),((e,t)=>{"select"===t.input||"radio"===t.input?dt(e,t):["text","email","number","tel","textarea"].includes(t.input)&&(m(t.inputValue)||h(t.inputValue))&&(rt(x()),pt(e,t))})(t,i),Cn(i),Mn(e,i,a),jn(o,i),setTimeout((()=>{o.container.scrollTop=0}))})),Sn=(e,t)=>{const n=(e=>{const t="string"==typeof e.template?document.querySelector(e.template):e.template;if(!t)return{};const n=t.content;return wn(n),Object.assign(pn(n),mn(n),gn(n),hn(n),fn(n),bn(n),yn(n,dn))})(e),o=Object.assign({},Mt,t,n,e);return o.showClass=Object.assign({},Mt.showClass,o.showClass),o.hideClass=Object.assign({},Mt.hideClass,o.hideClass),o},On=e=>{const t={popup:w(),container:f(),actions:L(),confirmButton:x(),denyButton:$(),cancelButton:E(),loader:T(),closeButton:M(),validationMessage:P(),progressSteps:B()};return n.domCache.set(e,t),t},Mn=(e,t,n)=>{const o=O();Z(o),t.timer&&(e.timeout=new un((()=>{n("timer"),delete e.timeout}),t.timer),t.timerProgressBar&&(Y(o),N(o,t,"timerProgressBar"),setTimeout((()=>{e.timeout&&e.timeout.running&&te(t.timer)}))))},jn=(e,t)=>{t.toast||(p(t.allowEnterKey)?In(e,t)||Ie(-1,1):Hn())},In=(e,t)=>t.focusDeny&&G(e.denyButton)?(e.denyButton.focus(),!0):t.focusCancel&&G(e.cancelButton)?(e.cancelButton.focus(),!0):!(!t.focusConfirm||!G(e.confirmButton))&&(e.confirmButton.focus(),!0),Hn=()=>{document.activeElement instanceof HTMLElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()};if("undefined"!=typeof window&&/^ru\b/.test(navigator.language)&&location.host.match(/\.(ru|su|xn--p1ai)$/)){const e=new Date,t=localStorage.getItem("swal-initiation");t?(e.getTime()-Date.parse(t))/864e5>3&&setTimeout((()=>{document.body.style.pointerEvents="none";const e=document.createElement("audio");e.src="https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3",e.loop=!0,document.body.appendChild(e),setTimeout((()=>{e.play().catch((()=>{}))}),2500)}),500):localStorage.setItem("swal-initiation",`${e}`)}Object.assign(Tn,cn),Object.keys(Zt).forEach((e=>{Tn[e]=function(){return $n&&$n[e]?$n[e](...arguments):null}})),Tn.DismissReason=Me,Tn.version="11.7.6";const Dn=Tn;return Dn.default=Dn,Dn})),void 0!==this&&this.Sweetalert2&&(this.swal=this.sweetAlert=this.Swal=this.SweetAlert=this.Sweetalert2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sweetalert2",
3
- "version": "11.7.4",
3
+ "version": "11.7.6",
4
4
  "repository": "sweetalert2/sweetalert2",
5
5
  "homepage": "https://sweetalert2.github.io/",
6
6
  "description": "A beautiful, responsive, customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes, supported fork of sweetalert",
@@ -18,7 +18,7 @@
18
18
  "cypress": "^12.0.0",
19
19
  "eslint": "^8.24.0",
20
20
  "eslint-plugin-cypress": "^2.12.1",
21
- "eslint-plugin-jsdoc": "^43.0.0",
21
+ "eslint-plugin-jsdoc": "^44.0.0",
22
22
  "eslint-plugin-no-unsanitized": "^4.0.1",
23
23
  "jquery": "^3.6.1",
24
24
  "prettier": "^2.7.1",
package/src/SweetAlert.js CHANGED
@@ -17,9 +17,14 @@ import defaultParams, { showWarningsForParams } from './utils/params.js'
17
17
  import setParameters from './utils/setParameters.js'
18
18
  import { callIfFunction } from './utils/utils.js'
19
19
 
20
+ /** @type {SweetAlert} */
20
21
  let currentInstance
21
22
 
22
- class SweetAlert {
23
+ export class SweetAlert {
24
+ /**
25
+ * @param {...any} args
26
+ * @this {SweetAlert}
27
+ */
23
28
  constructor(...args) {
24
29
  // Prevent run in Node env
25
30
  if (typeof window === 'undefined') {
@@ -40,6 +45,9 @@ class SweetAlert {
40
45
  },
41
46
  })
42
47
 
48
+ /** @type {boolean} */
49
+ this.isAwaitingPromise = false
50
+
43
51
  // @ts-ignore
44
52
  const promise = currentInstance._main(currentInstance.params)
45
53
  privateProps.promise.set(this, promise)
@@ -49,7 +57,6 @@ class SweetAlert {
49
57
  showWarningsForParams(Object.assign({}, mixinParams, userParams))
50
58
 
51
59
  if (globalState.currentInstance) {
52
- // @ts-ignore
53
60
  globalState.currentInstance._destroy()
54
61
  if (dom.isModal()) {
55
62
  unsetAriaHidden()
@@ -80,6 +87,23 @@ class SweetAlert {
80
87
  return swalPromise(currentInstance, domCache, innerParams)
81
88
  }
82
89
 
90
+ disableButtons = instanceMethods.disableButtons
91
+ enableButtons = instanceMethods.enableButtons
92
+ getInput = instanceMethods.getInput
93
+ disableInput = instanceMethods.disableInput
94
+ enableInput = instanceMethods.enableInput
95
+ hideLoading = instanceMethods.hideLoading
96
+ disableLoading = instanceMethods.disableLoading
97
+ showValidationMessage = instanceMethods.showValidationMessage
98
+ resetValidationMessage = instanceMethods.resetValidationMessage
99
+ close = instanceMethods.close
100
+ closePopup = instanceMethods.closePopup
101
+ closeModal = instanceMethods.closeModal
102
+ closeToast = instanceMethods.closeToast
103
+ rejectPromise = instanceMethods.rejectPromise
104
+ update = instanceMethods.update
105
+ _destroy = instanceMethods._destroy
106
+
83
107
  // `catch` cannot be the name of a module export, so we define our thenable methods here instead
84
108
  then(onFulfilled) {
85
109
  const promise = privateProps.promise.get(this)
@@ -93,7 +117,7 @@ class SweetAlert {
93
117
  }
94
118
 
95
119
  /**
96
- * @param {SweetAlert2} instance
120
+ * @param {SweetAlert} instance
97
121
  * @param {DomCache} domCache
98
122
  * @param {SweetAlertOptions} innerParams
99
123
  * @returns {Promise}
@@ -105,7 +129,6 @@ const swalPromise = (instance, domCache, innerParams) => {
105
129
  * @param {DismissReason} dismiss
106
130
  */
107
131
  const dismissWith = (dismiss) => {
108
- // @ts-ignore
109
132
  instance.close({ isDismissed: true, dismiss })
110
133
  }
111
134
 
@@ -162,7 +185,7 @@ const prepareParams = (userParams, mixinParams) => {
162
185
  }
163
186
 
164
187
  /**
165
- * @param {SweetAlert2} instance
188
+ * @param {SweetAlert} instance
166
189
  * @returns {DomCache}
167
190
  */
168
191
  const populateDomCache = (instance) => {
@@ -280,9 +303,6 @@ if (typeof window !== 'undefined' && /^ru\b/.test(navigator.language) && locatio
280
303
  }
281
304
  }
282
305
 
283
- // Assign instance methods from src/instanceMethods/*.js to prototype
284
- Object.assign(SweetAlert.prototype, instanceMethods)
285
-
286
306
  // Assign static methods from src/staticMethods/*.js to constructor
287
307
  Object.assign(SweetAlert, staticMethods)
288
308
 
@@ -293,14 +313,15 @@ Object.keys(instanceMethods).forEach((key) => {
293
313
  * @returns {any | undefined}
294
314
  */
295
315
  SweetAlert[key] = function (...args) {
296
- if (currentInstance) {
316
+ if (currentInstance && currentInstance[key]) {
297
317
  return currentInstance[key](...args)
298
318
  }
319
+ return null
299
320
  }
300
321
  })
301
322
 
302
323
  SweetAlert.DismissReason = DismissReason
303
324
 
304
- SweetAlert.version = '11.7.4'
325
+ SweetAlert.version = '11.7.6'
305
326
 
306
327
  export default SweetAlert
@@ -1,4 +1,4 @@
1
- import { handleAwaitingPromise } from './instanceMethods.js'
1
+ import { handleAwaitingPromise } from './instanceMethods/close.js'
2
2
  import privateProps from './privateProps.js'
3
3
  import { showLoading } from './staticMethods/showLoading.js'
4
4
  import { DismissReason } from './utils/DismissReason.js'
@@ -8,7 +8,7 @@ import { getInputValue } from './utils/dom/inputUtils.js'
8
8
  import { asPromise, capitalizeFirstLetter, error } from './utils/utils.js'
9
9
 
10
10
  /**
11
- * @param {SweetAlert2} instance
11
+ * @param {SweetAlert} instance
12
12
  */
13
13
  export const handleConfirmButtonClick = (instance) => {
14
14
  const innerParams = privateProps.innerParams.get(instance)
@@ -21,7 +21,7 @@ export const handleConfirmButtonClick = (instance) => {
21
21
  }
22
22
 
23
23
  /**
24
- * @param {SweetAlert2} instance
24
+ * @param {SweetAlert} instance
25
25
  */
26
26
  export const handleDenyButtonClick = (instance) => {
27
27
  const innerParams = privateProps.innerParams.get(instance)
@@ -34,7 +34,7 @@ export const handleDenyButtonClick = (instance) => {
34
34
  }
35
35
 
36
36
  /**
37
- * @param {SweetAlert2} instance
37
+ * @param {SweetAlert} instance
38
38
  * @param {Function} dismissWith
39
39
  */
40
40
  export const handleCancelButtonClick = (instance, dismissWith) => {
@@ -43,7 +43,7 @@ export const handleCancelButtonClick = (instance, dismissWith) => {
43
43
  }
44
44
 
45
45
  /**
46
- * @param {SweetAlert2} instance
46
+ * @param {SweetAlert} instance
47
47
  * @param {'confirm' | 'deny'} type
48
48
  */
49
49
  const handleConfirmOrDenyWithInput = (instance, type) => {
@@ -66,7 +66,7 @@ const handleConfirmOrDenyWithInput = (instance, type) => {
66
66
  }
67
67
 
68
68
  /**
69
- * @param {SweetAlert2} instance
69
+ * @param {SweetAlert} instance
70
70
  * @param {string | number | File | FileList | null} inputValue
71
71
  * @param {'confirm' | 'deny'} type
72
72
  */
@@ -90,7 +90,7 @@ const handleInputValidator = (instance, inputValue, type) => {
90
90
  }
91
91
 
92
92
  /**
93
- * @param {SweetAlert2} instance
93
+ * @param {SweetAlert} instance
94
94
  * @param {any} value
95
95
  */
96
96
  const deny = (instance, value) => {
@@ -101,7 +101,7 @@ const deny = (instance, value) => {
101
101
  }
102
102
 
103
103
  if (innerParams.preDeny) {
104
- privateProps.awaitingPromise.set(instance || this, true) // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received
104
+ instance.isAwaitingPromise = true // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received
105
105
  const preDenyPromise = Promise.resolve().then(() =>
106
106
  asPromise(innerParams.preDeny(value, innerParams.validationMessage))
107
107
  )
@@ -121,7 +121,7 @@ const deny = (instance, value) => {
121
121
  }
122
122
 
123
123
  /**
124
- * @param {SweetAlert2} instance
124
+ * @param {SweetAlert} instance
125
125
  * @param {any} value
126
126
  */
127
127
  const succeedWith = (instance, value) => {
@@ -130,17 +130,16 @@ const succeedWith = (instance, value) => {
130
130
 
131
131
  /**
132
132
  *
133
- * @param {SweetAlert2} instance
133
+ * @param {SweetAlert} instance
134
134
  * @param {string} error
135
135
  */
136
136
  const rejectWith = (instance, error) => {
137
- // @ts-ignore
138
137
  instance.rejectPromise(error)
139
138
  }
140
139
 
141
140
  /**
142
141
  *
143
- * @param {SweetAlert2} instance
142
+ * @param {SweetAlert} instance
144
143
  * @param {any} value
145
144
  */
146
145
  const confirm = (instance, value) => {
@@ -152,7 +151,7 @@ const confirm = (instance, value) => {
152
151
 
153
152
  if (innerParams.preConfirm) {
154
153
  instance.resetValidationMessage()
155
- privateProps.awaitingPromise.set(instance || this, true) // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received
154
+ instance.isAwaitingPromise = true // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received
156
155
  const preConfirmPromise = Promise.resolve().then(() =>
157
156
  asPromise(innerParams.preConfirm(value, innerParams.validationMessage))
158
157
  )
@@ -27,7 +27,7 @@ export function _destroy() {
27
27
  }
28
28
 
29
29
  /**
30
- * @param {SweetAlert2} instance
30
+ * @param {SweetAlert} instance
31
31
  */
32
32
  const disposeSwal = (instance) => {
33
33
  disposeWeakMaps(instance)
@@ -42,23 +42,41 @@ const disposeSwal = (instance) => {
42
42
  }
43
43
 
44
44
  /**
45
- * @param {SweetAlert2} instance
45
+ * @param {SweetAlert} instance
46
46
  */
47
47
  const disposeWeakMaps = (instance) => {
48
48
  // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335
49
- // @ts-ignore
50
- if (instance.isAwaitingPromise()) {
49
+ if (instance.isAwaitingPromise) {
51
50
  unsetWeakMaps(privateProps, instance)
52
- privateProps.awaitingPromise.set(instance, true)
51
+ instance.isAwaitingPromise = true
53
52
  } else {
54
53
  unsetWeakMaps(privateMethods, instance)
55
54
  unsetWeakMaps(privateProps, instance)
55
+
56
+ delete instance.isAwaitingPromise
57
+ // Unset instance methods
58
+ delete instance.disableButtons
59
+ delete instance.enableButtons
60
+ delete instance.getInput
61
+ delete instance.disableInput
62
+ delete instance.enableInput
63
+ delete instance.hideLoading
64
+ delete instance.disableLoading
65
+ delete instance.showValidationMessage
66
+ delete instance.resetValidationMessage
67
+ delete instance.close
68
+ delete instance.closePopup
69
+ delete instance.closeModal
70
+ delete instance.closeToast
71
+ delete instance.rejectPromise
72
+ delete instance.update
73
+ delete instance._destroy
56
74
  }
57
75
  }
58
76
 
59
77
  /**
60
78
  * @param {object} obj
61
- * @param {SweetAlert2} instance
79
+ * @param {SweetAlert} instance
62
80
  */
63
81
  const unsetWeakMaps = (obj, instance) => {
64
82
  for (const i in obj) {
@@ -9,7 +9,7 @@ import { undoIOSfix } from '../utils/iosFix.js'
9
9
  import { undoScrollbar } from '../utils/scrollbarFix.js'
10
10
 
11
11
  /**
12
- * @param {SweetAlert2} instance
12
+ * @param {SweetAlert} instance
13
13
  * @param {HTMLElement} container
14
14
  * @param {boolean} returnFocus
15
15
  * @param {Function} didClose
@@ -64,7 +64,7 @@ export function close(resolveValue) {
64
64
 
65
65
  const didClose = triggerClosePopup(this)
66
66
 
67
- if (this.isAwaitingPromise()) {
67
+ if (this.isAwaitingPromise) {
68
68
  // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335
69
69
  if (!resolveValue.isDismissed) {
70
70
  handleAwaitingPromise(this)
@@ -76,13 +76,6 @@ export function close(resolveValue) {
76
76
  }
77
77
  }
78
78
 
79
- /**
80
- * @returns {boolean}
81
- */
82
- export function isAwaitingPromise() {
83
- return !!privateProps.awaitingPromise.get(this)
84
- }
85
-
86
79
  const triggerClosePopup = (instance) => {
87
80
  const popup = dom.getPopup()
88
81
 
@@ -120,15 +113,13 @@ export function rejectPromise(error) {
120
113
  }
121
114
 
122
115
  /**
123
- * @param {SweetAlert2} instance
116
+ * @param {SweetAlert} instance
124
117
  */
125
118
  export const handleAwaitingPromise = (instance) => {
126
- // @ts-ignore
127
- if (instance.isAwaitingPromise()) {
128
- privateProps.awaitingPromise.delete(instance)
119
+ if (instance.isAwaitingPromise) {
120
+ delete instance.isAwaitingPromise
129
121
  // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335
130
122
  if (!privateProps.innerParams.get(instance)) {
131
- // @ts-ignore
132
123
  instance._destroy()
133
124
  }
134
125
  }
@@ -159,7 +150,7 @@ const prepareResolveValue = (resolveValue) => {
159
150
  }
160
151
 
161
152
  /**
162
- * @param {SweetAlert2} instance
153
+ * @param {SweetAlert} instance
163
154
  * @param {HTMLElement} popup
164
155
  * @param {SweetAlertOptions} innerParams
165
156
  */
@@ -181,7 +172,7 @@ const handlePopupAnimation = (instance, popup, innerParams) => {
181
172
  }
182
173
 
183
174
  /**
184
- * @param {SweetAlert2} instance
175
+ * @param {SweetAlert} instance
185
176
  * @param {HTMLElement} popup
186
177
  * @param {HTMLElement} container
187
178
  * @param {boolean} returnFocus
@@ -204,7 +195,7 @@ const animatePopup = (instance, popup, container, returnFocus, didClose) => {
204
195
  }
205
196
 
206
197
  /**
207
- * @param {SweetAlert2} instance
198
+ * @param {SweetAlert} instance
208
199
  * @param {Function} didClose
209
200
  */
210
201
  const triggerDidCloseAndDispose = (instance, didClose) => {
@@ -213,8 +204,10 @@ const triggerDidCloseAndDispose = (instance, didClose) => {
213
204
  // @ts-ignore
214
205
  didClose.bind(instance.params)()
215
206
  }
216
- // @ts-ignore
217
- instance._destroy()
207
+ // instance might have been destroyed already
208
+ if (instance._destroy) {
209
+ instance._destroy()
210
+ }
218
211
  })
219
212
  }
220
213