PageSourceSearch

https://curling.ru/extore/frontend/themes/kerling/js/calendar.js?v2

js curling.ru collected 2026-10-02 11:04:59 UTC 30,368 bytes, 712 lines download raw bytes

1/**
2 * color-calendar
3 * v1.0.7
4 * by Pawan Kolhe <[email protected]> (https://pawankolhe.com/)
5 */
6
7!(function (e, t) {
8  "object" == typeof exports && "undefined" != typeof module
9    ? (module.exports = t())
10    : "function" == typeof define && define.amd
11    ? define(t)
12    : ((e =
13        "undefined" != typeof globalThis ? globalThis : e || self).Calendar =
14        t());
15})(this, function () {
16  "use strict";
17  class e {
18    constructor(e = {}) {
19      var t, a, i, r, n, s, o, l, d, c, h, y, p;
20      if (
21        ((this.CAL_NAME = "color-calendar"),
22        (this.DAYS_TO_DISPLAY = 42),
23        (this.weekdayDisplayTypeOptions = {
24          short: ["S", "M", "T", "W", "T", "F", "S"],
25          "long-lower": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
26          "long-upper": ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"],
27        }),
28        (this.id = null !== (t = e.id) && void 0 !== t ? t : "#color-calendar"),
29        (this.calendarSize =
30          null !== (a = e.calendarSize) && void 0 !== a ? a : "large"),
31        (this.layoutModifiers =
32          null !== (i = e.layoutModifiers) && void 0 !== i ? i : []),
33        (this.eventsData =
34          null !== (r = e.eventsData) && void 0 !== r ? r : []),
35        (this.theme = null !== (n = e.theme) && void 0 !== n ? n : "basic"),
36        (this.primaryColor = e.primaryColor),
37        (this.headerColor = e.headerColor),
38        (this.headerBackgroundColor = e.headerBackgroundColor),
39        (this.weekdaysColor = e.weekdaysColor),
40        (this.weekdayDisplayType =
41          null !== (s = e.weekdayDisplayType) && void 0 !== s
42            ? s
43            : "long-lower"),
44        (this.monthDisplayType =
45          null !== (o = e.monthDisplayType) && void 0 !== o ? o : "long"),
46        (this.startWeekday =
47          null !== (l = e.startWeekday) && void 0 !== l ? l : 0),
48        (this.fontFamilyHeader = e.fontFamilyHeader),
49        (this.fontFamilyWeekdays = e.fontFamilyWeekdays),
50        (this.fontFamilyBody = e.fontFamilyBody),
51        (this.dropShadow = e.dropShadow),
52        (this.border = e.border),
53        (this.borderRadius = e.borderRadius),
54        (this.disableMonthYearPickers =
55          null !== (d = e.disableMonthYearPickers) && void 0 !== d && d),
56        (this.disableDayClick =
57          null !== (c = e.disableDayClick) && void 0 !== c && c),
58        (this.disableMonthArrowClick =
59          null !== (h = e.disableMonthArrowClick) && void 0 !== h && h),
60        (this.customMonthValues = e.customMonthValues),
61        (this.customWeekdayValues = e.customWeekdayValues),
62        (this.monthChanged = e.monthChanged),
63        (this.dateChanged = e.dateChanged),
64        (this.selectedDateClicked = e.selectedDateClicked),
65        this.customWeekdayValues && 7 === this.customWeekdayValues.length
66          ? (this.weekdays = this.customWeekdayValues)
67          : (this.weekdays =
68              null !==
69                (y = this.weekdayDisplayTypeOptions[this.weekdayDisplayType]) &&
70              void 0 !== y
71                ? y
72                : this.weekdayDisplayTypeOptions.short),
73        (this.today = new Date()),
74        (this.currentDate = new Date()),
75        (this.pickerType = "month"),
76        (this.eventDayMap = {}),
77        (this.oldSelectedNode = null),
78        (this.filteredEventsThisMonth = []),
79        (this.daysIn_PrevMonth = []),
80        (this.daysIn_CurrentMonth = []),
81        (this.daysIn_NextMonth = []),
82        (this.firstDay_PrevMonth = 0),
83        (this.firstDay_CurrentMonth = 0),
84        (this.firstDay_NextMonth = 0),
85        (this.numOfDays_PrevMonth = 0),
86        (this.numOfDays_CurrentMonth = 0),
87        (this.numOfDays_NextMonth = 0),
88        (this.yearPickerOffset = 0),
89        (this.yearPickerOffsetTemporary = 0),
90        (this.calendar = document.querySelector(this.id)),
91        !this.calendar)
92      )
93        throw new Error(
94          `[COLOR-CALENDAR] Element with selector '${this.id}' not found`
95        );
96      (this.calendar.innerHTML = `\n      <div class="${this.CAL_NAME} ${
97        this.theme
98      } color-calendar--${
99        this.calendarSize
100      }">\n        <div class="calendar__header">\n          <div class="calendar__arrow calendar__arrow-prev"><div class="calendar__arrow-inner"></div></div>\n          <div class="calendar__monthyear">
100\n            <span class="calendar__month"></span>&nbsp;\n            <span class="calendar__year"></span>\n          </div>\n          <div class="calendar__arrow calendar__arrow-next"><div class="calendar__arrow-inner"></div></div>\n        </div>\n        <div class="calendar__body">\n          <div class="calendar__weekdays"></div>\n          <div class="calendar__days"></div>\n          <div class="calendar__picker">\n            <div class="calendar__picker-month">\n              ${(null !==
101        (p = this.customMonthValues) && void 0 !== p
102        ? p
103        : [
104            "янв",
105            "фев",
106            "мар",
107            "апр",
108            "май",
109            "июн",
110            "июл",
111            "авг",
112            "сен",
113            "окт",
114            "ноя",
115            "дек",
116          ]
117      )
118        .map(
119          (e, t) =>
120            `<div class="calendar__picker-month-option" data-value="${t}">${e}</div>`
121        )
122        .join(
123          ""
124        )}\n            </div>\n            <div class="calendar__picker-year">\n              <div class="calendar__picker-year-option" data-value="0"></div>\n              <div class="calendar__picker-year-option" data-value="1"></div>\n              <div class="calendar__picker-year-option" data-value="2"></div>\n              <div class="calendar__picker-year-option" data-value="3"></div>\n              <div class="calendar__picker-year-option" data-value="4"></div>\n              <div class="calendar__picker-year-option" data-value="5"></div>\n              <div class="calendar__picker-year-option" data-value="6"></div>\n              <div class="calendar__picker-year-option" data-value="7"></div>\n              <div class="calendar__picker-year-option" data-value="8"></div>\n              <div class="calendar__picker-year-option" data-value="9"></div>\n              <div class="calendar__picker-year-option" data-value="10"></div>\n              <div class="calendar__picker-year-option" data-value="11"></div>\n              <div class="calendar__picker-year-arrow calendar__picker-year-arrow-left">\n                <div class="chevron-thin chevron-thin-left"></div>\n              </div>\n              <div class="calendar__picker-year-arrow calendar__picker-year-arrow-right">\n                <div class="chevron-thin chevron-thin-right"></div>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    `),
125        (this.calendarRoot = document.querySelector(
126          `${this.id} .${this.CAL_NAME}`
127        )),
128        (this.calendarHeader = document.querySelector(
129          this.id + " .calendar__header"
130        )),
131        (this.calendarWeekdays = document.querySelector(
132          this.id + " .calendar__weekdays"
133        )),
134        (this.calendarDays = document.querySelector(
135          this.id + " .calendar__days"
136        )),
137        (this.pickerContainer = document.querySelector(
138          this.id + " .calendar__picker"
139        )),
140        (this.pickerMonthContainer = document.querySelector(
141          this.id + " .calendar__picker-month"
142        )),
143        (this.pickerYearContainer = document.querySelector(
144          this.id + " .calendar__picker-year"
145        )),
146        (this.yearPickerChevronLeft = document.querySelector(
147          this.id + " .calendar__picker-year-arrow-left"
148        )),
149        (this.yearPickerChevronRight = document.querySelector(
150          this.id + " .calendar__picker-year-arrow-right"
151        )),
152        this.pickerMonthContainer.children[this.today.getMonth()].classList.add(
153          "calendar__picker-month-today"
154        ),
155        this.layoutModifiers.forEach((e) => {
156          this.calendarRoot.classList.add(e);
157        }),
158        this.layoutModifiers.includes("month-left-align") &&
159          (this.calendarHeader.innerHTML =
160            '\n        <div class="calendar__monthyear">\n          <span class="calendar__month"></span>&nbsp;\n          <span class="calendar__year"></span>\n        </div>\n        <div class="calendar__arrow calendar__arrow-prev"><div class="calendar__arrow-inner"></div></div>\n        <div class="calendar__arrow calendar__arrow-next"><div class="calendar__arrow-inner"></div></div>\n      '),
161        (this.monthyearDisplay = document.querySelector(
162          this.id + " .calendar__monthyear"
163        )),
164        (this.monthDisplay = document.querySelector(
165          this.id + " .calendar__month"
166        )),
167        (this.yearDisplay = document.querySelector(
168          this.id + " .calendar__year"
169        )),
170        (this.prevButton = document.querySelector(
171          this.id + " .calendar__arrow-prev .calendar__arrow-inner"
172        )),
173        (this.nextButton = document.querySelector(
174          this.id + " .calendar__arrow-next .calendar__arrow-inner"
175        )),
176        this.togglePicker(!1),
177        this.configureStylePreferences(),
178        this.addEventListeners(),
179        this.reset(new Date());
180    }
181    reset(e) {
182      (this.currentDate = e || new Date()),
183        this.clearCalendarDays(),
184        this.updateMonthYear(),
185        this.updateMonthPickerSelection(this.currentDate.getMonth()),
186        this.generatePickerYears(),
187        this.updateYearPickerSelection(this.currentDate.getFullYear(), 4),
188        this.updateYearPickerTodaySelection(),
189        this.generateWeekdays(),
190        this.generateDays(),
191        this.selectDayInitial(!!e),
192        this.renderDays(),
193        this.setOldSelectedNode(),
194        this.dateChanged &&
195          this.dateChanged(
196            this.currentDate,
197            this.getDateEvents(this.currentDate)
198          ),
199        this.monthChanged &&
200          this.monthChanged(this.currentDate, this.getMonthEvents());
201    }
202  }
203  return (
204    (e.prototype.addEventListeners = function () {
205      this.prevButton.addEventListener(
206        "click",
207        this.handlePrevMonthButtonClick.bind(this)
208      ),
209        this.nextButton.addEventListener(
210          "click",
211          this.handleNextMonthButtonClick.bind(this)
212        ),
213        this.monthyearDisplay.addEventListener(
214          "click",
215          this.handleMonthYearDisplayClick.bind(this)
216        ),
217        this.calendarDays.addEventListener(
218          "click",
219          this.handleCalendarDayClick.bind(this)
220        ),
221        this.pickerMonthContainer.addEventListener(
222          "click",
223          this.handleMonthPickerClick.bind(this)
224        ),
225        this.pickerYearContainer.addEventListener(
226          "click",
227          this.handleYearPickerClick.bind(this)
228        ),
229        this.yearPickerChevronLeft.addEventListener(
230          "click",
231          this.handleYearChevronLeftClick.bind(this)
232        ),
233        this.yearPickerChevronRight.addEventListener(
234          "click",
235          this.handleYearChevronRightClick.bind(this)
236        );
237    }),
238    (e.prototype.configureStylePreferences = function () {
239      let e = this.calendarRoot;
240      this.primaryColor &&
241        e.style.setProperty("--cal-color-primary", this.primaryColor),
242        this.fontFamilyHeader &&
243          e.style.setProperty(
244            "--cal-font-family-header",
245            this.fontFamilyHeader
246          ),
247        this.fontFamilyWeekdays &&
248          e.style.setProperty(
249            "--cal-font-family-weekdays",
250            this.fontFamilyWeekdays
251          ),
252        this.fontFamilyBody &&
253          e.style.setProperty("--cal-font-family-body", this.fontFamilyBody),
254        this.dropShadow &&
255          e.style.setProperty("--cal-drop-shadow", this.dropShadow),
256        this.border && e.style.setProperty("--cal-border", this.border),
257        this.borderRadius &&
258          e.style.setProperty("--cal-border-radius", this.borderRadius),
259        this.headerColor &&
260          e.style.setProperty("--cal-header-color", this.headerColor),
261        this.headerBackgroundColor &&
262          e.style.setProperty(
263            "--cal-header-background-color",
264            this.headerBackgroundColor
265          ),
266        this.weekdaysColor &&
267          e.style.setProperty("--cal-weekdays-color", this.weekdaysColor);
268    }),
269    (e.prototype.togglePicker = function (e) {
270      !0 === e
271        ? ((this.pickerContainer.style.visibility = "visible"),
272          (this.pickerContainer.style.opacity = "1"),
273          "year" === this.pickerType && this.generatePickerYears(),
274          this.removeYearPickerSelection(),
275          this.updateYearPickerSelection(this.currentDate.getFullYear()))
276        : !1 === e
277        ? ((this.pickerContainer.style.visibility = "hidden"),
278          (this.pickerContainer.style.opacity = "0"),
279          this.monthDisplay &&
280            this.yearDisplay &&
281            ((this.monthDisplay.style.opacity = "1"),
282            (this.yearDisplay.style.opacity = "1")),
283          (this.yearPickerOffsetTemporary = 0))
284        : "hidden" === this.pickerContainer.style.visibility
285        ? ((this.pickerContainer.style.visibility = "visible"),
286          (this.pickerContainer.style.opacity = "1"),
287          "year" === this.pickerType && this.generatePickerYears(),
288          this.removeYearPickerSelection(),
289          this.updateYearPickerSelection(this.currentDate.getFullYear()))
290        : ((this.pickerContainer.style.visibility = "hidden"),
291          (this.pickerContainer.style.opacity = "0"),
292          this.monthDisplay &&
293            this.yearDisplay &&
294            ((this.monthDisplay.style.opacity = "1"),
295            (this.yearDisplay.style.opacity = "1")),
296          (this.yearPickerOffsetTemporary = 0));
297    }),
298    (e.prototype.handleMonthPickerClick = function (e) {
299      if (!e.target.classList.contains("calendar__picker-month-option")) return;
300      const t = parseInt(e.target.dataset.value, 10);
301      this.updateMonthPickerSelection(t),
302        this.updateCurrentDate(0, void 0, t),
303        this.togglePicker(!1);
304    }),
305    (e.prototype.updateMonthPickerSelection = function (e) {
306      e < 0 ? (e = 11) : (e %= 12),
307        this.removeMonthPickerSelection(),
308        this.pickerMonthContainer.children[e].classList.add(
309          "calendar__picker-month-selected"
310        );
311    }),
312    (e.prototype.removeMonthPickerSelection = function () {
313      for (let e = 0; e < 12; e++)
314        this.pickerMonthContainer.children[e].classList.contains(
315          "calendar__picker-month-selected"
316        ) &&
317          this.pickerMonthContainer.children[e].classList.remove(
318            "calendar__picker-month-selected"
319          );
320    }),
321    (e.prototype.handleYearPickerClick = function (e) {
322      if (!e.target.classList.contains("calendar__picker-year-option")) return;
323      this.yearPickerOffset += this.yearPickerOffsetTemporary;
324      const t = parseInt(e.target.innerText),
325        a = parseInt(e.target.dataset.value);
326      this.updateYearPickerSelection(t, a),
327        this.updateCurrentDate(0, void 0, void 0, t),
328        this.togglePicker(!1);
329    }),
330    (e.prototype.updateYearPickerSelection = function (e, t) {
331      if (void 0 === t) {
332        for (let a = 0; a < 12; a++) {
333          let i = this.pickerYearContainer.children[a];
334          if (parseInt(i.innerHTML) === e && i.dataset.value) {
335            t = parseInt(i.dataset.value);
336            break;
337          }
338        }
339        if (void 0 === t) return;
340      }
341      this.removeYearPickerSelection(),
342        this.pickerYearContainer.children[t].classList.add(
343          "calendar__picker-year-selected"
344        );
345    }),
346    (e.prototype.updateYearPickerTodaySelection = function () {
347      parseInt(this.pickerYearContainer.children[4].innerHTML) ===
348      this.today.getFullYear()
349        ? this.pickerYearContainer.children[4].classList.add(
350            "calendar__picker-year-today"
351          )
352        : this.pickerYearContainer.children[4].classList.remove(
353            "calendar__picker-year-today"
354          );
355    }),
356    (e.prototype.removeYearPickerSelection = function () {
357      for (let e = 0; e < 12;
357 e++)
358        this.pickerYearContainer.children[e].classList.contains(
359          "calendar__picker-year-selected"
360        ) &&
361          this.pickerYearContainer.children[e].classList.remove(
362            "calendar__picker-year-selected"
363          );
364    }),
365    (e.prototype.generatePickerYears = function () {
366      const e =
367        this.today.getFullYear() +
368        this.yearPickerOffset +
369        this.yearPickerOffsetTemporary;
370      let t = 0;
371      for (let a = e - 4; a <= e + 7; a++) {
372        (this.pickerYearContainer.children[t].innerText = a.toString()), t++;
373      }
374      this.updateYearPickerTodaySelection();
375    }),
376    (e.prototype.handleYearChevronLeftClick = function () {
377      (this.yearPickerOffsetTemporary -= 12),
378        this.generatePickerYears(),
379        this.removeYearPickerSelection(),
380        this.updateYearPickerSelection(this.currentDate.getFullYear()),
381        this.updateYearPickerTodaySelection();
382    }),
383    (e.prototype.handleYearChevronRightClick = function () {
384      (this.yearPickerOffsetTemporary += 12),
385        this.generatePickerYears(),
386        this.removeYearPickerSelection(),
387        this.updateYearPickerSelection(this.currentDate.getFullYear()),
388        this.updateYearPickerTodaySelection();
389    }),
390    (e.prototype.setMonthDisplayType = function (e) {
391      (this.monthDisplayType = e), this.updateMonthYear();
392    }),
393    (e.prototype.handleMonthYearDisplayClick = function (e) {
394      if (
395        !e.target.classList.contains("calendar__month") &&
396        !e.target.classList.contains("calendar__year")
397      )
398        return;
399      if (this.disableMonthYearPickers) return;
400      const t = this.pickerType,
401        a = e.target.classList;
402      a.contains("calendar__month")
403        ? ((this.pickerType = "month"),
404          (this.monthDisplay.style.opacity = "1"),
405          (this.yearDisplay.style.opacity = "0.7"),
406          (this.pickerMonthContainer.style.display = "grid"),
407          (this.pickerYearContainer.style.display = "none"))
408        : a.contains("calendar__year") &&
409          ((this.pickerType = "year"),
410          (this.monthDisplay.style.opacity = "0.7"),
411          (this.yearDisplay.style.opacity = "1"),
412          (this.pickerMonthContainer.style.display = "none"),
413          (this.pickerYearContainer.style.display = "grid")),
414        t === this.pickerType ? this.togglePicker() : this.togglePicker(!0);
415    }),
416    (e.prototype.handlePrevMonthButtonClick = function () {
417      if (this.disableMonthArrowClick) return;
418      const e = this.currentDate.getMonth() - 1;
419      this.currentDate.getFullYear() <=
420        this.today.getFullYear() + this.yearPickerOffset - 4 &&
421        e < 0 &&
422        ((this.yearPickerOffset -= 12), this.generatePickerYears()),
423        e < 0 &&
424          this.updateYearPickerSelection(this.currentDate.getFullYear() - 1),
425        this.updateMonthPickerSelection(e),
426        this.updateCurrentDate(-1),
427        this.togglePicker(!1);
428    }),
429    (e.prototype.handleNextMonthButtonClick = function () {
430      if (this.disableMonthArrowClick) return;
431      const e = this.currentDate.getMonth() + 1;
432      this.currentDate.getFullYear() >=
433        this.today.getFullYear() + this.yearPickerOffset + 7 &&
434        e > 11 &&
435        ((this.yearPickerOffset += 12), this.generatePickerYears()),
436        e > 11 &&
437          this.updateYearPickerSelection(this.currentDate.getFullYear() + 1),
438        this.updateMonthPickerSelection(e),
439        this.updateCurrentDate(1),
440        this.togglePicker(!1);
441    }),
442    (e.prototype.updateMonthYear = function () {
443      (this.oldSelectedNode = null),
444        this.customMonthValues
445          ? (this.monthDisplay.innerHTML =
446              this.customMonthValues[this.currentDate.getMonth()])
447          : (this.monthDisplay.innerHTML = new Intl.DateTimeFormat("default", {
448              month: this.monthDisplayType,
449            }).format(this.currentDate)),
450        (this.yearDisplay.innerHTML = this.currentDate
451          .getFullYear()
452          .toString());
453    }),
454    (e.prototype.setWeekdayDisplayType = function (e) {
455      var t;
456      (this.weekdayDisplayType = e),
457        (this.weekdays =
458          null !==
459            (t = this.weekdayDisplayTypeOptions[this.weekdayDisplayType]) &&
460          void 0 !== t
461            ? t
462            : this.weekdayDisplayTypeOptions.short),
463        this.generateWeekdays();
464    }),
465    (e.prototype.generateWeekdays = function () {
466      let e = "";
467      for (let t = 0; t < 7; t++)
468        e += `\n      <div class="calendar__weekday">${
469          this.weekdays[(t + this.startWeekday) % 7]
470        }</div>\n    `;
471      this.calendarWeekdays.innerHTML = e;
472    }),
473    (e.prototype.setDate = function (e) {
474      e && (e instanceof Date ? this.reset(e) : this.reset(new Date(e)));
475    }),
476    (e.prototype.getSelectedDate = function () {
477      return this.currentDate;
478    }),
479    (e.prototype.clearCalendarDays = function () {
480      (this.daysIn_PrevMonth = []),
481        (this.daysIn_CurrentMonth = []),
482        (this.daysIn_NextMonth = []);
483    }),
484    (e.prototype.updateCalendar = function (e) {
485      e &&
486        (this.updateMonthYear(),
487        this.clearCalendarDays(),
488        this.generateDays(),
489        this.selectDayInitial()),
490        this.renderDays(),
491        e && this.setOldSelectedNode();
492    }),
493    (e.prototype.setOldSelectedNode = function () {
494      if (!this.oldSelectedNode) {
495        let e = void 0;
496        for (let t = 1; t < this.calendarDays.childNodes.length; t += 2) {
497          let a = this.calendarDays.childNodes[t];
498          if (
499            a.classList &&
500            a.classList.contains("calendar__day-active") &&
501            a.innerText === this.currentDate.getDate().toString()
502          ) {
503            e = a;
504            break;
505          }
506        }
507        e && (this.oldSelectedNode = [e, parseInt(e.innerText)]);
508      }
509    }),
510    (e.prototype.selectDayInitial = function (e) {
511      if (e)
512        this.daysIn_CurrentMonth[this.currentDate.getDate() - 1].selected = !0;
513      else {
514        let e = this.today.getMonth() === this.currentDate.getMonth(),
515          t = this.today.getDate() === this.currentDate.getDate();
516        e && t
517          ? (this.daysIn_CurrentMonth[this.today.getDate() - 1].selected = !0)
518          : (this.daysIn_CurrentMonth[0].selected = !0);
519      }
520    }),
521    (e.prototype.handleCalendarDayClick = function (e) {
522      if (
523        !(
524          e.target.classList.contains("calendar__day-box") ||
525          e.target.classList.contains("calendar__day-text") ||
526          e.target.classList.contains("calendar__day-box-today") ||
527          e.target.classList.contains("calendar__day-bullet")
528        )
529      )
530        return;
531      if (this.disableDayClick) return;
532      if (this.oldSelectedNode && !this.oldSelectedNode[0]) return;
533      if (e.target.parentElement.classList.contains("calendar__day-selected"))
534        return void (
535          this.selectedDateClicked &&
536          this.selectedDateClicked(
537            this.currentDate,
538            this.getDateEvents(this.currentDate)
539          )
540        );
541      let t, a;
542      (t = e.target.parentElement.innerText),
543        (a = parseInt(t, 10)),
544        this.removeOldDaySelection(),
545        t &&
546          (this.updateCurrentDate(0, a),
547          Object.assign(this.daysIn_CurrentMonth[a - 1], { selected: !0 }),
548          this.rerenderSelectedDay(e.target.parentElement, a, !0));
549    }),
550    (e.prototype.removeOldDaySelection = function () {
551      this.oldSelectedNode &&
552        (Object.assign(this.daysIn_CurrentMonth[this.oldSelectedNode[1] - 1], {
553          selected: !1,
554        }),
555        this.rerenderSelectedDay(
556          this.oldSelectedNode[0],
557          this.oldSelectedNode[1]
558        ));
559    }),
560    (e.prototype.updateCurrentDate = function (e, t, a, i) {
561      (this.currentDate = new Date(
562        i || this.currentDate.getFullYear(),
563        null != a ? a : this.currentDate.getMonth() + e,
564        0 === e && t ? t : 1
565      )),
566        (0 !== e || null != a || i) &&
567          (this.updateCalendar(!0),
568          this.monthChanged &&
569            this.monthChanged(this.currentDate, this.getMonthEvents())),
570        this.dateChanged &&
571          this.dateChanged(
572            this.currentDate,
573            this.getDateEvents(this.currentDate)
574          );
575    }),
576    (e.prototype.generateDays = function () {
577      (this.numOfDays_PrevMonth = new Date(
578        this.currentDate.getFullYear(),
579        this.currentDate.getMonth(),
580        0
581      ).getDate()),
582        (this.firstDay_CurrentMonth = new Date(
583          this.currentDate.getFullYear(),
584          this.currentDate.getMonth(),
585          1
586        ).getDay()),
587        (this.numOfDays_CurrentMonth = new Date(
588          this.currentDate.getFullYear(),
589          this.currentDate.getMonth() + 1,
590          0
591        ).getDate());
592      for (let e = 0; e < this.numOfDays_CurrentMonth; e++)
593        this.daysIn_CurrentMonth.push({ day: e + 1, selected: !1 });
594    }),
595    (e.prototype.renderDays = function () {
596      let e = 0;
597      const t = this.currentDate.getMonth(),
598        a = new Date(
599          this.currentDate.getFullYear(),
600          this.currentDate.getMonth(),
601          1
602        ),
603        i = new Date(
604          this.currentDate.getFullYear(),
605          this.currentDate.getMonth() + 1,
606          0,
607          23,
608          59,
609          59
610        );
611      let r;
612      (this.filteredEventsThisMonth = this.eventsData.filter((e) => {
613        const t = new Date(e.start),
614          r = new Date(e.end);
615        return (t > a && t < i) || (a > t && a < r);
616      })),
617        (this.eventDayMap = {}),
618        this.filteredEventsThisMonth.forEach((e) => {
619          let a = new Date(e.start),
620            i = new Date(e.end);
621          for (; a <= i; ) {
622            if (a.getMonth() === t) this.eventDayMap[a.getDate()] = !0;
623            else if (a.getMonth() > t) break;
624            a = new Date(a.getTime() + 864e5);
625          }
626        }),
627        (r =
628          this.firstDay_CurrentMonth < this.startWeekday
629            ? 7 + this.firstDay_CurrentMonth - this.startWeekday
630            : this.firstDay_CurrentMonth - this.startWeekday);
631      let n = "";
632      for (let t = 0; t < r; t++)
633        (n += `\n      <div class="calendar__day calendar__day-other">${
634          this.numOfDays_PrevMonth + 1 - r + t
635        }</div>\n    `),
636          e++;
637      let s = this.today.getFullYear() === this.currentDate.getFullYear(),
638        o = this.today.getMonth() === this.currentDate.getMonth() && s;
639      this.daysIn_CurrentMonth.forEach((t) => {
640        let a = o && t.day === this.today.getDate();
641        (n += `\n      <div class="calendar__day calendar__day-active${
642          a ? " calendar__day-today" : ""
643        }${
644          this.eventDayMap[t.day]
645            ? " calendar__day-event"
646            : " calendar__day-no-event"
647        }${
648          t.selected ? " calendar__day-selected" : ""
649        }">
649\n        <span class="calendar__day-text">${
650          t.day
651        }</span>\n        <div class="calendar__day-bullet"></div>\n        <div class="calendar__day-box"></div>\n      </div>\n    `),
652          e++;
653      });
654      for (let t = 0; t < this.DAYS_TO_DISPLAY - e; t++)
655        n += `\n      <div class="calendar__day calendar__day-other">${
656          t + 1
657        }</div>\n    `;
658      this.calendarDays.innerHTML = n;
659    }),
660    (e.prototype.rerenderSelectedDay = function (e, t, a) {
661      let i = e.previousElementSibling,
662        r = this.today.getFullYear() === this.currentDate.getFullYear(),
663        n =
664          this.today.getMonth() === this.currentDate.getMonth() &&
665          r &&
666          t === this.today.getDate(),
667        s = document.createElement("div");
668      (s.className += `calendar__day calendar__day-active${
669        n ? " calendar__day-today" : ""
670      }${
671        this.eventDayMap[t] ? " calendar__day-event" : " calendar__day-no-event"
672      }${
673        this.daysIn_CurrentMonth[t - 1].selected
674          ? " calendar__day-selected"
675          : ""
676      }`),
677        (s.innerHTML = `\n    <span class="calendar__day-text">${t}</span>\n    <div class="calendar__day-bullet"></div>\n    <div class="calendar__day-box"></div>\n  `),
678        i
679          ? i.parentElement
680            ? i.parentElement.insertBefore(s, i.nextSibling)
681            : console.log("Previous element does not have parent")
682          : this.calendarDays.insertBefore(s, e),
683        a && (this.oldSelectedNode = [s, t]),
684        e.remove();
685    }),
686    (e.prototype.getEventsData = function () {
687      return JSON.parse(JSON.stringify(this.eventsData));
688    }),
689    (e.prototype.setEventsData = function (e) {
690      return (
691        (this.eventsData = JSON.parse(JSON.stringify(e))),
692        this.setDate(this.currentDate),
693        this.eventsData.length
694      );
695    }),
696    (e.prototype.addEventsData = function (e = []) {
697      const t = this.eventsData.push(...e);
698      return this.setDate(this.currentDate), t;
699    }),
700    (e.prototype.getDateEvents = function (e) {
701      return this.filteredEventsThisMonth.filter((t) => {
702        const a = new Date(t.start).getDate(),
703          i = new Date(t.end).getDate();
704        return e.getDate() >= a && e.getDate() <= i;
705      });
706    }),
707    (e.prototype.getMonthEvents = function () {
708      return this.filteredEventsThisMonth;
709    }),
710    e
711  );
712});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.