(function(t,e){"use strict";if(typeof module!=="undefined"&&module.exports){module.exports=e(require("jquery"),require("bootstrap"))}else if(typeof define==="function"&&define.amd){define("bootstrap-dialog",["jquery","bootstrap"],function(t){return e(t)})}else{t.BootstrapDialog=e(t.jQuery)}})(this,function(l){"use strict";var n=l.fn.modal.Constructor;var e=function(t,e){if(/^4\./.test(l.fn.modal.Constructor.VERSION)){return new n(t,e)}else{n.call(this,t,e)}};e.getModalVersion=function(){var t=null;if(typeof l.fn.modal.Constructor.VERSION==="undefined"){t="v3.1"}else if(/^3\.2\.\d+/.test(l.fn.modal.Constructor.VERSION)){t="v3.2"}else if(/^3\.3\.[1,2]/.test(l.fn.modal.Constructor.VERSION)){t="v3.3"}else if(/^4\.0\.\d+/.test(l.fn.modal.Constructor.VERSION)){t="v4.0"}else if(/^4\.1\.\d+/.test(l.fn.modal.Constructor.VERSION)){t="v4.1"}else if(/^4\.\d\.\d+/.test(l.fn.modal.Constructor.VERSION)){t="v4.x"}else{t="v3.3.4"}return t};e.ORIGINAL_BODY_PADDING=parseInt(l("body").css("padding-right")||0,10);e.METHODS_TO_OVERRIDE={};e.METHODS_TO_OVERRIDE["v3.1"]={};e.METHODS_TO_OVERRIDE["v3.2"]={hide:function(t){if(t){t.preventDefault()}t=l.Event("hide.bs.modal");this.$element.trigger(t);if(!this.isShown||t.isDefaultPrevented()){return}this.isShown=false;var e=this.getGlobalOpenedDialogs();if(e.length===0){this.$body.removeClass("modal-open")}this.resetScrollbar();this.escape();l(document).off("focusin.bs.modal");this.$element.removeClass("in").attr("aria-hidden",true).off("click.dismiss.bs.modal");l.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",l.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal()}};e.METHODS_TO_OVERRIDE["v3.3"]={setScrollbar:function(){var t=e.ORIGINAL_BODY_PADDING;if(this.bodyIsOverflowing){this.$body.css("padding-right",t+this.scrollbarWidth)}},resetScrollbar:function(){var t=this.getGlobalOpenedDialogs();if(t.length===0){this.$body.css("padding-right",e.ORIGINAL_BODY_PADDING)}},hideModal:function(){this.$element.hide();this.backdrop(l.proxy(function(){var t=this.getGlobalOpenedDialogs();if(t.length===0){this.$body.removeClass("modal-open")}this.resetAdjustments();this.resetScrollbar();this.$element.trigger("hidden.bs.modal")},this))}};e.METHODS_TO_OVERRIDE["v3.3.4"]=l.extend({},e.METHODS_TO_OVERRIDE["v3.3"]);e.METHODS_TO_OVERRIDE["v4.0"]=l.extend({},e.METHODS_TO_OVERRIDE["v3.3"]);e.METHODS_TO_OVERRIDE["v4.1"]=l.extend({},e.METHODS_TO_OVERRIDE["v3.3"]);e.METHODS_TO_OVERRIDE["v4.x"]=l.extend({},e.METHODS_TO_OVERRIDE["v3.3"]);e.prototype={constructor:e,getGlobalOpenedDialogs:function(){var n=[];l.each(a.dialogs,function(t,e){if(e.isRealized()&&e.isOpened()){n.push(e)}});return n}};e.prototype=l.extend(e.prototype,n.prototype,e.METHODS_TO_OVERRIDE[e.getModalVersion()]);var a=function(t){this.defaultOptions=l.extend(true,{id:a.newGuid(),buttons:[],data:{},onshow:null,onshown:null,onhide:null,onhidden:null},a.defaultOptions);this.indexedButtons={};this.registeredButtonHotkeys={};this.draggableData={isMouseDown:false,mouseOffset:{}};this.realized=false;this.opened=false;this.initOptions(t);this.holdThisInstance()};a.BootstrapDialogModal=e;a.NAMESPACE="bootstrap-dialog";a.TYPE_DEFAULT="type-default";a.TYPE_INFO="type-info";a.TYPE_PRIMARY="type-primary";a.TYPE_SUCCESS="type-success";a.TYPE_WARNING="type-warning";a.TYPE_DANGER="type-danger";a.DEFAULT_TEXTS={};a.DEFAULT_TEXTS[a.TYPE_DEFAULT]="Information";a.DEFAULT_TEXTS[a.TYPE_INFO]="Information";a.DEFAULT_TEXTS[a.TYPE_PRIMARY]="Information";a.DEFAULT_TEXTS[a.TYPE_SUCCESS]="Success";a.DEFAULT_TEXTS[a.TYPE_WARNING]="Warning";a.DEFAULT_TEXTS[a.TYPE_DANGER]="Danger";a.DEFAULT_TEXTS["OK"]="OK";a.DEFAULT_TEXTS["CANCEL"]="Cancel";a.DEFAULT_TEXTS["CONFIRM"]="Confirmation";a.SIZE_NORMAL="size-normal";a.SIZE_SMALL="size-small";a.SIZE_WIDE="size-wide";a.SIZE_LARGE="size-large";a.BUTTON_SIZES={};a.BUTTON_SIZES[a.SIZE_NORMAL]="";a.BUTTON_SIZES[a.SIZE_SMALL]="";a.BUTTON_SIZES[a.SIZE_WIDE]="";a.BUTTON_SIZES[a.SIZE_LARGE]="btn-lg";a.ICON_SPINNER="glyphicon glyphicon-asterisk";a.defaultOptions={type:a.TYPE_PRIMARY,size:a.SIZE_NORMAL,cssClass:"",title:null,message:null,nl2br:true,closable:true,closeByBackdrop:true,closeByKeyboard:true,closeIcon:"&#215;",spinicon:a.ICON_SPINNER,autodestroy:true,draggable:false,animate:true,enableScript:false,description:"",tabindex:-1};a.configDefaultOptions=function(t){a.defaultOptions=l.extend(true,a.defaultOptions,t)};a.dialogs={};a.openAll=function(){l.each(a.dialogs,function(t,e){e.open()})};a.closeAll=function(){l.each(a.dialogs,function(t,e){e.close()})};a.getDialog=function(t){var e=null;if(typeof a.dialogs[t]!=="undefined"){e=a.dialogs[t]}return e};a.setDialog=function(t){a.dialogs[t.getId()]=t;return t};a.addDialog=function(t){return a.setDialog(t)};a.moveFocus=function(){var n=null;l.each(a.dialogs,function(t,e){if(e.isRealized()&&e.isOpened()){n=e}});if(n!==null){n.getModal().focus()}};a.METHODS_TO_OVERRIDE={};a.METHODS_TO_OVERRIDE["v3.1"]={handleModalBackdropEvent:function(){this.getModal().on("click",{dialog:this},function(t){t.target===this&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByBackdrop()&&t.data.dialog.close()});return this},updateZIndex:function(){if(this.isOpened()){var t=1040;var e=1050;var n=0;l.each(a.dialogs,function(t,e){if(e.isRealized()&&e.isOpened()){n++}});var i=this.getModal();var o=this.getModalBackdrop(i);i.css("z-index",e+(n-1)*20);o.css("z-index",t+(n-1)*20)}return this},open:function(){!this.isRealized()&&this.realize();this.getModal().modal("show");this.updateZIndex();return this}};a.METHODS_TO_OVERRIDE["v3.2"]={handleModalBackdropEvent:a.METHODS_TO_OVERRIDE["v3.1"]["handleModalBackdropEvent"],updateZIndex:a.METHODS_TO_OVERRIDE["v3.1"]["updateZIndex"],open:a.METHODS_TO_OVERRIDE["v3.1"]["open"]};a.METHODS_TO_OVERRIDE["v3.3"]={};a.METHODS_TO_OVERRIDE["v3.3.4"]=l.extend({},a.METHODS_TO_OVERRIDE["v3.1"]);a.METHODS_TO_OVERRIDE["v4.0"]={getModalBackdrop:function(t){return l(t.data("bs.modal")._backdrop)},handleModalBackdropEvent:function(){var i=this;this.getModal().on("click",{dialog:this},function(t){if(t.target===this&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByBackdrop()){t.data.dialog.close();var e=l(this).data("bs.modal");if(e&&typeof e._isTransitioning!="undefined"&&e._isTransitioning){var n=function(){e._hideModal(t)};i.isAnimate()?window.setTimeout(n,300):n()}}});return this},updateZIndex:a.METHODS_TO_OVERRIDE["v3.1"]["updateZIndex"],open:a.METHODS_TO_OVERRIDE["v3.1"]["open"],getModalForBootstrapDialogModal:function(){return this.getModal().get(0)}};a.METHODS_TO_OVERRIDE["v4.1"]=a.METHODS_TO_OVERRIDE["v4.0"];a.METHODS_TO_OVERRIDE["v4.x"]=a.METHODS_TO_OVERRIDE["v4.1"];a.prototype={constructor:a,initOptions:function(t){this.options=l.extend(true,this.defaultOptions,t);return this},holdThisInstance:function(){a.addDialog(this);return this},initModalStuff:function(){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());return this},createModal:function(){var t=l('<div class="modal" role="dialog" aria-hidden="true"></div>');t.prop("id",this.getId());t.attr("aria-labelledby",this.getId()+"_title");return t},getModal:function(){return this.$modal},setModal:function(t){this.$modal=t;return this},getModalBackdrop:function(t){return t.data("bs.modal").$backdrop},getModalForBootstrapDialogModal:function(){return this.getModal()},createModalDialog:function(){return l('<div class="modal-dialog" role="document"></div>')},getModalDialog:function(){return this.$modalDialog},setModalDialog:function(t){this.$modalDialog=t;return this},createModalContent:function(){return l('<div class="modal-content"></div>')},getModalContent:function(){return this.$modalContent},setModalContent:function(t){this.$modalContent=t;return this},createModalHeader:function(){return l('<div class="modal-header"></div>')},getModalHeader:function(){return this.$modalHeader},setModalHeader:function(t){this.$modalHeader=t;return this},createModalBody:function(){return l('<div class="modal-body"></div>')},getModalBody:function(){return this.$modalBody},setModalBody:function(t){this.$modalBody=t;return this},createModalFooter:function(){return l('<div class="modal-footer"></div>')},getModalFooter:function(){return this.$modalFooter},setModalFooter:function(t){this.$modalFooter=t;return this},createDynamicContent:function(t){var e=null;if(typeof t==="function"){e=t.call(t,this)}else{e=t}if(typeof e==="string"){e=this.formatStringContent(e)}return e},formatStringContent:function(t){if(this.options.nl2br){return t.replace(/\r\n/g,"<br />").replace(/[\r\n]/g,"<br />")}return t},setData:function(t,e){this.options.data[t]=e;return this},getData:function(t){return this.options.data[t]},setId:function(t){this.options.id=t;return this},getId:function(){return this.options.id},getType:function(){return this.options.type},setType:function(t){this.options.type=t;this.updateType();return this},updateType:function(){if(this.isRealized()){var t=[a.TYPE_DEFAULT,a.TYPE_INFO,a.TYPE_PRIMARY,a.TYPE_SUCCESS,a.TYPE_WARNING,a.TYPE_DANGER];this.getModal().removeClass(t.join(" ")).addClass(this.getType())}return this},getSize:function(){return this.options.size},setSize:function(t){this.options.size=t;this.updateSize();return this},updateSize:function(){if(this.isRealized()){var s=this;this.getModal().removeClass(a.SIZE_NORMAL).removeClass(a.SIZE_SMALL).removeClass(a.SIZE_WIDE).removeClass(a.SIZE_LARGE);this.getModal().addClass(this.getSize());this.getModalDialog().removeClass("modal-sm");if(this.getSize()===a.SIZE_SMALL){this.getModalDialog().addClass("modal-sm")}this.getModalDialog().removeClass("modal-lg");if(this.getSize()===a.SIZE_WIDE){this.getModalDialog().addClass("modal-lg")}l.each(this.options.buttons,function(t,e){var n=s.getButton(e.id);var i=["btn-lg","btn-sm","btn-xs"];var o=false;if(typeof e["cssClass"]==="string"){var a=e["cssClass"].split(" ");l.each(a,function(t,e){if(l.inArray(e,i)!==-1){o=true}})}if(!o){n.removeClass(i.join(" "));n.addClass(s.getButtonSize())}})}return this},getCssClass:function(){return this.options.cssClass},setCssClass:function(t){this.options.cssClass=t;return this},getTitle:function(){return this.options.title},setTitle:function(t){this.options.title=t;this.updateTitle();return this},updateTitle:function(){if(this.isRealized()){var t=this.getTitle()!==null?this.createDynamicContent(this.getTitle()):this.getDefaultText();this.getModalHeader().find("."+this.getNamespace("title")).html("").append(t).prop("id",this.getId()+"_title")}return this},getMessage:function(){return this.options.message},setMessage:function(t){this.options.message=t;this.updateMessage();return this},updateMessage:function(){if(this.isRealized()){var t=this.createDynamicContent(this.getMessage());var e=[];if(this.options.enableScript){var n=l(t);e=n.find("script");n.find("script").remove();t=n.html()}this.getModalBody().find("."+this.getNamespace("message")).html("").append(t);if(e&&e.length>0){var i="";for(var o=0;o<e.length;o++){var a=e[o];if(a.src){if(l('script[src$="'+a.src+'"]').length<1)l("body").append('<script type="text/javascript" src="'+a.src+'"><\/script>')}else if(a.text){i+='<script type="text/javascript">'+a.text+"<\/script>"}}if(i)this.getModalBody().data("script-text",i)}}return this},isClosable:function(){return this.options.closable},setClosable:function(t){this.options.closable=t;this.updateClosable();return this},setCloseByBackdrop:function(t){this.options.closeByBackdrop=t;return this},canCloseByBackdrop:function(){return this.options.closeByBackdrop},setCloseByKeyboard:function(t){this.options.closeByKeyboard=t;return this},canCloseByKeyboard:function(){return this.options.closeByKeyboard},isAnimate:function(){return this.options.animate},setAnimate:function(t){this.options.animate=t;return this},updateAnimate:function(){if(this.isRealized()){this.getModal().toggleClass("fade",this.isAnimate())}return this},getSpinicon:function(){return this.options.spinicon},setSpinicon:function(t){this.options.spinicon=t;return this},addButton:function(t){this.options.buttons.push(t);return this},addButtons:function(t){var n=this;l.each(t,function(t,e){n.addButton(e)});return this},getButtons:function(){return this.options.buttons},setButtons:function(t){this.options.buttons=t;this.updateButtons();return this},getButton:function(t){if(typeof this.indexedButtons[t]!=="undefined"){return this.indexedButtons[t]}return null},getButtonSize:function(){if(typeof a.BUTTON_SIZES[this.getSize()]!=="undefined"){return a.BUTTON_SIZES[this.getSize()]}return""},updateButtons:function(){if(this.isRealized()){if(this.getButtons().length===0){this.getModalFooter().hide()}else{this.getModalFooter().show().find("."+this.getNamespace("footer")).html("").append(this.createFooterButtons())}}return this},isAutodestroy:function(){return this.options.autodestroy},setAutodestroy:function(t){this.options.autodestroy=t},getDescription:function(){return this.options.description},setDescription:function(t){this.options.description=t;return this},setTabindex:function(t){this.options.tabindex=t;return this},getTabindex:function(){return this.options.tabindex},updateTabindex:function(){if(this.isRealized()){this.getModal().attr("tabindex",this.getTabindex())}return this},getDefaultText:function(){return a.DEFAULT_TEXTS[this.getType()]},getNamespace:function(t){return a.NAMESPACE+"-"+t},getModalVersion:function(){return e.getModalVersion()},createHeaderContent:function(){var t=l("<div></div>");t.addClass(this.getNamespace("header"));t.append(this.createTitleContent());if(this.getModalVersion()!=="v4.1")t.prepend(this.createCloseButton());else{t.css("width","100%");t.append(this.createCloseButton())}return t},createTitleContent:function(){var t=l("<h5></h5>");t.addClass(this.getNamespace("title"));t.addClass("modal-title");return t},createCloseButton:function(){var t=l("<div></div>");t.addClass(this.getNamespace("close-button"));var e=l('<button class="close" type="button" aria-label="Close"></button>');e.append(this.options.closeIcon);t.append(e);t.on("click",{dialog:this},function(t){t.data.dialog.close()});return t},createBodyContent:function(){var t=l("<div></div>");t.addClass(this.getNamespace("body"));t.append(this.createMessageContent());return t},createMessageContent:function(){var t=l("<div></div>");t.addClass(this.getNamespace("message"));return t},createFooterContent:function(){var t=l("<div></div>");t.addClass(this.getNamespace("footer"));return t},createFooterButtons:function(){var i=this;var o=l("<div></div>");o.addClass(this.getNamespace("footer-buttons"));this.indexedButtons={};l.each(this.options.buttons,function(t,e){if(!e.id){e.id=a.newGuid()}var n=i.createButton(e);i.indexedButtons[e.id]=n;if(i.getModalVersion()=="v4.1"){n.css("margin-left","5px")}o.append(n)});return o},createButton:function(t){var e=l('<button class="btn"></button>');e.prop("id",t.id);e.data("button",t);if(typeof t.icon!=="undefined"&&l.trim(t.icon)!==""){e.append(this.createButtonIcon(t.icon))}if(typeof t.label!=="undefined"){e.append(t.label)}if(typeof t.cssClass!=="undefined"&&l.trim(t.cssClass)!==""){e.addClass(t.cssClass)}else{e.addClass("btn-default")}if(typeof t.hotkey!=="undefined"){this.registeredButtonHotkeys[t.hotkey]=e}e.on("click",{dialog:this,$button:e,button:t},function(t){var e=t.data.dialog;var n=t.data.$button;var i=n.data("button");if(i.autospin){n.toggleSpin(true)}if(typeof i.action==="function"){return i.action.call(n,e,t)}});this.enhanceButton(e);if(typeof t.enabled!=="undefined"){e.toggleEnable(t.enabled)}return e},enhanceButton:function(o){o.dialog=this;o.toggleEnable=function(t){var e=this;if(typeof t!=="undefined"){e.prop("disabled",!t).toggleClass("disabled",!t)}else{e.prop("disabled",!e.prop("disabled"))}return e};o.enable=function(){var t=this;t.toggleEnable(true);return t};o.disable=function(){var t=this;t.toggleEnable(false);return t};o.toggleSpin=function(t){var e=this;var n=e.dialog;var i=e.find("."+n.getNamespace("button-icon"));if(typeof t==="undefined"){t=!(o.find(".icon-spin").length>0)}if(t){i.hide();o.prepend(n.createButtonIcon(n.getSpinicon()).addClass("icon-spin"))}else{i.show();o.find(".icon-spin").remove()}return e};o.spin=function(){var t=this;t.toggleSpin(true);return t};o.stopSpin=function(){var t=this;t.toggleSpin(false);return t};return this},createButtonIcon:function(t){var e=l("<span></span>");e.addClass(this.getNamespace("button-icon")).addClass(t);return e},createPromptForm:function(a){var t=l("<form></form>"),i=l('<input type="text" class="form-control" autocomplete="off">');switch(a.inputType){case"text":case"email":case"date":case"time":case"number":case"password":i.attr("type",a.inputType);i.val(l.trim(a.message));break;case"textarea":i=l('<textarea class="form-control" rows="3"></textarea>');i.val(l.trim(a.message));break;case"select":i=l('<select class="form-control"></select>');l.each(a.inputOptions,function(t,e){i.append('<option value="'+e.value+'"'+(e.selected?" selected":"")+">"+e.text+"</option>")});break;case"checkbox":i=l("<div></div>");var o='<div class="checkbox"><label><input type="checkbox"></label></div>';l.each(a.inputOptions,function(t,e){var n=l(o);n.find("input").attr("value",e.value).prop({checked:e.checked,indeterminate:e.indeterminate});n.find("label").append(e.text);i.append(n)});break}var n=["placeholder","pattern","minlength","maxlength","min","max","step","rows"];l.each(a,function(t,e){l.inArray(t,n)!==-1&&i.attr(t,e)});t.append(i);t.append('<button type="submit" class="hidden"></button>');t.on("submit",{dialog:this},function(t){if(a.btnOKHotkey===13&&!l(this).data("submit-trigger")){return false}if(this.checkValidity()){t.preventDefault();var e=t.data.dialog,n=e.getButton(a.btnOKId),i;if(a.inputType==="checkbox"){var o=e.getModalBody().find("input:checked");i=[];l.each(o,function(t,e){i.push(e.value)})}else{i=e.getModalBody().find("input, textarea, select").val()}if(typeof e.getData("callback")==="function"&&e.getData("callback").call(n,i)===false){return false}return e.close()}});return t},submitPromptForm:function(){var t=this.getMessage().closest("form");t.data("submit-trigger",true);t.find(":submit").trigger("click");t.data("submit-trigger",false)},enableButtons:function(n){l.each(this.indexedButtons,function(t,e){e.toggleEnable(n)});return this},updateClosable:function(){if(this.isRealized()){this.getModalHeader().find("."+this.getNamespace("close-button")).toggle(this.isClosable())}return this},onShow:function(t){this.options.onshow=t;return this},onShown:function(t){this.options.onshown=t;return this},onHide:function(t){this.options.onhide=t;return this},onHidden:function(t){this.options.onhidden=t;return this},isRealized:function(){return this.realized},setRealized:function(t){this.realized=t;return this},isOpened:function(){return this.opened},setOpened:function(t){this.opened=t;return this},handleModalEvents:function(){this.getModal().on("show.bs.modal",{dialog:this},function(t){var e=t.data.dialog;e.setOpened(true);if(e.isModalEvent(t)&&typeof e.options.onshow==="function"){var n=e.options.onshow(e);if(n===false){e.setOpened(false)}return n}});this.getModal().on("shown.bs.modal",{dialog:this},function(t){var e=t.data.dialog;if(e.isModalEvent(t)){if(e.getModalBody().data("script-text")){l("body").append(e.getModalBody().data("script-text"))}typeof e.options.onshown==="function"&&e.options.onshown(e)}});this.getModal().on("hide.bs.modal",{dialog:this},function(t){var e=t.data.dialog;e.setOpened(false);if(e.isModalEvent(t)&&typeof e.options.onhide==="function"){var n=e.options.onhide(e);if(n===false){e.setOpened(true)}return n}});this.getModal().on("hidden.bs.modal",{dialog:this},function(t){var e=t.data.dialog;e.isModalEvent(t)&&typeof e.options.onhidden==="function"&&e.options.onhidden(e);if(e.isAutodestroy()){e.setRealized(false);delete a.dialogs[e.getId()];if(e.draggableData.bodyMousemoveEvent){l("body").off("mousemove",e.draggableData.bodyMousemoveEvent)}l(this).remove()}a.moveFocus()});this.handleModalBackdropEvent();this.getModal().on("keyup",{dialog:this},function(t){t.which===27&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByKeyboard()&&t.data.dialog.close()});this.getModal().on("keyup",{dialog:this},function(t){var e=t.data.dialog;if(typeof e.registeredButtonHotkeys[t.which]!=="undefined"){var n=l(e.registeredButtonHotkeys[t.which]);!n.prop("disabled")&&n.focus().trigger("click")}});return this},handleModalBackdropEvent:function(){this.getModal().on("click",{dialog:this},function(t){l(t.target).hasClass("modal-backdrop")&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByBackdrop()&&t.data.dialog.close()});return this},isModalEvent:function(t){return typeof t.namespace!=="undefined"&&t.namespace==="bs.modal"},makeModalDraggable:function(){if(this.options.draggable){this.getModalHeader().addClass(this.getNamespace("draggable")).on("mousedown",{dialog:this},function(t){var e=t.data.dialog;e.draggableData.isMouseDown=true;var n=e.getModalDialog().offset();e.draggableData.mouseOffset={top:t.clientY-n.top,left:t.clientX-n.left}});this.getModal().on("mouseup mouseleave",{dialog:this},function(t){t.data.dialog.draggableData.isMouseDown=false});this.draggableData.bodyMousemoveEvent=function(t){var e=t.data.dialog;if(!e.draggableData.isMouseDown){return}e.getModalDialog().offset({top:t.clientY-e.draggableData.mouseOffset.top,left:t.clientX-e.draggableData.mouseOffset.left})};l("body").on("mousemove",{dialog:this},this.draggableData.bodyMousemoveEvent)}return this},realize:function(){this.initModalStuff();this.getModal().addClass(a.NAMESPACE).addClass(this.getCssClass());this.updateSize();if(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 e(this.getModalForBootstrapDialogModal(),{backdrop:"static",keyboard:false,show:false}));this.makeModalDraggable();this.handleModalEvents();this.setRealized(true);this.updateButtons();this.updateType();this.updateTitle();this.updateMessage();this.updateClosable();this.updateAnimate();this.updateSize();this.updateTabindex();return this},open:function(){!this.isRealized()&&this.realize();this.getModal().modal("show");return this},close:function(){!this.isRealized()&&this.realize();this.getModal().modal("hide");return this}};a.prototype=l.extend(a.prototype,a.METHODS_TO_OVERRIDE[e.getModalVersion()]);a.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,n=t==="x"?e:e&3|8;return n.toString(16)})};a.show=function(t){return new a(t).open()};a.alert=function(){var t={};var e={type:a.TYPE_PRIMARY,title:null,message:null,closable:false,draggable:false,buttonLabel:a.DEFAULT_TEXTS.OK,callback:null};if(typeof arguments[0]==="object"&&arguments[0].constructor==={}.constructor){t=l.extend(true,e,arguments[0])}else{t=l.extend(true,e,{message:arguments[0],callback:typeof arguments[1]!=="undefined"?arguments[1]:null})}var n=new a(t);n.setData("callback",t.callback);n.addButton({label:t.buttonLabel,action:function(t){if(typeof t.getData("callback")==="function"&&t.getData("callback").call(this,true)===false){return false}t.setData("btnClicked",true);return t.close()}});if(typeof n.options.onhide==="function"){n.onHide(function(t){var e=true;if(!t.getData("btnClicked")&&t.isClosable()&&typeof t.getData("callback")==="function"){e=t.getData("callback")(false)}if(e===false){return false}e=this.onhide(t);return e}.bind({onhide:n.options.onhide}))}else{n.onHide(function(t){var e=true;if(!t.getData("btnClicked")&&t.isClosable()&&typeof t.getData("callback")==="function"){e=t.getData("callback")(false)}return e})}return n.open()};a.confirm=function(){var t={};var e={type:a.TYPE_PRIMARY,title:null,message:null,closable:false,draggable:false,btnCancelLabel:a.DEFAULT_TEXTS.CANCEL,btnCancelClass:null,btnOKLabel:a.DEFAULT_TEXTS.OK,btnOKClass:null,callback:null};if(typeof arguments[0]==="object"&&arguments[0].constructor==={}.constructor){t=l.extend(true,e,arguments[0])}else{t=l.extend(true,e,{message:arguments[0],callback:typeof arguments[1]!=="undefined"?arguments[1]:null})}if(t.btnOKClass===null){t.btnOKClass=["btn",t.type.split("-")[1]].join("-")}var n=new a(t);n.setData("callback",t.callback);n.addButton({label:t.btnCancelLabel,cssClass:t.btnCancelClass,action:function(t){if(typeof t.getData("callback")==="function"&&t.getData("callback").call(this,false)===false){return false}return t.close()}});n.addButton({label:t.btnOKLabel,cssClass:t.btnOKClass,action:function(t){if(typeof t.getData("callback")==="function"&&t.getData("callback").call(this,true)===false){return false}return t.close()}});return n.open()};a.prompt=function(){var t={};var e={type:a.TYPE_PRIMARY,title:null,message:null,inputType:"text",inputOptions:[],closable:false,draggable:false,btnCancelLabel:a.DEFAULT_TEXTS.CANCEL,btnCancelClass:null,btnCancelHotkey:null,btnOKLabel:a.DEFAULT_TEXTS.OK,btnOKClass:null,btnOKHotkey:null,btnOKId:null,btnsOrder:a.defaultOptions.btnsOrder,onshown:function(t){t.getModalBody().find("input, textarea, select").first().focus()},callback:null};if(typeof arguments[0]==="object"&&arguments[0].constructor==={}.constructor){t=l.extend(true,e,arguments[0])}else{t=l.extend(true,e,{title:arguments[0],callback:typeof arguments[1]!=="undefined"?arguments[1]:null})}if(t.btnOKClass===null){t.btnOKClass=["btn",t.type.split("-")[1]].join("-")}if(t.btnOKId===null){t.btnOKId=a.newGuid()}var n=new a(t);n.setData("callback",t.callback);n.setMessage(n.createPromptForm(t));var i=[{label:t.btnCancelLabel,cssClass:t.btnCancelClass,hotkey:t.btnCancelHotkey,action:function(t){if(typeof t.getData("callback")==="function"&&t.getData("callback").call(this,null)===false){return false}return t.close()}},{id:t.btnOKId,label:t.btnOKLabel,cssClass:t.btnOKClass,hotkey:t.btnOKHotkey,action:function(t){t.submitPromptForm()}}];if(t.btnsOrder===a.BUTTONS_ORDER_OK_CANCEL){i.reverse()}n.addButtons(i);return n.open()};a.warning=function(t,e){return new a({type:a.TYPE_WARNING,message:t}).open()};a.danger=function(t,e){return new a({type:a.TYPE_DANGER,message:t}).open()};a.success=function(t,e){return new a({type:a.TYPE_SUCCESS,message:t}).open()};return a});