vue-cal 5.0.1-rc.17 → 5.0.1-rc.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { computed as $, reactive as $e, watch as me, toRefs as wt, ref as ie, onBeforeUnmount as Xe, inject as Ne, createElementBlock as O, openBlock as S, renderSlot as N, createCommentVNode as U, unref as V, Fragment as ne, renderList as be, normalizeClass as De, createElementVNode as ge, createVNode as Oe, Transition as Ge, withCtx as q, createBlock as Se, resolveDynamicComponent as Qe, mergeProps as ye, toHandlers as Ie, normalizeProps as se, guardReactiveProps as le, toDisplayString as re, normalizeStyle as ke, onMounted as qe, withModifiers as xe, nextTick as Ue, createTextVNode as et, TransitionGroup as tt, createSlots as je, useTemplateRef as _t, useId as kt, useAttrs as bt, provide as Tt } from "vue";
1
+ import { computed as M, reactive as $e, watch as me, toRefs as wt, ref as ue, onBeforeUnmount as Xe, inject as Ne, createElementBlock as j, openBlock as C, renderSlot as P, createCommentVNode as K, unref as V, Fragment as re, renderList as ke, normalizeClass as ye, createElementVNode as ge, createVNode as Oe, Transition as Ge, withCtx as J, createBlock as Se, resolveDynamicComponent as Qe, mergeProps as de, toHandlers as Be, normalizeProps as ee, toDisplayString as ie, normalizeStyle as _e, onMounted as qe, withModifiers as xe, nextTick as Ue, createTextVNode as et, TransitionGroup as tt, createSlots as je, useTemplateRef as _t, useId as kt, useAttrs as bt, provide as $t, guardReactiveProps as ae } from "vue";
2
2
  /**
3
- * vue-cal v5.0.1-rc.17
3
+ * vue-cal v5.0.1-rc.19
4
4
  * (c) 2024-2025 Antoni Andre <antoniandre.web@gmail.com>
5
5
  * @license MIT
6
6
  */
@@ -33,363 +33,366 @@ const fe = {
33
33
  years: { cols: 5, rows: 5 }
34
34
  // Arbitrary range of quarters of century (25y).
35
35
  }
