;(function(window,document,undefined){"use strict";(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o=0){newClass=newClass.replace(' '+className+' ',' ');} elem.className=newClass.replace(/^\s+|\s+$/g,'');}};var escapeHtml=function escapeHtml(str){var div=document.createElement('div');div.appendChild(document.createTextNode(str));return div.innerHTML;};var _show=function _show(elem){elem.style.opacity='';elem.style.display='block';};var show=function show(elems){if(elems&&!elems.length){return _show(elems);} for(var i=0;i0){setTimeout(tick,interval);}else{elem.style.display='none';}};tick();};var fireClick=function fireClick(node){if(typeof MouseEvent==='function'){var mevt=new MouseEvent('click',{view:window,bubbles:false,cancelable:true});node.dispatchEvent(mevt);}else if(document.createEvent){var evt=document.createEvent('MouseEvents');evt.initEvent('click',false,false);node.dispatchEvent(evt);}else if(document.createEventObject){node.fireEvent('onclick');}else if(typeof node.onclick==='function'){node.onclick();}};var stopEventPropagation=function stopEventPropagation(e){if(typeof e.stopPropagation==='function'){e.stopPropagation();e.preventDefault();}else if(window.event&&window.event.hasOwnProperty('cancelBubble')){window.event.cancelBubble=true;}};exports.hasClass=hasClass;exports.addClass=addClass;exports.removeClass=removeClass;exports.escapeHtml=escapeHtml;exports._show=_show;exports.show=show;exports._hide=_hide;exports.hide=hide;exports.isDescendant=isDescendant;exports.getTopMargin=getTopMargin;exports.fadeIn=fadeIn;exports.fadeOut=fadeOut;exports.fireClick=fireClick;exports.stopEventPropagation=stopEventPropagation;},{}],4:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _handleDom=require('./handle-dom');var _handleSwalDom=require('./handle-swal-dom');var handleKeyDown=function handleKeyDown(event,params,modal){var e=event||window.event;var keyCode=e.keyCode||e.which;var $okButton=modal.querySelector('button.confirm');var $cancelButton=modal.querySelector('button.cancel');var $modalButtons=modal.querySelectorAll('button[tabindex]');if([9,13,32,27].indexOf(keyCode)===-1){return;} var $targetElement=e.target||e.srcElement;var btnIndex=-1;for(var i=0;i<$modalButtons.length;i++){if($targetElement===$modalButtons[i]){btnIndex=i;break;}} if(keyCode===9){if(btnIndex===-1){$targetElement=$okButton;}else{if(btnIndex===$modalButtons.length-1){$targetElement=$modalButtons[0];}else{$targetElement=$modalButtons[btnIndex+1];}} (0,_handleDom.stopEventPropagation)(e);$targetElement.focus();if(params.confirmButtonColor){(0,_handleSwalDom.setFocusStyle)($targetElement,params.confirmButtonColor);}}else{if(keyCode===13){if($targetElement.tagName==='INPUT'){$targetElement=$okButton;$okButton.focus();} if(btnIndex===-1){$targetElement=$okButton;}else{$targetElement=undefined;}}else if(keyCode===27&¶ms.allowEscapeKey===true){$targetElement=$cancelButton;(0,_handleDom.fireClick)($targetElement,e);}else{$targetElement=undefined;}}};exports.default=handleKeyDown;},{"./handle-dom":3,"./handle-swal-dom":5}],5:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.fixVerticalPosition=exports.resetInputError=exports.resetInput=exports.openModal=exports.getInput=exports.getOverlay=exports.getModal=exports.sweetAlertInitialize=undefined;var _handleDom=require('./handle-dom');var _defaultParams=require('./default-params');var _defaultParams2=_interopRequireDefault(_defaultParams);var _injectedHtml=require('./injected-html');var _injectedHtml2=_interopRequireDefault(_injectedHtml);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};} var modalClass='.sweet-alert';var overlayClass='.sweet-overlay';var sweetAlertInitialize=function sweetAlertInitialize(){var sweetWrap=document.createElement('div');sweetWrap.innerHTML=_injectedHtml2.default;while(sweetWrap.firstChild){document.body.appendChild(sweetWrap.firstChild);}};var getModal=function getModal(){var $modal=document.querySelector(modalClass);if(!$modal){sweetAlertInitialize();$modal=getModal();} return $modal;};var getInput=function getInput(){var $modal=getModal();if($modal){return $modal.querySelector('input');}};var getOverlay=function getOverlay(){return document.querySelector(overlayClass);};var openModal=function openModal(callback){var $modal=getModal();(0,_handleDom.fadeIn)(getOverlay(),10);(0,_handleDom.show)($modal);(0,_handleDom.addClass)($modal,'showSweetAlert');(0,_handleDom.removeClass)($modal,'hideSweetAlert');window.previousActiveElement=document.activeElement;var $okButton=$modal.querySelector('button.confirm');$okButton.focus();setTimeout(function(){(0,_handleDom.addClass)($modal,'visible');},500);var timer=$modal.getAttribute('data-timer');if(timer!=='null'&&timer!==''){var timerCallback=callback;$modal.timeout=setTimeout(function(){var doneFunctionExists=(timerCallback||null)&&$modal.getAttribute('data-has-done-function')==='true';if(doneFunctionExists){timerCallback(null);}else{sweetAlert.close();}},timer);}};var resetInput=function resetInput(){var $modal=getModal();var $input=getInput();(0,_handleDom.removeClass)($modal,'show-input');$input.value=_defaultParams2.default.inputValue;$input.setAttribute('type',_defaultParams2.default.inputType);$input.setAttribute('placeholder',_defaultParams2.default.inputPlaceholder);resetInputError();};var resetInputError=function resetInputError(event){if(event&&event.keyCode===13){return false;} var $modal=getModal();var $errorIcon=$modal.querySelector('.sa-input-error');(0,_handleDom.removeClass)($errorIcon,'show');var $errorContainer=$modal.querySelector('.form-group');(0,_handleDom.removeClass)($errorContainer,'has-error');};var fixVerticalPosition=function fixVerticalPosition(){var $modal=getModal();$modal.style.marginTop=(0,_handleDom.getTopMargin)(getModal());};exports.sweetAlertInitialize=sweetAlertInitialize;exports.getModal=getModal;exports.getOverlay=getOverlay;exports.getInput=getInput;exports.openModal=openModal;exports.resetInput=resetInput;exports.resetInputError=resetInputError;exports.fixVerticalPosition=fixVerticalPosition;},{"./default-params":1,"./handle-dom":3,"./injected-html":6}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var injectedHTML="
"+"
"+"
\n \n \n \n \n
"+"
\n \n \n
"+"
"+"
\n \n \n\n
\n
\n
"+"
"+"

