var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.checkStringArgs=function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};
$jscomp.polyfill("String.prototype.endsWith",function(a){return a?a:function(b,a){var c=$jscomp.checkStringArgs(this,b,"endsWith");b+="";void 0===a&&(a=c.length);a=Math.max(0,Math.min(a|0,c.length));for(var e=b.length;0<e&&0<a;)if(c[--a]!=b[--e])return!1;return 0>=e}},"es6","es3");
zul.tab.Tabs=zk.$extends(zul.Widget,{_tabsScrollLeft:0,_tabsScrollTop:0,getTabbox:function(){return this.parent},getWidth:function(){var a=this._width;if(!a){var b=this.getTabbox();if(b&&b.isVertical())return"50px"}return a},onSize:function(){this._fixWidth(!0);this._scrollcheck("init")},beforeSize:function(){var a=this.getTabbox(),b=a.getWidth(),c=this.$n().style;b&&!b.endsWith("%")&&"auto"!=b||a.inAccordionMold()||a.isVertical()||(this.$n("cave").style.width="",c.width&&(c.width="",a.isTabscroll()||
(a.$n().style.width="")))},insertChildHTML_:function(a,b,c){var d=a.previousSibling;b?jq(b).before(a.redrawHTML_()):d?jq(d).after(a.redrawHTML_()):(b=this.$n("edge"))?jq(b).before(a.redrawHTML_()):jq(this.getCaveNode()).append(a.redrawHTML_());a.bind(c)},setVflex:function(a){"min"!=a&&(a=!1);this.$super(zul.tab.Tabs,"setVflex",a)},setHflex:function(a){"min"!=a&&(a=!1);this.$super(zul.tab.Tabs,"setHflex",a)},bind_:function(a,b,c){this.$supers(zul.tab.Tabs,"bind_",arguments);zWatch.listen({onSize:this,
onResponse:this,beforeSize:this})},unbind_:function(){zWatch.unlisten({onSize:this,onResponse:this,beforeSize:this});this.$supers(zul.tab.Tabs,"unbind_",arguments)},_scrollcheck:function(a,b){this._shallCheck=!1;var c=this.getTabbox();if(this.desktop&&(!c||c.isRealVisible()&&c.isTabscroll())){var d=this.$n();var e=c.$n();if(d&&e)if(c.isVertical()){var f=d.offsetHeight,h=d.scrollTop,l=0;jq(this.$n("cave")).children().each(function(){l+=this.offsetHeight});if(c._scrolling){var k=this._getArrowSize();
if(!(d.offsetHeight<=k)){var g=c.getSelectedTab();g=(b=b?b.$n():g?g.$n():null)?b.offsetTop:0;b=b?b.offsetHeight:0;l<=f+k&&(c._scrolling=!1,this._showbutton(!1),d.style.height=jq.px0(e.offsetHeight-2),d.scrollTop=0);switch(a){case "end":a=l-f-h;this._doScroll(0<=a?"down":"up",0<=a?a:Math.abs(a));break;case "init":case "vsel":g<h?this._doScroll("up",h-g):g+b>h+f&&this._doScroll("down",g+b-h-f)}}}else 0<l-f?(c._scrolling=!0,this._showbutton(!0),k=this._getArrowSize(),e=e.offsetHeight-k,d.style.height=
0<e?e+"px":"","end"==a&&(a=l-f-h+2,0<=a&&this._doScroll(this.uuid,"down",a))):this._showbutton(!1)}else if(!c.inAccordionMold()){k=this.$n("cave");g=c.getSelectedTab();f=(b=b?b.$n():g?g.$n():null)?b.offsetLeft:0;h=b?b.offsetWidth:0;b=d.offsetWidth;g=this._tabsScrollLeft;var n=0,p=c.toolbar,m=0;jq(k).children().each(function(){n+=this.offsetWidth});p&&p.desktop&&(m=p.$n().offsetWidth);if(c._scrolling)switch(k=this._getArrowSize(),c.$n("right").style.right=m+"px",n<=b+k&&(c._scrolling=!1,this._showbutton(!1),
d.style.width=jq.px0(e.offsetWidth-m),this._fixTabsScrollLeft(0)),a){case "end":a=n-b-g;this._doScroll(0<=a?"right":"left",0<=a?a:Math.abs(a));break;case "init":case "sel":f!=g&&(f<g?this._doScroll("left",g-f):f+h>g+b&&this._doScroll("right",f+h-g-b))}else 0<n-b?(c._scrolling=!0,this._showbutton(!0),k=this._getArrowSize(),e=e.offsetWidth-m-k,d.style.width=0<e?e+"px":"",c.$n("right").style.right=m+"px","sel"==a&&(f<g?this._doScroll("left",g-f):f+h>g+b&&this._doScroll("right",f+h-g-b))):this._showbutton(!1)}}},
_doScroll:function(a,b){this._doingScroll||(this._doingScroll={});if(!(0>=b||this._doingScroll[a])){var c=this,d=this.$n();this._doingScroll[a]=b;var e=60>=b?5:5*(zk.parseInt(b/60)+1);var f=function(a,b,d){switch(b){case "right":c._fixTabsScrollLeft(c._tabsScrollLeft+d);break;case "left":c._fixTabsScrollLeft(c._tabsScrollLeft-d);break;case "up":c._fixTabsScrollTop(c._tabsScrollTop-d);break;default:c._fixTabsScrollTop(c._tabsScrollTop+d)}a=c._tabsScrollLeft;b=c._tabsScrollTop;c._fixTabsScrollLeft(0>=
a?0:a);c._fixTabsScrollTop(0>=b?0:b)},h=setInterval(function(){b?(b<e?f(d,a,b):f(d,a,e),b-=e,b=0>b?0:b):(delete c._doingScroll[a],clearInterval(h))},10)}},_getArrowSize:function(){var a=this.getTabbox(),b=a.isVertical(),c=b?a.$n("up"):a.$n("left");a=b?a.$n("down"):a.$n("right");var d=0;c&&a&&(d=b?c.offsetHeight+a.offsetHeight:c.offsetWidth+a.offsetWidth);return d},_showbutton:function(a){var b=this.getTabbox();if(b.isTabscroll()){var c=b.$s("scroll");jq(b).removeClass(c);a&&(b.isVertical()||b.inAccordionMold()||
(a=b.toolbar,b.$n("left").style.height=b.$n("right").style.height="",a&&(a.$n().style.height="")),jq(b).addClass(c))}},_fixWidth:function(a){var b=this.$n(),c=this.getTabbox(),d=c.$n(),e=c._scrolling?this._getArrowSize():0;this._fixHgh(a);c.isVertical()?((c=c.getTabpanels())&&c._fixWidth(),b.style.width?b._width=b.style.width:b.style.width=b._width?b._width:"50px"):c.inAccordionMold()||d.offsetWidth<e||(c.isTabscroll()?((a=c.toolbar)&&(a=a.$n()),d.style.width||(d.style.width="100%"),b.style.width=
c._scrolling?jq.px0(zk(d).contentWidth()-(a?a.offsetWidth:0)-e):jq.px0(zk(d).contentWidth()-(a?a.offsetWidth:0)),a&&c._scrolling&&(c.$n("right").style.right=a.offsetWidth+"px")):d.style.width?b.style.width=jq.px0(zk(d).contentWidth()-zk(b).marginWidth()):d.offsetWidth&&(d.style.width=jq.px0(d.offsetWidth),b.style.width=jq.px0(zk(d).contentWidth()-zk(b).marginWidth())))},_fixHgh:function(a){if(!this.getTabbox()._scrolling){var b=this.getTabbox();if(b.isVertical()){var c=this.$n();var d=b.$n(),e=b.$n("up"),
f=b.$n("down"),h=this.$n("cave");jq(d).children("div");h=jq(h).children();b.getHeight()||b._vflex&&"min"!=b._vflex||(a?(a=h.length*h[0].offsetHeight,b=(b=b.getSelectedPanel())&&b.getPanelContentHeight_()||0,d.style.height=jq.px0(Math.max(a,b)+zk(d).padBorderHeight())):jq(d).css("height",""));c.style.height=jq.px0(zk(d).contentHeight()-zk(c).marginHeight());e&&f&&(e.style.width=f.style.width=c.style.width)}else d=b.$n("right"),e=b.$n("left"),b=b.toolbar,c=this.$n(),f=jq.px0(c?c.offsetHeight:0),d&&
e&&(d.style.height=e.style.height=f),b&&(b=b.$n())&&(b.style.height=f),c&&(c.style.height="")}},onResponse:function(){this._shallCheck&&this._scrollcheck("init")},onChildRemoved_:function(a){var b=this.parent;b&&a==b._selTab&&(b._selTab=null);this.desktop&&(this._shallCheck=!0);this.$supers("onChildRemoved_",arguments)},onChildAdded_:function(){this.desktop&&(this._shallCheck=!0);this.$supers("onChildAdded_",arguments)},onChildVisible_:function(){if(this.desktop){var a=this.getTabbox();a.inAccordionMold()&&
a.getHeight()&&a.syncSize()}this.$supers("onChildVisible_",arguments)},ignoreFlexSize_:function(a){var b=this.getTabbox();return b.isVertical()&&"h"==a||b.isHorizontal()&&"w"==a},_fixTabsScrollLeft:function(a){this.$n().scrollLeft=this._tabsScrollLeft=a},_fixTabsScrollTop:function(a){this.$n().scrollTop=this._tabsScrollTop=a}});
