calkit 0.1.0 → 0.2.0

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.
@@ -27,6 +27,9 @@ class Fe extends HTMLElement {
27
27
  /** Subclasses override to update Shadow DOM. */
28
28
  render() {
29
29
  }
30
+ /** Reset selection state. Subclasses should override with specific logic. */
31
+ clear() {
32
+ }
30
33
  /** Dispatch a composed, bubbling custom event. */
31
34
  emit(e, s = {}) {
32
35
  this.dispatchEvent(
@@ -36,8 +39,8 @@ class Fe extends HTMLElement {
36
39
  /** Show an inline status banner. */
37
40
  showStatus(e, s, a = {}) {
38
41
  if (!this._store) return;
39
- const { autoDismiss: n, dismissible: l = !0 } = a;
40
- clearTimeout(this._statusTimer), this._store.set({ statusType: e, statusMessage: s, statusDismissible: l }), this.emit("cal:status", { type: e, message: s }), n && n > 0 && (this._statusTimer = setTimeout(() => this.clearStatus(), n));
42
+ const { autoDismiss: n, dismissible: r = !0 } = a;
43
+ clearTimeout(this._statusTimer), this._store.set({ statusType: e, statusMessage: s, statusDismissible: r }), this.emit("cal:status", { type: e, message: s }), n && n > 0 && (this._statusTimer = setTimeout(() => this.clearStatus(), n));
41
44
  }
42
45
  /** Clear the status banner. */
43
46
  clearStatus() {
@@ -61,14 +64,14 @@ function Ve(t) {
61
64
  set(a) {
62
65
  const n = e;
63
66
  e = { ...e, ...a };
64
- let l = !1;
65
- for (const r of Object.keys(a))
66
- if (n[r] !== e[r]) {
67
- l = !0;
67
+ let r = !1;
68
+ for (const l of Object.keys(a))
69
+ if (n[l] !== e[l]) {
70
+ r = !0;
68
71
  break;
69
72
  }
70
- if (l)
71
- for (const r of s) r(e, n);
73
+ if (r)
74
+ for (const l of s) l(e, n);
72
75
  },
73
76
  getState() {
74
77
  return e;
@@ -78,7 +81,7 @@ function Ve(t) {
78
81
  }
79
82
  };
80
83
  }
81
- const oe = [
84
+ const _e = [
82
85
  "January",
83
86
  "February",
84
87
  "March",
@@ -91,16 +94,28 @@ const oe = [
91
94
  "October",
92
95
  "November",
93
96
  "December"
94
- ], qe = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], Oe = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Xe = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
95
- function He(t, e = "short") {
96
- const s = ee(t);
97
- return s ? e === "long" ? Oe[s.getDay()] : Xe[s.getDay()] : "";
97
+ ], Oe = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], qe = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Xe = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
98
+ function We(t) {
99
+ if (!t) return _e;
100
+ try {
101
+ const e = new Intl.DateTimeFormat(t, { month: "long" });
102
+ return Array.from({ length: 12 }, (s, a) => {
103
+ const n = e.format(new Date(2024, a, 1));
104
+ return n.charAt(0).toUpperCase() + n.slice(1);
105
+ });
106
+ } catch {
107
+ return _e;
108
+ }
98
109
  }
99
- function We(t = 0) {
100
- const e = [];
101
- for (let s = 0; s < 7; s++)
102
- e.push(qe[(t + s) % 7]);
103
- return e;
110
+ function He(t, e = "short", s) {
111
+ const a = ee(t);
112
+ return a ? e === "long" ? qe[a.getDay()] : Xe[a.getDay()] : "";
113
+ }
114
+ function Ue(t = 0, e) {
115
+ const s = [];
116
+ for (let a = 0; a < 7; a++)
117
+ s.push(Oe[(t + a) % 7]);
118
+ return s;
104
119
  }
105
120
  function $e(t, e) {
106
121
  return new Date(t, e + 1, 0).getDate();
@@ -108,7 +123,7 @@ function $e(t, e) {
108
123
  function Ge(t, e) {
109
124
  return new Date(t, e, 1).getDay();
110
125
  }
111
- function pe(t) {
126
+ function ue(t) {
112
127
  if (typeof t == "string") return t;
113
128
  const e = t instanceof Date ? t : new Date(t.year, t.month, t.day), s = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
114
129
  return `${s}-${a}-${n}`;
@@ -122,52 +137,52 @@ function ee(t) {
122
137
  }
123
138
  return null;
124
139
  }
125
- function _e(t, e) {
140
+ function be(t, e) {
126
141
  if (!t || !e) return !1;
127
142
  const s = ee(t), a = ee(e);
128
143
  return !s || !a ? !1 : s.getFullYear() === a.getFullYear() && s.getMonth() === a.getMonth() && s.getDate() === a.getDate();
129
144
  }
130
- function me() {
131
- return pe(/* @__PURE__ */ new Date());
145
+ function ge() {
146
+ return ue(/* @__PURE__ */ new Date());
132
147
  }
133
148
  function xe(t, e, s) {
134
149
  const a = new Date(t, e + s, 1);
135
150
  return { year: a.getFullYear(), month: a.getMonth() };
136
151
  }
137
- function fe(t, e) {
152
+ function me(t, e) {
138
153
  const s = ee(t);
139
- return s ? (s.setDate(s.getDate() + e), pe(s)) : t;
154
+ return s ? (s.setDate(s.getDate() + e), ue(s)) : t;
140
155
  }
141
- function Ue(t, e, s = 0) {
142
- const a = $e(t, e), l = (Ge(t, e) - s + 7) % 7, r = [], i = me(), d = xe(t, e, -1), g = $e(d.year, d.month);
143
- for (let k = l - 1; k >= 0; k--) {
144
- const u = g - k, p = pe({ year: d.year, month: d.month, day: u });
145
- r.push({ year: d.year, month: d.month, day: u, dateString: p, isCurrentMonth: !1, isToday: p === i });
156
+ function Ze(t, e, s = 0) {
157
+ const a = $e(t, e), r = (Ge(t, e) - s + 7) % 7, l = [], i = ge(), d = xe(t, e, -1), g = $e(d.year, d.month);
158
+ for (let k = r - 1; k >= 0; k--) {
159
+ const u = g - k, p = ue({ year: d.year, month: d.month, day: u });
160
+ l.push({ year: d.year, month: d.month, day: u, dateString: p, isCurrentMonth: !1, isToday: p === i });
146
161
  }
147
162
  for (let k = 1; k <= a; k++) {
148
- const u = pe({ year: t, month: e, day: k });
149
- r.push({ year: t, month: e, day: k, dateString: u, isCurrentMonth: !0, isToday: u === i });
163
+ const u = ue({ year: t, month: e, day: k });
164
+ l.push({ year: t, month: e, day: k, dateString: u, isCurrentMonth: !0, isToday: u === i });
150
165
  }
151
166
  const c = xe(t, e, 1);
152
- let o = 1;
153
- for (; r.length < 42; ) {
154
- const k = pe({ year: c.year, month: c.month, day: o });
155
- r.push({ year: c.year, month: c.month, day: o, dateString: k, isCurrentMonth: !1, isToday: k === i }), o++;
167
+ let h = 1;
168
+ for (; l.length < 42; ) {
169
+ const k = ue({ year: c.year, month: c.month, day: h });
170
+ l.push({ year: c.year, month: c.month, day: h, dateString: k, isCurrentMonth: !1, isToday: k === i }), h++;
156
171
  }
157
- return r;
172
+ return l;
158
173
  }
159
- function he(t) {
174
+ function de(t) {
160
175
  if (!t || typeof t != "string") return null;
161
176
  const e = t.trim().toUpperCase(), s = e.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/);
162
177
  if (s) {
163
178
  let n = parseInt(s[1], 10);
164
- const l = parseInt(s[2], 10), r = s[3];
165
- return r === "AM" && n === 12 && (n = 0), r === "PM" && n !== 12 && (n += 12), { hours: n, minutes: l };
179
+ const r = parseInt(s[2], 10), l = s[3];
180
+ return l === "AM" && n === 12 && (n = 0), l === "PM" && n !== 12 && (n += 12), { hours: n, minutes: r };
166
181
  }
167
182
  const a = e.match(/^(\d{1,2}):(\d{2})$/);
168
183
  return a ? { hours: parseInt(a[1], 10), minutes: parseInt(a[2], 10) } : null;
169
184
  }
170
- function ge(t, e, s = "24h") {
185
+ function pe(t, e, s = "24h") {
171
186
  const a = String(e).padStart(2, "0");
172
187
  if (s === "12h") {
173
188
  const n = t >= 12 ? "PM" : "AM";
@@ -175,8 +190,8 @@ function ge(t, e, s = "24h") {
175
190
  }
176
191
  return `${String(t).padStart(2, "0")}:${a}`;
177
192
  }
178
- function y(t) {
179
- const e = he(t);
193
+ function w(t) {
194
+ const e = de(t);
180
195
  return e ? e.hours * 60 + e.minutes : 0;
181
196
  }
182
197
  function ce(t) {
@@ -184,120 +199,134 @@ function ce(t) {
184
199
  return `${String(e).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
185
200
  }
186
201
  function Me(t, e, s) {
187
- const a = [], n = y(t), l = y(e);
188
- for (let r = n; r <= l; r += s)
189
- a.push(ce(r));
202
+ const a = [], n = w(t);
203
+ let r = w(e);
204
+ r <= n && (r += 1440);
205
+ for (let l = n; l <= r; l += s)
206
+ a.push(ce(l % 1440));
190
207
  return a;
191
208
  }
192
209
  function Ye() {
193
210
  const t = /* @__PURE__ */ new Date();
194
211
  return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
195
212
  }
196
- function Ze(t, e = 0) {
213
+ function Je(t, e = 0) {
197
214
  const s = ee(t);
198
215
  if (!s) return t;
199
216
  const n = (s.getDay() - e + 7) % 7;
200
- return s.setDate(s.getDate() - n), pe(s);
217
+ return s.setDate(s.getDate() - n), ue(s);
201
218
  }
202
219
  function Te(t, e = 0) {
203
- const s = Ze(t, e), a = [];
220
+ const s = Je(t, e), a = [];
204
221
  for (let n = 0; n < 7; n++)
205
- a.push(fe(s, n));
222
+ a.push(me(s, n));
206
223
  return a;
207
224
  }
208
- function Je(t, e, s) {
209
- const a = ee(e);
210
- if (!a) return "";
225
+ function Ke(t, e, s, a) {
226
+ const n = ee(e);
227
+ if (!n) return "";
228
+ const r = We(a);
211
229
  if (t === "day")
212
- return `${oe[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`;
230
+ return `${r[n.getMonth()]} ${n.getDate()}, ${n.getFullYear()}`;
213
231
  if (t === "week" && s && s.length === 7) {
214
- const n = ee(s[0]), l = ee(s[6]);
215
- return !n || !l ? "" : n.getMonth() === l.getMonth() ? `${oe[n.getMonth()]} ${n.getDate()}–${l.getDate()}, ${n.getFullYear()}` : n.getFullYear() === l.getFullYear() ? `${oe[n.getMonth()].slice(0, 3)} ${n.getDate()} – ${oe[l.getMonth()].slice(0, 3)} ${l.getDate()}, ${n.getFullYear()}` : `${oe[n.getMonth()].slice(0, 3)} ${n.getDate()}, ${n.getFullYear()} – ${oe[l.getMonth()].slice(0, 3)} ${l.getDate()}, ${l.getFullYear()}`;
232
+ const l = ee(s[0]), i = ee(s[6]);
233
+ return !l || !i ? "" : l.getMonth() === i.getMonth() ? `${r[l.getMonth()]} ${l.getDate()}–${i.getDate()}, ${l.getFullYear()}` : l.getFullYear() === i.getFullYear() ? `${r[l.getMonth()].slice(0, 3)} ${l.getDate()} – ${r[i.getMonth()].slice(0, 3)} ${i.getDate()}, ${l.getFullYear()}` : `${r[l.getMonth()].slice(0, 3)} ${l.getDate()}, ${l.getFullYear()} – ${r[i.getMonth()].slice(0, 3)} ${i.getDate()}, ${i.getFullYear()}`;
216
234
  }
217
- return t === "month" ? `${oe[a.getMonth()]} ${a.getFullYear()}` : "";
235
+ return t === "month" ? `${r[n.getMonth()]} ${n.getFullYear()}` : "";
218
236
  }
219
- function ve(t, e) {
237
+ function fe(t, e) {
220
238
  return t.filter((s) => s.start ? s.end && s.end !== s.start ? e >= s.start && e <= s.end : s.start === e : !1);
221
239
  }
222
240
  function ye(t) {
223
241
  if (!t.length) return t;
224
242
  const e = [...t].sort((a, n) => {
225
- const l = y(a.startTime || "00:00"), r = y(n.startTime || "00:00");
226
- if (l !== r) return l - r;
227
- const i = y(a.endTime || "23:59");
228
- return y(n.endTime || "23:59") - r - (i - l);
243
+ const r = w(a.startTime || "00:00"), l = w(n.startTime || "00:00");
244
+ if (r !== l) return r - l;
245
+ const i = w(a.endTime || "23:59");
246
+ return w(n.endTime || "23:59") - l - (i - r);
229
247
  }), s = [];
230
248
  for (const a of e) {
231
- const n = y(a.startTime || "00:00"), l = y(a.endTime || "23:59");
232
- let r = !1;
249
+ const n = w(a.startTime || "00:00"), r = w(a.endTime || "23:59");
250
+ let l = !1;
233
251
  for (let i = 0; i < s.length; i++)
234
252
  if (n >= s[i]) {
235
- a._col = i, s[i] = l, r = !0;
253
+ a._col = i, s[i] = r, l = !0;
236
254
  break;
237
255
  }
238
- r || (a._col = s.length, s.push(l));
256
+ l || (a._col = s.length, s.push(r));
239
257
  }
240
258
  for (const a of e) {
241
- const n = y(a.startTime || "00:00"), l = y(a.endTime || "23:59");
242
- let r = a._col;
259
+ const n = w(a.startTime || "00:00"), r = w(a.endTime || "23:59");
260
+ let l = a._col;
243
261
  for (const i of e) {
244
- const d = y(i.startTime || "00:00"), g = y(i.endTime || "23:59");
245
- d < l && g > n && (r = Math.max(r, i._col));
262
+ const d = w(i.startTime || "00:00"), g = w(i.endTime || "23:59");
263
+ d < r && g > n && (l = Math.max(l, i._col));
246
264
  }
247
- a._totalCols = r + 1;
265
+ a._totalCols = l + 1;
248
266
  }
249
267
  return e;
250
268
  }
251
269
  function ie(t, e, s, a) {
252
- return (y(t) - y(e)) / a * s;
270
+ return (w(t) - w(e)) / a * s;
253
271
  }
254
- function Ie(t, e, s, a) {
255
- const n = t / s * a, l = y(e) + n;
256
- return ce(Math.round(l));
272
+ function Ae(t, e, s, a) {
273
+ const n = t / s * a, r = w(e) + n;
274
+ return ce(Math.round(r));
257
275
  }
258
- function ze(t, e) {
259
- const s = y(t), a = Math.round(s / e) * e;
276
+ function Ie(t, e) {
277
+ const s = w(t), a = Math.round(s / e) * e;
260
278
  return ce(a);
261
279
  }
262
- function Ke(t, e, s) {
263
- return ve(t, s).filter(
280
+ function Qe(t, e, s) {
281
+ return fe(t, s).filter(
264
282
  (a) => a.resourceId === e
265
283
  );
266
284
  }
267
285
  function Be(t, e, s, a, n) {
268
- const l = Ke(t, e, s), r = y(a), i = y(n);
269
- for (const d of l) {
286
+ const r = Qe(t, e, s), l = w(a), i = w(n);
287
+ for (const d of r) {
270
288
  if (!d.startTime || !d.endTime) continue;
271
- const g = y(d.startTime), c = y(d.endTime);
272
- if (r < c && i > g)
289
+ const g = w(d.startTime), c = w(d.endTime);
290
+ if (l < c && i > g)
273
291
  return !1;
274
292
  }
275
293
  return !0;
276
294
  }
277
- function Qe(t, e, s, a, n = "08:00", l = "18:00") {
278
- const { duration: r, resourceId: i, minCapacity: d } = t, g = t.date || me(), c = 14;
279
- let o = e;
280
- i && (o = e.filter((p) => p.id === i)), d && (o = o.filter(
295
+ function et(t, e, s, a, n = "08:00", r = "18:00") {
296
+ const { duration: l, resourceId: i, minCapacity: d } = t, g = t.date || ge(), c = 14;
297
+ let h = e;
298
+ i && (h = e.filter((p) => p.id === i)), d && (h = h.filter(
281
299
  (p) => p.capacity && p.capacity >= d
282
300
  ));
283
- const k = y(n), u = y(l);
301
+ const k = w(n), u = w(r);
284
302
  for (let p = 0; p < c; p++) {
285
- const v = fe(g, p);
286
- for (const h of o)
287
- for (let m = k; m + r <= u; m += a) {
288
- const w = ce(m), T = ce(m + r);
289
- if (Be(s, h.id, v, w, T))
303
+ const f = me(g, p);
304
+ for (const o of h)
305
+ for (let m = k; m + l <= u; m += a) {
306
+ const _ = ce(m), C = ce(m + l);
307
+ if (Be(s, o.id, f, _, C))
290
308
  return {
291
- resourceId: h.id,
292
- date: v,
293
- startTime: w,
294
- endTime: T
309
+ resourceId: o.id,
310
+ date: f,
311
+ startTime: _,
312
+ endTime: C
295
313
  };
296
314
  }
297
315
  }
298
316
  return null;
299
317
  }
300
- const et = `
318
+ function tt(t) {
319
+ if (!Array.isArray(t) || !t.length) return null;
320
+ const e = {};
321
+ for (const s of t)
322
+ !s.name || !s.bg || !s.fg || (e[s.name] = {
323
+ bg: s.bg,
324
+ fg: s.fg,
325
+ hover: s.hover || s.bg
326
+ });
327
+ return Object.keys(e).length ? e : null;
328
+ }
329
+ const at = `
301
330
  :host {
302
331
  /* Light theme (default) */
303
332
  --cal-bg: 0 0% 100%;
@@ -465,7 +494,7 @@ const et = `
465
494
  --cal-status-success-border: 152 40% 28%;
466
495
  }
467
496
  }
468
- `, tt = `
497
+ `, st = `
469
498
  :host {
470
499
  display: inline-block;
471
500
  font-family: inherit;
@@ -506,7 +535,7 @@ const et = `
506
535
  [hidden] {
507
536
  display: none !important;
508
537
  }
509
- `, at = `
538
+ `, nt = `
510
539
  @keyframes cal-fade-in {
511
540
  from { opacity: 0; }
512
541
  to { opacity: 1; }
@@ -570,29 +599,46 @@ const et = `
570
599
  .cal-skeleton--rect {
571
600
  border-radius: var(--cal-radius-sm);
572
601
  }
573
- `, st = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12L6 8l4-4"/></svg>', nt = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4l4 4-4 4"/></svg>';
574
- function lt({ title: t, view: e, onPrev: s, onNext: a, onToday: n, onViewChange: l }) {
575
- const r = document.createElement("div");
576
- r.classList.add("cal-sched-nav");
602
+ `, lt = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12L6 8l4-4"/></svg>', rt = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4l4 4-4 4"/></svg>';
603
+ function it({ title: t, view: e, onPrev: s, onNext: a, onToday: n, onViewChange: r, locale: l }) {
577
604
  const i = document.createElement("div");
578
- i.classList.add("cal-sched-nav__left");
579
- const d = document.createElement("button");
580
- d.classList.add("cal-sched-nav__btn"), d.innerHTML = st, d.setAttribute("aria-label", "Previous"), d.addEventListener("click", s);
605
+ i.classList.add("cal-sched-nav");
606
+ const d = document.createElement("div");
607
+ d.classList.add("cal-sched-nav__left");
581
608
  const g = document.createElement("button");
582
- g.classList.add("cal-sched-nav__btn"), g.innerHTML = nt, g.setAttribute("aria-label", "Next"), g.addEventListener("click", a);
609
+ g.classList.add("cal-sched-nav__btn"), g.innerHTML = lt, g.setAttribute("aria-label", "Previous"), g.addEventListener("click", s);
583
610
  const c = document.createElement("button");
584
- c.classList.add("cal-sched-nav__today"), c.textContent = "Today", c.addEventListener("click", n);
585
- const o = document.createElement("span");
586
- o.classList.add("cal-sched-nav__title"), o.setAttribute("aria-live", "polite"), o.textContent = t, i.appendChild(d), i.appendChild(g), i.appendChild(c), i.appendChild(o);
587
- const k = document.createElement("div");
588
- k.classList.add("cal-sched-nav__tabs");
589
- for (const u of ["day", "week", "month"]) {
590
- const p = document.createElement("button");
591
- p.classList.add("cal-sched-nav__tab"), u === e && p.classList.add("cal-sched-nav__tab--active"), p.textContent = u.charAt(0).toUpperCase() + u.slice(1), p.addEventListener("click", () => l(u)), k.appendChild(p);
592
- }
593
- return r.appendChild(i), r.appendChild(k), r;
611
+ c.classList.add("cal-sched-nav__btn"), c.innerHTML = rt, c.setAttribute("aria-label", "Next"), c.addEventListener("click", a);
612
+ let h = "Today";
613
+ if (l)
614
+ try {
615
+ const _ = new Intl.RelativeTimeFormat(l, { numeric: "auto" }).formatToParts(0, "day").map((C) => C.value).join("");
616
+ h = _.charAt(0).toUpperCase() + _.slice(1);
617
+ } catch {
618
+ }
619
+ const k = document.createElement("button");
620
+ k.classList.add("cal-sched-nav__today"), k.textContent = h, k.addEventListener("click", n);
621
+ const u = document.createElement("span");
622
+ u.classList.add("cal-sched-nav__title"), u.setAttribute("aria-live", "polite"), u.textContent = t, d.appendChild(g), d.appendChild(c), d.appendChild(k), d.appendChild(u);
623
+ const p = document.createElement("div");
624
+ p.classList.add("cal-sched-nav__tabs");
625
+ const f = { day: "Day", week: "Week", month: "Month" };
626
+ if (l)
627
+ try {
628
+ const o = new Intl.DisplayNames(l, { type: "dateTimeField" });
629
+ for (const m of ["day", "week", "month"]) {
630
+ const _ = o.of(m);
631
+ _ && (f[m] = _.charAt(0).toUpperCase() + _.slice(1));
632
+ }
633
+ } catch {
634
+ }
635
+ for (const o of ["day", "week", "month"]) {
636
+ const m = document.createElement("button");
637
+ m.classList.add("cal-sched-nav__tab"), o === e && m.classList.add("cal-sched-nav__tab--active"), m.textContent = f[o], m.addEventListener("click", () => r(o)), p.appendChild(m);
638
+ }
639
+ return i.appendChild(d), i.appendChild(p), i;
594
640
  }
595
- const rt = `
641
+ const ct = `
596
642
  .cal-sched-nav {
597
643
  display: flex;
598
644
  align-items: center;
@@ -681,23 +727,23 @@ const rt = `
681
727
  color: hsl(var(--cal-accent-fg));
682
728
  }
683
729
  `;
684
- function Ne({ startTime: t, endTime: e, interval: s, slotHeight: a, format: n }) {
685
- const l = document.createElement("div");
686
- l.classList.add("cal-sched-time-axis");
687
- const r = Me(t, e, s);
688
- for (let i = 0; i < r.length; i++) {
689
- const d = r[i], g = he(d);
730
+ function je({ startTime: t, endTime: e, interval: s, slotHeight: a, format: n }) {
731
+ const r = document.createElement("div");
732
+ r.classList.add("cal-sched-time-axis");
733
+ const l = Me(t, e, s);
734
+ for (let i = 0; i < l.length; i++) {
735
+ const d = l[i], g = de(d);
690
736
  if (!g) continue;
691
737
  const c = document.createElement("div");
692
738
  if (c.classList.add("cal-sched-time-axis__slot"), c.style.height = `${a}px`, g.minutes === 0) {
693
- const o = document.createElement("span");
694
- o.classList.add("cal-sched-time-axis__label"), o.textContent = ge(g.hours, g.minutes, n), c.appendChild(o);
739
+ const h = document.createElement("span");
740
+ h.classList.add("cal-sched-time-axis__label"), h.textContent = pe(g.hours, g.minutes, n), c.appendChild(h);
695
741
  }
696
- l.appendChild(c);
742
+ r.appendChild(c);
697
743
  }
698
- return l;
744
+ return r;
699
745
  }
700
- const it = `
746
+ const ot = `
701
747
  .cal-sched-time-axis {
702
748
  display: flex;
703
749
  flex-direction: column;
@@ -723,28 +769,28 @@ const it = `
723
769
  user-select: none;
724
770
  }
725
771
  `;
726
- function ct({ resource: t, width: e }) {
772
+ function dt({ resource: t, width: e }) {
727
773
  const s = document.createElement("div");
728
774
  s.classList.add("cal-sched-resource-header"), e && (s.style.width = `${e}px`), s.style.flex = e ? `0 0 ${e}px` : "1 1 0";
729
775
  const a = document.createElement("span");
730
776
  a.classList.add("cal-sched-resource-header__dot");
731
777
  const n = t.color || "blue";
732
778
  a.style.background = `hsl(var(--cal-booking-${n}-fg))`, s.appendChild(a);
733
- const l = document.createElement("span");
734
- if (l.classList.add("cal-sched-resource-header__name"), l.textContent = t.name, s.appendChild(l), t.capacity) {
735
- const r = document.createElement("span");
736
- r.classList.add("cal-sched-resource-header__capacity"), r.textContent = t.capacity, r.setAttribute("title", `Capacity: ${t.capacity}`), s.appendChild(r);
779
+ const r = document.createElement("span");
780
+ if (r.classList.add("cal-sched-resource-header__name"), r.textContent = t.name, s.appendChild(r), t.capacity) {
781
+ const l = document.createElement("span");
782
+ l.classList.add("cal-sched-resource-header__capacity"), l.textContent = t.capacity, l.setAttribute("title", `Capacity: ${t.capacity}`), s.appendChild(l);
737
783
  }
738
784
  return s;
739
785
  }
740
- function dt({ resources: t }) {
786
+ function ht({ resources: t }) {
741
787
  const e = document.createElement("div");
742
788
  e.classList.add("cal-sched-resource-header-row");
743
789
  for (const s of t)
744
- e.appendChild(ct({ resource: s }));
790
+ e.appendChild(dt({ resource: s }));
745
791
  return e;
746
792
  }
747
- const ot = `
793
+ const ut = `
748
794
  .cal-sched-resource-header-row {
749
795
  display: flex;
750
796
  border-bottom: 1px solid hsl(var(--cal-sched-grid-line));
@@ -789,81 +835,81 @@ const ot = `
789
835
  flex-shrink: 0;
790
836
  }
791
837
  `;
792
- function we({ event: t, gridStartTime: e, slotHeight: s, interval: a, format: n, onClick: l, eventContent: r, showTime: i = !0, resource: d, draggable: g }) {
838
+ function we({ event: t, gridStartTime: e, slotHeight: s, interval: a, format: n, onClick: r, eventContent: l, showTime: i = !0, resource: d, draggable: g }) {
793
839
  const c = document.createElement("div");
794
840
  c.classList.add("cal-sched-event"), c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.dataset.eventId = t.id;
795
- const o = !!t.locked;
796
- g && !o && (c.dataset.draggable = "true"), o && c.classList.add("cal-sched-event--locked");
841
+ const h = !!t.locked;
842
+ g && !h && (c.dataset.draggable = "true"), h && c.classList.add("cal-sched-event--locked");
797
843
  const k = t.color || "blue";
798
844
  if (c.style.setProperty("--ev-bg", `var(--cal-booking-${k}-bg)`), c.style.setProperty("--ev-fg", `var(--cal-booking-${k}-fg)`), t.startTime && t.endTime) {
799
- const u = ie(t.startTime, e, s, a), p = ie(t.endTime, e, s, a), v = Math.max(p - u, s * 0.5);
800
- if (c.style.top = `${u}px`, c.style.height = `${v}px`, t._totalCols > 1) {
801
- const h = 100 / t._totalCols;
802
- c.style.left = `${t._col * h}%`, c.style.width = `${h}%`;
845
+ const u = ie(t.startTime, e, s, a), p = ie(t.endTime, e, s, a), f = Math.max(p - u, s * 0.5);
846
+ if (c.style.top = `${u}px`, c.style.height = `${f}px`, t._totalCols > 1) {
847
+ const o = 100 / t._totalCols;
848
+ c.style.left = `${t._col * o}%`, c.style.width = `${o}%`;
803
849
  }
804
850
  }
805
- if (typeof r == "function") {
806
- const u = r(t, d), p = document.createElement("div");
851
+ if (typeof l == "function") {
852
+ const u = l(t, d), p = document.createElement("div");
807
853
  p.classList.add("cal-sched-event__custom"), u instanceof HTMLElement ? p.appendChild(u) : u != null && (p.textContent = String(u)), c.appendChild(p);
808
854
  } else {
809
855
  const u = document.createElement("div");
810
856
  if (u.classList.add("cal-sched-event__title"), u.textContent = t.title || "", c.appendChild(u), i && t.startTime && t.endTime) {
811
857
  const p = document.createElement("div");
812
858
  p.classList.add("cal-sched-event__time");
813
- const v = he(t.startTime), h = he(t.endTime);
814
- v && h && (p.textContent = `${ge(v.hours, v.minutes, n)}–${ge(h.hours, h.minutes, n)}`), c.appendChild(p);
859
+ const f = de(t.startTime), o = de(t.endTime);
860
+ f && o && (p.textContent = `${pe(f.hours, f.minutes, n)}–${pe(o.hours, o.minutes, n)}`), c.appendChild(p);
815
861
  }
816
862
  }
817
- if (g && !o) {
863
+ if (g && !h) {
818
864
  const u = document.createElement("div");
819
865
  u.classList.add("cal-sched-event__resize-handle"), c.appendChild(u);
820
866
  }
821
- return l && (c.addEventListener("click", (u) => {
867
+ return r && (c.addEventListener("click", (u) => {
822
868
  if (c.dataset.wasDragged) {
823
869
  delete c.dataset.wasDragged;
824
870
  return;
825
871
  }
826
- u.stopPropagation(), l(t);
872
+ u.stopPropagation(), r(t);
827
873
  }), c.addEventListener("keydown", (u) => {
828
- (u.key === "Enter" || u.key === " ") && (u.preventDefault(), u.stopPropagation(), l(t));
874
+ (u.key === "Enter" || u.key === " ") && (u.preventDefault(), u.stopPropagation(), r(t));
829
875
  })), c;
830
876
  }
831
- function je({ event: t, onClick: e, eventContent: s, resource: a }) {
877
+ function Ne({ event: t, onClick: e, eventContent: s, resource: a }) {
832
878
  const n = document.createElement("div");
833
879
  n.classList.add("cal-sched-allday-chip"), n.dataset.eventId = t.id;
834
- const l = t.color || "blue";
835
- if (n.style.setProperty("--ev-bg", `var(--cal-booking-${l}-bg)`), n.style.setProperty("--ev-fg", `var(--cal-booking-${l}-fg)`), typeof s == "function") {
836
- const r = s(t, a);
837
- r instanceof HTMLElement ? n.appendChild(r) : r != null && (n.textContent = String(r));
880
+ const r = t.color || "blue";
881
+ if (n.style.setProperty("--ev-bg", `var(--cal-booking-${r}-bg)`), n.style.setProperty("--ev-fg", `var(--cal-booking-${r}-fg)`), typeof s == "function") {
882
+ const l = s(t, a);
883
+ l instanceof HTMLElement ? n.appendChild(l) : l != null && (n.textContent = String(l));
838
884
  } else
839
885
  n.textContent = t.title || "";
840
- return e && n.addEventListener("click", (r) => {
841
- r.stopPropagation(), e(t);
886
+ return e && n.addEventListener("click", (l) => {
887
+ l.stopPropagation(), e(t);
842
888
  }), n;
843
889
  }
844
- function ht({ event: t, format: e, onClick: s, eventContent: a, resource: n }) {
845
- const l = document.createElement("div");
846
- l.classList.add("cal-sched-month-chip"), l.dataset.eventId = t.id;
847
- const r = t.color || "blue";
848
- if (l.style.setProperty("--ev-bg", `var(--cal-booking-${r}-bg)`), l.style.setProperty("--ev-fg", `var(--cal-booking-${r}-fg)`), typeof a == "function") {
890
+ function pt({ event: t, format: e, onClick: s, eventContent: a, resource: n }) {
891
+ const r = document.createElement("div");
892
+ r.classList.add("cal-sched-month-chip"), r.dataset.eventId = t.id;
893
+ const l = t.color || "blue";
894
+ if (r.style.setProperty("--ev-bg", `var(--cal-booking-${l}-bg)`), r.style.setProperty("--ev-fg", `var(--cal-booking-${l}-fg)`), typeof a == "function") {
849
895
  const i = a(t, n);
850
- i instanceof HTMLElement ? l.appendChild(i) : i != null && (l.textContent = String(i));
896
+ i instanceof HTMLElement ? r.appendChild(i) : i != null && (r.textContent = String(i));
851
897
  } else {
852
898
  const i = document.createElement("span");
853
- i.classList.add("cal-sched-month-chip__dot"), i.style.background = `hsl(var(--cal-booking-${r}-fg))`, l.appendChild(i);
899
+ i.classList.add("cal-sched-month-chip__dot"), i.style.background = `hsl(var(--cal-booking-${l}-fg))`, r.appendChild(i);
854
900
  const d = document.createElement("span");
855
901
  if (d.classList.add("cal-sched-month-chip__text"), t.startTime) {
856
- const g = he(t.startTime), c = g ? ge(g.hours, g.minutes, e) : t.startTime;
902
+ const g = de(t.startTime), c = g ? pe(g.hours, g.minutes, e) : t.startTime;
857
903
  d.textContent = `${c} ${t.title || ""}`;
858
904
  } else
859
905
  d.textContent = t.title || "";
860
- l.appendChild(d);
906
+ r.appendChild(d);
861
907
  }
862
- return s && l.addEventListener("click", (i) => {
908
+ return s && r.addEventListener("click", (i) => {
863
909
  i.stopPropagation(), s(t);
864
- }), l;
910
+ }), r;
865
911
  }
866
- const ut = `
912
+ const gt = `
867
913
  .cal-sched-event {
868
914
  position: absolute;
869
915
  left: 2px;
@@ -980,13 +1026,13 @@ const ut = `
980
1026
  text-overflow: ellipsis;
981
1027
  }
982
1028
  `;
983
- function be({ date: t, startTime: e, endTime: s, resourceName: a, format: n, onCreate: l }) {
984
- const r = document.createElement("div");
985
- r.classList.add("cal-sched-slot-prompt", "cal-animate-fade");
1029
+ function ve({ date: t, startTime: e, endTime: s, resourceName: a, format: n, onCreate: r }) {
1030
+ const l = document.createElement("div");
1031
+ l.classList.add("cal-sched-slot-prompt", "cal-animate-fade");
986
1032
  const i = document.createElement("div");
987
1033
  if (i.classList.add("cal-sched-slot-prompt__info"), e && s) {
988
- const g = he(e), c = he(s), o = document.createElement("div");
989
- o.classList.add("cal-sched-slot-prompt__time"), g && c && (o.textContent = `${ge(g.hours, g.minutes, n)}–${ge(c.hours, c.minutes, n)}`), i.appendChild(o);
1034
+ const g = de(e), c = de(s), h = document.createElement("div");
1035
+ h.classList.add("cal-sched-slot-prompt__time"), g && c && (h.textContent = `${pe(g.hours, g.minutes, n)}–${pe(c.hours, c.minutes, n)}`), i.appendChild(h);
990
1036
  } else {
991
1037
  const g = document.createElement("div");
992
1038
  g.classList.add("cal-sched-slot-prompt__time"), g.textContent = t, i.appendChild(g);
@@ -995,13 +1041,13 @@ function be({ date: t, startTime: e, endTime: s, resourceName: a, format: n, onC
995
1041
  const g = document.createElement("div");
996
1042
  g.classList.add("cal-sched-slot-prompt__resource"), g.textContent = a, i.appendChild(g);
997
1043
  }
998
- r.appendChild(i);
1044
+ l.appendChild(i);
999
1045
  const d = document.createElement("button");
1000
1046
  return d.classList.add("cal-sched-slot-prompt__btn"), d.setAttribute("aria-label", "Create event"), d.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M7 3v8M3 7h8"/></svg>', d.addEventListener("click", (g) => {
1001
- g.stopPropagation(), l == null || l();
1002
- }), r.appendChild(d), r.addEventListener("click", (g) => g.stopPropagation()), r;
1047
+ g.stopPropagation(), r == null || r();
1048
+ }), l.appendChild(d), l.addEventListener("click", (g) => g.stopPropagation()), l;
1003
1049
  }
1004
- const pt = `
1050
+ const mt = `
1005
1051
  .cal-sched-slot-prompt {
1006
1052
  position: absolute;
1007
1053
  z-index: 10;
@@ -1066,142 +1112,142 @@ const pt = `
1066
1112
  box-shadow: inset 0 0 0 1.5px hsl(var(--cal-accent));
1067
1113
  }
1068
1114
  `;
1069
- function gt({
1115
+ function ft({
1070
1116
  date: t,
1071
1117
  resources: e,
1072
1118
  events: s,
1073
1119
  startTime: a,
1074
1120
  endTime: n,
1075
- interval: l,
1076
- slotHeight: r,
1121
+ interval: r,
1122
+ slotHeight: l,
1077
1123
  format: i,
1078
1124
  layout: d,
1079
1125
  resourceMode: g,
1080
1126
  selectedSlot: c,
1081
- eventContent: o,
1127
+ eventContent: h,
1082
1128
  showTime: k = !0,
1083
1129
  draggable: u,
1084
1130
  onSlotClick: p,
1085
- onEventClick: v,
1086
- onSlotCreate: h
1131
+ onEventClick: f,
1132
+ onSlotCreate: o
1087
1133
  }) {
1088
1134
  const m = document.createElement("div");
1089
1135
  m.classList.add("cal-sched-day"), d === "horizontal" && m.classList.add("cal-sched-day--horizontal");
1090
- const w = g === "tabs", T = e.length > 1 && !w, D = ve(s, t), F = D.filter((_) => !_.startTime || !_.endTime), X = D.filter((_) => _.startTime && _.endTime), Y = Me(a, n, l);
1136
+ const _ = g === "tabs", C = e.length > 1 && !_, D = fe(s, t), F = D.filter((x) => !x.startTime || !x.endTime), X = D.filter((x) => x.startTime && x.endTime), Y = Me(a, n, r);
1091
1137
  if (F.length > 0) {
1092
- const _ = document.createElement("div");
1093
- _.classList.add("cal-sched-day__allday");
1138
+ const x = document.createElement("div");
1139
+ x.classList.add("cal-sched-day__allday");
1094
1140
  const E = document.createElement("div");
1095
- E.classList.add("cal-sched-day__allday-label"), E.textContent = "All day", _.appendChild(E);
1141
+ E.classList.add("cal-sched-day__allday-label"), E.textContent = "All day", x.appendChild(E);
1096
1142
  const Z = document.createElement("div");
1097
1143
  Z.classList.add("cal-sched-day__allday-chips");
1098
- for (const j of F) {
1099
- const M = e.find((f) => f.id === j.resourceId);
1100
- Z.appendChild(je({
1101
- event: j,
1102
- onClick: (f) => v == null ? void 0 : v(f, j.resourceId, M),
1103
- eventContent: o,
1144
+ for (const N of F) {
1145
+ const M = e.find((v) => v.id === N.resourceId);
1146
+ Z.appendChild(Ne({
1147
+ event: N,
1148
+ onClick: (v) => f == null ? void 0 : f(v, N.resourceId, M),
1149
+ eventContent: h,
1104
1150
  resource: M
1105
1151
  }));
1106
1152
  }
1107
- _.appendChild(Z), m.appendChild(_);
1153
+ x.appendChild(Z), m.appendChild(x);
1108
1154
  }
1109
- if (T) {
1110
- const _ = document.createElement("div");
1111
- _.classList.add("cal-sched-day__header");
1155
+ if (C) {
1156
+ const x = document.createElement("div");
1157
+ x.classList.add("cal-sched-day__header");
1112
1158
  const E = document.createElement("div");
1113
- E.classList.add("cal-sched-day__header-spacer"), _.appendChild(E), _.appendChild(dt({ resources: e })), m.appendChild(_);
1159
+ E.classList.add("cal-sched-day__header-spacer"), x.appendChild(E), x.appendChild(ht({ resources: e })), m.appendChild(x);
1114
1160
  }
1115
- const N = document.createElement("div");
1116
- N.classList.add("cal-sched-day__grid-area"), N.appendChild(Ne({ startTime: a, endTime: n, interval: l, slotHeight: r, format: i }));
1161
+ const j = document.createElement("div");
1162
+ j.classList.add("cal-sched-day__grid-area"), j.appendChild(je({ startTime: a, endTime: n, interval: r, slotHeight: l, format: i }));
1117
1163
  const P = document.createElement("div");
1118
- if (P.classList.add("cal-sched-day__lanes"), T)
1119
- for (const _ of e) {
1164
+ if (P.classList.add("cal-sched-day__lanes"), C)
1165
+ for (const x of e) {
1120
1166
  const E = document.createElement("div");
1121
- E.classList.add("cal-sched-day__lane"), E.style.flex = "1 1 0", E.dataset.resourceId = _.id, E.dataset.date = t;
1167
+ E.classList.add("cal-sched-day__lane"), E.style.flex = "1 1 0", E.dataset.resourceId = x.id, E.dataset.date = t;
1122
1168
  for (let M = 0; M < Y.length; M++) {
1123
- const f = document.createElement("div");
1124
- f.classList.add("cal-sched-day__slot"), f.style.height = `${r}px`, f.dataset.time = Y[M], f.dataset.resourceId = _.id;
1125
- const z = M < Y.length - 1 ? Y[M + 1] : n;
1126
- c && c.date === t && c.startTime === Y[M] && c.resourceId === _.id && (f.classList.add("cal-sched-day__slot--selected"), f.appendChild(be({
1169
+ const v = document.createElement("div");
1170
+ v.classList.add("cal-sched-day__slot"), v.style.height = `${l}px`, v.dataset.time = Y[M], v.dataset.resourceId = x.id;
1171
+ const I = M < Y.length - 1 ? Y[M + 1] : n;
1172
+ c && c.date === t && c.startTime === Y[M] && c.resourceId === x.id && (v.classList.add("cal-sched-day__slot--selected"), v.appendChild(ve({
1127
1173
  date: t,
1128
1174
  startTime: Y[M],
1129
- endTime: z,
1130
- resourceName: _.name,
1175
+ endTime: I,
1176
+ resourceName: x.name,
1131
1177
  format: i,
1132
- onCreate: () => h == null ? void 0 : h(t, Y[M], z, _.id, _)
1133
- }))), f.addEventListener("click", () => {
1134
- p == null || p(t, Y[M], z, _.id, _);
1135
- }), E.appendChild(f);
1178
+ onCreate: () => o == null ? void 0 : o(t, Y[M], I, x.id, x)
1179
+ }))), v.addEventListener("click", () => {
1180
+ p == null || p(t, Y[M], I, x.id, x);
1181
+ }), E.appendChild(v);
1136
1182
  }
1137
- const Z = X.filter((M) => M.resourceId === _.id), j = ye(Z);
1138
- for (const M of j)
1183
+ const Z = X.filter((M) => M.resourceId === x.id), N = ye(Z);
1184
+ for (const M of N)
1139
1185
  E.appendChild(we({
1140
1186
  event: M,
1141
1187
  gridStartTime: a,
1142
- slotHeight: r,
1143
- interval: l,
1188
+ slotHeight: l,
1189
+ interval: r,
1144
1190
  format: i,
1145
- onClick: (f) => v == null ? void 0 : v(f, _.id, _),
1146
- eventContent: o,
1191
+ onClick: (v) => f == null ? void 0 : f(v, x.id, x),
1192
+ eventContent: h,
1147
1193
  showTime: k,
1148
- resource: _,
1194
+ resource: x,
1149
1195
  draggable: u
1150
1196
  }));
1151
1197
  P.appendChild(E);
1152
1198
  }
1153
1199
  else {
1154
- const _ = document.createElement("div");
1155
- _.classList.add("cal-sched-day__lane"), _.style.flex = "1 1 0", _.dataset.date = t;
1200
+ const x = document.createElement("div");
1201
+ x.classList.add("cal-sched-day__lane"), x.style.flex = "1 1 0", x.dataset.date = t;
1156
1202
  const E = e.length === 1 ? e[0] : null;
1157
- E && (_.dataset.resourceId = E.id);
1158
- for (let j = 0; j < Y.length; j++) {
1203
+ E && (x.dataset.resourceId = E.id);
1204
+ for (let N = 0; N < Y.length; N++) {
1159
1205
  const M = document.createElement("div");
1160
- M.classList.add("cal-sched-day__slot"), M.style.height = `${r}px`, M.dataset.time = Y[j];
1161
- const f = j < Y.length - 1 ? Y[j + 1] : n, z = (E == null ? void 0 : E.id) || null;
1162
- c && c.date === t && c.startTime === Y[j] && (c.resourceId === z || !c.resourceId && !z) && (M.classList.add("cal-sched-day__slot--selected"), M.appendChild(be({
1206
+ M.classList.add("cal-sched-day__slot"), M.style.height = `${l}px`, M.dataset.time = Y[N];
1207
+ const v = N < Y.length - 1 ? Y[N + 1] : n, I = (E == null ? void 0 : E.id) || null;
1208
+ c && c.date === t && c.startTime === Y[N] && (c.resourceId === I || !c.resourceId && !I) && (M.classList.add("cal-sched-day__slot--selected"), M.appendChild(ve({
1163
1209
  date: t,
1164
- startTime: Y[j],
1165
- endTime: f,
1210
+ startTime: Y[N],
1211
+ endTime: v,
1166
1212
  resourceName: (E == null ? void 0 : E.name) || null,
1167
1213
  format: i,
1168
- onCreate: () => h == null ? void 0 : h(t, Y[j], f, z, E)
1214
+ onCreate: () => o == null ? void 0 : o(t, Y[N], v, I, E)
1169
1215
  }))), M.addEventListener("click", () => {
1170
- p == null || p(t, Y[j], f, z, E);
1171
- }), _.appendChild(M);
1216
+ p == null || p(t, Y[N], v, I, E);
1217
+ }), x.appendChild(M);
1172
1218
  }
1173
1219
  const Z = ye(X);
1174
- for (const j of Z) {
1175
- const M = e.find((f) => f.id === j.resourceId) || e[0];
1176
- _.appendChild(we({
1177
- event: j,
1220
+ for (const N of Z) {
1221
+ const M = e.find((v) => v.id === N.resourceId) || e[0];
1222
+ x.appendChild(we({
1223
+ event: N,
1178
1224
  gridStartTime: a,
1179
- slotHeight: r,
1180
- interval: l,
1225
+ slotHeight: l,
1226
+ interval: r,
1181
1227
  format: i,
1182
- onClick: (f) => v == null ? void 0 : v(f, j.resourceId, M),
1183
- eventContent: o,
1228
+ onClick: (v) => f == null ? void 0 : f(v, N.resourceId, M),
1229
+ eventContent: h,
1184
1230
  showTime: k,
1185
1231
  resource: M,
1186
1232
  draggable: u
1187
1233
  }));
1188
1234
  }
1189
- P.appendChild(_);
1190
- }
1191
- N.appendChild(P);
1192
- const H = me();
1193
- if (_e(t, H)) {
1194
- const _ = Ye(), E = y(_), Z = y(a), j = y(n);
1195
- if (E >= Z && E <= j) {
1196
- const M = ie(_, a, r, l), f = document.createElement("div");
1197
- f.classList.add("cal-sched-now-line"), f.style.top = `${M}px`;
1198
- const z = document.createElement("div");
1199
- z.classList.add("cal-sched-now-line__dot"), f.appendChild(z), P.appendChild(f);
1235
+ P.appendChild(x);
1236
+ }
1237
+ j.appendChild(P);
1238
+ const H = ge();
1239
+ if (be(t, H)) {
1240
+ const x = Ye(), E = w(x), Z = w(a), N = w(n);
1241
+ if (E >= Z && E <= N) {
1242
+ const M = ie(x, a, l, r), v = document.createElement("div");
1243
+ v.classList.add("cal-sched-now-line"), v.style.top = `${M}px`;
1244
+ const I = document.createElement("div");
1245
+ I.classList.add("cal-sched-now-line__dot"), v.appendChild(I), P.appendChild(v);
1200
1246
  }
1201
1247
  }
1202
- return m.appendChild(N), m;
1248
+ return m.appendChild(j), m;
1203
1249
  }
1204
- const mt = `
1250
+ const vt = `
1205
1251
  .cal-sched-day {
1206
1252
  display: flex;
1207
1253
  flex-direction: column;
@@ -1341,208 +1387,208 @@ const mt = `
1341
1387
  padding: 4px 0;
1342
1388
  }
1343
1389
  `, Le = 3, Ce = 5;
1344
- function ft({
1390
+ function bt({
1345
1391
  date: t,
1346
1392
  firstDay: e,
1347
1393
  resources: s,
1348
1394
  events: a,
1349
1395
  startTime: n,
1350
- endTime: l,
1351
- interval: r,
1396
+ endTime: r,
1397
+ interval: l,
1352
1398
  slotHeight: i,
1353
1399
  format: d,
1354
1400
  layout: g,
1355
1401
  resourceMode: c,
1356
- selectedSlot: o,
1402
+ selectedSlot: h,
1357
1403
  eventContent: k,
1358
1404
  showTime: u = !0,
1359
1405
  draggable: p,
1360
- allDayCollapsed: v,
1361
- onToggleAllDay: h,
1406
+ allDayCollapsed: f,
1407
+ onToggleAllDay: o,
1362
1408
  onSlotClick: m,
1363
- onEventClick: w,
1364
- onSlotCreate: T
1409
+ onEventClick: _,
1410
+ onSlotCreate: C
1365
1411
  }) {
1366
1412
  const D = document.createElement("div");
1367
1413
  D.classList.add("cal-sched-week"), g === "horizontal" && D.classList.add("cal-sched-week--horizontal");
1368
- const F = Te(t, e), X = c === "tabs", Y = s.length > 1 && !X, N = Me(n, l, r), P = me(), H = {};
1369
- for (const f of F) {
1370
- const z = ve(a, f).filter((W) => !W.startTime || !W.endTime);
1371
- z.length && (H[f] = z);
1414
+ const F = Te(t, e), X = c === "tabs", Y = s.length > 1 && !X, j = Me(n, r, l), P = ge(), H = {};
1415
+ for (const v of F) {
1416
+ const I = fe(a, v).filter((W) => !W.startTime || !W.endTime);
1417
+ I.length && (H[v] = I);
1372
1418
  }
1373
1419
  if (Object.keys(H).length > 0) {
1374
- const f = document.createElement("div");
1375
- f.classList.add("cal-sched-week__allday"), v && f.classList.add("cal-sched-week__allday--collapsed");
1376
- const z = document.createElement("div");
1377
- z.classList.add("cal-sched-week__allday-spacer");
1420
+ const v = document.createElement("div");
1421
+ v.classList.add("cal-sched-week__allday"), f && v.classList.add("cal-sched-week__allday--collapsed");
1422
+ const I = document.createElement("div");
1423
+ I.classList.add("cal-sched-week__allday-spacer");
1378
1424
  const W = document.createElement("span");
1379
- W.textContent = "All day", z.appendChild(W);
1425
+ W.textContent = "All day", I.appendChild(W);
1380
1426
  const $ = document.createElement("button");
1381
- $.classList.add("cal-sched-week__allday-toggle"), $.setAttribute("aria-label", v ? "Expand all-day events" : "Collapse all-day events"), $.innerHTML = v ? '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5l3 3 3-3"/></svg>' : '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7l3-3 3 3"/></svg>', $.addEventListener("click", (R) => {
1382
- R.stopPropagation(), h == null || h();
1383
- }), z.appendChild($), f.appendChild(z);
1427
+ $.classList.add("cal-sched-week__allday-toggle"), $.setAttribute("aria-label", f ? "Expand all-day events" : "Collapse all-day events"), $.innerHTML = f ? '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5l3 3 3-3"/></svg>' : '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7l3-3 3 3"/></svg>', $.addEventListener("click", (R) => {
1428
+ R.stopPropagation(), o == null || o();
1429
+ }), I.appendChild($), v.appendChild(I);
1384
1430
  for (const R of F) {
1385
- const U = document.createElement("div");
1386
- U.classList.add("cal-sched-week__allday-cell");
1387
- const I = H[R] || [];
1388
- if (v) {
1389
- if (I.length > 0) {
1390
- const C = document.createElement("div");
1391
- C.classList.add("cal-sched-week__allday-dots");
1392
- const A = I.slice(0, Ce);
1393
- for (const G of A) {
1431
+ const G = document.createElement("div");
1432
+ G.classList.add("cal-sched-week__allday-cell");
1433
+ const A = H[R] || [];
1434
+ if (f) {
1435
+ if (A.length > 0) {
1436
+ const T = document.createElement("div");
1437
+ T.classList.add("cal-sched-week__allday-dots");
1438
+ const z = A.slice(0, Ce);
1439
+ for (const U of z) {
1394
1440
  const le = document.createElement("span");
1395
1441
  le.classList.add("cal-sched-week__allday-dot");
1396
- const ke = G.color || "blue";
1397
- le.style.background = `hsl(var(--cal-booking-${ke}-fg))`, C.appendChild(le);
1442
+ const ke = U.color || "blue";
1443
+ le.style.background = `hsl(var(--cal-booking-${ke}-fg))`, T.appendChild(le);
1398
1444
  }
1399
- if (I.length > Ce) {
1400
- const G = document.createElement("span");
1401
- G.classList.add("cal-sched-week__allday-overflow"), G.textContent = `+${I.length - Ce}`, C.appendChild(G);
1445
+ if (A.length > Ce) {
1446
+ const U = document.createElement("span");
1447
+ U.classList.add("cal-sched-week__allday-overflow"), U.textContent = `+${A.length - Ce}`, T.appendChild(U);
1402
1448
  }
1403
- U.appendChild(C);
1449
+ G.appendChild(T);
1404
1450
  }
1405
1451
  } else {
1406
- const C = I.slice(0, Le);
1407
- for (const A of C) {
1408
- const G = s.find((le) => le.id === A.resourceId);
1409
- U.appendChild(je({
1410
- event: A,
1411
- onClick: (le) => w == null ? void 0 : w(le, A.resourceId, G),
1452
+ const T = A.slice(0, Le);
1453
+ for (const z of T) {
1454
+ const U = s.find((le) => le.id === z.resourceId);
1455
+ G.appendChild(Ne({
1456
+ event: z,
1457
+ onClick: (le) => _ == null ? void 0 : _(le, z.resourceId, U),
1412
1458
  eventContent: k,
1413
- resource: G
1459
+ resource: U
1414
1460
  }));
1415
1461
  }
1416
- if (I.length > Le) {
1417
- const A = document.createElement("span");
1418
- A.classList.add("cal-sched-week__allday-overflow"), A.textContent = `+${I.length - Le}`, U.appendChild(A);
1462
+ if (A.length > Le) {
1463
+ const z = document.createElement("span");
1464
+ z.classList.add("cal-sched-week__allday-overflow"), z.textContent = `+${A.length - Le}`, G.appendChild(z);
1419
1465
  }
1420
1466
  }
1421
- f.appendChild(U);
1467
+ v.appendChild(G);
1422
1468
  }
1423
- D.appendChild(f);
1469
+ D.appendChild(v);
1424
1470
  }
1425
1471
  const E = document.createElement("div");
1426
1472
  E.classList.add("cal-sched-week__header");
1427
1473
  const Z = document.createElement("div");
1428
1474
  Z.classList.add("cal-sched-week__header-spacer"), E.appendChild(Z);
1429
- for (const f of F) {
1430
- const z = ee(f), W = document.createElement("div");
1431
- W.classList.add("cal-sched-week__day-header"), _e(f, P) && W.classList.add("cal-sched-week__day-header--today");
1475
+ for (const v of F) {
1476
+ const I = ee(v), W = document.createElement("div");
1477
+ W.classList.add("cal-sched-week__day-header"), be(v, P) && W.classList.add("cal-sched-week__day-header--today");
1432
1478
  const $ = document.createElement("span");
1433
- $.classList.add("cal-sched-week__day-name"), $.textContent = He(f);
1479
+ $.classList.add("cal-sched-week__day-name"), $.textContent = He(v);
1434
1480
  const R = document.createElement("span");
1435
- if (R.classList.add("cal-sched-week__day-num"), _e(f, P) && R.classList.add("cal-sched-week__day-num--today"), R.textContent = z ? z.getDate() : "", W.appendChild($), W.appendChild(R), Y) {
1436
- const U = document.createElement("div");
1437
- U.classList.add("cal-sched-week__res-row");
1438
- for (const I of s) {
1439
- const C = document.createElement("span");
1440
- C.classList.add("cal-sched-week__res-label");
1441
- const A = document.createElement("span");
1442
- A.classList.add("cal-sched-week__res-dot"), A.style.background = `hsl(var(--cal-booking-${I.color || "blue"}-fg))`, C.appendChild(A), C.appendChild(document.createTextNode(I.name)), U.appendChild(C);
1481
+ if (R.classList.add("cal-sched-week__day-num"), be(v, P) && R.classList.add("cal-sched-week__day-num--today"), R.textContent = I ? I.getDate() : "", W.appendChild($), W.appendChild(R), Y) {
1482
+ const G = document.createElement("div");
1483
+ G.classList.add("cal-sched-week__res-row");
1484
+ for (const A of s) {
1485
+ const T = document.createElement("span");
1486
+ T.classList.add("cal-sched-week__res-label");
1487
+ const z = document.createElement("span");
1488
+ z.classList.add("cal-sched-week__res-dot"), z.style.background = `hsl(var(--cal-booking-${A.color || "blue"}-fg))`, T.appendChild(z), T.appendChild(document.createTextNode(A.name)), G.appendChild(T);
1443
1489
  }
1444
- W.appendChild(U);
1490
+ W.appendChild(G);
1445
1491
  }
1446
1492
  E.appendChild(W);
1447
1493
  }
1448
1494
  D.appendChild(E);
1449
- const j = document.createElement("div");
1450
- j.classList.add("cal-sched-week__grid-area"), j.appendChild(Ne({ startTime: n, endTime: l, interval: r, slotHeight: i, format: d }));
1495
+ const N = document.createElement("div");
1496
+ N.classList.add("cal-sched-week__grid-area"), N.appendChild(je({ startTime: n, endTime: r, interval: l, slotHeight: i, format: d }));
1451
1497
  const M = document.createElement("div");
1452
1498
  M.classList.add("cal-sched-week__cols");
1453
- for (const f of F) {
1454
- const z = document.createElement("div");
1455
- z.classList.add("cal-sched-week__day-col"), z.dataset.date = f, _e(f, P) && z.classList.add("cal-sched-week__day-col--today");
1456
- const W = ve(a, f).filter(($) => $.startTime && $.endTime);
1499
+ for (const v of F) {
1500
+ const I = document.createElement("div");
1501
+ I.classList.add("cal-sched-week__day-col"), I.dataset.date = v, be(v, P) && I.classList.add("cal-sched-week__day-col--today");
1502
+ const W = fe(a, v).filter(($) => $.startTime && $.endTime);
1457
1503
  if (Y)
1458
1504
  for (const $ of s) {
1459
1505
  const R = document.createElement("div");
1460
1506
  R.classList.add("cal-sched-week__lane"), R.dataset.resourceId = $.id;
1461
- for (let C = 0; C < N.length; C++) {
1462
- const A = document.createElement("div");
1463
- A.classList.add("cal-sched-week__slot"), A.style.height = `${i}px`, A.dataset.time = N[C];
1464
- const G = C < N.length - 1 ? N[C + 1] : l;
1465
- o && o.date === f && o.startTime === N[C] && o.resourceId === $.id && (A.classList.add("cal-sched-week__slot--selected"), A.appendChild(be({
1466
- date: f,
1467
- startTime: N[C],
1468
- endTime: G,
1507
+ for (let T = 0; T < j.length; T++) {
1508
+ const z = document.createElement("div");
1509
+ z.classList.add("cal-sched-week__slot"), z.style.height = `${i}px`, z.dataset.time = j[T];
1510
+ const U = T < j.length - 1 ? j[T + 1] : r;
1511
+ h && h.date === v && h.startTime === j[T] && h.resourceId === $.id && (z.classList.add("cal-sched-week__slot--selected"), z.appendChild(ve({
1512
+ date: v,
1513
+ startTime: j[T],
1514
+ endTime: U,
1469
1515
  resourceName: $.name,
1470
1516
  format: d,
1471
- onCreate: () => T == null ? void 0 : T(f, N[C], G, $.id, $)
1472
- }))), A.addEventListener("click", () => {
1473
- m == null || m(f, N[C], G, $.id, $);
1474
- }), R.appendChild(A);
1517
+ onCreate: () => C == null ? void 0 : C(v, j[T], U, $.id, $)
1518
+ }))), z.addEventListener("click", () => {
1519
+ m == null || m(v, j[T], U, $.id, $);
1520
+ }), R.appendChild(z);
1475
1521
  }
1476
- const U = W.filter((C) => C.resourceId === $.id), I = ye(U);
1477
- for (const C of I)
1522
+ const G = W.filter((T) => T.resourceId === $.id), A = ye(G);
1523
+ for (const T of A)
1478
1524
  R.appendChild(we({
1479
- event: C,
1525
+ event: T,
1480
1526
  gridStartTime: n,
1481
1527
  slotHeight: i,
1482
- interval: r,
1528
+ interval: l,
1483
1529
  format: d,
1484
- onClick: (A) => w == null ? void 0 : w(A, $.id, $),
1530
+ onClick: (z) => _ == null ? void 0 : _(z, $.id, $),
1485
1531
  eventContent: k,
1486
1532
  showTime: u,
1487
1533
  resource: $,
1488
1534
  draggable: p
1489
1535
  }));
1490
- z.appendChild(R);
1536
+ I.appendChild(R);
1491
1537
  }
1492
1538
  else {
1493
1539
  const $ = document.createElement("div");
1494
1540
  $.classList.add("cal-sched-week__lane", "cal-sched-week__lane--full");
1495
1541
  const R = s.length === 1 ? s[0] : null;
1496
1542
  R && ($.dataset.resourceId = R.id);
1497
- for (let I = 0; I < N.length; I++) {
1498
- const C = document.createElement("div");
1499
- C.classList.add("cal-sched-week__slot"), C.style.height = `${i}px`, C.dataset.time = N[I];
1500
- const A = I < N.length - 1 ? N[I + 1] : l, G = (R == null ? void 0 : R.id) || null;
1501
- o && o.date === f && o.startTime === N[I] && (o.resourceId === G || !o.resourceId && !G) && (C.classList.add("cal-sched-week__slot--selected"), C.appendChild(be({
1502
- date: f,
1503
- startTime: N[I],
1504
- endTime: A,
1543
+ for (let A = 0; A < j.length; A++) {
1544
+ const T = document.createElement("div");
1545
+ T.classList.add("cal-sched-week__slot"), T.style.height = `${i}px`, T.dataset.time = j[A];
1546
+ const z = A < j.length - 1 ? j[A + 1] : r, U = (R == null ? void 0 : R.id) || null;
1547
+ h && h.date === v && h.startTime === j[A] && (h.resourceId === U || !h.resourceId && !U) && (T.classList.add("cal-sched-week__slot--selected"), T.appendChild(ve({
1548
+ date: v,
1549
+ startTime: j[A],
1550
+ endTime: z,
1505
1551
  resourceName: (R == null ? void 0 : R.name) || null,
1506
1552
  format: d,
1507
- onCreate: () => T == null ? void 0 : T(f, N[I], A, G, R)
1508
- }))), C.addEventListener("click", () => {
1509
- m == null || m(f, N[I], A, G, R);
1510
- }), $.appendChild(C);
1553
+ onCreate: () => C == null ? void 0 : C(v, j[A], z, U, R)
1554
+ }))), T.addEventListener("click", () => {
1555
+ m == null || m(v, j[A], z, U, R);
1556
+ }), $.appendChild(T);
1511
1557
  }
1512
- const U = ye(W);
1513
- for (const I of U) {
1514
- const C = s.find((A) => A.id === I.resourceId) || s[0];
1558
+ const G = ye(W);
1559
+ for (const A of G) {
1560
+ const T = s.find((z) => z.id === A.resourceId) || s[0];
1515
1561
  $.appendChild(we({
1516
- event: I,
1562
+ event: A,
1517
1563
  gridStartTime: n,
1518
1564
  slotHeight: i,
1519
- interval: r,
1565
+ interval: l,
1520
1566
  format: d,
1521
- onClick: (A) => w == null ? void 0 : w(A, I.resourceId, C),
1567
+ onClick: (z) => _ == null ? void 0 : _(z, A.resourceId, T),
1522
1568
  eventContent: k,
1523
1569
  showTime: u,
1524
- resource: C,
1570
+ resource: T,
1525
1571
  draggable: p
1526
1572
  }));
1527
1573
  }
1528
- z.appendChild($);
1574
+ I.appendChild($);
1529
1575
  }
1530
- M.appendChild(z);
1576
+ M.appendChild(I);
1531
1577
  }
1532
1578
  if (F.includes(P)) {
1533
- const f = Ye(), z = y(f), W = y(n), $ = y(l);
1534
- if (z >= W && z <= $) {
1535
- const R = F.indexOf(P), U = ie(f, n, i, r), I = document.createElement("div");
1536
- I.classList.add("cal-sched-now-line", "cal-sched-now-line--week"), I.style.top = `${U}px`;
1537
- const C = 100 / 7;
1538
- I.style.left = `${R * C}%`, I.style.width = `${C}%`;
1539
- const A = document.createElement("div");
1540
- A.classList.add("cal-sched-now-line__dot"), I.appendChild(A), M.appendChild(I);
1579
+ const v = Ye(), I = w(v), W = w(n), $ = w(r);
1580
+ if (I >= W && I <= $) {
1581
+ const R = F.indexOf(P), G = ie(v, n, i, l), A = document.createElement("div");
1582
+ A.classList.add("cal-sched-now-line", "cal-sched-now-line--week"), A.style.top = `${G}px`;
1583
+ const T = 100 / 7;
1584
+ A.style.left = `${R * T}%`, A.style.width = `${T}%`;
1585
+ const z = document.createElement("div");
1586
+ z.classList.add("cal-sched-now-line__dot"), A.appendChild(z), M.appendChild(A);
1541
1587
  }
1542
1588
  }
1543
- return j.appendChild(M), D.appendChild(j), D;
1589
+ return N.appendChild(M), D.appendChild(N), D;
1544
1590
  }
1545
- const vt = `
1591
+ const _t = `
1546
1592
  .cal-sched-week {
1547
1593
  display: flex;
1548
1594
  flex-direction: column;
@@ -1760,75 +1806,75 @@ const vt = `
1760
1806
  z-index: 5;
1761
1807
  pointer-events: none;
1762
1808
  }
1763
- `, Ae = 3;
1764
- function bt({
1809
+ `, ze = 3;
1810
+ function xt({
1765
1811
  date: t,
1766
1812
  firstDay: e,
1767
1813
  resources: s,
1768
1814
  events: a,
1769
1815
  format: n,
1770
- selectedResourceId: l,
1771
- selectedDate: r,
1816
+ selectedResourceId: r,
1817
+ selectedDate: l,
1772
1818
  eventContent: i,
1773
1819
  onSlotClick: d,
1774
1820
  onEventClick: g,
1775
1821
  onSlotCreate: c
1776
1822
  }) {
1777
- const o = document.createElement("div");
1778
- o.classList.add("cal-sched-month");
1823
+ const h = document.createElement("div");
1824
+ h.classList.add("cal-sched-month");
1779
1825
  const k = ee(t);
1780
- if (!k) return o;
1826
+ if (!k) return h;
1781
1827
  const u = k.getFullYear(), p = k.getMonth();
1782
- me();
1783
- const v = document.createElement("div");
1784
- v.classList.add("cal-sched-month__weekdays");
1785
- const h = We(e);
1786
- for (const T of h) {
1828
+ ge();
1829
+ const f = document.createElement("div");
1830
+ f.classList.add("cal-sched-month__weekdays");
1831
+ const o = Ue(e);
1832
+ for (const C of o) {
1787
1833
  const D = document.createElement("div");
1788
- D.classList.add("cal-sched-month__weekday"), D.textContent = T, v.appendChild(D);
1834
+ D.classList.add("cal-sched-month__weekday"), D.textContent = C, f.appendChild(D);
1789
1835
  }
1790
- o.appendChild(v);
1836
+ h.appendChild(f);
1791
1837
  const m = document.createElement("div");
1792
1838
  m.classList.add("cal-sched-month__grid");
1793
- const w = Ue(u, p, e);
1794
- for (const T of w) {
1839
+ const _ = Ze(u, p, e);
1840
+ for (const C of _) {
1795
1841
  const D = document.createElement("div");
1796
- D.classList.add("cal-sched-month__cell"), T.isCurrentMonth || D.classList.add("cal-sched-month__cell--outside"), T.isToday && D.classList.add("cal-sched-month__cell--today"), r && T.dateString === r && D.classList.add("cal-sched-month__cell--selected"), D.addEventListener("click", (H) => {
1797
- H.target.closest(".cal-sched-month-chip") || d == null || d(T.dateString);
1842
+ D.classList.add("cal-sched-month__cell"), C.isCurrentMonth || D.classList.add("cal-sched-month__cell--outside"), C.isToday && D.classList.add("cal-sched-month__cell--today"), l && C.dateString === l && D.classList.add("cal-sched-month__cell--selected"), D.addEventListener("click", (H) => {
1843
+ H.target.closest(".cal-sched-month-chip") || d == null || d(C.dateString);
1798
1844
  });
1799
1845
  const F = document.createElement("div");
1800
- F.classList.add("cal-sched-month__day-num"), T.isToday && F.classList.add("cal-sched-month__day-num--today"), F.textContent = T.day, D.appendChild(F);
1801
- let X = ve(a, T.dateString);
1802
- l && (X = X.filter((H) => H.resourceId === l)), X.sort((H, _) => H.startTime && !_.startTime ? -1 : !H.startTime && _.startTime ? 1 : H.startTime && _.startTime ? H.startTime.localeCompare(_.startTime) : 0);
1846
+ F.classList.add("cal-sched-month__day-num"), C.isToday && F.classList.add("cal-sched-month__day-num--today"), F.textContent = C.day, D.appendChild(F);
1847
+ let X = fe(a, C.dateString);
1848
+ r && (X = X.filter((H) => H.resourceId === r)), X.sort((H, x) => H.startTime && !x.startTime ? -1 : !H.startTime && x.startTime ? 1 : H.startTime && x.startTime ? H.startTime.localeCompare(x.startTime) : 0);
1803
1849
  const Y = document.createElement("div");
1804
1850
  Y.classList.add("cal-sched-month__events");
1805
- const N = X.slice(0, Ae), P = X.length - Ae;
1806
- for (const H of N) {
1807
- const _ = s.find((E) => E.id === H.resourceId);
1808
- Y.appendChild(ht({
1851
+ const j = X.slice(0, ze), P = X.length - ze;
1852
+ for (const H of j) {
1853
+ const x = s.find((E) => E.id === H.resourceId);
1854
+ Y.appendChild(pt({
1809
1855
  event: H,
1810
1856
  format: n,
1811
- onClick: (E) => g == null ? void 0 : g(E, H.resourceId, _),
1857
+ onClick: (E) => g == null ? void 0 : g(E, H.resourceId, x),
1812
1858
  eventContent: i,
1813
- resource: _
1859
+ resource: x
1814
1860
  }));
1815
1861
  }
1816
1862
  if (P > 0) {
1817
1863
  const H = document.createElement("div");
1818
1864
  H.classList.add("cal-sched-month__more"), H.textContent = `+${P} more`, Y.appendChild(H);
1819
1865
  }
1820
- D.appendChild(Y), r && T.dateString === r && (D.style.position = "relative", D.appendChild(be({
1821
- date: T.dateString,
1866
+ D.appendChild(Y), l && C.dateString === l && (D.style.position = "relative", D.appendChild(ve({
1867
+ date: C.dateString,
1822
1868
  startTime: null,
1823
1869
  endTime: null,
1824
1870
  resourceName: null,
1825
1871
  format: n,
1826
- onCreate: () => c == null ? void 0 : c(T.dateString)
1872
+ onCreate: () => c == null ? void 0 : c(C.dateString)
1827
1873
  }))), m.appendChild(D);
1828
1874
  }
1829
- return o.appendChild(m), o;
1875
+ return h.appendChild(m), h;
1830
1876
  }
1831
- const _t = `
1877
+ const yt = `
1832
1878
  .cal-sched-month {
1833
1879
  border: 1px solid hsl(var(--cal-sched-grid-line));
1834
1880
  border-radius: var(--cal-radius);
@@ -1913,38 +1959,38 @@ const _t = `
1913
1959
  color: hsl(var(--cal-fg));
1914
1960
  }
1915
1961
  `;
1916
- function xt({ columns: t = 3, rows: e = 10, slotHeight: s = 48 } = {}) {
1962
+ function wt({ columns: t = 3, rows: e = 10, slotHeight: s = 48 } = {}) {
1917
1963
  const a = document.createElement("div");
1918
1964
  a.setAttribute("role", "status"), a.setAttribute("aria-label", "Loading..."), a.classList.add("cal-sched-skeleton-grid");
1919
1965
  const n = document.createElement("div");
1920
1966
  n.classList.add("cal-sched-skeleton-grid__header");
1921
- const l = document.createElement("div");
1922
- l.classList.add("cal-sched-skeleton-grid__spacer"), n.appendChild(l);
1967
+ const r = document.createElement("div");
1968
+ r.classList.add("cal-sched-skeleton-grid__spacer"), n.appendChild(r);
1923
1969
  for (let i = 0; i < t; i++) {
1924
1970
  const d = document.createElement("div");
1925
1971
  d.classList.add("cal-skeleton", "cal-sched-skeleton-grid__col-header"), n.appendChild(d);
1926
1972
  }
1927
1973
  a.appendChild(n);
1928
- const r = document.createElement("div");
1929
- r.classList.add("cal-sched-skeleton-grid__body");
1974
+ const l = document.createElement("div");
1975
+ l.classList.add("cal-sched-skeleton-grid__body");
1930
1976
  for (let i = 0; i < e; i++) {
1931
1977
  const d = document.createElement("div");
1932
1978
  d.classList.add("cal-sched-skeleton-grid__row"), d.style.height = `${s}px`;
1933
1979
  const g = document.createElement("div");
1934
1980
  g.classList.add("cal-skeleton", "cal-sched-skeleton-grid__time"), d.appendChild(g);
1935
1981
  for (let c = 0; c < t; c++) {
1936
- const o = document.createElement("div");
1937
- if (o.classList.add("cal-sched-skeleton-grid__cell"), Math.random() < 0.15) {
1982
+ const h = document.createElement("div");
1983
+ if (h.classList.add("cal-sched-skeleton-grid__cell"), Math.random() < 0.15) {
1938
1984
  const k = document.createElement("div");
1939
- k.classList.add("cal-skeleton", "cal-skeleton--rect", "cal-sched-skeleton-grid__event"), k.style.height = `${s * (1 + Math.floor(Math.random() * 2))}px`, o.appendChild(k);
1985
+ k.classList.add("cal-skeleton", "cal-skeleton--rect", "cal-sched-skeleton-grid__event"), k.style.height = `${s * (1 + Math.floor(Math.random() * 2))}px`, h.appendChild(k);
1940
1986
  }
1941
- d.appendChild(o);
1987
+ d.appendChild(h);
1942
1988
  }
1943
- r.appendChild(d);
1989
+ l.appendChild(d);
1944
1990
  }
1945
- return a.appendChild(r), a;
1991
+ return a.appendChild(l), a;
1946
1992
  }
1947
- function yt() {
1993
+ function kt() {
1948
1994
  const t = document.createElement("div");
1949
1995
  t.setAttribute("role", "status"), t.setAttribute("aria-label", "Loading..."), t.classList.add("cal-sched-skeleton-month");
1950
1996
  const e = document.createElement("div");
@@ -1959,10 +2005,10 @@ function yt() {
1959
2005
  for (let a = 0; a < 35; a++) {
1960
2006
  const n = document.createElement("div");
1961
2007
  n.classList.add("cal-sched-skeleton-month__cell");
1962
- const l = document.createElement("div");
1963
- l.classList.add("cal-skeleton", "cal-sched-skeleton-month__num"), n.appendChild(l);
1964
- const r = Math.floor(Math.random() * 3);
1965
- for (let i = 0; i < r; i++) {
2008
+ const r = document.createElement("div");
2009
+ r.classList.add("cal-skeleton", "cal-sched-skeleton-month__num"), n.appendChild(r);
2010
+ const l = Math.floor(Math.random() * 3);
2011
+ for (let i = 0; i < l; i++) {
1966
2012
  const d = document.createElement("div");
1967
2013
  d.classList.add("cal-skeleton", "cal-skeleton--rect", "cal-sched-skeleton-month__chip"), n.appendChild(d);
1968
2014
  }
@@ -1970,7 +2016,7 @@ function yt() {
1970
2016
  }
1971
2017
  return t.appendChild(s), t;
1972
2018
  }
1973
- const wt = `
2019
+ const Et = `
1974
2020
  .cal-sched-skeleton-grid {
1975
2021
  border: 1px solid hsl(var(--cal-sched-grid-line));
1976
2022
  border-radius: var(--cal-radius);
@@ -2080,19 +2126,19 @@ const wt = `
2080
2126
  info: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 6.5V10M7 4.5v.01"/></svg>',
2081
2127
  success: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M4.5 7l2 2L9.5 5"/></svg>'
2082
2128
  };
2083
- function kt({ type: t = "info", message: e, dismissible: s = !0, onDismiss: a }) {
2129
+ function Lt({ type: t = "info", message: e, dismissible: s = !0, onDismiss: a }) {
2084
2130
  const n = document.createElement("div");
2085
2131
  n.classList.add("cal-status", `cal-status--${t}`, "cal-animate-slide-up"), n.setAttribute("role", t === "error" ? "alert" : "status"), n.setAttribute("aria-live", t === "error" ? "assertive" : "polite");
2086
- const l = document.createElement("span");
2087
- l.classList.add("cal-status__icon"), l.innerHTML = Pe[t] || Pe.info, n.appendChild(l);
2088
2132
  const r = document.createElement("span");
2089
- if (r.classList.add("cal-status__text"), r.textContent = e, n.appendChild(r), s) {
2133
+ r.classList.add("cal-status__icon"), r.innerHTML = Pe[t] || Pe.info, n.appendChild(r);
2134
+ const l = document.createElement("span");
2135
+ if (l.classList.add("cal-status__text"), l.textContent = e, n.appendChild(l), s) {
2090
2136
  const i = document.createElement("button");
2091
2137
  i.classList.add("cal-status__close"), i.setAttribute("aria-label", "Dismiss"), i.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M3 3l6 6M9 3l-6 6"/></svg>', i.addEventListener("click", () => a == null ? void 0 : a()), n.appendChild(i);
2092
2138
  }
2093
2139
  return n;
2094
2140
  }
2095
- const Et = `
2141
+ const Ct = `
2096
2142
  .cal-status {
2097
2143
  display: flex;
2098
2144
  align-items: center;
@@ -2155,60 +2201,60 @@ const Et = `
2155
2201
  border: 1px solid hsl(var(--cal-status-success-border));
2156
2202
  }
2157
2203
  `;
2158
- function Lt({ event: t, resource: e, format: s, onClose: a, actions: n, onAction: l }) {
2159
- const r = document.createElement("div");
2160
- r.classList.add("cal-sched-detail-backdrop"), r.addEventListener("click", a);
2204
+ function Tt({ event: t, resource: e, format: s, onClose: a, actions: n, onAction: r }) {
2205
+ const l = document.createElement("div");
2206
+ l.classList.add("cal-sched-detail-backdrop"), l.addEventListener("click", a);
2161
2207
  const i = document.createElement("div");
2162
2208
  i.classList.add("cal-sched-detail", "cal-animate-fade"), i.addEventListener("click", (u) => u.stopPropagation());
2163
2209
  const d = document.createElement("button");
2164
2210
  d.classList.add("cal-sched-detail__close"), d.setAttribute("aria-label", "Close"), d.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M4 4l6 6M10 4l-6 6"/></svg>', d.addEventListener("click", a), i.appendChild(d);
2165
2211
  const g = t.color || "blue", c = document.createElement("div");
2166
2212
  c.classList.add("cal-sched-detail__accent"), c.style.background = `hsl(var(--cal-booking-${g}-fg))`, i.appendChild(c);
2167
- const o = document.createElement("div");
2168
- if (o.classList.add("cal-sched-detail__title"), o.textContent = t.title || "Untitled", i.appendChild(o), t.startTime && t.endTime) {
2213
+ const h = document.createElement("div");
2214
+ if (h.classList.add("cal-sched-detail__title"), h.textContent = t.title || "Untitled", i.appendChild(h), t.startTime && t.endTime) {
2169
2215
  const u = document.createElement("div");
2170
2216
  u.classList.add("cal-sched-detail__row");
2171
2217
  const p = document.createElement("span");
2172
2218
  p.classList.add("cal-sched-detail__icon"), p.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="5.5"/><path d="M7 4v3.5l2.5 1.5"/></svg>', u.appendChild(p);
2173
- const v = he(t.startTime), h = he(t.endTime), m = document.createElement("span");
2174
- v && h && (m.textContent = `${ge(v.hours, v.minutes, s)}–${ge(h.hours, h.minutes, s)}`), u.appendChild(m), i.appendChild(u);
2219
+ const f = de(t.startTime), o = de(t.endTime), m = document.createElement("span");
2220
+ f && o && (m.textContent = `${pe(f.hours, f.minutes, s)}–${pe(o.hours, o.minutes, s)}`), u.appendChild(m), i.appendChild(u);
2175
2221
  }
2176
2222
  if (t.start) {
2177
2223
  const u = document.createElement("div");
2178
2224
  u.classList.add("cal-sched-detail__row");
2179
2225
  const p = document.createElement("span");
2180
2226
  p.classList.add("cal-sched-detail__icon"), p.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="1.5" y="2.5" width="11" height="9.5" rx="1.5"/><path d="M4.5 1v2.5M9.5 1v2.5M1.5 5.5h11"/></svg>', u.appendChild(p);
2181
- const v = ee(t.start), h = document.createElement("span");
2182
- if (v) {
2183
- let m = `${He(t.start, "long")}, ${oe[v.getMonth()]} ${v.getDate()}`;
2227
+ const f = ee(t.start), o = document.createElement("span");
2228
+ if (f) {
2229
+ let m = `${He(t.start, "long")}, ${_e[f.getMonth()]} ${f.getDate()}`;
2184
2230
  if (t.end && t.end !== t.start) {
2185
- const w = ee(t.end);
2186
- w && (m += ` – ${oe[w.getMonth()]} ${w.getDate()}`);
2231
+ const _ = ee(t.end);
2232
+ _ && (m += ` – ${_e[_.getMonth()]} ${_.getDate()}`);
2187
2233
  }
2188
- h.textContent = m;
2234
+ o.textContent = m;
2189
2235
  }
2190
- u.appendChild(h), i.appendChild(u);
2236
+ u.appendChild(o), i.appendChild(u);
2191
2237
  }
2192
2238
  if (e && e.name) {
2193
2239
  const u = document.createElement("div");
2194
2240
  u.classList.add("cal-sched-detail__row");
2195
2241
  const p = document.createElement("span");
2196
2242
  p.classList.add("cal-sched-detail__res-dot"), p.style.background = `hsl(var(--cal-booking-${e.color || "blue"}-fg))`, u.appendChild(p);
2197
- const v = document.createElement("span");
2198
- v.textContent = e.name, e.capacity && (v.textContent += ` (capacity: ${e.capacity})`), u.appendChild(v), i.appendChild(u);
2243
+ const f = document.createElement("span");
2244
+ f.textContent = e.name, e.capacity && (f.textContent += ` (capacity: ${e.capacity})`), u.appendChild(f), i.appendChild(u);
2199
2245
  }
2200
2246
  if (t.metadata && typeof t.metadata == "object") {
2201
2247
  const u = Object.entries(t.metadata);
2202
2248
  if (u.length > 0) {
2203
2249
  const p = document.createElement("div");
2204
2250
  p.classList.add("cal-sched-detail__meta");
2205
- for (const [v, h] of u) {
2251
+ for (const [f, o] of u) {
2206
2252
  const m = document.createElement("div");
2207
2253
  m.classList.add("cal-sched-detail__meta-row");
2208
- const w = document.createElement("span");
2209
- w.classList.add("cal-sched-detail__meta-label"), w.textContent = v;
2210
- const T = document.createElement("span");
2211
- T.textContent = String(h), m.appendChild(w), m.appendChild(T), p.appendChild(m);
2254
+ const _ = document.createElement("span");
2255
+ _.classList.add("cal-sched-detail__meta-label"), _.textContent = f;
2256
+ const C = document.createElement("span");
2257
+ C.textContent = String(o), m.appendChild(_), m.appendChild(C), p.appendChild(m);
2212
2258
  }
2213
2259
  i.appendChild(p);
2214
2260
  }
@@ -2217,20 +2263,20 @@ function Lt({ event: t, resource: e, format: s, onClose: a, actions: n, onAction
2217
2263
  const u = document.createElement("div");
2218
2264
  u.classList.add("cal-sched-detail__actions");
2219
2265
  for (const p of n) {
2220
- const v = document.createElement("button");
2221
- v.classList.add("cal-sched-detail__action"), p.type === "danger" && v.classList.add("cal-sched-detail__action--danger"), v.textContent = p.label, v.addEventListener("click", () => {
2222
- l == null || l(p.label);
2223
- }), u.appendChild(v);
2266
+ const f = document.createElement("button");
2267
+ f.classList.add("cal-sched-detail__action"), p.type === "danger" && f.classList.add("cal-sched-detail__action--danger"), f.textContent = p.label, f.addEventListener("click", () => {
2268
+ r == null || r(p.label);
2269
+ }), u.appendChild(f);
2224
2270
  }
2225
2271
  i.appendChild(u);
2226
2272
  }
2227
- r.appendChild(i);
2273
+ l.appendChild(i);
2228
2274
  const k = (u) => {
2229
2275
  u.key === "Escape" && a();
2230
2276
  };
2231
- return r.addEventListener("keydown", k), requestAnimationFrame(() => d.focus()), r;
2277
+ return l.addEventListener("keydown", k), requestAnimationFrame(() => d.focus()), l;
2232
2278
  }
2233
- const Ct = `
2279
+ const Mt = `
2234
2280
  .cal-sched-detail-backdrop {
2235
2281
  position: absolute;
2236
2282
  inset: 0;
@@ -2369,20 +2415,20 @@ const Ct = `
2369
2415
  background: hsl(var(--cal-status-error-bg));
2370
2416
  }
2371
2417
  `;
2372
- function Tt({ resources: t, selectedResourceId: e, onResourceFilter: s }) {
2418
+ function St({ resources: t, selectedResourceId: e, onResourceFilter: s }) {
2373
2419
  const a = document.createElement("div");
2374
2420
  a.classList.add("cal-sched-res-tabs");
2375
2421
  const n = document.createElement("button");
2376
2422
  n.classList.add("cal-sched-res-tabs__tab"), e || n.classList.add("cal-sched-res-tabs__tab--active"), n.textContent = "All", n.addEventListener("click", () => s == null ? void 0 : s(null)), a.appendChild(n);
2377
- for (const l of t) {
2378
- const r = document.createElement("button");
2379
- r.classList.add("cal-sched-res-tabs__tab"), e === l.id && r.classList.add("cal-sched-res-tabs__tab--active");
2423
+ for (const r of t) {
2424
+ const l = document.createElement("button");
2425
+ l.classList.add("cal-sched-res-tabs__tab"), e === r.id && l.classList.add("cal-sched-res-tabs__tab--active");
2380
2426
  const i = document.createElement("span");
2381
- i.classList.add("cal-sched-res-tabs__dot"), i.style.background = `hsl(var(--cal-booking-${l.color || "blue"}-fg))`, r.appendChild(i), r.appendChild(document.createTextNode(l.name)), r.addEventListener("click", () => s == null ? void 0 : s(l.id)), a.appendChild(r);
2427
+ i.classList.add("cal-sched-res-tabs__dot"), i.style.background = `hsl(var(--cal-booking-${r.color || "blue"}-fg))`, l.appendChild(i), l.appendChild(document.createTextNode(r.name)), l.addEventListener("click", () => s == null ? void 0 : s(r.id)), a.appendChild(l);
2382
2428
  }
2383
2429
  return a;
2384
2430
  }
2385
- const Mt = `
2431
+ const Dt = `
2386
2432
  .cal-sched-res-tabs {
2387
2433
  display: flex;
2388
2434
  gap: 4px;
@@ -2427,13 +2473,13 @@ const Mt = `
2427
2473
  border-radius: 50%;
2428
2474
  }
2429
2475
  `;
2430
- function St({ onClick: t }) {
2476
+ function $t({ onClick: t }) {
2431
2477
  const e = document.createElement("button");
2432
2478
  return e.classList.add("cal-sched-fab"), e.setAttribute("aria-label", "Create event"), e.innerHTML = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M10 4v12M4 10h12"/></svg>', e.addEventListener("click", (s) => {
2433
2479
  s.stopPropagation(), t == null || t();
2434
2480
  }), e;
2435
2481
  }
2436
- const Dt = `
2482
+ const At = `
2437
2483
  .cal-sched-fab {
2438
2484
  position: absolute;
2439
2485
  bottom: 16px;
@@ -2465,35 +2511,35 @@ const Dt = `
2465
2511
  outline: 2px solid hsl(var(--cal-ring));
2466
2512
  outline-offset: 2px;
2467
2513
  }
2468
- `, $t = 4;
2469
- function It({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove: n, onResize: l, onCreate: r }) {
2470
- let i = !1, d = null, g = null, c = null, o = null, k = 0, u = 0, p = 0, v = 0, h = !1, m = null, w = null, T = null, D = null, F = null, X = null, Y = null, N = null, P = null, H = null, _ = null, E = null, Z = 0;
2471
- function j(b) {
2514
+ `, It = 4;
2515
+ function zt({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove: n, onResize: r, onCreate: l }) {
2516
+ let i = !1, d = null, g = null, c = null, h = null, k = 0, u = 0, p = 0, f = 0, o = !1, m = null, _ = null, C = null, D = null, F = null, X = null, Y = null, j = null, P = null, H = null, x = null, E = null, Z = 0;
2517
+ function N(b) {
2472
2518
  if (!i || b.button !== 0) return;
2473
2519
  const L = b.target.closest(".cal-sched-event__resize-handle"), S = b.target.closest('.cal-sched-event[data-draggable="true"]');
2474
2520
  if (S) {
2475
- const q = S.dataset.eventId;
2476
- if (g = a().find((B) => B.id === q), !g) return;
2477
- b.preventDefault(), b.stopPropagation(), N = S, Y = b.pointerId, S.setPointerCapture(b.pointerId), p = b.clientX, v = b.clientY, h = !1, w = g.startTime, m = g.endTime, T = g.start, D = g.resourceId, L ? (d = "resize", o = S, o.classList.add("cal-sched-event--resizing")) : (d = "move", o = S);
2521
+ const O = S.dataset.eventId;
2522
+ if (g = a().find((B) => B.id === O), !g) return;
2523
+ b.preventDefault(), b.stopPropagation(), j = S, Y = b.pointerId, S.setPointerCapture(b.pointerId), p = b.clientX, f = b.clientY, o = !1, _ = g.startTime, m = g.endTime, C = g.start, D = g.resourceId, L ? (d = "resize", h = S, h.classList.add("cal-sched-event--resizing")) : (d = "move", h = S);
2478
2524
  } else {
2479
- const q = b.target.closest("[data-time]");
2480
- if (!q || b.target.closest(".cal-sched-slot-prompt")) return;
2481
- const x = z(b.clientX, b.clientY);
2482
- if (!x) return;
2483
- b.preventDefault(), d = "create", p = b.clientX, v = b.clientY, h = !1, H = x.date, _ = x.resourceId, E = x.time;
2525
+ const O = b.target.closest("[data-time]");
2526
+ if (!O || b.target.closest(".cal-sched-slot-prompt")) return;
2527
+ const y = I(b.clientX, b.clientY);
2528
+ if (!y) return;
2529
+ b.preventDefault(), d = "create", p = b.clientX, f = b.clientY, o = !1, H = y.date, x = y.resourceId, E = y.time;
2484
2530
  const B = t.querySelectorAll("[data-time]");
2485
- B.length > 0 && (Z = B[0].getBoundingClientRect().top), N = q, Y = b.pointerId, q.setPointerCapture(b.pointerId);
2531
+ B.length > 0 && (Z = B[0].getBoundingClientRect().top), j = O, Y = b.pointerId, O.setPointerCapture(b.pointerId);
2486
2532
  }
2487
- t.addEventListener("pointermove", M), t.addEventListener("pointerup", f);
2533
+ t.addEventListener("pointermove", M), t.addEventListener("pointerup", v);
2488
2534
  }
2489
2535
  function M(b) {
2490
2536
  if (!d) return;
2491
- const L = b.clientX - p, S = b.clientY - v, q = Math.sqrt(L * L + S * S);
2492
- if (!(!h && q < $t)) {
2493
- if (h = !0, d === "move") {
2494
- if (!c && o) {
2495
- const B = o.getBoundingClientRect();
2496
- k = p - B.left, u = v - B.top, c = o.cloneNode(!0), c.classList.add("cal-sched-event--ghost"), c.style.cssText = `
2537
+ const L = b.clientX - p, S = b.clientY - f, O = Math.sqrt(L * L + S * S);
2538
+ if (!(!o && O < It)) {
2539
+ if (o = !0, d === "move") {
2540
+ if (!c && h) {
2541
+ const B = h.getBoundingClientRect();
2542
+ k = p - B.left, u = f - B.top, c = h.cloneNode(!0), c.classList.add("cal-sched-event--ghost"), c.style.cssText = `
2497
2543
  position: fixed;
2498
2544
  width: ${B.width}px;
2499
2545
  height: ${B.height}px;
@@ -2511,32 +2557,32 @@ function It({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove:
2511
2557
  font-size: 12px;
2512
2558
  line-height: 1.3;
2513
2559
  overflow: hidden;
2514
- `, c.style.setProperty("--ev-bg", o.style.getPropertyValue("--ev-bg")), c.style.setProperty("--ev-fg", o.style.getPropertyValue("--ev-fg")), t.appendChild(c), o.classList.add("cal-sched-event--dragging");
2560
+ `, c.style.setProperty("--ev-bg", h.style.getPropertyValue("--ev-bg")), c.style.setProperty("--ev-fg", h.style.getPropertyValue("--ev-fg")), t.appendChild(c), h.classList.add("cal-sched-event--dragging");
2515
2561
  }
2516
2562
  c && (c.style.left = `${b.clientX - k}px`, c.style.top = `${b.clientY - u}px`);
2517
- const x = z(b.clientX, b.clientY);
2518
- x ? W(x) : $();
2563
+ const y = I(b.clientX, b.clientY);
2564
+ y ? W(y) : $();
2519
2565
  } else if (d === "resize") {
2520
- const x = e(), B = x.snapInterval || x.interval, Q = x.slotHeight * (B / x.interval), ae = b.clientY - v, O = Math.round(ae / Q) * B, ue = y(m), re = y(w);
2521
- let K = ue + O;
2522
- const te = x.minDuration || B, se = re + te;
2523
- if (K < se && (K = se), x.maxDuration) {
2524
- const de = re + x.maxDuration;
2525
- K > de && (K = de);
2566
+ const y = e(), B = y.snapInterval || y.interval, Q = y.slotHeight * (B / y.interval), ae = b.clientY - f, q = Math.round(ae / Q) * B, he = w(m), re = w(_);
2567
+ let K = he + q;
2568
+ const te = y.minDuration || B, se = re + te;
2569
+ if (K < se && (K = se), y.maxDuration) {
2570
+ const oe = re + y.maxDuration;
2571
+ K > oe && (K = oe);
2526
2572
  }
2527
- const V = y(x.endTime);
2573
+ const V = w(y.endTime);
2528
2574
  K > V && (K = V);
2529
2575
  const ne = ce(K);
2530
- if (o) {
2531
- const de = ie(w, x.startTime, x.slotHeight, x.interval), Ee = ie(ne, x.startTime, x.slotHeight, x.interval);
2532
- o.style.height = `${Math.max(Ee - de, x.slotHeight * 0.5)}px`;
2576
+ if (h) {
2577
+ const oe = ie(_, y.startTime, y.slotHeight, y.interval), Ee = ie(ne, y.startTime, y.slotHeight, y.interval);
2578
+ h.style.height = `${Math.max(Ee - oe, y.slotHeight * 0.5)}px`;
2533
2579
  }
2534
- U(b.clientX, b.clientY, ne, x.format);
2580
+ G(b.clientX, b.clientY, ne, y.format);
2535
2581
  } else if (d === "create") {
2536
- const x = e(), B = x.snapInterval || x.interval, Q = b.clientY - Z, ae = Ie(Math.max(0, Q), x.startTime, x.slotHeight, x.interval), J = ze(ae, B), O = y(J), ue = y(E), re = y(x.endTime), K = x.minDuration || B;
2537
- let te = Math.max(O, ue + K);
2538
- if (x.maxDuration) {
2539
- const V = ue + x.maxDuration;
2582
+ const y = e(), B = y.snapInterval || y.interval, Q = b.clientY - Z, ae = Ae(Math.max(0, Q), y.startTime, y.slotHeight, y.interval), J = Ie(ae, B), q = w(J), he = w(E), re = w(y.endTime), K = y.minDuration || B;
2583
+ let te = Math.max(q, he + K);
2584
+ if (y.maxDuration) {
2585
+ const V = he + y.maxDuration;
2540
2586
  te > V && (te = V);
2541
2587
  }
2542
2588
  te > re && (te = re);
@@ -2544,83 +2590,83 @@ function It({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove:
2544
2590
  if (!P) {
2545
2591
  P = document.createElement("div"), P.classList.add("cal-sched-create-preview");
2546
2592
  let V = null;
2547
- _ && (V = t.querySelector(`[data-resource-id="${_}"][data-date="${H}"]`), V || (V = t.querySelector(`[data-date="${H}"] [data-resource-id="${_}"]`))), V || (V = t.querySelector(`[data-date="${H}"] .cal-sched-week__lane`) || t.querySelector(`[data-date="${H}"] .cal-sched-day__lane`) || t.querySelector(`[data-date="${H}"]`)), V && V.appendChild(P);
2593
+ x && (V = t.querySelector(`[data-resource-id="${x}"][data-date="${H}"]`), V || (V = t.querySelector(`[data-date="${H}"] [data-resource-id="${x}"]`))), V || (V = t.querySelector(`[data-date="${H}"] .cal-sched-week__lane`) || t.querySelector(`[data-date="${H}"] .cal-sched-day__lane`) || t.querySelector(`[data-date="${H}"]`)), V && V.appendChild(P);
2548
2594
  }
2549
2595
  if (P) {
2550
- const V = e(), ne = ie(E, V.startTime, V.slotHeight, V.interval), de = ie(se, V.startTime, V.slotHeight, V.interval);
2551
- P.style.top = `${ne}px`, P.style.height = `${Math.max(de - ne, V.slotHeight * 0.5)}px`, P.dataset.endTime = se;
2596
+ const V = e(), ne = ie(E, V.startTime, V.slotHeight, V.interval), oe = ie(se, V.startTime, V.slotHeight, V.interval);
2597
+ P.style.top = `${ne}px`, P.style.height = `${Math.max(oe - ne, V.slotHeight * 0.5)}px`, P.dataset.endTime = se;
2552
2598
  }
2553
- U(b.clientX, b.clientY, se, x.format);
2599
+ G(b.clientX, b.clientY, se, y.format);
2554
2600
  }
2555
2601
  }
2556
2602
  }
2557
- function f(b) {
2603
+ function v(b) {
2558
2604
  if (d) {
2559
- if (t.removeEventListener("pointermove", M), t.removeEventListener("pointerup", f), N && Y != null) {
2605
+ if (t.removeEventListener("pointermove", M), t.removeEventListener("pointerup", v), j && Y != null) {
2560
2606
  try {
2561
- N.releasePointerCapture(Y);
2607
+ j.releasePointerCapture(Y);
2562
2608
  } catch {
2563
2609
  }
2564
- N = null, Y = null;
2610
+ j = null, Y = null;
2565
2611
  }
2566
2612
  if (d === "move") {
2567
- if ($(), c && (c.remove(), c = null), o && o.classList.remove("cal-sched-event--dragging"), h) {
2568
- o && (o.dataset.wasDragged = "true");
2569
- const L = z(b.clientX, b.clientY);
2613
+ if ($(), c && (c.remove(), c = null), h && h.classList.remove("cal-sched-event--dragging"), o) {
2614
+ h && (h.dataset.wasDragged = "true");
2615
+ const L = I(b.clientX, b.clientY);
2570
2616
  if (L && g) {
2571
- const S = e(), q = y(m) - y(w), x = L.time, B = y(x), Q = Math.min(B + q, y(S.endTime)), ae = ce(Q), J = {
2572
- date: T,
2573
- startTime: w,
2617
+ const S = e(), O = w(m) - w(_), y = L.time, B = w(y), Q = Math.min(B + O, w(S.endTime)), ae = ce(Q), J = {
2618
+ date: C,
2619
+ startTime: _,
2574
2620
  endTime: m,
2575
2621
  resourceId: D
2576
- }, O = {
2622
+ }, q = {
2577
2623
  date: L.date,
2578
- startTime: x,
2624
+ startTime: y,
2579
2625
  endTime: ae,
2580
2626
  resourceId: L.resourceId || D
2581
2627
  };
2582
- (J.date !== O.date || J.startTime !== O.startTime || J.resourceId !== O.resourceId) && (n == null || n({ event: g, from: J, to: O }));
2628
+ (J.date !== q.date || J.startTime !== q.startTime || J.resourceId !== q.resourceId) && (n == null || n({ event: g, from: J, to: q }));
2583
2629
  }
2584
2630
  }
2585
2631
  } else if (d === "resize") {
2586
- if (h) {
2587
- const L = e(), S = L.snapInterval || L.interval, q = L.slotHeight * (S / L.interval), x = b.clientY - v, Q = Math.round(x / q) * S, ae = y(m), J = y(w);
2588
- let O = ae + Q;
2589
- const ue = L.minDuration || S, re = J + ue;
2590
- if (O < re && (O = re), L.maxDuration) {
2632
+ if (o) {
2633
+ const L = e(), S = L.snapInterval || L.interval, O = L.slotHeight * (S / L.interval), y = b.clientY - f, Q = Math.round(y / O) * S, ae = w(m), J = w(_);
2634
+ let q = ae + Q;
2635
+ const he = L.minDuration || S, re = J + he;
2636
+ if (q < re && (q = re), L.maxDuration) {
2591
2637
  const se = J + L.maxDuration;
2592
- O > se && (O = se);
2638
+ q > se && (q = se);
2593
2639
  }
2594
- const K = y(L.endTime);
2595
- O > K && (O = K);
2596
- const te = ce(O);
2597
- o && (o.dataset.wasDragged = "true"), te !== m && g && (l == null || l({
2640
+ const K = w(L.endTime);
2641
+ q > K && (q = K);
2642
+ const te = ce(q);
2643
+ h && (h.dataset.wasDragged = "true"), te !== m && g && (r == null || r({
2598
2644
  event: g,
2599
2645
  from: { endTime: m },
2600
2646
  to: { endTime: te }
2601
2647
  }));
2602
2648
  }
2603
- o && o.classList.remove("cal-sched-event--resizing"), I();
2649
+ h && h.classList.remove("cal-sched-event--resizing"), A();
2604
2650
  } else if (d === "create") {
2605
- I();
2651
+ A();
2606
2652
  const L = (P == null ? void 0 : P.dataset.endTime) || null;
2607
- P && (P.remove(), P = null), h && H && E && L && (r == null || r({
2653
+ P && (P.remove(), P = null), o && H && E && L && (l == null || l({
2608
2654
  date: H,
2609
2655
  startTime: E,
2610
2656
  endTime: L,
2611
- resourceId: _
2612
- })), H = null, _ = null, E = null, Z = 0;
2657
+ resourceId: x
2658
+ })), H = null, x = null, E = null, Z = 0;
2613
2659
  }
2614
- d = null, g = null, o = null, k = 0, u = 0, p = 0, v = 0, h = !1, m = null, w = null, T = null, D = null;
2660
+ d = null, g = null, h = null, k = 0, u = 0, p = 0, f = 0, o = !1, m = null, _ = null, C = null, D = null;
2615
2661
  }
2616
2662
  }
2617
- function z(b, L) {
2618
- const S = e(), q = t.querySelectorAll("[data-date]");
2619
- let x = null, B = null;
2620
- for (const ne of q) {
2621
- const de = ne.getBoundingClientRect();
2622
- if (b >= de.left && b <= de.right) {
2623
- if (x = ne.dataset.date, ne.dataset.resourceId)
2663
+ function I(b, L) {
2664
+ const S = e(), O = t.querySelectorAll("[data-date]");
2665
+ let y = null, B = null;
2666
+ for (const ne of O) {
2667
+ const oe = ne.getBoundingClientRect();
2668
+ if (b >= oe.left && b <= oe.right) {
2669
+ if (y = ne.dataset.date, ne.dataset.resourceId)
2624
2670
  B = ne.dataset.resourceId;
2625
2671
  else {
2626
2672
  const Ee = ne.querySelectorAll("[data-resource-id]");
@@ -2635,14 +2681,14 @@ function It({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove:
2635
2681
  break;
2636
2682
  }
2637
2683
  }
2638
- if (!x) return null;
2684
+ if (!y) return null;
2639
2685
  const Q = t.querySelectorAll("[data-time]");
2640
2686
  if (Q.length === 0) return null;
2641
- const J = Q[0].getBoundingClientRect().top, O = L - J;
2642
- if (O < 0) return null;
2643
- const ue = S.snapInterval || S.interval, re = Ie(O, S.startTime, S.slotHeight, S.interval), K = ze(re, ue), te = y(K), se = y(S.startTime), V = y(S.endTime);
2687
+ const J = Q[0].getBoundingClientRect().top, q = L - J;
2688
+ if (q < 0) return null;
2689
+ const he = S.snapInterval || S.interval, re = Ae(q, S.startTime, S.slotHeight, S.interval), K = Ie(re, he), te = w(K), se = w(S.startTime), V = w(S.endTime);
2644
2690
  return te < se || te >= V ? null : {
2645
- date: x,
2691
+ date: y,
2646
2692
  time: K,
2647
2693
  resourceId: B
2648
2694
  };
@@ -2651,63 +2697,63 @@ function It({ shadowRoot: t, getConfig: e, getViewInfo: s, getEvents: a, onMove:
2651
2697
  $();
2652
2698
  const L = e();
2653
2699
  let S = L.interval;
2654
- g && w && m && (S = y(m) - y(w));
2655
- let x = y(b.time) + S;
2656
- const B = y(L.endTime);
2657
- x > B && (x = B);
2658
- const Q = ce(x);
2700
+ g && _ && m && (S = w(m) - w(_));
2701
+ let y = w(b.time) + S;
2702
+ const B = w(L.endTime);
2703
+ y > B && (y = B);
2704
+ const Q = ce(y);
2659
2705
  let ae = R(b.date, b.resourceId);
2660
2706
  if (!ae) return;
2661
2707
  X = document.createElement("div"), X.classList.add("cal-sched-drop-preview");
2662
- const J = ie(b.time, L.startTime, L.slotHeight, L.interval), O = ie(Q, L.startTime, L.slotHeight, L.interval);
2663
- X.style.top = `${J}px`, X.style.height = `${Math.max(O - J, L.slotHeight * 0.5)}px`, ae.appendChild(X);
2708
+ const J = ie(b.time, L.startTime, L.slotHeight, L.interval), q = ie(Q, L.startTime, L.slotHeight, L.interval);
2709
+ X.style.top = `${J}px`, X.style.height = `${Math.max(q - J, L.slotHeight * 0.5)}px`, ae.appendChild(X);
2664
2710
  }
2665
2711
  function $() {
2666
2712
  X && (X.remove(), X = null);
2667
2713
  }
2668
2714
  function R(b, L) {
2669
2715
  if (L) {
2670
- let q = t.querySelector(
2716
+ let O = t.querySelector(
2671
2717
  `[data-resource-id="${L}"][data-date="${b}"]`
2672
2718
  );
2673
- if (q || (q = t.querySelector(
2719
+ if (O || (O = t.querySelector(
2674
2720
  `[data-date="${b}"] [data-resource-id="${L}"]`
2675
- )), q) return q;
2721
+ )), O) return O;
2676
2722
  }
2677
2723
  const S = t.querySelector(`[data-date="${b}"]`);
2678
2724
  return S ? S.querySelector(".cal-sched-week__lane") || S.querySelector(".cal-sched-day__lane") || S : null;
2679
2725
  }
2680
- function U(b, L, S, q) {
2726
+ function G(b, L, S, O) {
2681
2727
  F || (F = document.createElement("div"), F.classList.add("cal-sched-drag-time-label"), t.appendChild(F));
2682
- const { hours: x, minutes: B } = C(S), Q = q === "12h" ? A(x, B) : S;
2728
+ const { hours: y, minutes: B } = T(S), Q = O === "12h" ? z(y, B) : S;
2683
2729
  F.textContent = Q, F.style.left = `${b + 12}px`, F.style.top = `${L - 8}px`;
2684
2730
  }
2685
- function I() {
2731
+ function A() {
2686
2732
  F && (F.remove(), F = null);
2687
2733
  }
2688
- function C(b) {
2734
+ function T(b) {
2689
2735
  const [L, S] = b.split(":").map(Number);
2690
2736
  return { hours: L, minutes: S };
2691
2737
  }
2692
- function A(b, L) {
2738
+ function z(b, L) {
2693
2739
  const S = b >= 12 ? "PM" : "AM";
2694
2740
  return `${b % 12 || 12}:${String(L).padStart(2, "0")} ${S}`;
2695
2741
  }
2696
- function G() {
2697
- i || (i = !0, t.addEventListener("pointerdown", j));
2742
+ function U() {
2743
+ i || (i = !0, t.addEventListener("pointerdown", N));
2698
2744
  }
2699
2745
  function le() {
2700
- i = !1, t.removeEventListener("pointerdown", j), t.removeEventListener("pointermove", M), t.removeEventListener("pointerup", f), ke();
2746
+ i = !1, t.removeEventListener("pointerdown", N), t.removeEventListener("pointermove", M), t.removeEventListener("pointerup", v), ke();
2701
2747
  }
2702
2748
  function ke() {
2703
- c && (c.remove(), c = null), P && (P.remove(), P = null), o && (o.classList.remove("cal-sched-event--dragging", "cal-sched-event--resizing"), o = null), $(), I(), d = null, g = null, h = !1;
2749
+ c && (c.remove(), c = null), P && (P.remove(), P = null), h && (h.classList.remove("cal-sched-event--dragging", "cal-sched-event--resizing"), h = null), $(), A(), d = null, g = null, o = !1;
2704
2750
  }
2705
2751
  function Re() {
2706
2752
  le();
2707
2753
  }
2708
- return { enable: G, disable: le, destroy: Re };
2754
+ return { enable: U, disable: le, destroy: Re };
2709
2755
  }
2710
- const zt = `
2756
+ const Pt = `
2711
2757
  [data-draggable="true"] {
2712
2758
  cursor: grab;
2713
2759
  }
@@ -2792,7 +2838,7 @@ const zt = `
2792
2838
  z-index: 1001;
2793
2839
  white-space: nowrap;
2794
2840
  }
2795
- `, At = `
2841
+ `, Ht = `
2796
2842
  .cal-sched {
2797
2843
  background: hsl(var(--cal-bg));
2798
2844
  border-radius: var(--cal-radius);
@@ -2804,27 +2850,27 @@ const zt = `
2804
2850
  position: relative;
2805
2851
  }
2806
2852
  `;
2807
- class Pt extends Fe {
2853
+ class Yt extends Fe {
2808
2854
  static get styles() {
2809
2855
  return [
2810
- et,
2811
- tt,
2812
2856
  at,
2813
- rt,
2814
- it,
2857
+ st,
2858
+ nt,
2859
+ ct,
2815
2860
  ot,
2816
2861
  ut,
2817
- mt,
2862
+ gt,
2818
2863
  vt,
2819
2864
  _t,
2820
- wt,
2865
+ yt,
2821
2866
  Et,
2822
2867
  Ct,
2823
2868
  Mt,
2824
- pt,
2825
2869
  Dt,
2826
- zt,
2827
- At
2870
+ mt,
2871
+ At,
2872
+ Pt,
2873
+ Ht
2828
2874
  ];
2829
2875
  }
2830
2876
  static get observedAttributes() {
@@ -2846,13 +2892,14 @@ class Pt extends Fe {
2846
2892
  "draggable-events",
2847
2893
  "snap-interval",
2848
2894
  "min-duration",
2849
- "max-duration"
2895
+ "max-duration",
2896
+ "locale"
2850
2897
  ];
2851
2898
  }
2852
2899
  constructor() {
2853
2900
  super(), this._store = Ve({
2854
2901
  view: "week",
2855
- anchorDate: me(),
2902
+ anchorDate: ge(),
2856
2903
  layout: "vertical",
2857
2904
  selectedResourceId: null,
2858
2905
  // Slot selection
@@ -2866,7 +2913,7 @@ class Pt extends Fe {
2866
2913
  statusDismissible: !0,
2867
2914
  // All-day collapse
2868
2915
  allDayCollapsed: !1
2869
- }), this._resources = [], this._events = [], this._eventActions = [], this._eventContent = null, this._unsubscribe = null, this._rendering = !1, this._nowTimer = null, this._dragManager = null;
2916
+ }), this._resources = [], this._events = [], this._eventActions = [], this._eventContent = null, this._colors = null, this._customColorMap = null, this._unsubscribe = null, this._rendering = !1, this._nowTimer = null, this._dragManager = null;
2870
2917
  }
2871
2918
  // -- Attribute getters --
2872
2919
  get view() {
@@ -2923,6 +2970,9 @@ class Pt extends Fe {
2923
2970
  const e = this.getAttribute("max-duration");
2924
2971
  return e ? parseInt(e, 10) : null;
2925
2972
  }
2973
+ get locale() {
2974
+ return this.getAttribute("locale") || void 0;
2975
+ }
2926
2976
  // -- Properties --
2927
2977
  get resources() {
2928
2978
  return this._resources;
@@ -2948,6 +2998,15 @@ class Pt extends Fe {
2948
2998
  set eventContent(e) {
2949
2999
  this._eventContent = typeof e == "function" ? e : null, this._initialized && this.render();
2950
3000
  }
3001
+ get colors() {
3002
+ return this._colors;
3003
+ }
3004
+ set colors(e) {
3005
+ if (this._colors = Array.isArray(e) ? e : null, this._customColorMap = tt(this._colors), this._customColorMap)
3006
+ for (const [s, a] of Object.entries(this._customColorMap))
3007
+ this.style.setProperty(`--cal-booking-${s}-bg`, a.bg), this.style.setProperty(`--cal-booking-${s}-fg`, a.fg), this.style.setProperty(`--cal-booking-${s}-hover`, a.hover);
3008
+ this._initialized && this.render();
3009
+ }
2951
3010
  get value() {
2952
3011
  return this._lastSlotValue || null;
2953
3012
  }
@@ -2994,19 +3053,19 @@ class Pt extends Fe {
2994
3053
  ["day", "week", "month"].includes(e) && (this._store.set({ view: e }), this.emit("cal:view-change", { view: e, date: this._store.get("anchorDate") }));
2995
3054
  }
2996
3055
  today() {
2997
- this.goToDate(me());
3056
+ this.goToDate(ge());
2998
3057
  }
2999
3058
  next() {
3000
3059
  const e = this._store.getState(), s = ee(e.anchorDate);
3001
3060
  if (!s) return;
3002
3061
  let a;
3003
3062
  if (e.view === "day")
3004
- a = fe(e.anchorDate, 1);
3063
+ a = me(e.anchorDate, 1);
3005
3064
  else if (e.view === "week")
3006
- a = fe(e.anchorDate, 7);
3065
+ a = me(e.anchorDate, 7);
3007
3066
  else {
3008
- const { year: n, month: l } = xe(s.getFullYear(), s.getMonth(), 1);
3009
- a = pe(new Date(n, l, 1));
3067
+ const { year: n, month: r } = xe(s.getFullYear(), s.getMonth(), 1);
3068
+ a = ue(new Date(n, r, 1));
3010
3069
  }
3011
3070
  this._store.set({ anchorDate: a }), this.emit("cal:date-change", { date: a, view: e.view });
3012
3071
  }
@@ -3015,17 +3074,17 @@ class Pt extends Fe {
3015
3074
  if (!s) return;
3016
3075
  let a;
3017
3076
  if (e.view === "day")
3018
- a = fe(e.anchorDate, -1);
3077
+ a = me(e.anchorDate, -1);
3019
3078
  else if (e.view === "week")
3020
- a = fe(e.anchorDate, -7);
3079
+ a = me(e.anchorDate, -7);
3021
3080
  else {
3022
- const { year: n, month: l } = xe(s.getFullYear(), s.getMonth(), -1);
3023
- a = pe(new Date(n, l, 1));
3081
+ const { year: n, month: r } = xe(s.getFullYear(), s.getMonth(), -1);
3082
+ a = ue(new Date(n, r, 1));
3024
3083
  }
3025
3084
  this._store.set({ anchorDate: a }), this.emit("cal:date-change", { date: a, view: e.view });
3026
3085
  }
3027
3086
  findAvailableSlot(e) {
3028
- return Qe(
3087
+ return et(
3029
3088
  e,
3030
3089
  this._resources,
3031
3090
  this._events,
@@ -3037,12 +3096,19 @@ class Pt extends Fe {
3037
3096
  isSlotAvailable(e, s, a, n) {
3038
3097
  return Be(this._events, n, e, s, a);
3039
3098
  }
3099
+ clear() {
3100
+ this._store.set({
3101
+ selectedSlot: null,
3102
+ detailEvent: null,
3103
+ detailResource: null
3104
+ }), this._lastSlotValue = null;
3105
+ }
3040
3106
  // -- Event handlers --
3041
- _handleSlotClick(e, s, a, n, l) {
3042
- this._lastSlotValue = { date: e, startTime: s, endTime: a, resourceId: n, resource: l }, this._store.set({ selectedSlot: { date: e, startTime: s, endTime: a, resourceId: n, resource: l } }), this.emit("cal:slot-select", { date: e, startTime: s, endTime: a, resourceId: n, resource: l });
3107
+ _handleSlotClick(e, s, a, n, r) {
3108
+ this._lastSlotValue = { date: e, startTime: s, endTime: a, resourceId: n, resource: r }, this._store.set({ selectedSlot: { date: e, startTime: s, endTime: a, resourceId: n, resource: r } }), this.emit("cal:slot-select", { date: e, startTime: s, endTime: a, resourceId: n, resource: r });
3043
3109
  }
3044
- _handleSlotCreate(e, s, a, n, l) {
3045
- this.emit("cal:slot-create", { date: e, startTime: s, endTime: a, resourceId: n, resource: l });
3110
+ _handleSlotCreate(e, s, a, n, r) {
3111
+ this.emit("cal:slot-create", { date: e, startTime: s, endTime: a, resourceId: n, resource: r });
3046
3112
  }
3047
3113
  _dismissSlot() {
3048
3114
  this._store.set({ selectedSlot: null });
@@ -3069,7 +3135,7 @@ class Pt extends Fe {
3069
3135
  });
3070
3136
  }
3071
3137
  _initDrag() {
3072
- this._dragManager || (this._dragManager = It({
3138
+ this._dragManager || (this._dragManager = zt({
3073
3139
  shadowRoot: this.shadowRoot,
3074
3140
  getConfig: () => ({
3075
3141
  slotHeight: this.slotHeight,
@@ -3114,56 +3180,57 @@ class Pt extends Fe {
3114
3180
  }
3115
3181
  // -- Render --
3116
3182
  render() {
3117
- var v;
3183
+ var f;
3118
3184
  if (this._rendering) return;
3119
3185
  this._rendering = !0;
3120
3186
  const e = this.shadowRoot, s = [...e.childNodes];
3121
- for (const h of s)
3122
- h.nodeName !== "STYLE" && !(h instanceof CSSStyleSheet) && e.removeChild(h);
3187
+ for (const o of s)
3188
+ o.nodeName !== "STYLE" && !(o instanceof CSSStyleSheet) && e.removeChild(o);
3123
3189
  const a = this._store.getState(), n = document.createElement("div");
3124
- n.classList.add("cal-sched"), a.statusType && a.statusMessage && n.appendChild(kt({
3190
+ n.classList.add("cal-sched"), a.statusType && a.statusMessage && n.appendChild(Lt({
3125
3191
  type: a.statusType,
3126
3192
  message: a.statusMessage,
3127
3193
  dismissible: a.statusDismissible,
3128
3194
  onDismiss: () => this.clearStatus()
3129
3195
  }));
3130
- const l = a.view, r = a.anchorDate, i = Te(r, this.firstDay), d = Je(l, r, i), g = this.resourceMode;
3131
- n.appendChild(lt({
3196
+ const r = a.view, l = a.anchorDate, i = Te(l, this.firstDay), d = Ke(r, l, i, this.locale), g = this.resourceMode;
3197
+ n.appendChild(it({
3132
3198
  title: d,
3133
- view: l,
3199
+ view: r,
3134
3200
  onPrev: () => this.prev(),
3135
3201
  onNext: () => this.next(),
3136
3202
  onToday: () => this.today(),
3137
- onViewChange: (h) => this._handleViewChange(h)
3203
+ onViewChange: (o) => this._handleViewChange(o),
3204
+ locale: this.locale
3138
3205
  }));
3139
- const c = this._resources.length > 0 ? this._resources : [{ id: "__default", name: "" }], o = g === "tabs" && c.length > 1 && c[0].id !== "__default";
3140
- o && !this.loading && n.appendChild(Tt({
3206
+ const c = this._resources.length > 0 ? this._resources : [{ id: "__default", name: "" }], h = g === "tabs" && c.length > 1 && c[0].id !== "__default";
3207
+ h && !this.loading && n.appendChild(St({
3141
3208
  resources: c,
3142
3209
  selectedResourceId: a.selectedResourceId,
3143
- onResourceFilter: (h) => this._handleResourceFilter(h)
3210
+ onResourceFilter: (o) => this._handleResourceFilter(o)
3144
3211
  }));
3145
3212
  let k = this._events;
3146
- o && a.selectedResourceId && (k = this._events.filter((h) => h.resourceId === a.selectedResourceId));
3213
+ h && a.selectedResourceId && (k = this._events.filter((o) => o.resourceId === a.selectedResourceId));
3147
3214
  let u = c;
3148
- if (o && a.selectedResourceId) {
3149
- const h = c.find((m) => m.id === a.selectedResourceId);
3150
- h && (u = [h]);
3215
+ if (h && a.selectedResourceId) {
3216
+ const o = c.find((m) => m.id === a.selectedResourceId);
3217
+ o && (u = [o]);
3151
3218
  }
3152
3219
  const p = document.createElement("div");
3153
3220
  if (p.classList.add("cal-sched__body"), this.loading)
3154
- if (l === "month")
3155
- p.appendChild(yt());
3221
+ if (r === "month")
3222
+ p.appendChild(kt());
3156
3223
  else {
3157
- const h = l === "week" ? 7 : Math.max(this._resources.length, 1);
3158
- p.appendChild(xt({
3159
- columns: h,
3160
- rows: Math.ceil((y(this.endTime) - y(this.startTime)) / this.interval),
3224
+ const o = r === "week" ? 7 : Math.max(this._resources.length, 1);
3225
+ p.appendChild(wt({
3226
+ columns: o,
3227
+ rows: Math.ceil((w(this.endTime) - w(this.startTime)) / this.interval),
3161
3228
  slotHeight: this.slotHeight
3162
3229
  }));
3163
3230
  }
3164
3231
  else
3165
- l === "day" ? p.appendChild(gt({
3166
- date: r,
3232
+ r === "day" ? p.appendChild(ft({
3233
+ date: l,
3167
3234
  resources: u,
3168
3235
  events: k,
3169
3236
  startTime: this.startTime,
@@ -3177,11 +3244,11 @@ class Pt extends Fe {
3177
3244
  eventContent: this._eventContent,
3178
3245
  showTime: this.showEventTime,
3179
3246
  draggable: this.draggableEvents,
3180
- onSlotClick: (h, m, w, T, D) => this._handleSlotClick(h, m, w, T, D),
3181
- onEventClick: (h, m, w) => this._handleEventClick(h, m, w),
3182
- onSlotCreate: (h, m, w, T, D) => this._handleSlotCreate(h, m, w, T, D)
3183
- })) : l === "week" ? p.appendChild(ft({
3184
- date: r,
3247
+ onSlotClick: (o, m, _, C, D) => this._handleSlotClick(o, m, _, C, D),
3248
+ onEventClick: (o, m, _) => this._handleEventClick(o, m, _),
3249
+ onSlotCreate: (o, m, _, C, D) => this._handleSlotCreate(o, m, _, C, D)
3250
+ })) : r === "week" ? p.appendChild(bt({
3251
+ date: l,
3185
3252
  firstDay: this.firstDay,
3186
3253
  resources: u,
3187
3254
  events: k,
@@ -3198,38 +3265,38 @@ class Pt extends Fe {
3198
3265
  draggable: this.draggableEvents,
3199
3266
  allDayCollapsed: a.allDayCollapsed,
3200
3267
  onToggleAllDay: () => this._store.set({ allDayCollapsed: !a.allDayCollapsed }),
3201
- onSlotClick: (h, m, w, T, D) => this._handleSlotClick(h, m, w, T, D),
3202
- onEventClick: (h, m, w) => this._handleEventClick(h, m, w),
3203
- onSlotCreate: (h, m, w, T, D) => this._handleSlotCreate(h, m, w, T, D)
3204
- })) : l === "month" && p.appendChild(bt({
3205
- date: r,
3268
+ onSlotClick: (o, m, _, C, D) => this._handleSlotClick(o, m, _, C, D),
3269
+ onEventClick: (o, m, _) => this._handleEventClick(o, m, _),
3270
+ onSlotCreate: (o, m, _, C, D) => this._handleSlotCreate(o, m, _, C, D)
3271
+ })) : r === "month" && p.appendChild(xt({
3272
+ date: l,
3206
3273
  firstDay: this.firstDay,
3207
3274
  resources: u,
3208
3275
  events: k,
3209
3276
  format: this.format,
3210
3277
  selectedResourceId: a.selectedResourceId,
3211
- selectedDate: ((v = a.selectedSlot) == null ? void 0 : v.date) || null,
3278
+ selectedDate: ((f = a.selectedSlot) == null ? void 0 : f.date) || null,
3212
3279
  eventContent: this._eventContent,
3213
- onSlotClick: (h) => this._handleSlotClick(h, null, null, null, null),
3214
- onEventClick: (h, m, w) => this._handleEventClick(h, m, w),
3215
- onSlotCreate: (h) => this._handleSlotCreate(h, null, null, null, null)
3280
+ onSlotClick: (o) => this._handleSlotClick(o, null, null, null, null),
3281
+ onEventClick: (o, m, _) => this._handleEventClick(o, m, _),
3282
+ onSlotCreate: (o) => this._handleSlotCreate(o, null, null, null, null)
3216
3283
  }));
3217
- n.appendChild(p), a.detailEvent && p.appendChild(Lt({
3284
+ n.appendChild(p), a.detailEvent && p.appendChild(Tt({
3218
3285
  event: a.detailEvent,
3219
3286
  resource: a.detailResource,
3220
3287
  format: this.format,
3221
3288
  onClose: () => this._closeDetail(),
3222
3289
  actions: this._eventActions,
3223
- onAction: (h) => this._handleEventAction(h)
3224
- })), this.showFab && !this.loading && p.appendChild(St({
3290
+ onAction: (o) => this._handleEventAction(o)
3291
+ })), this.showFab && !this.loading && p.appendChild($t({
3225
3292
  onClick: () => this._handleFabClick()
3226
- })), e.appendChild(n), this._escHandler || (this._escHandler = (h) => {
3227
- h.key === "Escape" && this._store.get("selectedSlot") && this._dismissSlot();
3293
+ })), e.appendChild(n), this._escHandler || (this._escHandler = (o) => {
3294
+ o.key === "Escape" && this._store.get("selectedSlot") && this._dismissSlot();
3228
3295
  }, this.shadowRoot.addEventListener("keydown", this._escHandler), document.addEventListener("keydown", this._escHandler)), this._rendering = !1;
3229
3296
  }
3230
3297
  }
3231
- customElements.get("cal-scheduler") || customElements.define("cal-scheduler", Pt);
3298
+ customElements.get("cal-scheduler") || customElements.define("cal-scheduler", Yt);
3232
3299
  export {
3233
- Pt as CalScheduler
3300
+ Yt as CalScheduler
3234
3301
  };
3235
3302
  //# sourceMappingURL=scheduler.es.js.map