vue-cal 5.0.1-rc.0 → 5.0.1-rc.10

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