@burdenoff/microfe-calendar 2026.1124.2 → 2026.1124.3

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.
Files changed (87) hide show
  1. package/dist/generated/wspace-operations.d.ts +469 -0
  2. package/dist/generated/wspace-operations.js +121 -9
  3. package/dist/generated/wspace-operations.js.map +1 -1
  4. package/dist/pages/ResourcesPage.js.map +1 -1
  5. package/dist/translations/en.d.ts +231 -0
  6. package/dist/v2/CalendarPageV2.js.map +1 -1
  7. package/dist/v2/data/enums.d.ts +1 -0
  8. package/dist/v2/data/enums.js +6 -2
  9. package/dist/v2/data/enums.js.map +1 -1
  10. package/dist/v2/dialogs/CalendarDialogsV2.js +12 -9
  11. package/dist/v2/dialogs/CalendarDialogsV2.js.map +1 -1
  12. package/dist/v2/event/CustomRepeat.d.ts +5 -0
  13. package/dist/v2/event/CustomRepeat.js +246 -0
  14. package/dist/v2/event/CustomRepeat.js.map +1 -0
  15. package/dist/v2/event/EventDetailsTab.d.ts +6 -0
  16. package/dist/v2/event/EventDetailsTab.js +291 -0
  17. package/dist/v2/event/EventDetailsTab.js.map +1 -0
  18. package/dist/v2/event/EventDialog.d.ts +25 -0
  19. package/dist/v2/event/EventDialog.js +365 -0
  20. package/dist/v2/event/EventDialog.js.map +1 -0
  21. package/dist/v2/event/EventDialogs.d.ts +3 -0
  22. package/dist/v2/event/EventDialogs.js +111 -0
  23. package/dist/v2/event/EventDialogs.js.map +1 -0
  24. package/dist/v2/event/EventMoreTab.d.ts +4 -0
  25. package/dist/v2/event/EventMoreTab.js +214 -0
  26. package/dist/v2/event/EventMoreTab.js.map +1 -0
  27. package/dist/v2/event/EventPeopleTab.d.ts +8 -0
  28. package/dist/v2/event/EventPeopleTab.js +422 -0
  29. package/dist/v2/event/EventPeopleTab.js.map +1 -0
  30. package/dist/v2/event/EventPlaceTab.d.ts +6 -0
  31. package/dist/v2/event/EventPlaceTab.js +264 -0
  32. package/dist/v2/event/EventPlaceTab.js.map +1 -0
  33. package/dist/v2/event/FindTimeDialog.d.ts +26 -0
  34. package/dist/v2/event/FindTimeDialog.js +667 -0
  35. package/dist/v2/event/FindTimeDialog.js.map +1 -0
  36. package/dist/v2/event/RepeatField.d.ts +5 -0
  37. package/dist/v2/event/RepeatField.js +88 -0
  38. package/dist/v2/event/RepeatField.js.map +1 -0
  39. package/dist/v2/event/dialogLogic.d.ts +87 -0
  40. package/dist/v2/event/dialogLogic.js +117 -0
  41. package/dist/v2/event/dialogLogic.js.map +1 -0
  42. package/dist/v2/event/dialogModel.d.ts +48 -0
  43. package/dist/v2/event/dialogModel.js +13 -0
  44. package/dist/v2/event/dialogModel.js.map +1 -0
  45. package/dist/v2/event/eventForm.d.ts +209 -0
  46. package/dist/v2/event/eventForm.js +397 -0
  47. package/dist/v2/event/eventForm.js.map +1 -0
  48. package/dist/v2/event/findTime.d.ts +120 -0
  49. package/dist/v2/event/findTime.js +149 -0
  50. package/dist/v2/event/findTime.js.map +1 -0
  51. package/dist/v2/event/findTimeSource.d.ts +102 -0
  52. package/dist/v2/event/findTimeSource.js +107 -0
  53. package/dist/v2/event/findTimeSource.js.map +1 -0
  54. package/dist/v2/event/parts.d.ts +46 -0
  55. package/dist/v2/event/parts.js +124 -0
  56. package/dist/v2/event/parts.js.map +1 -0
  57. package/dist/v2/event/place.d.ts +64 -0
  58. package/dist/v2/event/place.js +48 -0
  59. package/dist/v2/event/place.js.map +1 -0
  60. package/dist/v2/event/repeatWords.d.ts +19 -0
  61. package/dist/v2/event/repeatWords.js +130 -0
  62. package/dist/v2/event/repeatWords.js.map +1 -0
  63. package/dist/v2/event/rrule.d.ts +90 -0
  64. package/dist/v2/event/rrule.js +368 -0
  65. package/dist/v2/event/rrule.js.map +1 -0
  66. package/dist/v2/event/savePlan.d.ts +50 -0
  67. package/dist/v2/event/savePlan.js +125 -0
  68. package/dist/v2/event/savePlan.js.map +1 -0
  69. package/dist/v2/event/useEventData.d.ts +91 -0
  70. package/dist/v2/event/useEventData.js +202 -0
  71. package/dist/v2/event/useEventData.js.map +1 -0
  72. package/dist/v2/event/useEventDialogModel.d.ts +37 -0
  73. package/dist/v2/event/useEventDialogModel.js +129 -0
  74. package/dist/v2/event/useEventDialogModel.js.map +1 -0
  75. package/dist/v2/event/useEventSave.d.ts +41 -0
  76. package/dist/v2/event/useEventSave.js +185 -0
  77. package/dist/v2/event/useEventSave.js.map +1 -0
  78. package/dist/v2/format.d.ts +2 -0
  79. package/dist/v2/format.js +4 -0
  80. package/dist/v2/format.js.map +1 -1
  81. package/dist/v2/peek/EventPeek.js.map +1 -1
  82. package/dist/v2/peek/PeekEvent.js.map +1 -1
  83. package/dist/v2/rail/CalendarRail.js.map +1 -1
  84. package/dist/v2/runs/RunPeek.js.map +1 -1
  85. package/dist/v2/states/CalendarStates.js.map +1 -1
  86. package/dist/v2/types.d.ts +2 -0
  87. package/package.json +1 -1
