text: /** 
   * Kendo UI v2016.2.909 (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("util/main.min",["kendo.core.min"],e)}(function(){return function(){function e(e){return typeof e!==N}function t(e,t){var n=r(t);return D.round(e*n)/n}function r(e){return e?D.pow(10,e):1}function n(e,t,r){return D.max(D.min(e,r),t)}function o(e){return e*M}function a(e){return e/M}function l(e){return"number"==typeof e&&!isNaN(e)}function i(t,r){return e(t)?t:r}function s(e){return e*e}function d(e){var t,r=[];for(t in e)r.push(t+e[t]);return r.sort().join("")}function c(e){var t,r=2166136261;for(t=0;t<e.length;++t)r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24),r^=e.charCodeAt(t);return r>>>0}function u(e){return c(d(e))}function h(e){var t,r=e.length,n=W,o=E;for(t=0;t<r;t++)o=D.max(o,e[t]),n=D.min(n,e[t]);return{min:n,max:o}}function p(e){return h(e).min}function f(e){return h(e).max}function g(e){return k(e).min}function m(e){return k(e).max}function k(e){var t,r,n,o=W,a=E;for(t=0,r=e.length;t<r;t++)n=e[t],null!==n&&isFinite(n)&&(o=D.min(o,n),a=D.max(a,n));return{min:o===W?void 0:o,max:a===E?void 0:a}}function b(e){if(e)return e[e.length-1]}function _(e,t){return e.push.apply(e,t),e}function v(e){return F.template(e,{useWithBlock:!1,paramName:"d"})}function w(t,r){return e(r)&&null!==r?" "+t+"='"+r+"' ":""}function C(e){var t,r="";for(t=0;t<e.length;t++)r+=w(e[t][0],e[t][1]);return r}function y(t){var r,n,o="";for(r=0;r<t.length;r++)n=t[r][1],e(n)&&(o+=t[r][0]+":"+n+";");if(""!==o)return o}function T(e){return"string"!=typeof e&&(e+="px"),e}function x(e){var t,r,n=[];if(e)for(t=F.toHyphens(e).split("-"),r=0;r<t.length;r++)n.push("k-pos-"+t[r]);return n.join(" ")}function S(t){return""===t||null===t||"none"===t||"transparent"===t||!e(t)}function H(e){for(var t={1:"i",10:"x",100:"c",2:"ii",20:"xx",200:"cc",3:"iii",30:"xxx",300:"ccc",4:"iv",40:"xl",400:"cd",5:"v",50:"l",500:"d",6:"vi",60:"lx",600:"dc",7:"vii",70:"lxx",700:"dcc",8:"viii",80:"lxxx",800:"dccc",9:"ix",90:"xc",900:"cm",1e3:"m"},r=[1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],n="";e>0;)e<r[0]?r.shift():(n+=t[r[0]],e-=r[0]);return n}function R(e){var t,r,n,o,a;for(e=e.toLowerCase(),t={i:1,v:5,x:10,l:50,c:100,d:500,m:1e3},r=0,n=0,o=0;o<e.length;++o){if(a=t[e.charAt(o)],!a)return null;r+=a,a>n&&(r-=2*n),n=a}return r}function L(e){var t=Object.create(null);return function(){var r,n="";for(r=arguments.length;--r>=0;)n+=":"+arguments[r];return n in t?t[n]:e.apply(this,arguments)}}function z(e){for(var t,r,n=[],o=0,a=e.length;o<a;)t=e.charCodeAt(o++),t>=55296&&t<=56319&&o<a?(r=e.charCodeAt(o++),56320==(64512&r)?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),o--)):n.push(t);return n}function I(e){return e.map(function(e){var t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t+=String.fromCharCode(e)}).join("")}function A(e,t){function r(e,r){for(var n=[],o=0,a=0,l=0;o<e.length&&a<r.length;)t(e[o],r[a])<=0?n[l++]=e[o++]:n[l++]=r[a++];return o<e.length&&n.push.apply(n,e.slice(o)),a<r.length&&n.push.apply(n,r.slice(a)),n}return e.length<2?e.slice():function n(e){var t,o,a;return e.length<=1?e:(t=Math.floor(e.length/2),o=e.slice(0,t),a=e.slice(t),o=n(o),a=n(a),r(o,a))}(e)}var D=Math,F=window.kendo,q=F.deepExtend,M=D.PI/180,W=Number.MAX_VALUE,E=-Number.MAX_VALUE,N="undefined",P=Date.now;P||(P=function(){return(new Date).getTime()}),q(F,{util:{MAX_NUM:W,MIN_NUM:E,append:_,arrayLimits:h,arrayMin:p,arrayMax:f,defined:e,deg:a,hashKey:c,hashObject:u,isNumber:l,isTransparent:S,last:b,limitValue:n,now:P,objectKey:d,round:t,rad:o,renderAttr:w,renderAllAttr:C,renderPos:x,renderSize:T,renderStyle:y,renderTemplate:v,sparseArrayLimits:k,sparseArrayMin:g,sparseArrayMax:m,sqr:s,valueOrDefault:i,romanToArabic:R,arabicToRoman:H,memoize:L,ucs2encode:I,ucs2decode:z,mergeSort:A}}),F.drawing.util=F.util,F.dataviz.util=F.util}(),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,r){(r||t)()}),function(e,define){define("util/text-metrics.min",["kendo.core.min","util/main.min"],e)}(function(){!function(e){function t(){return{width:0,height:0,baseline:0}}function r(e,t,r){return u.current.measure(e,t,r)}function n(e,t){var r=[];if(e.length>0&&document.fonts){try{r=e.map(function(e){return document.fonts.load(e)})}catch(n){a.logToConsole(n)}Promise.all(r).then(t,t)}else t()}var o=document,a=window.kendo,l=a.Class,i=a.util,s=i.defined,d=l.extend({init:function(e){this._size=e,this._length=0,this._map={}},put:function(e,t){var r=this,n=r._map,o={key:e,value:t};n[e]=o,r._head?(r._tail.newer=o,o.older=r._tail,r._tail=o):r._head=r._tail=o,r._length>=r._size?(n[r._head.key]=null,r._head=r._head.newer,r._head.older=null):r._length++},get:function(e){var t=this,r=t._map[e];if(r)return r===t._head&&r!==t._tail&&(t._head=r.newer,t._head.older=null),r!==t._tail&&(r.older&&(r.older.newer=r.newer,r.newer.older=r.older),r.older=t._tail,r.newer=null,t._tail.newer=r,t._tail=r),r.value}}),c=e("<div style='position: absolute !important; top: -4000px !important; width: auto !important; height: auto !important;padding: 0 !important; margin: 0 !important; border: 0 !important;line-height: normal !important; visibility: hidden !important; white-space: nowrap!important;' />")[0],u=l.extend({init:function(e){this._cache=new d(1e3),this._initOptions(e)},options:{baselineMarkerSize:1},measure:function(r,n,a){var l,d,u,h,p,f,g,m;if(!r)return t();if(l=i.objectKey(n),d=i.hashKey(r+l),u=this._cache.get(d),u)return u;h=t(),p=a?a:c,f=this._baselineMarker().cloneNode(!1);for(g in n)m=n[g],s(m)&&(p.style[g]=m);return e(p).text(r),p.appendChild(f),o.body.appendChild(p),(r+"").length&&(h.width=p.offsetWidth-this.options.baselineMarkerSize,h.height=p.offsetHeight,h.baseline=f.offsetTop+this.options.baselineMarkerSize),h.width>0&&h.height>0&&this._cache.put(d,h),p.parentNode.removeChild(p),h},_baselineMarker:function(){return e("<div class='k-baseline-marker' style='display: inline-block; vertical-align: baseline;width: "+this.options.baselineMarkerSize+"px; height: "+this.options.baselineMarkerSize+"px;overflow: hidden;' />")[0]}});u.current=new u,a.util.TextMetrics=u,a.util.LRUCache=d,a.util.loadFonts=n,a.util.measureText=r}(window.kendo.jQuery)},"function"==typeof define&&define.amd?define:function(e,t,r){(r||t)()}),function(e,define){define("util/base64.min",["util/main.min"],e)}(function(){return function(){function e(e){var r,n,o,l,i,s,d,c="",u=0;for(e=t(e);u<e.length;)r=e.charCodeAt(u++),n=e.charCodeAt(u++),o=e.charCodeAt(u++),l=r>>2,i=(3&r)<<4|n>>4,s=(15&n)<<2|o>>6,d=63&o,isNaN(n)?s=d=64:isNaN(o)&&(d=64),c=c+a.charAt(l)+a.charAt(i)+a.charAt(s)+a.charAt(d);return c}function t(e){var t,r,n="";for(t=0;t<e.length;t++)r=e.charCodeAt(t),r<128?n+=o(r):r<2048?(n+=o(192|r>>>6),n+=o(128|63&r)):r<65536&&(n+=o(224|r>>>12),n+=o(128|r>>>6&63),n+=o(128|63&r));return n}var r=window.kendo,n=r.deepExtend,o=String.fromCharCode,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n(r.util,{encodeBase64:e,encodeUTF8:t})}(),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,r){(r||t)()}),function(e,define){define("mixins/observers.min",["kendo.core.min"],e)}(function(){return function(e){var t=Math,r=window.kendo,n=r.deepExtend,o=e.inArray,a={observers:function(){return this._observers=this._observers||[]},addObserver:function(e){return this._observers?this._observers.push(e):this._observers=[e],this},removeObserver:function(e){var t=this.observers(),r=o(e,t);return r!=-1&&t.splice(r,1),this},trigger:function(e,t){var r,n,o=this._observers;if(o&&!this._suspended)for(n=0;n<o.length;n++)r=o[n],r[e]&&r[e](t);return this},optionsChange:function(e){e=e||{},e.element=this,this.trigger("optionsChange",e)},geometryChange:function(){this.trigger("geometryChange",{element:this})},suspend:function(){return this._suspended=(this._suspended||0)+1,this},resume:function(){return this._suspended=t.max((this._suspended||0)-1,0),this},_observerField:function(e,t){this[e]&&this[e].removeObserver(this),this[e]=t,t.addObserver(this)}};n(r,{mixins:{ObserversMixin:a}})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,r){(r||t)()}),function(e,define){define("kendo.grid.min",["kendo.data.min","kendo.columnsorter.min","kendo.editable.min","kendo.window.min","kendo.filtermenu.min","kendo.columnmenu.min","kendo.groupable.min","kendo.pager.min","kendo.selectable.min","kendo.sortable.min","kendo.reorderable.min","kendo.resizable.min","kendo.mobile.actionsheet.min","kendo.mobile.pane.min","kendo.ooxml.min","kendo.excel.min","kendo.progressbar.min","kendo.pdf.min"],e)}(function(){return function(e,t){function r(e){return Array(e+1).join('<td class="k-group-cell">&nbsp;</td>')}function n(e){var t,r=" ";if(e){if(typeof e===dt)return e;for(t in e)r+=t+'="'+e[t]+'"'}return r}function o(t,r){e("th, th .k-grid-filter, th .k-link",t).add(document.body).css("cursor",r)}function a(t,r,n,o,a){var l,i=r;for(r=e(),a=a||1,l=0;l<a;l++)r=r.add(t.eq(i+l));"number"==typeof n?r[o?"insertBefore":"insertAfter"](t.eq(n)):r.appendTo(n)}function l(t,r,n){return e(t).add(r).find(n)}function i(e,t,r){var n,o,a,l;for(r=Ce(r)?r:[r],n=0,o=r.length;n<o;n++)a=r[n],be(a)&&a.click&&(l=a.name||a.text,t.on(at+We,"a.k-grid-"+(l||"").replace(/\s/g,""),{commandName:l},xe(a.click,e)))}function s(e,t,r){return ve(e,function(e){var n,o;return e=typeof e===dt?{field:e}:e,p(e)&&!r||(e.attributes=j(e.attributes),e.footerAttributes=j(e.footerAttributes),e.headerAttributes=j(e.headerAttributes),n=!0),e.columns&&(e.columns=s(e.columns,t,n)),o=ue.guid(),e.headerAttributes=_e({id:o},e.headerAttributes),_e({encoded:t,hidden:n},e)})}function d(e,t){var r=[];return c(e,t,r),r[r.length-1]}function c(e,t,r){var n,o;for(r=r||[],n=0;n<t.length;n++){if(e===t[n])return!0;if(t[n].columns){if(o=r.length,r.push(t[n]),c(e,t[n].columns,r))return!0;r.splice(o,r.length-o)}}return!1}function u(e,t){var r=t?V:j;e.hidden=!t,e.attributes=r(e.attributes),e.footerAttributes=r(e.footerAttributes),e.headerAttributes=r(e.headerAttributes)}function h(){return"none"!==this.style.display}function p(e){return f([e]).length>0}function f(e){return we(e,function(e){var t=!e.hidden;return t&&e.columns&&(t=f(e.columns).length>0),t})}function g(t){return e(t).map(function(){return this.toArray()})}function m(e,t,r){var n=_(D(t)),o=_(F(t)),a=e.rowSpan;e.rowSpan=r?n>o?a-(n-o)||1:a+(o-n):n>o?a+(n-o):a-(o-n)||1}function k(t,r,n,o,a,l,i){var s,d,c=_(t),u=_([r]);c>u&&(s=Array(i+1).join('<th class="k-group-cell k-header" scope="col">&nbsp;</th>'),d=l.children(":not(.k-filter-row)"),e(Array(c-u+1).join("<tr>"+s+"</tr>")).insertAfter(d.last())),z(l,c-u),v(n,o,a,l)}function b(t,r,n){var o,a,l,i,s,d,c,u;for(n=n||0,l=r,r=E(r),i={},s=t.find(">tr:not(.k-filter-row)"),d=function(){var t=e(this);return!t.hasClass("k-group-cell")&&!t.hasClass("k-hierarchy-cell")},c=0,u=r.length;c<u;c++)o=w(r[c],l),i[o.row]||(i[o.row]=s.eq(o.row).find(".k-header").filter(d)),a=i[o.row].eq(o.cell),a.attr(ue.attr("index"),n+c);return r.length}function _(e){var t,r,n=1,o=0;for(t=0;t<e.length;t++)e[t].columns&&(r=_(e[t].columns),r>o&&(o=r));return n+o}function v(t,r,n,o){var a,l,i=T(t[0],r),s=n.find(">tr:not(.k-filter-row):eq("+i.row+")>th.k-header"),d=e(),c=i.cell;for(a=0;a<t.length;a++)d=d.add(s.eq(c+a));for(o.find(">tr:not(.k-filter-row)").eq(i.row).append(d),l=[],a=0;a<t.length;a++)t[a].columns&&(l=l.concat(t[a].columns));l.length&&v(l,r,n,o)}function w(e,t,r,n){var o,a;for(r=r||0,n=n||{},n[r]=n[r]||0,a=0;a<t.length;a++){if(t[a]==e){o={cell:n[r],row:r};break}if(t[a].columns&&(o=w(e,t[a].columns,r+1,n)))break;n[r]++}return o}function C(e,t,r,n){var o,a=r.locked;do o=e[t],t+=n?1:-1;while(o&&t>-1&&t<e.length&&o!=r&&!o.columns&&o.locked==a);return o}function y(e,t,r,n){var o,a,l,i;return t.columns?(t=t.columns,t[n?0:t.length-1]):(o=d(t,e),a=o?o.columns:e,l=ye(t,a),0===l&&n?l++:l!=a.length-1||n?(l>0||0===l&&!n)&&(l+=n?-1:1):l--,i=ye(r,a),t=C(a,l,r,i>l),t&&t!=r&&t.columns?y(e,t,r,n):null)}function T(e,t,r,n){var o,a;for(r=r||0,n=n||{},n[r]=n[r]||0,a=0;a<t.length;a++){if(t[a]==e){o={cell:n[r],row:r};break}if(t[a].columns&&(o=T(e,t[a].columns,r+1,n)))break;t[a].hidden||n[r]++}return o}function x(e){var t=S(D(e));return t.concat(S(F(e)))}function S(e){var t,r=[],n=[];for(t=0;t<e.length;t++)r.push(e[t]),e[t].columns&&(n=n.concat(e[t].columns));return n.length&&(r=r.concat(S(n))),r}function H(e){var t,r,n=0;for(r=0;r<e.length;r++)t=e[r],t.columns?n+=H(t.columns):t.hidden&&n++;return n}function R(e){var t,r,n,o=0;for(r=0,n=e.length;r<n;r++)t=e[r].style.width,t&&t.indexOf("%")==-1&&(o+=parseInt(t,10));return o}function L(e,t){var r,n,o=e.find("tr:not(.k-filter-row) th:not(.k-group-cell,.k-hierarchy-cell)");for(n=0;n<o.length;n++)r=o[n].rowSpan,r>1&&(o[n].rowSpan=r-t||1)}function z(e,t){var r,n=e.find("tr:not(.k-filter-row) th:not(.k-group-cell,.k-hierarchy-cell)");for(r=0;r<n.length;r++)n[r].rowSpan+=t}function I(t){var r,n=t.find("tr:not(.k-filter-row)"),o=n.filter(function(){return!e(this).children().length}).remove().length,a=n.find("th:not(.k-group-cell,.k-hierarchy-cell)");for(r=0;r<a.length;r++)a[r].rowSpan>1&&(a[r].rowSpan-=o);return n.length-o}function A(e,t,r,n,o){var a,l,i,s=[];for(a=0,i=e.length;a<i;a++)l=r[n]||[],l.push(t.eq(o+a)),r[n]=l,e[a].columns&&(s=s.concat(e[a].columns));s.length&&A(s,t,r,n+1,o+e.length)}function D(e){return we(e,function(e){return e.locked})}function F(e){return we(e,function(e){return!e.locked})}function q(e){return we(e,function(e){return!e.locked&&p(e)})}function M(e){return we(e,function(e){return e.locked&&p(e)})}function W(e){var t,r=[];for(t=0;t<e.length;t++)e[t].hidden||(e[t].columns?r=r.concat(W(e[t].columns)):r.push(e[t]));return r}function E(e){var t,r=[];for(t=0;t<e.length;t++)e[t].columns?r=r.concat(E(e[t].columns)):r.push(e[t]);return r}function N(r){var n,o=r.find(">tr:not(.k-filter-row)"),a=function(){var t=e(this);return!t.hasClass("k-group-cell")&&!t.hasClass("k-hierarchy-cell")},l=e();return o.length>1&&(l=o.find("th").filter(a).filter(function(){return this.rowSpan>1})),l=l.add(o.last().find("th").filter(a)),n=ue.attr("index"),l.sort(function(r,o){var a,l;return r=e(r),o=e(o),a=r.attr(n),l=o.attr(n),a===t&&(a=e(r).index()),l===t&&(l=e(o).index()),a=parseInt(a,10),l=parseInt(l,10),a>l?1:a<l?-1:0}),l}function P(t){var r,n,o,a,l,i,s,d=t.closest("table"),c=e().add(t),u=t.closest("tr"),h=d.find("tr:not(.k-filter-row)"),p=h.index(u);if(p>0){for(r=h.eq(p-1),n=r.find("th:not(.k-group-cell,.k-hierarchy-cell)").filter(function(){return!e(this).attr("rowspan")}),o=0,a=u.find("th:not(.k-group-cell,.k-hierarchy-cell)").index(t),l=t.prevAll(":not(.k-group-cell,.k-hierarchy-cell)").filter(function(){return this.colSpan>1}),i=0;i<l.length;i++)o+=l[i].colSpan||1;for(a+=Math.max(o-1,0),o=0,i=0;i<n.length;i++)if(s=n.eq(i),o+=s.attr("colSpan")?s[0].colSpan:1,a>=i&&a<o){c=P(s).add(c);break}}return c}function B(t){var r,n,o,a,l,i,s,d=t.closest("thead"),c=e().add(t),u=t.closest("tr"),h=d.find("tr:not(.k-filter-row)"),p=h.index(u)+t[0].rowSpan,f=ue.attr("colspan");if(p<=h.length-1){for(r=u.next(),n=t.prevAll(":not(.k-group-cell,.k-hierarchy-cell)"),n=n.filter(function(){return!this.rowSpan||1===this.rowSpan}),a=0,o=0;o<n.length;o++)a+=parseInt(n.eq(o).attr(f),10)||1;for(l=r.find("th:not(.k-group-cell,.k-hierarchy-cell)"),i=parseInt(t.attr(f),10)||1,o=0;o<i;)r=l.eq(o+a),c=c.add(B(r)),s=parseInt(r.attr(f),10),s>1&&(i-=s-1),o++}return c}function O(t,r,n,o){var a,l=t;return o&&t.empty(),fe?t[0].innerHTML=n:(a=document.createElement("div"),a.innerHTML="<table><tbody>"+n+"</tbody></table>",t=a.firstChild.firstChild,r[0].replaceChild(t,l[0]),t=e(t)),t}function j(e){e=e||{};var t=e.style;return t?(t=t.replace(/((.*)?display)(.*)?:([^;]*)/i,"$1:none"),t===e.style&&(t=t.replace(/(.*)?/i,"display:none;$1"))):t="display:none",_e({},e,{style:t})}function V(e){e=e||{};var t=e.style;return t&&(e.style=t.replace(/(display\s*:\s*none\s*;?)*/gi,"")),e}function U(t,r,n,o){var a,l=t.find(">colgroup"),i=ve(r,function(e){return a=e.width,a&&0!==parseInt(a,10)?ue.format('<col style="width:{0}"/>',typeof a===dt?a:a+"px"):"<col />"});(n||l.find(".k-hierarchy-col").length)&&i.splice(0,0,'<col class="k-hierarchy-col" />'),l.length&&l.remove(),l=e(Array(o+1).join('<col class="k-group-col">')+i.join("")),l.is("colgroup")||(l=e("<colgroup/>").append(l)),t.prepend(l),wt.msie&&8==wt.version&&(t.css("display","inline-table"),window.setTimeout(function(){t.css("display","")},1))}function G(e,t){var r,n,o=0,a=e.find("th:not(.k-group-cell)");for(r=0,n=t.length;r<n;r++)t[r].locked&&(a.eq(r).insertBefore(a.eq(o)),a=e.find("th:not(.k-group-cell)"),o++)}function K(e){var t,r,n,o={};for(r=0,n=e.length;r<n;r++)t=e[r],o[t.value]=t.text;return o}function $(e,t,r,n){var o=r&&r.length&&be(r[0])&&"value"in r[0],a=o?K(r)[e]:e;return a=null!=a?a:"",t?ue.format(t,a):n===!1?a:ue.htmlEncode(a)}function Q(e,t,r){for(var n,o=0,a=e[o];a;){if(n=!!r||"none"!==a.style.display,n&&!kt.test(a.className)&&--t<0){a.style.display=r?"":"none";break}a=e[++o]}}function X(t,r){for(var n,o,a=0,l=t.length;a<l;a+=1)o=t.eq(a),o.is(".k-grouping-row,.k-detail-row")?(n=o.children(":not(.k-group-cell):first,.k-detail-cell").last(),n.attr("colspan",parseInt(n.attr("colspan"),10)-1)):(o.hasClass("k-grid-edit-row")&&(n=o.children(".k-edit-container")[0])&&(n=e(n),n.attr("colspan",parseInt(n.attr("colspan"),10)-1),n.find("col").eq(r).remove(),o=n.find("tr:first")),Q(o[0].cells,r,!1))}function J(e){var t,r,n=[];for(r=0;r<e.length&&(t=e[r],"field"in t&&"value"in t&&"items"in t);r++)n.push(t),t.hasSubgroups&&(n=n.concat(J(t.items)));return n}function Y(e){var t,r,n=[];for(r=0;r<e.length&&(t=e[r],"field"in t&&"value"in t&&"items"in t);r++)t.hasSubgroups&&(n=n.concat(Y(t.items))),n.push(t.aggregates);return n}function Z(t,r){for(var n,o,a,l=0,i=t.length;l<i;l+=1)o=t.eq(l),o.is(".k-grouping-row,.k-detail-row")?(n=o.children(":not(.k-group-cell):first,.k-detail-cell").last(),n.attr("colspan",parseInt(n.attr("colspan"),10)+1)):(o.hasClass("k-grid-edit-row")&&(n=o.children(".k-edit-container")[0])&&(n=e(n),n.attr("colspan",parseInt(n.attr("colspan"),10)+1),U(n.find(">form>table"),f(a),!1,0),o=n.find("tr:first")),Q(o[0].cells,r,!0))}function ee(e,t,r){r=r||1;var n,o,a;for(o=0,a=e.length;o<a;o++)n=e.eq(o).children().last(),n.attr("colspan",parseInt(n.attr("colspan"),10)+r),n=t.eq(o).children().last(),n.attr("colspan",parseInt(n.attr("colspan"),10)-r)}function te(e){var t,r,n=0,o=e.find(">colgroup>col");for(t=0,r=o.length;t<r;t+=1)n+=parseInt(o[t].style.width,10);return n}function re(e,t){var r,n,o,a;e=e[0],t=t[0],e.rows.length!==t.rows.length&&(r=e.offsetHeight,n=t.offsetHeight,r>n?(o=t.rows[t.rows.length-1],bt.test(o.className)&&(o=t.rows[t.rows.length-2]),a=r-n):(o=e.rows[e.rows.length-1],bt.test(o.className)&&(o=e.rows[e.rows.length-2]),a=n-r),o.style.height=o.offsetHeight+a+"px")}function ne(e,t){var r,n=e.offsetHeight,o=t.offsetHeight;n>o?r=n+"px":n<o&&(r=o+"px"),r&&(e.style.height=t.style.height=r)}function oe(e,t){var r,n,o;if(typeof e===dt&&e===t)return e;if(be(e)&&e.name===t)return e;if(Ce(e))for(r=0,n=e.length;r<n;r++)if(o=e[r],typeof o===dt&&o===t||o.name===t)return o;return null}function ae(t,r){var n,o,a=wt.msie||wt.edge;if(r===!0){if(t=e(t),n=t.parent().scrollTop(),o=t.parent().scrollLeft(),a)try{t[0].setActive()}catch(l){t[0].focus()}else t[0].focus();t.parent().scrollTop(n).scrollLeft(o)}else e(t).one("focusin",function(e){e.preventDefault()}).focus()}function le(t){return e(t).is(":button,a,:input,a>.k-icon,textarea,span.k-select,span.k-icon,span.k-link,.k-input,.k-multiselect-wrap,.k-tool-icon")}function ie(r){var n=e(r.currentTarget),o=n.is("th"),a=this.table.add(this.lockedTable),l=this.thead.parent().add(e(">table",this.lockedHeader)),i=le(r.target),s=n.closest("table")[0];if(!ue.support.touch)return i&&n.find(ue.roleSelector("filtercell")).length?(this._setCurrent(n),t):(s!==a[0]&&s!==a[1]&&s!==l[0]&&s!==l[1]||e(r.target).is("a.k-i-collapse, a.k-i-expand")||(this.options.navigatable&&this._setCurrent(n),!o&&i||setTimeout(function(){yt&&e(ue._activeElement()).hasClass("k-widget")||le(ue._activeElement())||ae(s,!0)}),o&&r.preventDefault()),t)}function se(e){return e&&(e.hasClass("k-edit-cell")||e.parent().hasClass("k-grid-edit-row"))}function de(e,t,n){return'<tr role="row" class="k-grouping-row">'+r(t)+'<td colspan="'+e+'" aria-expanded="true"><p class="k-reset"><a class="k-icon k-i-collapse" href="#" tabindex="-1"></a>'+n+"</p></td></tr>"}function ce(e){return'<tr role="row" class="k-grouping-row"><td colspan="'+e+'" aria-expanded="true"><p class="k-reset">&nbsp;</p></td></tr>'}var ue=window.kendo,he=ue.ui,pe=ue.data.DataSource,fe=ue.support.tbodyInnerHtml,ge=ue._activeElement,me=he.Widget,ke=ue.keys,be=e.isPlainObject,_e=e.extend,ve=e.map,we=e.grep,Ce=e.isArray,ye=e.inArray,Te=Array.prototype.push,xe=e.proxy,Se=ue.isFunction,He=e.isEmptyObject,Re=Math,Le="progress",ze="error",Ie=":not(.k-group-cell):not(.k-hierarchy-cell):visible",Ae="tbody>tr:not(.k-grouping-row):not(.k-detail-row):not(.k-group-footer) > td:not(.k-group-cell):not(.k-hierarchy-cell)",De="tr:not(.k-footer-template):visible",Fe=":not(.k-group-cell):not(.k-hierarchy-cell):visible",qe=De+":first>"+Fe+":first",Me="th.k-header:not(.k-group-cell):not(.k-hierarchy-cell)",We=".kendoGrid",Ee="edit",Ne="save",Pe="remove",Be="detailInit",Oe="filterMenuInit",je="columnMenuInit",Ve="change",Ue="columnHide",Ge="columnShow",Ke="saveChanges",$e="dataBound",Qe="detailExpand",Xe="detailCollapse",Je="k-state-focused",Ye="k-state-selected",Ze="k-grid-norecords",et="columnResize",tt="columnReorder",rt="columnLock",nt="columnUnlock",ot="navigate",at="click",lt="height",it="tabIndex",st="function",dt="string",ct="Are you sure you want to delete this record?",ut="No records available.",ht="Delete",pt="Cancel",ft=/(\}|\#)/gi,gt=/#/gi,mt="[\\x20\\t\\r\\n\\f]",kt=RegExp("(^|"+mt+")(k-group-cell|k-hierarchy-cell)("+mt+"|$)"),bt=RegExp("(^|"+mt+")(k-filter-row)("+mt+"|$)"),_t='<a class="k-button k-button-icontext #=className#" #=attr# href="\\#"><span class="#=iconClass# #=imageClass#"></span>#=text#</a>',vt=!1,wt=ue.support.browser,Ct=wt.msie&&7==wt.version,yt=wt.msie&&8==wt.version,Tt=me.extend({init:function(e,t){var r=this;me.fn.init.call(r,e,t),r._refreshHandler=xe(r.refresh,r),r.setDataSource(t.dataSource),r.wrap()},setDataSource:function(e){var t=this;t.dataSource&&t.dataSource.unbind(Ve,t._refreshHandler),t.dataSource=e,t.dataSource.bind(Ve,t._refreshHandler)},options:{name:"VirtualScrollable",itemHeight:e.noop,prefetch:!0},destroy:function(){var e=this;me.fn.destroy.call(e),e.dataSource.unbind(Ve,e._refreshHandler),e.wrapper.add(e.verticalScrollbar).off(We),e.drag&&(e.drag.destroy(),e.drag=null),e.wrapper=e.element=e.verticalScrollbar=null,e._refreshHandler=null},wrap:function(){var t,r=this,n=ue.support.scrollbar()+1,o=r.element;o.css({width:"auto",overflow:"hidden"}).css(vt?"padding-left":"padding-right",n),r.content=o.children().first(),t=r.wrapper=r.content.wrap('<div class="k-virtual-scrollable-wrap"/>').parent().bind("DOMMouseScroll"+We+" mousewheel"+We,xe(r._wheelScroll,r)),ue.support.kineticScrollNeeded&&(r.drag=new ue.UserEvents(r.wrapper,{global:!0,start:function(e){e.sender.capture()},move:function(e){r.verticalScrollbar.scrollTop(r.verticalScrollbar.scrollTop()-e.y.delta),t.scrollLeft(t.scrollLeft()-e.x.delta),e.preventDefault()}})),r.verticalScrollbar=e('<div class="k-scrollbar k-scrollbar-vertical" />').css({width:n}).appendTo(o).bind("scroll"+We,xe(r._scroll,r))},_wheelScroll:function(e){if(!e.ctrlKey){var t=this.verticalScrollbar,r=t.scrollTop(),n=ue.wheelDeltaY(e);!n||n>0&&0===r||n<0&&r+t[0].clientHeight==t[0].scrollHeight||(e.preventDefault(),this.verticalScrollbar.scrollTop(r+-n))}},_scroll:function(e){var t=this,r=!t.options.prefetch,n=e.currentTarget.scrollTop,o=t.dataSource,a=t.itemHeight,l=o.skip()||0,i=t._rangeStart||l,s=t.element.innerHeight(),d=!!(t._scrollbarTop&&t._scrollbarTop>n),c=Re.max(Re.floor(n/a),0),u=Re.max(c+Re.floor(s/a),0);t._scrollTop=n-i*a,t._scrollbarTop=n,t._scrolling=r,t._fetch(c,u,d)||(t.wrapper[0].scrollTop=t._scrollTop),r&&(t._scrollingTimeout&&clearTimeout(t._scrollingTimeout),t._scrollingTimeout=setTimeout(function(){t._scrolling=!1,t._page(t._rangeStart,t.dataSource.take())},100))},itemIndex:function(e){var t=this._rangeStart||this.dataSource.skip()||0;return t+e},position:function(e){var t,r=this._rangeStart||this.dataSource.skip()||0,n=this.dataSource.pageSize();return t=e>r?e-r+1:r-e-1,t>n?n:t},scrollIntoView:function(e){var t=this.wrapper[0],r=t.clientHeight,n=this._scrollTop||t.scrollTop,o=e[0].offsetTop,a=e[0].offsetHeight;n>o?this.verticalScrollbar[0].scrollTop-=r/2:o+a>=n+r&&(this.verticalScrollbar[0].scrollTop+=r/2)},_fetch:function(t,r,n){var o=this,a=o.dataSource,l=o.itemHeight,i=a.take(),s=o._rangeStart||a.skip()||0,d=Re.floor(t/i)*i,c=!1,u=.33;return t<s?(c=!0,s=Re.max(0,r-i),o._scrollTop=(t-s)*l,o._page(s,i)):r>=s+i&&!n?(c=!0,s=t,o._scrollTop=l,o._page(s,i)):!o._fetching&&o.options.prefetch&&(t<d+i-i*u&&t>i&&a.prefetch(d-i,i,e.noop),r>d+i*u&&a.prefetch(d+i,i,e.noop)),c},fetching:function(){return this._fetching},_page:function(e,t){var r=this,n=!r.options.prefetch,o=r.dataSource;clearTimeout(r._timeout),r._fetching=!0,r._rangeStart=e,o.inRange(e,t)?o.range(e,t):(n||ue.ui.progress(r.wrapper.parent(),!0),r._timeout=setTimeout(function(){r._scrolling||(n&&ue.ui.progress(r.wrapper.parent(),!0),o.range(e,t))},100))},repaintScrollbar:function(){var e,t=this,r="",n=25e4,o=t.dataSource,a=ue.support.kineticScrollNeeded?0:ue.support.scrollbar(),l=t.wrapper[0],i=t.itemHeight=t.options.itemHeight()||0,s=l.scrollWidth>l.offsetWidth?a:0,d=o.total()*i+s;for(e=0;e<Re.floor(d/n);e++)r+='<div style="width:1px;height:'+n+'px"></div>';d%n&&(r+='<div style="width:1px;height:'+d%n+'px"></div>'),t.verticalScrollbar.html(r),l.scrollTop=t._scrollTop},refresh:function(){var e=this,t=e.dataSource,r=e._rangeStart;ue.ui.progress(e.wrapper.parent(),!1),clearTimeout(e._timeout),e.repaintScrollbar(),e.drag&&e.drag.cancel(),r&&!e._fetching&&(e._rangeStart=t.skip(),1===t.page()&&(e.verticalScrollbar[0].scrollTop=0)),e._fetching=!1}}),xt={create:{text:"Add new record",imageClass:"k-add",className:"k-grid-add",iconClass:"k-icon"},cancel:{text:"Cancel changes",imageClass:"k-cancel",className:"k-grid-cancel-changes",iconClass:"k-icon"},save:{text:"Save changes",imageClass:"k-update",className:"k-grid-save-changes",iconClass:"k-icon"},destroy:{text:"Delete",imageClass:"k-delete",className:"k-grid-delete",iconClass:"k-icon"},edit:{text:"Edit",imageClass:"k-edit",className:"k-grid-edit",iconClass:"k-icon"},update:{text:"Update",imageClass:"k-update",className:"k-primary k-grid-update",iconClass:"k-icon"},canceledit:{text:"Cancel",imageClass:"k-cancel",className:"k-grid-cancel",iconClass:"k-icon"},excel:{text:"Export to Excel",imageClass:"k-i-excel",className:"k-grid-excel",iconClass:"k-icon"},pdf:{text:"Export to PDF",imageClass:"k-i-pdf",className:"k-grid-pdf",iconClass:"k-icon"}},St=ue.ui.DataBoundWidget.extend({init:function(t,r,n){var o=this;r=Ce(r)?{dataSource:r}:r,me.fn.init.call(o,t,r),n&&(o._events=n),vt=ue.support.isRtl(t),o._element(),o._aria(),o._columns(o.options.columns),o._dataSource(),o._tbody(),o._pageable(),o._thead(),o._groupable(),o._toolbar(),o._setContentHeight(),o._templates(),o._navigatable(),o._selectable(),o._clipboard(),o._details(),o._editable(),o._attachCustomCommandsEvent(),o._minScreenSupport(),o.options.autoBind?o.dataSource.fetch():(o._group=o._groups()>0,o._footer()),o.lockedContent&&(o.wrapper.addClass("k-grid-lockedcolumns"),o._resizeHandler=function(){o.resize()},e(window).on("resize"+We,o._resizeHandler)),ue.notify(o)},events:[Ve,"dataBinding","cancel",$e,Qe,Xe,Be,Oe,je,Ee,Ne,Pe,Ke,et,tt,Ge,Ue,rt,nt,ot],setDataSource:function(e){var t=this,r=t.options.scrollable;t.options.dataSource=e,t._dataSource(),t._pageable(),t._thead(),r&&(r.virtual?t.content.find(">.k-virtual-scrollable-wrap").scrollLeft(0):t.content.scrollLeft(0)),t.options.groupable&&t._groupable(),t.virtualScrollable&&t.virtualScrollable.setDataSource(t.options.dataSource),t.options.navigatable&&t._navigatable(),t.options.selectable&&t._selectable(),t.options.autoBind&&e.fetch()},options:{name:"Grid",columns:[],toolbar:null,autoBind:!0,filterable:!1,scrollable:!0,sortable:!1,selectable:!1,allowCopy:!1,navigatable:!1,pageable:!1,editable:!1,groupable:!1,rowTemplate:"",altRowTemplate:"",noRecords:!1,dataSource:{},height:null,resizable:!1,reorderable:!1,columnMenu:!1,detailTemplate:null,columnResizeHandleWidth:3,mobile:"",messages:{editable:{cancelDelete:pt,confirmation:ct,confirmDelete:ht},commands:{create:xt.create.text,cancel:xt.cancel.text,save:xt.save.text,destroy:xt.destroy.text,edit:xt.edit.text,update:xt.update.text,canceledit:xt.canceledit.text,excel:xt.excel.text,pdf:xt.pdf.text},noRecords:ut}},destroy:function(){var t,r=this;r._angularItems("cleanup"),r._destroyColumnAttachments(),me.fn.destroy.call(r),this._navigatableTables=null,r._resizeHandler&&e(window).off("resize"+We,r._resizeHandler),r.pager&&r.pager.element&&r.pager.destroy(),r.pager=null,r.groupable&&r.groupable.element&&r.groupable.element.kendoGroupable("destroy"),r.groupable=null,r.options.reorderable&&r.wrapper.data("kendoReorderable").destroy(),r.selectable&&r.selectable.element&&(r.selectable.destroy(),r.clearArea(),r.copyHandler&&(r.wrapper.off("keydown",r.copyHandler),r.unbind(r.copyHandler)),r.updateClipBoardState&&(r.unbind(r.updateClipBoardState),r.updateClipBoardState=null),r.clearAreaHandler&&r.wrapper.off("keyup",r.clearAreaHandler)),r.selectable=null,r.resizable&&(r.resizable.destroy(),r._resizeUserEvents&&(r._resizeHandleDocumentClickHandler&&e(document).off("click",r._resizeHandleDocumentClickHandler),r._resizeUserEvents.destroy(),r._resizeUserEvents=null),r.resizable=null),r.virtualScrollable&&r.virtualScrollable.element&&r.virtualScrollable.destroy(),r.virtualScrollable=null,r._destroyEditable(),r.dataSource&&(r.dataSource.unbind(Ve,r._refreshHandler).unbind(Le,r._progressHandler).unbind(ze,r._errorHandler),r._refreshHandler=r._progressHandler=r._errorHandler=null),t=r.element.add(r.wrapper).add(r.table).add(r.thead).add(r.wrapper.find(">.k-grid-toolbar")),r.content&&(t=t.add(r.content).add(r.content.find(">.k-virtual-scrollable-wrap"))),r.lockedHeader&&r._removeLockedContainers(),r.pane&&r.pane.destroy(),r.minScreenResizeHandler&&e(window).off("resize",r.minScreenResizeHandler),r._draggableInstance&&r._draggableInstance.element&&r._draggableInstance.destroy(),r._draggableInstance=null,t.off(We),ue.destroy(r.wrapper),r.rowTemplate=r.altRowTemplate=r.lockedRowTemplate=r.lockedAltRowTemplate=r.detailTemplate=r.footerTemplate=r.groupFooterTemplate=r.lockedGroupFooterTemplate=r.noRecordsTemplate=null,r.scrollables=r.thead=r.tbody=r.element=r.table=r.content=r.footer=r.wrapper=r.lockedTable=r.lockedContent=r.lockedHeader=r.lockedFooter=r._groupableClickHandler=r._setContentWidthHandler=null},getOptions:function(){var r,n,o,a=this.options;return a.dataSource=null,r=_e(!0,{},this.options),r.columns=ue.deepExtend([],this.columns),n=this.dataSource,o=n.options.data&&n._data,n.options.data=null,r.dataSource=e.extend(!0,{},n.options),n.options.data=o,r.dataSource.data=o,r.dataSource.page=n.page(),r.dataSource.filter=n.filter(),r.dataSource.pageSize=n.pageSize(),r.dataSource.sort=n.sort(),r.dataSource.group=n.group(),r.dataSource.aggregate=n.aggregate(),r.dataSource.transport&&(r.dataSource.transport.dataSource=null),r.pageable&&r.pageable.pageSize&&(r.pageable.pageSize=n.pageSize()),r.$angular=t,r},setOptions:function(e){var t,r,n,o,a=this.getOptions();ue.deepExtend(a,e),e.dataSource||(a.dataSource=this.dataSource),t=this.wrapper,r=this._events,n=this.element,this.destroy(),this.options=null,this._isMobile&&(o=t.closest(ue.roleSelector("pane")).parent(),o.after(t),o.remove(),t.removeClass("k-grid-mobile")),t[0]!==n[0]&&(t.before(n),t.remove()),n.empty(),this.init(n,a,r),this._setEvents(a)},items:function(){return this.lockedContent?this._items(this.tbody).add(this._items(this.lockedTable.children("tbody"))):this._items(this.tbody)},_items:function(t){return t.children().filter(function(){
  var t=e(this);return!t.hasClass("k-grouping-row")&&!t.hasClass("k-detail-row")&&!t.hasClass("k-group-footer")})},dataItems:function(){var e,t,r,n=ue.ui.DataBoundWidget.fn.dataItems.call(this);if(this.lockedContent){for(e=n.length,t=Array(2*e),r=e;--r>=0;)t[r]=t[r+e]=n[r];n=t}return n},_destroyColumnAttachments:function(){var t=this;t.resizeHandle=null,t.thead&&(this.angular("cleanup",function(){return{elements:t.thead.get()}}),t.thead.add(t.lockedHeader).find("th").each(function(){var t=e(this),r=t.data("kendoFilterMenu"),n=t.data("kendoColumnSorter"),o=t.data("kendoColumnMenu");r&&r.destroy(),n&&n.destroy(),o&&o.destroy()}))},_attachCustomCommandsEvent:function(){var e,t,r,n=this,o=E(n.columns||[]);for(t=0,r=o.length;t<r;t++)e=o[t].command,e&&i(n,n.wrapper,e)},_aria:function(){var e=this.element.attr("id")||"aria";e&&(this._cellId=e+"_active_cell")},_element:function(){var t=this,r=t.element;r.is("table")||(r=t.options.scrollable?t.element.find("> .k-grid-content > table"):t.element.children("table"),r.length||(r=e("<table />").appendTo(t.element))),Ct&&r.attr("cellspacing",0),t.table=r.attr("role",t._hasDetails()?"treegrid":"grid"),t._wrapper()},_createResizeHandle:function(t,r){var n,o,a,l,i,s,d,c=this,u=c.options.columnResizeHandleWidth,h=c.options.scrollable,p=c.resizeHandle,f=this._groups();if(p&&c.lockedContent&&p.data("th")[0]!==r[0]&&(p.off(We).remove(),p=null),p||(p=c.resizeHandle=e('<div class="k-resize-handle"><div class="k-resize-handle-inner"></div></div>'),t.append(p)),vt)n=r.position().left,h&&(l=r.closest(".k-grid-header-wrap, .k-grid-header-locked"),i=wt.msie?l.scrollLeft():0,s=wt.webkit?l[0].scrollWidth-l[0].offsetWidth-l.scrollLeft():0,d=wt.mozilla?l[0].scrollWidth-l[0].offsetWidth-(l[0].scrollWidth-l[0].offsetWidth-l.scrollLeft()):0,n-=s-d+i);else{for(n=r[0].offsetWidth,o=N(r.closest("thead")).filter(":visible"),a=0;a<o.length&&o[a]!=r[0];a++)n+=o[a].offsetWidth;f>0&&(n+=t.find(".k-group-cell:first").outerWidth()*f),c._hasDetails()&&(n+=t.find(".k-hierarchy-cell:first").outerWidth())}p.css({top:r.position().top,left:n-u,height:r.outerHeight(),width:3*u}).data("th",r).show(),p.off("dblclick"+We).on("dblclick"+We,function(){c._autoFitLeafColumn(r.data("index"))})},_positionColumnResizeHandle:function(){var t=this,r=t.options.columnResizeHandleWidth,n=t.lockedHeader?t.lockedHeader.find("thead:first"):e();t.thead.add(n).on("mousemove"+We,"th",function(n){function a(){var t,r=parseFloat(e(document.documentElement).css("zoom"));return isNaN(r)&&(r=1),t=parseFloat(e(document.body).css("zoom")),isNaN(t)&&(t=1),r*t}var l,i,s,d=e(this);d.hasClass("k-group-cell")||d.hasClass("k-hierarchy-cell")||(l=n.clientX/a(),i=e(window).scrollLeft(),s=d.offset().left+(vt?0:this.offsetWidth),l+i>s-r&&l+i<s+r?t._createResizeHandle(d.closest("div"),d):t.resizeHandle?t.resizeHandle.hide():o(t.wrapper,""))})},_resizeHandleDocumentClick:function(t){e(t.target).closest(".k-column-active").length||(e(document).off(t),this._hideResizeHandle())},_hideResizeHandle:function(){this.resizeHandle&&(this.resizeHandle.data("th").removeClass("k-column-active"),this.lockedContent&&!this._isMobile?(this.resizeHandle.off(We).remove(),this.resizeHandle=null):this.resizeHandle.hide())},_positionColumnResizeHandleTouch:function(){var t=this,r=t.lockedHeader?t.lockedHeader.find("thead:first"):e();t._resizeUserEvents=new ue.UserEvents(r.add(t.thead),{filter:"th:not(.k-group-cell):not(.k-hierarchy-cell)",threshold:10,hold:function(r){var n=e(r.target);r.preventDefault(),n.addClass("k-column-active"),t._createResizeHandle(n.closest("div"),n),t._resizeHandleDocumentClickHandler||(t._resizeHandleDocumentClickHandler=xe(t._resizeHandleDocumentClick,t)),e(document).on("click",t._resizeHandleDocumentClickHandler)}})},_resizable:function(){var t,r,n,a,l,i,s,d=this,c=d.options,u=this._isMobile,h=ue.support.mobileOS?0:ue.support.scrollbar();c.resizable&&(t=c.scrollable?d.wrapper.find(".k-grid-header-wrap:first"):d.wrapper,u?d._positionColumnResizeHandleTouch(t):d._positionColumnResizeHandle(t),d.resizable&&d.resizable.destroy(),d.resizable=new he.Resizable(t.add(d.lockedHeader),{handle:(c.scrollable?"":">")+".k-resize-handle",hint:function(t){return e('<div class="k-grid-resize-indicator" />').css({height:t.data("th").outerHeight()+d.tbody.attr("clientHeight")})},start:function(t){var h,p,f,g;s=e(t.currentTarget).data("th"),u&&d._hideResizeHandle(),h=s.closest("table"),p=e.inArray(s[0],N(s.closest("thead")).filter(":visible")),l=h.parent().hasClass("k-grid-header-locked"),f=l?d.lockedTable:d.table,g=d.footer||e(),d.footer&&d.lockedContent&&(g=d.footer.children(l?".k-grid-footer-locked":".k-grid-footer-wrap")),o(d.wrapper,"col-resize"),i=c.scrollable?h.find("col:not(.k-group-col):not(.k-hierarchy-col):eq("+p+")").add(f.children("colgroup").find("col:not(.k-group-col):not(.k-hierarchy-col):eq("+p+")")).add(g.find("colgroup").find("col:not(.k-group-col):not(.k-hierarchy-col):eq("+p+")")):f.children("colgroup").find("col:not(.k-group-col):not(.k-hierarchy-col):eq("+p+")"),r=t.x.location,n=s.outerWidth(),a=l?f.children("tbody").outerWidth():d.tbody.outerWidth(),wt.webkit&&d.wrapper.addClass("k-grid-column-resizing")},resize:function(t){var o,u,p,f,g,m,k=vt?-1:1,b=n+t.x.location*k-r*k;c.scrollable?(l&&d.lockedFooter?o=d.lockedFooter.children("table"):d.footer&&(o=d.footer.find(">.k-grid-footer-wrap>table")),o&&o[0]||(o=e()),u=s.closest("table"),p=l?d.lockedTable:d.table,f=!1,g=d.wrapper.width()-h,m=b,l&&a-n+m>g&&(m=n+(g-a-2*h),m<0&&(m=b),f=!0),m>10&&(i.css("width",m),a&&(m=f?g-2*h:a+t.x.location*k-r*k,p.add(u).add(o).css("width",m),l||(d._footerWidth=m)))):b>10&&i.css("width",b)},resizeend:function(){var e,t,r,a=s.outerWidth();o(d.wrapper,""),wt.webkit&&d.wrapper.removeClass("k-grid-column-resizing"),n!=a&&(t=d.lockedHeader?d.lockedHeader.find("thead:first tr:first").add(d.thead.find("tr:first")):s.parent(),r=s.attr(ue.attr("index")),r||(r=t.find("th:not(.k-group-cell):not(.k-hierarchy-cell)").index(s)),e=E(d.columns)[r],e.width=a,d.trigger(et,{column:e,oldWidth:n,newWidth:a}),d._applyLockedContainersWidth(),d._syncLockedContentHeight(),d._syncLockedHeaderHeight()),d._hideResizeHandle(),s=null}}))},_draggable:function(){var t,r=this;r.options.reorderable&&(r._draggableInstance&&r._draggableInstance.destroy(),t=r.wrapper.children(".k-grid-header"),r._draggableInstance=r.wrapper.kendoDraggable({group:ue.guid(),autoScroll:!0,filter:r.content?".k-grid-header:first "+Me:"table:first>.k-grid-header "+Me,dragstart:function(){t.children(".k-grid-header-wrap").unbind("scroll"+We+"scrolling").bind("scroll"+We+"scrolling",function(e){r.virtualScrollable?r.content.find(">.k-virtual-scrollable-wrap").scrollLeft(this.scrollLeft):r.scrollables.not(e.currentTarget).scrollLeft(this.scrollLeft)})},dragend:function(){t.children(".k-grid-header-wrap").unbind("scroll"+We+"scrolling")},drag:function(){r._hideResizeHandle()},hint:function(t){var r=t.attr(ue.attr("title"));return r&&(r=ue.htmlEncode(r)),e('<div class="k-header k-drag-clue" />').css({width:t.width(),paddingLeft:t.css("paddingLeft"),paddingRight:t.css("paddingRight"),lineHeight:t.height()+"px",paddingTop:t.css("paddingTop"),paddingBottom:t.css("paddingBottom")}).html(r||t.attr(ue.attr("field"))||t.text()).prepend('<span class="k-icon k-drag-status k-denied" />')}}).data("kendoDraggable"))},_reorderable:function(){var t,r=this;r.options.reorderable&&(r.wrapper.data("kendoReorderable")&&r.wrapper.data("kendoReorderable").destroy(),t=function(e,t,n){var o=e[t],a=e[n],l=d(o,r.columns);return e=l?l.columns:r.columns,ye(a,e)},r.wrapper.kendoReorderable({draggable:r._draggableInstance,dragOverContainers:function(e,n){var o=x(r.columns);return o[e].lockable!==!1&&t(o,e,n)>-1},inSameContainer:function(n){return e(n.source).parent()[0]===e(n.target).parent()[0]&&t(x(r.columns),n.sourceIndex,n.targetIndex)>-1},change:function(e){var n=x(r.columns),o=n[e.oldIndex],a=t(n,e.oldIndex,e.newIndex);r.trigger(tt,{newIndex:a,oldIndex:ye(o,n),column:o}),r.reorderColumn(a,o,"before"===e.position)}}))},_reorderHeader:function(e,t,r){var n,o,i,s,d=this,c=w(e[0],d.columns),u=w(t,d.columns),h=[];for(n=0;n<e.length;n++)e[n].columns&&(h=h.concat(e[n].columns));o=l(d.lockedHeader,d.thead,"tr:eq("+c.row+")>th.k-header:not(.k-group-cell,.k-hierarchy-cell)"),i=D(e).length,s=D([t]).length,h.length?(i>0&&0===s?k(e,t,h,d.columns,d.lockedHeader.find("thead"),d.thead,this._groups()):0===i&&s>0&&k(e,t,h,d.columns,d.thead,d.lockedHeader.find("thead"),this._groups()),(t.columns||c.cell-u.cell>1||u.cell-c.cell>1)&&(t=y(d.columns,t,e[0],r),t&&d._reorderHeader(h,t,r))):i!==s&&m(o[c.cell],d.columns,i),a(o,c.cell,u.cell,r,e.length)},_reorderContent:function(t,r,n){var o,i,s,d,c=this,u=e(),h=t[0],p=f(t),g=ye(h,E(c.columns)),m=ye(r,E(c.columns)),k=ye(h,W(c.columns)),b=ye(r,W(c.columns)),_=D(c.columns).length,v=!!r.locked,w=c.footer||c.wrapper.find(".k-grid-footer"),C=o=b;for(r.hidden&&(v?(b=c.lockedTable.find("colgroup"),C=c.lockedHeader.find("colgroup"),o=e(c.lockedFooter).find(">table>colgroup")):(b=c.tbody.prev(),C=c.thead.prev(),o=w.find(".k-grid-footer-wrap").find(">table>colgroup"))),c._hasFilterRow()&&a(c.wrapper.find(".k-filter-row th:not(.k-group-cell,.k-hierarchy-cell)"),g,m,n,t.length),a(l(c.lockedHeader,c.thead.prev(),"col:not(.k-group-col,.k-hierarchy-col)"),k,C,n,p.length),c.options.scrollable&&a(l(c.lockedTable,c.tbody.prev(),"col:not(.k-group-col,.k-hierarchy-col)"),k,b,n,p.length),w&&w.length&&(a(l(c.lockedFooter,w.find(".k-grid-footer-wrap"),">table>colgroup>col:not(.k-group-col,.k-hierarchy-col)"),k,o,n,p.length),a(w.find(".k-footer-template>td:not(.k-group-cell,.k-hierarchy-cell)"),g,m,n,t.length)),i=c.tbody.children(":not(.k-grouping-row,.k-detail-row)"),c.lockedTable&&(_>m?_<=g&&ee(c.lockedTable.find(">tbody>tr.k-grouping-row"),c.table.find(">tbody>tr.k-grouping-row"),t.length):_>g&&ee(c.table.find(">tbody>tr.k-grouping-row"),c.lockedTable.find(">tbody>tr.k-grouping-row"),t.length),u=c.lockedTable.find(">tbody>tr:not(.k-grouping-row,.k-detail-row)")),s=0,d=i.length;s<d;s+=1)a(l(u[s],i[s],">td:not(.k-group-cell,.k-hierarchy-cell)"),g,m,n,t.length)},_autoFitLeafColumn:function(e){this.autoFitColumn(E(this.columns)[e])},autoFitColumn:function(t){var r,n,o,a,l,i,s,d,c,u,f,g,m,k,b,_,v,w,C,y=this,T=y.options,x=y.columns,H=y.lockedHeader?N(y.lockedHeader.find(">table>thead")).filter(h).length:0,R="col:not(.k-group-col):not(.k-hierarchy-col)",L="td:visible:not(.k-group-cell):not(.k-hierarchy-cell)";if(t="number"==typeof t?x[t]:be(t)?we(S(x),function(e){return e===t})[0]:we(S(x),function(e){return e.field===t})[0],t&&p(t)){for(r=ye(t,E(x)),a=t.locked,o=a?y.lockedHeader.children("table"):y.thead.parent(),n=o.find("[data-index='"+r+"']"),d=a?y.lockedTable:y.table,c=y.footer||e(),y.footer&&y.lockedContent&&(c=y.footer.children(a?".k-grid-footer-locked":".k-grid-footer-wrap")),u=c.find("table").first(),y.lockedHeader&&!a&&(r-=H),f=0;f<x.length&&x[f]!==t;f++)x[f].hidden&&r--;if(T.scrollable?(l=o.find(R).eq(r).add(d.children("colgroup").find(R).eq(r)).add(u.find("colgroup").find(R).eq(r)),a||(i=d.parent(),s=i.scrollLeft())):l=d.children("colgroup").find(R).eq(r),g=o.add(d).add(u),m=n.outerWidth(),l.width(""),g.css("table-layout","fixed"),l.width("auto"),g.addClass("k-autofitting"),g.css("table-layout",""),k=Math.ceil(Math.max(n.outerWidth(),d.find("tr:not(.k-grouping-row)").eq(0).children(L).eq(r).outerWidth(),u.find("tr").eq(0).children(L).eq(r).outerWidth()))+1,l.width(k),t.width=k,T.scrollable){for(b=o.find("col"),v=0,w=0,C=b.length;w<C;w+=1){if(_=b[w].style.width,!_||_.indexOf("%")!=-1){v=0;break}v+=parseInt(_,10)}v&&g.each(function(){this.style.width=v+"px"})}wt.msie&&8==wt.version&&(g.css("display","inline-table"),setTimeout(function(){g.css("display","table")},1)),g.removeClass("k-autofitting"),s&&i.scrollLeft(s),y.trigger(et,{column:t,oldWidth:m,newWidth:k}),y._applyLockedContainersWidth(),y._syncLockedContentHeight(),y._syncLockedHeaderHeight()}},reorderColumn:function(e,r,n){var o,a,l=this,i=d(r,l.columns),s=i?i.columns:l.columns,c=ye(r,s),u=s[e],h=!!u.locked,p=D(l.columns).length;c!==e&&(!r.locked&&h&&1==F(l.columns).length||r.locked&&!h&&1==p||(l._hideResizeHandle(),n===t&&(n=e<c),a=[r],l._reorderHeader(a,u,n),l.lockedHeader&&(I(l.thead),I(l.lockedHeader)),u.columns&&(u=E(u.columns),u=u[n?0:u.length-1]),r.columns&&(a=E(r.columns)),l._reorderContent(a,u,n),o=!!r.locked,o=o!=h,r.locked=h,s.splice(n?e:e+1,0,r),s.splice(c<e?c:c+1,1),l._templates(),l._updateColumnCellIndex(),l._updateTablesWidth(),l._applyLockedContainersWidth(),l._syncLockedHeaderHeight(),l._syncLockedContentHeight(),l._updateFirstColumnClass(),o&&(h?l.trigger(rt,{column:r}):l.trigger(nt,{column:r}))))},_updateColumnCellIndex:function(){var e,t=0;this.lockedHeader&&(e=this.lockedHeader.find("thead"),t=b(e,D(this.columns))),b(this.thead,F(this.columns),t)},lockColumn:function(e){var t,r=this.columns;e="number"==typeof e?r[e]:we(r,function(t){return t.field===e})[0],!e||e.locked||e.hidden||(t=D(r).length-1,this.reorderColumn(t,e,!1))},unlockColumn:function(e){var t,r=this.columns;e="number"==typeof e?r[e]:we(r,function(t){return t.field===e})[0],e&&e.locked&&!e.hidden&&(t=D(r).length,this.reorderColumn(t,e,!0))},cellIndex:function(t){var r=0;return this.lockedTable&&!e.contains(this.lockedTable[0],t[0])&&(r=E(D(this.columns)).length),e(t).parent().children("td:not(.k-group-cell,.k-hierarchy-cell)").index(t)+r},_modelForContainer:function(t){t=e(t),t.is("tr")||"popup"===this._editMode()||(t=t.closest("tr"));var r=t.attr(ue.attr("uid"));return this.dataSource.getByUid(r)},_editable:function(){var t,r=this,n=r.selectable&&r.selectable.options.multiple,o=r.options.editable,a=function(){var t=ge(),n=r._editContainer;!n||e.contains(n[0],t)||n[0]===t||e(t).closest(".k-animation-container").length||r.editable.end()&&r.closeCell()};o&&(this.wrapper.addClass("k-editable"),t=r._editMode(),"incell"===t?o.update!==!1&&r.wrapper.on(at+We,"tr:not(.k-grouping-row) > td",function(t){var o=e(this),a=r.lockedTable&&o.closest("table")[0]===r.lockedTable[0];o.hasClass("k-hierarchy-cell")||o.hasClass("k-detail-cell")||o.hasClass("k-group-cell")||o.hasClass("k-edit-cell")||o.has("a.k-grid-delete").length||o.has("button.k-grid-delete").length||o.closest("tbody")[0]!==r.tbody[0]&&!a||e(t.target).is(":input")||(r.editable?r.editable.end()&&(n&&e(ge()).blur(),r.closeCell(),r.editCell(o)):r.editCell(o))}).on("focusin"+We,function(){e.contains(this,ge())||(clearTimeout(r.timer),r.timer=null)}).on("focusout"+We,function(){r.timer=setTimeout(a,1)}):o.update!==!1&&r.wrapper.on(at+We,"tbody>tr:not(.k-detail-row,.k-grouping-row):visible a.k-grid-edit",function(t){t.preventDefault(),r.editRow(e(this).closest("tr"))}),o.destroy!==!1?r.wrapper.on(at+We,"tbody>tr:not(.k-detail-row,.k-grouping-row):visible .k-grid-delete",function(t){t.preventDefault(),t.stopPropagation(),r.removeRow(e(this).closest("tr"))}):r.wrapper.on(at+We,"tbody>tr:not(.k-detail-row,.k-grouping-row):visible button.k-grid-delete",function(e){e.stopPropagation(),r._confirmation()||e.preventDefault()}))},editCell:function(t){var r,n,o,a;t=e(t),r=this,n=E(r.columns)[r.cellIndex(t)],o=r._modelForContainer(t),r.closeCell(),!o||o.editable&&!o.editable(n.field)||n.command||!n.field||(r._attachModelChange(o),r._editContainer=t,r.editable=t.addClass("k-edit-cell").kendoEditable({fields:{field:n.field,format:n.format,editor:n.editor,values:n.values},model:o,target:r,change:function(e){r.trigger(Ne,{values:e.values,container:t,model:o})&&e.preventDefault()}}).data("kendoEditable"),a=t.parent().addClass("k-grid-edit-row"),r.lockedContent&&ne(a[0],r._relatedRow(a).addClass("k-grid-edit-row")[0]),r.trigger(Ee,{container:t,model:o}))},_adjustLockedHorizontalScrollBar:function(){var e=this.table,t=e.parent(),r=e[0].offsetWidth>t[0].clientWidth?ue.support.scrollbar():0;this.lockedContent.height(t.height()-r)},_syncLockedContentHeight:function(){this.lockedTable&&(this.touchScroller||this._adjustLockedHorizontalScrollBar(),this._adjustRowsHeight(this.table,this.lockedTable))},_syncLockedHeaderHeight:function(){var e,t;this.lockedHeader&&(e=this.lockedHeader.children("table"),t=this.thead.parent(),this._adjustRowsHeight(e,t),re(e,t))},_syncLockedFooterHeight:function(){this.lockedFooter&&this.footer&&this.footer.length&&this._adjustRowsHeight(this.lockedFooter.children("table"),this.footer.find(".k-grid-footer-wrap > table"))},_destroyEditable:function(){var e=this,t=function(){if(e.editable){var t=e.editView?e.editView.element:e._editContainer;t&&(t.off(at+We,"a.k-grid-cancel",e._editCancelClickHandler),t.off(at+We,"a.k-grid-update",e._editUpdateClickHandler)),e._detachModelChange(),e.editable.destroy(),e.editable=null,e._editContainer=null,e._destroyEditView()}};e.editable&&("popup"!==e._editMode()||e._isMobile?t():e._editContainer.data("kendoWindow").bind("deactivate",t).close()),e._actionSheet&&(e._actionSheet.destroy(),e._actionSheet=null)},_destroyEditView:function(){this.editView&&(this.editView.purge(),this.editView=null,this.pane.navigate(""))},_attachModelChange:function(e){var t=this;t._modelChangeHandler=function(e){t._modelChange({field:e.field,model:this})},e.bind("change",t._modelChangeHandler)},_detachModelChange:function(){var e=this,t=e._editContainer,r=e._modelForContainer(t);r&&r.unbind(Ve,e._modelChangeHandler)},closeCell:function(t){var r,n,o,a,l=this,i=l._editContainer;i&&(r=i.closest("tr").attr(ue.attr("uid")),a=l.dataSource.getByUid(r),t&&l.trigger("cancel",{container:i,model:a})||(i.removeClass("k-edit-cell"),n=E(l.columns)[l.cellIndex(i)],o=i.parent().removeClass("k-grid-edit-row"),l._destroyEditable(),l._displayCell(i,n,a),i.hasClass("k-dirty-cell")&&e('<span class="k-dirty"/>').prependTo(i),l.trigger("itemChange",{item:o,data:a,ns:he}),l.lockedContent&&ne(o.css("height","")[0],l._relatedRow(o).css("height","")[0])))},_displayCell:function(e,t,r){var n=this,o={storage:{},count:0},a=_e({},ue.Template,n.options.templateSettings),l=ue.template(n._cellTmpl(t,o),a);o.count>0&&(l=xe(l,o.storage)),e.empty().html(l(r)),n.angular("compile",function(){return{elements:e,data:[{dataItem:r}]}})},removeRow:function(e){this._confirmation(e)&&this._removeRow(e)},_removeRow:function(t){var r,n=this,o=n._editMode();"incell"!==o&&n.cancelRow(),t=e(t),n.lockedContent&&(t=t.add(n._relatedRow(t))),t=t.hide(),r=n._modelForContainer(t),r&&!n.trigger(Pe,{row:t,model:r})?(n.dataSource.remove(r),"inline"!==o&&"popup"!==o||n.dataSource.sync()):"incell"===o&&n._destroyEditable()},_editMode:function(){var e="incell",t=this.options.editable;return t!==!0&&(e="string"==typeof t?t:t.mode||e),e},editRow:function(t){var r,n,o,a=this;t instanceof ue.data.ObservableObject?r=t:(t=e(t),r=a._modelForContainer(t)),n=a._editMode(),a.cancelRow(),r&&(t=a.tbody.children("["+ue.attr("uid")+"="+r.uid+"]"),a._attachModelChange(r),"popup"===n?a._createPopupEditor(r):"inline"===n?a._createInlineEditor(t,r):"incell"===n&&e(t).children(Ie).each(function(){var t=e(this),n=E(a.columns)[a.cellIndex(t)];if(r=a._modelForContainer(t),r&&(!r.editable||r.editable(n.field))&&n.field)return a.editCell(t),!1}),o=a.editView?a.editView.element:a._editContainer,o&&(this._editCancelClickHandler||(this._editCancelClickHandler=xe(this._editCancelClick,this)),o.on(at+We,"a.k-grid-cancel",this._editCancelClickHandler),this._editUpdateClickHandler||(this._editUpdateClickHandler=xe(this._editUpdateClick,this)),o.on(at+We,"a.k-grid-update",this._editUpdateClickHandler)))},_editUpdateClick:function(e){e.preventDefault(),e.stopPropagation(),this.saveRow()},_editCancelClick:function(t){var r,n=this,o=n.options.navigatable,a=n.editable.options.model,l=n.editView?n.editView.element:n._editContainer;t.preventDefault(),t.stopPropagation(),n.trigger("cancel",{container:l,model:a})||(r=n.items().index(e(n.current()).parent()),n.cancelRow(),o&&(n._setCurrent(n.items().eq(r).children().filter(Fe).first()),ae(n.table,!0)))},_createPopupEditor:function(r){var n,o,a,l,i,s,d,c,u,h,p,f=this,g="<div "+ue.attr("uid")+'="'+r.uid+'" class="k-popup-edit-form'+(f._isMobile?" k-mobile-list":"")+'"><div class="k-edit-form-container">',m=[],k=E(f.columns),b=f.options.editable,_=b.template,v=be(b)?b.window:{},w=_e({},ue.Template,f.options.templateSettings);if(v=v||{},_)for(typeof _===dt&&(_=window.unescape(_)),g+=ue.template(_,w)(r),a=0,l=k.length;a<l;a++)n=k[a],n.command&&(c=oe(n.command,"edit"),c&&(o=c));else for(a=0,l=k.length;a<l;a++)n=k[a],n.command?n.command&&(c=oe(n.command,"edit"),c&&(o=c)):(g+='<div class="k-edit-label"><label for="'+n.field+'">'+(n.title||n.field||"")+"</label></div>",r.editable&&!r.editable(n.field)||!n.field?(h={storage:{},count:0},i=ue.template(f._cellTmpl(n,h),w),h.count>0&&(i=xe(i,h.storage)),g+='<div class="k-edit-field">'+i(r)+"</div>"):(m.push({field:n.field,format:n.format,editor:n.editor,values:n.values}),g+="<div "+ue.attr("container-for")+'="'+n.field+'" class="k-edit-field"></div>'));o&&be(o)&&(o.text&&be(o.text)&&(s=o.text.update,d=o.text.cancel),o.attr&&(u=o.attr)),f._isMobile?(g+="</div></div>",f.editView=f.pane.append("<div data-"+ue.ns+'role="view" data-'+ue.ns+'use-native-scrolling="true" data-'+ue.ns+'init-widgets="false" class="k-grid-edit-form"><div data-'+ue.ns+'role="header" class="k-header">'+f._createButton({name:"update",text:s,attr:u})+(v.title||"Edit")+f._createButton({name:"canceledit",text:d,attr:u})+"</div>"+g+"</div>"),p=f._editContainer=f.editView.element.find(".k-popup-edit-form")):(g+='<div class="k-edit-buttons k-state-default">',g+=f._createButton({name:"update",text:s,attr:u})+f._createButton({name:"canceledit",text:d,attr:u}),g+="</div></div></div>",p=f._editContainer=e(g).appendTo(f.wrapper).eq(0).kendoWindow(_e({modal:!0,resizable:!1,draggable:!0,title:"Edit",visible:!1,close:function(n){if(n.userTriggered){if(n.sender.element.focus(),f.trigger("cancel",{container:p,model:r}))return n.preventDefault(),t;var o=f.items().index(e(f.current()).parent());f.cancelRow(),f.options.navigatable&&(f._setCurrent(f.items().eq(o).children().filter(Fe).first()),ae(f.table,!0))}}},v))),f.editable=f._editContainer.kendoEditable({fields:m,model:r,clearContainer:!1,target:f}).data("kendoEditable"),f._isMobile&&p.find("input[type=checkbox],input[type=radio]").parent(".k-edit-field").addClass("k-check").prev(".k-edit-label").addClass("k-check").click(function(){e(this).next().children("input").click()}),f._openPopUpEditor(),f.trigger(Ee,{container:p,model:r})},_openPopUpEditor:function(){this._isMobile?this.pane.navigate(this.editView,this._editAnimation):this._editContainer.data("kendoWindow").center().open()},_createInlineEditor:function(t,r){var n,o,a,l=this,i=[];l.lockedContent&&(t=t.add(l._relatedRow(t))),t.children(":not(.k-group-cell,.k-hierarchy-cell)").each(function(){if(o=e(this),n=E(l.columns)[l.cellIndex(o)],n.command||!n.field||r.editable&&!r.editable(n.field)){if(n.command&&(a=oe(n.command,"edit"))){o.empty();var t,s,d;be(a)&&(a.text&&be(a.text)&&(t=a.text.update,s=a.text.cancel),a.attr&&(d=a.attr)),e(l._createButton({name:"update",text:t,attr:d})+l._createButton({name:"canceledit",text:s,attr:d})).appendTo(o)}}else i.push({field:n.field,format:n.format,editor:n.editor,values:n.values}),o.attr(ue.attr("container-for"),n.field),o.empty()}),l._editContainer=t,l.editable=new ue.ui.Editable(t.addClass("k-grid-edit-row"),{target:l,fields:i,model:r,clearContainer:!1}),t.length>1&&(ne(t[0],t[1]),l._applyLockedContainersWidth()),l.trigger(Ee,{container:t,model:r})},cancelRow:function(e){var t,r=this,n=r._editContainer;if(n){if(t=r._modelForContainer(n),e&&r.trigger("cancel",{container:n,model:t}))return;r._destroyEditable(),r.dataSource.cancelChanges(t),r._displayRow("popup"!==r._editMode()?n:r.tbody.find("["+ue.attr("uid")+"="+t.uid+"]"))}},saveRow:function(){var e=this,t=e._editContainer,r=e._modelForContainer(t),n=e.editable;t&&n&&n.end()&&!e.trigger(Ne,{container:t,model:r})&&e.dataSource.sync()},_displayRow:function(t){var r,n,o,a,l,i=this,s=i._modelForContainer(t),d=t.hasClass("k-state-selected"),c=t.hasClass("k-alt");s&&(i.lockedContent&&(r=e((c?i.lockedAltRowTemplate:i.lockedRowTemplate)(s)),i._relatedRow(t.last()).replaceWith(r)),i.angular("cleanup",function(){return{elements:t.get()}}),n=e((c?i.altRowTemplate:i.rowTemplate)(s)),t.replaceWith(n),i.trigger("itemChange",{item:n,data:s,ns:he}),r&&r.length&&i.trigger("itemChange",{item:r,data:s,ns:he}),a=n,l=[{dataItem:s}],r&&r.length&&(a=n.add(r),l.push({dataItem:s})),i.angular("compile",function(){return{elements:a.get(),data:l}}),d&&i.options.selectable&&i.select(n.add(r)),r&&ne(n[0],r[0]),o=n.next(),o.hasClass("k-detail-row")&&o.is(":visible")&&n.find(".k-hierarchy-cell .k-icon").removeClass("k-plus").addClass("k-minus"))},_showMessage:function(t,r){var n,o,a,l=this;return l._isMobile?(n=ue.template('<ul><li class="km-actionsheet-title">#:title#</li><li><a href="\\#" class="k-button k-grid-delete">#:confirmDelete#</a></li></ul>'),o=e(n(t)).appendTo(l.view.element),a=l._actionSheet=new ue.mobile.ui.ActionSheet(o,{cancel:t.cancelDelete,cancelTemplate:'<li class="km-actionsheet-cancel"><a class="k-button" href="\\#">#:cancel#</a></li>',close:function(){this.destroy()},command:function(t){var n=e(t.currentTarget).parent();n.hasClass("km-actionsheet-cancel")||l._removeRow(r)},popup:l._actionSheetPopupOptions}),a.open(r),!1):window.confirm(t.title)},_confirmation:function(e){var t=this,r=t.options.editable,n=r===!0||typeof r===dt?t.options.messages.editable.confirmation:r.confirmation;return n===!1||null==n||(typeof n===st&&(n=n(t._modelForContainer(e))),t._showMessage({confirmDelete:r.confirmDelete||t.options.messages.editable.confirmDelete,cancelDelete:r.cancelDelete||t.options.messages.editable.cancelDelete,title:n===!0?t.options.messages.editable.confirmation:n},e))},cancelChanges:function(){this.dataSource.cancelChanges()},saveChanges:function(){var e=this;(e.editable&&e.editable.end()||!e.editable)&&!e.trigger(Ke)&&e.dataSource.sync()},addRow:function(){var e,t,r,n,o,a,l=this,i=l.dataSource,s=l._editMode(),d=l.options.editable.createAt||"",c=i.pageSize(),u=i.view()||[];(l.editable&&l.editable.end()||!l.editable)&&("incell"!=s&&l.cancelRow(),e=i.indexOf(u[0]),"bottom"==d.toLowerCase()&&(e+=u.length,c&&!i.options.serverPaging&&c<=u.length&&(e-=1)),e<0&&(e=i.page()>i.totalPages()?(i.page()-1)*c:0),t=i.insert(e,{}),r=t.uid,n=l.lockedContent?l.lockedTable:l.table,o=n.find("tr["+ue.attr("uid")+"="+r+"]"),a=o.children("td:not(.k-group-cell,.k-hierarchy-cell)").eq(l._firstEditableColumnIndex(o)),"inline"===s&&o.length?l.editRow(o):"popup"===s?l.editRow(t):a.length&&l.editCell(a),"bottom"==d.toLowerCase()&&l.lockedContent&&(l.lockedContent[0].scrollTop=l.content[0].scrollTop=l.table[0].offsetHeight))},_firstEditableColumnIndex:function(e){var t,r,n,o=this,a=E(o.columns),l=o._modelForContainer(e);for(r=0,n=a.length;r<n;r++)if(t=a[r],l&&(!l.editable||l.editable(t.field))&&!t.command&&t.field&&t.hidden!==!0)return r;return-1},_toolbar:function(){var t,r=this,n=r.wrapper,o=r.options.toolbar,a=r.options.editable;o&&(t=r.wrapper.find(".k-grid-toolbar"),t.length||(Se(o)||(o=typeof o===dt?o:r._toolbarTmpl(o).replace(gt,"\\#"),o=xe(ue.template(o),r)),t=e('<div class="k-header k-grid-toolbar" />').html(o({})).prependTo(n),r.angular("compile",function(){return{elements:t.get()}})),a&&a.create!==!1&&t.on(at+We,".k-grid-add",function(e){e.preventDefault(),r.addRow()}).on(at+We,".k-grid-cancel-changes",function(e){e.preventDefault(),r.cancelChanges()}).on(at+We,".k-grid-save-changes",function(e){e.preventDefault(),r.saveChanges()}),t.on(at+We,".k-grid-excel",function(e){e.preventDefault(),r.saveAsExcel()}),t.on(at+We,".k-grid-pdf",function(e){e.preventDefault(),r.saveAsPDF()}))},_toolbarTmpl:function(e){var t,r,n=this,o="";if(Ce(e))for(t=0,r=e.length;t<r;t++)o+=n._createButton(e[t]);return o},_createButton:function(e){var r,o=e.template||_t,a=typeof e===dt?e:e.name||e.text,l=xt[a]?xt[a].className:"k-grid-"+(a||"").replace(/\s/g,""),i={className:l,text:a,imageClass:"",attr:"",iconClass:""},s=this.options.messages.commands;if(!(a||be(e)&&e.template))throw Error("Custom commands should have name specified");return be(e)?(e=_e(!0,{},e),e.className&&ye(i.className,e.className.split(" "))<0?e.className+=" "+i.className:e.className===t&&(e.className=i.className),"edit"===a&&be(e.text)&&(e=_e(!0,{},e),e.text=e.text.edit),e.attr&&(be(e.attr)&&(e.attr=n(e.attr)),typeof e.attr===dt&&(r=e.attr.match(/class="(.+?)"/),r&&ye(r[1],e.className.split(" "))<0&&(e.className+=" "+r[1]))),i=_e(!0,i,xt[a],{text:s[a]},e)):i=_e(!0,i,xt[a],{text:s[a]}),ue.template(o)(i)},_hasFooters:function(){return!!this.footerTemplate||!!this.groupFooterTemplate||this.footer&&this.footer.length>0||this.wrapper.find(".k-grid-footer").length>0},_groupable:function(){var t=this;t._groupableClickHandler?t.table.add(t.lockedTable).off(at+We,t._groupableClickHandler):t._groupableClickHandler=function(r){var n=e(this),o=n.closest("tr");n.hasClass("k-i-collapse")?t.collapseGroup(o):t.expandGroup(o),r.preventDefault(),r.stopPropagation()},t._isLocked()?t.lockedTable.on(at+We,".k-grouping-row .k-i-collapse, .k-grouping-row .k-i-expand",t._groupableClickHandler):t.table.on(at+We,".k-grouping-row .k-i-collapse, .k-grouping-row .k-i-expand",t._groupableClickHandler),t._attachGroupable()},_attachGroupable:function(){var t=this,r=t.wrapper,n=t.options.groupable,o=Me+"["+ue.attr("field")+"]",a=t.content?".k-grid-header:first "+o:"table:first>.k-grid-header "+o;n&&n.enabled!==!1&&(r.has("div.k-grouping-header")[0]||e("<div>&nbsp;</div>").addClass("k-grouping-header").prependTo(r),t.groupable&&t.groupable.destroy(),t.groupable=new he.Groupable(r,_e({},n,{draggable:t._draggableInstance,groupContainer:">div.k-grouping-header",dataSource:t.dataSource,draggableElements:a,filter:a,allowDrag:t.options.reorderable})))},_continuousItems:function(t,r){var n,o,a,l,i,s,d,c;if(this.lockedContent){for(n=this,o=n.table.add(n.lockedTable),a=e(t,o[0]),l=e(t,o[1]),i=r?D(n.columns).length:1,s=r?n.columns.length-i:1,d=[],c=0;c<a.length;c+=i)Te.apply(d,a.slice(c,c+i)),Te.apply(d,l.splice(0,s));return d}},_selectable:function(){var r,n,o,a,l=this,i=[],s=l._isLocked(),d=l.options.selectable;d&&(l.selectable&&l.selectable.destroy(),d=ue.ui.Selectable.parseOptions(d),r=d.multiple,n=d.cell,l._hasDetails()&&(i[i.length]=".k-detail-row"),(l.options.groupable||l._hasFooters())&&(i[i.length]=".k-grouping-row,.k-group-footer"),i=i.join(","),""!==i&&(i=":not("+i+")"),o=l.table,s&&(o=o.add(l.lockedTable)),a=">"+(n?Ae:"tbody>tr"+i),l.selectable=new ue.ui.Selectable(o,{filter:a,aria:!0,multiple:r,change:function(){l.trigger(Ve)},useAllItems:s&&r&&n,relatedTarget:function(t){var r,o,a,i;if(!n&&s){for(o=e(),a=0,i=t.length;a<i;a++)r=l._relatedRow(t[a]),ye(r[0],t)<0&&(o=o.add(r));return o}},continuousItems:function(){return l._continuousItems(a,n)}}),l.options.navigatable&&o.on("keydown"+We,function(a){var i=l.current(),d=a.target;if(a.keyCode===ke.SPACEBAR&&e.inArray(d,o)>-1&&!i.is(".k-edit-cell,.k-header")&&i.parent().is(":not(.k-grouping-row,.k-detail-row,.k-group-footer)")){if(a.preventDefault(),a.stopPropagation(),i=n?i:i.parent(),s&&!n&&(i=i.add(l._relatedRow(i))),r)if(a.ctrlKey){if(i.hasClass(Ye))return i.removeClass(Ye),l.trigger(Ve),t}else l.selectable.clear();else l.selectable.clear();l.selectable.value(i)}}))},_clipboard:function(){var e,t=this.options,r=t.selectable;r&&t.allowCopy&&(e=this,t.navigatable||e.table.add(e.lockedTable).attr("tabindex",0).on("mousedown"+We+" keydown"+We,".k-detail-cell",function(e){e.target!==e.currentTarget&&e.stopImmediatePropagation()}).on("mousedown"+We,De+">"+Fe,xe(ie,e)),e.copyHandler=xe(e.copySelection,e),e.updateClipBoardState=function(){e.areaClipBoard&&e.areaClipBoard.val(e.getTSV()).focus().select()},e.bind("change",e.updateClipBoardState),e.wrapper.on("keydown",e.copyHandler),e.clearAreaHandler=xe(e.clearArea,e),e.wrapper.on("keyup",e.clearAreaHandler))},copySelection:function(t){t instanceof jQuery.Event&&!t.ctrlKey&&!t.metaKey||e(t.target).is("input:visible,textarea:visible")||window.getSelection&&""+window.getSelection()||document.selection&&document.selection.createRange().text||(this.areaClipBoard||(this.areaClipBoard=e("<textarea />").css({
  position:"fixed",top:"50%",left:"50%",opacity:0,width:0,height:0}).appendTo(this.wrapper)),this.areaClipBoard.val(this.getTSV()).focus().select())},getTSV:function(){var t,r,n,o,a,l,i=this,s=i.select(),d="\t",c=i.options.allowCopy,u=!0;return e.isPlainObject(c)&&c.delimeter&&(d=c.delimeter),t="",s.length&&(s.eq(0).is("tr")&&(s=s.find("td:not(.k-group-cell)")),u&&s.filter(":visible"),r=[],n=this.columns.length,o=i._isLocked()&&D(i.columns).length,a=!0,e.each(s,function(t,l){var s,d,c,h;l=e(l),s=l.closest("tr"),d=s.index(),c=l.index(),u&&(c-=l.prevAll(":hidden").length),o&&a&&(a=e.contains(i.lockedTable[0],l[0])),i._groups()&&a&&(c-=i._groups()),c=a?c:c+o,n>c&&(n=c),h=l.text(),r[d]||(r[d]=[]),r[d][c]=h}),l=r.length,r=e.each(r,function(e,t){t&&(r[e]=t.slice(n),l>e&&(l=e))}),e.each(r.slice(l),function(e,r){t+=r?r.join(d)+"\r\n":"\r\n"})),t},clearArea:function(t){var r;this.areaClipBoard&&t&&t.target===this.areaClipBoard[0]&&(r=this.options.navigatable?e(this.current()).closest("table"):this.table,ae(r,!0)),this.areaClipBoard&&(this.areaClipBoard.remove(),this.areaClipBoard=null)},_minScreenSupport:function(){var t=this.hideMinScreenCols();t&&(this.minScreenResizeHandler=xe(this.hideMinScreenCols,this),e(window).on("resize",this.minScreenResizeHandler))},hideMinScreenCols:function(){var e=this.columns,t=window.innerWidth>0?window.innerWidth:screen.width;return this._iterateMinScreenCols(e,t)},_iterateMinScreenCols:function(e,r){var n,o,a,l=!1;for(n=0;n<e.length;n++)o=e[n],a=o.minScreenWidth,a!==t&&null!==a&&(l=!0,a>r?this.hideColumn(o):this.showColumn(o)),!o.hidden&&o.columns&&(l=this._iterateMinScreenCols(o.columns,r)||l);return l},_relatedRow:function(t){var r,n,o=this.lockedTable;return t=e(t),o?(r=t.closest(this.table.add(this.lockedTable)),n=r.find(">tbody>tr").index(t),r=r[0]===this.table[0]?o:this.table,r.find(">tbody>tr").eq(n)):t},clearSelection:function(){var e=this;e.selectable.clear(),e.trigger(Ve)},select:function(e){var r=this,n=r.selectable;return e=r.table.add(r.lockedTable).find(e),e.length?(n.options.multiple||(n.clear(),e=e.first()),r._isLocked()&&(e=e.add(e.map(function(){return r._relatedRow(this)}))),n.value(e),t):n.value()},_updateCurrentAttr:function(t,r){var n,o=e(t).data("headerId");e(t).removeClass(Je).removeAttr("aria-describedby").closest("table").removeAttr("aria-activedescendant"),o?(o=o.replace(this._cellId,""),e(t).attr("id",o)):e(t).removeAttr("id"),r.data("headerId",r.attr("id")).attr("id",this._cellId).addClass(Je).closest("table").attr("aria-activedescendant",this._cellId),r.closest("tr").hasClass("k-grouping-row")||r.hasClass("k-header")?r.attr("aria-describedby",this._cellId):(n=this.columns[this.cellIndex(r)],n&&(o=n.headerAttributes.id),r.attr("aria-describedby",o+" "+this._cellId)),this._current=r},_scrollCurrent:function(){var t,r,n,o,a,l,i=this._current,s=this.options.scrollable;i&&s&&(t=i.parent(),r=t.closest("table").parent(),n=r.is(".k-grid-content-locked,.k-grid-header-locked"),o=r.is(".k-grid-content-locked,.k-grid-content,.k-virtual-scrollable-wrap"),a=e(this.content).find(">.k-virtual-scrollable-wrap").andSelf().last()[0],o&&(s.virtual?(l=Math.max(ye(t[0],this._items(t.parent())),0),this._rowVirtualIndex=this.virtualScrollable.itemIndex(l),this.virtualScrollable.scrollIntoView(t)):this._scrollTo(this._relatedRow(t)[0],a)),this.lockedContent&&(this.lockedContent[0].scrollTop=a.scrollTop),n||this._scrollTo(i[0],a))},current:function(e){return this._setCurrent(e,!0)},_setCurrent:function(t,r){var n=this._current;return t=e(t),t.length&&(n&&n[0]===t[0]||(this._updateCurrentAttr(n,t),this._scrollCurrent(),r||this.trigger(ot,{element:t}))),this._current},_removeCurrent:function(){this._current&&(this._current.removeClass(Je),this._current=null)},_scrollTo:function(t,r){var n,o=t.tagName.toLowerCase(),a="td"===o||"th"===o,l=t[a?"offsetLeft":"offsetTop"],i=t[a?"offsetWidth":"offsetHeight"],s=r[a?"scrollLeft":"scrollTop"],d=r[a?"clientWidth":"clientHeight"],c=l+i,u=0,h=0,p=0;vt&&a&&(n=e(t).closest("table")[0],wt.msie?h=n.offsetLeft:wt.mozilla&&(p=n.offsetLeft-ue.support.scrollbar())),s=Math.abs(s+h-p),u=s>l?l:c>s+d?i<=d?c-d:l:s,u=Math.abs(u+h)+p,r[a?"scrollLeft":"scrollTop"]=u},_navigatable:function(){var t,r,n,o=this;o.options.navigatable&&(t=o.table.add(o.lockedTable),r=o.thead.parent().add(e(">table",o.lockedHeader)),n=t,o.options.scrollable&&(n=n.add(r),r.attr(it,-1)),this._navigatableTables=n,n.off("mousedown"+We+" focus"+We+" focusout"+We+" keydown"+We),r.on("keydown"+We,xe(o._openHeaderMenu,o)).find("a.k-link").attr("tabIndex",-1),t.attr(it,Re.max(t.attr(it)||0,0)).on("mousedown"+We+" keydown"+We,".k-detail-cell",function(e){e.target!==e.currentTarget&&e.stopImmediatePropagation()}),n.on(ue.support.touch?"touchstart"+We:"mousedown"+We,De+">"+Fe,xe(ie,o)).on("focus"+We,xe(o._tableFocus,o)).on("focusout"+We,xe(o._tableBlur,o)).on("keydown"+We,xe(o._tableKeyDown,o)))},_openHeaderMenu:function(e){e.altKey&&e.keyCode==ke.DOWN&&(this.current().find(".k-grid-filter, .k-header-column-menu").click(),e.stopImmediatePropagation())},_setTabIndex:function(e){this._navigatableTables.attr(it,-1),e.attr(it,0)},_tableFocus:function(t){var r,n;ue.support.touch||(r=this.current(),n=e(t.currentTarget),r&&r.is(":visible")?r.addClass(Je):this._setCurrent(n.find(qe)),this._setTabIndex(n))},_tableBlur:function(){var e=this.current();e&&e.removeClass(Je)},_tableKeyDown:function(r){var n,o=this.current(),a=this.virtualScrollable&&this.virtualScrollable.fetching(),l=e(r.target),i=!r.isDefaultPrevented()&&!l.is(":button,a,:input,a>.k-icon");return a?(r.preventDefault(),t):(o=o?o:e(this.lockedTable).add(this.table).find(qe),o.length&&(n=!1,i&&r.keyCode==ke.UP&&(n=this._moveUp(o)),i&&r.keyCode==ke.DOWN&&(n=this._moveDown(o)),i&&r.keyCode==(vt?ke.LEFT:ke.RIGHT)&&(n=this._moveRight(o,r.altKey)),i&&r.keyCode==(vt?ke.RIGHT:ke.LEFT)&&(n=this._moveLeft(o,r.altKey)),i&&r.keyCode==ke.PAGEDOWN&&(n=this._handlePageDown()),i&&r.keyCode==ke.PAGEUP&&(n=this._handlePageUp()),r.keyCode!=ke.ENTER&&r.keyCode!=ke.F2||(n=this._handleEnterKey(o,r.currentTarget,l)),r.keyCode==ke.ESC&&(n=this._handleEscKey(o,r.currentTarget)),r.keyCode==ke.TAB&&(n=this._handleTabKey(o,r.currentTarget,r.shiftKey)),n&&(r.preventDefault(),r.stopPropagation())),t)},_moveLeft:function(e,t){var r,n,o=e.parent(),a=o.parent();return t?this.collapseRow(o):(n=a.find(De).index(o),r=this._prevHorizontalCell(a,e,n),r[0]||(a=this._horizontalContainer(a),r=this._prevHorizontalCell(a,e,n),r[0]!==e[0]&&ae(a.parent(),!0)),this._setCurrent(r)),!0},_moveRight:function(e,t){var r,n,o=e.parent(),a=o.parent();return t?this.expandRow(o):(n=a.find(De).index(o),r=this._nextHorizontalCell(a,e,n),r[0]||(a=this._horizontalContainer(a,!0),r=this._nextHorizontalCell(a,e,n),r[0]!==e[0]&&ae(a.parent(),!0)),this._setCurrent(r)),!0},_moveUp:function(e){var t=e.parent().parent(),r=this._prevVerticalCell(t,e);return r[0]||(t=this._verticalContainer(t,!0),r=this._prevVerticalCell(t,e),r[0]&&ae(t.parent(),!0)),this._setCurrent(r),!0},_moveDown:function(e){var t=e.parent().parent(),r=this._nextVerticalCell(t,e);return r[0]||(t=this._verticalContainer(t),r=this._nextVerticalCell(t,e),r[0]&&ae(t.parent(),!0)),this._setCurrent(r),!0},_handlePageDown:function(){return!!this.options.pageable&&(this.dataSource.page(this.dataSource.page()+1),!0)},_handlePageUp:function(){return!!this.options.pageable&&(this.dataSource.page(this.dataSource.page()-1),!0)},_handleTabKey:function(t,r,n){var o,a=this.options.editable&&"incell"==this._editMode();return!(!a||t.is("th"))&&(o=e(ge()).closest(".k-edit-cell"),o[0]&&o[0]!==t[0]&&(t=o),o=this._tabNext(t,r,n),!!o.length&&(this._handleEditing(t,o,o.closest("table")),!0))},_handleEscKey:function(t,r){var n,o=ge(),a="incell"==this._editMode();return se(t)?(a?this.closeCell(!0):(n=e(t).parent().index(),o&&o.blur(),this.cancelRow(!0),n>=0&&this._setCurrent(this.items().eq(n).children(Fe).first())),wt.msie&&wt.version<9&&document.body.focus(),ae(r,!0),!0):!!t.has(o).length&&(ae(r,!0),!0)},_toggleCurrent:function(e,t){var r=e.parent();return r.is(".k-grouping-row")?(r.find(".k-icon:first").click(),!0):!(t||!r.is(".k-master-row"))&&(r.find(".k-icon:first").click(),!0)},_handleEnterKey:function(t,r,n){var o,a=this.options.editable&&this.options.editable.update!==!1,l=n.closest("[role=gridcell]");return n.is("table")||e.contains(t[0],n[0])||(t=l),t.is("th")?(t.find(".k-link").click(),!0):!!this._toggleCurrent(t,a)||(o=t.find(":kendoFocusable:first"),o[0]&&!t.hasClass("k-edit-cell")&&t.hasClass("k-state-focused")?(o.focus(),!0):!(!a||n.is(":button,.k-button,textarea"))&&(l[0]||(l=t),this._handleEditing(l,!1,r),!0))},_nextHorizontalCell:function(e,t,r){var n,o,a,l=t.nextAll(Ie);return l.length||(n=e.find(De),o=n.index(t.parent()),o!=-1)?l.first():t.hasClass("k-header")?(a=[],A([D(this.columns)[0]],B(n.eq(0).children().first()),a,0,0),a[r]?a[r][0]:t):t.parent().hasClass("k-filter-row")?n.last().children(Ie).first():n.eq(r).children(Ie).first()},_prevHorizontalCell:function(e,t,r){var n,o,a,l,i=t.prevAll(Ie);return i.length||(n=e.find(De),o=n.index(t.parent()),o!=-1)?i.first():t.hasClass("k-header")?(a=[],l=D(this.columns),A([l[l.length-1]],B(n.eq(0).children().last()),a,0,0),a[r]?a[r][0]:t):t.parent().hasClass("k-filter-row")?n.last().children(Ie).last():n.eq(r).children(Ie).last()},_currentDataIndex:function(e,r){var n,o=r.attr("data-index");return o?(n=D(this.columns).length,n&&!e.closest("div").hasClass("k-grid-content-locked")[0]?o-n:o):t},_prevVerticalCell:function(t,r){var n,o=r.parent(),a=t.children(De),l=a.index(o),i=this._currentDataIndex(t,r);if(i||r.hasClass("k-header"))return n=P(r),n.eq(n.length-2);if(i=o.children(Ie).index(r),o.hasClass("k-filter-row"))return N(t).eq(i);if(l==-1){if(o=t.find(".k-filter-row"),!o[0])return N(t).eq(i)}else o=0===l?e():a.eq(l-1);return n=o.children(Ie),n.eq(n.length>i?i:0)},_nextVerticalCell:function(e,r){var n,o=r.parent(),a=e.children(De),l=a.index(o),i=this._currentDataIndex(e,r);return l!=-1&&i===t&&r.hasClass("k-header")?B(r).eq(1):(i=i?parseInt(i,10):o.children(Ie).index(r),o=a.eq(l==-1?0:l+r[0].rowSpan),n=o.children(Ie),n.eq(n.length>i?i:0))},_verticalContainer:function(e,t){var r=e.parent(),n=this._navigatableTables.length,o=Math.floor(n/2),a=ye(r[0],this._navigatableTables);return t&&(o*=-1),a+=o,(a>=0||a<n)&&(r=this._navigatableTables.eq(a)),r.find(t?"thead":"tbody")},_horizontalContainer:function(e,t){var r,n,o=this._navigatableTables.length;return o<=2?e:(r=e.parent(),n=ye(r[0],this._navigatableTables),n+=t?1:-1,!t||2!=n&&n!=o?!t&&(1==n||n<0)?e:this._navigatableTables.eq(n).find("thead, tbody"):e)},_tabNext:function(e,t,r){var n=!0,o=r?e.prevAll(Ie+":first"):e.nextAll(":visible:first");return o.length||(o=e.parent(),this.lockedTable&&(n=r&&t==this.lockedTable[0]||!r&&t==this.table[0],o=this._relatedRow(o)),n&&(o=o[r?"prevAll":"nextAll"]("tr:not(.k-grouping-row):not(.k-detail-row):visible:first")),o=o.children(Ie+(r?":last":":first"))),o},_handleEditing:function(r,n,o){var a,l,i=this,s=e(ge()),d=i._editMode(),c=wt.msie,u=c&&wt.version<9,h=i._editContainer,p=i.options.editable&&i.options.editable.update!==!1;if(o=e(o),l="incell"==d?r.hasClass("k-edit-cell"):r.parent().hasClass("k-grid-edit-row"),i.editable){if(e.contains(h[0],s[0])&&(wt.opera||u?s.blur().change().triggerHandler("blur"):(s.blur(),c&&s.blur())),!i.editable)return ae(o),t;if(!i.editable.end())return i._setCurrent("incell"==d?h:h.children().filter(Ie).first()),a=h.find(":kendoFocusable:first")[0],a&&a.focus(),t;"incell"==d?i.closeCell():(i.saveRow(),l=!0)}n&&i._setCurrent(n),u&&document.body.focus(),ae(o,!0),p&&(!l&&!n||n)&&("incell"==d?i.editCell(i.current()):i.editRow(i.current().parent()))},_wrapper:function(){var e=this,t=e.table,r=e.options.height,n=e.element;n.is("div")||(n=n.wrap("<div/>").parent()),e.wrapper=n.addClass("k-grid k-widget"),r&&(e.wrapper.css(lt,r),t.css(lt,"auto")),e._initMobile()},_initMobile:function(){var t,r=this.options,n=this;this._isMobile=r.mobile===!0&&ue.support.mobileOS||"phone"===r.mobile||"tablet"===r.mobile,this._isMobile&&(t=this.wrapper.addClass("k-grid-mobile").wrap("<div data-"+ue.ns+'stretch="true" data-'+ue.ns+'role="view" data-'+ue.ns+'init-widgets="false"></div>').parent(),this.pane=ue.mobile.ui.Pane.wrap(t),this.view=this.pane.view(),this._actionSheetPopupOptions=e(document.documentElement).hasClass("km-root")?{modal:!1}:{align:"bottom center",position:"bottom center",effect:"slideIn:up"},r.height&&this.pane.element.parent().css(lt,r.height),this._editAnimation="slide",this.view.bind("show",function(){n._isLocked()&&(n._updateTablesWidth(),n._applyLockedContainersWidth(),n._syncLockedContentHeight(),n._syncLockedHeaderHeight(),n._syncLockedFooterHeight())}))},_tbody:function(){var t,r=this,n=r.table;t=n.find(">tbody"),t.length||(t=e("<tbody/>").appendTo(n)),r.tbody=t.attr("role","rowgroup")},_scrollable:function(){var t,r,n,o,a=this,l=a.options,i=l.scrollable,s=i!==!0&&i.virtual&&!a.virtualScrollable,d=!ue.support.kineticScrollNeeded||s?ue.support.scrollbar():0;i&&(t=a.wrapper.children(".k-grid-header"),t[0]||(t=e('<div class="k-grid-header" />').insertBefore(a.table)),t.css(vt?"padding-left":"padding-right",i.virtual?d+1:d),r=e('<table role="grid" />'),Ct&&r.attr("cellspacing",0),r.width(a.table[0].style.width),r.append(a.thead),t.empty().append(e('<div class="k-grid-header-wrap k-auto-scrollable" />').append(r)),a.content=a.table.parent(),a.content.is(".k-virtual-scrollable-wrap, .km-scroll-container")&&(a.content=a.content.parent()),a.content.is(".k-grid-content, .k-virtual-scrollable-wrap")||(a.content=a.table.wrap('<div class="k-grid-content k-auto-scrollable" />').parent()),s&&(a.virtualScrollable=new Tt(a.content,{dataSource:a.dataSource,itemHeight:function(){return a._averageRowHeight()}})),a.scrollables=t.children(".k-grid-header-wrap").add(a.content),n=a.wrapper.find(".k-grid-footer"),n.length&&(a.scrollables=a.scrollables.add(n.children(".k-grid-footer-wrap"))),i.virtual?a.content.find(">.k-virtual-scrollable-wrap").unbind("scroll"+We).bind("scroll"+We,function(){a.scrollables.scrollLeft(this.scrollLeft),a.lockedContent&&(a.lockedContent[0].scrollTop=this.scrollTop)}):(a.content.unbind("scroll"+We).bind("scroll"+We,function(e){a.scrollables.not(e.currentTarget).scrollLeft(this.scrollLeft),a.lockedContent&&e.currentTarget==a.content[0]&&(a.lockedContent[0].scrollTop=this.scrollTop)}),o=a.content.data("kendoTouchScroller"),o&&o.destroy(),o=ue.touchScroller(a.content),o&&o.movable&&(a.touchScroller=o,o.movable.bind("change",function(e){a.scrollables.scrollLeft(-e.sender.x),a.lockedContent&&a.lockedContent.scrollTop(-e.sender.y)}),a.one($e,function(e){e.sender.wrapper.addClass("k-grid-backface")}))))},_renderNoRecordsContent:function(){var t,r=this;r.options.noRecords&&(t=r.table.parent().children("."+Ze),t.length&&(r.angular("cleanup",function(){return{elements:t.get()}}),t.remove()),r.dataSource&&r.dataSource.view().length||(t=e(r.noRecordsTemplate({})).insertAfter(r.table),r.angular("compile",function(){return{elements:t.get(),data:[{}]}})))},_setContentWidth:function(t){var r,n=this,o="k-grid-content-expander",a='<div class="'+o+'"></div>',l=n.resizable;n.options.scrollable&&n.wrapper.is(":visible")&&(r=n.table.parent().children("."+o),n._setContentWidthHandler=xe(n._setContentWidth,n),n.dataSource&&n.dataSource.view().length?r[0]&&(r.remove(),l&&l.unbind("resize",n._setContentWidthHandler)):(r[0]||(r=e(a).appendTo(n.table.parent()),l&&l.bind("resize",n._setContentWidthHandler)),n.thead&&(r.width(n.thead.width()),t&&n.content.scrollLeft(t))),n._applyLockedContainersWidth(),n.lockedHeader&&0===n.table[0].clientWidth&&(n.table[0].style.width="1px"))},_applyLockedContainersWidth:function(){if(this.options.scrollable&&this.lockedHeader){var e,t=this.thead.parent(),r=t.parent(),n=this.wrapper[0].clientWidth,o=this._groups(),a=ue.support.scrollbar(),l=this.lockedHeader.find(">table>colgroup>col:not(.k-group-col, .k-hierarchy-col)"),i=t.find(">colgroup>col:not(.k-group-col, .k-hierarchy-col)"),s=R(l),d=R(i);o>0&&(s+=this.lockedHeader.find(".k-group-cell:first").outerWidth()*o),s>=n&&(s=n-3*a),this.lockedHeader.add(this.lockedContent).width(s),r[0].style.width=r.parent().width()-s-2+"px",t.add(this.table).width(d),this.virtualScrollable&&(n-=a),this.content[0].style.width=n-s-2+"px",this.lockedFooter&&this.lockedFooter.length&&(this.lockedFooter.width(s),e=this.footer.find(".k-grid-footer-wrap"),e[0].style.width=r[0].clientWidth+"px",e.children().first().width(d))}},_setContentHeight:function(){var e,t=this,r=t.options,n=t.wrapper.innerHeight(),o=t.wrapper.children(".k-grid-header"),a=ue.support.scrollbar();r.scrollable&&t.wrapper.is(":visible")&&(n-=o.outerHeight(),t.pager&&(n-=t.pager.element.outerHeight()),r.groupable&&(n-=t.wrapper.children(".k-grouping-header").outerHeight()),r.toolbar&&(n-=t.wrapper.children(".k-grid-toolbar").outerHeight()),t.footerTemplate&&(n-=t.wrapper.children(".k-grid-footer").outerHeight()),e=function(e){var t,r;return!!e[0].style.height||(t=e.height(),e.height("auto"),r=e.height(),t!=r?(e.height(""),!0):(e.height(""),!1))},e(t.wrapper)&&(n>2*a?(t.lockedContent&&(a=t.table[0].offsetWidth>t.table.parent()[0].clientWidth?a:0,t.lockedContent.height(n-a)),t.content.height(n)):t.content.height(2*a+1)))},_averageRowHeight:function(){var e,t=this,r=t._items(t.tbody).length,n=t._rowHeight;return 0===r?n:(t._rowHeight||(t._rowHeight=n=t.table.outerHeight()/r,t._sum=n,t._measures=1),e=t.table.outerHeight()/r,n!==e&&(t._measures++,t._sum+=e,t._rowHeight=t._sum/t._measures),n)},_dataSource:function(){var e,r=this,n=r.options,o=n.dataSource;o=Ce(o)?{data:o}:o,be(o)&&(_e(o,{table:r.table,fields:r.columns}),e=n.pageable,be(e)&&e.pageSize!==t&&(o.pageSize=e.pageSize)),r.dataSource&&r._refreshHandler?r.dataSource.unbind(Ve,r._refreshHandler).unbind(Le,r._progressHandler).unbind(ze,r._errorHandler):(r._refreshHandler=xe(r.refresh,r),r._progressHandler=xe(r._requestStart,r),r._errorHandler=xe(r._error,r)),r.dataSource=pe.create(o).bind(Ve,r._refreshHandler).bind(Le,r._progressHandler).bind(ze,r._errorHandler)},_error:function(){this._progress(!1)},_requestStart:function(){this._progress(!0)},_modelChange:function(t){var r,n,o,a,l,i,s,d,c,u,h=this,p=h.tbody,f=t.model,g=h.tbody.find("tr["+ue.attr("uid")+"="+f.uid+"]"),m=g.hasClass("k-alt"),k=h._items(p).index(g),b=h.lockedContent;if(b&&(r=h._relatedRow(g)),g.add(r).children(".k-edit-cell").length&&!h.options.rowTemplate)g.add(r).children(":not(.k-group-cell,.k-hierarchy-cell)").each(function(){n=e(this),o=E(h.columns)[h.cellIndex(n)],o.field===t.field&&(n.hasClass("k-edit-cell")?n.addClass("k-dirty-cell"):(h._displayCell(n,o,f),e('<span class="k-dirty"/>').prependTo(n)))});else if(!g.hasClass("k-grid-edit-row")){for(i=e().add(g),b&&(a=(m?h.lockedAltRowTemplate:h.lockedRowTemplate)(f),i=i.add(r),r.replaceWith(a)),h.angular("cleanup",function(){return{elements:i.get()}}),a=(m?h.altRowTemplate:h.rowTemplate)(f),g.replaceWith(a),a=h._items(p).eq(k),u=[{dataItem:f}],b&&(g=g.add(r),r=h._relatedRow(a)[0],ne(a[0],r),a=a.add(r),u.push({dataItem:f})),h.angular("compile",function(){return{elements:a.get(),data:u}}),l=h.options.selectable,l&&g.hasClass("k-state-selected")&&h.select(a),d=i.children(":not(.k-group-cell,.k-hierarchy-cell)"),s=a.children(":not(.k-group-cell,.k-hierarchy-cell)"),k=0,c=h.columns.length;k<c;k++)o=h.columns[k],n=s.eq(k),l&&d.eq(k).hasClass("k-state-selected")&&n.addClass("k-state-selected"),o.field===t.field&&e('<span class="k-dirty"/>').prependTo(n);h.trigger("itemChange",{item:a,data:f,ns:he})}},_pageable:function(){var t,r=this,n=r.options.pageable;n&&(t=r.wrapper.children("div.k-grid-pager"),t.length||(t=e('<div class="k-pager-wrap k-grid-pager"/>').appendTo(r.wrapper)),r.pager&&r.pager.destroy(),r.pager="object"==typeof n&&n instanceof ue.ui.Pager?n:new ue.ui.Pager(t,_e({},n,{dataSource:r.dataSource})))},_footer:function(){var t,r,n,o=this,a=o.dataSource.aggregates(),l="",i=o.footerTemplate,s=o.options,d=o.footer||o.wrapper.find(".k-grid-footer");i?(l=e(o._wrapFooter(i(a))),d.length?(r=l,o.angular("cleanup",function(){return{elements:d.get()}}),d.replaceWith(r),d=o.footer=r):d=o.footer=s.scrollable?s.pageable?l.insertBefore(o.wrapper.children("div.k-grid-pager")):l.appendTo(o.wrapper):l.insertBefore(o.tbody),o.angular("compile",function(){return{elements:d.find("td:not(.k-group-cell, .k-hierarchy-cell)").get(),data:ve(o.columns,function(e){return{column:e,aggregate:a[e.field]}})}})):d&&!o.footer&&(o.footer=d),d.length&&(s.scrollable&&(t=d.attr("tabindex",-1).children(".k-grid-footer-wrap"),o.scrollables=o.scrollables.filter(function(){return!e(this).is(".k-grid-footer-wrap")}).add(t)),o._footerWidth&&d.find("table").css("width",o._footerWidth),t&&(n=o.content.scrollLeft(),s.scrollable!==!0&&s.scrollable.virtual&&(n=o.wrapper.find(".k-virtual-scrollable-wrap").scrollLeft()),t.scrollLeft(n))),o.lockedContent&&(o._appendLockedColumnFooter(),o._applyLockedContainersWidth(),o._syncLockedFooterHeight())},_wrapFooter:function(t){var r=this,n="",o=ue.support.mobileOS?0:ue.support.scrollbar();return r.options.scrollable?(n=e('<div class="k-grid-footer"><div class="k-grid-footer-wrap"><table'+(Ct?' cellspacing="0"':"")+"><tbody>"+t+"</tbody></table></div></div>"),r._appendCols(n.find("table")),n.css(vt?"padding-left":"padding-right",o),n):'<tfoot class="k-grid-footer">'+t+"</tfoot>"},_columnMenu:function(){var e,r,n,o,a,l,i,s,d,c=this,u=E(c.columns),h=c.options,p=h.columnMenu,f=we(c.columns,function(e){return e.columns!==t}).length>0,g=this._isMobile,m=function(e){c.trigger(je,{field:e.field,container:e.container})},k=function(e){ae(e.closest("table"),!0)},b=h.$angular;if(p)for("boolean"==typeof p&&(p={}),l=N(c.thead),i=0,s=l.length;i<s;i++)r=u[i],d=l.eq(i),r.command||!r.field&&!d.attr("data-"+ue.ns+"field")||(e=d.data("kendoColumnMenu"),e&&e.destroy(),o=r.sortable!==!1&&p.sortable!==!1&&h.sortable!==!1&&_e({},h.sortable,{compare:(r.sortable||{}).compare}),a=!(!h.filterable||r.filterable===!1||p.filterable===!1)&&_e({pane:c.pane},h.filterable,r.filterable),r.filterable&&r.filterable.dataSource&&(a.forceUnique=!1,a.checkSource=r.filterable.dataSource),a&&(a.format=r.format),n={dataSource:c.dataSource,values:r.values,columns:p.columns,sortable:o,filterable:a,messages:p.messages,owner:c,closeCallback:k,init:m,pane:c.pane,filter:g?":not(.k-column-active)":"",lockedColumns:!f&&r.lockable!==!1&&D(u).length>0},b&&(n.$angular=b),d.kendoColumnMenu(n))},_headerCells:function(){return this.thead.find("th").filter(function(){var t=e(this);return!t.hasClass("k-group-cell")&&!t.hasClass("k-hierarchy-cell")})},_filterable:function(){var e,t,r,n,o,a,l,i=this,s=E(i.columns),d=function(e){i.trigger(Oe,{field:e.field,container:e.container})},c=function(e){ae(e.closest("table"),!0)},u=i.options.filterable;if(u&&typeof u.mode==dt&&u.mode.indexOf("menu")==-1&&(u=!1),u&&!i.options.columnMenu)for(t=N(i.thead),n=0,o=t.length;n<o;n++)r=t.eq(n),s[n].filterable===!1||s[n].command||!s[n].field&&!r.attr("data-"+ue.ns+"field")||(e=r.data("kendoFilterMenu"),e&&e.destroy(),e=r.data("kendoFilterMultiCheck"),e&&e.destroy(),a=s[n].filterable,l=_e({},u,a,{dataSource:i.dataSource,values:s[n].values,format:s[n].format,closeCallback:c,title:s[n].title||s[n].field,init:d,pane:i.pane}),a&&a.messages&&(l.messages=_e(!0,{},u.messages,a.messages)),a&&a.dataSource&&(l.forceUnique=!1,l.checkSource=a.dataSource),a&&a.multi?r.kendoFilterMultiCheck(l):r.kendoFilterMenu(l))},_filterRow:function(){var t,r,n,o,a,l,i,s,d,c,u,h,p,f,g=this;if(g._hasFilterRow())for(r=g.options.$angular,n=E(g.columns),o=g.options.filterable,a=g.thead.find(".k-filter-row"),this._updateHeader(this.dataSource.group().length),l=0;l<n.length;l++)if(s=n[l],d=g.options.filterable.operators,c=!1,u=e("<th/>"),h=s.field,s.hidden&&u.hide(),a.append(u),h&&s.filterable!==!1){if(p=s.filterable&&s.filterable.cell||{},i=g.options.dataSource,i instanceof pe&&(i=g.options.dataSource.options),f=_e(!0,{},o.messages),s.filterable&&_e(!0,f,s.filterable.messages),p.enabled===!1){u.html("&nbsp;");continue}p.dataSource&&(i=p.dataSource,c=!0),s.filterable&&s.filterable.operators&&(d=s.filterable.operators),t={column:s,dataSource:g.dataSource,suggestDataSource:i,customDataSource:c,field:h,messages:f,values:s.values,template:p.template,delay:p.delay,inputWidth:p.inputWidth,suggestionOperator:p.suggestionOperator,minLength:p.minLength,dataTextField:p.dataTextField,operator:p.operator,operators:d,showOperators:p.showOperators},r&&(t.$angular=r),e("<span/>").attr(ue.attr("field"),h).appendTo(u).kendoFilterCell(t)}else u.html("&nbsp;")},_sortable:function(){var e,t,r,n,o,a,l=this,i=E(l.columns),s=l.options.sortable;if(s){for(n=N(l.thead),o=0,a=n.length;o<a;o++)e=i[o],e.sortable!==!1&&!e.command&&e.field&&(r=n.eq(o),t=r.data("kendoColumnSorter"),t&&t.destroy(),r.attr("data-"+ue.ns+"field",e.field).kendoColumnSorter(_e({},s,e.sortable,{dataSource:l.dataSource,aria:!0,filter:":not(.k-column-active)"})));n=null}},_columns:function(t){var r,n,o,a=this,l=a.table,i=l.find("col"),d=a.options.dataSource;if(t=t.length?t:ve(l.find("th"),function(t,r){t=e(t);var n=t.attr(ue.attr("sortable")),o=t.attr(ue.attr("filterable")),a=t.attr(ue.attr("type")),l=t.attr(ue.attr("groupable")),s=t.attr(ue.attr("field")),d=t.attr(ue.attr("title")),c=t.attr(ue.attr("menu"));return s||(s=t.text().replace(/\s|[^A-z0-9]/g,"")),{field:s,type:a,title:d,sortable:"false"!==n,filterable:"false"!==o,groupable:"false"!==l,menu:c,template:t.attr(ue.attr("template")),width:i.eq(r).css("width")}}),r=!(a.table.find("tbody tr").length>0&&(!d||!d.transport)),a.options.scrollable){if(o=t,n=D(t),t=F(t),n.length>0&&0===t.length)throw Error("There should be at least one non locked column");G(a.element.find("tr:has(th):first"),o),t=n.concat(t)}a.columns=s(t,r)},_groups:function(){var e=this.dataSource.group();return e?e.length:0},_tmpl:function(e,t,o,a){var l,i,s,d,c=this,u=_e({},ue.Template,c.options.templateSettings),h=t.length,p={storage:{},count:0},f=c._hasDetails(),g=[],m=c._groups();if(!e){for(e="<tr",o&&g.push("k-alt"),f&&g.push("k-master-row"),g.length&&(e+=' class="'+g.join(" ")+'"'),h&&(e+=" "+ue.attr("uid")+'="#='+ue.expr("uid",u.paramName)+'#"'),e+=" role='row'>",m>0&&!a&&(e+=r(m)),f&&(e+='<td class="k-hierarchy-cell"><a class="k-icon k-plus" href="\\#" tabindex="-1"></a></td>'),l=0;l<h;l++)s=t[l],i=s.template,d=typeof i,e+="<td"+n(s.attributes)+" role='gridcell'>",e+=c._cellTmpl(s,p),e+="</td>";e+="</tr>"}return e=ue.template(e,u),p.count>0?xe(e,p.storage):e},_headerCellText:function(e){var t=this,r=_e({},ue.Template,t.options.templateSettings),n=e.headerTemplate,o=typeof n,a=e.title||e.field||"";return o===st?a=ue.template(n,r)({}):o===dt&&(a=n),a},_cellTmpl:function(e,t){var r,n,o=this,a=_e({},ue.Template,o.options.templateSettings),l=e.template,i=a.paramName,s=e.field,d="",c=e.format,u=typeof l,h=e.values;if(e.command){if(Ce(e.command)){for(r=0,n=e.command.length;r<n;r++)d+=o._createButton(e.command[r]);return d.replace(gt,"\\#")}return o._createButton(e.command).replace(gt,"\\#")}return u===st?(t.storage["tmpl"+t.count]=l,d+="#=this.tmpl"+t.count+"("+i+")#",t.count++):u===dt?d+=l:h&&h.length&&be(h[0])&&"value"in h[0]&&s?(d+="#var v ="+ue.stringify(K(h)).replace(gt,"\\#")+"#",d+="#var f = v[",a.useWithBlock||(d+=i+"."),d+=s+"]#",d+="${f != null ? f : ''}"):(d+=e.encoded?"#:":"#=",c&&(d+='kendo.format("'+c.replace(ft,"\\$1")+'",'),s?(s=ue.expr(s,i),d+=s+"==null?'':"+s):d+="''",c&&(d+=")"),d+="#"),d},_templates:function(){var t=this,r=t.options,n=t.dataSource,o=n.group(),a=t.footer||t.wrapper.find(".k-grid-footer"),l=n.aggregate(),i=E(t.columns),s=E(D(t.columns)),d=r.scrollable?E(F(t.columns)):i;if(r.scrollable&&s.length){if(r.rowTemplate||r.altRowTemplate)throw Error("Having both row template and locked columns is not supported");t.rowTemplate=t._tmpl(r.rowTemplate,d,!1,!0),t.altRowTemplate=t._tmpl(r.altRowTemplate||r.rowTemplate,d,!0,!0),t.lockedRowTemplate=t._tmpl(r.rowTemplate,s),t.lockedAltRowTemplate=t._tmpl(r.altRowTemplate||r.rowTemplate,s,!0)}else t.rowTemplate=t._tmpl(r.rowTemplate,d),t.altRowTemplate=t._tmpl(r.altRowTemplate||r.rowTemplate,d,!0);t._hasDetails()&&(t.detailTemplate=t._detailTmpl(r.detailTemplate||"")),(t._group&&!He(l)||!He(l)&&!a.length||we(i,function(e){return e.footerTemplate}).length)&&(t.footerTemplate=t._footerTmpl(i,l,"footerTemplate","k-footer-template")),o&&we(i,function(e){return e.groupFooterTemplate}).length&&(l=e.map(o,function(e){return e.aggregates}),t.groupFooterTemplate=t._footerTmpl(d,l,"groupFooterTemplate","k-group-footer",s.length),r.scrollable&&s.length&&(t.lockedGroupFooterTemplate=t._footerTmpl(s,l,"groupFooterTemplate","k-group-footer"))),t.options.noRecords&&(t.noRecordsTemplate=t._noRecordsTmpl())},_noRecordsTmpl:function(){var t,r,n,o='<div class="{0}">{1}</div>',a='<div class="k-grid-norecords-template"{1}>{0}</div>',l=this.options.scrollable&&!this.wrapper[0].style.height?' style="margin:0 auto;position:static;"':"",i={storage:{},count:0},s=e.extend({},ue.Template,this.options.templateSettings),d=s.paramName,c="";return t=this.options.noRecords.template?this.options.noRecords.template:ue.format(a,this.options.messages.noRecords,l),r=typeof t,"function"===r?(i.storage["tmpl"+i.count]=t,c+="#=this.tmpl"+i.count+"("+d+")#",i.count++):"string"===r&&(c+=t),n=ue.template(ue.format(o,Ze,c),s),i.count>0&&(n=e.proxy(n,i.storage)),n},_footerTmpl:function(e,t,o,a,l){var i,s,d,c,u,h=this,p=_e({},ue.Template,h.options.templateSettings),f=p.paramName,g="",m={},k=0,b={},_=h._groups(),v=h.dataSource._emptyAggregates(t);for(g+='<tr class="'+a+'">',_>0&&!l&&(g+=r(_)),h._hasDetails()&&(g+='<td class="k-hierarchy-cell">&nbsp;</td>'),i=0,s=e.length;i<s;i++)u=e[i],d=u[o],c=typeof d,g+="<td"+n(u.footerAttributes)+">",d?(c!==st&&(b=v[u.field]?_e({},p,{paramName:f+"['"+u.field+"']"}):{},d=ue.template(d,b)),m["tmpl"+k]=d,g+="#=this.tmpl"+k+"("+f+")#",k++):g+="&nbsp;",g+="</td>";return g+="</tr>",g=ue.template(g,p),k>0?xe(g,m):g},_detailTmpl:function(e){var t=this,n="",o=_e({},ue.Template,t.options.templateSettings),a=o.paramName,l={},i=0,s=t._groups(),d=f(E(t.columns)).length,c=typeof e;return n+='<tr class="k-detail-row">',s>0&&(n+=r(s)),n+='<td class="k-hierarchy-cell"></td><td class="k-detail-cell"'+(d?' colspan="'+d+'"':"")+">",c===st?(l["tmpl"+i]=e,n+="#=this.tmpl"+i+"("+a+")#",i++):n+=e,n+="</td></tr>",n=ue.template(n,o),i>0?xe(n,l):n},_hasDetails:function(){var e=this;return null!==e.options.detailTemplate||(e._events[Be]||[]).length},_hasFilterRow:function(){var t=this.options.filterable,r=t&&typeof t.mode==dt&&t.mode.indexOf("row")!=-1,n=this.columns,o=e.grep(n,function(e){return e.filterable===!1});return n.length&&o.length==n.length&&(r=!1),r},_details:function(){var t=this;if(t.options.scrollable&&t._hasDetails()&&D(t.columns).length)throw Error("Having both detail template and locked columns is not supported");t.table.on(at+We,".k-hierarchy-cell .k-plus, .k-hierarchy-cell .k-minus",function(r){var n,o,a=e(this),l=a.hasClass("k-plus"),i=a.closest("tr.k-master-row"),s=t.detailTemplate,d=t._hasDetails();return a.toggleClass("k-plus",!l).toggleClass("k-minus",l),n=i.next(),d&&!n.hasClass("k-detail-row")&&(o=t.dataItem(i),n=e(s(o)).addClass(i.hasClass("k-alt")?"k-alt":"").insertAfter(i),t.angular("compile",function(){return{elements:n.get(),data:[{dataItem:o}]}}),t.trigger(Be,{masterRow:i,detailRow:n,data:o,detailCell:n.find(".k-detail-cell")})),t.trigger(l?Qe:Xe,{masterRow:i,detailRow:n}),n.toggle(l),t._current&&t._current.attr("aria-expanded",l),r.preventDefault(),!1})},dataItem:function(t){if(t=e(t)[0],!t)return null;var r,n,o=this.tbody.children(),a=/k-grouping-row|k-detail-row|k-group-footer/,l=t.sectionRowIndex;for(n=l,r=0;r<l;r++)a.test(o[r].className)&&n--;return this._data[n]},expandRow:function(t){e(t).find("> td .k-plus, > td .k-i-expand").click()},collapseRow:function(t){e(t).find("> td .k-minus, > td .k-i-collapse").click()},_createHeaderCells:function(e,r){var o,a,l,i,s,d,c=this,u="",h=E(c.columns);
  for(o=0,i=e.length;o<i;o++)a=e[o].column||e[o],l=c._headerCellText(a),s="",d=ye(a,h),a.command?(u+="<th scope='col'"+n(a.headerAttributes),r&&!e[o].colSpan&&(u+=" rowspan='"+r+"'"),d>-1&&(u+=ue.attr("index")+"='"+d+"'"),u+=">"+l+"</th>"):(a.field&&(s=ue.attr("field")+"='"+a.field+"' "),u+="<th scope='col' role='columnheader' "+s,r&&!e[o].colSpan&&(u+=" rowspan='"+r+"'"),e[o].colSpan>1&&(u+='colspan="'+(e[o].colSpan-H(a.columns))+'" ',u+=ue.attr("colspan")+"='"+e[o].colSpan+"'"),a.title&&(u+=ue.attr("title")+'="'+a.title.replace('"',"&quot;").replace(/'/g,"'")+'" '),a.groupable!==t&&(u+=ue.attr("groupable")+"='"+a.groupable+"' "),a.aggregates&&a.aggregates.length&&(u+=ue.attr("aggregates")+"='"+a.aggregates+"'"),d>-1&&(u+=ue.attr("index")+"='"+d+"'"),u+=n(a.headerAttributes),u+=">"+l+"</th>");return u},_appendLockedColumnContent:function(){var t,r,n,o,a,l=this.columns,i=this.table.find("colgroup"),s=i.find("col:not(.k-group-col,.k-hierarchy-col)"),d=e(),c=0,u=0;for(t=0,r=l.length;t<r;t++)if(l[t].locked)if(p(l[t])){for(o=1,l[t].columns&&(o=E(l[t].columns).length-H(l[t].columns)),o=o||1,a=0;a<o;a++)d=d.add(s.eq(t+u+a-c));u+=o-1}else c++;n=e('<div class="k-grid-content-locked"><table'+(Ct?' cellspacing="0"':"")+"><colgroup/><tbody></tbody></table></div>"),i.detach(),n.find("colgroup").append(d),i.insertBefore(this.table.find("tbody")),this.lockedContent=n.insertBefore(this.content),this.lockedTable=n.children("table")},_appendLockedColumnFooter:function(){var t,r,n=this,o=n.footer,a=o.find(".k-footer-template>td"),l=o.find(".k-grid-footer-wrap>table>colgroup>col"),i=e('<div class="k-grid-footer-locked"><table><colgroup /><tbody><tr class="k-footer-template"></tr></tbody></table></div>'),s=n._groups(),d=e(),c=e();for(d=d.add(a.filter(".k-group-cell")),t=0,r=E(D(n.columns)).length;t<r;t++)d=d.add(a.eq(t+s));for(c=c.add(l.filter(".k-group-col")),t=0,r=f(E(M(n.columns))).length;t<r;t++)c=c.add(l.eq(t+s));d.appendTo(i.find("tr")),c.appendTo(i.find("colgroup")),n.lockedFooter=i.prependTo(o)},_appendLockedColumnHeader:function(t){var r,n,o,a,l,i,s,d,c,u,h,f=this,m=this.columns,k=[],b=0,_=e(),v=f._hasFilterRow(),w=0,C=e(),y=0,T=e(),x=f.thead.prev().find("col:not(.k-group-col,.k-hierarchy-col)"),S=f.thead.find("tr:first .k-header:not(.k-group-cell,.k-hierarchy-cell)"),R=f.thead.find(".k-filter-row").find("th:not(.k-group-cell,.k-hierarchy-cell)"),z=0;for(r=0,o=m.length;r<o;r++){if(m[r].locked){if(s=S.eq(r),y=E(m[r].columns||[]).length,p(m[r])){for(d=null,m[r].columns&&(d=y-H(m[r].columns)),d=d||1,c=0;c<d;c++)_=_.add(x.eq(r+z+c-b));z+=d-1}for(A([m[r]],B(s),k,0,0),y=y||1,u=0;u<y;u++)C=C.add(R.eq(w+u));w+=y}m[r].columns&&(b+=H(m[r].columns)),p(m[r])||b++}if(k.length){for(n='<div class="k-grid-header-locked" style="width:1px"><table'+(Ct?' cellspacing="0"':"")+"><colgroup/><thead>",n+=Array(k.length+1).join("<tr></tr>"),n+=(v?'<tr class="k-filter-row" />':"")+"</thead></table></div>",i=e(n),x=i.find("colgroup"),x.append(f.thead.prev().find("col.k-group-col").add(_)),a=i.find("thead tr:not(.k-filter-row)"),r=0,o=k.length;r<o;r++)T=g(k[r]),a.eq(r).append(f.thead.find("tr:eq("+r+") .k-group-cell").add(T));return h=I(this.thead),k.length<h&&L(i,h-k.length),l=i.find(".k-filter-row"),l.append(f.thead.find(".k-filter-row .k-group-cell").add(C)),this.lockedHeader=i.prependTo(t),this.thead.find(".k-group-cell").remove(),!0}return!1},_removeLockedContainers:function(){var e=this.lockedHeader.add(this.lockedContent).add(this.lockedFooter);ue.destroy(e),e.off(We).remove(),this.lockedHeader=this.lockedContent=this.lockedFooter=null,this.selectable=null},_thead:function(){var t,r,n,o,a,l,i,s=this,d=s.columns,c=s._hasDetails()&&d.length,u=s._hasFilterRow(),h="",p=s.table.find(">thead"),f=s.element.find("thead:first").length>0;if(p.length||(p=e("<thead/>").insertBefore(s.tbody)),s.lockedHeader&&s.thead?(r=s.thead.find("tr:has(th):not(.k-filter-row)").html(""),r.remove(),r=e(),s._removeLockedContainers()):r=s.element.find(f?"thead:first tr:has(th):not(.k-filter-row)":"tr:has(th):first"),!r.length&&(r=p.children().first(),!r.length)){for(n=[{rowSpan:1,cells:[],index:0}],s._prepareColumns(n,d),t=0;t<n.length;t++)h+="<tr>",c&&(h+='<th class="k-hierarchy-cell" scope="col">&nbsp;</th>'),h+=s._createHeaderCells(n[t].cells,n[t].rowSpan),h+="</tr>";r=e(h)}u&&(o=e("<tr/>"),o.addClass("k-filter-row"),(c||r.find(".k-hierarchy-cell").length)&&o.prepend('<th class="k-hierarchy-cell" scope="col">&nbsp;</th>'),a=(s.thead||p).find(".k-filter-row"),a.length&&(ue.destroy(a),a.remove()),p.append(o)),r.children().length?c&&!r.find(".k-hierarchy-cell")[0]&&r.prepend('<th class="k-hierarchy-cell" scope="col">&nbsp;</th>'):(h="",c&&(h+='<th class="k-hierarchy-cell" scope="col">&nbsp;</th>'),h+=s._createHeaderCells(d),r.html(h)),r.attr("role","row").find("th").addClass("k-header"),s.options.scrollable||p.addClass("k-grid-header"),r.find("script").remove().end().prependTo(p),s.thead&&s._destroyColumnAttachments(),this.angular("cleanup",function(){return{elements:p.find("th").get()}}),this.angular("compile",function(){return{elements:p.find("th").get(),data:ve(d,function(e){return{column:e}})}}),s.thead=p.attr("role","rowgroup"),s._sortable(),s._filterable(),s._filterRow(),s._scrollable(),s._updateCols(),s._columnMenu(),i=this.options.scrollable&&D(this.columns).length,i&&(l=s._appendLockedColumnHeader(s.thead.closest(".k-grid-header")),s._appendLockedColumnContent(),s.lockedContent.bind("DOMMouseScroll"+We+" mousewheel"+We,xe(s._wheelScroll,s))),s._updateColumnCellIndex(),s._updateFirstColumnClass(),s._resizable(),s._draggable(),s._reorderable(),s._updateHeader(s._groups()),i&&(l&&s._syncLockedHeaderHeight(),s._applyLockedContainersWidth()),s.groupable&&s._attachGroupable()},_retrieveFirstColumn:function(t,r){var n,o=e();if(r.length&&t[0]){for(n=t[0];n.columns&&n.columns.length;)n=n.columns[0],r=r.filter(":not(:first())");o=o.add(r)}return o},_updateFirstColumnClass:function(){var t,r,n=this,o=n.columns||[],a=n._hasDetails()&&o.length;a||n._groups()||(t=n.thead.find(">tr:not(.k-filter-row):not(:first)"),o=F(o),r=n._retrieveFirstColumn(o,t),n._isLocked()&&(t=n.lockedHeader.find("thead>tr:not(.k-filter-row):not(:first)"),o=D(n.columns),r=r.add(n._retrieveFirstColumn(o,t))),r.each(function(){var t=e(this).find("th");t.removeClass("k-first"),t.eq(0).addClass("k-first")}))},_prepareColumns:function(e,t,r,n){var o,a,l=n||e[e.length-1],i=e[l.index+1],s=0;for(o=0;o<t.length;o++)a={column:t[o],colSpan:0},l.cells.push(a),t[o].columns&&t[o].columns.length&&(i||(i={rowSpan:0,cells:[],index:e.length},e.push(i)),a.colSpan=t[o].columns.length,this._prepareColumns(e,t[o].columns,a,i),s+=a.colSpan-1,l.rowSpan=e.length-l.index);r&&(r.colSpan+=s)},_wheelScroll:function(e){var t,r,n;e.ctrlKey||(t=this.content,this.options.scrollable.virtual&&(t=this.virtualScrollable.verticalScrollbar),r=t.scrollTop(),n=ue.wheelDeltaY(e),n&&(e.preventDefault(),t.scrollTop(r+-n)))},_isLocked:function(){return null!=this.lockedHeader},_updateHeaderCols:function(){var e=this.thead.parent().add(this.table);this._isLocked()?U(e,W(q(this.columns)),this._hasDetails(),0):U(e,W(f(this.columns)),this._hasDetails(),0)},_updateCols:function(e){e=e||this.thead.parent().add(this.table),this._appendCols(e,this._isLocked())},_updateLockedCols:function(e){this._isLocked()&&(e=e||this.lockedHeader.find("table").add(this.lockedTable),U(e,W(M(this.columns)),this._hasDetails(),this._groups()))},_appendCols:function(e,t){t?U(e,W(q(this.columns)),this._hasDetails(),0):U(e,W(f(this.columns)),this._hasDetails(),this._groups())},_autoColumns:function(e){if(e&&e.toJSON){var t,r,n=this;e=e.toJSON(),r=!(n.table.find("tbody tr").length>0&&(!n.dataSource||!n.dataSource.transport));for(t in e)n.columns.push({field:t,encoded:r,headerAttributes:{id:ue.guid()}});n._thead(),n._templates()}},_rowsHtml:function(e,t){var r,n,o=this,a="",l=t.rowTemplate,i=t.altRowTemplate;for(r=0,n=e.length;r<n;r++)a+=r%2?i(e[r]):l(e[r]),o._data.push(e[r]);return a},_groupRowHtml:function(e,t,r,n,o,a){var l,i,s=this,d="",c=e.field,u=we(E(s.columns),function(e){return e.field==c})[0]||{},h=u.groupHeaderTemplate,p=(u.title||c)+": "+$(e.value,u.format,u.values,u.encoded),f=s._groupAggregatesDefaultObject||{},g=_e({},f,e.aggregates),m=_e({},{field:e.field,value:e.value,aggregates:g},e.aggregates[e.field]),k=o.groupFooterTemplate,b=e.items;if(h&&(p=typeof h===st?h(m):ue.template(h)(m)),d+=n(t,r,p),e.hasSubgroups)for(l=0,i=b.length;l<i;l++)d+=s._groupRowHtml(b[l],a?t:t-1,r+1,n,o,a);else d+=s._rowsHtml(b,o);return k&&(d+=k(g)),d},collapseGroup:function(t){var r,n,o,a,l,i,s,d,c,u;for(t=e(t),n=this.options.groupable,o=n.showFooter,a=o?0:1,i=e(),this._isLocked()&&(t.closest("div").hasClass("k-grid-content-locked")?i=this.tbody.children("tr:eq("+t.index()+")").nextAll("tr"):(i=t.nextAll("tr"),t=this.lockedTable.find(">tbody>tr:eq("+t.index()+")"))),r=t.find(".k-group-cell").length,t.find(".k-i-collapse").addClass("k-i-expand").removeClass("k-i-collapse"),t.find("td[aria-expanded='true']:first").attr("aria-expanded",!1),t=t.nextAll("tr"),u=[],s=0,d=t.length;s<d&&(c=t.eq(s),l=c.find(".k-group-cell").length,c.hasClass("k-grouping-row")?a++:c.hasClass("k-group-footer")&&a--,!(l<=r||c.hasClass("k-group-footer")&&a<0));s++)i.length&&u.push(i[s]),u.push(c[0]);e(u).hide()},expandGroup:function(t){t=e(t);var r,n,o,a,l,i=this,s=i.options.groupable.showFooter,d=e(),c=[],u=1;for(this._isLocked()&&(t.closest("div").hasClass("k-grid-content-locked")?d=this.tbody.children("tr:eq("+t.index()+")").nextAll("tr"):(d=t.nextAll("tr"),t=this.lockedTable.find(">tbody>tr:eq("+t.index()+")"))),r=t.find(".k-group-cell").length,t.find(".k-i-expand").addClass("k-i-collapse").removeClass("k-i-expand"),t.find("td[aria-expanded='false']:first").attr("aria-expanded",!0),t=t.nextAll("tr"),a=0,l=t.length;a<l&&(n=t.eq(a),o=n.find(".k-group-cell").length,!(o<=r));a++)o!=r+1||n.hasClass("k-detail-row")||(n.show(),d.eq(a).show(),n.hasClass("k-grouping-row")&&n.find(".k-icon").hasClass("k-i-collapse")&&i.expandGroup(n),n.hasClass("k-master-row")&&n.find(".k-icon").hasClass("k-minus")&&(n.next().show(),d.eq(a+1).show())),n.hasClass("k-grouping-row")&&(s&&c.push(n.is(":visible")),u++),n.hasClass("k-group-footer")&&(s&&n.toggle(c.pop()),1==u?(n.show(),d.eq(a).show()):u--)},_updateHeader:function(t){var r=this,n=r._isLocked()?r.lockedHeader.find("thead"):r.thead,o=n.find("tr.k-filter-row").find("th.k-group-cell").length,a=n.find("tr:first").find("th.k-group-cell").length,l=n.children("tr:not(:first)").filter(function(){return!e(this).children(":visible").length});t>a?(e(Array(t-a+1).join('<th class="k-group-cell k-header" scope="col">&nbsp;</th>')).prependTo(n.children("tr:not(.k-filter-row)")),r.element.is(":visible")&&l.find("th.k-group-cell").hide()):t<a&&n.find("tr").each(function(){e(this).find("th.k-group-cell").filter(":eq("+t+"),:gt("+t+")").remove()}),t>o&&e(Array(t-o+1).join('<th class="k-group-cell k-header" scope="col">&nbsp;</th>')).prependTo(n.find(".k-filter-row"))},_firstDataItem:function(e,t){return e&&t&&(e=e.hasSubgroups?this._firstDataItem(e.items[0],t):e.items[0]),e},_updateTablesWidth:function(){var t,r=this;r._isLocked()&&(t=e(">.k-grid-footer>.k-grid-footer-wrap>table",r.wrapper).add(r.thead.parent()).add(r.table),r._footerWidth=te(t.eq(0)),t.width(r._footerWidth),t=e(">.k-grid-footer>.k-grid-footer-locked>table",r.wrapper).add(r.lockedHeader.find(">table")).add(r.lockedTable),t.width(te(t.eq(0))))},hideColumn:function(r){var n,o,a,i,s,d,c,g,m,k,b=this,_=0,v=b.footer||b.wrapper.find(".k-grid-footer"),w=b.columns,C=b.lockedHeader?N(b.lockedHeader.find(">table>thead")).filter(h).length:0;if(r="number"==typeof r?w[r]:be(r)?we(S(w),function(e){return e===r})[0]:we(S(w),function(e){return e.field===r})[0],r&&p(r)){if(r.columns&&r.columns.length){for(d=T(r,w),u(r,!1),Q(l(e(">table>thead",b.lockedHeader),b.thead,">tr:eq("+d.row+")>th"),d.cell,!1),a=0;a<r.columns.length;a++)this.hideColumn(r.columns[a]);return b.trigger(Ue,{column:r}),t}if(m=ye(r,f(E(w))),u(r,!1),b._setParentsVisibility(r,!1),b._templates(),b._updateCols(),b._updateLockedCols(),k=b.thead,c=m,b.lockedHeader&&C>m?k=b.lockedHeader.find(">table>thead"):c-=C,n=N(k).filter(h).eq(c),n[0].style.display="none",Q(l(e(">table>thead",b.lockedHeader),b.thead,">tr.k-filter-row>th"),m,!1),v[0]&&(b._updateCols(v.find(">.k-grid-footer-wrap>table")),b._updateLockedCols(v.find(">.k-grid-footer-locked>table")),Q(v.find(".k-footer-template>td"),m,!1)),b.lockedTable&&C>m?X(b.lockedTable.find(">tbody>tr"),m):X(b.tbody.children(),m-C),b.lockedTable)b._updateTablesWidth(),b._applyLockedContainersWidth(),b._syncLockedContentHeight(),b._syncLockedHeaderHeight(),b._syncLockedFooterHeight();else{for(i=b.thead.prev().find("col"),a=0,g=i.length;a<g;a+=1){if(s=i[a].style.width,!s||s.indexOf("%")!=-1){_=0;break}_+=parseInt(s,10)}o=e(">.k-grid-header table:first,>.k-grid-footer table:first",b.wrapper).add(b.table),b._footerWidth=null,_&&(o.each(function(){this.style.width=_+"px"}),b._footerWidth=_),wt.msie&&8==wt.version&&(o.css("display","inline-table"),setTimeout(function(){o.css("display","table")},1))}b._updateFirstColumnClass(),b.trigger(Ue,{column:r})}},_setParentsVisibility:function(t,r){var n,o,a,i,s,d=this.columns,h=[],p=r?function(e){return f(e.columns).length&&e.hidden}:function(e){return!f(e.columns).length&&!e.hidden};if(c(t,d,h)&&h.length)for(n=h.length-1;n>=0;n--)o=h[n],a=w(o,d),i=l(e(">table>thead",this.lockedHeader),this.thead,">tr:eq("+a.row+")>th:not(.k-group-cell):not(.k-hierarchy-cell)").eq(a.cell),p(o)&&(u(o,r),i[0].style.display=r?"":"none"),i.filter("["+ue.attr("colspan")+"]").length&&(s=parseInt(i.attr(ue.attr("colspan")),10),i[0].colSpan=s-H(o.columns)||1)},showColumn:function(r){var n,o,a,i,s,d,c,h,f,g,m,k=this,b=k.columns,_=k.footer||k.wrapper.find(".k-grid-footer"),v=k.lockedHeader?N(k.lockedHeader.find(">table>thead")).length:0;if(r="number"==typeof r?b[r]:be(r)?we(S(b),function(e){return e===r})[0]:we(S(b),function(e){return e.field===r})[0],r&&!p(r)){if(r.columns&&r.columns.length){for(c=w(r,b),u(r,!0),Q(l(e(">table>thead",k.lockedHeader),k.thead,">tr:eq("+c.row+")>th"),c.cell,!0),n=0;n<r.columns.length;n++)this.showColumn(r.columns[n]);return k.trigger(Ge,{column:r}),t}if(g=ye(r,E(b)),u(r,!0),k._setParentsVisibility(r,!0),k._templates(),k._updateCols(),k._updateLockedCols(),m=k.thead,d=g,k.lockedHeader&&v>g?m=k.lockedHeader.find(">table>thead"):d-=v,a=N(m).eq(d),a[0].style.display="",Q(l(e(">table>thead",k.lockedHeader),k.thead,">tr.k-filter-row>th"),g,!0),_[0]&&(k._updateCols(_.find(">.k-grid-footer-wrap>table")),k._updateLockedCols(_.find(">.k-grid-footer-locked>table")),Q(_.find(".k-footer-template>td"),g,!0)),k.lockedTable&&v>g?Z(k.lockedTable.find(">tbody>tr"),g):Z(k.tbody.children(),g-v),k.lockedTable)k._updateTablesWidth(),k._applyLockedContainersWidth(),k._syncLockedContentHeight(),k._syncLockedHeaderHeight();else if(i=e(">.k-grid-header table:first,>.k-grid-footer table:first",k.wrapper).add(k.table),r.width){for(s=0,f=k.thead.prev().find("col"),n=0,o=f.length;n<o;n+=1){if(h=f[n].style.width,h.indexOf("%")>-1){s=0;break}s+=parseInt(h,10)}k._footerWidth=null,s&&(i.each(function(){this.style.width=s+"px"}),k._footerWidth=s)}else i.width("");k._updateFirstColumnClass(),k.trigger(Ge,{column:r})}},_progress:function(e){var t=this.element;this.lockedContent?t=this.wrapper:this.element.is("table")?t=this.element.parent():this.content&&this.content.length&&(t=this.content),ue.ui.progress(t,e)},_resize:function(e,t){this._syncLockedHeaderHeight(),this.content&&(this._setContentWidth(),this._setContentHeight()),this.virtualScrollable&&(t||this._rowHeight)&&(t&&(this._rowHeight=null),this.virtualScrollable.repaintScrollbar())},_isActiveInTable:function(){var t=ge();return!!t&&(this.table[0]===t||e.contains(this.table[0],t)||this._isLocked()&&(this.lockedTable[0]===t||e.contains(this.lockedTable[0],t)))},refresh:function(t){var r,n=this,o=n.dataSource.view(),a=n.options.navigatable,l=e(n.current()),i=!1,s=(n.dataSource.group()||[]).length,d=s+W(f(n.columns)).length;t&&"itemchange"===t.action&&n.editable||(t&&"remove"===t.action&&n.editable&&n.editable.options.model&&ye(n.editable.options.model,t.items)>-1&&n.editable.options.model.unbind(Ve,n._modelChangeHandler),t=t||{},n.trigger("dataBinding",{action:t.action||"rebind",index:t.index,items:t.items})||(n._angularItems("cleanup"),a&&(n._isActiveInTable()||n._editContainer&&n._editContainer.data("kendoWindow"))&&(i=l.is("th"),r=Math.max(n.cellIndex(l),0)),n._destroyEditable(),n._progress(!1),n._hideResizeHandle(),n._data=[],n.columns.length||(n._autoColumns(n._firstDataItem(o[0],s)),d=s+n.columns.length),n._group=s>0||n._group,n._group&&(n._templates(),n._updateCols(),n._updateLockedCols(),n._updateHeader(s),n._group=s>0),n._renderContent(o,d,s),n._renderLockedContent(o,d,s),n._footer(),n._renderNoRecordsContent(),n._setContentHeight(),n._setContentWidth(n.content&&n.content.scrollLeft()),n.lockedTable&&(n.options.scrollable.virtual?n.content.find(">.k-virtual-scrollable-wrap").trigger("scroll"):n.touchScroller?n.touchScroller.movable.trigger("change"):(n.wrapper.one("scroll",function(e){e.stopPropagation()}),n.content.trigger("scroll"))),n._restoreCurrent(r,i),n.touchScroller&&n.touchScroller.contentResized(),n.selectable&&n.selectable.resetTouchEvents(),n._muteAngularRebind(function(){n._angularItems("compile")}),n.trigger($e)))},_restoreCurrent:function(r,n){var o,a,l;r===t||r<0||(this._removeCurrent(),n?this._setCurrent(this.thead.find("th:not(.k-group-cell)").eq(r)):(o=0,this._rowVirtualIndex?o=this.virtualScrollable.position(this._rowVirtualIndex):r=0,a=e(),this.lockedTable&&(a=this.lockedTable.find(">tbody>tr").eq(o)),a=a.add(this.tbody.children().eq(o)),l=a.find(">td:not(.k-group-cell):not(.k-hierarchy-cell)").eq(r),this._setCurrent(l)),this._current&&ae(this._current.closest("table")[0],!0))},_angularItems:function(e){ue.ui.DataBoundWidget.fn._angularItems.call(this,e),"cleanup"===e&&this._cleanupDetailItems(),this._angularGroupItems(e),this._angularGroupFooterItems(e)},_cleanupDetailItems:function(){var e=this;e._hasDetails()&&(e.angular("cleanup",function(){return{elements:e.tbody.children(".k-detail-row")}}),e.tbody.find(".k-detail-cell").empty())},_angularGroupItems:function(t){var r=this,n=r.tbody;r.lockedContent&&(n=r.lockedTable.find("tbody")),r._group&&r.angular(t,function(){return{elements:n.children(".k-grouping-row"),data:e.map(J(r.dataSource.view()),function(e){return{dataItem:e}})}})},_angularGroupFooterItems:function(t){var r=this,n=r.tbody;r.lockedContent&&(n=r.element),r._group&&r.groupFooterTemplate&&r.angular(t,function(){return{elements:n.find(".k-group-footer"),data:e.map(Y(r.dataSource.view()),function(e){return{dataItem:e}})}})},_renderContent:function(e,t,r){var n,o,a=this,l="",i=null!=a.lockedContent,s={rowTemplate:a.rowTemplate,altRowTemplate:a.altRowTemplate,groupFooterTemplate:a.groupFooterTemplate};if(t=i?t-W(M(a.columns)).length:t,r>0)for(t=i?t-r:t,a.detailTemplate&&t++,a.groupFooterTemplate&&(a._groupAggregatesDefaultObject=a.dataSource.aggregates()),n=0,o=e.length;n<o;n++)l+=a._groupRowHtml(e[n],t,0,i?ce:de,s,i);else l+=a._rowsHtml(e,s);a.tbody=O(a.tbody,a.table,l,this.options.$angular)},_renderLockedContent:function(e,t,r){var n,o,a,l="",i={rowTemplate:this.lockedRowTemplate,altRowTemplate:this.lockedAltRowTemplate,groupFooterTemplate:this.lockedGroupFooterTemplate};if(this.lockedContent){if(a=this.lockedTable,r>0)for(t-=f(E(F(this.columns))).length,n=0,o=e.length;n<o;n++)l+=this._groupRowHtml(e[n],t,0,de,i);else l=this._rowsHtml(e,i);O(a.children("tbody"),a,l,this.options.$angular),this._syncLockedContentHeight()}},_adjustRowsHeight:function(e,t){var r,n,o,a,l=e[0].rows,i=l.length,s=t[0].rows,d=e.add(t),c=d.length,u=[];for(r=0;r<i&&s[r];r++)l[r].style.height&&(l[r].style.height=s[r].style.height="");for(r=0;r<i&&s[r];r++)n=l[r].offsetHeight,o=s[r].offsetHeight,a=0,n>o?a=n:n<o&&(a=o),u.push(a);for(r=0;r<c;r++)d[r].style.display="none";for(r=0;r<i;r++)u[r]&&(l[r].style.height=s[r].style.height=u[r]+1+"px");for(r=0;r<c;r++)d[r].style.display=""}});ue.ExcelMixin&&ue.ExcelMixin.extend(St.prototype),ue.PDFMixin&&(ue.PDFMixin.extend(St.prototype),St.prototype._drawPDF_autoPageBreak=function(r){function n(){u&&i!==t?(c.one("change",o),c.page(i)):(s.refresh(),o())}function o(){p.appendTo(document.body);var t=e.extend({},s.options.pdf,{_destructive:!0,progress:function(e){r.notify({page:e.page,pageNumber:e.pageNum,progress:.5+e.pageNum/e.totalPages/2,totalPages:e.totalPages})}});ue.drawing.drawDOM(f,t).always(function(){p.remove()}).then(function(e){d.resolve(e)}).fail(function(e){d.reject(e)})}function a(){var e=c.page(),t=u?c.totalPages():1;l.append(h.find("tr")),e<t?c.page(e+1):(c.unbind("change",a),n())}var l,i,s=this,d=new e.Deferred,c=s.dataSource,u=s.options.pdf.allPages,h=s.wrapper.find(".k-grid-content tbody"),p=e("<div>").css({position:"absolute",left:-1e4,top:-1e4}),f=s.wrapper.clone().css({height:"auto",width:"auto"}).appendTo(p);return f.find(".k-grid-content").css({height:"auto",width:"auto",overflow:"visible"}),f.find(".k-grid-pager, .k-grid-toolbar, .k-grouping-header").remove(),f.find(".k-grid-header").css({paddingRight:0}),this._initPDFProgress(r),l=f.find(".k-grid-content tbody").empty(),i=c.page(),u?(c.bind("change",a),c.page(1)):a(),d.promise()},St.prototype._drawPDF=function(r){function n(){i&&d!==t?(l.unbind("change",o),l.one("change",function(){a.resolve(s)}),l.page(d)):a.resolve(s)}function o(){c._drawPDFShadow({width:c.wrapper.width()},{avoidLinks:c.options.pdf.avoidLinks}).done(function(e){var t=l.page(),o=i?l.totalPages():1,a={page:e,pageNumber:t,progress:t/o,totalPages:o};r.notify(a),s.append(a.page),t<o?l.page(t+1):n()}).fail(function(e){a.reject(e)})}var a,l,i,s,d,c=this;return c.options.pdf.paperSize&&"auto"!=c.options.pdf.paperSize?c._drawPDF_autoPageBreak(r):(a=new e.Deferred,l=c.dataSource,i=c.options.pdf.allPages,this._initPDFProgress(r),s=new ue.drawing.Group,d=l.page(),i?(l.bind("change",o),l.page(1)):o(),a.promise())},St.prototype._initPDFProgress=function(t){var r,n=e("<div class='k-loading-pdf-mask'><div class='k-loading-color'/></div>");n.prepend(this.wrapper.clone().css({position:"absolute",top:0,left:0})),this.wrapper.append(n),r=e("<div class='k-loading-pdf-progress'>").appendTo(n).kendoProgressBar({type:"chunk",chunkCount:10,min:0,max:1,value:0}).data("kendoProgressBar"),t.progress(function(e){r.value(e.progress)}).always(function(){ue.destroy(n),n.remove()})}),he.plugin(St),he.plugin(Tt)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,r){(r||t)()});
  //# sourceMappingURL=kendo.grid.min.js.map
  