!function(e,t){if("function"==typeof define&&define.amd)define(["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={};t(n),e.jsYearCalendar=n}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n=n.startDate&&a.classList.add("disabled");var i=document.createElement("span");if(i.innerHTML="‹",a.appendChild(i),t.appendChild(a),this._isFullYearMode()){var s=document.createElement("th");s.classList.add("year-title"),s.classList.add("year-neighbor2"),s.textContent=(this._startDate.getFullYear()-2).toString(),null!=this.options.minDate&&this.options.minDate>new Date(this._startDate.getFullYear()-2,11,31)&&s.classList.add("disabled"),t.appendChild(s);var o=document.createElement("th");o.classList.add("year-title"),o.classList.add("year-neighbor"),o.textContent=(this._startDate.getFullYear()-1).toString(),null!=this.options.minDate&&this.options.minDate>new Date(this._startDate.getFullYear()-1,11,31)&&o.classList.add("disabled"),t.appendChild(o)}var r=document.createElement("th");if(r.classList.add("year-title"),this._isFullYearMode()?r.textContent=this._startDate.getFullYear().toString():12==this.options.numberMonthsDisplayed?r.textContent="".concat(n.startDate.getFullYear()," - ").concat(n.endDate.getFullYear()):1l.options.minDate)&&(null==l.options.maxDate||n<=l.options.maxDate)){for(var r=[],i=0;i=a&&!(l._dataSource[i].endDate=l.options.minDate)&&(null==l.options.maxDate||t<=l.options.maxDate)){for(var i=0;i=t&&a.push(r[i]);0s._rangeStart?s._rangeEnd:s._rangeStart;s._triggerEvent("selectRange",{startDate:t,endDate:n,events:s.getEventsOnRange(t,new Date(n.getFullYear(),n.getMonth(),n.getDate()+1))})}}),this._responsiveInterval&&(clearInterval(this._responsiveInterval),this._responsiveInterval=null),this._responsiveInterval=setInterval(function(){if(null!=s.element.querySelector(".month")){var e=s.element.offsetWidth,t=s.element.querySelector(".month").offsetWidth+10;s._nbCols=null,6*tthis._rangeStart?this._rangeEnd:this._rangeStart;this.element.querySelectorAll(".month-container").forEach(function(e){var t=parseInt(e.dataset.monthId),n=new Date(i._startDate.getFullYear(),i._startDate.getMonth()+t,1),a=new Date(i._startDate.getFullYear(),i._startDate.getMonth()+t+1,1);s.getTime()=n.getTime()&&e.querySelectorAll("td.day:not(.old):not(.new)").forEach(function(e){var t=i._getDate(e);s<=t&&t<=o&&(e.classList.add("range"),t.getTime()==s.getTime()&&e.classList.add("range-start"),t.getTime()==o.getTime()&&e.classList.add("range-end"))})})}}},{key:"_getElementPosition",value:function(e){for(var t=0,n=0;t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;);return{top:t,left:n}}},{key:"_openContextMenu",value:function(e){var t=this,n=document.querySelector(".calendar-context-menu");if(null!==n)for(n.style.display="none";n.firstChild;)n.removeChild(n.firstChild);else(n=document.createElement("div")).classList.add("calendar-context-menu"),document.body.appendChild(n);for(var a=this._getDate(e),i=this.getEvents(a),s=0;sdocument.body.offsetWidth&&(n.style.left="",n.style.right="0"),setTimeout(function(){return t._checkContextMenuItemsPosition()},0);var c=function e(t){"click"===t.type&&n.contains(t.target)||(n.style.display="none",window.removeEventListener("click",e),window.removeEventListener("resize",e),window.removeEventListener("scroll",e))};window.addEventListener("click",c),window.addEventListener("resize",c),window.addEventListener("scroll",c)}}},{key:"_renderContextMenuItems",value:function(e,t,n){var a=document.createElement("div");a.classList.add("submenu");for(var i=0;idocument.body.offsetWidth?t.classList.add("open-left"):t.classList.remove("open-left")}),e.forEach(function(e){var t=e;t.style.display="",t.style.visibility=""})}},{key:"_getDate",value:function(e){var t=e.querySelector(".day-content").textContent,n=parseInt(e.closest(".month-container").dataset.monthId);return new Date(this._startDate.getFullYear(),this._startDate.getMonth()+n,t)}},{key:"_triggerEvent",value:function(e,t){var n=null;for(var a in"function"==typeof Event?n=new Event(e):(n=document.createEvent("Event")).initEvent(e,!1,!1),n.calendar=this,t)n[a]=t[a];return this.element.dispatchEvent(n),n}},{key:"_isDisabled",value:function(e){if(null!=this.options.minDate&&ethis.options.maxDate)return!0;if(0=e&&n.push(this._dataSource[a]);return n}},{key:"isThereFreeSlot",value:function(t){var n=this,e=1t}):!1===e?!a.some(function(e){return!n.options.alwaysHalfDay&&!e.startHalfDay||e.startDate