@burdenoff/microfe-calendar 2026.1124.2 → 2026.1124.4

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 (130) hide show
  1. package/dist/generated/wspace-operations.d.ts +811 -69
  2. package/dist/generated/wspace-operations.js +173 -19
  3. package/dist/generated/wspace-operations.js.map +1 -1
  4. package/dist/generated/wspace-types.d.ts +405 -6
  5. package/dist/pages/ResourcesPage.js.map +1 -1
  6. package/dist/translations/en.d.ts +250 -1
  7. package/dist/v2/CalendarPageV2.js +45 -41
  8. package/dist/v2/CalendarPageV2.js.map +1 -1
  9. package/dist/v2/CalendarRoutesV2.js +64 -64
  10. package/dist/v2/CalendarRoutesV2.js.map +1 -1
  11. package/dist/v2/data/enums.d.ts +1 -0
  12. package/dist/v2/data/enums.js +6 -2
  13. package/dist/v2/data/enums.js.map +1 -1
  14. package/dist/v2/data/errors.d.ts +5 -0
  15. package/dist/v2/data/errors.js +6 -2
  16. package/dist/v2/data/errors.js.map +1 -1
  17. package/dist/v2/data/normalize.d.ts +31 -3
  18. package/dist/v2/data/normalize.js +57 -13
  19. package/dist/v2/data/normalize.js.map +1 -1
  20. package/dist/v2/data/seriesDateLookup.d.ts +9 -0
  21. package/dist/v2/data/seriesDateLookup.js +12 -0
  22. package/dist/v2/data/seriesDateLookup.js.map +1 -0
  23. package/dist/v2/data/useEventActions.d.ts +9 -3
  24. package/dist/v2/data/useEventActions.js +239 -186
  25. package/dist/v2/data/useEventActions.js.map +1 -1
  26. package/dist/v2/data/useEventForPeek.js +63 -21
  27. package/dist/v2/data/useEventForPeek.js.map +1 -1
  28. package/dist/v2/data/useEventsInRangeV2.d.ts +40 -2
  29. package/dist/v2/data/useEventsInRangeV2.js +76 -47
  30. package/dist/v2/data/useEventsInRangeV2.js.map +1 -1
  31. package/dist/v2/day/DayPanel.js +1 -1
  32. package/dist/v2/day/DayPanel.js.map +1 -1
  33. package/dist/v2/dialogs/CalendarDialogsV2.js +12 -9
  34. package/dist/v2/dialogs/CalendarDialogsV2.js.map +1 -1
  35. package/dist/v2/event/CustomRepeat.d.ts +5 -0
  36. package/dist/v2/event/CustomRepeat.js +246 -0
  37. package/dist/v2/event/CustomRepeat.js.map +1 -0
  38. package/dist/v2/event/EventDetailsTab.d.ts +6 -0
  39. package/dist/v2/event/EventDetailsTab.js +291 -0
  40. package/dist/v2/event/EventDetailsTab.js.map +1 -0
  41. package/dist/v2/event/EventDialog.d.ts +35 -0
  42. package/dist/v2/event/EventDialog.js +388 -0
  43. package/dist/v2/event/EventDialog.js.map +1 -0
  44. package/dist/v2/event/EventDialogs.d.ts +3 -0
  45. package/dist/v2/event/EventDialogs.js +118 -0
  46. package/dist/v2/event/EventDialogs.js.map +1 -0
  47. package/dist/v2/event/EventMoreTab.d.ts +4 -0
  48. package/dist/v2/event/EventMoreTab.js +215 -0
  49. package/dist/v2/event/EventMoreTab.js.map +1 -0
  50. package/dist/v2/event/EventPeopleTab.d.ts +8 -0
  51. package/dist/v2/event/EventPeopleTab.js +422 -0
  52. package/dist/v2/event/EventPeopleTab.js.map +1 -0
  53. package/dist/v2/event/EventPlaceTab.d.ts +6 -0
  54. package/dist/v2/event/EventPlaceTab.js +264 -0
  55. package/dist/v2/event/EventPlaceTab.js.map +1 -0
  56. package/dist/v2/event/FindTimeDialog.d.ts +26 -0
  57. package/dist/v2/event/FindTimeDialog.js +667 -0
  58. package/dist/v2/event/FindTimeDialog.js.map +1 -0
  59. package/dist/v2/event/RepeatField.d.ts +5 -0
  60. package/dist/v2/event/RepeatField.js +91 -0
  61. package/dist/v2/event/RepeatField.js.map +1 -0
  62. package/dist/v2/event/dialogLogic.d.ts +97 -0
  63. package/dist/v2/event/dialogLogic.js +120 -0
  64. package/dist/v2/event/dialogLogic.js.map +1 -0
  65. package/dist/v2/event/dialogModel.d.ts +51 -0
  66. package/dist/v2/event/dialogModel.js +13 -0
  67. package/dist/v2/event/dialogModel.js.map +1 -0
  68. package/dist/v2/event/eventForm.d.ts +235 -0
  69. package/dist/v2/event/eventForm.js +450 -0
  70. package/dist/v2/event/eventForm.js.map +1 -0
  71. package/dist/v2/event/findTime.d.ts +120 -0
  72. package/dist/v2/event/findTime.js +149 -0
  73. package/dist/v2/event/findTime.js.map +1 -0
  74. package/dist/v2/event/findTimeSource.d.ts +102 -0
  75. package/dist/v2/event/findTimeSource.js +107 -0
  76. package/dist/v2/event/findTimeSource.js.map +1 -0
  77. package/dist/v2/event/parts.d.ts +46 -0
  78. package/dist/v2/event/parts.js +124 -0
  79. package/dist/v2/event/parts.js.map +1 -0
  80. package/dist/v2/event/place.d.ts +64 -0
  81. package/dist/v2/event/place.js +48 -0
  82. package/dist/v2/event/place.js.map +1 -0
  83. package/dist/v2/event/repeatWords.d.ts +19 -0
  84. package/dist/v2/event/repeatWords.js +130 -0
  85. package/dist/v2/event/repeatWords.js.map +1 -0
  86. package/dist/v2/event/rrule.d.ts +90 -0
  87. package/dist/v2/event/rrule.js +368 -0
  88. package/dist/v2/event/rrule.js.map +1 -0
  89. package/dist/v2/event/savePlan.d.ts +160 -0
  90. package/dist/v2/event/savePlan.js +219 -0
  91. package/dist/v2/event/savePlan.js.map +1 -0
  92. package/dist/v2/event/useEventData.d.ts +96 -0
  93. package/dist/v2/event/useEventData.js +229 -0
  94. package/dist/v2/event/useEventData.js.map +1 -0
  95. package/dist/v2/event/useEventDialogModel.d.ts +50 -0
  96. package/dist/v2/event/useEventDialogModel.js +144 -0
  97. package/dist/v2/event/useEventDialogModel.js.map +1 -0
  98. package/dist/v2/event/useEventSave.d.ts +57 -0
  99. package/dist/v2/event/useEventSave.js +276 -0
  100. package/dist/v2/event/useEventSave.js.map +1 -0
  101. package/dist/v2/events/eventLook.js +16 -16
  102. package/dist/v2/events/eventLook.js.map +1 -1
  103. package/dist/v2/events/eventModel.d.ts +17 -4
  104. package/dist/v2/events/eventModel.js +46 -34
  105. package/dist/v2/events/eventModel.js.map +1 -1
  106. package/dist/v2/events/localChanges.d.ts +4 -1
  107. package/dist/v2/events/localChanges.js +4 -2
  108. package/dist/v2/events/localChanges.js.map +1 -1
  109. package/dist/v2/format.d.ts +2 -0
  110. package/dist/v2/format.js +4 -0
  111. package/dist/v2/format.js.map +1 -1
  112. package/dist/v2/page/CalendarPageContext.d.ts +2 -2
  113. package/dist/v2/page/CalendarPageContext.js.map +1 -1
  114. package/dist/v2/page/useCalendarPageModel.js +141 -139
  115. package/dist/v2/page/useCalendarPageModel.js.map +1 -1
  116. package/dist/v2/page/viewState.d.ts +9 -1
  117. package/dist/v2/page/viewState.js +5 -3
  118. package/dist/v2/page/viewState.js.map +1 -1
  119. package/dist/v2/peek/EventPeek.js.map +1 -1
  120. package/dist/v2/peek/PeekEvent.js +210 -204
  121. package/dist/v2/peek/PeekEvent.js.map +1 -1
  122. package/dist/v2/rail/CalendarRail.js.map +1 -1
  123. package/dist/v2/rail/useMonthEventDates.js +1 -1
  124. package/dist/v2/rail/useMonthEventDates.js.map +1 -1
  125. package/dist/v2/runs/RunPeek.js.map +1 -1
  126. package/dist/v2/states/CalendarStates.d.ts +15 -0
  127. package/dist/v2/states/CalendarStates.js +42 -11
  128. package/dist/v2/states/CalendarStates.js.map +1 -1
  129. package/dist/v2/types.d.ts +32 -2
  130. package/package.json +1 -1
