/*
@license
dhtmlxScheduler v.4.4.9 Professional Evaluation

This software is covered by DHTMLX Evaluation License. Contact sales@dhtmlx.com to get Commercial or Enterprise license. Usage without proper license is prohibited.

(c) Dinamenta, UAB.
*/
!function(){function e(e){function t(t){var a={minicalButton:e.$keyboardNavigation.MinicalButton,minicalDate:e.$keyboardNavigation.MinicalCell,scheduler:e.$keyboardNavigation.SchedulerNode,dataArea:e.$keyboardNavigation.DataArea,timeSlot:e.$keyboardNavigation.TimeSlot,event:e.$keyboardNavigation.Event},i={};for(var n in a)i[n.toLowerCase()]=a[n];return t=(t+"").toLowerCase(),i[t]||a.scheduler}e.config.key_nav=!0,e.config.key_nav_step=30,e.addShortcut=function(e,a,i){var n=t(i);n&&n.prototype.bind(e,a);
},e.getShortcutHandler=function(a,i){var n=t(i);if(n){var r=e.$keyboardNavigation.shortcuts.parse(a);if(r.length)return n.prototype.findHandler(r[0])}},e.removeShortcut=function(e,a){var i=t(a);i&&i.prototype.unbind(e)},e.focus=function(){if(e.config.key_nav){var t=e.$keyboardNavigation.dispatcher;t.enable();var a=t.getActiveNode();!a||a instanceof e.$keyboardNavigation.MinicalButton||a instanceof e.$keyboardNavigation.MinicalCell?t.setDefaultNode():t.focusNode(t.getActiveNode())}},e.$keyboardNavigation={},
e._compose=function(){for(var e=Array.prototype.slice.call(arguments,0),t={},a=0;a<e.length;a++){var i=e[a];"function"==typeof i&&(i=new i);for(var n in i)t[n]=i[n]}return t},e.$keyboardNavigation.shortcuts={createCommand:function(){return{modifiers:{shift:!1,alt:!1,ctrl:!1,meta:!1},keyCode:null}},parse:function(e){for(var t=[],a=this.getExpressions(this.trim(e)),i=0;i<a.length;i++){for(var n=this.getWords(a[i]),r=this.createCommand(),s=0;s<n.length;s++)this.commandKeys[n[s]]?r.modifiers[n[s]]=!0:this.specialKeys[n[s]]?r.keyCode=this.specialKeys[n[s]]:r.keyCode=n[s].charCodeAt(0);
t.push(r)}return t},getCommandFromEvent:function(e){var t=this.createCommand();t.modifiers.shift=!!e.shiftKey,t.modifiers.alt=!!e.altKey,t.modifiers.ctrl=!!e.ctrlKey,t.modifiers.meta=!!e.metaKey,t.keyCode=e.which||e.keyCode;var a=String.fromCharCode(t.keyCode);return a&&(t.keyCode=a.toLowerCase().charCodeAt(0)),t},getHashFromEvent:function(e){return this.getHash(this.getCommandFromEvent(e))},getHash:function(e){var t=[];for(var a in e.modifiers)e.modifiers[a]&&t.push(a);return t.push(e.keyCode),t.join(this.junctionChar);
},getExpressions:function(e){return e.split(this.junctionChar)},getWords:function(e){return e.split(this.combinationChar)},trim:function(e){return e.replace(/\s/g,"")},junctionChar:",",combinationChar:"+",commandKeys:{shift:16,alt:18,ctrl:17,meta:!0},specialKeys:{backspace:8,tab:9,enter:13,esc:27,space:32,up:38,down:40,left:37,right:39,home:36,end:35,pageup:33,pagedown:34,"delete":46,insert:45,plus:107,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123}},e.$keyboardNavigation.EventHandler={
_handlers:null,findHandler:function(t){this._handlers||(this._handlers={});var a=e.$keyboardNavigation.shortcuts,i=a.getHash(t);return this._handlers[i]},doAction:function(e,t){var a=this.findHandler(e);a&&(a.call(this,t),t.preventDefault?t.preventDefault():t.returnValue=!1)},bind:function(t,a){this._handlers||(this._handlers={});for(var i=e.$keyboardNavigation.shortcuts,n=i.parse(t),r=0;r<n.length;r++)this._handlers[i.getHash(n[r])]=a},unbind:function(t){for(var a=e.$keyboardNavigation.shortcuts,i=a.parse(t),n=0;n<i.length;n++)this._handlers[a.getHash(i[n])]&&delete this._handlers[a.getHash(i[n])];
},bindAll:function(e){for(var t in e)this.bind(t,e[t])},initKeys:function(){this._handlers||(this._handlers={}),this.keys&&this.bindAll(this.keys)}},function(){e.$keyboardNavigation.getFocusableNodes=e._getFocusableNodes,e.$keyboardNavigation.trapFocus=function(t,a){if(9!=a.keyCode)return!1;for(var i=e.$keyboardNavigation.getFocusableNodes(t),n=document.activeElement,r=-1,s=0;s<i.length;s++)if(i[s]==n){r=s;break}var d,o;if(a.shiftKey){if(d=0>=r?i[i.length-1]:r-1,o=i[d])return o.focus(),a.preventDefault(),
!0}else if(d=r>=i.length-1?0:r+1,o=i[d])return o.focus(),a.preventDefault(),!0;return!1}}(),e.$keyboardNavigation.marker={clear:function(){for(var t=e.$container.querySelectorAll(".dhx_focus_slot"),a=0;a<t.length;a++)t[a].parentNode.removeChild(t[a])},createElement:function(){var e=document.createElement("DIV");return e.setAttribute("tabindex",-1),e.className="dhx_focus_slot",e},renderMultiple:function(t,a,i){for(var n=[],r=new Date(t),s=new Date(Math.min(a.valueOf(),e.date.add(e.date.day_start(new Date(t)),1,"day").valueOf()));r.valueOf()<a.valueOf();)n=n.concat(i.call(this,r,new Date(Math.min(s.valueOf(),a.valueOf())))),
r=e.date.day_start(e.date.add(r,1,"day")),s=e.date.day_start(e.date.add(r,1,"day")),s=new Date(Math.min(s.valueOf(),a.valueOf()));return n},render:function(t,a,i){this.clear();var n=[],r=e.$keyboardNavigation.TimeSlot.prototype._modes,s=e.$keyboardNavigation.TimeSlot.prototype._getMode();switch(s){case r.units:n=this.renderVerticalMarker(t,a,i);break;case r.timeline:n=this.renderTimelineMarker(t,a,i);break;case r.year:n=n.concat(this.renderMultiple(t,a,this.renderYearMarker));break;case r.month:n=this.renderMonthMarker(t,a);
break;case r.weekAgenda:n=n.concat(this.renderMultiple(t,a,this.renderWeekAgendaMarker));break;case r.list:n=this.renderAgendaMarker(t,a);break;case r.dayColumns:n=n.concat(this.renderMultiple(t,a,this.renderVerticalMarker))}this.addWaiAriaLabel(n,t,a,i),this.addDataAttributes(n,t,a,i);for(var d=n.length-1;d>=0;d--)if(n[d].offsetWidth)return n[d];return null},addDataAttributes:function(t,a,i,n){for(var r=e.date.date_to_str(e.config.api_date),s=r(a),d=r(i),o=0;o<t.length;o++)t[o].setAttribute("data-start-date",s),
t[o].setAttribute("data-end-date",d),n&&t[o].setAttribute("data-section",n)},addWaiAriaLabel:function(t,a,i,n){var r="",s=e.getState(),d=s.mode,o=!1;r+=e.templates.day_date(a),e.date.day_start(new Date(a)).valueOf()!=a.valueOf()&&(r+=" "+e.templates.hour_scale(a),o=!0),e.date.day_start(new Date(a)).valueOf()!=e.date.day_start(new Date(i)).valueOf()&&(r+=" - "+e.templates.day_date(i),(o||e.date.day_start(new Date(i)).valueOf()!=i.valueOf())&&(r+=" "+e.templates.hour_scale(i))),n&&(e.matrix&&e.matrix[d]?r+=", "+e.templates[d+"_scale_label"](n.key,n.label,n):e._props&&e._props[d]&&(r+=", "+e.templates[d+"_scale_text"](n.key,n.label,n)));
for(var l=0;l<t.length;l++)e._waiAria.setAttributes(t[l],{"aria-label":r,"aria-live":"polite"})},renderWeekAgendaMarker:function(t,a){for(var i=e.$container.querySelectorAll(".dhx_wa_day_cont .dhx_wa_scale_bar"),n=e.date.week_start(new Date(e.getState().min_date)),r=-1,s=e.date.day_start(new Date(t)),d=0;d<i.length&&(r++,e.date.day_start(new Date(n)).valueOf()!=s.valueOf());d++)n=e.date.add(n,1,"day");return-1!=r?this._wrapDiv(i[r]):[]},_wrapDiv:function(e){var t=this.createElement();return t.style.top=e.offsetTop+"px",
t.style.left=e.offsetLeft+"px",t.style.width=e.offsetWidth+"px",t.style.height=e.offsetHeight+"px",e.appendChild(t),[t]},renderYearMarker:function(t,a){var i=e._get_year_cell(t);i.style.position="relative";var n=this.createElement();return n.style.top="0px",n.style.left="0px",n.style.width="100%",n.style.height="100%",i.appendChild(n),[n]},renderAgendaMarker:function(t,a){var i=this.createElement();return i.style.height="1px",i.style.width="100%",i.style.opacity=1,i.style.top="0px",i.style.left="0px",
e.$container.querySelector(".dhx_cal_data").appendChild(i),[i]},renderTimelineMarker:function(t,a,i){var n=e._lame_copy({},e.matrix[e._mode]),r=n._scales;n.round_position=!1;var s=[],d=t?new Date(t):e._min_date,o=a?new Date(a):e._max_date;if(d.valueOf()<e._min_date.valueOf()&&(d=new Date(e._min_date)),o.valueOf()>e._max_date.valueOf()&&(o=new Date(e._max_date)),!n._trace_x)return s;for(var l=0;l<n._trace_x.length&&!e._is_column_visible(n._trace_x[l]);l++);if(l==n._trace_x.length)return s;var _=r[i];
if(!(a>d&&o>t))return s;var c=this.createElement(),h=e._timeline_getX({start_date:t},!1,n)-1,u=e._timeline_getX({start_date:a},!1,n)-1,g=n._section_height[i]-1||n.dy-1,v=0;e._isRender("cell")&&(v=_.offsetTop,h+=n.dx,u+=n.dx,_=e.$container.querySelector(".dhx_cal_data"));var f=Math.max(1,u-h-1);return c.style.cssText="height: "+g+"px; left: "+h+"px; width: "+f+"px; top: "+v+"px;",_.insertBefore(c,_.firstChild),s.push(c),s},renderMonthCell:function(t){for(var a=e.$container.querySelectorAll(".dhx_month_head"),i=[],n=0;n<a.length;n++)i.push(a[n].parentNode);
for(var r=e.date.week_start(new Date(e.getState().min_date)),s=-1,d=0,o=-1,l=r,_=e.date.day_start(new Date(t)),n=0;n<i.length&&(s++,6==o?(d++,o=0):o++,e.date.day_start(new Date(l)).valueOf()!=_.valueOf());n++)l=e.date.add(l,1,"day");if(-1==s)return[];var c=e._colsS[o],h=e._colsS.heights[d],u=this.createElement();u.style.top=h+"px",u.style.left=c+"px",u.style.width=e._cols[o]+"px",u.style.height=(e._colsS.heights[d+1]-h||e._colsS.height)+"px";var g=e.$container.querySelector(".dhx_cal_data"),v=g.querySelector("table");
return v.nextSibling?g.insertBefore(u,v.nextSibling):g.appendChild(u),u},renderMonthMarker:function(t,a){for(var i=[],n=t;n.valueOf()<a.valueOf();)i.push(this.renderMonthCell(n)),n=e.date.add(n,1,"day");return i},renderVerticalMarker:function(t,a,i){var n=e.locate_holder_day(t),r=[],s=null,d=e.config;if(e._ignores[n])return r;if(e._props&&e._props[e._mode]&&i){var o=e._props[e._mode];n=o.order[i];var l=o.order[i];o.days>1?n=e.locate_holder_day(t)+l:(n=l,o.size&&n>o.position+o.size&&(n=0))}if(s=e.locate_holder(n),
!s||s.querySelector(".dhx_scale_hour"))return document.createElement("div");var _=Math.max(60*t.getHours()+t.getMinutes(),60*d.first_hour),c=Math.min(60*a.getHours()+a.getMinutes(),60*d.last_hour);if(!c&&e.date.day_start(new Date(a)).valueOf()>e.date.day_start(new Date(t)).valueOf()&&(c=60*d.last_hour),_>=c)return[];var h=this.createElement(),u=e.config.hour_size_px*d.last_hour+1,g=36e5;return h.style.top=Math.round((60*_*1e3-e.config.first_hour*g)*e.config.hour_size_px/g)%u+"px",h.style.lineHeight=h.style.height=Math.max(Math.round(60*(c-_)*1e3*e.config.hour_size_px/g)%u,1)+"px",
h.style.width="100%",s.appendChild(h),r.push(h),r[0]}},e.$keyboardNavigation.SchedulerNode=function(){},e.$keyboardNavigation.SchedulerNode.prototype=e._compose(e.$keyboardNavigation.EventHandler,{getDefaultNode:function(){var t=new e.$keyboardNavigation.TimeSlot;return t.isValid()||(t=t.fallback()),t},_modes:{month:"month",year:"year",dayColumns:"dayColumns",timeline:"timeline",units:"units",weekAgenda:"weekAgenda",list:"list"},getMode:function(){var t=e.getState(),a=t.mode;return e.matrix&&e.matrix[a]?this._modes.timeline:e._props&&e._props[a]?this._modes.units:"month"==a?this._modes.month:"year"==a?this._modes.year:"week_agenda"==a?this._modes.weekAgenda:"map"==a||"agenda"==a||e._grid&&e["grid_"+a]?this._modes.list:this._modes.dayColumns;
},focus:function(){e.focus()},blur:function(){},disable:function(){e.$container.setAttribute("tabindex","0")},enable:function(){e.$container&&e.$container.removeAttribute("tabindex")},isEnabled:function(){return e.$container.hasAttribute("tabindex")},_compareEvents:function(e,t){return e.start_date.valueOf()==t.start_date.valueOf()?e.id>t.id?1:-1:e.start_date.valueOf()>t.start_date.valueOf()?1:-1},_pickEvent:function(t,a,i,n){var r=e.getState();t=new Date(Math.max(r.min_date.valueOf(),t.valueOf())),
a=new Date(Math.min(r.max_date.valueOf(),a.valueOf()));var s=e.getEvents(t,a);s.sort(this._compareEvents),n&&(s=s.reverse());for(var d=!!i,o=0;o<s.length&&d;o++)s[o].id==i&&(d=!1),s.splice(o,1),o--;return s[0]},nextEventHandler:function(t){var a=e.$keyboardNavigation.dispatcher.activeNode,i=t||a&&a.eventId,n=null;if(i&&e.getEvent(i)){var r=e.getEvent(i);n=e.$keyboardNavigation.SchedulerNode.prototype._pickEvent(r.start_date,e.date.add(r.start_date,1,"year"),r.id,!1)}if(!n&&!t){var s=e.getState();n=e.$keyboardNavigation.SchedulerNode.prototype._pickEvent(s.min_date,e.date.add(s.min_date,1,"year"),null,!1);
}if(n){var d=new e.$keyboardNavigation.Event(n.id);d.isValid()?(a&&a.blur(),e.$keyboardNavigation.dispatcher.setActiveNode(d)):this.nextEventHandler(n.id)}},prevEventHandler:function(t){var a=e.$keyboardNavigation.dispatcher.activeNode,i=t||a&&a.eventId,n=null;if(i&&e.getEvent(i)){var r=e.getEvent(i);n=e.$keyboardNavigation.SchedulerNode.prototype._pickEvent(e.date.add(r.end_date,-1,"year"),r.end_date,r.id,!0)}if(!n&&!t){var s=e.getState();n=e.$keyboardNavigation.SchedulerNode.prototype._pickEvent(e.date.add(s.max_date,-1,"year"),s.max_date,null,!0);
}if(n){var d=new e.$keyboardNavigation.Event(n.id);d.isValid()?(a&&a.blur(),e.$keyboardNavigation.dispatcher.setActiveNode(d)):this.prevEventHandler(n.id)}},keys:{"alt+1, alt+2, alt+3, alt+4, alt+5, alt+6, alt+7, alt+8, alt+9":function(t){var a=e.$keyboardNavigation.HeaderCell.prototype.getNodes(".dhx_cal_navline .dhx_cal_tab"),i=t.key;void 0===i&&(i=t.keyCode-48),a[1*i-1]&&a[1*i-1].click()},"ctrl+left,meta+left":function(t){e._click.dhx_cal_prev_button()},"ctrl+right,meta+right":function(t){e._click.dhx_cal_next_button();
},"ctrl+up,meta+up":function(t){var a=e.$container.querySelector(".dhx_cal_data");a.scrollTop-=20},"ctrl+down,meta+down":function(t){var a=e.$container.querySelector(".dhx_cal_data");a.scrollTop+=20},e:function(){this.nextEventHandler()},home:function(){e.setCurrentView(new Date)},"shift+e":function(){this.prevEventHandler()},"ctrl+enter,meta+enter":function(){e.addEventNow({start_date:new Date(e.getState().date)})},"ctrl+c,meta+c":function(t){e._key_nav_copy_paste(t)},"ctrl+v,meta+v":function(t){
e._key_nav_copy_paste(t)},"ctrl+x,meta+x":function(t){e._key_nav_copy_paste(t)}}}),e.$keyboardNavigation.SchedulerNode.prototype.bindAll(e.$keyboardNavigation.SchedulerNode.prototype.keys),e.$keyboardNavigation.KeyNavNode=function(){},e.$keyboardNavigation.KeyNavNode.prototype=e._compose(e.$keyboardNavigation.EventHandler,{isValid:function(){return!0},fallback:function(){return null},moveTo:function(t){e.$keyboardNavigation.dispatcher.setActiveNode(t)},compareTo:function(e){if(!e)return!1;for(var t in this){
if(!!this[t]!=!!e[t])return!1;var a=!(!this[t]||!this[t].toString),i=!(!e[t]||!e[t].toString);if(i!=a)return!1;if(i&&a){if(e[t].toString()!=this[t].toString())return!1}else if(e[t]!=this[t])return!1}return!0},getNode:function(){},focus:function(){var e=this.getNode();e&&(e.setAttribute("tabindex","-1"),e.focus&&e.focus())},blur:function(){var e=this.getNode();e&&e.setAttribute("tabindex","-1")}}),e.$keyboardNavigation.HeaderCell=function(e){this.index=e||0},e.$keyboardNavigation.HeaderCell.prototype=e._compose(e.$keyboardNavigation.KeyNavNode,{
getNode:function(e){e=e||this.index||0;var t=this.getNodes();return t[e]?t[e]:void 0},getNodes:function(t){t=t||[".dhx_cal_navline .dhx_cal_prev_button",".dhx_cal_navline .dhx_cal_next_button",".dhx_cal_navline .dhx_cal_today_button",".dhx_cal_navline .dhx_cal_tab"].join(", ");var a=Array.prototype.slice.call(e.$container.querySelectorAll(t));return a.sort(function(e,t){return e.offsetLeft-t.offsetLeft}),a},_handlers:null,isValid:function(){return!!this.getNode(this.index)},fallback:function(){var t=this.getNode(0);
return t||(t=new e.$keyboardNavigation.TimeSlot),t},keys:{left:function(){var t=this.index-1;0>t&&(t=this.getNodes().length-1),this.moveTo(new e.$keyboardNavigation.HeaderCell(t))},right:function(){var t=this.index+1;t>=this.getNodes().length&&(t=0),this.moveTo(new e.$keyboardNavigation.HeaderCell(t))},down:function(){this.moveTo(new e.$keyboardNavigation.TimeSlot)},enter:function(){var e=this.getNode();e&&e.click()}}}),e.$keyboardNavigation.HeaderCell.prototype.bindAll(e.$keyboardNavigation.HeaderCell.prototype.keys),
e.$keyboardNavigation.Event=function(t){if(this.eventId=null,e.getEvent(t)){var a=e.getEvent(t);this.start=new Date(a.start_date),this.end=new Date(a.end_date),this.section=this._getSection(a),this.eventId=t}},e.$keyboardNavigation.Event.prototype=e._compose(e.$keyboardNavigation.KeyNavNode,{_getNodes:function(){return Array.prototype.slice.call(e.$container.querySelectorAll("[event_id]"))},_modes:e.$keyboardNavigation.SchedulerNode.prototype._modes,getMode:e.$keyboardNavigation.SchedulerNode.prototype.getMode,
_handlers:null,isValid:function(){return!(!e.getEvent(this.eventId)||!this.getNode())},fallback:function(){var t=this._getNodes()[0],a=null;if(t&&e._locate_event(t)){var i=e._locate_event(t);a=new e.$keyboardNavigation.Event(i)}else a=new e.$keyboardNavigation.TimeSlot;return a},getNode:function(){var t="[event_id='"+this.eventId+"']",a=e.$keyboardNavigation.dispatcher.getInlineEditor(this.eventId);return a?a:e.$container.querySelector(t)},focus:function(){var t=e.getEvent(this.eventId),a=e.getState();
(t.start_date.valueOf()>a.max_date.valueOf()||t.end_date.valueOf()<=a.min_date.valueOf())&&e.setCurrentView(t.start_date),e.$keyboardNavigation.KeyNavNode.prototype.focus.apply(this)},blur:function(){e.$keyboardNavigation.KeyNavNode.prototype.blur.apply(this)},_getSection:function(t){var a=null,i=e.getState().mode;if(e.matrix&&e.matrix[i]){var n=e.matrix[e.getState().mode];a=t[n.y_property]}else if(e._props&&e._props[i]){var r=e._props[i];a=t[r.map_to]}return a},_moveToSlot:function(t){var a=e.getEvent(this.eventId);
if(a){var i=this._getSection(a),n=new e.$keyboardNavigation.TimeSlot(a.start_date,null,i);this.moveTo(n.nextSlot(n,t))}else this.moveTo(new e.$keyboardNavigation.TimeSlot)},keys:{left:function(){this._moveToSlot("left")},right:function(){this._moveToSlot("right")},down:function(){this.getMode()==this._modes.list?e.$keyboardNavigation.SchedulerNode.prototype.nextEventHandler():this._moveToSlot("down")},space:function(){var t=this.getNode();t&&t.click?t.click():this.moveTo(new e.$keyboardNavigation.TimeSlot);
},up:function(){this.getMode()==this._modes.list?e.$keyboardNavigation.SchedulerNode.prototype.prevEventHandler():this._moveToSlot("up")},"delete":function(){e.getEvent(this.eventId)?e._click.buttons["delete"](this.eventId):this.moveTo(new e.$keyboardNavigation.TimeSlot)},enter:function(){e.getEvent(this.eventId)?e.showLightbox(this.eventId):this.moveTo(new e.$keyboardNavigation.TimeSlot)}}}),e.$keyboardNavigation.Event.prototype.bindAll(e.$keyboardNavigation.Event.prototype.keys),e.$keyboardNavigation.TimeSlot=function(t,a,i,n){
var r=e.getState(),s=e.matrix&&e.matrix[r.mode];t||(t=this.getDefaultDate()),a||(a=s?e.date.add(t,s.x_step,s.x_unit):e.date.add(t,e.config.key_nav_step,"minute")),this.section=i||this._getDefaultSection(),this.start_date=new Date(t),this.end_date=new Date(a),this.movingDate=n||null},e.$keyboardNavigation.TimeSlot.prototype=e._compose(e.$keyboardNavigation.KeyNavNode,{_handlers:null,getDefaultDate:function(){var t,a=e.getState(),i=e.matrix&&e.matrix[a.mode];if(i)t=e.date[i.name+"_start"](new Date(a.date)),
t=this.findVisibleColumn(t);else if(t=new Date(e.getState().min_date),t=this.findVisibleColumn(t),t.setHours(e.config.first_hour),!e._table_view){var n=e.$container.querySelector(".dhx_cal_data");n.scrollTop&&t.setHours(e.config.first_hour+Math.ceil(n.scrollTop/e.config.hour_size_px))}return t},clone:function(t){return new e.$keyboardNavigation.TimeSlot(t.start_date,t.end_date,t.section,t.movingDate)},_getMultisectionView:function(){var t,a=e.getState();return e._props&&e._props[a.mode]?t=e._props[a.mode]:e.matrix&&e.matrix[a.mode]&&(t=e.matrix[a.mode]),
t},_getDefaultSection:function(){var e=null,t=this._getMultisectionView();return t&&!e&&(e=this._getNextSection()),e},_getNextSection:function(e,t){var a=this._getMultisectionView(),i=a.order[e],n=i;n=void 0!==i?i+t:a.size&&a.position?a.position:0,n=0>n?n=(a.options||a.y_unit).length-1:n;var r=a.options||a.y_unit;return r[n]?r[n].key:null},isValid:function(){var t=e.getState(),a=!(this.start_date.valueOf()<t.min_date.valueOf()||this.start_date.valueOf()>=t.max_date.valueOf());if(!a)return!1;if(!this.isVisible(this.start_date,this.end_date))return!1;
var i=this._getMultisectionView();return i?void 0!==i.order[this.section]:!0},fallback:function(){var t=new e.$keyboardNavigation.TimeSlot;return t.isValid()?t:new e.$keyboardNavigation.DataArea},getNodes:function(){return Array.prototype.slice.call(e.$container.querySelectorAll(".dhx_focus_slot"))},getNode:function(){return this.getNodes()[0]},focus:function(){e.$keyboardNavigation.marker.render(this.start_date,this.end_date,this.section),e.$keyboardNavigation.KeyNavNode.prototype.focus.apply(this),
e.$keyboardNavigation._pasteDate=this.start_date,e.$keyboardNavigation._pasteSection=this.section},blur:function(){e.$keyboardNavigation.KeyNavNode.prototype.blur.apply(this),e.$keyboardNavigation.marker.clear()},_modes:e.$keyboardNavigation.SchedulerNode.prototype._modes,_getMode:e.$keyboardNavigation.SchedulerNode.prototype.getMode,addMonthDate:function(t,a,i){var n;switch(a){case"up":n=e.date.add(t,-1,"week");break;case"down":n=e.date.add(t,1,"week");break;case"left":n=e.date.day_start(e.date.add(t,-1,"day")),
n=this.findVisibleColumn(n,-1);break;case"right":n=e.date.day_start(e.date.add(t,1,"day")),n=this.findVisibleColumn(n,1);break;default:n=e.date.day_start(new Date(t))}var r=e.getState();return(t.valueOf()<r.min_date.valueOf()||!i&&t.valueOf()>=r.max_date.valueOf())&&(n=new Date(r.min_date)),n},nextMonthSlot:function(t,a,i){var n,r;return n=this.addMonthDate(t.start_date,a,i),n.setHours(e.config.first_hour),r=new Date(n),r.setHours(e.config.last_hour),{start_date:n,end_date:r}},_alignTimeSlot:function(t,a,i,n){
for(var r=new Date(a);r.valueOf()<t.valueOf();)r=e.date.add(r,n,i);return r.valueOf()>t.valueOf()&&(r=e.date.add(r,-n,i)),r},nextTimelineSlot:function(t,a,i){var n=e.getState(),r=e.matrix[n.mode],s=this._alignTimeSlot(t.start_date,e.date[r.name+"_start"](new Date(t.start_date)),r.x_unit,r.x_step),d=this._alignTimeSlot(t.end_date,e.date[r.name+"_start"](new Date(t.end_date)),r.x_unit,r.x_step);d.valueOf()<=s.valueOf()&&(d=e.date.add(s,r.x_step,r.x_unit));var o=this.clone(t);switch(o.start_date=s,o.end_date=d,
o.section=t.section||this._getNextSection(),a){case"up":o.section=this._getNextSection(t.section,-1);break;case"down":o.section=this._getNextSection(t.section,1);break;case"left":o.start_date=this.findVisibleColumn(e.date.add(o.start_date,-r.x_step,r.x_unit),-1),o.end_date=e.date.add(o.start_date,r.x_step,r.x_unit);break;case"right":o.start_date=this.findVisibleColumn(e.date.add(o.start_date,r.x_step,r.x_unit),1),o.end_date=e.date.add(o.start_date,r.x_step,r.x_unit)}return(o.start_date.valueOf()<n.min_date.valueOf()||o.start_date.valueOf()>=n.max_date.valueOf())&&(i&&o.start_date.valueOf()>=n.max_date.valueOf()?o.start_date=new Date(n.max_date):(o.start_date=e.date[n.mode+"_start"](e.date.add(n.date,"left"==a?-1:1,n.mode)),
o.end_date=e.date.add(o.start_date,r.x_step,r.x_unit))),o},nextUnitsSlot:function(t,a,i){var n=this.clone(t);n.section=t.section||this._getNextSection();var r=t.section||this._getNextSection(),s=e.getState(),d=e._props[s.mode];switch(a){case"left":r=this._getNextSection(t.section,-1);var o=d.size?d.size-1:d.options.length;d.days>1&&d.order[r]==o-1&&e.date.add(t.start_date,-1,"day").valueOf()>=s.min_date.valueOf()&&(n=this.nextDaySlot(t,a,i));break;case"right":r=this._getNextSection(t.section,1),d.days>1&&!d.order[r]&&e.date.add(t.start_date,1,"day").valueOf()<s.max_date.valueOf()&&(n=this.nextDaySlot(t,a,i));
break;default:n=this.nextDaySlot(t,a,i),r=t.section}return n.section=r,n},_moveDate:function(t,a){var i=this.findVisibleColumn(e.date.add(t,a,"day"),a);return i.setHours(t.getHours()),i.setMinutes(t.getMinutes()),i},isBeforeLastHour:function(t,a){var i=t.getMinutes(),n=t.getHours(),r=e.config.last_hour;return r>n||!a&&(24==r||n==r)&&!i},isAfterFirstHour:function(t,a){var i=t.getMinutes(),n=t.getHours(),r=e.config.first_hour,s=e.config.last_hour;return n>=r||!a&&!i&&(!n&&24==s||n==s)},isInVisibleDayTime:function(e,t){
return this.isBeforeLastHour(e,t)&&this.isAfterFirstHour(e,t)},nextDaySlot:function(t,a,i){var n,r,s=e.config.key_nav_step,d=this._alignTimeSlot(t.start_date,e.date.day_start(new Date(t.start_date)),"minute",s),o=t.start_date;switch(a){case"up":if(n=e.date.add(d,-s,"minute"),!this.isInVisibleDayTime(n,!0)&&(!i||this.isInVisibleDayTime(o,!0))){var l=!0;i&&e.date.date_part(new Date(n)).valueOf()!=e.date.date_part(new Date(o)).valueOf()&&(l=!1),l&&(n=this.findVisibleColumn(e.date.add(t.start_date,-1,"day"),-1)),
n.setHours(e.config.last_hour),n.setMinutes(0),n=e.date.add(n,-s,"minute")}r=e.date.add(n,s,"minute");break;case"down":n=e.date.add(d,s,"minute");var _=i?n:e.date.add(n,s,"minute");if(!this.isInVisibleDayTime(_,!1)&&(!i||this.isInVisibleDayTime(o,!1)))if(i){var l=!0;e.date.date_part(new Date(o)).valueOf()==o.valueOf()&&(l=!1),l&&(n=this.findVisibleColumn(e.date.add(t.start_date,1,"day"),1)),n.setHours(e.config.first_hour),n.setMinutes(0),n=e.date.add(n,s,"minute")}else n=this.findVisibleColumn(e.date.add(t.start_date,1,"day"),1),
n.setHours(e.config.first_hour),n.setMinutes(0);r=e.date.add(n,s,"minute");break;case"left":n=this._moveDate(t.start_date,-1),r=this._moveDate(t.end_date,-1);break;case"right":n=this._moveDate(t.start_date,1),r=this._moveDate(t.end_date,1);break;default:n=d,r=e.date.add(n,s,"minute")}return{start_date:n,end_date:r}},nextWeekAgendaSlot:function(t,a){var i,n,r=e.getState();switch(a){case"down":case"left":i=e.date.day_start(e.date.add(t.start_date,-1,"day")),i=this.findVisibleColumn(i,-1);break;case"up":
case"right":i=e.date.day_start(e.date.add(t.start_date,1,"day")),i=this.findVisibleColumn(i,1);break;default:i=e.date.day_start(t.start_date)}return(t.start_date.valueOf()<r.min_date.valueOf()||t.start_date.valueOf()>=r.max_date.valueOf())&&(i=new Date(r.min_date)),n=new Date(i),n.setHours(e.config.last_hour),{start_date:i,end_date:n}},nextAgendaSlot:function(e,t){return{start_date:e.start_date,end_date:e.end_date}},isDateVisible:function(t){if(!e._ignores_detected)return!0;var a,i=e.matrix&&e.matrix[e.getState().mode];
return a=i?e._get_date_index(i,t):e.locate_holder_day(t),!e._ignores[a]},findVisibleColumn:function(t,a){var i=t;a=a||1;for(var n=e.getState();!this.isDateVisible(i)&&(a>0&&i.valueOf()<=n.max_date.valueOf()||0>a&&i.valueOf()>=n.min_date.valueOf());)i=this.nextDateColumn(i,a);return i},nextDateColumn:function(t,a){a=a||1;var i,n=e.matrix&&e.matrix[e.getState().mode];return i=n?e.date.add(t,a*n.x_step,n.x_unit):e.date.day_start(e.date.add(t,a,"day"))},isVisible:function(t,a){if(!e._ignores_detected)return!0;
for(var i=new Date(t);i.valueOf()<a.valueOf();){if(this.isDateVisible(i))return!0;i=this.nextDateColumn(i)}return!1},nextSlot:function(t,a,i,n){var r;i=i||this._getMode();var s=e.$keyboardNavigation.TimeSlot.prototype.clone(t);switch(i){case this._modes.units:r=this.nextUnitsSlot(s,a,n);break;case this._modes.timeline:r=this.nextTimelineSlot(s,a,n);break;case this._modes.year:r=this.nextMonthSlot(s,a,n);break;case this._modes.month:r=this.nextMonthSlot(s,a,n);break;case this._modes.weekAgenda:r=this.nextWeekAgendaSlot(s,a,n);
break;case this._modes.list:r=this.nextAgendaSlot(s,a,n);break;case this._modes.dayColumns:r=this.nextDaySlot(s,a,n)}return r.start_date.valueOf()>=r.end_date.valueOf()&&(r=this.nextSlot(r,a,i)),e.$keyboardNavigation.TimeSlot.prototype.clone(r)},extendSlot:function(t,a){var i,n=this._getMode();switch(n){case this._modes.units:i="left"==a||"right"==a?this.nextUnitsSlot(t,a):this.extendUnitsSlot(t,a);break;case this._modes.timeline:i="down"==a||"up"==a?this.nextTimelineSlot(t,a):this.extendTimelineSlot(t,a);
break;case this._modes.year:i=this.extendMonthSlot(t,a);break;case this._modes.month:i=this.extendMonthSlot(t,a);break;case this._modes.dayColumns:i=this.extendDaySlot(t,a);break;case this._modes.weekAgenda:i=this.extendWeekAgendaSlot(t,a);break;default:i=t}var r=e.getState();return i.start_date.valueOf()<r.min_date.valueOf()&&(i.start_date=this.findVisibleColumn(r.min_date),i.start_date.setHours(e.config.first_hour)),i.end_date.valueOf()>r.max_date.valueOf()&&(i.end_date=this.findVisibleColumn(r.max_date,-1)),
e.$keyboardNavigation.TimeSlot.prototype.clone(i)},extendTimelineSlot:function(e,t){return this.extendGenericSlot({left:"start_date",right:"end_date"},e,t,"timeline")},extendWeekAgendaSlot:function(e,t){return this.extendGenericSlot({left:"start_date",right:"end_date"},e,t,"weekAgenda")},extendGenericSlot:function(t,a,i,n){var r,s=a.movingDate;if(s||(s=t[i]),!s||!t[i])return a;if(!i)return e.$keyboardNavigation.TimeSlot.prototype.clone(a);r=this.nextSlot({start_date:a[s],section:a.section},i,n,!0),
r.start_date.valueOf()==a.start_date.valueOf()&&(r=this.nextSlot({start_date:r.start_date,section:r.section},i,n,!0)),r.movingDate=s;var d=this.extendSlotDates(a,r,r.movingDate);return d.end_date.valueOf()<=d.start_date.valueOf()&&(r.movingDate="end_date"==r.movingDate?"start_date":"end_date"),d=this.extendSlotDates(a,r,r.movingDate),r.start_date=d.start_date,r.end_date=d.end_date,r},extendSlotDates:function(e,t,a){var i={start_date:null,end_date:null};return"start_date"==a?(i.start_date=t.start_date,
i.end_date=e.end_date):(i.start_date=e.start_date,i.end_date=t.start_date),i},extendMonthSlot:function(t,a){var t=this.extendGenericSlot({up:"start_date",down:"end_date",left:"start_date",right:"end_date"},t,a,"month");return t.start_date.setHours(e.config.first_hour),t.end_date=e.date.add(t.end_date,-1,"day"),t.end_date.setHours(e.config.last_hour),t},extendUnitsSlot:function(e,t){var a;switch(t){case"down":case"up":a=this.extendDaySlot(e,t);break;default:a=e}return a.section=e.section,a},extendDaySlot:function(e,t){
return this.extendGenericSlot({up:"start_date",down:"end_date",left:"start_date",right:"end_date"},e,t,"dayColumns")},scrollSlot:function(t){var a=e.getState(),i=this.nextSlot(this,t);(i.start_date.valueOf()<a.min_date.valueOf()||i.start_date.valueOf()>=a.max_date.valueOf())&&e.setCurrentView(new Date(i.start_date)),this.moveTo(i)},keys:{left:function(){this.scrollSlot("left")},right:function(){this.scrollSlot("right")},down:function(){var t=this._getMode();t==this._modes.list?e.$keyboardNavigation.SchedulerNode.prototype.nextEventHandler():this.scrollSlot("down");
},up:function(){var t=this._getMode();t==this._modes.list?e.$keyboardNavigation.SchedulerNode.prototype.prevEventHandler():this.scrollSlot("up")},"shift+down":function(){this.moveTo(this.extendSlot(this,"down"))},"shift+up":function(){this.moveTo(this.extendSlot(this,"up"))},"shift+right":function(){this.moveTo(this.extendSlot(this,"right"))},"shift+left":function(){this.moveTo(this.extendSlot(this,"left"))},enter:function(){var t={start_date:new Date(this.start_date),end_date:new Date(this.end_date)
},a=e.getState().mode;if(e.matrix&&e.matrix[a]){var i=e.matrix[e.getState().mode];t[i.y_property]=this.section}else if(e._props&&e._props[a]){var n=e._props[a];t[n.map_to]=this.section}e.addEventNow(t)}}}),e.$keyboardNavigation.TimeSlot.prototype.bindAll(e.$keyboardNavigation.TimeSlot.prototype.keys),e.$keyboardNavigation.MinicalButton=function(e,t){this.container=e,this.index=t||0},e.$keyboardNavigation.MinicalButton.prototype=e._compose(e.$keyboardNavigation.KeyNavNode,{isValid:function(){var e=this.container;
return!!e.offsetWidth},fallback:function(){var t=new e.$keyboardNavigation.TimeSlot;return t.isValid()?t:new e.$keyboardNavigation.DataArea},focus:function(){e.$keyboardNavigation.dispatcher.globalNode.disable(),this.container.removeAttribute("tabindex"),e.$keyboardNavigation.KeyNavNode.prototype.focus.apply(this)},blur:function(){this.container.setAttribute("tabindex","0"),e.$keyboardNavigation.KeyNavNode.prototype.blur.apply(this)},getNode:function(){return this.index?this.container.querySelector(".dhx_cal_next_button"):this.container.querySelector(".dhx_cal_prev_button");
},keys:{right:function(t){this.moveTo(new e.$keyboardNavigation.MinicalButton(this.container,this.index?0:1))},left:function(t){this.moveTo(new e.$keyboardNavigation.MinicalButton(this.container,this.index?0:1))},down:function(){var t=new e.$keyboardNavigation.MinicalCell(this.container,0,0);t&&!t.isValid()&&(t=t.fallback()),this.moveTo(t)},enter:function(e){this.getNode().click()}}}),e.$keyboardNavigation.MinicalButton.prototype.bindAll(e.$keyboardNavigation.MinicalButton.prototype.keys),e.$keyboardNavigation.MinicalCell=function(e,t,a){
this.container=e,this.row=t||0,this.col=a||0},e.$keyboardNavigation.MinicalCell.prototype=e._compose(e.$keyboardNavigation.KeyNavNode,{isValid:function(){var e=this._getGrid();return!(!e[this.row]||!e[this.row][this.col])},fallback:function(){var t=this.row,a=this.col,i=this._getGrid();i[t]||(t=0);var n=!0;if(t>i.length/2&&(n=!1),!i[t]){var r=new e.$keyboardNavigation.TimeSlot;return r.isValid()?r:new e.$keyboardNavigation.DataArea}if(n){for(var s=a;i[t]&&s<i[t].length;s++)if(i[t][s]||s!=i[t].length-1||(t++,
a=0),i[t][s])return new e.$keyboardNavigation.MinicalCell(this.container,t,s)}else for(var s=a;i[t]&&s<i[t].length;s--)if(i[t][s]||s||(t--,a=i[t].length-1),i[t][s])return new e.$keyboardNavigation.MinicalCell(this.container,t,s);return new e.$keyboardNavigation.MinicalButton(this.container,0)},focus:function(){e.$keyboardNavigation.dispatcher.globalNode.disable(),this.container.removeAttribute("tabindex"),e.$keyboardNavigation.KeyNavNode.prototype.focus.apply(this)},blur:function(){this.container.setAttribute("tabindex","0"),
e.$keyboardNavigation.KeyNavNode.prototype.blur.apply(this)},_getNode:function(e,t){return this.container.querySelector(".dhx_year_body tr:nth-child("+(e+1)+") td:nth-child("+(t+1)+")")},getNode:function(){return this._getNode(this.row,this.col)},_getGrid:function(){for(var t=this.container.querySelectorAll(".dhx_year_body tr"),a=[],i=0;i<t.length;i++){a[i]=[];for(var n=t[i],r=n.querySelectorAll("td"),s=0;s<r.length;s++){var d=r[s],o=!0,l=e._getClassName(d);(l.indexOf("dhx_after")>-1||l.indexOf("dhx_before")>-1||l.indexOf("dhx_scale_ignore")>-1)&&(o=!1),
a[i][s]=o}}return a},keys:{right:function(t){var a=this._getGrid(),i=this.row,n=this.col+1;a[i]&&a[i][n]||(a[i+1]?(i+=1,n=0):n=this.col);var r=new e.$keyboardNavigation.MinicalCell(this.container,i,n);r.isValid()||(r=r.fallback()),this.moveTo(r)},left:function(t){var a=this._getGrid(),i=this.row,n=this.col-1;a[i]&&a[i][n]||(a[i-1]?(i-=1,n=a[i].length-1):n=this.col);var r=new e.$keyboardNavigation.MinicalCell(this.container,i,n);r.isValid()||(r=r.fallback()),this.moveTo(r)},down:function(){var t=this._getGrid(),a=this.row+1,i=this.col;
t[a]&&t[a][i]||(a=this.row);var n=new e.$keyboardNavigation.MinicalCell(this.container,a,i);n.isValid()||(n=n.fallback()),this.moveTo(n)},up:function(){var t=this._getGrid(),a=this.row-1,i=this.col;if(t[a]&&t[a][i]){var n=new e.$keyboardNavigation.MinicalCell(this.container,a,i);n.isValid()||(n=n.fallback()),this.moveTo(n)}else{var r=0;this.col>t[this.row].length/2&&(r=1),this.moveTo(new e.$keyboardNavigation.MinicalButton(this.container,r))}},enter:function(e){this.getNode().querySelector(".dhx_month_head").click();
}}}),e.$keyboardNavigation.MinicalCell.prototype.bindAll(e.$keyboardNavigation.MinicalCell.prototype.keys),e.$keyboardNavigation.DataArea=function(e){this.index=e||0},e.$keyboardNavigation.DataArea.prototype=e._compose(e.$keyboardNavigation.KeyNavNode,{getNode:function(t){return e.$container.querySelector(".dhx_cal_data")},_handlers:null,isValid:function(){return!0},fallback:function(){return this},keys:{"up,down,right,left":function(){this.moveTo(new e.$keyboardNavigation.TimeSlot)}}}),e.$keyboardNavigation.DataArea.prototype.bindAll(e.$keyboardNavigation.DataArea.prototype.keys),
dhtmlx._modalsStack||(dhtmlx._modalsStack=[]),function(){function t(){return!(!l.length&&!dhtmlx._modalsStack.length)}function a(e,t){for(;e&&e!=t;)e=e.parentNode;return!(e!=t)}function i(i){setTimeout(function(){t()||a(document.activeElement,e.$container)||e.focus()},1)}function n(t){e.eventRemove(t,"keydown",d),e.event(t,"keydown",d),l.push(t)}function r(){var t=l.pop();t&&e.eventRemove(t,"keydown",d),i(t)}function s(e){return dhtmlx._modalsStack.length?e==dhtmlx._modalsStack[dhtmlx._modalsStack.length-1]:e==l[l.length-1];
}function d(t){var t=t||window.event,a=t.currentTarget;s(a)&&e.$keyboardNavigation.trapFocus(a,t)}function o(){n(e.getLightbox())}var l=[];if(e.attachEvent("onLightbox",o),e.attachEvent("onAfterLightbox",r),e.attachEvent("onAfterQuickInfo",function(){i()}),!dhtmlx._keyNavMessagePopup){dhtmlx._keyNavMessagePopup=!0;var _=null,c=null;dhtmlx.attachEvent("onMessagePopup",function(t){for(_=document.activeElement,c=_;c&&e._getClassName(c).indexOf("dhx_cal_data")<0;)c=c.parentNode;c&&(c=c.parentNode),e.eventRemove(t,"keydown",d),
e.event(t,"keydown",d),dhtmlx._modalsStack.push(t)}),dhtmlx.attachEvent("onAfterMessagePopup",function(){var t=dhtmlx._modalsStack.pop();t&&e.eventRemove(t,"keydown",d),setTimeout(function(){for(var t=document.activeElement;t&&e._getClassName(t).indexOf("dhx_cal_light")<0;)t=t.parentNode;t||(_&&_.parentNode?_.focus():c&&c.parentNode&&c.focus(),_=null,c=null)},1)})}e.$keyboardNavigation.isModal=t}(),e.$keyboardNavigation.dispatcher={isActive:!1,activeNode:null,globalNode:new e.$keyboardNavigation.SchedulerNode,
enable:function(){e.$container&&(this.isActive=!0,this.globalNode.enable(),this.setActiveNode(this.getActiveNode()))},disable:function(){this.isActive=!1,this.globalNode.disable()},isEnabled:function(){return!!this.isActive},getDefaultNode:function(){return this.globalNode.getDefaultNode()},setDefaultNode:function(){this.setActiveNode(this.getDefaultNode())},getActiveNode:function(){var e=this.activeNode;return e&&!e.isValid()&&(e=e.fallback()),e},focusGlobalNode:function(){this.blurNode(this.globalNode),
this.focusNode(this.globalNode)},setActiveNode:function(e){e&&e.isValid()&&(this.activeNode&&this.activeNode.compareTo(e)||this.isEnabled()&&(this.blurNode(this.activeNode),this.activeNode=e,this.focusNode(this.activeNode)))},focusNode:function(t){t&&t.focus&&(t.focus(),t.getNode&&document.activeElement!=t.getNode()&&this.setActiveNode(new e.$keyboardNavigation.DataArea))},blurNode:function(e){e&&e.blur&&e.blur()},getInlineEditor:function(t){var a=e.$container.querySelector(".dhx_cal_editor[event_id='"+t+"'] textarea");
return a&&a.offsetWidth?a:null},keyDownHandler:function(t){if(!t.defaultPrevented){var a=this.getActiveNode();if((!e.$keyboardNavigation.isModal()||a&&a.container&&e._locate_css({target:a.container},"dhx_minical_popup",!1))&&(!e.getState().editor_id||!this.getInlineEditor(e.getState().editor_id))&&this.isEnabled()){t=t||window.event;var i=this.globalNode,n=e.$keyboardNavigation.shortcuts.getCommandFromEvent(t);a?a.findHandler(n)?a.doAction(n,t):i.findHandler(n)&&i.doAction(n,t):this.setDefaultNode();
}}},_timeout:null,delay:function(e,t){clearTimeout(this._timeout),this._timeout=setTimeout(e,t||1)}},e._temp_key_scope=function(){function t(e){e=e||window.event,d.x=e.clientX,d.y=e.clientY}function a(){for(var t=!1,a=!1,i=document.elementFromPoint(d.x,d.y);i&&i!=e._obj;)i=i.parentNode;return t=!(i!=e._obj),a=e.$keyboardNavigation.dispatcher.isEnabled(),t||a}function i(e){delete e.rec_type,delete e.rec_pattern,delete e.event_pid,delete e.event_length}function n(t){return e._lame_copy({},t)}function r(){
var t=e.$keyboardNavigation.dispatcher.getActiveNode();return t&&t.eventId?t.eventId:e._select_id}e.config.key_nav=!0,e.$keyboardNavigation._pasteDate=null,e.$keyboardNavigation._pasteSection=null;var s=null,d={};document.body?dhtmlxEvent(document.body,"mousemove",t):dhtmlxEvent(window,"load",function(){dhtmlxEvent(document.body,"mousemove",t)}),e.attachEvent("onMouseMove",function(t,a){var i=e.getState();if(i.mode&&i.min_date){var n=e.getActionData(a);e.$keyboardNavigation._pasteDate=n.date,e.$keyboardNavigation._pasteSection=n.section;
}}),e._make_pasted_event=function(t){var a=e.$keyboardNavigation._pasteDate,r=e.$keyboardNavigation._pasteSection,s=t.end_date-t.start_date,d=n(t);if(i(d),d.start_date=new Date(a),d.end_date=new Date(d.start_date.valueOf()+s),r){var o=e._get_section_property();e.config.multisection?d[o]=t[o]:d[o]=r}return d},e._do_paste=function(t,a,i){e.addEvent(a),e.callEvent("onEventPasted",[t,a,i])},e._is_key_nav_active=function(){return this._is_initialized()&&!this._is_lightbox_open()&&this.config.key_nav?!0:!1;
},e.event(document,"keydown",function(t){(t.ctrlKey||t.metaKey)&&86==t.keyCode&&e._buffer_event&&!e.$keyboardNavigation.dispatcher.isEnabled()&&(e.$keyboardNavigation.dispatcher.isActive=a())}),e._key_nav_copy_paste=function(t){if(!e._is_key_nav_active())return!0;if(t=t||event,37==t.keyCode||39==t.keyCode){t.cancelBubble=!0;var i=e.date.add(e._date,37==t.keyCode?-1:1,e._mode);return e.setCurrentView(i),!0}var d=r();if((t.ctrlKey||t.metaKey)&&67==t.keyCode)return d&&(e._buffer_event=n(e.getEvent(d)),
s=!0,e.callEvent("onEventCopied",[e.getEvent(d)])),!0;if((t.ctrlKey||t.metaKey)&&88==t.keyCode&&d){s=!1;var o=e._buffer_event=n(e.getEvent(d));e.updateEvent(o.id),e.callEvent("onEventCut",[o])}if((t.ctrlKey||t.metaKey)&&86==t.keyCode&&a(t)){var o=e._buffer_event?e.getEvent(e._buffer_event.id):e._buffer_event;if(o=o||e._buffer_event){var l=e._make_pasted_event(o);if(s)l.id=e.uid(),e._do_paste(s,l,o);else{var _=e.callEvent("onBeforeEventChanged",[l,t,!1,o]);_&&(e._do_paste(s,l,o),s=!0)}}return!0}}},
e._temp_key_scope(),function(){function t(){if(e.config.key_nav){var t,a=document.activeElement;return t=!a||e._locate_css(a,"dhx_cal_quick_info",!1)?!1:e.$keyboardNavigation.isChildOf(a,e.$container)||e.$keyboardNavigation.isMinical(a)}}function a(e){e&&!i.isEnabled()?i.enable():!e&&i.isEnabled()&&i.disable()}e.$keyboardNavigation.attachSchedulerHandlers=function(){function t(t){if(!e.config.key_nav)return!0;var a,i=e.$keyboardNavigation.isChildOf(t.target||t.srcElement,e.$container.querySelector(".dhx_cal_data")),r=e.getActionData(t);
e._locate_event(t.target||t.srcElement)?a=new e.$keyboardNavigation.Event(e._locate_event(t.target||t.srcElement)):i&&(a=new e.$keyboardNavigation.TimeSlot,r.date&&i&&(a=a.nextSlot(new e.$keyboardNavigation.TimeSlot(r.date,null,r.section)))),a&&(n.isEnabled()?r.date&&i&&n.delay(function(){n.setActiveNode(a)}):n.activeNode=a)}function a(t){if(e.config.key_nav&&n.isEnabled()){var a=t,i=new e.$keyboardNavigation.Event(a.eventId);if(!i.isValid()){var r=i.start||a.start,s=i.end||a.end,d=i.section||a.section;
i=new e.$keyboardNavigation.TimeSlot(r,s,d),i.isValid()||(i=new e.$keyboardNavigation.TimeSlot)}n.setActiveNode(i);var o=n.getActiveNode();o&&o.getNode&&document.activeElement!=o.getNode()&&n.focusNode(n.getActiveNode())}}var i,n=e.$keyboardNavigation.dispatcher,r=function(t){return e.config.key_nav?n.keyDownHandler(t):void 0},s=function(){n.focusGlobalNode()};e.attachEvent("onDataRender",function(){e.config.key_nav&&n.isEnabled()&&!e.getState().editor_id&&(clearTimeout(i),i=setTimeout(function(){
n.isEnabled()||n.enable();var t=n.getActiveNode();t instanceof e.$keyboardNavigation.MinicalButton||t instanceof e.$keyboardNavigation.MinicalCell||(t.isValid()?n.focusNode(t):n.setActiveNode(t.fallback()),n.focusNode(n.getActiveNode()))}))}),e.attachEvent("onSchedulerReady",function(){var a=e.$container;e.eventRemove(document,"keydown",r),e.eventRemove(a,"mousedown",t),e.eventRemove(a,"focus",s),e.config.key_nav?(e.event(document,"keydown",r),e.event(a,"mousedown",t),e.event(a,"focus",s),a.setAttribute("tabindex","0")):a.removeAttribute("tabindex");
});var d=e.updateEvent;e.updateEvent=function(t){var i=d.apply(this,arguments);if(e.config.key_nav&&n.isEnabled()&&e.getState().select_id==t){var r=new e.$keyboardNavigation.Event(t);e.getState().lightbox_id||a(r)}return i},e.attachEvent("onEventDeleted",function(t){if(!e.config.key_nav)return!0;if(n.isEnabled()){var a=n.getActiveNode();a.eventId==t&&n.setActiveNode(new e.$keyboardNavigation.TimeSlot)}return!0}),e.attachEvent("onClearAll",function(){return e.config.key_nav?void(n.isEnabled()&&n.getActiveNode()instanceof e.$keyboardNavigation.Event&&n.setActiveNode(new e.$keyboardNavigation.TimeSlot)):!0;
})},e.$keyboardNavigation._minicalendars=[],e.$keyboardNavigation.isMinical=function(t){for(var a=e.$keyboardNavigation._minicalendars,i=0;i<a.length;i++)if(this.isChildOf(t,a[i]))return!0;return!1},e.$keyboardNavigation.isChildOf=function(e,t){for(;e&&e!==t;)e=e.parentNode;return!(e!==t)},e.$keyboardNavigation.patchMinicalendar=function(){function t(t){var a=t.target;i.enable(),i.setActiveNode(new e.$keyboardNavigation.MinicalButton(a,0))}function a(t){var a=t.target||t.srcElement,n=e._locate_css(t,"dhx_cal_prev_button",!1),r=e._locate_css(t,"dhx_cal_next_button",!1),s=e._locate_css(t,"dhx_year_body",!1),d=0,o=0;
if(s){for(var l,_,c=a;c&&"td"!=c.tagName.toLowerCase();)c=c.parentNode;if(c&&(_=c,l=_.parentNode),l&&_){for(var h=l.parentNode.querySelectorAll("tr"),u=0;u<h.length;u++)if(h[u]==l){d=u;break}for(var g=l.querySelectorAll("td"),u=0;u<g.length;u++)if(g[u]==_){o=u;break}}}var v=t.currentTarget;i.delay(function(){if(n||r||s){var t;n?(t=new e.$keyboardNavigation.MinicalButton(v,0),i.setActiveNode(new e.$keyboardNavigation.MinicalButton(v,0))):r?t=new e.$keyboardNavigation.MinicalButton(v,1):s&&(t=new e.$keyboardNavigation.MinicalCell(v,d,o)),
t&&(i.enable(),t.isValid()&&(i.activeNode=null,i.setActiveNode(t)))}})}var i=e.$keyboardNavigation.dispatcher;if(e.renderCalendar){var n=e.renderCalendar;e.renderCalendar=function(){var r=n.apply(this,arguments),s=e.$keyboardNavigation._minicalendars;e.eventRemove(r,"click",a),e.event(r,"click",a),e.eventRemove(r,"focus",t),e.event(r,"focus",t);for(var d=!1,o=0;o<s.length;o++)if(s[o]==r){d=!0;break}if(d||s.push(r),i.isEnabled()){var l=i.getActiveNode();l&&l.container==r?i.focusNode(l):r.setAttribute("tabindex","0");
}else r.setAttribute("tabindex","0");return r}}if(e.destroyCalendar){var r=e.destroyCalendar;e.destroyCalendar=function(a,i){a=a||(e._def_count?e._def_count.firstChild:null);var n=r.apply(this,arguments);if(!a||!a.parentNode)for(var s=e.$keyboardNavigation._minicalendars,d=0;d<s.length;d++)s[d]==a&&(e.eventRemove(s[d],"focus",t),s.splice(d,1),d--);return n}}};var i=e.$keyboardNavigation.dispatcher;if(e.$keyboardNavigation.attachSchedulerHandlers(),e.renderCalendar)e.$keyboardNavigation.patchMinicalendar();else var n=e.attachEvent("onSchedulerReady",function(){
e.detachEvent(n),e.$keyboardNavigation.patchMinicalendar()});setInterval(function(){if(e.$container&&e.$keyboardNavigation.isChildOf(e.$container,document.body)){var n=t();n?a(n):!n&&i.isEnabled()&&setTimeout(function(){e.config.key_nav?a(t()):e.$container.removeAttribute("tabindex")},100)}},500)}()}window.Scheduler?window.Scheduler.plugin(e):e(window.scheduler)}();