/**
* Kendo UI v2016.3.914 (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(t,define){define("kendo.scheduler.timelineview.min",["kendo.scheduler.view.min"],t)}(function(){return function(t,e){function n(t){var e=new Date(1980,1,1,0,0,0);return u(e,p(t)),e}function i(t){var e=[],n=t.workWeekStart;for(e.push(n);t.workWeekEnd!=n;)n>6?n-=7:n++,e.push(n);return e}function o(t){var e,n=0;if(t.columns){for(e=0;t.columns.length>e;e++)n+=o(t.columns[e]);return t.colspan=n,n}return t.colspan=1,1}function r(t,e,n){var i,o,r,a;for(i=t.length-1;i>=0;i--)o=t[i].rectLeft,a=t[i].rectRight,r=e>=o&&a>=e,(r||o>=e&&n>=a||o>=e&&n>=o)&&(e>o&&(e=o),a>n&&(n=a));return s(t,e,n)}function s(t,e,n){var i,o,r=[];for(i=0;t.length>i;i++)o={rectLeft:t[i].rectLeft,rectRight:t[i].rectRight},(e>o.rectLeft&&o.rectRight>e||o.rectLeft>=e&&n>=o.rectRight)&&r.push(t[i]);return r}var a,l=window.kendo,d=l.ui,u=l.date.setTime,c=d.SchedulerView,h=t.extend,f=t.proxy,_=l.date.getDate,p=l.date.getMilliseconds,v=l.date.MS_PER_DAY,g=l.date.MS_PER_MINUTE,m="k-current-time",w="k-current-time-arrow",T="k-scheduler-header-wrap",k=.8666,D=".kendoTimelineView",y=l.template('
#:kendo.format("{0:t} - {1:t}", start, end)#
${title}
'),S=l.template("#=kendo.format('{0:m}', date)#"),C='# if(data.tail) {##}## if(data.isException()) {## } else if(data.isRecurring()) {## } #{0}
#if (showDelete) {##}## if(data.head) {##}##if(resizable && !data.tail){#
#}##if(resizable && !data.head){#
#}#
',V=l.Class.extend({init:function(t){this._view=t},_getTimeSlotByPosition:function(t,e,n){var i=this._view.groups[n];return i.timeSlotByPosition(t,e)},_hideHeaders:function(){var t=this._view;t.timesHeader.find("table tr:last").hide(),t.datesHeader.find("table tr:last").hide()},_setColspan:function(t){o(t)},_createRowsLayout:function(t,e,n){var i=this._view;return i._createRowsLayout(t,e,n)},_createVerticalColumnsLayout:function(t,e,n,i){return i},_createColumnsLayout:function(t,e,n){var i=this._view;return i._createColumnsLayout(t,e,n)},_getRowCount:function(){var t=this._view;return t._groupCount()},_getGroupsCount:function(){return 1},_addContent:function(t,e,n,i,o,r,s,a){var d,u,c,h,f=this._view,_="",p=f.options,v=function(e){var n,i="",o="",r=function(t){return function(){return f._resourceBySlot({groupIndex:t})}};return l.date.isToday(t[c])&&(o+="k-today"),(l.date.getMilliseconds(e)=l.date.getMilliseconds(p.workDayEnd)||!f._isWorkDay(t[c]))&&(o+=" k-nonwork-hour"),i+="",n=l.date.getDate(t[c]),l.date.setTime(n,l.date.getMilliseconds(e)),i+=s({date:n,resources:r(a?d:u)}),i+=" | "};for(d=0;i>d;d++){for(_+="",u=0;n>u;u++)for(c=0,h=e;h>c;c++)_+=f._forTimeRange(o,r,v);_+="
"}return _},_addTimeSlotsCollections:function(t,e,n,i,o){var r,s,a,l,d,u,c,h,f,_,v,g,m=this._view,w=n.length;for(o&&(w=Math.floor(w/t)),r=0;t>r;r++)for(s=0,a=m.groups[r],o&&(s=r),d=s*w,u=0,o||(u=r),c=n[d].children,h=c.length/(o?1:t),f=h/e,_=0;e>_;_++)for(v=_*f+h*u,l=p(new Date(+m.startTime())),g=0;f>g;g++)m._addTimeSlotToCollection(a,c,g,v,_,l,i),l+=i},_getVerticalGroupCount:function(t){return t},_getVerticalRowCount:function(t,e,n){var i=this._view;return i._isVerticallyGrouped()?t[e].maxRowCount:n},_renderEvent:function(t,e,n,i,o,r){var s,a=this._view,l=a._createEventElement(n.occurrence,e,o.head||n.head,o.tail||n.tail);l.appendTo(r).css({top:0,height:a.options.eventHeight}),s={start:n.occurrence._startTime||n.occurrence.start,end:n.occurrence._endTime||n.occurrence.end,element:l,uid:e.uid,slotRange:o,rowIndex:0,offsetTop:0},t.events[e.uid]=s,a.addContinuousEvent(i,o,l,e.isAllDay),a._arrangeRows(s,o,t)},_verticalCountForLevel:function(t){var e=this._view;return e._rowCountForLevel(t)},_horizontalCountForLevel:function(t){var e=this._view;return e._columnCountForLevel(t)},_updateCurrentVerticalTimeMarker:function(e,n){var i=this._view,o="",r=i.datesHeader.find("."+T),s=Math.round(e[0].innerRect(n,new Date(n.getTime()+1),!1).left),a=t(o).prependTo(r).addClass(w+"-down");a.css({left:i._adjustLeftPosition(s-a.outerWidth()*k/2),top:r.find("tr:last").prev().position().top}),t(o).prependTo(i.content).css({left:i._adjustLeftPosition(s),width:"1px",height:i.content[0].scrollHeight-1,top:0})},_changeGroup:function(){return e},_prevGroupSlot:function(t,e,n){var i,o=this._view;return o._isVerticallyGrouped()?t:(i=e._collection(0,n),i.last())},_nextGroupSlot:function(t,e,n){var i,o=this._view;return o._isVerticallyGrouped()?t:(i=e._collection(0,n),i.first())},_verticalSlots:function(t,e){var n=this._view;return n._changeGroup(t,e)},_verticalMethod:function(t){return t?"leftSlot":"rightSlot"},_normalizeVerticalSelection:function(){return e},_horizontalSlots:function(t,e,n,i,o,r,s){var a=this._view,l={};return l.startSlot=e[n](i),l.endSlot=e[n](o),r||!a._isHorizontallyGrouped()||l.startSlot&&l.endSlot||(l.startSlot=l.endSlot=a._changeGroup(t,s)),l},_changeVerticalViewPeriod:function(){return!1},_changeHorizontalViewPeriod:function(t,e,n,i){var o=this._view;return!(t.startSlot&&t.endSlot||e)&&o._changeViewPeriod(n,i,!1)},_updateDirection:function(t,e,n,i){var o=this._view;o._updateDirection(t,e,n,i,!0)},_createMoveHint:function(t,e){var n,i,o,r,s=this._view,a=t.start,l=s._createEventElement(e.occurrence,e.occurrence,!1,!1);l.addClass("k-event-drag-hint"),n=t.innerRect(e.occurrence.start,e.occurrence.end,s.options.snap),i=n.right-n.left-2,0>i&&(i=0),o=s._adjustLeftPosition(n.left),r={left:o,top:a.offsetTop,height:a.offsetHeight-2,width:i},l.css(r),s._moveHint=s._moveHint.add(l)},_adjustLeftPosition:function(t){var e=this._view;return e._isRtl&&(t-=e.content[0].scrollWidth-e.content[0].offsetWidth),t}}),x=l.Class.extend({init:function(t){this._view=t},_getTimeSlotByPosition:function(t,e,n){var i=this._view.groups[n];return i.timeSlotByPosition(t,e,!0)},_hideHeaders:function(){var t=this._view;t._isVerticallyGrouped()?t.times.find(".k-last").hide():(t.timesHeader.find("table tr").eq(2).hide(),t.datesHeader.find("table tr").eq(2).hide())},_setColspan:function(){},_createRowsLayout:function(t,e,n,i){var o=this._view;return o._createDateLayout(i,null,!0)},_createVerticalColumnsLayout:function(t,e,n){var i=this._view;return i._createColumnsLayout(t,null,n)},_createColumnsLayout:function(t,e,n,i){var o=this._view;return o._createColumnsLayout(t,e,n,i,!0)},_getRowCount:function(t){var e=this._view;return e._rowCountForLevel(t)},_getGroupsCount:function(){var t=this._view;return t._groupCount()},_addContent:function(t,e,n,i,o,r,s,a){var d,c,h,f,_=this._view,p="",v=_.options,m=function(e,n,i,o,r,a){var u,c="",f="",p=_._isVerticallyGrouped()?d:h,g=function(t){return function(){return _._resourceBySlot({groupIndex:t})}};return l.date.isToday(t[h])&&(f+="k-today"),(l.date.getMilliseconds(e)=l.date.getMilliseconds(v.workDayEnd)||!_._isWorkDay(t[p]))&&(f+=" k-nonwork-hour"),c+="",u=l.date.getDate(t[h]),l.date.setTime(u,l.date.getMilliseconds(e)),c+=s({date:u,resources:g(a)}),c+=" | "},w=new Date(o),T=_.options.minorTickCount,k=_.options.majorTick*g,D=k/T||1;for(c=0;i>c;c++){for(p+="",c%(i/_._dates.length)===0&&(d=c/(i/_._dates.length),w=new Date(_._dates[d]),l.date.setTime(w,l.date.getMilliseconds(o))),h=0,f=e;f>h;h++)if(p+=_._forTimeRange(w,r,m,a,n),a){u(w,D,!1);break}p+="
"}return p},_addTimeSlotsCollections:function(t,e,n,i,o){var r,s,a,l,d,u,c,h,f,_,v,g,m=this._view,w=n.length;for(o&&(w/=e),r=0;e>r;r++)for(s=0,o&&(s=r),l=s*w,d=0,u=n[l].children,c=o?w:u.length/(e*t),h=u.length/e,a=p(new Date(+m.startTime())),_=0;c>_;_++){for(o?(f=0,u=n[_+c*r].children):(f=r*h+t*_,d++),v=0;t>v;v++)g=m.groups[v],m._addTimeSlotToCollection(g,u,v,f,r,a,i);a+=i}},_getVerticalGroupCount:function(){var t=this._view;return t.content.find("tr").length},_getVerticalRowCount:function(t,e,n){return n},_renderEvent:function(t,e,n,i,o,r,s,a){var l,d,u,c,h,f=this._view,_=[];for(d=o.start.index;o.end.index>=d;d++)l=f._createEventElement(n.occurrence,e,d!==a,d!==s),l.appendTo(r).css({top:0,height:f.options.eventHeight}),u=i._timeSlotCollections[0]._slots[d],c=i.timeSlotRanges(u.start,u.end,!1)[0],h={start:d===s?n.occurrence._startTime||n.occurrence.start:u.start,end:d===a?n.occurrence._endTime||n.occurrence.end:u.end,element:l,uid:e.uid,slotRange:c,rowIndex:0,offsetTop:0},t.events[e.uid]=h,_.push(h),f.addContinuousEvent(i,c,l,e.isAllDay),f._arrangeRows(h,c,t);t.events[e.uid]=_},_verticalCountForLevel:function(t){var e=this._view;return e._columnCountForLevel(t)},_horizontalCountForLevel:function(t,e){var n=this._view;return n._columnCountForLevel(e)/n._columnCountForLevel(2)},_updateCurrentVerticalTimeMarker:function(e,n){var i=this._view,o=i.times.find("tr:first th:first"),r=i.times.find("tr:first th:last"),s="",a=t(s).prependTo(i.times),l=Math.round(e[0].innerRect(n,new Date(n.getTime()+1),!1).top),d={};this._isRtl?(d.right=o.position().left+o.outerHeight()-r.outerHeight(),a.addClass(w+"-left")):(d.left=r.position().left,a.addClass(w+"-right")),d.top=l-a.outerWidth()*k/2,a.css(d),t(s).prependTo(i.content).css({top:l,height:"1px",right:"1px",width:i.content[0].scrollWidth,left:0})},_changeGroup:function(t,e,n){var i=this._view;n||(t.groupIndex=e?i.groups.length-1:0)},_prevGroupSlot:function(t){return t},_nextGroupSlot:function(t){return t},_changeDate:function(t,e,n){var i,o,r=this._view,s=r.groups[t.groupIndex];if(e){if(i=s._getCollections(!1),o=n.index-1,o>=0)return i[0]._slots[o]}else if(i=s._getCollections(!1),o=n.index+1,i[0]&&i[0]._slots[o])return i[0]._slots[o]},_verticalSlots:function(t,e,n){return this._changeDate(t,e,n)},_verticalMethod:function(t,e){return e?t?"upSlot":"downSlot":t?"leftSlot":"rightSlot"},_normalizeVerticalSelection:function(t,n,i,o){var r=this._view;return o?e:r._normalizeVerticalSelection(t,n,i)},_horizontalSlots:function(t,e,n,i,o,r,s){var a=this._view,l=a._changeGroup(t,s),d={};return l?d.startSlot=d.endSlot=l:a._isVerticallyGrouped()||(d.startSlot=e[n](i),d.endSlot=e[n](o)),d},_changeVerticalViewPeriod:function(t,e,n,i){var o=this._view;return!(t.startSlot&&t.endSlot||e)&&o._changeViewPeriod(n,i,o._isVerticallyGrouped())},_changeHorizontalViewPeriod:function(t,e,n,i){var o=this._view;return o._isVerticallyGrouped()?!1:!(t.startSlot&&t.endSlot||e)&&o._changeViewPeriod(n,i,!1)},_updateDirection:function(t,e,n,i){var o=this._view;o._updateDirection(t,e,n,i,!o._isVerticallyGrouped())},_createMoveHint:function(t,e){var n,i,o,r,s=this._view,a=t.start,l=t.end;for(n=a.index;l.index>=n;n++)i=t.collection._slots[n],o=s._createEventElement(e.occurrence,e.occurrence,!1,!1),o.addClass("k-event-drag-hint"),r={left:i.offsetLeft+2,top:i.offsetTop,height:s.options.eventHeight,width:i.offsetWidth},o.css(r),s._moveHint=s._moveHint.add(o)},_adjustLeftPosition:function(t){var e=this._view;return e._isRtl&&!e._isVerticallyGrouped()&&(t-=e.content[0].scrollWidth-e.content[0].offsetWidth),t}});l.ui.scheduler.TimelineGroupedView=V,l.ui.scheduler.TimelineGroupedByDateView=x,a=c.extend({init:function(t,e){var n=this;c.fn.init.call(n,t,e),n._groupedView=n._getGroupedView(),n.title=n.options.title||n.options.name,n._workDays=i(n.options),n._templates(),n._editable(),n.calculateDateRange(),n._groups(),n._currentTime(!0)},name:"timeline",_getGroupedView:function(){return this._isGroupedByDate()?new l.ui.scheduler.TimelineGroupedByDateView(this):new l.ui.scheduler.TimelineGroupedView(this)},_getNextEventIndexBySlot:function(t,e,n){var i,o;if(this._isVerticallyGrouped())return l.ui.SchedulerView.fn._getNextEventIndexBySlot.call(this,t,e,n);for(i=0,o=0;e.length>o;o++)if(t.startDate()>e[o].start.startDate())i++;else{if(!(t.startDate().getTime()===e[o].start.startDate().getTime()&&n>e[o].start.groupIndex))break;i++}return i},_getSelectedSlot:function(t,e,n,i,o,r){return this._isVerticallyGrouped()?l.ui.SchedulerView.fn._getSelectedSlot.call(this,t,e,n,i,o,r):t},_getSortedEvents:function(e){return this._isVerticallyGrouped()?l.ui.SchedulerView.fn._getSortedEvents.call(this,e):e.sort(function(e,n){var i=e.start.startDate().getTime()-n.start.startDate().getTime();return 0===i&&(e.start.isDaySlot&&!n.start.isDaySlot&&(i=-1),!e.start.isDaySlot&&n.start.isDaySlot&&(i=1)),0===i&&(i=e.start.groupIndex-n.start.groupIndex),0===i&&(i=t(e.element).index()-t(n.element).index()),i})},_currentTimeMarkerUpdater:function(){this._updateCurrentTimeMarker(new Date)},_updateCurrentTimeMarker:function(e){var n,i,o,r,s,a,d,u,c,h,f,_,p,v=this.options;if(this.datesHeader.find("."+m).remove(),this.times.find("."+m).remove(),this.content.find("."+m).remove(),this._isInDateSlot({start:e,end:e}))for(v.currentTimeMarker.useLocalTimezone===!1&&(n=v.dataSource.options.schema.timezone,v.dataSource&&n&&(i=l.timezone.offset(e,n),e=l.timezone.convert(e,e.getTimezoneOffset(),i))),o=v.group&&"vertical"!=v.group.orientation?this.groups.length:1,r=0;o>r;r++){if(s=this.groups[r],!s)return;if(a=l.date.toUtcTime(e),d=s.timeSlotRanges(a,a+1),0===d.length)return;u=d[0].collection,c=u.slotByStartDate(e),c&&(this._isVerticallyGrouped()?this._groupedView._updateCurrentVerticalTimeMarker(d,e):(h="",f=this.datesHeader.find("."+T),_=Math.round(d[0].innerRect(e,new Date(e.getTime()+1),!1).left),p=t(h).prependTo(f).addClass(w+"-down"),p.css({left:this._adjustLeftPosition(_-p.outerWidth()*k/2),top:f.find("tr:last").prev().position().top}),t(h).prependTo(this.content).css({left:this._adjustLeftPosition(_),width:"1px",height:this.content[0].scrollHeight-1,top:0})))}},_adjustLeftPosition:function(t){return this._groupedView._adjustLeftPosition(t)},_currentTime:function(t){var n=this,i=n.options.currentTimeMarker;i!==!1&&i.updateInterval!==e&&(n._currentTimeMarkerUpdater(),t&&(n._currentTimeUpdateTimer=setInterval(f(this._currentTimeMarkerUpdater,n),i.updateInterval)))},_editable:function(){this.options.editable&&(this._isMobile()?this._touchEditable():this._mouseEditable())},_mouseEditable:function(){var e=this;e.element.on("click"+D,".k-event a:has(.k-si-close)",function(n){e.trigger("remove",{uid:t(this).closest(".k-event").attr(l.attr("uid"))}),n.preventDefault()}),e.options.editable.create!==!1&&e.element.on("dblclick"+D,".k-scheduler-content td",function(t){var n,i=e._slotByPosition(t.pageX,t.pageY);i&&(n=e._resourceBySlot(i),e.trigger("add",{eventInfo:h({start:i.startDate(),end:i.endDate()},n)})),t.preventDefault()}),e.options.editable.update!==!1&&e.element.on("dblclick"+D,".k-event",function(n){e.trigger("edit",{uid:t(this).closest(".k-event").attr(l.attr("uid"))}),n.preventDefault()})},_touchEditable:function(){var n=this,i=0;l.support.mobileOS.android&&(i=5),n.options.editable.create!==!1&&(n._addUserEvents=new l.UserEvents(n.element,{threshold:i,filter:".k-scheduler-content td",tap:function(t){var i,o=t.x.location!==e?t.x.location:t.x,r=t.y.location!==e?t.y.location:t.y,s=n._slotByPosition(o,r);s&&(i=n._resourceBySlot(s),n.trigger("add",{eventInfo:h({start:s.startDate(),end:s.endDate()},i)})),t.preventDefault()}})),n.options.editable.update!==!1&&(n._editUserEvents=new l.UserEvents(n.element,{threshold:i,filter:".k-event",tap:function(e){var i=t(e.target).closest(".k-event");i.hasClass("k-event-active")||n.trigger("edit",{uid:i.attr(l.attr("uid"))}),e.preventDefault()}}))},_slotByPosition:function(t,e){var n,i,o,r=this.content,s=r.offset();for(t-=s.left,e-=s.top,this._isRtl?(o=l.support.browser,o.mozilla?(t+=r[0].scrollWidth-r[0].offsetWidth,t+=r[0].scrollLeft):o.msie?(t-=r.scrollLeft(),t+=r[0].scrollWidth-r[0].offsetWidth):o.webkit&&(t+=r[0].scrollLeft)):t+=r[0].scrollLeft,e+=r[0].scrollTop,t=Math.ceil(t),e=Math.ceil(e),i=0;this.groups.length>i;i++)if(n=this._groupedView._getTimeSlotByPosition(t,e,i))return n;return null},options:{name:"TimelineView",title:"Timeline",selectedDateFormat:"{0:D}",selectedShortDateFormat:"{0:d}",date:l.date.today(),startTime:l.date.today(),endTime:l.date.today(),showWorkHours:!1,minorTickCount:2,editable:!0,workDayStart:new Date(1980,1,1,8,0,0),workDayEnd:new Date(1980,1,1,17,0,0),workWeekStart:1,workWeekEnd:5,majorTick:60,eventHeight:25,eventMinWidth:0,columnWidth:100,groupHeaderTemplate:"#=text#",majorTimeHeaderTemplate:"#=kendo.toString(date, 't')#",slotTemplate:" ",eventTemplate:y,dateHeaderTemplate:S,footer:{command:"workDay"},currentTimeMarker:{updateInterval:1e4,useLocalTimezone:!0},messages:{defaultRowText:"All events",showFullDay:"Show full day",showWorkDay:"Show business hours"}},events:["remove","add","edit"],_templates:function(){var t=this.options,e=h({},l.Template,t.templateSettings);this.eventTemplate=this._eventTmpl(t.eventTemplate,C),this.majorTimeHeaderTemplate=l.template(t.majorTimeHeaderTemplate,e),this.dateHeaderTemplate=l.template(t.dateHeaderTemplate,e),this.slotTemplate=l.template(t.slotTemplate,e),this.groupHeaderTemplate=l.template(t.groupHeaderTemplate,e)},_render:function(e){var n=this;e=e||[],n._dates=e,n._startDate=e[0],n._endDate=e[e.length-1||0],n._calculateSlotRanges(),n.createLayout(n._layout(e)),n._content(e),n._footer(),n._setContentWidth(),n.refreshLayout(),n.datesHeader.on("click"+D,".k-nav-day",function(e){var i=t(e.currentTarget).closest("th"),o=n._slotByPosition(i.offset().left,n.content.offset().top);n.trigger("navigate",{view:"timeline",date:o.startDate()})}),n._groupedView._hideHeaders()},_setContentWidth:function(){var t=this.content,e=t.width(),n=this.content.find("table"),i=n.find("tr:first").children().length,o=100,r=i*this.options.columnWidth;r>e&&(o=Math.ceil(r/e*100)),n.add(this.datesHeader.find("table")).css("width",o+"%")},_calculateSlotRanges:function(){var t,e,n,i,o=this._dates,r=this.startTime(),s=this.endTime();for(p(s)===p(l.date.getDate(s))&&(s=l.date.getDate(s),u(s,v-1)),s=p(s),r=p(r),t=[],e=0;o.length>e;e++)n=_(o[e]),u(n,r),i=_(o[e]),u(i,s),t.push({start:l.date.toUtcTime(n),end:l.date.toUtcTime(i)});this._slotRanges=t},_forTimeRange:function(t,e,i,o,r){var s,a,l,d,c,h,f,_,m,w,T,k,D,y,S,C,V,x;for(t=n(t),e=n(e),s=this,a=p(t),l=p(e),d=s.options.minorTickCount,c=s.options.majorTick*g,h=c/d||1,f=new Date(+t),_=f.getDate(),w=0,k="",T=v/h,a!=l&&(a>l&&(l+=v),T=(l-a)/h),T=o?1:Math.round(T),r&&(T*=r);T>w;w++)D=w%(c/h),y=0===D,S=d-1>D,C=D===d-1,V=d,T%d!==0&&(x=d>T-(w+1),y&&x&&(V=T%d)),k+=i(f,y,S,C,V,w%r),o||(r?w%r===r-1&&u(f,h,!1):u(f,h,!1));return l&&(m=p(f),_l&&(f=new Date(+e))),k},_layout:function(t){var e,n,i,o=[],r=[],s=this,a=[{text:s.options.messages.defaultRowText}],l=s._groupedView,d=[];for(e=0;s.options.minorTickCount>e;e++)d.push({text:"",className:"k-last",minorTicks:!0});for(this._forTimeRange(s.startTime(),s.endTime(),function(t,e,n,i,r){var a,u=s.majorTimeHeaderTemplate;e&&(a={text:u({date:t}),className:i?"k-slot-cell":"",columns:d.slice(0,r)},l._setColspan(a),o.push(a))}),n=0;t.length>n;n++)r.push({text:s.dateHeaderTemplate({date:t[n]}),className:"k-slot-cell",columns:o.slice(0)});return i=this.groupedResources,i.length&&("vertical"===this._groupOrientation()?(a=l._createRowsLayout(i,null,this.groupHeaderTemplate,r),r=l._createVerticalColumnsLayout(i,null,this.groupHeaderTemplate,r)):r=l._createColumnsLayout(i,r,this.groupHeaderTemplate,r)),{columns:r,rows:a}},_footer:function(){var e,n,i,o=this.options;o.footer!==!1&&(e='",this.footer=t(e).appendTo(this.element),i=this,this.footer.on("click"+D,".k-scheduler-fullday",function(t){t.preventDefault(),i.trigger("navigate",{view:i.name||o.name,date:i.startDate(),isWorkDay:!o.showWorkHours})}))},_columnCountForLevel:function(t){var e=this.columnLevels[t];return e?e.length:0},_rowCountForLevel:function(t){var e=this.rowLevels[t];return e?e.length:0},_isWorkDay:function(t){var e,n=t.getDay(),i=this._workDays;for(e=0;i.length>e;e++)if(i[e]===n)return!0;return!1},_content:function(t){var e=this,n=e.startTime(),i=this.endTime(),o=1,r=1,s=t.length,a="",l=this.groupedResources,d=this.slotTemplate,u=!1;l.length&&(u="vertical"===e._groupOrientation(),u?(r=e._groupedView._getRowCount(this.rowLevels.length-1),o=e._groupedView._getGroupsCount()):o=e._groupCount()),a+="",a+=e._groupedView._addContent(t,s,o,r,n,i,d,u),a+="",this.content.find("table").append(a)},_groups:function(){var t,e,n,i,o=this._groupCount(),r=this._dates,s=r.length;for(this.groups=[],t=0;o>t;t++)e=this._addResourceView(t),n=r[0],i=r[r.length-1||0],e.addTimeSlotCollection(n,l.date.addDays(i,1));this._timeSlotGroups(o,s)},_isHorizontallyGrouped:function(){return this.groupedResources.length&&"horizontal"===this._groupOrientation()},_timeSlotGroups:function(t,e){var n=this._timeSlotInterval(),i=this._isVerticallyGrouped(),o=this.content.find("tr");o.attr("role","row"),this._groupedView._addTimeSlotsCollections(t,e,o,n,i)},_addTimeSlotToCollection:function(t,e,n,i,o,r,s){var a=e[n+i],l=t.getTimeSlotCollection(0),d=this._dates[o],u=Date.UTC(d.getFullYear(),d.getMonth(),d.getDate()),c=u+r,h=c+s;a.setAttribute("role","gridcell"),a.setAttribute("aria-selected",!1),l.addTimeSlot(a,c,h,!0)},startDate:function(){return this._startDate},endDate:function(){return this._endDate},startTime:function(){var t=this.options;return t.showWorkHours?t.workDayStart:t.startTime},endTime:function(){var t=this.options;return t.showWorkHours?t.workDayEnd:t.endTime},_timeSlotInterval:function(){var t=this.options;return t.majorTick/t.minorTickCount*g},nextDate:function(){return l.date.nextDay(this.endDate())},previousDate:function(){return l.date.previousDay(this.startDate())},calculateDateRange:function(){this._render([this.options.date])},render:function(t){var e,n,i,o,r;for(this._headerColumnCount=0,this._groups(),this.element.find(".k-event").remove(),t=new l.data.Query(t).sort([{field:"start",dir:"asc"},{field:"end",dir:"desc"}]).toArray(),e=[],this._eventsByResource(t,this.groupedResources,e),n=[],i=0,o=0;e.length>o;o++)r={groupIndex:o,maxRowCount:0,events:{}},n.push(r),this._renderEvents(e[o],o,r),r.maxRowCount>i&&(i=r.maxRowCount);this._setRowsHeight(n,e.length,i),this._positionEvents(n,e.length),this._currentTime(!1),this.trigger("activate")},_positionEvents:function(e,n){var i,o,r,s,a;for(i=0;n>i;i++){o=e[i].events;for(r in o)if(s=o[r],t.isArray(s))for(a=0;s.length>a;a++)this._positionEvent(s[a]);else this._positionEvent(s)}},_setRowsHeight:function(e,n,i){var o,r,s,a,l,d=this.options.eventHeight+2,u=this._getBottomRowOffset(),c=this._groupedView,h=c._getVerticalGroupCount(n);for(n=this._isVerticallyGrouped()?h:1,o=0;n>o;o++)r=c._getVerticalRowCount(e,o,i),r=r?r:1,s=(d+2)*r+u,a=t(this.times.find("tr")[o]),l=t(this.content.find("tr")[o]),a.height(s),l.height(s);this._setContentWidth(),this.refreshLayout(),this._refreshSlots()},_getBottomRowOffset:function(){var t,e,n=.5*this.options.eventHeight,i=this._isMobile();return i?(t=30,e=60):(t=15,e=30),n>e?n=e:t>n&&(n=t),n},_positionEvent:function(t){var e,n,i,o=this.options.eventHeight+2,r=t.slotRange.innerRect(t.start,t.end,!1),s=this._adjustLeftPosition(r.left),a=r.right-r.left-2;0>a&&(a=0),this.options.eventMinWidth>a&&(e=t.slotRange.collection,n=e._slots[e._slots.length-1],i=n.offsetLeft+n.offsetWidth,a=this.options.eventMinWidth,s+a>i&&(a=i-r.left-2)),t.element.css({top:t.slotRange.start.offsetTop+t.rowIndex*(o+2)+"px",left:s,width:a})},_refreshSlots:function(){for(var t=0;this.groups.length>t;t++)this.groups[t].refresh()},_eventsByResource:function(t,e,n){var i,o,r,s,a=e[0];if(a)for(i=a.dataSource.view(),o=0;i.length>o;o++)r=this._resourceValue(a,i[o]),s=new l.data.Query(t).filter({field:a.field,operator:c.groupEqFilter(r)}).toArray(),e.length>1?this._eventsByResource(s,e.slice(1),n):n.push(s);else n.push(t)},_isInDateSlot:function(t){var e=t.start,n=t.end,i=_(this._startDate),o=l.date.addDays(_(this._endDate),1);return o>e&&n>=i},_isInTimeSlot:function(t){var e,n=t._startTime||l.date.toUtcTime(t.start),i=t._endTime||l.date.toUtcTime(t.end),o=this._slotRanges;for(n===i&&(i+=1),e=0;o.length>e;e++)if(o[e].end>n&&i>o[e].start)return!0;return!1},_adjustEvent:function(t){var e,n=t.start,i=t.end,o=t._time("start"),r=t._time("end"),s=p(this.startTime()),a=p(this.endTime()),d=null,c=null,h=!1,f=!1;return t.isAllDay?(d=_(n),s>o&&(u(d,s),f=!0),c=_(i),a===p(_(this.endTime()))?c=l.date.addDays(c,1):(u(c,a),h=!0)):(a=0===a?v:a,s>o?(d=_(n),u(d,s),f=!0):o>a&&(d=_(n),d=l.date.addDays(d,1),u(d,s),f=!0),r>a?(c=_(i),u(c,a),h=!0):s>r&&(c=_(i),c=l.date.addDays(c,-1),u(c,a),h=!0)),e=t.clone({start:d?d:n,end:c?c:i,_startTime:d?l.date.toUtcTime(d):t._startTime,_endTime:c?l.date.toUtcTime(c):t._endTime,isAllDay:!1}),{occurrence:e,head:h,tail:f}},_renderEvents:function(t,e,n){var i,o,r,s,a,l,d,u,c,h,f;for(o=0,r=t.length;r>o;o++)i=t[o],this._isInDateSlot(i)&&(s=i.isAllDay||i.end.getTime()-i.start.getTime()>=v,a=this.content,(s||this._isInTimeSlot(i))&&(l=this._adjustEvent(i),d=this.groups[e],d._continuousEvents||(d._continuousEvents=[]),u=d.slotRanges(l.occurrence,!1),c=u[0],h=c.start.index,f=c.end.index,this._isInTimeSlot(l.occurrence)&&this._groupedView._renderEvent(n,i,l,d,c,a,h,f)))},addContinuousEvent:function(t,e,n,i){var o=t._continuousEvents;o.push({element:n,isAllDay:i,uid:n.attr(l.attr("uid")),start:e.start,end:e.end})},_createEventElement:function(e,n,i,o){var r,s,a=this.eventTemplate,d=this.options.editable,u=this._isMobile(),c=d&&d.destroy!==!1&&!u,f=d&&d.resize!==!1,_=n._time("start"),p=n._time("end"),v=n.start,g=n.end,m=this.eventResources(n);return n._startTime&&_!==l.date.getMilliseconds(n.start)&&(v=new Date(_),v=l.timezone.apply(v,"Etc/UTC")),n._endTime&&p!==l.date.getMilliseconds(n.end)&&(g=new Date(p),g=l.timezone.apply(g,"Etc/UTC")),r=h({},{ns:l.ns,resizable:f,showDelete:c,head:i,tail:o,singleDay:1==this._dates.length,resources:m,inverseColor:m&&m[0]?this._shouldInverseResourceColor(m[0]):!1},n,{start:v,end:g}),s=t(a(r)),this.angular("compile",function(){return{elements:s,data:[{dataItem:r}]}}),s},_arrangeRows:function(t,e,n){var i,o,s,a,l,d,u=e.start.index,h=e.end.index,f=t.slotRange.innerRect(t.start,t.end,!1),_=f.right+this.options.eventMinWidth,p=r(e.events(),f.left,_);for(e.addEvent({slotIndex:u,start:u,end:h,rectLeft:f.left,rectRight:_,element:t.element,uid:t.uid}),p.push({start:u,end:h,uid:t.uid}),i=c.createRows(p),i.length>n.maxRowCount&&(n.maxRowCount=i.length),o=0,s=i.length;s>o;o++)for(a=i[o].events,l=0,d=a.length;d>l;l++)n.events[a[l].uid].rowIndex=o},_groupCount:function(){var t=this.groupedResources,e=this._groupedView;return t.length?"vertical"===this._groupOrientation()?e._verticalCountForLevel(t.length-1):e._horizontalCountForLevel(t.length-1,this.columnLevels.length-1):1},_updateEventForSelection:function(t){var e=this._adjustEvent(t.clone());return e.occurrence},_eventOptionsForMove:function(t){return t.isAllDay?{isAllDay:!1}:{}},_updateEventForResize:function(t){t.isAllDay&&t.set("isAllDay",!1)},_updateMoveHint:function(t,e,n){var i,o,r,s,a=this.groups[e],l=t.clone({start:t.start,end:t.end}),d=l.duration();for(l.start=new Date(l.start.getTime()+n),l.end=new Date(+l.start+d),i=this._adjustEvent(l),o=a.slotRanges(i.occurrence,!1),this._removeMoveHint(),r=0;o.length>r;r++)this._groupedView._createMoveHint(o[r],i);s=this.content,this._moveHint.appendTo(s)},_updateResizeHint:function(t,e,n,i){var o,r,s,a,d,u,h,f,_,p,v=this.groups[e],g=v.ranges(n,i,!1,!1);for(this._removeResizeHint(),o=0;g.length>o;o++)r=g[o],s=r.startSlot(),a=r.innerRect(n,i,!1),a.top=s.offsetTop,d=a.right-a.left,u=r.endSlot().offsetTop+s.offsetHeight-a.top,h=this._adjustLeftPosition(a.left),f=c.fn._createResizeHint.call(this,h,a.top,d,u),this._resizeHint=this._resizeHint.add(f);_="t",p=this.content,this._resizeHint.appendTo(p),this._resizeHint.find(".k-label-top,.k-label-bottom").text(""),this._resizeHint.first().addClass("k-first").find(".k-label-top").text(l.toString(l.timezone.toLocalDate(n),_)),this._resizeHint.last().addClass("k-last").find(".k-label-bottom").text(l.toString(l.timezone.toLocalDate(i),_))},selectionByElement:function(t){var e=t.offset();return this._slotByPosition(e.left,e.top)},_updateDirection:function(t,e,n,i,o){var r=e[0].start,s=e[e.length-1].end;n&&!o&&r.index===s.index&&r.collectionIndex===s.collectionIndex&&(t.backward=i)},_changeGroup:function(t,e){var n=e?"prevGroupSlot":"nextGroupSlot",i=this[n](t.start,t.groupIndex,!1);return i&&(t.groupIndex+=e?-1:1),this._groupedView._changeGroup(t,e,i),i},prevGroupSlot:function(t,e,n){var i=this.groups[e],o=i.ranges(t,t,n,!1)[0].start;if(!(0>=e))return this._groupedView._prevGroupSlot(o,i,n)},nextGroupSlot:function(t,e,n){var i=this.groups[e],o=i.ranges(t,t,n,!1)[0].start;if(!(e>=this.groups.length-1))return this._groupedView._nextGroupSlot(o,i,n)},_verticalSlots:function(t,e,n,i){var o=this._groupedView,r=o._verticalMethod(i,n),s=e[0].start,a=e[e.length-1].end,l=this.groups[t.groupIndex],d=o._normalizeVerticalSelection(t,e,i,n);return d&&(s=a=d),s=l[r](s),a=l[r](a),n||!this._isVerticallyGrouped()||s&&a||(s=a=o._verticalSlots(t,i,d)),{startSlot:s,endSlot:a}},_horizontalSlots:function(t,e,n,i){var o=i?"upSlot":"downSlot",r=e[0].start,s=e[e.length-1].end,a=this.groups[t.groupIndex],l={};return n?(l.startSlot=a[o](r),l.endSlot=a[o](s),n||!this._isHorizontallyGrouped()||r&&s||(l.startSlot=l.endSlot=this._changeGroup(t,i))):l=this._groupedView._horizontalSlots(t,a,o,r,s,n,i),l},_changeViewPeriod:function(t,e){var n,i=e?this.previousDate():this.nextDate(),o=t.start,r=t.end;return t.start=new Date(i),t.end=new Date(i),this._isHorizontallyGrouped()&&(t.groupIndex=e?this.groups.length-1:0),n=r-o,e?(r=p(this.endTime()),r=0===r?v:r,u(t.start,r-n),u(t.end,r)):(o=p(this.startTime()),u(t.start,o),u(t.end,o+n)),t.events=[],!0},move:function(t,e,n){var i,o,r,s,a,d=!1,u=this.groups[t.groupIndex],c=l.keys,h=this._groupedView,f=u.ranges(t.start,t.end,!1,!1);if(e===c.DOWN||e===c.UP){if(d=!0,r=e===c.UP,h._updateDirection(t,f,n,r),s=this._verticalSlots(t,f,n,r),h._changeVerticalViewPeriod(s,n,t,r))return d}else if((e===c.LEFT||e===c.RIGHT)&&(d=!0,r=e===c.LEFT,this._updateDirection(t,f,n,r,!1),s=this._horizontalSlots(t,f,n,r),h._changeHorizontalViewPeriod(s,n,t,r)))return d;return d&&(i=s.startSlot,o=s.endSlot,n?(a=t.backward,a&&i?t.start=i.startDate():!a&&o&&(t.end=o.endDate())):i&&o&&(t.start=i.startDate(),t.end=o.endDate()),t.events=[]),d},destroy:function(){var t=this;t.element&&t.element.off(D),t.footer&&t.footer.remove(),t._currentTimeUpdateTimer&&clearInterval(t._currentTimeUpdateTimer),c.fn.destroy.call(this),this._isMobile()&&t.options.editable&&(t.options.editable.create!==!1&&t._addUserEvents.destroy(),t.options.editable.update!==!1&&t._editUserEvents.destroy())}}),h(!0,d,{TimelineView:a,TimelineWeekView:a.extend({options:{name:"TimelineWeekView",title:"Timeline Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}",majorTick:120},name:"timelineWeek",calculateDateRange:function(){var t,e,n=this.options.date,i=l.date.dayOfWeek(n,this.calendarInfo().firstDay,-1),o=[];for(t=0,e=7;e>t;t++)o.push(i),i=l.date.nextDay(i);
this._render(o)}}),TimelineWorkWeekView:a.extend({options:{name:"TimelineWorkWeekView",title:"Timeline Work Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}",majorTick:120},name:"timelineWorkWeek",nextDate:function(){var t=l.date.dayOfWeek(l.date.nextDay(this.endDate()),this.calendarInfo().firstDay,1);return l.date.addDays(t,this._workDays[0])},previousDate:function(){var t=l.date.dayOfWeek(this.startDate(),this.calendarInfo().firstDay,-1),e=this._workDays;return l.date.addDays(t,e[e.length-1]-7)},calculateDateRange:function(){for(var t=this.options.date,e=l.date.dayOfWeek(t,this.options.workWeekStart,-1),n=l.date.dayOfWeek(e,this.options.workWeekEnd,1),i=[];n>=e;)i.push(e),e=l.date.nextDay(e);this._render(i)}}),TimelineMonthView:a.extend({options:{name:"TimelineMonthView",title:"Timeline Month",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}",workDayStart:new Date(1980,1,1,0,0,0),workDayEnd:new Date(1980,1,1,23,59,59),footer:!1,majorTick:1440,minorTickCount:1},name:"timelineMonth",calculateDateRange:function(){var t,e,n=this.options.date,i=l.date.firstDayOfMonth(n),o=l.date.lastDayOfMonth(n),r=[];for(t=0,e=o.getDate();e>t;t++)r.push(i),i=l.date.nextDay(i);this._render(r)}})})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()});
//# sourceMappingURL=kendo.scheduler.timelineview.min.js.map