summaryrefslogtreecommitdiffstats
path: root/asset/js/vendor/flatpickr
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--asset/js/vendor/flatpickr.js2705
-rw-r--r--asset/js/vendor/flatpickr.min.js2
-rw-r--r--asset/js/vendor/flatpickr/l10n/ar.js62
-rw-r--r--asset/js/vendor/flatpickr/l10n/de.js70
-rw-r--r--asset/js/vendor/flatpickr/l10n/es.js70
-rw-r--r--asset/js/vendor/flatpickr/l10n/fi.js69
-rw-r--r--asset/js/vendor/flatpickr/l10n/fr.js75
-rw-r--r--asset/js/vendor/flatpickr/l10n/it.js71
-rw-r--r--asset/js/vendor/flatpickr/l10n/ja.js71
-rw-r--r--asset/js/vendor/flatpickr/l10n/pt.js66
-rw-r--r--asset/js/vendor/flatpickr/l10n/ru.js75
-rw-r--r--asset/js/vendor/flatpickr/l10n/uk.js66
12 files changed, 3402 insertions, 0 deletions
diff --git a/asset/js/vendor/flatpickr.js b/asset/js/vendor/flatpickr.js
new file mode 100644
index 0000000..bb21f88
--- /dev/null
+++ b/asset/js/vendor/flatpickr.js
@@ -0,0 +1,2705 @@
+/* flatpickr v4.6.9, @license MIT */
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.icinga ? define(factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.flatpickr = factory());
+}(this, (function () { 'use strict';
+
+ /*! *****************************************************************************
+ Copyright (c) Microsoft Corporation.
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
+ ***************************************************************************** */
+
+ var __assign = function() {
+ __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+ };
+
+ function __spreadArrays() {
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
+ r[k] = a[j];
+ return r;
+ }
+
+ var HOOKS = [
+ "onChange",
+ "onClose",
+ "onDayCreate",
+ "onDestroy",
+ "onKeyDown",
+ "onMonthChange",
+ "onOpen",
+ "onParseConfig",
+ "onReady",
+ "onValueUpdate",
+ "onYearChange",
+ "onPreCalendarPosition",
+ ];
+ var defaults = {
+ _disable: [],
+ allowInput: false,
+ allowInvalidPreload: false,
+ altFormat: "F j, Y",
+ altInput: false,
+ altInputClass: "form-control input",
+ animate: typeof window === "object" &&
+ window.navigator.userAgent.indexOf("MSIE") === -1,
+ ariaDateFormat: "F j, Y",
+ autoFillDefaultTime: true,
+ clickOpens: true,
+ closeOnSelect: true,
+ conjunction: ", ",
+ dateFormat: "Y-m-d",
+ defaultHour: 12,
+ defaultMinute: 0,
+ defaultSeconds: 0,
+ disable: [],
+ disableMobile: false,
+ enableSeconds: false,
+ enableTime: false,
+ errorHandler: function (err) {
+ return typeof console !== "undefined" && console.warn(err);
+ },
+ getWeek: function (givenDate) {
+ var date = new Date(givenDate.getTime());
+ date.setHours(0, 0, 0, 0);
+ // Thursday in current week decides the year.
+ date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));
+ // January 4 is always in week 1.
+ var week1 = new Date(date.getFullYear(), 0, 4);
+ // Adjust to Thursday in week 1 and count number of weeks from date to week1.
+ return (1 +
+ Math.round(((date.getTime() - week1.getTime()) / 86400000 -
+ 3 +
+ ((week1.getDay() + 6) % 7)) /
+ 7));
+ },
+ hourIncrement: 1,
+ ignoredFocusElements: [],
+ inline: false,
+ locale: "default",
+ minuteIncrement: 5,
+ mode: "single",
+ monthSelectorType: "dropdown",
+ nextArrow: "<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>",
+ noCalendar: false,
+ now: new Date(),
+ onChange: [],
+ onClose: [],
+ onDayCreate: [],
+ onDestroy: [],
+ onKeyDown: [],
+ onMonthChange: [],
+ onOpen: [],
+ onParseConfig: [],
+ onReady: [],
+ onValueUpdate: [],
+ onYearChange: [],
+ onPreCalendarPosition: [],
+ plugins: [],
+ position: "auto",
+ positionElement: undefined,
+ prevArrow: "<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>",
+ shorthandCurrentMonth: false,
+ showMonths: 1,
+ static: false,
+ time_24hr: false,
+ weekNumbers: false,
+ wrap: false,
+ };
+
+ var english = {
+ weekdays: {
+ shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
+ longhand: [
+ "Sunday",
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday",
+ ],
+ },
+ months: {
+ shorthand: [
+ "Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "May",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec",
+ ],
+ longhand: [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December",
+ ],
+ },
+ daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
+ firstDayOfWeek: 0,
+ ordinal: function (nth) {
+ var s = nth % 100;
+ if (s > 3 && s < 21)
+ return "th";
+ switch (s % 10) {
+ case 1:
+ return "st";
+ case 2:
+ return "nd";
+ case 3:
+ return "rd";
+ default:
+ return "th";
+ }
+ },
+ rangeSeparator: " to ",
+ weekAbbreviation: "Wk",
+ scrollTitle: "Scroll to increment",
+ toggleTitle: "Click to toggle",
+ amPM: ["AM", "PM"],
+ yearAriaLabel: "Year",
+ monthAriaLabel: "Month",
+ hourAriaLabel: "Hour",
+ minuteAriaLabel: "Minute",
+ time_24hr: false,
+ };
+
+ var pad = function (number, length) {
+ if (length === void 0) { length = 2; }
+ return ("000" + number).slice(length * -1);
+ };
+ var int = function (bool) { return (bool === true ? 1 : 0); };
+ /* istanbul ignore next */
+ function debounce(fn, wait) {
+ var t;
+ return function () {
+ var _this = this;
+ var args = arguments;
+ clearTimeout(t);
+ t = setTimeout(function () { return fn.apply(_this, args); }, wait);
+ };
+ }
+ var arrayify = function (obj) {
+ return obj instanceof Array ? obj : [obj];
+ };
+
+ function toggleClass(elem, className, bool) {
+ if (bool === true)
+ return elem.classList.add(className);
+ elem.classList.remove(className);
+ }
+ function createElement(tag, className, content) {
+ var e = window.document.createElement(tag);
+ className = className || "";
+ content = content || "";
+ e.className = className;
+ if (content !== undefined)
+ e.textContent = content;
+ return e;
+ }
+ function clearNode(node) {
+ while (node.firstChild)
+ node.removeChild(node.firstChild);
+ }
+ function findParent(node, condition) {
+ if (condition(node))
+ return node;
+ else if (node.parentNode)
+ return findParent(node.parentNode, condition);
+ return undefined; // nothing found
+ }
+ function createNumberInput(inputClassName, opts) {
+ var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown");
+ if (navigator.userAgent.indexOf("MSIE 9.0") === -1) {
+ numInput.type = "number";
+ }
+ else {
+ numInput.type = "text";
+ numInput.pattern = "\\d*";
+ }
+ if (opts !== undefined)
+ for (var key in opts)
+ numInput.setAttribute(key, opts[key]);
+ wrapper.appendChild(numInput);
+ wrapper.appendChild(arrowUp);
+ wrapper.appendChild(arrowDown);
+ return wrapper;
+ }
+ function getEventTarget(event) {
+ try {
+ if (typeof event.composedPath === "function") {
+ var path = event.composedPath();
+ return path[0];
+ }
+ return event.target;
+ }
+ catch (error) {
+ return event.target;
+ }
+ }
+
+ var doNothing = function () { return undefined; };
+ var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; };
+ var revFormat = {
+ D: doNothing,
+ F: function (dateObj, monthName, locale) {
+ dateObj.setMonth(locale.months.longhand.indexOf(monthName));
+ },
+ G: function (dateObj, hour) {
+ dateObj.setHours(parseFloat(hour));
+ },
+ H: function (dateObj, hour) {
+ dateObj.setHours(parseFloat(hour));
+ },
+ J: function (dateObj, day) {
+ dateObj.setDate(parseFloat(day));
+ },
+ K: function (dateObj, amPM, locale) {
+ dateObj.setHours((dateObj.getHours() % 12) +
+ 12 * int(new RegExp(locale.amPM[1], "i").test(amPM)));
+ },
+ M: function (dateObj, shortMonth, locale) {
+ dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));
+ },
+ S: function (dateObj, seconds) {
+ dateObj.setSeconds(parseFloat(seconds));
+ },
+ U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },
+ W: function (dateObj, weekNum, locale) {
+ var weekNumber = parseInt(weekNum);
+ var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);
+ date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);
+ return date;
+ },
+ Y: function (dateObj, year) {
+ dateObj.setFullYear(parseFloat(year));
+ },
+ Z: function (_, ISODate) { return new Date(ISODate); },
+ d: function (dateObj, day) {
+ dateObj.setDate(parseFloat(day));
+ },
+ h: function (dateObj, hour) {
+ dateObj.setHours(parseFloat(hour));
+ },
+ i: function (dateObj, minutes) {
+ dateObj.setMinutes(parseFloat(minutes));
+ },
+ j: function (dateObj, day) {
+ dateObj.setDate(parseFloat(day));
+ },
+ l: doNothing,
+ m: function (dateObj, month) {
+ dateObj.setMonth(parseFloat(month) - 1);
+ },
+ n: function (dateObj, month) {
+ dateObj.setMonth(parseFloat(month) - 1);
+ },
+ s: function (dateObj, seconds) {
+ dateObj.setSeconds(parseFloat(seconds));
+ },
+ u: function (_, unixMillSeconds) {
+ return new Date(parseFloat(unixMillSeconds));
+ },
+ w: doNothing,
+ y: function (dateObj, year) {
+ dateObj.setFullYear(2000 + parseFloat(year));
+ },
+ };
+ var tokenRegex = {
+ D: "(\\w+)",
+ F: "(\\w+)",
+ G: "(\\d\\d|\\d)",
+ H: "(\\d\\d|\\d)",
+ J: "(\\d\\d|\\d)\\w+",
+ K: "",
+ M: "(\\w+)",
+ S: "(\\d\\d|\\d)",
+ U: "(.+)",
+ W: "(\\d\\d|\\d)",
+ Y: "(\\d{4})",
+ Z: "(.+)",
+ d: "(\\d\\d|\\d)",
+ h: "(\\d\\d|\\d)",
+ i: "(\\d\\d|\\d)",
+ j: "(\\d\\d|\\d)",
+ l: "(\\w+)",
+ m: "(\\d\\d|\\d)",
+ n: "(\\d\\d|\\d)",
+ s: "(\\d\\d|\\d)",
+ u: "(.+)",
+ w: "(\\d\\d|\\d)",
+ y: "(\\d{2})",
+ };
+ var formats = {
+ // get the date in UTC
+ Z: function (date) { return date.toISOString(); },
+ // weekday name, short, e.g. Thu
+ D: function (date, locale, options) {
+ return locale.weekdays.shorthand[formats.w(date, locale, options)];
+ },
+ // full month name e.g. January
+ F: function (date, locale, options) {
+ return monthToStr(formats.n(date, locale, options) - 1, false, locale);
+ },
+ // padded hour 1-12
+ G: function (date, locale, options) {
+ return pad(formats.h(date, locale, options));
+ },
+ // hours with leading zero e.g. 03
+ H: function (date) { return pad(date.getHours()); },
+ // day (1-30) with ordinal suffix e.g. 1st, 2nd
+ J: function (date, locale) {
+ return locale.ordinal !== undefined
+ ? date.getDate() + locale.ordinal(date.getDate())
+ : date.getDate();
+ },
+ // AM/PM
+ K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },
+ // shorthand month e.g. Jan, Sep, Oct, etc
+ M: function (date, locale) {
+ return monthToStr(date.getMonth(), true, locale);
+ },
+ // seconds 00-59
+ S: function (date) { return pad(date.getSeconds()); },
+ // unix timestamp
+ U: function (date) { return date.getTime() / 1000; },
+ W: function (date, _, options) {
+ return options.getWeek(date);
+ },
+ // full year e.g. 2016, padded (0001-9999)
+ Y: function (date) { return pad(date.getFullYear(), 4); },
+ // day in month, padded (01-30)
+ d: function (date) { return pad(date.getDate()); },
+ // hour from 1-12 (am/pm)
+ h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },
+ // minutes, padded with leading zero e.g. 09
+ i: function (date) { return pad(date.getMinutes()); },
+ // day in month (1-30)
+ j: function (date) { return date.getDate(); },
+ // weekday name, full, e.g. Thursday
+ l: function (date, locale) {
+ return locale.weekdays.longhand[date.getDay()];
+ },
+ // padded month number (01-12)
+ m: function (date) { return pad(date.getMonth() + 1); },
+ // the month number (1-12)
+ n: function (date) { return date.getMonth() + 1; },
+ // seconds 0-59
+ s: function (date) { return date.getSeconds(); },
+ // Unix Milliseconds
+ u: function (date) { return date.getTime(); },
+ // number of the day of the week
+ w: function (date) { return date.getDay(); },
+ // last two digits of year e.g. 16 for 2016
+ y: function (date) { return String(date.getFullYear()).substring(2); },
+ };
+
+ var createDateFormatter = function (_a) {
+ var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d;
+ return function (dateObj, frmt, overrideLocale) {
+ var locale = overrideLocale || l10n;
+ if (config.formatDate !== undefined && !isMobile) {
+ return config.formatDate(dateObj, frmt, locale);
+ }
+ return frmt
+ .split("")
+ .map(function (c, i, arr) {
+ return formats[c] && arr[i - 1] !== "\\"
+ ? formats[c](dateObj, locale, config)
+ : c !== "\\"
+ ? c
+ : "";
+ })
+ .join("");
+ };
+ };
+ var createDateParser = function (_a) {
+ var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
+ return function (date, givenFormat, timeless, customLocale) {
+ if (date !== 0 && !date)
+ return undefined;
+ var locale = customLocale || l10n;
+ var parsedDate;
+ var dateOrig = date;
+ if (date instanceof Date)
+ parsedDate = new Date(date.getTime());
+ else if (typeof date !== "string" &&
+ date.toFixed !== undefined // timestamp
+ )
+ // create a copy
+ parsedDate = new Date(date);
+ else if (typeof date === "string") {
+ // date string
+ var format = givenFormat || (config || defaults).dateFormat;
+ var datestr = String(date).trim();
+ if (datestr === "today") {
+ parsedDate = new Date();
+ timeless = true;
+ }
+ else if (config && config.parseDate) {
+ parsedDate = config.parseDate(date, format);
+ }
+ else if (/Z$/.test(datestr) ||
+ /GMT$/.test(datestr) // datestrings w/ timezone
+ ) {
+ parsedDate = new Date(date);
+ }
+ else {
+ var matched = void 0, ops = [];
+ for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
+ var token_1 = format[i];
+ var isBackSlash = token_1 === "\\";
+ var escaped = format[i - 1] === "\\" || isBackSlash;
+ if (tokenRegex[token_1] && !escaped) {
+ regexStr += tokenRegex[token_1];
+ var match = new RegExp(regexStr).exec(date);
+ if (match && (matched = true)) {
+ ops[token_1 !== "Y" ? "push" : "unshift"]({
+ fn: revFormat[token_1],
+ val: match[++matchIndex],
+ });
+ }
+ }
+ else if (!isBackSlash)
+ regexStr += "."; // don't really care
+ }
+ parsedDate =
+ !config || !config.noCalendar
+ ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)
+ : new Date(new Date().setHours(0, 0, 0, 0));
+ ops.forEach(function (_a) {
+ var fn = _a.fn, val = _a.val;
+ return (parsedDate = fn(parsedDate, val, locale) || parsedDate);
+ });
+ parsedDate = matched ? parsedDate : undefined;
+ }
+ }
+ /* istanbul ignore next */
+ if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {
+ config.errorHandler(new Error("Invalid date provided: " + dateOrig));
+ return undefined;
+ }
+ if (timeless === true)
+ parsedDate.setHours(0, 0, 0, 0);
+ return parsedDate;
+ };
+ };
+ /**
+ * Compute the difference in dates, measured in ms
+ */
+ function compareDates(date1, date2, timeless) {
+ if (timeless === void 0) { timeless = true; }
+ if (timeless !== false) {
+ return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -
+ new Date(date2.getTime()).setHours(0, 0, 0, 0));
+ }
+ return date1.getTime() - date2.getTime();
+ }
+ var isBetween = function (ts, ts1, ts2) {
+ return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);
+ };
+ var calculateSecondsSinceMidnight = function (hours, minutes, seconds) {
+ return hours * 3600 + minutes * 60 + seconds;
+ };
+ var parseSeconds = function (secondsSinceMidnight) {
+ var hours = Math.floor(secondsSinceMidnight / 3600), minutes = (secondsSinceMidnight - hours * 3600) / 60;
+ return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60];
+ };
+ var duration = {
+ DAY: 86400000,
+ };
+ function getDefaultHours(config) {
+ var hours = config.defaultHour;
+ var minutes = config.defaultMinute;
+ var seconds = config.defaultSeconds;
+ if (config.minDate !== undefined) {
+ var minHour = config.minDate.getHours();
+ var minMinutes = config.minDate.getMinutes();
+ var minSeconds = config.minDate.getSeconds();
+ if (hours < minHour) {
+ hours = minHour;
+ }
+ if (hours === minHour && minutes < minMinutes) {
+ minutes = minMinutes;
+ }
+ if (hours === minHour && minutes === minMinutes && seconds < minSeconds)
+ seconds = config.minDate.getSeconds();
+ }
+ if (config.maxDate !== undefined) {
+ var maxHr = config.maxDate.getHours();
+ var maxMinutes = config.maxDate.getMinutes();
+ hours = Math.min(hours, maxHr);
+ if (hours === maxHr)
+ minutes = Math.min(maxMinutes, minutes);
+ if (hours === maxHr && minutes === maxMinutes)
+ seconds = config.maxDate.getSeconds();
+ }
+ return { hours: hours, minutes: minutes, seconds: seconds };
+ }
+
+ if (typeof Object.assign !== "function") {
+ Object.assign = function (target) {
+ var args = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+ if (!target) {
+ throw TypeError("Cannot convert undefined or null to object");
+ }
+ var _loop_1 = function (source) {
+ if (source) {
+ Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });
+ }
+ };
+ for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
+ var source = args_1[_a];
+ _loop_1(source);
+ }
+ return target;
+ };
+ }
+
+ var DEBOUNCED_CHANGE_MS = 300;
+ function FlatpickrInstance(element, instanceConfig) {
+ var self = {
+ config: __assign(__assign({}, defaults), flatpickr.defaultConfig),
+ l10n: english,
+ };
+ self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
+ self._handlers = [];
+ self.pluginElements = [];
+ self.loadedPlugins = [];
+ self._bind = bind;
+ self._setHoursFromDate = setHoursFromDate;
+ self._positionCalendar = positionCalendar;
+ self.changeMonth = changeMonth;
+ self.changeYear = changeYear;
+ self.clear = clear;
+ self.close = close;
+ self._createElement = createElement;
+ self.destroy = destroy;
+ self.isEnabled = isEnabled;
+ self.jumpToDate = jumpToDate;
+ self.open = open;
+ self.redraw = redraw;
+ self.set = set;
+ self.setDate = setDate;
+ self.toggle = toggle;
+ function setupHelperFunctions() {
+ self.utils = {
+ getDaysInMonth: function (month, yr) {
+ if (month === void 0) { month = self.currentMonth; }
+ if (yr === void 0) { yr = self.currentYear; }
+ if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))
+ return 29;
+ return self.l10n.daysInMonth[month];
+ },
+ };
+ }
+ function init() {
+ self.element = self.input = element;
+ self.isOpen = false;
+ parseConfig();
+ setupLocale();
+ setupInputs();
+ setupDates();
+ setupHelperFunctions();
+ if (!self.isMobile)
+ build();
+ bindEvents();
+ if (self.selectedDates.length || self.config.noCalendar) {
+ if (self.config.enableTime) {
+ setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : undefined);
+ }
+ updateValue(false);
+ }
+ setCalendarWidth();
+ var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
+ /* TODO: investigate this further
+
+ Currently, there is weird positioning behavior in safari causing pages
+ to scroll up. https://github.com/chmln/flatpickr/issues/563
+
+ However, most browsers are not Safari and positioning is expensive when used
+ in scale. https://github.com/chmln/flatpickr/issues/1096
+ */
+ if (!self.isMobile && isSafari) {
+ positionCalendar();
+ }
+ triggerEvent("onReady");
+ }
+ function bindToInstance(fn) {
+ return fn.bind(self);
+ }
+ function setCalendarWidth() {
+ var config = self.config;
+ if (config.weekNumbers === false && config.showMonths === 1) {
+ return;
+ }
+ else if (config.noCalendar !== true) {
+ window.requestAnimationFrame(function () {
+ if (self.calendarContainer !== undefined) {
+ self.calendarContainer.style.visibility = "hidden";
+ self.calendarContainer.style.display = "block";
+ }
+ if (self.daysContainer !== undefined) {
+ var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;
+ self.daysContainer.style.width = daysWidth + "px";
+ self.calendarContainer.style.width =
+ daysWidth +
+ (self.weekWrapper !== undefined
+ ? self.weekWrapper.offsetWidth
+ : 0) +
+ "px";
+ self.calendarContainer.style.removeProperty("visibility");
+ self.calendarContainer.style.removeProperty("display");
+ }
+ });
+ }
+ }
+ /**
+ * The handler for all events targeting the time inputs
+ */
+ function updateTime(e) {
+ if (self.selectedDates.length === 0) {
+ var defaultDate = self.config.minDate === undefined ||
+ compareDates(new Date(), self.config.minDate) >= 0
+ ? new Date()
+ : new Date(self.config.minDate.getTime());
+ var defaults = getDefaultHours(self.config);
+ defaultDate.setHours(defaults.hours, defaults.minutes, defaults.seconds, defaultDate.getMilliseconds());
+ self.selectedDates = [defaultDate];
+ self.latestSelectedDateObj = defaultDate;
+ }
+ if (e !== undefined && e.type !== "blur") {
+ timeWrapper(e);
+ }
+ var prevValue = self._input.value;
+ setHoursFromInputs();
+ updateValue();
+ if (self._input.value !== prevValue) {
+ self._debouncedChange();
+ }
+ }
+ function ampm2military(hour, amPM) {
+ return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]);
+ }
+ function military2ampm(hour) {
+ switch (hour % 24) {
+ case 0:
+ case 12:
+ return 12;
+ default:
+ return hour % 12;
+ }
+ }
+ /**
+ * Syncs the selected date object time with user's time input
+ */
+ function setHoursFromInputs() {
+ if (self.hourElement === undefined || self.minuteElement === undefined)
+ return;
+ var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined
+ ? (parseInt(self.secondElement.value, 10) || 0) % 60
+ : 0;
+ if (self.amPM !== undefined) {
+ hours = ampm2military(hours, self.amPM.textContent);
+ }
+ var limitMinHours = self.config.minTime !== undefined ||
+ (self.config.minDate &&
+ self.minDateHasTime &&
+ self.latestSelectedDateObj &&
+ compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===
+ 0);
+ var limitMaxHours = self.config.maxTime !== undefined ||
+ (self.config.maxDate &&
+ self.maxDateHasTime &&
+ self.latestSelectedDateObj &&
+ compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===
+ 0);
+ if (self.config.maxTime !== undefined &&
+ self.config.minTime !== undefined &&
+ self.config.minTime > self.config.maxTime) {
+ var minBound = calculateSecondsSinceMidnight(self.config.minTime.getHours(), self.config.minTime.getMinutes(), self.config.minTime.getSeconds());
+ var maxBound = calculateSecondsSinceMidnight(self.config.maxTime.getHours(), self.config.maxTime.getMinutes(), self.config.maxTime.getSeconds());
+ var currentTime = calculateSecondsSinceMidnight(hours, minutes, seconds);
+ if (currentTime > maxBound && currentTime < minBound) {
+ var result = parseSeconds(minBound);
+ hours = result[0];
+ minutes = result[1];
+ seconds = result[2];
+ }
+ }
+ else {
+ if (limitMaxHours) {
+ var maxTime = self.config.maxTime !== undefined
+ ? self.config.maxTime
+ : self.config.maxDate;
+ hours = Math.min(hours, maxTime.getHours());
+ if (hours === maxTime.getHours())
+ minutes = Math.min(minutes, maxTime.getMinutes());
+ if (minutes === maxTime.getMinutes())
+ seconds = Math.min(seconds, maxTime.getSeconds());
+ }
+ if (limitMinHours) {
+ var minTime = self.config.minTime !== undefined
+ ? self.config.minTime
+ : self.config.minDate;
+ hours = Math.max(hours, minTime.getHours());
+ if (hours === minTime.getHours() && minutes < minTime.getMinutes())
+ minutes = minTime.getMinutes();
+ if (minutes === minTime.getMinutes())
+ seconds = Math.max(seconds, minTime.getSeconds());
+ }
+ }
+ setHours(hours, minutes, seconds);
+ }
+ /**
+ * Syncs time input values with a date
+ */
+ function setHoursFromDate(dateObj) {
+ var date = dateObj || self.latestSelectedDateObj;
+ if (date) {
+ setHours(date.getHours(), date.getMinutes(), date.getSeconds());
+ }
+ }
+ /**
+ * Sets the hours, minutes, and optionally seconds
+ * of the latest selected date object and the
+ * corresponding time inputs
+ * @param {Number} hours the hour. whether its military
+ * or am-pm gets inferred from config
+ * @param {Number} minutes the minutes
+ * @param {Number} seconds the seconds (optional)
+ */
+ function setHours(hours, minutes, seconds) {
+ if (self.latestSelectedDateObj !== undefined) {
+ self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);
+ }
+ if (!self.hourElement || !self.minuteElement || self.isMobile)
+ return;
+ self.hourElement.value = pad(!self.config.time_24hr
+ ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0)
+ : hours);
+ self.minuteElement.value = pad(minutes);
+ if (self.amPM !== undefined)
+ self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];
+ if (self.secondElement !== undefined)
+ self.secondElement.value = pad(seconds);
+ }
+ /**
+ * Handles the year input and incrementing events
+ * @param {Event} event the keyup or increment event
+ */
+ function onYearInput(event) {
+ var eventTarget = getEventTarget(event);
+ var year = parseInt(eventTarget.value) + (event.delta || 0);
+ if (year / 1000 > 1 ||
+ (event.key === "Enter" && !/[^\d]/.test(year.toString()))) {
+ changeYear(year);
+ }
+ }
+ /**
+ * Essentially addEventListener + tracking
+ * @param {Element} element the element to addEventListener to
+ * @param {String} event the event name
+ * @param {Function} handler the event handler
+ */
+ function bind(element, event, handler, options) {
+ if (event instanceof Array)
+ return event.forEach(function (ev) { return bind(element, ev, handler, options); });
+ if (element instanceof Array)
+ return element.forEach(function (el) { return bind(el, event, handler, options); });
+ element.addEventListener(event, handler, options);
+ self._handlers.push({
+ remove: function () { return element.removeEventListener(event, handler); },
+ });
+ }
+ function triggerChange() {
+ triggerEvent("onChange");
+ }
+ /**
+ * Adds all the necessary event listeners
+ */
+ function bindEvents() {
+ if (self.config.wrap) {
+ ["open", "close", "toggle", "clear"].forEach(function (evt) {
+ Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) {
+ return bind(el, "click", self[evt]);
+ });
+ });
+ }
+ if (self.isMobile) {
+ setupMobile();
+ return;
+ }
+ var debouncedResize = debounce(onResize, 50);
+ self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);
+ if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))
+ bind(self.daysContainer, "mouseover", function (e) {
+ if (self.config.mode === "range")
+ onMouseOver(getEventTarget(e));
+ });
+ bind(self._input, "keydown", onKeyDown);
+ if (self.calendarContainer !== undefined) {
+ bind(self.calendarContainer, "keydown", onKeyDown);
+ }
+ if (!self.config.inline && !self.config.static)
+ bind(window, "resize", debouncedResize);
+ if (window.ontouchstart !== undefined)
+ bind(window.document, "touchstart", documentClick);
+ else
+ bind(window.document, "mousedown", documentClick);
+ bind(window.document, "focus", documentClick, { capture: true });
+ if (self.config.clickOpens === true) {
+ bind(self._input, "focus", self.open);
+ bind(self._input, "click", self.open);
+ }
+ if (self.daysContainer !== undefined) {
+ bind(self.monthNav, "click", onMonthNavClick);
+ bind(self.monthNav, ["keyup", "increment"], onYearInput);
+ bind(self.daysContainer, "click", selectDate);
+ }
+ if (self.timeContainer !== undefined &&
+ self.minuteElement !== undefined &&
+ self.hourElement !== undefined) {
+ var selText = function (e) {
+ return getEventTarget(e).select();
+ };
+ bind(self.timeContainer, ["increment"], updateTime);
+ bind(self.timeContainer, "blur", updateTime, { capture: true });
+ bind(self.timeContainer, "click", timeIncrement);
+ bind([self.hourElement, self.minuteElement], ["focus", "click"], selText);
+ if (self.secondElement !== undefined)
+ bind(self.secondElement, "focus", function () { return self.secondElement && self.secondElement.select(); });
+ if (self.amPM !== undefined) {
+ bind(self.amPM, "click", function (e) {
+ updateTime(e);
+ triggerChange();
+ });
+ }
+ }
+ if (self.config.allowInput) {
+ bind(self._input, "blur", onBlur);
+ }
+ }
+ /**
+ * Set the calendar view to a particular date.
+ * @param {Date} jumpDate the date to set the view to
+ * @param {boolean} triggerChange if change events should be triggered
+ */
+ function jumpToDate(jumpDate, triggerChange) {
+ var jumpTo = jumpDate !== undefined
+ ? self.parseDate(jumpDate)
+ : self.latestSelectedDateObj ||
+ (self.config.minDate && self.config.minDate > self.now
+ ? self.config.minDate
+ : self.config.maxDate && self.config.maxDate < self.now
+ ? self.config.maxDate
+ : self.now);
+ var oldYear = self.currentYear;
+ var oldMonth = self.currentMonth;
+ try {
+ if (jumpTo !== undefined) {
+ self.currentYear = jumpTo.getFullYear();
+ self.currentMonth = jumpTo.getMonth();
+ }
+ }
+ catch (e) {
+ /* istanbul ignore next */
+ e.message = "Invalid date supplied: " + jumpTo;
+ self.config.errorHandler(e);
+ }
+ if (triggerChange && self.currentYear !== oldYear) {
+ triggerEvent("onYearChange");
+ buildMonthSwitch();
+ }
+ if (triggerChange &&
+ (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {
+ triggerEvent("onMonthChange");
+ }
+ self.redraw();
+ }
+ /**
+ * The up/down arrow handler for time inputs
+ * @param {Event} e the click event
+ */
+ function timeIncrement(e) {
+ var eventTarget = getEventTarget(e);
+ if (~eventTarget.className.indexOf("arrow"))
+ incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1);
+ }
+ /**
+ * Increments/decrements the value of input associ-
+ * ated with the up/down arrow by dispatching an
+ * "increment" event on the input.
+ *
+ * @param {Event} e the click event
+ * @param {Number} delta the diff (usually 1 or -1)
+ * @param {Element} inputElem the input element
+ */
+ function incrementNumInput(e, delta, inputElem) {
+ var target = e && getEventTarget(e);
+ var input = inputElem ||
+ (target && target.parentNode && target.parentNode.firstChild);
+ var event = createEvent("increment");
+ event.delta = delta;
+ input && input.dispatchEvent(event);
+ }
+ function build() {
+ var fragment = window.document.createDocumentFragment();
+ self.calendarContainer = createElement("div", "flatpickr-calendar");
+ self.calendarContainer.tabIndex = -1;
+ if (!self.config.noCalendar) {
+ fragment.appendChild(buildMonthNav());
+ self.innerContainer = createElement("div", "flatpickr-innerContainer");
+ if (self.config.weekNumbers) {
+ var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;
+ self.innerContainer.appendChild(weekWrapper);
+ self.weekNumbers = weekNumbers;
+ self.weekWrapper = weekWrapper;
+ }
+ self.rContainer = createElement("div", "flatpickr-rContainer");
+ self.rContainer.appendChild(buildWeekdays());
+ if (!self.daysContainer) {
+ self.daysContainer = createElement("div", "flatpickr-days");
+ self.daysContainer.tabIndex = -1;
+ }
+ buildDays();
+ self.rContainer.appendChild(self.daysContainer);
+ self.innerContainer.appendChild(self.rContainer);
+ fragment.appendChild(self.innerContainer);
+ }
+ if (self.config.enableTime) {
+ fragment.appendChild(buildTime());
+ }
+ toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range");
+ toggleClass(self.calendarContainer, "animate", self.config.animate === true);
+ toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1);
+ self.calendarContainer.appendChild(fragment);
+ var customAppend = self.config.appendTo !== undefined &&
+ self.config.appendTo.nodeType !== undefined;
+ if (self.config.inline || self.config.static) {
+ self.calendarContainer.classList.add(self.config.inline ? "inline" : "static");
+ if (self.config.inline) {
+ if (!customAppend && self.element.parentNode)
+ self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);
+ else if (self.config.appendTo !== undefined)
+ self.config.appendTo.appendChild(self.calendarContainer);
+ }
+ if (self.config.static) {
+ var wrapper = createElement("div", "flatpickr-wrapper");
+ if (self.element.parentNode)
+ self.element.parentNode.insertBefore(wrapper, self.element);
+ wrapper.appendChild(self.element);
+ if (self.altInput)
+ wrapper.appendChild(self.altInput);
+ wrapper.appendChild(self.calendarContainer);
+ }
+ }
+ if (!self.config.static && !self.config.inline)
+ (self.config.appendTo !== undefined
+ ? self.config.appendTo
+ : window.document.body).appendChild(self.calendarContainer);
+ }
+ function createDay(className, date, dayNumber, i) {
+ var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", "flatpickr-day " + className, date.getDate().toString());
+ dayElement.dateObj = date;
+ dayElement.$i = i;
+ dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat));
+ if (className.indexOf("hidden") === -1 &&
+ compareDates(date, self.now) === 0) {
+ self.todayDateElem = dayElement;
+ dayElement.classList.add("today");
+ dayElement.setAttribute("aria-current", "date");
+ }
+ if (dateIsEnabled) {
+ dayElement.tabIndex = -1;
+ if (isDateSelected(date)) {
+ dayElement.classList.add("selected");
+ self.selectedDateElem = dayElement;
+ if (self.config.mode === "range") {
+ toggleClass(dayElement, "startRange", self.selectedDates[0] &&
+ compareDates(date, self.selectedDates[0], true) === 0);
+ toggleClass(dayElement, "endRange", self.selectedDates[1] &&
+ compareDates(date, self.selectedDates[1], true) === 0);
+ if (className === "nextMonthDay")
+ dayElement.classList.add("inRange");
+ }
+ }
+ }
+ else {
+ dayElement.classList.add("flatpickr-disabled");
+ }
+ if (self.config.mode === "range") {
+ if (isDateInRange(date) && !isDateSelected(date))
+ dayElement.classList.add("inRange");
+ }
+ if (self.weekNumbers &&
+ self.config.showMonths === 1 &&
+ className !== "prevMonthDay" &&
+ dayNumber % 7 === 1) {
+ self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>");
+ }
+ triggerEvent("onDayCreate", dayElement);
+ return dayElement;
+ }
+ function focusOnDayElem(targetNode) {
+ targetNode.focus();
+ if (self.config.mode === "range")
+ onMouseOver(targetNode);
+ }
+ function getFirstAvailableDay(delta) {
+ var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;
+ var endMonth = delta > 0 ? self.config.showMonths : -1;
+ for (var m = startMonth; m != endMonth; m += delta) {
+ var month = self.daysContainer.children[m];
+ var startIndex = delta > 0 ? 0 : month.children.length - 1;
+ var endIndex = delta > 0 ? month.children.length : -1;
+ for (var i = startIndex; i != endIndex; i += delta) {
+ var c = month.children[i];
+ if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj))
+ return c;
+ }
+ }
+ return undefined;
+ }
+ function getNextAvailableDay(current, delta) {
+ var givenMonth = current.className.indexOf("Month") === -1
+ ? current.dateObj.getMonth()
+ : self.currentMonth;
+ var endMonth = delta > 0 ? self.config.showMonths : -1;
+ var loopDelta = delta > 0 ? 1 : -1;
+ for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {
+ var month = self.daysContainer.children[m];
+ var startIndex = givenMonth - self.currentMonth === m
+ ? current.$i + delta
+ : delta < 0
+ ? month.children.length - 1
+ : 0;
+ var numMonthDays = month.children.length;
+ for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {
+ var c = month.children[i];
+ if (c.className.indexOf("hidden") === -1 &&
+ isEnabled(c.dateObj) &&
+ Math.abs(current.$i - i) >= Math.abs(delta))
+ return focusOnDayElem(c);
+ }
+ }
+ self.changeMonth(loopDelta);
+ focusOnDay(getFirstAvailableDay(loopDelta), 0);
+ return undefined;
+ }
+ function focusOnDay(current, offset) {
+ var dayFocused = isInView(document.activeElement || document.body);
+ var startElem = current !== undefined
+ ? current
+ : dayFocused
+ ? document.activeElement
+ : self.selectedDateElem !== undefined && isInView(self.selectedDateElem)
+ ? self.selectedDateElem
+ : self.todayDateElem !== undefined && isInView(self.todayDateElem)
+ ? self.todayDateElem
+ : getFirstAvailableDay(offset > 0 ? 1 : -1);
+ if (startElem === undefined) {
+ self._input.focus();
+ }
+ else if (!dayFocused) {
+ focusOnDayElem(startElem);
+ }
+ else {
+ getNextAvailableDay(startElem, offset);
+ }
+ }
+ function buildMonthDays(year, month) {
+ var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;
+ var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year);
+ var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay";
+ var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;
+ // prepend days from the ending of previous month
+ for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {
+ days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
+ }
+ // Start at 1 since there is no 0th day
+ for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {
+ days.appendChild(createDay("", new Date(year, month, dayNumber), dayNumber, dayIndex));
+ }
+ // append days from the next month
+ for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&
+ (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {
+ days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
+ }
+ //updateNavigationCurrentMonth();
+ var dayContainer = createElement("div", "dayContainer");
+ dayContainer.appendChild(days);
+ return dayContainer;
+ }
+ function buildDays() {
+ if (self.daysContainer === undefined) {
+ return;
+ }
+ clearNode(self.daysContainer);
+ // TODO: week numbers for each month
+ if (self.weekNumbers)
+ clearNode(self.weekNumbers);
+ var frag = document.createDocumentFragment();
+ for (var i = 0; i < self.config.showMonths; i++) {
+ var d = new Date(self.currentYear, self.currentMonth, 1);
+ d.setMonth(self.currentMonth + i);
+ frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));
+ }
+ self.daysContainer.appendChild(frag);
+ self.days = self.daysContainer.firstChild;
+ if (self.config.mode === "range" && self.selectedDates.length === 1) {
+ onMouseOver();
+ }
+ }
+ function buildMonthSwitch() {
+ if (self.config.showMonths > 1 ||
+ self.config.monthSelectorType !== "dropdown")
+ return;
+ var shouldBuildMonth = function (month) {
+ if (self.config.minDate !== undefined &&
+ self.currentYear === self.config.minDate.getFullYear() &&
+ month < self.config.minDate.getMonth()) {
+ return false;
+ }
+ return !(self.config.maxDate !== undefined &&
+ self.currentYear === self.config.maxDate.getFullYear() &&
+ month > self.config.maxDate.getMonth());
+ };
+ self.monthsDropdownContainer.tabIndex = -1;
+ self.monthsDropdownContainer.innerHTML = "";
+ for (var i = 0; i < 12; i++) {
+ if (!shouldBuildMonth(i))
+ continue;
+ var month = createElement("option", "flatpickr-monthDropdown-month");
+ month.value = new Date(self.currentYear, i).getMonth().toString();
+ month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);
+ month.tabIndex = -1;
+ if (self.currentMonth === i) {
+ month.selected = true;
+ }
+ self.monthsDropdownContainer.appendChild(month);
+ }
+ }
+ function buildMonth() {
+ var container = createElement("div", "flatpickr-month");
+ var monthNavFragment = window.document.createDocumentFragment();
+ var monthElement;
+ if (self.config.showMonths > 1 ||
+ self.config.monthSelectorType === "static") {
+ monthElement = createElement("span", "cur-month");
+ }
+ else {
+ self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months");
+ self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel);
+ bind(self.monthsDropdownContainer, "change", function (e) {
+ var target = getEventTarget(e);
+ var selectedMonth = parseInt(target.value, 10);
+ self.changeMonth(selectedMonth - self.currentMonth);
+ triggerEvent("onMonthChange");
+ });
+ buildMonthSwitch();
+ monthElement = self.monthsDropdownContainer;
+ }
+ var yearInput = createNumberInput("cur-year", { tabindex: "-1" });
+ var yearElement = yearInput.getElementsByTagName("input")[0];
+ yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel);
+ if (self.config.minDate) {
+ yearElement.setAttribute("min", self.config.minDate.getFullYear().toString());
+ }
+ if (self.config.maxDate) {
+ yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString());
+ yearElement.disabled =
+ !!self.config.minDate &&
+ self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();
+ }
+ var currentMonth = createElement("div", "flatpickr-current-month");
+ currentMonth.appendChild(monthElement);
+ currentMonth.appendChild(yearInput);
+ monthNavFragment.appendChild(currentMonth);
+ container.appendChild(monthNavFragment);
+ return {
+ container: container,
+ yearElement: yearElement,
+ monthElement: monthElement,
+ };
+ }
+ function buildMonths() {
+ clearNode(self.monthNav);
+ self.monthNav.appendChild(self.prevMonthNav);
+ if (self.config.showMonths) {
+ self.yearElements = [];
+ self.monthElements = [];
+ }
+ for (var m = self.config.showMonths; m--;) {
+ var month = buildMonth();
+ self.yearElements.push(month.yearElement);
+ self.monthElements.push(month.monthElement);
+ self.monthNav.appendChild(month.container);
+ }
+ self.monthNav.appendChild(self.nextMonthNav);
+ }
+ function buildMonthNav() {
+ self.monthNav = createElement("div", "flatpickr-months");
+ self.yearElements = [];
+ self.monthElements = [];
+ self.prevMonthNav = createElement("span", "flatpickr-prev-month");
+ self.prevMonthNav.innerHTML = self.config.prevArrow;
+ self.nextMonthNav = createElement("span", "flatpickr-next-month");
+ self.nextMonthNav.innerHTML = self.config.nextArrow;
+ buildMonths();
+ Object.defineProperty(self, "_hidePrevMonthArrow", {
+ get: function () { return self.__hidePrevMonthArrow; },
+ set: function (bool) {
+ if (self.__hidePrevMonthArrow !== bool) {
+ toggleClass(self.prevMonthNav, "flatpickr-disabled", bool);
+ self.__hidePrevMonthArrow = bool;
+ }
+ },
+ });
+ Object.defineProperty(self, "_hideNextMonthArrow", {
+ get: function () { return self.__hideNextMonthArrow; },
+ set: function (bool) {
+ if (self.__hideNextMonthArrow !== bool) {
+ toggleClass(self.nextMonthNav, "flatpickr-disabled", bool);
+ self.__hideNextMonthArrow = bool;
+ }
+ },
+ });
+ self.currentYearElement = self.yearElements[0];
+ updateNavigationCurrentMonth();
+ return self.monthNav;
+ }
+ function buildTime() {
+ self.calendarContainer.classList.add("hasTime");
+ if (self.config.noCalendar)
+ self.calendarContainer.classList.add("noCalendar");
+ var defaults = getDefaultHours(self.config);
+ self.timeContainer = createElement("div", "flatpickr-time");
+ self.timeContainer.tabIndex = -1;
+ var separator = createElement("span", "flatpickr-time-separator", ":");
+ var hourInput = createNumberInput("flatpickr-hour", {
+ "aria-label": self.l10n.hourAriaLabel,
+ });
+ self.hourElement = hourInput.getElementsByTagName("input")[0];
+ var minuteInput = createNumberInput("flatpickr-minute", {
+ "aria-label": self.l10n.minuteAriaLabel,
+ });
+ self.minuteElement = minuteInput.getElementsByTagName("input")[0];
+ self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;
+ self.hourElement.value = pad(self.latestSelectedDateObj
+ ? self.latestSelectedDateObj.getHours()
+ : self.config.time_24hr
+ ? defaults.hours
+ : military2ampm(defaults.hours));
+ self.minuteElement.value = pad(self.latestSelectedDateObj
+ ? self.latestSelectedDateObj.getMinutes()
+ : defaults.minutes);
+ self.hourElement.setAttribute("step", self.config.hourIncrement.toString());
+ self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString());
+ self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1");
+ self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12");
+ self.hourElement.setAttribute("maxlength", "2");
+ self.minuteElement.setAttribute("min", "0");
+ self.minuteElement.setAttribute("max", "59");
+ self.minuteElement.setAttribute("maxlength", "2");
+ self.timeContainer.appendChild(hourInput);
+ self.timeContainer.appendChild(separator);
+ self.timeContainer.appendChild(minuteInput);
+ if (self.config.time_24hr)
+ self.timeContainer.classList.add("time24hr");
+ if (self.config.enableSeconds) {
+ self.timeContainer.classList.add("hasSeconds");
+ var secondInput = createNumberInput("flatpickr-second");
+ self.secondElement = secondInput.getElementsByTagName("input")[0];
+ self.secondElement.value = pad(self.latestSelectedDateObj
+ ? self.latestSelectedDateObj.getSeconds()
+ : defaults.seconds);
+ self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step"));
+ self.secondElement.setAttribute("min", "0");
+ self.secondElement.setAttribute("max", "59");
+ self.secondElement.setAttribute("maxlength", "2");
+ self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":"));
+ self.timeContainer.appendChild(secondInput);
+ }
+ if (!self.config.time_24hr) {
+ // add self.amPM if appropriate
+ self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj
+ ? self.hourElement.value
+ : self.config.defaultHour) > 11)]);
+ self.amPM.title = self.l10n.toggleTitle;
+ self.amPM.tabIndex = -1;
+ self.timeContainer.appendChild(self.amPM);
+ }
+ return self.timeContainer;
+ }
+ function buildWeekdays() {
+ if (!self.weekdayContainer)
+ self.weekdayContainer = createElement("div", "flatpickr-weekdays");
+ else
+ clearNode(self.weekdayContainer);
+ for (var i = self.config.showMonths; i--;) {
+ var container = createElement("div", "flatpickr-weekdaycontainer");
+ self.weekdayContainer.appendChild(container);
+ }
+ updateWeekdays();
+ return self.weekdayContainer;
+ }
+ function updateWeekdays() {
+ if (!self.weekdayContainer) {
+ return;
+ }
+ var firstDayOfWeek = self.l10n.firstDayOfWeek;
+ var weekdays = __spreadArrays(self.l10n.weekdays.shorthand);
+ if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {
+ weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek));
+ }
+ for (var i = self.config.showMonths; i--;) {
+ self.weekdayContainer.children[i].innerHTML = "\n <span class='flatpickr-weekday'>\n " + weekdays.join("</span><span class='flatpickr-weekday'>") + "\n </span>\n ";
+ }
+ }
+ /* istanbul ignore next */
+ function buildWeeks() {
+ self.calendarContainer.classList.add("hasWeeks");
+ var weekWrapper = createElement("div", "flatpickr-weekwrapper");
+ weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation));
+ var weekNumbers = createElement("div", "flatpickr-weeks");
+ weekWrapper.appendChild(weekNumbers);
+ return {
+ weekWrapper: weekWrapper,
+ weekNumbers: weekNumbers,
+ };
+ }
+ function changeMonth(value, isOffset) {
+ if (isOffset === void 0) { isOffset = true; }
+ var delta = isOffset ? value : value - self.currentMonth;
+ if ((delta < 0 && self._hidePrevMonthArrow === true) ||
+ (delta > 0 && self._hideNextMonthArrow === true))
+ return;
+ self.currentMonth += delta;
+ if (self.currentMonth < 0 || self.currentMonth > 11) {
+ self.currentYear += self.currentMonth > 11 ? 1 : -1;
+ self.currentMonth = (self.currentMonth + 12) % 12;
+ triggerEvent("onYearChange");
+ buildMonthSwitch();
+ }
+ buildDays();
+ triggerEvent("onMonthChange");
+ updateNavigationCurrentMonth();
+ }
+ function clear(triggerChangeEvent, toInitial) {
+ if (triggerChangeEvent === void 0) { triggerChangeEvent = true; }
+ if (toInitial === void 0) { toInitial = true; }
+ self.input.value = "";
+ if (self.altInput !== undefined)
+ self.altInput.value = "";
+ if (self.mobileInput !== undefined)
+ self.mobileInput.value = "";
+ self.selectedDates = [];
+ self.latestSelectedDateObj = undefined;
+ if (toInitial === true) {
+ self.currentYear = self._initialDate.getFullYear();
+ self.currentMonth = self._initialDate.getMonth();
+ }
+ if (self.config.enableTime === true) {
+ var _a = getDefaultHours(self.config), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds;
+ setHours(hours, minutes, seconds);
+ }
+ self.redraw();
+ if (triggerChangeEvent)
+ // triggerChangeEvent is true (default) or an Event
+ triggerEvent("onChange");
+ }
+ function close() {
+ self.isOpen = false;
+ if (!self.isMobile) {
+ if (self.calendarContainer !== undefined) {
+ self.calendarContainer.classList.remove("open");
+ }
+ if (self._input !== undefined) {
+ self._input.classList.remove("active");
+ }
+ }
+ triggerEvent("onClose");
+ }
+ function destroy() {
+ if (self.config !== undefined)
+ triggerEvent("onDestroy");
+ for (var i = self._handlers.length; i--;) {
+ self._handlers[i].remove();
+ }
+ self._handlers = [];
+ if (self.mobileInput) {
+ if (self.mobileInput.parentNode)
+ self.mobileInput.parentNode.removeChild(self.mobileInput);
+ self.mobileInput = undefined;
+ }
+ else if (self.calendarContainer && self.calendarContainer.parentNode) {
+ if (self.config.static && self.calendarContainer.parentNode) {
+ var wrapper = self.calendarContainer.parentNode;
+ wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);
+ if (wrapper.parentNode) {
+ while (wrapper.firstChild)
+ wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);
+ wrapper.parentNode.removeChild(wrapper);
+ }
+ }
+ else
+ self.calendarContainer.parentNode.removeChild(self.calendarContainer);
+ }
+ if (self.altInput) {
+ self.input.type = "text";
+ if (self.altInput.parentNode)
+ self.altInput.parentNode.removeChild(self.altInput);
+ delete self.altInput;
+ }
+ if (self.input) {
+ self.input.type = self.input._type;
+ self.input.classList.remove("flatpickr-input");
+ self.input.removeAttribute("readonly");
+ }
+ [
+ "_showTimeInput",
+ "latestSelectedDateObj",
+ "_hideNextMonthArrow",
+ "_hidePrevMonthArrow",
+ "__hideNextMonthArrow",
+ "__hidePrevMonthArrow",
+ "isMobile",
+ "isOpen",
+ "selectedDateElem",
+ "minDateHasTime",
+ "maxDateHasTime",
+ "days",
+ "daysContainer",
+ "_input",
+ "_positionElement",
+ "innerContainer",
+ "rContainer",
+ "monthNav",
+ "todayDateElem",
+ "calendarContainer",
+ "weekdayContainer",
+ "prevMonthNav",
+ "nextMonthNav",
+ "monthsDropdownContainer",
+ "currentMonthElement",
+ "currentYearElement",
+ "navigationCurrentMonth",
+ "selectedDateElem",
+ "config",
+ ].forEach(function (k) {
+ try {
+ delete self[k];
+ }
+ catch (_) { }
+ });
+ }
+ function isCalendarElem(elem) {
+ if (self.config.appendTo && self.config.appendTo.contains(elem))
+ return true;
+ return self.calendarContainer.contains(elem);
+ }
+ function documentClick(e) {
+ if (self.isOpen && !self.config.inline) {
+ var eventTarget_1 = getEventTarget(e);
+ var isCalendarElement = isCalendarElem(eventTarget_1);
+ var isInput = eventTarget_1 === self.input ||
+ eventTarget_1 === self.altInput ||
+ self.element.contains(eventTarget_1) ||
+ // web components
+ // e.path is not present in all browsers. circumventing typechecks
+ (e.path &&
+ e.path.indexOf &&
+ (~e.path.indexOf(self.input) ||
+ ~e.path.indexOf(self.altInput)));
+ var lostFocus = e.type === "blur"
+ ? isInput &&
+ e.relatedTarget &&
+ !isCalendarElem(e.relatedTarget)
+ : !isInput &&
+ !isCalendarElement &&
+ !isCalendarElem(e.relatedTarget);
+ var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {
+ return elem.contains(eventTarget_1);
+ });
+ if (lostFocus && isIgnored) {
+ if (self.timeContainer !== undefined &&
+ self.minuteElement !== undefined &&
+ self.hourElement !== undefined &&
+ self.input.value !== "" &&
+ self.input.value !== undefined) {
+ updateTime();
+ }
+ self.close();
+ if (self.config &&
+ self.config.mode === "range" &&
+ self.selectedDates.length === 1) {
+ self.clear(false);
+ self.redraw();
+ }
+ }
+ }
+ }
+ function changeYear(newYear) {
+ if (!newYear ||
+ (self.config.minDate && newYear < self.config.minDate.getFullYear()) ||
+ (self.config.maxDate && newYear > self.config.maxDate.getFullYear()))
+ return;
+ var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;
+ self.currentYear = newYearNum || self.currentYear;
+ if (self.config.maxDate &&
+ self.currentYear === self.config.maxDate.getFullYear()) {
+ self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);
+ }
+ else if (self.config.minDate &&
+ self.currentYear === self.config.minDate.getFullYear()) {
+ self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);
+ }
+ if (isNewYear) {
+ self.redraw();
+ triggerEvent("onYearChange");
+ buildMonthSwitch();
+ }
+ }
+ function isEnabled(date, timeless) {
+ var _a;
+ if (timeless === void 0) { timeless = true; }
+ var dateToCheck = self.parseDate(date, undefined, timeless); // timeless
+ if ((self.config.minDate &&
+ dateToCheck &&
+ compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||
+ (self.config.maxDate &&
+ dateToCheck &&
+ compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0))
+ return false;
+ if (!self.config.enable && self.config.disable.length === 0)
+ return true;
+ if (dateToCheck === undefined)
+ return false;
+ var bool = !!self.config.enable, array = (_a = self.config.enable) !== null && _a !== void 0 ? _a : self.config.disable;
+ for (var i = 0, d = void 0; i < array.length; i++) {
+ d = array[i];
+ if (typeof d === "function" &&
+ d(dateToCheck) // disabled by function
+ )
+ return bool;
+ else if (d instanceof Date &&
+ dateToCheck !== undefined &&
+ d.getTime() === dateToCheck.getTime())
+ // disabled by date
+ return bool;
+ else if (typeof d === "string") {
+ // disabled by date string
+ var parsed = self.parseDate(d, undefined, true);
+ return parsed && parsed.getTime() === dateToCheck.getTime()
+ ? bool
+ : !bool;
+ }
+ else if (
+ // disabled by range
+ typeof d === "object" &&
+ dateToCheck !== undefined &&
+ d.from &&
+ d.to &&
+ dateToCheck.getTime() >= d.from.getTime() &&
+ dateToCheck.getTime() <= d.to.getTime())
+ return bool;
+ }
+ return !bool;
+ }
+ function isInView(elem) {
+ if (self.daysContainer !== undefined)
+ return (elem.className.indexOf("hidden") === -1 &&
+ elem.className.indexOf("flatpickr-disabled") === -1 &&
+ self.daysContainer.contains(elem));
+ return false;
+ }
+ function onBlur(e) {
+ var isInput = e.target === self._input;
+ if (isInput &&
+ (self.selectedDates.length > 0 || self._input.value.length > 0) &&
+ !(e.relatedTarget && isCalendarElem(e.relatedTarget))) {
+ self.setDate(self._input.value, true, e.target === self.altInput
+ ? self.config.altFormat
+ : self.config.dateFormat);
+ }
+ }
+ function onKeyDown(e) {
+ // e.key e.keyCode
+ // "Backspace" 8
+ // "Tab" 9
+ // "Enter" 13
+ // "Escape" (IE "Esc") 27
+ // "ArrowLeft" (IE "Left") 37
+ // "ArrowUp" (IE "Up") 38
+ // "ArrowRight" (IE "Right") 39
+ // "ArrowDown" (IE "Down") 40
+ // "Delete" (IE "Del") 46
+ var eventTarget = getEventTarget(e);
+ var isInput = self.config.wrap
+ ? element.contains(eventTarget)
+ : eventTarget === self._input;
+ var allowInput = self.config.allowInput;
+ var allowKeydown = self.isOpen && (!allowInput || !isInput);
+ var allowInlineKeydown = self.config.inline && isInput && !allowInput;
+ if (e.keyCode === 13 && isInput) {
+ if (allowInput) {
+ self.setDate(self._input.value, true, eventTarget === self.altInput
+ ? self.config.altFormat
+ : self.config.dateFormat);
+ return eventTarget.blur();
+ }
+ else {
+ self.open();
+ }
+ }
+ else if (isCalendarElem(eventTarget) ||
+ allowKeydown ||
+ allowInlineKeydown) {
+ var isTimeObj = !!self.timeContainer &&
+ self.timeContainer.contains(eventTarget);
+ switch (e.keyCode) {
+ case 13:
+ if (isTimeObj) {
+ e.preventDefault();
+ updateTime();
+ focusAndClose();
+ }
+ else
+ selectDate(e);
+ break;
+ case 27: // escape
+ e.preventDefault();
+ focusAndClose();
+ break;
+ case 8:
+ case 46:
+ if (isInput && !self.config.allowInput) {
+ e.preventDefault();
+ self.clear();
+ }
+ break;
+ case 37:
+ case 39:
+ if (!isTimeObj && !isInput) {
+ e.preventDefault();
+ if (self.daysContainer !== undefined &&
+ (allowInput === false ||
+ (document.activeElement && isInView(document.activeElement)))) {
+ var delta_1 = e.keyCode === 39 ? 1 : -1;
+ if (!e.ctrlKey)
+ focusOnDay(undefined, delta_1);
+ else {
+ e.stopPropagation();
+ changeMonth(delta_1);
+ focusOnDay(getFirstAvailableDay(1), 0);
+ }
+ }
+ }
+ else if (self.hourElement)
+ self.hourElement.focus();
+ break;
+ case 38:
+ case 40:
+ e.preventDefault();
+ var delta = e.keyCode === 40 ? 1 : -1;
+ if ((self.daysContainer &&
+ eventTarget.$i !== undefined) ||
+ eventTarget === self.input ||
+ eventTarget === self.altInput) {
+ if (e.ctrlKey) {
+ e.stopPropagation();
+ changeYear(self.currentYear - delta);
+ focusOnDay(getFirstAvailableDay(1), 0);
+ }
+ else if (!isTimeObj)
+ focusOnDay(undefined, delta * 7);
+ }
+ else if (eventTarget === self.currentYearElement) {
+ changeYear(self.currentYear - delta);
+ }
+ else if (self.config.enableTime) {
+ if (!isTimeObj && self.hourElement)
+ self.hourElement.focus();
+ updateTime(e);
+ self._debouncedChange();
+ }
+ break;
+ case 9:
+ if (isTimeObj) {
+ var elems = [
+ self.hourElement,
+ self.minuteElement,
+ self.secondElement,
+ self.amPM,
+ ]
+ .concat(self.pluginElements)
+ .filter(function (x) { return x; });
+ var i = elems.indexOf(eventTarget);
+ if (i !== -1) {
+ var target = elems[i + (e.shiftKey ? -1 : 1)];
+ e.preventDefault();
+ (target || self._input).focus();
+ }
+ }
+ else if (!self.config.noCalendar &&
+ self.daysContainer &&
+ self.daysContainer.contains(eventTarget) &&
+ e.shiftKey) {
+ e.preventDefault();
+ self._input.focus();
+ }
+ break;
+ }
+ }
+ if (self.amPM !== undefined && eventTarget === self.amPM) {
+ switch (e.key) {
+ case self.l10n.amPM[0].charAt(0):
+ case self.l10n.amPM[0].charAt(0).toLowerCase():
+ self.amPM.textContent = self.l10n.amPM[0];
+ setHoursFromInputs();
+ updateValue();
+ break;
+ case self.l10n.amPM[1].charAt(0):
+ case self.l10n.amPM[1].charAt(0).toLowerCase():
+ self.amPM.textContent = self.l10n.amPM[1];
+ setHoursFromInputs();
+ updateValue();
+ break;
+ }
+ }
+ if (isInput || isCalendarElem(eventTarget)) {
+ triggerEvent("onKeyDown", e);
+ }
+ }
+ function onMouseOver(elem) {
+ if (self.selectedDates.length !== 1 ||
+ (elem &&
+ (!elem.classList.contains("flatpickr-day") ||
+ elem.classList.contains("flatpickr-disabled"))))
+ return;
+ var hoverDate = elem
+ ? elem.dateObj.getTime()
+ : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());
+ var containsDisabled = false;
+ var minRange = 0, maxRange = 0;
+ for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {
+ if (!isEnabled(new Date(t), true)) {
+ containsDisabled =
+ containsDisabled || (t > rangeStartDate && t < rangeEndDate);
+ if (t < initialDate && (!minRange || t > minRange))
+ minRange = t;
+ else if (t > initialDate && (!maxRange || t < maxRange))
+ maxRange = t;
+ }
+ }
+ for (var m = 0; m < self.config.showMonths; m++) {
+ var month = self.daysContainer.children[m];
+ var _loop_1 = function (i, l) {
+ var dayElem = month.children[i], date = dayElem.dateObj;
+ var timestamp = date.getTime();
+ var outOfRange = (minRange > 0 && timestamp < minRange) ||
+ (maxRange > 0 && timestamp > maxRange);
+ if (outOfRange) {
+ dayElem.classList.add("notAllowed");
+ ["inRange", "startRange", "endRange"].forEach(function (c) {
+ dayElem.classList.remove(c);
+ });
+ return "continue";
+ }
+ else if (containsDisabled && !outOfRange)
+ return "continue";
+ ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) {
+ dayElem.classList.remove(c);
+ });
+ if (elem !== undefined) {
+ elem.classList.add(hoverDate <= self.selectedDates[0].getTime()
+ ? "startRange"
+ : "endRange");
+ if (initialDate < hoverDate && timestamp === initialDate)
+ dayElem.classList.add("startRange");
+ else if (initialDate > hoverDate && timestamp === initialDate)
+ dayElem.classList.add("endRange");
+ if (timestamp >= minRange &&
+ (maxRange === 0 || timestamp <= maxRange) &&
+ isBetween(timestamp, initialDate, hoverDate))
+ dayElem.classList.add("inRange");
+ }
+ };
+ for (var i = 0, l = month.children.length; i < l; i++) {
+ _loop_1(i, l);
+ }
+ }
+ }
+ function onResize() {
+ if (self.isOpen && !self.config.static && !self.config.inline)
+ positionCalendar();
+ }
+ function open(e, positionElement) {
+ if (positionElement === void 0) { positionElement = self._positionElement; }
+ if (self.isMobile === true) {
+ if (e) {
+ e.preventDefault();
+ var eventTarget = getEventTarget(e);
+ if (eventTarget) {
+ eventTarget.blur();
+ }
+ }
+ if (self.mobileInput !== undefined) {
+ self.mobileInput.focus();
+ self.mobileInput.click();
+ }
+ triggerEvent("onOpen");
+ return;
+ }
+ else if (self._input.disabled || self.config.inline) {
+ return;
+ }
+ var wasOpen = self.isOpen;
+ self.isOpen = true;
+ if (!wasOpen) {
+ self.calendarContainer.classList.add("open");
+ self._input.classList.add("active");
+ triggerEvent("onOpen");
+ positionCalendar(positionElement);
+ }
+ if (self.config.enableTime === true && self.config.noCalendar === true) {
+ if (self.config.allowInput === false &&
+ (e === undefined ||
+ !self.timeContainer.contains(e.relatedTarget))) {
+ setTimeout(function () { return self.hourElement.select(); }, 50);
+ }
+ }
+ }
+ function minMaxDateSetter(type) {
+ return function (date) {
+ var dateObj = (self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat));
+ var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"];
+ if (dateObj !== undefined) {
+ self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] =
+ dateObj.getHours() > 0 ||
+ dateObj.getMinutes() > 0 ||
+ dateObj.getSeconds() > 0;
+ }
+ if (self.selectedDates) {
+ self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });
+ if (!self.selectedDates.length && type === "min")
+ setHoursFromDate(dateObj);
+ updateValue();
+ }
+ if (self.daysContainer) {
+ redraw();
+ if (dateObj !== undefined)
+ self.currentYearElement[type] = dateObj.getFullYear().toString();
+ else
+ self.currentYearElement.removeAttribute(type);
+ self.currentYearElement.disabled =
+ !!inverseDateObj &&
+ dateObj !== undefined &&
+ inverseDateObj.getFullYear() === dateObj.getFullYear();
+ }
+ };
+ }
+ function parseConfig() {
+ var boolOpts = [
+ "wrap",
+ "weekNumbers",
+ "allowInput",
+ "allowInvalidPreload",
+ "clickOpens",
+ "time_24hr",
+ "enableTime",
+ "noCalendar",
+ "altInput",
+ "shorthandCurrentMonth",
+ "inline",
+ "static",
+ "enableSeconds",
+ "disableMobile",
+ ];
+ var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig);
+ var formats = {};
+ self.config.parseDate = userConfig.parseDate;
+ self.config.formatDate = userConfig.formatDate;
+ Object.defineProperty(self.config, "enable", {
+ get: function () { return self.config._enable; },
+ set: function (dates) {
+ self.config._enable = parseDateRules(dates);
+ },
+ });
+ Object.defineProperty(self.config, "disable", {
+ get: function () { return self.config._disable; },
+ set: function (dates) {
+ self.config._disable = parseDateRules(dates);
+ },
+ });
+ var timeMode = userConfig.mode === "time";
+ if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {
+ var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;
+ formats.dateFormat =
+ userConfig.noCalendar || timeMode
+ ? "H:i" + (userConfig.enableSeconds ? ":S" : "")
+ : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : "");
+ }
+ if (userConfig.altInput &&
+ (userConfig.enableTime || timeMode) &&
+ !userConfig.altFormat) {
+ var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;
+ formats.altFormat =
+ userConfig.noCalendar || timeMode
+ ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K")
+ : defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K");
+ }
+ Object.defineProperty(self.config, "minDate", {
+ get: function () { return self.config._minDate; },
+ set: minMaxDateSetter("min"),
+ });
+ Object.defineProperty(self.config, "maxDate", {
+ get: function () { return self.config._maxDate; },
+ set: minMaxDateSetter("max"),
+ });
+ var minMaxTimeSetter = function (type) { return function (val) {
+ self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S");
+ }; };
+ Object.defineProperty(self.config, "minTime", {
+ get: function () { return self.config._minTime; },
+ set: minMaxTimeSetter("min"),
+ });
+ Object.defineProperty(self.config, "maxTime", {
+ get: function () { return self.config._maxTime; },
+ set: minMaxTimeSetter("max"),
+ });
+ if (userConfig.mode === "time") {
+ self.config.noCalendar = true;
+ self.config.enableTime = true;
+ }
+ Object.assign(self.config, formats, userConfig);
+ for (var i = 0; i < boolOpts.length; i++)
+ // https://github.com/microsoft/TypeScript/issues/31663
+ self.config[boolOpts[i]] =
+ self.config[boolOpts[i]] === true ||
+ self.config[boolOpts[i]] === "true";
+ HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {
+ self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);
+ });
+ self.isMobile =
+ !self.config.disableMobile &&
+ !self.config.inline &&
+ self.config.mode === "single" &&
+ !self.config.disable.length &&
+ !self.config.enable &&
+ !self.config.weekNumbers &&
+ /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
+ for (var i = 0; i < self.config.plugins.length; i++) {
+ var pluginConf = self.config.plugins[i](self) || {};
+ for (var key in pluginConf) {
+ if (HOOKS.indexOf(key) > -1) {
+ self.config[key] = arrayify(pluginConf[key])
+ .map(bindToInstance)
+ .concat(self.config[key]);
+ }
+ else if (typeof userConfig[key] === "undefined")
+ self.config[key] = pluginConf[key];
+ }
+ }
+ if (!userConfig.altInputClass) {
+ self.config.altInputClass =
+ getInputElem().className + " " + self.config.altInputClass;
+ }
+ triggerEvent("onParseConfig");
+ }
+ function getInputElem() {
+ return self.config.wrap
+ ? element.querySelector("[data-input]")
+ : element;
+ }
+ function setupLocale() {
+ if (typeof self.config.locale !== "object" &&
+ typeof flatpickr.l10ns[self.config.locale] === "undefined")
+ self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale));
+ self.l10n = __assign(__assign({}, flatpickr.l10ns.default), (typeof self.config.locale === "object"
+ ? self.config.locale
+ : self.config.locale !== "default"
+ ? flatpickr.l10ns[self.config.locale]
+ : undefined));
+ tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")";
+ var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {})));
+ if (userConfig.time_24hr === undefined &&
+ flatpickr.defaultConfig.time_24hr === undefined) {
+ self.config.time_24hr = self.l10n.time_24hr;
+ }
+ self.formatDate = createDateFormatter(self);
+ self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
+ }
+ function positionCalendar(customPositionElement) {
+ if (typeof self.config.position === "function") {
+ return void self.config.position(self, customPositionElement);
+ }
+ if (self.calendarContainer === undefined)
+ return;
+ triggerEvent("onPreCalendarPosition");
+ var positionElement = customPositionElement || self._positionElement;
+ var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" ||
+ (configPosVertical !== "below" &&
+ distanceFromBottom < calendarHeight &&
+ inputBounds.top > calendarHeight);
+ var top = window.pageYOffset +
+ inputBounds.top +
+ (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);
+ toggleClass(self.calendarContainer, "arrowTop", !showOnTop);
+ toggleClass(self.calendarContainer, "arrowBottom", showOnTop);
+ if (self.config.inline)
+ return;
+ var left = window.pageXOffset + inputBounds.left;
+ var isCenter = false;
+ var isRight = false;
+ if (configPosHorizontal === "center") {
+ left -= (calendarWidth - inputBounds.width) / 2;
+ isCenter = true;
+ }
+ else if (configPosHorizontal === "right") {
+ left -= calendarWidth - inputBounds.width;
+ isRight = true;
+ }
+ toggleClass(self.calendarContainer, "arrowLeft", !isCenter && !isRight);
+ toggleClass(self.calendarContainer, "arrowCenter", isCenter);
+ toggleClass(self.calendarContainer, "arrowRight", isRight);
+ var right = window.document.body.offsetWidth -
+ (window.pageXOffset + inputBounds.right);
+ var rightMost = left + calendarWidth > window.document.body.offsetWidth;
+ var centerMost = right + calendarWidth > window.document.body.offsetWidth;
+ toggleClass(self.calendarContainer, "rightMost", rightMost);
+ if (self.config.static)
+ return;
+ self.calendarContainer.style.top = top + "px";
+ if (!rightMost) {
+ self.calendarContainer.style.left = left + "px";
+ self.calendarContainer.style.right = "auto";
+ }
+ else if (!centerMost) {
+ self.calendarContainer.style.left = "auto";
+ self.calendarContainer.style.right = right + "px";
+ }
+ else {
+ var doc = getDocumentStyleSheet();
+ // some testing environments don't have css support
+ if (doc === undefined)
+ return;
+ var bodyWidth = window.document.body.offsetWidth;
+ var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);
+ var centerBefore = ".flatpickr-calendar.centerMost:before";
+ var centerAfter = ".flatpickr-calendar.centerMost:after";
+ var centerIndex = doc.cssRules.length;
+ var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}";
+ toggleClass(self.calendarContainer, "rightMost", false);
+ toggleClass(self.calendarContainer, "centerMost", true);
+ doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex);
+ self.calendarContainer.style.left = centerLeft + "px";
+ self.calendarContainer.style.right = "auto";
+ }
+ }
+ function getDocumentStyleSheet() {
+ var editableSheet = null;
+ for (var i = 0; i < document.styleSheets.length; i++) {
+ var sheet = document.styleSheets[i];
+ try {
+ sheet.cssRules;
+ }
+ catch (err) {
+ continue;
+ }
+ editableSheet = sheet;
+ break;
+ }
+ return editableSheet != null ? editableSheet : createStyleSheet();
+ }
+ function createStyleSheet() {
+ var style = document.createElement("style");
+ document.head.appendChild(style);
+ return style.sheet;
+ }
+ function redraw() {
+ if (self.config.noCalendar || self.isMobile)
+ return;
+ buildMonthSwitch();
+ updateNavigationCurrentMonth();
+ buildDays();
+ }
+ function focusAndClose() {
+ self._input.focus();
+ if (window.navigator.userAgent.indexOf("MSIE") !== -1 ||
+ navigator.msMaxTouchPoints !== undefined) {
+ // hack - bugs in the way IE handles focus keeps the calendar open
+ setTimeout(self.close, 0);
+ }
+ else {
+ self.close();
+ }
+ }
+ function selectDate(e) {
+ e.preventDefault();
+ e.stopPropagation();
+ var isSelectable = function (day) {
+ return day.classList &&
+ day.classList.contains("flatpickr-day") &&
+ !day.classList.contains("flatpickr-disabled") &&
+ !day.classList.contains("notAllowed");
+ };
+ var t = findParent(getEventTarget(e), isSelectable);
+ if (t === undefined)
+ return;
+ var target = t;
+ var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));
+ var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||
+ selectedDate.getMonth() >
+ self.currentMonth + self.config.showMonths - 1) &&
+ self.config.mode !== "range";
+ self.selectedDateElem = target;
+ if (self.config.mode === "single")
+ self.selectedDates = [selectedDate];
+ else if (self.config.mode === "multiple") {
+ var selectedIndex = isDateSelected(selectedDate);
+ if (selectedIndex)
+ self.selectedDates.splice(parseInt(selectedIndex), 1);
+ else
+ self.selectedDates.push(selectedDate);
+ }
+ else if (self.config.mode === "range") {
+ if (self.selectedDates.length === 2) {
+ self.clear(false, false);
+ }
+ self.latestSelectedDateObj = selectedDate;
+ self.selectedDates.push(selectedDate);
+ // unless selecting same date twice, sort ascendingly
+ if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)
+ self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
+ }
+ setHoursFromInputs();
+ if (shouldChangeMonth) {
+ var isNewYear = self.currentYear !== selectedDate.getFullYear();
+ self.currentYear = selectedDate.getFullYear();
+ self.currentMonth = selectedDate.getMonth();
+ if (isNewYear) {
+ triggerEvent("onYearChange");
+ buildMonthSwitch();
+ }
+ triggerEvent("onMonthChange");
+ }
+ updateNavigationCurrentMonth();
+ buildDays();
+ updateValue();
+ // maintain focus
+ if (!shouldChangeMonth &&
+ self.config.mode !== "range" &&
+ self.config.showMonths === 1)
+ focusOnDayElem(target);
+ else if (self.selectedDateElem !== undefined &&
+ self.hourElement === undefined) {
+ self.selectedDateElem && self.selectedDateElem.focus();
+ }
+ if (self.hourElement !== undefined)
+ self.hourElement !== undefined && self.hourElement.focus();
+ if (self.config.closeOnSelect) {
+ var single = self.config.mode === "single" && !self.config.enableTime;
+ var range = self.config.mode === "range" &&
+ self.selectedDates.length === 2 &&
+ !self.config.enableTime;
+ if (single || range) {
+ focusAndClose();
+ }
+ }
+ triggerChange();
+ }
+ var CALLBACKS = {
+ locale: [setupLocale, updateWeekdays],
+ showMonths: [buildMonths, setCalendarWidth, buildWeekdays],
+ minDate: [jumpToDate],
+ maxDate: [jumpToDate],
+ positionElement: [updatePositionElement],
+ clickOpens: [
+ function () {
+ if (self.config.clickOpens === true) {
+ bind(self._input, "focus", self.open);
+ bind(self._input, "click", self.open);
+ }
+ else {
+ self._input.removeEventListener("focus", self.open);
+ self._input.removeEventListener("click", self.open);
+ }
+ },
+ ],
+ };
+ function set(option, value) {
+ if (option !== null && typeof option === "object") {
+ Object.assign(self.config, option);
+ for (var key in option) {
+ if (CALLBACKS[key] !== undefined)
+ CALLBACKS[key].forEach(function (x) { return x(); });
+ }
+ }
+ else {
+ self.config[option] = value;
+ if (CALLBACKS[option] !== undefined)
+ CALLBACKS[option].forEach(function (x) { return x(); });
+ else if (HOOKS.indexOf(option) > -1)
+ self.config[option] = arrayify(value);
+ }
+ self.redraw();
+ updateValue(true);
+ }
+ function setSelectedDate(inputDate, format) {
+ var dates = [];
+ if (inputDate instanceof Array)
+ dates = inputDate.map(function (d) { return self.parseDate(d, format); });
+ else if (inputDate instanceof Date || typeof inputDate === "number")
+ dates = [self.parseDate(inputDate, format)];
+ else if (typeof inputDate === "string") {
+ switch (self.config.mode) {
+ case "single":
+ case "time":
+ dates = [self.parseDate(inputDate, format)];
+ break;
+ case "multiple":
+ dates = inputDate
+ .split(self.config.conjunction)
+ .map(function (date) { return self.parseDate(date, format); });
+ break;
+ case "range":
+ dates = inputDate
+ .split(self.l10n.rangeSeparator)
+ .map(function (date) { return self.parseDate(date, format); });
+ break;
+ }
+ }
+ else
+ self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate)));
+ self.selectedDates = (self.config.allowInvalidPreload
+ ? dates
+ : dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); }));
+ if (self.config.mode === "range")
+ self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
+ }
+ function setDate(date, triggerChange, format) {
+ if (triggerChange === void 0) { triggerChange = false; }
+ if (format === void 0) { format = self.config.dateFormat; }
+ if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))
+ return self.clear(triggerChange);
+ setSelectedDate(date, format);
+ self.latestSelectedDateObj =
+ self.selectedDates[self.selectedDates.length - 1];
+ self.redraw();
+ jumpToDate(undefined, triggerChange);
+ setHoursFromDate();
+ if (self.selectedDates.length === 0) {
+ self.clear(false);
+ }
+ updateValue(triggerChange);
+ if (triggerChange)
+ triggerEvent("onChange");
+ }
+ function parseDateRules(arr) {
+ return arr
+ .slice()
+ .map(function (rule) {
+ if (typeof rule === "string" ||
+ typeof rule === "number" ||
+ rule instanceof Date) {
+ return self.parseDate(rule, undefined, true);
+ }
+ else if (rule &&
+ typeof rule === "object" &&
+ rule.from &&
+ rule.to)
+ return {
+ from: self.parseDate(rule.from, undefined),
+ to: self.parseDate(rule.to, undefined),
+ };
+ return rule;
+ })
+ .filter(function (x) { return x; }); // remove falsy values
+ }
+ function setupDates() {
+ self.selectedDates = [];
+ self.now = self.parseDate(self.config.now) || new Date();
+ // Workaround IE11 setting placeholder as the input's value
+ var preloadedDate = self.config.defaultDate ||
+ ((self.input.nodeName === "INPUT" ||
+ self.input.nodeName === "TEXTAREA") &&
+ self.input.placeholder &&
+ self.input.value === self.input.placeholder
+ ? null
+ : self.input.value);
+ if (preloadedDate)
+ setSelectedDate(preloadedDate, self.config.dateFormat);
+ self._initialDate =
+ self.selectedDates.length > 0
+ ? self.selectedDates[0]
+ : self.config.minDate &&
+ self.config.minDate.getTime() > self.now.getTime()
+ ? self.config.minDate
+ : self.config.maxDate &&
+ self.config.maxDate.getTime() < self.now.getTime()
+ ? self.config.maxDate
+ : self.now;
+ self.currentYear = self._initialDate.getFullYear();
+ self.currentMonth = self._initialDate.getMonth();
+ if (self.selectedDates.length > 0)
+ self.latestSelectedDateObj = self.selectedDates[0];
+ if (self.config.minTime !== undefined)
+ self.config.minTime = self.parseDate(self.config.minTime, "H:i");
+ if (self.config.maxTime !== undefined)
+ self.config.maxTime = self.parseDate(self.config.maxTime, "H:i");
+ self.minDateHasTime =
+ !!self.config.minDate &&
+ (self.config.minDate.getHours() > 0 ||
+ self.config.minDate.getMinutes() > 0 ||
+ self.config.minDate.getSeconds() > 0);
+ self.maxDateHasTime =
+ !!self.config.maxDate &&
+ (self.config.maxDate.getHours() > 0 ||
+ self.config.maxDate.getMinutes() > 0 ||
+ self.config.maxDate.getSeconds() > 0);
+ }
+ function setupInputs() {
+ self.input = getInputElem();
+ /* istanbul ignore next */
+ if (!self.input) {
+ self.config.errorHandler(new Error("Invalid input element specified"));
+ return;
+ }
+ // hack: store previous type to restore it after destroy()
+ self.input._type = self.input.type;
+ self.input.type = "text";
+ self.input.classList.add("flatpickr-input");
+ self._input = self.input;
+ if (self.config.altInput) {
+ // replicate self.element
+ self.altInput = createElement(self.input.nodeName, self.config.altInputClass);
+ self._input = self.altInput;
+ self.altInput.placeholder = self.input.placeholder;
+ self.altInput.disabled = self.input.disabled;
+ self.altInput.required = self.input.required;
+ self.altInput.tabIndex = self.input.tabIndex;
+ self.altInput.type = "text";
+ self.input.setAttribute("type", "hidden");
+ if (!self.config.static && self.input.parentNode)
+ self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);
+ }
+ if (!self.config.allowInput)
+ self._input.setAttribute("readonly", "readonly");
+ updatePositionElement();
+ }
+ function updatePositionElement() {
+ self._positionElement = self.config.positionElement || self._input;
+ }
+ function setupMobile() {
+ var inputType = self.config.enableTime
+ ? self.config.noCalendar
+ ? "time"
+ : "datetime-local"
+ : "date";
+ self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile");
+ self.mobileInput.tabIndex = 1;
+ self.mobileInput.type = inputType;
+ self.mobileInput.disabled = self.input.disabled;
+ self.mobileInput.required = self.input.required;
+ self.mobileInput.placeholder = self.input.placeholder;
+ self.mobileFormatStr =
+ inputType === "datetime-local"
+ ? "Y-m-d\\TH:i:S"
+ : inputType === "date"
+ ? "Y-m-d"
+ : "H:i:S";
+ if (self.selectedDates.length > 0) {
+ self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);
+ }
+ if (self.config.minDate)
+ self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d");
+ if (self.config.maxDate)
+ self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d");
+ if (self.input.getAttribute("step"))
+ self.mobileInput.step = String(self.input.getAttribute("step"));
+ self.input.type = "hidden";
+ if (self.altInput !== undefined)
+ self.altInput.type = "hidden";
+ try {
+ if (self.input.parentNode)
+ self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);
+ }
+ catch (_a) { }
+ bind(self.mobileInput, "change", function (e) {
+ self.setDate(getEventTarget(e).value, false, self.mobileFormatStr);
+ triggerEvent("onChange");
+ triggerEvent("onClose");
+ });
+ }
+ function toggle(e) {
+ if (self.isOpen === true)
+ return self.close();
+ self.open(e);
+ }
+ function triggerEvent(event, data) {
+ // If the instance has been destroyed already, all hooks have been removed
+ if (self.config === undefined)
+ return;
+ var hooks = self.config[event];
+ if (hooks !== undefined && hooks.length > 0) {
+ for (var i = 0; hooks[i] && i < hooks.length; i++)
+ hooks[i](self.selectedDates, self.input.value, self, data);
+ }
+ if (event === "onChange") {
+ self.input.dispatchEvent(createEvent("change"));
+ // many front-end frameworks bind to the input event
+ self.input.dispatchEvent(createEvent("input"));
+ }
+ }
+ function createEvent(name) {
+ var e = document.createEvent("Event");
+ e.initEvent(name, true, true);
+ return e;
+ }
+ function isDateSelected(date) {
+ for (var i = 0; i < self.selectedDates.length; i++) {
+ if (compareDates(self.selectedDates[i], date) === 0)
+ return "" + i;
+ }
+ return false;
+ }
+ function isDateInRange(date) {
+ if (self.config.mode !== "range" || self.selectedDates.length < 2)
+ return false;
+ return (compareDates(date, self.selectedDates[0]) >= 0 &&
+ compareDates(date, self.selectedDates[1]) <= 0);
+ }
+ function updateNavigationCurrentMonth() {
+ if (self.config.noCalendar || self.isMobile || !self.monthNav)
+ return;
+ self.yearElements.forEach(function (yearElement, i) {
+ var d = new Date(self.currentYear, self.currentMonth, 1);
+ d.setMonth(self.currentMonth + i);
+ if (self.config.showMonths > 1 ||
+ self.config.monthSelectorType === "static") {
+ self.monthElements[i].textContent =
+ monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " ";
+ }
+ else {
+ self.monthsDropdownContainer.value = d.getMonth().toString();
+ }
+ yearElement.value = d.getFullYear().toString();
+ });
+ self._hidePrevMonthArrow =
+ self.config.minDate !== undefined &&
+ (self.currentYear === self.config.minDate.getFullYear()
+ ? self.currentMonth <= self.config.minDate.getMonth()
+ : self.currentYear < self.config.minDate.getFullYear());
+ self._hideNextMonthArrow =
+ self.config.maxDate !== undefined &&
+ (self.currentYear === self.config.maxDate.getFullYear()
+ ? self.currentMonth + 1 > self.config.maxDate.getMonth()
+ : self.currentYear > self.config.maxDate.getFullYear());
+ }
+ function getDateStr(format) {
+ return self.selectedDates
+ .map(function (dObj) { return self.formatDate(dObj, format); })
+ .filter(function (d, i, arr) {
+ return self.config.mode !== "range" ||
+ self.config.enableTime ||
+ arr.indexOf(d) === i;
+ })
+ .join(self.config.mode !== "range"
+ ? self.config.conjunction
+ : self.l10n.rangeSeparator);
+ }
+ /**
+ * Updates the values of inputs associated with the calendar
+ */
+ function updateValue(triggerChange) {
+ if (triggerChange === void 0) { triggerChange = true; }
+ if (self.mobileInput !== undefined && self.mobileFormatStr) {
+ self.mobileInput.value =
+ self.latestSelectedDateObj !== undefined
+ ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr)
+ : "";
+ }
+ self.input.value = getDateStr(self.config.dateFormat);
+ if (self.altInput !== undefined) {
+ self.altInput.value = getDateStr(self.config.altFormat);
+ }
+ if (triggerChange !== false)
+ triggerEvent("onValueUpdate");
+ }
+ function onMonthNavClick(e) {
+ var eventTarget = getEventTarget(e);
+ var isPrevMonth = self.prevMonthNav.contains(eventTarget);
+ var isNextMonth = self.nextMonthNav.contains(eventTarget);
+ if (isPrevMonth || isNextMonth) {
+ changeMonth(isPrevMonth ? -1 : 1);
+ }
+ else if (self.yearElements.indexOf(eventTarget) >= 0) {
+ eventTarget.select();
+ }
+ else if (eventTarget.classList.contains("arrowUp")) {
+ self.changeYear(self.currentYear + 1);
+ }
+ else if (eventTarget.classList.contains("arrowDown")) {
+ self.changeYear(self.currentYear - 1);
+ }
+ }
+ function timeWrapper(e) {
+ e.preventDefault();
+ var isKeyDown = e.type === "keydown", eventTarget = getEventTarget(e), input = eventTarget;
+ if (self.amPM !== undefined && eventTarget === self.amPM) {
+ self.amPM.textContent =
+ self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
+ }
+ var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta ||
+ (isKeyDown ? (e.which === 38 ? 1 : -1) : 0);
+ var newValue = curValue + step * delta;
+ if (typeof input.value !== "undefined" && input.value.length === 2) {
+ var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;
+ if (newValue < min) {
+ newValue =
+ max +
+ newValue +
+ int(!isHourElem) +
+ (int(isHourElem) && int(!self.amPM));
+ if (isMinuteElem)
+ incrementNumInput(undefined, -1, self.hourElement);
+ }
+ else if (newValue > max) {
+ newValue =
+ input === self.hourElement ? newValue - max - int(!self.amPM) : min;
+ if (isMinuteElem)
+ incrementNumInput(undefined, 1, self.hourElement);
+ }
+ if (self.amPM &&
+ isHourElem &&
+ (step === 1
+ ? newValue + curValue === 23
+ : Math.abs(newValue - curValue) > step)) {
+ self.amPM.textContent =
+ self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
+ }
+ input.value = pad(newValue);
+ }
+ }
+ init();
+ return self;
+ }
+ /* istanbul ignore next */
+ function _flatpickr(nodeList, config) {
+ // static list
+ var nodes = Array.prototype.slice
+ .call(nodeList)
+ .filter(function (x) { return x instanceof HTMLElement; });
+ var instances = [];
+ for (var i = 0; i < nodes.length; i++) {
+ var node = nodes[i];
+ try {
+ if (node.getAttribute("data-fp-omit") !== null)
+ continue;
+ if (node._flatpickr !== undefined) {
+ node._flatpickr.destroy();
+ node._flatpickr = undefined;
+ }
+ node._flatpickr = FlatpickrInstance(node, config || {});
+ instances.push(node._flatpickr);
+ }
+ catch (e) {
+ console.error(e);
+ }
+ }
+ return instances.length === 1 ? instances[0] : instances;
+ }
+ /* istanbul ignore next */
+ if (typeof HTMLElement !== "undefined" &&
+ typeof HTMLCollection !== "undefined" &&
+ typeof NodeList !== "undefined") {
+ // browser env
+ HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {
+ return _flatpickr(this, config);
+ };
+ HTMLElement.prototype.flatpickr = function (config) {
+ return _flatpickr([this], config);
+ };
+ }
+ /* istanbul ignore next */
+ var flatpickr = function (selector, config) {
+ if (typeof selector === "string") {
+ return _flatpickr(window.document.querySelectorAll(selector), config);
+ }
+ else if (selector instanceof Node) {
+ return _flatpickr([selector], config);
+ }
+ else {
+ return _flatpickr(selector, config);
+ }
+ };
+ /* istanbul ignore next */
+ flatpickr.defaultConfig = {};
+ flatpickr.l10ns = {
+ en: __assign({}, english),
+ default: __assign({}, english),
+ };
+ flatpickr.localize = function (l10n) {
+ flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n);
+ };
+ flatpickr.setDefaults = function (config) {
+ flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config);
+ };
+ flatpickr.parseDate = createDateParser({});
+ flatpickr.formatDate = createDateFormatter({});
+ flatpickr.compareDates = compareDates;
+ /* istanbul ignore next */
+ if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") {
+ jQuery.fn.flatpickr = function (config) {
+ return _flatpickr(this, config);
+ };
+ }
+ Date.prototype.fp_incr = function (days) {
+ return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days));
+ };
+ if (typeof window !== "undefined") {
+ window.flatpickr = flatpickr;
+ }
+
+ return flatpickr;
+
+})));
diff --git a/asset/js/vendor/flatpickr.min.js b/asset/js/vendor/flatpickr.min.js
new file mode 100644
index 0000000..286f1de
--- /dev/null
+++ b/asset/js/vendor/flatpickr.min.js
@@ -0,0 +1,2 @@
+/* flatpickr v4.6.9,, @license MIT */
+!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.icinga?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).flatpickr=n()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)};function n(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var a=Array(e),i=0;for(n=0;n<t;n++)for(var o=arguments[n],r=0,l=o.length;r<l;r++,i++)a[i]=o[r];return a}var t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],a={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(e){return"undefined"!=typeof console&&console.warn(e)},getWeek:function(e){var n=new Date(e.getTime());n.setHours(0,0,0,0),n.setDate(n.getDate()+3-(n.getDay()+6)%7);var t=new Date(n.getFullYear(),0,4);return 1+Math.round(((n.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"<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>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<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>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},i={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var n=e%100;if(n>3&&n<21)return"th";switch(n%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},o=function(e,n){return void 0===n&&(n=2),("000"+e).slice(-1*n)},r=function(e){return!0===e?1:0};function l(e,n){var t;return function(){var a=this,i=arguments;clearTimeout(t),t=setTimeout((function(){return e.apply(a,i)}),n)}}var c=function(e){return e instanceof Array?e:[e]};function s(e,n,t){if(!0===t)return e.classList.add(n);e.classList.remove(n)}function d(e,n,t){var a=window.document.createElement(e);return n=n||"",t=t||"",a.className=n,void 0!==t&&(a.textContent=t),a}function u(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function f(e,n){return n(e)?e:e.parentNode?f(e.parentNode,n):void 0}function m(e,n){var t=d("div","numInputWrapper"),a=d("input","numInput "+e),i=d("span","arrowUp"),o=d("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?a.type="number":(a.type="text",a.pattern="\\d*"),void 0!==n)for(var r in n)a.setAttribute(r,n[r]);return t.appendChild(a),t.appendChild(i),t.appendChild(o),t}function g(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(n){return e.target}}var p=function(){},h=function(e,n,t){return t.months[n?"shorthand":"longhand"][e]},v={D:p,F:function(e,n,t){e.setMonth(t.months.longhand.indexOf(n))},G:function(e,n){e.setHours(parseFloat(n))},H:function(e,n){e.setHours(parseFloat(n))},J:function(e,n){e.setDate(parseFloat(n))},K:function(e,n,t){e.setHours(e.getHours()%12+12*r(new RegExp(t.amPM[1],"i").test(n)))},M:function(e,n,t){e.setMonth(t.months.shorthand.indexOf(n))},S:function(e,n){e.setSeconds(parseFloat(n))},U:function(e,n){return new Date(1e3*parseFloat(n))},W:function(e,n,t){var a=parseInt(n),i=new Date(e.getFullYear(),0,2+7*(a-1),0,0,0,0);return i.setDate(i.getDate()-i.getDay()+t.firstDayOfWeek),i},Y:function(e,n){e.setFullYear(parseFloat(n))},Z:function(e,n){return new Date(n)},d:function(e,n){e.setDate(parseFloat(n))},h:function(e,n){e.setHours(parseFloat(n))},i:function(e,n){e.setMinutes(parseFloat(n))},j:function(e,n){e.setDate(parseFloat(n))},l:p,m:function(e,n){e.setMonth(parseFloat(n)-1)},n:function(e,n){e.setMonth(parseFloat(n)-1)},s:function(e,n){e.setSeconds(parseFloat(n))},u:function(e,n){return new Date(parseFloat(n))},w:p,y:function(e,n){e.setFullYear(2e3+parseFloat(n))}},D={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},w={Z:function(e){return e.toISOString()},D:function(e,n,t){return n.weekdays.shorthand[w.w(e,n,t)]},F:function(e,n,t){return h(w.n(e,n,t)-1,!1,n)},G:function(e,n,t){return o(w.h(e,n,t))},H:function(e){return o(e.getHours())},J:function(e,n){return void 0!==n.ordinal?e.getDate()+n.ordinal(e.getDate()):e.getDate()},K:function(e,n){return n.amPM[r(e.getHours()>11)]},M:function(e,n){return h(e.getMonth(),!0,n)},S:function(e){return o(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,n,t){return t.getWeek(e)},Y:function(e){return o(e.getFullYear(),4)},d:function(e){return o(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return o(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,n){return n.weekdays.longhand[e.getDay()]},m:function(e){return o(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},b=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o,l=e.isMobile,c=void 0!==l&&l;return function(e,n,a){var i=a||r;return void 0===t.formatDate||c?n.split("").map((function(n,a,o){return w[n]&&"\\"!==o[a-1]?w[n](e,i,t):"\\"!==n?n:""})).join(""):t.formatDate(e,n,i)}},C=function(e){var n=e.config,t=void 0===n?a:n,o=e.l10n,r=void 0===o?i:o;return function(e,n,i,o){if(0===e||e){var l,c=o||r,s=e;if(e instanceof Date)l=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)l=new Date(e);else if("string"==typeof e){var d=n||(t||a).dateFormat,u=String(e).trim();if("today"===u)l=new Date,i=!0;else if(t&&t.parseDate)l=t.parseDate(e,d);else if(/Z$/.test(u)||/GMT$/.test(u))l=new Date(e);else{for(var f=void 0,m=[],g=0,p=0,h="";g<d.length;g++){var w=d[g],b="\\"===w,C="\\"===d[g-1]||b;if(D[w]&&!C){h+=D[w];var M=new RegExp(h).exec(e);M&&(f=!0)&&m["Y"!==w?"push":"unshift"]({fn:v[w],val:M[++p]})}else b||(h+=".")}l=t&&t.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0),m.forEach((function(e){var n=e.fn,t=e.val;return l=n(l,t,c)||l})),l=f?l:void 0}}if(l instanceof Date&&!isNaN(l.getTime()))return!0===i&&l.setHours(0,0,0,0),l;t.errorHandler(new Error("Invalid date provided: "+s))}}};function M(e,n,t){return void 0===t&&(t=!0),!1!==t?new Date(e.getTime()).setHours(0,0,0,0)-new Date(n.getTime()).setHours(0,0,0,0):e.getTime()-n.getTime()}var y=function(e,n,t){return 3600*e+60*n+t},x=864e5;function E(e){var n=e.defaultHour,t=e.defaultMinute,a=e.defaultSeconds;if(void 0!==e.minDate){var i=e.minDate.getHours(),o=e.minDate.getMinutes(),r=e.minDate.getSeconds();n<i&&(n=i),n===i&&t<o&&(t=o),n===i&&t===o&&a<r&&(a=e.minDate.getSeconds())}if(void 0!==e.maxDate){var l=e.maxDate.getHours(),c=e.maxDate.getMinutes();(n=Math.min(n,l))===l&&(t=Math.min(c,t)),n===l&&t===c&&(a=e.maxDate.getSeconds())}return{hours:n,minutes:t,seconds:a}}"function"!=typeof Object.assign&&(Object.assign=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];if(!e)throw TypeError("Cannot convert undefined or null to object");for(var a=function(n){n&&Object.keys(n).forEach((function(t){return e[t]=n[t]}))},i=0,o=n;i<o.length;i++){var r=o[i];a(r)}return e});function T(p,v){var w={config:e(e({},a),S.defaultConfig),l10n:i};function T(e){return e.bind(w)}function k(){var e=w.config;!1===e.weekNumbers&&1===e.showMonths||!0!==e.noCalendar&&window.requestAnimationFrame((function(){if(void 0!==w.calendarContainer&&(w.calendarContainer.style.visibility="hidden",w.calendarContainer.style.display="block"),void 0!==w.daysContainer){var n=(w.days.offsetWidth+1)*e.showMonths;w.daysContainer.style.width=n+"px",w.calendarContainer.style.width=n+(void 0!==w.weekWrapper?w.weekWrapper.offsetWidth:0)+"px",w.calendarContainer.style.removeProperty("visibility"),w.calendarContainer.style.removeProperty("display")}}))}function I(e){if(0===w.selectedDates.length){var n=void 0===w.config.minDate||M(new Date,w.config.minDate)>=0?new Date:new Date(w.config.minDate.getTime()),t=E(w.config);n.setHours(t.hours,t.minutes,t.seconds,n.getMilliseconds()),w.selectedDates=[n],w.latestSelectedDateObj=n}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var n="keydown"===e.type,t=g(e),a=t;void 0!==w.amPM&&t===w.amPM&&(w.amPM.textContent=w.l10n.amPM[r(w.amPM.textContent===w.l10n.amPM[0])]);var i=parseFloat(a.getAttribute("min")),l=parseFloat(a.getAttribute("max")),c=parseFloat(a.getAttribute("step")),s=parseInt(a.value,10),d=e.delta||(n?38===e.which?1:-1:0),u=s+c*d;if(void 0!==a.value&&2===a.value.length){var f=a===w.hourElement,m=a===w.minuteElement;u<i?(u=l+u+r(!f)+(r(f)&&r(!w.amPM)),m&&j(void 0,-1,w.hourElement)):u>l&&(u=a===w.hourElement?u-l-r(!w.amPM):i,m&&j(void 0,1,w.hourElement)),w.amPM&&f&&(1===c?u+s===23:Math.abs(u-s)>c)&&(w.amPM.textContent=w.l10n.amPM[r(w.amPM.textContent===w.l10n.amPM[0])]),a.value=o(u)}}(e);var a=w._input.value;_(),Me(),w._input.value!==a&&w._debouncedChange()}function _(){if(void 0!==w.hourElement&&void 0!==w.minuteElement){var e,n,t=(parseInt(w.hourElement.value.slice(-2),10)||0)%24,a=(parseInt(w.minuteElement.value,10)||0)%60,i=void 0!==w.secondElement?(parseInt(w.secondElement.value,10)||0)%60:0;void 0!==w.amPM&&(e=t,n=w.amPM.textContent,t=e%12+12*r(n===w.l10n.amPM[1]));var o=void 0!==w.config.minTime||w.config.minDate&&w.minDateHasTime&&w.latestSelectedDateObj&&0===M(w.latestSelectedDateObj,w.config.minDate,!0),l=void 0!==w.config.maxTime||w.config.maxDate&&w.maxDateHasTime&&w.latestSelectedDateObj&&0===M(w.latestSelectedDateObj,w.config.maxDate,!0);if(void 0!==w.config.maxTime&&void 0!==w.config.minTime&&w.config.minTime>w.config.maxTime){var c=y(w.config.minTime.getHours(),w.config.minTime.getMinutes(),w.config.minTime.getSeconds()),s=y(w.config.maxTime.getHours(),w.config.maxTime.getMinutes(),w.config.maxTime.getSeconds()),d=y(t,a,i);if(d>s&&d<c){var u=function(e){var n=Math.floor(e/3600),t=(e-3600*n)/60;return[n,t,e-3600*n-60*t]}(c);t=u[0],a=u[1],i=u[2]}}else{if(l){var f=void 0!==w.config.maxTime?w.config.maxTime:w.config.maxDate;(t=Math.min(t,f.getHours()))===f.getHours()&&(a=Math.min(a,f.getMinutes())),a===f.getMinutes()&&(i=Math.min(i,f.getSeconds()))}if(o){var m=void 0!==w.config.minTime?w.config.minTime:w.config.minDate;(t=Math.max(t,m.getHours()))===m.getHours()&&a<m.getMinutes()&&(a=m.getMinutes()),a===m.getMinutes()&&(i=Math.max(i,m.getSeconds()))}}F(t,a,i)}}function O(e){var n=e||w.latestSelectedDateObj;n&&F(n.getHours(),n.getMinutes(),n.getSeconds())}function F(e,n,t){void 0!==w.latestSelectedDateObj&&w.latestSelectedDateObj.setHours(e%24,n,t||0,0),w.hourElement&&w.minuteElement&&!w.isMobile&&(w.hourElement.value=o(w.config.time_24hr?e:(12+e)%12+12*r(e%12==0)),w.minuteElement.value=o(n),void 0!==w.amPM&&(w.amPM.textContent=w.l10n.amPM[r(e>=12)]),void 0!==w.secondElement&&(w.secondElement.value=o(t)))}function A(e){var n=g(e),t=parseInt(n.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&X(t)}function N(e,n,t,a){return n instanceof Array?n.forEach((function(n){return N(e,n,t,a)})):e instanceof Array?e.forEach((function(e){return N(e,n,t,a)})):(e.addEventListener(n,t,a),void w._handlers.push({remove:function(){return e.removeEventListener(n,t)}}))}function P(){ve("onChange")}function Y(e,n){var t=void 0!==e?w.parseDate(e):w.latestSelectedDateObj||(w.config.minDate&&w.config.minDate>w.now?w.config.minDate:w.config.maxDate&&w.config.maxDate<w.now?w.config.maxDate:w.now),a=w.currentYear,i=w.currentMonth;try{void 0!==t&&(w.currentYear=t.getFullYear(),w.currentMonth=t.getMonth())}catch(e){e.message="Invalid date supplied: "+t,w.config.errorHandler(e)}n&&w.currentYear!==a&&(ve("onYearChange"),U()),!n||w.currentYear===a&&w.currentMonth===i||ve("onMonthChange"),w.redraw()}function H(e){var n=g(e);~n.className.indexOf("arrow")&&j(e,n.classList.contains("arrowUp")?1:-1)}function j(e,n,t){var a=e&&g(e),i=t||a&&a.parentNode&&a.parentNode.firstChild,o=De("increment");o.delta=n,i&&i.dispatchEvent(o)}function L(e,n,t,a){var i=ee(n,!0),o=d("span","flatpickr-day "+e,n.getDate().toString());return o.dateObj=n,o.$i=a,o.setAttribute("aria-label",w.formatDate(n,w.config.ariaDateFormat)),-1===e.indexOf("hidden")&&0===M(n,w.now)&&(w.todayDateElem=o,o.classList.add("today"),o.setAttribute("aria-current","date")),i?(o.tabIndex=-1,we(n)&&(o.classList.add("selected"),w.selectedDateElem=o,"range"===w.config.mode&&(s(o,"startRange",w.selectedDates[0]&&0===M(n,w.selectedDates[0],!0)),s(o,"endRange",w.selectedDates[1]&&0===M(n,w.selectedDates[1],!0)),"nextMonthDay"===e&&o.classList.add("inRange")))):o.classList.add("flatpickr-disabled"),"range"===w.config.mode&&function(e){return!("range"!==w.config.mode||w.selectedDates.length<2)&&(M(e,w.selectedDates[0])>=0&&M(e,w.selectedDates[1])<=0)}(n)&&!we(n)&&o.classList.add("inRange"),w.weekNumbers&&1===w.config.showMonths&&"prevMonthDay"!==e&&t%7==1&&w.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+w.config.getWeek(n)+"</span>"),ve("onDayCreate",o),o}function W(e){e.focus(),"range"===w.config.mode&&ie(e)}function R(e){for(var n=e>0?0:w.config.showMonths-1,t=e>0?w.config.showMonths:-1,a=n;a!=t;a+=e)for(var i=w.daysContainer.children[a],o=e>0?0:i.children.length-1,r=e>0?i.children.length:-1,l=o;l!=r;l+=e){var c=i.children[l];if(-1===c.className.indexOf("hidden")&&ee(c.dateObj))return c}}function B(e,n){var t=ne(document.activeElement||document.body),a=void 0!==e?e:t?document.activeElement:void 0!==w.selectedDateElem&&ne(w.selectedDateElem)?w.selectedDateElem:void 0!==w.todayDateElem&&ne(w.todayDateElem)?w.todayDateElem:R(n>0?1:-1);void 0===a?w._input.focus():t?function(e,n){for(var t=-1===e.className.indexOf("Month")?e.dateObj.getMonth():w.currentMonth,a=n>0?w.config.showMonths:-1,i=n>0?1:-1,o=t-w.currentMonth;o!=a;o+=i)for(var r=w.daysContainer.children[o],l=t-w.currentMonth===o?e.$i+n:n<0?r.children.length-1:0,c=r.children.length,s=l;s>=0&&s<c&&s!=(n>0?c:-1);s+=i){var d=r.children[s];if(-1===d.className.indexOf("hidden")&&ee(d.dateObj)&&Math.abs(e.$i-s)>=Math.abs(n))return W(d)}w.changeMonth(i),B(R(i),0)}(a,n):W(a)}function J(e,n){for(var t=(new Date(e,n,1).getDay()-w.l10n.firstDayOfWeek+7)%7,a=w.utils.getDaysInMonth((n-1+12)%12,e),i=w.utils.getDaysInMonth(n,e),o=window.document.createDocumentFragment(),r=w.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",c=r?"nextMonthDay hidden":"nextMonthDay",s=a+1-t,u=0;s<=a;s++,u++)o.appendChild(L(l,new Date(e,n-1,s),s,u));for(s=1;s<=i;s++,u++)o.appendChild(L("",new Date(e,n,s),s,u));for(var f=i+1;f<=42-t&&(1===w.config.showMonths||u%7!=0);f++,u++)o.appendChild(L(c,new Date(e,n+1,f%i),f,u));var m=d("div","dayContainer");return m.appendChild(o),m}function K(){if(void 0!==w.daysContainer){u(w.daysContainer),w.weekNumbers&&u(w.weekNumbers);for(var e=document.createDocumentFragment(),n=0;n<w.config.showMonths;n++){var t=new Date(w.currentYear,w.currentMonth,1);t.setMonth(w.currentMonth+n),e.appendChild(J(t.getFullYear(),t.getMonth()))}w.daysContainer.appendChild(e),w.days=w.daysContainer.firstChild,"range"===w.config.mode&&1===w.selectedDates.length&&ie()}}function U(){if(!(w.config.showMonths>1||"dropdown"!==w.config.monthSelectorType)){var e=function(e){return!(void 0!==w.config.minDate&&w.currentYear===w.config.minDate.getFullYear()&&e<w.config.minDate.getMonth())&&!(void 0!==w.config.maxDate&&w.currentYear===w.config.maxDate.getFullYear()&&e>w.config.maxDate.getMonth())};w.monthsDropdownContainer.tabIndex=-1,w.monthsDropdownContainer.innerHTML="";for(var n=0;n<12;n++)if(e(n)){var t=d("option","flatpickr-monthDropdown-month");t.value=new Date(w.currentYear,n).getMonth().toString(),t.textContent=h(n,w.config.shorthandCurrentMonth,w.l10n),t.tabIndex=-1,w.currentMonth===n&&(t.selected=!0),w.monthsDropdownContainer.appendChild(t)}}}function q(){var e,n=d("div","flatpickr-month"),t=window.document.createDocumentFragment();w.config.showMonths>1||"static"===w.config.monthSelectorType?e=d("span","cur-month"):(w.monthsDropdownContainer=d("select","flatpickr-monthDropdown-months"),w.monthsDropdownContainer.setAttribute("aria-label",w.l10n.monthAriaLabel),N(w.monthsDropdownContainer,"change",(function(e){var n=g(e),t=parseInt(n.value,10);w.changeMonth(t-w.currentMonth),ve("onMonthChange")})),U(),e=w.monthsDropdownContainer);var a=m("cur-year",{tabindex:"-1"}),i=a.getElementsByTagName("input")[0];i.setAttribute("aria-label",w.l10n.yearAriaLabel),w.config.minDate&&i.setAttribute("min",w.config.minDate.getFullYear().toString()),w.config.maxDate&&(i.setAttribute("max",w.config.maxDate.getFullYear().toString()),i.disabled=!!w.config.minDate&&w.config.minDate.getFullYear()===w.config.maxDate.getFullYear());var o=d("div","flatpickr-current-month");return o.appendChild(e),o.appendChild(a),t.appendChild(o),n.appendChild(t),{container:n,yearElement:i,monthElement:e}}function $(){u(w.monthNav),w.monthNav.appendChild(w.prevMonthNav),w.config.showMonths&&(w.yearElements=[],w.monthElements=[]);for(var e=w.config.showMonths;e--;){var n=q();w.yearElements.push(n.yearElement),w.monthElements.push(n.monthElement),w.monthNav.appendChild(n.container)}w.monthNav.appendChild(w.nextMonthNav)}function z(){w.weekdayContainer?u(w.weekdayContainer):w.weekdayContainer=d("div","flatpickr-weekdays");for(var e=w.config.showMonths;e--;){var n=d("div","flatpickr-weekdaycontainer");w.weekdayContainer.appendChild(n)}return G(),w.weekdayContainer}function G(){if(w.weekdayContainer){var e=w.l10n.firstDayOfWeek,t=n(w.l10n.weekdays.shorthand);e>0&&e<t.length&&(t=n(t.splice(e,t.length),t.splice(0,e)));for(var a=w.config.showMonths;a--;)w.weekdayContainer.children[a].innerHTML="\n <span class='flatpickr-weekday'>\n "+t.join("</span><span class='flatpickr-weekday'>")+"\n </span>\n "}}function V(e,n){void 0===n&&(n=!0);var t=n?e:e-w.currentMonth;t<0&&!0===w._hidePrevMonthArrow||t>0&&!0===w._hideNextMonthArrow||(w.currentMonth+=t,(w.currentMonth<0||w.currentMonth>11)&&(w.currentYear+=w.currentMonth>11?1:-1,w.currentMonth=(w.currentMonth+12)%12,ve("onYearChange"),U()),K(),ve("onMonthChange"),be())}function Z(e){return!(!w.config.appendTo||!w.config.appendTo.contains(e))||w.calendarContainer.contains(e)}function Q(e){if(w.isOpen&&!w.config.inline){var n=g(e),t=Z(n),a=n===w.input||n===w.altInput||w.element.contains(n)||e.path&&e.path.indexOf&&(~e.path.indexOf(w.input)||~e.path.indexOf(w.altInput)),i="blur"===e.type?a&&e.relatedTarget&&!Z(e.relatedTarget):!a&&!t&&!Z(e.relatedTarget),o=!w.config.ignoredFocusElements.some((function(e){return e.contains(n)}));i&&o&&(void 0!==w.timeContainer&&void 0!==w.minuteElement&&void 0!==w.hourElement&&""!==w.input.value&&void 0!==w.input.value&&I(),w.close(),w.config&&"range"===w.config.mode&&1===w.selectedDates.length&&(w.clear(!1),w.redraw()))}}function X(e){if(!(!e||w.config.minDate&&e<w.config.minDate.getFullYear()||w.config.maxDate&&e>w.config.maxDate.getFullYear())){var n=e,t=w.currentYear!==n;w.currentYear=n||w.currentYear,w.config.maxDate&&w.currentYear===w.config.maxDate.getFullYear()?w.currentMonth=Math.min(w.config.maxDate.getMonth(),w.currentMonth):w.config.minDate&&w.currentYear===w.config.minDate.getFullYear()&&(w.currentMonth=Math.max(w.config.minDate.getMonth(),w.currentMonth)),t&&(w.redraw(),ve("onYearChange"),U())}}function ee(e,n){var t;void 0===n&&(n=!0);var a=w.parseDate(e,void 0,n);if(w.config.minDate&&a&&M(a,w.config.minDate,void 0!==n?n:!w.minDateHasTime)<0||w.config.maxDate&&a&&M(a,w.config.maxDate,void 0!==n?n:!w.maxDateHasTime)>0)return!1;if(!w.config.enable&&0===w.config.disable.length)return!0;if(void 0===a)return!1;for(var i=!!w.config.enable,o=null!==(t=w.config.enable)&&void 0!==t?t:w.config.disable,r=0,l=void 0;r<o.length;r++){if("function"==typeof(l=o[r])&&l(a))return i;if(l instanceof Date&&void 0!==a&&l.getTime()===a.getTime())return i;if("string"==typeof l){var c=w.parseDate(l,void 0,!0);return c&&c.getTime()===a.getTime()?i:!i}if("object"==typeof l&&void 0!==a&&l.from&&l.to&&a.getTime()>=l.from.getTime()&&a.getTime()<=l.to.getTime())return i}return!i}function ne(e){return void 0!==w.daysContainer&&(-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&w.daysContainer.contains(e))}function te(e){!(e.target===w._input)||!(w.selectedDates.length>0||w._input.value.length>0)||e.relatedTarget&&Z(e.relatedTarget)||w.setDate(w._input.value,!0,e.target===w.altInput?w.config.altFormat:w.config.dateFormat)}function ae(e){var n=g(e),t=w.config.wrap?p.contains(n):n===w._input,a=w.config.allowInput,i=w.isOpen&&(!a||!t),o=w.config.inline&&t&&!a;if(13===e.keyCode&&t){if(a)return w.setDate(w._input.value,!0,n===w.altInput?w.config.altFormat:w.config.dateFormat),n.blur();w.open()}else if(Z(n)||i||o){var r=!!w.timeContainer&&w.timeContainer.contains(n);switch(e.keyCode){case 13:r?(e.preventDefault(),I(),ue()):fe(e);break;case 27:e.preventDefault(),ue();break;case 8:case 46:t&&!w.config.allowInput&&(e.preventDefault(),w.clear());break;case 37:case 39:if(r||t)w.hourElement&&w.hourElement.focus();else if(e.preventDefault(),void 0!==w.daysContainer&&(!1===a||document.activeElement&&ne(document.activeElement))){var l=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),V(l),B(R(1),0)):B(void 0,l)}break;case 38:case 40:e.preventDefault();var c=40===e.keyCode?1:-1;w.daysContainer&&void 0!==n.$i||n===w.input||n===w.altInput?e.ctrlKey?(e.stopPropagation(),X(w.currentYear-c),B(R(1),0)):r||B(void 0,7*c):n===w.currentYearElement?X(w.currentYear-c):w.config.enableTime&&(!r&&w.hourElement&&w.hourElement.focus(),I(e),w._debouncedChange());break;case 9:if(r){var s=[w.hourElement,w.minuteElement,w.secondElement,w.amPM].concat(w.pluginElements).filter((function(e){return e})),d=s.indexOf(n);if(-1!==d){var u=s[d+(e.shiftKey?-1:1)];e.preventDefault(),(u||w._input).focus()}}else!w.config.noCalendar&&w.daysContainer&&w.daysContainer.contains(n)&&e.shiftKey&&(e.preventDefault(),w._input.focus())}}if(void 0!==w.amPM&&n===w.amPM)switch(e.key){case w.l10n.amPM[0].charAt(0):case w.l10n.amPM[0].charAt(0).toLowerCase():w.amPM.textContent=w.l10n.amPM[0],_(),Me();break;case w.l10n.amPM[1].charAt(0):case w.l10n.amPM[1].charAt(0).toLowerCase():w.amPM.textContent=w.l10n.amPM[1],_(),Me()}(t||Z(n))&&ve("onKeyDown",e)}function ie(e){if(1===w.selectedDates.length&&(!e||e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled"))){for(var n=e?e.dateObj.getTime():w.days.firstElementChild.dateObj.getTime(),t=w.parseDate(w.selectedDates[0],void 0,!0).getTime(),a=Math.min(n,w.selectedDates[0].getTime()),i=Math.max(n,w.selectedDates[0].getTime()),o=!1,r=0,l=0,c=a;c<i;c+=x)ee(new Date(c),!0)||(o=o||c>a&&c<i,c<t&&(!r||c>r)?r=c:c>t&&(!l||c<l)&&(l=c));for(var s=0;s<w.config.showMonths;s++)for(var d=w.daysContainer.children[s],u=function(a,i){var c,s,u,f=d.children[a],m=f.dateObj.getTime(),g=r>0&&m<r||l>0&&m>l;return g?(f.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach((function(e){f.classList.remove(e)})),"continue"):o&&!g?"continue":(["startRange","inRange","endRange","notAllowed"].forEach((function(e){f.classList.remove(e)})),void(void 0!==e&&(e.classList.add(n<=w.selectedDates[0].getTime()?"startRange":"endRange"),t<n&&m===t?f.classList.add("startRange"):t>n&&m===t&&f.classList.add("endRange"),m>=r&&(0===l||m<=l)&&(s=t,u=n,(c=m)>Math.min(s,u)&&c<Math.max(s,u))&&f.classList.add("inRange"))))},f=0,m=d.children.length;f<m;f++)u(f)}}function oe(){!w.isOpen||w.config.static||w.config.inline||se()}function re(e){return function(n){var t=w.config["_"+e+"Date"]=w.parseDate(n,w.config.dateFormat),a=w.config["_"+("min"===e?"max":"min")+"Date"];void 0!==t&&(w["min"===e?"minDateHasTime":"maxDateHasTime"]=t.getHours()>0||t.getMinutes()>0||t.getSeconds()>0),w.selectedDates&&(w.selectedDates=w.selectedDates.filter((function(e){return ee(e)})),w.selectedDates.length||"min"!==e||O(t),Me()),w.daysContainer&&(de(),void 0!==t?w.currentYearElement[e]=t.getFullYear().toString():w.currentYearElement.removeAttribute(e),w.currentYearElement.disabled=!!a&&void 0!==t&&a.getFullYear()===t.getFullYear())}}function le(){return w.config.wrap?p.querySelector("[data-input]"):p}function ce(){"object"!=typeof w.config.locale&&void 0===S.l10ns[w.config.locale]&&w.config.errorHandler(new Error("flatpickr: invalid locale "+w.config.locale)),w.l10n=e(e({},S.l10ns.default),"object"==typeof w.config.locale?w.config.locale:"default"!==w.config.locale?S.l10ns[w.config.locale]:void 0),D.K="("+w.l10n.amPM[0]+"|"+w.l10n.amPM[1]+"|"+w.l10n.amPM[0].toLowerCase()+"|"+w.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},v),JSON.parse(JSON.stringify(p.dataset||{}))).time_24hr&&void 0===S.defaultConfig.time_24hr&&(w.config.time_24hr=w.l10n.time_24hr),w.formatDate=b(w),w.parseDate=C({config:w.config,l10n:w.l10n})}function se(e){if("function"!=typeof w.config.position){if(void 0!==w.calendarContainer){ve("onPreCalendarPosition");var n=e||w._positionElement,t=Array.prototype.reduce.call(w.calendarContainer.children,(function(e,n){return e+n.offsetHeight}),0),a=w.calendarContainer.offsetWidth,i=w.config.position.split(" "),o=i[0],r=i.length>1?i[1]:null,l=n.getBoundingClientRect(),c=window.innerHeight-l.bottom,d="above"===o||"below"!==o&&c<t&&l.top>t,u=window.pageYOffset+l.top+(d?-t-2:n.offsetHeight+2);if(s(w.calendarContainer,"arrowTop",!d),s(w.calendarContainer,"arrowBottom",d),!w.config.inline){var f=window.pageXOffset+l.left,m=!1,g=!1;"center"===r?(f-=(a-l.width)/2,m=!0):"right"===r&&(f-=a-l.width,g=!0),s(w.calendarContainer,"arrowLeft",!m&&!g),s(w.calendarContainer,"arrowCenter",m),s(w.calendarContainer,"arrowRight",g);var p=window.document.body.offsetWidth-(window.pageXOffset+l.right),h=f+a>window.document.body.offsetWidth,v=p+a>window.document.body.offsetWidth;if(s(w.calendarContainer,"rightMost",h),!w.config.static)if(w.calendarContainer.style.top=u+"px",h)if(v){var D=function(){for(var e=null,n=0;n<document.styleSheets.length;n++){var t=document.styleSheets[n];try{t.cssRules}catch(e){continue}e=t;break}return null!=e?e:(a=document.createElement("style"),document.head.appendChild(a),a.sheet);var a}();if(void 0===D)return;var b=window.document.body.offsetWidth,C=Math.max(0,b/2-a/2),M=D.cssRules.length,y="{left:"+l.left+"px;right:auto;}";s(w.calendarContainer,"rightMost",!1),s(w.calendarContainer,"centerMost",!0),D.insertRule(".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after"+y,M),w.calendarContainer.style.left=C+"px",w.calendarContainer.style.right="auto"}else w.calendarContainer.style.left="auto",w.calendarContainer.style.right=p+"px";else w.calendarContainer.style.left=f+"px",w.calendarContainer.style.right="auto"}}}else w.config.position(w,e)}function de(){w.config.noCalendar||w.isMobile||(U(),be(),K())}function ue(){w._input.focus(),-1!==window.navigator.userAgent.indexOf("MSIE")||void 0!==navigator.msMaxTouchPoints?setTimeout(w.close,0):w.close()}function fe(e){e.preventDefault(),e.stopPropagation();var n=f(g(e),(function(e){return e.classList&&e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled")&&!e.classList.contains("notAllowed")}));if(void 0!==n){var t=n,a=w.latestSelectedDateObj=new Date(t.dateObj.getTime()),i=(a.getMonth()<w.currentMonth||a.getMonth()>w.currentMonth+w.config.showMonths-1)&&"range"!==w.config.mode;if(w.selectedDateElem=t,"single"===w.config.mode)w.selectedDates=[a];else if("multiple"===w.config.mode){var o=we(a);o?w.selectedDates.splice(parseInt(o),1):w.selectedDates.push(a)}else"range"===w.config.mode&&(2===w.selectedDates.length&&w.clear(!1,!1),w.latestSelectedDateObj=a,w.selectedDates.push(a),0!==M(a,w.selectedDates[0],!0)&&w.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()})));if(_(),i){var r=w.currentYear!==a.getFullYear();w.currentYear=a.getFullYear(),w.currentMonth=a.getMonth(),r&&(ve("onYearChange"),U()),ve("onMonthChange")}if(be(),K(),Me(),i||"range"===w.config.mode||1!==w.config.showMonths?void 0!==w.selectedDateElem&&void 0===w.hourElement&&w.selectedDateElem&&w.selectedDateElem.focus():W(t),void 0!==w.hourElement&&void 0!==w.hourElement&&w.hourElement.focus(),w.config.closeOnSelect){var l="single"===w.config.mode&&!w.config.enableTime,c="range"===w.config.mode&&2===w.selectedDates.length&&!w.config.enableTime;(l||c)&&ue()}P()}}w.parseDate=C({config:w.config,l10n:w.l10n}),w._handlers=[],w.pluginElements=[],w.loadedPlugins=[],w._bind=N,w._setHoursFromDate=O,w._positionCalendar=se,w.changeMonth=V,w.changeYear=X,w.clear=function(e,n){void 0===e&&(e=!0);void 0===n&&(n=!0);w.input.value="",void 0!==w.altInput&&(w.altInput.value="");void 0!==w.mobileInput&&(w.mobileInput.value="");w.selectedDates=[],w.latestSelectedDateObj=void 0,!0===n&&(w.currentYear=w._initialDate.getFullYear(),w.currentMonth=w._initialDate.getMonth());if(!0===w.config.enableTime){var t=E(w.config),a=t.hours,i=t.minutes,o=t.seconds;F(a,i,o)}w.redraw(),e&&ve("onChange")},w.close=function(){w.isOpen=!1,w.isMobile||(void 0!==w.calendarContainer&&w.calendarContainer.classList.remove("open"),void 0!==w._input&&w._input.classList.remove("active"));ve("onClose")},w._createElement=d,w.destroy=function(){void 0!==w.config&&ve("onDestroy");for(var e=w._handlers.length;e--;)w._handlers[e].remove();if(w._handlers=[],w.mobileInput)w.mobileInput.parentNode&&w.mobileInput.parentNode.removeChild(w.mobileInput),w.mobileInput=void 0;else if(w.calendarContainer&&w.calendarContainer.parentNode)if(w.config.static&&w.calendarContainer.parentNode){var n=w.calendarContainer.parentNode;if(n.lastChild&&n.removeChild(n.lastChild),n.parentNode){for(;n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}}else w.calendarContainer.parentNode.removeChild(w.calendarContainer);w.altInput&&(w.input.type="text",w.altInput.parentNode&&w.altInput.parentNode.removeChild(w.altInput),delete w.altInput);w.input&&(w.input.type=w.input._type,w.input.classList.remove("flatpickr-input"),w.input.removeAttribute("readonly"));["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(e){try{delete w[e]}catch(e){}}))},w.isEnabled=ee,w.jumpToDate=Y,w.open=function(e,n){void 0===n&&(n=w._positionElement);if(!0===w.isMobile){if(e){e.preventDefault();var t=g(e);t&&t.blur()}return void 0!==w.mobileInput&&(w.mobileInput.focus(),w.mobileInput.click()),void ve("onOpen")}if(w._input.disabled||w.config.inline)return;var a=w.isOpen;w.isOpen=!0,a||(w.calendarContainer.classList.add("open"),w._input.classList.add("active"),ve("onOpen"),se(n));!0===w.config.enableTime&&!0===w.config.noCalendar&&(!1!==w.config.allowInput||void 0!==e&&w.timeContainer.contains(e.relatedTarget)||setTimeout((function(){return w.hourElement.select()}),50))},w.redraw=de,w.set=function(e,n){if(null!==e&&"object"==typeof e)for(var a in Object.assign(w.config,e),e)void 0!==me[a]&&me[a].forEach((function(e){return e()}));else w.config[e]=n,void 0!==me[e]?me[e].forEach((function(e){return e()})):t.indexOf(e)>-1&&(w.config[e]=c(n));w.redraw(),Me(!0)},w.setDate=function(e,n,t){void 0===n&&(n=!1);void 0===t&&(t=w.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return w.clear(n);ge(e,t),w.latestSelectedDateObj=w.selectedDates[w.selectedDates.length-1],w.redraw(),Y(void 0,n),O(),0===w.selectedDates.length&&w.clear(!1);Me(n),n&&ve("onChange")},w.toggle=function(e){if(!0===w.isOpen)return w.close();w.open(e)};var me={locale:[ce,G],showMonths:[$,k,z],minDate:[Y],maxDate:[Y],positionElement:[he],clickOpens:[function(){!0===w.config.clickOpens?(N(w._input,"focus",w.open),N(w._input,"click",w.open)):(w._input.removeEventListener("focus",w.open),w._input.removeEventListener("click",w.open))}]};function ge(e,n){var t=[];if(e instanceof Array)t=e.map((function(e){return w.parseDate(e,n)}));else if(e instanceof Date||"number"==typeof e)t=[w.parseDate(e,n)];else if("string"==typeof e)switch(w.config.mode){case"single":case"time":t=[w.parseDate(e,n)];break;case"multiple":t=e.split(w.config.conjunction).map((function(e){return w.parseDate(e,n)}));break;case"range":t=e.split(w.l10n.rangeSeparator).map((function(e){return w.parseDate(e,n)}))}else w.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));w.selectedDates=w.config.allowInvalidPreload?t:t.filter((function(e){return e instanceof Date&&ee(e,!1)})),"range"===w.config.mode&&w.selectedDates.sort((function(e,n){return e.getTime()-n.getTime()}))}function pe(e){return e.slice().map((function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?w.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:w.parseDate(e.from,void 0),to:w.parseDate(e.to,void 0)}:e})).filter((function(e){return e}))}function he(){w._positionElement=w.config.positionElement||w._input}function ve(e,n){if(void 0!==w.config){var t=w.config[e];if(void 0!==t&&t.length>0)for(var a=0;t[a]&&a<t.length;a++)t[a](w.selectedDates,w.input.value,w,n);"onChange"===e&&(w.input.dispatchEvent(De("change")),w.input.dispatchEvent(De("input")))}}function De(e){var n=document.createEvent("Event");return n.initEvent(e,!0,!0),n}function we(e){for(var n=0;n<w.selectedDates.length;n++)if(0===M(w.selectedDates[n],e))return""+n;return!1}function be(){w.config.noCalendar||w.isMobile||!w.monthNav||(w.yearElements.forEach((function(e,n){var t=new Date(w.currentYear,w.currentMonth,1);t.setMonth(w.currentMonth+n),w.config.showMonths>1||"static"===w.config.monthSelectorType?w.monthElements[n].textContent=h(t.getMonth(),w.config.shorthandCurrentMonth,w.l10n)+" ":w.monthsDropdownContainer.value=t.getMonth().toString(),e.value=t.getFullYear().toString()})),w._hidePrevMonthArrow=void 0!==w.config.minDate&&(w.currentYear===w.config.minDate.getFullYear()?w.currentMonth<=w.config.minDate.getMonth():w.currentYear<w.config.minDate.getFullYear()),w._hideNextMonthArrow=void 0!==w.config.maxDate&&(w.currentYear===w.config.maxDate.getFullYear()?w.currentMonth+1>w.config.maxDate.getMonth():w.currentYear>w.config.maxDate.getFullYear()))}function Ce(e){return w.selectedDates.map((function(n){return w.formatDate(n,e)})).filter((function(e,n,t){return"range"!==w.config.mode||w.config.enableTime||t.indexOf(e)===n})).join("range"!==w.config.mode?w.config.conjunction:w.l10n.rangeSeparator)}function Me(e){void 0===e&&(e=!0),void 0!==w.mobileInput&&w.mobileFormatStr&&(w.mobileInput.value=void 0!==w.latestSelectedDateObj?w.formatDate(w.latestSelectedDateObj,w.mobileFormatStr):""),w.input.value=Ce(w.config.dateFormat),void 0!==w.altInput&&(w.altInput.value=Ce(w.config.altFormat)),!1!==e&&ve("onValueUpdate")}function ye(e){var n=g(e),t=w.prevMonthNav.contains(n),a=w.nextMonthNav.contains(n);t||a?V(t?-1:1):w.yearElements.indexOf(n)>=0?n.select():n.classList.contains("arrowUp")?w.changeYear(w.currentYear+1):n.classList.contains("arrowDown")&&w.changeYear(w.currentYear-1)}return function(){w.element=w.input=p,w.isOpen=!1,function(){var n=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],i=e(e({},JSON.parse(JSON.stringify(p.dataset||{}))),v),o={};w.config.parseDate=i.parseDate,w.config.formatDate=i.formatDate,Object.defineProperty(w.config,"enable",{get:function(){return w.config._enable},set:function(e){w.config._enable=pe(e)}}),Object.defineProperty(w.config,"disable",{get:function(){return w.config._disable},set:function(e){w.config._disable=pe(e)}});var r="time"===i.mode;if(!i.dateFormat&&(i.enableTime||r)){var l=S.defaultConfig.dateFormat||a.dateFormat;o.dateFormat=i.noCalendar||r?"H:i"+(i.enableSeconds?":S":""):l+" H:i"+(i.enableSeconds?":S":"")}if(i.altInput&&(i.enableTime||r)&&!i.altFormat){var s=S.defaultConfig.altFormat||a.altFormat;o.altFormat=i.noCalendar||r?"h:i"+(i.enableSeconds?":S K":" K"):s+" h:i"+(i.enableSeconds?":S":"")+" K"}Object.defineProperty(w.config,"minDate",{get:function(){return w.config._minDate},set:re("min")}),Object.defineProperty(w.config,"maxDate",{get:function(){return w.config._maxDate},set:re("max")});var d=function(e){return function(n){w.config["min"===e?"_minTime":"_maxTime"]=w.parseDate(n,"H:i:S")}};Object.defineProperty(w.config,"minTime",{get:function(){return w.config._minTime},set:d("min")}),Object.defineProperty(w.config,"maxTime",{get:function(){return w.config._maxTime},set:d("max")}),"time"===i.mode&&(w.config.noCalendar=!0,w.config.enableTime=!0);Object.assign(w.config,o,i);for(var u=0;u<n.length;u++)w.config[n[u]]=!0===w.config[n[u]]||"true"===w.config[n[u]];t.filter((function(e){return void 0!==w.config[e]})).forEach((function(e){w.config[e]=c(w.config[e]||[]).map(T)})),w.isMobile=!w.config.disableMobile&&!w.config.inline&&"single"===w.config.mode&&!w.config.disable.length&&!w.config.enable&&!w.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(u=0;u<w.config.plugins.length;u++){var f=w.config.plugins[u](w)||{};for(var m in f)t.indexOf(m)>-1?w.config[m]=c(f[m]).map(T).concat(w.config[m]):void 0===i[m]&&(w.config[m]=f[m])}i.altInputClass||(w.config.altInputClass=le().className+" "+w.config.altInputClass);ve("onParseConfig")}(),ce(),function(){if(w.input=le(),!w.input)return void w.config.errorHandler(new Error("Invalid input element specified"));w.input._type=w.input.type,w.input.type="text",w.input.classList.add("flatpickr-input"),w._input=w.input,w.config.altInput&&(w.altInput=d(w.input.nodeName,w.config.altInputClass),w._input=w.altInput,w.altInput.placeholder=w.input.placeholder,w.altInput.disabled=w.input.disabled,w.altInput.required=w.input.required,w.altInput.tabIndex=w.input.tabIndex,w.altInput.type="text",w.input.setAttribute("type","hidden"),!w.config.static&&w.input.parentNode&&w.input.parentNode.insertBefore(w.altInput,w.input.nextSibling));w.config.allowInput||w._input.setAttribute("readonly","readonly");he()}(),function(){w.selectedDates=[],w.now=w.parseDate(w.config.now)||new Date;var e=w.config.defaultDate||("INPUT"!==w.input.nodeName&&"TEXTAREA"!==w.input.nodeName||!w.input.placeholder||w.input.value!==w.input.placeholder?w.input.value:null);e&&ge(e,w.config.dateFormat);w._initialDate=w.selectedDates.length>0?w.selectedDates[0]:w.config.minDate&&w.config.minDate.getTime()>w.now.getTime()?w.config.minDate:w.config.maxDate&&w.config.maxDate.getTime()<w.now.getTime()?w.config.maxDate:w.now,w.currentYear=w._initialDate.getFullYear(),w.currentMonth=w._initialDate.getMonth(),w.selectedDates.length>0&&(w.latestSelectedDateObj=w.selectedDates[0]);void 0!==w.config.minTime&&(w.config.minTime=w.parseDate(w.config.minTime,"H:i"));void 0!==w.config.maxTime&&(w.config.maxTime=w.parseDate(w.config.maxTime,"H:i"));w.minDateHasTime=!!w.config.minDate&&(w.config.minDate.getHours()>0||w.config.minDate.getMinutes()>0||w.config.minDate.getSeconds()>0),w.maxDateHasTime=!!w.config.maxDate&&(w.config.maxDate.getHours()>0||w.config.maxDate.getMinutes()>0||w.config.maxDate.getSeconds()>0)}(),w.utils={getDaysInMonth:function(e,n){return void 0===e&&(e=w.currentMonth),void 0===n&&(n=w.currentYear),1===e&&(n%4==0&&n%100!=0||n%400==0)?29:w.l10n.daysInMonth[e]}},w.isMobile||function(){var e=window.document.createDocumentFragment();if(w.calendarContainer=d("div","flatpickr-calendar"),w.calendarContainer.tabIndex=-1,!w.config.noCalendar){if(e.appendChild((w.monthNav=d("div","flatpickr-months"),w.yearElements=[],w.monthElements=[],w.prevMonthNav=d("span","flatpickr-prev-month"),w.prevMonthNav.innerHTML=w.config.prevArrow,w.nextMonthNav=d("span","flatpickr-next-month"),w.nextMonthNav.innerHTML=w.config.nextArrow,$(),Object.defineProperty(w,"_hidePrevMonthArrow",{get:function(){return w.__hidePrevMonthArrow},set:function(e){w.__hidePrevMonthArrow!==e&&(s(w.prevMonthNav,"flatpickr-disabled",e),w.__hidePrevMonthArrow=e)}}),Object.defineProperty(w,"_hideNextMonthArrow",{get:function(){return w.__hideNextMonthArrow},set:function(e){w.__hideNextMonthArrow!==e&&(s(w.nextMonthNav,"flatpickr-disabled",e),w.__hideNextMonthArrow=e)}}),w.currentYearElement=w.yearElements[0],be(),w.monthNav)),w.innerContainer=d("div","flatpickr-innerContainer"),w.config.weekNumbers){var n=function(){w.calendarContainer.classList.add("hasWeeks");var e=d("div","flatpickr-weekwrapper");e.appendChild(d("span","flatpickr-weekday",w.l10n.weekAbbreviation));var n=d("div","flatpickr-weeks");return e.appendChild(n),{weekWrapper:e,weekNumbers:n}}(),t=n.weekWrapper,a=n.weekNumbers;w.innerContainer.appendChild(t),w.weekNumbers=a,w.weekWrapper=t}w.rContainer=d("div","flatpickr-rContainer"),w.rContainer.appendChild(z()),w.daysContainer||(w.daysContainer=d("div","flatpickr-days"),w.daysContainer.tabIndex=-1),K(),w.rContainer.appendChild(w.daysContainer),w.innerContainer.appendChild(w.rContainer),e.appendChild(w.innerContainer)}w.config.enableTime&&e.appendChild(function(){w.calendarContainer.classList.add("hasTime"),w.config.noCalendar&&w.calendarContainer.classList.add("noCalendar");var e=E(w.config);w.timeContainer=d("div","flatpickr-time"),w.timeContainer.tabIndex=-1;var n=d("span","flatpickr-time-separator",":"),t=m("flatpickr-hour",{"aria-label":w.l10n.hourAriaLabel});w.hourElement=t.getElementsByTagName("input")[0];var a=m("flatpickr-minute",{"aria-label":w.l10n.minuteAriaLabel});w.minuteElement=a.getElementsByTagName("input")[0],w.hourElement.tabIndex=w.minuteElement.tabIndex=-1,w.hourElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getHours():w.config.time_24hr?e.hours:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(e.hours)),w.minuteElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getMinutes():e.minutes),w.hourElement.setAttribute("step",w.config.hourIncrement.toString()),w.minuteElement.setAttribute("step",w.config.minuteIncrement.toString()),w.hourElement.setAttribute("min",w.config.time_24hr?"0":"1"),w.hourElement.setAttribute("max",w.config.time_24hr?"23":"12"),w.hourElement.setAttribute("maxlength","2"),w.minuteElement.setAttribute("min","0"),w.minuteElement.setAttribute("max","59"),w.minuteElement.setAttribute("maxlength","2"),w.timeContainer.appendChild(t),w.timeContainer.appendChild(n),w.timeContainer.appendChild(a),w.config.time_24hr&&w.timeContainer.classList.add("time24hr");if(w.config.enableSeconds){w.timeContainer.classList.add("hasSeconds");var i=m("flatpickr-second");w.secondElement=i.getElementsByTagName("input")[0],w.secondElement.value=o(w.latestSelectedDateObj?w.latestSelectedDateObj.getSeconds():e.seconds),w.secondElement.setAttribute("step",w.minuteElement.getAttribute("step")),w.secondElement.setAttribute("min","0"),w.secondElement.setAttribute("max","59"),w.secondElement.setAttribute("maxlength","2"),w.timeContainer.appendChild(d("span","flatpickr-time-separator",":")),w.timeContainer.appendChild(i)}w.config.time_24hr||(w.amPM=d("span","flatpickr-am-pm",w.l10n.amPM[r((w.latestSelectedDateObj?w.hourElement.value:w.config.defaultHour)>11)]),w.amPM.title=w.l10n.toggleTitle,w.amPM.tabIndex=-1,w.timeContainer.appendChild(w.amPM));return w.timeContainer}());s(w.calendarContainer,"rangeMode","range"===w.config.mode),s(w.calendarContainer,"animate",!0===w.config.animate),s(w.calendarContainer,"multiMonth",w.config.showMonths>1),w.calendarContainer.appendChild(e);var i=void 0!==w.config.appendTo&&void 0!==w.config.appendTo.nodeType;if((w.config.inline||w.config.static)&&(w.calendarContainer.classList.add(w.config.inline?"inline":"static"),w.config.inline&&(!i&&w.element.parentNode?w.element.parentNode.insertBefore(w.calendarContainer,w._input.nextSibling):void 0!==w.config.appendTo&&w.config.appendTo.appendChild(w.calendarContainer)),w.config.static)){var l=d("div","flatpickr-wrapper");w.element.parentNode&&w.element.parentNode.insertBefore(l,w.element),l.appendChild(w.element),w.altInput&&l.appendChild(w.altInput),l.appendChild(w.calendarContainer)}w.config.static||w.config.inline||(void 0!==w.config.appendTo?w.config.appendTo:window.document.body).appendChild(w.calendarContainer)}(),function(){w.config.wrap&&["open","close","toggle","clear"].forEach((function(e){Array.prototype.forEach.call(w.element.querySelectorAll("[data-"+e+"]"),(function(n){return N(n,"click",w[e])}))}));if(w.isMobile)return void function(){var e=w.config.enableTime?w.config.noCalendar?"time":"datetime-local":"date";w.mobileInput=d("input",w.input.className+" flatpickr-mobile"),w.mobileInput.tabIndex=1,w.mobileInput.type=e,w.mobileInput.disabled=w.input.disabled,w.mobileInput.required=w.input.required,w.mobileInput.placeholder=w.input.placeholder,w.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",w.selectedDates.length>0&&(w.mobileInput.defaultValue=w.mobileInput.value=w.formatDate(w.selectedDates[0],w.mobileFormatStr));w.config.minDate&&(w.mobileInput.min=w.formatDate(w.config.minDate,"Y-m-d"));w.config.maxDate&&(w.mobileInput.max=w.formatDate(w.config.maxDate,"Y-m-d"));w.input.getAttribute("step")&&(w.mobileInput.step=String(w.input.getAttribute("step")));w.input.type="hidden",void 0!==w.altInput&&(w.altInput.type="hidden");try{w.input.parentNode&&w.input.parentNode.insertBefore(w.mobileInput,w.input.nextSibling)}catch(e){}N(w.mobileInput,"change",(function(e){w.setDate(g(e).value,!1,w.mobileFormatStr),ve("onChange"),ve("onClose")}))}();var e=l(oe,50);w._debouncedChange=l(P,300),w.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&N(w.daysContainer,"mouseover",(function(e){"range"===w.config.mode&&ie(g(e))}));N(w._input,"keydown",ae),void 0!==w.calendarContainer&&N(w.calendarContainer,"keydown",ae);w.config.inline||w.config.static||N(window,"resize",e);void 0!==window.ontouchstart?N(window.document,"touchstart",Q):N(window.document,"mousedown",Q);N(window.document,"focus",Q,{capture:!0}),!0===w.config.clickOpens&&(N(w._input,"focus",w.open),N(w._input,"click",w.open));void 0!==w.daysContainer&&(N(w.monthNav,"click",ye),N(w.monthNav,["keyup","increment"],A),N(w.daysContainer,"click",fe));if(void 0!==w.timeContainer&&void 0!==w.minuteElement&&void 0!==w.hourElement){var n=function(e){return g(e).select()};N(w.timeContainer,["increment"],I),N(w.timeContainer,"blur",I,{capture:!0}),N(w.timeContainer,"click",H),N([w.hourElement,w.minuteElement],["focus","click"],n),void 0!==w.secondElement&&N(w.secondElement,"focus",(function(){return w.secondElement&&w.secondElement.select()})),void 0!==w.amPM&&N(w.amPM,"click",(function(e){I(e),P()}))}w.config.allowInput&&N(w._input,"blur",te)}(),(w.selectedDates.length||w.config.noCalendar)&&(w.config.enableTime&&O(w.config.noCalendar?w.latestSelectedDateObj:void 0),Me(!1)),k();var n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!w.isMobile&&n&&se(),ve("onReady")}(),w}function k(e,n){for(var t=Array.prototype.slice.call(e).filter((function(e){return e instanceof HTMLElement})),a=[],i=0;i<t.length;i++){var o=t[i];try{if(null!==o.getAttribute("data-fp-omit"))continue;void 0!==o._flatpickr&&(o._flatpickr.destroy(),o._flatpickr=void 0),o._flatpickr=T(o,n||{}),a.push(o._flatpickr)}catch(e){console.error(e)}}return 1===a.length?a[0]:a}"undefined"!=typeof HTMLElement&&"undefined"!=typeof HTMLCollection&&"undefined"!=typeof NodeList&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return k(this,e)},HTMLElement.prototype.flatpickr=function(e){return k([this],e)});var S=function(e,n){return"string"==typeof e?k(window.document.querySelectorAll(e),n):e instanceof Node?k([e],n):k(e,n)};return S.defaultConfig={},S.l10ns={en:e({},i),default:e({},i)},S.localize=function(n){S.l10ns.default=e(e({},S.l10ns.default),n)},S.setDefaults=function(n){S.defaultConfig=e(e({},S.defaultConfig),n)},S.parseDate=C({}),S.formatDate=b({}),S.compareDates=M,"undefined"!=typeof jQuery&&void 0!==jQuery.fn&&(jQuery.fn.flatpickr=function(e){return k(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+("string"==typeof e?parseInt(e,10):e))},"undefined"!=typeof window&&(window.flatpickr=S),S}));
diff --git a/asset/js/vendor/flatpickr/l10n/ar.js b/asset/js/vendor/flatpickr/l10n/ar.js
new file mode 100644
index 0000000..221dc0f
--- /dev/null
+++ b/asset/js/vendor/flatpickr/l10n/ar.js
@@ -0,0 +1,62 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.icinga ? define(["exports"], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ar = {}));
+}(this, (function (exports) { 'use strict';
+
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined
+ ? window.flatpickr
+ : {
+ l10ns: {},
+ };
+ var Arabic = {
+ weekdays: {
+ shorthand: ["أحد", "اثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"],
+ longhand: [
+ "الأحد",
+ "الاثنين",
+ "الثلاثاء",
+ "الأربعاء",
+ "الخميس",
+ "الجمعة",
+ "السبت",
+ ],
+ },
+ months: {
+ shorthand: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
+ longhand: [
+ "يناير",
+ "فبراير",
+ "مارس",
+ "أبريل",
+ "مايو",
+ "يونيو",
+ "يوليو",
+ "أغسطس",
+ "سبتمبر",
+ "أكتوبر",
+ "نوفمبر",
+ "ديسمبر",
+ ],
+ },
+ firstDayOfWeek: 6,
+ rangeSeparator: " إلى ",
+ weekAbbreviation: "Wk",
+ scrollTitle: "قم بالتمرير للزيادة",
+ toggleTitle: "اضغط للتبديل",
+ amPM: ["ص", "م"],
+ yearAriaLabel: "سنة",
+ monthAriaLabel: "شهر",
+ hourAriaLabel: "ساعة",
+ minuteAriaLabel: "دقيقة",
+ time_24hr: false,
+ };
+ fp.l10ns.ar = Arabic;
+ var ar = fp.l10ns;
+
+ exports.Arabic = Arabic;
+ exports.default = ar;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/asset/js/vendor/flatpickr/l10n/de.js b/asset/js/vendor/flatpickr/l10n/de.js
new file mode 100644
index 0000000..b86f784
--- /dev/null
+++ b/asset/js/vendor/flatpickr/l10n/de.js
@@ -0,0 +1,70 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.icinga ? define(["exports"], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.de = {}));
+}(this, (function (exports) { 'use strict';
+
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined
+ ? window.flatpickr
+ : {
+ l10ns: {},
+ };
+ var German = {
+ weekdays: {
+ shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
+ longhand: [
+ "Sonntag",
+ "Montag",
+ "Dienstag",
+ "Mittwoch",
+ "Donnerstag",
+ "Freitag",
+ "Samstag",
+ ],
+ },
+ months: {
+ shorthand: [
+ "Jan",
+ "Feb",
+ "Mär",
+ "Apr",
+ "Mai",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Okt",
+ "Nov",
+ "Dez",
+ ],
+ longhand: [
+ "Januar",
+ "Februar",
+ "März",
+ "April",
+ "Mai",
+ "Juni",
+ "Juli",
+ "August",
+ "September",
+ "Oktober",
+ "November",
+ "Dezember",
+ ],
+ },
+ firstDayOfWeek: 1,
+ weekAbbreviation: "KW",
+ rangeSeparator: " bis ",
+ scrollTitle: "Zum Ändern scrollen",
+ toggleTitle: "Zum Umschalten klicken",
+ time_24hr: true,
+ };
+ fp.l10ns.de = German;
+ var de = fp.l10ns;
+
+ exports.German = German;
+ exports.default = de;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/asset/js/vendor/flatpickr/l10n/es.js b/asset/js/vendor/flatpickr/l10n/es.js
new file mode 100644
index 0000000..4da4635
--- /dev/null
+++ b/asset/js/vendor/flatpickr/l10n/es.js
@@ -0,0 +1,70 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.icinga ? define(["exports"], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.es = {}));
+}(this, (function (exports) { 'use strict';
+
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined
+ ? window.flatpickr
+ : {
+ l10ns: {},
+ };
+ var Spanish = {
+ weekdays: {
+ shorthand: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"],
+ longhand: [
+ "Domingo",
+ "Lunes",
+ "Martes",
+ "Miércoles",
+ "Jueves",
+ "Viernes",
+ "Sábado",
+ ],
+ },
+ months: {
+ shorthand: [
+ "Ene",
+ "Feb",
+ "Mar",
+ "Abr",
+ "May",
+ "Jun",
+ "Jul",
+ "Ago",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dic",
+ ],
+ longhand: [
+ "Enero",
+ "Febrero",
+ "Marzo",
+ "Abril",
+ "Mayo",
+ "Junio",
+ "Julio",
+ "Agosto",
+ "Septiembre",
+ "Octubre",
+ "Noviembre",
+ "Diciembre",
+ ],
+ },
+ ordinal: function () {
+ return "º";
+ },
+ firstDayOfWeek: 1,
+ rangeSeparator: " a ",
+ time_24hr: true,
+ };
+ fp.l10ns.es = Spanish;
+ var es = fp.l10ns;
+
+ exports.Spanish = Spanish;
+ exports.default = es;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/asset/js/vendor/flatpickr/l10n/fi.js b/asset/js/vendor/flatpickr/l10n/fi.js
new file mode 100644
index 0000000..3510078
--- /dev/null
+++ b/asset/js/vendor/flatpickr/l10n/fi.js
@@ -0,0 +1,69 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.icinga ? define(["exports"], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.fi = {}));
+}(this, (function (exports) { 'use strict';
+
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined
+ ? window.flatpickr
+ : {
+ l10ns: {},
+ };
+ var Finnish = {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ["su", "ma", "ti", "ke", "to", "pe", "la"],
+ longhand: [
+ "sunnuntai",
+ "maanantai",
+ "tiistai",
+ "keskiviikko",
+ "torstai",
+ "perjantai",
+ "lauantai",
+ ],
+ },
+ months: {
+ shorthand: [
+ "tammi",
+ "helmi",
+ "maalis",
+ "huhti",
+ "touko",
+ "kesä",
+ "heinä",
+ "elo",
+ "syys",
+ "loka",
+ "marras",
+ "joulu",
+ ],
+ longhand: [
+ "tammikuu",
+ "helmikuu",
+ "maaliskuu",
+ "huhtikuu",
+ "toukokuu",
+ "kesäkuu",
+ "heinäkuu",
+ "elokuu",
+ "syyskuu",
+ "lokakuu",
+ "marraskuu",
+ "joulukuu",
+ ],
+ },
+ ordinal: function () {
+ return ".";
+ },
+ time_24hr: true,
+ };
+ fp.l10ns.fi = Finnish;
+ var fi = fp.l10ns;
+
+ exports.Finnish = Finnish;
+ exports.default = fi;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/asset/js/vendor/flatpickr/l10n/fr.js b/asset/js/vendor/flatpickr/l10n/fr.js
new file mode 100644
index 0000000..4d5edf3
--- /dev/null
+++ b/asset/js/vendor/flatpickr/l10n/fr.js
@@ -0,0 +1,75 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.icinga ? define(["exports"], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.fr = {}));
+}(this, (function (exports) { 'use strict';
+
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined
+ ? window.flatpickr
+ : {
+ l10ns: {},
+ };
+ var French = {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"],
+ longhand: [
+ "dimanche",
+ "lundi",
+ "mardi",
+ "mercredi",
+ "jeudi",
+ "vendredi",
+ "samedi",
+ ],
+ },
+ months: {
+ shorthand: [
+ "janv",
+ "févr",
+ "mars",
+ "avr",
+ "mai",
+ "juin",
+ "juil",
+ "août",
+ "sept",
+ "oct",
+ "nov",
+ "déc",
+ ],
+ longhand: [
+ "janvier",
+ "février",
+ "mars",
+ "avril",
+ "mai",
+ "juin",
+ "juillet",
+ "août",
+ "septembre",
+ "octobre",
+ "novembre",
+ "décembre",
+ ],
+ },
+ ordinal: function (nth) {
+ if (nth > 1)
+ return "";
+ return "er";
+ },
+ rangeSeparator: " au ",
+ weekAbbreviation: "Sem",
+ scrollTitle: "Défiler pour augmenter la valeur",
+ toggleTitle: "Cliquer pour basculer",
+ time_24hr: true,
+ };
+ fp.l10ns.fr = French;
+ var fr = fp.l10ns;
+
+ exports.French = French;
+ exports.default = fr;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/asset/js/vendor/flatpickr/l10n/it.js b/asset/js/vendor/flatpickr/l10n/it.js
new file mode 100644
index 0000000..674f172
--- /dev/null
+++ b/asset/js/vendor/flatpickr/l10n/it.js
@@ -0,0 +1,71 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.icinga ? define(["exports"], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.it = {}));
+}(this, (function (exports) { 'use strict';
+
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined
+ ? window.flatpickr
+ : {
+ l10ns: {},
+ };
+ var Italian = {
+ weekdays: {
+ shorthand: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"],
+ longhand: [
+ "Domenica",
+ "Lunedì",
+ "Martedì",
+ "Mercoledì",
+ "Giovedì",
+ "Venerdì",
+ "Sabato",
+ ],
+ },
+ months: {
+ shorthand: [
+ "Gen",
+ "Feb",
+ "Mar",
+ "Apr",
+ "Mag",
+ "Giu",
+ "Lug",
+ "Ago",
+ "Set",
+ "Ott",
+ "Nov",
+ "Dic",
+ ],
+ longhand: [
+ "Gennaio",
+ "Febbraio",
+ "Marzo",
+ "Aprile",
+ "Maggio",
+ "Giugno",
+ "Luglio",
+ "Agosto",
+ "Settembre",
+ "Ottobre",
+ "Novembre",
+ "Dicembre",
+ ],
+ },
+ firstDayOfWeek: 1,
+ ordinal: function () { return "°"; },
+ rangeSeparator: " al ",
+ weekAbbreviation: "Se",
+ scrollTitle: "Scrolla per aumentare",
+ toggleTitle: "Clicca per cambiare",
+ time_24hr: true,
+ };
+ fp.l10ns.it = Italian;
+ var it = fp.l10ns;
+
+ exports.Italian = Italian;
+ exports.default = it;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/asset/js/vendor/flatpickr/l10n/ja.js b/asset/js/vendor/flatpickr/l10n/ja.js
new file mode 100644
index 0000000..fd15e34
--- /dev/null
+++ b/asset/js/vendor/flatpickr/l10n/ja.js
@@ -0,0 +1,71 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.icinga ? define(["exports"], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ja = {}));
+}(this, (function (exports) { 'use strict';
+
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined
+ ? window.flatpickr
+ : {
+ l10ns: {},
+ };
+ var Japanese = {
+ weekdays: {
+ shorthand: ["日", "月", "火", "水", "木", "金", "土"],
+ longhand: [
+ "日曜日",
+ "月曜日",
+ "火曜日",
+ "水曜日",
+ "木曜日",
+ "金曜日",
+ "土曜日",
+ ],
+ },
+ months: {
+ shorthand: [
+ "1月",
+ "2月",
+ "3月",
+ "4月",
+ "5月",
+ "6月",
+ "7月",
+ "8月",
+ "9月",
+ "10月",
+ "11月",
+ "12月",
+ ],
+ longhand: [
+ "1月",
+ "2月",
+ "3月",
+ "4月",
+ "5月",
+ "6月",
+ "7月",
+ "8月",
+ "9月",
+ "10月",
+ "11月",
+ "12月",
+ ],
+ },
+ time_24hr: true,
+ rangeSeparator: " から ",
+ monthAriaLabel: "月",
+ amPM: ["午前", "午後"],
+ yearAriaLabel: "年",
+ hourAriaLabel: "時間",
+ minuteAriaLabel: "分",
+ };
+ fp.l10ns.ja = Japanese;
+ var ja = fp.l10ns;
+
+ exports.Japanese = Japanese;
+ exports.default = ja;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/asset/js/vendor/flatpickr/l10n/pt.js b/asset/js/vendor/flatpickr/l10n/pt.js
new file mode 100644
index 0000000..7d6c605
--- /dev/null
+++ b/asset/js/vendor/flatpickr/l10n/pt.js
@@ -0,0 +1,66 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.icinga ? define(["exports"], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.pt = {}));
+}(this, (function (exports) { 'use strict';
+
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined
+ ? window.flatpickr
+ : {
+ l10ns: {},
+ };
+ var Portuguese = {
+ weekdays: {
+ shorthand: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"],
+ longhand: [
+ "Domingo",
+ "Segunda-feira",
+ "Terça-feira",
+ "Quarta-feira",
+ "Quinta-feira",
+ "Sexta-feira",
+ "Sábado",
+ ],
+ },
+ months: {
+ shorthand: [
+ "Jan",
+ "Fev",
+ "Mar",
+ "Abr",
+ "Mai",
+ "Jun",
+ "Jul",
+ "Ago",
+ "Set",
+ "Out",
+ "Nov",
+ "Dez",
+ ],
+ longhand: [
+ "Janeiro",
+ "Fevereiro",
+ "Março",
+ "Abril",
+ "Maio",
+ "Junho",
+ "Julho",
+ "Agosto",
+ "Setembro",
+ "Outubro",
+ "Novembro",
+ "Dezembro",
+ ],
+ },
+ rangeSeparator: " até ",
+ time_24hr: true,
+ };
+ fp.l10ns.pt = Portuguese;
+ var pt = fp.l10ns;
+
+ exports.Portuguese = Portuguese;
+ exports.default = pt;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/asset/js/vendor/flatpickr/l10n/ru.js b/asset/js/vendor/flatpickr/l10n/ru.js
new file mode 100644
index 0000000..5065f0b
--- /dev/null
+++ b/asset/js/vendor/flatpickr/l10n/ru.js
@@ -0,0 +1,75 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.icinga ? define(["exports"], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ru = {}));
+}(this, (function (exports) { 'use strict';
+
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined
+ ? window.flatpickr
+ : {
+ l10ns: {},
+ };
+ var Russian = {
+ weekdays: {
+ shorthand: ["Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"],
+ longhand: [
+ "Воскресенье",
+ "Понедельник",
+ "Вторник",
+ "Среда",
+ "Четверг",
+ "Пятница",
+ "Суббота",
+ ],
+ },
+ months: {
+ shorthand: [
+ "Янв",
+ "Фев",
+ "Март",
+ "Апр",
+ "Май",
+ "Июнь",
+ "Июль",
+ "Авг",
+ "Сен",
+ "Окт",
+ "Ноя",
+ "Дек",
+ ],
+ longhand: [
+ "Январь",
+ "Февраль",
+ "Март",
+ "Апрель",
+ "Май",
+ "Июнь",
+ "Июль",
+ "Август",
+ "Сентябрь",
+ "Октябрь",
+ "Ноябрь",
+ "Декабрь",
+ ],
+ },
+ firstDayOfWeek: 1,
+ ordinal: function () {
+ return "";
+ },
+ rangeSeparator: " — ",
+ weekAbbreviation: "Нед.",
+ scrollTitle: "Прокрутите для увеличения",
+ toggleTitle: "Нажмите для переключения",
+ amPM: ["ДП", "ПП"],
+ yearAriaLabel: "Год",
+ time_24hr: true,
+ };
+ fp.l10ns.ru = Russian;
+ var ru = fp.l10ns;
+
+ exports.Russian = Russian;
+ exports.default = ru;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/asset/js/vendor/flatpickr/l10n/uk.js b/asset/js/vendor/flatpickr/l10n/uk.js
new file mode 100644
index 0000000..a2eaa71
--- /dev/null
+++ b/asset/js/vendor/flatpickr/l10n/uk.js
@@ -0,0 +1,66 @@
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+ typeof define === 'function' && define.icinga ? define(["exports"], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.uk = {}));
+}(this, (function (exports) { 'use strict';
+
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined
+ ? window.flatpickr
+ : {
+ l10ns: {},
+ };
+ var Ukrainian = {
+ firstDayOfWeek: 1,
+ weekdays: {
+ shorthand: ["Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"],
+ longhand: [
+ "Неділя",
+ "Понеділок",
+ "Вівторок",
+ "Середа",
+ "Четвер",
+ "П'ятниця",
+ "Субота",
+ ],
+ },
+ months: {
+ shorthand: [
+ "Січ",
+ "Лют",
+ "Бер",
+ "Кві",
+ "Тра",
+ "Чер",
+ "Лип",
+ "Сер",
+ "Вер",
+ "Жов",
+ "Лис",
+ "Гру",
+ ],
+ longhand: [
+ "Січень",
+ "Лютий",
+ "Березень",
+ "Квітень",
+ "Травень",
+ "Червень",
+ "Липень",
+ "Серпень",
+ "Вересень",
+ "Жовтень",
+ "Листопад",
+ "Грудень",
+ ],
+ },
+ time_24hr: true,
+ };
+ fp.l10ns.uk = Ukrainian;
+ var uk = fp.l10ns;
+
+ exports.Ukrainian = Ukrainian;
+ exports.default = uk;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+})));