@@ -0,0 +1,368 @@
1
+ import { instantToZoned as e, weekdayOf as t, zonedTimeToInstant as n } from "../time/calendarTime.js";
2
+ import { addDays as r, parseDateValue as i } from "@burdenoff/fe-libs/ui";
3
+ // src/v2/event/rrule.ts
4
+ var a = [
5
+ "SU",
6
+ "MO",
7
+ "TU",
8
+ "WE",
9
+ "TH",
10
+ "FR",
11
+ "SA"
12
+ ], o = [
13
+ "MO",
14
+ "TU",
15
+ "WE",
16
+ "TH",
17
+ "FR"
18
+ ], s = [
19
+ "MO",
20
+ "TU",
21
+ "WE",
22
+ "TH",
23
+ "FR",
24
+ "SA",
25
+ "SU"
26
+ ], c = [
27
+ "DAILY",
28
+ "WEEKLY",
29
+ "MONTHLY",
30
+ "YEARLY"
31
+ ], l = 1e3;
32
+ function u(e) {
33
+ return a.some((t) => t === e);
34
+ }
35
+ function d(e) {
36
+ return c.some((t) => t === e);
37
+ }
38
+ function f(e) {
39
+ return a[t(e)] ?? "MO";
40
+ }
41
+ function p(e) {
42
+ return i(e)?.day ?? 1;
43
+ }
44
+ function m(e) {
45
+ let t = i(e);
46
+ return t ? new Date(Date.UTC(t.year, t.month, 0)).getUTCDate() : 31;
47
+ }
48
+ function h(e) {
49
+ return Math.ceil(p(e) / 7);
50
+ }
51
+ function g(e) {
52
+ return p(e) + 7 > m(e);
53
+ }
54
+ function _(e) {
55
+ let t = new Set(e);
56
+ return s.filter((e) => t.has(e));
57
+ }
58
+ function v(e, t) {
59
+ let n = _(e), r = _(t);
60
+ return n.length === r.length && n.every((e, t) => e === r[t]);
61
+ }
62
+ function y(e) {
63
+ let t = ["daily", "weekly"];
64
+ return h(e.start) <= 4 && t.push("monthlyNth"), g(e.start) && t.push("monthlyLast"), t.push("yearly"), o.includes(f(e.start)) && t.push("weekdays"), t;
65
+ }
66
+ function b(e, t) {
67
+ let n = { kind: "never" }, r = f(t.start);
68
+ switch (e) {
69
+ case "daily": return {
70
+ frequency: "DAILY",
71
+ interval: 1,
72
+ weekdays: [],
73
+ monthly: null,
74
+ end: n
75
+ };
76
+ case "weekly": return {
77
+ frequency: "WEEKLY",
78
+ interval: 1,
79
+ weekdays: [r],
80
+ monthly: null,
81
+ end: n
82
+ };
83
+ case "monthlyNth": return {
84
+ frequency: "MONTHLY",
85
+ interval: 1,
86
+ weekdays: [],
87
+ monthly: "nthWeekday",
88
+ end: n
89
+ };
90
+ case "monthlyLast": return {
91
+ frequency: "MONTHLY",
92
+ interval: 1,
93
+ weekdays: [],
94
+ monthly: "lastWeekday",
95
+ end: n
96
+ };
97
+ case "yearly": return {
98
+ frequency: "YEARLY",
99
+ interval: 1,
100
+ weekdays: [],
101
+ monthly: null,
102
+ end: n
103
+ };
104
+ case "weekdays": return {
105
+ frequency: "WEEKLY",
106
+ interval: 1,
107
+ weekdays: [...o],
108
+ monthly: null,
109
+ end: n
110
+ };
111
+ }
112
+ }
113
+ function x(e, t) {
114
+ for (let n of y(t)) {
115
+ let r = b(n, t);
116
+ if (r.frequency === e.frequency && r.interval === e.interval && v(r.weekdays, e.weekdays) && r.monthly === e.monthly && e.end.kind === "never") return n;
117
+ }
118
+ return null;
119
+ }
120
+ function S(e, t, n) {
121
+ return e.frequency === t ? e : {
122
+ ...e,
123
+ frequency: t,
124
+ weekdays: t === "WEEKLY" ? [f(n.start)] : [],
125
+ monthly: t === "MONTHLY" ? "monthDay" : null
126
+ };
127
+ }
128
+ function C(e, t, n) {
129
+ if (e.frequency !== "WEEKLY" || t === f(n.start)) return e;
130
+ let r = e.weekdays.includes(t) ? e.weekdays.filter((e) => e !== t) : [...e.weekdays, t];
131
+ return {
132
+ ...e,
133
+ weekdays: _(r)
134
+ };
135
+ }
136
+ function w(e, t, n) {
137
+ if (e.frequency === "WEEKLY") {
138
+ let r = f(t.start), i = f(n.start);
139
+ if (r === i) return e;
140
+ let a = e.weekdays.length === 1 && e.weekdays[0] === r ? [] : e.weekdays;
141
+ return {
142
+ ...e,
143
+ weekdays: _([...a, i])
144
+ };
145
+ }
146
+ if (e.frequency === "MONTHLY") {
147
+ if (e.monthly === "nthWeekday" && h(n.start) > 4) return {
148
+ ...e,
149
+ monthly: "lastWeekday"
150
+ };
151
+ if (e.monthly === "lastWeekday" && !g(n.start)) return {
152
+ ...e,
153
+ monthly: "nthWeekday"
154
+ };
155
+ }
156
+ return e;
157
+ }
158
+ function T(e, t) {
159
+ return !Number.isInteger(e.interval) || e.interval < 1 || e.interval > 99 ? "interval" : e.frequency === "WEEKLY" && e.weekdays.length === 0 ? "noWeekdays" : e.end.kind === "count" && (!Number.isInteger(e.end.count) || e.end.count < 1 || e.end.count > 999) ? "count" : e.end.kind === "until" && e.end.date < t.start ? "untilBeforeStart" : null;
160
+ }
161
+ function E(e) {
162
+ return e.toISOString().replace(/\.\d{3}Z$/, "Z").replace(/[-:]/g, "");
163
+ }
164
+ function D(e, t) {
165
+ if (t.allDay) return `${e.replace(/-/g, "")}T235959Z`;
166
+ let i = n(r(e, 1), 0, t.timeZone);
167
+ return E(/* @__PURE__ */ new Date(i.getTime() - l));
168
+ }
169
+ function O(e, t) {
170
+ let n = f(t.start);
171
+ return e === "lastWeekday" ? `-1${n}` : `${h(t.start)}${n}`;
172
+ }
173
+ function k(e, t) {
174
+ let n = [`FREQ=${e.frequency}`];
175
+ if (e.interval > 1 && n.push(`INTERVAL=${e.interval}`), e.frequency === "WEEKLY") {
176
+ let r = _(e.weekdays), i = r.length === 1 && r[0] === f(t.start);
177
+ r.length > 0 && !i && n.push(`BYDAY=${r.join(",")}`);
178
+ }
179
+ return e.frequency === "MONTHLY" && e.monthly && e.monthly !== "monthDay" && n.push(`BYDAY=${O(e.monthly, t)}`), e.end.kind === "count" && n.push(`COUNT=${e.end.count}`), e.end.kind === "until" && n.push(`UNTIL=${D(e.end.date, t)}`), n.join(";");
180
+ }
181
+ function A(e) {
182
+ let t = e.split(/\r?\n/).map((e) => e.trim()).filter((e) => e !== "").filter((e) => !/^DTSTART[:;]/i.test(e));
183
+ if (t.length !== 1) return null;
184
+ let [n] = t;
185
+ return n ? /^RRULE:/i.test(n) ? n.slice(6) : /^[A-Z-]+[:;]/i.test(n) && !/^[A-Z]+=/i.test(n) ? null : n : null;
186
+ }
187
+ function j(t, a) {
188
+ let o = /^(\d{4})(\d{2})(\d{2})(?:T(\d{2})(\d{2})(\d{2})(Z)?)?$/.exec(t);
189
+ if (!o) return null;
190
+ let [, s, c, l, u, d, f, p] = o, m = `${s}-${c}-${l}`;
191
+ if (!i(m)) return null;
192
+ if (u === void 0 || !p) return m;
193
+ let h = new Date(Date.UTC(Number(s), Number(c) - 1, Number(l), Number(u), Number(d), Number(f))), g = a.allDay ? "UTC" : a.timeZone, _ = a.allDay ? 0 : a.startMinutes, v = e(h, g).date;
194
+ return n(v, _, g).getTime() > h.getTime() && (v = r(v, -1)), v;
195
+ }
196
+ function M(e) {
197
+ let t = [];
198
+ for (let n of e.split(",")) {
199
+ let e = /^([+-]?\d{1,2})?(SU|MO|TU|WE|TH|FR|SA)$/.exec(n.trim().toUpperCase()), r = e?.[2];
200
+ if (!e || !u(r)) return null;
201
+ let i = e[1] === void 0 ? null : Number(e[1]);
202
+ t.push({
203
+ ordinal: i,
204
+ day: r
205
+ });
206
+ }
207
+ return t;
208
+ }
209
+ function N(e, t) {
210
+ return e.day === f(t.start) ? e.ordinal === -1 && g(t.start) ? "lastWeekday" : e.ordinal === h(t.start) && e.ordinal <= 4 ? "nthWeekday" : null : null;
211
+ }
212
+ function P(e, t) {
213
+ let n = (e ?? "").trim();
214
+ if (n === "") return { kind: "none" };
215
+ let r = {
216
+ kind: "kept",
217
+ text: n
218
+ }, a = A(n);
219
+ if (a === null) return r;
220
+ let o = /* @__PURE__ */ new Map();
221
+ for (let e of a.split(";")) {
222
+ if (e.trim() === "") continue;
223
+ let t = e.indexOf("=");
224
+ if (t <= 0) return r;
225
+ let n = e.slice(0, t).trim().toUpperCase();
226
+ if (o.has(n)) return r;
227
+ o.set(n, e.slice(t + 1).trim());
228
+ }
229
+ o.delete("DTSTART");
230
+ let s = o.get("FREQ")?.toUpperCase();
231
+ if (!d(s)) return r;
232
+ o.delete("FREQ");
233
+ let c = 1, l = o.get("INTERVAL");
234
+ if (l !== void 0) {
235
+ if (c = Number(l), !/^\d+$/.test(l) || c < 1 || c > 99) return r;
236
+ o.delete("INTERVAL");
237
+ }
238
+ let u = o.get("WKST");
239
+ if (u !== void 0) {
240
+ if (u.toUpperCase() !== "MO" && s === "WEEKLY" && c > 1) return r;
241
+ o.delete("WKST");
242
+ }
243
+ let m = { kind: "never" }, h = o.get("COUNT"), g = o.get("UNTIL");
244
+ if (h !== void 0 && g !== void 0) return r;
245
+ if (h !== void 0) {
246
+ let e = Number(h);
247
+ if (!/^\d+$/.test(h) || e < 1 || e > 999) return r;
248
+ m = {
249
+ kind: "count",
250
+ count: e
251
+ }, o.delete("COUNT");
252
+ }
253
+ if (g !== void 0) {
254
+ let e = j(g.toUpperCase(), t);
255
+ if (!e) return r;
256
+ m = {
257
+ kind: "until",
258
+ date: e
259
+ }, o.delete("UNTIL");
260
+ }
261
+ let v = o.get("BYDAY"), y = v === void 0 ? null : M(v);
262
+ if (v !== void 0 && y === null) return r;
263
+ o.delete("BYDAY");
264
+ let b = o.get("BYSETPOS");
265
+ o.delete("BYSETPOS");
266
+ let x = o.get("BYMONTHDAY");
267
+ o.delete("BYMONTHDAY");
268
+ let S = o.get("BYMONTH");
269
+ if (o.delete("BYMONTH"), o.size > 0) return r;
270
+ let C = f(t.start), w = {
271
+ interval: c,
272
+ end: m
273
+ };
274
+ switch (s) {
275
+ case "DAILY": {
276
+ if (b !== void 0 || x !== void 0 || S !== void 0) return r;
277
+ if (!y) return {
278
+ kind: "rule",
279
+ rule: {
280
+ ...w,
281
+ frequency: s,
282
+ weekdays: [],
283
+ monthly: null
284
+ }
285
+ };
286
+ let e = y.map((e) => e.day);
287
+ return c !== 1 || y.some((e) => e.ordinal !== null) || !e.includes(C) ? r : {
288
+ kind: "rule",
289
+ rule: {
290
+ ...w,
291
+ frequency: "WEEKLY",
292
+ weekdays: _(e),
293
+ monthly: null
294
+ }
295
+ };
296
+ }
297
+ case "WEEKLY": {
298
+ if (b !== void 0 || x !== void 0 || S !== void 0) return r;
299
+ let e = y ? y.map((e) => e.day) : [C];
300
+ return y?.some((e) => e.ordinal !== null) || !e.includes(C) ? r : {
301
+ kind: "rule",
302
+ rule: {
303
+ ...w,
304
+ frequency: s,
305
+ weekdays: _(e),
306
+ monthly: null
307
+ }
308
+ };
309
+ }
310
+ case "MONTHLY": {
311
+ if (S !== void 0) return r;
312
+ if (x !== void 0) return y || b !== void 0 || Number(x) !== p(t.start) ? r : {
313
+ kind: "rule",
314
+ rule: {
315
+ ...w,
316
+ frequency: s,
317
+ weekdays: [],
318
+ monthly: "monthDay"
319
+ }
320
+ };
321
+ if (!y) return b === void 0 ? {
322
+ kind: "rule",
323
+ rule: {
324
+ ...w,
325
+ frequency: s,
326
+ weekdays: [],
327
+ monthly: "monthDay"
328
+ }
329
+ } : r;
330
+ let [e] = y;
331
+ if (y.length !== 1 || !e) return r;
332
+ let n = e;
333
+ if (b !== void 0) {
334
+ if (e.ordinal !== null || !/^-?\d{1,2}$/.test(b)) return r;
335
+ n = {
336
+ ordinal: Number(b),
337
+ day: e.day
338
+ };
339
+ }
340
+ let i = N(n, t);
341
+ return i ? {
342
+ kind: "rule",
343
+ rule: {
344
+ ...w,
345
+ frequency: s,
346
+ weekdays: [],
347
+ monthly: i
348
+ }
349
+ } : r;
350
+ }
351
+ case "YEARLY": {
352
+ if (y || b !== void 0) return r;
353
+ let e = i(t.start);
354
+ return S !== void 0 && Number(S) !== e?.month || x !== void 0 && Number(x) !== e?.day ? r : {
355
+ kind: "rule",
356
+ rule: {
357
+ ...w,
358
+ frequency: s,
359
+ weekdays: [],
360
+ monthly: null
361
+ }
362
+ };
363
+ }
364
+ }
365
+ }
366
+ export { a as WEEKDAYS, o as WORKWEEK, k as buildRRule, w as followStart, g as isLastOfMonth, h as nthOfMonth, P as parseRRule, x as presetOf, b as presetRule, y as presetsFor, T as ruleProblem, E as utcStamp, f as weekdayCode, S as withFrequency, C as withWeekdayToggled };
367
+
368
+ //# sourceMappingURL=rrule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rrule.js","names":["WEEKDAYS","WORKWEEK","WEEK_ORDER","FREQUENCIES","SECOND_MS","isWeekday","day","value","isFrequency","frequency","weekdayCode","weekdayOf","date","dayOfMonth","parseDateValue","daysInMonth","parts","nthOfMonth","isLastOfMonth","inWeekOrder","set","days","sameDays","left","a","right","b","index","presetsFor","presets","anchor","presetRule","never","start","preset","presetOf","candidate","rule","withFrequency","withWeekdayToggled","item","followStart","oldDay","before","newDay","after","kept","ruleProblem","utcStamp","instant","untilStamp","last","nextMidnight","zonedTimeToInstant","addDays","monthlyWeekday","pattern","buildRRule","onlyStart","ruleLine","rules","text","line","untilDate","match","year","month","hours","minutes","seconds","utc","zone","minute","instantToZoned","weekdayEntries","entries","raw","ordinal","monthlyPatternOf","entry","parseRRule","fields","part","at","name","interval","intervalText","weekStart","end","countText","untilText","count","byDayText","byDay","setPosText","monthDayText","monthText","startDay","base","named","monthly"],"sources":["../../../src/v2/event/rrule.ts"],"sourcesContent":["/**\n * Repeat rules for the event dialog (BOFF-15698 A2): the RRULE the Repeat menu and its Custom\n * builder write, and a stored one read back into them. Pure.\n *\n * - A rule is always tied to the event's start (`RuleAnchor`): the weekly days include the\n * start's weekday, and a monthly rule is on the start's day of the month, its nth weekday or\n * its last weekday. So the start is always an occurrence, as RFC 5545 asks.\n * - What follows from the start is left to DTSTART rather than written out: weekly on the\n * start's day alone has no BYDAY, monthly on its day no BYMONTHDAY, yearly nothing more. The\n * service expands series in UTC until B7, and a written-out weekday lands a day early or late\n * for an event whose UTC date isn't its own (01:00 in Tokyo is the day before in UTC).\n * - UNTIL is a UTC time: the end of the last day on the event's clock, or for an all-day event\n * (stored at UTC midnights) the end of that day in UTC. Read back, it is the last day an\n * occurrence can start on.\n * - A stored rule this can't hold (BYHOUR, BYWEEKNO, EXDATE lines, several rules, a monthly day\n * other than the start's …) is `kept`: the menu names it, and saving leaves it as it is\n * unless the person picks another.\n */\nimport { addDays, parseDateValue, type DateValue } from '@burdenoff/fe-libs/ui';\nimport { instantToZoned, weekdayOf, zonedTimeToInstant } from '../time/calendarTime';\n\nexport type Weekday = 'SU' | 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA';\n\n/** By JavaScript's day number: 0 Sunday to 6 Saturday. */\nexport const WEEKDAYS: readonly Weekday[] = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'];\n\n/** Monday to Friday. */\nexport const WORKWEEK: readonly Weekday[] = ['MO', 'TU', 'WE', 'TH', 'FR'];\n\nexport type RepeatFrequency = 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY';\n\n/** A monthly rule: on the start's day of the month, its nth weekday, or its last weekday. */\nexport type MonthlyPattern = 'monthDay' | 'nthWeekday' | 'lastWeekday';\n\nexport type RepeatEnd =\n | { kind: 'never' }\n | { kind: 'count'; count: number }\n /** The last day an occurrence may start on, on the event's clock. */\n | { kind: 'until'; date: DateValue };\n\nexport interface RepeatRule {\n frequency: RepeatFrequency;\n /** Every `interval` days, weeks, months or years. */\n interval: number;\n /** Weekly: the days, in week order from Monday, the start's among them. Otherwise empty. */\n weekdays: Weekday[];\n /** Monthly: which day of each month. Otherwise null. */\n monthly: MonthlyPattern | null;\n end: RepeatEnd;\n}\n\n/** What a rule is tied to: the event's start, on its own clock. */\nexport interface RuleAnchor {\n start: DateValue;\n /** Minutes after midnight on the event's clock (0 for an all-day event). */\n startMinutes: number;\n timeZone: string;\n allDay: boolean;\n}\n\nexport type ParsedRepeat =\n { kind: 'none' } | { kind: 'rule'; rule: RepeatRule } | { kind: 'kept'; text: string };\n\n/** The menu's ready-made rules. */\nexport type RepeatPreset =\n 'daily' | 'weekly' | 'monthlyNth' | 'monthlyLast' | 'yearly' | 'weekdays';\n\n/** The longest interval and count the builder offers. */\nexport const MAX_INTERVAL = 99;\nexport const MAX_COUNT = 999;\n\nconst WEEK_ORDER: readonly Weekday[] = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'];\nconst FREQUENCIES: readonly RepeatFrequency[] = ['DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY'];\nconst SECOND_MS = 1000;\n\nfunction isWeekday(value: string | undefined): value is Weekday {\n return WEEKDAYS.some((day) => day === value);\n}\n\nfunction isFrequency(value: string | undefined): value is RepeatFrequency {\n return FREQUENCIES.some((frequency) => frequency === value);\n}\n\n/** The start's weekday. */\nexport function weekdayCode(date: DateValue): Weekday {\n return WEEKDAYS[weekdayOf(date)] ?? 'MO';\n}\n\nfunction dayOfMonth(date: DateValue): number {\n return parseDateValue(date)?.day ?? 1;\n}\n\nfunction daysInMonth(date: DateValue): number {\n const parts = parseDateValue(date);\n if (!parts) return 31;\n return new Date(Date.UTC(parts.year, parts.month, 0)).getUTCDate();\n}\n\n/** Which of its weekday the date is in its month: 1 for the first … 5 for a fifth. */\nexport function nthOfMonth(date: DateValue): number {\n return Math.ceil(dayOfMonth(date) / 7);\n}\n\n/** The date is the last of its weekday in its month. */\nexport function isLastOfMonth(date: DateValue): boolean {\n return dayOfMonth(date) + 7 > daysInMonth(date);\n}\n\n/** Days in week order from Monday, each once. */\nfunction inWeekOrder(days: readonly Weekday[]): Weekday[] {\n const set = new Set(days);\n return WEEK_ORDER.filter((day) => set.has(day));\n}\n\nfunction sameDays(a: readonly Weekday[], b: readonly Weekday[]): boolean {\n const left = inWeekOrder(a);\n const right = inWeekOrder(b);\n return left.length === right.length && left.every((day, index) => day === right[index]);\n}\n\n// ── The menu's rules ─────────────────────────────────────────────────────────\n\n/**\n * The presets the menu offers for this start: \"on the last …\" only in a month's last week,\n * \"every weekday\" only from a weekday (the start is always an occurrence).\n */\nexport function presetsFor(anchor: RuleAnchor): RepeatPreset[] {\n const presets: RepeatPreset[] = ['daily', 'weekly'];\n if (nthOfMonth(anchor.start) <= 4) presets.push('monthlyNth');\n if (isLastOfMonth(anchor.start)) presets.push('monthlyLast');\n presets.push('yearly');\n if (WORKWEEK.includes(weekdayCode(anchor.start))) presets.push('weekdays');\n return presets;\n}\n\n/** A preset's rule for this start, repeating for ever. */\nexport function presetRule(preset: RepeatPreset, anchor: RuleAnchor): RepeatRule {\n const never: RepeatEnd = { kind: 'never' };\n const start = weekdayCode(anchor.start);\n switch (preset) {\n case 'daily':\n return { frequency: 'DAILY', interval: 1, weekdays: [], monthly: null, end: never };\n case 'weekly':\n return { frequency: 'WEEKLY', interval: 1, weekdays: [start], monthly: null, end: never };\n case 'monthlyNth':\n return { frequency: 'MONTHLY', interval: 1, weekdays: [], monthly: 'nthWeekday', end: never };\n case 'monthlyLast':\n return {\n frequency: 'MONTHLY',\n interval: 1,\n weekdays: [],\n monthly: 'lastWeekday',\n end: never,\n };\n case 'yearly':\n return { frequency: 'YEARLY', interval: 1, weekdays: [], monthly: null, end: never };\n case 'weekdays':\n return {\n frequency: 'WEEKLY',\n interval: 1,\n weekdays: [...WORKWEEK],\n monthly: null,\n end: never,\n };\n }\n}\n\n/** The preset a rule is, for this start; null for anything else (a custom rule). */\nexport function presetOf(rule: RepeatRule, anchor: RuleAnchor): RepeatPreset | null {\n for (const preset of presetsFor(anchor)) {\n const candidate = presetRule(preset, anchor);\n if (\n candidate.frequency === rule.frequency &&\n candidate.interval === rule.interval &&\n sameDays(candidate.weekdays, rule.weekdays) &&\n candidate.monthly === rule.monthly &&\n rule.end.kind === 'never'\n ) {\n return preset;\n }\n }\n return null;\n}\n\n// ── The Custom builder's changes ─────────────────────────────────────────────\n\n/** A new frequency: weekly starts on the start's day, monthly on its day of the month. */\nexport function withFrequency(\n rule: RepeatRule,\n frequency: RepeatFrequency,\n anchor: RuleAnchor\n): RepeatRule {\n if (rule.frequency === frequency) return rule;\n return {\n ...rule,\n frequency,\n weekdays: frequency === 'WEEKLY' ? [weekdayCode(anchor.start)] : [],\n monthly: frequency === 'MONTHLY' ? 'monthDay' : null,\n };\n}\n\n/** Turns a weekly day on or off; the start's own day stays on. */\nexport function withWeekdayToggled(rule: RepeatRule, day: Weekday, anchor: RuleAnchor): RepeatRule {\n if (rule.frequency !== 'WEEKLY' || day === weekdayCode(anchor.start)) return rule;\n const days = rule.weekdays.includes(day)\n ? rule.weekdays.filter((item) => item !== day)\n : [...rule.weekdays, day];\n return { ...rule, weekdays: inWeekOrder(days) };\n}\n\n/**\n * The rule after the event's start moved, so the start stays an occurrence: a weekly rule\n * takes the new start's day (the old start's day goes when it was the only one); a monthly\n * nth weekday past the fourth becomes the last, and a last weekday no longer last the nth.\n */\nexport function followStart(rule: RepeatRule, before: RuleAnchor, after: RuleAnchor): RepeatRule {\n if (rule.frequency === 'WEEKLY') {\n const oldDay = weekdayCode(before.start);\n const newDay = weekdayCode(after.start);\n if (oldDay === newDay) return rule;\n const kept = rule.weekdays.length === 1 && rule.weekdays[0] === oldDay ? [] : rule.weekdays;\n return { ...rule, weekdays: inWeekOrder([...kept, newDay]) };\n }\n if (rule.frequency === 'MONTHLY') {\n if (rule.monthly === 'nthWeekday' && nthOfMonth(after.start) > 4) {\n return { ...rule, monthly: 'lastWeekday' };\n }\n if (rule.monthly === 'lastWeekday' && !isLastOfMonth(after.start)) {\n return { ...rule, monthly: 'nthWeekday' };\n }\n }\n return rule;\n}\n\nexport type RuleProblem = 'interval' | 'count' | 'untilBeforeStart' | 'noWeekdays';\n\n/** What is wrong with a rule the builder holds; null when it can be saved. */\nexport function ruleProblem(rule: RepeatRule, anchor: RuleAnchor): RuleProblem | null {\n if (!Number.isInteger(rule.interval) || rule.interval < 1 || rule.interval > MAX_INTERVAL) {\n return 'interval';\n }\n if (rule.frequency === 'WEEKLY' && rule.weekdays.length === 0) return 'noWeekdays';\n if (\n rule.end.kind === 'count' &&\n (!Number.isInteger(rule.end.count) || rule.end.count < 1 || rule.end.count > MAX_COUNT)\n ) {\n return 'count';\n }\n if (rule.end.kind === 'until' && rule.end.date < anchor.start) return 'untilBeforeStart';\n return null;\n}\n\n// ── Writing ──────────────────────────────────────────────────────────────────\n\n/** `20261231T182959Z`: an instant as RFC 5545 writes a UTC time. */\nexport function utcStamp(instant: Date): string {\n return instant\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n .replace(/[-:]/g, '');\n}\n\n/** The UNTIL of a last day: the end of that day on the event's clock, in UTC. */\nfunction untilStamp(last: DateValue, anchor: RuleAnchor): string {\n if (anchor.allDay) return `${last.replace(/-/g, '')}T235959Z`;\n const nextMidnight = zonedTimeToInstant(addDays(last, 1), 0, anchor.timeZone);\n return utcStamp(new Date(nextMidnight.getTime() - SECOND_MS));\n}\n\n/** `3TU`, `-1FR`: the start's nth or last weekday of the month. */\nfunction monthlyWeekday(pattern: 'nthWeekday' | 'lastWeekday', anchor: RuleAnchor): string {\n const day = weekdayCode(anchor.start);\n return pattern === 'lastWeekday' ? `-1${day}` : `${nthOfMonth(anchor.start)}${day}`;\n}\n\n/** The RRULE value of a rule (without the `RRULE:` prefix), tied to `anchor`. */\nexport function buildRRule(rule: RepeatRule, anchor: RuleAnchor): string {\n const parts = [`FREQ=${rule.frequency}`];\n if (rule.interval > 1) parts.push(`INTERVAL=${rule.interval}`);\n if (rule.frequency === 'WEEKLY') {\n const days = inWeekOrder(rule.weekdays);\n const onlyStart = days.length === 1 && days[0] === weekdayCode(anchor.start);\n if (days.length > 0 && !onlyStart) parts.push(`BYDAY=${days.join(',')}`);\n }\n if (rule.frequency === 'MONTHLY' && rule.monthly && rule.monthly !== 'monthDay') {\n parts.push(`BYDAY=${monthlyWeekday(rule.monthly, anchor)}`);\n }\n if (rule.end.kind === 'count') parts.push(`COUNT=${rule.end.count}`);\n if (rule.end.kind === 'until') parts.push(`UNTIL=${untilStamp(rule.end.date, anchor)}`);\n return parts.join(';');\n}\n\n// ── Reading ──────────────────────────────────────────────────────────────────\n\n/** The rule's line: one line, or the RRULE line among DTSTART lines; null for anything more. */\nfunction ruleLine(text: string): string | null {\n const lines = text\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .filter((line) => line !== '');\n const rules = lines.filter((line) => !/^DTSTART[:;]/i.test(line));\n if (rules.length !== 1) return null;\n const [line] = rules;\n if (!line) return null;\n if (/^RRULE:/i.test(line)) return line.slice('RRULE:'.length);\n // A one-line value with another property name (EXDATE:, RDATE:, EXRULE:) isn't a rule.\n return /^[A-Z-]+[:;]/i.test(line) && !/^[A-Z]+=/i.test(line) ? null : line;\n}\n\n/** The day an UNTIL names, on the event's clock: the last day an occurrence can start. */\nfunction untilDate(value: string, anchor: RuleAnchor): DateValue | null {\n const match = /^(\\d{4})(\\d{2})(\\d{2})(?:T(\\d{2})(\\d{2})(\\d{2})(Z)?)?$/.exec(value);\n if (!match) return null;\n const [, year, month, day, hours, minutes, seconds, utc] = match;\n const date: DateValue = `${year}-${month}-${day}`;\n if (!parseDateValue(date)) return null;\n // A date, or a floating time: the day as written.\n if (hours === undefined || !utc) return date;\n const instant = new Date(\n Date.UTC(\n Number(year),\n Number(month) - 1,\n Number(day),\n Number(hours),\n Number(minutes),\n Number(seconds)\n )\n );\n const zone = anchor.allDay ? 'UTC' : anchor.timeZone;\n const minute = anchor.allDay ? 0 : anchor.startMinutes;\n let last = instantToZoned(instant, zone).date;\n // An UNTIL before that day's occurrence (an end of day in UTC, read east of UTC) ends a day\n // earlier.\n if (zonedTimeToInstant(last, minute, zone).getTime() > instant.getTime())\n last = addDays(last, -1);\n return last;\n}\n\ninterface WeekdayEntry {\n ordinal: number | null;\n day: Weekday;\n}\n\nfunction weekdayEntries(value: string): WeekdayEntry[] | null {\n const entries: WeekdayEntry[] = [];\n for (const raw of value.split(',')) {\n const match = /^([+-]?\\d{1,2})?(SU|MO|TU|WE|TH|FR|SA)$/.exec(raw.trim().toUpperCase());\n const day = match?.[2];\n if (!match || !isWeekday(day)) return null;\n const ordinal = match[1] === undefined ? null : Number(match[1]);\n entries.push({ ordinal, day });\n }\n return entries;\n}\n\n/** The monthly pattern a weekday entry names for this start; null when it isn't the start's. */\nfunction monthlyPatternOf(entry: WeekdayEntry, anchor: RuleAnchor): MonthlyPattern | null {\n if (entry.day !== weekdayCode(anchor.start)) return null;\n if (entry.ordinal === -1 && isLastOfMonth(anchor.start)) return 'lastWeekday';\n if (entry.ordinal === nthOfMonth(anchor.start) && entry.ordinal <= 4) return 'nthWeekday';\n return null;\n}\n\n/**\n * Reads a stored rule: one line, with or without `RRULE:`, with an inline `DTSTART=` (the\n * service writes one) or DTSTART lines around it. What the builder can't hold for this start is\n * `kept`, never changed or dropped.\n */\nexport function parseRRule(text: string | null | undefined, anchor: RuleAnchor): ParsedRepeat {\n const raw = (text ?? '').trim();\n if (raw === '') return { kind: 'none' };\n const kept: ParsedRepeat = { kind: 'kept', text: raw };\n const line = ruleLine(raw);\n if (line === null) return kept;\n\n const fields = new Map<string, string>();\n for (const part of line.split(';')) {\n if (part.trim() === '') continue;\n const at = part.indexOf('=');\n if (at <= 0) return kept;\n const name = part.slice(0, at).trim().toUpperCase();\n if (fields.has(name)) return kept;\n fields.set(name, part.slice(at + 1).trim());\n }\n // The service's inline start; the start is the event's own.\n fields.delete('DTSTART');\n\n const frequency = fields.get('FREQ')?.toUpperCase();\n if (!isFrequency(frequency)) return kept;\n fields.delete('FREQ');\n\n let interval = 1;\n const intervalText = fields.get('INTERVAL');\n if (intervalText !== undefined) {\n interval = Number(intervalText);\n if (!/^\\d+$/.test(intervalText) || interval < 1 || interval > MAX_INTERVAL) return kept;\n fields.delete('INTERVAL');\n }\n\n // A week starting on Monday is the default; another start only matters every 2+ weeks.\n const weekStart = fields.get('WKST');\n if (weekStart !== undefined) {\n if (weekStart.toUpperCase() !== 'MO' && frequency === 'WEEKLY' && interval > 1) return kept;\n fields.delete('WKST');\n }\n\n let end: RepeatEnd = { kind: 'never' };\n const countText = fields.get('COUNT');\n const untilText = fields.get('UNTIL');\n if (countText !== undefined && untilText !== undefined) return kept;\n if (countText !== undefined) {\n const count = Number(countText);\n if (!/^\\d+$/.test(countText) || count < 1 || count > MAX_COUNT) return kept;\n end = { kind: 'count', count };\n fields.delete('COUNT');\n }\n if (untilText !== undefined) {\n const date = untilDate(untilText.toUpperCase(), anchor);\n if (!date) return kept;\n end = { kind: 'until', date };\n fields.delete('UNTIL');\n }\n\n const byDayText = fields.get('BYDAY');\n const byDay = byDayText === undefined ? null : weekdayEntries(byDayText);\n if (byDayText !== undefined && byDay === null) return kept;\n fields.delete('BYDAY');\n const setPosText = fields.get('BYSETPOS');\n fields.delete('BYSETPOS');\n const monthDayText = fields.get('BYMONTHDAY');\n fields.delete('BYMONTHDAY');\n const monthText = fields.get('BYMONTH');\n fields.delete('BYMONTH');\n // Anything else (BYHOUR, BYWEEKNO, BYYEARDAY, TZID …) is beyond the builder.\n if (fields.size > 0) return kept;\n\n const startDay = weekdayCode(anchor.start);\n const base = { interval, end };\n switch (frequency) {\n case 'DAILY': {\n if (setPosText !== undefined || monthDayText !== undefined || monthText !== undefined) {\n return kept;\n }\n if (!byDay) {\n return { kind: 'rule', rule: { ...base, frequency, weekdays: [], monthly: null } };\n }\n // \"Daily on weekdays\", as some apps write every weekday: the same as weekly on those days.\n const days = byDay.map((entry) => entry.day);\n if (\n interval !== 1 ||\n byDay.some((entry) => entry.ordinal !== null) ||\n !days.includes(startDay)\n ) {\n return kept;\n }\n return {\n kind: 'rule',\n rule: { ...base, frequency: 'WEEKLY', weekdays: inWeekOrder(days), monthly: null },\n };\n }\n case 'WEEKLY': {\n if (setPosText !== undefined || monthDayText !== undefined || monthText !== undefined) {\n return kept;\n }\n const days = byDay ? byDay.map((entry) => entry.day) : [startDay];\n if (byDay?.some((entry) => entry.ordinal !== null) || !days.includes(startDay)) return kept;\n return {\n kind: 'rule',\n rule: { ...base, frequency, weekdays: inWeekOrder(days), monthly: null },\n };\n }\n case 'MONTHLY': {\n if (monthText !== undefined) return kept;\n if (monthDayText !== undefined) {\n if (\n byDay ||\n setPosText !== undefined ||\n Number(monthDayText) !== dayOfMonth(anchor.start)\n ) {\n return kept;\n }\n return { kind: 'rule', rule: { ...base, frequency, weekdays: [], monthly: 'monthDay' } };\n }\n if (!byDay) {\n if (setPosText !== undefined) return kept;\n return { kind: 'rule', rule: { ...base, frequency, weekdays: [], monthly: 'monthDay' } };\n }\n const [entry] = byDay;\n if (byDay.length !== 1 || !entry) return kept;\n let named: WeekdayEntry = entry;\n if (setPosText !== undefined) {\n // BYDAY=TU;BYSETPOS=3 is the third Tuesday, as 3TU.\n if (entry.ordinal !== null || !/^-?\\d{1,2}$/.test(setPosText)) return kept;\n named = { ordinal: Number(setPosText), day: entry.day };\n }\n const monthly = monthlyPatternOf(named, anchor);\n if (!monthly) return kept;\n return { kind: 'rule', rule: { ...base, frequency, weekdays: [], monthly } };\n }\n case 'YEARLY': {\n if (byDay || setPosText !== undefined) return kept;\n const parts = parseDateValue(anchor.start);\n if (monthText !== undefined && Number(monthText) !== parts?.month) return kept;\n if (monthDayText !== undefined && Number(monthDayText) !== parts?.day) return kept;\n return { kind: 'rule', rule: { ...base, frequency, weekdays: [], monthly: null } };\n }\n }\n}\n"],"mappings":";;;AAwBA,IAAaA,IAA+B;CAAC;C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AQ,MAAM;KAAE,GAAGF;KAAM;KAAW,UAAU,CAAC;KAAG;IAAQ;GAAE,IADtDpD;EAEvB;EACA,KAAK,UAAU;GACb,IAAI+C,KAASC,MAAe,KAAA,GAAW,OAAOhD;GAC9C,IAAM9B,IAAQF,EAAegB,EAAO,KAAK;GAGzC,OAFIkE,MAAc,KAAA,KAAa,OAAOA,CAAS,MAAMhF,GAAO,SACxD+E,MAAiB,KAAA,KAAa,OAAOA,CAAY,MAAM/E,GAAO,MAAY8B,IACvE;IAAE,MAAM;IAAQ,MAAM;KAAE,GAAGoD;KAAM;KAAW,UAAU,CAAC;KAAG,SAAS;IAAK;GAAE;EACnF;CACF;AACF"}
@@ -0,0 +1,50 @@
1
+ import { CreateEventInput, UpdateEventInput, UpdateScope } from '../../generated/wspace-types';
2
+ import { CalendarEventV2 } from '../types';
3
+ import { EventForm, GuestDraft, ReminderDraft } from './eventForm';
4
+ /**
5
+ * The footer's question for a repeating event. "This event" waits for B7: the calendar shows a
6
+ * series at its first date only, and the API changes one date of a series as a separate event
7
+ * (`modifyRecurringInstance`) that the views would show beside the series.
8
+ */
9
+ export type ScopeChoice = 'later' | 'all';
10
+ export interface RoomBookingPlan {
11
+ resourceId: string;
12
+ start: Date;
13
+ end: Date;
14
+ }
15
+ export interface SavePlan {
16
+ /** A new event: what `createEvent` takes. */
17
+ create: CreateEventInput | null;
18
+ /** An edit: the `updateEvent` calls, in order; none when the event itself didn't change. */
19
+ updates: {
20
+ input: UpdateEventInput;
21
+ scope: UpdateScope | null;
22
+ }[];
23
+ addGuests: GuestDraft[];
24
+ /** Guests the event has that the form doesn't (each with its `attendeeId`). */
25
+ removeGuests: GuestDraft[];
26
+ /** The booking to cancel first: the room changed, or the event's time did. */
27
+ cancelBookingId: string | null;
28
+ bookRoom: RoomBookingPlan | null;
29
+ addReminders: ReminderDraft[];
30
+ /** Reminders the event has that the form doesn't (each with its `reminderId`). */
31
+ removeReminders: ReminderDraft[];
32
+ }
33
+ /**
34
+ * The API's update scope. The dialog edits a series at its first date (the calendar shows no
35
+ * other until B7), where "this and later" is every event: so both are `ALL_EVENTS`. The
36
+ * service's THIS_AND_FUTURE splits the series at the new start and would leave the first date
37
+ * behind as an empty series.
38
+ */
39
+ export declare function scopeFor(choice: ScopeChoice): UpdateScope;
40
+ /** A new event's plan. The form must have a calendar (the dialog checks). */
41
+ export declare function planNewEvent(form: EventForm): SavePlan;
42
+ /** The event's times differ from the form's: a day for an all-day event, else the instants. */
43
+ export declare function timesChanged(form: EventForm, event: CalendarEventV2, calendarTimeZone: string): boolean;
44
+ /**
45
+ * An edit's plan: what differs between the form and the event as the service last returned it.
46
+ * `scope` matters only for a repeating event.
47
+ */
48
+ export declare function planEdit(form: EventForm, event: CalendarEventV2, calendarTimeZone: string, scope: ScopeChoice): SavePlan;
49
+ /** Nothing to send. */
50
+ export declare function isEmptyPlan(plan: SavePlan): boolean;
@@ -0,0 +1,125 @@
1
+ import { EVENT_TYPE_MEETING as e, SCOPE_ALL_EVENTS as t } from "../data/enums.js";
2
+ import { eventRoom as n, safeWebUrl as r } from "../events/eventModel.js";
3
+ import { eventDays as i } from "../time/calendarTime.js";
4
+ import { addressOf as a, endInstant as o, formFromEvent as s, locationIsRoomName as c, rruleOf as l, startInstant as u, videoOf as d } from "./eventForm.js";
5
+ import { videoServiceOf as f } from "./place.js";
6
+ // src/v2/event/savePlan.ts
7
+ function p(e) {
8
+ switch (e) {
9
+ case "later":
10
+ case "all": return t;
11
+ }
12
+ }
13
+ function m(e) {
14
+ let t = e.roomId !== null && !e.allDay || e.address.trim() !== "", n = e.videoUrl.trim() !== "";
15
+ return t && n ? "HYBRID" : n ? "ONLINE" : t ? "PHYSICAL" : null;
16
+ }
17
+ function h(e) {
18
+ let t = e.videoUrl.trim();
19
+ return t === "" ? "" : r(t) ?? t;
20
+ }
21
+ function g(e) {
22
+ return e.allDay ? null : e.roomId;
23
+ }
24
+ function _(e) {
25
+ let t = e.trim();
26
+ return t === "" ? void 0 : t;
27
+ }
28
+ function v(t) {
29
+ let n = u(t), r = o(t), i = l(t), a = h(t), s = g(t), c = {
30
+ calendarId: t.calendarId ?? "",
31
+ title: t.title.trim(),
32
+ eventType: e,
33
+ startTime: n.toISOString(),
34
+ endTime: r.toISOString(),
35
+ allDay: t.allDay,
36
+ timezone: t.timeZone,
37
+ visibility: t.visibility
38
+ };
39
+ _(t.description) && (c.description = t.description), i && (c.isRecurring = !0, c.rrule = i);
40
+ let d = _(t.address);
41
+ d && (c.location = d), a && (c.onlineMeetingUrl = a, c.onlineMeetingProvider = f(a));
42
+ let p = m(t);
43
+ return p && (c.locationType = p), {
44
+ create: c,
45
+ updates: [],
46
+ addGuests: t.guests,
47
+ removeGuests: [],
48
+ cancelBookingId: null,
49
+ bookRoom: s ? {
50
+ resourceId: s,
51
+ start: n,
52
+ end: r
53
+ } : null,
54
+ addReminders: t.reminders,
55
+ removeReminders: []
56
+ };
57
+ }
58
+ function y(e, t, n) {
59
+ if (e.allDay !== t.allDay) return !0;
60
+ if (e.allDay) {
61
+ let r = i(t, n);
62
+ return r.start !== e.firstDay || r.end !== e.lastDay;
63
+ }
64
+ return u(e).getTime() !== t.start.getTime() || o(e).getTime() !== t.end.getTime();
65
+ }
66
+ function b(e, t, r, i) {
67
+ let _ = s(t, r), v = {}, b = e.title.trim();
68
+ b !== t.title && (v.title = b), e.description !== (t.description ?? "") && (v.description = e.description);
69
+ let S = y(e, t, r);
70
+ S ? (v.startTime = u(e).toISOString(), v.endTime = o(e).toISOString(), v.allDay = e.allDay, v.timezone = e.timeZone) : !e.allDay && e.timeZone !== (t.timeZone ?? r) && (v.timezone = e.timeZone);
71
+ let C = l(e), w = t.isRecurring && C !== null && C !== l(_);
72
+ e.visibility !== t.visibility && (v.visibility = e.visibility);
73
+ let T = h(e), E = d(t), D = T !== E.url.trim();
74
+ D && (v.onlineMeetingUrl = T, T && (v.onlineMeetingProvider = f(T)), E.field === "locationUrl" && (v.locationUrl = ""));
75
+ let O = e.address.trim(), k = a(t), A = O !== k.text.trim();
76
+ A && (v[k.field] = O);
77
+ let j = g(e) !== g(_);
78
+ j && v.location === void 0 && c(t) && (v.location = "");
79
+ let M = m(e);
80
+ (D || A || j) && M !== t.locationType && (M !== null || t.locationType !== null) && (v.locationType = M ?? "TBD");
81
+ let N = t.isRecurring ? p(i) : null, P = [];
82
+ w && C && S ? P.push({
83
+ input: v,
84
+ scope: N
85
+ }, {
86
+ input: { rrule: C },
87
+ scope: N
88
+ }) : (w && C && (v.rrule = C), Object.keys(v).length > 0 && P.push({
89
+ input: v,
90
+ scope: N
91
+ }));
92
+ let F = new Set(e.guests.map((e) => e.key)), I = new Set(_.guests.map((e) => e.key)), L = x(e.reminders, _.reminders), R = n(t), z = R && (R.status === "APPROVED" || R.status === "PENDING") ? R : null, B = g(e), V = u(e), H = o(e), U = z !== null && z.resourceId === B && z.start.getTime() === V.getTime() && z.end.getTime() === H.getTime(), W = z !== null && !U, G = B !== null && !U;
93
+ return {
94
+ create: null,
95
+ updates: P,
96
+ addGuests: e.guests.filter((e) => !I.has(e.key)),
97
+ removeGuests: _.guests.filter((e) => !F.has(e.key)),
98
+ cancelBookingId: W ? z.id : null,
99
+ bookRoom: G ? {
100
+ resourceId: B,
101
+ start: V,
102
+ end: H
103
+ } : null,
104
+ addReminders: L.add,
105
+ removeReminders: L.remove
106
+ };
107
+ }
108
+ function x(e, t) {
109
+ let n = new Set(e.map((e) => e.reminderId).filter(Boolean)), r = t.filter((e) => e.reminderId !== null && !n.has(e.reminderId)), i = [];
110
+ for (let t of e) {
111
+ if (t.reminderId !== null) continue;
112
+ let e = r.findIndex((e) => e.minutesBefore === t.minutesBefore && e.channel === t.channel);
113
+ e >= 0 ? r.splice(e, 1) : i.push(t);
114
+ }
115
+ return {
116
+ add: i,
117
+ remove: r
118
+ };
119
+ }
120
+ function S(e) {
121
+ return e.create === null && e.updates.length === 0 && e.addGuests.length === 0 && e.removeGuests.length === 0 && e.cancelBookingId === null && e.bookRoom === null && e.addReminders.length === 0 && e.removeReminders.length === 0;
122
+ }
123
+ export { S as isEmptyPlan, b as planEdit, v as planNewEvent, p as scopeFor, y as timesChanged };
124
+
125
+ //# sourceMappingURL=savePlan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"savePlan.js","names":["scopeFor","choice","SCOPE_ALL_EVENTS","locationTypeOf","place","form","video","videoLinkOf","typed","safeWebUrl","roomOf","trimmedOrUndefined","value","text","planNewEvent","start","startInstant","end","endInstant","rrule","rruleOf","room","create","EVENT_TYPE_MEETING","address","videoServiceOf","locationType","timesChanged","event","days","eventDays","calendarTimeZone","planEdit","before","formFromEvent","input","title","moved","ruleChanged","storedVideo","videoOf","videoChanged","storedAddress","addressOf","addressChanged","roomChanged","locationIsRoomName","updateScope","scope","updates","formKeys","guest","keptKeys","reminders","reminderChanges","booking","eventRoom","active","holds","roomMoves","bookNew","kept","wanted","reminder","free","stored","add","same","item","isEmptyPlan","plan"],"sources":["../../../src/v2/event/savePlan.ts"],"sourcesContent":["/**\n * What saving the event dialog sends (BOFF-15698 A2), worked out from the form and, for an\n * edit, the event as the service last returned it. Pure.\n *\n * - A new event: `createEvent` with what it takes, then its guests, its room and its reminders,\n * which the service adds one at a time.\n * - An edit sends only what changed, so what the dialog doesn't show (tags, check-in, other\n * apps' fields) is never written over, and a save after a partial failure sends only the rest.\n * - Clearing a field sends an empty string: the service reads a null as \"unchanged\".\n * - A room follows the event: when its booking isn't for the room and the time the form asks\n * for (the time or the room changed, or an earlier save couldn't take the room along), the old\n * booking is cancelled and the room booked again, so the service checks it is free then\n * (changing a booking's times doesn't check). An all-day event holds no room.\n * - A repeating event takes the API's update scope from the footer's question (`scopeFor`).\n * When a series' start moves, the service rewrites its rule from the old one, so a new rule\n * with a new start goes in a second update after the first.\n */\nimport type { CreateEventInput, UpdateEventInput, UpdateScope } from '../../generated/wspace-types';\nimport { EVENT_TYPE_MEETING, SCOPE_ALL_EVENTS } from '../data/enums';\nimport { eventRoom, safeWebUrl } from '../events/eventModel';\nimport { eventDays } from '../time/calendarTime';\nimport type { CalendarEventV2 } from '../types';\nimport {\n addressOf,\n endInstant,\n formFromEvent,\n locationIsRoomName,\n rruleOf,\n startInstant,\n videoOf,\n type EventForm,\n type GuestDraft,\n type ReminderDraft,\n} from './eventForm';\nimport { videoServiceOf } from './place';\n\n/**\n * The footer's question for a repeating event. \"This event\" waits for B7: the calendar shows a\n * series at its first date only, and the API changes one date of a series as a separate event\n * (`modifyRecurringInstance`) that the views would show beside the series.\n */\nexport type ScopeChoice = 'later' | 'all';\n\nexport interface RoomBookingPlan {\n resourceId: string;\n start: Date;\n end: Date;\n}\n\nexport interface SavePlan {\n /** A new event: what `createEvent` takes. */\n create: CreateEventInput | null;\n /** An edit: the `updateEvent` calls, in order; none when the event itself didn't change. */\n updates: { input: UpdateEventInput; scope: UpdateScope | null }[];\n addGuests: GuestDraft[];\n /** Guests the event has that the form doesn't (each with its `attendeeId`). */\n removeGuests: GuestDraft[];\n /** The booking to cancel first: the room changed, or the event's time did. */\n cancelBookingId: string | null;\n bookRoom: RoomBookingPlan | null;\n addReminders: ReminderDraft[];\n /** Reminders the event has that the form doesn't (each with its `reminderId`). */\n removeReminders: ReminderDraft[];\n}\n\n/**\n * The API's update scope. The dialog edits a series at its first date (the calendar shows no\n * other until B7), where \"this and later\" is every event: so both are `ALL_EVENTS`. The\n * service's THIS_AND_FUTURE splits the series at the new start and would leave the first date\n * behind as an empty series.\n */\nexport function scopeFor(choice: ScopeChoice): UpdateScope {\n switch (choice) {\n case 'later':\n case 'all':\n return SCOPE_ALL_EVENTS;\n }\n}\n\n/** Where the event is: a room or an address, a video call, both, or nothing decided. */\nfunction locationTypeOf(form: EventForm): 'PHYSICAL' | 'ONLINE' | 'HYBRID' | null {\n const place = (form.roomId !== null && !form.allDay) || form.address.trim() !== '';\n const video = form.videoUrl.trim() !== '';\n if (place && video) return 'HYBRID';\n if (video) return 'ONLINE';\n return place ? 'PHYSICAL' : null;\n}\n\n/** The link to store: as the browser reads it (https added when it had no scheme). */\nfunction videoLinkOf(form: EventForm): string {\n const typed = form.videoUrl.trim();\n return typed === '' ? '' : (safeWebUrl(typed) ?? typed);\n}\n\n/** The room the form books: none for an all-day event. */\nfunction roomOf(form: EventForm): string | null {\n return form.allDay ? null : form.roomId;\n}\n\nfunction trimmedOrUndefined(text: string): string | undefined {\n const value = text.trim();\n return value === '' ? undefined : value;\n}\n\n/** A new event's plan. The form must have a calendar (the dialog checks). */\nexport function planNewEvent(form: EventForm): SavePlan {\n const start = startInstant(form);\n const end = endInstant(form);\n const rrule = rruleOf(form);\n const video = videoLinkOf(form);\n const room = roomOf(form);\n const create: CreateEventInput = {\n calendarId: form.calendarId ?? '',\n title: form.title.trim(),\n eventType: EVENT_TYPE_MEETING,\n startTime: start.toISOString(),\n endTime: end.toISOString(),\n allDay: form.allDay,\n timezone: form.timeZone,\n visibility: form.visibility,\n };\n const description = trimmedOrUndefined(form.description);\n if (description) create.description = form.description;\n if (rrule) {\n create.isRecurring = true;\n create.rrule = rrule;\n }\n const address = trimmedOrUndefined(form.address);\n if (address) create.location = address;\n if (video) {\n create.onlineMeetingUrl = video;\n create.onlineMeetingProvider = videoServiceOf(video);\n }\n const locationType = locationTypeOf(form);\n if (locationType) create.locationType = locationType;\n return {\n create,\n updates: [],\n addGuests: form.guests,\n removeGuests: [],\n cancelBookingId: null,\n bookRoom: room ? { resourceId: room, start, end } : null,\n addReminders: form.reminders,\n removeReminders: [],\n };\n}\n\n/** The event's times differ from the form's: a day for an all-day event, else the instants. */\nexport function timesChanged(\n form: EventForm,\n event: CalendarEventV2,\n calendarTimeZone: string\n): boolean {\n if (form.allDay !== event.allDay) return true;\n if (form.allDay) {\n const days = eventDays(event, calendarTimeZone);\n return days.start !== form.firstDay || days.end !== form.lastDay;\n }\n return (\n startInstant(form).getTime() !== event.start.getTime() ||\n endInstant(form).getTime() !== event.end.getTime()\n );\n}\n\n/**\n * An edit's plan: what differs between the form and the event as the service last returned it.\n * `scope` matters only for a repeating event.\n */\nexport function planEdit(\n form: EventForm,\n event: CalendarEventV2,\n calendarTimeZone: string,\n scope: ScopeChoice\n): SavePlan {\n const before = formFromEvent(event, calendarTimeZone);\n const input: UpdateEventInput = {};\n const title = form.title.trim();\n if (title !== event.title) input.title = title;\n if (form.description !== (event.description ?? '')) input.description = form.description;\n\n const moved = timesChanged(form, event, calendarTimeZone);\n if (moved) {\n input.startTime = startInstant(form).toISOString();\n input.endTime = endInstant(form).toISOString();\n input.allDay = form.allDay;\n input.timezone = form.timeZone;\n } else if (!form.allDay && form.timeZone !== (event.timeZone ?? calendarTimeZone)) {\n input.timezone = form.timeZone;\n }\n\n const rrule = rruleOf(form);\n const ruleChanged = event.isRecurring && rrule !== null && rrule !== rruleOf(before);\n if (form.visibility !== event.visibility) input.visibility = form.visibility;\n\n const video = videoLinkOf(form);\n const storedVideo = videoOf(event);\n const videoChanged = video !== storedVideo.url.trim();\n if (videoChanged) {\n input.onlineMeetingUrl = video;\n if (video) input.onlineMeetingProvider = videoServiceOf(video);\n // Today's form kept an online event's link in the location link: it moves to the meeting's.\n if (storedVideo.field === 'locationUrl') input.locationUrl = '';\n }\n const address = form.address.trim();\n const storedAddress = addressOf(event);\n const addressChanged = address !== storedAddress.text.trim();\n if (addressChanged) input[storedAddress.field] = address;\n // Where it is follows the place fields, and only when one of them changed: an event's stored\n // kind of place isn't rewritten by an edit that didn't touch them.\n const roomChanged = roomOf(form) !== roomOf(before);\n // A location that was only the room's name goes with the room (views would show it as an\n // address once the booking is gone).\n if (roomChanged && input.location === undefined && locationIsRoomName(event)) input.location = '';\n const locationType = locationTypeOf(form);\n if (\n (videoChanged || addressChanged || roomChanged) &&\n locationType !== event.locationType &&\n (locationType !== null || event.locationType !== null)\n ) {\n input.locationType = locationType ?? 'TBD';\n }\n\n const updateScope = event.isRecurring ? scopeFor(scope) : null;\n const updates: SavePlan['updates'] = [];\n if (ruleChanged && rrule && moved) {\n // The service would write the old rule over a new one that comes with a new start.\n updates.push({ input, scope: updateScope }, { input: { rrule }, scope: updateScope });\n } else {\n if (ruleChanged && rrule) input.rrule = rrule;\n if (Object.keys(input).length > 0) updates.push({ input, scope: updateScope });\n }\n\n const formKeys = new Set(form.guests.map((guest) => guest.key));\n const keptKeys = new Set(before.guests.map((guest) => guest.key));\n const reminders = reminderChanges(form.reminders, before.reminders);\n\n const booking = eventRoom(event);\n const active =\n booking && (booking.status === 'APPROVED' || booking.status === 'PENDING') ? booking : null;\n const room = roomOf(form);\n const start = startInstant(form);\n const end = endInstant(form);\n // The booking is right when it holds the room asked for at the form's time. One at another\n // time (the event moved, or an earlier save moved it but couldn't take the room along) is let\n // go and booked again, as is one for another room.\n const holds =\n active !== null &&\n active.resourceId === room &&\n active.start.getTime() === start.getTime() &&\n active.end.getTime() === end.getTime();\n const roomMoves = active !== null && !holds;\n const bookNew = room !== null && !holds;\n\n return {\n create: null,\n updates,\n addGuests: form.guests.filter((guest) => !keptKeys.has(guest.key)),\n removeGuests: before.guests.filter((guest) => !formKeys.has(guest.key)),\n cancelBookingId: roomMoves ? active.id : null,\n bookRoom: bookNew ? { resourceId: room, start, end } : null,\n addReminders: reminders.add,\n removeReminders: reminders.remove,\n };\n}\n\n/**\n * Reminders to add and remove. A new one at the same time and on the same channel as one the\n * event has is that one: after a save that stopped part way, the reminders that did save are\n * the event's now, and saving again must not add them twice.\n */\nfunction reminderChanges(\n wanted: readonly ReminderDraft[],\n stored: readonly ReminderDraft[]\n): { add: ReminderDraft[]; remove: ReminderDraft[] } {\n const kept = new Set(wanted.map((reminder) => reminder.reminderId).filter(Boolean));\n const free = stored.filter(\n (reminder) => reminder.reminderId !== null && !kept.has(reminder.reminderId)\n );\n const add: ReminderDraft[] = [];\n for (const reminder of wanted) {\n if (reminder.reminderId !== null) continue;\n const same = free.findIndex(\n (item) => item.minutesBefore === reminder.minutesBefore && item.channel === reminder.channel\n );\n if (same >= 0) free.splice(same, 1);\n else add.push(reminder);\n }\n return { add, remove: free };\n}\n\n/** Nothing to send. */\nexport function isEmptyPlan(plan: SavePlan): boolean {\n return (\n plan.create === null &&\n plan.updates.length === 0 &&\n plan.addGuests.length === 0 &&\n plan.removeGuests.length === 0 &&\n plan.cancelBookingId === null &&\n plan.bookRoom === null &&\n plan.addReminders.length === 0 &&\n plan.removeReminders.length === 0\n );\n}\n"],"mappings":";;;;;;AAuEA,SAAgBA,EAAS,GAAkC;CACzD,QAAQC,GAAR;EACE,KAAK;EACL,KAAK,OACH,OAAOC;CACX;AACF;AAGA,SAASC,EAAe,GAA0D;CAChF,IAAMC,IAASC,EAAK,WAAW,QAAQ,CAACA,EAAK,UAAWA,EAAK,QAAQ,KAAK,MAAM,IAC1EC,IAAQD,EAAK,SAAS,KAAK,MAAM;CAGvC,OAFID,KAASE,IAAc,WACvBA,IAAc,WACXF,IAAQ,aAAa;AAC9B;AAGA,SAASG,EAAY,GAAyB;CAC5C,IAAMC,IAAQH,EAAK,SAAS,KAAK;CACjC,OAAOG,MAAU,KAAK,KAAMC,EAAWD,CAAK,KAAKA;AACnD;AAGA,SAASE,EAAO,GAAgC;CAC9C,OAAOL,EAAK,SAAS,OAAOA,EAAK;AACnC;AAEA,SAASM,EAAmB,GAAkC;CAC5D,IAAMC,IAAQC,EAAK,KAAK;CACxB,OAAOD,MAAU,KAAK,KAAA,IAAYA;AACpC;AAGA,SAAgBE,EAAa,GAA2B;CACtD,IAAMC,IAAQC,EAAaX,CAAI,GACzBY,IAAMC,EAAWb,CAAI,GACrBc,IAAQC,EAAQf,CAAI,GACpBC,IAAQC,EAAYF,CAAI,GACxBgB,IAAOX,EAAOL,CAAI,GAClBiB,IAA2B;EAC/B,YAAYjB,EAAK,cAAc;EAC/B,OAAOA,EAAK,MAAM,KAAK;EACvB,WAAWkB;EACX,WAAWR,EAAM,YAAY;EAC7B,SAASE,EAAI,YAAY;EACzB,QAAQZ,EAAK;EACb,UAAUA,EAAK;EACf,YAAYA,EAAK;CACnB;CAGA,AAFoBM,EAAmBN,EAAK,WACxC,MAAa,EAAO,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