@burdenoff/microfe-calendar 2026.1124.3 → 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 (88) hide show
  1. package/dist/generated/wspace-operations.d.ts +342 -69
  2. package/dist/generated/wspace-operations.js +73 -31
  3. package/dist/generated/wspace-operations.js.map +1 -1
  4. package/dist/generated/wspace-types.d.ts +405 -6
  5. package/dist/translations/en.d.ts +22 -4
  6. package/dist/v2/CalendarPageV2.js +45 -41
  7. package/dist/v2/CalendarPageV2.js.map +1 -1
  8. package/dist/v2/CalendarRoutesV2.js +64 -64
  9. package/dist/v2/CalendarRoutesV2.js.map +1 -1
  10. package/dist/v2/data/errors.d.ts +5 -0
  11. package/dist/v2/data/errors.js +6 -2
  12. package/dist/v2/data/errors.js.map +1 -1
  13. package/dist/v2/data/normalize.d.ts +31 -3
  14. package/dist/v2/data/normalize.js +57 -13
  15. package/dist/v2/data/normalize.js.map +1 -1
  16. package/dist/v2/data/seriesDateLookup.d.ts +9 -0
  17. package/dist/v2/data/seriesDateLookup.js +12 -0
  18. package/dist/v2/data/seriesDateLookup.js.map +1 -0
  19. package/dist/v2/data/useEventActions.d.ts +9 -3
  20. package/dist/v2/data/useEventActions.js +239 -186
  21. package/dist/v2/data/useEventActions.js.map +1 -1
  22. package/dist/v2/data/useEventForPeek.js +63 -21
  23. package/dist/v2/data/useEventForPeek.js.map +1 -1
  24. package/dist/v2/data/useEventsInRangeV2.d.ts +40 -2
  25. package/dist/v2/data/useEventsInRangeV2.js +76 -47
  26. package/dist/v2/data/useEventsInRangeV2.js.map +1 -1
  27. package/dist/v2/day/DayPanel.js +1 -1
  28. package/dist/v2/day/DayPanel.js.map +1 -1
  29. package/dist/v2/event/EventDialog.d.ts +13 -3
  30. package/dist/v2/event/EventDialog.js +189 -166
  31. package/dist/v2/event/EventDialog.js.map +1 -1
  32. package/dist/v2/event/EventDialogs.js +57 -50
  33. package/dist/v2/event/EventDialogs.js.map +1 -1
  34. package/dist/v2/event/EventMoreTab.js +8 -7
  35. package/dist/v2/event/EventMoreTab.js.map +1 -1
  36. package/dist/v2/event/EventPlaceTab.js +2 -2
  37. package/dist/v2/event/EventPlaceTab.js.map +1 -1
  38. package/dist/v2/event/FindTimeDialog.js +1 -1
  39. package/dist/v2/event/FindTimeDialog.js.map +1 -1
  40. package/dist/v2/event/RepeatField.js +10 -7
  41. package/dist/v2/event/RepeatField.js.map +1 -1
  42. package/dist/v2/event/dialogLogic.d.ts +10 -0
  43. package/dist/v2/event/dialogLogic.js +25 -22
  44. package/dist/v2/event/dialogLogic.js.map +1 -1
  45. package/dist/v2/event/dialogModel.d.ts +3 -0
  46. package/dist/v2/event/dialogModel.js.map +1 -1
  47. package/dist/v2/event/eventForm.d.ts +26 -0
  48. package/dist/v2/event/eventForm.js +145 -92
  49. package/dist/v2/event/eventForm.js.map +1 -1
  50. package/dist/v2/event/findTimeSource.js +44 -44
  51. package/dist/v2/event/findTimeSource.js.map +1 -1
  52. package/dist/v2/event/rrule.js.map +1 -1
  53. package/dist/v2/event/savePlan.d.ts +125 -15
  54. package/dist/v2/event/savePlan.js +162 -68
  55. package/dist/v2/event/savePlan.js.map +1 -1
  56. package/dist/v2/event/useEventData.d.ts +7 -2
  57. package/dist/v2/event/useEventData.js +107 -80
  58. package/dist/v2/event/useEventData.js.map +1 -1
  59. package/dist/v2/event/useEventDialogModel.d.ts +16 -3
  60. package/dist/v2/event/useEventDialogModel.js +82 -67
  61. package/dist/v2/event/useEventDialogModel.js.map +1 -1
  62. package/dist/v2/event/useEventSave.d.ts +20 -4
  63. package/dist/v2/event/useEventSave.js +181 -90
  64. package/dist/v2/event/useEventSave.js.map +1 -1
  65. package/dist/v2/events/eventLook.js +16 -16
  66. package/dist/v2/events/eventLook.js.map +1 -1
  67. package/dist/v2/events/eventModel.d.ts +17 -4
  68. package/dist/v2/events/eventModel.js +46 -34
  69. package/dist/v2/events/eventModel.js.map +1 -1
  70. package/dist/v2/events/localChanges.d.ts +4 -1
  71. package/dist/v2/events/localChanges.js +4 -2
  72. package/dist/v2/events/localChanges.js.map +1 -1
  73. package/dist/v2/page/CalendarPageContext.d.ts +2 -2
  74. package/dist/v2/page/CalendarPageContext.js.map +1 -1
  75. package/dist/v2/page/useCalendarPageModel.js +141 -139
  76. package/dist/v2/page/useCalendarPageModel.js.map +1 -1
  77. package/dist/v2/page/viewState.d.ts +9 -1
  78. package/dist/v2/page/viewState.js +5 -3
  79. package/dist/v2/page/viewState.js.map +1 -1
  80. package/dist/v2/peek/PeekEvent.js +210 -204
  81. package/dist/v2/peek/PeekEvent.js.map +1 -1
  82. package/dist/v2/rail/useMonthEventDates.js +1 -1
  83. package/dist/v2/rail/useMonthEventDates.js.map +1 -1
  84. package/dist/v2/states/CalendarStates.d.ts +15 -0
  85. package/dist/v2/states/CalendarStates.js +42 -11
  86. package/dist/v2/states/CalendarStates.js.map +1 -1
  87. package/dist/v2/types.d.ts +30 -2
  88. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"EventPlaceTab.js","names":["_Fragment","ADDRESS_INPUT_ID","VIDEO_ERROR_ID","NO_ROOM","MAX_FEATURES_SHOWN","serviceName","service","tr","stateIn","roomStateAt","room","model","RoomStatus","useCalendarPage","state","StatusChip","formatInstantRange","timeZone","format","Clock3","RoomExtra","Fragment","Pill","feature","UserCheck","roomCard","details","Building2","roomFits","people","UseRoomButton","Button","current","ChosenRoomNotice","chosen","rooms","form","Notice","alternative","freeAlternative","action","instead","RoomChoice","cards","RadioCards","update","value","RoomField","SoonNote","VideoField","wrong","video","safeWebUrl","videoServiceOf","Field","VIDEO_INPUT_ID","Video","Input","readOnly","videoUrl","event","Link2","AddressField","MapPin","address","EventPlaceTab"],"sources":["../../../src/v2/event/EventPlaceTab.tsx"],"sourcesContent":["/**\n * The event dialog's Place tab (BOFF-15698 A2): a room, a video call, an address. They go\n * together (a room and a link is a hybrid meeting), so each is its own field rather than one\n * choice: an event that already has a room and a link keeps both.\n *\n * - Rooms are cards for the event's time: free, booked by something else (yellow, with a free\n * room offered instead), closed, or needing approval. The room is booked when the event saves\n * (`bookCalendarResource`), and booked again when its time changes. An all-day event books\n * none.\n * - The video link is pasted; its service is named from the address (Meet, Zoom, Teams, else\n * \"Link\"). Making a meeting link in those services is out of scope.\n */\nimport { Building2, Clock3, Link2, MapPin, UserCheck, Video } from 'lucide-react';\nimport { Button, Input, Notice, StatusChip } from '@burdenoff/fe-libs/ui';\nimport type { Tr } from '../data/useEventActions';\nimport { safeWebUrl } from '../events/eventModel';\nimport { formatInstantRange } from '../format';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { VIDEO_INPUT_ID } from './dialogLogic';\nimport type { EventDialogModel } from './dialogModel';\nimport {\n freeAlternative,\n roomFits,\n roomStateAt,\n videoServiceOf,\n type RoomForEvent,\n type RoomState,\n type VideoService,\n} from './place';\nimport { Field, Pill, RadioCards, SoonNote, type RadioCardOption } from './parts';\n\nconst ADDRESS_INPUT_ID = 'calendar-event-address';\nconst VIDEO_ERROR_ID = 'calendar-event-video-error';\n\nconst NO_ROOM = 'none';\n\n/** Features shown on a room's card. */\nconst MAX_FEATURES_SHOWN = 4;\n\ntype TabProps = { model: EventDialogModel };\n\nfunction serviceName(service: VideoService, tr: Tr): string {\n switch (service) {\n case 'GOOGLE_MEET':\n return tr('calendar.v2.evMeet', 'Meet');\n case 'ZOOM':\n return tr('calendar.v2.evZoom', 'Zoom');\n case 'MICROSOFT_TEAMS':\n return tr('calendar.v2.evTeamsCall', 'Teams');\n case 'CUSTOM':\n return tr('calendar.v2.evLink', 'Link');\n }\n}\n\n/** A room's state at the event's time (its own booking doesn't count against it). */\nfunction stateIn(model: EventDialogModel, room: RoomForEvent): RoomState {\n return roomStateAt(room, model.start, model.end, model.event?.id ?? null);\n}\n\n/** \"Free then\", \"Booked 13:00 – 14:00\", \"Closed\" or \"Checking…\". */\nfunction RoomStatus({ state }: { state: RoomState }) {\n const { tr, format, timeZone } = useCalendarPage();\n switch (state.kind) {\n case 'free':\n return <StatusChip status=\"ok\">{tr('calendar.v2.evRoomFree', 'Free then')}</StatusChip>;\n case 'booked':\n return (\n <StatusChip status=\"warn\">\n {tr('calendar.v2.evRoomBookedAt', 'Booked {{time}}', {\n time: formatInstantRange(state.booking.start, state.booking.end, timeZone, format),\n })}\n </StatusChip>\n );\n case 'closed':\n return <StatusChip status=\"paused\">{tr('calendar.v2.roomPaused', 'Closed')}</StatusChip>;\n case 'unknown':\n return (\n <StatusChip status=\"waiting\" icon={Clock3}>\n {tr('calendar.v2.evChecking', 'Checking…')}\n </StatusChip>\n );\n }\n}\n\n/** Below a room card's name: its features, and (a timed event) its state and approval. */\nfunction RoomExtra({ model, room }: TabProps & { room: RoomForEvent }) {\n const { tr } = useCalendarPage();\n return (\n <>\n {room.features.length > 0 ? (\n <span className=\"flex flex-wrap gap-1\">\n {room.features.slice(0, MAX_FEATURES_SHOWN).map((feature) => (\n <Pill key={feature}>{feature}</Pill>\n ))}\n </span>\n ) : null}\n {model.form.allDay ? null : (\n <span className=\"flex flex-wrap items-center gap-2\">\n <RoomStatus state={stateIn(model, room)} />\n {room.needsApproval ? (\n <span className=\"inline-flex items-center gap-1 text-xs text-text-secondary\">\n <UserCheck className=\"size-3\" aria-hidden=\"true\" />\n {tr('calendar.v2.evNeedsApproval', 'Needs approval')}\n </span>\n ) : null}\n </span>\n )}\n </>\n );\n}\n\n/** A room's card: name, where it is and its seats (\"small for 9\" in yellow), and its state. */\nfunction roomCard(\n model: EventDialogModel,\n room: RoomForEvent,\n people: number,\n tr: Tr\n): RadioCardOption<string> {\n const details = [\n room.place,\n room.capacity === null\n ? null\n : tr('calendar.v2.seats', '{{count}} seats', { count: room.capacity }),\n ].filter(Boolean);\n return {\n value: room.id,\n icon: <Building2 />,\n title: room.name,\n description: (\n <>\n {details.join(' · ')}\n {roomFits(room, people) ? null : (\n <span className=\"text-status-warning-text\">\n {' · '}\n {tr('calendar.v2.evRoomSmall', 'small for {{count}}', { count: people })}\n </span>\n )}\n </>\n ),\n extra: <RoomExtra model={model} room={room} />,\n };\n}\n\n/** \"Use Atlas\": switches to a free room. */\nfunction UseRoomButton({ model, room }: TabProps & { room: RoomForEvent | null }) {\n const { tr } = useCalendarPage();\n if (!room) return null;\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={model.readOnly}\n onClick={() => model.update((current) => ({ ...current, roomId: room.id }))}\n >\n {tr('calendar.v2.evUseRoom', 'Use {{room}}', { room: room.name })}\n </Button>\n );\n}\n\n/** The chosen room is booked or closed then (with a free one offered), or needs approval. */\nfunction ChosenRoomNotice({ model }: TabProps) {\n const { tr, format, timeZone } = useCalendarPage();\n const { form, rooms } = model;\n const chosen = rooms.rooms.find((room) => room.id === form.roomId) ?? null;\n if (!chosen || form.allDay) return null;\n const state = stateIn(model, chosen);\n if (state.kind === 'free' && chosen.needsApproval) {\n return (\n <Notice tone=\"info\" icon={UserCheck}>\n {tr(\n 'calendar.v2.evRoomApproval',\n '{{room}} needs approval. It’s asked for when you save; the event shows “waiting” until then.',\n { room: chosen.name }\n )}\n </Notice>\n );\n }\n if (state.kind !== 'booked' && state.kind !== 'closed') return null;\n const alternative = freeAlternative(\n rooms.rooms,\n chosen.id,\n model.start,\n model.end,\n form.guests.length + 1,\n model.event?.id ?? null\n );\n const action = alternative ? <UseRoomButton model={model} room={alternative} /> : undefined;\n if (state.kind === 'closed') {\n return (\n <Notice tone=\"warn\" action={action}>\n <b>{tr('calendar.v2.evRoomClosed', 'Room closed.')}</b>{' '}\n {tr('calendar.v2.evRoomClosedBody', '{{room}} isn’t taking bookings.', {\n room: chosen.name,\n })}\n </Notice>\n );\n }\n const instead = alternative\n ? tr('calendar.v2.evRoomAlternative', '{{room}} is free then.', { room: alternative.name })\n : tr('calendar.v2.evRoomNoAlternative', 'No other room is free then.');\n return (\n <Notice tone=\"warn\" action={action}>\n <b>{tr('calendar.v2.evRoomConflict', 'Room taken.')}</b>{' '}\n {tr('calendar.v2.evRoomConflictBody', '{{room}} is booked {{time}}.', {\n room: chosen.name,\n time: formatInstantRange(state.booking.start, state.booking.end, timeZone, format),\n })}{' '}\n {instead}\n </Notice>\n );\n}\n\n/** The room cards, or why there are none (loading, failed with a retry, no rooms yet). */\nfunction RoomChoice({ model }: TabProps) {\n const { tr } = useCalendarPage();\n const { form, update, rooms } = model;\n if (rooms.status === 'error') {\n return (\n <Notice\n tone=\"bad\"\n action={\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={rooms.retry}>\n {tr('calendar.v2.tryAgain', 'Try again')}\n </Button>\n }\n >\n {tr('calendar.v2.roomsFailed', 'Couldn’t load the rooms.')}\n </Notice>\n );\n }\n if (rooms.rooms.length === 0) {\n return (\n <p className=\"text-sm text-text-secondary\">\n {rooms.status === 'loading'\n ? tr('calendar.v2.loadingRooms', 'Loading rooms…')\n : tr('calendar.v2.noRooms', 'No rooms yet.')}\n </p>\n );\n }\n const people = form.guests.length + 1;\n const cards: RadioCardOption<string>[] = [\n {\n value: NO_ROOM,\n title: tr('calendar.v2.evNoRoom', 'No room'),\n description: tr('calendar.v2.evNoRoomBody', 'A call, an address, or not decided yet'),\n },\n ...rooms.rooms.map((room) => roomCard(model, room, people, tr)),\n ];\n return (\n <RadioCards\n labelledBy=\"calendar-event-room\"\n options={cards}\n value={form.roomId ?? NO_ROOM}\n onValueChange={(value) =>\n update((current) => ({ ...current, roomId: value === NO_ROOM ? null : value }))\n }\n disabled={model.readOnly || form.allDay}\n className=\"sm:grid-cols-2\"\n />\n );\n}\n\nfunction RoomField({ model }: TabProps) {\n const { tr } = useCalendarPage();\n return (\n <div className=\"flex flex-col gap-2\">\n <span id=\"calendar-event-room\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.evRoom', 'Room')}\n </span>\n {model.form.allDay ? (\n <SoonNote>\n {tr(\n 'calendar.v2.evRoomAllDay',\n 'Rooms are booked for a time. Switch off All day to book one.'\n )}\n </SoonNote>\n ) : null}\n <ChosenRoomNotice model={model} />\n <RoomChoice model={model} />\n </div>\n );\n}\n\nfunction VideoField({ model }: TabProps) {\n const { tr } = useCalendarPage();\n const { form, update, readOnly } = model;\n const wrong = model.showIssues && model.issues.video;\n const video = form.videoUrl.trim();\n const service = video && safeWebUrl(video) ? videoServiceOf(video) : null;\n return (\n <Field\n label={tr('calendar.v2.evVideo', 'Video call')}\n labelFor={VIDEO_INPUT_ID}\n hint={tr(\n 'calendar.v2.evVideoHint',\n 'Paste a link to the call: Meet, Zoom, Teams or any other.'\n )}\n error={\n wrong\n ? tr('calendar.v2.evVideoBad', 'That isn’t a web address. Paste the call’s link.')\n : undefined\n }\n errorId={VIDEO_ERROR_ID}\n >\n <div className=\"flex items-center gap-2\">\n <span className=\"relative min-w-0 flex-1\">\n <Video\n className=\"pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n id={VIDEO_INPUT_ID}\n value={form.videoUrl}\n inputMode=\"url\"\n autoComplete=\"off\"\n disabled={readOnly}\n placeholder=\"https://…\"\n aria-invalid={wrong ? true : undefined}\n aria-describedby={wrong ? VIDEO_ERROR_ID : undefined}\n onChange={(event) => {\n const videoUrl = event.target.value;\n update((current) => ({ ...current, videoUrl }));\n }}\n className=\"ps-9\"\n />\n </span>\n {service ? (\n <span className=\"inline-flex shrink-0 items-center gap-1 rounded-button border border-border-default px-2 py-1 text-xs font-semibold text-text-primary\">\n <Link2 className=\"size-3\" aria-hidden=\"true\" />\n {serviceName(service, tr)}\n </span>\n ) : null}\n </div>\n </Field>\n );\n}\n\nfunction AddressField({ model }: TabProps) {\n const { tr } = useCalendarPage();\n const { form, update, readOnly } = model;\n return (\n <Field\n label={tr('calendar.v2.evAddress', 'Address')}\n labelFor={ADDRESS_INPUT_ID}\n hint={tr('calendar.v2.evAddressHint', 'Somewhere else: an office, a café, a street address.')}\n >\n <span className=\"relative\">\n <MapPin\n className=\"pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n id={ADDRESS_INPUT_ID}\n value={form.address}\n autoComplete=\"off\"\n disabled={readOnly}\n placeholder={tr('calendar.v2.evAddressPlaceholder', 'For example: Acme office, MG Road')}\n onChange={(event) => {\n const address = event.target.value;\n update((current) => ({ ...current, address }));\n }}\n className=\"ps-9\"\n />\n </span>\n </Field>\n );\n}\n\nexport function EventPlaceTab({ model }: TabProps) {\n return (\n <div className=\"flex flex-col gap-5\">\n <RoomField model={model} />\n <VideoField model={model} />\n <AddressField model={model} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AA+BA,IAAMC,IAAmB,0BACnBC,IAAiB,8BAEjBC,IAAU,QAGVC,IAAqB;AAI3B,SAASC,EAAY,GAAuB,GAAgB;CAC1D,QAAQC,GAAR;EACE,KAAK,eACH,OAAOC,EAAG,sBAAsB,MAAM;EACxC,KAAK,QACH,OAAOA,EAAG,sBAAsB,MAAM;EACxC,KAAK,mBACH,OAAOA,EAAG,2BAA2B,OAAO;EAC9C,KAAK,UACH,OAAOA,EAAG,sBAAsB,MAAM;CAC1C;AACF;AAGA,SAASC,EAAQ,GAAyB,GAA+B;CACvE,OAAOC,EAAYC,GAAMC,EAAM,OAAOA,EAAM,KAAKA,EAAM,OAAO,MAAM,IAAI;AAC1E;AAGA,SAASC,EAAW,EAAE,YAA+B;CACnD,IAAM,EAAE,OAAI,WAAQ,gBAAaC,EAAgB;CACjD,QAAQC,EAAM,MAAd;EACE,KAAK,QACH,OAAO,kBAACC,GAAD;GAAY,QAAO;GAAM,UAAAR,EAAG,0BAA0B,WAAW;EAAc,CAAA;EACxF,KAAK,UACH,OACE,kBAACQ,GAAD;GAAY,QAAO;GAChB,UAAAR,EAAG,8BAA8B,mBAAmB,EACnD,MAAMS,EAAmBF,EAAM,QAAQ,OAAOA,EAAM,QAAQ,KAAKG,GAAUC,CAAM,EACnF,CAAC;EACS,CAAA;EAEhB,KAAK,UACH,OAAO,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UAAA;GACE,kBAAClB,GAAD,EAAkB,SAAQ,CAAA;GAC1B,kBAACE,GAAD,EAAmB,SAAQ,CAAA;GAC3B,kBAACa,GAAD,EAAqB,SAAQ,CAAA;EAC1B;;AAET"}
