\";\n\tif (resizable) {\n\t\thtml += resize_handle;\n\t}\n\tif(scheduler.getState().mode == \"month\"){\n\t\tev = scheduler.getEvent(ev.id); // ev at this point could be a part (row in a month view) of a larger event\n\t}\n\n\tif (ev._timed){\n\t\thtml += `${scheduler.templates.event_bar_date(ev.start_date, ev.end_date, ev)}`;\n\t}\n\n\thtml += \"
';\n\t\t\t\tscheduler.init(container);\n\n\t\t\t\tthis.el = container;\n\t\t\t}\n\t\t},\n\t\ttype: 4\n\t};\n};\n\n}","import global from \"../global\";\n\nexport default function extend(scheduler) {\n\n(function(){\n\n\tvar setCurrentView = scheduler.setCurrentView,\n\t\tupdateView = scheduler.updateView;\n\tvar update_view_timer = null,\n\t\tcurr_view_timer = null;\n\n\tvar lazy_setCurrentView = function(date, mode){\n\t\tvar self = this;\n\t\tglobal.clearTimeout(curr_view_timer);\n\t\tglobal.clearTimeout(update_view_timer);\n\n\t\tvar oldDate = self._date,\n\t\t\toldMode = self._mode;\n\t\tupdateFlags(this, date, mode);\n\n\t\tcurr_view_timer = setTimeout(function(){\n\n\t\t\tif(scheduler.$destroyed){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!self.callEvent(\"onBeforeViewChange\", [oldMode, oldDate, mode || self._mode, date || self._date])){\n\t\t\t\tupdateFlags(self, oldDate, oldMode);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tupdateView.call(self, date, mode);\n\t\t\tself.callEvent(\"onViewChange\", [self._mode, self._date]);\n\n\t\t\tglobal.clearTimeout(update_view_timer);\n\t\t\tcurr_view_timer = 0;\n\t\t}, scheduler.config.delay_render);\n\t};\n\tvar lazy_updateView = function(date, mode){\n\t\tvar self = this,\n\t\t\tars = arguments;\n\n\t\tupdateFlags(this, date, mode);\n\n\t\tglobal.clearTimeout(update_view_timer);\n\t\tupdate_view_timer = setTimeout(function(){\n\t\t\tif(scheduler.$destroyed){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(curr_view_timer)\n\t\t\t\treturn;\n\n\t\t\tupdateView.apply(self, ars);\n\t\t}, scheduler.config.delay_render);\n\t};\n\tfunction updateFlags(scheduler, date, mode){\n\t\tif(date)\n\t\t\tscheduler._date = date;\n\t\tif(mode)\n\t\t\tscheduler._mode = mode;\n\n\t}\n\tscheduler.attachEvent(\"onSchedulerReady\", function(){\n\t\tif(scheduler.config.delay_render){\n\t\t\tscheduler.setCurrentView = lazy_setCurrentView;\n\t\t\tscheduler.updateView = lazy_updateView;\n\t\t}else{\n\t\t\tscheduler.setCurrentView = setCurrentView;\n\t\t\tscheduler.updateView = updateView;\n\t\t}\n\t});\n\n})();\n\n}","import global from \"../global\";\n\nexport default function extend(scheduler) {\n/*\nif (global.dataProcessor && !dataProcessor.prototype.init_original){\n\tdataProcessor.prototype.init_original=dataProcessor.prototype.init;\n\tdataProcessor.prototype.init=function(obj){\n\t\tthis.init_original(obj);\n\t\tobj._dataprocessor=this;\n\n\t\tthis.setTransactionMode(\"POST\",true);\n\t\tthis.serverProcessor+=(this.serverProcessor.indexOf(\"?\")!=-1?\"&\":\"?\")+\"editing=true\";\n\t};\n}*/\n\nscheduler.attachEvent(\"onSchedulerReady\", function(){\n\tif(typeof dhtmlxError !== \"undefined\") {\n\t\twindow.dhtmlxError.catchError(\"LoadXML\", function(a, b, c){\n\t\t\tvar message = c[0].responseText;\n\n\t\t\tswitch (scheduler.config.ajax_error){\n\t\t\t\tcase \"alert\":\n\t\t\t\t\tglobal.alert(message);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"console\":\n\t\t\t\t\tglobal.console.log(message);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t});\n\t}\n});\n\n\n}","import ar from \"./locale_ar\";\nimport be from \"./locale_be\";\nimport ca from \"./locale_ca\";\nimport cn from \"./locale_cn\";\nimport cs from \"./locale_cs\";\nimport da from \"./locale_da\";\nimport de from \"./locale_de\";\nimport el from \"./locale_el\";\nimport en from \"./locale_en\";\nimport es from \"./locale_es\";\nimport fi from \"./locale_fi\";\nimport fr from \"./locale_fr\";\nimport he from \"./locale_he\";\nimport hu from \"./locale_hu\";\nimport id from \"./locale_id\";\nimport it from \"./locale_it\";\nimport jp from \"./locale_jp\";\n\nimport LocaleManager from \"./locale_manager\";\n\nimport nb from \"./locale_nb\";\nimport nl from \"./locale_nl\";\nimport no from \"./locale_no\";\nimport pl from \"./locale_pl\";\nimport pt from \"./locale_pt\";\nimport ro from \"./locale_ro\";\nimport ru from \"./locale_ru\";\nimport si from \"./locale_si\";\nimport sk from \"./locale_sk\";\nimport sv from \"./locale_sv\";\nimport tr from \"./locale_tr\";\nimport ua from \"./locale_ua\";\n\nexport default function(){\n\treturn new LocaleManager({\n\t\ten,\n\t\tar,\n\t\tbe,\n\t\tca,\n\t\tcn,\n\t\tcs,\n\t\tda,\n\t\tde,\n\t\tel,\n\t\tes,\n\t\tfi,\n\t\tfr,\n\t\the,\n\t\thu,\n\t\tid,\n\t\tit,\n\t\tjp,\n\t\tnb,\n\t\tnl,\n\t\tno,\n\t\tpl,\n\t\tpt,\n\t\tro,\n\t\tru,\n\t\tsi,\n\t\tsk,\n\t\tsv,\n\t\ttr,\n\t\tua\n\t});\n}","export default class ExtensionsManager{\n\tconstructor(config){\n\t\tthis._extensions = {};\n\t\tfor(const i in config){\n\t\t\tthis._extensions[i] = config[i];\n\t\t}\n\t}\n\n\taddExtension(name, ext) {\n\t\tthis._extensions[name] = ext;\n\t}\n\n\tgetExtension(name) {\n\t\treturn this._extensions[name];\n\t}\n}","\nexport default function(){\n/* global dhtmlx */\nif (typeof dhtmlx != \"undefined\" && dhtmlx.attaches) {\n\tdhtmlx.attaches.attachScheduler = function (day, mode, tabs, scheduler) {\n\t\tvar tabs = tabs || '';\n\t\tvar obj = document.createElement(\"DIV\");\n\t\tobj.id = \"dhxSchedObj_\" + this._genStr(12);\n\t\tobj.innerHTML = '
' + tabs + '
';\n\t\tdocument.body.appendChild(obj.firstChild);\n\n\t\tthis.attachObject(obj.id, false, true);\n\n\t\tthis.vs[this.av].sched = scheduler;\n\t\tthis.vs[this.av].schedId = obj.id;\n\t\tscheduler.setSizes = scheduler.updateView;\n\t\tscheduler.destructor = function () { };\n\t\tscheduler.init(obj.id, day, mode);\n\n\t\treturn this.vs[this._viewRestore()].sched;\n\t};\n}\n\n}","export default function extend(scheduler) {\n\n\n/**\n * helpers for Multisection and Daily timeline events\n * Preserve _sorder and _count calculated for virtual events, so event position won't change when it refreshed individually\n * @private\n */\n\nif (!scheduler._inited_multisection_copies) {\n\tscheduler.attachEvent(\"onEventIdChange\", function (old_id, new_id) {\n\t\tvar copies = this._multisection_copies;\n\t\tif (!copies) return;\n\n\t\tif (copies[old_id] && !copies[new_id]) {\n\t\t\tvar eventCopies = copies[old_id];\n\t\t\tdelete copies[old_id];\n\t\t\tcopies[new_id] = eventCopies;\n\t\t}\n\t});\n\tscheduler._inited_multisection_copies = true;\n}\n\nscheduler._register_copies_array = function(evs){\n\tfor(var i=0; i < evs.length; i++)\n\t\tthis._register_copy(evs[i]);\n};\nscheduler._register_copy = function(copy){\n\tif(!this._multisection_copies){\n\t\treturn;\n\t}\n\n\tif(!this._multisection_copies[copy.id]){\n\t\tthis._multisection_copies[copy.id] = {};\n\t}\n\tvar section = copy[this._get_section_property()];\n\tvar evs = this._multisection_copies[copy.id];\n\tevs[section] = copy;\n};\nscheduler._get_copied_event = function(event_id, section){\n\tif(!this._multisection_copies[event_id])\n\t\treturn null;\n\n\tif(this._multisection_copies[event_id][section])\n\t\treturn this._multisection_copies[event_id][section];\n\n\tvar parts = this._multisection_copies[event_id];\n\t//multisection event has not been rendered in this section, need retrieve state of one of rendered events\n\tif(scheduler._drag_event && scheduler._drag_event._orig_section && parts[scheduler._drag_event._orig_section]){\n\t\treturn parts[scheduler._drag_event._orig_section];\n\t}else{\n\t\tvar min_sorder = Infinity,\n\t\t\tev = null;\n\t\tfor(var i in parts){\n\t\t\tif(parts[i]._sorder < min_sorder){\n\t\t\t\tev = parts[i];\n\t\t\t\tmin_sorder = parts[i]._sorder;\n\t\t\t}\n\t\t}\n\t\treturn ev;\n\t}\n};\nscheduler._clear_copied_events = function(){\n\tthis._multisection_copies = {};\n};\n\nscheduler._restore_render_flags = function(section_evs){\n\tvar map_to = this._get_section_property();\n\tfor(var i=0; i < section_evs.length; i++){\n\t\tvar ev = section_evs[i];\n\t\tvar prev_state = scheduler._get_copied_event(ev.id, ev[map_to]);\n\t\tif(prev_state){\n\t\t\tfor(var p in prev_state){\n\t\t\t\tif(p.indexOf(\"_\") === 0){\n\t\t\t\t\tev[p] = prev_state[p];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\n}","const externalDrag = {\n\tfrom_scheduler :null,\n\tto_scheduler: null,\n\tdrag_data:null,\n\tdrag_placeholder : null,\n\tdelete_dnd_holder : function(){\n\t\tvar node = this.drag_placeholder;\n\t\tif(!node)\n\t\t\treturn;\n\t\tif(node.parentNode)\n\t\t\tnode.parentNode.removeChild(node);\n\t\tdocument.body.className = document.body.className.replace(\" dhx_no_select\", \"\");\n\t\tthis.drag_placeholder = null;\n\t},\n\tcopy_event_node : function(event, scheduler){\n\t\tvar clone = null;\n\t\tfor (var i = 0; i < scheduler._rendered.length; i++){\n\t\t\tvar node = scheduler._rendered[i];\n\t\t\tif (node.getAttribute(scheduler.config.event_attribute) == event.id || node.getAttribute(scheduler.config.event_attribute) == scheduler._drag_id) {\n\t\t\t\tclone = node.cloneNode(true);\n\t\t\t\tclone.style.position = clone.style.top = clone.style.left = \"\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn clone || document.createElement(\"div\");\n\t},\n\tcreate_dnd_holder : function(event, scheduler){\n\t\tif(this.drag_placeholder)\n\t\t\treturn this.drag_placeholder;\n\n\t\tvar holder = document.createElement(\"div\");\n\t\tvar html = scheduler.templates.event_outside(event.start_date, event.end_date, event);\n\t\tif(html){\n\t\t\tholder.innerHTML = html;\n\t\t}else{\n\t\t\tholder.appendChild(this.copy_event_node(event, scheduler));\n\t\t}\n\n\t\tholder.className = \"dhx_drag_placeholder\";\n\t\tholder.style.position = \"absolute\";\n\t\tthis.drag_placeholder = holder;\n\t\tdocument.body.appendChild(holder);\n\t\tdocument.body.className += \" dhx_no_select\";\n\t\treturn holder;\n\t},\n\tmove_dnd_holder : function(e){\n\t\tvar pos = {x: e.clientX, y: e.clientY};\n\t\tthis.create_dnd_holder(this.drag_data.ev, this.from_scheduler);\n\t\tif(!this.drag_placeholder){\n\t\t\treturn;\n\t\t}\n\t\tvar x = pos.x,\n\t\t\ty = pos.y;\n\n\t\tvar html = document.documentElement,\n\t\t\tbody = document.body,\n\t\t\tholder = this.drag_placeholder;\n\n\t\tholder.style.left = 10 + x + (html && html.scrollLeft || body && body.scrollLeft || 0) - (html.clientLeft || 0) + \"px\";\n\t\tholder.style.top = 10 + y + (html && html.scrollTop || body && body.scrollTop || 0) - (html.clientTop || 0) + \"px\";\n\t},\n\tclear_scheduler_dnd : function(scheduler){\n\t\tscheduler._drag_id = scheduler._drag_pos = scheduler._drag_mode = scheduler._drag_event = scheduler._new_event = null;\n\t},\n\tstop_drag : function(scheduler){\n\t\tif(scheduler){\n\t\t\tthis.clear_scheduler_dnd(scheduler);\n\t\t}\n\t\tthis.delete_dnd_holder();\n\t\tthis.drag_data = null;\n\t},\n\tinject_into_scheduler : function(event, scheduler, dom_event){\n\t\tevent._count = 1; // reset order calculation for the new location (scheduler)\n\t\tevent._sorder = 0;\n\n\t\tif(event.event_pid && event.event_pid != \"0\") {\n\t\t\tevent.event_pid = null;\n\t\t\tevent.rec_type = event.rec_pattern = \"\";\n\t\t\tevent.event_length = 0;\n\t\t}\n\n\t\tscheduler._drag_event = event;\n\t\tscheduler._events[event.id] = event;\n\t\tscheduler._drag_id = event.id;\n\t\tscheduler._drag_mode = \"move\";\n\n\t\t//resolve event position\n\t\tif(dom_event)\n\t\t\tscheduler._on_mouse_move(dom_event);\n\t},\n\tstart_dnd : function(scheduler){\n\t\tif(!scheduler.config.drag_out)\n\t\t\treturn;\n\n\t\tthis.from_scheduler = scheduler;\n\t\tthis.to_scheduler = scheduler;\n\t\tvar drag = this.drag_data = {};\n\t\tdrag.ev = scheduler._drag_event;\n\t\tdrag.orig_id = scheduler._drag_event.id;\n\t},\n\tland_into_scheduler : function(scheduler, e){\n\t\tif(!scheduler.config.drag_in){\n\t\t\tthis.move_dnd_holder(e);\n\t\t\treturn false;\n\t\t}\n\n\t\tvar drag = this.drag_data;\n\n\t\tvar ev = scheduler._lame_clone(drag.ev); // _lame_clone - helper for deep copy\n\n\t\tif(scheduler != this.from_scheduler){\n\t\t\tev.id = scheduler.uid();\n\t\t\tvar duration = ev.end_date - ev.start_date;\n\t\t\tev.start_date = new Date(scheduler.getState().min_date);\n\t\t\tev.end_date = new Date(ev.start_date.valueOf() + duration);\n\t\t}else{\n\t\t\tev.id = this.drag_data.orig_id;\n\t\t\tev._dhx_changed = true;\n\t\t}\n\t\tthis.drag_data.target_id = ev.id;\n\t\tif(!scheduler.callEvent(\"onBeforeEventDragIn\", [ev.id, ev, e]))\n\t\t\treturn false;\n\t\tthis.to_scheduler = scheduler;\n\t\tthis.inject_into_scheduler(ev, scheduler, e);\n\t\tthis.delete_dnd_holder();\n\t\tscheduler.updateView();\n\t\tscheduler.callEvent(\"onEventDragIn\", [ev.id, ev, e]);\n\t\treturn true;\n\t},\n\n\tdrag_from_scheduler : function(scheduler, e){\n\t\tif(this.drag_data && scheduler._drag_id && scheduler.config.drag_out){\n\t\t\tif(!scheduler.callEvent(\"onBeforeEventDragOut\", [scheduler._drag_id, scheduler._drag_event, e])){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(this.to_scheduler == scheduler){\n\t\t\t\tthis.to_scheduler = null;\n\t\t\t}\n\t\t\t\n\t\t\tthis.create_dnd_holder(this.drag_data.ev, scheduler);\n\t\t\tvar id = scheduler._drag_id;\n\t\t\tthis.drag_data.target_id = null;\n\t\t\tdelete scheduler._events[id];\n\t\t\tthis.clear_scheduler_dnd(scheduler);\n\t\t\tscheduler.updateEvent(id);\n\t\t\tscheduler.callEvent(\"onEventDragOut\", [id, this.drag_data.ev, e]);\n\t\t\treturn true;\n\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t},\n\treset_event : function(event, scheduler){\n\t\tthis.inject_into_scheduler(event, scheduler);\n\t\tthis.stop_drag(scheduler);\n\t\tscheduler.updateView();\n\t},\n\tmove_permanently : function(original_event, moved_event, from, to){\n\t\tto.callEvent(\"onEventAdded\", [moved_event.id, moved_event]);\n\n\t\t// delete from original calendar\n\t\tthis.inject_into_scheduler(original_event, from);\n\t\tthis.stop_drag(from);\n\t\tif(original_event.event_pid && original_event.event_pid != \"0\") {\n\t\t\tfrom.callEvent(\"onConfirmedBeforeEventDelete\", [original_event.id]);\n\t\t\tfrom.updateEvent(moved_event.event_pid);\n\t\t} else {\n\t\t\tfrom.deleteEvent(original_event.id);\n\t\t}\n\t\tfrom.updateView();\n\t\tto.updateView();\n\t}\n};\n\nlet outerDragHandlerAttached = false;\nconst connectedSchedulers = [];\nfunction attachOuterDragHandler(scheduler) {\n\tscheduler.event(document.body, \"mousemove\", function(e) {\n\t\tvar dnd = externalDrag;\n\t\tvar target_scheduler = dnd.target_scheduler;\n\n\t\tif(target_scheduler){\n\t\t\tif(!dnd.from_scheduler){\n\t\t\t\t// start dragging event inside initial scheduler\n\t\t\t\tif(target_scheduler.getState().drag_mode == \"move\" && target_scheduler.config.drag_out){\n\t\t\t\t\tdnd.start_dnd(target_scheduler);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(target_scheduler._drag_id){\n\t\t\t\t\t// moving event inside target scheduler\n\t\t\t\t}else{\n\t\t\t\t\t// dragging event into target scheduler\n\t\t\t\t\tvar source = dnd.to_scheduler;//previos target scheduler\n\t\t\t\t\tif(!source || dnd.drag_from_scheduler(source, e)){\n\t\t\t\t\t\tdnd.land_into_scheduler(target_scheduler, e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}else if(dnd.from_scheduler){\n\t\t\tif(!dnd.to_scheduler){\n\t\t\t\t//dragging outside schedulers\n\t\t\t\tdnd.move_dnd_holder(e);\n\t\t\t}else{\n\t\t\t\t// dragging out of target scheduler\n\t\t\t\tdnd.drag_from_scheduler(dnd.to_scheduler, e);\n\t\t\t}\n\t\t}\n\n\t\tdnd.target_scheduler = null;\n\t});\n\tscheduler.event(document.body, \"mouseup\", function(e) {\n\t\tvar dnd = externalDrag;\n\t\tvar from = dnd.from_scheduler,\n\t\t\tto = dnd.to_scheduler;\n\n\t\tif(from){\n\t\t\tif(to && from == to){\n\t\t\t\t// drop back to the same calendar\n\t\t\t\tfrom.updateEvent(dnd.drag_data.target_id);\n\t\t\t}else if(to && from !== to){\n\t\t\t\t// drop to another scheduler\n\t\t\t\tvar original = dnd.drag_data.ev;\n\t\t\t\tvar ev = to.getEvent(dnd.drag_data.target_id);\n\t\t\t\tif(from.callEvent(\"onEventDropOut\", [original.id, original, to, e])){\n\t\t\t\t\tdnd.move_permanently(original, ev, from, to);\n\t\t\t\t}else{\n\t\t\t\t\tdnd.reset_event(original, from);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t// drop outside schedulers\n\t\t\t\tvar original = dnd.drag_data.ev;\n\t\t\t\tif(from.callEvent(\"onEventDropOut\", [original.id, original, null, e])){\n\t\t\t\t\tdnd.reset_event(original, from);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdnd.stop_drag();\n\t\tdnd.current_scheduler = dnd.from_scheduler = dnd.to_scheduler = null;\n\t});\n\n}\n\nfunction processScheduler(scheduler){\n\tscheduler.attachEvent(\"onSchedulerReady\", function(){\n\t\tattachOuterDragHandler(scheduler);\n\t\touterDragHandlerAttached = true;\n\t}, {once: true});\n\n\tscheduler.attachEvent(\"onDestroy\", function(){\n\t\touterDragHandlerAttached = false;\n\t\tconst nextScheduler = connectedSchedulers.pop();\n\t\tif(nextScheduler){\n\t\t\tprocessScheduler(nextScheduler);\n\t\t}\n\t}, {once: true});\n}\n\nexport default function(scheduler){\n\tif(window.Scheduler && window.Scheduler.plugin){// if Scheduler factory is defined, not to confuse with the browser Scheduler object\n\t\twindow.Scheduler._outer_drag = externalDrag;// old private api compatibility\n\t}\n\n\tconnectedSchedulers.push(scheduler);\n\tif(!outerDragHandlerAttached) {\n\t\tprocessScheduler(scheduler);\n\t}\n\n\tscheduler.config.drag_in = true;\n\tscheduler.config.drag_out = true;\n\tscheduler.templates.event_outside = function(start, end, event){};\n\tvar dnd = externalDrag;\n\tscheduler.attachEvent(\"onTemplatesReady\", function(){\n\t\tscheduler.event(scheduler._obj, \"mousemove\", function(e){\n\t\t\tdnd.target_scheduler = scheduler;\n\t\t});\n\t\tscheduler.event(scheduler._obj, \"mouseup\", function(e){\n\t\t\tdnd.target_scheduler = scheduler;\n\t\t});\n\t});\n}","export default function(scheduler){\n\n\n\n(function(){\n\tvar modalsStack = [];\n\n\tfunction isModal(){\n\t\treturn !!(modalsStack.length);\n\t}\n\n\tfunction isChildOf(child, parent){\n\t\twhile(child && child != parent){\n\t\t\tchild = child.parentNode;\n\t\t}\n\n\t\treturn !!(child == parent);\n\t}\n\n\tfunction afterPopup(box){\n\t\tsetTimeout(function(){\n\t\t\tif(scheduler.$destroyed){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(!isModal() && !(isChildOf(document.activeElement, scheduler.$container))) {\n\t\t\t\tscheduler.focus();\n\t\t\t}\n\t\t}, 1);\n\t}\n\tfunction startModal(box){\n\t\tscheduler.eventRemove(box, \"keydown\", trapFocus);\n\t\tscheduler.event(box, \"keydown\", trapFocus);\n\t\tmodalsStack.push(box);\n\t\t//scheduler.$keyboardNavigation.dispatcher.disable();\n\t}\n\n\tfunction endModal(){\n\t\tvar box = modalsStack.pop();\n\t\tif(box) {\n\t\t\tscheduler.eventRemove(box, \"keydown\", trapFocus);\n\t\t}\n\t\tafterPopup(box);\n\n\t}\n\n\tfunction isTopModal(box){\n\t//\tif(dhtmlx._modalsStack.length){\n\t//\t\treturn box == dhtmlx._modalsStack[dhtmlx._modalsStack.length - 1];\n\t//\t}else{\n\t\t\treturn box == modalsStack[modalsStack.length - 1];\n\t//\t}\n\n\t}\n\n\tfunction trapFocus(event){\n\t\tvar event = event || window.event;\n\t\tvar target = event.currentTarget;\n\t\tif(!isTopModal(target)) return;\n\n\t\tscheduler.$keyboardNavigation.trapFocus(target, event);\n\t}\n\n\tfunction traceLightbox(){\n\t\tstartModal(scheduler.getLightbox());\n\t}\n\n\tscheduler.attachEvent(\"onLightbox\", traceLightbox);\n\tscheduler.attachEvent(\"onAfterLightbox\", endModal);\n\n\tscheduler.attachEvent(\"onAfterQuickInfo\", function(){afterPopup();});\n\n\tif(!scheduler._keyNavMessagePopup) {\n\t\tscheduler._keyNavMessagePopup = true;\n\n\t\tvar focusElement = null;\n\t\tvar backupFocus = null;\n\t\tconst modalsStack = [];\n\t\tscheduler.attachEvent(\"onMessagePopup\", function(box){\n\t\t\tfocusElement = document.activeElement;\n\t\t\tbackupFocus = focusElement;\n\n\t\t\twhile(backupFocus && scheduler._getClassName(backupFocus).indexOf(\"dhx_cal_data\") < 0){\n\t\t\t\tbackupFocus = backupFocus.parentNode;\n\t\t\t}\n\t\t\tif(backupFocus){\n\t\t\t\tbackupFocus = backupFocus.parentNode;\n\t\t\t}\n\n\t\t\tscheduler.eventRemove(box, \"keydown\", trapFocus);\n\t\t\tscheduler.event(box, \"keydown\", trapFocus);\n\t\t\tmodalsStack.push(box);\n\t\t});\n\n\n\t\tscheduler.attachEvent(\"onAfterMessagePopup\", function () {\n\t\t\tvar box = modalsStack.pop();\n\t\t\tif(box) {\n\t\t\t\tscheduler.eventRemove(box, \"keydown\", trapFocus);\n\t\t\t}\n\t\t\tsetTimeout(function(){\n\t\t\t\tif(scheduler.$destroyed){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tvar currentTarget = document.activeElement;\n\t\t\t\twhile(currentTarget && scheduler._getClassName(currentTarget).indexOf(\"dhx_cal_light\") < 0){\n\t\t\t\t\tcurrentTarget = currentTarget.parentNode;\n\t\t\t\t}\n\t\t\t\tif(currentTarget)\n\t\t\t\t\treturn;\n\n\n\t\t\t\tif(focusElement && focusElement.parentNode){\n\t\t\t\t\tfocusElement.focus();\n\n\t\t\t\t}else if(backupFocus && backupFocus.parentNode){\n\t\t\t\t\tbackupFocus.focus();\n\t\t\t\t}\n\t\t\t\tfocusElement = null;\n\t\t\t\tbackupFocus = null;\n\n\t\t\t}, 1);\n\t\t});\n\t}\n\n\tscheduler.$keyboardNavigation.isModal = isModal;\n\n\n})();\n\n}","export default function(scheduler){\n\n//Initial idea and implementation by Steve MC\nscheduler._temp_key_scope = function (){\n\n\tscheduler.config.key_nav = true;\n\n\tscheduler.$keyboardNavigation._pasteDate = null; // used for copy and paste operations\n\tscheduler.$keyboardNavigation._pasteSection = null; // used for copy and paste operations\n\tvar isCopy = null;\n\n\tvar pos = {};\n\n\tif(!document.body){\n\t\tscheduler.event(window, \"load\", function(){\n\t\t\tscheduler.event(document.body, \"mousemove\", trackMousePosition);\n\t\t});\n\t}else{\n\t\tscheduler.event(document.body, \"mousemove\", trackMousePosition);\n\t}\n\n\tfunction trackMousePosition(event){\n\t\tevent = event || window.event;\n\t\tpos.x = event.clientX;\n\t\tpos.y = event.clientY;\n\t}\n\tfunction currentTarget(){\n\n\t\tvar mousePointer = false;\n\t\tvar keyNavPointer = false;\n\n\t\tvar target = document.elementFromPoint(pos.x, pos.y);\n\t\twhile(target && target != scheduler._obj){\n\t\t\ttarget = target.parentNode;\n\t\t}\n\t\tmousePointer = !!(target == scheduler._obj);\n\n\t\tkeyNavPointer = scheduler.$keyboardNavigation.dispatcher.isEnabled();\n\n\t\treturn mousePointer || keyNavPointer;\n\t}\n\n\tscheduler.attachEvent(\"onMouseMove\", function(id,e){\n\t\tvar state = scheduler.getState();\n\n\t\t// make sure scheduler is fully initialized before calling scheduler.getActionData\n\t\tif(!(state.mode && state.min_date)){\n\t\t\treturn;\n\t\t}\n\t\tvar position = scheduler.getActionData(e);\n\t\tscheduler.$keyboardNavigation._pasteDate = position.date;\n\t\tscheduler.$keyboardNavigation._pasteSection = position.section;\n\t});\n\n\tfunction clear_event_after(ev){\n\t\tdelete ev.rec_type; delete ev.rec_pattern;\n\t\tdelete ev.event_pid; delete ev.event_length;\n\t}\n\n\tfunction copyEvent(ev){\n\t\treturn scheduler._lame_copy({}, ev);\n\t}\n\n\tscheduler._make_pasted_event = function(ev){\n\t\tvar date = scheduler.$keyboardNavigation._pasteDate;\n\t\tvar section = scheduler.$keyboardNavigation._pasteSection;\n\n\t\tvar event_duration = ev.end_date-ev.start_date;\n\n\t\tvar copy = copyEvent(ev);\n\t\tclear_event_after(copy);\n\t\tcopy.start_date = new Date(date);\n\t\tcopy.end_date = new Date(copy.start_date.valueOf() + event_duration);\n\n\t\tif(section){\n\t\t\tvar property = scheduler._get_section_property();\n\t\t\t// GS-2527: if the event has multiple sections, it will be inserted into the initial sections.\n\t\t\tif(scheduler.config.multisection && ev[property] && scheduler.isMultisectionEvent && scheduler.isMultisectionEvent(ev)) \n\t\t\t\tcopy[property] = ev[property]; // save initial set of resources for multisection view\n\t\t\telse\n\t\t\t\tcopy[property] = section;\n\t\t}\n\t\treturn copy;\n\t};\n\tscheduler._do_paste = function(is_copy, modified_ev, original_ev){\n\t\tif(scheduler.callEvent(\"onBeforeEventPasted\", [is_copy, modified_ev, original_ev]) === false){\n\t\t\treturn;\n\t\t}\n\t\tscheduler.addEvent(modified_ev);\n\t\tscheduler.callEvent(\"onEventPasted\", [is_copy, modified_ev, original_ev]);\n\t};\n\n\tscheduler._is_key_nav_active = function(){\n\t\tif(this._is_initialized() && !this._is_lightbox_open() && this.config.key_nav){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t};\n\n\tfunction getSelectedEvent(){\n\t\tvar node = scheduler.$keyboardNavigation.dispatcher.getActiveNode();\n\t\tif(node && node.eventId) return node.eventId;\n\t\treturn scheduler._select_id;\n\t}\n\n\tscheduler.event(document, \"keydown\", function(e){\n\t\t// compatibility fix - scheduler focus on ctrl+v on mouse hover\n\t\tif(((e.ctrlKey || e.metaKey) && e.keyCode == 86) && scheduler._buffer_event && !scheduler.$keyboardNavigation.dispatcher.isEnabled()) {\n\t\t\tscheduler.$keyboardNavigation.dispatcher.isActive = currentTarget();\n\t\t}\n\t});\n\n\tscheduler._key_nav_copy_paste = function(e){\n\t\tif(!scheduler._is_key_nav_active()) return true;\n\n\t\tif (e.keyCode == 37 || e.keyCode == 39) { // Left, Right arrows\n\t\t\te.cancelBubble = true;\n\n\t\t\tvar next = scheduler.date.add(scheduler._date,(e.keyCode == 37 ? -1 : 1 ),scheduler._mode);\n\t\t\tscheduler.setCurrentView(next);\n\t\t\treturn true;\n\t\t}\n\n\t\tvar select_id = getSelectedEvent();\n\t\tif ((e.ctrlKey || e.metaKey) && e.keyCode == 67) { // CTRL+C\n\t\t\tif (select_id) {\n\t\t\t\tscheduler._buffer_event = copyEvent(scheduler.getEvent(select_id));\n\t\t\t\tisCopy = true;\n\t\t\t\tscheduler.callEvent(\"onEventCopied\", [scheduler.getEvent(select_id)]);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tif ((e.ctrlKey || e.metaKey) && e.keyCode == 88) { // CTRL+X\n\t\t\tif (select_id) {\n\t\t\t\tisCopy = false;\n\t\t\t\tvar ev = scheduler._buffer_event = copyEvent(scheduler.getEvent(select_id));\n\n\t\t\t\tscheduler.updateEvent(ev.id);\n\t\t\t\tscheduler.callEvent(\"onEventCut\", [ev]);\n\t\t\t}\n\t\t}\n\n\t\tif ((e.ctrlKey || e.metaKey) && e.keyCode == 86 && currentTarget(e)) { // CTRL+V\n\t\t\tvar ev = scheduler._buffer_event ? scheduler.getEvent(scheduler._buffer_event.id) : scheduler._buffer_event;\n\t\t\tev = ev || scheduler._buffer_event;\n\n\t\t\tif (ev) {\n\t\t\t\tvar new_ev = scheduler._make_pasted_event(ev);\n\t\t\t\tif (isCopy) {\n\t\t\t\t\tnew_ev.id = scheduler.uid();\n\t\t\t\t\tscheduler._do_paste(isCopy, new_ev, ev);\n\t\t\t\t}\n\t\t\t\telse { // cut operation\n\t\t\t\t\tvar res = scheduler.callEvent(\"onBeforeEventChanged\",[new_ev, e, false, ev]);\n\t\t\t\t\tif (res) {\n\t\t\t\t\t\tscheduler._do_paste(isCopy, new_ev, ev);\n\t\t\t\t\t\tisCopy = true; // switch to copy after first paste operation\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t};\n};\nscheduler._temp_key_scope();\n\n}","export default function(scheduler){\n\nscheduler.$keyboardNavigation.attachSchedulerHandlers = function(){\n\tvar dispatcher = scheduler.$keyboardNavigation.dispatcher;\n\n\tvar keyDownHandler = function(e){\n\t\tif(!scheduler.config.key_nav) return;\n\n\t\treturn dispatcher.keyDownHandler(e);\n\t};\n\n\tvar focusHandler = function () {\n\t\tdispatcher.keepScrollPosition(function () {\n\t\t\tdispatcher.focusGlobalNode();\n\t\t});\n\t};\n\n\tvar waitCall;\n\tscheduler.attachEvent(\"onDataRender\", function(){\n\t\tif(!scheduler.config.key_nav) return;\n\t\tif(!(dispatcher.isEnabled() && !scheduler.getState().editor_id)) return;\n\n\t\tclearTimeout(waitCall);\n\t\twaitCall = setTimeout(function(){\n\t\t\tif(scheduler.$destroyed){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(!dispatcher.isEnabled())\n\t\t\t\tdispatcher.enable();\n\t\t\treFocusActiveNode();\n\t\t});\n\t});\n\n\tvar reFocusActiveNode = function(){\n\t\tif(!dispatcher.isEnabled())\n\t\t\treturn;\n\n\t\tvar activeNode = dispatcher.getActiveNode();\n\t\tif(!activeNode)\n\t\t\treturn;\n\n\t\tif(!activeNode.isValid()){\n\t\t\tactiveNode = activeNode.fallback();\n\t\t}\n\n\t\tif(!activeNode || activeNode instanceof scheduler.$keyboardNavigation.MinicalButton || activeNode instanceof scheduler.$keyboardNavigation.MinicalCell)\n\t\t\treturn;\n\n\t\tdispatcher.keepScrollPosition(function () {\n\t\t\tactiveNode.focus(true);\n\t\t});\n\t};\n\n\tscheduler.attachEvent(\"onSchedulerReady\", function(){\n\t\tvar container = scheduler.$container;\n\t\tscheduler.eventRemove(document, \"keydown\", keyDownHandler);\n\t\tscheduler.eventRemove(container, \"mousedown\", mousedownHandler);\n\t\tscheduler.eventRemove(container, \"focus\", focusHandler);\n\n\n\t\tif(scheduler.config.key_nav){\n\n\t\t\tscheduler.event(document, \"keydown\", keyDownHandler);\n\t\t\tscheduler.event(container, \"mousedown\", mousedownHandler);\n\t\t\tscheduler.event(container, \"focus\", focusHandler);\n\n\t\t\tcontainer.setAttribute(\"tabindex\", \"0\");\n\n\t\t}else{\n\t\t\tcontainer.removeAttribute(\"tabindex\");\n\t\t}\n\t});\n\n\tfunction mousedownHandler(e){\n\t\tif(!scheduler.config.key_nav) return true;\n\n\t\tconst view = scheduler.getView();\n\t\tlet dataAreaClick = false;\n\t\tif (scheduler.getState().mode === \"month\") {\n\t\t\tdataAreaClick = scheduler.$keyboardNavigation.isChildOf(e.target || e.srcElement, scheduler.$container.querySelector(\".dhx_cal_month_table\"));\n\t\t} else if (view && view.layout === \"timeline\") {\n\t\t\tdataAreaClick = scheduler.$keyboardNavigation.isChildOf(e.target || e.srcElement, scheduler.$container.querySelector(\".dhx_timeline_data_col\"));\n\t\t} else {\n\t\t\tconst listOfScales = scheduler.$container.querySelectorAll(\".dhx_scale_holder\");\n\t\t\tconst arrOfScales = Array.from(listOfScales);\n\t\t\tdataAreaClick = arrOfScales.some(scale => scale === e.target.parentNode);\n\t\t}\n\n\t\tvar pos = scheduler.getActionData(e);\n\n\t\tvar focusNode;\n\t\tif(scheduler._locate_event(e.target || e.srcElement)){\n\t\t\tfocusNode = new scheduler.$keyboardNavigation.Event(scheduler._locate_event(e.target || e.srcElement));\n\t\t}else if(dataAreaClick){\n\t\t\tfocusNode = new scheduler.$keyboardNavigation.TimeSlot();\n\t\t\tif(pos.date && dataAreaClick){\n\t\t\t\tfocusNode = focusNode.nextSlot(new scheduler.$keyboardNavigation.TimeSlot(pos.date, null, pos.section));\n\t\t\t}\n\t\t}\n\n\t\tif(focusNode) {\n\t\t\tif (!dispatcher.isEnabled()) {\n\t\t\t\tdispatcher.activeNode = focusNode;\n\n\t\t\t} else {\n\t\t\t\tif (pos.date && dataAreaClick) {\n\t\t\t\t\tdispatcher.delay(function () {\n\t\t\t\t\t\tdispatcher.setActiveNode(focusNode);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction focusEvent(evNode){\n\t\tif(!scheduler.config.key_nav) return;\n\t\tif(!dispatcher.isEnabled()) return;\n\n\n\t\tvar prevState = evNode;\n\t\tvar focusNode = new scheduler.$keyboardNavigation.Event(prevState.eventId);\n\t\tif(!focusNode.isValid()){\n\t\t\tvar lastStart = focusNode.start || prevState.start;\n\t\t\tvar lastEnd = focusNode.end || prevState.end;\n\t\t\tvar lastSection = focusNode.section || prevState.section;\n\n\t\t\tfocusNode = new scheduler.$keyboardNavigation.TimeSlot(lastStart, lastEnd, lastSection);\n\t\t\tif(!focusNode.isValid()){\n\t\t\t\tfocusNode = new scheduler.$keyboardNavigation.TimeSlot();\n\t\t\t}\n\t\t}\n\n\t\tdispatcher.setActiveNode(focusNode);\n\t\tvar node = dispatcher.getActiveNode();\n\t\tif(node && node.getNode && document.activeElement != node.getNode()){\n\t\t\tdispatcher.focusNode(dispatcher.getActiveNode());\n\t\t}\n\t}\n\n\n\tvar updateEvent = scheduler.updateEvent;\n\tscheduler.updateEvent = function(id){\n\t\tvar res = updateEvent.apply(this, arguments);\n\t\tif(scheduler.config.key_nav && dispatcher.isEnabled()){\n\t\t\tif(scheduler.getState().select_id == id){\n\t\t\t\tvar element = new scheduler.$keyboardNavigation.Event(id);\n\n\t\t\t\tif(!scheduler.getState().lightbox_id){\n\t\t\t\t\tfocusEvent(element);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn res;\n\t};\n\n\tscheduler.attachEvent(\"onEventDeleted\", function(id) {\n\t\tif(!scheduler.config.key_nav) return true;\n\t\tif(dispatcher.isEnabled()){\n\t\t\tvar activeNode = dispatcher.getActiveNode();\n\t\t\tif(activeNode.eventId == id){\n\t\t\t\tdispatcher.setActiveNode(new scheduler.$keyboardNavigation.TimeSlot());\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t});\n\n\tscheduler.attachEvent(\"onClearAll\", function(){\n\t\tif(!scheduler.config.key_nav) return true;\n\t\tif(dispatcher.isEnabled()){\n\t\t\tif(dispatcher.getActiveNode() instanceof scheduler.$keyboardNavigation.Event){\n\t\t\t\tdispatcher.setActiveNode(new scheduler.$keyboardNavigation.TimeSlot());\n\t\t\t}\n\t\t}\n\t});\n\n};\n\n}","/* eslint-disable */\n\nexport default function dhtmlxError(type, name, params) {\n\tif (!this.catches)\n\t\tthis.catches = [];\n\n\treturn this;\n}\n\ndhtmlxError.prototype.catchError = function (type, func_name) {\n\tthis.catches[type] = func_name;\n};\n\ndhtmlxError.prototype.throwError = function (type, name, params) {\n\tif (this.catches[type])\n\t\treturn this.catches[type](type, name, params);\n\n\tif (this.catches[\"ALL\"])\n\t\treturn this.catches[\"ALL\"](type, name, params);\n\n\tglobal.alert(\"Error type: \" + arguments[0] + \"\\nDescription: \" + arguments[1]);\n\treturn null;\n};\n\n","import { IMapAdapter, ICalendarEvent, IMapSettings, IMapPosition} from \"./types\";\ndeclare let google: any;\n\nexport class GoogleMapAdapter implements IMapAdapter {\n\tprivate map: any;\n\tprivate scheduler: any;\n\tprivate settings: IMapSettings;\n\tprivate _markers: any[];\n\tprivate infoWindow: any;\n\tconstructor(scheduler: any) {\n\t\tthis.map = null;\n\t\tthis._markers = [];\n\t\tthis.scheduler = scheduler;\n\t}\n\tonEventClick(event: ICalendarEvent): void {\n\t\tif (this._markers && this._markers.length > 0) {\n\t\t\tfor (let i = 0; i < this._markers.length; i++) {\n\t\t\t\tif (event.id == this._markers[i].event.id) {\n\t\t\t\t\tlet zoom = this.settings.zoom_after_resolve || this.settings.initial_zoom;\n\t\t\t\t\tif (event.lat && event.lng){\n\t\t\t\t\t\tthis.map.setCenter({\n\t\t\t\t\t\t\tlat: event.lat, \n\t\t\t\t\t\t\tlng: event.lng,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tthis.map.setZoom(zoom);\n\t\t\t\t\t} else {\t\t\t\t\t\t\n\t\t\t\t\t\tthis.map.setCenter({\n\t\t\t\t\t\t\tlat: this.settings.error_position.lat, \n\t\t\t\t\t\t\tlng: this.settings.error_position.lng,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tthis.map.setZoom(zoom);\n\t\t\t\t\t}\n\t\t\t\t\tgoogle.maps.event.trigger(this._markers[i].marker, 'click');\n\t\t\t\t}\t\n\t\t\t}\n\t\t} \n\t}\n\n\tinitialize(container: HTMLElement, options: IMapSettings): void {\n\t\tthis.settings = options;\n\t\tlet scheduler = this.scheduler;\n\t\tlet mapOptions = {\n\t\t\tcenter: { lat: options.initial_position.lat, lng: options.initial_position.lng },\n\t\t\tzoom: options.initial_zoom,\n\t\t\tmapId: container.id,\n\t\t\tscrollwheel: true,\n\t\t\tmapTypeId: options.type\n\t\t}\n\t\t// we need to reuse the google map to avoid leak memory\n\t\tif (this.map === null) {\n\t\t\tthis.map = new google.maps.Map(container, mapOptions);\n\t\t}\n\t\telse {\n\t\t\tlet map = this.map;\n\t\t\tcontainer.appendChild(this.map.__gm.messageOverlay);\n\t\t\tcontainer.appendChild(this.map.__gm.outerContainer);\n\t\t\tsetTimeout(function() {\n\t\t\t\tmap.setOptions({container: container.id});\n\t\t\t}, 500);\n\t\t}\n\t\tgoogle.maps.event.addListener(this.map, \"dblclick\", function(event) {\n\t\t\tconst geocoder = new google.maps.Geocoder();\n\t\n\t\t\tif (!scheduler.config.readonly && scheduler.config.dblclick_create) {\n\t\t\t\tlet point = event.latLng;\n\t\t\t\tgeocoder.geocode(\n\t\t\t\t\t{ 'latLng': point },\n\t\t\t\t\tfunction(results, status) {\n\t\t\t\t\t\tif (status == google.maps.GeocoderStatus.OK) {\n\t\t\t\t\t\t\tpoint = results[0].geometry.location;\n\t\t\t\t\t\t\tscheduler.addEventNow({\n\t\t\t\t\t\t\t\tlat: point.lat(),\n\t\t\t\t\t\t\t\tlng: point.lng(),\n\t\t\t\t\t\t\t\tevent_location: results[0].formatted_address,\n\t\t\t\t\t\t\t\tstart_date: scheduler.getState().date,\n\t\t\t\t\t\t\t\tend_date: scheduler.date.add(scheduler.getState().date, scheduler.config.time_step, \"minute\")\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconsole.error('Geocode was not successful for the following reason: ' + status);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tdestroy(container: HTMLElement): void {\n\t\tgoogle.maps.event.clearInstanceListeners(window);\n\t\tgoogle.maps.event.clearInstanceListeners(document);\n\t\tgoogle.maps.event.clearInstanceListeners(container);\n\t\twhile (container.firstChild) {\n\t\t\tcontainer.firstChild.remove();\n\t\t}\n\t\tcontainer.innerHTML = \"\";\n\t}\n\n\tasync addEventMarker(event: ICalendarEvent): Promise {\n\t\tlet config = {\n\t\t\ttitle: event.text,\n\t\t\tposition: {},\n\t\t\tmap: {}\n\t\t}\n\t\t\n\t\tif (event.lat && event.lng) {\n\t\t\tconfig.position = { lat: event.lat, lng: event.lng };\n\t\t} else {\n\t\t\tconfig.position = { lat: this.settings.error_position.lat, lng: this.settings.error_position.lng }\n\t\t}\n\t\tconst { AdvancedMarkerElement } = await google.maps.importLibrary(\"marker\");\n\t\tlet marker;\n\t\tif (this.scheduler.ext.mapView.createMarker) {\n\t\t\tconfig.map = this.map;\n\t\t\tmarker = this.scheduler.ext.mapView.createMarker(config);\n\t\t} else {\n\t\t\tmarker = new AdvancedMarkerElement(config);\n\t\t\tmarker.map = this.map;\n\t\t}\n\t\tmarker.setMap(this.map);\n\t\t//case for markeks which were deleted with DataProcessor\n\t\tif (event[\"!nativeeditor_status\"] == \"true_deleted\"){\n\t\t\tmarker.setMap(null);\n\t\t}\n\t\tgoogle.maps.event.addListener(marker, \"click\", () => {\n\t\t\tif (this.infoWindow) {\n\t\t\t\tthis.infoWindow.close();\n\t\t\t}\n\t\t\tthis.infoWindow = new google.maps.InfoWindow({maxWidth: this.settings.info_window_max_width});\n\t\t\tthis.infoWindow.setContent(this.scheduler.templates.map_info_content(event));\n\t\t\tthis.infoWindow.open({\n\t\t\t\tanchor: marker,\n\t\t\t\tmap: this.map,\n\t\t\t});\n\t\t});\n\t\tlet markerInfo = {event, ...config, marker};\n\t\tthis._markers.push(markerInfo);\n\t}\n\n\tremoveEventMarker(eventId: string): void {\n\t\tfor (let i = 0; i < this._markers.length; i++) {\n\t\t\tif (eventId == this._markers[i].event.id) {\n\t\t\t\tthis._markers[i].marker.setVisible(false);\n\t\t\t\tthis._markers[i].marker.setMap(null);\n\t\t\t\tthis._markers[i].marker.setPosition(null);\n\t\t\t\tthis._markers[i].marker = null;\n\t\t\t\tthis._markers.splice(i,1);\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\t}\n\n\tupdateEventMarker(event: ICalendarEvent): void {\n\t\tfor (let i = 0; i < this._markers.length; i++) {\n\t\t\tif(this._markers[i].event.id == event.id) {\n\t\t\t\tthis._markers[i].event = event;\n\t\t\t\tthis._markers[i].position.lat = event.lat;\n\t\t\t\tthis._markers[i].position.lng = event.lng;\n\t\t\t\tthis._markers[i].text = event.text;\n\t\t\t\tlet latlng = new google.maps.LatLng(event.lat, event.lng);\n\t\t\t\tthis._markers[i].marker.setPosition(latlng);\n\t\t\t}\n\t\t}\n\t}\n\n\tclearEventMarkers(): void {\n\t\tif (this._markers.length > 0) {\n\t\t\tfor (let i = 0; i < this._markers.length; i++) {\n\t\t\t\tthis._markers[i].marker.setMap(null);\n\t\t\t}\n\t\t\tthis._markers = [];\n\t\t}\n\t}\n\n\tsetView(latitude: number, longitude: number, zoom: number): void {\n\t\tthis.map.setCenter({\n\t\t\tlat: latitude, \n\t\t\tlng: longitude,\n\t\t});\n\t\tthis.map.setZoom(zoom);\n\t}\n\n\tasync resolveAddress(string: string): Promise {\n\t\tconst geocoder = new google.maps.Geocoder();\n\t\tlet position: any = await new Promise((resolve) => {\n\t\t\tgeocoder.geocode(\n\t\t\t\t{ 'address': string },\n\t\t\t\tfunction(results, status) {\n\t\t\t\t\tif (status == google.maps.GeocoderStatus.OK) {\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t lat: results[0].geometry.location.lat(),\n\t\t\t\t\t\t lng: results[0].geometry.location.lng()\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.error('Geocode was not successful for the following reason: ' + status);\n\t\t\t\t\t\tresolve({});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\t\treturn position;\n\t}\n\t\n}","import { IMapAdapter, ICalendarEvent, IMapSettings, IMapPosition} from \"./types\";\n\ndeclare let L: any\n\nexport class OpenStreetMapAdapter implements IMapAdapter {\n\tprivate map: any;\n\tprivate scheduler: any;\n\tprivate _markers: any[];\n\tprivate settings: IMapSettings;\n\tconstructor(scheduler: any) {\n\t\tthis.map = null;\n\t\tthis._markers = [];\n\t\tthis.scheduler = scheduler;\n\t}\n\tonEventClick(event: ICalendarEvent): void {\n\t\tif (this._markers && this._markers.length > 0) {\n\t\t\tfor (let i = 0; i < this._markers.length; i++) {\n\t\t\t\tif (event.id == this._markers[i].event.id) {\n\t\t\t\t\tthis._markers[i].marker.openPopup();\n\t\t\t\t\tthis._markers[i].marker.closeTooltip();\n\t\t\t\t\tif (event.lat && event.lng) {\n\t\t\t\t\t\tthis.setView(event.lat, event.lng, this.settings.zoom_after_resolve || this.settings.initial_zoom);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.setView(this.settings.error_position.lat, this.settings.error_position.lng, this.settings.zoom_after_resolve || this.settings.initial_zoom);\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t}\n\t\t} \n\t}\n\n\tinitialize(container: HTMLElement, options: IMapSettings): void {\n\t\tlet scheduler = this.scheduler;\n\t\tlet mapWrapper = document.createElement('div');\n\t\tmapWrapper.className = 'mapWrapper';\n\t\tmapWrapper.id = 'mapWrapper';\n\t\tmapWrapper.style.width = container.style.width;\n\t\tmapWrapper.style.height = container.style.height;\n\t\tcontainer.appendChild(mapWrapper);\n\n\t\tlet map = L.map(mapWrapper, {\n\t\t\tcenter: L.latLng(options.initial_position.lat, options.initial_position.lng),\n\t\t\tzoom: options.initial_zoom,\n\t\t\tkeyboard: false // need to set false, due to bug with moving window\n\t\t});\n\t\tL.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);\n\t\tmap.on(\"dblclick\", async function(e){\n\t\t\tconst settings = {\n\t\t\t\t\"method\": \"GET\",\n\t\t\t\theaders: {\n\t\t\t\t\t\"Accept-Language\": \"en\",\n\t\t\t\t},\n\t\t\t};\n\t\t\tlet response = await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${e.latlng.lat}&lon=${e.latlng.lng}&format=json`, settings).then(response => response.json());\n\t\t\tif (response.address) {\n\t\t\t\tlet address = response.address.country;\n\t\t\t\tscheduler.addEventNow({\n\t\t\t\t\tlat: e.latlng.lat,\n\t\t\t\t\tlng: e.latlng.lng,\n\t\t\t\t\tevent_location: address,\n\t\t\t\t\tstart_date: scheduler.getState().date,\n\t\t\t\t\tend_date: scheduler.date.add(scheduler.getState().date, scheduler.config.time_step, \"minute\")\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconsole.error(\"unable recieve a position of the event\", response.error);\n\t\t\t}\n\t\t});\n\t\tthis.map = map;\n\t\tthis.settings = options;\n\t}\n\n\tdestroy(container: HTMLElement): void {\n\t\tthis.map.remove();\n\t\twhile (container.firstChild) {\n\t\t\tcontainer.firstChild.remove();\n\t\t}\n\t\tcontainer.innerHTML = \"\";\n\t}\n\n\taddEventMarker(event: ICalendarEvent): void {\n\t\tconst myIcon = L.icon({\n\t\t\ticonUrl: 'https://unpkg.com/leaflet@1.0.3/dist/images/marker-icon.png',\n\t\t\ticonSize: [25, 41],\n\t\t\tshadowSize: [30, 65],\n\t\t\ticonAnchor: [12, 41],\n\t\t\tshadowAnchor: [7, 65]\n\t\t});\n\t\tlet popupConfig = {\n\t\t\tminWidth: 180,\n\t\t\tmaxWidth: this.settings.info_window_max_width,\n\t\t}\n\t\tconst markerPopup = L.popup(popupConfig).setContent(this.scheduler.templates.map_info_content(event));\n\t\tconst tooltip = L.tooltip().setContent(event.text);\n\n\t\tlet markerConfig = [\n\t\t\tevent.lat,\n\t\t\tevent.lng\n\t\t]\n\t\t\n\t\tif (!event.lat || !event.lng) {\n\t\t\tmarkerConfig = [this.settings.error_position.lat, this.settings.error_position.lng];\n\t\t}\n\t\tconst marker = L.marker(markerConfig, {\n\t\t\ticon: myIcon\n\t\t}).bindPopup(markerPopup).bindTooltip(tooltip).addTo(this.map);\n\t\tconst markerInfo = {event, marker};\n\t\tthis._markers.push(markerInfo);\t\t\n\t}\n\n\tremoveEventMarker(eventId: string): void {\n\t\tfor (let i = 0; i < this._markers.length; i++) {\n\t\t\tif (eventId == this._markers[i].event.id) {\n\t\t\t\tthis.map.removeLayer(this._markers[i].marker);\n\t\t\t\tthis._markers.splice(i,1);\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\t}\n\n\tupdateEventMarker(event: ICalendarEvent): void {\n\t\tfor (let i = 0; i < this._markers.length; i++) {\n\t\t\tif(this._markers[i].event.id == event.id) {\n\t\t\t\tthis._markers[i].event = event;\n\t\t\t\tif (!event.lat || !event.lng){\n\t\t\t\t\tthis._markers[i].marker.setLatLng([this.settings.error_position.lat, this.settings.error_position.lng]);\n\t\t\t\t} else {\n\t\t\t\t\tthis._markers[i].marker.setLatLng([event.lat, event.lng]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tclearEventMarkers(): void {\n\t\tif(this._markers) {\n\t\t\tfor (let i = 0; i < this._markers.length; i++) {\n\t\t\t\tthis.map.removeLayer(this._markers[i].marker); \n\t\t\t}\n\t\t\tthis._markers = [];\n\t\t}\n\t}\n\n\tsetView(latitude: number, longitude: number, zoom: number): void {\n\t\tthis.map.setView([latitude, longitude], zoom);\n\t}\n\n\tasync resolveAddress(string: string): Promise {\n\t\tconst settings = {\n\t\t\t\"method\": \"GET\",\n\t\t\theaders: {\n\t\t\t\t\"Accept-Language\": \"en\",\n\t\t\t},\n\t\t};\n\t\tlet position:any = {};\n\t\tlet response = await fetch(`https://nominatim.openstreetmap.org/search?q=${string}&format=json`, settings).then(response => response.json());\n\t\tif (response && response.length) {\n\t\t\tposition.lat = +response[0].lat;\n\t\t\tposition.lng = +response[0].lon;\n\t\t} else {\n\t\t\tconsole.error(`Unable recieve a position of the event's location: ${string}`);\n\t\t}\n\t\treturn position;\n\t}\n}","import { IMapAdapter, ICalendarEvent, IMapSettings, IMapPosition} from \"./types\";\n\ndeclare let mapboxgl: any;\ndeclare let MapboxGeocoder: any;\n\nexport class MapboxAdapter implements IMapAdapter {\n\tprivate map: any;\n\tprivate scheduler: any;\n\tprivate settings: IMapSettings;\n\tprivate _markers: any[];\n\tconstructor(scheduler: any) {\n\t\tthis.map = null;\n\t\tthis._markers = [];\n\t\tthis.scheduler = scheduler;\n\t}\n\tonEventClick(event: ICalendarEvent): void {\n\t\tif (this._markers && this._markers.length > 0) {\n\t\t\tfor (let i = 0; i < this._markers.length; i++) {\n const popup = this._markers[i].marker.getPopup();\n if (popup.isOpen()){\n popup.remove();\n }\n\t\t\t\tif (event.id == this._markers[i].event.id) {\n\t\t\t\t\tthis._markers[i].marker.togglePopup();\n\t\t\t\t\tif (event.lat && event.lng) {\n\t\t\t\t\t\tthis.setView(event.lat, event.lng, this.settings.zoom_after_resolve || this.settings.initial_zoom);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.setView(this.settings.error_position.lat, this.settings.error_position.lng, this.settings.zoom_after_resolve || this.settings.initial_zoom);\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t}\n\t\t} \n\t}\n\n\tinitialize(container: HTMLElement, options: IMapSettings): void {\n let scheduler = this.scheduler;\n\n\t\tmapboxgl.accessToken = options.accessToken;\n const map = new mapboxgl.Map({\n container: container, \n center: [options.initial_position.lng, options.initial_position.lat], \n zoom: options.initial_zoom + 1, // problems with coordinates if zoom = 1\n });\n map.on(\"dblclick\",async function(e){\n\t\t\tlet response = await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${e.lngLat.lng},${ e.lngLat.lat}.json?access_token=${options.accessToken}`).then(response => response.json());\n\t\t\tif (response.features){\n\t\t\t\tlet address = response.features[0].place_name;\n\t\t\t\tscheduler.addEventNow({\n\t\t\t\t\tlat: e.lngLat.lat,\n\t\t\t\t\tlng: e.lngLat.lng,\n\t\t\t\t\tevent_location: address,\n\t\t\t\t\tstart_date: scheduler.getState().date,\n\t\t\t\t\tend_date: scheduler.date.add(scheduler.getState().date, scheduler.config.time_step, \"minute\")\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconsole.error(\"unable recieve a position of the event\");\n\t\t\t}\n\t\t});\n this.map = map;\n this.settings = options;\n\t}\n\n\tdestroy(container: HTMLElement): void {\n\t\tthis.map.remove();\n while (container.firstChild) {\n\t\t\tcontainer.firstChild.remove();\n\t\t}\n container.innerHTML = \"\";\n\t}\n\n\taddEventMarker(event: ICalendarEvent): void {\n let config = [\n\t\t\tevent.lng,\n\t\t\tevent.lat\n\t\t]\n\t\t\n\t\tif (!event.lat || !event.lng) {\n\t\t\tconfig = [this.settings.error_position.lng, this.settings.error_position.lat];\n\t\t} \n\n\t\tconst popup = new mapboxgl.Popup({ offset: 25, focusAfterOpen: false})\n .setMaxWidth(`${this.settings.info_window_max_width}px`) \n .setHTML(this.scheduler.templates.map_info_content(event));\n const marker = new mapboxgl.Marker()\n .setLngLat(config)\n .setPopup(popup)\n .addTo(this.map);\n const markerInfo = {event, marker}; \n this._markers.push(markerInfo);\n\t}\n\n\tremoveEventMarker(eventId: string): void {\n\t\tfor (let i = 0; i < this._markers.length; i++) {\n\t\t\tif (eventId == this._markers[i].event.id) {\n\t\t\t\tthis._markers[i].marker.remove();\n this._markers.splice(i,1);\n\t\t\t\ti--;\n\t\t\t}\n\t\t}\n\t}\n\n\tupdateEventMarker(event: ICalendarEvent): void {\n\t\tfor (let i = 0; i < this._markers.length; i++) {\n\t\t\tif(this._markers[i].event.id == event.id) {\n\t\t\t\tthis._markers[i].event = event;\n\t\t\t\tif (!event.lat || !event.lng){\n\t\t\t\t\tthis._markers[i].marker.setLngLat([this.settings.error_position.lng, this.settings.error_position.lat]);\n\t\t\t\t} else {\n\t\t\t\t\tthis._markers[i].marker.setLngLat([event.lng, event.lat]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tclearEventMarkers(): void {\n\t\tfor (let i = 0; i {\n\t\tlet response = await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${string}.json?access_token=${this.settings.accessToken}`).then(response => response.json());\n\t\tlet position:any = {};\n\t\tif (response && response.features.length) {\n\t\t\tposition.lng = response.features[0].center[0];\n\t\t\tposition.lat = response.features[0].center[1];\n\t\t} else {\n\t\t\tconsole.error(`Unable recieve a position of the event's location: ${string}`);\n\t\t}\n\t\treturn position;\n\t}\n}","// =============================================================================\n// Weekday\n// =============================================================================\nexport var ALL_WEEKDAYS = [\n 'MO',\n 'TU',\n 'WE',\n 'TH',\n 'FR',\n 'SA',\n 'SU',\n];\nvar Weekday = /** @class */ (function () {\n function Weekday(weekday, n) {\n if (n === 0)\n throw new Error(\"Can't create weekday with n == 0\");\n this.weekday = weekday;\n this.n = n;\n }\n Weekday.fromStr = function (str) {\n return new Weekday(ALL_WEEKDAYS.indexOf(str));\n };\n // __call__ - Cannot call the object directly, do it through\n // e.g. RRule.TH.nth(-1) instead,\n Weekday.prototype.nth = function (n) {\n return this.n === n ? this : new Weekday(this.weekday, n);\n };\n // __eq__\n Weekday.prototype.equals = function (other) {\n return this.weekday === other.weekday && this.n === other.n;\n };\n // __repr__\n Weekday.prototype.toString = function () {\n var s = ALL_WEEKDAYS[this.weekday];\n if (this.n)\n s = (this.n > 0 ? '+' : '') + String(this.n) + s;\n return s;\n };\n Weekday.prototype.getJsWeekday = function () {\n return this.weekday === 6 ? 0 : this.weekday + 1;\n };\n return Weekday;\n}());\nexport { Weekday };\n//# sourceMappingURL=weekday.js.map","// =============================================================================\n// Helper functions\n// =============================================================================\nimport { ALL_WEEKDAYS } from './weekday';\nexport var isPresent = function (value) {\n return value !== null && value !== undefined;\n};\nexport var isNumber = function (value) {\n return typeof value === 'number';\n};\nexport var isWeekdayStr = function (value) {\n return typeof value === 'string' && ALL_WEEKDAYS.includes(value);\n};\nexport var isArray = Array.isArray;\n/**\n * Simplified version of python's range()\n */\nexport var range = function (start, end) {\n if (end === void 0) { end = start; }\n if (arguments.length === 1) {\n end = start;\n start = 0;\n }\n var rang = [];\n for (var i = start; i < end; i++)\n rang.push(i);\n return rang;\n};\nexport var clone = function (array) {\n return [].concat(array);\n};\nexport var repeat = function (value, times) {\n var i = 0;\n var array = [];\n if (isArray(value)) {\n for (; i < times; i++)\n array[i] = [].concat(value);\n }\n else {\n for (; i < times; i++)\n array[i] = value;\n }\n return array;\n};\nexport var toArray = function (item) {\n if (isArray(item)) {\n return item;\n }\n return [item];\n};\nexport function padStart(item, targetLength, padString) {\n if (padString === void 0) { padString = ' '; }\n var str = String(item);\n targetLength = targetLength >> 0;\n if (str.length > targetLength) {\n return String(str);\n }\n targetLength = targetLength - str.length;\n if (targetLength > padString.length) {\n padString += repeat(padString, targetLength / padString.length);\n }\n return padString.slice(0, targetLength) + String(str);\n}\n/**\n * Python like split\n */\nexport var split = function (str, sep, num) {\n var splits = str.split(sep);\n return num\n ? splits.slice(0, num).concat([splits.slice(num).join(sep)])\n : splits;\n};\n/**\n * closure/goog/math/math.js:modulo\n * Copyright 2006 The Closure Library Authors.\n * The % operator in JavaScript returns the remainder of a / b, but differs from\n * some other languages in that the result will have the same sign as the\n * dividend. For example, -1 % 8 == -1, whereas in some other languages\n * (such as Python) the result would be 7. This function emulates the more\n * correct modulo behavior, which is useful for certain applications such as\n * calculating an offset index in a circular list.\n *\n * @param {number} a The dividend.\n * @param {number} b The divisor.\n * @return {number} a % b where the result is between 0 and b (either 0 <= x < b\n * or b < x <= 0, depending on the sign of b).\n */\nexport var pymod = function (a, b) {\n var r = a % b;\n // If r and b differ in sign, add b to wrap the result to the correct sign.\n return r * b < 0 ? r + b : r;\n};\n/**\n * @see: \n */\nexport var divmod = function (a, b) {\n return { div: Math.floor(a / b), mod: pymod(a, b) };\n};\nexport var empty = function (obj) {\n return !isPresent(obj) || obj.length === 0;\n};\n/**\n * Python-like boolean\n *\n * @return {Boolean} value of an object/primitive, taking into account\n * the fact that in Python an empty list's/tuple's\n * boolean value is False, whereas in JS it's true\n */\nexport var notEmpty = function (obj) {\n return !empty(obj);\n};\n/**\n * Return true if a value is in an array\n */\nexport var includes = function (arr, val) {\n return notEmpty(arr) && arr.indexOf(val) !== -1;\n};\n//# sourceMappingURL=helpers.js.map","import { padStart } from './helpers';\nexport var datetime = function (y, m, d, h, i, s) {\n if (h === void 0) { h = 0; }\n if (i === void 0) { i = 0; }\n if (s === void 0) { s = 0; }\n return new Date(Date.UTC(y, m - 1, d, h, i, s));\n};\n/**\n * General date-related utilities.\n * Also handles several incompatibilities between JavaScript and Python\n *\n */\nexport var MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n/**\n * Number of milliseconds of one day\n */\nexport var ONE_DAY = 1000 * 60 * 60 * 24;\n/**\n * @see: \n */\nexport var MAXYEAR = 9999;\n/**\n * Python uses 1-Jan-1 as the base for calculating ordinals but we don't\n * want to confuse the JS engine with milliseconds > Number.MAX_NUMBER,\n * therefore we use 1-Jan-1970 instead\n */\nexport var ORDINAL_BASE = datetime(1970, 1, 1);\n/**\n * Python: MO-SU: 0 - 6\n * JS: SU-SAT 0 - 6\n */\nexport var PY_WEEKDAYS = [6, 0, 1, 2, 3, 4, 5];\n/**\n * py_date.timetuple()[7]\n */\nexport var getYearDay = function (date) {\n var dateNoTime = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());\n return (Math.ceil((dateNoTime.valueOf() - new Date(date.getUTCFullYear(), 0, 1).valueOf()) /\n ONE_DAY) + 1);\n};\nexport var isLeapYear = function (year) {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n};\nexport var isDate = function (value) {\n return value instanceof Date;\n};\nexport var isValidDate = function (value) {\n return isDate(value) && !isNaN(value.getTime());\n};\n/**\n * @return {Number} the date's timezone offset in ms\n */\nexport var tzOffset = function (date) {\n return date.getTimezoneOffset() * 60 * 1000;\n};\n/**\n * @see: \n */\nexport var daysBetween = function (date1, date2) {\n // The number of milliseconds in one day\n // Convert both dates to milliseconds\n var date1ms = date1.getTime();\n var date2ms = date2.getTime();\n // Calculate the difference in milliseconds\n var differencems = date1ms - date2ms;\n // Convert back to days and return\n return Math.round(differencems / ONE_DAY);\n};\n/**\n * @see: \n */\nexport var toOrdinal = function (date) {\n return daysBetween(date, ORDINAL_BASE);\n};\n/**\n * @see - \n */\nexport var fromOrdinal = function (ordinal) {\n return new Date(ORDINAL_BASE.getTime() + ordinal * ONE_DAY);\n};\nexport var getMonthDays = function (date) {\n var month = date.getUTCMonth();\n return month === 1 && isLeapYear(date.getUTCFullYear())\n ? 29\n : MONTH_DAYS[month];\n};\n/**\n * @return {Number} python-like weekday\n */\nexport var getWeekday = function (date) {\n return PY_WEEKDAYS[date.getUTCDay()];\n};\n/**\n * @see: \n */\nexport var monthRange = function (year, month) {\n var date = datetime(year, month + 1, 1);\n return [getWeekday(date), getMonthDays(date)];\n};\n/**\n * @see: \n */\nexport var combine = function (date, time) {\n time = time || date;\n return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds()));\n};\nexport var clone = function (date) {\n var dolly = new Date(date.getTime());\n return dolly;\n};\nexport var cloneDates = function (dates) {\n var clones = [];\n for (var i = 0; i < dates.length; i++) {\n clones.push(clone(dates[i]));\n }\n return clones;\n};\n/**\n * Sorts an array of Date or Time objects\n */\nexport var sort = function (dates) {\n dates.sort(function (a, b) {\n return a.getTime() - b.getTime();\n });\n};\nexport var timeToUntilString = function (time, utc) {\n if (utc === void 0) { utc = true; }\n var date = new Date(time);\n return [\n padStart(date.getUTCFullYear().toString(), 4, '0'),\n padStart(date.getUTCMonth() + 1, 2, '0'),\n padStart(date.getUTCDate(), 2, '0'),\n 'T',\n padStart(date.getUTCHours(), 2, '0'),\n padStart(date.getUTCMinutes(), 2, '0'),\n padStart(date.getUTCSeconds(), 2, '0'),\n utc ? 'Z' : '',\n ].join('');\n};\nexport var untilStringToDate = function (until) {\n var re = /^(\\d{4})(\\d{2})(\\d{2})(T(\\d{2})(\\d{2})(\\d{2})Z?)?$/;\n var bits = re.exec(until);\n if (!bits)\n throw new Error(\"Invalid UNTIL value: \".concat(until));\n return new Date(Date.UTC(parseInt(bits[1], 10), parseInt(bits[2], 10) - 1, parseInt(bits[3], 10), parseInt(bits[5], 10) || 0, parseInt(bits[6], 10) || 0, parseInt(bits[7], 10) || 0));\n};\nvar dateTZtoISO8601 = function (date, timeZone) {\n // date format for sv-SE is almost ISO8601\n var dateStr = date.toLocaleString('sv-SE', { timeZone: timeZone });\n // '2023-02-07 10:41:36'\n return dateStr.replace(' ', 'T') + 'Z';\n};\nexport var dateInTimeZone = function (date, timeZone) {\n var localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n // Date constructor can only reliably parse dates in ISO8601 format\n var dateInLocalTZ = new Date(dateTZtoISO8601(date, localTimeZone));\n var dateInTargetTZ = new Date(dateTZtoISO8601(date, timeZone !== null && timeZone !== void 0 ? timeZone : 'UTC'));\n var tzOffset = dateInTargetTZ.getTime() - dateInLocalTZ.getTime();\n return new Date(date.getTime() - tzOffset);\n};\n//# sourceMappingURL=dateutil.js.map","/**\n * This class helps us to emulate python's generators, sorta.\n */\nvar IterResult = /** @class */ (function () {\n function IterResult(method, args) {\n this.minDate = null;\n this.maxDate = null;\n this._result = [];\n this.total = 0;\n this.method = method;\n this.args = args;\n if (method === 'between') {\n this.maxDate = args.inc\n ? args.before\n : new Date(args.before.getTime() - 1);\n this.minDate = args.inc ? args.after : new Date(args.after.getTime() + 1);\n }\n else if (method === 'before') {\n this.maxDate = args.inc ? args.dt : new Date(args.dt.getTime() - 1);\n }\n else if (method === 'after') {\n this.minDate = args.inc ? args.dt : new Date(args.dt.getTime() + 1);\n }\n }\n /**\n * Possibly adds a date into the result.\n *\n * @param {Date} date - the date isn't necessarly added to the result\n * list (if it is too late/too early)\n * @return {Boolean} true if it makes sense to continue the iteration\n * false if we're done.\n */\n IterResult.prototype.accept = function (date) {\n ++this.total;\n var tooEarly = this.minDate && date < this.minDate;\n var tooLate = this.maxDate && date > this.maxDate;\n if (this.method === 'between') {\n if (tooEarly)\n return true;\n if (tooLate)\n return false;\n }\n else if (this.method === 'before') {\n if (tooLate)\n return false;\n }\n else if (this.method === 'after') {\n if (tooEarly)\n return true;\n this.add(date);\n return false;\n }\n return this.add(date);\n };\n /**\n *\n * @param {Date} date that is part of the result.\n * @return {Boolean} whether we are interested in more values.\n */\n IterResult.prototype.add = function (date) {\n this._result.push(date);\n return true;\n };\n /**\n * 'before' and 'after' return only one date, whereas 'all'\n * and 'between' an array.\n *\n * @return {Date,Array?}\n */\n IterResult.prototype.getValue = function () {\n var res = this._result;\n switch (this.method) {\n case 'all':\n case 'between':\n return res;\n case 'before':\n case 'after':\n default:\n return (res.length ? res[res.length - 1] : null);\n }\n };\n IterResult.prototype.clone = function () {\n return new IterResult(this.method, this.args);\n };\n return IterResult;\n}());\nexport default IterResult;\n//# sourceMappingURL=iterresult.js.map","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n function next() {\n while (env.stack.length) {\n var rec = env.stack.pop();\n try {\n var result = rec.dispose && rec.dispose.call(rec.value);\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n catch (e) {\n fail(e);\n }\n }\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n};\n","import { __extends } from \"tslib\";\nimport IterResult from './iterresult';\n/**\n * IterResult subclass that calls a callback function on each add,\n * and stops iterating when the callback returns false.\n */\nvar CallbackIterResult = /** @class */ (function (_super) {\n __extends(CallbackIterResult, _super);\n function CallbackIterResult(method, args, iterator) {\n var _this = _super.call(this, method, args) || this;\n _this.iterator = iterator;\n return _this;\n }\n CallbackIterResult.prototype.add = function (date) {\n if (this.iterator(date, this._result.length)) {\n this._result.push(date);\n return true;\n }\n return false;\n };\n return CallbackIterResult;\n}(IterResult));\nexport default CallbackIterResult;\n//# sourceMappingURL=callbackiterresult.js.map","export var Frequency;\n(function (Frequency) {\n Frequency[Frequency[\"YEARLY\"] = 0] = \"YEARLY\";\n Frequency[Frequency[\"MONTHLY\"] = 1] = \"MONTHLY\";\n Frequency[Frequency[\"WEEKLY\"] = 2] = \"WEEKLY\";\n Frequency[Frequency[\"DAILY\"] = 3] = \"DAILY\";\n Frequency[Frequency[\"HOURLY\"] = 4] = \"HOURLY\";\n Frequency[Frequency[\"MINUTELY\"] = 5] = \"MINUTELY\";\n Frequency[Frequency[\"SECONDLY\"] = 6] = \"SECONDLY\";\n})(Frequency || (Frequency = {}));\nexport function freqIsDailyOrGreater(freq) {\n return freq < Frequency.HOURLY;\n}\n//# sourceMappingURL=types.js.map","// =============================================================================\n// i18n\n// =============================================================================\nvar ENGLISH = {\n dayNames: [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n ],\n monthNames: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n tokens: {\n SKIP: /^[ \\r\\n\\t]+|^\\.$/,\n number: /^[1-9][0-9]*/,\n numberAsText: /^(one|two|three)/i,\n every: /^every/i,\n 'day(s)': /^days?/i,\n 'weekday(s)': /^weekdays?/i,\n 'week(s)': /^weeks?/i,\n 'hour(s)': /^hours?/i,\n 'minute(s)': /^minutes?/i,\n 'month(s)': /^months?/i,\n 'year(s)': /^years?/i,\n on: /^(on|in)/i,\n at: /^(at)/i,\n the: /^the/i,\n first: /^first/i,\n second: /^second/i,\n third: /^third/i,\n nth: /^([1-9][0-9]*)(\\.|th|nd|rd|st)/i,\n last: /^last/i,\n for: /^for/i,\n 'time(s)': /^times?/i,\n until: /^(un)?til/i,\n monday: /^mo(n(day)?)?/i,\n tuesday: /^tu(e(s(day)?)?)?/i,\n wednesday: /^we(d(n(esday)?)?)?/i,\n thursday: /^th(u(r(sday)?)?)?/i,\n friday: /^fr(i(day)?)?/i,\n saturday: /^sa(t(urday)?)?/i,\n sunday: /^su(n(day)?)?/i,\n january: /^jan(uary)?/i,\n february: /^feb(ruary)?/i,\n march: /^mar(ch)?/i,\n april: /^apr(il)?/i,\n may: /^may/i,\n june: /^june?/i,\n july: /^july?/i,\n august: /^aug(ust)?/i,\n september: /^sep(t(ember)?)?/i,\n october: /^oct(ober)?/i,\n november: /^nov(ember)?/i,\n december: /^dec(ember)?/i,\n comma: /^(,\\s*|(and|or)\\s*)+/i,\n },\n};\nexport default ENGLISH;\n//# sourceMappingURL=i18n.js.map","import ENGLISH from './i18n';\nimport { RRule } from '../rrule';\nimport { isArray, isNumber, isPresent } from '../helpers';\n// =============================================================================\n// Helper functions\n// =============================================================================\n/**\n * Return true if a value is in an array\n */\nvar contains = function (arr, val) {\n return arr.indexOf(val) !== -1;\n};\nvar defaultGetText = function (id) { return id.toString(); };\nvar defaultDateFormatter = function (year, month, day) { return \"\".concat(month, \" \").concat(day, \", \").concat(year); };\n/**\n *\n * @param {RRule} rrule\n * Optional:\n * @param {Function} gettext function\n * @param {Object} language definition\n * @constructor\n */\nvar ToText = /** @class */ (function () {\n function ToText(rrule, gettext, language, dateFormatter) {\n if (gettext === void 0) { gettext = defaultGetText; }\n if (language === void 0) { language = ENGLISH; }\n if (dateFormatter === void 0) { dateFormatter = defaultDateFormatter; }\n this.text = [];\n this.language = language || ENGLISH;\n this.gettext = gettext;\n this.dateFormatter = dateFormatter;\n this.rrule = rrule;\n this.options = rrule.options;\n this.origOptions = rrule.origOptions;\n if (this.origOptions.bymonthday) {\n var bymonthday = [].concat(this.options.bymonthday);\n var bynmonthday = [].concat(this.options.bynmonthday);\n bymonthday.sort(function (a, b) { return a - b; });\n bynmonthday.sort(function (a, b) { return b - a; });\n // 1, 2, 3, .., -5, -4, -3, ..\n this.bymonthday = bymonthday.concat(bynmonthday);\n if (!this.bymonthday.length)\n this.bymonthday = null;\n }\n if (isPresent(this.origOptions.byweekday)) {\n var byweekday = !isArray(this.origOptions.byweekday)\n ? [this.origOptions.byweekday]\n : this.origOptions.byweekday;\n var days = String(byweekday);\n this.byweekday = {\n allWeeks: byweekday.filter(function (weekday) {\n return !weekday.n;\n }),\n someWeeks: byweekday.filter(function (weekday) {\n return Boolean(weekday.n);\n }),\n isWeekdays: days.indexOf('MO') !== -1 &&\n days.indexOf('TU') !== -1 &&\n days.indexOf('WE') !== -1 &&\n days.indexOf('TH') !== -1 &&\n days.indexOf('FR') !== -1 &&\n days.indexOf('SA') === -1 &&\n days.indexOf('SU') === -1,\n isEveryDay: days.indexOf('MO') !== -1 &&\n days.indexOf('TU') !== -1 &&\n days.indexOf('WE') !== -1 &&\n days.indexOf('TH') !== -1 &&\n days.indexOf('FR') !== -1 &&\n days.indexOf('SA') !== -1 &&\n days.indexOf('SU') !== -1,\n };\n var sortWeekDays = function (a, b) {\n return a.weekday - b.weekday;\n };\n this.byweekday.allWeeks.sort(sortWeekDays);\n this.byweekday.someWeeks.sort(sortWeekDays);\n if (!this.byweekday.allWeeks.length)\n this.byweekday.allWeeks = null;\n if (!this.byweekday.someWeeks.length)\n this.byweekday.someWeeks = null;\n }\n else {\n this.byweekday = null;\n }\n }\n /**\n * Test whether the rrule can be fully converted to text.\n *\n * @param {RRule} rrule\n * @return {Boolean}\n */\n ToText.isFullyConvertible = function (rrule) {\n var canConvert = true;\n if (!(rrule.options.freq in ToText.IMPLEMENTED))\n return false;\n if (rrule.origOptions.until && rrule.origOptions.count)\n return false;\n for (var key in rrule.origOptions) {\n if (contains(['dtstart', 'tzid', 'wkst', 'freq'], key))\n return true;\n if (!contains(ToText.IMPLEMENTED[rrule.options.freq], key))\n return false;\n }\n return canConvert;\n };\n ToText.prototype.isFullyConvertible = function () {\n return ToText.isFullyConvertible(this.rrule);\n };\n /**\n * Perform the conversion. Only some of the frequencies are supported.\n * If some of the rrule's options aren't supported, they'll\n * be omitted from the output an \"(~ approximate)\" will be appended.\n *\n * @return {*}\n */\n ToText.prototype.toString = function () {\n var gettext = this.gettext;\n if (!(this.options.freq in ToText.IMPLEMENTED)) {\n return gettext('RRule error: Unable to fully convert this rrule to text');\n }\n this.text = [gettext('every')];\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this[RRule.FREQUENCIES[this.options.freq]]();\n if (this.options.until) {\n this.add(gettext('until'));\n var until = this.options.until;\n this.add(this.dateFormatter(until.getUTCFullYear(), this.language.monthNames[until.getUTCMonth()], until.getUTCDate()));\n }\n else if (this.options.count) {\n this.add(gettext('for'))\n .add(this.options.count.toString())\n .add(this.plural(this.options.count) ? gettext('times') : gettext('time'));\n }\n if (!this.isFullyConvertible())\n this.add(gettext('(~ approximate)'));\n return this.text.join('');\n };\n ToText.prototype.HOURLY = function () {\n var gettext = this.gettext;\n if (this.options.interval !== 1)\n this.add(this.options.interval.toString());\n this.add(this.plural(this.options.interval) ? gettext('hours') : gettext('hour'));\n };\n ToText.prototype.MINUTELY = function () {\n var gettext = this.gettext;\n if (this.options.interval !== 1)\n this.add(this.options.interval.toString());\n this.add(this.plural(this.options.interval)\n ? gettext('minutes')\n : gettext('minute'));\n };\n ToText.prototype.DAILY = function () {\n var gettext = this.gettext;\n if (this.options.interval !== 1)\n this.add(this.options.interval.toString());\n if (this.byweekday && this.byweekday.isWeekdays) {\n this.add(this.plural(this.options.interval)\n ? gettext('weekdays')\n : gettext('weekday'));\n }\n else {\n this.add(this.plural(this.options.interval) ? gettext('days') : gettext('day'));\n }\n if (this.origOptions.bymonth) {\n this.add(gettext('in'));\n this._bymonth();\n }\n if (this.bymonthday) {\n this._bymonthday();\n }\n else if (this.byweekday) {\n this._byweekday();\n }\n else if (this.origOptions.byhour) {\n this._byhour();\n }\n };\n ToText.prototype.WEEKLY = function () {\n var gettext = this.gettext;\n if (this.options.interval !== 1) {\n this.add(this.options.interval.toString()).add(this.plural(this.options.interval) ? gettext('weeks') : gettext('week'));\n }\n if (this.byweekday && this.byweekday.isWeekdays) {\n if (this.options.interval === 1) {\n this.add(this.plural(this.options.interval)\n ? gettext('weekdays')\n : gettext('weekday'));\n }\n else {\n this.add(gettext('on')).add(gettext('weekdays'));\n }\n }\n else if (this.byweekday && this.byweekday.isEveryDay) {\n this.add(this.plural(this.options.interval) ? gettext('days') : gettext('day'));\n }\n else {\n if (this.options.interval === 1)\n this.add(gettext('week'));\n if (this.origOptions.bymonth) {\n this.add(gettext('in'));\n this._bymonth();\n }\n if (this.bymonthday) {\n this._bymonthday();\n }\n else if (this.byweekday) {\n this._byweekday();\n }\n if (this.origOptions.byhour) {\n this._byhour();\n }\n }\n };\n ToText.prototype.MONTHLY = function () {\n var gettext = this.gettext;\n if (this.origOptions.bymonth) {\n if (this.options.interval !== 1) {\n this.add(this.options.interval.toString()).add(gettext('months'));\n if (this.plural(this.options.interval))\n this.add(gettext('in'));\n }\n else {\n // this.add(gettext('MONTH'))\n }\n this._bymonth();\n }\n else {\n if (this.options.interval !== 1) {\n this.add(this.options.interval.toString());\n }\n this.add(this.plural(this.options.interval)\n ? gettext('months')\n : gettext('month'));\n }\n if (this.bymonthday) {\n this._bymonthday();\n }\n else if (this.byweekday && this.byweekday.isWeekdays) {\n this.add(gettext('on')).add(gettext('weekdays'));\n }\n else if (this.byweekday) {\n this._byweekday();\n }\n };\n ToText.prototype.YEARLY = function () {\n var gettext = this.gettext;\n if (this.origOptions.bymonth) {\n if (this.options.interval !== 1) {\n this.add(this.options.interval.toString());\n this.add(gettext('years'));\n }\n else {\n // this.add(gettext('YEAR'))\n }\n this._bymonth();\n }\n else {\n if (this.options.interval !== 1) {\n this.add(this.options.interval.toString());\n }\n this.add(this.plural(this.options.interval) ? gettext('years') : gettext('year'));\n }\n if (this.bymonthday) {\n this._bymonthday();\n }\n else if (this.byweekday) {\n this._byweekday();\n }\n if (this.options.byyearday) {\n this.add(gettext('on the'))\n .add(this.list(this.options.byyearday, this.nth, gettext('and')))\n .add(gettext('day'));\n }\n if (this.options.byweekno) {\n this.add(gettext('in'))\n .add(this.plural(this.options.byweekno.length)\n ? gettext('weeks')\n : gettext('week'))\n .add(this.list(this.options.byweekno, undefined, gettext('and')));\n }\n };\n ToText.prototype._bymonthday = function () {\n var gettext = this.gettext;\n if (this.byweekday && this.byweekday.allWeeks) {\n this.add(gettext('on'))\n .add(this.list(this.byweekday.allWeeks, this.weekdaytext, gettext('or')))\n .add(gettext('the'))\n .add(this.list(this.bymonthday, this.nth, gettext('or')));\n }\n else {\n this.add(gettext('on the')).add(this.list(this.bymonthday, this.nth, gettext('and')));\n }\n // this.add(gettext('DAY'))\n };\n ToText.prototype._byweekday = function () {\n var gettext = this.gettext;\n if (this.byweekday.allWeeks && !this.byweekday.isWeekdays) {\n this.add(gettext('on')).add(this.list(this.byweekday.allWeeks, this.weekdaytext));\n }\n if (this.byweekday.someWeeks) {\n if (this.byweekday.allWeeks)\n this.add(gettext('and'));\n this.add(gettext('on the')).add(this.list(this.byweekday.someWeeks, this.weekdaytext, gettext('and')));\n }\n };\n ToText.prototype._byhour = function () {\n var gettext = this.gettext;\n this.add(gettext('at')).add(this.list(this.origOptions.byhour, undefined, gettext('and')));\n };\n ToText.prototype._bymonth = function () {\n this.add(this.list(this.options.bymonth, this.monthtext, this.gettext('and')));\n };\n ToText.prototype.nth = function (n) {\n n = parseInt(n.toString(), 10);\n var nth;\n var gettext = this.gettext;\n if (n === -1)\n return gettext('last');\n var npos = Math.abs(n);\n switch (npos) {\n case 1:\n case 21:\n case 31:\n nth = npos + gettext('st');\n break;\n case 2:\n case 22:\n nth = npos + gettext('nd');\n break;\n case 3:\n case 23:\n nth = npos + gettext('rd');\n break;\n default:\n nth = npos + gettext('th');\n }\n return n < 0 ? nth + ' ' + gettext('last') : nth;\n };\n ToText.prototype.monthtext = function (m) {\n return this.language.monthNames[m - 1];\n };\n ToText.prototype.weekdaytext = function (wday) {\n var weekday = isNumber(wday) ? (wday + 1) % 7 : wday.getJsWeekday();\n return ((wday.n ? this.nth(wday.n) + ' ' : '') +\n this.language.dayNames[weekday]);\n };\n ToText.prototype.plural = function (n) {\n return n % 100 !== 1;\n };\n ToText.prototype.add = function (s) {\n this.text.push(' ');\n this.text.push(s);\n return this;\n };\n ToText.prototype.list = function (arr, callback, finalDelim, delim) {\n var _this = this;\n if (delim === void 0) { delim = ','; }\n if (!isArray(arr)) {\n arr = [arr];\n }\n var delimJoin = function (array, delimiter, finalDelimiter) {\n var list = '';\n for (var i = 0; i < array.length; i++) {\n if (i !== 0) {\n if (i === array.length - 1) {\n list += ' ' + finalDelimiter + ' ';\n }\n else {\n list += delimiter + ' ';\n }\n }\n list += array[i];\n }\n return list;\n };\n callback =\n callback ||\n function (o) {\n return o.toString();\n };\n var realCallback = function (arg) {\n return callback && callback.call(_this, arg);\n };\n if (finalDelim) {\n return delimJoin(arr.map(realCallback), delim, finalDelim);\n }\n else {\n return arr.map(realCallback).join(delim + ' ');\n }\n };\n return ToText;\n}());\nexport default ToText;\n//# sourceMappingURL=totext.js.map","import ENGLISH from './i18n';\nimport { RRule } from '../rrule';\n// =============================================================================\n// Parser\n// =============================================================================\nvar Parser = /** @class */ (function () {\n function Parser(rules) {\n this.done = true;\n this.rules = rules;\n }\n Parser.prototype.start = function (text) {\n this.text = text;\n this.done = false;\n return this.nextSymbol();\n };\n Parser.prototype.isDone = function () {\n return this.done && this.symbol === null;\n };\n Parser.prototype.nextSymbol = function () {\n var best;\n var bestSymbol;\n this.symbol = null;\n this.value = null;\n do {\n if (this.done)\n return false;\n var rule = void 0;\n best = null;\n for (var name_1 in this.rules) {\n rule = this.rules[name_1];\n var match = rule.exec(this.text);\n if (match) {\n if (best === null || match[0].length > best[0].length) {\n best = match;\n bestSymbol = name_1;\n }\n }\n }\n if (best != null) {\n this.text = this.text.substr(best[0].length);\n if (this.text === '')\n this.done = true;\n }\n if (best == null) {\n this.done = true;\n this.symbol = null;\n this.value = null;\n return;\n }\n } while (bestSymbol === 'SKIP');\n this.symbol = bestSymbol;\n this.value = best;\n return true;\n };\n Parser.prototype.accept = function (name) {\n if (this.symbol === name) {\n if (this.value) {\n var v = this.value;\n this.nextSymbol();\n return v;\n }\n this.nextSymbol();\n return true;\n }\n return false;\n };\n Parser.prototype.acceptNumber = function () {\n return this.accept('number');\n };\n Parser.prototype.expect = function (name) {\n if (this.accept(name))\n return true;\n throw new Error('expected ' + name + ' but found ' + this.symbol);\n };\n return Parser;\n}());\nexport default function parseText(text, language) {\n if (language === void 0) { language = ENGLISH; }\n var options = {};\n var ttr = new Parser(language.tokens);\n if (!ttr.start(text))\n return null;\n S();\n return options;\n function S() {\n // every [n]\n ttr.expect('every');\n var n = ttr.acceptNumber();\n if (n)\n options.interval = parseInt(n[0], 10);\n if (ttr.isDone())\n throw new Error('Unexpected end');\n switch (ttr.symbol) {\n case 'day(s)':\n options.freq = RRule.DAILY;\n if (ttr.nextSymbol()) {\n AT();\n F();\n }\n break;\n // FIXME Note: every 2 weekdays != every two weeks on weekdays.\n // DAILY on weekdays is not a valid rule\n case 'weekday(s)':\n options.freq = RRule.WEEKLY;\n options.byweekday = [RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR];\n ttr.nextSymbol();\n AT();\n F();\n break;\n case 'week(s)':\n options.freq = RRule.WEEKLY;\n if (ttr.nextSymbol()) {\n ON();\n AT();\n F();\n }\n break;\n case 'hour(s)':\n options.freq = RRule.HOURLY;\n if (ttr.nextSymbol()) {\n ON();\n F();\n }\n break;\n case 'minute(s)':\n options.freq = RRule.MINUTELY;\n if (ttr.nextSymbol()) {\n ON();\n F();\n }\n break;\n case 'month(s)':\n options.freq = RRule.MONTHLY;\n if (ttr.nextSymbol()) {\n ON();\n F();\n }\n break;\n case 'year(s)':\n options.freq = RRule.YEARLY;\n if (ttr.nextSymbol()) {\n ON();\n F();\n }\n break;\n case 'monday':\n case 'tuesday':\n case 'wednesday':\n case 'thursday':\n case 'friday':\n case 'saturday':\n case 'sunday':\n options.freq = RRule.WEEKLY;\n var key = ttr.symbol\n .substr(0, 2)\n .toUpperCase();\n options.byweekday = [RRule[key]];\n if (!ttr.nextSymbol())\n return;\n // TODO check for duplicates\n while (ttr.accept('comma')) {\n if (ttr.isDone())\n throw new Error('Unexpected end');\n var wkd = decodeWKD();\n if (!wkd) {\n throw new Error('Unexpected symbol ' + ttr.symbol + ', expected weekday');\n }\n options.byweekday.push(RRule[wkd]);\n ttr.nextSymbol();\n }\n AT();\n MDAYs();\n F();\n break;\n case 'january':\n case 'february':\n case 'march':\n case 'april':\n case 'may':\n case 'june':\n case 'july':\n case 'august':\n case 'september':\n case 'october':\n case 'november':\n case 'december':\n options.freq = RRule.YEARLY;\n options.bymonth = [decodeM()];\n if (!ttr.nextSymbol())\n return;\n // TODO check for duplicates\n while (ttr.accept('comma')) {\n if (ttr.isDone())\n throw new Error('Unexpected end');\n var m = decodeM();\n if (!m) {\n throw new Error('Unexpected symbol ' + ttr.symbol + ', expected month');\n }\n options.bymonth.push(m);\n ttr.nextSymbol();\n }\n ON();\n F();\n break;\n default:\n throw new Error('Unknown symbol');\n }\n }\n function ON() {\n var on = ttr.accept('on');\n var the = ttr.accept('the');\n if (!(on || the))\n return;\n do {\n var nth = decodeNTH();\n var wkd = decodeWKD();\n var m = decodeM();\n // nth | \n if (nth) {\n // ttr.nextSymbol()\n if (wkd) {\n ttr.nextSymbol();\n if (!options.byweekday)\n options.byweekday = [];\n options.byweekday.push(RRule[wkd].nth(nth));\n }\n else {\n if (!options.bymonthday)\n options.bymonthday = [];\n options.bymonthday.push(nth);\n ttr.accept('day(s)');\n }\n // \n }\n else if (wkd) {\n ttr.nextSymbol();\n if (!options.byweekday)\n options.byweekday = [];\n options.byweekday.push(RRule[wkd]);\n }\n else if (ttr.symbol === 'weekday(s)') {\n ttr.nextSymbol();\n if (!options.byweekday) {\n options.byweekday = [RRule.MO, RRule.TU, RRule.WE, RRule.TH, RRule.FR];\n }\n }\n else if (ttr.symbol === 'week(s)') {\n ttr.nextSymbol();\n var n = ttr.acceptNumber();\n if (!n) {\n throw new Error('Unexpected symbol ' + ttr.symbol + ', expected week number');\n }\n options.byweekno = [parseInt(n[0], 10)];\n while (ttr.accept('comma')) {\n n = ttr.acceptNumber();\n if (!n) {\n throw new Error('Unexpected symbol ' + ttr.symbol + '; expected monthday');\n }\n options.byweekno.push(parseInt(n[0], 10));\n }\n }\n else if (m) {\n ttr.nextSymbol();\n if (!options.bymonth)\n options.bymonth = [];\n options.bymonth.push(m);\n }\n else {\n return;\n }\n } while (ttr.accept('comma') || ttr.accept('the') || ttr.accept('on'));\n }\n function AT() {\n var at = ttr.accept('at');\n if (!at)\n return;\n do {\n var n = ttr.acceptNumber();\n if (!n) {\n throw new Error('Unexpected symbol ' + ttr.symbol + ', expected hour');\n }\n options.byhour = [parseInt(n[0], 10)];\n while (ttr.accept('comma')) {\n n = ttr.acceptNumber();\n if (!n) {\n throw new Error('Unexpected symbol ' + ttr.symbol + '; expected hour');\n }\n options.byhour.push(parseInt(n[0], 10));\n }\n } while (ttr.accept('comma') || ttr.accept('at'));\n }\n function decodeM() {\n switch (ttr.symbol) {\n case 'january':\n return 1;\n case 'february':\n return 2;\n case 'march':\n return 3;\n case 'april':\n return 4;\n case 'may':\n return 5;\n case 'june':\n return 6;\n case 'july':\n return 7;\n case 'august':\n return 8;\n case 'september':\n return 9;\n case 'october':\n return 10;\n case 'november':\n return 11;\n case 'december':\n return 12;\n default:\n return false;\n }\n }\n function decodeWKD() {\n switch (ttr.symbol) {\n case 'monday':\n case 'tuesday':\n case 'wednesday':\n case 'thursday':\n case 'friday':\n case 'saturday':\n case 'sunday':\n return ttr.symbol.substr(0, 2).toUpperCase();\n default:\n return false;\n }\n }\n function decodeNTH() {\n switch (ttr.symbol) {\n case 'last':\n ttr.nextSymbol();\n return -1;\n case 'first':\n ttr.nextSymbol();\n return 1;\n case 'second':\n ttr.nextSymbol();\n return ttr.accept('last') ? -2 : 2;\n case 'third':\n ttr.nextSymbol();\n return ttr.accept('last') ? -3 : 3;\n case 'nth':\n var v = parseInt(ttr.value[1], 10);\n if (v < -366 || v > 366)\n throw new Error('Nth out of range: ' + v);\n ttr.nextSymbol();\n return ttr.accept('last') ? -v : v;\n default:\n return false;\n }\n }\n function MDAYs() {\n ttr.accept('on');\n ttr.accept('the');\n var nth = decodeNTH();\n if (!nth)\n return;\n options.bymonthday = [nth];\n ttr.nextSymbol();\n while (ttr.accept('comma')) {\n nth = decodeNTH();\n if (!nth) {\n throw new Error('Unexpected symbol ' + ttr.symbol + '; expected monthday');\n }\n options.bymonthday.push(nth);\n ttr.nextSymbol();\n }\n }\n function F() {\n if (ttr.symbol === 'until') {\n var date = Date.parse(ttr.text);\n if (!date)\n throw new Error('Cannot parse until date:' + ttr.text);\n options.until = new Date(date);\n }\n else if (ttr.accept('for')) {\n options.count = parseInt(ttr.value[0], 10);\n ttr.expect('number');\n // ttr.expect('times')\n }\n }\n}\n//# sourceMappingURL=parsetext.js.map","import ToText from './totext';\nimport parseText from './parsetext';\nimport { RRule } from '../rrule';\nimport { Frequency } from '../types';\nimport ENGLISH from './i18n';\n/* !\n * rrule.js - Library for working with recurrence rules for calendar dates.\n * https://github.com/jakubroztocil/rrule\n *\n * Copyright 2010, Jakub Roztocil and Lars Schoning\n * Licenced under the BSD licence.\n * https://github.com/jakubroztocil/rrule/blob/master/LICENCE\n *\n */\n/**\n *\n * Implementation of RRule.fromText() and RRule::toText().\n *\n *\n * On the client side, this file needs to be included\n * when those functions are used.\n *\n */\n// =============================================================================\n// fromText\n// =============================================================================\n/**\n * Will be able to convert some of the below described rules from\n * text format to a rule object.\n *\n *\n * RULES\n *\n * Every ([n])\n * day(s)\n * | [weekday], ..., (and) [weekday]\n * | weekday(s)\n * | week(s)\n * | month(s)\n * | [month], ..., (and) [month]\n * | year(s)\n *\n *\n * Plus 0, 1, or multiple of these:\n *\n * on [weekday], ..., (or) [weekday] the [monthday], [monthday], ... (or) [monthday]\n *\n * on [weekday], ..., (and) [weekday]\n *\n * on the [monthday], [monthday], ... (and) [monthday] (day of the month)\n *\n * on the [nth-weekday], ..., (and) [nth-weekday] (of the month/year)\n *\n *\n * Plus 0 or 1 of these:\n *\n * for [n] time(s)\n *\n * until [date]\n *\n * Plus (.)\n *\n *\n * Definitely no supported for parsing:\n *\n * (for year):\n * in week(s) [n], ..., (and) [n]\n *\n * on the [yearday], ..., (and) [n] day of the year\n * on day [yearday], ..., (and) [n]\n *\n *\n * NON-TERMINALS\n *\n * [n]: 1, 2 ..., one, two, three ..\n * [month]: January, February, March, April, May, ... December\n * [weekday]: Monday, ... Sunday\n * [nth-weekday]: first [weekday], 2nd [weekday], ... last [weekday], ...\n * [monthday]: first, 1., 2., 1st, 2nd, second, ... 31st, last day, 2nd last day, ..\n * [date]:\n * - [month] (0-31(,) ([year])),\n * - (the) 0-31.(1-12.([year])),\n * - (the) 0-31/(1-12/([year])),\n * - [weekday]\n *\n * [year]: 0000, 0001, ... 01, 02, ..\n *\n * Definitely not supported for parsing:\n *\n * [yearday]: first, 1., 2., 1st, 2nd, second, ... 366th, last day, 2nd last day, ..\n *\n * @param {String} text\n * @return {Object, Boolean} the rule, or null.\n */\nvar fromText = function (text, language) {\n if (language === void 0) { language = ENGLISH; }\n return new RRule(parseText(text, language) || undefined);\n};\nvar common = [\n 'count',\n 'until',\n 'interval',\n 'byweekday',\n 'bymonthday',\n 'bymonth',\n];\nToText.IMPLEMENTED = [];\nToText.IMPLEMENTED[Frequency.HOURLY] = common;\nToText.IMPLEMENTED[Frequency.MINUTELY] = common;\nToText.IMPLEMENTED[Frequency.DAILY] = ['byhour'].concat(common);\nToText.IMPLEMENTED[Frequency.WEEKLY] = common;\nToText.IMPLEMENTED[Frequency.MONTHLY] = common;\nToText.IMPLEMENTED[Frequency.YEARLY] = ['byweekno', 'byyearday'].concat(common);\n// =============================================================================\n// Export\n// =============================================================================\nvar toText = function (rrule, gettext, language, dateFormatter) {\n return new ToText(rrule, gettext, language, dateFormatter).toString();\n};\nvar isFullyConvertible = ToText.isFullyConvertible;\nexport { fromText, parseText, isFullyConvertible, toText };\n//# sourceMappingURL=index.js.map","import { __extends } from \"tslib\";\nimport { Frequency } from './types';\nimport { pymod, divmod, empty, includes } from './helpers';\nimport { getWeekday, MAXYEAR, monthRange } from './dateutil';\nvar Time = /** @class */ (function () {\n function Time(hour, minute, second, millisecond) {\n this.hour = hour;\n this.minute = minute;\n this.second = second;\n this.millisecond = millisecond || 0;\n }\n Time.prototype.getHours = function () {\n return this.hour;\n };\n Time.prototype.getMinutes = function () {\n return this.minute;\n };\n Time.prototype.getSeconds = function () {\n return this.second;\n };\n Time.prototype.getMilliseconds = function () {\n return this.millisecond;\n };\n Time.prototype.getTime = function () {\n return ((this.hour * 60 * 60 + this.minute * 60 + this.second) * 1000 +\n this.millisecond);\n };\n return Time;\n}());\nexport { Time };\nvar DateTime = /** @class */ (function (_super) {\n __extends(DateTime, _super);\n function DateTime(year, month, day, hour, minute, second, millisecond) {\n var _this = _super.call(this, hour, minute, second, millisecond) || this;\n _this.year = year;\n _this.month = month;\n _this.day = day;\n return _this;\n }\n DateTime.fromDate = function (date) {\n return new this(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.valueOf() % 1000);\n };\n DateTime.prototype.getWeekday = function () {\n return getWeekday(new Date(this.getTime()));\n };\n DateTime.prototype.getTime = function () {\n return new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond)).getTime();\n };\n DateTime.prototype.getDay = function () {\n return this.day;\n };\n DateTime.prototype.getMonth = function () {\n return this.month;\n };\n DateTime.prototype.getYear = function () {\n return this.year;\n };\n DateTime.prototype.addYears = function (years) {\n this.year += years;\n };\n DateTime.prototype.addMonths = function (months) {\n this.month += months;\n if (this.month > 12) {\n var yearDiv = Math.floor(this.month / 12);\n var monthMod = pymod(this.month, 12);\n this.month = monthMod;\n this.year += yearDiv;\n if (this.month === 0) {\n this.month = 12;\n --this.year;\n }\n }\n };\n DateTime.prototype.addWeekly = function (days, wkst) {\n if (wkst > this.getWeekday()) {\n this.day += -(this.getWeekday() + 1 + (6 - wkst)) + days * 7;\n }\n else {\n this.day += -(this.getWeekday() - wkst) + days * 7;\n }\n this.fixDay();\n };\n DateTime.prototype.addDaily = function (days) {\n this.day += days;\n this.fixDay();\n };\n DateTime.prototype.addHours = function (hours, filtered, byhour) {\n if (filtered) {\n // Jump to one iteration before next day\n this.hour += Math.floor((23 - this.hour) / hours) * hours;\n }\n for (;;) {\n this.hour += hours;\n var _a = divmod(this.hour, 24), dayDiv = _a.div, hourMod = _a.mod;\n if (dayDiv) {\n this.hour = hourMod;\n this.addDaily(dayDiv);\n }\n if (empty(byhour) || includes(byhour, this.hour))\n break;\n }\n };\n DateTime.prototype.addMinutes = function (minutes, filtered, byhour, byminute) {\n if (filtered) {\n // Jump to one iteration before next day\n this.minute +=\n Math.floor((1439 - (this.hour * 60 + this.minute)) / minutes) * minutes;\n }\n for (;;) {\n this.minute += minutes;\n var _a = divmod(this.minute, 60), hourDiv = _a.div, minuteMod = _a.mod;\n if (hourDiv) {\n this.minute = minuteMod;\n this.addHours(hourDiv, false, byhour);\n }\n if ((empty(byhour) || includes(byhour, this.hour)) &&\n (empty(byminute) || includes(byminute, this.minute))) {\n break;\n }\n }\n };\n DateTime.prototype.addSeconds = function (seconds, filtered, byhour, byminute, bysecond) {\n if (filtered) {\n // Jump to one iteration before next day\n this.second +=\n Math.floor((86399 - (this.hour * 3600 + this.minute * 60 + this.second)) /\n seconds) * seconds;\n }\n for (;;) {\n this.second += seconds;\n var _a = divmod(this.second, 60), minuteDiv = _a.div, secondMod = _a.mod;\n if (minuteDiv) {\n this.second = secondMod;\n this.addMinutes(minuteDiv, false, byhour, byminute);\n }\n if ((empty(byhour) || includes(byhour, this.hour)) &&\n (empty(byminute) || includes(byminute, this.minute)) &&\n (empty(bysecond) || includes(bysecond, this.second))) {\n break;\n }\n }\n };\n DateTime.prototype.fixDay = function () {\n if (this.day <= 28) {\n return;\n }\n var daysinmonth = monthRange(this.year, this.month - 1)[1];\n if (this.day <= daysinmonth) {\n return;\n }\n while (this.day > daysinmonth) {\n this.day -= daysinmonth;\n ++this.month;\n if (this.month === 13) {\n this.month = 1;\n ++this.year;\n if (this.year > MAXYEAR) {\n return;\n }\n }\n daysinmonth = monthRange(this.year, this.month - 1)[1];\n }\n };\n DateTime.prototype.add = function (options, filtered) {\n var freq = options.freq, interval = options.interval, wkst = options.wkst, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond;\n switch (freq) {\n case Frequency.YEARLY:\n return this.addYears(interval);\n case Frequency.MONTHLY:\n return this.addMonths(interval);\n case Frequency.WEEKLY:\n return this.addWeekly(interval, wkst);\n case Frequency.DAILY:\n return this.addDaily(interval);\n case Frequency.HOURLY:\n return this.addHours(interval, filtered, byhour);\n case Frequency.MINUTELY:\n return this.addMinutes(interval, filtered, byhour, byminute);\n case Frequency.SECONDLY:\n return this.addSeconds(interval, filtered, byhour, byminute, bysecond);\n }\n };\n return DateTime;\n}(Time));\nexport { DateTime };\n//# sourceMappingURL=datetime.js.map","import { __assign } from \"tslib\";\nimport { freqIsDailyOrGreater } from './types';\nimport { includes, notEmpty, isPresent, isNumber, isArray, isWeekdayStr, } from './helpers';\nimport { RRule, defaultKeys, DEFAULT_OPTIONS } from './rrule';\nimport { getWeekday, isDate, isValidDate } from './dateutil';\nimport { Weekday } from './weekday';\nimport { Time } from './datetime';\nexport function initializeOptions(options) {\n var invalid = [];\n var keys = Object.keys(options);\n // Shallow copy for options and origOptions and check for invalid\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n if (!includes(defaultKeys, key))\n invalid.push(key);\n if (isDate(options[key]) && !isValidDate(options[key])) {\n invalid.push(key);\n }\n }\n if (invalid.length) {\n throw new Error('Invalid options: ' + invalid.join(', '));\n }\n return __assign({}, options);\n}\nexport function parseOptions(options) {\n var opts = __assign(__assign({}, DEFAULT_OPTIONS), initializeOptions(options));\n if (isPresent(opts.byeaster))\n opts.freq = RRule.YEARLY;\n if (!(isPresent(opts.freq) && RRule.FREQUENCIES[opts.freq])) {\n throw new Error(\"Invalid frequency: \".concat(opts.freq, \" \").concat(options.freq));\n }\n if (!opts.dtstart)\n opts.dtstart = new Date(new Date().setMilliseconds(0));\n if (!isPresent(opts.wkst)) {\n opts.wkst = RRule.MO.weekday;\n }\n else if (isNumber(opts.wkst)) {\n // cool, just keep it like that\n }\n else {\n opts.wkst = opts.wkst.weekday;\n }\n if (isPresent(opts.bysetpos)) {\n if (isNumber(opts.bysetpos))\n opts.bysetpos = [opts.bysetpos];\n for (var i = 0; i < opts.bysetpos.length; i++) {\n var v = opts.bysetpos[i];\n if (v === 0 || !(v >= -366 && v <= 366)) {\n throw new Error('bysetpos must be between 1 and 366,' + ' or between -366 and -1');\n }\n }\n }\n if (!(Boolean(opts.byweekno) ||\n notEmpty(opts.byweekno) ||\n notEmpty(opts.byyearday) ||\n Boolean(opts.bymonthday) ||\n notEmpty(opts.bymonthday) ||\n isPresent(opts.byweekday) ||\n isPresent(opts.byeaster))) {\n switch (opts.freq) {\n case RRule.YEARLY:\n if (!opts.bymonth)\n opts.bymonth = opts.dtstart.getUTCMonth() + 1;\n opts.bymonthday = opts.dtstart.getUTCDate();\n break;\n case RRule.MONTHLY:\n opts.bymonthday = opts.dtstart.getUTCDate();\n break;\n case RRule.WEEKLY:\n opts.byweekday = [getWeekday(opts.dtstart)];\n break;\n }\n }\n // bymonth\n if (isPresent(opts.bymonth) && !isArray(opts.bymonth)) {\n opts.bymonth = [opts.bymonth];\n }\n // byyearday\n if (isPresent(opts.byyearday) &&\n !isArray(opts.byyearday) &&\n isNumber(opts.byyearday)) {\n opts.byyearday = [opts.byyearday];\n }\n // bymonthday\n if (!isPresent(opts.bymonthday)) {\n opts.bymonthday = [];\n opts.bynmonthday = [];\n }\n else if (isArray(opts.bymonthday)) {\n var bymonthday = [];\n var bynmonthday = [];\n for (var i = 0; i < opts.bymonthday.length; i++) {\n var v = opts.bymonthday[i];\n if (v > 0) {\n bymonthday.push(v);\n }\n else if (v < 0) {\n bynmonthday.push(v);\n }\n }\n opts.bymonthday = bymonthday;\n opts.bynmonthday = bynmonthday;\n }\n else if (opts.bymonthday < 0) {\n opts.bynmonthday = [opts.bymonthday];\n opts.bymonthday = [];\n }\n else {\n opts.bynmonthday = [];\n opts.bymonthday = [opts.bymonthday];\n }\n // byweekno\n if (isPresent(opts.byweekno) && !isArray(opts.byweekno)) {\n opts.byweekno = [opts.byweekno];\n }\n // byweekday / bynweekday\n if (!isPresent(opts.byweekday)) {\n opts.bynweekday = null;\n }\n else if (isNumber(opts.byweekday)) {\n opts.byweekday = [opts.byweekday];\n opts.bynweekday = null;\n }\n else if (isWeekdayStr(opts.byweekday)) {\n opts.byweekday = [Weekday.fromStr(opts.byweekday).weekday];\n opts.bynweekday = null;\n }\n else if (opts.byweekday instanceof Weekday) {\n if (!opts.byweekday.n || opts.freq > RRule.MONTHLY) {\n opts.byweekday = [opts.byweekday.weekday];\n opts.bynweekday = null;\n }\n else {\n opts.bynweekday = [[opts.byweekday.weekday, opts.byweekday.n]];\n opts.byweekday = null;\n }\n }\n else {\n var byweekday = [];\n var bynweekday = [];\n for (var i = 0; i < opts.byweekday.length; i++) {\n var wday = opts.byweekday[i];\n if (isNumber(wday)) {\n byweekday.push(wday);\n continue;\n }\n else if (isWeekdayStr(wday)) {\n byweekday.push(Weekday.fromStr(wday).weekday);\n continue;\n }\n if (!wday.n || opts.freq > RRule.MONTHLY) {\n byweekday.push(wday.weekday);\n }\n else {\n bynweekday.push([wday.weekday, wday.n]);\n }\n }\n opts.byweekday = notEmpty(byweekday) ? byweekday : null;\n opts.bynweekday = notEmpty(bynweekday) ? bynweekday : null;\n }\n // byhour\n if (!isPresent(opts.byhour)) {\n opts.byhour = opts.freq < RRule.HOURLY ? [opts.dtstart.getUTCHours()] : null;\n }\n else if (isNumber(opts.byhour)) {\n opts.byhour = [opts.byhour];\n }\n // byminute\n if (!isPresent(opts.byminute)) {\n opts.byminute =\n opts.freq < RRule.MINUTELY ? [opts.dtstart.getUTCMinutes()] : null;\n }\n else if (isNumber(opts.byminute)) {\n opts.byminute = [opts.byminute];\n }\n // bysecond\n if (!isPresent(opts.bysecond)) {\n opts.bysecond =\n opts.freq < RRule.SECONDLY ? [opts.dtstart.getUTCSeconds()] : null;\n }\n else if (isNumber(opts.bysecond)) {\n opts.bysecond = [opts.bysecond];\n }\n return { parsedOptions: opts };\n}\nexport function buildTimeset(opts) {\n var millisecondModulo = opts.dtstart.getTime() % 1000;\n if (!freqIsDailyOrGreater(opts.freq)) {\n return [];\n }\n var timeset = [];\n opts.byhour.forEach(function (hour) {\n opts.byminute.forEach(function (minute) {\n opts.bysecond.forEach(function (second) {\n timeset.push(new Time(hour, minute, second, millisecondModulo));\n });\n });\n });\n return timeset;\n}\n//# sourceMappingURL=parseoptions.js.map","import { __assign } from \"tslib\";\nimport { Frequency } from './types';\nimport { Weekday } from './weekday';\nimport { untilStringToDate } from './dateutil';\nimport { Days } from './rrule';\nexport function parseString(rfcString) {\n var options = rfcString\n .split('\\n')\n .map(parseLine)\n .filter(function (x) { return x !== null; });\n return __assign(__assign({}, options[0]), options[1]);\n}\nexport function parseDtstart(line) {\n var options = {};\n var dtstartWithZone = /DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\\s]+)/i.exec(line);\n if (!dtstartWithZone) {\n return options;\n }\n var tzid = dtstartWithZone[1], dtstart = dtstartWithZone[2];\n if (tzid) {\n options.tzid = tzid;\n }\n options.dtstart = untilStringToDate(dtstart);\n return options;\n}\nfunction parseLine(rfcString) {\n rfcString = rfcString.replace(/^\\s+|\\s+$/, '');\n if (!rfcString.length)\n return null;\n var header = /^([A-Z]+?)[:;]/.exec(rfcString.toUpperCase());\n if (!header) {\n return parseRrule(rfcString);\n }\n var key = header[1];\n switch (key.toUpperCase()) {\n case 'RRULE':\n case 'EXRULE':\n return parseRrule(rfcString);\n case 'DTSTART':\n return parseDtstart(rfcString);\n default:\n throw new Error(\"Unsupported RFC prop \".concat(key, \" in \").concat(rfcString));\n }\n}\nfunction parseRrule(line) {\n var strippedLine = line.replace(/^RRULE:/i, '');\n var options = parseDtstart(strippedLine);\n var attrs = line.replace(/^(?:RRULE|EXRULE):/i, '').split(';');\n attrs.forEach(function (attr) {\n var _a = attr.split('='), key = _a[0], value = _a[1];\n switch (key.toUpperCase()) {\n case 'FREQ':\n options.freq = Frequency[value.toUpperCase()];\n break;\n case 'WKST':\n options.wkst = Days[value.toUpperCase()];\n break;\n case 'COUNT':\n case 'INTERVAL':\n case 'BYSETPOS':\n case 'BYMONTH':\n case 'BYMONTHDAY':\n case 'BYYEARDAY':\n case 'BYWEEKNO':\n case 'BYHOUR':\n case 'BYMINUTE':\n case 'BYSECOND':\n var num = parseNumber(value);\n var optionKey = key.toLowerCase();\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n options[optionKey] = num;\n break;\n case 'BYWEEKDAY':\n case 'BYDAY':\n options.byweekday = parseWeekday(value);\n break;\n case 'DTSTART':\n case 'TZID':\n // for backwards compatibility\n var dtstart = parseDtstart(line);\n options.tzid = dtstart.tzid;\n options.dtstart = dtstart.dtstart;\n break;\n case 'UNTIL':\n options.until = untilStringToDate(value);\n break;\n case 'BYEASTER':\n options.byeaster = Number(value);\n break;\n default:\n throw new Error(\"Unknown RRULE property '\" + key + \"'\");\n }\n });\n return options;\n}\nfunction parseNumber(value) {\n if (value.indexOf(',') !== -1) {\n var values = value.split(',');\n return values.map(parseIndividualNumber);\n }\n return parseIndividualNumber(value);\n}\nfunction parseIndividualNumber(value) {\n if (/^[+-]?\\d+$/.test(value)) {\n return Number(value);\n }\n return value;\n}\nfunction parseWeekday(value) {\n var days = value.split(',');\n return days.map(function (day) {\n if (day.length === 2) {\n // MO, TU, ...\n return Days[day]; // wday instanceof Weekday\n }\n // -1MO, +3FR, 1SO, 13TU ...\n var parts = day.match(/^([+-]?\\d{1,2})([A-Z]{2})$/);\n if (!parts || parts.length < 3) {\n throw new SyntaxError(\"Invalid weekday string: \".concat(day));\n }\n var n = Number(parts[1]);\n var wdaypart = parts[2];\n var wday = Days[wdaypart].weekday;\n return new Weekday(wday, n);\n });\n}\n//# sourceMappingURL=parsestring.js.map","import { dateInTimeZone, timeToUntilString } from './dateutil';\nvar DateWithZone = /** @class */ (function () {\n function DateWithZone(date, tzid) {\n if (isNaN(date.getTime())) {\n throw new RangeError('Invalid date passed to DateWithZone');\n }\n this.date = date;\n this.tzid = tzid;\n }\n Object.defineProperty(DateWithZone.prototype, \"isUTC\", {\n get: function () {\n return !this.tzid || this.tzid.toUpperCase() === 'UTC';\n },\n enumerable: false,\n configurable: true\n });\n DateWithZone.prototype.toString = function () {\n var datestr = timeToUntilString(this.date.getTime(), this.isUTC);\n if (!this.isUTC) {\n return \";TZID=\".concat(this.tzid, \":\").concat(datestr);\n }\n return \":\".concat(datestr);\n };\n DateWithZone.prototype.getTime = function () {\n return this.date.getTime();\n };\n DateWithZone.prototype.rezonedDate = function () {\n if (this.isUTC) {\n return this.date;\n }\n return dateInTimeZone(this.date, this.tzid);\n };\n return DateWithZone;\n}());\nexport { DateWithZone };\n//# sourceMappingURL=datewithzone.js.map","import { RRule, DEFAULT_OPTIONS } from './rrule';\nimport { includes, isPresent, isArray, isNumber, toArray } from './helpers';\nimport { Weekday } from './weekday';\nimport { timeToUntilString } from './dateutil';\nimport { DateWithZone } from './datewithzone';\nexport function optionsToString(options) {\n var rrule = [];\n var dtstart = '';\n var keys = Object.keys(options);\n var defaultKeys = Object.keys(DEFAULT_OPTIONS);\n for (var i = 0; i < keys.length; i++) {\n if (keys[i] === 'tzid')\n continue;\n if (!includes(defaultKeys, keys[i]))\n continue;\n var key = keys[i].toUpperCase();\n var value = options[keys[i]];\n var outValue = '';\n if (!isPresent(value) || (isArray(value) && !value.length))\n continue;\n switch (key) {\n case 'FREQ':\n outValue = RRule.FREQUENCIES[options.freq];\n break;\n case 'WKST':\n if (isNumber(value)) {\n outValue = new Weekday(value).toString();\n }\n else {\n outValue = value.toString();\n }\n break;\n case 'BYWEEKDAY':\n /*\n NOTE: BYWEEKDAY is a special case.\n RRule() deconstructs the rule.options.byweekday array\n into an array of Weekday arguments.\n On the other hand, rule.origOptions is an array of Weekdays.\n We need to handle both cases here.\n It might be worth change RRule to keep the Weekdays.\n \n Also, BYWEEKDAY (used by RRule) vs. BYDAY (RFC)\n \n */\n key = 'BYDAY';\n outValue = toArray(value)\n .map(function (wday) {\n if (wday instanceof Weekday) {\n return wday;\n }\n if (isArray(wday)) {\n return new Weekday(wday[0], wday[1]);\n }\n return new Weekday(wday);\n })\n .toString();\n break;\n case 'DTSTART':\n dtstart = buildDtstart(value, options.tzid);\n break;\n case 'UNTIL':\n outValue = timeToUntilString(value, !options.tzid);\n break;\n default:\n if (isArray(value)) {\n var strValues = [];\n for (var j = 0; j < value.length; j++) {\n strValues[j] = String(value[j]);\n }\n outValue = strValues.toString();\n }\n else {\n outValue = String(value);\n }\n }\n if (outValue) {\n rrule.push([key, outValue]);\n }\n }\n var rules = rrule\n .map(function (_a) {\n var key = _a[0], value = _a[1];\n return \"\".concat(key, \"=\").concat(value.toString());\n })\n .join(';');\n var ruleString = '';\n if (rules !== '') {\n ruleString = \"RRULE:\".concat(rules);\n }\n return [dtstart, ruleString].filter(function (x) { return !!x; }).join('\\n');\n}\nfunction buildDtstart(dtstart, tzid) {\n if (!dtstart) {\n return '';\n }\n return 'DTSTART' + new DateWithZone(new Date(dtstart), tzid).toString();\n}\n//# sourceMappingURL=optionstostring.js.map","import IterResult from './iterresult';\nimport { clone, cloneDates } from './dateutil';\nimport { isArray } from './helpers';\nfunction argsMatch(left, right) {\n if (Array.isArray(left)) {\n if (!Array.isArray(right))\n return false;\n if (left.length !== right.length)\n return false;\n return left.every(function (date, i) { return date.getTime() === right[i].getTime(); });\n }\n if (left instanceof Date) {\n return right instanceof Date && left.getTime() === right.getTime();\n }\n return left === right;\n}\nvar Cache = /** @class */ (function () {\n function Cache() {\n this.all = false;\n this.before = [];\n this.after = [];\n this.between = [];\n }\n /**\n * @param {String} what - all/before/after/between\n * @param {Array,Date} value - an array of dates, one date, or null\n * @param {Object?} args - _iter arguments\n */\n Cache.prototype._cacheAdd = function (what, value, args) {\n if (value) {\n value = value instanceof Date ? clone(value) : cloneDates(value);\n }\n if (what === 'all') {\n this.all = value;\n }\n else {\n args._value = value;\n this[what].push(args);\n }\n };\n /**\n * @return false - not in the cache\n * @return null - cached, but zero occurrences (before/after)\n * @return Date - cached (before/after)\n * @return [] - cached, but zero occurrences (all/between)\n * @return [Date1, DateN] - cached (all/between)\n */\n Cache.prototype._cacheGet = function (what, args) {\n var cached = false;\n var argsKeys = args ? Object.keys(args) : [];\n var findCacheDiff = function (item) {\n for (var i = 0; i < argsKeys.length; i++) {\n var key = argsKeys[i];\n if (!argsMatch(args[key], item[key])) {\n return true;\n }\n }\n return false;\n };\n var cachedObject = this[what];\n if (what === 'all') {\n cached = this.all;\n }\n else if (isArray(cachedObject)) {\n // Let's see whether we've already called the\n // 'what' method with the same 'args'\n for (var i = 0; i < cachedObject.length; i++) {\n var item = cachedObject[i];\n if (argsKeys.length && findCacheDiff(item))\n continue;\n cached = item._value;\n break;\n }\n }\n if (!cached && this.all) {\n // Not in the cache, but we already know all the occurrences,\n // so we can find the correct dates from the cached ones.\n var iterResult = new IterResult(what, args);\n for (var i = 0; i < this.all.length; i++) {\n if (!iterResult.accept(this.all[i]))\n break;\n }\n cached = iterResult.getValue();\n this._cacheAdd(what, cached, args);\n }\n return isArray(cached)\n ? cloneDates(cached)\n : cached instanceof Date\n ? clone(cached)\n : cached;\n };\n return Cache;\n}());\nexport { Cache };\n//# sourceMappingURL=cache.js.map","import { __spreadArray } from \"tslib\";\nimport { range, repeat } from './helpers';\n// =============================================================================\n// Date masks\n// =============================================================================\n// Every mask is 7 days longer to handle cross-year weekly periods.\nvar M365MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], repeat(1, 31), true), repeat(2, 28), true), repeat(3, 31), true), repeat(4, 30), true), repeat(5, 31), true), repeat(6, 30), true), repeat(7, 31), true), repeat(8, 31), true), repeat(9, 30), true), repeat(10, 31), true), repeat(11, 30), true), repeat(12, 31), true), repeat(1, 7), true);\nvar M366MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], repeat(1, 31), true), repeat(2, 29), true), repeat(3, 31), true), repeat(4, 30), true), repeat(5, 31), true), repeat(6, 30), true), repeat(7, 31), true), repeat(8, 31), true), repeat(9, 30), true), repeat(10, 31), true), repeat(11, 30), true), repeat(12, 31), true), repeat(1, 7), true);\nvar M28 = range(1, 29);\nvar M29 = range(1, 30);\nvar M30 = range(1, 31);\nvar M31 = range(1, 32);\nvar MDAY366MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], M31, true), M29, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31.slice(0, 7), true);\nvar MDAY365MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], M31, true), M28, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31, true), M30, true), M31, true), M30, true), M31, true), M31.slice(0, 7), true);\nvar NM28 = range(-28, 0);\nvar NM29 = range(-29, 0);\nvar NM30 = range(-30, 0);\nvar NM31 = range(-31, 0);\nvar NMDAY366MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], NM31, true), NM29, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31.slice(0, 7), true);\nvar NMDAY365MASK = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], NM31, true), NM28, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31, true), NM30, true), NM31, true), NM30, true), NM31, true), NM31.slice(0, 7), true);\nvar M366RANGE = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366];\nvar M365RANGE = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365];\nvar WDAYMASK = (function () {\n var wdaymask = [];\n for (var i = 0; i < 55; i++)\n wdaymask = wdaymask.concat(range(7));\n return wdaymask;\n})();\nexport { WDAYMASK, M365MASK, M365RANGE, M366MASK, M366RANGE, MDAY365MASK, MDAY366MASK, NMDAY365MASK, NMDAY366MASK, };\n//# sourceMappingURL=masks.js.map","import { __assign } from \"tslib\";\nimport { datetime, getWeekday, isLeapYear, toOrdinal } from '../dateutil';\nimport { empty, repeat, pymod, includes } from '../helpers';\nimport { M365MASK, MDAY365MASK, NMDAY365MASK, WDAYMASK, M365RANGE, M366MASK, MDAY366MASK, NMDAY366MASK, M366RANGE, } from '../masks';\nexport function rebuildYear(year, options) {\n var firstyday = datetime(year, 1, 1);\n var yearlen = isLeapYear(year) ? 366 : 365;\n var nextyearlen = isLeapYear(year + 1) ? 366 : 365;\n var yearordinal = toOrdinal(firstyday);\n var yearweekday = getWeekday(firstyday);\n var result = __assign(__assign({ yearlen: yearlen, nextyearlen: nextyearlen, yearordinal: yearordinal, yearweekday: yearweekday }, baseYearMasks(year)), { wnomask: null });\n if (empty(options.byweekno)) {\n return result;\n }\n result.wnomask = repeat(0, yearlen + 7);\n var firstwkst;\n var wyearlen;\n var no1wkst = (firstwkst = pymod(7 - yearweekday + options.wkst, 7));\n if (no1wkst >= 4) {\n no1wkst = 0;\n // Number of days in the year, plus the days we got\n // from last year.\n wyearlen = result.yearlen + pymod(yearweekday - options.wkst, 7);\n }\n else {\n // Number of days in the year, minus the days we\n // left in last year.\n wyearlen = yearlen - no1wkst;\n }\n var div = Math.floor(wyearlen / 7);\n var mod = pymod(wyearlen, 7);\n var numweeks = Math.floor(div + mod / 4);\n for (var j = 0; j < options.byweekno.length; j++) {\n var n = options.byweekno[j];\n if (n < 0) {\n n += numweeks + 1;\n }\n if (!(n > 0 && n <= numweeks)) {\n continue;\n }\n var i = void 0;\n if (n > 1) {\n i = no1wkst + (n - 1) * 7;\n if (no1wkst !== firstwkst) {\n i -= 7 - firstwkst;\n }\n }\n else {\n i = no1wkst;\n }\n for (var k = 0; k < 7; k++) {\n result.wnomask[i] = 1;\n i++;\n if (result.wdaymask[i] === options.wkst)\n break;\n }\n }\n if (includes(options.byweekno, 1)) {\n // Check week number 1 of next year as well\n // orig-TODO : Check -numweeks for next year.\n var i = no1wkst + numweeks * 7;\n if (no1wkst !== firstwkst)\n i -= 7 - firstwkst;\n if (i < yearlen) {\n // If week starts in next year, we\n // don't care about it.\n for (var j = 0; j < 7; j++) {\n result.wnomask[i] = 1;\n i += 1;\n if (result.wdaymask[i] === options.wkst)\n break;\n }\n }\n }\n if (no1wkst) {\n // Check last week number of last year as\n // well. If no1wkst is 0, either the year\n // started on week start, or week number 1\n // got days from last year, so there are no\n // days from last year's last week number in\n // this year.\n var lnumweeks = void 0;\n if (!includes(options.byweekno, -1)) {\n var lyearweekday = getWeekday(datetime(year - 1, 1, 1));\n var lno1wkst = pymod(7 - lyearweekday.valueOf() + options.wkst, 7);\n var lyearlen = isLeapYear(year - 1) ? 366 : 365;\n var weekst = void 0;\n if (lno1wkst >= 4) {\n lno1wkst = 0;\n weekst = lyearlen + pymod(lyearweekday - options.wkst, 7);\n }\n else {\n weekst = yearlen - no1wkst;\n }\n lnumweeks = Math.floor(52 + pymod(weekst, 7) / 4);\n }\n else {\n lnumweeks = -1;\n }\n if (includes(options.byweekno, lnumweeks)) {\n for (var i = 0; i < no1wkst; i++)\n result.wnomask[i] = 1;\n }\n }\n return result;\n}\nfunction baseYearMasks(year) {\n var yearlen = isLeapYear(year) ? 366 : 365;\n var firstyday = datetime(year, 1, 1);\n var wday = getWeekday(firstyday);\n if (yearlen === 365) {\n return {\n mmask: M365MASK,\n mdaymask: MDAY365MASK,\n nmdaymask: NMDAY365MASK,\n wdaymask: WDAYMASK.slice(wday),\n mrange: M365RANGE,\n };\n }\n return {\n mmask: M366MASK,\n mdaymask: MDAY366MASK,\n nmdaymask: NMDAY366MASK,\n wdaymask: WDAYMASK.slice(wday),\n mrange: M366RANGE,\n };\n}\n//# sourceMappingURL=yearinfo.js.map","import { notEmpty, repeat, range, isPresent } from '../helpers';\nimport { Frequency } from '../types';\nimport { rebuildYear } from './yearinfo';\nimport { rebuildMonth } from './monthinfo';\nimport { easter } from './easter';\nimport { Time } from '../datetime';\nimport { datetime, sort, toOrdinal } from '../dateutil';\n// =============================================================================\n// Iterinfo\n// =============================================================================\nvar Iterinfo = /** @class */ (function () {\n // eslint-disable-next-line no-empty-function\n function Iterinfo(options) {\n this.options = options;\n }\n Iterinfo.prototype.rebuild = function (year, month) {\n var options = this.options;\n if (year !== this.lastyear) {\n this.yearinfo = rebuildYear(year, options);\n }\n if (notEmpty(options.bynweekday) &&\n (month !== this.lastmonth || year !== this.lastyear)) {\n var _a = this.yearinfo, yearlen = _a.yearlen, mrange = _a.mrange, wdaymask = _a.wdaymask;\n this.monthinfo = rebuildMonth(year, month, yearlen, mrange, wdaymask, options);\n }\n if (isPresent(options.byeaster)) {\n this.eastermask = easter(year, options.byeaster);\n }\n };\n Object.defineProperty(Iterinfo.prototype, \"lastyear\", {\n get: function () {\n return this.monthinfo ? this.monthinfo.lastyear : null;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"lastmonth\", {\n get: function () {\n return this.monthinfo ? this.monthinfo.lastmonth : null;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"yearlen\", {\n get: function () {\n return this.yearinfo.yearlen;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"yearordinal\", {\n get: function () {\n return this.yearinfo.yearordinal;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"mrange\", {\n get: function () {\n return this.yearinfo.mrange;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"wdaymask\", {\n get: function () {\n return this.yearinfo.wdaymask;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"mmask\", {\n get: function () {\n return this.yearinfo.mmask;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"wnomask\", {\n get: function () {\n return this.yearinfo.wnomask;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"nwdaymask\", {\n get: function () {\n return this.monthinfo ? this.monthinfo.nwdaymask : [];\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"nextyearlen\", {\n get: function () {\n return this.yearinfo.nextyearlen;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"mdaymask\", {\n get: function () {\n return this.yearinfo.mdaymask;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Iterinfo.prototype, \"nmdaymask\", {\n get: function () {\n return this.yearinfo.nmdaymask;\n },\n enumerable: false,\n configurable: true\n });\n Iterinfo.prototype.ydayset = function () {\n return [range(this.yearlen), 0, this.yearlen];\n };\n Iterinfo.prototype.mdayset = function (_, month) {\n var start = this.mrange[month - 1];\n var end = this.mrange[month];\n var set = repeat(null, this.yearlen);\n for (var i = start; i < end; i++)\n set[i] = i;\n return [set, start, end];\n };\n Iterinfo.prototype.wdayset = function (year, month, day) {\n // We need to handle cross-year weeks here.\n var set = repeat(null, this.yearlen + 7);\n var i = toOrdinal(datetime(year, month, day)) - this.yearordinal;\n var start = i;\n for (var j = 0; j < 7; j++) {\n set[i] = i;\n ++i;\n if (this.wdaymask[i] === this.options.wkst)\n break;\n }\n return [set, start, i];\n };\n Iterinfo.prototype.ddayset = function (year, month, day) {\n var set = repeat(null, this.yearlen);\n var i = toOrdinal(datetime(year, month, day)) - this.yearordinal;\n set[i] = i;\n return [set, i, i + 1];\n };\n Iterinfo.prototype.htimeset = function (hour, _, second, millisecond) {\n var _this = this;\n var set = [];\n this.options.byminute.forEach(function (minute) {\n set = set.concat(_this.mtimeset(hour, minute, second, millisecond));\n });\n sort(set);\n return set;\n };\n Iterinfo.prototype.mtimeset = function (hour, minute, _, millisecond) {\n var set = this.options.bysecond.map(function (second) { return new Time(hour, minute, second, millisecond); });\n sort(set);\n return set;\n };\n Iterinfo.prototype.stimeset = function (hour, minute, second, millisecond) {\n return [new Time(hour, minute, second, millisecond)];\n };\n Iterinfo.prototype.getdayset = function (freq) {\n switch (freq) {\n case Frequency.YEARLY:\n return this.ydayset.bind(this);\n case Frequency.MONTHLY:\n return this.mdayset.bind(this);\n case Frequency.WEEKLY:\n return this.wdayset.bind(this);\n case Frequency.DAILY:\n return this.ddayset.bind(this);\n default:\n return this.ddayset.bind(this);\n }\n };\n Iterinfo.prototype.gettimeset = function (freq) {\n switch (freq) {\n case Frequency.HOURLY:\n return this.htimeset.bind(this);\n case Frequency.MINUTELY:\n return this.mtimeset.bind(this);\n case Frequency.SECONDLY:\n return this.stimeset.bind(this);\n }\n };\n return Iterinfo;\n}());\nexport default Iterinfo;\n//# sourceMappingURL=index.js.map","import { RRule } from '../rrule';\nimport { empty, repeat, pymod } from '../helpers';\nexport function rebuildMonth(year, month, yearlen, mrange, wdaymask, options) {\n var result = {\n lastyear: year,\n lastmonth: month,\n nwdaymask: [],\n };\n var ranges = [];\n if (options.freq === RRule.YEARLY) {\n if (empty(options.bymonth)) {\n ranges = [[0, yearlen]];\n }\n else {\n for (var j = 0; j < options.bymonth.length; j++) {\n month = options.bymonth[j];\n ranges.push(mrange.slice(month - 1, month + 1));\n }\n }\n }\n else if (options.freq === RRule.MONTHLY) {\n ranges = [mrange.slice(month - 1, month + 1)];\n }\n if (empty(ranges)) {\n return result;\n }\n // Weekly frequency won't get here, so we may not\n // care about cross-year weekly periods.\n result.nwdaymask = repeat(0, yearlen);\n for (var j = 0; j < ranges.length; j++) {\n var rang = ranges[j];\n var first = rang[0];\n var last = rang[1] - 1;\n for (var k = 0; k < options.bynweekday.length; k++) {\n var i = void 0;\n var _a = options.bynweekday[k], wday = _a[0], n = _a[1];\n if (n < 0) {\n i = last + (n + 1) * 7;\n i -= pymod(wdaymask[i] - wday, 7);\n }\n else {\n i = first + (n - 1) * 7;\n i += pymod(7 - wdaymask[i] + wday, 7);\n }\n if (first <= i && i <= last)\n result.nwdaymask[i] = 1;\n }\n }\n return result;\n}\n//# sourceMappingURL=monthinfo.js.map","export function easter(y, offset) {\n if (offset === void 0) { offset = 0; }\n var a = y % 19;\n var b = Math.floor(y / 100);\n var c = y % 100;\n var d = Math.floor(b / 4);\n var e = b % 4;\n var f = Math.floor((b + 8) / 25);\n var g = Math.floor((b - f + 1) / 3);\n var h = Math.floor(19 * a + b - d - g + 15) % 30;\n var i = Math.floor(c / 4);\n var k = c % 4;\n var l = Math.floor(32 + 2 * e + 2 * i - h - k) % 7;\n var m = Math.floor((a + 11 * h + 22 * l) / 451);\n var month = Math.floor((h + l - 7 * m + 114) / 31);\n var day = ((h + l - 7 * m + 114) % 31) + 1;\n var date = Date.UTC(y, month - 1, day + offset);\n var yearStart = Date.UTC(y, 0, 1);\n return [Math.ceil((date - yearStart) / (1000 * 60 * 60 * 24))];\n}\n//# sourceMappingURL=easter.js.map","import { combine, fromOrdinal, sort } from '../dateutil';\nimport { pymod, isPresent, includes } from '../helpers';\nexport function buildPoslist(bysetpos, timeset, start, end, ii, dayset) {\n var poslist = [];\n for (var j = 0; j < bysetpos.length; j++) {\n var daypos = void 0;\n var timepos = void 0;\n var pos = bysetpos[j];\n if (pos < 0) {\n daypos = Math.floor(pos / timeset.length);\n timepos = pymod(pos, timeset.length);\n }\n else {\n daypos = Math.floor((pos - 1) / timeset.length);\n timepos = pymod(pos - 1, timeset.length);\n }\n var tmp = [];\n for (var k = start; k < end; k++) {\n var val = dayset[k];\n if (!isPresent(val))\n continue;\n tmp.push(val);\n }\n var i = void 0;\n if (daypos < 0) {\n i = tmp.slice(daypos)[0];\n }\n else {\n i = tmp[daypos];\n }\n var time = timeset[timepos];\n var date = fromOrdinal(ii.yearordinal + i);\n var res = combine(date, time);\n // XXX: can this ever be in the array?\n // - compare the actual date instead?\n if (!includes(poslist, res))\n poslist.push(res);\n }\n sort(poslist);\n return poslist;\n}\n//# sourceMappingURL=poslist.js.map","import { freqIsDailyOrGreater } from '../types';\nimport { combine, fromOrdinal, MAXYEAR } from '../dateutil';\nimport Iterinfo from '../iterinfo/index';\nimport { RRule } from '../rrule';\nimport { buildTimeset } from '../parseoptions';\nimport { notEmpty, includes, isPresent } from '../helpers';\nimport { DateWithZone } from '../datewithzone';\nimport { buildPoslist } from './poslist';\nimport { DateTime } from '../datetime';\nexport function iter(iterResult, options) {\n var dtstart = options.dtstart, freq = options.freq, interval = options.interval, until = options.until, bysetpos = options.bysetpos;\n var count = options.count;\n if (count === 0 || interval === 0) {\n return emitResult(iterResult);\n }\n var counterDate = DateTime.fromDate(dtstart);\n var ii = new Iterinfo(options);\n ii.rebuild(counterDate.year, counterDate.month);\n var timeset = makeTimeset(ii, counterDate, options);\n for (;;) {\n var _a = ii.getdayset(freq)(counterDate.year, counterDate.month, counterDate.day), dayset = _a[0], start = _a[1], end = _a[2];\n var filtered = removeFilteredDays(dayset, start, end, ii, options);\n if (notEmpty(bysetpos)) {\n var poslist = buildPoslist(bysetpos, timeset, start, end, ii, dayset);\n for (var j = 0; j < poslist.length; j++) {\n var res = poslist[j];\n if (until && res > until) {\n return emitResult(iterResult);\n }\n if (res >= dtstart) {\n var rezonedDate = rezoneIfNeeded(res, options);\n if (!iterResult.accept(rezonedDate)) {\n return emitResult(iterResult);\n }\n if (count) {\n --count;\n if (!count) {\n return emitResult(iterResult);\n }\n }\n }\n }\n }\n else {\n for (var j = start; j < end; j++) {\n var currentDay = dayset[j];\n if (!isPresent(currentDay)) {\n continue;\n }\n var date = fromOrdinal(ii.yearordinal + currentDay);\n for (var k = 0; k < timeset.length; k++) {\n var time = timeset[k];\n var res = combine(date, time);\n if (until && res > until) {\n return emitResult(iterResult);\n }\n if (res >= dtstart) {\n var rezonedDate = rezoneIfNeeded(res, options);\n if (!iterResult.accept(rezonedDate)) {\n return emitResult(iterResult);\n }\n if (count) {\n --count;\n if (!count) {\n return emitResult(iterResult);\n }\n }\n }\n }\n }\n }\n if (options.interval === 0) {\n return emitResult(iterResult);\n }\n // Handle frequency and interval\n counterDate.add(options, filtered);\n if (counterDate.year > MAXYEAR) {\n return emitResult(iterResult);\n }\n if (!freqIsDailyOrGreater(freq)) {\n timeset = ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, 0);\n }\n ii.rebuild(counterDate.year, counterDate.month);\n }\n}\nfunction isFiltered(ii, currentDay, options) {\n var bymonth = options.bymonth, byweekno = options.byweekno, byweekday = options.byweekday, byeaster = options.byeaster, bymonthday = options.bymonthday, bynmonthday = options.bynmonthday, byyearday = options.byyearday;\n return ((notEmpty(bymonth) && !includes(bymonth, ii.mmask[currentDay])) ||\n (notEmpty(byweekno) && !ii.wnomask[currentDay]) ||\n (notEmpty(byweekday) && !includes(byweekday, ii.wdaymask[currentDay])) ||\n (notEmpty(ii.nwdaymask) && !ii.nwdaymask[currentDay]) ||\n (byeaster !== null && !includes(ii.eastermask, currentDay)) ||\n ((notEmpty(bymonthday) || notEmpty(bynmonthday)) &&\n !includes(bymonthday, ii.mdaymask[currentDay]) &&\n !includes(bynmonthday, ii.nmdaymask[currentDay])) ||\n (notEmpty(byyearday) &&\n ((currentDay < ii.yearlen &&\n !includes(byyearday, currentDay + 1) &&\n !includes(byyearday, -ii.yearlen + currentDay)) ||\n (currentDay >= ii.yearlen &&\n !includes(byyearday, currentDay + 1 - ii.yearlen) &&\n !includes(byyearday, -ii.nextyearlen + currentDay - ii.yearlen)))));\n}\nfunction rezoneIfNeeded(date, options) {\n return new DateWithZone(date, options.tzid).rezonedDate();\n}\nfunction emitResult(iterResult) {\n return iterResult.getValue();\n}\nfunction removeFilteredDays(dayset, start, end, ii, options) {\n var filtered = false;\n for (var dayCounter = start; dayCounter < end; dayCounter++) {\n var currentDay = dayset[dayCounter];\n filtered = isFiltered(ii, currentDay, options);\n if (filtered)\n dayset[currentDay] = null;\n }\n return filtered;\n}\nfunction makeTimeset(ii, counterDate, options) {\n var freq = options.freq, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond;\n if (freqIsDailyOrGreater(freq)) {\n return buildTimeset(options);\n }\n if ((freq >= RRule.HOURLY &&\n notEmpty(byhour) &&\n !includes(byhour, counterDate.hour)) ||\n (freq >= RRule.MINUTELY &&\n notEmpty(byminute) &&\n !includes(byminute, counterDate.minute)) ||\n (freq >= RRule.SECONDLY &&\n notEmpty(bysecond) &&\n !includes(bysecond, counterDate.second))) {\n return [];\n }\n return ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, counterDate.millisecond);\n}\n//# sourceMappingURL=index.js.map","import { isValidDate } from './dateutil';\nimport IterResult from './iterresult';\nimport CallbackIterResult from './callbackiterresult';\nimport { fromText, parseText, toText, isFullyConvertible } from './nlp/index';\nimport { Frequency, } from './types';\nimport { parseOptions, initializeOptions } from './parseoptions';\nimport { parseString } from './parsestring';\nimport { optionsToString } from './optionstostring';\nimport { Cache } from './cache';\nimport { Weekday } from './weekday';\nimport { iter } from './iter/index';\n// =============================================================================\n// RRule\n// =============================================================================\nexport var Days = {\n MO: new Weekday(0),\n TU: new Weekday(1),\n WE: new Weekday(2),\n TH: new Weekday(3),\n FR: new Weekday(4),\n SA: new Weekday(5),\n SU: new Weekday(6),\n};\nexport var DEFAULT_OPTIONS = {\n freq: Frequency.YEARLY,\n dtstart: null,\n interval: 1,\n wkst: Days.MO,\n count: null,\n until: null,\n tzid: null,\n bysetpos: null,\n bymonth: null,\n bymonthday: null,\n bynmonthday: null,\n byyearday: null,\n byweekno: null,\n byweekday: null,\n bynweekday: null,\n byhour: null,\n byminute: null,\n bysecond: null,\n byeaster: null,\n};\nexport var defaultKeys = Object.keys(DEFAULT_OPTIONS);\n/**\n *\n * @param {Options?} options - see \n * - The only required option is `freq`, one of RRule.YEARLY, RRule.MONTHLY, ...\n * @constructor\n */\nvar RRule = /** @class */ (function () {\n function RRule(options, noCache) {\n if (options === void 0) { options = {}; }\n if (noCache === void 0) { noCache = false; }\n // RFC string\n this._cache = noCache ? null : new Cache();\n // used by toString()\n this.origOptions = initializeOptions(options);\n var parsedOptions = parseOptions(options).parsedOptions;\n this.options = parsedOptions;\n }\n RRule.parseText = function (text, language) {\n return parseText(text, language);\n };\n RRule.fromText = function (text, language) {\n return fromText(text, language);\n };\n RRule.fromString = function (str) {\n return new RRule(RRule.parseString(str) || undefined);\n };\n RRule.prototype._iter = function (iterResult) {\n return iter(iterResult, this.options);\n };\n RRule.prototype._cacheGet = function (what, args) {\n if (!this._cache)\n return false;\n return this._cache._cacheGet(what, args);\n };\n RRule.prototype._cacheAdd = function (what, value, args) {\n if (!this._cache)\n return;\n return this._cache._cacheAdd(what, value, args);\n };\n /**\n * @param {Function} iterator - optional function that will be called\n * on each date that is added. It can return false\n * to stop the iteration.\n * @return Array containing all recurrences.\n */\n RRule.prototype.all = function (iterator) {\n if (iterator) {\n return this._iter(new CallbackIterResult('all', {}, iterator));\n }\n var result = this._cacheGet('all');\n if (result === false) {\n result = this._iter(new IterResult('all', {}));\n this._cacheAdd('all', result);\n }\n return result;\n };\n /**\n * Returns all the occurrences of the rrule between after and before.\n * The inc keyword defines what happens if after and/or before are\n * themselves occurrences. With inc == True, they will be included in the\n * list, if they are found in the recurrence set.\n *\n * @return Array\n */\n RRule.prototype.between = function (after, before, inc, iterator) {\n if (inc === void 0) { inc = false; }\n if (!isValidDate(after) || !isValidDate(before)) {\n throw new Error('Invalid date passed in to RRule.between');\n }\n var args = {\n before: before,\n after: after,\n inc: inc,\n };\n if (iterator) {\n return this._iter(new CallbackIterResult('between', args, iterator));\n }\n var result = this._cacheGet('between', args);\n if (result === false) {\n result = this._iter(new IterResult('between', args));\n this._cacheAdd('between', result, args);\n }\n return result;\n };\n /**\n * Returns the last recurrence before the given datetime instance.\n * The inc keyword defines what happens if dt is an occurrence.\n * With inc == True, if dt itself is an occurrence, it will be returned.\n *\n * @return Date or null\n */\n RRule.prototype.before = function (dt, inc) {\n if (inc === void 0) { inc = false; }\n if (!isValidDate(dt)) {\n throw new Error('Invalid date passed in to RRule.before');\n }\n var args = { dt: dt, inc: inc };\n var result = this._cacheGet('before', args);\n if (result === false) {\n result = this._iter(new IterResult('before', args));\n this._cacheAdd('before', result, args);\n }\n return result;\n };\n /**\n * Returns the first recurrence after the given datetime instance.\n * The inc keyword defines what happens if dt is an occurrence.\n * With inc == True, if dt itself is an occurrence, it will be returned.\n *\n * @return Date or null\n */\n RRule.prototype.after = function (dt, inc) {\n if (inc === void 0) { inc = false; }\n if (!isValidDate(dt)) {\n throw new Error('Invalid date passed in to RRule.after');\n }\n var args = { dt: dt, inc: inc };\n var result = this._cacheGet('after', args);\n if (result === false) {\n result = this._iter(new IterResult('after', args));\n this._cacheAdd('after', result, args);\n }\n return result;\n };\n /**\n * Returns the number of recurrences in this set. It will have go trough\n * the whole recurrence, if this hasn't been done before.\n */\n RRule.prototype.count = function () {\n return this.all().length;\n };\n /**\n * Converts the rrule into its string representation\n *\n * @see \n * @return String\n */\n RRule.prototype.toString = function () {\n return optionsToString(this.origOptions);\n };\n /**\n * Will convert all rules described in nlp:ToText\n * to text.\n */\n RRule.prototype.toText = function (gettext, language, dateFormatter) {\n return toText(this, gettext, language, dateFormatter);\n };\n RRule.prototype.isFullyConvertibleToText = function () {\n return isFullyConvertible(this);\n };\n /**\n * @return a RRule instance with the same freq and options\n * as this one (cache is not cloned)\n */\n RRule.prototype.clone = function () {\n return new RRule(this.origOptions);\n };\n // RRule class 'constants'\n RRule.FREQUENCIES = [\n 'YEARLY',\n 'MONTHLY',\n 'WEEKLY',\n 'DAILY',\n 'HOURLY',\n 'MINUTELY',\n 'SECONDLY',\n ];\n RRule.YEARLY = Frequency.YEARLY;\n RRule.MONTHLY = Frequency.MONTHLY;\n RRule.WEEKLY = Frequency.WEEKLY;\n RRule.DAILY = Frequency.DAILY;\n RRule.HOURLY = Frequency.HOURLY;\n RRule.MINUTELY = Frequency.MINUTELY;\n RRule.SECONDLY = Frequency.SECONDLY;\n RRule.MO = Days.MO;\n RRule.TU = Days.TU;\n RRule.WE = Days.WE;\n RRule.TH = Days.TH;\n RRule.FR = Days.FR;\n RRule.SA = Days.SA;\n RRule.SU = Days.SU;\n RRule.parseString = parseString;\n RRule.optionsToString = optionsToString;\n return RRule;\n}());\nexport { RRule };\n//# sourceMappingURL=rrule.js.map","import { __assign } from \"tslib\";\nimport { RRule } from './rrule';\nimport { RRuleSet } from './rruleset';\nimport { untilStringToDate } from './dateutil';\nimport { includes, split } from './helpers';\nimport { parseString, parseDtstart } from './parsestring';\n/**\n * RRuleStr\n * To parse a set of rrule strings\n */\nvar DEFAULT_OPTIONS = {\n dtstart: null,\n cache: false,\n unfold: false,\n forceset: false,\n compatible: false,\n tzid: null,\n};\nexport function parseInput(s, options) {\n var rrulevals = [];\n var rdatevals = [];\n var exrulevals = [];\n var exdatevals = [];\n var parsedDtstart = parseDtstart(s);\n var dtstart = parsedDtstart.dtstart;\n var tzid = parsedDtstart.tzid;\n var lines = splitIntoLines(s, options.unfold);\n lines.forEach(function (line) {\n var _a;\n if (!line)\n return;\n var _b = breakDownLine(line), name = _b.name, parms = _b.parms, value = _b.value;\n switch (name.toUpperCase()) {\n case 'RRULE':\n if (parms.length) {\n throw new Error(\"unsupported RRULE parm: \".concat(parms.join(',')));\n }\n rrulevals.push(parseString(line));\n break;\n case 'RDATE':\n var _c = (_a = /RDATE(?:;TZID=([^:=]+))?/i.exec(line)) !== null && _a !== void 0 ? _a : [], rdateTzid = _c[1];\n if (rdateTzid && !tzid) {\n tzid = rdateTzid;\n }\n rdatevals = rdatevals.concat(parseRDate(value, parms));\n break;\n case 'EXRULE':\n if (parms.length) {\n throw new Error(\"unsupported EXRULE parm: \".concat(parms.join(',')));\n }\n exrulevals.push(parseString(value));\n break;\n case 'EXDATE':\n exdatevals = exdatevals.concat(parseRDate(value, parms));\n break;\n case 'DTSTART':\n break;\n default:\n throw new Error('unsupported property: ' + name);\n }\n });\n return {\n dtstart: dtstart,\n tzid: tzid,\n rrulevals: rrulevals,\n rdatevals: rdatevals,\n exrulevals: exrulevals,\n exdatevals: exdatevals,\n };\n}\nfunction buildRule(s, options) {\n var _a = parseInput(s, options), rrulevals = _a.rrulevals, rdatevals = _a.rdatevals, exrulevals = _a.exrulevals, exdatevals = _a.exdatevals, dtstart = _a.dtstart, tzid = _a.tzid;\n var noCache = options.cache === false;\n if (options.compatible) {\n options.forceset = true;\n options.unfold = true;\n }\n if (options.forceset ||\n rrulevals.length > 1 ||\n rdatevals.length ||\n exrulevals.length ||\n exdatevals.length) {\n var rset_1 = new RRuleSet(noCache);\n rset_1.dtstart(dtstart);\n rset_1.tzid(tzid || undefined);\n rrulevals.forEach(function (val) {\n rset_1.rrule(new RRule(groomRruleOptions(val, dtstart, tzid), noCache));\n });\n rdatevals.forEach(function (date) {\n rset_1.rdate(date);\n });\n exrulevals.forEach(function (val) {\n rset_1.exrule(new RRule(groomRruleOptions(val, dtstart, tzid), noCache));\n });\n exdatevals.forEach(function (date) {\n rset_1.exdate(date);\n });\n if (options.compatible && options.dtstart)\n rset_1.rdate(dtstart);\n return rset_1;\n }\n var val = rrulevals[0] || {};\n return new RRule(groomRruleOptions(val, val.dtstart || options.dtstart || dtstart, val.tzid || options.tzid || tzid), noCache);\n}\nexport function rrulestr(s, options) {\n if (options === void 0) { options = {}; }\n return buildRule(s, initializeOptions(options));\n}\nfunction groomRruleOptions(val, dtstart, tzid) {\n return __assign(__assign({}, val), { dtstart: dtstart, tzid: tzid });\n}\nfunction initializeOptions(options) {\n var invalid = [];\n var keys = Object.keys(options);\n var defaultKeys = Object.keys(DEFAULT_OPTIONS);\n keys.forEach(function (key) {\n if (!includes(defaultKeys, key))\n invalid.push(key);\n });\n if (invalid.length) {\n throw new Error('Invalid options: ' + invalid.join(', '));\n }\n return __assign(__assign({}, DEFAULT_OPTIONS), options);\n}\nfunction extractName(line) {\n if (line.indexOf(':') === -1) {\n return {\n name: 'RRULE',\n value: line,\n };\n }\n var _a = split(line, ':', 1), name = _a[0], value = _a[1];\n return {\n name: name,\n value: value,\n };\n}\nfunction breakDownLine(line) {\n var _a = extractName(line), name = _a.name, value = _a.value;\n var parms = name.split(';');\n if (!parms)\n throw new Error('empty property name');\n return {\n name: parms[0].toUpperCase(),\n parms: parms.slice(1),\n value: value,\n };\n}\nfunction splitIntoLines(s, unfold) {\n if (unfold === void 0) { unfold = false; }\n s = s && s.trim();\n if (!s)\n throw new Error('Invalid empty string');\n // More info about 'unfold' option\n // Go head to http://www.ietf.org/rfc/rfc2445.txt\n if (!unfold) {\n return s.split(/\\s/);\n }\n var lines = s.split('\\n');\n var i = 0;\n while (i < lines.length) {\n // TODO\n var line = (lines[i] = lines[i].replace(/\\s+$/g, ''));\n if (!line) {\n lines.splice(i, 1);\n }\n else if (i > 0 && line[0] === ' ') {\n lines[i - 1] += line.slice(1);\n lines.splice(i, 1);\n }\n else {\n i += 1;\n }\n }\n return lines;\n}\nfunction validateDateParm(parms) {\n parms.forEach(function (parm) {\n if (!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(parm)) {\n throw new Error('unsupported RDATE/EXDATE parm: ' + parm);\n }\n });\n}\nfunction parseRDate(rdateval, parms) {\n validateDateParm(parms);\n return rdateval.split(',').map(function (datestr) { return untilStringToDate(datestr); });\n}\n//# sourceMappingURL=rrulestr.js.map","import { __extends } from \"tslib\";\nimport { RRule } from './rrule';\nimport { sort, timeToUntilString } from './dateutil';\nimport { includes } from './helpers';\nimport { iterSet } from './iterset';\nimport { rrulestr } from './rrulestr';\nimport { optionsToString } from './optionstostring';\nfunction createGetterSetter(fieldName) {\n var _this = this;\n return function (field) {\n if (field !== undefined) {\n _this[\"_\".concat(fieldName)] = field;\n }\n if (_this[\"_\".concat(fieldName)] !== undefined) {\n return _this[\"_\".concat(fieldName)];\n }\n for (var i = 0; i < _this._rrule.length; i++) {\n var field_1 = _this._rrule[i].origOptions[fieldName];\n if (field_1) {\n return field_1;\n }\n }\n };\n}\nvar RRuleSet = /** @class */ (function (_super) {\n __extends(RRuleSet, _super);\n /**\n *\n * @param {Boolean?} noCache\n * The same stratagy as RRule on cache, default to false\n * @constructor\n */\n function RRuleSet(noCache) {\n if (noCache === void 0) { noCache = false; }\n var _this = _super.call(this, {}, noCache) || this;\n _this.dtstart = createGetterSetter.apply(_this, ['dtstart']);\n _this.tzid = createGetterSetter.apply(_this, ['tzid']);\n _this._rrule = [];\n _this._rdate = [];\n _this._exrule = [];\n _this._exdate = [];\n return _this;\n }\n RRuleSet.prototype._iter = function (iterResult) {\n return iterSet(iterResult, this._rrule, this._exrule, this._rdate, this._exdate, this.tzid());\n };\n /**\n * Adds an RRule to the set\n *\n * @param {RRule}\n */\n RRuleSet.prototype.rrule = function (rrule) {\n _addRule(rrule, this._rrule);\n };\n /**\n * Adds an EXRULE to the set\n *\n * @param {RRule}\n */\n RRuleSet.prototype.exrule = function (rrule) {\n _addRule(rrule, this._exrule);\n };\n /**\n * Adds an RDate to the set\n *\n * @param {Date}\n */\n RRuleSet.prototype.rdate = function (date) {\n _addDate(date, this._rdate);\n };\n /**\n * Adds an EXDATE to the set\n *\n * @param {Date}\n */\n RRuleSet.prototype.exdate = function (date) {\n _addDate(date, this._exdate);\n };\n /**\n * Get list of included rrules in this recurrence set.\n *\n * @return List of rrules\n */\n RRuleSet.prototype.rrules = function () {\n return this._rrule.map(function (e) { return rrulestr(e.toString()); });\n };\n /**\n * Get list of excluded rrules in this recurrence set.\n *\n * @return List of exrules\n */\n RRuleSet.prototype.exrules = function () {\n return this._exrule.map(function (e) { return rrulestr(e.toString()); });\n };\n /**\n * Get list of included datetimes in this recurrence set.\n *\n * @return List of rdates\n */\n RRuleSet.prototype.rdates = function () {\n return this._rdate.map(function (e) { return new Date(e.getTime()); });\n };\n /**\n * Get list of included datetimes in this recurrence set.\n *\n * @return List of exdates\n */\n RRuleSet.prototype.exdates = function () {\n return this._exdate.map(function (e) { return new Date(e.getTime()); });\n };\n RRuleSet.prototype.valueOf = function () {\n var result = [];\n if (!this._rrule.length && this._dtstart) {\n result = result.concat(optionsToString({ dtstart: this._dtstart }));\n }\n this._rrule.forEach(function (rrule) {\n result = result.concat(rrule.toString().split('\\n'));\n });\n this._exrule.forEach(function (exrule) {\n result = result.concat(exrule\n .toString()\n .split('\\n')\n .map(function (line) { return line.replace(/^RRULE:/, 'EXRULE:'); })\n .filter(function (line) { return !/^DTSTART/.test(line); }));\n });\n if (this._rdate.length) {\n result.push(rdatesToString('RDATE', this._rdate, this.tzid()));\n }\n if (this._exdate.length) {\n result.push(rdatesToString('EXDATE', this._exdate, this.tzid()));\n }\n return result;\n };\n /**\n * to generate recurrence field such as:\n * DTSTART:19970902T010000Z\n * RRULE:FREQ=YEARLY;COUNT=2;BYDAY=TU\n * RRULE:FREQ=YEARLY;COUNT=1;BYDAY=TH\n */\n RRuleSet.prototype.toString = function () {\n return this.valueOf().join('\\n');\n };\n /**\n * Create a new RRuleSet Object completely base on current instance\n */\n RRuleSet.prototype.clone = function () {\n var rrs = new RRuleSet(!!this._cache);\n this._rrule.forEach(function (rule) { return rrs.rrule(rule.clone()); });\n this._exrule.forEach(function (rule) { return rrs.exrule(rule.clone()); });\n this._rdate.forEach(function (date) { return rrs.rdate(new Date(date.getTime())); });\n this._exdate.forEach(function (date) { return rrs.exdate(new Date(date.getTime())); });\n return rrs;\n };\n return RRuleSet;\n}(RRule));\nexport { RRuleSet };\nfunction _addRule(rrule, collection) {\n if (!(rrule instanceof RRule)) {\n throw new TypeError(String(rrule) + ' is not RRule instance');\n }\n if (!includes(collection.map(String), String(rrule))) {\n collection.push(rrule);\n }\n}\nfunction _addDate(date, collection) {\n if (!(date instanceof Date)) {\n throw new TypeError(String(date) + ' is not Date instance');\n }\n if (!includes(collection.map(Number), Number(date))) {\n collection.push(date);\n sort(collection);\n }\n}\nfunction rdatesToString(param, rdates, tzid) {\n var isUTC = !tzid || tzid.toUpperCase() === 'UTC';\n var header = isUTC ? \"\".concat(param, \":\") : \"\".concat(param, \";TZID=\").concat(tzid, \":\");\n var dateString = rdates\n .map(function (rdate) { return timeToUntilString(rdate.valueOf(), isUTC); })\n .join(',');\n return \"\".concat(header).concat(dateString);\n}\n//# sourceMappingURL=rruleset.js.map","import { DateWithZone } from './datewithzone';\nimport { iter } from './iter';\nimport { sort } from './dateutil';\nexport function iterSet(iterResult, _rrule, _exrule, _rdate, _exdate, tzid) {\n var _exdateHash = {};\n var _accept = iterResult.accept;\n function evalExdate(after, before) {\n _exrule.forEach(function (rrule) {\n rrule.between(after, before, true).forEach(function (date) {\n _exdateHash[Number(date)] = true;\n });\n });\n }\n _exdate.forEach(function (date) {\n var zonedDate = new DateWithZone(date, tzid).rezonedDate();\n _exdateHash[Number(zonedDate)] = true;\n });\n iterResult.accept = function (date) {\n var dt = Number(date);\n if (isNaN(dt))\n return _accept.call(this, date);\n if (!_exdateHash[dt]) {\n evalExdate(new Date(dt - 1), new Date(dt + 1));\n if (!_exdateHash[dt]) {\n _exdateHash[dt] = true;\n return _accept.call(this, date);\n }\n }\n return true;\n };\n if (iterResult.method === 'between') {\n evalExdate(iterResult.args.after, iterResult.args.before);\n iterResult.accept = function (date) {\n var dt = Number(date);\n if (!_exdateHash[dt]) {\n _exdateHash[dt] = true;\n return _accept.call(this, date);\n }\n return true;\n };\n }\n for (var i = 0; i < _rdate.length; i++) {\n var zonedDate = new DateWithZone(_rdate[i], tzid).rezonedDate();\n if (!iterResult.accept(new Date(zonedDate.getTime())))\n break;\n }\n _rrule.forEach(function (rrule) {\n iter(iterResult, rrule.options);\n });\n var res = iterResult._result;\n sort(res);\n switch (iterResult.method) {\n case 'all':\n case 'between':\n return res;\n case 'before':\n return ((res.length && res[res.length - 1]) || null);\n case 'after':\n default:\n return ((res.length && res[0]) || null);\n }\n}\n//# sourceMappingURL=iterset.js.map","/* autoscroll start */\n\nexport default function(scheduler){\n\nlet scrollInterval = 10;\n\nlet interval = null;\nlet startPos = null;\n\nfunction getRelativeCoordinates (e, parent) {\n\tconst view = scheduler.matrix[scheduler._mode];\n\tconst pos = {};\n\tconst offset = {};\n\tlet container = parent;\n\n\tpos.x = !!e.touches ? e.touches[ 0 ].pageX : e.pageX;\n\tpos.y = !! e.touches ? e.touches[ 0 ].pageY : e.pageY;\n\n\toffset.left = container.offsetLeft + view.dx;\n\toffset.top = container.offsetTop;\n\n\twhile ( container ) {\n\n\t\toffset.left += container.offsetLeft;\n\t\toffset.top += container.offsetTop;\n\n\t\tcontainer = container.offsetParent;\n\t}\n\n\treturn {\n\t\tx : pos.x - offset.left,\n\t\ty : pos.y - offset.top\n\t};\n}\n\nfunction autoscrollInterval(event){\n\tif(interval)\n\t\tclearInterval(interval);\n\n\tconst view = scheduler.matrix[scheduler._mode];\n\tif(!view)\n\t\treturn;\n\tscheduler._schedulerOuter = scheduler.$container.querySelector(\".dhx_timeline_data_wrapper\");\n\tif (!view.scrollable){\n\t\tscheduler._schedulerOuter = scheduler.$container.querySelector(\".dhx_cal_data\");\n\t}\n\n\tconst eventPos = {\n\t\tpageX: !!event.touches ? event.touches[0].pageX : event.pageX,\n\t\tpageY: !!event.touches ? event.touches[0].pageY : event.pageY\n\t};\n\tinterval = setInterval(function(){tick(eventPos);}, scrollInterval);\n}\n\nscheduler.attachEvent(\"onDestroy\", function(){\n\tclearInterval(interval);\n});\n\nfunction tick(e){\n\tif(!scheduler.getState().drag_id) {\n\t\tclearInterval(interval);\n\t\tstartPos = null;\n\t\treturn;\n\t}\n\n\tconst view = scheduler.matrix[scheduler._mode];\n\tif(!view)\n\t\treturn;\n\n\n\t\n\tconst viewport = scheduler._schedulerOuter;\n\tconst box = getRelativeCoordinates(e, viewport);\n\n\tconst availWidth = viewport.offsetWidth - view.dx;\n\tconst availHeight = viewport.offsetHeight;\n\n\tconst posX = box.x;\n\tconst posY = box.y;\n\n\tlet settings = view.autoscroll || {};\n\tif(settings === true){\n\t\tsettings = {};\n\t}\n\n\tscheduler._merge(settings, {\n\t\trange_x: 200,// px to edge\n\t\trange_y: 100,\n\t\tspeed_x: 20,// speed\n\t\tspeed_y: 10\n\t});\n\n\tlet scrollLeft = need_scroll(posX, availWidth, startPos ? startPos.x : 0, settings.range_x);\n\tif(!view.scrollable){\n\t\tscrollLeft = 0;\n\t}\n\tlet scrollTop = need_scroll(posY, availHeight, startPos ? startPos.y : 0, settings.range_y);\n\n\tif((scrollTop || scrollLeft) && !startPos){\n\t\tstartPos = {\n\t\t\tx: posX,\n\t\t\ty: posY\n\t\t};\n\n\t\tscrollLeft = 0;\n\t\tscrollTop = 0;\n\t}\n\n\tscrollLeft = scrollLeft * settings.speed_x;\n\tscrollTop = scrollTop * settings.speed_y;\n\n\tif(scrollLeft && scrollTop){\n\t\tif(Math.abs(scrollLeft / 5) > Math.abs(scrollTop)){\n\t\t\tscrollTop = 0;\n\t\t}else if(Math.abs(scrollTop / 5) > Math.abs(scrollLeft)){\n\t\t\tscrollLeft = 0;\n\t\t}\n\t}\n\n\tif(scrollLeft || scrollTop){\n\t\tstartPos.started = true;\n\t\tscroll(scrollLeft, scrollTop);\n\t}else{\n\t\tclearInterval(interval);\n\t}\n}\n\nfunction need_scroll(pos, boxSize, startCoord, scrollRange){\n\tif(pos < scrollRange && (!startPos || startPos.started || pos < startCoord)){\n\t\treturn -1;\n\t}else if(boxSize - pos < scrollRange && (!startPos || startPos.started || pos > startCoord)){\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\nfunction scroll(left, top){\n\tconst viewport = scheduler._schedulerOuter;\n\tif(top){\n\t\tviewport.scrollTop += top;\n\t}\n\tif (left){ // + 40 - adjust height of that movement was correct\n\t\tviewport.scrollLeft += left;\n\t}\n}\n\n\nvar evId = scheduler.attachEvent(\"onSchedulerReady\", function(){\n\tif (scheduler.matrix) {\n\t\tscheduler.event(document.body, \"mousemove\", autoscrollInterval);\n\t\tscheduler.detachEvent(evId);\n\t}\n});\n\n/* autoscroll end */\n\n}","export default (function(){\n\treturn function create(){\n\t\tvar modes = {\n\t\t\t\"minMax\":\"[0;max]\",\n\t\t\t\"maxMin\":\"[max;0]\",\n\t\t\t\"nMaxMin\":\"[-max;0]\"\n\t\t};\n\t\t\n\t\tfunction createTestElement(){\n\t\t\tvar container = document.createElement(\"div\");\n\t\t\tcontainer.style.cssText = \t\"direction: rtl;\" + \n\t\t\t\t\t\t\t\t\t\t\"overflow: auto;\" +\n\t\t\t\t\t\t\t\t\t\t\"width:100px;\" +\n\t\t\t\t\t\t\t\t\t\t\"height: 100px;\" +\n\t\t\t\t\t\t\t\t\t\t\"position:absolute;\" +\n\t\t\t\t\t\t\t\t\t\t\"top: -100500px;\" +\n\t\t\t\t\t\t\t\t\t\t\"left: -100500px;\";\n\t\t\tvar content = document.createElement(\"div\");\n\t\t\tcontent.style.cssText = \"width: 100500px;height: 1px;\";\n\t\t\tcontainer.appendChild(content);\n\t\t\treturn container;\n\t\t}\n\n\t\tfunction detectScrollMode(){\n\t\t\tvar result = modes.minMax;\n\t\t\tvar demoElement = createTestElement();\n\t\t\tdocument.body.appendChild(demoElement);\n\n\t\t\tvar initialScroll = demoElement.scrollLeft;\n\t\t\tif(initialScroll > 0){\n\t\t\t\t// scrollLeft goes from zero (left) to maximum value (right), the same way as in ltr mode\n\t\t\t\t// probably chrome\n\t\t\t\tresult = modes.minMax;\n\t\t\t}else{\n\t\t\t\tdemoElement.scrollLeft = -50;\n\t\t\t\tif(demoElement.scrollLeft === -50){\n\t\t\t\t\t// scrollLeft goes from negative max (left) to zero (right)\n\t\t\t\t\t// probably FF\n\t\t\t\t\tresult = modes.nMaxMin; \n\t\t\t\t}else{\n\t\t\t\t\t// scrollLeft goes from max (left) to zero (right)\n\t\t\t\t\t// probably IE\n\t\t\t\t\tresult = modes.maxMin; \n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdocument.body.removeChild(demoElement);\n\t\t\treturn result;\n\t\t}\n\n\t\tfunction normalizeValue(value, scrollWidth){\n\t\t\tvar mode = getMode();\n\t\t\tif(mode === modes.nMaxMin){\n\t\t\t\tif(value){\n\t\t\t\t\treturn -value;\n\t\t\t\t}else {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}else if (mode === modes.minMax){\n\t\t\t\treturn scrollWidth - value;\n\t\t\t}else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\n\n\t\tfunction getScrollValue(element){\n\t\t\t//const direction = \"ltr\";\n\t\t\tvar direction = getComputedStyle(element).direction;\n\t\t\tif(!direction || direction === \"ltr\"){\n\t\t\t\treturn element.scrollLeft;\n\t\t\t}else {\n\t\t\t\tvar maxScroll = element.scrollWidth - element.offsetWidth;\n\t\t\t\treturn normalizeValue(element.scrollLeft, maxScroll);\n\t\t\t}\n\t\t}\n\n\t\tfunction setScrollValue(element, value){\n\t\t\t//const direction = \"ltr\";\n\t\t\tvar direction = getComputedStyle(element).direction;\n\t\t\tif(!direction || direction === \"ltr\"){\n\t\t\t\telement.scrollLeft = value;\n\t\t\t}else {\n\t\t\t\tvar maxScroll = element.scrollWidth - element.offsetWidth;\n\t\t\t\tvar normalized = normalizeValue(value, maxScroll);\n\t\t\t\telement.scrollLeft = normalized;\n\t\t\t}\n\t\t}\n\n\t\tvar currentMode;\n\t\tfunction getMode(){\n\t\t\tif(!currentMode){\n\t\t\t\tcurrentMode = detectScrollMode();\n\t\t\t}\n\t\t\treturn currentMode;\n\t\t}\n\t\treturn {\n\t\t\tmodes: modes,\n\t\t\tgetMode: getMode,\n\t\t\tnormalizeValue: normalizeValue,\n\t\t\tgetScrollValue: getScrollValue,\n\t\t\tsetScrollValue: setScrollValue\n\t\t};\n\t};\n})();","interface IViewPosition{\n\ttop: number;\n\tleft: number;\n}\n\ninterface IViewBox extends IViewPosition{\n\twidth: number;\n\theight: number;\n\tbottom: number;\n\tright: number;\n}\n\nexport class Tooltip {\n\tprivate _root: HTMLElement;\n\tprivate _tooltipNode: HTMLElement | null;\n\tprivate _scheduler: any;\n\n\tconstructor(scheduler: any){\n\t\tthis._scheduler = scheduler;\n\t}\n\n\tgetNode() : HTMLElement {\n\t\tconst scheduler = this._scheduler;\n\t\tif (!this._tooltipNode){\n\t\t\tthis._tooltipNode = document.createElement(\"div\");\n\t\t\tthis._tooltipNode.className = \"dhtmlXTooltip scheduler_tooltip tooltip\";\n\n\t\t\tscheduler._waiAria.tooltipAttr(this._tooltipNode);\n\t\t}\n\t\tif(scheduler.config.rtl){\n\t\t\tthis._tooltipNode.classList.add(\"dhtmlXTooltip_rtl\");\n\t\t} else{\n\t\t\tthis._tooltipNode.classList.remove(\"dhtmlXTooltip_rtl\");\n\t\t}\n\t\treturn this._tooltipNode;\n\t}\n\n\tsetViewport(node: HTMLElement):Tooltip{\n\t\tthis._root = node;\n\t\treturn this;\n\t}\n\n\tshow(left: number, top: number): Tooltip;\n\tshow(event: MouseEvent): Tooltip;\n\tshow(left: number | MouseEvent, top?: number): Tooltip {\n\t\tconst scheduler = this._scheduler;\n\t\tconst domHelpers = scheduler.$domHelpers;\n\t\tconst container = document.body;\n\t\tconst node = this.getNode();\n\n\t\tif(!domHelpers.isChildOf(node, container)){\n\t\t\tthis.hide();\n\t\t\tcontainer.appendChild(node);\n\t\t}\n\n\t\tif (this._isLikeMouseEvent(left)) {\n\t\t\tconst position = this._calculateTooltipPosition(left as MouseEvent);\n\t\t\ttop = position.top;\n\t\t\tleft = position.left;\n\t\t}\n\n\t\tnode.style.top = top + \"px\";\n\t\tnode.style.left = left + \"px\";\n\n\t\tscheduler._waiAria.tooltipVisibleAttr(node);\n\t\treturn this;\n\t}\n\thide() : Tooltip{\n\t\tconst scheduler = this._scheduler;\n\t\tconst node = this.getNode();\n\t\tif(node && node.parentNode){\n\t\t\tnode.parentNode.removeChild(node);\n\t\t}\n\t\tscheduler._waiAria.tooltipHiddenAttr(node);\n\t\treturn this;\n\t}\n\n\tsetContent(html: string) : Tooltip{\n\t\tconst node = this.getNode();\n\t\tnode.innerHTML = html;\n\t\treturn this;\n\t}\n\n\t// it is for salesforce, because it proxies event to it own events\n\tprivate _isLikeMouseEvent(event: any): boolean {\n\t\tif (!event || typeof event !== \"object\") {\n\t\t\treturn false;\n\t\t}\n\t\treturn \"clientX\" in event && \"clientY\" in event;\n\t}\n\n\tprivate _getViewPort() : HTMLElement {\n\t\treturn this._root || document.body;\n\t}\n\n\n\tprivate _calculateTooltipPosition(event: MouseEvent): IViewPosition{\n\t\tconst scheduler = this._scheduler;\n\t\tconst domHelpers = scheduler.$domHelpers;\n\t\t// top/left coordinates inside the viewport by mouse position\n\t\tconst viewport = this._getViewPortSize();\n\t\tconst tooltipNode = this.getNode();\n\t\tconst tooltip: IViewBox = {\n\t\t\ttop:0,\n\t\t\tleft: 0,\n\t\t\twidth: tooltipNode.offsetWidth,\n\t\t\theight: tooltipNode.offsetHeight,\n\t\t\tbottom: 0,\n\t\t\tright: 0\n\t\t};\n\n\t\tconst offsetX = scheduler.config.tooltip_offset_x;\n\t\tconst offsetY = scheduler.config.tooltip_offset_y;\n\n\t\tconst container = document.body;\n\t\tconst mouse = domHelpers.getRelativeEventPosition(event, container);\n\t\tconst containerPos = domHelpers.getNodePosition(container);\n\t\tmouse.y += containerPos.y; // to fix margin collapsing\n\n\t\ttooltip.top = mouse.y;\n\t\ttooltip.left = mouse.x;\n\t\ttooltip.top += offsetY;\n\t\ttooltip.left += offsetX;\n\t\ttooltip.bottom = tooltip.top + tooltip.height;\n\t\ttooltip.right = tooltip.left + tooltip.width;\n\n\t\tconst scrollTop = window.scrollY + container.scrollTop; // to fix margin collapsing\n\t\t// edge cases when the tooltip element can be partially hidden by edges of the viewport\n\t\tif(tooltip.top < viewport.top - scrollTop){\n\t\t\ttooltip.top = viewport.top;\n\t\t\ttooltip.bottom = tooltip.top + tooltip.height;\n\t\t}else if(tooltip.bottom > viewport.bottom){\n\t\t\ttooltip.bottom = viewport.bottom;\n\t\t\ttooltip.top = tooltip.bottom - tooltip.height;\n\t\t}\n\n\t\tif(tooltip.left < viewport.left){\n\t\t\ttooltip.left = viewport.left;\n\t\t\ttooltip.right = viewport.left + tooltip.width;\n\t\t}else if(tooltip.right > viewport.right){\n\t\t\ttooltip.right = viewport.right;\n\t\t\ttooltip.left = tooltip.right - tooltip.width;\n\t\t}\n\n\t\tif(mouse.x >= tooltip.left && mouse.x <= tooltip.right) {\n\t\t\ttooltip.left = mouse.x - tooltip.width - offsetX;\n\t\t\ttooltip.right = tooltip.left + tooltip.width;\n\t\t}\n\n\t\tif(mouse.y >= tooltip.top && mouse.y <= tooltip.bottom) {\n\t\t\ttooltip.top = mouse.y - tooltip.height - offsetY;\n\t\t\ttooltip.bottom = tooltip.top + tooltip.height;\n\t\t}\n\n\t\treturn tooltip;\n\t}\n\n\tprivate _getViewPortSize() : IViewBox {\n\t\tconst scheduler = this._scheduler;\n\t\tconst domHelpers = scheduler.$domHelpers;\n\t\tconst container = this._getViewPort();\n\t\tlet viewport = container;\n\t\tlet scrollTop = window.scrollY + document.body.scrollTop;\n\t\tlet scrollLeft = window.scrollX + document.body.scrollLeft;\n\t\tlet pos;\n\t\t// support for the initial tooltip mode where the tooltip element was attached to the data area of scheduler\n\t\tif(container === scheduler.$event_data){\n\t\t\tviewport = scheduler.$event;\n\t\t\tscrollTop = 0;\n\t\t\tscrollLeft = 0;\n\t\t\tpos = domHelpers.getNodePosition(scheduler.$event);\n\t\t}else{\n\t\t\tpos = domHelpers.getNodePosition(viewport);\n\t\t}\n\t\treturn {\n\t\t\tleft:pos.x + scrollLeft,\n\t\t\ttop: pos.y + scrollTop,\n\t\t\twidth: pos.width,\n\t\t\theight: pos.height,\n\t\t\tbottom: pos.y + pos.height + scrollTop,\n\t\t\tright: pos.x + pos.width + scrollLeft\n\t\t};\n\t}\n}\n","import * as utils from \"../../core/utils/utils\";\nimport { Tooltip } from \"./tooltip\";\n\ninterface ITrackerTarget {\n\tselector: string;\n\tonmouseenter: (event: MouseEvent, node: HTMLElement) => void;\n\tonmousemove: (event: MouseEvent, node: HTMLElement) => void;\n\tonmouseleave: (event: MouseEvent, node: HTMLElement) => void;\n\tglobal: boolean;\n}\n\ninterface ITooltipConfig {\n\tselector: string;\n\thtml: (event: MouseEvent, node: HTMLElement) => string;\n\tglobal: boolean;\n}\n\nexport class TooltipManager{\n\ttooltip: Tooltip;\n\tprotected _domEvents: any;\n\tprivate _listeners: object = {};\n\tprivate _scheduler: any;\n\tprivate delayShow: any;\n\tprivate delayHide: any;\n\n\tconstructor(scheduler: any) {\n\t\tthis.tooltip = new Tooltip(scheduler);\n\t\tthis._scheduler = scheduler;\n\t\tthis._domEvents = scheduler._createDomEventScope();\n\t\tthis._initDelayedFunctions();\n\t}\n\n\tdestructor(): void{\n\t\tthis.tooltip.hide();\n\t\tthis._domEvents.detachAll();\n\t}\n\thideTooltip(): void{\n\t\tthis.delayHide();\n\t}\n\tattach(config: ITrackerTarget): void {\n\t\tlet root = document.body;\n\t\tconst scheduler = this._scheduler;\n\t\tconst domHelpers = scheduler.$domHelpers;\n\t\tif(!config.global){\n\t\t\troot = scheduler.$root;\n\t\t}\n\n\t\tlet watchableTarget = null;\n\t\tconst handler = (event) => {\n\t\t\tconst eventTarget = domHelpers.getTargetNode(event);\n\t\t\tconst targetNode = domHelpers.closest(eventTarget, config.selector);\n\t\t\tif(domHelpers.isChildOf(eventTarget, this.tooltip.getNode())){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst doOnMouseEnter = () => {\n\t\t\t\twatchableTarget = targetNode;\n\t\t\t\tconfig.onmouseenter(event, targetNode);\n\t\t\t};\n\t\t\t// GS-2377: to show tooltip after touch and hide it when touch is outside the events\n\t\t\tif (scheduler._mobile && scheduler.config.touch_tooltip){\n\t\t\t\tif(targetNode){\n\t\t\t\t\tdoOnMouseEnter();\n\t\t\t\t} else {\n\t\t\t\t\tconfig.onmouseleave(event, targetNode);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(watchableTarget){\n\t\t\t\tif(targetNode && targetNode === watchableTarget){\n\t\t\t\t\tconfig.onmousemove(event, targetNode);\n\t\t\t\t}else{\n\t\t\t\t\tconfig.onmouseleave(event, watchableTarget);\n\t\t\t\t\twatchableTarget = null;\n\n\t\t\t\t\tif(targetNode && targetNode !== watchableTarget){\n\t\t\t\t\t\tdoOnMouseEnter();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(targetNode){\n\t\t\t\t\tdoOnMouseEnter();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis.detach(config.selector);\n\t\tthis._domEvents.attach(root, \"mousemove\", handler);\n\t\tthis._listeners[config.selector] = {\n\t\t\tnode: root,\n\t\t\thandler\n\t\t};\n\t}\n\n\tdetach(selector: string): void {\n\t\tconst listener = this._listeners[selector];\n\t\tif(listener){\n\t\t\tthis._domEvents.detach(listener.node, \"mousemove\", listener.handler);\n\t\t}\n\t}\n\n\ttooltipFor(config: ITooltipConfig): void {\n\t\tconst cloneDomEvent = (event: MouseEvent) => {\n\t\t\tlet clone = event;\n\t\t\t// making events survive timeout in ie\n\t\t\t// tslint:disable-next-line no-string-literal\n\t\t\tif(document[\"createEventObject\"] && !document.createEvent){\n\t\t\t\t// tslint:disable-next-line no-string-literal\n\t\t\t\tclone = document[\"createEventObject\"](event);\n\t\t\t}\n\t\t\treturn clone;\n\t\t};\n\t\tthis._initDelayedFunctions();\n\t\tthis.attach({\n\t\t\tselector: config.selector,\n\t\t\tglobal: config.global,\n\t\t\tonmouseenter:(event: MouseEvent, node: HTMLElement) => {\n\t\t\t\tconst html = config.html(event, node);\n\t\t\t\tif(html){\n\t\t\t\t\tthis.delayShow(cloneDomEvent(event), html);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonmousemove:(event: MouseEvent, node: HTMLElement) => {\n\t\t\t\tconst html = config.html(event, node);\n\t\t\t\tif(html){\n\t\t\t\t\tthis.delayShow(cloneDomEvent(event), html);\n\t\t\t\t}else{\n\t\t\t\t\tthis.delayShow.$cancelTimeout();\n\t\t\t\t\tthis.delayHide();\n\t\t\t\t}\n\t\t\t},\n\t\t\tonmouseleave:() => {\n\t\t\t\tthis.delayShow.$cancelTimeout();\n\t\t\t\tthis.delayHide();\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate _initDelayedFunctions(){\n\t\tconst scheduler = this._scheduler;\n\t\t// reset delayed functions in order to apply current values of tooltip_timeout\n\t\tif(this.delayShow){\n\t\t\tthis.delayShow.$cancelTimeout();\n\t\t}\n\t\tif(this.delayHide){\n\t\t\tthis.delayHide.$cancelTimeout();\n\t\t}\n\t\tthis.tooltip.hide();\n\t\t\n\t\tthis.delayShow = (utils as any).default.delay((event: MouseEvent, html: string) => {\n\t\t\tif(scheduler.callEvent(\"onBeforeTooltip\", [event]) === false) {\n\t\t\t\tthis.tooltip.hide();\n\t\t\t} else {\n\t\t\t\tthis.tooltip.setContent(html);\n\t\t\t\tthis.tooltip.show(event);\n\t\t\t}\n\t\t}, scheduler.config.tooltip_timeout || 1);\n\n\t\tthis.delayHide = (utils as any).default.delay(() => {\n\t\t\tthis.delayShow.$cancelTimeout();\n\t\t\tthis.tooltip.hide();\n\t\t}, scheduler.config.tooltip_hide_timeout || 1);\n\t}\n\n}","import active_links from \"./active_links\";\nimport agenda_legacy from \"./agenda_legacy_view\";\nimport agenda_view from \"./agenda\";\nimport all_timed from \"./all_timed\";\nimport collision from \"./collision\";\nimport container_autoresize from \"./container_autoresize\";\nimport cookie from \"./cookie\";\nimport daytimeline from \"./daytimeline\";\nimport drag_between from \"./drag_between\";\nimport editors from \"./editors\";\nimport expand from \"./expand\";\nimport grid_view from \"./grid_view\";\nimport html_templates from \"./html_templates\";\nimport key_nav from \"./key_nav\";\nimport layer from \"./layer\";\nimport legacy from \"./legacy\";\nimport limit from \"./limit\";\nimport map_view from \"./map_view\";\nimport minical from \"./minical\";\nimport monthheight from \"./monthheight\";\nimport multisection from \"./multisection\";\nimport multiselect from \"./multiselect\";\nimport multisource from \"./multisource\";\nimport mvc from \"./mvc\";\nimport outerdrag from \"./outerdrag\";\nimport pdf from \"./pdf\";\nimport quick_info from \"./quick_info\";\nimport readonly from \"./readonly\";\nimport recurring from \"./recurring\";\nimport recurring_legacy from \"./recurring_legacy\";\nimport serialize from \"./serialize\";\nimport timeline from \"./timeline\";\nimport tooltip from \"./tooltip\";\nimport treetimeline from \"./treetimeline\";\nimport units from \"./units\";\nimport url from \"./url\";\nimport week_agenda from \"./week_agenda\";\nimport wp from \"./wp\";\nimport year_view from \"./year_view\";\nimport export_api from \"./export_api\";\n\nexport default {\n\tactive_links,\n\tagenda_legacy,\n\tagenda_view,\n\tall_timed,\n\tcollision,\n\tcontainer_autoresize,\n\tcookie,\n\tdaytimeline,\n\tdrag_between,\n\teditors,\n\texpand,\n\texport_api,\n\tgrid_view,\n\thtml_templates,\n\tkey_nav,\n\tlayer,\n\tlegacy,\n\tlimit,\n\tmap_view,\n\tminical,\n\tmonthheight,\n\tmultisection,\n\tmultiselect,\n\tmultisource,\n\tmvc,\n\touterdrag,\n\tpdf,\n\tquick_info,\n\treadonly,\n\trecurring,\n\trecurring_legacy,\n\tserialize,\n\ttimeline,\n\ttooltip,\n\ttreetimeline,\n\tunits,\n\turl,\n\tweek_agenda,\n\twp,\n\tyear_view\n};","export default function(scheduler){\n\nscheduler.config.active_link_view = \"day\";\nscheduler._active_link_click = function(e){\n\tvar start = e.target;\n\tvar to = start.getAttribute(\"data-link-date\");\n\tvar s_d = scheduler.date.str_to_date(scheduler.config.api_date, false, true);\n\tif (to) {\n\t\tscheduler.setCurrentView(s_d(to), scheduler.config.active_link_view);\n\t\tif (e && e.preventDefault)\n\t\t\te.preventDefault();\n\t\treturn false;\n\t}\n};\nscheduler.attachEvent(\"onTemplatesReady\", function() {\n\tvar do_wrapper = function(key, fullname){\n\t\tfullname = fullname || (key+\"_scale_date\");\n\n\t\tif(!scheduler.templates['_active_links_old_'+ fullname]){\n\t\t\tscheduler.templates['_active_links_old_'+ fullname] = scheduler.templates[fullname];\n\t\t}\n\t\tvar week_x = scheduler.templates['_active_links_old_'+ fullname];\n\t\tvar d_s = scheduler.date.date_to_str(scheduler.config.api_date);\n\t\tscheduler.templates[fullname] = function(date) {\n\t\t\treturn \"\" + week_x(date) + \"\";\n\t\t};\n\t};\n\n\tdo_wrapper(\"week\");\n\tdo_wrapper(\"\", \"month_day\");\n\tif (this.matrix){\n\t\tfor (var key in this.matrix)\n\t\t\tdo_wrapper(key);\n\t}\n\n\tthis._detachDomEvent(this._obj, \"click\", scheduler._active_link_click);\n\tscheduler.event(this._obj, \"click\", scheduler._active_link_click);\n});\n\n}","export default function(scheduler){\n\nscheduler.date.add_agenda_legacy = function(date){\n\treturn scheduler.date.add(date, 1, \"year\");\n};\n\nscheduler.templates.agenda_legacy_time = function(start,end,ev){\n\tif (ev._timed)\n\t\treturn this.day_date(ev.start_date, ev.end_date, ev)+\" \"+this.event_date(start);\n\telse\n\t\treturn scheduler.templates.day_date(start)+\" – \"+scheduler.templates.day_date(end);\n};\nscheduler.templates.agenda_legacy_text = function(start,end,event){\n\treturn event.text;\n};\nscheduler.templates.agenda_legacy_date = function(){ return \"\"; };\n\nscheduler.date.agenda_legacy_start=function(){ return scheduler.date.date_part(scheduler._currentDate()); };\n\nscheduler.attachEvent(\"onTemplatesReady\",function() {\n\tvar old_dblclick_dhx_cal_data = scheduler.dblclick_dhx_cal_data;\n\tscheduler.dblclick_dhx_cal_data = function() {\n\t\tif (this._mode == \"agenda_legacy\") {\n\t\t\tif (!this.config.readonly && this.config.dblclick_create)\n\t\t\t\tthis.addEventNow();\n\t\t} else {\n\t\t\tif (old_dblclick_dhx_cal_data)\n\t\t\t\treturn old_dblclick_dhx_cal_data.apply(this, arguments);\n\t\t}\n\t};\n\n\n\tvar old = scheduler.render_data;\n\tscheduler.render_data=function(evs){\n\t\tif (this._mode == \"agenda_legacy\")\n\t\t\tfill_agenda_tab();\n\t\telse\n\t\t\treturn old.apply(this,arguments);\n\t};\n\n\tvar old_render_view_data = scheduler.render_view_data;\n\tscheduler.render_view_data = function(){\n\t\tif(this._mode == \"agenda_legacy\") {\n\t\t\tscheduler._agendaScrollTop = scheduler._els[\"dhx_cal_data\"][0].childNodes[0].scrollTop;\n\t\t\tscheduler._els[\"dhx_cal_data\"][0].childNodes[0].scrollTop = 0;\n\t\t}\n\t\treturn old_render_view_data.apply(this,arguments);\n\t};\n\n\n\n\tfunction set_full_view(mode){\n\t\tif (mode){\n\t\t\tvar l = scheduler.locale.labels;\n\n\t\t\tvar rowAttr = scheduler._waiAria.agendaHeadAttrString();\n\t\t\tvar dateHeader = scheduler._waiAria.agendaHeadDateString(l.date);\n\t\t\tvar descriptionHeader = scheduler._waiAria.agendaHeadDescriptionString(l.description);\n\n\t\t\tscheduler._els[\"dhx_cal_header\"][0].innerHTML=\"
\";\n\t\t\tscheduler._table_view=true;\n\t\t\tscheduler.set_sizes();\n\t\t}\n\t}\n\n\tfunction fill_agenda_tab(){\n\t\t//select events for which data need to be printed\n\n\t\tvar events = scheduler.get_visible_events();\n\t\tevents.sort(function(a,b){ return a.start_date>b.start_date?1:-1;});\n\n\t\tvar tableAttr = scheduler._waiAria.agendaDataAttrString();\n\t\tvar agendaEventAttrString;\n\t\t//generate html for the view\n\t\tvar html=\"