/*

@license
dhtmlxScheduler.Net v.4.0.3 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) XB Software Ltd.

*/
!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},n={};for(var i in a)n[i.toLowerCase()]=a[i];return t=(t+"").toLowerCase(),n[t]||a.scheduler}e.config.key_nav=!0,e.config.key_nav_step=30,e.addShortcut=function(e,a,n){var i=t(n)
;i&&i.prototype.bind(e,a)},e.getShortcutHandler=function(a,n){var i=t(n);if(i){var r=e.$keyboardNavigation.shortcuts.parse(a);if(r.length)return i.prototype.findHandler(r[0])}},e.removeShortcut=function(e,a){var n=t(a);n&&n.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 n=e[a];"function"==typeof n&&(n=new n);for(var i in n)t[i]=n[i]}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)),n=0;n<a.length;n++){for(var i=this.getWords(a[n]),r=this.createCommand(),o=0;o<i.length;o++)this.commandKeys[i[o]]?r.modifiers[i[o]]=!0:this.specialKeys[i[o]]?r.keyCode=this.specialKeys[i[o]]:r.keyCode=i[o].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,
t.keyCode>=96&&t.keyCode<=105&&(t.keyCode-=48);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,n=a.getHash(t);return this._handlers[n]},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 n=e.$keyboardNavigation.shortcuts,i=n.parse(t),r=0;r<i.length;r++)this._handlers[n.getHash(i[r])]=a},unbind:function(t){
for(var a=e.$keyboardNavigation.shortcuts,n=a.parse(t),i=0;i<n.length;i++)this._handlers[a.getHash(n[i])]&&delete this._handlers[a.getHash(n[i])]},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 n=e.$keyboardNavigation.getFocusableNodes(t),i=document.activeElement,r=-1,o=0;o<n.length;o++)if(n[o]==i){r=o;break}var d,l;if(a.shiftKey){if(d=r<=0?n.length-1:r-1,l=n[d])return l.focus(),a.preventDefault(),!0}else if(d=r>=n.length-1?0:r+1,l=n[d])return l.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,n){for(var i=[],r=new Date(t),o=new Date(Math.min(a.valueOf(),e.date.add(e.date.day_start(new Date(t)),1,"day").valueOf()));r.valueOf()<a.valueOf();)i=i.concat(n.call(this,r,new Date(Math.min(o.valueOf(),a.valueOf())))),r=e.date.day_start(e.date.add(r,1,"day")),o=e.date.day_start(e.date.add(r,1,"day")),o=new Date(Math.min(o.valueOf(),a.valueOf()));return i},
render:function(t,a,n){this.clear();var i=[],r=e.$keyboardNavigation.TimeSlot.prototype._modes;switch(e.$keyboardNavigation.TimeSlot.prototype._getMode()){case r.units:i=this.renderVerticalMarker(t,a,n);break;case r.timeline:i=this.renderTimelineMarker(t,a,n);break;case r.year:i=i.concat(this.renderMultiple(t,a,this.renderYearMarker));break;case r.month:i=this.renderMonthMarker(t,a);break;case r.weekAgenda:i=i.concat(this.renderMultiple(t,a,this.renderWeekAgendaMarker));break;case r.list:
i=this.renderAgendaMarker(t,a);break;case r.dayColumns:i=i.concat(this.renderMultiple(t,a,this.renderVerticalMarker))}this.addWaiAriaLabel(i,t,a,n),this.addDataAttributes(i,t,a,n);for(var o=i.length-1;o>=0;o--)if(i[o].offsetWidth)return i[o];return null},addDataAttributes:function(t,a,n,i){for(var r=e.date.date_to_str(e.config.api_date),o=r(a),d=r(n),l=0;l<t.length;l++)t[l].setAttribute("data-start-date",o),t[l].setAttribute("data-end-date",d),i&&t[l].setAttribute("data-section",i)},
addWaiAriaLabel:function(t,a,n,i){var r="",o=e.getState(),d=o.mode,l=!1;r+=e.templates.day_date(a),e.date.day_start(new Date(a)).valueOf()!=a.valueOf()&&(r+=" "+e.templates.hour_scale(a),l=!0),e.date.day_start(new Date(a)).valueOf()!=e.date.day_start(new Date(n)).valueOf()&&(r+=" - "+e.templates.day_date(n),(l||e.date.day_start(new Date(n)).valueOf()!=n.valueOf())&&(r+=" "+e.templates.hour_scale(n))),
i&&(e.matrix&&e.matrix[d]?r+=", "+e.templates[d+"_scale_label"](i.key,i.label,i):e._props&&e._props[d]&&(r+=", "+e.templates[d+"_scale_text"](i.key,i.label,i)));for(var s=0;s<t.length;s++)e._waiAria.setAttributes(t[s],{"aria-label":r,"aria-live":"polite"})},renderWeekAgendaMarker:function(t,a){for(var n=e.$container.querySelectorAll(".dhx_wa_day_cont .dhx_wa_scale_bar"),i=e.date.week_start(new Date(e.getState().min_date)),r=-1,o=e.date.day_start(new Date(t)),d=0;d<n.length&&(r++,
e.date.day_start(new Date(i)).valueOf()!=o.valueOf());d++)i=e.date.add(i,1,"day");return-1!=r?this._wrapDiv(n[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 n=e._get_year_cell(t);n.style.position="relative";var i=this.createElement();return i.style.top="0px",i.style.left="0px",i.style.width="100%",
i.style.height="100%",n.appendChild(i),[i]},renderAgendaMarker:function(t,a){var n=this.createElement();return n.style.height="1px",n.style.width="100%",n.style.opacity=1,n.style.top="0px",n.style.left="0px",e.$container.querySelector(".dhx_cal_data").appendChild(n),[n]},renderTimelineMarker:function(t,a,n){var i=e._lame_copy({},e.matrix[e._mode]),r=i._scales;i.round_position=!1;var o=[],d=t?new Date(t):e._min_date,l=a?new Date(a):e._max_date
;if(d.valueOf()<e._min_date.valueOf()&&(d=new Date(e._min_date)),l.valueOf()>e._max_date.valueOf()&&(l=new Date(e._max_date)),!i._trace_x)return o;for(var s=0;s<i._trace_x.length&&!e._is_column_visible(i._trace_x[s]);s++);if(s==i._trace_x.length)return o;var _=r[n];if(!(d<a&&l>t))return o;var c=this.createElement(),u=e._timeline_getX({start_date:t},!1,i)-1,h=e._timeline_getX({start_date:a},!1,i)-1,p=i._section_height[n]-1||i.dy-1,v=0;e._isRender("cell")&&(v=_.offsetTop,u+=i.dx,h+=i.dx,
_=e.$container.querySelector(".dhx_cal_data"));var g=Math.max(1,h-u-1);return c.style.cssText="height: "+p+"px; left: "+u+"px; width: "+g+"px; top: "+v+"px;",_.appendChild(c),o.push(c),o},renderMonthCell:function(t){for(var a=e.$container.querySelectorAll(".dhx_month_head"),n=[],i=0;i<a.length;i++)n.push(a[i].parentNode);for(var r=e.date.week_start(new Date(e.getState().min_date)),o=-1,d=0,l=-1,s=r,_=e.date.day_start(new Date(t)),i=0;i<n.length&&(o++,6==l?(d++,l=0):l++,
e.date.day_start(new Date(s)).valueOf()!=_.valueOf());i++)s=e.date.add(s,1,"day");if(-1==o)return[];var c=e._colsS[l],u=e._colsS.heights[d],h=this.createElement();h.style.top=u+"px",h.style.left=c+"px",h.style.width=e._cols[l]+"px",h.style.height=(e._colsS.heights[d+1]-u||e._colsS.height)+"px";var p=e.$container.querySelector(".dhx_cal_data"),v=p.querySelector("table");return v.nextSibling?p.insertBefore(h,v.nextSibling):p.appendChild(h),h},renderMonthMarker:function(t,a){
for(var n=[],i=t;i.valueOf()<a.valueOf();)n.push(this.renderMonthCell(i)),i=e.date.add(i,1,"day");return n},renderVerticalMarker:function(t,a,n){var i=e.locate_holder_day(t),r=[],o=null,d=e.config;if(e._ignores[i])return r;if(e._props&&e._props[e._mode]&&n){var l=e._props[e._mode];i=l.order[n];var s=l.order[n];l.days>1?i=e.locate_holder_day(t)+s:(i=s,l.size&&i>l.position+l.size&&(i=0))}if(!(o=e.locate_holder(i))||o.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 u=this.createElement(),h=e.config.hour_size_px*d.last_hour+1,p=36e5;return u.style.top=Math.round((60*_*1e3-e.config.first_hour*p)*e.config.hour_size_px/p)%h+"px",
u.style.lineHeight=u.style.height=Math.max(Math.round(60*(c-_)*1e3*e.config.hour_size_px/p)%h,1)+"px",u.style.width="100%",o.appendChild(u),r.push(u),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,n,i){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 o=e.getEvents(t,a);o.sort(this._compareEvents),i&&(o=o.reverse())
;for(var d=!!n,l=0;l<o.length&&d;l++)o[l].id==n&&(d=!1),o.splice(l,1),l--;for(var l=0;l<o.length;l++){if(new e.$keyboardNavigation.Event(o[l].id).getNode())return o[l]}return null},nextEventHandler:function(t){var a=e.$keyboardNavigation.dispatcher.activeNode,n=t||a&&a.eventId,i=null;if(n&&e.getEvent(n)){var r=e.getEvent(n);i=e.$keyboardNavigation.SchedulerNode.prototype._pickEvent(r.start_date,e.date.add(r.start_date,1,"year"),r.id,!1)}if(!i&&!t){var o=e.getState()
;i=e.$keyboardNavigation.SchedulerNode.prototype._pickEvent(o.min_date,e.date.add(o.min_date,1,"year"),null,!1)}if(i){var d=new e.$keyboardNavigation.Event(i.id);d.isValid()?(a&&a.blur(),e.$keyboardNavigation.dispatcher.setActiveNode(d)):this.nextEventHandler(i.id)}},prevEventHandler:function(t){var a=e.$keyboardNavigation.dispatcher.activeNode,n=t||a&&a.eventId,i=null;if(n&&e.getEvent(n)){var r=e.getEvent(n)
;i=e.$keyboardNavigation.SchedulerNode.prototype._pickEvent(e.date.add(r.end_date,-1,"year"),r.end_date,r.id,!0)}if(!i&&!t){var o=e.getState();i=e.$keyboardNavigation.SchedulerNode.prototype._pickEvent(e.date.add(o.max_date,-1,"year"),o.max_date,null,!0)}if(i){var d=new e.$keyboardNavigation.Event(i.id);d.isValid()?(a&&a.blur(),e.$keyboardNavigation.dispatcher.setActiveNode(d)):this.prevEventHandler(i.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"),n=t.key;void 0===n&&(n=t.keyCode-48),a[1*n-1]&&a[1*n-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){e.$container.querySelector(".dhx_cal_data").scrollTop-=20},"ctrl+down,meta+down":function(t){e.$container.querySelector(".dhx_cal_data").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),n=!(!e[t]||!e[t].toString);if(n!=a)return!1;if(n&&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();if(t[e])return t[e]},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;t<0&&(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 n=e._locate_event(t);a=new e.$keyboardNavigation.Event(n)}else a=new e.$keyboardNavigation.TimeSlot;return a},isScrolledIntoView:function(t){var a=t.getBoundingClientRect(),n=e.$container.querySelector(".dhx_cal_data").getBoundingClientRect();return!(a.bottom<n.top||a.top>n.bottom)},getNode:function(){
var t="[event_id='"+this.eventId+"']",a=e.$keyboardNavigation.dispatcher.getInlineEditor(this.eventId);if(a)return a;if(e.isMultisectionEvent&&e.isMultisectionEvent(e.getEvent(this.eventId))){for(var n=e.$container.querySelectorAll(t),i=0;i<n.length;i++)if(this.isScrolledIntoView(n[i]))return n[i];return n[0]}return 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);var n=this.getNode();this.isScrolledIntoView(n)?e.$keyboardNavigation.dispatcher.keepScrollPosition(function(){e.$keyboardNavigation.KeyNavNode.prototype.focus.apply(this)}.bind(this)):e.$keyboardNavigation.KeyNavNode.prototype.focus.apply(this)},blur:function(){e.$keyboardNavigation.KeyNavNode.prototype.blur.apply(this)},_getSection:function(t){
var a=null,n=e.getState().mode;if(e.matrix&&e.matrix[n]){a=t[e.matrix[e.getState().mode].y_property]}else if(e._props&&e._props[n]){var i=e._props[n];a=t[i.map_to]}return a},_moveToSlot:function(t){var a=e.getEvent(this.eventId);if(a){var n=this._getSection(a),i=new e.$keyboardNavigation.TimeSlot(a.start_date,null,n);this.moveTo(i.nextSlot(i,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,n,i){var r=e.getState(),o=e.matrix&&e.matrix[r.mode];t||(t=this.getDefaultDate()),
a||(a=o?e.date.add(t,o.x_step,o.x_unit):e.date.add(t,e.config.key_nav_step,"minute")),this.section=n||this._getDefaultSection(),this.start_date=new Date(t),this.end_date=new Date(a),this.movingDate=i||null},e.$keyboardNavigation.TimeSlot.prototype=e._compose(e.$keyboardNavigation.KeyNavNode,{_handlers:null,getDefaultDate:function(){var t,a=e.getState(),n=new Date(a.date);n.setSeconds(0),n.setMilliseconds(0);var i=new Date;i.setSeconds(0),i.setMilliseconds(0);var r=e.matrix&&e.matrix[a.mode],o=!1
;if(n.valueOf()===i.valueOf()&&(o=!0),r)o?("day"===r.x_unit?(i.setHours(0),i.setMinutes(0)):"hour"===r.x_unit&&i.setMinutes(0),t=i):t=e.date[r.name+"_start"](new Date(a.date)),t=this.findVisibleColumn(t);else if(t=new Date(e.getState().min_date),o&&(t=i),t=this.findVisibleColumn(t),o||t.setHours(e.config.first_hour),!e._table_view){var d=e.$container.querySelector(".dhx_cal_data");d.scrollTop&&t.setHours(e.config.first_hour+Math.ceil(d.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;return this._getMultisectionView()&&!e&&(e=this._getNextSection()),e},_getNextSection:function(e,t){var a=this._getMultisectionView(),n=a.order[e],i=n
;i=void 0!==n?n+t:a.size&&a.position?a.position:0,i=i<0?i=(a.options||a.y_unit).length-1:i;var r=a.options||a.y_unit;return r[i]?r[i].key:null},isValid:function(){var t=e.getState();if(this.start_date.valueOf()<t.min_date.valueOf()||this.start_date.valueOf()>=t.max_date.valueOf())return!1;if(!this.isVisible(this.start_date,this.end_date))return!1;var a=this._getMultisectionView();return!a||void 0!==a.order[this.section]},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,n){var i;switch(a){case"up":i=e.date.add(t,-1,"week");break;case"down":i=e.date.add(t,1,"week");break;case"left":i=e.date.day_start(e.date.add(t,-1,"day")),i=this.findVisibleColumn(i,-1);break;case"right":i=e.date.day_start(e.date.add(t,1,"day")),
i=this.findVisibleColumn(i,1);break;default:i=e.date.day_start(new Date(t))}var r=e.getState();return(t.valueOf()<r.min_date.valueOf()||!n&&t.valueOf()>=r.max_date.valueOf())&&(i=new Date(r.min_date)),i},nextMonthSlot:function(t,a,n){var i,r;return i=this.addMonthDate(t.start_date,a,n),i.setHours(e.config.first_hour),r=new Date(i),r.setHours(e.config.last_hour),{start_date:i,end_date:r}},_alignTimeSlot:function(t,a,n,i){for(var r=new Date(a);r.valueOf()<t.valueOf();)r=e.date.add(r,i,n)
;return r.valueOf()>t.valueOf()&&(r=e.date.add(r,-i,n)),r},nextTimelineSlot:function(t,a,n){var i=e.getState(),r=e.matrix[i.mode],o=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()<=o.valueOf()&&(d=e.date.add(o,r.x_step,r.x_unit));var l=this.clone(t);switch(l.start_date=o,l.end_date=d,l.section=t.section||this._getNextSection(),a){
case"up":l.section=this._getNextSection(t.section,-1);break;case"down":l.section=this._getNextSection(t.section,1);break;case"left":l.start_date=this.findVisibleColumn(e.date.add(l.start_date,-r.x_step,r.x_unit),-1),l.end_date=e.date.add(l.start_date,r.x_step,r.x_unit);break;case"right":l.start_date=this.findVisibleColumn(e.date.add(l.start_date,r.x_step,r.x_unit),1),l.end_date=e.date.add(l.start_date,r.x_step,r.x_unit)}
return(l.start_date.valueOf()<i.min_date.valueOf()||l.start_date.valueOf()>=i.max_date.valueOf())&&(n&&l.start_date.valueOf()>=i.max_date.valueOf()?l.start_date=new Date(i.max_date):(l.start_date=e.date[i.mode+"_start"](e.date.add(i.date,"left"==a?-1:1,i.mode)),l.end_date=e.date.add(l.start_date,r.x_step,r.x_unit))),l},nextUnitsSlot:function(t,a,n){var i=this.clone(t);i.section=t.section||this._getNextSection();var r=t.section||this._getNextSection(),o=e.getState(),d=e._props[o.mode];switch(a){
case"left":r=this._getNextSection(t.section,-1);var l=d.size?d.size-1:d.options.length;d.days>1&&d.order[r]==l-1&&e.date.add(t.start_date,-1,"day").valueOf()>=o.min_date.valueOf()&&(i=this.nextDaySlot(t,a,n));break;case"right":r=this._getNextSection(t.section,1),d.days>1&&!d.order[r]&&e.date.add(t.start_date,1,"day").valueOf()<o.max_date.valueOf()&&(i=this.nextDaySlot(t,a,n));break;default:i=this.nextDaySlot(t,a,n),r=t.section}return i.section=r,i},_moveDate:function(t,a){
var n=this.findVisibleColumn(e.date.add(t,a,"day"),a);return n.setHours(t.getHours()),n.setMinutes(t.getMinutes()),n},isBeforeLastHour:function(t,a){var n=t.getMinutes(),i=t.getHours(),r=e.config.last_hour;return i<r||!a&&(24==r||i==r)&&!n},isAfterFirstHour:function(t,a){var n=t.getMinutes(),i=t.getHours(),r=e.config.first_hour,o=e.config.last_hour;return i>=r||!a&&!n&&(!i&&24==o||i==o)},isInVisibleDayTime:function(e,t){return this.isBeforeLastHour(e,t)&&this.isAfterFirstHour(e,t)},
nextDaySlot:function(t,a,n){var i,r,o=e.config.key_nav_step,d=this._alignTimeSlot(t.start_date,e.date.day_start(new Date(t.start_date)),"minute",o),l=t.start_date;switch(a){case"up":if(i=e.date.add(d,-o,"minute"),!this.isInVisibleDayTime(i,!0)&&(!n||this.isInVisibleDayTime(l,!0))){var s=!0;n&&e.date.date_part(new Date(i)).valueOf()!=e.date.date_part(new Date(l)).valueOf()&&(s=!1),s&&(i=this.findVisibleColumn(e.date.add(t.start_date,-1,"day"),-1)),i.setHours(e.config.last_hour),i.setMinutes(0),
i=e.date.add(i,-o,"minute")}r=e.date.add(i,o,"minute");break;case"down":i=e.date.add(d,o,"minute");var _=n?i:e.date.add(i,o,"minute");if(!this.isInVisibleDayTime(_,!1)&&(!n||this.isInVisibleDayTime(l,!1)))if(n){var s=!0;e.date.date_part(new Date(l)).valueOf()==l.valueOf()&&(s=!1),s&&(i=this.findVisibleColumn(e.date.add(t.start_date,1,"day"),1)),i.setHours(e.config.first_hour),i.setMinutes(0),i=e.date.add(i,o,"minute")}else i=this.findVisibleColumn(e.date.add(t.start_date,1,"day"),1),
i.setHours(e.config.first_hour),i.setMinutes(0);r=e.date.add(i,o,"minute");break;case"left":i=this._moveDate(t.start_date,-1),r=this._moveDate(t.end_date,-1);break;case"right":i=this._moveDate(t.start_date,1),r=this._moveDate(t.end_date,1);break;default:i=d,r=e.date.add(i,o,"minute")}return{start_date:i,end_date:r}},nextWeekAgendaSlot:function(t,a){var n,i,r=e.getState();switch(a){case"down":case"left":n=e.date.day_start(e.date.add(t.start_date,-1,"day")),n=this.findVisibleColumn(n,-1);break
;case"up":case"right":n=e.date.day_start(e.date.add(t.start_date,1,"day")),n=this.findVisibleColumn(n,1);break;default:n=e.date.day_start(t.start_date)}return(t.start_date.valueOf()<r.min_date.valueOf()||t.start_date.valueOf()>=r.max_date.valueOf())&&(n=new Date(r.min_date)),i=new Date(n),i.setHours(e.config.last_hour),{start_date:n,end_date:i}},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,n=e.matrix&&e.matrix[e.getState().mode];return a=n?e._get_date_index(n,t):e.locate_holder_day(t),!e._ignores[a]},findVisibleColumn:function(t,a){var n=t;a=a||1;for(var i=e.getState();!this.isDateVisible(n)&&(a>0&&n.valueOf()<=i.max_date.valueOf()||a<0&&n.valueOf()>=i.min_date.valueOf());)n=this.nextDateColumn(n,a);return n},nextDateColumn:function(t,a){a=a||1;var n=e.matrix&&e.matrix[e.getState().mode];return 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 n=new Date(t);n.valueOf()<a.valueOf();){if(this.isDateVisible(n))return!0;n=this.nextDateColumn(n)}return!1},nextSlot:function(t,a,n,i){var r;n=n||this._getMode();var o=e.$keyboardNavigation.TimeSlot.prototype.clone(t);switch(n){case this._modes.units:r=this.nextUnitsSlot(o,a,i);break;case this._modes.timeline:r=this.nextTimelineSlot(o,a,i);break;case this._modes.year:case this._modes.month:r=this.nextMonthSlot(o,a,i);break
;case this._modes.weekAgenda:r=this.nextWeekAgendaSlot(o,a,i);break;case this._modes.list:r=this.nextAgendaSlot(o,a,i);break;case this._modes.dayColumns:r=this.nextDaySlot(o,a,i)}return r.start_date.valueOf()>=r.end_date.valueOf()&&(r=this.nextSlot(r,a,n)),e.$keyboardNavigation.TimeSlot.prototype.clone(r)},extendSlot:function(t,a){var n,i=this._getMode();switch(i){case this._modes.units:n="left"==a||"right"==a?this.nextUnitsSlot(t,a):this.extendUnitsSlot(t,a);break;case this._modes.timeline:
n="down"==a||"up"==a?this.nextTimelineSlot(t,a):this.extendTimelineSlot(t,a);break;case this._modes.year:case this._modes.month:n=this.extendMonthSlot(t,a);break;case this._modes.dayColumns:n=this.extendDaySlot(t,a);break;case this._modes.weekAgenda:n=this.extendWeekAgendaSlot(t,a);break;default:n=t}var r=e.getState();return n.start_date.valueOf()<r.min_date.valueOf()&&(n.start_date=this.findVisibleColumn(r.min_date),n.start_date.setHours(e.config.first_hour)),
n.end_date.valueOf()>r.max_date.valueOf()&&(n.end_date=this.findVisibleColumn(r.max_date,-1)),e.$keyboardNavigation.TimeSlot.prototype.clone(n)},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,n,i){var r,o=a.movingDate;if(o||(o=t[n]),!o||!t[n])return a
;if(!n)return e.$keyboardNavigation.TimeSlot.prototype.clone(a);r=this.nextSlot({start_date:a[o],section:a.section},n,i,!0),r.start_date.valueOf()==a.start_date.valueOf()&&(r=this.nextSlot({start_date:r.start_date,section:r.section},n,i,!0)),r.movingDate=o;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 n={start_date:null,end_date:null};return"start_date"==a?(n.start_date=t.start_date,n.end_date=e.end_date):(n.start_date=e.start_date,n.end_date=t.start_date),n},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(),n=this.nextSlot(this,t);(n.start_date.valueOf()<a.min_date.valueOf()||n.start_date.valueOf()>=a.max_date.valueOf())&&e.setCurrentView(new Date(n.start_date)),this.moveTo(n)
},keys:{left:function(){this.scrollSlot("left")},right:function(){this.scrollSlot("right")},down:function(){this._getMode()==this._modes.list?e.$keyboardNavigation.SchedulerNode.prototype.nextEventHandler():this.scrollSlot("down")},up:function(){this._getMode()==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]){t[e.matrix[e.getState().mode].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(){return!!this.container.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,n=this._getGrid();n[t]||(t=0);var i=!0;if(t>n.length/2&&(i=!1),!n[t]){var r=new e.$keyboardNavigation.TimeSlot;return r.isValid()?r:new e.$keyboardNavigation.DataArea}if(i){
for(var o=a;n[t]&&o<n[t].length;o++)if(n[t][o]||o!=n[t].length-1||(t++,a=0),n[t][o])return new e.$keyboardNavigation.MinicalCell(this.container,t,o)}else for(var o=a;n[t]&&o<n[t].length;o--)if(n[t][o]||o||(t--,a=n[t].length-1),n[t][o])return new e.$keyboardNavigation.MinicalCell(this.container,t,o);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=[],n=0;n<t.length;n++){a[n]=[]
;for(var i=t[n],r=i.querySelectorAll("td"),o=0;o<r.length;o++){var d=r[o],l=!0,s=e._getClassName(d);(s.indexOf("dhx_after")>-1||s.indexOf("dhx_before")>-1||s.indexOf("dhx_scale_ignore")>-1)&&(l=!1),a[n][o]=l}}return a},keys:{right:function(t){var a=this._getGrid(),n=this.row,i=this.col+1;a[n]&&a[n][i]||(a[n+1]?(n+=1,i=0):i=this.col);var r=new e.$keyboardNavigation.MinicalCell(this.container,n,i);r.isValid()||(r=r.fallback()),this.moveTo(r)},left:function(t){
var a=this._getGrid(),n=this.row,i=this.col-1;a[n]&&a[n][i]||(a[n-1]?(n-=1,i=a[n].length-1):i=this.col);var r=new e.$keyboardNavigation.MinicalCell(this.container,n,i);r.isValid()||(r=r.fallback()),this.moveTo(r)},down:function(){var t=this._getGrid(),a=this.row+1,n=this.col;t[a]&&t[a][n]||(a=this.row);var i=new e.$keyboardNavigation.MinicalCell(this.container,a,n);i.isValid()||(i=i.fallback()),this.moveTo(i)},up:function(){var t=this._getGrid(),a=this.row-1,n=this.col;if(t[a]&&t[a][n]){
var i=new e.$keyboardNavigation.MinicalCell(this.container,a,n);i.isValid()||(i=i.fallback()),this.moveTo(i)}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!(!s.length&&!dhtmlx._modalsStack.length)}function a(e,t){for(;e&&e!=t;)e=e.parentNode;return!(e!=t)}function n(n){setTimeout(function(){t()||a(document.activeElement,e.$container)||e.focus()},1)}function i(t){e.eventRemove(t,"keydown",d),e.event(t,"keydown",d),s.push(t)}function r(){var t=s.pop();t&&e.eventRemove(t,"keydown",d),n(t)}function o(e){return dhtmlx._modalsStack.length?e==dhtmlx._modalsStack[dhtmlx._modalsStack.length-1]:e==s[s.length-1]}function d(t){
var t=t||window.event,a=t.currentTarget;o(a)&&e.$keyboardNavigation.trapFocus(a,t)}function l(){i(e.getLightbox())}var s=[];if(e.attachEvent("onLightbox",l),e.attachEvent("onAfterLightbox",r),e.attachEvent("onAfterQuickInfo",function(){n()}),!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,keepScrollPosition:function(t){var a,n,i=e.$container.querySelector(".dhx_timeline_scrollable_data");i||(i=e.$container.querySelector(".dhx_cal_data")),i&&(a=i.scrollTop,n=i.scrollLeft),t(),i&&(i.scrollTop=a,i.scrollLeft=n)},enable:function(){if(e.$container){this.isActive=!0;var t=this;this.keepScrollPosition(function(){t.globalNode.enable(),t.setActiveNode(t.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 n=this.globalNode,i=e.$keyboardNavigation.shortcuts.getCommandFromEvent(t);a?a.findHandler(i)?a.doAction(i,t):n.findHandler(i)&&n.doAction(i,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,n=document.elementFromPoint(d.x,d.y);n&&n!=e._obj;)n=n.parentNode;return t=!(n!=e._obj),a=e.$keyboardNavigation.dispatcher.isEnabled(),t||a}function n(e){delete e.rec_type,delete e.rec_pattern,delete e.event_pid,delete e.event_length}function i(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 o=null,d={};document.body?e.event(document.body,"mousemove",t):e.event(window,"load",function(){e.event(document.body,"mousemove",t)}),e.attachEvent("onMouseMove",function(t,a){var n=e.getState();if(n.mode&&n.min_date){var i=e.getActionData(a);e.$keyboardNavigation._pasteDate=i.date,
e.$keyboardNavigation._pasteSection=i.section}}),e._make_pasted_event=function(t){var a=e.$keyboardNavigation._pasteDate,r=e.$keyboardNavigation._pasteSection,o=t.end_date-t.start_date,d=i(t);if(n(d),d.start_date=new Date(a),d.end_date=new Date(d.start_date.valueOf()+o),r){var l=e._get_section_property();e.config.multisection?d[l]=t[l]:d[l]=r}return d},e._do_paste=function(t,a,n){!1!==e.callEvent("onBeforeEventPasted",[t,a,n])&&(e.addEvent(a),e.callEvent("onEventPasted",[t,a,n]))},
e._is_key_nav_active=function(){return!(!this._is_initialized()||this._is_lightbox_open()||!this.config.key_nav)},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 n=e.date.add(e._date,37==t.keyCode?-1:1,e._mode)
;return e.setCurrentView(n),!0}var d=r();if((t.ctrlKey||t.metaKey)&&67==t.keyCode)return d&&(e._buffer_event=i(e.getEvent(d)),o=!0,e.callEvent("onEventCopied",[e.getEvent(d)])),!0;if((t.ctrlKey||t.metaKey)&&88==t.keyCode&&d){o=!1;var l=e._buffer_event=i(e.getEvent(d));e.updateEvent(l.id),e.callEvent("onEventCut",[l])}if((t.ctrlKey||t.metaKey)&&86==t.keyCode&&a(t)){var l=e._buffer_event?e.getEvent(e._buffer_event.id):e._buffer_event;if(l=l||e._buffer_event){var s=e._make_pasted_event(l)
;if(o)s.id=e.uid(),e._do_paste(o,s,l);else{e.callEvent("onBeforeEventChanged",[s,t,!1,l])&&(e._do_paste(o,s,l),o=!0)}}return!0}}},e._temp_key_scope(),function(){function t(){if(e.config.key_nav){var t=document.activeElement;return!(!t||e._locate_css(t,"dhx_cal_quick_info",!1))&&(e.$keyboardNavigation.isChildOf(t,e.$container)||e.$keyboardNavigation.isMinical(t))}}function a(e){e&&!n.isEnabled()?n.enable():!e&&n.isEnabled()&&n.disable()}e.$keyboardNavigation.attachSchedulerHandlers=function(){
function t(t){if(!e.config.key_nav)return!0;var a,n=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)):n&&(a=new e.$keyboardNavigation.TimeSlot,r.date&&n&&(a=a.nextSlot(new e.$keyboardNavigation.TimeSlot(r.date,null,r.section)))),a&&(i.isEnabled()?r.date&&n&&i.delay(function(){i.setActiveNode(a)}):i.activeNode=a)}
function a(t){if(e.config.key_nav&&i.isEnabled()){var a=t,n=new e.$keyboardNavigation.Event(a.eventId);if(!n.isValid()){var r=n.start||a.start,o=n.end||a.end,d=n.section||a.section;n=new e.$keyboardNavigation.TimeSlot(r,o,d),n.isValid()||(n=new e.$keyboardNavigation.TimeSlot)}i.setActiveNode(n);var l=i.getActiveNode();l&&l.getNode&&document.activeElement!=l.getNode()&&i.focusNode(i.getActiveNode())}}var n,i=e.$keyboardNavigation.dispatcher,r=function(t){
if(e.config.key_nav)return i.keyDownHandler(t)},o=function(){i.keepScrollPosition(function(){i.focusGlobalNode()})};e.attachEvent("onDataRender",function(){e.config.key_nav&&i.isEnabled()&&!e.getState().editor_id&&(clearTimeout(n),n=setTimeout(function(){i.isEnabled()||i.enable(),d()}))});var d=function(){if(i.isEnabled()){var t=i.getActiveNode();t&&(t.isValid()||(t=t.fallback()),
!t||t instanceof e.$keyboardNavigation.MinicalButton||t instanceof e.$keyboardNavigation.MinicalCell||i.keepScrollPosition(function(){t.focus(!0)}))}};e.attachEvent("onSchedulerReady",function(){var a=e.$container;e.eventRemove(document,"keydown",r),e.eventRemove(a,"mousedown",t),e.eventRemove(a,"focus",o),e.config.key_nav?(e.event(document,"keydown",r),e.event(a,"mousedown",t),e.event(a,"focus",o),a.setAttribute("tabindex","0")):a.removeAttribute("tabindex")});var l=e.updateEvent
;e.updateEvent=function(t){var n=l.apply(this,arguments);if(e.config.key_nav&&i.isEnabled()&&e.getState().select_id==t){var r=new e.$keyboardNavigation.Event(t);e.getState().lightbox_id||a(r)}return n},e.attachEvent("onEventDeleted",function(t){if(!e.config.key_nav)return!0;if(i.isEnabled()){i.getActiveNode().eventId==t&&i.setActiveNode(new e.$keyboardNavigation.TimeSlot)}return!0}),e.attachEvent("onClearAll",function(){if(!e.config.key_nav)return!0
;i.isEnabled()&&i.getActiveNode()instanceof e.$keyboardNavigation.Event&&i.setActiveNode(new e.$keyboardNavigation.TimeSlot)})},e.$keyboardNavigation._minicalendars=[],e.$keyboardNavigation.isMinical=function(t){for(var a=e.$keyboardNavigation._minicalendars,n=0;n<a.length;n++)if(this.isChildOf(t,a[n]))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
;n.enable(),n.setActiveNode(new e.$keyboardNavigation.MinicalButton(a,0))}function a(t){var a=t.target||t.srcElement,i=e._locate_css(t,"dhx_cal_prev_button",!1),r=e._locate_css(t,"dhx_cal_next_button",!1),o=e._locate_css(t,"dhx_year_body",!1),d=0,l=0;if(o){for(var s,_,c=a;c&&"td"!=c.tagName.toLowerCase();)c=c.parentNode;if(c&&(_=c,s=_.parentNode),s&&_){for(var u=s.parentNode.querySelectorAll("tr"),h=0;h<u.length;h++)if(u[h]==s){d=h;break}
for(var p=s.querySelectorAll("td"),h=0;h<p.length;h++)if(p[h]==_){l=h;break}}}var v=t.currentTarget;n.delay(function(){if(i||r||o){var t;i?(t=new e.$keyboardNavigation.MinicalButton(v,0),n.setActiveNode(new e.$keyboardNavigation.MinicalButton(v,0))):r?t=new e.$keyboardNavigation.MinicalButton(v,1):o&&(t=new e.$keyboardNavigation.MinicalCell(v,d,l)),t&&(n.enable(),t.isValid()&&(n.activeNode=null,n.setActiveNode(t)))}})}var n=e.$keyboardNavigation.dispatcher;if(e.renderCalendar){
var i=e.renderCalendar;e.renderCalendar=function(){var r=i.apply(this,arguments),o=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,l=0;l<o.length;l++)if(o[l]==r){d=!0;break}if(d||o.push(r),n.isEnabled()){var s=n.getActiveNode();s&&s.container==r?n.focusNode(s):r.setAttribute("tabindex","0")}else r.setAttribute("tabindex","0");return r}}if(e.destroyCalendar){var r=e.destroyCalendar
;e.destroyCalendar=function(a,n){a=a||(e._def_count?e._def_count.firstChild:null);var i=r.apply(this,arguments);if(!a||!a.parentNode)for(var o=e.$keyboardNavigation._minicalendars,d=0;d<o.length;d++)o[d]==a&&(e.eventRemove(o[d],"focus",t),o.splice(d,1),d--);return i}}};var n=e.$keyboardNavigation.dispatcher;if(e.$keyboardNavigation.attachSchedulerHandlers(),e.renderCalendar)e.$keyboardNavigation.patchMinicalendar();else var i=e.attachEvent("onSchedulerReady",function(){e.detachEvent(i),
e.$keyboardNavigation.patchMinicalendar()});setInterval(function(){if(e.$container&&e.$keyboardNavigation.isChildOf(e.$container,document.body)){var i=t();i?a(i):!i&&n.isEnabled()&&setTimeout(function(){e.config.key_nav?a(t()):e.$container.removeAttribute("tabindex")},100)}},500)}()}window.Scheduler&&window.Scheduler.plugin?window.Scheduler.plugin(e):e(window.scheduler)}();