1
+ {"version":3,"file":"EventPlaceTab.js","names":["_Fragment","ADDRESS_INPUT_ID","VIDEO_ERROR_ID","NO_ROOM","MAX_FEATURES_SHOWN","serviceName","service","tr","stateIn","roomStateAt","room","model","RoomStatus","useCalendarPage","state","StatusChip","formatInstantRange","timeZone","format","Clock3","RoomExtra","Fragment","Pill","feature","UserCheck","roomCard","details","Building2","roomFits","people","UseRoomButton","Button","current","ChosenRoomNotice","chosen","rooms","form","Notice","alternative","freeAlternative","action","instead","RoomChoice","cards","RadioCards","update","value","RoomField","SoonNote","VideoField","wrong","video","safeWebUrl","videoServiceOf","Field","VIDEO_INPUT_ID","Video","Input","readOnly","videoUrl","event","Link2","AddressField","MapPin","address","EventPlaceTab"],"sources":["../../../src/v2/event/EventPlaceTab.tsx"],"sourcesContent":["/**\n * The event dialog's Place tab (BOFF-15698 A2): a room, a video call, an address. They go\n * together (a room and a link is a hybrid meeting), so each is its own field rather than one\n * choice: an event that already has a room and a link keeps both.\n *\n * - Rooms are cards for the event's time: free, booked by something else (yellow, with a free\n * room offered instead), closed, or needing approval. The room is booked when the event saves\n * (`bookCalendarResource`), and booked again when its time changes. An all-day event books\n * none.\n * - The video link is pasted; its service is named from the address (Meet, Zoom, Teams, else\n * \"Link\"). Making a meeting link in those services is out of scope.\n */\nimport { Building2, Clock3, Link2, MapPin, UserCheck, Video } from 'lucide-react';\nimport { Button, Input, Notice, StatusChip } from '@burdenoff/fe-libs/ui';\nimport type { Tr } from '../data/useEventActions';\nimport { safeWebUrl } from '../events/eventModel';\nimport { formatInstantRange } from '../format';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { VIDEO_INPUT_ID } from './dialogLogic';\nimport type { EventDialogModel } from './dialogModel';\nimport {\n freeAlternative,\n roomFits,\n roomStateAt,\n videoServiceOf,\n type RoomForEvent,\n type RoomState,\n type VideoService,\n} from './place';\nimport { Field, Pill, RadioCards, SoonNote, type RadioCardOption } from './parts';\n\nconst ADDRESS_INPUT_ID = 'calendar-event-address';\nconst VIDEO_ERROR_ID = 'calendar-event-video-error';\n\nconst NO_ROOM = 'none';\n\n/** Features shown on a room's card. */\nconst MAX_FEATURES_SHOWN = 4;\n\ntype TabProps = { model: EventDialogModel };\n\nfunction serviceName(service: VideoService, tr: Tr): string {\n switch (service) {\n case 'GOOGLE_MEET':\n return tr('calendar.v2.evMeet', 'Meet');\n case 'ZOOM':\n return tr('calendar.v2.evZoom', 'Zoom');\n case 'MICROSOFT_TEAMS':\n return tr('calendar.v2.evTeamsCall', 'Teams');\n case 'CUSTOM':\n return tr('calendar.v2.evLink', 'Link');\n }\n}\n\n/** A room's state at the event's time (its own booking doesn't count against it). */\nfunction stateIn(model: EventDialogModel, room: RoomForEvent): RoomState {\n return roomStateAt(room, model.start, model.end, model.event?.eventId ?? null);\n}\n\n/** \"Free then\", \"Booked 13:00 – 14:00\", \"Closed\" or \"Checking…\". */\nfunction RoomStatus({ state }: { state: RoomState }) {\n const { tr, format, timeZone } = useCalendarPage();\n switch (state.kind) {\n case 'free':\n return <StatusChip status=\"ok\">{tr('calendar.v2.evRoomFree', 'Free then')}</StatusChip>;\n case 'booked':\n return (\n <StatusChip status=\"warn\">\n {tr('calendar.v2.evRoomBookedAt', 'Booked {{time}}', {\n time: formatInstantRange(state.booking.start, state.booking.end, timeZone, format),\n })}\n </StatusChip>\n );\n case 'closed':\n return <StatusChip status=\"paused\">{tr('calendar.v2.roomPaused', 'Closed')}</StatusChip>;\n case 'unknown':\n return (\n <StatusChip status=\"waiting\" icon={Clock3}>\n {tr('calendar.v2.evChecking', 'Checking…')}\n </StatusChip>\n );\n }\n}\n\n/** Below a room card's name: its features, and (a timed event) its state and approval. */\nfunction RoomExtra({ model, room }: TabProps & { room: RoomForEvent }) {\n const { tr } = useCalendarPage();\n return (\n <>\n {room.features.length > 0 ? (\n <span className=\"flex flex-wrap gap-1\">\n {room.features.slice(0, MAX_FEATURES_SHOWN).map((feature) => (\n <Pill key={feature}>{feature}</Pill>\n ))}\n </span>\n ) : null}\n {model.form.allDay ? null : (\n <span className=\"flex flex-wrap items-center gap-2\">\n <RoomStatus state={stateIn(model, room)} />\n {room.needsApproval ? (\n <span className=\"inline-flex items-center gap-1 text-xs text-text-secondary\">\n <UserCheck className=\"size-3\" aria-hidden=\"true\" />\n {tr('calendar.v2.evNeedsApproval', 'Needs approval')}\n </span>\n ) : null}\n </span>\n )}\n </>\n );\n}\n\n/** A room's card: name, where it is and its seats (\"small for 9\" in yellow), and its state. */\nfunction roomCard(\n model: EventDialogModel,\n room: RoomForEvent,\n people: number,\n tr: Tr\n): RadioCardOption<string> {\n const details = [\n room.place,\n room.capacity === null\n ? null\n : tr('calendar.v2.seats', '{{count}} seats', { count: room.capacity }),\n ].filter(Boolean);\n return {\n value: room.id,\n icon: <Building2 />,\n title: room.name,\n description: (\n <>\n {details.join(' · ')}\n {roomFits(room, people) ? null : (\n <span className=\"text-status-warning-text\">\n {' · '}\n {tr('calendar.v2.evRoomSmall', 'small for {{count}}', { count: people })}\n </span>\n )}\n </>\n ),\n extra: <RoomExtra model={model} room={room} />,\n };\n}\n\n/** \"Use Atlas\": switches to a free room. */\nfunction UseRoomButton({ model, room }: TabProps & { room: RoomForEvent | null }) {\n const { tr } = useCalendarPage();\n if (!room) return null;\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={model.readOnly}\n onClick={() => model.update((current) => ({ ...current, roomId: room.id }))}\n >\n {tr('calendar.v2.evUseRoom', 'Use {{room}}', { room: room.name })}\n </Button>\n );\n}\n\n/** The chosen room is booked or closed then (with a free one offered), or needs approval. */\nfunction ChosenRoomNotice({ model }: TabProps) {\n const { tr, format, timeZone } = useCalendarPage();\n const { form, rooms } = model;\n const chosen = rooms.rooms.find((room) => room.id === form.roomId) ?? null;\n if (!chosen || form.allDay) return null;\n const state = stateIn(model, chosen);\n if (state.kind === 'free' && chosen.needsApproval) {\n return (\n <Notice tone=\"info\" icon={UserCheck}>\n {tr(\n 'calendar.v2.evRoomApproval',\n '{{room}} needs approval. It’s asked for when you save; the event shows “waiting” until then.',\n { room: chosen.name }\n )}\n </Notice>\n );\n }\n if (state.kind !== 'booked' && state.kind !== 'closed') return null;\n const alternative = freeAlternative(\n rooms.rooms,\n chosen.id,\n model.start,\n model.end,\n form.guests.length + 1,\n model.event?.eventId ?? null\n );\n const action = alternative ? <UseRoomButton model={model} room={alternative} /> : undefined;\n if (state.kind === 'closed') {\n return (\n <Notice tone=\"warn\" action={action}>\n <b>{tr('calendar.v2.evRoomClosed', 'Room closed.')}</b>{' '}\n {tr('calendar.v2.evRoomClosedBody', '{{room}} isn’t taking bookings.', {\n room: chosen.name,\n })}\n </Notice>\n );\n }\n const instead = alternative\n ? tr('calendar.v2.evRoomAlternative', '{{room}} is free then.', { room: alternative.name })\n : tr('calendar.v2.evRoomNoAlternative', 'No other room is free then.');\n return (\n <Notice tone=\"warn\" action={action}>\n <b>{tr('calendar.v2.evRoomConflict', 'Room taken.')}</b>{' '}\n {tr('calendar.v2.evRoomConflictBody', '{{room}} is booked {{time}}.', {\n room: chosen.name,\n time: formatInstantRange(state.booking.start, state.booking.end, timeZone, format),\n })}{' '}\n {instead}\n </Notice>\n );\n}\n\n/** The room cards, or why there are none (loading, failed with a retry, no rooms yet). */\nfunction RoomChoice({ model }: TabProps) {\n const { tr } = useCalendarPage();\n const { form, update, rooms } = model;\n if (rooms.status === 'error') {\n return (\n <Notice\n tone=\"bad\"\n action={\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={rooms.retry}>\n {tr('calendar.v2.tryAgain', 'Try again')}\n </Button>\n }\n >\n {tr('calendar.v2.roomsFailed', 'Couldn’t load the rooms.')}\n </Notice>\n );\n }\n if (rooms.rooms.length === 0) {\n return (\n <p className=\"text-sm text-text-secondary\">\n {rooms.status === 'loading'\n ? tr('calendar.v2.loadingRooms', 'Loading rooms…')\n : tr('calendar.v2.noRooms', 'No rooms yet.')}\n </p>\n );\n }\n const people = form.guests.length + 1;\n const cards: RadioCardOption<string>[] = [\n {\n value: NO_ROOM,\n title: tr('calendar.v2.evNoRoom', 'No room'),\n description: tr('calendar.v2.evNoRoomBody', 'A call, an address, or not decided yet'),\n },\n ...rooms.rooms.map((room) => roomCard(model, room, people, tr)),\n ];\n return (\n <RadioCards\n labelledBy=\"calendar-event-room\"\n options={cards}\n value={form.roomId ?? NO_ROOM}\n onValueChange={(value) =>\n update((current) => ({ ...current, roomId: value === NO_ROOM ? null : value }))\n }\n disabled={model.readOnly || form.allDay}\n className=\"sm:grid-cols-2\"\n />\n );\n}\n\nfunction RoomField({ model }: TabProps) {\n const { tr } = useCalendarPage();\n return (\n <div className=\"flex flex-col gap-2\">\n <span id=\"calendar-event-room\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.evRoom', 'Room')}\n </span>\n {model.form.allDay ? (\n <SoonNote>\n {tr(\n 'calendar.v2.evRoomAllDay',\n 'Rooms are booked for a time. Switch off All day to book one.'\n )}\n </SoonNote>\n ) : null}\n <ChosenRoomNotice model={model} />\n <RoomChoice model={model} />\n </div>\n );\n}\n\nfunction VideoField({ model }: TabProps) {\n const { tr } = useCalendarPage();\n const { form, update, readOnly } = model;\n const wrong = model.showIssues && model.issues.video;\n const video = form.videoUrl.trim();\n const service = video && safeWebUrl(video) ? videoServiceOf(video) : null;\n return (\n <Field\n label={tr('calendar.v2.evVideo', 'Video call')}\n labelFor={VIDEO_INPUT_ID}\n hint={tr(\n 'calendar.v2.evVideoHint',\n 'Paste a link to the call: Meet, Zoom, Teams or any other.'\n )}\n error={\n wrong\n ? tr('calendar.v2.evVideoBad', 'That isn’t a web address. Paste the call’s link.')\n : undefined\n }\n errorId={VIDEO_ERROR_ID}\n >\n <div className=\"flex items-center gap-2\">\n <span className=\"relative min-w-0 flex-1\">\n <Video\n className=\"pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n id={VIDEO_INPUT_ID}\n value={form.videoUrl}\n inputMode=\"url\"\n autoComplete=\"off\"\n disabled={readOnly}\n placeholder=\"https://…\"\n aria-invalid={wrong ? true : undefined}\n aria-describedby={wrong ? VIDEO_ERROR_ID : undefined}\n onChange={(event) => {\n const videoUrl = event.target.value;\n update((current) => ({ ...current, videoUrl }));\n }}\n className=\"ps-9\"\n />\n </span>\n {service ? (\n <span className=\"inline-flex shrink-0 items-center gap-1 rounded-button border border-border-default px-2 py-1 text-xs font-semibold text-text-primary\">\n <Link2 className=\"size-3\" aria-hidden=\"true\" />\n {serviceName(service, tr)}\n </span>\n ) : null}\n </div>\n </Field>\n );\n}\n\nfunction AddressField({ model }: TabProps) {\n const { tr } = useCalendarPage();\n const { form, update, readOnly } = model;\n return (\n <Field\n label={tr('calendar.v2.evAddress', 'Address')}\n labelFor={ADDRESS_INPUT_ID}\n hint={tr('calendar.v2.evAddressHint', 'Somewhere else: an office, a café, a street address.')}\n >\n <span className=\"relative\">\n <MapPin\n className=\"pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n id={ADDRESS_INPUT_ID}\n value={form.address}\n autoComplete=\"off\"\n disabled={readOnly}\n placeholder={tr('calendar.v2.evAddressPlaceholder', 'For example: Acme office, MG Road')}\n onChange={(event) => {\n const address = event.target.value;\n update((current) => ({ ...current, address }));\n }}\n className=\"ps-9\"\n />\n </span>\n </Field>\n );\n}\n\nexport function EventPlaceTab({ model }: TabProps) {\n return (\n <div className=\"flex flex-col gap-5\">\n <RoomField model={model} />\n <VideoField model={model} />\n <AddressField model={model} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AA+BA,IAAMC,IAAmB,0BACnBC,IAAiB,8BAEjBC,IAAU,QAGVC,IAAqB;AAI3B,SAASC,EAAY,G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AAQ,CAAA,GAC7CxD,EAAYC,GAASC,CAAE,CACpB;GACJ,CAAA,IAAA,IACD;;CACA,CAAA;AAEX;AAEA,SAASuD,EAAa,EAAE,YAAmB;CACzC,IAAM,EAAE,UAAOjD,EAAgB,GACzB,EAAE,SAAM,WAAQ,gBAAaF;CACnC,OACE,kBAAC2C,GAAD;EACE,OAAO/C,EAAG,yBAAyB,SAAS;EAC5C,UAAUN;EACV,MAAMM,EAAG,6BAA6B,sDAAsD;EAE5F,UAAA,kBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACE,kBAACwD,GAAD;IACE,WAAU;IACV,eAAY;GACb,CAAA,GACD,kBAACN,GAAD;IACE,IAAIxD;IACJ,OAAOmC,EAAK;IACZ,cAAa;IACb,UAAUsB;IACV,aAAanD,EAAG,oCAAoC,mCAAmC;IACvF,WAAW,MAAU;KACnB,IAAMyD,IAAUJ,EAAM,OAAO;KAC7B,GAAQ,OAAa;MAAE,GAAG5B;MAAS;KAAQ,EAAE;IAC/C;IACA,WAAU;GACX,CAAA,CACG;;CACD,CAAA;AAEX;AAEA,SAAgBiC,EAAc,EAAE,YAAmB;CACjD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAAClB,GAAD,EAAkB,SAAQ,CAAA;GAC1B,kBAACE,GAAD,EAAmB,SAAQ,CAAA;GAC3B,kBAACa,GAAD,EAAqB,SAAQ,CAAA;EAC1B;;AAET"}
@@ -144,7 +144,7 @@ function de(e, t, n, r) {
144
144
  return e.status === "ready" && i && a ? "ready" : "loading";
145
145
  }
146
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?.id ?? null), v = a && m.status === "ready" ? m.byUserId.get(a)?.workingHours ?? [] : null;
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
148
  return {
149
149
  participants: l,
150
150
  busyOf: ue(o, a, f, m, i),
@@ -1 +1 @@
1
- {"version":3,"file":"FindTimeDialog.js","names":["SEARCH_DAYS","STEP","KEY_STEP","FindTimeDialog","handlers","source","basis","FindTimeReady","event","FindTimeState","FindTimeHeader","useCalendarPage","TabbedDialogHeader","IconTile","Users","tr","subtitle","body","edited","Button","TabbedDialog","open","onClose","TabbedDialogContent","TabbedDialogFooter","useUserIds","idsKey","participants","person","useMemo","useParticipants","useCalendar","youName","currentUser","participantsOf","me","busyReader","ownTime","owners","guest","userId","participant","identities","answer","freeBusy","personBusySpans","timeZone","loadStatus","rooms","peopleKnown","roomsReady","hasRoom","useFindTimeData","userIds","useIdentities","range","daysToInstants","day","addDays","useFreeBusy","roomId","roomIdOf","useRoomsForEvent","room","findTimeRoomOf","bookedRoomNameOf","myRules","workingHoursOn","date","useClashWords","clashes","data","key","item","name","useSubtitle","count","who","formatDuration","length","durationWords","page","setLength","useState","startLengthOf","setDay","startDayOf","pick","setPick","clashWords","people","busy","suggestions","suggestTimes","first","chosen","pickStart","zonedTimeToInstant","pickClashes","clashesAt","moving","movesDirectly","leave","onBack","FindTimeControls","next","SuggestionCards","FindTimeTimeline","PickSummary","onUse","lengths","LENGTH_CHIPS","a","b","Segmented","onLength","value","minutes","today","onDay","ChevronLeft","DatePicker","format","ChevronRight","SuggestionCard","checked","onPick","cn","FOCUS_RING","formatDay","suggestion","formatMinuteRange","instantToZoned","CircleCheck","AlertTriangle","SuggestionList","Notice","firstFree","outsiders","useBlockWord","kind","STRIPES","BLOCK_LOOK","TimelineBar","blockWord","geometry","place","pct","start","end","blocks","spans","blocksOnDay","block","window","showNow","row","off","part","pickEndClock","TimelineName","Building2","EntityAvatar","role","keyedMinute","steps","rtl","last","step","ready","hours","timelineWindow","minute","offHours","hourMarks","hour","rows","formatMinutes","Fragment","index","box","click","fraction","minuteAt","verdict"],"sources":["../../../src/v2/event/FindTimeDialog.tsx"],"sourcesContent":["/**\n * Find a time (BOFF-15698 A2): a viewer (fe-libs' dialog frame, at most 760 px wide; a sheet on\n * phones). Length and day; suggested times (everyone free first, then near misses naming who\n * can't make it; the room counts); and a timeline with a row per person and for the room, with\n * the working hours, the busy time and a now line. The timeline is also a slider: a click, or\n * the arrow keys, pick a time on it.\n *\n * Who it looks at depends on where it opened:\n * - from the event dialog: the person, the guests and the room picked there, and \"Use this time\"\n * goes back to the dialog with that time;\n * - from an event's peek (\"Find a better time\"): the event's people and room, and the event moves\n * there (with Undo, as a drag does) when a drag could move it; anything else opens the event\n * dialog with the time (`movesDirectly`);\n * - from ⋯ Find a time: the person alone, and the time starts a new event.\n *\n * Busy time comes from free/busy (people) and bookings (the room); someone outside the\n * workspace has none to show (\"No free/busy\"), which is never read as free.\n */\nimport { Fragment, useMemo, useState, type KeyboardEvent, type MouseEvent } from 'react';\nimport {\n AlertTriangle,\n Building2,\n ChevronLeft,\n ChevronRight,\n CircleCheck,\n Users,\n} from 'lucide-react';\nimport {\n addDays,\n Button,\n DatePicker,\n EntityAvatar,\n IconTile,\n Notice,\n Segmented,\n TabbedDialog,\n TabbedDialogContent,\n TabbedDialogFooter,\n TabbedDialogHeader,\n type DateValue,\n} from '@burdenoff/fe-libs/ui';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { useCalendar } from '../../providers/CalendarProvider';\nimport { useFreeBusy, type FreeBusyV2 } from '../data/useFreeBusy';\nimport { formatDay, formatDuration, formatMinuteRange, formatMinutes } from '../format';\nimport { offHours, workingHoursOn, type DayHours } from '../grid/workingHours';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { FOCUS_RING } from '../styles';\nimport { daysToInstants, instantToZoned, zonedTimeToInstant } from '../time/calendarTime';\nimport type { CalendarEventV2, WorkingHoursV2 } from '../types';\nimport { LENGTH_CHIPS } from './eventForm';\nimport type { EventSession } from './EventDialog';\nimport {\n blocksOnDay,\n clashesAt,\n minuteAt,\n movesDirectly,\n personBusySpans,\n suggestTimes,\n timelineWindow,\n type BusySpan,\n type FindTimePerson,\n type Suggestion,\n} from './findTime';\nimport {\n bookedRoomNameOf,\n findTimeRoomOf,\n participantsOf,\n pickEndClock,\n roomIdOf,\n startDayOf,\n startLengthOf,\n type FindTimeBasis,\n type FindTimeRoom,\n type Participant,\n type PickedTime,\n} from './findTimeSource';\nimport {\n useIdentities,\n useRoomsForEvent,\n type EditedEvent,\n type Identities,\n type RoomsForEvent,\n} from './useEventData';\n\n/** Where Find a time opened, and so whose time it looks at. */\nexport type FindTimeSource =\n | { kind: 'form'; session: EventSession; event: CalendarEventV2 | null }\n | { kind: 'event'; edited: EditedEvent }\n | { kind: 'none' };\n\n/** Days searched from the chosen one. */\nconst SEARCH_DAYS = 7;\n/** Minutes between suggested starts. */\nconst STEP = 30;\n/** Minutes a timeline key press moves the pick. */\nconst KEY_STEP = 15;\n\ninterface Handlers {\n /** \"Use this time\", with what Find a time was looking at. */\n onUse: (time: PickedTime, basis: FindTimeBasis) => void;\n /** Back to the event dialog (when it opened from there). */\n onBack: (() => void) | null;\n onClose: () => void;\n}\n\nexport function FindTimeDialog({ source, ...handlers }: { source: FindTimeSource } & Handlers) {\n if (source.kind === 'form') {\n const basis: FindTimeBasis = { kind: 'form', form: source.session.form, event: source.event };\n return <FindTimeReady basis={basis} {...handlers} />;\n }\n if (source.kind === 'none') return <FindTimeReady basis={{ kind: 'none' }} {...handlers} />;\n if (source.edited.status === 'ready') {\n // Keyed by the event, so its day and length start the search.\n const event = source.edited.event;\n return <FindTimeReady key={event.id} basis={{ kind: 'event', event }} {...handlers} />;\n }\n return <FindTimeState edited={source.edited} onClose={handlers.onClose} />;\n}\n\n/** The frame's header. */\nfunction FindTimeHeader({ subtitle }: { subtitle?: string }) {\n const { tr } = useCalendarPage();\n return (\n <TabbedDialogHeader\n icon={\n <IconTile size=\"sm\" aria-hidden=\"true\">\n <Users />\n </IconTile>\n }\n title={tr('calendar.v2.findTime', 'Find a time')}\n description={subtitle}\n closeLabel={tr('calendar.v2.close', 'Close')}\n />\n );\n}\n\n/** While the event to move loads, or when it can't be read. */\nfunction FindTimeState({ edited, onClose }: { edited: EditedEvent; onClose: () => void }) {\n const { tr } = useCalendarPage();\n let body = (\n <div className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.openingEvent', 'Opening the event…')}\n </div>\n );\n if (edited.status === 'missing') {\n body = (\n <div className=\"flex max-w-sm flex-col gap-2\">\n <b className=\"text-base text-text-primary\">\n {tr('calendar.v2.peekMissing', 'This event isn’t available')}\n </b>\n <p className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.actionGone', 'It may have been deleted or moved by someone else.')}\n </p>\n </div>\n );\n } else if (edited.status === 'error') {\n body = (\n <div className=\"flex max-w-sm flex-col items-center gap-3\">\n <b className=\"text-base text-text-primary\">\n {tr('calendar.v2.peekFailed', 'Couldn’t open the event')}\n </b>\n <Button type=\"button\" variant=\"outline\" onClick={edited.retry}>\n {tr('calendar.v2.tryAgain', 'Try again')}\n </Button>\n </div>\n );\n }\n return (\n <TabbedDialog open onOpenChange={(open) => (open ? undefined : onClose())}>\n <TabbedDialogContent size=\"viewer\" className=\"sm:max-w-[760px]\" aria-describedby={undefined}>\n <FindTimeHeader />\n <div className=\"grid min-h-0 flex-1 place-items-center p-6 text-center\">{body}</div>\n <TabbedDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tr('calendar.v2.close', 'Close')}\n </Button>\n </TabbedDialogFooter>\n </TabbedDialogContent>\n </TabbedDialog>\n );\n}\n\n/** What the dialog has read about everyone's time over the searched week. */\ninterface FindTimeData {\n participants: Participant[];\n /** A participant's busy time; null when it can't be known (someone outside the workspace). */\n busyOf: (participant: Participant) => BusySpan[] | null;\n room: FindTimeRoom | null;\n /** The person's working hours on a day; null for a day off or while they load. */\n hoursOn: (date: DateValue) => DayHours | null;\n status: 'loading' | 'ready' | 'error';\n retry: () => void;\n /** People whose free/busy may be missing some busy time. */\n truncated: Participant[];\n nameOf: (participant: Participant) => string;\n}\n\n/** The participants' user ids: the same array while they are the same people. */\nfunction useUserIds(participants: readonly Participant[]): string[] {\n const idsKey = participants\n .flatMap((person) => (person.userId ? [person.userId] : []))\n .join('\\n');\n return useMemo(() => (idsKey ? idsKey.split('\\n') : []), [idsKey]);\n}\n\n/** The people Find a time looks at, the person first, with their roles. */\nfunction useParticipants(basis: FindTimeBasis): Participant[] {\n const { tr, me } = useCalendarPage();\n const { currentUser } = useCalendar();\n const youName = currentUser?.name?.trim() || currentUser?.email || tr('calendar.v2.evYou', 'You');\n return participantsOf(basis, me, {\n you: `${youName} ${tr('calendar.v2.youSuffix', '(you)')}`,\n organiser: tr('calendar.v2.organiser', 'Organiser'),\n required: tr('calendar.v2.evRequired', 'Required'),\n optional: tr('calendar.v2.evOptional', 'Optional'),\n guest: tr('calendar.v2.guest', 'Guest'),\n });\n}\n\n/**\n * A participant's busy time from free/busy; null for someone with none to show (outside the\n * workspace). The event's own time doesn't count against its organiser and guests.\n */\nfunction busyReader(\n event: CalendarEventV2 | null,\n me: string | null,\n identities: Identities,\n freeBusy: FreeBusyV2,\n timeZone: string\n): (participant: Participant) => BusySpan[] | null {\n const ownTime = event && !event.allDay ? { start: event.start, end: event.end } : null;\n const owners = new Set(\n (event?.guests ?? [])\n .filter((guest) => guest.response !== 'DECLINED')\n .map((guest) => guest.userId)\n );\n if (event) owners.add(event.organizerId);\n return (participant) => {\n const userId = participant.userId;\n const member =\n userId !== null &&\n (userId === me || identities.status !== 'ready' || identities.byUserId.has(userId));\n if (!member) return null;\n const answer = freeBusy.byUserId.get(userId);\n if (!answer) return [];\n return personBusySpans(answer, timeZone, owners.has(userId) ? ownTime : null);\n };\n}\n\n/**\n * Loading, ready, or failed: free/busy, who of the people is a member (anyone else has no\n * free/busy, which must never read as free), and the room's bookings when there is a room.\n */\nfunction loadStatus(\n freeBusy: FreeBusyV2,\n identities: Identities,\n rooms: RoomsForEvent,\n hasRoom: boolean\n): FindTimeData['status'] {\n if ([freeBusy.status, identities.status, rooms.status].includes('error')) return 'error';\n const peopleKnown = identities.status === 'ready' || identities.status === 'idle';\n const roomsReady = !hasRoom || rooms.status === 'ready';\n return freeBusy.status === 'ready' && peopleKnown && roomsReady ? 'ready' : 'loading';\n}\n\nfunction useFindTimeData(basis: FindTimeBasis, day: DateValue): FindTimeData {\n const { tr, timeZone, me } = useCalendarPage();\n const event = basis.kind === 'none' ? null : basis.event;\n const participants = useParticipants(basis);\n const userIds = useUserIds(participants);\n const identities = useIdentities(userIds);\n const range = daysToInstants(day, addDays(day, SEARCH_DAYS - 1), timeZone);\n const freeBusy = useFreeBusy(userIds, range.from, range.to);\n const roomId = roomIdOf(basis);\n const rooms = useRoomsForEvent(range.to, { skip: roomId === null });\n const room = findTimeRoomOf(\n roomId,\n rooms,\n bookedRoomNameOf(basis) ?? tr('calendar.v2.theRoom', 'The room'),\n range,\n event?.id ?? null\n );\n const myRules: readonly WorkingHoursV2[] | null =\n me && freeBusy.status === 'ready' ? (freeBusy.byUserId.get(me)?.workingHours ?? []) : null;\n return {\n participants,\n busyOf: busyReader(event, me, identities, freeBusy, timeZone),\n room,\n hoursOn: (date) => (myRules ? workingHoursOn(date, myRules, timeZone) : null),\n status: loadStatus(freeBusy, identities, rooms, roomId !== null),\n retry: () => {\n freeBusy.refetch();\n identities.retry();\n rooms.retry();\n },\n truncated: participants.filter(\n (person) => person.userId !== null && freeBusy.byUserId.get(person.userId)?.truncated\n ),\n nameOf: (participant) =>\n participant.userId && participant.userId !== me\n ? (identities.byUserId.get(participant.userId)?.name ?? participant.name)\n : participant.name,\n };\n}\n\n/** \"Priya is busy · Atlas is booked\". */\nfunction useClashWords(data: FindTimeData): (clashes: readonly string[]) => string {\n const { tr, me } = useCalendarPage();\n return (clashes) =>\n clashes\n .map((key) => {\n if (data.room && key === data.room.id) {\n return tr('calendar.v2.ftRoomBooked', '{{room}} is booked', { room: data.room.name });\n }\n if (me && key === `u:${me}`) return tr('calendar.v2.ftYouBusy', 'You’re busy');\n const person = data.participants.find((item) => item.key === key);\n const name = person ? data.nameOf(person) : key;\n return tr('calendar.v2.ftPersonBusy', '{{name}} is busy', {\n name: name.split(' ')[0] ?? name,\n });\n })\n .join(' · ');\n}\n\n/** \"1 h · 4 people and Atlas\". */\nfunction useSubtitle(data: FindTimeData, length: number): string {\n const { tr, durationWords } = useCalendarPage();\n const count = data.participants.length;\n const who =\n count === 1\n ? tr('calendar.v2.peopleOne', '1 person')\n : tr('calendar.v2.peopleMany', '{{count}} people', { count });\n return [\n formatDuration(length, durationWords),\n data.room\n ? tr('calendar.v2.ftWhoAndRoom', '{{who}} and {{room}}', { who, room: data.room.name })\n : who,\n ].join(' · ');\n}\n\nfunction FindTimeReady({ basis, onUse, onBack, onClose }: { basis: FindTimeBasis } & Handlers) {\n const page = useCalendarPage();\n const { tr, timeZone, me } = page;\n const [length, setLength] = useState(() => startLengthOf(basis));\n const [day, setDay] = useState<DateValue>(() => startDayOf(basis, timeZone, page.today));\n const [pick, setPick] = useState<{ date: DateValue; start: number } | null>(null);\n const data = useFindTimeData(basis, day);\n const clashWords = useClashWords(data);\n\n const people: FindTimePerson[] = data.participants.flatMap((person) => {\n const busy = data.busyOf(person);\n return busy === null ? [] : [{ id: person.key, required: person.required, busy }];\n });\n const suggestions: Suggestion[] =\n data.status === 'ready'\n ? suggestTimes({\n day,\n days: SEARCH_DAYS,\n timeZone,\n length,\n now: page.now,\n step: STEP,\n workingHours: data.hoursOn,\n people,\n room: data.room,\n })\n : [];\n const first = suggestions[0];\n const chosen = pick ?? (first ? { date: first.date, start: first.start } : null);\n\n // The picked time's clashes (a time picked on the timeline needn't be a suggestion).\n const pickStart = chosen ? zonedTimeToInstant(chosen.date, chosen.start, timeZone) : null;\n const pickClashes = pickStart\n ? clashesAt(people, data.room, pickStart, new Date(pickStart.getTime() + length * 60_000))\n .clashes\n : [];\n\n const event = basis.kind === 'event' ? basis.event : null;\n const moving =\n event !== null && movesDirectly(event, page.calendarsById.get(event.calendarId), me, timeZone);\n const subtitle = useSubtitle(data, length);\n const leave = () => (onBack ? onBack() : onClose());\n\n return (\n <TabbedDialog open onOpenChange={(open) => (open ? undefined : leave())}>\n <TabbedDialogContent size=\"viewer\" className=\"sm:max-w-[760px]\" aria-describedby={undefined}>\n <FindTimeHeader subtitle={subtitle} />\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain p-5\">\n <div className=\"flex flex-col gap-5\">\n <FindTimeControls\n length={length}\n onLength={(next) => {\n setLength(next);\n setPick(null);\n }}\n day={day}\n onDay={(next) => {\n setDay(next);\n setPick(null);\n }}\n />\n <SuggestionCards\n data={data}\n suggestions={suggestions}\n chosen={chosen}\n onPick={setPick}\n day={day}\n clashWords={clashWords}\n />\n <FindTimeTimeline\n data={data}\n day={day}\n length={length}\n chosen={chosen}\n onPick={(start) => setPick({ date: day, start })}\n />\n </div>\n </div>\n <TabbedDialogFooter className=\"gap-2\">\n <PickSummary\n chosen={chosen}\n length={length}\n ready={data.status === 'ready'}\n clashes={pickClashes}\n clashWords={clashWords}\n />\n <Button type=\"button\" variant=\"outline\" onClick={leave}>\n {onBack ? tr('calendar.v2.ftBack', 'Back') : tr('calendar.v2.evCancel', 'Cancel')}\n </Button>\n <Button\n type=\"button\"\n disabled={!chosen || data.status !== 'ready'}\n onClick={() => (chosen ? onUse({ ...chosen, length }, basis) : undefined)}\n >\n {moving\n ? tr('calendar.v2.ftMoveHere', 'Move the event here')\n : tr('calendar.v2.ftUse', 'Use this time')}\n </Button>\n </TabbedDialogFooter>\n </TabbedDialogContent>\n </TabbedDialog>\n );\n}\n\n/** Length and day. */\nfunction FindTimeControls({\n length,\n onLength,\n day,\n onDay,\n}: {\n length: number;\n onLength: (minutes: number) => void;\n day: DateValue;\n onDay: (day: DateValue) => void;\n}) {\n const page = useCalendarPage();\n const { tr, format, today } = page;\n const lengths = [...new Set([...LENGTH_CHIPS, length])].sort((a, b) => a - b);\n return (\n <div className=\"flex flex-wrap items-end gap-x-6 gap-y-3\">\n {/* Full width on phones, where the chips fill the row (fe-libs' Segmented). */}\n <div className=\"flex flex-col gap-1.5 max-md:w-full\">\n <span id=\"calendar-ft-length\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.evLength', 'Length')}\n </span>\n <Segmented<string>\n aria-labelledby=\"calendar-ft-length\"\n value={String(length)}\n onValueChange={(value) => onLength(Number(value))}\n options={lengths.map((minutes) => ({\n value: String(minutes),\n label: formatDuration(minutes, page.durationWords),\n }))}\n />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <span id=\"calendar-ft-day\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.day', 'Day')}\n </span>\n <div className=\"flex items-center gap-1.5\" role=\"group\" aria-labelledby=\"calendar-ft-day\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={tr('calendar.v2.ftPrevDay', 'Previous day')}\n disabled={day <= today}\n onClick={() => onDay(addDays(day, -1))}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </Button>\n <DatePicker\n value={day}\n onChange={onDay}\n label={tr('calendar.v2.day', 'Day')}\n weekStartsOn={page.prefs.weekStart}\n locale={format.locale}\n timeZone={page.timeZone}\n min={today}\n format={{ weekday: 'long', day: 'numeric', month: 'short' }}\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={tr('calendar.v2.ftNextDay', 'Next day')}\n onClick={() => onDay(addDays(day, 1))}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/** One suggested time, as a radio card. */\nfunction SuggestionCard({\n suggestion,\n checked,\n onPick,\n clashWords,\n}: {\n suggestion: Suggestion;\n checked: boolean;\n onPick: () => void;\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr, format, timeZone } = useCalendarPage();\n return (\n <button\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n onClick={onPick}\n className={cn(\n 'flex min-w-0 flex-col gap-1 rounded-card border p-3 text-start motion-safe:transition-colors',\n checked\n ? 'border-action-primary-bg bg-accent-soft shadow-[inset_0_0_0_1px_var(--color-action-primary-bg)]'\n : 'border-border-default bg-bg-surface hover:border-border-strong',\n FOCUS_RING\n )}\n >\n <b className=\"text-sm font-semibold text-text-primary\">\n {formatDay(suggestion.date, format, 'short')} ·{' '}\n {formatMinuteRange(\n suggestion.start,\n instantToZoned(suggestion.endAt, timeZone).minutes,\n format\n )}\n </b>\n {suggestion.clashes.length === 0 ? (\n <span className=\"inline-flex items-center gap-1 text-xs font-semibold text-status-success-text\">\n <CircleCheck className=\"size-3.5\" aria-hidden=\"true\" />\n {tr('calendar.v2.ftEveryoneFree', 'Everyone’s free')}\n </span>\n ) : (\n <span className=\"inline-flex items-start gap-1 text-xs font-semibold text-status-warning-text\">\n <AlertTriangle className=\"mt-px size-3.5 shrink-0\" aria-hidden=\"true\" />\n {clashWords(suggestion.clashes)}\n </span>\n )}\n </button>\n );\n}\n\n/** The suggested times, or why there are none yet. */\nfunction SuggestionList({\n data,\n suggestions,\n chosen,\n onPick,\n clashWords,\n}: {\n data: FindTimeData;\n suggestions: readonly Suggestion[];\n chosen: { date: DateValue; start: number } | null;\n onPick: (pick: { date: DateValue; start: number }) => void;\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr } = useCalendarPage();\n if (data.status === 'error') {\n return (\n <Notice\n tone=\"bad\"\n action={\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={data.retry}>\n {tr('calendar.v2.tryAgain', 'Try again')}\n </Button>\n }\n >\n {tr(\n 'calendar.v2.evFreeBusyFailed',\n 'Couldn’t check who’s free. That isn’t the same as free.'\n )}\n </Notice>\n );\n }\n if (data.status === 'loading') {\n return (\n <p className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.ftLooking', 'Looking at everyone’s time…')}\n </p>\n );\n }\n if (suggestions.length === 0) {\n return (\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'calendar.v2.ftNothing',\n 'No time in your working hours this week. Try a shorter length or another day.'\n )}\n </p>\n );\n }\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby=\"calendar-ft-suggested\"\n className=\"grid gap-2 sm:grid-cols-3\"\n >\n {suggestions.map((suggestion) => (\n <SuggestionCard\n key={`${suggestion.date}|${suggestion.start}`}\n suggestion={suggestion}\n checked={chosen?.date === suggestion.date && chosen.start === suggestion.start}\n onPick={() => onPick({ date: suggestion.date, start: suggestion.start })}\n clashWords={clashWords}\n />\n ))}\n </div>\n );\n}\n\n/** \"Suggested times\", the list, and the notes under it. */\nfunction SuggestionCards({\n data,\n suggestions,\n chosen,\n onPick,\n day,\n clashWords,\n}: {\n data: FindTimeData;\n suggestions: readonly Suggestion[];\n chosen: { date: DateValue; start: number } | null;\n onPick: (pick: { date: DateValue; start: number }) => void;\n day: DateValue;\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr, format } = useCalendarPage();\n const firstFree = suggestions.find((item) => item.clashes.length === 0);\n const outsiders = data.participants.filter((person) => data.busyOf(person) === null);\n return (\n <div className=\"flex flex-col gap-2\">\n <span id=\"calendar-ft-suggested\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.ftSuggested', 'Suggested times')}\n </span>\n <SuggestionList\n data={data}\n suggestions={suggestions}\n chosen={chosen}\n onPick={onPick}\n clashWords={clashWords}\n />\n {firstFree && firstFree.date !== day ? (\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'calendar.v2.ftLaterDays',\n 'Nothing on {{day}} works for everyone; the first such times are on later days.',\n { day: formatDay(day, format, 'short') }\n )}\n </p>\n ) : null}\n {outsiders.length > 0 ? (\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'calendar.v2.ftOutsiders',\n 'Not counted: {{names}}. People outside the workspace have no free/busy to show.',\n { names: outsiders.map((person) => person.name).join(', ') }\n )}\n </p>\n ) : null}\n {data.truncated.length > 0 ? (\n <p className=\"text-xs text-status-warning-text\">\n {tr(\n 'calendar.v2.ftTruncated',\n 'Some busy time couldn’t all be read for {{names}}: check with them.',\n { names: data.truncated.map((person) => data.nameOf(person)).join(', ') }\n )}\n </p>\n ) : null}\n </div>\n );\n}\n\n/** What a busy block on the timeline says. */\nfunction useBlockWord(): (kind: BusySpan['kind']) => string {\n const { tr } = useCalendarPage();\n return (kind) => {\n switch (kind) {\n case 'away':\n return tr('calendar.v2.evAway', 'Away');\n case 'closed':\n return tr('calendar.v2.roomPaused', 'Closed');\n case 'booked':\n return tr('calendar.v2.ftBooked', 'Booked');\n default:\n return tr('calendar.v2.busy', 'Busy');\n }\n };\n}\n\nconst STRIPES =\n 'bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,var(--color-border-subtle)_6px_9px)]';\n\nconst BLOCK_LOOK: Readonly<Record<BusySpan['kind'], string>> = {\n tentative: 'border-dashed border-border-strong bg-bg-sunken text-text-secondary',\n busy: 'border-border-strong bg-bg-sunken text-text-primary',\n booked: 'border-border-strong bg-bg-sunken text-text-primary',\n away: cn('border-border-strong text-text-secondary', STRIPES),\n closed: cn('border-border-strong text-text-secondary', STRIPES),\n};\n\ninterface TimelineGeometry {\n day: DateValue;\n window: { start: number; end: number };\n /** Where a minute of the day sits across the bar, in percent. */\n pct: (minute: number) => number;\n}\n\n/** One row's bar: off hours striped, busy blocks, the now line and the pick. */\nfunction TimelineBar({\n row,\n spans,\n geometry,\n off,\n chosen,\n length,\n}: {\n /** Its grid row (the slider lies over the bars, so every cell is placed). */\n row: number;\n spans: BusySpan[] | null;\n geometry: TimelineGeometry;\n off: readonly { start: number; end: number }[];\n chosen: { date: DateValue; start: number } | null;\n length: number;\n}) {\n const page = useCalendarPage();\n const { tr, timeZone } = page;\n const blockWord = useBlockWord();\n const { day, window, pct } = geometry;\n const place = (start: number, end: number) => ({\n insetInlineStart: `${pct(start)}%`,\n width: `${pct(end) - pct(start)}%`,\n });\n const blocks = spans\n ? blocksOnDay(spans, day, timeZone).filter(\n (block) => block.end > window.start && block.start < window.end\n )\n : [];\n const showNow =\n day === page.today && page.nowMinute > window.start && page.nowMinute < window.end;\n return (\n <div\n className=\"relative col-start-2 min-h-11 border-b border-border-subtle\"\n style={{ gridRow: row }}\n >\n {off.map((part) => (\n <i\n key={`${part.start}-${part.end}`}\n aria-hidden=\"true\"\n className=\"absolute inset-y-0 bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,transparent_6px_10px)]\"\n style={place(part.start, part.end)}\n />\n ))}\n {spans === null ? (\n <span className=\"absolute inset-0 grid place-items-center text-xs text-text-secondary\">\n {tr('calendar.v2.evNoFreeBusy', 'No free/busy')}\n </span>\n ) : null}\n {blocks.map((block) => (\n <i\n key={`${block.start}-${block.end}-${block.kind}`}\n aria-hidden=\"true\"\n className={cn(\n 'absolute inset-y-2 overflow-hidden rounded-md border px-1 text-[11px] leading-6 not-italic',\n BLOCK_LOOK[block.kind]\n )}\n style={place(block.start, block.end)}\n >\n {blockWord(block.kind)}\n </i>\n ))}\n {showNow ? (\n <i\n aria-hidden=\"true\"\n className=\"absolute inset-y-0 w-0.5 bg-action-primary-bg\"\n style={{ insetInlineStart: `${pct(page.nowMinute)}%` }}\n />\n ) : null}\n {chosen?.date === day ? (\n <i\n aria-hidden=\"true\"\n 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)]\"\n style={place(chosen.start, pickEndClock({ ...chosen, length }, timeZone))}\n />\n ) : null}\n </div>\n );\n}\n\n/** A timeline row's name: an avatar (or a room tile), the name and the role. */\nfunction TimelineName({\n row,\n name,\n role,\n room,\n}: {\n row: number;\n name: string;\n role: string;\n room: boolean;\n}) {\n return (\n <div\n className=\"col-start-1 flex min-w-0 items-center gap-2 border-b border-border-subtle px-3 py-2\"\n style={{ gridRow: row }}\n >\n {room ? (\n <span className=\"grid size-6 shrink-0 place-items-center rounded-md bg-bg-sunken text-text-secondary\">\n <Building2 className=\"size-3.5\" aria-hidden=\"true\" />\n </span>\n ) : (\n <EntityAvatar name={name} size={24} />\n )}\n <span className=\"min-w-0\">\n <b className=\"block truncate text-xs font-semibold text-text-primary\">{name}</b>\n <small className=\"block truncate text-[11px] text-text-secondary\">{role}</small>\n </span>\n </div>\n );\n}\n\n/** The minute a timeline key moves the pick to; null for a key it doesn't take. */\nfunction keyedMinute(\n key: string,\n rtl: boolean,\n value: number,\n window: { start: number; end: number },\n last: number\n): number | null {\n const steps: Readonly<Record<string, number>> = {\n ArrowRight: rtl ? -KEY_STEP : KEY_STEP,\n ArrowLeft: rtl ? KEY_STEP : -KEY_STEP,\n ArrowUp: KEY_STEP,\n ArrowDown: -KEY_STEP,\n PageUp: 60,\n PageDown: -60,\n };\n if (key === 'Home') return window.start;\n if (key === 'End') return last;\n const step = steps[key];\n return step === undefined ? null : Math.max(window.start, Math.min(value + step, last));\n}\n\n/**\n * The day's timeline: a row per person and for the room. Over the bars lies a slider: a click\n * picks the quarter hour under the pointer; the arrow keys move the pick 15 minutes, Page Up and\n * Page Down an hour, Home and End to the ends of the day shown.\n */\nfunction FindTimeTimeline({\n data,\n day,\n length,\n chosen,\n onPick,\n}: {\n data: FindTimeData;\n day: DateValue;\n length: number;\n chosen: { date: DateValue; start: number } | null;\n onPick: (start: number) => void;\n}) {\n const { tr, format, timeZone } = useCalendarPage();\n // No time is picked before everyone's busy time is in hand: it would read as free.\n const ready = data.status === 'ready';\n const hours = data.hoursOn(day);\n const window = timelineWindow(hours);\n const geometry: TimelineGeometry = {\n day,\n window,\n pct: (minute) =>\n ((Math.min(Math.max(minute, window.start), window.end) - window.start) /\n (window.end - window.start)) *\n 100,\n };\n const off = offHours(hours).filter((part) => part.end > window.start && part.start < window.end);\n const last = window.end - length;\n const value = chosen?.date === day ? chosen.start : (hours?.start ?? window.start);\n // Hours inside the window: a label at either edge would hang outside it.\n const hourMarks: number[] = [];\n for (let hour = Math.floor(window.start / 60) + 1; hour * 60 < window.end; hour += 1) {\n hourMarks.push(hour);\n }\n const rows = data.participants.map((person) => ({\n key: person.key,\n name: data.nameOf(person),\n role: person.role,\n room: false,\n spans: data.busyOf(person),\n }));\n if (data.room) {\n rows.push({\n key: data.room.id,\n name: data.room.name,\n role: tr('calendar.v2.ftRoom', 'Room'),\n room: true,\n spans: data.room.busy,\n });\n }\n const onClick = (click: MouseEvent<HTMLDivElement>) => {\n const box = click.currentTarget.getBoundingClientRect();\n if (!ready || box.width <= 0) return;\n const rtl = getComputedStyle(click.currentTarget).direction === 'rtl';\n const fraction = (rtl ? box.right - click.clientX : click.clientX - box.left) / box.width;\n onPick(minuteAt(fraction, window, length));\n };\n const onKeyDown = (key: KeyboardEvent<HTMLDivElement>) => {\n const rtl = getComputedStyle(key.currentTarget).direction === 'rtl';\n const next = ready ? keyedMinute(key.key, rtl, value, window, last) : null;\n if (next === null) return;\n key.preventDefault();\n onPick(next);\n };\n return (\n <div className=\"flex flex-col gap-2\">\n <span id=\"calendar-ft-timeline\" className=\"text-sm font-semibold text-text-primary\">\n {formatDay(day, format, 'mid')} · {formatMinuteRange(window.start, window.end, format)}\n </span>\n <div className=\"overflow-x-auto rounded-card border border-border-default bg-bg-surface\">\n <div className=\"grid min-w-[560px] grid-cols-[minmax(120px,160px)_minmax(0,1fr)]\">\n <span className=\"col-start-1 row-start-1 border-b border-border-subtle\" />\n <div\n className=\"relative col-start-2 row-start-1 h-6 border-b border-border-subtle\"\n aria-hidden=\"true\"\n >\n {hourMarks.map((hour) => (\n <span\n key={hour}\n className=\"absolute top-1 -translate-x-1/2 text-[11px] text-text-muted rtl:translate-x-1/2\"\n style={{ insetInlineStart: `${geometry.pct(hour * 60)}%` }}\n >\n {formatMinutes(hour * 60, format)}\n </span>\n ))}\n </div>\n {rows.map((row, index) => (\n <Fragment key={row.key}>\n <TimelineName row={index + 2} name={row.name} role={row.role} room={row.room} />\n <TimelineBar\n row={index + 2}\n spans={row.spans}\n geometry={geometry}\n off={off}\n chosen={chosen}\n length={length}\n />\n </Fragment>\n ))}\n <div\n role=\"slider\"\n tabIndex={0}\n aria-labelledby=\"calendar-ft-timeline\"\n aria-valuemin={window.start}\n aria-valuemax={last}\n aria-valuenow={value}\n aria-valuetext={formatMinuteRange(\n value,\n pickEndClock({ date: day, start: value, length }, timeZone),\n format\n )}\n aria-disabled={ready ? undefined : true}\n onClick={onClick}\n onKeyDown={onKeyDown}\n className={cn(\n 'relative z-10 col-start-2 rounded-md',\n ready ? 'cursor-pointer' : 'cursor-progress',\n FOCUS_RING\n )}\n style={{ gridRow: `2 / span ${rows.length}` }}\n />\n </div>\n </div>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'calendar.v2.ftTimelineHint',\n 'Click a free spot, or use the arrow keys, to pick a time. Striped: outside your working hours.'\n )}\n </p>\n </div>\n );\n}\n\n/** The footer's words: the picked time and who can't make it. */\nfunction PickSummary({\n chosen,\n length,\n ready,\n clashes,\n clashWords,\n}: {\n chosen: { date: DateValue; start: number } | null;\n length: number;\n /** Everyone's busy time (and the room's) is in hand; until then nothing is called free. */\n ready: boolean;\n clashes: readonly string[];\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr, format, timeZone } = useCalendarPage();\n if (!chosen) {\n return (\n <span className=\"min-w-0 flex-1 text-xs text-text-secondary max-sm:basis-full\">\n {tr('calendar.v2.ftPick', 'Pick a time')}\n </span>\n );\n }\n let verdict = (\n <span className=\"text-text-secondary\">\n {tr('calendar.v2.ftCheckingFree', 'Checking who’s free…')}\n </span>\n );\n if (ready && clashes.length === 0) {\n verdict = (\n <span className=\"font-semibold text-status-success-text\">\n {tr('calendar.v2.ftEveryoneFree', 'Everyone’s free')}\n </span>\n );\n } else if (ready) {\n verdict = <span className=\"font-semibold text-status-warning-text\">{clashWords(clashes)}</span>;\n }\n return (\n <span className=\"min-w-0 flex-1 text-xs max-sm:basis-full\">\n <span className=\"text-text-secondary\">\n {formatDay(chosen.date, format, 'short')} ·{' '}\n {formatMinuteRange(chosen.start, pickEndClock({ ...chosen, length }, timeZone), format)}{' '}\n ·{' '}\n </span>\n {verdict}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4FA,IAAMA,IAAc,GAEdC,IAAO,IAEPC,IAAW;AAUjB,SAAgBC,GAAe,EAAE,WAAQ,GAAGC,KAAmD;CAC7F,IAAIC,EAAO,SAAS,QAAQ;EAC1B,IAAMC,IAAuB;GAAE,MAAM;GAAQ,MAAMD,EAAO,QAAQ;GAAM,OAAOA,EAAO;EAAM;EAC5F,OAAO,kBAACE,GAAD;GAAsB;GAAO,GAAIH;EAAW,CAAA;CACrD;CACA,IAAIC,EAAO,SAAS,QAAQ,OAAO,kBAACE,GAAD;EAAe,OAAO,EAAE,MAAM,OAAO;EAAG,GAAIH;CAAW,CAAA;CAC1F,IAAIC,EAAO,OAAO,WAAW,SAAS;EAEpC,IAAMG,IAAQH,EAAO,OAAO;EAC5B,OAAO,kBAACE,GAAD;GAA8B,OAAO;IAAE,MAAM;IAAS;GAAM;GAAG,GAAIH;EAAW,GAA1DI,EAAM,EAAoD;CACvF;CACA,OAAO,kBAACC,IAAD;EAAe,QAAQJ,EAAO;EAAQ,SAASD,EAAS;CAAU,CAAA;AAC3E;AAGA,SAASM,EAAe,EAAE,eAAmC;CAC3D,IAAM,EAAE,UAAOC,EAAgB;CAC/B,OACE,kBAACC,GAAD;EACE,MACE,kBAACC,IAAD;GAAU,MAAK;GAAK,eAAY;GAC9B,UAAA,kBAACC,GAAD,CAAQ,CAAA;EACA,CAAA;EAEZ,OAAOC,EAAG,wBAAwB,aAAa;EAC/C,aAAaC;EACb,YAAYD,EAAG,qBAAqB,OAAO;CAC5C,CAAA;AAEL;AAGA,SAASN,GAAc,EAAE,WAAQ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M,WAAU;EACb,UAAAvD,EAAG,8BAA8B,iBAAiB;CAC/C,CAAA,IAEC0J,MACT,IAAU,kBAAC,QAAD;EAAM,WAAU;EAA0C,UAAAhF,EAAWnB,CAAO;CAAQ,CAAA,IAG9F,kBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CACE,kBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA;IACG2D,EAAUlC,EAAO,MAAM2B,GAAQ,OAAO;IAAE;IAAG;IAC3CS,EAAkBpC,EAAO,OAAOgE,EAAa;KAAE,GAAGhE;KAAQ;IAAO,GAAGjD,CAAQ,GAAG4E,CAAM;IAAG;IAAI;IAC3F;GACE;EACL,CAAA,GAAA8D,CACG;;AAEV"}
1
+ {"version":3,"file":"FindTimeDialog.js","names":["SEARCH_DAYS","STEP","KEY_STEP","FindTimeDialog","handlers","source","basis","FindTimeReady","event","FindTimeState","FindTimeHeader","useCalendarPage","TabbedDialogHeader","IconTile","Users","tr","subtitle","body","edited","Button","TabbedDialog","open","onClose","TabbedDialogContent","TabbedDialogFooter","useUserIds","idsKey","participants","person","useMemo","useParticipants","useCalendar","youName","currentUser","participantsOf","me","busyReader","ownTime","owners","guest","userId","participant","identities","answer","freeBusy","personBusySpans","timeZone","loadStatus","rooms","peopleKnown","roomsReady","hasRoom","useFindTimeData","userIds","useIdentities","range","daysToInstants","day","addDays","useFreeBusy","roomId","roomIdOf","useRoomsForEvent","room","findTimeRoomOf","bookedRoomNameOf","myRules","workingHoursOn","date","useClashWords","clashes","data","key","item","name","useSubtitle","count","who","formatDuration","length","durationWords","page","setLength","useState","startLengthOf","setDay","startDayOf","pick","setPick","clashWords","people","busy","suggestions","suggestTimes","first","chosen","pickStart","zonedTimeToInstant","pickClashes","clashesAt","moving","movesDirectly","leave","onBack","FindTimeControls","next","SuggestionCards","FindTimeTimeline","PickSummary","onUse","lengths","LENGTH_CHIPS","a","b","Segmented","onLength","value","minutes","today","onDay","ChevronLeft","DatePicker","format","ChevronRight","SuggestionCard","checked","onPick","cn","FOCUS_RING","formatDay","suggestion","formatMinuteRange","instantToZoned","CircleCheck","AlertTriangle","SuggestionList","Notice","firstFree","outsiders","useBlockWord","kind","STRIPES","BLOCK_LOOK","TimelineBar","blockWord","geometry","place","pct","start","end","blocks","spans","blocksOnDay","block","window","showNow","row","off","part","pickEndClock","TimelineName","Building2","EntityAvatar","role","keyedMinute","steps","rtl","last","step","ready","hours","timelineWindow","minute","offHours","hourMarks","hour","rows","formatMinutes","Fragment","index","box","click","fraction","minuteAt","verdict"],"sources":["../../../src/v2/event/FindTimeDialog.tsx"],"sourcesContent":["/**\n * Find a time (BOFF-15698 A2): a viewer (fe-libs' dialog frame, at most 760 px wide; a sheet on\n * phones). Length and day; suggested times (everyone free first, then near misses naming who\n * can't make it; the room counts); and a timeline with a row per person and for the room, with\n * the working hours, the busy time and a now line. The timeline is also a slider: a click, or\n * the arrow keys, pick a time on it.\n *\n * Who it looks at depends on where it opened:\n * - from the event dialog: the person, the guests and the room picked there, and \"Use this time\"\n * goes back to the dialog with that time;\n * - from an event's peek (\"Find a better time\"): the event's people and room, and the event moves\n * there (with Undo, as a drag does) when a drag could move it; anything else opens the event\n * dialog with the time (`movesDirectly`);\n * - from ⋯ Find a time: the person alone, and the time starts a new event.\n *\n * Busy time comes from free/busy (people) and bookings (the room); someone outside the\n * workspace has none to show (\"No free/busy\"), which is never read as free.\n */\nimport { Fragment, useMemo, useState, type KeyboardEvent, type MouseEvent } from 'react';\nimport {\n AlertTriangle,\n Building2,\n ChevronLeft,\n ChevronRight,\n CircleCheck,\n Users,\n} from 'lucide-react';\nimport {\n addDays,\n Button,\n DatePicker,\n EntityAvatar,\n IconTile,\n Notice,\n Segmented,\n TabbedDialog,\n TabbedDialogContent,\n TabbedDialogFooter,\n TabbedDialogHeader,\n type DateValue,\n} from '@burdenoff/fe-libs/ui';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { useCalendar } from '../../providers/CalendarProvider';\nimport { useFreeBusy, type FreeBusyV2 } from '../data/useFreeBusy';\nimport { formatDay, formatDuration, formatMinuteRange, formatMinutes } from '../format';\nimport { offHours, workingHoursOn, type DayHours } from '../grid/workingHours';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { FOCUS_RING } from '../styles';\nimport { daysToInstants, instantToZoned, zonedTimeToInstant } from '../time/calendarTime';\nimport type { CalendarEventV2, WorkingHoursV2 } from '../types';\nimport { LENGTH_CHIPS } from './eventForm';\nimport type { EventSession } from './EventDialog';\nimport {\n blocksOnDay,\n clashesAt,\n minuteAt,\n movesDirectly,\n personBusySpans,\n suggestTimes,\n timelineWindow,\n type BusySpan,\n type FindTimePerson,\n type Suggestion,\n} from './findTime';\nimport {\n bookedRoomNameOf,\n findTimeRoomOf,\n participantsOf,\n pickEndClock,\n roomIdOf,\n startDayOf,\n startLengthOf,\n type FindTimeBasis,\n type FindTimeRoom,\n type Participant,\n type PickedTime,\n} from './findTimeSource';\nimport {\n useIdentities,\n useRoomsForEvent,\n type EditedEvent,\n type Identities,\n type RoomsForEvent,\n} from './useEventData';\n\n/** Where Find a time opened, and so whose time it looks at. */\nexport type FindTimeSource =\n | { kind: 'form'; session: EventSession; event: CalendarEventV2 | null }\n | { kind: 'event'; edited: EditedEvent }\n | { kind: 'none' };\n\n/** Days searched from the chosen one. */\nconst SEARCH_DAYS = 7;\n/** Minutes between suggested starts. */\nconst STEP = 30;\n/** Minutes a timeline key press moves the pick. */\nconst KEY_STEP = 15;\n\ninterface Handlers {\n /** \"Use this time\", with what Find a time was looking at. */\n onUse: (time: PickedTime, basis: FindTimeBasis) => void;\n /** Back to the event dialog (when it opened from there). */\n onBack: (() => void) | null;\n onClose: () => void;\n}\n\nexport function FindTimeDialog({ source, ...handlers }: { source: FindTimeSource } & Handlers) {\n if (source.kind === 'form') {\n const basis: FindTimeBasis = { kind: 'form', form: source.session.form, event: source.event };\n return <FindTimeReady basis={basis} {...handlers} />;\n }\n if (source.kind === 'none') return <FindTimeReady basis={{ kind: 'none' }} {...handlers} />;\n if (source.edited.status === 'ready') {\n // Keyed by the event, so its day and length start the search.\n const event = source.edited.event;\n return <FindTimeReady key={event.id} basis={{ kind: 'event', event }} {...handlers} />;\n }\n return <FindTimeState edited={source.edited} onClose={handlers.onClose} />;\n}\n\n/** The frame's header. */\nfunction FindTimeHeader({ subtitle }: { subtitle?: string }) {\n const { tr } = useCalendarPage();\n return (\n <TabbedDialogHeader\n icon={\n <IconTile size=\"sm\" aria-hidden=\"true\">\n <Users />\n </IconTile>\n }\n title={tr('calendar.v2.findTime', 'Find a time')}\n description={subtitle}\n closeLabel={tr('calendar.v2.close', 'Close')}\n />\n );\n}\n\n/** While the event to move loads, or when it can't be read. */\nfunction FindTimeState({ edited, onClose }: { edited: EditedEvent; onClose: () => void }) {\n const { tr } = useCalendarPage();\n let body = (\n <div className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.openingEvent', 'Opening the event…')}\n </div>\n );\n if (edited.status === 'missing') {\n body = (\n <div className=\"flex max-w-sm flex-col gap-2\">\n <b className=\"text-base text-text-primary\">\n {tr('calendar.v2.peekMissing', 'This event isn’t available')}\n </b>\n <p className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.actionGone', 'It may have been deleted or moved by someone else.')}\n </p>\n </div>\n );\n } else if (edited.status === 'error') {\n body = (\n <div className=\"flex max-w-sm flex-col items-center gap-3\">\n <b className=\"text-base text-text-primary\">\n {tr('calendar.v2.peekFailed', 'Couldn’t open the event')}\n </b>\n <Button type=\"button\" variant=\"outline\" onClick={edited.retry}>\n {tr('calendar.v2.tryAgain', 'Try again')}\n </Button>\n </div>\n );\n }\n return (\n <TabbedDialog open onOpenChange={(open) => (open ? undefined : onClose())}>\n <TabbedDialogContent size=\"viewer\" className=\"sm:max-w-[760px]\" aria-describedby={undefined}>\n <FindTimeHeader />\n <div className=\"grid min-h-0 flex-1 place-items-center p-6 text-center\">{body}</div>\n <TabbedDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tr('calendar.v2.close', 'Close')}\n </Button>\n </TabbedDialogFooter>\n </TabbedDialogContent>\n </TabbedDialog>\n );\n}\n\n/** What the dialog has read about everyone's time over the searched week. */\ninterface FindTimeData {\n participants: Participant[];\n /** A participant's busy time; null when it can't be known (someone outside the workspace). */\n busyOf: (participant: Participant) => BusySpan[] | null;\n room: FindTimeRoom | null;\n /** The person's working hours on a day; null for a day off or while they load. */\n hoursOn: (date: DateValue) => DayHours | null;\n status: 'loading' | 'ready' | 'error';\n retry: () => void;\n /** People whose free/busy may be missing some busy time. */\n truncated: Participant[];\n nameOf: (participant: Participant) => string;\n}\n\n/** The participants' user ids: the same array while they are the same people. */\nfunction useUserIds(participants: readonly Participant[]): string[] {\n const idsKey = participants\n .flatMap((person) => (person.userId ? [person.userId] : []))\n .join('\\n');\n return useMemo(() => (idsKey ? idsKey.split('\\n') : []), [idsKey]);\n}\n\n/** The people Find a time looks at, the person first, with their roles. */\nfunction useParticipants(basis: FindTimeBasis): Participant[] {\n const { tr, me } = useCalendarPage();\n const { currentUser } = useCalendar();\n const youName = currentUser?.name?.trim() || currentUser?.email || tr('calendar.v2.evYou', 'You');\n return participantsOf(basis, me, {\n you: `${youName} ${tr('calendar.v2.youSuffix', '(you)')}`,\n organiser: tr('calendar.v2.organiser', 'Organiser'),\n required: tr('calendar.v2.evRequired', 'Required'),\n optional: tr('calendar.v2.evOptional', 'Optional'),\n guest: tr('calendar.v2.guest', 'Guest'),\n });\n}\n\n/**\n * A participant's busy time from free/busy; null for someone with none to show (outside the\n * workspace). The event's own time doesn't count against its organiser and guests.\n */\nfunction busyReader(\n event: CalendarEventV2 | null,\n me: string | null,\n identities: Identities,\n freeBusy: FreeBusyV2,\n timeZone: string\n): (participant: Participant) => BusySpan[] | null {\n const ownTime = event && !event.allDay ? { start: event.start, end: event.end } : null;\n const owners = new Set(\n (event?.guests ?? [])\n .filter((guest) => guest.response !== 'DECLINED')\n .map((guest) => guest.userId)\n );\n if (event) owners.add(event.organizerId);\n return (participant) => {\n const userId = participant.userId;\n const member =\n userId !== null &&\n (userId === me || identities.status !== 'ready' || identities.byUserId.has(userId));\n if (!member) return null;\n const answer = freeBusy.byUserId.get(userId);\n if (!answer) return [];\n return personBusySpans(answer, timeZone, owners.has(userId) ? ownTime : null);\n };\n}\n\n/**\n * Loading, ready, or failed: free/busy, who of the people is a member (anyone else has no\n * free/busy, which must never read as free), and the room's bookings when there is a room.\n */\nfunction loadStatus(\n freeBusy: FreeBusyV2,\n identities: Identities,\n rooms: RoomsForEvent,\n hasRoom: boolean\n): FindTimeData['status'] {\n if ([freeBusy.status, identities.status, rooms.status].includes('error')) return 'error';\n const peopleKnown = identities.status === 'ready' || identities.status === 'idle';\n const roomsReady = !hasRoom || rooms.status === 'ready';\n return freeBusy.status === 'ready' && peopleKnown && roomsReady ? 'ready' : 'loading';\n}\n\nfunction useFindTimeData(basis: FindTimeBasis, day: DateValue): FindTimeData {\n const { tr, timeZone, me } = useCalendarPage();\n const event = basis.kind === 'none' ? null : basis.event;\n const participants = useParticipants(basis);\n const userIds = useUserIds(participants);\n const identities = useIdentities(userIds);\n const range = daysToInstants(day, addDays(day, SEARCH_DAYS - 1), timeZone);\n const freeBusy = useFreeBusy(userIds, range.from, range.to);\n const roomId = roomIdOf(basis);\n const rooms = useRoomsForEvent(range.to, { skip: roomId === null });\n const room = findTimeRoomOf(\n roomId,\n rooms,\n bookedRoomNameOf(basis) ?? tr('calendar.v2.theRoom', 'The room'),\n range,\n event?.eventId ?? null\n );\n const myRules: readonly WorkingHoursV2[] | null =\n me && freeBusy.status === 'ready' ? (freeBusy.byUserId.get(me)?.workingHours ?? []) : null;\n return {\n participants,\n busyOf: busyReader(event, me, identities, freeBusy, timeZone),\n room,\n hoursOn: (date) => (myRules ? workingHoursOn(date, myRules, timeZone) : null),\n status: loadStatus(freeBusy, identities, rooms, roomId !== null),\n retry: () => {\n freeBusy.refetch();\n identities.retry();\n rooms.retry();\n },\n truncated: participants.filter(\n (person) => person.userId !== null && freeBusy.byUserId.get(person.userId)?.truncated\n ),\n nameOf: (participant) =>\n participant.userId && participant.userId !== me\n ? (identities.byUserId.get(participant.userId)?.name ?? participant.name)\n : participant.name,\n };\n}\n\n/** \"Priya is busy · Atlas is booked\". */\nfunction useClashWords(data: FindTimeData): (clashes: readonly string[]) => string {\n const { tr, me } = useCalendarPage();\n return (clashes) =>\n clashes\n .map((key) => {\n if (data.room && key === data.room.id) {\n return tr('calendar.v2.ftRoomBooked', '{{room}} is booked', { room: data.room.name });\n }\n if (me && key === `u:${me}`) return tr('calendar.v2.ftYouBusy', 'You’re busy');\n const person = data.participants.find((item) => item.key === key);\n const name = person ? data.nameOf(person) : key;\n return tr('calendar.v2.ftPersonBusy', '{{name}} is busy', {\n name: name.split(' ')[0] ?? name,\n });\n })\n .join(' · ');\n}\n\n/** \"1 h · 4 people and Atlas\". */\nfunction useSubtitle(data: FindTimeData, length: number): string {\n const { tr, durationWords } = useCalendarPage();\n const count = data.participants.length;\n const who =\n count === 1\n ? tr('calendar.v2.peopleOne', '1 person')\n : tr('calendar.v2.peopleMany', '{{count}} people', { count });\n return [\n formatDuration(length, durationWords),\n data.room\n ? tr('calendar.v2.ftWhoAndRoom', '{{who}} and {{room}}', { who, room: data.room.name })\n : who,\n ].join(' · ');\n}\n\nfunction FindTimeReady({ basis, onUse, onBack, onClose }: { basis: FindTimeBasis } & Handlers) {\n const page = useCalendarPage();\n const { tr, timeZone, me } = page;\n const [length, setLength] = useState(() => startLengthOf(basis));\n const [day, setDay] = useState<DateValue>(() => startDayOf(basis, timeZone, page.today));\n const [pick, setPick] = useState<{ date: DateValue; start: number } | null>(null);\n const data = useFindTimeData(basis, day);\n const clashWords = useClashWords(data);\n\n const people: FindTimePerson[] = data.participants.flatMap((person) => {\n const busy = data.busyOf(person);\n return busy === null ? [] : [{ id: person.key, required: person.required, busy }];\n });\n const suggestions: Suggestion[] =\n data.status === 'ready'\n ? suggestTimes({\n day,\n days: SEARCH_DAYS,\n timeZone,\n length,\n now: page.now,\n step: STEP,\n workingHours: data.hoursOn,\n people,\n room: data.room,\n })\n : [];\n const first = suggestions[0];\n const chosen = pick ?? (first ? { date: first.date, start: first.start } : null);\n\n // The picked time's clashes (a time picked on the timeline needn't be a suggestion).\n const pickStart = chosen ? zonedTimeToInstant(chosen.date, chosen.start, timeZone) : null;\n const pickClashes = pickStart\n ? clashesAt(people, data.room, pickStart, new Date(pickStart.getTime() + length * 60_000))\n .clashes\n : [];\n\n const event = basis.kind === 'event' ? basis.event : null;\n const moving =\n event !== null && movesDirectly(event, page.calendarsById.get(event.calendarId), me, timeZone);\n const subtitle = useSubtitle(data, length);\n const leave = () => (onBack ? onBack() : onClose());\n\n return (\n <TabbedDialog open onOpenChange={(open) => (open ? undefined : leave())}>\n <TabbedDialogContent size=\"viewer\" className=\"sm:max-w-[760px]\" aria-describedby={undefined}>\n <FindTimeHeader subtitle={subtitle} />\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain p-5\">\n <div className=\"flex flex-col gap-5\">\n <FindTimeControls\n length={length}\n onLength={(next) => {\n setLength(next);\n setPick(null);\n }}\n day={day}\n onDay={(next) => {\n setDay(next);\n setPick(null);\n }}\n />\n <SuggestionCards\n data={data}\n suggestions={suggestions}\n chosen={chosen}\n onPick={setPick}\n day={day}\n clashWords={clashWords}\n />\n <FindTimeTimeline\n data={data}\n day={day}\n length={length}\n chosen={chosen}\n onPick={(start) => setPick({ date: day, start })}\n />\n </div>\n </div>\n <TabbedDialogFooter className=\"gap-2\">\n <PickSummary\n chosen={chosen}\n length={length}\n ready={data.status === 'ready'}\n clashes={pickClashes}\n clashWords={clashWords}\n />\n <Button type=\"button\" variant=\"outline\" onClick={leave}>\n {onBack ? tr('calendar.v2.ftBack', 'Back') : tr('calendar.v2.evCancel', 'Cancel')}\n </Button>\n <Button\n type=\"button\"\n disabled={!chosen || data.status !== 'ready'}\n onClick={() => (chosen ? onUse({ ...chosen, length }, basis) : undefined)}\n >\n {moving\n ? tr('calendar.v2.ftMoveHere', 'Move the event here')\n : tr('calendar.v2.ftUse', 'Use this time')}\n </Button>\n </TabbedDialogFooter>\n </TabbedDialogContent>\n </TabbedDialog>\n );\n}\n\n/** Length and day. */\nfunction FindTimeControls({\n length,\n onLength,\n day,\n onDay,\n}: {\n length: number;\n onLength: (minutes: number) => void;\n day: DateValue;\n onDay: (day: DateValue) => void;\n}) {\n const page = useCalendarPage();\n const { tr, format, today } = page;\n const lengths = [...new Set([...LENGTH_CHIPS, length])].sort((a, b) => a - b);\n return (\n <div className=\"flex flex-wrap items-end gap-x-6 gap-y-3\">\n {/* Full width on phones, where the chips fill the row (fe-libs' Segmented). */}\n <div className=\"flex flex-col gap-1.5 max-md:w-full\">\n <span id=\"calendar-ft-length\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.evLength', 'Length')}\n </span>\n <Segmented<string>\n aria-labelledby=\"calendar-ft-length\"\n value={String(length)}\n onValueChange={(value) => onLength(Number(value))}\n options={lengths.map((minutes) => ({\n value: String(minutes),\n label: formatDuration(minutes, page.durationWords),\n }))}\n />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <span id=\"calendar-ft-day\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.day', 'Day')}\n </span>\n <div className=\"flex items-center gap-1.5\" role=\"group\" aria-labelledby=\"calendar-ft-day\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={tr('calendar.v2.ftPrevDay', 'Previous day')}\n disabled={day <= today}\n onClick={() => onDay(addDays(day, -1))}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </Button>\n <DatePicker\n value={day}\n onChange={onDay}\n label={tr('calendar.v2.day', 'Day')}\n weekStartsOn={page.prefs.weekStart}\n locale={format.locale}\n timeZone={page.timeZone}\n min={today}\n format={{ weekday: 'long', day: 'numeric', month: 'short' }}\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={tr('calendar.v2.ftNextDay', 'Next day')}\n onClick={() => onDay(addDays(day, 1))}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/** One suggested time, as a radio card. */\nfunction SuggestionCard({\n suggestion,\n checked,\n onPick,\n clashWords,\n}: {\n suggestion: Suggestion;\n checked: boolean;\n onPick: () => void;\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr, format, timeZone } = useCalendarPage();\n return (\n <button\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n onClick={onPick}\n className={cn(\n 'flex min-w-0 flex-col gap-1 rounded-card border p-3 text-start motion-safe:transition-colors',\n checked\n ? 'border-action-primary-bg bg-accent-soft shadow-[inset_0_0_0_1px_var(--color-action-primary-bg)]'\n : 'border-border-default bg-bg-surface hover:border-border-strong',\n FOCUS_RING\n )}\n >\n <b className=\"text-sm font-semibold text-text-primary\">\n {formatDay(suggestion.date, format, 'short')} ·{' '}\n {formatMinuteRange(\n suggestion.start,\n instantToZoned(suggestion.endAt, timeZone).minutes,\n format\n )}\n </b>\n {suggestion.clashes.length === 0 ? (\n <span className=\"inline-flex items-center gap-1 text-xs font-semibold text-status-success-text\">\n <CircleCheck className=\"size-3.5\" aria-hidden=\"true\" />\n {tr('calendar.v2.ftEveryoneFree', 'Everyone’s free')}\n </span>\n ) : (\n <span className=\"inline-flex items-start gap-1 text-xs font-semibold text-status-warning-text\">\n <AlertTriangle className=\"mt-px size-3.5 shrink-0\" aria-hidden=\"true\" />\n {clashWords(suggestion.clashes)}\n </span>\n )}\n </button>\n );\n}\n\n/** The suggested times, or why there are none yet. */\nfunction SuggestionList({\n data,\n suggestions,\n chosen,\n onPick,\n clashWords,\n}: {\n data: FindTimeData;\n suggestions: readonly Suggestion[];\n chosen: { date: DateValue; start: number } | null;\n onPick: (pick: { date: DateValue; start: number }) => void;\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr } = useCalendarPage();\n if (data.status === 'error') {\n return (\n <Notice\n tone=\"bad\"\n action={\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={data.retry}>\n {tr('calendar.v2.tryAgain', 'Try again')}\n </Button>\n }\n >\n {tr(\n 'calendar.v2.evFreeBusyFailed',\n 'Couldn’t check who’s free. That isn’t the same as free.'\n )}\n </Notice>\n );\n }\n if (data.status === 'loading') {\n return (\n <p className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.ftLooking', 'Looking at everyone’s time…')}\n </p>\n );\n }\n if (suggestions.length === 0) {\n return (\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'calendar.v2.ftNothing',\n 'No time in your working hours this week. Try a shorter length or another day.'\n )}\n </p>\n );\n }\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby=\"calendar-ft-suggested\"\n className=\"grid gap-2 sm:grid-cols-3\"\n >\n {suggestions.map((suggestion) => (\n <SuggestionCard\n key={`${suggestion.date}|${suggestion.start}`}\n suggestion={suggestion}\n checked={chosen?.date === suggestion.date && chosen.start === suggestion.start}\n onPick={() => onPick({ date: suggestion.date, start: suggestion.start })}\n clashWords={clashWords}\n />\n ))}\n </div>\n );\n}\n\n/** \"Suggested times\", the list, and the notes under it. */\nfunction SuggestionCards({\n data,\n suggestions,\n chosen,\n onPick,\n day,\n clashWords,\n}: {\n data: FindTimeData;\n suggestions: readonly Suggestion[];\n chosen: { date: DateValue; start: number } | null;\n onPick: (pick: { date: DateValue; start: number }) => void;\n day: DateValue;\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr, format } = useCalendarPage();\n const firstFree = suggestions.find((item) => item.clashes.length === 0);\n const outsiders = data.participants.filter((person) => data.busyOf(person) === null);\n return (\n <div className=\"flex flex-col gap-2\">\n <span id=\"calendar-ft-suggested\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.ftSuggested', 'Suggested times')}\n </span>\n <SuggestionList\n data={data}\n suggestions={suggestions}\n chosen={chosen}\n onPick={onPick}\n clashWords={clashWords}\n />\n {firstFree && firstFree.date !== day ? (\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'calendar.v2.ftLaterDays',\n 'Nothing on {{day}} works for everyone; the first such times are on later days.',\n { day: formatDay(day, format, 'short') }\n )}\n </p>\n ) : null}\n {outsiders.length > 0 ? (\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'calendar.v2.ftOutsiders',\n 'Not counted: {{names}}. People outside the workspace have no free/busy to show.',\n { names: outsiders.map((person) => person.name).join(', ') }\n )}\n </p>\n ) : null}\n {data.truncated.length > 0 ? (\n <p className=\"text-xs text-status-warning-text\">\n {tr(\n 'calendar.v2.ftTruncated',\n 'Some busy time couldn’t all be read for {{names}}: check with them.',\n { names: data.truncated.map((person) => data.nameOf(person)).join(', ') }\n )}\n </p>\n ) : null}\n </div>\n );\n}\n\n/** What a busy block on the timeline says. */\nfunction useBlockWord(): (kind: BusySpan['kind']) => string {\n const { tr } = useCalendarPage();\n return (kind) => {\n switch (kind) {\n case 'away':\n return tr('calendar.v2.evAway', 'Away');\n case 'closed':\n return tr('calendar.v2.roomPaused', 'Closed');\n case 'booked':\n return tr('calendar.v2.ftBooked', 'Booked');\n default:\n return tr('calendar.v2.busy', 'Busy');\n }\n };\n}\n\nconst STRIPES =\n 'bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,var(--color-border-subtle)_6px_9px)]';\n\nconst BLOCK_LOOK: Readonly<Record<BusySpan['kind'], string>> = {\n tentative: 'border-dashed border-border-strong bg-bg-sunken text-text-secondary',\n busy: 'border-border-strong bg-bg-sunken text-text-primary',\n booked: 'border-border-strong bg-bg-sunken text-text-primary',\n away: cn('border-border-strong text-text-secondary', STRIPES),\n closed: cn('border-border-strong text-text-secondary', STRIPES),\n};\n\ninterface TimelineGeometry {\n day: DateValue;\n window: { start: number; end: number };\n /** Where a minute of the day sits across the bar, in percent. */\n pct: (minute: number) => number;\n}\n\n/** One row's bar: off hours striped, busy blocks, the now line and the pick. */\nfunction TimelineBar({\n row,\n spans,\n geometry,\n off,\n chosen,\n length,\n}: {\n /** Its grid row (the slider lies over the bars, so every cell is placed). */\n row: number;\n spans: BusySpan[] | null;\n geometry: TimelineGeometry;\n off: readonly { start: number; end: number }[];\n chosen: { date: DateValue; start: number } | null;\n length: number;\n}) {\n const page = useCalendarPage();\n const { tr, timeZone } = page;\n const blockWord = useBlockWord();\n const { day, window, pct } = geometry;\n const place = (start: number, end: number) => ({\n insetInlineStart: `${pct(start)}%`,\n width: `${pct(end) - pct(start)}%`,\n });\n const blocks = spans\n ? blocksOnDay(spans, day, timeZone).filter(\n (block) => block.end > window.start && block.start < window.end\n )\n : [];\n const showNow =\n day === page.today && page.nowMinute > window.start && page.nowMinute < window.end;\n return (\n <div\n className=\"relative col-start-2 min-h-11 border-b border-border-subtle\"\n style={{ gridRow: row }}\n >\n {off.map((part) => (\n <i\n key={`${part.start}-${part.end}`}\n aria-hidden=\"true\"\n className=\"absolute inset-y-0 bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,transparent_6px_10px)]\"\n style={place(part.start, part.end)}\n />\n ))}\n {spans === null ? (\n <span className=\"absolute inset-0 grid place-items-center text-xs text-text-secondary\">\n {tr('calendar.v2.evNoFreeBusy', 'No free/busy')}\n </span>\n ) : null}\n {blocks.map((block) => (\n <i\n key={`${block.start}-${block.end}-${block.kind}`}\n aria-hidden=\"true\"\n className={cn(\n 'absolute inset-y-2 overflow-hidden rounded-md border px-1 text-[11px] leading-6 not-italic',\n BLOCK_LOOK[block.kind]\n )}\n style={place(block.start, block.end)}\n >\n {blockWord(block.kind)}\n </i>\n ))}\n {showNow ? (\n <i\n aria-hidden=\"true\"\n className=\"absolute inset-y-0 w-0.5 bg-action-primary-bg\"\n style={{ insetInlineStart: `${pct(page.nowMinute)}%` }}\n />\n ) : null}\n {chosen?.date === day ? (\n <i\n aria-hidden=\"true\"\n 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)]\"\n style={place(chosen.start, pickEndClock({ ...chosen, length }, timeZone))}\n />\n ) : null}\n </div>\n );\n}\n\n/** A timeline row's name: an avatar (or a room tile), the name and the role. */\nfunction TimelineName({\n row,\n name,\n role,\n room,\n}: {\n row: number;\n name: string;\n role: string;\n room: boolean;\n}) {\n return (\n <div\n className=\"col-start-1 flex min-w-0 items-center gap-2 border-b border-border-subtle px-3 py-2\"\n style={{ gridRow: row }}\n >\n {room ? (\n <span className=\"grid size-6 shrink-0 place-items-center rounded-md bg-bg-sunken text-text-secondary\">\n <Building2 className=\"size-3.5\" aria-hidden=\"true\" />\n </span>\n ) : (\n <EntityAvatar name={name} size={24} />\n )}\n <span className=\"min-w-0\">\n <b className=\"block truncate text-xs font-semibold text-text-primary\">{name}</b>\n <small className=\"block truncate text-[11px] text-text-secondary\">{role}</small>\n </span>\n </div>\n );\n}\n\n/** The minute a timeline key moves the pick to; null for a key it doesn't take. */\nfunction keyedMinute(\n key: string,\n rtl: boolean,\n value: number,\n window: { start: number; end: number },\n last: number\n): number | null {\n const steps: Readonly<Record<string, number>> = {\n ArrowRight: rtl ? -KEY_STEP : KEY_STEP,\n ArrowLeft: rtl ? KEY_STEP : -KEY_STEP,\n ArrowUp: KEY_STEP,\n ArrowDown: -KEY_STEP,\n PageUp: 60,\n PageDown: -60,\n };\n if (key === 'Home') return window.start;\n if (key === 'End') return last;\n const step = steps[key];\n return step === undefined ? null : Math.max(window.start, Math.min(value + step, last));\n}\n\n/**\n * The day's timeline: a row per person and for the room. Over the bars lies a slider: a click\n * picks the quarter hour under the pointer; the arrow keys move the pick 15 minutes, Page Up and\n * Page Down an hour, Home and End to the ends of the day shown.\n */\nfunction FindTimeTimeline({\n data,\n day,\n length,\n chosen,\n onPick,\n}: {\n data: FindTimeData;\n day: DateValue;\n length: number;\n chosen: { date: DateValue; start: number } | null;\n onPick: (start: number) => void;\n}) {\n const { tr, format, timeZone } = useCalendarPage();\n // No time is picked before everyone's busy time is in hand: it would read as free.\n const ready = data.status === 'ready';\n const hours = data.hoursOn(day);\n const window = timelineWindow(hours);\n const geometry: TimelineGeometry = {\n day,\n window,\n pct: (minute) =>\n ((Math.min(Math.max(minute, window.start), window.end) - window.start) /\n (window.end - window.start)) *\n 100,\n };\n const off = offHours(hours).filter((part) => part.end > window.start && part.start < window.end);\n const last = window.end - length;\n const value = chosen?.date === day ? chosen.start : (hours?.start ?? window.start);\n // Hours inside the window: a label at either edge would hang outside it.\n const hourMarks: number[] = [];\n for (let hour = Math.floor(window.start / 60) + 1; hour * 60 < window.end; hour += 1) {\n hourMarks.push(hour);\n }\n const rows = data.participants.map((person) => ({\n key: person.key,\n name: data.nameOf(person),\n role: person.role,\n room: false,\n spans: data.busyOf(person),\n }));\n if (data.room) {\n rows.push({\n key: data.room.id,\n name: data.room.name,\n role: tr('calendar.v2.ftRoom', 'Room'),\n room: true,\n spans: data.room.busy,\n });\n }\n const onClick = (click: MouseEvent<HTMLDivElement>) => {\n const box = click.currentTarget.getBoundingClientRect();\n if (!ready || box.width <= 0) return;\n const rtl = getComputedStyle(click.currentTarget).direction === 'rtl';\n const fraction = (rtl ? box.right - click.clientX : click.clientX - box.left) / box.width;\n onPick(minuteAt(fraction, window, length));\n };\n const onKeyDown = (key: KeyboardEvent<HTMLDivElement>) => {\n const rtl = getComputedStyle(key.currentTarget).direction === 'rtl';\n const next = ready ? keyedMinute(key.key, rtl, value, window, last) : null;\n if (next === null) return;\n key.preventDefault();\n onPick(next);\n };\n return (\n <div className=\"flex flex-col gap-2\">\n <span id=\"calendar-ft-timeline\" className=\"text-sm font-semibold text-text-primary\">\n {formatDay(day, format, 'mid')} · {formatMinuteRange(window.start, window.end, format)}\n </span>\n <div className=\"overflow-x-auto rounded-card border border-border-default bg-bg-surface\">\n <div className=\"grid min-w-[560px] grid-cols-[minmax(120px,160px)_minmax(0,1fr)]\">\n <span className=\"col-start-1 row-start-1 border-b border-border-subtle\" />\n <div\n className=\"relative col-start-2 row-start-1 h-6 border-b border-border-subtle\"\n aria-hidden=\"true\"\n >\n {hourMarks.map((hour) => (\n <span\n key={hour}\n className=\"absolute top-1 -translate-x-1/2 text-[11px] text-text-muted rtl:translate-x-1/2\"\n style={{ insetInlineStart: `${geometry.pct(hour * 60)}%` }}\n >\n {formatMinutes(hour * 60, format)}\n </span>\n ))}\n </div>\n {rows.map((row, index) => (\n <Fragment key={row.key}>\n <TimelineName row={index + 2} name={row.name} role={row.role} room={row.room} />\n <TimelineBar\n row={index + 2}\n spans={row.spans}\n geometry={geometry}\n off={off}\n chosen={chosen}\n length={length}\n />\n </Fragment>\n ))}\n <div\n role=\"slider\"\n tabIndex={0}\n aria-labelledby=\"calendar-ft-timeline\"\n aria-valuemin={window.start}\n aria-valuemax={last}\n aria-valuenow={value}\n aria-valuetext={formatMinuteRange(\n value,\n pickEndClock({ date: day, start: value, length }, timeZone),\n format\n )}\n aria-disabled={ready ? undefined : true}\n onClick={onClick}\n onKeyDown={onKeyDown}\n className={cn(\n 'relative z-10 col-start-2 rounded-md',\n ready ? 'cursor-pointer' : 'cursor-progress',\n FOCUS_RING\n )}\n style={{ gridRow: `2 / span ${rows.length}` }}\n />\n </div>\n </div>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'calendar.v2.ftTimelineHint',\n 'Click a free spot, or use the arrow keys, to pick a time. Striped: outside your working hours.'\n )}\n </p>\n </div>\n );\n}\n\n/** The footer's words: the picked time and who can't make it. */\nfunction PickSummary({\n chosen,\n length,\n ready,\n clashes,\n clashWords,\n}: {\n chosen: { date: DateValue; start: number } | null;\n length: number;\n /** Everyone's busy time (and the room's) is in hand; until then nothing is called free. */\n ready: boolean;\n clashes: readonly string[];\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr, format, timeZone } = useCalendarPage();\n if (!chosen) {\n return (\n <span className=\"min-w-0 flex-1 text-xs text-text-secondary max-sm:basis-full\">\n {tr('calendar.v2.ftPick', 'Pick a time')}\n </span>\n );\n }\n let verdict = (\n <span className=\"text-text-secondary\">\n {tr('calendar.v2.ftCheckingFree', 'Checking who’s free…')}\n </span>\n );\n if (ready && clashes.length === 0) {\n verdict = (\n <span className=\"font-semibold text-status-success-text\">\n {tr('calendar.v2.ftEveryoneFree', 'Everyone’s free')}\n </span>\n );\n } else if (ready) {\n verdict = <span className=\"font-semibold text-status-warning-text\">{clashWords(clashes)}</span>;\n }\n return (\n <span className=\"min-w-0 flex-1 text-xs max-sm:basis-full\">\n <span className=\"text-text-secondary\">\n {formatDay(chosen.date, format, 'short')} ·{' '}\n {formatMinuteRange(chosen.start, pickEndClock({ ...chosen, length }, timeZone), format)}{' '}\n ·{' '}\n </span>\n {verdict}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4FA,IAAMA,IAAc,GAEdC,IAAO,IAEPC,IAAW;AAUjB,SAAgBC,GAAe,EAAE,WAAQ,GAAGC,KAAmD;CAC7F,IAAIC,EAAO,SAAS,QAAQ;EAC1B,IAAMC,IAAuB;GAAE,MAAM;GAAQ,MAAMD,EAAO,QAAQ;GAAM,OAAOA,EAAO;EAAM;EAC5F,OAAO,kBAACE,GAAD;GAAsB;GAAO,GAAIH;EAAW,CAAA;CACrD;CACA,IAAIC,EAAO,SAAS,QAAQ,OAAO,kBAACE,GAAD;EAAe,OAAO,EAAE,MAAM,OAAO;EAAG,GAAIH;CAAW,CAAA;CAC1F,IAAIC,EAAO,OAAO,WAAW,SAAS;EAEpC,IAAMG,IAAQH,EAAO,OAAO;EAC5B,OAAO,kBAACE,GAAD;GAA8B,OAAO;IAAE,MAAM;IAAS;GAAM;GAAG,GAAIH;EAAW,GAA1DI,EAAM,EAAoD;CACvF;CACA,OAAO,kBAACC,IAAD;EAAe,QAAQJ,EAAO;EAAQ,SAASD,EAAS;CAAU,CAAA;AAC3E;AAGA,SAASM,EAAe,EAAE,eAAmC;CAC3D,IAAM,EAAE,UAAOC,EAAgB;CAC/B,OACE,kBAACC,GAAD;EACE,MACE,kBAACC,IAAD;GAAU,MAAK;GAAK,eAAY;GAC9B,UAAA,kBAACC,GAAD,CAAQ,CAAA;EAC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IACF,kBAAC,QAAD;EAAM,WAAU;EACb,UAAAzK,EAAG,8BAA8B,sBAAsB;CACpD,CAAA;CAWR,OATI0J,KAASnG,EAAQ,WAAW,IAC9B,IACE,kBAAC,QAAD;EAAM,WAAU;EACb,UAAAvD,EAAG,8BAA8B,iBAAiB;CAC/C,CAAA,IAEC0J,MACT,IAAU,kBAAC,QAAD;EAAM,WAAU;EAA0C,UAAAhF,EAAWnB,CAAO;CAAQ,CAAA,IAG9F,kBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CACE,kBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA;IACG2D,EAAUlC,EAAO,MAAM2B,GAAQ,OAAO;IAAE;IAAG;IAC3CS,EAAkBpC,EAAO,OAAOgE,EAAa;KAAE,GAAGhE;KAAQ;IAAO,GAAGjD,CAAQ,GAAG4E,CAAM;IAAG;IAAI;IAC3F;GACE;EACL,CAAA,GAAA8D,CACG;;AAEV"}
@@ -10,21 +10,24 @@ import { DropdownMenu as _, DropdownMenuContent as v, DropdownMenuRadioGroup as
10
10
  import { cn as C } from "@burdenoff/fe-libs/utils";
11
11
  // src/v2/event/RepeatField.tsx
12
12
  function w({ model: w }) {
13
- let { tr: T, format: E } = e(), { form: D, update: O, event: k } = w, A = n(D), j = k !== null && !k.isRecurring, M = w.readOnly || j, N = r(D), P = u(D, T, E), F = j ? "calendar-event-repeat-note" : void 0;
13
+ let { tr: T, format: E } = e(), { form: D, update: O, event: k } = w, A = n(D), j = k !== null && !k.isRecurring, M = w.scope === "this", N = w.readOnly || j || M, P = r(D), F = u(D, T, E), I = (j || M) && !w.readOnly ? "calendar-event-repeat-note" : void 0;
14
14
  return /* @__PURE__ */ h(i, {
15
15
  label: T("calendar.v2.evRepeat", "Repeat"),
16
16
  labelId: "calendar-event-repeat-label",
17
- hint: j && !w.readOnly ? /* @__PURE__ */ h(a, {
18
- id: F,
17
+ hint: I && j ? /* @__PURE__ */ h(a, {
18
+ id: I,
19
19
  children: T("calendar.v2.rrLockedSingle", "An existing event can’t start repeating yet. Make a new repeating event instead.")
20
+ }) : I ? /* @__PURE__ */ h(a, {
21
+ id: I,
22
+ children: T("calendar.v2.rrLockedDate", "The repeat belongs to the series. To change it, pick This and later events or Every event below.")
20
23
  }) : void 0,
21
24
  children: /* @__PURE__ */ g(_, { children: [/* @__PURE__ */ h(S, {
22
25
  asChild: !0,
23
- disabled: M,
26
+ disabled: N,
24
27
  children: /* @__PURE__ */ g("button", {
25
28
  type: "button",
26
29
  "aria-labelledby": "calendar-event-repeat-label calendar-event-repeat-value",
27
- "aria-describedby": F,
30
+ "aria-describedby": I,
28
31
  className: C("flex h-10 w-full items-center gap-2 rounded-input border border-border-default bg-bg-surface px-3 text-start text-sm text-text-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-60", t),
29
32
  children: [
30
33
  /* @__PURE__ */ h(m, {
@@ -34,7 +37,7 @@ function w({ model: w }) {
34
37
  /* @__PURE__ */ h("span", {
35
38
  id: "calendar-event-repeat-value",
36
39
  className: "min-w-0 flex-1 truncate",
37
- children: P
40
+ children: F
38
41
  }),
39
42
  /* @__PURE__ */ h(p, {
40
43
  className: "size-4 shrink-0 text-text-muted",
@@ -76,7 +79,7 @@ function w({ model: w }) {
76
79
  /* @__PURE__ */ h(x, {}),
77
80
  /* @__PURE__ */ h(b, {
78
81
  value: "custom",
79
- children: D.repeat.kind === "custom" && N ? o(N, A, T, E) : T("calendar.v2.rrCustom", "Custom…")
82
+ children: D.repeat.kind === "custom" && P ? o(P, A, T, E) : T("calendar.v2.rrCustom", "Custom…")
80
83
  })
81
84
  ]
82
85
  })
@@ -1 +1 @@
1
- {"version":3,"file":"RepeatField.js","names":["RepeatField","useCalendarPage","model","anchor","anchorOf","form","existingSingle","event","locked","rule","repeatRuleOf","label","repeatLabel","tr","format","noteId","Field","SoonNote","DropdownMenu","DropdownMenuTrigger","cn","FOCUS_RING","Repeat","ChevronDown","DropdownMenuContent","DropdownMenuRadioGroup","menuValueOf","isMenuValue","value","update","current","repeatFor","DropdownMenuRadioItem","presetsFor","preset","describeRule","presetRule","DropdownMenuSeparator"],"sources":["../../../src/v2/event/RepeatField.tsx"],"sourcesContent":["/**\n * Repeat (BOFF-15698 A2): the menu (doesn't repeat, daily, weekly on the day, monthly on the\n * nth or last weekday, yearly, every weekday, Custom…). The Custom builder is `CustomRepeat`;\n * the rule is written by `rrule.ts`.\n *\n * The API can't turn an existing event into a series or a series back into one event\n * (`UpdateEventInput` has no `isRecurring`, B7): an existing event that doesn't repeat keeps\n * the menu locked, and a series can change its rule but not stop repeating.\n */\nimport { ChevronDown, Repeat } from 'lucide-react';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '@burdenoff/fe-libs/ui';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { FOCUS_RING } from '../styles';\nimport type { EventDialogModel } from './dialogModel';\nimport { anchorOf, repeatRuleOf } from './eventForm';\nimport { Field, SoonNote } from './parts';\nimport { describeRule, isMenuValue, menuValueOf, repeatFor, repeatLabel } from './repeatWords';\nimport { presetRule, presetsFor } from './rrule';\n\n/** The Repeat menu. */\nexport function RepeatField({ model }: { model: EventDialogModel }) {\n const page = useCalendarPage();\n const { tr, format } = page;\n const { form, update, event } = model;\n const anchor = anchorOf(form);\n const existingSingle = event !== null && !event.isRecurring;\n const locked = model.readOnly || existingSingle;\n const rule = repeatRuleOf(form);\n const label = repeatLabel(form, tr, format);\n const noteId = existingSingle ? 'calendar-event-repeat-note' : undefined;\n return (\n <Field\n label={tr('calendar.v2.evRepeat', 'Repeat')}\n labelId=\"calendar-event-repeat-label\"\n hint={\n existingSingle && !model.readOnly ? (\n <SoonNote id={noteId}>\n {tr(\n 'calendar.v2.rrLockedSingle',\n 'An existing event can’t start repeating yet. Make a new repeating event instead.'\n )}\n </SoonNote>\n ) : undefined\n }\n >\n <DropdownMenu>\n <DropdownMenuTrigger asChild disabled={locked}>\n <button\n type=\"button\"\n aria-labelledby=\"calendar-event-repeat-label calendar-event-repeat-value\"\n aria-describedby={noteId}\n className={cn(\n 'flex h-10 w-full items-center gap-2 rounded-input border border-border-default bg-bg-surface px-3 text-start text-sm text-text-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-60',\n FOCUS_RING\n )}\n >\n <Repeat className=\"size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n <span id=\"calendar-event-repeat-value\" className=\"min-w-0 flex-1 truncate\">\n {label}\n </span>\n <ChevronDown className=\"size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" className=\"w-[min(22rem,calc(100vw-2rem))]\">\n <DropdownMenuRadioGroup\n value={menuValueOf(form.repeat)}\n onValueChange={(value) => {\n if (isMenuValue(value)) {\n update((current) => ({ ...current, repeat: repeatFor(value, current) }));\n }\n }}\n >\n <DropdownMenuRadioItem value=\"none\" disabled={event?.isRecurring === true}>\n <span className=\"flex flex-col\">\n {tr('calendar.v2.rrNone', 'Doesn’t repeat')}\n {event?.isRecurring ? (\n <span className=\"text-xs text-text-secondary\">\n {tr('calendar.v2.rrCantStop', 'A series can’t stop repeating here yet.')}\n </span>\n ) : null}\n </span>\n </DropdownMenuRadioItem>\n {presetsFor(anchor).map((preset) => (\n <DropdownMenuRadioItem key={preset} value={preset}>\n {describeRule(presetRule(preset, anchor), anchor, tr, format)}\n </DropdownMenuRadioItem>\n ))}\n {form.repeat.kind === 'kept' ? (\n <DropdownMenuRadioItem value=\"kept\">\n {tr('calendar.v2.rrKept', 'A rule from another app (kept)')}\n </DropdownMenuRadioItem>\n ) : null}\n <DropdownMenuSeparator />\n <DropdownMenuRadioItem value=\"custom\">\n {form.repeat.kind === 'custom' && rule\n ? describeRule(rule, anchor, tr, format)\n : tr('calendar.v2.rrCustom', 'Custom…')}\n </DropdownMenuRadioItem>\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AACE,GAAD;MAAuB,OAAM;MAAO,UAAUzB,GAAO,gBAAgB;MACnE,UAAA,kBAAC,QAAD;OAAM,WAAU;OAAhB,UAAA,CACGM,EAAG,sBAAsB,gBAAgB,GACzCN,GAAO,cACN,kBAAC,QAAD;QAAM,WAAU;QACb,UAAAM,EAAG,0BAA0B,yCAAyC;OACnE,CAAA,IACJ,IACA;;KACe,CAAA;KACtBoB,EAAW9B,CAAM,CAAC,CAAC,KAAK,MACvB,kBAAC6B,GAAD;MAAoC,OAAOE;MACxC,UAAAC,EAAaC,EAAWF,GAAQ/B,CAAM,GAAGA,GAAQU,GAAIC,CAAM;KACvC,GAFKoB,CAEL,CACxB;KACA7B,EAAK,OAAO,SAAS,SACpB,kBAAC2B,GAAD;MAAuB,OAAM;MAC1B,UAAAnB,EAAG,sBAAsB,gCAAgC;KACrC,CAAA,IACrB;KACJ,kBAACwB,GAAD,CAAwB,CAAA;KACxB,kBAACL,GAAD;MAAuB,OAAM;MAC1B,UAAA3B,EAAK,OAAO,SAAS,YAAYI,IAC9B0B,EAAa1B,GAAMN,GAAQU,GAAIC,CAAM,IACrCD,EAAG,wBAAwB,SAAS;KACnB,CAAA;IACD;;EACL,CAAA,CACT,EAAA,CAAA;CACT,CAAA;AAEX"}
1
+ {"version":3,"file":"RepeatField.js","names":["RepeatField","useCalendarPage","model","anchor","anchorOf","form","existingSingle","event","oneDate","locked","rule","repeatRuleOf","label","repeatLabel","tr","format","noteId","Field","SoonNote","DropdownMenu","DropdownMenuTrigger","cn","FOCUS_RING","Repeat","ChevronDown","DropdownMenuContent","DropdownMenuRadioGroup","menuValueOf","isMenuValue","value","update","current","repeatFor","DropdownMenuRadioItem","presetsFor","preset","describeRule","presetRule","DropdownMenuSeparator"],"sources":["../../../src/v2/event/RepeatField.tsx"],"sourcesContent":["/**\n * Repeat (BOFF-15698 A2): the menu (doesn't repeat, daily, weekly on the day, monthly on the\n * nth or last weekday, yearly, every weekday, Custom…). The Custom builder is `CustomRepeat`;\n * the rule is written by `rrule.ts`.\n *\n * The API can't turn an existing event into a series or a series back into one event\n * (`UpdateEventInput` has no `isRecurring`, B7): an existing event that doesn't repeat keeps\n * the menu locked, and a series can change its rule but not stop repeating. One date of a series\n * changed on its own (\"This event\", A4) doesn't repeat by itself: the menu shows the series'\n * rule, locked, while that is the answer.\n */\nimport { ChevronDown, Repeat } from 'lucide-react';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '@burdenoff/fe-libs/ui';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { FOCUS_RING } from '../styles';\nimport type { EventDialogModel } from './dialogModel';\nimport { anchorOf, repeatRuleOf } from './eventForm';\nimport { Field, SoonNote } from './parts';\nimport { describeRule, isMenuValue, menuValueOf, repeatFor, repeatLabel } from './repeatWords';\nimport { presetRule, presetsFor } from './rrule';\n\n/** The Repeat menu. */\nexport function RepeatField({ model }: { model: EventDialogModel }) {\n const page = useCalendarPage();\n const { tr, format } = page;\n const { form, update, event } = model;\n const anchor = anchorOf(form);\n const existingSingle = event !== null && !event.isRecurring;\n const oneDate = model.scope === 'this';\n const locked = model.readOnly || existingSingle || oneDate;\n const rule = repeatRuleOf(form);\n const label = repeatLabel(form, tr, format);\n const noteId =\n (existingSingle || oneDate) && !model.readOnly ? 'calendar-event-repeat-note' : undefined;\n return (\n <Field\n label={tr('calendar.v2.evRepeat', 'Repeat')}\n labelId=\"calendar-event-repeat-label\"\n hint={\n noteId && existingSingle ? (\n <SoonNote id={noteId}>\n {tr(\n 'calendar.v2.rrLockedSingle',\n 'An existing event can’t start repeating yet. Make a new repeating event instead.'\n )}\n </SoonNote>\n ) : noteId ? (\n <SoonNote id={noteId}>\n {tr(\n 'calendar.v2.rrLockedDate',\n 'The repeat belongs to the series. To change it, pick This and later events or Every event below.'\n )}\n </SoonNote>\n ) : undefined\n }\n >\n <DropdownMenu>\n <DropdownMenuTrigger asChild disabled={locked}>\n <button\n type=\"button\"\n aria-labelledby=\"calendar-event-repeat-label calendar-event-repeat-value\"\n aria-describedby={noteId}\n className={cn(\n 'flex h-10 w-full items-center gap-2 rounded-input border border-border-default bg-bg-surface px-3 text-start text-sm text-text-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-60',\n FOCUS_RING\n )}\n >\n <Repeat className=\"size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n <span id=\"calendar-event-repeat-value\" className=\"min-w-0 flex-1 truncate\">\n {label}\n </span>\n <ChevronDown className=\"size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" className=\"w-[min(22rem,calc(100vw-2rem))]\">\n <DropdownMenuRadioGroup\n value={menuValueOf(form.repeat)}\n onValueChange={(value) => {\n if (isMenuValue(value)) {\n update((current) => ({ ...current, repeat: repeatFor(value, current) }));\n }\n }}\n >\n <DropdownMenuRadioItem value=\"none\" disabled={event?.isRecurring === true}>\n <span className=\"flex flex-col\">\n {tr('calendar.v2.rrNone', 'Doesn’t repeat')}\n {event?.isRecurring ? (\n <span className=\"text-xs text-text-secondary\">\n {tr('calendar.v2.rrCantStop', 'A series can’t stop repeating here yet.')}\n </span>\n ) : null}\n </span>\n </DropdownMenuRadioItem>\n {presetsFor(anchor).map((preset) => (\n <DropdownMenuRadioItem key={preset} value={preset}>\n {describeRule(presetRule(preset, anchor), anchor, tr, format)}\n </DropdownMenuRadioItem>\n ))}\n {form.repeat.kind === 'kept' ? (\n <DropdownMenuRadioItem value=\"kept\">\n {tr('calendar.v2.rrKept', 'A rule from another app (kept)')}\n </DropdownMenuRadioItem>\n ) : null}\n <DropdownMenuSeparator />\n <DropdownMenuRadioItem value=\"custom\">\n {form.repeat.kind === 'custom' && rule\n ? describeRule(rule, anchor, tr, format)\n : tr('calendar.v2.rrCustom', 'Custom…')}\n </DropdownMenuRad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,AAAIuB,EAAYC,CAAK,KACnBC,GAAQ,OAAa;MAAE,GAAGC;MAAS,QAAQC,EAAUH,GAAOE,CAAO;KAAE,EAAE;IAE3E;IANF,UAAA;KAQE,kBAACE,GAAD;MAAuB,OAAM;MAAO,UAAU1B,GAAO,gBAAgB;MACnE,UAAA,kBAAC,QAAD;OAAM,WAAU;OAAhB,UAAA,CACGO,EAAG,sBAAsB,gBAAgB,GACzCP,GAAO,cACN,kBAAC,QAAD;QAAM,WAAU;QACb,UAAAO,EAAG,0BAA0B,yCAAyC;OACnE,CAAA,IACJ,IACA;;KACe,CAAA;KACtBoB,EAAW/B,CAAM,CAAC,CAAC,KAAK,MACvB,kBAAC8B,GAAD;MAAoC,OAAOE;MACxC,UAAAC,EAAaC,EAAWF,GAAQhC,CAAM,GAAGA,GAAQW,GAAIC,CAAM;KACvC,GAFKoB,CAEL,CACxB;KACA9B,EAAK,OAAO,SAAS,SACpB,kBAAC4B,GAAD;MAAuB,OAAM;MAC1B,UAAAnB,EAAG,sBAAsB,gCAAgC;KACrC,CAAA,IACrB;KACJ,kBAACwB,GAAD,CAAwB,CAAA;KACxB,kBAACL,GAAD;MAAuB,OAAM;MAC1B,UAAA5B,EAAK,OAAO,SAAS,YAAYK,IAC9B0B,EAAa1B,GAAMP,GAAQW,GAAIC,CAAM,IACrCD,EAAG,wBAAwB,SAAS;KACnB,CAAA;IACD;;EACL,CAAA,CACT,EAAA,CAAA;CACT,CAAA;AAEX"}
@@ -75,6 +75,16 @@ export declare function readBackOf(edited: {
75
75
  status: 'ready';
76
76
  }>['refresh'];
77
77
  }): ReadBack | null;
78
+ /**
79
+ * What the person's changes are told from (A4): the form as the dialog opened, or once a save
80
+ * stopped part way (`partlySaved`), the event as read back, which holds what saved. Told from
81
+ * the form as it opened, Save again would move a series (or the later part of one) a second
82
+ * time, and take a repeat or room that didn't save for one that did.
83
+ */
84
+ export declare function baselineOf(session: {
85
+ initial: EventForm;
86
+ partlySaved: boolean;
87
+ }, edited: EditedEvent, timeZone: string): EventForm;
78
88
  /** The footer while the edited event is read back: reading, or it can't be. */
79
89
  export declare function reloadNote(readBack: ReadBack, tr: Tr): FooterNote;
80
90
  /** The part of a busy span inside the event, on the calendar's clock: "13:00 – 13:30". */