"use strict";var WindowDialog=function(i,t,n,e,o,a,l,s,d){this.id=i,this.dialogWidthPercent=n,this.buttonSettings=e,this.cssClasses=o,this.openAfterInit=a,this.contentCreationAdditionalCallback=l,this.contentPage=s,this.contentObject=d,this.$dialogWrapper=null,this.$dialogTitleElement=null,Util.isInitialized(t)&&s.prepend('<div dialogtitle="'+t+'"></div>'),Util.isInitialized(d)&&this.init(d)};WindowDialog.currentlyOpenedDialog=null,WindowDialog.hideCurrentlyOpenedDialog=function(){WindowDialog.currentlyOpenedDialog&&WindowDialog.currentlyOpenedDialog.close()},WindowDialog.prototype.init=function(i){var t=this;this.contentObject=i;var n=this.contentObject.additionalTranslationCallback;this.contentObject.additionalTranslationCallback=function(){Util.isInitialized(n)&&n(t.contentObject)};var e=function(){this.$dialog.removeAttr("style")}.bind(this);this.$dialog=$("<div id='"+this.id+"' class='windowDialog "+(Util.isInitialized(this.cssClasses)?this.cssClasses:"")+"'></div>");var o=function(){this.$dialog.dialog({closeOnEscape:!0,autoOpen:!1,draggable:!1,resizable:!1,modal:!1,buttons:[],close:function(){window.removeEventListener("optimizedResize",e),appMain.unfreezeApplication()},open:function(){window.addEventListener("optimizedResize",e),appMain.freezeApplication(),t.contentObject.translate()}})}.bind(this),a=function(i){o();var n=assetLoader.makeDummyJob("window dialog "+t.id+" init job",!1,function(){if(t.$dialogWrapper=t.$dialog.parent(),t.$dialogWrapper.attr("id",t.id+"Wrapper"),t.$dialogWrapper.removeAttr("style"),Util.isInitialized(t.cssClasses))for(var n=t.cssClasses.split(" "),e=0;e<n.length;e++)t.$dialogWrapper.addClass(n[e]+"-wrapper");Gui.replaceElementWithCloseCrossButton(t.$dialogWrapper.find(".ui-dialog-titlebar button"),function(){t.close()}),t.$dialogWrapper=t.$dialog.parent(),t.contentObject.init(t.$dialogWrapper),gui.mainMenu&&gui.mainMenu.initTransformLinksToTabs(t.$dialog,function(){t.close()}),t.$dialogTitleElement=t.$dialogWrapper.find(".ui-dialog-title"),t.$dialogTitleElement.addClass("unselectable"),i&&t.openDialog()});Util.isInitialized(t.contentCreationAdditionalCallback)&&t.contentCreationAdditionalCallback(t,n),n.startJob()};"string"==typeof this.contentPage?this.$dialog.load(this.contentPage,function(){a(t.openAfterInit)}):(this.$dialog.append(this.contentPage),a(t.openAfterInit))},WindowDialog.prototype.openDialog=function(){this.$dialog.dialog("isOpen")||this.$dialog.dialog("open"),gui.showModalBehind(!0),this.$dialogWrapper.addClass("window-open"),WindowDialog.currentlyOpenedDialog=this},WindowDialog.prototype.close=function(){this.$dialog.dialog("isOpen")&&this.$dialog.dialog("close"),gui.showModalBehind(!1),this.$dialogWrapper.removeClass("window-open"),WindowDialog.currentlyOpenedDialog=null},WindowDialog.prototype.getDialogWrapper=function(){return this.$dialogWrapper},WindowDialog.prototype.getDialog=function(){return this.$dialog};