PluginProbe
WebTotem Security / 2.2.4
WebTotem Security v2.2.4
3.0.1 3.0.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.1 2.2.2 2.2.3 2.2.4 All 109 releases
wt-security / htdocs / js / flatpickr.js

flatpickr.js in WebTotem Security 2.2.4, at htdocs/js/flatpickr.js

2,786 lines 124.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* flatpickr v4.6.3,, @license MIT */
2 !(function (e, t) {
3 "object" == typeof exports && "undefined" != typeof module
4 ? (module.exports = t())
5 : "function" == typeof define && define.amd
6 ? define(t)
7 : ((e = e || self).flatpickr = t());
8 })(this, function () {
9 "use strict";
10 var e = function () {
11 return (e =
12 Object.assign ||
13 function (e) {
14 for (var t, n = 1, a = arguments.length; n < a; n++)
15 for (var i in (t = arguments[n]))
16 Object.prototype.hasOwnProperty.call(t, i) &&
17 (e[i] = t[i]);
18 return e;
19 }).apply(this, arguments);
20 },
21 t = [
22 "onChange",
23 "onClose",
24 "onDayCreate",
25 "onDestroy",
26 "onKeyDown",
27 "onMonthChange",
28 "onOpen",
29 "onParseConfig",
30 "onReady",
31 "onValueUpdate",
32 "onYearChange",
33 "onPreCalendarPosition",
34 ],
35 n = {
36 _disable: [],
37 _enable: [],
38 allowInput: !1,
39 altFormat: "F j, Y",
40 altInput: !1,
41 altInputClass: "form-control input",
42 animate:
43 "object" == typeof window &&
44 -1 === window.navigator.userAgent.indexOf("MSIE"),
45 ariaDateFormat: "F j, Y",
46 clickOpens: !0,
47 closeOnSelect: !0,
48 conjunction: ", ",
49 dateFormat: "Y-m-d",
50 defaultHour: 12,
51 defaultMinute: 0,
52 defaultSeconds: 0,
53 disable: [],
54 disableMobile: !1,
55 enable: [],
56 enableSeconds: !1,
57 enableTime: !1,
58 errorHandler: function (e) {
59 return "undefined" != typeof console && console.warn(e);
60 },
61 getWeek: function (e) {
62 var t = new Date(e.getTime());
63 t.setHours(0, 0, 0, 0),
64 t.setDate(t.getDate() + 3 - ((t.getDay() + 6) % 7));
65 var n = new Date(t.getFullYear(), 0, 4);
66 return (
67 1 +
68 Math.round(
69 ((t.getTime() - n.getTime()) / 864e5 -
70 3 +
71 ((n.getDay() + 6) % 7)) /
72 7
73 )
74 );
75 },
76 hourIncrement: 1,
77 ignoredFocusElements: [],
78 inline: !1,
79 locale: "default",
80 minuteIncrement: 5,
81 mode: "single",
82 monthSelectorType: "dropdown",
83 nextArrow:
84 "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",
85 noCalendar: !1,
86 now: new Date(),
87 onChange: [],
88 onClose: [],
89 onDayCreate: [],
90 onDestroy: [],
91 onKeyDown: [],
92 onMonthChange: [],
93 onOpen: [],
94 onParseConfig: [],
95 onReady: [],
96 onValueUpdate: [],
97 onYearChange: [],
98 onPreCalendarPosition: [],
99 plugins: [],
100 position: "auto",
101 positionElement: void 0,
102 prevArrow:
103 "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",
104 shorthandCurrentMonth: !1,
105 showMonths: 1,
106 static: !1,
107 time_24hr: !1,
108 weekNumbers: !1,
109 wrap: !1,
110 },
111 a = {
112 weekdays: {
113 shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
114 longhand: [
115 "Sunday",
116 "Monday",
117 "Tuesday",
118 "Wednesday",
119 "Thursday",
120 "Friday",
121 "Saturday",
122 ],
123 },
124 months: {
125 shorthand: [
126 "Jan",
127 "Feb",
128 "Mar",
129 "Apr",
130 "May",
131 "Jun",
132 "Jul",
133 "Aug",
134 "Sep",
135 "Oct",
136 "Nov",
137 "Dec",
138 ],
139 longhand: [
140 "January",
141 "February",
142 "March",
143 "April",
144 "May",
145 "June",
146 "July",
147 "August",
148 "September",
149 "October",
150 "November",
151 "December",
152 ],
153 },
154 daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
155 firstDayOfWeek: 0,
156 ordinal: function (e) {
157 var t = e % 100;
158 if (t > 3 && t < 21) return "th";
159 switch (t % 10) {
160 case 1:
161 return "st";
162 case 2:
163 return "nd";
164 case 3:
165 return "rd";
166 default:
167 return "th";
168 }
169 },
170 rangeSeparator: " to ",
171 weekAbbreviation: "Wk",
172 scrollTitle: "Scroll to increment",
173 toggleTitle: "Click to toggle",
174 amPM: ["AM", "PM"],
175 yearAriaLabel: "Year",
176 hourAriaLabel: "Hour",
177 minuteAriaLabel: "Minute",
178 time_24hr: !1,
179 },
180 i = function (e) {
181 return ("0" + e).slice(-2);
182 },
183 o = function (e) {
184 return !0 === e ? 1 : 0;
185 };
186 function r(e, t, n) {
187 var a;
188 return (
189 void 0 === n && (n = !1),
190 function () {
191 var i = this,
192 o = arguments;
193 null !== a && clearTimeout(a),
194 (a = window.setTimeout(function () {
195 (a = null), n || e.apply(i, o);
196 }, t)),
197 n && !a && e.apply(i, o);
198 }
199 );
200 }
201 var l = function (e) {
202 return e instanceof Array ? e : [e];
203 };
204 function c(e, t, n) {
205 if (!0 === n) return e.classList.add(t);
206 e.classList.remove(t);
207 }
208 function d(e, t, n) {
209 var a = window.document.createElement(e);
210 return (
211 (t = t || ""),
212 (n = n || ""),
213 (a.className = t),
214 void 0 !== n && (a.textContent = n),
215 a
216 );
217 }
218 function s(e) {
219 for (; e.firstChild; ) e.removeChild(e.firstChild);
220 }
221 function u(e, t) {
222 var n = d("div", "numInputWrapper"),
223 a = d("input", "numInput " + e),
224 i = d("span", "arrowUp"),
225 o = d("span", "arrowDown");
226 if (
227 (-1 === navigator.userAgent.indexOf("MSIE 9.0")
228 ? (a.type = "number")
229 : ((a.type = "text"), (a.pattern = "\\d*")),
230 void 0 !== t)
231 )
232 for (var r in t) a.setAttribute(r, t[r]);
233 return n.appendChild(a), n.appendChild(i), n.appendChild(o), n;
234 }
235 var f = function () {},
236 m = function (e, t, n) {
237 return n.months[t ? "shorthand" : "longhand"][e];
238 },
239 g = {
240 D: f,
241 F: function (e, t, n) {
242 e.setMonth(n.months.longhand.indexOf(t));
243 },
244 G: function (e, t) {
245 e.setHours(parseFloat(t));
246 },
247 H: function (e, t) {
248 e.setHours(parseFloat(t));
249 },
250 J: function (e, t) {
251 e.setDate(parseFloat(t));
252 },
253 K: function (e, t, n) {
254 e.setHours(
255 (e.getHours() % 12) +
256 12 * o(new RegExp(n.amPM[1], "i").test(t))
257 );
258 },
259 M: function (e, t, n) {
260 e.setMonth(n.months.shorthand.indexOf(t));
261 },
262 S: function (e, t) {
263 e.setSeconds(parseFloat(t));
264 },
265 U: function (e, t) {
266 return new Date(1e3 * parseFloat(t));
267 },
268 W: function (e, t, n) {
269 var a = parseInt(t),
270 i = new Date(
271 e.getFullYear(),
272 0,
273 2 + 7 * (a - 1),
274 0,
275 0,
276 0,
277 0
278 );
279 return (
280 i.setDate(i.getDate() - i.getDay() + n.firstDayOfWeek), i
281 );
282 },
283 Y: function (e, t) {
284 e.setFullYear(parseFloat(t));
285 },
286 Z: function (e, t) {
287 return new Date(t);
288 },
289 d: function (e, t) {
290 e.setDate(parseFloat(t));
291 },
292 h: function (e, t) {
293 e.setHours(parseFloat(t));
294 },
295 i: function (e, t) {
296 e.setMinutes(parseFloat(t));
297 },
298 j: function (e, t) {
299 e.setDate(parseFloat(t));
300 },
301 l: f,
302 m: function (e, t) {
303 e.setMonth(parseFloat(t) - 1);
304 },
305 n: function (e, t) {
306 e.setMonth(parseFloat(t) - 1);
307 },
308 s: function (e, t) {
309 e.setSeconds(parseFloat(t));
310 },
311 u: function (e, t) {
312 return new Date(parseFloat(t));
313 },
314 w: f,
315 y: function (e, t) {
316 e.setFullYear(2e3 + parseFloat(t));
317 },
318 },
319 p = {
320 D: "(\\w+)",
321 F: "(\\w+)",
322 G: "(\\d\\d|\\d)",
323 H: "(\\d\\d|\\d)",
324 J: "(\\d\\d|\\d)\\w+",
325 K: "",
326 M: "(\\w+)",
327 S: "(\\d\\d|\\d)",
328 U: "(.+)",
329 W: "(\\d\\d|\\d)",
330 Y: "(\\d{4})",
331 Z: "(.+)",
332 d: "(\\d\\d|\\d)",
333 h: "(\\d\\d|\\d)",
334 i: "(\\d\\d|\\d)",
335 j: "(\\d\\d|\\d)",
336 l: "(\\w+)",
337 m: "(\\d\\d|\\d)",
338 n: "(\\d\\d|\\d)",
339 s: "(\\d\\d|\\d)",
340 u: "(.+)",
341 w: "(\\d\\d|\\d)",
342 y: "(\\d{2})",
343 },
344 h = {
345 Z: function (e) {
346 return e.toISOString();
347 },
348 D: function (e, t, n) {
349 return t.weekdays.shorthand[h.w(e, t, n)];
350 },
351 F: function (e, t, n) {
352 return m(h.n(e, t, n) - 1, !1, t);
353 },
354 G: function (e, t, n) {
355 return i(h.h(e, t, n));
356 },
357 H: function (e) {
358 return i(e.getHours());
359 },
360 J: function (e, t) {
361 return void 0 !== t.ordinal
362 ? e.getDate() + t.ordinal(e.getDate())
363 : e.getDate();
364 },
365 K: function (e, t) {
366 return t.amPM[o(e.getHours() > 11)];
367 },
368 M: function (e, t) {
369 return m(e.getMonth(), !0, t);
370 },
371 S: function (e) {
372 return i(e.getSeconds());
373 },
374 U: function (e) {
375 return e.getTime() / 1e3;
376 },
377 W: function (e, t, n) {
378 return n.getWeek(e);
379 },
380 Y: function (e) {
381 return e.getFullYear();
382 },
383 d: function (e) {
384 return i(e.getDate());
385 },
386 h: function (e) {
387 return e.getHours() % 12 ? e.getHours() % 12 : 12;
388 },
389 i: function (e) {
390 return i(e.getMinutes());
391 },
392 j: function (e) {
393 return e.getDate();
394 },
395 l: function (e, t) {
396 return t.weekdays.longhand[e.getDay()];
397 },
398 m: function (e) {
399 return i(e.getMonth() + 1);
400 },
401 n: function (e) {
402 return e.getMonth() + 1;
403 },
404 s: function (e) {
405 return e.getSeconds();
406 },
407 u: function (e) {
408 return e.getTime();
409 },
410 w: function (e) {
411 return e.getDay();
412 },
413 y: function (e) {
414 return String(e.getFullYear()).substring(2);
415 },
416 },
417 v = function (e) {
418 var t = e.config,
419 i = void 0 === t ? n : t,
420 o = e.l10n,
421 r = void 0 === o ? a : o;
422 return function (e, t, n) {
423 var a = n || r;
424 return void 0 !== i.formatDate
425 ? i.formatDate(e, t, a)
426 : t
427 .split("")
428 .map(function (t, n, o) {
429 return h[t] && "\\" !== o[n - 1]
430 ? h[t](e, a, i)
431 : "\\" !== t
432 ? t
433 : "";
434 })
435 .join("");
436 };
437 },
438 D = function (e) {
439 var t = e.config,
440 i = void 0 === t ? n : t,
441 o = e.l10n,
442 r = void 0 === o ? a : o;
443 return function (e, t, a, o) {
444 if (0 === e || e) {
445 var l,
446 c = o || r,
447 d = e;
448 if (e instanceof Date) l = new Date(e.getTime());
449 else if ("string" != typeof e && void 0 !== e.toFixed)
450 l = new Date(e);
451 else if ("string" == typeof e) {
452 var s = t || (i || n).dateFormat,
453 u = String(e).trim();
454 if ("today" === u) (l = new Date()), (a = !0);
455 else if (/Z$/.test(u) || /GMT$/.test(u))
456 l = new Date(e);
457 else if (i && i.parseDate) l = i.parseDate(e, s);
458 else {
459 l =
460 i && i.noCalendar
461 ? new Date(new Date().setHours(0, 0, 0, 0))
462 : new Date(
463 new Date().getFullYear(),
464 0,
465 1,
466 0,
467 0,
468 0,
469 0
470 );
471 for (
472 var f = void 0, m = [], h = 0, v = 0, D = "";
473 h < s.length;
474 h++
475 ) {
476 var w = s[h],
477 b = "\\" === w,
478 C = "\\" === s[h - 1] || b;
479 if (p[w] && !C) {
480 D += p[w];
481 var M = new RegExp(D).exec(e);
482 M &&
483 (f = !0) &&
484 m["Y" !== w ? "push" : "unshift"]({
485 fn: g[w],
486 val: M[++v],
487 });
488 } else b || (D += ".");
489 m.forEach(function (e) {
490 var t = e.fn,
491 n = e.val;
492 return (l = t(l, n, c) || l);
493 });
494 }
495 l = f ? l : void 0;
496 }
497 }
498 if (l instanceof Date && !isNaN(l.getTime()))
499 return !0 === a && l.setHours(0, 0, 0, 0), l;
500 i.errorHandler(new Error("Invalid date provided: " + d));
501 }
502 };
503 };
504 function w(e, t, n) {
505 return (
506 void 0 === n && (n = !0),
507 !1 !== n
508 ? new Date(e.getTime()).setHours(0, 0, 0, 0) -
509 new Date(t.getTime()).setHours(0, 0, 0, 0)
510 : e.getTime() - t.getTime()
511 );
512 }
513 var b = function (e, t, n) {
514 return e > Math.min(t, n) && e < Math.max(t, n);
515 },
516 C = { DAY: 864e5 };
517 "function" != typeof Object.assign &&
518 (Object.assign = function (e) {
519 for (var t = [], n = 1; n < arguments.length; n++)
520 t[n - 1] = arguments[n];
521 if (!e)
522 throw TypeError("Cannot convert undefined or null to object");
523 for (
524 var a = function (t) {
525 t &&
526 Object.keys(t).forEach(function (n) {
527 return (e[n] = t[n]);
528 });
529 },
530 i = 0,
531 o = t;
532 i < o.length;
533 i++
534 ) {
535 a(o[i]);
536 }
537 return e;
538 });
539 var M = 300;
540 function y(f, g) {
541 var h = { config: e({}, n, E.defaultConfig), l10n: a };
542 function y(e) {
543 return e.bind(h);
544 }
545 function x() {
546 var e = h.config;
547 (!1 === e.weekNumbers && 1 === e.showMonths) ||
548 (!0 !== e.noCalendar &&
549 window.requestAnimationFrame(function () {
550 if (
551 (void 0 !== h.calendarContainer &&
552 ((h.calendarContainer.style.visibility =
553 "hidden"),
554 (h.calendarContainer.style.display = "block")),
555 void 0 !== h.daysContainer)
556 ) {
557 var t = (h.days.offsetWidth + 1) * e.showMonths;
558 (h.daysContainer.style.width = t + "px"),
559 (h.calendarContainer.style.width =
560 t +
561 (void 0 !== h.weekWrapper
562 ? h.weekWrapper.offsetWidth
563 : 0) +
564 "px"),
565 h.calendarContainer.style.removeProperty(
566 "visibility"
567 ),
568 h.calendarContainer.style.removeProperty(
569 "display"
570 );
571 }
572 }));
573 }
574 function T(e) {
575 0 === h.selectedDates.length && ie(),
576 void 0 !== e &&
577 "blur" !== e.type &&
578 (function (e) {
579 e.preventDefault();
580 var t = "keydown" === e.type,
581 n = e.target;
582 void 0 !== h.amPM &&
583 e.target === h.amPM &&
584 (h.amPM.textContent =
585 h.l10n.amPM[
586 o(h.amPM.textContent === h.l10n.amPM[0])
587 ]);
588 var a = parseFloat(n.getAttribute("min")),
589 r = parseFloat(n.getAttribute("max")),
590 l = parseFloat(n.getAttribute("step")),
591 c = parseInt(n.value, 10),
592 d = e.delta || (t ? (38 === e.which ? 1 : -1) : 0),
593 s = c + l * d;
594 if (void 0 !== n.value && 2 === n.value.length) {
595 var u = n === h.hourElement,
596 f = n === h.minuteElement;
597 s < a
598 ? ((s = r + s + o(!u) + (o(u) && o(!h.amPM))),
599 f && j(void 0, -1, h.hourElement))
600 : s > r &&
601 ((s =
602 n === h.hourElement
603 ? s - r - o(!h.amPM)
604 : a),
605 f && j(void 0, 1, h.hourElement)),
606 h.amPM &&
607 u &&
608 (1 === l
609 ? s + c === 23
610 : Math.abs(s - c) > l) &&
611 (h.amPM.textContent =
612 h.l10n.amPM[
613 o(
614 h.amPM.textContent ===
615 h.l10n.amPM[0]
616 )
617 ]),
618 (n.value = i(s));
619 }
620 })(e);
621 var t = h._input.value;
622 k(), we(), h._input.value !== t && h._debouncedChange();
623 }
624 function k() {
625 if (void 0 !== h.hourElement && void 0 !== h.minuteElement) {
626 var e,
627 t,
628 n = (parseInt(h.hourElement.value.slice(-2), 10) || 0) % 24,
629 a = (parseInt(h.minuteElement.value, 10) || 0) % 60,
630 i =
631 void 0 !== h.secondElement
632 ? (parseInt(h.secondElement.value, 10) || 0) % 60
633 : 0;
634 void 0 !== h.amPM &&
635 ((e = n),
636 (t = h.amPM.textContent),
637 (n = (e % 12) + 12 * o(t === h.l10n.amPM[1])));
638 var r =
639 void 0 !== h.config.minTime ||
640 (h.config.minDate &&
641 h.minDateHasTime &&
642 h.latestSelectedDateObj &&
643 0 === w(h.latestSelectedDateObj, h.config.minDate, !0));
644 if (
645 void 0 !== h.config.maxTime ||
646 (h.config.maxDate &&
647 h.maxDateHasTime &&
648 h.latestSelectedDateObj &&
649 0 === w(h.latestSelectedDateObj, h.config.maxDate, !0))
650 ) {
651 var l =
652 void 0 !== h.config.maxTime
653 ? h.config.maxTime
654 : h.config.maxDate;
655 (n = Math.min(n, l.getHours())) === l.getHours() &&
656 (a = Math.min(a, l.getMinutes())),
657 a === l.getMinutes() &&
658 (i = Math.min(i, l.getSeconds()));
659 }
660 if (r) {
661 var c =
662 void 0 !== h.config.minTime
663 ? h.config.minTime
664 : h.config.minDate;
665 (n = Math.max(n, c.getHours())) === c.getHours() &&
666 (a = Math.max(a, c.getMinutes())),
667 a === c.getMinutes() &&
668 (i = Math.max(i, c.getSeconds()));
669 }
670 O(n, a, i);
671 }
672 }
673 function I(e) {
674 var t = e || h.latestSelectedDateObj;
675 t && O(t.getHours(), t.getMinutes(), t.getSeconds());
676 }
677 function S() {
678 var e = h.config.defaultHour,
679 t = h.config.defaultMinute,
680 n = h.config.defaultSeconds;
681 if (void 0 !== h.config.minDate) {
682 var a = h.config.minDate.getHours(),
683 i = h.config.minDate.getMinutes();
684 (e = Math.max(e, a)) === a && (t = Math.max(i, t)),
685 e === a && t === i && (n = h.config.minDate.getSeconds());
686 }
687 if (void 0 !== h.config.maxDate) {
688 var o = h.config.maxDate.getHours(),
689 r = h.config.maxDate.getMinutes();
690 (e = Math.min(e, o)) === o && (t = Math.min(r, t)),
691 e === o && t === r && (n = h.config.maxDate.getSeconds());
692 }
693 O(e, t, n);
694 }
695 function O(e, t, n) {
696 void 0 !== h.latestSelectedDateObj &&
697 h.latestSelectedDateObj.setHours(e % 24, t, n || 0, 0),
698 h.hourElement &&
699 h.minuteElement &&
700 !h.isMobile &&
701 ((h.hourElement.value = i(
702 h.config.time_24hr
703 ? e
704 : ((12 + e) % 12) + 12 * o(e % 12 == 0)
705 )),
706 (h.minuteElement.value = i(t)),
707 void 0 !== h.amPM &&
708 (h.amPM.textContent = h.l10n.amPM[o(e >= 12)]),
709 void 0 !== h.secondElement &&
710 (h.secondElement.value = i(n)));
711 }
712 function _(e) {
713 var t = parseInt(e.target.value) + (e.delta || 0);
714 (t / 1e3 > 1 ||
715 ("Enter" === e.key && !/[^\d]/.test(t.toString()))) &&
716 Q(t);
717 }
718 function F(e, t, n, a) {
719 return t instanceof Array
720 ? t.forEach(function (t) {
721 return F(e, t, n, a);
722 })
723 : e instanceof Array
724 ? e.forEach(function (e) {
725 return F(e, t, n, a);
726 })
727 : (e.addEventListener(t, n, a),
728 void h._handlers.push({
729 element: e,
730 event: t,
731 handler: n,
732 options: a,
733 }));
734 }
735 function N(e) {
736 return function (t) {
737 1 === t.which && e(t);
738 };
739 }
740 function Y() {
741 ge("onChange");
742 }
743 function A(e, t) {
744 var n =
745 void 0 !== e
746 ? h.parseDate(e)
747 : h.latestSelectedDateObj ||
748 (h.config.minDate && h.config.minDate > h.now
749 ? h.config.minDate
750 : h.config.maxDate && h.config.maxDate < h.now
751 ? h.config.maxDate
752 : h.now),
753 a = h.currentYear,
754 i = h.currentMonth;
755 try {
756 void 0 !== n &&
757 ((h.currentYear = n.getFullYear()),
758 (h.currentMonth = n.getMonth()));
759 } catch (e) {
760 (e.message = "Invalid date supplied: " + n),
761 h.config.errorHandler(e);
762 }
763 t && h.currentYear !== a && (ge("onYearChange"), K()),
764 !t ||
765 (h.currentYear === a && h.currentMonth === i) ||
766 ge("onMonthChange"),
767 h.redraw();
768 }
769 function P(e) {
770 ~e.target.className.indexOf("arrow") &&
771 j(e, e.target.classList.contains("arrowUp") ? 1 : -1);
772 }
773 function j(e, t, n) {
774 var a = e && e.target,
775 i = n || (a && a.parentNode && a.parentNode.firstChild),
776 o = pe("increment");
777 (o.delta = t), i && i.dispatchEvent(o);
778 }
779 function H(e, t, n, a) {
780 var i = X(t, !0),
781 o = d("span", "flatpickr-day " + e, t.getDate().toString());
782 return (
783 (o.dateObj = t),
784 (o.$i = a),
785 o.setAttribute(
786 "aria-label",
787 h.formatDate(t, h.config.ariaDateFormat)
788 ),
789 -1 === e.indexOf("hidden") &&
790 0 === w(t, h.now) &&
791 ((h.todayDateElem = o),
792 o.classList.add("today"),
793 o.setAttribute("aria-current", "date")),
794 i
795 ? ((o.tabIndex = -1),
796 he(t) &&
797 (o.classList.add("selected"),
798 (h.selectedDateElem = o),
799 "range" === h.config.mode &&
800 (c(
801 o,
802 "startRange",
803 h.selectedDates[0] &&
804 0 === w(t, h.selectedDates[0], !0)
805 ),
806 c(
807 o,
808 "endRange",
809 h.selectedDates[1] &&
810 0 === w(t, h.selectedDates[1], !0)
811 ),
812 "nextMonthDay" === e &&
813 o.classList.add("inRange"))))
814 : o.classList.add("flatpickr-disabled"),
815 "range" === h.config.mode &&
816 (function (e) {
817 return (
818 !(
819 "range" !== h.config.mode ||
820 h.selectedDates.length < 2
821 ) &&
822 w(e, h.selectedDates[0]) >= 0 &&
823 w(e, h.selectedDates[1]) <= 0
824 );
825 })(t) &&
826 !he(t) &&
827 o.classList.add("inRange"),
828 h.weekNumbers &&
829 1 === h.config.showMonths &&
830 "prevMonthDay" !== e &&
831 n % 7 == 1 &&
832 h.weekNumbers.insertAdjacentHTML(
833 "beforeend",
834 "<span class='flatpickr-day'>" +
835 h.config.getWeek(t) +
836 "</span>"
837 ),
838 ge("onDayCreate", o),
839 o
840 );
841 }
842 function L(e) {
843 e.focus(), "range" === h.config.mode && ne(e);
844 }
845 function W(e) {
846 for (
847 var t = e > 0 ? 0 : h.config.showMonths - 1,
848 n = e > 0 ? h.config.showMonths : -1,
849 a = t;
850 a != n;
851 a += e
852 )
853 for (
854 var i = h.daysContainer.children[a],
855 o = e > 0 ? 0 : i.children.length - 1,
856 r = e > 0 ? i.children.length : -1,
857 l = o;
858 l != r;
859 l += e
860 ) {
861 var c = i.children[l];
862 if (-1 === c.className.indexOf("hidden") && X(c.dateObj))
863 return c;
864 }
865 }
866 function R(e, t) {
867 var n = ee(document.activeElement || document.body),
868 a =
869 void 0 !== e
870 ? e
871 : n
872 ? document.activeElement
873 : void 0 !== h.selectedDateElem &&
874 ee(h.selectedDateElem)
875 ? h.selectedDateElem
876 : void 0 !== h.todayDateElem && ee(h.todayDateElem)
877 ? h.todayDateElem
878 : W(t > 0 ? 1 : -1);
879 return void 0 === a
880 ? h._input.focus()
881 : n
882 ? void (function (e, t) {
883 for (
884 var n =
885 -1 === e.className.indexOf("Month")
886 ? e.dateObj.getMonth()
887 : h.currentMonth,
888 a = t > 0 ? h.config.showMonths : -1,
889 i = t > 0 ? 1 : -1,
890 o = n - h.currentMonth;
891 o != a;
892 o += i
893 )
894 for (
895 var r = h.daysContainer.children[o],
896 l =
897 n - h.currentMonth === o
898 ? e.$i + t
899 : t < 0
900 ? r.children.length - 1
901 : 0,
902 c = r.children.length,
903 d = l;
904 d >= 0 && d < c && d != (t > 0 ? c : -1);
905 d += i
906 ) {
907 var s = r.children[d];
908 if (
909 -1 === s.className.indexOf("hidden") &&
910 X(s.dateObj) &&
911 Math.abs(e.$i - d) >= Math.abs(t)
912 )
913 return L(s);
914 }
915 h.changeMonth(i), R(W(i), 0);
916 })(a, t)
917 : L(a);
918 }
919 function B(e, t) {
920 for (
921 var n =
922 (new Date(e, t, 1).getDay() -
923 h.l10n.firstDayOfWeek +
924 7) %
925 7,
926 a = h.utils.getDaysInMonth((t - 1 + 12) % 12),
927 i = h.utils.getDaysInMonth(t),
928 o = window.document.createDocumentFragment(),
929 r = h.config.showMonths > 1,
930 l = r ? "prevMonthDay hidden" : "prevMonthDay",
931 c = r ? "nextMonthDay hidden" : "nextMonthDay",
932 s = a + 1 - n,
933 u = 0;
934 s <= a;
935 s++, u++
936 )
937 o.appendChild(H(l, new Date(e, t - 1, s), s, u));
938 for (s = 1; s <= i; s++, u++)
939 o.appendChild(H("", new Date(e, t, s), s, u));
940 for (
941 var f = i + 1;
942 f <= 42 - n && (1 === h.config.showMonths || u % 7 != 0);
943 f++, u++
944 )
945 o.appendChild(H(c, new Date(e, t + 1, f % i), f, u));
946 var m = d("div", "dayContainer");
947 return m.appendChild(o), m;
948 }
949 function J() {
950 if (void 0 !== h.daysContainer) {
951 s(h.daysContainer), h.weekNumbers && s(h.weekNumbers);
952 for (
953 var e = document.createDocumentFragment(), t = 0;
954 t < h.config.showMonths;
955 t++
956 ) {
957 var n = new Date(h.currentYear, h.currentMonth, 1);
958 n.setMonth(h.currentMonth + t),
959 e.appendChild(B(n.getFullYear(), n.getMonth()));
960 }
961 h.daysContainer.appendChild(e),
962 (h.days = h.daysContainer.firstChild),
963 "range" === h.config.mode &&
964 1 === h.selectedDates.length &&
965 ne();
966 }
967 }
968 function K() {
969 if (
970 !(
971 h.config.showMonths > 1 ||
972 "dropdown" !== h.config.monthSelectorType
973 )
974 ) {
975 var e = function (e) {
976 return (
977 !(
978 void 0 !== h.config.minDate &&
979 h.currentYear === h.config.minDate.getFullYear() &&
980 e < h.config.minDate.getMonth()
981 ) &&
982 !(
983 void 0 !== h.config.maxDate &&
984 h.currentYear === h.config.maxDate.getFullYear() &&
985 e > h.config.maxDate.getMonth()
986 )
987 );
988 };
989 (h.monthsDropdownContainer.tabIndex = -1),
990 (h.monthsDropdownContainer.innerHTML = "");
991 for (var t = 0; t < 12; t++)
992 if (e(t)) {
993 var n = d("option", "flatpickr-monthDropdown-month");
994 (n.value = new Date(h.currentYear, t)
995 .getMonth()
996 .toString()),
997 (n.textContent = m(
998 t,
999 h.config.shorthandCurrentMonth,
1000 h.l10n
1001 )),
1002 (n.tabIndex = -1),
1003 h.currentMonth === t && (n.selected = !0),
1004 h.monthsDropdownContainer.appendChild(n);
1005 }
1006 }
1007 }
1008 function U() {
1009 var e,
1010 t = d("div", "flatpickr-month"),
1011 n = window.document.createDocumentFragment();
1012 h.config.showMonths > 1 || "static" === h.config.monthSelectorType
1013 ? (e = d("span", "cur-month"))
1014 : ((h.monthsDropdownContainer = d(
1015 "select",
1016 "flatpickr-monthDropdown-months"
1017 )),
1018 F(h.monthsDropdownContainer, "change", function (e) {
1019 var t = e.target,
1020 n = parseInt(t.value, 10);
1021 h.changeMonth(n - h.currentMonth), ge("onMonthChange");
1022 }),
1023 K(),
1024 (e = h.monthsDropdownContainer));
1025 var a = u("cur-year", { tabindex: "-1" }),
1026 i = a.getElementsByTagName("input")[0];
1027 i.setAttribute("aria-label", h.l10n.yearAriaLabel),
1028 h.config.minDate &&
1029 i.setAttribute(
1030 "min",
1031 h.config.minDate.getFullYear().toString()
1032 ),
1033 h.config.maxDate &&
1034 (i.setAttribute(
1035 "max",
1036 h.config.maxDate.getFullYear().toString()
1037 ),
1038 (i.disabled =
1039 !!h.config.minDate &&
1040 h.config.minDate.getFullYear() ===
1041 h.config.maxDate.getFullYear()));
1042 var o = d("div", "flatpickr-current-month");
1043 return (
1044 o.appendChild(e),
1045 o.appendChild(a),
1046 n.appendChild(o),
1047 t.appendChild(n),
1048 { container: t, yearElement: i, monthElement: e }
1049 );
1050 }
1051 function q() {
1052 s(h.monthNav),
1053 h.monthNav.appendChild(h.prevMonthNav),
1054 h.config.showMonths &&
1055 ((h.yearElements = []), (h.monthElements = []));
1056 for (var e = h.config.showMonths; e--; ) {
1057 var t = U();
1058 h.yearElements.push(t.yearElement),
1059 h.monthElements.push(t.monthElement),
1060 h.monthNav.appendChild(t.container);
1061 }
1062 h.monthNav.appendChild(h.nextMonthNav);
1063 }
1064 function $() {
1065 h.weekdayContainer
1066 ? s(h.weekdayContainer)
1067 : (h.weekdayContainer = d("div", "flatpickr-weekdays"));
1068 for (var e = h.config.showMonths; e--; ) {
1069 var t = d("div", "flatpickr-weekdaycontainer");
1070 h.weekdayContainer.appendChild(t);
1071 }
1072 return z(), h.weekdayContainer;
1073 }
1074 function z() {
1075 if (h.weekdayContainer) {
1076 var e = h.l10n.firstDayOfWeek,
1077 t = h.l10n.weekdays.shorthand.slice();
1078 e > 0 &&
1079 e < t.length &&
1080 (t = t.splice(e, t.length).concat(t.splice(0, e)));
1081 for (var n = h.config.showMonths; n--; )
1082 h.weekdayContainer.children[n].innerHTML =
1083 "\n <span class='flatpickr-weekday'>\n " +
1084 t.join("</span><span class='flatpickr-weekday'>") +
1085 "\n </span>\n ";
1086 }
1087 }
1088 function G(e, t) {
1089 void 0 === t && (t = !0);
1090 var n = t ? e : e - h.currentMonth;
1091 (n < 0 && !0 === h._hidePrevMonthArrow) ||
1092 (n > 0 && !0 === h._hideNextMonthArrow) ||
1093 ((h.currentMonth += n),
1094 (h.currentMonth < 0 || h.currentMonth > 11) &&
1095 ((h.currentYear += h.currentMonth > 11 ? 1 : -1),
1096 (h.currentMonth = (h.currentMonth + 12) % 12),
1097 ge("onYearChange"),
1098 K()),
1099 J(),
1100 ge("onMonthChange"),
1101 ve());
1102 }
1103 function V(e) {
1104 return (
1105 !(!h.config.appendTo || !h.config.appendTo.contains(e)) ||
1106 h.calendarContainer.contains(e)
1107 );
1108 }
1109 function Z(e) {
1110 if (h.isOpen && !h.config.inline) {
1111 var t =
1112 "function" == typeof (r = e).composedPath
1113 ? r.composedPath()[0]
1114 : r.target,
1115 n = V(t),
1116 a =
1117 t === h.input ||
1118 t === h.altInput ||
1119 h.element.contains(t) ||
1120 (e.path &&
1121 e.path.indexOf &&
1122 (~e.path.indexOf(h.input) ||
1123 ~e.path.indexOf(h.altInput))),
1124 i =
1125 "blur" === e.type
1126 ? a && e.relatedTarget && !V(e.relatedTarget)
1127 : !a && !n && !V(e.relatedTarget),
1128 o = !h.config.ignoredFocusElements.some(function (e) {
1129 return e.contains(t);
1130 });
1131 i &&
1132 o &&
1133 (void 0 !== h.timeContainer &&
1134 void 0 !== h.minuteElement &&
1135 void 0 !== h.hourElement &&
1136 T(),
1137 h.close(),
1138 "range" === h.config.mode &&
1139 1 === h.selectedDates.length &&
1140 (h.clear(!1), h.redraw()));
1141 }
1142 var r;
1143 }
1144 function Q(e) {
1145 if (
1146 !(
1147 !e ||
1148 (h.config.minDate && e < h.config.minDate.getFullYear()) ||
1149 (h.config.maxDate && e > h.config.maxDate.getFullYear())
1150 )
1151 ) {
1152 var t = e,
1153 n = h.currentYear !== t;
1154 (h.currentYear = t || h.currentYear),
1155 h.config.maxDate &&
1156 h.currentYear === h.config.maxDate.getFullYear()
1157 ? (h.currentMonth = Math.min(
1158 h.config.maxDate.getMonth(),
1159 h.currentMonth
1160 ))
1161 : h.config.minDate &&
1162 h.currentYear === h.config.minDate.getFullYear() &&
1163 (h.currentMonth = Math.max(
1164 h.config.minDate.getMonth(),
1165 h.currentMonth
1166 )),
1167 n && (h.redraw(), ge("onYearChange"), K());
1168 }
1169 }
1170 function X(e, t) {
1171 void 0 === t && (t = !0);
1172 var n = h.parseDate(e, void 0, t);
1173 if (
1174 (h.config.minDate &&
1175 n &&
1176 w(
1177 n,
1178 h.config.minDate,
1179 void 0 !== t ? t : !h.minDateHasTime
1180 ) < 0) ||
1181 (h.config.maxDate &&
1182 n &&
1183 w(
1184 n,
1185 h.config.maxDate,
1186 void 0 !== t ? t : !h.maxDateHasTime
1187 ) > 0)
1188 )
1189 return !1;
1190 if (0 === h.config.enable.length && 0 === h.config.disable.length)
1191 return !0;
1192 if (void 0 === n) return !1;
1193 for (
1194 var a = h.config.enable.length > 0,
1195 i = a ? h.config.enable : h.config.disable,
1196 o = 0,
1197 r = void 0;
1198 o < i.length;
1199 o++
1200 ) {
1201 if ("function" == typeof (r = i[o]) && r(n)) return a;
1202 if (
1203 r instanceof Date &&
1204 void 0 !== n &&
1205 r.getTime() === n.getTime()
1206 )
1207 return a;
1208 if ("string" == typeof r && void 0 !== n) {
1209 var l = h.parseDate(r, void 0, !0);
1210 return l && l.getTime() === n.getTime() ? a : !a;
1211 }
1212 if (
1213 "object" == typeof r &&
1214 void 0 !== n &&
1215 r.from &&
1216 r.to &&
1217 n.getTime() >= r.from.getTime() &&
1218 n.getTime() <= r.to.getTime()
1219 )
1220 return a;
1221 }
1222 return !a;
1223 }
1224 function ee(e) {
1225 return (
1226 void 0 !== h.daysContainer &&
1227 -1 === e.className.indexOf("hidden") &&
1228 h.daysContainer.contains(e)
1229 );
1230 }
1231 function te(e) {
1232 var t = e.target === h._input,
1233 n = h.config.allowInput,
1234 a = h.isOpen && (!n || !t),
1235 i = h.config.inline && t && !n;
1236 if (13 === e.keyCode && t) {
1237 if (n)
1238 return (
1239 h.setDate(
1240 h._input.value,
1241 !0,
1242 e.target === h.altInput
1243 ? h.config.altFormat
1244 : h.config.dateFormat
1245 ),
1246 e.target.blur()
1247 );
1248 h.open();
1249 } else if (V(e.target) || a || i) {
1250 var o = !!h.timeContainer && h.timeContainer.contains(e.target);
1251 switch (e.keyCode) {
1252 case 13:
1253 o ? (e.preventDefault(), T(), de()) : se(e);
1254 break;
1255 case 27:
1256 e.preventDefault(), de();
1257 break;
1258 case 8:
1259 case 46:
1260 t &&
1261 !h.config.allowInput &&
1262 (e.preventDefault(), h.clear());
1263 break;
1264 case 37:
1265 case 39:
1266 if (o || t) h.hourElement && h.hourElement.focus();
1267 else if (
1268 (e.preventDefault(),
1269 void 0 !== h.daysContainer &&
1270 (!1 === n ||
1271 (document.activeElement &&
1272 ee(document.activeElement))))
1273 ) {
1274 var r = 39 === e.keyCode ? 1 : -1;
1275 e.ctrlKey
1276 ? (e.stopPropagation(), G(r), R(W(1), 0))
1277 : R(void 0, r);
1278 }
1279 break;
1280 case 38:
1281 case 40:
1282 e.preventDefault();
1283 var l = 40 === e.keyCode ? 1 : -1;
1284 (h.daysContainer && void 0 !== e.target.$i) ||
1285 e.target === h.input ||
1286 e.target === h.altInput
1287 ? e.ctrlKey
1288 ? (e.stopPropagation(),
1289 Q(h.currentYear - l),
1290 R(W(1), 0))
1291 : o || R(void 0, 7 * l)
1292 : e.target === h.currentYearElement
1293 ? Q(h.currentYear - l)
1294 : h.config.enableTime &&
1295 (!o && h.hourElement && h.hourElement.focus(),
1296 T(e),
1297 h._debouncedChange());
1298 break;
1299 case 9:
1300 if (o) {
1301 var c = [
1302 h.hourElement,
1303 h.minuteElement,
1304 h.secondElement,
1305 h.amPM,
1306 ]
1307 .concat(h.pluginElements)
1308 .filter(function (e) {
1309 return e;
1310 }),
1311 d = c.indexOf(e.target);
1312 if (-1 !== d) {
1313 var s = c[d + (e.shiftKey ? -1 : 1)];
1314 e.preventDefault(), (s || h._input).focus();
1315 }
1316 } else
1317 !h.config.noCalendar &&
1318 h.daysContainer &&
1319 h.daysContainer.contains(e.target) &&
1320 e.shiftKey &&
1321 (e.preventDefault(), h._input.focus());
1322 }
1323 }
1324 if (void 0 !== h.amPM && e.target === h.amPM)
1325 switch (e.key) {
1326 case h.l10n.amPM[0].charAt(0):
1327 case h.l10n.amPM[0].charAt(0).toLowerCase():
1328 (h.amPM.textContent = h.l10n.amPM[0]), k(), we();
1329 break;
1330 case h.l10n.amPM[1].charAt(0):
1331 case h.l10n.amPM[1].charAt(0).toLowerCase():
1332 (h.amPM.textContent = h.l10n.amPM[1]), k(), we();
1333 }
1334 (t || V(e.target)) && ge("onKeyDown", e);
1335 }
1336 function ne(e) {
1337 if (
1338 1 === h.selectedDates.length &&
1339 (!e ||
1340 (e.classList.contains("flatpickr-day") &&
1341 !e.classList.contains("flatpickr-disabled")))
1342 ) {
1343 for (
1344 var t = e
1345 ? e.dateObj.getTime()
1346 : h.days.firstElementChild.dateObj.getTime(),
1347 n = h
1348 .parseDate(h.selectedDates[0], void 0, !0)
1349 .getTime(),
1350 a = Math.min(t, h.selectedDates[0].getTime()),
1351 i = Math.max(t, h.selectedDates[0].getTime()),
1352 o = !1,
1353 r = 0,
1354 l = 0,
1355 c = a;
1356 c < i;
1357 c += C.DAY
1358 )
1359 X(new Date(c), !0) ||
1360 ((o = o || (c > a && c < i)),
1361 c < n && (!r || c > r)
1362 ? (r = c)
1363 : c > n && (!l || c < l) && (l = c));
1364 for (var d = 0; d < h.config.showMonths; d++)
1365 for (
1366 var s = h.daysContainer.children[d],
1367 u = function (a, i) {
1368 var c = s.children[a],
1369 d = c.dateObj.getTime(),
1370 u = (r > 0 && d < r) || (l > 0 && d > l);
1371 return u
1372 ? (c.classList.add("notAllowed"),
1373 [
1374 "inRange",
1375 "startRange",
1376 "endRange",
1377 ].forEach(function (e) {
1378 c.classList.remove(e);
1379 }),
1380 "continue")
1381 : o && !u
1382 ? "continue"
1383 : ([
1384 "startRange",
1385 "inRange",
1386 "endRange",
1387 "notAllowed",
1388 ].forEach(function (e) {
1389 c.classList.remove(e);
1390 }),
1391 void (
1392 void 0 !== e &&
1393 (e.classList.add(
1394 t <= h.selectedDates[0].getTime()
1395 ? "startRange"
1396 : "endRange"
1397 ),
1398 n < t && d === n
1399 ? c.classList.add("startRange")
1400 : n > t &&
1401 d === n &&
1402 c.classList.add("endRange"),
1403 d >= r &&
1404 (0 === l || d <= l) &&
1405 b(d, n, t) &&
1406 c.classList.add("inRange"))
1407 ));
1408 },
1409 f = 0,
1410 m = s.children.length;
1411 f < m;
1412 f++
1413 )
1414 u(f);
1415 }
1416 }
1417 function ae() {
1418 !h.isOpen || h.config.static || h.config.inline || le();
1419 }
1420 function ie() {
1421 h.setDate(
1422 void 0 !== h.config.minDate
1423 ? new Date(h.config.minDate.getTime())
1424 : new Date(),
1425 !0
1426 ),
1427 S(),
1428 we();
1429 }
1430 function oe(e) {
1431 return function (t) {
1432 var n = (h.config["_" + e + "Date"] = h.parseDate(
1433 t,
1434 h.config.dateFormat
1435 )),
1436 a = h.config["_" + ("min" === e ? "max" : "min") + "Date"];
1437 void 0 !== n &&
1438 (h["min" === e ? "minDateHasTime" : "maxDateHasTime"] =
1439 n.getHours() > 0 ||
1440 n.getMinutes() > 0 ||
1441 n.getSeconds() > 0),
1442 h.selectedDates &&
1443 ((h.selectedDates = h.selectedDates.filter(function (
1444 e
1445 ) {
1446 return X(e);
1447 })),
1448 h.selectedDates.length || "min" !== e || I(n),
1449 we()),
1450 h.daysContainer &&
1451 (ce(),
1452 void 0 !== n
1453 ? (h.currentYearElement[
1454 e
1455 ] = n.getFullYear().toString())
1456 : h.currentYearElement.removeAttribute(e),
1457 (h.currentYearElement.disabled =
1458 !!a &&
1459 void 0 !== n &&
1460 a.getFullYear() === n.getFullYear()));
1461 };
1462 }
1463 function re() {
1464 "object" != typeof h.config.locale &&
1465 void 0 === E.l10ns[h.config.locale] &&
1466 h.config.errorHandler(
1467 new Error("flatpickr: invalid locale " + h.config.locale)
1468 ),
1469 (h.l10n = e(
1470 {},
1471 E.l10ns.default,
1472 "object" == typeof h.config.locale
1473 ? h.config.locale
1474 : "default" !== h.config.locale
1475 ? E.l10ns[h.config.locale]
1476 : void 0
1477 )),
1478 (p.K =
1479 "(" +
1480 h.l10n.amPM[0] +
1481 "|" +
1482 h.l10n.amPM[1] +
1483 "|" +
1484 h.l10n.amPM[0].toLowerCase() +
1485 "|" +
1486 h.l10n.amPM[1].toLowerCase() +
1487 ")"),
1488 void 0 ===
1489 e({}, g, JSON.parse(JSON.stringify(f.dataset || {})))
1490 .time_24hr &&
1491 void 0 === E.defaultConfig.time_24hr &&
1492 (h.config.time_24hr = h.l10n.time_24hr),
1493 (h.formatDate = v(h)),
1494 (h.parseDate = D({ config: h.config, l10n: h.l10n }));
1495 }
1496 function le(e) {
1497 if (void 0 !== h.calendarContainer) {
1498 ge("onPreCalendarPosition");
1499 var t = e || h._positionElement,
1500 n = Array.prototype.reduce.call(
1501 h.calendarContainer.children,
1502 function (e, t) {
1503 return e + t.offsetHeight;
1504 },
1505 0
1506 ),
1507 a = h.calendarContainer.offsetWidth,
1508 i = h.config.position.split(" "),
1509 o = i[0],
1510 r = i.length > 1 ? i[1] : null,
1511 l = t.getBoundingClientRect(),
1512 d = window.innerHeight - l.bottom,
1513 s = "above" === o || ("below" !== o && d < n && l.top > n),
1514 u =
1515 window.pageYOffset +
1516 l.top +
1517 (s ? -n - 2 : t.offsetHeight + 2);
1518 if (
1519 (c(h.calendarContainer, "arrowTop", !s),
1520 c(h.calendarContainer, "arrowBottom", s),
1521 !h.config.inline)
1522 ) {
1523 var f =
1524 window.pageXOffset +
1525 l.left -
1526 (null != r && "center" === r
1527 ? (a - l.width) / 2
1528 : 0),
1529 m =
1530 window.document.body.offsetWidth -
1531 (window.pageXOffset + l.right),
1532 g = f + a > window.document.body.offsetWidth,
1533 p = m + a > window.document.body.offsetWidth;
1534 if (
1535 (c(h.calendarContainer, "rightMost", g),
1536 !h.config.static)
1537 )
1538 if (((h.calendarContainer.style.top = u + "px"), g))
1539 if (p) {
1540 var v = document.styleSheets[0];
1541 if (void 0 === v) return;
1542 var D = window.document.body.offsetWidth,
1543 w = Math.max(0, D / 2 - a / 2),
1544 b = v.cssRules.length,
1545 C = "{left:" + l.left + "px;right:auto;}";
1546 c(h.calendarContainer, "rightMost", !1),
1547 c(h.calendarContainer, "centerMost", !0),
1548 v.insertRule(
1549 ".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after" +
1550 C,
1551 b
1552 ),
1553 (h.calendarContainer.style.left = w + "px"),
1554 (h.calendarContainer.style.right = "auto");
1555 } else
1556 (h.calendarContainer.style.left = "auto"),
1557 (h.calendarContainer.style.right =
1558 m + "px");
1559 else
1560 (h.calendarContainer.style.left = f + "px"),
1561 (h.calendarContainer.style.right = "auto");
1562 }
1563 }
1564 }
1565 function ce() {
1566 h.config.noCalendar || h.isMobile || (ve(), J());
1567 }
1568 function de() {
1569 h._input.focus(),
1570 -1 !== window.navigator.userAgent.indexOf("MSIE") ||
1571 void 0 !== navigator.msMaxTouchPoints
1572 ? setTimeout(h.close, 0)
1573 : h.close();
1574 }
1575 function se(e) {
1576 e.preventDefault(), e.stopPropagation();
1577 var t = (function e(t, n) {
1578 return n(t) ? t : t.parentNode ? e(t.parentNode, n) : void 0;
1579 })(e.target, function (e) {
1580 return (
1581 e.classList &&
1582 e.classList.contains("flatpickr-day") &&
1583 !e.classList.contains("flatpickr-disabled") &&
1584 !e.classList.contains("notAllowed")
1585 );
1586 });
1587 if (void 0 !== t) {
1588 var n = t,
1589 a = (h.latestSelectedDateObj = new Date(
1590 n.dateObj.getTime()
1591 )),
1592 i =
1593 (a.getMonth() < h.currentMonth ||
1594 a.getMonth() >
1595 h.currentMonth + h.config.showMonths - 1) &&
1596 "range" !== h.config.mode;
1597 if (((h.selectedDateElem = n), "single" === h.config.mode))
1598 h.selectedDates = [a];
1599 else if ("multiple" === h.config.mode) {
1600 var o = he(a);
1601 o
1602 ? h.selectedDates.splice(parseInt(o), 1)
1603 : h.selectedDates.push(a);
1604 } else
1605 "range" === h.config.mode &&
1606 (2 === h.selectedDates.length && h.clear(!1, !1),
1607 (h.latestSelectedDateObj = a),
1608 h.selectedDates.push(a),
1609 0 !== w(a, h.selectedDates[0], !0) &&
1610 h.selectedDates.sort(function (e, t) {
1611 return e.getTime() - t.getTime();
1612 }));
1613 if ((k(), i)) {
1614 var r = h.currentYear !== a.getFullYear();
1615 (h.currentYear = a.getFullYear()),
1616 (h.currentMonth = a.getMonth()),
1617 r && (ge("onYearChange"), K()),
1618 ge("onMonthChange");
1619 }
1620 if (
1621 (ve(),
1622 J(),
1623 we(),
1624 h.config.enableTime &&
1625 setTimeout(function () {
1626 return (h.showTimeInput = !0);
1627 }, 50),
1628 i || "range" === h.config.mode || 1 !== h.config.showMonths
1629 ? void 0 !== h.selectedDateElem &&
1630 void 0 === h.hourElement &&
1631 h.selectedDateElem &&
1632 h.selectedDateElem.focus()
1633 : L(n),
1634 void 0 !== h.hourElement &&
1635 void 0 !== h.hourElement &&
1636 h.hourElement.focus(),
1637 h.config.closeOnSelect)
1638 ) {
1639 var l = "single" === h.config.mode && !h.config.enableTime,
1640 c =
1641 "range" === h.config.mode &&
1642 2 === h.selectedDates.length &&
1643 !h.config.enableTime;
1644 (l || c) && de();
1645 }
1646 Y();
1647 }
1648 }
1649 (h.parseDate = D({ config: h.config, l10n: h.l10n })),
1650 (h._handlers = []),
1651 (h.pluginElements = []),
1652 (h.loadedPlugins = []),
1653 (h._bind = F),
1654 (h._setHoursFromDate = I),
1655 (h._positionCalendar = le),
1656 (h.changeMonth = G),
1657 (h.changeYear = Q),
1658 (h.clear = function (e, t) {
1659 void 0 === e && (e = !0);
1660 void 0 === t && (t = !0);
1661 (h.input.value = ""),
1662 void 0 !== h.altInput && (h.altInput.value = "");
1663 void 0 !== h.mobileInput && (h.mobileInput.value = "");
1664 (h.selectedDates = []),
1665 (h.latestSelectedDateObj = void 0),
1666 !0 === t &&
1667 ((h.currentYear = h._initialDate.getFullYear()),
1668 (h.currentMonth = h._initialDate.getMonth()));
1669 (h.showTimeInput = !1), !0 === h.config.enableTime && S();
1670 h.redraw(), e && ge("onChange");
1671 }),
1672 (h.close = function () {
1673 (h.isOpen = !1),
1674 h.isMobile ||
1675 (void 0 !== h.calendarContainer &&
1676 h.calendarContainer.classList.remove("open"),
1677 void 0 !== h._input &&
1678 h._input.classList.remove("active"));
1679 ge("onClose");
1680 }),
1681 (h._createElement = d),
1682 (h.destroy = function () {
1683 void 0 !== h.config && ge("onDestroy");
1684 for (var e = h._handlers.length; e--; ) {
1685 var t = h._handlers[e];
1686 t.element.removeEventListener(
1687 t.event,
1688 t.handler,
1689 t.options
1690 );
1691 }
1692 if (((h._handlers = []), h.mobileInput))
1693 h.mobileInput.parentNode &&
1694 h.mobileInput.parentNode.removeChild(h.mobileInput),
1695 (h.mobileInput = void 0);
1696 else if (h.calendarContainer && h.calendarContainer.parentNode)
1697 if (h.config.static && h.calendarContainer.parentNode) {
1698 var n = h.calendarContainer.parentNode;
1699 if (
1700 (n.lastChild && n.removeChild(n.lastChild),
1701 n.parentNode)
1702 ) {
1703 for (; n.firstChild; )
1704 n.parentNode.insertBefore(n.firstChild, n);
1705 n.parentNode.removeChild(n);
1706 }
1707 } else
1708 h.calendarContainer.parentNode.removeChild(
1709 h.calendarContainer
1710 );
1711 h.altInput &&
1712 ((h.input.type = "text"),
1713 h.altInput.parentNode &&
1714 h.altInput.parentNode.removeChild(h.altInput),
1715 delete h.altInput);
1716 h.input &&
1717 ((h.input.type = h.input._type),
1718 h.input.classList.remove("flatpickr-input"),
1719 h.input.removeAttribute("readonly"),
1720 (h.input.value = ""));
1721 [
1722 "_showTimeInput",
1723 "latestSelectedDateObj",
1724 "_hideNextMonthArrow",
1725 "_hidePrevMonthArrow",
1726 "__hideNextMonthArrow",
1727 "__hidePrevMonthArrow",
1728 "isMobile",
1729 "isOpen",
1730 "selectedDateElem",
1731 "minDateHasTime",
1732 "maxDateHasTime",
1733 "days",
1734 "daysContainer",
1735 "_input",
1736 "_positionElement",
1737 "innerContainer",
1738 "rContainer",
1739 "monthNav",
1740 "todayDateElem",
1741 "calendarContainer",
1742 "weekdayContainer",
1743 "prevMonthNav",
1744 "nextMonthNav",
1745 "monthsDropdownContainer",
1746 "currentMonthElement",
1747 "currentYearElement",
1748 "navigationCurrentMonth",
1749 "selectedDateElem",
1750 "config",
1751 ].forEach(function (e) {
1752 try {
1753 delete h[e];
1754 } catch (e) {}
1755 });
1756 }),
1757 (h.isEnabled = X),
1758 (h.jumpToDate = A),
1759 (h.open = function (e, t) {
1760 void 0 === t && (t = h._positionElement);
1761 if (!0 === h.isMobile)
1762 return (
1763 e && (e.preventDefault(), e.target && e.target.blur()),
1764 void 0 !== h.mobileInput &&
1765 (h.mobileInput.focus(), h.mobileInput.click()),
1766 void ge("onOpen")
1767 );
1768 if (h._input.disabled || h.config.inline) return;
1769 var n = h.isOpen;
1770 (h.isOpen = !0),
1771 n ||
1772 (h.calendarContainer.classList.add("open"),
1773 h._input.classList.add("active"),
1774 ge("onOpen"),
1775 le(t));
1776 !0 === h.config.enableTime &&
1777 !0 === h.config.noCalendar &&
1778 (0 === h.selectedDates.length && ie(),
1779 !1 !== h.config.allowInput ||
1780 (void 0 !== e &&
1781 h.timeContainer.contains(e.relatedTarget)) ||
1782 setTimeout(function () {
1783 return h.hourElement.select();
1784 }, 50));
1785 }),
1786 (h.redraw = ce),
1787 (h.set = function (e, n) {
1788 if (null !== e && "object" == typeof e)
1789 for (var a in (Object.assign(h.config, e), e))
1790 void 0 !== ue[a] &&
1791 ue[a].forEach(function (e) {
1792 return e();
1793 });
1794 else
1795 (h.config[e] = n),
1796 void 0 !== ue[e]
1797 ? ue[e].forEach(function (e) {
1798 return e();
1799 })
1800 : t.indexOf(e) > -1 && (h.config[e] = l(n));
1801 h.redraw(), we(!1);
1802 }),
1803 (h.setDate = function (e, t, n) {
1804 void 0 === t && (t = !1);
1805 void 0 === n && (n = h.config.dateFormat);
1806 if ((0 !== e && !e) || (e instanceof Array && 0 === e.length))
1807 return h.clear(t);
1808 fe(e, n),
1809 (h.showTimeInput = h.selectedDates.length > 0),
1810 (h.latestSelectedDateObj =
1811 h.selectedDates[h.selectedDates.length - 1]),
1812 h.redraw(),
1813 A(),
1814 I(),
1815 0 === h.selectedDates.length && h.clear(!1);
1816 we(t), t && ge("onChange");
1817 }),
1818 (h.toggle = function (e) {
1819 if (!0 === h.isOpen) return h.close();
1820 h.open(e);
1821 });
1822 var ue = {
1823 locale: [re, z],
1824 showMonths: [q, x, $],
1825 minDate: [A],
1826 maxDate: [A],
1827 };
1828 function fe(e, t) {
1829 var n = [];
1830 if (e instanceof Array)
1831 n = e.map(function (e) {
1832 return h.parseDate(e, t);
1833 });
1834 else if (e instanceof Date || "number" == typeof e)
1835 n = [h.parseDate(e, t)];
1836 else if ("string" == typeof e)
1837 switch (h.config.mode) {
1838 case "single":
1839 case "time":
1840 n = [h.parseDate(e, t)];
1841 break;
1842 case "multiple":
1843 n = e.split(h.config.conjunction).map(function (e) {
1844 return h.parseDate(e, t);
1845 });
1846 break;
1847 case "range":
1848 n = e.split(h.l10n.rangeSeparator).map(function (e) {
1849 return h.parseDate(e, t);
1850 });
1851 }
1852 else
1853 h.config.errorHandler(
1854 new Error("Invalid date supplied: " + JSON.stringify(e))
1855 );
1856 (h.selectedDates = n.filter(function (e) {
1857 return e instanceof Date && X(e, !1);
1858 })),
1859 "range" === h.config.mode &&
1860 h.selectedDates.sort(function (e, t) {
1861 return e.getTime() - t.getTime();
1862 });
1863 }
1864 function me(e) {
1865 return e
1866 .slice()
1867 .map(function (e) {
1868 return "string" == typeof e ||
1869 "number" == typeof e ||
1870 e instanceof Date
1871 ? h.parseDate(e, void 0, !0)
1872 : e && "object" == typeof e && e.from && e.to
1873 ? {
1874 from: h.parseDate(e.from, void 0),
1875 to: h.parseDate(e.to, void 0),
1876 }
1877 : e;
1878 })
1879 .filter(function (e) {
1880 return e;
1881 });
1882 }
1883 function ge(e, t) {
1884 if (void 0 !== h.config) {
1885 var n = h.config[e];
1886 if (void 0 !== n && n.length > 0)
1887 for (var a = 0; n[a] && a < n.length; a++)
1888 n[a](h.selectedDates, h.input.value, h, t);
1889 "onChange" === e &&
1890 (h.input.dispatchEvent(pe("change")),
1891 h.input.dispatchEvent(pe("input")));
1892 }
1893 }
1894 function pe(e) {
1895 var t = document.createEvent("Event");
1896 return t.initEvent(e, !0, !0), t;
1897 }
1898 function he(e) {
1899 for (var t = 0; t < h.selectedDates.length; t++)
1900 if (0 === w(h.selectedDates[t], e)) return "" + t;
1901 return !1;
1902 }
1903 function ve() {
1904 h.config.noCalendar ||
1905 h.isMobile ||
1906 !h.monthNav ||
1907 (h.yearElements.forEach(function (e, t) {
1908 var n = new Date(h.currentYear, h.currentMonth, 1);
1909 n.setMonth(h.currentMonth + t),
1910 h.config.showMonths > 1 ||
1911 "static" === h.config.monthSelectorType
1912 ? (h.monthElements[t].textContent =
1913 m(
1914 n.getMonth(),
1915 h.config.shorthandCurrentMonth,
1916 h.l10n
1917 ) + " ")
1918 : (h.monthsDropdownContainer.value = n
1919 .getMonth()
1920 .toString()),
1921 (e.value = n.getFullYear().toString());
1922 }),
1923 (h._hidePrevMonthArrow =
1924 void 0 !== h.config.minDate &&
1925 (h.currentYear === h.config.minDate.getFullYear()
1926 ? h.currentMonth <= h.config.minDate.getMonth()
1927 : h.currentYear < h.config.minDate.getFullYear())),
1928 (h._hideNextMonthArrow =
1929 void 0 !== h.config.maxDate &&
1930 (h.currentYear === h.config.maxDate.getFullYear()
1931 ? h.currentMonth + 1 > h.config.maxDate.getMonth()
1932 : h.currentYear > h.config.maxDate.getFullYear())));
1933 }
1934 function De(e) {
1935 return h.selectedDates
1936 .map(function (t) {
1937 return h.formatDate(t, e);
1938 })
1939 .filter(function (e, t, n) {
1940 return (
1941 "range" !== h.config.mode ||
1942 h.config.enableTime ||
1943 n.indexOf(e) === t
1944 );
1945 })
1946 .join(
1947 "range" !== h.config.mode
1948 ? h.config.conjunction
1949 : h.l10n.rangeSeparator
1950 );
1951 }
1952 function we(e) {
1953 void 0 === e && (e = !0),
1954 void 0 !== h.mobileInput &&
1955 h.mobileFormatStr &&
1956 (h.mobileInput.value =
1957 void 0 !== h.latestSelectedDateObj
1958 ? h.formatDate(
1959 h.latestSelectedDateObj,
1960 h.mobileFormatStr
1961 )
1962 : ""),
1963 (h.input.value = De(h.config.dateFormat)),
1964 void 0 !== h.altInput &&
1965 (h.altInput.value = De(h.config.altFormat)),
1966 !1 !== e && ge("onValueUpdate");
1967 }
1968 function be(e) {
1969 var t = h.prevMonthNav.contains(e.target),
1970 n = h.nextMonthNav.contains(e.target);
1971 t || n
1972 ? G(t ? -1 : 1)
1973 : h.yearElements.indexOf(e.target) >= 0
1974 ? e.target.select()
1975 : e.target.classList.contains("arrowUp")
1976 ? h.changeYear(h.currentYear + 1)
1977 : e.target.classList.contains("arrowDown") &&
1978 h.changeYear(h.currentYear - 1);
1979 }
1980 return (
1981 (function () {
1982 (h.element = h.input = f),
1983 (h.isOpen = !1),
1984 (function () {
1985 var a = [
1986 "wrap",
1987 "weekNumbers",
1988 "allowInput",
1989 "clickOpens",
1990 "time_24hr",
1991 "enableTime",
1992 "noCalendar",
1993 "altInput",
1994 "shorthandCurrentMonth",
1995 "inline",
1996 "static",
1997 "enableSeconds",
1998 "disableMobile",
1999 ],
2000 i = e(
2001 {},
2002 g,
2003 JSON.parse(JSON.stringify(f.dataset || {}))
2004 ),
2005 o = {};
2006 (h.config.parseDate = i.parseDate),
2007 (h.config.formatDate = i.formatDate),
2008 Object.defineProperty(h.config, "enable", {
2009 get: function () {
2010 return h.config._enable;
2011 },
2012 set: function (e) {
2013 h.config._enable = me(e);
2014 },
2015 }),
2016 Object.defineProperty(h.config, "disable", {
2017 get: function () {
2018 return h.config._disable;
2019 },
2020 set: function (e) {
2021 h.config._disable = me(e);
2022 },
2023 });
2024 var r = "time" === i.mode;
2025 if (!i.dateFormat && (i.enableTime || r)) {
2026 var c = E.defaultConfig.dateFormat || n.dateFormat;
2027 o.dateFormat =
2028 i.noCalendar || r
2029 ? "H:i" + (i.enableSeconds ? ":S" : "")
2030 : c +
2031 " H:i" +
2032 (i.enableSeconds ? ":S" : "");
2033 }
2034 if (i.altInput && (i.enableTime || r) && !i.altFormat) {
2035 var d = E.defaultConfig.altFormat || n.altFormat;
2036 o.altFormat =
2037 i.noCalendar || r
2038 ? "h:i" + (i.enableSeconds ? ":S K" : " K")
2039 : d +
2040 " h:i" +
2041 (i.enableSeconds ? ":S" : "") +
2042 " K";
2043 }
2044 i.altInputClass ||
2045 (h.config.altInputClass =
2046 h.input.className +
2047 " " +
2048 h.config.altInputClass),
2049 Object.defineProperty(h.config, "minDate", {
2050 get: function () {
2051 return h.config._minDate;
2052 },
2053 set: oe("min"),
2054 }),
2055 Object.defineProperty(h.config, "maxDate", {
2056 get: function () {
2057 return h.config._maxDate;
2058 },
2059 set: oe("max"),
2060 });
2061 var s = function (e) {
2062 return function (t) {
2063 h.config[
2064 "min" === e ? "_minTime" : "_maxTime"
2065 ] = h.parseDate(t, "H:i:S");
2066 };
2067 };
2068 Object.defineProperty(h.config, "minTime", {
2069 get: function () {
2070 return h.config._minTime;
2071 },
2072 set: s("min"),
2073 }),
2074 Object.defineProperty(h.config, "maxTime", {
2075 get: function () {
2076 return h.config._maxTime;
2077 },
2078 set: s("max"),
2079 }),
2080 "time" === i.mode &&
2081 ((h.config.noCalendar = !0),
2082 (h.config.enableTime = !0)),
2083 Object.assign(h.config, o, i);
2084 for (var u = 0; u < a.length; u++)
2085 h.config[a[u]] =
2086 !0 === h.config[a[u]] ||
2087 "true" === h.config[a[u]];
2088 t
2089 .filter(function (e) {
2090 return void 0 !== h.config[e];
2091 })
2092 .forEach(function (e) {
2093 h.config[e] = l(h.config[e] || []).map(y);
2094 }),
2095 (h.isMobile =
2096 !h.config.disableMobile &&
2097 !h.config.inline &&
2098 "single" === h.config.mode &&
2099 !h.config.disable.length &&
2100 !h.config.enable.length &&
2101 !h.config.weekNumbers &&
2102 /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
2103 navigator.userAgent
2104 ));
2105 for (var u = 0; u < h.config.plugins.length; u++) {
2106 var m = h.config.plugins[u](h) || {};
2107 for (var p in m)
2108 t.indexOf(p) > -1
2109 ? (h.config[p] = l(m[p])
2110 .map(y)
2111 .concat(h.config[p]))
2112 : void 0 === i[p] && (h.config[p] = m[p]);
2113 }
2114 ge("onParseConfig");
2115 })(),
2116 re(),
2117 (h.input = h.config.wrap
2118 ? f.querySelector("[data-input]")
2119 : f),
2120 h.input
2121 ? ((h.input._type = h.input.type),
2122 (h.input.type = "text"),
2123 h.input.classList.add("flatpickr-input"),
2124 (h._input = h.input),
2125 h.config.altInput &&
2126 ((h.altInput = d(
2127 h.input.nodeName,
2128 h.config.altInputClass
2129 )),
2130 (h._input = h.altInput),
2131 (h.altInput.placeholder = h.input.placeholder),
2132 (h.altInput.disabled = h.input.disabled),
2133 (h.altInput.required = h.input.required),
2134 (h.altInput.tabIndex = h.input.tabIndex),
2135 (h.altInput.type = "text"),
2136 h.input.setAttribute("type", "hidden"),
2137 !h.config.static &&
2138 h.input.parentNode &&
2139 h.input.parentNode.insertBefore(
2140 h.altInput,
2141 h.input.nextSibling
2142 )),
2143 h.config.allowInput ||
2144 h._input.setAttribute("readonly", "readonly"),
2145 (h._positionElement =
2146 h.config.positionElement || h._input))
2147 : h.config.errorHandler(
2148 new Error("Invalid input element specified")
2149 ),
2150 (function () {
2151 (h.selectedDates = []),
2152 (h.now = h.parseDate(h.config.now) || new Date());
2153 var e =
2154 h.config.defaultDate ||
2155 (("INPUT" !== h.input.nodeName &&
2156 "TEXTAREA" !== h.input.nodeName) ||
2157 !h.input.placeholder ||
2158 h.input.value !== h.input.placeholder
2159 ? h.input.value
2160 : null);
2161 e && fe(e, h.config.dateFormat),
2162 (h._initialDate =
2163 h.selectedDates.length > 0
2164 ? h.selectedDates[0]
2165 : h.config.minDate &&
2166 h.config.minDate.getTime() >
2167 h.now.getTime()
2168 ? h.config.minDate
2169 : h.config.maxDate &&
2170 h.config.maxDate.getTime() <
2171 h.now.getTime()
2172 ? h.config.maxDate
2173 : h.now),
2174 (h.currentYear = h._initialDate.getFullYear()),
2175 (h.currentMonth = h._initialDate.getMonth()),
2176 h.selectedDates.length > 0 &&
2177 (h.latestSelectedDateObj = h.selectedDates[0]),
2178 void 0 !== h.config.minTime &&
2179 (h.config.minTime = h.parseDate(
2180 h.config.minTime,
2181 "H:i"
2182 )),
2183 void 0 !== h.config.maxTime &&
2184 (h.config.maxTime = h.parseDate(
2185 h.config.maxTime,
2186 "H:i"
2187 )),
2188 (h.minDateHasTime =
2189 !!h.config.minDate &&
2190 (h.config.minDate.getHours() > 0 ||
2191 h.config.minDate.getMinutes() > 0 ||
2192 h.config.minDate.getSeconds() > 0)),
2193 (h.maxDateHasTime =
2194 !!h.config.maxDate &&
2195 (h.config.maxDate.getHours() > 0 ||
2196 h.config.maxDate.getMinutes() > 0 ||
2197 h.config.maxDate.getSeconds() > 0)),
2198 Object.defineProperty(h, "showTimeInput", {
2199 get: function () {
2200 return h._showTimeInput;
2201 },
2202 set: function (e) {
2203 (h._showTimeInput = e),
2204 h.calendarContainer &&
2205 c(
2206 h.calendarContainer,
2207 "showTimeInput",
2208 e
2209 ),
2210 h.isOpen && le();
2211 },
2212 });
2213 })(),
2214 (h.utils = {
2215 getDaysInMonth: function (e, t) {
2216 return (
2217 void 0 === e && (e = h.currentMonth),
2218 void 0 === t && (t = h.currentYear),
2219 1 === e &&
2220 ((t % 4 == 0 && t % 100 != 0) || t % 400 == 0)
2221 ? 29
2222 : h.l10n.daysInMonth[e]
2223 );
2224 },
2225 }),
2226 h.isMobile ||
2227 (function () {
2228 var e = window.document.createDocumentFragment();
2229 if (
2230 ((h.calendarContainer = d(
2231 "div",
2232 "flatpickr-calendar"
2233 )),
2234 (h.calendarContainer.tabIndex = -1),
2235 !h.config.noCalendar)
2236 ) {
2237 if (
2238 (e.appendChild(
2239 ((h.monthNav = d(
2240 "div",
2241 "flatpickr-months"
2242 )),
2243 (h.yearElements = []),
2244 (h.monthElements = []),
2245 (h.prevMonthNav = d(
2246 "span",
2247 "flatpickr-prev-month"
2248 )),
2249 (h.prevMonthNav.innerHTML =
2250 h.config.prevArrow),
2251 (h.nextMonthNav = d(
2252 "span",
2253 "flatpickr-next-month"
2254 )),
2255 (h.nextMonthNav.innerHTML =
2256 h.config.nextArrow),
2257 q(),
2258 Object.defineProperty(
2259 h,
2260 "_hidePrevMonthArrow",
2261 {
2262 get: function () {
2263 return h.__hidePrevMonthArrow;
2264 },
2265 set: function (e) {
2266 h.__hidePrevMonthArrow !==
2267 e &&
2268 (c(
2269 h.prevMonthNav,
2270 "flatpickr-disabled",
2271 e
2272 ),
2273 (h.__hidePrevMonthArrow = e));
2274 },
2275 }
2276 ),
2277 Object.defineProperty(
2278 h,
2279 "_hideNextMonthArrow",
2280 {
2281 get: function () {
2282 return h.__hideNextMonthArrow;
2283 },
2284 set: function (e) {
2285 h.__hideNextMonthArrow !==
2286 e &&
2287 (c(
2288 h.nextMonthNav,
2289 "flatpickr-disabled",
2290 e
2291 ),
2292 (h.__hideNextMonthArrow = e));
2293 },
2294 }
2295 ),
2296 (h.currentYearElement =
2297 h.yearElements[0]),
2298 ve(),
2299 h.monthNav)
2300 ),
2301 (h.innerContainer = d(
2302 "div",
2303 "flatpickr-innerContainer"
2304 )),
2305 h.config.weekNumbers)
2306 ) {
2307 var t = (function () {
2308 h.calendarContainer.classList.add(
2309 "hasWeeks"
2310 );
2311 var e = d(
2312 "div",
2313 "flatpickr-weekwrapper"
2314 );
2315 e.appendChild(
2316 d(
2317 "span",
2318 "flatpickr-weekday",
2319 h.l10n.weekAbbreviation
2320 )
2321 );
2322 var t = d("div", "flatpickr-weeks");
2323 return (
2324 e.appendChild(t),
2325 {
2326 weekWrapper: e,
2327 weekNumbers: t,
2328 }
2329 );
2330 })(),
2331 n = t.weekWrapper,
2332 a = t.weekNumbers;
2333 h.innerContainer.appendChild(n),
2334 (h.weekNumbers = a),
2335 (h.weekWrapper = n);
2336 }
2337 (h.rContainer = d(
2338 "div",
2339 "flatpickr-rContainer"
2340 )),
2341 h.rContainer.appendChild($()),
2342 h.daysContainer ||
2343 ((h.daysContainer = d(
2344 "div",
2345 "flatpickr-days"
2346 )),
2347 (h.daysContainer.tabIndex = -1)),
2348 J(),
2349 h.rContainer.appendChild(h.daysContainer),
2350 h.innerContainer.appendChild(h.rContainer),
2351 e.appendChild(h.innerContainer);
2352 }
2353 h.config.enableTime &&
2354 e.appendChild(
2355 (function () {
2356 h.calendarContainer.classList.add(
2357 "hasTime"
2358 ),
2359 h.config.noCalendar &&
2360 h.calendarContainer.classList.add(
2361 "noCalendar"
2362 ),
2363 (h.timeContainer = d(
2364 "div",
2365 "flatpickr-time"
2366 )),
2367 (h.timeContainer.tabIndex = -1);
2368 var e = d(
2369 "span",
2370 "flatpickr-time-separator",
2371 ":"
2372 ),
2373 t = u("flatpickr-hour", {
2374 "aria-label":
2375 h.l10n.hourAriaLabel,
2376 });
2377 h.hourElement = t.getElementsByTagName(
2378 "input"
2379 )[0];
2380 var n = u("flatpickr-minute", {
2381 "aria-label":
2382 h.l10n.minuteAriaLabel,
2383 });
2384 if (
2385 ((h.minuteElement = n.getElementsByTagName(
2386 "input"
2387 )[0]),
2388 (h.hourElement.tabIndex = h.minuteElement.tabIndex = -1),
2389 (h.hourElement.value = i(
2390 h.latestSelectedDateObj
2391 ? h.latestSelectedDateObj.getHours()
2392 : h.config.time_24hr
2393 ? h.config.defaultHour
2394 : (function (e) {
2395 switch (e % 24) {
2396 case 0:
2397 case 12:
2398 return 12;
2399 default:
2400 return e % 12;
2401 }
2402 })(h.config.defaultHour)
2403 )),
2404 (h.minuteElement.value = i(
2405 h.latestSelectedDateObj
2406 ? h.latestSelectedDateObj.getMinutes()
2407 : h.config.defaultMinute
2408 )),
2409 h.hourElement.setAttribute(
2410 "step",
2411 h.config.hourIncrement.toString()
2412 ),
2413 h.minuteElement.setAttribute(
2414 "step",
2415 h.config.minuteIncrement.toString()
2416 ),
2417 h.hourElement.setAttribute(
2418 "min",
2419 h.config.time_24hr ? "0" : "1"
2420 ),
2421 h.hourElement.setAttribute(
2422 "max",
2423 h.config.time_24hr ? "23" : "12"
2424 ),
2425 h.minuteElement.setAttribute(
2426 "min",
2427 "0"
2428 ),
2429 h.minuteElement.setAttribute(
2430 "max",
2431 "59"
2432 ),
2433 h.timeContainer.appendChild(t),
2434 h.timeContainer.appendChild(e),
2435 h.timeContainer.appendChild(n),
2436 h.config.time_24hr &&
2437 h.timeContainer.classList.add(
2438 "time24hr"
2439 ),
2440 h.config.enableSeconds)
2441 ) {
2442 h.timeContainer.classList.add(
2443 "hasSeconds"
2444 );
2445 var a = u("flatpickr-second");
2446 (h.secondElement = a.getElementsByTagName(
2447 "input"
2448 )[0]),
2449 (h.secondElement.value = i(
2450 h.latestSelectedDateObj
2451 ? h.latestSelectedDateObj.getSeconds()
2452 : h.config
2453 .defaultSeconds
2454 )),
2455 h.secondElement.setAttribute(
2456 "step",
2457 h.minuteElement.getAttribute(
2458 "step"
2459 )
2460 ),
2461 h.secondElement.setAttribute(
2462 "min",
2463 "0"
2464 ),
2465 h.secondElement.setAttribute(
2466 "max",
2467 "59"
2468 ),
2469 h.timeContainer.appendChild(
2470 d(
2471 "span",
2472 "flatpickr-time-separator",
2473 ":"
2474 )
2475 ),
2476 h.timeContainer.appendChild(a);
2477 }
2478 return (
2479 h.config.time_24hr ||
2480 ((h.amPM = d(
2481 "span",
2482 "flatpickr-am-pm",
2483 h.l10n.amPM[
2484 o(
2485 (h.latestSelectedDateObj
2486 ? h.hourElement
2487 .value
2488 : h.config
2489 .defaultHour) >
2490 11
2491 )
2492 ]
2493 )),
2494 (h.amPM.title =
2495 h.l10n.toggleTitle),
2496 (h.amPM.tabIndex = -1),
2497 h.timeContainer.appendChild(
2498 h.amPM
2499 )),
2500 h.timeContainer
2501 );
2502 })()
2503 ),
2504 c(
2505 h.calendarContainer,
2506 "rangeMode",
2507 "range" === h.config.mode
2508 ),
2509 c(
2510 h.calendarContainer,
2511 "animate",
2512 !0 === h.config.animate
2513 ),
2514 c(
2515 h.calendarContainer,
2516 "multiMonth",
2517 h.config.showMonths > 1
2518 ),
2519 h.calendarContainer.appendChild(e);
2520 var r =
2521 void 0 !== h.config.appendTo &&
2522 void 0 !== h.config.appendTo.nodeType;
2523 if (
2524 (h.config.inline || h.config.static) &&
2525 (h.calendarContainer.classList.add(
2526 h.config.inline ? "inline" : "static"
2527 ),
2528 h.config.inline &&
2529 (!r && h.element.parentNode
2530 ? h.element.parentNode.insertBefore(
2531 h.calendarContainer,
2532 h._input.nextSibling
2533 )
2534 : void 0 !== h.config.appendTo &&
2535 h.config.appendTo.appendChild(
2536 h.calendarContainer
2537 )),
2538 h.config.static)
2539 ) {
2540 var l = d("div", "flatpickr-wrapper");
2541 h.element.parentNode &&
2542 h.element.parentNode.insertBefore(
2543 l,
2544 h.element
2545 ),
2546 l.appendChild(h.element),
2547 h.altInput && l.appendChild(h.altInput),
2548 l.appendChild(h.calendarContainer);
2549 }
2550 h.config.static ||
2551 h.config.inline ||
2552 (void 0 !== h.config.appendTo
2553 ? h.config.appendTo
2554 : window.document.body
2555 ).appendChild(h.calendarContainer);
2556 })(),
2557 (function () {
2558 if (
2559 (h.config.wrap &&
2560 ["open", "close", "toggle", "clear"].forEach(
2561 function (e) {
2562 Array.prototype.forEach.call(
2563 h.element.querySelectorAll(
2564 "[data-" + e + "]"
2565 ),
2566 function (t) {
2567 return F(t, "click", h[e]);
2568 }
2569 );
2570 }
2571 ),
2572 h.isMobile)
2573 )
2574 !(function () {
2575 var e = h.config.enableTime
2576 ? h.config.noCalendar
2577 ? "time"
2578 : "datetime-local"
2579 : "date";
2580 (h.mobileInput = d(
2581 "input",
2582 h.input.className + " flatpickr-mobile"
2583 )),
2584 (h.mobileInput.step =
2585 h.input.getAttribute("step") || "any"),
2586 (h.mobileInput.tabIndex = 1),
2587 (h.mobileInput.type = e),
2588 (h.mobileInput.disabled = h.input.disabled),
2589 (h.mobileInput.required = h.input.required),
2590 (h.mobileInput.placeholder =
2591 h.input.placeholder),
2592 (h.mobileFormatStr =
2593 "datetime-local" === e
2594 ? "Y-m-d\\TH:i:S"
2595 : "date" === e
2596 ? "Y-m-d"
2597 : "H:i:S"),
2598 h.selectedDates.length > 0 &&
2599 (h.mobileInput.defaultValue = h.mobileInput.value = h.formatDate(
2600 h.selectedDates[0],
2601 h.mobileFormatStr
2602 )),
2603 h.config.minDate &&
2604 (h.mobileInput.min = h.formatDate(
2605 h.config.minDate,
2606 "Y-m-d"
2607 )),
2608 h.config.maxDate &&
2609 (h.mobileInput.max = h.formatDate(
2610 h.config.maxDate,
2611 "Y-m-d"
2612 )),
2613 (h.input.type = "hidden"),
2614 void 0 !== h.altInput &&
2615 (h.altInput.type = "hidden");
2616 try {
2617 h.input.parentNode &&
2618 h.input.parentNode.insertBefore(
2619 h.mobileInput,
2620 h.input.nextSibling
2621 );
2622 } catch (e) {}
2623 F(h.mobileInput, "change", function (e) {
2624 h.setDate(
2625 e.target.value,
2626 !1,
2627 h.mobileFormatStr
2628 ),
2629 ge("onChange"),
2630 ge("onClose");
2631 });
2632 })();
2633 else {
2634 var e = r(ae, 50);
2635 (h._debouncedChange = r(Y, M)),
2636 h.daysContainer &&
2637 !/iPhone|iPad|iPod/i.test(
2638 navigator.userAgent
2639 ) &&
2640 F(h.daysContainer, "mouseover", function (
2641 e
2642 ) {
2643 "range" === h.config.mode &&
2644 ne(e.target);
2645 }),
2646 F(window.document.body, "keydown", te),
2647 h.config.inline ||
2648 h.config.static ||
2649 F(window, "resize", e),
2650 void 0 !== window.ontouchstart
2651 ? F(window.document, "touchstart", Z)
2652 : F(window.document, "mousedown", N(Z)),
2653 F(window.document, "focus", Z, { capture: !0 }),
2654 !0 === h.config.clickOpens &&
2655 (F(h._input, "focus", h.open),
2656 F(h._input, "mousedown", N(h.open))),
2657 void 0 !== h.daysContainer &&
2658 (F(h.monthNav, "mousedown", N(be)),
2659 F(h.monthNav, ["keyup", "increment"], _),
2660 F(h.daysContainer, "mousedown", N(se))),
2661 void 0 !== h.timeContainer &&
2662 void 0 !== h.minuteElement &&
2663 void 0 !== h.hourElement &&
2664 (F(h.timeContainer, ["increment"], T),
2665 F(h.timeContainer, "blur", T, {
2666 capture: !0,
2667 }),
2668 F(h.timeContainer, "mousedown", N(P)),
2669 F(
2670 [h.hourElement, h.minuteElement],
2671 ["focus", "click"],
2672 function (e) {
2673 return e.target.select();
2674 }
2675 ),
2676 void 0 !== h.secondElement &&
2677 F(
2678 h.secondElement,
2679 "focus",
2680 function () {
2681 return (
2682 h.secondElement &&
2683 h.secondElement.select()
2684 );
2685 }
2686 ),
2687 void 0 !== h.amPM &&
2688 F(
2689 h.amPM,
2690 "mousedown",
2691 N(function (e) {
2692 T(e), Y();
2693 })
2694 ));
2695 }
2696 })(),
2697 (h.selectedDates.length || h.config.noCalendar) &&
2698 (h.config.enableTime &&
2699 I(
2700 h.config.noCalendar
2701 ? h.latestSelectedDateObj ||
2702 h.config.minDate
2703 : void 0
2704 ),
2705 we(!1)),
2706 x(),
2707 (h.showTimeInput =
2708 h.selectedDates.length > 0 || h.config.noCalendar);
2709 var a = /^((?!chrome|android).)*safari/i.test(
2710 navigator.userAgent
2711 );
2712 !h.isMobile && a && le(), ge("onReady");
2713 })(),
2714 h
2715 );
2716 }
2717 function x(e, t) {
2718 for (
2719 var n = Array.prototype.slice.call(e).filter(function (e) {
2720 return e instanceof HTMLElement;
2721 }),
2722 a = [],
2723 i = 0;
2724 i < n.length;
2725 i++
2726 ) {
2727 var o = n[i];
2728 try {
2729 if (null !== o.getAttribute("data-fp-omit")) continue;
2730 void 0 !== o._flatpickr &&
2731 (o._flatpickr.destroy(), (o._flatpickr = void 0)),
2732 (o._flatpickr = y(o, t || {})),
2733 a.push(o._flatpickr);
2734 } catch (e) {
2735 console.error(e);
2736 }
2737 }
2738 return 1 === a.length ? a[0] : a;
2739 }
2740 "undefined" != typeof HTMLElement &&
2741 "undefined" != typeof HTMLCollection &&
2742 "undefined" != typeof NodeList &&
2743 ((HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (
2744 e
2745 ) {
2746 return x(this, e);
2747 }),
2748 (HTMLElement.prototype.flatpickr = function (e) {
2749 return x([this], e);
2750 }));
2751 var E = function (e, t) {
2752 return "string" == typeof e
2753 ? x(window.document.querySelectorAll(e), t)
2754 : e instanceof Node
2755 ? x([e], t)
2756 : x(e, t);
2757 };
2758 return (
2759 (E.defaultConfig = {}),
2760 (E.l10ns = { en: e({}, a), default: e({}, a) }),
2761 (E.localize = function (t) {
2762 E.l10ns.default = e({}, E.l10ns.default, t);
2763 }),
2764 (E.setDefaults = function (t) {
2765 E.defaultConfig = e({}, E.defaultConfig, t);
2766 }),
2767 (E.parseDate = D({})),
2768 (E.formatDate = v({})),
2769 (E.compareDates = w),
2770 "undefined" != typeof jQuery &&
2771 void 0 !== jQuery.fn &&
2772 (jQuery.fn.flatpickr = function (e) {
2773 return x(this, e);
2774 }),
2775 (Date.prototype.fp_incr = function (e) {
2776 return new Date(
2777 this.getFullYear(),
2778 this.getMonth(),
2779 this.getDate() + ("string" == typeof e ? parseInt(e, 10) : e)
2780 );
2781 }),
2782 "undefined" != typeof window && (window.flatpickr = E),
2783 E
2784 );
2785 });
2786