UNPKG

@vuepic/vue-datepicker

Version:

Datepicker component for Vue 3

1,225 lines 209 kB
import { useAttrs as Xn, createElementBlock as V, openBlock as $, createElementVNode as ge, unref as s, reactive as ta, computed as G, ref as J, toRef as Xt, watch as st, defineComponent as Ke, onMounted as Ge, onUnmounted as jt, renderSlot as ue, normalizeProps as We, mergeProps as Ve, Fragment as we, createCommentVNode as X, normalizeStyle as ot, createTextVNode as bt, toDisplayString as Xe, onBeforeUpdate as Jn, nextTick as lt, withModifiers as Jt, normalizeClass as Me, withDirectives as ia, renderList as _e, vShow as da, createVNode as nt, createBlock as Se, withCtx as De, withKeys as Zn, Transition as Kt, createSlots as Je, useSlots as Et, guardReactiveProps as et, resolveDynamicComponent as ma, toValue as xn, h as el, render as an, getCurrentScope as tl, onScopeDispose as al, getCurrentInstance as nl, isRef as nn, Teleport as ll } from "vue"; import { format as pt, isEqual as Ft, isValid as ca, addMonths as Bt, subMonths as Zt, getMonth as Ae, getYear as ye, set as Re, startOfMonth as rl, setMonth as ol, setYear as mt, isAfter as It, isBefore as Ht, eachDayOfInterval as hn, getSeconds as Ut, getMinutes as Tt, getHours as kt, startOfWeek as Ua, endOfWeek as bn, setHours as sl, setMinutes as ul, setSeconds as kn, setMilliseconds as wn, parse as Na, isDate as il, subDays as dl, addDays as Dt, addHours as cl, addYears as Dn, subYears as Mn, endOfYear as $n, startOfYear as fa, differenceInYears as fl, add as An, sub as vl, getWeek as ml, getISOWeek as pl, isSameQuarter as ln, eachQuarterOfInterval as yl, startOfQuarter as gl, endOfQuarter as rn, getQuarter as on, differenceInCalendarDays as hl, getDay as bl } from "date-fns"; function Gt() { const e = Xn(); return $(), V( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", fill: "currentColor", "aria-hidden": "true", class: "dp__icon", role: "img", ...e }, [ ge("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" }), ge("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" }), ge("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" }), ge("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" }) ] ); } Gt.compatConfig = { MODE: 3 }; function Tn() { return $(), V( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", fill: "currentColor", "aria-hidden": "true", class: "dp__icon", role: "img" }, [ ge("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" }), ge("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" }) ] ); } Tn.compatConfig = { MODE: 3 }; function Wa() { return $(), V( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", fill: "currentColor", "aria-hidden": "true", class: "dp__icon", role: "img" }, [ ge("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" }) ] ); } Wa.compatConfig = { MODE: 3 }; function Va() { return $(), V( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", fill: "currentColor", "aria-hidden": "true", class: "dp__icon", role: "img" }, [ ge("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" }) ] ); } Va.compatConfig = { MODE: 3 }; function ja() { return $(), V( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", fill: "currentColor", "aria-hidden": "true", class: "dp__icon", role: "img" }, [ ge("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" }), ge("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" }) ] ); } ja.compatConfig = { MODE: 3 }; function Ka() { return $(), V( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", fill: "currentColor", "aria-hidden": "true", class: "dp__icon", role: "img" }, [ ge("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" }) ] ); } Ka.compatConfig = { MODE: 3 }; function Ga() { return $(), V( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", fill: "currentColor", "aria-hidden": "true", class: "dp__icon", role: "img" }, [ ge("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" }) ] ); } Ga.compatConfig = { MODE: 3 }; const tt = (e, t) => t ? new Date(e.toLocaleString("en-US", { timeZone: t })) : new Date(e), Qa = (e, t, r) => { const a = La(e, t, r); return a || K(); }, kl = (e, t, r) => { const a = t.dateInTz ? tt(new Date(e), t.dateInTz) : K(e); return r ? je(a, !0) : a; }, La = (e, t, r) => { if (!e) return null; const a = r ? je(K(e), !0) : K(e); return t ? t.exactMatch ? kl(e, t, r) : tt(a, t.timezone) : a; }, wl = (e) => { const r = new Date(e.getFullYear(), 0, 1).getTimezoneOffset(); return e.getTimezoneOffset() < r; }, Dl = (e, t) => { if (!e) return 0; const r = /* @__PURE__ */ new Date(), a = new Date(r.toLocaleString("en-US", { timeZone: "UTC" })), n = new Date(r.toLocaleString("en-US", { timeZone: e })), c = (wl(t ?? n) ? n : t ?? n).getTimezoneOffset() / 60; return (+a - +n) / (1e3 * 60 * 60) - c; }; var ut = /* @__PURE__ */ ((e) => (e.month = "month", e.year = "year", e))(ut || {}), it = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(it || {}), _t = /* @__PURE__ */ ((e) => (e.header = "header", e.calendar = "calendar", e.timePicker = "timePicker", e))(_t || {}), qe = /* @__PURE__ */ ((e) => (e.month = "month", e.year = "year", e.calendar = "calendar", e.time = "time", e.minutes = "minutes", e.hours = "hours", e.seconds = "seconds", e))(qe || {}); const Ml = ["timestamp", "date", "iso"]; var Ze = /* @__PURE__ */ ((e) => (e.up = "up", e.down = "down", e.left = "left", e.right = "right", e))(Ze || {}), Oe = /* @__PURE__ */ ((e) => (e.arrowUp = "ArrowUp", e.arrowDown = "ArrowDown", e.arrowLeft = "ArrowLeft", e.arrowRight = "ArrowRight", e.enter = "Enter", e.space = " ", e.esc = "Escape", e.tab = "Tab", e.home = "Home", e.end = "End", e.pageUp = "PageUp", e.pageDown = "PageDown", e))(Oe || {}), zt = /* @__PURE__ */ ((e) => (e.MONTH_AND_YEAR = "MM-yyyy", e.YEAR = "yyyy", e.DATE = "dd-MM-yyyy", e))(zt || {}); function sn(e) { return (t) => { const r = new Intl.DateTimeFormat(e, { weekday: "short", timeZone: "UTC" }).format(/* @__PURE__ */ new Date(`2017-01-0${t}T00:00:00+00:00`)); return e === "ar" ? r.slice(2, 5) : r.slice(0, 2); }; } function $l(e) { return (t) => pt(tt(/* @__PURE__ */ new Date(`2017-01-0${t}T00:00:00+00:00`), "UTC"), "EEEEEE", { locale: e }); } const Al = (e, t, r) => { const a = [1, 2, 3, 4, 5, 6, 7]; let n; if (e !== null) try { n = a.map($l(e)); } catch { n = a.map(sn(t)); } else n = a.map(sn(t)); const u = n.slice(0, r), c = n.slice(r + 1, n.length); return [n[r]].concat(...c).concat(...u); }, qa = (e, t, r) => { const a = []; for (let n = +e[0]; n <= +e[1]; n++) a.push({ value: +n, text: Cn(n, t) }); return r ? a.reverse() : a; }, Sn = (e, t, r) => { const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((u) => { const c = u < 10 ? `0${u}` : u; return /* @__PURE__ */ new Date(`2017-${c}-01T00:00:00+00:00`); }); if (e !== null) try { const u = r === "long" ? "LLLL" : "LLL"; return a.map((c, p) => { const d = pt(tt(c, "UTC"), u, { locale: e }); return { text: d.charAt(0).toUpperCase() + d.substring(1), value: p }; }); } catch { } const n = new Intl.DateTimeFormat(t, { month: r, timeZone: "UTC" }); return a.map((u, c) => { const p = n.format(u); return { text: p.charAt(0).toUpperCase() + p.substring(1), value: c }; }); }, Tl = (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], He = (e) => { const t = s(e); return t != null && t.$el ? t == null ? void 0 : t.$el : t; }, Sl = (e) => ({ type: "dot", ...e ?? {} }), Pn = (e) => Array.isArray(e) ? !!e[0] && !!e[1] : !1, Xa = { prop: (e) => `"${e}" prop must be enabled!`, dateArr: (e) => `You need to use array as "model-value" binding in order to support "${e}"` }, ze = (e) => e, un = (e) => e === 0 ? e : !e || isNaN(+e) ? null : +e, dn = (e) => e === null, Rn = (e) => { if (e) return [...e.querySelectorAll("input, button, select, textarea, a[href]")][0]; }, Pl = (e) => { const t = [], r = (a) => a.filter((n) => n); for (let a = 0; a < e.length; a += 3) { const n = [e[a], e[a + 1], e[a + 2]]; t.push(r(n)); } return t; }, xt = (e, t, r) => { const a = r != null, n = t != null; if (!a && !n) return !1; const u = +r, c = +t; return a && n ? +e > u || +e < c : a ? +e > u : n ? +e < c : !1; }, Wt = (e, t) => Pl(e).map((r) => r.map((a) => { const { active: n, disabled: u, isBetween: c, highlighted: p } = t(a); return { ...a, active: n, disabled: u, className: { dp__overlay_cell_active: n, dp__overlay_cell: !n, dp__overlay_cell_disabled: u, dp__overlay_cell_pad: !0, dp__overlay_cell_active_disabled: u && n, dp__cell_in_between: c, "dp--highlighted": p } }; })), $t = (e, t, r = !1) => { e && t.allowStopPropagation && (r && e.stopImmediatePropagation(), e.stopPropagation()); }, Rl = () => [ "a[href]", "area[href]", "input:not([disabled]):not([type='hidden'])", "select:not([disabled])", "textarea:not([disabled])", "button:not([disabled])", "[tabindex]:not([tabindex='-1'])", "[data-datepicker-instance]" ].join(", "); function Cl(e, t) { let r = [...document.querySelectorAll(Rl())]; r = r.filter((n) => !e.contains(n) || n.hasAttribute("data-datepicker-instance")); const a = r.indexOf(e); if (a >= 0 && (t ? a - 1 >= 0 : a + 1 <= r.length)) return r[a + (t ? -1 : 1)]; } const Fa = (e, t) => e == null ? void 0 : e.querySelector(`[data-dp-element="${t}"]`), Cn = (e, t) => new Intl.NumberFormat(t, { useGrouping: !1, style: "decimal" }).format(e), Ja = (e, t) => pt(e, t ?? zt.DATE), Ta = (e) => Array.isArray(e), va = (e, t, r) => t.get(Ja(e, r)), Ol = (e, t) => e ? t ? t instanceof Map ? !!va(e, t) : t(K(e)) : !1 : !0, xe = (e, t, r = !1, a) => { if (e.key === Oe.enter || e.key === Oe.space) return r && e.preventDefault(), t(); if (a) return a(e); }, Bl = () => "ontouchstart" in window || navigator.maxTouchPoints > 0, On = (e, t) => e ? zt.MONTH_AND_YEAR : t ? zt.YEAR : zt.DATE, Bn = (e) => e < 10 ? `0${e}` : e, cn = (e, t, r, a, n, u) => { const c = Na(e, t.slice(0, e.length), /* @__PURE__ */ new Date(), { locale: u }); return ca(c) && il(c) ? a || n ? c : Re(c, { hours: +r.hours, minutes: +(r == null ? void 0 : r.minutes), seconds: +(r == null ? void 0 : r.seconds), milliseconds: 0 }) : null; }, _l = (e, t, r, a, n, u) => { const c = Array.isArray(r) ? r[0] : r; if (typeof t == "string") return cn(e, t, c, a, n, u); if (Array.isArray(t)) { let p = null; for (const d of t) if (p = cn(e, d, c, a, n, u), p) break; return p; } return typeof t == "function" ? t(e) : null; }, K = (e) => e ? new Date(e) : /* @__PURE__ */ new Date(), Yl = (e, t, r) => { if (t) { const n = (e.getMonth() + 1).toString().padStart(2, "0"), u = e.getDate().toString().padStart(2, "0"), c = e.getHours().toString().padStart(2, "0"), p = e.getMinutes().toString().padStart(2, "0"), d = r ? e.getSeconds().toString().padStart(2, "0") : "00"; return `${e.getFullYear()}-${n}-${u}T${c}:${p}:${d}.000Z`; } const a = Date.UTC( e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate(), e.getUTCHours(), e.getUTCMinutes(), e.getUTCSeconds() ); return new Date(a).toISOString(); }, je = (e, t) => { const r = K(JSON.parse(JSON.stringify(e))), a = Re(r, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }); return t ? rl(a) : a; }, At = (e, t, r, a) => { let n = e ? K(e) : K(); return (t || t === 0) && (n = sl(n, +t)), (r || r === 0) && (n = ul(n, +r)), (a || a === 0) && (n = kn(n, +a)), wn(n, 0); }, Ne = (e, t) => !e || !t ? !1 : Ht(je(e), je(t)), Te = (e, t) => !e || !t ? !1 : Ft(je(e), je(t)), Fe = (e, t) => !e || !t ? !1 : It(je(e), je(t)), ea = (e, t, r) => e != null && e[0] && (e != null && e[1]) ? Fe(r, e[0]) && Ne(r, e[1]) : e != null && e[0] && t ? Fe(r, e[0]) && Ne(r, t) || Ne(r, e[0]) && Fe(r, t) : !1, dt = (e) => { const t = Re(new Date(e), { date: 1 }); return je(t); }, Sa = (e, t, r) => t && (r || r === 0) ? Object.fromEntries( ["hours", "minutes", "seconds"].map((a) => a === t ? [a, r] : [a, isNaN(+e[a]) ? void 0 : +e[a]]) ) : { hours: isNaN(+e.hours) ? void 0 : +e.hours, minutes: isNaN(+e.minutes) ? void 0 : +e.minutes, seconds: isNaN(+e.seconds) ? void 0 : +e.seconds }, Yt = (e) => ({ hours: kt(e), minutes: Tt(e), seconds: Ut(e) }), _n = (e, t) => { if (t) { const r = ye(K(t)); if (r > e) return 12; if (r === e) return Ae(K(t)); } }, Yn = (e, t) => { if (t) { const r = ye(K(t)); return r < e ? -1 : r === e ? Ae(K(t)) : void 0; } }, Vt = (e) => { if (e) return ye(K(e)); }, In = (e, t) => { const r = Fe(e, t) ? t : e, a = Fe(t, e) ? t : e; return hn({ start: r, end: a }); }, Il = (e) => { const t = Bt(e, 1); return { month: Ae(t), year: ye(t) }; }, gt = (e, t) => { const r = Ua(e, { weekStartsOn: +t }), a = bn(e, { weekStartsOn: +t }); return [r, a]; }, En = (e, t) => { const r = { hours: kt(K()), minutes: Tt(K()), seconds: t ? Ut(K()) : 0 }; return Object.assign(r, e); }, Mt = (e, t, r) => [Re(K(e), { date: 1 }), Re(K(), { month: t, year: r, date: 1 })], ht = (e, t, r) => { let a = e ? K(e) : K(); return (t || t === 0) && (a = ol(a, t)), r && (a = mt(a, r)), a; }, Nn = (e, t, r, a, n) => { if (!a || n && !t || !n && !r) return !1; const u = n ? Bt(e, 1) : Zt(e, 1), c = [Ae(u), ye(u)]; return n ? !Nl(...c, t) : !El(...c, r); }, El = (e, t, r) => Ne(...Mt(r, e, t)) || Te(...Mt(r, e, t)), Nl = (e, t, r) => Fe(...Mt(r, e, t)) || Te(...Mt(r, e, t)), Ln = (e, t, r, a, n, u, c) => { if (typeof t == "function" && !c) return t(e); const p = r ? { locale: r } : void 0; return Array.isArray(e) ? `${pt(e[0], u, p)}${n && !e[1] ? "" : a}${e[1] ? pt(e[1], u, p) : ""}` : pt(e, u, p); }, Nt = (e) => { if (e) return null; throw new Error(Xa.prop("partial-range")); }, sa = (e, t) => { if (t) return e(); throw new Error(Xa.prop("range")); }, za = (e) => Array.isArray(e) ? ca(e[0]) && (e[1] ? ca(e[1]) : !0) : e ? ca(e) : !1, Ll = (e, t) => Re(t ?? K(), { hours: +e.hours || 0, minutes: +e.minutes || 0, seconds: +e.seconds || 0 }), Pa = (e, t, r, a) => { if (!e) return !0; if (a) { const n = r === "max" ? Ht(e, t) : It(e, t), u = { seconds: 0, milliseconds: 0 }; return n || Ft(Re(e, u), Re(t, u)); } return r === "max" ? e.getTime() <= t.getTime() : e.getTime() >= t.getTime(); }, Ra = (e, t, r) => e ? Ll(e, t) : K(r ?? t), fn = (e, t, r, a, n) => { if (Array.isArray(a)) { const c = Ra(e, a[0], t), p = Ra(e, a[1], t); return Pa(a[0], c, r, !!t) && Pa(a[1], p, r, !!t) && n; } const u = Ra(e, a, t); return Pa(a, u, r, !!t) && n; }, Ca = (e) => Re(K(), Yt(e)), Fl = (e, t, r) => { if (e instanceof Map) { const a = `${Bn(r + 1)}-${t}`; return e.size ? e.has(a) : !1; } return typeof e == "function" ? e(je(Re(K(), { month: r, year: t }), !0)) : !1; }, zl = (e, t, r) => { if (e instanceof Map) { const a = `${Bn(r + 1)}-${t}`; return e.size ? e.has(a) : !0; } return !0; }, Fn = (e, t, r) => typeof e == "function" ? e({ month: t, year: r }) : !!e.months.find((a) => a.month === t && a.year === r), Za = (e, t) => typeof e == "function" ? e(t) : e.years.includes(t), Ha = (e) => `dp-${pt(e, "yyyy-MM-dd")}`, vn = (e, t) => { const r = dl(je(t), e), a = Dt(je(t), e); return { before: r, after: a }; }, Qt = ta({ menuFocused: !1, shiftKeyInMenu: !1 }), zn = () => { const e = (a) => { Qt.menuFocused = a; }, t = (a) => { Qt.shiftKeyInMenu !== a && (Qt.shiftKeyInMenu = a); }; return { control: G(() => ({ shiftKeyInMenu: Qt.shiftKeyInMenu, menuFocused: Qt.menuFocused })), setMenuFocused: e, setShiftKey: t }; }, Ce = ta({ monthYear: [], calendar: [], time: [], actionRow: [], selectionGrid: [], timePicker: { 0: [], 1: [] }, monthPicker: [] }), Oa = J(null), ua = J(!1), Ba = J(!1), _a = J(!1), Ya = J(!1), Qe = J(0), Le = J(0), St = () => { const e = G(() => ua.value ? [...Ce.selectionGrid, Ce.actionRow].filter((h) => h.length) : Ba.value ? [ ...Ce.timePicker[0], ...Ce.timePicker[1], Ya.value ? [] : [Oa.value], Ce.actionRow ].filter((h) => h.length) : _a.value ? [...Ce.monthPicker, Ce.actionRow] : [Ce.monthYear, ...Ce.calendar, Ce.time, Ce.actionRow].filter((h) => h.length)), t = (h) => { Qe.value = h ? Qe.value + 1 : Qe.value - 1; let R = null; e.value[Le.value] && (R = e.value[Le.value][Qe.value]), !R && e.value[Le.value + (h ? 1 : -1)] ? (Le.value = Le.value + (h ? 1 : -1), Qe.value = h ? 0 : e.value[Le.value].length - 1) : R || (Qe.value = h ? Qe.value - 1 : Qe.value + 1); }, r = (h) => { if (Le.value === 0 && !h || Le.value === e.value.length && h) return; Le.value = h ? Le.value + 1 : Le.value - 1, e.value[Le.value] ? e.value[Le.value] && !e.value[Le.value][Qe.value] && Qe.value !== 0 && (Qe.value = e.value[Le.value].length - 1) : Le.value = h ? Le.value - 1 : Le.value + 1; }, a = (h) => { let R = null; e.value[Le.value] && (R = e.value[Le.value][Qe.value]), R ? R.focus({ preventScroll: !ua.value }) : Qe.value = h ? Qe.value - 1 : Qe.value + 1; }, n = () => { t(!0), a(!0); }, u = () => { t(!1), a(!1); }, c = () => { r(!1), a(!0); }, p = () => { r(!0), a(!0); }, d = (h, R) => { Ce[R] = h; }, Y = (h, R) => { Ce[R] = h; }, f = () => { Qe.value = 0, Le.value = 0; }; return { buildMatrix: d, buildMultiLevelMatrix: Y, setTimePickerBackRef: (h) => { Oa.value = h; }, setSelectionGrid: (h) => { ua.value = h, f(), h || (Ce.selectionGrid = []); }, setTimePicker: (h, R = !1) => { Ba.value = h, Ya.value = R, f(), h || (Ce.timePicker[0] = [], Ce.timePicker[1] = []); }, setTimePickerElements: (h, R = 0) => { Ce.timePicker[R] = h; }, arrowRight: n, arrowLeft: u, arrowUp: c, arrowDown: p, clearArrowNav: () => { Ce.monthYear = [], Ce.calendar = [], Ce.time = [], Ce.actionRow = [], Ce.selectionGrid = [], Ce.timePicker[0] = [], Ce.timePicker[1] = [], ua.value = !1, Ba.value = !1, Ya.value = !1, _a.value = !1, f(), Oa.value = null; }, setMonthPicker: (h) => { _a.value = h, f(); }, refSets: Ce // exposed for testing }; }, mn = (e) => ({ menuAppearTop: "dp-menu-appear-top", menuAppearBottom: "dp-menu-appear-bottom", open: "dp-slide-down", close: "dp-slide-up", next: "calendar-next", previous: "calendar-prev", vNext: "dp-slide-up", vPrevious: "dp-slide-down", ...e ?? {} }), Hl = (e) => ({ toggleOverlay: "Toggle overlay", menu: "Datepicker menu", input: "Datepicker input", openTimePicker: "Open time picker", closeTimePicker: "Close time Picker", incrementValue: (t) => `Increment ${t}`, decrementValue: (t) => `Decrement ${t}`, openTpOverlay: (t) => `Open ${t} overlay`, amPmButton: "Switch AM/PM mode", openYearsOverlay: "Open years overlay", openMonthsOverlay: "Open months overlay", nextMonth: "Next month", prevMonth: "Previous month", nextYear: "Next year", prevYear: "Previous year", day: void 0, weekDay: void 0, clearInput: "Clear value", calendarIcon: "Calendar icon", timePicker: "Time picker", monthPicker: (t) => `Month picker${t ? " overlay" : ""}`, yearPicker: (t) => `Year picker${t ? " overlay" : ""}`, timeOverlay: (t) => `${t} overlay`, ...e ?? {} }), pn = (e) => e ? typeof e == "boolean" ? e ? 2 : 0 : +e >= 2 ? +e : 2 : 0, Ul = (e) => { const t = typeof e == "object" && e, r = { static: !0, solo: !1 }; if (!e) return { ...r, count: pn(!1) }; const a = t ? e : {}, n = t ? a.count ?? !0 : e, u = pn(n); return Object.assign(r, a, { count: u }); }, Wl = (e, t, r) => e || (typeof r == "string" ? r : t), Vl = (e) => typeof e == "boolean" ? e ? mn({}) : !1 : mn(e), jl = (e) => { const t = { enterSubmit: !0, tabSubmit: !0, openMenu: "open", selectOnFocus: !1, rangeSeparator: " - ", escClose: !0 }; return typeof e == "object" ? { ...t, ...e ?? {}, enabled: !0 } : { ...t, enabled: e }; }, Kl = (e) => ({ months: [], years: [], times: { hours: [], minutes: [], seconds: [] }, ...e ?? {} }), Gl = (e) => ({ showSelect: !0, showCancel: !0, showNow: !1, showPreview: !0, ...e ?? {} }), Ql = (e) => { const t = { input: !1 }; return typeof e == "object" ? { ...t, ...e ?? {}, enabled: !0 } : { enabled: e, ...t }; }, ql = (e) => ({ ...{ allowStopPropagation: !0, closeOnScroll: !1, modeHeight: 255, allowPreventDefault: !1, closeOnClearValue: !0, closeOnAutoApply: !0, noSwipe: !1, keepActionRow: !1, onClickOutside: void 0, tabOutClosesMenu: !0, arrowLeft: void 0, keepViewOnOffsetClick: !1, timeArrowHoldThreshold: 0, shadowDom: !1, mobileBreakpoint: 600, setDateOnMenuClose: !1 }, ...e ?? {} }), Xl = (e) => { const t = { dates: Array.isArray(e) ? e.map((r) => K(r)) : [], years: [], months: [], quarters: [], weeks: [], weekdays: [], options: { highlightDisabled: !1 } }; return typeof e == "function" ? e : { ...t, ...e ?? {} }; }, Jl = (e) => typeof e == "object" ? { type: (e == null ? void 0 : e.type) ?? "local", hideOnOffsetDates: (e == null ? void 0 : e.hideOnOffsetDates) ?? !1 } : { type: e, hideOnOffsetDates: !1 }, Zl = (e) => { const t = { noDisabledRange: !1, showLastInRange: !0, minMaxRawRange: !1, partialRange: !0, disableTimeRangeValidation: !1, maxRange: void 0, minRange: void 0, autoRange: void 0, fixedStart: !1, fixedEnd: !1 }; return typeof e == "object" ? { enabled: !0, ...t, ...e } : { enabled: e, ...t }; }, xl = (e) => e ? typeof e == "string" ? { timezone: e, exactMatch: !1, dateInTz: void 0, emitTimezone: void 0, convertModel: !0 } : { timezone: e.timezone, exactMatch: e.exactMatch ?? !1, dateInTz: e.dateInTz ?? void 0, emitTimezone: e.emitTimezone ?? void 0, convertModel: e.convertModel ?? !0 } : { timezone: void 0, exactMatch: !1, emitTimezone: void 0 }, Ia = (e, t, r, a) => new Map( e.map((n) => { const u = Qa(n, t, a); return [Ja(u, r), u]; }) ), er = (e, t) => e.length ? new Map( e.map((r) => { const a = Qa(r.date, t); return [Ja(a, zt.DATE), r]; }) ) : null, tr = (e) => { var r; const t = On(e.isMonthPicker, e.isYearPicker); return { minDate: La(e.minDate, e.timezone, e.isSpecific), maxDate: La(e.maxDate, e.timezone, e.isSpecific), disabledDates: Ta(e.disabledDates) ? Ia(e.disabledDates, e.timezone, t, e.isSpecific) : e.disabledDates, allowedDates: Ta(e.allowedDates) ? Ia(e.allowedDates, e.timezone, t, e.isSpecific) : null, highlight: typeof e.highlight == "object" && Ta((r = e.highlight) == null ? void 0 : r.dates) ? Ia(e.highlight.dates, e.timezone, t) : e.highlight, markers: er(e.markers, e.timezone) }; }, ar = (e) => typeof e == "boolean" ? { enabled: e, dragSelect: !0, limit: null } : { enabled: !!e, limit: e.limit ? +e.limit : null, dragSelect: e.dragSelect ?? !0 }, nr = (e) => ({ ...Object.fromEntries( Object.keys(e).map((r) => { const a = r, n = e[a], u = typeof e[a] == "string" ? { [n]: !0 } : Object.fromEntries(n.map((c) => [c, !0])); return [r, u]; }) ) }), Ye = (e) => { const t = () => { const H = e.enableSeconds ? ":ss" : "", D = e.enableMinutes ? ":mm" : ""; return e.is24 ? `HH${D}${H}` : `hh${D}${H} aa`; }, r = () => { var H; return e.format ? e.format : e.monthPicker ? "MM/yyyy" : e.timePicker ? t() : e.weekPicker ? `${((H = _.value) == null ? void 0 : H.type) === "iso" ? "II" : "ww"}-RR` : e.yearPicker ? "yyyy" : e.quarterPicker ? "QQQ/yyyy" : e.enableTimePicker ? `MM/dd/yyyy, ${t()}` : "MM/dd/yyyy"; }, a = (H) => En(H, e.enableSeconds), n = () => j.value.enabled ? e.startTime && Array.isArray(e.startTime) ? [a(e.startTime[0]), a(e.startTime[1])] : null : e.startTime && !Array.isArray(e.startTime) ? a(e.startTime) : null, u = G(() => Ul(e.multiCalendars)), c = G(() => n()), p = G(() => Hl(e.ariaLabels)), d = G(() => Kl(e.filters)), Y = G(() => Vl(e.transitions)), f = G(() => Gl(e.actionRow)), O = G( () => Wl(e.previewFormat, e.format, r()) ), m = G(() => jl(e.textInput)), P = G(() => Ql(e.inline)), F = G(() => ql(e.config)), L = G(() => Xl(e.highlight)), _ = G(() => Jl(e.weekNumbers)), h = G(() => xl(e.timezone)), R = G(() => ar(e.multiDates)), b = G( () => tr({ minDate: e.minDate, maxDate: e.maxDate, disabledDates: e.disabledDates, allowedDates: e.allowedDates, highlight: L.value, markers: e.markers, timezone: h.value, isSpecific: e.monthPicker || e.yearPicker || e.quarterPicker, isMonthPicker: e.monthPicker, isYearPicker: e.yearPicker }) ), j = G(() => Zl(e.range)), z = G(() => nr(e.ui)); return { defaultedTransitions: Y, defaultedMultiCalendars: u, defaultedStartTime: c, defaultedAriaLabels: p, defaultedFilters: d, defaultedActionRow: f, defaultedPreviewFormat: O, defaultedTextInput: m, defaultedInline: P, defaultedConfig: F, defaultedHighlight: L, defaultedWeekNumbers: _, defaultedRange: j, propDates: b, defaultedTz: h, defaultedMultiDates: R, defaultedUI: z, getDefaultPattern: r, getDefaultStartTime: n, handleEventPropagation: (H) => { F.value.allowStopPropagation && H.stopPropagation(), F.value.allowPreventDefault && H.preventDefault(); } }; }, lr = (e, t, r) => { const a = J(), { defaultedTextInput: n, defaultedRange: u, defaultedTz: c, defaultedMultiDates: p, getDefaultPattern: d } = Ye(t), Y = J(""), f = Xt(t, "format"), O = Xt(t, "formatLocale"); st( a, () => { typeof t.onInternalModelChange == "function" && e("internal-model-change", a.value, T(!0)); }, { deep: !0 } ), st(u, (l, w) => { l.enabled !== w.enabled && (a.value = null); }), st(f, () => { U(); }); const m = (l) => c.value.timezone && c.value.convertModel ? tt(l, c.value.timezone) : l, P = (l) => { if (c.value.timezone && c.value.convertModel) { const w = Dl(c.value.timezone, l); return cl(l, w); } return l; }, F = (l, w, oe = !1) => Ln( l, t.format, t.formatLocale, n.value.rangeSeparator, t.modelAuto, w ?? d(), oe ), L = (l) => l ? t.modelType ? Z(l) : { hours: kt(l), minutes: Tt(l), seconds: t.enableSeconds ? Ut(l) : 0 } : null, _ = (l) => t.modelType ? Z(l) : { month: Ae(l), year: ye(l) }, h = (l) => Array.isArray(l) ? p.value.enabled ? l.map((w) => R(w, mt(K(), w))) : sa( () => [ mt(K(), l[0]), l[1] ? mt(K(), l[1]) : Nt(u.value.partialRange) ], u.value.enabled ) : mt(K(), +l), R = (l, w) => (typeof l == "string" || typeof l == "number") && t.modelType ? S(l) : w, b = (l) => Array.isArray(l) ? [ R( l[0], At(null, +l[0].hours, +l[0].minutes, l[0].seconds) ), R( l[1], At(null, +l[1].hours, +l[1].minutes, l[1].seconds) ) ] : R(l, At(null, l.hours, l.minutes, l.seconds)), j = (l) => { const w = Re(K(), { date: 1 }); return Array.isArray(l) ? p.value.enabled ? l.map((oe) => R(oe, ht(w, +oe.month, +oe.year))) : sa( () => [ R(l[0], ht(w, +l[0].month, +l[0].year)), R( l[1], l[1] ? ht(w, +l[1].month, +l[1].year) : Nt(u.value.partialRange) ) ], u.value.enabled ) : R(l, ht(w, +l.month, +l.year)); }, z = (l) => { if (Array.isArray(l)) return l.map((w) => S(w)); throw new Error(Xa.dateArr("multi-dates")); }, ae = (l) => { if (Array.isArray(l) && u.value.enabled) { const w = l[0], oe = l[1]; return [ K(Array.isArray(w) ? w[0] : null), Array.isArray(oe) && oe.length ? K(oe[0]) : null ]; } return K(l[0]); }, H = (l) => t.modelAuto ? Array.isArray(l) ? [S(l[0]), S(l[1])] : t.autoApply ? [S(l)] : [S(l), null] : Array.isArray(l) ? sa( () => l[1] ? [ S(l[0]), l[1] ? S(l[1]) : Nt(u.value.partialRange) ] : [S(l[0])], u.value.enabled ) : S(l), D = () => { Array.isArray(a.value) && u.value.enabled && a.value.length === 1 && a.value.push(Nt(u.value.partialRange)); }, Q = () => { const l = a.value; return [ Z(l[0]), l[1] ? Z(l[1]) : Nt(u.value.partialRange) ]; }, B = () => Array.isArray(a.value) ? a.value[1] ? Q() : Z(ze(a.value[0])) : [], q = () => (a.value || []).map((l) => Z(l)), ve = (l = !1) => (l || D(), t.modelAuto ? B() : p.value.enabled ? q() : Array.isArray(a.value) ? sa(() => Q(), u.value.enabled) : Z(ze(a.value))), pe = (l) => !l || Array.isArray(l) && !l.length ? null : t.timePicker ? b(ze(l)) : t.monthPicker ? j(ze(l)) : t.yearPicker ? h(ze(l)) : p.value.enabled ? z(ze(l)) : t.weekPicker ? ae(ze(l)) : H(ze(l)), v = (l) => { const w = pe(l); za(ze(w)) ? (a.value = ze(w), U()) : (a.value = null, Y.value = ""); }, N = () => { const l = (w) => pt(w, n.value.format); return `${l(a.value[0])} ${n.value.rangeSeparator} ${a.value[1] ? l(a.value[1]) : ""}`; }, ee = () => r.value && a.value ? Array.isArray(a.value) ? N() : pt(a.value, n.value.format) : F(a.value), y = () => a.value ? p.value.enabled ? a.value.map((l) => F(l)).join("; ") : n.value.enabled && typeof n.value.format == "string" ? ee() : F(a.value) : "", U = () => { !t.format || typeof t.format == "string" || n.value.enabled && typeof n.value.format == "string" ? Y.value = y() : Y.value = t.format(a.value); }, S = (l) => { if (t.utc) { const w = new Date(l); return t.utc === "preserve" ? new Date(w.getTime() + w.getTimezoneOffset() * 6e4) : w; } return t.modelType ? Ml.includes(t.modelType) ? m(new Date(l)) : t.modelType === "format" && (typeof t.format == "string" || !t.format) ? m( Na(l, d(), /* @__PURE__ */ new Date(), { locale: O.value }) ) : m( Na(l, t.modelType, /* @__PURE__ */ new Date(), { locale: O.value }) ) : m(new Date(l)); }, Z = (l) => l ? t.utc ? Yl(l, t.utc === "preserve", t.enableSeconds) : t.modelType ? t.modelType === "timestamp" ? +P(l) : t.modelType === "iso" ? P(l).toISOString() : t.modelType === "format" && (typeof t.format == "string" || !t.format) ? F(P(l)) : F(P(l), t.modelType, !0) : P(l) : "", A = (l, w = !1, oe = !1) => { if (oe) return l; if (e("update:model-value", l), c.value.emitTimezone && w) { const M = Array.isArray(l) ? l.map((he) => tt(ze(he), c.value.emitTimezone)) : tt(ze(l), c.value.emitTimezone); e("update:model-timezone-value", M); } }, ie = (l) => Array.isArray(a.value) ? p.value.enabled ? a.value.map((w) => l(w)) : [ l(a.value[0]), a.value[1] ? l(a.value[1]) : Nt(u.value.partialRange) ] : l(ze(a.value)), i = () => { if (Array.isArray(a.value)) { const l = gt(a.value[0], t.weekStart), w = a.value[1] ? gt(a.value[1], t.weekStart) : []; return [l.map((oe) => K(oe)), w.map((oe) => K(oe))]; } return gt(a.value, t.weekStart).map((l) => K(l)); }, W = (l, w) => A(ze(ie(l)), !1, w), se = (l) => { const w = i(); return l ? w : e("update:model-value", i()); }, T = (l = !1) => (l || U(), t.monthPicker ? W(_, l) : t.timePicker ? W(L, l) : t.yearPicker ? W(ye, l) : t.weekPicker ? se(l) : A(ve(l), !0, l)); return { inputValue: Y, internalModelValue: a, checkBeforeEmit: () => a.value ? u.value.enabled ? u.value.partialRange ? a.value.length >= 1 : a.value.length === 2 : !!a.value : !1, parseExternalModelValue: v, formatInputValue: U, emitModelValue: T }; }, rr = (e, t) => { const { defaultedFilters: r, propDates: a } = Ye(e), { validateMonthYearInRange: n } = Pt(e), u = (f, O) => { let m = f; return r.value.months.includes(Ae(m)) ? (m = O ? Bt(f, 1) : Zt(f, 1), u(m, O)) : m; }, c = (f, O) => { let m = f; return r.value.years.includes(ye(m)) ? (m = O ? Dn(f, 1) : Mn(f, 1), c(m, O)) : m; }, p = (f, O = !1) => { const m = Re(K(), { month: e.month, year: e.year }); let P = f ? Bt(m, 1) : Zt(m, 1); e.disableYearSelect && (P = mt(P, e.year)); let F = Ae(P), L = ye(P); r.value.months.includes(F) && (P = u(P, f), F = Ae(P), L = ye(P)), r.value.years.includes(L) && (P = c(P, f), L = ye(P)), n(F, L, f, e.preventMinMaxNavigation) && d(F, L, O); }, d = (f, O, m) => { t("update-month-year", { month: f, year: O, fromNav: m }); }, Y = G(() => (f) => Nn( Re(K(), { month: e.month, year: e.year }), a.value.maxDate, a.value.minDate, e.preventMinMaxNavigation, f )); return { handleMonthYearChange: p, isDisabled: Y, updateMonthYear: d }; }, pa = { multiCalendars: { type: [Boolean, Number, String, Object], default: void 0 }, modelValue: { type: [String, Date, Array, Object, Number], default: null }, modelType: { type: String, default: null }, position: { type: String, default: "center" }, dark: { type: Boolean, default: !1 }, format: { type: [String, Function], default: () => null }, autoPosition: { type: [Boolean, String], default: !0 }, altPosition: { type: Function, default: null }, transitions: { type: [Boolean, Object], default: !0 }, formatLocale: { type: Object, default: null }, utc: { type: [Boolean, String], default: !1 }, ariaLabels: { type: Object, default: () => ({}) }, offset: { type: [Number, String], default: 10 }, hideNavigation: { type: Array, default: () => [] }, timezone: { type: [String, Object], default: null }, vertical: { type: Boolean, default: !1 }, disableMonthYearSelect: { type: Boolean, default: !1 }, disableYearSelect: { type: Boolean, default: !1 }, dayClass: { type: Function, default: null }, yearRange: { type: Array, default: () => [1900, 2100] }, enableTimePicker: { type: Boolean, default: !0 }, autoApply: { type: Boolean, default: !1 }, disabledDates: { type: [Array, Function], default: () => [] }, monthNameFormat: { type: String, default: "short" }, startDate: { type: [Date, String], default: null }, startTime: { type: [Object, Array], default: null }, hideOffsetDates: { type: Boolean, default: !1 }, noToday: { type: Boolean, default: !1 }, disabledWeekDays: { type: Array, default: () => [] }, allowedDates: { type: Array, default: null }, nowButtonLabel: { type: String, default: "Now" }, markers: { type: Array, default: () => [] }, escClose: { type: Boolean, default: !0 }, spaceConfirm: { type: Boolean, default: !0 }, monthChangeOnArrows: { type: Boolean, default: !0 }, presetDates: { type: Array, default: () => [] }, flow: { type: Array, default: () => [] }, partialFlow: { type: Boolean, default: !1 }, preventMinMaxNavigation: { type: Boolean, default: !1 }, reverseYears: { type: Boolean, default: !1 }, weekPicker: { type: Boolean, default: !1 }, filters: { type: Object, default: () => ({}) }, arrowNavigation: { type: Boolean, default: !1 }, highlight: { type: [Function, Object], default: null }, teleport: { type: [Boolean, String, Object], default: null }, teleportCenter: { type: Boolean, default: !1 }, locale: { type: String, default: "en-Us" }, weekNumName: { type: String, default: "W" }, weekStart: { type: [Number, String], default: 1 }, weekNumbers: { type: [String, Function, Object], default: null }, monthChangeOnScroll: { type: [Boolean, String], default: !0 }, dayNames: { type: [Function, Array], default: null }, monthPicker: { type: Boolean, default: !1 }, customProps: { type: Object, default: null }, yearPicker: { type: Boolean, default: !1 }, modelAuto: { type: Boolean, default: !1 }, selectText: { type: String, default: "Select" }, cancelText: { type: String, default: "Cancel" }, previewFormat: { type: [String, Function], default: () => "" }, multiDates: { type: [Object, Boolean], default: !1 }, ignoreTimeValidation: { type: Boolean, default: !1 }, minDate: { type: [Date, String], default: null }, maxDate: { type: [Date, String], default: null }, minTime: { type: Object, default: null }, maxTime: { type: Object, default: null }, name: { type: String, default: null }, placeholder: { type: String, default: "" }, hideInputIcon: { type: Boolean, default: !1 }, clearable: { type: Boolean, default: !0 }, alwaysClearable: { type: Boolean, default: !1 }, state: { type: Boolean, default: null }, required: { type: Boolean, default: !1 }, autocomplete: { type: String, default: "off" }, timePicker: { type: Boolean, default: !1 }, enableSeconds: { type: Boolean, default: !1 }, is24: { type: Boolean, default: !0 }, noHoursOverlay: { type: Boolean, default: !1 }, noMinutesOverlay: { type: Boolean, default: !1 }, noSecondsOverlay: { type: Boolean, default: !1 }, hoursGridIncrement: { type: [String, Number], default: 1 }, minutesGridIncrement: { type: [String, Number], default: 5 }, secondsGridIncrement: { type: [String, Number], default: 5 }, hoursIncrement: { type: [Number, String], default: 1 }, minutesIncrement: { type: [Number, String], default: 1 }, secondsIncrement: { type: [Number, String], default: 1 }, range: { type: [Boolean, Object], default: !1 }, uid: { type: String, default: null }, disabled: { type: Boolean, default: !1 }, readonly: { type: Boolean, default: !1 }, inline: { type: [Boolean, Object], default: !1 }, textInput: { type: [Boolean, Object], default: !1 }, sixWeeks: { type: [Boolean, String], default: !1 }, actionRow: { type: Object, default: () => ({}) }, focusStartDate: { type: Boolean, default: !1 }, disabledTimes: { type: [Function, Array], default: void 0 }, timePickerInline: { type: Boolean, default: !1 }, calendar: { type: Function, default: null }, config: { type: Object, default: void 0 }, quarterPicker: { type: Boolean, default: !1 }, yearFirst: { type: Boolean, default: !1 }, loading: { type: Boolean, default: !1 }, onInternalModelChange: { type: [Function, Object], default: null }, enableMinutes: { type: Boolean, default: !0 }, ui: { type: Object, default: () => ({}) } }, ct = { ...pa, shadow: { type: Boolean, default: !1 }, flowStep: { type: Number, default: 0 }, internalModelValue: { type: [Date, Array], default: null }, noOverlayFocus: { type: Boolean, default: !1 }, collapse: { type: Boolean, default: !1 }, menuWrapRef: { type: Object, default: null }, getInputRect: { type: Function, default: () => ({}) }, isTextInputDate: { type: Boolean, default: !1 }, isMobile: { type: Boolean, default: void 0 } }, or = ["title"], sr = ["disabled"], ur = /* @__PURE__ */ Ke({ compatConfig: { MODE: 3 }, __name: "ActionRow", props: { menuMount: { type: Boolean, default: !1 }, calendarWidth: { type: Number, default: 0 }, ...ct }, emits: ["close-picker", "select-date", "select-now", "invalid-select"], setup(e, { emit: t }) { const r = t, a = e, { defaultedActionRow: n, defaultedPreviewFormat: u, defaultedMultiCalendars: c, defaultedTextInput: p, defaultedInline: d, defaultedRange: Y, defaultedMultiDates: f } = Ye(a), { isTimeValid: O, isMonthValid: m } = Pt(a), { buildMatrix: P } = St(), F = J(null), L = J(null), _ = J(!1), h = J({}), R = J(null), b = J(null); Ge(() => { a.arrowNavigation && P([He(F), He(L)], "actionRow"), j(), window.addEventListener("resize", j); }), jt(() => { window.removeEventListener("resize", j); }); const j = () => { _.value = !1, setTimeout(() => { var ee, y; const v = (ee = R.value) == null ? void 0 : ee.getBoundingClientRect(), N = (y = b.value) == null ? void 0 : y.getBoundingClientRect(); v && N && (h.value.maxWidth = `${N.width - v.width - 20}px`), _.value = !0; }, 0); }, z = G(() => Y.value.enabled && !Y.value.partialRange && a.internalModelValue ? a.internalModelValue.length === 2 : !0), ae = G( () => !O.value(a.internalModelValue) || !m.value(a.internalModelValue) || !z.value ), H = () => { const v = u.value; return a.timePicker || a.monthPicker, v(ze(a.internalModelValue)); }, D = () => { const v = a.internalModelValue; return c.value.count > 0 ? `${Q(v[0])} - ${Q(v[1])}` : [Q(v[0]), Q(v[1])]; }, Q = (v) => Ln( v, u.value, a.formatLocale, p.value.rangeSeparator, a.modelAuto, u.value ), B = G(() => !a.internalModelValue || !a.menuMount ? "" : typeof u.value == "string" ? Array.isArray(a.internalModelValue) ? a.internalModelValue.length === 2 && a.internalModelValue[1] ? D() : f.value.enabled ? a.internalModelValue.map((v) => `${Q(v)}`) : a.modelAuto ? `${Q(a.internalModelValue[0])}` : `${Q(a.internalModelValue[0])} -` : Q(a.internalModelValue) : H()), q = () => f.value.enabled ? "; " : " - ", ve = G( () => Array.isArray(B.value) ? B.value.join(q()) : B.value ), pe = () => { O.value(a.internalModelValue) && m.value(a.internalModelValue) && z.value ? r("select-date") : r("invalid-select"); }; return (v, N) => ($(), V("div", { ref_key: "actionRowRef", ref: b, class: "dp__action_row" }, [ v.$slots["action-row"] ? ue(v.$slots, "action-row", We(Ve({ key: 0 }, { internalModelValue: v.internalModelValue, disabled: ae.value, selectDate: () => v.$emit("select-date"), closePicker: () => v.$emit("close-picker") }))) : ($(), V(we, { key: 1 }, [ s(n).showPreview ? ($(), V("div", { key: 0, class: "dp__selection_preview", title: ve.value, style: ot(h.value) }, [ v.$slots["action-preview"] && _.value ? ue(v.$slots, "action-preview", { key: 0, value: v.internalModelValue }) : X("", !0), !v.$slots["action-preview"] && _.value ? ($(), V(we, { key: 1 }, [ bt(Xe(ve.value), 1) ], 64)) : X("", !0) ], 12, or)) : X("", !0), ge("div", { ref_key: "actionBtnContainer", ref: R, class: "dp__action_buttons", "data-dp-element": "action-row" }, [ v.$slots["action-buttons"] ? ue(v.$slots, "action-buttons", { key: 0, value: v.internalModelValue }) : X("", !0), v.$slots["action-buttons"] ? X("", !0) : ($(), V(we, { key: 1 }, [ !s(d).enabled && s(n).showCancel ? ($(), V("button", { key: 0, ref_key: "cancelButtonRef", ref: F, type: "button", class: "dp__action_button dp__action_cancel", onClick: N[0] || (N[0] = (ee) => v.$emit("close-picker")), onKeydown: N[1] || (N[1] = (ee) => s(xe)(ee, () => v.$emit("close-picker"))) }, Xe(v.cancelText), 545)) : X("", !0), s(n).showNow ? ($(), V("button", { key: 1, type: "button", class: "dp__action_button dp__action_cancel", onClick: N[2] || (N[2] = (ee) => v.$emit("select-now")), onKeydown: N[3] || (N[3] = (ee) => s(xe)(ee, () => v.$emit("select-now"))) }, Xe(v.nowButtonLabel), 33)) : X("", !0), s(n).showSelect ? ($(), V("button", { key: 2, ref_key: "selectButtonRef", ref: L, type: "button", class: "dp__action_button dp__action_select", disabled: ae.value, "data-test-id": "select-button", onKeydown: N[4] || (N[4] = (ee) => s(xe)(ee, () => pe())), onClick: pe }, Xe(v.selectText), 41, sr)) : X("", !0) ], 64)) ], 512) ], 64)) ], 512)); } }), ir = ["role", "aria-label", "tabindex"], dr = { class: "dp__selection_grid_header" }, cr = ["aria-selected", "aria-disabled", "data-test-id", "onClick", "onKeydown", "onMouseover"], fr = ["aria-label"], aa = /* @__PURE__ */ Ke({ __name: "SelectionOverlay", props: { items: {}, type: {}, isLast: { type: Boolean }, arrowNavigation: { type: Boolean }, skipButtonRef: { type: Boolean }, headerRefs: {}, hideNavigation: {}, escClose: { type: Boolean }, useRelative: { type: Boolean }, height: {}, textInput: { type: [Boolean, Object] }, config: {}, noOverlayFocus: { type: Boolean }, focusValue: {}, menuWrapRef: {}, ariaLabels: {}, overlayLabel: {} }, emits: ["selected", "toggle", "reset-flow", "hover-value"], setup(e, { expose: t, emit: r }) { const { setSelectionGrid: a, buildMultiLevelMatrix: n, setMonthPicker: u } = St(), c = r, p = e, { defaultedAriaLabels: d, defaultedTextInput: Y, defaultedConfig: f, handleEventPropagation: O } = Ye( p ), { hideNavigationButtons: m } = ha(), P = J(!1), F = J(null), L = J(null), _ = J([]), h = J(), R = J(null), b = J(0), j = J(null); Jn(() => { F.value = null; }), Ge(() => { lt().then(() => ve()), p.noOverlayFocus || ae(), z(!0); }), jt(() => z(!1)); const z = (i) => { var W; p.arrowNavigation && ((W = p.headerRefs) != null && W.length ? u(i) : a(i)); }, ae = () => { var W; const i = He(L); i && (Y.value.enabled || (F.value ? (W = F.value) == null || W.focus({ preventScroll: !0 }) : i.focus({ preventScroll: !0 })), P.value = i.clientHeight < i.scrollHeight); }, H = G( () => ({ dp__overlay: !0, "dp--overlay-absolute": !p.useRelative, "dp--overlay-relative": p.useRelative }) ), D = G( () => p.useRelative ? { height: `${p.height}px`, width: "var(--dp-menu-min-width)" } : void 0 ), Q = G(() => ({ dp__overlay_col: !0 })), B = G( () => ({ dp__btn: !0, dp__button: !0, dp__overlay_action: !0, dp__over_action_scroll: P.value, dp__button_bottom: p.isLast }) ), q = G(() => { var i, W; return { dp__overlay_container: !0, dp__container_flex: ((i = p.items) == null ? void 0 : i.length) <= 6, dp__container_block: ((W = p.items) == null ? void 0 : W.length) > 6 }; }); st( () => p.items, () => ve(!1), { deep: !0 } ); const ve = (i = !0) => { lt().then(() => { const W = He(F), se = He(L), T = He(R), re = He(j), l = T ? T.getBoundingClientRect().height : 0; se && (se.getBoundingClientRect().height ? b.value = se.getBoundingClientRect().height - l : b.value = f.value.modeHeight - l), W && re && i && (re.scrollTop = W.offsetTop - re.offsetTop - (b.value / 2 - W.getBoundingClientRect().height) - l); }); }, pe = (i) => { i.disabled || c("selected", i.value); }, v = () => { c("toggle"), c("reset-flow"); }, N = (i) => { p.escClose && (v(), O(i)); }, ee = (i, W, se, T) => { i && ((W.active || W.value === p.focusValue) && (F.value = i), p.arrowNavigation && (Array.isArray(_.value[se]) ? _.value[se][T] = i : _.value[se] = [i], y())); }, y = () => { var W, se; const i = (W = p.headerRefs) != null && W.length ? [p.headerRefs].concat(_.value) : _.value.concat([p.skipButtonRef ? [] : [R.value]]); n(ze(i), (se = p.headerRefs) != null && se.length ? "monthPicker" : "selectionGrid"); }, U = (i) => { p.arrowNavi