!function(n,t){"use strict";if("undefined"!=typeof module&&module.exports){var i="undefined"!=typeof process,r=i&&"electron"in process.versions;r?n.BootstrapDialog=t(n.jQuery):module.exports=t(require("jquery"),require("bootstrap"))}else"function"==typeof define&&define.amd?define("bootstrap-dialog",["jquery","bootstrap"],function(n){return t(n)}):n.BootstrapDialog=t(n.jQuery)}(this,function(n){"use strict";var r=n.fn.modal.Constructor,i=function(n,t){r.call(this,n,t)},t;return i.getModalVersion=function(){return"undefined"==typeof n.fn.modal.Constructor.VERSION?"v3.1":/3\.2\.\d+/.test(n.fn.modal.Constructor.VERSION)?"v3.2":/3\.3\.[1,2]/.test(n.fn.modal.Constructor.VERSION)?"v3.3":"v3.3.4"},i.ORIGINAL_BODY_PADDING=parseInt(n("body").css("padding-right")||0,10),i.METHODS_TO_OVERRIDE={},i.METHODS_TO_OVERRIDE["v3.1"]={},i.METHODS_TO_OVERRIDE["v3.2"]={hide:function(t){if(t&&t.preventDefault(),t=n.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()){this.isShown=!1;var i=this.getGlobalOpenedDialogs();0===i.length&&this.$body.removeClass("modal-open");this.resetScrollbar();this.escape();n(document).off("focusin.bs.modal");this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal");n.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",n.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal()}}},i.METHODS_TO_OVERRIDE["v3.3"]={setScrollbar:function(){var n=i.ORIGINAL_BODY_PADDING;this.bodyIsOverflowing&&this.$body.css("padding-right",n+this.scrollbarWidth)},resetScrollbar:function(){var n=this.getGlobalOpenedDialogs();0===n.length&&this.$body.css("padding-right",i.ORIGINAL_BODY_PADDING)},hideModal:function(){this.$element.hide();this.backdrop(n.proxy(function(){var n=this.getGlobalOpenedDialogs();0===n.length&&this.$body.removeClass("modal-open");this.resetAdjustments();this.resetScrollbar();this.$element.trigger("hidden.bs.modal")},this))}},i.METHODS_TO_OVERRIDE["v3.3.4"]=n.extend({},i.METHODS_TO_OVERRIDE["v3.3"]),i.prototype={constructor:i,getGlobalOpenedDialogs:function(){var i=[];return n.each(t.dialogs,function(n,t){t.isRealized()&&t.isOpened()&&i.push(t)}),i}},i.prototype=n.extend(i.prototype,r.prototype,i.METHODS_TO_OVERRIDE[i.getModalVersion()]),t=function(i){this.defaultOptions=n.extend(!0,{id:t.newGuid(),buttons:[],data:{},onshow:null,onshown:null,onhide:null,onhidden:null},t.defaultOptions);this.indexedButtons={};this.registeredButtonHotkeys={};this.draggableData={isMouseDown:!1,mouseOffset:{}};this.realized=!1;this.opened=!1;this.initOptions(i);this.holdThisInstance()},t.BootstrapDialogModal=i,t.NAMESPACE="bootstrap-dialog",t.TYPE_DEFAULT="type-default",t.TYPE_INFO="type-info",t.TYPE_PRIMARY="type-primary",t.TYPE_SUCCESS="type-success",t.TYPE_WARNING="type-warning",t.TYPE_DANGER="type-danger",t.DEFAULT_TEXTS={},t.DEFAULT_TEXTS[t.TYPE_DEFAULT]="Information",t.DEFAULT_TEXTS[t.TYPE_INFO]="Information",t.DEFAULT_TEXTS[t.TYPE_PRIMARY]="Information",t.DEFAULT_TEXTS[t.TYPE_SUCCESS]="Success",t.DEFAULT_TEXTS[t.TYPE_WARNING]="Warning",t.DEFAULT_TEXTS[t.TYPE_DANGER]="Danger",t.DEFAULT_TEXTS.OK="OK",t.DEFAULT_TEXTS.CANCEL="Cancel",t.DEFAULT_TEXTS.CONFIRM="Confirmation",t.SIZE_NORMAL="size-normal",t.SIZE_SMALL="size-small",t.SIZE_WIDE="size-wide",t.SIZE_LARGE="size-large",t.BUTTON_SIZES={},t.BUTTON_SIZES[t.SIZE_NORMAL]="",t.BUTTON_SIZES[t.SIZE_SMALL]="",t.BUTTON_SIZES[t.SIZE_WIDE]="",t.BUTTON_SIZES[t.SIZE_LARGE]="btn-lg",t.ICON_SPINNER="glyphicon glyphicon-asterisk",t.defaultOptions={type:t.TYPE_PRIMARY,size:t.SIZE_NORMAL,cssClass:"",title:null,message:null,nl2br:!0,closable:!0,closeByBackdrop:!0,closeByKeyboard:!0,spinicon:t.ICON_SPINNER,autodestroy:!0,draggable:!1,animate:!0,description:"",tabindex:-1},t.configDefaultOptions=function(i){t.defaultOptions=n.extend(!0,t.defaultOptions,i)},t.dialogs={},t.openAll=function(){n.each(t.dialogs,function(n,t){t.open()})},t.closeAll=function(){n.each(t.dialogs,function(n,t){t.close()})},t.getDialog=function(n){var i=null;return"undefined"!=typeof t.dialogs[n]&&(i=t.dialogs[n]),i},t.setDialog=function(n){return t.dialogs[n.getId()]=n,n},t.addDialog=function(n){return t.setDialog(n)},t.moveFocus=function(){var i=null;n.each(t.dialogs,function(n,t){i=t});null!==i&&i.isRealized()&&i.getModal().focus()},t.METHODS_TO_OVERRIDE={},t.METHODS_TO_OVERRIDE["v3.1"]={handleModalBackdropEvent:function(){return this.getModal().on("click",{dialog:this},function(n){n.target===this&&n.data.dialog.isClosable()&&n.data.dialog.canCloseByBackdrop()&&n.data.dialog.close()}),this},updateZIndex:function(){var i=0,r,u;return n.each(t.dialogs,function(){i++}),r=this.getModal(),u=r.data("bs.modal").$backdrop,r.css("z-index",1050+20*(i-1)),u.css("z-index",1040+20*(i-1)),this},open:function(){return!this.isRealized()&&this.realize(),this.getModal().modal("show"),this.updateZIndex(),this}},t.METHODS_TO_OVERRIDE["v3.2"]={handleModalBackdropEvent:t.METHODS_TO_OVERRIDE["v3.1"].handleModalBackdropEvent,updateZIndex:t.METHODS_TO_OVERRIDE["v3.1"].updateZIndex,open:t.METHODS_TO_OVERRIDE["v3.1"].open},t.METHODS_TO_OVERRIDE["v3.3"]={},t.METHODS_TO_OVERRIDE["v3.3.4"]=n.extend({},t.METHODS_TO_OVERRIDE["v3.1"]),t.prototype={constructor:t,initOptions:function(t){return this.options=n.extend(!0,this.defaultOptions,t),this},holdThisInstance:function(){return t.addDialog(this),this},initModalStuff:function(){return this.setModal(this.createModal()).setModalDialog(this.createModalDialog()).setModalContent(this.createModalContent()).setModalHeader(this.createModalHeader()).setModalBody(this.createModalBody()).setModalFooter(this.createModalFooter()),this.getModal().append(this.getModalDialog()),this.getModalDialog().append(this.getModalContent()),this.getModalContent().append(this.getModalHeader()).append(this.getModalBody()).append(this.getModalFooter()),this},createModal:function(){var t=n('<div class="modal" role="dialog" aria-hidden="true"><\/div>');return t.prop("id",this.getId()),t.attr("aria-labelledby",this.getId()+"_title"),t},getModal:function(){return this.$modal},setModal:function(n){return this.$modal=n,this},createModalDialog:function(){return n('<div class="modal-dialog"><\/div>')},getModalDialog:function(){return this.$modalDialog},setModalDialog:function(n){return this.$modalDialog=n,this},createModalContent:function(){return n('<div class="modal-content"><\/div>')},getModalContent:function(){return this.$modalContent},setModalContent:function(n){return this.$modalContent=n,this},createModalHeader:function(){return n('<div class="modal-header"><\/div>')},getModalHeader:function(){return this.$modalHeader},setModalHeader:function(n){return this.$modalHeader=n,this},createModalBody:function(){return n('<div class="modal-body"><\/div>')},getModalBody:function(){return this.$modalBody},setModalBody:function(n){return this.$modalBody=n,this},createModalFooter:function(){return n('<div class="modal-footer"><\/div>')},getModalFooter:function(){return this.$modalFooter},setModalFooter:function(n){return this.$modalFooter=n,this},createDynamicContent:function(n){var t=null;return t="function"==typeof n?n.call(n,this):n,"string"==typeof t&&(t=this.formatStringContent(t)),t},formatStringContent:function(n){return this.options.nl2br?n.replace(/\r\n/g,"<br />").replace(/[\r\n]/g,"<br />"):n},setData:function(n,t){return this.options.data[n]=t,this},getData:function(n){return this.options.data[n]},setId:function(n){return this.options.id=n,this},getId:function(){return this.options.id},getType:function(){return this.options.type},setType:function(n){return this.options.type=n,this.updateType(),this},updateType:function(){if(this.isRealized()){var n=[t.TYPE_DEFAULT,t.TYPE_INFO,t.TYPE_PRIMARY,t.TYPE_SUCCESS,t.TYPE_WARNING,t.TYPE_DANGER];this.getModal().removeClass(n.join(" ")).addClass(this.getType())}return this},getSize:function(){return this.options.size},setSize:function(n){return this.options.size=n,this.updateSize(),this},updateSize:function(){if(this.isRealized()){var i=this;this.getModal().removeClass(t.SIZE_NORMAL).removeClass(t.SIZE_SMALL).removeClass(t.SIZE_WIDE).removeClass(t.SIZE_LARGE);this.getModal().addClass(this.getSize());this.getModalDialog().removeClass("modal-sm");this.getSize()===t.SIZE_SMALL&&this.getModalDialog().addClass("modal-sm");this.getModalDialog().removeClass("modal-lg");this.getSize()===t.SIZE_WIDE&&this.getModalDialog().addClass("modal-lg");n.each(this.options.buttons,function(t,r){var u=i.getButton(r.id),f=["btn-lg","btn-sm","btn-xs"],e=!1,o;"string"==typeof r.cssClass&&(o=r.cssClass.split(" "),n.each(o,function(t,i){-1!==n.inArray(i,f)&&(e=!0)}));e||(u.removeClass(f.join(" ")),u.addClass(i.getButtonSize()))})}return this},getCssClass:function(){return this.options.cssClass},setCssClass:function(n){return this.options.cssClass=n,this},getTitle:function(){return this.options.title},setTitle:function(n){return this.options.title=n,this.updateTitle(),this},updateTitle:function(){if(this.isRealized()){var n=null!==this.getTitle()?this.createDynamicContent(this.getTitle()):this.getDefaultText();this.getModalHeader().find("."+this.getNamespace("title")).html("").append(n).prop("id",this.getId()+"_title")}return this},getMessage:function(){return this.options.message},setMessage:function(n){return this.options.message=n,this.updateMessage(),this},updateMessage:function(){if(this.isRealized()){var n=this.createDynamicContent(this.getMessage());this.getModalBody().find("."+this.getNamespace("message")).html("").append(n)}return this},isClosable:function(){return this.options.closable},setClosable:function(n){return this.options.closable=n,this.updateClosable(),this},setCloseByBackdrop:function(n){return this.options.closeByBackdrop=n,this},canCloseByBackdrop:function(){return this.options.closeByBackdrop},setCloseByKeyboard:function(n){return this.options.closeByKeyboard=n,this},canCloseByKeyboard:function(){return this.options.closeByKeyboard},isAnimate:function(){return this.options.animate},setAnimate:function(n){return this.options.animate=n,this},updateAnimate:function(){return this.isRealized()&&this.getModal().toggleClass("fade",this.isAnimate()),this},getSpinicon:function(){return this.options.spinicon},setSpinicon:function(n){return this.options.spinicon=n,this},addButton:function(n){return this.options.buttons.push(n),this},addButtons:function(t){var i=this;return n.each(t,function(n,t){i.addButton(t)}),this},getButtons:function(){return this.options.buttons},setButtons:function(n){return this.options.buttons=n,this.updateButtons(),this},getButton:function(n){return"undefined"!=typeof this.indexedButtons[n]?this.indexedButtons[n]:null},getButtonSize:function(){return"undefined"!=typeof t.BUTTON_SIZES[this.getSize()]?t.BUTTON_SIZES[this.getSize()]:""},updateButtons:function(){return this.isRealized()&&(0===this.getButtons().length?this.getModalFooter().hide():this.getModalFooter().show().find("."+this.getNamespace("footer")).html("").append(this.createFooterButtons())),this},isAutodestroy:function(){return this.options.autodestroy},setAutodestroy:function(n){this.options.autodestroy=n},getDescription:function(){return this.options.description},setDescription:function(n){return this.options.description=n,this},setTabindex:function(n){return this.options.tabindex=n,this},getTabindex:function(){return this.options.tabindex},updateTabindex:function(){return this.isRealized()&&this.getModal().attr("tabindex",this.getTabindex()),this},getDefaultText:function(){return t.DEFAULT_TEXTS[this.getType()]},getNamespace:function(n){return t.NAMESPACE+"-"+n},createHeaderContent:function(){var t=n("<div><\/div>");return t.addClass(this.getNamespace("header")),t.append(this.createTitleContent()),t.prepend(this.createCloseButton()),t},createTitleContent:function(){var t=n("<div><\/div>");return t.addClass(this.getNamespace("title")),t},createCloseButton:function(){var t=n("<div><\/div>"),i;return t.addClass(this.getNamespace("close-button")),i=n('<button class="close">&times;<\/button>'),t.append(i),t.on("click",{dialog:this},function(n){n.data.dialog.close()}),t},createBodyContent:function(){var t=n("<div><\/div>");return t.addClass(this.getNamespace("body")),t.append(this.createMessageContent()),t},createMessageContent:function(){var t=n("<div><\/div>");return t.addClass(this.getNamespace("message")),t},createFooterContent:function(){var t=n("<div><\/div>");return t.addClass(this.getNamespace("footer")),t},createFooterButtons:function(){var r=this,i=n("<div><\/div>");return i.addClass(this.getNamespace("footer-buttons")),this.indexedButtons={},n.each(this.options.buttons,function(n,u){u.id||(u.id=t.newGuid());var f=r.createButton(u);r.indexedButtons[u.id]=f;i.append(f)}),i},createButton:function(t){var i=n('<button class="btn"><\/button>');return i.prop("id",t.id),i.data("button",t),"undefined"!=typeof t.icon&&""!==n.trim(t.icon)&&i.append(this.createButtonIcon(t.icon)),"undefined"!=typeof t.label&&i.append(t.label),"undefined"!=typeof t.cssClass&&""!==n.trim(t.cssClass)?i.addClass(t.cssClass):i.addClass("btn-default"),"undefined"!=typeof t.hotkey&&(this.registeredButtonHotkeys[t.hotkey]=i),i.on("click",{dialog:this,$button:i,button:t},function(n){var r=n.data.dialog,t=n.data.$button,i=t.data("button");"function"==typeof i.action&&i.action.call(t,r,n);i.autospin&&t.toggleSpin(!0)}),this.enhanceButton(i),"undefined"!=typeof t.enabled&&i.toggleEnable(t.enabled),i},enhanceButton:function(n){return n.dialog=this,n.toggleEnable=function(n){var t=this;return"undefined"!=typeof n?t.prop("disabled",!n).toggleClass("disabled",!n):t.prop("disabled",!t.prop("disabled")),t},n.enable=function(){var n=this;return n.toggleEnable(!0),n},n.disable=function(){var n=this;return n.toggleEnable(!1),n},n.toggleSpin=function(t){var i=this,r=i.dialog,u=i.find("."+r.getNamespace("button-icon"));return"undefined"==typeof t&&(t=!(n.find(".icon-spin").length>0)),t?(u.hide(),n.prepend(r.createButtonIcon(r.getSpinicon()).addClass("icon-spin"))):(u.show(),n.find(".icon-spin").remove()),i},n.spin=function(){var n=this;return n.toggleSpin(!0),n},n.stopSpin=function(){var n=this;return n.toggleSpin(!1),n},this},createButtonIcon:function(t){var i=n("<span><\/span>");return i.addClass(this.getNamespace("button-icon")).addClass(t),i},enableButtons:function(t){return n.each(this.indexedButtons,function(n,i){i.toggleEnable(t)}),this},updateClosable:function(){return this.isRealized()&&this.getModalHeader().find("."+this.getNamespace("close-button")).toggle(this.isClosable()),this},onShow:function(n){return this.options.onshow=n,this},onShown:function(n){return this.options.onshown=n,this},onHide:function(n){return this.options.onhide=n,this},onHidden:function(n){return this.options.onhidden=n,this},isRealized:function(){return this.realized},setRealized:function(n){return this.realized=n,this},isOpened:function(){return this.opened},setOpened:function(n){return this.opened=n,this},handleModalEvents:function(){return this.getModal().on("show.bs.modal",{dialog:this},function(n){var t=n.data.dialog,i;if(t.setOpened(!0),t.isModalEvent(n)&&"function"==typeof t.options.onshow)return i=t.options.onshow(t),i===!1&&t.setOpened(!1),i}),this.getModal().on("shown.bs.modal",{dialog:this},function(n){var t=n.data.dialog;t.isModalEvent(n)&&"function"==typeof t.options.onshown&&t.options.onshown(t)}),this.getModal().on("hide.bs.modal",{dialog:this},function(n){var t=n.data.dialog,i;if(t.setOpened(!1),t.isModalEvent(n)&&"function"==typeof t.options.onhide)return i=t.options.onhide(t),i===!1&&t.setOpened(!0),i}),this.getModal().on("hidden.bs.modal",{dialog:this},function(i){var r=i.data.dialog;r.isModalEvent(i)&&"function"==typeof r.options.onhidden&&r.options.onhidden(r);r.isAutodestroy()&&(r.setRealized(!1),delete t.dialogs[r.getId()],n(this).remove());t.moveFocus()}),this.handleModalBackdropEvent(),this.getModal().on("keyup",{dialog:this},function(n){27===n.which&&n.data.dialog.isClosable()&&n.data.dialog.canCloseByKeyboard()&&n.data.dialog.close()}),this.getModal().on("keyup",{dialog:this},function(t){var r=t.data.dialog,i;"undefined"!=typeof r.registeredButtonHotkeys[t.which]&&(i=n(r.registeredButtonHotkeys[t.which]),i.prop("disabled")||i.focus().trigger("click"))}),this},handleModalBackdropEvent:function(){return this.getModal().on("click",{dialog:this},function(t){n(t.target).hasClass("modal-backdrop")&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByBackdrop()&&t.data.dialog.close()}),this},isModalEvent:function(n){return"undefined"!=typeof n.namespace&&"bs.modal"===n.namespace},makeModalDraggable:function(){return this.options.draggable&&(this.getModalHeader().addClass(this.getNamespace("draggable")).on("mousedown",{dialog:this},function(n){var t=n.data.dialog,i;t.draggableData.isMouseDown=!0;i=t.getModalDialog().offset();t.draggableData.mouseOffset={top:n.clientY-i.top,left:n.clientX-i.left}}),this.getModal().on("mouseup mouseleave",{dialog:this},function(n){n.data.dialog.draggableData.isMouseDown=!1}),n("body").on("mousemove",{dialog:this},function(n){var t=n.data.dialog;t.draggableData.isMouseDown&&t.getModalDialog().offset({top:n.clientY-t.draggableData.mouseOffset.top,left:n.clientX-t.draggableData.mouseOffset.left})})),this},realize:function(){return this.initModalStuff(),this.getModal().addClass(t.NAMESPACE).addClass(this.getCssClass()),this.updateSize(),this.getDescription()&&this.getModal().attr("aria-describedby",this.getDescription()),this.getModalFooter().append(this.createFooterContent()),this.getModalHeader().append(this.createHeaderContent()),this.getModalBody().append(this.createBodyContent()),this.getModal().data("bs.modal",new i(this.getModal(),{backdrop:"static",keyboard:!1,show:!1})),this.makeModalDraggable(),this.handleModalEvents(),this.setRealized(!0),this.updateButtons(),this.updateType(),this.updateTitle(),this.updateMessage(),this.updateClosable(),this.updateAnimate(),this.updateSize(),this.updateTabindex(),this},open:function(){return!this.isRealized()&&this.realize(),this.getModal().modal("show"),this},close:function(){return!this.isRealized()&&this.realize(),this.getModal().modal("hide"),this}},t.prototype=n.extend(t.prototype,t.METHODS_TO_OVERRIDE[i.getModalVersion()]),t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=16*Math.random()|0,i="x"===n?t:3&t|8;return i.toString(16)})},t.show=function(n){return new t(n).open()},t.alert=function(){var i={},r={type:t.TYPE_PRIMARY,title:null,message:null,closable:!1,draggable:!1,buttonLabel:t.DEFAULT_TEXTS.OK,callback:null};return i="object"==typeof arguments[0]&&arguments[0].constructor==={}.constructor?n.extend(!0,r,arguments[0]):n.extend(!0,r,{message:arguments[0],callback:"undefined"!=typeof arguments[1]?arguments[1]:null}),new t({type:i.type,title:i.title,message:i.message,closable:i.closable,draggable:i.draggable,data:{callback:i.callback},onhide:function(n){!n.getData("btnClicked")&&n.isClosable()&&"function"==typeof n.getData("callback")&&n.getData("callback")(!1)},buttons:[{label:i.buttonLabel,action:function(n){n.setData("btnClicked",!0);"function"==typeof n.getData("callback")&&n.getData("callback")(!0);n.close()}}]}).open()},t.confirm=function(){var i={},r={type:t.TYPE_PRIMARY,title:null,message:null,closable:!1,draggable:!1,btnCancelLabel:t.DEFAULT_TEXTS.CANCEL,btnOKLabel:t.DEFAULT_TEXTS.OK,btnOKClass:null,callback:null};return i="object"==typeof arguments[0]&&arguments[0].constructor==={}.constructor?n.extend(!0,r,arguments[0]):n.extend(!0,r,{message:arguments[0],closable:!1,buttonLabel:t.DEFAULT_TEXTS.OK,callback:"undefined"!=typeof arguments[1]?arguments[1]:null}),null===i.btnOKClass&&(i.btnOKClass=["btn",i.type.split("-")[1]].join("-")),new t({type:i.type,title:i.title,message:i.message,closable:i.closable,draggable:i.draggable,data:{callback:i.callback},buttons:[{label:i.btnCancelLabel,action:function(n){"function"==typeof n.getData("callback")&&n.getData("callback")(!1);n.close()}},{label:i.btnOKLabel,cssClass:i.btnOKClass,action:function(n){"function"==typeof n.getData("callback")&&n.getData("callback")(!0);n.close()}}]}).open()},t.warning=function(n){return new t({type:t.TYPE_WARNING,message:n}).open()},t.danger=function(n){return new t({type:t.TYPE_DANGER,message:n}).open()},t.success=function(n){return new t({type:t.TYPE_SUCCESS,message:n}).open()},t});!function(n,t){"use strict";var r,i=n.document;r=function(){var e,c,l,y,w,b,k,h,f,r,g,o,d,u={},s={},v=!1,p={ENTER:13,ESC:27,SPACE:32},a=[];return s={buttons:{holder:'<nav class="alertify-buttons">{{buttons}}<\/nav>',submit:'<button type="submit" class="alertify-button alertify-button-ok" id="alertify-ok">{{ok}}<\/button>',ok:'<button class="alertify-button alertify-button-ok" id="alertify-ok">{{ok}}<\/button>',cancel:'<button class="alertify-button alertify-button-cancel" id="alertify-cancel">{{cancel}}<\/button>'},input:'<div class="alertify-text-wrapper"><input type="text" class="alertify-text" id="alertify-text"><\/div>',message:'<p class="alertify-message">{{message}}<\/p>',log:'<article class="alertify-log{{class}}">{{message}}<\/article>'},d=function(){var n,r,u=!1,e=i.createElement("fakeelement"),f={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"};for(n in f)if(e.style[n]!==t){r=f[n];u=!0;break}return{type:r,supported:u}},e=function(n){return i.getElementById(n)},u={labels:{ok:"OK",cancel:"Cancel"},delay:5e3,buttonReverse:!1,buttonFocus:"ok",transition:t,addListeners:function(n){var r,u,s,h,f,v="undefined"!=typeof l,e="undefined"!=typeof c,a="undefined"!=typeof o,b="",t=this;r=function(t){return"undefined"!=typeof t.preventDefault&&t.preventDefault(),s(t),"undefined"!=typeof o&&(b=o.value),"function"==typeof n&&("undefined"!=typeof o?n(!0,b):n(!0)),!1};u=function(t){return"undefined"!=typeof t.preventDefault&&t.preventDefault(),s(t),"function"==typeof n&&n(!1),!1};s=function(){t.hide();t.unbind(i.body,"keyup",h);t.unbind(y,"focus",f);v&&t.unbind(l,"click",r);e&&t.unbind(c,"click",u)};h=function(n){var t=n.keyCode;(t===p.SPACE&&!a||a&&t===p.ENTER)&&r(n);t===p.ESC&&e&&u(n)};f=function(){a?o.focus():!e||t.buttonReverse?l.focus():c.focus()};this.bind(y,"focus",f);this.bind(w,"focus",f);v&&this.bind(l,"click",r);e&&this.bind(c,"click",u);this.bind(i.body,"keyup",h);this.transition.supported||this.setFocus()},bind:function(n,t,i){"function"==typeof n.addEventListener?n.addEventListener(t,i,!1):n.attachEvent&&n.attachEvent("on"+t,i)},handleErrors:function(){if("undefined"!=typeof n.onerror){var t=this;return n.onerror=function(n,i,r){t.error("["+n+" on line "+r+" of "+i+"]",0)},!0}return!1},appendButtons:function(n,t){return this.buttonReverse?t+n:n+t},build:function(n){var t="",i=n.type,r=n.message,e=n.cssClass||"";switch(t+='<div class="alertify-dialog">',t+='<a id="alertify-resetFocusBack" class="alertify-resetFocus" href="#">Reset Focus<\/a>',"none"===u.buttonFocus&&(t+='<a href="#" id="alertify-noneFocus" class="alertify-hidden"><\/a>'),"prompt"===i&&(t+='<div id="alertify-form">'),t+='<article class="alertify-inner">',t+=s.message.replace("{{message}}",r),"prompt"===i&&(t+=s.input),t+=s.buttons.holder,t+="<\/article>","prompt"===i&&(t+="<\/div>"),t+='<a id="alertify-resetFocus" class="alertify-resetFocus" href="#">Reset Focus<\/a>',t+="<\/div>",i){case"confirm":t=t.replace("{{buttons}}",this.appendButtons(s.buttons.cancel,s.buttons.ok));t=t.replace("{{ok}}",this.labels.ok).replace("{{cancel}}",this.labels.cancel);break;case"prompt":t=t.replace("{{buttons}}",this.appendButtons(s.buttons.cancel,s.buttons.submit));t=t.replace("{{ok}}",this.labels.ok).replace("{{cancel}}",this.labels.cancel);break;case"alert":t=t.replace("{{buttons}}",s.buttons.ok);t=t.replace("{{ok}}",this.labels.ok)}return f.className="alertify alertify-"+i+" "+e,h.className="alertify-cover",t},close:function(n,t){var u,f,e=t&&!isNaN(t)?+t:this.delay,i=this;this.bind(n,"click",function(){u(n)});f=function(n){n.stopPropagation();i.unbind(this,i.transition.type,f);r.removeChild(this);r.hasChildNodes()||(r.className+=" alertify-logs-hidden")};u=function(n){"undefined"!=typeof n&&n.parentNode===r&&(i.transition.supported?(i.bind(n,i.transition.type,f),n.className+=" alertify-log-hide"):(r.removeChild(n),r.hasChildNodes()||(r.className+=" alertify-logs-hidden")))};0!==t&&setTimeout(function(){u(n)},e)},dialog:function(n,t,u,f,e){k=i.activeElement;var o=function(){r&&null!==r.scrollTop&&h&&null!==h.scrollTop||o()};if("string"!=typeof n)throw new Error("message must be a string");if("string"!=typeof t)throw new Error("type must be a string");if("undefined"!=typeof u&&"function"!=typeof u)throw new Error("fn must be a function");return this.init(),o(),a.push({type:t,message:n,callback:u,placeholder:f,cssClass:e}),v||this.setup(),this},extend:function(n){if("string"!=typeof n)throw new Error("extend method must have exactly one paramter");return function(t,i){return this.log(t,n,i),this}},hide:function(){var n,t=this;a.splice(0,1);a.length>0?this.setup(!0):(v=!1,n=function(i){i.stopPropagation();t.unbind(f,t.transition.type,n)},this.transition.supported?(this.bind(f,this.transition.type,n),f.className="alertify alertify-hide alertify-hidden"):f.className="alertify alertify-hide alertify-hidden alertify-isHidden",h.className="alertify-cover alertify-cover-hidden",k.focus())},init:function(){i.createElement("nav");i.createElement("article");i.createElement("section");null==e("alertify-cover")&&(h=i.createElement("div"),h.setAttribute("id","alertify-cover"),h.className="alertify-cover alertify-cover-hidden",i.body.appendChild(h));null==e("alertify")&&(v=!1,a=[],f=i.createElement("section"),f.setAttribute("id","alertify"),f.className="alertify alertify-hidden",i.body.appendChild(f));null==e("alertify-logs")&&(r=i.createElement("section"),r.setAttribute("id","alertify-logs"),r.className="alertify-logs alertify-logs-hidden",i.body.appendChild(r));i.body.setAttribute("tabindex","0");this.transition=d()},log:function(n,t,i){var u=function(){r&&null!==r.scrollTop||u()};return this.init(),u(),r.className="alertify-logs",this.notify(n,t,i),this},notify:function(n,t,u){var f=i.createElement("article");f.className="alertify-log"+("string"==typeof t&&""!==t?" alertify-log-"+t:"");f.innerHTML=n;r.appendChild(f);setTimeout(function(){f.className=f.className+" alertify-log-show"},50);this.close(f,u)},set:function(n){var t;if("object"!=typeof n&&n instanceof Array)throw new Error("args must be an object");for(t in n)n.hasOwnProperty(t)&&(this[t]=n[t])},setFocus:function(){o?(o.focus(),o.select()):b.focus()},setup:function(n){var r,i=a[0],s=this;v=!0;r=function(n){n.stopPropagation();s.setFocus();s.unbind(f,s.transition.type,r)};this.transition.supported&&!n&&this.bind(f,this.transition.type,r);f.innerHTML=this.build(i);y=e("alertify-resetFocus");w=e("alertify-resetFocusBack");l=e("alertify-ok")||t;c=e("alertify-cancel")||t;b="cancel"===u.buttonFocus?c:"none"===u.buttonFocus?e("alertify-noneFocus"):l;o=e("alertify-text")||t;g=e("alertify-form")||t;"string"==typeof i.placeholder&&""!==i.placeholder&&(o.value=i.placeholder);n&&this.setFocus();this.addListeners(i.callback)},unbind:function(n,t,i){"function"==typeof n.removeEventListener?n.removeEventListener(t,i,!1):n.detachEvent&&n.detachEvent("on"+t,i)}},{alert:function(n,t,i){return u.dialog(n,"alert",t,"",i),this},confirm:function(n,t,i){return u.dialog(n,"confirm",t,"",i),this},extend:u.extend,init:u.init,log:function(n,t,i){return u.log(n,t,i),this},prompt:function(n,t,i,r){return u.dialog(n,"prompt",t,i,r),this},success:function(n,t){return u.log(n,"success",t),this},error:function(n,t){return u.log(n,"error",t),this},set:function(n){u.set(n)},labels:u.labels,debug:u.handleErrors}};"function"==typeof define?define([],function(){return new r}):"undefined"==typeof n.alertify&&(n.alertify=new r)}(this)