@luckydye/calendar 1.2.3 → 1.3.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.
package/dist/calendar.js CHANGED
@@ -249,7 +249,7 @@ let Vt = class extends HTMLElement {
249
249
  Vt.elementStyles = [], Vt.shadowRootOptions = { mode: "open" }, Vt[re("elementProperties")] = /* @__PURE__ */ new Map(), Vt[re("finalized")] = /* @__PURE__ */ new Map(), yn?.({ ReactiveElement: Vt }), (Ce.reactiveElementVersions ??= []).push("2.1.2");
250
250
  const Ke = globalThis, di = (n) => n, we = Ke.trustedTypes, ui = we ? we.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, Bi = "$lit$", At = `lit$${Math.random().toFixed(9).slice(2)}$`, qi = "?" + At, bn = `<${qi}>`, Lt = document, le = () => Lt.createComment(""), ce = (n) => n === null || typeof n != "object" && typeof n != "function", Xe = Array.isArray, wn = (n) => Xe(n) || typeof n?.[Symbol.iterator] == "function", _e = `[
251
251
  \f\r]`, ne = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, fi = /-->/g, gi = />/g, It = RegExp(`>|${_e}(?:([^\\s"'>=/]+)(${_e}*=${_e}*(?:[^
252
- \f\r"'\`<>=]|("|')|))|$)`, "g"), pi = /'/g, vi = /"/g, Vi = /^(?:script|style|textarea|title)$/i, En = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), _ = En(1), Xt = /* @__PURE__ */ Symbol.for("lit-noChange"), G = /* @__PURE__ */ Symbol.for("lit-nothing"), mi = /* @__PURE__ */ new WeakMap(), Ut = Lt.createTreeWalker(Lt, 129);
252
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), pi = /'/g, vi = /"/g, Vi = /^(?:script|style|textarea|title)$/i, En = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), O = En(1), Xt = /* @__PURE__ */ Symbol.for("lit-noChange"), G = /* @__PURE__ */ Symbol.for("lit-nothing"), mi = /* @__PURE__ */ new WeakMap(), Ut = Lt.createTreeWalker(Lt, 129);
253
253
  function ji(n, t) {
254
254
  if (!Xe(n) || !n.hasOwnProperty("raw")) throw Error("invalid template strings array");
255
255
  return ui !== void 0 ? ui.createHTML(t) : t;
@@ -1609,14 +1609,14 @@ function ds(n, t) {
1609
1609
  ;
1610
1610
  }
1611
1611
  if (d) {
1612
- var C = void 0;
1612
+ var M = void 0;
1613
1613
  if (F(t.byweekno, -1))
1614
- C = -1;
1614
+ M = -1;
1615
1615
  else {
1616
- var H = Gt(Wt(n - 1, 1, 1)), M = lt(7 - H.valueOf() + t.wkst, 7), E = oe(n - 1) ? 366 : 365, $ = void 0;
1617
- M >= 4 ? (M = 0, $ = E + lt(H - t.wkst, 7)) : $ = i - d, C = Math.floor(52 + lt($, 7) / 4);
1616
+ var H = Gt(Wt(n - 1, 1, 1)), $ = lt(7 - H.valueOf() + t.wkst, 7), w = oe(n - 1) ? 366 : 365, D = void 0;
1617
+ $ >= 4 ? ($ = 0, D = w + lt(H - t.wkst, 7)) : D = i - d, M = Math.floor(52 + lt(D, 7) / 4);
1618
1618
  }
1619
- if (F(t.byweekno, C))
1619
+ if (F(t.byweekno, M))
1620
1620
  for (var p = 0; p < d; p++)
1621
1621
  a.wnomask[p] = 1;
1622
1622
  }
@@ -1826,25 +1826,25 @@ function nn(n, t) {
1826
1826
  var h = c.getdayset(i)(l.year, l.month, l.day), u = h[0], f = h[1], v = h[2], g = ys(u, f, v, c, t);
1827
1827
  if (Z(o))
1828
1828
  for (var p = vs(o, d, f, v, c, u), y = 0; y < p.length; y++) {
1829
- var C = p[y];
1830
- if (r && C > r)
1829
+ var M = p[y];
1830
+ if (r && M > r)
1831
1831
  return xt(n);
1832
- if (C >= e) {
1833
- var H = Ci(C, t);
1832
+ if (M >= e) {
1833
+ var H = Ci(M, t);
1834
1834
  if (!n.accept(H) || a && (--a, !a))
1835
1835
  return xt(n);
1836
1836
  }
1837
1837
  }
1838
1838
  else
1839
1839
  for (var y = f; y < v; y++) {
1840
- var M = u[y];
1841
- if (V(M))
1842
- for (var E = Ji(c.yearordinal + M), $ = 0; $ < d.length; $++) {
1843
- var w = d[$], C = Qi(E, w);
1844
- if (r && C > r)
1840
+ var $ = u[y];
1841
+ if (V($))
1842
+ for (var w = Ji(c.yearordinal + $), D = 0; D < d.length; D++) {
1843
+ var E = d[D], M = Qi(w, E);
1844
+ if (r && M > r)
1845
1845
  return xt(n);
1846
- if (C >= e) {
1847
- var H = Ci(C, t);
1846
+ if (M >= e) {
1847
+ var H = Ci(M, t);
1848
1848
  if (!n.accept(H) || a && (--a, !a))
1849
1849
  return xt(n);
1850
1850
  }
@@ -2274,6 +2274,14 @@ class N {
2274
2274
  this.calendarEvents.set(e.id, e);
2275
2275
  return this.sendEvents(), t;
2276
2276
  }
2277
+ applyEventOptimistically(t) {
2278
+ this.calendarEvents.set(t.id, t), this.storage?.putEvent(t).catch(() => {
2279
+ }), this.sendEvents();
2280
+ }
2281
+ removeEventOptimistically(t) {
2282
+ this.calendarEvents.delete(t), this.storage?.deleteEvent(t).catch(() => {
2283
+ }), this.sendEvents();
2284
+ }
2277
2285
  setFilter(t) {
2278
2286
  this.filter = t, this.sendEvents();
2279
2287
  }
@@ -2769,7 +2777,7 @@ const ke = class ke extends Kt {
2769
2777
  }, 200));
2770
2778
  }
2771
2779
  render() {
2772
- return !this.isShowing || !this.currentMessage ? _`` : _`<div class="message">${this.currentMessage}</div>`;
2780
+ return !this.isShowing || !this.currentMessage ? O`` : O`<div class="message">${this.currentMessage}</div>`;
2773
2781
  }
2774
2782
  };
2775
2783
  ke.styles = zi`
@@ -3006,6 +3014,13 @@ class zs {
3006
3014
  r.objectStore(this.storeName).put(this.serializeEvent(t)), r.oncomplete = () => i(), r.onerror = () => s(r.error);
3007
3015
  });
3008
3016
  }
3017
+ async deleteEvent(t) {
3018
+ const e = await this.open();
3019
+ return new Promise((i, s) => {
3020
+ const r = e.transaction(this.storeName, "readwrite");
3021
+ r.objectStore(this.storeName).delete(t), r.oncomplete = () => i(), r.onerror = () => s(r.error);
3022
+ });
3023
+ }
3009
3024
  }
3010
3025
  const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3011
3026
  constructor() {
@@ -3383,8 +3398,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3383
3398
  if (!this.scrollAnimationFrame) return;
3384
3399
  const y = Math.min((p - u) / h, 1);
3385
3400
  this._dayHeight = r + (t - r) * f(y), this.updateWeekOffsets();
3386
- const C = c + (d - c) * v(y);
3387
- this._scrollTop = Math.max(0, C * this.totalHeight), this.scrollContainer && (this.scrollContent && this.scrollContainer.scrollHeight < this._scrollTop && (this.scrollContent.style.minHeight = this._scrollTop + window.innerHeight + "px"), this.scrollContainer.scrollTop = this._scrollTop), this.renderCanvas(), y < 1 ? this.scrollAnimationFrame = requestAnimationFrame(g) : (this._dayHeight = t, this._scrollTop = e, this.saveDayHeight(), this.saveScrollPosition(), this.scrollAnimationFrame = null, this.renderCanvas());
3401
+ const M = c + (d - c) * v(y);
3402
+ this._scrollTop = Math.max(0, M * this.totalHeight), this.scrollContainer && (this.scrollContent && this.scrollContainer.scrollHeight < this._scrollTop && (this.scrollContent.style.minHeight = this._scrollTop + window.innerHeight + "px"), this.scrollContainer.scrollTop = this._scrollTop), this.renderCanvas(), y < 1 ? this.scrollAnimationFrame = requestAnimationFrame(g) : (this._dayHeight = t, this._scrollTop = e, this.saveDayHeight(), this.saveScrollPosition(), this.scrollAnimationFrame = null, this.renderCanvas());
3388
3403
  };
3389
3404
  this.scrollAnimationFrame = requestAnimationFrame(g);
3390
3405
  return;
@@ -3605,10 +3620,10 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3605
3620
  if (u >= 0) {
3606
3621
  const { row: f, col: v } = this.getDayVisualPosition(u), g = z + v * a, p = h.yOffset + f * this.dayHeight - r, y = getComputedStyle(this).getPropertyValue("--bg-today").trim() || "rgba(255, 255, 255, 0.05)";
3607
3622
  if (t.fillStyle = y, t.fillRect(g, p, a, this.dayHeight), d) {
3608
- const C = /* @__PURE__ */ new Date(), H = C.getHours() * 60 + C.getMinutes(), M = p + H / 1440 * this.dayHeight;
3609
- if (M >= 0 && M <= i) {
3610
- const E = getComputedStyle(this).getPropertyValue("--accent-current-time").trim() || "rgba(255, 0, 0, 0.8)";
3611
- t.strokeStyle = E, t.lineWidth = 1, t.beginPath(), t.moveTo(g, M), t.lineTo(g + a, M), t.stroke(), t.lineWidth = 1;
3623
+ const M = /* @__PURE__ */ new Date(), H = M.getHours() * 60 + M.getMinutes(), $ = p + H / 1440 * this.dayHeight;
3624
+ if ($ >= 0 && $ <= i) {
3625
+ const w = getComputedStyle(this).getPropertyValue("--accent-current-time").trim() || "rgba(255, 0, 0, 0.8)";
3626
+ t.strokeStyle = w, t.lineWidth = 1, t.beginPath(), t.moveTo(g, $), t.lineTo(g + a, $), t.stroke(), t.lineWidth = 1;
3612
3627
  }
3613
3628
  }
3614
3629
  }
@@ -3623,21 +3638,21 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3623
3638
  if (!u) continue;
3624
3639
  const f = u.yOffset - r;
3625
3640
  if (this.filter && h > 0) {
3626
- const w = c[h - 1];
3627
- if (!w) continue;
3628
- const S = this.weeks.indexOf(w), O = this.weeks.indexOf(u) - S - 1;
3629
- if (O > 0) {
3641
+ const E = c[h - 1];
3642
+ if (!E) continue;
3643
+ const S = this.weeks.indexOf(E), _ = this.weeks.indexOf(u) - S - 1;
3644
+ if (_ > 0) {
3630
3645
  const b = f, x = getComputedStyle(this).getPropertyValue("--grid-color-strong").trim() || "rgba(255, 255, 255, 0.3)";
3631
3646
  t.strokeStyle = x, t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(z, b), t.lineTo(e, b), t.stroke(), t.setLineDash([]);
3632
3647
  const T = getComputedStyle(this).getPropertyValue("--text-muted").trim() || "rgba(255, 255, 255, 0.4)";
3633
3648
  t.fillStyle = T, t.textAlign = "center";
3634
- const D = `⋯ ${O} week${O > 1 ? "s" : ""}`, U = t.measureText(D).width, L = 8, P = (z + e) / 2 - U / 2 - L, B = b - 8, R = U + L * 2, W = 16, K = getComputedStyle(this).getPropertyValue("--bg-primary").trim() || "rgba(30, 30, 30, 0.9)";
3635
- t.fillStyle = K, t.beginPath(), t.roundRect(P, B, R, W, 8), t.fill(), t.fillStyle = T, t.fillText(D, (z + e) / 2, b + 4);
3649
+ const C = `⋯ ${_} week${_ > 1 ? "s" : ""}`, U = t.measureText(C).width, L = 8, P = (z + e) / 2 - U / 2 - L, B = b - 8, R = U + L * 2, W = 16, K = getComputedStyle(this).getPropertyValue("--bg-primary").trim() || "rgba(30, 30, 30, 0.9)";
3650
+ t.fillStyle = K, t.beginPath(), t.roundRect(P, B, R, W, 8), t.fill(), t.fillStyle = T, t.fillText(C, (z + e) / 2, b + 4);
3636
3651
  }
3637
3652
  }
3638
3653
  t.strokeStyle = getComputedStyle(this).getPropertyValue("--grid-color").trim() || "rgba(255, 255, 255, 0.1)", t.beginPath(), t.moveTo(z, f), t.lineTo(e, f), t.stroke();
3639
- for (let w = 1; w < this.rowsPerWeek; w++) {
3640
- const S = f + w * this.dayHeight;
3654
+ for (let E = 1; E < this.rowsPerWeek; E++) {
3655
+ const S = f + E * this.dayHeight;
3641
3656
  S >= 0 && S <= i && (t.beginPath(), t.moveTo(z, S), t.lineTo(e, S), t.stroke());
3642
3657
  }
3643
3658
  const v = Math.max(
@@ -3653,73 +3668,73 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3653
3668
  /[\d.]+\)$/,
3654
3669
  `${0.4 * v})`
3655
3670
  );
3656
- for (let w = 0; w < this.rowsPerWeek; w++) {
3657
- const S = f + w * this.dayHeight;
3671
+ for (let E = 0; E < this.rowsPerWeek; E++) {
3672
+ const S = f + E * this.dayHeight;
3658
3673
  for (let A = 0; A < 24; A++) {
3659
- const O = S + A / 24 * this.dayHeight;
3660
- if (O >= 0 && O <= i && (t.beginPath(), t.moveTo(z, O), t.lineTo(e, O), t.stroke(), v > 0.1)) {
3674
+ const _ = S + A / 24 * this.dayHeight;
3675
+ if (_ >= 0 && _ <= i && (t.beginPath(), t.moveTo(z, _), t.lineTo(e, _), t.stroke(), v > 0.1)) {
3661
3676
  const b = `${A.toString().padStart(2, "0")}:00`;
3662
- t.fillText(b, 48, O + 4);
3677
+ t.fillText(b, 48, _ + 4);
3663
3678
  }
3664
3679
  }
3665
3680
  }
3666
3681
  if (v > 0.1) {
3667
- const w = /* @__PURE__ */ new Date(), S = u.days.findIndex(
3668
- (A) => N.isSameDay(A, w)
3682
+ const E = /* @__PURE__ */ new Date(), S = u.days.findIndex(
3683
+ (A) => N.isSameDay(A, E)
3669
3684
  );
3670
3685
  if (S >= 0) {
3671
- const { row: A } = this.getDayVisualPosition(S), O = w.getHours() * 60 + w.getMinutes(), b = f + A * this.dayHeight + O / 1440 * this.dayHeight;
3686
+ const { row: A } = this.getDayVisualPosition(S), _ = E.getHours() * 60 + E.getMinutes(), b = f + A * this.dayHeight + _ / 1440 * this.dayHeight;
3672
3687
  if (b >= 0 && b <= i) {
3673
- const x = w.getHours().toString().padStart(2, "0"), T = w.getMinutes().toString().padStart(2, "0"), D = `${x}:${T}`;
3688
+ const x = E.getHours().toString().padStart(2, "0"), T = E.getMinutes().toString().padStart(2, "0"), C = `${x}:${T}`;
3674
3689
  t.save(), t.textAlign = "right", t.textBaseline = "middle";
3675
- const U = t.measureText(D).width, L = 6, P = 48, B = b, R = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.7)";
3690
+ const U = t.measureText(C).width, L = 6, P = 48, B = b, R = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.7)";
3676
3691
  t.fillStyle = R, t.beginPath(), t.roundRect(
3677
3692
  P - U - L,
3678
3693
  B - 8,
3679
3694
  U + L * 2,
3680
3695
  16,
3681
3696
  4
3682
- ), t.fill(), t.fillStyle = getComputedStyle(this).getPropertyValue("--text-primary").trim() || "rgba(255, 255, 255, 1)", t.fillText(D, P, B), t.restore();
3697
+ ), t.fill(), t.fillStyle = getComputedStyle(this).getPropertyValue("--text-primary").trim() || "rgba(255, 255, 255, 1)", t.fillText(C, P, B), t.restore();
3683
3698
  }
3684
3699
  }
3685
3700
  }
3686
3701
  const y = Math.max(
3687
3702
  0,
3688
3703
  Math.min(1, 1 - (this.dayHeight - 300) / 50)
3689
- ), C = getComputedStyle(this).getPropertyValue("--text-muted").trim() || "rgba(255, 255, 255, 0.4)";
3690
- t.fillStyle = C.replace(
3704
+ ), M = getComputedStyle(this).getPropertyValue("--text-muted").trim() || "rgba(255, 255, 255, 0.4)";
3705
+ t.fillStyle = M.replace(
3691
3706
  /[\d.]+\)$/,
3692
3707
  `${0.4 * y})`
3693
3708
  ), t.textAlign = "center";
3694
- const H = `W${u.weekNumber}`, M = f, E = f + u.height, $ = Math.max(
3709
+ const H = `W${u.weekNumber}`, $ = f, w = f + u.height, D = Math.max(
3695
3710
  14,
3696
- Math.min(M + u.height / 2 + 4, E - 4)
3711
+ Math.min($ + u.height / 2 + 4, w - 4)
3697
3712
  );
3698
- $ >= Math.max(0, M + 4) && $ <= Math.min(i, E) && y > 0.1 && t.fillText(H, 30, $);
3713
+ D >= Math.max(0, $ + 4) && D <= Math.min(i, w) && y > 0.1 && t.fillText(H, 30, D);
3699
3714
  }
3700
3715
  this.renderEventsOnCanvas(t, r, i, a, c), this.renderDateLabels(), this.renderWeekdayLabels(t, a, c, r, i), this.isCreatingEvent && this.renderEventCreationPreview(), this.isDraggingEvent && this.renderEventMovePreview(), this.renderMinimap();
3701
3716
  }
3702
3717
  renderEventsOnCanvas(t, e, i, s, r) {
3703
3718
  const o = this.events, a = getComputedStyle(this).fontFamily, l = e + i, c = this.dayHeight >= 300;
3704
3719
  if (this.eventRects = [], r.length === 0) return;
3705
- const d = r[0], h = r[r.length - 1], u = d.days[0], f = h.days[6], v = u.getTime(), g = f.getTime() + 864e5 - 1, p = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), C = [], H = [], M = [];
3720
+ const d = r[0], h = r[r.length - 1], u = d.days[0], f = h.days[6], v = u.getTime(), g = f.getTime() + 864e5 - 1, p = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), M = [], H = [], $ = [];
3706
3721
  for (const b of o) {
3707
3722
  const x = b.start.getTime(), T = b.end.getTime();
3708
3723
  if (T < v || x > g)
3709
3724
  continue;
3710
- const D = [];
3725
+ const C = [];
3711
3726
  for (const P of r) {
3712
3727
  const B = P.days[0], R = P.days[6];
3713
3728
  if (!B || !R) continue;
3714
3729
  const W = B.getTime(), K = R.getTime() + 86399999;
3715
3730
  if (T >= W && x <= K) {
3716
3731
  const J = this.weeks.indexOf(P);
3717
- D.push({ weekIndex: J, week: P });
3732
+ C.push({ weekIndex: J, week: P });
3718
3733
  }
3719
3734
  }
3720
- const U = D.length, L = b.isAllDay === !0;
3721
- for (let P = 0; P < D.length; P++) {
3722
- const { weekIndex: B, week: R } = D[P], W = P === 0, K = P === D.length - 1;
3735
+ const U = C.length, L = b.isAllDay === !0;
3736
+ for (let P = 0; P < C.length; P++) {
3737
+ const { weekIndex: B, week: R } = C[P], W = P === 0, K = P === C.length - 1;
3723
3738
  let J = 0, wt = 6;
3724
3739
  if (W && (J = Ui(R, b.start)), K) {
3725
3740
  const ut = L ? new Date(b.end.getTime() - 1) : b.end;
@@ -3735,10 +3750,10 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3735
3750
  isEnd: K,
3736
3751
  totalWeeks: U
3737
3752
  };
3738
- L ? H.push(rt) : M.push(rt);
3753
+ L ? H.push(rt) : $.push(rt);
3739
3754
  }
3740
3755
  }
3741
- const E = c ? M.flatMap((b) => {
3756
+ const w = c ? $.flatMap((b) => {
3742
3757
  if (b.startDayIndex === b.endDayIndex) return [b];
3743
3758
  const x = [];
3744
3759
  for (let T = b.startDayIndex; T <= b.endDayIndex; T++)
@@ -3751,20 +3766,20 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3751
3766
  totalWeeks: 1
3752
3767
  });
3753
3768
  return x;
3754
- }) : M;
3755
- C.push(...H, ...E);
3756
- const $ = /* @__PURE__ */ new Map();
3757
- for (const b of C) {
3769
+ }) : $;
3770
+ M.push(...H, ...w);
3771
+ const D = /* @__PURE__ */ new Map();
3772
+ for (const b of M) {
3758
3773
  const x = b.event.isAllDay === !0;
3759
3774
  if (c && !x)
3760
3775
  for (let T = b.startDayIndex; T <= b.endDayIndex; T++) {
3761
- const D = `${b.weekIndex}-${T}`;
3762
- $.has(D) || $.set(D, []), $.get(D).push(b);
3776
+ const C = `${b.weekIndex}-${T}`;
3777
+ D.has(C) || D.set(C, []), D.get(C).push(b);
3763
3778
  }
3764
3779
  }
3765
- const w = /* @__PURE__ */ new Map();
3766
- for (const [b, x] of $) {
3767
- const [T, D] = b.split("-"), U = parseInt(D), L = parseInt(T), P = [];
3780
+ const E = /* @__PURE__ */ new Map();
3781
+ for (const [b, x] of D) {
3782
+ const [T, C] = b.split("-"), U = parseInt(C), L = parseInt(T), P = [];
3768
3783
  for (const R of x) {
3769
3784
  const W = this.weeks[L];
3770
3785
  if (!W) continue;
@@ -3789,21 +3804,21 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3789
3804
  ;
3790
3805
  W === B.length ? B.push({ endMinutes: R.endMinutes }) : B[W].endMinutes = R.endMinutes;
3791
3806
  const K = `${R.segment.weekIndex}-${R.segment.event.id}-${U}`;
3792
- w.set(K, {
3807
+ E.set(K, {
3793
3808
  column: W,
3794
3809
  totalColumns: B.length
3795
3810
  });
3796
3811
  }
3797
3812
  for (const R of P) {
3798
- const W = `${R.segment.weekIndex}-${R.segment.event.id}-${U}`, K = w.get(W);
3813
+ const W = `${R.segment.weekIndex}-${R.segment.event.id}-${U}`, K = E.get(W);
3799
3814
  K && (K.totalColumns = B.length);
3800
3815
  }
3801
3816
  }
3802
- for (const b of C) {
3817
+ for (const b of M) {
3803
3818
  const {
3804
3819
  event: x,
3805
3820
  week: T,
3806
- weekIndex: D,
3821
+ weekIndex: C,
3807
3822
  startDayIndex: U,
3808
3823
  endDayIndex: L,
3809
3824
  isStart: P,
@@ -3826,13 +3841,13 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3826
3841
  ), Et = x.start.getTime(), gt = x.end.getTime() - 6e4, st = Math.max(Et, nt), j = Math.min(gt, q), pt = new Date(st), vt = new Date(j), Pt = pt.getHours() * 60 + pt.getMinutes(), Rt = vt.getHours() * 60 + vt.getMinutes(), $t = W + J.row * this.dayHeight;
3827
3842
  rt = $t + Pt / 1440 * this.dayHeight, ut = $t + Rt / 1440 * this.dayHeight;
3828
3843
  } else {
3829
- const nt = `${D}-${x.id}`;
3844
+ const nt = `${C}-${x.id}`;
3830
3845
  let q = y.get(nt);
3831
3846
  if (q === void 0) {
3832
3847
  for (q = 0; ; ) {
3833
3848
  let st = !0;
3834
3849
  for (let j = U; j <= L; j++) {
3835
- const pt = `${D}-${j}`;
3850
+ const pt = `${C}-${j}`;
3836
3851
  if (p.get(pt)?.has(q)) {
3837
3852
  st = !1;
3838
3853
  break;
@@ -3844,7 +3859,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3844
3859
  y.set(nt, q);
3845
3860
  }
3846
3861
  for (let st = U; st <= L; st++) {
3847
- const j = `${D}-${st}`;
3862
+ const j = `${C}-${st}`;
3848
3863
  let pt = p.get(j);
3849
3864
  pt || (pt = /* @__PURE__ */ new Set(), p.set(j, pt)), pt.add(q);
3850
3865
  }
@@ -3859,7 +3874,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3859
3874
  ut - rt
3860
3875
  );
3861
3876
  let X, Tt;
3862
- const Qt = `${D}-${x.id}-${U}`, kt = w.get(Qt);
3877
+ const Qt = `${C}-${x.id}-${U}`, kt = E.get(Qt);
3863
3878
  if (c && !K && kt && kt.totalColumns > 1) {
3864
3879
  const nt = s / kt.totalColumns;
3865
3880
  X = z + J.col * s + kt.column * nt, Tt = nt;
@@ -3983,27 +3998,27 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3983
3998
  "October",
3984
3999
  "November",
3985
4000
  "December"
3986
- ], A = [], O = /* @__PURE__ */ new Set();
4001
+ ], A = [], _ = /* @__PURE__ */ new Set();
3987
4002
  for (const b of r) {
3988
4003
  const x = b.days[0];
3989
4004
  if (!x) continue;
3990
- const T = x.getMonth(), D = x.getFullYear(), U = `${T}-${D}`;
3991
- if (!O.has(U)) {
3992
- O.add(U);
4005
+ const T = x.getMonth(), C = x.getFullYear(), U = `${T}-${C}`;
4006
+ if (!_.has(U)) {
4007
+ _.add(U);
3993
4008
  const L = S[T];
3994
4009
  L && A.push({
3995
4010
  monthKey: U,
3996
4011
  monthName: L,
3997
- year: D,
4012
+ year: C,
3998
4013
  yOffset: b.yOffset
3999
4014
  });
4000
4015
  }
4001
4016
  }
4002
4017
  for (let b = 0; b < A.length; b++) {
4003
- const x = A[b], T = A[b + 1], D = x.yOffset, U = T ? T.yOffset : this.totalHeight;
4018
+ const x = A[b], T = A[b + 1], C = x.yOffset, U = T ? T.yOffset : this.totalHeight;
4004
4019
  if (U < e) continue;
4005
- if (D > l) break;
4006
- const L = [12, 0, 0, 12], P = Math.max(0, e - D), B = U - D - 24, R = Math.min(P, B), K = D + R - e + 32;
4020
+ if (C > l) break;
4021
+ const L = [12, 0, 0, 12], P = Math.max(0, e - C), B = U - C - 24, R = Math.min(P, B), K = C + R - e + 32;
4007
4022
  t.save(), t.font = `bold 18px ${a}`, t.textAlign = "left", t.textBaseline = "top";
4008
4023
  const J = `${x.monthName} ${x.year}`, wt = t.measureText(J).width, ut = 64 + L[3] + 8, Q = K + L[0], X = 8, Tt = 8, Qt = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.7)";
4009
4024
  t.fillStyle = Qt, t.beginPath(), t.roundRect(
@@ -4173,40 +4188,40 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4173
4188
  for (let p = 0; p < 7; p++) {
4174
4189
  const y = g.days[p];
4175
4190
  if (!y) continue;
4176
- const { row: C, col: H } = this.getDayVisualPosition(p);
4191
+ const { row: M, col: H } = this.getDayVisualPosition(p);
4177
4192
  if (H < l || H > c) continue;
4178
- const M = g.yOffset + C * this.dayHeight, E = M + this.dayHeight;
4179
- if (s < M || i > E) continue;
4180
- const $ = Math.max(i, M), w = Math.min(s, E), S = $ - M, A = Math.floor(
4193
+ const $ = g.yOffset + M * this.dayHeight, w = $ + this.dayHeight;
4194
+ if (s < $ || i > w) continue;
4195
+ const D = Math.max(i, $), E = Math.min(s, w), S = D - $, A = Math.floor(
4181
4196
  S / this.dayHeight * 24 * 60
4182
- ), O = Math.floor(A / 60), b = A % 60, x = w - M, T = Math.ceil(
4197
+ ), _ = Math.floor(A / 60), b = A % 60, x = E - $, T = Math.ceil(
4183
4198
  x / this.dayHeight * 24 * 60
4184
- ), D = Math.floor(T / 60), U = T % 60, L = new Date(y);
4185
- L.setHours(O, b, 0, 0);
4199
+ ), C = Math.floor(T / 60), U = T % 60, L = new Date(y);
4200
+ L.setHours(_, b, 0, 0);
4186
4201
  const P = new Date(y);
4187
- P.setHours(D, U, 59, 999), h.push({ start: L, end: P });
4202
+ P.setHours(C, U, 59, 999), h.push({ start: L, end: P });
4188
4203
  }
4189
4204
  else
4190
4205
  for (const g of d)
4191
4206
  for (let p = 0; p < 7; p++) {
4192
4207
  const y = g.days[p];
4193
4208
  if (!y) continue;
4194
- const { row: C, col: H } = this.getDayVisualPosition(p);
4209
+ const { row: M, col: H } = this.getDayVisualPosition(p);
4195
4210
  if (H < l || H > c) continue;
4196
- const M = g.yOffset + C * this.dayHeight, E = M + this.dayHeight;
4197
- if (s < M || i > E) continue;
4198
- const $ = new Date(y);
4199
- $.setHours(0, 0, 0, 0);
4200
- const w = new Date(y);
4201
- w.setHours(23, 59, 59, 999), h.push({ start: $, end: w });
4211
+ const $ = g.yOffset + M * this.dayHeight, w = $ + this.dayHeight;
4212
+ if (s < $ || i > w) continue;
4213
+ const D = new Date(y);
4214
+ D.setHours(0, 0, 0, 0);
4215
+ const E = new Date(y);
4216
+ E.setHours(23, 59, 59, 999), h.push({ start: D, end: E });
4202
4217
  }
4203
4218
  const f = /* @__PURE__ */ new Set();
4204
4219
  for (const g of this.events) {
4205
4220
  if (g.isAllDay) continue;
4206
4221
  const p = g.start.getTime(), y = g.end.getTime();
4207
- for (const C of h) {
4208
- const H = C.start.getTime(), M = C.end.getTime();
4209
- if (!(y < H || p > M)) {
4222
+ for (const M of h) {
4223
+ const H = M.start.getTime(), $ = M.end.getTime();
4224
+ if (!(y < H || p > $)) {
4210
4225
  f.add(g);
4211
4226
  break;
4212
4227
  }
@@ -4233,7 +4248,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4233
4248
  ), this.renderCanvas();
4234
4249
  }
4235
4250
  renderEvents() {
4236
- return _``;
4251
+ return O``;
4237
4252
  }
4238
4253
  checkAndExtendRange() {
4239
4254
  if (this.isExtendingRange || this.filter) return;
@@ -4430,7 +4445,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4430
4445
  renderVirtualEvent(t, e, i, s = !0) {
4431
4446
  if (!this.overlayCanvas || !this.overlayCtx || !this.scrollContainer)
4432
4447
  return;
4433
- const r = this.overlayCtx, o = getComputedStyle(this).fontFamily, c = (this.scrollContainer.getBoundingClientRect().width - z - Yi) / this._columnsPerRow, d = (S, A, O) => {
4448
+ const r = this.overlayCtx, o = getComputedStyle(this).fontFamily, c = (this.scrollContainer.getBoundingClientRect().width - z - Yi) / this._columnsPerRow, d = (S, A, _) => {
4434
4449
  const b = this.weeks.find(
4435
4450
  (L) => L.days.some((P) => P.toDateString() === S.toDateString())
4436
4451
  );
@@ -4439,56 +4454,56 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4439
4454
  (L) => L.toDateString() === S.toDateString()
4440
4455
  );
4441
4456
  if (x < 0) return null;
4442
- const { row: T } = this.getDayVisualPosition(x), D = A * 60 + O;
4443
- return b.yOffset + T * this.dayHeight + D / 1440 * this.dayHeight - this.scrollTop;
4457
+ const { row: T } = this.getDayVisualPosition(x), C = A * 60 + _;
4458
+ return b.yOffset + T * this.dayHeight + C / 1440 * this.dayHeight - this.scrollTop;
4444
4459
  }, h = (S) => {
4445
4460
  const A = this.weeks.find(
4446
4461
  (x) => x.days.some((T) => T.toDateString() === S.toDateString())
4447
4462
  );
4448
4463
  if (!A) return null;
4449
- const O = A.days.findIndex(
4464
+ const _ = A.days.findIndex(
4450
4465
  (x) => x.toDateString() === S.toDateString()
4451
4466
  );
4452
- if (O < 0) return null;
4453
- const { col: b } = this.getDayVisualPosition(O);
4467
+ if (_ < 0) return null;
4468
+ const { col: b } = this.getDayVisualPosition(_);
4454
4469
  return b * c;
4455
- }, u = (S, A, O) => {
4456
- const b = S + 2, x = c - 4, T = Math.max(4, O - A);
4470
+ }, u = (S, A, _) => {
4471
+ const b = S + 2, x = c - 4, T = Math.max(4, _ - A);
4457
4472
  r.fillStyle = i.fill, r.beginPath(), r.roundRect(b, A, x, T, 4), r.fill(), r.strokeStyle = i.stroke, r.lineWidth = 1, r.setLineDash([6, 3]), r.stroke(), r.setLineDash([]);
4458
4473
  }, f = t.toDateString() === e.toDateString();
4459
4474
  if (f) {
4460
- const S = h(t), A = d(t, t.getHours(), t.getMinutes()), O = d(e, e.getHours(), e.getMinutes());
4461
- S != null && A != null && O != null && u(S, A, O);
4475
+ const S = h(t), A = d(t, t.getHours(), t.getMinutes()), _ = d(e, e.getHours(), e.getMinutes());
4476
+ S != null && A != null && _ != null && u(S, A, _);
4462
4477
  } else {
4463
4478
  const S = new Date(t);
4464
4479
  S.setHours(0, 0, 0, 0);
4465
4480
  const A = new Date(e);
4466
4481
  for (A.setHours(23, 59, 59, 999); S <= A; ) {
4467
- const O = h(S);
4468
- if (O != null) {
4482
+ const _ = h(S);
4483
+ if (_ != null) {
4469
4484
  const b = S.toDateString() === t.toDateString(), x = S.toDateString() === e.toDateString();
4470
- let T, D;
4471
- b ? (T = d(S, t.getHours(), t.getMinutes()), D = d(S, 23, 59)) : x ? (T = d(S, 0, 0), D = d(S, e.getHours(), e.getMinutes())) : (T = d(S, 0, 0), D = d(S, 23, 59)), T != null && D != null && u(O, T, D);
4485
+ let T, C;
4486
+ b ? (T = d(S, t.getHours(), t.getMinutes()), C = d(S, 23, 59)) : x ? (T = d(S, 0, 0), C = d(S, e.getHours(), e.getMinutes())) : (T = d(S, 0, 0), C = d(S, 23, 59)), T != null && C != null && u(_, T, C);
4472
4487
  }
4473
4488
  S.setDate(S.getDate() + 1);
4474
4489
  }
4475
4490
  }
4476
- const v = (S) => `${S.getHours().toString().padStart(2, "0")}:${S.getMinutes().toString().padStart(2, "0")}`, g = (S) => `${S.getDate()}.${S.getMonth() + 1}`, p = f ? `${v(t)} – ${v(e)}` : `${g(t)} ${v(t)} – ${g(e)} ${v(e)}`, H = Math.abs(e.getTime() - t.getTime()) / (1e3 * 60) < 15, M = h(t), E = h(e), $ = d(t, t.getHours(), t.getMinutes()), w = d(e, e.getHours(), e.getMinutes());
4477
- if (M != null && E != null && $ != null && w != null) {
4491
+ const v = (S) => `${S.getHours().toString().padStart(2, "0")}:${S.getMinutes().toString().padStart(2, "0")}`, g = (S) => `${S.getDate()}.${S.getMonth() + 1}`, p = f ? `${v(t)} – ${v(e)}` : `${g(t)} ${v(t)} – ${g(e)} ${v(e)}`, H = Math.abs(e.getTime() - t.getTime()) / (1e3 * 60) < 15, $ = h(t), w = h(e), D = d(t, t.getHours(), t.getMinutes()), E = d(e, e.getHours(), e.getMinutes());
4492
+ if ($ != null && w != null && D != null && E != null) {
4478
4493
  r.font = `600 11px ${o}`, r.fillStyle = i.text, r.textAlign = "left";
4479
- const S = s ? M : E;
4494
+ const S = s ? $ : w;
4480
4495
  if (H) {
4481
- const A = s ? $ : w, O = A + 6, b = A + 10, x = r.measureText(p).width, T = 6, D = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.8)";
4482
- r.fillStyle = D, r.beginPath(), r.roundRect(
4496
+ const A = s ? D : E, _ = A + 6, b = A + 10, x = r.measureText(p).width, T = 6, C = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.8)";
4497
+ r.fillStyle = C, r.beginPath(), r.roundRect(
4483
4498
  S + 4,
4484
- O,
4499
+ _,
4485
4500
  x + T * 2,
4486
4501
  16,
4487
4502
  4
4488
4503
  ), r.fill(), r.fillStyle = "white", r.textBaseline = "top", r.fillText(p, S + 4 + T, b);
4489
4504
  } else {
4490
4505
  r.textBaseline = "top";
4491
- const A = s ? $ + 4 : w - 18;
4506
+ const A = s ? D + 4 : E - 18;
4492
4507
  r.fillText(p, S + 8, A);
4493
4508
  }
4494
4509
  }
@@ -4510,19 +4525,19 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4510
4525
  if (!d) continue;
4511
4526
  const { row: h, col: u } = this.getDayVisualPosition(c), f = u * s, v = l.yOffset + h * this.dayHeight - r, g = v + this.dayHeight;
4512
4527
  if (c === 5 || c === 6) {
4513
- const E = getComputedStyle(this).getPropertyValue("--bg-weekend").trim() || "rgba(255, 255, 255, 0.03)";
4514
- t.fillStyle = E, t.fillRect(f, v, s, this.dayHeight);
4528
+ const w = getComputedStyle(this).getPropertyValue("--bg-weekend").trim() || "rgba(255, 255, 255, 0.03)";
4529
+ t.fillStyle = w, t.fillRect(f, v, s, this.dayHeight);
4515
4530
  }
4516
4531
  const p = this.dayHeight >= 300, y = /* @__PURE__ */ new Date();
4517
4532
  if (!p && N.isSameDay(d, y)) {
4518
- const E = getComputedStyle(this).getPropertyValue("--accent-current-time").trim() || "rgba(255, 0, 0, 0.8)";
4519
- t.strokeStyle = E, t.lineWidth = 1, t.strokeRect(f + 1, v + 1, s - 2, this.dayHeight - 2), t.lineWidth = 1;
4533
+ const w = getComputedStyle(this).getPropertyValue("--accent-current-time").trim() || "rgba(255, 0, 0, 0.8)";
4534
+ t.strokeStyle = w, t.lineWidth = 1, t.strokeRect(f + 1, v + 1, s - 2, this.dayHeight - 2), t.lineWidth = 1;
4520
4535
  }
4521
- const C = 12, M = Math.min(
4522
- g - C - 8,
4523
- i - C - 64
4536
+ const M = 12, $ = Math.min(
4537
+ g - M - 8,
4538
+ i - M - 64
4524
4539
  );
4525
- v < i && g > 0 && M > v && (t.fillStyle = a, t.fillText(d.getDate().toString(), f + s - 12, M));
4540
+ v < i && g > 0 && $ > v && (t.fillStyle = a, t.fillText(d.getDate().toString(), f + s - 12, $));
4526
4541
  }
4527
4542
  }
4528
4543
  }
@@ -4538,25 +4553,25 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4538
4553
  const p = Math.min(h, g - d - 2);
4539
4554
  if (!(p < 0))
4540
4555
  for (let y = 0; y < this._columnsPerRow; y++) {
4541
- const C = f * this._columnsPerRow + y;
4542
- if (C >= 7) continue;
4543
- const H = o[C];
4556
+ const M = f * this._columnsPerRow + y;
4557
+ if (M >= 7) continue;
4558
+ const H = o[M];
4544
4559
  if (!H) continue;
4545
- const M = z + y * e + e / 2, E = t.measureText(H).width, $ = 6, w = 2;
4560
+ const $ = z + y * e + e / 2, w = t.measureText(H).width, D = 6, E = 2;
4546
4561
  t.fillStyle = c, t.beginPath(), t.roundRect(
4547
- M - E / 2 - $,
4562
+ $ - w / 2 - D,
4548
4563
  p,
4549
- E + $ * 2,
4564
+ w + D * 2,
4550
4565
  d,
4551
4566
  4
4552
- ), t.fill(), t.fillStyle = l, t.fillText(H, M, p + w + 1);
4567
+ ), t.fill(), t.fillStyle = l, t.fillText(H, $, p + E + 1);
4553
4568
  }
4554
4569
  }
4555
4570
  }
4556
4571
  renderSelection() {
4557
- if (!this.selection) return _``;
4572
+ if (!this.selection) return O``;
4558
4573
  const t = Math.min(this.selection.startX, this.selection.endX), e = Math.max(this.selection.startX, this.selection.endX), i = Math.min(this.selection.startY, this.selection.endY), s = Math.max(this.selection.startY, this.selection.endY);
4559
- return _`
4574
+ return O`
4560
4575
  <div
4561
4576
  class="selection"
4562
4577
  style="
@@ -4582,20 +4597,20 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4582
4597
  for (let p = v; p <= g; p++) {
4583
4598
  const y = this.weeks[p];
4584
4599
  if (!y || y.height === 0) continue;
4585
- const C = y.days[0], H = y.days[6];
4586
- if (!C || !H) continue;
4587
- const M = C.getTime(), E = H.getTime() + a - 1, $ = Math.max(d, M), w = Math.min(h, E), S = Math.floor(
4588
- $ % a / l
4600
+ const M = y.days[0], H = y.days[6];
4601
+ if (!M || !H) continue;
4602
+ const $ = M.getTime(), w = H.getTime() + a - 1, D = Math.max(d, $), E = Math.min(h, w), S = Math.floor(
4603
+ D % a / l
4589
4604
  ), A = Math.floor(
4590
- w % a / l
4591
- ), O = y.yOffset / this.totalHeight * e + S / 1440 * (y.height / this.totalHeight * e), b = y.yOffset / this.totalHeight * e + A / 1440 * (y.height / this.totalHeight * e);
4592
- i.globalAlpha = c.readOnly ? 0.333 * 0.5 : 0.333, i.fillStyle = c.color || "#888", i.fillRect(2, O, t - 4, Math.max(b - O, 2));
4605
+ E % a / l
4606
+ ), _ = y.yOffset / this.totalHeight * e + S / 1440 * (y.height / this.totalHeight * e), b = y.yOffset / this.totalHeight * e + A / 1440 * (y.height / this.totalHeight * e);
4607
+ i.globalAlpha = c.readOnly ? 0.333 * 0.5 : 0.333, i.fillStyle = c.color || "#888", i.fillRect(2, _, t - 4, Math.max(b - _, 2));
4593
4608
  }
4594
4609
  }
4595
4610
  }
4596
4611
  renderMinimap() {
4597
- if (this.totalHeight === 0 || this.weeks.length === 0) return _``;
4598
- if (!this.minimapBufferCanvas) return _``;
4612
+ if (this.totalHeight === 0 || this.weeks.length === 0) return O``;
4613
+ if (!this.minimapBufferCanvas) return O``;
4599
4614
  const t = 32, e = 2e3, i = this.viewportHeight / this.totalHeight, s = this.scrollTop / this.totalHeight * e, r = Math.max(i * e, 4), o = this.minimapCanvas, a = o.getContext("2d");
4600
4615
  if (o.width = t, o.height = e, !a) throw new Error("Failed to get 2d context");
4601
4616
  a.drawImage(this.minimapBufferCanvas, 0, 0), getComputedStyle(this).getPropertyValue("--grid-color").trim();
@@ -4737,7 +4752,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4737
4752
  }
4738
4753
  renderNotificationsList(t) {
4739
4754
  return t.reminders?.length ? t.reminders.map(
4740
- (e) => _`
4755
+ (e) => O`
4741
4756
  <div class="notification-item">
4742
4757
  <select
4743
4758
  class="notification-select"
@@ -4748,7 +4763,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4748
4763
  }}
4749
4764
  >
4750
4765
  ${As.map(
4751
- (i) => _`<option value="${i.value}" ?selected=${i.value === e.triggerOffset}>${i.label}</option>`
4766
+ (i) => O`<option value="${i.value}" ?selected=${i.value === e.triggerOffset}>${i.label}</option>`
4752
4767
  )}
4753
4768
  </select>
4754
4769
  <button
@@ -4757,7 +4772,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4757
4772
  >×</button>
4758
4773
  </div>
4759
4774
  `
4760
- ) : _`<div class="notification-empty-state">No notifications set</div>`;
4775
+ ) : O`<div class="notification-empty-state">No notifications set</div>`;
4761
4776
  }
