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

*/
!function(e,define){define("util/main.min",["kendo.core.min"],e)}(function(){return function(){function e(e){return typeof e!==F}function t(e,t){var n=i(t);return B.round(e*n)/n}function i(e){return e?B.pow(10,e):1}function n(e,t,i){return B.max(B.min(e,i),t)}function a(e){return e*V}function r(e){return e/V}function o(e){return"number"==typeof e&&!isNaN(e)}function s(t,i){return e(t)?t:i}function d(e){return e*e}function l(e){var t,i=[];for(t in e)i.push(t+e[t]);return i.sort().join("")}function c(e){var t,i=2166136261;for(t=0;t<e.length;++t)i+=(i<<1)+(i<<4)+(i<<7)+(i<<8)+(i<<24),i^=e.charCodeAt(t);return i>>>0}function u(e){return c(l(e))}function h(e){var t,i=e.length,n=P,a=H;for(t=0;t<i;t++)a=B.max(a,e[t]),n=B.min(n,e[t]);return{min:n,max:a}}function p(e){return h(e).min}function f(e){return h(e).max}function m(e){return g(e).min}function v(e){return g(e).max}function g(e){var t,i,n,a=P,r=H;for(t=0,i=e.length;t<i;t++)n=e[t],null!==n&&isFinite(n)&&(a=B.min(a,n),r=B.max(r,n));return{min:a===P?void 0:a,max:r===H?void 0:r}}function _(e){if(e)return e[e.length-1]}function k(e,t){return e.push.apply(e,t),e}function w(e){return I.template(e,{useWithBlock:!1,paramName:"d"})}function b(t,i){return e(i)&&null!==i?" "+t+"='"+i+"' ":""}function y(e){var t,i="";for(t=0;t<e.length;t++)i+=b(e[t][0],e[t][1]);return i}function z(t){var i,n,a="";for(i=0;i<t.length;i++)n=t[i][1],e(n)&&(a+=t[i][0]+":"+n+";");if(""!==a)return a}function T(e){return"string"!=typeof e&&(e+="px"),e}function D(e){var t,i,n=[];if(e)for(t=I.toHyphens(e).split("-"),i=0;i<t.length;i++)n.push("k-pos-"+t[i]);return n.join(" ")}function x(t){return""===t||null===t||"none"===t||"transparent"===t||!e(t)}function S(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"},i=[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<i[0]?i.shift():(n+=t[i[0]],e-=i[0]);return n}function E(e){var t,i,n,a,r;for(e=e.toLowerCase(),t={i:1,v:5,x:10,l:50,c:100,d:500,m:1e3},i=0,n=0,a=0;a<e.length;++a){if(r=t[e.charAt(a)],!r)return null;i+=r,r>n&&(i-=2*n),n=r}return i}function C(e){var t=Object.create(null);return function(){var i,n="";for(i=arguments.length;--i>=0;)n+=":"+arguments[i];return n in t?t[n]:t[n]=e.apply(this,arguments)}}function A(e){for(var t,i,n=[],a=0,r=e.length;a<r;)t=e.charCodeAt(a++),t>=55296&&t<=56319&&a<r?(i=e.charCodeAt(a++),56320==(64512&i)?n.push(((1023&t)<<10)+(1023&i)+65536):(n.push(t),a--)):n.push(t);return n}function M(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 R(e,t){function i(e,i){for(var n=[],a=0,r=0,o=0;a<e.length&&r<i.length;)t(e[a],i[r])<=0?n[o++]=e[a++]:n[o++]=i[r++];return a<e.length&&n.push.apply(n,e.slice(a)),r<i.length&&n.push.apply(n,i.slice(r)),n}return e.length<2?e.slice():function n(e){var t,a,r;return e.length<=1?e:(t=Math.floor(e.length/2),a=e.slice(0,t),r=e.slice(t),a=n(a),r=n(r),i(a,r))}(e)}var B=Math,I=window.kendo,O=I.deepExtend,V=B.PI/180,P=Number.MAX_VALUE,H=-Number.MAX_VALUE,F="undefined",W=Date.now;W||(W=function(){return(new Date).getTime()}),O(I,{util:{MAX_NUM:P,MIN_NUM:H,append:k,arrayLimits:h,arrayMin:p,arrayMax:f,defined:e,deg:r,hashKey:c,hashObject:u,isNumber:o,isTransparent:x,last:_,limitValue:n,now:W,objectKey:l,round:t,rad:a,renderAttr:b,renderAllAttr:y,renderPos:D,renderSize:T,renderStyle:z,renderTemplate:w,sparseArrayLimits:g,sparseArrayMin:m,sparseArrayMax:v,sqr:d,valueOrDefault:s,romanToArabic:E,arabicToRoman:S,memoize:C,ucs2encode:M,ucs2decode:A,mergeSort:R}}),I.drawing.util=I.util,I.dataviz.util=I.util}(),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,i){(i||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 i(e,t,i){return u.current.measure(e,t,i)}function n(e,t){var i=[];if(e.length>0&&document.fonts){try{i=e.map(function(e){return document.fonts.load(e)})}catch(n){r.logToConsole(n)}Promise.all(i).then(t,t)}else t()}var a=document,r=window.kendo,o=r.Class,s=r.util,d=s.defined,l=o.extend({init:function(e){this._size=e,this._length=0,this._map={}},put:function(e,t){var i=this,n=i._map,a={key:e,value:t};n[e]=a,i._head?(i._tail.newer=a,a.older=i._tail,i._tail=a):i._head=i._tail=a,i._length>=i._size?(n[i._head.key]=null,i._head=i._head.newer,i._head.older=null):i._length++},get:function(e){var t=this,i=t._map[e];if(i)return i===t._head&&i!==t._tail&&(t._head=i.newer,t._head.older=null),i!==t._tail&&(i.older&&(i.older.newer=i.newer,i.newer.older=i.older),i.older=t._tail,i.newer=null,t._tail.newer=i,t._tail=i),i.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=o.extend({init:function(e){this._cache=new l(1e3),this._initOptions(e)},options:{baselineMarkerSize:1},measure:function(i,n,r){var o,l,u,h,p,f,m,v;if(!i)return t();if(o=s.objectKey(n),l=s.hashKey(i+o),u=this._cache.get(l),u)return u;h=t(),p=r?r:c,f=this._baselineMarker().cloneNode(!1);for(m in n)v=n[m],d(v)&&(p.style[m]=v);return e(p).text(i),p.appendChild(f),a.body.appendChild(p),(i+"").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(l,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,r.util.TextMetrics=u,r.util.LRUCache=l,r.util.loadFonts=n,r.util.measureText=i}(window.kendo.jQuery)},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()}),function(e,define){define("util/base64.min",["util/main.min"],e)}(function(){return function(){function e(e){var i,n,a,o,s,d,l,c="",u=0;for(e=t(e);u<e.length;)i=e.charCodeAt(u++),n=e.charCodeAt(u++),a=e.charCodeAt(u++),o=i>>2,s=(3&i)<<4|n>>4,d=(15&n)<<2|a>>6,l=63&a,isNaN(n)?d=l=64:isNaN(a)&&(l=64),c=c+r.charAt(o)+r.charAt(s)+r.charAt(d)+r.charAt(l);return c}function t(e){var t,i,n="";for(t=0;t<e.length;t++)i=e.charCodeAt(t),i<128?n+=a(i):i<2048?(n+=a(192|i>>>6),n+=a(128|63&i)):i<65536&&(n+=a(224|i>>>12),n+=a(128|i>>>6&63),n+=a(128|63&i));return n}var i=window.kendo,n=i.deepExtend,a=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n(i.util,{encodeBase64:e,encodeUTF8:t})}(),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()}),function(e,define){define("mixins/observers.min",["kendo.core.min"],e)}(function(){return function(e){var t=Math,i=window.kendo,n=i.deepExtend,a=e.inArray,r={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(),i=a(e,t);return i!=-1&&t.splice(i,1),this},trigger:function(e,t){var i,n,a=this._observers;if(a&&!this._suspended)for(n=0;n<a.length;n++)i=a[n],i[e]&&i[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(i,{mixins:{ObserversMixin:r}})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()}),function(e,define){define("kendo.scheduler.min",["kendo.dropdownlist.min","kendo.editable.min","kendo.multiselect.min","kendo.window.min","kendo.datetimepicker.min","kendo.scheduler.recurrence.min","kendo.scheduler.view.min","kendo.scheduler.dayview.min","kendo.scheduler.agendaview.min","kendo.scheduler.monthview.min","kendo.scheduler.timelineview.min","kendo.mobile.actionsheet.min","kendo.mobile.pane.min","kendo.pdf.min"],e)}(function(){return function(e,t){function i(e,t){return t=t||"",e.startTimezone&&(t=e.startTimezone,e.endTimezone&&(t+=" | "+e.endTimezone)),t}function n(e,t){var i=t.timezone;i&&(e[M.attr("timezone")]=i)}function a(e,t){var i,n=t.model.fields[t.field].validation;n&&(i=n.dateCompare,i&&q(i)&&i.message&&(e[M.attr("dateCompare-msg")]=i.message))}function r(e,t){return function(i){return i=e(i),s(i,"apply",t),i||[]}}function o(e,t){return function(i){return i&&("[object Array]"===J.call(i)||i instanceof M.data.ObservableArray||(i=[i])),s(i,"remove",t,!0),i=e(i),i||[]}}function s(e,t,i,n){var a,r,o;for(e=e||[],r=0,o=e.length;r<o;r++)a=e[r],n?a.startTimezone||a.endTimezone?i?(a.start=M.timezone.convert(a.start,a.startTimezone||a.endTimezone,i),a.end=M.timezone.convert(a.end,a.endTimezone||a.startTimezone,i),a.start=M.timezone[t](a.start,i),a.end=M.timezone[t](a.end,i)):(a.start=M.timezone[t](a.start,a.startTimezone||a.endTimezone),a.end=M.timezone[t](a.end,a.endTimezone||a.startTimezone)):i&&(a.start=M.timezone[t](a.start,i),a.end=M.timezone[t](a.end,i)):a.startTimezone||a.endTimezone?(a.start=M.timezone[t](a.start,a.startTimezone||a.endTimezone),a.end=M.timezone[t](a.end,a.endTimezone||a.startTimezone),i&&(a.start=M.timezone.convert(a.start,a.startTimezone||a.endTimezone,i),a.end=M.timezone.convert(a.end,a.endTimezone||a.startTimezone,i))):i&&(a.start=M.timezone[t](a.start,i),a.end=M.timezone[t](a.end,i)),n&&delete a.uid;return e}function d(e,t){for(var i,n=e.length,a=0;a<n;a++)if(i=e[a],i.uid===t)return i}function l(e,t,i){return e=i?M.timezone.convert(e,t,i):M.timezone.remove(e,t)}function c(e){var t,i,n,a,r,o,s,d,c,u,h,p;return!(e.filter("[name=end]").length&&(t=e.closest(".k-scheduler-edit-form"),i=t.find("[name=start]:visible"),n=t.find("[name=end]:visible"),n[0]&&i[0]&&(o=M.widgetInstance(i,M.ui),s=M.widgetInstance(n,M.ui),d=t.data("kendoEditable"),c=d?d.options.model:null,o&&s?(a=o.value(),r=s.value()):(a=M.parseDate(i.val()),r=M.parseDate(n.val())),a&&r)))||(c&&(u=i.attr(M.attr("timezone")),h=c.startTimezone,p=c.endTimezone,h=h||p,p=p||h,h&&(a=l(a,h,u),r=l(r,p,u))),a<=r)}function u(e,t,i,n){for(var a=e.length,r=[],o=0;o<a;o++)r=r.concat(e[o].expand(t,i,n));return r}function h(e){return delete e.name,delete e.prefix,delete e.remove,delete e.edit,delete e.add,delete e.navigate,e}function p(t,i){var n,a,r=(t.fields||t)[i],o=["url","email","number","date","boolean"],s=r?r.validation:{},d=M.attr("type"),l=e.inArray,c={};for(n in s)a=s[n],l(n,o)>=0?c[d]=n:M.isFunction(a)||(c[n]=q(a)?a.value||n:a),c[M.attr(n+"-msg")]=a.message;return c}function f(t,i){var n=p(i,t.field);return function(i){e(M.format('<select data-{0}bind="value:{1}">',M.ns,t.field)).appendTo(i).attr(n).kendoDropDownList({dataTextField:t.dataTextField,dataValueField:t.dataValueField,dataSource:t.dataSource,valuePrimitive:t.valuePrimitive,optionLabel:"None",template:M.format('<span class="k-scheduler-mark" style="background-color:#= data.{0}?{0}:"none" #"></span>#={1}#',t.dataColorField,t.dataTextField)})}}function m(t){var i=p(t.model,t.field);return function(t){e('<textarea name="description" class="k-textbox"/>').attr(i).appendTo(t)}}function v(t,i){var n=p(i,t.field);return function(i){e(M.format('<select data-{0}bind="value:{1}">',M.ns,t.field)).appendTo(i).attr(n).kendoMultiSelect({dataTextField:t.dataTextField,dataValueField:t.dataValueField,dataSource:t.dataSource,valuePrimitive:t.valuePrimitive,itemTemplate:M.format('<span class="k-scheduler-mark" style="background-color:#= data.{0}?{0}:"none" #"></span>#={1}#',t.dataColorField,t.dataTextField),tagTemplate:M.format('<span class="k-scheduler-mark" style="background-color:#= data.{0}?{0}:"none" #"></span>#={1}#',t.dataColorField,t.dataTextField)})}}function g(t,i){var n=p(i,t.field);return function(i){var a,r,o="",s=t.dataSource.view();for(a=0,r=s.length;a<r;a++)o+=M.format('<option value="{0}">{1}</option>',M.getter(t.dataValueField)(s[a]),M.getter(t.dataTextField)(s[a]));e(M.format('<select data-{0}bind="value:{1}" multiple="multiple" data-{0}value-primitive="{3}">{2}</select>',M.ns,t.field,o,t.valuePrimitive)).appendTo(i).attr(n)}}function _(e,t){var i,n=e.end.getTime()-e.start.getTime(),a=new Date(e.start.getTime());return M.date.setTime(a,t),i=new Date(a.getTime()),M.date.setTime(i,n,!0),{start:a,end:i}}var k,w,b,y,z,T,D,x,S,E,C,A,M=window.kendo,R=M.date,B=M.support.input,I=R.MS_PER_DAY,O=R.getDate,V=M.date.getMilliseconds,P=M.recurrence,H=M.keys,F=M.ui,W=F.Widget,N=F.DataBoundWidget,L="string",U=F.Popup,j=F.Calendar,K=M.data.DataSource,q=e.isPlainObject,Q=e.extend,$=e.proxy,J=Object.prototype.toString,Y=e.isArray,Z=".kendoScheduler",X="click",G="change",ee="cancel",te="remove",ie="save",ne="add",ae="edit",re=/(?:value:start|value:end)(?:,|$)/,oe=O(new Date),se=",",de=/\;/g,le="recurrenceException",ce="Are you sure you want to delete this event?",ue="Do you want to delete only this event occurrence or the whole series?",he="Do you want to edit only this event occurrence or the whole series?",pe="Are you sure you want to delete this event occurrence?",fe="Are you sure you want to delete the whole series?",me='<a class="k-button #=className#" #=attr# href="\\#">#=text#</a>',ve=M.template('<li class="k-current-view" data-#=ns#name="#=view#"><a role="button" href="\\#" class="k-link">${views[view].title}</a></li>'),ge=M.template('<div class="k-floatwrap k-header k-scheduler-toolbar"># if (pdf) { #<ul class="k-reset k-scheduler-tools"><li><a role="button" href="\\#" class="k-button k-pdf"><span class="k-icon k-i-pdf"></span>${messages.pdf}</a></li></ul># } #<ul class="k-reset k-scheduler-navigation"><li class="k-state-default k-header k-nav-today"><a role="button" href="\\#" class="k-link">${messages.today}</a></li><li class="k-state-default k-header k-nav-prev"><a role="button" href="\\#" class="k-link"><span class="k-icon k-i-arrow-w"></span></a></li><li class="k-state-default k-header k-nav-next"><a role="button" href="\\#" class="k-link"><span class="k-icon k-i-arrow-e"></span></a></li><li class="k-state-default k-nav-current"><a role="button" href="\\#" class="k-link"><span class="k-icon k-i-calendar"></span><span class="k-sm-date-format" data-#=ns#bind="text: formattedShortDate"></span><span class="k-lg-date-format" data-#=ns#bind="text: formattedDate"></span></a></li></ul>#if(viewsCount === 1){#<a role="button" data-#=ns#name="#=view#" href="\\#" class="k-link k-scheduler-refresh"><span class="k-icon k-i-refresh"></span></a>#}else{#<ul class="k-reset k-header k-scheduler-views">#for(var view in views){#<li class="k-state-default k-view-#= view.toLowerCase() #" data-#=ns#name="#=view#"><a role="button" href="\\#" class="k-link">${views[view].title}</a></li>#}#</ul>#}#</div>'),_e=M.template('<div class="k-floatwrap k-header k-scheduler-toolbar"><ul class="k-reset k-header k-scheduler-navigation"><li class="k-state-default k-nav-today"><a role="button" href="\\#" class="k-link">${messages.today}</a></li></ul>#if(viewsCount === 1){#<a role="button" data-#=ns#name="#=view#" href="\\#" class="k-link k-scheduler-refresh"><span class="k-icon k-i-refresh"></span></a>#}else{#<ul class="k-reset k-header k-scheduler-views">#for(var view in views){#<li class="k-state-default k-view-#= view.toLowerCase() #" data-#=ns#name="#=view#"><a role="button" href="\\#" class="k-link">${views[view].title}</a></li>#}#</ul>#}#</div><div class="k-floatwrap k-header k-scheduler-toolbar"><ul class="k-reset k-header k-scheduler-navigation"><li class="k-state-default k-nav-prev"><a role="button" href="\\#" class="k-link"><span class="k-icon k-i-arrow-w"></span></a></li><li class="k-state-default k-nav-current"><span class="k-sm-date-format" data-#=ns#bind="text: formattedShortDate"></span><span class="k-lg-date-format" data-#=ns#bind="text: formattedDate"></span></li><li class="k-state-default k-nav-next"><a role="button" href="\\#" class="k-link"><span class="k-icon k-i-arrow-e"></span></a></li></ul></div>'),ke=function(t,i){var r={name:i.field},o=B.date?"":M.attr("role")+'="datepicker" ',s=M.attr("role")+'="datetimepicker" ',d=i.model.isAllDay,l=M.attr("validate")+"='"+!d+"'",c=M.attr("validate")+"='"+d+"'";n(r,i),a(r,i),e('<input type="datetime-local" required '+M.attr("type")+'="date" '+s+M.attr("bind")+'="value:'+i.field+',invisible:isAllDay" '+l+"/>").attr(r).appendTo(t),e('<input type="date" required '+M.attr("type")+'="date" '+o+M.attr("bind")+'="value:'+i.field+',visible:isAllDay" '+c+"/>").attr(r).appendTo(t),e("<span "+M.attr("for")+'="'+i.field+'" class="k-invalid-msg"/>').hide().appendTo(t)},we=function(t,i){var r={name:i.field},o=i.model.isAllDay,s=M.attr("validate")+"='"+!o+"' ",d=M.attr("validate")+"='"+o+"' ";n(r,i),a(r,i),e('<input type="text" required '+M.attr("type")+'="date" '+M.attr("role")+'="datetimepicker" '+M.attr("bind")+'="value:'+i.field+',invisible:isAllDay" '+s+"/>").attr(r).appendTo(t),e('<input type="text" required '+M.attr("type")+'="date" '+M.attr("role")+'="datepicker" '+M.attr("bind")+'="value:'+i.field+',visible:isAllDay" '+d+"/>").attr(r).appendTo(t),e("<span "+M.attr("bind")+'="text: '+i.field+'Timezone"></span>').appendTo(t),"end"===i.field&&e("<span "+M.attr("bind")+'="text: startTimezone, invisible: endTimezone"></span>').appendTo(t),e("<span "+M.attr("for")+'="'+i.field+'" class="k-invalid-msg"/>').hide().appendTo(t)},be=function(t,i){e("<div "+M.attr("bind")+'="value:'+i.field+'" />').attr({name:i.field}).appendTo(t).kendoRecurrenceEditor({start:i.model.start,timezone:i.timezone,messages:i.messages})},ye=function(t,i){e("<div "+M.attr("bind")+'="value:'+i.field+'" />').attr({name:i.field}).appendTo(t).kendoMobileRecurrenceEditor({start:i.model.start,timezone:i.timezone,messages:i.messages,pane:i.pane,value:i.model[i.field]})},ze=function(t,n){var a=i(n.model,n.messages.noTimezone);e('<a href="#" class="k-button k-timezone-button" data-bind="invisible:isAllDay">'+a+"</a>").click(n.click).appendTo(t)},Te=function(t,i){e('<a href="#" class="k-button" data-bind="invisible:isAllDay">'+i.messages.timezoneEditorButton+"</a>").click(i.click).appendTo(t)},De=function(t,i){e("<div "+M.attr("bind")+'="value:'+i.field+'" />').attr({name:i.field}).toggle(i.visible).appendTo(t).kendoMobileTimezoneEditor({optionLabel:i.noTimezone})},xe=function(i,n){var a=n.visible||n.visible===t;e("<div "+M.attr("bind")+'="value:'+n.field+'" />').attr({name:n.field}).toggle(a).appendTo(i).kendoTimezoneEditor({optionLabel:n.noTimezone})},Se=M.Class.extend({init:function(t,i){var n=t.timezone;this.reader=i,i.model&&(this.model=i.model),this.timezone=n,this.data=r(e.proxy(this.data,this),n),this.serialize=o(e.proxy(this.serialize,this),n)},errors:function(e){return this.reader.errors(e)},parse:function(e){return this.reader.parse(e)},data:function(e){return this.reader.data(e)},total:function(e){return this.reader.total(e)},groups:function(e){return this.reader.groups(e)},aggregates:function(e){return this.reader.aggregates(e)},serialize:function(e){return this.reader.serialize(e)}}),Ee=M.data.Model.define({init:function(e){var t=this;M.data.Model.fn.init.call(t,e),t._defaultId=t.defaults[t.idField]},_time:function(e){var t=this[e],i="_"+e+"Time";return this[i]?this[i]-M.date.toUtcTime(M.date.getDate(t)):V(t)},_date:function(e){var t="_"+e+"Time";return this[t]?this[t]-this._time(e):M.date.getDate(this[e])},clone:function(t,i){var n=this.uid,a=new this.constructor(e.extend({},this.toJSON(),t));return i||(a.uid=n),a},duration:function(){var e=this.end,t=this.start,i=(e.getTimezoneOffset()-t.getTimezoneOffset())*M.date.MS_PER_MINUTE;return e-t-i},expand:function(e,t,i){return P?P.expand(this,e,t,i):[this]},update:function(e){for(var t in e)this.set(t,e[t]);this._startTime&&this.set("_startTime",M.date.toUtcTime(this.start)),this._endTime&&this.set("_endTime",M.date.toUtcTime(this.end))},isMultiDay:function(){return this.isAllDay||this.duration()>=M.date.MS_PER_DAY},isException:function(){return!this.isNew()&&this.recurrenceId},isOccurrence:function(){return this.isNew()&&this.recurrenceId},isRecurring:function(){return!(!this.recurrenceRule&&!this.recurrenceId)},isRecurrenceHead:function(){return!(!this.id||!this.recurrenceRule)},toOccurrence:function(t){return t=e.extend(t,{recurrenceException:null,recurrenceRule:null,recurrenceId:this.id||this.recurrenceId}),t[this.idField]=this.defaults[this.idField],this.clone(t,!0)},toJSON:function(){var e=M.data.Model.fn.toJSON.call(this);return e.uid=this.uid,delete e._startTime,delete e._endTime,e},shouldSerialize:function(e){return M.data.Model.fn.shouldSerialize.call(this,e)&&"_defaultId"!==e},set:function(e,t){var i,n,a,r=this.isAllDay||!1;M.data.Model.fn.set.call(this,e,t),"isAllDay"==e&&t!=r&&(i=M.date.getDate(this.start),n=new Date(this.end),a=M.date.getMilliseconds(n),0===a&&t&&(a=I),this.set("start",i),t===!0?(M.date.setTime(n,-a),n<i&&(n=i)):M.date.setTime(n,I-a),this.set("end",n))},id:"id",fields:{id:{type:"number"},title:{defaultValue:"",type:"string"},start:{type:"date",validation:{required:!0}},startTimezone:{type:"string"},end:{type:"date",validation:{required:!0,dateCompare:{value:c}}},endTimezone:{type:"string"},recurrenceRule:{defaultValue:"",type:"string"},recurrenceException:{defaultValue:"",type:"string"},isAllDay:{type:"boolean",defaultValue:!1},description:{type:"string"}}}),Ce=K.extend({init:function(e){K.fn.init.call(this,Q(!0,{},{schema:{modelBase:Ee,model:Ee}},e)),this.reader=new Se(this.options.schema,this.reader)},expand:function(e,t){var i=this.view(),n={};return e&&t&&(t=new Date(t.getTime()+I-1),n={logic:"or",filters:[{logic:"and",filters:[{field:"start",operator:"gte",value:e},{field:"end",operator:"gte",value:e},{field:"start",operator:"lte",value:t}]},{logic:"and",filters:[{field:"start",operator:"lte",value:new Date(e.getTime()+I-1)},{field:"end",operator:"gte",value:e}]}]},i=new M.data.Query(u(i,e,t,this.reader.timezone)).filter(n).toArray()),i},cancelChanges:function(e){e&&e.isOccurrence()&&this._removeExceptionDate(e),K.fn.cancelChanges.call(this,e)},insert:function(e,t){if(t){if(!(t instanceof Ee)){var i=t;t=this._createNewModel(),t.accept(i)}return(!this._pushCreated&&t.isRecurrenceHead()||t.recurrenceId)&&(t=t.recurrenceId?t:t.toOccurrence(),this._addExceptionDate(t)),K.fn.insert.call(this,e,t)}},pushCreate:function(e){this._pushCreated=!0,K.fn.pushCreate.call(this,e),this._pushCreated=!1},remove:function(e){return e.isRecurrenceHead()?this._removeExceptions(e):e.isRecurring()&&this._addExceptionDate(e),K.fn.remove.call(this,e)},_removeExceptions:function(e){for(var t=this.data().slice(0),i=t.shift(),n=e.id;i;)i.recurrenceId===n&&K.fn.remove.call(this,i),i=t.shift();e.set(le,"")},_removeExceptionDate:function(e){var t,i,n,a;e.recurrenceId&&(t=this.get(e.recurrenceId),t&&(i=e.start,n=RegExp("(\\"+se+"?)"+P.toExceptionString(i,this.reader.timezone)),a=(t.recurrenceException||"").replace(de,se).replace(/\,$/,""),t.set(le,a.replace(n,""))))},_addExceptionDate:function(e){var t,i=e.start,n=this.reader.timezone,a=this.get(e.recurrenceId),r=(a.recurrenceException||"").replace(de,se).replace(/\,$/,"");P.isException(r,i,n)||(t=P.toExceptionString(i,n),a.set(le,r+(r&&t?se:"")+t))}});Ce.create=function(e){(Y(e)||e instanceof M.data.ObservableArray)&&(e={data:e});var t=e||{},i=t.data;if(t.data=i,!(t instanceof Ce)&&t instanceof M.data.DataSource)throw Error("Incorrect DataSource type. Only SchedulerDataSource instances are supported");return t instanceof Ce?t:new Ce(t)},Q(!0,M.data,{SchedulerDataSource:Ce,SchedulerDataReader:Se,SchedulerEvent:Ee}),k={update:{text:"Save",className:"k-primary k-scheduler-update"},canceledit:{text:"Cancel",className:"k-scheduler-cancel"},destroy:{text:"Delete",imageClass:"k-i-delete",className:"k-primary k-scheduler-delete",iconClass:"k-icon"}},w={mobile:{dateRange:ke,timezonePopUp:ze,timezone:De,recurrence:ye,description:m,multipleResources:g,resources:f},desktop:{dateRange:we,timezonePopUp:Te,timezone:xe,recurrence:be,description:m,multipleResources:v,resources:f}},b=M.Observable.extend({init:function(e,t){M.Observable.fn.init.call(this),this.element=e,this.options=Q(!0,{},this.options,t),this.createButton=this.options.createButton,this.toggleDateValidationHandler=$(this._toggleDateValidation,this)},_toggleDateValidation:function(t){if("isAllDay"==t.field){var i,n,a,r=this.container,o=this.editable.options.model.isAllDay,s=M.attr("bind");r.find("["+s+"*=end],["+s+"*=start]").each(function(){i=e(this),re.test(i.attr(s))&&(n=i.is("["+M.attr("role")+"=datetimepicker],[type*=datetime]"),a=o!==n,i.attr(M.attr("validate"),a))})}},fields:function(e,t){var i,n,a=this,r=a.options.messages,o=a.options.timezone,s=function(e){e.preventDefault(),a._initTimezoneEditor(t,this)},d=[{field:"title",title:r.editor.title},{field:"start",title:r.editor.start,editor:e.dateRange,timezone:o},{field:"end",title:r.editor.end,editor:e.dateRange,timezone:o},{field:"isAllDay",title:r.editor.allDayEvent}];M.timezone.windows_zones&&(d.push({field:"timezone",title:r.editor.timezone,editor:e.timezonePopUp,click:s,messages:r.editor,model:t}),d.push({field:"startTimezone",title:r.editor.startTimezone,editor:e.timezone,noTimezone:r.editor.noTimezone}),d.push({field:"endTimezone",title:r.editor.endTimezone,editor:e.timezone,noTimezone:r.editor.noTimezone})),t.recurrenceId||d.push({field:"recurrenceRule",title:r.editor.repeat,editor:e.recurrence,timezone:o,messages:r.recurrenceEditor,pane:this.pane}),"description"in t&&d.push({field:"description",title:r.editor.description,editor:e.description({model:t,field:"description"})});for(i=0;i<this.options.resources.length;i++)n=this.options.resources[i],d.push({field:n.field,title:n.title,editor:n.multiple?e.multipleResources(n,t):e.resources(n,t)});return d},end:function(){return this.editable.end()},_buildEditTemplate:function(e,t,i){var n,a,r,o,s=this.options.messages,d=Q({},M.Template,this.options.templateSettings),l=d.paramName,c=this.options.editable.template,u="";if(c)typeof c===L&&(c=window.unescape(c)),u+=M.template(c,d)(e);else for(n=0,a=t.length;n<a;n++)r=t[n],"startTimezone"===r.field&&(u+='<div class="k-popup-edit-form k-scheduler-edit-form k-scheduler-timezones" style="display:none">',u+='<div class="k-edit-form-container">',u+='<div class="k-edit-label"></div>',u+='<div class="k-edit-field"><label class="k-check"><input class="k-timezone-toggle" type="checkbox" />'+s.editor.separateTimezones+"</label></div>"),u+='<div class="k-edit-label"><label for="'+r.field+'">'+(r.title||r.field||"")+"</label></div>",!e.editable||e.editable(r.field)?(i.push(r),u+="<div "+M.attr("container-for")+'="'+r.field+'" class="k-edit-field"></div>'):(o="#:",r.field?(r=M.expr(r.field,l),o+=r+"==null?'':"+r):o+="''",o+="#",o=M.template(o,d),u+='<div class="k-edit-field">'+o(e)+"</div>"),"endTimezone"===r.field&&(u+=this._createEndTimezoneButton());return u},_createEndTimezoneButton:function(){return"</div></div>"},_revertTimezones:function(e){e.set("startTimezone",this._startTimezone),e.set("endTimezone",this._endTimezone),delete this._startTimezone,delete this._endTimezone}}),y=b.extend({init:function(){b.fn.init.apply(this,arguments),this.pane=M.mobile.ui.Pane.wrap(this.element),this.pane.element.parent().css("height",this.options.height),this.view=this.pane.view(),this._actionSheetButtonTemplate=M.template('<li><a #=attr# class="k-button #=className#" href="\\#">#:text#</a></li>'),this._actionSheetPopupOptions=e(document.documentElement).hasClass("km-root")?{modal:!1}:{align:"bottom center",position:"bottom center",effect:"slideIn:up"}},options:{animations:{left:"slide",right:"slide:right"}},destroy:function(){this.close(),this.unbind(),this.pane.destroy()},_initTimezoneEditor:function(t){var n,a=this,r=a.pane,o=a.options.messages,s=a.timezoneView,d=a.container.find(".k-scheduler-timezones"),l=d.find(".k-timezone-toggle"),c=d.find(".k-edit-label:last").add(d.find(".k-edit-field:last")),u=function(e){if("startTimezone"===e.field){var i=t.startTimezone;l.prop("disabled",!i),i||(c.hide(),t.set("endTimezone",""),l.prop("checked",!1))}};a._startTimezone=t.startTimezone||"",a._endTimezone=t.endTimezone||"",s||(n='<div data-role="view" class="k-popup-edit-form k-scheduler-edit-form k-mobile-list"><div data-role="header" class="k-header"><a href="#" class="k-button k-scheduler-cancel">'+o.cancel+"</a>"+o.editor.timezoneTitle+'<a href="#" class="k-button k-scheduler-update">'+o.save+"</a></div></div>",this.timezoneView=s=r.append(n),s.contentElement().append(d.show()),s.element.on(X+Z,".k-scheduler-cancel, .k-scheduler-update",function(n){var s,d;n.preventDefault(),n.stopPropagation(),e(this).hasClass("k-scheduler-cancel")&&a._revertTimezones(t),t.unbind("change",u),s=r.element.find("#edit").data("kendoMobileView"),d=i(t,o.editor.noTimezone),s.contentElement().find(".k-timezone-button").text(d),r.navigate(s,a.options.animations.right)}),l.click(function(){c.toggle(l.prop("checked")),t.set("endTimezone","")}),t.bind("change",u)),l.prop("checked",t.endTimezone).prop("disabled",!t.startTimezone),t.endTimezone?c.show():c.hide(),r.navigate(s,a.options.animations.left)},_createActionSheetButton:function(e){return e.template=this._actionSheetButtonTemplate,this.createButton(e)},showDialog:function(t){var i,n,a="",r='<ul><li class="km-actionsheet-title">'+t.title+"</li>",o=this.element.find(".k-event["+M.attr("uid")+"='"+t.model.uid+"']");for(this.container&&(o=this.container.find(".k-scheduler-delete"),o[0]&&(a="phone")),i=0;i<t.buttons.length;i++)r+=this._createActionSheetButton(t.buttons[i]);r+="</ul>",n=e(r).appendTo(this.pane.view().element).kendoMobileActionSheet({type:a,cancel:this.options.messages.cancel,cancelTemplate:'<li class="km-actionsheet-cancel"><a class="k-button" href="\\#">#:cancel#</a></li>',close:function(){this.destroy()},command:function(i){var a=n.element.find("li:not(.km-actionsheet-cancel) > .k-button").index(e(i.currentTarget));a>-1&&(n.close(),t.buttons[a].click())},popup:this._actionSheetPopupOptions}).data("kendoMobileActionSheet"),n.open(o)},editEvent:function(t){var i,n,a,r,o,s=this.pane,d="",l=this.options.messages,c=l.save,u=l.destroy,h=l.cancel,p=l.editor.editorTitle;return d+='<div data-role="view" class="k-popup-edit-form k-scheduler-edit-form k-mobile-list" id="edit" '+M.attr("uid")+'="'+t.uid+'"><div data-role="header" class="k-header"><a href="#" class="k-button k-scheduler-cancel">'+h+"</a>"+p+'<a href="#" class="k-button k-scheduler-update">'+c+"</a></div>",i=this.fields(w.mobile,t),n=this,a=[],d+=this._buildEditTemplate(t,i,a),!t.isNew()&&this.options.editable&&this.options.editable.destroy!==!1&&(d+='<div class="k-edit-buttons"><a href="#" class="k-scheduler-delete k-button">'+u+"</a></div>"),d+="</div>",r=s.append(d),o=this.container=r.element,this.editable=o.kendoEditable({fields:a,model:t,clearContainer:!1,target:n.options.target,validateOnBlur:!0}).data("kendoEditable"),o.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()}),this.trigger("edit",{container:o,model:t})?this.trigger("cancel",{container:o,model:t}):(o.on(X+Z,"a.k-scheduler-edit, a.k-scheduler-cancel, a.k-scheduler-update, a.k-scheduler-delete",function(i){var a,r;i.preventDefault(),i.stopPropagation(),a=e(this),a.hasClass("k-scheduler-edit")?s.navigate("#edit",n.options.animations.right):(r="cancel",a.hasClass("k-scheduler-update")?r="save":a.hasClass("k-scheduler-delete")&&(r="remove"),n.trigger(r,{container:o,model:t}))}),s.navigate(r,n.options.animations.left),
t.bind("change",n.toggleDateValidationHandler)),this.editable},_views:function(){return this.pane.element.find(M.roleSelector("view")).not(this.view.element)},close:function(){var e,t,i,n;if(this.container){for(this.pane.navigate("",this.options.animations.right),e=this._views(),i=0,n=e.length;i<n;i++)t=e.eq(i).data("kendoMobileView"),t&&t.purge();e.remove(),this.container=null,this.editable&&(this.editable.options.model.unbind("change",this.toggleDateValidationHandler),this.editable.destroy(),this.editable=null),this.timezoneView=null}}}),z=b.extend({destroy:function(){this.close(),this.unbind()},editEvent:function(t){var i,n,a,r=this,o=r.options.editable,s="<div "+M.attr("uid")+'="'+t.uid+'" class="k-popup-edit-form k-scheduler-edit-form"><div class="k-edit-form-container">',d=r.options.messages,l=d.save,c=d.cancel,u=d.destroy,h=this.fields(w.desktop,t),p=[];return s+=this._buildEditTemplate(t,h,p),n=q(o)?o.window:{},s+='<div class="k-edit-buttons k-state-default">',s+=this.createButton({name:"update",text:l,attr:i})+this.createButton({name:"canceledit",text:c,attr:i}),t.isNew()||o.destroy===!1||(s+=this.createButton({name:"delete",text:u,attr:i})),s+="</div></div></div>",a=this.container=e(s).appendTo(r.element).eq(0).kendoWindow(Q({modal:!0,resizable:!1,draggable:!0,title:d.editor.editorTitle,visible:!1,close:function(e){e.userTriggered&&r.trigger(ee,{container:a,model:t})&&e.preventDefault()}},n)),r.editable=a.kendoEditable({fields:p,model:t,clearContainer:!1,validateOnBlur:!0,target:r.options.target}).data("kendoEditable"),r.trigger(ae,{container:a,model:t})?r.trigger(ee,{container:a,model:t}):(a.data("kendoWindow").center().open(),a.on(X+Z,"a.k-scheduler-cancel",function(e){e.preventDefault(),e.stopPropagation(),r.trigger(ee,{container:a,model:t})}),a.on(X+Z,"a.k-scheduler-update",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("save",{container:a,model:t})}),a.on(X+Z,"a.k-scheduler-delete",function(e){e.preventDefault(),e.stopPropagation(),r.trigger(te,{container:a,model:t})}),M.cycleForm(a),t.bind("change",r.toggleDateValidationHandler)),r.editable},close:function(){var e=this,t=function(){e.editable&&(e.editable.options.model.unbind("change",e.toggleDateValidationHandler),e.editable.destroy(),e.editable=null,e.container=null),e.popup&&(e.popup.destroy(),e.popup=null)};e.editable?(e._timezonePopup&&e._timezonePopup.data("kendoWindow")&&(e._timezonePopup.data("kendoWindow").destroy(),e._timezonePopup=null),e.container.is(":visible")?e.container.data("kendoWindow").bind("deactivate",t).close():t()):t()},_createEndTimezoneButton:function(){var e=this.options.messages,t="";return t+='<div class="k-edit-buttons k-state-default">',t+=this.createButton({name:"savetimezone",text:e.save})+this.createButton({name:"canceltimezone",text:e.cancel}),t+="</div></div></div>"},showDialog:function(t){var i,n,a,r=M.format("<div class='k-popup-edit-form'><div class='k-edit-form-container'><p class='k-popup-message'>{0}</p>",t.text);for(r+='<div class="k-edit-buttons k-state-default">',i=0;i<t.buttons.length;i++)r+=this.createButton(t.buttons[i]);r+="</div></div></div>",n=this.element,this.popup&&this.popup.destroy(),a=this.popup=e(r).appendTo(n).eq(0).on("click",".k-button",function(i){i.preventDefault(),a.close();var n=e(i.currentTarget).index();t.buttons[n].click()}).kendoWindow({modal:!0,resizable:!1,draggable:!1,title:t.title,visible:!1,close:function(){this.destroy(),n.focus()}}).getKendoWindow(),a.center().open()},_initTimezoneEditor:function(e,t){var i,n=this,a=n.container.find(".k-scheduler-timezones"),r=a.find(".k-timezone-toggle"),o=a.find(".k-edit-label:last").add(a.find(".k-edit-field:last")),s=a.find(".k-scheduler-savetimezone"),d=a.find(".k-scheduler-canceltimezone"),l=n._timezonePopup,c=function(t){if("startTimezone"===t.field){var i=e.startTimezone;r.prop("disabled",!i),i||(o.hide(),e.set("endTimezone",""),r.prop("checked",!1))}};n._startTimezone=e.startTimezone,n._endTimezone=e.endTimezone,l||(n._timezonePopup=l=a.kendoWindow({modal:!0,resizable:!1,draggable:!0,title:n.options.messages.editor.timezoneEditorTitle,visible:!1,close:function(i){e.unbind("change",c),i.userTriggered&&n._revertTimezones(e),t&&t.focus()}}),r.click(function(){o.toggle(r.prop("checked")),e.set("endTimezone","")}),s.click(function(e){e.preventDefault(),i.close()}),d.click(function(t){t.preventDefault(),n._revertTimezones(e),i.close()}),e.bind("change",c)),r.prop("checked",e.endTimezone).prop("disabled",!e.startTimezone),e.endTimezone?o.show():o.hide(),i=l.data("kendoWindow"),i.center().open()}}),T=N.extend({init:function(t,i){var n=this;W.fn.init.call(n,t,i),n.options.views&&n.options.views.length||(n.options.views=["day","week"]),n.resources=[],n._initModel(),n._wrapper(),n._views(),n._toolbar(),n._dataSource(),n._resources(),n._resizeHandler=function(){n.resize()},n.wrapper.on("mousedown"+Z+" selectstart"+Z,function(t){e(t.target).is(":kendoFocusable")||t.preventDefault()}),n.options.editable&&n.options.editable.resize!==!1&&n._resizable(),n._movable(),n._bindResize(),n.options.messages&&n.options.messages.recurrence&&(P.options=n.options.messages.recurrence),n._selectable(),n._ariaId=M.guid(),n._createEditor()},_bindResize:function(){e(window).on("resize"+Z,this._resizeHandler)},_unbindResize:function(){e(window).off("resize"+Z,this._resizeHandler)},dataItems:function(){var i,n,a,r,o,s=this,d=s.items(),l=s._data,c=e.map(d,function(t){return e(t).attr("data-uid")}),u={},h=c.length;for(i=0;i<h;i++)u[c[i]]=null;for(a=l.length,i=0;i<a;i++)r=l[i],u[r.uid]!==t&&(u[r.uid]=r);o=[];for(n in u)o.push(u[n]);return o},_isMobile:function(){var e=this.options;return e.mobile===!0&&M.support.mobileOS||"phone"===e.mobile||"tablet"===e.mobile},_isMobilePhoneView:function(){var e=this.options;return e.mobile===!0&&M.support.mobileOS&&!M.support.mobileOS.tablet||"phone"===e.mobile},_groupsByResource:function(e,t,i,n,a){var r,o,s,d,l,c,u;if(i||(i=[]),r=e[0]){for(s=r.dataSource.view(),d=0,l=0;l<s.length;l++)c=M.getter(r.dataValueField)(s[l]),u=t+d+l,o=this._groupsByResource(e.slice(1),u,i,c,r.field),o[r.field]=c,d=o.groupIndex,a&&n&&(o[a]=n),1===e.length&&(o.groupIndex=t+l,i.push(o));return o}return{}},data:function(){return this._data},select:function(i){var n,a,r,o,s,d,l,c,u,h,p=this,f=p.view(),m=p._selection,v=f.groups;if(i===t)return r=f._selectedSlots,m?(m&&m.events&&(a=p._selectedEvents()),{start:m.start,end:m.end,events:a,slots:r,resources:f._resourceBySlot(m)}):[];if(!i)return p._selection=null,p._old=null,f.clearSelection(),t;if(e.isArray(i)&&(i={events:i.splice(0)}),i.resources){s=[],d=[],f.groupedResources&&p._groupsByResource(f.groupedResources,0,d);for(o in i.resources)s.push({field:o,operator:"eq",value:i.resources[o]});n=new M.data.Query(d).filter(s).toArray()}return i.events&&i.events.length?(p._selectEvents(i.events,n),p._select(),t):(v&&i.start&&i.end&&(l=O(f._startDate),c=M.date.addDays(O(f._endDate),1),i.start<c&&l<=i.end&&(u=n&&n.length?v[n[0].groupIndex]:v[0],h=u.ranges(i.start,i.end,i.isAllDay,!1),h.length&&(p._selection={start:M.timezone.toLocalDate(h[0].start.start),end:M.timezone.toLocalDate(h[h.length-1].end.end),groupIndex:h[0].start.groupIndex,index:h[0].start.index,isAllDay:h[0].start.isDaySlot,events:[]},p._select()))),t)},_selectEvents:function(e,t){var i,n,a,r,o,s,d,l,c=this,u=c.view(),h=u.groups,p=e.length,f=t&&t.length;for(i=0;i<p;i++)if(h&&f){for(n=h[t[0].groupIndex],a=[],r=n.timeSlotCollectionCount(),o=n.daySlotCollectionCount(),s=0;s<r;s++)a=a.concat(n.getTimeSlotCollection(s).events());for(d=0;d<o;d++)a=a.concat(n.getDaySlotCollection(d).events());a=new M.data.Query(a).filter({field:"element[0].getAttribute('data-uid')",operator:"eq",value:e[i]}).toArray(),a[0]&&c._createSelection(a[0].element)}else l=u.element.find(M.format(".k-event[data-uid={0}], .k-task[data-uid={0}]",e[i])),l.length&&c._createSelection(l[0])},_selectable:function(){var t,i=this,n=i.wrapper,a=M.support.mobileOS?"touchend":"mousedown";i.options.selectable&&(i._tabindex(),n.on(a+Z,".k-scheduler-header-all-day td, .k-scheduler-content td, .k-event",function(e){var t=e.which,a=e.button,r=M.support.browser,o=t&&3===t||a&&2==a;M.support.mobileOS&&e.isDefaultPrevented()||(o||i._createSelection(e.currentTarget),n.focus(),r.msie&&r.version<9&&setTimeout(function(){n.focus()}))}),t=e.proxy(i._mouseMove,i),n.on("mousedown"+Z,".k-scheduler-header-all-day td, .k-scheduler-content td",function(e){var i=e.which,a=e.button,r=i&&3===i||a&&2==a;r||n.on("mousemove"+Z,".k-scheduler-header-all-day td, .k-scheduler-content td",t)}),n.on("mouseup"+Z+" mouseleave"+Z,function(){n.off("mousemove"+Z,".k-scheduler-header-all-day td, .k-scheduler-content td",t)}),n.on("focus"+Z,function(){i._selection||i._selectFirstSlot(),i._select()}),n.on("focusout"+Z,function(){i._ctrlKey=i._shiftKey=!1}),n.on("keydown"+Z,$(i._keydown,i)),n.on("keyup"+Z,function(e){i._ctrlKey=e.ctrlKey,i._shiftKey=e.shiftKey}))},_selectFirstSlot:function(){this._createSelection(this.wrapper.find(".k-scheduler-content").find("td:first"))},_select:function(){var t,i,n,a,r,o=this,s=o.view(),d=o.wrapper,l=s.current(),c=o._selection;if(c&&(l&&(l.removeAttribute("id"),l.removeAttribute("aria-label"),d.removeAttr("aria-activedescendant")),s.select(c),l=s.current(),l&&o._old!==l)){if(t=e(l).data("uid"),o._old&&t&&t===e(o._old).data("uid"))return;n=c,a=o._selectedEvents(),r=s._selectedSlots,a[0]?(n=a[0]||c,i=M.format(o.options.messages.ariaEventLabel,n.title,n.start,n.start)):i=M.format(o.options.messages.ariaSlotLabel,n.start,n.end),l.setAttribute("id",o._ariaId),l.setAttribute("aria-label",i),d.attr("aria-activedescendant",o._ariaId),o._old=l,o.trigger("change",{start:c.start,end:c.end,events:a,slots:r,resources:s._resourceBySlot(c)})}},_selectedEvents:function(){for(var e,t=this._selection.events,i=t.length,n=0,a=[];n<i;n++)e=this.occurrenceByUid(t[n]),e&&a.push(e);return a},_mouseMove:function(t){var i=this;clearTimeout(i._moveTimer),i._moveTimer=setTimeout(function(){var n,a,r,o=i.view(),s=i._selection;s&&(n=o.selectionByElement(e(t.currentTarget)),n&&s.groupIndex===n.groupIndex&&(a=n.startDate(),r=n.endDate(),a>=s.end?s.backward=!1:r<=s.start&&(s.backward=!0),s.backward?s.start=a:s.end=r,i._select()))},5)},_viewByIndex:function(e){var t,i=this.views;for(t in i){if(!e)return t;e--}},_keydown:function(i){var n=this,a=i.keyCode,r=n.view(),o=r.options.editable,s=n._selection,d=i.shiftKey;return n._ctrlKey=i.ctrlKey,n._shiftKey=i.shiftKey,s?(a===H.TAB?r.moveToEvent(s,d)&&(n._select(),i.preventDefault()):o&&a===H.ENTER?s.events.length?o.update!==!1&&n.editEvent(s.events[0]):o.create!==!1&&(s.isAllDay&&(s=e.extend({},s,{end:M.date.addDays(s.end,-1)})),n.addEvent(Q({},s,r._resourceBySlot(s)))):a===H.DELETE&&o!==!1&&o.destroy!==!1?n.removeEvent(s.events[0]):a>=49&&a<=57?n.view(n._viewByIndex(a-49)):r.move(s,a,d)&&(r.inRange(s)?n._select():n.date(s.start),i.preventDefault()),n._adjustSelectedDate(),t):(n._selectFirstSlot(),n._select(),t)},_createSelection:function(t){var i,n,a;this._selection&&(this._ctrlKey||this._shiftKey)||(this._selection={events:[],groupIndex:0}),t=e(t),a=this._selection,t.is(".k-event")&&(i=t.attr(M.attr("uid"))),n=this.view().selectionByElement(t),n&&(a.groupIndex=n.groupIndex||0),i&&(n=d(this._data,i)),n&&n.uid&&(i=[n.uid]),this._updateSelection(n,i),this._adjustSelectedDate()},_updateSelection:function(e,i,n){var a,r,o=this._selection;e&&o&&(a=this.view(),e.uid&&(e=a._updateEventForSelection(e)),this._shiftKey&&o.start&&o.end?(r=e.end<o.end,o.end=e.endDate?e.endDate():e.end,r&&a._timeSlotInterval&&M.date.setTime(o.end,-a._timeSlotInterval())):(o.start=e.startDate?e.startDate():e.start,o.end=e.endDate?e.endDate():e.end),o.isAllDay="isDaySlot"in e?e.isDaySlot:e.isAllDay,null!==n&&n!==t&&(o.groupIndex=n),o.index=e.index,o.events=this._ctrlKey?o.events.concat(i||[]):i||[])},options:{name:"Scheduler",date:oe,editable:!0,autoBind:!0,snap:!0,mobile:!1,timezone:"",allDaySlot:!0,min:new Date(1900,0,1),max:new Date(2099,11,31),toolbar:null,footer:{},messages:{today:"Today",pdf:"Export to PDF",save:"Save",cancel:"Cancel",destroy:"Delete",deleteWindowTitle:"Delete event",ariaSlotLabel:"Selected from {0:t} to {1:t}",ariaEventLabel:"{0} on {1:D} at {2:t}",views:{day:"Day",week:"Week",workWeek:"Work Week",agenda:"Agenda",month:"Month",timeline:"Timeline",timelineWeek:"Timeline Week",timelineWorkWeek:"Timeline Work Week",timelineMonth:"Timeline Month"},recurrenceMessages:{deleteWindowTitle:"Delete Recurring Item",deleteWindowOccurrence:"Delete current occurrence",deleteWindowSeries:"Delete the series",editWindowTitle:"Edit Recurring Item",editWindowOccurrence:"Edit current occurrence",editWindowSeries:"Edit the series"},editable:{confirmation:ce},editor:{title:"Title",start:"Start",end:"End",allDayEvent:"All day event",description:"Description",repeat:"Repeat",timezone:" ",startTimezone:"Start timezone",endTimezone:"End timezone",separateTimezones:"Use separate start and end time zones",timezoneEditorTitle:"Timezones",timezoneEditorButton:"Time zone",timezoneTitle:"Time zones",noTimezone:"No timezone",editorTitle:"Event"}},height:null,width:null,resources:[],group:{resources:[],orientation:"horizontal"},views:[],selectable:!1},events:[te,ae,ee,ie,"add","dataBinding","dataBound","moveStart","move","moveEnd","resizeStart","resize","resizeEnd","navigate","change"],destroy:function(){var t,i=this;W.fn.destroy.call(i),i.dataSource&&(i.dataSource.unbind(G,i._refreshHandler),i.dataSource.unbind("progress",i._progressHandler),i.dataSource.unbind("error",i._errorHandler)),i.calendar&&(i.calendar.destroy(),i.popup.destroy()),i.view()&&i.view().destroy(),i._editor&&i._editor.destroy(),this._moveDraggable&&this._moveDraggable.destroy(),this._resizeDraggable&&this._resizeDraggable.destroy(),t=i.element.add(i.wrapper).add(i.toolbar).add(i.popup),t.off(Z),clearTimeout(i._moveTimer),i._model=null,i.toolbar=null,i.element=null,e(window).off("resize"+Z,i._resizeHandler),M.destroy(i.wrapper)},setDataSource:function(e){this.options.dataSource=e,this._dataSource(),this.options.autoBind&&e.fetch()},items:function(){var e=this.wrapper.find(".k-scheduler-content"),t=this.view();return t&&"agenda"===t.options.name?e.find(".k-task"):e.find(".k-event").add(this.wrapper.find(".k-scheduler-header-wrap").find(".k-scheduler-header-all-day").siblings())},_movable:function(){var i,n,a,r,o,s,d,l=this,c=0,u=l._isMobile(),h=l.options.editable&&l.options.editable.move!==!1,p=l.options.editable&&l.options.editable.resize!==!1;(h||p&&u)&&(u&&M.support.mobileOS.android&&(c=5),l._moveDraggable=new M.ui.Draggable(l.element,{distance:c,filter:".k-event",ignore:".k-resize-handle",holdToDrag:u,autoScroll:!0}),h&&l._moveDraggable.bind("dragstart",function(e){var r=l.view(),c=e.currentTarget;return r.options.editable&&r.options.editable.move!==!1?u&&!c.hasClass("k-event-active")?(l.element.find(".k-event-active").removeClass("k-event-active"),e.preventDefault(),t):(o=l.occurrenceByUid(c.attr(M.attr("uid"))),s=o.clone(),s.update(r._eventOptionsForMove(s)),i=r._slotByPosition(e.x.startLocation,e.y.startLocation),a=i.startOffset(e.x.startLocation,e.y.startLocation,l.options.snap),n=i,d=i,i&&!l.trigger("moveStart",{event:o})||e.preventDefault(),t):(e.preventDefault(),t)}).bind("drag",function(e){var t,d,c=l.view(),u=c._slotByPosition(e.x.location,e.y.location);u&&(r=u.startOffset(e.x.location,e.y.location,l.options.snap),u.isDaySlot!==i.isDaySlot?(i=c._slotByPosition(e.x.location,e.y.location),a=i.startOffset(e.x.location,e.y.location,l.options.snap),t=r-a,s.isAllDay=u.isDaySlot,s.start=M.timezone.toLocalDate(a),s.end=M.timezone.toLocalDate(r),c._updateMoveHint(s,u.groupIndex,t),d={start:s.start,end:s.end}):(t=r-a,c._updateMoveHint(s,u.groupIndex,t),d=_(s,t)),l.trigger("move",{event:o,slot:{element:u.element,start:u.startDate(),end:u.endDate(),isDaySlot:u.isDaySlot},resources:c._resourceBySlot(u),start:d.start,end:d.end})?c._updateMoveHint(s,u.groupIndex,t):n=u)}).bind("dragend",function(t){var c,u,h,p,f,m,v,g,k;l.view()._removeMoveHint(),c=r-a,u=_(s,c),h=u.start,p=u.end,f=l.view()._resourceBySlot(n),m=l.view()._resourceBySlot(i),v=l.trigger("moveEnd",{event:o,slot:{element:n.element,start:n.startDate(),end:n.endDate()},start:h,end:p,resources:f}),v||o.start.getTime()===h.getTime()&&o.end.getTime()===p.getTime()&&d.isDaySlot===n.isDaySlot&&M.stringify(f)===M.stringify(m)||(g=l.view()._eventOptionsForMove(o),k=d.isDaySlot!==n.isDaySlot?n.isDaySlot?e.extend({start:n.startDate(),end:n.startDate(),isAllDay:n.isDaySlot},g,f):e.extend({isAllDay:n.isDaySlot,start:h,end:p},g,f):e.extend({isAllDay:o.isAllDay,start:h,end:p},g,f),l._updateEvent(null,o,k,n.groupIndex)),t.currentTarget.removeClass("k-event-active"),this.cancelHold()}).bind("dragcancel",function(){l.view()._removeMoveHint(),this.cancelHold()}),u&&(l._moveDraggable.bind("hold",function(e){l.element.find(".k-scheduler-monthview").length&&e.preventDefault(),l.element.find(".k-event-active").removeClass("k-event-active"),e.currentTarget.addClass("k-event-active")}),M.support.mobileOS.android||l._moveDraggable.userEvents.bind("press",function(e){e.preventDefault()})))},_resizable:function(){function t(e){var t,i={"k-resize-e":"east","k-resize-w":"west","k-resize-n":"north","k-resize-s":"south"};for(t in i)if(e.hasClass(t))return i[t]}var i,n,a,r,o,s=this,d=0;s._isMobile()&&M.support.mobileOS.android&&(d=5),s._resizeDraggable=new M.ui.Draggable(s.element,{distance:d,filter:".k-resize-handle",autoScroll:!0,dragstart:function(t){var d=e(t.currentTarget),l=d.closest(".k-event"),c=l.attr(M.attr("uid")),u=s.view();a=s.occurrenceByUid(c),r=a.clone(),u._updateEventForResize(r),o=u._slotByPosition(t.x.startLocation,t.y.startLocation),s.trigger("resizeStart",{event:a})&&t.preventDefault(),i=M.date.toUtcTime(r.start),n=M.date.toUtcTime(r.end)},drag:function(d){var l,c,u,h,p,f;o&&(l=e(d.currentTarget),c=t(l),u=s.view(),h=u._slotByPosition(d.x.location,d.y.location),h&&o.groupIndex==h.groupIndex&&(o=h,p=i,f=n,"south"==c?!o.isDaySlot&&o.end-M.date.toUtcTime(r.start)>=u._timeSlotInterval()&&(n=r.isAllDay?o.startOffset(d.x.location,d.y.location,s.options.snap):o.endOffset(d.x.location,d.y.location,s.options.snap)):"north"==c?!o.isDaySlot&&M.date.toUtcTime(r.end)-o.start>=u._timeSlotInterval()&&(i=o.startOffset(d.x.location,d.y.location,s.options.snap)):"east"==c?o.isDaySlot&&M.date.toUtcTime(M.date.getDate(o.endDate()))>=M.date.toUtcTime(M.date.getDate(r.start))?n=r.isAllDay?o.startOffset(d.x.location,d.y.location,s.options.snap):o.endOffset(d.x.location,d.y.location,s.options.snap):!o.isDaySlot&&o.end-M.date.toUtcTime(r.start)>=u._timeSlotInterval()&&(n=o.endOffset(d.x.location,d.y.location,s.options.snap)):"west"==c&&(o.isDaySlot&&M.date.toUtcTime(M.date.getDate(r.end))>=M.date.toUtcTime(M.date.getDate(o.startDate()))?i=o.startOffset(d.x.location,d.y.location,s.options.snap):!o.isDaySlot&&M.date.toUtcTime(r.end)-o.start>=u._timeSlotInterval()&&(i=o.startOffset(d.x.location,d.y.location,s.options.snap))),s.trigger("resize",{event:a,slot:{element:o.element,start:o.startDate(),end:o.endDate()},start:M.timezone.toLocalDate(i),end:M.timezone.toLocalDate(n),resources:u._resourceBySlot(o)})?(i=p,n=f):u._updateResizeHint(r,o.groupIndex,i,n)))},dragend:function(d){var l,c=e(d.currentTarget),u=new Date(r.start.getTime()),h=new Date(r.end.getTime()),p=t(c);s.view()._removeResizeHint(),"south"==p?h=M.timezone.toLocalDate(n):"north"==p?u=M.timezone.toLocalDate(i):"east"==p?h=o.isDaySlot?M.date.getDate(M.timezone.toLocalDate(n)):M.timezone.toLocalDate(n):"west"==p&&(o.isDaySlot?(u=new Date(M.timezone.toLocalDate(i)),u.setHours(0),u.setMinutes(0)):u=M.timezone.toLocalDate(i)),l=s.trigger("resizeEnd",{event:a,slot:{element:o.element,start:o.startDate(),end:o.endDate()},start:u,end:h,resources:s.view()._resourceBySlot(o)}),!l&&h.getTime()>=u.getTime()&&(r.start.getTime()==u.getTime()&&r.end.getTime()==h.getTime()||(s.view()._updateEventForResize(a),s._updateEvent(p,a,{start:u,end:h}))),o=null,a=null},dragcancel:function(){s.view()._removeResizeHint(),o=null,a=null}})},_updateEvent:function(e,t,i,n){var a,r=this,o=function(e,t){try{r._preventRefresh=!0,e.update(i),r._convertDates(e)}finally{r._preventRefresh=!1}r.trigger(ie,{event:e})||(t&&t(),r._updateSelection(e,[e.uid],n),r.dataSource.sync())},s=function(e){return e.recurrenceRule?r.dataSource.getByUid(e.uid):r.dataSource.get(e.recurrenceId)},d=function(){var n,a,d=s(t);"south"!=e&&"north"!=e||(i.start&&(n=M.date.getDate(d.start),M.date.setTime(n,V(i.start)),i.start=n),i.end&&(a=M.date.getDate(d.end),M.date.setTime(a,V(i.end)),i.end=a)),r.dataSource._removeExceptions(d),o(d)},l=function(){var e=s(t),i=function(){r._convertDates(e)},n=e.toOccurrence({start:t.start,end:t.end});o(r.dataSource.add(n),i)};t.recurrenceRule||t.isOccurrence()?(a=r.options.messages.recurrenceMessages,r._showRecurringDialog(t,l,d,{title:a.editWindowTitle,text:a.editRecurring?a.editRecurring:he,occurrenceText:a.editWindowOccurrence,seriesText:a.editWindowSeries})):o(r.dataSource.getByUid(t.uid))},_modelForContainer:function(t){return t=e(t).closest("["+M.attr("uid")+"]"),this.dataSource.getByUid(t.attr(M.attr("uid")))},showDialog:function(e){this._editor.showDialog(e)},focus:function(){this.wrapper.focus()},_confirmation:function(e,t){var i,n,a,r,o,s=this.options.editable;s===!0||s.confirmation!==!1?(i=this.options.messages,n=i.deleteWindowTitle,a=typeof s.confirmation===L?s.confirmation:i.editable.confirmation,this._isEditorOpened()&&t.isRecurring()&&(r=this.options.messages.recurrenceMessages,n=r.deleteWindowTitle,a=t.isException()?r.deleteRecurringConfirmation?r.deleteRecurringConfirmation:pe:r.deleteSeriesConfirmation?r.deleteSeriesConfirmation:fe),o=[{name:"destroy",text:i.destroy,click:function(){e()}}],this._isMobile()&&M.mobile.ui.Pane||o.push({name:"canceledit",text:i.cancel,click:function(){e(!0)}}),this._unbindResize(),this.showDialog({model:t,text:a,title:n,buttons:o}),this._bindResize()):e()},addEvent:function(e){var t,i,n=this._editor.editable,a=this.dataSource;e=e||{},i=this.trigger("add",{event:e}),!i&&(n&&n.end()||!n)&&(this.cancelEvent(),e&&e.toJSON&&(e=e.toJSON()),t=a.add(e),t&&(this.cancelEvent(),this._editEvent(t)))},saveEvent:function(){var e,t,i,n=this._editor;n&&(e=n.editable,t=n.container,i=this._modelForContainer(t),t&&e&&e.end()&&!this.trigger(ie,{container:t,event:i})&&(i.isRecurrenceHead()&&this.dataSource._removeExceptions(i),i.dirty||i.isOccurrence()||this._convertDates(i,"remove"),this.dataSource.sync()))},cancelEvent:function(){var e,t=this._editor,i=t.container;i&&(e=this._modelForContainer(i),e&&e.isOccurrence()&&(this._convertDates(e,"remove"),this._convertDates(this.dataSource.get(e.recurrenceId),"remove")),this.dataSource.cancelChanges(e),t.close())},editEvent:function(e){var t="string"==typeof e?this.occurrenceByUid(e):e;t&&(this.cancelEvent(),t.isRecurring()?this._editRecurringDialog(t):this._editEvent(t))},_editEvent:function(e){this._unbindResize(),this._createPopupEditor(e),this._bindResize()},_editRecurringDialog:function(e){var t=this,i=function(){e.isException()?t._editEvent(e):t.addEvent(e)},n=function(){e.recurrenceId&&(e=t.dataSource.get(e.recurrenceId)),t._editEvent(e)},a=t.options.messages.recurrenceMessages;t._showRecurringDialog(e,i,n,{title:a.editWindowTitle,text:a.editRecurring?a.editRecurring:he,occurrenceText:a.editWindowOccurrence,seriesText:a.editWindowSeries})},_showRecurringDialog:function(e,t,i,n){var a=this,r=a.options.editable,o=q(r)?r.editRecurringMode:"dialog";"series"===o?i():"occurrence"===o?t():(this._unbindResize(),a.showDialog({model:e,title:n.title,text:n.text,buttons:[{text:n.occurrenceText,click:t},{text:n.seriesText,click:i}]}),this._bindResize())},_createButton:function(e){var t=e.template||me,i=typeof e===L?e:e.name||e.text,n={className:"k-scheduler-"+(i||"").replace(/\s/g,""),text:i,attr:""};if(!(i||q(e)&&e.template))throw Error("Custom commands should have name specified");return q(e)?(e.className&&(e.className+=" "+n.className),"edit"===i&&q(e.text)&&(e=Q(!0,{},e),e.text=e.text.edit),n=Q(!0,n,k[i],e)):n=Q(!0,n,k[i]),M.template(t)(n)},_convertDates:function(e,t){var i=this.dataSource.reader.timezone,n=e.startTimezone,a=e.endTimezone,r=e.start,o=e.start;t=t||"apply",n=n||a,a=a||n,n&&(i?"apply"===t?(r=M.timezone.convert(e.start,i,n),o=M.timezone.convert(e.end,i,a)):(r=M.timezone.convert(e.start,n,i),o=M.timezone.convert(e.end,a,i)):(r=M.timezone[t](e.start,n),o=M.timezone[t](e.end,a)),e._set("start",r),e._set("end",o))},_createEditor:function(){var e,i=this;e=i._editor=this._isMobile()&&M.mobile.ui.Pane?new y(this.wrapper,Q({},this.options,{target:this,timezone:i.dataSource.reader.timezone,resources:i.resources,createButton:$(this._createButton,this)})):new z(this.wrapper,Q({},this.options,{target:this,createButton:$(this._createButton,this),timezone:i.dataSource.reader.timezone,resources:i.resources})),e.bind("cancel",function(e){return i.trigger("cancel",{container:e.container,event:e.model})?(e.preventDefault(),t):(i.cancelEvent(),i.focus(),t)}),e.bind("edit",function(e){i.trigger(ae,{container:e.container,event:e.model})&&e.preventDefault()}),e.bind("save",function(){i.saveEvent()}),e.bind("remove",function(e){i.removeEvent(e.model)})},_createPopupEditor:function(e){var t=this._editor;e.isNew()&&!e.isOccurrence()||(e.isOccurrence()&&this._convertDates(e.recurrenceId?this.dataSource.get(e.recurrenceId):e),this._convertDates(e)),this.editable=t.editEvent(e)},removeEvent:function(e){var t=this,i="string"==typeof e?t.occurrenceByUid(e):e;i&&(i.isRecurring()?t._deleteRecurringDialog(i):t._confirmation(function(e){e||t._removeEvent(i)},i))},occurrenceByUid:function(e){var t=this.dataSource.getByUid(e);return t||(t=d(this._data,e)),t},occurrencesInRange:function(e,t){return new M.data.Query(this._data).filter({logic:"or",filters:[{logic:"and",filters:[{field:"start",operator:"gte",value:e},{field:"end",operator:"gte",value:e},{field:"start",operator:"lt",value:t}]},{logic:"and",filters:[{field:"start",operator:"lte",value:e},{field:"end",operator:"gt",value:e}]}]}).toArray()},_removeEvent:function(e){this.trigger(te,{event:e})||this.dataSource.remove(e)&&this.dataSource.sync()},_deleteRecurringDialog:function(e){var t,i,n,a,r,o=this,s=e,d=o.options.editable,l=q(d)?d.editRecurringMode:"dialog",c=function(){var e=s.recurrenceId?s:s.toOccurrence(),t=o.dataSource.get(e.recurrenceId);o._convertDates(t),o._removeEvent(e)},u=function(){s.recurrenceId&&(s=o.dataSource.get(s.recurrenceId)),o._removeEvent(s)};("dialog"!=l||o._isEditorOpened())&&(t=function(){o._confirmation(function(e){e||c()},s)},i=function(){o._confirmation(function(e){e||u()},s)}),n=i||u,a=t||c,o._isEditorOpened()?e.isException()?a():n():(r=o.options.messages.recurrenceMessages,o._showRecurringDialog(e,a,n,{title:r.deleteWindowTitle,text:r.deleteRecurring?r.deleteRecurring:ue,occurrenceText:r.deleteWindowOccurrence,seriesText:r.deleteWindowSeries}))},_isEditorOpened:function(){return!!this._editor.container},_unbindView:function(e){var t=this;t.angular("cleanup",function(){return{elements:t.items()}}),e.destroy()},_bindView:function(e){var t=this;t.options.editable&&(t._viewRemoveHandler&&e.unbind(te,t._viewRemoveHandler),t._viewRemoveHandler=function(e){t.removeEvent(e.uid)},e.bind(te,t._viewRemoveHandler),t._viewAddHandler&&e.unbind(ne,t._viewAddHandler),t._viewAddHandler=function(e){t.addEvent(e.eventInfo)},e.bind(ne,this._viewAddHandler),t._viewEditHandler&&e.unbind(ae,t._viewEditHandler),t._viewEditHandler=function(e){t.editEvent(e.uid)},e.bind(ae,this._viewEditHandler)),t._viewNavigateHandler&&e.unbind("navigate",t._viewNavigateHandler),t._viewNavigateHandler=function(e){var i,n;e.view&&(i="isWorkDay"in e,n=i?"changeWorkDay":"changeView",t.trigger("navigate",{view:e.view,isWorkDay:e.isWorkDay,action:n,date:e.date})||(i&&(t._workDayMode=e.isWorkDay),t._selectView(e.view),t.date(e.date)))},e.bind("navigate",t._viewNavigateHandler),t._viewActivateHandler&&e.unbind("activate",t._viewActivateHandler),t._viewActivateHandler=function(){var e=this;t._selection&&(e.constrainSelection(t._selection),t._select(),t._adjustSelectedDate())},e.bind("activate",t._viewActivateHandler)},_selectView:function(e){var t,i,n,a=this;e&&a.views[e]&&(a._selectedView&&a._unbindView(a._selectedView),a._selectedView=a._renderView(e),a._selectedViewName=e,a._viewsCount>1&&(t=ve({views:a.views,view:e,ns:M.ns}),i=a.toolbar.find(".k-scheduler-views li:first-child"),i.is(".k-current-view")?i.replaceWith(t):a.toolbar.find(".k-scheduler-views").prepend(t),n=a.toolbar.find(".k-scheduler-views li").removeClass("k-state-selected"),n.end().find(".k-view-"+e.replace(/\./g,"\\.").toLowerCase()).addClass("k-state-selected")))},view:function(e){var i=this;return e?(i._selectView(e),i.rebind(),t):i._selectedView},viewName:function(){return this.view().name},_renderView:function(e){var t=this._initializeView(e);return this._bindView(t),this._model.set("formattedDate",t.dateForTitle()),this._model.set("formattedShortDate",t.shortDateForTitle()),t},resize:function(e){var t=this.getSize(),i=this._size,n=this.view();n&&n.groups&&(!e&&i&&t.width===i.width&&t.height===i.height||(this.refresh({action:"resize"}),this._size=t))},_adjustSelectedDate:function(){var e=this._model.selectedDate,t=this._selection,i=t.start;i&&!M.date.isInDateRange(e,O(i),O(t.end))&&e.setFullYear(i.getFullYear(),i.getMonth(),i.getDate())},_initializeView:function(e){var t,i,n=this.views[e];if(n){if(t=q(n),i=n.type,typeof i===L&&(i=M.getter(n.type)(window)),!i)throw Error("There is no such view");n=new i(this.wrapper,h(Q(!0,{},this.options,t?n:{},{resources:this.resources,date:this.date(),showWorkHours:this._workDayMode})))}return n},_views:function(){var e,t,i,n,a,r,o,s,d,l=this.options.views;for(this.views={},this._viewsCount=0,o=0,s=l.length;o<s;o++)d=!1,e=l[o],n=q(e),n?(r=a=e.type?e.type:e,typeof r!==L&&(a=e.name||e.title,d=!0)):r=a=e,t=D[a],t&&!d&&(e.type=t.type,t.title=this.options.messages.views[a],"day"===t.type?t.messages={allDay:this.options.messages.allDay}:"agenda"===t.type&&(t.messages={event:this.options.messages.event,date:this.options.messages.date,time:this.options.messages.time})),e=Q({title:a},t,n?e:{}),a&&(this.views[a]=e,this._viewsCount++,i&&!e.selected||(i=a));i&&(this._selectedViewName=i)},rebind:function(){this.dataSource.fetch()},_dataSource:function(){var e=this,t=e.options,i=t.dataSource;i=Y(i)?{data:i}:i,!t.timezone||i instanceof Ce?i instanceof Ce&&(t.timezone=i.options.schema?i.options.schema.timezone:""):i=Q(!0,i,{schema:{timezone:t.timezone}}),e.dataSource&&e._refreshHandler?e.dataSource.unbind(G,e._refreshHandler).unbind("progress",e._progressHandler).unbind("error",e._errorHandler):(e._refreshHandler=$(e.refresh,e),e._progressHandler=$(e._requestStart,e),e._errorHandler=$(e._error,e)),e.dataSource=M.data.SchedulerDataSource.create(i).bind(G,e._refreshHandler).bind("progress",e._progressHandler).bind("error",e._errorHandler),e.options.dataSource=e.dataSource},_error:function(){this._progress(!1)},_requestStart:function(){this._progress(!0)},_progress:function(e){var t=this.element.find(".k-scheduler-content");M.ui.progress(t,e)},_resources:function(){var t,i,n,a,r,o=this,s=o.options.resources;for(t=0;t<s.length;t++){if(i=s[t],n=i.field,a=i.dataSource,!n||!a)throw Error('The "field" and "dataSource" options of the scheduler resource are mandatory.');o.resources.push({field:n,name:i.name||n,title:i.title||n,dataTextField:i.dataTextField||"text",dataValueField:i.dataValueField||"value",dataColorField:i.dataColorField||"color",valuePrimitive:null==i.valuePrimitive||i.valuePrimitive,multiple:i.multiple||!1,dataSource:M.data.DataSource.create(a)})}r=e.map(o.resources,function(e){return e.dataSource.fetch()}),e.when.apply(null,r).then(function(){o.options.autoBind?o.view(o._selectedViewName):o._selectView(o._selectedViewName)})},_initModel:function(){var e=this;e._model=M.observable({selectedDate:new Date(this.options.date),formattedDate:"",formattedShortDate:""}),e._model.bind("change",function(t){
"selectedDate"===t.field&&e.view(e._selectedViewName)})},_wrapper:function(){var e=this,t=e.options,i=t.height,n=t.width;e.wrapper=e.element.addClass("k-widget k-scheduler k-floatwrap").attr("role","grid").attr("aria-multiselectable",!0),e._isMobile()&&e.wrapper.addClass("k-scheduler-mobile"),e._isMobilePhoneView()&&e.wrapper.addClass("k-scheduler-phone"),i&&e.wrapper.height(i),n&&e.wrapper.width(n)},date:function(e){return null!=e&&O(e)>=O(this.options.min)&&O(e)<=O(this.options.max)&&this._model.set("selectedDate",e),O(this._model.get("selectedDate"))},_toolbar:function(){var i,n,a=this,r=a.options,o=[];r.toolbar&&(o=e.isArray(r.toolbar)?r.toolbar:[r.toolbar]),i=this._isMobilePhoneView()?_e:ge,n=e(i({messages:r.messages,pdf:e.grep(o,function(e){return"pdf"==e||"pdf"==e.name}).length>0,ns:M.ns,views:a.views,viewsCount:a._viewsCount})),a.wrapper.append(n),a.toolbar=n,M.bind(a.toolbar,a._model),n.on(X+Z,".k-pdf",function(e){e.preventDefault(),a.saveAsPDF()}),n.on(X+Z,".k-scheduler-navigation li",function(i){var n=e(this),r=new Date(a.date()),o="";if(i.preventDefault(),n.hasClass("k-nav-today"))o="today",r=new Date;else if(n.hasClass("k-nav-next"))o="next",r=a.view().nextDate();else if(n.hasClass("k-nav-prev"))o="previous",r=a.view().previousDate();else if(n.hasClass("k-nav-current")&&!a._isMobilePhoneView())return a._showCalendar(),t;a.trigger("navigate",{view:a._selectedViewName,action:o,date:r})||a.date(r)}),n.on(X+Z,".k-scheduler-views li, .k-scheduler-refresh",function(t){t.preventDefault();var i=e(this).attr(M.attr("name"));a.trigger("navigate",{view:i,action:"changeView",date:a.date()})||(a.view(i),a.element.find(".k-state-expanded").removeClass("k-state-expanded"))}),n.on(X+Z,".k-scheduler-views li.k-current-view",function(){a.element.find(".k-scheduler-views").toggleClass("k-state-expanded")}),n.find("li").hover(function(){e(this).addClass("k-state-hover")},function(){e(this).removeClass("k-state-hover")})},_showCalendar:function(){var t=this,i=t.toolbar.find(".k-nav-current"),n=e('<div class="k-calendar-container"><div class="k-scheduler-calendar"/></div>');t.popup||(t.popup=new U(n,{anchor:i,open:function(){t.calendar||(t.calendar=new j(this.element.find(".k-scheduler-calendar"),{change:function(){var e=this.value();t.trigger("navigate",{view:t._selectedViewName,action:"changeDate",date:e})||(t.date(e),t.popup.close())},min:t.options.min,max:t.options.max})),t.calendar.value(t.date())},copyAnchorStyles:!1})),t.popup.open()},refresh:function(e){var t=this,i=this.view();this._progress(!1),this.angular("cleanup",function(){return{elements:t.items()}}),e=e||{},i&&(e&&"itemchange"===e.action&&(this._editor.editable||this._preventRefresh)||this.trigger("dataBinding",{action:e.action||"rebind",index:e.index,items:e.items})||(e&&"resize"===e.action||!this._editor||this._editor.close(),this._data=this.dataSource.expand(i.startDate(),i.endDate()),i.refreshLayout(),i.render(this._data),this.trigger("dataBound")))},slotByPosition:function(e,t){var i,n=this.view();return n._slotByPosition?(i=n._slotByPosition(e,t),i?{startDate:i.startDate(),endDate:i.endDate(),groupIndex:i.groupIndex,element:i.element,isDaySlot:i.isDaySlot}:null):null},slotByElement:function(t){var i=e(t).offset();return this.slotByPosition(i.left,i.top)},resourcesBySlot:function(e){return this.view()._resourceBySlot(e)}}),D={day:{type:"kendo.ui.DayView"},week:{type:"kendo.ui.WeekView"},workWeek:{type:"kendo.ui.WorkWeekView"},agenda:{type:"kendo.ui.AgendaView"},month:{type:"kendo.ui.MonthView"},timeline:{type:"kendo.ui.TimelineView"},timelineWeek:{type:"kendo.ui.TimelineWeekView"},timelineWorkWeek:{type:"kendo.ui.TimelineWorkWeekView"},timelineMonth:{type:"kendo.ui.TimelineMonthView"}},F.plugin(T),M.PDFMixin&&(M.PDFMixin.extend(T.prototype),x="k-scheduler-pdf-export",T.fn._drawPDF=function(t){var i,n,a,r=this.wrapper,o=r[0].style.cssText;return r.css({width:r.width(),height:r.height()}),r.addClass(x),i=this,n=new e.Deferred,a=r.find(".k-scheduler-content").find("table").css("table-layout","auto"),setTimeout(function(){a.css("table-layout","fixed"),i.resize(!0),i._drawPDFShadow({},{avoidLinks:i.options.pdf.avoidLinks}).done(function(e){var i={page:e,pageNumber:1,progress:1,totalPages:1};t.notify(i),n.resolve(i.page)}).fail(function(e){n.reject(e)}).always(function(){r[0].style.cssText=o,r.removeClass(x),i.resize(!0),i.resize(!0)})}),n}),S=W.extend({init:function(e,t){var i=this,n=M.timezone.windows_zones;if(!n||!M.timezone.zones_titles)throw Error("kendo.timezones.min.js is not included.");W.fn.init.call(i,e,t),i.wrapper=i.element,i._zonesQuery=new M.data.Query(n),i._zoneTitleId=M.guid(),i._zoneTitlePicker(),i._zonePicker(),i._zoneTitle.bind("cascade",function(){this.value()||i._zone.wrapper.hide()}),i._zone.bind("cascade",function(){i._value=this.value(),i.trigger("change")}),i.value(i.options.value)},options:{name:"TimezoneEditor",value:"",optionLabel:"No timezone"},events:["change"],_zoneTitlePicker:function(){var t=this,i=e('<input id="'+t._zoneTitleId+'"/>').appendTo(t.wrapper);t._zoneTitle=new M.ui.DropDownList(i,{dataSource:M.timezone.zones_titles,dataValueField:"other_zone",dataTextField:"name",optionLabel:t.options.optionLabel})},_zonePicker:function(){var t=this,i=e("<input />").appendTo(this.wrapper);t._zone=new M.ui.DropDownList(i,{dataValueField:"zone",dataTextField:"territory",dataSource:t._zonesQuery.data,cascadeFrom:t._zoneTitleId,dataBound:function(){t._value=this.value(),this.wrapper.toggle(this.dataSource.view().length>1)}}),t._zone.wrapper.hide()},destroy:function(){W.fn.destroy.call(this),M.destroy(this.wrapper)},value:function(e){var i,n=this;return e===t?n._value:(i=n._zonesQuery.filter({field:"zone",operator:"eq",value:e}).data[0],i?(n._zoneTitle.value(i.other_zone),n._zone.value(i.zone)):n._zoneTitle.select(0),t)}}),F.plugin(S),E=M.template('<option value="#=other_zone#">#=name#</option>'),C=M.template('<option value="#=zone#">#=territory#</option>'),A=W.extend({init:function(e,t){var i=this,n=M.timezone.windows_zones;if(!n||!M.timezone.zones_titles)throw Error("kendo.timezones.min.js is not included.");W.fn.init.call(i,e,t),i.wrapper=i.element,i._zonesQuery=new M.data.Query(n),i._zoneTitlePicker(),i._zonePicker(),i.value(i.options.value)},options:{name:"MobileTimezoneEditor",optionLabel:"No timezone",value:""},events:["change"],_bindZones:function(e){var t=e?this._filter(e):[];this._zone.html(this._options(t,C))},_filter:function(e){return this._zonesQuery.filter({field:"other_zone",operator:"eq",value:e}).data},_options:function(e,t,i){var n=0,a="",r=e.length;for(i&&(a+=t({other_zone:"",name:i}));n<r;n++)a+=t(e[n]);return a},_zoneTitlePicker:function(){var t=this,i=t._options(M.timezone.zones_titles,E,t.options.optionLabel);t._zoneTitle=e("<select>"+i+"</select>").appendTo(t.wrapper).change(function(){var e=this.value,i=t._zone;t._bindZones(e),e&&i[0].children.length>1?i.show():i.hide(),t._value=i[0].value,t.trigger("change")})},_zonePicker:function(){var t=this;t._zone=e('<select style="display:none"></select>').appendTo(this.wrapper).change(function(){t._value=this.value,t.trigger("change")}),t._bindZones(t._zoneTitle.val()),t._value=t._zone[0].value},destroy:function(){W.fn.destroy.call(this),M.destroy(this.wrapper)},value:function(e){var i,n=this,a=n._zone,r="",o="";return e===t?n._value:(i=n._zonesQuery.filter({field:"zone",operator:"eq",value:e}).data[0],i&&(o=i.zone,r=i.other_zone),n._zoneTitle.val(r),n._bindZones(r),a.val(o),o=a[0].value,o&&a[0].children.length>1?a.show():a.hide(),n._value=o,t)}}),F.plugin(A)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()});
//# sourceMappingURL=kendo.scheduler.min.js.map