@@ -0,0 +1,667 @@
1
+ import { useCalendar as e } from "../../providers/CalendarProvider.js";
2
+ import { useFreeBusy as t } from "../data/useFreeBusy.js";
3
+ import { formatDay as n, formatDuration as r, formatMinuteRange as i, formatMinutes as a } from "../format.js";
4
+ import { offHours as o, workingHoursOn as s } from "../grid/workingHours.js";
5
+ import { useCalendarPage as c } from "../page/CalendarPageContext.js";
6
+ import { FOCUS_RING as l } from "../styles.js";
7
+ import { daysToInstants as u, instantToZoned as d, zonedTimeToInstant as f } from "../time/calendarTime.js";
8
+ import { LENGTH_CHIPS as p } from "./eventForm.js";
9
+ import { blocksOnDay as m, clashesAt as h, minuteAt as g, movesDirectly as _, personBusySpans as v, suggestTimes as y, timelineWindow as b } from "./findTime.js";
10
+ import { bookedRoomNameOf as x, findTimeRoomOf as S, participantsOf as C, pickEndClock as w, roomIdOf as T, startDayOf as E, startLengthOf as ee } from "./findTimeSource.js";
11
+ import { useIdentities as D, useRoomsForEvent as O } from "./useEventData.js";
12
+ import { Fragment as k, useMemo as A, useState as j } from "react";
13
+ import { AlertTriangle as M, Building2 as te, ChevronLeft as N, ChevronRight as P, CircleCheck as F, Users as I } from "lucide-react";
14
+ import { jsx as L, jsxs as R } from "react/jsx-runtime";
15
+ import { Button as z, DatePicker as ne, EntityAvatar as re, IconTile as ie, Notice as ae, Segmented as B, TabbedDialog as V, TabbedDialogContent as H, TabbedDialogFooter as U, TabbedDialogHeader as W, addDays as G } from "@burdenoff/fe-libs/ui";
16
+ import { cn as K } from "@burdenoff/fe-libs/utils";
17
+ // src/v2/event/FindTimeDialog.tsx
18
+ var q = 7, J = 30, Y = 15;
19
+ function oe({ source: e, ...t }) {
20
+ if (e.kind === "form") {
21
+ let n = {
22
+ kind: "form",
23
+ form: e.session.form,
24
+ event: e.event
25
+ };
26
+ return /* @__PURE__ */ L(Z, {
27
+ basis: n,
28
+ ...t
29
+ });
30
+ }
31
+ if (e.kind === "none") return /* @__PURE__ */ L(Z, {
32
+ basis: { kind: "none" },
33
+ ...t
34
+ });
35
+ if (e.edited.status === "ready") {
36
+ let n = e.edited.event;
37
+ return /* @__PURE__ */ L(Z, {
38
+ basis: {
39
+ kind: "event",
40
+ event: n
41
+ },
42
+ ...t
43
+ }, n.id);
44
+ }
45
+ return /* @__PURE__ */ L(se, {
46
+ edited: e.edited,
47
+ onClose: t.onClose
48
+ });
49
+ }
50
+ function X({ subtitle: e }) {
51
+ let { tr: t } = c();
52
+ return /* @__PURE__ */ L(W, {
53
+ icon: /* @__PURE__ */ L(ie, {
54
+ size: "sm",
55
+ "aria-hidden": "true",
56
+ children: /* @__PURE__ */ L(I, {})
57
+ }),
58
+ title: t("calendar.v2.findTime", "Find a time"),
59
+ description: e,
60
+ closeLabel: t("calendar.v2.close", "Close")
61
+ });
62
+ }
63
+ function se({ edited: e, onClose: t }) {
64
+ let { tr: n } = c(), r = /* @__PURE__ */ L("div", {
65
+ className: "text-sm text-text-secondary",
66
+ children: n("calendar.v2.openingEvent", "Opening the event…")
67
+ });
68
+ return e.status === "missing" ? r = /* @__PURE__ */ R("div", {
69
+ className: "flex max-w-sm flex-col gap-2",
70
+ children: [/* @__PURE__ */ L("b", {
71
+ className: "text-base text-text-primary",
72
+ children: n("calendar.v2.peekMissing", "This event isn’t available")
73
+ }), /* @__PURE__ */ L("p", {
74
+ className: "text-sm text-text-secondary",
75
+ children: n("calendar.v2.actionGone", "It may have been deleted or moved by someone else.")
76
+ })]
77
+ }) : e.status === "error" && (r = /* @__PURE__ */ R("div", {
78
+ className: "flex max-w-sm flex-col items-center gap-3",
79
+ children: [/* @__PURE__ */ L("b", {
80
+ className: "text-base text-text-primary",
81
+ children: n("calendar.v2.peekFailed", "Couldn’t open the event")
82
+ }), /* @__PURE__ */ L(z, {
83
+ type: "button",
84
+ variant: "outline",
85
+ onClick: e.retry,
86
+ children: n("calendar.v2.tryAgain", "Try again")
87
+ })]
88
+ })), /* @__PURE__ */ L(V, {
89
+ open: !0,
90
+ onOpenChange: (e) => e ? void 0 : t(),
91
+ children: /* @__PURE__ */ R(H, {
92
+ size: "viewer",
93
+ className: "sm:max-w-[760px]",
94
+ "aria-describedby": void 0,
95
+ children: [
96
+ /* @__PURE__ */ L(X, {}),
97
+ /* @__PURE__ */ L("div", {
98
+ className: "grid min-h-0 flex-1 place-items-center p-6 text-center",
99
+ children: r
100
+ }),
101
+ /* @__PURE__ */ L(U, { children: /* @__PURE__ */ L(z, {
102
+ type: "button",
103
+ variant: "outline",
104
+ onClick: t,
105
+ children: n("calendar.v2.close", "Close")
106
+ }) })
107
+ ]
108
+ })
109
+ });
110
+ }
111
+ function ce(e) {
112
+ let t = e.flatMap((e) => e.userId ? [e.userId] : []).join("\n");
113
+ return A(() => t ? t.split("\n") : [], [t]);
114
+ }
115
+ function le(t) {
116
+ let { tr: n, me: r } = c(), { currentUser: i } = e(), a = i?.name?.trim() || i?.email || n("calendar.v2.evYou", "You");
117
+ return C(t, r, {
118
+ you: `${a} ${n("calendar.v2.youSuffix", "(you)")}`,
119
+ organiser: n("calendar.v2.organiser", "Organiser"),
120
+ required: n("calendar.v2.evRequired", "Required"),
121
+ optional: n("calendar.v2.evOptional", "Optional"),
122
+ guest: n("calendar.v2.guest", "Guest")
123
+ });
124
+ }
125
+ function ue(e, t, n, r, i) {
126
+ let a = e && !e.allDay ? {
127
+ start: e.start,
128
+ end: e.end
129
+ } : null, o = new Set((e?.guests ?? []).filter((e) => e.response !== "DECLINED").map((e) => e.userId));
130
+ return e && o.add(e.organizerId), (e) => {
131
+ let s = e.userId;
132
+ if (s === null || s !== t && n.status === "ready" && !n.byUserId.has(s)) return null;
133
+ let c = r.byUserId.get(s);
134
+ return c ? v(c, i, o.has(s) ? a : null) : [];
135
+ };
136
+ }
137
+ function de(e, t, n, r) {
138
+ if ([
139
+ e.status,
140
+ t.status,
141
+ n.status
142
+ ].includes("error")) return "error";
143
+ let i = t.status === "ready" || t.status === "idle", a = !r || n.status === "ready";
144
+ return e.status === "ready" && i && a ? "ready" : "loading";
145
+ }
146
+ function fe(e, n) {
147
+ let { tr: r, timeZone: i, me: a } = c(), o = e.kind === "none" ? null : e.event, l = le(e), d = ce(l), f = D(d), p = u(n, G(n, 6), i), m = t(d, p.from, p.to), h = T(e), g = O(p.to, { skip: h === null }), _ = S(h, g, x(e) ?? r("calendar.v2.theRoom", "The room"), p, o?.eventId ?? null), v = a && m.status === "ready" ? m.byUserId.get(a)?.workingHours ?? [] : null;
148
+ return {
149
+ participants: l,
150
+ busyOf: ue(o, a, f, m, i),
151
+ room: _,
152
+ hoursOn: (e) => v ? s(e, v, i) : null,
153
+ status: de(m, f, g, h !== null),
154
+ retry: () => {
155
+ m.refetch(), f.retry(), g.retry();
156
+ },
157
+ truncated: l.filter((e) => e.userId !== null && m.byUserId.get(e.userId)?.truncated),
158
+ nameOf: (e) => e.userId && e.userId !== a ? f.byUserId.get(e.userId)?.name ?? e.name : e.name
159
+ };
160
+ }
161
+ function pe(e) {
162
+ let { tr: t, me: n } = c();
163
+ return (r) => r.map((r) => {
164
+ if (e.room && r === e.room.id) return t("calendar.v2.ftRoomBooked", "{{room}} is booked", { room: e.room.name });
165
+ if (n && r === `u:${n}`) return t("calendar.v2.ftYouBusy", "You’re busy");
166
+ let i = e.participants.find((e) => e.key === r), a = i ? e.nameOf(i) : r;
167
+ return t("calendar.v2.ftPersonBusy", "{{name}} is busy", { name: a.split(" ")[0] ?? a });
168
+ }).join(" · ");
169
+ }
170
+ function me(e, t) {
171
+ let { tr: n, durationWords: i } = c(), a = e.participants.length, o = a === 1 ? n("calendar.v2.peopleOne", "1 person") : n("calendar.v2.peopleMany", "{{count}} people", { count: a });
172
+ return [r(t, i), e.room ? n("calendar.v2.ftWhoAndRoom", "{{who}} and {{room}}", {
173
+ who: o,
174
+ room: e.room.name
175
+ }) : o].join(" · ");
176
+ }
177
+ function Z({ basis: e, onUse: t, onBack: n, onClose: r }) {
178
+ let i = c(), { tr: a, timeZone: o, me: s } = i, [l, u] = j(() => ee(e)), [d, p] = j(() => E(e, o, i.today)), [m, g] = j(null), v = fe(e, d), b = pe(v), x = v.participants.flatMap((e) => {
179
+ let t = v.busyOf(e);
180
+ return t === null ? [] : [{
181
+ id: e.key,
182
+ required: e.required,
183
+ busy: t
184
+ }];
185
+ }), S = v.status === "ready" ? y({
186
+ day: d,
187
+ days: q,
188
+ timeZone: o,
189
+ length: l,
190
+ now: i.now,
191
+ step: J,
192
+ workingHours: v.hoursOn,
193
+ people: x,
194
+ room: v.room
195
+ }) : [], C = S[0], w = m ?? (C ? {
196
+ date: C.date,
197
+ start: C.start
198
+ } : null), T = w ? f(w.date, w.start, o) : null, D = T ? h(x, v.room, T, new Date(T.getTime() + l * 6e4)).clashes : [], O = e.kind === "event" ? e.event : null, k = O !== null && _(O, i.calendarsById.get(O.calendarId), s, o), A = me(v, l), M = () => n ? n() : r();
199
+ return /* @__PURE__ */ L(V, {
200
+ open: !0,
201
+ onOpenChange: (e) => e ? void 0 : M(),
202
+ children: /* @__PURE__ */ R(H, {
203
+ size: "viewer",
204
+ className: "sm:max-w-[760px]",
205
+ "aria-describedby": void 0,
206
+ children: [
207
+ /* @__PURE__ */ L(X, { subtitle: A }),
208
+ /* @__PURE__ */ L("div", {
209
+ className: "min-h-0 flex-1 overflow-y-auto overscroll-contain p-5",
210
+ children: /* @__PURE__ */ R("div", {
211
+ className: "flex flex-col gap-5",
212
+ children: [
213
+ /* @__PURE__ */ L(Q, {
214
+ length: l,
215
+ onLength: (e) => {
216
+ u(e), g(null);
217
+ },
218
+ day: d,
219
+ onDay: (e) => {
220
+ p(e), g(null);
221
+ }
222
+ }),
223
+ /* @__PURE__ */ L(_e, {
224
+ data: v,
225
+ suggestions: S,
226
+ chosen: w,
227
+ onPick: g,
228
+ day: d,
229
+ clashWords: b
230
+ }),
231
+ /* @__PURE__ */ L(Ce, {
232
+ data: v,
233
+ day: d,
234
+ length: l,
235
+ chosen: w,
236
+ onPick: (e) => g({
237
+ date: d,
238
+ start: e
239
+ })
240
+ })
241
+ ]
242
+ })
243
+ }),
244
+ /* @__PURE__ */ R(U, {
245
+ className: "gap-2",
246
+ children: [
247
+ /* @__PURE__ */ L(we, {
248
+ chosen: w,
249
+ length: l,
250
+ ready: v.status === "ready",
251
+ clashes: D,
252
+ clashWords: b
253
+ }),
254
+ /* @__PURE__ */ L(z, {
255
+ type: "button",
256
+ variant: "outline",
257
+ onClick: M,
258
+ children: n ? a("calendar.v2.ftBack", "Back") : a("calendar.v2.evCancel", "Cancel")
259
+ }),
260
+ /* @__PURE__ */ L(z, {
261
+ type: "button",
262
+ disabled: !w || v.status !== "ready",
263
+ onClick: () => w ? t({
264
+ ...w,
265
+ length: l
266
+ }, e) : void 0,
267
+ children: k ? a("calendar.v2.ftMoveHere", "Move the event here") : a("calendar.v2.ftUse", "Use this time")
268
+ })
269
+ ]
270
+ })
271
+ ]
272
+ })
273
+ });
274
+ }
275
+ function Q({ length: e, onLength: t, day: n, onDay: i }) {
276
+ let a = c(), { tr: o, format: s, today: l } = a, u = [.../* @__PURE__ */ new Set([...p, e])].sort((e, t) => e - t);
277
+ return /* @__PURE__ */ R("div", {
278
+ className: "flex flex-wrap items-end gap-x-6 gap-y-3",
279
+ children: [/* @__PURE__ */ R("div", {
280
+ className: "flex flex-col gap-1.5 max-md:w-full",
281
+ children: [/* @__PURE__ */ L("span", {
282
+ id: "calendar-ft-length",
283
+ className: "text-sm font-semibold text-text-primary",
284
+ children: o("calendar.v2.evLength", "Length")
285
+ }), /* @__PURE__ */ L(B, {
286
+ "aria-labelledby": "calendar-ft-length",
287
+ value: String(e),
288
+ onValueChange: (e) => t(Number(e)),
289
+ options: u.map((e) => ({
290
+ value: String(e),
291
+ label: r(e, a.durationWords)
292
+ }))
293
+ })]
294
+ }), /* @__PURE__ */ R("div", {
295
+ className: "flex flex-col gap-1.5",
296
+ children: [/* @__PURE__ */ L("span", {
297
+ id: "calendar-ft-day",
298
+ className: "text-sm font-semibold text-text-primary",
299
+ children: o("calendar.v2.day", "Day")
300
+ }), /* @__PURE__ */ R("div", {
301
+ className: "flex items-center gap-1.5",
302
+ role: "group",
303
+ "aria-labelledby": "calendar-ft-day",
304
+ children: [
305
+ /* @__PURE__ */ L(z, {
306
+ type: "button",
307
+ variant: "outline",
308
+ size: "icon-sm",
309
+ "aria-label": o("calendar.v2.ftPrevDay", "Previous day"),
310
+ disabled: n <= l,
311
+ onClick: () => i(G(n, -1)),
312
+ children: /* @__PURE__ */ L(N, { "aria-hidden": "true" })
313
+ }),
314
+ /* @__PURE__ */ L(ne, {
315
+ value: n,
316
+ onChange: i,
317
+ label: o("calendar.v2.day", "Day"),
318
+ weekStartsOn: a.prefs.weekStart,
319
+ locale: s.locale,
320
+ timeZone: a.timeZone,
321
+ min: l,
322
+ format: {
323
+ weekday: "long",
324
+ day: "numeric",
325
+ month: "short"
326
+ }
327
+ }),
328
+ /* @__PURE__ */ L(z, {
329
+ type: "button",
330
+ variant: "outline",
331
+ size: "icon-sm",
332
+ "aria-label": o("calendar.v2.ftNextDay", "Next day"),
333
+ onClick: () => i(G(n, 1)),
334
+ children: /* @__PURE__ */ L(P, { "aria-hidden": "true" })
335
+ })
336
+ ]
337
+ })]
338
+ })]
339
+ });
340
+ }
341
+ function he({ suggestion: e, checked: t, onPick: r, clashWords: a }) {
342
+ let { tr: o, format: s, timeZone: u } = c();
343
+ return /* @__PURE__ */ R("button", {
344
+ type: "button",
345
+ role: "radio",
346
+ "aria-checked": t,
347
+ onClick: r,
348
+ className: K("flex min-w-0 flex-col gap-1 rounded-card border p-3 text-start motion-safe:transition-colors", t ? "border-action-primary-bg bg-accent-soft shadow-[inset_0_0_0_1px_var(--color-action-primary-bg)]" : "border-border-default bg-bg-surface hover:border-border-strong", l),
349
+ children: [/* @__PURE__ */ R("b", {
350
+ className: "text-sm font-semibold text-text-primary",
351
+ children: [
352
+ n(e.date, s, "short"),
353
+ " ·",
354
+ " ",
355
+ i(e.start, d(e.endAt, u).minutes, s)
356
+ ]
357
+ }), e.clashes.length === 0 ? /* @__PURE__ */ R("span", {
358
+ className: "inline-flex items-center gap-1 text-xs font-semibold text-status-success-text",
359
+ children: [/* @__PURE__ */ L(F, {
360
+ className: "size-3.5",
361
+ "aria-hidden": "true"
362
+ }), o("calendar.v2.ftEveryoneFree", "Everyone’s free")]
363
+ }) : /* @__PURE__ */ R("span", {
364
+ className: "inline-flex items-start gap-1 text-xs font-semibold text-status-warning-text",
365
+ children: [/* @__PURE__ */ L(M, {
366
+ className: "mt-px size-3.5 shrink-0",
367
+ "aria-hidden": "true"
368
+ }), a(e.clashes)]
369
+ })]
370
+ });
371
+ }
372
+ function ge({ data: e, suggestions: t, chosen: n, onPick: r, clashWords: i }) {
373
+ let { tr: a } = c();
374
+ return e.status === "error" ? /* @__PURE__ */ L(ae, {
375
+ tone: "bad",
376
+ action: /* @__PURE__ */ L(z, {
377
+ type: "button",
378
+ variant: "outline",
379
+ size: "sm",
380
+ onClick: e.retry,
381
+ children: a("calendar.v2.tryAgain", "Try again")
382
+ }),
383
+ children: a("calendar.v2.evFreeBusyFailed", "Couldn’t check who’s free. That isn’t the same as free.")
384
+ }) : e.status === "loading" ? /* @__PURE__ */ L("p", {
385
+ className: "text-sm text-text-secondary",
386
+ children: a("calendar.v2.ftLooking", "Looking at everyone’s time…")
387
+ }) : t.length === 0 ? /* @__PURE__ */ L("p", {
388
+ className: "text-sm text-text-secondary",
389
+ children: a("calendar.v2.ftNothing", "No time in your working hours this week. Try a shorter length or another day.")
390
+ }) : /* @__PURE__ */ L("div", {
391
+ role: "radiogroup",
392
+ "aria-labelledby": "calendar-ft-suggested",
393
+ className: "grid gap-2 sm:grid-cols-3",
394
+ children: t.map((e) => /* @__PURE__ */ L(he, {
395
+ suggestion: e,
396
+ checked: n?.date === e.date && n.start === e.start,
397
+ onPick: () => r({
398
+ date: e.date,
399
+ start: e.start
400
+ }),
401
+ clashWords: i
402
+ }, `${e.date}|${e.start}`))
403
+ });
404
+ }
405
+ function _e({ data: e, suggestions: t, chosen: r, onPick: i, day: a, clashWords: o }) {
406
+ let { tr: s, format: l } = c(), u = t.find((e) => e.clashes.length === 0), d = e.participants.filter((t) => e.busyOf(t) === null);
407
+ return /* @__PURE__ */ R("div", {
408
+ className: "flex flex-col gap-2",
409
+ children: [
410
+ /* @__PURE__ */ L("span", {
411
+ id: "calendar-ft-suggested",
412
+ className: "text-sm font-semibold text-text-primary",
413
+ children: s("calendar.v2.ftSuggested", "Suggested times")
414
+ }),
415
+ /* @__PURE__ */ L(ge, {
416
+ data: e,
417
+ suggestions: t,
418
+ chosen: r,
419
+ onPick: i,
420
+ clashWords: o
421
+ }),
422
+ u && u.date !== a ? /* @__PURE__ */ L("p", {
423
+ className: "text-xs text-text-secondary",
424
+ children: s("calendar.v2.ftLaterDays", "Nothing on {{day}} works for everyone; the first such times are on later days.", { day: n(a, l, "short") })
425
+ }) : null,
426
+ d.length > 0 ? /* @__PURE__ */ L("p", {
427
+ className: "text-xs text-text-secondary",
428
+ children: s("calendar.v2.ftOutsiders", "Not counted: {{names}}. People outside the workspace have no free/busy to show.", { names: d.map((e) => e.name).join(", ") })
429
+ }) : null,
430
+ e.truncated.length > 0 ? /* @__PURE__ */ L("p", {
431
+ className: "text-xs text-status-warning-text",
432
+ children: s("calendar.v2.ftTruncated", "Some busy time couldn’t all be read for {{names}}: check with them.", { names: e.truncated.map((t) => e.nameOf(t)).join(", ") })
433
+ }) : null
434
+ ]
435
+ });
436
+ }
437
+ function ve() {
438
+ let { tr: e } = c();
439
+ return (t) => {
440
+ switch (t) {
441
+ case "away": return e("calendar.v2.evAway", "Away");
442
+ case "closed": return e("calendar.v2.roomPaused", "Closed");
443
+ case "booked": return e("calendar.v2.ftBooked", "Booked");
444
+ default: return e("calendar.v2.busy", "Busy");
445
+ }
446
+ };
447
+ }
448
+ var $ = "bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,var(--color-border-subtle)_6px_9px)]", ye = {
449
+ tentative: "border-dashed border-border-strong bg-bg-sunken text-text-secondary",
450
+ busy: "border-border-strong bg-bg-sunken text-text-primary",
451
+ booked: "border-border-strong bg-bg-sunken text-text-primary",
452
+ away: K("border-border-strong text-text-secondary", $),
453
+ closed: K("border-border-strong text-text-secondary", $)
454
+ };
455
+ function be({ row: e, spans: t, geometry: n, off: r, chosen: i, length: a }) {
456
+ let o = c(), { tr: s, timeZone: l } = o, u = ve(), { day: d, window: f, pct: p } = n, h = (e, t) => ({
457
+ insetInlineStart: `${p(e)}%`,
458
+ width: `${p(t) - p(e)}%`
459
+ }), g = t ? m(t, d, l).filter((e) => e.end > f.start && e.start < f.end) : [], _ = d === o.today && o.nowMinute > f.start && o.nowMinute < f.end;
460
+ return /* @__PURE__ */ R("div", {
461
+ className: "relative col-start-2 min-h-11 border-b border-border-subtle",
462
+ style: { gridRow: e },
463
+ children: [
464
+ r.map((e) => /* @__PURE__ */ L("i", {
465
+ "aria-hidden": "true",
466
+ className: "absolute inset-y-0 bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,transparent_6px_10px)]",
467
+ style: h(e.start, e.end)
468
+ }, `${e.start}-${e.end}`)),
469
+ t === null ? /* @__PURE__ */ L("span", {
470
+ className: "absolute inset-0 grid place-items-center text-xs text-text-secondary",
471
+ children: s("calendar.v2.evNoFreeBusy", "No free/busy")
472
+ }) : null,
473
+ g.map((e) => /* @__PURE__ */ L("i", {
474
+ "aria-hidden": "true",
475
+ className: K("absolute inset-y-2 overflow-hidden rounded-md border px-1 text-[11px] leading-6 not-italic", ye[e.kind]),
476
+ style: h(e.start, e.end),
477
+ children: u(e.kind)
478
+ }, `${e.start}-${e.end}-${e.kind}`)),
479
+ _ ? /* @__PURE__ */ L("i", {
480
+ "aria-hidden": "true",
481
+ className: "absolute inset-y-0 w-0.5 bg-action-primary-bg",
482
+ style: { insetInlineStart: `${p(o.nowMinute)}%` }
483
+ }) : null,
484
+ i?.date === d ? /* @__PURE__ */ L("i", {
485
+ "aria-hidden": "true",
486
+ className: "absolute inset-y-1 rounded-md border-2 border-action-primary-bg bg-[color-mix(in_oklab,var(--color-action-primary-bg)_14%,transparent)]",
487
+ style: h(i.start, w({
488
+ ...i,
489
+ length: a
490
+ }, l))
491
+ }) : null
492
+ ]
493
+ });
494
+ }
495
+ function xe({ row: e, name: t, role: n, room: r }) {
496
+ return /* @__PURE__ */ R("div", {
497
+ className: "col-start-1 flex min-w-0 items-center gap-2 border-b border-border-subtle px-3 py-2",
498
+ style: { gridRow: e },
499
+ children: [r ? /* @__PURE__ */ L("span", {
500
+ className: "grid size-6 shrink-0 place-items-center rounded-md bg-bg-sunken text-text-secondary",
501
+ children: /* @__PURE__ */ L(te, {
502
+ className: "size-3.5",
503
+ "aria-hidden": "true"
504
+ })
505
+ }) : /* @__PURE__ */ L(re, {
506
+ name: t,
507
+ size: 24
508
+ }), /* @__PURE__ */ R("span", {
509
+ className: "min-w-0",
510
+ children: [/* @__PURE__ */ L("b", {
511
+ className: "block truncate text-xs font-semibold text-text-primary",
512
+ children: t
513
+ }), /* @__PURE__ */ L("small", {
514
+ className: "block truncate text-[11px] text-text-secondary",
515
+ children: n
516
+ })]
517
+ })]
518
+ });
519
+ }
520
+ function Se(e, t, n, r, i) {
521
+ let a = {
522
+ ArrowRight: t ? -15 : Y,
523
+ ArrowLeft: t ? Y : -15,
524
+ ArrowUp: Y,
525
+ ArrowDown: -15,
526
+ PageUp: 60,
527
+ PageDown: -60
528
+ };
529
+ if (e === "Home") return r.start;
530
+ if (e === "End") return i;
531
+ let o = a[e];
532
+ return o === void 0 ? null : Math.max(r.start, Math.min(n + o, i));
533
+ }
534
+ function Ce({ data: e, day: t, length: r, chosen: s, onPick: u }) {
535
+ let { tr: d, format: f, timeZone: p } = c(), m = e.status === "ready", h = e.hoursOn(t), _ = b(h), v = {
536
+ day: t,
537
+ window: _,
538
+ pct: (e) => (Math.min(Math.max(e, _.start), _.end) - _.start) / (_.end - _.start) * 100
539
+ }, y = o(h).filter((e) => e.end > _.start && e.start < _.end), x = _.end - r, S = s?.date === t ? s.start : h?.start ?? _.start, C = [];
540
+ for (let e = Math.floor(_.start / 60) + 1; e * 60 < _.end; e += 1) C.push(e);
541
+ let T = e.participants.map((t) => ({
542
+ key: t.key,
543
+ name: e.nameOf(t),
544
+ role: t.role,
545
+ room: !1,
546
+ spans: e.busyOf(t)
547
+ }));
548
+ return e.room && T.push({
549
+ key: e.room.id,
550
+ name: e.room.name,
551
+ role: d("calendar.v2.ftRoom", "Room"),
552
+ room: !0,
553
+ spans: e.room.busy
554
+ }), /* @__PURE__ */ R("div", {
555
+ className: "flex flex-col gap-2",
556
+ children: [
557
+ /* @__PURE__ */ R("span", {
558
+ id: "calendar-ft-timeline",
559
+ className: "text-sm font-semibold text-text-primary",
560
+ children: [
561
+ n(t, f, "mid"),
562
+ " · ",
563
+ i(_.start, _.end, f)
564
+ ]
565
+ }),
566
+ /* @__PURE__ */ L("div", {
567
+ className: "overflow-x-auto rounded-card border border-border-default bg-bg-surface",
568
+ children: /* @__PURE__ */ R("div", {
569
+ className: "grid min-w-[560px] grid-cols-[minmax(120px,160px)_minmax(0,1fr)]",
570
+ children: [
571
+ /* @__PURE__ */ L("span", { className: "col-start-1 row-start-1 border-b border-border-subtle" }),
572
+ /* @__PURE__ */ L("div", {
573
+ className: "relative col-start-2 row-start-1 h-6 border-b border-border-subtle",
574
+ "aria-hidden": "true",
575
+ children: C.map((e) => /* @__PURE__ */ L("span", {
576
+ className: "absolute top-1 -translate-x-1/2 text-[11px] text-text-muted rtl:translate-x-1/2",
577
+ style: { insetInlineStart: `${v.pct(e * 60)}%` },
578
+ children: a(e * 60, f)
579
+ }, e))
580
+ }),
581
+ T.map((e, t) => /* @__PURE__ */ R(k, { children: [/* @__PURE__ */ L(xe, {
582
+ row: t + 2,
583
+ name: e.name,
584
+ role: e.role,
585
+ room: e.room
586
+ }), /* @__PURE__ */ L(be, {
587
+ row: t + 2,
588
+ spans: e.spans,
589
+ geometry: v,
590
+ off: y,
591
+ chosen: s,
592
+ length: r
593
+ })] }, e.key)),
594
+ /* @__PURE__ */ L("div", {
595
+ role: "slider",
596
+ tabIndex: 0,
597
+ "aria-labelledby": "calendar-ft-timeline",
598
+ "aria-valuemin": _.start,
599
+ "aria-valuemax": x,
600
+ "aria-valuenow": S,
601
+ "aria-valuetext": i(S, w({
602
+ date: t,
603
+ start: S,
604
+ length: r
605
+ }, p), f),
606
+ "aria-disabled": !m || void 0,
607
+ onClick: (e) => {
608
+ let t = e.currentTarget.getBoundingClientRect();
609
+ if (!m || t.width <= 0) return;
610
+ let n = (getComputedStyle(e.currentTarget).direction === "rtl" ? t.right - e.clientX : e.clientX - t.left) / t.width;
611
+ u(g(n, _, r));
612
+ },
613
+ onKeyDown: (e) => {
614
+ let t = getComputedStyle(e.currentTarget).direction === "rtl", n = m ? Se(e.key, t, S, _, x) : null;
615
+ n !== null && (e.preventDefault(), u(n));
616
+ },
617
+ className: K("relative z-10 col-start-2 rounded-md", m ? "cursor-pointer" : "cursor-progress", l),
618
+ style: { gridRow: `2 / span ${T.length}` }
619
+ })
620
+ ]
621
+ })
622
+ }),
623
+ /* @__PURE__ */ L("p", {
624
+ className: "text-xs text-text-secondary",
625
+ children: d("calendar.v2.ftTimelineHint", "Click a free spot, or use the arrow keys, to pick a time. Striped: outside your working hours.")
626
+ })
627
+ ]
628
+ });
629
+ }
630
+ function we({ chosen: e, length: t, ready: r, clashes: a, clashWords: o }) {
631
+ let { tr: s, format: l, timeZone: u } = c();
632
+ if (!e) return /* @__PURE__ */ L("span", {
633
+ className: "min-w-0 flex-1 text-xs text-text-secondary max-sm:basis-full",
634
+ children: s("calendar.v2.ftPick", "Pick a time")
635
+ });
636
+ let d = /* @__PURE__ */ L("span", {
637
+ className: "text-text-secondary",
638
+ children: s("calendar.v2.ftCheckingFree", "Checking who’s free…")
639
+ });
640
+ return r && a.length === 0 ? d = /* @__PURE__ */ L("span", {
641
+ className: "font-semibold text-status-success-text",
642
+ children: s("calendar.v2.ftEveryoneFree", "Everyone’s free")
643
+ }) : r && (d = /* @__PURE__ */ L("span", {
644
+ className: "font-semibold text-status-warning-text",
645
+ children: o(a)
646
+ })), /* @__PURE__ */ R("span", {
647
+ className: "min-w-0 flex-1 text-xs max-sm:basis-full",
648
+ children: [/* @__PURE__ */ R("span", {
649
+ className: "text-text-secondary",
650
+ children: [
651
+ n(e.date, l, "short"),
652
+ " ·",
653
+ " ",
654
+ i(e.start, w({
655
+ ...e,
656
+ length: t
657
+ }, u), l),
658
+ " ",
659
+ "·",
660
+ " "
661
+ ]
662
+ }), d]
663
+ });
664
+ }
665
+ export { oe as FindTimeDialog };
666
+
667
+ //# sourceMappingURL=FindTimeDialog.js.map