Title

\n

Text

\n
\n \n \n Not valid\n \n
"+"
\n \n
\n "+"
\n
\n
\n
\n
\n
\n
"+"
";exports.default=injectedHTML;},{}],7:[function(require,module,exports){'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj;};var _utils=require('./utils');var _handleSwalDom=require('./handle-swal-dom');var _handleDom=require('./handle-dom');var alertTypes=['error','warning','info','success','input','prompt'];var setParameters=function setParameters(params){var modal=(0,_handleSwalDom.getModal)();var $title=modal.querySelector('h2');var $text=modal.querySelector('p');var $cancelBtn=modal.querySelector('button.cancel');var $confirmBtn=modal.querySelector('button.confirm');$title.innerHTML=params.html?params.title:(0,_handleDom.escapeHtml)(params.title).split('\n').join('
');$text.innerHTML=params.html?params.text:(0,_handleDom.escapeHtml)(params.text||'').split('\n').join('
');if(params.text)(0,_handleDom.show)($text);if(params.customClass){(0,_handleDom.addClass)(modal,params.customClass);modal.setAttribute('data-custom-class',params.customClass);}else{var customClass=modal.getAttribute('data-custom-class');(0,_handleDom.removeClass)(modal,customClass);modal.setAttribute('data-custom-class','');} (0,_handleDom.hide)(modal.querySelectorAll('.sa-icon'));if(params.type&&!(0,_utils.isIE8)()){var _ret=function(){var validType=false;for(var i=0;i