ns-vue-flatpickr
Version:
A lightweight and customizable date/time picker component for Vue.js applications
1,607 lines • 71.3 kB
JavaScript
import { defineComponent as _n, h as de, nextTick as Fn } from "vue";
var xe = [
"onChange",
"onClose",
"onDayCreate",
"onDestroy",
"onKeyDown",
"onMonthChange",
"onOpen",
"onParseConfig",
"onReady",
"onValueUpdate",
"onYearChange",
"onPreCalendarPosition"
], z = {
_disable: [],
allowInput: !1,
allowInvalidPreload: !1,
altFormat: "F j, Y",
altInput: !1,
altInputClass: "form-control input",
animate: typeof window == "object" && window.navigator.userAgent.indexOf("MSIE") === -1,
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(a) {
return typeof console < "u" && console.warn(a);
},
getWeek: function(a) {
var r = new Date(a.getTime());
r.setHours(0, 0, 0, 0), r.setDate(r.getDate() + 3 - (r.getDay() + 6) % 7);
var e = new Date(r.getFullYear(), 0, 4);
return 1 + Math.round(((r.getTime() - e.getTime()) / 864e5 - 3 + (e.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: /* @__PURE__ */ 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,
useLocaleYear: !1
}, te = {
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(a) {
var r = a % 100;
if (r > 3 && r < 21)
return "th";
switch (r % 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,
localeYearAdjustment: 0
}, T = function(a, r) {
return r === void 0 && (r = 2), ("000" + a).slice(r * -1);
}, A = function(a) {
return a === !0 ? 1 : 0;
};
function $e(a, r) {
var e;
return function() {
var c = this, d = arguments;
clearTimeout(e), e = setTimeout(function() {
return a.apply(c, d);
}, r);
};
}
var ke = function(a) {
return a instanceof Array ? a : [a];
};
function I(a, r, e) {
if (e === !0)
return a.classList.add(r);
a.classList.remove(r);
}
function v(a, r, e) {
var c = window.document.createElement(a);
return r = r || "", e = e || "", c.className = r, e !== void 0 && (c.textContent = e), c;
}
function ge(a) {
for (; a.firstChild; )
a.removeChild(a.firstChild);
}
function qe(a, r) {
if (r(a))
return a;
if (a.parentNode)
return qe(a.parentNode, r);
}
function me(a, r) {
var e = v("div", "numInputWrapper"), c = v("input", "numInput " + a), d = v("span", "arrowUp"), m = v("span", "arrowDown");
if (navigator.userAgent.indexOf("MSIE 9.0") === -1 ? c.type = "number" : (c.type = "text", c.pattern = "\\d*"), r !== void 0)
for (var b in r)
c.setAttribute(b, r[b]);
return e.appendChild(c), e.appendChild(d), e.appendChild(m), e;
}
function _(a) {
try {
if (typeof a.composedPath == "function") {
var r = a.composedPath();
return r[0];
}
return a.target;
} catch {
return a.target;
}
}
var Ie = function() {
}, pe = function(a, r, e) {
return e.months[r ? "shorthand" : "longhand"][a];
}, An = {
D: Ie,
F: function(a, r, e) {
a.setMonth(e.months.longhand.indexOf(r));
},
G: function(a, r) {
a.setHours((a.getHours() >= 12 ? 12 : 0) + parseFloat(r));
},
H: function(a, r) {
a.setHours(parseFloat(r));
},
J: function(a, r) {
a.setDate(parseFloat(r));
},
K: function(a, r, e) {
a.setHours(a.getHours() % 12 + 12 * A(new RegExp(e.amPM[1], "i").test(r)));
},
M: function(a, r, e) {
a.setMonth(e.months.shorthand.indexOf(r));
},
S: function(a, r) {
a.setSeconds(parseFloat(r));
},
U: function(a, r) {
return new Date(parseFloat(r) * 1e3);
},
W: function(a, r, e) {
var c = parseInt(r), d = new Date(a.getFullYear(), 0, 2 + (c - 1) * 7, 0, 0, 0, 0);
return d.setDate(d.getDate() - d.getDay() + e.firstDayOfWeek), d;
},
Y: function(a, r, e, c) {
if (c.useLocaleYear) {
var d = e.localeYearAdjustment || 0;
a.setFullYear(parseFloat(r) - d);
} else
a.setFullYear(parseFloat(r));
},
Z: function(a, r) {
return new Date(r);
},
d: function(a, r) {
a.setDate(parseFloat(r));
},
h: function(a, r) {
a.setHours((a.getHours() >= 12 ? 12 : 0) + parseFloat(r));
},
i: function(a, r) {
a.setMinutes(parseFloat(r));
},
j: function(a, r) {
a.setDate(parseFloat(r));
},
l: Ie,
m: function(a, r) {
a.setMonth(parseFloat(r) - 1);
},
n: function(a, r) {
a.setMonth(parseFloat(r) - 1);
},
s: function(a, r) {
a.setSeconds(parseFloat(r));
},
u: function(a, r) {
return new Date(parseFloat(r));
},
w: Ie,
y: function(a, r, e, c) {
if (c.useLocaleYear) {
var d = e.localeYearAdjustment || 0, m = Math.floor(((/* @__PURE__ */ new Date()).getFullYear() + d) / 100) * 100, b = m + parseFloat(r) - d;
a.setFullYear(b);
} else
a.setFullYear(2e3 + parseFloat(r));
}
}, V = {
D: "",
F: "",
G: "(\\d\\d|\\d)",
H: "(\\d\\d|\\d)",
J: "(\\d\\d|\\d)\\w+",
K: "",
M: "",
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: "",
m: "(\\d\\d|\\d)",
n: "(\\d\\d|\\d)",
s: "(\\d\\d|\\d)",
u: "(.+)",
w: "(\\d\\d|\\d)",
y: "(\\d{2})"
}, ne = {
Z: function(a) {
return a.toISOString();
},
D: function(a, r, e) {
return r.weekdays.shorthand[ne.w(a, r, e)];
},
F: function(a, r, e) {
return pe(ne.n(a, r, e) - 1, !1, r);
},
G: function(a, r, e) {
return T(ne.h(a, r, e));
},
H: function(a) {
return T(a.getHours());
},
J: function(a, r) {
return r.ordinal !== void 0 ? a.getDate() + r.ordinal(a.getDate()) : a.getDate();
},
K: function(a, r) {
return r.amPM[A(a.getHours() > 11)];
},
M: function(a, r) {
return pe(a.getMonth(), !0, r);
},
S: function(a) {
return T(a.getSeconds());
},
U: function(a) {
return a.getTime() / 1e3;
},
W: function(a, r, e) {
return e.getWeek(a);
},
Y: function(a, r, e) {
return e.useLocaleYear ? T(a.getFullYear() + (r.localeYearAdjustment || 0), 4) : T(a.getFullYear(), 4);
},
d: function(a) {
return T(a.getDate());
},
h: function(a) {
return a.getHours() % 12 ? a.getHours() % 12 : 12;
},
i: function(a) {
return T(a.getMinutes());
},
j: function(a) {
return a.getDate();
},
l: function(a, r) {
return r.weekdays.longhand[a.getDay()];
},
m: function(a) {
return T(a.getMonth() + 1);
},
n: function(a) {
return a.getMonth() + 1;
},
s: function(a) {
return a.getSeconds();
},
u: function(a) {
return a.getTime();
},
w: function(a) {
return a.getDay();
},
y: function(a, r, e) {
return e.useLocaleYear ? String(a.getFullYear() + (r.localeYearAdjustment || 0)).substring(2) : String(a.getFullYear()).substring(2);
}
}, ze = function(a) {
var r = a.config, e = r === void 0 ? z : r, c = a.l10n, d = c === void 0 ? te : c, m = a.isMobile, b = m === void 0 ? !1 : m;
return function(M, x, Z) {
var E = Z || d;
return e.formatDate !== void 0 && !b ? e.formatDate(M, x, E) : x.split("").map(function(O, Y, P) {
return ne[O] && P[Y - 1] !== "\\" ? ne[O](M, E, e) : O !== "\\" ? O : "";
}).join("");
};
}, Fe = function(a) {
var r = a.config, e = r === void 0 ? z : r, c = a.l10n, d = c === void 0 ? te : c;
return function(m, b, M, x) {
if (!(m !== 0 && !m)) {
var Z = x || d, E, O = m;
if (m instanceof Date)
E = new Date(m.getTime());
else if (typeof m != "string" && m.toFixed !== void 0)
E = new Date(m);
else if (typeof m == "string") {
var Y = b || (e || z).dateFormat, P = String(m).trim();
if (P === "today")
E = /* @__PURE__ */ new Date(), M = !0;
else if (e && e.parseDate)
E = e.parseDate(m, Y);
else if (/Z$/.test(P) || /GMT$/.test(P))
E = new Date(m);
else {
for (var ae = void 0, D = [], j = 0, he = 0, L = ""; j < Y.length; j++) {
var R = Y[j], $ = R === "\\", ve = Y[j - 1] === "\\" || $;
if (V[R] && !ve) {
L += V[R];
var W = new RegExp(L).exec(m);
W && (ae = !0) && D[R !== "Y" ? "push" : "unshift"]({
fn: An[R],
val: W[++he]
});
} else
$ || (L += ".");
}
E = !e || !e.noCalendar ? new Date((/* @__PURE__ */ new Date()).getFullYear(), 0, 1, 0, 0, 0, 0) : new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)), D.forEach(function(K) {
var U = K.fn, De = K.val;
return E = U(E, De, Z, e) || E;
}), E = ae ? E : void 0;
}
}
if (!(E instanceof Date && !isNaN(E.getTime()))) {
e.errorHandler(new Error("Invalid date provided: " + O));
return;
}
return M === !0 && E.setHours(0, 0, 0, 0), E;
}
};
};
function F(a, r, e) {
return e === void 0 && (e = !0), e !== !1 ? new Date(a.getTime()).setHours(0, 0, 0, 0) - new Date(r.getTime()).setHours(0, 0, 0, 0) : a.getTime() - r.getTime();
}
var On = function(a, r, e) {
return a > Math.min(r, e) && a < Math.max(r, e);
}, Te = function(a, r, e) {
return a * 3600 + r * 60 + e;
}, Yn = function(a) {
var r = Math.floor(a / 3600), e = (a - r * 3600) / 60;
return [r, e, a - r * 3600 - e * 60];
}, Nn = {
DAY: 864e5
};
function Se(a) {
var r = a.defaultHour, e = a.defaultMinute, c = a.defaultSeconds;
if (a.minDate !== void 0) {
var d = a.minDate.getHours(), m = a.minDate.getMinutes(), b = a.minDate.getSeconds();
r < d && (r = d), r === d && e < m && (e = m), r === d && e === m && c < b && (c = a.minDate.getSeconds());
}
if (a.maxDate !== void 0) {
var M = a.maxDate.getHours(), x = a.maxDate.getMinutes();
r = Math.min(r, M), r === M && (e = Math.min(x, e)), r === M && e === x && (c = a.maxDate.getSeconds());
}
return { hours: r, minutes: e, seconds: c };
}
typeof Object.assign != "function" && (Object.assign = function(a) {
for (var r = [], e = 1; e < arguments.length; e++)
r[e - 1] = arguments[e];
if (!a)
throw TypeError("Cannot convert undefined or null to object");
for (var c = function(M) {
M && Object.keys(M).forEach(function(x) {
return a[x] = M[x];
});
}, d = 0, m = r; d < m.length; d++) {
var b = m[d];
c(b);
}
return a;
});
var k = globalThis && globalThis.__assign || function() {
return k = Object.assign || function(a) {
for (var r, e = 1, c = arguments.length; e < c; e++) {
r = arguments[e];
for (var d in r)
Object.prototype.hasOwnProperty.call(r, d) && (a[d] = r[d]);
}
return a;
}, k.apply(this, arguments);
}, Ke = globalThis && globalThis.__spreadArrays || function() {
for (var a = 0, r = 0, e = arguments.length; r < e; r++)
a += arguments[r].length;
for (var c = Array(a), d = 0, r = 0; r < e; r++)
for (var m = arguments[r], b = 0, M = m.length; b < M; b++, d++)
c[d] = m[b];
return c;
}, Pn = 300;
function Hn(a, r) {
var e = {
config: k(k({}, z), y.defaultConfig),
l10n: te
};
e.parseDate = Fe({ config: e.config, l10n: e.l10n }), e._handlers = [], e.pluginElements = [], e.loadedPlugins = [], e._bind = D, e._setHoursFromDate = Y, e._positionCalendar = ue, e.changeMonth = be, e.changeYear = re, e.clear = tn, e.close = an, e.onMouseOver = le, e._createElement = v, e.createDay = W, e.destroy = rn, e.isEnabled = B, e.jumpToDate = L, e.updateValue = H, e.open = un, e.redraw = je, e.set = dn, e.setDate = gn, e.toggle = vn;
function c() {
e.utils = {
getDaysInMonth: function(n, t) {
return n === void 0 && (n = e.currentMonth), t === void 0 && (t = e.currentYear), n === 1 && (t % 4 === 0 && t % 100 !== 0 || t % 400 === 0) ? 29 : e.l10n.daysInMonth[n];
}
};
}
function d() {
e.element = e.input = a, e.isOpen = !1, sn(), Le(), pn(), mn(), c(), e.isMobile || ve(), he(), (e.selectedDates.length || e.config.noCalendar) && (e.config.enableTime && Y(e.config.noCalendar ? e.latestSelectedDateObj : void 0), H(!1)), M();
var n = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
!e.isMobile && n && ue(), w("onReady");
}
function m() {
var n;
return ((n = e.calendarContainer) === null || n === void 0 ? void 0 : n.getRootNode()).activeElement || document.activeElement;
}
function b(n) {
return n.bind(e);
}
function M() {
var n = e.config;
n.weekNumbers === !1 && n.showMonths === 1 || n.noCalendar !== !0 && window.requestAnimationFrame(function() {
if (e.calendarContainer !== void 0 && (e.calendarContainer.style.visibility = "hidden", e.calendarContainer.style.display = "block"), e.daysContainer !== void 0) {
var t = (e.days.offsetWidth + 1) * n.showMonths;
e.daysContainer.style.width = t + "px", e.calendarContainer.style.width = t + (e.weekWrapper !== void 0 ? e.weekWrapper.offsetWidth : 0) + "px", e.calendarContainer.style.removeProperty("visibility"), e.calendarContainer.style.removeProperty("display");
}
});
}
function x(n) {
if (e.selectedDates.length === 0) {
var t = e.config.minDate === void 0 || F(/* @__PURE__ */ new Date(), e.config.minDate) >= 0 ? /* @__PURE__ */ new Date() : new Date(e.config.minDate.getTime()), i = Se(e.config);
t.setHours(i.hours, i.minutes, i.seconds, t.getMilliseconds()), e.selectedDates = [t], e.latestSelectedDateObj = t;
}
n !== void 0 && n.type !== "blur" && Cn(n);
var o = e._input.value;
O(), H(), e._input.value !== o && e._debouncedChange();
}
function Z(n, t) {
return n % 12 + 12 * A(t === e.l10n.amPM[1]);
}
function E(n) {
switch (n % 24) {
case 0:
case 12:
return 12;
default:
return n % 12;
}
}
function O() {
if (!(e.hourElement === void 0 || e.minuteElement === void 0)) {
var n = (parseInt(e.hourElement.value.slice(-2), 10) || 0) % 24, t = (parseInt(e.minuteElement.value, 10) || 0) % 60, i = e.secondElement !== void 0 ? (parseInt(e.secondElement.value, 10) || 0) % 60 : 0;
e.amPM !== void 0 && (n = Z(n, e.amPM.textContent));
var o = e.config.minTime !== void 0 || e.config.minDate && e.minDateHasTime && e.latestSelectedDateObj && F(e.latestSelectedDateObj, e.config.minDate, !0) === 0, l = e.config.maxTime !== void 0 || e.config.maxDate && e.maxDateHasTime && e.latestSelectedDateObj && F(e.latestSelectedDateObj, e.config.maxDate, !0) === 0;
if (e.config.maxTime !== void 0 && e.config.minTime !== void 0 && e.config.minTime > e.config.maxTime) {
var u = Te(e.config.minTime.getHours(), e.config.minTime.getMinutes(), e.config.minTime.getSeconds()), p = Te(e.config.maxTime.getHours(), e.config.maxTime.getMinutes(), e.config.maxTime.getSeconds()), s = Te(n, t, i);
if (s > p && s < u) {
var h = Yn(u);
n = h[0], t = h[1], i = h[2];
}
} else {
if (l) {
var f = e.config.maxTime !== void 0 ? e.config.maxTime : e.config.maxDate;
n = Math.min(n, f.getHours()), n === f.getHours() && (t = Math.min(t, f.getMinutes())), t === f.getMinutes() && (i = Math.min(i, f.getSeconds()));
}
if (o) {
var g = e.config.minTime !== void 0 ? e.config.minTime : e.config.minDate;
n = Math.max(n, g.getHours()), n === g.getHours() && t < g.getMinutes() && (t = g.getMinutes()), t === g.getMinutes() && (i = Math.max(i, g.getSeconds()));
}
}
P(n, t, i);
}
}
function Y(n) {
var t = n || e.latestSelectedDateObj;
t && t instanceof Date && P(t.getHours(), t.getMinutes(), t.getSeconds());
}
function P(n, t, i) {
e.latestSelectedDateObj !== void 0 && e.latestSelectedDateObj.setHours(n % 24, t, i || 0, 0), !(!e.hourElement || !e.minuteElement || e.isMobile) && (e.hourElement.value = T(e.config.time_24hr ? n : (12 + n) % 12 + 12 * A(n % 12 === 0)), e.minuteElement.value = T(t), e.amPM !== void 0 && (e.amPM.textContent = e.l10n.amPM[A(n >= 12)]), e.secondElement !== void 0 && (e.secondElement.value = T(i)));
}
function ae(n) {
var t = _(n), i = parseInt(t.value) + (n.delta || 0);
if (i / 1e3 > 1 || n.key === "Enter" && !/[^\d]/.test(i.toString())) {
if (e.config.useLocaleYear) {
var o = e.l10n.localeYearAdjustment || 0;
i = i - o;
}
re(i);
}
}
function D(n, t, i, o) {
if (t instanceof Array)
return t.forEach(function(l) {
return D(n, l, i, o);
});
if (n instanceof Array)
return n.forEach(function(l) {
return D(l, t, i, o);
});
n.addEventListener(t, i, o), e._handlers.push({
remove: function() {
return n.removeEventListener(t, i, o);
}
});
}
function j() {
w("onChange");
}
function he() {
if (e.config.wrap && ["open", "close", "toggle", "clear"].forEach(function(i) {
Array.prototype.forEach.call(e.element.querySelectorAll("[data-" + i + "]"), function(o) {
return D(o, "click", e[i]);
});
}), e.isMobile) {
hn();
return;
}
var n = $e(ln, 50);
if (e._debouncedChange = $e(j, Pn), e.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent) && D(e.daysContainer, "mouseover", function(i) {
e.config.mode === "range" && le(_(i));
}), D(e._input, "keydown", Ne), e.calendarContainer !== void 0 && D(e.calendarContainer, "keydown", Ne), !e.config.inline && !e.config.static && D(window, "resize", n), window.ontouchstart !== void 0 ? D(window.document, "touchstart", Ce) : D(window.document, "mousedown", Ce), D(window.document, "focus", Ce, { capture: !0 }), e.config.clickOpens === !0 && (D(e._input, "focus", e.open), D(e._input, "click", e.open)), e.daysContainer !== void 0 && (D(e.monthNav, "click", bn), D(e.monthNav, ["keyup", "increment"], ae), D(e.daysContainer, "click", Re)), e.timeContainer !== void 0 && e.minuteElement !== void 0 && e.hourElement !== void 0) {
var t = function(i) {
return _(i).select();
};
D(e.timeContainer, ["increment"], x), D(e.timeContainer, "blur", x, { capture: !0 }), D(e.timeContainer, "click", R), D([e.hourElement, e.minuteElement], ["focus", "click"], t), e.secondElement !== void 0 && D(e.secondElement, "focus", function() {
return e.secondElement && e.secondElement.select();
}), e.amPM !== void 0 && D(e.amPM, "click", function(i) {
x(i);
});
}
e.config.allowInput && D(e._input, "blur", on);
}
function L(n, t) {
var i = n !== void 0 ? e.parseDate(n) : e.latestSelectedDateObj || (e.config.minDate && e.config.minDate > e.now ? e.config.minDate : e.config.maxDate && e.config.maxDate < e.now ? e.config.maxDate : e.now), o = e.currentYear, l = e.currentMonth;
try {
i !== void 0 && (e.currentYear = i.getFullYear(), e.currentMonth = i.getMonth());
} catch (u) {
u.message = "Invalid date supplied: " + i, e.config.errorHandler(u);
}
t && e.currentYear !== o && (w("onYearChange"), J()), t && (e.currentYear !== o || e.currentMonth !== l) && w("onMonthChange"), e.redraw();
}
function R(n) {
var t = _(n);
~t.className.indexOf("arrow") && $(n, t.classList.contains("arrowUp") ? 1 : -1);
}
function $(n, t, i) {
var o = n && _(n), l = i || o && o.parentNode && o.parentNode.firstChild, u = Me("increment");
u.delta = t, l && l.dispatchEvent(u);
}
function ve() {
var n = window.document.createDocumentFragment();
if (e.calendarContainer = v("div", "flatpickr-calendar"), e.calendarContainer.tabIndex = -1, !e.config.noCalendar) {
if (n.appendChild(Xe()), e.innerContainer = v("div", "flatpickr-innerContainer"), e.config.weekNumbers) {
var t = nn(), i = t.weekWrapper, o = t.weekNumbers;
e.innerContainer.appendChild(i), e.weekNumbers = o, e.weekWrapper = i;
}
e.rContainer = v("div", "flatpickr-rContainer"), e.rContainer.appendChild(Oe()), e.daysContainer || (e.daysContainer = v("div", "flatpickr-days"), e.daysContainer.tabIndex = -1), ie(), e.rContainer.appendChild(e.daysContainer), e.innerContainer.appendChild(e.rContainer), n.appendChild(e.innerContainer);
}
e.config.enableTime && n.appendChild(en()), I(e.calendarContainer, "rangeMode", e.config.mode === "range"), I(e.calendarContainer, "animate", e.config.animate === !0), I(e.calendarContainer, "multiMonth", e.config.showMonths > 1), e.calendarContainer.appendChild(n);
var l = e.config.appendTo !== void 0 && e.config.appendTo.nodeType !== void 0;
if ((e.config.inline || e.config.static) && (e.calendarContainer.classList.add(e.config.inline ? "inline" : "static"), e.config.inline && (!l && e.element.parentNode ? e.element.parentNode.insertBefore(e.calendarContainer, e._input.nextSibling) : e.config.appendTo !== void 0 && e.config.appendTo.appendChild(e.calendarContainer)), e.config.static)) {
var u = v("div", "flatpickr-wrapper");
e.element.parentNode && e.element.parentNode.insertBefore(u, e.element), u.appendChild(e.element), e.altInput && u.appendChild(e.altInput), u.appendChild(e.calendarContainer);
}
!e.config.static && !e.config.inline && (e.config.appendTo !== void 0 ? e.config.appendTo : window.document.body).appendChild(e.calendarContainer);
}
function W(n, t, i, o) {
var l = B(t, !0), u = v("span", n, t.getDate().toString());
return u.dateObj = t, u.$i = o, u.setAttribute("aria-label", e.formatDate(t, e.config.ariaDateFormat)), n.indexOf("hidden") === -1 && F(t, e.now) === 0 && (e.todayDateElem = u, u.classList.add("today"), u.setAttribute("aria-current", "date")), l ? (u.tabIndex = -1, ye(t) && (u.classList.add("selected"), e.selectedDateElem = u, e.config.mode === "range" && (I(u, "startRange", e.selectedDates[0] && F(t, e.selectedDates[0], !0) === 0), I(u, "endRange", e.selectedDates[1] && F(t, e.selectedDates[1], !0) === 0), n === "nextMonthDay" && u.classList.add("inRange")))) : u.classList.add("flatpickr-disabled"), e.config.mode === "range" && Dn(t) && !ye(t) && u.classList.add("inRange"), e.weekNumbers && e.config.showMonths === 1 && n !== "prevMonthDay" && o % 7 === 6 && e.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + e.config.getWeek(t) + "</span>"), w("onDayCreate", u), u;
}
function K(n) {
n.focus(), e.config.mode === "range" && le(n);
}
function U(n) {
for (var t = n > 0 ? 0 : e.config.showMonths - 1, i = n > 0 ? e.config.showMonths : -1, o = t; o != i; o += n)
for (var l = e.daysContainer.children[o], u = n > 0 ? 0 : l.children.length - 1, p = n > 0 ? l.children.length : -1, s = u; s != p; s += n) {
var h = l.children[s];
if (h.className.indexOf("hidden") === -1 && B(h.dateObj))
return h;
}
}
function De(n, t) {
for (var i = n.className.indexOf("Month") === -1 ? n.dateObj.getMonth() : e.currentMonth, o = t > 0 ? e.config.showMonths : -1, l = t > 0 ? 1 : -1, u = i - e.currentMonth; u != o; u += l)
for (var p = e.daysContainer.children[u], s = i - e.currentMonth === u ? n.$i + t : t < 0 ? p.children.length - 1 : 0, h = p.children.length, f = s; f >= 0 && f < h && f != (t > 0 ? h : -1); f += l) {
var g = p.children[f];
if (g.className.indexOf("hidden") === -1 && B(g.dateObj) && Math.abs(n.$i - f) >= Math.abs(t))
return K(g);
}
e.changeMonth(l), Q(U(l), 0);
}
function Q(n, t) {
var i = m(), o = oe(i || document.body), l = n !== void 0 ? n : o ? i : e.selectedDateElem !== void 0 && oe(e.selectedDateElem) ? e.selectedDateElem : e.todayDateElem !== void 0 && oe(e.todayDateElem) ? e.todayDateElem : U(t > 0 ? 1 : -1);
l === void 0 ? e._input.focus() : o ? De(l, t) : K(l);
}
function Ze(n, t) {
for (var i = (new Date(n, t, 1).getDay() - e.l10n.firstDayOfWeek + 7) % 7, o = e.utils.getDaysInMonth((t - 1 + 12) % 12, n), l = e.utils.getDaysInMonth(t, n), u = window.document.createDocumentFragment(), p = e.config.showMonths > 1, s = p ? "prevMonthDay hidden" : "prevMonthDay", h = p ? "nextMonthDay hidden" : "nextMonthDay", f = o + 1 - i, g = 0; f <= o; f++, g++)
u.appendChild(W("flatpickr-day " + s, new Date(n, t - 1, f), f, g));
for (f = 1; f <= l; f++, g++)
u.appendChild(W("flatpickr-day", new Date(n, t, f), f, g));
for (var C = l + 1; C <= 42 - i && (e.config.showMonths === 1 || g % 7 !== 0); C++, g++)
u.appendChild(W("flatpickr-day " + h, new Date(n, t + 1, C % l), C, g));
var N = v("div", "dayContainer");
return N.appendChild(u), N;
}
function ie() {
if (e.daysContainer !== void 0) {
ge(e.daysContainer), e.weekNumbers && ge(e.weekNumbers);
for (var n = document.createDocumentFragment(), t = 0; t < e.config.showMonths; t++) {
var i = new Date(e.currentYear, e.currentMonth, 1);
i.setMonth(e.currentMonth + t), n.appendChild(Ze(i.getFullYear(), i.getMonth()));
}
e.daysContainer.appendChild(n), e.days = e.daysContainer.firstChild, e.config.mode === "range" && e.selectedDates.length === 1 && le();
}
}
function J() {
if (!(e.config.showMonths > 1 || e.config.monthSelectorType !== "dropdown")) {
var n = function(o) {
return e.config.minDate !== void 0 && e.currentYear === e.config.minDate.getFullYear() && o < e.config.minDate.getMonth() ? !1 : !(e.config.maxDate !== void 0 && e.currentYear === e.config.maxDate.getFullYear() && o > e.config.maxDate.getMonth());
};
e.monthsDropdownContainer && (e.monthsDropdownContainer.tabIndex = -1, e.monthsDropdownContainer.innerHTML = "");
for (var t = 0; t < 12; t++)
if (n(t)) {
var i = v("option", "flatpickr-monthDropdown-month");
i.value = new Date(e.currentYear, t).getMonth().toString(), i.textContent = pe(t, e.config.shorthandCurrentMonth, e.l10n), i.tabIndex = -1, e.currentMonth === t && (i.selected = !0), e.monthsDropdownContainer && e.monthsDropdownContainer.appendChild(i);
}
}
}
function Qe() {
var n = v("div", "flatpickr-month"), t = window.document.createDocumentFragment(), i;
e.config.showMonths > 1 || e.config.monthSelectorType === "static" ? i = v("span", "cur-month") : (e.monthsDropdownContainer = v("select", "flatpickr-monthDropdown-months"), e.monthsDropdownContainer.setAttribute("aria-label", e.l10n.monthAriaLabel), D(e.monthsDropdownContainer, "change", function(p) {
var s = _(p), h = parseInt(s.value, 10);
e.changeMonth(h - e.currentMonth), w("onMonthChange");
}), J(), i = e.monthsDropdownContainer);
var o = me("cur-year", { tabindex: "-1" }), l = o.getElementsByTagName("input")[0];
l.setAttribute("aria-label", e.l10n.yearAriaLabel), e.config.minDate && l.setAttribute("min", e.config.minDate.getFullYear().toString()), e.config.maxDate && (l.setAttribute("max", e.config.maxDate.getFullYear().toString()), l.disabled = !!e.config.minDate && e.config.minDate.getFullYear() === e.config.maxDate.getFullYear());
var u = v("div", "flatpickr-current-month");
return u.appendChild(i), u.appendChild(o), t.appendChild(u), n.appendChild(t), {
container: n,
yearElement: l,
monthElement: i
};
}
function Ae() {
ge(e.monthNav), e.monthNav.appendChild(e.prevMonthNav), e.config.showMonths && (e.yearElements = [], e.monthElements = []);
for (var n = e.config.showMonths; n--; ) {
var t = Qe();
e.yearElements.push(t.yearElement), e.monthElements.push(t.monthElement), e.monthNav.appendChild(t.container);
}
e.monthNav.appendChild(e.nextMonthNav);
}
function Xe() {
return e.monthNav = v("div", "flatpickr-months"), e.yearElements = [], e.monthElements = [], e.prevMonthNav = v("span", "flatpickr-prev-month"), e.prevMonthNav.innerHTML = e.config.prevArrow, e.nextMonthNav = v("span", "flatpickr-next-month"), e.nextMonthNav.innerHTML = e.config.nextArrow, Ae(), Object.defineProperty(e, "_hidePrevMonthArrow", {
get: function() {
return e.__hidePrevMonthArrow;
},
set: function(n) {
e.__hidePrevMonthArrow !== n && (I(e.prevMonthNav, "flatpickr-disabled", n), e.__hidePrevMonthArrow = n);
}
}), Object.defineProperty(e, "_hideNextMonthArrow", {
get: function() {
return e.__hideNextMonthArrow;
},
set: function(n) {
e.__hideNextMonthArrow !== n && (I(e.nextMonthNav, "flatpickr-disabled", n), e.__hideNextMonthArrow = n);
}
}), e.currentYearElement = e.yearElements[0], fe(), e.monthNav;
}
function en() {
e.calendarContainer.classList.add("hasTime"), e.config.noCalendar && e.calendarContainer.classList.add("noCalendar");
var n = Se(e.config);
e.timeContainer = v("div", "flatpickr-time"), e.timeContainer.tabIndex = -1;
var t = v("span", "flatpickr-time-separator", ":"), i = me("flatpickr-hour", {
"aria-label": e.l10n.hourAriaLabel
});
e.hourElement = i.getElementsByTagName("input")[0];
var o = me("flatpickr-minute", {
"aria-label": e.l10n.minuteAriaLabel
});
if (e.minuteElement = o.getElementsByTagName("input")[0], e.hourElement.tabIndex = e.minuteElement.tabIndex = -1, e.hourElement.value = T(e.latestSelectedDateObj ? e.latestSelectedDateObj.getHours() : e.config.time_24hr ? n.hours : E(n.hours)), e.minuteElement.value = T(e.latestSelectedDateObj ? e.latestSelectedDateObj.getMinutes() : n.minutes), e.hourElement.setAttribute("step", e.config.hourIncrement.toString()), e.minuteElement.setAttribute("step", e.config.minuteIncrement.toString()), e.hourElement.setAttribute("min", e.config.time_24hr ? "0" : "1"), e.hourElement.setAttribute("max", e.config.time_24hr ? "23" : "12"), e.hourElement.setAttribute("maxlength", "2"), e.minuteElement.setAttribute("min", "0"), e.minuteElement.setAttribute("max", "59"), e.minuteElement.setAttribute("maxlength", "2"), e.timeContainer.appendChild(i), e.timeContainer.appendChild(t), e.timeContainer.appendChild(o), e.config.time_24hr && e.timeContainer.classList.add("time24hr"), e.config.enableSeconds) {
e.timeContainer.classList.add("hasSeconds");
var l = me("flatpickr-second");
e.secondElement = l.getElementsByTagName("input")[0], e.secondElement.value = T(e.latestSelectedDateObj ? e.latestSelectedDateObj.getSeconds() : n.seconds), e.secondElement.setAttribute("step", e.minuteElement.getAttribute("step")), e.secondElement.setAttribute("min", "0"), e.secondElement.setAttribute("max", "59"), e.secondElement.setAttribute("maxlength", "2"), e.timeContainer.appendChild(v("span", "flatpickr-time-separator", ":")), e.timeContainer.appendChild(l);
}
return e.config.time_24hr || (e.amPM = v("span", "flatpickr-am-pm", e.l10n.amPM[A((e.latestSelectedDateObj ? e.hourElement.value : e.config.defaultHour) > 11)]), e.amPM.title = e.l10n.toggleTitle, e.amPM.tabIndex = -1, e.timeContainer.appendChild(e.amPM)), e.timeContainer;
}
function Oe() {
e.weekdayContainer ? ge(e.weekdayContainer) : e.weekdayContainer = v("div", "flatpickr-weekdays");
for (var n = e.config.showMonths; n--; ) {
var t = v("div", "flatpickr-weekdaycontainer");
e.weekdayContainer.appendChild(t);
}
return Ye(), e.weekdayContainer;
}
function Ye() {
if (e.weekdayContainer) {
var n = e.l10n.firstDayOfWeek, t = Ke(e.l10n.weekdays.shorthand);
n > 0 && n < t.length && (t = Ke(t.splice(n, t.length), t.splice(0, n)));
for (var i = e.config.showMonths; i--; )
e.weekdayContainer.children[i].innerHTML = `
<span class='flatpickr-weekday'>
` + t.join("</span><span class='flatpickr-weekday'>") + `
</span>
`;
}
}
function nn() {
e.calendarContainer.classList.add("hasWeeks");
var n = v("div", "flatpickr-weekwrapper");
n.appendChild(v("span", "flatpickr-weekday", e.l10n.weekAbbreviation));
var t = v("div", "flatpickr-weeks");
return n.appendChild(t), {
weekWrapper: n,
weekNumbers: t
};
}
function be(n, t) {
t === void 0 && (t = !0);
var i = t ? n : n - e.currentMonth;
i < 0 && e._hidePrevMonthArrow === !0 || i > 0 && e._hideNextMonthArrow === !0 || (e.currentMonth += i, (e.currentMonth < 0 || e.currentMonth > 11) && (e.currentYear += e.currentMonth > 11 ? 1 : -1, e.currentMonth = (e.currentMonth + 12) % 12, w("onYearChange"), J()), ie(), w("onMonthChange"), fe());
}
function tn(n, t) {
if (n === void 0 && (n = !0), t === void 0 && (t = !0), e.input.value = "", e.altInput !== void 0 && (e.altInput.value = ""), e.mobileInput !== void 0 && (e.mobileInput.value = ""), e.selectedDates = [], e.latestSelectedDateObj = void 0, t === !0 && (e.currentYear = e._initialDate.getFullYear(), e.currentMonth = e._initialDate.getMonth()), e.config.enableTime === !0) {
var i = Se(e.config), o = i.hours, l = i.minutes, u = i.seconds;
P(o, l, u);
}
e.redraw(), n && w("onChange");
}
function an() {
e.isOpen = !1, e.isMobile || (e.calendarContainer !== void 0 && e.calendarContainer.classList.remove("open"), e._input !== void 0 && e._input.classList.remove("active")), w("onClose");
}
function rn() {
e.config !== void 0 && w("onDestroy");
for (var n = e._handlers.length; n--; )
e._handlers[n].remove();
if (e._handlers = [], e.mobileInput)
e.mobileInput.parentNode && e.mobileInput.parentNode.removeChild(e.mobileInput), e.mobileInput = void 0;
else if (e.calendarContainer && e.calendarContainer.parentNode)
if (e.config.static && e.calendarContainer.parentNode) {
var t = e.calendarContainer.parentNode;
if (t.lastChild && t.removeChild(t.lastChild), t.parentNode) {
for (; t.firstChild; )
t.parentNode.insertBefore(t.firstChild, t);
t.parentNode.removeChild(t);
}
} else
e.calendarContainer.parentNode.removeChild(e.calendarContainer);
e.altInput && (e.input.type = "text", e.altInput.parentNode && e.altInput.parentNode.removeChild(e.altInput), delete e.altInput), e.input && (e.input.type = e.input._type, e.input.classList.remove("flatpickr-input"), e.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(i) {
try {
delete e[i];
} catch {
}
});
}
function X(n) {
return e.calendarContainer.contains(n);
}
function Ce(n) {
if (e.isOpen && !e.config.inline) {
var t = _(n), i = X(t), o = e._input.value.trimEnd() !== ce(), l = t === e.input || t === e.altInput || e.element.contains(t) || n.path && n.path.indexOf && (~n.path.indexOf(e.input) || ~n.path.indexOf(e.altInput)), u = !l && !i && !X(n.relatedTarget), p = !e.config.ignoredFocusElements.some(function(s) {
return s.contains(t);
});
u && p && (e.config.allowInput && e.setDate(e._input.value, o, e.config.altInput ? e.config.altFormat : e.config.dateFormat), e.timeContainer !== void 0 && e.minuteElement !== void 0 && e.hourElement !== void 0 && e.input.value !== "" && e.input.value !== void 0 && x(), e.close(), e.config && e.config.mode === "range" && e.selectedDates.length === 1 && e.clear(!1));
}
}
function re(n) {
if (!(!n || e.config.minDate && n < e.config.minDate.getFullYear() || e.config.maxDate && n > e.config.maxDate.getFullYear())) {
var t = n, i = e.currentYear !== t;
e.currentYear = t || e.currentYear, e.config.maxDate && e.currentYear === e.config.maxDate.getFullYear() ? e.currentMonth = Math.min(e.config.maxDate.getMonth(), e.currentMonth) : e.config.minDate && e.currentYear === e.config.minDate.getFullYear() && (e.currentMonth = Math.max(e.config.minDate.getMonth(), e.currentMonth)), i && (e.redraw(), w("onYearChange"), J());
}
}
function B(n, t) {
var i;
t === void 0 && (t = !0);
var o = e.parseDate(n, void 0, t);
if (e.config.minDate && o && F(o, e.config.minDate, t !== void 0 ? t : !e.minDateHasTime) < 0 || e.config.maxDate && o && F(o, e.config.maxDate, t !== void 0 ? t : !e.maxDateHasTime) > 0)
return !1;
if (!e.config.enable && e.config.disable.length === 0)
return !0;
if (o === void 0)
return !1;
for (var l = !!e.config.enable, u = (i = e.config.enable) !== null && i !== void 0 ? i : e.config.disable, p = 0, s = void 0; p < u.length; p++) {
if (s = u[p], typeof s == "function" && s(o))
return l;
if (s instanceof Date && o !== void 0 && s.getTime() === o.getTime())
return l;
if (typeof s == "string") {
var h = e.parseDate(s, void 0, !0);
return h && h.getTime() === o.getTime() ? l : !l;
} else if (typeof s == "object" && o !== void 0 && s.from && s.to && o.getTime() >= s.from.getTime() && o.getTime() <= s.to.getTime())
return l;
}
return !l;
}
function oe(n) {
return e.daysContainer !== void 0 ? n.className.indexOf("hidden") === -1 && n.className.indexOf("flatpickr-disabled") === -1 && e.daysContainer.contains(n) : !1;
}
function on(n) {
var t = n.target === e._input, i = e._input.value.trimEnd() !== ce();
t && i && !(n.relatedTarget && X(n.relatedTarget)) && e.setDate(e._input.value, !0, n.target === e.altInput ? e.config.altFormat : e.config.dateFormat);
}
function Ne(n) {
var t = _(n), i = e.config.wrap ? a.contains(t) : t === e._input, o = e.config.allowInput, l = e.isOpen && (!o || !i), u = e.config.inline && i && !o;
if (n.keyCode === 13 && i) {
if (o)
return e.setDate(e._input.value, !0, t === e.altInput ? e.config.altFormat : e.config.dateFormat), e.close(), t.blur();
e.open();
} else if (X(t) || l || u) {
var p = !!e.timeContainer && e.timeContainer.contains(t);
switch (n.keyCode) {
case 13:
p ? (n.preventDefault(), x(), we()) : Re(n);
break;
case 27:
n.preventDefault(), we();
break;
case 8:
case 46:
i && !e.config.allowInput && (n.preventDefault(), e.clear());
break;
case 37:
case 39:
if (!p && !i) {
n.preventDefault();
var s = m();
if (e.daysContainer !== void 0 && (o === !1 || s && oe(s))) {
var h = n.keyCode === 39 ? 1 : -1;
n.ctrlKey ? (n.stopPropagation(), be(h), Q(U(1), 0)) : Q(void 0, h);
}
} else
e.hourElement && e.hourElement.focus();
break;
case 38:
case 40:
n.preventDefault();
var f = n.keyCode === 40 ? 1 : -1;
e.daysContainer && t.$i !== void 0 || t === e.input || t === e.altInput ? n.ctrlKey ? (n.stopPropagation(), re(e.currentYear - f), Q(U(1), 0)) : p || Q(void 0, f * 7) : t === e.currentYearElement ? re(e.currentYear - f) : e.config.enableTime && (!p && e.hourElement && e.hourElement.focus(), x(n), e._debouncedChange());
break;
case 9:
if (p) {
var g = [
e.hourElement,
e.minuteElement,
e.secondElement,
e.amPM
].concat(e.pluginElements).filter(function(S) {
return S;
}), C = g.indexOf(t);
if (C !== -1) {
var N = g[C + (n.shiftKey ? -1 : 1)];
n.preventDefault(), (N || e._input).focus();
}
} else
!e.config.noCalendar && e.daysContainer && e.daysContainer.contains(t) && n.shiftKey && (n.preventDefault(), e._input.focus());
break;
}
}
if (e.amPM !== void 0 && t === e.amPM)
switch (n.key) {
case e.l10n.amPM[0].charAt(0):
case e.l10n.amPM[0].charAt(0).toLowerCase():
e.amPM.textContent = e.l10n.amPM[0], O(), H();
break;
case e.l10n.amPM[1].charAt(0):
case e.l10n.amPM[1].charAt(0).toLowerCase():
e.amPM.textContent = e.l10n.amPM[1], O(), H();
break;
}
(i || X(t)) && w("onKeyDown", n);
}
function le(n, t) {
if (t === void 0 && (t = "flatpickr-day"), !(e.selectedDates.length !== 1 || n && (!n.classList.contains(t) || n.classList.contains("flatpickr-disabled")))) {
for (var i = n ? n.dateObj.getTime() : e.days.firstElementChild.dateObj.getTime(), o = e.parseDate(e.selectedDates[0], void 0, !0).getTime(), l = Math.min(i, e.selectedDates[0].getTime()), u = Math.max(i, e.selectedDates[0].getTime()), p = !1, s = 0, h = 0, f = l; f < u; f += Nn.DAY)
B(new Date(f), !0) || (p = p || f > l && f < u, f < o && (!s || f > s) ? s = f : f > o && (!h || f < h) && (h = f));
var g = Array.from(e.rContainer.querySelectorAll("*:nth-child(-n+" + e.config.showMonths + ") > ." + t));
g.forEach(function(C) {
var N = C.dateObj, S = N.getTime(), ee = s > 0 && S < s || h > 0 && S > h;
if (ee) {
C.classList.add("notAllowed"), ["inRange", "startRange", "endRange"].forEach(function(q) {
C.classList.remove(q);
});
return;
} else if (p && !ee)
return;
["startRange", "inRange", "endRange", "notAllowed"].forEach(function(q) {
C.classList.remove(q);
}), n !== void 0 && (n.classList.add(i <= e.selectedDates[0].getTime() ? "startRange" : "endRange"), o < i && S === o ? C.classList.add("startRange") : o > i && S === o && C.classList.add("endRange"), S >= s && (h === 0 || S <= h) && On(S, o, i) && C.classList.add("inRange"));
});
}
}
function ln() {
e.isOpen && !e.config.static && !e.config.inline && ue();
}
function un(n, t) {
if (t === void 0 && (t = e._positionElement), e.isMobile === !0) {
if (n) {
n.preventDefault();
var i = _(n);
i && i.blur();
}
e.mobileInput !== void 0 && (e.mobileInput.focus(), e.mobileInput.click()), w("onOpen");
return;
} else if (e._input.disabled || e.config.inline)
return;
var o = e.isOpen;
e.isOpen = !0, o || (e.calendarContainer.classList.add("open"), e._input.classList.add("active"), w("onOpen"), ue(t)), e.config.enableTime === !0 && e.config.noCalendar === !0 && e.config.allowInput === !1 && (n === void 0 || !e.timeContainer.contains(n.relatedTarget)) && setTimeout(function() {
return e.hourElement.select();
}, 50);
}
function Pe(n) {
return function(t) {
var i = e.config["_" + n + "Date"] = e.parseDate(t, e.config.dateFormat), o = e.config["_" + (n === "min" ? "max" : "min") + "Date"];
i !== void 0 && (e[n === "min" ? "minDateHasTime" : "maxDateHasTime"] = i.getHours() > 0 || i.getMinutes() > 0 || i.getSeconds() > 0), e.selectedDates && (e.selectedDates = e.selectedDates.filter(function(l) {
return B(l);
}), !e.selectedDates.length && n === "min" && Y(i), H()), e.daysContainer && (je(), i !== void 0 ? e.currentYearElement[n] = i.getFullYear().toString() : e.currentYearElement.removeAttribute(n), e.currentYearElement.disabled = !!o && i !== void 0 && o.getFullYear() === i.getFullYear());
};
}
function sn() {
var n = [
"wrap",
"weekNumbers",
"allowInput",
"allowInvalidPreload",
"clickOpens",
"time_24hr",
"enableTime",
"noCalendar",
"altInput",
"shorthandCurrentMonth",
"inline",
"static",
"enableSeconds",
"disableMobile"
], t = k(k({}, JSON.parse(JSON.stringify(a.dataset || {}))), r), i = {};
e.config.parseDate = t.parseDate, e.config.formatDate = t.formatDate, Object.defineProperty(e.config, "enable", {
get: function() {
return e.config._enable;
},
set: function(g) {
e.config._enable = Be(g);
}
}), Object.defineProperty(e.config, "disable", {
get: function() {
return e.config._disable;
},
set: function(g) {
e.config._disable = Be(g);
}
});
var o = t.mode === "time";
if (!t.dateFormat && (t.enableTime || o)) {
var l = y.defaultConfig.dateFormat || z.dateFormat;
i.dateFormat = t.noCalendar || o ? "H:i" + (t.enableSeconds ? ":S" : "") : l + " H:i" + (t.enableSeconds ? ":S" : "");
}
if (t.altInput && (t.enableTime || o) && !t.altFormat) {
var u = y.defaultConfig.altFormat || z.altFormat;
i.altFormat = t.noCalendar || o ? "h:i" + (t.enableSeconds ? ":S K" : " K") : u + (" h:i" + (t.enableSeconds ? ":S" : "") + " K");
}
Object.defineProperty(e.config, "minDate", {
get: function() {
return e.config._minDate;
},
set: Pe("min")
}), Object.defineProperty(e.config, "maxDate", {
get: function() {
return e.config._maxDate;
},
set: Pe("max")
});
var p = function(g) {
return function(C) {
e.config[g === "min" ? "_minTime" : "_maxTime"] = e.parseDate(C, "H:i:S");
};
};
Object.defineProperty(e.config, "minTime", {
get: function() {
return e.config._minTime;
},
set: p("min")
}), Object.defineProperty(e.config, "maxTime", {
get: function() {
return e.config._maxTime;
},
set: p("max")
}), t.mode === "time" && (e.config.noCalendar = !0, e.config.enableTime = !0), Object.assign(e.config, i, t);
for (var s = 0; s < n.length; s++)
e.config[n[s]] = e.config[n[s]] === !0 || e.config[n[s]] === "true";
xe.filter(function(g) {
return e.config[g] !== void 0;
}).forEach(function(g) {
e.config[g] = ke(e.config[g] || []).map(b);
}), e.isMobile = !e.config.disableMobile && !e.config.inline && e.config.mode === "single" && !e.config.disable.length && !e.config.enable && !e.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
for (var s = 0; s < e.config.plugins.length; s++) {
var h = e.config.plugins[s](e) || {};
for (var f in h)
xe.indexOf(f) > -1 ? e.config[f] = ke(h[f]).map(b).concat(e.config[f]) : typeof t[f] > "u" && (e.config[f] = h[f]);
}
t.altInputClass || (e.config.altInputClass = He().className + " " + e.config.altInputClass), w("onParseConfig");
}
function He() {
return e.config.wrap ? a.querySelector("[data-input]") : a;
}
function Le() {
typeof e.config.locale != "object" && typeof y.l10ns[e.config.locale] > "u" && e.config.errorHandler(new Error("flatpickr: invalid locale " + e.config.locale)), e.l10n = k(k({}, y.l10ns.default), typeof e.config.locale == "object" ? e.config.locale : e.config.locale !== "default" ? y.l10ns[e.config.locale] : void 0), V.D = "(" + e.l10n.weekdays.shorthand.join("|") + ")", V.l = "(" + e.l10n.weekdays.longhand.join("|") + ")", V.M = "(" + e.l10n.months.shorthand.join("|") + ")", V.F = "(" + e.l10n.months.longhand.join("|") + ")", V.K = "(" + e.l10n.amPM[0] + "|" + e.l10n.amPM[1] + "|" + e.l10n.amPM[0].toLowerCase() + "|" + e.l10n.amPM[1].toLowerCase() + ")";
var n = k(k({}, r), JSON.parse(JSON.stringify(a.dataset || {})));
n.time_24hr === void 0 && y.defaultConfig.time_24hr === void 0 && (e.config.time_24hr = e.l10n.time_24hr), e.formatDate = ze(e), e.parseDate = Fe({ config: e.config, l10n: e.l10n });
}
function ue(n) {
if (typeof e.config.position == "function")
return void e.config.position(e, n);
if (e.calendarContainer !== void 0) {
w("onPreCalendarPosition");
var t = n || e._positionElement, i = Array.prototype.reduce.call(e.calendarContainer.children, function(Tn, Sn) {
return Tn + Sn.offsetHeight;
}, 0), o = e.calendarContainer.offsetWidth, l = e.config.position.split(" "), u = l[0], p = l.length > 1 ? l[1] : null, s = t.getBoundingClientRect(), h = window.innerHeight - s.bottom, f = u === "above" || u !== "below" && h < i && s.top > i, g = window.pageYOffset + s.top + (f ? -i - 2 : t.offsetHeight + 2);
if (I(e.calendarContainer, "arrowTop", !f), I(e.calendarContainer, "arrowBottom", f), !e.config.inline) {
var C = window.pageXOffset + s.left, N = !1, S = !1;
p === "center" ? (C -= (o - s.width) / 2, N = !0) : p === "right" && (C -= o - s.width, S = !0), I(e.calendarContainer, "arrowLeft", !N && !S), I(e.calendarContainer, "arrowCenter", N), I(e.calendarContainer, "arrowRight", S);
var ee = window.document.body.offsetWidth - (window.pageXOffset + s.right), q = C + o > window.document.body.offsetWidth, wn = ee + o > window.document.body.offsetWidth;
if (I(e.calendarContainer, "rightMost", q), !e.config.static)
if (e.calendarContainer.style.top = g + "px", !q)
e.calendarContainer.style.left = C + "px", e.calendarContainer.style.right = "auto";
else if (!wn)
e.calendarContainer.style.left = "auto", e.calendarContainer.style.right = ee + "px";
else {
var Ee = fn();
if (Ee === void 0)
return;
var Mn = window.document.body.offsetWidth, yn = Math.max(0, Mn / 2 - o / 2), En = ".flatpickr-calendar.centerMost:before", xn = ".flatpickr-calendar.centerMost:after", kn = Ee.cssRules.length, In = "{left:" + s.left + "px;right:auto;}";
I(e.calendarContainer, "rightMost", !1), I(e.calendarContainer, "centerMost", !0), Ee.insertRule(En + "," + xn + In, kn), e.calendarContainer.style.left = yn + "px", e.calendarContainer.style.right = "auto";
}
}
}
}
function fn() {
for (var n = null, t = 0; t < document.styleSheets.length; t++) {
var i = document.styleSheets[t];
if (i.cssRules) {
try {
i.cssRules;
} catch {
continue;
}
n = i;
break;
}
}
return n ?? cn();
}
function cn() {
var n = document.createElement("style");
return document.head.appendChild(n), n.sheet;
}
function je() {
e.config.noCalendar || e.isMobile || (J(), fe(), ie());
}
function we() {
e._input.focus(), window.navigator.userAgent.indexOf("MSIE") !== -1 || navigator.msMaxTouchPoints !== void 0 ? setTimeout(e.close, 0) : e.close();
}
function Re(n) {
n.preventDefault(), n.stopPropagation();
var t = function(g) {
return g.classList && g.classList.contains("flatpickr-day") && !g.classList.contains("flatpickr-disabled") && !g.classList.contains("notAllowed");
}, i = qe(_(n), t);
if (i !== void 0) {
var o = i, l = e.latestSelectedDateObj = new Date(o.dateObj.getTime()), u = (l.getMonth() < e.currentMonth || l.getMonth() > e.currentMonth + e.config.showMonths - 1) && e.config.mode !== "range";
if (e.selectedDateElem = o, e.config.mode === "single")
e.selectedDates = [l];
else if (e.config.mode === "multiple") {
var p = ye(l);
p ? e.selectedDates.splice(parseInt(p), 1) : e.selectedDates.push(l);
} else
e.config.mode === "range" && (e.selectedDates.length === 2 && e.clear(!1, !1), e.latestSelectedDateObj = l, e.selectedDates.push(l), F(l, e.selectedDates[0], !0) !== 0 && e.selectedDates.sort(function(g, C) {
return g.getTime() - C.getTime();
}));
if (O(), u) {
var s = e.currentYear !== l.getFullYear();
e.currentYear = l.getFullYear(), e.currentMonth = l.getMonth(), s && (w("onYearChange"), J()), w("onMonthChange");
}
if (fe(), ie(), H(), !u && e.config.mode !== "range" && e.config.showMonths === 1 ? K(o) : e.selectedDateElem !== void 0 && e.hourElement === void 0 && e.selectedDateElem && e.selectedDateElem.focus(), e.hourElement !== void 0 && e.hourElement !== void 0 && e.hourElement.focus(), e.config.closeOnSelect) {
var h = e.config.mode === "single" && !e.config.enableTime, f = e.config.mode === "range" && e.selectedDates.length === 2 && !e.config.enableTime;
(h || f) && we();
}
j();
}
}
var se = {
locale: [Le, Ye],
showMonths: [Ae, M, Oe],
minDate: [L],
maxDate: [L],
positionElement: [Ve],
clickOpens: [
function() {
e.config.clickOpens === !0 ? (D(e._input, "focus", e.open), D(e._input, "click", e.open)) : (e._input.removeEventListener("focus", e.open), e._input.removeEventListener("click", e.open));
}
]
};
function dn(n, t) {
if (n !== null && typeof n == "object") {
Object.assign(e.config, n);
for (var i in n)
se[i] !== void 0 && se[i].forEach(function(o) {
return o();
});
} else
e.config[n] = t, se[n] !== void 0 ? se[n].forEach(function(o) {
return o();
}) : xe.indexOf(n) > -1 && (e.config[n] = ke(t));
e.redraw(), H(!0);
}
function We(n, t) {
var i = [];
if (n instanceof Array)
i = n.map(function(o) {
return e.parseDate(o, t);
});
else if (n instanceof Date || typeof n == "number")
i = [e.parseDate(n, t)];
else if (typeof n == "string")
switch (e.config.mode) {
case "single":
case "time":
i = [e.parseDate(n, t)];
break;
case "multiple":
i = n.split(e.config.conjunction).map(function(o) {
return e.parseDate(o, t);
});
break;
case "range":
i = n.split(e.l10n.rangeSeparator).map(function(o) {
return e.parseDate(o, t);
});
break;
}
else
e.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(n)));
e.selectedDates = e.config.allowInvalidPreload ? i : i.filter(function(o) {
return o instanceof Date && B(o, !1);
}), e.config.mode === "range" && e.selectedDates.sort(function(o, l) {
return o.getTime() - l.getTime();
});
}
function gn(n, t, i) {
if (t === void 0 && (t = !1), i === void 0 && (i = e.config.dateFormat), n !== 0 && !n || n instanceof Array && n.length === 0)
return e.clear(t);
We(n, i), e.latestSelectedDateObj = e.selectedDates[e.selectedDates.length - 1], e.redraw(), L(void 0, t), Y(), e.selectedDates.length === 0 && e.clear(!1), H(t), t && w("onChange");
}
function Be(n) {
return n.slice().map(function(t) {
return typeof t == "string" || typeof t == "number" || t instanceof Date ? e.parseDate(t, void 0, !0) : t && typeof t == "object" && t.from && t.to ? {
from: e.parseDate(t.from, void 0),
to: e.parseDate(t.to, void 0)
} : t;
}).filter(function(t) {
return t;
});
}
function mn() {
e.selectedDates = [], e.now = e.parseDate(e.config.now) || /* @__PURE__ */ new Date();
var n = e.config.defaultDate || ((e.input.nodeName === "INPUT" || e.input.nodeName === "TEXTAREA") && e.input.placeholder && e.input.value === e.input.placeholder ? null : e.input.value);
n && We(n, e.config.dateFormat), e._initialDate = e.selectedDates.length > 0 ? e.selectedDates[0] : e.config.minDate && e.config.minDate.getTime() > e.now.getTime() ? e.config.minDate : e.config.maxDate && e.config.maxDate.getTime() < e.now.getTime() ? e.config.maxDate : e.now, e.currentYear = e._initialDate.getFullYear(), e.currentMonth = e._initialDate.getMonth(), e.selectedDates.length > 0 && (e.latestSelectedDateObj = e.selectedDates[0]), e.config.minTime !== void 0 && (e.config.minTime = e.parseDate(e.config.minTime, "H:i")), e.config.maxTime !== void 0 && (e.config.maxTime = e.parseDate(e.config.maxTime, "H:i")), e.minDateHasTime = !!e.config.minDate && (e.config.minDate.getHours() > 0 || e.config.minDate.getMinutes() > 0 || e.config.minDate.getSeconds() > 0), e.maxDateHasTime = !!e.config.maxDate && (e.config.maxDate.getHours() > 0 || e.config.maxDate.getMinutes() > 0 || e.config.maxDate.getSeconds() > 0);
}
function pn() {
if (e.input = He(), !e.input) {
e.config.errorHandler(new Error("Invalid input element specified"));
return;
}
e.input._type = e.input.type, e.input.type = "text", e.input.classList.add("flatpickr-input"), e._input = e.input, e.config.altInput && (e.altInput = v(e.input.nodeName, e.config.altInputClass), e._input = e.altInput, e.altInput.placeholder = e.input.placeholder, e.altInput.disabled = e.input.disabled, e.altInput.required = e.input.required, e.altInput.tabIndex = e.input.tabIndex, e.altInput.type = "text", e.input.setAttribute("type", "hidden"), !e.config.static && e.input.parentNode && e.input.parentNode.insertBefore(e.altInput, e.input.nextSibling)), e.config.allowInput || e._input.setAttribute("readonly", "readonly"), Ve();
}
function Ve() {
e._positionElement = e.config.positionElement || e._input;
}
function hn() {
var n = e.config.enableTime ? e.config.noCalendar ? "time" : "datetime-local" : "date";
e.mobileInput = v("input", e.input.className + " flatpickr-mobile"), e.mobileInput.tabIndex = 1, e.mobileInput.type = n, e.mobileInput.disabled = e.input.disabled, e.mobileInput.required = e.input.required, e.mobileInput.placeholder = e.input.placeholder, e.mobileFormatStr = n === "datetime-local" ? "Y-m-d\\TH:i:S" : n === "date" ? "Y-m-d" : "H:i:S", e.selectedDates.length > 0 && (e.mobileInput.defaultValue = e.mobileInput.value = e.formatDate(e.selectedDates[0], e.mobileFormatStr)), e.config.minDate && (e.mobileInput.min = e.formatDate(e.config.minDate, "Y-m-d")), e.config.maxDate && (e.mobileInput.max = e.formatDate(e.config.maxDate, "Y-m-d")), e.input.getAttribute("step") && (e.mobileInput.step = String(e.input.getAttribute("step"))), e.input.type = "hidden", e.altInput !== void 0 && (e.altInput.type = "hidden");
try {
e.input.parentNode && e.input.parentNode.insertBefore(e.mobileInput, e.input.nextSibling);
} catch {
}
D(e.mobileInput, "change", function(t) {
e.setDate(_(t).value, !1, e.mobileFormatStr), w("onChange"), w("onClose");
});
}
function vn(n) {
if (e.isOpen === !0)
return e.close();
e.open(n);
}
function w(n, t) {
if (e.config !== void 0) {
var i = e.config[n];
if (i !== void 0 && i.length > 0)
for (var o = 0; i[o] && o < i.length; o++)
i[o](e.selectedDates, e.input.value, e, t);
n === "onChange" && (e.input.dispatchEvent(Me("change")), e.input.dispatchEvent(Me("input")));
}
}
function Me(n) {
var t = document.createEvent("Event");
return t.initEvent(n, !0, !0), t;
}
function ye(n) {
for (var t = 0; t < e.selectedDates.length; t++) {
var i = e.selectedDates[t];
if (i instanceof Date && F(i, n) === 0)
return "" + t;
}
return !1;
}
function Dn(n) {
return e.config.mode !== "range" || e.selectedDates.length < 2 ? !1 : F(n, e.selectedDates[0]) >= 0 && F(n, e.selectedDates[1]) <= 0;
}
function fe() {
e.config.noCalendar || e.isMobile || !e.monthNav || (e.yearElements.forEach(function(n, t) {
var i = new Date(e.currentYear, e.currentMonth, 1);
if (i.setMonth(e.currentMonth + t), e.config.showMonths > 1 || e.config.monthSelectorType === "static" ? e.monthElements[t].textContent = pe(i.getMonth(), e.config.shorthandCurrentMonth, e.l10n) + " " : e.monthsDropdownContainer.value = i.getMonth().toString(), e.config.useLocaleYear) {
var o = e.l10n.localeYearAdjustment || 0;
n.value = (i.getFullYear() + o).toString();
} else
n.value = i.getFullYear().toString();
}), e._hidePrevMonthArrow = e.config.minDate !== void 0 && (e.currentYear === e.config.minDate.getFullYear() ? e.currentMonth <= e.config.minDate.getMonth() : e.currentYear < e.config.minDate.getFullYear()), e._hideNextMonthArrow = e.config.maxDate !== void 0 && (e.currentYear === e.config.maxDate.getFullYear() ? e.currentMonth + 1 > e.config.maxDate.getMonth() : e.currentYear > e.config.maxDate.getFullYear()));
}
function ce(n) {
var t = n || (e.config.altInput ? e.config.altFormat : e.config.dateFormat);
return e.selectedDates.map(function(i) {
return e.formatDate(i, t);
}).filter(function(i, o, l) {
return e.config.mode !== "range" || e.config.enableTime || l.indexOf(i) === o;
}).join(e.config.mode !== "range" ? e.config.conjunction : e.l10n.rangeSeparator);
}
function H(n) {
n === void 0 && (n = !0), e.mobileInput !== void 0 && e.mobileFormatStr && (e.mobileInput.value = e.latestSelectedDateObj !== void 0 ? e.formatDate(e.latestSelectedDateObj, e.mobileFormatStr) : ""), e.input.value = ce(e.config.dateFormat), e.altInput !== void 0 && (e.altInput.value = ce(e.config.altFormat)), n !== !1 && w("onValueUpdate");
}
function bn(n) {
var t = _(n), i = e.prevMonthNav.contains(t), o = e.nextMonthNav.contains(t);
i || o ? be(i ? -1 : 1) : e.yearElements.indexOf(t) >= 0 ? t.select() : t.classList.contains("arrowUp") ? e.changeYear(e.currentYear + 1) : t.classList.contains("arrowDown") && e.changeYear(e.currentYear - 1);
}
function Cn(n) {
n.preventDefault();
var t = n.type === "keydown", i = _(n), o = i;
e.amPM !== void 0 && i === e.amPM && (e.amPM.textContent = e.l10n.amPM[A(e.amPM.textContent === e.l10n.amPM[0])]);
var l = parseFloat(o.getAttribute("min")), u = parseFloat(o.getAttribute("max")), p = parseFloat(o.getAttribute("step")), s = parseInt(o.value, 10), h = n.delta || (t ? n.which === 38 ? 1 : -1 : 0), f = s + p * h;
if (typeof o.value < "u" && o.value.length === 2) {
var g = o === e.hourElement, C = o === e.minuteElement;
f < l ? (f = u + f + A(!g) + (A(g) && A(!e.amPM)), C && $(void 0, -1, e.hourElement)) : f > u && (f = o === e.hourElement ? f - u - A(!e.amPM) : l, C && $(void 0, 1, e.hourElement)), e.amPM && g && (p === 1 ? f + s === 23 : Math.abs(f - s) > p) && (e.amPM.textContent = e.l10n.amPM[A(e.amPM.textContent === e.l10n.amPM[0])]), o.value = T(f);
}
}
return d(), e;
}
function G(a, r) {
for (var e = Array.prototype.slice.call(a).filter(function(b) {
return b instanceof HTMLElement;
}), c = [], d = 0; d < e.length; d++) {
var m = e[d];
try {
if (m.getAttribute("data-fp-omit") !== null)
continue;
m._flatpickr !== void 0 && (m._flatpickr.destroy(), m._flatpickr = void 0), m._flatpickr = Hn(m, r || {}), c.push(m._flatpickr);
} catch (b) {
console.error(b);
}
}
return c.length === 1 ? c[0] : c;
}
typeof HTMLElement < "u" && typeof HTMLCollection < "u" && typeof NodeList < "u" && (HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function(a) {
return G(this, a);
}, HTMLElement.prototype.flatpickr = function(a) {
return G([this], a);
});
var y = function(a, r) {
return typeof a == "string" ? G(window.document.querySelectorAll(a), r) : a instanceof Node ? G([a], r) : G(a, r);
};
y.defaultConfig = {};
y.l10ns = {
en: k({}, te),
default: k({}, te)
};
y.localize = function(a) {
y.l10ns.default = k(k({}, y.l10ns.default), a);
};
y.setDefaults = function(a) {
y.defaultConfig = k(k({}, y.defaultConfig), a);
};
y.parseDate = Fe({});
y.formatDate = ze({});
y.compareDates = F;
typeof jQuery < "u" && typeof jQuery.fn < "u" && (jQuery.fn.flatpickr = function(a) {
return G(this, a);
});
Date.prototype.fp_incr = function(a) {
return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof a == "string" ? parseInt(a, 10) : a));
};
typeof window < "u" && (window.flatpickr = y);
const Ge = [
"onChange",
"onClose",
"onDestroy",
"onMonthChange",
"onOpen",
"onYearChange"
], Ln = [
"onValueUpdate",
"onDayCreate",
"onParseConfig",
"onReady",
"onPreCalendarPosition",
"onKeyDown"
], Ue = {
onChange: "change",
onClose: "close",
onDestroy: "destroy",
onMonthChange: "monthChange",
onOpen: "open",
onYearChange: "yearChange",
onValueUpdate: "valueUpdate",
onDayCreate: "dayCreate",
onParseConfig: "parseConfig",
onReady: "ready",
onPreCalendarPosition: "preCalendarPosition",
onKeyDown: "keyDown"
};
function _e(a) {
return a instanceof Array ? a : [a];
}
function Je(a) {
return a && a.length ? a : null;
}
const jn = [...Ge, ...Ln], Rn = ["locale", "showMonths"], Bn = _n({
name: "Flatpickr",
render() {
var a, r, e, c, d, m, b, M;
return this.options.wrap || this.wrap ? this.$slots.default && ((r = (a = this.$slots).default) == null ? void 0 : r.call(a).length) == 1 ? (c = (e = this.$slots).default) == null ? void 0 : c.call(e)[0] : !this.$slots.default || ((m = (d = this.$slots).default) == null ? void 0 : m.call(d).length) == 0 ? de("div", {}, de("input", {
type: "text",
"data-input": !0,
disabled: this.disabled,
onInput: this.onInput
})) : de("div", {}, (M = (b = this.$slots).default) == null ? void 0 : M.call(b)) : de("input", {
type: "text",
"data-input": !0,
disabled: this.disabled,
onInput: this.onInput
});
},
emits: [
"blur",
"update:modelValue",
...Object.values(Ue)
],
props: {
options: {
type: Object,
default: () => ({
defaultDate: null,
wrap: !1
})
},
modelValue: {
type: [String, Number, Date, Array, null],
required: !0
},
disabled: {
type: Boolean,
default: !1
},
wrap: {
type: Boolean,
default: !1
},
mode: {
type: String,
default: "single"
},
events: {
type: Array,
default: () => Ge
},
changeDateOnly: {
type: Boolean,
default: !1
}
},
data() {
return {
fp: null
//todo make it non-reactive
};
},
methods: {
prepareConfig() {
let a = { ...this.options };
this.events.forEach((c) => {
let d = y.defaultConfig[c] || [], m = (...b) => {
this.$emit(Ue[c], ...b);
};
a[c] = _e(a[c] || []).concat(
d,
m
);
});
const r = this.onClose.bind(this), e = this.onChange.bind(this);
return a.onClose = _e(a.onClose || []).concat(r), a.onChange = _e(a.onChange || []).concat(e), a.defaultDate = this.modelValue || a.defaultDate, this.wrap && (a.wrap = this.wrap), a.mode = this.mode, a;
},
/**
* Get the HTML node where flatpickr to be attached
* Bind on parent element if wrap is true
*/
getElem() {
return this.$el;
},
/**
* Watch for value changed by date-picker itself and notify parent component
*/
onInput(a) {
Fn().then(() => {
});
},
onChange(a, r, e) {
if (this.mode == "single")
if (this.changeDateOnly && a[0]) {
const c = a[0], d = this.modelValue instanceof Date ? this.modelValue : null;
d ? this.$emit("update:modelValue", new Date(c.getFullYear(), c.getMonth(), c.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds())) : this.$emit("update:modelValue", a[0] || null);
} else
this.$emit("update:modelValue", a[0] || null);
else if (this.mode == "time") {
const c = this.modelValue instanceof Date ? this.modelValue : /* @__PURE__ */ new Date(), d = a[0] || null;
d ? this.$emit("update:modelValue", new Date(c.getFullYear(), c.getMonth(), c.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds())) : this.$emit("update:modelValue", null);
} else
this.$emit("update:modelValue", a);
},
fpInput() {
return this.fp.altInput || this.fp.input;
},
/**
* Blur event is required by many validation libraries
*/
onBlur(a) {
this.$emit("blur", Je(a.target.value));
},
/**
* Flatpickr does not emit input event in some cases
*/
onClose(a, r) {
},
/**
* Watch for the disabled property and sets the value to the real input.
*/
watchDisabled(a) {
a ? this.fpInput().setAttribute("disabled", "") : this.fpInput().removeAttribute("disabled");
}
},
watch: {
/**
* Watch for any config changes and redraw date-picker
*/
options: {
deep: !0,
handler(a) {
if (!this.fp)
return;
let r = { ...a };
jn.forEach((e) => {
delete r[e];
}), this.fp.set(r), Rn.forEach((e) => {
typeof r[e] < "u" && this.fp.set(e, r[e]);
});
}
},
/**
* Watch for changes from parent component and update DOM
*/
modelValue(a) {
var r;
!this.$el || a === Je(this.$el.value) || (r = this.fp) == null || r.setDate(a, !1);
}
},
beforeUnmount() {
this.fp && (this.fpInput().removeEventListener("blur", this.onBlur), this.fp.destroy(), this.fp = null);
},
mounted() {
this.fp || (this.fp = y(this.getElem(), this.prepareConfig()), this.fpInput().addEventListener("blur", this.onBlur), this.$watch("disabled", this.watchDisabled, {
immediate: !0
}));
}
});
export {
Bn as Flatpickr,
y as fp
};