4762
4777
  addNotification(t) {
4763
4778
  const e = {
@@ -4815,64 +4830,64 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4815
4830
  renderEventDetail() {
4816
4831
  if (!this.selectedEventForDetail || !this.selectedEventRect)
4817
4832
  return null;
4818
- const t = this.selectedEventForDetail, e = (E) => new Intl.DateTimeFormat(this.locale, {
4833
+ const t = this.selectedEventForDetail, e = (w) => new Intl.DateTimeFormat(this.locale, {
4819
4834
  weekday: "short",
4820
4835
  year: "numeric",
4821
4836
  month: "short",
4822
4837
  day: "numeric"
4823
- }).format(E), i = (E) => new Intl.DateTimeFormat(this.locale, {
4838
+ }).format(w), i = (w) => new Intl.DateTimeFormat(this.locale, {
4824
4839
  hour: "numeric",
4825
4840
  minute: "2-digit"
4826
- }).format(E), s = N.isSameDay(t.start, t.end), r = 320, o = 550, a = 8, l = this.scrollContainer?.clientWidth || 800, c = this.scrollContainer?.clientHeight || 600, d = this.selectedEventRect.x + this.selectedEventRect.width + a, h = this.selectedEventRect.x - r - a, u = d + r <= l ? d : h, f = z + a, v = l - r - a, g = Math.max(f, Math.min(v, u)), p = this.selectedEventRect.y - this.scrollTop, y = a, C = c - o - a, H = Math.max(y, Math.min(C, p)), M = `left: ${g}px; top: ${H}px; --calendar-color: ${t.color || "#888888"};`;
4827
- return _`
4828
- <div class="event-detail-overlay" style="${M}">
4841
+ }).format(w), s = N.isSameDay(t.start, t.end), r = 320, o = 550, a = 8, l = this.scrollContainer?.clientWidth || 800, c = this.scrollContainer?.clientHeight || 600, d = this.selectedEventRect.x + this.selectedEventRect.width + a, h = this.selectedEventRect.x - r - a, u = d + r <= l ? d : h, f = z + a, v = l - r - a, g = Math.max(f, Math.min(v, u)), p = this.selectedEventRect.y - this.scrollTop, y = a, M = c - o - a, H = Math.max(y, Math.min(M, p)), $ = `left: ${g}px; top: ${H}px; --calendar-color: ${t.color || "#888888"};`;
4842
+ return O`
4843
+ <div class="event-detail-overlay" style="${$}">
4829
4844
  <div class="event-detail-content">
4830
4845
  <div class="event-detail-header">
4831
4846
  <div class="event-detail-header-content">
4832
- ${t.calendar ? _`
4847
+ ${t.calendar ? O`
4833
4848
  <div class="event-detail-section event-detail-calendar">
4834
4849
  <div class="event-detail-value">${t.calendar}</div>
4835
4850
  </div>
4836
4851
  ` : null}
4837
- ${t.readOnly || t.organizer != null && !this.currentUserEmails.has(t.organizer.email) ? _`
4838
- <h3 class="event-detail-title">${t.rrule ? _`<span style="opacity: 0.6">⟳</span> ` : ""}${t.title}</h3>
4839
- ` : _`
4852
+ ${t.readOnly || t.organizer != null && !this.currentUserEmails.has(t.organizer.email) ? O`
4853
+ <h3 class="event-detail-title">${t.rrule ? O`<span style="opacity: 0.6">⟳</span> ` : ""}${t.title}</h3>
4854
+ ` : O`
4840
4855
  <textarea
4841
4856
  class="event-detail-title-input"
4842
4857
  .value=${t.title}
4843
4858
  placeholder="Event title"
4844
- @input=${(E) => {
4845
- const w = E.target.value;
4846
- w !== t.title && (this.updateEventTimeout && clearTimeout(this.updateEventTimeout), this.updateEventTimeout = setTimeout(() => {
4859
+ @input=${(w) => {
4860
+ const E = w.target.value;
4861
+ E !== t.title && (this.updateEventTimeout && clearTimeout(this.updateEventTimeout), this.updateEventTimeout = setTimeout(() => {
4847
4862
  this.dispatchEvent(
4848
4863
  new CustomEvent("update-event", {
4849
- detail: { event: t, updates: { title: w } },
4864
+ detail: { event: t, updates: { title: E } },
4850
4865
  bubbles: !0,
4851
4866
  composed: !0
4852
4867
  })
4853
4868
  ), this.updateEventTimeout = null;
4854
4869
  }, 500));
4855
4870
  }}
4856
- @keydown=${(E) => {
4857
- if (E.key === "Enter") {
4871
+ @keydown=${(w) => {
4872
+ if (w.key === "Enter") {
4858
4873
  this.updateEventTimeout && (clearTimeout(this.updateEventTimeout), this.updateEventTimeout = null);
4859
- const $ = E.target, w = $.value;
4860
- w !== t.title && this.dispatchEvent(
4874
+ const D = w.target, E = D.value;
4875
+ E !== t.title && this.dispatchEvent(
4861
4876
  new CustomEvent("update-event", {
4862
- detail: { event: t, updates: { title: w } },
4877
+ detail: { event: t, updates: { title: E } },
4863
4878
  bubbles: !0,
4864
4879
  composed: !0
4865
4880
  })
4866
- ), $.blur();
4881
+ ), D.blur();
4867
4882
  }
4868
4883
  }}
4869
4884
  />
4870
4885
  `}
4871
4886
  <div class="event-detail-time">
4872
- ${s ? _`
4887
+ ${s ? O`
4873
4888
  <div>${e(t.start)}</div>
4874
4889
  <div>${i(t.start)} – ${i(t.end)}</div>
4875
- ` : _`
4890
+ ` : O`
4876
4891
  <div>${e(t.start)}, ${i(t.start)}</div>
4877
4892
  <div>${e(t.end)}, ${i(t.end)}</div>
4878
4893
  `}
@@ -4887,14 +4902,20 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4887
4902
  </div>
4888
4903
 
4889
4904
  <div class="event-detail-body">
4890
- ${t.location ? _`
4905
+ ${(() => {
4906
+ const w = t.description?.match(/https:\/\/teams\.microsoft\.com\/[^\s<>"]+/), D = w ? w[0] : null;
4907
+ return !t.location && !D ? null : O`
4891
4908
  <div class="event-detail-section">
4892
4909
  <div class="event-detail-label">Location</div>
4893
- <div class="event-detail-value">${t.location}</div>
4910
+ <div class="event-detail-value">
4911
+ ${t.location ? O`<div>${t.location}</div>` : null}
4912
+ ${D ? O`<a href="${D}" class="event-detail-link" target="_blank" rel="noopener">Join Microsoft Teams Meeting</a>` : null}
4913
+ </div>
4894
4914
  </div>
4895
- ` : null}
4915
+ `;
4916
+ })()}
4896
4917
 
4897
- ${t.url ? _`
4918
+ ${t.url ? O`
4898
4919
  <div class="event-detail-section">
4899
4920
  <div class="event-detail-label">URL</div>
4900
4921
  <div class="event-detail-value">
@@ -4905,7 +4926,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4905
4926
  </div>
4906
4927
  ` : null}
4907
4928
 
4908
- ${t.organizer ? _`
4929
+ ${t.organizer ? O`
4909
4930
  <div class="event-detail-section">
4910
4931
  <div class="event-detail-label">Organizer</div>
4911
4932
  <div class="event-detail-value">
@@ -4916,17 +4937,17 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4916
4937
 
4917
4938
  ${(() => {
4918
4939
  if (!t.attendees || t.attendees.length === 0) return null;
4919
- const E = this.findCurrentUserAttendee(t), $ = E ? t.attendees.filter((w) => w !== E) : t.attendees;
4920
- return $.length > 0 ? _`
4940
+ const w = this.findCurrentUserAttendee(t), D = w ? t.attendees.filter((E) => E !== w) : t.attendees;
4941
+ return D.length > 0 ? O`
4921
4942
  <div class="event-detail-section">
4922
- <div class="event-detail-label">Participants (${$.length})</div>
4943
+ <div class="event-detail-label">Participants (${D.length})</div>
4923
4944
  <div class="event-detail-value">
4924
- ${$.map(
4925
- (w) => _`
4945
+ ${D.map(
4946
+ (E) => O`
4926
4947
  <div style="margin-bottom: 4px">
4927
- <span title=${w.email}>${w.name || w.email}</span>
4928
- ${w.status ? _`<span style="opacity: 0.7"> - ${this.formatAttendeeStatus(
4929
- w.status
4948
+ <span title=${E.email}>${E.name || E.email}</span>
4949
+ ${E.status ? O`<span style="opacity: 0.7"> - ${this.formatAttendeeStatus(
4950
+ E.status
4930
4951
  )}</span>` : null}
4931
4952
  </div>
4932
4953
  `
@@ -4936,7 +4957,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4936
4957
  ` : null;
4937
4958
  })()}
4938
4959
 
4939
- ${t.readOnly ? null : _`
4960
+ ${t.readOnly ? null : O`
4940
4961
  <div class="event-detail-section">
4941
4962
  <div class="event-detail-label">
4942
4963
  <span>Notifications</span>
@@ -4951,7 +4972,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4951
4972
  </div>
4952
4973
  `}
4953
4974
 
4954
- ${t.readOnly || t.organizer != null && !this.currentUserEmails.has(t.organizer.email) ? t.description ? _`
4975
+ ${t.readOnly || t.organizer != null && !this.currentUserEmails.has(t.organizer.email) ? t.description ? O`
4955
4976
  <div class="event-detail-section">
4956
4977
  <div class="event-detail-label">Description</div>
4957
4978
  <div class="event-detail-description ${this.isDescriptionExpanded ? "expanded" : ""}">
@@ -4962,7 +4983,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4962
4983
  )}</pre>
4963
4984
  </div>
4964
4985
  ${t.description.length > 300 || t.description.split(`
4965
- `).length > 8 ? _`
4986
+ `).length > 8 ? O`
4966
4987
  <button
4967
4988
  class="description-see-more"
4968
4989
  @click=${() => {
@@ -4973,7 +4994,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4973
4994
  </button>
4974
4995
  ` : null}
4975
4996
  </div>
4976
- ` : null : _`
4997
+ ` : null : O`
4977
4998
  <div class="event-detail-section">
4978
4999
  <div class="event-detail-label">Description</div>
4979
5000
  <textarea
@@ -4981,14 +5002,14 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4981
5002
  .value=${t.description ?? ""}
4982
5003
  placeholder="Add description..."
4983
5004
  rows="3"
4984
- @input=${(E) => {
4985
- const w = E.target.value;
5005
+ @input=${(w) => {
5006
+ const E = w.target.value;
4986
5007
  this.updateEventTimeout && clearTimeout(this.updateEventTimeout), this.updateEventTimeout = setTimeout(() => {
4987
5008
  this.dispatchEvent(
4988
5009
  new CustomEvent("update-event", {
4989
5010
  detail: {
4990
5011
  event: t,
4991
- updates: { description: w }
5012
+ updates: { description: E }
4992
5013
  },
4993
5014
  bubbles: !0,
4994
5015
  composed: !0
@@ -4996,13 +5017,13 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4996
5017
  ), this.updateEventTimeout = null;
4997
5018
  }, 500);
4998
5019
  }}
4999
- @blur=${(E) => {
5000
- const w = E.target.value;
5001
- this.updateEventTimeout && (clearTimeout(this.updateEventTimeout), this.updateEventTimeout = null), w !== (t.description ?? "") && this.dispatchEvent(
5020
+ @blur=${(w) => {
5021
+ const E = w.target.value;
5022
+ this.updateEventTimeout && (clearTimeout(this.updateEventTimeout), this.updateEventTimeout = null), E !== (t.description ?? "") && this.dispatchEvent(
5002
5023
  new CustomEvent("update-event", {
5003
5024
  detail: {
5004
5025
  event: t,
5005
- updates: { description: w }
5026
+ updates: { description: E }
5006
5027
  },
5007
5028
  bubbles: !0,
5008
5029
  composed: !0
@@ -5016,29 +5037,29 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
5016
5037
 
5017
5038
  ${(() => {
5018
5039
  if (!t.attendees || t.attendees.length === 0) return null;
5019
- const E = this.findCurrentUserAttendee(t);
5020
- return !E || t.readOnly || t.organizer?.email === E.email ? null : _`
5040
+ const w = this.findCurrentUserAttendee(t);
5041
+ return !w || t.readOnly || t.organizer?.email === w.email ? null : O`
5021
5042
  <div class="event-detail-footer">
5022
5043
  <div class="invite-response-buttons">
5023
5044
  <button
5024
- class="invite-response-button ${E.status === "ACCEPTED" ? "active" : ""}"
5025
- @click=${() => this.updateAttendeeStatus(t, E, "ACCEPTED")}
5045
+ class="invite-response-button ${w.status === "ACCEPTED" ? "active" : ""}"
5046
+ @click=${() => this.updateAttendeeStatus(t, w, "ACCEPTED")}
5026
5047
  >
5027
5048
  Accept
5028
5049
  </button>
5029
5050
  <button
5030
- class="invite-response-button ${E.status === "TENTATIVE" ? "active" : ""}"
5051
+ class="invite-response-button ${w.status === "TENTATIVE" ? "active" : ""}"
5031
5052
  @click=${() => this.updateAttendeeStatus(
5032
5053
  t,
5033
- E,
5054
+ w,
5034
5055
  "TENTATIVE"
5035
5056
  )}
5036
5057
  >
5037
5058
  Maybe
5038
5059
  </button>
5039
5060
  <button
5040
- class="invite-response-button ${E.status === "DECLINED" ? "active" : ""}"
5041
- @click=${() => this.updateAttendeeStatus(t, E, "DECLINED")}
5061
+ class="invite-response-button ${w.status === "DECLINED" ? "active" : ""}"
5062
+ @click=${() => this.updateAttendeeStatus(t, w, "DECLINED")}
5042
5063
  >
5043
5064
  Decline
5044
5065
  </button>
@@ -5051,62 +5072,10 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
5051
5072
  `;
5052
5073
  }
5053
5074
  render() {
5054
- return _`
5075
+ return O`
5055
5076
  <div class="container ${this.isDraggingFile ? "dragging-file" : ""}">
5056
- <div class="toolbar">
5057
- <div class="toolbar-left">
5058
- <slot name="toolbar-center"></slot>
5059
-
5060
- <button class="toolbar-button" title="Month" @click=${this.scrollToMonth}>
5061
- Month
5062
- </button>
5063
- <button class="toolbar-button" title="Today" @click=${this.scrollToToday}>
5064
- Today
5065
- </button>
5066
- <button ?disabled=${this.historyStack.length === 0 || this.historyIndex >= this.historyStack.length - 1} class="toolbar-button" title="Back" @click=${this.goBack}>
5067
-
5068
- </button>
5069
- <button ?disabled=${this.historyStack.length === 0 || this.historyIndex === 0} class="toolbar-button" title="Forward" @click=${this.goForward}>
5070
-
5071
- </button>
5072
- <div class="toolbar-zoom">
5073
- <input
5074
- type="range"
5075
- class="toolbar-zoom-slider"
5076
- min="${Nt}"
5077
- max="${me}"
5078
- .value=${this.dayHeight}
5079
- @input=${this.onZoomSliderChange}
5080
- title="Adjust zoom level"
5081
- />
5082
- </div>
5083
- </div>
5084
-
5085
- <div class="toolbar-right">
5086
- <!--<select
5087
- class="theme-selector"
5088
- .value=${this.currentTheme}
5089
- @change=${this.onThemeChange}
5090
- title="Select theme"
5091
- >
5092
- ${Ws.map(
5093
- (t) => _`<option value="${t.name}">${t.label}</option>`
5094
- )}
5095
- </select>-->
5096
- <div class="toolbar-search">
5097
- <span class="toolbar-search-icon">🔍</span>
5098
- <input
5099
- class="toolbar-search-input"
5100
- type="text"
5101
- placeholder="Filter events..."
5102
- .value=${this.filter}
5103
- @input=${this.onFilterInput}
5104
- />
5105
- </div>
5106
- </div>
5107
- </div>
5108
-
5109
5077
  <div class="body">
5078
+ <slot name="sidebar"></slot>
5110
5079
  <div class="calendar-area">
5111
5080
  <div class="canvas-layer">
5112
5081
  <canvas></canvas>
@@ -5126,6 +5095,57 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
5126
5095
  ${this.minimapCanvas}
5127
5096
  ${this.renderEventDetail()}
5128
5097
  ${this.renderNotificationPopover()}
5098
+
5099
+ <div class="toolbar">
5100
+ <div class="toolbar-left">
5101
+ <button class="toolbar-button" title="Month" @click=${this.scrollToMonth}>
5102
+ Month
5103
+ </button>
5104
+ <button class="toolbar-button" title="Today" @click=${this.scrollToToday}>
5105
+ Today
5106
+ </button>
5107
+ <button ?disabled=${this.historyStack.length === 0 || this.historyIndex >= this.historyStack.length - 1} class="toolbar-button" title="Back" @click=${this.goBack}>
5108
+
5109
+ </button>
5110
+ <button ?disabled=${this.historyStack.length === 0 || this.historyIndex === 0} class="toolbar-button" title="Forward" @click=${this.goForward}>
5111
+
5112
+ </button>
5113
+ <div class="toolbar-zoom">
5114
+ <input
5115
+ type="range"
5116
+ class="toolbar-zoom-slider"
5117
+ min="${Nt}"
5118
+ max="${me}"
5119
+ .value=${this.dayHeight}
5120
+ @input=${this.onZoomSliderChange}
5121
+ title="Adjust zoom level"
5122
+ />
5123
+ </div>
5124
+ </div>
5125
+
5126
+ <div class="toolbar-right">
5127
+ <!--<select
5128
+ class="theme-selector"
5129
+ .value=${this.currentTheme}
5130
+ @change=${this.onThemeChange}
5131
+ title="Select theme"
5132
+ >
5133
+ ${Ws.map(
5134
+ (t) => O`<option value="${t.name}">${t.label}</option>`
5135
+ )}
5136
+ </select>-->
5137
+ <div class="toolbar-search">
5138
+ <span class="toolbar-search-icon">🔍</span>
5139
+ <input
5140
+ class="toolbar-search-input"
5141
+ type="text"
5142
+ placeholder="Filter events..."
5143
+ .value=${this.filter}
5144
+ @input=${this.onFilterInput}
5145
+ />
5146
+ </div>
5147
+ </div>
5148
+ </div>
5129
5149
  </div>
5130
5150
  </div>
5131
5151
  </div>
@@ -5142,7 +5162,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
5142
5162
  hour: "numeric",
5143
5163
  minute: "2-digit"
5144
5164
  });
5145
- return _`
5165
+ return O`
5146
5166
  <div class="notification-popover-overlay" @click=${this.onNotificationPopoverToggle}></div>
5147
5167
  <div class="notification-popover">
5148
5168
  <div class="notification-popover-header">
@@ -5150,8 +5170,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
5150
5170
  <button class="notification-popover-close" @click=${this.onNotificationPopoverToggle}>×</button>
5151
5171
  </div>
5152
5172
  <div class="notification-popover-content">
5153
- ${this.scheduledNotifications.length === 0 ? _`<div class="notification-popover-empty">No scheduled notifications</div>` : this.scheduledNotifications.map(
5154
- (i) => _`
5173
+ ${this.scheduledNotifications.length === 0 ? O`<div class="notification-popover-empty">No scheduled notifications</div>` : this.scheduledNotifications.map(
5174
+ (i) => O`
5155
5175
  <div class="notification-popover-item">
5156
5176
  <div class="notification-popover-item-header">
5157
5177
  <div class="notification-popover-item-title">${i.eventTitle}</div>
@@ -5163,7 +5183,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
5163
5183
  <div class="notification-popover-item-event-time">📅 ${e(
5164
5184
  i.eventStart
5165
5185
  )}</div>
5166
- ${i.eventLocation ? _`<div class="notification-popover-item-location">📍 ${i.eventLocation}</div>` : null}
5186
+ ${i.eventLocation ? O`<div class="notification-popover-item-location">📍 ${i.eventLocation}</div>` : null}
5167
5187
  </div>
5168
5188
  </div>
5169
5189
  `
@@ -5201,31 +5221,24 @@ ni.styles = zi`
5201
5221
  align-items: center;
5202
5222
  justify-content: space-between;
5203
5223
  padding: 8px 10px;
5204
- background: var(--bg-secondary, rgba(36, 36, 38, 0.5));
5205
- border: 1px solid var(--grid-color, rgba(255, 255, 255, 0.1));
5224
+ background: var(--bg-primary, rgb(30, 30, 30));
5206
5225
  flex-shrink: 0;
5207
5226
  gap: 16px;
5208
5227
  position: absolute;
5209
- bottom: .25rem;
5210
- left: .5rem;
5211
- right: 0.5rem;
5228
+ bottom: 0;
5229
+ left: 0;
5230
+ right: 0;
5212
5231
  z-index: 100;
5213
- border-radius: var(--border-radius-lg, 8px);
5214
- overflow: hidden;
5215
-
5216
- --backdrop-padding: 30px;
5217
- --backdrop-size: 42px;
5218
5232
  }
5219
5233
 
5220
5234
  .toolbar::before {
5221
5235
  content: '';
5222
- width: 100%;
5223
5236
  position: absolute;
5224
- top: calc(var(--backdrop-padding) * -1);
5225
5237
  left: 0;
5226
- bottom: calc(var(--backdrop-padding) * -1);
5227
- backdrop-filter: blur(var(--backdrop-size));
5228
- z-index: -1;
5238
+ right: 0;
5239
+ bottom: 100%;
5240
+ height: 48px;
5241
+ background: linear-gradient(to bottom, transparent, var(--bg-primary, rgb(30, 30, 30)));
5229
5242
  pointer-events: none;
5230
5243
  }
5231
5244
 
@@ -5606,13 +5619,14 @@ ni.styles = zi`
5606
5619
  flex-direction: column;
5607
5620
  min-width: 0;
5608
5621
  max-height: 550px;
5622
+ border-radius: var(--border-radius-lg, 8px);
5623
+ overflow: hidden;
5609
5624
  }
5610
5625
 
5611
5626
  .event-detail-footer {
5612
5627
  border-top: 1px solid var(--grid-color, rgba(255, 255, 255, 0.1));
5613
5628
  padding: 12px 16px;
5614
5629
  background: var(--bg-elevated, rgba(20, 20, 20, 0.95));
5615
- border-radius: 0 0 var(--border-radius-lg, 8px) 0;
5616
5630
  }
5617
5631
 
5618
5632
  .invite-response-buttons {