(function(){function m(a,b,c){var d=a.getFirstChild();d&&(b?(a._fcvflex=d.getVflex(),a._fchflex=d.getHflex(),c&&"min"==d._vflex||d.setVflex(!0),c&&"min"==d._hflex||d.setHflex(!0)):(d.setVflex(a._fcvflex),d.setHflex(a._fchflex),delete a._fcvflex,delete a._fchflex))}zul.layout.LayoutRegion=zk.$extends(zul.Widget,{_open:!0,_border:"normal",_maxsize:2E3,_minsize:0,_scrollbar:null,_slidable:!0,_closable:!0,$init:function(){this.$supers("$init",arguments);this._margins=[0,0,0,0];this._cmargins=[3,3,3,3]},
$define:{flex:function(a){m(this,a);this.rerender()},border:function(a){a&&"0"!=a||(this._border="none");this.desktop&&((this.$n("real")||{})._lastSize=null);this.updateDomClass_()},title:function(){this.rerender()},splittable:function(a){this.parent&&this.desktop&&this.parent.resize()},maxsize:null,minsize:null,collapsible:function(a){var b=this.$n(this._open?"btn":"btned");!b||a&&!this._closable||(b.style.display=a?"":"none")},autoscroll:function(a){var b=this.$n("cave");b&&(b=this.isFlex()&&this.getFirstChild()?
this.getFirstChild().$n():b,a?this._nativebar?(b.style.overflow="auto",b.style.position="relative",this.domListen_(b,"onScroll"),zWatch.listen({onResponse:this})):zWatch.listen({onSize:this}):this._nativebar?(b.style.overflow="hidden",b.style.position="",this.domUnlisten_(b,"onScroll"),zWatch.unlisten({onResponse:this})):zWatch.unlisten({onSize:this}),this._fireSizedIfChildFlex())},open:function(a,b,c){if(this.$n()&&this.isCollapsible()&&this.parent&&(b||this._closable)){c=this.parent._animationDisabled||
c;var d=this.$n("colled"),g=this.$n("real");if(a){if(b){if(!zk(this.$n()).isRealVisible()){d&&(jq(g).show(),jq(d).hide());return}var f=this.$n("real").style;f.visibility="hidden";f.display="";this._syncSize(!0);f.visibility="";f.display="none";this._open=!0}d&&(c?(jq(g).show(),jq(d).hide(),zUtl.fireShown(this)):zk(d).slideOut(this,{anchor:this.sanchor,duration:200,afterAnima:b?this.$class.afterSlideOut:this.$class._afterSlideOutX}))}else d&&!c?zk(g).slideOut(this,{anchor:this.sanchor,beforeAnima:this.$class.beforeSlideOut,
afterAnima:b?this.$class.afterSlideOut:this.$class._afterSlideOutX}):(d&&jq(d).show(),jq(g).hide());c&&this.parent.resize();!b&&c&&this.fire("onOpen",{open:a})}},slide:function(a,b,c){if(this._isSlide)c?this.$class.afterSlideUp.apply(this,[this.$n("real")]):zk(this.$n("real")).slideUp(this,{anchor:this.sanchor,afterAnima:this.$class.afterSlideUp});else{this._isSlide=!0;c=this.$n("real");var d=c.style;d.visibility="hidden";d.display="";this._syncSize();this._original=[d.left,d.top];this._alignTo();
d.zIndex=100;this.$n("btn")&&(this.$n("btn").style.display="none");d.visibility="";d.display="none";jq(this.$n()).addClass(this.$s("slide"));zk(c).slideDown(this,{anchor:this.sanchor,afterAnima:this.$class.afterSlideDown})}b||this.fire("onSlide",{slide:a})},slidable:null,closable:function(a){this.desktop&&this._collapsible&&(jq(this.$n("btn")).toggle(a),jq(this.$n("btned")).toggle(a),jq(this.$n("splitbtn")).toggleClass(this.$s("splitter-button-disabled"),!a))}},setVflex:function(a){"min"!=a&&(a=!1);
this.$super(zul.layout.LayoutRegion,"setVflex",a)},setHflex:function(a){"min"!=a&&(a=!1);this.$super(zul.layout.LayoutRegion,"setHflex",a)},getCmargins:function(){return zUtl.intsToString(this._open?this._margins:this._cmargins)},setCmargins:function(a){this.getCmargins()!=a&&(this._cmargins=zUtl.stringToInts(a,0),this.parent&&this.desktop&&this.parent.resize())},getCurrentMargins_:function(){return zul.layout.LayoutRegion._aryToObject(this._open?this._margins:this._cmargins)},getMargins:function(){return zUtl.intsToString(this._margins)},
setMargins:function(a){this.getMargins()!=a&&(this._margins=zUtl.stringToInts(a,0),this.parent&&this.desktop&&this.parent.resize())},domClass_:function(a){var b=this.$supers("domClass_",arguments);if(!a||!a.zclass){var c="normal"==this.getBorder()?"":this.$s("noborder");c&&(b+=(b?" ":"")+c)}return b},getZclass:function(){return null==this._zclass?"z-"+this.getPosition():this._zclass},getMarginSize_:function(a){return zk(this.$n("real")).sumStyles("h"==a?"tb":"lr",jq.margins)},setWidth:function(a){this._width=
a;var b=this.$n("real");b&&(b.style.width=a?a:"",b._lastSize=null,this.parent.resize());return this},setHeight:function(a){this._height=a;var b=this.$n("real");b&&(b.style.height=a?a:"",b._lastSize=null,this.parent.resize());return this},setVisible:function(a){if(this._visible!=a){this.$supers("setVisible",arguments);var b=this.$n("real"),c=this.$n("colled");b&&(this._visible?this._open?(jq(b).show(),c&&jq(c).hide()):(jq(b).hide(),c&&jq(c).show()):(jq(b).hide(),c&&jq(c).hide()),this.parent.resize())}return this},
setFlexSize_:function(a,b){if(!this._cssflex||null==this.parent.getFlexContainer_()||b){b=this.$n("real");var c=b.style;if(void 0!==a.height)if("auto"==a.height)c.height="";else if(""==a.height)c.height=this._height?this._height:"";else{var d=this.$n("cave"),g=this.$n("cap");d=d&&"min"!=this._vflex?d.offsetHeight+d.offsetTop:a.height-zk(b).marginHeight();g&&(d+=g.offsetHeight);c.height=jq.px0(d)}void 0!==a.width&&("auto"==a.width?b.style.width="":""==a.width?b.style.width=this._width?this._width:
"":(a=a.width-zk(b).marginWidth(),b.style.width=jq.px0(a)))}},updateDomClass_:function(){if(this.desktop){var a=this.$n("real");a&&(a.className=this.domClass_(),this.parent&&this.parent.resize())}},updateDomStyle_:function(){if(this.desktop){var a=this.$n("real");a&&(zk(a).clearStyles().jq.css(jq.parseStyle(this.domStyle_())),this.parent&&this.parent.resize())}},onChildAdded_:function(a){this.$supers("onChildAdded_",arguments);a.$instanceof(zul.layout.Borderlayout)&&(this._flex=!0,jq(this.$n()).addClass(this.$s("nested")));
this.isFlex()&&m(this,!0,!0);(this.$n("real")||{})._lastSize=null;this.parent&&this.desktop&&this.parent.isRealVisible({dom:!0})&&this.parent.resize()},onChildRemoved_:function(a){this.$supers("onChildRemoved_",arguments);this.isFlex()&&m(this,!1);a.$instanceof(zul.layout.Borderlayout)&&(this._flex=!1,jq(this.$n()).removeClass(this.$s("nested")));(this.$n("real")||{})._lastSize=null;this.parent&&this.desktop&&!this.childReplacing_&&this.parent.isRealVisible({dom:!0})&&this.parent.resize()},rerender:function(){this.$supers("rerender",
arguments);this.parent&&this.parent.resize();return this},bind_:function(){this.$supers(zul.layout.LayoutRegion,"bind_",arguments);if(this.getPosition()!=zul.layout.Borderlayout.CENTER){var a=this.$n("split");if(a){this._fixSplit();var b=this._isVertical(),c=this.$class;this._drag=new zk.Draggable(this,a,{constraint:b?"vertical":"horizontal",ghosting:c._ghosting,snap:c._snap,zIndex:12E3,overlay:!0,initSensitivity:0,ignoredrag:c._ignoredrag,endeffect:c._endeffect});this._open||(a=this.$n("colled"),
b=this.$n("real"),a&&jq(a).show(),jq(b).hide());this._visible||(a=this.$n("colled"),b=this.$n("real"),jq(b).hide(),a&&jq(a).hide())}}this._open&&!this.isVisible()&&(this.$n().style.display="none");this.isAutoscroll()&&(this._nativebar?(a=this.isFlex()&&this.getFirstChild()?this.getFirstChild().$n():this.$n("cave"),this.domListen_(a,"onScroll")):zWatch.listen({onSize:this}));this.isFlex()&&m(this,!0,!0)},unbind_:function(){if(this.isAutoscroll())if(this._nativebar){var a=this.isFlex()&&this.getFirstChild()?
this.getFirstChild().$n():this.$n("cave");this.domUnlisten_(a,"onScroll")}else zWatch.unlisten({onSize:this});this.destroyBar_();this.$n("split")&&this._drag&&(this._drag.destroy(),this._drag=null);this.isFlex()&&m(this,!1);this.$supers(zul.layout.LayoutRegion,"unbind_",arguments)},afterChildMinFlexChanged_:function(a,b){if(this.desktop){a=this.$n("cave");var c=this.$n("real");a&&(a.style["h"==b?"height":"width"]="");c&&(c.style["h"==b?"height":"width"]="");this.parent._resize()}},onSize:function(){var a=
this;if(this._fixBarHeight&&this.firstChild){var b=this.firstChild.$n();b&&(b.style.height="")}setTimeout(function(){if(a.desktop){var c=a.$n("cave");!a._scrollbar&&!a._nativebar&&c&&c.firstChild&&(a._scrollbar=a.initScrollbar_());a.refreshBar_()}},200)},initScrollbar_:function(){var a=this,b=!1!==jq(a.$n("real")).data("embedscrollbar"),c=a.$n("cave");return new zul.Scrollbar(c,c.firstChild,{embed:b,onScrollEnd:function(){a._doScroll()}})},refreshBar_:function(a,b){var c=this._scrollbar;if(c&&this._open){var d=
this.$n("cave"),g=this.firstChild;g=g?g.getHeight():0;var f=d.firstChild;for(d=d.offsetHeight;f&&3==f.nodeType;)f=f.nextSibling;if(f){var e=f.style;g&&g.indexOf("px")?this._fixBarHeight=!1:(e.height="",e.height=jq.px(f.scrollHeight>=d?f.scrollHeight:d),this._fixBarHeight=!0);c.scroller=f;c.syncSize(a);b&&c.scrollTo(0,0)}}},destroyBar_:function(){var a=this._scrollbar;a&&(a.destroy(),this._scrollbar=null)},doResizeScroll_:function(){this.$supers("doResizeScroll_",arguments);this.refreshBar_(!0)},onResponse:function(){this._fireSizedIfChildFlex()},
_fireSizedIfChildFlex:function(){for(var a=this.firstChild;a;a=a.nextSibling)if(0<a._nvflex||0<a._nhflex){zUtl.fireSized(this);break}},doClick_:function(a){var b=a.domTarget;b.id||(b=b.parentNode);switch(b){case this.$n("colled"):case this.$n("title"):if(this._slidable){this.setSlide(!this._isSlide);break}case this.$n("btn"):case this.$n("btned"):case this.$n("splitbtn"):if(!this.isCollapsible()||this._isSlide||zk.animating()||!this._closable)return;this._open||(b=this.$n("real").style,b.visibility=
"hidden",b.display="",this._syncSize(!0),b.visibility="",b.display="none");this.setOpen(!this._open)}this.$supers("doClick_",arguments)},_docClick:function(a){a=a.target;if(this._isSlide&&!jq.isAncestor(this.$n("real"),a)){var b=this.$n("btned");!this._closable||b!=a&&b!=a.parentNode?this.$class.uuid(a)==this.uuid&&zk.animating()||this.setSlide(!1):(this.setSlide(!1,!1,!0),this.setOpen(!0,!1,!0),this.$n("real").style.zIndex="")}},_syncSize:function(a){var b=this.parent,c=b.$n(),d=c.offsetWidth,g=
c.offsetHeight,f=0,e=g;this._open=!0;for(var l=["north","south","west","east"],h=0,p=l.length;h<p;++h)if((c=b[l[h]])&&(zk(c.$n()).isVisible()||zk(c.$n("colled")).isVisible())){var n=c==this,k=c._ambit(n),q=this.$class;switch(l[h]){case "north":case "south":k.w=d-k.w;"north"==l[h]?f=k.ts:k.y=g-k.y;e-=k.ts;if(n){k.w=this.$n("colled").offsetWidth;a&&(a=q._aryToObject(this._cmargins),k.w+=a.left+a.right);b._resizeWgt(c,k,!0);this._open=!1;return}break;default:if(k.y+=f,k.h=e-k.h,"east"==l[h]&&(k.x=d-
k.x),n){k.h=this.$n("colled").offsetHeight;a&&(a=q._aryToObject(this._cmargins),k.h+=a.top+a.bottom);b._resizeWgt(c,k,!0);this._open=!1;return}}}},_alignTo:function(){var a=this.$n("colled"),b=this.$n("real"),c=b.style,d=zul.layout.Borderlayout;switch(this.getPosition()){case d.NORTH:c.top=jq.px(a.offsetTop+a.offsetHeight);c.left=jq.px(a.offsetLeft);break;case d.SOUTH:c.top=jq.px(a.offsetTop-b.offsetHeight);c.left=jq.px(a.offsetLeft);break;case d.WEST:c.left=jq.px(a.offsetLeft+a.offsetWidth);c.top=
jq.px(a.offsetTop);break;case d.EAST:c.left=jq.px(a.offsetLeft-b.offsetWidth),c.top=jq.px(a.offsetTop)}},_doScroll:function(){zWatch.fireDown("onScroll",this);zWatch.fire("_onSyncScroll",this)},_fixSplit:function(){var a=this.$n("split");a&&(a.style.display=this._splittable?"block":"none")},_fixFontIcon:function(){zk(this).redoCSS(-1,{fixFontIcon:!0,selector:".z-borderlayout-icon"})},_isVertical:function(){var a=zul.layout.Borderlayout;return this.getPosition()!=a.WEST&&this.getPosition()!=a.EAST},
_ambit:function(a){var b=this.getCurrentMargins_();if(this.getPosition()&&!this._open){a=this.$n("colled");var c={x:b.left,y:b.top,w:a?a.offsetWidth:0,h:a?a.offsetHeight:0};a=!0}else{c=this.parent.$n();var d=this.getWidth()||"",g=this.getHeight()||"",f;c={x:b.left,y:b.top,w:0<(f=d.indexOf("%"))?Math.max(Math.floor(c.offsetWidth*zk.parseInt(d.substring(0,f))/100),0):this.$n("real").offsetWidth,h:0<(f=g.indexOf("%"))?Math.max(Math.floor(c.offsetHeight*zk.parseInt(g.substring(0,f))/100),0):this.$n("real").offsetHeight}}f=
a?{offsetHeight:0,offsetWidth:0}:this.$n("split")||{offsetHeight:0,offsetWidth:0};a||this._fixSplit();this._ambit2(c,b,f);return c},_ambit2:zk.$void,setBtnPos_:function(a,b){var c=this.$n("splitbtn");b?c.style.marginLeft=jq.px0((a.w-c.offsetWidth)/2):c.style.marginTop=jq.px0((a.h-c.offsetHeight)/2)},_reszSplt:function(a){var b=this.$n("split"),c=this.$n("splitbtn");zk(b).isVisible()&&(zk(c).isVisible()&&this.setBtnPos_(a,this._isVertical()),zk.copy(b.style,this._reszSp2(a,{w:b.offsetWidth,h:b.offsetHeight})));
return a},_reszSp2:zk.$void,getIconClass_:function(a){var b=zul.layout.Borderlayout;switch(this.getPosition()){case b.NORTH:return a?"z-icon-angle-double-down":"z-icon-angle-double-up";case b.SOUTH:return a?"z-icon-angle-double-up":"z-icon-angle-double-down";case b.WEST:return a?"z-icon-angle-double-right":"z-icon-angle-double-left";case b.EAST:return a?"z-icon-angle-double-left":"z-icon-angle-double-right"}return""},titleRenderer_:function(a){if(this._title){var b=this.uuid,c=this.getPosition()!=
zul.layout.Borderlayout.CENTER,d=this.parent;a.push('<div id="',b,'-cap" class="',this.$s("header"),'">');c&&(a.push('<i id="',b,'-btn" class="',d.$s("icon")," ",this.getIconClass_(),'"'),this._collapsible&&this._closable||a.push(' style="display:none;"'),a.push("></i>"));a.push(zUtl.encodeXML(this._title),"</div>")}},getFirstChild:function(){return this.firstChild}},{_aryToObject:function(a){return{top:a[0],left:a[1],right:a[2],bottom:a[3]}},beforeSlideOut:function(a){a=this.$n("colled").style;a.display=
"";a.visibility="hidden";a.zIndex=1;this.parent.resize()},_afterSlideOutX:function(a){this.$class.afterSlideOut.call(this,a,!0);this._fixFontIcon()},afterSlideOut:function(a,b){if(this._open)zk(this.$n("real")).slideIn(this,{anchor:this.sanchor,afterAnima:b?this.$class._afterSlideInX:this.$class.afterSlideIn});else{a=this.$n("colled");var c=a.style;c.zIndex="";c.visibility="";zk(a).slideIn(this,{anchor:this.sanchor,duration:200,afterAnima:b?function(d){this.fire("onOpen",{open:this._open})}:zk.$void})}this._fixFontIcon()},
_afterSlideInX:function(a){this.$class.afterSlideIn.call(this,a);this.fire("onOpen",{open:this._open});this._fixFontIcon()},afterSlideIn:function(a){this.parent.resize();this._fixFontIcon()},afterSlideDown:function(a){jq(document).on("click",this.proxy(this._docClick));this._fixFontIcon()},afterSlideUp:function(a){var b=a.style;b.left=this._original[0];b.top=this._original[1];a._lastSize=null;b.zIndex="";this.$n("btn")&&(this.$n("btn").style.display=this._closable?"":"none");jq(this.$n()).removeClass(this.$s("slide"));
jq(document).off("click",this.proxy(this._docClick));this._isSlide=!1;this._fixFontIcon()},_ignoredrag:function(a,b,c){c=c.domTarget;b=a.control;var d=b.$n("split");if(!c||d!=c&&!jq.contains(d,c))return!0;if(b.isSplittable()&&b._open){var g=zul.layout.Borderlayout,f=b.getPosition();c=b.getMaxsize();d=b.getMinsize();var e=b.parent,l=b.$n("real"),h=zul.layout.LayoutRegion._aryToObject(b._margins),p=zk(l).padBorderWidth(),n=p+(f==g.WEST?h.left:h.right);h=p+(f==g.NORTH?h.top:h.bottom);switch(f){case g.NORTH:case g.SOUTH:c=
(f=e.center||(f==g.NORTH?e.south:e.north))?g.CENTER==f.getPosition()?Math.min(c,l.offsetHeight+f.$n("real").offsetHeight-0):Math.min(c,e.$n().offsetHeight-f.$n("real").offsetHeight-f.$n("split").offsetHeight-b.$n("split").offsetHeight):e.$n().offsetHeight-b.$n("split").offsetHeight;break;case g.WEST:case g.EAST:c=(f=e.center||(f==g.WEST?e.east:e.west))?g.CENTER==f.getPosition()?Math.min(c,l.offsetWidth+f.$n("real").offsetWidth-0):Math.min(c,e.$n().offsetWidth-f.$n("real").offsetWidth-f.$n("split").offsetWidth-
b.$n("split").offsetWidth):e.$n().offsetWidth-b.$n("split").offsetWidth}b=zk(l).cmOffset();a._rootoffs={maxs:c,mins:d,top:b[1]+h,left:b[0]+n,right:l.offsetWidth,bottom:l.offsetHeight};return!1}return!0},_endeffect:function(a,b){var c=a.control;c._isVertical()?c.setHeight(a._point[1]+"px"):c.setWidth(a._point[0]+"px");c.$n().style.zIndex="";a._rootoffs=a._point=null;c.parent.resize();c.fire("onSize",zk.copy({width:c.$n("real").style.width,height:c.$n("real").style.height},b.data))},_snap:function(a,
b){var c=a.control,d=b[0];b=b[1];var g=zul.layout.Borderlayout,f=c.$n("split"),e=a._rootoffs;switch(c.getPosition()){case g.NORTH:b>e.maxs+e.top&&(b=e.maxs+e.top);b<e.mins+e.top&&(b=e.mins+e.top);var l=d;var h=b-e.top;break;case g.SOUTH:e.top+e.bottom-b-f.offsetHeight>e.maxs?(b=e.top+e.bottom-e.maxs-f.offsetHeight,h=e.maxs):e.top+e.bottom-e.mins-f.offsetHeight<=b?(b=e.top+e.bottom-e.mins-f.offsetHeight,h=e.mins):h=e.top-b+e.bottom-f.offsetHeight;l=d;break;case g.WEST:d>e.maxs+e.left&&(d=e.maxs+e.left);
d<e.mins+e.left&&(d=e.mins+e.left);l=d-e.left;h=b;break;case g.EAST:e.left+e.right-d-f.offsetWidth>e.maxs?(d=e.left+e.right-e.maxs-f.offsetWidth,l=e.maxs):e.left+e.right-e.mins-f.offsetWidth<=d?(d=e.left+e.right-e.mins-f.offsetWidth,l=e.mins):l=e.left-d+e.right-f.offsetWidth,h=b}a._point=[l,h];return[d,b]},_ghosting:function(a,b,c){a=a.node;c=zk(a);jq(document.body).prepend('<div id="zk_layoutghost" class="z-splitter-ghost" style="font-size:0;line-height:0;background:#AAA;position:absolute;top:'+
b[1]+"px;left:"+b[0]+"px;width:"+c.offsetWidth()+"px;height:"+c.offsetHeight()+"px;cursor:"+a.style.cursor+';"></div>');return jq("#zk_layoutghost")[0]}})})();
