@forcecalendar/interface 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  var V = Object.defineProperty;
2
- var P = (p, e, t) => e in p ? V(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t;
3
- var I = (p, e, t) => P(p, typeof e != "symbol" ? e + "" : e, t);
4
- class $ extends HTMLElement {
2
+ var W = (u, e, t) => e in u ? V(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
3
+ var $ = (u, e, t) => W(u, typeof e != "symbol" ? e + "" : e, t);
4
+ class O extends HTMLElement {
5
5
  constructor() {
6
6
  super(), this.attachShadow({ mode: "open" }), this._listeners = [], this._state = null, this._props = /* @__PURE__ */ new Map(), this._initialized = !1;
7
7
  }
@@ -108,7 +108,7 @@ class $ extends HTMLElement {
108
108
  this.setProp(e, s), this._initialized && this.render();
109
109
  }
110
110
  }
111
- class U {
111
+ class j {
112
112
  constructor() {
113
113
  this.timezones = {
114
114
  // UTC
@@ -673,25 +673,25 @@ class U {
673
673
  };
674
674
  }
675
675
  }
676
- let E = null;
677
- class S {
676
+ let k = null;
677
+ class C {
678
678
  /**
679
679
  * Get the shared singleton instance of TimezoneManager
680
680
  * This should be used instead of creating new instances to avoid memory bloat
681
681
  * @returns {TimezoneManager} The shared instance
682
682
  */
683
683
  static getInstance() {
684
- return E || (E = new S()), E;
684
+ return k || (k = new C()), k;
685
685
  }
686
686
  /**
687
687
  * Reset the singleton instance (useful for testing)
688
688
  * @private
689
689
  */
690
690
  static _resetInstance() {
691
- E && E.clearCache(), E = null;
691
+ k && k.clearCache(), k = null;
692
692
  }
693
693
  constructor() {
694
- this.database = new U(), this.offsetCache = /* @__PURE__ */ new Map(), this.dstCache = /* @__PURE__ */ new Map(), this.maxCacheSize = 1e3, this.cacheHits = 0, this.cacheMisses = 0;
694
+ this.database = new j(), this.offsetCache = /* @__PURE__ */ new Map(), this.dstCache = /* @__PURE__ */ new Map(), this.maxCacheSize = 1e3, this.cacheHits = 0, this.cacheMisses = 0;
695
695
  }
696
696
  /**
697
697
  * Convert date from one timezone to another
@@ -976,7 +976,7 @@ class S {
976
976
  }
977
977
  }
978
978
  }
979
- class M {
979
+ class w {
980
980
  /**
981
981
  * Normalize event data
982
982
  * @param {import('../../types.js').EventData} data - Raw event data
@@ -1039,27 +1039,27 @@ class M {
1039
1039
  color: o = null,
1040
1040
  backgroundColor: c = null,
1041
1041
  borderColor: l = null,
1042
- textColor: d = null,
1043
- recurring: h = !1,
1044
- recurrenceRule: g = null,
1045
- timeZone: w = null,
1046
- endTimeZone: f = null,
1047
- status: k = "confirmed",
1048
- visibility: b = "public",
1042
+ textColor: h = null,
1043
+ recurring: d = !1,
1044
+ recurrenceRule: p = null,
1045
+ timeZone: b = null,
1046
+ endTimeZone: v = null,
1047
+ status: M = "confirmed",
1048
+ visibility: D = "public",
1049
1049
  organizer: T = null,
1050
1050
  attendees: A = [],
1051
- reminders: _ = [],
1052
- category: L,
1051
+ reminders: I = [],
1052
+ category: R,
1053
1053
  // Support singular category (no default)
1054
- categories: F,
1054
+ categories: B,
1055
1055
  // Support plural categories (no default)
1056
- attachments: O = [],
1057
- conferenceData: H = null,
1058
- metadata: R = {},
1059
- ...B
1056
+ attachments: U = [],
1057
+ conferenceData: Y = null,
1058
+ metadata: N = {},
1059
+ ...P
1060
1060
  // Capture any extra properties
1061
1061
  }) {
1062
- const m = M.normalize({
1062
+ const g = w.normalize({
1063
1063
  id: e,
1064
1064
  title: t,
1065
1065
  start: s,
@@ -1070,27 +1070,27 @@ class M {
1070
1070
  color: o,
1071
1071
  backgroundColor: c,
1072
1072
  borderColor: l,
1073
- textColor: d,
1074
- recurring: h,
1075
- recurrenceRule: g,
1076
- timeZone: w,
1077
- endTimeZone: f,
1078
- status: k,
1079
- visibility: b,
1073
+ textColor: h,
1074
+ recurring: d,
1075
+ recurrenceRule: p,
1076
+ timeZone: b,
1077
+ endTimeZone: v,
1078
+ status: M,
1079
+ visibility: D,
1080
1080
  organizer: T,
1081
1081
  attendees: A,
1082
- reminders: _,
1083
- category: L,
1082
+ reminders: I,
1083
+ category: R,
1084
1084
  // Pass category to normalize
1085
- categories: F,
1085
+ categories: B,
1086
1086
  // Pass categories to normalize
1087
- attachments: O,
1088
- conferenceData: H,
1089
- metadata: R,
1090
- ...B
1087
+ attachments: U,
1088
+ conferenceData: Y,
1089
+ metadata: N,
1090
+ ...P
1091
1091
  // Pass any extra properties
1092
1092
  });
1093
- M.validate(m), this.id = m.id, this.title = m.title, this._timezoneManager = S.getInstance(), this.timeZone = m.timeZone || this._timezoneManager.getSystemTimezone(), this.endTimeZone = m.endTimeZone || this.timeZone, this.start = m.start, this.end = m.end, this.startUTC = this._timezoneManager.toUTC(this.start, this.timeZone), this.endUTC = this._timezoneManager.toUTC(this.end, this.endTimeZone), this.allDay = m.allDay, this.description = m.description, this.location = m.location, this.color = m.color, this.backgroundColor = m.backgroundColor, this.borderColor = m.borderColor, this.textColor = m.textColor, this.recurring = m.recurring, this.recurrenceRule = m.recurrenceRule, this._originalTimeZone = m.timeZone || null, this.status = m.status, this.visibility = m.visibility, this.organizer = m.organizer, this.attendees = [...m.attendees], this.reminders = [...m.reminders], this.categories = m.categories ? [...m.categories] : [], this.attachments = [...m.attachments], this.conferenceData = m.conferenceData, this.metadata = { ...m.metadata }, this._cache = {}, this._validateAttendees(), this._validateReminders();
1093
+ w.validate(g), this.id = g.id, this.title = g.title, this._timezoneManager = C.getInstance(), this.timeZone = g.timeZone || this._timezoneManager.getSystemTimezone(), this.endTimeZone = g.endTimeZone || this.timeZone, this.start = g.start, this.end = g.end, this.startUTC = this._timezoneManager.toUTC(this.start, this.timeZone), this.endUTC = this._timezoneManager.toUTC(this.end, this.endTimeZone), this.allDay = g.allDay, this.description = g.description, this.location = g.location, this.color = g.color, this.backgroundColor = g.backgroundColor, this.borderColor = g.borderColor, this.textColor = g.textColor, this.recurring = g.recurring, this.recurrenceRule = g.recurrenceRule, this._originalTimeZone = g.timeZone || null, this.status = g.status, this.visibility = g.visibility, this.organizer = g.organizer, this.attendees = [...g.attendees], this.reminders = [...g.reminders], this.categories = g.categories ? [...g.categories] : [], this.attachments = [...g.attachments], this.conferenceData = g.conferenceData, this.metadata = { ...g.metadata }, this._cache = {}, this._validateAttendees(), this._validateReminders();
1094
1094
  }
1095
1095
  /**
1096
1096
  * Get event duration in milliseconds
@@ -1180,7 +1180,7 @@ class M {
1180
1180
  * @throws {Error} If otherEvent is not an Event instance or doesn't have start/end
1181
1181
  */
1182
1182
  overlaps(e) {
1183
- if (e instanceof M)
1183
+ if (e instanceof w)
1184
1184
  return !(this.end <= e.start || this.start >= e.end);
1185
1185
  if (e && e.start && e.end)
1186
1186
  return !(this.end <= e.start || this.start >= e.end);
@@ -1200,7 +1200,7 @@ class M {
1200
1200
  * @returns {Event} New Event instance with updated properties
1201
1201
  */
1202
1202
  clone(e = {}) {
1203
- return new M({
1203
+ return new w({
1204
1204
  id: this.id,
1205
1205
  title: this.title,
1206
1206
  start: new Date(this.start),
@@ -1264,7 +1264,7 @@ class M {
1264
1264
  * @returns {Event} New Event instance
1265
1265
  */
1266
1266
  static fromObject(e) {
1267
- return new M(e);
1267
+ return new w(e);
1268
1268
  }
1269
1269
  /**
1270
1270
  * Compare events for equality
@@ -1272,7 +1272,7 @@ class M {
1272
1272
  * @returns {boolean} True if events are equal
1273
1273
  */
1274
1274
  equals(e) {
1275
- return e instanceof M ? this.id === e.id && this.title === e.title && this.start.getTime() === e.start.getTime() && this.end.getTime() === e.end.getTime() && this.allDay === e.allDay && this.description === e.description && this.location === e.location && this.recurring === e.recurring && this.recurrenceRule === e.recurrenceRule && this.status === e.status : !1;
1275
+ return e instanceof w ? this.id === e.id && this.title === e.title && this.start.getTime() === e.start.getTime() && this.end.getTime() === e.end.getTime() && this.allDay === e.allDay && this.description === e.description && this.location === e.location && this.recurring === e.recurring && this.recurrenceRule === e.recurrenceRule && this.status === e.status : !1;
1276
1276
  }
1277
1277
  // ============ Attendee Management Methods ============
1278
1278
  /**
@@ -1531,7 +1531,7 @@ class M {
1531
1531
  return this.conferenceData !== null;
1532
1532
  }
1533
1533
  }
1534
- let u = class D {
1534
+ let f = class y {
1535
1535
  /**
1536
1536
  * Get the start of a day
1537
1537
  * @param {Date} date - The date
@@ -1567,7 +1567,7 @@ let u = class D {
1567
1567
  * @returns {Date}
1568
1568
  */
1569
1569
  static endOfWeek(e, t = 0) {
1570
- const s = D.startOfWeek(e, t);
1570
+ const s = y.startOfWeek(e, t);
1571
1571
  return s.setDate(s.getDate() + 6), s.setHours(23, 59, 59, 999), s;
1572
1572
  }
1573
1573
  /**
@@ -1619,7 +1619,7 @@ let u = class D {
1619
1619
  * @returns {Date}
1620
1620
  */
1621
1621
  static addWeeks(e, t) {
1622
- return D.addDays(e, t * 7);
1622
+ return y.addDays(e, t * 7);
1623
1623
  }
1624
1624
  /**
1625
1625
  * Add months to a date
@@ -1701,7 +1701,7 @@ let u = class D {
1701
1701
  * @returns {boolean}
1702
1702
  */
1703
1703
  static isSameWeek(e, t, s = 0) {
1704
- const i = D.startOfWeek(e, s), r = D.startOfWeek(t, s);
1704
+ const i = y.startOfWeek(e, s), r = y.startOfWeek(t, s);
1705
1705
  return i.toDateString() === r.toDateString();
1706
1706
  }
1707
1707
  /**
@@ -1739,7 +1739,7 @@ let u = class D {
1739
1739
  * @returns {number}
1740
1740
  */
1741
1741
  static differenceInWeeks(e, t) {
1742
- return Math.floor(D.differenceInDays(e, t) / 7);
1742
+ return Math.floor(y.differenceInDays(e, t) / 7);
1743
1743
  }
1744
1744
  /**
1745
1745
  * Get the difference in months between two dates
@@ -1795,7 +1795,7 @@ let u = class D {
1795
1795
  * @returns {string}
1796
1796
  */
1797
1797
  static getMonthName(e, t = "en-US", s = "long") {
1798
- return D.format(e, t, { month: s });
1798
+ return y.format(e, t, { month: s });
1799
1799
  }
1800
1800
  /**
1801
1801
  * Get day name
@@ -1805,7 +1805,7 @@ let u = class D {
1805
1805
  * @returns {string}
1806
1806
  */
1807
1807
  static getDayName(e, t = "en-US", s = "long") {
1808
- return D.format(e, t, { weekday: s });
1808
+ return y.format(e, t, { weekday: s });
1809
1809
  }
1810
1810
  /**
1811
1811
  * Format time
@@ -1815,7 +1815,7 @@ let u = class D {
1815
1815
  * @returns {string}
1816
1816
  */
1817
1817
  static formatTime(e, t = "en-US", s = !1) {
1818
- return D.format(e, t, {
1818
+ return y.format(e, t, {
1819
1819
  hour: "numeric",
1820
1820
  minute: "2-digit",
1821
1821
  hour12: !s
@@ -1837,7 +1837,7 @@ let u = class D {
1837
1837
  * @returns {Date}
1838
1838
  */
1839
1839
  static setTime(e, t) {
1840
- const s = new Date(e), { hours: i, minutes: r } = D.parseTime(t);
1840
+ const s = new Date(e), { hours: i, minutes: r } = y.parseTime(t);
1841
1841
  return s.setHours(i, r, 0, 0), s;
1842
1842
  }
1843
1843
  /**
@@ -1916,7 +1916,7 @@ let u = class D {
1916
1916
  * @returns {boolean}
1917
1917
  */
1918
1918
  static isDST(e, t) {
1919
- const s = new Date(e.getFullYear(), 0, 1), i = new Date(e.getFullYear(), 6, 1), r = D.getTimezoneOffset(s, t), n = D.getTimezoneOffset(i, t), a = D.getTimezoneOffset(e, t);
1919
+ const s = new Date(e.getFullYear(), 0, 1), i = new Date(e.getFullYear(), 6, 1), r = y.getTimezoneOffset(s, t), n = y.getTimezoneOffset(i, t), a = y.getTimezoneOffset(e, t);
1920
1920
  return Math.max(r, n) === a;
1921
1921
  }
1922
1922
  /**
@@ -1927,9 +1927,9 @@ let u = class D {
1927
1927
  * @returns {Date}
1928
1928
  */
1929
1929
  static addHoursWithDST(e, t, s) {
1930
- const i = new Date(e), r = D.getTimezoneOffset(e, s);
1930
+ const i = new Date(e), r = y.getTimezoneOffset(e, s);
1931
1931
  i.setTime(i.getTime() + t * 60 * 60 * 1e3);
1932
- const n = D.getTimezoneOffset(i, s);
1932
+ const n = y.getTimezoneOffset(i, s);
1933
1933
  if (r !== n) {
1934
1934
  const a = (n - r) * 6e4;
1935
1935
  i.setTime(i.getTime() + a);
@@ -1948,11 +1948,11 @@ let u = class D {
1948
1948
  * @returns {Date}
1949
1949
  */
1950
1950
  static createInTimeZone(e, t, s, i = 0, r = 0, n = 0, a) {
1951
- const o = `${e}-${String(t + 1).padStart(2, "0")}-${String(s).padStart(2, "0")}`, c = `${String(i).padStart(2, "0")}:${String(r).padStart(2, "0")}:${String(n).padStart(2, "0")}`, l = /* @__PURE__ */ new Date(`${o}T${c}`), d = D.getTimezoneOffset(l, a), h = l.getTime() + d * 6e4;
1952
- return new Date(h);
1951
+ const o = `${e}-${String(t + 1).padStart(2, "0")}-${String(s).padStart(2, "0")}`, c = `${String(i).padStart(2, "0")}:${String(r).padStart(2, "0")}:${String(n).padStart(2, "0")}`, l = /* @__PURE__ */ new Date(`${o}T${c}`), h = y.getTimezoneOffset(l, a), d = l.getTime() + h * 6e4;
1952
+ return new Date(d);
1953
1953
  }
1954
1954
  };
1955
- class Y {
1955
+ class Z {
1956
1956
  /**
1957
1957
  * Parse an RRULE string into a structured rule object
1958
1958
  * @param {string|Object} rrule - RRULE string or rule object
@@ -2206,7 +2206,7 @@ class Y {
2206
2206
  return e.count ? r += `, ${e.count} time${e.count > 1 ? "s" : ""}` : e.until && (r += `, until ${e.until.toLocaleDateString()}`), r;
2207
2207
  }
2208
2208
  }
2209
- class N {
2209
+ class q {
2210
2210
  /**
2211
2211
  * Expand a recurring event into individual occurrences
2212
2212
  * @param {import('./Event.js').Event} event - The recurring event
@@ -2219,35 +2219,35 @@ class N {
2219
2219
  static expandEvent(e, t, s, i = 365, r = null) {
2220
2220
  if (!e.recurring || !e.recurrenceRule)
2221
2221
  return [{ start: e.start, end: e.end, timezone: e.timeZone }];
2222
- const n = this.parseRule(e.recurrenceRule), a = [], o = e.end - e.start, c = r || e.timeZone || "UTC", l = S.getInstance();
2223
- let d = new Date(e.start), h = 0;
2222
+ const n = this.parseRule(e.recurrenceRule), a = [], o = e.end - e.start, c = r || e.timeZone || "UTC", l = C.getInstance();
2223
+ let h = new Date(e.start), d = 0;
2224
2224
  n.until && n.until < s && (s = n.until);
2225
- let g = l.getTimezoneOffset(d, c), w = 0;
2226
- const f = 3;
2227
- for (; d <= s && h < i; ) {
2228
- if (d >= t) {
2229
- const b = new Date(d), T = new Date(d.getTime() + o), A = l.getTimezoneOffset(b, c);
2230
- if (A !== g) {
2231
- const _ = g - A;
2232
- b.setMinutes(b.getMinutes() + _), T.setMinutes(T.getMinutes() + _);
2225
+ let p = l.getTimezoneOffset(h, c), b = 0;
2226
+ const v = 3;
2227
+ for (; h <= s && d < i; ) {
2228
+ if (h >= t) {
2229
+ const D = new Date(h), T = new Date(h.getTime() + o), A = l.getTimezoneOffset(D, c);
2230
+ if (A !== p) {
2231
+ const I = p - A;
2232
+ D.setMinutes(D.getMinutes() + I), T.setMinutes(T.getMinutes() + I);
2233
2233
  }
2234
- g = A, this.isException(b, n, e.id) || a.push({
2235
- start: b,
2234
+ p = A, this.isException(D, n, e.id) || a.push({
2235
+ start: D,
2236
2236
  end: T,
2237
2237
  recurringEventId: e.id,
2238
2238
  timezone: c,
2239
2239
  originalStart: e.start
2240
2240
  });
2241
2241
  }
2242
- const k = d.getTime();
2243
- if (d = this.getNextOccurrence(d, n, c), h++, d.getTime() === k) {
2244
- if (w++, w >= f) {
2242
+ const M = h.getTime();
2243
+ if (h = this.getNextOccurrence(h, n, c), d++, h.getTime() === M) {
2244
+ if (b++, b >= v) {
2245
2245
  console.warn("RecurrenceEngine: Date not advancing, breaking to prevent infinite loop");
2246
2246
  break;
2247
2247
  }
2248
2248
  } else
2249
- w = 0;
2250
- if (n.count && h >= n.count)
2249
+ b = 0;
2250
+ if (n.count && d >= n.count)
2251
2251
  break;
2252
2252
  }
2253
2253
  return a;
@@ -2258,7 +2258,7 @@ class N {
2258
2258
  * @returns {import('../../types.js').RecurrenceRule} Parsed rule object
2259
2259
  */
2260
2260
  static parseRule(e) {
2261
- return Y.parse(e);
2261
+ return Z.parse(e);
2262
2262
  }
2263
2263
  /**
2264
2264
  * Calculate the next occurrence based on the rule
@@ -2446,7 +2446,7 @@ class N {
2446
2446
  return r && (n = `${r === -1 ? "Last" : ["", "1st", "2nd", "3rd", "4th", "5th"][r] || `${r}th`} ${n}`), n;
2447
2447
  }
2448
2448
  }
2449
- class z {
2449
+ class _ {
2450
2450
  /**
2451
2451
  * Create a new LRU Cache
2452
2452
  * @param {number} capacity - Maximum number of items in cache
@@ -2533,7 +2533,7 @@ class z {
2533
2533
  return this.cache.size;
2534
2534
  }
2535
2535
  }
2536
- class j {
2536
+ class K {
2537
2537
  constructor(e = {}) {
2538
2538
  this.config = {
2539
2539
  checkInterval: 3e4,
@@ -2751,7 +2751,7 @@ class j {
2751
2751
  this.stopMonitoring(), this.caches.clear();
2752
2752
  }
2753
2753
  }
2754
- class W {
2754
+ class G {
2755
2755
  constructor(e = {}) {
2756
2756
  this.config = {
2757
2757
  enableCache: !0,
@@ -2766,7 +2766,7 @@ class W {
2766
2766
  enableAdaptiveMemory: !0,
2767
2767
  // Enable adaptive memory management
2768
2768
  ...e
2769
- }, this.eventCache = new z(this.config.cacheCapacity), this.queryCache = new z(Math.floor(this.config.cacheCapacity / 2)), this.dateRangeCache = new z(Math.floor(this.config.cacheCapacity / 4)), this.config.enableAdaptiveMemory && (this.memoryManager = new j({
2769
+ }, this.eventCache = new _(this.config.cacheCapacity), this.queryCache = new _(Math.floor(this.config.cacheCapacity / 2)), this.dateRangeCache = new _(Math.floor(this.config.cacheCapacity / 4)), this.config.enableAdaptiveMemory && (this.memoryManager = new K({
2770
2770
  checkInterval: 3e4,
2771
2771
  memoryThreshold: 0.75,
2772
2772
  criticalThreshold: 0.9
@@ -3056,7 +3056,7 @@ class W {
3056
3056
  this.cleanupTimer && (clearInterval(this.cleanupTimer), this.cleanupTimer = null), this.batchTimer && (clearTimeout(this.batchTimer), this.batchTimer = null), this.eventCache.clear(), this.queryCache.clear(), this.dateRangeCache.clear(), this.lazyIndexes.clear(), this.pendingIndexes.clear();
3057
3057
  }
3058
3058
  }
3059
- class Z {
3059
+ class Q {
3060
3060
  /**
3061
3061
  * Create a new ConflictDetector
3062
3062
  * @param {import('../events/EventStore.js').EventStore} eventStore - Event store instance
@@ -3085,8 +3085,8 @@ class Z {
3085
3085
  throw new Error("Event must have start and end dates");
3086
3086
  const i = [], r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), a = new Date(e.start.getTime() - s.bufferMinutes * 6e4), o = new Date(e.end.getTime() + s.bufferMinutes * 6e4), c = this.eventStore.getEventsInRange(a, o, !1).filter((l) => !(l.id === e.id || s.excludeEventIds.includes(l.id) || !s.includeStatuses.includes(l.status) || s.ignoreAllDay && (l.allDay || e.allDay) || l.status === "cancelled"));
3087
3087
  for (const l of c) {
3088
- const d = this._detectEventConflicts(e, l, s);
3089
- d.length > 0 && (i.push(...d), r.add(e.id), r.add(l.id), e.attendees && e.attendees.forEach((h) => n.add(h.email)), l.attendees && l.attendees.forEach((h) => n.add(h.email)));
3088
+ const h = this._detectEventConflicts(e, l, s);
3089
+ h.length > 0 && (i.push(...h), r.add(e.id), r.add(l.id), e.attendees && e.attendees.forEach((d) => n.add(d.email)), l.attendees && l.attendees.forEach((d) => n.add(d.email)));
3090
3090
  }
3091
3091
  return this._buildConflictSummary(i, r, n);
3092
3092
  }
@@ -3343,7 +3343,7 @@ class Z {
3343
3343
  return i >= n && r <= a;
3344
3344
  }
3345
3345
  }
3346
- class q {
3346
+ class J {
3347
3347
  constructor(e = {}) {
3348
3348
  this.events = /* @__PURE__ */ new Map(), this.indices = {
3349
3349
  /** @type {Map<string, Set<string>>} UTC Date string -> Set of event IDs */
@@ -3356,7 +3356,7 @@ class q {
3356
3356
  byCategory: /* @__PURE__ */ new Map(),
3357
3357
  /** @type {Map<string, Set<string>>} Status -> Set of event IDs */
3358
3358
  byStatus: /* @__PURE__ */ new Map()
3359
- }, this.timezoneManager = S.getInstance(), this.defaultTimezone = e.timezone || this.timezoneManager.getSystemTimezone(), this.optimizer = new W(e.performance), this.conflictDetector = new Z(this), this.isBatchMode = !1, this.batchNotifications = [], this.batchBackup = null, this.version = 0, this.listeners = /* @__PURE__ */ new Set();
3359
+ }, this.timezoneManager = C.getInstance(), this.defaultTimezone = e.timezone || this.timezoneManager.getSystemTimezone(), this.optimizer = new G(e.performance), this.conflictDetector = new Q(this), this.isBatchMode = !1, this.batchNotifications = [], this.batchBackup = null, this.version = 0, this.listeners = /* @__PURE__ */ new Set();
3360
3360
  }
3361
3361
  /**
3362
3362
  * Add an event to the store
@@ -3366,7 +3366,7 @@ class q {
3366
3366
  */
3367
3367
  addEvent(e) {
3368
3368
  return this.optimizer.measure("addEvent", () => {
3369
- if (e instanceof M || (e = new M(e)), this.events.has(e.id))
3369
+ if (e instanceof w || (e = new w(e)), this.events.has(e.id))
3370
3370
  throw new Error(`Event with id ${e.id} already exists`);
3371
3371
  return this.events.set(e.id, e), this.optimizer.cache(e.id, e, "event"), this._indexEvent(e), this.isBatchMode ? this.batchNotifications.push({
3372
3372
  type: "add",
@@ -3478,13 +3478,13 @@ class q {
3478
3478
  * @returns {Event[]} Events occurring on the date, sorted by start time
3479
3479
  */
3480
3480
  getEventsForDate(e, t = null) {
3481
- t = t || this.defaultTimezone, u.getLocalDateString(e);
3481
+ t = t || this.defaultTimezone, f.getLocalDateString(e);
3482
3482
  const s = /* @__PURE__ */ new Set(), i = new Date(e);
3483
3483
  for (let l = -1; l <= 1; l++) {
3484
- const d = new Date(i);
3485
- d.setDate(d.getDate() + l);
3486
- const h = u.getLocalDateString(d), g = this.indices.byDate.get(h);
3487
- g && g.forEach((w) => s.add(w));
3484
+ const h = new Date(i);
3485
+ h.setDate(h.getDate() + l);
3486
+ const d = f.getLocalDateString(h), p = this.indices.byDate.get(d);
3487
+ p && p.forEach((b) => s.add(b));
3488
3488
  }
3489
3489
  const r = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, n = this.indices.byMonth.get(r);
3490
3490
  n && n.forEach((l) => s.add(l));
@@ -3493,15 +3493,15 @@ class q {
3493
3493
  const c = new Date(e);
3494
3494
  c.setHours(23, 59, 59, 999);
3495
3495
  for (const l of s) {
3496
- const d = this.events.get(l);
3497
- if (d) {
3498
- const h = d.getStartInTimezone(t), g = d.getEndInTimezone(t);
3499
- h <= c && g >= o && a.push(d);
3496
+ const h = this.events.get(l);
3497
+ if (h) {
3498
+ const d = h.getStartInTimezone(t), p = h.getEndInTimezone(t);
3499
+ d <= c && p >= o && a.push(h);
3500
3500
  }
3501
3501
  }
3502
- return a.sort((l, d) => {
3503
- const h = l.getStartInTimezone(t), g = d.getStartInTimezone(t), w = h - g;
3504
- return w !== 0 ? w : d.duration - l.duration;
3502
+ return a.sort((l, h) => {
3503
+ const d = l.getStartInTimezone(t), p = h.getStartInTimezone(t), b = d - p;
3504
+ return b !== 0 ? b : h.duration - l.duration;
3505
3505
  });
3506
3506
  }
3507
3507
  /**
@@ -3512,14 +3512,14 @@ class q {
3512
3512
  * @returns {Event[]} Array of overlapping events
3513
3513
  */
3514
3514
  getOverlappingEvents(e, t, s = null) {
3515
- const i = [], r = u.startOfDay(e), n = u.endOfDay(t), a = u.getDateRange(r, n), o = /* @__PURE__ */ new Set();
3515
+ const i = [], r = f.startOfDay(e), n = f.endOfDay(t), a = f.getDateRange(r, n), o = /* @__PURE__ */ new Set();
3516
3516
  return a.forEach((c) => {
3517
- const l = u.getLocalDateString(c);
3518
- (this.indices.byDate.get(l) || /* @__PURE__ */ new Set()).forEach((h) => {
3519
- if (!o.has(h) && h !== s) {
3520
- o.add(h);
3521
- const g = this.events.get(h);
3522
- g && g.overlaps({ start: e, end: t }) && i.push(g);
3517
+ const l = f.getLocalDateString(c);
3518
+ (this.indices.byDate.get(l) || /* @__PURE__ */ new Set()).forEach((d) => {
3519
+ if (!o.has(d) && d !== s) {
3520
+ o.add(d);
3521
+ const p = this.events.get(d);
3522
+ p && p.overlaps({ start: e, end: t }) && i.push(p);
3523
3523
  }
3524
3524
  });
3525
3525
  }), i.sort((c, l) => c.start - l.start);
@@ -3612,8 +3612,8 @@ class q {
3612
3612
  } else
3613
3613
  o.push(c);
3614
3614
  }), o.sort((c, l) => {
3615
- const d = c.getStartInTimezone(i), h = l.getStartInTimezone(i);
3616
- return d - h;
3615
+ const h = c.getStartInTimezone(i), d = l.getStartInTimezone(i);
3616
+ return h - d;
3617
3617
  });
3618
3618
  }
3619
3619
  /**
@@ -3629,7 +3629,7 @@ class q {
3629
3629
  return [e];
3630
3630
  i = i || this.defaultTimezone;
3631
3631
  const r = e.timeZone || i;
3632
- return N.expandEvent(e, t, s).map((a, o) => e.clone({
3632
+ return q.expandEvent(e, t, s).map((a, o) => e.clone({
3633
3633
  id: `${e.id}_occurrence_${o}`,
3634
3634
  start: a.start,
3635
3635
  end: a.end,
@@ -3680,9 +3680,9 @@ class q {
3680
3680
  this._indexEventLazy(e);
3681
3681
  return;
3682
3682
  }
3683
- const t = e.getStartInTimezone(e.timeZone), s = e.getEndInTimezone(e.endTimeZone || e.timeZone), i = u.startOfDay(t), r = u.endOfDay(s);
3684
- u.getDateRange(i, r).forEach((o) => {
3685
- const c = u.getLocalDateString(o);
3683
+ const t = e.getStartInTimezone(e.timeZone), s = e.getEndInTimezone(e.endTimeZone || e.timeZone), i = f.startOfDay(t), r = f.endOfDay(s);
3684
+ f.getDateRange(i, r).forEach((o) => {
3685
+ const c = f.getLocalDateString(o);
3686
3686
  this.indices.byDate.has(c) || this.indices.byDate.set(c, /* @__PURE__ */ new Set()), this.indices.byDate.get(c).add(e.id);
3687
3687
  }), `${i.getFullYear()}${String(i.getMonth() + 1).padStart(2, "0")}`, `${r.getFullYear()}${String(r.getMonth() + 1).padStart(2, "0")}`;
3688
3688
  const a = new Date(i.getFullYear(), i.getMonth(), 1);
@@ -3700,21 +3700,21 @@ class q {
3700
3700
  */
3701
3701
  _indexEventLazy(e) {
3702
3702
  this.optimizer.createLazyIndexMarkers(e);
3703
- const t = e.getStartInTimezone(e.timeZone), s = e.getEndInTimezone(e.endTimeZone || e.timeZone), i = u.startOfDay(t), r = u.endOfDay(s), n = new Date(i);
3704
- if (n.setDate(n.getDate() + 7), u.getDateRange(
3703
+ const t = e.getStartInTimezone(e.timeZone), s = e.getEndInTimezone(e.endTimeZone || e.timeZone), i = f.startOfDay(t), r = f.endOfDay(s), n = new Date(i);
3704
+ if (n.setDate(n.getDate() + 7), f.getDateRange(
3705
3705
  i,
3706
3706
  n < r ? n : r
3707
3707
  ).forEach((c) => {
3708
- const l = u.getLocalDateString(c);
3708
+ const l = f.getLocalDateString(c);
3709
3709
  this.indices.byDate.has(l) || this.indices.byDate.set(l, /* @__PURE__ */ new Set()), this.indices.byDate.get(l).add(e.id);
3710
3710
  }), r > n) {
3711
3711
  const c = new Date(r);
3712
- c.setDate(c.getDate() - 7), u.getDateRange(
3712
+ c.setDate(c.getDate() - 7), f.getDateRange(
3713
3713
  c > i ? c : i,
3714
3714
  r
3715
- ).forEach((d) => {
3716
- const h = u.getLocalDateString(d);
3717
- this.indices.byDate.has(h) || this.indices.byDate.set(h, /* @__PURE__ */ new Set()), this.indices.byDate.get(h).add(e.id);
3715
+ ).forEach((h) => {
3716
+ const d = f.getLocalDateString(h);
3717
+ this.indices.byDate.has(d) || this.indices.byDate.set(d, /* @__PURE__ */ new Set()), this.indices.byDate.get(d).add(e.id);
3718
3718
  });
3719
3719
  }
3720
3720
  const o = new Date(i.getFullYear(), i.getMonth(), 1);
@@ -4023,7 +4023,7 @@ class q {
4023
4023
  return t;
4024
4024
  }
4025
4025
  }
4026
- let K = class {
4026
+ let X = class {
4027
4027
  /**
4028
4028
  * Create a new StateManager instance
4029
4029
  * @param {Partial<import('../../types.js').CalendarState>} [initialState={}] - Initial state values
@@ -4404,13 +4404,13 @@ let K = class {
4404
4404
  }
4405
4405
  }
4406
4406
  };
4407
- class G {
4407
+ class ee {
4408
4408
  /**
4409
4409
  * Create a new Calendar instance
4410
4410
  * @param {import('../../types.js').CalendarConfig} [config={}] - Configuration options
4411
4411
  */
4412
4412
  constructor(e = {}) {
4413
- this.timezoneManager = S.getInstance(), this.config = {
4413
+ this.timezoneManager = C.getInstance(), this.config = {
4414
4414
  view: "month",
4415
4415
  date: /* @__PURE__ */ new Date(),
4416
4416
  weekStartsOn: 0,
@@ -4425,7 +4425,7 @@ class G {
4425
4425
  end: "17:00"
4426
4426
  },
4427
4427
  ...e
4428
- }, this.eventStore = new q({ timezone: this.config.timeZone }), this.state = new K({
4428
+ }, this.eventStore = new J({ timezone: this.config.timeZone }), this.state = new X({
4429
4429
  view: this.config.view,
4430
4430
  currentDate: this.config.date,
4431
4431
  weekStartsOn: this.config.weekStartsOn,
@@ -4516,7 +4516,7 @@ class G {
4516
4516
  * @returns {import('../events/Event.js').Event} The added event
4517
4517
  */
4518
4518
  addEvent(e) {
4519
- !(e instanceof M) && !e.timeZone && (e = { ...e, timeZone: this.config.timeZone });
4519
+ !(e instanceof w) && !e.timeZone && (e = { ...e, timeZone: this.config.timeZone });
4520
4520
  const t = this.eventStore.addEvent(e);
4521
4521
  return this._emit("eventAdd", { event: t }), t;
4522
4522
  }
@@ -4714,32 +4714,32 @@ class G {
4714
4714
  * @private
4715
4715
  */
4716
4716
  _getMonthViewData(e) {
4717
- const t = e.getFullYear(), s = e.getMonth(), i = this.state.get("weekStartsOn"), r = this.state.get("fixedWeekCount"), n = new Date(t, s, 1), a = new Date(t, s + 1, 0), o = u.startOfWeek(n, i), c = [];
4717
+ const t = e.getFullYear(), s = e.getMonth(), i = this.state.get("weekStartsOn"), r = this.state.get("fixedWeekCount"), n = new Date(t, s, 1), a = new Date(t, s + 1, 0), o = f.startOfWeek(n, i), c = [];
4718
4718
  let l = new Date(o);
4719
- const d = r ? 6 : Math.ceil((a.getDate() + u.getDayOfWeek(n, i)) / 7);
4720
- for (let h = 0; h < d; h++) {
4721
- const g = {
4722
- weekNumber: u.getWeekNumber(l),
4719
+ const h = r ? 6 : Math.ceil((a.getDate() + f.getDayOfWeek(n, i)) / 7);
4720
+ for (let d = 0; d < h; d++) {
4721
+ const p = {
4722
+ weekNumber: f.getWeekNumber(l),
4723
4723
  days: []
4724
4724
  };
4725
- for (let w = 0; w < 7; w++) {
4726
- const f = new Date(l), k = f.getMonth() === s, b = u.isToday(f), T = f.getDay() === 0 || f.getDay() === 6;
4727
- g.days.push({
4728
- date: f,
4729
- dayOfMonth: f.getDate(),
4730
- isCurrentMonth: k,
4731
- isToday: b,
4725
+ for (let b = 0; b < 7; b++) {
4726
+ const v = new Date(l), M = v.getMonth() === s, D = f.isToday(v), T = v.getDay() === 0 || v.getDay() === 6;
4727
+ p.days.push({
4728
+ date: v,
4729
+ dayOfMonth: v.getDate(),
4730
+ isCurrentMonth: M,
4731
+ isToday: D,
4732
4732
  isWeekend: T,
4733
- events: this.getEventsForDate(f)
4734
- }), l = u.addDays(l, 1);
4733
+ events: this.getEventsForDate(v)
4734
+ }), l = f.addDays(l, 1);
4735
4735
  }
4736
- c.push(g);
4736
+ c.push(p);
4737
4737
  }
4738
4738
  return {
4739
4739
  type: "month",
4740
4740
  year: t,
4741
4741
  month: s,
4742
- monthName: u.getMonthName(e, this.state.get("locale")),
4742
+ monthName: f.getMonthName(e, this.state.get("locale")),
4743
4743
  weeks: c,
4744
4744
  startDate: o,
4745
4745
  endDate: new Date(l.getTime() - 1)
@@ -4751,15 +4751,15 @@ class G {
4751
4751
  * @private
4752
4752
  */
4753
4753
  _getWeekViewData(e) {
4754
- const t = this.state.get("weekStartsOn"), s = u.startOfWeek(e, t), i = u.endOfWeek(e, t), r = [], n = new Date(s);
4754
+ const t = this.state.get("weekStartsOn"), s = f.startOfWeek(e, t), i = f.endOfWeek(e, t), r = [], n = new Date(s);
4755
4755
  for (let a = 0; a < 7; a++) {
4756
4756
  const o = new Date(n);
4757
4757
  r.push({
4758
4758
  date: o,
4759
4759
  dayOfMonth: o.getDate(),
4760
4760
  dayOfWeek: o.getDay(),
4761
- dayName: u.getDayName(o, this.state.get("locale")),
4762
- isToday: u.isToday(o),
4761
+ dayName: f.getDayName(o, this.state.get("locale")),
4762
+ isToday: f.isToday(o),
4763
4763
  isWeekend: o.getDay() === 0 || o.getDay() === 6,
4764
4764
  events: this.getEventsForDate(o),
4765
4765
  // Add overlap groups for positioning overlapping events
@@ -4769,7 +4769,7 @@ class G {
4769
4769
  }
4770
4770
  return {
4771
4771
  type: "week",
4772
- weekNumber: u.getWeekNumber(s),
4772
+ weekNumber: f.getWeekNumber(s),
4773
4773
  startDate: s,
4774
4774
  endDate: i,
4775
4775
  days: r
@@ -4787,15 +4787,15 @@ class G {
4787
4787
  const o = new Date(e);
4788
4788
  o.setHours(n + 1, 0, 0, 0), r.push({
4789
4789
  hour: n,
4790
- time: u.formatTime(a, this.state.get("locale")),
4790
+ time: f.formatTime(a, this.state.get("locale")),
4791
4791
  events: i.filter((c) => c.start < o && c.end > a)
4792
4792
  });
4793
4793
  }
4794
4794
  return {
4795
4795
  type: "day",
4796
4796
  date: e,
4797
- dayName: u.getDayName(e, this.state.get("locale")),
4798
- isToday: u.isToday(e),
4797
+ dayName: f.getDayName(e, this.state.get("locale")),
4798
+ isToday: f.isToday(e),
4799
4799
  allDayEvents: s,
4800
4800
  hours: r
4801
4801
  };
@@ -4819,8 +4819,8 @@ class G {
4819
4819
  });
4820
4820
  const n = Array.from(r.values()).sort((a, o) => a.date - o.date).map((a) => ({
4821
4821
  ...a,
4822
- dayName: u.getDayName(a.date, this.state.get("locale")),
4823
- isToday: u.isToday(a.date)
4822
+ dayName: f.getDayName(a.date, this.state.get("locale")),
4823
+ isToday: f.isToday(a.date)
4824
4824
  }));
4825
4825
  return {
4826
4826
  type: "list",
@@ -4925,7 +4925,7 @@ class G {
4925
4925
  }), this.plugins.clear(), this.views.clear(), this._emit("destroy");
4926
4926
  }
4927
4927
  }
4928
- class Q {
4928
+ class te {
4929
4929
  constructor() {
4930
4930
  this.events = /* @__PURE__ */ new Map(), this.wildcardHandlers = /* @__PURE__ */ new Set();
4931
4931
  }
@@ -5067,10 +5067,10 @@ class Q {
5067
5067
  return e;
5068
5068
  }
5069
5069
  }
5070
- const y = new Q();
5071
- class J {
5070
+ const m = new te();
5071
+ class se {
5072
5072
  constructor(e = {}) {
5073
- this.calendar = new G({
5073
+ this.calendar = new ee({
5074
5074
  view: e.view || "month",
5075
5075
  date: e.date || /* @__PURE__ */ new Date(),
5076
5076
  weekStartsOn: e.weekStartsOn ?? 0,
@@ -5147,51 +5147,51 @@ class J {
5147
5147
  (i) => e[i] !== t[i]
5148
5148
  );
5149
5149
  s.forEach((i) => {
5150
- y.emit(`state:${i}:changed`, {
5150
+ m.emit(`state:${i}:changed`, {
5151
5151
  oldValue: e[i],
5152
5152
  newValue: t[i],
5153
5153
  state: t
5154
5154
  });
5155
- }), s.length > 0 && y.emit("state:changed", { oldState: e, newState: t, changedKeys: s });
5155
+ }), s.length > 0 && m.emit("state:changed", { oldState: e, newState: t, changedKeys: s });
5156
5156
  }
5157
5157
  // Calendar operations
5158
5158
  setView(e) {
5159
- this.calendar.setView(e), this.setState({ view: e }), y.emit("view:changed", { view: e });
5159
+ this.calendar.setView(e), this.setState({ view: e }), m.emit("view:changed", { view: e });
5160
5160
  }
5161
5161
  getView() {
5162
5162
  return this.state.view;
5163
5163
  }
5164
5164
  setDate(e) {
5165
- this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), y.emit("date:changed", { date: this.state.currentDate });
5165
+ this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("date:changed", { date: this.state.currentDate });
5166
5166
  }
5167
5167
  getCurrentDate() {
5168
5168
  return this.state.currentDate;
5169
5169
  }
5170
5170
  // Navigation
5171
5171
  next() {
5172
- this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }), y.emit("navigation:next", { date: this.state.currentDate });
5172
+ this.calendar.next(), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:next", { date: this.state.currentDate });
5173
5173
  }
5174
5174
  previous() {
5175
- this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }), y.emit("navigation:previous", { date: this.state.currentDate });
5175
+ this.calendar.previous(), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:previous", { date: this.state.currentDate });
5176
5176
  }
5177
5177
  today() {
5178
- this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), y.emit("navigation:today", { date: this.state.currentDate });
5178
+ this.calendar.today(), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:today", { date: this.state.currentDate });
5179
5179
  }
5180
5180
  goToDate(e) {
5181
- this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), y.emit("navigation:goto", { date: this.state.currentDate });
5181
+ this.calendar.goToDate(e), this.setState({ currentDate: this.calendar.getCurrentDate() }), m.emit("navigation:goto", { date: this.state.currentDate });
5182
5182
  }
5183
5183
  // Event management
5184
5184
  addEvent(e) {
5185
5185
  const t = this.calendar.addEvent(e);
5186
- return t ? (this._syncEventsFromCore(), y.emit("event:added", { event: t }), t) : (console.error("Failed to add event to calendar"), y.emit("event:error", { action: "add", event: e, error: "Failed to add event" }), null);
5186
+ return t ? (this._syncEventsFromCore(), m.emit("event:added", { event: t }), t) : (console.error("Failed to add event to calendar"), m.emit("event:error", { action: "add", event: e, error: "Failed to add event" }), null);
5187
5187
  }
5188
5188
  updateEvent(e, t) {
5189
5189
  this._syncEventsFromCore({ silent: !0 });
5190
5190
  const s = this.calendar.updateEvent(e, t);
5191
- return s ? (this._syncEventsFromCore(), y.emit("event:updated", { event: s }), s) : (console.error(`Failed to update event: ${e}`), y.emit("event:error", { action: "update", eventId: e, updates: t, error: "Event not found in calendar" }), null);
5191
+ return s ? (this._syncEventsFromCore(), m.emit("event:updated", { event: s }), s) : (console.error(`Failed to update event: ${e}`), m.emit("event:error", { action: "update", eventId: e, updates: t, error: "Event not found in calendar" }), null);
5192
5192
  }
5193
5193
  deleteEvent(e) {
5194
- return this._syncEventsFromCore({ silent: !0 }), this.calendar.removeEvent(e) ? (this._syncEventsFromCore(), y.emit("event:deleted", { eventId: e }), !0) : (console.error(`Failed to delete event: ${e}`), y.emit("event:error", { action: "delete", eventId: e, error: "Event not found" }), !1);
5194
+ return this._syncEventsFromCore({ silent: !0 }), this.calendar.removeEvent(e) ? (this._syncEventsFromCore(), m.emit("event:deleted", { eventId: e }), !0) : (console.error(`Failed to delete event: ${e}`), m.emit("event:error", { action: "delete", eventId: e, error: "Event not found" }), !1);
5195
5195
  }
5196
5196
  getEvents() {
5197
5197
  return this.calendar.getEvents() || [];
@@ -5242,20 +5242,20 @@ class J {
5242
5242
  }
5243
5243
  // Selection management
5244
5244
  selectEvent(e) {
5245
- this.setState({ selectedEvent: e }), y.emit("event:selected", { event: e });
5245
+ this.setState({ selectedEvent: e }), m.emit("event:selected", { event: e });
5246
5246
  }
5247
5247
  selectEventById(e) {
5248
5248
  const t = this.state.events.find((s) => s.id === e);
5249
5249
  t && this.selectEvent(t);
5250
5250
  }
5251
5251
  deselectEvent() {
5252
- this.setState({ selectedEvent: null }), y.emit("event:deselected", {});
5252
+ this.setState({ selectedEvent: null }), m.emit("event:deselected", {});
5253
5253
  }
5254
5254
  selectDate(e) {
5255
- this.setState({ selectedDate: e }), y.emit("date:selected", { date: e });
5255
+ this.setState({ selectedDate: e }), m.emit("date:selected", { date: e });
5256
5256
  }
5257
5257
  deselectDate() {
5258
- this.setState({ selectedDate: null }), y.emit("date:deselected", {});
5258
+ this.setState({ selectedDate: null }), m.emit("date:deselected", {});
5259
5259
  }
5260
5260
  // Utility methods
5261
5261
  isToday(e) {
@@ -5275,7 +5275,7 @@ class J {
5275
5275
  }
5276
5276
  // Error handling
5277
5277
  setError(e) {
5278
- this.setState({ error: e }), e && y.emit("error", { error: e });
5278
+ this.setState({ error: e }), e && m.emit("error", { error: e });
5279
5279
  }
5280
5280
  clearError() {
5281
5281
  this.setState({ error: null });
@@ -5289,7 +5289,7 @@ class J {
5289
5289
  this.subscribers.clear(), this._subscriberIds && (this._subscriberIds.clear(), this._subscriberIds = null), this.state = null, this.calendar = null;
5290
5290
  }
5291
5291
  }
5292
- class x extends u {
5292
+ class S extends f {
5293
5293
  /**
5294
5294
  * Format date for display
5295
5295
  */
@@ -5351,8 +5351,8 @@ class x extends u {
5351
5351
  * Get relative time string (e.g., "2 hours ago", "in 3 days")
5352
5352
  */
5353
5353
  static getRelativeTime(e, t = /* @__PURE__ */ new Date(), s = "en-US") {
5354
- const i = new Intl.RelativeTimeFormat(s, { numeric: "auto" }), r = e - t, n = Math.floor(r / 1e3), a = Math.floor(n / 60), o = Math.floor(a / 60), c = Math.floor(o / 24), l = Math.floor(c / 7), d = Math.floor(c / 30), h = Math.floor(c / 365);
5355
- return Math.abs(n) < 60 ? i.format(n, "second") : Math.abs(a) < 60 ? i.format(a, "minute") : Math.abs(o) < 24 ? i.format(o, "hour") : Math.abs(c) < 7 ? i.format(c, "day") : Math.abs(l) < 4 ? i.format(l, "week") : Math.abs(d) < 12 ? i.format(d, "month") : i.format(h, "year");
5354
+ const i = new Intl.RelativeTimeFormat(s, { numeric: "auto" }), r = e - t, n = Math.floor(r / 1e3), a = Math.floor(n / 60), o = Math.floor(a / 60), c = Math.floor(o / 24), l = Math.floor(c / 7), h = Math.floor(c / 30), d = Math.floor(c / 365);
5355
+ return Math.abs(n) < 60 ? i.format(n, "second") : Math.abs(a) < 60 ? i.format(a, "minute") : Math.abs(o) < 24 ? i.format(o, "hour") : Math.abs(c) < 7 ? i.format(c, "day") : Math.abs(l) < 4 ? i.format(l, "week") : Math.abs(h) < 12 ? i.format(h, "month") : i.format(d, "year");
5356
5356
  }
5357
5357
  /**
5358
5358
  * Check if date is today
@@ -5403,7 +5403,7 @@ class x extends u {
5403
5403
  return r && (r.toLowerCase() === "pm" && n < 12 ? o = n + 12 : r.toLowerCase() === "am" && n === 12 && (o = 0)), s.setHours(o, a || 0, 0, 0), s;
5404
5404
  }
5405
5405
  }
5406
- class C {
5406
+ class L {
5407
5407
  /**
5408
5408
  * Create element with attributes and children
5409
5409
  */
@@ -5598,7 +5598,7 @@ class C {
5598
5598
  return e.addEventListener("keydown", r), s == null || s.focus(), () => e.removeEventListener("keydown", r);
5599
5599
  }
5600
5600
  }
5601
- class v {
5601
+ class x {
5602
5602
  /**
5603
5603
  * Get CSS variable value
5604
5604
  */
@@ -5935,7 +5935,7 @@ class v {
5935
5935
  /**
5936
5936
  * Default theme colors
5937
5937
  */
5938
- I(v, "colors", {
5938
+ $(x, "colors", {
5939
5939
  primary: "#3B82F6",
5940
5940
  // Modern Blue
5941
5941
  secondary: "#64748B",
@@ -5968,7 +5968,7 @@ I(v, "colors", {
5968
5968
  }), /**
5969
5969
  * Common CSS variables
5970
5970
  */
5971
- I(v, "cssVariables", {
5971
+ $(x, "cssVariables", {
5972
5972
  // "Pro" Palette - Functional & Sharp
5973
5973
  "--fc-primary-color": "#2563EB",
5974
5974
  // International Blue (Focus)
@@ -6036,7 +6036,7 @@ I(v, "cssVariables", {
6036
6036
  }), /**
6037
6037
  * Get responsive breakpoints
6038
6038
  */
6039
- I(v, "breakpoints", {
6039
+ $(x, "breakpoints", {
6040
6040
  xs: "320px",
6041
6041
  sm: "576px",
6042
6042
  md: "768px",
@@ -6044,101 +6044,89 @@ I(v, "breakpoints", {
6044
6044
  xl: "1200px",
6045
6045
  "2xl": "1400px"
6046
6046
  });
6047
- class X extends $ {
6048
- constructor() {
6049
- super(), this._stateManager = null, this.viewData = null, this.config = {
6050
- maxEventsToShow: 3
6051
- }, this._registryCheckInterval = null;
6052
- }
6053
- connectedCallback() {
6054
- super.connectedCallback(), console.log("[MonthView] connectedCallback - starting registry polling"), this._startRegistryPolling();
6055
- }
6056
- disconnectedCallback() {
6057
- super.disconnectedCallback(), this._stopRegistryPolling();
6058
- }
6059
- _startRegistryPolling() {
6060
- this._checkRegistry();
6061
- let e = 0;
6062
- this._registryCheckInterval = setInterval(() => {
6063
- if (e++, this._stateManager || e > 50) {
6064
- this._stopRegistryPolling();
6065
- return;
6066
- }
6067
- this._checkRegistry();
6068
- }, 100);
6069
- }
6070
- _stopRegistryPolling() {
6071
- this._registryCheckInterval && (clearInterval(this._registryCheckInterval), this._registryCheckInterval = null);
6047
+ class H {
6048
+ /**
6049
+ * @param {HTMLElement} container - The DOM element to render into
6050
+ * @param {StateManager} stateManager - The state manager instance
6051
+ */
6052
+ constructor(e, t) {
6053
+ this.container = e, this.stateManager = t, this._listeners = [], this._scrolled = !1;
6072
6054
  }
6073
- _checkRegistry() {
6074
- const e = this.getAttribute("data-state-registry");
6075
- if (console.log("[MonthView] Checking registry for ID:", e), e && window.__forceCalendarRegistry && window.__forceCalendarRegistry[e]) {
6076
- const t = window.__forceCalendarRegistry[e];
6077
- console.log("[MonthView] Found stateManager in registry"), this._stopRegistryPolling(), this.setStateManager(t);
6078
- }
6055
+ /**
6056
+ * Render the view into the container
6057
+ * Must be implemented by subclasses
6058
+ */
6059
+ render() {
6060
+ throw new Error("render() must be implemented by subclass");
6079
6061
  }
6080
- set stateManager(e) {
6081
- console.log("[MonthView] stateManager setter called with:", !!e), this.setStateManager(e);
6062
+ /**
6063
+ * Clean up event listeners
6064
+ */
6065
+ cleanup() {
6066
+ this._listeners.forEach(({ element: e, event: t, handler: s }) => {
6067
+ e.removeEventListener(t, s);
6068
+ }), this._listeners = [];
6082
6069
  }
6083
- // Method alternative for Salesforce Locker Service compatibility
6084
- setStateManager(e) {
6085
- if (console.log("[MonthView] setStateManager method called with:", !!e), this._stateManager === e) {
6086
- console.log("[MonthView] stateManager already set, skipping");
6087
- return;
6088
- }
6089
- this._stateManager = e, e && (console.log("[MonthView] Subscribing to state changes and loading view data"), this.unsubscribe = e.subscribe(this.handleStateUpdate.bind(this)), this.loadViewData());
6070
+ /**
6071
+ * Add an event listener with automatic cleanup tracking
6072
+ * @param {HTMLElement} element
6073
+ * @param {string} event
6074
+ * @param {Function} handler
6075
+ */
6076
+ addListener(e, t, s) {
6077
+ const i = s.bind(this);
6078
+ e.addEventListener(t, i), this._listeners.push({ element: e, event: t, handler: i });
6090
6079
  }
6091
- get stateManager() {
6092
- return this._stateManager;
6080
+ /**
6081
+ * Escape HTML to prevent XSS
6082
+ * @param {string} str
6083
+ * @returns {string}
6084
+ */
6085
+ escapeHTML(e) {
6086
+ return e == null ? "" : L.escapeHTML(String(e));
6093
6087
  }
6094
- handleStateUpdate(e, t) {
6095
- if (e.currentDate !== t.currentDate) {
6096
- this.loadViewData();
6097
- return;
6098
- }
6099
- e.events !== t.events && this.updateEvents(), e.selectedDate !== t.selectedDate && this.updateSelection(e.selectedDate, t.selectedDate);
6088
+ /**
6089
+ * Check if a date is today
6090
+ * @param {Date} date
6091
+ * @returns {boolean}
6092
+ */
6093
+ isToday(e) {
6094
+ const t = /* @__PURE__ */ new Date();
6095
+ return e.getDate() === t.getDate() && e.getMonth() === t.getMonth() && e.getFullYear() === t.getFullYear();
6100
6096
  }
6101
- updateEvents() {
6102
- this.loadViewData();
6097
+ /**
6098
+ * Check if two dates are the same day
6099
+ * @param {Date} date1
6100
+ * @param {Date} date2
6101
+ * @returns {boolean}
6102
+ */
6103
+ isSameDay(e, t) {
6104
+ return e.getDate() === t.getDate() && e.getMonth() === t.getMonth() && e.getFullYear() === t.getFullYear();
6103
6105
  }
6104
- updateSelection(e, t) {
6105
- if (t) {
6106
- const s = this.shadowRoot.querySelector(`[data-date^="${t.toISOString().split("T")[0]}"]`);
6107
- s && s.classList.remove("selected");
6108
- }
6109
- if (e) {
6110
- const s = this.shadowRoot.querySelector(`[data-date^="${e.toISOString().split("T")[0]}"]`);
6111
- s && s.classList.add("selected");
6112
- }
6106
+ /**
6107
+ * Format hour for display (e.g., "9 AM", "2 PM")
6108
+ * @param {number} hour - Hour in 24-hour format (0-23)
6109
+ * @returns {string}
6110
+ */
6111
+ formatHour(e) {
6112
+ const t = e >= 12 ? "PM" : "AM";
6113
+ return `${e % 12 || 12} ${t}`;
6113
6114
  }
6114
- loadViewData() {
6115
- if (console.log("[MonthView] loadViewData called, stateManager:", !!this.stateManager), !this.stateManager) return;
6116
- const e = this.stateManager.getViewData();
6117
- console.log("[MonthView] viewData from stateManager:", e), this.viewData = this.processViewData(e), console.log("[MonthView] processed viewData:", this.viewData), this.render(), console.log("[MonthView] render completed");
6118
- }
6119
- processViewData(e) {
6120
- var i, r;
6121
- if (!e || !e.weeks) return null;
6122
- const t = (r = (i = this.stateManager) == null ? void 0 : i.getState()) == null ? void 0 : r.selectedDate, s = e.weeks.map((n) => n.days.map((a) => {
6123
- const o = new Date(a.date), c = t && o.toDateString() === t.toDateString(), l = a.events.map((d) => ({
6124
- ...d,
6125
- textColor: this.getContrastingTextColor(d.backgroundColor)
6126
- }));
6127
- return {
6128
- ...a,
6129
- date: o,
6130
- isOtherMonth: !a.isCurrentMonth,
6131
- isSelected: c,
6132
- events: l
6133
- };
6134
- }));
6135
- return {
6136
- ...e,
6137
- weeks: s,
6138
- month: e.month,
6139
- year: e.year
6140
- };
6115
+ /**
6116
+ * Format time for display (e.g., "9 AM", "2:30 PM")
6117
+ * @param {Date} date
6118
+ * @returns {string}
6119
+ */
6120
+ formatTime(e) {
6121
+ const t = e.getHours(), s = e.getMinutes(), i = t >= 12 ? "PM" : "AM", r = t % 12 || 12;
6122
+ return s === 0 ? `${r} ${i}` : `${r}:${s.toString().padStart(2, "0")} ${i}`;
6141
6123
  }
6124
+ /**
6125
+ * Get contrasting text color for a background color
6126
+ * Uses WCAG luminance formula
6127
+ * @param {string} bgColor - Hex color string
6128
+ * @returns {string} 'black' or 'white'
6129
+ */
6142
6130
  getContrastingTextColor(e) {
6143
6131
  if (!e || typeof e != "string") return "white";
6144
6132
  const t = e.charAt(0) === "#" ? e.substring(1) : e;
@@ -6150,1019 +6138,385 @@ class X extends $ {
6150
6138
  const o = [i / 255, r / 255, n / 255].map((l) => l <= 0.03928 ? l / 12.92 : Math.pow((l + 0.055) / 1.055, 2.4));
6151
6139
  return 0.2126 * o[0] + 0.7152 * o[1] + 0.0722 * o[2] > 0.179 ? "black" : "white";
6152
6140
  }
6153
- isSelectedDate(e) {
6154
- var s, i;
6155
- const t = (i = (s = this.stateManager) == null ? void 0 : s.getState()) == null ? void 0 : i.selectedDate;
6156
- return t && e.toDateString() === t.toDateString();
6141
+ /**
6142
+ * Render the "now" indicator line for time-based views
6143
+ * @returns {string} HTML string
6144
+ */
6145
+ renderNowIndicator() {
6146
+ const e = /* @__PURE__ */ new Date();
6147
+ return `<div class="fc-now-indicator" style="position: absolute; left: 0; right: 0; top: ${e.getHours() * 60 + e.getMinutes()}px; height: 2px; background: #dc2626; z-index: 15; pointer-events: none;"></div>`;
6157
6148
  }
6158
- getStyles() {
6149
+ /**
6150
+ * Render a timed event block
6151
+ * @param {Object} event - Event object
6152
+ * @param {Object} options - Rendering options
6153
+ * @returns {string} HTML string
6154
+ */
6155
+ renderTimedEvent(e, t = {}) {
6156
+ const { compact: s = !0 } = t, i = new Date(e.start), r = new Date(e.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), s ? 20 : 30), o = e.backgroundColor || "#2563eb", c = s ? "4px 8px" : "8px 12px", l = s ? "11px" : "13px", h = s ? "2px" : "12px", d = s ? "2px" : "24px", p = s ? "4px" : "6px";
6159
6157
  return `
6160
- :host {
6161
- display: block;
6162
- height: 100%;
6163
- }
6164
-
6165
- .month-view {
6166
- display: flex;
6167
- flex-direction: column;
6168
- height: 100%;
6169
- background: var(--fc-background);
6170
- }
6171
-
6172
- .month-header {
6173
- display: grid;
6174
- grid-template-columns: repeat(7, 1fr);
6175
- background: var(--fc-background);
6176
- border-bottom: 1px solid var(--fc-border-color);
6177
- z-index: 5;
6178
- }
6179
-
6180
- .month-header-cell {
6181
- padding: var(--fc-spacing-sm);
6182
- text-align: left; /* Align with dates */
6183
- font-weight: var(--fc-font-weight-bold);
6184
- font-size: 10px;
6185
- color: var(--fc-text-light);
6186
- text-transform: uppercase;
6187
- letter-spacing: 0.1em;
6188
- border-left: 1px solid transparent; /* Alignment hack */
6189
- padding-left: 8px;
6190
- }
6191
-
6192
- .month-body {
6193
- flex: 1;
6194
- display: flex;
6195
- flex-direction: column;
6196
- overflow: hidden;
6197
- }
6198
-
6199
- .month-week {
6200
- flex: 1;
6201
- display: grid;
6202
- grid-template-columns: repeat(7, 1fr);
6203
- border-bottom: 1px solid var(--fc-border-color);
6204
- }
6205
-
6206
- .month-week:last-child {
6207
- border-bottom: none;
6208
- }
6209
-
6210
- .month-day {
6211
- background: var(--fc-background);
6212
- padding: 4px;
6213
- position: relative;
6214
- cursor: default;
6215
- overflow: hidden;
6216
- min-height: 80px;
6217
- border-right: 1px solid var(--fc-border-color);
6218
- display: flex;
6219
- flex-direction: column;
6220
- min-width: 0; /* Critical for Grid Item shrinking */
6221
- }
6222
-
6223
- .month-day:last-child {
6224
- border-right: none;
6225
- }
6226
-
6227
- .month-day:hover {
6228
- background: var(--fc-background-alt);
6229
- }
6230
-
6231
- .month-day.other-month {
6232
- background: var(--fc-background-alt);
6233
- background-image: linear-gradient(45deg, #f9fafb 25%, transparent 25%, transparent 50%, #f9fafb 50%, #f9fafb 75%, transparent 75%, transparent);
6234
- background-size: 10px 10px;
6235
- }
6236
-
6237
- .month-day.other-month .day-number {
6238
- color: var(--fc-text-light);
6239
- opacity: 0.5;
6240
- }
6241
-
6242
- .month-day.selected {
6243
- background: var(--fc-background-hover);
6244
- }
6245
-
6246
- .day-header {
6247
- display: flex;
6248
- align-items: center;
6249
- justify-content: space-between;
6250
- padding: 4px;
6251
- margin-bottom: 2px;
6252
- }
6253
-
6254
- .day-number {
6255
- font-size: 12px;
6256
- font-family: var(--fc-font-family); /* Ensure monospaced feel if available */
6257
- font-weight: var(--fc-font-weight-medium);
6258
- color: var(--fc-text-color);
6259
- line-height: 1;
6260
- }
6261
-
6262
- .month-day.today .day-number {
6263
- color: white;
6264
- background: var(--fc-danger-color); /* Red for Today (Calendar standard) */
6265
- width: 20px;
6266
- height: 20px;
6267
- display: flex;
6268
- align-items: center;
6269
- justify-content: center;
6270
- border-radius: 50%;
6271
- margin-left: -4px; /* Optical adjustment */
6272
- }
6273
-
6274
- .day-events {
6275
- display: flex;
6276
- flex-direction: column;
6277
- gap: 2px;
6278
- flex: 1;
6279
- overflow: hidden;
6280
- }
6281
-
6282
- /* Precision Event Style */
6283
- .event-item {
6284
- font-size: 11px;
6285
- padding: 2px 6px;
6286
- border-radius: 2px; /* Micro rounding */
6287
-
6288
- /* High Contrast */
6289
- background: var(--fc-primary-color);
6290
- color: white;
6291
-
6292
- overflow: hidden;
6293
- text-overflow: ellipsis;
6294
- white-space: nowrap;
6295
- cursor: pointer;
6296
- line-height: 1.3;
6297
- font-weight: var(--fc-font-weight-medium);
6298
- margin: 0 1px;
6299
- border: 1px solid rgba(0,0,0,0.05); /* Subtle border for definition */
6300
- }
6301
-
6302
- .event-item:hover {
6303
- opacity: 0.9;
6304
- }
6305
-
6306
- .event-time {
6307
- font-weight: var(--fc-font-weight-bold);
6308
- margin-right: 4px;
6309
- opacity: 0.9;
6310
- font-size: 10px;
6311
- }
6312
-
6313
- .more-events {
6314
- font-size: 10px;
6315
- color: var(--fc-text-secondary);
6316
- cursor: pointer;
6317
- padding: 1px 4px;
6318
- font-weight: var(--fc-font-weight-medium);
6319
- text-align: right;
6320
- }
6321
-
6322
- .more-events:hover {
6323
- color: var(--fc-text-color);
6324
- text-decoration: underline;
6325
- }
6326
-
6327
- /* Responsive adjustments */
6328
- @media (max-width: 768px) {
6329
- .month-day {
6330
- min-height: 60px;
6331
- padding: 2px;
6332
- }
6333
-
6334
- .day-number {
6335
- font-size: 11px;
6336
- }
6337
-
6338
- .event-item {
6339
- font-size: 10px;
6340
- padding: 1px 3px;
6341
- }
6342
-
6343
- .month-header-cell {
6344
- font-size: 9px;
6345
- padding: 4px;
6346
- }
6347
- }
6348
-
6349
- /* Loading state */
6350
- .month-loading {
6351
- display: flex;
6352
- align-items: center;
6353
- justify-content: center;
6354
- height: 100%;
6355
- color: var(--fc-text-secondary);
6356
- font-weight: var(--fc-font-weight-medium);
6357
- }
6358
-
6359
- /* Empty state */
6360
- .month-empty {
6361
- display: flex;
6362
- flex-direction: column;
6363
- align-items: center;
6364
- justify-content: center;
6365
- height: 100%;
6366
- color: var(--fc-text-secondary);
6367
- gap: var(--fc-spacing-md);
6368
- }
6369
-
6370
- .empty-icon {
6371
- width: 48px;
6372
- height: 48px;
6373
- opacity: 0.3;
6374
- }
6158
+ <div class="fc-event fc-timed-event" data-event-id="${this.escapeHTML(e.id)}"
6159
+ style="position: absolute; top: ${n}px; height: ${a}px;
6160
+ left: ${h}; right: ${d};
6161
+ background-color: ${o}; border-radius: ${p};
6162
+ padding: ${c}; font-size: ${l};
6163
+ font-weight: 500; color: white; overflow: hidden;
6164
+ box-shadow: 0 1px 2px rgba(0,0,0,0.1);
6165
+ cursor: pointer; z-index: 5;">
6166
+ <div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
6167
+ ${this.escapeHTML(e.title)}
6168
+ </div>
6169
+ <div style="font-size: ${s ? "10px" : "11px"}; opacity: 0.9;">
6170
+ ${this.formatTime(i)}${s ? "" : " - " + this.formatTime(r)}
6171
+ </div>
6172
+ </div>
6375
6173
  `;
6376
6174
  }
6377
- template() {
6378
- return this.viewData ? `
6379
- <div class="month-view">
6380
- ${this.renderHeader()}
6381
- ${this.renderBody()}
6382
- </div>
6383
- ` : `
6384
- <div class="month-view">
6385
- <div class="month-loading">Loading calendar...</div>
6175
+ /**
6176
+ * Attach common event handlers for day/event clicks
6177
+ */
6178
+ attachCommonEventHandlers() {
6179
+ this.container.querySelectorAll(".fc-event").forEach((e) => {
6180
+ this.addListener(e, "click", (t) => {
6181
+ t.stopPropagation();
6182
+ const s = e.dataset.eventId, i = this.stateManager.getEvents().find((r) => r.id === s);
6183
+ i && this.stateManager.selectEvent(i);
6184
+ });
6185
+ });
6186
+ }
6187
+ }
6188
+ class E extends H {
6189
+ constructor(e, t) {
6190
+ super(e, t), this.maxEventsToShow = 3;
6191
+ }
6192
+ render() {
6193
+ if (!this.container || !this.stateManager) return;
6194
+ const e = this.stateManager.getViewData();
6195
+ if (!e || !e.weeks) {
6196
+ this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #666;">No data available for month view.</div>';
6197
+ return;
6198
+ }
6199
+ this.cleanup();
6200
+ const t = this.stateManager.getState().config, s = this._renderMonthView(e, t);
6201
+ this.container.innerHTML = s, this._attachEventHandlers();
6202
+ }
6203
+ _renderMonthView(e, t) {
6204
+ const s = t.weekStartsOn || 0;
6205
+ let r = `
6206
+ <div class="fc-month-view" style="display: flex; flex-direction: column; height: 100%; min-height: 400px; background: #fff; border: 1px solid #e5e7eb;">
6207
+ <div class="fc-month-header" style="display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; background: #f9fafb;">
6208
+ ${this._getDayNames(s).map((n) => `<div class="fc-month-header-cell" style="padding: 12px 8px; text-align: center; font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase;">${n}</div>`).join("")}
6386
6209
  </div>
6387
- `;
6210
+ <div class="fc-month-body" style="display: flex; flex-direction: column; flex: 1;">
6211
+ `;
6212
+ return e.weeks.forEach((n) => {
6213
+ r += this._renderWeek(n);
6214
+ }), r += "</div></div>", r;
6388
6215
  }
6389
- renderHeader() {
6390
- const { config: e } = this.stateManager.getState(), t = [], s = e.weekStartsOn || 0;
6216
+ _getDayNames(e) {
6217
+ const t = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], s = [];
6391
6218
  for (let i = 0; i < 7; i++) {
6392
- const r = (s + i) % 7, n = x.getDayAbbreviation(r, e.locale);
6393
- t.push(`<div class="month-header-cell">${n}</div>`);
6219
+ const r = (e + i) % 7;
6220
+ s.push(t[r]);
6394
6221
  }
6395
- return `
6396
- <div class="month-header">
6397
- ${t.join("")}
6398
- </div>
6399
- `;
6222
+ return s;
6400
6223
  }
6401
- renderBody() {
6402
- return !this.viewData.weeks || this.viewData.weeks.length === 0 ? `
6403
- <div class="month-body">
6404
- <div class="month-empty">
6405
- <svg class="empty-icon" viewBox="0 0 24 24">
6406
- <path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11z"/>
6407
- </svg>
6408
- <p>No calendar data available</p>
6409
- </div>
6224
+ _renderWeek(e) {
6225
+ let t = '<div class="fc-month-week" style="display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; min-height: 80px;">';
6226
+ return e.days.forEach((s) => {
6227
+ t += this._renderDay(s);
6228
+ }), t += "</div>", t;
6229
+ }
6230
+ _renderDay(e) {
6231
+ const t = !e.isCurrentMonth, s = e.isToday, i = t ? "#f3f4f6" : "#fff", r = t ? "#9ca3af" : "#111827", n = s ? "background: #2563eb; color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;" : "", a = e.events || [], o = a.slice(0, this.maxEventsToShow), c = a.length - this.maxEventsToShow;
6232
+ return `
6233
+ <div class="fc-month-day" data-date="${e.date}"
6234
+ style="background: ${i}; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 4px; min-height: 80px; cursor: pointer; display: flex; flex-direction: column;">
6235
+ <div class="fc-day-number" style="font-size: 13px; font-weight: 500; color: ${r}; padding: 2px 4px; margin-bottom: 4px; ${n}">
6236
+ ${e.dayOfMonth}
6237
+ </div>
6238
+ <div class="fc-day-events" style="display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: hidden;">
6239
+ ${o.map((l) => this._renderEvent(l)).join("")}
6240
+ ${c > 0 ? `<div class="fc-more-events" style="font-size: 10px; color: #6b7280; padding: 2px 4px; font-weight: 500;">+${c} more</div>` : ""}
6410
6241
  </div>
6411
- ` : `
6412
- <div class="month-body">
6413
- ${this.viewData.weeks.map((t) => this.renderWeek(t)).join("")}
6414
6242
  </div>
6415
6243
  `;
6416
6244
  }
6417
- renderWeek(e) {
6245
+ _renderEvent(e) {
6246
+ const t = e.backgroundColor || "#2563eb";
6418
6247
  return `
6419
- <div class="month-week">
6420
- ${e.map((s) => this.renderDay(s)).join("")}
6248
+ <div class="fc-event" data-event-id="${this.escapeHTML(e.id)}"
6249
+ style="background-color: ${t}; font-size: 11px; padding: 2px 6px; border-radius: 3px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;">
6250
+ ${this.escapeHTML(e.title)}
6421
6251
  </div>
6422
6252
  `;
6423
6253
  }
6424
- renderDay(e) {
6425
- const { date: t, dayOfMonth: s, isOtherMonth: i, isToday: r, isSelected: n, isWeekend: a, events: o = [] } = e, c = s, l = ["month-day"];
6426
- i && l.push("other-month"), r && l.push("today"), n && l.push("selected"), a && l.push("weekend");
6427
- const d = o.slice(0, this.config.maxEventsToShow), h = o.length - this.config.maxEventsToShow, g = d.map((f) => this.renderEvent(f)).join(""), w = h > 0 ? `<div class="more-events">+${h} more</div>` : "";
6428
- return `
6429
- <div class="${l.join(" ")}"
6430
- data-date="${t.toISOString()}"
6431
- data-day="${c}">
6432
- <div class="day-header">
6433
- <span class="day-number">${c}</span>
6434
- </div>
6435
- <div class="day-events">
6436
- ${g}
6437
- ${w}
6438
- </div>
6439
- </div>
6440
- `;
6441
- }
6442
- renderEvent(e) {
6443
- const { title: t, start: s, allDay: i, backgroundColor: r, textColor: n } = e;
6444
- let a = "";
6445
- if (r) {
6446
- const l = v.sanitizeColor(r), d = v.sanitizeColor(n, "white");
6447
- a += `background-color: ${l}; color: ${d};`;
6448
- }
6449
- let o = "";
6450
- !i && s && (o = x.formatTime(new Date(s), !1, !1));
6451
- const c = ["event-item"];
6452
- return i && c.push("all-day"), `
6453
- <div class="${c.join(" ")}"
6454
- style="${a}"
6455
- data-event-id="${e.id}"
6456
- title="${C.escapeHTML(t)}">
6457
- ${o ? `<span class="event-time">${o}</span>` : ""}
6458
- <span class="event-title">${C.escapeHTML(t)}</span>
6459
- </div>
6460
- `;
6461
- }
6462
- afterRender() {
6463
- this.$$(".month-day").forEach((e) => {
6464
- this.addListener(e, "click", this.handleDayClick);
6465
- }), this.$$(".event-item").forEach((e) => {
6466
- this.addListener(e, "click", this.handleEventClick);
6467
- }), this.$$(".more-events").forEach((e) => {
6468
- this.addListener(e, "click", this.handleMoreClick);
6469
- });
6470
- }
6471
- handleDayClick(e) {
6472
- e.stopPropagation();
6473
- const t = e.currentTarget, s = new Date(t.dataset.date);
6474
- this.stateManager.selectDate(s), this.emit("day-click", { date: s });
6475
- }
6476
- handleEventClick(e) {
6477
- e.stopPropagation();
6478
- const s = e.currentTarget.dataset.eventId, i = this.stateManager.getEvents().find((r) => r.id === s);
6479
- i && (this.stateManager.selectEvent(i), this.emit("event-click", { event: i }));
6480
- }
6481
- handleMoreClick(e) {
6482
- e.stopPropagation();
6483
- const t = e.currentTarget.closest(".month-day"), s = new Date(t.dataset.date), i = this.stateManager.getEventsForDate(s);
6484
- this.emit("more-events-click", { date: s, events: i });
6485
- }
6486
- unmount() {
6487
- this.unsubscribe && this.unsubscribe();
6254
+ _attachEventHandlers() {
6255
+ this.container.querySelectorAll(".fc-month-day").forEach((e) => {
6256
+ this.addListener(e, "click", (t) => {
6257
+ if (t.target.closest(".fc-event")) return;
6258
+ const s = new Date(e.dataset.date);
6259
+ this.stateManager.selectDate(s);
6260
+ });
6261
+ }), this.attachCommonEventHandlers();
6488
6262
  }
6489
6263
  }
6490
- class ee extends $ {
6491
- constructor() {
6492
- super(), this._stateManager = null, this.viewData = null, this.hours = Array.from({ length: 24 }, (e, t) => t), this._registryCheckInterval = null;
6493
- }
6494
- connectedCallback() {
6495
- super.connectedCallback(), this._startRegistryPolling();
6496
- }
6497
- disconnectedCallback() {
6498
- super.disconnectedCallback(), this._registryCheckInterval && clearInterval(this._registryCheckInterval);
6499
- }
6500
- _startRegistryPolling() {
6501
- this._checkRegistry();
6502
- let e = 0;
6503
- this._registryCheckInterval = setInterval(() => {
6504
- if (e++, this._stateManager || e > 50) {
6505
- clearInterval(this._registryCheckInterval);
6506
- return;
6507
- }
6508
- this._checkRegistry();
6509
- }, 100);
6510
- }
6511
- _checkRegistry() {
6512
- const e = this.getAttribute("data-state-registry");
6513
- e && window.__forceCalendarRegistry && window.__forceCalendarRegistry[e] && (clearInterval(this._registryCheckInterval), this.setStateManager(window.__forceCalendarRegistry[e]));
6264
+ class z extends H {
6265
+ constructor(e, t) {
6266
+ super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
6514
6267
  }
6515
- set stateManager(e) {
6516
- this.setStateManager(e);
6517
- }
6518
- setStateManager(e) {
6519
- this._stateManager !== e && (this._stateManager = e, e && (this.unsubscribe = e.subscribe(this.handleStateUpdate.bind(this)), this.loadViewData()));
6520
- }
6521
- get stateManager() {
6522
- return this._stateManager;
6523
- }
6524
- handleStateUpdate(e, t) {
6525
- if (e.currentDate !== (t == null ? void 0 : t.currentDate) || e.view !== (t == null ? void 0 : t.view)) {
6526
- this.loadViewData();
6268
+ render() {
6269
+ if (!this.container || !this.stateManager) return;
6270
+ const e = this.stateManager.getViewData();
6271
+ if (!e || !e.days || e.days.length === 0) {
6272
+ this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #666;">No data available for week view.</div>';
6527
6273
  return;
6528
6274
  }
6529
- e.events !== (t == null ? void 0 : t.events) && this.loadViewData(), e.selectedDate !== (t == null ? void 0 : t.selectedDate) && this.updateSelection(e.selectedDate, t == null ? void 0 : t.selectedDate);
6530
- }
6531
- updateSelection(e, t) {
6532
- if (t) {
6533
- const s = this.shadowRoot.querySelector(`[data-date^="${t.toISOString().split("T")[0]}"]`);
6534
- s && s.classList.remove("selected");
6535
- }
6536
- if (e) {
6537
- const s = this.shadowRoot.querySelector(`[data-date^="${e.toISOString().split("T")[0]}"]`);
6538
- s && s.classList.add("selected");
6539
- }
6540
- }
6541
- loadViewData() {
6542
- if (!this.stateManager) return;
6543
- const e = this.stateManager.getViewData();
6544
- this.viewData = this.processViewData(e), this.render();
6545
- }
6546
- processViewData(e) {
6547
- if (!e) return null;
6548
- let t = [];
6549
- return e.weeks && e.weeks.length > 0 ? t = e.weeks[0].days : e.days && (t = e.days), !t || t.length === 0 ? null : {
6550
- ...e,
6551
- days: t.map((s) => {
6552
- const i = new Date(s.date);
6553
- return {
6554
- ...s,
6555
- date: i,
6556
- isToday: x.isToday(i),
6557
- timedEvents: (s.events || []).filter((r) => !r.allDay),
6558
- allDayEvents: (s.events || []).filter((r) => r.allDay)
6559
- };
6560
- })
6561
- };
6275
+ this.cleanup();
6276
+ const t = this.stateManager.getState().config, s = this._renderWeekView(e, t);
6277
+ this.container.innerHTML = s, this._attachEventHandlers(), this._scrollToCurrentTime();
6562
6278
  }
6563
- getStyles() {
6279
+ _renderWeekView(e, t) {
6280
+ const s = e.days, i = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], r = Array.from({ length: 24 }, (a, o) => o), n = s.map((a) => {
6281
+ const o = new Date(a.date), c = a.events || [];
6282
+ return {
6283
+ ...a,
6284
+ date: o,
6285
+ dayName: i[o.getDay()],
6286
+ dayOfMonth: o.getDate(),
6287
+ isToday: this.isToday(o),
6288
+ timedEvents: c.filter((l) => !l.allDay),
6289
+ allDayEvents: c.filter((l) => l.allDay)
6290
+ };
6291
+ });
6564
6292
  return `
6565
- :host {
6566
- display: flex;
6567
- flex-direction: column;
6568
- height: 100%;
6569
- min-height: 0;
6570
- }
6571
-
6572
- .week-view {
6573
- display: flex;
6574
- flex-direction: column;
6575
- height: 100%;
6576
- background: var(--fc-background);
6577
- min-height: 0;
6578
- overflow: hidden;
6579
- }
6580
-
6581
- /* Header Section */
6582
- .week-header {
6583
- display: grid;
6584
- grid-template-columns: 60px repeat(7, 1fr);
6585
- border-bottom: 1px solid var(--fc-border-color);
6586
- background: var(--fc-background);
6587
- z-index: 20;
6588
- flex-shrink: 0;
6589
- }
6590
-
6591
- .day-column-header {
6592
- padding: 12px 8px;
6593
- text-align: center;
6594
- border-right: 1px solid var(--fc-border-color);
6595
- display: flex;
6596
- flex-direction: column;
6597
- align-items: center;
6598
- gap: 4px;
6599
- }
6600
-
6601
- .day-name {
6602
- font-size: 10px;
6603
- font-weight: 700;
6604
- color: var(--fc-text-light);
6605
- text-transform: uppercase;
6606
- letter-spacing: 0.1em;
6607
- }
6608
-
6609
- .day-number {
6610
- font-size: 16px;
6611
- font-weight: 500;
6612
- width: 28px;
6613
- height: 28px;
6614
- display: flex;
6615
- align-items: center;
6616
- justify-content: center;
6617
- border-radius: 50%;
6618
- color: var(--fc-text-color);
6619
- }
6620
-
6621
- .is-today .day-number {
6622
- background: var(--fc-danger-color);
6623
- color: white;
6624
- font-weight: 700;
6625
- }
6626
-
6627
- /* All Day Events Row */
6628
- .all-day-row {
6629
- display: grid;
6630
- grid-template-columns: 60px repeat(7, 1fr);
6631
- border-bottom: 1px solid var(--fc-border-color);
6632
- background: var(--fc-background-alt);
6633
- min-height: 32px;
6634
- flex-shrink: 0;
6635
- }
6636
-
6637
- .all-day-label {
6638
- font-size: 9px;
6639
- color: var(--fc-text-light);
6640
- display: flex;
6641
- align-items: center;
6642
- justify-content: center;
6643
- border-right: 1px solid var(--fc-border-color);
6644
- text-transform: uppercase;
6645
- font-weight: 700;
6646
- }
6647
-
6648
- .all-day-cell {
6649
- border-right: 1px solid var(--fc-border-color);
6650
- padding: 4px;
6651
- display: flex;
6652
- flex-direction: column;
6653
- gap: 2px;
6654
- }
6655
-
6656
- /* Body Section */
6657
- .week-body {
6658
- flex: 1;
6659
- overflow-y: auto;
6660
- overflow-x: hidden;
6661
- position: relative;
6662
- display: grid;
6663
- grid-template-columns: 60px repeat(7, 1fr);
6664
- background: var(--fc-background);
6665
- }
6666
-
6667
- .time-gutter {
6668
- border-right: 1px solid var(--fc-border-color);
6669
- background: var(--fc-background-alt);
6670
- height: 1440px;
6671
- }
6672
-
6673
- .time-slot-label {
6674
- height: 60px;
6675
- font-size: 10px;
6676
- color: var(--fc-text-light);
6677
- text-align: right;
6678
- padding-right: 8px;
6679
- font-weight: 500;
6680
- }
6681
-
6682
- .day-column {
6683
- border-right: 1px solid var(--fc-border-color);
6684
- position: relative;
6685
- height: 1440px;
6686
- }
6687
-
6688
- .day-column.selected {
6689
- background: var(--fc-background-hover);
6690
- }
6691
-
6692
- /* Grid Lines Layer */
6693
- .grid-lines {
6694
- position: absolute;
6695
- top: 0;
6696
- left: 60px;
6697
- right: 0;
6698
- bottom: 0;
6699
- pointer-events: none;
6700
- }
6701
-
6702
- .grid-line {
6703
- height: 60px;
6704
- border-bottom: 1px solid var(--fc-border-color);
6705
- width: 100%;
6706
- }
6707
-
6708
- .grid-line:last-child {
6709
- border-bottom: none;
6710
- }
6711
-
6712
- .event-container {
6713
- position: absolute;
6714
- left: 2px;
6715
- right: 2px;
6716
- border-radius: 4px;
6717
- padding: 4px 8px;
6718
- font-size: 11px;
6719
- font-weight: 500;
6720
- color: white;
6721
- background: var(--fc-primary-color);
6722
- border: 1px solid rgba(0,0,0,0.1);
6723
- overflow: hidden;
6724
- box-shadow: var(--fc-shadow-sm);
6725
- cursor: pointer;
6726
- transition: transform 0.1s;
6727
- z-index: 5;
6728
- }
6729
-
6730
- .event-container:hover {
6731
- z-index: 10;
6732
- transform: scale(1.02);
6733
- }
6734
-
6735
- .now-indicator {
6736
- position: absolute;
6737
- left: 0;
6738
- right: 0;
6739
- height: 2px;
6740
- background: var(--fc-danger-color);
6741
- z-index: 15;
6742
- pointer-events: none;
6743
- }
6293
+ <div class="fc-week-view" style="display: flex; flex-direction: column; height: 100%; background: #fff; overflow: hidden;">
6294
+ ${this._renderHeader(n)}
6295
+ ${this._renderAllDayRow(n)}
6296
+ ${this._renderTimeGrid(n, r)}
6297
+ </div>
6744
6298
  `;
6745
6299
  }
6746
- template() {
6747
- return this.viewData ? `
6748
- <div class="week-view">
6749
- <div class="week-header">
6750
- <div class="time-gutter-header"></div>
6751
- ${this.viewData.days.map((e) => `
6752
- <div class="day-column-header ${e.isToday ? "is-today" : ""}">
6753
- <span class="day-name">${x.getDayAbbreviation(e.date.getDay())}</span>
6754
- <span class="day-number">${e.date.getDate()}</span>
6300
+ _renderHeader(e) {
6301
+ return `
6302
+ <div class="fc-week-header" style="display: grid; grid-template-columns: 60px repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; background: #f9fafb; flex-shrink: 0;">
6303
+ <div style="border-right: 1px solid #e5e7eb;"></div>
6304
+ ${e.map((t) => `
6305
+ <div style="padding: 12px 8px; text-align: center; border-right: 1px solid #e5e7eb;">
6306
+ <div style="font-size: 10px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em;">
6307
+ ${t.dayName}
6755
6308
  </div>
6756
- `).join("")}
6757
- </div>
6758
-
6759
- <div class="all-day-row">
6760
- <div class="all-day-label">All day</div>
6761
- ${this.viewData.days.map((e) => `
6762
- <div class="all-day-cell">
6763
- ${e.allDayEvents.map((t) => this.renderAllDayEvent(t)).join("")}
6309
+ <div style="font-size: 16px; font-weight: 500; margin-top: 4px; ${t.isToday ? "background: #dc2626; color: white; border-radius: 50%; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;" : "color: #111827;"}">
6310
+ ${t.dayOfMonth}
6764
6311
  </div>
6765
- `).join("")}
6766
- </div>
6767
-
6768
- <div class="week-body" id="scroll-container">
6769
- <div class="grid-lines">
6770
- ${this.hours.map(() => '<div class="grid-line"></div>').join("")}
6771
6312
  </div>
6772
-
6773
- <div class="time-gutter">
6774
- ${this.hours.map((e) => `
6775
- <div class="time-slot-label">
6776
- ${e === 0 ? "" : x.formatTime((/* @__PURE__ */ new Date()).setHours(e, 0), !1)}
6313
+ `).join("")}
6314
+ </div>
6315
+ `;
6316
+ }
6317
+ _renderAllDayRow(e) {
6318
+ return `
6319
+ <div class="fc-all-day-row" style="display: grid; grid-template-columns: 60px repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; background: #fafafa; min-height: 32px; flex-shrink: 0;">
6320
+ <div style="font-size: 9px; color: #6b7280; display: flex; align-items: center; justify-content: center; border-right: 1px solid #e5e7eb; text-transform: uppercase; font-weight: 700;">
6321
+ All day
6322
+ </div>
6323
+ ${e.map((t) => `
6324
+ <div class="fc-all-day-cell" data-date="${t.date.toISOString()}" style="border-right: 1px solid #e5e7eb; padding: 4px; display: flex; flex-direction: column; gap: 2px;">
6325
+ ${t.allDayEvents.map((s) => `
6326
+ <div class="fc-event fc-all-day-event" data-event-id="${this.escapeHTML(s.id)}"
6327
+ style="background-color: ${s.backgroundColor || "#2563eb"}; font-size: 10px; padding: 2px 4px; border-radius: 2px; color: white; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
6328
+ ${this.escapeHTML(s.title)}
6777
6329
  </div>
6778
6330
  `).join("")}
6779
6331
  </div>
6780
-
6781
- ${this.viewData.days.map((e) => `
6782
- <div class="day-column" data-date="${e.date.toISOString()}">
6783
- ${e.isToday ? this.renderNowIndicator() : ""}
6784
- ${e.timedEvents.map((t) => this.renderTimedEvent(t)).join("")}
6785
- </div>
6786
- `).join("")}
6787
- </div>
6332
+ `).join("")}
6788
6333
  </div>
6789
- ` : '<div class="week-view">Loading...</div>';
6334
+ `;
6790
6335
  }
6791
- renderTimedEvent(e) {
6792
- const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), r = (s - t) / (1e3 * 60), n = i, a = Math.max(r, 20), o = v.sanitizeColor(e.backgroundColor), c = v.sanitizeColor(v.getContrastColor(o), "white");
6336
+ _renderTimeGrid(e, t) {
6793
6337
  return `
6794
- <div class="event-container"
6795
- style="top: ${n}px; height: ${a}px; background-color: ${o}; color: ${c};"
6796
- data-event-id="${e.id}">
6797
- <span class="event-title">${C.escapeHTML(e.title)}</span>
6798
- <span class="event-time">${x.formatTime(t)}</span>
6338
+ <div id="week-scroll-container" class="fc-time-grid-container" style="flex: 1; overflow-y: auto; overflow-x: hidden; position: relative;">
6339
+ <div class="fc-time-grid" style="display: grid; grid-template-columns: 60px repeat(7, 1fr); position: relative; height: ${this.totalHeight}px;">
6340
+ ${this._renderTimeGutter(t)}
6341
+ ${e.map((s) => this._renderDayColumn(s, t)).join("")}
6342
+ </div>
6799
6343
  </div>
6800
6344
  `;
6801
6345
  }
6802
- renderAllDayEvent(e) {
6803
- const t = v.sanitizeColor(e.backgroundColor), s = v.sanitizeColor(v.getContrastColor(t), "white");
6346
+ _renderTimeGutter(e) {
6804
6347
  return `
6805
- <div class="event-item"
6806
- style="background-color: ${t}; color: ${s}; font-size: 10px; padding: 2px 4px; border-radius: 2px; cursor: pointer; margin-bottom: 2px;"
6807
- data-event-id="${e.id}">
6808
- ${C.escapeHTML(e.title)}
6348
+ <div class="fc-time-gutter" style="border-right: 1px solid #e5e7eb; background: #fafafa;">
6349
+ ${e.map((t) => `
6350
+ <div style="height: ${this.hourHeight}px; font-size: 10px; color: #6b7280; text-align: right; padding-right: 8px; font-weight: 500;">
6351
+ ${t === 0 ? "" : this.formatHour(t)}
6352
+ </div>
6353
+ `).join("")}
6809
6354
  </div>
6810
6355
  `;
6811
6356
  }
6812
- renderNowIndicator() {
6813
- const e = /* @__PURE__ */ new Date();
6814
- return `<div class="now-indicator" style="top: ${e.getHours() * 60 + e.getMinutes()}px"></div>`;
6357
+ _renderDayColumn(e, t) {
6358
+ return `
6359
+ <div class="fc-week-day-column" data-date="${e.date.toISOString()}" style="border-right: 1px solid #e5e7eb; position: relative; cursor: pointer;">
6360
+ <!-- Hour grid lines -->
6361
+ ${t.map(() => `<div style="height: ${this.hourHeight}px; border-bottom: 1px solid #f3f4f6;"></div>`).join("")}
6362
+
6363
+ <!-- Now indicator for today -->
6364
+ ${e.isToday ? this.renderNowIndicator() : ""}
6365
+
6366
+ <!-- Timed events -->
6367
+ ${e.timedEvents.map((s) => this.renderTimedEvent(s, { compact: !0 })).join("")}
6368
+ </div>
6369
+ `;
6815
6370
  }
6816
- afterRender() {
6817
- const e = this.$("#scroll-container");
6818
- e && !this._scrolled && (e.scrollTop = 8 * 60 - 50, this._scrolled = !0), this.$$("[data-event-id]").forEach((t) => {
6819
- this.addListener(t, "click", (s) => {
6820
- s.stopPropagation();
6821
- const i = s.currentTarget.dataset.eventId, r = this.stateManager.getEvents().find((n) => n.id === i);
6822
- r && this.emit("event-click", { event: r });
6823
- });
6824
- }), this.$$(".day-column").forEach((t) => {
6825
- this.addListener(t, "click", (s) => {
6826
- const i = s.currentTarget, r = this.$("#scroll-container"), n = i.getBoundingClientRect(), a = s.clientY - n.top + (r ? r.scrollTop : 0), o = new Date(i.dataset.date);
6827
- o.setHours(Math.floor(a / 60), Math.floor(a % 60), 0, 0), this.stateManager.selectDate(o), this.emit("day-click", { date: o });
6371
+ _attachEventHandlers() {
6372
+ this.container.querySelectorAll(".fc-week-day-column").forEach((e) => {
6373
+ this.addListener(e, "click", (t) => {
6374
+ if (t.target.closest(".fc-event")) return;
6375
+ const s = new Date(e.dataset.date), i = e.getBoundingClientRect(), r = this.container.querySelector("#week-scroll-container"), n = t.clientY - i.top + (r ? r.scrollTop : 0);
6376
+ s.setHours(Math.floor(n / this.hourHeight), Math.floor(n % this.hourHeight / (this.hourHeight / 60)), 0, 0), this.stateManager.selectDate(s);
6828
6377
  });
6829
- });
6378
+ }), this.attachCommonEventHandlers();
6830
6379
  }
6831
- unmount() {
6832
- this.unsubscribe && this.unsubscribe();
6380
+ _scrollToCurrentTime() {
6381
+ if (this._scrolled) return;
6382
+ const e = this.container.querySelector("#week-scroll-container");
6383
+ e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
6833
6384
  }
6834
6385
  }
6835
- class te extends $ {
6836
- constructor() {
6837
- super(), this._stateManager = null, this.viewData = null, this.hours = Array.from({ length: 24 }, (e, t) => t), this._registryCheckInterval = null;
6838
- }
6839
- connectedCallback() {
6840
- super.connectedCallback(), this._startRegistryPolling();
6386
+ class F extends H {
6387
+ constructor(e, t) {
6388
+ super(e, t), this.hourHeight = 60, this.totalHeight = 24 * this.hourHeight;
6841
6389
  }
6842
- disconnectedCallback() {
6843
- super.disconnectedCallback(), this._registryCheckInterval && clearInterval(this._registryCheckInterval);
6844
- }
6845
- _startRegistryPolling() {
6846
- this._checkRegistry();
6847
- let e = 0;
6848
- this._registryCheckInterval = setInterval(() => {
6849
- if (e++, this._stateManager || e > 50) {
6850
- clearInterval(this._registryCheckInterval);
6851
- return;
6852
- }
6853
- this._checkRegistry();
6854
- }, 100);
6855
- }
6856
- _checkRegistry() {
6857
- const e = this.getAttribute("data-state-registry");
6858
- e && window.__forceCalendarRegistry && window.__forceCalendarRegistry[e] && (clearInterval(this._registryCheckInterval), this.setStateManager(window.__forceCalendarRegistry[e]));
6859
- }
6860
- set stateManager(e) {
6861
- this.setStateManager(e);
6862
- }
6863
- setStateManager(e) {
6864
- this._stateManager !== e && (this._stateManager = e, e && (this.unsubscribe = e.subscribe(this.handleStateUpdate.bind(this)), this.loadViewData()));
6865
- }
6866
- get stateManager() {
6867
- return this._stateManager;
6868
- }
6869
- handleStateUpdate(e, t) {
6870
- if (e.currentDate !== (t == null ? void 0 : t.currentDate) || e.view !== (t == null ? void 0 : t.view)) {
6871
- this.loadViewData();
6390
+ render() {
6391
+ if (!this.container || !this.stateManager) return;
6392
+ const e = this.stateManager.getViewData();
6393
+ if (!e) {
6394
+ this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #666;">No data available for day view.</div>';
6872
6395
  return;
6873
6396
  }
6874
- e.events !== (t == null ? void 0 : t.events) && this.loadViewData(), e.selectedDate !== (t == null ? void 0 : t.selectedDate) && this.updateSelection(e.selectedDate, t == null ? void 0 : t.selectedDate);
6875
- }
6876
- updateSelection(e, t) {
6877
- const s = this.shadowRoot.querySelector(".day-column");
6878
- if (!s) return;
6879
- ((r) => r && x.isSameDay(r, new Date(s.dataset.date)))(e) ? s.classList.add("selected") : s.classList.remove("selected");
6880
- }
6881
- loadViewData() {
6882
- if (!this.stateManager) return;
6883
- const e = this.stateManager.getViewData();
6884
- this.viewData = this.processViewData(e), this.render();
6885
- }
6886
- processViewData(e) {
6887
- var n;
6888
- if (!e) return null;
6889
- let t = null;
6890
- const s = (n = this.stateManager) == null ? void 0 : n.getState(), i = (s == null ? void 0 : s.currentDate) || /* @__PURE__ */ new Date();
6891
- if (e.days && Array.isArray(e.days) && e.days.length > 0)
6892
- t = e.days.find((a) => x.isSameDay(new Date(a.date), i)) || e.days[0];
6893
- else if (e.weeks && Array.isArray(e.weeks) && e.weeks.length > 0) {
6894
- const a = e.weeks.flatMap((o) => o.days || []);
6895
- t = a.find((o) => x.isSameDay(new Date(o.date), i)) || a[0];
6896
- } else e.date && (t = e);
6897
- if (!t) return null;
6898
- const r = new Date(t.date);
6899
- return {
6900
- ...e,
6901
- day: {
6902
- ...t,
6903
- date: r,
6904
- isToday: x.isToday(r),
6905
- timedEvents: (t.events || []).filter((a) => !a.allDay),
6906
- allDayEvents: (t.events || []).filter((a) => a.allDay)
6907
- }
6908
- };
6397
+ this.cleanup();
6398
+ const t = this.stateManager.getState().config, s = this._renderDayView(e, t);
6399
+ this.container.innerHTML = s, this._attachEventHandlers(), this._scrollToCurrentTime();
6909
6400
  }
6910
- getStyles() {
6401
+ _renderDayView(e, t) {
6402
+ var h, d;
6403
+ const s = ((d = (h = this.stateManager) == null ? void 0 : h.getState()) == null ? void 0 : d.currentDate) || /* @__PURE__ */ new Date(), i = this._extractDayData(e, s);
6404
+ if (!i)
6405
+ return '<div style="padding: 20px; text-align: center; color: #666;">No data available for day view.</div>';
6406
+ const { dayDate: r, dayName: n, isToday: a, allDayEvents: o, timedEvents: c } = i, l = Array.from({ length: 24 }, (p, b) => b);
6911
6407
  return `
6912
- :host {
6913
- display: flex;
6914
- flex-direction: column;
6915
- height: 100%;
6916
- min-height: 0;
6917
- }
6918
-
6919
- .day-view {
6920
- display: flex;
6921
- flex-direction: column;
6922
- height: 100%;
6923
- background: var(--fc-background);
6924
- min-height: 0;
6925
- overflow: hidden;
6926
- }
6927
-
6928
- /* Header */
6929
- .day-header {
6930
- display: grid;
6931
- grid-template-columns: 60px 1fr;
6932
- border-bottom: 1px solid var(--fc-border-color);
6933
- background: var(--fc-background);
6934
- z-index: 20;
6935
- flex-shrink: 0;
6936
- }
6937
-
6938
- .day-column-header {
6939
- padding: 16px 24px;
6940
- text-align: left;
6941
- display: flex;
6942
- flex-direction: column;
6943
- gap: 4px;
6944
- }
6945
-
6946
- .day-name {
6947
- font-size: 12px;
6948
- font-weight: 700;
6949
- color: var(--fc-text-light);
6950
- text-transform: uppercase;
6951
- letter-spacing: 0.1em;
6952
- }
6953
-
6954
- .day-number {
6955
- font-size: 24px;
6956
- font-weight: 600;
6957
- color: var(--fc-text-color);
6958
- }
6959
-
6960
- .is-today .day-number {
6961
- color: var(--fc-danger-color);
6962
- }
6963
-
6964
- /* All Day Events */
6965
- .all-day-row {
6966
- display: grid;
6967
- grid-template-columns: 60px 1fr;
6968
- border-bottom: 1px solid var(--fc-border-color);
6969
- background: var(--fc-background-alt);
6970
- min-height: 36px;
6971
- flex-shrink: 0;
6972
- }
6973
-
6974
- .all-day-label {
6975
- font-size: 9px;
6976
- color: var(--fc-text-light);
6977
- display: flex;
6978
- align-items: center;
6979
- justify-content: center;
6980
- border-right: 1px solid var(--fc-border-color);
6981
- text-transform: uppercase;
6982
- font-weight: 700;
6983
- }
6984
-
6985
- .all-day-cell {
6986
- padding: 6px 12px;
6987
- display: flex;
6988
- flex-wrap: wrap;
6989
- gap: 4px;
6990
- }
6991
-
6992
- /* Body */
6993
- .day-body {
6994
- flex: 1;
6995
- overflow-y: auto;
6996
- overflow-x: hidden;
6997
- position: relative;
6998
- display: grid;
6999
- grid-template-columns: 60px 1fr;
7000
- background: var(--fc-background);
7001
- }
7002
-
7003
- .time-gutter {
7004
- border-right: 1px solid var(--fc-border-color);
7005
- background: var(--fc-background-alt);
7006
- height: 1440px;
7007
- }
7008
-
7009
- .time-slot-label {
7010
- height: 60px;
7011
- font-size: 11px;
7012
- color: var(--fc-text-light);
7013
- text-align: right;
7014
- padding-right: 12px;
7015
- font-weight: 500;
7016
- }
7017
-
7018
- .day-column {
7019
- position: relative;
7020
- height: 1440px;
7021
- }
7022
-
7023
- .day-column.selected {
7024
- background: var(--fc-background-hover);
7025
- }
7026
-
7027
- /* Grid Lines */
7028
- .grid-lines {
7029
- position: absolute;
7030
- top: 0;
7031
- left: 60px;
7032
- right: 0;
7033
- bottom: 0;
7034
- pointer-events: none;
7035
- }
7036
-
7037
- .grid-line {
7038
- height: 60px;
7039
- border-bottom: 1px solid var(--fc-border-color);
7040
- width: 100%;
7041
- }
7042
-
7043
- /* Event Style */
7044
- .event-container {
7045
- position: absolute;
7046
- left: 12px;
7047
- right: 24px;
7048
- border-radius: 6px;
7049
- padding: 8px 12px;
7050
- font-size: 13px;
7051
- font-weight: 500;
7052
- color: white;
7053
- background: var(--fc-primary-color);
7054
- border: 1px solid rgba(0,0,0,0.1);
7055
- overflow: hidden;
7056
- box-shadow: var(--fc-shadow);
7057
- cursor: pointer;
7058
- transition: all 0.15s ease;
7059
- z-index: 5;
7060
- }
7061
-
7062
- .event-container:hover {
7063
- z-index: 10;
7064
- transform: translateX(4px);
7065
- }
7066
-
7067
- .now-indicator {
7068
- position: absolute;
7069
- left: 0;
7070
- right: 0;
7071
- height: 2px;
7072
- background: var(--fc-danger-color);
7073
- z-index: 15;
7074
- pointer-events: none;
7075
- }
6408
+ <div class="fc-day-view" style="display: flex; flex-direction: column; height: 100%; background: #fff; overflow: hidden;">
6409
+ ${this._renderHeader(r, n, a)}
6410
+ ${this._renderAllDayRow(o, r)}
6411
+ ${this._renderTimeGrid(c, a, r, l)}
6412
+ </div>
7076
6413
  `;
7077
6414
  }
7078
- template() {
7079
- var i, r, n;
7080
- if (!this.viewData || !this.viewData.day)
7081
- return '<div class="day-view" style="padding: 20px; color: var(--fc-text-light);">No data available.</div>';
7082
- const { day: e } = this.viewData, t = ((n = (r = (i = this.stateManager) == null ? void 0 : i.state) == null ? void 0 : r.config) == null ? void 0 : n.locale) || "en-US", s = x.formatDate(e.date, "day", t).split(" ")[0];
6415
+ _extractDayData(e, t) {
6416
+ let s, i, r, n, a;
6417
+ const o = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
6418
+ if (e.type === "day" && e.date)
6419
+ if (s = new Date(e.date), i = e.dayName || o[s.getDay()], r = e.isToday !== void 0 ? e.isToday : this.isToday(s), n = e.allDayEvents || [], e.hours && Array.isArray(e.hours)) {
6420
+ const c = /* @__PURE__ */ new Map();
6421
+ e.hours.forEach((l) => {
6422
+ (l.events || []).forEach((h) => {
6423
+ c.has(h.id) || c.set(h.id, h);
6424
+ });
6425
+ }), a = Array.from(c.values());
6426
+ } else
6427
+ a = [];
6428
+ else if (e.days && e.days.length > 0) {
6429
+ const c = e.days.find((h) => this.isSameDay(new Date(h.date), t)) || e.days[0];
6430
+ s = new Date(c.date), i = o[s.getDay()], r = this.isToday(s);
6431
+ const l = c.events || [];
6432
+ n = l.filter((h) => h.allDay), a = l.filter((h) => !h.allDay);
6433
+ } else
6434
+ return null;
6435
+ return { dayDate: s, dayName: i, isToday: r, allDayEvents: n, timedEvents: a };
6436
+ }
6437
+ _renderHeader(e, t, s) {
7083
6438
  return `
7084
- <div class="day-view">
7085
- <div class="day-header">
7086
- <div class="time-gutter-header"></div>
7087
- <div class="day-column-header ${e.isToday ? "is-today" : ""}">
7088
- <span class="day-name">${s}</span>
7089
- <span class="day-number">${e.date.getDate()}</span>
6439
+ <div class="fc-day-header" style="display: grid; grid-template-columns: 60px 1fr; border-bottom: 1px solid #e5e7eb; background: #f9fafb; flex-shrink: 0;">
6440
+ <div style="border-right: 1px solid #e5e7eb;"></div>
6441
+ <div style="padding: 16px 24px;">
6442
+ <div style="font-size: 12px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em;">
6443
+ ${t}
7090
6444
  </div>
7091
- </div>
7092
-
7093
- <div class="all-day-row">
7094
- <div class="all-day-label">All day</div>
7095
- <div class="all-day-cell">
7096
- ${e.allDayEvents.map((a) => this.renderAllDayEvent(a)).join("")}
6445
+ <div style="font-size: 24px; font-weight: 600; margin-top: 4px; ${s ? "color: #dc2626;" : "color: #111827;"}">
6446
+ ${e.getDate()}
7097
6447
  </div>
7098
6448
  </div>
7099
-
7100
- <div class="day-body" id="scroll-container">
7101
- <div class="grid-lines">
7102
- ${this.hours.map(() => '<div class="grid-line"></div>').join("")}
7103
- </div>
7104
-
7105
- <div class="time-gutter">
7106
- ${this.hours.map((a) => `
7107
- <div class="time-slot-label">
7108
- ${a === 0 ? "" : x.formatTime((/* @__PURE__ */ new Date()).setHours(a, 0), !1)}
7109
- </div>
7110
- `).join("")}
7111
- </div>
7112
-
7113
- <div class="day-column" data-date="${e.date.toISOString()}">
7114
- ${e.isToday ? this.renderNowIndicator() : ""}
7115
- ${e.timedEvents.map((a) => this.renderTimedEvent(a)).join("")}
7116
- </div>
6449
+ </div>
6450
+ `;
6451
+ }
6452
+ _renderAllDayRow(e, t) {
6453
+ return `
6454
+ <div class="fc-all-day-row" style="display: grid; grid-template-columns: 60px 1fr; border-bottom: 1px solid #e5e7eb; background: #fafafa; min-height: 36px; flex-shrink: 0;">
6455
+ <div style="font-size: 9px; color: #6b7280; display: flex; align-items: center; justify-content: center; border-right: 1px solid #e5e7eb; text-transform: uppercase; font-weight: 700;">
6456
+ All day
6457
+ </div>
6458
+ <div class="fc-all-day-cell" data-date="${t.toISOString()}" style="padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 4px;">
6459
+ ${e.map((s) => `
6460
+ <div class="fc-event fc-all-day-event" data-event-id="${this.escapeHTML(s.id)}"
6461
+ style="background-color: ${s.backgroundColor || "#2563eb"}; font-size: 12px; padding: 4px 8px; border-radius: 4px; color: white; cursor: pointer; font-weight: 500;">
6462
+ ${this.escapeHTML(s.title)}
6463
+ </div>
6464
+ `).join("")}
7117
6465
  </div>
7118
6466
  </div>
7119
6467
  `;
7120
6468
  }
7121
- renderTimedEvent(e) {
7122
- const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), r = (s - t) / (1e3 * 60), n = i, a = Math.max(r, 30), o = v.sanitizeColor(e.backgroundColor), c = v.sanitizeColor(v.getContrastColor(o), "white");
6469
+ _renderTimeGrid(e, t, s, i) {
7123
6470
  return `
7124
- <div class="event-container"
7125
- style="top: ${n}px; height: ${a}px; background-color: ${o}; color: ${c};"
7126
- data-event-id="${e.id}">
7127
- <span class="event-title">${C.escapeHTML(e.title)}</span>
7128
- <span class="event-time">${x.formatTime(t)} - ${x.formatTime(s)}</span>
6471
+ <div id="day-scroll-container" class="fc-time-grid-container" style="flex: 1; overflow-y: auto; overflow-x: hidden; position: relative;">
6472
+ <div class="fc-time-grid" style="display: grid; grid-template-columns: 60px 1fr; position: relative; height: ${this.totalHeight}px;">
6473
+ ${this._renderTimeGutter(i)}
6474
+ ${this._renderDayColumn(e, t, s, i)}
6475
+ </div>
7129
6476
  </div>
7130
6477
  `;
7131
6478
  }
7132
- renderAllDayEvent(e) {
7133
- const t = v.sanitizeColor(e.backgroundColor), s = v.sanitizeColor(v.getContrastColor(t), "white");
6479
+ _renderTimeGutter(e) {
7134
6480
  return `
7135
- <div class="event-item"
7136
- style="background-color: ${t}; color: ${s}; font-size: 12px; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-weight: 500; margin-bottom: 2px;"
7137
- data-event-id="${e.id}">
7138
- ${C.escapeHTML(e.title)}
6481
+ <div class="fc-time-gutter" style="border-right: 1px solid #e5e7eb; background: #fafafa;">
6482
+ ${e.map((t) => `
6483
+ <div style="height: ${this.hourHeight}px; font-size: 11px; color: #6b7280; text-align: right; padding-right: 12px; font-weight: 500;">
6484
+ ${t === 0 ? "" : this.formatHour(t)}
6485
+ </div>
6486
+ `).join("")}
7139
6487
  </div>
7140
6488
  `;
7141
6489
  }
7142
- renderNowIndicator() {
7143
- const e = /* @__PURE__ */ new Date();
7144
- return `<div class="now-indicator" style="top: ${e.getHours() * 60 + e.getMinutes()}px"></div>`;
6490
+ _renderDayColumn(e, t, s, i) {
6491
+ return `
6492
+ <div class="fc-day-column" data-date="${s.toISOString()}" style="position: relative; cursor: pointer;">
6493
+ <!-- Hour grid lines -->
6494
+ ${i.map(() => `<div style="height: ${this.hourHeight}px; border-bottom: 1px solid #f3f4f6;"></div>`).join("")}
6495
+
6496
+ <!-- Now indicator for today -->
6497
+ ${t ? this.renderNowIndicator() : ""}
6498
+
6499
+ <!-- Timed events -->
6500
+ ${e.map((r) => this.renderTimedEvent(r, { compact: !1 })).join("")}
6501
+ </div>
6502
+ `;
7145
6503
  }
7146
- afterRender() {
7147
- const e = this.$("#scroll-container");
7148
- e && !this._scrolled && (e.scrollTop = 8 * 60 - 50, this._scrolled = !0), this.$$("[data-event-id]").forEach((s) => {
7149
- this.addListener(s, "click", (i) => {
7150
- i.stopPropagation();
7151
- const r = i.currentTarget.dataset.eventId, n = this.stateManager.getEvents().find((a) => a.id === r);
7152
- n && this.emit("event-click", { event: n });
6504
+ _attachEventHandlers() {
6505
+ this.container.querySelectorAll(".fc-day-column").forEach((e) => {
6506
+ this.addListener(e, "click", (t) => {
6507
+ if (t.target.closest(".fc-event")) return;
6508
+ const s = new Date(e.dataset.date), i = e.getBoundingClientRect(), r = this.container.querySelector("#day-scroll-container"), n = t.clientY - i.top + (r ? r.scrollTop : 0);
6509
+ s.setHours(Math.floor(n / this.hourHeight), Math.floor(n % this.hourHeight / (this.hourHeight / 60)), 0, 0), this.stateManager.selectDate(s);
7153
6510
  });
7154
- });
7155
- const t = this.$(".day-column");
7156
- t && this.addListener(t, "click", (s) => {
7157
- const i = s.currentTarget, r = this.$("#scroll-container"), n = i.getBoundingClientRect(), a = s.clientY - n.top + (r ? r.scrollTop : 0), o = new Date(i.dataset.date);
7158
- o.setHours(Math.floor(a / 60), Math.floor(a % 60), 0, 0), this.stateManager.selectDate(o), this.emit("day-click", { date: o });
7159
- });
6511
+ }), this.attachCommonEventHandlers();
7160
6512
  }
7161
- unmount() {
7162
- this.unsubscribe && this.unsubscribe();
6513
+ _scrollToCurrentTime() {
6514
+ if (this._scrolled) return;
6515
+ const e = this.container.querySelector("#day-scroll-container");
6516
+ e && (e.scrollTop = 8 * this.hourHeight - 50, this._scrolled = !0);
7163
6517
  }
7164
6518
  }
7165
- class se extends $ {
6519
+ class ie extends O {
7166
6520
  constructor() {
7167
6521
  super(), this._isVisible = !1, this._cleanupFocusTrap = null, this.config = {
7168
6522
  title: "New Event",
@@ -7192,8 +6546,8 @@ class se extends $ {
7192
6546
  }
7193
6547
  getStyles() {
7194
6548
  return `
7195
- ${v.getBaseStyles()}
7196
- ${v.getButtonStyles()}
6549
+ ${x.getBaseStyles()}
6550
+ ${x.getButtonStyles()}
7197
6551
 
7198
6552
  :host {
7199
6553
  display: none;
@@ -7436,7 +6790,7 @@ class se extends $ {
7436
6790
  });
7437
6791
  }
7438
6792
  open(e = /* @__PURE__ */ new Date()) {
7439
- this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = e, this._formData.end = new Date(e.getTime() + this.config.defaultDuration * 60 * 1e3), this._formData.title = "", this._formData.color = this.config.colors[0].color, this.startInput && (this.titleInput.value = "", this.startInput.value = this.formatDateForInput(this._formData.start), this.endInput.value = this.formatDateForInput(this._formData.end), this.updateColorSelection(), this._cleanupFocusTrap = C.trapFocus(this.modalContent));
6793
+ this.hasAttribute("open") || this.setAttribute("open", ""), this.titleGroup.classList.remove("has-error"), this.endGroup.classList.remove("has-error"), this._formData.start = e, this._formData.end = new Date(e.getTime() + this.config.defaultDuration * 60 * 1e3), this._formData.title = "", this._formData.color = this.config.colors[0].color, this.startInput && (this.titleInput.value = "", this.startInput.value = this.formatDateForInput(this._formData.start), this.endInput.value = this.formatDateForInput(this._formData.end), this.updateColorSelection(), this._cleanupFocusTrap = L.trapFocus(this.modalContent));
7440
6794
  }
7441
6795
  close() {
7442
6796
  this.removeAttribute("open"), this._cleanupFocusTrap && (this._cleanupFocusTrap(), this._cleanupFocusTrap = null);
@@ -7465,11 +6819,8 @@ class se extends $ {
7465
6819
  this._cleanupFocusTrap && this._cleanupFocusTrap(), this._handleKeyDown && (window.removeEventListener("keydown", this._handleKeyDown), this._handleKeyDown = null, this._keydownListenerAdded = !1);
7466
6820
  }
7467
6821
  }
7468
- customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form", se);
7469
- customElements.get("forcecal-month") || customElements.define("forcecal-month", X);
7470
- customElements.get("forcecal-week") || customElements.define("forcecal-week", ee);
7471
- customElements.get("forcecal-day") || customElements.define("forcecal-day", te);
7472
- class ie extends $ {
6822
+ customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form", ie);
6823
+ class re extends O {
7473
6824
  static get observedAttributes() {
7474
6825
  return ["view", "date", "locale", "timezone", "week-starts-on", "height"];
7475
6826
  }
@@ -7484,16 +6835,16 @@ class ie extends $ {
7484
6835
  timeZone: this.getAttribute("timezone") || Intl.DateTimeFormat().resolvedOptions().timeZone,
7485
6836
  weekStartsOn: parseInt(this.getAttribute("week-starts-on") || "0")
7486
6837
  };
7487
- this.stateManager = new J(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
6838
+ this.stateManager = new se(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
7488
6839
  }
7489
6840
  setupEventListeners() {
7490
- y.on("navigation:*", (e, t) => {
6841
+ m.on("navigation:*", (e, t) => {
7491
6842
  this.emit("calendar-navigate", { action: t.split(":")[1], ...e });
7492
- }), y.on("view:changed", (e) => {
6843
+ }), m.on("view:changed", (e) => {
7493
6844
  this.emit("calendar-view-change", e);
7494
- }), y.on("event:*", (e, t) => {
6845
+ }), m.on("event:*", (e, t) => {
7495
6846
  this.emit(`calendar-event-${t.split(":")[1]}`, e);
7496
- }), y.on("date:selected", (e) => {
6847
+ }), m.on("date:selected", (e) => {
7497
6848
  this.emit("calendar-date-select", e);
7498
6849
  });
7499
6850
  }
@@ -7536,8 +6887,12 @@ class ie extends $ {
7536
6887
  if (e) {
7537
6888
  this._currentViewInstance && this._currentViewInstance.cleanup && this._currentViewInstance.cleanup();
7538
6889
  try {
7539
- const t = this._createViewRenderer(this.currentView);
7540
- t && (t._viewType = this.currentView, this._currentViewInstance = t, t.stateManager = this.stateManager, t.container = e, t.render());
6890
+ const s = {
6891
+ month: E,
6892
+ week: z,
6893
+ day: F
6894
+ }[this.currentView] || E, i = new s(e, this.stateManager);
6895
+ i._viewType = this.currentView, this._currentViewInstance = i, i.render();
7541
6896
  } catch (t) {
7542
6897
  console.error("[ForceCalendar] Error switching view:", t);
7543
6898
  }
@@ -7558,10 +6913,10 @@ class ie extends $ {
7558
6913
  getStyles() {
7559
6914
  const e = this.getAttribute("height") || "800px";
7560
6915
  return `
7561
- ${v.getBaseStyles()}
7562
- ${v.getButtonStyles()}
7563
- ${v.getGridStyles()}
7564
- ${v.getAnimations()}
6916
+ ${x.getBaseStyles()}
6917
+ ${x.getButtonStyles()}
6918
+ ${x.getGridStyles()}
6919
+ ${x.getAnimations()}
7565
6920
 
7566
6921
  :host {
7567
6922
  --calendar-height: ${e};
@@ -7950,7 +7305,7 @@ class ie extends $ {
7950
7305
  return `
7951
7306
  <div class="force-calendar">
7952
7307
  <div class="fc-error">
7953
- <p><strong>Error:</strong> ${C.escapeHTML(r.message || "An error occurred")}</p>
7308
+ <p><strong>Error:</strong> ${L.escapeHTML(r.message || "An error occurred")}</p>
7954
7309
  </div>
7955
7310
  </div>
7956
7311
  `;
@@ -8016,8 +7371,12 @@ class ie extends $ {
8016
7371
  return;
8017
7372
  this._currentViewInstance && (this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), this._viewUnsubscribe && (this._viewUnsubscribe(), this._viewUnsubscribe = null));
8018
7373
  try {
8019
- const i = this._createViewRenderer(this.currentView);
8020
- i && (i._viewType = this.currentView, this._currentViewInstance = i, i.stateManager = this.stateManager, i.container = e, i.render());
7374
+ const r = {
7375
+ month: E,
7376
+ week: z,
7377
+ day: F
7378
+ }[this.currentView] || E, n = new r(e, this.stateManager);
7379
+ n._viewType = this.currentView, this._currentViewInstance = n, n.render();
8021
7380
  } catch (i) {
8022
7381
  console.error("[ForceCalendar] Error creating/rendering view:", i);
8023
7382
  }
@@ -8040,307 +7399,19 @@ class ie extends $ {
8040
7399
  });
8041
7400
  }), this._hasRendered = !0;
8042
7401
  }
7402
+ /**
7403
+ * Create a view renderer instance for the given view type
7404
+ * Uses pure JavaScript renderer classes for Salesforce Locker Service compatibility
7405
+ * @param {string} viewName - 'month', 'week', or 'day'
7406
+ * @returns {BaseViewRenderer} Renderer instance
7407
+ */
8043
7408
  _createViewRenderer(e) {
8044
- const t = e;
8045
- return {
8046
- stateManager: null,
8047
- container: null,
8048
- _listeners: [],
8049
- _scrolled: !1,
8050
- _escapeHTML(s) {
8051
- return s == null ? "" : C.escapeHTML(String(s));
8052
- },
8053
- cleanup() {
8054
- this._listeners.forEach(({ element: s, event: i, handler: r }) => {
8055
- s.removeEventListener(i, r);
8056
- }), this._listeners = [];
8057
- },
8058
- addListener(s, i, r) {
8059
- s.addEventListener(i, r), this._listeners.push({ element: s, event: i, handler: r });
8060
- },
8061
- render() {
8062
- if (!this.container || !this.stateManager) return;
8063
- const s = this.stateManager.getViewData();
8064
- if (!s) {
8065
- this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #666;">Loading...</div>';
8066
- return;
8067
- }
8068
- this.cleanup();
8069
- const i = this.stateManager.getState().config;
8070
- let r = "";
8071
- switch (t) {
8072
- case "week":
8073
- r = this._renderWeekView(s, i);
8074
- break;
8075
- case "day":
8076
- r = this._renderDayView(s, i);
8077
- break;
8078
- case "month":
8079
- default:
8080
- if (!s.weeks) {
8081
- this.container.innerHTML = '<div style="padding: 20px; text-align: center; color: #666;">No data available for month view.</div>';
8082
- return;
8083
- }
8084
- r = this._renderMonthView(s, i);
8085
- break;
8086
- }
8087
- this.container.innerHTML = r, this._attachEventHandlers(t);
8088
- },
8089
- _renderMonthView(s, i) {
8090
- const r = i.weekStartsOn || 0, n = [];
8091
- for (let o = 0; o < 7; o++) {
8092
- const c = (r + o) % 7;
8093
- n.push(["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][c]);
8094
- }
8095
- let a = `
8096
- <div class="fc-month-view" style="display: flex; flex-direction: column; height: 100%; min-height: 400px; background: #fff; border: 1px solid #e5e7eb;">
8097
- <div class="fc-month-header" style="display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; background: #f9fafb;">
8098
- ${n.map((o) => `<div class="fc-month-header-cell" style="padding: 12px 8px; text-align: center; font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase;">${o}</div>`).join("")}
8099
- </div>
8100
- <div class="fc-month-body" style="display: flex; flex-direction: column; flex: 1;">
8101
- `;
8102
- return s.weeks.forEach((o) => {
8103
- a += '<div class="fc-month-week" style="display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; min-height: 80px;">', o.days.forEach((c) => {
8104
- const l = !c.isCurrentMonth, d = c.isToday, h = l ? "#f3f4f6" : "#fff", g = l ? "#9ca3af" : "#111827", w = d ? "background: #2563eb; color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;" : "", f = c.events || [], k = f.slice(0, 3), b = f.length - 3;
8105
- a += `
8106
- <div class="fc-month-day" data-date="${c.date}" style="background: ${h}; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 4px; min-height: 80px; cursor: pointer;">
8107
- <div class="fc-day-number" style="font-size: 13px; font-weight: 500; color: ${g}; padding: 2px 4px; margin-bottom: 4px; ${w}">${c.dayOfMonth}</div>
8108
- <div class="fc-day-events" style="display: flex; flex-direction: column; gap: 2px;">
8109
- ${k.map((T) => `
8110
- <div class="fc-event" data-event-id="${this._escapeHTML(T.id)}" style="background-color: ${T.backgroundColor || "#2563eb"}; font-size: 11px; padding: 2px 6px; border-radius: 3px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;">
8111
- ${this._escapeHTML(T.title)}
8112
- </div>
8113
- `).join("")}
8114
- ${b > 0 ? `<div class="fc-more-events" style="font-size: 10px; color: #6b7280; padding: 2px 4px; font-weight: 500;">+${b} more</div>` : ""}
8115
- </div>
8116
- </div>
8117
- `;
8118
- }), a += "</div>";
8119
- }), a += "</div></div>", a;
8120
- },
8121
- _renderWeekView(s, i) {
8122
- const r = s.days || [];
8123
- if (r.length === 0)
8124
- return '<div style="padding: 20px; text-align: center; color: #666;">No data available for week view.</div>';
8125
- i.weekStartsOn;
8126
- const n = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], a = Array.from({ length: 24 }, (l, d) => d), o = r.map((l) => {
8127
- const d = new Date(l.date), h = l.events || [];
8128
- return {
8129
- ...l,
8130
- date: d,
8131
- dayName: n[d.getDay()],
8132
- dayOfMonth: d.getDate(),
8133
- isToday: this._isToday(d),
8134
- timedEvents: h.filter((g) => !g.allDay),
8135
- allDayEvents: h.filter((g) => g.allDay)
8136
- };
8137
- });
8138
- return `
8139
- <div class="fc-week-view" style="display: flex; flex-direction: column; height: 100%; background: #fff; overflow: hidden;">
8140
- <!-- Header -->
8141
- <div style="display: grid; grid-template-columns: 60px repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; background: #f9fafb; flex-shrink: 0;">
8142
- <div style="border-right: 1px solid #e5e7eb;"></div>
8143
- ${o.map((l) => `
8144
- <div style="padding: 12px 8px; text-align: center; border-right: 1px solid #e5e7eb;">
8145
- <div style="font-size: 10px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em;">${l.dayName}</div>
8146
- <div style="font-size: 16px; font-weight: 500; margin-top: 4px; ${l.isToday ? "background: #dc2626; color: white; border-radius: 50%; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;" : "color: #111827;"}">${l.dayOfMonth}</div>
8147
- </div>
8148
- `).join("")}
8149
- </div>
8150
-
8151
- <!-- All Day Row -->
8152
- <div style="display: grid; grid-template-columns: 60px repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; background: #fafafa; min-height: 32px; flex-shrink: 0;">
8153
- <div style="font-size: 9px; color: #6b7280; display: flex; align-items: center; justify-content: center; border-right: 1px solid #e5e7eb; text-transform: uppercase; font-weight: 700;">All day</div>
8154
- ${o.map((l) => `
8155
- <div style="border-right: 1px solid #e5e7eb; padding: 4px; display: flex; flex-direction: column; gap: 2px;">
8156
- ${l.allDayEvents.map((d) => `
8157
- <div class="fc-event" data-event-id="${this._escapeHTML(d.id)}" style="background-color: ${d.backgroundColor || "#2563eb"}; font-size: 10px; padding: 2px 4px; border-radius: 2px; color: white; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
8158
- ${this._escapeHTML(d.title)}
8159
- </div>
8160
- `).join("")}
8161
- </div>
8162
- `).join("")}
8163
- </div>
8164
-
8165
- <!-- Time Grid Body -->
8166
- <div id="week-scroll-container" style="flex: 1; overflow-y: auto; overflow-x: hidden; position: relative;">
8167
- <div style="display: grid; grid-template-columns: 60px repeat(7, 1fr); position: relative; height: 1440px;">
8168
- <!-- Time Gutter -->
8169
- <div style="border-right: 1px solid #e5e7eb; background: #fafafa;">
8170
- ${a.map((l) => `
8171
- <div style="height: 60px; font-size: 10px; color: #6b7280; text-align: right; padding-right: 8px; font-weight: 500;">
8172
- ${l === 0 ? "" : this._formatHour(l)}
8173
- </div>
8174
- `).join("")}
8175
- </div>
8176
-
8177
- <!-- Day Columns -->
8178
- ${o.map((l) => `
8179
- <div class="fc-week-day-column" data-date="${l.date.toISOString()}" style="border-right: 1px solid #e5e7eb; position: relative; cursor: pointer;">
8180
- <!-- Hour grid lines -->
8181
- ${a.map(() => '<div style="height: 60px; border-bottom: 1px solid #f3f4f6;"></div>').join("")}
8182
-
8183
- <!-- Now indicator for today -->
8184
- ${l.isToday ? this._renderNowIndicator() : ""}
8185
-
8186
- <!-- Timed events -->
8187
- ${l.timedEvents.map((d) => this._renderTimedEvent(d)).join("")}
8188
- </div>
8189
- `).join("")}
8190
- </div>
8191
- </div>
8192
- </div>
8193
- `;
8194
- },
8195
- _renderDayView(s, i) {
8196
- var g, w;
8197
- const r = ((w = (g = this.stateManager) == null ? void 0 : g.getState()) == null ? void 0 : w.currentDate) || /* @__PURE__ */ new Date();
8198
- let n, a, o, c, l;
8199
- if (s.type === "day" && s.date)
8200
- if (n = new Date(s.date), a = s.dayName || ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][n.getDay()], o = s.isToday !== void 0 ? s.isToday : this._isToday(n), c = s.allDayEvents || [], s.hours && Array.isArray(s.hours)) {
8201
- const f = /* @__PURE__ */ new Map();
8202
- s.hours.forEach((k) => {
8203
- (k.events || []).forEach((b) => {
8204
- f.has(b.id) || f.set(b.id, b);
8205
- });
8206
- }), l = Array.from(f.values());
8207
- } else
8208
- l = [];
8209
- else if (s.days && s.days.length > 0) {
8210
- const f = s.days.find((b) => this._isSameDay(new Date(b.date), r)) || s.days[0];
8211
- n = new Date(f.date), a = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][n.getDay()], o = this._isToday(n);
8212
- const k = f.events || [];
8213
- c = k.filter((b) => b.allDay), l = k.filter((b) => !b.allDay);
8214
- } else
8215
- return '<div style="padding: 20px; text-align: center; color: #666;">No data available for day view.</div>';
8216
- const d = Array.from({ length: 24 }, (f, k) => k);
8217
- return `
8218
- <div class="fc-day-view" style="display: flex; flex-direction: column; height: 100%; background: #fff; overflow: hidden;">
8219
- <!-- Header -->
8220
- <div style="display: grid; grid-template-columns: 60px 1fr; border-bottom: 1px solid #e5e7eb; background: #f9fafb; flex-shrink: 0;">
8221
- <div style="border-right: 1px solid #e5e7eb;"></div>
8222
- <div style="padding: 16px 24px;">
8223
- <div style="font-size: 12px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em;">${a}</div>
8224
- <div style="font-size: 24px; font-weight: 600; margin-top: 4px; ${o ? "color: #dc2626;" : "color: #111827;"}">${n.getDate()}</div>
8225
- </div>
8226
- </div>
8227
-
8228
- <!-- All Day Row -->
8229
- <div style="display: grid; grid-template-columns: 60px 1fr; border-bottom: 1px solid #e5e7eb; background: #fafafa; min-height: 36px; flex-shrink: 0;">
8230
- <div style="font-size: 9px; color: #6b7280; display: flex; align-items: center; justify-content: center; border-right: 1px solid #e5e7eb; text-transform: uppercase; font-weight: 700;">All day</div>
8231
- <div style="padding: 6px 12px; display: flex; flex-wrap: wrap; gap: 4px;">
8232
- ${c.map((f) => `
8233
- <div class="fc-event" data-event-id="${this._escapeHTML(f.id)}" style="background-color: ${f.backgroundColor || "#2563eb"}; font-size: 12px; padding: 4px 8px; border-radius: 4px; color: white; cursor: pointer; font-weight: 500;">
8234
- ${this._escapeHTML(f.title)}
8235
- </div>
8236
- `).join("")}
8237
- </div>
8238
- </div>
8239
-
8240
- <!-- Time Grid Body -->
8241
- <div id="day-scroll-container" style="flex: 1; overflow-y: auto; overflow-x: hidden; position: relative;">
8242
- <div style="display: grid; grid-template-columns: 60px 1fr; position: relative; height: 1440px;">
8243
- <!-- Time Gutter -->
8244
- <div style="border-right: 1px solid #e5e7eb; background: #fafafa;">
8245
- ${d.map((f) => `
8246
- <div style="height: 60px; font-size: 11px; color: #6b7280; text-align: right; padding-right: 12px; font-weight: 500;">
8247
- ${f === 0 ? "" : this._formatHour(f)}
8248
- </div>
8249
- `).join("")}
8250
- </div>
8251
-
8252
- <!-- Day Column -->
8253
- <div class="fc-day-column" data-date="${n.toISOString()}" style="position: relative; cursor: pointer;">
8254
- <!-- Hour grid lines -->
8255
- ${d.map(() => '<div style="height: 60px; border-bottom: 1px solid #f3f4f6;"></div>').join("")}
8256
-
8257
- <!-- Now indicator for today -->
8258
- ${o ? this._renderNowIndicator() : ""}
8259
-
8260
- <!-- Timed events -->
8261
- ${l.map((f) => this._renderTimedEventDay(f)).join("")}
8262
- </div>
8263
- </div>
8264
- </div>
8265
- </div>
8266
- `;
8267
- },
8268
- _renderTimedEvent(s) {
8269
- const i = new Date(s.start), r = new Date(s.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), 20), o = s.backgroundColor || "#2563eb";
8270
- return `
8271
- <div class="fc-event" data-event-id="${this._escapeHTML(s.id)}"
8272
- style="position: absolute; top: ${n}px; height: ${a}px; left: 2px; right: 2px;
8273
- background-color: ${o}; border-radius: 4px; padding: 4px 8px; font-size: 11px;
8274
- font-weight: 500; color: white; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.1);
8275
- cursor: pointer; z-index: 5;">
8276
- <div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${this._escapeHTML(s.title)}</div>
8277
- <div style="font-size: 10px; opacity: 0.9;">${this._formatTime(i)}</div>
8278
- </div>
8279
- `;
8280
- },
8281
- _renderTimedEventDay(s) {
8282
- const i = new Date(s.start), r = new Date(s.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), 30), o = s.backgroundColor || "#2563eb";
8283
- return `
8284
- <div class="fc-event" data-event-id="${this._escapeHTML(s.id)}"
8285
- style="position: absolute; top: ${n}px; height: ${a}px; left: 12px; right: 24px;
8286
- background-color: ${o}; border-radius: 6px; padding: 8px 12px; font-size: 13px;
8287
- font-weight: 500; color: white; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
8288
- cursor: pointer; z-index: 5;">
8289
- <div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">${this._escapeHTML(s.title)}</div>
8290
- <div style="font-size: 11px; opacity: 0.9;">${this._formatTime(i)} - ${this._formatTime(r)}</div>
8291
- </div>
8292
- `;
8293
- },
8294
- _renderNowIndicator() {
8295
- const s = /* @__PURE__ */ new Date();
8296
- return `<div style="position: absolute; left: 0; right: 0; top: ${s.getHours() * 60 + s.getMinutes()}px; height: 2px; background: #dc2626; z-index: 15; pointer-events: none;"></div>`;
8297
- },
8298
- _formatHour(s) {
8299
- const i = s >= 12 ? "PM" : "AM";
8300
- return `${s % 12 || 12} ${i}`;
8301
- },
8302
- _formatTime(s) {
8303
- const i = s.getHours(), r = s.getMinutes(), n = i >= 12 ? "PM" : "AM", a = i % 12 || 12;
8304
- return r === 0 ? `${a} ${n}` : `${a}:${r.toString().padStart(2, "0")} ${n}`;
8305
- },
8306
- _isToday(s) {
8307
- const i = /* @__PURE__ */ new Date();
8308
- return s.getDate() === i.getDate() && s.getMonth() === i.getMonth() && s.getFullYear() === i.getFullYear();
8309
- },
8310
- _isSameDay(s, i) {
8311
- return s.getDate() === i.getDate() && s.getMonth() === i.getMonth() && s.getFullYear() === i.getFullYear();
8312
- },
8313
- _attachEventHandlers(s) {
8314
- const i = this.stateManager;
8315
- if (this.container.querySelectorAll(".fc-month-day").forEach((r) => {
8316
- this.addListener(r, "click", (n) => {
8317
- const a = new Date(r.dataset.date);
8318
- i.selectDate(a);
8319
- });
8320
- }), this.container.querySelectorAll(".fc-week-day-column").forEach((r) => {
8321
- this.addListener(r, "click", (n) => {
8322
- if (n.target.closest(".fc-event")) return;
8323
- const a = new Date(r.dataset.date), o = r.getBoundingClientRect(), c = this.container.querySelector("#week-scroll-container"), l = n.clientY - o.top + (c ? c.scrollTop : 0);
8324
- a.setHours(Math.floor(l / 60), Math.floor(l % 60), 0, 0), i.selectDate(a);
8325
- });
8326
- }), this.container.querySelectorAll(".fc-day-column").forEach((r) => {
8327
- this.addListener(r, "click", (n) => {
8328
- if (n.target.closest(".fc-event")) return;
8329
- const a = new Date(r.dataset.date), o = r.getBoundingClientRect(), c = this.container.querySelector("#day-scroll-container"), l = n.clientY - o.top + (c ? c.scrollTop : 0);
8330
- a.setHours(Math.floor(l / 60), Math.floor(l % 60), 0, 0), i.selectDate(a);
8331
- });
8332
- }), this.container.querySelectorAll(".fc-event").forEach((r) => {
8333
- this.addListener(r, "click", (n) => {
8334
- n.stopPropagation();
8335
- const a = r.dataset.eventId, o = i.getEvents().find((c) => c.id === a);
8336
- o && i.selectEvent(o);
8337
- });
8338
- }), s === "week" || s === "day") {
8339
- const r = s === "week" ? "#week-scroll-container" : "#day-scroll-container", n = this.container.querySelector(r);
8340
- n && !this._scrolled && (n.scrollTop = 8 * 60 - 50, this._scrolled = !0);
8341
- }
8342
- }
8343
- };
7409
+ const s = {
7410
+ month: E,
7411
+ week: z,
7412
+ day: F
7413
+ }[e] || E;
7414
+ return new s(null, null);
8344
7415
  }
8345
7416
  handleNavigation(e) {
8346
7417
  switch (e.currentTarget.dataset.action) {
@@ -8363,14 +7434,14 @@ class ie extends $ {
8363
7434
  const s = this.stateManager.state.config.locale;
8364
7435
  switch (t) {
8365
7436
  case "month":
8366
- return x.formatDate(e, "month", s);
7437
+ return S.formatDate(e, "month", s);
8367
7438
  case "week":
8368
- const i = x.startOfWeek(e), r = x.endOfWeek(e);
8369
- return x.formatDateRange(i, r, s);
7439
+ const i = S.startOfWeek(e), r = S.endOfWeek(e);
7440
+ return S.formatDateRange(i, r, s);
8370
7441
  case "day":
8371
- return x.formatDate(e, "long", s);
7442
+ return S.formatDate(e, "long", s);
8372
7443
  default:
8373
- return x.formatDate(e, "month", s);
7444
+ return S.formatDate(e, "month", s);
8374
7445
  }
8375
7446
  }
8376
7447
  getIcon(e) {
@@ -8421,22 +7492,23 @@ class ie extends $ {
8421
7492
  this.stateManager.today();
8422
7493
  }
8423
7494
  destroy() {
8424
- this.stateManager && this.stateManager.destroy(), y.clear(), super.cleanup();
7495
+ this.stateManager && this.stateManager.destroy(), m.clear(), super.cleanup();
8425
7496
  }
8426
7497
  }
8427
- customElements.get("forcecal-main") || customElements.define("forcecal-main", ie);
7498
+ customElements.get("forcecal-main") || customElements.define("forcecal-main", re);
8428
7499
  typeof window < "u" && typeof customElements < "u" && console.log("Force Calendar Interface loading...");
8429
7500
  export {
8430
- $ as BaseComponent,
8431
- C as DOMUtils,
8432
- x as DateUtils,
8433
- te as DayView,
8434
- Q as EventBus,
8435
- ie as ForceCalendar,
8436
- X as MonthView,
8437
- J as StateManager,
8438
- v as StyleUtils,
8439
- ee as WeekView,
8440
- y as eventBus
7501
+ O as BaseComponent,
7502
+ H as BaseViewRenderer,
7503
+ L as DOMUtils,
7504
+ S as DateUtils,
7505
+ F as DayViewRenderer,
7506
+ te as EventBus,
7507
+ re as ForceCalendar,
7508
+ E as MonthViewRenderer,
7509
+ se as StateManager,
7510
+ x as StyleUtils,
7511
+ z as WeekViewRenderer,
7512
+ m as eventBus
8441
7513
  };
8442
7514
  //# sourceMappingURL=force-calendar-interface.esm.js.map