vue-cal 5.0.1-rc.5 → 5.0.1-rc.7

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