sweetalert2
Advanced tools
Comparing version 6.0.0 to 6.0.1
/*! | ||
* sweetalert2 v6.0.0 | ||
* sweetalert2 v6.0.1 | ||
* Released under the MIT License. | ||
@@ -646,4 +646,6 @@ */ | ||
} | ||
} else { | ||
content.innerHTML = params.html || params.text.split('\n').join('<br>'); | ||
} else if (params.html) { | ||
content.innerHTML = params.html; | ||
} else if (params.text) { | ||
content.innerHTML = ('' + params.text).split('\n').join('<br>'); | ||
} | ||
@@ -1685,5 +1687,5 @@ show(content); | ||
sweetAlert.version = '6.0.0'; | ||
sweetAlert.version = '6.0.1'; | ||
module.exports = sweetAlert; | ||
if (window.Sweetalert2) window.sweetAlert = window.swal = window.Sweetalert2; |
/*! | ||
* sweetalert2 v6.0.0 | ||
* sweetalert2 v6.0.1 | ||
* Released under the MIT License. | ||
@@ -650,4 +650,6 @@ */ | ||
} | ||
} else { | ||
content.innerHTML = params.html || params.text.split('\n').join('<br>'); | ||
} else if (params.html) { | ||
content.innerHTML = params.html; | ||
} else if (params.text) { | ||
content.innerHTML = ('' + params.text).split('\n').join('<br>'); | ||
} | ||
@@ -1689,3 +1691,3 @@ show(content); | ||
sweetAlert.version = '6.0.0'; | ||
sweetAlert.version = '6.0.1'; | ||
@@ -1692,0 +1694,0 @@ return sweetAlert; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Sweetalert2=t()}(this,function(){"use strict";var e="swal2-",t=function(t){var n={};for(var o in t)n[t[o]]=e+t[o];return n},n=t(["container","in","iosfix","modal","overlay","fade","show","hide","noanimation","close","content","spacer","confirm","cancel","icon","image","input","file","range","select","radio","checkbox","textarea","inputerror","validationerror","progresssteps","activeprogressstep","progresscircle","progressline","loading","styled"]),o=t(["success","warning","info","question","error"]),r={title:"",text:"",html:"",type:null,customClass:"",animation:!0,allowOutsideClick:!0,allowEscapeKey:!0,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonColor:"#3085d6",confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonColor:"#aaa",cancelButtonClass:null,buttonsStyling:!0,reverseButtons:!1,focusCancel:!1,showCloseButton:!1,showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageClass:null,timer:null,width:500,padding:20,background:"#fff",input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,progressSteps:[],currentProgressStep:null,progressStepsDistance:"40px",onOpen:null,onClose:null},i=('\n <div class="'+n.modal+'" style="display: none" tabIndex="-1">\n <ul class="'+n.progresssteps+'"></ul>\n <div class="'+n.icon+" "+o.error+'">\n <span class="x-mark"><span class="line left"></span><span class="line right"></span></span>\n </div>\n <div class="'+n.icon+" "+o.question+'">?</div>\n <div class="'+n.icon+" "+o.warning+'">!</div>\n <div class="'+n.icon+" "+o.info+'">i</div>\n <div class="'+n.icon+" "+o.success+'">\n <span class="line tip"></span> <span class="line long"></span>\n <div class="placeholder"></div> <div class="fix"></div>\n </div>\n <img class="'+n.image+'">\n <h2></h2>\n <div class="'+n.content+'"></div>\n <input class="'+n.input+'">\n <input type="file" class="'+n.file+'">\n <div class="'+n.range+'">\n <output></output>\n <input type="range">\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 </label>\n <textarea class="'+n.textarea+'"></textarea>\n <div class="'+n.validationerror+'"></div>\n <hr class="'+n.spacer+'">\n <button type="button" class="'+n.confirm+'">OK</button>\n <button type="button" class="'+n.cancel+'">Cancel</button>\n <span class="'+n.close+'">×</span>\n </div>\n').replace(/(^|\n)\s*/g,""),a=void 0,l=document.getElementsByClassName(n.container);l.length?a=l[0]:(a=document.createElement("div"),a.className=n.container,a.innerHTML=i);var s=function(e,t){e=String(e).replace(/[^0-9a-f]/gi,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;for(var n="#",o=0;o<3;o++){var r=parseInt(e.substr(2*o,2),16);r=Math.round(Math.min(Math.max(0,r+r*t),255)).toString(16),n+=("00"+r).substr(r.length)}return n},c={previousWindowKeyDown:null,previousActiveElement:null,previousBodyPadding:null},u=function(){if("undefined"==typeof document)return void console.error("SweetAlert2 requires document to initialize");if(!document.getElementsByClassName(n.container).length){document.body.appendChild(a);var e=p(),t=A(e,n.input),o=A(e,n.file),r=e.querySelector("."+n.range+" input"),i=e.querySelector("."+n.range+" output"),l=A(e,n.select),s=e.querySelector("."+n.checkbox+" input"),c=A(e,n.textarea);return t.oninput=function(){J.resetValidationError()},t.onkeydown=function(e){setTimeout(function(){13===e.keyCode&&(e.stopPropagation(),J.clickConfirm())},0)},o.onchange=function(){J.resetValidationError()},r.oninput=function(){J.resetValidationError(),i.value=r.value},r.onchange=function(){J.resetValidationError(),r.previousSibling.value=r.value},l.onchange=function(){J.resetValidationError()},s.onchange=function(){J.resetValidationError()},c.oninput=function(){J.resetValidationError()},e}},d=function(e){return a.querySelector("."+e)},p=function(){return document.body.querySelector("."+n.modal)||u()},f=function(){var e=p();return e.querySelectorAll("."+n.icon)},m=function(){return d(n.image)},v=function(){return d(n.spacer)},h=function(){return d(n.progresssteps)},y=function(){return d(n.validationerror)},g=function(){return d(n.confirm)},b=function(){return d(n.cancel)},w=function(){return d(n.close)},C=function(t){var n=[g(),b()];return t&&n.reverse(),n.concat(Array.prototype.slice.call(p().querySelectorAll("button:not([class^="+e+"]), input:not([type=hidden]), textarea, select")))},k=function(e,t){return!!e.classList&&e.classList.contains(t)},S=function(e){if(e.focus(),"file"!==e.type){var t=e.value;e.value="",e.value=t}},x=function(e,t){if(e&&t){var n=t.split(/\s+/).filter(Boolean);n.forEach(function(t){e.classList.add(t)})}},E=function(e,t){if(e&&t){var n=t.split(/\s+/).filter(Boolean);n.forEach(function(t){e.classList.remove(t)})}},A=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(k(e.childNodes[n],t))return e.childNodes[n]},B=function(e,t){t||(t="block"),e.style.opacity="",e.style.display=t},P=function(e){e.style.opacity="",e.style.display="none"},q=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},L=function(e){return e.offsetWidth||e.offsetHeight||e.getClientRects().length},M=function(e,t){e.style.removeProperty?e.style.removeProperty(t):e.style.removeAttribute(t)},T=function(e){if("function"==typeof MouseEvent){var t=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0});e.dispatchEvent(t)}else if(document.createEvent){var n=document.createEvent("MouseEvents");n.initEvent("click",!1,!1),e.dispatchEvent(n)}else document.createEventObject?e.fireEvent("onclick"):"function"==typeof e.onclick&&e.onclick()},V=function(){var e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",msAnimation:"MSAnimationEnd",animation:"animationend"};for(var n in t)if(t.hasOwnProperty(n)&&void 0!==e.style[n])return t[n];return!1}(),H=function(){var e=p();window.onkeydown=c.previousWindowKeyDown,c.previousActiveElement&&c.previousActiveElement.focus&&c.previousActiveElement.focus(),clearTimeout(e.timeout)},O=function(){var e=document.createElement("div");e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e);var t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t},N=function(e,t){var n=void 0;return function(){var o=function(){n=null,e()};clearTimeout(n),n=setTimeout(o,t)}},j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I=(function(){function e(e){this.value=e}function t(t){function n(e,t){return new Promise(function(n,r){var l={key:e,arg:t,resolve:n,reject:r,next:null};a?a=a.next=l:(i=a=l,o(e,t))})}function o(n,i){try{var a=t[n](i),l=a.value;l instanceof e?Promise.resolve(l.value).then(function(e){o("next",e)},function(e){o("throw",e)}):r(a.done?"return":"normal",a.value)}catch(e){r("throw",e)}}function r(e,t){switch(e){case"return":i.resolve({value:t,done:!0});break;case"throw":i.reject(t);break;default:i.resolve({value:t,done:!1})}i=i.next,i?o(i.key,i.arg):a=null}var i,a;this._invoke=n,"function"!=typeof t.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)},{wrap:function(e){return function(){return new t(e.apply(this,arguments))}},await:function(t){return new e(t)}}}(),Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}),D=I({},r),W=[],U=void 0,K=function(e){var t=p();for(var i in e)r.hasOwnProperty(i)||"extraParams"===i||console.warn('SweetAlert2: Unknown parameter "'+i+'"');t.style.width="number"==typeof e.width?e.width+"px":e.width,t.style.padding=e.padding+"px",t.style.background=e.background;var a=t.querySelector("h2"),l=t.querySelector("."+n.content),s=g(),c=b(),u=t.querySelector("."+n.close);if(a.innerHTML=e.title.split("\n").join("<br>"),e.text||e.html){if("object"===j(e.html))if(l.innerHTML="",0 in e.html)for(var d=0;d in e.html;d++)l.appendChild(e.html[d].cloneNode(!0));else l.appendChild(e.html.cloneNode(!0));else l.innerHTML=e.html||e.text.split("\n").join("<br>");B(l)}else P(l);e.showCloseButton?B(u):P(u),t.className=n.modal,e.customClass&&x(t,e.customClass);var y=h(),w=parseInt(null===e.currentProgressStep?J.getQueueStep():e.currentProgressStep,10);e.progressSteps.length?(B(y),q(y),w>=e.progressSteps.length&&console.warn("SweetAlert2: Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),e.progressSteps.forEach(function(t,o){var r=document.createElement("li");if(x(r,n.progresscircle),r.innerHTML=t,o===w&&x(r,n.activeprogressstep),y.appendChild(r),o!==e.progressSteps.length-1){var i=document.createElement("li");x(i,n.progressline),i.style.width=e.progressStepsDistance,y.appendChild(i)}})):P(y);for(var C=f(),k=0;k<C.length;k++)P(C[k]);if(e.type){var S=!1;for(var A in o)if(e.type===A){S=!0;break}if(!S)return console.error("SweetAlert2: Unknown alert type: "+e.type),!1;var L=t.querySelector("."+n.icon+"."+o[e.type]);switch(B(L),e.type){case"success":x(L,"animate"),x(L.querySelector(".tip"),"animate-success-tip"),x(L.querySelector(".long"),"animate-success-long");break;case"error":x(L,"animate-error-icon"),x(L.querySelector(".x-mark"),"animate-x-mark");break;case"warning":x(L,"pulse-warning")}}var T=m();e.imageUrl?(T.setAttribute("src",e.imageUrl),B(T),e.imageWidth?T.setAttribute("width",e.imageWidth):T.removeAttribute("width"),e.imageHeight?T.setAttribute("height",e.imageHeight):T.removeAttribute("height"),T.className=n.image,e.imageClass&&x(T,e.imageClass)):P(T),e.showCancelButton?c.style.display="inline-block":P(c),e.showConfirmButton?M(s,"display"):P(s);var V=v();e.showConfirmButton||e.showCancelButton?B(V):P(V),s.innerHTML=e.confirmButtonText,c.innerHTML=e.cancelButtonText,e.buttonsStyling&&(s.style.backgroundColor=e.confirmButtonColor,c.style.backgroundColor=e.cancelButtonColor),s.className=n.confirm,x(s,e.confirmButtonClass),c.className=n.cancel,x(c,e.cancelButtonClass),e.buttonsStyling?(x(s,n.styled),x(c,n.styled)):(E(s,n.styled),E(c,n.styled),s.style.backgroundColor=s.style.borderLeftColor=s.style.borderRightColor="",c.style.backgroundColor=c.style.borderLeftColor=c.style.borderRightColor=""),e.animation===!0?E(t,n.noanimation):x(t,n.noanimation)},R=function(e,t){var o=p();e?(x(o,n.show),x(a,n.fade),E(o,n.hide)):E(o,n.fade),B(o),a.style.overflowY="hidden",V&&!k(o,n.noanimation)?o.addEventListener(V,function e(){o.removeEventListener(V,e),a.style.overflowY="auto"}):a.style.overflowY="auto",x(a,n.in),x(document.body,n.in),_(),Q(),c.previousActiveElement=document.activeElement,null!==t&&"function"==typeof t&&t(void 0,o)},_=function(){null===c.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(c.previousBodyPadding=document.body.style.paddingRight,document.body.style.paddingRight=O()+"px")},z=function(){null!==c.previousBodyPadding&&(document.body.style.paddingRight=c.previousBodyPadding,c.previousBodyPadding=null)},Q=function(){var e=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;if(e&&!k(document.body,n.iosfix)){var t=document.body.scrollTop;document.body.style.top=t*-1+"px",x(document.body,n.iosfix)}},Y=function(){if(k(document.body,n.iosfix)){var e=parseInt(document.body.style.top,10);E(document.body,n.iosfix),document.body.scrollTop=e*-1}},Z=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];if(void 0===t[0])return console.error("SweetAlert2 expects at least 1 attribute!"),!1;var r=I({},D);switch(j(t[0])){case"string":r.title=t[0],r.text=t[1],r.type=t[2];break;case"object":I(r,t[0]),r.extraParams=t[0].extraParams,"email"===r.input&&null===r.inputValidator&&(r.inputValidator=function(e){return new Promise(function(t,n){var o=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;o.test(e)?t():n("Invalid email address")})});break;default:return console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got '+j(t[0])),!1}K(r);var i=p();return new Promise(function(e,t){r.timer&&(i.timeout=setTimeout(function(){J.closeModal(r.onClose),t("timer")},r.timer));var o=function(e){switch(e=e||r.input){case"select":case"textarea":case"file":return A(i,n[e]);case"checkbox":return i.querySelector("."+n.checkbox+" input");case"radio":return i.querySelector("."+n.radio+" input:checked")||i.querySelector("."+n.radio+" input:first-child");case"range":return i.querySelector("."+n.range+" input");default:return A(i,n.input)}},l=function(){var e=o();if(!e)return null;switch(r.input){case"checkbox":return e.checked?1:0;case"radio":return e.checked?e.value:null;case"file":return e.files.length?e.files[0]:null;default:return r.inputAutoTrim?e.value.trim():e.value}};r.input&&setTimeout(function(){var e=o();e&&S(e)},0);for(var u=function(t){r.showLoaderOnConfirm&&J.showLoading(),r.preConfirm?r.preConfirm(t,r.extraParams).then(function(n){J.closeModal(r.onClose),e(n||t)},function(e){J.hideLoading(),e&&J.showValidationError(e)}):(J.closeModal(r.onClose),e(t))},d=function(e){var n=e||window.event,o=n.target||n.srcElement,i=g(),a=b(),c=i===o||i.contains(o),d=a===o||a.contains(o);switch(n.type){case"mouseover":case"mouseup":r.buttonsStyling&&(c?i.style.backgroundColor=s(r.confirmButtonColor,-.1):d&&(a.style.backgroundColor=s(r.cancelButtonColor,-.1)));break;case"mouseout":r.buttonsStyling&&(c?i.style.backgroundColor=r.confirmButtonColor:d&&(a.style.backgroundColor=r.cancelButtonColor));break;case"mousedown":r.buttonsStyling&&(c?i.style.backgroundColor=s(r.confirmButtonColor,-.2):d&&(a.style.backgroundColor=s(r.cancelButtonColor,-.2)));break;case"click":c&&J.isVisible()?r.input?!function(){var e=l();r.inputValidator?(J.disableInput(),r.inputValidator(e,r.extraParams).then(function(){J.enableInput(),u(e)},function(e){J.enableInput(),e&&J.showValidationError(e)})):u(e)}():u(!0):d&&J.isVisible()&&(J.closeModal(r.onClose),t("cancel"))}},f=i.querySelectorAll("button"),m=0;m<f.length;m++)f[m].onclick=d,f[m].onmouseover=d,f[m].onmouseout=d,f[m].onmousedown=d;w().onclick=function(){J.closeModal(r.onClose),t("close")},a.onclick=function(e){e.target===a&&r.allowOutsideClick&&(J.closeModal(r.onClose),t("overlay"))};var k=g(),q=b();r.reverseButtons?k.parentNode.insertBefore(q,k):k.parentNode.insertBefore(k,q);var M=function(e,t){for(var n=C(r.focusCancel),o=0;o<n.length;o++){e+=t,e===n.length?e=0:e===-1&&(e=n.length-1);var i=n[e];if(L(i))return i.focus()}},V=function(e){var n=e||window.event,o=n.keyCode||n.which;if([9,13,32,27].indexOf(o)!==-1){for(var i=n.target||n.srcElement,a=C(r.focusCancel),l=-1,s=0;s<a.length;s++)if(i===a[s]){l=s;break}9===o?(n.shiftKey?M(l,-1):M(l,1),n.stopPropagation(),n.preventDefault()):13===o||32===o?l===-1&&(r.focusCancel?T(q,n):T(k,n)):27===o&&r.allowEscapeKey===!0&&(J.closeModal(r.onClose),t("esc"))}};c.previousWindowKeyDown=window.onkeydown,window.onkeydown=V,r.buttonsStyling&&(k.style.borderLeftColor=r.confirmButtonColor,k.style.borderRightColor=r.confirmButtonColor),J.showLoading=J.enableLoading=function(){B(v()),B(k,"inline-block"),x(k,n.loading),x(i,n.loading),k.disabled=!0,q.disabled=!0},J.hideLoading=J.disableLoading=function(){r.showConfirmButton||(P(k),r.showCancelButton||P(v())),E(k,n.loading),E(i,n.loading),k.disabled=!1,q.disabled=!1},J.enableButtons=function(){k.disabled=!1,q.disabled=!1},J.disableButtons=function(){k.disabled=!0,q.disabled=!0},J.enableConfirmButton=function(){k.disabled=!1},J.disableConfirmButton=function(){k.disabled=!0},J.enableInput=function(){var e=o();if(!e)return!1;if("radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),r=0;r<n.length;r++)n[r].disabled=!1;else e.disabled=!1},J.disableInput=function(){var e=o();if(!e)return!1;if(e&&"radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),r=0;r<n.length;r++)n[r].disabled=!0;else e.disabled=!0},J.recalculateHeight=N(function(){var e=p(),t=e.style.display;e.style.minHeight="",B(e),e.style.minHeight=e.scrollHeight+1+"px",e.style.display=t},50),J.showValidationError=function(e){var t=y();t.innerHTML=e,B(t);var r=o();S(r),x(r,n.inputerror)},J.resetValidationError=function(){var e=y();P(e),J.recalculateHeight();var t=o();t&&E(t,n.inputerror)},J.getProgressSteps=function(){return r.progressSteps},J.setProgressSteps=function(e){r.progressSteps=e,K(r)},J.showProgressSteps=function(){B(h())},J.hideProgressSteps=function(){P(h())},J.enableButtons(),J.hideLoading(),J.resetValidationError();for(var H=["input","file","range","select","radio","checkbox","textarea"],O=void 0,I=0;I<H.length;I++){var D=n[H[I]],W=A(i,D);if(O=o(H[I])){for(var _ in O.attributes)if(O.attributes.hasOwnProperty(_)){var z=O.attributes[_].name;"type"!==z&&"value"!==z&&O.removeAttribute(z)}for(var Q in r.inputAttributes)O.setAttribute(Q,r.inputAttributes[Q])}W.className=D,r.inputClass&&x(W,r.inputClass),P(W)}var Y=void 0;!function(){switch(r.input){case"text":case"email":case"password":case"number":case"tel":O=A(i,n.input),O.value=r.inputValue,O.placeholder=r.inputPlaceholder,O.type=r.input,B(O);break;case"file":O=A(i,n.file),O.placeholder=r.inputPlaceholder,O.type=r.input,B(O);break;case"range":var e=A(i,n.range),t=e.querySelector("input"),a=e.querySelector("output");t.value=r.inputValue,t.type=r.input,a.value=r.inputValue,B(e);break;case"select":var l=A(i,n.select);if(l.innerHTML="",r.inputPlaceholder){var s=document.createElement("option");s.innerHTML=r.inputPlaceholder,s.value="",s.disabled=!0,s.selected=!0,l.appendChild(s)}Y=function(e){for(var t in e){var n=document.createElement("option");n.value=t,n.innerHTML=e[t],r.inputValue===t&&(n.selected=!0),l.appendChild(n)}B(l),l.focus()};break;case"radio":var c=A(i,n.radio);c.innerHTML="",Y=function(e){for(var t in e){var o=1,i=document.createElement("input"),a=document.createElement("label"),l=document.createElement("span");i.type="radio",i.name=n.radio,i.value=t,i.id=n.radio+"-"+o++,r.inputValue===t&&(i.checked=!0),l.innerHTML=e[t],a.appendChild(i),a.appendChild(l),a.for=i.id,c.appendChild(a)}B(c);var s=c.querySelectorAll("input");s.length&&s[0].focus()};break;case"checkbox":var u=A(i,n.checkbox),d=o("checkbox");d.type="checkbox",d.value=1,d.id=n.checkbox,d.checked=Boolean(r.inputValue);var p=u.getElementsByTagName("span");p.length&&u.removeChild(p[0]),p=document.createElement("span"),p.innerHTML=r.inputPlaceholder,u.appendChild(p),B(u);break;case"textarea":var f=A(i,n.textarea);f.value=r.inputValue,f.placeholder=r.inputPlaceholder,B(f);break;case null:break;default:console.error('SweetAlert2: Unexpected type of input! Expected "text", "email", "password", "select", "checkbox", "textarea" or "file", got "'+r.input+'"')}}(),"select"!==r.input&&"radio"!==r.input||(r.inputOptions instanceof Promise?(J.showLoading(),r.inputOptions.then(function(e){J.hideLoading(),Y(e)})):"object"===j(r.inputOptions)?Y(r.inputOptions):console.error("SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got "+j(r.inputOptions))),R(r.animation,r.onOpen),M(-1,1),a.scrollTop=0,"undefined"==typeof MutationObserver||U||(U=new MutationObserver(J.recalculateHeight),U.observe(i,{childList:!0,characterData:!0,subtree:!0}))})},J=function e(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];return e.isVisible()&&e.close(),Z.apply(void 0,n)};return J.isVisible=function(){var e=p();return L(e)},J.queue=function(e){W=e;var t=p(),n=function(){W=[],t.removeAttribute("data-queue-step")},o=[];return new Promise(function(e,r){!function i(a,l){a<W.length?(t.setAttribute("data-queue-step",a),J(W[a]).then(function(e){o.push(e),i(a+1,l)},function(e){n(),r(e)})):(n(),e(o))}(0)})},J.getQueueStep=function(){return p().getAttribute("data-queue-step")},J.insertQueueStep=function(e,t){return t&&t<W.length?W.splice(t,0,e):W.push(e)},J.deleteQueueStep=function(e){"undefined"!=typeof W[e]&&W.splice(e,1)},J.close=J.closeModal=function(e){var t=p();E(t,n.show),x(t,n.hide);var r=t.querySelector("."+n.icon+"."+o.success);E(r,"animate"),E(r.querySelector(".tip"),"animate-success-tip"),E(r.querySelector(".long"),"animate-success-long");var i=t.querySelector("."+n.icon+"."+o.error);E(i,"animate-error-icon"),E(i.querySelector(".x-mark"),"animate-x-mark");var l=t.querySelector("."+n.icon+"."+o.warning);E(l,"pulse-warning"),H();var s=function(){P(t),t.style.minHeight="",E(a,n.in),E(document.body,n.in),z(),Y()};V&&!k(t,n.noanimation)?t.addEventListener(V,function e(){t.removeEventListener(V,e),k(t,n.hide)&&s()}):s(),null!==e&&"function"==typeof e&&e(void 0,t)},J.clickConfirm=function(){return g().click()},J.clickCancel=function(){return b().click()},J.setDefaults=function(e){if(!e||"object"!==("undefined"==typeof e?"undefined":j(e)))return console.error("SweetAlert2: the argument for setDefaults() is required and has to be a object");for(var t in e)r.hasOwnProperty(t)||"extraParams"===t||(console.warn('SweetAlert2: Unknown parameter "'+t+'"'),delete e[t]);I(D,e)},J.resetDefaults=function(){D=I({},r)},J.noop=function(){},J.version="6.0.0",J}),window.Sweetalert2&&(window.sweetAlert=window.swal=window.Sweetalert2); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Sweetalert2=t()}(this,function(){"use strict";var e="swal2-",t=function(t){var n={};for(var o in t)n[t[o]]=e+t[o];return n},n=t(["container","in","iosfix","modal","overlay","fade","show","hide","noanimation","close","content","spacer","confirm","cancel","icon","image","input","file","range","select","radio","checkbox","textarea","inputerror","validationerror","progresssteps","activeprogressstep","progresscircle","progressline","loading","styled"]),o=t(["success","warning","info","question","error"]),r={title:"",text:"",html:"",type:null,customClass:"",animation:!0,allowOutsideClick:!0,allowEscapeKey:!0,showConfirmButton:!0,showCancelButton:!1,preConfirm:null,confirmButtonText:"OK",confirmButtonColor:"#3085d6",confirmButtonClass:null,cancelButtonText:"Cancel",cancelButtonColor:"#aaa",cancelButtonClass:null,buttonsStyling:!0,reverseButtons:!1,focusCancel:!1,showCloseButton:!1,showLoaderOnConfirm:!1,imageUrl:null,imageWidth:null,imageHeight:null,imageClass:null,timer:null,width:500,padding:20,background:"#fff",input:null,inputPlaceholder:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputClass:null,inputAttributes:{},inputValidator:null,progressSteps:[],currentProgressStep:null,progressStepsDistance:"40px",onOpen:null,onClose:null},i=('\n <div class="'+n.modal+'" style="display: none" tabIndex="-1">\n <ul class="'+n.progresssteps+'"></ul>\n <div class="'+n.icon+" "+o.error+'">\n <span class="x-mark"><span class="line left"></span><span class="line right"></span></span>\n </div>\n <div class="'+n.icon+" "+o.question+'">?</div>\n <div class="'+n.icon+" "+o.warning+'">!</div>\n <div class="'+n.icon+" "+o.info+'">i</div>\n <div class="'+n.icon+" "+o.success+'">\n <span class="line tip"></span> <span class="line long"></span>\n <div class="placeholder"></div> <div class="fix"></div>\n </div>\n <img class="'+n.image+'">\n <h2></h2>\n <div class="'+n.content+'"></div>\n <input class="'+n.input+'">\n <input type="file" class="'+n.file+'">\n <div class="'+n.range+'">\n <output></output>\n <input type="range">\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 </label>\n <textarea class="'+n.textarea+'"></textarea>\n <div class="'+n.validationerror+'"></div>\n <hr class="'+n.spacer+'">\n <button type="button" class="'+n.confirm+'">OK</button>\n <button type="button" class="'+n.cancel+'">Cancel</button>\n <span class="'+n.close+'">×</span>\n </div>\n').replace(/(^|\n)\s*/g,""),a=void 0,l=document.getElementsByClassName(n.container);l.length?a=l[0]:(a=document.createElement("div"),a.className=n.container,a.innerHTML=i);var s=function(e,t){e=String(e).replace(/[^0-9a-f]/gi,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;for(var n="#",o=0;o<3;o++){var r=parseInt(e.substr(2*o,2),16);r=Math.round(Math.min(Math.max(0,r+r*t),255)).toString(16),n+=("00"+r).substr(r.length)}return n},c={previousWindowKeyDown:null,previousActiveElement:null,previousBodyPadding:null},u=function(){if("undefined"==typeof document)return void console.error("SweetAlert2 requires document to initialize");if(!document.getElementsByClassName(n.container).length){document.body.appendChild(a);var e=p(),t=A(e,n.input),o=A(e,n.file),r=e.querySelector("."+n.range+" input"),i=e.querySelector("."+n.range+" output"),l=A(e,n.select),s=e.querySelector("."+n.checkbox+" input"),c=A(e,n.textarea);return t.oninput=function(){J.resetValidationError()},t.onkeydown=function(e){setTimeout(function(){13===e.keyCode&&(e.stopPropagation(),J.clickConfirm())},0)},o.onchange=function(){J.resetValidationError()},r.oninput=function(){J.resetValidationError(),i.value=r.value},r.onchange=function(){J.resetValidationError(),r.previousSibling.value=r.value},l.onchange=function(){J.resetValidationError()},s.onchange=function(){J.resetValidationError()},c.oninput=function(){J.resetValidationError()},e}},d=function(e){return a.querySelector("."+e)},p=function(){return document.body.querySelector("."+n.modal)||u()},f=function(){var e=p();return e.querySelectorAll("."+n.icon)},m=function(){return d(n.image)},v=function(){return d(n.spacer)},h=function(){return d(n.progresssteps)},y=function(){return d(n.validationerror)},g=function(){return d(n.confirm)},b=function(){return d(n.cancel)},w=function(){return d(n.close)},C=function(t){var n=[g(),b()];return t&&n.reverse(),n.concat(Array.prototype.slice.call(p().querySelectorAll("button:not([class^="+e+"]), input:not([type=hidden]), textarea, select")))},k=function(e,t){return!!e.classList&&e.classList.contains(t)},S=function(e){if(e.focus(),"file"!==e.type){var t=e.value;e.value="",e.value=t}},x=function(e,t){if(e&&t){var n=t.split(/\s+/).filter(Boolean);n.forEach(function(t){e.classList.add(t)})}},E=function(e,t){if(e&&t){var n=t.split(/\s+/).filter(Boolean);n.forEach(function(t){e.classList.remove(t)})}},A=function(e,t){for(var n=0;n<e.childNodes.length;n++)if(k(e.childNodes[n],t))return e.childNodes[n]},B=function(e,t){t||(t="block"),e.style.opacity="",e.style.display=t},P=function(e){e.style.opacity="",e.style.display="none"},q=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)},L=function(e){return e.offsetWidth||e.offsetHeight||e.getClientRects().length},M=function(e,t){e.style.removeProperty?e.style.removeProperty(t):e.style.removeAttribute(t)},T=function(e){if("function"==typeof MouseEvent){var t=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0});e.dispatchEvent(t)}else if(document.createEvent){var n=document.createEvent("MouseEvents");n.initEvent("click",!1,!1),e.dispatchEvent(n)}else document.createEventObject?e.fireEvent("onclick"):"function"==typeof e.onclick&&e.onclick()},V=function(){var e=document.createElement("div"),t={WebkitAnimation:"webkitAnimationEnd",OAnimation:"oAnimationEnd oanimationend",msAnimation:"MSAnimationEnd",animation:"animationend"};for(var n in t)if(t.hasOwnProperty(n)&&void 0!==e.style[n])return t[n];return!1}(),H=function(){var e=p();window.onkeydown=c.previousWindowKeyDown,c.previousActiveElement&&c.previousActiveElement.focus&&c.previousActiveElement.focus(),clearTimeout(e.timeout)},O=function(){var e=document.createElement("div");e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e);var t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t},N=function(e,t){var n=void 0;return function(){var o=function(){n=null,e()};clearTimeout(n),n=setTimeout(o,t)}},j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I=(function(){function e(e){this.value=e}function t(t){function n(e,t){return new Promise(function(n,r){var l={key:e,arg:t,resolve:n,reject:r,next:null};a?a=a.next=l:(i=a=l,o(e,t))})}function o(n,i){try{var a=t[n](i),l=a.value;l instanceof e?Promise.resolve(l.value).then(function(e){o("next",e)},function(e){o("throw",e)}):r(a.done?"return":"normal",a.value)}catch(e){r("throw",e)}}function r(e,t){switch(e){case"return":i.resolve({value:t,done:!0});break;case"throw":i.reject(t);break;default:i.resolve({value:t,done:!1})}i=i.next,i?o(i.key,i.arg):a=null}var i,a;this._invoke=n,"function"!=typeof t.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)},{wrap:function(e){return function(){return new t(e.apply(this,arguments))}},await:function(t){return new e(t)}}}(),Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}),D=I({},r),W=[],U=void 0,K=function(e){var t=p();for(var i in e)r.hasOwnProperty(i)||"extraParams"===i||console.warn('SweetAlert2: Unknown parameter "'+i+'"');t.style.width="number"==typeof e.width?e.width+"px":e.width,t.style.padding=e.padding+"px",t.style.background=e.background;var a=t.querySelector("h2"),l=t.querySelector("."+n.content),s=g(),c=b(),u=t.querySelector("."+n.close);if(a.innerHTML=e.title.split("\n").join("<br>"),e.text||e.html){if("object"===j(e.html))if(l.innerHTML="",0 in e.html)for(var d=0;d in e.html;d++)l.appendChild(e.html[d].cloneNode(!0));else l.appendChild(e.html.cloneNode(!0));else e.html?l.innerHTML=e.html:e.text&&(l.innerHTML=(""+e.text).split("\n").join("<br>"));B(l)}else P(l);e.showCloseButton?B(u):P(u),t.className=n.modal,e.customClass&&x(t,e.customClass);var y=h(),w=parseInt(null===e.currentProgressStep?J.getQueueStep():e.currentProgressStep,10);e.progressSteps.length?(B(y),q(y),w>=e.progressSteps.length&&console.warn("SweetAlert2: Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),e.progressSteps.forEach(function(t,o){var r=document.createElement("li");if(x(r,n.progresscircle),r.innerHTML=t,o===w&&x(r,n.activeprogressstep),y.appendChild(r),o!==e.progressSteps.length-1){var i=document.createElement("li");x(i,n.progressline),i.style.width=e.progressStepsDistance,y.appendChild(i)}})):P(y);for(var C=f(),k=0;k<C.length;k++)P(C[k]);if(e.type){var S=!1;for(var A in o)if(e.type===A){S=!0;break}if(!S)return console.error("SweetAlert2: Unknown alert type: "+e.type),!1;var L=t.querySelector("."+n.icon+"."+o[e.type]);switch(B(L),e.type){case"success":x(L,"animate"),x(L.querySelector(".tip"),"animate-success-tip"),x(L.querySelector(".long"),"animate-success-long");break;case"error":x(L,"animate-error-icon"),x(L.querySelector(".x-mark"),"animate-x-mark");break;case"warning":x(L,"pulse-warning")}}var T=m();e.imageUrl?(T.setAttribute("src",e.imageUrl),B(T),e.imageWidth?T.setAttribute("width",e.imageWidth):T.removeAttribute("width"),e.imageHeight?T.setAttribute("height",e.imageHeight):T.removeAttribute("height"),T.className=n.image,e.imageClass&&x(T,e.imageClass)):P(T),e.showCancelButton?c.style.display="inline-block":P(c),e.showConfirmButton?M(s,"display"):P(s);var V=v();e.showConfirmButton||e.showCancelButton?B(V):P(V),s.innerHTML=e.confirmButtonText,c.innerHTML=e.cancelButtonText,e.buttonsStyling&&(s.style.backgroundColor=e.confirmButtonColor,c.style.backgroundColor=e.cancelButtonColor),s.className=n.confirm,x(s,e.confirmButtonClass),c.className=n.cancel,x(c,e.cancelButtonClass),e.buttonsStyling?(x(s,n.styled),x(c,n.styled)):(E(s,n.styled),E(c,n.styled),s.style.backgroundColor=s.style.borderLeftColor=s.style.borderRightColor="",c.style.backgroundColor=c.style.borderLeftColor=c.style.borderRightColor=""),e.animation===!0?E(t,n.noanimation):x(t,n.noanimation)},R=function(e,t){var o=p();e?(x(o,n.show),x(a,n.fade),E(o,n.hide)):E(o,n.fade),B(o),a.style.overflowY="hidden",V&&!k(o,n.noanimation)?o.addEventListener(V,function e(){o.removeEventListener(V,e),a.style.overflowY="auto"}):a.style.overflowY="auto",x(a,n.in),x(document.body,n.in),_(),Q(),c.previousActiveElement=document.activeElement,null!==t&&"function"==typeof t&&t(void 0,o)},_=function(){null===c.previousBodyPadding&&document.body.scrollHeight>window.innerHeight&&(c.previousBodyPadding=document.body.style.paddingRight,document.body.style.paddingRight=O()+"px")},z=function(){null!==c.previousBodyPadding&&(document.body.style.paddingRight=c.previousBodyPadding,c.previousBodyPadding=null)},Q=function(){var e=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;if(e&&!k(document.body,n.iosfix)){var t=document.body.scrollTop;document.body.style.top=t*-1+"px",x(document.body,n.iosfix)}},Y=function(){if(k(document.body,n.iosfix)){var e=parseInt(document.body.style.top,10);E(document.body,n.iosfix),document.body.scrollTop=e*-1}},Z=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];if(void 0===t[0])return console.error("SweetAlert2 expects at least 1 attribute!"),!1;var r=I({},D);switch(j(t[0])){case"string":r.title=t[0],r.text=t[1],r.type=t[2];break;case"object":I(r,t[0]),r.extraParams=t[0].extraParams,"email"===r.input&&null===r.inputValidator&&(r.inputValidator=function(e){return new Promise(function(t,n){var o=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;o.test(e)?t():n("Invalid email address")})});break;default:return console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got '+j(t[0])),!1}K(r);var i=p();return new Promise(function(e,t){r.timer&&(i.timeout=setTimeout(function(){J.closeModal(r.onClose),t("timer")},r.timer));var o=function(e){switch(e=e||r.input){case"select":case"textarea":case"file":return A(i,n[e]);case"checkbox":return i.querySelector("."+n.checkbox+" input");case"radio":return i.querySelector("."+n.radio+" input:checked")||i.querySelector("."+n.radio+" input:first-child");case"range":return i.querySelector("."+n.range+" input");default:return A(i,n.input)}},l=function(){var e=o();if(!e)return null;switch(r.input){case"checkbox":return e.checked?1:0;case"radio":return e.checked?e.value:null;case"file":return e.files.length?e.files[0]:null;default:return r.inputAutoTrim?e.value.trim():e.value}};r.input&&setTimeout(function(){var e=o();e&&S(e)},0);for(var u=function(t){r.showLoaderOnConfirm&&J.showLoading(),r.preConfirm?r.preConfirm(t,r.extraParams).then(function(n){J.closeModal(r.onClose),e(n||t)},function(e){J.hideLoading(),e&&J.showValidationError(e)}):(J.closeModal(r.onClose),e(t))},d=function(e){var n=e||window.event,o=n.target||n.srcElement,i=g(),a=b(),c=i===o||i.contains(o),d=a===o||a.contains(o);switch(n.type){case"mouseover":case"mouseup":r.buttonsStyling&&(c?i.style.backgroundColor=s(r.confirmButtonColor,-.1):d&&(a.style.backgroundColor=s(r.cancelButtonColor,-.1)));break;case"mouseout":r.buttonsStyling&&(c?i.style.backgroundColor=r.confirmButtonColor:d&&(a.style.backgroundColor=r.cancelButtonColor));break;case"mousedown":r.buttonsStyling&&(c?i.style.backgroundColor=s(r.confirmButtonColor,-.2):d&&(a.style.backgroundColor=s(r.cancelButtonColor,-.2)));break;case"click":c&&J.isVisible()?r.input?!function(){var e=l();r.inputValidator?(J.disableInput(),r.inputValidator(e,r.extraParams).then(function(){J.enableInput(),u(e)},function(e){J.enableInput(),e&&J.showValidationError(e)})):u(e)}():u(!0):d&&J.isVisible()&&(J.closeModal(r.onClose),t("cancel"))}},f=i.querySelectorAll("button"),m=0;m<f.length;m++)f[m].onclick=d,f[m].onmouseover=d,f[m].onmouseout=d,f[m].onmousedown=d;w().onclick=function(){J.closeModal(r.onClose),t("close")},a.onclick=function(e){e.target===a&&r.allowOutsideClick&&(J.closeModal(r.onClose),t("overlay"))};var k=g(),q=b();r.reverseButtons?k.parentNode.insertBefore(q,k):k.parentNode.insertBefore(k,q);var M=function(e,t){for(var n=C(r.focusCancel),o=0;o<n.length;o++){e+=t,e===n.length?e=0:e===-1&&(e=n.length-1);var i=n[e];if(L(i))return i.focus()}},V=function(e){var n=e||window.event,o=n.keyCode||n.which;if([9,13,32,27].indexOf(o)!==-1){for(var i=n.target||n.srcElement,a=C(r.focusCancel),l=-1,s=0;s<a.length;s++)if(i===a[s]){l=s;break}9===o?(n.shiftKey?M(l,-1):M(l,1),n.stopPropagation(),n.preventDefault()):13===o||32===o?l===-1&&(r.focusCancel?T(q,n):T(k,n)):27===o&&r.allowEscapeKey===!0&&(J.closeModal(r.onClose),t("esc"))}};c.previousWindowKeyDown=window.onkeydown,window.onkeydown=V,r.buttonsStyling&&(k.style.borderLeftColor=r.confirmButtonColor,k.style.borderRightColor=r.confirmButtonColor),J.showLoading=J.enableLoading=function(){B(v()),B(k,"inline-block"),x(k,n.loading),x(i,n.loading),k.disabled=!0,q.disabled=!0},J.hideLoading=J.disableLoading=function(){r.showConfirmButton||(P(k),r.showCancelButton||P(v())),E(k,n.loading),E(i,n.loading),k.disabled=!1,q.disabled=!1},J.enableButtons=function(){k.disabled=!1,q.disabled=!1},J.disableButtons=function(){k.disabled=!0,q.disabled=!0},J.enableConfirmButton=function(){k.disabled=!1},J.disableConfirmButton=function(){k.disabled=!0},J.enableInput=function(){var e=o();if(!e)return!1;if("radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),r=0;r<n.length;r++)n[r].disabled=!1;else e.disabled=!1},J.disableInput=function(){var e=o();if(!e)return!1;if(e&&"radio"===e.type)for(var t=e.parentNode.parentNode,n=t.querySelectorAll("input"),r=0;r<n.length;r++)n[r].disabled=!0;else e.disabled=!0},J.recalculateHeight=N(function(){var e=p(),t=e.style.display;e.style.minHeight="",B(e),e.style.minHeight=e.scrollHeight+1+"px",e.style.display=t},50),J.showValidationError=function(e){var t=y();t.innerHTML=e,B(t);var r=o();S(r),x(r,n.inputerror)},J.resetValidationError=function(){var e=y();P(e),J.recalculateHeight();var t=o();t&&E(t,n.inputerror)},J.getProgressSteps=function(){return r.progressSteps},J.setProgressSteps=function(e){r.progressSteps=e,K(r)},J.showProgressSteps=function(){B(h())},J.hideProgressSteps=function(){P(h())},J.enableButtons(),J.hideLoading(),J.resetValidationError();for(var H=["input","file","range","select","radio","checkbox","textarea"],O=void 0,I=0;I<H.length;I++){var D=n[H[I]],W=A(i,D);if(O=o(H[I])){for(var _ in O.attributes)if(O.attributes.hasOwnProperty(_)){var z=O.attributes[_].name;"type"!==z&&"value"!==z&&O.removeAttribute(z)}for(var Q in r.inputAttributes)O.setAttribute(Q,r.inputAttributes[Q])}W.className=D,r.inputClass&&x(W,r.inputClass),P(W)}var Y=void 0;!function(){switch(r.input){case"text":case"email":case"password":case"number":case"tel":O=A(i,n.input),O.value=r.inputValue,O.placeholder=r.inputPlaceholder,O.type=r.input,B(O);break;case"file":O=A(i,n.file),O.placeholder=r.inputPlaceholder,O.type=r.input,B(O);break;case"range":var e=A(i,n.range),t=e.querySelector("input"),a=e.querySelector("output");t.value=r.inputValue,t.type=r.input,a.value=r.inputValue,B(e);break;case"select":var l=A(i,n.select);if(l.innerHTML="",r.inputPlaceholder){var s=document.createElement("option");s.innerHTML=r.inputPlaceholder,s.value="",s.disabled=!0,s.selected=!0,l.appendChild(s)}Y=function(e){for(var t in e){var n=document.createElement("option");n.value=t,n.innerHTML=e[t],r.inputValue===t&&(n.selected=!0),l.appendChild(n)}B(l),l.focus()};break;case"radio":var c=A(i,n.radio);c.innerHTML="",Y=function(e){for(var t in e){var o=1,i=document.createElement("input"),a=document.createElement("label"),l=document.createElement("span");i.type="radio",i.name=n.radio,i.value=t,i.id=n.radio+"-"+o++,r.inputValue===t&&(i.checked=!0),l.innerHTML=e[t],a.appendChild(i),a.appendChild(l),a.for=i.id,c.appendChild(a)}B(c);var s=c.querySelectorAll("input");s.length&&s[0].focus()};break;case"checkbox":var u=A(i,n.checkbox),d=o("checkbox");d.type="checkbox",d.value=1,d.id=n.checkbox,d.checked=Boolean(r.inputValue);var p=u.getElementsByTagName("span");p.length&&u.removeChild(p[0]),p=document.createElement("span"),p.innerHTML=r.inputPlaceholder,u.appendChild(p),B(u);break;case"textarea":var f=A(i,n.textarea);f.value=r.inputValue,f.placeholder=r.inputPlaceholder,B(f);break;case null:break;default:console.error('SweetAlert2: Unexpected type of input! Expected "text", "email", "password", "select", "checkbox", "textarea" or "file", got "'+r.input+'"')}}(),"select"!==r.input&&"radio"!==r.input||(r.inputOptions instanceof Promise?(J.showLoading(),r.inputOptions.then(function(e){J.hideLoading(),Y(e)})):"object"===j(r.inputOptions)?Y(r.inputOptions):console.error("SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got "+j(r.inputOptions))),R(r.animation,r.onOpen),M(-1,1),a.scrollTop=0,"undefined"==typeof MutationObserver||U||(U=new MutationObserver(J.recalculateHeight),U.observe(i,{childList:!0,characterData:!0,subtree:!0}))})},J=function e(){for(var t=arguments.length,n=Array(t),o=0;o<t;o++)n[o]=arguments[o];return e.isVisible()&&e.close(),Z.apply(void 0,n)};return J.isVisible=function(){var e=p();return L(e)},J.queue=function(e){W=e;var t=p(),n=function(){W=[],t.removeAttribute("data-queue-step")},o=[];return new Promise(function(e,r){!function i(a,l){a<W.length?(t.setAttribute("data-queue-step",a),J(W[a]).then(function(e){o.push(e),i(a+1,l)},function(e){n(),r(e)})):(n(),e(o))}(0)})},J.getQueueStep=function(){return p().getAttribute("data-queue-step")},J.insertQueueStep=function(e,t){return t&&t<W.length?W.splice(t,0,e):W.push(e)},J.deleteQueueStep=function(e){"undefined"!=typeof W[e]&&W.splice(e,1)},J.close=J.closeModal=function(e){var t=p();E(t,n.show),x(t,n.hide);var r=t.querySelector("."+n.icon+"."+o.success);E(r,"animate"),E(r.querySelector(".tip"),"animate-success-tip"),E(r.querySelector(".long"),"animate-success-long");var i=t.querySelector("."+n.icon+"."+o.error);E(i,"animate-error-icon"),E(i.querySelector(".x-mark"),"animate-x-mark");var l=t.querySelector("."+n.icon+"."+o.warning);E(l,"pulse-warning"),H();var s=function(){P(t),t.style.minHeight="",E(a,n.in),E(document.body,n.in),z(),Y()};V&&!k(t,n.noanimation)?t.addEventListener(V,function e(){t.removeEventListener(V,e),k(t,n.hide)&&s()}):s(),null!==e&&"function"==typeof e&&e(void 0,t)},J.clickConfirm=function(){return g().click()},J.clickCancel=function(){return b().click()},J.setDefaults=function(e){if(!e||"object"!==("undefined"==typeof e?"undefined":j(e)))return console.error("SweetAlert2: the argument for setDefaults() is required and has to be a object");for(var t in e)r.hasOwnProperty(t)||"extraParams"===t||(console.warn('SweetAlert2: Unknown parameter "'+t+'"'),delete e[t]);I(D,e)},J.resetDefaults=function(){D=I({},r)},J.noop=function(){},J.version="6.0.1",J}),window.Sweetalert2&&(window.sweetAlert=window.swal=window.Sweetalert2); |
{ | ||
"name": "sweetalert2", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"repository": "https://github.com/limonte/sweetalert2.git", | ||
@@ -5,0 +5,0 @@ "homepage": "https://limonte.github.io/sweetalert2/", |
@@ -48,4 +48,6 @@ import { defaultParams, sweetContainer } from './utils/default.js' | ||
} | ||
} else { | ||
content.innerHTML = params.html || (params.text.split('\n').join('<br>')) | ||
} else if (params.html) { | ||
content.innerHTML = params.html | ||
} else if (params.text) { | ||
content.innerHTML = ('' + params.text).split('\n').join('<br>') | ||
} | ||
@@ -52,0 +54,0 @@ dom.show(content) |
Sorry, the diff of this file is not supported yet
238412
4975