text: window.zmsDialog=window.zmsDialog||{},function(a){"use strict";var b,c,d=a||{},e=new zmail.Navigator({onEscape:function(){zmsDialog.remove()}}),f=function(a){a.$el&&a.$el.addClass("sel")},g=function(a){a.$el&&a.$el.removeClass("sel")},h=function(a){var b=e.dom;a=a||[],a.forEach(function(a,c){e.focused<0&&(e.focused=a.selected?c:-1),b.push({isArrowKeyAllowed:!0,$el:a.$el,onFocus:f,onBlur:g,onEnter:a.callback})}),e.setThisAsCurrentNavigator()},i={conBtn:function(a){var b,c,d,e=0;for(a&&(e=a.length),d=$("<div class='SC_PUbtm'/>"),b=0;b<e;b++)c=$("<span/>"),a[b].$el=c,c.html(a[b].txt),c.on("click",a[b].callback),a[b].selected?c.addClass("sel"):a[b].isCancel&&c.attr("data-val","Cancel"),d.append(c);return d},conPtr:function(a){var b=$("<div/>");return"top"===a?b.addClass("SC_arr SC_arrt"):"tleft"===a?b.addClass("SC_arr SC_arrtl"):"tright"===a?b.addClass("SC_arr SC_arrtr"):"bottom"===a?b.addClass("SC_arr SC_arrb"):"bleft"===a?b.addClass("SC_arr SC_arrbl"):"bright"===a&&b.addClass("SC_arr SC_arrbr"),b}},j={dragMove:function(a,d){var e,f,g,h,i=$("#zmsdialog_"+zmsDialog.elemId);g=a.pageX,h=a.pageY,e=g-b,f=h-c,d(i,e,f,g,h),b=g,c=h},setDrag:function(a,d){a.on("mousedown",function(a){b=a.pageX,c=a.pageY,a.preventDefault(),$(document).mousemove(function(a){j.dragMove(a,d)}),$(document).mouseup(function(){$(document).off("mousemove")})})},movePopup:function(a,b,c){var d=$(document.body).width(),e=$(document.body).height(),f=a.width(),g=a.height(),h=a.offset();h.left+b<=0?a.css("left","0px"):h.left+f+b>=d?a.css("left",d-f+"px"):a.css("left",h.left+b+"px"),h.top+c<=0?a.css("top","0px"):h.top+g+c+13>=e?a.css("top",e-g-13+"px"):a.css("top",h.top+c+"px")},resPopup:function(a,b,c,d,e){var f=$(document.body).width(),g=$(document.body).height(),h=a.width(),i=a.height(),j=a.offset();d+b>=f?a.width(f-j.left):a.width(b+h),e>=g?a.height(g-j.top-13):a.height(c+i)}},k={elemId:null,create:function(a,b){var c,d,e,f,g,k,l,m,n,o,p,q,r,s,t="",u="",v="",w=0,x=void 0===b.defaultNavigator||b.defaultNavigator;if(this.elemId=a,this.closeaction=b.closeaction,this.options=b,q="SC_Pop ",b.customClass&&(q+=" "+b.customClass),b.style)for(var y in b.style)u+=y+":"+b.style[y]+";";if(b.posParent||(q+=" SC_cent"),$("#zmsdialog_"+a).length)return $("#zmsdialog_"+a).attr("style",u),void $("#zmsdialog_"+a).show();if(t+='<div class="'+q+'"><div class="SC_pe"><div id="zmsdialog_'+a+'" class="SC_PU">',t+='<div id="zmsdialogcont_'+a+'" class="SC_PUcen"></div></div></div></div>',$("#"+a).wrap(t),l=$("#zmsdialog_"+a),l.attr("style",u),b.posParent&&l.parents(".SC_Pop").css(b.posParent),b.stopPropagation&&l.on("mousedown",function(a){zmUtil.stopEvents(a)}),b.title){v+='<div class="SC_PUtt"><h3>';var z="hdr_actions",A=b[z];if(A)for(var B=0,C=A.length;B<C;B++)v+='<i class="SC_lnk">'+A[B].text+"</i>";else{var D=zmText.get("dialog","tooltips.close");v+='<div class="SCmb"><div class="SC_frt"><ul><li><b><div class="SC_hd"></div><span data-tooltip="'+D+'" class="SC_ttip ttr"><i class="msi-close"></i></span></b></li></ul></div></div>'}v+=b.title,v+="</h3></div>",$("#zmsdialogcont_"+a).before(v)}if(b.buttons&&b.buttons.length&&(c=i.conBtn(b.buttons),$("#zmsdialogcont_"+a).after(c)),x&&h(b.buttons),b.hideButtons&&$("#zmsdialog_"+a).find(".SC_PUbtm").addClass("SC_vh"),b.bottom&&$("#zmsdialogcont_"+a).after("<div class='SC_PUbtm'>"+b.bottom+"</div>"),b.ptr&&$("#zmsdialogcont_"+a).after(i.conPtr(b.ptr)),b.res){var E=$("<div/>");E.css({position:"absolute",bottom:"0px",right:"0px",width:"10px",height:"10px",background:"grey"}),$("#zmsdialogcont_"+a).after(E),j.setDrag($("#zmsdialog_"+a+" div"),j.resPopup)}l.show(),$("#"+a).show(),setTimeout(function(){b.mask?l.parents(".SC_Pop").addClass("wht"):l.parents(".SC_Pop").addClass("tra"),b.afterDisplay&&setTimeout(function(){b.afterDisplay()},100)},500),k=$(document.body),m=k.height(),n=k.width(),o=l.height(),p=l.width(),b.pos&&("center"===b.pos?(d=m/2-o/2,e=n/2-p/2):"tleft"===b.pos?(d="10%",e="10%"):"tcenter"===b.pos?(d="10%",e=n/2-p/2):"tright"===b.pos?(d="10%",f="10%"):"mleft"===b.pos?(e="10%",d=m/2-o/2):"mright"===b.pos?(f="10%",d=m/2-o/2):"bleft"===b.pos?(e="10%",d=.9*(m-o)):"bcenter"===b.pos?(d=.9*(m-o),e=n/2-p/2):"bright"===b.pos?(d=.9*(m-o),f="10%"):"onevent"===b.pos&&(g=b.onelem.offset(),d=g.top+b.onelem.height()+3,e=g.left,d+o>m&&(d=m-o-20),e+p>n&&(e=n-p-20))),l.css("top",d),e?l.css("left",e):l.css("right",f),r=l.find(".SC_PUtt").height()||0,w&&(w=c.height()||0),m=$(document.body).height(),window.isFinite(b.heightPercent)&&(b.heightPercent=window.parseInt(b.heightPercent),m*=b.heightPercent/100),s=m-(r+w+100),b.notToSetMaxHeight||$("#zmsdialogcont_"+a).css("max-height",s+"px"),b.hideclose?$("#zmsdialog_"+a+" .SC_PUtt i.msi-close").hide():$("#zmsdialog_"+a+" .SC_PUtt i.msi-close").closest("span").click(function(){zmsDialog.remove()}),b.drag&&j.setDrag($("#zmsdialog_"+a).children(":first"),j.movePopup),b.posParent&&$.publish("/mail/menuCreated",[{element:l.parents(".SC_Pop")[0],menuHandler:this.remove.bind(this)}])},remove:function(a){var b=this,c=$("#"+zmsDialog.elemId);e.clearTrace(),c.parents(".SC_Pop").removeClass("wht tra"),setTimeout(function(){var c,d=zmsDialog.elemId;$("#"+d).hide(),c=$("#zmsdialogcont_"+d).contents(),$("#zmsdialog_"+d).parents(".SC_Pop").replaceWith(c),$("#zmsMask").remove(),b.closeaction&&(a||b.closeaction(),b.closeaction=null),zmsDialog.elemId=null,$.publish("zm/framework/dialogClosed",{id:d})},500)},hide:function(){var a=$("#"+zmsDialog.elemId);a.parents(".SC_Pop").removeClass("wht tra"),setTimeout(function(){$("#zmsdialog_"+zmsDialog.elemId).parents(".SC_Pop").hide(),$("#zmsMask").remove()},500)},succErrMsg:function(a,b,c){c=c||{},c.parElem=c.parElem||$("#"+zmsDialog.elemId)[0],_zm.succErrMsg(a,b,c)},showButtons:function(){$("#zmsdialog_"+zmsDialog.elemId).find(".SC_PUbtm").removeClass("SC_vh")},hideButtons:function(){$("#zmsdialog_"+zmsDialog.elemId).find(".SC_PUbtm").addClass("SC_vh")},isOpen:function(){return null!==zmsDialog.elemId},listenOnceDialogClose:function(a){if("function"==typeof a){var b=function(){$.unsubscribe("zm/framework/dialogClosed",b),a()};$.subscribe("zm/framework/dialogClosed",b)}}};return $.extend(!0,d,k),d}(zmsDialog),window.zmsDialog=function(a){"use strict";var b="zm_AlertText",c=function(b,c){return c=c||{},c.buttons=c.buttons||[{txt:zmText.get("dialog","ok"),selected:!0}],c.mask=c.mask||!0,c.pos=c.pos||"center",c.closeaction=function(){_zm.remove(b)},c.buttons[0].callback=function(){a.remove(),c.onOk&&c.onOk()},c},d=function(b,c){return c=c||{},c.buttons=c.buttons||[{txt:zmText.get("dialog","ok"),selected:!0},{txt:zmText.get("dialog","cancel"),isCancel:!0}],c.mask=c.mask||!0,c.closeaction=function(){_zm.remove(b)},c.buttons[0].callback=function(){a.remove(),c.onOk&&c.onOk(),c.onHide&&c.onHide()},c.buttons[1].callback=function(){a.remove(),_zm.remove(b),c.onCancel&&c.onCancel(),c.onHide&&c.onHide()},c},e=function(a){var c=zmComponent.htmlizer(["h4",{attrs:{id:b},child:[["text",a]]}]);return document.body.appendChild(c),c};return a.confirm=function(c,f){a.create(b,d(e(c),f))},a.alert=function(d,f){a.create(b,c(e(d),f))},a}(window.zmsDialog||{}),window.Dialog=function(a){"use strict";var b={},c={center:"SC_cent"},d={white:"wht",none:"tra"},e={maskWrapper:function(a){var b=a.maskWrapperClass;return b+=" "+c[a.position],b+=" "+d[a.mask],"<div class='"+b+"'></div>"},positionWrapper:function(a){return"<div class='"+a.positionWrapperClass+"'></div>"},contentWrapper:function(a){return"<div class='"+a.contentWrapperClass+"' style='"+(a.wrapperStyle||"")+"' ></div>"},icon:function(a,b,c){var d=a.delimiter?c.iconDelimiterClass:"";return"<li class='"+d+"'><b class='"+c.iconSelectorClass+"'  data-id='"+b+"'><div class='SC_hd' /><span><i class='"+a["class"]+"' /></span></b></li>"},iconGroup:function(a,b,c,d){var e=$("<ul/>"),f=this;return _.isArray(a)||(a=[a]),_(a).each(function(a,g){var h=b+"."+c+"."+g;return e.append($(f.icon(a,h,d)))}),e},iconGroupWrapper:function(){return $("<div class='SCmb'>")},closeIcon:function(a){a=a||{};var b=a.icons||{};if(b.closeIcon){var c=this.iconGroupWrapper();c.addClass("puClose");var d=$("<ul/>");return d.append(this.icon(b.closeIcon,"closeIcon",a)),c.append(d),c}},title:function(a){var b=$("<h3/>");return b.text(a),b},leftHeader:function(a){var b,c=$("<div class='SC_flt'>"),d=a.icons||{},e=this;return a.title&&c.append(this.title(a.title)),d.left&&(b=this.iconGroupWrapper(),_(d.left).each(function(c,d){b.append(e.iconGroup(c,"left",d,a))}),c.append(b)),c},rightHeader:function(a){var b,c=$("<div class='SC_frt'>"),d=a.icons||{},e=this;return d.right&&(b=this.iconGroupWrapper(),_(d.right).each(function(c,d){b.append(e.iconGroup(c,"right",d,a))}),c.append(b)),c},header:function(a,b){a=a||{},b=b||{};var c=$("<div class='"+a.headerClass+"'/>");return b.$leftHeader=this.leftHeader(a),c.append(b.$leftHeader),b.$rightHeader=this.rightHeader(a),c.append(b.$rightHeader),c},content:function(a){return a=a||{},"<div class='"+a.contentClass+"' style='"+(a.contentStyle||"")+"' >"},button:function(a,b,c){var d=a.isSelected?c.buttonSelectionClass:"",e=a.name,f=a.isCancel?"data-val='Cancel'":"",g=a.attrs||"";d+=" "+c.buttonSelectorClass;var h=$("<span class='"+d+"' data-id='"+b+"' "+f+" "+g+" />");return h.text(e),h},buttonContainer:function(a){var b=a.buttons,c=this;if(b&&b.length){var d=$("<div class='"+a.buttonContainerClass+"' ></div>");return _(b).each(function(b,e){d.append(c.button(b,e,a))}),d}return""}};return b.templates=e,_.extend(a,b),a}(window.Dialog||{}),window.Dialog=function(a){"use strict";var b={},c=function(a,b){var c=a.config,d=c.buttons,e=b.dom;if(d&&d.length){var f=function(a){a.$el&&a.$el.addClass(c.buttonSelectionClass)},g=function(a){a.$el&&a.$el.removeClass(c.buttonSelectionClass)},h=a.$els.$buttonContainer.children();_(d).each(function(c,d){b.focused<0&&(b.focused=c.isSelected?d:-1),e.push({isArrowKeyAllowed:!0,$el:$(h[d]),onFocus:f,onBlur:g,onEnter:function(){c.callback(a)}})})}},d=function(a){var b=new zmail.Navigator({onEscape:function(){a.remove()}});return c(a,b),b};return b.getDefaultNavigator=d,_.extend(a,b),a}(window.Dialog||{}),window.Dialog=function(a){"use strict";var b={},c=a.templates,d={getConfig:function(){return{maskWrapperClass:"SC_Pop",positionWrapperClass:"SC_pe",contentWrapperClass:"SC_PU",headerClass:"SC_PUtt",contentClass:"SC_PUcen",buttonContainerClass:"SC_PUbtm",buttonSelectionClass:"sel",buttonSelectorClass:"js-button-selector",iconSelectorClass:"js-icon-selector",iconDelimiterClass:"SC_lbr",position:"center",mask:"white",defaultCloseIcon:!0,ignoreMouseDown:!0,avoidDeepCleanOnRemoval:!1,defaultNavigator:!0}},getCloseIcon:function(){return{"class":"msi-close",callback:function(a){a.remove()}}},extendDefaults:function(a){var b=d.getConfig();return _.extend(b,a),b.defaultCloseIcon&&(b.icons=b.icons||{},b.icons.closeIcon=d.getCloseIcon()),b}},e={build:function(a){var b=a.$els,d=a.config,e=a.templates||c;b.$maskWrapper=$(e.maskWrapper(d)),b.$positionWrapper=$(e.positionWrapper(d)),b.$maskWrapper.append(b.$positionWrapper),b.$contentWrapper=$(e.contentWrapper(d)),b.$positionWrapper.append(b.$contentWrapper),d.defaultCloseIcon&&(b.$closeIcon=$(e.closeIcon(d)),b.$contentWrapper.append(b.$closeIcon)),(d.title||d.icons&&(d.icons.closeIcon||d.icons.left||d.icons.right))&&(b.$header=$(e.header(d,b)),b.$contentWrapper.append(b.$header)),b.$content=$(e.content(d)),b.$contentWrapper.append(b.$content),d.buttons&&d.buttons.length&&(b.$buttonContainer=$(e.buttonContainer(d)),b.$contentWrapper.append(b.$buttonContainer))}},f={buttonsCallbackInvoker:function(a,b,c){var d=a.config.buttons,e=d[b];e&&e.callback&&e.callback(a,c)},iconsCallbackInvoker:function(a,b,c){var d=a.config.icons||{},e=_zm.getProperty(d,b);e&&e.callback&&e.callback(a,c)},bindEvents:function(a){var b=a.config;a.$els.$buttonContainer&&a.$els.$buttonContainer.on("click","."+b.buttonSelectorClass,function(c){var d=$(c.target).closest("."+b.buttonSelectorClass).data("id");f.buttonsCallbackInvoker(a,d,c)});var c=function(c){var d=$(c.target).closest("."+b.iconSelectorClass).data("id");f.iconsCallbackInvoker(a,d,c)};a.$els.$closeIcon&&a.$els.$closeIcon.on("click","."+b.iconSelectorClass,c),a.$els.$header&&a.$els.$header.on("click","."+b.iconSelectorClass,c),a.config.ignoreMouseDown&&a.$els.$maskWrapper.on("mousedown",function(a){a.stopPropagation()})}},g={show:function(){this.$els.$maskWrapper.show(),this.config.navigator&&this.config.navigator.setThisAsCurrentNavigator()},hide:function(){this.$els.$maskWrapper.hide(),this.config.hideAction&&this.config.hideAction(this)},remove:function(){this.config.closeAction&&this.config.closeAction(this),this.$els.$maskWrapper.remove(),this.$els.$maskWrapper.remove(),this.config.navigator&&this.config.navigator.clearTrace(),this.config.avoidDeepCleanOnRemoval||(delete this.$els,delete this.config),$.publish("zm/framework/dialogClosed",{})}},h={init:function(a){return e.build(a),f.bindEvents(a),_.extend(a,g),this},dialogWillMount:function(a){return a.config.dialogWillMount&&a.config.dialogWillMount.call(a,a),this},_configureNavigator:function(b){var c=b.config;!c.navigator&&c.defaultNavigator&&(c.navigator=a.getDefaultNavigator(b)),c.navigator&&c.navigator.setThisAsCurrentNavigator()},mountDialog:function(a){var b=a.$dialogParent?$(a.$dialogParent):$("body");return b.append(a.$els.$maskWrapper),a.config.$content&&a.$els.$content.append(a.config.$content),this._configureNavigator(a),this},dialogDidMount:function(a){return a.config.dialogDidMount&&a.config.dialogDidMount.call(a,a),this}},i=function(a){var b={config:d.extendDefaults(a),$els:{}};return h.init(b).dialogWillMount(b).mountDialog(b).dialogDidMount(b),b};return b["new"]=i,_.extend(a,b),a}(window.Dialog||{}),window.Dialog=function(a){"use strict";var b={},c=function(b,c,d){var e=function(a,b){c&&c(a,b),a.remove()};return d=d||{},d.title=b,d.buttons=[{name:d.okButtonName||zmText.get("dialog","ok"),callback:e}],a["new"](d)};return b.alert=c,_.extend(a,b),a}(window.Dialog||{}),window.Dialog=function(a){"use strict";var b={},c=function(b,c,d,e){var f=function(a,b){c&&c(a,b),a.remove()},g=function(a,b){d&&d(a,b),a.remove()};return e=e||{},e.title=b,e.buttons=[{name:e.okButtonName||zmText.get("dialog","ok"),isSelected:!0,callback:f},{name:e.cancelButtonName||zmText.get("dialog","cancel"),callback:g,isCancel:!0}],a["new"](e)};return b.confirm=c,_.extend(a,b),a}(window.Dialog||{});