PluginProbe
WebTotem Security / 3.0.1
WebTotem Security v3.0.1
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 / includes / js / flatpickr.js

flatpickr.js in WebTotem Security 3.0.1, at includes/js/flatpickr.js

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