UNPKG

vue3-calendar-component

Version:

A comprehensive Vue 3 Calendar component with Vuetify 3, TypeScript, and advanced features

1,298 lines (1,297 loc) 79.8 kB
import { ref as K, computed as C, defineComponent as B, createBlock as Z, openBlock as D, unref as m, withCtx as H, createVNode as z, createElementVNode as V, createCommentVNode as I, createTextVNode as P, toDisplayString as x, resolveComponent as Je, createElementBlock as M, renderSlot as le, Fragment as U, renderList as J, normalizeStyle as ne, normalizeClass as G, withModifiers as X, mergeProps as Oe, mergeModels as Ue, inject as Dt, useModel as xe, getCurrentInstance as $t, watch as ve, onMounted as kt, onUnmounted as Mt, resolveDynamicComponent as _t, createSlots as wt, normalizeProps as bt, guardReactiveProps as St } from "vue"; import { VProgressLinear as Ge, VBtnToggle as je, VSpacer as ae, VToolbar as Re, VIcon as Q, VBtn as j, VChip as re, VCardActions as Ze, VCard as Se, VMenu as se, VSelect as Ke, VTextField as Qe, VCol as he, VRow as Xe } from "vuetify/components"; import W from "dayjs"; import { VIcon as me } from "vuetify/components/VIcon"; import { useDisplay as Tt } from "vuetify"; function oe(n) { return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; } var ge = { exports: {} }, Yt = ge.exports, et; function Ot() { return et || (et = 1, function(n, i) { (function(t, e) { n.exports = e(W); })(Yt, function(t) { function e(s) { return s && typeof s == "object" && "default" in s ? s : { default: s }; } var o = e(t), h = { s: "ein paar Sekunden", m: ["eine Minute", "einer Minute"], mm: "%d Minuten", h: ["eine Stunde", "einer Stunde"], hh: "%d Stunden", d: ["ein Tag", "einem Tag"], dd: ["%d Tage", "%d Tagen"], M: ["ein Monat", "einem Monat"], MM: ["%d Monate", "%d Monaten"], y: ["ein Jahr", "einem Jahr"], yy: ["%d Jahre", "%d Jahren"] }; function f(s, d, g) { var _ = h[g]; return Array.isArray(_) && (_ = _[d ? 0 : 1]), _.replace("%d", s); } var $ = { name: "de", weekdays: "Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"), weekdaysShort: "So._Mo._Di._Mi._Do._Fr._Sa.".split("_"), weekdaysMin: "So_Mo_Di_Mi_Do_Fr_Sa".split("_"), months: "Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"), monthsShort: "Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sept._Okt._Nov._Dez.".split("_"), ordinal: function(s) { return s + "."; }, weekStart: 1, yearStart: 4, formats: { LTS: "HH:mm:ss", LT: "HH:mm", L: "DD.MM.YYYY", LL: "D. MMMM YYYY", LLL: "D. MMMM YYYY HH:mm", LLLL: "dddd, D. MMMM YYYY HH:mm" }, relativeTime: { future: "in %s", past: "vor %s", s: f, m: f, mm: f, h: f, hh: f, d: f, dd: f, M: f, MM: f, y: f, yy: f } }; return o.default.locale($, null, !0), $; }); }(ge)), ge.exports; } Ot(); var pe = { exports: {} }, Ct = pe.exports, tt; function Et() { return tt || (tt = 1, function(n, i) { (function(t, e) { n.exports = e(); })(Ct, function() { return { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t) { var e = ["th", "st", "nd", "rd"], o = t % 100; return "[" + t + (e[(o - 20) % 10] || e[o] || e[0]) + "]"; } }; }); }(pe)), pe.exports; } Et(); const ft = { dayJsLocale: "en", status: { open: "Open", planned: "Planned", overdue: "Overdue", completed: "Completed", cancelled: "Cancelled" }, views: { agenda: { noEvents: "No events scheduled for this day", buttons: { markEventCompleted: "Mark as Completed", cancelEvent: "Cancel Event" } } }, toolbar: { buttons: { month: "Month", week: "Week", day: "Day", agenda: "Agenda", today: "Today", previous: "Previous", next: "Next" }, filters: { statusLabel: "Filter by status", filterByCategory: "Filter by category" }, searchPlaceholder: "Search events...", clearFilters: "Clear Filters", activeFilters: function(n) { return `${n} filter${n > 1 ? "s" : ""} active`; } }, formats: { date: "MM/DD/YYYY", time: "HH:mm", day: "dddd, MMMM D, YYYY", startOfWeek: "MMM D", endOfWeek: "MMM D, YYYY", month: "MMMM YYYY", duration(n, i, t) { const e = []; return n > 0 && e.push(`${n} d`), i > 0 && e.push(`${i} h`), t > 0 && e.push(`${t} m`), e.join(", "); } } }, ie = K(ft); function ce() { const n = (e) => { ie.value = e, e.dayJsLocale ? W.locale(e.dayJsLocale) : W.locale("en"), console.log(W().format("MMMM D, YYYY")); }, i = (e) => { const o = e ? W(e) : W(); return ie.value.dayJsLocale ? o.locale(ie.value.dayJsLocale) : o; }, t = C(() => (e) => { const o = e ? W(e) : W(); return ie.value.dayJsLocale ? o.locale(ie.value.dayJsLocale) : o; }); return { current: ie, setLocale: n, createLocalizedDayjs: i, localizedDayjs: t }; } const Lt = { class: "calendar-title" }, xt = { class: "text-h6" }, zt = /* @__PURE__ */ B({ components: { VBtn: j, VIcon: Q, VToolbar: Re, VSpacer: ae, VBtnToggle: je, VProgressLinear: Ge }, __name: "CalendarToolbarButtons", props: { currentDate: {}, currentView: {}, loading: { type: Boolean, default: !1 } }, emits: ["view-change", "date-change", "navigate-previous", "navigate-next", "navigate-today"], setup(n, { emit: i }) { const t = ce(), { localizedDayjs: e } = t, o = n, h = i, f = C(() => { const s = e.value(o.currentDate); switch (o.currentView) { case "week": { const d = e.value(s.startOf("week")).format(t.current.value.formats.startOfWeek ?? "MMM D"), g = e.value(s.endOf("week")).format(t.current.value.formats.endOfWeek ?? "MMM D, YYYY"); return `${d} - ${g}`; } case "day": case "agenda": return s.format(t.current.value.formats.day ?? "dddd, MMMM D, YYYY"); case "month": default: return s.format(t.current.value.formats.month ?? "MMMM YYYY"); } }), $ = (s) => { s && s !== o.currentView && h("view-change", { oldView: o.currentView, newView: s, currentDate: o.currentDate }); }; return (s, d) => (D(), Z(m(Re), { density: "compact", class: "calendar-toolbar" }, { default: H(() => [ z(m(j), { title: m(t).current.value.toolbar.buttons.previous || "Previous", icon: "", disabled: s.loading, onClick: d[0] || (d[0] = (g) => s.$emit("navigate-previous")) }, { default: H(() => [ z(m(Q), null, { default: H(() => d[3] || (d[3] = [ P("mdi-chevron-left") ])), _: 1, __: [3] }) ]), _: 1 }, 8, ["title", "disabled"]), z(m(j), { title: m(t).current.value.toolbar.buttons.next || "Next", icon: "", disabled: s.loading, onClick: d[1] || (d[1] = (g) => s.$emit("navigate-next")) }, { default: H(() => [ z(m(Q), null, { default: H(() => d[4] || (d[4] = [ P("mdi-chevron-right") ])), _: 1, __: [4] }) ]), _: 1 }, 8, ["title", "disabled"]), z(m(j), { variant: "text", disabled: s.loading, class: "mx-2", onClick: d[2] || (d[2] = (g) => s.$emit("navigate-today")) }, { default: H(() => [ P(x(m(t).current.value.toolbar.buttons.today || "Today"), 1) ]), _: 1 }, 8, ["disabled"]), z(m(ae)), V("div", Lt, [ V("h2", xt, x(f.value), 1) ]), z(m(ae)), z(m(je), { "model-value": s.currentView, mandatory: "", variant: "outlined", divided: "", class: "view-toggle", "onUpdate:modelValue": $ }, { default: H(() => [ z(m(j), { value: "month", size: "small" }, { default: H(() => [ P(x(m(t).current.value.toolbar.buttons.month || "Month"), 1) ]), _: 1 }), z(m(j), { value: "week", size: "small" }, { default: H(() => [ P(x(m(t).current.value.toolbar.buttons.week || "Week"), 1) ]), _: 1 }), z(m(j), { value: "day", size: "small" }, { default: H(() => [ P(x(m(t).current.value.toolbar.buttons.day || "Day"), 1) ]), _: 1 }), z(m(j), { value: "agenda", size: "small" }, { default: H(() => [ P(x(m(t).current.value.toolbar.buttons.agenda || "Agenda"), 1) ]), _: 1 }) ]), _: 1 }, 8, ["model-value"]), s.loading ? (D(), Z(m(Ge), { key: 0, indeterminate: "", color: "primary", class: "position-absolute", style: { bottom: "0", left: "0", right: "0" } })) : I("", !0) ]), _: 1 })); } }), ee = (n, i) => { const t = n.__vccOpts || n; for (const [e, o] of i) t[e] = o; return t; }, He = /* @__PURE__ */ ee(zt, [["__scopeId", "data-v-ce23c6f9"]]); var ye = { exports: {} }, Vt = ye.exports, nt; function Ht() { return nt || (nt = 1, function(n, i) { (function(t, e) { n.exports = e(); })(Vt, function() { var t, e, o = 1e3, h = 6e4, f = 36e5, $ = 864e5, s = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, d = 31536e6, g = 2628e6, _ = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, y = { years: d, months: g, days: $, hours: f, minutes: h, seconds: o, milliseconds: 1, weeks: 6048e5 }, b = function(O) { return O instanceof L; }, p = function(O, r, l) { return new L(O, l, r.$l); }, a = function(O) { return e.p(O) + "s"; }, k = function(O) { return O < 0; }, w = function(O) { return k(O) ? Math.ceil(O) : Math.floor(O); }, E = function(O) { return Math.abs(O); }, c = function(O, r) { return O ? k(O) ? { negative: !0, format: "" + E(O) + r } : { negative: !1, format: "" + O + r } : { negative: !1, format: "" }; }, L = function() { function O(l, u, Y) { var T = this; if (this.$d = {}, this.$l = Y, l === void 0 && (this.$ms = 0, this.parseFromMilliseconds()), u) return p(l * y[a(u)], this); if (typeof l == "number") return this.$ms = l, this.parseFromMilliseconds(), this; if (typeof l == "object") return Object.keys(l).forEach(function(R) { T.$d[a(R)] = l[R]; }), this.calMilliseconds(), this; if (typeof l == "string") { var F = l.match(_); if (F) { var N = F.slice(2).map(function(R) { return R != null ? Number(R) : 0; }); return this.$d.years = N[0], this.$d.months = N[1], this.$d.weeks = N[2], this.$d.days = N[3], this.$d.hours = N[4], this.$d.minutes = N[5], this.$d.seconds = N[6], this.calMilliseconds(), this; } } return this; } var r = O.prototype; return r.calMilliseconds = function() { var l = this; this.$ms = Object.keys(this.$d).reduce(function(u, Y) { return u + (l.$d[Y] || 0) * y[Y]; }, 0); }, r.parseFromMilliseconds = function() { var l = this.$ms; this.$d.years = w(l / d), l %= d, this.$d.months = w(l / g), l %= g, this.$d.days = w(l / $), l %= $, this.$d.hours = w(l / f), l %= f, this.$d.minutes = w(l / h), l %= h, this.$d.seconds = w(l / o), l %= o, this.$d.milliseconds = l; }, r.toISOString = function() { var l = c(this.$d.years, "Y"), u = c(this.$d.months, "M"), Y = +this.$d.days || 0; this.$d.weeks && (Y += 7 * this.$d.weeks); var T = c(Y, "D"), F = c(this.$d.hours, "H"), N = c(this.$d.minutes, "M"), R = this.$d.seconds || 0; this.$d.milliseconds && (R += this.$d.milliseconds / 1e3, R = Math.round(1e3 * R) / 1e3); var de = c(R, "S"), Ee = l.negative || u.negative || T.negative || F.negative || N.negative || de.negative, Le = F.format || N.format || de.format ? "T" : "", fe = (Ee ? "-" : "") + "P" + l.format + u.format + T.format + Le + F.format + N.format + de.format; return fe === "P" || fe === "-P" ? "P0D" : fe; }, r.toJSON = function() { return this.toISOString(); }, r.format = function(l) { var u = l || "YYYY-MM-DDTHH:mm:ss", Y = { Y: this.$d.years, YY: e.s(this.$d.years, 2, "0"), YYYY: e.s(this.$d.years, 4, "0"), M: this.$d.months, MM: e.s(this.$d.months, 2, "0"), D: this.$d.days, DD: e.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: e.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: e.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: e.s(this.$d.seconds, 2, "0"), SSS: e.s(this.$d.milliseconds, 3, "0") }; return u.replace(s, function(T, F) { return F || String(Y[T]); }); }, r.as = function(l) { return this.$ms / y[a(l)]; }, r.get = function(l) { var u = this.$ms, Y = a(l); return Y === "milliseconds" ? u %= 1e3 : u = Y === "weeks" ? w(u / y[Y]) : this.$d[Y], u || 0; }, r.add = function(l, u, Y) { var T; return T = u ? l * y[a(u)] : b(l) ? l.$ms : p(l, this).$ms, p(this.$ms + T * (Y ? -1 : 1), this); }, r.subtract = function(l, u) { return this.add(l, u, !0); }, r.locale = function(l) { var u = this.clone(); return u.$l = l, u; }, r.clone = function() { return p(this.$ms, this); }, r.humanize = function(l) { return t().add(this.$ms, "ms").locale(this.$l).fromNow(!l); }, r.valueOf = function() { return this.asMilliseconds(); }, r.milliseconds = function() { return this.get("milliseconds"); }, r.asMilliseconds = function() { return this.as("milliseconds"); }, r.seconds = function() { return this.get("seconds"); }, r.asSeconds = function() { return this.as("seconds"); }, r.minutes = function() { return this.get("minutes"); }, r.asMinutes = function() { return this.as("minutes"); }, r.hours = function() { return this.get("hours"); }, r.asHours = function() { return this.as("hours"); }, r.days = function() { return this.get("days"); }, r.asDays = function() { return this.as("days"); }, r.weeks = function() { return this.get("weeks"); }, r.asWeeks = function() { return this.as("weeks"); }, r.months = function() { return this.get("months"); }, r.asMonths = function() { return this.as("months"); }, r.years = function() { return this.get("years"); }, r.asYears = function() { return this.as("years"); }, O; }(), S = function(O, r, l) { return O.add(r.years() * l, "y").add(r.months() * l, "M").add(r.days() * l, "d").add(r.hours() * l, "h").add(r.minutes() * l, "m").add(r.seconds() * l, "s").add(r.milliseconds() * l, "ms"); }; return function(O, r, l) { t = l, e = l().$utils(), l.duration = function(T, F) { var N = l.locale(); return p(T, { $l: N }, F); }, l.isDuration = b; var u = r.prototype.add, Y = r.prototype.subtract; r.prototype.add = function(T, F) { return b(T) ? S(this, T, 1) : u.bind(this)(T, F); }, r.prototype.subtract = function(T, F) { return b(T) ? S(this, T, -1) : Y.bind(this)(T, F); }; }; }); }(ye)), ye.exports; } var Ft = Ht(); const Wt = /* @__PURE__ */ oe(Ft); var De = { exports: {} }, At = De.exports, rt; function It() { return rt || (rt = 1, function(n, i) { (function(t, e) { n.exports = e(); })(At, function() { var t = "day"; return function(e, o, h) { var f = function(d) { return d.add(4 - d.isoWeekday(), t); }, $ = o.prototype; $.isoWeekYear = function() { return f(this).year(); }, $.isoWeek = function(d) { if (!this.$utils().u(d)) return this.add(7 * (d - this.isoWeek()), t); var g, _, y, b, p = f(this), a = (g = this.isoWeekYear(), _ = this.$u, y = (_ ? h.utc : h)().year(g).startOf("year"), b = 4 - y.isoWeekday(), y.isoWeekday() > 4 && (b += 7), y.add(b, t)); return p.diff(a, "week") + 1; }, $.isoWeekday = function(d) { return this.$utils().u(d) ? this.day() || 7 : this.day(this.day() % 7 ? d : d - 7); }; var s = $.startOf; $.startOf = function(d, g) { var _ = this.$utils(), y = !!_.u(g) || g; return _.p(d) === "isoweek" ? y ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : s.bind(this)(d, g); }; }; }); }(De)), De.exports; } var Nt = It(); const Bt = /* @__PURE__ */ oe(Nt); var $e = { exports: {} }, qt = $e.exports, at; function Pt() { return at || (at = 1, function(n, i) { (function(t, e) { n.exports = e(); })(qt, function() { var t = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }; return function(e, o, h) { var f = o.prototype, $ = f.format; h.en.formats = t, f.format = function(s) { s === void 0 && (s = "YYYY-MM-DDTHH:mm:ssZ"); var d = this.$locale().formats, g = function(_, y) { return _.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(b, p, a) { var k = a && a.toUpperCase(); return p || y[a] || t[a] || y[k].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(w, E, c) { return E || c.slice(1); }); }); }(s, d === void 0 ? {} : d); return $.call(this, g); }; }; }); }($e)), $e.exports; } var Jt = Pt(); const Ut = /* @__PURE__ */ oe(Jt); var ke = { exports: {} }, Gt = ke.exports, st; function jt() { return st || (st = 1, function(n, i) { (function(t, e) { n.exports = e(); })(Gt, function() { return function(t, e, o) { t = t || {}; var h = e.prototype, f = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" }; function $(d, g, _, y) { return h.fromToBase(d, g, _, y); } o.en.relativeTime = f, h.fromToBase = function(d, g, _, y, b) { for (var p, a, k, w = _.$locale().relativeTime || f, E = t.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], c = E.length, L = 0; L < c; L += 1) { var S = E[L]; S.d && (p = y ? o(d).diff(_, S.d, !0) : _.diff(d, S.d, !0)); var O = (t.rounding || Math.round)(Math.abs(p)); if (k = p > 0, O <= S.r || !S.r) { O <= 1 && L > 0 && (S = E[L - 1]); var r = w[S.l]; b && (O = b("" + O)), a = typeof r == "string" ? r.replace("%d", O) : r(O, g, S.l, k); break; } } if (g) return a; var l = k ? w.future : w.past; return typeof l == "function" ? l(a) : l.replace("%s", a); }, h.to = function(d, g) { return $(d, g, this, !0); }, h.from = function(d, g) { return $(d, g, this); }; var s = function(d) { return d.$u ? o.utc() : o(); }; h.toNow = function(d) { return this.to(s(this), d); }, h.fromNow = function(d) { return this.from(s(this), d); }; }; }); }(ke)), ke.exports; } var Rt = jt(); const Zt = /* @__PURE__ */ oe(Rt); var Me = { exports: {} }, Kt = Me.exports, ot; function Qt() { return ot || (ot = 1, function(n, i) { (function(t, e) { n.exports = e(); })(Kt, function() { var t = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, e = {}; return function(o, h, f) { var $, s = function(y, b, p) { p === void 0 && (p = {}); var a = new Date(y), k = function(w, E) { E === void 0 && (E = {}); var c = E.timeZoneName || "short", L = w + "|" + c, S = e[L]; return S || (S = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: w, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: c }), e[L] = S), S; }(b, p); return k.formatToParts(a); }, d = function(y, b) { for (var p = s(y, b), a = [], k = 0; k < p.length; k += 1) { var w = p[k], E = w.type, c = w.value, L = t[E]; L >= 0 && (a[L] = parseInt(c, 10)); } var S = a[3], O = S === 24 ? 0 : S, r = a[0] + "-" + a[1] + "-" + a[2] + " " + O + ":" + a[4] + ":" + a[5] + ":000", l = +y; return (f.utc(r).valueOf() - (l -= l % 1e3)) / 6e4; }, g = h.prototype; g.tz = function(y, b) { y === void 0 && (y = $); var p, a = this.utcOffset(), k = this.toDate(), w = k.toLocaleString("en-US", { timeZone: y }), E = Math.round((k - new Date(w)) / 1e3 / 60), c = 15 * -Math.round(k.getTimezoneOffset() / 15) - E; if (!Number(c)) p = this.utcOffset(0, b); else if (p = f(w, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(c, !0), b) { var L = p.utcOffset(); p = p.add(a - L, "minute"); } return p.$x.$timezone = y, p; }, g.offsetName = function(y) { var b = this.$x.$timezone || f.tz.guess(), p = s(this.valueOf(), b, { timeZoneName: y }).find(function(a) { return a.type.toLowerCase() === "timezonename"; }); return p && p.value; }; var _ = g.startOf; g.startOf = function(y, b) { if (!this.$x || !this.$x.$timezone) return _.call(this, y, b); var p = f(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L }); return _.call(p, y, b).tz(this.$x.$timezone, !0); }, f.tz = function(y, b, p) { var a = p && b, k = p || b || $, w = d(+f(), k); if (typeof y != "string") return f(y).tz(k); var E = function(O, r, l) { var u = O - 60 * r * 1e3, Y = d(u, l); if (r === Y) return [u, r]; var T = d(u -= 60 * (Y - r) * 1e3, l); return Y === T ? [u, Y] : [O - 60 * Math.min(Y, T) * 1e3, Math.max(Y, T)]; }(f.utc(y, a).valueOf(), w, k), c = E[0], L = E[1], S = f(c).utcOffset(L); return S.$x.$timezone = k, S; }, f.tz.guess = function() { return Intl.DateTimeFormat().resolvedOptions().timeZone; }, f.tz.setDefault = function(y) { $ = y; }; }; }); }(Me)), Me.exports; } var Xt = Qt(); const en = /* @__PURE__ */ oe(Xt); var _e = { exports: {} }, tn = _e.exports, it; function nn() { return it || (it = 1, function(n, i) { (function(t, e) { n.exports = e(); })(tn, function() { var t = "minute", e = /[+-]\d\d(?::?\d\d)?/g, o = /([+-]|\d\d)/g; return function(h, f, $) { var s = f.prototype; $.utc = function(a) { var k = { date: a, utc: !0, args: arguments }; return new f(k); }, s.utc = function(a) { var k = $(this.toDate(), { locale: this.$L, utc: !0 }); return a ? k.add(this.utcOffset(), t) : k; }, s.local = function() { return $(this.toDate(), { locale: this.$L, utc: !1 }); }; var d = s.parse; s.parse = function(a) { a.utc && (this.$u = !0), this.$utils().u(a.$offset) || (this.$offset = a.$offset), d.call(this, a); }; var g = s.init; s.init = function() { if (this.$u) { var a = this.$d; this.$y = a.getUTCFullYear(), this.$M = a.getUTCMonth(), this.$D = a.getUTCDate(), this.$W = a.getUTCDay(), this.$H = a.getUTCHours(), this.$m = a.getUTCMinutes(), this.$s = a.getUTCSeconds(), this.$ms = a.getUTCMilliseconds(); } else g.call(this); }; var _ = s.utcOffset; s.utcOffset = function(a, k) { var w = this.$utils().u; if (w(a)) return this.$u ? 0 : w(this.$offset) ? _.call(this) : this.$offset; if (typeof a == "string" && (a = function(S) { S === void 0 && (S = ""); var O = S.match(e); if (!O) return null; var r = ("" + O[0]).match(o) || ["-", 0, 0], l = r[0], u = 60 * +r[1] + +r[2]; return u === 0 ? 0 : l === "+" ? u : -u; }(a), a === null)) return this; var E = Math.abs(a) <= 16 ? 60 * a : a, c = this; if (k) return c.$offset = E, c.$u = a === 0, c; if (a !== 0) { var L = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset(); (c = this.local().add(E + L, t)).$offset = E, c.$x.$localOffset = L; } else c = this.utc(); return c; }; var y = s.format; s.format = function(a) { var k = a || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : ""); return y.call(this, k); }, s.valueOf = function() { var a = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset()); return this.$d.valueOf() - 6e4 * a; }, s.isUTC = function() { return !!this.$u; }, s.toISOString = function() { return this.toDate().toISOString(); }, s.toString = function() { return this.toDate().toUTCString(); }; var b = s.toDate; s.toDate = function(a) { return a === "s" && this.$offset ? $(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : b.call(this); }; var p = s.diff; s.diff = function(a, k, w) { if (a && this.$u === a.$u) return p.call(this, a, k, w); var E = this.local(), c = $(a).local(); return p.call(E, c, k, w); }; }; }); }(_e)), _e.exports; } var rn = nn(); const an = /* @__PURE__ */ oe(rn); var we = { exports: {} }, sn = we.exports, lt; function on() { return lt || (lt = 1, function(n, i) { (function(t, e) { n.exports = e(); })(sn, function() { var t = "week", e = "year"; return function(o, h, f) { var $ = h.prototype; $.week = function(s) { if (s === void 0 && (s = null), s !== null) return this.add(7 * (s - this.week()), "day"); var d = this.$locale().yearStart || 1; if (this.month() === 11 && this.date() > 25) { var g = f(this).startOf(e).add(1, e).date(d), _ = f(this).endOf(t); if (g.isBefore(_)) return 1; } var y = f(this).startOf(e).date(d).startOf(t).subtract(1, "millisecond"), b = this.diff(y, t, !0); return b < 0 ? f(this).startOf("week").week() : Math.ceil(b); }, $.weeks = function(s) { return s === void 0 && (s = null), this.week(s); }; }; }); }(we)), we.exports; } var ln = on(); const un = /* @__PURE__ */ oe(ln); W.extend(an); W.extend(en); W.extend(Bt); W.extend(un); W.extend(Wt); W.extend(Zt); W.extend(Ut); function cn(n) { const i = W(n.start), t = n.end ? W(n.end) : i.add(1, "hour"); return { ...n, startDate: i, endDate: t, isAllDay: n.allDay || !1 }; } function ut(n) { return n.map(cn); } function mt(n, i, t) { return n.filter((e) => e.startDate.isBefore(t) && e.endDate.isAfter(i)); } function Ce(n, i) { const t = i.startOf("day"), e = i.endOf("day"); return mt(n, t, e); } function vt(n = "00:00", i = "24:00", t = 60) { const e = [], [o, h] = n.split(":").map(Number), [f, $] = i.split(":").map(Number); let s = W().hour(o).minute(h).second(0); const d = W().hour(f).minute($).second(0); for (; s.isBefore(d); ) e.push({ hour: s.hour(), minute: s.minute(), label: s.format("HH:mm") }), s = s.add(t, "minute"); return e; } function ht(n, i = "monday") { const t = n.add(-n.get("day"), "d").add(qe(i), "day"), e = []; for (let o = 0; o < 7; o++) e.push(t.add(o, "day")); return e; } function dn(n, i = "monday") { const t = qe(i), e = n.startOf("month"), o = n.endOf("month"), h = e.startOf("week").add(t, "day"), f = o.endOf("week").add(t, "day"), $ = []; let s = h; for (; s.isBefore(f) || s.isSame(f, "day"); ) { const d = []; for (let g = 0; g < 7; g++) d.push(s.add(g, "day")); $.push(d), s = s.add(7, "day"); } return $; } function Ne(n, i) { if (n.isAllDay) return "All day"; const t = i || "HH:mm", e = n.startDate.format(t), o = n.endDate.format(t); return `${e} - ${o}`; } function fn(n) { return n.endDate.diff(n.startDate, "minute"); } function jr(n, i) { return n.startDate.isBefore(i.endDate) && n.endDate.isAfter(i.startDate); } function mn(n) { return [...n].sort((i, t) => i.startDate.valueOf() - t.startDate.valueOf()); } function ue(n) { if (n.color) return n.color; if (n.backgroundColor) return n.backgroundColor; switch (n.status) { case "completed": return "#4caf50"; case "cancelled": return "#f44336"; case "overdue": return "#ff5722"; case "planned": return "#2196f3"; case "open": default: return "#9e9e9e"; } } function Be(n) { if (n.textColor) return n.textColor; const t = ue(n).replace("#", ""), e = parseInt(t.substr(0, 2), 16), o = parseInt(t.substr(2, 2), 16), h = parseInt(t.substr(4, 2), 16); return (e * 299 + o * 587 + h * 114) / 1e3 > 128 ? "#000000" : "#ffffff"; } function Te(n) { return n.isSame(W(), "day"); } function Ye(n) { const i = n.day(); return i === 0 || i === 6; } function qe(n) { switch (n) { case "sunday": return 0; case "monday": return 1; case "tuesday": return 2; case "wednesday": return 3; case "thursday": return 4; case "friday": return 5; case "saturday": return 6; default: return -1; } } function vn(n, i) { let t = [...n]; if (i.search) { const e = i.search.toLowerCase(); t = t.filter( (o) => o.title.toLowerCase().indexOf(e) !== -1 || o.subtitle && o.subtitle.toLowerCase().indexOf(e) !== -1 || o.description && o.description.toLowerCase().indexOf(e) !== -1 ); } if (i.statuses && i.statuses.length > 0 && (t = t.filter((e) => i.statuses.indexOf(e.status || "open") !== -1)), i.dateRange) { const { start: e, end: o } = i.dateRange; t = t.filter((h) => h.startDate.isBefore(o) && h.endDate.isAfter(e)); } return i.customFilter && (t = t.filter(i.customFilter)), t; } function hn(n, i) { let t = null; return (...e) => { t && clearTimeout(t), t = setTimeout(() => n(...e), i); }; } function Rr(n, i) { let t; return (...e) => { t || (n(...e), t = !0, setTimeout(() => t = !1, i)); }; } function Zr() { return Math.random().toString(36).substring(2) + Date.now().toString(36); } function ct(n) { if (n === null || typeof n != "object") return n; if (n instanceof Date) return new Date(n.getTime()); if (Array.isArray(n)) return n.map(ct); const i = {}; for (const t in n) Object.prototype.hasOwnProperty.call(n, t) && (i[t] = ct(n[t])); return i; } const gn = { class: "agenda-view" }, pn = { class: "agenda-header" }, yn = { class: "text-h6" }, Dn = { class: "agenda-content" }, $n = { key: 0, class: "no-events" }, kn = { class: "text-body-1 text-grey" }, Mn = { key: 1, class: "events-list" }, _n = { class: "event-header d-flex align-center mb-2" }, wn = { class: "event-title text-h6 flex-grow-1" }, bn = { key: 0, class: "event-subtitle text-subtitle-1 mb-2" }, Sn = { class: "event-time d-flex align-center mb-2" }, Tn = { class: "text-body-2" }, Yn = { key: 0, class: "ml-2 text-caption text-grey" }, On = { key: 1, class: "event-location d-flex align-center mb-2" }, Cn = { class: "text-body-2" }, En = { key: 2, class: "event-description" }, Ln = { class: "text-body-2 mb-0" }, xn = { key: 3, class: "event-metadata mt-3" }, zn = { class: "d-flex flex-wrap gap-2" }, Vn = /* @__PURE__ */ B({ components: { VIcon: me, VCard: Se, VCardActions: Ze, VChip: re, VSpacer: ae, VBtn: j }, __name: "AgendaView", props: { events: {}, currentDate: {}, containerHeight: {}, config: {}, readOnly: { type: Boolean } }, emits: ["event-click", "event-update"], setup(n, { emit: i }) { const t = ce(), e = n, o = i, h = C(() => Ce(e.events, e.currentDate)), f = C(() => mn(h.value)), $ = C(() => t.localizedDayjs.value(e.currentDate).format(t.current.value.formats.day)), s = (a) => { switch (a) { case "completed": return "success"; case "cancelled": return "error"; case "overdue": return "warning"; case "planned": return "info"; case "open": default: return "default"; } }, d = (a) => { switch (a) { case "completed": return t.current.value.status.completed; case "cancelled": return t.current.value.status.cancelled; case "overdue": return t.current.value.status.overdue; case "planned": return t.current.value.status.planned; case "open": default: return t.current.value.status.open; } }, g = (a) => { const k = fn(a), w = Math.floor(k / (24 * 60)), E = Math.floor(k / 60), c = k % 60; return t.current.value.formats.duration(w, E, c); }, _ = (a) => a.endDate.isBefore(W()) && a.status !== "completed" && a.status !== "cancelled", y = (a) => { o("event-click", a); }, b = (a) => { o("event-update", a.id, { status: "completed" }); }, p = (a) => { o("event-update", a.id, { status: "cancelled" }); }; return (a, k) => { const w = Je("v-divider"), E = Je("v-card-text"); return D(), M("div", gn, [ V("div", pn, [ V("h3", yn, x($.value), 1), h.value.length > 0 ? (D(), Z(m(re), { key: 0, color: "primary", size: "small" }, { default: H(() => [ P(x(h.value.length) + " event" + x(h.value.length > 1 ? "s" : ""), 1) ]), _: 1 })) : I("", !0) ]), V("div", Dn, [ h.value.length === 0 ? (D(), M("div", $n, [ le(a.$slots, "no-events", { date: a.currentDate }, () => [ z(m(me), { icon: "mdi-calendar-blank", size: "64", color: "grey-lighten-2", class: "mb-4" }), V("p", kn, x(m(t).current.value.views.agenda.noEvents), 1) ], !0) ])) : (D(), M("div", Mn, [ (D(!0), M(U, null, J(f.value, (c) => (D(), M("div", { key: c.id }, [ le(a.$slots, "event-content", { event: c, date: a.currentDate, handleEventClick: y }, () => [ z(m(Se), { class: G(["agenda-event mb-4", { "event-completed": c.status === "completed", "event-cancelled": c.status === "cancelled", "event-overdue": _(c) }]), style: ne({ borderLeft: `4px solid ${m(ue)(c)}` }), elevation: "2", onClick: (L) => y({ event: c, nativeEvent: L }) }, { default: H(() => [ z(E, { class: "pa-4" }, { default: H(() => [ V("div", _n, [ c.icon ? (D(), Z(m(me), { key: 0, icon: c.icon, color: m(ue)(c), class: "mr-2" }, null, 8, ["icon", "color"])) : I("", !0), V("h4", wn, x(c.title), 1), z(m(re), { color: s(c.status || "open"), size: "small", variant: "outlined" }, { default: H(() => [ P(x(d(c.status || "open")), 1) ]), _: 2 }, 1032, ["color"]) ]), c.subtitle ? (D(), M("div", bn, x(c.subtitle), 1)) : I("", !0), V("div", Sn, [ z(m(me), { icon: "mdi-clock-outline", size: "small", class: "mr-2" }), V("span", Tn, x(m(Ne)(c)), 1), c.isAllDay ? I("", !0) : (D(), M("span", Yn, " (" + x(g(c)) + ") ", 1)) ]), c.location ? (D(), M("div", On, [ z(m(me), { icon: "mdi-map-marker", size: "small", class: "mr-2" }), V("span", Cn, x(c.location), 1) ])) : I("", !0), c.description ? (D(), M("div", En, [ V("p", Ln, x(c.description), 1) ])) : I("", !0), c.data && Object.keys(c.data).length > 0 ? (D(), M("div", xn, [ z(w, { class: "mb-2" }), V("div", zn, [ (D(!0), M(U, null, J(c.data, (L, S) => (D(), Z(m(re), { key: S, size: "x-small", variant: "outlined" }, { default: H(() => [ P(x(S) + ": " + x(L), 1) ]), _: 2 }, 1024))), 128)) ]) ])) : I("", !0) ]), _: 2 }, 1024), z(m(Ze), { class: "pa-4 pt-0" }, { default: H(() => [ z(m(ae)), c.status !== "completed" && c.status !== "cancelled" ? (D(), Z(m(j), { key: 0, disabled: a.readOnly, variant: "text", size: "small", color: "success", onClick: X((L) => b(c), ["stop"]) }, { default: H(() => [ P(x(m(t).current.value.views.agenda.buttons.markEventCompleted), 1) ]), _: 2 }, 1032, ["disabled", "onClick"])) : I("", !0), c.status !== "cancelled" ? (D(), Z(m(j), { key: 1, disabled: a.readOnly, variant: "text", size: "small", color: "error", onClick: X((L) => p(c), ["stop"]) }, { default: H(() => [ P(x(m(t).current.value.views.agenda.buttons.cancelEvent), 1) ]), _: 2 }, 1032, ["disabled", "onClick"])) : I("", !0) ]), _: 2 }, 1024) ]), _: 2 }, 1032, ["style", "class", "onClick"]) ], !0) ]))), 128)) ])) ]) ]); }; } }), Fe = /* @__PURE__ */ ee(Vn, [["__scopeId", "data-v-fde84cc6"]]); function Pe(n) { const i = K(null), t = K(null), e = K(!1), o = K(null), h = (g, _) => { i.value = g, t.value = _, e.value = !0, _.style.opacity = "0.5", _.style.cursor = "grabbing"; }, f = () => { t.value && (t.value.style.opacity = "1", t.value.style.cursor = "grab"), i.value = null, t.value = null, e.value = !1, o.value = null; }, $ = async (g, _) => { if (!i.value) return; const y = i.value, b = y.startDate, p = y.endDate, a = _ || g.add(p.diff(b, "minute"), "minute"), k = { event: y, newStart: g.toDate(), newEnd: a.toDate(), oldStart: b.toDate(), oldEnd: p.toDate() }; try { n && await n(k); } catch (w) { console.error("Failed to drop event:", w); } finally { f(); } }, s = (g) => { o.value = g, g.style.backgroundColor = "rgba(25, 118, 210, 0.1)"; }, d = (g) => { o.value === g && (g.style.backgroundColor = "", o.value = null); }; return { draggedEvent: C(() => i.value), isDragging: C(() => e.value), handleDragStart: h, handleDragEnd: f, handleDrop: $, handleDragOver: s, handleDragLeave: d }; } function We(n) { return C(() => { const [t, e] = n.value.split(":").map(Number); return t * 60 + e; }); } function gt(n, i, t, e, o = 60) { return C(() => { const f = We(i), $ = We(t), s = C(() => { const _ = $.value - f.value; return Math.ceil(_ / e.value); }), d = n.value - o; return { height: C(() => d <= 0 ? 30 : Math.max(30, Math.floor(d / s.value))).value, numberOfSlots: s.value, minTime: f.value, maxTime: $.value }; }); } function Kr() { const { mobile: n, width: i, sm: t, md: e, lg: o, xl: h, xxl: f } = Tt(), $ = C(() => t.value || e.value), s = C(() => o.value || h.value || f.value), d = C(() => n.value ? "agenda" : $.value ? "week" : "month"), g = C(() => n.value ? "compact" : $.value ? "normal" : "detailed"), _ = C(() => s.value), y = C(() => n.value ? 40 : $.value ? 50 : i.value > 1920 ? 80 : 60), b = C(() => i.value > 1920); return { mobile: n, tablet: $, desktop: s, isWideScreen: b, recommendedView: d, eventDisplayMode: g, showSidebar: _, timeSlotHeight: y }; } const Hn = ["draggable"], Fn = { class: "event-content" }, Wn = { class: "event-header" }, An = { class: "event-title" }, In = { key: 0, class: "event-subtitle" }, Nn = { class: "event-time" }, Bn = { key: 1, class: "event-location" }, qn = { key: 2, class: "event-description" }, Pn = /* @__PURE__ */ B({ __name: "DayEventView", props: { event: {}, day: {}, dynamicTimeSlots: {}, handleEventClick: { type: Function }, handleDragStart: { type: Function }, config: {}, readOnly: { type: Boolean } }, setup(n) { B({ components: { VIcon: Q } }); const i = n, t = (e) => { const [o, h] = (i.config.minTime || "00:00").split(":").map(Number), [f, $] = (i.config.maxTime || "24:00").split(":").map(Number), s = i.day.hour(o).minute(h).second(0), d = i.day.hour(f).minute($).second(0), g = e.startDate.isBefore(s) ? s : e.startDate, _ = e.endDate.isAfter(d) ? d : e.endDate; if (e.endDate.isBefore(s) || e.startDate.isAfter(d)) return { display: "none" }; const y = g.diff(s, "minute"), b = _.diff(g, "minute"), p = i.config.timeSlotDuration || 60, a = i.dynamicTimeSlots.height, k = Math.max(0, y / p * a), w = Math.max(b / p * a, 20); return { position: "absolute", top: `${k}px`, height: `${w}px`, left: "8px", right: "8px", backgroundColor: ue(e), color: Be(e), zIndex: 10 }; }; return (e, o) => (D(), M("div", { class: G(["day-event", { "event-completed": e.event.status === "completed" }]), style: ne(t(e.event)), draggable: !e.readOnly, onClick: o[0] || (o[0] = X((h) => e.handleEventClick({ event: e.event, nativeEvent: h }), ["stop"])), onDragstart: o[1] || (o[1] = (h) => e.handleDragStart(e.event, h.target)) }, [ V("div", Fn, [ V("div", Wn, [ e.event.icon ? (D(), Z(m(Q), { key: 0, icon: e.event.icon, size: "small", class: "mr-2" }, null, 8, ["icon"])) : I("", !0), V("div", An, x(e.event.title), 1) ]), e.event.subtitle ? (D(), M("div", In, x(e.event.subtitle), 1)) : I("", !0), V("div", Nn, x(m(Ne)(e.event)), 1), e.event.location ? (D(), M("div", Bn, [ z(m(Q), { icon: "mdi-map-marker", size: "x-small", class: "mr-1" }), P(" " + x(e.event.location), 1) ])) : I("", !0), e.event.description ? (D(), M("div", qn, x(e.event.description), 1)) : I("", !0) ]) ], 46, Hn)); } }), dt = /* @__PURE__ */ ee(Pn, [["__scopeId", "data-v-69ba6863"]]), Jn = { class: "day-view" }, Un = { key: 0, class: "time-column-header" }, Gn = { class: "day-name" }, jn = { key: 0, class: "time-column" }, Rn = { class: "time-label" }, Zn = ["onClick", "onDrop"], Kn = { key: 0 }, Qn = { key: 1 }, Xn = /* @__PURE__ */ B({ __name: "DayView", props: { events: {}, currentDate: {}, containerHeight: {}, config: {}, readOnly: { type: Boolean } }, emits: ["time-slot-click", "event-click", "event-drop", "date-click"], setup(n, { emit: i }) { B({ components: { VMenu: se } }); const t = n, e = i, o = C(() => !t.readOnly), h = C(() => t.containerHeight || 500), f = C(() => t.config.timeSlotDuration ?? 60), $ = C(() => t.config.minTime || "00:00"), s = C(() => t.config.maxTime || "24:00"), d = gt(h, $, s, f, 60), { handleDragStart: g, handleDrop: _ } = Pe(async (r) => { e("event-drop", { event: r.event, date: r.date, newEnd: r.newEnd, newStart: r.newStart, oldEnd: r.oldEnd, oldStart: r.oldStart }); }), y = C(() => vt(t.config.minTime, t.config.maxTime, t.config.timeSlotDuration)), b = C(() => Ce(t.events, t.currentDate)), p = (r) => { e("event-click", r); }, a = (r) => { e("date-click", r); }, k = (r) => { const l = t.currentDate.hour(r.hour).minute(r.minute); e("time-slot-click", { date: l, slot: r }); }, w = (r, l) => { o.value && l instanceof HTMLElement && (l.style.opacity = "0.5", l.style.transform = "rotate(3deg)", g(r, l)); }, E = (r) => { o.value && (document.querySelectorAll(".drag-highlight").forEach((l) => { l.classList.remove("drag-highlight"); }), document.querySelectorAll('[style*="opacity: 0.5"]').forEach((l) => { const u = l; u.style.opacity = "", u.style.transform = ""; }), _(r)); }, c = (r) => { if (r.preventDefault(), !o.value) return; r.currentTarget.classList.add("drag-highlight"); }, L = (r) => { r.currentTarget.classList.remove("drag-highlight"); }, S = (r) => { if (r.preventDefault(), !o.value) return; r.currentTarget.classList.add("drag-highlight-slot"); }, O = (r) => { r.currentTarget.classList.remove("drag-highlight-slot"); }; return (r, l) => (D(), M("div", Jn, [ V("div", { class: G(["day-header", { "show-time-grid": r.config.showTimeGrid, "hide-time-grid": !r.config.showTimeGrid }]) }, [ r.config.showTimeGrid ? (D(), M("div", Un)) : I("", !0), V("div", { class: G(["day-header-content", { today: m(Te)(r.currentDate), weekend: m(Ye)(r.currentDate) }]), onClick: l[0] || (l[0] = (u) => a({ date: r.currentDate, nativeEvent: u })) }, [ V("div", Gn, x(r.currentDate.format("dddd")), 1) ], 2) ], 2), V("div", { class: G(["day-body", { "show-time-grid": r.config.showTimeGrid, "hide-time-grid": !r.config.showTimeGrid }]), onDrop: l[1] || (l[1] = (u) => E(r.currentDate.startOf("day"))) }, [ r.config.showTimeGrid ? (D(), M("div", jn, [ (D(!0), M(U, null, J(y.value, (u) => (D(), M("div", { key: `${u.hour}-${u.minute}`, class: "time-slot", style: ne({ height: `${m(d).height}px` }) }, [ V("span", Rn, x(u.label), 1) ], 4))), 128)) ])) : I("", !0),