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.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;
$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
$jscomp.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};
$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(a,b){var c=$jscomp.propertyToPolyfillSymbol[b];if(null==c)return a[b];c=a[c];return void 0!==c?c:a[b]};$jscomp.polyfill=function(a,b,c,d){b&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(a,b,c,d):$jscomp.polyfillUnisolated(a,b,c,d))};
$jscomp.polyfillUnisolated=function(a,b,c,d){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))return;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.polyfillIsolated=function(a,b,c,d){var e=a.split(".");a=1===e.length;d=e[0];d=!a&&d in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var g=0;g<e.length-1;g++){var f=e[g];if(!(f in d))return;d=d[f]}e=e[e.length-1];c=$jscomp.IS_SYMBOL_NATIVE&&"es6"===c?d[e]:null;b=b(c);null!=b&&(a?$jscomp.defineProperty($jscomp.polyfills,e,{configurable:!0,writable:!0,value:b}):b!==c&&(void 0===$jscomp.propertyToPolyfillSymbol[e]&&(c=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+c+"$"+e),$jscomp.defineProperty(d,$jscomp.propertyToPolyfillSymbol[e],{configurable:!0,writable:!0,value:b})))};$jscomp.polyfill("String.prototype.startsWith",function(a){return a?a:function(b,c){var d=$jscomp.checkStringArgs(this,b,"startsWith");b+="";var e=d.length,g=b.length;c=Math.max(0,Math.min(c|0,d.length));for(var f=0;f<g&&c<e;)if(d[c++]!=b[f++])return!1;return f>=g}},"es6","es3");
zul.mesh.SortWidget=zk.$extends(zul.mesh.HeaderWidget,{_sortDirection:"natural",_sortAscending:"none",_sortDescending:"none",$define:{sortDirection:function(a){if(this.desktop){var b=jq(this.$n("sort-icon"));b.removeClass();switch(a){case "ascending":b.addClass("z-icon-caret-up");break;case "descending":b.addClass("z-icon-caret-down")}}},sortAscending:function(a){a||(this._sortAscending="none");this.desktop&&(this.setSortDirection("natural"),jq(this.$n()).toggleClass(this.$s("sort"),this.isSortable_()))},
sortDescending:function(a){a||(this._sortDescending="none");this.desktop&&(this.setSortDirection("natural"),jq(this.$n()).toggleClass(this.$s("sort"),this.isSortable_()))}},$init:function(){this.$supers("$init",arguments);this.listen({onSort:this},-1E3)},setSort:function(a){a&&a.startsWith("client")?(this.setSortAscending(a),this.setSortDescending(a)):(this.setSortAscending("none"),this.setSortDescending("none"))},isSortable_:function(){return"none"!=this._sortAscending||"none"!=this._sortDescending},
sort:function(a,b){if(!this.checkClientSort_(a))return!1;b.stop();this.replaceCavedChildrenInOrder_(a);return!0},checkClientSort_:function(a){var b=this.getSortDirection();if(a){if("ascending"==b)return!1}else if("descending"==b)return!1;a=a?this._sortAscending:this._sortDescending;if("fromServer"==a||"none"==a)return!1;a=this.getMeshWidget();return!a||a.isModel()?!1:!0},replaceCavedChildrenInOrder_:function(a){var b=this.getMeshWidget(),c=this.getMeshBody(),d=this.getSortDirection(),e=a?this._sortAscending:
this._sortDescending,g=c.desktop,f=c.$n();try{c.unbind();for(var h=[],u=this.getChildIndex(),k=0,p=0,v=b.getBodyWidgetIterator(),q;q=v.next();p++)for(var l=0,m=q.firstChild;m;m=m.nextSibling,l++)l==u&&(h[k++]={wgt:m,index:p});var w="ascending"==d?-1:1,x=this.sorting,y="client(number)"==e;h.sort(function(r,t){var n=x(r.wgt,t.wgt,y)*w;0==n&&(n=r.index<t.index?-1:1);return n});k=0;for(l=h.length;k<l;k++)c.appendChild(h[k].wgt.parent);this._fixDirection(a)}finally{c.replaceHTML(f,g)}},sorting:function(a,
b,c){a="function"==typeof a.getLabel?a.getLabel():"function"==typeof a.getValue?a.getValue():a;b="function"==typeof b.getLabel?b.getLabel():"function"==typeof b.getValue?b.getValue():b;return c?a-b:a>b?1:a<b?-1:0},_fixDirection:function(a){a=a?"ascending":"descending";for(var b=this.parent.firstChild;b;b=b.nextSibling)b.setSortDirection(b==this?a:"natural")},onSort:function(a){var b=this.getSortDirection();"ascending"==b?this.sort(!1,a):"descending"==b?this.sort(!0,a):this.sort(!0,a)||this.sort(!1,
a)},bind_:function(){this.$supers(zul.mesh.SortWidget,"bind_",arguments);if("none"!=this._sortAscending||"none"!=this._sortDescending){var a=jq(this.$n()),b=jq(this.$n("sort-icon"));a.addClass(this.$s("sort"));switch(this._sortDirection){case "ascending":b.addClass("z-icon-caret-up");break;case "descending":b.addClass("z-icon-caret-down")}}},unbind_:function(){this.$supers(zul.mesh.SortWidget,"unbind_",arguments)},getColumnMenuPopup_:zk.$void,_doMenuClick:function(a){if(this.parent._menupopup&&"none"!=
this.parent._menupopup){var b=this.parent._menupopup,c=this.$n("btn");jq(this.$n()).addClass(this.$s("visited"));b="auto"!=b&&"auto-keep"!=b||!this.parent._mpop?this.$f(this.parent._menupopup):this.parent._mpop;if(zul.menu.Menupopup.isInstance(b)){var d=zk(c).revisedOffset(),e="none"!=this.getSortAscending(),g="none"!=this.getSortDescending(),f=this.getMeshWidget();if(b.$instanceof(zul.mesh.ColumnMenupopup)){b.getAscitem().setVisible(e);b.getDescitem().setVisible(g);var h=f.getModel();zk.feature.pe&&
b.getGroupitem()&&("group"==h||!h||this.isListen("onGroup",{asapOnly:1})?b.getGroupitem().setVisible(e||g):b.getGroupitem().setVisible(!1));zk.feature.ee&&b.getUngroupitem()&&(h=!h||this.isListen("onUngroup",{asapOnly:1}),b.getUngroupitem().setVisible(h&&f.hasGroup()));(f=b.getDescitem().nextSibling)&&f.setVisible(e||g)}else b.listen({onOpen:[this.parent,this.parent._onMenuPopup]});b.open(c,[d[0],d[1]+c.offsetHeight-4],null,{sendOnOpen:!0})}a.stop()}}});
