/** 
 * Kendo UI v2016.3.1118 (http://www.telerik.com/kendo-ui)                                                                                                                                              
 * Copyright 2016 Telerik AD. All rights reserved.                                                                                                                                                      
 *                                                                                                                                                                                                      
 * Kendo UI commercial licenses may be obtained at                                                                                                                                                      
 * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete                                                                                                                                  
 * If you do not own a commercial license, this file shall be governed by the trial license terms.                                                                                                      
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       

*/
!function(e,define){define("kendo.columnmenu.min",["kendo.popup.min","kendo.filtermenu.min","kendo.menu.min"],e)}(function(){return function(e,n){function s(n){return e.trim(n).replace(/&nbsp;/gi,"")}function l(e,n){var s,l,t,i={};for(s=0,l=e.length;s<l;s++)t=e[s],i[t[n]]=t;return i}function t(e){var n,s=[];for(n=0;n<e.length;n++)e[n].columns?s=s.concat(t(e[n].columns)):s.push(e[n]);return s}var i=window.kendo,o=i.ui,a=e.proxy,r=e.extend,c=e.grep,u=e.map,d=e.inArray,p="k-state-selected",k="asc",m="desc",f="change",h="init",g="select",b="kendoPopup",C="kendoFilterMenu",w="kendoMenu",v=".kendoColumnMenu",_=o.Widget,x=_.extend({init:function(n,s){var l,t=this;_.fn.init.call(t,n,s),n=t.element,s=t.options,t.owner=s.owner,t.dataSource=s.dataSource,t.field=n.attr(i.attr("field")),t.title=n.attr(i.attr("title")),l=n.find(".k-header-column-menu"),l[0]||(l=n.addClass("k-with-icon").prepend('<a class="k-header-column-menu" href="#"><span class="k-icon k-i-arrowhead-s">'+s.messages.settings+"</span></a>").find(".k-header-column-menu")),t.link=l.attr("tabindex",-1).on("click"+v,a(t._click,t)),t.wrapper=e('<div class="k-column-menu"/>'),t._refreshHandler=a(t.refresh,t),t.dataSource.bind(f,t._refreshHandler)},_init:function(){var e=this;e.pane=e.options.pane,e.pane&&(e._isMobile=!0),e._isMobile?e._createMobileMenu():e._createMenu(),e.owner._muteAngularRebind(function(){e._angularItems("compile")}),e._sort(),e._columns(),e._filter(),e._lockColumns(),e.trigger(h,{field:e.field,container:e.wrapper})},events:[h,"sort","filtering"],options:{name:"ColumnMenu",messages:{sortAscending:"Sort Ascending",sortDescending:"Sort Descending",filter:"Filter",columns:"Columns",done:"Done",settings:"Column Settings",lock:"Lock",unlock:"Unlock"},filter:"",columns:!0,sortable:!0,filterable:!0,animations:{left:"slide"}},_createMenu:function(){var e=this,n=e.options;e.wrapper.html(i.template(M)({uid:i.guid(),ns:i.ns,messages:n.messages,sortable:n.sortable,filterable:n.filterable,columns:e._ownerColumns(),showColumns:n.columns,lockedColumns:n.lockedColumns})),e.popup=e.wrapper[b]({anchor:e.link,open:a(e._open,e),activate:a(e._activate,e),close:function(){e.options.closeCallback&&e.options.closeCallback(e.element)}}).data(b),e.menu=e.wrapper.children()[w]({orientation:"vertical",closeOnClick:!1}).data(w)},_createMobileMenu:function(){var e=this,n=e.options,s=i.template(S)({ns:i.ns,field:e.field,title:e.title||e.field,messages:n.messages,sortable:n.sortable,filterable:n.filterable,columns:e._ownerColumns(),showColumns:n.columns,lockedColumns:n.lockedColumns});e.view=e.pane.append(s),e.wrapper=e.view.element.find(".k-column-menu"),e.menu=new y(e.wrapper.children(),{pane:e.pane}),e.view.element.on("click",".k-done",function(n){e.close(),n.preventDefault()}),e.options.lockedColumns&&e.view.bind("show",function(){e._updateLockedColumns()})},_angularItems:function(n){var s=this;s.angular(n,function(){var n=s.wrapper.find(".k-columns-item input["+i.attr("field")+"]").map(function(){return e(this).closest("li")}),l=u(s._ownerColumns(),function(e){return{column:e._originalObject}});return{elements:n,data:l}})},destroy:function(){var e=this;e._angularItems("cleanup"),_.fn.destroy.call(e),e.filterMenu&&e.filterMenu.destroy(),e._refreshHandler&&e.dataSource.unbind(f,e._refreshHandler),e.options.columns&&e.owner&&(e._updateColumnsMenuHandler&&(e.owner.unbind("columnShow",e._updateColumnsMenuHandler),e.owner.unbind("columnHide",e._updateColumnsMenuHandler)),e._updateColumnsLockedStateHandler&&(e.owner.unbind("columnLock",e._updateColumnsLockedStateHandler),e.owner.unbind("columnUnlock",e._updateColumnsLockedStateHandler))),e.menu&&(e.menu.element.off(v),e.menu.destroy()),e.wrapper.off(v),e.popup&&e.popup.destroy(),e.view&&e.view.purge(),e.link.off(v),e.owner=null,e.wrapper=null,e.element=null},close:function(){this.menu.close(),this.popup&&(this.popup.close(),this.popup.element.off("keydown"+v))},_click:function(e){e.preventDefault(),e.stopPropagation();var n=this.options;n.filter&&this.element.is(!n.filter)||(this.popup||this.pane||this._init(),this._isMobile?this.pane.navigate(this.view,this.options.animations.left):this.popup.toggle())},_open:function(){var n=this;e(".k-column-menu").not(n.wrapper).each(function(){e(this).data(b).close()}),n.popup.element.on("keydown"+v,function(e){e.keyCode==i.keys.ESC&&n.close()}),n.options.lockedColumns&&n._updateLockedColumns()},_activate:function(){this.menu.element.focus()},_ownerColumns:function(){var e=t(this.owner.columns),n=c(e,function(e){var n=!0,l=s(e.title||"");return e.menu!==!1&&(e.field||l.length)||(n=!1),n});return u(n,function(n){return{originalField:n.field,field:n.field||n.title,title:n.title||n.field,hidden:n.hidden,index:d(n,e),locked:!!n.locked,_originalObject:n}})},_sort:function(){var n=this;n.options.sortable&&(n.refresh(),n.menu.bind(g,function(s){var l,t=e(s.item);t.hasClass("k-sort-asc")?l=k:t.hasClass("k-sort-desc")&&(l=m),l&&(t.parent().find(".k-sort-"+(l==k?m:k)).removeClass(p),n._sortDataSource(t,l),n.close())}))},_sortDataSource:function(e,s){var l,t,i=this,o=i.options.sortable,a=null===o.compare?n:o.compare,r=i.dataSource,c=r.sort()||[],u=e.hasClass(p)&&o&&o.allowUnsort!==!1;if(s=u?n:s,!i.trigger("sort",{sort:{field:i.field,dir:s,compare:a}})){if(u?e.removeClass(p):e.addClass(p),"multiple"===o.mode){for(l=0,t=c.length;l<t;l++)if(c[l].field===i.field){c.splice(l,1);break}c.push({field:i.field,dir:s,compare:a})}else c=[{field:i.field,dir:s,compare:a}];r.sort(c)}},_columns:function(){var n=this;n.options.columns&&(n._updateColumnsMenu(),n._updateColumnsMenuHandler=a(n._updateColumnsMenu,n),n.owner.bind(["columnHide","columnShow"],n._updateColumnsMenuHandler),n._updateColumnsLockedStateHandler=a(n._updateColumnsLockedState,n),n.owner.bind(["columnUnlock","columnLock"],n._updateColumnsLockedStateHandler),n.menu.bind(g,function(s){var l,o,a,r=e(s.item),u=t(n.owner.columns);n._isMobile&&s.preventDefault(),r.parent().closest("li.k-columns-item")[0]&&(l=r.find(":checkbox"),l.attr("disabled")||(a=l.attr(i.attr("field")),o=c(u,function(e){return e.field==a||e.title==a})[0],o.hidden===!0?n.owner.showColumn(o):n.owner.hideColumn(o)))}))},_updateColumnsMenu:function(){var e,n,s,l,t,o,a=i.attr("field"),r=i.attr("locked"),p=c(this._ownerColumns(),function(e){return!e.hidden}),k=c(p,function(e){return e.originalField}),m=c(k,function(e){return e.locked===!0}).length,f=c(k,function(e){return e.locked!==!0}).length;for(p=u(p,function(e){return e.field}),this.wrapper.find("[role='menuitemcheckbox']").attr("aria-checked",!1),o=this.wrapper.find(".k-columns-item input["+a+"]").prop("disabled",!1).prop("checked",!1),e=0,n=o.length;e<n;e++)s=o.eq(e),t="true"===s.attr(r),l=!1,d(s.attr(a),p)>-1&&(l=!0,s.prop("checked",l)),s.closest("[role='menuitemcheckbox']").attr("aria-checked",l),l&&(1==m&&t&&s.prop("disabled",!0),1!=f||t||s.prop("disabled",!0))},_updateColumnsLockedState:function(){var e,n,s,t,o=i.attr("field"),a=i.attr("locked"),r=l(this._ownerColumns(),"field"),c=this.wrapper.find(".k-columns-item input[type=checkbox]");for(e=0,n=c.length;e<n;e++)s=c.eq(e),t=r[s.attr(o)],t&&s.attr(a,t.locked);this._updateColumnsMenu()},_filter:function(){var n=this,s=C,l=n.options;l.filterable!==!1&&(l.filterable.multi&&(s="kendoFilterMultiCheck",l.filterable.dataSource&&(l.filterable.checkSource=l.filterable.dataSource,delete l.filterable.dataSource)),n.filterMenu=n.wrapper.find(".k-filterable")[s](r(!0,{},{appendToElement:!0,dataSource:l.dataSource,values:l.values,field:n.field,title:n.title,change:function(e){n.trigger("filtering",{filter:e.filter,field:e.field})&&e.preventDefault()}},l.filterable)).data(s),n._isMobile&&n.menu.bind(g,function(s){var l=e(s.item);l.hasClass("k-filter-item")&&n.pane.navigate(n.filterMenu.view,n.options.animations.left)}))},_lockColumns:function(){var n=this;n.menu.bind(g,function(s){var l=e(s.item);l.hasClass("k-lock")?(n.owner.lockColumn(n.field),n.close()):l.hasClass("k-unlock")&&(n.owner.unlockColumn(n.field),n.close())})},_updateLockedColumns:function(){var e,n,s,l,t=this.field,i=this.owner.columns,o=c(i,function(e){return e.field==t||e.title==t})[0];o&&(e=o.locked===!0,n=c(i,function(n){return!n.hidden&&(n.locked&&e||!n.locked&&!e)}).length,s=this.wrapper.find(".k-lock").removeClass("k-state-disabled"),l=this.wrapper.find(".k-unlock").removeClass("k-state-disabled"),(e||1==n)&&s.addClass("k-state-disabled"),e&&1!=n||l.addClass("k-state-disabled"),this._updateColumnsLockedState())},refresh:function(){var e,n,s,l=this,t=l.options.dataSource.sort()||[],i=l.field;for(l.wrapper.find(".k-sort-asc, .k-sort-desc").removeClass(p),n=0,s=t.length;n<s;n++)e=t[n],i==e.field&&l.wrapper.find(".k-sort-"+e.dir).addClass(p);l.link[l._filterExist(l.dataSource.filter())?"addClass":"removeClass"]("k-state-active")},_filterExist:function(e){var n,s,l,t=!1;if(e){for(e=e.filters,s=0,l=e.length;s<l;s++)n=e[s],n.field==this.field?t=!0:n.filters&&(t=t||this._filterExist(n));return t}}}),M='<ul id="#=uid#">#if(sortable){#<li class="k-item k-sort-asc"><span class="k-link"><span class="k-sprite k-i-sort-asc"></span>${messages.sortAscending}</span></li><li class="k-item k-sort-desc"><span class="k-link"><span class="k-sprite k-i-sort-desc"></span>${messages.sortDescending}</span></li>#if(showColumns || filterable){#<li class="k-separator" role="presentation"></li>#}##}##if(showColumns){#<li class="k-item k-columns-item" aria-haspopup="true"><span class="k-link"><span class="k-sprite k-i-columns"></span>${messages.columns}</span><ul>#for (var idx = 0; idx < columns.length; idx++) {#<li role="menuitemcheckbox" aria-checked="false"><input type="checkbox" data-#=ns#field="#=columns[idx].field.replace(/"/g,"&\\#34;")#" data-#=ns#index="#=columns[idx].index#" data-#=ns#locked="#=columns[idx].locked#"/>#=columns[idx].title#</li>#}#</ul></li>#if(filterable || lockedColumns){#<li class="k-separator" role="presentation"></li>#}##}##if(filterable){#<li class="k-item k-filter-item" aria-haspopup="true"><span class="k-link"><span class="k-sprite k-filter"></span>${messages.filter}</span><ul><li><div class="k-filterable"></div></li></ul></li>#if(lockedColumns){#<li class="k-separator" role="presentation"></li>#}##}##if(lockedColumns){#<li class="k-item k-lock"><span class="k-link"><span class="k-sprite k-i-lock"></span>${messages.lock}</span></li><li class="k-item k-unlock"><span class="k-link"><span class="k-sprite k-i-unlock"></span>${messages.unlock}</span></li>#}#</ul>',S='<div data-#=ns#role="view" data-#=ns#init-widgets="false" data-#=ns#use-native-scrolling="true" class="k-grid-column-menu"><div data-#=ns#role="header" class="k-header">${messages.settings}<button class="k-button k-done">#=messages.done#</button></div><div class="k-column-menu k-mobile-list"><ul><li><span class="k-link">${title}</span><ul>#if(sortable){#<li class="k-item k-sort-asc"><span class="k-link"><span class="k-sprite k-i-sort-asc"></span>${messages.sortAscending}</span></li><li class="k-item k-sort-desc"><span class="k-link"><span class="k-sprite k-i-sort-desc"></span>${messages.sortDescending}</span></li>#}##if(lockedColumns){#<li class="k-item k-lock"><span class="k-link"><span class="k-sprite k-i-lock"></span>${messages.lock}</span></li><li class="k-item k-unlock"><span class="k-link"><span class="k-sprite k-i-unlock"></span>${messages.unlock}</span></li>#}##if(filterable){#<li class="k-item k-filter-item"><span class="k-link k-filterable"><span class="k-sprite k-filter"></span>${messages.filter}</span></li>#}#</ul></li>#if(showColumns){#<li class="k-columns-item"><span class="k-link">${messages.columns}</span><ul>#for (var idx = 0; idx < columns.length; idx++) {#<li class="k-item"><label class="k-label"><input type="checkbox" class="k-check" data-#=ns#field="#=columns[idx].field.replace(/"/g,"&\\#34;")#" data-#=ns#index="#=columns[idx].index#" data-#=ns#locked="#=columns[idx].locked#"/>#=columns[idx].title#</label></li>#}#</ul></li>#}#</ul></div></div>',y=_.extend({init:function(e,n){_.fn.init.call(this,e,n),this.element.on("click"+v,"li.k-item:not(.k-separator):not(.k-state-disabled)","_click")},events:[g],_click:function(n){e(n.target).is("[type=checkbox]")||n.preventDefault(),this.trigger(g,{item:n.currentTarget})},close:function(){this.options.pane.navigate("")},destroy:function(){_.fn.destroy.call(this),this.element.off(v)}});o.plugin(x)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,n,s){(s||n)()});
//# sourceMappingURL=kendo.columnmenu.min.js.map
