@devheniik/datepicker
Version:
Datepicker component for Vue 3
1,312 lines • 153 kB
JavaScript
import { openBlock as p, createElementBlock as C, createElementVNode as re, reactive as Tt, computed as F, unref as u, ref as W, watch as tt, toRef as Mt, onMounted as He, nextTick as dt, defineComponent as We, renderSlot as x, createCommentVNode as $, normalizeClass as ye, withKeys as de, createBlock as fe, withModifiers as Ze, normalizeStyle as Qe, normalizeProps as Pe, mergeProps as Te, Fragment as ce, createTextVNode as Ke, toDisplayString as Ce, renderList as De, createVNode as et, Transition as gt, withCtx as ie, onBeforeUpdate as Jn, onUnmounted as dn, withDirectives as _t, vShow as Nt, createSlots as Ye, isRef as ot, guardReactiveProps as Le, resolveDynamicComponent as Yn, useSlots as cn, getCurrentScope as Qn, onScopeDispose as ea, Teleport as ta } from "vue";
import { isBefore as fn, isEqual as Vn, isAfter as vn, set as Se, setHours as En, setMinutes as Fn, setSeconds as Ln, setMilliseconds as mn, parse as on, isValid as Rt, isDate as na, format as bt, getMonth as pe, getDay as aa, getYear as ke, getHours as je, getMinutes as Ge, getSeconds as yt, parseISO as ra, startOfWeek as pn, endOfWeek as la, setMonth as Ot, setYear as ut, addDays as mt, add as Un, addMonths as st, subMonths as Dt, getWeek as oa, getISOWeek as sa, differenceInCalendarDays as ia, eachDayOfInterval as kn, addYears as ua, subYears as da, sub as ca } from "date-fns";
function Lt() {
return p(), C(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
re("path", {
d: "M29.333 8c0-2.208-1.792-4-4-4h-18.667c-2.208 0-4 1.792-4 4v18.667c0 2.208 1.792 4 4 4h18.667c2.208 0 4-1.792 4-4v-18.667zM26.667 8v18.667c0 0.736-0.597 1.333-1.333 1.333 0 0-18.667 0-18.667 0-0.736 0-1.333-0.597-1.333-1.333 0 0 0-18.667 0-18.667 0-0.736 0.597-1.333 1.333-1.333 0 0 18.667 0 18.667 0 0.736 0 1.333 0.597 1.333 1.333z"
}),
re("path", {
d: "M20 2.667v5.333c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-5.333c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333z"
}),
re("path", {
d: "M9.333 2.667v5.333c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-5.333c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333z"
}),
re("path", {
d: "M4 14.667h24c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-24c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"
})
]
);
}
function fa() {
return p(), C(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
re("path", {
d: "M23.057 7.057l-16 16c-0.52 0.52-0.52 1.365 0 1.885s1.365 0.52 1.885 0l16-16c0.52-0.52 0.52-1.365 0-1.885s-1.365-0.52-1.885 0z"
}),
re("path", {
d: "M7.057 8.943l16 16c0.52 0.52 1.365 0.52 1.885 0s0.52-1.365 0-1.885l-16-16c-0.52-0.52-1.365-0.52-1.885 0s-0.52 1.365 0 1.885z"
})
]
);
}
function wn() {
return p(), C(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
re("path", {
d: "M20.943 23.057l-7.057-7.057c0 0 7.057-7.057 7.057-7.057 0.52-0.52 0.52-1.365 0-1.885s-1.365-0.52-1.885 0l-8 8c-0.521 0.521-0.521 1.365 0 1.885l8 8c0.52 0.52 1.365 0.52 1.885 0s0.52-1.365 0-1.885z"
})
]
);
}
function bn() {
return p(), C(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
re("path", {
d: "M12.943 24.943l8-8c0.521-0.521 0.521-1.365 0-1.885l-8-8c-0.52-0.52-1.365-0.52-1.885 0s-0.52 1.365 0 1.885l7.057 7.057c0 0-7.057 7.057-7.057 7.057-0.52 0.52-0.52 1.365 0 1.885s1.365 0.52 1.885 0z"
})
]
);
}
function Hn() {
return p(), C(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
re("path", {
d: "M16 1.333c-8.095 0-14.667 6.572-14.667 14.667s6.572 14.667 14.667 14.667c8.095 0 14.667-6.572 14.667-14.667s-6.572-14.667-14.667-14.667zM16 4c6.623 0 12 5.377 12 12s-5.377 12-12 12c-6.623 0-12-5.377-12-12s5.377-12 12-12z"
}),
re("path", {
d: "M14.667 8v8c0 0.505 0.285 0.967 0.737 1.193l5.333 2.667c0.658 0.329 1.46 0.062 1.789-0.596s0.062-1.46-0.596-1.789l-4.596-2.298c0 0 0-7.176 0-7.176 0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333z"
})
]
);
}
function Wn() {
return p(), C(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
re("path", {
d: "M24.943 19.057l-8-8c-0.521-0.521-1.365-0.521-1.885 0l-8 8c-0.52 0.52-0.52 1.365 0 1.885s1.365 0.52 1.885 0l7.057-7.057c0 0 7.057 7.057 7.057 7.057 0.52 0.52 1.365 0.52 1.885 0s0.52-1.365 0-1.885z"
})
]
);
}
function zn() {
return p(), C(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
re("path", {
d: "M7.057 12.943l8 8c0.521 0.521 1.365 0.521 1.885 0l8-8c0.52-0.52 0.52-1.365 0-1.885s-1.365-0.52-1.885 0l-7.057 7.057c0 0-7.057-7.057-7.057-7.057-0.52-0.52-1.365-0.52-1.885 0s-0.52 1.365 0 1.885z"
})
]
);
}
const Dn = (e, n, a, t) => {
const s = on(e, n.slice(0, e.length), /* @__PURE__ */ new Date());
return Rt(s) && na(s) ? t ? s : Se(s, {
hours: +a.hours,
minutes: +(a == null ? void 0 : a.minutes),
seconds: +(a == null ? void 0 : a.seconds),
milliseconds: 0
}) : null;
}, va = (e, n, a, t) => {
const s = Array.isArray(a) ? a[0] : a;
if (typeof n == "string")
return Dn(e, n, s, t);
if (Array.isArray(n)) {
let c = null;
for (const h of n)
if (c = Dn(e, h, s, t), c)
break;
return c;
}
return typeof n == "function" ? n(e) : null;
}, b = (e) => e ? new Date(e) : /* @__PURE__ */ new Date(), ma = (e, n) => {
if (n) {
const t = (e.getMonth() + 1).toString().padStart(2, "0"), s = e.getDate().toString().padStart(2, "0"), c = e.getHours().toString().padStart(2, "0"), h = e.getMinutes().toString().padStart(2, "0");
return `${e.getFullYear()}-${t}-${s}T${c}:${h}:00.000Z`;
}
const a = Date.UTC(
e.getUTCFullYear(),
e.getUTCMonth(),
e.getUTCDate(),
e.getUTCHours(),
e.getUTCMinutes(),
e.getUTCSeconds()
);
return new Date(a).toISOString();
}, Ue = (e) => {
let n = b(JSON.parse(JSON.stringify(e)));
return n = En(n, 0), n = Fn(n, 0), n = Ln(n, 0), n = mn(n, 0), n;
}, Ee = (e, n, a, t) => {
let s = e ? b(e) : b();
return (n || n === 0) && (s = En(s, +n)), (a || a === 0) && (s = Fn(s, +a)), (t || t === 0) && (s = Ln(s, +t)), mn(s, 0);
}, _e = (e, n) => !e || !n ? !1 : fn(Ue(e), Ue(n)), me = (e, n) => !e || !n ? !1 : Vn(Ue(e), Ue(n)), Be = (e, n) => !e || !n ? !1 : vn(Ue(e), Ue(n)), Kn = (e, n, a) => e && e[0] && e[1] ? Be(a, e[0]) && _e(a, e[1]) : e && e[0] && n ? Be(a, e[0]) && _e(a, n) || _e(a, e[0]) && Be(a, n) : !1, kt = (e) => {
const n = Se(new Date(e), { date: 1 });
return Ue(n);
}, wt = Tt({
menuFocused: !1,
shiftKeyInMenu: !1
}), xn = () => {
const e = (t) => {
wt.menuFocused = t;
}, n = (t) => {
wt.shiftKeyInMenu !== t && (wt.shiftKeyInMenu = t);
};
return {
control: F(() => ({ shiftKeyInMenu: wt.shiftKeyInMenu, menuFocused: wt.menuFocused })),
setMenuFocused: e,
setShiftKey: n
};
};
function yn(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Bt = {}, ya = {
get exports() {
return Bt;
},
set exports(e) {
Bt = e;
}
};
(function(e, n) {
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = a;
function a(t) {
if (t === null || t === !0 || t === !1)
return NaN;
var s = Number(t);
return isNaN(s) ? s : s < 0 ? Math.ceil(s) : Math.floor(s);
}
e.exports = n.default;
})(ya, Bt);
const ga = /* @__PURE__ */ yn(Bt);
var Yt = {}, ha = {
get exports() {
return Yt;
},
set exports(e) {
Yt = e;
}
};
(function(e, n) {
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = a;
function a(t) {
var s = new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds()));
return s.setUTCFullYear(t.getFullYear()), t.getTime() - s.getTime();
}
e.exports = n.default;
})(ha, Yt);
const $n = /* @__PURE__ */ yn(Yt);
function pa(e, n) {
var a = Da(n);
return a.formatToParts ? wa(a, e) : ba(a, e);
}
var ka = {
year: 0,
month: 1,
day: 2,
hour: 3,
minute: 4,
second: 5
};
function wa(e, n) {
try {
for (var a = e.formatToParts(n), t = [], s = 0; s < a.length; s++) {
var c = ka[a[s].type];
c >= 0 && (t[c] = parseInt(a[s].value, 10));
}
return t;
} catch (h) {
if (h instanceof RangeError)
return [NaN];
throw h;
}
}
function ba(e, n) {
var a = e.format(n).replace(/\u200E/g, ""), t = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(a);
return [t[3], t[1], t[2], t[4], t[5], t[6]];
}
var Xt = {};
function Da(e) {
if (!Xt[e]) {
var n = new Intl.DateTimeFormat("en-US", {
hour12: !1,
timeZone: "America/New_York",
year: "numeric",
month: "numeric",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
}).format(/* @__PURE__ */ new Date("2014-06-25T04:00:00.123Z")), a = n === "06/25/2014, 00:00:00" || n === "06/25/2014 00:00:00";
Xt[e] = a ? new Intl.DateTimeFormat("en-US", {
hour12: !1,
timeZone: e,
year: "numeric",
month: "numeric",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
}) : new Intl.DateTimeFormat("en-US", {
hourCycle: "h23",
timeZone: e,
year: "numeric",
month: "numeric",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
});
}
return Xt[e];
}
function gn(e, n, a, t, s, c, h) {
var P = /* @__PURE__ */ new Date(0);
return P.setUTCFullYear(e, n, a), P.setUTCHours(t, s, c, h), P;
}
var Mn = 36e5, $a = 6e4, qt = {
timezone: /([Z+-].*)$/,
timezoneZ: /^(Z)$/,
timezoneHH: /^([+-]\d{2})$/,
timezoneHHMM: /^([+-]\d{2}):?(\d{2})$/
};
function hn(e, n, a) {
var t, s;
if (!e || (t = qt.timezoneZ.exec(e), t))
return 0;
var c;
if (t = qt.timezoneHH.exec(e), t)
return c = parseInt(t[1], 10), Tn(c) ? -(c * Mn) : NaN;
if (t = qt.timezoneHHMM.exec(e), t) {
c = parseInt(t[1], 10);
var h = parseInt(t[2], 10);
return Tn(c, h) ? (s = Math.abs(c) * Mn + h * $a, c > 0 ? -s : s) : NaN;
}
if (Aa(e)) {
n = new Date(n || Date.now());
var P = a ? n : Ma(n), Y = sn(P, e), D = a ? Y : Ta(n, Y, e);
return -D;
}
return NaN;
}
function Ma(e) {
return gn(
e.getFullYear(),
e.getMonth(),
e.getDate(),
e.getHours(),
e.getMinutes(),
e.getSeconds(),
e.getMilliseconds()
);
}
function sn(e, n) {
var a = pa(e, n), t = gn(
a[0],
a[1] - 1,
a[2],
a[3] % 24,
a[4],
a[5],
0
).getTime(), s = e.getTime(), c = s % 1e3;
return s -= c >= 0 ? c : 1e3 + c, t - s;
}
function Ta(e, n, a) {
var t = e.getTime(), s = t - n, c = sn(new Date(s), a);
if (n === c)
return n;
s -= c - n;
var h = sn(new Date(s), a);
return c === h ? c : Math.max(c, h);
}
function Tn(e, n) {
return -23 <= e && e <= 23 && (n == null || 0 <= n && n <= 59);
}
var An = {};
function Aa(e) {
if (An[e])
return !0;
try {
return new Intl.DateTimeFormat(void 0, { timeZone: e }), An[e] = !0, !0;
} catch {
return !1;
}
}
var Sa = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/;
const jn = Sa;
var Jt = 36e5, Sn = 6e4, Ca = 2, Ie = {
dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,
datePattern: /^([0-9W+-]+)(.*)/,
plainTime: /:/,
// year tokens
YY: /^(\d{2})$/,
YYY: [
/^([+-]\d{2})$/,
// 0 additional digits
/^([+-]\d{3})$/,
// 1 additional digit
/^([+-]\d{4})$/
// 2 additional digits
],
YYYY: /^(\d{4})/,
YYYYY: [
/^([+-]\d{4})/,
// 0 additional digits
/^([+-]\d{5})/,
// 1 additional digit
/^([+-]\d{6})/
// 2 additional digits
],
// date tokens
MM: /^-(\d{2})$/,
DDD: /^-?(\d{3})$/,
MMDD: /^-?(\d{2})-?(\d{2})$/,
Www: /^-?W(\d{2})$/,
WwwD: /^-?W(\d{2})-?(\d{1})$/,
HH: /^(\d{2}([.,]\d*)?)$/,
HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,
// time zone tokens (to identify the presence of a tz)
timeZone: jn
};
function un(e, n) {
if (arguments.length < 1)
throw new TypeError("1 argument required, but only " + arguments.length + " present");
if (e === null)
return /* @__PURE__ */ new Date(NaN);
var a = n || {}, t = a.additionalDigits == null ? Ca : ga(a.additionalDigits);
if (t !== 2 && t !== 1 && t !== 0)
throw new RangeError("additionalDigits must be 0, 1 or 2");
if (e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]")
return new Date(e.getTime());
if (typeof e == "number" || Object.prototype.toString.call(e) === "[object Number]")
return new Date(e);
if (!(typeof e == "string" || Object.prototype.toString.call(e) === "[object String]"))
return /* @__PURE__ */ new Date(NaN);
var s = Pa(e), c = _a(s.date, t), h = c.year, P = c.restDateString, Y = Na(P, h);
if (isNaN(Y))
return /* @__PURE__ */ new Date(NaN);
if (Y) {
var D = Y.getTime(), L = 0, M;
if (s.time && (L = Ra(s.time), isNaN(L)))
return /* @__PURE__ */ new Date(NaN);
if (s.timeZone || a.timeZone) {
if (M = hn(s.timeZone || a.timeZone, new Date(D + L)), isNaN(M))
return /* @__PURE__ */ new Date(NaN);
} else
M = $n(new Date(D + L)), M = $n(new Date(D + L + M));
return new Date(D + L + M);
} else
return /* @__PURE__ */ new Date(NaN);
}
function Pa(e) {
var n = {}, a = Ie.dateTimePattern.exec(e), t;
if (a ? (n.date = a[1], t = a[3]) : (a = Ie.datePattern.exec(e), a ? (n.date = a[1], t = a[2]) : (n.date = null, t = e)), t) {
var s = Ie.timeZone.exec(t);
s ? (n.time = t.replace(s[1], ""), n.timeZone = s[1].trim()) : n.time = t;
}
return n;
}
function _a(e, n) {
var a = Ie.YYY[n], t = Ie.YYYYY[n], s;
if (s = Ie.YYYY.exec(e) || t.exec(e), s) {
var c = s[1];
return {
year: parseInt(c, 10),
restDateString: e.slice(c.length)
};
}
if (s = Ie.YY.exec(e) || a.exec(e), s) {
var h = s[1];
return {
year: parseInt(h, 10) * 100,
restDateString: e.slice(h.length)
};
}
return {
year: null
};
}
function Na(e, n) {
if (n === null)
return null;
var a, t, s, c;
if (e.length === 0)
return t = /* @__PURE__ */ new Date(0), t.setUTCFullYear(n), t;
if (a = Ie.MM.exec(e), a)
return t = /* @__PURE__ */ new Date(0), s = parseInt(a[1], 10) - 1, Pn(n, s) ? (t.setUTCFullYear(n, s), t) : /* @__PURE__ */ new Date(NaN);
if (a = Ie.DDD.exec(e), a) {
t = /* @__PURE__ */ new Date(0);
var h = parseInt(a[1], 10);
return Ba(n, h) ? (t.setUTCFullYear(n, 0, h), t) : /* @__PURE__ */ new Date(NaN);
}
if (a = Ie.MMDD.exec(e), a) {
t = /* @__PURE__ */ new Date(0), s = parseInt(a[1], 10) - 1;
var P = parseInt(a[2], 10);
return Pn(n, s, P) ? (t.setUTCFullYear(n, s, P), t) : /* @__PURE__ */ new Date(NaN);
}
if (a = Ie.Www.exec(e), a)
return c = parseInt(a[1], 10) - 1, _n(n, c) ? Cn(n, c) : /* @__PURE__ */ new Date(NaN);
if (a = Ie.WwwD.exec(e), a) {
c = parseInt(a[1], 10) - 1;
var Y = parseInt(a[2], 10) - 1;
return _n(n, c, Y) ? Cn(n, c, Y) : /* @__PURE__ */ new Date(NaN);
}
return null;
}
function Ra(e) {
var n, a, t;
if (n = Ie.HH.exec(e), n)
return a = parseFloat(n[1].replace(",", ".")), Qt(a) ? a % 24 * Jt : NaN;
if (n = Ie.HHMM.exec(e), n)
return a = parseInt(n[1], 10), t = parseFloat(n[2].replace(",", ".")), Qt(a, t) ? a % 24 * Jt + t * Sn : NaN;
if (n = Ie.HHMMSS.exec(e), n) {
a = parseInt(n[1], 10), t = parseInt(n[2], 10);
var s = parseFloat(n[3].replace(",", "."));
return Qt(a, t, s) ? a % 24 * Jt + t * Sn + s * 1e3 : NaN;
}
return null;
}
function Cn(e, n, a) {
n = n || 0, a = a || 0;
var t = /* @__PURE__ */ new Date(0);
t.setUTCFullYear(e, 0, 4);
var s = t.getUTCDay() || 7, c = n * 7 + a + 1 - s;
return t.setUTCDate(t.getUTCDate() + c), t;
}
var Oa = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Ia = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function Gn(e) {
return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
}
function Pn(e, n, a) {
if (n < 0 || n > 11)
return !1;
if (a != null) {
if (a < 1)
return !1;
var t = Gn(e);
if (t && a > Ia[n] || !t && a > Oa[n])
return !1;
}
return !0;
}
function Ba(e, n) {
if (n < 1)
return !1;
var a = Gn(e);
return !(a && n > 366 || !a && n > 365);
}
function _n(e, n, a) {
return !(n < 0 || n > 52 || a != null && (a < 0 || a > 6));
}
function Qt(e, n, a) {
return !(e != null && (e < 0 || e >= 25) || n != null && (n < 0 || n >= 60) || a != null && (a < 0 || a >= 60));
}
var Vt = {}, Ya = {
get exports() {
return Vt;
},
set exports(e) {
Vt = e;
}
}, Et = {}, Va = {
get exports() {
return Et;
},
set exports(e) {
Et = e;
}
};
(function(e, n) {
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = a;
function a(t, s) {
if (t == null)
throw new TypeError("assign requires that input parameter not be null or undefined");
for (var c in s)
Object.prototype.hasOwnProperty.call(s, c) && (t[c] = s[c]);
return t;
}
e.exports = n.default;
})(Va, Et);
(function(e, n) {
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = s;
var a = t(Et);
function t(c) {
return c && c.__esModule ? c : { default: c };
}
function s(c) {
return (0, a.default)({}, c);
}
e.exports = n.default;
})(Ya, Vt);
const Ea = /* @__PURE__ */ yn(Vt);
function Fa(e, n, a) {
var t = un(e, a), s = hn(n, t, !0), c = new Date(t.getTime() - s), h = /* @__PURE__ */ new Date(0);
return h.setFullYear(c.getUTCFullYear(), c.getUTCMonth(), c.getUTCDate()), h.setHours(c.getUTCHours(), c.getUTCMinutes(), c.getUTCSeconds(), c.getUTCMilliseconds()), h;
}
function La(e, n, a) {
if (typeof e == "string" && !e.match(jn)) {
var t = Ea(a);
return t.timeZone = n, un(e, t);
}
var s = un(e, a), c = gn(
s.getFullYear(),
s.getMonth(),
s.getDate(),
s.getHours(),
s.getMinutes(),
s.getSeconds(),
s.getMilliseconds()
).getTime(), h = hn(n, new Date(c));
return new Date(c + h);
}
const Ua = (e, n = 3) => {
const a = [];
for (let t = 0; t < e.length; t += n)
a.push([e[t], e[t + 1], e[t + 2]]);
return a;
}, Ha = (e, n) => {
const a = [1, 2, 3, 4, 5, 6, 7].map((c) => new Intl.DateTimeFormat(e, { weekday: "short", timeZone: "UTC" }).format(/* @__PURE__ */ new Date(`2017-01-0${c}T00:00:00+00:00`)).slice(0, 2)), t = a.slice(0, n), s = a.slice(n + 1, a.length);
return [a[n]].concat(...s).concat(...t);
}, Wa = (e, n) => {
const a = [];
for (let t = +e[0]; t <= +e[1]; t++)
a.push({ value: +t, text: `${t}` });
return n ? a.reverse() : a;
}, za = (e, n) => {
const a = new Intl.DateTimeFormat(e, { month: n, timeZone: "UTC" });
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((s) => {
const c = s < 10 ? `0${s}` : s;
return /* @__PURE__ */ new Date(`2017-${c}-01T00:00:00+00:00`);
}).map((s, c) => ({
text: a.format(s),
value: c
}));
}, Ka = (e) => [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11][e], $e = (e) => {
const n = u(e);
return n != null && n.$el ? n == null ? void 0 : n.$el : n;
}, xa = (e) => Object.assign({ type: "dot" }, e), Zn = (e) => Array.isArray(e) ? !!e[0] && !!e[1] : !1, Ft = {
prop: (e) => `"${e}" prop must be enabled!`,
dateArr: (e) => `You need to use array as "model-value" binding in order to support "${e}"`
}, Me = (e) => e, Nn = (e) => e === 0 ? e : !e || isNaN(+e) ? null : +e, Rn = (e) => Object.assign(
{
menuAppear: "dp-menu-appear",
open: "dp-slide-down",
close: "dp-slide-up",
next: "calendar-next",
previous: "calendar-prev",
vNext: "dp-slide-up",
vPrevious: "dp-slide-down"
},
e
), ja = (e) => Object.assign(
{
toggleOverlay: "Toggle overlay",
menu: "Datepicker menu",
input: "Datepicker input",
calendarWrap: "Calendar wrapper",
calendarDays: "Calendar days",
openTimePicker: "Open time picker",
closeTimePicker: "Close time Picker",
incrementValue: (n) => `Increment ${n}`,
decrementValue: (n) => `Decrement ${n}`,
openTpOverlay: (n) => `Open ${n} overlay`,
amPmButton: "Switch AM/PM mode",
openYearsOverlay: "Open years overlay",
openMonthsOverlay: "Open months overlay",
nextMonth: "Next month",
prevMonth: "Previous month",
day: () => ""
},
e
), Ga = (e) => e === null ? 0 : typeof e == "boolean" ? e ? 2 : 0 : +e >= 2 ? +e : 2, Za = (e, n, a) => e || (typeof a == "string" ? a : n), Xa = (e) => typeof e == "boolean" ? e ? Rn({}) : !1 : Rn(e), qa = () => ({
enterSubmit: !0,
tabSubmit: !0,
openMenu: !0,
rangeSeparator: " - "
}), Ja = (e) => Object.assign({ months: [], years: [], times: { hours: [], minutes: [], seconds: [] } }, e), Ve = (e) => {
const n = () => {
if (e.partialRange)
return null;
throw new Error(Ft.prop("partial-range"));
}, a = F(() => ({
ariaLabels: ja(e.ariaLabels),
textInputOptions: Object.assign(qa(), e.textInputOptions),
multiCalendars: Ga(e.multiCalendars),
previewFormat: Za(e.previewFormat, e.format, c()),
filters: Ja(e.filters),
transitions: Xa(e.transitions),
startTime: m()
})), t = (o) => {
if (e.range)
return o();
throw new Error(Ft.prop("range"));
}, s = () => {
const o = e.enableSeconds ? ":ss" : "";
return e.is24 ? `HH:mm${o}` : `hh:mm${o} aa`;
}, c = () => e.format ? e.format : e.monthPicker ? "MM/yyyy" : e.timePicker ? s() : e.weekPicker ? "MM/dd/yyyy" : e.yearPicker ? "yyyy" : e.enableTimePicker ? `MM/dd/yyyy, ${s()}` : "MM/dd/yyyy", h = (o, r) => {
if (typeof e.format == "function")
return e.format(o);
const d = r || c(), A = e.formatLocale ? { locale: e.formatLocale } : void 0;
return Array.isArray(o) ? `${bt(o[0], d, A)} ${e.modelAuto && !o[1] ? "" : a.value.textInputOptions.rangeSeparator || "-"} ${o[1] ? bt(o[1], d, A) : ""}` : bt(o, d, A);
}, P = (o) => e.timezone ? Fa(o, e.timezone) : o, Y = (o) => e.timezone ? La(o, e.timezone) : o, D = F(() => (o) => {
var r;
return (r = e.hideNavigation) == null ? void 0 : r.includes(o);
}), L = (o) => {
const r = e.maxDate ? Be(P(o), P(b(e.maxDate))) : !1, d = e.minDate ? _e(P(o), P(b(e.minDate))) : !1, A = O(o, e.disabledDates), R = a.value.filters.months.map((ne) => +ne).includes(pe(o)), g = e.disabledWeekDays.length ? e.disabledWeekDays.some((ne) => +ne === aa(o)) : !1, k = e.allowedDates.length ? !e.allowedDates.some((ne) => me(P(b(ne)), P(o))) : !1, y = ke(o), j = y < +e.yearRange[0] || y > +e.yearRange[1];
return !(r || d || A || R || j || g || k);
}, M = (o) => {
const r = {
hours: je(b()),
minutes: Ge(b()),
seconds: e.enableSeconds ? yt(b()) : 0
};
return Object.assign(r, o);
}, m = () => e.range ? e.startTime && Array.isArray(e.startTime) ? [M(e.startTime[0]), M(e.startTime[1])] : null : e.startTime && !Array.isArray(e.startTime) ? M(e.startTime) : null, T = (o) => !L(o), Q = (o) => Array.isArray(o) ? Rt(o[0]) && (o[1] ? Rt(o[1]) : !0) : o ? Rt(o) : !1, X = (o) => o instanceof Date ? o : ra(o), z = (o) => {
const r = pn(P(o), { weekStartsOn: +e.weekStart }), d = la(P(o), { weekStartsOn: +e.weekStart });
return [r, d];
}, O = (o, r) => Array.isArray(r) ? r.some((d) => me(P(b(d)), P(o))) : r(o), I = (o, r, d) => {
let A = o ? b(o) : b();
return (r || r === 0) && (A = Ot(A, r)), d && (A = ut(A, d)), A;
}, V = (o) => Se(b(), { hours: je(o), minutes: Ge(o), seconds: yt(o) }), J = (o) => Se(b(), {
hours: +o.hours || 0,
minutes: +o.minutes || 0,
seconds: +o.seconds || 0
}), G = (o, r, d, A) => {
if (!o)
return !0;
if (A) {
const H = d === "max" ? fn(o, r) : vn(o, r), R = { seconds: 0, milliseconds: 0 };
return H || Vn(Se(o, R), Se(r, R));
}
return d === "max" ? o.getTime() <= r.getTime() : o.getTime() >= r.getTime();
}, te = () => !e.enableTimePicker || e.monthPicker || e.yearPicker || e.ignoreTimeValidation, se = (o) => Array.isArray(o) ? [o[0] ? V(o[0]) : null, o[1] ? V(o[1]) : null] : V(o), S = (o) => {
const r = e.maxTime ? J(e.maxTime) : b(e.maxDate);
return Array.isArray(o) ? G(o[0], r, "max", !!e.maxDate) && G(o[1], r, "max", !!e.maxDate) : G(o, r, "max", !!e.maxDate);
}, E = (o, r) => {
const d = e.minTime ? J(e.minTime) : b(e.minDate);
return Array.isArray(o) ? G(o[0], d, "min", !!e.minDate) && G(o[1], d, "min", !!e.minDate) && r : G(o, d, "min", !!e.minDate) && r;
}, U = (o) => {
let r = !0;
if (!o || te())
return !0;
const d = !e.minDate && !e.maxDate ? se(o) : o;
return (e.maxTime || e.maxDate) && (r = S(Me(d))), (e.minTime || e.minDate) && (r = E(Me(d), r)), r;
}, f = (o, r) => {
const d = b(JSON.parse(JSON.stringify(o))), A = [];
for (let H = 0; H < 7; H++) {
const R = mt(d, H), g = pe(R) !== r;
A.push({
text: e.hideOffsetDates && g ? "" : R.getDate(),
value: R,
current: !g,
classData: {}
});
}
return A;
}, _ = (o, r) => {
const d = [], A = b(P(new Date(r, o))), H = b(P(new Date(r, o + 1, 0))), R = pn(A, { weekStartsOn: e.weekStart }), g = (k) => {
const y = f(k, o);
if (d.push({ days: y }), !d[d.length - 1].days.some(
(j) => me(Ue(j.value), Ue(H))
)) {
const j = mt(k, 7);
g(j);
}
};
if (g(R), e.sixWeeks && d.length < 6) {
const k = 6 - d.length;
for (let y = 1; y <= k; y++) {
const j = d[d.length - 1], ne = j.days[j.days.length - 1], Ne = f(mt(ne.value, 1), pe(A));
d.push({ days: Ne });
}
}
return d;
}, K = (o, r, d) => [Se(b(o), { date: 1 }), Se(b(), { month: r, year: d, date: 1 })], oe = (o, r) => _e(...K(e.minDate, o, r)) || me(...K(e.minDate, o, r)), ee = (o, r) => Be(...K(e.maxDate, o, r)) || me(...K(e.maxDate, o, r)), N = (o, r, d) => {
let A = !1;
return e.maxDate && d && ee(o, r) && (A = !0), e.minDate && !d && oe(o, r) && (A = !0), A;
};
return {
checkPartialRangeValue: n,
checkRangeEnabled: t,
getZonedDate: P,
getZonedToUtc: Y,
formatDate: h,
getDefaultPattern: c,
validateDate: L,
getDefaultStartTime: m,
isDisabled: T,
isValidDate: Q,
sanitizeDate: X,
getWeekFromDate: z,
matchDate: O,
setDateMonthOrYear: I,
isValidTime: U,
getCalendarDays: _,
validateMonthYearInRange: (o, r, d, A) => {
let H = !1;
return A ? e.minDate && e.maxDate ? H = N(o, r, d) : (e.minDate && oe(o, r) || e.maxDate && ee(o, r)) && (H = !0) : H = !0, H;
},
validateMaxDate: ee,
validateMinDate: oe,
assignDefaultTime: M,
defaults: a,
hideNavigationButtons: D
};
}, he = Tt({
monthYear: [],
calendar: [],
time: [],
actionRow: [],
selectionGrid: [],
timePicker: {
0: [],
1: []
},
monthPicker: []
}), en = W(null), Pt = W(!1), tn = W(!1), nn = W(!1), an = W(!1), Oe = W(0), Ae = W(0), nt = () => {
const e = F(() => Pt.value ? [...he.selectionGrid, he.actionRow].filter((O) => O.length) : tn.value ? [
...he.timePicker[0],
...he.timePicker[1],
an.value ? [] : [en.value],
he.actionRow
].filter((O) => O.length) : nn.value ? [...he.monthPicker, he.actionRow] : [he.monthYear, ...he.calendar, he.time, he.actionRow].filter((O) => O.length)), n = (O) => {
Oe.value = O ? Oe.value + 1 : Oe.value - 1;
let I = null;
e.value[Ae.value] && (I = e.value[Ae.value][Oe.value]), I || (Oe.value = O ? Oe.value - 1 : Oe.value + 1);
}, a = (O) => {
if (Ae.value === 0 && !O || Ae.value === e.value.length && O)
return;
Ae.value = O ? Ae.value + 1 : Ae.value - 1, e.value[Ae.value] ? e.value[Ae.value] && !e.value[Ae.value][Oe.value] && Oe.value !== 0 && (Oe.value = e.value[Ae.value].length - 1) : Ae.value = O ? Ae.value - 1 : Ae.value + 1;
}, t = (O) => {
let I = null;
e.value[Ae.value] && (I = e.value[Ae.value][Oe.value]), I ? I.focus({ preventScroll: !Pt.value }) : Oe.value = O ? Oe.value - 1 : Oe.value + 1;
}, s = () => {
n(!0), t(!0);
}, c = () => {
n(!1), t(!1);
}, h = () => {
a(!1), t(!0);
}, P = () => {
a(!0), t(!0);
}, Y = (O, I) => {
he[I] = O;
}, D = (O, I) => {
he[I] = O;
}, L = () => {
Oe.value = 0, Ae.value = 0;
};
return {
buildMatrix: Y,
buildMultiLevelMatrix: D,
setTimePickerBackRef: (O) => {
en.value = O;
},
setSelectionGrid: (O) => {
Pt.value = O, L(), O || (he.selectionGrid = []);
},
setTimePicker: (O, I = !1) => {
tn.value = O, an.value = I, L(), O || (he.timePicker[0] = [], he.timePicker[1] = []);
},
setTimePickerElements: (O, I = 0) => {
he.timePicker[I] = O;
},
arrowRight: s,
arrowLeft: c,
arrowUp: h,
arrowDown: P,
clearArrowNav: () => {
he.monthYear = [], he.calendar = [], he.time = [], he.actionRow = [], he.selectionGrid = [], he.timePicker[0] = [], he.timePicker[1] = [], Pt.value = !1, tn.value = !1, an.value = !1, nn.value = !1, L(), en.value = null;
},
setMonthPicker: (O) => {
nn.value = O, L();
},
refSets: he
// exposed for testing
};
}, On = (e) => Array.isArray(e), lt = (e) => Array.isArray(e), In = (e) => Array.isArray(e) && e.length === 2, Qa = (e, n, a, t, s) => {
const {
getDefaultStartTime: c,
isDisabled: h,
sanitizeDate: P,
getWeekFromDate: Y,
setDateMonthOrYear: D,
validateMonthYearInRange: L,
defaults: M
} = Ve(e), m = F({
get: () => e.internalModelValue,
set: (i) => {
!e.readonly && !e.disabled && n("update:internal-model-value", i);
}
}), T = W([]);
tt(m, () => {
te();
});
const Q = Mt(e, "multiCalendars");
tt(Q, () => {
ve(0);
});
const X = W([{ month: pe(b()), year: ke(b()) }]), z = Tt({
hours: e.range ? [je(b()), je(b())] : je(b()),
minutes: e.range ? [Ge(b()), Ge(b())] : Ge(b()),
seconds: e.range ? [0, 0] : 0
}), O = F(
() => (i) => X.value[i] ? X.value[i].month : 0
), I = F(
() => (i) => X.value[i] ? X.value[i].year : 0
), V = F(() => e.flow && e.flow.length && !e.partialFlow ? s.value === e.flow.length : !0), J = (i, w, q) => {
var v, B;
X.value[i] || (X.value[i] = { month: 0, year: 0 }), X.value[i].month = w === null ? (v = X.value[i]) == null ? void 0 : v.month : w, X.value[i].year = q === null ? (B = X.value[i]) == null ? void 0 : B.year : q;
}, G = (i, w) => {
z[i] = w;
};
He(() => {
m.value || (e.startDate && (J(0, pe(b(e.startDate)), ke(b(e.startDate))), M.value.multiCalendars && ve(0)), M.value.startTime && N()), te(!0);
});
const te = (i = !1) => {
if (m.value)
return Array.isArray(m.value) ? (T.value = m.value, f(i)) : S(m.value);
if (e.timePicker)
return _();
if (e.monthPicker && !e.range)
return K();
if (e.yearPicker && !e.range)
return oe();
if (M.value.multiCalendars && i && !e.startDate)
return se(b(), i);
}, se = (i, w = !1) => {
if ((!M.value.multiCalendars || !e.multiStatic || w) && J(0, pe(i), ke(i)), M.value.multiCalendars)
for (let q = 1; q < M.value.multiCalendars; q++) {
const v = Se(b(), { month: O.value(q - 1), year: I.value(q - 1) }), B = Un(v, { months: 1 });
X.value[q] = { month: pe(B), year: ke(B) };
}
}, S = (i) => {
se(i), G("hours", je(i)), G("minutes", Ge(i)), G("seconds", yt(i));
}, E = (i, w) => {
se(i[0], w);
const q = (v, B) => [
v(i[0]),
i[1] ? v(i[1]) : z[B][1]
];
G("hours", q(je, "hours")), G("minutes", q(Ge, "minutes")), G("seconds", q(yt, "seconds"));
}, U = (i, w) => {
if ((e.range || e.weekPicker) && !e.multiDates)
return E(i, w);
if (e.multiDates) {
const q = i[i.length - 1];
return S(q);
}
}, f = (i) => {
const w = m.value;
U(w, i), M.value.multiCalendars && e.multiCalendarsSolo && o();
}, _ = () => {
if (N(), !e.range)
m.value = Ee(b(), z.hours, z.minutes, ee());
else {
const i = z.hours, w = z.minutes;
m.value = [
Ee(b(), i[0], w[0], ee()),
Ee(b(), i[1], w[1], ee(!1))
];
}
}, K = () => {
e.multiDates ? m.value = [D(b(), O.value(0), I.value(0))] : m.value = D(b(), O.value(0), I.value(0));
}, oe = () => {
m.value = b();
}, ee = (i = !0) => e.enableSeconds ? Array.isArray(z.seconds) ? i ? z.seconds[0] : z.seconds[1] : z.seconds : 0, N = () => {
const i = c();
if (i) {
const w = Array.isArray(i), q = w ? [+i[0].hours, +i[1].hours] : +i.hours, v = w ? [+i[0].minutes, +i[1].minutes] : +i.minutes, B = w ? [+i[0].seconds, +i[1].seconds] : +i.seconds;
G("hours", q), G("minutes", v), e.enableSeconds && G("seconds", B);
}
}, l = () => Array.isArray(m.value) && m.value.length ? m.value[m.value.length - 1] : null, o = () => {
if (Array.isArray(m.value) && m.value.length === 2) {
const i = b(
b(m.value[1] ? m.value[1] : st(m.value[0], 1))
), [w, q] = [pe(m.value[0]), ke(m.value[0])], [v, B] = [pe(m.value[1]), ke(m.value[1])];
(w !== v || w === v && q !== B) && e.multiCalendarsSolo && J(1, pe(i), ke(i));
}
}, r = (i) => {
const w = st(i, 1);
return { month: pe(w), year: ke(w) };
}, d = (i) => {
const w = pe(b(i)), q = ke(b(i));
if (J(0, w, q), M.value.multiCalendars > 0)
for (let v = 1; v < M.value.multiCalendars; v++) {
const B = r(
Se(b(i), { year: O.value(v - 1), month: I.value(v - 1) })
);
J(v, B.month, B.year);
}
}, A = (i) => {
if (m.value && Array.isArray(m.value))
if (m.value.some((w) => me(i, w))) {
const w = m.value.filter((q) => !me(q, i));
m.value = w.length ? w : null;
} else
(e.multiDatesLimit && +e.multiDatesLimit > m.value.length || !e.multiDatesLimit) && m.value.push(i);
else
m.value = [i];
}, H = (i, w) => {
const q = Be(i, w) ? w : i, v = Be(w, i) ? w : i;
return kn({ start: q, end: v });
}, R = (i, w = 0) => {
if (Array.isArray(m.value) && m.value[w]) {
const q = ia(i, m.value[w]), v = H(m.value[w], i), B = v.length === 1 ? 0 : v.filter((be) => h(be)).length, we = Math.abs(q) - B;
if (e.minRange && e.maxRange)
return we >= +e.minRange && we <= +e.maxRange;
if (e.minRange)
return we >= +e.minRange;
if (e.maxRange)
return we <= +e.maxRange;
}
return !0;
}, g = (i) => Array.isArray(m.value) && m.value.length === 2 ? e.fixedStart && (Be(i, m.value[0]) || me(i, m.value[0])) ? [m.value[0], i] : e.fixedEnd && (_e(i, m.value[1]) || me(i, m.value[1])) ? [i, m.value[1]] : (n("invalid-fixed-range", i), m.value) : [], k = () => {
e.autoApply && V.value && n("auto-apply", e.partialFlow);
}, y = () => {
e.autoApply && n("select-date");
}, j = (i) => !kn({ start: i[0], end: i[1] }).some((q) => h(q)), ne = (i) => (m.value = Y(b(i.value)), k()), Ne = (i) => {
const w = Ee(b(i.value), z.hours, z.minutes, ee());
e.multiDates ? A(w) : m.value = w, a(), k();
}, Xe = () => {
T.value = m.value ? m.value.slice() : [], T.value.length === 2 && !(e.fixedStart || e.fixedEnd) && (T.value = []);
}, le = (i, w) => {
const q = [b(i.value), mt(b(i.value), +e.autoRange)];
j(q) && (w && d(i.value), T.value = q);
}, qe = (i) => {
ze(i.value) || !R(i.value, e.fixedStart ? 0 : 1) || (T.value = g(b(i.value)));
}, ze = (i) => e.noDisabledRange ? H(T.value[0], i).some((q) => h(q)) : !1, Re = (i, w) => {
if (Xe(), e.autoRange)
return le(i, w);
if (e.fixedStart || e.fixedEnd)
return qe(i);
T.value[0] ? R(b(i.value)) && !ze(i.value) && (_e(b(i.value), b(T.value[0])) ? T.value.unshift(b(i.value)) : T.value[1] = b(i.value)) : T.value[0] = b(i.value);
}, rt = (i) => {
T.value[i] = Ee(
T.value[i],
z.hours[i],
z.minutes[i],
ee(i !== 1)
);
}, ht = () => {
T.value.length && (T.value[0] && !T.value[1] ? rt(0) : (rt(0), rt(1), a()), m.value = T.value.slice(), T.value[0] && T.value[1] && e.autoApply && n("auto-apply"), T.value[0] && !T.value[1] && e.modelAuto && e.autoApply && n("auto-apply"));
}, ae = (i, w = !1) => {
if (!(h(i.value) || !i.current && e.hideOffsetDates)) {
if (e.weekPicker)
return ne(i);
if (!e.range)
return Ne(i);
lt(z.hours) && lt(z.minutes) && !e.multiDates && (Re(i, w), ht());
}
}, ge = (i) => {
const w = i[0];
return e.weekNumbers === "local" ? oa(w.value, { weekStartsOn: +e.weekStart }) : e.weekNumbers === "iso" ? sa(w.value) : typeof e.weekNumbers == "function" ? e.weekNumbers(w.value) : "";
}, ve = (i) => {
for (let w = i - 1; w >= 0; w--) {
const q = Dt(Se(b(), { month: O.value(w + 1), year: I.value(w + 1) }), 1);
J(w, pe(q), ke(q));
}
for (let w = i + 1; w <= M.value.multiCalendars - 1; w++) {
const q = st(Se(b(), { month: O.value(w - 1), year: I.value(w - 1) }), 1);
J(w, pe(q), ke(q));
}
}, Fe = (i) => D(b(), O.value(i), I.value(i)), Je = (i) => Ee(i, z.hours, z.minutes, ee()), Ht = (i) => {
A(Fe(i));
}, Wt = (i, w) => {
const q = e.monthPicker ? O.value(i) !== w.month || !w.fromNav : I.value(i) !== w.year;
if (J(i, w.month, w.year), M.value.multiCalendars && !e.multiCalendarsSolo && ve(i), e.monthPicker || e.yearPicker)
if (e.multiDates)
q && Ht(i);
else if (e.range) {
if (q) {
let v = m.value ? m.value.slice() : [];
v.length === 2 && v[1] !== null && (v = []), v.length ? _e(Fe(i), v[0]) ? v.unshift(Fe(i)) : v[1] = Fe(i) : v = [Fe(i)], m.value = v;
}
} else
m.value = Fe(i);
n("update-month-year", { instance: i, month: w.month, year: w.year }), t(e.multiCalendarsSolo ? i : void 0);
}, zt = async (i = !1) => {
if (e.autoApply && (e.monthPicker || e.yearPicker)) {
await dt();
const w = e.monthPicker ? i : !1;
e.range ? n("auto-apply", w || !m.value || m.value.length === 1) : n("auto-apply", w);
}
a();
}, At = (i, w) => {
const q = Se(b(), { month: O.value(w), year: I.value(w) }), v = i < 0 ? st(q, 1) : Dt(q, 1);
L(pe(v), ke(v), i < 0, e.preventMinMaxNavigation) && (J(w, pe(v), ke(v)), M.value.multiCalendars && !e.multiCalendarsSolo && ve(w), n("update-month-year", { instance: w, month: pe(v), year: ke(v) }), t());
}, pt = (i) => {
On(i) && On(m.value) && lt(z.hours) && lt(z.minutes) ? (i[0] && m.value[0] && (m.value[0] = Ee(i[0], z.hours[0], z.minutes[0], ee())), i[1] && m.value[1] && (m.value[1] = Ee(i[1], z.hours[1], z.minutes[1], ee(!1)))) : e.multiDates && Array.isArray(m.value) ? m.value[m.value.length - 1] = Je(i) : !e.range && !In(i) && (m.value = Je(i)), n("time-update");
}, Kt = (i, w = !0, q = !1) => {
const v = w ? i : z.hours, B = !w && !q ? i : z.minutes, we = q ? i : z.seconds;
if (e.range && In(m.value) && lt(v) && lt(B) && lt(we) && !e.disableTimeRangeValidation) {
const be = (Z) => Ee(m.value[Z], v[Z], B[Z], we[Z]), xe = (Z) => mn(m.value[Z], 0);
if (me(m.value[0], m.value[1]) && (vn(be(0), xe(1)) || fn(be(1), xe(0))))
return;
}
if (G("hours", v), G("minutes", B), G("seconds", we), m.value)
if (e.multiDates) {
const be = l();
be && pt(be);
} else
pt(m.value);
else
e.timePicker && pt(e.range ? [b(), b()] : b());
a();
}, xt = (i, w) => {
e.monthChangeOnScroll && At(e.monthChangeOnScroll !== "inverse" ? -i.deltaY : i.deltaY, w);
}, jt = (i, w, q = !1) => {
e.monthChangeOnArrows && e.vertical === q && St(i, w);
}, St = (i, w) => {
At(i === "right" ? -1 : 1, w);
};
return {
time: z,
month: O,
year: I,
modelValue: m,
calendars: X,
monthYearSelect: zt,
isDisabled: h,
updateTime: Kt,
getWeekNum: ge,
selectDate: ae,
updateMonthYear: Wt,
handleScroll: xt,
getMarker: (i) => e.markers.find((w) => me(P(i.value), P(w.date))),
handleArrow: jt,
handleSwipe: St,
selectCurrentDate: () => {
e.range ? m.value && Array.isArray(m.value) && m.value[0] ? m.value = _e(b(), m.value[0]) ? [b(), m.value[0]] : [m.value[0], b()] : m.value = [b()] : m.value = b(), y();
},
presetDateRange: (i, w) => {
w || i.length && i.length <= 2 && e.range && (m.value = i.map((q) => b(q)), y(), e.multiCalendars && dt().then(() => te(!0)));
}
};
}, er = (e, n, a) => {
const t = W(), {
getZonedToUtc: s,
getZonedDate: c,
formatDate: h,
getDefaultPattern: P,
checkRangeEnabled: Y,
checkPartialRangeValue: D,
isValidDate: L,
setDateMonthOrYear: M,
defaults: m
} = Ve(n), T = W(""), Q = Mt(n, "format");
tt(t, () => {
e("internal-model-change", t.value);
}), tt(Q, () => {
o();
});
const X = (y) => {
const j = y || b();
return n.modelType ? d(j) : {
hours: je(j),
minutes: Ge(j),
seconds: n.enableSeconds ? yt(j) : 0
};
}, z = (y) => n.modelType ? d(y) : { month: pe(y), year: ke(y) }, O = (y) => Array.isArray(y) ? Y(() => [
ut(b(), y[0]),
y[1] ? ut(b(), y[1]) : D()
]) : ut(b(), +y), I = (y, j) => (typeof y == "string" || typeof y == "number") && n.modelType ? r(y) : j, V = (y) => Array.isArray(y) ? [
I(
y[0],
Ee(null, +y[0].hours, +y[0].minutes, y[0].seconds)
),
I(
y[1],
Ee(null, +y[1].hours, +y[1].minutes, y[1].seconds)
)
] : I(y, Ee(null, y.hours, y.minutes, y.seconds)), J = (y) => Array.isArray(y) ? n.multiDates ? y.map((j) => I(j, M(null, +j.month, +j.year))) : Y(() => [
I(y[0], M(null, +y[0].month, +y[0].year)),
I(
y[1],
y[1] ? M(null, +y[1].month, +y[1].year) : D()
)
]) : I(y, M(null, +y.month, +y.year)), G = (y) => {
if (Array.isArray(y))
return y.map((j) => r(j));
throw new Error(Ft.dateArr("multi-dates"));
}, te = (y) => {
if (Array.isArray(y))
return [b(y[0]), b(y[1])];
throw new Error(Ft.dateArr("week-picker"));
}, se = (y) => n.modelAuto ? Array.isArray(y) ? [r(y[0]), r(y[1])] : n.autoApply ? [r(y)] : [r(y), null] : Array.isArray(y) ? Y(() => [
r(y[0]),
y[1] ? r(y[1]) : D()
]) : r(y), S = () => {
Array.isArray(t.value) && n.range && t.value.length === 1 && t.value.push(D());
}, E = () => {
const y = t.value;
return [
d(y[0]),
y[1] ? d(y[1]) : D()
];
}, U = () => t.value[1] ? E() : d(Me(t.value[0])), f = () => (t.value || []).map((y) => d(y)), _ = () => (S(), n.modelAuto ? U() : n.multiDates ? f() : Array.isArray(t.value) ? Y(() => E()) : d(Me(t.value))), K = (y) => y ? n.timePicker ? V(Me(y)) : n.monthPicker ? J(Me(y)) : n.yearPicker ? O(Me(y)) : n.multiDates ? G(Me(y)) : n.weekPicker ? te(Me(y)) : se(Me(y)) : null, oe = (y) => {
const j = K(y);
L(Me(j)) ? (t.value = Me(j), o()) : (t.value = null, T.value = "");
}, ee = () => {
var j;
const y = (ne) => {
var Ne;
return bt(ne, (Ne = m.value.textInputOptions) == null ? void 0 : Ne.format);
};
return `${y(t.value[0])} ${(j = m.value.textInputOptions) == null ? void 0 : j.rangeSeparator} ${t.value[1] ? y(t.value[1]) : ""}`;
}, N = () => {
var y;
return a.value && t.value ? Array.isArray(t.value) ? ee() : bt(t.value, (y = m.value.textInputOptions) == null ? void 0 : y.format) : h(t.value);
}, l = () => {
var y;
return t.value ? n.multiDates ? t.value.map((j) => h(j)).join("; ") : n.textInput && typeof ((y = m.value.textInputOptions) == null ? void 0 : y.format) == "string" ? N() : h(t.value) : "";
}, o = () => {
!n.format || typeof n.format == "string" ? T.value = l() : T.value = n.format(t.value);
}, r = (y) => {
if (n.utc) {
const j = new Date(y);
return n.utc === "preserve" ? new Date(j.getTime() + j.getTimezoneOffset() * 6e4) : j;
}
return n.modelType ? n.modelType === "date" || n.modelType === "timestamp" ? c(new Date(y)) : n.modelType === "format" && (typeof n.format == "string" || !n.format) ? on(y, P(), /* @__PURE__ */ new Date()) : c(on(y, n.modelType, /* @__PURE__ */ new Date())) : c(new Date(y));
}, d = (y) => y ? n.utc ? ma(y, n.utc === "preserve") : n.modelType ? n.modelType === "timestamp" ? +s(y) : n.modelType === "format" && (typeof n.format == "string" || !n.format) ? h(s(y)) : h(s(y), n.modelType) : s(y) : "", A = (y) => {
e("update:model-value", y);
}, H = (y) => Array.isArray(t.value) ? n.multiDates ? t.value.map((j) => y(j)) : [
y(t.value[0]),
t.value[1] ? y(t.value[1]) : D()
] : y(Me(t.value)), R = (y) => A(Me(H(y)));
return {
inputValue: T,
internalModelValue: t,
checkBeforeEmit: () => t.value ? n.range ? n.partialRange ? t.value.length >= 1 : t.value.length === 2 : !!t.value : !1,
parseExternalModelValue: oe,
formatInputValue: o,
emitModelValue: () => (o(), n.monthPicker ? R(z) : n.timePicker ? R(X) : n.yearPicker ? R(ke) : n.weekPicker ? A(t.value) : A(_()))
};
}, tr = (e, n) => {
const { validateMonthYearInRange: a, validateMaxDate: t, validateMinDate: s, defaults: c } = Ve(e), h = (M, m) => {
let T = M;
return c.value.filters.months.includes(pe(T)) ? (T = m ? st(M, 1) : Dt(M, 1), h(T, m)) : T;
}, P = (M, m) => {
let T = M;
return c.value.filters.years.includes(ke(T)) ? (T = m ? ua(M, 1) : da(M, 1), P(T, m)) : T;
}, Y = (M) => {
const m = Se(/* @__PURE__ */ new Date(), { month: e.month, year: e.year });
let T = M ? st(m, 1) : Dt(m, 1), Q = pe(T), X = ke(T);
c.value.filters.months.includes(Q) && (T = h(T, M), Q = pe(T), X = ke(T)), c.value.filters.years.includes(X) && (T = P(T, M), X = ke(T)), a(Q, X, M, e.preventMinMaxNavigation) && D(Q, X);
}, D = (M, m) => {
n("update-month-year", { month: M, year: m });
}, L = F(() => (M) => {
if (!e.preventMinMaxNavigation || M && !e.maxDate || !M && !e.minDate)
return !1;
const m = Se(/* @__PURE__ */ new Date(), { month: e.month, year: e.year }), T = M ? st(m, 1) : Dt(m, 1), Q = [pe(T), ke(T)];
return M ? !t(...Q) : !s(...Q);
});
return { handleMonthYearChange: Y, isDisabled: L, updateMonthYear: D };
};
var It = /* @__PURE__ */ ((e) => (e.center = "center", e.left = "left", e.right = "right", e))(It || {});
const nr = (e, n, a, t) => {
const s = W({
top: "0",
left: "0",
transform: "none"
}), c = W(!1), h = Mt(t, "teleportCenter");
tt(h, () => {
X();
});
const P = (S) => {
if (t.teleport) {
const E = S.getBoundingClientRect();
return {
left: E.left + window.scrollX,
top: E.top + window.scrollY
};
}
return { top: 0, left: 0 };
}, Y = (S, E) => {
s.value.left = `${S + E}px`, s.value.transform = "translateX(-100%)";
}, D = (S) => {
s.value.left = `${S}px`, s.value.transform = "translateX(0)";
}, L = (S, E, U = !1) => {
t.position === It.left && D(S), t.position === It.right && Y(S, E), t.position === It.center && (s.value.left = `${S + E / 2}px`, s.value.transform = U ? "translate(-50%, -50%)" : "translateX(-50%)");
}, M = (S) => {
const { width: E, height: U } = S.getBoundingClientRect(), { top: f, left: _ } = t.altPosition ? t.altPosition(S) : P(S);
return { top: +f, left: +_, width: E, height: U };
}, m = () => {
const S = $e(n);
if (S) {
const { top: E, left: U, width: f, height: _ } = M(S);
s.value.top = `${E + _ / 2}px`, s.value.transform = "translateY(-50%)", L(U, f, !0);
}
}, T = () => {
s.value.left = "50%", s.value.top = "50%", s.value.transform = "translate(-50%, -50%)", s.value.position = "fixed";
}, Q = () => {
const S = $e(n), { top: E, left: U, transform: f } = t.altPosition(S);
s.value = { top: `${E}px`, left: `${U}px`, transform: f || "" };
}, X = (S = !0) => {
if (!t.inline)
return h.value ? T() : t.altPosition !== null ? Q() : (S && a("recalculate-position"), G());
}, z = ({
inputEl: S,
menuEl: E,
left: U,
width: f
}) => {
window.screen.width > 768 && L(U, f), V(S, E);
}, O = (S, E) => {
const { top: U, left: f, height: _, width: K } = M(S);
s.value.top = `${_ + U + +t.offset}px`, z({ inputEl: S, menuEl: E, left: f, width: K }), c.value = !1;
}, I = (S, E) => {
const { top: U, left: f, width: _ } = M(S), { height: K } = E.getBoundingClientRect();
s.value.top = `${U - K - +t.offset}px`, z({ inputEl: S, menuEl: E, left: f, width: _ }), c.value = !0;
}, V = (S, E) => {
if (t.autoPosition) {
const { left: U, width: f } = M(S), { left: _, right: K } = E.getBoundingClientRect();
return _ <= 0 || _ <= U ? D(U) : K >= document.documentElement.clientWidth ? Y(U, f) : L(U, f);
}
}, J = (S, E) => {
const { height: U } = E.getBoundingClientRect(), { top: f, height: _ } = S.getBoundingClientRect(), oe = window.innerHeight - f - _, ee = f;
return U <= oe ? O(S,