36
- }, $t = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], Re = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], Mt = Re.reduce((D, n, r) => (D[n] = r || 7, D), {}), Yt = (D, n, r) => {
37
- const { dateUtils: h } = D, p = !1, b = $(() => {
38
- if (W.value[n.view]) return n.view;
39
- const s = n.datePicker ? "month" : "week", l = n.view || s;
40
- return W.value[l] ? l : (console.warn(
41
- `Vue Cal: the provided or default view \`${l}\` is either invalid or not in the list of available views. The first available view will be chosen: \`${Object.keys(W.value)[0]}\`.`
36
+ }, Tt = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], Re = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], Mt = Re.reduce((y, s, r) => (y[s] = r || 7, y), {}), Yt = (y, s, r) => {
37
+ const { dateUtils: d } = y, w = !1, b = M(() => {
38
+ if (W.value[s.view]) return s.view;
39
+ const l = s.datePicker ? "month" : "week", p = s.view || l;
40
+ return W.value[p] ? p : (console.warn(
41
+ `Vue Cal: the provided or default view \`${p}\` is either invalid or not in the list of available views. The first available view will be chosen: \`${Object.keys(W.value)[0]}\`.`
42
42
  ), Object.keys(W.value)[0]);
43
- }), H = $(() => n.sm && !n.xs), v = $(() => n.xs || n.datePicker), j = $(() => n.clickToNavigate || n.datePicker && n.clickToNavigate !== !1), i = $(() => {
44
- const s = {
43
+ }), H = M(() => s.sm && !s.xs), f = M(() => s.xs || s.datePicker), F = M(() => s.clickToNavigate || s.datePicker && s.clickToNavigate !== !1), u = M(() => {
44
+ const l = {
45
45
  cell: {},
46
46
  // All possible event listeners to attach to cells.
47
47
  event: {}
48
48
  // All possible event listeners to attach to calendar events.
49
- }, l = (_) => _.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
50
- for (const [_, t] of Object.entries(r)) {
51
- const [C, L, J] = _.match(/^on(Cell|Event)(.+)$/) || [];
52
- C && (s[L.toLowerCase()][l(J).replace(/^-+|-+$/g, "")] = t);
49
+ }, p = (k) => k.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
50
+ for (const [k, a] of Object.entries(r)) {
51
+ const [O, B, R] = k.match(/^on(Cell|Event)(.+)$/) || [];
52
+ O && (l[B.toLowerCase()][p(R).replace(/^-+|-+$/g, "")] = a);
53
53
  }
54
- return s;
55
- }), f = $(() => {
56
- var l;
57
- const s = {};
58
- return n.hideWeekends && (s[6] = !0) && (s[7] = !0), (l = n.hideWeekdays) != null && l.length && n.hideWeekdays.forEach((_) => s[Mt[_]] = !0), s;
59
- }), T = $(() => n.hideWeekends || f.value[6] && f.value[7]), W = $(() => {
60
- const s = n.datePicker;
61
- let l = 0, _ = {};
62
- const t = n.views;
63
- return s && !t ? {
54
+ return l;
55
+ }), m = M(() => {
56
+ var p;
57
+ const l = {};
58
+ return s.hideWeekends && (l[6] = !0) && (l[7] = !0), (p = s.hideWeekdays) != null && p.length && s.hideWeekdays.forEach((k) => l[Mt[k]] = !0), l;
59
+ }), Y = M(() => s.hideWeekends || m.value[6] && m.value[7]), W = M(() => {
60
+ const l = s.datePicker;
61
+ let p = 0, k = {};
62
+ const a = s.views;
63
+ return l && !a ? {
64
64
  month: { ...fe.availableViews.month },
65
65
  year: { ...fe.availableViews.year },
66
66
  years: { ...fe.availableViews.years }
67
- } : (t ? (Array.isArray(t) ? _ = t.reduce((C, L) => (typeof L == "string" && fe.availableViews[L] ? C[L] = fe.availableViews[L] : l++, C), {}) : typeof t == "object" && (_ = Object.entries(t).reduce((C, [L, J]) => {
68
- const { cols: Z, rows: ue } = fe.availableViews[L];
69
- return C[L] = { cols: J.cols || Z, rows: J.rows || ue }, C;
70
- }, {})), l && console.warn("Vue Cal: the provided `views` prop contains invalid views that will be ignored."), Object.keys(_).length || (console.warn("Vue Cal: No valid view in the provided `views` prop. Falling back to default views."), _ = { ...fe.availableViews })) : _ = { ...fe.availableViews }, _);
71
- }), R = $(() => n.datePicker ? "month" : W.value.week ? "week" : Object.keys(W.value)[0]), o = $(() => {
72
- if (typeof n.selectedDate == "string") return h.stringToDate(n.selectedDate);
73
- if (n.selectedDate instanceof Date) return n.selectedDate;
74
- n.selectedDate ? console.warn("Vue Cal: The provided selected date is invalid:", n.selectedDate) : console.log("Vue Cal: Info - The provided selected date is undefined.");
75
- }), c = $(() => {
76
- if (!n.disableDays) return [];
77
- const s = [];
78
- if (Array.isArray(n.disableDays))
79
- for (let l of n.disableDays) {
80
- let _ = l;
81
- typeof l == "string" ? _ = h.stringToDate(l) : l instanceof Date && (l = h.formatDate(l, "YYYY-MM-DD")), _ instanceof Date && !isNaN(_.getTime()) ? s.push(l) : console.warn("Vue Cal: The provided `disableDays` prop contains an invalid date:", l);
67
+ } : (a ? (Array.isArray(a) ? k = a.reduce((O, B) => (typeof B == "string" && fe.availableViews[B] ? O[B] = fe.availableViews[B] : p++, O), {}) : typeof a == "object" && (k = Object.entries(a).reduce((O, [B, R]) => {
68
+ const { cols: oe, rows: te } = fe.availableViews[B];
69
+ return O[B] = { cols: R.cols || oe, rows: R.rows || te }, O;
70
+ }, {})), p && console.warn("Vue Cal: the provided `views` prop contains invalid views that will be ignored."), Object.keys(k).length || (console.warn("Vue Cal: No valid view in the provided `views` prop. Falling back to default views."), k = { ...fe.availableViews })) : k = { ...fe.availableViews }, k);
71
+ }), q = M(() => s.datePicker ? "month" : W.value.week ? "week" : Object.keys(W.value)[0]), t = M(() => {
72
+ if (typeof s.selectedDate == "string") return d.stringToDate(s.selectedDate);
73
+ if (s.selectedDate instanceof Date) return s.selectedDate;
74
+ s.selectedDate ? console.warn("Vue Cal: The provided selected date is invalid:", s.selectedDate) : console.log("Vue Cal: Info - The provided selected date is undefined.");
75
+ }), o = M(() => {
76
+ if (!s.disableDays) return [];
77
+ const l = [];
78
+ if (Array.isArray(s.disableDays))
79
+ for (let p of s.disableDays) {
80
+ let k = p;
81
+ typeof p == "string" ? k = d.stringToDate(p) : p instanceof Date && (p = d.formatDate(p, "YYYY-MM-DD")), k instanceof Date && !isNaN(k.getTime()) ? l.push(p) : console.warn("Vue Cal: The provided `disableDays` prop contains an invalid date:", p);
82
82
  }
83
- else console.warn("Vue Cal: The provided `disableDays` prop is invalid:", n.disableDays);
84
- return s;
85
- }), e = $(() => {
86
- let s = null;
87
- return n.minDate && typeof n.minDate == "string" ? s = h.stringToDate(n.minDate) : n.minDate && n.minDate instanceof Date && (s = n.minDate), (s == null ? void 0 : s.getTime()) || null;
88
- }), m = $(() => {
89
- let s = null;
90
- return n.maxDate && typeof n.maxDate == "string" ? s = h.stringToDate(n.maxDate) : n.maxDate && n.maxDate instanceof Date && (s = n.maxDate), (s == null ? void 0 : s.getTime()) || null;
91
- }), g = $(() => {
92
- var _;
93
- const { view: s } = D;
94
- return n.schedules.length && (s.isDay || s.isDays || s.isWeek) && ((_ = n.schedules) == null ? void 0 : _.map((t, C) => ({ ...t, id: t.id ?? C + 1 }))) || void 0;
95
- }), M = $(() => {
96
- const s = {
83
+ else console.warn("Vue Cal: The provided `disableDays` prop is invalid:", s.disableDays);
84
+ return l;
85
+ }), e = M(() => {
86
+ let l = null;
87
+ return s.minDate && typeof s.minDate == "string" ? l = d.stringToDate(s.minDate) : s.minDate && s.minDate instanceof Date && (l = s.minDate), (l == null ? void 0 : l.getTime()) || null;
88
+ }), h = M(() => {
89
+ let l = null;
90
+ return s.maxDate && typeof s.maxDate == "string" ? l = d.stringToDate(s.maxDate) : s.maxDate && s.maxDate instanceof Date && (l = s.maxDate), (l == null ? void 0 : l.getTime()) || null;
91
+ }), c = M(() => {
92
+ var k;
93
+ const { view: l } = y;
94
+ return s.schedules.length && (l.isDay || l.isDays || l.isWeek) && ((k = s.schedules) == null ? void 0 : k.map((a, O) => ({ ...a, id: a.id ?? O + 1 }))) || void 0;
95
+ }), E = M(() => {
96
+ const l = {
97
97
  drag: !0,
98
98
  resize: !0,
99
99
  delete: !0,
100
100
  create: !0
101
101
  };
102
- return n.editableEvents === !0 ? s : n.editableEvents === !1 ? Object.keys(s).map((l) => s[l] = !1) : { ...s, ...n.editableEvents };
103
- }), P = async (s) => {
104
- var _;
105
- let l = /* @__PURE__ */ Object.assign({ "../i18n/ar.json": () => import("./i18n/ar.js").then((t) => t.default), "../i18n/bg.json": () => import("./i18n/bg.js").then((t) => t.default), "../i18n/bn.json": () => import("./i18n/bn.js").then((t) => t.default), "../i18n/bs.json": () => import("./i18n/bs.js").then((t) => t.default), "../i18n/ca.json": () => import("./i18n/ca.js").then((t) => t.default), "../i18n/cs.json": () => import("./i18n/cs.js").then((t) => t.default), "../i18n/da.json": () => import("./i18n/da.js").then((t) => t.default), "../i18n/de.json": () => import("./i18n/de.js").then((t) => t.default), "../i18n/el.json": () => import("./i18n/el.js").then((t) => t.default), "../i18n/en-gb.json": () => import("./i18n/en-gb.js").then((t) => t.default), "../i18n/en-us.json": () => Promise.resolve().then(() => Vt).then((t) => t.default), "../i18n/es.json": () => import("./i18n/es.js").then((t) => t.default), "../i18n/et.json": () => import("./i18n/et.js").then((t) => t.default), "../i18n/fa.json": () => import("./i18n/fa.js").then((t) => t.default), "../i18n/fi.json": () => import("./i18n/fi.js").then((t) => t.default), "../i18n/fr.json": () => import("./i18n/fr.js").then((t) => t.default), "../i18n/he.json": () => import("./i18n/he.js").then((t) => t.default), "../i18n/hr.json": () => import("./i18n/hr.js").then((t) => t.default), "../i18n/hu.json": () => import("./i18n/hu.js").then((t) => t.default), "../i18n/id.json": () => import("./i18n/id.js").then((t) => t.default), "../i18n/is.json": () => import("./i18n/is.js").then((t) => t.default), "../i18n/it.json": () => import("./i18n/it.js").then((t) => t.default), "../i18n/ja.json": () => import("./i18n/ja.js").then((t) => t.default), "../i18n/ka.json": () => import("./i18n/ka.js").then((t) => t.default), "../i18n/ko.json": () => import("./i18n/ko.js").then((t) => t.default), "../i18n/lt.json": () => import("./i18n/lt.js").then((t) => t.default), "../i18n/mn.json": () => import("./i18n/mn.js").then((t) => t.default), "../i18n/nl.json": () => import("./i18n/nl.js").then((t) => t.default), "../i18n/no.json": () => import("./i18n/no.js").then((t) => t.default), "../i18n/pl.json": () => import("./i18n/pl.js").then((t) => t.default), "../i18n/pt-br.json": () => import("./i18n/pt-br.js").then((t) => t.default), "../i18n/pt-pt.json": () => import("./i18n/pt-pt.js").then((t) => t.default), "../i18n/ro.json": () => import("./i18n/ro.js").then((t) => t.default), "../i18n/ru.json": () => import("./i18n/ru.js").then((t) => t.default), "../i18n/sk.json": () => import("./i18n/sk.js").then((t) => t.default), "../i18n/sl.json": () => import("./i18n/sl.js").then((t) => t.default), "../i18n/sq.json": () => import("./i18n/sq.js").then((t) => t.default), "../i18n/sr.json": () => import("./i18n/sr.js").then((t) => t.default), "../i18n/sv.json": () => import("./i18n/sv.js").then((t) => t.default), "../i18n/tr.json": () => import("./i18n/tr.js").then((t) => t.default), "../i18n/uk.json": () => import("./i18n/uk.js").then((t) => t.default), "../i18n/vi.json": () => import("./i18n/vi.js").then((t) => t.default), "../i18n/zh-cn.json": () => import("./i18n/zh-cn.js").then((t) => t.default), "../i18n/zh-hk.json": () => import("./i18n/zh-hk.js").then((t) => t.default) });
102
+ return s.editableEvents === !0 ? l : s.editableEvents === !1 ? Object.keys(l).map((p) => l[p] = !1) : { ...l, ...s.editableEvents };
103
+ }), L = M(() => {
104
+ const { view: l } = y, { eventCount: p } = s;
105
+ return (Array.isArray(p) ? p.includes(l.id) : p) && (l.isMonth && !s.eventsOnMonthView || l.isYear);
106
+ }), z = async (l) => {
107
+ var k;
108
+ let p = /* @__PURE__ */ Object.assign({ "../i18n/ar.json": () => import("./i18n/ar.js").then((a) => a.default), "../i18n/bg.json": () => import("./i18n/bg.js").then((a) => a.default), "../i18n/bn.json": () => import("./i18n/bn.js").then((a) => a.default), "../i18n/bs.json": () => import("./i18n/bs.js").then((a) => a.default), "../i18n/ca.json": () => import("./i18n/ca.js").then((a) => a.default), "../i18n/cs.json": () => import("./i18n/cs.js").then((a) => a.default), "../i18n/da.json": () => import("./i18n/da.js").then((a) => a.default), "../i18n/de.json": () => import("./i18n/de.js").then((a) => a.default), "../i18n/el.json": () => import("./i18n/el.js").then((a) => a.default), "../i18n/en-gb.json": () => import("./i18n/en-gb.js").then((a) => a.default), "../i18n/en-us.json": () => Promise.resolve().then(() => Vt).then((a) => a.default), "../i18n/es.json": () => import("./i18n/es.js").then((a) => a.default), "../i18n/et.json": () => import("./i18n/et.js").then((a) => a.default), "../i18n/fa.json": () => import("./i18n/fa.js").then((a) => a.default), "../i18n/fi.json": () => import("./i18n/fi.js").then((a) => a.default), "../i18n/fr.json": () => import("./i18n/fr.js").then((a) => a.default), "../i18n/he.json": () => import("./i18n/he.js").then((a) => a.default), "../i18n/hr.json": () => import("./i18n/hr.js").then((a) => a.default), "../i18n/hu.json": () => import("./i18n/hu.js").then((a) => a.default), "../i18n/id.json": () => import("./i18n/id.js").then((a) => a.default), "../i18n/is.json": () => import("./i18n/is.js").then((a) => a.default), "../i18n/it.json": () => import("./i18n/it.js").then((a) => a.default), "../i18n/ja.json": () => import("./i18n/ja.js").then((a) => a.default), "../i18n/ka.json": () => import("./i18n/ka.js").then((a) => a.default), "../i18n/ko.json": () => import("./i18n/ko.js").then((a) => a.default), "../i18n/lt.json": () => import("./i18n/lt.js").then((a) => a.default), "../i18n/mn.json": () => import("./i18n/mn.js").then((a) => a.default), "../i18n/nl.json": () => import("./i18n/nl.js").then((a) => a.default), "../i18n/no.json": () => import("./i18n/no.js").then((a) => a.default), "../i18n/pl.json": () => import("./i18n/pl.js").then((a) => a.default), "../i18n/pt-br.json": () => import("./i18n/pt-br.js").then((a) => a.default), "../i18n/pt-pt.json": () => import("./i18n/pt-pt.js").then((a) => a.default), "../i18n/ro.json": () => import("./i18n/ro.js").then((a) => a.default), "../i18n/ru.json": () => import("./i18n/ru.js").then((a) => a.default), "../i18n/sk.json": () => import("./i18n/sk.js").then((a) => a.default), "../i18n/sl.json": () => import("./i18n/sl.js").then((a) => a.default), "../i18n/sq.json": () => import("./i18n/sq.js").then((a) => a.default), "../i18n/sr.json": () => import("./i18n/sr.js").then((a) => a.default), "../i18n/sv.json": () => import("./i18n/sv.js").then((a) => a.default), "../i18n/tr.json": () => import("./i18n/tr.js").then((a) => a.default), "../i18n/uk.json": () => import("./i18n/uk.js").then((a) => a.default), "../i18n/vi.json": () => import("./i18n/vi.js").then((a) => a.default), "../i18n/zh-cn.json": () => import("./i18n/zh-cn.js").then((a) => a.default), "../i18n/zh-hk.json": () => import("./i18n/zh-hk.js").then((a) => a.default) });
106
109
  {
107
- if (!l[`../i18n/${s}.json`]) {
108
- console.warn(`Vue Cal: the locale \`${s}\` does not exist. Falling back to \`en-us\`.`), s = "en-us";
110
+ if (!p[`../i18n/${l}.json`]) {
111
+ console.warn(`Vue Cal: the locale \`${l}\` does not exist. Falling back to \`en-us\`.`), l = "en-us";
109
112
  return;
110
113
  }
111
- l = await ((_ = l[`../i18n/${s}.json`]) == null ? void 0 : _.call(l));
114
+ p = await ((k = p[`../i18n/${l}.json`]) == null ? void 0 : k.call(p));
112
115
  }
113
- D.texts = Object.assign(D.texts, Object.assign({ ...fe.texts }, l)), h.updateTexts(D.texts);
114
- }, A = $e(n.events || []);
115
- return me(() => n.events, (s) => A.splice(0, A.length, ...s)), me(() => n.locale, (s) => P(s || "en-us")), (n.locale || !D.texts.today) && P(n.locale || "en-us"), {
116
- ...wt(n),
117
- events: A,
116
+ y.texts = Object.assign(y.texts, Object.assign({ ...fe.texts }, p)), d.updateTexts(y.texts);
117
+ }, D = $e(s.events || []);
118
+ return me(() => s.events, (l) => D.splice(0, D.length, ...l)), me(() => s.locale, (l) => z(l || "en-us")), (s.locale || !y.texts.today) && z(s.locale || "en-us"), {
119
+ ...wt(s),
120
+ events: D,
118
121
  // All the events listeners for cells and events that the end user may have attached to vue-cal.
119
- eventListeners: i,
120
- defaultView: R,
122
+ eventListeners: u,
123
+ defaultView: q,
121
124
  availableViews: W,
122
- disableDays: c,
123
- ready: p,
125
+ disableDays: o,
126
+ ready: w,
124
127
  sm: H,
125
- xs: v,
126
- clickToNavigate: j,
127
- hideWeekdays: f,
128
- hideWeekends: T,
128
+ xs: f,
129
+ clickToNavigate: F,
130
+ hideWeekdays: m,
131
+ hideWeekends: Y,
129
132
  minTimestamp: e,
130
- maxTimestamp: m,
131
- schedules: g,
132
- selectedDate: o,
133
- editableEvents: M,
133
+ maxTimestamp: h,
134
+ schedules: c,
135
+ selectedDate: t,
136
+ editableEvents: E,
137
+ showCellEventCount: L,
134
138
  view: b,
135
139
  // Getters.
136
140
  get hasHiddenDays() {
137
- return Object.keys(f.value).length;
141
+ return Object.keys(m.value).length;
138
142
  },
139
143
  get size() {
140
- return v.value ? "xs" : H.value ? "sm" : "lg";
144
+ return f.value ? "xs" : H.value ? "sm" : "lg";
141
145
  },
142
- loadTexts: P
146
+ loadTexts: z
143
147
  };
144
- }, Ve = (D, n) => {
145
- const r = n.timeTo - n.timeFrom;
146
- return (D - n.timeFrom) * 100 / r;
147
- }, Pe = (D, n) => {
148
- const r = n.timeTo - n.timeFrom;
149
- return ~~(D * r / 100 + n.timeFrom);
150
- }, Ze = (D, n) => {
151
- const r = n.clientHeight;
152
- return D * 100 / r;
153
- }, Be = $e({ id: null, date: null });
148
+ }, Ve = (y, s) => {
149
+ const r = s.timeTo - s.timeFrom;
150
+ return (y - s.timeFrom) * 100 / r;
151
+ }, Fe = (y, s) => {
152
+ const r = s.timeTo - s.timeFrom;
153
+ return ~~(y * r / 100 + s.timeFrom);
154
+ }, Ze = (y, s) => {
155
+ const r = s.clientHeight;
156
+ return y * 100 / r;
157
+ }, Ie = $e({ id: null, date: null });
154
158
  let at = !1, Je = !0;
155
- const we = $e({ el: null, cell: null, timeout: null }), _e = $e({
159
+ const pe = $e({ el: null, cell: null, timeout: null }), we = $e({
156
160
  eventId: null,
157
161
  fromVueCal: null,
158
162
  toVueCal: null
159
163
  });
160
- function Et(D) {
161
- const { config: n, view: r, eventsManager: h, emit: p, uid: b, dateUtils: H } = D, v = (e) => {
164
+ function Et(y) {
165
+ const { config: s, view: r, eventsManager: d, emit: w, uid: b, dateUtils: H } = y, f = (e) => {
162
166
  var l;
163
- const { timeStep: m, timeCellHeight: g, timeFrom: M } = n, P = (((l = e.touches) == null ? void 0 : l[0]) || e).clientY, { top: A } = e.currentTarget.getBoundingClientRect(), s = P - A - ~~e.dataTransfer.getData("cursor-grab-at");
164
- return Pe(Ze(s, e.currentTarget), n);
165
- }, j = (e, m, g) => {
166
- const M = m.duration || i(m.start, m.end) || n.timeStep;
167
- let P = Math.max(v(e), 0);
168
- if (n.snapToInterval) {
169
- const _ = P + n.snapToInterval / 2;
170
- P = _ - _ % n.snapToInterval;
167
+ const { timeStep: h, timeCellHeight: c, timeFrom: E } = s, L = (((l = e.touches) == null ? void 0 : l[0]) || e).clientY, { top: z } = e.currentTarget.getBoundingClientRect(), D = L - z - ~~e.dataTransfer.getData("cursor-grab-at");
168
+ return Fe(Ze(D, e.currentTarget), s);
169
+ }, F = (e, h, c) => {
170
+ const E = h.duration || u(h.start, h.end) || s.timeStep;
171
+ let L = Math.max(f(e), 0);
172
+ if (s.snapToInterval) {
173
+ const p = L + s.snapToInterval / 2;
174
+ L = p - p % s.snapToInterval;
171
175
  }
172
- const A = new Date(new Date(g).setMinutes(P)), s = Math.min(P + M, 24 * 60), l = new Date(new Date(g).setMinutes(s));
173
- return { start: A, end: l };
174
- }, i = (e, m) => Math.round((m - e) / 6e4);
176
+ const z = new Date(new Date(c).setMinutes(L)), D = Math.min(L + E, 24 * 60), l = new Date(new Date(c).setMinutes(D));
177
+ return { start: z, end: l };
178
+ }, u = (e, h) => Math.round((h - e) / 6e4);
175
179
  return {
176
- eventDragStart: (e, m) => {
177
- if (e.target.nodeType === 3 || D.touch.isResizingEvent) return e.preventDefault();
180
+ eventDragStart: (e, h) => {
181
+ if (e.target.nodeType === 3 || y.touch.isResizingEvent) return e.preventDefault();
178
182
  e.dataTransfer.effectAllowed = "move", e.dataTransfer.dropEffect = "move";
179
- const g = { ...m, _: { id: m._.id, duration: i(m.start, m.end) } };
183
+ const c = { ...h, _: { id: h._.id, duration: u(h.start, h.end) } };
180
184
  try {
181
- e.dataTransfer.setData("text/plain", ""), e.dataTransfer.setData("event", JSON.stringify(g)), e.dataTransfer.setData("cursor-grab-at", e.offsetY);
182
- } catch (P) {
183
- return console.warn("Vue Cal: Failed to set drag data:", P), e.preventDefault();
185
+ e.dataTransfer.setData("text/plain", ""), e.dataTransfer.setData("event", JSON.stringify(c)), e.dataTransfer.setData("cursor-grab-at", e.offsetY);
186
+ } catch (L) {
187
+ return console.warn("Vue Cal: Failed to set drag data:", L), e.preventDefault();
184
188
  }
185
- _e.eventId = m._.id, _e.fromVueCal = b;
186
- const M = e.target.closest(".vuecal__event");
187
- M.classList.add("vuecal__event--dragging-ghost"), setTimeout(() => {
188
- M.classList.add("vuecal__event--dragging-original"), M.classList.remove("vuecal__event--dragging-ghost");
189
- }, 0), at = !1, Object.assign(Be, { id: r.id, date: r.firstCellDate }), Je = !0, D.touch.isDraggingEvent = !0;
189
+ we.eventId = h._.id, we.fromVueCal = b, w("event-drag-start", {
190
+ e,
191
+ event: h
192
+ });
193
+ const E = e.target.closest(".vuecal__event");
194
+ E.classList.add("vuecal__event--dragging-ghost"), setTimeout(() => {
195
+ E.classList.add("vuecal__event--dragging-original"), E.classList.remove("vuecal__event--dragging-ghost");
196
+ }, 0), at = !1, Object.assign(Ie, { id: r.id, date: r.firstCellDate }), Je = !0, y.touch.isDraggingEvent = !0;
190
197
  },
191
- eventDragEnd: (e, m) => {
192
- _e.eventId = null, e.target.closest(".vuecal__event").classList.remove("vuecal__event--dragging-original");
193
- const { fromVueCal: g, toVueCal: M } = _e;
194
- M && g !== M && h.deleteEvent(m._.id, 3), at && Je && Be.id && r.switchView(Be.id, Be.date, !0), p("event-drag-end", {
198
+ eventDragEnd: (e, h) => {
199
+ we.eventId = null, e.target.closest(".vuecal__event").classList.remove("vuecal__event--dragging-original");
200
+ const { fromVueCal: c, toVueCal: E } = we;
201
+ E && c !== E && d.deleteEvent(h._.id, 3), at && Je && Ie.id && r.switchView(Ie.id, Ie.date, !0), w("event-drag-end", {
195
202
  e,
196
- event: m,
197
- external: _e.fromVueCal !== b
198
- }), _e.fromVueCal = null, _e.toVueCal = null, D.touch.isDraggingEvent = !1;
203
+ event: h,
204
+ external: we.fromVueCal !== b
205
+ }), we.fromVueCal = null, we.toVueCal = null, y.touch.isDraggingEvent = !1;
199
206
  },
200
- cellDragEnter: (e, m) => {
201
- const { start: g } = m, M = e.currentTarget;
207
+ cellDragEnter: (e, h) => {
208
+ const { start: c } = h, E = e.currentTarget;
202
209
  if (!e.currentTarget.contains(e.relatedTarget)) {
203
- if (M === we.el || !M.className.includes("vuecal__cell-content")) return !1;
204
- we.el && (we.cell.highlighted = !1), Object.assign(we, { el: M, cell: m, timeout: clearTimeout(we.timeout) }), m.highlighted = !0, ["years", "year", "month"].includes(r.id) && (we.timeout = setTimeout(() => D.switchToNarrowerView(g), 2e3));
210
+ if (E === pe.el || !E.className.includes("vuecal__cell-content")) return !1;
211
+ pe.el && (pe.cell.highlighted = !1), Object.assign(pe, { el: E, cell: h, timeout: clearTimeout(pe.timeout) }), h.highlighted = !0, ["years", "year", "month"].includes(r.id) && (pe.timeout = setTimeout(() => y.switchToNarrowerView(c), 2e3));
205
212
  }
206
213
  },
207
- cellDragOver: (e, m) => {
208
- const { start: g, schedule: M } = m;
209
- e.preventDefault(), m.highlighted = !0, (M || M === 0) && (m.highlightedSchedule = M);
214
+ cellDragOver: (e, h) => {
215
+ const { start: c, schedule: E } = h;
216
+ e.preventDefault(), h.highlighted = !0, (E || E === 0) && (h.highlightedSchedule = E);
210
217
  },
211
- cellDragLeave: (e, m) => {
212
- e.preventDefault(), !e.currentTarget.contains(e.relatedTarget) && (m.highlightedSchedule = !1, we.cell === m && (clearTimeout(we.timeout), Object.assign(we, { el: null, cell: null, timeout: null }), m.highlighted = !1));
218
+ cellDragLeave: (e, h) => {
219
+ e.preventDefault(), !e.currentTarget.contains(e.relatedTarget) && (h.highlightedSchedule = !1, pe.cell === h && (clearTimeout(pe.timeout), Object.assign(pe, { el: null, cell: null, timeout: null }), h.highlighted = !1));
213
220
  },
214
- cellDragDrop: async (e, m) => {
215
- var C, L, J;
216
- e.preventDefault(), clearTimeout(we.timeout), Object.assign(we, { el: null, cell: null, timeout: null });
217
- const g = JSON.parse(e.dataTransfer.getData("event") || "{}");
218
- g.start && (g.start = new Date(g.start)), g.end && (g.end = new Date(g.end));
219
- let M;
220
- const { start: P, end: A } = j(e, g, m.start), { schedule: s } = ((C = e.target.closest("[data-schedule]")) == null ? void 0 : C.dataset) || {};
221
+ cellDragDrop: async (e, h) => {
222
+ var a, O, B;
223
+ e.preventDefault(), clearTimeout(pe.timeout), Object.assign(pe, { el: null, cell: null, timeout: null });
224
+ const c = JSON.parse(e.dataTransfer.getData("event") || "{}");
225
+ c.start && (c.start = new Date(c.start)), c.end && (c.end = new Date(c.end));
226
+ let E;
227
+ const { start: L, end: z } = F(e, c, h.start), { schedule: D } = ((a = e.target.closest("[data-schedule]")) == null ? void 0 : a.dataset) || {};
221
228
  let l = () => {
222
229
  };
223
- _e.fromVueCal === b ? (M = h.getEvent(g._.id), M && (M._.dragging = !1, l = () => {
224
- M.start = P, M.end = A, s !== void 0 && (M.schedule = ~~s);
225
- })) : (M = {
226
- ...g,
227
- start: P,
228
- end: A,
229
- ...s !== void 0 && { schedule: ~~s },
230
- _: { id: ((L = g._) == null ? void 0 : L.id) || g.id, duration: i(P, A) },
231
- getOverlappingEvents: () => h.getEventsInRange(
232
- h.getEventsByDate(H.formatDate(P), !0),
233
- { start: P, end: A },
234
- { schedule: ~~s }
235
- )
230
+ we.fromVueCal === b ? (E = d.getEvent(c._.id), E && (E._.dragging = !1, l = () => {
231
+ E.start = L, E.end = z, D !== void 0 && (E.schedule = ~~D);
232
+ })) : (E = {
233
+ ...c,
234
+ start: L,
235
+ end: z,
236
+ ...D !== void 0 && { schedule: ~~D },
237
+ _: { id: ((O = c._) == null ? void 0 : O.id) || c.id, duration: u(L, z) },
238
+ getOverlappingEvents: () => d.getEventsInRange(L, z, { schedule: ~~D })
236
239
  }, l = () => {
237
- M = h.createEvent(M);
240
+ E = d.createEvent(E);
238
241
  });
239
- let _ = !0;
240
- const { drop: t } = (J = n.eventListeners) == null ? void 0 : J.event;
241
- t && (_ = await t({
242
+ let p = !0;
243
+ const { drop: k } = (B = s.eventListeners) == null ? void 0 : B.event;
244
+ k && (p = await k({
242
245
  e,
243
- event: { ...M, start: P, end: A, schedule: ~~s },
244
- overlaps: M.getOverlappingEvents({ start: P, end: A, schedule: ~~s }),
245
- cell: m,
246
- external: _e.fromVueCal !== b
247
- })), _ !== !1 && l(), m.highlighted = !1, m.highlightedSchedule = null, Je = !1, _e.toVueCal = b, p("event-dropped", {
246
+ event: { ...E, start: L, end: z, schedule: ~~D },
247
+ overlaps: E.getOverlappingEvents({ start: L, end: z, schedule: ~~D }),
248
+ cell: h,
249
+ external: we.fromVueCal !== b
250
+ })), p !== !1 && l(), h.highlighted = !1, h.highlightedSchedule = null, Je = !1, we.toVueCal = b, w("event-dropped", {
248
251
  e,
249
- cell: m,
250
- event: M,
251
- originalEvent: g,
252
- external: _e.fromVueCal !== b
252
+ cell: h,
253
+ event: E,
254
+ originalEvent: c,
255
+ external: we.fromVueCal !== b
253
256
  });
254
257
  }
255
258
  };
256
259
  }
257
- const st = (D, n) => {
258
- let r, h, p, b = {}, H = {};
259
- const v = ie(D), j = () => {
260
- v.value.today || (v.value = n), Date.prototype.addDays = function(a) {
261
- return W(this, a || 0);
262
- }, Date.prototype.subtractDays = function(a) {
263
- return R(this, a || 0);
264
- }, Date.prototype.addHours = function(a) {
265
- return o(this, a || 0);
266
- }, Date.prototype.subtractHours = function(a) {
267
- return c(this, a || 0);
268
- }, Date.prototype.addMinutes = function(a) {
269
- return e(this, a || 0);
270
- }, Date.prototype.subtractMinutes = function(a) {
271
- return m(this, a || 0);
260
+ const st = (y, s) => {
261
+ let r, d, w, b = {}, H = {};
262
+ const f = ue(y), F = () => {
263
+ f.value.today || (f.value = s), Date.prototype.addDays = function(n) {
264
+ return W(this, n || 0);
265
+ }, Date.prototype.subtractDays = function(n) {
266
+ return q(this, n || 0);
267
+ }, Date.prototype.addHours = function(n) {
268
+ return t(this, n || 0);
269
+ }, Date.prototype.subtractHours = function(n) {
270
+ return o(this, n || 0);
271
+ }, Date.prototype.addMinutes = function(n) {
272
+ return e(this, n || 0);
273
+ }, Date.prototype.subtractMinutes = function(n) {
274
+ return h(this, n || 0);
272
275
  }, Date.prototype.getWeek = function() {
273
- return M(this);
276
+ return E(this);
274
277
  }, Date.prototype.isToday = function() {
275
- return P(this);
278
+ return L(this);
276
279
  }, Date.prototype.isLeapYear = function() {
277
280
  return l(this);
278
- }, Date.prototype.format = function(a = "YYYY-MM-DD") {
279
- return ue(this, a);
280
- }, Date.prototype.formatTime = function(a = "HH:mm") {
281
- return de(this, a);
281
+ }, Date.prototype.format = function(n = "YYYY-MM-DD") {
282
+ return oe(this, n);
283
+ }, Date.prototype.formatTime = function(n = "HH:mm") {
284
+ return se(this, n);
282
285
  };
283
- }, i = () => {
286
+ }, u = () => {
284
287
  delete Date.prototype.addDays, delete Date.prototype.subtractDays, delete Date.prototype.addHours, delete Date.prototype.subtractHours, delete Date.prototype.addMinutes, delete Date.prototype.subtractMinutes, delete Date.prototype.getWeek, delete Date.prototype.isToday, delete Date.prototype.isLeapYear, delete Date.prototype.format, delete Date.prototype.formatTime;
285
- }, f = (a) => {
286
- v.value = a, Date.prototype.subtractDays && j();
287
- }, T = () => (h !== (/* @__PURE__ */ new Date()).getDate() && (r = /* @__PURE__ */ new Date(), h = r.getDate(), p = `${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`), p), W = (a, w) => {
288
- const y = new Date(a.valueOf());
289
- return y.setDate(y.getDate() + w), y;
290
- }, R = (a, w) => {
291
- const y = new Date(a.valueOf());
292
- return y.setDate(y.getDate() - w), y;
293
- }, o = (a, w) => {
294
- const y = new Date(a.valueOf());
295
- return y.setHours(y.getHours() + w), y;
296
- }, c = (a, w) => {
297
- const y = new Date(a.valueOf());
298
- return y.setHours(y.getHours() - w), y;
299
- }, e = (a, w) => {
300
- const y = new Date(a.valueOf());
301
- return y.setMinutes(y.getMinutes() + w), y;
302
- }, m = (a, w) => {
303
- const y = new Date(a.valueOf());
304
- return y.setMinutes(y.getMinutes() - w), y;
305
- }, g = (a, w) => {
306
- const y = (B) => {
307
- const Q = B % w;
308
- return Q !== 0 && (B += Q >= w / 2 ? w - Q : -Q), B;
288
+ }, m = (n) => {
289
+ f.value = n, Date.prototype.subtractDays && F();
290
+ }, Y = () => (d !== (/* @__PURE__ */ new Date()).getDate() && (r = /* @__PURE__ */ new Date(), d = r.getDate(), w = `${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`), w), W = (n, _) => {
291
+ const g = new Date(n.valueOf());
292
+ return g.setDate(g.getDate() + _), g;
293
+ }, q = (n, _) => {
294
+ const g = new Date(n.valueOf());
295
+ return g.setDate(g.getDate() - _), g;
296
+ }, t = (n, _) => {
297
+ const g = new Date(n.valueOf());
298
+ return g.setHours(g.getHours() + _), g;
299
+ }, o = (n, _) => {
300
+ const g = new Date(n.valueOf());
301
+ return g.setHours(g.getHours() - _), g;
302
+ }, e = (n, _) => {
303
+ const g = new Date(n.valueOf());
304
+ return g.setMinutes(g.getMinutes() + _), g;
305
+ }, h = (n, _) => {
306
+ const g = new Date(n.valueOf());
307
+ return g.setMinutes(g.getMinutes() - _), g;
308
+ }, c = (n, _) => {
309
+ const g = (A) => {
310
+ const x = A % _;
311
+ return x !== 0 && (A += x >= _ / 2 ? _ - x : -x), A;
309
312
  };
310
- if (typeof a == "number") return y(a);
311
- if (a instanceof Date) {
312
- let B = y(a.getMinutes());
313
- B >= 60 && (a.setHours(a.getHours() + 1), B = 0), a.setMinutes(B, 0, 0);
313
+ if (typeof n == "number") return g(n);
314
+ if (n instanceof Date) {
315
+ let A = g(n.getMinutes());
316
+ A >= 60 && (n.setHours(n.getHours() + 1), A = 0), n.setMinutes(A, 0, 0);
314
317
  }
315
- }, M = (a, w = !1) => {
316
- const y = new Date(Date.UTC(a.getFullYear(), a.getMonth(), a.getDate())), B = y.getUTCDay() || 7;
317
- y.setUTCDate(y.getUTCDate() + 4 - B);
318
- const Q = new Date(Date.UTC(y.getUTCFullYear(), 0, 1));
319
- return Math.ceil(((y - Q) / 864e5 + 1) / 7) + (w ? 1 : 0);
320
- }, P = (a) => `${a.getFullYear()}-${a.getMonth()}-${a.getDate()}` === T(), A = (a, w) => {
321
- if (!a || !w) return console.warn(`Vue Cal: missing date${a ? "2" : "1"} parameter for comparison with \`isSameDate(date1, date2)\`.`);
322
- if (Z(a)) {
323
- if (!Z(w)) return console.warn(`Vue Cal: invalid date2 provided for comparison with \`isSameDate(date1, date2)\`: \`${w}\`.`);
324
- } else return console.warn(`Vue Cal: invalid date1 provided for comparison with \`isSameDate(date1, date2)\`: \`${a}\`.`);
325
- return a.getFullYear() === w.getFullYear() && a.getMonth() === w.getMonth() && a.getDate() === w.getDate();
326
- }, s = (a, w, y) => Z(a) ? a.getTime() >= w && a.getTime() <= y : console.warn(`Vue Cal: invalid date provided to \`isInRange(date, rangeStart, rangeEnd)\`: \`${a}\`.`), l = (a) => {
327
- const w = a.getFullYear();
328
- return !(w % 400) || w % 100 && !(w % 4);
329
- }, _ = (a = null, w) => {
330
- const y = a && new Date(a.valueOf()) || /* @__PURE__ */ new Date(), B = w ? 7 : 6;
331
- return y.setDate(y.getDate() - (y.getDay() + B) % 7), y;
332
- }, t = (a) => a instanceof Date ? a : (a.length === 10 && (a += " 00:00"), new Date(a.replace(/-/g, "/"))), C = (a) => a.getHours() * 60 + a.getMinutes(), L = (a, w) => {
333
- typeof a == "string" && (a = a.replace(/-/g, "/")), typeof w == "string" && (w = w.replace(/-/g, "/")), a = new Date(a).setHours(0, 0, 0, 0), w = new Date(w).setHours(0, 0, 1, 0);
334
- const y = (new Date(w).getTimezoneOffset() - new Date(a).getTimezoneOffset()) * 60 * 1e3;
335
- return Math.ceil((w - a - y) / (24 * 3600 * 1e3));
336
- }, J = (a, w, y) => Math.abs(a.getTime() - w.getTime()) <= y * 60 * 1e3, Z = (a) => a && a instanceof Date && !isNaN(a), ue = (a, w = "YYYY-MM-DD", y = null) => {
337
- if (y || (y = v.value), w || (w = "YYYY-MM-DD"), w === "YYYY-MM-DD") return ce(a);
318
+ }, E = (n, _ = !1) => {
319
+ const g = new Date(Date.UTC(n.getFullYear(), n.getMonth(), n.getDate())), A = g.getUTCDay() || 7;
320
+ g.setUTCDate(g.getUTCDate() + 4 - A);
321
+ const x = new Date(Date.UTC(g.getUTCFullYear(), 0, 1));
322
+ return Math.ceil(((g - x) / 864e5 + 1) / 7) + (_ ? 1 : 0);
323
+ }, L = (n) => `${n.getFullYear()}-${n.getMonth()}-${n.getDate()}` === Y(), z = (n, _) => {
324
+ if (!n || !_) return console.warn(`Vue Cal: missing date${n ? "2" : "1"} parameter for comparison with \`isSameDate(date1, date2)\`.`);
325
+ if (R(n)) {
326
+ if (!R(_)) return console.warn(`Vue Cal: invalid date2 provided for comparison with \`isSameDate(date1, date2)\`: \`${_}\`.`);
327
+ } else return console.warn(`Vue Cal: invalid date1 provided for comparison with \`isSameDate(date1, date2)\`: \`${n}\`.`);
328
+ return n.getFullYear() === _.getFullYear() && n.getMonth() === _.getMonth() && n.getDate() === _.getDate();
329
+ }, D = (n, _, g) => R(n) ? n.getTime() >= _ && n.getTime() <= g : console.warn(`Vue Cal: invalid date provided to \`isInRange(date, rangeStart, rangeEnd)\`: \`${n}\`.`), l = (n) => {
330
+ const _ = n.getFullYear();
331
+ return !(_ % 400) || _ % 100 && !(_ % 4);
332
+ }, p = (n = null, _) => {
333
+ const g = n && new Date(n.valueOf()) || /* @__PURE__ */ new Date(), A = _ ? 7 : 6;
334
+ return g.setDate(g.getDate() - (g.getDay() + A) % 7), g;
335
+ }, k = (n) => n instanceof Date ? n : (n.length === 10 && (n += " 00:00"), new Date(n.replace(/-/g, "/"))), a = (n) => n.getHours() * 60 + n.getMinutes(), O = (n, _) => {
336
+ typeof n == "string" && (n = n.replace(/-/g, "/")), typeof _ == "string" && (_ = _.replace(/-/g, "/")), n = new Date(n).setHours(0, 0, 0, 0), _ = new Date(_).setHours(0, 0, 1, 0);
337
+ const g = (new Date(_).getTimezoneOffset() - new Date(n).getTimezoneOffset()) * 60 * 1e3;
338
+ return Math.ceil((_ - n - g) / (24 * 3600 * 1e3));
339
+ }, B = (n, _, g) => Math.abs(n.getTime() - _.getTime()) <= g * 60 * 1e3, R = (n) => n && n instanceof Date && !isNaN(n), oe = (n, _ = "YYYY-MM-DD", g = null) => {
340
+ if (g || (g = f.value), _ || (_ = "YYYY-MM-DD"), _ === "YYYY-MM-DD") return te(n);
338
341
  b = {}, H = {};
339
- const B = {
340
- YYYY: () => ee(a, y).YYYY,
341
- YY: () => ee(a, y).YY(),
342
- M: () => ee(a, y).M,
343
- MM: () => ee(a, y).MM(),
344
- MMM: () => ee(a, y).MMM(),
345
- MMMM: () => ee(a, y).MMMM(),
346
- MMMMG: () => ee(a, y).MMMMG(),
347
- D: () => ee(a, y).D,
348
- DD: () => ee(a, y).DD(),
349
- S: () => ee(a, y).S(),
350
- d: () => ee(a, y).d,
351
- dd: () => ee(a, y).dd(),
352
- ddd: () => ee(a, y).ddd(),
353
- dddd: () => ee(a, y).dddd(),
354
- HH: () => x(a, y).HH,
355
- H: () => x(a, y).H,
356
- hh: () => x(a, y).hh,
357
- h: () => x(a, y).h,
358
- am: () => x(a, y).am,
359
- AM: () => x(a, y).AM,
360
- mm: () => x(a, y).mm,
361
- m: () => x(a, y).m,
362
- s: () => x(a, y).s
342
+ const A = {
343
+ YYYY: () => Q(n, g).YYYY,
344
+ YY: () => Q(n, g).YY(),
345
+ M: () => Q(n, g).M,
346
+ MM: () => Q(n, g).MM(),
347
+ MMM: () => Q(n, g).MMM(),
348
+ MMMM: () => Q(n, g).MMMM(),
349
+ MMMMG: () => Q(n, g).MMMMG(),
350
+ D: () => Q(n, g).D,
351
+ DD: () => Q(n, g).DD(),
352
+ S: () => Q(n, g).S(),
353
+ d: () => Q(n, g).d,
354
+ dd: () => Q(n, g).dd(),
355
+ ddd: () => Q(n, g).ddd(),
356
+ dddd: () => Q(n, g).dddd(),
357
+ HH: () => le(n, g).HH,
358
+ H: () => le(n, g).H,
359
+ hh: () => le(n, g).hh,
360
+ h: () => le(n, g).h,
361
+ am: () => le(n, g).am,
362
+ AM: () => le(n, g).AM,
363
+ mm: () => le(n, g).mm,
364
+ m: () => le(n, g).m,
365
+ s: () => le(n, g).s
363
366
  };
364
- return w.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (Q, he) => {
365
- const te = B[he.replace(/\{|\}/g, "")];
366
- return te !== void 0 ? te() : he;
367
+ return _.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (x, he) => {
368
+ const i = A[he.replace(/\{|\}/g, "")];
369
+ return i !== void 0 ? i() : he;
367
370
  });
368
- }, ce = (a) => {
369
- const w = a.getMonth() + 1, y = a.getDate();
370
- return `${a.getFullYear()}-${w < 10 ? "0" : ""}${w}-${y < 10 ? "0" : ""}${y}`;
371
- }, de = (a, w = "HH:mm", y = null, B = !1) => {
372
- let Q = !1;
373
- if (B) {
374
- const [u, k, E] = [a.getHours(), a.getMinutes(), a.getSeconds()];
375
- u + k + E === 141 && (Q = !0);
371
+ }, te = (n) => {
372
+ const _ = n.getMonth() + 1, g = n.getDate();
373
+ return `${n.getFullYear()}-${_ < 10 ? "0" : ""}${_}-${g < 10 ? "0" : ""}${g}`;
374
+ }, se = (n, _ = "HH:mm", g = null, A = !1) => {
375
+ let x = !1;
376
+ if (A) {
377
+ const [T, S, $] = [n.getHours(), n.getMinutes(), n.getSeconds()];
378
+ T + S + $ === 141 && (x = !0);
376
379
  }
377
- if (a instanceof Date && w === "HH:mm") return Q ? "24:00" : pe(a);
378
- H = {}, y || (y = v.value);
379
- const he = x(a, y), te = w.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (u, k) => {
380
- const E = he[k.replace(/\{|\}/g, "")];
381
- return E !== void 0 ? E : k;
380
+ if (n instanceof Date && _ === "HH:mm") return x ? "24:00" : ce(n);
381
+ H = {}, g || (g = f.value);
382
+ const he = le(n, g), i = _.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g, (T, S) => {
383
+ const $ = he[S.replace(/\{|\}/g, "")];
384
+ return $ !== void 0 ? $ : S;
382
385
  });
383
- return Q ? te.replace("23:59", "24:00") : te;
384
- }, pe = (a) => {
385
- const w = a.getHours(), y = a.getMinutes();
386
- return `${(w < 10 ? "0" : "") + w}:${(y < 10 ? "0" : "") + y}`;
387
- }, oe = (a) => {
388
- const w = Math.floor(a / 60).toString().padStart(2, 0), y = (a % 60).toString().padStart(2, 0);
389
- return `${w}:${y}`;
390
- }, K = (a) => {
391
- if (a > 3 && a < 21) return "th";
392
- switch (a % 10) {
386
+ return x ? i.replace("23:59", "24:00") : i;
387
+ }, ce = (n) => {
388
+ const _ = n.getHours(), g = n.getMinutes();
389
+ return `${(_ < 10 ? "0" : "") + _}:${(g < 10 ? "0" : "") + g}`;
390
+ }, X = (n) => {
391
+ const _ = Math.floor(n / 60).toString().padStart(2, 0), g = (n % 60).toString().padStart(2, 0);
392
+ return `${_}:${g}`;
393
+ }, Ee = (n) => {
394
+ if (n > 3 && n < 21) return "th";
395
+ switch (n % 10) {
393
396
  case 1:
394
397
  return "st";
395
398
  case 2:
@@ -399,94 +402,97 @@ const st = (D, n) => {
399
402
  default:
400
403
  return "th";
401
404
  }
402
- }, ee = (a, w) => {
405
+ }, Q = (n, _) => {
403
406
  if (b.D) return b;
404
- const y = a.getFullYear(), B = a.getMonth() + 1, Q = a.getDate(), te = (a.getDay() - 1 + 7) % 7;
407
+ const g = n.getFullYear(), A = n.getMonth() + 1, x = n.getDate(), i = (n.getDay() - 1 + 7) % 7;
405
408
  return b = {
406
409
  // Year.
407
- YYYY: y,
410
+ YYYY: g,
408
411
  // 2024.
409
- YY: () => y.toString().substring(2),
412
+ YY: () => g.toString().substring(2),
410
413
  // 24.
411
414
  // Month.
412
- M: B,
415
+ M: A,
413
416
  // 1 to 12.
414
- MM: () => B.toString().padStart(2, 0),
417
+ MM: () => A.toString().padStart(2, 0),
415
418
  // 01 to 12.
416
- MMM: () => w.months[B - 1].substring(0, 3),
419
+ MMM: () => _.months[A - 1].substring(0, 3),
417
420
  // Jan to Dec.
418
- MMMM: () => w.months[B - 1],
421
+ MMMM: () => _.months[A - 1],
419
422
  // January to December.
420
- MMMMG: () => (w.monthsGenitive || w.months)[B - 1],
423
+ MMMMG: () => (_.monthsGenitive || _.months)[A - 1],
421
424
  // January to December in genitive form (Greek...)
422
425
  // Day.
423
- D: Q,
426
+ D: x,
424
427
  // 1 to 31.
425
- DD: () => Q.toString().padStart(2, 0),
428
+ DD: () => x.toString().padStart(2, 0),
426
429
  // 01 to 31.
427
- S: () => K(Q),
430
+ S: () => Ee(x),
428
431
  // st, nd, rd, th.
429
432
  // Day of the week.
430
- d: te + 1,
433
+ d: i + 1,
431
434
  // 1 to 7 with 7 = Sunday.
432
435
  // Some locales have same start for all the days, so they have specific abbrev in weekDaysShort.
433
- dd: () => w.weekDaysShort.length ? w.weekDaysShort[te] : w.weekDays[te][0],
436
+ dd: () => _.weekDaysShort.length ? _.weekDaysShort[i] : _.weekDays[i][0],
434
437
  // M to S.
435
- ddd: () => w.weekDaysShort.length ? w.weekDaysShort[te] : w.weekDays[te].substr(0, 3),
438
+ ddd: () => _.weekDaysShort.length ? _.weekDaysShort[i] : _.weekDays[i].substr(0, 3),
436
439
  // Mon to Sun.
437
- dddd: () => w.weekDays[te]
440
+ dddd: () => _.weekDays[i]
438
441
  // Monday to Sunday.
439
442
  }, b;
440
- }, x = (a, w) => {
443
+ }, le = (n, _) => {
441
444
  if (H.am) return H;
442
- let y, B, Q;
443
- a instanceof Date ? (y = a.getHours(), B = a.getMinutes(), Q = a.getSeconds()) : (y = Math.floor(a / 60), B = Math.floor(a % 60));
444
- const he = y % 12 ? y % 12 : 12, te = (w || { am: "am", pm: "pm" })[y === 24 || y < 12 ? "am" : "pm"];
445
+ let g, A, x;
446
+ n instanceof Date ? (g = n.getHours(), A = n.getMinutes(), x = n.getSeconds()) : (g = Math.floor(n / 60), A = Math.floor(n % 60));
447
+ const he = g % 12 ? g % 12 : 12, i = (_ || { am: "am", pm: "pm" })[g === 24 || g < 12 ? "am" : "pm"];
445
448
  return H = {
446
- H: y,
449
+ H: g,
447
450
  h: he,
448
- HH: y.toString().padStart(2, 0),
451
+ HH: g.toString().padStart(2, 0),
449
452
  hh: he.toString().padStart(2, 0),
450
- am: te,
451
- AM: te.toUpperCase(),
452
- m: B,
453
- mm: B.toString().padStart(2, 0),
454
- s: Q
453
+ am: i,
454
+ AM: i.toUpperCase(),
455
+ m: A,
456
+ mm: A.toString().padStart(2, 0),
457
+ s: x
455
458
  }, H;
456
459
  };
457
460
  return {
458
- addDatePrototypes: j,
459
- removeDatePrototypes: i,
460
- updateTexts: f,
461
+ addDatePrototypes: F,
462
+ removeDatePrototypes: u,
463
+ updateTexts: m,
461
464
  addDays: W,
462
- subtractDays: R,
463
- addHours: o,
464
- subtractHours: c,
465
+ subtractDays: q,
466
+ addHours: t,
467
+ subtractHours: o,
465
468
  addMinutes: e,
466
- subtractMinutes: m,
467
- snapToInterval: g,
468
- getWeek: M,
469
- isToday: P,
470
- isSameDate: A,
471
- isInRange: s,
469
+ subtractMinutes: h,
470
+ snapToInterval: c,
471
+ getWeek: E,
472
+ isToday: L,
473
+ isSameDate: z,
474
+ isInRange: D,
472
475
  isLeapYear: l,
473
- getPreviousFirstDayOfWeek: _,
474
- stringToDate: t,
475
- dateToMinutes: C,
476
- countDays: L,
477
- datesInSameTimeStep: J,
478
- isValid: Z,
479
- formatDate: ue,
480
- formatDateLite: ce,
481
- formatTime: de,
482
- formatTimeLite: pe,
483
- formatMinutes: oe
476
+ getPreviousFirstDayOfWeek: p,
477
+ stringToDate: k,
478
+ dateToMinutes: a,
479
+ countDays: O,
480
+ datesInSameTimeStep: B,
481
+ isValid: R,
482
+ formatDate: oe,
483
+ formatDateLite: te,
484
+ formatTime: se,
485
+ formatTimeLite: ce,
486
+ formatMinutes: X
484
487
  };
485
- }, St = (D) => {
486
- const { dateUtils: n, config: r } = D;
487
- let h = 0;
488
- const p = $(() => {
489
- const o = {
488
+ }, St = (y) => {
489
+ const { dateUtils: s, config: r } = y;
490
+ let d = 0;
491
+ const w = M(() => {
492
+ const t = {
493
+ // A map of events indexed by { YYYY: { MM: { DD: [] } } }.
494
+ // Each year contains a map of 12 months starting from 1, each containing a map of days starting from 1, each containing an array of event IDs.
495
+ byYear: {},
490
496
  byDate: {},
491
497
  // A map of single-day events indexed by date.
492
498
  recurring: [],
@@ -494,434 +500,454 @@ const st = (D, n) => {
494
500
  multiday: [],
495
501
  // An array of events IDs that are multiday.
496
502
  byId: {}
497
- // A map of all the events indexed by ID for fast lookup.
498
- }, c = r.events.sort((e, m) => e.start - m.start < 0 ? -1 : 1);
499
- for (const e of c)
500
- b(e), e._ || (e._ = {}), e._.id = e._.id || ++h, e.delete || (e.delete = (m) => f(e._.id, m)), e._.deleting = !1, e._.deleted = !1, e.isOverlapping = (m = null) => e.getOverlappingEvents(m).length, e.getOverlappingEvents = (m = null) => {
501
- var g;
502
- return W(
503
- v(n.formatDate((m == null ? void 0 : m.start) || e.start), !0),
504
- { start: (m == null ? void 0 : m.start) || e.start, end: (m == null ? void 0 : m.end) || e.end },
505
- { excludeIds: [e._.id], schedule: (g = r.schedules) != null && g.length ? ~~((m == null ? void 0 : m.schedule) || e.schedule) : null }
506
- );
507
- }, e._.register = (m) => {
508
- e._.$el = m, e._.fireCreated && (D.emit("event-created", e), delete e._.fireCreated);
509
- }, e._.unregister = () => {
510
- e._.$el = null, e._.register = null, e.isOverlapping = null, e.getOverlappingEvents = null, e.delete = null;
511
- }, o.byId[e._.id] = e, e.recurring ? o.recurring.push(e._.id) : e._.multiday ? (o.multiday.push(e._.id), o.byDate[e._.startFormatted] || (o.byDate[e._.startFormatted] = []), o.byDate[e._.startFormatted].push(e._.id)) : (o.byDate[e._.startFormatted] || (o.byDate[e._.startFormatted] = []), o.byDate[e._.startFormatted].push(e._.id));
512
- return o;
513
- }), b = (o) => {
514
- if (typeof o.start == "string" && (o.start = n.stringToDate(o.start)), typeof o.end == "string" && (o.end = n.stringToDate(o.end)), o.start.setSeconds(0, 0), o.end.setSeconds(0, 0), isNaN(o.start) || isNaN(o.end)) {
515
- isNaN(o.start) ? console.error(`Vue Cal: invalid start date for event "${o.title}".`, o.start) : console.error(`Vue Cal: invalid end date for event "${o.title}".`, o.end);
503
+ // A map of all the events indexed by ID for fast lookup. Each event is the original full event object.
504
+ }, o = r.events.sort((e, h) => e.start - h.start < 0 ? -1 : 1);
505
+ for (const e of o)
506
+ if (b(e), H(e), t.byId[e._.id] = e, e.recurring)
507
+ t.recurring.push(e._.id);
508
+ else if (e._.multiday)
509
+ t.multiday.push(e._.id), t.byDate[e._.startFormatted] || (t.byDate[e._.startFormatted] = []), t.byDate[e._.startFormatted].push(e._.id);
510
+ else {
511
+ t.byDate[e._.startFormatted] || (t.byDate[e._.startFormatted] = []), t.byDate[e._.startFormatted].push(e._.id);
512
+ const h = e._.startFormatted.substring(0, 4), c = e._.startFormatted.substring(5, 7), E = e._.startFormatted.substring(8, 10);
513
+ t.byYear[h] || (t.byYear[h] = {}), t.byYear[h][c] || (t.byYear[h][c] = {}), t.byYear[h][c][E] || (t.byYear[h][c][E] = []), t.byYear[h][c][E].push(e._.id);
514
+ }
515
+ return t;
516
+ }), b = (t) => {
517
+ if (typeof t.start == "string" && (t.start = s.stringToDate(t.start)), typeof t.end == "string" && (t.end = s.stringToDate(t.end)), t.start.setSeconds(0, 0), t.end.setSeconds(0, 0), isNaN(t.start) || isNaN(t.end)) {
518
+ isNaN(t.start) ? console.error(`Vue Cal: invalid start date for event "${t.title}".`, t.start) : console.error(`Vue Cal: invalid end date for event "${t.title}".`, t.end);
516
519
  return;
517
- } else o.end.getTime() < o.start.getTime() && console.error(`Vue Cal: invalid event dates for event "${o.title}". The event ends before it starts.`, o.start, o.end);
518
- o._ || (o._ = {}), o._.multiday = !n.isSameDate(o.start, new Date(o.end.getTime() - 1)), o._.startFormatted = n.formatDate(o.start), o._.startMinutes = ~~n.dateToMinutes(o.start), o._.endMinutes = ~~n.dateToMinutes(o.end);
519
- const c = o.start.getHours(), e = o.start.getMinutes().toString().padStart(2, 0), m = o.end.getHours(), g = o.end.getMinutes().toString().padStart(2, 0);
520
- o._.startTimeFormatted24 = `${c.toString().padStart(2, 0)}:${e}`, o._.startTimeFormatted12 = `${c % 12 || 12}${e ? `:${e}` : ""} ${c < 12 ? "AM" : "PM"}`, o._.endTimeFormatted24 = `${m.toString().padStart(2, 0)}:${g}`, o._.endTimeFormatted12 = `${m % 12 || 12}${g ? `:${g}` : ""} ${m < 12 ? "AM" : "PM"}`, o._.duration = Math.abs(~~((o.end - o.start) / 6e4));
521
- }, H = (o) => p.value.byId[o], v = (o, c = !1, e = !1) => {
522
- let m = p.value.byDate[o] || [];
523
- return m = c || e ? m.map(H) : m, e || (m = m.filter((g) => !g.background && !g._.deleted), c || (m = m.map((g) => g._.id))), m;
524
- }, j = (o) => {
525
- const c = {};
526
- for (const { startFormatted: e } of o) {
527
- c[e] = [];
528
- const m = v(e, !1, !0);
529
- m.length && c[e].push(...m);
520
+ } else t.end.getTime() < t.start.getTime() && console.error(`Vue Cal: invalid event dates for event "${t.title}". The event ends before it starts.`, t.start, t.end);
521
+ t._ || (t._ = {}), t._.multiday = !s.isSameDate(t.start, new Date(t.end.getTime() - 1)), t._.startFormatted = s.formatDate(t.start), t._.startMinutes = ~~s.dateToMinutes(t.start), t._.endMinutes = ~~s.dateToMinutes(t.end);
522
+ const o = t.start.getHours(), e = t.start.getMinutes().toString().padStart(2, 0), h = t.end.getHours(), c = t.end.getMinutes().toString().padStart(2, 0);
523
+ t._.startTimeFormatted24 = `${o.toString().padStart(2, 0)}:${e}`, t._.startTimeFormatted12 = `${o % 12 || 12}${e ? `:${e}` : ""} ${o < 12 ? "AM" : "PM"}`, t._.endTimeFormatted24 = `${h.toString().padStart(2, 0)}:${c}`, t._.endTimeFormatted12 = `${h % 12 || 12}${c ? `:${c}` : ""} ${h < 12 ? "AM" : "PM"}`, t._.duration = Math.abs(~~((t.end - t.start) / 6e4));
524
+ }, H = (t) => {
525
+ t._ || (t._ = {}), t._.id = t._.id || ++d, t.delete || (t.delete = (o) => m(t._.id, o)), t._.deleting = !1, t._.deleted = !1, t.isOverlapping = (o = null) => t.getOverlappingEvents(o).length, t.getOverlappingEvents = (o = null) => {
526
+ var e;
527
+ return W(
528
+ (o == null ? void 0 : o.start) || t.start,
529
+ (o == null ? void 0 : o.end) || t.end,
530
+ { excludeIds: [t._.id], schedule: (e = r.schedules) != null && e.length ? ~~((o == null ? void 0 : o.schedule) || t.schedule) : null }
531
+ );
532
+ }, t._.register = (o) => {
533
+ t._.$el = o, t._.fireCreated && (y.emit("event-created", t), delete t._.fireCreated);
534
+ }, t._.unregister = () => {
535
+ t._.$el = null, t._.register = null, t.isOverlapping = null, t.getOverlappingEvents = null, t.delete = null;
536
+ };
537
+ }, f = (t) => w.value.byId[t], F = (t) => {
538
+ const o = [];
539
+ for (const { start: e, end: h } of t) {
540
+ const c = W(e, h);
541
+ c.length && o.push(...c);
530
542
  }
531
- return c;
532
- }, i = (o) => {
533
- if (!o.start || !o.end) {
543
+ return o;
544
+ }, u = (t) => {
545
+ if (!t.start || !t.end) {
534
546
  console.error("Vue Cal: Cannot create an event without valid start and end dates.");
535
547
  return;
536
548
  }
537
- return r.snapToInterval && (n.snapToInterval(o.start, r.snapToInterval), n.snapToInterval(o.end, r.snapToInterval)), o = { ...o }, o._ || (o._ = {}), o._.id = ++h, o._.fireCreated = !0, r.events.push(o), o;
538
- }, f = async (o, c = 0) => {
539
- var P, A;
540
- if (!o) return console.warn("Vue Cal: Cannot delete event without its ID or criteria.");
541
- let e = typeof o == "string" || !isNaN(o) ? o : null;
542
- const m = typeof o == "object" ? Object.entries(o) : null;
543
- if (m) {
544
- const [s, l] = m[0];
545
- e = (P = r.events.find((_) => _[s] === l)) == null ? void 0 : P._.id;
549
+ return r.snapToInterval && (s.snapToInterval(t.start, r.snapToInterval), s.snapToInterval(t.end, r.snapToInterval)), t = { ...t }, t._ || (t._ = {}), t._.id = ++d, t._.fireCreated = !0, r.events.push(t), t;
550
+ }, m = async (t, o = 0) => {
551
+ var L, z;
552
+ if (!t) return console.warn("Vue Cal: Cannot delete event without its ID or criteria.");
553
+ let e = typeof t == "string" || !isNaN(t) ? t : null;
554
+ const h = typeof t == "object" ? Object.entries(t) : null;
555
+ if (h) {
556
+ const [D, l] = h[0];
557
+ e = (L = r.events.find((p) => p[D] === l)) == null ? void 0 : L._.id;
546
558
  }
547
559
  if (!r.editableEvents.delete)
548
560
  return console.info("Vue Cal: Event deletion is disabled. Enable it with the `editable-events` props.");
549
561
  if (!e) return console.warn("Vue Cal: Cannot delete event without its ID.");
550
- const g = r.events.findIndex((s) => s._.id === e);
551
- if (g === -1) return console.warn(`Vue Cal: Cannot delete unknown event \`${e}\`.`);
552
- const M = r.events[g];
553
- if (M.deletable === !1) return console.warn(`Vue Cal: Can't delete event \`${e}\` since it was explicitely set to \`delete: false\`.`);
554
- switch (c) {
562
+ const c = r.events.findIndex((D) => D._.id === e);
563
+ if (c === -1) return console.warn(`Vue Cal: Cannot delete unknown event \`${e}\`.`);
564
+ const E = r.events[c];
565
+ if (E.deletable === !1) return console.warn(`Vue Cal: Can't delete event \`${e}\` since it was explicitely set to \`delete: false\`.`);
566
+ switch (o) {
555
567
  case 0:
556
- M._.deleting ? r.events.splice(g, 1) : M._.deleting = !0;
568
+ E._.deleting ? r.events.splice(c, 1) : E._.deleting = !0;
557
569
  break;
558
570
  // Display the delete button.
559
571
  case 1:
560
- M._.deleting = !0;
572
+ E._.deleting = !0;
561
573
  break;
562
574
  // Visual deletion + external DOM event firing.
563
575
  // When explicitly using this stage, the event will be visually deleted but still present in the
564
576
  // source of truth until the cell is unmounted (by navigating away).
565
577
  case 2:
566
- M._.deleted = !0, r.events[g]._.deleted = !0, (A = M._.$el) == null || A.dispatchEvent(new CustomEvent("event-deleted", { detail: M._.id }));
578
+ E._.deleted = !0, r.events[c]._.deleted = !0, (z = E._.$el) == null || z.dispatchEvent(new CustomEvent("event-deleted", { detail: E._.id }));
567
579
  break;
568
580
  // Effective deletion from the source of truth (by default, when unmounting the cell).
569
581
  case 3:
570
- r.events.splice(g, 1), D.emit("update:events", r.events), D.emit("event-delete", M);
582
+ r.events.splice(c, 1), y.emit("update:events", r.events), y.emit("event-delete", E);
571
583
  break;
572
584
  }
573
585
  return !0;
574
- }, T = (o) => {
575
- const c = v(o, !0);
576
- if (!c.length) return { cellOverlaps: {}, longestStreak: 0 };
577
- const e = {};
578
- let m = [], g = 0;
579
- c.sort((M, P) => M.start - P.start || M.end - M.start - (P.end - P.start));
580
- for (const M of c) {
581
- const P = M._.id;
582
- e[P] || (e[P] = { overlaps: /* @__PURE__ */ new Set(), maxConcurrent: 1, position: 0 }), m = m.filter((t) => t.end > M.start);
583
- const A = m.filter((t) => {
584
- var L;
585
- return (!((L = r.schedules) != null && L.length) || M.schedule === t.schedule) && t.start < M.end;
586
- }), s = new Set(A.map((t) => {
587
- var C;
588
- return ((C = e[t._.id]) == null ? void 0 : C.position) ?? 0;
586
+ }, Y = (t, o) => {
587
+ const e = W(t, o);
588
+ if (!e.length) return { cellOverlaps: {}, longestStreak: 0 };
589
+ const h = {};
590
+ let c = [], E = 0;
591
+ e.sort((L, z) => L.start - z.start || L.end - L.start - (z.end - z.start));
592
+ for (const L of e) {
593
+ const z = L._.id;
594
+ h[z] || (h[z] = { overlaps: /* @__PURE__ */ new Set(), maxConcurrent: 1, position: 0 }), c = c.filter((a) => a.end > L.start);
595
+ const D = c.filter((a) => {
596
+ var B;
597
+ return (!((B = r.schedules) != null && B.length) || L.schedule === a.schedule) && a.start < L.end;
598
+ }), l = new Set(D.map((a) => {
599
+ var O;
600
+ return ((O = h[a._.id]) == null ? void 0 : O.position) ?? 0;
589
601
  }));
590
- let l = 0;
591
- for (; s.has(l); ) l++;
592
- e[P].position = l, m.push(M);
593
- const _ = Math.max(1, ...A.map((t) => {
594
- var C;
595
- return ((C = e[t._.id]) == null ? void 0 : C.maxConcurrent) ?? 1;
602
+ let p = 0;
603
+ for (; l.has(p); ) p++;
604
+ h[z].position = p, c.push(L);
605
+ const k = Math.max(1, ...D.map((a) => {
606
+ var O;
607
+ return ((O = h[a._.id]) == null ? void 0 : O.maxConcurrent) ?? 1;
596
608
  }));
597
- e[P].maxConcurrent = Math.max(A.length + 1, _);
598
- for (const t of A)
599
- e[t._.id].overlaps.add(P), e[P].overlaps.add(t._.id), e[t._.id].maxConcurrent = e[P].maxConcurrent;
600
- g = Math.max(g, e[P].maxConcurrent);
609
+ h[z].maxConcurrent = Math.max(D.length + 1, k);
610
+ for (const a of D)
611
+ h[a._.id].overlaps.add(z), h[z].overlaps.add(a._.id), h[a._.id].maxConcurrent = h[z].maxConcurrent;
612
+ E = Math.max(E, h[z].maxConcurrent);
613
+ }
614
+ for (const L in h) h[L].overlaps = [...h[L].overlaps];
615
+ return { cellOverlaps: h, longestStreak: E };
616
+ }, W = (t, o, { excludeIds: e = [], schedule: h = null, background: c = !0 } = {}) => {
617
+ const E = t.getFullYear(), L = o.getFullYear(), z = t.getMonth() + 1, D = o.getMonth() + 1, l = t.getDate(), p = o.getDate(), k = t.getTime(), a = o.getTime(), O = [], B = new Set(e);
618
+ for (let R = E; R <= L; R++) {
619
+ const oe = `${R}`, te = w.value.byYear[oe];
620
+ if (!te) continue;
621
+ const se = R === E ? z : 1, ce = R === L ? D : 12;
622
+ for (let X = se; X <= ce; X++) {
623
+ const Ee = String(X).padStart(2, "0"), Q = te[Ee];
624
+ if (Q)
625
+ for (const le in Q) {
626
+ const n = +le;
627
+ if (R === E && X === z && n < l || R === L && X === D && n > p) continue;
628
+ const _ = Q[le];
629
+ for (let g = 0; g < _.length; g++) {
630
+ const A = w.value.byId[_[g]];
631
+ !A || B.has(A._.id) || h !== null && h !== A.schedule || c === !1 && A.background || A.end.getTime() > k && A.start.getTime() < a && O.push(A);
632
+ }
633
+ }
634
+ }
601
635
  }
602
- for (const M in e) e[M].overlaps = [...e[M].overlaps];
603
- return { cellOverlaps: e, longestStreak: g };
604
- }, W = (o = [], { start: c, end: e }, { excludeIds: m = [], schedule: g = null }) => {
605
- var A;
606
- const M = new Set(m), P = [];
607
- for (const s of o)
608
- !M.has((A = s._) == null ? void 0 : A.id) && (g === null || g === s.schedule) && R(s, c, e) && P.push(s);
609
- return P;
610
- }, R = (o, c, e) => {
611
- const m = o.allDay || !r.time, g = m ? new Date(o.start).setHours(0, 0, 0, 0) : o.start.getTime(), M = m ? new Date(o.end).setHours(23, 59, 59, 999) : o.end.getTime(), P = m ? new Date(c).setHours(0, 0, 0, 0) : c.getTime(), A = m ? new Date(e).setHours(23, 59, 59, 999) : e.getTime();
612
- return M > P && g < A;
636
+ return O;
613
637
  };
614
638
  return {
615
- events: p,
616
- getEvent: H,
617
- getEventsByDate: v,
618
- getViewEvents: j,
619
- getCellOverlappingEvents: T,
639
+ events: w,
640
+ getEvent: f,
641
+ getViewEvents: F,
642
+ getCellOverlappingEvents: Y,
620
643
  getEventsInRange: W,
621
- createEvent: i,
622
- deleteEvent: f,
623
- isEventInRange: R
644
+ createEvent: u,
645
+ deleteEvent: m,
646
+ isEventInRange: (t, o, e) => {
647
+ const h = t.allDay || !r.time, c = h ? new Date(t.start).setHours(0, 0, 0, 0) : t.start.getTime(), E = h ? new Date(t.end).setHours(23, 59, 59, 999) : t.end.getTime(), L = h ? new Date(o).setHours(0, 0, 0, 0) : o.getTime(), z = h ? new Date(e).setHours(23, 59, 59, 999) : e.getTime();
648
+ return E > L && c < z;
649
+ }
624
650
  };
625
- }, Ct = ({ config: D, dateUtils: n, emit: r, texts: h, eventsManager: p }, b) => {
626
- const { availableViews: H } = D, v = ie(D.view && H[D.view] ? D.view : D.defaultView), j = ie(D.selectedDate || null), i = ie(/* @__PURE__ */ new Date()), f = ie(new Date(D.viewDate || i.value));
627
- f.value.setHours(0, 0, 0, 0);
628
- const T = ie(new Date(f));
651
+ }, Ct = ({ config: y, dateUtils: s, emit: r, texts: d, eventsManager: w }, b) => {
652
+ const { availableViews: H } = y, f = ue(y.view && H[y.view] ? y.view : y.defaultView), F = ue(y.selectedDate || null), u = ue(/* @__PURE__ */ new Date()), m = ue(new Date(y.viewDate || u.value));
653
+ m.value.setHours(0, 0, 0, 0);
654
+ const Y = ue(new Date(m));
629
655
  let W = null;
630
- const R = $(() => v.value === "month" ? T.value : l.value), o = $(() => v.value === "month" ? new Date(T.value.getFullYear(), T.value.getMonth() + 1, 0, 23, 59, 59, 999) : t.value), c = $(() => v.value === "week" ? n.getPreviousFirstDayOfWeek(l.value, D.startWeekOnSunday) : v.value === "month" ? l.value : R.value), e = $(() => {
631
- if (v.value === "week") {
632
- const d = n.addDays(c.value, 7);
633
- return d.setMilliseconds(-1), d;
656
+ const q = M(() => f.value === "month" ? Y.value : l.value), t = M(() => f.value === "month" ? new Date(Y.value.getFullYear(), Y.value.getMonth() + 1, 0, 23, 59, 59, 999) : k.value), o = M(() => f.value === "week" ? s.getPreviousFirstDayOfWeek(l.value, y.startWeekOnSunday) : f.value === "month" ? l.value : q.value), e = M(() => {
657
+ if (f.value === "week") {
658
+ const v = s.addDays(o.value, 7);
659
+ return v.setMilliseconds(-1), v;
634
660
  }
635
- return v.value === "month" ? t.value : o.value;
636
- }), m = $(() => {
637
- const d = i.value.getTime();
638
- if (v.value === "week")
639
- return c.value.getTime() <= d && d <= e.value.getTime();
640
- const F = l.value.getTime(), X = t.value.getTime();
641
- return F <= d && d <= X;
661
+ return f.value === "month" ? k.value : t.value;
662
+ }), h = M(() => {
663
+ const v = u.value.getTime();
664
+ if (f.value === "week")
665
+ return o.value.getTime() <= v && v <= e.value.getTime();
666
+ const N = l.value.getTime(), Z = k.value.getTime();
667
+ return N <= v && v <= Z;
642
668
  });
643
- function g() {
644
- i.value = /* @__PURE__ */ new Date(), W = setTimeout(g, 60 * 1e3);
669
+ function c() {
670
+ u.value = /* @__PURE__ */ new Date(), W = setTimeout(c, 60 * 1e3);
645
671
  }
646
- function M() {
647
- W = setTimeout(g, (60 - (/* @__PURE__ */ new Date()).getSeconds()) * 1e3), g();
672
+ function E() {
673
+ W = setTimeout(c, (60 - (/* @__PURE__ */ new Date()).getSeconds()) * 1e3), c();
648
674
  }
649
- const P = $(() => {
650
- if (!D.availableViews[v.value]) return 1;
651
- let d = D.availableViews[v.value].cols;
652
- return D.hasHiddenDays && ["week", "month"].includes(v.value) && (d -= D.hasHiddenDays), d;
653
- }), A = $(() => {
654
- var d;
655
- return ((d = D.availableViews[v.value]) == null ? void 0 : d.rows) || 1;
656
- }), s = $(() => P.value * A.value), l = $(() => {
657
- if (v.value === "month") {
658
- let d = T.value.getDay() || 7;
659
- return D.startWeekOnSunday && !D.hideWeekdays[7] && (d += 1), D.viewDayOffset && (d -= D.viewDayOffset), n.subtractDays(T.value, d - 1);
675
+ const L = M(() => {
676
+ if (!y.availableViews[f.value]) return 1;
677
+ let v = y.availableViews[f.value].cols;
678
+ return y.hasHiddenDays && ["week", "month"].includes(f.value) && (v -= y.hasHiddenDays), v;
679
+ }), z = M(() => {
680
+ var v;
681
+ return ((v = y.availableViews[f.value]) == null ? void 0 : v.rows) || 1;
682
+ }), D = M(() => L.value * z.value), l = M(() => {
683
+ if (f.value === "month") {
684
+ let v = Y.value.getDay() || 7;
685
+ return y.startWeekOnSunday && !y.hideWeekdays[7] && (v += 1), y.viewDayOffset && (v -= y.viewDayOffset), s.subtractDays(Y.value, v - 1);
660
686
  }
661
- if (v.value === "week") {
662
- const d = "1234567".split("").filter((X) => !Object.keys(D.hideWeekdays).includes(X));
663
- let F = Math.min(...d);
664
- return D.startWeekOnSunday && !D.hideWeekdays[7] && (F = 1), D.viewDayOffset && (F += D.viewDayOffset), n.addDays(T.value, F - 1);
687
+ if (f.value === "week") {
688
+ const v = "1234567".split("").filter((Z) => !Object.keys(y.hideWeekdays).includes(Z));
689
+ let N = Math.min(...v);
690
+ return y.startWeekOnSunday && !y.hideWeekdays[7] && (N = 1), y.viewDayOffset && (N += y.viewDayOffset), s.addDays(Y.value, N - 1);
665
691
  }
666
- return T.value;
667
- }), _ = $(() => {
668
- const d = [], F = ["days", "week", "month"].includes(v.value);
669
- let X = 0;
670
- for (let G = 0; G < s.value + X; G++)
671
- switch (v.value) {
692
+ return Y.value;
693
+ }), p = M(() => {
694
+ const v = [], N = ["days", "week", "month"].includes(f.value);
695
+ let Z = 0;
696
+ for (let U = 0; U < D.value + Z; U++)
697
+ switch (f.value) {
672
698
  case "day":
673
699
  case "days":
674
700
  case "week":
675
701
  case "month": {
676
- const ve = n.addDays(l.value, G), We = ve.getDay() || 7;
677
- if (F && D.hasHiddenDays && D.hideWeekdays[We]) {
678
- X++;
702
+ const ve = s.addDays(l.value, U), We = ve.getDay() || 7;
703
+ if (N && y.hasHiddenDays && y.hideWeekdays[We]) {
704
+ Z++;
679
705
  continue;
680
706
  }
681
707
  const Ce = new Date(ve);
682
- Ce.setHours(23, 59, 59, 999), d.push({ start: ve, startFormatted: n.formatDate(ve), end: Ce });
708
+ Ce.setHours(23, 59, 59, 999), v.push({ start: ve, startFormatted: s.formatDate(ve), end: Ce });
683
709
  break;
684
710
  }
685
711
  case "year":
686
- d.push({
687
- start: new Date(l.value.getFullYear(), G, 1, 0, 0, 0, 0),
688
- end: new Date(l.value.getFullYear(), G + 1, 0, 23, 59, 59, 999)
712
+ v.push({
713
+ start: new Date(l.value.getFullYear(), U, 1, 0, 0, 0, 0),
714
+ end: new Date(l.value.getFullYear(), U + 1, 0, 23, 59, 59, 999)
689
715
  });
690
716
  break;
691
717
  case "years":
692
- d.push({
693
- start: new Date(l.value.getFullYear() + G, 0, 1, 0, 0, 0, 0),
694
- end: new Date(l.value.getFullYear() + G + 1, 0, 0, 23, 59, 59, 999)
718
+ v.push({
719
+ start: new Date(l.value.getFullYear() + U, 0, 1, 0, 0, 0, 0),
720
+ end: new Date(l.value.getFullYear() + U + 1, 0, 0, 23, 59, 59, 999)
695
721
  });
696
722
  break;
697
723
  }
698
- return d;
699
- }), t = $(() => _.value[_.value.length - 1].end), C = ie("right"), L = $(() => {
700
- const d = Object.keys(D.availableViews);
701
- return d[d.indexOf(v.value) + 1];
702
- }), J = $(() => {
703
- const d = Object.keys(D.availableViews);
704
- return d[d.indexOf(v.value) - 1];
724
+ return v;
725
+ }), k = M(() => p.value[p.value.length - 1].end), a = ue("right"), O = M(() => {
726
+ const v = Object.keys(y.availableViews);
727
+ return v[v.indexOf(f.value) + 1];
728
+ }), B = M(() => {
729
+ const v = Object.keys(y.availableViews);
730
+ return v[v.indexOf(f.value) - 1];
705
731
  });
706
- function Z(d, F, X = !1) {
707
- if (!F || !F[d]) return d + 1;
708
- const G = F[d];
709
- return X && typeof G == "string" ? G.substring(0, 3) : G;
732
+ function R(v, N, Z = !1) {
733
+ if (!N || !N[v]) return v + 1;
734
+ const U = N[v];
735
+ return Z && typeof U == "string" ? U.substring(0, 3) : U;
710
736
  }
711
- function ue(d, F, X) {
712
- const { monthsArray: G, monthBeforeDay: ve, canTruncate: We, xs: Ce } = X, Me = d.getMonth(), Ye = d.getFullYear(), Ee = F.getMonth(), Fe = F.getFullYear(), Ae = Me !== Ee, pt = Ye !== Fe, Te = We && (Ce || Ae), Le = d.getDate(), He = F.getDate();
713
- return pt ? ve ? `${Z(Me, G, Te)} ${Le}, ${Ye} - ${Z(Ee, G, Te)} ${He}, ${Fe}` : `${Le} ${Z(Me, G, Te)} ${Ye} - ${He} ${Z(Ee, G, Te)} ${Fe}` : Ae ? ve ? `${Z(Me, G, Te)} ${Le} - ${Z(Ee, G, Te)} ${He}, ${Ye}` : `${Le} ${Z(Me, G, Te)} - ${He} ${Z(Ee, G, Te)} ${Ye}` : ve ? `${Z(Me, G, Te)} ${Le}-${He}, ${Ye}` : `${Le}-${He} ${Z(Me, G, Te)} ${Ye}`;
737
+ function oe(v, N, Z) {
738
+ const { monthsArray: U, monthBeforeDay: ve, canTruncate: We, xs: Ce } = Z, Te = v.getMonth(), Me = v.getFullYear(), Ye = N.getMonth(), Pe = N.getFullYear(), Ae = Te !== Ye, pt = Me !== Pe, be = We && (Ce || Ae), Le = v.getDate(), He = N.getDate();
739
+ return pt ? ve ? `${R(Te, U, be)} ${Le}, ${Me} - ${R(Ye, U, be)} ${He}, ${Pe}` : `${Le} ${R(Te, U, be)} ${Me} - ${He} ${R(Ye, U, be)} ${Pe}` : Ae ? ve ? `${R(Te, U, be)} ${Le} - ${R(Ye, U, be)} ${He}, ${Me}` : `${Le} ${R(Te, U, be)} - ${He} ${R(Ye, U, be)} ${Me}` : ve ? `${R(Te, U, be)} ${Le}-${He}, ${Me}` : `${Le}-${He} ${R(Te, U, be)} ${Me}`;
714
740
  }
715
- const ce = $(() => {
716
- const { dateFormat: d, months: F, monthsGenitive: X, week: G, truncations: ve } = h, We = D.locale, Ce = ve !== !1, Me = d.indexOf("M") < d.indexOf("D"), Ye = X && We === "el" ? X : F;
717
- switch (v.value) {
741
+ const te = M(() => {
742
+ const { dateFormat: v, months: N, monthsGenitive: Z, week: U, truncations: ve } = d, We = y.locale, Ce = ve !== !1, Te = v.indexOf("M") < v.indexOf("D"), Me = Z && We === "el" ? Z : N;
743
+ switch (f.value) {
718
744
  case "day":
719
- return n.formatDate(l.value, d);
745
+ return s.formatDate(l.value, v);
720
746
  case "days":
721
747
  case "week": {
722
- const Ee = {
723
- monthsArray: Ye,
724
- monthBeforeDay: Me,
748
+ const Ye = {
749
+ monthsArray: Me,
750
+ monthBeforeDay: Te,
725
751
  canTruncate: Ce,
726
- xs: D.xs
752
+ xs: y.xs
727
753
  };
728
- let Fe = ue(l.value, t.value, Ee);
729
- if (v.value === "week") {
730
- const Ae = n.getWeek(
754
+ let Pe = oe(l.value, k.value, Ye);
755
+ if (f.value === "week") {
756
+ const Ae = s.getWeek(
731
757
  l.value,
732
- D.startWeekOnSunday && !D.hideWeekdays[7]
758
+ y.startWeekOnSunday && !y.hideWeekdays[7]
733
759
  );
734
- Fe += ` <small>${G} ${Ae}</small>`;
760
+ Pe += ` <small>${U} ${Ae}</small>`;
735
761
  }
736
- return Fe;
762
+ return Pe;
737
763
  }
738
764
  case "month": {
739
- const Ee = `${D.xs && Ce ? "MMM" : "MMMM"} YYYY`;
740
- return n.formatDate(R.value, Ee);
765
+ const Ye = `${y.xs && Ce ? "MMM" : "MMMM"} YYYY`;
766
+ return s.formatDate(q.value, Ye);
741
767
  }
742
768
  case "year":
743
769
  return l.value.getFullYear();
744
770
  case "years":
745
- return `${l.value.getFullYear()} - ${o.value.getFullYear()}`;
771
+ return `${l.value.getFullYear()} - ${t.value.getFullYear()}`;
746
772
  }
747
773
  });
748
- function de() {
749
- switch (T.value = new Date(f.value || i.value), T.value.setHours(0, 0, 0, 0), v.value) {
774
+ function se() {
775
+ switch (Y.value = new Date(m.value || u.value), Y.value.setHours(0, 0, 0, 0), f.value) {
750
776
  case "day":
751
777
  break;
752
778
  case "days":
753
779
  break;
754
780
  case "week":
755
- T.value = n.getPreviousFirstDayOfWeek(T.value, D.startWeekOnSunday && !D.hideWeekdays[7]);
781
+ Y.value = s.getPreviousFirstDayOfWeek(Y.value, y.startWeekOnSunday && !y.hideWeekdays[7]);
756
782
  break;
757
783
  case "month":
758
- T.value = new Date(T.value.getFullYear(), T.value.getMonth(), 1, 0, 0, 0, 0);
784
+ Y.value = new Date(Y.value.getFullYear(), Y.value.getMonth(), 1, 0, 0, 0, 0);
759
785
  break;
760
786
  case "year":
761
- T.value = new Date(T.value.getFullYear(), 0, 1, 0, 0, 0, 0);
787
+ Y.value = new Date(Y.value.getFullYear(), 0, 1, 0, 0, 0, 0);
762
788
  break;
763
789
  case "years":
764
- T.value = new Date(T.value.getFullYear() - T.value.getFullYear() % s.value, 0, 1, 0, 0, 0, 0);
790
+ Y.value = new Date(Y.value.getFullYear() - Y.value.getFullYear() % D.value, 0, 1, 0, 0, 0, 0);
765
791
  break;
766
792
  }
767
- D.ready && r("view-change", {
768
- id: v.value,
769
- title: ce.value,
770
- start: R.value,
771
- end: o.value,
772
- extendedStart: c.value,
793
+ y.ready && r("view-change", {
794
+ id: f.value,
795
+ title: te.value,
796
+ start: q.value,
797
+ end: t.value,
798
+ extendedStart: o.value,
773
799
  extendedEnd: e.value,
774
- cellDates: _.value,
775
- containsToday: m.value,
776
- events: z.value
777
- }), i.value = /* @__PURE__ */ new Date();
800
+ cellDates: p.value,
801
+ containsToday: h.value,
802
+ events: G.value
803
+ }), u.value = /* @__PURE__ */ new Date();
778
804
  }
779
- function pe(d) {
780
- const F = v.value, X = D.availableViews[F];
781
- d[F] && JSON.stringify(d[F]) === JSON.stringify(X) || de();
805
+ function ce(v) {
806
+ const N = f.value, Z = y.availableViews[N];
807
+ v[N] && JSON.stringify(v[N]) === JSON.stringify(Z) || se();
782
808
  }
783
- function oe(d, F = !0) {
784
- const X = Object.keys(D.availableViews);
785
- v.value !== d && (X.includes(d) ? (C.value = X.indexOf(d) < X.indexOf(v.value) ? "left" : "right", v.value = d, r("update:view", d), de()) : console.warn(`Vue Cal: the \`${d}\` view is not available.`));
809
+ function X(v, N = !0) {
810
+ const Z = Object.keys(y.availableViews);
811
+ f.value !== v && (Z.includes(v) ? (a.value = Z.indexOf(v) < Z.indexOf(f.value) ? "left" : "right", f.value = v, r("update:view", v), se()) : console.warn(`Vue Cal: the \`${v}\` view is not available.`));
786
812
  }
787
- function K() {
788
- L.value ? oe(L.value) : console.warn("Vue Cal: no broader view is available.");
813
+ function Ee() {
814
+ O.value ? X(O.value) : console.warn("Vue Cal: no broader view is available.");
789
815
  }
790
- function ee() {
791
- J.value ? oe(J.value) : console.warn("Vue Cal: no narrower view is available.");
816
+ function Q() {
817
+ B.value ? X(B.value) : console.warn("Vue Cal: no narrower view is available.");
792
818
  }
793
- function x() {
794
- w(!1);
819
+ function le() {
820
+ _(!1);
795
821
  }
796
- function a() {
797
- w(!0);
822
+ function n() {
823
+ _(!0);
798
824
  }
799
- function w(d = !0) {
800
- let F = new Date(f.value);
801
- switch (v.value) {
825
+ function _(v = !0) {
826
+ let N = new Date(m.value);
827
+ switch (f.value) {
802
828
  case "day":
803
829
  case "days":
804
- d ? F = n.addDays(t.value, 1) : F = n.subtractDays(l.value, s.value);
830
+ v ? N = s.addDays(k.value, 1) : N = s.subtractDays(l.value, D.value);
805
831
  break;
806
832
  case "week": {
807
- d ? (F = n.addDays(e.value, 1), F.setHours(0, 0, 0, 0)) : F = n.subtractDays(c.value, s.value);
833
+ v ? (N = s.addDays(e.value, 1), N.setHours(0, 0, 0, 0)) : N = s.subtractDays(o.value, D.value);
808
834
  break;
809
835
  }
810
836
  case "month": {
811
- const X = d ? 1 : -1;
812
- F = new Date(F.getFullYear(), F.getMonth() + X, 1, 0, 0, 0, 0);
837
+ const Z = v ? 1 : -1;
838
+ N = new Date(N.getFullYear(), N.getMonth() + Z, 1, 0, 0, 0, 0);
813
839
  break;
814
840
  }
815
841
  case "year": {
816
- const X = d ? 1 : -1;
817
- F = new Date(F.getFullYear() + X, 1, 1, 0, 0, 0, 0);
842
+ const Z = v ? 1 : -1;
843
+ N = new Date(N.getFullYear() + Z, 1, 1, 0, 0, 0, 0);
818
844
  break;
819
845
  }
820
846
  case "years": {
821
- const X = d ? s.value : -s.value;
822
- F = new Date(F.getFullYear() + X, 1, 1, 0, 0, 0, 0);
847
+ const Z = v ? D.value : -D.value;
848
+ N = new Date(N.getFullYear() + Z, 1, 1, 0, 0, 0, 0);
823
849
  break;
824
850
  }
825
851
  }
826
- B(F);
852
+ A(N);
827
853
  }
828
- function y() {
829
- const d = /* @__PURE__ */ new Date();
830
- d.setHours(0, 0, 0, 0), B(d);
854
+ function g() {
855
+ const v = /* @__PURE__ */ new Date();
856
+ v.setHours(0, 0, 0, 0), A(v);
831
857
  }
832
- function B(d, F = !0, X = !1) {
833
- if (!n.isValid(d)) return console.warn("Vue Cal: can't navigate to the given date: invalid date provided to `updateViewDate(date)`.");
834
- let [G, ve] = [l.value, t.value];
835
- v.value === "month" && ([G, ve] = [R.value, o.value]), (!n.isInRange(d, G, ve) || X) && (d.setHours(0, 0, 0, 0), C.value = d.getTime() < G.getTime() ? "left" : "right", f.value = d, F && r("update:viewDate", d), de());
858
+ function A(v, N = !0, Z = !1) {
859
+ if (!s.isValid(v)) return console.warn("Vue Cal: can't navigate to the given date: invalid date provided to `updateViewDate(date)`.");
860
+ let [U, ve] = [l.value, k.value];
861
+ f.value === "month" && ([U, ve] = [q.value, t.value]), (!s.isInRange(v, U, ve) || Z) && (v.setHours(0, 0, 0, 0), a.value = v.getTime() < U.getTime() ? "left" : "right", m.value = v, N && r("update:viewDate", v), se());
836
862
  }
837
- function Q(d, F = !0) {
838
- if (!n.isValid(d)) return console.warn("Vue Cal: can't update the selected date: invalid date provided to `updateSelectedDate(date)`.");
839
- const { isValid: X, isSameDate: G } = n;
840
- (!j.value || !X(j.value) || !G(d, j.value)) && (d.setHours(0, 0, 0, 0), j.value = d, F && r("update:selectedDate", d));
863
+ function x(v, N = !0) {
864
+ if (!s.isValid(v)) return console.warn("Vue Cal: can't update the selected date: invalid date provided to `updateSelectedDate(date)`.");
865
+ const { isValid: Z, isSameDate: U } = s;
866
+ (!F.value || !Z(F.value) || !U(v, F.value)) && (v.setHours(0, 0, 0, 0), F.value = v, N && r("update:selectedDate", v));
841
867
  }
842
- function he(d) {
843
- !d && !T.value.getDay() ? B(n.addDays(T.value, 1), !0, !0) : (C.value = "left", de());
868
+ function he(v) {
869
+ !v && !Y.value.getDay() ? A(s.addDays(Y.value, 1), !0, !0) : (a.value = "left", se());
844
870
  }
845
- function te(d) {
846
- d && D.startWeekOnSunday && !T.value.getDay() ? B(n.addDays(T.value, 1), !0, !0) : !d && D.startWeekOnSunday && T.value.getDay() === 1 && B(n.subtractDays(T.value, 1), !0, !0);
871
+ function i(v) {
872
+ v && y.startWeekOnSunday && !Y.value.getDay() ? A(s.addDays(Y.value, 1), !0, !0) : !v && y.startWeekOnSunday && Y.value.getDay() === 1 && A(s.subtractDays(Y.value, 1), !0, !0);
847
873
  }
848
- function u() {
849
- console.log("toggling weekdays", D.hideWeekdays);
874
+ function T() {
875
+ console.log("toggling weekdays", y.hideWeekdays);
850
876
  }
851
- function k(d) {
852
- var G;
853
- const F = (G = b.value) == null ? void 0 : G.querySelector(".vuecal__scrollable"), X = d ? d * D.timeCellHeight / D.timeStep : 0;
854
- F == null || F.scrollTo({ top: X, behavior: "smooth" });
877
+ function S(v) {
878
+ var U;
879
+ const N = (U = b.value) == null ? void 0 : U.querySelector(".vuecal__scrollable"), Z = v ? v * y.timeCellHeight / y.timeStep : 0;
880
+ N == null || N.scrollTo({ top: Z, behavior: "smooth" });
855
881
  }
856
- function E() {
857
- const d = /* @__PURE__ */ new Date();
858
- k(d.getHours() * 60 + d.getMinutes());
882
+ function $() {
883
+ const v = /* @__PURE__ */ new Date();
884
+ S(v.getHours() * 60 + v.getMinutes());
859
885
  }
860
- function Y() {
861
- k(0);
886
+ function I() {
887
+ S(0);
862
888
  }
863
- const z = $(() => p.getViewEvents(_.value)), I = p.createEvent, ae = p.deleteEvent;
864
- return me(() => D.view, (d) => oe(d, !1)), me(() => D.availableViews, pe), me(() => D.datePicker, () => oe("month", !1)), me(() => D.viewDate, (d) => B(d, !1)), me(() => D.selectedDate, (d) => Q(d, !1)), me(() => D.startWeekOnSunday, (d) => he(d)), me(() => D.hideWeekends, (d) => te(d)), me(() => D.hideWeekdays, u), me(() => s.value, () => {
865
- s.value > 90 && console.warn("Vue Cal: high cell count detected. Performance may degrade when interactions are enabled.");
866
- }), me(() => D.watchRealTime, (d) => {
867
- d && D.time ? M() : W = clearTimeout(W);
868
- }), de(), D.time && D.watchRealTime && M(), Xe(() => W = clearTimeout(W)), {
869
- now: i,
870
- id: v,
871
- broaderView: L,
872
- narrowerView: J,
873
- title: ce,
874
- viewDate: f,
875
- start: R,
876
- end: o,
877
- extendedStart: c,
889
+ const G = M(() => w.getViewEvents(p.value)), ne = w.createEvent, De = w.deleteEvent;
890
+ return me(() => y.view, (v) => X(v, !1)), me(() => y.availableViews, ce), me(() => y.datePicker, () => X("month", !1)), me(() => y.viewDate, (v) => A(v, !1)), me(() => y.selectedDate, (v) => x(v, !1)), me(() => y.startWeekOnSunday, (v) => he(v)), me(() => y.hideWeekends, (v) => i(v)), me(() => y.hideWeekdays, T), me(() => D.value, () => {
891
+ D.value > 90 && console.warn("Vue Cal: high cell count detected. Performance may degrade when interactions are enabled.");
892
+ }), me(() => y.watchRealTime, (v) => {
893
+ v && y.time ? E() : W = clearTimeout(W);
894
+ }), se(), y.time && y.watchRealTime && E(), Xe(() => W = clearTimeout(W)), {
895
+ now: u,
896
+ id: f,
897
+ broaderView: O,
898
+ narrowerView: B,
899
+ title: te,
900
+ viewDate: m,
901
+ start: q,
902
+ end: t,
903
+ extendedStart: o,
878
904
  // Full range, including out of scope month days, and hidden leading/trailing days.
879
905
  extendedEnd: e,
880
906
  // Full range, including out of scope month days, and hidden leading/trailing days.
881
907
  firstCellDate: l,
882
- lastCellDate: t,
883
- containsToday: m,
884
- selectedDate: j,
885
- cellDates: _,
886
- cols: P,
887
- rows: A,
908
+ lastCellDate: k,
909
+ containsToday: h,
910
+ selectedDate: F,
911
+ cellDates: p,
912
+ cols: L,
913
+ rows: z,
888
914
  // All the events are stored and indexed in the events object of the eventsManager.
889
915
  // The following events array is only a subset of visible ones, plus any potential recurring
890
916
  // and multi-day events.
891
- events: z,
892
- transitionDirection: C,
893
- switch: oe,
894
- broader: K,
895
- narrower: ee,
896
- previous: x,
897
- next: a,
898
- navigate: w,
899
- goToToday: y,
900
- updateViewDate: B,
901
- updateSelectedDate: Q,
902
- scrollToCurrentTime: E,
903
- scrollToTime: k,
904
- scrollTop: Y,
905
- createEvent: I,
906
- deleteEvent: ae,
917
+ events: G,
918
+ transitionDirection: a,
919
+ switch: X,
920
+ broader: Ee,
921
+ narrower: Q,
922
+ previous: le,
923
+ next: n,
924
+ navigate: _,
925
+ goToToday: g,
926
+ updateViewDate: A,
927
+ updateSelectedDate: x,
928
+ scrollToCurrentTime: $,
929
+ scrollToTime: S,
930
+ scrollTop: I,
931
+ createEvent: ne,
932
+ deleteEvent: De,
907
933
  // Getters.
908
934
  get isDay() {
909
- return v.value === "day";
935
+ return f.value === "day";
910
936
  },
911
937
  get isDays() {
912
- return v.value === "days";
938
+ return f.value === "days";
913
939
  },
914
940
  get isWeek() {
915
- return v.value === "week";
941
+ return f.value === "week";
916
942
  },
917
943
  get isMonth() {
918
- return v.value === "month";
944
+ return f.value === "month";
919
945
  },
920
946
  get isYear() {
921
- return v.value === "year";
947
+ return f.value === "year";
922
948
  },
923
949
  get isYears() {
924
- return v.value === "years";
950
+ return f.value === "years";
925
951
  }
926
952
  };
927
953
  }, lt = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], rt = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], ot = "Years", it = "Year", ut = "Month", ct = "Week", dt = "Days", vt = "Day", mt = "Today", ft = "No Event", gt = "All day", ht = "Delete", yt = "Create an event", Dt = "dddd, MMMM D, YYYY", Ke = {
@@ -961,11 +987,11 @@ const st = (D, n) => {
961
987
  // Make texts reactive before a locale is loaded.
962
988
  dateUtils: st(fe.texts, Ke)
963
989
  // Some Date utils functions need localized texts.
964
- }), Ot = ({ props: D, emit: n, attrs: r, vuecalEl: h, uid: p }) => {
990
+ }), Ot = ({ props: y, emit: s, attrs: r, vuecalEl: d, uid: w }) => {
965
991
  const b = $e({
966
- uid: p,
992
+ uid: w,
967
993
  // The Vuecal instance unique ID, used for dnd source-target identification.
968
- emit: n,
994
+ emit: s,
969
995
  texts: { ...ze.texts },
970
996
  // Make texts reactive before a locale is loaded.
971
997
  // The date utils composable.
@@ -986,8 +1012,8 @@ const st = (D, n) => {
986
1012
  isResizingEvent: !1
987
1013
  }
988
1014
  });
989
- return b.dateUtils = st(Object.assign(fe.texts, b.texts), Ke), b.config = Yt(b, D, r), b.eventsManager = St(b), b.view = Ct(b, h), b.dnd = Et(b), b;
990
- }, jt = 24 * 60, Pt = {
1015
+ return b.dateUtils = st(Object.assign(fe.texts, b.texts), Ke), b.config = Yt(b, y, r), b.eventsManager = St(b), b.view = Ct(b, d), b.dnd = Et(b), b;
1016
+ }, jt = 24 * 60, Ft = {
991
1017
  allDayEvents: { type: [Boolean, String], default: !1 },
992
1018
  // Coming soon.
993
1019
  stackEvents: { type: Boolean, default: !1 },
@@ -1008,8 +1034,9 @@ const st = (D, n) => {
1008
1034
  // The array of events to display in Vue Cal.
1009
1035
  // Can hold just the view events and be updated or the full array of all events available.
1010
1036
  events: { type: Array, default: () => [] },
1011
- eventCount: { type: Boolean, default: !1 },
1012
- // Displays an events counter in each cell on month view.
1037
+ // Displays an events counter in each cell on month view or year view.
1038
+ // Can be a boolean or an array of views to display the event count on.
1039
+ eventCount: { type: [Boolean, Array], default: !1 },
1013
1040
  eventsOnMonthView: { type: Boolean, default: !1 },
1014
1041
  // Displays events in full on month view.
1015
1042
  hideWeekdays: { type: Array, default: () => [] },
@@ -1083,7 +1110,7 @@ const st = (D, n) => {
1083
1110
  // minScheduleWidth: { type: Number, default: 0 },
1084
1111
  // overlapsPerTimeStep: { type: Boolean, default: false },
1085
1112
  // resizeX: { type: Boolean, default: false },
1086
- }, Ft = { class: "vuecal__header" }, Lt = {
1113
+ }, Pt = { class: "vuecal__header" }, Lt = {
1087
1114
  key: 0,
1088
1115
  class: "vuecal__views-bar"
1089
1116
  }, Ht = ["onClick", "innerHTML"], zt = {
@@ -1091,53 +1118,53 @@ const st = (D, n) => {
1091
1118
  class: "vuecal__title-bar"
1092
1119
  }, Nt = { class: "vuecal__transition-wrap" }, Wt = ["disabled", "innerHTML"], At = {
1093
1120
  __name: "header",
1094
- setup(D) {
1095
- const n = Ne("vuecal"), { view: r, config: h } = n, p = () => {
1096
- h.clickToNavigate && r.broader();
1097
- }, b = $(() => h.clickToNavigate ? { click: p } : {});
1098
- return (H, v) => (S(), O("div", Ft, [
1099
- N(H.$slots, "header", {
1121
+ setup(y) {
1122
+ const s = Ne("vuecal"), { view: r, config: d } = s, w = () => {
1123
+ d.clickToNavigate && r.broader();
1124
+ }, b = M(() => d.clickToNavigate ? { click: w } : {});
1125
+ return (H, f) => (C(), j("div", Pt, [
1126
+ P(H.$slots, "header", {
1100
1127
  view: V(r),
1101
- availableViews: V(h).availableViews,
1102
- vuecal: V(n)
1128
+ availableViews: V(d).availableViews,
1129
+ vuecal: V(s)
1103
1130
  }),
1104
- H.$slots.header ? U("", !0) : (S(), O(ne, { key: 0 }, [
1105
- V(h).viewsBar ? (S(), O("div", Lt, [
1106
- (S(!0), O(ne, null, be(V(h).availableViews, (j, i) => (S(), O("button", {
1107
- class: De(["vuecal__view-button", { "vuecal__view-button--active": V(r).id === i }]),
1108
- onClick: (f) => V(r).switch(i),
1109
- innerHTML: V(n).texts[i],
1131
+ H.$slots.header ? K("", !0) : (C(), j(re, { key: 0 }, [
1132
+ V(d).viewsBar ? (C(), j("div", Lt, [
1133
+ (C(!0), j(re, null, ke(V(d).availableViews, (F, u) => (C(), j("button", {
1134
+ class: ye(["vuecal__view-button", { "vuecal__view-button--active": V(r).id === u }]),
1135
+ onClick: (m) => V(r).switch(u),
1136
+ innerHTML: V(s).texts[u],
1110
1137
  type: "button"
1111
1138
  }, null, 10, Ht))), 256))
1112
- ])) : U("", !0),
1113
- V(h).titleBar ? (S(), O("nav", zt, [
1139
+ ])) : K("", !0),
1140
+ V(d).titleBar ? (C(), j("nav", zt, [
1114
1141
  ge("button", {
1115
- class: De(["vuecal__nav vuecal__nav--prev", { "vuecal__nav--default": !H.$slots["previous-button"] }]),
1116
- onClick: v[0] || (v[0] = (...j) => V(r).previous && V(r).previous(...j)),
1142
+ class: ye(["vuecal__nav vuecal__nav--prev", { "vuecal__nav--default": !H.$slots["previous-button"] }]),
1143
+ onClick: f[0] || (f[0] = (...F) => V(r).previous && V(r).previous(...F)),
1117
1144
  type: "button"
1118
1145
  }, [
1119
- N(H.$slots, "previous-button")
1146
+ P(H.$slots, "previous-button")
1120
1147
  ], 2),
1121
1148
  ge("div", Nt, [
1122
1149
  Oe(Ge, {
1123
1150
  name: `vuecal-slide-fade--${V(r).transitionDirection}`
1124
1151
  }, {
1125
- default: q(() => [
1126
- (S(), O("div", {
1152
+ default: J(() => [
1153
+ (C(), j("div", {
1127
1154
  key: V(r).id + V(r).start.getTime()
1128
1155
  }, [
1129
- H.$slots.title ? (S(), Se(Qe(V(h).clickToNavigate && V(r).broaderView ? "button" : "div"), ye({
1156
+ H.$slots.title || H.$slots[`title.${V(r).id}`] ? (C(), Se(Qe(V(d).clickToNavigate && V(r).broaderView ? "button" : "div"), de({
1130
1157
  key: 0,
1131
1158
  class: "vuecal__title"
1132
- }, Ie(b.value)), {
1133
- default: q(() => [
1134
- N(H.$slots, "title", se(le(V(r))))
1159
+ }, Be(b.value)), {
1160
+ default: J(() => [
1161
+ H.$slots[`title.${V(r).id}`] ? P(H.$slots, `title.${V(r).id}`, ee(de({ key: 0 }, V(r)))) : P(H.$slots, "title", ee(de({ key: 1 }, V(r))))
1135
1162
  ]),
1136
1163
  _: 3
1137
- }, 16)) : (S(), Se(Qe(V(h).clickToNavigate && V(r).broaderView ? "button" : "div"), ye({
1164
+ }, 16)) : (C(), Se(Qe(V(d).clickToNavigate && V(r).broaderView ? "button" : "div"), de({
1138
1165
  key: 1,
1139
1166
  class: "vuecal__title"
1140
- }, Ie(b.value), {
1167
+ }, Be(b.value), {
1141
1168
  innerHTML: V(r).title
1142
1169
  }), null, 16, ["innerHTML"]))
1143
1170
  ]))
@@ -1145,35 +1172,35 @@ const st = (D, n) => {
1145
1172
  _: 3
1146
1173
  }, 8, ["name"])
1147
1174
  ]),
1148
- V(h).todayButton ? (S(), O(ne, { key: 0 }, [
1149
- H.$slots["today-button"] ? N(H.$slots, "today-button", {
1175
+ V(d).todayButton ? (C(), j(re, { key: 0 }, [
1176
+ H.$slots["today-button"] ? P(H.$slots, "today-button", {
1150
1177
  key: 0,
1151
1178
  navigate: () => !V(r).containsToday && V(r).goToToday(),
1152
1179
  active: V(r).containsToday
1153
- }) : (S(), O("button", {
1180
+ }) : (C(), j("button", {
1154
1181
  key: 1,
1155
- class: De(["vuecal__nav vuecal__nav--today vuecal__nav--default", { "vuecal__nav--active": V(r).containsToday }]),
1156
- onClick: v[1] || (v[1] = (j) => !V(r).containsToday && V(r).goToToday()),
1182
+ class: ye(["vuecal__nav vuecal__nav--today vuecal__nav--default", { "vuecal__nav--active": V(r).containsToday }]),
1183
+ onClick: f[1] || (f[1] = (F) => !V(r).containsToday && V(r).goToToday()),
1157
1184
  disabled: !!V(r).containsToday,
1158
1185
  type: "button",
1159
- innerHTML: V(n).texts.today
1186
+ innerHTML: V(s).texts.today
1160
1187
  }, null, 10, Wt))
1161
- ], 64)) : U("", !0),
1188
+ ], 64)) : K("", !0),
1162
1189
  ge("button", {
1163
- class: De(["vuecal__nav vuecal__nav--next", { "vuecal__nav--default": !H.$slots["next-button"] }]),
1164
- onClick: v[2] || (v[2] = (...j) => V(r).next && V(r).next(...j)),
1190
+ class: ye(["vuecal__nav vuecal__nav--next", { "vuecal__nav--default": !H.$slots["next-button"] }]),
1191
+ onClick: f[2] || (f[2] = (...F) => V(r).next && V(r).next(...F)),
1165
1192
  type: "button"
1166
1193
  }, [
1167
- N(H.$slots, "next-button")
1194
+ P(H.$slots, "next-button")
1168
1195
  ], 2)
1169
- ])) : U("", !0)
1196
+ ])) : K("", !0)
1170
1197
  ], 64))
1171
1198
  ]));
1172
1199
  }
1173
- }, Bt = {
1200
+ }, It = {
1174
1201
  key: 0,
1175
1202
  class: "vuecal__headings"
1176
- }, It = {
1203
+ }, Bt = {
1177
1204
  key: 0,
1178
1205
  class: "vuecal__weekdays-headings"
1179
1206
  }, Rt = ["onClick"], Xt = { class: "vuecal__weekday-day" }, Gt = {
@@ -1184,93 +1211,93 @@ const st = (D, n) => {
1184
1211
  class: "vuecal__schedules-headings w-flex grow"
1185
1212
  }, Ut = ["innerHTML"], qt = {
1186
1213
  __name: "headings-bar",
1187
- setup(D) {
1188
- const n = Ne("vuecal"), { view: r, config: h, dateUtils: p } = n, b = $(() => h.xs ? "day-xs" : h.sm || r.isDays || r.isMonth ? "day-sm" : "day"), H = $(() => (r.isDay || r.isDays || r.isWeek || r.isMonth) && !(r.isDay && !h.schedules)), v = $(() => r.cellDates.slice(0, r.cols).map(({ start: i }) => ({
1189
- id: Re[i.getDay()],
1190
- date: i,
1191
- dateNumber: i.getDate(),
1192
- day: p.formatDate(i, "dddd"),
1193
- "day-sm": p.formatDate(i, "ddd"),
1194
- "day-xs": p.formatDate(i, "dd"),
1195
- isToday: p.isToday(i)
1196
- }))), j = {
1197
- click: (i) => {
1198
- (r.isDays || r.isWeek) && r.updateSelectedDate(i);
1214
+ setup(y) {
1215
+ const s = Ne("vuecal"), { view: r, config: d, dateUtils: w } = s, b = M(() => d.xs ? "day-xs" : d.sm || r.isDays || r.isMonth ? "day-sm" : "day"), H = M(() => (r.isDay || r.isDays || r.isWeek || r.isMonth) && !(r.isDay && !d.schedules)), f = M(() => r.cellDates.slice(0, r.cols).map(({ start: u }) => ({
1216
+ id: Re[u.getDay()],
1217
+ date: u,
1218
+ dateNumber: u.getDate(),
1219
+ day: w.formatDate(u, "dddd"),
1220
+ "day-sm": w.formatDate(u, "ddd"),
1221
+ "day-xs": w.formatDate(u, "dd"),
1222
+ isToday: w.isToday(u)
1223
+ }))), F = {
1224
+ click: (u) => {
1225
+ (r.isDays || r.isWeek) && r.updateSelectedDate(u);
1199
1226
  }
1200
1227
  };
1201
- return (i, f) => H.value ? (S(), O("div", Bt, [
1202
- V(r).isDay ? U("", !0) : (S(), O("div", It, [
1203
- (S(!0), O(ne, null, be(v.value, (T, W) => (S(), O("div", {
1204
- class: De(["vuecal__weekday", { "vuecal__weekday--today": T.isToday }]),
1228
+ return (u, m) => H.value ? (C(), j("div", It, [
1229
+ V(r).isDay ? K("", !0) : (C(), j("div", Bt, [
1230
+ (C(!0), j(re, null, ke(f.value, (Y, W) => (C(), j("div", {
1231
+ class: ye(["vuecal__weekday", { "vuecal__weekday--today": Y.isToday }]),
1205
1232
  key: W,
1206
- onClick: (R) => j.click(T.date)
1233
+ onClick: (q) => F.click(Y.date)
1207
1234
  }, [
1208
- N(i.$slots, "weekday-heading", {
1209
- label: T[b.value],
1210
- id: T.id,
1211
- date: T.date
1235
+ P(u.$slots, "weekday-heading", {
1236
+ label: Y[b.value],
1237
+ id: Y.id,
1238
+ date: Y.date
1212
1239
  }, () => [
1213
- ge("span", Xt, re(T[b.value]), 1),
1214
- V(r).isMonth ? U("", !0) : (S(), O("strong", Gt, re(T.dateNumber), 1))
1240
+ ge("span", Xt, ie(Y[b.value]), 1),
1241
+ V(r).isMonth ? K("", !0) : (C(), j("strong", Gt, ie(Y.dateNumber), 1))
1215
1242
  ])
1216
1243
  ], 10, Rt))), 128))
1217
1244
  ])),
1218
- V(h).schedules ? (S(), O("div", Jt, [
1219
- (S(!0), O(ne, null, be(v.value, (T, W) => (S(), O(ne, { key: W }, [
1220
- (S(!0), O(ne, null, be(V(h).schedules, (R, o) => (S(), O(ne, { key: o }, [
1221
- i.$slots["schedule-heading"] ? (S(), O("div", {
1245
+ V(d).schedules ? (C(), j("div", Jt, [
1246
+ (C(!0), j(re, null, ke(f.value, (Y, W) => (C(), j(re, { key: W }, [
1247
+ (C(!0), j(re, null, ke(V(d).schedules, (q, t) => (C(), j(re, { key: t }, [
1248
+ u.$slots["schedule-heading"] ? (C(), j("div", {
1222
1249
  key: 0,
1223
- class: De(["vuecal__schedule vuecal__schedule--heading", R.class])
1250
+ class: ye(["vuecal__schedule vuecal__schedule--heading", q.class])
1224
1251
  }, [
1225
- N(i.$slots, "schedule-heading", {
1226
- schedule: R,
1252
+ P(u.$slots, "schedule-heading", {
1253
+ schedule: q,
1227
1254
  view: V(r)
1228
1255
  })
1229
- ], 2)) : (S(), O("div", {
1256
+ ], 2)) : (C(), j("div", {
1230
1257
  key: 1,
1231
- class: De(["vuecal__schedule vuecal__schedule--heading", R.class]),
1232
- innerHTML: R.label
1258
+ class: ye(["vuecal__schedule vuecal__schedule--heading", q.class]),
1259
+ innerHTML: q.label
1233
1260
  }, null, 10, Ut))
1234
1261
  ], 64))), 128))
1235
1262
  ], 64))), 128))
1236
- ])) : U("", !0)
1237
- ])) : U("", !0);
1263
+ ])) : K("", !0)
1264
+ ])) : K("", !0);
1238
1265
  }
1239
1266
  }, Zt = { class: "vuecal__time-column" }, Kt = {
1240
1267
  __name: "time-column",
1241
- setup(D) {
1242
- const n = Ne("vuecal"), { config: r, texts: h } = n, p = $(() => {
1268
+ setup(y) {
1269
+ const s = Ne("vuecal"), { config: r, texts: d } = s, w = M(() => {
1243
1270
  const b = [];
1244
- for (let v = r.timeFrom; v < r.timeTo; v += r.timeStep) {
1245
- const j = v + r.timeStep > r.timeTo, i = ~~(v / 60), f = v % 60, T = h[v < 720 ? "am" : "pm"];
1271
+ for (let f = r.timeFrom; f < r.timeTo; f += r.timeStep) {
1272
+ const F = f + r.timeStep > r.timeTo, u = ~~(f / 60), m = f % 60, Y = d[f < 720 ? "am" : "pm"];
1246
1273
  let W = null;
1247
- j && (W = `calc(var(--vuecal-time-cell-height) * ${(r.timeTo - v) / r.timeStep})`), b.push({
1248
- minutesSum: v,
1274
+ F && (W = `calc(var(--vuecal-time-cell-height) * ${(r.timeTo - f) / r.timeStep})`), b.push({
1275
+ minutesSum: f,
1249
1276
  // The sum of hours + minutes in minutes.
1250
- hours: i,
1251
- minutes: f,
1252
- formatted12: `${i % 12 ? i % 12 : 12}${f ? `:${f.toString().padStart(2, 0)}` : ""}${T}`,
1253
- formatted24: `${i.toString().padStart(2, 0)}:${f.toString().padStart(2, 0)}`,
1277
+ hours: u,
1278
+ minutes: m,
1279
+ formatted12: `${u % 12 ? u % 12 : 12}${m ? `:${m.toString().padStart(2, 0)}` : ""}${Y}`,
1280
+ formatted24: `${u.toString().padStart(2, 0)}:${m.toString().padStart(2, 0)}`,
1254
1281
  height: W
1255
1282
  });
1256
1283
  }
1257
1284
  return b;
1258
1285
  });
1259
- return (b, H) => (S(), O("div", Zt, [
1260
- (S(!0), O(ne, null, be(p.value, (v, j) => (S(), O("div", {
1286
+ return (b, H) => (C(), j("div", Zt, [
1287
+ (C(!0), j(re, null, ke(w.value, (f, F) => (C(), j("div", {
1261
1288
  class: "vuecal__time-cell",
1262
- key: j,
1263
- style: ke({ height: v.height || null })
1289
+ key: F,
1290
+ style: _e({ height: f.height || null })
1264
1291
  }, [
1265
- N(b.$slots, "time-cell", {
1266
- index: j,
1267
- minutes: v.minutes,
1268
- hours: v.hours,
1269
- minutesSum: v.minutesSum,
1270
- format12: v.formatted12,
1271
- format24: v.formatted24
1292
+ P(b.$slots, "time-cell", {
1293
+ index: F,
1294
+ minutes: f.minutes,
1295
+ hours: f.hours,
1296
+ minutesSum: f.minutesSum,
1297
+ format12: f.formatted12,
1298
+ format24: f.formatted24
1272
1299
  }, () => [
1273
- ge("label", null, re(V(r).twelveHour ? v.formatted12 : v.formatted24), 1)
1300
+ ge("label", null, ie(V(r).twelveHour ? f.formatted12 : f.formatted24), 1)
1274
1301
  ])
1275
1302
  ], 4))), 128))
1276
1303
  ]));
@@ -1284,8 +1311,8 @@ const st = (D, n) => {
1284
1311
  event: { type: Object, required: !0 }
1285
1312
  },
1286
1313
  emits: ["event-drag-start", "event-drag-end", "event-resize-start", "event-resize-end"],
1287
- setup(D, { emit: n }) {
1288
- const { config: r, view: h, dnd: p, touch: b, dateUtils: H } = Ne("vuecal"), v = D, j = ie(null), i = $e(v.event), f = $e({
1314
+ setup(y, { emit: s }) {
1315
+ const { config: r, view: d, dnd: w, touch: b, dateUtils: H } = Ne("vuecal"), f = y, F = ue(null), u = $e(f.event), m = $e({
1289
1316
  dragging: !1,
1290
1317
  resizing: !1,
1291
1318
  fromResizer: !1,
@@ -1319,158 +1346,158 @@ const st = (D, n) => {
1319
1346
  cellEl: null,
1320
1347
  // Store the cell DOM node for a more efficient resizing calc in mousemove/touchmove.
1321
1348
  schedule: null
1322
- }), T = $(() => r.editableEvents.drag && i.draggable !== !1 && !i.background), W = $(() => r.time && r.editableEvents.resize && i.resizable !== !1 && !i.background);
1323
- $(() => r.editableEvents.delete && i.deletable !== !1 && !i.background);
1324
- const R = $(() => {
1325
- var s, l, _;
1349
+ }), Y = M(() => r.editableEvents.drag && u.draggable !== !1 && !u.background), W = M(() => d.isMonth || d.isYear || d.isYears ? !1 : r.time && r.editableEvents.resize && u.resizable !== !1 && !u.background);
1350
+ M(() => r.editableEvents.delete && u.deletable !== !1 && !u.background);
1351
+ const q = M(() => {
1352
+ var D, l, p;
1326
1353
  return {
1327
- [`vuecal__event--${i._.id}`]: !0,
1328
- [i.class]: !!i.class,
1329
- "vuecal__event--recurring": !!i.recurring,
1330
- "vuecal__event--background": !!i.background,
1331
- "vuecal__event--multiday": !!((s = i._) != null && s.multiday),
1332
- "vuecal__event--cut-top": ((l = i._) == null ? void 0 : l.startMinutes) < r.timeFrom,
1333
- "vuecal__event--cut-bottom": ((_ = i._) == null ? void 0 : _.endMinutes) > r.timeTo || i.end.getDate() !== i.start.getDate(),
1354
+ [`vuecal__event--${u._.id}`]: !0,
1355
+ [u.class]: !!u.class,
1356
+ "vuecal__event--recurring": !!u.recurring,
1357
+ "vuecal__event--background": !!u.background,
1358
+ "vuecal__event--multiday": !!((D = u._) != null && D.multiday),
1359
+ "vuecal__event--cut-top": ((l = u._) == null ? void 0 : l.startMinutes) < r.timeFrom,
1360
+ "vuecal__event--cut-bottom": ((p = u._) == null ? void 0 : p.endMinutes) > r.timeTo || u.end.getDate() !== u.start.getDate(),
1334
1361
  // Only apply the dragging class on the event copy that is being dragged.
1335
- "vuecal__event--dragging": !i._.draggingGhost && i._.dragging,
1362
+ "vuecal__event--dragging": !u._.draggingGhost && u._.dragging,
1336
1363
  // Only apply the dragging-ghost class on the event original that remains fixed while a copy is being
1337
1364
  // dragged. Sometimes when dragging fast the dragging-ghost class would get stuck and events stays
1338
1365
  // invisible, so if dragging is false, disable the dragging-ghost class as well.
1339
1366
  // On event drop, if the new position of the event is approved, only remove the dragging-ghost class
1340
1367
  // after event deletion (event._.dragging is already false) so the event ghost does not flash in before
1341
1368
  // deletion.
1342
- "vuecal__event--dragging-ghost": i._.draggingGhost,
1343
- "vuecal__event--resizing": f.resizing
1369
+ "vuecal__event--dragging-ghost": u._.draggingGhost,
1370
+ "vuecal__event--resizing": m.resizing
1344
1371
  };
1345
- }), o = $(() => {
1346
- const s = (h.isDay || h.isDays || h.isWeek) && r.time;
1347
- if (!s && !i.backgroundColor && !i.color) return !1;
1372
+ }), t = M(() => {
1373
+ const D = (d.isDay || d.isDays || d.isWeek) && r.time;
1374
+ if (!D && !u.backgroundColor && !u.color) return !1;
1348
1375
  const l = {
1349
- backgroundColor: i.backgroundColor || null,
1350
- color: i.color || null
1376
+ backgroundColor: u.backgroundColor || null,
1377
+ color: u.color || null
1351
1378
  };
1352
- if (s) {
1353
- const _ = Math.max(r.timeFrom, i._.startMinutes), t = Math.min(r.timeTo, i._.endMinutes), C = Ve(_, r), L = Ve(t, r) - C;
1354
- l.top = `${C}%`, l.height = `${L}%`;
1379
+ if (D) {
1380
+ const p = Math.max(r.timeFrom, u._.startMinutes), k = Math.min(r.timeTo, u._.endMinutes), a = Ve(p, r), O = Ve(k, r) - a;
1381
+ l.top = `${a}%`, l.height = `${O}%`;
1355
1382
  }
1356
1383
  return l;
1357
- }), c = $(() => {
1358
- const s = { ...r.eventListeners.event };
1359
- for (const [t, C] of Object.entries(s))
1360
- ["resize-end"].includes(t) || (s[t] = (L) => {
1361
- L.type !== "drop" && C(L.type ? { e: L, event: i } : L);
1384
+ }), o = M(() => {
1385
+ const D = { ...r.eventListeners.event };
1386
+ for (const [k, a] of Object.entries(D))
1387
+ ["resize-end"].includes(k) || (D[k] = (O) => {
1388
+ O.type !== "drop" && a(O.type ? { e: O, event: u } : O);
1362
1389
  });
1363
- const l = { ...s };
1364
- s.touchstart = (t) => {
1365
- var C;
1366
- t.stopPropagation(), e(t), (C = l.touchstart) == null || C.call(l, { e: t, event: i });
1367
- }, s.mousedown = (t) => {
1368
- var C;
1369
- t.stopPropagation(), e(t), (C = l.mousedown) == null || C.call(l, { e: t, event: i });
1390
+ const l = { ...D };
1391
+ D.touchstart = (k) => {
1392
+ var a;
1393
+ k.stopPropagation(), e(k), (a = l.touchstart) == null || a.call(l, { e: k, event: u });
1394
+ }, D.mousedown = (k) => {
1395
+ var a;
1396
+ k.stopPropagation(), e(k), (a = l.mousedown) == null || a.call(l, { e: k, event: u });
1370
1397
  };
1371
- let _ = null;
1372
- return s.click = (t) => {
1373
- var C;
1374
- (C = l.click) == null || C.call(l, { e: t, event: i }), _ ? _ = clearTimeout(_) : _ = setTimeout(() => {
1375
- var L;
1376
- _ = null, (L = l["delayed-click"]) == null || L.call(l, { e: t, event: i });
1398
+ let p = null;
1399
+ return D.click = (k) => {
1400
+ var a;
1401
+ (a = l.click) == null || a.call(l, { e: k, event: u }), p ? p = clearTimeout(p) : p = setTimeout(() => {
1402
+ var O;
1403
+ p = null, (O = l["delayed-click"]) == null || O.call(l, { e: k, event: u });
1377
1404
  }, 400);
1378
- }, s.dblclick = (t) => {
1379
- l.dblclick ? l.dblclick({ e: t, event: i }) : i.delete(1);
1380
- }, s;
1381
- }), e = (s) => {
1382
- var t, C, L;
1383
- const l = ((t = s.touches) == null ? void 0 : t[0]) || s;
1384
- f.fromResizer = l.target.matches(".vuecal__event-resizer, .vuecal__event-resizer *");
1385
- const _ = j.value.getBoundingClientRect();
1386
- f.startX = (((C = s.touches) == null ? void 0 : C[0]) || s).clientX - _.left, f.startY = (((L = s.touches) == null ? void 0 : L[0]) || s).clientY - _.top, f.startPercentageX = f.startX * 100 / _.width, f.startPercentageY = f.startY * 100 / _.height, f.cellEl = j.value.closest(".vuecal__cell"), f.resizeStartDate = i.start, A(s.type === "touchstart" ? "touchmove" : "mousemove", m), A(s.type === "touchstart" ? "touchend" : "mouseup", g, { once: !0 }), f.holdTimer = setTimeout(() => {
1387
- var J, Z;
1388
- f.holding = !0, (Z = (J = c.value).hold) == null || Z.call(J, { e: s, event: i });
1405
+ }, D.dblclick = (k) => {
1406
+ l.dblclick ? l.dblclick({ e: k, event: u }) : u.delete(1);
1407
+ }, D;
1408
+ }), e = (D) => {
1409
+ var k, a, O;
1410
+ const l = ((k = D.touches) == null ? void 0 : k[0]) || D;
1411
+ m.fromResizer = l.target.matches(".vuecal__event-resizer, .vuecal__event-resizer *");
1412
+ const p = F.value.getBoundingClientRect();
1413
+ m.startX = (((a = D.touches) == null ? void 0 : a[0]) || D).clientX - p.left, m.startY = (((O = D.touches) == null ? void 0 : O[0]) || D).clientY - p.top, m.startPercentageX = m.startX * 100 / p.width, m.startPercentageY = m.startY * 100 / p.height, m.cellEl = F.value.closest(".vuecal__cell"), m.resizeStartDate = u.start, z(D.type === "touchstart" ? "touchmove" : "mousemove", h), z(D.type === "touchstart" ? "touchend" : "mouseup", c, { once: !0 }), m.holdTimer = setTimeout(() => {
1414
+ var B, R;
1415
+ m.holding = !0, (R = (B = o.value).hold) == null || R.call(B, { e: D, event: u });
1389
1416
  }, 1e3);
1390
- }, m = async (s) => {
1391
- var _, t, C, L;
1392
- const l = ((_ = s.touches) == null ? void 0 : _[0]) || s;
1393
- if (f.fromResizer && !f.resizing && (f.resizing = !0, f.resizingOriginalEvent = { ...i, _: { ...i._ } }, b.isResizingEvent = !0, (C = (t = c.value).resizeStart) == null || C.call(t, { e: s, event: i })), f.holdTimer = clearTimeout(f.holdTimer), f.holding = !1, f.cellEl) {
1394
- const { top: J, left: Z, width: ue, height: ce } = f.cellEl.getBoundingClientRect();
1395
- f.moveX = l.clientX - Z, f.moveY = l.clientY - J, f.movePercentageX = f.moveX * 100 / ue, f.movePercentageY = f.moveY * 100 / ce;
1417
+ }, h = async (D) => {
1418
+ var p, k, a, O;
1419
+ const l = ((p = D.touches) == null ? void 0 : p[0]) || D;
1420
+ if (m.fromResizer && !m.resizing && (m.resizing = !0, m.resizingOriginalEvent = { ...u, _: { ...u._ } }, b.isResizingEvent = !0, (a = (k = o.value).resizeStart) == null || a.call(k, { e: D, event: u })), m.holdTimer = clearTimeout(m.holdTimer), m.holding = !1, m.cellEl) {
1421
+ const { top: B, left: R, width: oe, height: te } = m.cellEl.getBoundingClientRect();
1422
+ m.moveX = l.clientX - R, m.moveY = l.clientY - B, m.movePercentageX = m.moveX * 100 / oe, m.movePercentageY = m.moveY * 100 / te;
1396
1423
  }
1397
- if (f.fromResizer) {
1398
- const { newStart: J, newEnd: Z } = M(i);
1399
- let ue = !0;
1400
- const { resize: ce } = (L = r.eventListeners) == null ? void 0 : L.event;
1401
- ce && (ue = await ce({
1402
- e: s,
1403
- event: { ...i, start: J, end: Z },
1404
- overlaps: i.getOverlappingEvents({ start: J, end: Z })
1405
- })), ue !== !1 ? (i.start = J, i.end = Z, f.resizingLastAcceptedEvent && (f.resizingLastAcceptedEvent = null)) : ce && (f.resizingLastAcceptedEvent = { ...i, _: { ...i._ } });
1424
+ if (m.fromResizer) {
1425
+ const { newStart: B, newEnd: R } = E(u);
1426
+ let oe = !0;
1427
+ const { resize: te } = (O = r.eventListeners) == null ? void 0 : O.event;
1428
+ te && (oe = await te({
1429
+ e: D,
1430
+ event: { ...u, start: B, end: R },
1431
+ overlaps: u.getOverlappingEvents({ start: B, end: R })
1432
+ })), oe !== !1 ? (u.start = B, u.end = R, m.resizingLastAcceptedEvent && (m.resizingLastAcceptedEvent = null)) : te && (m.resizingLastAcceptedEvent = { ...u, _: { ...u._ } });
1406
1433
  }
1407
- }, g = async (s) => {
1408
- var l, _;
1409
- if (f.holdTimer = clearTimeout(f.holdTimer), f.holding = !1, f.resizing) {
1410
- const { newStart: t, newEnd: C } = M(i);
1411
- let L = !0;
1412
- const J = c.value["resize-end"];
1413
- J && (L = await J({
1414
- e: s,
1415
- event: i,
1416
- original: f.resizingOriginalEvent,
1434
+ }, c = async (D) => {
1435
+ var l, p;
1436
+ if (m.holdTimer = clearTimeout(m.holdTimer), m.holding = !1, m.resizing) {
1437
+ const { newStart: k, newEnd: a } = E(u);
1438
+ let O = !0;
1439
+ const B = o.value["resize-end"];
1440
+ B && (O = await B({
1441
+ e: D,
1442
+ event: u,
1443
+ original: m.resizingOriginalEvent,
1417
1444
  // Original event details before resizing.
1418
- overlaps: i.getOverlappingEvents({ start: t, end: C })
1419
- })), i.start = L === !1 ? (f.resizingLastAcceptedEvent || f.resizingOriginalEvent).start : ((l = f.resizingLastAcceptedEvent) == null ? void 0 : l.start) || t, i.end = L === !1 ? (f.resizingLastAcceptedEvent || f.resizingOriginalEvent).end : ((_ = f.resizingLastAcceptedEvent) == null ? void 0 : _.end) || C, i._.duration < 1 && (i.start = f.resizingOriginalEvent.start, i.end = f.resizingOriginalEvent.end), b.isResizingEvent = !1;
1445
+ overlaps: u.getOverlappingEvents({ start: k, end: a })
1446
+ })), u.start = O === !1 ? (m.resizingLastAcceptedEvent || m.resizingOriginalEvent).start : ((l = m.resizingLastAcceptedEvent) == null ? void 0 : l.start) || k, u.end = O === !1 ? (m.resizingLastAcceptedEvent || m.resizingOriginalEvent).end : ((p = m.resizingLastAcceptedEvent) == null ? void 0 : p.end) || a, u._.duration < 1 && (u.start = m.resizingOriginalEvent.start, u.end = m.resizingOriginalEvent.end), b.isResizingEvent = !1;
1420
1447
  }
1421
- document.removeEventListener(s.type === "touchend" ? "touchmove" : "mousemove", m), f.resizing = !1, f.fromResizer = !1, f.dragging = !1, f.startX = 0, f.startY = 0, f.moveX = 0, f.moveY = 0, f.startPercentageX = 0, f.startPercentageY = 0, f.movePercentageX = 0, f.movePercentageY = 0, f.cellEl = null, f.resizeStartDate = null, f.resizingOriginalEvent = null, f.resizingLastAcceptedEvent = null, f.schedule = null;
1422
- }, M = (s) => {
1423
- const l = new Date(s.start.getFullYear(), s.start.getMonth(), s.start.getDate());
1448
+ document.removeEventListener(D.type === "touchend" ? "touchmove" : "mousemove", h), m.resizing = !1, m.fromResizer = !1, m.dragging = !1, m.startX = 0, m.startY = 0, m.moveX = 0, m.moveY = 0, m.startPercentageX = 0, m.startPercentageY = 0, m.movePercentageX = 0, m.movePercentageY = 0, m.cellEl = null, m.resizeStartDate = null, m.resizingOriginalEvent = null, m.resizingLastAcceptedEvent = null, m.schedule = null;
1449
+ }, E = (D) => {
1450
+ const l = new Date(D.start.getFullYear(), D.start.getMonth(), D.start.getDate());
1424
1451
  new Date(l).setDate(l.getDate() + 1);
1425
- let t = Pe(f.movePercentageY, r);
1426
- if (t = Math.max(0, Math.min(t, 24 * 60)), r.snapToInterval) {
1427
- const J = t + r.snapToInterval / 2;
1428
- t = J - J % r.snapToInterval;
1452
+ let k = Fe(m.movePercentageY, r);
1453
+ if (k = Math.max(0, Math.min(k, 24 * 60)), r.snapToInterval) {
1454
+ const B = k + r.snapToInterval / 2;
1455
+ k = B - B % r.snapToInterval;
1429
1456
  }
1430
- let C = s.start, L = new Date(l.getTime() + t * 6e4);
1431
- return L < f.resizeStartDate && (C = L, L = f.resizeStartDate), { newStart: C, newEnd: L };
1457
+ let a = D.start, O = new Date(l.getTime() + k * 6e4);
1458
+ return O < m.resizeStartDate && (a = O, O = m.resizeStartDate), { newStart: a, newEnd: O };
1432
1459
  };
1433
- qe(() => i._.register(j.value));
1434
- const P = [], A = (s, l, _) => {
1435
- document.addEventListener(s, l, _), P.push({ event: s, handler: l, options: _ });
1460
+ qe(() => u._.register(F.value));
1461
+ const L = [], z = (D, l, p) => {
1462
+ document.addEventListener(D, l, p), L.push({ event: D, handler: l, options: p });
1436
1463
  };
1437
1464
  return Xe(() => {
1438
- i._.unregister();
1439
- for (const { event: s, handler: l, options: _ } of P)
1440
- document.removeEventListener(s, l, _);
1441
- }), (s, l) => (S(), O("div", ye({ class: "vuecal__event" }, Ie(c.value, !0), {
1465
+ u._.unregister();
1466
+ for (const { event: D, handler: l, options: p } of L)
1467
+ document.removeEventListener(D, l, p);
1468
+ }), (D, l) => (C(), j("div", de({ class: "vuecal__event" }, Be(o.value, !0), {
1442
1469
  ref_key: "eventEl",
1443
- ref: j,
1444
- class: R.value,
1445
- style: o.value,
1446
- draggable: T.value ? "true" : void 0,
1447
- onDragstart: l[2] || (l[2] = (_) => T.value && V(p).eventDragStart(_, i)),
1448
- onDragend: l[3] || (l[3] = (_) => T.value && V(p).eventDragEnd(_, i))
1470
+ ref: F,
1471
+ class: q.value,
1472
+ style: t.value,
1473
+ draggable: Y.value ? "true" : void 0,
1474
+ onDragstart: l[2] || (l[2] = (p) => Y.value && V(w).eventDragStart(p, u)),
1475
+ onDragend: l[3] || (l[3] = (p) => Y.value && V(w).eventDragEnd(p, u))
1449
1476
  }), [
1450
1477
  ge("div", xt, [
1451
- N(s.$slots, "event", { event: i }, () => [
1452
- ge("div", ea, re(i.title), 1),
1453
- V(r).time ? (S(), O("div", ta, re(i._[`startTimeFormatted${V(r).twelveHour ? 12 : 24}`]) + `
1454
- - ` + re(i._[`endTimeFormatted${V(r).twelveHour ? 12 : 24}`]), 1)) : U("", !0),
1478
+ P(D.$slots, "event", { event: u }, () => [
1479
+ ge("div", ea, ie(u.title), 1),
1480
+ V(r).time ? (C(), j("div", ta, ie(u._[`startTimeFormatted${V(r).twelveHour ? 12 : 24}`]) + `
1481
+ - ` + ie(u._[`endTimeFormatted${V(r).twelveHour ? 12 : 24}`]), 1)) : K("", !0),
1455
1482
  ge("div", {
1456
1483
  class: "vuecal__event-content",
1457
- innerHTML: i.content
1484
+ innerHTML: u.content
1458
1485
  }, null, 8, aa)
1459
1486
  ])
1460
1487
  ]),
1461
- W.value ? (S(), O("div", {
1488
+ W.value ? (C(), j("div", {
1462
1489
  key: 0,
1463
1490
  class: "vuecal__event-resizer",
1464
1491
  onDragstart: l[0] || (l[0] = xe(() => {
1465
1492
  }, ["prevent", "stop"]))
1466
- }, null, 32)) : U("", !0),
1493
+ }, null, 32)) : K("", !0),
1467
1494
  Oe(Ge, { name: "vuecal-delete-btn" }, {
1468
- default: q(() => [
1469
- i._.deleting ? (S(), O("div", {
1495
+ default: J(() => [
1496
+ u._.deleting ? (C(), j("div", {
1470
1497
  key: 0,
1471
1498
  class: "vuecal__event-delete",
1472
- onClick: l[1] || (l[1] = xe((_) => i.delete(3), ["stop"]))
1473
- }, "Delete")) : U("", !0)
1499
+ onClick: l[1] || (l[1] = xe((p) => u.delete(3), ["stop"]))
1500
+ }, "Delete")) : K("", !0)
1474
1501
  ]),
1475
1502
  _: 1
1476
1503
  })
@@ -1506,10 +1533,10 @@ const st = (D, n) => {
1506
1533
  end: { type: Date, required: !0 },
1507
1534
  index: { type: Number, required: !0 }
1508
1535
  },
1509
- setup(D) {
1510
- const n = D, r = Ne("vuecal"), { view: h, config: p, dateUtils: b, eventsManager: H, dnd: v, touch: j } = r, i = $(() => b.isToday(n.start)), f = ie(null), T = ie([]), W = ie(!1), R = (u) => {
1511
- T.value.push(u.detail), W.value = !0;
1512
- }, o = () => setTimeout(() => W.value = !1, 300), c = $e({
1536
+ setup(y) {
1537
+ const s = y, r = Ne("vuecal"), { view: d, config: w, dateUtils: b, eventsManager: H, dnd: f, touch: F } = r, u = M(() => b.isToday(s.start)), m = ue(null), Y = ue([]), W = ue(!1), q = (i) => {
1538
+ Y.value.push(i.detail), W.value = !0;
1539
+ }, t = () => setTimeout(() => W.value = !1, 300), o = $e({
1513
1540
  dragging: !1,
1514
1541
  holding: !1,
1515
1542
  // When the cell is clicked and hold for a certain amount of time.
@@ -1530,411 +1557,414 @@ const st = (D, n) => {
1530
1557
  movePercentageX: 0,
1531
1558
  movePercentageY: 0,
1532
1559
  schedule: null
1533
- }), e = ie(!1), m = ie({ cellOverlaps: {}, longestStreak: 0 }), g = $(() => {
1534
- let u = Math.min(c.startPercentageY, c.movePercentageY), k = Math.max(c.startPercentageY, c.movePercentageY), E = Pe(u, p), Y = Pe(k, p);
1535
- return p.snapToInterval && (E = b.snapToInterval(E, p.snapToInterval), Y = b.snapToInterval(Y, p.snapToInterval), u = Ve(E, p), k = Ve(Y, p)), {
1560
+ }), e = ue(!1), h = ue({ cellOverlaps: {}, longestStreak: 0 }), c = M(() => {
1561
+ let i = Math.min(o.startPercentageY, o.movePercentageY), T = Math.max(o.startPercentageY, o.movePercentageY), S = Fe(i, w), $ = Fe(T, w);
1562
+ return w.snapToInterval && (S = b.snapToInterval(S, w.snapToInterval), $ = b.snapToInterval($, w.snapToInterval), i = Ve(S, w), T = Ve($, w)), {
1536
1563
  style: {
1537
- top: `${u}%`,
1538
- height: `${Math.abs(k - u)}%`
1564
+ top: `${i}%`,
1565
+ height: `${Math.abs(T - i)}%`
1539
1566
  },
1540
- startMinutes: E,
1541
- endMinutes: Y,
1542
- start: b.formatMinutes(E),
1543
- end: b.formatMinutes(Y),
1544
- ...c.schedule ? { schedule: c.schedule } : {}
1567
+ startMinutes: S,
1568
+ endMinutes: $,
1569
+ start: b.formatMinutes(S),
1570
+ end: b.formatMinutes($),
1571
+ ...o.schedule ? { schedule: o.schedule } : {}
1545
1572
  };
1546
- }), M = $(() => {
1547
- const u = p.editableEvents.create && (c.dragging || e.value), k = p.eventCreateMinDrag && c.thresholdPassed || !p.eventCreateMinDrag;
1548
- return u && k;
1549
- }), P = $(() => {
1550
- var ae;
1551
- const u = /* @__PURE__ */ new Date(), k = h.start.getFullYear(), E = h.start.getMonth(), Y = n.start.getFullYear(), z = n.start.getMonth();
1573
+ }), E = M(() => {
1574
+ const i = w.editableEvents.create && (o.dragging || e.value), T = w.eventCreateMinDrag && o.thresholdPassed || !w.eventCreateMinDrag;
1575
+ return i && T;
1576
+ }), L = M(() => {
1577
+ var ne;
1578
+ const i = /* @__PURE__ */ new Date(), T = d.start.getFullYear(), S = d.start.getMonth(), $ = s.start.getFullYear(), I = s.start.getMonth();
1552
1579
  return {
1553
- [`vuecal__cell--${Re[n.start.getDay()]}`]: h.isDay || h.isDays || h.isWeek || h.isMonth,
1554
- [`vuecal__cell--${$t[z]}`]: h.isYear,
1555
- [`vuecal__cell--${Y}`]: h.isYears,
1556
- "vuecal__cell--today": i.value,
1557
- "vuecal__cell--current-month": h.isYear && Y === u.getFullYear() && z === u.getMonth(),
1558
- "vuecal__cell--current-year": h.isYears && Y === u.getFullYear(),
1559
- "vuecal__cell--out-of-range": h.isMonth && (Y !== k || z !== E),
1560
- "vuecal__cell--before-min": de.value && ue.value,
1561
- "vuecal__cell--after-max": de.value && ce.value,
1562
- "vuecal__cell--disabled": de.value,
1563
- "vuecal__cell--selected": h.selectedDate && h.selectedDate.getTime() >= n.start.getTime() && h.selectedDate.getTime() <= n.end.getTime(),
1564
- "vuecal__cell--has-schedules": (ae = p.schedules) == null ? void 0 : ae.length,
1565
- "vuecal__cell--dragging": c.dragging,
1566
- "vuecal__cell--has-events": l.value.length
1580
+ [`vuecal__cell--${Re[s.start.getDay()]}`]: d.isDay || d.isDays || d.isWeek || d.isMonth,
1581
+ [`vuecal__cell--${Tt[I]}`]: d.isYear,
1582
+ [`vuecal__cell--${$}`]: d.isYears,
1583
+ "vuecal__cell--today": u.value,
1584
+ "vuecal__cell--current-month": d.isYear && $ === i.getFullYear() && I === i.getMonth(),
1585
+ "vuecal__cell--current-year": d.isYears && $ === i.getFullYear(),
1586
+ "vuecal__cell--out-of-range": d.isMonth && ($ !== T || I !== S),
1587
+ "vuecal__cell--before-min": te.value && R.value,
1588
+ "vuecal__cell--after-max": te.value && oe.value,
1589
+ "vuecal__cell--disabled": te.value,
1590
+ "vuecal__cell--selected": d.selectedDate && d.selectedDate.getTime() >= s.start.getTime() && d.selectedDate.getTime() <= s.end.getTime(),
1591
+ "vuecal__cell--has-schedules": (ne = w.schedules) == null ? void 0 : ne.length,
1592
+ "vuecal__cell--dragging": o.dragging,
1593
+ "vuecal__cell--has-events": D.value.length
1567
1594
  };
1568
- }), A = $(() => b.formatDate(n.start)), s = $(() => {
1569
- switch (h.id) {
1595
+ });
1596
+ M(() => b.formatDate(s.start));
1597
+ const z = M(() => {
1598
+ switch (d.id) {
1570
1599
  case "day":
1571
1600
  return "";
1572
1601
  case "days":
1573
- return p.availableViews.days.rows > 1 && b.formatDate(n.start, "D"), "";
1602
+ return w.availableViews.days.rows > 1 && b.formatDate(s.start, "D"), "";
1574
1603
  case "week":
1575
1604
  return "";
1576
1605
  case "month":
1577
- return b.formatDate(n.start, "D");
1606
+ return b.formatDate(s.start, "D");
1578
1607
  case "year":
1579
- return b.formatDate(n.start, p.xs ? "MMM" : "MMMM");
1608
+ return b.formatDate(s.start, w.xs ? "MMM" : "MMMM");
1580
1609
  case "years":
1581
- return b.formatDate(n.start, "YYYY");
1610
+ return b.formatDate(s.start, "YYYY");
1582
1611
  }
1583
- }), l = $(() => p.datePicker ? [] : H.getEventsByDate(A.value, !0, !0).filter((u) => !T.value.includes(u._.id))), _ = $(() => l.value.filter((u) => !u.background)), t = $(() => {
1584
- var u;
1585
- return (u = p.schedules) == null ? void 0 : u.reduce((k, E) => (k[E.id] = l.value.filter((Y) => Y.schedule === E.id), k), {});
1586
- }), C = $(() => {
1587
- const u = {};
1588
- for (const k of l.value) {
1589
- const E = k._.id, { maxConcurrent: Y = 1, position: z = 0 } = m.value.cellOverlaps[E] || {};
1590
- u[E] = { left: `${100 / Y * z}%` }, p.stackEvents ? u[E].width = `${100 / Y + (z === Y - 1 ? 0 : 15)}%` : u[E].width = `${100 / Y}%`;
1612
+ }), D = M(() => w.datePicker ? [] : H.getEventsInRange(s.start, s.end, { excludeIds: Y.value })), l = M(() => D.value.filter((i) => !i.background)), p = M(() => {
1613
+ var i;
1614
+ return (i = w.schedules) == null ? void 0 : i.reduce((T, S) => (T[S.id] = D.value.filter(($) => $.schedule === S.id), T), {});
1615
+ }), k = M(() => {
1616
+ if (d.isMonth || d.isYear || d.isYears) return {};
1617
+ const i = {};
1618
+ for (const T of D.value) {
1619
+ const S = T._.id, { maxConcurrent: $ = 1, position: I = 0 } = h.value.cellOverlaps[S] || {};
1620
+ i[S] = { left: `${100 / $ * I}%` }, w.stackEvents ? i[S].width = `${100 / $ + (I === $ - 1 ? 0 : 15)}%` : i[S].width = `${100 / $}%`;
1591
1621
  }
1592
- return u;
1593
- }), L = $(() => {
1594
- const u = {};
1595
- for (const k of l.value) {
1596
- const E = k._.id, { maxConcurrent: Y = 1, position: z = 0 } = m.value.cellOverlaps[E] || {};
1597
- u[E] = `vuecal__event--stack-${z + 1}-${Y}`;
1622
+ return i;
1623
+ }), a = M(() => {
1624
+ const i = {};
1625
+ for (const T of D.value) {
1626
+ const S = T._.id, { maxConcurrent: $ = 1, position: I = 0 } = h.value.cellOverlaps[S] || {};
1627
+ i[S] = `vuecal__event--stack-${I + 1}-${$}`;
1598
1628
  }
1599
- return u;
1600
- }), J = $(() => h.isMonth && p.eventCount && !p.eventsOnMonthView && _.value.length), Z = $(() => {
1601
- var E;
1602
- if (!p.specialHours || h.isMonth || h.isYear || h.isYears) return;
1603
- const u = Re[n.start.getDay()];
1604
- let k = (E = p.specialHours) == null ? void 0 : E[u];
1605
- if (k)
1606
- return Array.isArray(k) || (k = [k]), k.map((Y) => {
1607
- let { from: z, to: I, class: ae, label: d } = Y;
1608
- if (isNaN(z) || isNaN(I) || p.timeFrom >= I || p.timeTo <= z) return;
1609
- z = Math.max(p.timeFrom, z), I = Math.min(p.timeTo, I);
1610
- const F = Ve(z, p), X = Ve(I, p) - F;
1629
+ return i;
1630
+ }), O = M(() => w.showCellEventCount && l.value.length), B = M(() => {
1631
+ var S;
1632
+ if (!w.specialHours || d.isMonth || d.isYear || d.isYears) return;
1633
+ const i = Re[s.start.getDay()];
1634
+ let T = (S = w.specialHours) == null ? void 0 : S[i];
1635
+ if (T)
1636
+ return Array.isArray(T) || (T = [T]), T.map(($) => {
1637
+ let { from: I, to: G, class: ne, label: De } = $;
1638
+ if (isNaN(I) || isNaN(G) || w.timeFrom >= G || w.timeTo <= I) return;
1639
+ I = Math.max(w.timeFrom, I), G = Math.min(w.timeTo, G);
1640
+ const v = Ve(I, w), N = Ve(G, w) - v;
1611
1641
  return {
1612
- style: { top: `${F}%`, height: `${X}%` },
1613
- label: d,
1614
- class: ae
1642
+ style: { top: `${v}%`, height: `${N}%` },
1643
+ label: De,
1644
+ class: ne
1615
1645
  };
1616
- }).filter((Y) => !!Y);
1617
- }), ue = $(() => p.minTimestamp !== null && p.minTimestamp > n.end.getTime()), ce = $(() => p.maxTimestamp && p.maxTimestamp < n.start.getTime()), de = $(() => {
1618
- const { disableDays: u } = p, k = h.isYear || h.isYears;
1619
- return u.length && u.includes(b.formatDate(n.start)) && !k ? !0 : ue.value || ce.value;
1620
- }), pe = $e({
1621
- show: $(() => {
1622
- if (!(!h.isDay && !h.isDays && !h.isWeek) && !(!i.value || !p.time) && !(p.timeFrom > b.dateToMinutes(h.now)) && !(b.dateToMinutes(h.now) > p.timeTo))
1646
+ }).filter(($) => !!$);
1647
+ }), R = M(() => w.minTimestamp !== null && w.minTimestamp > s.end.getTime()), oe = M(() => w.maxTimestamp && w.maxTimestamp < s.start.getTime()), te = M(() => {
1648
+ const { disableDays: i } = w, T = d.isYear || d.isYears;
1649
+ return i.length && i.includes(b.formatDate(s.start)) && !T ? !0 : R.value || oe.value;
1650
+ }), se = $e({
1651
+ show: M(() => {
1652
+ if (!(!d.isDay && !d.isDays && !d.isWeek) && !(!u.value || !w.time) && !(w.timeFrom > b.dateToMinutes(d.now)) && !(b.dateToMinutes(d.now) > w.timeTo))
1623
1653
  return !0;
1624
1654
  }),
1625
- nowInMinutes: $(() => b.dateToMinutes(h.now)),
1626
- todaysTimePosition: $(() => Ve(pe.nowInMinutes, p)),
1627
- style: $(() => `top: ${pe.todaysTimePosition}%`),
1628
- currentTime: $(() => b.formatTime(h.now))
1629
- }), oe = $(() => {
1630
- if (de.value) return {};
1631
- const u = { ...p.eventListeners.cell };
1632
- for (const [Y, z] of Object.entries(u))
1633
- u[Y] = (I) => {
1634
- var ae, d, F;
1635
- (F = (d = I.target || ((ae = I.e) == null ? void 0 : ae.target)).closest) != null && F.call(d, ".vuecal__event") || z(I.type ? { e: I, cell: K.value, cursor: x.value } : I);
1655
+ nowInMinutes: M(() => b.dateToMinutes(d.now)),
1656
+ todaysTimePosition: M(() => Ve(se.nowInMinutes, w)),
1657
+ style: M(() => `top: ${se.todaysTimePosition}%`),
1658
+ currentTime: M(() => b.formatTime(d.now))
1659
+ }), ce = M(() => {
1660
+ if (te.value) return {};
1661
+ const i = { ...w.eventListeners.cell };
1662
+ for (const [$, I] of Object.entries(i))
1663
+ i[$] = (G) => {
1664
+ var ne, De, v;
1665
+ (v = (De = G.target || ((ne = G.e) == null ? void 0 : ne.target)).closest) != null && v.call(De, ".vuecal__event") || I(G.type ? { e: G, cell: X.value, cursor: Q.value } : G);
1636
1666
  };
1637
- const k = { ...u };
1638
- let E = null;
1639
- return u.click = (Y) => {
1640
- var I;
1641
- a();
1642
- const z = ee(Y);
1643
- (I = k.click) == null || I.call(k, { e: Y, cell: K.value, cursor: z }), E ? E = clearTimeout(E) : E = setTimeout(() => {
1644
- var ae;
1645
- E = null, (ae = k["delayed-click"]) == null || ae.call(k, { e: Y, cell: K.value, cursor: z });
1667
+ const T = { ...i };
1668
+ let S = null;
1669
+ return i.click = ($) => {
1670
+ var G;
1671
+ le();
1672
+ const I = Ee($);
1673
+ (G = T.click) == null || G.call(T, { e: $, cell: X.value, cursor: I }), S ? S = clearTimeout(S) : S = setTimeout(() => {
1674
+ var ne;
1675
+ S = null, (ne = T["delayed-click"]) == null || ne.call(T, { e: $, cell: X.value, cursor: I });
1646
1676
  }, 400);
1647
- }, (p.time && h.isDay || h.isDays || h.isWeek) && (u.touchstart = (Y) => {
1648
- var z;
1649
- w(Y.e || Y), (z = k.touchstart) == null || z.call(k, { e: Y, cell: K.value, cursor: x.value });
1650
- }, u.mousedown = (Y) => {
1651
- var z;
1652
- w(Y.e || Y), (z = k.mousedown) == null || z.call(k, { e: Y, cell: K.value, cursor: x.value });
1653
- }), k.dblclick && (u.dblclick = (Y) => {
1654
- var z;
1655
- (z = k.dblclick) == null || z.call(k, { e: Y, cell: K.value, cursor: ee(Y) });
1656
- }), p.editableEvents.drag && (u.dragenter = (Y) => v.cellDragEnter(Y, K.value), u.dragover = (Y) => {
1657
- Y.preventDefault(), v.cellDragOver(Y, K.value);
1658
- }, u.dragleave = (Y) => v.cellDragLeave(Y, K.value), u.drop = (Y) => v.cellDragDrop(Y, K.value)), u;
1659
- }), K = $(() => ({
1660
- start: n.start,
1661
- end: n.end,
1662
- events: l,
1663
- ...c.schedule ? { schedule: c.schedule } : {},
1664
- goNarrower: () => h.narrower(),
1665
- goBroader: () => h.broader(),
1666
- broader: h.broaderView,
1667
- narrower: h.narrowerView
1668
- })), ee = (u) => {
1669
- var I;
1670
- const k = (((I = u.touches) == null ? void 0 : I[0]) || u).clientY, { top: E } = f.value.getBoundingClientRect(), Y = Ze(k - E, f.value), z = new Date(n.start);
1671
- return z.setMinutes(Pe(Y, p)), { y: Y, date: z };
1672
- }, x = $(() => {
1673
- const u = Pe(c.movePercentageY || c.startPercentageY, p), k = new Date(n.start);
1674
- return k.setMinutes(u), {
1675
- x: c.movePercentageX || c.startPercentageX,
1676
- y: c.movePercentageY || c.startPercentageY,
1677
- date: k
1677
+ }, (w.time && d.isDay || d.isDays || d.isWeek) && (i.touchstart = ($) => {
1678
+ var I;
1679
+ n($.e || $), (I = T.touchstart) == null || I.call(T, { e: $, cell: X.value, cursor: Q.value });
1680
+ }, i.mousedown = ($) => {
1681
+ var I;
1682
+ n($.e || $), (I = T.mousedown) == null || I.call(T, { e: $, cell: X.value, cursor: Q.value });
1683
+ }), T.dblclick && (i.dblclick = ($) => {
1684
+ var I;
1685
+ (I = T.dblclick) == null || I.call(T, { e: $, cell: X.value, cursor: Ee($) });
1686
+ }), w.editableEvents.drag && (i.dragenter = ($) => f.cellDragEnter($, X.value), i.dragover = ($) => {
1687
+ $.preventDefault(), f.cellDragOver($, X.value);
1688
+ }, i.dragleave = ($) => f.cellDragLeave($, X.value), i.drop = ($) => f.cellDragDrop($, X.value)), i;
1689
+ }), X = M(() => ({
1690
+ start: s.start,
1691
+ end: s.end,
1692
+ events: D,
1693
+ ...o.schedule ? { schedule: o.schedule } : {},
1694
+ goNarrower: () => d.narrower(),
1695
+ goBroader: () => d.broader(),
1696
+ broader: d.broaderView,
1697
+ narrower: d.narrowerView
1698
+ })), Ee = (i) => {
1699
+ var G;
1700
+ const T = (((G = i.touches) == null ? void 0 : G[0]) || i).clientY, { top: S } = m.value.getBoundingClientRect(), $ = Ze(T - S, m.value), I = new Date(s.start);
1701
+ return I.setMinutes(Fe($, w)), { y: $, date: I };
1702
+ }, Q = M(() => {
1703
+ const i = Fe(o.movePercentageY || o.startPercentageY, w), T = new Date(s.start);
1704
+ return T.setMinutes(i), {
1705
+ x: o.movePercentageX || o.startPercentageX,
1706
+ y: o.movePercentageY || o.startPercentageY,
1707
+ date: T
1678
1708
  };
1679
- }), a = () => {
1680
- h.updateSelectedDate(n.start), p.clickToNavigate && ((h.isMonth || h.isDays || h.isWeek) && p.availableViews.day ? h.switch("day") : h.isYear && p.availableViews.month ? h.switch("month") : h.isYears && p.availableViews.year && h.switch("year")), h.updateViewDate(n.start);
1681
- }, w = (u) => {
1682
- var E, Y;
1683
- c.schedule = ~~u.target.dataset.schedule;
1684
- const k = f.value.getBoundingClientRect();
1685
- c.startX = (((E = u.touches) == null ? void 0 : E[0]) || u).clientX - k.left, c.startY = (((Y = u.touches) == null ? void 0 : Y[0]) || u).clientY - k.top, c.startPercentageX = c.startX * 100 / k.width, c.startPercentageY = c.startY * 100 / k.height, c.thresholdPassed = !1, document.addEventListener(u.type === "touchstart" ? "touchmove" : "mousemove", y), document.addEventListener(u.type === "touchstart" ? "touchend" : "mouseup", B, { once: !0 }), c.holdTimer = setTimeout(() => {
1686
- var z, I;
1687
- c.holding = !0, (I = (z = oe.value).hold) == null || I.call(z, { e: u, cell: K.value, cursor: x.value });
1709
+ }), le = () => {
1710
+ d.updateSelectedDate(s.start), w.clickToNavigate && ((d.isMonth || d.isDays || d.isWeek) && w.availableViews.day ? d.switch("day") : d.isYear && w.availableViews.month ? d.switch("month") : d.isYears && w.availableViews.year && d.switch("year")), d.updateViewDate(s.start);
1711
+ }, n = (i) => {
1712
+ var S, $;
1713
+ o.schedule = ~~i.target.dataset.schedule;
1714
+ const T = m.value.getBoundingClientRect();
1715
+ o.startX = (((S = i.touches) == null ? void 0 : S[0]) || i).clientX - T.left, o.startY = ((($ = i.touches) == null ? void 0 : $[0]) || i).clientY - T.top, o.startPercentageX = o.startX * 100 / T.width, o.startPercentageY = o.startY * 100 / T.height, o.thresholdPassed = !1, document.addEventListener(i.type === "touchstart" ? "touchmove" : "mousemove", _), document.addEventListener(i.type === "touchstart" ? "touchend" : "mouseup", g, { once: !0 }), o.holdTimer = setTimeout(() => {
1716
+ var I, G;
1717
+ o.holding = !0, (G = (I = ce.value).hold) == null || G.call(I, { e: i, cell: X.value, cursor: Q.value });
1688
1718
  }, 1e3);
1689
- }, y = (u) => {
1690
- var E, Y, z, I, ae, d;
1691
- c.dragging || (j.isDraggingCell = !0, (Y = (E = oe.value).dragStart) == null || Y.call(E, { e: u, cell: K.value, cursor: x.value })), c.dragging = !0, c.holdTimer = clearTimeout(c.holdTimer), c.holding = !1;
1692
- const k = f.value.getBoundingClientRect();
1693
- c.moveX = (((z = u.touches) == null ? void 0 : z[0]) || u).clientX - k.left, c.moveY = (((I = u.touches) == null ? void 0 : I[0]) || u).clientY - k.top, c.movePercentageX = c.moveX * 100 / k.width, c.movePercentageY = c.moveY * 100 / k.height, p.eventCreateMinDrag && Math.abs(c.startY - c.moveY) > p.eventCreateMinDrag && (c.thresholdPassed = !0), (d = (ae = oe.value).drag) == null || d.call(ae, { e: u, cell: K.value, cursor: x.value });
1694
- }, B = async (u) => {
1695
- var k, E;
1696
- document.removeEventListener(u.type === "touchend" ? "touchmove" : "mousemove", y, { passive: !1 }), c.dragging && ((E = (k = oe.value)["drag-end"]) == null || E.call(k, { e: u, cell: K.value, cursor: x.value }), j.isDraggingCell = !1, p.editableEvents.create && (e.value = !0, await Q(u), e.value = !1)), c.holdTimer = clearTimeout(c.holdTimer), c.holding = !1, c.dragging = !1, c.startX = 0, c.startY = 0, c.moveX = 0, c.moveY = 0, c.startPercentageX = 0, c.startPercentageY = 0, c.movePercentageX = 0, c.movePercentageY = 0, c.thresholdPassed = !1, c.schedule = null;
1697
- }, Q = async (u) => {
1698
- if (!M.value) return;
1699
- let { start: k, end: E, startMinutes: Y, endMinutes: z } = g.value;
1700
- k = new Date(n.start), k.setMinutes(Y), E = new Date(n.start), E.setMinutes(z);
1701
- let I = { ...g.value, start: k, end: E };
1702
- const { create: ae } = p.eventListeners.event;
1703
- if (typeof ae == "function") {
1704
- const d = I;
1705
- I = await new Promise((F) => ae({ e: u, event: I, cell: K.value, resolve: F, cursor: x.value })), I && typeof I == "object" && h.createEvent(I), I && typeof I == "boolean" && h.createEvent(d);
1706
- } else h.createEvent(I);
1719
+ }, _ = (i) => {
1720
+ var S, $, I, G, ne, De;
1721
+ o.dragging || (F.isDraggingCell = !0, ($ = (S = ce.value)["drag-start"]) == null || $.call(S, { e: i, cell: X.value, cursor: Q.value })), o.dragging = !0, o.holdTimer = clearTimeout(o.holdTimer), o.holding = !1;
1722
+ const T = m.value.getBoundingClientRect();
1723
+ o.moveX = (((I = i.touches) == null ? void 0 : I[0]) || i).clientX - T.left, o.moveY = (((G = i.touches) == null ? void 0 : G[0]) || i).clientY - T.top, o.movePercentageX = o.moveX * 100 / T.width, o.movePercentageY = o.moveY * 100 / T.height, w.eventCreateMinDrag && Math.abs(o.startY - o.moveY) > w.eventCreateMinDrag && (o.thresholdPassed = !0), (De = (ne = ce.value).drag) == null || De.call(ne, { e: i, cell: X.value, cursor: Q.value });
1724
+ }, g = async (i) => {
1725
+ var T, S;
1726
+ document.removeEventListener(i.type === "touchend" ? "touchmove" : "mousemove", _, { passive: !1 }), o.dragging && ((S = (T = ce.value)["drag-end"]) == null || S.call(T, { e: i, cell: X.value, cursor: Q.value }), F.isDraggingCell = !1, w.editableEvents.create && (e.value = !0, await A(i), e.value = !1)), o.holdTimer = clearTimeout(o.holdTimer), o.holding = !1, o.dragging = !1, o.startX = 0, o.startY = 0, o.moveX = 0, o.moveY = 0, o.startPercentageX = 0, o.startPercentageY = 0, o.movePercentageX = 0, o.movePercentageY = 0, o.thresholdPassed = !1, o.schedule = null;
1727
+ }, A = async (i) => {
1728
+ if (!E.value) return;
1729
+ let { start: T, end: S, startMinutes: $, endMinutes: I } = c.value;
1730
+ T = new Date(s.start), T.setMinutes($), S = new Date(s.start), S.setMinutes(I);
1731
+ let G = { ...c.value, start: T, end: S };
1732
+ const { create: ne } = w.eventListeners.event;
1733
+ if (typeof ne == "function") {
1734
+ const De = G;
1735
+ G = await new Promise((v) => ne({ e: i, event: G, cell: X.value, resolve: v, cursor: Q.value })), G && typeof G == "object" && d.createEvent(G), G && typeof G == "boolean" && d.createEvent(De);
1736
+ } else d.createEvent(G);
1737
+ }, x = () => {
1738
+ var i;
1739
+ for (const T of Object.keys(ce.value))
1740
+ (i = m.value) == null || i.removeEventListener(T, ce.value[T]);
1707
1741
  }, he = () => {
1708
- var u;
1709
- for (const k of Object.keys(oe.value))
1710
- (u = f.value) == null || u.removeEventListener(k, oe.value[k]);
1711
- }, te = () => {
1712
- m.value = H.getCellOverlappingEvents(A.value);
1742
+ h.value = H.getCellOverlappingEvents(s.start, s.end);
1713
1743
  };
1714
1744
  return me(
1715
1745
  // Watch event IDs and start/end dates (only) to detect event resizing/dnd.
1716
- () => _.value.map((u) => `${u._.id}${u.start.getTime()}${u.end.getTime()}`).join(),
1746
+ () => !d.isYears && !d.isYear && l.value.map((i) => `${i._.id}${i.start.getTime()}${i.end.getTime()}`).join(),
1717
1747
  async () => {
1718
- await Ue(), te();
1748
+ await Ue(), he();
1719
1749
  },
1720
1750
  { immediate: !0, flush: "post" }
1721
1751
  // Use flush: 'post' to prevent infinite updates.
1722
1752
  ), Xe(async () => {
1723
- for (const u of T.value) H.deleteEvent(u, 3);
1724
- he(), await Ue();
1725
- }), (u, k) => (S(), O("div", ye({
1726
- class: ["vuecal__cell", P.value],
1753
+ for (const i of Y.value) H.deleteEvent(i, 3);
1754
+ x(), await Ue();
1755
+ }), (i, T) => (C(), j("div", de({
1756
+ class: ["vuecal__cell", L.value],
1727
1757
  ref_key: "cellEl",
1728
- ref: f
1729
- }, Ie(oe.value, !0)), [
1730
- u.$slots.cell ? N(u.$slots, "cell", {
1758
+ ref: m
1759
+ }, Be(ce.value, !0)), [
1760
+ i.$slots.cell ? P(i.$slots, "cell", {
1731
1761
  key: 0,
1732
- cell: K.value
1733
- }) : U("", !0),
1734
- Z.value ? (S(!0), O(ne, { key: 1 }, be(Z.value, (E, Y) => (S(), O("div", {
1735
- class: De(["vuecal__special-hours", E.class]),
1736
- style: ke(E.style),
1737
- innerHTML: E.label || ""
1738
- }, null, 14, na))), 256)) : U("", !0),
1739
- !u.$slots.cell && V(p).schedules ? (S(!0), O(ne, { key: 2 }, be(V(p).schedules, (E) => (S(), O("div", {
1740
- class: De(["vuecal__schedule vuecal__schedule--cell", E.class]),
1741
- key: E.id,
1742
- style: ke(E.style || null),
1743
- "data-schedule": E.id
1762
+ cell: X.value
1763
+ }) : K("", !0),
1764
+ B.value ? (C(!0), j(re, { key: 1 }, ke(B.value, (S, $) => (C(), j("div", {
1765
+ class: ye(["vuecal__special-hours", S.class]),
1766
+ style: _e(S.style),
1767
+ innerHTML: S.label || ""
1768
+ }, null, 14, na))), 256)) : K("", !0),
1769
+ !i.$slots.cell && V(w).schedules ? (C(!0), j(re, { key: 2 }, ke(V(w).schedules, (S) => (C(), j("div", {
1770
+ class: ye(["vuecal__schedule vuecal__schedule--cell", S.class]),
1771
+ key: S.id,
1772
+ style: _e(S.style || null),
1773
+ "data-schedule": S.id
1744
1774
  }, [
1745
- u.$slots["cell-events"] ? N(u.$slots, "cell-events", {
1775
+ i.$slots["cell-events"] ? P(i.$slots, "cell-events", {
1746
1776
  key: 0,
1747
- cell: K.value
1748
- }) : U("", !0),
1749
- s.value || u.$slots["cell-date"] ? (S(), O("div", la, [
1750
- N(u.$slots, "cell-date", { cell: K.value }, () => [
1751
- et(re(s.value), 1)
1777
+ cell: X.value
1778
+ }) : K("", !0),
1779
+ z.value || i.$slots["cell-date"] ? (C(), j("div", la, [
1780
+ P(i.$slots, "cell-date", { cell: X.value }, () => [
1781
+ et(ie(z.value), 1)
1752
1782
  ])
1753
- ])) : U("", !0),
1754
- u.$slots["cell-content"] ? (S(), O("div", ra, [
1755
- N(u.$slots, "cell-content", { cell: K.value })
1756
- ])) : U("", !0),
1757
- u.$slots["cell-events"] && l.value.length ? (S(), O("div", oa, [
1758
- N(u.$slots, "cell-events", { cell: K.value })
1759
- ])) : l.value.length || W.value ? (S(), Se(tt, {
1783
+ ])) : K("", !0),
1784
+ i.$slots["cell-content"] ? (C(), j("div", ra, [
1785
+ P(i.$slots, "cell-content", { cell: X.value })
1786
+ ])) : K("", !0),
1787
+ i.$slots["cell-events"] && D.value.length ? (C(), j("div", oa, [
1788
+ P(i.$slots, "cell-events", { cell: X.value })
1789
+ ])) : D.value.length || W.value ? (C(), Se(tt, {
1760
1790
  key: 4,
1761
1791
  class: "vuecal__cell-events",
1762
1792
  name: "vuecal-event-delete",
1763
- onBeforeLeave: k[0] || (k[0] = (Y) => W.value = !0),
1764
- onAfterLeave: o,
1793
+ onBeforeLeave: T[0] || (T[0] = ($) => W.value = !0),
1794
+ onAfterLeave: t,
1765
1795
  tag: "div"
1766
1796
  }, {
1767
- default: q(() => [
1768
- (S(!0), O(ne, null, be(t.value[E.id], (Y) => (S(), Se(nt, {
1769
- key: Y._.id,
1770
- event: Y,
1771
- onEventDeleted: R,
1772
- style: ke(C.value[Y._.id])
1797
+ default: J(() => [
1798
+ (C(!0), j(re, null, ke(p.value[S.id], ($) => (C(), Se(nt, {
1799
+ key: $._.id,
1800
+ event: $,
1801
+ onEventDeleted: q,
1802
+ style: _e(k.value[$._.id])
1773
1803
  }, je({ _: 2 }, [
1774
- u.$slots.event ? {
1804
+ i.$slots.event ? {
1775
1805
  name: "event",
1776
- fn: q((z) => [
1777
- N(u.$slots, "event", ye({ ref_for: !0 }, z))
1806
+ fn: J((I) => [
1807
+ P(i.$slots, "event", de({ ref_for: !0 }, I))
1778
1808
  ]),
1779
1809
  key: "0"
1780
1810
  } : void 0
1781
1811
  ]), 1032, ["event", "style"]))), 128))
1782
1812
  ]),
1783
1813
  _: 2
1784
- }, 1024)) : U("", !0),
1785
- M.value && c.schedule === E.id ? (S(), O("div", {
1814
+ }, 1024)) : K("", !0),
1815
+ E.value && o.schedule === S.id ? (C(), j("div", {
1786
1816
  key: 5,
1787
1817
  class: "vuecal__event-placeholder",
1788
- style: ke(g.value.style)
1789
- }, re(g.value.start) + " - " + re(g.value.end), 5)) : U("", !0)
1790
- ], 14, sa))), 128)) : U("", !0),
1791
- !u.$slots.cell && !V(p).schedules ? (S(), O(ne, { key: 3 }, [
1792
- u.$slots["cell-events"] ? N(u.$slots, "cell-events", {
1818
+ style: _e(c.value.style)
1819
+ }, ie(c.value.start) + " - " + ie(c.value.end), 5)) : K("", !0)
1820
+ ], 14, sa))), 128)) : K("", !0),
1821
+ !i.$slots.cell && !V(w).schedules ? (C(), j(re, { key: 3 }, [
1822
+ i.$slots["cell-events"] ? P(i.$slots, "cell-events", {
1793
1823
  key: 0,
1794
- cell: K.value
1795
- }) : U("", !0),
1796
- s.value || u.$slots["cell-date"] ? (S(), O("div", ia, [
1797
- N(u.$slots, "cell-date", { cell: K.value }, () => [
1798
- et(re(s.value), 1)
1824
+ cell: X.value
1825
+ }) : K("", !0),
1826
+ z.value || i.$slots["cell-date"] ? (C(), j("div", ia, [
1827
+ P(i.$slots, "cell-date", { cell: X.value }, () => [
1828
+ et(ie(z.value), 1)
1799
1829
  ])
1800
- ])) : U("", !0),
1801
- u.$slots["cell-content"] ? (S(), O("div", ua, [
1802
- N(u.$slots, "cell-content", { cell: K.value })
1803
- ])) : U("", !0),
1804
- u.$slots["cell-events"] && l.value.length ? (S(), O("div", ca, [
1805
- N(u.$slots, "cell-events", { cell: K.value })
1806
- ])) : (l.value.length || W.value) && !(V(h).isMonth && !V(p).eventsOnMonthView) ? (S(), Se(tt, {
1830
+ ])) : K("", !0),
1831
+ i.$slots["cell-content"] ? (C(), j("div", ua, [
1832
+ P(i.$slots, "cell-content", { cell: X.value })
1833
+ ])) : K("", !0),
1834
+ i.$slots["cell-events"] && D.value.length ? (C(), j("div", ca, [
1835
+ P(i.$slots, "cell-events", { cell: X.value })
1836
+ ])) : !(V(d).isMonth && !V(w).eventsOnMonthView) && !V(d).isYear && !V(d).isYears && (D.value.length || W.value) ? (C(), Se(tt, {
1807
1837
  key: 4,
1808
1838
  class: "vuecal__cell-events",
1809
1839
  name: "vuecal-event-delete",
1810
- onBeforeLeave: k[1] || (k[1] = (E) => W.value = !0),
1811
- onAfterLeave: o,
1840
+ onBeforeLeave: T[1] || (T[1] = (S) => W.value = !0),
1841
+ onAfterLeave: t,
1812
1842
  tag: "div"
1813
1843
  }, {
1814
- default: q(() => [
1815
- (S(!0), O(ne, null, be(l.value, (E) => (S(), Se(nt, {
1816
- key: E._.id,
1817
- event: E,
1818
- onEventDeleted: R,
1819
- class: De(L.value[E._.id]),
1820
- style: ke(C.value[E._.id])
1844
+ default: J(() => [
1845
+ (C(!0), j(re, null, ke(D.value, (S) => (C(), Se(nt, {
1846
+ key: S._.id,
1847
+ event: S,
1848
+ onEventDeleted: q,
1849
+ class: ye(a.value[S._.id]),
1850
+ style: _e(k.value[S._.id])
1821
1851
  }, je({ _: 2 }, [
1822
- u.$slots.event ? {
1852
+ i.$slots.event ? {
1823
1853
  name: "event",
1824
- fn: q((Y) => [
1825
- N(u.$slots, "event", ye({ ref_for: !0 }, Y))
1854
+ fn: J(($) => [
1855
+ P(i.$slots, "event", de({ ref_for: !0 }, $))
1826
1856
  ]),
1827
1857
  key: "0"
1828
1858
  } : void 0
1829
1859
  ]), 1032, ["event", "class", "style"]))), 128))
1830
1860
  ]),
1831
1861
  _: 3
1832
- })) : U("", !0),
1833
- M.value ? (S(), O("div", {
1862
+ })) : K("", !0),
1863
+ E.value ? (C(), j("div", {
1834
1864
  key: 5,
1835
1865
  class: "vuecal__event-placeholder",
1836
- style: ke(g.value.style)
1837
- }, re(g.value.start) + " - " + re(g.value.end), 5)) : U("", !0)
1838
- ], 64)) : U("", !0),
1839
- u.$slots["event-count"] ? N(u.$slots, "event-count", {
1866
+ style: _e(c.value.style)
1867
+ }, ie(c.value.start) + " - " + ie(c.value.end), 5)) : K("", !0)
1868
+ ], 64)) : K("", !0),
1869
+ i.$slots["event-count"] ? P(i.$slots, "event-count", {
1840
1870
  key: 4,
1841
- events: _.value
1842
- }) : J.value ? (S(), O("div", da, re(_.value.length), 1)) : U("", !0),
1843
- pe.show ? (S(), O("div", {
1871
+ events: l.value
1872
+ }) : O.value ? (C(), j("div", da, ie(l.value.length), 1)) : K("", !0),
1873
+ se.show ? (C(), j("div", {
1844
1874
  key: 6,
1845
1875
  class: "vuecal__now-line",
1846
- style: ke(pe.style),
1847
- title: pe.currentTime
1876
+ style: _e(se.style),
1877
+ title: se.currentTime
1848
1878
  }, [
1849
- ge("span", null, re(pe.currentTime), 1)
1850
- ], 12, va)) : U("", !0)
1879
+ ge("span", null, ie(se.currentTime), 1)
1880
+ ], 12, va)) : K("", !0)
1851
1881
  ], 16));
1852
1882
  }
1853
1883
  }, fa = {
1854
1884
  __name: "body",
1855
- setup(D) {
1856
- const n = Ne("vuecal"), { view: r, config: h, dateUtils: p } = n, b = ie(null), H = ie(null), v = $(() => ({
1885
+ setup(y) {
1886
+ const s = Ne("vuecal"), { view: r, config: d, dateUtils: w } = s, b = ue(null), H = ue(null), f = M(() => ({
1857
1887
  "--vuecal-grid-columns": r.cols,
1858
1888
  "--vuecal-grid-rows": r.rows
1859
- })), j = $(() => {
1860
- const T = p.formatTime(Pe(H.value, h));
1889
+ })), F = M(() => {
1890
+ const Y = w.formatTime(Fe(H.value, d));
1861
1891
  return {
1862
1892
  style: { top: `${H.value}%` },
1863
- time: T
1893
+ time: Y
1864
1894
  };
1865
- }), i = (T) => {
1866
- var o;
1895
+ }), u = (Y) => {
1896
+ var t;
1867
1897
  if (r.isMonth || r.isYear || r.isYears) return;
1868
- const W = (((o = T.touches) == null ? void 0 : o[0]) || T).clientY, { top: R } = b.value.getBoundingClientRect();
1869
- H.value = Ze(W - R, b.value);
1870
- }, f = () => {
1898
+ const W = (((t = Y.touches) == null ? void 0 : t[0]) || Y).clientY, { top: q } = b.value.getBoundingClientRect();
1899
+ H.value = Ze(W - q, b.value);
1900
+ }, m = () => {
1871
1901
  H.value = null;
1872
1902
  };
1873
1903
  return qe(() => {
1874
- b.value.addEventListener("mousemove", i), b.value.addEventListener("touchmove", i), b.value.addEventListener("mouseleave", f), b.value.addEventListener("touchend", f);
1904
+ b.value.addEventListener("mousemove", u), b.value.addEventListener("touchmove", u), b.value.addEventListener("mouseleave", m), b.value.addEventListener("touchend", m);
1875
1905
  }), Xe(() => {
1876
- b.value && (b.value.removeEventListener("mousemove", i), b.value.removeEventListener("touchmove", i), b.value.removeEventListener("mouseleave", f), b.value.removeEventListener("touchend", f));
1877
- }), (T, W) => (S(), O("div", {
1906
+ b.value && (b.value.removeEventListener("mousemove", u), b.value.removeEventListener("touchmove", u), b.value.removeEventListener("mouseleave", m), b.value.removeEventListener("touchend", m));
1907
+ }), (Y, W) => (C(), j("div", {
1878
1908
  class: "vuecal__body",
1879
1909
  ref_key: "bodyEl",
1880
1910
  ref: b,
1881
- style: ke(v.value)
1911
+ style: _e(f.value)
1882
1912
  }, [
1883
1913
  Oe(Ge, { name: "vuecal-shrink" }, {
1884
- default: q(() => [
1885
- V(h).timeAtCursor && H.value !== null ? (S(), O("div", {
1914
+ default: J(() => [
1915
+ V(d).timeAtCursor && H.value !== null ? (C(), j("div", {
1886
1916
  key: 0,
1887
1917
  class: "vuecal__time-at-cursor",
1888
- style: ke(j.value.style)
1918
+ style: _e(F.value.style)
1889
1919
  }, [
1890
- ge("label", null, re(j.value.time), 1)
1891
- ], 4)) : U("", !0)
1920
+ ge("label", null, ie(F.value.time), 1)
1921
+ ], 4)) : K("", !0)
1892
1922
  ]),
1893
1923
  _: 1
1894
1924
  }),
1895
- (S(!0), O(ne, null, be(V(r).cellDates, (R, o) => (S(), Se(ma, {
1896
- key: o,
1897
- start: R.start,
1898
- end: R.end,
1899
- index: o
1925
+ (C(!0), j(re, null, ke(V(r).cellDates, (q, t) => (C(), Se(ma, {
1926
+ key: t,
1927
+ start: q.start,
1928
+ end: q.end,
1929
+ index: t
1900
1930
  }, je({ _: 2 }, [
1901
- T.$slots.cell ? {
1931
+ Y.$slots.cell ? {
1902
1932
  name: "cell",
1903
- fn: q((c) => [
1904
- N(T.$slots, "cell", ye({ ref_for: !0 }, c))
1933
+ fn: J((o) => [
1934
+ P(Y.$slots, "cell", de({ ref_for: !0 }, o))
1905
1935
  ]),
1906
1936
  key: "0"
1907
1937
  } : void 0,
1908
- T.$slots["cell-date"] ? {
1938
+ Y.$slots["cell-date"] ? {
1909
1939
  name: "cell-date",
1910
- fn: q((c) => [
1911
- N(T.$slots, "cell-date", ye({ ref_for: !0 }, c))
1940
+ fn: J((o) => [
1941
+ P(Y.$slots, "cell-date", de({ ref_for: !0 }, o))
1912
1942
  ]),
1913
1943
  key: "1"
1914
1944
  } : void 0,
1915
- T.$slots["cell-content"] ? {
1945
+ Y.$slots["cell-content"] ? {
1916
1946
  name: "cell-content",
1917
- fn: q((c) => [
1918
- N(T.$slots, "cell-content", ye({ ref_for: !0 }, c))
1947
+ fn: J((o) => [
1948
+ P(Y.$slots, "cell-content", de({ ref_for: !0 }, o))
1919
1949
  ]),
1920
1950
  key: "2"
1921
1951
  } : void 0,
1922
- T.$slots["cell-events"] ? {
1952
+ Y.$slots["cell-events"] ? {
1923
1953
  name: "cell-events",
1924
- fn: q((c) => [
1925
- N(T.$slots, "cell-events", ye({ ref_for: !0 }, c))
1954
+ fn: J((o) => [
1955
+ P(Y.$slots, "cell-events", de({ ref_for: !0 }, o))
1926
1956
  ]),
1927
1957
  key: "3"
1928
- } : T.$slots.event ? {
1958
+ } : Y.$slots.event ? {
1929
1959
  name: "event",
1930
- fn: q((c) => [
1931
- N(T.$slots, "event", ye({ ref_for: !0 }, c))
1960
+ fn: J((o) => [
1961
+ P(Y.$slots, "event", de({ ref_for: !0 }, o))
1932
1962
  ]),
1933
1963
  key: "4"
1934
- } : T.$slots["event-count"] ? {
1964
+ } : Y.$slots["event-count"] ? {
1935
1965
  name: "event-count",
1936
- fn: q((c) => [
1937
- N(T.$slots, "event-count", ye({ ref_for: !0 }, c))
1966
+ fn: J((o) => [
1967
+ P(Y.$slots, "event-count", de({ ref_for: !0 }, o))
1938
1968
  ]),
1939
1969
  key: "5"
1940
1970
  } : void 0
@@ -1946,7 +1976,7 @@ const st = (D, n) => {
1946
1976
  class: "vuecal__week-numbers"
1947
1977
  }, Da = { class: "vuecal__week-number" }, pa = { class: "vuecal__body-wrap" }, _a = {
1948
1978
  __name: "index",
1949
- props: Pt,
1979
+ props: Ft,
1950
1980
  emits: [
1951
1981
  "ready",
1952
1982
  "view-change",
@@ -1956,132 +1986,176 @@ const st = (D, n) => {
1956
1986
  "update:events",
1957
1987
  "event-delete",
1958
1988
  "event-created",
1959
- "event-dropped"
1989
+ "event-dropped",
1990
+ "event-drag-start",
1991
+ "event-drag-end"
1960
1992
  ],
1961
- setup(D, { expose: n, emit: r }) {
1962
- const h = D, p = r, b = _t("vuecal-el"), H = Ot({ props: h, emit: p, attrs: bt(), vuecalEl: b, uid: kt() }), { config: v, view: j, dateUtils: i, touch: f } = H, T = $(() => v.time && (j.isDay || j.isDays || j.isWeek)), W = $(() => Array(j.rows).fill().map((e, m) => i.getWeek(i.addDays(j.firstCellDate, 7 * m)))), R = $(() => {
1993
+ setup(y, { expose: s, emit: r }) {
1994
+ const d = y, w = r, b = _t("vuecal-el"), H = Ot({ props: d, emit: w, attrs: bt(), vuecalEl: b, uid: kt() }), { config: f, view: F, dateUtils: u, touch: m } = H, Y = M(() => f.time && (F.isDay || F.isDays || F.isWeek)), W = M(() => Array(F.rows).fill().map((e, h) => u.getWeek(u.addDays(F.firstCellDate, 7 * h)))), q = M(() => {
1963
1995
  var e;
1964
1996
  return {
1965
- "vuecal--ready": v.ready,
1966
- [`vuecal--${v.theme}-theme`]: v.theme,
1967
- [`vuecal--${v.size}`]: !0,
1968
- "vuecal--date-picker": v.datePicker,
1969
- "vuecal--dark": v.dark,
1970
- "vuecal--light": !v.dark,
1971
- [`vuecal--${j.id}-view`]: !0,
1972
- "vuecal--view-has-time": T.value,
1973
- "vuecal--timeless": !v.time,
1974
- "vuecal--dragging-cell": f.isDraggingCell,
1975
- "vuecal--dragging-event": f.isDraggingEvent,
1976
- "vuecal--resizing-event": f.isResizingEvent,
1977
- "vuecal--has-schedules": (e = v.schedules) == null ? void 0 : e.length
1997
+ "vuecal--ready": f.ready,
1998
+ [`vuecal--${f.theme}-theme`]: f.theme,
1999
+ [`vuecal--${f.size}`]: !0,
2000
+ "vuecal--date-picker": f.datePicker,
2001
+ "vuecal--dark": f.dark,
2002
+ "vuecal--light": !f.dark,
2003
+ [`vuecal--${F.id}-view`]: !0,
2004
+ "vuecal--view-has-time": Y.value,
2005
+ "vuecal--timeless": !f.time,
2006
+ "vuecal--dragging-cell": m.isDraggingCell,
2007
+ "vuecal--dragging-event": m.isDraggingEvent,
2008
+ "vuecal--resizing-event": m.isResizingEvent,
2009
+ "vuecal--has-schedules": (e = f.schedules) == null ? void 0 : e.length
1978
2010
  };
1979
- }), o = $(() => ({
1980
- "--vuecal-time-cell-height": v.timeCellHeight && `${v.timeCellHeight}px`
1981
- })), c = $(() => {
1982
- var e, m;
2011
+ }), t = M(() => ({
2012
+ "--vuecal-time-cell-height": f.timeCellHeight && `${f.timeCellHeight}px`
2013
+ })), o = M(() => {
2014
+ var e, h;
1983
2015
  return {
1984
- "vuecal__scrollable--row": T.value || v.weekNumbers && j.isMonth,
2016
+ "vuecal__scrollable--row": Y.value || f.weekNumbers && F.isMonth,
1985
2017
  // Keep the states inside the Vue transition wrapper for smooth CSS transitions.
1986
- [`vuecal__scrollable--${j.id}-view`]: !0,
1987
- "vuecal__scrollable--has-schedules": (e = v.schedules) == null ? void 0 : e.length,
1988
- "vuecal__scrollable--no-schedules": !((m = v.schedules) != null && m.length)
2018
+ [`vuecal__scrollable--${F.id}-view`]: !0,
2019
+ "vuecal__scrollable--has-schedules": (e = f.schedules) == null ? void 0 : e.length,
2020
+ "vuecal__scrollable--no-schedules": !((h = f.schedules) != null && h.length)
1989
2021
  };
1990
2022
  });
1991
2023
  return qe(async () => {
1992
- await Ue(), v.ready = !0, p("ready", { config: v, view: j });
1993
- }), Tt("vuecal", H), n({ view: H.view }), (e, m) => (S(), O("div", {
1994
- class: De(["vuecal", R.value]),
2024
+ await Ue(), f.ready = !0, w("ready", { config: f, view: F });
2025
+ }), $t("vuecal", H), s({ view: H.view }), (e, h) => (C(), j("div", {
2026
+ class: ye(["vuecal", q.value]),
1995
2027
  ref: "vuecal-el",
1996
2028
  "data-locale": e.locale,
1997
- style: ke(o.value)
2029
+ style: _e(t.value)
1998
2030
  }, [
1999
- e.$slots.diy ? N(e.$slots, "diy", {
2031
+ e.$slots.diy ? P(e.$slots, "diy", {
2000
2032
  key: 0,
2001
2033
  vuecal: V(H)
2002
- }) : (S(), O(ne, { key: 1 }, [
2034
+ }) : (C(), j(re, { key: 1 }, [
2003
2035
  Oe(At, null, je({ _: 2 }, [
2004
2036
  e.$slots.header ? {
2005
2037
  name: "header",
2006
- fn: q((g) => [
2007
- N(e.$slots, "header", se(le(g)))
2038
+ fn: J((c) => [
2039
+ P(e.$slots, "header", ee(ae(c)))
2008
2040
  ]),
2009
2041
  key: "0"
2010
2042
  } : void 0,
2011
2043
  !e.$slots.header && e.$slots["previous-button"] ? {
2012
2044
  name: "previous-button",
2013
- fn: q((g) => [
2014
- N(e.$slots, "previous-button", se(le(g)))
2045
+ fn: J((c) => [
2046
+ P(e.$slots, "previous-button", ee(ae(c)))
2015
2047
  ]),
2016
2048
  key: "1"
2017
2049
  } : void 0,
2018
2050
  !e.$slots.header && e.$slots["next-button"] ? {
2019
2051
  name: "next-button",
2020
- fn: q((g) => [
2021
- N(e.$slots, "next-button", se(le(g)))
2052
+ fn: J((c) => [
2053
+ P(e.$slots, "next-button", ee(ae(c)))
2022
2054
  ]),
2023
2055
  key: "2"
2024
2056
  } : void 0,
2025
2057
  !e.$slots.header && e.$slots["today-button"] ? {
2026
2058
  name: "today-button",
2027
- fn: q((g) => [
2028
- N(e.$slots, "today-button", se(le(g)))
2059
+ fn: J((c) => [
2060
+ P(e.$slots, "today-button", ee(ae(c)))
2029
2061
  ]),
2030
2062
  key: "3"
2031
2063
  } : void 0,
2032
2064
  !e.$slots.header && e.$slots.title ? {
2033
2065
  name: "title",
2034
- fn: q((g) => [
2035
- N(e.$slots, "title", se(le(g)))
2066
+ fn: J((c) => [
2067
+ P(e.$slots, "title", ee(ae(c)))
2036
2068
  ]),
2037
2069
  key: "4"
2038
2070
  } : void 0,
2071
+ !e.$slots.header && e.$slots["title.day"] ? {
2072
+ name: "title.day",
2073
+ fn: J((c) => [
2074
+ P(e.$slots, "title.day", ee(ae(c)))
2075
+ ]),
2076
+ key: "5"
2077
+ } : void 0,
2078
+ !e.$slots.header && e.$slots["title.days"] ? {
2079
+ name: "title.days",
2080
+ fn: J((c) => [
2081
+ P(e.$slots, "title.days", ee(ae(c)))
2082
+ ]),
2083
+ key: "6"
2084
+ } : void 0,
2085
+ !e.$slots.header && e.$slots["title.week"] ? {
2086
+ name: "title.week",
2087
+ fn: J((c) => [
2088
+ P(e.$slots, "title.week", ee(ae(c)))
2089
+ ]),
2090
+ key: "7"
2091
+ } : void 0,
2092
+ !e.$slots.header && e.$slots["title.month"] ? {
2093
+ name: "title.month",
2094
+ fn: J((c) => [
2095
+ P(e.$slots, "title.month", ee(ae(c)))
2096
+ ]),
2097
+ key: "8"
2098
+ } : void 0,
2099
+ !e.$slots.header && e.$slots["title.year"] ? {
2100
+ name: "title.year",
2101
+ fn: J((c) => [
2102
+ P(e.$slots, "title.year", ee(ae(c)))
2103
+ ]),
2104
+ key: "9"
2105
+ } : void 0,
2106
+ !e.$slots.header && e.$slots["title.years"] ? {
2107
+ name: "title.years",
2108
+ fn: J((c) => [
2109
+ P(e.$slots, "title.years", ee(ae(c)))
2110
+ ]),
2111
+ key: "10"
2112
+ } : void 0,
2039
2113
  !e.$slots.header && e.$slots["schedule-heading"] ? {
2040
2114
  name: "schedule-heading",
2041
- fn: q((g) => [
2042
- N(e.$slots, "schedule-heading", se(le(g)))
2115
+ fn: J((c) => [
2116
+ P(e.$slots, "schedule-heading", ee(ae(c)))
2043
2117
  ]),
2044
- key: "5"
2118
+ key: "11"
2045
2119
  } : void 0
2046
2120
  ]), 1024),
2047
2121
  ge("div", ha, [
2048
2122
  Oe(Ge, {
2049
- name: `vuecal-slide-fade--${V(j).transitionDirection}`
2123
+ name: `vuecal-slide-fade--${V(F).transitionDirection}`
2050
2124
  }, {
2051
- default: q(() => [
2052
- (S(), O("div", {
2053
- class: De(["vuecal__scrollable", c.value]),
2054
- key: V(j).id + V(j).start.getTime()
2125
+ default: J(() => [
2126
+ (C(), j("div", {
2127
+ class: ye(["vuecal__scrollable", o.value]),
2128
+ key: V(F).id + V(F).start.getTime()
2055
2129
  }, [
2056
- T.value ? (S(), Se(Kt, { key: 0 }, je({ _: 2 }, [
2130
+ Y.value ? (C(), Se(Kt, { key: 0 }, je({ _: 2 }, [
2057
2131
  e.$slots["time-cell"] ? {
2058
2132
  name: "time-cell",
2059
- fn: q((g) => [
2060
- N(e.$slots, "time-cell", se(le(g)))
2133
+ fn: J((c) => [
2134
+ P(e.$slots, "time-cell", ee(ae(c)))
2061
2135
  ]),
2062
2136
  key: "0"
2063
2137
  } : void 0
2064
- ]), 1024)) : U("", !0),
2065
- V(v).weekNumbers && V(j).isMonth ? (S(), O("div", ya, [
2066
- (S(!0), O(ne, null, be(W.value, (g) => (S(), O("div", Da, [
2067
- N(e.$slots, "week-number", {}, () => [
2068
- ge("small", null, re(g), 1)
2138
+ ]), 1024)) : K("", !0),
2139
+ V(f).weekNumbers && V(F).isMonth ? (C(), j("div", ya, [
2140
+ (C(!0), j(re, null, ke(W.value, (c) => (C(), j("div", Da, [
2141
+ P(e.$slots, "week-number", {}, () => [
2142
+ ge("small", null, ie(c), 1)
2069
2143
  ])
2070
2144
  ]))), 256))
2071
- ])) : U("", !0),
2145
+ ])) : K("", !0),
2072
2146
  ge("div", pa, [
2073
2147
  Oe(qt, null, je({ _: 2 }, [
2074
2148
  e.$slots["weekday-heading"] ? {
2075
2149
  name: "weekday-heading",
2076
- fn: q((g) => [
2077
- N(e.$slots, "weekday-heading", se(le(g)))
2150
+ fn: J((c) => [
2151
+ P(e.$slots, "weekday-heading", ee(ae(c)))
2078
2152
  ]),
2079
2153
  key: "0"
2080
2154
  } : void 0,
2081
2155
  e.$slots["schedule-heading"] ? {
2082
2156
  name: "schedule-heading",
2083
- fn: q((g) => [
2084
- N(e.$slots, "schedule-heading", se(le(g)))
2157
+ fn: J((c) => [
2158
+ P(e.$slots, "schedule-heading", ee(ae(c)))
2085
2159
  ]),
2086
2160
  key: "1"
2087
2161
  } : void 0
@@ -2089,43 +2163,43 @@ const st = (D, n) => {
2089
2163
  Oe(fa, null, je({ _: 2 }, [
2090
2164
  e.$slots.cell ? {
2091
2165
  name: "cell",
2092
- fn: q((g) => [
2093
- N(e.$slots, "cell", se(le(g)))
2166
+ fn: J((c) => [
2167
+ P(e.$slots, "cell", ee(ae(c)))
2094
2168
  ]),
2095
2169
  key: "0"
2096
2170
  } : void 0,
2097
2171
  !e.$slots.cell && e.$slots["cell-date"] ? {
2098
2172
  name: "cell-date",
2099
- fn: q((g) => [
2100
- N(e.$slots, "cell-date", se(le(g)))
2173
+ fn: J((c) => [
2174
+ P(e.$slots, "cell-date", ee(ae(c)))
2101
2175
  ]),
2102
2176
  key: "1"
2103
2177
  } : void 0,
2104
2178
  !e.$slots.cell && e.$slots["cell-content"] ? {
2105
2179
  name: "cell-content",
2106
- fn: q((g) => [
2107
- N(e.$slots, "cell-content", se(le(g)))
2180
+ fn: J((c) => [
2181
+ P(e.$slots, "cell-content", ee(ae(c)))
2108
2182
  ]),
2109
2183
  key: "2"
2110
2184
  } : void 0,
2111
2185
  !e.$slots.cell && e.$slots["cell-events"] ? {
2112
2186
  name: "cell-events",
2113
- fn: q((g) => [
2114
- N(e.$slots, "cell-events", se(le(g)))
2187
+ fn: J((c) => [
2188
+ P(e.$slots, "cell-events", ee(ae(c)))
2115
2189
  ]),
2116
2190
  key: "3"
2117
2191
  } : void 0,
2118
2192
  !e.$slots.cell && e.$slots.event ? {
2119
2193
  name: "event",
2120
- fn: q((g) => [
2121
- N(e.$slots, "event", se(le(g)))
2194
+ fn: J((c) => [
2195
+ P(e.$slots, "event", ee(ae(c)))
2122
2196
  ]),
2123
2197
  key: "4"
2124
2198
  } : void 0,
2125
2199
  !e.$slots.cell && e.$slots["event-count"] ? {
2126
2200
  name: "event-count",
2127
- fn: q((g) => [
2128
- N(e.$slots, "event-count", se(le(g)))
2201
+ fn: J((c) => [
2202
+ P(e.$slots, "event-count", ee(ae(c)))
2129
2203
  ]),
2130
2204
  key: "5"
2131
2205
  } : void 0
@@ -2139,12 +2213,12 @@ const st = (D, n) => {
2139
2213
  ], 64))
2140
2214
  ], 14, ga));
2141
2215
  }
2142
- }, ka = (D) => {
2143
- ze.texts = { ...fe.texts, ...D }, ze.dateUtils.updateTexts(ze.texts);
2216
+ }, ka = (y) => {
2217
+ ze.texts = { ...fe.texts, ...y }, ze.dateUtils.updateTexts(ze.texts);
2144
2218
  }, {
2145
2219
  addDatePrototypes: ba,
2146
- removeDatePrototypes: Ta,
2147
- updateTexts: $a,
2220
+ removeDatePrototypes: $a,
2221
+ updateTexts: Ta,
2148
2222
  addDays: Ma,
2149
2223
  subtractDays: Ya,
2150
2224
  addHours: Ea,
@@ -2153,16 +2227,16 @@ const st = (D, n) => {
2153
2227
  subtractMinutes: Va,
2154
2228
  getWeek: Oa,
2155
2229
  isToday: ja,
2156
- isSameDate: Pa,
2157
- isInRange: Fa,
2230
+ isSameDate: Fa,
2231
+ isInRange: Pa,
2158
2232
  isLeapYear: La,
2159
2233
  getPreviousFirstDayOfWeek: Ha,
2160
2234
  stringToDate: za,
2161
2235
  dateToMinutes: Na,
2162
2236
  countDays: Wa,
2163
2237
  datesInSameTimeStep: Aa,
2164
- isValid: Ba,
2165
- formatDate: Ia,
2238
+ isValid: Ia,
2239
+ formatDate: Ba,
2166
2240
  formatDateLite: Ra,
2167
2241
  formatTime: Xa,
2168
2242
  formatTimeLite: Ga,
@@ -2177,23 +2251,23 @@ export {
2177
2251
  Wa as countDays,
2178
2252
  Na as dateToMinutes,
2179
2253
  Aa as datesInSameTimeStep,
2180
- Ia as formatDate,
2254
+ Ba as formatDate,
2181
2255
  Ra as formatDateLite,
2182
2256
  Ja as formatMinutes,
2183
2257
  Xa as formatTime,
2184
2258
  Ga as formatTimeLite,
2185
2259
  Ha as getPreviousFirstDayOfWeek,
2186
2260
  Oa as getWeek,
2187
- Fa as isInRange,
2261
+ Pa as isInRange,
2188
2262
  La as isLeapYear,
2189
- Pa as isSameDate,
2263
+ Fa as isSameDate,
2190
2264
  ja as isToday,
2191
- Ba as isValidDate,
2192
- Ta as removeDatePrototypes,
2265
+ Ia as isValidDate,
2266
+ $a as removeDatePrototypes,
2193
2267
  za as stringToDate,
2194
2268
  Ya as subtractDays,
2195
2269
  Sa as subtractHours,
2196
2270
  Va as subtractMinutes,
2197
- $a as updateTexts,
2271
+ Ta as updateTexts,
2198
2272
  ka as useLocale
2199
2273
  };