text: /*
  * Kendo UI Complete v2013.3.1316 (http://kendoui.com)
  * Copyright 2014 Telerik AD. All rights reserved.
  *
  * Kendo UI Complete commercial licenses may be obtained at
  * https://www.kendoui.com/purchase/license-agreement/kendo-ui-complete-commercial.aspx
  * If you do not own a commercial license, this file shall be governed by the trial license terms.
  */
  !function(define){return define(["./kendo.data.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"],function(){!function(e,t){function a(e){return Array(e+1).join('<td class="k-group-cell">&nbsp;</td>')}function r(e){var t,a=" ";if(e){if(typeof e===ht)return e;for(t in e)a+=t+'="'+e[t]+'"'}return a}function i(t){var a=0;return e("> .k-grouping-header, > .k-grid-toolbar",t).each(function(){a+=this.offsetHeight}),a}function n(t,a){e("th, th .k-grid-filter, th .k-link",t).add(document.body).css("cursor",a)}function o(e){var t,a,r={},i={};if(!M(e))for(A(e)||(e=[e]),t=0,a=e.length;a>t;t++)r[e[t].aggregate]=0,i[e[t].field]=r;return i}function l(e,t,a){var r=e.eq(t),i=e.eq(a);r[t>a?"insertBefore":"insertAfter"](i)}function s(e,t,a){var r,i,n,o;for(a=A(a)?a:[a],r=0,i=a.length;i>r;r++)n=a[r],H(n)&&n.click&&(o=n.name||n.text,t.on(dt+U,"a.k-grid-"+(o||"").replace(/\s/g,""),{commandName:o},W(n.click,e)))}function d(e){return z(e,function(e){return!e.hidden})}function c(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",R({},e,{style:t})}function p(e){e=e||{};var t=e.style;return t&&(e.style=t.replace(/(display\s*:\s*none\s*;?)*/gi,"")),e}function u(t,a,r,i){var n,o=t.find(">colgroup"),l=D(a,function(e){return n=e.width,n&&0!==parseInt(n,10)?_.format('<col style="width:{0}"/>',typeof n===ht?n:n+"px"):"<col />"});(r||o.find(".k-hierarchy-col").length)&&l.splice(0,0,'<col class="k-hierarchy-col" />'),o.length&&o.remove(),o=e(Array(i+1).join('<col class="k-group-col">')+l.join("")),o.is("colgroup")||(o=e("<colgroup/>").append(o)),t.prepend(o),yt.msie&&8==yt.version&&(t.css("display","inline-table"),window.setTimeout(function(){t.css("display","")},1))}function h(e){var t,a,r,i={};for(a=0,r=e.length;r>a;a++)t=e[a],i[t.value]=t.text;return i}function f(e,t,a){var r=a&&a.length&&H(a[0])&&"value"in a[0],i=r?h(a)[e]:e;return i=null!=i?i:"",t?_.format(t,i):i}function g(e,t,a){for(var r,i=0,n=e[i];n;){if(r=a?!0:"none"!==n.style.display,r&&!vt.test(n.className)&&--t<0){n.style.display=a?"":"none";break}n=e[++i]}}function m(e,t){var a,r,i;if(typeof e===ht&&e===t)return e;if(H(e)&&e.name===t)return e;if(A(e))for(a=0,r=e.length;r>a;a++)if(i=e[a],typeof i===ht&&i===t||i.name===t)return i;return null}function b(t,a){var r,i,n,o=yt.msie;if(a===!0){if(t=e(t),n=o&&t.parent().is(".k-grid-content,.k-grid-header-wrap"),n&&(r=t.parent().scrollTop(),i=t.parent().scrollLeft()),o)try{t[0].setActive()}catch(l){t[0].focus()}else t[0].focus();n&&(t.parent().scrollTop(r),t.parent().scrollLeft(i))}else e(t).one("focusin",function(e){e.preventDefault()}).focus()}function k(t){var a=e(t.currentTarget),r=a.is("th"),i=a.closest("table")[0];_.support.touch||(i===this.table[0]||i===this.thead.parent()[0])&&(this.current(a),(r||!e(t.target).is(":button,a,:input,a>.k-icon,textarea,span.k-icon,span.k-link,.k-input,.k-multiselect-wrap"))&&setTimeout(function(){xt&&e(_._activeElement()).hasClass("k-widget")||b(i,!0)}),r&&t.preventDefault())}var _=window.kendo,v=_.ui,w=_.data.DataSource,C=v.Groupable,y=_.support.tbodyInnerHtml,T=_._activeElement,x=v.Widget,S=_.keys,H=e.isPlainObject,R=e.extend,D=e.map,z=e.grep,A=e.isArray,E=e.inArray,W=e.proxy,I=_.isFunction,M=e.isEmptyObject,N=Math,F="progress",L="error",B=":not(.k-group-cell):not(.k-hierarchy-cell):visible",P="tbody>tr:not(.k-grouping-row):not(.k-detail-row):not(.k-group-footer) > td:not(.k-group-cell):not(.k-hierarchy-cell)",q="tr:not(.k-footer-template):visible",O=":not(.k-group-cell):not(.k-hierarchy-cell):visible",G=q+":first>"+O+":first",j="th.k-header:not(.k-group-cell,.k-hierarchy-cell)",U=".kendoGrid",V="edit",$="save",K="remove",J="detailInit",X="filterMenuInit",Q="columnMenuInit",Y="change",Z="columnHide",et="columnShow",tt="saveChanges",at="dataBound",rt="detailExpand",it="detailCollapse",nt="k-state-focused",ot="k-state-selected",lt="columnResize",st="columnReorder",dt="click",ct="height",pt="tabIndex",ut="function",ht="string",ft="Are you sure you want to delete this record?",gt="Delete",mt="Cancel",bt=/(\}|\#)/gi,kt=/#/gi,_t="[\\x20\\t\\r\\n\\f]",vt=RegExp("(^|"+_t+")"+"(k-group-cell|k-hierarchy-cell)"+"("+_t+"|$)"),wt='<a class="k-button k-button-icontext #=className#" #=attr# href="\\#"><span class="#=iconClass# #=imageClass#"></span>#=text#</a>',Ct=!1,yt=_.support.browser,Tt=yt.msie&&7==yt.version,xt=yt.msie&&8==yt.version,St=x.extend({init:function(e,t){var a=this;x.fn.init.call(a,e,t),a._refreshHandler=W(a.refresh,a),a.setDataSource(t.dataSource),a.wrap()},setDataSource:function(e){var t=this;t.dataSource&&t.dataSource.unbind(Y,t._refreshHandler),t.dataSource=e,t.dataSource.bind(Y,t._refreshHandler)},options:{name:"VirtualScrollable",itemHeight:e.noop},destroy:function(){var e=this;x.fn.destroy.call(e),e.dataSource.unbind(Y,e._refreshHandler),e.wrapper.add(e.verticalScrollbar).off(U),e.drag&&e.drag.destroy()},wrap:function(){var t,a=this,r=_.support.scrollbar()+1,i=a.element;i.css({width:"auto",overflow:"hidden"}).css(Ct?"padding-left":"padding-right",r),a.content=i.children().first(),t=a.wrapper=a.content.wrap('<div class="k-virtual-scrollable-wrap"/>').parent().bind("DOMMouseScroll"+U+" mousewheel"+U,W(a._wheelScroll,a)),_.support.kineticScrollNeeded&&(a.drag=new _.UserEvents(a.wrapper,{global:!0,move:function(e){a.verticalScrollbar.scrollTop(a.verticalScrollbar.scrollTop()-e.y.delta),t.scrollLeft(t.scrollLeft()-e.x.delta),e.preventDefault()}})),a.verticalScrollbar=e('<div class="k-scrollbar k-scrollbar-vertical" />').css({width:r}).appendTo(i).bind("scroll"+U,W(a._scroll,a))},_wheelScroll:function(e){var a,r=this,i=r.verticalScrollbar.scrollTop(),n=e.originalEvent,o=n.wheelDeltaY;n.wheelDelta?(o===t||o)&&(a=n.wheelDelta):n.detail&&n.axis===n.VERTICAL_AXIS&&(a=10*-n.detail),a&&(e.preventDefault(),r.verticalScrollbar.scrollTop(i+-a))},_scroll:function(e){var t=this,a=e.currentTarget.scrollTop,r=t.dataSource,i=t.itemHeight,n=r.skip()||0,o=t._rangeStart||n,l=t.element.innerHeight(),s=!!(t._scrollbarTop&&t._scrollbarTop>a),d=N.max(N.floor(a/i),0),c=N.max(d+N.floor(l/i),0);t._scrollTop=a-o*i,t._scrollbarTop=a,t._fetch(d,c,s)||(t.wrapper[0].scrollTop=t._scrollTop)},_fetch:function(e,t,a){var r=this,i=r.dataSource,n=r.itemHeight,o=i.take(),l=r._rangeStart||i.skip()||0,s=N.floor(e/o)*o,d=!1,c=.33;return l>e?(d=!0,l=N.max(0,t-o),r._scrollTop=(e-l)*n,r._page(l,o)):t>=l+o&&!a?(d=!0,l=e,r._scrollTop=n,r._page(l,o)):r._fetching||(s+o-o*c>e&&e>o&&i.prefetch(s-o,o),t>s+o*c&&i.prefetch(s+o,o)),d},_page:function(e,t){var a=this,r=a.dataSource;clearTimeout(a._timeout),a._fetching=!0,a._rangeStart=e,r.inRange(e,t)?r.range(e,t):(_.ui.progress(a.wrapper.parent(),!0),a._timeout=setTimeout(function(){r.range(e,t)},100))},refresh:function(){var e,t,a,r,i=this,n="",o=25e4,l=i.dataSource,s=i._rangeStart,d=_.support.kineticScrollNeeded?0:_.support.scrollbar(),c=i.wrapper[0];for(_.ui.progress(i.wrapper.parent(),!1),clearTimeout(i._timeout),a=i.itemHeight=i.options.itemHeight()||0,r=c.scrollWidth>c.offsetWidth?d:0,e=l.total()*a+r,t=0;t<N.floor(e/o);t++)n+='<div style="width:1px;height:'+o+'px"></div>';e%o&&(n+='<div style="width:1px;height:'+e%o+'px"></div>'),i.verticalScrollbar.html(n),c.scrollTop=i._scrollTop,i.drag&&i.drag.cancel(),s&&!i._fetching&&(i._rangeStart=l.skip()),i._fetching=!1}}),Ht={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-grid-update",iconClass:"k-icon"},canceledit:{text:"Cancel",imageClass:"k-cancel",className:"k-grid-cancel",iconClass:"k-icon"}},Rt=x.extend({init:function(e,t){var a=this;t=A(t)?{dataSource:t}:t,x.fn.init.call(a,e,t),Ct=_.support.isRtl(e),a._element(),a._aria(),a._columns(a.options.columns),a._dataSource(),a._tbody(),a._pageable(),a._thead(),a._groupable(),a._toolbar(),a._setContentHeight(),a._templates(),a._navigatable(),a._selectable(),a._details(),a._editable(),a._attachCustomCommandsEvent(),a.options.autoBind?a.dataSource.fetch():a._footer(),_.notify(a)},events:[Y,"dataBinding","cancel",at,rt,it,J,X,Q,V,$,K,tt,lt,st,et,Z],setDataSource:function(e){var t=this;t.options.dataSource=e,t._dataSource(),t._pageable(),t.options.groupable&&t._groupable(),t._thead(),t.virtualScrollable&&t.virtualScrollable.setDataSource(t.options.dataSource),t.options.autoBind&&e.fetch()},options:{name:"Grid",columns:[],toolbar:null,autoBind:!0,filterable:!1,scrollable:!0,sortable:!1,selectable:!1,navigatable:!1,pageable:!1,editable:!1,groupable:!1,rowTemplate:"",altRowTemplate:"",dataSource:{},height:null,resizable:!1,reorderable:!1,columnMenu:!1,detailTemplate:null,columnResizeHandleWidth:3,mobile:""},destroy:function(){var t,a=this;x.fn.destroy.call(a),a.pager&&a.pager.destroy(),a.groupable&&a.groupable.destroy(),a.options.reorderable&&a.wrapper.data("kendoReorderable").destroy(),a.selectable&&a.selectable.destroy(),a.resizable&&(a.resizable.destroy(),a._resizeUserEvents&&(a._resizeHandleDocumentClickHandler&&e(document).off("click",a._resizeHandleDocumentClickHandler),a._resizeUserEvents.destroy())),a.virtualScrollable&&a.virtualScrollable.destroy(),a._destroyColumnAttachments(),a._destroyEditable(),a.dataSource.unbind(Y,a._refreshHandler).unbind(F,a._progressHandler).unbind(L,a._errorHandler),t=a.element.add(a.wrapper).add(a.table).add(a.thead).add(a.wrapper.find(">.k-grid-toolbar")),a.content&&(t=t.add(a.content).add(a.content.find(">.k-virtual-scrollable-wrap"))),a.pane&&a.pane.destroy(),t.off(U),_.destroy(a.wrapper)},setOptions:function(e){var t=this;x.fn.setOptions.call(this,e),t._templates()},items:function(){return this.tbody.children(":not(.k-grouping-row,.k-detail-row,.k-group-footer)")},_destroyColumnAttachments:function(){var t=this;t.resizeHandle=null,t.thead.find("th").each(function(){var t=e(this),a=t.data("kendoFilterMenu"),r=t.data("kendoSortable"),i=t.data("kendoColumnMenu");a&&a.destroy(),r&&r.destroy(),i&&i.destroy()})},_attachCustomCommandsEvent:function(){var e,t,a,r=this,i=r.columns||[];for(t=0,a=i.length;a>t;t++)e=i[t].command,e&&s(r,r.wrapper,e)},_aria:function(){var e=this.element.attr("id")||"aria";e&&(this._cellId=e+"_active_cell")},_element:function(){var t=this,a=t.element;a.is("table")||(a=t.options.scrollable?t.element.find("> .k-grid-content > table"):t.element.children("table"),a.length||(a=e("<table />").appendTo(t.element))),Tt&&a.attr("cellspacing",0),t.table=a.attr("role",t._hasDetails()?"treegrid":"grid"),t._wrapper()},_createResizeHandle:function(t,a){var r,n,o,l,s,d=this,c=d.options.columnResizeHandleWidth,p=d.options.scrollable,u=d.resizeHandle;u||(u=d.resizeHandle=e('<div class="k-resize-handle"><div class="k-resize-handle-inner"></div></div>'),t.append(u)),Ct?(n=a.closest(".k-grid-header-wrap"),o=yt.msie?n.scrollLeft():0,l=yt.webkit?n[0].scrollWidth-n[0].offsetWidth-n.scrollLeft():0,s=yt.mozilla?n[0].scrollWidth-n[0].offsetWidth-(n[0].scrollWidth-n[0].offsetWidth-n.scrollLeft()):0,r=a.position().left-l+s-o):(r=a[0].offsetWidth,a.prevAll(":visible").each(function(){r+=this.offsetWidth})),u.css({top:p?0:i(d.wrapper),left:r-c,height:a.outerHeight(),width:3*c}).data("th",a).show()},_positionColumnResizeHandle:function(t){var a=this,r=a.resizeHandle,i=a.options.columnResizeHandleWidth;a.thead.on("mousemove"+U,"th:not(.k-group-cell,.k-hierarchy-cell)",function(o){var l=e(this),s=o.clientX,d=e(window).scrollLeft(),c=l.offset().left+(Ct?0:this.offsetWidth);s+d>c-i&&c+i>s+d?a._createResizeHandle(t,l):r?r.hide():n(a.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.resizeHandle.hide())},_positionColumnResizeHandleTouch:function(t){var a=this;a._resizeUserEvents=new _.UserEvents(a.thead,{filter:"th:not(.k-group-cell,.k-hierarchy-cell)",threshold:10,hold:function(r){var i=e(r.target);r.preventDefault(),i.addClass("k-column-active"),a._createResizeHandle(t,i),a._resizeHandleDocumentClickHandler||(a._resizeHandleDocumentClickHandler=W(a._resizeHandleDocumentClick,a)),e(document).on("click",a._resizeHandleDocumentClickHandler)}})},_resizable:function(){var t,a,r,i,o,l,s=this,d=s.options,c=this._isMobile;d.resizable&&(t=d.scrollable?s.wrapper.find(".k-grid-header-wrap:first"):s.wrapper,c?s._positionColumnResizeHandleTouch(t):s._positionColumnResizeHandle(t),s.resizable=new v.Resizable(t,{handle:".k-resize-handle",hint:function(t){return e('<div class="k-grid-resize-indicator" />').css({height:t.data("th").outerHeight()+s.tbody.attr("clientHeight")})},start:function(t){l=e(t.currentTarget).data("th"),c&&s._hideResizeHandle();var p=e.inArray(l[0],l.parent().children(":visible")),u=s.tbody.parent(),h=s.footer||e();n(s.wrapper,"col-resize"),o=d.scrollable?s.thead.parent().find("col:eq("+p+")").add(u.children("colgroup").find("col:eq("+p+")")).add(h.find("colgroup").find("col:eq("+p+")")):u.children("colgroup").find("col:eq("+p+")"),a=t.x.location,r=l.outerWidth(),i=s.tbody.outerWidth()},resize:function(t){var n=Ct?-1:1,l=r+t.x.location*n-a*n,c=s.footer||e();l>10&&(o.css("width",l),d.scrollable&&i&&(s._footerWidth=i+t.x.location*n-a*n,s.tbody.parent().add(s.thead.parent()).add(c.find("table")).css("width",s._footerWidth)))},resizeend:function(){var e,t=l.outerWidth();n(s.wrapper,""),r!=t&&(e=s.columns[l.parent().find("th:not(.k-group-cell,.k-hierarchy-cell)").index(l)],e.width=t,s.trigger(lt,{column:e,oldWidth:r,newWidth:t})),s._hideResizeHandle(),l=null}}))},_draggable:function(){var t=this;t.options.reorderable&&(t._draggableInstance&&t._draggableInstance.destroy(),t._draggableInstance=t.wrapper.kendoDraggable({group:_.guid(),filter:t.content?".k-grid-header:first "+j:"table:first>.k-grid-header "+j,drag:function(){t._hideResizeHandle()},hint:function(t){return 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(t.attr(_.attr("title"))||t.attr(_.attr("field"))||t.text()).prepend('<span class="k-icon k-drag-status k-denied" />')}}).data("kendoDraggable"))},_reorderable:function(){var e=this;e.options.reorderable&&e.wrapper.kendoReorderable({draggable:e._draggableInstance,change:function(t){var a=E(e.columns[t.newIndex],e.columns),r=e.columns[t.oldIndex];e.trigger(st,{newIndex:a,oldIndex:E(r,e.columns),column:r}),e.reorderColumn(a,r)}})},reorderColumn:function(e,t){var a,r,i,n=this,o=E(t,n.columns),s=E(t,d(n.columns)),c=E(n.columns[e],d(n.columns)),p=n.footer||n.wrapper.find(".k-grid-footer");if(o!==e)for(n._hideResizeHandle(),n.columns.splice(o,1),n.columns.splice(e,0,t),n._templates(),l(n.thead.prev().find("col:not(.k-group-col,.k-hierarchy-col)"),s,c),n.options.scrollable&&l(n.tbody.prev().find("col:not(.k-group-col,.k-hierarchy-col)"),s,c),l(n.thead.find(".k-header:not(.k-group-cell,.k-hierarchy-cell)"),o,e),p&&p.length&&(l(p.find(".k-grid-footer-wrap>table>colgroup>col:not(.k-group-col,.k-hierarchy-col)"),s,c),l(p.find(".k-footer-template>td:not(.k-group-cell,.k-hierarchy-cell)"),o,e)),a=n.tbody.children(":not(.k-grouping-row,.k-detail-row)"),r=0,i=a.length;i>r;r+=1)l(a.eq(r).find(">td:not(.k-group-cell,.k-hierarchy-cell)"),o,e)},cellIndex:function(t){return e(t).parent().children("td:not(.k-group-cell,.k-hierarchy-cell)").index(t)},_modelForContainer:function(t){t=e(t),t.is("tr")||"popup"===this._editMode()||(t=t.closest("tr"));var a=t.attr(_.attr("uid"));return this.dataSource.getByUid(a)},_editable:function(){var t,a=this,r=a.selectable&&a.selectable.options.multiple,i=a.options.editable,n=function(){var t=T(),r=a._editContainer;!r||e.contains(r[0],t)||r[0]===t||e(t).closest(".k-animation-container").length||a.editable.end()&&a.closeCell()};i&&(t=a._editMode(),"incell"===t?i.update!==!1&&a.wrapper.on(dt+U,"tr:not(.k-grouping-row) > td",function(t){var i=e(this);i.hasClass("k-hierarchy-cell")||i.hasClass("k-detail-cell")||i.hasClass("k-group-cell")||i.hasClass("k-edit-cell")||i.has("a.k-grid-delete").length||i.has("button.k-grid-delete").length||i.closest("tbody")[0]!==a.tbody[0]||e(t.target).is(":input")||(a.editable?a.editable.end()&&(r&&e(T()).blur(),a.closeCell(),a.editCell(i)):a.editCell(i))}).on("focusin"+U,function(){clearTimeout(a.timer),a.timer=null}).on("focusout"+U,function(){a.timer=setTimeout(n,1)}):i.update!==!1&&a.wrapper.on(dt+U,"tbody>tr:not(.k-detail-row,.k-grouping-row):visible a.k-grid-edit",function(t){t.preventDefault(),a.editRow(e(this).closest("tr"))}),i.destroy!==!1?a.wrapper.on(dt+U,"tbody>tr:not(.k-detail-row,.k-grouping-row):visible .k-grid-delete",function(t){t.preventDefault(),t.stopPropagation(),a.removeRow(e(this).closest("tr"))}):a.wrapper.on(dt+U,"tbody>tr:not(.k-detail-row,.k-grouping-row):visible button.k-grid-delete",function(e){e.stopPropagation(),a._confirmation()||e.preventDefault()}))},editCell:function(t){t=e(t);var a=this,r=a.columns[a.cellIndex(t)],i=a._modelForContainer(t);!i||i.editable&&!i.editable(r.field)||r.command||!r.field||(a._attachModelChange(i),a._editContainer=t,a.editable=t.addClass("k-edit-cell").kendoEditable({fields:{field:r.field,format:r.format,editor:r.editor,values:r.values},model:i,change:function(e){a.trigger($,{values:e.values,container:t,model:i})&&e.preventDefault()}}).data("kendoEditable"),t.parent().addClass("k-grid-edit-row"),a.trigger(V,{container:t,model:i}))},_destroyEditable:function(){var e=this,t=function(){e.editable&&(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,a=e._modelForContainer(t);a&&a.unbind(Y,e._modelChangeHandler)},closeCell:function(t){var a,r,i,n=this,o=n._editContainer;o&&(a=o.closest("tr").attr(_.attr("uid")),i=n.dataSource.getByUid(a),t&&n.trigger("cancel",{container:o,model:i})||(o.removeClass("k-edit-cell"),r=n.columns[n.cellIndex(o)],o.parent().removeClass("k-grid-edit-row"),n._destroyEditable(),n._displayCell(o,r,i),o.hasClass("k-dirty-cell")&&e('<span class="k-dirty"/>').prependTo(o)))},_displayCell:function(e,t,a){var r=this,i={storage:{},count:0},n=R({},_.Template,r.options.templateSettings),o=_.template(r._cellTmpl(t,i),n);i.count>0&&(o=W(o,i.storage)),e.empty().html(o(a))},removeRow:function(e){this._confirmation(e)&&this._removeRow(e)},_removeRow:function(t){var a,r,i=this;t=e(t).hide(),a=i._modelForContainer(t),a&&!i.trigger(K,{row:t,model:a})&&(r=i._editMode(),"incell"!==r&&i.cancelRow(),i.dataSource.remove(a),("inline"===r||"popup"===r)&&i.dataSource.sync())},_editMode:function(){var e="incell",t=this.options.editable;return t!==!0&&(e="string"==typeof t?t:t.mode||e),e},editRow:function(a){var r,i,n,o,l=this;a instanceof _.data.ObservableObject?r=a:(a=e(a),r=l._modelForContainer(a)),i=l._editMode(),n=l.options.navigatable,l.cancelRow(),r&&(l._attachModelChange(r),"popup"===i?l._createPopupEditor(r):"inline"===i?l._createInlineEditor(a,r):"incell"===i&&e(a).children(B).each(function(){var a=e(this),i=l.columns[a.index()];return r=l._modelForContainer(a),r&&(!r.editable||r.editable(i.field))&&i.field?(l.editCell(a),!1):t}),o=l.editView?l.editView.element:l._editContainer,o.on(dt+U,"a.k-grid-cancel",function(t){if(t.preventDefault(),t.stopPropagation(),!l.trigger("cancel",{container:o,model:r})){var a=l.items().index(e(l.current()).parent());l.cancelRow(),n&&(l.current(l.items().eq(a).children().filter(O).first()),b(l.table,!0))}}),o.on(dt+U,"a.k-grid-update",function(e){e.preventDefault(),e.stopPropagation(),l.saveRow()}))},_createPopupEditor:function(a){var r,i,n,o,l,s,d,c,p,u,h,f=this,g="<div "+_.attr("uid")+'="'+a.uid+'" class="k-popup-edit-form'+(f._isMobile?" k-mobile-list":"")+'"><div class="k-edit-form-container">',k=[],v=f.options.editable,w=v.template,C=H(v)?v.window:{},y=R({},_.Template,f.options.templateSettings);if(C=C||{},w)for(typeof w===ht&&(w=window.unescape(w)),g+=_.template(w,y)(a),n=0,o=f.columns.length;o>n;n++)r=f.columns[n],r.command&&(c=m(r.command,"edit"),c&&(i=c));else for(n=0,o=f.columns.length;o>n;n++)r=f.columns[n],r.command?r.command&&(c=m(r.command,"edit"),c&&(i=c)):(g+='<div class="k-edit-label"><label for="'+r.field+'">'+(r.title||r.field||"")+"</label></div>",a.editable&&!a.editable(r.field)||!r.field?(u={storage:{},count:0},l=_.template(f._cellTmpl(r,u),y),u.count>0&&(l=W(l,u.storage)),g+='<div class="k-edit-field">'+l(a)+"</div>"):(k.push({field:r.field,format:r.format,editor:r.editor,values:r.values}),g+="<div "+_.attr("container-for")+'="'+r.field+'" class="k-edit-field"></div>'));i&&H(i)&&(i.text&&H(i.text)&&(s=i.text.update,d=i.text.cancel),i.attr&&(p=i.attr)),f._isMobile?(g+="</div></div>",f.editView=f.pane.append("<div data-"+_.ns+'role="view" data-'+_.ns+'init-widgets="false" class="k-grid-edit-form">'+"<div data-"+_.ns+'role="header" class="k-header">'+f._createButton({name:"update",text:s,attr:p})+(C.title||"Edit")+f._createButton({name:"canceledit",text:d,attr:p})+"</div>"+g+"</div>"),h=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:p})+f._createButton({name:"canceledit",text:d,attr:p}),g+="</div></div></div>",h=f._editContainer=e(g).appendTo(f.wrapper).eq(0).kendoWindow(R({modal:!0,resizable:!1,draggable:!0,title:"Edit",visible:!1,close:function(r){if(r.userTriggered){if(r.sender.element.focus(),f.trigger("cancel",{container:h,model:a}))return r.preventDefault(),t;var i=f.items().index(e(f.current()).parent());f.cancelRow(),f.options.navigatable&&(f.current(f.items().eq(i).children().filter(O).first()),b(f.table,!0))}}},C))),f.editable=f._editContainer.kendoEditable({fields:k,model:a,clearContainer:!1}).data("kendoEditable"),f._isMobile&&h.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(V,{container:h,model:a})},_openPopUpEditor:function(){this._isMobile?this.pane.navigate(this.editView,this._editAnimation):this._editContainer.data("kendoWindow").center().open()},_createInlineEditor:function(t,a){var r,i,n,o=this,l=[];t.children(":not(.k-group-cell,.k-hierarchy-cell)").each(function(){if(i=e(this),r=o.columns[o.cellIndex(i)],r.command||!r.field||a.editable&&!a.editable(r.field)){if(r.command&&(n=m(r.command,"edit"))){i.empty();var t,s,d;H(n)&&(n.text&&H(n.text)&&(t=n.text.update,s=n.text.cancel),n.attr&&(d=n.attr)),e(o._createButton({name:"update",text:t,attr:d})+o._createButton({name:"canceledit",text:s,attr:d})).appendTo(i)}}else l.push({field:r.field,format:r.format,editor:r.editor,values:r.values}),i.attr(_.attr("container-for"),r.field),i.empty()}),o._editContainer=t,o.editable=t.addClass("k-grid-edit-row").kendoEditable({fields:l,model:a,clearContainer:!1}).data("kendoEditable"),o.trigger(V,{container:t,model:a})},cancelRow:function(){var e,t=this,a=t._editContainer;a&&(e=t._modelForContainer(a),t._destroyEditable(),t.dataSource.cancelChanges(e),"popup"!==t._editMode()?t._displayRow(a):t._displayRow(t.items().filter("["+_.attr("uid")+"="+e.uid+"]")))},saveRow:function(){var e=this,t=e._editContainer,a=e._modelForContainer(t),r=e.editable;t&&r&&r.end()&&!e.trigger($,{container:t,model:a})&&e.dataSource.sync()},_displayRow:function(t){var a=this,r=a._modelForContainer(t);r&&t.replaceWith(e((t.hasClass("k-alt")?a.altRowTemplate:a.rowTemplate)(r)))},_showMessage:function(t,a){var r,i,n,o=this;return o._isMobile?(r=_.template('<ul><li class="km-actionsheet-title">#:title#</li><li><a href="\\#" class="k-button k-grid-delete">#:confirmDelete#</a></li></ul>'),i=e(r(t)).appendTo(o.view.element),n=o._actionSheet=new _.mobile.ui.ActionSheet(i,{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 r=e(t.currentTarget).parent();r.hasClass("km-actionsheet-cancel")||o._removeRow(a)},popup:o._actionSheetPopupOptions}),n.open(a),!1):window.confirm(t.title)},_confirmation:function(e){var t=this,a=t.options.editable,r=a===!0||typeof a===ht?ft:a.confirmation;return r!==!1&&null!=r?t._showMessage({confirmDelete:a.confirmDelete||gt,cancelDelete:a.cancelDelete||mt,title:r===!0?ft:r},e):!0},cancelChanges:function(){this.dataSource.cancelChanges()},saveChanges:function(){var e=this;(e.editable&&e.editable.end()||!e.editable)&&!e.trigger(tt)&&e.dataSource.sync()},addRow:function(){var e,t,a,r,i,n=this,o=n.dataSource,l=n._editMode(),s=n.options.editable.createAt||"",d=o.pageSize(),c=o.view()||[];(n.editable&&n.editable.end()||!n.editable)&&("incell"!=l&&n.cancelRow(),e=o.indexOf(c[0]),"bottom"==s.toLowerCase()&&(e+=c.length,d&&!o.options.serverPaging&&d<=c.length&&(e-=1)),0>e&&(e=o.page()>o.totalPages()?(o.page()-1)*d:0),t=o.insert(e,{}),a=t.uid,r=n.table.find("tr["+_.attr("uid")+"="+a+"]"),i=r.children("td:not(.k-group-cell,.k-hierarchy-cell)").eq(n._firstEditableColumnIndex(r)),"inline"===l&&r.length?n.editRow(r):"popup"===l?n.editRow(t):i.length&&n.editCell(i))},_firstEditableColumnIndex:function(e){var t,a,r,i=this,n=i.columns,o=i._modelForContainer(e);for(a=0,r=n.length;r>a;a++)if(t=n[a],o&&(!o.editable||o.editable(t.field))&&!t.command&&t.field)return a;return-1},_toolbar:function(){var t,a=this,r=a.wrapper,i=a.options.toolbar,n=a.options.editable;i&&(t=a.wrapper.find(".k-grid-toolbar"),t.length||(I(i)||(i=typeof i===ht?i:a._toolbarTmpl(i).replace(kt,"\\#"),i=W(_.template(i),a)),t=e('<div class="k-toolbar k-grid-toolbar" />').html(i({})).prependTo(r)),n&&n.create!==!1&&t.on(dt+U,".k-grid-add",function(e){e.preventDefault(),a.addRow()}).on(dt+U,".k-grid-cancel-changes",function(e){e.preventDefault(),a.cancelChanges()}).on(dt+U,".k-grid-save-changes",function(e){e.preventDefault(),a.saveChanges()}))},_toolbarTmpl:function(e){var t,a,r=this,i="";if(A(e))for(t=0,a=e.length;a>t;t++)i+=r._createButton(e[t]);return i},_createButton:function(e){var t=e.template||wt,a=typeof e===ht?e:e.name||e.text,i=Ht[a]?Ht[a].className:"k-grid-"+(a||"").replace(/\s/g,""),n={className:i,text:a,imageClass:"",attr:"",iconClass:""};if(!(a||H(e)&&e.template))throw Error("Custom commands should have name specified");return H(e)?(e.className&&(e.className+=" "+n.className),"edit"===a&&H(e.text)&&(e=R(!0,{},e),e.text=e.text.edit),e.attr&&H(e.attr)&&(e.attr=r(e.attr)),n=R(!0,n,Ht[a],e)):n=R(!0,n,Ht[a]),_.template(t)(n)},_hasFooters:function(){var e,t=this.columns,a=t.length;for(e=0;a>e;e++)if(""!==t[e].footerTemplate||""!==t[e].groupFooterTemplate)return!0;return!1},_groupable:function(){var t=this;t._groupableClickHandler?t.table.off(dt+U,t._groupableClickHandler):t._groupableClickHandler=function(a){var r=e(this),i=r.closest("tr");r.hasClass("k-i-collapse")?t.collapseGroup(i):t.expandGroup(i),a.preventDefault(),a.stopPropagation()},t.table.on(dt+U,".k-grouping-row .k-i-collapse, .k-grouping-row .k-i-expand",t._groupableClickHandler),t._attachGroupable()},_attachGroupable:function(){var t=this,a=t.wrapper,r=t.options.groupable,i=j+":visible["+_.attr("field")+"]",n=j+"["+_.attr("field")+"]";r&&(a.has("div.k-grouping-header")[0]||e("<div>&nbsp;</div>").addClass("k-grouping-header").prependTo(a),t.groupable&&t.groupable.destroy(),t.groupable=new C(a,R({},r,{draggable:t._draggableInstance,groupContainer:">div.k-grouping-header",dataSource:t.dataSource,draggableElements:t.content?".k-grid-header:first "+i:"table:first>.k-grid-header "+i,filter:t.content?".k-grid-header:first "+n:"table:first>.k-grid-header "+n,allowDrag:t.options.reorderable})))},_selectable:function(){var e,a,r=this,i=[],n=r.options.selectable;n&&(e=typeof n===ht&&n.toLowerCase().indexOf("multiple")>-1,a=typeof n===ht&&n.toLowerCase().indexOf("cell")>-1,r._hasDetails()&&(i[i.length]=".k-detail-row"),(r.options.groupable||r._hasFooters())&&(i[i.length]=".k-grouping-row,.k-group-footer"),i=i.join(","),""!==i&&(i=":not("+i+")"),r.selectable=new _.ui.Selectable(r.table,{filter:">"+(a?P:"tbody>tr"+i),aria:!0,multiple:e,change:function(){r.trigger(Y)}}),r.options.navigatable&&r.table.on("keydown"+U,function(i){var n=r.current();if(i.keyCode===S.SPACEBAR&&i.target==r.table[0]&&!n.is(".k-edit-cell,.k-header")&&n.parent().is(":not(.k-grouping-row,.k-detail-row,.k-group-footer)")){if(i.preventDefault(),i.stopPropagation(),n=a?n:n.parent(),e)if(i.ctrlKey){if(n.hasClass(ot))return n.removeClass(ot),r.trigger(Y),t}else r.selectable.clear();else r.selectable.clear();r.selectable.value(n)}}))},clearSelection:function(){var e=this;e.selectable.clear(),e.trigger(Y)},select:function(a){var r=this,i=r.selectable;return a=e(a),a.length?(i.options.multiple||(i.clear(),a=a.first()),i.value(a),t):i.value()},current:function(a){var r=this,i=r.options.scrollable,n=r._current,o=r.table.add(r.thead.parent());return a!==t&&a.length&&(n&&n[0]===a[0]||(n&&(n.removeClass(nt).removeAttr("id"),o.removeAttr("aria-activedescendant")),a.attr("id",r._cellId),r._current=a.addClass(nt),o.attr("aria-activedescendant",r._cellId),a.length&&i&&(e.contains(r.content[0],a[0])&&r._scrollTo(a.parent()[0],r.content[0]),i.virtual?r._scrollTo(a[0],r.content.find(">.k-virtual-scrollable-wrap")[0]):r._scrollTo(a[0],r.content[0])))),r._current},_removeCurrent:function(){this._current&&(this._current.removeClass(nt),this._current=null)},_scrollTo:function(e,t){var a=e.tagName.toLowerCase(),r="td"===a||"th"===a,i=e[r?"offsetLeft":"offsetTop"],n=e[r?"offsetWidth":"offsetHeight"],o=t[r?"scrollLeft":"scrollTop"],l=t[r?"clientWidth":"clientHeight"],s=i+n,d=0;d=o>i?i:s>o+l?l>=n?s-l:i:o,t[r?"scrollLeft":"scrollTop"]=d},_navigatable:function(){var t=this,a=W(t.current,t),r=t.table,i=t.thead.parent(),n=r,o=_.support.isRtl(t.element);t.options.navigatable&&(t.options.scrollable&&(n=r.add(i),i.attr(pt,-1)),i.on("keydown"+U,function(e){e.altKey&&e.keyCode==S.DOWN&&(a().find(".k-grid-filter, .k-header-column-menu").click(),e.stopImmediatePropagation())}).find("a.k-link").attr("tabIndex",-1),r.attr(pt,N.max(r.attr(pt)||0,0)).on("mousedown"+U+" keydown"+U,".k-detail-cell",function(e){e.target!==e.currentTarget&&e.stopImmediatePropagation()}),n.on(_.support.touch?"touchstart"+U:"mousedown"+U,q+">"+O,W(k,t)).on("focus"+U,function(){if(!_.support.touch){var t=a();t&&t.is(":visible")?t.addClass(nt):a(e(this).find(G)),this==r[0]?(i.attr(pt,-1),r.attr(pt,0)):(r.attr(pt,-1),i.attr(pt,0))}}).on("focusout"+U,function(){var e=a();e&&e.removeClass(nt)}).on("keydown"+U,function(i){var n,l,s,d,c,p,u,h,f=i.keyCode,g=!1,m=!i.isDefaultPrevented()&&!e(i.target).is(":button,a,:input,a>.k-icon"),k=t.options.pageable,_=t.dataSource,v="incell"==t._editMode(),w=i.shiftKey,C=a();C&&C.is("th")&&(m=!0),m&&f==S.UP?(C?(s=C.parent().prevAll(q).first(),s[0]||(c=t.thead.parent(),b(c,!0),s=c.find(q).first()),d=C.index(),C=s.children().eq(d),C[0]&&C.is(O)||(C=s.children(O).first())):C=r.find(G),g=!0,a(C)):m&&f==S.DOWN?(C?(s=C.parent().nextAll(q).first(),!s[0]&&C.is("th")&&(b(t.tbody.parent()),s=t.tbody.find(q).first()),d=C.index(),C=s.children().eq(d),C[0]&&C.is(O)||(C=s.children(O).first())):C=r.find(G),g=!0,a(C)):m&&f==(o?S.RIGHT:S.LEFT)?(a(C?C.prevAll(B+":first"):r.find(G)),g=!0):m&&f==(o?S.LEFT:S.RIGHT)?(C?C.next()[0]&&(C=C.nextAll(B+":first")):C=r.find(G),g=!0,a(C)):m&&k&&S.PAGEDOWN==f?(_.page(_.page()+1),g=!0):m&&k&&S.PAGEUP==f?(_.page(_.page()-1),g=!0):f==S.ENTER||S.F2==f?(C=C?C:r.find(G),C.is("th")?(C.find(".k-link").click(),g=!0):C.parent().is(".k-master-row,.k-grouping-row")?(C.parent().find(".k-icon:first").click(),g=!0):(p=C.find(":kendoFocusable:first"),!C.hasClass("k-edit-cell")&&p[0]&&C.hasClass("k-state-focused")?(p.focus(),g=!0):t.options.editable&&!e(i.target).is(":button,.k-button,textarea")&&(u=e(i.target).closest("[role=gridcell]"),u[0]||(u=C),t._handleEditing(u),g=!0))):S.ESC==f?(n=T(),C&&e.contains(C[0],n)&&!C.hasClass("k-edit-cell")&&!C.parent().hasClass("k-grid-edit-row")?(b(t.table[0],!0),g=!0):!t._editContainer||C&&!t._editContainer.has(C[0])&&C[0]!==t._editContainer[0]||(v?t.closeCell(!0):(l=t.items().index(e(C).parent()),n&&n.blur(),t.cancelRow(),l>=0&&t.current(t.items().eq(l).children().filter(O).first())),yt.msie&&yt.version<9&&document.body.focus(),b(r,!0),g=!0)):S.TAB==f&&(C=e(C),t.options.editable&&v&&(h=e(T()).closest(".k-edit-cell"),h[0]&&h[0]!==C[0]&&(C=h)),h=w?C.prevAll(B+":first"):C.nextAll(":visible:first"),h.length||(h=C.parent()[w?"prevAll":"nextAll"]("tr:not(.k-grouping-row):not(.k-detail-row):visible:first").children(B+(w?":last":":first"))),!C.is("th")&&h.length&&t.options.editable&&v&&(t._handleEditing(C,h),g=!0)),g&&(i.preventDefault(),i.stopPropagation())
  }))},_handleEditing:function(a,r){var i,n,o=this,l=e(T()),s=o._editMode(),d=yt.msie,c=d&&yt.version<9,p=o._editContainer;if(n="incell"==s?a.hasClass("k-edit-cell"):a.parent().hasClass("k-grid-edit-row"),o.editable){if(e.contains(p[0],l[0])&&(yt.opera||c?l.change().triggerHandler("blur"):(l.blur(),d&&l.blur())),!o.editable)return b(o.table),t;if(!o.editable.end())return"incell"==s?o.current(p):o.current(p.children().filter(B).first()),i=p.find(":kendoFocusable:first")[0],i&&i.focus(),t;"incell"==s?o.closeCell():(o.saveRow(),n=!0)}r&&o.current(r),c&&document.body.focus(),b(o.table,!0),(!n&&!r||r)&&("incell"==s?o.editCell(o.current()):o.editRow(o.current().parent()))},_wrapper:function(){var e=this,t=e.table,a=e.options.height,r=e.element;r.is("div")||(r=r.wrap("<div/>").parent()),e.wrapper=r.addClass("k-grid k-widget k-secondary"),a&&(e.wrapper.css(ct,a),t.css(ct,"auto")),e._initMobile()},_initMobile:function(){var t,a=this.options;this._isMobile=a.mobile===!0&&_.support.mobileOS||"phone"===a.mobile||"tablet"===a.mobile,this._isMobile&&(t=this.wrapper.addClass("k-grid-mobile").wrap("<div data-"+_.ns+'role="view" '+"data-"+_.ns+'init-widgets="false"></div>').parent(),this.pane=_.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"},a.height&&this.pane.element.parent().css(ct,a.height),this._editAnimation="slide")},_tbody:function(){var t,a=this,r=a.table;t=r.find(">tbody"),t.length||(t=e("<tbody/>").appendTo(r)),a.tbody=t},_scrollable:function(){var t,a,r,i,n,o=this,l=o.options,s=l.scrollable,d=s!==!0&&s.virtual&&!o.virtualScrollable,c=!_.support.kineticScrollNeeded||d?_.support.scrollbar():0;s&&(t=o.wrapper.children(".k-grid-header"),t[0]||(t=e('<div class="k-grid-header" />').insertBefore(o.table)),t.css(Ct?"padding-left":"padding-right",s.virtual?c+1:c),a=e('<table role="grid" />'),Tt&&a.attr("cellspacing",0),a.append(o.thead),t.empty().append(e('<div class="k-grid-header-wrap" />').append(a)),o.content=o.table.parent(),o.content.is(".k-virtual-scrollable-wrap")&&(o.content=o.content.parent()),o.content.is(".k-grid-content, .k-virtual-scrollable-wrap")||(o.content=o.table.wrap('<div class="k-grid-content" />').parent()),d&&(o.virtualScrollable=new St(o.content,{dataSource:o.dataSource,itemHeight:W(o._averageRowHeight,o)})),o.scrollables=t.children(".k-grid-header-wrap"),r=o.wrapper.find(".k-grid-footer"),i=Ct&&yt.webkit?c:0,r.length&&(o.scrollables=o.scrollables.add(r.children(".k-grid-footer-wrap"))),s.virtual?o.content.find(">.k-virtual-scrollable-wrap").bind("scroll"+U,function(){o.scrollables.scrollLeft(this.scrollLeft+i)}):(o.content.bind("scroll"+U,function(){o.scrollables.scrollLeft(this.scrollLeft+i)}),n=_.touchScroller(o.content),n&&n.movable&&n.movable.bind("change",function(e){o.scrollables.scrollLeft(-e.sender.x)})))},_setContentWidth:function(){var t,a=this,r="k-grid-content-expander",i='<div class="'+r+'"></div>',n=a.resizable;a.options.scrollable&&a.wrapper.is(":visible")&&(t=a.table.parent().children("."+r),a._setContentWidthHandler=W(a._setContentWidth,a),a.dataSource&&a.dataSource.view().length?t[0]&&(t.remove(),n&&n.unbind("resize",a._setContentWidthHandler)):(t[0]||(t=e(i).appendTo(a.table.parent()),n&&n.bind("resize",a._setContentWidthHandler)),a.thead&&t.width(a.thead.width())))},_setContentHeight:function(){var e,t=this,a=t.options,r=t.wrapper.innerHeight(),i=t.wrapper.children(".k-grid-header"),n=_.support.scrollbar();a.scrollable&&t.wrapper.is(":visible")&&(r-=i.outerHeight(),t.pager&&(r-=t.pager.element.outerHeight()),a.groupable&&(r-=t.wrapper.children(".k-grouping-header").outerHeight()),a.toolbar&&(r-=t.wrapper.children(".k-grid-toolbar").outerHeight()),t.footerTemplate&&(r-=t.wrapper.children(".k-grid-footer").outerHeight()),e=function(e){var t,a;return e[0].style.height?!0:(t=e.height(),e.height("auto"),a=e.height(),t!=a?(e.height(""),!0):(e.height(""),!1))},e(t.wrapper)&&(r>2*n?t.content.height(r):t.content.height(2*n+1)))},_averageRowHeight:function(){var e,t=this,a=t._rowHeight;return t._rowHeight||(t._rowHeight=a=t.table.outerHeight()/t.items().length,t._sum=a,t._measures=1),e=t.table.outerHeight()/t.items().length,a!==e&&(t._measures++,t._sum+=e,t._rowHeight=t._sum/t._measures),a},_dataSource:function(){var e,a=this,r=a.options,i=r.dataSource;i=A(i)?{data:i}:i,H(i)&&(R(i,{table:a.table,fields:a.columns}),e=r.pageable,H(e)&&e.pageSize!==t&&(i.pageSize=e.pageSize)),a.dataSource&&a._refreshHandler?a.dataSource.unbind(Y,a._refreshHandler).unbind(F,a._progressHandler).unbind(L,a._errorHandler):(a._refreshHandler=W(a.refresh,a),a._progressHandler=W(a._requestStart,a),a._errorHandler=W(a._error,a)),a.dataSource=w.create(i).bind(Y,a._refreshHandler).bind(F,a._progressHandler).bind(L,a._errorHandler)},_error:function(){this._progress(!1)},_requestStart:function(){this._progress(!0)},_modelChange:function(t){var a,r,i,n,o=this,l=t.model,s=o.tbody.find("tr["+_.attr("uid")+"="+l.uid+"]"),d=s.hasClass("k-alt"),c=o.items().index(s);if(s.children(".k-edit-cell").length&&!o.options.rowTemplate)s.children(":not(.k-group-cell,.k-hierarchy-cell)").each(function(){a=e(this),r=o.columns[o.cellIndex(a)],r.field===t.field&&(a.hasClass("k-edit-cell")?a.addClass("k-dirty-cell"):(o._displayCell(a,r,l),e('<span class="k-dirty"/>').prependTo(a)))});else if(!s.hasClass("k-grid-edit-row")){for(i=(d?o.altRowTemplate:o.rowTemplate)(l),s.replaceWith(i),i=o.items().eq(c),c=0,n=o.columns.length;n>c;c++)r=o.columns[c],r.field===t.field&&(a=i.children(":not(.k-group-cell,.k-hierarchy-cell)").eq(c),e('<span class="k-dirty"/>').prependTo(a));o.trigger("itemChange",{item:i,data:l,ns:v})}},_pageable:function(){var t,a=this,r=a.options.pageable;r&&(t=a.wrapper.children("div.k-grid-pager"),t.length||(t=e('<div class="k-pager-wrap k-grid-pager"/>').appendTo(a.wrapper)),a.pager&&a.pager.destroy(),a.pager="object"==typeof r&&r instanceof _.ui.Pager?r:new _.ui.Pager(t,R({},r,{dataSource:a.dataSource})))},_footer:function(){var t,a,r=this,i=r.dataSource.aggregates(),n="",l=r.footerTemplate,s=r.options,d=r.footer||r.wrapper.find(".k-grid-footer");l?(i=M(i)?o(r.dataSource.aggregate()):i,n=e(r._wrapFooter(l(i))),d.length?(a=n,d.replaceWith(a),d=r.footer=a):d=r.footer=s.scrollable?s.pageable?n.insertBefore(r.wrapper.children("div.k-grid-pager")):n.appendTo(r.wrapper):n.insertBefore(r.tbody)):d&&!r.footer&&(r.footer=d),d.length&&(s.scrollable&&(t=d.attr("tabindex",-1).children(".k-grid-footer-wrap"),r.scrollables=r.scrollables.not(".k-grid-footer-wrap").add(t)),r._footerWidth&&d.find("table").css("width",r._footerWidth),t&&t.scrollLeft(r.content.scrollLeft()))},_wrapFooter:function(t){var a=this,r="",i=_.support.mobileOS?0:_.support.scrollbar();return a.options.scrollable?(r=e('<div class="k-grid-footer"><div class="k-grid-footer-wrap"><table'+(Tt?' cellspacing="0"':"")+"><tbody>"+t+"</tbody></table></div></div>"),a._appendCols(r.find("table")),r.css(Ct?"padding-left":"padding-right",i),r):'<tfoot class="k-grid-footer">'+t+"</tfoot>"},_columnMenu:function(){var t,a,r,i,n,o,l=this,s=l.columns,d=l.options,c=d.columnMenu,p=this._isMobile,u=function(){b(l.thead.parent(),!0)},h=function(e){l.trigger(Q,{field:e.field,container:e.container})};c&&("boolean"==typeof c&&(c={}),l.thead.find("th:not(.k-hierarchy-cell,.k-group-cell)").each(function(f){a=s[f],o=e(this),a.command||!a.field&&!o.attr("data-"+_.ns+"field")||(t=o.data("kendoColumnMenu"),t&&t.destroy(),i=a.sortable!==!1&&c.sortable!==!1?d.sortable:!1,n=d.filterable&&a.filterable!==!1&&c.filterable!==!1?R({pane:l.pane},a.filterable,d.filterable):!1,r={dataSource:l.dataSource,values:a.values,columns:c.columns,sortable:i,filterable:n,messages:c.messages,owner:l,closeCallback:u,init:h,pane:l.pane,filter:p?":not(.k-column-active)":""},o.kendoColumnMenu(r))}))},_filterable:function(){var t,a,r=this,i=r.columns,n=function(){b(r.thead.parent(),!0)},o=r.options.filterable;o&&!r.options.columnMenu&&r.thead.find("th:not(.k-hierarchy-cell,.k-group-cell)").each(function(l){var s,d;t=e(this),i[l].filterable===!1||i[l].command||!i[l].field&&!t.attr("data-"+_.ns+"field")||(a=t.data("kendoFilterMenu"),a&&a.destroy(),s=i[l].filterable,d=R({},o,s,{dataSource:r.dataSource,values:i[l].values,closeCallback:n,init:function(e){r.trigger(X,{field:e.field,container:e.container})},pane:r.pane}),s&&s.messages&&(d.messages=R(!0,{},o.messages,s.messages)),t.kendoFilterMenu(d))})},_sortable:function(){var t,a,r,i=this,n=i.columns,o=i.options.sortable;o&&i.thead.find("th:not(.k-hierarchy-cell,.k-group-cell)").each(function(l){t=n[l],t.sortable!==!1&&!t.command&&t.field&&(a=e(this),r=a.data("kendoSortable"),r&&r.destroy(),a.attr("data-"+_.ns+"field",t.field).kendoSortable(R({},o,t.sortable,{dataSource:i.dataSource,aria:!0,filter:":not(.k-column-active)"})))})},_columns:function(t){var a,r=this,i=r.table,n=i.find("col"),o=r.options.dataSource;t=t.length?t:D(i.find("th"),function(t,a){t=e(t);var r=t.attr(_.attr("sortable")),i=t.attr(_.attr("filterable")),o=t.attr(_.attr("type")),l=t.attr(_.attr("groupable")),s=t.attr(_.attr("field")),d=t.attr(_.attr("menu"));return s||(s=t.text().replace(/\s|[^A-z0-9]/g,"")),{field:s,type:o,sortable:"false"!==r,filterable:"false"!==i,groupable:"false"!==l,menu:d,template:t.attr(_.attr("template")),width:n.eq(a).css("width")}}),a=!(r.table.find("tbody tr").length>0&&(!o||!o.transport)),r.columns=D(t,function(e){return e=typeof e===ht?{field:e}:e,e.hidden&&(e.attributes=c(e.attributes),e.footerAttributes=c(e.footerAttributes),e.headerAttributes=c(e.headerAttributes)),R({encoded:a},e)})},_groups:function(){var e=this.dataSource.group();return e?e.length:0},_tmpl:function(e,t){var i,n,o,l,s=this,d=R({},_.Template,s.options.templateSettings),c=s.columns.length,p={storage:{},count:0},u=s._hasDetails(),h=[],f=s._groups();if(!e){for(e="<tr",t&&h.push("k-alt"),u&&h.push("k-master-row"),h.length&&(e+=' class="'+h.join(" ")+'"'),c&&(e+=" "+_.attr("uid")+'="#='+_.expr("uid",d.paramName)+'#"'),e+=" role='row'>",f>0&&(e+=a(f)),u&&(e+='<td class="k-hierarchy-cell"><a class="k-icon k-plus" href="\\#" tabindex="-1"></a></td>'),i=0;c>i;i++)o=s.columns[i],n=o.template,l=typeof n,e+="<td"+r(o.attributes)+" role='gridcell'>",e+=s._cellTmpl(o,p),e+="</td>";e+="</tr>"}return e=_.template(e,d),p.count>0?W(e,p.storage):e},_headerCellText:function(e){var t=this,a=R({},_.Template,t.options.templateSettings),r=e.headerTemplate,i=typeof r,n=e.title||e.field||"";return i===ut?n=_.template(r,a)({}):i===ht&&(n=r),n},_cellTmpl:function(e,t){var a,r,i=this,n=R({},_.Template,i.options.templateSettings),o=e.template,l=n.paramName,s=e.field,d="",c=e.format,p=typeof o,u=e.values;if(e.command){if(A(e.command)){for(a=0,r=e.command.length;r>a;a++)d+=i._createButton(e.command[a]);return d.replace(kt,"\\#")}return i._createButton(e.command).replace(kt,"\\#")}return p===ut?(t.storage["tmpl"+t.count]=o,d+="#=this.tmpl"+t.count+"("+l+")#",t.count++):p===ht?d+=o:u&&u.length&&H(u[0])&&"value"in u[0]&&s?(d+="#var v ="+_.stringify(h(u))+"#",d+="#var f = v[",n.useWithBlock||(d+=l+"."),d+=s+"]#",d+="${f != null ? f : ''}"):(d+=e.encoded?"#:":"#=",c&&(d+='kendo.format("'+c.replace(bt,"\\$1")+'",'),s?(s=_.expr(s,l),d+=s+"==null?'':"+s):d+="''",c&&(d+=")"),d+="#"),d},_templates:function(){var t=this,a=t.options,r=t.dataSource,i=r.group(),n=t.footer||t.wrapper.find(".k-grid-footer"),o=r.aggregate();t.rowTemplate=t._tmpl(a.rowTemplate),t.altRowTemplate=t._tmpl(a.altRowTemplate||a.rowTemplate,!0),t._hasDetails()&&(t.detailTemplate=t._detailTmpl(a.detailTemplate||"")),(t._group&&!M(o)||!M(o)&&!n.length||z(t.columns,function(e){return e.footerTemplate}).length)&&(t.footerTemplate=t._footerTmpl(o,"footerTemplate","k-footer-template")),i&&z(t.columns,function(e){return e.groupFooterTemplate}).length&&(o=e.map(i,function(e){return e.aggregates}),t.groupFooterTemplate=t._footerTmpl(o,"groupFooterTemplate","k-group-footer"))},_footerTmpl:function(e,t,i){var n,l,s,d,c,p=this,u=R({},_.Template,p.options.templateSettings),h=u.paramName,f="",g=p.columns,m={},b=0,k={},v=p._groups(),w=o(e);for(f+='<tr class="'+i+'">',v>0&&(f+=a(v)),p._hasDetails()&&(f+='<td class="k-hierarchy-cell">&nbsp;</td>'),n=0,l=p.columns.length;l>n;n++)c=g[n],s=c[t],d=typeof s,f+="<td"+r(c.footerAttributes)+">",s?(d!==ut&&(k=w[c.field]?R({},u,{paramName:h+"."+c.field}):{},s=_.template(s,k)),m["tmpl"+b]=s,f+="#=this.tmpl"+b+"("+h+")#",b++):f+="&nbsp;",f+="</td>";return f+="</tr>",f=_.template(f,u),b>0?W(f,m):f},_detailTmpl:function(e){var t=this,r="",i=R({},_.Template,t.options.templateSettings),n=i.paramName,o={},l=0,s=t._groups(),c=d(t.columns).length,p=typeof e;return r+='<tr class="k-detail-row">',s>0&&(r+=a(s)),r+='<td class="k-hierarchy-cell"></td><td class="k-detail-cell"'+(c?' colspan="'+c+'"':"")+">",p===ut?(o["tmpl"+l]=e,r+="#=this.tmpl"+l+"("+n+")#",l++):r+=e,r+="</td></tr>",r=_.template(r,i),l>0?W(r,o):r},_hasDetails:function(){var e=this;return null!==e.options.detailTemplate||(e._events[J]||[]).length},_details:function(){var t=this;t.table.on(dt+U,".k-hierarchy-cell .k-plus, .k-hierarchy-cell .k-minus",function(a){var r,i,n=e(this),o=n.hasClass("k-plus"),l=n.closest("tr.k-master-row"),s=t.detailTemplate,d=t._hasDetails();return n.toggleClass("k-plus",!o).toggleClass("k-minus",o),d&&!l.next().hasClass("k-detail-row")&&(i=t.dataItem(l),e(s(i)).addClass(l.hasClass("k-alt")?"k-alt":"").insertAfter(l),t.trigger(J,{masterRow:l,detailRow:l.next(),data:i,detailCell:l.next().find(".k-detail-cell")})),r=l.next(),t.trigger(o?rt:it,{masterRow:l,detailRow:r}),r.toggle(o),t._current&&t._current.attr("aria-expanded",o),a.preventDefault(),!1})},dataItem:function(t){if(t=e(t)[0],!t)return null;var a,r,i=this.tbody.children(),n=/k-grouping-row|k-detail-row|k-group-footer/,o=t.sectionRowIndex;for(r=o,a=0;o>a;a++)n.test(i[a].className)&&r--;return this._data[r]},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()},_thead:function(){var a,i,n,o,l,s=this,d=s.columns,c=s._hasDetails()&&d.length,p="",u=s.table.find(">thead");if(u.length||(u=e("<thead/>").insertBefore(s.tbody)),n=s.element.find("tr:has(th):first"),n.length||(n=u.children().first(),n.length||(n=e("<tr/>"))),n.children().length)c&&!n.find(".k-hierarchy-cell")[0]&&n.prepend('<th class="k-hierarchy-cell">&nbsp;</th>');else{for(c&&(p+='<th class="k-hierarchy-cell">&nbsp;</th>'),a=0,i=d.length;i>a;a++)l=d[a],o=s._headerCellText(l),l.command?p+="<th"+r(l.headerAttributes)+">"+o+"</th>":(p+="<th role='columnheader' "+_.attr("field")+"='"+(l.field||"")+"' ",l.title&&(p+=_.attr("title")+'="'+l.title.replace(/'/g,"'")+'" '),l.groupable!==t&&(p+=_.attr("groupable")+"='"+l.groupable+"' "),l.aggregates&&(p+=_.attr("aggregates")+"='"+l.aggregates+"'"),p+=r(l.headerAttributes),p+=">"+o+"</th>");n.html(p)}n.find("th").addClass("k-header"),s.options.scrollable||u.addClass("k-grid-header"),n.find("script").remove().end().appendTo(u),s.thead&&s._destroyColumnAttachments(),s.thead=u,s._sortable(),s._filterable(),s._scrollable(),s._updateCols(),s._resizable(),s._draggable(),s._reorderable(),s.groupable&&s._attachGroupable(),s._columnMenu()},_updateCols:function(){var e=this;e._appendCols(e.thead.parent().add(e.table))},_appendCols:function(e){var t=this;u(e,d(t.columns),t._hasDetails(),t._groups())},_autoColumns:function(e){if(e&&e.toJSON){var t,a=this;e=e.toJSON();for(t in e)a.columns.push({field:t});a._thead(),a._templates()}},_rowsHtml:function(e){var t,a,r=this,i="",n=r.rowTemplate,o=r.altRowTemplate;for(t=0,a=e.length;a>t;t++)i+=t%2?o(e[t]):n(e[t]),r._data.push(e[t]);return i},_groupRowHtml:function(e,t,r){var i,n,o=this,l="",s=e.field,d=z(o.columns,function(e){return e.field==s})[0]||{},c=d.groupHeaderTemplate,p=(d.title||s)+": "+f(e.value,d.format,d.values),u=R({},{field:e.field,value:e.value},e.aggregates[e.field]),h=o._groupAggregatesDefaultObject||{},g=e.items;if(c&&(p=typeof c===ut?c(u):_.template(c)(u)),l+='<tr class="k-grouping-row">'+a(r)+'<td colspan="'+t+'" aria-expanded="true">'+'<p class="k-reset">'+'<a class="k-icon k-i-collapse" href="#" tabindex="-1"></a>'+p+"</p></td></tr>",e.hasSubgroups)for(i=0,n=g.length;n>i;i++)l+=o._groupRowHtml(g[i],t-1,r+1);else l+=o._rowsHtml(g);return o.groupFooterTemplate&&(l+=o.groupFooterTemplate(R(h,e.aggregates))),l},collapseGroup:function(a){a=e(a).find(".k-icon").addClass("k-i-expand").removeClass("k-i-collapse").end();var r,i,n=a.find(".k-group-cell").length,o=1;a.find("td:first").attr("aria-expanded",!1),a.nextAll("tr").each(function(){return i=e(this),r=i.find(".k-group-cell").length,i.hasClass("k-grouping-row")?o++:i.hasClass("k-group-footer")&&o--,n>=r||i.hasClass("k-group-footer")&&0>o?!1:(i.hide(),t)})},expandGroup:function(a){a=e(a).find(".k-icon").addClass("k-i-collapse").removeClass("k-i-expand").end();var r,i,n=this,o=a.find(".k-group-cell").length,l=1;a.find("td:first").attr("aria-expanded",!0),a.nextAll("tr").each(function(){return r=e(this),i=r.find(".k-group-cell").length,o>=i?!1:(i!=o+1||r.hasClass("k-detail-row")||(r.show(),r.hasClass("k-grouping-row")&&r.find(".k-icon").hasClass("k-i-collapse")&&n.expandGroup(r),r.hasClass("k-master-row")&&r.find(".k-icon").hasClass("k-minus")&&r.next().show()),r.hasClass("k-grouping-row")&&l++,r.hasClass("k-group-footer")&&(1==l?r.show():l--),t)})},_updateHeader:function(t){var a=this,r=a.thead.find("th.k-group-cell"),i=r.length;t>i?e(Array(t-i+1).join('<th class="k-group-cell k-header">&nbsp;</th>')).prependTo(a.thead.find("tr")):i>t&&(i-=t,e(z(r,function(e,t){return i>t})).remove())},_firstDataItem:function(e,t){return e&&t&&(e=e.hasSubgroups?this._firstDataItem(e.items[0],t):e.items[0]),e},hideColumn:function(t){var a,r,i,n,o,l,s,p,u,h=this,f=0,m=h.footer||h.wrapper.find(".k-grid-footer"),b=h.columns;if(t="number"==typeof t?b[t]:z(b,function(e){return e.field===t})[0],t&&!t.hidden){for(u=E(t,d(b)),t.hidden=!0,t.attributes=c(t.attributes),t.footerAttributes=c(t.footerAttributes),t.headerAttributes=c(t.headerAttributes),h._templates(),h._updateCols(),g(h.thead.find(">tr")[0].cells,u,!1),m[0]&&(h._appendCols(m.find("table:first")),g(m.find(".k-footer-template")[0].cells,u,!1)),a=h.tbody.children(),o=0,p=a.length;p>o;o+=1)r=a.eq(o),r.is(".k-grouping-row,.k-detail-row")?(i=r.children(":not(.k-group-cell):first,.k-detail-cell").last(),i.attr("colspan",parseInt(i.attr("colspan"),10)-1)):(r.hasClass("k-grid-edit-row")&&(i=r.children(".k-edit-container")[0])&&(i=e(i),i.attr("colspan",parseInt(i.attr("colspan"),10)-1),i.find("col").eq(u).remove(),r=i.find("tr:first")),g(r[0].cells,u,!1));for(l=h.thead.prev().find("col"),o=0,p=l.length;p>o;o+=1){if(s=l[o].style.width,!s||-1!=s.indexOf("%")){f=0;break}f+=parseInt(s,10)}n=e(">.k-grid-header table:first,>.k-grid-footer table:first",h.wrapper).add(h.table),h._footerWidth=null,f&&(n.width(f),h._footerWidth=f),yt.msie&&8==yt.version&&(n.css("display","inline-table"),setTimeout(function(){n.css("display","table")},1)),h.trigger(Z,{column:t})}},showColumn:function(t){var a,r,i,n,o,l,s,c,h,f,m=this,b=m.columns,k=m.footer||m.wrapper.find(".k-grid-footer");if(t="number"==typeof t?b[t]:z(b,function(e){return e.field===t})[0],t&&t.hidden){for(f=E(t,b),t.hidden=!1,t.attributes=p(t.attributes),t.footerAttributes=p(t.footerAttributes),t.headerAttributes=p(t.headerAttributes),m._templates(),m._updateCols(),g(m.thead.find(">tr")[0].cells,f,!0),k[0]&&(m._appendCols(k.find("table:first")),g(k.find(".k-footer-template")[0].cells,f,!0)),a=m.tbody.children(),r=0,i=a.length;i>r;r+=1)n=a.eq(r),n.is(".k-grouping-row,.k-detail-row")?(o=n.children(":not(.k-group-cell):first,.k-detail-cell").last(),o.attr("colspan",parseInt(o.attr("colspan"),10)+1)):(n.hasClass("k-grid-edit-row")&&(o=n.children(".k-edit-container")[0])&&(o=e(o),o.attr("colspan",parseInt(o.attr("colspan"),10)+1),u(o.find(">form>table"),d(b),!1,0),n=o.find("tr:first")),g(n[0].cells,f,!0));if(l=e(">.k-grid-header table:first,>.k-grid-footer table:first",m.wrapper).add(m.table),t.width){for(s=0,h=m.thead.prev().find("col"),r=0,i=h.length;i>r;r+=1){if(c=h[r].style.width,c.indexOf("%")>-1){s=0;break}s+=parseInt(c,10)}m._footerWidth=null,s&&(l.width(s),m._footerWidth=s)}else l.width("");m.trigger(et,{column:t})}},_progress:function(e){var t=this,a=t.element.is("table")?t.element.parent():t.content&&t.content.length?t.content:t.element;_.ui.progress(a,e)},_resize:function(){this.content&&(this._setContentHeight(),this._setContentWidth())},refresh:function(t){var a,r,i,n,l,s,c=this,p="",u=c.dataSource.view(),h=c.options.navigatable,f=e(c.current()),g=!1,m=(c.dataSource.group()||[]).length,k=m+d(c.columns).length;if(!(t&&"itemchange"===t.action&&c.editable||(t=t||{},c.trigger("dataBinding",{action:t.action||"rebind",index:t.index,items:t.items})))){if(s=T(),h&&(c.table[0]===s||e.contains(c.table[0],s)||c._editContainer&&c._editContainer.data("kendoWindow"))&&(g=f.is("th"),l=0,g&&(l=c.thead.find("th:not(.k-group-cell)").index(f))),c._destroyEditable(),c._progress(!1),c._hideResizeHandle(),c._data=[],c.columns.length||(c._autoColumns(c._firstDataItem(u[0],m)),k=m+c.columns.length),c._group=m>0||c._group,c._group&&(c._templates(),c._updateCols(),c._updateHeader(m),c._group=m>0),m>0)for(c.detailTemplate&&k++,c.groupFooterTemplate&&(c._groupAggregatesDefaultObject=o(c.dataSource.aggregate())),r=0,a=u.length;a>r;r++)p+=c._groupRowHtml(u[r],k,0);else p+=c._rowsHtml(u);y?c.tbody[0].innerHTML=p:(n=document.createElement("div"),n.innerHTML="<table><tbody>"+p+"</tbody></table>",i=n.firstChild.firstChild,c.table[0].replaceChild(i,c.tbody[0]),c.tbody=e(i)),c._footer(),c._setContentHeight(),c._setContentWidth(),l>=0&&(c._removeCurrent(),g?c.current(c.thead.find("th:not(.k-group-cell)").eq(l)):c.current(c.items().eq(l).children().filter(B).first()),c._current&&b(c._current.closest("table")[0],!0)),c.trigger(at)}}});v.plugin(Rt),v.plugin(St)}(window.kendo.jQuery)})}("function"==typeof define&&define.amd?define:function(e,t){return t()});/*
  //@ sourceMappingURL=kendo.grid.min.js.map
  */