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(a,c){var b=$jscomp.checkStringArgs(this,a,"endsWith");a+="";void 0===c&&(c=b.length);c=Math.max(0,Math.min(c|0,b.length));for(var e=a.length;0<e&&0<c;)if(b[--c]!=a[--e])return!1;return 0>=e}},"es6","es3");
var Tree=zul.sel.Tree=zk.$extends(zul.sel.SelectWidget,{_scrollbar:null,_barPos:null,unbind_:function(){this.destroyBar_();this.$supers(Tree,"unbind_",arguments)},onSize:function(){this.$supers(Tree,"onSize",arguments);var a=this,b=this.frozen;this._shallSyncFrozen&&b&&this._nativebar&&(b.onSize(),this._shallSyncFrozen=!1);setTimeout(function(){a.desktop&&!a._nativebar&&(a._scrollbar||(a._scrollbar=zul.mesh.Scrollbar.init(a)),a.refreshBar_())},200)},refreshBar_:function(a){var b=this._scrollbar;if(b){if(this._currentLeft||
this._currentTop)var c={l:this._currentLeft,t:this._currentTop};this.inPagingMold()&&c&&(a=!0);b.syncSize(a||this._shallShowScrollbar);delete this._shallShowScrollbar;c&&b.scrollTo(c.l,c.t);a=this.frozen;var d;a&&0!=(d=a._start)&&(a._doScrollNow(d),b.setBarPosition(d))}},destroyBar_:function(){var a=this._scrollbar;a&&(a.destroy(),this._scrollbar=null)},clear:function(){if(this._treechildren&&this._treechildren.nChildren)for(var a=this._treechildren.firstChild;a;a=a.nextSibling)a.detach()},insertBefore:function(a,
b,c){if(this.$super("insertBefore",a,b,!this.z_rod))return this._fixOnAdd(a,c,c),!0},appendChild:function(a,b){if(this.$super("appendChild",a,!this.z_rod))return this.insertingBefore_||this._fixOnAdd(a,b,b),!0},_fixOnAdd:function(a,b,c){a.$instanceof(zul.sel.Treecols)?this.treecols=a:a.$instanceof(zul.sel.Treechildren)?(this.treechildren=a,this._fixSelectedSet()):a.$instanceof(zul.mesh.Paging)?this.paging=a:a.$instanceof(zul.sel.Treefoot)?this.treefoot=a:a.$instanceof(zul.mesh.Frozen)&&(this.frozen=
a);b||this.rerender();c||this._syncSize()},onChildRemoved_:function(a){this.$supers("onChildRemoved_",arguments);a==this.treecols?this.treecols=null:a==this.treefoot?this.treefoot=null:a==this.treechildren?(this.treechildren=null,this._selItems=[],this._sel=null):a==this.paging?this.paging=null:a==this.frozen&&(this.frozen=null,this.destroyBar_());this.childReplacing_||this._syncSize()},onChildAdded_:function(a){this.$supers("onChildAdded_",arguments);this.childReplacing_&&this._fixOnAdd(a,!0)},_onTreeitemAdded:function(a){this._fixNewChild(a);
this._onTreechildrenAdded(a.treechildren)},_onTreeitemRemoved:function(a){var b,c;a.isSelected()&&(this._selItems.$remove(a),(b=this._sel==a)&&!this._multiple&&(this._sel=null));this._onTreechildrenRemoved(a.treechildren);b&&this._fixSelected();(c=a.previousSibling||a.getParentItem())?this._shallSyncFocus=c:this._shallSyncFocus=!0},_onTreechildrenAdded:function(a){if(a&&a.parent!=this){var b=0;a=a.getItems();for(var c=a.length;b<c;++b)a[b]&&this._fixNewChild(a[b])}},_onTreechildrenRemoved:function(a){if(null!=
a&&a.parent!=this){for(var b,c=0,d=a.getItems(),e=d.length;c<e;++c)if(a=d[c],a.isSelected()&&(this._selItems.$remove(a),this._sel==a)){if(!this._multiple){this._sel=null;return}b=!0}b&&this._fixSelected()}},_fixNewChild:function(a){a.isSelected()&&(this._sel&&!this._multiple?(a._selected=!1,a.rerender()):(this._sel||(this._sel=a),this._selItems.push(a)))},_fixSelectedSet:function(){this._sel=null;this._selItems=[];for(var a=0,b=this.getItems(),c=b.length;a<c;++a)if(b[a].isSelected()){if(null==this._sel)this._sel=
b[a];else if(!this._multiple){b[a]._selected=!1;continue}this._selItems.push(b[a])}},_fixSelected:function(){switch(this._selItems.length){case 1:var a=this._selItems[0];case 0:break;default:for(var b=0,c=this.getItems(),d=c.length;b<d;++b)if(c[b].isSelected()){a=c[b];break}}return a!=this._sel?(this._sel=a,!0):!1},_sizeOnOpen:function(){this._shallShowScrollbar=!0;var a=this.treecols,b;if(!a||this.isSizedByContent()||"min"==this._hflex)this.syncSize();else for(a=a.firstChild;a;a=a.nextSibling)if(a._hflex||
!(b=a._width)||"auto"==b){this.syncSize();return}this.doResizeScroll_()},getHeadWidgetClass:function(){return zul.sel.Treecols},itemIterator:_zkf=function(a){return new zul.sel.TreeItemIter(this,a)},getBodyWidgetIterator:_zkf,getItems:function(a){return this.treechildren?this.treechildren.getItems(null,a):[]},getItemCount:function(a){return null!=this.treechildren?this.treechildren.getItemCount(a):0},_doLeft:function(a){a.isOpen()&&a.setOpen(!1)},_doRight:function(a){a.isOpen()||a.setOpen(!0)},shallIgnoreSelect_:function(a){var b=
a.domTarget;if(b)return b=b.id,b.endsWith("open")||b.endsWith("icon")||"onRightClick"==a.name&&!this.rightSelect},clearSelection:function(){this.$supers("clearSelection",arguments);this._sel=null},_addItemToSelection:function(){this.$supers("_addItemToSelection",arguments);this._sel=this._selItems[0]},_removeItemFromSelection:function(){this.$supers("_removeItemFromSelection",arguments);this._sel=this._selItems[0]},checkOnHighlightDisabled_:function(){if(this._selectOnHighlightDisabled){var a=window.getSelection||
document.selection;if(a)return zk.ie&&9>zk.ie?"Text"==a.type&&0<a.createRange().htmlText.length:0<a().toString().length}}});zul.sel.TreeItemIter=zk.$extends(zk.Object,{$init:function(a,b){this.tree=a;this.opts=b},_init:function(){this._isInit||(this._isInit=!0,this.items=this.tree.getItems(this.opts),this.length=this.items.length,this.cur=0)},hasNext:function(){this._init();return this.cur<this.length},next:function(){this._init();return this.items[this.cur++]}});
