@rokoyfa/calendar 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +194 -3
  4. package/api/openapi.yaml +911 -0
  5. package/dist-lib/cdn/calendar-widget.js +14 -0
  6. package/dist-lib/cdn/calendar-widget.js.map +1 -0
  7. package/dist-lib/npm/index.d.ts +1 -0
  8. package/dist-lib/npm/index.js +13055 -0
  9. package/dist-lib/npm/index.js.map +1 -0
  10. package/dist-lib/npm/types/components/Button.d.ts +17 -0
  11. package/dist-lib/npm/types/components/ChoiceChip.d.ts +13 -0
  12. package/dist-lib/npm/types/components/ConfirmModal.d.ts +11 -0
  13. package/dist-lib/npm/types/components/DateTimeField.d.ts +14 -0
  14. package/dist-lib/npm/types/components/Form.d.ts +8 -0
  15. package/dist-lib/npm/types/components/FormField.d.ts +10 -0
  16. package/dist-lib/npm/types/components/IconButton.d.ts +11 -0
  17. package/dist-lib/npm/types/components/Icons.d.ts +10 -0
  18. package/dist-lib/npm/types/components/Modal.d.ts +10 -0
  19. package/dist-lib/npm/types/components/NumberField.d.ts +12 -0
  20. package/dist-lib/npm/types/components/PageLayout.d.ts +13 -0
  21. package/dist-lib/npm/types/components/PageSection.d.ts +9 -0
  22. package/dist-lib/npm/types/components/PasswordField.d.ts +4 -0
  23. package/dist-lib/npm/types/components/SegmentedControl.d.ts +11 -0
  24. package/dist-lib/npm/types/components/SegmentedField.d.ts +11 -0
  25. package/dist-lib/npm/types/components/SelectField.d.ts +13 -0
  26. package/dist-lib/npm/types/components/StatusMessage.d.ts +13 -0
  27. package/dist-lib/npm/types/components/Stepper.d.ts +9 -0
  28. package/dist-lib/npm/types/components/Switch.d.ts +8 -0
  29. package/dist-lib/npm/types/components/Tabs.d.ts +14 -0
  30. package/dist-lib/npm/types/components/TeamsGate.d.ts +4 -0
  31. package/dist-lib/npm/types/components/TextField.d.ts +9 -0
  32. package/dist-lib/npm/types/config/calendars.d.ts +1 -0
  33. package/dist-lib/npm/types/config/routes.d.ts +17 -0
  34. package/dist-lib/npm/types/context/HostContext.d.ts +9 -0
  35. package/dist-lib/npm/types/context/RootElementContext.d.ts +2 -0
  36. package/dist-lib/npm/types/data/index.d.ts +4 -0
  37. package/dist-lib/npm/types/data/localDataSource.d.ts +3 -0
  38. package/dist-lib/npm/types/data/restDataSource.d.ts +11 -0
  39. package/dist-lib/npm/types/data/tenantDataSource.d.ts +10 -0
  40. package/dist-lib/npm/types/data/types.d.ts +21 -0
  41. package/dist-lib/npm/types/features/authorization/components/AccountMenu.d.ts +6 -0
  42. package/dist-lib/npm/types/features/authorization/components/AuthFields.d.ts +26 -0
  43. package/dist-lib/npm/types/features/authorization/components/AuthGate.d.ts +7 -0
  44. package/dist-lib/npm/types/features/authorization/components/ContinueLink.d.ts +1 -0
  45. package/dist-lib/npm/types/features/authorization/components/EmailVerificationBanner.d.ts +1 -0
  46. package/dist-lib/npm/types/features/authorization/components/ForgotPasswordPage.d.ts +1 -0
  47. package/dist-lib/npm/types/features/authorization/components/LoginPage.d.ts +1 -0
  48. package/dist-lib/npm/types/features/authorization/components/RegisterPage.d.ts +1 -0
  49. package/dist-lib/npm/types/features/authorization/components/ResendVerificationButton.d.ts +4 -0
  50. package/dist-lib/npm/types/features/authorization/components/ResetPasswordPage.d.ts +1 -0
  51. package/dist-lib/npm/types/features/authorization/components/VerifyEmailPage.d.ts +1 -0
  52. package/dist-lib/npm/types/features/authorization/components/account/AccountSettings.d.ts +1 -0
  53. package/dist-lib/npm/types/features/authorization/components/account/DeleteAccountSection.d.ts +1 -0
  54. package/dist-lib/npm/types/features/authorization/components/account/EmailSection.d.ts +4 -0
  55. package/dist-lib/npm/types/features/authorization/components/account/PasswordSection.d.ts +1 -0
  56. package/dist-lib/npm/types/features/authorization/components/account/ProfileSection.d.ts +4 -0
  57. package/dist-lib/npm/types/features/authorization/context/AuthContext.d.ts +2 -0
  58. package/dist-lib/npm/types/features/authorization/context/AuthProvider.d.ts +8 -0
  59. package/dist-lib/npm/types/features/authorization/hooks/useAuth.d.ts +18 -0
  60. package/dist-lib/npm/types/features/authorization/index.d.ts +14 -0
  61. package/dist-lib/npm/types/features/authorization/repositories/HostTokenAuthRepository.d.ts +18 -0
  62. package/dist-lib/npm/types/features/authorization/repositories/RemoteAuthRepository.d.ts +18 -0
  63. package/dist-lib/npm/types/features/authorization/types/auth.d.ts +52 -0
  64. package/dist-lib/npm/types/features/authorization/utils/validation.d.ts +22 -0
  65. package/dist-lib/npm/types/features/calendar/components/Calendar.d.ts +14 -0
  66. package/dist-lib/npm/types/features/calendar/components/CalendarHeader.d.ts +16 -0
  67. package/dist-lib/npm/types/features/calendar/components/DayColumn.d.ts +18 -0
  68. package/dist-lib/npm/types/features/calendar/components/EventBlock.d.ts +10 -0
  69. package/dist-lib/npm/types/features/calendar/components/EventChip.d.ts +8 -0
  70. package/dist-lib/npm/types/features/calendar/components/EventTitle.d.ts +8 -0
  71. package/dist-lib/npm/types/features/calendar/components/MiniMonth.d.ts +9 -0
  72. package/dist-lib/npm/types/features/calendar/components/MonthGrid.d.ts +8 -0
  73. package/dist-lib/npm/types/features/calendar/components/MonthView.d.ts +2 -0
  74. package/dist-lib/npm/types/features/calendar/components/NowIndicator.d.ts +6 -0
  75. package/dist-lib/npm/types/features/calendar/components/TimeColumn.d.ts +1 -0
  76. package/dist-lib/npm/types/features/calendar/components/TimeGridView.d.ts +2 -0
  77. package/dist-lib/npm/types/features/calendar/components/YearView.d.ts +2 -0
  78. package/dist-lib/npm/types/features/calendar/constants/grid.d.ts +4 -0
  79. package/dist-lib/npm/types/features/calendar/constants/views.d.ts +7 -0
  80. package/dist-lib/npm/types/features/calendar/context/EventSourcesContext.d.ts +3 -0
  81. package/dist-lib/npm/types/features/calendar/hooks/useCalendarView.d.ts +19 -0
  82. package/dist-lib/npm/types/features/calendar/hooks/useEventSource.d.ts +2 -0
  83. package/dist-lib/npm/types/features/calendar/hooks/useNow.d.ts +1 -0
  84. package/dist-lib/npm/types/features/calendar/hooks/useSlotSelection.d.ts +6 -0
  85. package/dist-lib/npm/types/features/calendar/index.d.ts +4 -0
  86. package/dist-lib/npm/types/features/calendar/types/editor.d.ts +5 -0
  87. package/dist-lib/npm/types/features/calendar/types/eventLayout.d.ts +14 -0
  88. package/dist-lib/npm/types/features/calendar/types/eventSource.d.ts +6 -0
  89. package/dist-lib/npm/types/features/calendar/types/view.d.ts +26 -0
  90. package/dist-lib/npm/types/features/calendar/utils/eventGeometry.d.ts +3 -0
  91. package/dist-lib/npm/types/features/calendar/utils/eventLabels.d.ts +15 -0
  92. package/dist-lib/npm/types/features/calendar/utils/layoutEvents.d.ts +3 -0
  93. package/dist-lib/npm/types/features/calendar/utils/segmentEvents.d.ts +5 -0
  94. package/dist-lib/npm/types/features/calendar/utils/slotSelection.d.ts +17 -0
  95. package/dist-lib/npm/types/features/calendars/components/ActiveCalendarIndicator.d.ts +1 -0
  96. package/dist-lib/npm/types/features/calendars/components/CalendarPreview.d.ts +4 -0
  97. package/dist-lib/npm/types/features/calendars/components/CalendarSettings.d.ts +1 -0
  98. package/dist-lib/npm/types/features/calendars/components/CalendarSwitcher.d.ts +1 -0
  99. package/dist-lib/npm/types/features/calendars/components/InvitationList.d.ts +1 -0
  100. package/dist-lib/npm/types/features/calendars/components/create/ColorStep.d.ts +7 -0
  101. package/dist-lib/npm/types/features/calendars/components/create/CreateCalendarPage.d.ts +1 -0
  102. package/dist-lib/npm/types/features/calendars/components/create/DetailsStep.d.ts +12 -0
  103. package/dist-lib/npm/types/features/calendars/components/create/MembersStep.d.ts +8 -0
  104. package/dist-lib/npm/types/features/calendars/components/create/ReviewStep.d.ts +4 -0
  105. package/dist-lib/npm/types/features/calendars/components/settings/CalendarSettingsPage.d.ts +1 -0
  106. package/dist-lib/npm/types/features/calendars/components/settings/DangerSection.d.ts +9 -0
  107. package/dist-lib/npm/types/features/calendars/components/settings/GeneralSection.d.ts +4 -0
  108. package/dist-lib/npm/types/features/calendars/components/settings/MembersSection.d.ts +11 -0
  109. package/dist-lib/npm/types/features/calendars/components/settings/TeamInvitationsSection.d.ts +12 -0
  110. package/dist-lib/npm/types/features/calendars/components/settings/TransferOwnershipModal.d.ts +8 -0
  111. package/dist-lib/npm/types/features/calendars/constants/calendars.d.ts +9 -0
  112. package/dist-lib/npm/types/features/calendars/context/CalendarsContext.d.ts +2 -0
  113. package/dist-lib/npm/types/features/calendars/context/CalendarsProvider.d.ts +8 -0
  114. package/dist-lib/npm/types/features/calendars/hooks/useCalendars.d.ts +1 -0
  115. package/dist-lib/npm/types/features/calendars/hooks/useTeam.d.ts +12 -0
  116. package/dist-lib/npm/types/features/calendars/index.d.ts +11 -0
  117. package/dist-lib/npm/types/features/calendars/repositories/LocalCalendarRepository.d.ts +20 -0
  118. package/dist-lib/npm/types/features/calendars/repositories/RemoteCalendarRepository.d.ts +23 -0
  119. package/dist-lib/npm/types/features/calendars/types/calendar.d.ts +91 -0
  120. package/dist-lib/npm/types/features/calendars/utils/draft.d.ts +7 -0
  121. package/dist-lib/npm/types/features/calendars/utils/permissions.d.ts +13 -0
  122. package/dist-lib/npm/types/features/events/components/ColorPicker.d.ts +7 -0
  123. package/dist-lib/npm/types/features/events/components/CustomColorSettings.d.ts +1 -0
  124. package/dist-lib/npm/types/features/events/components/DeleteEventModal.d.ts +8 -0
  125. package/dist-lib/npm/types/features/events/components/EventModal.d.ts +11 -0
  126. package/dist-lib/npm/types/features/events/components/RecurrenceFields.d.ts +9 -0
  127. package/dist-lib/npm/types/features/events/components/RecurrenceScopeModal.d.ts +8 -0
  128. package/dist-lib/npm/types/features/events/components/ScopeButtons.d.ts +10 -0
  129. package/dist-lib/npm/types/features/events/constants/colors.d.ts +3 -0
  130. package/dist-lib/npm/types/features/events/hooks/useCustomColors.d.ts +8 -0
  131. package/dist-lib/npm/types/features/events/hooks/useEvents.d.ts +15 -0
  132. package/dist-lib/npm/types/features/events/index.d.ts +5 -0
  133. package/dist-lib/npm/types/features/events/types/eventModal.d.ts +1 -0
  134. package/dist-lib/npm/types/features/events/utils/scopeOptions.d.ts +3 -0
  135. package/dist-lib/npm/types/features/events/utils/seriesActions.d.ts +4 -0
  136. package/dist-lib/npm/types/features/preferences/components/PreferencesSettings.d.ts +1 -0
  137. package/dist-lib/npm/types/features/preferences/context/PreferencesContext.d.ts +6 -0
  138. package/dist-lib/npm/types/features/preferences/context/PreferencesProvider.d.ts +4 -0
  139. package/dist-lib/npm/types/features/preferences/hooks/usePreferences.d.ts +1 -0
  140. package/dist-lib/npm/types/features/preferences/index.d.ts +3 -0
  141. package/dist-lib/npm/types/features/storage/components/LocalImportPrompt.d.ts +5 -0
  142. package/dist-lib/npm/types/features/storage/context/StorageContext.d.ts +2 -0
  143. package/dist-lib/npm/types/features/storage/context/StorageProvider.d.ts +8 -0
  144. package/dist-lib/npm/types/features/storage/hooks/useStorage.d.ts +7 -0
  145. package/dist-lib/npm/types/features/storage/index.d.ts +10 -0
  146. package/dist-lib/npm/types/features/storage/repositories/LocalColorRepository.d.ts +9 -0
  147. package/dist-lib/npm/types/features/storage/repositories/LocalEventRepository.d.ts +13 -0
  148. package/dist-lib/npm/types/features/storage/repositories/LocalPreferencesRepository.d.ts +8 -0
  149. package/dist-lib/npm/types/features/storage/repositories/RemoteColorRepository.d.ts +10 -0
  150. package/dist-lib/npm/types/features/storage/repositories/RemoteEventRepository.d.ts +12 -0
  151. package/dist-lib/npm/types/features/storage/repositories/RemotePreferencesRepository.d.ts +9 -0
  152. package/dist-lib/npm/types/features/storage/types/storage.d.ts +35 -0
  153. package/dist-lib/npm/types/features/storage/utils/copyEvents.d.ts +3 -0
  154. package/dist-lib/npm/types/features/storage/utils/localStorageList.d.ts +5 -0
  155. package/dist-lib/npm/types/features/storage/utils/localStorageValue.d.ts +9 -0
  156. package/dist-lib/npm/types/hooks/useArrowKeyNavigation.d.ts +6 -0
  157. package/dist-lib/npm/types/hooks/useAsyncAction.d.ts +6 -0
  158. package/dist-lib/npm/types/hooks/useAsyncResource.d.ts +9 -0
  159. package/dist-lib/npm/types/hooks/useForm.d.ts +21 -0
  160. package/dist-lib/npm/types/hooks/useFormState.d.ts +8 -0
  161. package/dist-lib/npm/types/hooks/useRequiredContext.d.ts +2 -0
  162. package/dist-lib/npm/types/hooks/useTabParam.d.ts +3 -0
  163. package/dist-lib/npm/types/i18n/I18nContext.d.ts +15 -0
  164. package/dist-lib/npm/types/i18n/I18nProvider.d.ts +7 -0
  165. package/dist-lib/npm/types/i18n/errorMessage.d.ts +2 -0
  166. package/dist-lib/npm/types/i18n/format.d.ts +28 -0
  167. package/dist-lib/npm/types/i18n/index.d.ts +8 -0
  168. package/dist-lib/npm/types/i18n/locale.d.ts +14 -0
  169. package/dist-lib/npm/types/i18n/messages/de/auth.d.ts +2 -0
  170. package/dist-lib/npm/types/i18n/messages/de/calendar.d.ts +3 -0
  171. package/dist-lib/npm/types/i18n/messages/de/calendars.d.ts +2 -0
  172. package/dist-lib/npm/types/i18n/messages/de/core.d.ts +7 -0
  173. package/dist-lib/npm/types/i18n/messages/de/events.d.ts +2 -0
  174. package/dist-lib/npm/types/i18n/messages/de/index.d.ts +2 -0
  175. package/dist-lib/npm/types/i18n/messages/de/settings.d.ts +2 -0
  176. package/dist-lib/npm/types/i18n/messages/de/storage.d.ts +2 -0
  177. package/dist-lib/npm/types/i18n/messages/en/auth.d.ts +97 -0
  178. package/dist-lib/npm/types/i18n/messages/en/calendar.d.ts +34 -0
  179. package/dist-lib/npm/types/i18n/messages/en/calendars.d.ts +177 -0
  180. package/dist-lib/npm/types/i18n/messages/en/core.d.ts +86 -0
  181. package/dist-lib/npm/types/i18n/messages/en/events.d.ts +42 -0
  182. package/dist-lib/npm/types/i18n/messages/en/index.d.ts +466 -0
  183. package/dist-lib/npm/types/i18n/messages/en/settings.d.ts +23 -0
  184. package/dist-lib/npm/types/i18n/messages/en/storage.d.ts +7 -0
  185. package/dist-lib/npm/types/i18n/messages/index.d.ts +4 -0
  186. package/dist-lib/npm/types/i18n/messages/types.d.ts +2 -0
  187. package/dist-lib/npm/types/i18n/useI18n.d.ts +3 -0
  188. package/dist-lib/npm/types/i18n/useLocaleGetter.d.ts +1 -0
  189. package/dist-lib/npm/types/i18n/weekInfo.d.ts +5 -0
  190. package/dist-lib/npm/types/lib/CalendarApp.d.ts +14 -0
  191. package/dist-lib/npm/types/lib/CalendarWidget.d.ts +2 -0
  192. package/dist-lib/npm/types/lib/IsolatedRoot.d.ts +9 -0
  193. package/dist-lib/npm/types/lib/config.d.ts +28 -0
  194. package/dist-lib/npm/types/lib/defaults.d.ts +13 -0
  195. package/dist-lib/npm/types/lib/element.d.ts +16 -0
  196. package/dist-lib/npm/types/lib/eventCallbacks.d.ts +11 -0
  197. package/dist-lib/npm/types/lib/index.d.ts +16 -0
  198. package/dist-lib/npm/types/lib/linkParam.d.ts +2 -0
  199. package/dist-lib/npm/types/lib/version.d.ts +1 -0
  200. package/dist-lib/npm/types/pages/CalendarPage.d.ts +1 -0
  201. package/dist-lib/npm/types/pages/SettingsPage.d.ts +1 -0
  202. package/dist-lib/npm/types/router.d.ts +7 -0
  203. package/dist-lib/npm/types/utils/api.d.ts +32 -0
  204. package/dist-lib/npm/types/utils/apiError.d.ts +26 -0
  205. package/dist-lib/npm/types/utils/appError.d.ts +10 -0
  206. package/dist-lib/npm/types/utils/calendarView.d.ts +3 -0
  207. package/dist-lib/npm/types/utils/classNames.d.ts +2 -0
  208. package/dist-lib/npm/types/utils/color.d.ts +5 -0
  209. package/dist-lib/npm/types/utils/date.d.ts +44 -0
  210. package/dist-lib/npm/types/utils/dom.d.ts +3 -0
  211. package/dist-lib/npm/types/utils/event.d.ts +74 -0
  212. package/dist-lib/npm/types/utils/number.d.ts +1 -0
  213. package/dist-lib/npm/types/utils/object.d.ts +3 -0
  214. package/dist-lib/npm/types/utils/preferences.d.ts +15 -0
  215. package/dist-lib/npm/types/utils/recurrence.d.ts +33 -0
  216. package/dist-lib/npm/types/utils/series.d.ts +9 -0
  217. package/dist-lib/npm/types/utils/validation.d.ts +6 -0
  218. package/package.json +82 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["events","auth","calendars","settings","storage","views","calendar","common","errors","validation","colors","themes","recurrence","NO_INVITATIONS","invariant","createContext","isBrowser","createContext","DataRoutes","isBrowser","alreadyWarned","Form","_Fragment","InvitationRow","_Fragment","_Fragment","AUTH_PATH","_Fragment","_Fragment","_Fragment","_Fragment","_Fragment","_Fragment","_Fragment","_Fragment","_Fragment","DEFAULT_STORAGE_KEY","NO_EVENTS","DEFAULT_STORAGE_KEY","THEMES","_Fragment","_Fragment","_Fragment","_Fragment","_Fragment","_Fragment","_Fragment","_Fragment","THEMES","_Fragment","_Fragment","_Fragment","styles"],"sources":["../../src/context/HostContext.ts","../../src/utils/appError.ts","../../src/utils/apiError.ts","../../src/i18n/errorMessage.ts","../../src/context/RootElementContext.ts","../../src/utils/date.ts","../../src/i18n/format.ts","../../src/i18n/I18nContext.ts","../../src/i18n/locale.ts","../../src/i18n/messages/de/events.ts","../../src/i18n/messages/de/auth.ts","../../src/i18n/messages/de/calendars.ts","../../src/i18n/messages/de/settings.ts","../../src/i18n/messages/de/storage.ts","../../src/i18n/messages/de/calendar.ts","../../src/i18n/messages/de/core.ts","../../src/i18n/messages/de/index.ts","../../src/i18n/messages/en/events.ts","../../src/i18n/messages/en/auth.ts","../../src/i18n/messages/en/calendars.ts","../../src/i18n/messages/en/settings.ts","../../src/i18n/messages/en/storage.ts","../../src/i18n/messages/en/calendar.ts","../../src/i18n/messages/en/core.ts","../../src/i18n/messages/en/index.ts","../../src/i18n/messages/index.ts","../../src/i18n/weekInfo.ts","../../src/i18n/I18nProvider.tsx","../../src/hooks/useRequiredContext.ts","../../src/i18n/useI18n.ts","../../src/i18n/useLocaleGetter.ts","../../src/hooks/useAsyncResource.ts","../../src/config/calendars.ts","../../src/features/calendars/constants/calendars.ts","../../src/utils/validation.ts","../../src/features/calendars/utils/draft.ts","../../src/features/calendars/types/calendar.ts","../../src/features/calendars/utils/permissions.ts","../../src/features/calendars/context/CalendarsContext.ts","../../src/features/calendars/context/CalendarsProvider.tsx","../../src/features/calendars/hooks/useCalendars.ts","../../node_modules/react-router/dist/production/lib/router/url.js","../../node_modules/react-router/dist/production/lib/router/history.js","../../node_modules/react-router/dist/production/lib/router/utils.js","../../node_modules/react-router/dist/production/lib/router/instrumentation.js","../../node_modules/react-router/dist/production/lib/router/matcher.js","../../node_modules/react-router/dist/production/lib/router/matcher-route-pattern.preload.js","../../node_modules/react-router/dist/production/lib/router/navigation.js","../../node_modules/react-router/dist/production/lib/router/router.js","../../node_modules/react-router/dist/production/lib/context.js","../../node_modules/react-router/dist/production/lib/errors.js","../../node_modules/react-router/dist/production/lib/hooks.js","../../node_modules/react-router/dist/production/lib/server-runtime/warnings.js","../../node_modules/react-router/dist/production/lib/components.js","../../node_modules/react-router/dist/production/lib/dom/dom.js","../../node_modules/react-router/dist/production/lib/dom/ssr/invariant.js","../../node_modules/react-router/dist/production/lib/dom/ssr/markup.js","../../node_modules/react-router/dist/production/lib/dom/ssr/single-fetch.js","../../node_modules/react-router/dist/production/lib/dom/ssr/routeModules.js","../../node_modules/react-router/dist/production/lib/dom/ssr/links.js","../../node_modules/react-router/dist/production/lib/dom/ssr/components.js","../../node_modules/react-router/dist/production/lib/dom/lib.js","../../src/utils/classNames.ts","../../src/components/Button.tsx","../../src/config/routes.ts","../../src/hooks/useAsyncAction.ts","../../src/components/Modal.tsx","../../src/components/StatusMessage.tsx","../../src/components/ConfirmModal.tsx","../../src/components/Icons.tsx","../../src/components/PageSection.tsx","../../src/components/Switch.tsx","../../src/utils/color.ts","../../src/utils/object.ts","../../src/utils/number.ts","../../src/utils/recurrence.ts","../../src/utils/event.ts","../../src/features/calendars/components/InvitationList.tsx","../../src/features/calendars/components/CalendarSettings.tsx","../../src/components/PageLayout.tsx","../../src/components/Tabs.tsx","../../src/hooks/useTabParam.ts","../../src/features/authorization/context/AuthContext.ts","../../src/features/authorization/context/AuthProvider.tsx","../../src/features/authorization/hooks/useAuth.ts","../../src/features/authorization/repositories/HostTokenAuthRepository.ts","../../src/features/authorization/repositories/RemoteAuthRepository.ts","../../src/features/authorization/components/AccountMenu.tsx","../../src/components/Form.tsx","../../src/hooks/useFormState.ts","../../src/hooks/useForm.ts","../../src/features/authorization/utils/validation.ts","../../src/components/FormField.tsx","../../src/components/TextField.tsx","../../src/components/PasswordField.tsx","../../src/features/authorization/components/AuthFields.tsx","../../src/features/authorization/components/account/DeleteAccountSection.tsx","../../src/features/authorization/components/ResendVerificationButton.tsx","../../src/features/authorization/components/account/EmailSection.tsx","../../src/features/authorization/components/account/PasswordSection.tsx","../../src/features/authorization/components/account/ProfileSection.tsx","../../src/features/authorization/components/account/AccountSettings.tsx","../../src/features/authorization/components/AuthGate.tsx","../../src/features/authorization/components/EmailVerificationBanner.tsx","../../src/features/authorization/components/ForgotPasswordPage.tsx","../../src/features/authorization/components/LoginPage.tsx","../../src/features/authorization/components/RegisterPage.tsx","../../src/features/authorization/components/ContinueLink.tsx","../../src/features/authorization/components/ResetPasswordPage.tsx","../../src/features/authorization/components/VerifyEmailPage.tsx","../../src/features/calendars/hooks/useTeam.ts","../../src/features/calendars/components/settings/TransferOwnershipModal.tsx","../../src/features/calendars/components/settings/DangerSection.tsx","../../src/hooks/useArrowKeyNavigation.ts","../../src/features/storage/context/StorageContext.ts","../../src/features/storage/context/StorageProvider.tsx","../../src/features/storage/hooks/useStorage.ts","../../src/features/storage/utils/localStorageValue.ts","../../src/features/storage/utils/localStorageList.ts","../../src/features/storage/repositories/LocalEventRepository.ts","../../src/features/storage/utils/copyEvents.ts","../../src/features/storage/components/LocalImportPrompt.tsx","../../src/features/storage/repositories/LocalColorRepository.ts","../../src/utils/calendarView.ts","../../src/utils/preferences.ts","../../src/features/storage/repositories/LocalPreferencesRepository.ts","../../src/utils/api.ts","../../src/features/storage/repositories/RemoteColorRepository.ts","../../src/features/storage/repositories/RemoteEventRepository.ts","../../src/features/storage/repositories/RemotePreferencesRepository.ts","../../src/utils/series.ts","../../src/features/events/utils/seriesActions.ts","../../src/features/events/hooks/useEvents.ts","../../src/components/DateTimeField.tsx","../../src/features/events/utils/scopeOptions.ts","../../src/components/ChoiceChip.tsx","../../src/features/events/constants/colors.ts","../../src/features/events/hooks/useCustomColors.ts","../../src/features/events/components/ColorPicker.tsx","../../src/components/NumberField.tsx","../../src/components/SelectField.tsx","../../src/features/events/components/RecurrenceFields.tsx","../../src/features/events/components/ScopeButtons.tsx","../../src/features/events/components/RecurrenceScopeModal.tsx","../../src/features/events/components/EventModal.tsx","../../src/features/events/components/DeleteEventModal.tsx","../../src/components/IconButton.tsx","../../src/features/events/components/CustomColorSettings.tsx","../../src/features/calendar/context/EventSourcesContext.ts","../../src/features/calendar/constants/views.ts","../../src/features/calendar/hooks/useCalendarView.ts","../../src/features/calendar/hooks/useNow.ts","../../src/features/calendar/utils/eventLabels.ts","../../src/features/calendar/utils/segmentEvents.ts","../../src/components/SegmentedControl.tsx","../../src/features/calendar/components/CalendarHeader.tsx","../../src/utils/dom.ts","../../src/features/calendar/constants/grid.ts","../../src/features/calendar/utils/eventGeometry.ts","../../src/features/calendar/utils/layoutEvents.ts","../../src/features/calendar/hooks/useEventSource.ts","../../src/features/calendar/components/EventTitle.tsx","../../src/features/calendar/components/EventChip.tsx","../../src/features/calendar/components/MonthGrid.tsx","../../src/features/calendar/components/MonthView.tsx","../../src/features/calendar/utils/slotSelection.ts","../../src/features/calendar/hooks/useSlotSelection.ts","../../src/features/calendar/components/EventBlock.tsx","../../src/features/calendar/components/NowIndicator.tsx","../../src/features/calendar/components/DayColumn.tsx","../../src/features/calendar/components/TimeColumn.tsx","../../src/features/calendar/components/TimeGridView.tsx","../../src/features/calendar/components/MiniMonth.tsx","../../src/features/calendar/components/YearView.tsx","../../src/features/calendar/components/Calendar.tsx","../../src/features/calendars/components/CalendarPreview.tsx","../../src/features/calendars/components/create/ColorStep.tsx","../../src/features/calendars/components/create/DetailsStep.tsx","../../src/features/calendars/components/settings/GeneralSection.tsx","../../src/features/calendars/components/settings/MembersSection.tsx","../../src/features/calendars/components/settings/TeamInvitationsSection.tsx","../../src/features/calendars/components/settings/CalendarSettingsPage.tsx","../../src/components/Stepper.tsx","../../src/features/calendars/components/create/MembersStep.tsx","../../src/features/calendars/components/create/ReviewStep.tsx","../../src/features/calendars/components/create/CreateCalendarPage.tsx","../../src/features/calendars/components/CalendarSwitcher.tsx","../../src/features/calendars/components/ActiveCalendarIndicator.tsx","../../src/features/calendars/repositories/LocalCalendarRepository.ts","../../src/features/calendars/repositories/RemoteCalendarRepository.ts","../../src/data/localDataSource.ts","../../src/data/restDataSource.ts","../../src/data/tenantDataSource.ts","../../src/features/preferences/context/PreferencesContext.ts","../../src/features/preferences/context/PreferencesProvider.tsx","../../src/features/preferences/hooks/usePreferences.ts","../../src/components/SegmentedField.tsx","../../src/features/preferences/components/PreferencesSettings.tsx","../../src/components/TeamsGate.tsx","../../src/pages/CalendarPage.tsx","../../src/pages/SettingsPage.tsx","../../src/router.tsx","../../src/lib/eventCallbacks.ts","../../src/lib/CalendarApp.tsx","../../src/lib/defaults.ts","../../src/assets/css/index.css?inline","../../src/lib/IsolatedRoot.tsx","../../src/lib/linkParam.ts","../../src/lib/CalendarWidget.tsx","../../src/lib/version.ts","../../src/lib/element.tsx"],"sourcesContent":["import { createContext, use } from 'react'\r\nimport type { CalendarView } from '../utils/calendarView.ts'\r\n\r\nexport type HostTheme = 'light' | 'dark'\r\n\r\nexport type HostOptions = {\r\n teams: boolean\r\n theme?: HostTheme\r\n initialView?: CalendarView\r\n}\r\n\r\nexport const HostContext = createContext<HostOptions>({ teams: true })\r\n\r\nexport const useHost = () => use(HostContext)\r\n","export const ERROR_CODES = [\r\n 'unknown',\r\n 'eventNotFound',\r\n 'accountRequired',\r\n 'saveEventsFailed',\r\n 'savePreferencesFailed',\r\n 'saveColorFailed',\r\n 'saveDecisionFailed',\r\n 'invalidLink',\r\n 'invalidResetLink',\r\n 'invalidCredentials',\r\n 'emailTaken',\r\n 'wrongCurrentPassword',\r\n 'wrongPassword',\r\n 'soleOwner',\r\n 'unauthorized',\r\n 'forbidden',\r\n 'notFound',\r\n 'serverError',\r\n 'payloadTooLarge',\r\n 'calendarNotFound',\r\n 'teamNotFound',\r\n 'memberNotFound',\r\n 'invitationNotFound',\r\n 'invitationExpired',\r\n 'tooManyLoginAttempts',\r\n 'seriesHasDetached',\r\n 'selfInvite',\r\n 'alreadyMember',\r\n 'alreadyInvited',\r\n 'personalTeam',\r\n 'lastOwner',\r\n 'alreadyOwner',\r\n 'lastCalendar',\r\n 'tooManyColors',\r\n 'managedByHost',\r\n 'unknownTenant',\r\n 'originNotAllowed',\r\n 'invalidUserToken',\r\n] as const\r\n\r\nexport const isErrorCode = (value: unknown): value is ErrorCode =>\r\n typeof value === 'string' && (ERROR_CODES as readonly string[]).includes(value)\r\n\r\nexport type ErrorCode = (typeof ERROR_CODES)[number]\r\n\r\nexport class AppError extends Error {\r\n readonly code: ErrorCode\r\n\r\n constructor(code: ErrorCode, options?: { cause?: unknown }) {\r\n super(code, options)\r\n this.name = 'AppError'\r\n this.code = code\r\n }\r\n}\r\n\r\nexport const isAppError = (error: unknown): error is AppError => error instanceof AppError\r\n","import { isErrorCode, type ErrorCode } from './appError.ts'\r\n\r\nexport type ApiErrorKind = 'http' | 'timeout' | 'network' | 'aborted' | 'parse'\r\n\r\ntype ApiErrorOptions = {\r\n kind: ApiErrorKind\r\n code?: ErrorCode\r\n status?: number | null\r\n body?: unknown\r\n cause?: unknown\r\n}\r\n\r\nexport const getServerMessage = (body: unknown) => {\r\n if (typeof body !== 'object' || body === null) return null\r\n const message = (body as Record<string, unknown>).message\r\n return typeof message === 'string' && message.trim() ? message.trim() : null\r\n}\r\n\r\nexport const getServerCode = (body: unknown) => {\r\n if (typeof body !== 'object' || body === null) return undefined\r\n const code = (body as Record<string, unknown>).code\r\n return isErrorCode(code) ? code : undefined\r\n}\r\n\r\nexport class ApiError extends Error {\r\n readonly kind: ApiErrorKind\r\n readonly status: number | null\r\n readonly body: unknown\r\n readonly code: ErrorCode | null\r\n\r\n constructor(message: string, { kind, code, status = null, body, cause }: ApiErrorOptions) {\r\n super(message, { cause })\r\n this.name = 'ApiError'\r\n this.kind = kind\r\n this.code = code ?? null\r\n this.status = status\r\n this.body = body\r\n }\r\n\r\n get serverMessage() {\r\n return getServerMessage(this.body)\r\n }\r\n\r\n static fromResponse(status: number, body: unknown) {\r\n return new ApiError(getServerMessage(body) ?? `Request failed with status ${status}.`, {\r\n kind: 'http',\r\n code: getServerCode(body),\r\n status,\r\n body,\r\n })\r\n }\r\n\r\n static fromKind(kind: Exclude<ApiErrorKind, 'http'>, cause?: unknown) {\r\n return new ApiError(`Request failed: ${kind}.`, { kind, cause })\r\n }\r\n\r\n get isUnauthorized() {\r\n return this.status === 401\r\n }\r\n\r\n get isNotFound() {\r\n return this.status === 404\r\n }\r\n\r\n get isServerError() {\r\n return this.status !== null && this.status >= 500\r\n }\r\n}\r\n\r\nexport const isApiError = (error: unknown): error is ApiError => error instanceof ApiError\r\n","import { isApiError } from '../utils/apiError.ts'\r\nimport { isAppError } from '../utils/appError.ts'\r\nimport type { Messages } from './messages/index.ts'\r\n\r\nconst SERVER_ERROR_STATUS = 500\r\n\r\nexport function getErrorMessage(error: unknown, m: Messages) {\r\n if (isAppError(error)) return m.errors[error.code]\r\n if (isApiError(error)) {\r\n if (error.code) return m.errors[error.code]\r\n if (error.serverMessage) return error.serverMessage\r\n if (error.kind !== 'http' || error.status === null) return error.kind === 'http' ? m.errors.unknown : m.errors.kind[error.kind]\r\n return (\r\n m.errors.status[error.status] ??\r\n (error.status >= SERVER_ERROR_STATUS ? m.errors.serverError : m.errors.requestFailed(error.status))\r\n )\r\n }\r\n return m.errors.unknown\r\n}\r\n","import { createContext, use } from 'react'\r\n\r\nexport const RootElementContext = createContext<HTMLElement | null>(null)\r\n\r\nexport function useRootElement() {\r\n const root = use(RootElementContext)\r\n if (!root) throw new Error('useRootElement must be used inside <Calendar>.')\r\n return root\r\n}\r\n","export const DAYS_PER_WEEK = 7\r\nexport const HOURS_PER_DAY = 24\r\nexport const MINUTES_PER_HOUR = 60\r\nexport const MINUTES_PER_DAY = HOURS_PER_DAY * MINUTES_PER_HOUR\r\nconst MS_PER_DAY = 86_400_000\r\n\r\nexport type DateRange = {\r\n from: string\r\n to: string\r\n}\r\n\r\nexport const ISO_DATE_PATTERN = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/\r\nexport const TIME_PATTERN = /^([01]\\d|2[0-3]):[0-5]\\d$/\r\n\r\nexport const isISODate = (value: unknown): value is string => typeof value === 'string' && ISO_DATE_PATTERN.test(value)\r\n\r\nexport const isTime = (value: unknown): value is string => typeof value === 'string' && TIME_PATTERN.test(value)\r\n\r\nconst pad = (value: number) => String(value).padStart(2, '0')\r\n\r\nconst parseISODate = (isoDate: string) => {\r\n const [year, month, day] = isoDate.split('-').map(Number)\r\n return { year, monthIndex: month - 1, day }\r\n}\r\n\r\nexport const toISODate = (date: Date) => `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`\r\n\r\nexport const fromISODate = (isoDate: string) => {\r\n const { year, monthIndex, day } = parseISODate(isoDate)\r\n return new Date(year, monthIndex, day)\r\n}\r\n\r\nexport const minISODate = (a: string, b: string) => (a < b ? a : b)\r\n\r\nexport const maxISODate = (a: string, b: string) => (a > b ? a : b)\r\n\r\nexport const timeToMinutes = (time: string) => {\r\n const [hours, minutes] = time.split(':').map(Number)\r\n return hours * MINUTES_PER_HOUR + minutes\r\n}\r\n\r\nexport const minutesToTime = (totalMinutes: number) =>\r\n `${pad(Math.floor(totalMinutes / MINUTES_PER_HOUR))}:${pad(totalMinutes % MINUTES_PER_HOUR)}`\r\n\r\nexport const addDays = (date: Date, amount: number) =>\r\n new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount)\r\n\r\nexport const addDaysToISODate = (isoDate: string, amount: number) => toISODate(addDays(fromISODate(isoDate), amount))\r\n\r\nexport const addMonthsToISODate = (isoDate: string, amount: number) => {\r\n const { year, monthIndex, day } = parseISODate(isoDate)\r\n const target = new Date(year, monthIndex + amount, 1)\r\n return toISODate(\r\n new Date(\r\n target.getFullYear(),\r\n target.getMonth(),\r\n Math.min(day, daysInMonth(target.getFullYear(), target.getMonth())),\r\n ),\r\n )\r\n}\r\n\r\nexport const startOfMonthISO = (isoDate: string) => `${isoDate.slice(0, 7)}-01`\r\n\r\nexport const endOfMonthISO = (isoDate: string) => addDaysToISODate(addMonthsToISODate(startOfMonthISO(isoDate), 1), -1)\r\n\r\nexport const startOfYearISO = (isoDate: string) => `${isoDate.slice(0, 4)}-01-01`\r\n\r\nexport const endOfYearISO = (isoDate: string) => `${isoDate.slice(0, 4)}-12-31`\r\n\r\nexport const isSameMonthISO = (a: string, b: string) => a.slice(0, 7) === b.slice(0, 7)\r\n\r\nexport const listISODates = (from: string, to: string) =>\r\n Array.from({ length: daysBetween(from, to) + 1 }, (_, index) => addDaysToISODate(from, index))\r\n\r\nconst toUTCTime = (isoDate: string) => {\r\n const { year, monthIndex, day } = parseISODate(isoDate)\r\n return Date.UTC(year, monthIndex, day)\r\n}\r\n\r\nexport const daysBetween = (fromIsoDate: string, toIsoDate: string) =>\r\n Math.round((toUTCTime(toIsoDate) - toUTCTime(fromIsoDate)) / MS_PER_DAY)\r\n\r\nexport const daysInMonth = (year: number, monthIndex: number) => new Date(year, monthIndex + 1, 0).getDate()\r\n\r\nexport const getWeekdayIndex = (date: Date) => (date.getDay() + DAYS_PER_WEEK - 1) % DAYS_PER_WEEK\r\n\r\nexport const MONDAY = 1\r\n\r\nexport const startOfWeek = (date: Date, firstDay = MONDAY) =>\r\n addDays(date, -((date.getDay() - firstDay + DAYS_PER_WEEK) % DAYS_PER_WEEK))\r\n\r\nexport const startOfWeekISO = (isoDate: string, firstDay = MONDAY) =>\r\n toISODate(startOfWeek(fromISODate(isoDate), firstDay))\r\n\r\nexport const endOfWeekISO = (isoDate: string, firstDay = MONDAY) =>\r\n addDaysToISODate(startOfWeekISO(isoDate, firstDay), DAYS_PER_WEEK - 1)\r\n\r\nexport const getMonthWeeks = (isoDate: string, firstDay = MONDAY) => {\r\n const dates = listISODates(\r\n startOfWeekISO(startOfMonthISO(isoDate), firstDay),\r\n endOfWeekISO(endOfMonthISO(isoDate), firstDay),\r\n )\r\n return Array.from({ length: dates.length / DAYS_PER_WEEK }, (_, week) =>\r\n dates.slice(week * DAYS_PER_WEEK, (week + 1) * DAYS_PER_WEEK),\r\n )\r\n}\r\n\r\nexport const isSameDay = (a: Date, b: Date) => toISODate(a) === toISODate(b)\r\n\r\nexport const getWeekDays = (weekStart: Date) =>\r\n Array.from({ length: DAYS_PER_WEEK }, (_, index) => addDays(weekStart, index))\r\n\r\ntype WeekRule = { firstDay: number; minimalDays: number }\r\n\r\nconst firstWeekStart = (year: number, { firstDay, minimalDays }: WeekRule) =>\r\n startOfWeek(new Date(year, 0, minimalDays), firstDay)\r\n\r\nexport const getWeekNumber = (date: Date, rule: WeekRule) => {\r\n const weekStart = startOfWeek(date, rule.firstDay)\r\n const weekEndYear = addDays(weekStart, DAYS_PER_WEEK - 1).getFullYear()\r\n const candidate = firstWeekStart(weekEndYear, rule)\r\n const firstWeek = weekStart < candidate ? firstWeekStart(weekEndYear - 1, rule) : candidate\r\n return Math.floor(daysBetween(toISODate(firstWeek), toISODate(weekStart)) / DAYS_PER_WEEK) + 1\r\n}\r\n\r\nexport const getDayOfMonth = (isoDate: string) => Number(isoDate.slice(8, 10))\r\n","import { addDays, DAYS_PER_WEEK, fromISODate, MINUTES_PER_HOUR } from '../utils/date.ts'\r\n\r\nconst atMinutes = (minutes: number) =>\r\n new Date(2000, 0, 3, Math.floor(minutes / MINUTES_PER_HOUR), minutes % MINUTES_PER_HOUR)\r\n\r\nconst REFERENCE_MONDAY = new Date(2000, 0, 3)\r\n\r\nconst stripTrailingDot = (label: string) => label.replace(/\\.$/, '')\r\n\r\nexport type Formatter = ReturnType<typeof createFormatter>\r\n\r\nexport function createFormatter(locale: string, firstDay: number) {\r\n const format = (options: Intl.DateTimeFormatOptions) => new Intl.DateTimeFormat(locale, options)\r\n const weekday = format({ weekday: 'long' })\r\n const shortWeekday = format({ weekday: 'short' })\r\n const day = format({ day: '2-digit', month: '2-digit', year: '2-digit' })\r\n const shortDay = format({ day: '2-digit', month: '2-digit' })\r\n const fullDay = format({ day: '2-digit', month: '2-digit', year: 'numeric' })\r\n const month = format({ month: 'long' })\r\n const monthYear = format({ month: 'long', year: 'numeric' })\r\n const longDate = format({ weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' })\r\n const hourCycle = format({ hour: 'numeric' }).resolvedOptions().hourCycle\r\n const uses12Hours = hourCycle === 'h11' || hourCycle === 'h12'\r\n const time = format(uses12Hours ? { hour: 'numeric', minute: '2-digit' } : { hour: '2-digit', minute: '2-digit' })\r\n const hourOnly = format(uses12Hours ? { hour: 'numeric' } : { hour: '2-digit', minute: '2-digit' })\r\n const list = new Intl.ListFormat(locale, { type: 'conjunction' })\r\n const mondayBasedOrder = Array.from(\r\n { length: DAYS_PER_WEEK },\r\n (_, offset) => (firstDay - 1 + offset + DAYS_PER_WEEK) % DAYS_PER_WEEK,\r\n )\r\n\r\n const weekdayLabels = (formatter: Intl.DateTimeFormat) =>\r\n mondayBasedOrder.map((weekday) => ({\r\n weekday,\r\n label: stripTrailingDot(formatter.format(addDays(REFERENCE_MONDAY, weekday))),\r\n }))\r\n\r\n const formatMonthTitle = (date: Date) => month.format(date)\r\n\r\n return {\r\n locale,\r\n uses12Hours,\r\n firstDay,\r\n weekday: (date: Date) => weekday.format(date),\r\n shortWeekday: (date: Date) => stripTrailingDot(shortWeekday.format(date)),\r\n day: (date: Date) => day.format(date),\r\n shortDay: (isoDate: string) => shortDay.format(fromISODate(isoDate)),\r\n fullDay: (isoDate: string) => fullDay.format(fromISODate(isoDate)),\r\n longDate: (isoDate: string) => longDate.format(fromISODate(isoDate)),\r\n monthName: (isoDate: string) => month.format(fromISODate(isoDate)),\r\n monthYear: (isoDate: string) => monthYear.format(fromISODate(isoDate)),\r\n time: (minutes: number) => time.format(atMinutes(minutes)),\r\n hour: (hour: number) => hourOnly.format(atMinutes(hour * MINUTES_PER_HOUR)),\r\n compactHour: (hour: number) => (uses12Hours ? `${hour % 12 || 12}${hour < 12 ? 'a' : 'p'}` : String(hour)),\r\n list: (items: readonly string[]) => list.format(items),\r\n shortWeekdays: weekdayLabels(shortWeekday),\r\n longWeekdays: weekdayLabels(weekday),\r\n weekdayName: (mondayBasedIndex: number) => weekday.format(addDays(REFERENCE_MONDAY, mondayBasedIndex)),\r\n weekTitle: (weekStart: Date) => {\r\n const weekEnd = addDays(weekStart, DAYS_PER_WEEK - 1)\r\n const startMonth = formatMonthTitle(weekStart)\r\n const endMonth = formatMonthTitle(weekEnd)\r\n const startYear = weekStart.getFullYear()\r\n const endYear = weekEnd.getFullYear()\r\n if (startYear !== endYear) return `${startMonth} ${startYear} / ${endMonth} ${endYear}`\r\n if (startMonth !== endMonth) return `${startMonth} / ${endMonth} ${endYear}`\r\n return monthYear.format(weekStart)\r\n },\r\n }\r\n}\r\n","import { createContext } from 'react'\r\nimport type { Formatter } from './format.ts'\r\nimport type { Language } from './locale.ts'\r\nimport type { Messages } from './messages/index.ts'\r\nimport type { WeekInfo } from './weekInfo.ts'\r\n\r\nexport type I18n = {\r\n locale: string\r\n language: Language\r\n m: Messages\r\n format: Formatter\r\n weekInfo: WeekInfo\r\n}\r\n\r\nexport type I18nContextValue = I18n & {\r\n setUserLocale: (locale: string | null) => void\r\n}\r\n\r\nexport const I18nContext = createContext<I18nContextValue | null>(null)\r\n","export const SUPPORTED_LANGUAGES = ['en', 'de'] as const\r\n\r\nexport type Language = (typeof SUPPORTED_LANGUAGES)[number]\r\n\r\nexport const DEFAULT_LOCALE = 'en-US'\r\n\r\nexport const LOCALE_CHOICES = ['auto', 'en-US', 'en-GB', 'de-DE'] as const\r\n\r\nexport type LocaleChoice = (typeof LOCALE_CHOICES)[number]\r\n\r\nconst isSupportedLanguage = (language: string): language is Language =>\r\n (SUPPORTED_LANGUAGES as readonly string[]).includes(language)\r\n\r\nconst canonicalize = (tag: string | null | undefined) => {\r\n if (!tag) return null\r\n try {\r\n return Intl.getCanonicalLocales(tag)[0] ?? null\r\n } catch {\r\n return null\r\n }\r\n}\r\n\r\nconst toSupportedLocale = (tag: string | null | undefined) => {\r\n const canonical = canonicalize(tag)\r\n if (!canonical) return null\r\n const { language, region } = new Intl.Locale(canonical)\r\n if (isSupportedLanguage(language)) return canonical\r\n const fallback = region ? `en-${region}` : null\r\n return fallback && Intl.DateTimeFormat.supportedLocalesOf(fallback).length > 0 ? fallback : null\r\n}\r\n\r\nexport const getLanguage = (locale: string): Language => {\r\n const { language } = new Intl.Locale(locale)\r\n return isSupportedLanguage(language) ? language : 'en'\r\n}\r\n\r\ntype LocaleSources = {\r\n user?: string | null\r\n host?: string | null\r\n browser?: readonly string[]\r\n}\r\n\r\nexport function resolveLocale({ user, host, browser = [] }: LocaleSources) {\r\n const candidates = [user === 'auto' ? null : user, host, ...browser]\r\n for (const candidate of candidates) {\r\n const locale = toSupportedLocale(candidate)\r\n if (locale) return locale\r\n }\r\n return DEFAULT_LOCALE\r\n}\r\n\r\nexport const getBrowserLanguages = () => (typeof navigator === 'undefined' ? [] : navigator.languages)\r\n","import type { Messages } from '../types.ts'\r\n\r\nexport const events: Messages['events'] = {\r\n createTitle: 'Neuer Termin',\r\n editTitle: 'Termin bearbeiten',\r\n title: 'Titel',\r\n startDate: 'Startdatum',\r\n startTime: 'Beginn',\r\n endDate: 'Enddatum',\r\n endTime: 'Ende',\r\n description: 'Beschreibung',\r\n color: 'Farbe',\r\n addCustomColor: 'Eigene Farbe hinzufügen',\r\n customColors: 'Eigene Farben',\r\n customColorsDescription: (max) =>\r\n `Bis zu ${max} Farben, die du beim Bearbeiten eines Termins hinzufügst. Termine behalten ihre Farbe, auch wenn du sie hier entfernst.`,\r\n noCustomColors: 'Noch keine eigenen Farben.',\r\n removeColor: (label) => `Farbe ${label} entfernen`,\r\n deleteTitle: 'Termin löschen?',\r\n deleteSeriesMessage: (title) =>\r\n `„${title}“ ist ein wiederkehrender Termin. Was soll gelöscht werden? Das kann nicht rückgängig gemacht werden.`,\r\n deleteMessage: (title) => `Soll „${title}“ wirklich gelöscht werden? Das kann nicht rückgängig gemacht werden.`,\r\n yes: 'Ja',\r\n no: 'Nein',\r\n scopeTitle: 'Wiederkehrenden Termin ändern',\r\n scopeMessage: 'Für welche Termine der Serie sollen die Änderungen gelten?',\r\n scopes: {\r\n single: 'Nur dieser Termin',\r\n following: 'Dieser und alle folgenden',\r\n all: 'Alle Termine',\r\n },\r\n repeat: 'Wiederholen',\r\n never: 'Nie',\r\n every: 'Alle',\r\n onTheseDays: 'An diesen Tagen',\r\n inMonth: 'Im Monat',\r\n ends: 'Endet',\r\n endsOnDate: 'Am Datum',\r\n endsAfterCount: 'Nach Anzahl',\r\n lastOccurrence: 'Letzter Termin',\r\n after: 'Nach',\r\n occurrences: { one: 'Termin', many: 'Terminen' },\r\n}\r\n","import type { Messages } from '../types.ts'\r\n\r\nexport const auth: Messages['auth'] = {\r\n name: 'Name',\r\n email: 'E-Mail-Adresse',\r\n password: 'Passwort',\r\n repeat: (label) => `${label} wiederholen`,\r\n passwordHint: (min) => `Mindestens ${min} Zeichen.`,\r\n validation: {\r\n nameRequired: 'Bitte einen Namen eingeben.',\r\n nameTooLong: (max) => `Der Name darf höchstens ${max} Zeichen lang sein.`,\r\n passwordRequired: 'Bitte das Passwort eingeben.',\r\n passwordTooShort: (min) => `Das Passwort muss mindestens ${min} Zeichen lang sein.`,\r\n passwordTooLong: (max) => `Das Passwort darf höchstens ${max} Zeichen lang sein.`,\r\n passwordMismatch: 'Die Passwörter stimmen nicht überein.',\r\n passwordUnchanged: 'Das neue Passwort muss sich vom aktuellen unterscheiden.',\r\n },\r\n login: {\r\n title: 'Anmelden',\r\n submit: 'Anmelden',\r\n pending: 'Wird angemeldet …',\r\n noAccount: 'Noch kein Konto?',\r\n registerLink: 'Jetzt registrieren',\r\n forgotPassword: 'Passwort vergessen?',\r\n },\r\n register: {\r\n title: 'Registrieren',\r\n submit: 'Konto erstellen',\r\n pending: 'Konto wird erstellt …',\r\n hasAccount: 'Schon ein Konto?',\r\n loginLink: 'Anmelden',\r\n },\r\n forgot: {\r\n title: 'Passwort vergessen',\r\n remembered: 'Wieder eingefallen?',\r\n loginLink: 'Anmelden',\r\n hint: 'Gib die E-Mail-Adresse deines Kontos ein. Wir schicken dir einen Link für ein neues Passwort.',\r\n success: (email) =>\r\n `Falls es ein Konto für ${email} gibt, haben wir dir einen Link zum Zurücksetzen geschickt. Er ist eine Stunde gültig.`,\r\n submit: 'Link senden',\r\n pending: 'Wird gesendet …',\r\n },\r\n reset: {\r\n title: 'Neues Passwort',\r\n newPassword: 'Neues Passwort',\r\n incompleteLink: 'Dieser Link ist unvollständig. Bitte fordere einen neuen an.',\r\n requestNewLink: 'Neuen Link anfordern',\r\n success: 'Dein Passwort wurde geändert.',\r\n submit: 'Passwort speichern',\r\n pending: 'Wird gespeichert …',\r\n },\r\n verify: {\r\n title: 'E-Mail bestätigen',\r\n verifying: 'E-Mail-Adresse wird bestätigt …',\r\n incompleteLink: 'Dieser Link ist unvollständig.',\r\n success: 'Deine E-Mail-Adresse ist bestätigt.',\r\n newLinkBefore: 'Einen neuen Link kannst du in den ',\r\n newLinkSettings: 'Einstellungen',\r\n newLinkAfter: ' anfordern.',\r\n bannerLabel: 'E-Mail-Bestätigung',\r\n bannerBefore: 'Bitte bestätige deine E-Mail-Adresse ',\r\n bannerAfter: ' über den Link in unserer E-Mail.',\r\n resend: 'Erneut senden',\r\n resent: 'E-Mail wurde erneut gesendet.',\r\n sending: 'Wird gesendet …',\r\n },\r\n continueToCalendar: 'Zum Kalender',\r\n signInNow: 'Jetzt anmelden',\r\n menu: {\r\n signIn: 'Anmelden',\r\n accountOf: (name) => `Konto von ${name}`,\r\n signOut: 'Abmelden',\r\n signingOut: 'Wird abgemeldet …',\r\n },\r\n account: {\r\n profile: 'Profil',\r\n savePending: 'Wird gespeichert …',\r\n emailTitle: 'E-Mail-Adresse',\r\n verified: 'Bestätigt',\r\n unverified: 'Nicht bestätigt',\r\n verificationSent: 'Wir haben dir einen Bestätigungslink geschickt. Nichts angekommen?',\r\n resendVerification: 'Bestätigungslink erneut senden',\r\n passwordTitle: 'Passwort ändern',\r\n passwordDescription: 'Andere Geräte werden danach abgemeldet.',\r\n currentPassword: 'Aktuelles Passwort',\r\n newPassword: 'Neues Passwort',\r\n passwordChanged: 'Dein Passwort wurde geändert.',\r\n passwordPending: 'Wird geändert …',\r\n passwordSubmit: 'Passwort ändern',\r\n deleteTitle: 'Konto löschen',\r\n deleteDescription: 'Löscht dein Konto mit allen persönlichen Terminen.',\r\n deleteOpen: 'Konto löschen …',\r\n deleteWarningBefore: 'Dein Konto, dein persönlicher Kalender und alle Termine darin werden ',\r\n deleteWarningStrong: 'endgültig gelöscht',\r\n deleteWarningAfter: '. Das lässt sich nicht rückgängig machen.',\r\n deletePassword: 'Passwort zur Bestätigung',\r\n deletePending: 'Wird gelöscht …',\r\n deleteSubmit: 'Endgültig löschen',\r\n },\r\n}\r\n","import type { Messages } from '../types.ts'\r\n\r\nexport const calendars: Messages['calendars'] = {\r\n personalName: 'Persönlich',\r\n roles: {\r\n owner: 'Owner',\r\n admin: 'Administrator',\r\n manager: 'Verwalter',\r\n editor: 'Redakteur',\r\n member: 'Mitglied',\r\n contributor: 'Beitragender',\r\n viewer: 'Betrachter',\r\n },\r\n roleDescriptions: {\r\n owner: 'Leitet den Kalender und hat immer alle Rechte.',\r\n admin: 'Verwaltet Kalender, Mitglieder und alle Termine. Kann den Kalender nicht löschen.',\r\n manager: 'Verwaltet den Kalender und alle Termine und lädt neue Mitglieder ein.',\r\n editor: 'Legt Termine an und bearbeitet und löscht alle Termine.',\r\n member: 'Legt Termine an und bearbeitet und löscht die eigenen.',\r\n contributor: 'Legt Termine an und bearbeitet die eigenen, löscht aber nichts.',\r\n viewer: 'Sieht den Kalender, ändert aber nichts.',\r\n },\r\n roleHint: (role, description) => `${role}: ${description}`,\r\n kind: {\r\n personal: 'Persönlicher Kalender',\r\n team: 'Team-Kalender',\r\n teamWithName: (team) => `Team-Kalender · ${team}`,\r\n },\r\n indicator: {\r\n onlyYou: 'Nur für dich',\r\n team: (role) => `Team · ${role}`,\r\n current: (name) => `Aktueller Kalender: ${name}`,\r\n },\r\n switcher: {\r\n open: 'Kalender wechseln',\r\n title: 'Kalender wechseln',\r\n personal: 'Persönlich',\r\n teams: 'Teams',\r\n active: 'Aktiv',\r\n openInvitations: (count) => (count === 1 ? 'Du hast eine offene Einladung.' : `Du hast ${count} offene Einladungen.`),\r\n view: 'Ansehen',\r\n noTeams: 'Du bist noch in keinem Team. Erstelle einen Kalender oder tritt über eine Einladung bei.',\r\n newCalendar: 'Neuer Kalender',\r\n },\r\n invitations: {\r\n title: 'Einladungen',\r\n description:\r\n 'Du wurdest in diese Kalender eingeladen. Nach dem Annehmen erscheinen sie unten und in „Kalender wechseln“.',\r\n invitedBy: (name) => `${name} lädt dich ein`,\r\n invited: 'Du bist eingeladen',\r\n validUntil: (date) => `gültig bis ${date}`,\r\n decline: 'Ablehnen',\r\n declining: 'Wird abgelehnt …',\r\n accept: 'Annehmen',\r\n accepting: 'Wird angenommen …',\r\n },\r\n list: {\r\n title: 'Kalender',\r\n description:\r\n 'Alle Kalender, auf die du Zugriff hast, mit deiner Rolle. Bei Team-Kalendern legst du fest, ob ihre Termine auch in deinem persönlichen Kalender erscheinen. Verlassen kannst du sie, außer du bist Owner. Dann musst du die Leitung vorher übergeben.',\r\n settingsFor: (name) => `Einstellungen für ${name}`,\r\n personalHint: 'Dein eigener Kalender. Er lässt sich nicht verlassen oder entfernen.',\r\n showInPersonal: 'Termine auch im persönlichen Kalender anzeigen',\r\n leave: 'Kalender verlassen',\r\n ownerCannotLeave: 'Als Owner kannst du den Kalender erst verlassen, wenn du die Leitung übergeben hast.',\r\n noTeamCalendars: 'Noch keine Team-Kalender. Erstelle einen oder tritt über eine Einladung bei.',\r\n create: 'Kalender erstellen',\r\n },\r\n leave: {\r\n title: 'Kalender verlassen?',\r\n confirm: 'Verlassen',\r\n pending: 'Wird verlassen …',\r\n message: (team) =>\r\n `Du verlässt das Team „${team}“ und siehst seinen Kalender nicht mehr. Zurück geht es nur über eine neue Einladung.`,\r\n },\r\n create: {\r\n title: 'Neuer Kalender',\r\n steps: [\r\n { label: 'Name', title: 'Wie heißt der Kalender?', hint: 'Name und Beschreibung sehen alle Mitglieder.' },\r\n { label: 'Farbe', title: 'Welche Farbe bekommt er?', hint: 'Neue Termine in diesem Kalender starten mit dieser Farbe.' },\r\n {\r\n label: 'Mitglieder',\r\n title: 'Wen möchtest du einladen?',\r\n hint: 'Eingeladene bekommen eine E-Mail und sehen den Kalender, sobald sie annehmen.',\r\n },\r\n { label: 'Überprüfen', title: 'Alles richtig?', hint: 'Du bist Owner und kannst alles später noch ändern.' },\r\n ],\r\n stepCount: (step, total) => `Schritt ${step} von ${total}`,\r\n next: 'Weiter',\r\n pending: 'Wird erstellt …',\r\n submit: 'Kalender erstellen',\r\n },\r\n details: {\r\n name: 'Name',\r\n namePlaceholder: 'z. B. Familie, Fußballverein, Projekt',\r\n description: 'Beschreibung',\r\n descriptionOptional: 'Beschreibung (optional)',\r\n descriptionPlaceholder: 'Wofür ist dieser Kalender?',\r\n yourRole: 'Deine Rolle',\r\n invitations: 'Einladungen',\r\n none: 'Keine',\r\n },\r\n invite: {\r\n email: 'E-Mail-Adresse',\r\n role: 'Rolle',\r\n add: 'Hinzufügen',\r\n nobodyYet: 'Noch niemand eingeladen. Das geht auch später noch.',\r\n remove: (email) => `${email} entfernen`,\r\n },\r\n validation: {\r\n nameRequired: 'Bitte einen Namen eingeben.',\r\n nameTooLong: (max) => `Der Name darf höchstens ${max} Zeichen lang sein.`,\r\n tooManyInvitations: (max) => `Höchstens ${max} Einladungen auf einmal.`,\r\n selfInvite: 'Du bist automatisch Owner und musst dich nicht einladen.',\r\n alreadyInvited: 'Diese Adresse ist schon eingeladen.',\r\n alreadyMember: 'Diese Person ist schon Mitglied.',\r\n },\r\n settings: {\r\n title: 'Kalender-Einstellungen',\r\n pageTitle: (name) => `${name} · Einstellungen`,\r\n notFound: 'Diesen Kalender gibt es nicht, oder du hast keinen Zugriff mehr.',\r\n tabsLabel: 'Bereiche der Kalender-Einstellungen',\r\n withCount: (label, count) => (count > 0 ? `${label} (${count})` : label),\r\n tabs: { general: 'Allgemein', members: 'Mitglieder', invitations: 'Einladungen', danger: 'Gefahrenbereich' },\r\n displayTitle: 'Anzeige',\r\n displayDescription: 'Gilt nur für dich. Andere Mitglieder stellen das selbst ein.',\r\n personalTitle: 'Persönlicher Kalender',\r\n personalHint:\r\n 'Nur du siehst diesen Kalender. Er lässt sich nicht teilen, verlassen oder löschen. Termine aus Team-Kalendern blendest du in deren Einstellungen ein oder aus.',\r\n },\r\n general: {\r\n title: 'Allgemein',\r\n teamDescription:\r\n 'Name und Farbe ändern Owner, Administratoren und Verwalter. Die Beschreibung ändern Owner und Administratoren.',\r\n personalDescription: 'Name und Farbe deines persönlichen Kalenders. Nur du siehst ihn.',\r\n pending: 'Wird gespeichert …',\r\n },\r\n members: {\r\n title: 'Mitglieder',\r\n description:\r\n 'Alle, die diesen Kalender sehen. Rollen ändern und Mitglieder entfernen dürfen Owner und Administratoren, und zwar nur bei Rollen unterhalb der eigenen.',\r\n you: ' (du)',\r\n roleOf: (name) => `Rolle von ${name}`,\r\n remove: 'Entfernen',\r\n removeTitle: 'Mitglied entfernen?',\r\n removing: 'Wird entfernt …',\r\n removeMessage: (name, calendar) =>\r\n `${name} sieht „${calendar}“ danach nicht mehr. Zurück geht es nur über eine neue Einladung.`,\r\n },\r\n teamInvitations: {\r\n title: 'Einladungen',\r\n description:\r\n 'Neue Mitglieder per E-Mail einladen. Du kannst nur Rollen unterhalb deiner eigenen vergeben. Eine Einladung ist 7 Tage gültig.',\r\n revoke: 'Zurückziehen',\r\n revoking: 'Wird zurückgezogen …',\r\n submit: 'Einladen',\r\n sending: 'Wird gesendet …',\r\n sent: (email) => `Einladung an ${email} verschickt.`,\r\n none: 'Keine offenen Einladungen.',\r\n },\r\n danger: {\r\n title: 'Gefahrenbereich',\r\n transferHint:\r\n 'Ein anderes Mitglied wird Owner, du wirst Administrator. Zurück geht es nur, wenn der neue Owner dir die Rolle wieder gibt.',\r\n transferUnavailable: 'Zum Übertragen braucht das Team ein weiteres Mitglied, das noch nicht Owner ist.',\r\n transfer: 'Leitung übertragen',\r\n lastOwnerHint: 'Als einziger Owner kannst du nicht austreten. Übertrage vorher die Leitung oder lösche das Team.',\r\n leaveHint: 'Du siehst den Kalender danach nicht mehr. Zurück geht es nur über eine neue Einladung.',\r\n deleteHint: (team) => `Löscht das Team „${team}“ mit allen Kalendern, Terminen und Einladungen für alle Mitglieder.`,\r\n deleteTeam: 'Team löschen',\r\n transferConfirmTitle: 'Leitung wirklich übertragen?',\r\n transferConfirm: 'Endgültig übertragen',\r\n transferring: 'Wird übertragen …',\r\n transferMessage: (name, email, team, role) =>\r\n `${name} (${email}) wird Owner von „${team}“ und bekommt alle Rechte, auch zum Löschen des Teams. Du wirst ${role} und kannst das Team danach nicht mehr löschen oder die Leitung selbst zurückholen.`,\r\n deleteTitle: 'Team löschen?',\r\n deleteConfirm: 'Endgültig löschen',\r\n deleting: 'Wird gelöscht …',\r\n deleteMessage: (team, count) =>\r\n `„${team}“ wird mit allen Kalendern, Terminen und Einladungen gelöscht, auch für alle ${count} Mitglieder. Das kann nicht rückgängig gemacht werden.`,\r\n },\r\n transfer: {\r\n title: 'Leitung übertragen',\r\n search: 'Mitglied suchen',\r\n searchPlaceholder: 'Name oder E-Mail',\r\n noResults: 'Kein Mitglied gefunden.',\r\n newOwner: 'Neuer Owner',\r\n confirm: 'Bestätigen',\r\n },\r\n}\r\n","import type { Messages } from '../types.ts'\r\n\r\nexport const settings: Messages['settings'] = {\r\n tabsLabel: 'Bereiche der Einstellungen',\r\n tabs: { calendars: 'Kalender', appearance: 'Darstellung', account: 'Konto' },\r\n languageTitle: 'Sprache und Region',\r\n languageDescription: 'Bestimmt Sprache, Datums- und Zeitformate und den ersten Tag der Woche.',\r\n languageLabel: 'Sprache',\r\n languages: {\r\n auto: 'Automatisch (Browser)',\r\n 'en-US': 'English (US)',\r\n 'en-GB': 'English (UK)',\r\n 'de-DE': 'Deutsch',\r\n },\r\n themeTitle: 'Farbschema',\r\n themeLabel: 'Hell oder dunkel',\r\n startViewTitle: 'Startansicht',\r\n startViewDescription: 'Mit dieser Ansicht öffnet sich der Kalender.',\r\n desktop: 'Computer und Tablet',\r\n mobile: 'Handy',\r\n}\r\n","import type { Messages } from '../types.ts'\r\n\r\nexport const storage: Messages['storage'] = {\r\n importTitle: 'Lokale Termine übernehmen?',\r\n importMessage: (count) =>\r\n `In diesem Browser ${count === 1 ? 'ist ein Termin' : `sind ${count} Termine`} ohne Konto gespeichert. Sollen sie in dein Konto übernommen werden? Danach sind sie auf allen Geräten verfügbar und werden hier lokal entfernt.`,\r\n importing: 'Wird übernommen …',\r\n importConfirm: 'In mein Konto übernehmen',\r\n keepLocal: 'Nur in diesem Browser behalten',\r\n}\r\n","import type { Messages } from '../types.ts'\r\n\r\nexport const views: Messages['views'] = {\r\n label: 'Ansicht',\r\n day: { label: 'Tag', previous: 'Vorheriger Tag', next: 'Nächster Tag' },\r\n week: { label: 'Woche', previous: 'Vorherige Woche', next: 'Nächste Woche' },\r\n month: { label: 'Monat', previous: 'Vorheriger Monat', next: 'Nächster Monat' },\r\n year: { label: 'Jahr', previous: 'Vorheriges Jahr', next: 'Nächstes Jahr' },\r\n weekNumber: (week) => `KW ${week}`,\r\n weekNumberLong: (week) => `Kalenderwoche ${week}`,\r\n}\r\n\r\nexport const calendar: Messages['calendar'] = {\r\n today: 'Heute',\r\n newEvent: 'Neuer Termin',\r\n now: (time) => `Jetzt: ${time}`,\r\n openDay: (date) => `${date} öffnen`,\r\n moreEvents: (count) => `+${count} weitere`,\r\n fromCalendar: (name) => `Aus dem Kalender „${name}“`,\r\n sharedEventNotice: (source) => `${source}. Änderungen sehen alle Mitglieder.`,\r\n}\r\n","import type { Messages } from '../types.ts'\r\n\r\nexport const common: Messages['common'] = {\r\n loading: 'Lädt …',\r\n close: 'Schließen',\r\n cancel: 'Abbrechen',\r\n save: 'Speichern',\r\n saving: 'Wird gespeichert …',\r\n saved: 'Gespeichert.',\r\n delete: 'Löschen',\r\n deleting: 'Wird gelöscht …',\r\n backToCalendar: 'Zum Kalender',\r\n backToSettings: 'Zu den Einstellungen',\r\n settings: 'Einstellungen',\r\n progress: 'Fortschritt',\r\n next: 'Weiter',\r\n back: 'Zurück',\r\n}\r\n\r\nexport const errors: Messages['errors'] = {\r\n unknown: 'Ein unbekannter Fehler ist aufgetreten.',\r\n eventNotFound: 'Der Termin wurde nicht gefunden.',\r\n accountRequired: 'Team-Kalender gibt es nur mit Konto.',\r\n saveEventsFailed: 'Die Termine konnten nicht lokal gespeichert werden.',\r\n savePreferencesFailed: 'Die Einstellungen konnten nicht lokal gespeichert werden.',\r\n saveColorFailed: 'Die Farbe konnte nicht lokal gespeichert werden.',\r\n saveDecisionFailed: 'Die Entscheidung konnte nicht gespeichert werden.',\r\n invalidLink: 'Der Link ist ungültig oder abgelaufen.',\r\n invalidResetLink: 'Der Link ist ungültig oder abgelaufen. Bitte fordere einen neuen an.',\r\n invalidCredentials: 'E-Mail-Adresse oder Passwort ist falsch.',\r\n emailTaken: 'Für diese E-Mail-Adresse gibt es bereits ein Konto.',\r\n wrongCurrentPassword: 'Das aktuelle Passwort ist falsch.',\r\n wrongPassword: 'Das Passwort ist falsch.',\r\n soleOwner: 'Du bist einziger Owner eines Teams mit weiteren Mitgliedern. Bitte übergib zuerst die Leitung.',\r\n unauthorized: 'Bitte melde dich an.',\r\n forbidden: 'Dazu fehlt dir die Berechtigung.',\r\n notFound: 'Der Eintrag wurde nicht gefunden.',\r\n payloadTooLarge: 'Die Daten sind zu groß.',\r\n calendarNotFound: 'Der Kalender wurde nicht gefunden.',\r\n teamNotFound: 'Das Team wurde nicht gefunden.',\r\n memberNotFound: 'Das Mitglied wurde nicht gefunden.',\r\n invitationNotFound: 'Die Einladung wurde nicht gefunden.',\r\n invitationExpired: 'Die Einladung ist nicht mehr gültig.',\r\n tooManyLoginAttempts: 'Zu viele Fehlversuche. Bitte warte ein paar Minuten.',\r\n seriesHasDetached: 'Die Serie hat einzeln geänderte Termine. Bitte diese zuerst löschen.',\r\n selfInvite: 'Du kannst dich nicht selbst einladen.',\r\n alreadyMember: 'Diese Person ist schon Mitglied.',\r\n alreadyInvited: 'Diese Adresse ist schon eingeladen.',\r\n personalTeam: 'Im persönlichen Kalender ist das nicht möglich.',\r\n lastOwner: 'Ein Team braucht mindestens einen Owner. Übertrage vorher die Leitung oder lösche das Team.',\r\n alreadyOwner: 'Dieses Mitglied ist bereits Owner.',\r\n lastCalendar: 'Das ist der letzte Kalender des Teams. Lösche stattdessen das Team.',\r\n tooManyColors: 'Du kannst höchstens 12 eigene Farben speichern.',\r\n managedByHost: 'Dein Konto wird von der Website verwaltet, auf der du den Kalender nutzt.',\r\n unknownTenant: 'Dieser Kalender ist nicht richtig eingerichtet (unbekannter Tenant).',\r\n originNotAllowed: 'Dieser Kalender darf auf dieser Website nicht verwendet werden.',\r\n invalidUserToken: 'Deine Anmeldung konnte nicht bestätigt werden. Bitte lade die Seite neu.',\r\n status: {\r\n 400: 'Die Anfrage war ungültig.',\r\n 401: 'Bitte melde dich an.',\r\n 403: 'Dafür fehlt dir die Berechtigung.',\r\n 404: 'Der Eintrag wurde nicht gefunden.',\r\n 409: 'Der Eintrag wurde inzwischen geändert. Bitte neu laden.',\r\n 413: 'Die Daten sind zu groß.',\r\n 422: 'Die Eingaben sind ungültig.',\r\n 429: 'Zu viele Anfragen. Bitte kurz warten.',\r\n },\r\n serverError: 'Auf dem Server ist ein Fehler aufgetreten.',\r\n requestFailed: (status) => `Die Anfrage ist fehlgeschlagen (${status}).`,\r\n kind: {\r\n timeout: 'Der Server hat nicht rechtzeitig geantwortet.',\r\n network: 'Der Server ist nicht erreichbar.',\r\n aborted: 'Die Anfrage wurde abgebrochen.',\r\n parse: 'Die Antwort des Servers konnte nicht gelesen werden.',\r\n },\r\n}\r\n\r\nexport const validation: Messages['validation'] = {\r\n emailRequired: 'Bitte eine E-Mail-Adresse eingeben.',\r\n emailInvalid: 'Bitte eine gültige E-Mail-Adresse eingeben.',\r\n integerRange: (min, max) => `Bitte eine ganze Zahl von ${min} bis ${max} eingeben.`,\r\n titleRequired: 'Bitte einen Titel eingeben.',\r\n titleTooLong: (max) => `Der Titel darf höchstens ${max} Zeichen lang sein.`,\r\n descriptionTooLong: (max) => `Die Beschreibung darf höchstens ${max} Zeichen lang sein.`,\r\n startDateInvalid: 'Bitte ein gültiges Startdatum wählen.',\r\n startTimeInvalid: 'Bitte eine gültige Startzeit wählen.',\r\n endDateInvalid: 'Bitte ein gültiges Enddatum wählen.',\r\n endTimeInvalid: 'Bitte eine gültige Endzeit wählen.',\r\n endDateBeforeStart: 'Das Enddatum darf nicht vor dem Startdatum liegen.',\r\n endBeforeStart: 'Das Ende muss nach dem Beginn liegen.',\r\n weekdaysRequired: 'Bitte mindestens einen Wochentag wählen.',\r\n dateInvalid: 'Bitte ein gültiges Datum wählen.',\r\n untilBeforeStart: 'Das Ende der Wiederholung darf nicht vor dem Startdatum liegen.',\r\n}\r\n\r\nexport const colors: Messages['colors'] = {\r\n blue: 'Blau',\r\n red: 'Rot',\r\n green: 'Grün',\r\n yellow: 'Gelb',\r\n}\r\n\r\nexport const themes: Messages['themes'] = {\r\n system: 'Automatisch',\r\n light: 'Hell',\r\n dark: 'Dunkel',\r\n}\r\n\r\nexport const recurrence: Messages['recurrence'] = {\r\n frequency: { daily: 'Täglich', weekly: 'Wöchentlich', monthly: 'Monatlich', yearly: 'Jährlich' },\r\n units: {\r\n daily: { one: 'Tag', many: 'Tage' },\r\n weekly: { one: 'Woche', many: 'Wochen' },\r\n monthly: { one: 'Monat', many: 'Monate' },\r\n yearly: { one: 'Jahr', many: 'Jahre' },\r\n },\r\n every: (interval, unit) => `Alle ${interval} ${unit}`,\r\n onWeekdays: (weekdays) => ` am ${weekdays}`,\r\n onDate: (date) => ` am ${date}`,\r\n monthlyOnDay: (day) => `am ${day}.`,\r\n monthlyOnWeekday: (ordinal, weekday) => `am ${['ersten', 'zweiten', 'dritten', 'vierten', 'fünften'][ordinal - 1]} ${weekday}`,\r\n monthlyOnLastWeekday: (weekday) => `am letzten ${weekday}`,\r\n until: (date) => ` bis ${date}`,\r\n times: (count) => (count === 1 ? ', einmal' : `, ${count}-mal`),\r\n}\r\n","import type { Messages } from '../types.ts'\r\nimport { events } from './events.ts'\r\nimport { auth } from './auth.ts'\r\nimport { calendars } from './calendars.ts'\r\nimport { settings } from './settings.ts'\r\nimport { storage } from './storage.ts'\r\nimport { calendar, views } from './calendar.ts'\r\nimport { colors, common, errors, recurrence, themes, validation } from './core.ts'\r\n\r\nexport const de: Messages = { common, errors, validation, colors, themes, recurrence, views, calendar, events, storage, settings, auth, calendars }\r\n","export const events = {\r\n createTitle: 'New event',\r\n editTitle: 'Edit event',\r\n title: 'Title',\r\n startDate: 'Start date',\r\n startTime: 'Start',\r\n endDate: 'End date',\r\n endTime: 'End',\r\n description: 'Description',\r\n color: 'Color',\r\n addCustomColor: 'Add custom color',\r\n customColors: 'Custom colors',\r\n customColorsDescription: (max: number) =>\r\n `Up to ${max} colors that you add while editing an event. Events keep their color even if you remove it here.`,\r\n noCustomColors: 'No custom colors yet.',\r\n removeColor: (label: string) => `Remove color ${label}`,\r\n deleteTitle: 'Delete event?',\r\n deleteSeriesMessage: (title: string) =>\r\n `“${title}” is a recurring event. What should be deleted? This cannot be undone.`,\r\n deleteMessage: (title: string) => `Do you really want to delete “${title}”? This cannot be undone.`,\r\n yes: 'Yes',\r\n no: 'No',\r\n scopeTitle: 'Change recurring event',\r\n scopeMessage: 'Which events in the series should the changes apply to?',\r\n scopes: {\r\n single: 'This event only',\r\n following: 'This and all following events',\r\n all: 'All events',\r\n },\r\n repeat: 'Repeat',\r\n never: 'Never',\r\n every: 'Every',\r\n onTheseDays: 'On these days',\r\n inMonth: 'In the month',\r\n ends: 'Ends',\r\n endsOnDate: 'On date',\r\n endsAfterCount: 'After a number',\r\n lastOccurrence: 'Last event',\r\n after: 'After',\r\n occurrences: { one: 'event', many: 'events' },\r\n}\r\n","export const auth = {\r\n name: 'Name',\r\n email: 'Email address',\r\n password: 'Password',\r\n repeat: (label: string) => `Repeat ${label.charAt(0).toLowerCase()}${label.slice(1)}`,\r\n passwordHint: (min: number) => `At least ${min} characters.`,\r\n validation: {\r\n nameRequired: 'Please enter a name.',\r\n nameTooLong: (max: number) => `The name can be at most ${max} characters long.`,\r\n passwordRequired: 'Please enter the password.',\r\n passwordTooShort: (min: number) => `The password must be at least ${min} characters long.`,\r\n passwordTooLong: (max: number) => `The password can be at most ${max} characters long.`,\r\n passwordMismatch: 'The passwords do not match.',\r\n passwordUnchanged: 'The new password must be different from the current one.',\r\n },\r\n login: {\r\n title: 'Sign in',\r\n submit: 'Sign in',\r\n pending: 'Signing in …',\r\n noAccount: 'No account yet?',\r\n registerLink: 'Register now',\r\n forgotPassword: 'Forgot password?',\r\n },\r\n register: {\r\n title: 'Register',\r\n submit: 'Create account',\r\n pending: 'Creating account …',\r\n hasAccount: 'Already have an account?',\r\n loginLink: 'Sign in',\r\n },\r\n forgot: {\r\n title: 'Forgot password',\r\n remembered: 'Remembered it?',\r\n loginLink: 'Sign in',\r\n hint: 'Enter the email address of your account. We will send you a link to set a new password.',\r\n success: (email: string) =>\r\n `If an account exists for ${email}, we have sent you a link to reset your password. It is valid for one hour.`,\r\n submit: 'Send link',\r\n pending: 'Sending …',\r\n },\r\n reset: {\r\n title: 'New password',\r\n newPassword: 'New password',\r\n incompleteLink: 'This link is incomplete. Please request a new one.',\r\n requestNewLink: 'Request a new link',\r\n success: 'Your password has been changed.',\r\n submit: 'Save password',\r\n pending: 'Saving …',\r\n },\r\n verify: {\r\n title: 'Confirm email',\r\n verifying: 'Confirming email address …',\r\n incompleteLink: 'This link is incomplete.',\r\n success: 'Your email address is confirmed.',\r\n newLinkBefore: 'You can request a new link in the ',\r\n newLinkSettings: 'settings',\r\n newLinkAfter: '.',\r\n bannerLabel: 'Email confirmation',\r\n bannerBefore: 'Please confirm your email address ',\r\n bannerAfter: ' using the link in our email.',\r\n resend: 'Send again',\r\n resent: 'The email has been sent again.',\r\n sending: 'Sending …',\r\n },\r\n continueToCalendar: 'Go to calendar',\r\n signInNow: 'Sign in now',\r\n menu: {\r\n signIn: 'Sign in',\r\n accountOf: (name: string) => `Account of ${name}`,\r\n signOut: 'Sign out',\r\n signingOut: 'Signing out …',\r\n },\r\n account: {\r\n profile: 'Profile',\r\n savePending: 'Saving …',\r\n emailTitle: 'Email address',\r\n verified: 'Confirmed',\r\n unverified: 'Not confirmed',\r\n verificationSent: 'We have sent you a confirmation link. Nothing arrived?',\r\n resendVerification: 'Resend confirmation link',\r\n passwordTitle: 'Change password',\r\n passwordDescription: 'Other devices will be signed out afterwards.',\r\n currentPassword: 'Current password',\r\n newPassword: 'New password',\r\n passwordChanged: 'Your password has been changed.',\r\n passwordPending: 'Changing …',\r\n passwordSubmit: 'Change password',\r\n deleteTitle: 'Delete account',\r\n deleteDescription: 'Deletes your account with all personal events.',\r\n deleteOpen: 'Delete account …',\r\n deleteWarningBefore: 'Your account, your personal calendar and all events in it will be ',\r\n deleteWarningStrong: 'permanently deleted',\r\n deleteWarningAfter: '. This cannot be undone.',\r\n deletePassword: 'Password for confirmation',\r\n deletePending: 'Deleting …',\r\n deleteSubmit: 'Delete permanently',\r\n },\r\n}\r\n","import type { TeamRole } from '../../../features/calendars/types/calendar.ts'\r\n\r\nexport const calendars = {\r\n personalName: 'Personal',\r\n roles: {\r\n owner: 'Owner',\r\n admin: 'Administrator',\r\n manager: 'Manager',\r\n editor: 'Editor',\r\n member: 'Member',\r\n contributor: 'Contributor',\r\n viewer: 'Viewer',\r\n } satisfies Record<TeamRole, string>,\r\n roleDescriptions: {\r\n owner: 'Leads the calendar and always has all permissions.',\r\n admin: 'Manages calendars, members and all events. Cannot delete the calendar.',\r\n manager: 'Manages the calendar and all events and invites new members.',\r\n editor: 'Creates events and edits and deletes all events.',\r\n member: 'Creates events and edits and deletes their own.',\r\n contributor: 'Creates events and edits their own, but deletes nothing.',\r\n viewer: 'Sees the calendar but changes nothing.',\r\n } satisfies Record<TeamRole, string>,\r\n roleHint: (role: string, description: string) => `${role}: ${description}`,\r\n kind: {\r\n personal: 'Personal calendar',\r\n team: 'Team calendar',\r\n teamWithName: (team: string) => `Team calendar · ${team}`,\r\n },\r\n indicator: {\r\n onlyYou: 'Only for you',\r\n team: (role: string) => `Team · ${role}`,\r\n current: (name: string) => `Current calendar: ${name}`,\r\n },\r\n switcher: {\r\n open: 'Switch calendar',\r\n title: 'Switch calendar',\r\n personal: 'Personal',\r\n teams: 'Teams',\r\n active: 'Active',\r\n openInvitations: (count: number) =>\r\n count === 1 ? 'You have one open invitation.' : `You have ${count} open invitations.`,\r\n view: 'View',\r\n noTeams: 'You are not in a team yet. Create a calendar or join one through an invitation.',\r\n newCalendar: 'New calendar',\r\n },\r\n invitations: {\r\n title: 'Invitations',\r\n description: 'You have been invited to these calendars. Once accepted, they appear below and in “Switch calendar”.',\r\n invitedBy: (name: string) => `${name} invited you`,\r\n invited: 'You are invited',\r\n validUntil: (date: string) => `valid until ${date}`,\r\n decline: 'Decline',\r\n declining: 'Declining …',\r\n accept: 'Accept',\r\n accepting: 'Accepting …',\r\n },\r\n list: {\r\n title: 'Calendars',\r\n description:\r\n 'All calendars you have access to, with your role. For team calendars you decide whether their events also appear in your personal calendar. You can leave them unless you are the owner. Then you have to hand over ownership first.',\r\n settingsFor: (name: string) => `Settings for ${name}`,\r\n personalHint: 'Your own calendar. It cannot be left or removed.',\r\n showInPersonal: 'Also show events in the personal calendar',\r\n leave: 'Leave calendar',\r\n ownerCannotLeave: 'As the owner, you can only leave the calendar after handing over ownership.',\r\n noTeamCalendars: 'No team calendars yet. Create one or join one through an invitation.',\r\n create: 'Create calendar',\r\n },\r\n leave: {\r\n title: 'Leave calendar?',\r\n confirm: 'Leave',\r\n pending: 'Leaving …',\r\n message: (team: string) =>\r\n `You are leaving the team “${team}” and will no longer see its calendar. You can only come back through a new invitation.`,\r\n },\r\n create: {\r\n title: 'New calendar',\r\n steps: [\r\n { label: 'Name', title: 'What is the calendar called?', hint: 'All members see the name and description.' },\r\n { label: 'Color', title: 'Which color should it get?', hint: 'New events in this calendar start with this color.' },\r\n {\r\n label: 'Members',\r\n title: 'Who do you want to invite?',\r\n hint: 'Invitees receive an email and see the calendar as soon as they accept.',\r\n },\r\n { label: 'Review', title: 'Is everything correct?', hint: 'You are the owner and can change everything later.' },\r\n ],\r\n stepCount: (step: number, total: number) => `Step ${step} of ${total}`,\r\n next: 'Next',\r\n pending: 'Creating …',\r\n submit: 'Create calendar',\r\n },\r\n details: {\r\n name: 'Name',\r\n namePlaceholder: 'e.g. Family, football club, project',\r\n description: 'Description',\r\n descriptionOptional: 'Description (optional)',\r\n descriptionPlaceholder: 'What is this calendar for?',\r\n yourRole: 'Your role',\r\n invitations: 'Invitations',\r\n none: 'None',\r\n },\r\n invite: {\r\n email: 'Email address',\r\n role: 'Role',\r\n add: 'Add',\r\n nobodyYet: 'Nobody invited yet. You can do that later too.',\r\n remove: (email: string) => `Remove ${email}`,\r\n },\r\n validation: {\r\n nameRequired: 'Please enter a name.',\r\n nameTooLong: (max: number) => `The name can be at most ${max} characters long.`,\r\n tooManyInvitations: (max: number) => `At most ${max} invitations at once.`,\r\n selfInvite: 'You are automatically the owner and do not need to invite yourself.',\r\n alreadyInvited: 'This address has already been invited.',\r\n alreadyMember: 'This person is already a member.',\r\n },\r\n settings: {\r\n title: 'Calendar settings',\r\n pageTitle: (name: string) => `${name} · Settings`,\r\n notFound: 'This calendar does not exist, or you no longer have access to it.',\r\n tabsLabel: 'Calendar settings sections',\r\n withCount: (label: string, count: number) => (count > 0 ? `${label} (${count})` : label),\r\n tabs: { general: 'General', members: 'Members', invitations: 'Invitations', danger: 'Danger zone' },\r\n displayTitle: 'Display',\r\n displayDescription: 'Applies only to you. Other members set this themselves.',\r\n personalTitle: 'Personal calendar',\r\n personalHint:\r\n 'Only you see this calendar. It cannot be shared, left or deleted. You show or hide events from team calendars in their settings.',\r\n },\r\n general: {\r\n title: 'General',\r\n teamDescription:\r\n 'Owners, administrators and managers change the name and color. Owners and administrators change the description.',\r\n personalDescription: 'Name and color of your personal calendar. Only you see it.',\r\n pending: 'Saving …',\r\n },\r\n members: {\r\n title: 'Members',\r\n description:\r\n 'Everyone who sees this calendar. Owners and administrators can change roles and remove members, but only for roles below their own.',\r\n you: ' (you)',\r\n roleOf: (name: string) => `Role of ${name}`,\r\n remove: 'Remove',\r\n removeTitle: 'Remove member?',\r\n removing: 'Removing …',\r\n removeMessage: (name: string, calendar: string) =>\r\n `${name} will no longer see “${calendar}”. They can only come back through a new invitation.`,\r\n },\r\n teamInvitations: {\r\n title: 'Invitations',\r\n description:\r\n 'Invite new members by email. You can only assign roles below your own. An invitation is valid for 7 days.',\r\n revoke: 'Withdraw',\r\n revoking: 'Withdrawing …',\r\n submit: 'Invite',\r\n sending: 'Sending …',\r\n sent: (email: string) => `Invitation sent to ${email}.`,\r\n none: 'No open invitations.',\r\n },\r\n danger: {\r\n title: 'Danger zone',\r\n transferHint:\r\n 'Another member becomes the owner and you become an administrator. You only get the role back if the new owner gives it to you.',\r\n transferUnavailable: 'To transfer ownership, the team needs another member who is not yet an owner.',\r\n transfer: 'Transfer ownership',\r\n lastOwnerHint: 'As the only owner you cannot leave. Transfer ownership first or delete the team.',\r\n leaveHint: 'You will no longer see the calendar. You can only come back through a new invitation.',\r\n deleteHint: (team: string) => `Deletes the team “${team}” with all calendars, events and invitations for all members.`,\r\n deleteTeam: 'Delete team',\r\n transferConfirmTitle: 'Really transfer ownership?',\r\n transferConfirm: 'Transfer permanently',\r\n transferring: 'Transferring …',\r\n transferMessage: (name: string, email: string, team: string, role: string) =>\r\n `${name} (${email}) becomes the owner of “${team}” and gets all permissions, including deleting the team. You become ${role} and can then no longer delete the team or take back ownership yourself.`,\r\n deleteTitle: 'Delete team?',\r\n deleteConfirm: 'Delete permanently',\r\n deleting: 'Deleting …',\r\n deleteMessage: (team: string, count: number) =>\r\n `“${team}” will be deleted with all calendars, events and invitations, for all ${count} members as well. This cannot be undone.`,\r\n },\r\n transfer: {\r\n title: 'Transfer ownership',\r\n search: 'Search members',\r\n searchPlaceholder: 'Name or email',\r\n noResults: 'No member found.',\r\n newOwner: 'New owner',\r\n confirm: 'Confirm',\r\n },\r\n}\r\n","export const settings = {\r\n tabsLabel: 'Settings sections',\r\n tabs: { calendars: 'Calendars', appearance: 'Appearance', account: 'Account' },\r\n languageTitle: 'Language and region',\r\n languageDescription: 'Controls the language, date and time formats and the first day of the week.',\r\n languageLabel: 'Language',\r\n languages: {\r\n auto: 'Automatic (browser)',\r\n 'en-US': 'English (US)',\r\n 'en-GB': 'English (UK)',\r\n 'de-DE': 'Deutsch',\r\n },\r\n themeTitle: 'Color scheme',\r\n themeLabel: 'Light or dark',\r\n startViewTitle: 'Start view',\r\n startViewDescription: 'The calendar opens in this view.',\r\n desktop: 'Computer and tablet',\r\n mobile: 'Phone',\r\n}\r\n","export const storage = {\r\n importTitle: 'Import local events?',\r\n importMessage: (count: number) =>\r\n `${count === 1 ? 'One event is' : `${count} events are`} stored in this browser without an account. Do you want to move ${count === 1 ? 'it' : 'them'} to your account? ${count === 1 ? 'It' : 'They'} will then be available on all your devices and removed from this browser.`,\r\n importing: 'Importing …',\r\n importConfirm: 'Move to my account',\r\n keepLocal: 'Keep in this browser only',\r\n}\r\n","export const views = {\r\n label: 'View',\r\n day: { label: 'Day', previous: 'Previous day', next: 'Next day' },\r\n week: { label: 'Week', previous: 'Previous week', next: 'Next week' },\r\n month: { label: 'Month', previous: 'Previous month', next: 'Next month' },\r\n year: { label: 'Year', previous: 'Previous year', next: 'Next year' },\r\n weekNumber: (week: number) => `Wk ${week}`,\r\n weekNumberLong: (week: number) => `Week ${week}`,\r\n}\r\n\r\nexport const calendar = {\r\n today: 'Today',\r\n newEvent: 'New event',\r\n now: (time: string) => `Now: ${time}`,\r\n openDay: (date: string) => `Open ${date}`,\r\n moreEvents: (count: number) => `+${count} more`,\r\n fromCalendar: (name: string) => `From the calendar “${name}”`,\r\n sharedEventNotice: (source: string) => `${source}. All members see changes.`,\r\n}\r\n","import type { ErrorCode } from '../../../utils/appError.ts'\r\nimport type { ApiErrorKind } from '../../../utils/apiError.ts'\r\n\r\nexport const common = {\r\n loading: 'Loading …',\r\n close: 'Close',\r\n cancel: 'Cancel',\r\n save: 'Save',\r\n saving: 'Saving …',\r\n saved: 'Saved.',\r\n delete: 'Delete',\r\n deleting: 'Deleting …',\r\n backToCalendar: 'Back to calendar',\r\n backToSettings: 'Back to settings',\r\n settings: 'Settings',\r\n progress: 'Progress',\r\n next: 'Next',\r\n back: 'Back',\r\n}\r\n\r\nexport const errors: Record<ErrorCode, string> & {\r\n status: Partial<Record<number, string>>\r\n serverError: string\r\n requestFailed: (status: number) => string\r\n kind: Record<Exclude<ApiErrorKind, 'http'>, string>\r\n} = {\r\n unknown: 'An unknown error occurred.',\r\n eventNotFound: 'The event could not be found.',\r\n accountRequired: 'Team calendars require an account.',\r\n saveEventsFailed: 'The events could not be saved in this browser.',\r\n savePreferencesFailed: 'The settings could not be saved in this browser.',\r\n saveColorFailed: 'The color could not be saved in this browser.',\r\n saveDecisionFailed: 'Your choice could not be saved in this browser.',\r\n invalidLink: 'This link is invalid or has expired.',\r\n invalidResetLink: 'This link is invalid or has expired. Please request a new one.',\r\n invalidCredentials: 'Email address or password is incorrect.',\r\n emailTaken: 'An account with this email address already exists.',\r\n wrongCurrentPassword: 'The current password is incorrect.',\r\n wrongPassword: 'The password is incorrect.',\r\n soleOwner: 'You are the only owner of a team with other members. Please transfer ownership first.',\r\n unauthorized: 'Please sign in.',\r\n forbidden: 'You do not have permission to do that.',\r\n notFound: 'The item could not be found.',\r\n payloadTooLarge: 'The data is too large.',\r\n calendarNotFound: 'The calendar could not be found.',\r\n teamNotFound: 'The team could not be found.',\r\n memberNotFound: 'The member could not be found.',\r\n invitationNotFound: 'The invitation could not be found.',\r\n invitationExpired: 'This invitation is no longer valid.',\r\n tooManyLoginAttempts: 'Too many failed attempts. Please wait a few minutes.',\r\n seriesHasDetached: 'The series has separately edited events. Please delete them first.',\r\n selfInvite: 'You cannot invite yourself.',\r\n alreadyMember: 'This person is already a member.',\r\n alreadyInvited: 'This address has already been invited.',\r\n personalTeam: 'This is not possible in the personal calendar.',\r\n lastOwner: 'A team needs at least one owner. Transfer ownership or delete the team first.',\r\n alreadyOwner: 'This member is already an owner.',\r\n lastCalendar: 'This is the last calendar of the team. Delete the team instead.',\r\n tooManyColors: 'You can save at most 12 custom colors.',\r\n managedByHost: 'Your account is managed by the website you are using.',\r\n unknownTenant: 'This calendar is not set up correctly (unknown tenant).',\r\n originNotAllowed: 'This calendar may not be used on this website.',\r\n invalidUserToken: 'Your sign-in could not be confirmed. Please reload the page.',\r\n status: {\r\n 400: 'The request was invalid.',\r\n 401: 'Please sign in.',\r\n 403: 'You do not have permission to do that.',\r\n 404: 'The item could not be found.',\r\n 409: 'The item has changed in the meantime. Please reload.',\r\n 413: 'The data is too large.',\r\n 422: 'The input is invalid.',\r\n 429: 'Too many requests. Please wait a moment.',\r\n },\r\n serverError: 'Something went wrong on the server.',\r\n requestFailed: (status) => `The request failed (${status}).`,\r\n kind: {\r\n timeout: 'The server did not respond in time.',\r\n network: 'The server cannot be reached.',\r\n aborted: 'The request was cancelled.',\r\n parse: 'The server response could not be read.',\r\n },\r\n}\r\n\r\nexport const validation = {\r\n emailRequired: 'Please enter an email address.',\r\n emailInvalid: 'Please enter a valid email address.',\r\n integerRange: (min: number, max: number) => `Please enter a whole number from ${min} to ${max}.`,\r\n titleRequired: 'Please enter a title.',\r\n titleTooLong: (max: number) => `The title can be at most ${max} characters long.`,\r\n descriptionTooLong: (max: number) => `The description can be at most ${max} characters long.`,\r\n startDateInvalid: 'Please choose a valid start date.',\r\n startTimeInvalid: 'Please choose a valid start time.',\r\n endDateInvalid: 'Please choose a valid end date.',\r\n endTimeInvalid: 'Please choose a valid end time.',\r\n endDateBeforeStart: 'The end date cannot be before the start date.',\r\n endBeforeStart: 'The end must be after the start.',\r\n weekdaysRequired: 'Please choose at least one weekday.',\r\n dateInvalid: 'Please choose a valid date.',\r\n untilBeforeStart: 'The repetition cannot end before the start date.',\r\n}\r\n\r\nexport const colors = {\r\n blue: 'Blue',\r\n red: 'Red',\r\n green: 'Green',\r\n yellow: 'Yellow',\r\n}\r\n\r\nexport const themes = {\r\n system: 'Automatic',\r\n light: 'Light',\r\n dark: 'Dark',\r\n}\r\n\r\nexport const recurrence = {\r\n frequency: { daily: 'Daily', weekly: 'Weekly', monthly: 'Monthly', yearly: 'Yearly' },\r\n units: {\r\n daily: { one: 'day', many: 'days' },\r\n weekly: { one: 'week', many: 'weeks' },\r\n monthly: { one: 'month', many: 'months' },\r\n yearly: { one: 'year', many: 'years' },\r\n },\r\n every: (interval: number, unit: string) => `Every ${interval} ${unit}`,\r\n onWeekdays: (weekdays: string) => ` on ${weekdays}`,\r\n onDate: (date: string) => ` on ${date}`,\r\n monthlyOnDay: (day: number) => `on day ${day}`,\r\n monthlyOnWeekday: (ordinal: number, weekday: string) =>\r\n `on the ${['first', 'second', 'third', 'fourth', 'fifth'][ordinal - 1]} ${weekday}`,\r\n monthlyOnLastWeekday: (weekday: string) => `on the last ${weekday}`,\r\n until: (date: string) => ` until ${date}`,\r\n times: (count: number) => (count === 1 ? ', once' : `, ${count} times`),\r\n}\r\n","import { events } from './events.ts'\r\nimport { auth } from './auth.ts'\r\nimport { calendars } from './calendars.ts'\r\nimport { settings } from './settings.ts'\r\nimport { storage } from './storage.ts'\r\nimport { calendar, views } from './calendar.ts'\r\nimport { colors, common, errors, recurrence, themes, validation } from './core.ts'\r\n\r\nexport const en = { common, errors, validation, colors, themes, recurrence, views, calendar, events, storage, settings, auth, calendars }\r\n","import type { Language } from '../locale.ts'\r\nimport { de } from './de/index.ts'\r\nimport { en } from './en/index.ts'\r\nimport type { Messages } from './types.ts'\r\n\r\nexport type { Messages } from './types.ts'\r\n\r\nexport const MESSAGES: Record<Language, Messages> = { en, de }\r\n","export type WeekInfo = {\r\n firstDay: number\r\n minimalDays: number\r\n}\r\n\r\ntype IntlWeekInfo = { firstDay: number; minimalDays?: number }\r\n\r\ntype LocaleWithWeekInfo = Intl.Locale & {\r\n getWeekInfo?: () => IntlWeekInfo\r\n weekInfo?: IntlWeekInfo\r\n}\r\n\r\nconst SUNDAY_FIRST_REGIONS = new Set(['US', 'CA', 'MX', 'BR', 'JP', 'IL', 'PH', 'KR', 'TW', 'HK', 'IN', 'ZA'])\r\n\r\nconst ISO_WEEK: WeekInfo = { firstDay: 1, minimalDays: 4 }\r\n\r\nconst SUNDAY_WEEK: WeekInfo = { firstDay: 0, minimalDays: 1 }\r\n\r\nconst fromIntl = (locale: LocaleWithWeekInfo): WeekInfo | null => {\r\n const info = locale.getWeekInfo?.() ?? locale.weekInfo\r\n if (!info) return null\r\n const firstDay = info.firstDay % 7\r\n return { firstDay, minimalDays: info.minimalDays ?? (firstDay === ISO_WEEK.firstDay ? ISO_WEEK : SUNDAY_WEEK).minimalDays }\r\n}\r\n\r\nexport function getWeekInfo(tag: string): WeekInfo {\r\n const locale = new Intl.Locale(tag).maximize() as LocaleWithWeekInfo\r\n return fromIntl(locale) ?? (SUNDAY_FIRST_REGIONS.has(locale.region ?? '') ? SUNDAY_WEEK : ISO_WEEK)\r\n}\r\n","import { useEffect, useMemo, useState, type ReactNode } from 'react'\r\nimport { useRootElement } from '../context/RootElementContext.ts'\r\nimport { createFormatter } from './format.ts'\r\nimport { I18nContext, type I18nContextValue } from './I18nContext.ts'\r\nimport { getBrowserLanguages, getLanguage, resolveLocale } from './locale.ts'\r\nimport { MESSAGES } from './messages/index.ts'\r\nimport { getWeekInfo } from './weekInfo.ts'\r\n\r\ntype I18nProviderProps = {\r\n locale?: string\r\n children: ReactNode\r\n}\r\n\r\nexport function I18nProvider({ locale: hostLocale, children }: I18nProviderProps) {\r\n const root = useRootElement()\r\n const [userLocale, setUserLocale] = useState<string | null>(null)\r\n const locale = useMemo(\r\n () => resolveLocale({ user: userLocale, host: hostLocale, browser: getBrowserLanguages() }),\r\n [userLocale, hostLocale],\r\n )\r\n\r\n useEffect(() => root.setAttribute('lang', locale), [root, locale])\r\n\r\n const value = useMemo<I18nContextValue>(() => {\r\n const language = getLanguage(locale)\r\n const weekInfo = getWeekInfo(locale)\r\n return {\r\n locale,\r\n language,\r\n m: MESSAGES[language],\r\n format: createFormatter(locale, weekInfo.firstDay),\r\n weekInfo,\r\n setUserLocale,\r\n }\r\n }, [locale])\r\n\r\n return <I18nContext value={value}>{children}</I18nContext>\r\n}\r\n","import { useContext, type Context } from 'react'\r\n\r\nexport function useRequiredContext<T>(context: Context<T | null>, providerName: string) {\r\n const value = useContext(context)\r\n if (value === null) throw new Error(`This hook must be used inside <${providerName}>.`)\r\n return value\r\n}\r\n","import { useRequiredContext } from '../hooks/useRequiredContext.ts'\r\nimport { I18nContext } from './I18nContext.ts'\r\n\r\nexport const useI18n = () => useRequiredContext(I18nContext, 'I18nProvider')\r\n","import { useCallback, useEffect, useRef } from 'react'\r\nimport { useI18n } from './useI18n.ts'\r\n\r\nexport function useLocaleGetter() {\r\n const { locale } = useI18n()\r\n const localeRef = useRef(locale)\r\n\r\n useEffect(() => {\r\n localeRef.current = locale\r\n }, [locale])\r\n\r\n return useCallback(() => localeRef.current, [])\r\n}\r\n","import { useCallback, useEffect, useMemo, useState } from 'react'\r\nimport { getErrorMessage, useI18n } from '../i18n/index.ts'\r\n\r\ntype ResourceState<T> = {\r\n source: object | null\r\n data: T\r\n failure: { reason: unknown } | null\r\n}\r\n\r\nexport function useAsyncResource<T>(load: () => Promise<T>, initialData: T, refreshKey: unknown = null) {\r\n const { m } = useI18n()\r\n const [version, setVersion] = useState(0)\r\n const [state, setState] = useState<ResourceState<T>>({ source: null, data: initialData, failure: null })\r\n const source = useMemo(() => ({ load, version, refreshKey }), [load, version, refreshKey])\r\n\r\n useEffect(() => {\r\n let cancelled = false\r\n\r\n source\r\n .load()\r\n .then((data) => {\r\n if (!cancelled) setState({ source, data, failure: null })\r\n })\r\n .catch((reason: unknown) => {\r\n if (!cancelled) setState((previous) => ({ ...previous, source, failure: { reason } }))\r\n })\r\n\r\n return () => {\r\n cancelled = true\r\n }\r\n }, [source])\r\n\r\n const reload = useCallback(() => setVersion((current) => current + 1), [])\r\n const setData = useCallback((data: T) => setState((previous) => ({ ...previous, data })), [])\r\n const update = useCallback(\r\n (change: (data: T) => T) => setState((previous) => ({ ...previous, data: change(previous.data) })),\r\n [],\r\n )\r\n\r\n const apply = useCallback(\r\n async (request: Promise<T>) => {\r\n const data = await request\r\n setData(data)\r\n return data\r\n },\r\n [setData],\r\n )\r\n\r\n const error = state.failure ? getErrorMessage(state.failure.reason, m) : null\r\n\r\n return { data: state.data, error, isLoading: state.source !== source, reload, setData, update, apply }\r\n}\r\n","export const PERSONAL_CALENDAR_ID = 'personal'\r\n","import { PERSONAL_CALENDAR_ID } from '../../../config/calendars.ts'\r\nimport type { CalendarDraft, CalendarSummary, InvitableRole, TeamRole } from '../types/calendar.ts'\r\n\r\nexport const CALENDAR_NAME_MAX_LENGTH = 80\r\nexport const CALENDAR_DESCRIPTION_MAX_LENGTH = 500\r\nexport const MAX_INVITATIONS = 50\r\n\r\nexport const PERSONAL_CALENDAR: CalendarSummary = {\r\n id: PERSONAL_CALENDAR_ID,\r\n teamId: PERSONAL_CALENDAR_ID,\r\n name: '',\r\n color: 'blue',\r\n kind: 'personal',\r\n teamName: null,\r\n description: '',\r\n role: 'owner',\r\n showInPersonal: true,\r\n permissions: [\r\n 'read_calendar',\r\n 'manage_calendars',\r\n 'create_entry',\r\n 'update_own_entry',\r\n 'update_any_entry',\r\n 'delete_own_entry',\r\n 'delete_any_entry',\r\n ],\r\n}\r\n\r\nexport const EMPTY_CALENDAR_DRAFT: CalendarDraft = {\r\n name: '',\r\n description: '',\r\n color: 'green',\r\n invitations: [],\r\n}\r\n\r\nexport const ROLE_HIERARCHY: Record<TeamRole, number> = {\r\n owner: 0,\r\n admin: 10,\r\n manager: 20,\r\n editor: 30,\r\n member: 40,\r\n contributor: 50,\r\n viewer: 60,\r\n}\r\n\r\nexport const INVITABLE_ROLES: readonly InvitableRole[] = [\r\n 'admin',\r\n 'manager',\r\n 'editor',\r\n 'member',\r\n 'contributor',\r\n 'viewer',\r\n]\r\n\r\nexport const DEFAULT_INVITATION_ROLE: InvitableRole = 'member'\r\n","import type { Messages } from '../i18n/index.ts'\r\n\r\nexport type FieldErrors<T> = Partial<Record<keyof T, string>>\r\n\r\nexport const hasFieldErrors = (errors: object) => Object.values(errors).some(Boolean)\r\n\r\nexport const EMAIL_MAX_LENGTH = 254\r\n\r\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\r\n\r\nexport const normalizeEmail = (email: string) => email.trim().toLowerCase()\r\n\r\nexport const validateEmail = (email: string, m: Messages) => {\r\n if (!email) return m.validation.emailRequired\r\n if (email.length > EMAIL_MAX_LENGTH || !EMAIL_PATTERN.test(email)) return m.validation.emailInvalid\r\n return undefined\r\n}\r\n","import type { Messages } from '../../../i18n/index.ts'\r\nimport { normalizeEmail, validateEmail, type FieldErrors } from '../../../utils/validation.ts'\r\nimport { CALENDAR_DESCRIPTION_MAX_LENGTH, CALENDAR_NAME_MAX_LENGTH, MAX_INVITATIONS } from '../constants/calendars.ts'\r\nimport type { CalendarDraft, Invitation } from '../types/calendar.ts'\r\n\r\nexport type DetailsValues = Pick<CalendarDraft, 'name' | 'description'>\r\n\r\nexport const validateDetails = ({ name, description }: DetailsValues, m: Messages): FieldErrors<DetailsValues> => ({\r\n name: !name.trim()\r\n ? m.calendars.validation.nameRequired\r\n : name.trim().length > CALENDAR_NAME_MAX_LENGTH\r\n ? m.calendars.validation.nameTooLong(CALENDAR_NAME_MAX_LENGTH)\r\n : undefined,\r\n description:\r\n description.trim().length > CALENDAR_DESCRIPTION_MAX_LENGTH\r\n ? m.validation.descriptionTooLong(CALENDAR_DESCRIPTION_MAX_LENGTH)\r\n : undefined,\r\n})\r\n\r\nexport const validateInvitation = (\r\n { email }: Invitation,\r\n existing: readonly Invitation[],\r\n ownEmail: string | null,\r\n m: Messages,\r\n): FieldErrors<Invitation> => {\r\n const normalized = normalizeEmail(email)\r\n if (existing.length >= MAX_INVITATIONS) return { email: m.calendars.validation.tooManyInvitations(MAX_INVITATIONS) }\r\n if (normalized === ownEmail) return { email: m.calendars.validation.selfInvite }\r\n if (existing.some((invitation) => invitation.email === normalized))\r\n return { email: m.calendars.validation.alreadyInvited }\r\n return { email: validateEmail(normalized, m) }\r\n}\r\n\r\nexport const normalizeDraft = (draft: CalendarDraft): CalendarDraft => ({\r\n ...draft,\r\n name: draft.name.trim(),\r\n description: draft.description.trim(),\r\n})\r\n","import type { EventColor } from '../../../utils/event.ts'\r\n\r\nexport type CalendarKind = 'personal' | 'team'\r\n\r\nexport const TEAM_ROLES = ['owner', 'admin', 'manager', 'editor', 'member', 'contributor', 'viewer'] as const\r\n\r\nexport type TeamRole = (typeof TEAM_ROLES)[number]\r\n\r\nexport type InvitableRole = Exclude<TeamRole, 'owner'>\r\n\r\nexport const PERMISSIONS = [\r\n 'read_calendar',\r\n 'manage_calendars',\r\n 'create_entry',\r\n 'update_own_entry',\r\n 'update_any_entry',\r\n 'delete_own_entry',\r\n 'delete_any_entry',\r\n 'invite_members',\r\n 'manage_members',\r\n 'manage_team',\r\n 'delete_team',\r\n] as const\r\n\r\nexport type Permission = (typeof PERMISSIONS)[number]\r\n\r\nexport type CalendarSummary = {\r\n id: string\r\n teamId: string\r\n name: string\r\n color: EventColor\r\n kind: CalendarKind\r\n teamName: string | null\r\n description: string\r\n role: TeamRole\r\n showInPersonal: boolean\r\n permissions: readonly Permission[]\r\n}\r\n\r\nexport type Invitation = {\r\n email: string\r\n role: InvitableRole\r\n}\r\n\r\nexport type CalendarDraft = {\r\n name: string\r\n description: string\r\n color: EventColor\r\n invitations: Invitation[]\r\n}\r\n\r\nexport type PendingInvitation = {\r\n id: string\r\n teamId: string\r\n teamName: string\r\n description: string\r\n role: InvitableRole\r\n invitedBy: string | null\r\n expiresAt: string\r\n}\r\n\r\nexport type TeamMember = {\r\n userId: string\r\n name: string\r\n email: string\r\n role: TeamRole\r\n joinedAt: string\r\n}\r\n\r\nexport type TeamInvitation = PendingInvitation & { email: string }\r\n\r\nexport type CalendarChanges = Pick<CalendarSummary, 'name' | 'color'>\r\n\r\nexport type TeamChanges = { name: string; description: string }\r\n\r\nexport interface CalendarRepository {\r\n list(): Promise<CalendarSummary[]>\r\n create(draft: CalendarDraft): Promise<CalendarSummary>\r\n leave(teamId: string): Promise<void>\r\n setShowInPersonal(calendarId: string, showInPersonal: boolean): Promise<CalendarSummary>\r\n listInvitations(): Promise<PendingInvitation[]>\r\n acceptInvitation(id: string): Promise<CalendarSummary[]>\r\n declineInvitation(id: string): Promise<void>\r\n updateCalendar(calendarId: string, changes: CalendarChanges): Promise<CalendarSummary>\r\n updateTeam(teamId: string, changes: TeamChanges): Promise<CalendarSummary[]>\r\n deleteTeam(teamId: string): Promise<void>\r\n transferOwnership(teamId: string, userId: string): Promise<CalendarSummary[]>\r\n listMembers(teamId: string): Promise<TeamMember[]>\r\n changeMemberRole(teamId: string, userId: string, role: TeamRole): Promise<TeamMember>\r\n removeMember(teamId: string, userId: string): Promise<void>\r\n listTeamInvitations(teamId: string): Promise<TeamInvitation[]>\r\n invite(teamId: string, invitation: Invitation): Promise<TeamInvitation>\r\n revokeInvitation(teamId: string, invitationId: string): Promise<void>\r\n}\r\n\r\nexport type CalendarsContextValue = {\r\n repository: CalendarRepository\r\n isLoading: boolean\r\n calendars: readonly CalendarSummary[]\r\n invitations: readonly PendingInvitation[]\r\n error: string | null\r\n activeCalendar: CalendarSummary\r\n visibleCalendarIds: readonly string[]\r\n selectCalendar: (id: string) => void\r\n createCalendar: (draft: CalendarDraft) => Promise<CalendarSummary>\r\n leaveCalendar: (id: string) => Promise<void>\r\n setShowInPersonal: (id: string, showInPersonal: boolean) => Promise<void>\r\n acceptInvitation: (id: string) => Promise<void>\r\n declineInvitation: (id: string) => Promise<void>\r\n updateCalendar: (calendar: CalendarSummary, changes: CalendarChanges) => Promise<void>\r\n updateTeam: (calendar: CalendarSummary, changes: TeamChanges) => Promise<void>\r\n deleteTeam: (calendar: CalendarSummary) => Promise<void>\r\n transferOwnership: (calendar: CalendarSummary, userId: string) => Promise<void>\r\n}\r\n","import type { Messages } from '../../../i18n/index.ts'\r\nimport { INVITABLE_ROLES, ROLE_HIERARCHY } from '../constants/calendars.ts'\r\nimport { TEAM_ROLES, type CalendarSummary, type Permission, type TeamRole } from '../types/calendar.ts'\r\n\r\nexport const isPersonalCalendar = ({ kind }: CalendarSummary) => kind === 'personal'\r\n\r\nexport const canLeaveCalendar = (calendar: CalendarSummary) =>\r\n !isPersonalCalendar(calendar) && calendar.role !== 'owner'\r\n\r\nexport const getVisibleCalendarIds = (calendars: readonly CalendarSummary[], active: CalendarSummary) =>\r\n isPersonalCalendar(active)\r\n ? calendars.filter((calendar) => isPersonalCalendar(calendar) || calendar.showInPersonal).map(({ id }) => id)\r\n : [active.id]\r\n\r\nexport const hasPermission = (calendar: CalendarSummary, permission: Permission) =>\r\n calendar.permissions.includes(permission)\r\n\r\nexport const getSharedCalendars = (calendars: readonly CalendarSummary[], active: CalendarSummary) =>\r\n isPersonalCalendar(active)\r\n ? calendars.filter((calendar) => !isPersonalCalendar(calendar) && calendar.showInPersonal)\r\n : []\r\n\r\nexport const outranks = (actor: TeamRole, target: TeamRole) =>\r\n actor === 'owner' || ROLE_HIERARCHY[actor] < ROLE_HIERARCHY[target]\r\n\r\nexport const getAssignableRoles = (actor: TeamRole) =>\r\n TEAM_ROLES.filter((role) => (role !== 'owner' ? outranks(actor, role) : actor === 'owner'))\r\n\r\nexport const getInvitableRoles = (actor: TeamRole) => INVITABLE_ROLES.filter((role) => outranks(actor, role))\r\n\r\nconst SETTINGS_PERMISSIONS: readonly Permission[] = [\r\n 'manage_calendars',\r\n 'manage_team',\r\n 'invite_members',\r\n 'manage_members',\r\n 'delete_team',\r\n]\r\n\r\nexport const canOpenSettings = (calendar: CalendarSummary) =>\r\n SETTINGS_PERMISSIONS.some((permission) => hasPermission(calendar, permission))\r\n\r\nexport const getDistinctTeamName = ({ name, teamName }: CalendarSummary) =>\r\n teamName && teamName !== name ? teamName : null\r\n\r\nexport const getCalendarKindLabel = (calendar: CalendarSummary, { calendars: { kind } }: Messages) => {\r\n if (isPersonalCalendar(calendar)) return kind.personal\r\n const teamName = getDistinctTeamName(calendar)\r\n return teamName ? kind.teamWithName(teamName) : kind.team\r\n}\r\n","import { createContext } from 'react'\r\nimport type { CalendarsContextValue } from '../types/calendar.ts'\r\n\r\nexport const CalendarsContext = createContext<CalendarsContextValue | null>(null)\r\n","import { useCallback, useMemo, useState, type ReactNode } from 'react'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { useAsyncResource } from '../../../hooks/useAsyncResource.ts'\r\nimport { PERSONAL_CALENDAR } from '../constants/calendars.ts'\r\nimport type {\r\n CalendarChanges,\r\n CalendarRepository,\r\n CalendarDraft,\r\n CalendarsContextValue,\r\n CalendarSummary,\r\n PendingInvitation,\r\n TeamChanges,\r\n} from '../types/calendar.ts'\r\nimport { normalizeDraft } from '../utils/draft.ts'\r\nimport { getVisibleCalendarIds, isPersonalCalendar } from '../utils/permissions.ts'\r\nimport { CalendarsContext } from './CalendarsContext.ts'\r\n\r\nconst INITIAL_CALENDARS: CalendarSummary[] = [PERSONAL_CALENDAR]\r\nconst NO_INVITATIONS: PendingInvitation[] = []\r\n\r\ntype CalendarsProviderProps = {\r\n repository: CalendarRepository\r\n children: ReactNode\r\n}\r\n\r\nexport function CalendarsProvider({ repository, children }: CalendarsProviderProps) {\r\n const { m } = useI18n()\r\n const loadCalendars = useCallback(() => repository.list(), [repository])\r\n const loadInvitations = useCallback(() => repository.listInvitations(), [repository])\r\n const {\r\n data: storedCalendars,\r\n error,\r\n isLoading,\r\n update: updateCalendars,\r\n } = useAsyncResource(loadCalendars, INITIAL_CALENDARS)\r\n const { data: invitations, update: updateInvitations } = useAsyncResource(loadInvitations, NO_INVITATIONS)\r\n const [activeId, setActiveId] = useState<string | null>(null)\r\n const personalName = m.calendars.personalName\r\n const calendars = useMemo(\r\n () =>\r\n storedCalendars.map((calendar) =>\r\n isPersonalCalendar(calendar) ? { ...calendar, name: personalName } : calendar,\r\n ),\r\n [storedCalendars, personalName],\r\n )\r\n\r\n const personalCalendar = calendars.find(isPersonalCalendar) ?? { ...PERSONAL_CALENDAR, name: personalName }\r\n const activeCalendar = calendars.find((calendar) => calendar.id === activeId) ?? personalCalendar\r\n\r\n const selectCalendar = useCallback((id: string) => setActiveId(id), [])\r\n\r\n const replaceCalendar = useCallback(\r\n (changed: CalendarSummary) =>\r\n updateCalendars((current) => current.map((calendar) => (calendar.id === changed.id ? changed : calendar))),\r\n [updateCalendars],\r\n )\r\n\r\n const createCalendar = useCallback(\r\n async (draft: CalendarDraft) => {\r\n const calendar = await repository.create(normalizeDraft(draft))\r\n updateCalendars((current) => [...current, calendar])\r\n return calendar\r\n },\r\n [repository, updateCalendars],\r\n )\r\n\r\n const leaveCalendar = useCallback(\r\n async (id: string) => {\r\n const calendar = calendars.find((entry) => entry.id === id)\r\n if (!calendar || isPersonalCalendar(calendar)) return\r\n await repository.leave(calendar.teamId)\r\n updateCalendars((current) => current.filter((entry) => entry.teamId !== calendar.teamId))\r\n },\r\n [calendars, repository, updateCalendars],\r\n )\r\n\r\n const setShowInPersonal = useCallback(\r\n async (id: string, showInPersonal: boolean) => {\r\n replaceCalendar(await repository.setShowInPersonal(id, showInPersonal))\r\n },\r\n [repository, replaceCalendar],\r\n )\r\n\r\n const acceptInvitation = useCallback(\r\n async (id: string) => {\r\n const added = await repository.acceptInvitation(id)\r\n updateCalendars((current) => [\r\n ...current.filter((calendar) => !added.some(({ id }) => id === calendar.id)),\r\n ...added,\r\n ])\r\n updateInvitations((current) => current.filter((invitation) => invitation.id !== id))\r\n },\r\n [repository, updateCalendars, updateInvitations],\r\n )\r\n\r\n const declineInvitation = useCallback(\r\n async (id: string) => {\r\n await repository.declineInvitation(id)\r\n updateInvitations((current) => current.filter((invitation) => invitation.id !== id))\r\n },\r\n [repository, updateInvitations],\r\n )\r\n\r\n const updateCalendar = useCallback(\r\n async (calendar: CalendarSummary, changes: CalendarChanges) => {\r\n replaceCalendar(await repository.updateCalendar(calendar.id, changes))\r\n },\r\n [repository, replaceCalendar],\r\n )\r\n\r\n const replaceCalendars = useCallback(\r\n (changed: readonly CalendarSummary[]) =>\r\n updateCalendars((current) => current.map((entry) => changed.find(({ id }) => id === entry.id) ?? entry)),\r\n [updateCalendars],\r\n )\r\n\r\n const updateTeam = useCallback(\r\n async (calendar: CalendarSummary, changes: TeamChanges) => {\r\n replaceCalendars(await repository.updateTeam(calendar.teamId, changes))\r\n },\r\n [repository, replaceCalendars],\r\n )\r\n\r\n const transferOwnership = useCallback(\r\n async (calendar: CalendarSummary, userId: string) => {\r\n replaceCalendars(await repository.transferOwnership(calendar.teamId, userId))\r\n },\r\n [repository, replaceCalendars],\r\n )\r\n\r\n const deleteTeam = useCallback(\r\n async (calendar: CalendarSummary) => {\r\n await repository.deleteTeam(calendar.teamId)\r\n updateCalendars((current) => current.filter((entry) => entry.teamId !== calendar.teamId))\r\n },\r\n [repository, updateCalendars],\r\n )\r\n\r\n const visibleCalendarIds = useMemo(\r\n () => getVisibleCalendarIds(calendars, activeCalendar),\r\n [calendars, activeCalendar],\r\n )\r\n\r\n const value = useMemo<CalendarsContextValue>(\r\n () => ({\r\n repository,\r\n isLoading,\r\n calendars,\r\n invitations,\r\n error,\r\n activeCalendar,\r\n visibleCalendarIds,\r\n selectCalendar,\r\n createCalendar,\r\n leaveCalendar,\r\n setShowInPersonal,\r\n acceptInvitation,\r\n declineInvitation,\r\n updateCalendar,\r\n updateTeam,\r\n deleteTeam,\r\n transferOwnership,\r\n }),\r\n [\r\n repository,\r\n isLoading,\r\n calendars,\r\n invitations,\r\n error,\r\n activeCalendar,\r\n visibleCalendarIds,\r\n selectCalendar,\r\n createCalendar,\r\n leaveCalendar,\r\n setShowInPersonal,\r\n acceptInvitation,\r\n declineInvitation,\r\n updateCalendar,\r\n updateTeam,\r\n deleteTeam,\r\n transferOwnership,\r\n ],\r\n )\r\n\r\n return <CalendarsContext value={value}>{children}</CalendarsContext>\r\n}\r\n","import { useRequiredContext } from '../../../hooks/useRequiredContext.ts'\r\nimport { CalendarsContext } from '../context/CalendarsContext.ts'\r\n\r\nexport const useCalendars = () => useRequiredContext(CalendarsContext, 'CalendarsProvider')\r\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\n//#region lib/router/url.ts\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|[\\\\/]{2})/i;\nconst PROTOCOL_RELATIVE_URL_REGEX = /^[\\\\/]{2}/;\nfunction normalizeProtocolRelativeUrl(url, protocol) {\n\treturn protocol + url.replace(/\\\\/g, \"/\");\n}\n//#endregion\nexport { ABSOLUTE_URL_REGEX, PROTOCOL_RELATIVE_URL_REGEX, normalizeProtocolRelativeUrl };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { PROTOCOL_RELATIVE_URL_REGEX } from \"./url.js\";\n//#region lib/router/history.ts\n/**\n* Actions represent the type of change to a location value.\n*/\nlet Action = /* @__PURE__ */ function(Action) {\n\t/**\n\t* A POP indicates a change to an arbitrary index in the history stack, such\n\t* as a back or forward navigation. It does not describe the direction of the\n\t* navigation, only that the current index changed.\n\t*\n\t* Note: This is the default action for newly created history objects.\n\t*/\n\tAction[\"Pop\"] = \"POP\";\n\t/**\n\t* A PUSH indicates a new entry being added to the history stack, such as when\n\t* a link is clicked and a new page loads. When this happens, all subsequent\n\t* entries in the stack are lost.\n\t*/\n\tAction[\"Push\"] = \"PUSH\";\n\t/**\n\t* A REPLACE indicates the entry at the current index in the history stack\n\t* being replaced by a new one.\n\t*/\n\tAction[\"Replace\"] = \"REPLACE\";\n\treturn Action;\n}({});\nconst PopStateEventType = \"popstate\";\nfunction isLocation(obj) {\n\treturn typeof obj === \"object\" && obj != null && \"pathname\" in obj && \"search\" in obj && \"hash\" in obj && \"state\" in obj && \"key\" in obj;\n}\n/**\n* Memory history stores the current location in memory. It is designed for use\n* in stateful non-browser environments like tests and React Native.\n*/\nfunction createMemoryHistory(options = {}) {\n\tlet { initialEntries = [\"/\"], initialIndex, v5Compat = false } = options;\n\tlet entries;\n\tentries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === \"string\" ? null : entry.state, index === 0 ? \"default\" : void 0, typeof entry === \"string\" ? void 0 : entry.mask));\n\tlet index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);\n\tlet action = \"POP\";\n\tlet listener = null;\n\tfunction clampIndex(n) {\n\t\treturn Math.min(Math.max(n, 0), entries.length - 1);\n\t}\n\tfunction getCurrentLocation() {\n\t\treturn entries[index];\n\t}\n\tfunction createMemoryLocation(to, state = null, key, mask) {\n\t\tlet location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key, mask);\n\t\twarning(location.pathname.charAt(0) === \"/\", `relative pathnames are not supported in memory history: ${JSON.stringify(to)}`);\n\t\treturn location;\n\t}\n\tfunction createHref(to) {\n\t\treturn typeof to === \"string\" ? to : createPath(to);\n\t}\n\treturn {\n\t\tget index() {\n\t\t\treturn index;\n\t\t},\n\t\tget action() {\n\t\t\treturn action;\n\t\t},\n\t\tget location() {\n\t\t\treturn getCurrentLocation();\n\t\t},\n\t\tcreateHref,\n\t\tcreateURL(to) {\n\t\t\treturn new URL(createHref(to), \"http://localhost\");\n\t\t},\n\t\tencodeLocation(to) {\n\t\t\tlet path = typeof to === \"string\" ? parsePath(to) : to;\n\t\t\treturn {\n\t\t\t\tpathname: path.pathname || \"\",\n\t\t\t\tsearch: path.search || \"\",\n\t\t\t\thash: path.hash || \"\"\n\t\t\t};\n\t\t},\n\t\tpush(to, state) {\n\t\t\taction = \"PUSH\";\n\t\t\tlet nextLocation = isLocation(to) ? to : createMemoryLocation(to, state);\n\t\t\tindex += 1;\n\t\t\tentries.splice(index, entries.length, nextLocation);\n\t\t\tif (v5Compat && listener) listener({\n\t\t\t\taction,\n\t\t\t\tlocation: nextLocation,\n\t\t\t\tdelta: 1\n\t\t\t});\n\t\t},\n\t\treplace(to, state) {\n\t\t\taction = \"REPLACE\";\n\t\t\tlet nextLocation = isLocation(to) ? to : createMemoryLocation(to, state);\n\t\t\tentries[index] = nextLocation;\n\t\t\tif (v5Compat && listener) listener({\n\t\t\t\taction,\n\t\t\t\tlocation: nextLocation,\n\t\t\t\tdelta: 0\n\t\t\t});\n\t\t},\n\t\tgo(delta) {\n\t\t\taction = \"POP\";\n\t\t\tlet nextIndex = clampIndex(index + delta);\n\t\t\tlet nextLocation = entries[nextIndex];\n\t\t\tindex = nextIndex;\n\t\t\tif (listener) listener({\n\t\t\t\taction,\n\t\t\t\tlocation: nextLocation,\n\t\t\t\tdelta\n\t\t\t});\n\t\t},\n\t\tlisten(fn) {\n\t\t\tlistener = fn;\n\t\t\treturn () => {\n\t\t\t\tlistener = null;\n\t\t\t};\n\t\t}\n\t};\n}\n/**\n* Browser history stores the location in regular URLs. This is the standard for\n* most web apps, but it requires some configuration on the server to ensure you\n* serve the same app at multiple URLs.\n*\n* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n*/\nfunction createBrowserHistory(options = {}) {\n\tfunction createBrowserLocation(window, globalHistory) {\n\t\tlet maskedLocation = globalHistory.state?.masked;\n\t\tlet { pathname, search, hash } = maskedLocation || window.location;\n\t\treturn createLocation(\"\", {\n\t\t\tpathname,\n\t\t\tsearch,\n\t\t\thash\n\t\t}, globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\", maskedLocation ? {\n\t\t\tpathname: window.location.pathname,\n\t\t\tsearch: window.location.search,\n\t\t\thash: window.location.hash\n\t\t} : void 0);\n\t}\n\tfunction createBrowserHref(window, to) {\n\t\treturn typeof to === \"string\" ? to : createPath(to);\n\t}\n\treturn getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);\n}\n/**\n* Hash history stores the location in window.location.hash. This makes it ideal\n* for situations where you don't want to send the location to the server for\n* some reason, either because you do cannot configure it or the URL space is\n* reserved for something else.\n*\n* @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n*/\nfunction createHashHistory(options = {}) {\n\tfunction createHashLocation(window, globalHistory) {\n\t\tlet { pathname = \"/\", search = \"\", hash = \"\" } = parsePath(window.location.hash.substring(1));\n\t\tif (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) pathname = \"/\" + pathname;\n\t\treturn createLocation(\"\", {\n\t\t\tpathname,\n\t\t\tsearch,\n\t\t\thash\n\t\t}, globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n\t}\n\tfunction createHashHref(window, to) {\n\t\tlet base = window.document.querySelector(\"base\");\n\t\tlet href = \"\";\n\t\tif (base && base.getAttribute(\"href\")) {\n\t\t\tlet url = window.location.href;\n\t\t\tlet hashIndex = url.indexOf(\"#\");\n\t\t\thref = hashIndex === -1 ? url : url.slice(0, hashIndex);\n\t\t}\n\t\treturn href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n\t}\n\tfunction validateHashLocation(location, to) {\n\t\twarning(location.pathname.charAt(0) === \"/\", `relative pathnames are not supported in hash history.push(${JSON.stringify(to)})`);\n\t}\n\treturn getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);\n}\nfunction invariant(value, message) {\n\tif (value === false || value === null || typeof value === \"undefined\") throw new Error(message);\n}\nfunction warning(cond, message) {\n\tif (!cond) {\n\t\tif (typeof console !== \"undefined\") console.warn(message);\n\t\ttry {\n\t\t\tthrow new Error(message);\n\t\t} catch {}\n\t}\n}\nfunction createKey() {\n\treturn Math.random().toString(36).substring(2, 10);\n}\n/**\n* For browser-based histories, we combine the state and key into an object\n*/\nfunction getHistoryState(location, index) {\n\treturn {\n\t\tusr: location.state,\n\t\tkey: location.key,\n\t\tidx: index,\n\t\tmasked: location.mask ? {\n\t\t\tpathname: location.pathname,\n\t\t\tsearch: location.search,\n\t\t\thash: location.hash\n\t\t} : void 0\n\t};\n}\n/**\n* Creates a Location object with a unique key from the given Path\n*/\nfunction createLocation(current, to, state = null, key, mask) {\n\treturn {\n\t\tpathname: typeof current === \"string\" ? current : current.pathname,\n\t\tsearch: \"\",\n\t\thash: \"\",\n\t\t...typeof to === \"string\" ? parsePath(to) : to,\n\t\tstate,\n\t\tkey: to && to.key || key || createKey(),\n\t\tmask\n\t};\n}\n/**\n* Creates a string URL path from the given pathname, search, and hash components.\n*\n* @public\n* @category Utils\n* @param path The pathname, search, and hash components to combine.\n* @returns The combined URL path.\n*/\nfunction createPath({ pathname = \"/\", search = \"\", hash = \"\" }) {\n\tif (search && search !== \"?\") pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n\tif (hash && hash !== \"#\") pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n\treturn pathname;\n}\n/**\n* Parses a string URL path into its separate pathname, search, and hash components.\n*\n* @public\n* @category Utils\n* @param path The URL path to parse.\n* @returns The parsed pathname, search, and hash components.\n*/\nfunction parsePath(path) {\n\tlet parsedPath = {};\n\tif (path) {\n\t\tlet hashIndex = path.indexOf(\"#\");\n\t\tif (hashIndex >= 0) {\n\t\t\tparsedPath.hash = path.substring(hashIndex);\n\t\t\tpath = path.substring(0, hashIndex);\n\t\t}\n\t\tlet searchIndex = path.indexOf(\"?\");\n\t\tif (searchIndex >= 0) {\n\t\t\tparsedPath.search = path.substring(searchIndex);\n\t\t\tpath = path.substring(0, searchIndex);\n\t\t}\n\t\tif (path) parsedPath.pathname = path;\n\t}\n\treturn parsedPath;\n}\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options = {}) {\n\tlet { window = document.defaultView, v5Compat = false } = options;\n\tlet globalHistory = window.history;\n\tlet action = \"POP\";\n\tlet listener = null;\n\tlet index = getIndex();\n\tif (index == null) {\n\t\tindex = 0;\n\t\tglobalHistory.replaceState({\n\t\t\t...globalHistory.state,\n\t\t\tidx: index\n\t\t}, \"\");\n\t}\n\tfunction getIndex() {\n\t\treturn (globalHistory.state || { idx: null }).idx;\n\t}\n\tfunction handlePop() {\n\t\taction = \"POP\";\n\t\tlet nextIndex = getIndex();\n\t\tlet delta = nextIndex == null ? null : nextIndex - index;\n\t\tindex = nextIndex;\n\t\tif (listener) listener({\n\t\t\taction,\n\t\t\tlocation: history.location,\n\t\t\tdelta\n\t\t});\n\t}\n\tfunction push(to, state) {\n\t\taction = \"PUSH\";\n\t\tlet location = isLocation(to) ? to : createLocation(history.location, to, state);\n\t\tif (validateLocation) validateLocation(location, to);\n\t\tindex = getIndex() + 1;\n\t\tlet historyState = getHistoryState(location, index);\n\t\tlet url = history.createHref(location.mask || location);\n\t\ttry {\n\t\t\tglobalHistory.pushState(historyState, \"\", url);\n\t\t} catch (error) {\n\t\t\tif (error instanceof DOMException && error.name === \"DataCloneError\") throw error;\n\t\t\twindow.location.assign(url);\n\t\t}\n\t\tif (v5Compat && listener) listener({\n\t\t\taction,\n\t\t\tlocation: history.location,\n\t\t\tdelta: 1\n\t\t});\n\t}\n\tfunction replace(to, state) {\n\t\taction = \"REPLACE\";\n\t\tlet location = isLocation(to) ? to : createLocation(history.location, to, state);\n\t\tif (validateLocation) validateLocation(location, to);\n\t\tindex = getIndex();\n\t\tlet historyState = getHistoryState(location, index);\n\t\tlet url = history.createHref(location.mask || location);\n\t\tglobalHistory.replaceState(historyState, \"\", url);\n\t\tif (v5Compat && listener) listener({\n\t\t\taction,\n\t\t\tlocation: history.location,\n\t\t\tdelta: 0\n\t\t});\n\t}\n\tfunction createURL(to) {\n\t\treturn createBrowserURLImpl(window, to);\n\t}\n\tlet history = {\n\t\tget action() {\n\t\t\treturn action;\n\t\t},\n\t\tget location() {\n\t\t\treturn getLocation(window, globalHistory);\n\t\t},\n\t\tlisten(fn) {\n\t\t\tif (listener) throw new Error(\"A history only accepts one active listener\");\n\t\t\twindow.addEventListener(PopStateEventType, handlePop);\n\t\t\tlistener = fn;\n\t\t\treturn () => {\n\t\t\t\twindow.removeEventListener(PopStateEventType, handlePop);\n\t\t\t\tlistener = null;\n\t\t\t};\n\t\t},\n\t\tcreateHref(to) {\n\t\t\treturn createHref(window, to);\n\t\t},\n\t\tcreateURL,\n\t\tencodeLocation(to) {\n\t\t\tlet url = createURL(to);\n\t\t\treturn {\n\t\t\t\tpathname: url.pathname,\n\t\t\t\tsearch: url.search,\n\t\t\t\thash: url.hash\n\t\t\t};\n\t\t},\n\t\tpush,\n\t\treplace,\n\t\tgo(n) {\n\t\t\treturn globalHistory.go(n);\n\t\t}\n\t};\n\treturn history;\n}\nfunction createBrowserURLImpl(windowImpl, to, isAbsolute = false) {\n\tlet base = \"http://localhost\";\n\tif (windowImpl) base = windowImpl.location.origin !== \"null\" ? windowImpl.location.origin : windowImpl.location.href;\n\tinvariant(base, \"No window.location.(origin|href) available to create URL\");\n\tlet href = typeof to === \"string\" ? to : createPath(to);\n\thref = href.replace(/ $/, \"%20\");\n\tif (!isAbsolute && PROTOCOL_RELATIVE_URL_REGEX.test(href)) href = base + href;\n\treturn new URL(href, base);\n}\n//#endregion\nexport { Action, createBrowserHistory, createBrowserURLImpl, createHashHistory, createLocation, createMemoryHistory, createPath, invariant, parsePath, warning };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { ABSOLUTE_URL_REGEX, PROTOCOL_RELATIVE_URL_REGEX, normalizeProtocolRelativeUrl } from \"./url.js\";\nimport { invariant, parsePath, warning } from \"./history.js\";\nimport * as React$1 from \"react\";\n//#region lib/router/utils.ts\n/**\n* Creates a type-safe {@link RouterContext} object that can be used to\n* store and retrieve arbitrary values in [`action`](../../start/framework/route-module#action)s,\n* [`loader`](../../start/framework/route-module#loader)s, and [middleware](../../how-to/middleware).\n* Similar to React's [`createContext`](https://react.dev/reference/react/createContext),\n* but specifically designed for React Router's request/response lifecycle.\n*\n* If a `defaultValue` is provided, it will be returned from `context.get()`\n* when no value has been set for the context. Otherwise, reading this context\n* when no value has been set will throw an error.\n*\n* ```tsx filename=app/context.ts\n* import { createContext } from \"react-router\";\n*\n* // Create a context for user data\n* export const userContext =\n* createContext<User | null>(null);\n* ```\n*\n* ```tsx filename=app/middleware/auth.ts\n* import { getUserFromSession } from \"~/auth.server\";\n* import { userContext } from \"~/context\";\n*\n* export const authMiddleware = async ({\n* context,\n* request,\n* }) => {\n* const user = await getUserFromSession(request);\n* context.set(userContext, user);\n* };\n* ```\n*\n* ```tsx filename=app/routes/profile.tsx\n* import { userContext } from \"~/context\";\n*\n* export async function loader({\n* context,\n* }: Route.LoaderArgs) {\n* const user = context.get(userContext);\n*\n* if (!user) {\n* throw new Response(\"Unauthorized\", { status: 401 });\n* }\n*\n* return { user };\n* }\n* ```\n*\n* @public\n* @category Utils\n* @mode framework\n* @mode data\n* @param defaultValue An optional default value for the context. This value\n* will be returned if no value has been set for this context.\n* @returns A {@link RouterContext} object that can be used with\n* `context.get()` and `context.set()` in [`action`](../../start/framework/route-module#action)s,\n* [`loader`](../../start/framework/route-module#loader)s, and [middleware](../../how-to/middleware).\n*/\nfunction createContext(defaultValue) {\n\treturn { defaultValue };\n}\n/**\n* Provides methods for writing/reading values in application context in a\n* type-safe way. Primarily for usage with [middleware](../../how-to/middleware).\n*\n* @example\n* import {\n* createContext,\n* RouterContextProvider\n* } from \"react-router\";\n*\n* const userContext = createContext<User | null>(null);\n* const contextProvider = new RouterContextProvider();\n* contextProvider.set(userContext, getUser());\n* // ^ Type-safe\n* const user = contextProvider.get(userContext);\n* // ^ User\n*\n* @public\n* @category Utils\n* @mode framework\n* @mode data\n*/\nvar RouterContextProvider = class {\n\t#map = /* @__PURE__ */ new Map();\n\t/**\n\t* Create a new `RouterContextProvider` instance\n\t* @param init An optional initial context map to populate the provider with\n\t*/\n\tconstructor(init) {\n\t\tif (init) for (let [context, value] of init) this.set(context, value);\n\t}\n\t/**\n\t* Access a value from the context. If no value has been set for the context,\n\t* it will return the context's `defaultValue` if provided, or throw an error\n\t* if no `defaultValue` was set.\n\t* @param context The context to get the value for\n\t* @returns The value for the context, or the context's `defaultValue` if no\n\t* value was set\n\t*/\n\tget(context) {\n\t\tif (this.#map.has(context)) return this.#map.get(context);\n\t\tif (context.defaultValue !== void 0) return context.defaultValue;\n\t\tthrow new Error(\"No value found for context\");\n\t}\n\t/**\n\t* Set a value for the context. If the context already has a value set, this\n\t* will overwrite it.\n\t*\n\t* @param context The context to set the value for\n\t* @param value The value to set for the context\n\t* @returns {void}\n\t*/\n\tset(context, value) {\n\t\tthis.#map.set(context, value);\n\t}\n};\nconst unsupportedLazyRouteObjectKeys = new Set([\n\t\"lazy\",\n\t\"caseSensitive\",\n\t\"path\",\n\t\"id\",\n\t\"index\",\n\t\"children\",\n\t\"unstable_validateParams\"\n]);\nfunction isUnsupportedLazyRouteObjectKey(key) {\n\treturn unsupportedLazyRouteObjectKeys.has(key);\n}\nconst unsupportedLazyRouteFunctionKeys = new Set([\n\t\"lazy\",\n\t\"caseSensitive\",\n\t\"path\",\n\t\"id\",\n\t\"index\",\n\t\"middleware\",\n\t\"children\",\n\t\"unstable_validateParams\"\n]);\nfunction isUnsupportedLazyRouteFunctionKey(key) {\n\treturn unsupportedLazyRouteFunctionKeys.has(key);\n}\nfunction isIndexRoute(route) {\n\treturn route.index === true;\n}\nfunction defaultMapRouteProperties(route) {\n\tlet updates = {};\n\tif (route.Component) Object.assign(updates, {\n\t\telement: React$1.createElement(route.Component),\n\t\tComponent: void 0\n\t});\n\tif (route.HydrateFallback) Object.assign(updates, {\n\t\thydrateFallbackElement: React$1.createElement(route.HydrateFallback),\n\t\tHydrateFallback: void 0\n\t});\n\tif (route.ErrorBoundary) Object.assign(updates, {\n\t\terrorElement: React$1.createElement(route.ErrorBoundary),\n\t\tErrorBoundary: void 0\n\t});\n\treturn updates;\n}\nfunction convertRoutesToDataRoutes(routes, mapRouteProperties = defaultMapRouteProperties, parentPath = [], manifest = {}, allowInPlaceMutations = false) {\n\treturn routes.map((route, index) => {\n\t\tlet treePath = [...parentPath, String(index)];\n\t\tlet id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n\t\tinvariant(route.index !== true || !route.children, `Cannot specify children on an index route`);\n\t\tinvariant(allowInPlaceMutations || !manifest[id], `Found a route id collision on id \"${id}\". Route id's must be globally unique within Data Router usages`);\n\t\tif (isIndexRoute(route)) {\n\t\t\tlet indexRoute = {\n\t\t\t\t...route,\n\t\t\t\tid\n\t\t\t};\n\t\t\tmanifest[id] = mergeRouteUpdates(indexRoute, mapRouteProperties(indexRoute));\n\t\t\treturn indexRoute;\n\t\t} else {\n\t\t\tlet pathOrLayoutRoute = {\n\t\t\t\t...route,\n\t\t\t\tid,\n\t\t\t\tchildren: void 0\n\t\t\t};\n\t\t\tmanifest[id] = mergeRouteUpdates(pathOrLayoutRoute, mapRouteProperties(pathOrLayoutRoute));\n\t\t\tif (route.children) pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest, allowInPlaceMutations);\n\t\t\treturn pathOrLayoutRoute;\n\t\t}\n\t});\n}\nfunction mergeRouteUpdates(route, updates) {\n\treturn Object.assign(route, {\n\t\t...updates,\n\t\t...typeof updates.lazy === \"object\" && updates.lazy != null ? { lazy: {\n\t\t\t...route.lazy,\n\t\t\t...updates.lazy\n\t\t} } : {}\n\t});\n}\n/**\n* Matches the given routes to a location and returns the match data.\n*\n* @example\n* import { matchRoutes } from \"react-router\";\n*\n* let routes = [{\n* path: \"/\",\n* Component: Root,\n* children: [{\n* path: \"dashboard\",\n* Component: Dashboard,\n* }]\n* }];\n*\n* matchRoutes(routes, \"/dashboard\"); // [rootMatch, dashboardMatch]\n*\n* @public\n* @category Utils\n* @param routes The array of route objects to match against.\n* @param locationArg The location to match against, either a string path or a\n* partial {@link Location} object\n* @param basename Optional base path to strip from the location before matching.\n* Defaults to `/`.\n* @returns An array of matched routes, or `null` if no matches were found.\n*/\nfunction matchRoutes(routes, locationArg, basename = \"/\") {\n\treturn matchRoutesImpl(routes, locationArg, basename, false);\n}\nfunction matchRoutesImpl(routes, locationArg, basename, allowPartial, precomputedBranches) {\n\tlet pathname = stripBasename((typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg).pathname || \"/\", basename);\n\tif (pathname == null) return null;\n\tlet branches = precomputedBranches ?? flattenAndRankRoutes(routes);\n\tlet matches = null;\n\tlet decoded = decodePath(pathname);\n\tfor (let i = 0; matches == null && i < branches.length; ++i) matches = matchRouteBranch(branches[i], decoded, allowPartial);\n\treturn matches;\n}\nfunction convertRouteMatchToUiMatch(match, loaderData) {\n\tlet { route, pathname, params } = match;\n\treturn {\n\t\tid: route.id,\n\t\tpathname,\n\t\tparams,\n\t\tloaderData: loaderData[route.id],\n\t\thandle: route.handle\n\t};\n}\nfunction flattenAndRankRoutes(routes) {\n\tlet branches = flattenRoutes(routes);\n\trankRouteBranches(branches);\n\treturn branches;\n}\nfunction flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = \"\", _hasParentOptionalSegments = false) {\n\tlet flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {\n\t\tlet meta = {\n\t\t\trelativePath: relativePath === void 0 ? route.path || \"\" : relativePath,\n\t\t\tcaseSensitive: route.caseSensitive === true,\n\t\t\tchildrenIndex: index,\n\t\t\troute\n\t\t};\n\t\tif (meta.relativePath.startsWith(\"/\")) {\n\t\t\tif (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) return;\n\t\t\tinvariant(meta.relativePath.startsWith(parentPath), `Absolute route path \"${meta.relativePath}\" nested under path \"${parentPath}\" is not valid. An absolute child route path must start with the combined path of all its parent routes.`);\n\t\t\tmeta.relativePath = meta.relativePath.slice(parentPath.length);\n\t\t}\n\t\tlet path = joinPaths([parentPath, meta.relativePath]);\n\t\tlet routesMeta = parentsMeta.concat(meta);\n\t\tif (route.children && route.children.length > 0) {\n\t\t\tinvariant(route.index !== true, `Index routes must not have child routes. Please remove all child routes from route path \"${path}\".`);\n\t\t\tflattenRoutes(route.children, branches, routesMeta, path, hasParentOptionalSegments);\n\t\t}\n\t\tif (route.path == null && !route.index) return;\n\t\tbranches.push({\n\t\t\tpath,\n\t\t\tscore: computeScore(path, route.index),\n\t\t\troutesMeta: routesMeta.map((meta, i) => {\n\t\t\t\tlet [matcher, params] = compilePath(meta.relativePath, meta.caseSensitive, i === routesMeta.length - 1);\n\t\t\t\treturn {\n\t\t\t\t\t...meta,\n\t\t\t\t\tmatcher,\n\t\t\t\t\tcompiledParams: params\n\t\t\t\t};\n\t\t\t})\n\t\t});\n\t};\n\troutes.forEach((route, index) => {\n\t\tif (route.path === \"\" || !route.path?.includes(\"?\")) flattenRoute(route, index);\n\t\telse for (let exploded of explodeOptionalSegments(route.path)) flattenRoute(route, index, true, exploded);\n\t});\n\treturn branches;\n}\nfunction explodeOptionalSegments(path) {\n\tlet segments = path.split(\"/\");\n\tif (segments.length === 0) return [];\n\tlet [first, ...rest] = segments;\n\tlet isOptional = first.endsWith(\"?\");\n\tlet required = first.replace(/\\?$/, \"\");\n\tif (rest.length === 0) return isOptional ? [required, \"\"] : [required];\n\tlet restExploded = explodeOptionalSegments(rest.join(\"/\"));\n\tlet result = [];\n\tresult.push(...restExploded.map((subpath) => subpath === \"\" ? required : [required, subpath].join(\"/\")));\n\tif (isOptional) result.push(...restExploded);\n\treturn result.map((exploded) => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\nfunction rankRouteBranches(branches) {\n\tbranches.sort((a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(a.routesMeta.map((meta) => meta.childrenIndex), b.routesMeta.map((meta) => meta.childrenIndex)));\n}\nconst paramRe = /^:[\\w-]+$/;\nconst partialParamRe = /^:[\\w-]+/;\nconst partialDynamicSegmentValue = 3.5;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = (s) => s === \"*\";\nfunction computeScore(path, index) {\n\tlet segments = path.split(\"/\");\n\tlet initialScore = segments.length;\n\tif (segments.some(isSplat)) initialScore += splatPenalty;\n\tif (index) initialScore += indexRouteValue;\n\treturn segments.filter((s) => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : partialParamRe.test(segment) ? partialDynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\nfunction compareIndexes(a, b) {\n\treturn a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]) ? a[a.length - 1] - b[b.length - 1] : 0;\n}\nfunction matchRouteBranch(branch, pathname, allowPartial = false) {\n\tlet { routesMeta } = branch;\n\tlet matchedParams = {};\n\tlet matchedPathname = \"/\";\n\tlet matches = [];\n\tfor (let i = 0; i < routesMeta.length; ++i) {\n\t\tlet meta = routesMeta[i];\n\t\tlet end = i === routesMeta.length - 1;\n\t\tlet remainingPathname = matchedPathname === \"/\" ? pathname : pathname.slice(matchedPathname.length) || \"/\";\n\t\tlet pattern = {\n\t\t\tpath: meta.relativePath,\n\t\t\tcaseSensitive: meta.caseSensitive,\n\t\t\tend\n\t\t};\n\t\tlet match = meta.matcher && meta.compiledParams ? matchPathImpl(pattern, remainingPathname, meta.matcher, meta.compiledParams) : matchPath(pattern, remainingPathname);\n\t\tlet route = meta.route;\n\t\tif (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) match = matchPath({\n\t\t\tpath: meta.relativePath,\n\t\t\tcaseSensitive: meta.caseSensitive,\n\t\t\tend: false\n\t\t}, remainingPathname);\n\t\tif (!match) return null;\n\t\tObject.assign(matchedParams, match.params);\n\t\tmatches.push({\n\t\t\tparams: matchedParams,\n\t\t\tpathname: joinPaths([matchedPathname, match.pathname]),\n\t\t\tpathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),\n\t\t\troute\n\t\t});\n\t\tif (match.pathnameBase !== \"/\") matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n\t}\n\treturn matches;\n}\n/**\n* Characters that `encodeURIComponent` escapes but that are valid literally in\n* a URL path segment. Per RFC 3986 §3.3, a path segment is made of `pchar`:\n*\n* ```\n* pchar = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n* sub-delims = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\" / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n* ```\n*\n* `encodeURIComponent` targets query-string values, where `$ & + , ; = : @`\n* are delimiters and must be escaped — but in a path segment they carry no\n* special meaning, and browsers keep them literal in `location.pathname`.\n* (`! ' ( ) *` and the unreserved set are already left alone by\n* `encodeURIComponent`, so they need no restoring.)\n*/\nconst PATH_PARAM_OVERESCAPED = {\n\t\"%24\": \"$\",\n\t\"%26\": \"&\",\n\t\"%2B\": \"+\",\n\t\"%2C\": \",\",\n\t\"%3A\": \":\",\n\t\"%3B\": \";\",\n\t\"%3D\": \"=\",\n\t\"%40\": \"@\"\n};\n/**\n* Encodes a param value for interpolation into a single URL path segment.\n*\n* Escapes characters that would break the path (`/ ? # %`, whitespace,\n* non-ASCII, …) while leaving characters that RFC 3986 permits literally in a\n* path segment untouched. Escaping those would needlessly rewrite URLs — e.g.\n* a semver build param `1.0.0+1` would become `1.0.0%2B1` even though browsers\n* display and match the `+` literally in `location.pathname`.\n*\n* See [RFC 3986 §3.3](https://datatracker.ietf.org/doc/html/rfc3986#section-3.3))\n*\n* @param value The param value to encode.\n* @returns The encoded value, safe for use as a single path segment.\n*/\nfunction encodePathParam(value) {\n\treturn encodeURIComponent(value).replace(/%(?:24|26|2B|2C|3A|3B|3D|40)/g, (match) => PATH_PARAM_OVERESCAPED[match]);\n}\n/**\n* Returns a path with params interpolated.\n*\n* Param values are percent-encoded for use in a path segment: characters that\n* would change the URL structure (`/`, `?`, `#`, `%`, whitespace, non-ASCII)\n* are escaped, while characters that RFC 3986 allows literally in a path\n* segment (`$ & + , ; = : @`) are kept as-is. Note this differs from query-string\n* encoding (`encodeURIComponent`/`URLSearchParams`), where those characters are\n* delimiters and must be escaped. Splat (`*`) values are encoded per segment,\n* preserving `/` separators.\n*\n* See [RFC 3986 §3.3](https://datatracker.ietf.org/doc/html/rfc3986#section-3.3)\n*\n* @example\n* import { generatePath } from \"react-router\";\n*\n* generatePath(\"/users/:id\", { id: \"123\" }); // \"/users/123\"\n* generatePath(\"/files/:name\", { name: \"a b\" }); // \"/files/a%20b\"\n* generatePath(\"/releases/:v\", { v: \"1.0.0+1\" }); // \"/releases/1.0.0+1\"\n*\n* @public\n* @category Utils\n* @param originalPath The original path to generate.\n* @param params The parameters to interpolate into the path.\n* @returns The generated path with parameters interpolated.\n*/\nfunction generatePath(originalPath, params = {}) {\n\tlet path = originalPath;\n\tif (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n\t\twarning(false, `Route path \"${path}\" will be treated as if it were \"${path.replace(/\\*$/, \"/*\")}\" because the \\`*\\` character must always follow a \\`/\\` in the pattern. To get rid of this warning, please change the route path to \"${path.replace(/\\*$/, \"/*\")}\".`);\n\t\tpath = path.replace(/\\*$/, \"/*\");\n\t}\n\tconst prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n\tconst stringify = (p) => p == null ? \"\" : typeof p === \"string\" ? p : String(p);\n\treturn prefix + path.split(/\\/+/).map((segment, index, array) => {\n\t\tif (index === array.length - 1 && segment === \"*\") return stringify(params[\"*\"]);\n\t\tconst keyMatch = segment.match(/^:([\\w-]+)(\\??)(.*)/);\n\t\tif (keyMatch) {\n\t\t\tconst [, key, optional, suffix] = keyMatch;\n\t\t\tlet param = params[key];\n\t\t\tinvariant(optional === \"?\" || param != null, `Missing \":${key}\" param`);\n\t\t\treturn encodePathParam(stringify(param)) + suffix;\n\t\t}\n\t\treturn segment.replace(/\\?$/g, \"\");\n\t}).filter((segment) => !!segment).join(\"/\");\n}\n/**\n* Performs pattern matching on a URL pathname and returns information about\n* the match.\n*\n* @public\n* @category Utils\n* @param pattern The pattern to match against the URL pathname. This can be a\n* string or a {@link PathPattern} object. If a string is provided, it will be\n* treated as a pattern with `caseSensitive` set to `false` and `end` set to\n* `true`.\n* @param pathname The URL pathname to match against the pattern.\n* @returns A path match object if the pattern matches the pathname,\n* or `null` if it does not match.\n*/\nfunction matchPath(pattern, pathname) {\n\tif (typeof pattern === \"string\") pattern = {\n\t\tpath: pattern,\n\t\tcaseSensitive: false,\n\t\tend: true\n\t};\n\tlet [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);\n\treturn matchPathImpl(pattern, pathname, matcher, compiledParams);\n}\nfunction matchPathImpl(pattern, pathname, matcher, compiledParams) {\n\tlet match = pathname.match(matcher);\n\tif (!match) return null;\n\tlet matchedPathname = match[0];\n\tlet pathnameBase = removeTrailingSlash(matchedPathname, 1);\n\tlet captureGroups = match.slice(1);\n\treturn {\n\t\tparams: compiledParams.reduce((memo, { paramName, isOptional }, index) => {\n\t\t\tif (paramName === \"*\") {\n\t\t\t\tlet splatValue = captureGroups[index] || \"\";\n\t\t\t\tpathnameBase = removeTrailingSlash(matchedPathname.slice(0, matchedPathname.length - splatValue.length), 1);\n\t\t\t}\n\t\t\tconst value = captureGroups[index];\n\t\t\tif (isOptional && !value) memo[paramName] = void 0;\n\t\t\telse memo[paramName] = (value || \"\").replace(/%2F/g, \"/\");\n\t\t\treturn memo;\n\t\t}, {}),\n\t\tpathname: matchedPathname,\n\t\tpathnameBase,\n\t\tpattern\n\t};\n}\nfunction compilePath(path, caseSensitive = false, end = true) {\n\twarning(path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"), `Route path \"${path}\" will be treated as if it were \"${path.replace(/\\*$/, \"/*\")}\" because the \\`*\\` character must always follow a \\`/\\` in the pattern. To get rid of this warning, please change the route path to \"${path.replace(/\\*$/, \"/*\")}\".`);\n\tlet params = [];\n\tlet regexpSource = \"^\" + path.replace(/\\/*\\*?$/, \"\").replace(/^\\/*/, \"/\").replace(/[\\\\.*+^${}|()[\\]]/g, \"\\\\$&\").replace(/\\/:([\\w-]+)(\\?)?/g, (match, paramName, isOptional, index, str) => {\n\t\tparams.push({\n\t\t\tparamName,\n\t\t\tisOptional: isOptional != null\n\t\t});\n\t\tif (isOptional) {\n\t\t\tlet nextChar = str.charAt(index + match.length);\n\t\t\tif (nextChar && nextChar !== \"/\") return \"/([^\\\\/]*)\";\n\t\t\treturn \"(?:/([^\\\\/]*))?\";\n\t\t}\n\t\treturn \"/([^\\\\/]+)\";\n\t}).replace(/\\/([\\w-]+)\\?(?=\\/|$|\\()/g, \"(?:/$1)?\");\n\tif (path.endsWith(\"*\")) {\n\t\tparams.push({ paramName: \"*\" });\n\t\tregexpSource += path === \"*\" || path === \"/*\" ? \"(.*)$\" : \"(?:\\\\/(.+)|\\\\/*)$\";\n\t} else if (end) regexpSource += \"\\\\/*$\";\n\telse if (path !== \"\" && path !== \"/\") regexpSource += \"(?:(?=\\\\/|$))\";\n\treturn [new RegExp(regexpSource, caseSensitive ? void 0 : \"i\"), params];\n}\nfunction decodePath(value) {\n\ttry {\n\t\treturn value.split(\"/\").map((v) => decodeURIComponent(v).replace(/\\//g, \"%2F\")).join(\"/\");\n\t} catch (error) {\n\t\twarning(false, `The URL path \"${value}\" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).`);\n\t\treturn value;\n\t}\n}\nfunction stripBasename(pathname, basename) {\n\tif (basename === \"/\") return pathname;\n\tif (!pathname.toLowerCase().startsWith(basename.toLowerCase())) return null;\n\tlet startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n\tlet nextChar = pathname.charAt(startIndex);\n\tif (nextChar && nextChar !== \"/\") return null;\n\treturn pathname.slice(startIndex) || \"/\";\n}\nfunction prependBasename({ basename, pathname }) {\n\treturn pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n}\nconst isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);\n/**\n* Returns a resolved {@link Path} object relative to the given pathname.\n*\n* @public\n* @category Utils\n* @param to The path to resolve, either a string or a partial {@link Path}\n* object.\n* @param fromPathname The pathname to resolve the path from. Defaults to `/`.\n* @returns A {@link Path} object with the resolved pathname, search, and hash.\n*/\nfunction resolvePath(to, fromPathname = \"/\") {\n\tlet { pathname: toPathname, search = \"\", hash = \"\" } = typeof to === \"string\" ? parsePath(to) : to;\n\tlet pathname;\n\tif (toPathname) {\n\t\ttoPathname = removeDoubleSlashes(toPathname);\n\t\tif (toPathname.startsWith(\"/\") || toPathname.startsWith(\"\\\\\")) pathname = resolvePathname(toPathname.substring(1), \"/\");\n\t\telse pathname = resolvePathname(toPathname, fromPathname);\n\t} else pathname = fromPathname;\n\treturn {\n\t\tpathname,\n\t\tsearch: normalizeSearch(search),\n\t\thash: normalizeHash(hash)\n\t};\n}\nfunction resolvePathname(relativePath, fromPathname) {\n\tlet segments = removeTrailingSlash(fromPathname).split(\"/\");\n\trelativePath.split(\"/\").forEach((segment) => {\n\t\tif (segment === \"..\") {\n\t\t\tif (segments.length > 1) segments.pop();\n\t\t} else if (segment !== \".\") segments.push(segment);\n\t});\n\treturn segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\nfunction getInvalidPathError(char, field, dest, path) {\n\treturn `Cannot include a '${char}' character in a manually specified \\`to.${field}\\` field [${JSON.stringify(path)}]. Please separate it out to the \\`to.${dest}\\` field. Alternatively you may provide the full path as a string in <Link to=\"...\"> and the router will parse it for you.`;\n}\nfunction getPathContributingMatches(matches) {\n\treturn matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\nfunction getResolveToMatches(matches) {\n\tlet pathMatches = getPathContributingMatches(matches);\n\treturn pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);\n}\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {\n\tlet to;\n\tif (typeof toArg === \"string\") to = parsePath(toArg);\n\telse {\n\t\tto = { ...toArg };\n\t\tinvariant(!to.pathname || !to.pathname.includes(\"?\"), getInvalidPathError(\"?\", \"pathname\", \"search\", to));\n\t\tinvariant(!to.pathname || !to.pathname.includes(\"#\"), getInvalidPathError(\"#\", \"pathname\", \"hash\", to));\n\t\tinvariant(!to.search || !to.search.includes(\"#\"), getInvalidPathError(\"#\", \"search\", \"hash\", to));\n\t}\n\tlet isEmptyPath = toArg === \"\" || to.pathname === \"\";\n\tlet toPathname = isEmptyPath ? \"/\" : to.pathname;\n\tlet from;\n\tif (toPathname == null) from = locationPathname;\n\telse {\n\t\tlet routePathnameIndex = routePathnames.length - 1;\n\t\tif (!isPathRelative && toPathname.startsWith(\"..\")) {\n\t\t\tlet toSegments = toPathname.split(\"/\");\n\t\t\twhile (toSegments[0] === \"..\") {\n\t\t\t\ttoSegments.shift();\n\t\t\t\troutePathnameIndex -= 1;\n\t\t\t}\n\t\t\tto.pathname = toSegments.join(\"/\");\n\t\t}\n\t\tfrom = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n\t}\n\tlet path = resolvePath(to, from);\n\tlet hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n\tlet hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n\tif (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) path.pathname += \"/\";\n\treturn path;\n}\nconst removeDoubleSlashes = (path) => path.replace(/[\\\\/]{2,}/g, \"/\");\nconst joinPaths = (paths) => removeDoubleSlashes(paths.join(\"/\"));\nfunction removeTrailingSlash(path, minLength = 0) {\n\tlet end = path.length;\n\twhile (end > minLength && path.charCodeAt(end - 1) === 47) end--;\n\treturn end === path.length ? path : path.slice(0, end);\n}\nconst normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\\/*/, \"/\");\nconst normalizeSearch = (search) => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\nconst normalizeHash = (hash) => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\nvar DataWithResponseInit = class {\n\ttype = \"DataWithResponseInit\";\n\tdata;\n\tinit;\n\tconstructor(data, init) {\n\t\tthis.data = data;\n\t\tthis.init = init || null;\n\t}\n};\n/**\n* Create \"responses\" that contain `headers`/`status` without forcing\n* serialization into an actual [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n*\n* @example\n* import { data } from \"react-router\";\n*\n* export async function action({ request }: Route.ActionArgs) {\n* let formData = await request.formData();\n* let item = await createItem(formData);\n* return data(item, {\n* headers: { \"X-Custom-Header\": \"value\" }\n* status: 201,\n* });\n* }\n*\n* @public\n* @category Utils\n* @mode framework\n* @mode data\n* @param data The data to be included in the response.\n* @param init The status code or a `ResponseInit` object to be included in the\n* response.\n* @returns A {@link DataWithResponseInit} instance containing the data and\n* response init.\n*/\nfunction data(data, init) {\n\treturn new DataWithResponseInit(data, typeof init === \"number\" ? { status: init } : init);\n}\n/**\n* A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response).\n* Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)\n* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).\n*\n* This utility accepts absolute URLs and can navigate to external domains, so\n* the application should validate any user-supplied inputs to redirects.\n*\n* @example\n* import { redirect } from \"react-router\";\n*\n* export async function loader({ request }: Route.LoaderArgs) {\n* if (!isLoggedIn(request))\n* throw redirect(\"/login\");\n* }\n*\n* // ...\n* }\n*\n* @public\n* @category Utils\n* @mode framework\n* @mode data\n* @param url The URL to redirect to.\n* @param init The status code or a `ResponseInit` object to be included in the\n* response.\n* @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n* object with the redirect status and [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)\n* header.\n*/\nconst redirect = (url, init = 302) => {\n\tlet responseInit = init;\n\tif (typeof responseInit === \"number\") responseInit = { status: responseInit };\n\telse if (typeof responseInit.status === \"undefined\") responseInit.status = 302;\n\tlet headers = new Headers(responseInit.headers);\n\theaders.set(\"Location\", url);\n\treturn new Response(null, {\n\t\t...responseInit,\n\t\theaders\n\t});\n};\n/**\n* A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n* that will force a document reload to the new location. Sets the status code\n* and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)\n* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).\n*\n* This utility accepts absolute URLs and can navigate to external domains, so\n* the application should validate any user-supplied inputs to redirects.\n*\n* ```tsx filename=routes/logout.tsx\n* import { redirectDocument } from \"react-router\";\n*\n* import { destroySession } from \"../sessions.server\";\n*\n* export async function action({ request }: Route.ActionArgs) {\n* let session = await getSession(request.headers.get(\"Cookie\"));\n* return redirectDocument(\"/\", {\n* headers: { \"Set-Cookie\": await destroySession(session) }\n* });\n* }\n* ```\n*\n* @public\n* @category Utils\n* @mode framework\n* @mode data\n* @param url The URL to redirect to.\n* @param init The status code or a `ResponseInit` object to be included in the\n* response.\n* @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n* object with the redirect status and [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)\n* header.\n*/\nconst redirectDocument = (url, init) => {\n\tlet response = redirect(url, init);\n\tresponse.headers.set(\"X-Remix-Reload-Document\", \"true\");\n\treturn response;\n};\n/**\n* A redirect [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n* that will perform a [`history.replaceState`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState)\n* instead of a [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState)\n* for client-side navigation redirects. Sets the status code and the [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)\n* header. Defaults to [`302 Found`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302).\n*\n* @example\n* import { replace } from \"react-router\";\n*\n* export async function loader() {\n* return replace(\"/new-location\");\n* }\n*\n* @public\n* @category Utils\n* @mode framework\n* @mode data\n* @param url The URL to redirect to.\n* @param init The status code or a `ResponseInit` object to be included in the\n* response.\n* @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n* object with the redirect status and [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)\n* header.\n*/\nconst replace = (url, init) => {\n\tlet response = redirect(url, init);\n\tresponse.headers.set(\"X-Remix-Replace\", \"true\");\n\treturn response;\n};\nconst SUPPORTED_ERROR_TYPES = [\n\t\"EvalError\",\n\t\"RangeError\",\n\t\"ReferenceError\",\n\t\"SyntaxError\",\n\t\"TypeError\",\n\t\"URIError\"\n];\nvar ErrorResponseImpl = class {\n\tstatus;\n\tstatusText;\n\tdata;\n\terror;\n\tinternal;\n\tconstructor(status, statusText, data, internal = false) {\n\t\tthis.status = status;\n\t\tthis.statusText = statusText || \"\";\n\t\tthis.internal = internal;\n\t\tif (data instanceof Error) {\n\t\t\tthis.data = data.toString();\n\t\t\tthis.error = data;\n\t\t} else this.data = data;\n\t}\n};\n/**\n* Check if the given error is an {@link ErrorResponse} generated from a 4xx/5xx\n* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n* thrown from an [`action`](../../start/framework/route-module#action) or\n* [`loader`](../../start/framework/route-module#loader) function.\n*\n* @example\n* import { isRouteErrorResponse } from \"react-router\";\n*\n* export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {\n* if (isRouteErrorResponse(error)) {\n* return (\n* <>\n* <p>Error: `${error.status}: ${error.statusText}`</p>\n* <p>{error.data}</p>\n* </>\n* );\n* }\n*\n* return (\n* <p>Error: {error instanceof Error ? error.message : \"Unknown Error\"}</p>\n* );\n* }\n*\n* @public\n* @category Utils\n* @mode framework\n* @mode data\n* @param error The error to check.\n* @returns `true` if the error is an {@link ErrorResponse}, `false` otherwise.\n*/\nfunction isRouteErrorResponse(error) {\n\treturn error != null && typeof error.status === \"number\" && typeof error.statusText === \"string\" && typeof error.internal === \"boolean\" && \"data\" in error;\n}\nfunction getRoutePattern(matches) {\n\treturn joinPaths(matches.map((m) => m.route.path).filter(Boolean)) || \"/\";\n}\nfunction createDataFunctionUrl(request, path) {\n\tlet url = new URL(typeof request === \"string\" || request instanceof URL ? request : request.url);\n\tlet parsed = typeof path === \"string\" ? parsePath(path) : path;\n\turl.pathname = parsed.pathname || \"/\";\n\tif (parsed.search) {\n\t\tlet searchParams = new URLSearchParams(parsed.search);\n\t\tlet indexValues = searchParams.getAll(\"index\");\n\t\tsearchParams.delete(\"index\");\n\t\tfor (let value of indexValues.filter(Boolean)) searchParams.append(\"index\", value);\n\t\tlet search = searchParams.toString();\n\t\turl.search = search ? `?${search}` : \"\";\n\t} else url.search = \"\";\n\turl.hash = parsed.hash || \"\";\n\treturn url;\n}\nconst isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof window.document.createElement !== \"undefined\";\nfunction parseToInfo(_to, basename) {\n\tlet to = _to;\n\tif (typeof to !== \"string\" || !ABSOLUTE_URL_REGEX.test(to)) return {\n\t\tabsoluteURL: void 0,\n\t\tisExternal: false,\n\t\tto\n\t};\n\tlet absoluteURL = to;\n\tlet isExternal = false;\n\tif (isBrowser) try {\n\t\tlet currentUrl = new URL(window.location.href);\n\t\tlet targetUrl = PROTOCOL_RELATIVE_URL_REGEX.test(to) ? new URL(normalizeProtocolRelativeUrl(to, currentUrl.protocol)) : new URL(to);\n\t\tlet path = stripBasename(targetUrl.pathname, basename);\n\t\tif (targetUrl.origin === currentUrl.origin && path != null) to = path + targetUrl.search + targetUrl.hash;\n\t\telse isExternal = true;\n\t} catch {\n\t\twarning(false, `<Link to=\"${to}\"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`);\n\t}\n\treturn {\n\t\tabsoluteURL,\n\t\tisExternal,\n\t\tto\n\t};\n}\n//#endregion\nexport { ErrorResponseImpl, RouterContextProvider, SUPPORTED_ERROR_TYPES, compilePath, convertRouteMatchToUiMatch, convertRoutesToDataRoutes, createContext, createDataFunctionUrl, data, decodePath, defaultMapRouteProperties, encodePathParam, explodeOptionalSegments, flattenAndRankRoutes, generatePath, getPathContributingMatches, getResolveToMatches, getRoutePattern, isAbsoluteUrl, isBrowser, isRouteErrorResponse, isUnsupportedLazyRouteFunctionKey, isUnsupportedLazyRouteObjectKey, joinPaths, matchPath, matchRoutes, matchRoutesImpl, normalizePathname, parseToInfo, prependBasename, redirect, redirectDocument, removeDoubleSlashes, removeTrailingSlash, replace, resolvePath, resolveTo, stripBasename };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { createPath, invariant } from \"./history.js\";\nimport { RouterContextProvider, createContext } from \"./utils.js\";\n//#region lib/router/instrumentation.ts\nconst UninstrumentedSymbol = Symbol(\"Uninstrumented\");\nconst instrumentationResultMetaContext = createContext();\nlet instrumentationClientResultMetaReceivers = /* @__PURE__ */ new WeakMap();\nfunction getRouteInstrumentationUpdates(fns, route) {\n\tlet aggregated = {\n\t\tlazy: [],\n\t\t\"lazy.loader\": [],\n\t\t\"lazy.action\": [],\n\t\t\"lazy.middleware\": [],\n\t\tmiddleware: [],\n\t\tloader: [],\n\t\taction: []\n\t};\n\tfns.forEach((fn) => fn({\n\t\tid: route.id,\n\t\tindex: route.index,\n\t\tpath: route.path,\n\t\tinstrument(i) {\n\t\t\tif (i.lazy != null) aggregated.lazy.push(i.lazy);\n\t\t\tif (i[\"lazy.loader\"] != null) aggregated[\"lazy.loader\"].push(i[\"lazy.loader\"]);\n\t\t\tif (i[\"lazy.action\"] != null) aggregated[\"lazy.action\"].push(i[\"lazy.action\"]);\n\t\t\tif (i[\"lazy.middleware\"] != null) aggregated[\"lazy.middleware\"].push(i[\"lazy.middleware\"]);\n\t\t\tif (i.middleware != null) aggregated.middleware.push(i.middleware);\n\t\t\tif (i.loader != null) aggregated.loader.push(i.loader);\n\t\t\tif (i.action != null) aggregated.action.push(i.action);\n\t\t}\n\t}));\n\tlet updates = {};\n\tif (typeof route.lazy === \"function\" && aggregated.lazy.length > 0) {\n\t\tlet lazy = route.lazy;\n\t\tupdates.lazy = async (...args) => {\n\t\t\treturn throwOrReturnResult(await recurseRight(aggregated.lazy, void 0, () => lazy(...args), getInstrumentationInnerResult));\n\t\t};\n\t}\n\tif (typeof route.lazy === \"object\") {\n\t\tlet lazyObject = route.lazy;\n\t\tif (typeof lazyObject.middleware === \"function\" && aggregated[\"lazy.middleware\"].length > 0) {\n\t\t\tlet middleware = lazyObject.middleware;\n\t\t\tupdates.lazy = Object.assign(updates.lazy || {}, { middleware: async (...args) => {\n\t\t\t\treturn throwOrReturnResult(await recurseRight(aggregated[\"lazy.middleware\"], void 0, () => middleware(...args), getInstrumentationInnerResult));\n\t\t\t} });\n\t\t}\n\t\tif (typeof lazyObject.loader === \"function\" && aggregated[\"lazy.loader\"].length > 0) {\n\t\t\tlet loader = lazyObject.loader;\n\t\t\tupdates.lazy = Object.assign(updates.lazy || {}, { loader: async (...args) => {\n\t\t\t\treturn throwOrReturnResult(await recurseRight(aggregated[\"lazy.loader\"], void 0, () => loader(...args), getInstrumentationInnerResult));\n\t\t\t} });\n\t\t}\n\t\tif (typeof lazyObject.action === \"function\" && aggregated[\"lazy.action\"].length > 0) {\n\t\t\tlet action = lazyObject.action;\n\t\t\tupdates.lazy = Object.assign(updates.lazy || {}, { action: async (...args) => {\n\t\t\t\treturn throwOrReturnResult(await recurseRight(aggregated[\"lazy.action\"], void 0, () => action(...args), getInstrumentationInnerResult));\n\t\t\t} });\n\t\t}\n\t}\n\tif (typeof route.loader === \"function\" && aggregated.loader.length > 0) {\n\t\tlet original = getUninstrumentedHandler(route.loader);\n\t\tlet instrumented = async (...args) => {\n\t\t\treturn throwOrReturnResult(await recurseRight(aggregated.loader, getHandlerInfo(args[0]), () => original(...args), getInstrumentationInnerResult));\n\t\t};\n\t\tif (original.hydrate === true) instrumented.hydrate = true;\n\t\tsetUninstrumentedHandler(instrumented, original);\n\t\tupdates.loader = instrumented;\n\t}\n\tif (typeof route.action === \"function\" && aggregated.action.length > 0) {\n\t\tlet original = getUninstrumentedHandler(route.action);\n\t\tlet instrumented = async (...args) => {\n\t\t\treturn throwOrReturnResult(await recurseRight(aggregated.action, getHandlerInfo(args[0]), () => original(...args), getInstrumentationInnerResult));\n\t\t};\n\t\tsetUninstrumentedHandler(instrumented, original);\n\t\tupdates.action = instrumented;\n\t}\n\tif (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) updates.middleware = route.middleware.map((middleware) => {\n\t\tlet original = getUninstrumentedHandler(middleware);\n\t\tlet instrumented = async (...args) => {\n\t\t\treturn throwOrReturnResult(await recurseRight(aggregated.middleware, getHandlerInfo(args[0]), () => original(...args), getInstrumentationInnerResult));\n\t\t};\n\t\tsetUninstrumentedHandler(instrumented, original);\n\t\treturn instrumented;\n\t});\n\treturn updates;\n}\nfunction instrumentClientSideRouter(router, fns) {\n\tlet aggregated = {\n\t\tnavigate: [],\n\t\tfetch: []\n\t};\n\tfns.forEach((fn) => fn({ instrument(i) {\n\t\tif (i.navigate != null) aggregated.navigate.push(i.navigate);\n\t\tif (i.fetch != null) aggregated.fetch.push(i.fetch);\n\t} }));\n\tif (aggregated.navigate.length > 0) {\n\t\tlet navigate = getUninstrumentedHandler(router.navigate);\n\t\tlet instrumentedNavigate = async (...args) => {\n\t\t\tlet [to, opts] = args;\n\t\t\tlet meta;\n\t\t\tlet info = {\n\t\t\t\tto: typeof to === \"number\" || typeof to === \"string\" ? to : to ? createPath(to) : \".\",\n\t\t\t\t...getRouterInfo(router, opts ?? {})\n\t\t\t};\n\t\t\treturn throwOrReturnResult(await recurseRight(aggregated.navigate, info, async () => {\n\t\t\t\tif (typeof to === \"number\") return await navigate(...args);\n\t\t\t\tlet cleanup = setInstrumentationClientResultMetaReceiver(router, (value) => {\n\t\t\t\t\tmeta = value;\n\t\t\t\t});\n\t\t\t\ttry {\n\t\t\t\t\treturn await navigate(...args);\n\t\t\t\t} finally {\n\t\t\t\t\tcleanup();\n\t\t\t\t}\n\t\t\t}, (result) => ({\n\t\t\t\t...getInstrumentationInnerResult(result),\n\t\t\t\tmeta\n\t\t\t})));\n\t\t};\n\t\tsetUninstrumentedHandler(instrumentedNavigate, navigate);\n\t\trouter.navigate = instrumentedNavigate;\n\t}\n\tif (aggregated.fetch.length > 0) {\n\t\tlet fetch = getUninstrumentedHandler(router.fetch);\n\t\tlet instrumentedFetch = async (...args) => {\n\t\t\tlet [key, _, href, opts] = args;\n\t\t\tlet meta;\n\t\t\treturn throwOrReturnResult(await recurseRight(aggregated.fetch, {\n\t\t\t\thref: href ?? \".\",\n\t\t\t\tfetcherKey: key,\n\t\t\t\t...getRouterInfo(router, opts ?? {})\n\t\t\t}, async () => {\n\t\t\t\tlet cleanup = setInstrumentationClientResultMetaReceiver(router, (value) => {\n\t\t\t\t\tmeta = value;\n\t\t\t\t});\n\t\t\t\ttry {\n\t\t\t\t\treturn await fetch(...args);\n\t\t\t\t} finally {\n\t\t\t\t\tcleanup();\n\t\t\t\t}\n\t\t\t}, (result) => ({\n\t\t\t\t...getInstrumentationInnerResult(result),\n\t\t\t\tmeta\n\t\t\t})));\n\t\t};\n\t\tsetUninstrumentedHandler(instrumentedFetch, fetch);\n\t\trouter.fetch = instrumentedFetch;\n\t}\n\treturn router;\n}\nfunction instrumentHandler(handler, fns) {\n\tlet aggregated = { request: [] };\n\tfns.forEach((fn) => fn({ instrument(i) {\n\t\tif (i.request != null) aggregated.request.push(i.request);\n\t} }));\n\tlet instrumentedHandler = handler;\n\tif (aggregated.request.length > 0) instrumentedHandler = async (...args) => {\n\t\tlet [request, context] = args;\n\t\tlet instrumentationContext = context ?? new RouterContextProvider();\n\t\treturn throwOrReturnResult(await recurseRight(aggregated.request, {\n\t\t\trequest: getReadonlyRequest(request),\n\t\t\tcontext: getReadonlyContext(instrumentationContext)\n\t\t}, () => handler(request, instrumentationContext), (result, info) => {\n\t\t\tlet meta;\n\t\t\ttry {\n\t\t\t\tmeta = info.context?.get(instrumentationResultMetaContext);\n\t\t\t} catch {}\n\t\t\tinvariant(result.value instanceof Response, \"Expected a Response from the request handler\");\n\t\t\treturn {\n\t\t\t\t...getInstrumentationInnerResult(result),\n\t\t\t\tstatusCode: result.value.status,\n\t\t\t\tmeta\n\t\t\t};\n\t\t}));\n\t};\n\treturn instrumentedHandler;\n}\nfunction getUninstrumentedHandler(handler) {\n\treturn handler[UninstrumentedSymbol] ?? handler;\n}\nfunction setUninstrumentedHandler(handler, uninstrumentedHandler) {\n\thandler[UninstrumentedSymbol] = uninstrumentedHandler;\n}\nfunction setInstrumentationClientResultMetaReceiver(router, receiver) {\n\tinstrumentationClientResultMetaReceivers.set(router, receiver);\n\treturn () => {\n\t\tif (instrumentationClientResultMetaReceivers.get(router) === receiver) instrumentationClientResultMetaReceivers.delete(router);\n\t};\n}\nfunction consumeInstrumentationClientResultMetaReceiver(router) {\n\tlet receiver = instrumentationClientResultMetaReceivers.get(router);\n\tinstrumentationClientResultMetaReceivers.delete(router);\n\treturn receiver;\n}\nfunction throwOrReturnResult(result) {\n\tif (result.type === \"error\") throw result.value;\n\treturn result.value;\n}\nasync function recurseRight(impls, info, handler, getInnerResult, state = {\n\tresult: null,\n\tinnerResult: null\n}, index = impls.length - 1) {\n\tlet impl = impls[index];\n\tif (!impl) {\n\t\ttry {\n\t\t\tstate.result = {\n\t\t\t\ttype: \"success\",\n\t\t\t\tvalue: await handler()\n\t\t\t};\n\t\t} catch (e) {\n\t\t\tstate.result = {\n\t\t\t\ttype: \"error\",\n\t\t\t\tvalue: e\n\t\t\t};\n\t\t}\n\t\tstate.innerResult = getInnerResult(state.result, info);\n\t} else {\n\t\tlet handlerPromise = void 0;\n\t\tlet callHandler = async () => {\n\t\t\tif (handlerPromise) console.error(\"You cannot call instrumented handlers more than once\");\n\t\t\telse handlerPromise = recurseRight(impls, info, handler, getInnerResult, state, index - 1);\n\t\t\tawait handlerPromise;\n\t\t\tinvariant(state.innerResult, \"Expected an inner result\");\n\t\t\treturn state.innerResult;\n\t\t};\n\t\ttry {\n\t\t\tawait impl(callHandler, info);\n\t\t} catch (e) {\n\t\t\tconsole.error(\"An instrumentation function threw an error:\", e);\n\t\t}\n\t\tif (!handlerPromise) await callHandler();\n\t\tawait handlerPromise;\n\t}\n\tif (state.result) return state.result;\n\tstate.result = {\n\t\ttype: \"error\",\n\t\tvalue: /* @__PURE__ */ new Error(\"No result assigned in instrumentation chain.\")\n\t};\n\tstate.innerResult = getInnerResult(state.result, info);\n\treturn state.result;\n}\nfunction getInstrumentationInnerResult(result) {\n\tif (result.type === \"error\" && result.value instanceof Error) return {\n\t\tstatus: \"error\",\n\t\terror: result.value\n\t};\n\treturn {\n\t\tstatus: \"success\",\n\t\terror: void 0\n\t};\n}\nfunction getHandlerInfo(args) {\n\tlet { request, context, params } = args;\n\treturn {\n\t\t...args,\n\t\trequest: getReadonlyRequest(request),\n\t\tparams: { ...params },\n\t\tcontext: getReadonlyContext(context)\n\t};\n}\nfunction getRouterInfo(router, opts) {\n\treturn {\n\t\tcurrentUrl: createPath(router.state.location),\n\t\t...\"formMethod\" in opts ? { formMethod: opts.formMethod } : {},\n\t\t...\"formEncType\" in opts ? { formEncType: opts.formEncType } : {},\n\t\t...\"formData\" in opts ? { formData: opts.formData } : {},\n\t\t...\"body\" in opts ? { body: opts.body } : {}\n\t};\n}\nfunction getReadonlyRequest(request) {\n\treturn {\n\t\tmethod: request.method,\n\t\turl: request.url,\n\t\theaders: { get: (...args) => request.headers.get(...args) }\n\t};\n}\nfunction getReadonlyContext(context) {\n\treturn { get: (ctx) => context.get(ctx) };\n}\n//#endregion\nexport { consumeInstrumentationClientResultMetaReceiver, getRouteInstrumentationUpdates, instrumentClientSideRouter, instrumentHandler, instrumentationResultMetaContext };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { flattenAndRankRoutes, matchRoutesImpl } from \"./utils.js\";\n//#region lib/router/matcher.ts\nvar V6RegExMatcher = class {\n\t#routes = [];\n\t#branches = [];\n\t#basename;\n\tconstructor(basename) {\n\t\tthis.#basename = basename;\n\t}\n\tupdate(routes) {\n\t\tthis.#routes = routes;\n\t\tthis.#branches = flattenAndRankRoutes(routes);\n\t}\n\tmatch(locationArg, allowPartial = false) {\n\t\treturn matchRoutesImpl(this.#routes, locationArg, this.#basename, allowPartial, this.#branches);\n\t}\n};\n//#endregion\nexport { V6RegExMatcher };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { RoutePatternDataRouteMatcher } from \"./matcher-route-pattern.js\";\n//#region lib/router/matcher-route-pattern.preload.ts\nlet RoutePatternMatcher;\nfunction getRoutePatternMatcher() {\n\treturn RoutePatternMatcher;\n}\n/**\n* Initialize the route-pattern matcher before creating a Data Router or static\n* handler with `future.unstable_routePatternMatching` enabled. Import from\n* `react-router/route-pattern` and call this once during application startup.\n* Server and browser applications must each preload their own matcher.\n*\n* The matcher is statically imported by this module. Tree-shaking bundlers can\n* remove it from applications that do not use this function. Initialization is\n* synchronous, and repeated calls are safe.\n*\n* @public\n* @category Data Routers\n* @mode data\n* @returns {void}\n*/\nfunction unstable_preloadRoutePattern() {\n\tRoutePatternMatcher = RoutePatternDataRouteMatcher;\n}\n//#endregion\nexport { getRoutePatternMatcher, unstable_preloadRoutePattern };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\n//#region lib/router/navigation.ts\nconst DEFAULT_NAVIGATION_URL = new URL(\"http://localhost\");\nfunction getNavigatorCurrentUrl(navigator) {\n\tif (navigator.createURL) return navigator.createURL(\"/\");\n\ttry {\n\t\treturn new URL(navigator.createHref(\"/\"), DEFAULT_NAVIGATION_URL);\n\t} catch {\n\t\treturn DEFAULT_NAVIGATION_URL;\n\t}\n}\nfunction isSameOrigin(a, b) {\n\treturn a.origin === b.origin && (a.origin !== \"null\" || a.protocol === b.protocol && a.host === b.host);\n}\nfunction isExplicitUrl(destination, target) {\n\tif (destination.startsWith(\"//\")) return true;\n\tlet protocol = target.protocol.toLowerCase();\n\tif (!destination.toLowerCase().startsWith(protocol)) return false;\n\treturn target.host === \"\" || destination.slice(protocol.length).startsWith(\"//\");\n}\nfunction validateNavigationTarget(original, resolved, currentUrl, externalPolicy) {\n\tlet originalUrl = null;\n\ttry {\n\t\toriginalUrl = original == null ? null : new URL(original, currentUrl);\n\t} catch {}\n\tlet resolvedUrl = new URL(resolved, currentUrl);\n\tlet originalIsExternal = originalUrl != null && !isSameOrigin(originalUrl, currentUrl);\n\tlet resolvedIsExternal = !isSameOrigin(resolvedUrl, currentUrl);\n\tif (externalPolicy === \"reject\") {\n\t\tif (originalIsExternal || resolvedIsExternal) throw new Error(\"External navigation is not allowed\");\n\t} else if (resolvedIsExternal) {\n\t\tif (originalUrl == null || !isExplicitUrl(original, originalUrl) || !isSameOrigin(originalUrl, resolvedUrl)) throw new Error(\"External navigation is not allowed\");\n\t}\n}\n//#endregion\nexport { getNavigatorCurrentUrl, validateNavigationTarget };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { PROTOCOL_RELATIVE_URL_REGEX, normalizeProtocolRelativeUrl } from \"./url.js\";\nimport { createBrowserURLImpl, createLocation, createPath, invariant, parsePath, warning } from \"./history.js\";\nimport { ErrorResponseImpl, RouterContextProvider, convertRouteMatchToUiMatch, convertRoutesToDataRoutes, createDataFunctionUrl, getPathContributingMatches, getResolveToMatches, getRoutePattern, isAbsoluteUrl, isRouteErrorResponse, isUnsupportedLazyRouteFunctionKey, isUnsupportedLazyRouteObjectKey, prependBasename, removeDoubleSlashes, resolveTo, stripBasename } from \"./utils.js\";\nimport { consumeInstrumentationClientResultMetaReceiver, getRouteInstrumentationUpdates, instrumentClientSideRouter } from \"./instrumentation.js\";\nimport { V6RegExMatcher } from \"./matcher.js\";\nimport { getRoutePatternMatcher } from \"./matcher-route-pattern.preload.js\";\nimport { validateNavigationTarget } from \"./navigation.js\";\n//#region lib/router/router.ts\nconst validMutationMethodsArr = [\n\t\"POST\",\n\t\"PUT\",\n\t\"PATCH\",\n\t\"DELETE\"\n];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"GET\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([\n\t301,\n\t302,\n\t303,\n\t307,\n\t308\n]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n\tstate: \"idle\",\n\tlocation: void 0,\n\tmatches: void 0,\n\thistoryAction: void 0,\n\tformMethod: void 0,\n\tformAction: void 0,\n\tformEncType: void 0,\n\tformData: void 0,\n\tjson: void 0,\n\ttext: void 0\n};\nconst IDLE_FETCHER = {\n\tstate: \"idle\",\n\tdata: void 0,\n\tformMethod: void 0,\n\tformAction: void 0,\n\tformEncType: void 0,\n\tformData: void 0,\n\tjson: void 0,\n\ttext: void 0\n};\nconst IDLE_BLOCKER = {\n\tstate: \"unblocked\",\n\tproceed: void 0,\n\treset: void 0,\n\tlocation: void 0\n};\nconst TRANSITIONS_STORAGE_KEY = \"remix-router-transitions\";\nconst ResetLoaderDataSymbol = Symbol(\"ResetLoaderData\");\nfunction createDataRouteMatcher(future, basename) {\n\tif (future.unstable_routePatternMatching) {\n\t\tlet RoutePatternMatcher = getRoutePatternMatcher();\n\t\tinvariant(RoutePatternMatcher, \"You must call unstable_preloadRoutePattern() from \\\"react-router/route-pattern\\\" before enabling future.unstable_routePatternMatching.\");\n\t\treturn new RoutePatternMatcher(basename);\n\t}\n\treturn new V6RegExMatcher(basename);\n}\n/**\n* Encapsulates the stable and in-flight route trees together with their\n* pre-computed branch caches so the structures always stay in sync.\n*/\nvar DataRoutes = class {\n\t#routes;\n\t#hmrRoutes;\n\t#matcher;\n\tconstructor(routes, matcher) {\n\t\tthis.#routes = routes;\n\t\tthis.#matcher = matcher;\n\t\tthis.#matcher.update(routes);\n\t}\n\t/** The stable route tree */\n\tget stableRoutes() {\n\t\treturn this.#routes;\n\t}\n\t/** The in-flight route tree if one is active, otherwise the stable tree */\n\tget activeRoutes() {\n\t\treturn this.#hmrRoutes ?? this.#routes;\n\t}\n\tget hasHMRRoutes() {\n\t\treturn this.#hmrRoutes != null;\n\t}\n\t/** Replace the stable route tree and recompute its branches */\n\tsetRoutes(routes) {\n\t\tthis.#routes = routes;\n\t\tif (!this.#hmrRoutes) this.#matcher.update(routes);\n\t}\n\t/** Set a new in-flight route tree and recompute its branches */\n\tsetHmrRoutes(routes) {\n\t\tthis.#hmrRoutes = routes;\n\t\tthis.#matcher.update(routes);\n\t}\n\t/** Commit in-flight routes/branches to the stable slot and clear in-flight */\n\tcommitHmrRoutes() {\n\t\tif (this.#hmrRoutes) {\n\t\t\tthis.#routes = this.#hmrRoutes;\n\t\t\tthis.#hmrRoutes = void 0;\n\t\t\tthis.#matcher.update(this.#routes);\n\t\t}\n\t}\n};\n/**\n* Create a router and listen to history POP navigations\n*/\nfunction createRouter(init) {\n\tconst routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : void 0;\n\tconst isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n\tinvariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n\tlet hydrationRouteProperties = init.hydrationRouteProperties || [];\n\tlet _mapRouteProperties = init.mapRouteProperties;\n\tlet mapRouteProperties = _mapRouteProperties ? _mapRouteProperties : () => ({});\n\tif (init.instrumentations) {\n\t\tlet instrumentations = init.instrumentations;\n\t\tmapRouteProperties = (route) => {\n\t\t\treturn {\n\t\t\t\t..._mapRouteProperties?.(route),\n\t\t\t\t...getRouteInstrumentationUpdates(instrumentations.map((i) => i.route).filter(Boolean), route)\n\t\t\t};\n\t\t};\n\t}\n\tlet future = { ...init.future };\n\tlet basename = init.basename || \"/\";\n\tif (!basename.startsWith(\"/\")) basename = `/${basename}`;\n\tlet dataRouteMatcher = createDataRouteMatcher(future, basename);\n\tlet manifest = {};\n\tlet dataRoutes = new DataRoutes(convertRoutesToDataRoutes(init.routes, mapRouteProperties, void 0, manifest), dataRouteMatcher);\n\tlet dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware;\n\tlet unlistenHistory = null;\n\tlet subscribers = /* @__PURE__ */ new Set();\n\tlet bufferedInitialStateUpdate = null;\n\tlet savedScrollPositions = null;\n\tlet getScrollRestorationKey = null;\n\tlet getScrollPosition = null;\n\tlet initialScrollRestored = init.hydrationData != null;\n\tlet initialMatches = dataRouteMatcher.match(init.history.location);\n\tlet initialMatchesIsFOW = false;\n\tlet initialErrors = null;\n\tlet initialized;\n\tlet renderFallback;\n\tif (initialMatches == null && !init.patchRoutesOnNavigation) {\n\t\tlet error = getInternalRouterError(404, { pathname: init.history.location.pathname });\n\t\tlet { matches, route } = getShortCircuitMatches(dataRoutes.activeRoutes);\n\t\tinitialized = true;\n\t\trenderFallback = !initialized;\n\t\tinitialMatches = matches;\n\t\tinitialErrors = { [route.id]: error };\n\t} else {\n\t\tif (initialMatches && !init.hydrationData) {\n\t\t\tif (checkFogOfWar(initialMatches, init.history.location.pathname).active) initialMatches = null;\n\t\t}\n\t\tif (!initialMatches) {\n\t\t\tinitialized = false;\n\t\t\trenderFallback = !initialized;\n\t\t\tinitialMatches = [];\n\t\t\tlet fogOfWar = checkFogOfWar(null, init.history.location.pathname);\n\t\t\tif (fogOfWar.active && fogOfWar.matches) {\n\t\t\t\tinitialMatchesIsFOW = true;\n\t\t\t\tinitialMatches = fogOfWar.matches;\n\t\t\t}\n\t\t} else if (initialMatches.some((m) => m.route.lazy)) {\n\t\t\tinitialized = false;\n\t\t\trenderFallback = !initialized;\n\t\t} else if (!initialMatches.some((m) => routeHasLoaderOrMiddleware(m.route))) {\n\t\t\tinitialized = true;\n\t\t\trenderFallback = !initialized;\n\t\t} else {\n\t\t\tlet loaderData = init.hydrationData ? init.hydrationData.loaderData : null;\n\t\t\tlet errors = init.hydrationData ? init.hydrationData.errors : null;\n\t\t\tlet relevantMatches = initialMatches;\n\t\t\tif (errors) {\n\t\t\t\tlet idx = initialMatches.findIndex((m) => errors[m.route.id] !== void 0);\n\t\t\t\trelevantMatches = relevantMatches.slice(0, idx + 1);\n\t\t\t}\n\t\t\trenderFallback = false;\n\t\t\tinitialized = true;\n\t\t\trelevantMatches.forEach((m) => {\n\t\t\t\tlet status = getRouteHydrationStatus(m.route, loaderData, errors);\n\t\t\t\trenderFallback = renderFallback || status.renderFallback;\n\t\t\t\tinitialized = initialized && !status.shouldLoad;\n\t\t\t});\n\t\t}\n\t}\n\tlet router;\n\tlet state = {\n\t\thistoryAction: init.history.action,\n\t\tlocation: init.history.location,\n\t\tmatches: initialMatches,\n\t\tinitialized,\n\t\trenderFallback,\n\t\tnavigation: IDLE_NAVIGATION,\n\t\trestoreScrollPosition: init.hydrationData != null ? false : null,\n\t\tpreventScrollReset: false,\n\t\trevalidation: \"idle\",\n\t\tloaderData: init.hydrationData && init.hydrationData.loaderData || {},\n\t\tactionData: init.hydrationData && init.hydrationData.actionData || null,\n\t\terrors: init.hydrationData && init.hydrationData.errors || initialErrors,\n\t\tfetchers: /* @__PURE__ */ new Map(),\n\t\tblockers: /* @__PURE__ */ new Map()\n\t};\n\tlet pendingAction = \"POP\";\n\tlet pendingPopstateNavigationDfd = null;\n\tlet pendingPreventScrollReset = false;\n\tlet pendingNavigationController;\n\tlet pendingViewTransitionEnabled = false;\n\tlet appliedViewTransitions = /* @__PURE__ */ new Map();\n\tlet removePageHideEventListener = null;\n\tlet isUninterruptedRevalidation = false;\n\tlet isRevalidationRequired = false;\n\tlet cancelledFetcherLoads = /* @__PURE__ */ new Set();\n\tlet fetchControllers = /* @__PURE__ */ new Map();\n\tlet incrementingLoadId = 0;\n\tlet pendingNavigationLoadId = -1;\n\tlet fetchReloadIds = /* @__PURE__ */ new Map();\n\tlet fetchRedirectIds = /* @__PURE__ */ new Set();\n\tlet fetchLoadMatches = /* @__PURE__ */ new Map();\n\tlet activeFetchers = /* @__PURE__ */ new Map();\n\tlet fetchersQueuedForDeletion = /* @__PURE__ */ new Set();\n\tlet blockerFunctions = /* @__PURE__ */ new Map();\n\tlet unblockBlockerHistoryUpdate = void 0;\n\tlet pendingRevalidationDfd = null;\n\tfunction initialize() {\n\t\tunlistenHistory = init.history.listen(({ action: historyAction, location, delta }) => {\n\t\t\tif (unblockBlockerHistoryUpdate) {\n\t\t\t\tunblockBlockerHistoryUpdate();\n\t\t\t\tunblockBlockerHistoryUpdate = void 0;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\twarning(blockerFunctions.size === 0 || delta != null, \"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.\");\n\t\t\tlet blockerKey = shouldBlockNavigation({\n\t\t\t\tcurrentLocation: state.location,\n\t\t\t\tnextLocation: location,\n\t\t\t\thistoryAction\n\t\t\t});\n\t\t\tif (blockerKey && delta != null) {\n\t\t\t\tlet nextHistoryUpdatePromise = new Promise((resolve) => {\n\t\t\t\t\tunblockBlockerHistoryUpdate = resolve;\n\t\t\t\t});\n\t\t\t\tinit.history.go(delta * -1);\n\t\t\t\tupdateBlocker(blockerKey, {\n\t\t\t\t\tstate: \"blocked\",\n\t\t\t\t\tlocation,\n\t\t\t\t\tproceed() {\n\t\t\t\t\t\tupdateBlocker(blockerKey, {\n\t\t\t\t\t\t\tstate: \"proceeding\",\n\t\t\t\t\t\t\tproceed: void 0,\n\t\t\t\t\t\t\treset: void 0,\n\t\t\t\t\t\t\tlocation\n\t\t\t\t\t\t});\n\t\t\t\t\t\tnextHistoryUpdatePromise.then(() => init.history.go(delta));\n\t\t\t\t\t},\n\t\t\t\t\treset() {\n\t\t\t\t\t\tlet blockers = new Map(state.blockers);\n\t\t\t\t\t\tblockers.set(blockerKey, IDLE_BLOCKER);\n\t\t\t\t\t\tupdateState({ blockers });\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tpendingPopstateNavigationDfd?.resolve();\n\t\t\t\tpendingPopstateNavigationDfd = null;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn startNavigation(historyAction, location);\n\t\t});\n\t\tif (isBrowser) {\n\t\t\trestoreAppliedTransitions(routerWindow, appliedViewTransitions);\n\t\t\tlet _saveAppliedTransitions = () => persistAppliedTransitions(routerWindow, appliedViewTransitions);\n\t\t\trouterWindow.addEventListener(\"pagehide\", _saveAppliedTransitions);\n\t\t\tremovePageHideEventListener = () => routerWindow.removeEventListener(\"pagehide\", _saveAppliedTransitions);\n\t\t}\n\t\tif (!state.initialized) startNavigation(\"POP\", state.location, { initialHydration: true });\n\t\treturn router;\n\t}\n\tfunction dispose() {\n\t\tif (unlistenHistory) unlistenHistory();\n\t\tif (removePageHideEventListener) removePageHideEventListener();\n\t\tsubscribers.clear();\n\t\tpendingNavigationController && pendingNavigationController.abort();\n\t\tstate.fetchers.forEach((_, key) => deleteFetcher(state.fetchers, key));\n\t\tstate.blockers.forEach((_, key) => deleteBlocker(key));\n\t}\n\tfunction subscribe(fn) {\n\t\tsubscribers.add(fn);\n\t\tif (bufferedInitialStateUpdate) {\n\t\t\tlet { newErrors } = bufferedInitialStateUpdate;\n\t\t\tbufferedInitialStateUpdate = null;\n\t\t\tfn(state, {\n\t\t\t\tdeletedFetchers: [],\n\t\t\t\tnewErrors,\n\t\t\t\tviewTransitionOpts: void 0,\n\t\t\t\tflushSync: false\n\t\t\t});\n\t\t}\n\t\treturn () => subscribers.delete(fn);\n\t}\n\tfunction updateState(newState, opts = {}) {\n\t\tif (newState.matches) newState.matches = newState.matches.map((m) => {\n\t\t\tlet route = manifest[m.route.id];\n\t\t\tlet matchRoute = m.route;\n\t\t\tif (matchRoute.element !== route.element || matchRoute.errorElement !== route.errorElement || matchRoute.hydrateFallbackElement !== route.hydrateFallbackElement) return {\n\t\t\t\t...m,\n\t\t\t\troute\n\t\t\t};\n\t\t\treturn m;\n\t\t});\n\t\tstate = {\n\t\t\t...state,\n\t\t\t...newState\n\t\t};\n\t\tlet unmountedFetchers = [];\n\t\tlet mountedFetchers = [];\n\t\tstate.fetchers.forEach((fetcher, key) => {\n\t\t\tif (fetcher.state === \"idle\") if (fetchersQueuedForDeletion.has(key)) unmountedFetchers.push(key);\n\t\t\telse mountedFetchers.push(key);\n\t\t});\n\t\tfetchersQueuedForDeletion.forEach((key) => {\n\t\t\tif (!state.fetchers.has(key) && !fetchControllers.has(key)) unmountedFetchers.push(key);\n\t\t});\n\t\tif (subscribers.size === 0) bufferedInitialStateUpdate = { newErrors: newState.errors ?? null };\n\t\t[...subscribers].forEach((subscriber) => subscriber(state, {\n\t\t\tdeletedFetchers: unmountedFetchers,\n\t\t\tnewErrors: newState.errors ?? null,\n\t\t\tviewTransitionOpts: opts.viewTransitionOpts,\n\t\t\tflushSync: opts.flushSync === true\n\t\t}));\n\t\tunmountedFetchers.forEach((key) => deleteFetcher(state.fetchers, key));\n\t\tmountedFetchers.forEach((key) => state.fetchers.delete(key));\n\t}\n\tfunction completeNavigation(location, newState, { flushSync } = {}) {\n\t\tlet isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && location.state?._isRedirect !== true;\n\t\tlet actionData;\n\t\tif (newState.actionData) if (Object.keys(newState.actionData).length > 0) actionData = newState.actionData;\n\t\telse actionData = null;\n\t\telse if (isActionReload) actionData = state.actionData;\n\t\telse actionData = null;\n\t\tlet loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n\t\tlet blockers = state.blockers;\n\t\tif (blockers.size > 0 && !isUninterruptedRevalidation) {\n\t\t\tblockers = new Map(blockers);\n\t\t\tblockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n\t\t}\n\t\tlet restoreScrollPosition = isUninterruptedRevalidation ? false : getSavedScrollPosition(location, newState.matches || state.matches);\n\t\tlet preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && location.state?._isRedirect !== true;\n\t\tdataRoutes.commitHmrRoutes();\n\t\tif (isUninterruptedRevalidation) {} else if (pendingAction === \"POP\") {} else if (pendingAction === \"PUSH\") init.history.push(location, location.state);\n\t\telse if (pendingAction === \"REPLACE\") init.history.replace(location, location.state);\n\t\tlet viewTransitionOpts;\n\t\tif (pendingAction === \"POP\" && !isUninterruptedRevalidation && location !== state.location) {\n\t\t\tlet priorPaths = appliedViewTransitions.get(state.location.pathname);\n\t\t\tif (priorPaths && priorPaths.has(location.pathname)) viewTransitionOpts = {\n\t\t\t\tcurrentLocation: state.location,\n\t\t\t\tnextLocation: location\n\t\t\t};\n\t\t\telse if (appliedViewTransitions.has(location.pathname)) viewTransitionOpts = {\n\t\t\t\tcurrentLocation: location,\n\t\t\t\tnextLocation: state.location\n\t\t\t};\n\t\t} else if (pendingViewTransitionEnabled) {\n\t\t\tlet toPaths = appliedViewTransitions.get(state.location.pathname);\n\t\t\tif (toPaths) toPaths.add(location.pathname);\n\t\t\telse {\n\t\t\t\ttoPaths = new Set([location.pathname]);\n\t\t\t\tappliedViewTransitions.set(state.location.pathname, toPaths);\n\t\t\t}\n\t\t\tviewTransitionOpts = {\n\t\t\t\tcurrentLocation: state.location,\n\t\t\t\tnextLocation: location\n\t\t\t};\n\t\t}\n\t\tupdateState({\n\t\t\t...newState,\n\t\t\tactionData,\n\t\t\tloaderData,\n\t\t\thistoryAction: pendingAction,\n\t\t\tlocation,\n\t\t\tinitialized: true,\n\t\t\trenderFallback: false,\n\t\t\tnavigation: IDLE_NAVIGATION,\n\t\t\trevalidation: \"idle\",\n\t\t\trestoreScrollPosition,\n\t\t\tpreventScrollReset,\n\t\t\tblockers\n\t\t}, {\n\t\t\tviewTransitionOpts,\n\t\t\tflushSync: flushSync === true\n\t\t});\n\t\tpendingAction = \"POP\";\n\t\tpendingPreventScrollReset = false;\n\t\tpendingViewTransitionEnabled = false;\n\t\tisUninterruptedRevalidation = false;\n\t\tisRevalidationRequired = false;\n\t\tpendingPopstateNavigationDfd?.resolve();\n\t\tpendingPopstateNavigationDfd = null;\n\t\tpendingRevalidationDfd?.resolve();\n\t\tpendingRevalidationDfd = null;\n\t}\n\tasync function navigate(to, opts) {\n\t\tpendingPopstateNavigationDfd?.resolve();\n\t\tpendingPopstateNavigationDfd = null;\n\t\tif (typeof to === \"number\") {\n\t\t\tif (!pendingPopstateNavigationDfd) pendingPopstateNavigationDfd = createDeferred();\n\t\t\tlet promise = pendingPopstateNavigationDfd.promise;\n\t\t\tinit.history.go(to);\n\t\t\treturn promise;\n\t\t}\n\t\tlet instrumentationNavigateMetaReceiver = consumeInstrumentationClientResultMetaReceiver(router);\n\t\tlet { path, submission, error } = normalizeNavigateOptions(false, normalizeTo(state.location, state.matches, basename, to, opts?.fromRouteId, opts?.relative), opts);\n\t\tlet maskPath;\n\t\tif (opts?.mask) {\n\t\t\tlet partialPath = typeof opts.mask === \"string\" ? parsePath(opts.mask) : {\n\t\t\t\t...state.location.mask,\n\t\t\t\t...opts.mask\n\t\t\t};\n\t\t\tmaskPath = {\n\t\t\t\tpathname: partialPath.pathname ?? \"\",\n\t\t\t\tsearch: partialPath.search ?? \"\",\n\t\t\t\thash: partialPath.hash ?? \"\"\n\t\t\t};\n\t\t\tif (PROTOCOL_RELATIVE_URL_REGEX.test(maskPath.pathname)) throw new Error(\"External navigation is not allowed\");\n\t\t\telse if (maskPath.pathname.startsWith(\"\\\\\")) maskPath.pathname = maskPath.pathname.replace(/^\\\\+/, \"/\");\n\t\t\tvalidateNavigationTarget(typeof opts.mask === \"string\" ? opts.mask : createPath(opts.mask), createPath(maskPath), init.history.createURL(\"/\"), \"reject\");\n\t\t}\n\t\tlet currentLocation = state.location;\n\t\tlet nextLocation = createLocation(currentLocation, path, opts && opts.state, void 0, maskPath);\n\t\tnextLocation = {\n\t\t\t...nextLocation,\n\t\t\t...init.history.encodeLocation(nextLocation)\n\t\t};\n\t\tvalidateNavigationTarget(to == null ? init.history.createHref(state.location) : typeof to === \"string\" ? to : createPath(to), init.history.createHref(nextLocation.mask || nextLocation), init.history.createURL(\"/\"), \"reject\");\n\t\tlet userReplace = opts && opts.replace != null ? opts.replace : void 0;\n\t\tlet historyAction = \"PUSH\";\n\t\tif (userReplace === true) historyAction = \"REPLACE\";\n\t\telse if (userReplace === false) {} else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) historyAction = \"REPLACE\";\n\t\tlet preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : void 0;\n\t\tlet flushSync = (opts && opts.flushSync) === true;\n\t\tlet blockerKey = shouldBlockNavigation({\n\t\t\tcurrentLocation,\n\t\t\tnextLocation,\n\t\t\thistoryAction\n\t\t});\n\t\tif (blockerKey) {\n\t\t\tupdateBlocker(blockerKey, {\n\t\t\t\tstate: \"blocked\",\n\t\t\t\tlocation: nextLocation,\n\t\t\t\tproceed() {\n\t\t\t\t\tupdateBlocker(blockerKey, {\n\t\t\t\t\t\tstate: \"proceeding\",\n\t\t\t\t\t\tproceed: void 0,\n\t\t\t\t\t\treset: void 0,\n\t\t\t\t\t\tlocation: nextLocation\n\t\t\t\t\t});\n\t\t\t\t\tnavigate(to, opts);\n\t\t\t\t},\n\t\t\t\treset() {\n\t\t\t\t\tlet blockers = new Map(state.blockers);\n\t\t\t\t\tblockers.set(blockerKey, IDLE_BLOCKER);\n\t\t\t\t\tupdateState({ blockers });\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tawait startNavigation(historyAction, nextLocation, {\n\t\t\tsubmission,\n\t\t\tpendingError: error,\n\t\t\tpreventScrollReset,\n\t\t\treplace: opts && opts.replace,\n\t\t\tenableViewTransition: opts && opts.viewTransition,\n\t\t\tflushSync,\n\t\t\tcallSiteDefaultShouldRevalidate: opts && opts.defaultShouldRevalidate,\n\t\t\tinstrumentationNavigateMetaReceiver\n\t\t});\n\t}\n\tfunction revalidate() {\n\t\tif (!pendingRevalidationDfd) pendingRevalidationDfd = createDeferred();\n\t\tinterruptActiveLoads();\n\t\tupdateState({ revalidation: \"loading\" });\n\t\tlet promise = pendingRevalidationDfd.promise;\n\t\tif (state.navigation.state === \"submitting\") return promise;\n\t\tif (state.navigation.state === \"idle\") {\n\t\t\tstartNavigation(state.historyAction, state.location, { startUninterruptedRevalidation: true });\n\t\t\treturn promise;\n\t\t}\n\t\tstartNavigation(pendingAction || state.historyAction, state.navigation.location, {\n\t\t\toverrideNavigation: state.navigation,\n\t\t\tenableViewTransition: pendingViewTransitionEnabled === true\n\t\t});\n\t\treturn promise;\n\t}\n\tasync function startNavigation(historyAction, location, opts) {\n\t\tpendingNavigationController && pendingNavigationController.abort();\n\t\tpendingNavigationController = null;\n\t\tpendingAction = historyAction;\n\t\tisUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n\t\tsaveScrollPosition(state.location, state.matches);\n\t\tpendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n\t\tpendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;\n\t\tlet matches = opts?.initialHydration && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? state.matches : dataRouteMatcher.match(location);\n\t\tlet flushSync = (opts && opts.flushSync) === true;\n\t\tif (matches && state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n\t\t\tcompleteNavigation(location, { matches }, { flushSync });\n\t\t\treturn;\n\t\t}\n\t\tlet fogOfWar = checkFogOfWar(matches, location.pathname);\n\t\tif (fogOfWar.active && fogOfWar.matches) matches = fogOfWar.matches;\n\t\tif (opts?.instrumentationNavigateMetaReceiver) {\n\t\t\tlet meta = getInstrumentationNavigateMeta(init.history, location, matches);\n\t\t\topts.instrumentationNavigateMetaReceiver(meta);\n\t\t}\n\t\tif (!matches) {\n\t\t\tlet { error, notFoundMatches, route } = handleNavigational404(location.pathname);\n\t\t\tcompleteNavigation(location, {\n\t\t\t\tmatches: notFoundMatches,\n\t\t\t\tloaderData: {},\n\t\t\t\terrors: { [route.id]: error }\n\t\t\t}, { flushSync });\n\t\t\treturn;\n\t\t}\n\t\tlet loadingNavigation = opts && opts.overrideNavigation ? {\n\t\t\t...opts.overrideNavigation,\n\t\t\tmatches,\n\t\t\thistoryAction\n\t\t} : void 0;\n\t\tpendingNavigationController = new AbortController();\n\t\tlet request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n\t\tlet scopedContext = init.getContext ? await init.getContext() : new RouterContextProvider();\n\t\tlet pendingActionResult;\n\t\tif (opts && opts.pendingError) pendingActionResult = [findNearestBoundary(matches).route.id, {\n\t\t\ttype: \"error\",\n\t\t\terror: opts.pendingError\n\t\t}];\n\t\telse if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n\t\t\tlet actionResult = await handleAction(request, location, opts.submission, matches, historyAction, scopedContext, fogOfWar.active, opts && opts.initialHydration === true, {\n\t\t\t\treplace: opts.replace,\n\t\t\t\tflushSync\n\t\t\t});\n\t\t\tif (actionResult.shortCircuited) return;\n\t\t\tif (actionResult.pendingActionResult) {\n\t\t\t\tlet [routeId, result] = actionResult.pendingActionResult;\n\t\t\t\tif (isErrorResult(result) && isRouteErrorResponse(result.error) && result.error.status === 404) {\n\t\t\t\t\tpendingNavigationController = null;\n\t\t\t\t\tcompleteNavigation(location, {\n\t\t\t\t\t\tmatches: actionResult.matches,\n\t\t\t\t\t\tloaderData: {},\n\t\t\t\t\t\terrors: { [routeId]: result.error }\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmatches = actionResult.matches || matches;\n\t\t\tpendingActionResult = actionResult.pendingActionResult;\n\t\t\tloadingNavigation = getLoadingNavigation(location, matches, historyAction, opts.submission);\n\t\t\tflushSync = false;\n\t\t\tfogOfWar.active = false;\n\t\t\trequest = createClientSideRequest(init.history, request.url, request.signal);\n\t\t}\n\t\tlet { shortCircuited, matches: updatedMatches, loaderData, errors, workingFetchers } = await handleLoaders(request, location, matches, historyAction, scopedContext, fogOfWar.active, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, opts && opts.initialHydration === true, flushSync, pendingActionResult, opts && opts.callSiteDefaultShouldRevalidate);\n\t\tif (shortCircuited) return;\n\t\tpendingNavigationController = null;\n\t\tcompleteNavigation(location, {\n\t\t\tmatches: updatedMatches || matches,\n\t\t\t...getActionDataForCommit(pendingActionResult),\n\t\t\tloaderData,\n\t\t\terrors,\n\t\t\t...workingFetchers ? { fetchers: workingFetchers } : {}\n\t\t});\n\t}\n\tasync function handleAction(request, location, submission, matches, historyAction, scopedContext, isFogOfWar, initialHydration, opts = {}) {\n\t\tinterruptActiveLoads();\n\t\tupdateState({ navigation: getSubmittingNavigation(location, matches, historyAction, submission) }, { flushSync: opts.flushSync === true });\n\t\tif (isFogOfWar) {\n\t\t\tlet discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n\t\t\tif (discoverResult.type === \"aborted\") return { shortCircuited: true };\n\t\t\telse if (discoverResult.type === \"error\") {\n\t\t\t\tif (discoverResult.partialMatches.length === 0) {\n\t\t\t\t\tlet { matches, route } = getShortCircuitMatches(dataRoutes.activeRoutes);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmatches,\n\t\t\t\t\t\tpendingActionResult: [route.id, {\n\t\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\t\terror: discoverResult.error\n\t\t\t\t\t\t}]\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tlet boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n\t\t\t\treturn {\n\t\t\t\t\tmatches: discoverResult.partialMatches,\n\t\t\t\t\tpendingActionResult: [boundaryId, {\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\terror: discoverResult.error\n\t\t\t\t\t}]\n\t\t\t\t};\n\t\t\t} else if (!discoverResult.matches) {\n\t\t\t\tlet { notFoundMatches, error, route } = handleNavigational404(location.pathname);\n\t\t\t\treturn {\n\t\t\t\t\tmatches: notFoundMatches,\n\t\t\t\t\tpendingActionResult: [route.id, {\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\terror\n\t\t\t\t\t}]\n\t\t\t\t};\n\t\t\t} else matches = discoverResult.matches;\n\t\t}\n\t\tlet result;\n\t\tlet actionMatch = getTargetMatch(matches, location);\n\t\tif (!actionMatch.route.action && !actionMatch.route.lazy) result = {\n\t\t\ttype: \"error\",\n\t\t\terror: getInternalRouterError(405, {\n\t\t\t\tmethod: request.method,\n\t\t\t\tpathname: location.pathname,\n\t\t\t\trouteId: actionMatch.route.id\n\t\t\t})\n\t\t};\n\t\telse {\n\t\t\tlet results = await callDataStrategy(request, location, getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, location, matches, actionMatch, initialHydration ? [] : hydrationRouteProperties, scopedContext), scopedContext, null);\n\t\t\tresult = results[actionMatch.route.id];\n\t\t\tif (!result) {\n\t\t\t\tfor (let match of matches) if (results[match.route.id]) {\n\t\t\t\t\tresult = results[match.route.id];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (request.signal.aborted) return { shortCircuited: true };\n\t\t}\n\t\tif (isRedirectResult(result)) {\n\t\t\tlet replace;\n\t\t\tif (opts && opts.replace != null) replace = opts.replace;\n\t\t\telse replace = normalizeRedirectLocation(result.response.headers.get(\"Location\"), new URL(request.url), basename, init.history) === state.location.pathname + state.location.search;\n\t\t\tawait startRedirectNavigation(request, result, true, {\n\t\t\t\tsubmission,\n\t\t\t\treplace\n\t\t\t});\n\t\t\treturn { shortCircuited: true };\n\t\t}\n\t\tif (isErrorResult(result)) {\n\t\t\tlet boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n\t\t\tif ((opts && opts.replace) !== true) pendingAction = \"PUSH\";\n\t\t\treturn {\n\t\t\t\tmatches,\n\t\t\t\tpendingActionResult: [\n\t\t\t\t\tboundaryMatch.route.id,\n\t\t\t\t\tresult,\n\t\t\t\t\tactionMatch.route.id\n\t\t\t\t]\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tmatches,\n\t\t\tpendingActionResult: [actionMatch.route.id, result]\n\t\t};\n\t}\n\tasync function handleLoaders(request, location, matches, historyAction, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace, initialHydration, flushSync, pendingActionResult, callSiteDefaultShouldRevalidate) {\n\t\tlet loadingNavigation = overrideNavigation || getLoadingNavigation(location, matches, historyAction, submission);\n\t\tlet activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);\n\t\tlet shouldUpdateNavigationState = !isUninterruptedRevalidation && !initialHydration;\n\t\tif (isFogOfWar) {\n\t\t\tif (shouldUpdateNavigationState) {\n\t\t\t\tlet actionData = getUpdatedActionData(pendingActionResult);\n\t\t\t\tupdateState({\n\t\t\t\t\tnavigation: loadingNavigation,\n\t\t\t\t\t...actionData !== void 0 ? { actionData } : {}\n\t\t\t\t}, { flushSync });\n\t\t\t}\n\t\t\tlet discoverResult = await discoverRoutes(matches, location.pathname, request.signal);\n\t\t\tif (discoverResult.type === \"aborted\") return { shortCircuited: true };\n\t\t\telse if (discoverResult.type === \"error\") {\n\t\t\t\tif (discoverResult.partialMatches.length === 0) {\n\t\t\t\t\tlet { matches, route } = getShortCircuitMatches(dataRoutes.activeRoutes);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmatches,\n\t\t\t\t\t\tloaderData: {},\n\t\t\t\t\t\terrors: { [route.id]: discoverResult.error }\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tlet boundaryId = findNearestBoundary(discoverResult.partialMatches).route.id;\n\t\t\t\treturn {\n\t\t\t\t\tmatches: discoverResult.partialMatches,\n\t\t\t\t\tloaderData: {},\n\t\t\t\t\terrors: { [boundaryId]: discoverResult.error }\n\t\t\t\t};\n\t\t\t} else if (!discoverResult.matches) {\n\t\t\t\tlet { error, notFoundMatches, route } = handleNavigational404(location.pathname);\n\t\t\t\treturn {\n\t\t\t\t\tmatches: notFoundMatches,\n\t\t\t\t\tloaderData: {},\n\t\t\t\t\terrors: { [route.id]: error }\n\t\t\t\t};\n\t\t\t} else matches = discoverResult.matches;\n\t\t}\n\t\tlet { dsMatches, revalidatingFetchers } = getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest, init.history, state, matches, activeSubmission, location, initialHydration ? [] : hydrationRouteProperties, initialHydration === true, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, dataRouteMatcher, pendingActionResult, callSiteDefaultShouldRevalidate);\n\t\tpendingNavigationLoadId = ++incrementingLoadId;\n\t\tif (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some((m) => m.route.middleware && m.route.middleware.length > 0) && revalidatingFetchers.length === 0) {\n\t\t\tlet workingFetchers = new Map(state.fetchers);\n\t\t\tlet didUpdateFetcherRedirects = markFetchRedirectsDone(workingFetchers);\n\t\t\tcompleteNavigation(location, {\n\t\t\t\tmatches,\n\t\t\t\tloaderData: {},\n\t\t\t\terrors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { [pendingActionResult[0]]: pendingActionResult[1].error } : null,\n\t\t\t\t...getActionDataForCommit(pendingActionResult),\n\t\t\t\t...didUpdateFetcherRedirects ? { fetchers: workingFetchers } : {}\n\t\t\t}, { flushSync });\n\t\t\treturn { shortCircuited: true };\n\t\t}\n\t\tif (shouldUpdateNavigationState) {\n\t\t\tlet updates = {};\n\t\t\tif (!isFogOfWar) {\n\t\t\t\tupdates.navigation = loadingNavigation;\n\t\t\t\tlet actionData = getUpdatedActionData(pendingActionResult);\n\t\t\t\tif (actionData !== void 0) updates.actionData = actionData;\n\t\t\t}\n\t\t\tif (revalidatingFetchers.length > 0) updates.fetchers = getUpdatedRevalidatingFetchers(revalidatingFetchers);\n\t\t\tupdateState(updates, { flushSync });\n\t\t}\n\t\trevalidatingFetchers.forEach((rf) => {\n\t\t\tabortFetcher(rf.key);\n\t\t\tif (rf.controller) fetchControllers.set(rf.key, rf.controller);\n\t\t});\n\t\tlet abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((f) => abortFetcher(f.key));\n\t\tif (pendingNavigationController) pendingNavigationController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n\t\tlet { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData(dsMatches, revalidatingFetchers, request, location, scopedContext);\n\t\tif (request.signal.aborted) return { shortCircuited: true };\n\t\tif (pendingNavigationController) pendingNavigationController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n\t\trevalidatingFetchers.forEach((rf) => fetchControllers.delete(rf.key));\n\t\tlet redirect = findRedirect(loaderResults);\n\t\tif (redirect) {\n\t\t\tawait startRedirectNavigation(request, redirect.result, true, { replace });\n\t\t\treturn { shortCircuited: true };\n\t\t}\n\t\tredirect = findRedirect(fetcherResults);\n\t\tif (redirect) {\n\t\t\tfetchRedirectIds.add(redirect.key);\n\t\t\tawait startRedirectNavigation(request, redirect.result, true, { replace });\n\t\t\treturn { shortCircuited: true };\n\t\t}\n\t\tlet workingFetchers = new Map(state.fetchers);\n\t\tlet { loaderData, errors } = processLoaderData(state, matches, loaderResults, pendingActionResult, revalidatingFetchers, fetcherResults, workingFetchers);\n\t\tif (initialHydration && state.errors) errors = {\n\t\t\t...state.errors,\n\t\t\t...errors\n\t\t};\n\t\tlet didUpdateFetcherRedirects = markFetchRedirectsDone(workingFetchers);\n\t\tlet didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId, workingFetchers);\n\t\tlet shouldUpdateFetchers = didUpdateFetcherRedirects || didAbortFetchLoads || revalidatingFetchers.length > 0;\n\t\treturn {\n\t\t\tmatches,\n\t\t\tloaderData,\n\t\t\terrors,\n\t\t\t...shouldUpdateFetchers ? { workingFetchers } : {}\n\t\t};\n\t}\n\tfunction getUpdatedActionData(pendingActionResult) {\n\t\tif (pendingActionResult && !isErrorResult(pendingActionResult[1])) return { [pendingActionResult[0]]: pendingActionResult[1].data };\n\t\telse if (state.actionData) if (Object.keys(state.actionData).length === 0) return null;\n\t\telse return state.actionData;\n\t}\n\tfunction getUpdatedRevalidatingFetchers(revalidatingFetchers) {\n\t\tlet workingFetchers = new Map(state.fetchers);\n\t\trevalidatingFetchers.forEach((rf) => {\n\t\t\tlet fetcher = workingFetchers.get(rf.key);\n\t\t\tlet revalidatingFetcher = getLoadingFetcher(void 0, fetcher ? fetcher.data : void 0);\n\t\t\tworkingFetchers.set(rf.key, revalidatingFetcher);\n\t\t});\n\t\treturn workingFetchers;\n\t}\n\tasync function fetch(key, routeId, href, opts) {\n\t\tabortFetcher(key);\n\t\tlet flushSync = (opts && opts.flushSync) === true;\n\t\tlet instrumentationResultMetaReceiver = consumeInstrumentationClientResultMetaReceiver(router);\n\t\tlet normalizedPath = normalizeTo(state.location, state.matches, basename, href, routeId, opts?.relative);\n\t\tlet matches = dataRouteMatcher.match(normalizedPath);\n\t\tlet fogOfWar = checkFogOfWar(matches, normalizedPath);\n\t\tif (fogOfWar.active && fogOfWar.matches) matches = fogOfWar.matches;\n\t\tif (instrumentationResultMetaReceiver) instrumentationResultMetaReceiver(getInstrumentationNavigateMeta(init.history, normalizedPath, matches));\n\t\tif (!matches) {\n\t\t\tsetFetcherError(key, routeId, getInternalRouterError(404, { pathname: normalizedPath }), { flushSync });\n\t\t\treturn;\n\t\t}\n\t\tlet { path, submission, error } = normalizeNavigateOptions(true, normalizedPath, opts);\n\t\tif (error) {\n\t\t\tsetFetcherError(key, routeId, error, { flushSync });\n\t\t\treturn;\n\t\t}\n\t\tlet scopedContext = init.getContext ? await init.getContext() : new RouterContextProvider();\n\t\tlet preventScrollReset = (opts && opts.preventScrollReset) === true;\n\t\tif (submission && isMutationMethod(submission.formMethod)) {\n\t\t\tawait handleFetcherAction(key, routeId, path, matches, scopedContext, fogOfWar.active, flushSync, preventScrollReset, submission, opts && opts.defaultShouldRevalidate);\n\t\t\treturn;\n\t\t}\n\t\tlet loadMatch = {\n\t\t\trouteId,\n\t\t\tpath,\n\t\t\tisDiscovering: fogOfWar.active\n\t\t};\n\t\tfetchLoadMatches.set(key, loadMatch);\n\t\tawait handleFetcherLoader(key, loadMatch, matches, scopedContext, flushSync, preventScrollReset, submission);\n\t}\n\tasync function handleFetcherAction(key, routeId, path, requestMatches, scopedContext, isFogOfWar, flushSync, preventScrollReset, submission, callSiteDefaultShouldRevalidate) {\n\t\tinterruptActiveLoads();\n\t\tfetchLoadMatches.delete(key);\n\t\tupdateFetcherState(key, getSubmittingFetcher(submission, state.fetchers.get(key)), { flushSync });\n\t\tlet abortController = new AbortController();\n\t\tlet fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n\t\tif (isFogOfWar) {\n\t\t\tlet discoverResult = await discoverRoutes(requestMatches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n\t\t\tif (discoverResult.type === \"aborted\") return;\n\t\t\telse if (discoverResult.type === \"error\") {\n\t\t\t\tsetFetcherError(key, routeId, discoverResult.error, { flushSync });\n\t\t\t\treturn;\n\t\t\t} else if (!discoverResult.matches) {\n\t\t\t\tsetFetcherError(key, routeId, getInternalRouterError(404, { pathname: path }), { flushSync });\n\t\t\t\treturn;\n\t\t\t} else requestMatches = discoverResult.matches;\n\t\t}\n\t\tlet match = getTargetMatch(requestMatches, path);\n\t\tif (!match.route.action && !match.route.lazy) {\n\t\t\tsetFetcherError(key, routeId, getInternalRouterError(405, {\n\t\t\t\tmethod: submission.formMethod,\n\t\t\t\tpathname: path,\n\t\t\t\trouteId\n\t\t\t}), { flushSync });\n\t\t\treturn;\n\t\t}\n\t\tfetchControllers.set(key, abortController);\n\t\tlet originatingLoadId = incrementingLoadId;\n\t\tlet fetchMatches = getTargetedDataStrategyMatches(mapRouteProperties, manifest, fetchRequest, path, requestMatches, match, hydrationRouteProperties, scopedContext);\n\t\tlet actionResults = await callDataStrategy(fetchRequest, path, fetchMatches, scopedContext, key);\n\t\tlet actionResult = actionResults[match.route.id];\n\t\tif (!actionResult) {\n\t\t\tfor (let match of fetchMatches) if (actionResults[match.route.id]) {\n\t\t\t\tactionResult = actionResults[match.route.id];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (fetchRequest.signal.aborted) {\n\t\t\tif (fetchControllers.get(key) === abortController) fetchControllers.delete(key);\n\t\t\treturn;\n\t\t}\n\t\tif (fetchersQueuedForDeletion.has(key)) {\n\t\t\tif (isRedirectResult(actionResult) || isErrorResult(actionResult)) {\n\t\t\t\tupdateFetcherState(key, getDoneFetcher(void 0));\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tif (isRedirectResult(actionResult)) {\n\t\t\t\tfetchControllers.delete(key);\n\t\t\t\tif (pendingNavigationLoadId > originatingLoadId) {\n\t\t\t\t\tupdateFetcherState(key, getDoneFetcher(void 0));\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\tfetchRedirectIds.add(key);\n\t\t\t\t\tupdateFetcherState(key, getLoadingFetcher(submission));\n\t\t\t\t\treturn startRedirectNavigation(fetchRequest, actionResult, false, {\n\t\t\t\t\t\tfetcherSubmission: submission,\n\t\t\t\t\t\tpreventScrollReset\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isErrorResult(actionResult)) {\n\t\t\t\tsetFetcherError(key, routeId, actionResult.error);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tlet nextLocation = state.navigation.location || state.location;\n\t\tlet revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n\t\tlet matches = state.navigation.state !== \"idle\" ? dataRouteMatcher.match(state.navigation.location) : state.matches;\n\t\tinvariant(matches, \"Didn't find any matches after fetcher action\");\n\t\tlet loadId = ++incrementingLoadId;\n\t\tfetchReloadIds.set(key, loadId);\n\t\tlet { dsMatches, revalidatingFetchers } = getMatchesToLoad(revalidationRequest, scopedContext, mapRouteProperties, manifest, init.history, state, matches, submission, nextLocation, hydrationRouteProperties, false, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, dataRouteMatcher, [match.route.id, actionResult], callSiteDefaultShouldRevalidate);\n\t\tlet loadFetcher = getLoadingFetcher(submission, actionResult.data);\n\t\tlet workingFetchers = new Map(state.fetchers);\n\t\tworkingFetchers.set(key, loadFetcher);\n\t\trevalidatingFetchers.filter((rf) => rf.key !== key).forEach((rf) => {\n\t\t\tlet staleKey = rf.key;\n\t\t\tlet existingFetcher = workingFetchers.get(staleKey);\n\t\t\tlet revalidatingFetcher = getLoadingFetcher(void 0, existingFetcher ? existingFetcher.data : void 0);\n\t\t\tworkingFetchers.set(staleKey, revalidatingFetcher);\n\t\t\tabortFetcher(staleKey);\n\t\t\tif (rf.controller) fetchControllers.set(staleKey, rf.controller);\n\t\t});\n\t\tupdateState({ fetchers: workingFetchers });\n\t\tlet abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((rf) => abortFetcher(rf.key));\n\t\tabortController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n\t\tlet { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData(dsMatches, revalidatingFetchers, revalidationRequest, nextLocation, scopedContext);\n\t\tif (abortController.signal.aborted) {\n\t\t\tif (fetchReloadIds.get(key) === loadId) fetchReloadIds.delete(key);\n\t\t\treturn;\n\t\t}\n\t\tabortController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n\t\tfetchReloadIds.delete(key);\n\t\tfetchControllers.delete(key);\n\t\trevalidatingFetchers.forEach((r) => fetchControllers.delete(r.key));\n\t\tlet fetcherIsMounted = state.fetchers.has(key);\n\t\tlet getRedirectStateWithDoneFetcher = (s) => {\n\t\t\tif (!fetcherIsMounted) return s;\n\t\t\tlet workingFetchers = new Map(s.fetchers);\n\t\t\tworkingFetchers.set(key, getDoneFetcher(actionResult.data));\n\t\t\treturn {\n\t\t\t\t...s,\n\t\t\t\tfetchers: workingFetchers\n\t\t\t};\n\t\t};\n\t\tlet redirect = findRedirect(loaderResults);\n\t\tif (redirect) {\n\t\t\tstate = getRedirectStateWithDoneFetcher(state);\n\t\t\treturn startRedirectNavigation(revalidationRequest, redirect.result, false, { preventScrollReset });\n\t\t}\n\t\tredirect = findRedirect(fetcherResults);\n\t\tif (redirect) {\n\t\t\tfetchRedirectIds.add(redirect.key);\n\t\t\tstate = getRedirectStateWithDoneFetcher(state);\n\t\t\treturn startRedirectNavigation(revalidationRequest, redirect.result, false, { preventScrollReset });\n\t\t}\n\t\tlet finalFetchers = new Map(state.fetchers);\n\t\tif (fetcherIsMounted) finalFetchers.set(key, getDoneFetcher(actionResult.data));\n\t\tlet { loaderData, errors } = processLoaderData(state, matches, loaderResults, void 0, revalidatingFetchers, fetcherResults, finalFetchers);\n\t\tabortStaleFetchLoads(loadId, finalFetchers);\n\t\tif (state.navigation.state === \"loading\" && loadId > pendingNavigationLoadId) {\n\t\t\tinvariant(pendingAction, \"Expected pending action\");\n\t\t\tpendingNavigationController && pendingNavigationController.abort();\n\t\t\tcompleteNavigation(state.navigation.location, {\n\t\t\t\tmatches,\n\t\t\t\tloaderData,\n\t\t\t\terrors,\n\t\t\t\tfetchers: finalFetchers\n\t\t\t});\n\t\t} else {\n\t\t\tupdateState({\n\t\t\t\terrors,\n\t\t\t\tloaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors),\n\t\t\t\tfetchers: finalFetchers\n\t\t\t});\n\t\t\tisRevalidationRequired = false;\n\t\t}\n\t}\n\tasync function handleFetcherLoader(key, loadMatch, matches, scopedContext, flushSync, preventScrollReset, submission) {\n\t\tlet { routeId, path } = loadMatch;\n\t\tlet existingFetcher = state.fetchers.get(key);\n\t\tupdateFetcherState(key, getLoadingFetcher(submission, existingFetcher ? existingFetcher.data : void 0), { flushSync });\n\t\tlet abortController = new AbortController();\n\t\tlet fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n\t\tif (loadMatch.isDiscovering) {\n\t\t\tlet discoverResult = await discoverRoutes(matches, new URL(fetchRequest.url).pathname, fetchRequest.signal, key);\n\t\t\tif (discoverResult.type === \"aborted\") return;\n\t\t\telse if (discoverResult.type === \"error\") {\n\t\t\t\tsetFetcherError(key, routeId, discoverResult.error, { flushSync });\n\t\t\t\treturn;\n\t\t\t} else if (!discoverResult.matches) {\n\t\t\t\tsetFetcherError(key, routeId, getInternalRouterError(404, { pathname: path }), { flushSync });\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tmatches = discoverResult.matches;\n\t\t\t\tloadMatch.isDiscovering = false;\n\t\t\t}\n\t\t}\n\t\tlet match = getTargetMatch(matches, path);\n\t\tfetchControllers.set(key, abortController);\n\t\tlet originatingLoadId = incrementingLoadId;\n\t\tlet results = await callDataStrategy(fetchRequest, path, getTargetedDataStrategyMatches(mapRouteProperties, manifest, fetchRequest, path, matches, match, hydrationRouteProperties, scopedContext), scopedContext, key);\n\t\tlet result = results[match.route.id];\n\t\tif (!result) {\n\t\t\tfor (let match of matches) if (results[match.route.id]) {\n\t\t\t\tresult = results[match.route.id];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (fetchControllers.get(key) === abortController) fetchControllers.delete(key);\n\t\tif (fetchRequest.signal.aborted) return;\n\t\tif (fetchersQueuedForDeletion.has(key)) {\n\t\t\tupdateFetcherState(key, getDoneFetcher(void 0));\n\t\t\treturn;\n\t\t}\n\t\tif (isRedirectResult(result)) if (pendingNavigationLoadId > originatingLoadId) {\n\t\t\tupdateFetcherState(key, getDoneFetcher(void 0));\n\t\t\treturn;\n\t\t} else {\n\t\t\tfetchRedirectIds.add(key);\n\t\t\tawait startRedirectNavigation(fetchRequest, result, false, { preventScrollReset });\n\t\t\treturn;\n\t\t}\n\t\tif (isErrorResult(result)) {\n\t\t\tsetFetcherError(key, routeId, result.error);\n\t\t\treturn;\n\t\t}\n\t\tupdateFetcherState(key, getDoneFetcher(result.data));\n\t}\n\t/**\n\t* Utility function to handle redirects returned from an action or loader.\n\t* Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n\t* example:\n\t*\n\t* - user is on /a\n\t* - user clicks a link to /b\n\t* - loader for /b redirects to /c\n\t*\n\t* In a non-JS app the browser would track the in-flight navigation to /b and\n\t* then replace it with /c when it encountered the redirect response. In\n\t* the end it would only ever update the URL bar with /c.\n\t*\n\t* In client-side routing using pushState/replaceState, we aim to emulate\n\t* this behavior and we also do not update history until the end of the\n\t* navigation (including processed redirects). This means that we never\n\t* actually touch history until we've processed redirects, so we just use\n\t* the history action from the original navigation (PUSH or REPLACE).\n\t*/\n\tasync function startRedirectNavigation(request, redirect, isNavigation, { submission, fetcherSubmission, preventScrollReset, replace } = {}) {\n\t\tif (!isNavigation) {\n\t\t\tpendingPopstateNavigationDfd?.resolve();\n\t\t\tpendingPopstateNavigationDfd = null;\n\t\t}\n\t\tif (redirect.response.headers.has(\"X-Remix-Revalidate\")) isRevalidationRequired = true;\n\t\tlet location = redirect.response.headers.get(\"Location\");\n\t\tinvariant(location, \"Expected a Location header on the redirect Response\");\n\t\tlet originalLocation = location;\n\t\tlet currentUrl = new URL(request.url);\n\t\tlocation = normalizeRedirectLocation(location, currentUrl, basename, init.history);\n\t\tvalidateNavigationTarget(originalLocation, location, currentUrl, \"allow-explicit\");\n\t\tlet redirectLocation = createLocation(state.location, location, { _isRedirect: true });\n\t\tif (isBrowser) {\n\t\t\tlet isDocumentReload = false;\n\t\t\tif (redirect.response.headers.has(\"X-Remix-Reload-Document\")) isDocumentReload = true;\n\t\t\telse if (isAbsoluteUrl(location)) {\n\t\t\t\tconst url = createBrowserURLImpl(routerWindow, location, true);\n\t\t\t\tisDocumentReload = url.origin !== routerWindow.location.origin || stripBasename(url.pathname, basename) == null;\n\t\t\t}\n\t\t\tif (isDocumentReload) {\n\t\t\t\tif (replace) routerWindow.location.replace(location);\n\t\t\t\telse routerWindow.location.assign(location);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tpendingNavigationController = null;\n\t\tlet redirectNavigationType = replace === true || redirect.response.headers.has(\"X-Remix-Replace\") ? \"REPLACE\" : \"PUSH\";\n\t\tlet { formMethod, formAction, formEncType } = state.navigation;\n\t\tif (!submission && !fetcherSubmission && formMethod && formAction && formEncType) submission = getSubmissionFromNavigation(state.navigation);\n\t\tlet activeSubmission = submission || fetcherSubmission;\n\t\tif (redirectPreserveMethodStatusCodes.has(redirect.response.status) && activeSubmission && isMutationMethod(activeSubmission.formMethod)) await startNavigation(redirectNavigationType, redirectLocation, {\n\t\t\tsubmission: {\n\t\t\t\t...activeSubmission,\n\t\t\t\tformAction: location\n\t\t\t},\n\t\t\tpreventScrollReset: preventScrollReset || pendingPreventScrollReset,\n\t\t\tenableViewTransition: isNavigation ? pendingViewTransitionEnabled : void 0\n\t\t});\n\t\telse await startNavigation(redirectNavigationType, redirectLocation, {\n\t\t\toverrideNavigation: getLoadingNavigation(redirectLocation, [], redirectNavigationType, submission),\n\t\t\tfetcherSubmission,\n\t\t\tpreventScrollReset: preventScrollReset || pendingPreventScrollReset,\n\t\t\tenableViewTransition: isNavigation ? pendingViewTransitionEnabled : void 0\n\t\t});\n\t}\n\tasync function callDataStrategy(request, path, matches, scopedContext, fetcherKey) {\n\t\tlet results;\n\t\tlet dataResults = {};\n\t\ttry {\n\t\t\tresults = await callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, scopedContext, false);\n\t\t} catch (e) {\n\t\t\tmatches.filter((m) => m.shouldLoad).forEach((m) => {\n\t\t\t\tdataResults[m.route.id] = {\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terror: e\n\t\t\t\t};\n\t\t\t});\n\t\t\treturn dataResults;\n\t\t}\n\t\tif (request.signal.aborted) return dataResults;\n\t\tif (!isMutationMethod(request.method)) for (let match of matches) {\n\t\t\tif (results[match.route.id]?.type === \"error\") break;\n\t\t\tif (!results.hasOwnProperty(match.route.id) && !state.loaderData.hasOwnProperty(match.route.id) && (!state.errors || !state.errors.hasOwnProperty(match.route.id)) && match.shouldCallHandler()) results[match.route.id] = {\n\t\t\t\ttype: \"error\",\n\t\t\t\tresult: /* @__PURE__ */ new Error(`No result returned from dataStrategy for route ${match.route.id}`)\n\t\t\t};\n\t\t}\n\t\tfor (let [routeId, result] of Object.entries(results)) if (isRedirectDataStrategyResult(result)) {\n\t\t\tlet response = result.result;\n\t\t\tdataResults[routeId] = {\n\t\t\t\ttype: \"redirect\",\n\t\t\t\tresponse: normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename)\n\t\t\t};\n\t\t} else dataResults[routeId] = await convertDataStrategyResultToDataResult(result);\n\t\treturn dataResults;\n\t}\n\tasync function callLoadersAndMaybeResolveData(matches, fetchersToLoad, request, location, scopedContext) {\n\t\tlet loaderResultsPromise = callDataStrategy(request, location, matches, scopedContext, null);\n\t\tlet fetcherResultsPromise = Promise.all(fetchersToLoad.map(async (f) => {\n\t\t\tif (f.matches && f.match && f.request && f.controller) {\n\t\t\t\tlet result = (await callDataStrategy(f.request, f.path, f.matches, scopedContext, f.key))[f.match.route.id];\n\t\t\t\treturn { [f.key]: result };\n\t\t\t} else return Promise.resolve({ [f.key]: {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror: getInternalRouterError(404, { pathname: f.path })\n\t\t\t} });\n\t\t}));\n\t\treturn {\n\t\t\tloaderResults: await loaderResultsPromise,\n\t\t\tfetcherResults: (await fetcherResultsPromise).reduce((acc, r) => Object.assign(acc, r), {})\n\t\t};\n\t}\n\tfunction interruptActiveLoads() {\n\t\tisRevalidationRequired = true;\n\t\tfetchLoadMatches.forEach((_, key) => {\n\t\t\tif (fetchControllers.has(key)) cancelledFetcherLoads.add(key);\n\t\t\tabortFetcher(key);\n\t\t});\n\t}\n\tfunction updateFetcherState(key, fetcher, opts = {}) {\n\t\tlet workingFetchers = new Map(state.fetchers);\n\t\tworkingFetchers.set(key, fetcher);\n\t\tupdateState({ fetchers: workingFetchers }, { flushSync: (opts && opts.flushSync) === true });\n\t}\n\tfunction setFetcherError(key, routeId, error, opts = {}) {\n\t\tlet boundaryMatch = findNearestBoundary(state.matches, routeId);\n\t\tlet workingFetchers = new Map(state.fetchers);\n\t\tdeleteFetcher(workingFetchers, key);\n\t\tupdateState({\n\t\t\terrors: { [boundaryMatch.route.id]: error },\n\t\t\tfetchers: workingFetchers\n\t\t}, { flushSync: (opts && opts.flushSync) === true });\n\t}\n\tfunction getFetcher(key) {\n\t\tactiveFetchers.set(key, (activeFetchers.get(key) || 0) + 1);\n\t\tif (fetchersQueuedForDeletion.has(key)) fetchersQueuedForDeletion.delete(key);\n\t\treturn state.fetchers.get(key) || IDLE_FETCHER;\n\t}\n\tfunction resetFetcher(key, opts) {\n\t\tabortFetcher(key, opts?.reason);\n\t\tupdateFetcherState(key, getDoneFetcher(null));\n\t}\n\tfunction deleteFetcher(fetchers, key) {\n\t\tlet fetcher = state.fetchers.get(key);\n\t\tif (fetchControllers.has(key) && !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))) abortFetcher(key);\n\t\tfetchLoadMatches.delete(key);\n\t\tfetchReloadIds.delete(key);\n\t\tfetchRedirectIds.delete(key);\n\t\tfetchersQueuedForDeletion.delete(key);\n\t\tcancelledFetcherLoads.delete(key);\n\t\tfetchers.delete(key);\n\t}\n\tfunction queueFetcherForDeletion(key) {\n\t\tlet count = (activeFetchers.get(key) || 0) - 1;\n\t\tif (count <= 0) {\n\t\t\tactiveFetchers.delete(key);\n\t\t\tfetchersQueuedForDeletion.add(key);\n\t\t} else activeFetchers.set(key, count);\n\t\tupdateState({ fetchers: new Map(state.fetchers) });\n\t}\n\tfunction abortFetcher(key, reason) {\n\t\tlet controller = fetchControllers.get(key);\n\t\tif (controller) {\n\t\t\tcontroller.abort(reason);\n\t\t\tfetchControllers.delete(key);\n\t\t}\n\t}\n\tfunction markFetchersDone(keys, fetchers) {\n\t\tfor (let key of keys) {\n\t\t\tlet fetcher = fetchers.get(key);\n\t\t\tinvariant(fetcher, `Expected fetcher: ${key}`);\n\t\t\tlet doneFetcher = getDoneFetcher(fetcher.data);\n\t\t\tfetchers.set(key, doneFetcher);\n\t\t}\n\t}\n\tfunction markFetchRedirectsDone(fetchers) {\n\t\tlet doneKeys = [];\n\t\tlet didUpdateFetchers = false;\n\t\tfor (let key of fetchRedirectIds) {\n\t\t\tlet fetcher = fetchers.get(key);\n\t\t\tinvariant(fetcher, `Expected fetcher: ${key}`);\n\t\t\tif (fetcher.state === \"loading\") {\n\t\t\t\tfetchRedirectIds.delete(key);\n\t\t\t\tdoneKeys.push(key);\n\t\t\t\tdidUpdateFetchers = true;\n\t\t\t}\n\t\t}\n\t\tmarkFetchersDone(doneKeys, fetchers);\n\t\treturn didUpdateFetchers;\n\t}\n\tfunction abortStaleFetchLoads(landedId, fetchers) {\n\t\tlet yeetedKeys = [];\n\t\tfor (let [key, id] of fetchReloadIds) if (id < landedId) {\n\t\t\tlet fetcher = fetchers.get(key);\n\t\t\tinvariant(fetcher, `Expected fetcher: ${key}`);\n\t\t\tif (fetcher.state === \"loading\") {\n\t\t\t\tabortFetcher(key);\n\t\t\t\tfetchReloadIds.delete(key);\n\t\t\t\tyeetedKeys.push(key);\n\t\t\t}\n\t\t}\n\t\tmarkFetchersDone(yeetedKeys, fetchers);\n\t\treturn yeetedKeys.length > 0;\n\t}\n\tfunction getBlocker(key, fn) {\n\t\tlet blocker = state.blockers.get(key) || IDLE_BLOCKER;\n\t\tif (blockerFunctions.get(key) !== fn) blockerFunctions.set(key, fn);\n\t\treturn blocker;\n\t}\n\tfunction deleteBlocker(key) {\n\t\tstate.blockers.delete(key);\n\t\tblockerFunctions.delete(key);\n\t}\n\tfunction updateBlocker(key, newBlocker) {\n\t\tlet blocker = state.blockers.get(key) || IDLE_BLOCKER;\n\t\tinvariant(blocker.state === \"unblocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"proceeding\" || blocker.state === \"blocked\" && newBlocker.state === \"unblocked\" || blocker.state === \"proceeding\" && newBlocker.state === \"unblocked\", `Invalid blocker state transition: ${blocker.state} -> ${newBlocker.state}`);\n\t\tlet blockers = new Map(state.blockers);\n\t\tblockers.set(key, newBlocker);\n\t\tupdateState({ blockers });\n\t}\n\tfunction shouldBlockNavigation({ currentLocation, nextLocation, historyAction }) {\n\t\tif (blockerFunctions.size === 0) return;\n\t\tif (blockerFunctions.size > 1) warning(false, \"A router only supports one blocker at a time\");\n\t\tlet entries = Array.from(blockerFunctions.entries());\n\t\tlet [blockerKey, blockerFunction] = entries[entries.length - 1];\n\t\tlet blocker = state.blockers.get(blockerKey);\n\t\tif (blocker && blocker.state === \"proceeding\") return;\n\t\tif (blockerFunction({\n\t\t\tcurrentLocation,\n\t\t\tnextLocation,\n\t\t\thistoryAction\n\t\t})) return blockerKey;\n\t}\n\tfunction handleNavigational404(pathname) {\n\t\tlet error = getInternalRouterError(404, { pathname });\n\t\tlet routesToUse = dataRoutes.activeRoutes;\n\t\tlet { matches, route } = getShortCircuitMatches(routesToUse);\n\t\treturn {\n\t\t\tnotFoundMatches: matches,\n\t\t\troute,\n\t\t\terror\n\t\t};\n\t}\n\tfunction enableScrollRestoration(positions, getPosition, getKey) {\n\t\tsavedScrollPositions = positions;\n\t\tgetScrollPosition = getPosition;\n\t\tgetScrollRestorationKey = getKey || null;\n\t\tif (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n\t\t\tinitialScrollRestored = true;\n\t\t\tlet y = getSavedScrollPosition(state.location, state.matches);\n\t\t\tif (y != null) updateState({ restoreScrollPosition: y });\n\t\t}\n\t\treturn () => {\n\t\t\tsavedScrollPositions = null;\n\t\t\tgetScrollPosition = null;\n\t\t\tgetScrollRestorationKey = null;\n\t\t};\n\t}\n\tfunction getScrollKey(location, matches) {\n\t\tif (getScrollRestorationKey) return getScrollRestorationKey(location, matches.map((m) => convertRouteMatchToUiMatch(m, state.loaderData))) || location.key;\n\t\treturn location.key;\n\t}\n\tfunction saveScrollPosition(location, matches) {\n\t\tif (savedScrollPositions && getScrollPosition) {\n\t\t\tlet key = getScrollKey(location, matches);\n\t\t\tsavedScrollPositions[key] = getScrollPosition();\n\t\t}\n\t}\n\tfunction getSavedScrollPosition(location, matches) {\n\t\tif (savedScrollPositions) {\n\t\t\tlet key = getScrollKey(location, matches);\n\t\t\tlet y = savedScrollPositions[key];\n\t\t\tif (typeof y === \"number\") return y;\n\t\t}\n\t\treturn null;\n\t}\n\tfunction checkFogOfWar(matches, pathname) {\n\t\tif (init.patchRoutesOnNavigation) {\n\t\t\tif (!matches) return {\n\t\t\t\tactive: true,\n\t\t\t\tmatches: dataRouteMatcher.match(pathname, true) || []\n\t\t\t};\n\t\t\telse if (Object.keys(matches[0].params).length > 0) return {\n\t\t\t\tactive: true,\n\t\t\t\tmatches: dataRouteMatcher.match(pathname, true)\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tactive: false,\n\t\t\tmatches: null\n\t\t};\n\t}\n\tasync function discoverRoutes(matches, pathname, signal, fetcherKey) {\n\t\tif (!init.patchRoutesOnNavigation) return {\n\t\t\ttype: \"success\",\n\t\t\tmatches\n\t\t};\n\t\tlet partialMatches = matches;\n\t\twhile (true) {\n\t\t\tlet localManifest = manifest;\n\t\t\ttry {\n\t\t\t\tawait init.patchRoutesOnNavigation({\n\t\t\t\t\tsignal,\n\t\t\t\t\tpath: pathname,\n\t\t\t\t\tmatches: partialMatches,\n\t\t\t\t\tfetcherKey,\n\t\t\t\t\tpatch: (routeId, children) => {\n\t\t\t\t\t\tif (signal.aborted) return;\n\t\t\t\t\t\tpatchRoutesImpl(routeId, children, dataRoutes, localManifest, mapRouteProperties, false);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} catch (e) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terror: e,\n\t\t\t\t\tpartialMatches\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (signal.aborted) return { type: \"aborted\" };\n\t\t\tlet newMatches = dataRouteMatcher.match(pathname);\n\t\t\tlet newPartialMatches = null;\n\t\t\tif (newMatches) if (Object.keys(newMatches[0].params).length === 0) return {\n\t\t\t\ttype: \"success\",\n\t\t\t\tmatches: newMatches\n\t\t\t};\n\t\t\telse {\n\t\t\t\tnewPartialMatches = dataRouteMatcher.match(pathname, true);\n\t\t\t\tif (!(newPartialMatches && partialMatches.length < newPartialMatches.length && compareMatches(partialMatches, newPartialMatches.slice(0, partialMatches.length)))) return {\n\t\t\t\t\ttype: \"success\",\n\t\t\t\t\tmatches: newMatches\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (!newPartialMatches) newPartialMatches = dataRouteMatcher.match(pathname, true);\n\t\t\tif (!newPartialMatches || compareMatches(partialMatches, newPartialMatches)) return {\n\t\t\t\ttype: \"success\",\n\t\t\t\tmatches: null\n\t\t\t};\n\t\t\tpartialMatches = newPartialMatches;\n\t\t}\n\t}\n\tfunction compareMatches(a, b) {\n\t\treturn a.length === b.length && a.every((m, i) => m.route.id === b[i].route.id);\n\t}\n\tfunction _internalSetRoutes(newRoutes) {\n\t\tmanifest = {};\n\t\tdataRoutes.setHmrRoutes(convertRoutesToDataRoutes(newRoutes, mapRouteProperties, void 0, manifest));\n\t}\n\tfunction patchRoutes(routeId, children, unstable_allowElementMutations = false) {\n\t\tpatchRoutesImpl(routeId, children, dataRoutes, manifest, mapRouteProperties, unstable_allowElementMutations);\n\t\tif (!dataRoutes.hasHMRRoutes) updateState({});\n\t}\n\trouter = {\n\t\tget basename() {\n\t\t\treturn basename;\n\t\t},\n\t\tget future() {\n\t\t\treturn future;\n\t\t},\n\t\tget state() {\n\t\t\treturn state;\n\t\t},\n\t\tget routes() {\n\t\t\treturn dataRoutes.stableRoutes;\n\t\t},\n\t\tmatch(locationArg) {\n\t\t\treturn dataRouteMatcher.match(locationArg);\n\t\t},\n\t\tget manifest() {\n\t\t\treturn manifest;\n\t\t},\n\t\tget window() {\n\t\t\treturn routerWindow;\n\t\t},\n\t\tinitialize,\n\t\tsubscribe,\n\t\tenableScrollRestoration,\n\t\tnavigate,\n\t\tfetch,\n\t\trevalidate,\n\t\tcreateHref: (to) => init.history.createHref(to),\n\t\tcreateURL: (to) => init.history.createURL(to),\n\t\tencodeLocation: (to) => init.history.encodeLocation(to),\n\t\tgetFetcher,\n\t\tresetFetcher,\n\t\tdeleteFetcher: queueFetcherForDeletion,\n\t\tdispose,\n\t\tgetBlocker,\n\t\tdeleteBlocker,\n\t\tpatchRoutes,\n\t\t_internalFetchControllers: fetchControllers,\n\t\t_internalSetRoutes,\n\t\t_internalSetStateDoNotUseOrYouWillBreakYourApp(newState) {\n\t\t\tupdateState(newState);\n\t\t}\n\t};\n\tif (init.instrumentations) router = instrumentClientSideRouter(router, init.instrumentations.map((i) => i.router).filter(Boolean));\n\treturn router;\n}\n/**\n* Create a static handler to perform server-side data loading\n*\n* @example\n* export async function handleRequest(request: Request) {\n* let { query, dataRoutes } = createStaticHandler(routes);\n* let context = await query(request);\n*\n* if (context instanceof Response) {\n* return context;\n* }\n*\n* let router = createStaticRouter(dataRoutes, context);\n* return new Response(\n* ReactDOMServer.renderToString(<StaticRouterProvider ... />),\n* { headers: { \"Content-Type\": \"text/html\" } }\n* );\n* }\n*\n* @public\n* @category Data Routers\n* @mode data\n* @param routes The {@link RouteObject | route objects} to create a static\n* handler for\n* @param opts Options\n* @param opts.basename The base URL for the static handler (default: `/`)\n* @param opts.future Future flags for the static handler\n* @returns A static handler that can be used to query data for the provided\n* routes\n*/\nfunction createStaticHandler(routes, opts) {\n\tinvariant(routes.length > 0, \"You must provide a non-empty routes array to createStaticHandler\");\n\tlet manifest = {};\n\tlet basename = (opts ? opts.basename : null) || \"/\";\n\tlet _mapRouteProperties = opts?.mapRouteProperties;\n\tlet mapRouteProperties = _mapRouteProperties ? _mapRouteProperties : () => ({});\n\tlet dataRouteMatcher = createDataRouteMatcher({ ...opts?.future }, basename);\n\tif (opts?.instrumentations) {\n\t\tlet instrumentations = opts.instrumentations;\n\t\tmapRouteProperties = (route) => {\n\t\t\treturn {\n\t\t\t\t..._mapRouteProperties?.(route),\n\t\t\t\t...getRouteInstrumentationUpdates(instrumentations.map((i) => i.route).filter(Boolean), route)\n\t\t\t};\n\t\t};\n\t}\n\tlet dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, void 0, manifest);\n\tdataRouteMatcher.update(dataRoutes);\n\tlet match = (locationArg) => dataRouteMatcher.match(locationArg);\n\t/**\n\t* The query() method is intended for document requests, in which we want to\n\t* call an optional action and potentially multiple loaders for all nested\n\t* routes. It returns a StaticHandlerContext object, which is very similar\n\t* to the router state (location, loaderData, actionData, errors, etc.) and\n\t* also adds SSR-specific information such as the statusCode and headers\n\t* from action/loaders Responses.\n\t*\n\t* It _should_ never throw and should report all errors through the\n\t* returned handlerContext.errors object, properly associating errors to\n\t* their error boundary. Additionally, it tracks _deepestRenderedBoundaryId\n\t* which can be used to emulate React error boundaries during SSR by performing\n\t* a second pass only down to the boundaryId.\n\t*\n\t* The one exception where we do not return a StaticHandlerContext is when a\n\t* redirect response is returned or thrown from any action/loader. We\n\t* propagate that out and return the raw Response so the HTTP server can\n\t* return it directly.\n\t*\n\t* - `opts.requestContext` is an optional server context that will be passed\n\t* to actions/loaders in the `context` parameter\n\t* - `opts.skipLoaderErrorBubbling` is an optional parameter that will prevent\n\t* the bubbling of errors which allows single-fetch-type implementations\n\t* where the client will handle the bubbling and we may need to return data\n\t* for the handling route\n\t*/\n\tasync function query(request, { requestContext, filterMatchesToLoad, skipLoaderErrorBubbling, skipRevalidation, dataStrategy, generateMiddlewareResponse, normalizePath } = {}) {\n\t\tlet normalizePathImpl = normalizePath || defaultNormalizePath;\n\t\tlet method = request.method;\n\t\tlet location = createLocation(\"\", normalizePathImpl(request), null, \"default\");\n\t\tlet matches = dataRouteMatcher.match(location);\n\t\trequestContext = requestContext != null ? requestContext : new RouterContextProvider();\n\t\tif (!isValidMethod(method) && method !== \"HEAD\") {\n\t\t\tlet error = getInternalRouterError(405, { method });\n\t\t\tlet { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);\n\t\t\tlet staticContext = {\n\t\t\t\tbasename,\n\t\t\t\tlocation,\n\t\t\t\tmatches: methodNotAllowedMatches,\n\t\t\t\tloaderData: {},\n\t\t\t\tactionData: null,\n\t\t\t\terrors: { [route.id]: error },\n\t\t\t\tstatusCode: error.status,\n\t\t\t\tloaderHeaders: {},\n\t\t\t\tactionHeaders: {},\n\t\t\t\t_match: match\n\t\t\t};\n\t\t\treturn generateMiddlewareResponse ? generateMiddlewareResponse(() => Promise.resolve(staticContext)) : staticContext;\n\t\t} else if (!matches) {\n\t\t\tlet error = getInternalRouterError(404, { pathname: location.pathname });\n\t\t\tlet { matches: notFoundMatches, route } = getShortCircuitMatches(dataRoutes);\n\t\t\tlet staticContext = {\n\t\t\t\tbasename,\n\t\t\t\tlocation,\n\t\t\t\tmatches: notFoundMatches,\n\t\t\t\tloaderData: {},\n\t\t\t\tactionData: null,\n\t\t\t\terrors: { [route.id]: error },\n\t\t\t\tstatusCode: error.status,\n\t\t\t\tloaderHeaders: {},\n\t\t\t\tactionHeaders: {},\n\t\t\t\t_match: match\n\t\t\t};\n\t\t\treturn generateMiddlewareResponse ? generateMiddlewareResponse(() => Promise.resolve(staticContext)) : staticContext;\n\t\t}\n\t\tif (generateMiddlewareResponse) {\n\t\t\tinvariant(requestContext instanceof RouterContextProvider, \"When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `RouterContextProvider`\");\n\t\t\ttry {\n\t\t\t\tawait loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties);\n\t\t\t\tlet renderedStaticContext;\n\t\t\t\tlet response = await runServerMiddlewarePipeline({\n\t\t\t\t\trequest,\n\t\t\t\t\turl: createDataFunctionUrl(request, location),\n\t\t\t\t\tpattern: getRoutePattern(matches),\n\t\t\t\t\tmatches,\n\t\t\t\t\tparams: matches[0].params,\n\t\t\t\t\tcontext: requestContext\n\t\t\t\t}, async () => {\n\t\t\t\t\treturn await generateMiddlewareResponse(async (revalidationRequest, opts = {}) => {\n\t\t\t\t\t\tlet result = await queryImpl(revalidationRequest, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null, \"filterMatchesToLoad\" in opts ? opts.filterMatchesToLoad ?? null : filterMatchesToLoad ?? null, skipRevalidation === true);\n\t\t\t\t\t\tif (isResponse(result)) return result;\n\t\t\t\t\t\trenderedStaticContext = {\n\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\tbasename,\n\t\t\t\t\t\t\t...result,\n\t\t\t\t\t\t\t_match: match\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn renderedStaticContext;\n\t\t\t\t\t});\n\t\t\t\t}, async (error, routeId) => {\n\t\t\t\t\tif (isRedirectResponse(error)) return error;\n\t\t\t\t\tif (isResponse(error)) try {\n\t\t\t\t\t\terror = new ErrorResponseImpl(error.status, error.statusText, await parseResponseBody(error));\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\terror = e;\n\t\t\t\t\t}\n\t\t\t\t\tif (isDataWithResponseInit(error)) error = dataWithResponseInitToErrorResponse(error);\n\t\t\t\t\tif (renderedStaticContext) {\n\t\t\t\t\t\tif (routeId in renderedStaticContext.loaderData) renderedStaticContext.loaderData[routeId] = void 0;\n\t\t\t\t\t\tlet staticContext = getStaticContextFromError(dataRoutes, renderedStaticContext, error, skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, routeId).route.id);\n\t\t\t\t\t\treturn generateMiddlewareResponse(() => Promise.resolve(staticContext));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet staticContext = {\n\t\t\t\t\t\t\tmatches,\n\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\tbasename,\n\t\t\t\t\t\t\tloaderData: {},\n\t\t\t\t\t\t\tactionData: null,\n\t\t\t\t\t\t\terrors: { [skipLoaderErrorBubbling ? routeId : findNearestBoundary(matches, matches.find((m) => m.route.id === routeId || m.route.loader)?.route.id || routeId).route.id]: error },\n\t\t\t\t\t\t\tstatusCode: isRouteErrorResponse(error) ? error.status : 500,\n\t\t\t\t\t\t\tactionHeaders: {},\n\t\t\t\t\t\t\tloaderHeaders: {},\n\t\t\t\t\t\t\t_match: match\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn generateMiddlewareResponse(() => Promise.resolve(staticContext));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tinvariant(isResponse(response), \"Expected a response in query()\");\n\t\t\t\treturn response;\n\t\t\t} catch (e) {\n\t\t\t\tif (isResponse(e)) return e;\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\t\tlet result = await queryImpl(request, location, matches, requestContext, dataStrategy || null, skipLoaderErrorBubbling === true, null, filterMatchesToLoad || null, skipRevalidation === true);\n\t\tif (isResponse(result)) return result;\n\t\treturn {\n\t\t\tlocation,\n\t\t\tbasename,\n\t\t\t...result,\n\t\t\t_match: match\n\t\t};\n\t}\n\t/**\n\t* The queryRoute() method is intended for targeted route requests, either\n\t* for fetch ?_data requests or resource route requests. In this case, we\n\t* are only ever calling a single action or loader, and we are returning the\n\t* returned value directly. In most cases, this will be a Response returned\n\t* from the action/loader, but it may be a primitive or other value as well -\n\t* and in such cases the calling context should handle that accordingly.\n\t*\n\t* We do respect the throw/return differentiation, so if an action/loader\n\t* throws, then this method will throw the value. This is important so we\n\t* can do proper boundary identification in Remix where a thrown Response\n\t* must go to the Catch Boundary but a returned Response is happy-path.\n\t*\n\t* One thing to note is that any Router-initiated Errors that make sense\n\t* to associate with a status code will be thrown as an ErrorResponse\n\t* instance which include the raw Error, such that the calling context can\n\t* serialize the error as they see fit while including the proper response\n\t* code. Examples here are 404 and 405 errors that occur prior to reaching\n\t* any user-defined loaders.\n\t*\n\t* - `opts.routeId` allows you to specify the specific route handler to call.\n\t* If not provided the handler will determine the proper route by matching\n\t* against `request.url`\n\t* - `opts.requestContext` is an optional server context that will be passed\n\t* to actions/loaders in the `context` parameter\n\t*/\n\tasync function queryRoute(request, { routeId, requestContext, dataStrategy, generateMiddlewareResponse, normalizePath } = {}) {\n\t\tlet normalizePathImpl = normalizePath || defaultNormalizePath;\n\t\tlet method = request.method;\n\t\tlet location = createLocation(\"\", normalizePathImpl(request), null, \"default\");\n\t\tlet matches = dataRouteMatcher.match(location);\n\t\trequestContext = requestContext != null ? requestContext : new RouterContextProvider();\n\t\tif (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") throw getInternalRouterError(405, { method });\n\t\telse if (!matches) throw getInternalRouterError(404, { pathname: location.pathname });\n\t\tlet match = routeId ? matches.find((m) => m.route.id === routeId) : getTargetMatch(matches, location);\n\t\tif (routeId && !match) throw getInternalRouterError(403, {\n\t\t\tpathname: location.pathname,\n\t\t\trouteId\n\t\t});\n\t\telse if (!match) throw getInternalRouterError(404, { pathname: location.pathname });\n\t\tif (generateMiddlewareResponse) {\n\t\t\tinvariant(requestContext instanceof RouterContextProvider, \"When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `RouterContextProvider`\");\n\t\t\tawait loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties);\n\t\t\treturn await runServerMiddlewarePipeline({\n\t\t\t\trequest,\n\t\t\t\turl: createDataFunctionUrl(request, location),\n\t\t\t\tpattern: getRoutePattern(matches),\n\t\t\t\tmatches,\n\t\t\t\tparams: matches[0].params,\n\t\t\t\tcontext: requestContext\n\t\t\t}, async () => {\n\t\t\t\treturn await generateMiddlewareResponse(async (innerRequest) => {\n\t\t\t\t\tlet processed = handleQueryResult(await queryImpl(innerRequest, location, matches, requestContext, dataStrategy || null, false, match, null, false));\n\t\t\t\t\treturn isResponse(processed) ? processed : typeof processed === \"string\" ? new Response(processed) : Response.json(processed);\n\t\t\t\t});\n\t\t\t}, (error) => {\n\t\t\t\tif (isDataWithResponseInit(error)) return Promise.resolve(dataWithResponseInitToResponse(error));\n\t\t\t\tif (isResponse(error)) return Promise.resolve(error);\n\t\t\t\tthrow error;\n\t\t\t});\n\t\t}\n\t\treturn handleQueryResult(await queryImpl(request, location, matches, requestContext, dataStrategy || null, false, match, null, false));\n\t\tfunction handleQueryResult(result) {\n\t\t\tif (isResponse(result)) return result;\n\t\t\tlet error = result.errors ? Object.values(result.errors)[0] : void 0;\n\t\t\tif (error !== void 0) throw error;\n\t\t\tif (result.actionData) return Object.values(result.actionData)[0];\n\t\t\tif (result.loaderData) return Object.values(result.loaderData)[0];\n\t\t}\n\t}\n\tasync function queryImpl(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, skipRevalidation) {\n\t\tinvariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n\t\ttry {\n\t\t\tif (isMutationMethod(request.method)) return await submit(request, location, matches, routeMatch || getTargetMatch(matches, location), requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch != null, filterMatchesToLoad, skipRevalidation);\n\t\t\tlet result = await loadRouteData(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad);\n\t\t\treturn isResponse(result) ? result : {\n\t\t\t\t...result,\n\t\t\t\tactionData: null,\n\t\t\t\tactionHeaders: {}\n\t\t\t};\n\t\t} catch (e) {\n\t\t\tif (isDataStrategyResult(e) && isResponse(e.result)) {\n\t\t\t\tif (e.type === \"error\") throw e.result;\n\t\t\t\treturn e.result;\n\t\t\t}\n\t\t\tif (isRedirectResponse(e)) return e;\n\t\t\tthrow e;\n\t\t}\n\t}\n\tasync function submit(request, location, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest, filterMatchesToLoad, skipRevalidation) {\n\t\tlet result;\n\t\tif (!actionMatch.route.action && !actionMatch.route.lazy) {\n\t\t\tlet error = getInternalRouterError(405, {\n\t\t\t\tmethod: request.method,\n\t\t\t\tpathname: new URL(request.url).pathname,\n\t\t\t\trouteId: actionMatch.route.id\n\t\t\t});\n\t\t\tif (isRouteRequest) throw error;\n\t\t\tresult = {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror\n\t\t\t};\n\t\t} else {\n\t\t\tresult = (await callDataStrategy(request, location, getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, location, matches, actionMatch, [], requestContext), isRouteRequest, requestContext, dataStrategy))[actionMatch.route.id];\n\t\t\tif (request.signal.aborted) throwStaticHandlerAbortedError(request, isRouteRequest);\n\t\t}\n\t\tif (isRedirectResult(result)) throw new Response(null, {\n\t\t\tstatus: result.response.status,\n\t\t\theaders: { Location: result.response.headers.get(\"Location\") }\n\t\t});\n\t\tif (isRouteRequest) {\n\t\t\tif (isErrorResult(result)) throw result.error;\n\t\t\treturn {\n\t\t\t\tmatches: [actionMatch],\n\t\t\t\tloaderData: {},\n\t\t\t\tactionData: { [actionMatch.route.id]: result.data },\n\t\t\t\terrors: null,\n\t\t\t\tstatusCode: 200,\n\t\t\t\tloaderHeaders: {},\n\t\t\t\tactionHeaders: {}\n\t\t\t};\n\t\t}\n\t\tif (skipRevalidation) if (isErrorResult(result)) {\n\t\t\tlet boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);\n\t\t\treturn {\n\t\t\t\tstatusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,\n\t\t\t\tactionData: null,\n\t\t\t\tactionHeaders: { ...result.headers ? { [actionMatch.route.id]: result.headers } : {} },\n\t\t\t\tmatches,\n\t\t\t\tloaderData: {},\n\t\t\t\terrors: { [boundaryMatch.route.id]: result.error },\n\t\t\t\tloaderHeaders: {}\n\t\t\t};\n\t\t} else return {\n\t\t\tactionData: { [actionMatch.route.id]: result.data },\n\t\t\tactionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {},\n\t\t\tmatches,\n\t\t\tloaderData: {},\n\t\t\terrors: null,\n\t\t\tstatusCode: result.statusCode || 200,\n\t\t\tloaderHeaders: {}\n\t\t};\n\t\tlet loaderRequest = new Request(request.url, {\n\t\t\theaders: request.headers,\n\t\t\tredirect: request.redirect,\n\t\t\tsignal: request.signal\n\t\t});\n\t\tif (isErrorResult(result)) return {\n\t\t\t...await loadRouteData(loaderRequest, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, filterMatchesToLoad, [(skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id)).route.id, result]),\n\t\t\tstatusCode: isRouteErrorResponse(result.error) ? result.error.status : result.statusCode != null ? result.statusCode : 500,\n\t\t\tactionData: null,\n\t\t\tactionHeaders: { ...result.headers ? { [actionMatch.route.id]: result.headers } : {} }\n\t\t};\n\t\treturn {\n\t\t\t...await loadRouteData(loaderRequest, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, null, filterMatchesToLoad),\n\t\t\tactionData: { [actionMatch.route.id]: result.data },\n\t\t\t...result.statusCode ? { statusCode: result.statusCode } : {},\n\t\t\tactionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {}\n\t\t};\n\t}\n\tasync function loadRouteData(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {\n\t\tlet isRouteRequest = routeMatch != null;\n\t\tif (isRouteRequest && !routeMatch?.route.loader && !routeMatch?.route.lazy) throw getInternalRouterError(400, {\n\t\t\tmethod: request.method,\n\t\t\tpathname: new URL(request.url).pathname,\n\t\t\trouteId: routeMatch?.route.id\n\t\t});\n\t\tlet dsMatches;\n\t\tif (routeMatch) dsMatches = getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, location, matches, routeMatch, [], requestContext);\n\t\telse {\n\t\t\tlet maxIdx = pendingActionResult && isErrorResult(pendingActionResult[1]) ? matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1 : void 0;\n\t\t\tlet pattern = getRoutePattern(matches);\n\t\t\tdsMatches = matches.map((match, index) => {\n\t\t\t\tif (maxIdx != null && index > maxIdx) return getDataStrategyMatch(mapRouteProperties, manifest, request, location, pattern, match, [], requestContext, false);\n\t\t\t\treturn getDataStrategyMatch(mapRouteProperties, manifest, request, location, pattern, match, [], requestContext, (match.route.loader || match.route.lazy) != null && (!filterMatchesToLoad || filterMatchesToLoad(match)));\n\t\t\t});\n\t\t}\n\t\tif (!dataStrategy && !dsMatches.some((m) => m.shouldLoad)) return {\n\t\t\tmatches,\n\t\t\tloaderData: {},\n\t\t\terrors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { [pendingActionResult[0]]: pendingActionResult[1].error } : null,\n\t\t\tstatusCode: 200,\n\t\t\tloaderHeaders: {}\n\t\t};\n\t\tlet results = await callDataStrategy(request, location, dsMatches, isRouteRequest, requestContext, dataStrategy);\n\t\tif (request.signal.aborted) throwStaticHandlerAbortedError(request, isRouteRequest);\n\t\treturn {\n\t\t\t...processRouteLoaderData(matches, results, pendingActionResult, true, skipLoaderErrorBubbling),\n\t\t\tmatches\n\t\t};\n\t}\n\tasync function callDataStrategy(request, location, matches, isRouteRequest, requestContext, dataStrategy) {\n\t\tlet results = await callDataStrategyImpl(dataStrategy || defaultDataStrategy, request, location, matches, null, requestContext, true);\n\t\tlet dataResults = {};\n\t\tawait Promise.all(matches.map(async (match) => {\n\t\t\tif (!(match.route.id in results)) return;\n\t\t\tlet result = results[match.route.id];\n\t\t\tif (isRedirectDataStrategyResult(result)) {\n\t\t\t\tlet response = result.result;\n\t\t\t\tthrow normalizeRelativeRoutingRedirectResponse(response, request, match.route.id, matches, basename);\n\t\t\t}\n\t\t\tif (isRouteRequest) {\n\t\t\t\tif (isResponse(result.result)) throw result;\n\t\t\t\telse if (isDataWithResponseInit(result.result)) throw dataWithResponseInitToResponse(result.result);\n\t\t\t}\n\t\t\tdataResults[match.route.id] = await convertDataStrategyResultToDataResult(result);\n\t\t}));\n\t\treturn dataResults;\n\t}\n\treturn {\n\t\tdataRoutes,\n\t\tmatch,\n\t\tquery,\n\t\tqueryRoute\n\t};\n}\n/**\n* Given an existing StaticHandlerContext and an error thrown at render time,\n* provide an updated StaticHandlerContext suitable for a second SSR render\n*\n* @category Utils\n*/\nfunction getStaticContextFromError(routes, handlerContext, error, boundaryId) {\n\tlet errorBoundaryId = boundaryId || handlerContext._deepestRenderedBoundaryId || routes[0].id;\n\treturn {\n\t\t...handlerContext,\n\t\tstatusCode: isRouteErrorResponse(error) ? error.status : 500,\n\t\terrors: { [errorBoundaryId]: error }\n\t};\n}\nfunction throwStaticHandlerAbortedError(request, isRouteRequest) {\n\tif (request.signal.reason !== void 0) throw request.signal.reason;\n\tthrow new Error(`${isRouteRequest ? \"queryRoute\" : \"query\"}() call aborted without an \\`AbortSignal.reason\\`: ${request.method} ${request.url}`);\n}\nfunction isSubmissionNavigation(opts) {\n\treturn opts != null && (\"formData\" in opts && opts.formData != null || \"body\" in opts && opts.body !== void 0);\n}\nfunction defaultNormalizePath(request) {\n\tlet url = new URL(request.url);\n\treturn {\n\t\tpathname: url.pathname,\n\t\tsearch: url.search,\n\t\thash: url.hash\n\t};\n}\nfunction normalizeTo(location, matches, basename, to, fromRouteId, relative) {\n\tlet contextualMatches;\n\tlet activeRouteMatch;\n\tif (fromRouteId) {\n\t\tcontextualMatches = [];\n\t\tfor (let match of matches) {\n\t\t\tcontextualMatches.push(match);\n\t\t\tif (match.route.id === fromRouteId) {\n\t\t\t\tactiveRouteMatch = match;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tcontextualMatches = matches;\n\t\tactiveRouteMatch = matches[matches.length - 1];\n\t}\n\tlet path = resolveTo(to ? to : \".\", getResolveToMatches(contextualMatches), stripBasename(location.pathname, basename) || location.pathname, relative === \"path\");\n\tif (to == null) {\n\t\tpath.search = location.search;\n\t\tpath.hash = location.hash;\n\t}\n\tif ((to == null || to === \"\" || to === \".\") && activeRouteMatch) {\n\t\tlet nakedIndex = hasNakedIndexQuery(path.search);\n\t\tif (activeRouteMatch.route.index && !nakedIndex) path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n\t\telse if (!activeRouteMatch.route.index && nakedIndex) {\n\t\t\tlet params = new URLSearchParams(path.search);\n\t\t\tlet indexValues = params.getAll(\"index\");\n\t\t\tparams.delete(\"index\");\n\t\t\tindexValues.filter((v) => v).forEach((v) => params.append(\"index\", v));\n\t\t\tlet qs = params.toString();\n\t\t\tpath.search = qs ? `?${qs}` : \"\";\n\t\t}\n\t}\n\tif (basename !== \"/\") path.pathname = prependBasename({\n\t\tbasename,\n\t\tpathname: path.pathname\n\t});\n\treturn createPath(path);\n}\nfunction normalizeNavigateOptions(isFetcher, path, opts) {\n\tif (!opts || !isSubmissionNavigation(opts)) return { path };\n\tif (opts.formMethod && !isValidMethod(opts.formMethod)) return {\n\t\tpath,\n\t\terror: getInternalRouterError(405, { method: opts.formMethod })\n\t};\n\tlet getInvalidBodyError = () => ({\n\t\tpath,\n\t\terror: getInternalRouterError(400, { type: \"invalid-body\" })\n\t});\n\tlet formMethod = (opts.formMethod || \"get\").toUpperCase();\n\tlet formAction = stripHashFromPath(path);\n\tif (opts.body !== void 0) {\n\t\tif (opts.formEncType === \"text/plain\") {\n\t\t\tif (!isMutationMethod(formMethod)) return getInvalidBodyError();\n\t\t\tlet text = typeof opts.body === \"string\" ? opts.body : opts.body instanceof FormData || opts.body instanceof URLSearchParams ? Array.from(opts.body.entries()).reduce((acc, [name, value]) => `${acc}${name}=${value}\\n`, \"\") : String(opts.body);\n\t\t\treturn {\n\t\t\t\tpath,\n\t\t\t\tsubmission: {\n\t\t\t\t\tformMethod,\n\t\t\t\t\tformAction,\n\t\t\t\t\tformEncType: opts.formEncType,\n\t\t\t\t\tformData: void 0,\n\t\t\t\t\tjson: void 0,\n\t\t\t\t\ttext\n\t\t\t\t}\n\t\t\t};\n\t\t} else if (opts.formEncType === \"application/json\") {\n\t\t\tif (!isMutationMethod(formMethod)) return getInvalidBodyError();\n\t\t\ttry {\n\t\t\t\tlet json = typeof opts.body === \"string\" ? JSON.parse(opts.body) : opts.body;\n\t\t\t\treturn {\n\t\t\t\t\tpath,\n\t\t\t\t\tsubmission: {\n\t\t\t\t\t\tformMethod,\n\t\t\t\t\t\tformAction,\n\t\t\t\t\t\tformEncType: opts.formEncType,\n\t\t\t\t\t\tformData: void 0,\n\t\t\t\t\t\tjson,\n\t\t\t\t\t\ttext: void 0\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t} catch {\n\t\t\t\treturn getInvalidBodyError();\n\t\t\t}\n\t\t}\n\t}\n\tinvariant(typeof FormData === \"function\", \"FormData is not available in this environment\");\n\tlet searchParams;\n\tlet formData;\n\tif (opts.formData) {\n\t\tsearchParams = convertFormDataToSearchParams(opts.formData);\n\t\tformData = opts.formData;\n\t} else if (opts.body instanceof FormData) {\n\t\tsearchParams = convertFormDataToSearchParams(opts.body);\n\t\tformData = opts.body;\n\t} else if (opts.body instanceof URLSearchParams) {\n\t\tsearchParams = opts.body;\n\t\tformData = convertSearchParamsToFormData(searchParams);\n\t} else if (opts.body == null) {\n\t\tsearchParams = new URLSearchParams();\n\t\tformData = new FormData();\n\t} else try {\n\t\tsearchParams = new URLSearchParams(opts.body);\n\t\tformData = convertSearchParamsToFormData(searchParams);\n\t} catch {\n\t\treturn getInvalidBodyError();\n\t}\n\tlet submission = {\n\t\tformMethod,\n\t\tformAction,\n\t\tformEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n\t\tformData,\n\t\tjson: void 0,\n\t\ttext: void 0\n\t};\n\tif (isMutationMethod(submission.formMethod)) return {\n\t\tpath,\n\t\tsubmission\n\t};\n\tlet parsedPath = parsePath(path);\n\tif (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) searchParams.append(\"index\", \"\");\n\tparsedPath.search = `?${searchParams}`;\n\treturn {\n\t\tpath: createPath(parsedPath),\n\t\tsubmission\n\t};\n}\nfunction getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, dataRouteMatcher, pendingActionResult, callSiteDefaultShouldRevalidate) {\n\tlet actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;\n\tlet currentUrl = history.createURL(state.location);\n\tlet nextUrl = history.createURL(location);\n\tlet maxIdx;\n\tif (initialHydration && state.errors) {\n\t\tlet boundaryId = Object.keys(state.errors)[0];\n\t\tmaxIdx = matches.findIndex((m) => m.route.id === boundaryId);\n\t} else if (pendingActionResult && isErrorResult(pendingActionResult[1])) {\n\t\tlet boundaryId = pendingActionResult[0];\n\t\tmaxIdx = matches.findIndex((m) => m.route.id === boundaryId) - 1;\n\t}\n\tlet actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : void 0;\n\tlet shouldSkipRevalidation = actionStatus && actionStatus >= 400;\n\tlet baseShouldRevalidateArgs = {\n\t\tcurrentUrl,\n\t\tcurrentParams: state.matches[0]?.params || {},\n\t\tnextUrl,\n\t\tnextParams: matches[0].params,\n\t\t...submission,\n\t\tactionResult,\n\t\tactionStatus\n\t};\n\tlet pattern = getRoutePattern(matches);\n\tlet dsMatches = matches.map((match, index) => {\n\t\tlet { route } = match;\n\t\tlet forceShouldLoad = null;\n\t\tif (maxIdx != null && index > maxIdx) forceShouldLoad = false;\n\t\telse if (route.lazy) forceShouldLoad = true;\n\t\telse if (!routeHasLoaderOrMiddleware(route)) forceShouldLoad = false;\n\t\telse if (initialHydration) {\n\t\t\tlet { shouldLoad } = getRouteHydrationStatus(route, state.loaderData, state.errors);\n\t\t\tforceShouldLoad = shouldLoad;\n\t\t} else if (isNewLoader(state.loaderData, state.matches[index], match)) forceShouldLoad = true;\n\t\tif (forceShouldLoad !== null) return getDataStrategyMatch(mapRouteProperties, manifest, request, location, pattern, match, lazyRoutePropertiesToSkip, scopedContext, forceShouldLoad);\n\t\tlet defaultShouldRevalidate = false;\n\t\tif (typeof callSiteDefaultShouldRevalidate === \"boolean\") defaultShouldRevalidate = callSiteDefaultShouldRevalidate;\n\t\telse if (shouldSkipRevalidation) defaultShouldRevalidate = false;\n\t\telse if (isRevalidationRequired) defaultShouldRevalidate = true;\n\t\telse if (currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search) defaultShouldRevalidate = true;\n\t\telse if (currentUrl.search !== nextUrl.search) defaultShouldRevalidate = true;\n\t\telse if (isNewRouteInstance(state.matches[index], match)) defaultShouldRevalidate = true;\n\t\tlet shouldRevalidateArgs = {\n\t\t\t...baseShouldRevalidateArgs,\n\t\t\tdefaultShouldRevalidate\n\t\t};\n\t\treturn getDataStrategyMatch(mapRouteProperties, manifest, request, location, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateLoader(match, shouldRevalidateArgs), shouldRevalidateArgs, callSiteDefaultShouldRevalidate);\n\t});\n\tlet revalidatingFetchers = [];\n\tfetchLoadMatches.forEach((f, key) => {\n\t\tif (initialHydration || !matches.some((m) => m.route.id === f.routeId) || fetchersQueuedForDeletion.has(key) || f.isDiscovering) return;\n\t\tlet fetcher = state.fetchers.get(key);\n\t\tlet isMidInitialLoad = fetcher && fetcher.state !== \"idle\" && fetcher.data === void 0;\n\t\tlet fetcherMatches = dataRouteMatcher.match(f.path);\n\t\tif (!fetcherMatches) {\n\t\t\trevalidatingFetchers.push({\n\t\t\t\tkey,\n\t\t\t\trouteId: f.routeId,\n\t\t\t\tpath: f.path,\n\t\t\t\tmatches: null,\n\t\t\t\tmatch: null,\n\t\t\t\trequest: null,\n\t\t\t\tcontroller: null\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (fetchRedirectIds.has(key)) return;\n\t\tlet fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n\t\tlet fetchController = new AbortController();\n\t\tlet fetchRequest = createClientSideRequest(history, f.path, fetchController.signal);\n\t\tlet fetcherDsMatches = null;\n\t\tif (cancelledFetcherLoads.has(key)) {\n\t\t\tcancelledFetcherLoads.delete(key);\n\t\t\tfetcherDsMatches = getTargetedDataStrategyMatches(mapRouteProperties, manifest, fetchRequest, f.path, fetcherMatches, fetcherMatch, lazyRoutePropertiesToSkip, scopedContext);\n\t\t} else if (isMidInitialLoad) {\n\t\t\tif (isRevalidationRequired) fetcherDsMatches = getTargetedDataStrategyMatches(mapRouteProperties, manifest, fetchRequest, f.path, fetcherMatches, fetcherMatch, lazyRoutePropertiesToSkip, scopedContext);\n\t\t} else {\n\t\t\tlet defaultShouldRevalidate;\n\t\t\tif (typeof callSiteDefaultShouldRevalidate === \"boolean\") defaultShouldRevalidate = callSiteDefaultShouldRevalidate;\n\t\t\telse if (shouldSkipRevalidation) defaultShouldRevalidate = false;\n\t\t\telse defaultShouldRevalidate = isRevalidationRequired;\n\t\t\tlet shouldRevalidateArgs = {\n\t\t\t\t...baseShouldRevalidateArgs,\n\t\t\t\tdefaultShouldRevalidate\n\t\t\t};\n\t\t\tif (shouldRevalidateLoader(fetcherMatch, shouldRevalidateArgs)) fetcherDsMatches = getTargetedDataStrategyMatches(mapRouteProperties, manifest, fetchRequest, f.path, fetcherMatches, fetcherMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs);\n\t\t}\n\t\tif (fetcherDsMatches) revalidatingFetchers.push({\n\t\t\tkey,\n\t\t\trouteId: f.routeId,\n\t\t\tpath: f.path,\n\t\t\tmatches: fetcherDsMatches,\n\t\t\tmatch: fetcherMatch,\n\t\t\trequest: fetchRequest,\n\t\t\tcontroller: fetchController\n\t\t});\n\t});\n\treturn {\n\t\tdsMatches,\n\t\trevalidatingFetchers\n\t};\n}\nfunction routeHasLoaderOrMiddleware(route) {\n\treturn route.loader != null || route.middleware != null && route.middleware.length > 0;\n}\nfunction getRouteHydrationStatus(route, loaderData, errors) {\n\tif (route.lazy) return {\n\t\tshouldLoad: true,\n\t\trenderFallback: true\n\t};\n\tif (!routeHasLoaderOrMiddleware(route)) return {\n\t\tshouldLoad: false,\n\t\trenderFallback: false\n\t};\n\tlet hasData = loaderData != null && route.id in loaderData;\n\tlet hasError = errors != null && errors[route.id] !== void 0;\n\tif (!hasData && hasError) return {\n\t\tshouldLoad: false,\n\t\trenderFallback: false\n\t};\n\tif (typeof route.loader === \"function\" && route.loader.hydrate === true) return {\n\t\tshouldLoad: true,\n\t\trenderFallback: !hasData\n\t};\n\tlet shouldLoad = !hasData && !hasError;\n\treturn {\n\t\tshouldLoad,\n\t\trenderFallback: shouldLoad\n\t};\n}\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n\tlet isNew = !currentMatch || match.route.id !== currentMatch.route.id;\n\tlet isMissingData = !currentLoaderData.hasOwnProperty(match.route.id);\n\treturn isNew || isMissingData;\n}\nfunction isNewRouteInstance(currentMatch, match) {\n\tlet currentPath = currentMatch.route.path;\n\treturn currentMatch.pathname !== match.pathname || currentPath != null && currentPath.endsWith(\"*\") && currentMatch.params[\"*\"] !== match.params[\"*\"];\n}\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n\tif (loaderMatch.route.shouldRevalidate) {\n\t\tlet routeChoice = loaderMatch.route.shouldRevalidate(arg);\n\t\tif (typeof routeChoice === \"boolean\") return routeChoice;\n\t}\n\treturn arg.defaultShouldRevalidate;\n}\nfunction patchRoutesImpl(routeId, children, dataRoutes, manifest, mapRouteProperties, allowElementMutations) {\n\tlet childrenToPatch;\n\tif (routeId) {\n\t\tlet route = manifest[routeId];\n\t\tinvariant(route, `No route found to patch children into: routeId = ${routeId}`);\n\t\tif (!route.children) route.children = [];\n\t\tchildrenToPatch = route.children;\n\t} else childrenToPatch = dataRoutes.activeRoutes;\n\tlet uniqueChildren = [];\n\tlet existingChildren = [];\n\tchildren.forEach((newRoute) => {\n\t\tlet existingRoute = childrenToPatch.find((existingRoute) => isSameRoute(newRoute, existingRoute));\n\t\tif (existingRoute) existingChildren.push({\n\t\t\texistingRoute,\n\t\t\tnewRoute\n\t\t});\n\t\telse uniqueChildren.push(newRoute);\n\t});\n\tif (uniqueChildren.length > 0) {\n\t\tlet newRoutes = convertRoutesToDataRoutes(uniqueChildren, mapRouteProperties, [\n\t\t\trouteId || \"_\",\n\t\t\t\"patch\",\n\t\t\tString(childrenToPatch?.length || \"0\")\n\t\t], manifest);\n\t\tchildrenToPatch.push(...newRoutes);\n\t}\n\tif (allowElementMutations && existingChildren.length > 0) for (let i = 0; i < existingChildren.length; i++) {\n\t\tlet { existingRoute, newRoute } = existingChildren[i];\n\t\tlet existingRouteTyped = existingRoute;\n\t\tlet [newRouteTyped] = convertRoutesToDataRoutes([newRoute], mapRouteProperties, [], {}, true);\n\t\tObject.assign(existingRouteTyped, {\n\t\t\telement: newRouteTyped.element ? newRouteTyped.element : existingRouteTyped.element,\n\t\t\terrorElement: newRouteTyped.errorElement ? newRouteTyped.errorElement : existingRouteTyped.errorElement,\n\t\t\thydrateFallbackElement: newRouteTyped.hydrateFallbackElement ? newRouteTyped.hydrateFallbackElement : existingRouteTyped.hydrateFallbackElement\n\t\t});\n\t}\n\tif (!dataRoutes.hasHMRRoutes) dataRoutes.setRoutes([...dataRoutes.activeRoutes]);\n}\nfunction isSameRoute(newRoute, existingRoute) {\n\tif (\"id\" in newRoute && \"id\" in existingRoute && newRoute.id === existingRoute.id) return true;\n\tif (!(newRoute.index === existingRoute.index && newRoute.path === existingRoute.path && newRoute.caseSensitive === existingRoute.caseSensitive)) return false;\n\tif ((!newRoute.children || newRoute.children.length === 0) && (!existingRoute.children || existingRoute.children.length === 0)) return true;\n\treturn newRoute.children?.every((aChild, i) => existingRoute.children?.some((bChild) => isSameRoute(aChild, bChild))) ?? false;\n}\nconst lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();\nconst loadLazyRouteProperty = ({ key, route, manifest, mapRouteProperties }) => {\n\tlet routeToUpdate = manifest[route.id];\n\tinvariant(routeToUpdate, \"No route found in manifest\");\n\tif (!routeToUpdate.lazy || typeof routeToUpdate.lazy !== \"object\") return;\n\tlet lazyFn = routeToUpdate.lazy[key];\n\tif (!lazyFn) return;\n\tlet cache = lazyRoutePropertyCache.get(routeToUpdate);\n\tif (!cache) {\n\t\tcache = {};\n\t\tlazyRoutePropertyCache.set(routeToUpdate, cache);\n\t}\n\tlet cachedPromise = cache[key];\n\tif (cachedPromise) return cachedPromise;\n\tlet propertyPromise = (async () => {\n\t\tlet isUnsupported = isUnsupportedLazyRouteObjectKey(key);\n\t\tlet isStaticallyDefined = routeToUpdate[key] !== void 0;\n\t\tif (isUnsupported) {\n\t\t\twarning(!isUnsupported, \"Route property \" + key + \" is not a supported lazy route property. This property will be ignored.\");\n\t\t\tcache[key] = Promise.resolve();\n\t\t} else if (isStaticallyDefined) warning(false, `Route \"${routeToUpdate.id}\" has a static property \"${key}\" defined. The lazy property will be ignored.`);\n\t\telse {\n\t\t\tlet value = await lazyFn();\n\t\t\tif (value != null) {\n\t\t\t\tObject.assign(routeToUpdate, { [key]: value });\n\t\t\t\tObject.assign(routeToUpdate, mapRouteProperties(routeToUpdate));\n\t\t\t}\n\t\t}\n\t\tif (typeof routeToUpdate.lazy === \"object\") {\n\t\t\trouteToUpdate.lazy[key] = void 0;\n\t\t\tif (Object.values(routeToUpdate.lazy).every((value) => value === void 0)) routeToUpdate.lazy = void 0;\n\t\t}\n\t})();\n\tcache[key] = propertyPromise;\n\treturn propertyPromise;\n};\nconst lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap();\n/**\n* Execute route.lazy functions to lazily load route modules (loader, action,\n* shouldRevalidate) and update the routeManifest in place which shares objects\n* with dataRoutes so those get updated as well.\n*/\nfunction loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePropertiesToSkip) {\n\tlet routeToUpdate = manifest[route.id];\n\tinvariant(routeToUpdate, \"No route found in manifest\");\n\tif (!route.lazy) return {\n\t\tlazyRoutePromise: void 0,\n\t\tlazyHandlerPromise: void 0\n\t};\n\tif (typeof route.lazy === \"function\") {\n\t\tlet cachedPromise = lazyRouteFunctionCache.get(routeToUpdate);\n\t\tif (cachedPromise) return {\n\t\t\tlazyRoutePromise: cachedPromise,\n\t\t\tlazyHandlerPromise: cachedPromise\n\t\t};\n\t\tlet lazyRoutePromise = (async () => {\n\t\t\tinvariant(typeof route.lazy === \"function\", \"No lazy route function found\");\n\t\t\tlet lazyRoute = await route.lazy();\n\t\t\tlet routeUpdates = {};\n\t\t\tfor (let lazyRouteProperty in lazyRoute) {\n\t\t\t\tlet lazyValue = lazyRoute[lazyRouteProperty];\n\t\t\t\tif (lazyValue === void 0) continue;\n\t\t\t\tlet isUnsupported = isUnsupportedLazyRouteFunctionKey(lazyRouteProperty);\n\t\t\t\tlet isStaticallyDefined = routeToUpdate[lazyRouteProperty] !== void 0;\n\t\t\t\tif (isUnsupported) warning(!isUnsupported, \"Route property \" + lazyRouteProperty + \" is not a supported property to be returned from a lazy route function. This property will be ignored.\");\n\t\t\t\telse if (isStaticallyDefined) warning(!isStaticallyDefined, `Route \"${routeToUpdate.id}\" has a static property \"${lazyRouteProperty}\" defined but its lazy function is also returning a value for this property. The lazy route property \"${lazyRouteProperty}\" will be ignored.`);\n\t\t\t\telse routeUpdates[lazyRouteProperty] = lazyValue;\n\t\t\t}\n\t\t\tObject.assign(routeToUpdate, routeUpdates);\n\t\t\tObject.assign(routeToUpdate, {\n\t\t\t\t...mapRouteProperties(routeToUpdate),\n\t\t\t\tlazy: void 0\n\t\t\t});\n\t\t})();\n\t\tlazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise);\n\t\tlazyRoutePromise.catch(() => {});\n\t\treturn {\n\t\t\tlazyRoutePromise,\n\t\t\tlazyHandlerPromise: lazyRoutePromise\n\t\t};\n\t}\n\tlet lazyKeys = Object.keys(route.lazy);\n\tlet lazyPropertyPromises = [];\n\tlet lazyHandlerPromise = void 0;\n\tfor (let key of lazyKeys) {\n\t\tif (lazyRoutePropertiesToSkip && lazyRoutePropertiesToSkip.includes(key)) continue;\n\t\tlet promise = loadLazyRouteProperty({\n\t\t\tkey,\n\t\t\troute,\n\t\t\tmanifest,\n\t\t\tmapRouteProperties\n\t\t});\n\t\tif (promise) {\n\t\t\tlazyPropertyPromises.push(promise);\n\t\t\tif (key === type) lazyHandlerPromise = promise;\n\t\t}\n\t}\n\tlet lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {}) : void 0;\n\tlazyRoutePromise?.catch(() => {});\n\tlazyHandlerPromise?.catch(() => {});\n\treturn {\n\t\tlazyRoutePromise,\n\t\tlazyHandlerPromise\n\t};\n}\nfunction isNonNullable(value) {\n\treturn value !== void 0;\n}\nfunction loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties) {\n\tlet promises = matches.map(({ route }) => {\n\t\tif (typeof route.lazy !== \"object\" || !route.lazy.middleware) return;\n\t\treturn loadLazyRouteProperty({\n\t\t\tkey: \"middleware\",\n\t\t\troute,\n\t\t\tmanifest,\n\t\t\tmapRouteProperties\n\t\t});\n\t}).filter(isNonNullable);\n\treturn promises.length > 0 ? Promise.all(promises) : void 0;\n}\nasync function defaultDataStrategy(args) {\n\tlet matchesToLoad = args.matches.filter((m) => m.shouldLoad);\n\tlet keyedResults = {};\n\t(await Promise.all(matchesToLoad.map((m) => m.resolve()))).forEach((result, i) => {\n\t\tkeyedResults[matchesToLoad[i].route.id] = result;\n\t});\n\treturn keyedResults;\n}\nasync function defaultDataStrategyWithMiddleware(args) {\n\tif (!args.matches.some((m) => m.route.middleware)) return defaultDataStrategy(args);\n\treturn runClientMiddlewarePipeline(args, () => defaultDataStrategy(args));\n}\nfunction runServerMiddlewarePipeline(args, handler, errorHandler) {\n\treturn runMiddlewarePipeline(args, handler, processResult, isResponse, errorHandler);\n\tfunction processResult(result) {\n\t\treturn isDataWithResponseInit(result) ? dataWithResponseInitToResponse(result) : result;\n\t}\n}\nfunction runClientMiddlewarePipeline(args, handler) {\n\treturn runMiddlewarePipeline(args, handler, (r) => {\n\t\tif (isRedirectResponse(r)) throw r;\n\t\treturn r;\n\t}, isDataStrategyResults, errorHandler);\n\tasync function errorHandler(error, routeId, nextResult) {\n\t\tif (nextResult) return Object.assign(nextResult.value, { [routeId]: {\n\t\t\ttype: \"error\",\n\t\t\tresult: error\n\t\t} });\n\t\telse {\n\t\t\tlet { matches } = args;\n\t\t\tlet maxBoundaryIdx = Math.min(Math.max(matches.findIndex((m) => m.route.id === routeId), 0), Math.max(matches.findIndex((m) => m.shouldCallHandler()), 0));\n\t\t\tlet deepestRouteId = matches[maxBoundaryIdx].route.id;\n\t\t\tfor (let match of matches.slice(0, maxBoundaryIdx + 1)) try {\n\t\t\t\tawait match._lazyPromises?.route;\n\t\t\t} catch {\n\t\t\t\tdeepestRouteId = match.route.id;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn { [findNearestBoundary(matches, deepestRouteId).route.id]: {\n\t\t\t\ttype: \"error\",\n\t\t\t\tresult: error\n\t\t\t} };\n\t\t}\n\t}\n}\nasync function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {\n\tlet { matches, ...dataFnArgs } = args;\n\treturn await callRouteMiddleware(dataFnArgs, matches.flatMap((m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []), handler, processResult, isResult, errorHandler);\n}\nasync function callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx = 0) {\n\tlet { request } = args;\n\tif (request.signal.aborted) throw request.signal.reason ?? /* @__PURE__ */ new Error(`Request aborted: ${request.method} ${request.url}`);\n\tlet tuple = middlewares[idx];\n\tif (!tuple) return await handler();\n\tlet [routeId, middleware] = tuple;\n\tlet nextResult;\n\tlet next = async () => {\n\t\tif (nextResult) throw new Error(\"You may only call `next()` once per middleware\");\n\t\ttry {\n\t\t\tnextResult = { value: await callRouteMiddleware(args, middlewares, handler, processResult, isResult, errorHandler, idx + 1) };\n\t\t\treturn nextResult.value;\n\t\t} catch (error) {\n\t\t\tnextResult = { value: await errorHandler(error, routeId, nextResult) };\n\t\t\treturn nextResult.value;\n\t\t}\n\t};\n\ttry {\n\t\tlet value = await middleware(args, next);\n\t\tlet result = value != null ? processResult(value) : void 0;\n\t\tif (isResult(result)) return result;\n\t\telse if (nextResult) return result ?? nextResult.value;\n\t\telse {\n\t\t\tnextResult = { value: await next() };\n\t\t\treturn nextResult.value;\n\t\t}\n\t} catch (error) {\n\t\treturn await errorHandler(error, routeId, nextResult);\n\t}\n}\nfunction getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip) {\n\tlet lazyMiddlewarePromise = loadLazyRouteProperty({\n\t\tkey: \"middleware\",\n\t\troute: match.route,\n\t\tmanifest,\n\t\tmapRouteProperties\n\t});\n\tlet lazyRoutePromises = loadLazyRoute(match.route, isMutationMethod(request.method) ? \"action\" : \"loader\", manifest, mapRouteProperties, lazyRoutePropertiesToSkip);\n\treturn {\n\t\tmiddleware: lazyMiddlewarePromise,\n\t\troute: lazyRoutePromises.lazyRoutePromise,\n\t\thandler: lazyRoutePromises.lazyHandlerPromise\n\t};\n}\nfunction getDataStrategyMatch(mapRouteProperties, manifest, request, path, pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {\n\tlet isUsingNewApi = false;\n\tlet _lazyPromises = getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip);\n\treturn {\n\t\t...match,\n\t\t_lazyPromises,\n\t\tshouldLoad,\n\t\tshouldRevalidateArgs,\n\t\tshouldCallHandler(defaultShouldRevalidate) {\n\t\t\tisUsingNewApi = true;\n\t\t\tif (!shouldRevalidateArgs) return shouldLoad;\n\t\t\tif (typeof callSiteDefaultShouldRevalidate === \"boolean\") return shouldRevalidateLoader(match, {\n\t\t\t\t...shouldRevalidateArgs,\n\t\t\t\tdefaultShouldRevalidate: callSiteDefaultShouldRevalidate\n\t\t\t});\n\t\t\tif (typeof defaultShouldRevalidate === \"boolean\") return shouldRevalidateLoader(match, {\n\t\t\t\t...shouldRevalidateArgs,\n\t\t\t\tdefaultShouldRevalidate\n\t\t\t});\n\t\t\treturn shouldRevalidateLoader(match, shouldRevalidateArgs);\n\t\t},\n\t\tresolve(handlerOverride) {\n\t\t\tlet { lazy, loader, middleware } = match.route;\n\t\t\tlet callHandler = isUsingNewApi || shouldLoad || handlerOverride && !isMutationMethod(request.method) && (lazy || loader);\n\t\t\tlet isMiddlewareOnlyRoute = middleware && middleware.length > 0 && !loader && !lazy;\n\t\t\tif (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) return callLoaderOrAction({\n\t\t\t\trequest,\n\t\t\t\tpath,\n\t\t\t\tpattern,\n\t\t\t\tmatch,\n\t\t\t\tlazyHandlerPromise: _lazyPromises?.handler,\n\t\t\t\tlazyRoutePromise: _lazyPromises?.route,\n\t\t\t\thandlerOverride,\n\t\t\t\tscopedContext\n\t\t\t});\n\t\t\treturn Promise.resolve({\n\t\t\t\ttype: \"data\",\n\t\t\t\tresult: void 0\n\t\t\t});\n\t\t}\n\t};\n}\nfunction getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, path, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs = null) {\n\treturn matches.map((match) => {\n\t\tif (match.route.id !== targetMatch.route.id) return {\n\t\t\t...match,\n\t\t\tshouldLoad: false,\n\t\t\tshouldRevalidateArgs,\n\t\t\tshouldCallHandler: () => false,\n\t\t\t_lazyPromises: getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request, match, lazyRoutePropertiesToSkip),\n\t\t\tresolve: () => Promise.resolve({\n\t\t\t\ttype: \"data\",\n\t\t\t\tresult: void 0\n\t\t\t})\n\t\t};\n\t\treturn getDataStrategyMatch(mapRouteProperties, manifest, request, path, getRoutePattern(matches), match, lazyRoutePropertiesToSkip, scopedContext, true, shouldRevalidateArgs);\n\t});\n}\nasync function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, scopedContext, isStaticHandler) {\n\tif (matches.some((m) => m._lazyPromises?.middleware)) await Promise.all(matches.map((m) => m._lazyPromises?.middleware));\n\tlet dataStrategyArgs = {\n\t\trequest,\n\t\turl: createDataFunctionUrl(request, path),\n\t\tpattern: getRoutePattern(matches),\n\t\tparams: matches[0].params,\n\t\tcontext: scopedContext,\n\t\tmatches\n\t};\n\tlet runClientMiddleware = isStaticHandler ? () => {\n\t\tthrow new Error(\"You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`\");\n\t} : (cb) => {\n\t\tlet typedDataStrategyArgs = dataStrategyArgs;\n\t\treturn runClientMiddlewarePipeline(typedDataStrategyArgs, () => {\n\t\t\treturn cb({\n\t\t\t\t...typedDataStrategyArgs,\n\t\t\t\tfetcherKey,\n\t\t\t\trunClientMiddleware: () => {\n\t\t\t\t\tthrow new Error(\"Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler\");\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t};\n\tlet results = await dataStrategyImpl({\n\t\t...dataStrategyArgs,\n\t\tfetcherKey,\n\t\trunClientMiddleware\n\t});\n\ttry {\n\t\tawait Promise.all(matches.flatMap((m) => [m._lazyPromises?.handler, m._lazyPromises?.route]));\n\t} catch {}\n\treturn results;\n}\nasync function callLoaderOrAction({ request, path, pattern, match, lazyHandlerPromise, lazyRoutePromise, handlerOverride, scopedContext }) {\n\tlet result;\n\tlet onReject;\n\tlet isAction = isMutationMethod(request.method);\n\tlet type = isAction ? \"action\" : \"loader\";\n\tlet runHandler = (handler) => {\n\t\tlet reject;\n\t\tlet abortPromise = new Promise((_, r) => reject = r);\n\t\tonReject = () => reject();\n\t\trequest.signal.addEventListener(\"abort\", onReject);\n\t\tlet actualHandler = (ctx) => {\n\t\t\tif (typeof handler !== \"function\") return Promise.reject(/* @__PURE__ */ new Error(`You cannot call the handler for a route which defines a boolean \"${type}\" [routeId: ${match.route.id}]`));\n\t\t\treturn handler({\n\t\t\t\trequest,\n\t\t\t\turl: createDataFunctionUrl(request, path),\n\t\t\t\tpattern,\n\t\t\t\tparams: match.params,\n\t\t\t\tcontext: scopedContext\n\t\t\t}, ...ctx !== void 0 ? [ctx] : []);\n\t\t};\n\t\tlet handlerPromise = (async () => {\n\t\t\ttry {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tresult: await (handlerOverride ? handlerOverride((ctx) => actualHandler(ctx)) : actualHandler())\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\tresult: e\n\t\t\t\t};\n\t\t\t}\n\t\t})();\n\t\treturn Promise.race([handlerPromise, abortPromise]);\n\t};\n\ttry {\n\t\tlet handler = isAction ? match.route.action : match.route.loader;\n\t\tif (lazyHandlerPromise || lazyRoutePromise) if (handler) {\n\t\t\tlet handlerError;\n\t\t\tlet [value] = await Promise.all([\n\t\t\t\trunHandler(handler).catch((e) => {\n\t\t\t\t\thandlerError = e;\n\t\t\t\t}),\n\t\t\t\tlazyHandlerPromise,\n\t\t\t\tlazyRoutePromise\n\t\t\t]);\n\t\t\tif (handlerError !== void 0) throw handlerError;\n\t\t\tresult = value;\n\t\t} else {\n\t\t\tawait lazyHandlerPromise;\n\t\t\tlet handler = isAction ? match.route.action : match.route.loader;\n\t\t\tif (handler) [result] = await Promise.all([runHandler(handler), lazyRoutePromise]);\n\t\t\telse if (type === \"action\") {\n\t\t\t\tlet url = new URL(request.url);\n\t\t\t\tlet pathname = url.pathname + url.search;\n\t\t\t\tthrow getInternalRouterError(405, {\n\t\t\t\t\tmethod: request.method,\n\t\t\t\t\tpathname,\n\t\t\t\t\trouteId: match.route.id\n\t\t\t\t});\n\t\t\t} else return {\n\t\t\t\ttype: \"data\",\n\t\t\t\tresult: void 0\n\t\t\t};\n\t\t}\n\t\telse if (!handler) {\n\t\t\tlet url = new URL(request.url);\n\t\t\tthrow getInternalRouterError(404, { pathname: url.pathname + url.search });\n\t\t} else result = await runHandler(handler);\n\t} catch (e) {\n\t\treturn {\n\t\t\ttype: \"error\",\n\t\t\tresult: e\n\t\t};\n\t} finally {\n\t\tif (onReject) request.signal.removeEventListener(\"abort\", onReject);\n\t}\n\treturn result;\n}\nasync function parseResponseBody(response) {\n\tlet contentType = response.headers.get(\"Content-Type\");\n\tif (contentType && /\\bapplication\\/json\\b/.test(contentType)) return response.body == null ? null : response.json();\n\treturn response.text();\n}\nasync function convertDataStrategyResultToDataResult(dataStrategyResult) {\n\tlet { result, type } = dataStrategyResult;\n\tif (isResponse(result)) {\n\t\tlet data;\n\t\ttry {\n\t\t\tdata = await parseResponseBody(result);\n\t\t} catch (e) {\n\t\t\treturn {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror: e\n\t\t\t};\n\t\t}\n\t\tif (type === \"error\") return {\n\t\t\ttype: \"error\",\n\t\t\terror: new ErrorResponseImpl(result.status, result.statusText, data),\n\t\t\tstatusCode: result.status,\n\t\t\theaders: result.headers\n\t\t};\n\t\treturn {\n\t\t\ttype: \"data\",\n\t\t\tdata,\n\t\t\tstatusCode: result.status,\n\t\t\theaders: result.headers\n\t\t};\n\t}\n\tif (type === \"error\") {\n\t\tif (isDataWithResponseInit(result)) {\n\t\t\tif (result.data instanceof Error) return {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror: result.data,\n\t\t\t\tstatusCode: result.init?.status,\n\t\t\t\theaders: result.init?.headers ? new Headers(result.init.headers) : void 0\n\t\t\t};\n\t\t\treturn {\n\t\t\t\ttype: \"error\",\n\t\t\t\terror: dataWithResponseInitToErrorResponse(result),\n\t\t\t\tstatusCode: isRouteErrorResponse(result) ? result.status : void 0,\n\t\t\t\theaders: result.init?.headers ? new Headers(result.init.headers) : void 0\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\ttype: \"error\",\n\t\t\terror: result,\n\t\t\tstatusCode: isRouteErrorResponse(result) ? result.status : void 0\n\t\t};\n\t}\n\tif (isDataWithResponseInit(result)) return {\n\t\ttype: \"data\",\n\t\tdata: result.data,\n\t\tstatusCode: result.init?.status,\n\t\theaders: result.init?.headers ? new Headers(result.init.headers) : void 0\n\t};\n\treturn {\n\t\ttype: \"data\",\n\t\tdata: result\n\t};\n}\nfunction normalizeRelativeRoutingRedirectResponse(response, request, routeId, matches, basename) {\n\tlet location = response.headers.get(\"Location\");\n\tinvariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\");\n\tif (!isAbsoluteUrl(location)) {\n\t\tlet trimmedMatches = matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1);\n\t\tlocation = normalizeTo(new URL(request.url), trimmedMatches, basename, location);\n\t\tresponse.headers.set(\"Location\", location);\n\t}\n\treturn response;\n}\nconst invalidProtocols = [\n\t\"about:\",\n\t\"blob:\",\n\t\"chrome:\",\n\t\"chrome-untrusted:\",\n\t\"content:\",\n\t\"data:\",\n\t\"devtools:\",\n\t\"file:\",\n\t\"filesystem:\",\n\t\"javascript:\"\n];\nfunction hasInvalidProtocol(location) {\n\ttry {\n\t\treturn invalidProtocols.includes(new URL(location).protocol);\n\t} catch {\n\t\treturn false;\n\t}\n}\nfunction normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {\n\tif (isAbsoluteUrl(location)) {\n\t\tlet normalizedLocation = location;\n\t\tlet url = PROTOCOL_RELATIVE_URL_REGEX.test(normalizedLocation) ? new URL(normalizeProtocolRelativeUrl(normalizedLocation, currentUrl.protocol)) : new URL(normalizedLocation);\n\t\tif (hasInvalidProtocol(url.toString())) throw new Error(\"Invalid redirect location\");\n\t\tlet isSameBasename = stripBasename(url.pathname, basename) != null;\n\t\tif (url.origin === currentUrl.origin && isSameBasename) return removeDoubleSlashes(url.pathname) + url.search + url.hash;\n\t}\n\ttry {\n\t\tif (hasInvalidProtocol(historyInstance.createURL(location).toString())) throw new Error(\"Invalid redirect location\");\n\t} catch {}\n\treturn location;\n}\nfunction createClientSideRequest(history, location, signal, submission) {\n\tlet url = history.createURL(stripHashFromPath(location)).toString();\n\tlet init = { signal };\n\tif (submission && isMutationMethod(submission.formMethod)) {\n\t\tlet { formMethod, formEncType } = submission;\n\t\tinit.method = formMethod.toUpperCase();\n\t\tif (formEncType === \"application/json\") {\n\t\t\tinit.headers = new Headers({ \"Content-Type\": formEncType });\n\t\t\tinit.body = JSON.stringify(submission.json);\n\t\t} else if (formEncType === \"text/plain\") init.body = submission.text;\n\t\telse if (formEncType === \"application/x-www-form-urlencoded\" && submission.formData) init.body = convertFormDataToSearchParams(submission.formData);\n\t\telse init.body = submission.formData;\n\t}\n\treturn new Request(url, init);\n}\nfunction convertFormDataToSearchParams(formData) {\n\tlet searchParams = new URLSearchParams();\n\tfor (let [key, value] of formData.entries()) searchParams.append(key, typeof value === \"string\" ? value : value.name);\n\treturn searchParams;\n}\nfunction convertSearchParamsToFormData(searchParams) {\n\tlet formData = new FormData();\n\tfor (let [key, value] of searchParams.entries()) formData.append(key, value);\n\treturn formData;\n}\nfunction processRouteLoaderData(matches, results, pendingActionResult, isStaticHandler = false, skipLoaderErrorBubbling = false) {\n\tlet loaderData = {};\n\tlet errors = null;\n\tlet statusCode;\n\tlet foundError = false;\n\tlet loaderHeaders = {};\n\tlet pendingError = pendingActionResult && isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : void 0;\n\tmatches.forEach((match) => {\n\t\tif (!(match.route.id in results)) return;\n\t\tlet id = match.route.id;\n\t\tlet result = results[id];\n\t\tinvariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n\t\tif (isErrorResult(result)) {\n\t\t\tlet error = result.error;\n\t\t\tif (pendingError !== void 0) {\n\t\t\t\terror = pendingError;\n\t\t\t\tpendingError = void 0;\n\t\t\t}\n\t\t\terrors = errors || {};\n\t\t\tif (skipLoaderErrorBubbling) errors[id] = error;\n\t\t\telse {\n\t\t\t\tlet boundaryMatch = findNearestBoundary(matches, id);\n\t\t\t\tif (errors[boundaryMatch.route.id] == null) errors[boundaryMatch.route.id] = error;\n\t\t\t}\n\t\t\tif (!isStaticHandler) loaderData[id] = ResetLoaderDataSymbol;\n\t\t\tif (!foundError) {\n\t\t\t\tfoundError = true;\n\t\t\t\tstatusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n\t\t\t}\n\t\t\tif (result.headers) loaderHeaders[id] = result.headers;\n\t\t} else {\n\t\t\tloaderData[id] = result.data;\n\t\t\tif (result.statusCode && result.statusCode !== 200 && !foundError) statusCode = result.statusCode;\n\t\t\tif (result.headers) loaderHeaders[id] = result.headers;\n\t\t}\n\t});\n\tif (pendingError !== void 0 && pendingActionResult) {\n\t\terrors = { [pendingActionResult[0]]: pendingError };\n\t\tif (pendingActionResult[2]) loaderData[pendingActionResult[2]] = void 0;\n\t}\n\treturn {\n\t\tloaderData,\n\t\terrors,\n\t\tstatusCode: statusCode || 200,\n\t\tloaderHeaders\n\t};\n}\nfunction processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults, workingFetchers) {\n\tlet { loaderData, errors } = processRouteLoaderData(matches, results, pendingActionResult);\n\trevalidatingFetchers.filter((f) => !f.matches || f.matches.some((m) => m.shouldLoad)).forEach((rf) => {\n\t\tlet { key, match, controller } = rf;\n\t\tif (controller && controller.signal.aborted) return;\n\t\tlet result = fetcherResults[key];\n\t\tinvariant(result, \"Did not find corresponding fetcher result\");\n\t\tif (isErrorResult(result)) {\n\t\t\tlet boundaryMatch = findNearestBoundary(state.matches, match?.route.id);\n\t\t\tif (!(errors && errors[boundaryMatch.route.id])) errors = {\n\t\t\t\t...errors,\n\t\t\t\t[boundaryMatch.route.id]: result.error\n\t\t\t};\n\t\t\tworkingFetchers.delete(key);\n\t\t} else if (isRedirectResult(result)) invariant(false, \"Unhandled fetcher revalidation redirect\");\n\t\telse {\n\t\t\tlet doneFetcher = getDoneFetcher(result.data);\n\t\t\tworkingFetchers.set(key, doneFetcher);\n\t\t}\n\t});\n\treturn {\n\t\tloaderData,\n\t\terrors\n\t};\n}\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n\tlet mergedLoaderData = Object.entries(newLoaderData).filter(([, v]) => v !== ResetLoaderDataSymbol).reduce((merged, [k, v]) => {\n\t\tmerged[k] = v;\n\t\treturn merged;\n\t}, {});\n\tlet preservedCount = 0;\n\tfor (let match of matches) {\n\t\tlet id = match.route.id;\n\t\tif (!newLoaderData.hasOwnProperty(id) && loaderData.hasOwnProperty(id) && match.route.loader) {\n\t\t\tmergedLoaderData[id] = loaderData[id];\n\t\t\tpreservedCount++;\n\t\t}\n\t\tif (errors && errors.hasOwnProperty(id)) break;\n\t}\n\treturn Object.keys(newLoaderData).length === 0 && preservedCount === Object.keys(loaderData).length ? loaderData : mergedLoaderData;\n}\nfunction getActionDataForCommit(pendingActionResult) {\n\tif (!pendingActionResult) return {};\n\treturn isErrorResult(pendingActionResult[1]) ? { actionData: {} } : { actionData: { [pendingActionResult[0]]: pendingActionResult[1].data } };\n}\nfunction findNearestBoundary(matches, routeId) {\n\treturn (routeId ? matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1) : [...matches]).reverse().find((m) => m.route.ErrorBoundary != null || m.route.errorElement != null) || matches[0];\n}\nfunction getShortCircuitMatches(routes) {\n\tlet route = routes.length === 1 ? routes[0] : routes.find((r) => r.index || !r.path || r.path === \"/\") || { id: `__shim-error-route__` };\n\treturn {\n\t\tmatches: [{\n\t\t\tparams: {},\n\t\t\tpathname: \"\",\n\t\t\tpathnameBase: \"\",\n\t\t\troute\n\t\t}],\n\t\troute\n\t};\n}\nfunction getInternalRouterError(status, { pathname, routeId, method, type, message } = {}) {\n\tlet statusText = \"Unknown Server Error\";\n\tlet errorMessage = \"Unknown @remix-run/router error\";\n\tif (status === 400) {\n\t\tstatusText = \"Bad Request\";\n\t\tif (method && pathname && routeId) errorMessage = `You made a ${method} request to \"${pathname}\" but did not provide a \\`loader\\` for route \"${routeId}\", so there is no way to handle the request.`;\n\t\telse if (type === \"invalid-body\") errorMessage = \"Unable to encode submission body\";\n\t} else if (status === 403) {\n\t\tstatusText = \"Forbidden\";\n\t\terrorMessage = `Route \"${routeId}\" does not match URL \"${pathname}\"`;\n\t} else if (status === 404) {\n\t\tstatusText = \"Not Found\";\n\t\terrorMessage = `No route matches URL \"${pathname}\"`;\n\t} else if (status === 405) {\n\t\tstatusText = \"Method Not Allowed\";\n\t\tif (method && pathname && routeId) errorMessage = `You made a ${method.toUpperCase()} request to \"${pathname}\" but did not provide an \\`action\\` for route \"${routeId}\", so there is no way to handle the request.`;\n\t\telse if (method) errorMessage = `Invalid request method \"${method.toUpperCase()}\"`;\n\t}\n\treturn new ErrorResponseImpl(status || 500, statusText, new Error(errorMessage), true);\n}\nfunction findRedirect(results) {\n\tlet entries = Object.entries(results);\n\tfor (let i = entries.length - 1; i >= 0; i--) {\n\t\tlet [key, result] = entries[i];\n\t\tif (isRedirectResult(result)) return {\n\t\t\tkey,\n\t\t\tresult\n\t\t};\n\t}\n}\nfunction stripHashFromPath(path) {\n\treturn createPath({\n\t\t...typeof path === \"string\" ? parsePath(path) : path,\n\t\thash: \"\"\n\t});\n}\nfunction isHashChangeOnly(a, b) {\n\tif (a.pathname !== b.pathname || a.search !== b.search) return false;\n\tif (a.hash === \"\") return b.hash !== \"\";\n\telse if (a.hash === b.hash) return true;\n\telse if (b.hash !== \"\") return true;\n\treturn false;\n}\nfunction dataWithResponseInitToResponse(data) {\n\treturn Response.json(data.data, data.init ?? void 0);\n}\nfunction dataWithResponseInitToErrorResponse(data) {\n\treturn new ErrorResponseImpl(data.init?.status ?? 500, data.init?.statusText ?? \"Internal Server Error\", data.data);\n}\nfunction isDataStrategyResults(result) {\n\treturn result != null && typeof result === \"object\" && Object.entries(result).every(([key, value]) => typeof key === \"string\" && isDataStrategyResult(value));\n}\nfunction isDataStrategyResult(result) {\n\treturn result != null && typeof result === \"object\" && \"type\" in result && \"result\" in result && (result.type === \"data\" || result.type === \"error\");\n}\nfunction isRedirectDataStrategyResult(result) {\n\treturn isResponse(result.result) && redirectStatusCodes.has(result.result.status);\n}\nfunction isErrorResult(result) {\n\treturn result.type === \"error\";\n}\nfunction isRedirectResult(result) {\n\treturn (result && result.type) === \"redirect\";\n}\nfunction isDataWithResponseInit(value) {\n\treturn typeof value === \"object\" && value != null && \"type\" in value && \"data\" in value && \"init\" in value && value.type === \"DataWithResponseInit\";\n}\nfunction isResponse(value) {\n\treturn value != null && typeof value.status === \"number\" && typeof value.statusText === \"string\" && typeof value.headers === \"object\" && typeof value.body !== \"undefined\";\n}\nfunction isRedirectStatusCode(statusCode) {\n\treturn redirectStatusCodes.has(statusCode);\n}\nfunction isRedirectResponse(result) {\n\treturn isResponse(result) && isRedirectStatusCode(result.status) && result.headers.has(\"Location\");\n}\nfunction isValidMethod(method) {\n\treturn validRequestMethods.has(method.toUpperCase());\n}\nfunction isMutationMethod(method) {\n\treturn validMutationMethods.has(method.toUpperCase());\n}\nfunction hasNakedIndexQuery(search) {\n\treturn new URLSearchParams(search).getAll(\"index\").some((v) => v === \"\");\n}\nfunction getTargetMatch(matches, location) {\n\tlet search = typeof location === \"string\" ? parsePath(location).search : location.search;\n\tif (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || \"\")) return matches[matches.length - 1];\n\tlet pathMatches = getPathContributingMatches(matches);\n\treturn pathMatches[pathMatches.length - 1];\n}\nfunction getInstrumentationNavigateMeta(history, location, matches) {\n\treturn {\n\t\turl: createDataFunctionUrl(history.createURL(location), location),\n\t\tpattern: matches ? getRoutePattern(matches) : \"\",\n\t\tparams: matches?.[0]?.params ? { ...matches[0].params } : {}\n\t};\n}\nfunction getSubmissionFromNavigation(navigation) {\n\tlet { formMethod, formAction, formEncType, text, formData, json } = navigation;\n\tif (!formMethod || !formAction || !formEncType) return;\n\tif (text != null) return {\n\t\tformMethod,\n\t\tformAction,\n\t\tformEncType,\n\t\tformData: void 0,\n\t\tjson: void 0,\n\t\ttext\n\t};\n\telse if (formData != null) return {\n\t\tformMethod,\n\t\tformAction,\n\t\tformEncType,\n\t\tformData,\n\t\tjson: void 0,\n\t\ttext: void 0\n\t};\n\telse if (json !== void 0) return {\n\t\tformMethod,\n\t\tformAction,\n\t\tformEncType,\n\t\tformData: void 0,\n\t\tjson,\n\t\ttext: void 0\n\t};\n}\nfunction getLoadingNavigation(location, matches, historyAction, submission) {\n\tif (submission) return {\n\t\tstate: \"loading\",\n\t\tlocation,\n\t\tmatches,\n\t\thistoryAction,\n\t\tformMethod: submission.formMethod,\n\t\tformAction: submission.formAction,\n\t\tformEncType: submission.formEncType,\n\t\tformData: submission.formData,\n\t\tjson: submission.json,\n\t\ttext: submission.text\n\t};\n\telse return {\n\t\tstate: \"loading\",\n\t\tlocation,\n\t\tmatches,\n\t\thistoryAction,\n\t\tformMethod: void 0,\n\t\tformAction: void 0,\n\t\tformEncType: void 0,\n\t\tformData: void 0,\n\t\tjson: void 0,\n\t\ttext: void 0\n\t};\n}\nfunction getSubmittingNavigation(location, matches, historyAction, submission) {\n\treturn {\n\t\tstate: \"submitting\",\n\t\tlocation,\n\t\tmatches,\n\t\thistoryAction,\n\t\tformMethod: submission.formMethod,\n\t\tformAction: submission.formAction,\n\t\tformEncType: submission.formEncType,\n\t\tformData: submission.formData,\n\t\tjson: submission.json,\n\t\ttext: submission.text\n\t};\n}\nfunction getLoadingFetcher(submission, data) {\n\tif (submission) return {\n\t\tstate: \"loading\",\n\t\tformMethod: submission.formMethod,\n\t\tformAction: submission.formAction,\n\t\tformEncType: submission.formEncType,\n\t\tformData: submission.formData,\n\t\tjson: submission.json,\n\t\ttext: submission.text,\n\t\tdata\n\t};\n\telse return {\n\t\tstate: \"loading\",\n\t\tformMethod: void 0,\n\t\tformAction: void 0,\n\t\tformEncType: void 0,\n\t\tformData: void 0,\n\t\tjson: void 0,\n\t\ttext: void 0,\n\t\tdata\n\t};\n}\nfunction getSubmittingFetcher(submission, existingFetcher) {\n\treturn {\n\t\tstate: \"submitting\",\n\t\tformMethod: submission.formMethod,\n\t\tformAction: submission.formAction,\n\t\tformEncType: submission.formEncType,\n\t\tformData: submission.formData,\n\t\tjson: submission.json,\n\t\ttext: submission.text,\n\t\tdata: existingFetcher ? existingFetcher.data : void 0\n\t};\n}\nfunction getDoneFetcher(data) {\n\treturn {\n\t\tstate: \"idle\",\n\t\tformMethod: void 0,\n\t\tformAction: void 0,\n\t\tformEncType: void 0,\n\t\tformData: void 0,\n\t\tjson: void 0,\n\t\ttext: void 0,\n\t\tdata\n\t};\n}\nfunction restoreAppliedTransitions(_window, transitions) {\n\ttry {\n\t\tlet sessionPositions = _window.sessionStorage.getItem(TRANSITIONS_STORAGE_KEY);\n\t\tif (sessionPositions) {\n\t\t\tlet json = JSON.parse(sessionPositions);\n\t\t\tfor (let [k, v] of Object.entries(json || {})) if (v && Array.isArray(v)) transitions.set(k, new Set(v || []));\n\t\t}\n\t} catch {}\n}\nfunction persistAppliedTransitions(_window, transitions) {\n\tif (transitions.size > 0) {\n\t\tlet json = {};\n\t\tfor (let [k, v] of transitions) json[k] = [...v];\n\t\ttry {\n\t\t\t_window.sessionStorage.setItem(TRANSITIONS_STORAGE_KEY, JSON.stringify(json));\n\t\t} catch (error) {\n\t\t\twarning(false, `Failed to save applied view transitions in sessionStorage (${error}).`);\n\t\t}\n\t}\n}\nfunction createDeferred() {\n\tlet resolve;\n\tlet reject;\n\tlet promise = new Promise((res, rej) => {\n\t\tresolve = async (val) => {\n\t\t\tres(val);\n\t\t\ttry {\n\t\t\t\tawait promise;\n\t\t\t} catch {}\n\t\t};\n\t\treject = async (error) => {\n\t\t\trej(error);\n\t\t\ttry {\n\t\t\t\tawait promise;\n\t\t\t} catch {}\n\t\t};\n\t});\n\treturn {\n\t\tpromise,\n\t\tresolve,\n\t\treject\n\t};\n}\n//#endregion\nexport { IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, createDataRouteMatcher, createRouter, createStaticHandler, getStaticContextFromError, hasInvalidProtocol, isDataWithResponseInit, isMutationMethod, isRedirectResponse, isRedirectStatusCode, isResponse };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React$1 from \"react\";\n//#region lib/context.ts\nconst DataRouterContext = React$1.createContext(null);\nDataRouterContext.displayName = \"DataRouter\";\nconst DataRouterStateContext = React$1.createContext(null);\nDataRouterStateContext.displayName = \"DataRouterState\";\nconst DataRouterDataContext = React$1.createContext(null);\nDataRouterDataContext.displayName = \"DataRouterData\";\nconst DataRouterNavigationContext = React$1.createContext(null);\nDataRouterNavigationContext.displayName = \"DataRouterNavigation\";\nconst RSCRouterContext = React$1.createContext(false);\nfunction useIsRSCRouterContext() {\n\treturn React$1.useContext(RSCRouterContext);\n}\nconst ViewTransitionContext = React$1.createContext({ isTransitioning: false });\nViewTransitionContext.displayName = \"ViewTransition\";\nconst FetchersContext = React$1.createContext(null);\nFetchersContext.displayName = \"Fetchers\";\nconst AwaitContext = React$1.createContext(null);\nAwaitContext.displayName = \"Await\";\nconst AwaitContextProvider = (props) => React$1.createElement(AwaitContext.Provider, props);\nconst NavigationContext = React$1.createContext(null);\nNavigationContext.displayName = \"Navigation\";\nconst LocationContext = React$1.createContext(null);\nLocationContext.displayName = \"Location\";\nconst RouteContext = React$1.createContext({\n\toutlet: null,\n\tmatches: [],\n\tisDataRoute: false\n});\nRouteContext.displayName = \"Route\";\nconst IsDataRouteContext = React$1.createContext(false);\nIsDataRouteContext.displayName = \"IsDataRoute\";\nconst RouteIdContext = React$1.createContext(void 0);\nRouteIdContext.displayName = \"RouteId\";\nconst RouteErrorContext = React$1.createContext(null);\nRouteErrorContext.displayName = \"RouteError\";\n//#endregion\nexport { AwaitContext, AwaitContextProvider, DataRouterContext, DataRouterDataContext, DataRouterNavigationContext, DataRouterStateContext, FetchersContext, IsDataRouteContext, LocationContext, NavigationContext, RSCRouterContext, RouteContext, RouteErrorContext, RouteIdContext, ViewTransitionContext, useIsRSCRouterContext };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { ErrorResponseImpl } from \"./router/utils.js\";\n//#region lib/errors.ts\nconst ERROR_DIGEST_BASE = \"REACT_ROUTER_ERROR\";\nconst ERROR_DIGEST_REDIRECT = \"REDIRECT\";\nconst ERROR_DIGEST_ROUTE_ERROR_RESPONSE = \"ROUTE_ERROR_RESPONSE\";\nfunction decodeRedirectErrorDigest(digest) {\n\tif (digest.startsWith(`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:{`)) try {\n\t\tlet parsed = JSON.parse(digest.slice(28));\n\t\tif (typeof parsed === \"object\" && parsed && typeof parsed.status === \"number\" && typeof parsed.statusText === \"string\" && typeof parsed.location === \"string\" && typeof parsed.reloadDocument === \"boolean\" && typeof parsed.replace === \"boolean\") return parsed;\n\t} catch {}\n}\nfunction decodeRouteErrorResponseDigest(digest) {\n\tif (digest.startsWith(`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:{`)) try {\n\t\tlet parsed = JSON.parse(digest.slice(40));\n\t\tif (typeof parsed === \"object\" && parsed && typeof parsed.status === \"number\" && typeof parsed.statusText === \"string\") return new ErrorResponseImpl(parsed.status, parsed.statusText, parsed.data);\n\t} catch {}\n}\n//#endregion\nexport { decodeRedirectErrorDigest, decodeRouteErrorResponseDigest };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { createPath, invariant, parsePath, warning } from \"./router/history.js\";\nimport { convertRouteMatchToUiMatch, decodePath, getResolveToMatches, getRoutePattern, isBrowser, isRouteErrorResponse, joinPaths, matchPath, matchRoutes, parseToInfo, resolveTo, stripBasename } from \"./router/utils.js\";\nimport { getNavigatorCurrentUrl, validateNavigationTarget } from \"./router/navigation.js\";\nimport { IDLE_BLOCKER, hasInvalidProtocol } from \"./router/router.js\";\nimport { AwaitContext, DataRouterContext, DataRouterDataContext, DataRouterNavigationContext, DataRouterStateContext, FetchersContext, IsDataRouteContext, LocationContext, NavigationContext, RSCRouterContext, RouteContext, RouteErrorContext, RouteIdContext } from \"./context.js\";\nimport { decodeRedirectErrorDigest, decodeRouteErrorResponseDigest } from \"./errors.js\";\nimport * as React$1 from \"react\";\n//#region lib/hooks.tsx\n/**\n* Resolves a URL against the current {@link Location}.\n*\n* @example\n* import { useHref } from \"react-router\";\n*\n* function SomeComponent() {\n* let href = useHref(\"some/where\");\n* // \"/resolved/some/where\"\n* }\n*\n* @public\n* @category Hooks\n* @param to The path to resolve\n* @param options Options\n* @param options.relative Defaults to `\"route\"` so routing is relative to the\n* route tree.\n* Set to `\"path\"` to make relative routing operate against path segments.\n* @returns The resolved href string\n*/\nfunction useHref(to, { relative } = {}) {\n\tinvariant(useInRouterContext(), `useHref() may be used only in the context of a <Router> component.`);\n\tlet { basename, navigator } = React$1.useContext(NavigationContext);\n\tlet { hash, pathname, search } = useResolvedPath(to, { relative });\n\tlet joinedPathname = pathname;\n\tif (basename !== \"/\") joinedPathname = pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n\treturn navigator.createHref({\n\t\tpathname: joinedPathname,\n\t\tsearch,\n\t\thash\n\t});\n}\n/**\n* Returns `true` if this component is a descendant of a {@link Router}, useful\n* to ensure a component is used within a {@link Router}.\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns Whether the component is within a {@link Router} context\n*/\nfunction useInRouterContext() {\n\treturn React$1.useContext(LocationContext) != null;\n}\n/**\n* Returns the current {@link Location}. This can be useful if you'd like to\n* perform some side effect whenever it changes.\n*\n* @example\n* import * as React from 'react'\n* import { useLocation } from 'react-router'\n*\n* function SomeComponent() {\n* let location = useLocation()\n*\n* React.useEffect(() => {\n* // Google Analytics\n* ga('send', 'pageview')\n* }, [location]);\n*\n* return (\n* // ...\n* );\n* }\n*\n* @public\n* @category Hooks\n* @returns The current {@link Location} object\n*/\nfunction useLocation() {\n\tinvariant(useInRouterContext(), `useLocation() may be used only in the context of a <Router> component.`);\n\treturn React$1.useContext(LocationContext).location;\n}\n/**\n* Returns the current {@link Navigation} action which describes how the router\n* came to the current {@link Location}, either by a pop, push, or replace on\n* the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) stack.\n*\n* @public\n* @category Hooks\n* @returns The current {@link NavigationType} (`\"POP\"`, `\"PUSH\"`, or `\"REPLACE\"`)\n*/\nfunction useNavigationType() {\n\treturn React$1.useContext(LocationContext).navigationType;\n}\n/**\n* Returns a {@link PathMatch} object if the given pattern matches the current URL.\n* This is useful for components that need to know \"active\" state, e.g.\n* {@link NavLink | `<NavLink>`}.\n*\n* @public\n* @category Hooks\n* @param pattern The pattern to match against the current {@link Location}\n* @returns The path match object if the pattern matches, `null` otherwise\n*/\nfunction useMatch(pattern) {\n\tinvariant(useInRouterContext(), `useMatch() may be used only in the context of a <Router> component.`);\n\tlet { pathname } = useLocation();\n\treturn React$1.useMemo(() => matchPath(pattern, decodePath(pathname)), [pathname, pattern]);\n}\nconst navigateEffectWarning = \"You should call navigate() in a React.useEffect(), not when your component is first rendered.\";\n/**\n* Returns a function that lets you navigate programmatically in the browser in\n* response to user interactions or effects.\n*\n* It's often better to use {@link redirect} in [`action`](../../start/framework/route-module#action)/[`loader`](../../start/framework/route-module#loader)\n* functions than this hook.\n*\n* The returned function signature is `navigate(to, options?)`/`navigate(delta)` where:\n*\n* * `to` can be a string path, a {@link To} object, or a number (delta)\n* * `options` contains options for modifying the navigation\n* * These options work in all modes (Framework, Data, and Declarative):\n* * `relative`: `\"route\"` or `\"path\"` to control relative routing logic\n* * `replace`: Replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History) stack\n* * `state`: Optional [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state) to include with the new {@link Location}\n* * These options only work in Framework and Data modes:\n* * `flushSync`: Wrap the DOM updates in [`ReactDom.flushSync`](https://react.dev/reference/react-dom/flushSync)\n* * `preventScrollReset`: Do not scroll back to the top of the page after navigation\n* * `viewTransition`: Enable [`document.startViewTransition`](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for this navigation\n*\n* @example\n* import { useNavigate } from \"react-router\";\n*\n* function SomeComponent() {\n* let navigate = useNavigate();\n* return (\n* <button onClick={() => navigate(-1)}>\n* Go Back\n* </button>\n* );\n* }\n*\n* @additionalExamples\n* ### Navigate to another path\n*\n* ```tsx\n* navigate(\"/some/route\");\n* navigate(\"/some/route?search=param\");\n* ```\n*\n* ### Navigate with a {@link To} object\n*\n* All properties are optional.\n*\n* ```tsx\n* navigate(\n* {\n* pathname: \"/some/route\",\n* search: \"?search=param\",\n* hash: \"#hash\",\n* },\n* {\n* state: { some: \"state\" },\n* },\n* );\n* ```\n*\n* If you use `state`, that will be available on the {@link Location} object on\n* the next page. Access it with `useLocation().state` (see {@link useLocation}).\n*\n* ### Navigate back or forward in the history stack\n*\n* ```tsx\n* // back\n* // often used to close modals\n* navigate(-1);\n*\n* // forward\n* // often used in a multistep wizard workflows\n* navigate(1);\n* ```\n*\n* Be cautious with `navigate(number)`. If your application can load up to a\n* route that has a button that tries to navigate forward/back, there may not be\n* a [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)\n* entry to go back or forward to, or it can go somewhere you don't expect\n* (like a different domain).\n*\n* Only use this if you're sure they will have an entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)\n* stack to navigate to.\n*\n* ### Replace the current entry in the history stack\n*\n* This will remove the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)\n* stack, replacing it with a new one, similar to a server side redirect.\n*\n* ```tsx\n* navigate(\"/some/route\", { replace: true });\n* ```\n*\n* ### Prevent Scroll Reset\n*\n* [MODES: framework, data]\n*\n* <br/>\n* <br/>\n*\n* To prevent {@link ScrollRestoration | `<ScrollRestoration>`} from resetting\n* the scroll position, use the `preventScrollReset` option.\n*\n* ```tsx\n* navigate(\"?some-tab=1\", { preventScrollReset: true });\n* ```\n*\n* For example, if you have a tab interface connected to search params in the\n* middle of a page, and you don't want it to scroll to the top when a tab is\n* clicked.\n*\n* ### Return Type Augmentation\n*\n* Internally, `useNavigate` uses a separate implementation when you are in\n* Declarative mode versus Data/Framework mode - the primary difference being\n* that the latter is able to return a stable reference that does not change\n* identity across navigations. The implementation in Data/Framework mode also\n* returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)\n* that resolves when the navigation is completed. This means the return type of\n* `useNavigate` is `void | Promise<void>`. This is accurate, but can lead to\n* some red squigglies based on the union in the return value:\n*\n* - If you're using `typescript-eslint`, you may see errors from\n* [`@typescript-eslint/no-floating-promises`](https://typescript-eslint.io/rules/no-floating-promises)\n* - In Framework/Data mode, `React.use(navigate())` will show a false-positive\n* `Argument of type 'void | Promise<void>' is not assignable to parameter of\n* type 'Usable<void>'` error\n*\n* The easiest way to work around these issues is to augment the type based on the\n* router you're using:\n*\n* ```ts\n* // If using <BrowserRouter>\n* declare module \"react-router\" {\n* interface NavigateFunction {\n* (to: To, options?: NavigateOptions): void;\n* (delta: number): void;\n* }\n* }\n*\n* // If using <RouterProvider> or Framework mode\n* declare module \"react-router\" {\n* interface NavigateFunction {\n* (to: To, options?: NavigateOptions): Promise<void>;\n* (delta: number): Promise<void>;\n* }\n* }\n* ```\n*\n* @public\n* @category Hooks\n* @returns A navigate function for programmatic navigation\n*/\nfunction useNavigate() {\n\treturn React$1.useContext(IsDataRouteContext) ? useNavigateStable() : useNavigateUnstable();\n}\nfunction useNavigateUnstable() {\n\tinvariant(useInRouterContext(), `useNavigate() may be used only in the context of a <Router> component.`);\n\tlet dataRouterContext = React$1.useContext(DataRouterContext);\n\tlet { basename, navigator } = React$1.useContext(NavigationContext);\n\tlet { matches } = React$1.useContext(RouteContext);\n\tlet { pathname: locationPathname } = useLocation();\n\tlet routePathnamesJson = JSON.stringify(getResolveToMatches(matches));\n\tlet activeRef = React$1.useRef(false);\n\tReact$1.useLayoutEffect(() => {\n\t\tactiveRef.current = true;\n\t});\n\treturn React$1.useCallback((to, options = {}) => {\n\t\twarning(activeRef.current, navigateEffectWarning);\n\t\tif (!activeRef.current) return;\n\t\tif (typeof to === \"number\") {\n\t\t\tnavigator.go(to);\n\t\t\treturn;\n\t\t}\n\t\tlet path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === \"path\");\n\t\tif (dataRouterContext == null && basename !== \"/\") path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n\t\tvalidateNavigationTarget(typeof to === \"string\" ? to : createPath(to), navigator.createHref(path), getNavigatorCurrentUrl(navigator), \"reject\");\n\t\t(!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);\n\t}, [\n\t\tbasename,\n\t\tnavigator,\n\t\troutePathnamesJson,\n\t\tlocationPathname,\n\t\tdataRouterContext\n\t]);\n}\nconst OutletContext = React$1.createContext(null);\n/**\n* Returns the parent route {@link Outlet | `<Outlet context>`}.\n*\n* Often parent routes manage state or other values you want shared with child\n* routes. You can create your own [context provider](https://react.dev/learn/passing-data-deeply-with-context)\n* if you like, but this is such a common situation that it's built-into\n* {@link Outlet | `<Outlet>`}.\n*\n* ```tsx\n* // Parent route\n* function Parent() {\n* const [count, setCount] = React.useState(0);\n* return <Outlet context={[count, setCount]} />;\n* }\n* ```\n*\n* ```tsx\n* // Child route\n* import { useOutletContext } from \"react-router\";\n*\n* function Child() {\n* const [count, setCount] = useOutletContext();\n* const increment = () => setCount((c) => c + 1);\n* return <button onClick={increment}>{count}</button>;\n* }\n* ```\n*\n* If you're using TypeScript, we recommend the parent component provide a\n* custom hook for accessing the context value. This makes it easier for\n* consumers to get nice typings, control consumers, and know who's consuming\n* the context value.\n*\n* Here's a more realistic example:\n*\n* ```tsx filename=src/routes/dashboard.tsx lines=[14,20]\n* import { useState } from \"react\";\n* import { Outlet, useOutletContext } from \"react-router\";\n*\n* import type { User } from \"./types\";\n*\n* type ContextType = { user: User | null };\n*\n* export default function Dashboard() {\n* const [user, setUser] = useState<User | null>(null);\n*\n* return (\n* <div>\n* <h1>Dashboard</h1>\n* <Outlet context={{ user } satisfies ContextType} />\n* </div>\n* );\n* }\n*\n* export function useUser() {\n* return useOutletContext<ContextType>();\n* }\n* ```\n*\n* ```tsx filename=src/routes/dashboard/messages.tsx lines=[1,4]\n* import { useUser } from \"../dashboard\";\n*\n* export default function DashboardMessages() {\n* const { user } = useUser();\n* return (\n* <div>\n* <h2>Messages</h2>\n* <p>Hello, {user.name}!</p>\n* </div>\n* );\n* }\n* ```\n*\n* @public\n* @category Hooks\n* @returns The context value passed to the parent {@link Outlet} component\n*/\nfunction useOutletContext() {\n\treturn React$1.useContext(OutletContext);\n}\n/**\n* Returns the element for the child route at this level of the route\n* hierarchy. Used internally by {@link Outlet | `<Outlet>`} to render child\n* routes.\n*\n* @public\n* @category Hooks\n* @param context The context to pass to the outlet\n* @returns The child route element or `null` if no child routes match\n*/\nfunction useOutlet(context) {\n\tlet outlet = React$1.useContext(RouteContext).outlet;\n\treturn React$1.useMemo(() => outlet && /* @__PURE__ */ React$1.createElement(OutletContext.Provider, { value: context }, outlet), [outlet, context]);\n}\n/**\n* Returns an object of key/value-pairs of the dynamic params from the current\n* URL that were matched by the routes. Child routes inherit all params from\n* their parent routes.\n*\n* Assuming a route pattern like `/posts/:postId` is matched by `/posts/123`\n* then `params.postId` will be `\"123\"`.\n*\n* @example\n* import { useParams } from \"react-router\";\n*\n* function SomeComponent() {\n* let params = useParams();\n* params.postId;\n* }\n*\n* @additionalExamples\n* ### Basic Usage\n*\n* ```tsx\n* import { useParams } from \"react-router\";\n*\n* // given a route like:\n* <Route path=\"/posts/:postId\" element={<Post />} />;\n*\n* // or a data route like:\n* createBrowserRouter([\n* {\n* path: \"/posts/:postId\",\n* component: Post,\n* },\n* ]);\n*\n* // or in routes.ts\n* route(\"/posts/:postId\", \"routes/post.tsx\");\n* ```\n*\n* Access the params in a component:\n*\n* ```tsx\n* import { useParams } from \"react-router\";\n*\n* export default function Post() {\n* let params = useParams();\n* return <h1>Post: {params.postId}</h1>;\n* }\n* ```\n*\n* ### Multiple Params\n*\n* Patterns can have multiple params:\n*\n* ```tsx\n* \"/posts/:postId/comments/:commentId\";\n* ```\n*\n* All will be available in the params object:\n*\n* ```tsx\n* import { useParams } from \"react-router\";\n*\n* export default function Post() {\n* let params = useParams();\n* return (\n* <h1>\n* Post: {params.postId}, Comment: {params.commentId}\n* </h1>\n* );\n* }\n* ```\n*\n* ### Catchall Params\n*\n* Catchall params are defined with `*`:\n*\n* ```tsx\n* \"/files/*\";\n* ```\n*\n* The matched value will be available in the params object as follows:\n*\n* ```tsx\n* import { useParams } from \"react-router\";\n*\n* export default function File() {\n* let params = useParams();\n* let catchall = params[\"*\"];\n* // ...\n* }\n* ```\n*\n* You can destructure the catchall param:\n*\n* ```tsx\n* export default function File() {\n* let { \"*\": catchall } = useParams();\n* console.log(catchall);\n* }\n* ```\n*\n* @public\n* @category Hooks\n* @returns An object containing the dynamic route parameters\n*/\nfunction useParams() {\n\tlet { matches } = React$1.useContext(RouteContext);\n\treturn matches[matches.length - 1]?.params ?? {};\n}\n/**\n* Resolves the pathname of the given `to` value against the current\n* {@link Location}. Similar to {@link useHref}, but returns a\n* {@link Path} instead of a string.\n*\n* @example\n* import { useResolvedPath } from \"react-router\";\n*\n* function SomeComponent() {\n* // if the user is at /dashboard/profile\n* let path = useResolvedPath(\"../accounts\");\n* path.pathname; // \"/dashboard/accounts\"\n* path.search; // \"\"\n* path.hash; // \"\"\n* }\n*\n* @public\n* @category Hooks\n* @param to The path to resolve\n* @param options Options\n* @param options.relative Defaults to `\"route\"` so routing is relative to the route tree.\n* Set to `\"path\"` to make relative routing operate against path segments.\n* @returns The resolved {@link Path} object with `pathname`, `search`, and `hash`\n*/\nfunction useResolvedPath(to, { relative } = {}) {\n\tlet { matches } = React$1.useContext(RouteContext);\n\tlet { pathname: locationPathname } = useLocation();\n\tlet routePathnamesJson = JSON.stringify(getResolveToMatches(matches));\n\treturn React$1.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === \"path\"), [\n\t\tto,\n\t\troutePathnamesJson,\n\t\tlocationPathname,\n\t\trelative\n\t]);\n}\n/**\n* Hook version of {@link Routes | `<Routes>`} that uses objects instead of\n* components. These objects have the same properties as the component props.\n* The return value of `useRoutes` is either a valid React element you can use\n* to render the route tree, or `null` if nothing matched.\n*\n* @example\n* import { useRoutes } from \"react-router\";\n*\n* function App() {\n* let element = useRoutes([\n* {\n* path: \"/\",\n* element: <Dashboard />,\n* children: [\n* {\n* path: \"messages\",\n* element: <DashboardMessages />,\n* },\n* { path: \"tasks\", element: <DashboardTasks /> },\n* ],\n* },\n* { path: \"team\", element: <AboutPage /> },\n* ]);\n*\n* return element;\n* }\n*\n* @public\n* @category Hooks\n* @param routes An array of {@link RouteObject}s that define the route hierarchy\n* @param locationArg An optional {@link Location} object or pathname string to\n* use instead of the current {@link Location}\n* @returns A React element to render the matched route, or `null` if no routes matched\n*/\nfunction useRoutes(routes, locationArg) {\n\treturn useRoutesImpl(routes, locationArg);\n}\nfunction useRoutesImpl(routes, locationArg, dataRouterOpts) {\n\tinvariant(useInRouterContext(), `useRoutes() may be used only in the context of a <Router> component.`);\n\tlet { navigator } = React$1.useContext(NavigationContext);\n\tlet { matches: parentMatches } = React$1.useContext(RouteContext);\n\tlet routeMatch = parentMatches[parentMatches.length - 1];\n\tlet parentParams = routeMatch ? routeMatch.params : {};\n\trouteMatch && routeMatch.pathname;\n\tlet parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n\trouteMatch && routeMatch.route;\n\tlet locationFromContext = useLocation();\n\tlet location;\n\tif (locationArg) {\n\t\tlet parsedLocationArg = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n\t\tinvariant(parentPathnameBase === \"/\" || parsedLocationArg.pathname?.startsWith(parentPathnameBase), `When overriding the location using \\`<Routes location>\\` or \\`useRoutes(routes, location)\\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is \"${parentPathnameBase}\" but pathname \"${parsedLocationArg.pathname}\" was given in the \\`location\\` prop.`);\n\t\tlocation = parsedLocationArg;\n\t} else location = locationFromContext;\n\tlet pathname = location.pathname || \"/\";\n\tlet remainingPathname = pathname;\n\tif (parentPathnameBase !== \"/\") {\n\t\tlet parentSegments = parentPathnameBase.replace(/^\\//, \"\").split(\"/\");\n\t\tremainingPathname = \"/\" + pathname.replace(/^\\//, \"\").split(\"/\").slice(parentSegments.length).join(\"/\");\n\t}\n\tlet matches;\n\tif (dataRouterOpts) if (dataRouterOpts.state.matches.length) matches = dataRouterOpts.state.matches.map((m) => Object.assign(m, { route: dataRouterOpts.manifest[m.route.id] || m.route }));\n\telse matches = dataRouterOpts.router.match(dataRouterOpts.state.location);\n\telse matches = matchRoutes(routes, { pathname: remainingPathname });\n\tlet renderedMatches = _renderMatches(matches && matches.map((match) => Object.assign({}, match, {\n\t\tparams: Object.assign({}, parentParams, match.params),\n\t\tpathname: joinPaths([parentPathnameBase, navigator.encodeLocation ? navigator.encodeLocation(match.pathname.replace(/%/g, \"%25\").replace(/\\?/g, \"%3F\").replace(/#/g, \"%23\")).pathname : match.pathname]),\n\t\tpathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase, navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase.replace(/%/g, \"%25\").replace(/\\?/g, \"%3F\").replace(/#/g, \"%23\")).pathname : match.pathnameBase])\n\t})), parentMatches, dataRouterOpts);\n\tif (locationArg && renderedMatches) return /* @__PURE__ */ React$1.createElement(LocationContext.Provider, { value: {\n\t\tlocation: {\n\t\t\tpathname: \"/\",\n\t\t\tsearch: \"\",\n\t\t\thash: \"\",\n\t\t\tstate: null,\n\t\t\tkey: \"default\",\n\t\t\tmask: void 0,\n\t\t\t...location\n\t\t},\n\t\tnavigationType: \"POP\"\n\t} }, renderedMatches);\n\treturn renderedMatches;\n}\nfunction DefaultErrorComponent() {\n\tlet error = useRouteError();\n\tlet message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);\n\tlet stack = error instanceof Error ? error.stack : null;\n\treturn /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement(\"h2\", null, \"Unexpected Application Error!\"), /* @__PURE__ */ React$1.createElement(\"h3\", { style: { fontStyle: \"italic\" } }, message), stack ? /* @__PURE__ */ React$1.createElement(\"pre\", { style: {\n\t\tpadding: \"0.5rem\",\n\t\tbackgroundColor: \"rgba(200,200,200, 0.5)\"\n\t} }, stack) : null, null);\n}\nconst defaultErrorElement = /* @__PURE__ */ React$1.createElement(DefaultErrorComponent, null);\nvar RenderErrorBoundary = class extends React$1.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tlocation: props.location,\n\t\t\trevalidation: props.revalidation,\n\t\t\terror: props.error\n\t\t};\n\t}\n\tstatic contextType = RSCRouterContext;\n\tstatic getDerivedStateFromError(error) {\n\t\treturn { error };\n\t}\n\tstatic getDerivedStateFromProps(props, state) {\n\t\tif (state.location !== props.location || state.revalidation !== \"idle\" && props.revalidation === \"idle\") return {\n\t\t\terror: props.error,\n\t\t\tlocation: props.location,\n\t\t\trevalidation: props.revalidation\n\t\t};\n\t\treturn {\n\t\t\terror: props.error !== void 0 ? props.error : state.error,\n\t\t\tlocation: state.location,\n\t\t\trevalidation: props.revalidation || state.revalidation\n\t\t};\n\t}\n\tcomponentDidCatch(error, errorInfo) {\n\t\tif (this.props.onError) this.props.onError(error, errorInfo);\n\t\telse console.error(\"React Router caught the following error during render\", error);\n\t}\n\trender() {\n\t\tlet error = this.state.error;\n\t\tif (this.context && typeof error === \"object\" && error && \"digest\" in error && typeof error.digest === \"string\") {\n\t\t\tconst decoded = decodeRouteErrorResponseDigest(error.digest);\n\t\t\tif (decoded) error = decoded;\n\t\t}\n\t\tlet result = error !== void 0 ? /* @__PURE__ */ React$1.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React$1.createElement(IsDataRouteContext.Provider, { value: this.props.routeContext.isDataRoute }, /* @__PURE__ */ React$1.createElement(RouteIdContext.Provider, { value: this.props.routeContext.matches[this.props.routeContext.matches.length - 1]?.route.id }, /* @__PURE__ */ React$1.createElement(RouteErrorContext.Provider, {\n\t\t\tvalue: error,\n\t\t\tchildren: this.props.component\n\t\t})))) : this.props.children;\n\t\tif (this.context) return /* @__PURE__ */ React$1.createElement(RSCErrorHandler, { error }, result);\n\t\treturn result;\n\t}\n};\nconst errorRedirectHandledMap = /* @__PURE__ */ new WeakMap();\nfunction RSCErrorHandler({ children, error }) {\n\tlet { basename, navigator } = React$1.useContext(NavigationContext);\n\tif (typeof error === \"object\" && error && \"digest\" in error && typeof error.digest === \"string\") {\n\t\tlet redirect = decodeRedirectErrorDigest(error.digest);\n\t\tif (redirect) {\n\t\t\tlet existingRedirect = errorRedirectHandledMap.get(error);\n\t\t\tif (existingRedirect) throw existingRedirect;\n\t\t\tlet parsed = parseToInfo(redirect.location, basename);\n\t\t\tlet target = parsed.absoluteURL || parsed.to;\n\t\t\tvalidateNavigationTarget(redirect.location, target, getNavigatorCurrentUrl(navigator), \"allow-explicit\");\n\t\t\tif (hasInvalidProtocol(target)) throw new Error(\"Invalid redirect location\");\n\t\t\tif (isBrowser && !errorRedirectHandledMap.get(error)) if (parsed.isExternal || redirect.reloadDocument) window.location.href = target;\n\t\t\telse {\n\t\t\t\tconst redirectPromise = Promise.resolve().then(() => window.__reactRouterDataRouter.navigate(parsed.to, { replace: redirect.replace }));\n\t\t\t\terrorRedirectHandledMap.set(error, redirectPromise);\n\t\t\t\tthrow redirectPromise;\n\t\t\t}\n\t\t\treturn /* @__PURE__ */ React$1.createElement(\"meta\", {\n\t\t\t\thttpEquiv: \"refresh\",\n\t\t\t\tcontent: `0;url=${target}`\n\t\t\t});\n\t\t}\n\t}\n\treturn children;\n}\nfunction RenderedRoute({ routeContext, match, children }) {\n\tlet dataRouterContext = React$1.useContext(DataRouterContext);\n\tif (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n\treturn /* @__PURE__ */ React$1.createElement(RouteContext.Provider, { value: routeContext }, /* @__PURE__ */ React$1.createElement(IsDataRouteContext.Provider, { value: routeContext.isDataRoute }, /* @__PURE__ */ React$1.createElement(RouteIdContext.Provider, { value: match.route.id }, children)));\n}\nfunction _renderMatches(matches, parentMatches = [], dataRouterOpts) {\n\tlet dataRouterState = dataRouterOpts?.state;\n\tif (matches == null) {\n\t\tif (!dataRouterState) return null;\n\t\tif (dataRouterState.errors) matches = dataRouterState.matches;\n\t\telse if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) matches = dataRouterState.matches;\n\t\telse return null;\n\t}\n\tlet renderedMatches = matches;\n\tlet errors = dataRouterState?.errors;\n\tif (errors != null) {\n\t\tlet errorIndex = renderedMatches.findIndex((m) => m.route.id && errors?.[m.route.id] !== void 0);\n\t\tinvariant(errorIndex >= 0, `Could not find a matching route for errors on route IDs: ${Object.keys(errors).join(\",\")}`);\n\t\trenderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));\n\t}\n\tlet renderFallback = false;\n\tlet fallbackIndex = -1;\n\tif (dataRouterOpts && dataRouterState) {\n\t\trenderFallback = dataRouterState.renderFallback;\n\t\tfor (let i = 0; i < renderedMatches.length; i++) {\n\t\t\tlet match = renderedMatches[i];\n\t\t\tif (match.route.HydrateFallback || match.route.hydrateFallbackElement) fallbackIndex = i;\n\t\t\tif (match.route.id) {\n\t\t\t\tlet { loaderData, errors } = dataRouterState;\n\t\t\t\tlet needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors || errors[match.route.id] === void 0);\n\t\t\t\tif (match.route.lazy || needsToRunLoader) {\n\t\t\t\t\tif (dataRouterOpts.isStatic) renderFallback = true;\n\t\t\t\t\tif (fallbackIndex >= 0) renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);\n\t\t\t\t\telse renderedMatches = [renderedMatches[0]];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tlet onErrorHandler = dataRouterOpts?.onError;\n\tlet onError = dataRouterState && onErrorHandler ? (error, errorInfo) => {\n\t\tonErrorHandler(error, {\n\t\t\tlocation: dataRouterState.location,\n\t\t\tparams: dataRouterState.matches?.[0]?.params ?? {},\n\t\t\tpattern: getRoutePattern(dataRouterState.matches),\n\t\t\terrorInfo\n\t\t});\n\t} : void 0;\n\treturn renderedMatches.reduceRight((outlet, match, index) => {\n\t\tlet error;\n\t\tlet shouldRenderHydrateFallback = false;\n\t\tlet errorElement = null;\n\t\tlet hydrateFallbackElement = null;\n\t\tif (dataRouterState) {\n\t\t\terror = errors && match.route.id ? errors[match.route.id] : void 0;\n\t\t\terrorElement = match.route.errorElement || defaultErrorElement;\n\t\t\tif (renderFallback) {\n\t\t\t\tif (fallbackIndex < 0 && index === 0) {\n\t\t\t\t\twarningOnce(\"route-fallback\", false, \"No `HydrateFallback` element provided to render during initial hydration\");\n\t\t\t\t\tshouldRenderHydrateFallback = true;\n\t\t\t\t\thydrateFallbackElement = null;\n\t\t\t\t} else if (fallbackIndex === index) {\n\t\t\t\t\tshouldRenderHydrateFallback = true;\n\t\t\t\t\thydrateFallbackElement = match.route.hydrateFallbackElement || null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlet matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n\t\tlet getChildren = () => {\n\t\t\tlet children;\n\t\t\tif (error) children = errorElement;\n\t\t\telse if (shouldRenderHydrateFallback) children = hydrateFallbackElement;\n\t\t\telse if (match.route.Component) children = /* @__PURE__ */ React$1.createElement(match.route.Component, null);\n\t\t\telse if (match.route.element) children = match.route.element;\n\t\t\telse children = outlet;\n\t\t\treturn /* @__PURE__ */ React$1.createElement(RenderedRoute, {\n\t\t\t\tmatch,\n\t\t\t\trouteContext: {\n\t\t\t\t\toutlet,\n\t\t\t\t\tmatches,\n\t\t\t\t\tisDataRoute: dataRouterState != null\n\t\t\t\t},\n\t\t\t\tchildren\n\t\t\t});\n\t\t};\n\t\treturn dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React$1.createElement(RenderErrorBoundary, {\n\t\t\tlocation: dataRouterState.location,\n\t\t\trevalidation: dataRouterState.revalidation,\n\t\t\tcomponent: errorElement,\n\t\t\terror,\n\t\t\tchildren: getChildren(),\n\t\t\trouteContext: {\n\t\t\t\toutlet: null,\n\t\t\t\tmatches,\n\t\t\t\tisDataRoute: true\n\t\t\t},\n\t\t\tonError\n\t\t}) : getChildren();\n\t}, null);\n}\nfunction getDataRouterConsoleError(hookName) {\n\treturn `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;\n}\nfunction useDataRouterContext(hookName) {\n\tlet ctx = React$1.useContext(DataRouterContext);\n\tinvariant(ctx, getDataRouterConsoleError(hookName));\n\treturn ctx;\n}\nfunction useDataRouterState(hookName) {\n\tlet state = React$1.useContext(DataRouterStateContext);\n\tinvariant(state, getDataRouterConsoleError(hookName));\n\treturn state;\n}\nfunction useDataRouterFetchers(hookName) {\n\tlet fetchers = React$1.useContext(FetchersContext);\n\tinvariant(fetchers, getDataRouterConsoleError(hookName));\n\treturn fetchers;\n}\nfunction useDataRouterData(hookName) {\n\tlet data = React$1.useContext(DataRouterDataContext);\n\tinvariant(data, getDataRouterConsoleError(hookName));\n\treturn data;\n}\nfunction useDataRouterNavigation(hookName) {\n\tlet navigation = React$1.useContext(DataRouterNavigationContext);\n\tinvariant(navigation, getDataRouterConsoleError(hookName));\n\treturn navigation;\n}\nfunction useCurrentRouteId(hookName) {\n\tlet routeId = React$1.useContext(RouteIdContext);\n\tinvariant(routeId, `${hookName} can only be used on routes that contain a unique \"id\"`);\n\treturn routeId;\n}\n/**\n* Returns the current {@link Navigation}, defaulting to an \"idle\" navigation\n* when no navigation is in progress. You can use this to render pending UI\n* (like a global spinner) or read [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData)\n* from a form navigation.\n*\n* @example\n* import { useNavigation } from \"react-router\";\n*\n* function SomeComponent() {\n* let navigation = useNavigation();\n* navigation.state;\n* navigation.formData;\n* // etc.\n* }\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns The current {@link Navigation} object\n*/\nfunction useNavigation() {\n\tlet { navigation } = useDataRouterNavigation(\"useNavigation\");\n\treturn React$1.useMemo(() => {\n\t\tlet { matches, historyAction, ...rest } = navigation;\n\t\treturn rest;\n\t}, [navigation]);\n}\n/**\n* Revalidate the data on the page for reasons outside of normal data mutations\n* like [`Window` focus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)\n* or polling on an interval.\n*\n* Note that page data is already revalidated automatically after actions.\n* If you find yourself using this for normal CRUD operations on your data in\n* response to user interactions, you're probably not taking advantage of the\n* other APIs like {@link useFetcher}, {@link Form}, {@link useSubmit} that do\n* this automatically.\n*\n* @example\n* import { useRevalidator } from \"react-router\";\n*\n* function WindowFocusRevalidator() {\n* const revalidator = useRevalidator();\n*\n* useFakeWindowFocus(() => {\n* revalidator.revalidate();\n* });\n*\n* return (\n* <div hidden={revalidator.state === \"idle\"}>\n* Revalidating...\n* </div>\n* );\n* }\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns An object with a `revalidate` function and the current revalidation\n* `state`\n*/\nfunction useRevalidator() {\n\tlet dataRouterContext = useDataRouterContext(\"useRevalidator\");\n\tlet { revalidation } = useDataRouterNavigation(\"useRevalidator\");\n\tlet revalidate = React$1.useCallback(async () => {\n\t\tawait dataRouterContext.router.revalidate();\n\t}, [dataRouterContext.router]);\n\treturn React$1.useMemo(() => ({\n\t\trevalidate,\n\t\tstate: revalidation\n\t}), [revalidate, revalidation]);\n}\n/**\n* Returns the active route matches, useful for accessing `loaderData` for\n* parent/child routes or the route [`handle`](../../start/framework/route-module#handle)\n* property\n*\n* Pairing the route `handle` with `useMatches` gets very powerful since you can put\n* whatever you want on a route handle and have access to `useMatches` anywhere.\n* Please see the [handle](../../how-to/using-handle) documentation for an example\n* of breadcrumbs via `useMatches`/`handle`.\n*\n* ```tsx\n* import { useMatches } from \"react-router\";\n*\n* function SomeComponent() {\n* const matches = useMatches();\n* // matches[i].id // route id\n* // matches[i].pathname // the portion of the URL the route matched\n* // matches[i].params // the parsed params from the URL\n* // matches[i].loaderData // the data from the loader\n* // matches[i].handle // the route handle with any app specific data\n* }\n* ```\n*\n* <docs-info>useMatches only works with a data router like `createBrowserRouter`,\n* since they know the full route tree up front and can provide all of the current\n* matches. Additionally, `useMatches` will not match down into any descendant route\n* trees since the router isn't aware of the descendant routes.</docs-info>\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns An array of {@link UIMatch | UI matches} for the current route hierarchy\n*/\nfunction useMatches() {\n\tlet { matches } = useDataRouterState(\"useMatches\");\n\tlet { loaderData } = useDataRouterData(\"useMatches\");\n\treturn React$1.useMemo(() => matches.map((m) => convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);\n}\n/**\n* Returns the data from the closest route\n* [`loader`](../../start/framework/route-module#loader) or\n* [`clientLoader`](../../start/framework/route-module#clientloader).\n*\n* @example\n* import { useLoaderData } from \"react-router\";\n*\n* export async function loader() {\n* return await fakeDb.invoices.findAll();\n* }\n*\n* export default function Invoices() {\n* let invoices = useLoaderData<typeof loader>();\n* // ...\n* }\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns The data returned from the route's [`loader`](../../start/framework/route-module#loader) or [`clientLoader`](../../start/framework/route-module#clientloader) function\n*/\nfunction useLoaderData() {\n\tlet data = useDataRouterData(\"useLoaderData\");\n\tlet routeId = useCurrentRouteId(\"useLoaderData\");\n\treturn data.loaderData[routeId];\n}\n/**\n* Returns the [`loader`](../../start/framework/route-module#loader) data for a\n* given route by route ID.\n*\n* Route IDs are created automatically. They are simply the path of the route file\n* relative to the app folder without the extension.\n*\n* | Route Filename | Route ID |\n* | ---------------------------- | ---------------------- |\n* | `app/root.tsx` | `\"root\"` |\n* | `app/routes/teams.tsx` | `\"routes/teams\"` |\n* | `app/whatever/teams.$id.tsx` | `\"whatever/teams.$id\"` |\n*\n* @example\n* import { useRouteLoaderData } from \"react-router\";\n*\n* function SomeComponent() {\n* const { user } = useRouteLoaderData(\"root\");\n* }\n*\n* // You can also specify your own route ID's manually in your routes.ts file:\n* route(\"/\", \"containers/app.tsx\", { id: \"app\" })\n* useRouteLoaderData(\"app\");\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @param routeId The ID of the route to return loader data from\n* @returns The data returned from the specified route's [`loader`](../../start/framework/route-module#loader)\n* function, or `undefined` if not found\n*/\nfunction useRouteLoaderData(routeId) {\n\treturn useDataRouterData(\"useRouteLoaderData\").loaderData[routeId];\n}\n/**\n* Returns the [`action`](../../start/framework/route-module#action) data from\n* the most recent `POST` navigation form submission or `undefined` if there\n* hasn't been one.\n*\n* @example\n* import { Form, useActionData } from \"react-router\";\n*\n* export async function action({ request }) {\n* const body = await request.formData();\n* const name = body.get(\"visitorsName\");\n* return { message: `Hello, ${name}` };\n* }\n*\n* export default function Invoices() {\n* const data = useActionData();\n* return (\n* <Form method=\"post\">\n* <input type=\"text\" name=\"visitorsName\" />\n* {data ? data.message : \"Waiting...\"}\n* </Form>\n* );\n* }\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns The data returned from the route's [`action`](../../start/framework/route-module#action)\n* function, or `undefined` if no [`action`](../../start/framework/route-module#action)\n* has been called\n*/\nfunction useActionData() {\n\tlet data = useDataRouterData(\"useActionData\");\n\tlet routeId = useCurrentRouteId(\"useActionData\");\n\treturn data.actionData ? data.actionData[routeId] : void 0;\n}\n/**\n* Accesses the error thrown during an\n* [`action`](../../start/framework/route-module#action),\n* [`loader`](../../start/framework/route-module#loader),\n* or component render to be used in a route module\n* [`ErrorBoundary`](../../start/framework/route-module#errorboundary).\n*\n* @example\n* export function ErrorBoundary() {\n* const error = useRouteError();\n* return <div>{error.message}</div>;\n* }\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns The error that was thrown during route [loading](../../start/framework/route-module#loader),\n* [`action`](../../start/framework/route-module#action) execution, or rendering\n*/\nfunction useRouteError() {\n\tlet error = React$1.useContext(RouteErrorContext);\n\tlet data = useDataRouterData(\"useRouteError\");\n\tlet routeId = useCurrentRouteId(\"useRouteError\");\n\tif (error !== void 0) return error;\n\treturn data.errors?.[routeId];\n}\n/**\n* Returns the resolved promise value from the closest {@link Await | `<Await>`}.\n*\n* @example\n* function SomeDescendant() {\n* const value = useAsyncValue();\n* // ...\n* }\n*\n* // somewhere in your app\n* <Await resolve={somePromise}>\n* <SomeDescendant />\n* </Await>;\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns The resolved value from the nearest {@link Await} component\n*/\nfunction useAsyncValue() {\n\treturn React$1.useContext(AwaitContext)?._data;\n}\n/**\n* Returns the rejection value from the closest {@link Await | `<Await>`}.\n*\n* @example\n* import { Await, useAsyncError } from \"react-router\";\n*\n* function ErrorElement() {\n* const error = useAsyncError();\n* return (\n* <p>Uh Oh, something went wrong! {error.message}</p>\n* );\n* }\n*\n* // somewhere in your app\n* <Await\n* resolve={promiseThatRejects}\n* errorElement={<ErrorElement />}\n* />;\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns The error that was thrown in the nearest {@link Await} component\n*/\nfunction useAsyncError() {\n\treturn React$1.useContext(AwaitContext)?._error;\n}\nlet blockerId = 0;\n/**\n* Allow the application to block navigations within the SPA and present the\n* user a confirmation dialog to confirm the navigation. Mostly used to avoid\n* using half-filled form data. This does not handle hard-reloads or\n* cross-origin navigations.\n*\n* The {@link Blocker} object returned by the hook has the following properties:\n*\n* - **`state`**\n* - `unblocked` - the blocker is idle and has not prevented any navigation\n* - `blocked` - the blocker has prevented a navigation\n* - `proceeding` - the blocker is proceeding through from a blocked navigation\n* - **`location`**\n* - When in a `blocked` state, this represents the {@link Location} to which\n* we blocked a navigation. When in a `proceeding` state, this is the\n* location being navigated to after a `blocker.proceed()` call.\n* - **`proceed()`**\n* - When in a `blocked` state, you may call `blocker.proceed()` to proceed to\n* the blocked location.\n* - **`reset()`**\n* - When in a `blocked` state, you may call `blocker.reset()` to return the\n* blocker to an `unblocked` state and leave the user at the current\n* location.\n*\n* @example\n* // Boolean version\n* let blocker = useBlocker(value !== \"\");\n*\n* // Function version\n* let blocker = useBlocker(\n* ({ currentLocation, nextLocation, historyAction }) =>\n* value !== \"\" &&\n* currentLocation.pathname !== nextLocation.pathname\n* );\n*\n* @additionalExamples\n* ```tsx\n* import { useCallback, useState } from \"react\";\n* import { BlockerFunction, useBlocker } from \"react-router\";\n*\n* export function ImportantForm() {\n* const [value, setValue] = useState(\"\");\n*\n* const shouldBlock = useCallback<BlockerFunction>(\n* () => value !== \"\",\n* [value]\n* );\n* const blocker = useBlocker(shouldBlock);\n*\n* return (\n* <form\n* onSubmit={(e) => {\n* e.preventDefault();\n* setValue(\"\");\n* if (blocker.state === \"blocked\") {\n* blocker.proceed();\n* }\n* }}\n* >\n* <input\n* name=\"data\"\n* value={value}\n* onChange={(e) => setValue(e.target.value)}\n* />\n*\n* <button type=\"submit\">Save</button>\n*\n* {blocker.state === \"blocked\" ? (\n* <>\n* <p style={{ color: \"red\" }}>\n* Blocked the last navigation to\n* </p>\n* <button\n* type=\"button\"\n* onClick={() => blocker.proceed()}\n* >\n* Let me through\n* </button>\n* <button\n* type=\"button\"\n* onClick={() => blocker.reset()}\n* >\n* Keep me here\n* </button>\n* </>\n* ) : blocker.state === \"proceeding\" ? (\n* <p style={{ color: \"orange\" }}>\n* Proceeding through blocked navigation\n* </p>\n* ) : (\n* <p style={{ color: \"green\" }}>\n* Blocker is currently unblocked\n* </p>\n* )}\n* </form>\n* );\n* }\n* ```\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @param shouldBlock Either a boolean or a function returning a boolean which\n* indicates whether the navigation should be blocked. The function format\n* receives a single object parameter containing the `currentLocation`,\n* `nextLocation`, and `historyAction` of the potential navigation.\n* @returns A {@link Blocker} object with state and reset functionality\n*/\nfunction useBlocker(shouldBlock) {\n\tlet { router, basename } = useDataRouterContext(\"useBlocker\");\n\tlet state = useDataRouterState(\"useBlocker\");\n\tlet [blockerKey, setBlockerKey] = React$1.useState(\"\");\n\tlet blockerFunction = React$1.useCallback((arg) => {\n\t\tif (typeof shouldBlock !== \"function\") return !!shouldBlock;\n\t\tif (basename === \"/\") return shouldBlock(arg);\n\t\tlet { currentLocation, nextLocation, historyAction } = arg;\n\t\treturn shouldBlock({\n\t\t\tcurrentLocation: {\n\t\t\t\t...currentLocation,\n\t\t\t\tpathname: stripBasename(currentLocation.pathname, basename) || currentLocation.pathname\n\t\t\t},\n\t\t\tnextLocation: {\n\t\t\t\t...nextLocation,\n\t\t\t\tpathname: stripBasename(nextLocation.pathname, basename) || nextLocation.pathname\n\t\t\t},\n\t\t\thistoryAction\n\t\t});\n\t}, [basename, shouldBlock]);\n\tReact$1.useEffect(() => {\n\t\tlet key = String(++blockerId);\n\t\tsetBlockerKey(key);\n\t\treturn () => router.deleteBlocker(key);\n\t}, [router]);\n\tReact$1.useEffect(() => {\n\t\tif (blockerKey !== \"\") router.getBlocker(blockerKey, blockerFunction);\n\t}, [\n\t\trouter,\n\t\tblockerKey,\n\t\tblockerFunction\n\t]);\n\treturn blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;\n}\nfunction useNavigateStable() {\n\tlet { router } = useDataRouterContext(\"useNavigate\");\n\tlet id = useCurrentRouteId(\"useNavigate\");\n\tlet activeRef = React$1.useRef(false);\n\tReact$1.useLayoutEffect(() => {\n\t\tactiveRef.current = true;\n\t});\n\treturn React$1.useCallback(async (to, options = {}) => {\n\t\twarning(activeRef.current, navigateEffectWarning);\n\t\tif (!activeRef.current) return;\n\t\tif (typeof to === \"number\") await router.navigate(to);\n\t\telse await router.navigate(to, {\n\t\t\tfromRouteId: id,\n\t\t\t...options\n\t\t});\n\t}, [router, id]);\n}\nconst alreadyWarned = {};\nfunction warningOnce(key, cond, message) {\n\tif (!cond && !alreadyWarned[key]) {\n\t\talreadyWarned[key] = true;\n\t\twarning(false, message);\n\t}\n}\nfunction useRoute(...args) {\n\tconst currentRouteId = useCurrentRouteId(\"useRoute\");\n\tconst id = args[0] ?? currentRouteId;\n\tconst state = useDataRouterState(\"useRoute\");\n\tconst data = useDataRouterData(\"useRoute\");\n\tconst route = state.matches.find(({ route }) => route.id === id);\n\tif (route === void 0) return void 0;\n\treturn {\n\t\thandle: route.route.handle,\n\t\tloaderData: data.loaderData[id],\n\t\tactionData: data.actionData?.[id]\n\t};\n}\nfunction toRouterStateMatch(match) {\n\treturn {\n\t\tid: match.route.id,\n\t\tpathname: match.pathname,\n\t\tparams: match.params,\n\t\thandle: match.route.handle\n\t};\n}\n/**\n* A unified hook for reading router state: current (`active`) and in-flight\n* (`pending`) locations, search params, params, matches, and navigation type.\n*\n* This hook consolidates the information you used to get from {@link useLocation},\n* {@link useSearchParams}, {@link useParams}, {@link useMatches}, {@link useNavigation},\n* and {@link useNavigationType} into a single hook.\n*\n*\n* @example\n* import { unstable_useRouterState as useRouterState } from \"react-router\";\n*\n* let { active, pending } = unstable_useRouterState();\n*\n* // Active is always populated with the current location\n* active.location; // replaces `useLocation()`\n* active.searchParams; // replaces `useSearchParams()[0]`\n* active.params; // replaces `useParams()`\n* active.matches; // replaces `useMatches()`\n* active.type; // replaces `useNavigationType()`\n*\n* // Pending is only populated during a navigation\n* pending.location; // replaces `useNavigation().location`\n* pending.searchParams; // equivalent to `new URLSearchParams(useNavigation().search)`\n* pending.params; // Not directly accessible today\n* pending.matches; // Not directly accessible today\n* pending.type; // Not directly accessible today\n* pending.state; // replaces `useNavigation().state`\n* pending.formMethod; // replaces useNavigation().formMethod\n* pending.formAction; // replaces useNavigation().formAction\n* pending.formEncType; // replaces useNavigation().formEncType\n* pending.formData; // replaces useNavigation().formData\n* pending.json; // replaces useNavigation().json\n* pending.text; // replaces useNavigation().text\n*\n* @name unstable_useRouterState\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns The current router state with `active` and `pending` variants\n*/\nfunction useRouterState() {\n\tlet { location, historyAction: type, matches } = useDataRouterState(\"unstable_useRouterState\");\n\tlet { navigation } = useDataRouterNavigation(\"unstable_useRouterState\");\n\tlet active = React$1.useMemo(() => ({\n\t\ttype,\n\t\tlocation,\n\t\tsearchParams: new URLSearchParams(location.search),\n\t\tparams: matches[matches.length - 1]?.params ?? {},\n\t\tmatches: matches.map((m) => toRouterStateMatch(m))\n\t}), [\n\t\tlocation,\n\t\tmatches,\n\t\ttype\n\t]);\n\tlet pending = React$1.useMemo(() => {\n\t\tif (navigation.state === \"idle\") return null;\n\t\tlet shared = {\n\t\t\ttype: navigation.historyAction,\n\t\t\tlocation: navigation.location,\n\t\t\tsearchParams: new URLSearchParams(navigation.location.search),\n\t\t\tparams: navigation.matches[navigation.matches.length - 1]?.params ?? {},\n\t\t\tmatches: navigation.matches.map((m) => toRouterStateMatch(m))\n\t\t};\n\t\treturn navigation.state === \"loading\" ? {\n\t\t\t...shared,\n\t\t\tstate: \"loading\",\n\t\t\tformMethod: navigation.formMethod,\n\t\t\tformAction: navigation.formAction,\n\t\t\tformEncType: navigation.formEncType,\n\t\t\tformData: navigation.formData,\n\t\t\tjson: navigation.json,\n\t\t\ttext: navigation.text\n\t\t} : {\n\t\t\t...shared,\n\t\t\tstate: \"submitting\",\n\t\t\tformMethod: navigation.formMethod,\n\t\t\tformAction: navigation.formAction,\n\t\t\tformEncType: navigation.formEncType,\n\t\t\tformData: navigation.formData,\n\t\t\tjson: navigation.json,\n\t\t\ttext: navigation.text\n\t\t};\n\t}, [navigation]);\n\treturn React$1.useMemo(() => ({\n\t\tactive,\n\t\tpending\n\t}), [active, pending]);\n}\n//#endregion\nexport { _renderMatches, useActionData, useAsyncError, useAsyncValue, useBlocker, useCurrentRouteId, useDataRouterContext, useDataRouterData, useDataRouterFetchers, useDataRouterState, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRoute, useRouteError, useRouteLoaderData, useRouterState, useRoutes, useRoutesImpl };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\n//#region lib/server-runtime/warnings.ts\nconst alreadyWarned = {};\nfunction warnOnce(condition, message) {\n\tif (!condition && !alreadyWarned[message]) {\n\t\talreadyWarned[message] = true;\n\t\tconsole.warn(message);\n\t}\n}\n//#endregion\nexport { warnOnce };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { createMemoryHistory, createPath, invariant, parsePath, warning } from \"./router/history.js\";\nimport { defaultMapRouteProperties, getResolveToMatches, getRoutePattern, resolveTo, stripBasename } from \"./router/utils.js\";\nimport { getNavigatorCurrentUrl, validateNavigationTarget } from \"./router/navigation.js\";\nimport { createRouter } from \"./router/router.js\";\nimport { AwaitContext, DataRouterContext, DataRouterDataContext, DataRouterNavigationContext, DataRouterStateContext, FetchersContext, LocationContext, NavigationContext, RouteContext, ViewTransitionContext, useIsRSCRouterContext } from \"./context.js\";\nimport { _renderMatches, useActionData, useAsyncValue, useInRouterContext, useLoaderData, useLocation, useMatches, useNavigate, useOutlet, useParams, useRouteError, useRoutes, useRoutesImpl } from \"./hooks.js\";\nimport { warnOnce } from \"./server-runtime/warnings.js\";\nimport * as React$1 from \"react\";\nimport { useOptimistic } from \"react\";\n//#region lib/components.tsx\nconst hydrationRouteProperties = [\"HydrateFallback\", \"hydrateFallbackElement\"];\n/**\n* Create a new {@link DataRouter} that manages the application path using an\n* in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)\n* stack. Useful for non-browser environments without a DOM API.\n*\n* Data Routers should not be held in React state. You should create your router\n* once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.\n* You can use `patchRoutesOnNavigation` to add additional routes programmatically.\n*\n* @public\n* @category Data Routers\n* @mode data\n* @param routes Application routes\n* @param opts Options\n* @param {MemoryRouterOpts.basename} opts.basename n/a\n* @param {MemoryRouterOpts.dataStrategy} opts.dataStrategy n/a\n* @param {MemoryRouterOpts.future} opts.future n/a\n* @param {MemoryRouterOpts.getContext} opts.getContext n/a\n* @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a\n* @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a\n* @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a\n* @param {MemoryRouterOpts.instrumentations} opts.instrumentations n/a\n* @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a\n* @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`}\n*/\nfunction createMemoryRouter(routes, opts) {\n\treturn createRouter({\n\t\tbasename: opts?.basename,\n\t\tgetContext: opts?.getContext,\n\t\tfuture: opts?.future,\n\t\thistory: createMemoryHistory({\n\t\t\tinitialEntries: opts?.initialEntries,\n\t\t\tinitialIndex: opts?.initialIndex\n\t\t}),\n\t\thydrationData: opts?.hydrationData,\n\t\troutes,\n\t\tmapRouteProperties: defaultMapRouteProperties,\n\t\thydrationRouteProperties,\n\t\tdataStrategy: opts?.dataStrategy,\n\t\tpatchRoutesOnNavigation: opts?.patchRoutesOnNavigation,\n\t\tinstrumentations: opts?.instrumentations\n\t}).initialize();\n}\nvar Deferred = class {\n\tstatus = \"pending\";\n\tpromise;\n\tresolve;\n\treject;\n\tconstructor() {\n\t\tthis.promise = new Promise((resolve, reject) => {\n\t\t\tthis.resolve = (value) => {\n\t\t\t\tif (this.status === \"pending\") {\n\t\t\t\t\tthis.status = \"resolved\";\n\t\t\t\t\tresolve(value);\n\t\t\t\t}\n\t\t\t};\n\t\t\tthis.reject = (reason) => {\n\t\t\t\tif (this.status === \"pending\") {\n\t\t\t\t\tthis.status = \"rejected\";\n\t\t\t\t\treject(reason);\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t}\n};\n/**\n* Render the UI for the given {@link DataRouter}. This component should\n* typically be at the top of an app's element tree. The router prop should\n* be a single router instance created outside of the React tree. Avoid\n* creating new routers during React renders/re-renders.\n*\n* ```tsx\n* import { createBrowserRouter } from \"react-router\";\n* import { RouterProvider } from \"react-router/dom\";\n* import { createRoot } from \"react-dom/client\";\n*\n* const router = createBrowserRouter(routes);\n* createRoot(document.getElementById(\"root\")).render(\n* <RouterProvider router={router} />\n* );\n* ```\n*\n* <docs-info>Please note that this component is exported both from\n* `react-router` and `react-router/dom` with the only difference being that the\n* latter automatically wires up `react-dom`'s [`flushSync`](https://react.dev/reference/react-dom/flushSync)\n* implementation. You _almost always_ want to use the version from\n* `react-router/dom` unless you're running in a non-DOM environment.</docs-info>\n*\n*\n* @public\n* @category Data Routers\n* @mode data\n* @param props Props\n* @param {RouterProviderProps.flushSync} props.flushSync n/a\n* @param {RouterProviderProps.onError} props.onError n/a\n* @param {RouterProviderProps.router} props.router n/a\n* @param {RouterProviderProps.useTransitions} props.useTransitions n/a\n* @returns React element for the rendered router\n*/\nfunction RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, useTransitions }) {\n\tuseTransitions = useIsRSCRouterContext() || useTransitions;\n\tlet [_state, setStateImpl] = React$1.useState(router.state);\n\tlet [state, setOptimisticState] = useOptimistic(_state);\n\tlet [pendingState, setPendingState] = React$1.useState();\n\tlet [vtContext, setVtContext] = React$1.useState({ isTransitioning: false });\n\tlet [renderDfd, setRenderDfd] = React$1.useState();\n\tlet [transition, setTransition] = React$1.useState();\n\tlet [interruption, setInterruption] = React$1.useState();\n\tlet fetcherData = React$1.useRef(/* @__PURE__ */ new Map());\n\tlet setState = React$1.useCallback((newState, { deletedFetchers, newErrors, flushSync, viewTransitionOpts }) => {\n\t\tif (newErrors && onError) Object.values(newErrors).forEach((error) => onError(error, {\n\t\t\tlocation: newState.location,\n\t\t\tparams: newState.matches[0]?.params ?? {},\n\t\t\tpattern: getRoutePattern(newState.matches)\n\t\t}));\n\t\tnewState.fetchers.forEach((fetcher, key) => {\n\t\t\tif (fetcher.data !== void 0) fetcherData.current.set(key, fetcher.data);\n\t\t});\n\t\tdeletedFetchers.forEach((key) => fetcherData.current.delete(key));\n\t\twarnOnce(flushSync === false || reactDomFlushSyncImpl != null, \"You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from \\\"react-router/dom\\\"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.\");\n\t\tlet isViewTransitionAvailable = router.window != null && router.window.document != null && typeof router.window.document.startViewTransition === \"function\";\n\t\twarnOnce(viewTransitionOpts == null || isViewTransitionAvailable, \"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available.\");\n\t\tif (!viewTransitionOpts || !isViewTransitionAvailable) {\n\t\t\tif (reactDomFlushSyncImpl && flushSync) reactDomFlushSyncImpl(() => setStateImpl(newState));\n\t\t\telse if (useTransitions === false) setStateImpl(newState);\n\t\t\telse React$1.startTransition(() => {\n\t\t\t\tif (useTransitions === true) setOptimisticState((s) => getOptimisticRouterState(s, newState));\n\t\t\t\tsetStateImpl(newState);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (reactDomFlushSyncImpl && flushSync) {\n\t\t\treactDomFlushSyncImpl(() => {\n\t\t\t\tif (transition) {\n\t\t\t\t\trenderDfd?.resolve();\n\t\t\t\t\ttransition.skipTransition();\n\t\t\t\t}\n\t\t\t\tsetVtContext({\n\t\t\t\t\tisTransitioning: true,\n\t\t\t\t\tflushSync: true,\n\t\t\t\t\tcurrentLocation: viewTransitionOpts.currentLocation,\n\t\t\t\t\tnextLocation: viewTransitionOpts.nextLocation\n\t\t\t\t});\n\t\t\t});\n\t\t\tlet t = router.window.document.startViewTransition(() => {\n\t\t\t\treactDomFlushSyncImpl(() => setStateImpl(newState));\n\t\t\t});\n\t\t\tt.finished.finally(() => {\n\t\t\t\treactDomFlushSyncImpl(() => {\n\t\t\t\t\tsetRenderDfd(void 0);\n\t\t\t\t\tsetTransition(void 0);\n\t\t\t\t\tsetPendingState(void 0);\n\t\t\t\t\tsetVtContext({ isTransitioning: false });\n\t\t\t\t});\n\t\t\t});\n\t\t\treactDomFlushSyncImpl(() => setTransition(t));\n\t\t\treturn;\n\t\t}\n\t\tif (transition) {\n\t\t\trenderDfd?.resolve();\n\t\t\ttransition.skipTransition();\n\t\t\tsetInterruption({\n\t\t\t\tstate: newState,\n\t\t\t\tcurrentLocation: viewTransitionOpts.currentLocation,\n\t\t\t\tnextLocation: viewTransitionOpts.nextLocation\n\t\t\t});\n\t\t} else {\n\t\t\tsetPendingState(newState);\n\t\t\tsetVtContext({\n\t\t\t\tisTransitioning: true,\n\t\t\t\tflushSync: false,\n\t\t\t\tcurrentLocation: viewTransitionOpts.currentLocation,\n\t\t\t\tnextLocation: viewTransitionOpts.nextLocation\n\t\t\t});\n\t\t}\n\t}, [\n\t\trouter.window,\n\t\treactDomFlushSyncImpl,\n\t\ttransition,\n\t\trenderDfd,\n\t\tuseTransitions,\n\t\tsetOptimisticState,\n\t\tonError\n\t]);\n\tReact$1.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n\tReact$1.useEffect(() => {\n\t\tif (vtContext.isTransitioning && !vtContext.flushSync) setRenderDfd(new Deferred());\n\t}, [vtContext]);\n\tReact$1.useEffect(() => {\n\t\tif (renderDfd && pendingState && router.window) {\n\t\t\tlet newState = pendingState;\n\t\t\tlet renderPromise = renderDfd.promise;\n\t\t\tlet transition = router.window.document.startViewTransition(async () => {\n\t\t\t\tif (useTransitions === false) setStateImpl(newState);\n\t\t\t\telse React$1.startTransition(() => {\n\t\t\t\t\tif (useTransitions === true) setOptimisticState((s) => getOptimisticRouterState(s, newState));\n\t\t\t\t\tsetStateImpl(newState);\n\t\t\t\t});\n\t\t\t\tawait renderPromise;\n\t\t\t});\n\t\t\ttransition.finished.finally(() => {\n\t\t\t\tsetRenderDfd(void 0);\n\t\t\t\tsetTransition(void 0);\n\t\t\t\tsetPendingState(void 0);\n\t\t\t\tsetVtContext({ isTransitioning: false });\n\t\t\t});\n\t\t\tsetTransition(transition);\n\t\t}\n\t}, [\n\t\tpendingState,\n\t\trenderDfd,\n\t\trouter.window,\n\t\tuseTransitions,\n\t\tsetOptimisticState\n\t]);\n\tReact$1.useEffect(() => {\n\t\tif (renderDfd && pendingState && state.location.key === pendingState.location.key) renderDfd.resolve();\n\t}, [\n\t\trenderDfd,\n\t\ttransition,\n\t\tstate.location,\n\t\tpendingState\n\t]);\n\tReact$1.useEffect(() => {\n\t\tif (!vtContext.isTransitioning && interruption) {\n\t\t\tsetPendingState(interruption.state);\n\t\t\tsetVtContext({\n\t\t\t\tisTransitioning: true,\n\t\t\t\tflushSync: false,\n\t\t\t\tcurrentLocation: interruption.currentLocation,\n\t\t\t\tnextLocation: interruption.nextLocation\n\t\t\t});\n\t\t\tsetInterruption(void 0);\n\t\t}\n\t}, [vtContext.isTransitioning, interruption]);\n\tlet navigator = React$1.useMemo(() => {\n\t\treturn {\n\t\t\tcreateHref: router.createHref,\n\t\t\tcreateURL: router.createURL,\n\t\t\tencodeLocation: router.encodeLocation,\n\t\t\tgo: (n) => router.navigate(n),\n\t\t\tpush: (to, state, opts) => router.navigate(to, {\n\t\t\t\tstate,\n\t\t\t\tpreventScrollReset: opts?.preventScrollReset\n\t\t\t}),\n\t\t\treplace: (to, state, opts) => router.navigate(to, {\n\t\t\t\treplace: true,\n\t\t\t\tstate,\n\t\t\t\tpreventScrollReset: opts?.preventScrollReset\n\t\t\t})\n\t\t};\n\t}, [router]);\n\tlet basename = router.basename || \"/\";\n\tlet dataRouterContext = React$1.useMemo(() => ({\n\t\trouter,\n\t\tnavigator,\n\t\tstatic: false,\n\t\tbasename,\n\t\tonError\n\t}), [\n\t\trouter,\n\t\tnavigator,\n\t\tbasename,\n\t\tonError\n\t]);\n\tlet dataRouterState = React$1.useMemo(() => ({\n\t\thistoryAction: state.historyAction,\n\t\tlocation: state.location,\n\t\tmatches: state.matches,\n\t\tinitialized: state.initialized,\n\t\trenderFallback: state.renderFallback,\n\t\trestoreScrollPosition: state.restoreScrollPosition,\n\t\tpreventScrollReset: state.preventScrollReset,\n\t\tblockers: state.blockers\n\t}), [\n\t\tstate.historyAction,\n\t\tstate.location,\n\t\tstate.matches,\n\t\tstate.initialized,\n\t\tstate.renderFallback,\n\t\tstate.restoreScrollPosition,\n\t\tstate.preventScrollReset,\n\t\tstate.blockers\n\t]);\n\tlet dataRouterNavigation = React$1.useMemo(() => ({\n\t\tnavigation: state.navigation,\n\t\trevalidation: state.revalidation\n\t}), [state.navigation, state.revalidation]);\n\tlet dataRouterData = React$1.useMemo(() => ({\n\t\tloaderData: state.loaderData,\n\t\tactionData: state.actionData,\n\t\terrors: state.errors\n\t}), [\n\t\tstate.loaderData,\n\t\tstate.actionData,\n\t\tstate.errors\n\t]);\n\tlet fetchersContext = React$1.useMemo(() => ({\n\t\tfetchers: state.fetchers,\n\t\tfetcherData: fetcherData.current\n\t}), [state.fetchers]);\n\treturn /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement(DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React$1.createElement(DataRouterStateContext.Provider, { value: dataRouterState }, /* @__PURE__ */ React$1.createElement(DataRouterNavigationContext.Provider, { value: dataRouterNavigation }, /* @__PURE__ */ React$1.createElement(DataRouterDataContext.Provider, { value: dataRouterData }, /* @__PURE__ */ React$1.createElement(FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React$1.createElement(ViewTransitionContext.Provider, { value: vtContext }, /* @__PURE__ */ React$1.createElement(Router, {\n\t\tbasename,\n\t\tlocation: state.location,\n\t\tnavigationType: state.historyAction,\n\t\tnavigator,\n\t\tuseTransitions\n\t}, /* @__PURE__ */ React$1.createElement(MemoizedDataRoutes, {\n\t\troutes: router.routes,\n\t\tmanifest: router.manifest,\n\t\tstate,\n\t\tisStatic: false,\n\t\tonError\n\t})))))))), null);\n}\nfunction getOptimisticRouterState(currentState, newState) {\n\treturn {\n\t\t...currentState,\n\t\tnavigation: newState.navigation.state !== \"idle\" ? newState.navigation : currentState.navigation,\n\t\trevalidation: newState.revalidation !== \"idle\" ? newState.revalidation : currentState.revalidation,\n\t\tactionData: newState.navigation.state !== \"submitting\" ? newState.actionData : currentState.actionData,\n\t\tfetchers: newState.fetchers\n\t};\n}\nconst MemoizedDataRoutes = React$1.memo(DataRoutes);\nfunction DataRoutes({ routes, manifest, state, isStatic, onError }) {\n\tlet dataRouterContext = React$1.useContext(DataRouterContext);\n\tinvariant(dataRouterContext, \"You must render this element inside a <DataRouterContext.Provider> element\");\n\treturn useRoutesImpl(routes, void 0, {\n\t\trouter: dataRouterContext.router,\n\t\tmanifest,\n\t\tstate,\n\t\tisStatic,\n\t\tonError\n\t});\n}\n/**\n* A declarative {@link Router | `<Router>`} that stores all entries in memory.\n*\n* @public\n* @category Declarative Routers\n* @mode declarative\n* @param props Props\n* @param {MemoryRouterProps.basename} props.basename n/a\n* @param {MemoryRouterProps.children} props.children n/a\n* @param {MemoryRouterProps.initialEntries} props.initialEntries n/a\n* @param {MemoryRouterProps.initialIndex} props.initialIndex n/a\n* @param {MemoryRouterProps.useTransitions} props.useTransitions n/a\n* @returns A declarative in-memory {@link Router | `<Router>`} for client-side\n* routing.\n*/\nfunction MemoryRouter({ basename, children, initialEntries, initialIndex, useTransitions }) {\n\tlet historyRef = React$1.useRef(null);\n\tif (historyRef.current == null) historyRef.current = createMemoryHistory({\n\t\tinitialEntries,\n\t\tinitialIndex,\n\t\tv5Compat: true\n\t});\n\tlet history = historyRef.current;\n\tlet [state, setStateImpl] = React$1.useState({\n\t\taction: history.action,\n\t\tlocation: history.location\n\t});\n\tlet setState = React$1.useCallback((newState) => {\n\t\tif (useTransitions === false) setStateImpl(newState);\n\t\telse React$1.startTransition(() => setStateImpl(newState));\n\t}, [useTransitions]);\n\tReact$1.useLayoutEffect(() => history.listen(setState), [history, setState]);\n\treturn /* @__PURE__ */ React$1.createElement(Router, {\n\t\tbasename,\n\t\tchildren,\n\t\tlocation: state.location,\n\t\tnavigationType: state.action,\n\t\tnavigator: history,\n\t\tuseTransitions\n\t});\n}\n/**\n* A component-based version of {@link useNavigate} to use in a\n* [`React.Component` class](https://react.dev/reference/react/Component) where\n* hooks cannot be used.\n*\n* It's recommended to avoid using this component in favor of {@link useNavigate}.\n*\n* @example\n* <Navigate to=\"/tasks\" />\n*\n* @public\n* @category Components\n* @param props Props\n* @param {NavigateProps.relative} props.relative n/a\n* @param {NavigateProps.replace} props.replace n/a\n* @param {NavigateProps.state} props.state n/a\n* @param {NavigateProps.to} props.to n/a\n* @returns {void}\n*\n*/\nfunction Navigate({ to, replace, state, relative }) {\n\tinvariant(useInRouterContext(), `<Navigate> may be used only in the context of a <Router> component.`);\n\tlet { static: isStatic, navigator } = React$1.useContext(NavigationContext);\n\twarning(!isStatic, \"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.\");\n\tlet { matches } = React$1.useContext(RouteContext);\n\tlet { pathname: locationPathname } = useLocation();\n\tlet navigate = useNavigate();\n\tlet path = resolveTo(to, getResolveToMatches(matches), locationPathname, relative === \"path\");\n\tvalidateNavigationTarget(typeof to === \"string\" ? to : createPath(to), navigator.createHref(path), getNavigatorCurrentUrl(navigator), \"reject\");\n\tlet jsonPath = JSON.stringify(path);\n\tReact$1.useEffect(() => {\n\t\tnavigate(JSON.parse(jsonPath), {\n\t\t\treplace,\n\t\t\tstate,\n\t\t\trelative\n\t\t});\n\t}, [\n\t\tnavigate,\n\t\tjsonPath,\n\t\trelative,\n\t\treplace,\n\t\tstate\n\t]);\n\treturn null;\n}\n/**\n* Renders the matching child route of a parent route or nothing if no child\n* route matches.\n*\n* @example\n* import { Outlet } from \"react-router\";\n*\n* export default function SomeParent() {\n* return (\n* <div>\n* <h1>Parent Content</h1>\n* <Outlet />\n* </div>\n* );\n* }\n*\n* @public\n* @category Components\n* @param props Props\n* @param {OutletProps.context} props.context n/a\n* @returns React element for the rendered outlet or `null` if no child route matches.\n*/\nfunction Outlet(props) {\n\treturn useOutlet(props.context);\n}\n/**\n* Configures an element to render when a pattern matches the current location.\n* It must be rendered within a {@link Routes} element. Note that these routes\n* do not participate in data loading, actions, code splitting, or any other\n* route module features.\n*\n* @example\n* // Usually used in a declarative router\n* function App() {\n* return (\n* <BrowserRouter>\n* <Routes>\n* <Route index element={<StepOne />} />\n* <Route path=\"step-2\" element={<StepTwo />} />\n* <Route path=\"step-3\" element={<StepThree />} />\n* </Routes>\n* </BrowserRouter>\n* );\n* }\n*\n* // But can be used with a data router as well if you prefer the JSX notation\n* const routes = createRoutesFromElements(\n* <>\n* <Route index loader={step1Loader} Component={StepOne} />\n* <Route path=\"step-2\" loader={step2Loader} Component={StepTwo} />\n* <Route path=\"step-3\" loader={step3Loader} Component={StepThree} />\n* </>\n* );\n*\n* const router = createBrowserRouter(routes);\n*\n* function App() {\n* return <RouterProvider router={router} />;\n* }\n*\n* @public\n* @category Components\n* @param props Props\n* @param {PathRouteProps.action} props.action n/a\n* @param {PathRouteProps.caseSensitive} props.caseSensitive n/a\n* @param {PathRouteProps.Component} props.Component n/a\n* @param {PathRouteProps.children} props.children n/a\n* @param {PathRouteProps.element} props.element n/a\n* @param {PathRouteProps.ErrorBoundary} props.ErrorBoundary n/a\n* @param {PathRouteProps.errorElement} props.errorElement n/a\n* @param {PathRouteProps.handle} props.handle n/a\n* @param {PathRouteProps.HydrateFallback} props.HydrateFallback n/a\n* @param {PathRouteProps.hydrateFallbackElement} props.hydrateFallbackElement n/a\n* @param {PathRouteProps.id} props.id n/a\n* @param {PathRouteProps.index} props.index n/a\n* @param {PathRouteProps.lazy} props.lazy n/a\n* @param {PathRouteProps.loader} props.loader n/a\n* @param {PathRouteProps.path} props.path n/a\n* @param {PathRouteProps.shouldRevalidate} props.shouldRevalidate n/a\n* @returns {void}\n*/\nfunction Route(props) {\n\tinvariant(false, \"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.\");\n}\n/**\n* Provides location context for the rest of the app.\n*\n* Note: You usually won't render a `<Router>` directly. Instead, you'll render a\n* router that is more specific to your environment such as a {@link BrowserRouter}\n* in web browsers or a {@link ServerRouter} for server rendering.\n*\n* @public\n* @category Declarative Routers\n* @mode declarative\n* @param props Props\n* @param {RouterProps.basename} props.basename n/a\n* @param {RouterProps.children} props.children n/a\n* @param {RouterProps.location} props.location n/a\n* @param {RouterProps.navigationType} props.navigationType n/a\n* @param {RouterProps.navigator} props.navigator n/a\n* @param {RouterProps.static} props.static n/a\n* @param {RouterProps.useTransitions} props.useTransitions n/a\n* @returns React element for the rendered router or `null` if the location does\n* not match the {@link props.basename}\n*/\nfunction Router({ basename: basenameProp = \"/\", children = null, location: locationProp, navigationType = \"POP\", navigator, static: staticProp = false, useTransitions }) {\n\tinvariant(!useInRouterContext(), \"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.\");\n\tlet basename = basenameProp.replace(/^\\/*/, \"/\");\n\tlet navigationContext = React$1.useMemo(() => ({\n\t\tbasename,\n\t\tnavigator,\n\t\tstatic: staticProp,\n\t\tuseTransitions,\n\t\tfuture: {}\n\t}), [\n\t\tbasename,\n\t\tnavigator,\n\t\tstaticProp,\n\t\tuseTransitions\n\t]);\n\tif (typeof locationProp === \"string\") locationProp = parsePath(locationProp);\n\tlet { pathname = \"/\", search = \"\", hash = \"\", state = null, key = \"default\", mask } = locationProp;\n\tlet locationContext = React$1.useMemo(() => {\n\t\tlet trailingPathname = stripBasename(pathname, basename);\n\t\tif (trailingPathname == null) return null;\n\t\treturn {\n\t\t\tlocation: {\n\t\t\t\tpathname: trailingPathname,\n\t\t\t\tsearch,\n\t\t\t\thash,\n\t\t\t\tstate,\n\t\t\t\tkey,\n\t\t\t\tmask\n\t\t\t},\n\t\t\tnavigationType\n\t\t};\n\t}, [\n\t\tbasename,\n\t\tpathname,\n\t\tsearch,\n\t\thash,\n\t\tstate,\n\t\tkey,\n\t\tnavigationType,\n\t\tmask\n\t]);\n\twarning(locationContext != null, `<Router basename=\"${basename}\"> is not able to match the URL \"${pathname}${search}${hash}\" because it does not start with the basename, so the <Router> won't render anything.`);\n\tif (locationContext == null) return null;\n\treturn /* @__PURE__ */ React$1.createElement(NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React$1.createElement(LocationContext.Provider, {\n\t\tchildren,\n\t\tvalue: locationContext\n\t}));\n}\n/**\n* Renders a branch of {@link Route | `<Route>`s} that best matches the current\n* location. Note that these routes do not participate in [data loading](../../start/framework/route-module#loader),\n* [`action`](../../start/framework/route-module#action), code splitting, or\n* any other [route module](../../start/framework/route-module) features.\n*\n* @example\n* import { Route, Routes } from \"react-router\";\n*\n* <Routes>\n* <Route index element={<StepOne />} />\n* <Route path=\"step-2\" element={<StepTwo />} />\n* <Route path=\"step-3\" element={<StepThree />} />\n* </Routes>\n*\n* @public\n* @category Components\n* @param props Props\n* @param {RoutesProps.children} props.children n/a\n* @param {RoutesProps.location} props.location n/a\n* @returns React element for the rendered routes or `null` if no route matches\n*/\nfunction Routes({ children, location }) {\n\treturn useRoutes(createRoutesFromChildren(children), location);\n}\n/**\n* Used to render promise values with automatic error handling.\n*\n* **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense)\n*\n* @example\n* import { Await, useLoaderData } from \"react-router\";\n*\n* export async function loader() {\n* // not awaited\n* const reviews = getReviews();\n* // awaited (blocks the transition)\n* const book = await fetch(\"/api/book\").then((res) => res.json());\n* return { book, reviews };\n* }\n*\n* function Book() {\n* const { book, reviews } = useLoaderData();\n* return (\n* <div>\n* <h1>{book.title}</h1>\n* <p>{book.description}</p>\n* <React.Suspense fallback={<ReviewsSkeleton />}>\n* <Await\n* resolve={reviews}\n* errorElement={\n* <div>Could not load reviews 😬</div>\n* }\n* children={(resolvedReviews) => (\n* <Reviews items={resolvedReviews} />\n* )}\n* />\n* </React.Suspense>\n* </div>\n* );\n* }\n*\n* @public\n* @category Components\n* @mode framework\n* @mode data\n* @param props Props\n* @param {AwaitProps.children} props.children n/a\n* @param {AwaitProps.errorElement} props.errorElement n/a\n* @param {AwaitProps.resolve} props.resolve n/a\n* @returns React element for the rendered awaited value\n*/\nfunction Await({ children, errorElement, resolve }) {\n\tlet dataRouterContext = React$1.useContext(DataRouterContext);\n\tlet dataRouterStateContext = React$1.useContext(DataRouterStateContext);\n\tlet onError = React$1.useCallback((error, errorInfo) => {\n\t\tif (dataRouterContext && dataRouterContext.onError && dataRouterStateContext) dataRouterContext.onError(error, {\n\t\t\tlocation: dataRouterStateContext.location,\n\t\t\tparams: dataRouterStateContext.matches[0]?.params || {},\n\t\t\tpattern: getRoutePattern(dataRouterStateContext.matches),\n\t\t\terrorInfo\n\t\t});\n\t}, [dataRouterContext, dataRouterStateContext]);\n\treturn /* @__PURE__ */ React$1.createElement(AwaitErrorBoundary, {\n\t\tresolve,\n\t\terrorElement,\n\t\tonError\n\t}, /* @__PURE__ */ React$1.createElement(ResolveAwait, null, children));\n}\nvar AwaitErrorBoundary = class extends React$1.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = { error: null };\n\t}\n\tstatic getDerivedStateFromError(error) {\n\t\treturn { error };\n\t}\n\tcomponentDidCatch(error, errorInfo) {\n\t\tif (this.props.onError) this.props.onError(error, errorInfo);\n\t\telse console.error(\"<Await> caught the following error during render\", error, errorInfo);\n\t}\n\trender() {\n\t\tlet { children, errorElement, resolve } = this.props;\n\t\tlet promise = null;\n\t\tlet status = 0;\n\t\tif (!(resolve instanceof Promise)) {\n\t\t\tstatus = 1;\n\t\t\tpromise = Promise.resolve();\n\t\t\tObject.defineProperty(promise, \"_tracked\", { get: () => true });\n\t\t\tObject.defineProperty(promise, \"_data\", { get: () => resolve });\n\t\t} else if (this.state.error) {\n\t\t\tstatus = 2;\n\t\t\tlet renderError = this.state.error;\n\t\t\tpromise = Promise.reject().catch(() => {});\n\t\t\tObject.defineProperty(promise, \"_tracked\", { get: () => true });\n\t\t\tObject.defineProperty(promise, \"_error\", { get: () => renderError });\n\t\t} else if (resolve._tracked) {\n\t\t\tpromise = resolve;\n\t\t\tstatus = \"_error\" in promise ? 2 : \"_data\" in promise ? 1 : 0;\n\t\t} else {\n\t\t\tstatus = 0;\n\t\t\tObject.defineProperty(resolve, \"_tracked\", { get: () => true });\n\t\t\tpromise = resolve.then((data) => Object.defineProperty(resolve, \"_data\", { get: () => data }), (error) => {\n\t\t\t\tthis.props.onError?.(error);\n\t\t\t\tObject.defineProperty(resolve, \"_error\", { get: () => error });\n\t\t\t});\n\t\t}\n\t\tif (status === 2 && !errorElement) throw promise._error;\n\t\tif (status === 2) return /* @__PURE__ */ React$1.createElement(AwaitContext.Provider, {\n\t\t\tvalue: promise,\n\t\t\tchildren: errorElement\n\t\t});\n\t\tif (status === 1) return /* @__PURE__ */ React$1.createElement(AwaitContext.Provider, {\n\t\t\tvalue: promise,\n\t\t\tchildren\n\t\t});\n\t\tthrow promise;\n\t}\n};\nfunction ResolveAwait({ children }) {\n\tlet data = useAsyncValue();\n\tlet toRender = typeof children === \"function\" ? children(data) : children;\n\treturn /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, toRender);\n}\n/**\n* Creates a route config from a React \"children\" object, which is usually\n* either a `<Route>` element or an array of them. Used internally by\n* `<Routes>` to create a route config from its children.\n*\n* @category Utils\n* @mode data\n* @param children The React children to convert into a route config\n* @param parentPath The path of the parent route, used to generate unique IDs.\n* @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter}\n*/\nfunction createRoutesFromChildren(children, parentPath = []) {\n\tlet routes = [];\n\tReact$1.Children.forEach(children, (element, index) => {\n\t\tif (!React$1.isValidElement(element)) return;\n\t\tlet treePath = [...parentPath, index];\n\t\tif (element.type === React$1.Fragment) {\n\t\t\troutes.push.apply(routes, createRoutesFromChildren(element.props.children, treePath));\n\t\t\treturn;\n\t\t}\n\t\tinvariant(element.type === Route, `[${typeof element.type === \"string\" ? element.type : element.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);\n\t\tlet props = element.props;\n\t\tinvariant(!props.index || !props.children, \"An index route cannot have child routes.\");\n\t\tlet route = {\n\t\t\tid: props.id || treePath.join(\"-\"),\n\t\t\tcaseSensitive: props.caseSensitive,\n\t\t\telement: props.element,\n\t\t\tComponent: props.Component,\n\t\t\tindex: props.index,\n\t\t\tpath: props.path,\n\t\t\tmiddleware: props.middleware,\n\t\t\tloader: props.loader,\n\t\t\taction: props.action,\n\t\t\thydrateFallbackElement: props.hydrateFallbackElement,\n\t\t\tHydrateFallback: props.HydrateFallback,\n\t\t\terrorElement: props.errorElement,\n\t\t\tErrorBoundary: props.ErrorBoundary,\n\t\t\tshouldRevalidate: props.shouldRevalidate,\n\t\t\thandle: props.handle,\n\t\t\tlazy: props.lazy\n\t\t};\n\t\tif (props.children) route.children = createRoutesFromChildren(props.children, treePath);\n\t\troutes.push(route);\n\t});\n\treturn routes;\n}\n/**\n* Create route objects from JSX elements instead of arrays of objects.\n*\n* @example\n* const routes = createRoutesFromElements(\n* <>\n* <Route index loader={step1Loader} Component={StepOne} />\n* <Route path=\"step-2\" loader={step2Loader} Component={StepTwo} />\n* <Route path=\"step-3\" loader={step3Loader} Component={StepThree} />\n* </>\n* );\n*\n* const router = createBrowserRouter(routes);\n*\n* function App() {\n* return <RouterProvider router={router} />;\n* }\n*\n* @name createRoutesFromElements\n* @public\n* @category Utils\n* @mode data\n* @param children The React children to convert into a route config\n* @param parentPath The path of the parent route, used to generate unique IDs.\n* This is used for internal recursion and is not intended to be used by the\n* application developer.\n* @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter}\n*/\nconst createRoutesFromElements = createRoutesFromChildren;\n/**\n* Renders the result of {@link matchRoutes} into a React element.\n*\n* @public\n* @category Utils\n* @param matches The array of {@link RouteMatch | route matches} to render\n* @returns A React element that renders the matched routes or `null` if no matches\n*/\nfunction renderMatches(matches) {\n\treturn _renderMatches(matches);\n}\nfunction useRouteComponentProps() {\n\treturn {\n\t\tparams: useParams(),\n\t\tloaderData: useLoaderData(),\n\t\tactionData: useActionData(),\n\t\tmatches: useMatches()\n\t};\n}\nfunction WithComponentProps({ children }) {\n\tconst props = useRouteComponentProps();\n\treturn React$1.cloneElement(children, props);\n}\nfunction withComponentProps(Component) {\n\treturn function WithComponentProps() {\n\t\tconst props = useRouteComponentProps();\n\t\treturn React$1.createElement(Component, props);\n\t};\n}\nfunction useHydrateFallbackProps() {\n\treturn {\n\t\tparams: useParams(),\n\t\tloaderData: useLoaderData(),\n\t\tactionData: useActionData()\n\t};\n}\nfunction WithHydrateFallbackProps({ children }) {\n\tconst props = useHydrateFallbackProps();\n\treturn React$1.cloneElement(children, props);\n}\nfunction withHydrateFallbackProps(HydrateFallback) {\n\treturn function WithHydrateFallbackProps() {\n\t\tconst props = useHydrateFallbackProps();\n\t\treturn React$1.createElement(HydrateFallback, props);\n\t};\n}\nfunction useErrorBoundaryProps() {\n\treturn {\n\t\tparams: useParams(),\n\t\tloaderData: useLoaderData(),\n\t\tactionData: useActionData(),\n\t\terror: useRouteError()\n\t};\n}\nfunction WithErrorBoundaryProps({ children }) {\n\tconst props = useErrorBoundaryProps();\n\treturn React$1.cloneElement(children, props);\n}\nfunction withErrorBoundaryProps(ErrorBoundary) {\n\treturn function WithErrorBoundaryProps() {\n\t\tconst props = useErrorBoundaryProps();\n\t\treturn React$1.createElement(ErrorBoundary, props);\n\t};\n}\n//#endregion\nexport { Await, DataRoutes, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, WithComponentProps, WithErrorBoundaryProps, WithHydrateFallbackProps, createMemoryRouter, createRoutesFromChildren, createRoutesFromElements, hydrationRouteProperties, renderMatches, withComponentProps, withErrorBoundaryProps, withHydrateFallbackProps };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { warning } from \"../router/history.js\";\nimport { stripBasename } from \"../router/utils.js\";\nconst defaultEncType = \"application/x-www-form-urlencoded\";\nfunction isHtmlElement(object) {\n\treturn typeof HTMLElement !== \"undefined\" && object instanceof HTMLElement;\n}\nfunction isButtonElement(object) {\n\treturn isHtmlElement(object) && object.tagName.toLowerCase() === \"button\";\n}\nfunction isFormElement(object) {\n\treturn isHtmlElement(object) && object.tagName.toLowerCase() === \"form\";\n}\nfunction isInputElement(object) {\n\treturn isHtmlElement(object) && object.tagName.toLowerCase() === \"input\";\n}\nfunction isModifiedEvent(event) {\n\treturn !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\nfunction shouldProcessLinkClick(event, target) {\n\treturn event.button === 0 && (!target || target === \"_self\") && !isModifiedEvent(event);\n}\n/**\n* Creates a URLSearchParams object using the given initializer.\n*\n* This is identical to `new URLSearchParams(init)` except it also supports\n* arrays as values in the object form of the initializer instead of just\n* strings. This is convenient when you need multiple values for a given key,\n* but don't want to use an array initializer.\n*\n* @example\n* // Instead of:\n* let searchParams = new URLSearchParams([\n* [\"sort\", \"name\"],\n* [\"sort\", \"price\"],\n* ]);\n*\n* // You can do:\n* let searchParams = createSearchParams({\n* sort: [\"name\", \"price\"],\n* });\n*\n* @public\n* @category Utils\n* @param init The value used to initialize the URL search parameters.\n* @returns A URLSearchParams object containing the initialized search\n* parameters.\n*/\nfunction createSearchParams(init = \"\") {\n\treturn new URLSearchParams(typeof init === \"string\" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {\n\t\tlet value = init[key];\n\t\treturn memo.concat(Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]);\n\t}, []));\n}\nfunction getSearchParamsForLocation(locationSearch, defaultSearchParams) {\n\tlet searchParams = createSearchParams(locationSearch);\n\tif (defaultSearchParams) defaultSearchParams.forEach((_, key) => {\n\t\tif (!searchParams.has(key)) defaultSearchParams.getAll(key).forEach((value) => {\n\t\t\tsearchParams.append(key, value);\n\t\t});\n\t});\n\treturn searchParams;\n}\nlet _formDataSupportsSubmitter = null;\nfunction isFormDataSubmitterSupported() {\n\tif (_formDataSupportsSubmitter === null) try {\n\t\tnew FormData(document.createElement(\"form\"), 0);\n\t\t_formDataSupportsSubmitter = false;\n\t} catch {\n\t\t_formDataSupportsSubmitter = true;\n\t}\n\treturn _formDataSupportsSubmitter;\n}\nconst supportedFormEncTypes = new Set([\n\t\"application/x-www-form-urlencoded\",\n\t\"multipart/form-data\",\n\t\"text/plain\"\n]);\nfunction getFormEncType(encType) {\n\tif (encType != null && !supportedFormEncTypes.has(encType)) {\n\t\twarning(false, `\"${encType}\" is not a valid \\`encType\\` for \\`<Form>\\`/\\`<fetcher.Form>\\` and will default to \"${defaultEncType}\"`);\n\t\treturn null;\n\t}\n\treturn encType;\n}\nfunction getFormSubmissionInfo(target, basename) {\n\tlet method;\n\tlet action;\n\tlet encType;\n\tlet formData;\n\tlet body;\n\tif (isFormElement(target)) {\n\t\tlet attr = target.getAttribute(\"action\");\n\t\taction = attr ? stripBasename(attr, basename) : null;\n\t\tmethod = target.getAttribute(\"method\") || \"get\";\n\t\tencType = getFormEncType(target.getAttribute(\"enctype\")) || defaultEncType;\n\t\tformData = new FormData(target);\n\t} else if (isButtonElement(target) || isInputElement(target) && (target.type === \"submit\" || target.type === \"image\")) {\n\t\tlet form = target.form;\n\t\tif (form == null) throw new Error(`Cannot submit a <button> or <input type=\"submit\"> without a <form>`);\n\t\tlet attr = target.getAttribute(\"formaction\") || form.getAttribute(\"action\");\n\t\taction = attr ? stripBasename(attr, basename) : null;\n\t\tmethod = target.getAttribute(\"formmethod\") || form.getAttribute(\"method\") || \"get\";\n\t\tencType = getFormEncType(target.getAttribute(\"formenctype\")) || getFormEncType(form.getAttribute(\"enctype\")) || defaultEncType;\n\t\tformData = new FormData(form, target);\n\t\tif (!isFormDataSubmitterSupported()) {\n\t\t\tlet { name, type, value } = target;\n\t\t\tif (type === \"image\") {\n\t\t\t\tlet prefix = name ? `${name}.` : \"\";\n\t\t\t\tformData.append(`${prefix}x`, \"0\");\n\t\t\t\tformData.append(`${prefix}y`, \"0\");\n\t\t\t} else if (name) formData.append(name, value);\n\t\t}\n\t} else if (isHtmlElement(target)) throw new Error(\"Cannot submit element that is not <form>, <button>, or <input type=\\\"submit|image\\\">\");\n\telse {\n\t\tmethod = \"get\";\n\t\taction = null;\n\t\tencType = defaultEncType;\n\t\tbody = target;\n\t}\n\tif (formData && encType === \"text/plain\") {\n\t\tbody = formData;\n\t\tformData = void 0;\n\t}\n\treturn {\n\t\taction,\n\t\tmethod: method.toLowerCase(),\n\t\tencType,\n\t\tformData,\n\t\tbody\n\t};\n}\n//#endregion\nexport { createSearchParams, getFormSubmissionInfo, getSearchParamsForLocation, shouldProcessLinkClick };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\n//#region lib/dom/ssr/invariant.ts\nfunction invariant(value, message) {\n\tif (value === false || value === null || typeof value === \"undefined\") throw new Error(message);\n}\n//#endregion\nexport { invariant as default };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\n//#region lib/dom/ssr/markup.ts\nconst ESCAPE_LOOKUP = {\n\t\"&\": \"\\\\u0026\",\n\t\">\": \"\\\\u003e\",\n\t\"<\": \"\\\\u003c\",\n\t\"\\u2028\": \"\\\\u2028\",\n\t\"\\u2029\": \"\\\\u2029\"\n};\nconst ESCAPE_REGEX = /[&><\\u2028\\u2029]/g;\nfunction escapeHtml(html) {\n\treturn html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);\n}\nfunction escapeAttribute(value) {\n\treturn value.replace(/&/g, \"&amp;\").replace(/\"/g, \"&quot;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\n}\n//#endregion\nexport { escapeAttribute, escapeHtml };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { ErrorResponseImpl, SUPPORTED_ERROR_TYPES, data, isRouteErrorResponse, redirect } from \"../../router/utils.js\";\nimport { isDataWithResponseInit, isResponse } from \"../../router/router.js\";\nimport invariant from \"./invariant.js\";\nimport { escapeHtml } from \"./markup.js\";\nimport { decode } from \"../../../vendor/turbo-stream-v2/turbo-stream.js\";\nimport { createRequestInit } from \"./data.js\";\nimport * as React$1 from \"react\";\n//#region lib/dom/ssr/single-fetch.tsx\nconst SingleFetchRedirectSymbol = Symbol(\"SingleFetchRedirect\");\nvar SingleFetchNoResultError = class extends Error {};\nconst NO_BODY_STATUS_CODES = new Set([\n\t100,\n\t101,\n\t204,\n\t205\n]);\nfunction StreamTransfer({ context, identifier, reader, textDecoder, nonce }) {\n\tif (!context.renderMeta || !context.renderMeta.didRenderScripts) return null;\n\tif (!context.renderMeta.streamCache) context.renderMeta.streamCache = {};\n\tlet { streamCache } = context.renderMeta;\n\tlet promise = streamCache[identifier];\n\tif (!promise) promise = streamCache[identifier] = reader.read().then((result) => {\n\t\tstreamCache[identifier].result = {\n\t\t\tdone: result.done,\n\t\t\tvalue: textDecoder.decode(result.value, { stream: true })\n\t\t};\n\t}).catch((e) => {\n\t\tstreamCache[identifier].error = e;\n\t});\n\tif (promise.error) throw promise.error;\n\tif (promise.result === void 0) throw promise;\n\tlet { done, value } = promise.result;\n\tlet scriptTag = value ? /* @__PURE__ */ React$1.createElement(\"script\", {\n\t\tnonce,\n\t\tdangerouslySetInnerHTML: { __html: `window.__reactRouterContext.streamController.enqueue(${escapeHtml(JSON.stringify(value))});` }\n\t}) : null;\n\tif (done) return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, scriptTag, /* @__PURE__ */ React$1.createElement(\"script\", {\n\t\tnonce,\n\t\tdangerouslySetInnerHTML: { __html: `window.__reactRouterContext.streamController.close();` }\n\t}));\n\telse return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, scriptTag, /* @__PURE__ */ React$1.createElement(React$1.Suspense, null, /* @__PURE__ */ React$1.createElement(StreamTransfer, {\n\t\tcontext,\n\t\tidentifier: identifier + 1,\n\t\treader,\n\t\ttextDecoder,\n\t\tnonce\n\t})));\n}\nfunction getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules, ssr) {\n\tlet dataStrategy = getSingleFetchDataStrategyImpl(getRouter, (match) => {\n\t\tlet manifestRoute = manifest.routes[match.route.id];\n\t\tinvariant(manifestRoute, \"Route not found in manifest\");\n\t\treturn {\n\t\t\thasLoader: manifestRoute.hasLoader,\n\t\t\thasClientLoader: manifestRoute.hasClientLoader\n\t\t};\n\t}, fetchAndDecodeViaTurboStream, ssr);\n\treturn async (args) => args.runClientMiddleware(dataStrategy);\n}\nfunction getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode, ssr, shouldAllowOptOut = () => true) {\n\treturn async (args) => {\n\t\tlet { request, matches, fetcherKey } = args;\n\t\tlet router = getRouter();\n\t\tif (request.method !== \"GET\") return singleFetchActionStrategy(args, fetchAndDecode);\n\t\tlet foundRevalidatingServerLoader = matches.some((m) => {\n\t\t\tlet { hasLoader, hasClientLoader } = getRouteInfo(m);\n\t\t\treturn m.shouldCallHandler() && hasLoader && !hasClientLoader;\n\t\t});\n\t\tif (!ssr && !foundRevalidatingServerLoader) return nonSsrStrategy(args, getRouteInfo, fetchAndDecode);\n\t\tif (fetcherKey) return singleFetchLoaderFetcherStrategy(args, fetchAndDecode);\n\t\treturn singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, fetchAndDecode, ssr, shouldAllowOptOut);\n\t};\n}\nasync function singleFetchActionStrategy(args, fetchAndDecode) {\n\tlet actionMatch = args.matches.find((m) => m.shouldCallHandler());\n\tinvariant(actionMatch, \"No action match found\");\n\tlet actionStatus = void 0;\n\tlet result = await actionMatch.resolve(async (handler) => {\n\t\treturn await handler(async () => {\n\t\t\tlet { data, status } = await fetchAndDecode(args, [actionMatch.route.id]);\n\t\t\tactionStatus = status;\n\t\t\treturn unwrapSingleFetchResult(data, actionMatch.route.id);\n\t\t});\n\t});\n\tif (isResponse(result.result) || isRouteErrorResponse(result.result) || isDataWithResponseInit(result.result)) return { [actionMatch.route.id]: result };\n\treturn { [actionMatch.route.id]: {\n\t\ttype: result.type,\n\t\tresult: data(result.result, actionStatus)\n\t} };\n}\nasync function nonSsrStrategy(args, getRouteInfo, fetchAndDecode) {\n\tlet matchesToLoad = args.matches.filter((m) => m.shouldCallHandler());\n\tlet results = {};\n\tawait Promise.all(matchesToLoad.map(async (m) => {\n\t\tlet routeId = m.route.id;\n\t\tresults[routeId] = await m.resolve(async (handler) => {\n\t\t\tlet { hasClientLoader } = getRouteInfo(m);\n\t\t\treturn hasClientLoader ? handler(async () => {\n\t\t\t\tlet { data } = await fetchAndDecode(args, [routeId]);\n\t\t\t\treturn unwrapSingleFetchResult(data, routeId);\n\t\t\t}) : handler();\n\t\t});\n\t}));\n\treturn results;\n}\nasync function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, fetchAndDecode, ssr, shouldAllowOptOut = () => true) {\n\tlet routesParams = /* @__PURE__ */ new Set();\n\tlet foundOptOutRoute = false;\n\tlet routeDfds = args.matches.map(() => createDeferred());\n\tlet singleFetchDfd = createDeferred();\n\tlet results = {};\n\tlet resolvePromise = Promise.all(args.matches.map(async (m, i) => m.resolve(async (handler) => {\n\t\trouteDfds[i].resolve();\n\t\tlet routeId = m.route.id;\n\t\tlet { hasLoader, hasClientLoader } = getRouteInfo(m);\n\t\tlet defaultShouldRevalidate = !m.shouldRevalidateArgs || m.shouldRevalidateArgs.actionStatus == null || m.shouldRevalidateArgs.actionStatus < 400;\n\t\tif (!m.shouldCallHandler(defaultShouldRevalidate)) {\n\t\t\tfoundOptOutRoute ||= m.shouldRevalidateArgs != null && hasLoader;\n\t\t\treturn;\n\t\t}\n\t\tif (shouldAllowOptOut(m) && hasClientLoader) {\n\t\t\tif (hasLoader) foundOptOutRoute = true;\n\t\t\ttry {\n\t\t\t\tresults[routeId] = {\n\t\t\t\t\ttype: \"data\",\n\t\t\t\t\tresult: await handler(async () => {\n\t\t\t\t\t\tlet { data } = await fetchAndDecode(args, [routeId]);\n\t\t\t\t\t\treturn unwrapSingleFetchResult(data, routeId);\n\t\t\t\t\t})\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\tresults[routeId] = {\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\tresult: e\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (hasLoader) routesParams.add(routeId);\n\t\ttry {\n\t\t\tresults[routeId] = {\n\t\t\t\ttype: \"data\",\n\t\t\t\tresult: await handler(async () => {\n\t\t\t\t\treturn unwrapSingleFetchResult(await singleFetchDfd.promise, routeId);\n\t\t\t\t})\n\t\t\t};\n\t\t} catch (e) {\n\t\t\tresults[routeId] = {\n\t\t\t\ttype: \"error\",\n\t\t\t\tresult: e\n\t\t\t};\n\t\t}\n\t})));\n\tawait Promise.all(routeDfds.map((d) => d.promise));\n\tif ((!router.state.initialized && router.state.navigation.state === \"idle\" || routesParams.size === 0) && !window.__reactRouterHdrActive) singleFetchDfd.resolve({ routes: {} });\n\telse {\n\t\tlet targetRoutes = ssr && foundOptOutRoute && routesParams.size > 0 ? [...routesParams.keys()] : void 0;\n\t\ttry {\n\t\t\tlet data = await fetchAndDecode(args, targetRoutes);\n\t\t\tsingleFetchDfd.resolve(data.data);\n\t\t} catch (e) {\n\t\t\tsingleFetchDfd.reject(e);\n\t\t}\n\t}\n\tawait resolvePromise;\n\tawait bubbleMiddlewareErrors(singleFetchDfd.promise, args.matches, routesParams, results);\n\treturn results;\n}\nasync function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams, results) {\n\ttry {\n\t\tlet middlewareError;\n\t\tlet fetchedData = await singleFetchPromise;\n\t\tif (\"routes\" in fetchedData) {\n\t\t\tfor (let match of matches) if (match.route.id in fetchedData.routes) {\n\t\t\t\tlet routeResult = fetchedData.routes[match.route.id];\n\t\t\t\tif (\"error\" in routeResult) {\n\t\t\t\t\tmiddlewareError = routeResult.error;\n\t\t\t\t\tif (results[match.route.id]?.result == null) results[match.route.id] = {\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\tresult: middlewareError\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (middlewareError !== void 0) Array.from(routesParams.values()).forEach((routeId) => {\n\t\t\tif (results[routeId].result instanceof SingleFetchNoResultError) results[routeId].result = middlewareError;\n\t\t});\n\t} catch {}\n}\nasync function singleFetchLoaderFetcherStrategy(args, fetchAndDecode) {\n\tlet fetcherMatch = args.matches.find((m) => m.shouldCallHandler());\n\tinvariant(fetcherMatch, \"No fetcher match found\");\n\tlet routeId = fetcherMatch.route.id;\n\tlet result = await fetcherMatch.resolve(async (handler) => handler(async () => {\n\t\tlet { data } = await fetchAndDecode(args, [routeId]);\n\t\treturn unwrapSingleFetchResult(data, routeId);\n\t}));\n\treturn { [fetcherMatch.route.id]: result };\n}\nfunction stripIndexParam(url) {\n\tlet indexValues = url.searchParams.getAll(\"index\");\n\turl.searchParams.delete(\"index\");\n\tlet indexValuesToKeep = [];\n\tfor (let indexValue of indexValues) if (indexValue) indexValuesToKeep.push(indexValue);\n\tfor (let toKeep of indexValuesToKeep) url.searchParams.append(\"index\", toKeep);\n\treturn url;\n}\nfunction singleFetchUrl(reqUrl, extension) {\n\tlet url = typeof reqUrl === \"string\" ? new URL(reqUrl, typeof window === \"undefined\" ? \"server://singlefetch/\" : window.location.origin) : reqUrl;\n\tif (url.pathname.endsWith(\"/\")) url.pathname = `${url.pathname}_.${extension}`;\n\telse url.pathname = `${url.pathname}.${extension}`;\n\treturn url;\n}\nasync function fetchAndDecodeViaTurboStream(args, targetRoutes) {\n\tlet { request } = args;\n\tlet url = singleFetchUrl(request.url, \"data\");\n\tif (request.method === \"GET\") {\n\t\turl = stripIndexParam(url);\n\t\tif (targetRoutes) url.searchParams.set(\"_routes\", targetRoutes.join(\",\"));\n\t}\n\tlet res = await fetch(url, await createRequestInit(request));\n\tif (res.status >= 400 && !res.headers.has(\"X-Remix-Response\")) throw new ErrorResponseImpl(res.status, res.statusText, await res.text());\n\tif (res.status === 204 && res.headers.has(\"X-Remix-Redirect\")) return {\n\t\tstatus: 202,\n\t\tdata: { redirect: {\n\t\t\tredirect: res.headers.get(\"X-Remix-Redirect\"),\n\t\t\tstatus: Number(res.headers.get(\"X-Remix-Status\") || \"302\"),\n\t\t\trevalidate: res.headers.get(\"X-Remix-Revalidate\") === \"true\",\n\t\t\treload: res.headers.get(\"X-Remix-Reload-Document\") === \"true\",\n\t\t\treplace: res.headers.get(\"X-Remix-Replace\") === \"true\"\n\t\t} }\n\t};\n\tif (NO_BODY_STATUS_CODES.has(res.status)) {\n\t\tlet routes = {};\n\t\tif (targetRoutes && request.method !== \"GET\") routes[targetRoutes[0]] = { data: void 0 };\n\t\treturn {\n\t\t\tstatus: res.status,\n\t\t\tdata: { routes }\n\t\t};\n\t}\n\tinvariant(res.body, \"No response body to decode\");\n\ttry {\n\t\tlet decoded = await decodeViaTurboStream(res.body, window);\n\t\tlet data;\n\t\tif (request.method === \"GET\") {\n\t\t\tlet typed = decoded.value;\n\t\t\tif (SingleFetchRedirectSymbol in typed) data = { redirect: typed[SingleFetchRedirectSymbol] };\n\t\t\telse data = { routes: typed };\n\t\t} else {\n\t\t\tlet typed = decoded.value;\n\t\t\tlet routeId = targetRoutes?.[0];\n\t\t\tinvariant(routeId, \"No routeId found for single fetch call decoding\");\n\t\t\tif (\"redirect\" in typed) data = { redirect: typed };\n\t\t\telse data = { routes: { [routeId]: typed } };\n\t\t}\n\t\treturn {\n\t\t\tstatus: res.status,\n\t\t\tdata\n\t\t};\n\t} catch (cause) {\n\t\tthrow new Error(\"Unable to decode turbo-stream response\", { cause });\n\t}\n}\nfunction decodeViaTurboStream(body, global) {\n\treturn decode(body, { plugins: [(type, ...rest) => {\n\t\tif (type === \"SanitizedError\") {\n\t\t\tlet [name, message, stack] = rest;\n\t\t\tlet Constructor = Error;\n\t\t\tif (name && SUPPORTED_ERROR_TYPES.includes(name) && name in global && typeof global[name] === \"function\") Constructor = global[name];\n\t\t\tlet error = new Constructor(message);\n\t\t\terror.stack = stack;\n\t\t\treturn { value: error };\n\t\t}\n\t\tif (type === \"ErrorResponse\") {\n\t\t\tlet [data, status, statusText] = rest;\n\t\t\treturn { value: new ErrorResponseImpl(status, statusText, data) };\n\t\t}\n\t\tif (type === \"SingleFetchRedirect\") return { value: { [SingleFetchRedirectSymbol]: rest[0] } };\n\t\tif (type === \"SingleFetchClassInstance\") return { value: rest[0] };\n\t\tif (type === \"SingleFetchFallback\") return { value: void 0 };\n\t}] });\n}\nfunction unwrapSingleFetchResult(result, routeId) {\n\tif (\"redirect\" in result) {\n\t\tlet { redirect: location, revalidate, reload, replace, status } = result.redirect;\n\t\tthrow redirect(location, {\n\t\t\tstatus,\n\t\t\theaders: {\n\t\t\t\t...revalidate ? { \"X-Remix-Revalidate\": \"yes\" } : null,\n\t\t\t\t...reload ? { \"X-Remix-Reload-Document\": \"yes\" } : null,\n\t\t\t\t...replace ? { \"X-Remix-Replace\": \"yes\" } : null\n\t\t\t}\n\t\t});\n\t}\n\tlet routeResult = result.routes[routeId];\n\tif (routeResult == null) throw new SingleFetchNoResultError(`No result found for routeId \"${routeId}\"`);\n\telse if (\"error\" in routeResult) throw routeResult.error;\n\telse if (\"data\" in routeResult) return routeResult.data;\n\telse throw new Error(`Invalid response found for routeId \"${routeId}\"`);\n}\nfunction createDeferred() {\n\tlet resolve;\n\tlet reject;\n\tlet promise = new Promise((res, rej) => {\n\t\tresolve = async (val) => {\n\t\t\tres(val);\n\t\t\ttry {\n\t\t\t\tawait promise;\n\t\t\t} catch {}\n\t\t};\n\t\treject = async (error) => {\n\t\t\trej(error);\n\t\t\ttry {\n\t\t\t\tawait promise;\n\t\t\t} catch {}\n\t\t};\n\t});\n\treturn {\n\t\tpromise,\n\t\tresolve,\n\t\treject\n\t};\n}\n//#endregion\nexport { NO_BODY_STATUS_CODES, SingleFetchRedirectSymbol, StreamTransfer, decodeViaTurboStream, getSingleFetchDataStrategyImpl, getTurboStreamSingleFetchDataStrategy, singleFetchUrl, stripIndexParam };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\n//#region lib/dom/ssr/routeModules.ts\nasync function loadRouteModule(route, routeModulesCache) {\n\tif (route.id in routeModulesCache) return routeModulesCache[route.id];\n\ttry {\n\t\tlet routeModule = await import(\n\t\t\t/* @vite-ignore */\n\t\t\t/* webpackIgnore: true */\n\t\t\troute.module\n);\n\t\trouteModulesCache[route.id] = routeModule;\n\t\treturn routeModule;\n\t} catch (error) {\n\t\tconsole.error(`Error loading route module \\`${route.module}\\`, reloading page...`);\n\t\tconsole.error(error);\n\t\tif (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && import.meta.hot) throw error;\n\t\twindow.location.reload();\n\t\treturn new Promise(() => {});\n\t}\n}\n//#endregion\nexport { loadRouteModule };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { loadRouteModule } from \"./routeModules.js\";\n//#region lib/dom/ssr/links.ts\n/**\n* Gets all the links for a set of matches. The modules are assumed to have been\n* loaded already.\n*/\nfunction getKeyedLinksForMatches(matches, routeModules, manifest) {\n\treturn dedupeLinkDescriptors(matches.map((match) => {\n\t\tlet module = routeModules[match.route.id];\n\t\tlet route = manifest.routes[match.route.id];\n\t\treturn [route && route.css ? route.css.map((href) => ({\n\t\t\trel: \"stylesheet\",\n\t\t\thref\n\t\t})) : [], module?.links?.() || []];\n\t}).flat(2), getModuleLinkHrefs(matches, manifest));\n}\nfunction getRouteCssDescriptors(route) {\n\tif (!route.css) return [];\n\treturn route.css.map((href) => ({\n\t\trel: \"stylesheet\",\n\t\thref\n\t}));\n}\nasync function prefetchRouteCss(route) {\n\tif (!route.css) return;\n\tlet descriptors = getRouteCssDescriptors(route);\n\tawait Promise.all(descriptors.map(prefetchStyleLink));\n}\nasync function prefetchStyleLinks(route, routeModule) {\n\tif (!route.css && !routeModule.links || !isPreloadSupported()) return;\n\tlet descriptors = [];\n\tif (route.css) descriptors.push(...getRouteCssDescriptors(route));\n\tif (routeModule.links) descriptors.push(...routeModule.links());\n\tif (descriptors.length === 0) return;\n\tlet styleLinks = [];\n\tfor (let descriptor of descriptors) if (!isPageLinkDescriptor(descriptor) && descriptor.rel === \"stylesheet\") styleLinks.push({\n\t\t...descriptor,\n\t\trel: \"preload\",\n\t\tas: \"style\"\n\t});\n\tawait Promise.all(styleLinks.map(prefetchStyleLink));\n}\nasync function prefetchStyleLink(descriptor) {\n\treturn new Promise((resolve) => {\n\t\tif (descriptor.media && !window.matchMedia(descriptor.media).matches || document.querySelector(`link[rel=\"stylesheet\"][href=\"${descriptor.href}\"]`)) return resolve();\n\t\tlet link = document.createElement(\"link\");\n\t\tObject.assign(link, descriptor);\n\t\tfunction removeLink() {\n\t\t\tif (document.head.contains(link)) document.head.removeChild(link);\n\t\t}\n\t\tlink.onload = () => {\n\t\t\tremoveLink();\n\t\t\tresolve();\n\t\t};\n\t\tlink.onerror = () => {\n\t\t\tremoveLink();\n\t\t\tresolve();\n\t\t};\n\t\tdocument.head.appendChild(link);\n\t});\n}\nfunction isPageLinkDescriptor(object) {\n\treturn object != null && typeof object.page === \"string\";\n}\nfunction isHtmlLinkDescriptor(object) {\n\tif (object == null) return false;\n\tif (object.href == null) return object.rel === \"preload\" && typeof object.imageSrcSet === \"string\" && typeof object.imageSizes === \"string\";\n\treturn typeof object.rel === \"string\" && typeof object.href === \"string\";\n}\nasync function getKeyedPrefetchLinks(matches, manifest, routeModules) {\n\treturn dedupeLinkDescriptors((await Promise.all(matches.map(async (match) => {\n\t\tlet route = manifest.routes[match.route.id];\n\t\tif (route) {\n\t\t\tlet mod = await loadRouteModule(route, routeModules);\n\t\t\treturn mod.links ? mod.links() : [];\n\t\t}\n\t\treturn [];\n\t}))).flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === \"stylesheet\" || link.rel === \"preload\").map((link) => link.rel === \"stylesheet\" ? {\n\t\t...link,\n\t\trel: \"prefetch\",\n\t\tas: \"style\"\n\t} : {\n\t\t...link,\n\t\trel: \"prefetch\"\n\t}));\n}\nfunction getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {\n\tlet isNew = (match, index) => {\n\t\tif (!currentMatches[index]) return true;\n\t\treturn match.route.id !== currentMatches[index].route.id;\n\t};\n\tlet matchPathChanged = (match, index) => {\n\t\treturn currentMatches[index].pathname !== match.pathname || currentMatches[index].route.path?.endsWith(\"*\") && currentMatches[index].params[\"*\"] !== match.params[\"*\"];\n\t};\n\tif (mode === \"assets\") return nextMatches.filter((match, index) => isNew(match, index) || matchPathChanged(match, index));\n\tif (mode === \"data\") return nextMatches.filter((match, index) => {\n\t\tlet manifestRoute = manifest.routes[match.route.id];\n\t\tif (!manifestRoute || !manifestRoute.hasLoader) return false;\n\t\tif (isNew(match, index) || matchPathChanged(match, index)) return true;\n\t\tif (match.route.shouldRevalidate) {\n\t\t\tlet routeChoice = match.route.shouldRevalidate({\n\t\t\t\tcurrentUrl: new URL(location.pathname + location.search + location.hash, window.origin),\n\t\t\t\tcurrentParams: currentMatches[0]?.params || {},\n\t\t\t\tnextUrl: new URL(page, window.origin),\n\t\t\t\tnextParams: match.params,\n\t\t\t\tdefaultShouldRevalidate: true\n\t\t\t});\n\t\t\tif (typeof routeChoice === \"boolean\") return routeChoice;\n\t\t}\n\t\treturn true;\n\t});\n\treturn [];\n}\nfunction getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {\n\treturn dedupeHrefs(matches.map((match) => {\n\t\tlet route = manifest.routes[match.route.id];\n\t\tif (!route) return [];\n\t\tlet hrefs = [route.module];\n\t\tif (route.clientActionModule) hrefs = hrefs.concat(route.clientActionModule);\n\t\tif (route.clientLoaderModule) hrefs = hrefs.concat(route.clientLoaderModule);\n\t\tif (includeHydrateFallback && route.hydrateFallbackModule) hrefs = hrefs.concat(route.hydrateFallbackModule);\n\t\tif (route.imports) hrefs = hrefs.concat(route.imports);\n\t\treturn hrefs;\n\t}).flat(1));\n}\nfunction dedupeHrefs(hrefs) {\n\treturn [...new Set(hrefs)];\n}\nfunction sortKeys(obj) {\n\tlet sorted = {};\n\tlet keys = Object.keys(obj).sort();\n\tfor (let key of keys) sorted[key] = obj[key];\n\treturn sorted;\n}\nfunction dedupeLinkDescriptors(descriptors, preloads) {\n\tlet set = /* @__PURE__ */ new Set();\n\tlet preloadsSet = new Set(preloads);\n\treturn descriptors.reduce((deduped, descriptor) => {\n\t\tif (preloads && !isPageLinkDescriptor(descriptor) && descriptor.as === \"script\" && descriptor.href && preloadsSet.has(descriptor.href)) return deduped;\n\t\tlet key = JSON.stringify(sortKeys(descriptor));\n\t\tif (!set.has(key)) {\n\t\t\tset.add(key);\n\t\t\tdeduped.push({\n\t\t\t\tkey,\n\t\t\t\tlink: descriptor\n\t\t\t});\n\t\t}\n\t\treturn deduped;\n\t}, []);\n}\nlet _isPreloadSupported;\nfunction isPreloadSupported() {\n\tif (_isPreloadSupported !== void 0) return _isPreloadSupported;\n\tlet el = document.createElement(\"link\");\n\t_isPreloadSupported = el.relList.supports(\"preload\");\n\tel = null;\n\treturn _isPreloadSupported;\n}\n//#endregion\nexport { getKeyedLinksForMatches, getKeyedPrefetchLinks, getModuleLinkHrefs, getNewMatchesForLinks, isPageLinkDescriptor, prefetchRouteCss, prefetchStyleLinks };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { useIsRSCRouterContext } from \"../../context.js\";\nimport { useDataRouterContext, useDataRouterData, useDataRouterState, useLocation } from \"../../hooks.js\";\nimport { warnOnce } from \"../../server-runtime/warnings.js\";\nimport invariant from \"./invariant.js\";\nimport { getKeyedLinksForMatches, getKeyedPrefetchLinks, getModuleLinkHrefs, getNewMatchesForLinks, isPageLinkDescriptor } from \"./links.js\";\nimport { escapeHtml } from \"./markup.js\";\nimport { singleFetchUrl } from \"./single-fetch.js\";\nimport { getPartialManifest, isFogOfWarEnabled } from \"./fog-of-war.js\";\nimport * as React$1 from \"react\";\n//#region lib/dom/ssr/components.tsx\nconst FrameworkContext = React$1.createContext(void 0);\nFrameworkContext.displayName = \"FrameworkContext\";\nfunction useFrameworkContext() {\n\tlet context = React$1.useContext(FrameworkContext);\n\tinvariant(context, \"You must render this element inside a <HydratedRouter> element\");\n\treturn context;\n}\nfunction usePrefetchBehavior(prefetch, theirElementProps) {\n\tlet frameworkContext = React$1.useContext(FrameworkContext);\n\tlet [maybePrefetch, setMaybePrefetch] = React$1.useState(false);\n\tlet [shouldPrefetch, setShouldPrefetch] = React$1.useState(false);\n\tlet { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;\n\tlet ref = React$1.useRef(null);\n\tReact$1.useEffect(() => {\n\t\tif (prefetch === \"render\") setShouldPrefetch(true);\n\t\tif (prefetch === \"viewport\") {\n\t\t\tlet callback = (entries) => {\n\t\t\t\tentries.forEach((entry) => {\n\t\t\t\t\tsetShouldPrefetch(entry.isIntersecting);\n\t\t\t\t});\n\t\t\t};\n\t\t\tlet observer = new IntersectionObserver(callback, { threshold: .5 });\n\t\t\tif (ref.current) observer.observe(ref.current);\n\t\t\treturn () => {\n\t\t\t\tobserver.disconnect();\n\t\t\t};\n\t\t}\n\t}, [prefetch]);\n\tReact$1.useEffect(() => {\n\t\tif (maybePrefetch) {\n\t\t\tlet id = setTimeout(() => {\n\t\t\t\tsetShouldPrefetch(true);\n\t\t\t}, 100);\n\t\t\treturn () => {\n\t\t\t\tclearTimeout(id);\n\t\t\t};\n\t\t}\n\t}, [maybePrefetch]);\n\tlet setIntent = () => {\n\t\tsetMaybePrefetch(true);\n\t};\n\tlet cancelIntent = () => {\n\t\tsetMaybePrefetch(false);\n\t\tsetShouldPrefetch(false);\n\t};\n\tif (!frameworkContext) return [\n\t\tfalse,\n\t\tref,\n\t\t{}\n\t];\n\tif (prefetch !== \"intent\") return [\n\t\tshouldPrefetch,\n\t\tref,\n\t\t{}\n\t];\n\treturn [\n\t\tshouldPrefetch,\n\t\tref,\n\t\t{\n\t\t\tonFocus: composeEventHandlers(onFocus, setIntent),\n\t\t\tonBlur: composeEventHandlers(onBlur, cancelIntent),\n\t\t\tonMouseEnter: composeEventHandlers(onMouseEnter, setIntent),\n\t\t\tonMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),\n\t\t\tonTouchStart: composeEventHandlers(onTouchStart, setIntent)\n\t\t}\n\t];\n}\nfunction composeEventHandlers(theirHandler, ourHandler) {\n\treturn (event) => {\n\t\ttheirHandler && theirHandler(event);\n\t\tif (!event.defaultPrevented) ourHandler(event);\n\t};\n}\nfunction getActiveMatches(matches, errors, isSpaMode) {\n\tif (isSpaMode && !isHydrated) return [matches[0]];\n\tif (errors) {\n\t\tlet errorIdx = matches.findIndex((m) => errors[m.route.id] !== void 0);\n\t\treturn matches.slice(0, errorIdx + 1);\n\t}\n\treturn matches;\n}\nconst CRITICAL_CSS_DATA_ATTRIBUTE = \"data-react-router-critical-css\";\n/**\n* Renders all the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)\n* tags created by the route module's [`links`](../../start/framework/route-module#links)\n* export. You should render it inside the [`<head>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head)\n* of your document.\n*\n* @example\n* import { Links } from \"react-router\";\n*\n* export default function Root() {\n* return (\n* <html>\n* <head>\n* <Links />\n* </head>\n* <body></body>\n* </html>\n* );\n* }\n*\n* @public\n* @category Components\n* @mode framework\n* @param props Props\n* @param {LinksProps.nonce} props.nonce n/a\n* @param {LinksProps.crossOrigin} props.crossOrigin n/a\n* @returns A collection of React elements for [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)\n* tags\n*/\nfunction Links({ nonce, crossOrigin }) {\n\tlet { isSpaMode, manifest, routeModules, criticalCss, nonce: contextNonce } = useFrameworkContext();\n\tlet { matches: routerMatches } = useDataRouterState(\"Links\");\n\tlet { errors } = useDataRouterData(\"Links\");\n\tlet matches = getActiveMatches(routerMatches, errors, isSpaMode);\n\tlet keyedLinks = React$1.useMemo(() => getKeyedLinksForMatches(matches, routeModules, manifest), [\n\t\tmatches,\n\t\trouteModules,\n\t\tmanifest\n\t]);\n\tif (nonce == null && contextNonce) nonce = contextNonce;\n\treturn /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, typeof criticalCss === \"string\" ? /* @__PURE__ */ React$1.createElement(\"style\", {\n\t\t[CRITICAL_CSS_DATA_ATTRIBUTE]: \"\",\n\t\tnonce,\n\t\tdangerouslySetInnerHTML: { __html: criticalCss }\n\t}) : null, typeof criticalCss === \"object\" ? /* @__PURE__ */ React$1.createElement(\"link\", {\n\t\t[CRITICAL_CSS_DATA_ATTRIBUTE]: \"\",\n\t\trel: \"stylesheet\",\n\t\thref: criticalCss.href,\n\t\tnonce,\n\t\tcrossOrigin\n\t}) : null, keyedLinks.map(({ key, link }) => isPageLinkDescriptor(link) ? /* @__PURE__ */ React$1.createElement(PrefetchPageLinks, {\n\t\tkey,\n\t\tnonce,\n\t\t...link,\n\t\tcrossOrigin: link.crossOrigin ?? crossOrigin\n\t}) : /* @__PURE__ */ React$1.createElement(\"link\", {\n\t\tkey,\n\t\tnonce,\n\t\t...link,\n\t\tcrossOrigin: link.crossOrigin ?? crossOrigin\n\t})));\n}\n/**\n* Renders [`<link rel=prefetch|modulepreload>`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/rel)\n* tags for modules and data of another page to enable an instant navigation to\n* that page. [`<Link prefetch>`](./Link#prefetch) uses this internally, but you\n* can render it to prefetch a page for any other reason.\n*\n* For example, you may render one of this as the user types into a search field\n* to prefetch search results before they click through to their selection.\n*\n* @example\n* import { PrefetchPageLinks } from \"react-router\";\n*\n* <PrefetchPageLinks page=\"/absolute/path\" />\n*\n* @public\n* @category Components\n* @mode framework\n* @param props Props\n* @param {PageLinkDescriptor.page} props.page n/a\n* @param props.linkProps Additional props to spread onto the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)\n* tags, such as [`crossOrigin`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/crossOrigin),\n* [`integrity`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/integrity),\n* [`rel`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement/rel),\n* etc.\n* @returns A collection of React elements for [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)\n* tags\n*/\nfunction PrefetchPageLinks({ page, ...linkProps }) {\n\tlet rsc = useIsRSCRouterContext();\n\tlet { nonce: contextNonce } = useFrameworkContext();\n\tlet { router } = useDataRouterContext(\"PrefetchPageLinks\");\n\tlet matches = React$1.useMemo(() => router.match(page), [\n\t\trouter,\n\t\trouter.routes,\n\t\tpage\n\t]);\n\tif (!matches) return null;\n\tif (linkProps.nonce == null && contextNonce) linkProps = {\n\t\t...linkProps,\n\t\tnonce: contextNonce\n\t};\n\tif (rsc) return /* @__PURE__ */ React$1.createElement(RSCPrefetchPageLinksImpl, {\n\t\tpage,\n\t\tmatches,\n\t\t...linkProps\n\t});\n\treturn /* @__PURE__ */ React$1.createElement(PrefetchPageLinksImpl, {\n\t\tpage,\n\t\tmatches,\n\t\t...linkProps\n\t});\n}\nfunction useKeyedPrefetchLinks(matches) {\n\tlet { manifest, routeModules } = useFrameworkContext();\n\tlet [keyedPrefetchLinks, setKeyedPrefetchLinks] = React$1.useState([]);\n\tReact$1.useEffect(() => {\n\t\tlet interrupted = false;\n\t\tgetKeyedPrefetchLinks(matches, manifest, routeModules).then((links) => {\n\t\t\tif (!interrupted) setKeyedPrefetchLinks(links);\n\t\t});\n\t\treturn () => {\n\t\t\tinterrupted = true;\n\t\t};\n\t}, [\n\t\tmatches,\n\t\tmanifest,\n\t\trouteModules\n\t]);\n\treturn keyedPrefetchLinks;\n}\nfunction RSCPrefetchPageLinksImpl({ page, matches: nextMatches, ...linkProps }) {\n\tlet location = useLocation();\n\tlet dataHrefs = React$1.useMemo(() => {\n\t\tif (page === location.pathname + location.search + location.hash) return [];\n\t\tlet url = singleFetchUrl(page, \"rsc\");\n\t\tlet hasSomeRoutesWithShouldRevalidate = false;\n\t\tlet targetRoutes = [];\n\t\tfor (let match of nextMatches) if (typeof match.route.shouldRevalidate === \"function\") hasSomeRoutesWithShouldRevalidate = true;\n\t\telse targetRoutes.push(match.route.id);\n\t\tif (hasSomeRoutesWithShouldRevalidate && targetRoutes.length > 0) url.searchParams.set(\"_routes\", targetRoutes.join(\",\"));\n\t\treturn [url.pathname + url.search];\n\t}, [\n\t\tpage,\n\t\tlocation,\n\t\tnextMatches\n\t]);\n\treturn /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React$1.createElement(\"link\", {\n\t\tkey: href,\n\t\trel: \"prefetch\",\n\t\tas: \"fetch\",\n\t\thref,\n\t\t...linkProps\n\t})));\n}\nfunction PrefetchPageLinksImpl({ page, matches: nextMatches, ...linkProps }) {\n\tlet location = useLocation();\n\tlet { manifest, routeModules } = useFrameworkContext();\n\tlet { matches } = useDataRouterState(\"PrefetchPageLinks\");\n\tlet { loaderData } = useDataRouterData(\"PrefetchPageLinks\");\n\tlet newMatchesForData = React$1.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, manifest, location, \"data\"), [\n\t\tpage,\n\t\tnextMatches,\n\t\tmatches,\n\t\tmanifest,\n\t\tlocation\n\t]);\n\tlet newMatchesForAssets = React$1.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, manifest, location, \"assets\"), [\n\t\tpage,\n\t\tnextMatches,\n\t\tmatches,\n\t\tmanifest,\n\t\tlocation\n\t]);\n\tlet dataHrefs = React$1.useMemo(() => {\n\t\tif (page === location.pathname + location.search + location.hash) return [];\n\t\tlet routesParams = /* @__PURE__ */ new Set();\n\t\tlet foundOptOutRoute = false;\n\t\tnextMatches.forEach((m) => {\n\t\t\tlet manifestRoute = manifest.routes[m.route.id];\n\t\t\tif (!manifestRoute || !manifestRoute.hasLoader) return;\n\t\t\tif (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) foundOptOutRoute = true;\n\t\t\telse if (manifestRoute.hasClientLoader) foundOptOutRoute = true;\n\t\t\telse routesParams.add(m.route.id);\n\t\t});\n\t\tif (routesParams.size === 0) return [];\n\t\tlet url = singleFetchUrl(page, \"data\");\n\t\tif (foundOptOutRoute && routesParams.size > 0) url.searchParams.set(\"_routes\", nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(\",\"));\n\t\treturn [url.pathname + url.search];\n\t}, [\n\t\tloaderData,\n\t\tlocation,\n\t\tmanifest,\n\t\tnewMatchesForData,\n\t\tnextMatches,\n\t\tpage,\n\t\trouteModules\n\t]);\n\tlet moduleHrefs = React$1.useMemo(() => getModuleLinkHrefs(newMatchesForAssets, manifest), [newMatchesForAssets, manifest]);\n\tlet keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);\n\treturn /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React$1.createElement(\"link\", {\n\t\tkey: href,\n\t\trel: \"prefetch\",\n\t\tas: \"fetch\",\n\t\thref,\n\t\t...linkProps\n\t})), moduleHrefs.map((href) => /* @__PURE__ */ React$1.createElement(\"link\", {\n\t\tkey: href,\n\t\trel: \"modulepreload\",\n\t\thref,\n\t\t...linkProps\n\t})), keyedPrefetchLinks.map(({ key, link }) => /* @__PURE__ */ React$1.createElement(\"link\", {\n\t\tkey,\n\t\tnonce: linkProps.nonce,\n\t\t...link,\n\t\tcrossOrigin: link.crossOrigin ?? linkProps.crossOrigin\n\t})));\n}\n/**\n* Renders all the [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta)\n* tags created by the route module's [`meta`](../../start/framework/route-module#meta)\n* export. You should render it inside the [`<head>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head)\n* of your document.\n*\n* @example\n* import { Meta } from \"react-router\";\n*\n* export default function Root() {\n* return (\n* <html>\n* <head>\n* <Meta />\n* </head>\n* </html>\n* );\n* }\n*\n* @public\n* @category Components\n* @mode framework\n* @returns A collection of React elements for [`<meta>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta)\n* tags\n*/\nfunction Meta() {\n\tlet { isSpaMode, routeModules } = useFrameworkContext();\n\tlet { matches: routerMatches } = useDataRouterState(\"Meta\");\n\tlet { errors, loaderData } = useDataRouterData(\"Meta\");\n\tlet location = useLocation();\n\tlet _matches = getActiveMatches(routerMatches, errors, isSpaMode);\n\tlet error = null;\n\tif (errors) error = errors[_matches[_matches.length - 1].route.id];\n\tlet meta = [];\n\tlet leafMeta = null;\n\tlet matches = [];\n\tfor (let i = 0; i < _matches.length; i++) {\n\t\tlet _match = _matches[i];\n\t\tlet routeId = _match.route.id;\n\t\tlet data = loaderData[routeId];\n\t\tlet params = _match.params;\n\t\tlet routeModule = routeModules[routeId];\n\t\tlet routeMeta = [];\n\t\tlet match = {\n\t\t\tid: routeId,\n\t\t\tloaderData: data,\n\t\t\tmeta: [],\n\t\t\tparams: _match.params,\n\t\t\tpathname: _match.pathname,\n\t\t\thandle: _match.route.handle,\n\t\t\terror\n\t\t};\n\t\tmatches[i] = match;\n\t\tif (routeModule?.meta) routeMeta = typeof routeModule.meta === \"function\" ? routeModule.meta({\n\t\t\tloaderData: data,\n\t\t\tparams,\n\t\t\tlocation,\n\t\t\tmatches,\n\t\t\terror\n\t\t}) : Array.isArray(routeModule.meta) ? [...routeModule.meta] : routeModule.meta;\n\t\telse if (leafMeta) routeMeta = [...leafMeta];\n\t\trouteMeta = routeMeta || [];\n\t\tif (!Array.isArray(routeMeta)) throw new Error(\"The route at \" + _match.route.path + \" returns an invalid value. All route meta functions must return an array of meta objects.\\n\\nTo reference the meta function API, see https://reactrouter.com/start/framework/route-module#meta\");\n\t\tmatch.meta = routeMeta;\n\t\tmatches[i] = match;\n\t\tmeta = [...routeMeta];\n\t\tleafMeta = meta;\n\t}\n\treturn /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, meta.flat().map((metaProps) => {\n\t\tif (!metaProps) return null;\n\t\tif (\"tagName\" in metaProps) {\n\t\t\tlet { tagName, ...rest } = metaProps;\n\t\t\tif (!isValidMetaTag(tagName)) {\n\t\t\t\tconsole.warn(`A meta object uses an invalid tagName: ${tagName}. Expected either 'link' or 'meta'`);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet Comp = tagName;\n\t\t\treturn /* @__PURE__ */ React$1.createElement(Comp, {\n\t\t\t\tkey: JSON.stringify(rest),\n\t\t\t\t...rest\n\t\t\t});\n\t\t}\n\t\tif (\"title\" in metaProps) return /* @__PURE__ */ React$1.createElement(\"title\", { key: \"title\" }, String(metaProps.title));\n\t\tif (\"charset\" in metaProps) {\n\t\t\tmetaProps.charSet ??= metaProps.charset;\n\t\t\tdelete metaProps.charset;\n\t\t}\n\t\tif (\"charSet\" in metaProps && metaProps.charSet != null) return typeof metaProps.charSet === \"string\" ? /* @__PURE__ */ React$1.createElement(\"meta\", {\n\t\t\tkey: \"charSet\",\n\t\t\tcharSet: metaProps.charSet\n\t\t}) : null;\n\t\tif (\"script:ld+json\" in metaProps) try {\n\t\t\tlet json = JSON.stringify(metaProps[\"script:ld+json\"]);\n\t\t\treturn /* @__PURE__ */ React$1.createElement(\"script\", {\n\t\t\t\tkey: `script:ld+json:${json}`,\n\t\t\t\ttype: \"application/ld+json\",\n\t\t\t\tdangerouslySetInnerHTML: { __html: escapeHtml(json) }\n\t\t\t});\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t\treturn /* @__PURE__ */ React$1.createElement(\"meta\", {\n\t\t\tkey: JSON.stringify(metaProps),\n\t\t\t...metaProps\n\t\t});\n\t}));\n}\nfunction isValidMetaTag(tagName) {\n\treturn typeof tagName === \"string\" && /^(meta|link)$/.test(tagName);\n}\n/**\n* Tracks whether hydration is finished, so scripts can be skipped\n* during client-side updates.\n*/\nlet isHydrated = false;\nfunction setIsHydrated() {\n\tisHydrated = true;\n}\n/**\n* Renders the client runtime of your app. It should be rendered inside the\n* [`<body>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body)\n* of the document.\n*\n* If server rendering, you can omit `<Scripts/>` and the app will work as a\n* traditional web app without JavaScript, relying solely on HTML and browser\n* behaviors.\n*\n* @example\n* import { Scripts } from \"react-router\";\n*\n* export default function Root() {\n* return (\n* <html>\n* <head />\n* <body>\n* <Scripts />\n* </body>\n* </html>\n* );\n* }\n*\n* @public\n* @category Components\n* @mode framework\n* @param scriptProps Additional props to spread onto the [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)\n* tags, such as [`crossOrigin`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement/crossOrigin),\n* [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce),\n* etc.\n* @returns A collection of React elements for [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)\n* tags\n*/\nfunction Scripts(scriptProps) {\n\tlet { manifest, serverHandoffString, isSpaMode, renderMeta, routeDiscovery, ssr, nonce: contextNonce } = useFrameworkContext();\n\tlet { router, static: isStatic, staticContext } = useDataRouterContext(\"Scripts\");\n\tlet { matches: routerMatches } = useDataRouterState(\"Scripts\");\n\tlet isRSCRouterContext = useIsRSCRouterContext();\n\tlet enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);\n\tif (scriptProps.nonce == null && contextNonce) scriptProps = {\n\t\t...scriptProps,\n\t\tnonce: contextNonce\n\t};\n\tif (renderMeta) renderMeta.didRenderScripts = true;\n\tlet matches = getActiveMatches(routerMatches, null, isSpaMode);\n\tReact$1.useEffect(() => {\n\t\tsetIsHydrated();\n\t}, []);\n\tlet initialScripts = React$1.useMemo(() => {\n\t\tif (isRSCRouterContext) return null;\n\t\tlet contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());` : \" \";\n\t\tlet routeModulesScript = !isStatic ? \" \" : `${manifest.hmr?.runtime ? `import ${JSON.stringify(manifest.hmr.runtime)};` : \"\"}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : \"\"};\n${matches.map((match, routeIndex) => {\n\t\t\tlet routeVarName = `route${routeIndex}`;\n\t\t\tlet manifestEntry = manifest.routes[match.route.id];\n\t\t\tinvariant(manifestEntry, `Route ${match.route.id} not found in manifest`);\n\t\t\tlet { clientActionModule, clientLoaderModule, clientMiddlewareModule, hydrateFallbackModule, module } = manifestEntry;\n\t\t\tlet chunks = [\n\t\t\t\t...clientActionModule ? [{\n\t\t\t\t\tmodule: clientActionModule,\n\t\t\t\t\tvarName: `${routeVarName}_clientAction`\n\t\t\t\t}] : [],\n\t\t\t\t...clientLoaderModule ? [{\n\t\t\t\t\tmodule: clientLoaderModule,\n\t\t\t\t\tvarName: `${routeVarName}_clientLoader`\n\t\t\t\t}] : [],\n\t\t\t\t...clientMiddlewareModule ? [{\n\t\t\t\t\tmodule: clientMiddlewareModule,\n\t\t\t\t\tvarName: `${routeVarName}_clientMiddleware`\n\t\t\t\t}] : [],\n\t\t\t\t...hydrateFallbackModule ? [{\n\t\t\t\t\tmodule: hydrateFallbackModule,\n\t\t\t\t\tvarName: `${routeVarName}_HydrateFallback`\n\t\t\t\t}] : [],\n\t\t\t\t{\n\t\t\t\t\tmodule,\n\t\t\t\t\tvarName: `${routeVarName}_main`\n\t\t\t\t}\n\t\t\t];\n\t\t\tif (chunks.length === 1) return `import * as ${routeVarName} from ${JSON.stringify(module)};`;\n\t\t\treturn [chunks.map((chunk) => `import * as ${chunk.varName} from \"${chunk.module}\";`).join(\"\\n\"), `const ${routeVarName} = {${chunks.map((chunk) => `...${chunk.varName}`).join(\",\")}};`].join(\"\\n\");\n\t\t}).join(\"\\n\")}\n ${enableFogOfWar ? `window.__reactRouterManifest = ${JSON.stringify(getPartialManifest(manifest, router), null, 2)};` : \"\"}\n window.__reactRouterRouteModules = {${matches.map((match, index) => `${JSON.stringify(match.route.id)}:route${index}`).join(\",\")}};\n\nimport(${JSON.stringify(manifest.entry.module)});`;\n\t\treturn /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, /* @__PURE__ */ React$1.createElement(\"script\", {\n\t\t\t...scriptProps,\n\t\t\tsuppressHydrationWarning: true,\n\t\t\tdangerouslySetInnerHTML: { __html: contextScript },\n\t\t\ttype: void 0\n\t\t}), /* @__PURE__ */ React$1.createElement(\"script\", {\n\t\t\t...scriptProps,\n\t\t\tsuppressHydrationWarning: true,\n\t\t\tdangerouslySetInnerHTML: { __html: routeModulesScript },\n\t\t\ttype: \"module\",\n\t\t\tasync: true\n\t\t}));\n\t}, []);\n\tlet preloads = isHydrated || isRSCRouterContext ? [] : [...new Set(manifest.entry.imports.concat(getModuleLinkHrefs(matches, manifest, { includeHydrateFallback: true })))];\n\tlet sri = typeof manifest.sri === \"object\" ? manifest.sri : {};\n\twarnOnce(!isRSCRouterContext, \"The <Scripts /> element is a no-op when using RSC and can be safely removed.\");\n\treturn isHydrated || isRSCRouterContext ? null : /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, typeof manifest.sri === \"object\" ? /* @__PURE__ */ React$1.createElement(\"script\", {\n\t\t...scriptProps,\n\t\t\"rr-importmap\": \"\",\n\t\ttype: \"importmap\",\n\t\tsuppressHydrationWarning: true,\n\t\tdangerouslySetInnerHTML: { __html: JSON.stringify({ integrity: sri }) }\n\t}) : null, !enableFogOfWar ? /* @__PURE__ */ React$1.createElement(\"link\", {\n\t\trel: \"modulepreload\",\n\t\thref: manifest.url,\n\t\tcrossOrigin: scriptProps.crossOrigin,\n\t\tintegrity: sri[manifest.url],\n\t\tnonce: scriptProps.nonce,\n\t\tsuppressHydrationWarning: true\n\t}) : null, /* @__PURE__ */ React$1.createElement(\"link\", {\n\t\trel: \"modulepreload\",\n\t\thref: manifest.entry.module,\n\t\tcrossOrigin: scriptProps.crossOrigin,\n\t\tintegrity: sri[manifest.entry.module],\n\t\tnonce: scriptProps.nonce,\n\t\tsuppressHydrationWarning: true\n\t}), preloads.map((path) => /* @__PURE__ */ React$1.createElement(\"link\", {\n\t\tkey: path,\n\t\trel: \"modulepreload\",\n\t\thref: path,\n\t\tcrossOrigin: scriptProps.crossOrigin,\n\t\tintegrity: sri[path],\n\t\tnonce: scriptProps.nonce,\n\t\tsuppressHydrationWarning: true\n\t})), initialScripts);\n}\nfunction mergeRefs(...refs) {\n\treturn (value) => {\n\t\trefs.forEach((ref) => {\n\t\t\tif (typeof ref === \"function\") ref(value);\n\t\t\telse if (ref != null) ref.current = value;\n\t\t});\n\t};\n}\n//#endregion\nexport { CRITICAL_CSS_DATA_ATTRIBUTE, FrameworkContext, Links, Meta, PrefetchPageLinks, Scripts, mergeRefs, setIsHydrated, useFrameworkContext, usePrefetchBehavior };\n","/**\n * react-router v8.4.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport { ABSOLUTE_URL_REGEX } from \"../router/url.js\";\nimport { createBrowserHistory, createHashHistory, createPath, invariant, warning } from \"../router/history.js\";\nimport { ErrorResponseImpl, SUPPORTED_ERROR_TYPES, defaultMapRouteProperties, joinPaths, matchPath, parseToInfo, resolveTo, stripBasename } from \"../router/utils.js\";\nimport { IDLE_FETCHER, createRouter } from \"../router/router.js\";\nimport { DataRouterNavigationContext, NavigationContext, RouteContext, ViewTransitionContext } from \"../context.js\";\nimport { useBlocker, useCurrentRouteId, useDataRouterContext, useDataRouterFetchers, useDataRouterState, useHref, useLocation, useMatches, useNavigate, useNavigation, useResolvedPath } from \"../hooks.js\";\nimport { Router, hydrationRouteProperties } from \"../components.js\";\nimport { createSearchParams, getFormSubmissionInfo, getSearchParamsForLocation, shouldProcessLinkClick } from \"./dom.js\";\nimport { escapeHtml } from \"./ssr/markup.js\";\nimport { FrameworkContext, PrefetchPageLinks, mergeRefs, usePrefetchBehavior } from \"./ssr/components.js\";\nimport * as React$1 from \"react\";\n//#region lib/dom/lib.tsx\nconst isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\" && typeof window.document.createElement !== \"undefined\";\ntry {\n\tif (isBrowser) window.__reactRouterVersion = \"8\";\n} catch {}\n/**\n* Create a new {@link DataRouter| data router} that manages the application\n* path via [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState)\n* and [`history.replaceState`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState).\n*\n* Data Routers should not be held in React state. You should create your router\n* once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.\n* You can use `patchRoutesOnNavigation` to add additional routes programmatically.\n*\n* @public\n* @category Data Routers\n* @mode data\n* @param routes Application routes\n* @param opts Options\n* @param {DOMRouterOpts.basename} opts.basename n/a\n* @param {DOMRouterOpts.dataStrategy} opts.dataStrategy n/a\n* @param {DOMRouterOpts.future} opts.future n/a\n* @param {DOMRouterOpts.getContext} opts.getContext n/a\n* @param {DOMRouterOpts.hydrationData} opts.hydrationData n/a\n* @param {DOMRouterOpts.instrumentations} opts.instrumentations n/a\n* @param {DOMRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a\n* @param {DOMRouterOpts.window} opts.window n/a\n* @returns An initialized {@link DataRouter| data router} to pass to {@link RouterProvider | `<RouterProvider>`}\n*/\nfunction createBrowserRouter(routes, opts) {\n\treturn createRouter({\n\t\tbasename: opts?.basename,\n\t\tgetContext: opts?.getContext,\n\t\tfuture: opts?.future,\n\t\thistory: createBrowserHistory({ window: opts?.window }),\n\t\thydrationData: opts?.hydrationData || parseHydrationData(),\n\t\troutes,\n\t\tmapRouteProperties: defaultMapRouteProperties,\n\t\thydrationRouteProperties,\n\t\tdataStrategy: opts?.dataStrategy,\n\t\tpatchRoutesOnNavigation: opts?.patchRoutesOnNavigation,\n\t\twindow: opts?.window,\n\t\tinstrumentations: opts?.instrumentations\n\t}).initialize();\n}\n/**\n* Create a new {@link DataRouter| data router} that manages the application\n* path via the URL [`hash`](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash).\n*\n* Data Routers should not be held in React state. You should create your router\n* once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.\n* You can use `patchRoutesOnNavigation` to add additional routes programmatically.\n*\n* @public\n* @category Data Routers\n* @mode data\n* @param routes Application routes\n* @param opts Options\n* @param {DOMRouterOpts.basename} opts.basename n/a\n* @param {DOMRouterOpts.future} opts.future n/a\n* @param {DOMRouterOpts.getContext} opts.getContext n/a\n* @param {DOMRouterOpts.hydrationData} opts.hydrationData n/a\n* @param {DOMRouterOpts.instrumentations} opts.instrumentations n/a\n* @param {DOMRouterOpts.dataStrategy} opts.dataStrategy n/a\n* @param {DOMRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a\n* @param {DOMRouterOpts.window} opts.window n/a\n* @returns An initialized {@link DataRouter| data router} to pass to {@link RouterProvider | `<RouterProvider>`}\n*/\nfunction createHashRouter(routes, opts) {\n\treturn createRouter({\n\t\tbasename: opts?.basename,\n\t\tgetContext: opts?.getContext,\n\t\tfuture: opts?.future,\n\t\thistory: createHashHistory({ window: opts?.window }),\n\t\thydrationData: opts?.hydrationData || parseHydrationData(),\n\t\troutes,\n\t\tmapRouteProperties: defaultMapRouteProperties,\n\t\thydrationRouteProperties,\n\t\tdataStrategy: opts?.dataStrategy,\n\t\tpatchRoutesOnNavigation: opts?.patchRoutesOnNavigation,\n\t\twindow: opts?.window,\n\t\tinstrumentations: opts?.instrumentations\n\t}).initialize();\n}\nfunction parseHydrationData() {\n\tlet state = window?.__staticRouterHydrationData;\n\tif (state && state.errors) state = {\n\t\t...state,\n\t\terrors: deserializeErrors(state.errors)\n\t};\n\treturn state;\n}\nfunction deserializeErrors(errors) {\n\tif (!errors) return null;\n\tlet entries = Object.entries(errors);\n\tlet serialized = {};\n\tfor (let [key, val] of entries) if (val && val.__type === \"RouteErrorResponse\") serialized[key] = new ErrorResponseImpl(val.status, val.statusText, val.data, val.internal === true);\n\telse if (val && val.__type === \"Error\") {\n\t\tif (typeof val.__subType === \"string\" && SUPPORTED_ERROR_TYPES.includes(val.__subType)) {\n\t\t\tlet ErrorConstructor = window[val.__subType];\n\t\t\tif (typeof ErrorConstructor === \"function\") try {\n\t\t\t\tlet error = new ErrorConstructor(val.message);\n\t\t\t\terror.stack = \"\";\n\t\t\t\tserialized[key] = error;\n\t\t\t} catch {}\n\t\t}\n\t\tif (serialized[key] == null) {\n\t\t\tlet error = new Error(val.message);\n\t\t\terror.stack = \"\";\n\t\t\tserialized[key] = error;\n\t\t}\n\t} else serialized[key] = val;\n\treturn serialized;\n}\n/**\n* A declarative {@link Router | `<Router>`} using the browser [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)\n* API for client-side routing.\n*\n* @public\n* @category Declarative Routers\n* @mode declarative\n* @param props Props\n* @param {BrowserRouterProps.basename} props.basename n/a\n* @param {BrowserRouterProps.children} props.children n/a\n* @param {BrowserRouterProps.useTransitions} props.useTransitions n/a\n* @param {BrowserRouterProps.window} props.window n/a\n* @returns A declarative {@link Router | `<Router>`} using the browser [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)\n* API for client-side routing.\n*/\nfunction BrowserRouter({ basename, children, useTransitions, window }) {\n\tlet historyRef = React$1.useRef(null);\n\tif (historyRef.current == null) historyRef.current = createBrowserHistory({\n\t\twindow,\n\t\tv5Compat: true\n\t});\n\tlet history = historyRef.current;\n\tlet [state, setStateImpl] = React$1.useState({\n\t\taction: history.action,\n\t\tlocation: history.location\n\t});\n\tlet setState = React$1.useCallback((newState) => {\n\t\tif (useTransitions === false) setStateImpl(newState);\n\t\telse React$1.startTransition(() => setStateImpl(newState));\n\t}, [useTransitions]);\n\tReact$1.useLayoutEffect(() => history.listen(setState), [history, setState]);\n\treturn /* @__PURE__ */ React$1.createElement(Router, {\n\t\tbasename,\n\t\tchildren,\n\t\tlocation: state.location,\n\t\tnavigationType: state.action,\n\t\tnavigator: history,\n\t\tuseTransitions\n\t});\n}\n/**\n* A declarative {@link Router | `<Router>`} that stores the location in the\n* [`hash`](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash) portion\n* of the URL so it is not sent to the server.\n*\n* @public\n* @category Declarative Routers\n* @mode declarative\n* @param props Props\n* @param {HashRouterProps.basename} props.basename n/a\n* @param {HashRouterProps.children} props.children n/a\n* @param {HashRouterProps.useTransitions} props.useTransitions n/a\n* @param {HashRouterProps.window} props.window n/a\n* @returns A declarative {@link Router | `<Router>`} using the URL [`hash`](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash)\n* for client-side routing.\n*/\nfunction HashRouter({ basename, children, useTransitions, window }) {\n\tlet historyRef = React$1.useRef(null);\n\tif (historyRef.current == null) historyRef.current = createHashHistory({\n\t\twindow,\n\t\tv5Compat: true\n\t});\n\tlet history = historyRef.current;\n\tlet [state, setStateImpl] = React$1.useState({\n\t\taction: history.action,\n\t\tlocation: history.location\n\t});\n\tlet setState = React$1.useCallback((newState) => {\n\t\tif (useTransitions === false) setStateImpl(newState);\n\t\telse React$1.startTransition(() => setStateImpl(newState));\n\t}, [useTransitions]);\n\tReact$1.useLayoutEffect(() => history.listen(setState), [history, setState]);\n\treturn /* @__PURE__ */ React$1.createElement(Router, {\n\t\tbasename,\n\t\tchildren,\n\t\tlocation: state.location,\n\t\tnavigationType: state.action,\n\t\tnavigator: history,\n\t\tuseTransitions\n\t});\n}\n/**\n* A declarative {@link Router | `<Router>`} that accepts a pre-instantiated\n* `history` object.\n* It's important to note that using your own `history` object is highly discouraged\n* and may add two versions of the `history` library to your bundles unless you use\n* the same version of the `history` library that React Router uses internally.\n*\n* @name unstable_HistoryRouter\n* @public\n* @category Declarative Routers\n* @mode declarative\n* @param props Props\n* @param {HistoryRouterProps.basename} props.basename n/a\n* @param {HistoryRouterProps.children} props.children n/a\n* @param {HistoryRouterProps.history} props.history n/a\n* @param {HistoryRouterProps.useTransitions} props.useTransitions n/a\n* @returns A declarative {@link Router | `<Router>`} using the provided history\n* implementation for client-side routing.\n*/\nfunction HistoryRouter({ basename, children, history, useTransitions }) {\n\tlet [state, setStateImpl] = React$1.useState({\n\t\taction: history.action,\n\t\tlocation: history.location\n\t});\n\tlet setState = React$1.useCallback((newState) => {\n\t\tif (useTransitions === false) setStateImpl(newState);\n\t\telse React$1.startTransition(() => setStateImpl(newState));\n\t}, [useTransitions]);\n\tReact$1.useLayoutEffect(() => history.listen(setState), [history, setState]);\n\treturn /* @__PURE__ */ React$1.createElement(Router, {\n\t\tbasename,\n\t\tchildren,\n\t\tlocation: state.location,\n\t\tnavigationType: state.action,\n\t\tnavigator: history,\n\t\tuseTransitions\n\t});\n}\nHistoryRouter.displayName = \"unstable_HistoryRouter\";\n/**\n* A progressively enhanced [`<a href>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a)\n* wrapper to enable navigation with client-side routing.\n*\n* @example\n* import { Link } from \"react-router\";\n*\n* <Link to=\"/dashboard\">Dashboard</Link>;\n*\n* <Link\n* to={{\n* pathname: \"/some/path\",\n* search: \"?query=string\",\n* hash: \"#hash\",\n* }}\n* />;\n*\n* @public\n* @category Components\n* @param {LinkProps.discover} props.discover [modes: framework] n/a\n* @param {LinkProps.prefetch} props.prefetch [modes: framework] n/a\n* @param {LinkProps.preventScrollReset} props.preventScrollReset [modes: framework, data] n/a\n* @param {LinkProps.relative} props.relative n/a\n* @param {LinkProps.reloadDocument} props.reloadDocument n/a\n* @param {LinkProps.replace} props.replace n/a\n* @param {LinkProps.state} props.state n/a\n* @param {LinkProps.to} props.to n/a\n* @param {LinkProps.viewTransition} props.viewTransition [modes: framework, data] n/a\n* @param {LinkProps.defaultShouldRevalidate} props.defaultShouldRevalidate n/a\n* @param {LinkProps.mask} props.mask [modes: framework, data] n/a\n*/\nconst Link = React$1.forwardRef(function LinkWithRef({ onClick, discover = \"render\", prefetch = \"none\", relative, reloadDocument, replace, mask, state, target, to, preventScrollReset, viewTransition, defaultShouldRevalidate, ...rest }, forwardedRef) {\n\tlet { basename, navigator, useTransitions } = React$1.useContext(NavigationContext);\n\tlet isAbsolute = typeof to === \"string\" && ABSOLUTE_URL_REGEX.test(to);\n\tlet parsed = parseToInfo(to, basename);\n\tto = parsed.to;\n\tlet href = useHref(to, { relative });\n\tlet location = useLocation();\n\tlet maskedHref = null;\n\tif (mask) {\n\t\tlet resolved = resolveTo(mask, [], location.mask ? location.mask.pathname : \"/\", true);\n\t\tif (basename !== \"/\") resolved.pathname = resolved.pathname === \"/\" ? basename : joinPaths([basename, resolved.pathname]);\n\t\tmaskedHref = navigator.createHref(resolved);\n\t}\n\tlet [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(prefetch, rest);\n\tlet internalOnClick = useLinkClickHandler(to, {\n\t\treplace,\n\t\tmask,\n\t\tstate,\n\t\ttarget,\n\t\tpreventScrollReset,\n\t\trelative,\n\t\tviewTransition,\n\t\tdefaultShouldRevalidate,\n\t\tuseTransitions\n\t});\n\tfunction handleClick(event) {\n\t\tif (onClick) onClick(event);\n\t\tif (!event.defaultPrevented) internalOnClick(event);\n\t}\n\tlet isSpaLink = !(parsed.isExternal || reloadDocument);\n\tlet link = /* @__PURE__ */ React$1.createElement(\"a\", {\n\t\t...rest,\n\t\t...prefetchHandlers,\n\t\thref: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href,\n\t\tonClick: isSpaLink ? handleClick : onClick,\n\t\tref: mergeRefs(forwardedRef, prefetchRef),\n\t\ttarget,\n\t\t\"data-discover\": !isAbsolute && discover === \"render\" ? \"true\" : void 0\n\t});\n\treturn shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, link, /* @__PURE__ */ React$1.createElement(PrefetchPageLinks, { page: href })) : link;\n});\nLink.displayName = \"Link\";\n/**\n* Wraps {@link Link | `<Link>`} with additional props for styling active and\n* pending states.\n*\n* - Automatically applies classes to the link based on its `active` and `pending`\n* states, see {@link NavLinkProps.className}\n* - Note that `pending` is only available with Framework and Data modes.\n* - Automatically applies `aria-current=\"page\"` to the link when the link is active.\n* See [`aria-current`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)\n* on MDN.\n* - States are additionally available through the className, style, and children\n* render props. See {@link NavLinkRenderProps}.\n*\n* @example\n* <NavLink to=\"/message\">Messages</NavLink>\n*\n* // Using render props\n* <NavLink\n* to=\"/messages\"\n* className={({ isActive, isPending }) =>\n* isPending ? \"pending\" : isActive ? \"active\" : \"\"\n* }\n* >\n* Messages\n* </NavLink>\n*\n* @public\n* @category Components\n* @param {NavLinkProps.caseSensitive} props.caseSensitive n/a\n* @param {NavLinkProps.children} props.children n/a\n* @param {NavLinkProps.className} props.className n/a\n* @param {NavLinkProps.discover} props.discover [modes: framework] n/a\n* @param {NavLinkProps.end} props.end n/a\n* @param {NavLinkProps.prefetch} props.prefetch [modes: framework] n/a\n* @param {NavLinkProps.preventScrollReset} props.preventScrollReset [modes: framework, data] n/a\n* @param {NavLinkProps.relative} props.relative n/a\n* @param {NavLinkProps.reloadDocument} props.reloadDocument n/a\n* @param {NavLinkProps.replace} props.replace n/a\n* @param {NavLinkProps.state} props.state n/a\n* @param {NavLinkProps.style} props.style n/a\n* @param {NavLinkProps.to} props.to n/a\n* @param {NavLinkProps.viewTransition} props.viewTransition [modes: framework, data] n/a\n*/\nconst NavLink = React$1.forwardRef(function NavLinkWithRef({ \"aria-current\": ariaCurrentProp = \"page\", caseSensitive = false, className: classNameProp = \"\", end = false, style: styleProp, to, viewTransition, children, ...rest }, ref) {\n\tlet path = useResolvedPath(to, { relative: rest.relative });\n\tlet location = useLocation();\n\tlet routerNavigation = React$1.useContext(DataRouterNavigationContext);\n\tlet { navigator, basename } = React$1.useContext(NavigationContext);\n\tlet isTransitioning = routerNavigation != null && useViewTransitionState(path) && viewTransition === true;\n\tlet toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;\n\tlet locationPathname = location.pathname;\n\tlet nextLocationPathname = routerNavigation?.navigation.location ? routerNavigation.navigation.location.pathname : null;\n\tif (!caseSensitive) {\n\t\tlocationPathname = locationPathname.toLowerCase();\n\t\tnextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;\n\t\ttoPathname = toPathname.toLowerCase();\n\t}\n\tif (nextLocationPathname && basename) nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;\n\tconst endSlashPosition = toPathname !== \"/\" && toPathname.endsWith(\"/\") ? toPathname.length - 1 : toPathname.length;\n\tlet isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === \"/\";\n\tlet isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(endSlashPosition) === \"/\");\n\tlet renderProps = {\n\t\tisActive,\n\t\tisPending,\n\t\tisTransitioning\n\t};\n\tlet ariaCurrent = isActive ? ariaCurrentProp : void 0;\n\tlet className;\n\tif (typeof classNameProp === \"function\") className = classNameProp(renderProps);\n\telse className = [\n\t\tclassNameProp,\n\t\tisActive ? \"active\" : null,\n\t\tisPending ? \"pending\" : null,\n\t\tisTransitioning ? \"transitioning\" : null\n\t].filter(Boolean).join(\" \");\n\tlet style = typeof styleProp === \"function\" ? styleProp(renderProps) : styleProp;\n\treturn /* @__PURE__ */ React$1.createElement(Link, {\n\t\t...rest,\n\t\t\"aria-current\": ariaCurrent,\n\t\tclassName,\n\t\tref,\n\t\tstyle,\n\t\tto,\n\t\tviewTransition\n\t}, typeof children === \"function\" ? children(renderProps) : children);\n});\nNavLink.displayName = \"NavLink\";\n/**\n* A progressively enhanced HTML [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form)\n* that submits data to actions via [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch),\n* activating pending states in {@link useNavigation} which enables advanced\n* user interfaces beyond a basic HTML [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form).\n* After a form's `action` completes, all data on the page is automatically\n* revalidated to keep the UI in sync with the data.\n*\n* Because it uses the HTML form API, server rendered pages are interactive at a\n* basic level before JavaScript loads. Instead of React Router managing the\n* submission, the browser manages the submission as well as the pending states\n* (like the spinning favicon). After JavaScript loads, React Router takes over\n* enabling web application user experiences.\n*\n* `Form` is most useful for submissions that should also change the URL or\n* otherwise add an entry to the browser history stack. For forms that shouldn't\n* manipulate the browser [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)\n* stack, use {@link FetcherWithComponents.Form | `<fetcher.Form>`}.\n*\n* @example\n* import { Form } from \"react-router\";\n*\n* function NewEvent() {\n* return (\n* <Form action=\"/events\" method=\"post\">\n* <input name=\"title\" type=\"text\" />\n* <input name=\"description\" type=\"text\" />\n* </Form>\n* );\n* }\n*\n* @public\n* @category Components\n* @mode framework\n* @mode data\n* @param {FormProps.action} action n/a\n* @param {FormProps.discover} discover n/a\n* @param {FormProps.encType} encType n/a\n* @param {FormProps.fetcherKey} fetcherKey n/a\n* @param {FormProps.method} method n/a\n* @param {FormProps.navigate} navigate n/a\n* @param {FormProps.preventScrollReset} preventScrollReset n/a\n* @param {FormProps.relative} relative n/a\n* @param {FormProps.reloadDocument} reloadDocument n/a\n* @param {FormProps.replace} replace n/a\n* @param {FormProps.state} state n/a\n* @param {FormProps.viewTransition} viewTransition n/a\n* @param {FormProps.defaultShouldRevalidate} defaultShouldRevalidate n/a\n* @returns A progressively enhanced [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) component\n*/\nconst Form = React$1.forwardRef(({ discover = \"render\", fetcherKey, navigate, reloadDocument, replace, state, method = \"get\", action, onSubmit, relative, preventScrollReset, viewTransition, defaultShouldRevalidate, ...props }, forwardedRef) => {\n\tlet { useTransitions } = React$1.useContext(NavigationContext);\n\tlet submit = useSubmit();\n\tlet formAction = useFormAction(action, { relative });\n\tlet formMethod = method.toLowerCase() === \"get\" ? \"get\" : \"post\";\n\tlet isAbsolute = typeof action === \"string\" && ABSOLUTE_URL_REGEX.test(action);\n\tlet submitHandler = (event) => {\n\t\tonSubmit && onSubmit(event);\n\t\tif (event.defaultPrevented) return;\n\t\tevent.preventDefault();\n\t\tlet submitter = event.nativeEvent.submitter;\n\t\tlet submitMethod = submitter?.getAttribute(\"formmethod\") || method;\n\t\tlet doSubmit = () => submit(submitter || event.currentTarget, {\n\t\t\tfetcherKey,\n\t\t\tmethod: submitMethod,\n\t\t\tnavigate,\n\t\t\treplace,\n\t\t\tstate,\n\t\t\trelative,\n\t\t\tpreventScrollReset,\n\t\t\tviewTransition,\n\t\t\tdefaultShouldRevalidate\n\t\t});\n\t\tif (useTransitions && navigate !== false) React$1.startTransition(() => doSubmit());\n\t\telse doSubmit();\n\t};\n\treturn /* @__PURE__ */ React$1.createElement(\"form\", {\n\t\tref: forwardedRef,\n\t\tmethod: formMethod,\n\t\taction: formAction,\n\t\tonSubmit: reloadDocument ? onSubmit : submitHandler,\n\t\t...props,\n\t\t\"data-discover\": !isAbsolute && discover === \"render\" ? \"true\" : void 0\n\t});\n});\nForm.displayName = \"Form\";\n/**\n* Emulates the browser's scroll restoration on location changes. Apps should only render one of these, right before the {@link Scripts} component.\n*\n* ```tsx\n* import { ScrollRestoration } from \"react-router\";\n*\n* export default function Root() {\n* return (\n* <html>\n* <body>\n* <ScrollRestoration />\n* <Scripts />\n* </body>\n* </html>\n* );\n* }\n* ```\n*\n* This component renders an inline `<script>` to prevent scroll flashing. The\n* `nonce` prop will be passed down to the script tag to allow CSP nonce usage.\n* If not provided in Framework Mode, it will default to any\n* {@link ServerRouter | `<ServerRouter nonce>`} prop.\n*\n* ```tsx\n* <ScrollRestoration nonce={cspNonce} />\n* ```\n*\n* @public\n* @category Components\n* @mode framework\n* @mode data\n* @param props Props\n* @param {ScrollRestorationProps.getKey} props.getKey n/a\n* @param {ScriptsProps.nonce} props.nonce n/a\n* @param {ScrollRestorationProps.storageKey} props.storageKey n/a\n* @returns A [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)\n* tag that restores scroll positions on navigation.\n*/\nfunction ScrollRestoration({ getKey, storageKey, ...props }) {\n\tlet remixContext = React$1.useContext(FrameworkContext);\n\tlet { basename } = React$1.useContext(NavigationContext);\n\tlet location = useLocation();\n\tlet matches = useMatches();\n\tuseScrollRestoration({\n\t\tgetKey,\n\t\tstorageKey\n\t});\n\tlet ssrKey = React$1.useMemo(() => {\n\t\tif (!remixContext || !getKey) return null;\n\t\tlet userKey = getScrollRestorationKey(location, matches, basename, getKey);\n\t\treturn userKey !== location.key ? userKey : null;\n\t}, []);\n\tif (!remixContext || remixContext.isSpaMode) return null;\n\tlet restoreScroll = ((storageKey, restoreKey) => {\n\t\tif (!window.history.state || !window.history.state.key) {\n\t\t\tlet key = Math.random().toString(32).slice(2);\n\t\t\twindow.history.replaceState({ key }, \"\");\n\t\t}\n\t\ttry {\n\t\t\tlet storedY = JSON.parse(sessionStorage.getItem(storageKey) || \"{}\")[restoreKey || window.history.state.key];\n\t\t\tif (typeof storedY === \"number\") window.scrollTo(0, storedY);\n\t\t} catch (error) {\n\t\t\tconsole.error(error);\n\t\t\tsessionStorage.removeItem(storageKey);\n\t\t}\n\t}).toString();\n\tif (props.nonce == null && remixContext?.nonce) props.nonce = remixContext.nonce;\n\treturn /* @__PURE__ */ React$1.createElement(\"script\", {\n\t\t...props,\n\t\tsuppressHydrationWarning: true,\n\t\tdangerouslySetInnerHTML: { __html: `(${restoreScroll})(${escapeHtml(JSON.stringify(storageKey || SCROLL_RESTORATION_STORAGE_KEY))}, ${escapeHtml(JSON.stringify(ssrKey))})` }\n\t});\n}\nScrollRestoration.displayName = \"ScrollRestoration\";\n/**\n* Handles the click behavior for router {@link Link | `<Link>`} components.This\n* is useful if you need to create custom {@link Link | `<Link>`} components with\n* the same click behavior we use in our exported {@link Link | `<Link>`}.\n*\n* @public\n* @category Hooks\n* @param to The URL to navigate to, can be a string or a partial {@link Path}.\n* @param options Options\n* @param options.preventScrollReset Whether to prevent the scroll position from\n* being reset to the top of the viewport on completion of the navigation when\n* using the {@link ScrollRestoration} component. Defaults to `false`.\n* @param options.relative The {@link RelativeRoutingType | relative routing type}\n* to use for the link. Defaults to `\"route\"`.\n* @param options.replace Whether to replace the current [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)\n* entry instead of pushing a new one. Defaults to `false`.\n* @param options.state The state to add to the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)\n* entry for this navigation. Defaults to `undefined`.\n* @param options.target The target attribute for the link. Defaults to `undefined`.\n* @param options.viewTransition Enables a [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)\n* for this navigation. To apply specific styles during the transition, see\n* {@link useViewTransitionState}. Defaults to `false`.\n* @param options.defaultShouldRevalidate Specify the default revalidation\n* behavior for the navigation. When not specified, loaders revalidate\n* according to the router's standard revalidation behavior.\n* @param options.mask Masked location to display in the browser instead\n* of the router location. Defaults to `undefined`.\n* @param options.useTransitions Wraps the navigation in\n* [`React.startTransition`](https://react.dev/reference/react/startTransition)\n* for concurrent rendering. Defaults to `false`.\n* @returns A click handler function that can be used in a custom {@link Link} component.\n*/\nfunction useLinkClickHandler(to, { target, replace: replaceProp, mask, state, preventScrollReset, relative, viewTransition, defaultShouldRevalidate, useTransitions } = {}) {\n\tlet navigate = useNavigate();\n\tlet location = useLocation();\n\tlet path = useResolvedPath(to, { relative });\n\treturn React$1.useCallback((event) => {\n\t\tif (shouldProcessLinkClick(event, target)) {\n\t\t\tevent.preventDefault();\n\t\t\tlet replace = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);\n\t\t\tlet doNavigate = () => navigate(to, {\n\t\t\t\treplace,\n\t\t\t\tmask,\n\t\t\t\tstate,\n\t\t\t\tpreventScrollReset,\n\t\t\t\trelative,\n\t\t\t\tviewTransition,\n\t\t\t\tdefaultShouldRevalidate\n\t\t\t});\n\t\t\tif (useTransitions) React$1.startTransition(() => doNavigate());\n\t\t\telse doNavigate();\n\t\t}\n\t}, [\n\t\tlocation,\n\t\tnavigate,\n\t\tpath,\n\t\treplaceProp,\n\t\tmask,\n\t\tstate,\n\t\ttarget,\n\t\tto,\n\t\tpreventScrollReset,\n\t\trelative,\n\t\tviewTransition,\n\t\tdefaultShouldRevalidate,\n\t\tuseTransitions\n\t]);\n}\n/**\n* Returns a tuple of the current URL's [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)\n* and a function to update them. Setting the search params causes a navigation.\n*\n* ```tsx\n* import { useSearchParams } from \"react-router\";\n*\n* export function SomeComponent() {\n* const [searchParams, setSearchParams] = useSearchParams();\n* // ...\n* }\n* ```\n*\n* ### `setSearchParams` function\n*\n* The second element of the tuple is a function that can be used to update the\n* search params. It accepts the same types as `defaultInit` and will cause a\n* navigation to the new URL.\n*\n* ```tsx\n* let [searchParams, setSearchParams] = useSearchParams();\n*\n* // a search param string\n* setSearchParams(\"?tab=1\");\n*\n* // a shorthand object\n* setSearchParams({ tab: \"1\" });\n*\n* // object keys can be arrays for multiple values on the key\n* setSearchParams({ brand: [\"nike\", \"reebok\"] });\n*\n* // an array of tuples\n* setSearchParams([[\"tab\", \"1\"]]);\n*\n* // a `URLSearchParams` object\n* setSearchParams(new URLSearchParams(\"?tab=1\"));\n* ```\n*\n* It also supports a function callback like React's\n* [`setState`](https://react.dev/reference/react/useState#setstate):\n*\n* ```tsx\n* setSearchParams((searchParams) => {\n* searchParams.set(\"tab\", \"2\");\n* return searchParams;\n* });\n* ```\n*\n* <docs-warning>The function callback version of `setSearchParams` does not support\n* the [queueing](https://react.dev/reference/react/useState#setstate-parameters)\n* logic that React's `setState` implements. Multiple calls to `setSearchParams`\n* in the same tick will not build on the prior value. If you need this behavior,\n* you can use `setState` manually.</docs-warning>\n*\n* ### Notes\n*\n* Note that `searchParams` is a stable reference, so you can reliably use it\n* as a dependency in React's [`useEffect`](https://react.dev/reference/react/useEffect)\n* hooks.\n*\n* ```tsx\n* useEffect(() => {\n* console.log(searchParams.get(\"tab\"));\n* }, [searchParams]);\n* ```\n*\n* However, this also means it's mutable. If you change the object without\n* calling `setSearchParams`, its values will change between renders if some\n* other state causes the component to re-render and URL will not reflect the\n* values.\n*\n* @public\n* @category Hooks\n* @param defaultInit\n* You can initialize the search params with a default value, though it **will\n* not** change the URL on the first render.\n*\n* ```tsx\n* // a search param string\n* useSearchParams(\"?tab=1\");\n*\n* // a shorthand object\n* useSearchParams({ tab: \"1\" });\n*\n* // object keys can be arrays for multiple values on the key\n* useSearchParams({ brand: [\"nike\", \"reebok\"] });\n*\n* // an array of tuples\n* useSearchParams([[\"tab\", \"1\"]]);\n*\n* // a `URLSearchParams` object\n* useSearchParams(new URLSearchParams(\"?tab=1\"));\n* ```\n* @returns A tuple of the current [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)\n* and a function to update them.\n*/\nfunction useSearchParams(defaultInit) {\n\twarning(typeof URLSearchParams !== \"undefined\", \"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.\");\n\tlet defaultSearchParamsRef = React$1.useRef(createSearchParams(defaultInit));\n\tlet hasSetSearchParamsRef = React$1.useRef(false);\n\tlet location = useLocation();\n\tlet searchParams = React$1.useMemo(() => getSearchParamsForLocation(location.search, hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current), [location.search]);\n\tlet navigate = useNavigate();\n\treturn [searchParams, React$1.useCallback((nextInit, navigateOptions) => {\n\t\tconst newSearchParams = createSearchParams(typeof nextInit === \"function\" ? nextInit(new URLSearchParams(searchParams)) : nextInit);\n\t\thasSetSearchParamsRef.current = true;\n\t\tnavigate(\"?\" + newSearchParams, navigateOptions);\n\t}, [navigate, searchParams])];\n}\nlet fetcherId = 0;\nlet getUniqueFetcherId = () => `__${String(++fetcherId)}__`;\n/**\n* The imperative version of {@link Form | `<Form>`} that lets you submit a form\n* from code instead of a user interaction.\n*\n* @example\n* import { useSubmit } from \"react-router\";\n*\n* function SomeComponent() {\n* const submit = useSubmit();\n* return (\n* <Form onChange={(event) => submit(event.currentTarget)} />\n* );\n* }\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns A function that can be called to submit a {@link Form} imperatively.\n*/\nfunction useSubmit() {\n\tlet { router } = useDataRouterContext(\"useSubmit\");\n\tlet { basename } = React$1.useContext(NavigationContext);\n\tlet currentRouteId = useCurrentRouteId(\"useSubmit\");\n\tlet routerFetch = router.fetch;\n\tlet routerNavigate = router.navigate;\n\treturn React$1.useCallback(async (target, options = {}) => {\n\t\tlet { action, method, encType, formData, body } = getFormSubmissionInfo(target, basename);\n\t\tif (options.navigate === false) await routerFetch(options.fetcherKey || getUniqueFetcherId(), currentRouteId, options.action || action, {\n\t\t\tdefaultShouldRevalidate: options.defaultShouldRevalidate,\n\t\t\tpreventScrollReset: options.preventScrollReset,\n\t\t\trelative: options.relative,\n\t\t\tformData,\n\t\t\tbody,\n\t\t\tformMethod: options.method || method,\n\t\t\tformEncType: options.encType || encType,\n\t\t\tflushSync: options.flushSync\n\t\t});\n\t\telse await routerNavigate(options.action || action, {\n\t\t\tdefaultShouldRevalidate: options.defaultShouldRevalidate,\n\t\t\tpreventScrollReset: options.preventScrollReset,\n\t\t\trelative: options.relative,\n\t\t\tformData,\n\t\t\tbody,\n\t\t\tformMethod: options.method || method,\n\t\t\tformEncType: options.encType || encType,\n\t\t\treplace: options.replace,\n\t\t\tstate: options.state,\n\t\t\tfromRouteId: currentRouteId,\n\t\t\tflushSync: options.flushSync,\n\t\t\tviewTransition: options.viewTransition\n\t\t});\n\t}, [\n\t\trouterFetch,\n\t\trouterNavigate,\n\t\tbasename,\n\t\tcurrentRouteId\n\t]);\n}\n/**\n* Resolves the URL to the closest route in the component hierarchy instead of\n* the current URL of the app.\n*\n* This is used internally by {@link Form} to resolve the `action` to the closest\n* route, but can be used generically as well.\n*\n* ```ts\n* import { useFormAction } from \"react-router\";\n*\n* function SomeComponent() {\n* // closest route URL\n* let action = useFormAction();\n*\n* // closest route URL + \"destroy\"\n* let destroyAction = useFormAction(\"destroy\");\n* }\n* ```\n*\n* <docs-info>This hook adds a `basename` if your app specifies one, so that it\n* can be used with raw `<form>` elements in a progressively enhanced way. If\n* you are using this to provide an `action` to `<Form>` or `fetcher.submit`, you\n* will need to remove the `basename` since both of those will prepend it\n* internally.</docs-info>\n*\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @param action The action to append to the closest route URL. Defaults to the\n* closest route URL.\n* @param options Options\n* @param options.relative The relative routing type to use when resolving the\n* action. Defaults to `\"route\"`.\n* @returns The resolved action URL.\n*/\nfunction useFormAction(action, { relative } = {}) {\n\tlet { basename } = React$1.useContext(NavigationContext);\n\tlet routeContext = React$1.useContext(RouteContext);\n\tinvariant(routeContext, \"useFormAction must be used inside a RouteContext\");\n\tlet [match] = routeContext.matches.slice(-1);\n\tlet path = { ...useResolvedPath(action ? action : \".\", { relative }) };\n\tlet location = useLocation();\n\tif (action == null) {\n\t\tpath.search = location.search;\n\t\tlet params = new URLSearchParams(path.search);\n\t\tlet indexValues = params.getAll(\"index\");\n\t\tif (indexValues.some((v) => v === \"\")) {\n\t\t\tparams.delete(\"index\");\n\t\t\tindexValues.filter((v) => v).forEach((v) => params.append(\"index\", v));\n\t\t\tlet qs = params.toString();\n\t\t\tpath.search = qs ? `?${qs}` : \"\";\n\t\t}\n\t}\n\tif ((!action || action === \".\") && match.route.index) path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n\tif (basename !== \"/\") path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n\treturn createPath(path);\n}\n/**\n* Useful for creating complex, dynamic user interfaces that require multiple,\n* concurrent data interactions without causing a navigation.\n*\n* Fetchers track their own, independent state and can be used to load data, submit\n* forms, and generally interact with [`action`](../../start/framework/route-module#action)\n* and [`loader`](../../start/framework/route-module#loader) functions.\n*\n* @example\n* import { useFetcher } from \"react-router\"\n*\n* function SomeComponent() {\n* let fetcher = useFetcher()\n*\n* // states are available on the fetcher\n* fetcher.state // \"idle\" | \"loading\" | \"submitting\"\n* fetcher.data // the data returned from the action or loader\n*\n* // render a form\n* <fetcher.Form method=\"post\" />\n*\n* // load data\n* fetcher.load(\"/some/route\")\n*\n* // submit data\n* fetcher.submit(someFormRef, { method: \"post\" })\n* fetcher.submit(someData, {\n* method: \"post\",\n* encType: \"application/json\"\n* })\n*\n* // reset fetcher\n* fetcher.reset()\n* }\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @param options Options\n* @param options.key A unique key to identify the fetcher.\n*\n*\n* By default, `useFetcher` generates a unique fetcher scoped to that component.\n* If you want to identify a fetcher with your own key such that you can access\n* it from elsewhere in your app, you can do that with the `key` option:\n*\n* ```tsx\n* function SomeComp() {\n* let fetcher = useFetcher({ key: \"my-key\" })\n* // ...\n* }\n*\n* // Somewhere else\n* function AnotherComp() {\n* // this will be the same fetcher, sharing the state across the app\n* let fetcher = useFetcher({ key: \"my-key\" });\n* // ...\n* }\n* ```\n* @returns A {@link FetcherWithComponents} object that contains the fetcher's state, data, and components for submitting forms and loading data.\n*/\nfunction useFetcher({ key } = {}) {\n\tlet { router } = useDataRouterContext(\"useFetcher\");\n\tlet fetchersContext = useDataRouterFetchers(\"useFetcher\");\n\tlet routeId = useCurrentRouteId(\"useFetcher\");\n\tlet defaultKey = React$1.useId();\n\tlet [fetcherKey, setFetcherKey] = React$1.useState(key || defaultKey);\n\tif (key && key !== fetcherKey) setFetcherKey(key);\n\tlet { deleteFetcher, getFetcher, resetFetcher, fetch: routerFetch } = router;\n\tReact$1.useEffect(() => {\n\t\tgetFetcher(fetcherKey);\n\t\treturn () => deleteFetcher(fetcherKey);\n\t}, [\n\t\tdeleteFetcher,\n\t\tgetFetcher,\n\t\tfetcherKey\n\t]);\n\tlet load = React$1.useCallback(async (href, opts) => {\n\t\tinvariant(routeId, \"No routeId available for fetcher.load()\");\n\t\tawait routerFetch(fetcherKey, routeId, href, opts);\n\t}, [\n\t\tfetcherKey,\n\t\trouteId,\n\t\trouterFetch\n\t]);\n\tlet submitImpl = useSubmit();\n\tlet submit = React$1.useCallback(async (target, opts) => {\n\t\tawait submitImpl(target, {\n\t\t\t...opts,\n\t\t\tnavigate: false,\n\t\t\tfetcherKey\n\t\t});\n\t}, [fetcherKey, submitImpl]);\n\tlet reset = React$1.useCallback((opts) => resetFetcher(fetcherKey, opts), [resetFetcher, fetcherKey]);\n\tlet FetcherForm = React$1.useMemo(() => {\n\t\tlet FetcherForm = React$1.forwardRef((props, ref) => {\n\t\t\treturn /* @__PURE__ */ React$1.createElement(Form, {\n\t\t\t\t...props,\n\t\t\t\tnavigate: false,\n\t\t\t\tfetcherKey,\n\t\t\t\tref\n\t\t\t});\n\t\t});\n\t\tFetcherForm.displayName = \"fetcher.Form\";\n\t\treturn FetcherForm;\n\t}, [fetcherKey]);\n\tlet fetcher = fetchersContext.fetchers.get(fetcherKey) || IDLE_FETCHER;\n\tlet data = fetchersContext.fetcherData.get(fetcherKey);\n\treturn React$1.useMemo(() => ({\n\t\tForm: FetcherForm,\n\t\tsubmit,\n\t\tload,\n\t\treset,\n\t\t...fetcher,\n\t\tdata\n\t}), [\n\t\tFetcherForm,\n\t\tsubmit,\n\t\tload,\n\t\treset,\n\t\tfetcher,\n\t\tdata\n\t]);\n}\n/**\n* Returns an array of all in-flight {@link Fetcher}s. This is useful for components\n* throughout the app that didn't create the fetchers but want to use their submissions\n* to participate in optimistic UI.\n*\n* @example\n* import { useFetchers } from \"react-router\";\n*\n* function SomeComponent() {\n* const fetchers = useFetchers();\n* fetchers[0].formData; // FormData\n* fetchers[0].state; // etc.\n* // ...\n* }\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @returns An array of all in-flight {@link Fetcher}s, each with a unique `key`\n* property.\n*/\nfunction useFetchers() {\n\tlet { fetchers } = useDataRouterFetchers(\"useFetchers\");\n\treturn React$1.useMemo(() => Array.from(fetchers.entries()).map(([key, fetcher]) => ({\n\t\t...fetcher,\n\t\tkey\n\t})), [fetchers]);\n}\nconst SCROLL_RESTORATION_STORAGE_KEY = \"react-router-scroll-positions\";\nlet savedScrollPositions = {};\nfunction getScrollRestorationKey(location, matches, basename, getKey) {\n\tlet key = null;\n\tif (getKey) if (basename !== \"/\") key = getKey({\n\t\t...location,\n\t\tpathname: stripBasename(location.pathname, basename) || location.pathname\n\t}, matches);\n\telse key = getKey(location, matches);\n\tif (key == null) key = location.key;\n\treturn key;\n}\n/**\n* When rendered inside a {@link RouterProvider}, will restore scroll positions\n* on navigations\n*\n* <!--\n* Not marked `@public` because we only export as UNSAFE_ and therefore we don't\n* maintain an .md file for this hook\n* -->\n*\n* @name UNSAFE_useScrollRestoration\n* @category Hooks\n* @mode framework\n* @mode data\n* @param options Options\n* @param options.getKey A function that returns a key to use for scroll restoration.\n* This is useful for custom scroll restoration logic, such as using only the pathname\n* so that subsequent navigations to prior paths will restore the scroll. Defaults\n* to `location.key`.\n* @param options.storageKey The key to use for storing scroll positions in\n* `sessionStorage`. Defaults to `\"react-router-scroll-positions\"`.\n* @returns {void}\n*/\nfunction useScrollRestoration({ getKey, storageKey } = {}) {\n\tlet { router } = useDataRouterContext(\"useScrollRestoration\");\n\tlet { restoreScrollPosition, preventScrollReset } = useDataRouterState(\"useScrollRestoration\");\n\tlet { basename } = React$1.useContext(NavigationContext);\n\tlet location = useLocation();\n\tlet matches = useMatches();\n\tlet navigation = useNavigation();\n\tReact$1.useEffect(() => {\n\t\twindow.history.scrollRestoration = \"manual\";\n\t\treturn () => {\n\t\t\twindow.history.scrollRestoration = \"auto\";\n\t\t};\n\t}, []);\n\tusePageShow(React$1.useCallback((event) => {\n\t\tif (event.persisted) window.history.scrollRestoration = \"manual\";\n\t}, []));\n\tusePageHide(React$1.useCallback(() => {\n\t\tif (navigation.state === \"idle\") {\n\t\t\tlet key = getScrollRestorationKey(location, matches, basename, getKey);\n\t\t\tsavedScrollPositions[key] = window.scrollY;\n\t\t}\n\t\ttry {\n\t\t\tsessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions));\n\t\t} catch (error) {\n\t\t\twarning(false, `Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`);\n\t\t}\n\t\twindow.history.scrollRestoration = \"auto\";\n\t}, [\n\t\tnavigation.state,\n\t\tgetKey,\n\t\tbasename,\n\t\tlocation,\n\t\tmatches,\n\t\tstorageKey\n\t]));\n\tif (typeof document !== \"undefined\") {\n\t\tReact$1.useLayoutEffect(() => {\n\t\t\ttry {\n\t\t\t\tlet sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);\n\t\t\t\tif (sessionPositions) savedScrollPositions = JSON.parse(sessionPositions);\n\t\t\t} catch {}\n\t\t}, [storageKey]);\n\t\tReact$1.useLayoutEffect(() => {\n\t\t\tlet disableScrollRestoration = router?.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKey ? (location, matches) => getScrollRestorationKey(location, matches, basename, getKey) : void 0);\n\t\t\treturn () => disableScrollRestoration && disableScrollRestoration();\n\t\t}, [\n\t\t\trouter,\n\t\t\tbasename,\n\t\t\tgetKey\n\t\t]);\n\t\tReact$1.useLayoutEffect(() => {\n\t\t\tif (restoreScrollPosition === false) return;\n\t\t\tif (typeof restoreScrollPosition === \"number\") {\n\t\t\t\twindow.scrollTo(0, restoreScrollPosition);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (location.hash) {\n\t\t\t\t\tlet el = document.getElementById(decodeURIComponent(location.hash.slice(1)));\n\t\t\t\t\tif (el) {\n\t\t\t\t\t\tel.scrollIntoView();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\twarning(false, `\"${location.hash.slice(1)}\" is not a decodable element ID. The view will not scroll to it.`);\n\t\t\t}\n\t\t\tif (preventScrollReset === true) return;\n\t\t\twindow.scrollTo(0, 0);\n\t\t}, [\n\t\t\tlocation,\n\t\t\trestoreScrollPosition,\n\t\t\tpreventScrollReset\n\t\t]);\n\t}\n}\n/**\n* Set up a callback to be fired on [Window's `beforeunload` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event).\n*\n* @public\n* @category Hooks\n* @param callback The callback to be called when the [`beforeunload` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event)\n* is fired.\n* @param options Options\n* @param options.capture If `true`, the event will be captured during the capture\n* phase. Defaults to `false`.\n* @returns {void}\n*/\nfunction useBeforeUnload(callback, options) {\n\tlet { capture } = options || {};\n\tReact$1.useEffect(() => {\n\t\tlet opts = capture != null ? { capture } : void 0;\n\t\twindow.addEventListener(\"beforeunload\", callback, opts);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"beforeunload\", callback, opts);\n\t\t};\n\t}, [callback, capture]);\n}\nfunction usePageHide(callback, options) {\n\tlet { capture } = options || {};\n\tReact$1.useEffect(() => {\n\t\tlet opts = capture != null ? { capture } : void 0;\n\t\twindow.addEventListener(\"pagehide\", callback, opts);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"pagehide\", callback, opts);\n\t\t};\n\t}, [callback, capture]);\n}\nfunction usePageShow(callback, options) {\n\tlet { capture } = options || {};\n\tReact$1.useEffect(() => {\n\t\tlet opts = capture != null ? { capture } : void 0;\n\t\twindow.addEventListener(\"pageshow\", callback, opts);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"pageshow\", callback, opts);\n\t\t};\n\t}, [callback, capture]);\n}\n/**\n* Wrapper around {@link useBlocker} to show a [`window.confirm`](https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm)\n* prompt to users instead of building a custom UI with {@link useBlocker}.\n*\n* The `unstable_` flag will not be removed because this technique has a lot of\n* rough edges and behaves very differently (and incorrectly sometimes) across\n* browsers if users click addition back/forward navigations while the\n* confirmation is open. Use at your own risk.\n*\n* @example\n* function ImportantForm() {\n* let [value, setValue] = React.useState(\"\");\n*\n* // Block navigating elsewhere when data has been entered into the input\n* unstable_usePrompt({\n* message: \"Are you sure?\",\n* when: ({ currentLocation, nextLocation }) =>\n* value !== \"\" &&\n* currentLocation.pathname !== nextLocation.pathname,\n* });\n*\n* return (\n* <Form method=\"post\">\n* <label>\n* Enter some important data:\n* <input\n* name=\"data\"\n* value={value}\n* onChange={(e) => setValue(e.target.value)}\n* />\n* </label>\n* <button type=\"submit\">Save</button>\n* </Form>\n* );\n* }\n*\n* @name unstable_usePrompt\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @param options Options\n* @param options.message The message to show in the confirmation dialog.\n* @param options.when A boolean or a function that returns a boolean indicating\n* whether to block the navigation. If a function is provided, it will receive an\n* object with `currentLocation` and `nextLocation` properties.\n* @returns {void}\n*/\nfunction usePrompt({ when, message }) {\n\tlet blocker = useBlocker(when);\n\tReact$1.useEffect(() => {\n\t\tif (blocker.state === \"blocked\") if (window.confirm(message)) setTimeout(blocker.proceed, 0);\n\t\telse blocker.reset();\n\t}, [blocker, message]);\n\tReact$1.useEffect(() => {\n\t\tif (blocker.state === \"blocked\" && !when) blocker.reset();\n\t}, [blocker, when]);\n}\n/**\n* This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)\n* and the specified location matches either side of the navigation (the URL you are\n* navigating **to** or the URL you are navigating **from**). This can be used to apply finer-grained styles to\n* elements to further customize the view transition. This requires that view\n* transitions have been enabled for the given navigation via {@link LinkProps.viewTransition}\n* (or the `Form`, `submit`, or `navigate` call)\n*\n* @public\n* @category Hooks\n* @mode framework\n* @mode data\n* @param to The {@link To} location to compare against the active transition's current\n* and next URLs.\n* @param options Options\n* @param options.relative The relative routing type to use when resolving the\n* `to` location, defaults to `\"route\"`. See {@link RelativeRoutingType} for\n* more details.\n* @returns `true` if there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)\n* and the resolved path matches the transition's destination or source pathname, otherwise `false`.\n*/\nfunction useViewTransitionState(to, { relative } = {}) {\n\tlet vtContext = React$1.useContext(ViewTransitionContext);\n\tinvariant(vtContext != null, \"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?\");\n\tlet { basename } = useDataRouterContext(\"useViewTransitionState\");\n\tlet path = useResolvedPath(to, { relative });\n\tif (!vtContext.isTransitioning) return false;\n\tlet currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;\n\tlet nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;\n\treturn matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;\n}\n//#endregion\nexport { BrowserRouter, Form, HashRouter, HistoryRouter, Link, NavLink, ScrollRestoration, createBrowserRouter, createHashRouter, useBeforeUnload, useFetcher, useFetchers, useFormAction, useLinkClickHandler, usePrompt, useScrollRestoration, useSearchParams, useSubmit, useViewTransitionState };\n","export type ClassNameValue = string | false | null | undefined\r\n\r\nexport const classNames = (...names: readonly ClassNameValue[]) => names.filter(Boolean).join(' ')\r\n","import type { ButtonHTMLAttributes, ComponentProps } from 'react'\r\nimport { Link } from 'react-router'\r\nimport { classNames } from '../utils/classNames.ts'\r\n\r\ntype ButtonVariant = 'primary' | 'secondary' | 'outline' | 'danger' | 'success'\r\n\r\ntype ButtonStyleProps = {\r\n variant?: ButtonVariant\r\n block?: boolean\r\n className?: string\r\n}\r\n\r\nconst getButtonClassName = ({ variant = 'primary', block, className }: ButtonStyleProps) =>\r\n classNames('button', variant !== 'primary' && `button--${variant}`, block && 'button--block', className)\r\n\r\ntype ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\r\n ButtonStyleProps & {\r\n isPending?: boolean\r\n pendingLabel?: string\r\n 'data-autofocus'?: boolean\r\n }\r\n\r\nexport function Button({\r\n variant,\r\n block,\r\n className,\r\n isPending = false,\r\n pendingLabel,\r\n type = 'button',\r\n disabled,\r\n children,\r\n ...buttonProps\r\n}: ButtonProps) {\r\n return (\r\n <button\r\n {...buttonProps}\r\n type={type}\r\n className={getButtonClassName({ variant, block, className })}\r\n disabled={disabled || isPending}\r\n >\r\n {isPending && pendingLabel ? pendingLabel : children}\r\n </button>\r\n )\r\n}\r\n\r\ntype ButtonLinkProps = ComponentProps<typeof Link> & ButtonStyleProps\r\n\r\nexport function ButtonLink({ variant, block, className, ...linkProps }: ButtonLinkProps) {\r\n return <Link {...linkProps} className={getButtonClassName({ variant, block, className })} />\r\n}\r\n","export const ROUTES = {\r\n calendar: '/',\r\n login: '/login',\r\n register: '/register',\r\n forgotPassword: '/forgot-password',\r\n resetPassword: '/reset-password',\r\n verifyEmail: '/verify-email',\r\n settings: '/settings',\r\n createCalendar: '/calendars/new',\r\n calendarSettings: '/calendars/:calendarId/settings',\r\n} as const\r\n\r\nexport const calendarSettingsPath = (calendarId: string) =>\r\n ROUTES.calendarSettings.replace(':calendarId', encodeURIComponent(calendarId))\r\n\r\nexport const SETTINGS_CALENDARS_PATH = `${ROUTES.settings}?tab=calendars`\r\n\r\nexport const TOKEN_PARAM = 'token'\r\n\r\nconst REDIRECT_PARAM = 'redirect'\r\n\r\nexport const isSafeRedirect = (path: string | null): path is string =>\r\n path !== null && path.startsWith('/') && !path.startsWith('//') && !path.startsWith('/\\\\')\r\n\r\nexport const getRedirectTarget = (searchParams: URLSearchParams) => {\r\n const target = searchParams.get(REDIRECT_PARAM)\r\n return isSafeRedirect(target) ? target : ROUTES.calendar\r\n}\r\n\r\nexport const withRedirect = (route: string, redirectTo: string | null) =>\r\n isSafeRedirect(redirectTo) && redirectTo !== ROUTES.calendar\r\n ? `${route}?${new URLSearchParams({ [REDIRECT_PARAM]: redirectTo })}`\r\n : route\r\n","import { useCallback, useState } from 'react'\r\nimport { getErrorMessage, useI18n } from '../i18n/index.ts'\r\n\r\nexport function useAsyncAction<Args extends unknown[]>(action: (...args: Args) => Promise<void>) {\r\n const [isPending, setIsPending] = useState(false)\r\n const [isSuccess, setIsSuccess] = useState(false)\r\n const { m } = useI18n()\r\n const [failure, setFailure] = useState<{ reason: unknown } | null>(null)\r\n\r\n const run = useCallback(\r\n async (...args: Args) => {\r\n setIsPending(true)\r\n setIsSuccess(false)\r\n setFailure(null)\r\n try {\r\n await action(...args)\r\n setIsSuccess(true)\r\n } catch (reason) {\r\n setFailure({ reason })\r\n } finally {\r\n setIsPending(false)\r\n }\r\n },\r\n [action],\r\n )\r\n\r\n const error = failure ? getErrorMessage(failure.reason, m) : null\r\n\r\n return { run, isPending, isSuccess, error }\r\n}\r\n","import { useEffect, useId, useRef, type ReactNode } from 'react'\r\nimport { createPortal } from 'react-dom'\r\nimport { useRootElement } from '../context/RootElementContext.ts'\r\nimport { classNames } from '../utils/classNames.ts'\r\nimport { useI18n } from '../i18n/index.ts'\r\n\r\ntype ModalProps = {\r\n title: string\r\n onClose: () => void\r\n children: ReactNode\r\n variant?: 'default' | 'danger'\r\n size?: 'default' | 'large'\r\n}\r\n\r\nexport function Modal({ title, onClose, children, variant = 'default', size = 'default' }: ModalProps) {\r\n const { m } = useI18n()\r\n const root = useRootElement()\r\n const dialogRef = useRef<HTMLDialogElement>(null)\r\n const titleId = useId()\r\n\r\n useEffect(() => {\r\n const dialog = dialogRef.current\r\n if (!dialog) return\r\n dialog.showModal()\r\n dialog.querySelector<HTMLElement>('[data-autofocus]')?.focus()\r\n return () => dialog.close()\r\n }, [])\r\n\r\n return createPortal(\r\n <dialog\r\n ref={dialogRef}\r\n className={classNames('modal', variant === 'danger' && 'modal--danger', size === 'large' && 'modal--large')}\r\n aria-labelledby={titleId}\r\n onCancel={(event) => {\r\n event.preventDefault()\r\n onClose()\r\n }}\r\n onClick={(event) => {\r\n if (event.target === event.currentTarget) onClose()\r\n }}\r\n >\r\n <div className=\"modalContent\">\r\n <header className=\"modalHeader\">\r\n <h2 id={titleId} className=\"modalTitle\">\r\n {title}\r\n </h2>\r\n <button type=\"button\" className=\"closeButton\" aria-label={m.common.close} onClick={onClose}>\r\n ×\r\n </button>\r\n </header>\r\n {children}\r\n </div>\r\n </dialog>,\r\n root,\r\n )\r\n}\r\n","import { classNames } from '../utils/classNames.ts'\r\n\r\ntype StatusMessageProps = {\r\n message: string | false | null | undefined\r\n tone?: 'error' | 'success'\r\n className?: string\r\n}\r\n\r\nexport function StatusMessage({ message, tone = 'error', className }: StatusMessageProps) {\r\n if (!message) return null\r\n return (\r\n <p\r\n className={classNames(tone === 'error' ? 'errorText' : 'successText', className)}\r\n role={tone === 'error' ? 'alert' : 'status'}\r\n >\r\n {message}\r\n </p>\r\n )\r\n}\r\n\r\nexport function ErrorMessage(props: Omit<StatusMessageProps, 'tone'>) {\r\n return <StatusMessage {...props} tone=\"error\" />\r\n}\r\n\r\ntype ActionFeedbackProps = {\r\n error: string | null | undefined\r\n success?: string | false | null\r\n}\r\n\r\nexport function ActionFeedback({ error, success }: ActionFeedbackProps) {\r\n return (\r\n <>\r\n <ErrorMessage message={error} />\r\n <StatusMessage tone=\"success\" message={success} />\r\n </>\r\n )\r\n}\r\n","import type { ReactNode } from 'react'\r\nimport { useI18n } from '../i18n/index.ts'\r\nimport { useAsyncAction } from '../hooks/useAsyncAction.ts'\r\nimport { Button } from './Button.tsx'\r\nimport { Modal } from './Modal.tsx'\r\nimport { ActionFeedback } from './StatusMessage.tsx'\r\n\r\ntype ConfirmModalProps = {\r\n title: string\r\n confirmLabel: string\r\n pendingLabel: string\r\n onConfirm: () => Promise<void>\r\n onClose: () => void\r\n children: ReactNode\r\n}\r\n\r\nexport function ConfirmModal({ title, confirmLabel, pendingLabel, onConfirm, onClose, children }: ConfirmModalProps) {\r\n const { m } = useI18n()\r\n const { run, isPending, error } = useAsyncAction(onConfirm)\r\n\r\n return (\r\n <Modal title={title} variant=\"danger\" onClose={onClose}>\r\n <div className=\"formSection\">\r\n <p className=\"modalMessage\">{children}</p>\r\n <ActionFeedback error={error} />\r\n <div className=\"formActions\">\r\n <Button variant=\"secondary\" onClick={onClose} data-autofocus>\r\n {m.common.cancel}\r\n </Button>\r\n <Button variant=\"danger\" isPending={isPending} pendingLabel={pendingLabel} onClick={() => void run()}>\r\n {confirmLabel}\r\n </Button>\r\n </div>\r\n </div>\r\n </Modal>\r\n )\r\n}\r\n","type IconProps = {\r\n size?: number\r\n}\r\n\r\nfunction IconBase({ size = 22, path, strokeWidth = 3 }: IconProps & { path: string; strokeWidth?: number }) {\r\n return (\r\n <svg\r\n width={size}\r\n height={size}\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n strokeWidth={strokeWidth}\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n aria-hidden=\"true\"\r\n >\r\n <path d={path} />\r\n </svg>\r\n )\r\n}\r\n\r\nexport const ChevronLeftIcon = (props: IconProps) => <IconBase {...props} path=\"M15 18l-6-6 6-6\" />\r\n\r\nexport const ChevronRightIcon = (props: IconProps) => <IconBase {...props} path=\"M9 18l6-6-6-6\" />\r\n\r\nexport const TeamIcon = (props: IconProps) => (\r\n <IconBase\r\n {...props}\r\n strokeWidth={2.5}\r\n path=\"M16 21v-2a4 4 0 00-4-4H6a4 4 0 00-4 4v2M13 7a4 4 0 11-8 0 4 4 0 018 0zM22 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75\"\r\n />\r\n)\r\n\r\nexport const PlusIcon = (props: IconProps) => <IconBase {...props} path=\"M12 5v14M5 12h14\" />\r\n\r\nexport const RepeatIcon = (props: IconProps) => (\r\n <IconBase\r\n {...props}\r\n strokeWidth={2.5}\r\n path=\"M17 2l4 4-4 4M3 11V9a3 3 0 013-3h15M7 22l-4-4 4-4M21 13v2a3 3 0 01-3 3H3\"\r\n />\r\n)\r\n\r\nexport const SettingsIcon = (props: IconProps) => (\r\n <IconBase\r\n {...props}\r\n strokeWidth={2}\r\n path=\"M12 15a3 3 0 100-6 3 3 0 000 6zM19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 11-2.83 2.83l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 11-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 11-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 110-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 112.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 114 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 112.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 110 4h-.09a1.65 1.65 0 00-1.51 1z\"\r\n />\r\n)\r\n","import type { ReactNode } from 'react'\r\nimport { classNames } from '../utils/classNames.ts'\r\n\r\ntype PageSectionProps = {\r\n title: string\r\n description?: ReactNode\r\n tone?: 'default' | 'danger'\r\n children: ReactNode\r\n}\r\n\r\nexport function PageSection({ title, description, tone = 'default', children }: PageSectionProps) {\r\n return (\r\n <section className={classNames('pageSection', tone === 'danger' && 'pageSection--danger')}>\r\n <div className=\"pageSectionIntro\">\r\n <h2 className=\"pageSectionTitle\">{title}</h2>\r\n {description && <p className=\"formHint\">{description}</p>}\r\n </div>\r\n <div className=\"pageSectionBody\">{children}</div>\r\n </section>\r\n )\r\n}\r\n","type SwitchProps = {\r\n label: string\r\n checked: boolean\r\n disabled?: boolean\r\n onChange: (checked: boolean) => void\r\n}\r\n\r\nexport function Switch({ label, checked, disabled, onChange }: SwitchProps) {\r\n return (\r\n <label className=\"switch\">\r\n <input\r\n type=\"checkbox\"\r\n role=\"switch\"\r\n className=\"switchInput\"\r\n checked={checked}\r\n disabled={disabled}\r\n onChange={(event) => onChange(event.target.checked)}\r\n />\r\n <span className=\"switchTrack\" aria-hidden=\"true\" />\r\n <span className=\"switchLabel\">{label}</span>\r\n </label>\r\n )\r\n}\r\n","export type HexColor = `#${string}`\r\n\r\nconst HEX_COLOR_PATTERN = /^#[0-9a-f]{6}$/i\r\nconst DARK_TEXT = '#222222'\r\nconst LIGHT_TEXT = '#ffffff'\r\nconst LUMINANCE_THRESHOLD = 0.2\r\n\r\nexport const isHexColor = (value: unknown): value is HexColor =>\r\n typeof value === 'string' && HEX_COLOR_PATTERN.test(value)\r\n\r\nexport const normalizeHexColor = (value: HexColor) => value.toLowerCase() as HexColor\r\n\r\nconst toLinear = (channel: number) =>\r\n channel <= 0.03928 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4\r\n\r\nexport const getRelativeLuminance = (color: HexColor) => {\r\n const [red, green, blue] = [1, 3, 5].map((index) => toLinear(parseInt(color.slice(index, index + 2), 16) / 255))\r\n return 0.2126 * red + 0.7152 * green + 0.0722 * blue\r\n}\r\n\r\nexport const getReadableTextColor = (background: HexColor) =>\r\n getRelativeLuminance(background) > LUMINANCE_THRESHOLD ? DARK_TEXT : LIGHT_TEXT\r\n","export const pick = <T extends object, K extends keyof T>(source: T, keys: readonly K[]) =>\r\n Object.fromEntries(keys.map((key) => [key, source[key]])) as Pick<T, K>\r\n\r\nexport const isOneOf = <T extends string>(values: readonly T[], value: unknown): value is T =>\r\n values.includes(value as T)\r\n\r\nexport const asRecord = (value: unknown): Record<string, unknown> =>\r\n typeof value === 'object' && value !== null ? (value as Record<string, unknown>) : {}\r\n","export const isIntegerInRange = (value: unknown, min: number, max = Number.MAX_SAFE_INTEGER): value is number =>\r\n typeof value === 'number' && Number.isInteger(value) && value >= min && value <= max\r\n","import {\r\n addDaysToISODate,\r\n daysBetween,\r\n daysInMonth,\r\n DAYS_PER_WEEK,\r\n fromISODate,\r\n getWeekdayIndex,\r\n isISODate,\r\n minISODate,\r\n maxISODate,\r\n toISODate,\r\n} from './date.ts'\r\nimport type { I18n, Messages } from '../i18n/index.ts'\r\nimport { isIntegerInRange } from './number.ts'\r\nimport { isOneOf } from './object.ts'\r\nimport { hasFieldErrors } from './validation.ts'\r\n\r\nexport const RECURRENCE_FREQUENCIES = ['daily', 'weekly', 'monthly', 'yearly'] as const\r\n\r\nexport type RecurrenceFrequency = (typeof RECURRENCE_FREQUENCIES)[number]\r\n\r\nexport const MONTHLY_MODES = ['dayOfMonth', 'weekdayOfMonth', 'lastWeekdayOfMonth'] as const\r\n\r\nexport type MonthlyMode = (typeof MONTHLY_MODES)[number]\r\n\r\nexport type Recurrence = {\r\n frequency: RecurrenceFrequency\r\n interval: number\r\n weekdays: number[]\r\n monthlyMode: MonthlyMode\r\n until: string | null\r\n count: number | null\r\n}\r\n\r\nexport const RECURRENCE_INTERVAL_MAX = 99\r\nexport const RECURRENCE_COUNT_MAX = 999\r\n\r\nconst MAX_EMPTY_PERIODS = 1000\r\n\r\nexport const getISODateWeekday = (isoDate: string) => getWeekdayIndex(fromISODate(isoDate))\r\n\r\nconst getWeekdayOrdinal = (isoDate: string) => Math.ceil(fromISODate(isoDate).getDate() / DAYS_PER_WEEK)\r\n\r\nexport const isInLastWeekOfMonth = (isoDate: string) => {\r\n const date = fromISODate(isoDate)\r\n return date.getDate() + DAYS_PER_WEEK > daysInMonth(date.getFullYear(), date.getMonth())\r\n}\r\n\r\nexport const isRecurrenceFrequency = (value: unknown): value is RecurrenceFrequency =>\r\n isOneOf(RECURRENCE_FREQUENCIES, value)\r\n\r\nexport const isMonthlyMode = (value: unknown): value is MonthlyMode => isOneOf(MONTHLY_MODES, value)\r\n\r\nexport const createRecurrence = (frequency: RecurrenceFrequency, startDate: string): Recurrence => ({\r\n frequency,\r\n interval: 1,\r\n weekdays: [getISODateWeekday(startDate)],\r\n monthlyMode: 'dayOfMonth',\r\n until: null,\r\n count: null,\r\n})\r\n\r\nconst weekdayDistance = (from: number, to: number) => (((to - from) % DAYS_PER_WEEK) + DAYS_PER_WEEK) % DAYS_PER_WEEK\r\n\r\nexport const normalizeWeekdays = (weekdays: readonly number[]) => [...new Set(weekdays)].toSorted((a, b) => a - b)\r\n\r\nexport const parseRecurrence = (value: unknown): Recurrence | null => {\r\n if (typeof value !== 'object' || value === null) return null\r\n const { frequency, interval, weekdays, monthlyMode, until, count } = value as Record<string, unknown>\r\n if (!isRecurrenceFrequency(frequency) || !isIntegerInRange(interval, 1)) return null\r\n if (!Array.isArray(weekdays) || !weekdays.every((day) => isIntegerInRange(day, 0, DAYS_PER_WEEK - 1))) return null\r\n if (monthlyMode !== undefined && !isMonthlyMode(monthlyMode)) return null\r\n if (until != null && !isISODate(until)) return null\r\n if (count != null && !isIntegerInRange(count, 1)) return null\r\n return {\r\n frequency,\r\n interval,\r\n weekdays: normalizeWeekdays(weekdays),\r\n monthlyMode: monthlyMode ?? 'dayOfMonth',\r\n until: until ?? null,\r\n count: count ?? null,\r\n }\r\n}\r\n\r\nexport const isSameRecurrence = (a: Recurrence | null, b: Recurrence | null) => {\r\n if (a === null || b === null) return a === b\r\n return (\r\n a.frequency === b.frequency &&\r\n a.interval === b.interval &&\r\n a.until === b.until &&\r\n a.count === b.count &&\r\n (a.frequency !== 'weekly' || normalizeWeekdays(a.weekdays).join() === normalizeWeekdays(b.weekdays).join()) &&\r\n (a.frequency !== 'monthly' || a.monthlyMode === b.monthlyMode)\r\n )\r\n}\r\n\r\nexport const shiftWeekdays = (weekdays: readonly number[], days: number) =>\r\n normalizeWeekdays(weekdays.map((day) => weekdayDistance(-days, day)))\r\n\r\nexport const adaptRecurrenceToStart = (recurrence: Recurrence | null, previousStart: string, nextStart: string) => {\r\n if (!recurrence || !isISODate(previousStart) || !isISODate(nextStart)) return recurrence\r\n\r\n if (recurrence.frequency === 'weekly') {\r\n const followsStart = recurrence.weekdays.length === 1 && recurrence.weekdays[0] === getISODateWeekday(previousStart)\r\n return followsStart ? { ...recurrence, weekdays: [getISODateWeekday(nextStart)] } : recurrence\r\n }\r\n\r\n if (recurrence.frequency === 'monthly' && recurrence.monthlyMode === 'lastWeekdayOfMonth' && !isInLastWeekOfMonth(nextStart))\r\n return { ...recurrence, monthlyMode: 'weekdayOfMonth' as const }\r\n\r\n return recurrence\r\n}\r\n\r\nexport const hasRecurrenceErrors = (errors: RecurrenceValidationErrors) => hasFieldErrors(errors)\r\n\r\nexport type RecurrenceValidationErrors = Partial<Record<'interval' | 'weekdays' | 'until' | 'count', string>>\r\n\r\nexport const validateRecurrence = (\r\n recurrence: Recurrence,\r\n startDate: string,\r\n { validation }: Messages,\r\n): RecurrenceValidationErrors => {\r\n const errors: RecurrenceValidationErrors = {}\r\n const { interval, frequency, weekdays, until, count } = recurrence\r\n\r\n if (!isIntegerInRange(interval, 1, RECURRENCE_INTERVAL_MAX)) errors.interval = validation.integerRange(1, RECURRENCE_INTERVAL_MAX)\r\n\r\n if (frequency === 'weekly' && weekdays.length === 0) errors.weekdays = validation.weekdaysRequired\r\n\r\n if (until !== null) {\r\n if (!isISODate(until)) errors.until = validation.dateInvalid\r\n else if (isISODate(startDate) && until < startDate)\r\n errors.until = validation.untilBeforeStart\r\n }\r\n\r\n if (count !== null && !isIntegerInRange(count, 1, RECURRENCE_COUNT_MAX))\r\n errors.count = validation.integerRange(1, RECURRENCE_COUNT_MAX)\r\n\r\n return errors\r\n}\r\n\r\nexport const formatMonthlyMode = (mode: MonthlyMode, startDate: string, { m, format }: Pick<I18n, 'm' | 'format'>) => {\r\n const weekday = format.weekdayName(getISODateWeekday(startDate))\r\n if (mode === 'weekdayOfMonth') return m.recurrence.monthlyOnWeekday(getWeekdayOrdinal(startDate), weekday)\r\n if (mode === 'lastWeekdayOfMonth') return m.recurrence.monthlyOnLastWeekday(weekday)\r\n return m.recurrence.monthlyOnDay(fromISODate(startDate).getDate())\r\n}\r\n\r\nexport const getMonthlyModeOptions = (startDate: string): MonthlyMode[] =>\r\n isInLastWeekOfMonth(startDate) ? [...MONTHLY_MODES] : ['dayOfMonth', 'weekdayOfMonth']\r\n\r\nexport const formatRecurrence = (recurrence: Recurrence, startDate: string, i18n: Pick<I18n, 'm' | 'format'>) => {\r\n const { m, format } = i18n\r\n const { frequency, interval, weekdays, until, count } = recurrence\r\n const base =\r\n interval === 1 ? m.recurrence.frequency[frequency] : m.recurrence.every(interval, m.recurrence.units[frequency].many)\r\n\r\n const detail =\r\n frequency === 'weekly'\r\n ? m.recurrence.onWeekdays(format.list(normalizeWeekdays(weekdays).map((day) => format.weekdayName(day))))\r\n : frequency === 'monthly'\r\n ? ` ${formatMonthlyMode(recurrence.monthlyMode, startDate, i18n)}`\r\n : frequency === 'yearly'\r\n ? m.recurrence.onDate(format.shortDay(startDate))\r\n : ''\r\n\r\n const end = until !== null ? m.recurrence.until(format.fullDay(until)) : count !== null ? m.recurrence.times(count) : ''\r\n\r\n return `${base}${detail}${end}`\r\n}\r\n\r\nconst dayOfMonth = (year: number, monthIndex: number, day: number) =>\r\n day >= 1 && day <= daysInMonth(year, monthIndex) ? toISODate(new Date(year, monthIndex, day)) : null\r\n\r\nconst nthWeekdayOfMonth = (year: number, monthIndex: number, weekday: number, ordinal: number) => {\r\n const firstWeekday = getWeekdayIndex(new Date(year, monthIndex, 1))\r\n return dayOfMonth(year, monthIndex, 1 + weekdayDistance(firstWeekday, weekday) + (ordinal - 1) * DAYS_PER_WEEK)\r\n}\r\n\r\nconst lastWeekdayOfMonth = (year: number, monthIndex: number, weekday: number) => {\r\n const lastDay = daysInMonth(year, monthIndex)\r\n const lastWeekday = getWeekdayIndex(new Date(year, monthIndex, lastDay))\r\n return dayOfMonth(year, monthIndex, lastDay - weekdayDistance(weekday, lastWeekday))\r\n}\r\n\r\ntype Period = { start: string; dates: string[] }\r\n\r\nfunction* periods(seriesStart: string, recurrence: Recurrence, from: string): Generator<Period> {\r\n const { frequency, interval } = recurrence\r\n\r\n if (frequency === 'daily') {\r\n for (let step = Math.max(Math.ceil(daysBetween(seriesStart, from) / interval), 0); ; step++) {\r\n const date = addDaysToISODate(seriesStart, step * interval)\r\n yield { start: date, dates: [date] }\r\n }\r\n }\r\n\r\n if (frequency === 'weekly') {\r\n const anchor = addDaysToISODate(seriesStart, -getISODateWeekday(seriesStart))\r\n const weekdays = normalizeWeekdays(recurrence.weekdays)\r\n const firstWeek = Math.floor(daysBetween(anchor, from) / DAYS_PER_WEEK)\r\n for (let step = Math.max(Math.floor(firstWeek / interval), 0); ; step++) {\r\n const weekStart = addDaysToISODate(anchor, step * interval * DAYS_PER_WEEK)\r\n yield { start: weekStart, dates: weekdays.map((weekday) => addDaysToISODate(weekStart, weekday)) }\r\n }\r\n }\r\n\r\n const start = fromISODate(seriesStart)\r\n const fromDate = fromISODate(from)\r\n\r\n if (frequency === 'monthly') {\r\n const weekday = getISODateWeekday(seriesStart)\r\n const ordinal = getWeekdayOrdinal(seriesStart)\r\n const monthsUntilFrom =\r\n (fromDate.getFullYear() - start.getFullYear()) * 12 + fromDate.getMonth() - start.getMonth()\r\n for (let step = Math.max(Math.floor(monthsUntilFrom / interval), 0); ; step++) {\r\n const month = new Date(start.getFullYear(), start.getMonth() + step * interval, 1)\r\n const year = month.getFullYear()\r\n const monthIndex = month.getMonth()\r\n const date =\r\n recurrence.monthlyMode === 'weekdayOfMonth'\r\n ? nthWeekdayOfMonth(year, monthIndex, weekday, ordinal)\r\n : recurrence.monthlyMode === 'lastWeekdayOfMonth'\r\n ? lastWeekdayOfMonth(year, monthIndex, weekday)\r\n : dayOfMonth(year, monthIndex, start.getDate())\r\n yield { start: toISODate(month), dates: date ? [date] : [] }\r\n }\r\n }\r\n\r\n for (let step = Math.max(Math.floor((fromDate.getFullYear() - start.getFullYear()) / interval), 0); ; step++) {\r\n const year = start.getFullYear() + step * interval\r\n const date = dayOfMonth(year, start.getMonth(), start.getDate())\r\n yield { start: `${year}-01-01`, dates: date ? [date] : [] }\r\n }\r\n}\r\n\r\nexport function getOccurrenceDates(\r\n seriesStart: string,\r\n recurrence: Recurrence,\r\n windowStart: string,\r\n windowEnd: string,\r\n): string[] {\r\n const { until, count } = recurrence\r\n const last = until === null ? windowEnd : minISODate(until, windowEnd)\r\n const first = count === null ? maxISODate(windowStart, seriesStart) : seriesStart\r\n if (first > last) return []\r\n\r\n const dates: string[] = []\r\n let generated = 0\r\n let emptyPeriods = 0\r\n\r\n for (const period of periods(seriesStart, recurrence, first)) {\r\n if (period.start > last) break\r\n const candidates = period.dates.filter((date) => date >= first && date <= last)\r\n emptyPeriods = candidates.length === 0 ? emptyPeriods + 1 : 0\r\n if (emptyPeriods > MAX_EMPTY_PERIODS) break\r\n\r\n for (const date of candidates) {\r\n generated++\r\n if (count !== null && generated > count) return dates\r\n if (date >= windowStart) dates.push(date)\r\n }\r\n }\r\n\r\n return dates\r\n}\r\n\r\nexport const countOccurrencesBefore = (seriesStart: string, recurrence: Recurrence, date: string) =>\r\n getOccurrenceDates(seriesStart, recurrence, seriesStart, addDaysToISODate(date, -1)).length\r\n","import type { CSSProperties } from 'react'\r\nimport {\r\n addDaysToISODate,\r\n daysBetween,\r\n isISODate,\r\n isTime,\r\n MINUTES_PER_DAY,\r\n MINUTES_PER_HOUR,\r\n minutesToTime,\r\n timeToMinutes,\r\n} from './date.ts'\r\nimport type { I18n, Messages } from '../i18n/index.ts'\r\nimport { classNames, type ClassNameValue } from './classNames.ts'\r\nimport { getReadableTextColor, isHexColor, type HexColor } from './color.ts'\r\nimport { isOneOf, pick } from './object.ts'\r\nimport { hasFieldErrors } from './validation.ts'\r\nimport {\r\n getOccurrenceDates,\r\n hasRecurrenceErrors,\r\n parseRecurrence,\r\n validateRecurrence,\r\n type Recurrence,\r\n type RecurrenceValidationErrors,\r\n} from './recurrence.ts'\r\n\r\nexport const PRESET_EVENT_COLORS = ['blue', 'red', 'green', 'yellow'] as const\r\n\r\nexport type PresetEventColor = (typeof PRESET_EVENT_COLORS)[number]\r\n\r\nexport type EventColor = PresetEventColor | HexColor\r\n\r\nexport const EVENT_TITLE_MAX_LENGTH = 100\r\nexport const EVENT_DESCRIPTION_MAX_LENGTH = 2000\r\n\r\nexport type CalendarEvent = {\r\n id: string\r\n calendarId: string\r\n title: string\r\n startDate: string\r\n start: string\r\n endDate: string\r\n end: string\r\n description: string\r\n color: EventColor\r\n recurrence: Recurrence | null\r\n excludedDates: string[]\r\n seriesId: string | null\r\n originalDate: string | null\r\n createdAt: string\r\n updatedAt: string\r\n}\r\n\r\nconst EVENT_INPUT_KEYS = [\r\n 'title',\r\n 'startDate',\r\n 'start',\r\n 'endDate',\r\n 'end',\r\n 'description',\r\n 'color',\r\n 'recurrence',\r\n 'excludedDates',\r\n 'seriesId',\r\n 'originalDate',\r\n] as const satisfies readonly (keyof CalendarEvent)[]\r\n\r\nexport type EventInput = Pick<CalendarEvent, (typeof EVENT_INPUT_KEYS)[number]>\r\n\r\nexport const NO_SERIES_LINK = { seriesId: null, originalDate: null } as const satisfies Partial<EventInput>\r\n\r\nexport type EventOccurrence = CalendarEvent & {\r\n occurrenceKey: string\r\n seriesStartDate: string\r\n}\r\n\r\nexport type EditScope = 'single' | 'following' | 'all'\r\n\r\nexport type EventPeriod = Pick<CalendarEvent, 'startDate' | 'start' | 'endDate' | 'end'>\r\n\r\nexport type SeriesRule = Pick<CalendarEvent, 'startDate' | 'recurrence' | 'excludedDates'>\r\n\r\nexport type EventValidationErrors = Partial<Record<Exclude<keyof EventInput, 'recurrence'>, string>> & {\r\n recurrence?: RecurrenceValidationErrors\r\n}\r\n\r\nexport const isPresetEventColor = (value: unknown): value is PresetEventColor => isOneOf(PRESET_EVENT_COLORS, value)\r\n\r\nexport const isEventColor = (value: unknown): value is EventColor => isPresetEventColor(value) || isHexColor(value)\r\n\r\nexport const getEventColorLabel = (color: EventColor, m: Messages) =>\r\n isPresetEventColor(color) ? m.colors[color] : color.toUpperCase()\r\n\r\nexport const getEventColorAttributes = (\r\n color: EventColor,\r\n ...classNamesToMerge: ClassNameValue[]\r\n): { className?: string; style?: CSSProperties } =>\r\n isPresetEventColor(color)\r\n ? { className: classNames(...classNamesToMerge, `color-${color}`) }\r\n : {\r\n className: classNames(...classNamesToMerge) || undefined,\r\n style: { '--event-color': color, '--event-text': getReadableTextColor(color) } as CSSProperties,\r\n }\r\n\r\nexport const parseCalendarEvent = (value: unknown): CalendarEvent | null => {\r\n if (typeof value !== 'object' || value === null) return null\r\n const { date, ...rest } = value as Record<string, unknown>\r\n const startDate = rest.startDate ?? date\r\n const endDate = rest.endDate ?? startDate\r\n const recurrence = rest.recurrence == null ? null : parseRecurrence(rest.recurrence)\r\n const excludedDates = Array.isArray(rest.excludedDates) ? rest.excludedDates.filter(isISODate) : []\r\n const seriesId = typeof rest.seriesId === 'string' ? rest.seriesId : null\r\n const originalDate = seriesId !== null && isISODate(rest.originalDate) ? rest.originalDate : null\r\n\r\n if (\r\n typeof rest.id !== 'string' ||\r\n typeof rest.calendarId !== 'string' ||\r\n typeof rest.title !== 'string' ||\r\n !isISODate(startDate) ||\r\n !isTime(rest.start) ||\r\n !isISODate(endDate) ||\r\n !isTime(rest.end) ||\r\n typeof rest.description !== 'string' ||\r\n !isEventColor(rest.color) ||\r\n (rest.recurrence != null && recurrence === null)\r\n )\r\n return null\r\n\r\n return {\r\n id: rest.id,\r\n calendarId: rest.calendarId,\r\n title: rest.title,\r\n startDate,\r\n start: rest.start,\r\n endDate,\r\n end: rest.end,\r\n description: rest.description,\r\n color: rest.color,\r\n recurrence,\r\n excludedDates,\r\n seriesId: originalDate === null ? null : seriesId,\r\n originalDate,\r\n createdAt: typeof rest.createdAt === 'string' ? rest.createdAt : '',\r\n updatedAt: typeof rest.updatedAt === 'string' ? rest.updatedAt : '',\r\n }\r\n}\r\n\r\nexport type HourSlot = { date: string; hour: number }\r\n\r\nexport const createEventInputForSlots = (first: HourSlot, last: HourSlot): EventInput => {\r\n const end = (last.hour + 1) * MINUTES_PER_HOUR\r\n const endsNextDay = end >= MINUTES_PER_DAY\r\n return {\r\n title: '',\r\n startDate: first.date,\r\n start: minutesToTime(first.hour * MINUTES_PER_HOUR),\r\n endDate: endsNextDay ? addDaysToISODate(last.date, 1) : last.date,\r\n end: minutesToTime(end % MINUTES_PER_DAY),\r\n description: '',\r\n color: 'blue',\r\n recurrence: null,\r\n excludedDates: [],\r\n ...NO_SERIES_LINK,\r\n }\r\n}\r\n\r\nexport const createEventInput = (date: string, hour: number) => createEventInputForSlots({ date, hour }, { date, hour })\r\n\r\nexport const toEventInput = (event: CalendarEvent): EventInput => pick(event, EVENT_INPUT_KEYS)\r\n\r\nexport const normalizeEventInput = (input: EventInput): EventInput => ({\r\n ...input,\r\n title: input.title.trim(),\r\n description: input.description.trim(),\r\n ...(input.recurrence ? NO_SERIES_LINK : { excludedDates: [] }),\r\n})\r\n\r\nexport const getEventDuration = (period: EventPeriod) =>\r\n getSpanDays(period) * MINUTES_PER_DAY + timeToMinutes(period.end) - timeToMinutes(period.start)\r\n\r\nexport const isMultiDayEvent = ({ startDate, endDate }: Pick<EventPeriod, 'startDate' | 'endDate'>) =>\r\n startDate !== endDate\r\n\r\nexport const getSpanDays = ({ startDate, endDate }: Pick<EventPeriod, 'startDate' | 'endDate'>) =>\r\n daysBetween(startDate, endDate)\r\n\r\nexport const moveToStartDate = (period: Pick<EventPeriod, 'startDate' | 'endDate'>, startDate: string) => ({\r\n startDate,\r\n endDate: addDaysToISODate(startDate, getSpanDays(period)),\r\n})\r\n\r\nexport const getActiveOccurrenceDates = (\r\n { startDate, recurrence, excludedDates }: SeriesRule,\r\n from: string,\r\n to: string,\r\n) => {\r\n if (!recurrence) return startDate >= from && startDate <= to ? [startDate] : []\r\n const excluded = new Set(excludedDates)\r\n return getOccurrenceDates(startDate, recurrence, from, to).filter((date) => !excluded.has(date))\r\n}\r\n\r\nconst getOccurrenceStartDates = (event: CalendarEvent, from: string, to: string) =>\r\n getActiveOccurrenceDates(event, addDaysToISODate(from, -getSpanDays(event)), to)\r\n\r\nexport const eventOccursInRange = (event: CalendarEvent, from: string, to: string) =>\r\n getOccurrenceStartDates(event, from, to).length > 0\r\n\r\nexport const toSeriesRule = (occurrence: EventOccurrence): SeriesRule => ({\r\n startDate: occurrence.seriesStartDate,\r\n recurrence: occurrence.recurrence,\r\n excludedDates: occurrence.excludedDates,\r\n})\r\n\r\nexport const expandEvents = (events: readonly CalendarEvent[], from: string, to: string): EventOccurrence[] =>\r\n events.flatMap((event) =>\r\n getOccurrenceStartDates(event, from, to).map((startDate) => ({\r\n ...event,\r\n ...moveToStartDate(event, startDate),\r\n occurrenceKey: `${event.id}:${startDate}`,\r\n seriesStartDate: event.startDate,\r\n })),\r\n )\r\n\r\nexport const formatEventPeriod = (event: EventPeriod, { format }: Pick<I18n, 'format'>) => {\r\n const start = format.time(timeToMinutes(event.start))\r\n const end = format.time(timeToMinutes(event.end))\r\n return isMultiDayEvent(event)\r\n ? `${format.shortDay(event.startDate)} ${start} – ${format.shortDay(event.endDate)} ${end}`\r\n : `${start} – ${end}`\r\n}\r\n\r\nexport const validateEventInput = (input: EventInput, m: Messages): EventValidationErrors => {\r\n const errors: EventValidationErrors = {}\r\n const { validation } = m\r\n\r\n if (!input.title) errors.title = validation.titleRequired\r\n else if (input.title.length > EVENT_TITLE_MAX_LENGTH) errors.title = validation.titleTooLong(EVENT_TITLE_MAX_LENGTH)\r\n\r\n if (!isISODate(input.startDate)) errors.startDate = validation.startDateInvalid\r\n if (!isTime(input.start)) errors.start = validation.startTimeInvalid\r\n if (!isISODate(input.endDate)) errors.endDate = validation.endDateInvalid\r\n if (!isTime(input.end)) errors.end = validation.endTimeInvalid\r\n\r\n if (!errors.startDate && !errors.endDate && input.endDate < input.startDate)\r\n errors.endDate = validation.endDateBeforeStart\r\n else if (!errors.startDate && !errors.start && !errors.endDate && !errors.end && getEventDuration(input) <= 0)\r\n errors.end = validation.endBeforeStart\r\n\r\n if (input.recurrence) {\r\n const recurrenceErrors = validateRecurrence(input.recurrence, input.startDate, m)\r\n if (hasRecurrenceErrors(recurrenceErrors)) errors.recurrence = recurrenceErrors\r\n }\r\n\r\n if (input.description.length > EVENT_DESCRIPTION_MAX_LENGTH)\r\n errors.description = validation.descriptionTooLong(EVENT_DESCRIPTION_MAX_LENGTH)\r\n\r\n return errors\r\n}\r\n\r\nexport const hasValidationErrors = ({ recurrence, ...fields }: EventValidationErrors) =>\r\n hasFieldErrors(fields) || (recurrence !== undefined && hasRecurrenceErrors(recurrence))\r\n","import { Button } from '../../../components/Button.tsx'\r\nimport { PageSection } from '../../../components/PageSection.tsx'\r\nimport { ActionFeedback } from '../../../components/StatusMessage.tsx'\r\nimport { useAsyncAction } from '../../../hooks/useAsyncAction.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { toISODate } from '../../../utils/date.ts'\r\nimport { useCalendars } from '../hooks/useCalendars.ts'\r\nimport type { PendingInvitation } from '../types/calendar.ts'\r\n\r\nfunction InvitationRow({ invitation }: { invitation: PendingInvitation }) {\r\n const { m, format } = useI18n()\r\n const { invitations: text, roles } = m.calendars\r\n const { acceptInvitation, declineInvitation } = useCalendars()\r\n const accept = useAsyncAction(() => acceptInvitation(invitation.id))\r\n const decline = useAsyncAction(() => declineInvitation(invitation.id))\r\n const isBusy = accept.isPending || decline.isPending\r\n\r\n return (\r\n <li className=\"calendarSettingCard\">\r\n <div className=\"calendarSettingHeader\">\r\n <span className=\"itemRowMain\">\r\n <span className=\"itemRowTitle\">{invitation.teamName}</span>\r\n <span className=\"itemRowMeta\">\r\n {invitation.invitedBy ? text.invitedBy(invitation.invitedBy) : text.invited} ·{' '}\r\n {text.validUntil(format.longDate(toISODate(new Date(invitation.expiresAt))))}\r\n </span>\r\n {invitation.description && <span className=\"itemRowMeta\">{invitation.description}</span>}\r\n </span>\r\n <span className=\"badge\">{roles[invitation.role]}</span>\r\n </div>\r\n <div className=\"calendarSettingBody\">\r\n <ActionFeedback error={accept.error ?? decline.error} />\r\n <div className=\"formActions\">\r\n <Button\r\n variant=\"outline\"\r\n disabled={isBusy}\r\n isPending={decline.isPending}\r\n pendingLabel={text.declining}\r\n onClick={() => void decline.run()}\r\n >\r\n {text.decline}\r\n </Button>\r\n <Button\r\n disabled={isBusy}\r\n isPending={accept.isPending}\r\n pendingLabel={text.accepting}\r\n onClick={() => void accept.run()}\r\n >\r\n {text.accept}\r\n </Button>\r\n </div>\r\n </div>\r\n </li>\r\n )\r\n}\r\n\r\nexport function InvitationList() {\r\n const { m } = useI18n()\r\n const { invitations } = useCalendars()\r\n if (invitations.length === 0) return null\r\n\r\n return (\r\n <PageSection\r\n title={m.calendars.invitations.title}\r\n description={m.calendars.invitations.description}\r\n >\r\n <ul className=\"calendarSettingList\">\r\n {invitations.map((invitation) => (\r\n <InvitationRow key={invitation.id} invitation={invitation} />\r\n ))}\r\n </ul>\r\n </PageSection>\r\n )\r\n}\r\n","import { useState } from 'react'\r\nimport { Button, ButtonLink } from '../../../components/Button.tsx'\r\nimport { Link } from 'react-router'\r\nimport { calendarSettingsPath, ROUTES } from '../../../config/routes.ts'\r\nimport { ConfirmModal } from '../../../components/ConfirmModal.tsx'\r\nimport { SettingsIcon } from '../../../components/Icons.tsx'\r\nimport { PageSection } from '../../../components/PageSection.tsx'\r\nimport { Switch } from '../../../components/Switch.tsx'\r\nimport { ActionFeedback, ErrorMessage } from '../../../components/StatusMessage.tsx'\r\nimport { useAsyncAction } from '../../../hooks/useAsyncAction.ts'\r\nimport { getEventColorAttributes } from '../../../utils/event.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { useCalendars } from '../hooks/useCalendars.ts'\r\nimport type { CalendarSummary } from '../types/calendar.ts'\r\nimport { canLeaveCalendar, canOpenSettings, getCalendarKindLabel, isPersonalCalendar } from '../utils/permissions.ts'\r\nimport { InvitationList } from './InvitationList.tsx'\r\nimport { useHost } from '../../../context/HostContext.ts'\r\n\r\nfunction LeaveCalendarModal({ calendar, onClose }: { calendar: CalendarSummary; onClose: () => void }) {\r\n const { m } = useI18n()\r\n const { leaveCalendar } = useCalendars()\r\n return (\r\n <ConfirmModal\r\n title={m.calendars.leave.title}\r\n confirmLabel={m.calendars.leave.confirm}\r\n pendingLabel={m.calendars.leave.pending}\r\n onConfirm={async () => {\r\n await leaveCalendar(calendar.id)\r\n onClose()\r\n }}\r\n onClose={onClose}\r\n >\r\n {m.calendars.leave.message(calendar.teamName ?? calendar.name)}\r\n </ConfirmModal>\r\n )\r\n}\r\n\r\nfunction CalendarRow({ calendar, onLeave }: { calendar: CalendarSummary; onLeave: () => void }) {\r\n const { m } = useI18n()\r\n const { list, roles } = m.calendars\r\n const { setShowInPersonal } = useCalendars()\r\n const { run, error } = useAsyncAction(setShowInPersonal)\r\n\r\n return (\r\n <li className=\"calendarSettingCard\">\r\n <div className=\"calendarSettingHeader\">\r\n <span {...getEventColorAttributes(calendar.color, 'colorSwatch colorSwatch--large')} aria-hidden=\"true\" />\r\n <span className=\"itemRowMain\">\r\n <span className=\"itemRowTitle\">{calendar.name}</span>\r\n <span className=\"itemRowMeta\">{getCalendarKindLabel(calendar, m)}</span>\r\n {calendar.description && <span className=\"itemRowMeta\">{calendar.description}</span>}\r\n </span>\r\n <span className=\"badge\">{roles[calendar.role]}</span>\r\n {canOpenSettings(calendar) && (\r\n <Link\r\n to={calendarSettingsPath(calendar.id)}\r\n className=\"iconLink\"\r\n aria-label={list.settingsFor(calendar.name)}\r\n title={m.common.settings}\r\n >\r\n <SettingsIcon size={20} />\r\n </Link>\r\n )}\r\n </div>\r\n {isPersonalCalendar(calendar) ? (\r\n <p className=\"formHint\">{list.personalHint}</p>\r\n ) : (\r\n <div className=\"calendarSettingBody\">\r\n <Switch\r\n label={list.showInPersonal}\r\n checked={calendar.showInPersonal}\r\n onChange={(checked) => void run(calendar.id, checked)}\r\n />\r\n <ActionFeedback error={error} />\r\n {canLeaveCalendar(calendar) ? (\r\n <div className=\"formActions\">\r\n <Button variant=\"outline\" onClick={onLeave}>\r\n {list.leave}\r\n </Button>\r\n </div>\r\n ) : (\r\n <p className=\"formHint\">{list.ownerCannotLeave}</p>\r\n )}\r\n </div>\r\n )}\r\n </li>\r\n )\r\n}\r\n\r\nexport function CalendarSettings() {\r\n const { m } = useI18n()\r\n const { list } = m.calendars\r\n const { teams } = useHost()\r\n const { calendars, error } = useCalendars()\r\n const [calendarToLeave, setCalendarToLeave] = useState<CalendarSummary | null>(null)\r\n\r\n return (\r\n <>\r\n {teams && <InvitationList />}\r\n <PageSection\r\n title={list.title}\r\n description={list.description}\r\n >\r\n <ErrorMessage message={error} />\r\n <ul className=\"calendarSettingList\">\r\n {calendars.map((calendar) => (\r\n <CalendarRow key={calendar.id} calendar={calendar} onLeave={() => setCalendarToLeave(calendar)} />\r\n ))}\r\n </ul>\r\n {teams && calendars.every(isPersonalCalendar) && (\r\n <p className=\"emptyHint\">{list.noTeamCalendars}</p>\r\n )}\r\n {teams && (\r\n <div className=\"formActions\">\r\n <ButtonLink to={ROUTES.createCalendar}>{list.create}</ButtonLink>\r\n </div>\r\n )}\r\n {calendarToLeave && <LeaveCalendarModal calendar={calendarToLeave} onClose={() => setCalendarToLeave(null)} />}\r\n </PageSection>\r\n </>\r\n )\r\n}\r\n","import type { ReactNode } from 'react'\r\nimport { Link } from 'react-router'\r\nimport { ROUTES } from '../config/routes.ts'\r\nimport { useI18n } from '../i18n/index.ts'\r\n\r\ntype PageLayoutProps = {\r\n title: string\r\n back?: { to: string; label: string }\r\n variant?: 'card' | 'full'\r\n footer?: ReactNode\r\n children: ReactNode\r\n}\r\n\r\nexport function PageLayout({ title, back, variant = 'card', footer, children }: PageLayoutProps) {\r\n const { m } = useI18n()\r\n const backLink = back ?? { to: ROUTES.calendar, label: m.common.backToCalendar }\r\n const heading = (\r\n <>\r\n <Link to={backLink.to} className=\"pageBack\">\r\n ← {backLink.label}\r\n </Link>\r\n <h1 className=\"pageTitle\">{title}</h1>\r\n </>\r\n )\r\n const body = (\r\n <>\r\n {children}\r\n {footer && <p className=\"pageFooter\">{footer}</p>}\r\n </>\r\n )\r\n\r\n if (variant === 'full')\r\n return (\r\n <div className=\"pageFull\">\r\n <header className=\"pageHeader\">{heading}</header>\r\n <main className=\"pageContent\">{body}</main>\r\n </div>\r\n )\r\n\r\n return (\r\n <main className=\"page\">\r\n <div className=\"pageCard surface\">\r\n {heading}\r\n {body}\r\n </div>\r\n </main>\r\n )\r\n}\r\n","import { useId, useRef, type KeyboardEvent, type ReactNode } from 'react'\r\nimport { classNames } from '../utils/classNames.ts'\r\n\r\nexport type TabDefinition<T extends string> = {\r\n value: T\r\n label: string\r\n content: ReactNode\r\n}\r\n\r\ntype TabsProps<T extends string> = {\r\n label: string\r\n tabs: readonly TabDefinition<T>[]\r\n value: T\r\n onChange: (value: T) => void\r\n}\r\n\r\nconst STEP_BY_KEY: Partial<Record<string, number>> = { ArrowLeft: -1, ArrowRight: 1 }\r\n\r\nexport function Tabs<T extends string>({ label, tabs, value, onChange }: TabsProps<T>) {\r\n const idPrefix = useId()\r\n const listRef = useRef<HTMLDivElement>(null)\r\n const activeIndex = Math.max(\r\n tabs.findIndex((tab) => tab.value === value),\r\n 0,\r\n )\r\n const active = tabs[activeIndex]\r\n const tabId = (tab: T) => `${idPrefix}-tab-${tab}`\r\n\r\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\r\n const step = STEP_BY_KEY[event.key]\r\n if (!step) return\r\n event.preventDefault()\r\n const next = tabs[(activeIndex + step + tabs.length) % tabs.length]\r\n onChange(next.value)\r\n listRef.current?.querySelector<HTMLElement>(`#${CSS.escape(tabId(next.value))}`)?.focus()\r\n }\r\n\r\n return (\r\n <div className=\"tabs\">\r\n <div ref={listRef} className=\"tabList\" role=\"tablist\" aria-label={label} onKeyDown={handleKeyDown}>\r\n {tabs.map((tab) => {\r\n const isActive = tab.value === active.value\r\n return (\r\n <button\r\n key={tab.value}\r\n id={tabId(tab.value)}\r\n type=\"button\"\r\n role=\"tab\"\r\n className={classNames('tab', isActive && 'active')}\r\n aria-selected={isActive}\r\n aria-controls={`${idPrefix}-panel`}\r\n tabIndex={isActive ? 0 : -1}\r\n onClick={() => onChange(tab.value)}\r\n >\r\n {tab.label}\r\n </button>\r\n )\r\n })}\r\n </div>\r\n <div id={`${idPrefix}-panel`} role=\"tabpanel\" aria-labelledby={tabId(active.value)} className=\"tabPanel\">\r\n {active.content}\r\n </div>\r\n </div>\r\n )\r\n}\r\n","import { useSearchParams } from 'react-router'\r\n\r\nconst TAB_PARAM = 'tab'\r\n\r\nexport function useTabParam<T extends string>(tabs: readonly { value: T }[]) {\r\n const [searchParams, setSearchParams] = useSearchParams()\r\n const requested = searchParams.get(TAB_PARAM)\r\n const active = tabs.find((tab) => tab.value === requested)?.value ?? tabs[0].value\r\n const select = (tab: T) => setSearchParams({ [TAB_PARAM]: tab }, { replace: true })\r\n return [active, select] as const\r\n}\r\n","import { createContext } from 'react'\r\nimport type { AuthContextValue } from '../types/auth.ts'\r\n\r\nexport const AuthContext = createContext<AuthContextValue | null>(null)\r\n","import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react'\r\nimport type {\r\n AccountDeletionInput,\r\n AuthContextValue,\r\n AuthRepository,\r\n AuthStatus,\r\n LoginInput,\r\n PasswordChangeInput,\r\n PasswordResetInput,\r\n PasswordResetRequestInput,\r\n ProfileInput,\r\n RegisterInput,\r\n User,\r\n} from '../types/auth.ts'\r\nimport { AppError } from '../../../utils/appError.ts'\r\nimport { AuthContext } from './AuthContext.ts'\r\n\r\ntype AuthProviderProps = {\r\n repository: AuthRepository | null\r\n children: ReactNode\r\n}\r\n\r\nconst unavailable = () => Promise.reject(new AppError('unknown'))\r\n\r\nconst DISABLED_AUTH: AuthRepository = {\r\n getCurrentUser: async () => null,\r\n login: unavailable,\r\n register: unavailable,\r\n logout: async () => undefined,\r\n updateProfile: unavailable,\r\n changePassword: unavailable,\r\n deleteAccount: unavailable,\r\n requestPasswordReset: unavailable,\r\n resetPassword: unavailable,\r\n verifyEmail: unavailable,\r\n resendVerificationEmail: unavailable,\r\n}\r\n\r\ntype Session = {\r\n status: AuthStatus\r\n user: User | null\r\n}\r\n\r\nconst ANONYMOUS: Session = { status: 'anonymous', user: null }\r\n\r\nconst authenticated = (user: User): Session => ({ status: 'authenticated', user })\r\n\r\nexport function AuthProvider({ repository: configuredRepository, children }: AuthProviderProps) {\r\n const enabled = configuredRepository !== null\r\n const repository = configuredRepository ?? DISABLED_AUTH\r\n const method = repository.method ?? 'password'\r\n const [session, setSession] = useState<Session>(enabled ? { status: 'loading', user: null } : ANONYMOUS)\r\n\r\n useEffect(() => {\r\n if (!enabled) return\r\n let cancelled = false\r\n repository\r\n .getCurrentUser()\r\n .then((user) => {\r\n if (!cancelled) setSession(user ? authenticated(user) : ANONYMOUS)\r\n })\r\n .catch(() => {\r\n if (!cancelled) setSession(ANONYMOUS)\r\n })\r\n return () => {\r\n cancelled = true\r\n }\r\n }, [repository, enabled])\r\n\r\n const signIn = useCallback(async (request: Promise<User>) => {\r\n const user = await request\r\n setSession(authenticated(user))\r\n return user\r\n }, [])\r\n\r\n const login = useCallback((input: LoginInput) => signIn(repository.login(input)), [repository, signIn])\r\n\r\n const register = useCallback((input: RegisterInput) => signIn(repository.register(input)), [repository, signIn])\r\n\r\n const updateProfile = useCallback(\r\n (input: ProfileInput) => signIn(repository.updateProfile(input)),\r\n [repository, signIn],\r\n )\r\n\r\n const logout = useCallback(async () => {\r\n try {\r\n await repository.logout()\r\n } finally {\r\n setSession(ANONYMOUS)\r\n }\r\n }, [repository])\r\n\r\n const deleteAccount = useCallback(\r\n async (input: AccountDeletionInput) => {\r\n await repository.deleteAccount(input)\r\n setSession(ANONYMOUS)\r\n },\r\n [repository],\r\n )\r\n\r\n const verifyEmail = useCallback(\r\n async (token: string) => {\r\n await repository.verifyEmail(token)\r\n setSession((current) => (current.user ? authenticated({ ...current.user, emailVerified: true }) : current))\r\n },\r\n [repository],\r\n )\r\n\r\n const accountRequests = useMemo(\r\n () => ({\r\n changePassword: (input: PasswordChangeInput) => repository.changePassword(input),\r\n requestPasswordReset: (input: PasswordResetRequestInput) => repository.requestPasswordReset(input),\r\n resetPassword: (input: PasswordResetInput) => repository.resetPassword(input),\r\n resendVerificationEmail: () => repository.resendVerificationEmail(),\r\n }),\r\n [repository],\r\n )\r\n\r\n const expireSession = useCallback(() => {\r\n if (method !== 'hostToken') {\r\n setSession(ANONYMOUS)\r\n return\r\n }\r\n repository\r\n .getCurrentUser()\r\n .then((user) => setSession(user ? authenticated(user) : ANONYMOUS))\r\n .catch(() => setSession(ANONYMOUS))\r\n }, [method, repository])\r\n\r\n const value = useMemo<AuthContextValue>(\r\n () => ({\r\n enabled,\r\n method,\r\n ...session,\r\n ...accountRequests,\r\n login,\r\n register,\r\n logout,\r\n updateProfile,\r\n deleteAccount,\r\n verifyEmail,\r\n expireSession,\r\n }),\r\n [enabled, method, session, accountRequests, login, register, logout, updateProfile, deleteAccount, verifyEmail, expireSession],\r\n )\r\n\r\n return <AuthContext value={value}>{children}</AuthContext>\r\n}\r\n","import { useRequiredContext } from '../../../hooks/useRequiredContext.ts'\r\nimport { AuthContext } from '../context/AuthContext.ts'\r\n\r\nexport const useAuth = () => useRequiredContext(AuthContext, 'AuthProvider')\r\n","import { isApiError } from '../../../utils/apiError.ts'\r\nimport { AppError } from '../../../utils/appError.ts'\r\nimport type { ApiClient } from '../../../utils/api.ts'\r\nimport type { AuthRepository, User, UserTokenProvider } from '../types/auth.ts'\r\n\r\nconst AUTH_PATH = '/auth'\r\n\r\nconst notAvailable = () => Promise.reject(new AppError('managedByHost'))\r\n\r\nexport class HostTokenAuthRepository implements AuthRepository {\r\n readonly method = 'hostToken'\r\n readonly #api: ApiClient\r\n readonly #getUserToken: UserTokenProvider\r\n\r\n constructor(api: ApiClient, getUserToken: UserTokenProvider) {\r\n this.#api = api\r\n this.#getUserToken = getUserToken\r\n }\r\n\r\n async getCurrentUser() {\r\n try {\r\n return await this.#api.get<User>(`${AUTH_PATH}/me`)\r\n } catch (error) {\r\n if (!isApiError(error) || !error.isUnauthorized) throw error\r\n }\r\n const token = await this.#getUserToken()\r\n if (!token) return null\r\n return this.#api.post<User>(`${AUTH_PATH}/token`, { token })\r\n }\r\n\r\n async logout() {\r\n await this.#api.post<void>(`${AUTH_PATH}/logout`)\r\n }\r\n\r\n login = notAvailable\r\n register = notAvailable\r\n updateProfile = notAvailable\r\n changePassword = notAvailable\r\n deleteAccount = notAvailable\r\n requestPasswordReset = notAvailable\r\n resetPassword = notAvailable\r\n verifyEmail = notAvailable\r\n resendVerificationEmail = notAvailable\r\n}\r\n","import { ApiError, isApiError } from '../../../utils/apiError.ts'\r\nimport type { ErrorCode } from '../../../utils/appError.ts'\r\nimport type { ApiClient } from '../../../utils/api.ts'\r\nimport type {\r\n AccountDeletionInput,\r\n AuthRepository,\r\n LoginInput,\r\n PasswordChangeInput,\r\n PasswordResetInput,\r\n PasswordResetRequestInput,\r\n ProfileInput,\r\n RegisterInput,\r\n User,\r\n} from '../types/auth.ts'\r\n\r\nconst AUTH_PATH = '/auth'\r\nconst ME_PATH = `${AUTH_PATH}/me`\r\n\r\ntype StatusCodes = Partial<Record<number, ErrorCode>>\r\n\r\nconst withCode = (error: unknown, codes: StatusCodes) => {\r\n if (!isApiError(error) || error.status === null) return error\r\n const code = codes[error.status]\r\n if (!code) return error\r\n return new ApiError(error.message, { kind: error.kind, code, status: error.status, body: error.body, cause: error })\r\n}\r\n\r\nconst translateErrors = async <T>(request: Promise<T>, codes: StatusCodes) => {\r\n try {\r\n return await request\r\n } catch (error) {\r\n throw withCode(error, codes)\r\n }\r\n}\r\n\r\nexport class RemoteAuthRepository implements AuthRepository {\r\n readonly method = 'password'\r\n readonly #api: ApiClient\r\n\r\n constructor(api: ApiClient) {\r\n this.#api = api\r\n }\r\n\r\n async getCurrentUser() {\r\n try {\r\n return await this.#api.get<User>(ME_PATH)\r\n } catch (error) {\r\n if (isApiError(error) && error.isUnauthorized) return null\r\n throw error\r\n }\r\n }\r\n\r\n login(input: LoginInput) {\r\n return translateErrors(this.#api.post<User>(`${AUTH_PATH}/login`, input), {\r\n 401: 'invalidCredentials',\r\n })\r\n }\r\n\r\n register(input: RegisterInput) {\r\n return translateErrors(this.#api.post<User>(`${AUTH_PATH}/register`, input), {\r\n 409: 'emailTaken',\r\n })\r\n }\r\n\r\n async logout() {\r\n await this.#api.post<void>(`${AUTH_PATH}/logout`)\r\n }\r\n\r\n updateProfile(input: ProfileInput) {\r\n return this.#api.patch<User>(ME_PATH, input)\r\n }\r\n\r\n changePassword(input: PasswordChangeInput) {\r\n return translateErrors(this.#api.post<void>(`${ME_PATH}/password`, input), {\r\n 403: 'wrongCurrentPassword',\r\n })\r\n }\r\n\r\n deleteAccount(input: AccountDeletionInput) {\r\n return translateErrors(this.#api.request<void>('DELETE', ME_PATH, { body: input }), {\r\n 403: 'wrongPassword',\r\n 409: 'soleOwner',\r\n })\r\n }\r\n\r\n async requestPasswordReset(input: PasswordResetRequestInput) {\r\n await this.#api.post<void>(`${AUTH_PATH}/password-reset`, input)\r\n }\r\n\r\n resetPassword(input: PasswordResetInput) {\r\n return translateErrors(this.#api.post<void>(`${AUTH_PATH}/password-reset/confirm`, input), {\r\n 410: 'invalidResetLink',\r\n })\r\n }\r\n\r\n verifyEmail(token: string) {\r\n return translateErrors(this.#api.post<void>(`${AUTH_PATH}/verify-email`, { token }), { 410: 'invalidLink' })\r\n }\r\n\r\n async resendVerificationEmail() {\r\n await this.#api.post<void>(`${AUTH_PATH}/verify-email/resend`)\r\n }\r\n}\r\n","import type { MouseEvent, ReactNode, ToggleEvent } from 'react'\r\nimport { useLocation } from 'react-router'\r\nimport { Button, ButtonLink } from '../../../components/Button.tsx'\r\nimport { ROUTES, withRedirect } from '../../../config/routes.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { useAsyncAction } from '../../../hooks/useAsyncAction.ts'\r\nimport { useAuth } from '../hooks/useAuth.ts'\r\nimport { ErrorMessage } from '../../../components/StatusMessage.tsx'\r\n\r\nconst ACCOUNT_POPOVER_ID = 'accountMenu'\r\n\r\nconst getInitial = (name: string) => name.trim().charAt(0).toUpperCase() || '?'\r\n\r\nconst closeOnAction = (event: MouseEvent<HTMLDivElement>) => {\r\n const menu = event.currentTarget\r\n if (menu.matches(':popover-open') && event.target instanceof Element && event.target.closest('a, button'))\r\n menu.hidePopover()\r\n}\r\n\r\nconst POPOVER_GAP_PX = 8\r\n\r\nconst placeBelowTrigger = (event: ToggleEvent<HTMLDivElement>) => {\r\n if (event.newState !== 'open') return\r\n const menu = event.currentTarget\r\n const trigger = (menu.getRootNode() as Document | ShadowRoot).querySelector<HTMLElement>(\r\n `[popovertarget=\"${menu.id}\"]`,\r\n )\r\n if (!trigger) return\r\n const { bottom, right } = trigger.getBoundingClientRect()\r\n menu.style.top = `${bottom + POPOVER_GAP_PX}px`\r\n menu.style.right = `${Math.max(document.documentElement.clientWidth - right, POPOVER_GAP_PX)}px`\r\n}\r\n\r\ntype AccountMenuProps = {\r\n menuItems?: ReactNode\r\n}\r\n\r\nexport function AccountMenu({ menuItems }: AccountMenuProps) {\r\n const { m } = useI18n()\r\n const { enabled, method, status, user, logout } = useAuth()\r\n const location = useLocation()\r\n const { run, isPending, error } = useAsyncAction(logout)\r\n\r\n if (!enabled || status === 'loading') return null\r\n\r\n if (!user && method === 'hostToken') return null\r\n\r\n if (!user)\r\n return (\r\n <ButtonLink\r\n to={withRedirect(ROUTES.login, location.pathname + location.search)}\r\n variant=\"outline\"\r\n className=\"accountLogin\"\r\n >\r\n {m.auth.menu.signIn}\r\n </ButtonLink>\r\n )\r\n\r\n return (\r\n <>\r\n <button\r\n type=\"button\"\r\n className=\"accountButton\"\r\n popoverTarget={ACCOUNT_POPOVER_ID}\r\n aria-label={m.auth.menu.accountOf(user.name)}\r\n title={user.name}\r\n >\r\n {getInitial(user.name)}\r\n </button>\r\n <div\r\n id={ACCOUNT_POPOVER_ID}\r\n popover=\"auto\"\r\n className=\"accountPopover surface\"\r\n onBeforeToggle={placeBelowTrigger}\r\n onClick={closeOnAction}\r\n >\r\n <p className=\"accountName\">{user.name}</p>\r\n <p className=\"accountEmail\">{user.email}</p>\r\n <ErrorMessage message={error} />\r\n {menuItems}\r\n <ButtonLink to={ROUTES.settings} variant=\"outline\" block>\r\n {m.common.settings}\r\n </ButtonLink>\r\n {method === 'password' && (\r\n <Button\r\n variant=\"secondary\"\r\n block\r\n isPending={isPending}\r\n pendingLabel={m.auth.menu.signingOut}\r\n onClick={() => void run()}\r\n >\r\n {m.auth.menu.signOut}\r\n </Button>\r\n )}\r\n </div>\r\n </>\r\n )\r\n}\r\n","import type { ReactNode, SubmitEventHandler } from 'react'\r\nimport { classNames } from '../utils/classNames.ts'\r\n\r\ntype FormProps = {\r\n onSubmit: SubmitEventHandler<HTMLFormElement>\r\n className?: string\r\n children: ReactNode\r\n}\r\n\r\nexport function Form({ onSubmit, className, children }: FormProps) {\r\n return (\r\n <form className={classNames('formSection', className)} method=\"post\" noValidate onSubmit={onSubmit}>\r\n {children}\r\n </form>\r\n )\r\n}\r\n","import { useCallback, useState } from 'react'\r\nimport { hasFieldErrors, type FieldErrors } from '../utils/validation.ts'\r\n\r\nexport function useFormState<T extends object>(initialValues: T, validate: (values: T) => FieldErrors<T>) {\r\n const [values, setValues] = useState(initialValues)\r\n const [errors, setErrors] = useState<FieldErrors<T>>({})\r\n\r\n const setField = useCallback(<K extends keyof T>(field: K, value: T[K]) => {\r\n setValues((current) => ({ ...current, [field]: value }))\r\n setErrors((current) => (current[field] ? { ...current, [field]: undefined } : current))\r\n }, [])\r\n\r\n const validateAll = (prepared: T = values) => {\r\n const nextErrors = validate(prepared)\r\n setErrors(nextErrors)\r\n return !hasFieldErrors(nextErrors)\r\n }\r\n\r\n const reset = useCallback(() => {\r\n setValues(initialValues)\r\n setErrors({})\r\n }, [initialValues])\r\n\r\n return { values, errors, setField, validateAll, reset }\r\n}\r\n","import type { SubmitEventHandler } from 'react'\r\nimport type { FieldErrors } from '../utils/validation.ts'\r\nimport { useAsyncAction } from './useAsyncAction.ts'\r\nimport { useFormState } from './useFormState.ts'\r\n\r\ntype FormOptions<T extends object> = {\r\n initialValues: T\r\n validate: (values: T) => FieldErrors<T>\r\n prepare?: (values: T) => T\r\n onSubmit: (values: T) => Promise<void>\r\n}\r\n\r\nexport function useForm<T extends object>({ initialValues, validate, prepare, onSubmit }: FormOptions<T>) {\r\n const form = useFormState(initialValues, validate)\r\n const action = useAsyncAction(onSubmit)\r\n\r\n const handleSubmit: SubmitEventHandler<HTMLFormElement> = (event) => {\r\n event.preventDefault()\r\n const prepared = prepare ? prepare(form.values) : form.values\r\n if (form.validateAll(prepared)) void action.run(prepared)\r\n }\r\n\r\n return { ...form, ...action, handleSubmit }\r\n}\r\n","import type { Messages } from '../../../i18n/index.ts'\r\nimport { validateEmail, type FieldErrors } from '../../../utils/validation.ts'\r\nimport type { AccountDeletionInput, LoginInput, PasswordResetRequestInput, ProfileInput, RegisterInput } from '../types/auth.ts'\r\n\r\nexport { EMAIL_MAX_LENGTH, normalizeEmail } from '../../../utils/validation.ts'\r\n\r\nexport const NAME_MAX_LENGTH = 80\r\nexport const PASSWORD_MIN_LENGTH = 8\r\nexport const PASSWORD_MAX_LENGTH = 128\r\n\r\nexport type NewPasswordValues = {\r\n password: string\r\n passwordConfirmation: string\r\n}\r\n\r\nexport type RegisterFormValues = RegisterInput & NewPasswordValues\r\n\r\nexport type PasswordChangeFormValues = NewPasswordValues & {\r\n currentPassword: string\r\n}\r\n\r\nconst validateName = (name: string, m: Messages) => {\r\n if (!name) return m.auth.validation.nameRequired\r\n if (name.length > NAME_MAX_LENGTH) return m.auth.validation.nameTooLong(NAME_MAX_LENGTH)\r\n return undefined\r\n}\r\n\r\nconst requirePassword = (password: string, m: Messages) => (password ? undefined : m.auth.validation.passwordRequired)\r\n\r\nconst validateNewPassword = (\r\n { password, passwordConfirmation }: NewPasswordValues,\r\n m: Messages,\r\n): FieldErrors<NewPasswordValues> => ({\r\n password:\r\n password.length < PASSWORD_MIN_LENGTH\r\n ? m.auth.validation.passwordTooShort(PASSWORD_MIN_LENGTH)\r\n : password.length > PASSWORD_MAX_LENGTH\r\n ? m.auth.validation.passwordTooLong(PASSWORD_MAX_LENGTH)\r\n : undefined,\r\n passwordConfirmation: passwordConfirmation === password ? undefined : m.auth.validation.passwordMismatch,\r\n})\r\n\r\nexport const validateLogin = ({ email, password }: LoginInput, m: Messages): FieldErrors<LoginInput> => ({\r\n email: validateEmail(email, m),\r\n password: requirePassword(password, m),\r\n})\r\n\r\nexport const validateRegister = (values: RegisterFormValues, m: Messages): FieldErrors<RegisterFormValues> => ({\r\n name: validateName(values.name, m),\r\n email: validateEmail(values.email, m),\r\n ...validateNewPassword(values, m),\r\n})\r\n\r\nexport const validateProfile = ({ name }: ProfileInput, m: Messages): FieldErrors<ProfileInput> => ({\r\n name: validateName(name, m),\r\n})\r\n\r\nexport const validatePasswordResetRequest = (\r\n { email }: PasswordResetRequestInput,\r\n m: Messages,\r\n): FieldErrors<PasswordResetRequestInput> => ({ email: validateEmail(email, m) })\r\n\r\nexport const validatePasswordReset = validateNewPassword\r\n\r\nexport const validatePasswordChange = (\r\n values: PasswordChangeFormValues,\r\n m: Messages,\r\n): FieldErrors<PasswordChangeFormValues> => {\r\n const errors = { currentPassword: requirePassword(values.currentPassword, m), ...validateNewPassword(values, m) }\r\n if (!errors.password && values.password === values.currentPassword)\r\n errors.password = m.auth.validation.passwordUnchanged\r\n return errors\r\n}\r\n\r\nexport const validateAccountDeletion = (\r\n { password }: AccountDeletionInput,\r\n m: Messages,\r\n): FieldErrors<AccountDeletionInput> => ({\r\n password: requirePassword(password, m),\r\n})\r\n","import type { ReactNode } from 'react'\r\nimport { classNames } from '../utils/classNames.ts'\r\n\r\ntype FormFieldProps = {\r\n label: string\r\n error?: string\r\n as?: 'label' | 'fieldset'\r\n className?: string\r\n children: ReactNode\r\n}\r\n\r\nexport function FormField({ label, error, as: Element = 'label', className, children }: FormFieldProps) {\r\n const Caption = Element === 'fieldset' ? 'legend' : 'span'\r\n return (\r\n <Element className={classNames('field', className)}>\r\n <Caption className=\"descriptor\">{label}</Caption>\r\n {children}\r\n {error && <span className=\"errorText\">{error}</span>}\r\n </Element>\r\n )\r\n}\r\n","import type { InputHTMLAttributes, ReactNode } from 'react'\r\nimport { classNames } from '../utils/classNames.ts'\r\nimport { FormField } from './FormField.tsx'\r\n\r\nexport type TextFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value'> & {\r\n label: string\r\n value: string\r\n error?: string\r\n addon?: ReactNode\r\n onChange: (value: string) => void\r\n}\r\n\r\nexport function TextField({ label, error, addon, onChange, className, ...inputProps }: TextFieldProps) {\r\n const input = (\r\n <input\r\n {...inputProps}\r\n className={classNames('input', className)}\r\n aria-invalid={Boolean(error)}\r\n onChange={(event) => onChange(event.target.value)}\r\n />\r\n )\r\n return (\r\n <FormField label={label} error={error}>\r\n {addon ? (\r\n <span className=\"inlineField\">\r\n {input}\r\n {addon}\r\n </span>\r\n ) : (\r\n input\r\n )}\r\n </FormField>\r\n )\r\n}\r\n","import { useState } from 'react'\r\nimport { TextField, type TextFieldProps } from './TextField.tsx'\r\n\r\ntype PasswordFieldProps = Omit<TextFieldProps, 'type' | 'addon'>\r\n\r\nexport function PasswordField(props: PasswordFieldProps) {\r\n const [isVisible, setIsVisible] = useState(false)\r\n return (\r\n <TextField\r\n {...props}\r\n type={isVisible ? 'text' : 'password'}\r\n addon={\r\n <button\r\n type=\"button\"\r\n className=\"fieldToggle\"\r\n aria-pressed={isVisible}\r\n onClick={() => setIsVisible((visible) => !visible)}\r\n >\r\n {isVisible ? 'Verbergen' : 'Anzeigen'}\r\n </button>\r\n }\r\n />\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { PasswordField } from '../../../components/PasswordField.tsx'\r\nimport { TextField } from '../../../components/TextField.tsx'\r\nimport type { FieldErrors } from '../../../utils/validation.ts'\r\nimport {\r\n EMAIL_MAX_LENGTH,\r\n NAME_MAX_LENGTH,\r\n PASSWORD_MAX_LENGTH,\r\n PASSWORD_MIN_LENGTH,\r\n type NewPasswordValues,\r\n} from '../utils/validation.ts'\r\n\r\ntype FieldProps = {\r\n value: string\r\n error?: string\r\n onChange: (value: string) => void\r\n autoFocus?: boolean\r\n}\r\n\r\nexport function NameField(props: FieldProps) {\r\n const { m } = useI18n()\r\n return <TextField {...props} label={m.auth.name} name=\"name\" autoComplete=\"name\" maxLength={NAME_MAX_LENGTH} />\r\n}\r\n\r\nexport function EmailField({ isNewAccount = false, ...props }: FieldProps & { isNewAccount?: boolean }) {\r\n const { m } = useI18n()\r\n return (\r\n <TextField\r\n {...props}\r\n label={m.auth.email}\r\n name=\"email\"\r\n type=\"email\"\r\n inputMode=\"email\"\r\n autoComplete={isNewAccount ? 'email' : 'username'}\r\n maxLength={EMAIL_MAX_LENGTH}\r\n />\r\n )\r\n}\r\n\r\ntype CurrentPasswordFieldProps = FieldProps & {\r\n label?: string\r\n name?: string\r\n 'data-autofocus'?: boolean\r\n}\r\n\r\nexport function CurrentPasswordField({ label, name = 'password', ...props }: CurrentPasswordFieldProps) {\r\n const { m } = useI18n()\r\n return (\r\n <PasswordField\r\n {...props}\r\n label={label ?? m.auth.password}\r\n name={name}\r\n autoComplete=\"current-password\"\r\n maxLength={PASSWORD_MAX_LENGTH}\r\n />\r\n )\r\n}\r\n\r\ntype NewPasswordFieldsProps = {\r\n values: NewPasswordValues\r\n errors: FieldErrors<NewPasswordValues>\r\n label?: string\r\n onChange: (field: keyof NewPasswordValues, value: string) => void\r\n}\r\n\r\nexport function NewPasswordFields({ values, errors, label, onChange }: NewPasswordFieldsProps) {\r\n const { m } = useI18n()\r\n const passwordLabel = label ?? m.auth.password\r\n const fields = [\r\n { name: 'password', label: passwordLabel },\r\n { name: 'passwordConfirmation', label: m.auth.repeat(passwordLabel) },\r\n ] as const\r\n\r\n return (\r\n <>\r\n {fields.map((field) => (\r\n <PasswordField\r\n key={field.name}\r\n label={field.label}\r\n name={field.name}\r\n autoComplete=\"new-password\"\r\n maxLength={PASSWORD_MAX_LENGTH}\r\n value={values[field.name]}\r\n error={errors[field.name]}\r\n onChange={(value) => onChange(field.name, value)}\r\n />\r\n ))}\r\n <p className=\"formHint\">{m.auth.passwordHint(PASSWORD_MIN_LENGTH)}</p>\r\n </>\r\n )\r\n}\r\n","import { useState } from 'react'\r\nimport { useI18n } from '../../../../i18n/index.ts'\r\nimport { Button } from '../../../../components/Button.tsx'\r\nimport { Form } from '../../../../components/Form.tsx'\r\nimport { Modal } from '../../../../components/Modal.tsx'\r\nimport { PageSection } from '../../../../components/PageSection.tsx'\r\nimport { ActionFeedback } from '../../../../components/StatusMessage.tsx'\r\nimport { useForm } from '../../../../hooks/useForm.ts'\r\nimport { useAuth } from '../../hooks/useAuth.ts'\r\nimport type { AccountDeletionInput } from '../../types/auth.ts'\r\nimport { validateAccountDeletion } from '../../utils/validation.ts'\r\nimport { CurrentPasswordField } from '../AuthFields.tsx'\r\n\r\nconst EMPTY_DELETION: AccountDeletionInput = { password: '' }\r\n\r\nfunction DeleteAccountModal({ onClose }: { onClose: () => void }) {\r\n const { m } = useI18n()\r\n const { deleteAccount } = useAuth()\r\n const { values, errors, setField, handleSubmit, isPending, error } = useForm({\r\n initialValues: EMPTY_DELETION,\r\n validate: (input) => validateAccountDeletion(input, m),\r\n onSubmit: deleteAccount,\r\n })\r\n\r\n return (\r\n <Modal title={m.auth.account.deleteTitle} variant=\"danger\" onClose={onClose}>\r\n <Form onSubmit={handleSubmit}>\r\n <p>\r\n {m.auth.account.deleteWarningBefore}\r\n <strong>{m.auth.account.deleteWarningStrong}</strong>\r\n {m.auth.account.deleteWarningAfter}\r\n </p>\r\n <CurrentPasswordField\r\n label={m.auth.account.deletePassword}\r\n value={values.password}\r\n error={errors.password}\r\n onChange={(password) => setField('password', password)}\r\n data-autofocus\r\n />\r\n <ActionFeedback error={error} />\r\n <div className=\"formActions\">\r\n <Button variant=\"secondary\" onClick={onClose}>\r\n {m.common.cancel}\r\n </Button>\r\n <Button type=\"submit\" variant=\"danger\" isPending={isPending} pendingLabel={m.auth.account.deletePending}>\r\n {m.auth.account.deleteSubmit}\r\n </Button>\r\n </div>\r\n </Form>\r\n </Modal>\r\n )\r\n}\r\n\r\nexport function DeleteAccountSection() {\r\n const { m } = useI18n()\r\n const [isConfirming, setIsConfirming] = useState(false)\r\n\r\n return (\r\n <PageSection title={m.auth.account.deleteTitle} tone=\"danger\" description={m.auth.account.deleteDescription}>\r\n <div className=\"formActions\">\r\n <Button variant=\"danger\" onClick={() => setIsConfirming(true)}>\r\n {m.auth.account.deleteOpen}\r\n </Button>\r\n </div>\r\n {isConfirming && <DeleteAccountModal onClose={() => setIsConfirming(false)} />}\r\n </PageSection>\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { ActionFeedback } from '../../../components/StatusMessage.tsx'\r\nimport { useAsyncAction } from '../../../hooks/useAsyncAction.ts'\r\nimport { useAuth } from '../hooks/useAuth.ts'\r\n\r\nexport function ResendVerificationButton({ label, className }: { label: string; className?: string }) {\r\n const { m } = useI18n()\r\n const { resendVerificationEmail } = useAuth()\r\n const { run, isPending, isSuccess, error } = useAsyncAction(resendVerificationEmail)\r\n\r\n if (isSuccess) return <ActionFeedback error={null} success={m.auth.verify.resent} />\r\n\r\n return (\r\n <>\r\n <Button\r\n variant=\"outline\"\r\n className={className}\r\n isPending={isPending}\r\n pendingLabel={m.auth.verify.sending}\r\n onClick={() => void run()}\r\n >\r\n {label}\r\n </Button>\r\n <ActionFeedback error={error} />\r\n </>\r\n )\r\n}\r\n","import { useI18n } from '../../../../i18n/index.ts'\r\nimport { PageSection } from '../../../../components/PageSection.tsx'\r\nimport type { User } from '../../types/auth.ts'\r\nimport { ResendVerificationButton } from '../ResendVerificationButton.tsx'\r\n\r\nexport function EmailSection({ user }: { user: User }) {\r\n const { m } = useI18n()\r\n return (\r\n <PageSection title={m.auth.account.emailTitle}>\r\n <p className=\"settingValue\">\r\n {user.email}\r\n <span className={user.emailVerified ? 'badge badge--success' : 'badge'}>\r\n {user.emailVerified ? m.auth.account.verified : m.auth.account.unverified}\r\n </span>\r\n </p>\r\n {!user.emailVerified && (\r\n <>\r\n <p className=\"formHint\">{m.auth.account.verificationSent}</p>\r\n <div className=\"formActions\">\r\n <ResendVerificationButton label={m.auth.account.resendVerification} />\r\n </div>\r\n </>\r\n )}\r\n </PageSection>\r\n )\r\n}\r\n","import { useI18n } from '../../../../i18n/index.ts'\r\nimport { Button } from '../../../../components/Button.tsx'\r\nimport { Form } from '../../../../components/Form.tsx'\r\nimport { PageSection } from '../../../../components/PageSection.tsx'\r\nimport { ActionFeedback } from '../../../../components/StatusMessage.tsx'\r\nimport { useForm } from '../../../../hooks/useForm.ts'\r\nimport { useAuth } from '../../hooks/useAuth.ts'\r\nimport { validatePasswordChange, type PasswordChangeFormValues } from '../../utils/validation.ts'\r\nimport { CurrentPasswordField, NewPasswordFields } from '../AuthFields.tsx'\r\n\r\nconst EMPTY_PASSWORD_CHANGE: PasswordChangeFormValues = { currentPassword: '', password: '', passwordConfirmation: '' }\r\n\r\nexport function PasswordSection() {\r\n const { m } = useI18n()\r\n const { changePassword } = useAuth()\r\n const { values, errors, setField, handleSubmit, reset, isPending, isSuccess, error } = useForm({\r\n initialValues: EMPTY_PASSWORD_CHANGE,\r\n validate: (input) => validatePasswordChange(input, m),\r\n onSubmit: async ({ currentPassword, password }) => {\r\n await changePassword({ currentPassword, newPassword: password })\r\n reset()\r\n },\r\n })\r\n\r\n return (\r\n <PageSection title={m.auth.account.passwordTitle} description={m.auth.account.passwordDescription}>\r\n <Form onSubmit={handleSubmit}>\r\n <CurrentPasswordField\r\n label={m.auth.account.currentPassword}\r\n name=\"currentPassword\"\r\n value={values.currentPassword}\r\n error={errors.currentPassword}\r\n onChange={(currentPassword) => setField('currentPassword', currentPassword)}\r\n />\r\n <NewPasswordFields label={m.auth.account.newPassword} values={values} errors={errors} onChange={setField} />\r\n <ActionFeedback error={error} success={isSuccess && m.auth.account.passwordChanged} />\r\n <div className=\"formActions\">\r\n <Button type=\"submit\" isPending={isPending} pendingLabel={m.auth.account.passwordPending}>\r\n {m.auth.account.passwordSubmit}\r\n </Button>\r\n </div>\r\n </Form>\r\n </PageSection>\r\n )\r\n}\r\n","import { useI18n } from '../../../../i18n/index.ts'\r\nimport { Button } from '../../../../components/Button.tsx'\r\nimport { Form } from '../../../../components/Form.tsx'\r\nimport { PageSection } from '../../../../components/PageSection.tsx'\r\nimport { ActionFeedback } from '../../../../components/StatusMessage.tsx'\r\nimport { useForm } from '../../../../hooks/useForm.ts'\r\nimport { useAuth } from '../../hooks/useAuth.ts'\r\nimport type { User } from '../../types/auth.ts'\r\nimport { validateProfile } from '../../utils/validation.ts'\r\nimport { NameField } from '../AuthFields.tsx'\r\n\r\nexport function ProfileSection({ user }: { user: User }) {\r\n const { m } = useI18n()\r\n const { updateProfile } = useAuth()\r\n const { values, errors, setField, handleSubmit, isPending, isSuccess, error } = useForm({\r\n initialValues: { name: user.name },\r\n validate: (input) => validateProfile(input, m),\r\n prepare: ({ name }) => ({ name: name.trim() }),\r\n onSubmit: async (input) => {\r\n await updateProfile(input)\r\n },\r\n })\r\n\r\n return (\r\n <PageSection title={m.auth.account.profile}>\r\n <Form onSubmit={handleSubmit}>\r\n <NameField value={values.name} error={errors.name} onChange={(name) => setField('name', name)} />\r\n <ActionFeedback error={error} success={isSuccess && m.common.saved} />\r\n <div className=\"formActions\">\r\n <Button\r\n type=\"submit\"\r\n isPending={isPending}\r\n pendingLabel={m.auth.account.savePending}\r\n disabled={values.name.trim() === user.name}\r\n >\r\n {m.common.save}\r\n </Button>\r\n </div>\r\n </Form>\r\n </PageSection>\r\n )\r\n}\r\n","import { useAuth } from '../../hooks/useAuth.ts'\r\nimport { DeleteAccountSection } from './DeleteAccountSection.tsx'\r\nimport { EmailSection } from './EmailSection.tsx'\r\nimport { PasswordSection } from './PasswordSection.tsx'\r\nimport { ProfileSection } from './ProfileSection.tsx'\r\n\r\nexport function AccountSettings() {\r\n const { enabled, user } = useAuth()\r\n if (!enabled || !user) return null\r\n\r\n return (\r\n <>\r\n <ProfileSection user={user} />\r\n <EmailSection user={user} />\r\n <PasswordSection />\r\n <DeleteAccountSection />\r\n </>\r\n )\r\n}\r\n","import type { ReactNode } from 'react'\r\nimport { Navigate, useLocation, useSearchParams } from 'react-router'\r\nimport { getRedirectTarget, ROUTES, withRedirect } from '../../../config/routes.ts'\r\nimport { useAuth } from '../hooks/useAuth.ts'\r\n\r\ntype AuthGateProps = {\r\n access: 'guest' | 'any' | 'user' | 'account'\r\n children: ReactNode\r\n}\r\n\r\nexport function AuthGate({ access, children }: AuthGateProps) {\r\n const { enabled, method, user } = useAuth()\r\n const [searchParams] = useSearchParams()\r\n const location = useLocation()\r\n\r\n const usesPassword = method === 'password'\r\n if (access === 'user') return enabled && usesPassword && !user ? <Navigate to={ROUTES.calendar} replace /> : children\r\n if (!enabled) return <Navigate to={ROUTES.calendar} replace />\r\n if (access === 'guest' && !usesPassword) return <Navigate to={ROUTES.calendar} replace />\r\n if (access === 'account' && !user)\r\n return <Navigate to={usesPassword ? withRedirect(ROUTES.login, location.pathname) : ROUTES.calendar} replace />\r\n if (access === 'guest' && user) return <Navigate to={getRedirectTarget(searchParams)} replace />\r\n return children\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { useAuth } from '../hooks/useAuth.ts'\r\nimport { ResendVerificationButton } from './ResendVerificationButton.tsx'\r\n\r\nexport function EmailVerificationBanner() {\r\n const { m } = useI18n()\r\n const { method, user } = useAuth()\r\n if (!user || user.emailVerified || method !== 'password') return null\r\n\r\n return (\r\n <div className=\"banner\" role=\"region\" aria-label={m.auth.verify.bannerLabel}>\r\n <p>\r\n {m.auth.verify.bannerBefore}\r\n <strong>{user.email}</strong>\r\n {m.auth.verify.bannerAfter}\r\n </p>\r\n <ResendVerificationButton label={m.auth.verify.resend} className=\"bannerAction\" />\r\n </div>\r\n )\r\n}\r\n","import { Link } from 'react-router'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { Form } from '../../../components/Form.tsx'\r\nimport { PageLayout } from '../../../components/PageLayout.tsx'\r\nimport { ActionFeedback } from '../../../components/StatusMessage.tsx'\r\nimport { ROUTES } from '../../../config/routes.ts'\r\nimport { useForm } from '../../../hooks/useForm.ts'\r\nimport { useAuth } from '../hooks/useAuth.ts'\r\nimport type { PasswordResetRequestInput } from '../types/auth.ts'\r\nimport { normalizeEmail, validatePasswordResetRequest } from '../utils/validation.ts'\r\nimport { EmailField } from './AuthFields.tsx'\r\n\r\nconst EMPTY_REQUEST: PasswordResetRequestInput = { email: '' }\r\n\r\nexport function ForgotPasswordPage() {\r\n const { m } = useI18n()\r\n const { requestPasswordReset } = useAuth()\r\n const { values, errors, setField, handleSubmit, isPending, isSuccess, error } = useForm({\r\n initialValues: EMPTY_REQUEST,\r\n validate: (input) => validatePasswordResetRequest(input, m),\r\n prepare: ({ email }) => ({ email: normalizeEmail(email) }),\r\n onSubmit: requestPasswordReset,\r\n })\r\n\r\n return (\r\n <PageLayout\r\n title={m.auth.forgot.title}\r\n footer={\r\n <>\r\n {m.auth.forgot.remembered} <Link to={ROUTES.login}>{m.auth.forgot.loginLink}</Link>\r\n </>\r\n }\r\n >\r\n {isSuccess ? (\r\n <ActionFeedback\r\n error={null}\r\n success={m.auth.forgot.success(normalizeEmail(values.email))}\r\n />\r\n ) : (\r\n <Form onSubmit={handleSubmit}>\r\n <p className=\"formHint\">{m.auth.forgot.hint}</p>\r\n <EmailField\r\n value={values.email}\r\n error={errors.email}\r\n onChange={(email) => setField('email', email)}\r\n autoFocus\r\n />\r\n <ActionFeedback error={error} />\r\n <Button type=\"submit\" block isPending={isPending} pendingLabel={m.auth.forgot.pending}>\r\n {m.auth.forgot.submit}\r\n </Button>\r\n </Form>\r\n )}\r\n </PageLayout>\r\n )\r\n}\r\n","import { Link, useNavigate, useSearchParams } from 'react-router'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { Form } from '../../../components/Form.tsx'\r\nimport { PageLayout } from '../../../components/PageLayout.tsx'\r\nimport { ActionFeedback } from '../../../components/StatusMessage.tsx'\r\nimport { getRedirectTarget, ROUTES, withRedirect } from '../../../config/routes.ts'\r\nimport { useForm } from '../../../hooks/useForm.ts'\r\nimport { useAuth } from '../hooks/useAuth.ts'\r\nimport type { LoginInput } from '../types/auth.ts'\r\nimport { normalizeEmail, validateLogin } from '../utils/validation.ts'\r\nimport { CurrentPasswordField, EmailField } from './AuthFields.tsx'\r\n\r\nconst EMPTY_LOGIN: LoginInput = { email: '', password: '' }\r\n\r\nexport function LoginPage() {\r\n const { m } = useI18n()\r\n const { login } = useAuth()\r\n const navigate = useNavigate()\r\n const [searchParams] = useSearchParams()\r\n const redirectTo = getRedirectTarget(searchParams)\r\n const { values, errors, setField, handleSubmit, isPending, error } = useForm({\r\n initialValues: EMPTY_LOGIN,\r\n validate: (input) => validateLogin(input, m),\r\n prepare: (input) => ({ ...input, email: normalizeEmail(input.email) }),\r\n onSubmit: async (input) => {\r\n await login(input)\r\n await navigate(redirectTo, { replace: true })\r\n },\r\n })\r\n\r\n return (\r\n <PageLayout\r\n title={m.auth.login.title}\r\n footer={\r\n <>\r\n {m.auth.login.noAccount} <Link to={withRedirect(ROUTES.register, redirectTo)}>{m.auth.login.registerLink}</Link>\r\n </>\r\n }\r\n >\r\n <Form onSubmit={handleSubmit}>\r\n <EmailField\r\n value={values.email}\r\n error={errors.email}\r\n onChange={(email) => setField('email', email)}\r\n autoFocus\r\n />\r\n <CurrentPasswordField\r\n value={values.password}\r\n error={errors.password}\r\n onChange={(password) => setField('password', password)}\r\n />\r\n <Link to={ROUTES.forgotPassword} className=\"formLink\">\r\n {m.auth.login.forgotPassword}\r\n </Link>\r\n <ActionFeedback error={error} />\r\n <Button type=\"submit\" block isPending={isPending} pendingLabel={m.auth.login.pending}>\r\n {m.auth.login.submit}\r\n </Button>\r\n </Form>\r\n </PageLayout>\r\n )\r\n}\r\n","import { Link, useNavigate, useSearchParams } from 'react-router'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { Form } from '../../../components/Form.tsx'\r\nimport { PageLayout } from '../../../components/PageLayout.tsx'\r\nimport { ActionFeedback } from '../../../components/StatusMessage.tsx'\r\nimport { getRedirectTarget, ROUTES, withRedirect } from '../../../config/routes.ts'\r\nimport { useForm } from '../../../hooks/useForm.ts'\r\nimport { useAuth } from '../hooks/useAuth.ts'\r\nimport { normalizeEmail, validateRegister, type RegisterFormValues } from '../utils/validation.ts'\r\nimport { EmailField, NameField, NewPasswordFields } from './AuthFields.tsx'\r\n\r\nconst EMPTY_REGISTRATION: RegisterFormValues = { name: '', email: '', password: '', passwordConfirmation: '' }\r\n\r\nexport function RegisterPage() {\r\n const { m } = useI18n()\r\n const { register } = useAuth()\r\n const navigate = useNavigate()\r\n const [searchParams] = useSearchParams()\r\n const redirectTo = getRedirectTarget(searchParams)\r\n const { values, errors, setField, handleSubmit, isPending, error } = useForm({\r\n initialValues: EMPTY_REGISTRATION,\r\n validate: (input) => validateRegister(input, m),\r\n prepare: (input) => ({ ...input, name: input.name.trim(), email: normalizeEmail(input.email) }),\r\n onSubmit: async ({ name, email, password }) => {\r\n await register({ name, email, password })\r\n await navigate(redirectTo, { replace: true })\r\n },\r\n })\r\n\r\n return (\r\n <PageLayout\r\n title={m.auth.register.title}\r\n footer={\r\n <>\r\n {m.auth.register.hasAccount} <Link to={withRedirect(ROUTES.login, redirectTo)}>{m.auth.register.loginLink}</Link>\r\n </>\r\n }\r\n >\r\n <Form onSubmit={handleSubmit}>\r\n <NameField value={values.name} error={errors.name} onChange={(name) => setField('name', name)} autoFocus />\r\n <EmailField\r\n isNewAccount\r\n value={values.email}\r\n error={errors.email}\r\n onChange={(email) => setField('email', email)}\r\n />\r\n <NewPasswordFields values={values} errors={errors} onChange={setField} />\r\n <ActionFeedback error={error} />\r\n <Button type=\"submit\" block isPending={isPending} pendingLabel={m.auth.register.pending}>\r\n {m.auth.register.submit}\r\n </Button>\r\n </Form>\r\n </PageLayout>\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { ButtonLink } from '../../../components/Button.tsx'\r\nimport { ROUTES } from '../../../config/routes.ts'\r\nimport { useAuth } from '../hooks/useAuth.ts'\r\n\r\nexport function ContinueLink() {\r\n const { m } = useI18n()\r\n const { user } = useAuth()\r\n return (\r\n <ButtonLink to={user ? ROUTES.calendar : ROUTES.login} block>\r\n {user ? m.auth.continueToCalendar : m.auth.signInNow}\r\n </ButtonLink>\r\n )\r\n}\r\n","import { Link, useSearchParams } from 'react-router'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { Form } from '../../../components/Form.tsx'\r\nimport { PageLayout } from '../../../components/PageLayout.tsx'\r\nimport { ActionFeedback } from '../../../components/StatusMessage.tsx'\r\nimport { ROUTES, TOKEN_PARAM } from '../../../config/routes.ts'\r\nimport { useForm } from '../../../hooks/useForm.ts'\r\nimport { useAuth } from '../hooks/useAuth.ts'\r\nimport { validatePasswordReset, type NewPasswordValues } from '../utils/validation.ts'\r\nimport { NewPasswordFields } from './AuthFields.tsx'\r\nimport { ContinueLink } from './ContinueLink.tsx'\r\n\r\nconst EMPTY_PASSWORD: NewPasswordValues = { password: '', passwordConfirmation: '' }\r\n\r\nfunction NewLinkLink() {\r\n const { m } = useI18n()\r\n return <Link to={ROUTES.forgotPassword}>{m.auth.reset.requestNewLink}</Link>\r\n}\r\n\r\nexport function ResetPasswordPage() {\r\n const { m } = useI18n()\r\n const { resetPassword } = useAuth()\r\n const [searchParams] = useSearchParams()\r\n const token = searchParams.get(TOKEN_PARAM)\r\n const { values, errors, setField, handleSubmit, isPending, isSuccess, error } = useForm({\r\n initialValues: EMPTY_PASSWORD,\r\n validate: (input) => validatePasswordReset(input, m),\r\n onSubmit: ({ password }) => resetPassword({ token: token ?? '', password }),\r\n })\r\n\r\n const renderContent = () => {\r\n if (!token)\r\n return (\r\n <>\r\n <ActionFeedback error={m.auth.reset.incompleteLink} />\r\n <NewLinkLink />\r\n </>\r\n )\r\n\r\n if (isSuccess)\r\n return (\r\n <>\r\n <ActionFeedback error={null} success={m.auth.reset.success} />\r\n <ContinueLink />\r\n </>\r\n )\r\n\r\n return (\r\n <Form onSubmit={handleSubmit}>\r\n <NewPasswordFields label={m.auth.reset.newPassword} values={values} errors={errors} onChange={setField} />\r\n <ActionFeedback error={error} />\r\n {error && <NewLinkLink />}\r\n <Button type=\"submit\" block isPending={isPending} pendingLabel={m.auth.reset.pending}>\r\n {m.auth.reset.submit}\r\n </Button>\r\n </Form>\r\n )\r\n }\r\n\r\n return <PageLayout title={m.auth.reset.title}>{renderContent()}</PageLayout>\r\n}\r\n","import { useCallback } from 'react'\r\nimport { Link, useSearchParams } from 'react-router'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { PageLayout } from '../../../components/PageLayout.tsx'\r\nimport { ActionFeedback } from '../../../components/StatusMessage.tsx'\r\nimport { ROUTES, TOKEN_PARAM } from '../../../config/routes.ts'\r\nimport { useAsyncResource } from '../../../hooks/useAsyncResource.ts'\r\nimport { useAuth } from '../hooks/useAuth.ts'\r\nimport { ContinueLink } from './ContinueLink.tsx'\r\n\r\nconst verifications = new Map<string, Promise<boolean>>()\r\n\r\nconst verifyOnce = (token: string, verify: (token: string) => Promise<void>) => {\r\n let verification = verifications.get(token)\r\n if (!verification) {\r\n verification = verify(token).then(() => true)\r\n verifications.set(token, verification)\r\n }\r\n return verification\r\n}\r\n\r\nexport function VerifyEmailPage() {\r\n const { m } = useI18n()\r\n const { user, verifyEmail } = useAuth()\r\n const [searchParams] = useSearchParams()\r\n const token = searchParams.get(TOKEN_PARAM)\r\n const load = useCallback(async () => (token ? verifyOnce(token, verifyEmail) : false), [token, verifyEmail])\r\n const { data: isVerified, error, isLoading } = useAsyncResource(load, false)\r\n\r\n if (token && isLoading)\r\n return (\r\n <PageLayout title={m.auth.verify.title}>\r\n <p className=\"formHint\">{m.auth.verify.verifying}</p>\r\n </PageLayout>\r\n )\r\n\r\n return (\r\n <PageLayout title={m.auth.verify.title}>\r\n <ActionFeedback\r\n error={token ? error : m.auth.verify.incompleteLink}\r\n success={isVerified && m.auth.verify.success}\r\n />\r\n <ContinueLink />\r\n {error && user && (\r\n <p className=\"formHint\">\r\n {m.auth.verify.newLinkBefore}\r\n <Link to={ROUTES.settings}>{m.auth.verify.newLinkSettings}</Link>\r\n {m.auth.verify.newLinkAfter}\r\n </p>\r\n )}\r\n </PageLayout>\r\n )\r\n}\r\n","import { useCallback } from 'react'\r\nimport { useAsyncResource } from '../../../hooks/useAsyncResource.ts'\r\nimport type { CalendarSummary, Invitation, TeamInvitation, TeamMember, TeamRole } from '../types/calendar.ts'\r\nimport { hasPermission, isPersonalCalendar } from '../utils/permissions.ts'\r\nimport { useCalendars } from './useCalendars.ts'\r\n\r\nconst NO_MEMBERS: TeamMember[] = []\r\nconst NO_INVITATIONS: TeamInvitation[] = []\r\n\r\nexport function useTeam(calendar: CalendarSummary) {\r\n const { repository } = useCalendars()\r\n const { teamId } = calendar\r\n const isTeam = !isPersonalCalendar(calendar)\r\n const canSeeInvitations = isTeam && hasPermission(calendar, 'invite_members')\r\n\r\n const loadMembers = useCallback(\r\n async () => (isTeam ? repository.listMembers(teamId) : NO_MEMBERS),\r\n [isTeam, repository, teamId],\r\n )\r\n const loadInvitations = useCallback(\r\n async () => (canSeeInvitations ? repository.listTeamInvitations(teamId) : NO_INVITATIONS),\r\n [canSeeInvitations, repository, teamId],\r\n )\r\n const members = useAsyncResource(loadMembers, NO_MEMBERS)\r\n const invitations = useAsyncResource(loadInvitations, NO_INVITATIONS)\r\n const { update: updateMembers } = members\r\n const { update: updateInvitations } = invitations\r\n\r\n const changeRole = useCallback(\r\n async (userId: string, role: TeamRole) => {\r\n const changed = await repository.changeMemberRole(teamId, userId, role)\r\n updateMembers((current) => current.map((member) => (member.userId === userId ? changed : member)))\r\n },\r\n [repository, teamId, updateMembers],\r\n )\r\n\r\n const removeMember = useCallback(\r\n async (userId: string) => {\r\n await repository.removeMember(teamId, userId)\r\n updateMembers((current) => current.filter((member) => member.userId !== userId))\r\n },\r\n [repository, teamId, updateMembers],\r\n )\r\n\r\n const invite = useCallback(\r\n async (invitation: Invitation) => {\r\n const created = await repository.invite(teamId, invitation)\r\n updateInvitations((current) => [...current, created])\r\n },\r\n [repository, teamId, updateInvitations],\r\n )\r\n\r\n const revokeInvitation = useCallback(\r\n async (invitationId: string) => {\r\n await repository.revokeInvitation(teamId, invitationId)\r\n updateInvitations((current) => current.filter((invitation) => invitation.id !== invitationId))\r\n },\r\n [repository, teamId, updateInvitations],\r\n )\r\n\r\n return {\r\n reloadMembers: members.reload,\r\n members: members.data,\r\n membersError: members.error,\r\n invitations: invitations.data,\r\n invitationsError: invitations.error,\r\n changeRole,\r\n removeMember,\r\n invite,\r\n revokeInvitation,\r\n }\r\n}\r\n","import { useState } from 'react'\r\nimport { Button } from '../../../../components/Button.tsx'\r\nimport { Modal } from '../../../../components/Modal.tsx'\r\nimport { TextField } from '../../../../components/TextField.tsx'\r\nimport { useI18n } from '../../../../i18n/index.ts'\r\nimport type { TeamMember } from '../../types/calendar.ts'\r\n\r\ntype TransferOwnershipModalProps = {\r\n candidates: readonly TeamMember[]\r\n onSelect: (member: TeamMember) => void\r\n onClose: () => void\r\n}\r\n\r\nconst matches = ({ name, email }: TeamMember, query: string, locale: string) =>\r\n `${name} ${email}`.toLocaleLowerCase(locale).includes(query.trim().toLocaleLowerCase(locale))\r\n\r\nexport function TransferOwnershipModal({ candidates, onSelect, onClose }: TransferOwnershipModalProps) {\r\n const { m, locale } = useI18n()\r\n const { transfer, roles } = m.calendars\r\n const [query, setQuery] = useState('')\r\n const [selectedId, setSelectedId] = useState<string | null>(null)\r\n const results = candidates.filter((member) => matches(member, query, locale))\r\n const selected = candidates.find((member) => member.userId === selectedId) ?? null\r\n\r\n return (\r\n <Modal title={transfer.title} onClose={onClose}>\r\n <div className=\"formSection\">\r\n <TextField\r\n label={transfer.search}\r\n name=\"memberSearch\"\r\n type=\"search\"\r\n autoComplete=\"off\"\r\n placeholder={transfer.searchPlaceholder}\r\n value={query}\r\n onChange={setQuery}\r\n data-autofocus\r\n />\r\n {results.length === 0 ? (\r\n <p className=\"emptyHint\">{transfer.noResults}</p>\r\n ) : (\r\n <ul className=\"memberPicker\" role=\"radiogroup\" aria-label={transfer.newOwner}>\r\n {results.map((member) => (\r\n <li key={member.userId}>\r\n <label className=\"memberOption\">\r\n <input\r\n type=\"radio\"\r\n name=\"newOwner\"\r\n value={member.userId}\r\n checked={member.userId === selectedId}\r\n onChange={() => setSelectedId(member.userId)}\r\n />\r\n <span className=\"itemRowMain\">\r\n <span className=\"itemRowTitle\">{member.name}</span>\r\n <span className=\"itemRowMeta\">{member.email}</span>\r\n </span>\r\n <span className=\"badge\">{roles[member.role]}</span>\r\n </label>\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n <div className=\"formActions\">\r\n <Button variant=\"secondary\" onClick={onClose}>\r\n {m.common.cancel}\r\n </Button>\r\n <Button disabled={!selected} onClick={() => selected && onSelect(selected)}>\r\n {transfer.confirm}\r\n </Button>\r\n </div>\r\n </div>\r\n </Modal>\r\n )\r\n}\r\n","import { useState } from 'react'\r\nimport { useNavigate } from 'react-router'\r\nimport { Button } from '../../../../components/Button.tsx'\r\nimport { ConfirmModal } from '../../../../components/ConfirmModal.tsx'\r\nimport { PageSection } from '../../../../components/PageSection.tsx'\r\nimport { SETTINGS_CALENDARS_PATH } from '../../../../config/routes.ts'\r\nimport { useI18n } from '../../../../i18n/index.ts'\r\nimport { useCalendars } from '../../hooks/useCalendars.ts'\r\nimport type { CalendarSummary, TeamMember } from '../../types/calendar.ts'\r\nimport { hasPermission } from '../../utils/permissions.ts'\r\nimport { TransferOwnershipModal } from './TransferOwnershipModal.tsx'\r\n\r\ntype Action = { type: 'leave' | 'delete' | 'transfer' } | { type: 'confirmTransfer'; member: TeamMember }\r\n\r\ntype DangerSectionProps = {\r\n calendar: CalendarSummary\r\n members: readonly TeamMember[]\r\n currentUserId: string | null\r\n onOwnershipTransferred: () => void\r\n}\r\n\r\nexport function DangerSection({ calendar, members, currentUserId, onOwnershipTransferred }: DangerSectionProps) {\r\n const { m } = useI18n()\r\n const { danger, leave, roles } = m.calendars\r\n const { leaveCalendar, deleteTeam, transferOwnership } = useCalendars()\r\n const navigate = useNavigate()\r\n const [action, setAction] = useState<Action | null>(null)\r\n const isOwner = calendar.role === 'owner'\r\n const candidates = members.filter((member) => member.userId !== currentUserId && member.role !== 'owner')\r\n const owners = members.filter((member) => member.role === 'owner').length\r\n const isLastOwner = calendar.role === 'owner' && owners <= 1\r\n const canDelete = hasPermission(calendar, 'delete_team')\r\n const teamName = calendar.teamName ?? calendar.name\r\n\r\n const finish = async (operation: () => Promise<void>) => {\r\n await operation()\r\n await navigate(SETTINGS_CALENDARS_PATH, { replace: true })\r\n }\r\n\r\n return (\r\n <PageSection title={danger.title} tone=\"danger\">\r\n {isOwner && (\r\n <div className=\"dangerAction\">\r\n <p className=\"formHint\">\r\n {candidates.length > 0 ? danger.transferHint : danger.transferUnavailable}\r\n </p>\r\n <Button variant=\"outline\" disabled={candidates.length === 0} onClick={() => setAction({ type: 'transfer' })}>\r\n {danger.transfer}\r\n </Button>\r\n </div>\r\n )}\r\n <div className=\"dangerAction\">\r\n <p className=\"formHint\">\r\n {isLastOwner ? danger.lastOwnerHint : danger.leaveHint}\r\n </p>\r\n <Button variant=\"outline\" disabled={isLastOwner} onClick={() => setAction({ type: 'leave' })}>\r\n {m.calendars.list.leave}\r\n </Button>\r\n </div>\r\n {canDelete && (\r\n <div className=\"dangerAction\">\r\n <p className=\"formHint\">{danger.deleteHint(teamName)}</p>\r\n <Button variant=\"danger\" onClick={() => setAction({ type: 'delete' })}>\r\n {danger.deleteTeam}\r\n </Button>\r\n </div>\r\n )}\r\n\r\n {action?.type === 'transfer' && (\r\n <TransferOwnershipModal\r\n candidates={candidates}\r\n onSelect={(member) => setAction({ type: 'confirmTransfer', member })}\r\n onClose={() => setAction(null)}\r\n />\r\n )}\r\n {action?.type === 'confirmTransfer' && (\r\n <ConfirmModal\r\n title={danger.transferConfirmTitle}\r\n confirmLabel={danger.transferConfirm}\r\n pendingLabel={danger.transferring}\r\n onConfirm={async () => {\r\n await transferOwnership(calendar, action.member.userId)\r\n onOwnershipTransferred()\r\n setAction(null)\r\n }}\r\n onClose={() => setAction(null)}\r\n >\r\n {danger.transferMessage(action.member.name, action.member.email, teamName, roles.admin)}\r\n </ConfirmModal>\r\n )}\r\n {action?.type === 'leave' && (\r\n <ConfirmModal\r\n title={leave.title}\r\n confirmLabel={leave.confirm}\r\n pendingLabel={leave.pending}\r\n onConfirm={() => finish(() => leaveCalendar(calendar.id))}\r\n onClose={() => setAction(null)}\r\n >\r\n {leave.message(teamName)}\r\n </ConfirmModal>\r\n )}\r\n {action?.type === 'delete' && (\r\n <ConfirmModal\r\n title={danger.deleteTitle}\r\n confirmLabel={danger.deleteConfirm}\r\n pendingLabel={danger.deleting}\r\n onConfirm={() => finish(() => deleteTeam(calendar))}\r\n onClose={() => setAction(null)}\r\n >\r\n {danger.deleteMessage(teamName, members.length)}\r\n </ConfirmModal>\r\n )}\r\n </PageSection>\r\n )\r\n}\r\n","import { useEffect } from 'react'\r\nimport { useRootElement } from '../context/RootElementContext.ts'\r\n\r\ntype ArrowKeyNavigationOptions = {\r\n onPrevious: () => void\r\n onNext: () => void\r\n}\r\n\r\nconst isEditableTarget = (target: EventTarget | null) =>\r\n target instanceof HTMLElement &&\r\n (target.isContentEditable || target.closest('input, textarea, select, [role=\"dialog\"], dialog') !== null)\r\n\r\nexport function useArrowKeyNavigation({ onPrevious, onNext }: ArrowKeyNavigationOptions) {\r\n const root = useRootElement()\r\n\r\n useEffect(() => {\r\n const handleKeyDown = (event: KeyboardEvent) => {\r\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return\r\n if (isEditableTarget(event.target)) return\r\n\r\n const action = event.key === 'ArrowLeft' ? onPrevious : event.key === 'ArrowRight' ? onNext : null\r\n if (!action) return\r\n event.preventDefault()\r\n action()\r\n }\r\n\r\n root.addEventListener('keydown', handleKeyDown)\r\n return () => root.removeEventListener('keydown', handleKeyDown)\r\n }, [root, onPrevious, onNext])\r\n}\r\n","import { createContext } from 'react'\r\nimport type { StorageContextValue } from '../types/storage.ts'\r\n\r\nexport const StorageContext = createContext<StorageContextValue | null>(null)\r\n","import { useCallback, useMemo, useState, type ReactNode } from 'react'\r\nimport type { StorageContextValue, StorageRepositories } from '../types/storage.ts'\r\nimport { StorageContext } from './StorageContext.ts'\r\n\r\ntype StorageProviderProps = {\r\n repositories: StorageRepositories\r\n children: ReactNode\r\n}\r\n\r\nexport function StorageProvider({ repositories, children }: StorageProviderProps) {\r\n const [version, setVersion] = useState(0)\r\n const invalidate = useCallback(() => setVersion((current) => current + 1), [])\r\n const value = useMemo<StorageContextValue>(\r\n () => ({ ...repositories, version, invalidate }),\r\n [repositories, version, invalidate],\r\n )\r\n\r\n return <StorageContext value={value}>{children}</StorageContext>\r\n}\r\n","import { useRequiredContext } from '../../../hooks/useRequiredContext.ts'\r\nimport { StorageContext } from '../context/StorageContext.ts'\r\n\r\nexport const useStorage = () => useRequiredContext(StorageContext, 'StorageProvider')\r\n\r\nexport const useEventRepository = () => useStorage().events\r\n\r\nexport const useColorRepository = () => useStorage().colors\r\n\r\nexport const usePreferencesRepository = () => useStorage().preferences\r\n","import { AppError, type ErrorCode } from '../../../utils/appError.ts'\r\n\r\nexport class LocalStorageValue<T> {\r\n readonly #key: string\r\n readonly #parse: (value: unknown) => T\r\n readonly #writeError: ErrorCode\r\n\r\n constructor(key: string, parse: (value: unknown) => T, writeError: ErrorCode) {\r\n this.#key = key\r\n this.#parse = parse\r\n this.#writeError = writeError\r\n }\r\n\r\n initialize() {\r\n try {\r\n if (localStorage.getItem(this.#key) === null) localStorage.setItem(this.#key, JSON.stringify(this.#parse(null)))\r\n } catch {\r\n return\r\n }\r\n }\r\n\r\n read(): T {\r\n try {\r\n const raw = localStorage.getItem(this.#key)\r\n return this.#parse(raw ? JSON.parse(raw) : null)\r\n } catch {\r\n return this.#parse(null)\r\n }\r\n }\r\n\r\n write(value: T) {\r\n try {\r\n localStorage.setItem(this.#key, JSON.stringify(value))\r\n } catch {\r\n throw new AppError(this.#writeError)\r\n }\r\n }\r\n\r\n update(change: (value: T) => T) {\r\n const next = change(this.read())\r\n this.write(next)\r\n return next\r\n }\r\n}\r\n","import type { ErrorCode } from '../../../utils/appError.ts'\r\nimport { LocalStorageValue } from './localStorageValue.ts'\r\n\r\nexport class LocalStorageList<T> extends LocalStorageValue<T[]> {\r\n constructor(key: string, parseItem: (value: unknown) => T | null, writeError: ErrorCode) {\r\n super(\r\n key,\r\n (value) => (Array.isArray(value) ? value.map(parseItem).filter((item): item is T => item !== null) : []),\r\n writeError,\r\n )\r\n }\r\n}\r\n","import { AppError } from '../../../utils/appError.ts'\r\nimport { PERSONAL_CALENDAR_ID } from '../../../config/calendars.ts'\r\nimport {\r\n eventOccursInRange,\r\n parseCalendarEvent,\r\n type CalendarEvent,\r\n type EventInput,\r\n} from '../../../utils/event.ts'\r\nimport type { EventQuery, EventRepository } from '../types/storage.ts'\r\nimport { LocalStorageList } from '../utils/localStorageList.ts'\r\n\r\nconst DEFAULT_STORAGE_KEY = 'calendar.events.v1'\r\nconst LEGACY_CALENDAR_ID = 'local'\r\n\r\nconst parseLocalEvent = (value: unknown) => {\r\n const event = parseCalendarEvent(value)\r\n return event?.calendarId === LEGACY_CALENDAR_ID ? { ...event, calendarId: PERSONAL_CALENDAR_ID } : event\r\n}\r\n\r\nexport class LocalEventRepository implements EventRepository {\r\n readonly #events: LocalStorageList<CalendarEvent>\r\n\r\n constructor(storageKey = DEFAULT_STORAGE_KEY) {\r\n this.#events = new LocalStorageList(\r\n storageKey,\r\n parseLocalEvent,\r\n 'saveEventsFailed',\r\n )\r\n }\r\n\r\n async list({ from, to, calendarIds }: EventQuery) {\r\n return this.#events\r\n .read()\r\n .filter((event) => calendarIds.includes(event.calendarId) && eventOccursInRange(event, from, to))\r\n }\r\n\r\n async listAll() {\r\n return this.#events.read()\r\n }\r\n\r\n async clear() {\r\n this.#events.write([])\r\n }\r\n\r\n async listSeries(seriesId: string) {\r\n return this.#events.read().filter((event) => event.id === seriesId || event.seriesId === seriesId)\r\n }\r\n\r\n async create(calendarId: string, input: EventInput) {\r\n const now = new Date().toISOString()\r\n const event: CalendarEvent = {\r\n ...input,\r\n id: crypto.randomUUID(),\r\n calendarId,\r\n createdAt: now,\r\n updatedAt: now,\r\n }\r\n this.#events.update((events) => [...events, event])\r\n return event\r\n }\r\n\r\n async update(id: string, input: EventInput) {\r\n const existing = this.#events.read().find((event) => event.id === id)\r\n if (!existing) throw new AppError('eventNotFound')\r\n\r\n const updated: CalendarEvent = { ...existing, ...input, updatedAt: new Date().toISOString() }\r\n this.#events.update((events) => events.map((event) => (event.id === id ? updated : event)))\r\n return updated\r\n }\r\n\r\n async remove(id: string) {\r\n this.#events.update((events) => events.filter((event) => event.id !== id))\r\n }\r\n}\r\n","import { PERSONAL_CALENDAR_ID } from '../../../config/calendars.ts'\r\nimport { NO_SERIES_LINK, toEventInput, type CalendarEvent } from '../../../utils/event.ts'\r\nimport type { EventRepository } from '../types/storage.ts'\r\n\r\nconst isDetached = (event: CalendarEvent) => event.seriesId !== null\r\n\r\nexport async function copyEvents(events: readonly CalendarEvent[], target: EventRepository) {\r\n const newIds = new Map<string, string>()\r\n const ordered = events.toSorted((a, b) => Number(isDetached(a)) - Number(isDetached(b)))\r\n\r\n for (const event of ordered) {\r\n const seriesId = event.seriesId === null ? undefined : newIds.get(event.seriesId)\r\n const created = await target.create(PERSONAL_CALENDAR_ID, {\r\n ...toEventInput(event),\r\n ...(seriesId ? { seriesId, originalDate: event.originalDate } : NO_SERIES_LINK),\r\n })\r\n newIds.set(event.id, created.id)\r\n }\r\n\r\n return ordered.length\r\n}\r\n","import { useCallback, useMemo, useState } from 'react'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { ErrorMessage } from '../../../components/StatusMessage.tsx'\r\nimport { Modal } from '../../../components/Modal.tsx'\r\nimport { useAsyncAction } from '../../../hooks/useAsyncAction.ts'\r\nimport { useAsyncResource } from '../../../hooks/useAsyncResource.ts'\r\nimport type { CalendarEvent } from '../../../utils/event.ts'\r\nimport { useStorage } from '../hooks/useStorage.ts'\r\nimport { LocalEventRepository } from '../repositories/LocalEventRepository.ts'\r\nimport { copyEvents } from '../utils/copyEvents.ts'\r\nimport { LocalStorageList } from '../utils/localStorageList.ts'\r\n\r\nconst declinedUsers = new LocalStorageList<string>(\r\n 'calendar.localImportDeclined.v1',\r\n (value) => (typeof value === 'string' ? value : null),\r\n 'saveDecisionFailed',\r\n)\r\n\r\nconst NO_EVENTS: CalendarEvent[] = []\r\n\r\ntype LocalImportPromptProps = {\r\n userId: string\r\n}\r\n\r\nexport function LocalImportPrompt({ userId }: LocalImportPromptProps) {\r\n const { m } = useI18n()\r\n const { mode, events: target, invalidate } = useStorage()\r\n const localEvents = useMemo(() => new LocalEventRepository(), [])\r\n const load = useCallback(() => localEvents.listAll(), [localEvents])\r\n const { data: pending, isLoading } = useAsyncResource(load, NO_EVENTS)\r\n const [isDismissed, setIsDismissed] = useState(() => declinedUsers.read().includes(userId))\r\n\r\n const {\r\n run: importEvents,\r\n isPending,\r\n error,\r\n } = useAsyncAction(async () => {\r\n await copyEvents(pending, target)\r\n await localEvents.clear()\r\n invalidate()\r\n setIsDismissed(true)\r\n })\r\n\r\n const keepLocal = () => {\r\n declinedUsers.update((users) => [...new Set([...users, userId])])\r\n setIsDismissed(true)\r\n }\r\n\r\n if (mode !== 'remote' || isLoading || isDismissed || pending.length === 0) return null\r\n\r\n return (\r\n <Modal title={m.storage.importTitle} onClose={keepLocal}>\r\n <p className=\"modalMessage\">{m.storage.importMessage(pending.length)}</p>\r\n <ErrorMessage message={error} />\r\n <div className=\"modalActions modalActions--stacked\">\r\n <Button\r\n block\r\n isPending={isPending}\r\n pendingLabel={m.storage.importing}\r\n onClick={() => void importEvents()}\r\n data-autofocus\r\n >\r\n {m.storage.importConfirm}\r\n </Button>\r\n <Button variant=\"secondary\" block disabled={isPending} onClick={keepLocal}>\r\n {m.storage.keepLocal}\r\n </Button>\r\n </div>\r\n </Modal>\r\n )\r\n}\r\n","import { isHexColor, normalizeHexColor, type HexColor } from '../../../utils/color.ts'\r\nimport type { ColorRepository } from '../types/storage.ts'\r\nimport { LocalStorageList } from '../utils/localStorageList.ts'\r\n\r\nconst DEFAULT_STORAGE_KEY = 'calendar.colors.v1'\r\n\r\nconst parseColor = (value: unknown) => (isHexColor(value) ? normalizeHexColor(value) : null)\r\n\r\nexport class LocalColorRepository implements ColorRepository {\r\n readonly #colors: LocalStorageList<HexColor>\r\n\r\n constructor(storageKey = DEFAULT_STORAGE_KEY) {\r\n this.#colors = new LocalStorageList(storageKey, parseColor, 'saveColorFailed')\r\n this.#colors.initialize()\r\n }\r\n\r\n async list() {\r\n return [...new Set(this.#colors.read())]\r\n }\r\n\r\n async add(color: HexColor) {\r\n const normalized = normalizeHexColor(color)\r\n const colors = await this.list()\r\n if (colors.includes(normalized)) return colors\r\n return this.#colors.update(() => [...colors, normalized])\r\n }\r\n\r\n async remove(color: HexColor) {\r\n const normalized = normalizeHexColor(color)\r\n return this.#colors.update((colors) => colors.filter((entry) => entry !== normalized))\r\n }\r\n}\r\n","import { isOneOf } from './object.ts'\r\n\r\nexport const CALENDAR_VIEWS = ['day', 'week', 'month', 'year'] as const\r\n\r\nexport type CalendarView = (typeof CALENDAR_VIEWS)[number]\r\n\r\nexport const isCalendarView = (value: unknown): value is CalendarView => isOneOf(CALENDAR_VIEWS, value)\r\n","import { LOCALE_CHOICES, type LocaleChoice } from '../i18n/locale.ts'\r\nimport { isCalendarView, type CalendarView } from './calendarView.ts'\r\nimport { asRecord, isOneOf } from './object.ts'\r\n\r\nexport const THEMES = ['system', 'light', 'dark'] as const\r\n\r\nexport type Theme = (typeof THEMES)[number]\r\n\r\nexport type Preferences = {\r\n theme: Theme\r\n defaultView: CalendarView\r\n mobileDefaultView: CalendarView\r\n locale: LocaleChoice\r\n}\r\n\r\nexport const DEFAULT_PREFERENCES: Preferences = {\r\n theme: 'system',\r\n defaultView: 'week',\r\n mobileDefaultView: 'day',\r\n locale: 'auto',\r\n}\r\n\r\nexport const COMPACT_MAX_WIDTH = 700\r\n\r\nexport const isCompactWidth = (width: number) => width <= COMPACT_MAX_WIDTH\r\n\r\nexport const parsePreferences = (value: unknown): Preferences => {\r\n const { theme, defaultView, mobileDefaultView, locale } = asRecord(value)\r\n return {\r\n theme: isOneOf(THEMES, theme) ? theme : DEFAULT_PREFERENCES.theme,\r\n defaultView: isCalendarView(defaultView) ? defaultView : DEFAULT_PREFERENCES.defaultView,\r\n mobileDefaultView: isCalendarView(mobileDefaultView) ? mobileDefaultView : DEFAULT_PREFERENCES.mobileDefaultView,\r\n locale: isOneOf(LOCALE_CHOICES, locale) ? locale : DEFAULT_PREFERENCES.locale,\r\n }\r\n}\r\n\r\nexport const getStartView = ({ defaultView, mobileDefaultView }: Preferences, isMobile: boolean) =>\r\n isMobile ? mobileDefaultView : defaultView\r\n","import { parsePreferences, type Preferences } from '../../../utils/preferences.ts'\r\nimport type { PreferencesRepository } from '../types/storage.ts'\r\nimport { LocalStorageValue } from '../utils/localStorageValue.ts'\r\n\r\nconst DEFAULT_STORAGE_KEY = 'calendar.preferences.v1'\r\n\r\nexport class LocalPreferencesRepository implements PreferencesRepository {\r\n readonly #preferences: LocalStorageValue<Preferences>\r\n\r\n constructor(storageKey = DEFAULT_STORAGE_KEY) {\r\n this.#preferences = new LocalStorageValue(\r\n storageKey,\r\n parsePreferences,\r\n 'savePreferencesFailed',\r\n )\r\n this.#preferences.initialize()\r\n }\r\n\r\n async get() {\r\n return this.#preferences.read()\r\n }\r\n\r\n async update(changes: Partial<Preferences>) {\r\n return this.#preferences.update((current) => ({ ...current, ...changes }))\r\n }\r\n}\r\n","import { ApiError } from './apiError.ts'\r\n\r\nexport type QueryValue = string | number | boolean | null | undefined\r\n\r\nexport type QueryParams = Record<string, QueryValue | readonly QueryValue[]>\r\n\r\nexport type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\r\n\r\nexport type ApiRequestOptions = {\r\n query?: QueryParams\r\n body?: unknown\r\n headers?: HeadersInit\r\n signal?: AbortSignal\r\n timeoutMs?: number\r\n}\r\n\r\nexport type ApiClientOptions = {\r\n baseUrl: string\r\n timeoutMs?: number\r\n credentials?: RequestCredentials\r\n headers?: HeadersInit\r\n getAccessToken?: () => string | null\r\n getLanguage?: () => string | null\r\n onUnauthorized?: (error: ApiError) => void\r\n}\r\n\r\nexport type ApiClient = {\r\n request<T>(method: HttpMethod, path: string, options?: ApiRequestOptions): Promise<T>\r\n get<T>(path: string, options?: Omit<ApiRequestOptions, 'body'>): Promise<T>\r\n post<T>(path: string, body?: unknown, options?: Omit<ApiRequestOptions, 'body'>): Promise<T>\r\n put<T>(path: string, body?: unknown, options?: Omit<ApiRequestOptions, 'body'>): Promise<T>\r\n patch<T>(path: string, body?: unknown, options?: Omit<ApiRequestOptions, 'body'>): Promise<T>\r\n delete<T = void>(path: string, options?: Omit<ApiRequestOptions, 'body'>): Promise<T>\r\n}\r\n\r\nconst DEFAULT_TIMEOUT_MS = 10_000\r\nconst EMPTY_STATUSES = new Set([204, 205])\r\n\r\nconst isRawBody = (body: unknown): body is BodyInit =>\r\n body instanceof FormData ||\r\n body instanceof Blob ||\r\n body instanceof URLSearchParams ||\r\n body instanceof ArrayBuffer ||\r\n typeof body === 'string'\r\n\r\nexport const buildQueryString = (query: QueryParams = {}) => {\r\n const params = new URLSearchParams()\r\n for (const [key, raw] of Object.entries(query)) {\r\n const values: readonly QueryValue[] = Array.isArray(raw) ? raw : [raw as QueryValue]\r\n for (const value of values) if (value !== null && value !== undefined) params.append(key, String(value))\r\n }\r\n const queryString = params.toString()\r\n return queryString ? `?${queryString}` : ''\r\n}\r\n\r\nexport const joinUrl = (baseUrl: string, path: string) =>\r\n `${baseUrl.replace(/\\/+$/, '')}/${path.replace(/^\\/+/, '')}`\r\n\r\nexport const encodePathSegment = (value: string | number) => encodeURIComponent(String(value))\r\n\r\nconst readBody = async (response: Response): Promise<unknown> => {\r\n if (EMPTY_STATUSES.has(response.status)) return undefined\r\n const text = await response.text()\r\n if (!text) return undefined\r\n const isJson = response.headers.get('Content-Type')?.includes('json') ?? false\r\n return isJson ? JSON.parse(text) : text\r\n}\r\n\r\nexport function createApiClient({\r\n baseUrl,\r\n timeoutMs: defaultTimeoutMs = DEFAULT_TIMEOUT_MS,\r\n credentials = 'include',\r\n headers: defaultHeaders,\r\n getAccessToken = () => null,\r\n getLanguage = () => null,\r\n onUnauthorized,\r\n}: ApiClientOptions): ApiClient {\r\n const request = async <T>(\r\n method: HttpMethod,\r\n path: string,\r\n { query, body, headers, signal, timeoutMs = defaultTimeoutMs }: ApiRequestOptions = {},\r\n ): Promise<T> => {\r\n const timeoutSignal = AbortSignal.timeout(timeoutMs)\r\n const requestHeaders = new Headers(defaultHeaders)\r\n requestHeaders.set('Accept', 'application/json')\r\n\r\n const language = getLanguage()\r\n if (language) requestHeaders.set('Accept-Language', language)\r\n\r\n const token = getAccessToken()\r\n if (token) requestHeaders.set('Authorization', `Bearer ${token}`)\r\n\r\n let requestBody: BodyInit | undefined\r\n if (body !== undefined) {\r\n if (isRawBody(body)) requestBody = body\r\n else {\r\n requestHeaders.set('Content-Type', 'application/json')\r\n requestBody = JSON.stringify(body)\r\n }\r\n }\r\n\r\n new Headers(headers).forEach((value, key) => requestHeaders.set(key, value))\r\n\r\n let response: Response\r\n try {\r\n response = await fetch(joinUrl(baseUrl, path) + buildQueryString(query), {\r\n method,\r\n headers: requestHeaders,\r\n body: requestBody,\r\n credentials,\r\n signal: signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal,\r\n })\r\n } catch (error) {\r\n if (timeoutSignal.aborted) throw ApiError.fromKind('timeout', error)\r\n if (signal?.aborted) throw ApiError.fromKind('aborted', error)\r\n throw ApiError.fromKind('network', error)\r\n }\r\n\r\n let data: unknown\r\n try {\r\n data = await readBody(response)\r\n } catch (error) {\r\n if (!response.ok) throw ApiError.fromResponse(response.status, undefined)\r\n throw ApiError.fromKind('parse', error)\r\n }\r\n\r\n if (!response.ok) {\r\n const error = ApiError.fromResponse(response.status, data)\r\n if (error.isUnauthorized) onUnauthorized?.(error)\r\n throw error\r\n }\r\n\r\n return data as T\r\n }\r\n\r\n return {\r\n request,\r\n get: (path, options) => request('GET', path, options),\r\n post: (path, body, options) => request('POST', path, { ...options, body }),\r\n put: (path, body, options) => request('PUT', path, { ...options, body }),\r\n patch: (path, body, options) => request('PATCH', path, { ...options, body }),\r\n delete: (path, options) => request('DELETE', path, options),\r\n }\r\n}\r\n","import { encodePathSegment, type ApiClient } from '../../../utils/api.ts'\r\nimport { isHexColor, normalizeHexColor, type HexColor } from '../../../utils/color.ts'\r\nimport type { ColorRepository } from '../types/storage.ts'\r\n\r\nconst COLORS_PATH = '/colors'\r\n\r\nconst parseColors = (value: unknown): HexColor[] =>\r\n Array.isArray(value) ? [...new Set(value.filter(isHexColor).map(normalizeHexColor))] : []\r\n\r\nexport class RemoteColorRepository implements ColorRepository {\r\n readonly #api: ApiClient\r\n\r\n constructor(api: ApiClient) {\r\n this.#api = api\r\n }\r\n\r\n async list() {\r\n return parseColors(await this.#api.get<unknown>(COLORS_PATH))\r\n }\r\n\r\n async add(color: HexColor) {\r\n return parseColors(await this.#api.post<unknown>(COLORS_PATH, { color: normalizeHexColor(color) }))\r\n }\r\n\r\n async remove(color: HexColor) {\r\n const path = `${COLORS_PATH}/${encodePathSegment(normalizeHexColor(color).slice(1))}`\r\n return parseColors(await this.#api.delete<unknown>(path))\r\n }\r\n}\r\n","import { encodePathSegment, type ApiClient, type QueryParams } from '../../../utils/api.ts'\r\nimport type { CalendarEvent, EventInput } from '../../../utils/event.ts'\r\nimport type { EventQuery, EventRepository } from '../types/storage.ts'\r\n\r\nconst EVENTS_PATH = '/events'\r\n\r\nexport class RemoteEventRepository implements EventRepository {\r\n readonly #api: ApiClient\r\n\r\n constructor(api: ApiClient) {\r\n this.#api = api\r\n }\r\n\r\n list({ from, to, calendarIds }: EventQuery) {\r\n return this.#query({ from, to, calendarId: calendarIds })\r\n }\r\n\r\n listSeries(seriesId: string) {\r\n return this.#query({ seriesId })\r\n }\r\n\r\n create(calendarId: string, input: EventInput) {\r\n return this.#api.post<CalendarEvent>(EVENTS_PATH, { ...input, calendarId })\r\n }\r\n\r\n update(id: string, input: EventInput) {\r\n return this.#api.put<CalendarEvent>(this.#eventPath(id), input)\r\n }\r\n\r\n remove(id: string) {\r\n return this.#api.delete(this.#eventPath(id))\r\n }\r\n\r\n #query(query: QueryParams) {\r\n return this.#api.get<CalendarEvent[]>(EVENTS_PATH, { query })\r\n }\r\n\r\n #eventPath(id: string) {\r\n return `${EVENTS_PATH}/${encodePathSegment(id)}`\r\n }\r\n}\r\n","import type { ApiClient } from '../../../utils/api.ts'\r\nimport { parsePreferences, type Preferences } from '../../../utils/preferences.ts'\r\nimport type { PreferencesRepository } from '../types/storage.ts'\r\n\r\nconst PREFERENCES_PATH = '/preferences'\r\n\r\nexport class RemotePreferencesRepository implements PreferencesRepository {\r\n readonly #api: ApiClient\r\n\r\n constructor(api: ApiClient) {\r\n this.#api = api\r\n }\r\n\r\n async get() {\r\n return parsePreferences(await this.#api.get<unknown>(PREFERENCES_PATH))\r\n }\r\n\r\n async update(changes: Partial<Preferences>) {\r\n return parsePreferences(await this.#api.patch<unknown>(PREFERENCES_PATH, changes))\r\n }\r\n}\r\n","import { addDaysToISODate, daysBetween, minISODate } from './date.ts'\r\nimport {\r\n getActiveOccurrenceDates,\r\n moveToStartDate,\r\n NO_SERIES_LINK,\r\n toEventInput,\r\n type CalendarEvent,\r\n type EventInput,\r\n type SeriesRule,\r\n} from './event.ts'\r\nimport { countOccurrencesBefore, isSameRecurrence, shiftWeekdays, type Recurrence } from './recurrence.ts'\r\n\r\nexport const hasEarlierOccurrences = (series: SeriesRule, date: string) =>\r\n series.recurrence !== null &&\r\n date > series.startDate &&\r\n getActiveOccurrenceDates(series, series.startDate, addDaysToISODate(date, -1)).length > 0\r\n\r\nexport const getShift = (occurrenceDate: string, input: EventInput) => daysBetween(occurrenceDate, input.startDate)\r\n\r\nexport const isDetachedFrom = (event: CalendarEvent, date: string) =>\r\n event.originalDate !== null && event.originalDate >= date\r\n\r\nconst shiftDates = (dates: readonly string[], shift: number) => dates.map((date) => addDaysToISODate(date, shift))\r\n\r\nconst followShift = (previous: Recurrence | null, next: Recurrence, shift: number) =>\r\n shift !== 0 && next.frequency === 'weekly' && isSameRecurrence(previous, next)\r\n ? { ...next, weekdays: shiftWeekdays(next.weekdays, shift) }\r\n : next\r\n\r\nconst asSingleEvent = (input: EventInput): EventInput => ({ ...input, excludedDates: [], ...NO_SERIES_LINK })\r\n\r\nexport const excludeOccurrence = (series: CalendarEvent, occurrenceDate: string): EventInput => ({\r\n ...toEventInput(series),\r\n excludedDates: [...new Set([...series.excludedDates, occurrenceDate])].toSorted(),\r\n})\r\n\r\nexport const detachOccurrence = (series: CalendarEvent, occurrenceDate: string, input: EventInput): EventInput => ({\r\n ...input,\r\n recurrence: null,\r\n excludedDates: [],\r\n seriesId: series.id,\r\n originalDate: occurrenceDate,\r\n})\r\n\r\nexport const changeWholeSeries = (series: CalendarEvent, occurrenceDate: string, input: EventInput): EventInput => {\r\n if (input.recurrence === null) return asSingleEvent(input)\r\n\r\n const shift = getShift(occurrenceDate, input)\r\n return {\r\n ...input,\r\n ...moveToStartDate(input, addDaysToISODate(series.startDate, shift)),\r\n recurrence: followShift(series.recurrence, input.recurrence, shift),\r\n excludedDates: shiftDates(series.excludedDates, shift),\r\n ...NO_SERIES_LINK,\r\n }\r\n}\r\n\r\nexport const truncateSeries = (series: CalendarEvent, occurrenceDate: string): EventInput => {\r\n const lastDate = addDaysToISODate(occurrenceDate, -1)\r\n const { recurrence } = series\r\n return {\r\n ...toEventInput(series),\r\n recurrence: recurrence && {\r\n ...recurrence,\r\n until: recurrence.until === null ? lastDate : minISODate(recurrence.until, lastDate),\r\n count: null,\r\n },\r\n excludedDates: series.excludedDates.filter((date) => date < occurrenceDate),\r\n }\r\n}\r\n\r\nexport const continueSeries = (series: CalendarEvent, occurrenceDate: string, input: EventInput): EventInput => {\r\n if (input.recurrence === null) return asSingleEvent(input)\r\n\r\n const shift = getShift(occurrenceDate, input)\r\n const keepsRule = isSameRecurrence(series.recurrence, input.recurrence)\r\n const { count } = input.recurrence\r\n const remaining =\r\n keepsRule && series.recurrence && count !== null\r\n ? Math.max(count - countOccurrencesBefore(series.startDate, series.recurrence, occurrenceDate), 1)\r\n : count\r\n\r\n return {\r\n ...input,\r\n recurrence: { ...followShift(series.recurrence, input.recurrence, shift), count: remaining },\r\n excludedDates: keepsRule\r\n ? shiftDates(\r\n series.excludedDates.filter((date) => date >= occurrenceDate),\r\n shift,\r\n )\r\n : [],\r\n ...NO_SERIES_LINK,\r\n }\r\n}\r\n","import { addDaysToISODate } from '../../../utils/date.ts'\r\nimport { toEventInput, type CalendarEvent, type EditScope, type EventInput } from '../../../utils/event.ts'\r\nimport {\r\n changeWholeSeries,\r\n continueSeries,\r\n detachOccurrence,\r\n excludeOccurrence,\r\n getShift,\r\n hasEarlierOccurrences,\r\n isDetachedFrom,\r\n truncateSeries,\r\n} from '../../../utils/series.ts'\r\nimport type { EventRepository } from '../../storage/index.ts'\r\n\r\ntype ScopeHandlers = {\r\n plain: () => Promise<unknown>\r\n single: () => Promise<unknown>\r\n following: (detached: CalendarEvent[]) => Promise<unknown>\r\n all: (detached: CalendarEvent[]) => Promise<unknown>\r\n}\r\n\r\nasync function applyScope(\r\n repository: EventRepository,\r\n series: CalendarEvent,\r\n occurrenceDate: string,\r\n requestedScope: EditScope,\r\n handlers: ScopeHandlers,\r\n) {\r\n if (!series.recurrence) return handlers.plain()\r\n\r\n const scope =\r\n requestedScope === 'following' && !hasEarlierOccurrences(series, occurrenceDate) ? 'all' : requestedScope\r\n if (scope === 'single') return handlers.single()\r\n\r\n const detached = (await repository.listSeries(series.id)).filter((event) => event.seriesId === series.id)\r\n return handlers[scope](detached)\r\n}\r\n\r\nasync function forEachInOrder<T>(items: readonly T[], action: (item: T) => Promise<unknown>) {\r\n for (const item of items) await action(item)\r\n}\r\n\r\nconst relink = (event: CalendarEvent, seriesId: string | null, shift: number): EventInput => ({\r\n ...toEventInput(event),\r\n seriesId,\r\n originalDate: seriesId === null || event.originalDate === null ? null : addDaysToISODate(event.originalDate, shift),\r\n})\r\n\r\nexport const updateOccurrence = (\r\n repository: EventRepository,\r\n series: CalendarEvent,\r\n occurrenceDate: string,\r\n input: EventInput,\r\n scope: EditScope,\r\n) => {\r\n const shift = getShift(occurrenceDate, input)\r\n const relinkAll = (events: readonly CalendarEvent[], seriesId: string | null) =>\r\n forEachInOrder(events, (event) => repository.update(event.id, relink(event, seriesId, shift)))\r\n\r\n return applyScope(repository, series, occurrenceDate, scope, {\r\n plain: () => repository.update(series.id, input),\r\n single: async () => {\r\n await repository.update(series.id, excludeOccurrence(series, occurrenceDate))\r\n await repository.create(series.calendarId, detachOccurrence(series, occurrenceDate, input))\r\n },\r\n following: async (detached) => {\r\n await repository.update(series.id, truncateSeries(series, occurrenceDate))\r\n const created = await repository.create(series.calendarId, continueSeries(series, occurrenceDate, input))\r\n await relinkAll(\r\n detached.filter((event) => isDetachedFrom(event, occurrenceDate)),\r\n created.recurrence ? created.id : null,\r\n )\r\n },\r\n all: async (detached) => {\r\n await repository.update(series.id, changeWholeSeries(series, occurrenceDate, input))\r\n if (!input.recurrence) await relinkAll(detached, null)\r\n else if (shift !== 0) await relinkAll(detached, series.id)\r\n },\r\n })\r\n}\r\n\r\nexport const deleteOccurrence = (\r\n repository: EventRepository,\r\n series: CalendarEvent,\r\n occurrenceDate: string,\r\n scope: EditScope,\r\n) => {\r\n const removeAll = (events: readonly CalendarEvent[]) => forEachInOrder(events, (event) => repository.remove(event.id))\r\n\r\n return applyScope(repository, series, occurrenceDate, scope, {\r\n plain: () => repository.remove(series.id),\r\n single: () => repository.update(series.id, excludeOccurrence(series, occurrenceDate)),\r\n following: async (detached) => {\r\n await repository.update(series.id, truncateSeries(series, occurrenceDate))\r\n await removeAll(detached.filter((event) => isDetachedFrom(event, occurrenceDate)))\r\n },\r\n all: async (detached) => {\r\n await removeAll(detached)\r\n await repository.remove(series.id)\r\n },\r\n })\r\n}\r\n","import { useCallback } from 'react'\r\nimport { useAsyncResource } from '../../../hooks/useAsyncResource.ts'\r\nimport { AppError } from '../../../utils/appError.ts'\r\nimport {\r\n type CalendarEvent,\r\n type EditScope,\r\n type EventInput,\r\n type EventOccurrence,\r\n} from '../../../utils/event.ts'\r\nimport { useStorage, type EventQuery } from '../../storage/index.ts'\r\nimport { deleteOccurrence, updateOccurrence } from '../utils/seriesActions.ts'\r\n\r\nconst NO_EVENTS: CalendarEvent[] = []\r\n\r\ntype UseEventsOptions = EventQuery & { targetCalendarId: string }\r\n\r\nexport function useEvents({ from, to, calendarIds, targetCalendarId }: UseEventsOptions) {\r\n const { events: repository, version } = useStorage()\r\n const load = useCallback(() => repository.list({ from, to, calendarIds }), [repository, from, to, calendarIds])\r\n const { data: events, error, isLoading, reload } = useAsyncResource(load, NO_EVENTS, version)\r\n\r\n const findSeries = useCallback(\r\n (occurrence: EventOccurrence) => {\r\n const series = events.find((event) => event.id === occurrence.id)\r\n if (!series) throw new AppError('eventNotFound')\r\n return series\r\n },\r\n [events],\r\n )\r\n\r\n const withReload = useCallback(\r\n async <T>(operation: () => Promise<T>) => {\r\n try {\r\n return await operation()\r\n } finally {\r\n reload()\r\n }\r\n },\r\n [reload],\r\n )\r\n\r\n const createEvent = useCallback(\r\n (input: EventInput) => withReload(() => repository.create(targetCalendarId, input)),\r\n [repository, withReload, targetCalendarId],\r\n )\r\n\r\n const updateEvent = useCallback(\r\n (occurrence: EventOccurrence, input: EventInput, scope: EditScope) =>\r\n withReload(() => updateOccurrence(repository, findSeries(occurrence), occurrence.startDate, input, scope)),\r\n [repository, withReload, findSeries],\r\n )\r\n\r\n const deleteEvent = useCallback(\r\n (occurrence: EventOccurrence, scope: EditScope) =>\r\n withReload(() => deleteOccurrence(repository, findSeries(occurrence), occurrence.startDate, scope)),\r\n [repository, withReload, findSeries],\r\n )\r\n\r\n return { events, error, isLoading, reload, createEvent, updateEvent, deleteEvent }\r\n}\r\n","import { FormField } from './FormField.tsx'\r\n\r\ntype DateTimeFieldProps = {\r\n name: string\r\n dateLabel: string\r\n timeLabel: string\r\n date: string\r\n time: string\r\n minDate?: string\r\n dateError?: string\r\n timeError?: string\r\n onDateChange: (date: string) => void\r\n onTimeChange: (time: string) => void\r\n}\r\n\r\nexport function DateTimeField({\r\n name,\r\n dateLabel,\r\n timeLabel,\r\n date,\r\n time,\r\n minDate,\r\n dateError,\r\n timeError,\r\n onDateChange,\r\n onTimeChange,\r\n}: DateTimeFieldProps) {\r\n return (\r\n <div className=\"formRow\">\r\n <FormField label={dateLabel} error={dateError}>\r\n <input\r\n className=\"input\"\r\n type=\"date\"\r\n name={`${name}Date`}\r\n min={minDate}\r\n value={date}\r\n aria-invalid={Boolean(dateError)}\r\n onChange={(event) => onDateChange(event.target.value)}\r\n />\r\n </FormField>\r\n <FormField label={timeLabel} error={timeError}>\r\n <input\r\n className=\"input\"\r\n type=\"time\"\r\n name={name}\r\n value={time}\r\n aria-invalid={Boolean(timeError)}\r\n onChange={(event) => onTimeChange(event.target.value)}\r\n />\r\n </FormField>\r\n </div>\r\n )\r\n}\r\n","import { toSeriesRule, type EditScope, type EventOccurrence } from '../../../utils/event.ts'\r\nimport { isSameRecurrence, type Recurrence } from '../../../utils/recurrence.ts'\r\nimport { hasEarlierOccurrences } from '../../../utils/series.ts'\r\n\r\nexport const getScopeOptions = (\r\n occurrence: EventOccurrence | null,\r\n nextRecurrence: Recurrence | null = occurrence?.recurrence ?? null,\r\n): EditScope[] => {\r\n if (!occurrence?.recurrence) return ['all']\r\n const options: EditScope[] = []\r\n if (isSameRecurrence(occurrence.recurrence, nextRecurrence)) options.push('single')\r\n if (hasEarlierOccurrences(toSeriesRule(occurrence), occurrence.startDate)) options.push('following')\r\n options.push('all')\r\n return options\r\n}\r\n","import type { CSSProperties, ReactNode } from 'react'\r\nimport { classNames } from '../utils/classNames.ts'\r\n\r\ntype ChoiceChipProps = {\r\n type: 'radio' | 'checkbox'\r\n label: string\r\n checked: boolean\r\n onChange: () => void\r\n name?: string\r\n className?: string\r\n style?: CSSProperties\r\n children?: ReactNode\r\n}\r\n\r\nexport function ChoiceChip({ type, label, checked, onChange, name, className, style, children }: ChoiceChipProps) {\r\n return (\r\n <label className={classNames('chip', className, checked && 'active')} style={style} title={label}>\r\n <input\r\n type={type}\r\n name={name}\r\n className=\"visuallyHidden\"\r\n aria-label={label}\r\n checked={checked}\r\n onChange={onChange}\r\n />\r\n {children}\r\n </label>\r\n )\r\n}\r\n","import type { HexColor } from '../../../utils/color.ts'\r\n\r\nexport const MAX_CUSTOM_COLORS = 12\r\n\r\nexport const DEFAULT_CUSTOM_COLOR: HexColor = '#888888'\r\n","import { useCallback } from 'react'\r\nimport { useAsyncResource } from '../../../hooks/useAsyncResource.ts'\r\nimport type { HexColor } from '../../../utils/color.ts'\r\nimport { useColorRepository } from '../../storage/index.ts'\r\nimport { MAX_CUSTOM_COLORS } from '../constants/colors.ts'\r\n\r\nconst NO_COLORS: HexColor[] = []\r\n\r\nexport function useCustomColors() {\r\n const repository = useColorRepository()\r\n const load = useCallback(() => repository.list(), [repository])\r\n const { data: colors, error, apply } = useAsyncResource(load, NO_COLORS)\r\n\r\n const addColor = useCallback((color: HexColor) => apply(repository.add(color)), [repository, apply])\r\n\r\n const removeColor = useCallback(\r\n async (color: HexColor) => {\r\n await apply(repository.remove(color))\r\n },\r\n [repository, apply],\r\n )\r\n\r\n return { colors, error, addColor, removeColor, canAddMore: colors.length < MAX_CUSTOM_COLORS }\r\n}\r\n","import { useEffect, useMemo, useRef } from 'react'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { ChoiceChip } from '../../../components/ChoiceChip.tsx'\r\nimport { FormField } from '../../../components/FormField.tsx'\r\nimport { isHexColor, normalizeHexColor } from '../../../utils/color.ts'\r\nimport {\r\n getEventColorAttributes,\r\n getEventColorLabel,\r\n PRESET_EVENT_COLORS,\r\n type EventColor,\r\n} from '../../../utils/event.ts'\r\nimport { DEFAULT_CUSTOM_COLOR } from '../constants/colors.ts'\r\nimport { useCustomColors } from '../hooks/useCustomColors.ts'\r\n\r\ntype ColorPickerProps = {\r\n value: EventColor\r\n onChange: (color: EventColor) => void\r\n}\r\n\r\nexport function ColorPicker({ value, onChange }: ColorPickerProps) {\r\n const { m } = useI18n()\r\n const { colors: customColors, addColor, canAddMore } = useCustomColors()\r\n const addInputRef = useRef<HTMLInputElement>(null)\r\n\r\n const options = useMemo<EventColor[]>(() => {\r\n const list: EventColor[] = [...PRESET_EVENT_COLORS, ...customColors]\r\n if (isHexColor(value) && !list.includes(value)) list.push(value)\r\n return list\r\n }, [customColors, value])\r\n\r\n useEffect(() => {\r\n const input = addInputRef.current\r\n if (!input) return\r\n\r\n const handleChange = () => {\r\n if (!isHexColor(input.value)) return\r\n const color = normalizeHexColor(input.value)\r\n onChange(color)\r\n void addColor(color)\r\n }\r\n\r\n input.addEventListener('change', handleChange)\r\n return () => input.removeEventListener('change', handleChange)\r\n }, [addColor, onChange, canAddMore])\r\n\r\n return (\r\n <FormField as=\"fieldset\" label={m.events.color}>\r\n <div className=\"choiceList\">\r\n {options.map((color) => {\r\n const { className, style } = getEventColorAttributes(color, 'color')\r\n return (\r\n <ChoiceChip\r\n key={color}\r\n type=\"radio\"\r\n name=\"eventColor\"\r\n label={getEventColorLabel(color, m)}\r\n checked={value === color}\r\n onChange={() => onChange(color)}\r\n className={className}\r\n style={style}\r\n />\r\n )\r\n })}\r\n\r\n {canAddMore && (\r\n <label className=\"chip color colorAdd\" title={m.events.addCustomColor}>\r\n <input\r\n ref={addInputRef}\r\n type=\"color\"\r\n className=\"visuallyHidden\"\r\n aria-label={m.events.addCustomColor}\r\n defaultValue={DEFAULT_CUSTOM_COLOR}\r\n />\r\n </label>\r\n )}\r\n </div>\r\n </FormField>\r\n )\r\n}\r\n","import { FormField } from './FormField.tsx'\r\n\r\ntype NumberFieldProps = {\r\n label: string\r\n name: string\r\n value: number | null\r\n min: number\r\n max: number\r\n unit?: string\r\n error?: string\r\n onChange: (value: number) => void\r\n}\r\n\r\nexport function NumberField({ label, name, value, min, max, unit, error, onChange }: NumberFieldProps) {\r\n return (\r\n <FormField label={label} error={error}>\r\n <span className=\"inlineField\">\r\n <input\r\n className=\"input numberInput\"\r\n type=\"number\"\r\n name={name}\r\n min={min}\r\n max={max}\r\n step={1}\r\n value={value === null || Number.isNaN(value) ? '' : value}\r\n aria-invalid={Boolean(error)}\r\n onChange={(event) => onChange(event.target.valueAsNumber)}\r\n />\r\n {unit && <span>{unit}</span>}\r\n </span>\r\n </FormField>\r\n )\r\n}\r\n","import { FormField } from './FormField.tsx'\r\n\r\nexport type SelectOption<T extends string> = {\r\n value: T\r\n label: string\r\n}\r\n\r\ntype SelectFieldProps<T extends string> = {\r\n label: string\r\n name: string\r\n value: T\r\n options: readonly SelectOption<T>[]\r\n onChange: (value: T) => void\r\n}\r\n\r\nexport function SelectField<T extends string>({ label, name, value, options, onChange }: SelectFieldProps<T>) {\r\n return (\r\n <FormField label={label}>\r\n <select\r\n className=\"input\"\r\n name={name}\r\n value={value}\r\n onChange={(event) => {\r\n const option = options.find((candidate) => candidate.value === event.target.value)\r\n if (option) onChange(option.value)\r\n }}\r\n >\r\n {options.map((option) => (\r\n <option key={option.value} value={option.value}>\r\n {option.label}\r\n </option>\r\n ))}\r\n </select>\r\n </FormField>\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { ChoiceChip } from '../../../components/ChoiceChip.tsx'\r\nimport { FormField } from '../../../components/FormField.tsx'\r\nimport { NumberField } from '../../../components/NumberField.tsx'\r\nimport { SelectField, type SelectOption } from '../../../components/SelectField.tsx'\r\nimport { addMonthsToISODate, isISODate } from '../../../utils/date.ts'\r\nimport { isIntegerInRange } from '../../../utils/number.ts'\r\nimport {\r\n createRecurrence,\r\n formatMonthlyMode,\r\n formatRecurrence,\r\n getMonthlyModeOptions,\r\n hasRecurrenceErrors,\r\n normalizeWeekdays,\r\n RECURRENCE_COUNT_MAX,\r\n RECURRENCE_FREQUENCIES,\r\n RECURRENCE_INTERVAL_MAX,\r\n type Recurrence,\r\n type RecurrenceFrequency,\r\n type RecurrenceValidationErrors,\r\n} from '../../../utils/recurrence.ts'\r\n\r\ntype RecurrenceFieldsProps = {\r\n value: Recurrence | null\r\n startDate: string\r\n errors: RecurrenceValidationErrors\r\n onChange: (recurrence: Recurrence | null) => void\r\n}\r\n\r\ntype EndMode = 'never' | 'date' | 'count'\r\n\r\nconst DEFAULT_COUNT = 10\r\nconst DEFAULT_UNTIL_MONTHS = 3\r\n\r\nconst getEndMode = ({ until, count }: Recurrence): EndMode =>\r\n until !== null ? 'date' : count !== null ? 'count' : 'never'\r\n\r\nconst pluralize = (count: number | null, one: string, many: string) => (count === 1 ? one : many)\r\n\r\nconst canSummarize = (recurrence: Recurrence, startDate: string, errors: RecurrenceValidationErrors) =>\r\n isISODate(startDate) &&\r\n !hasRecurrenceErrors(errors) &&\r\n isIntegerInRange(recurrence.interval, 1) &&\r\n (recurrence.count === null || isIntegerInRange(recurrence.count, 1))\r\n\r\nexport function RecurrenceFields({ value, startDate, errors, onChange }: RecurrenceFieldsProps) {\r\n const i18n = useI18n()\r\n const { m, format } = i18n\r\n const hasValidStart = isISODate(startDate)\r\n\r\n const frequencyOptions: SelectOption<RecurrenceFrequency | 'never'>[] = [\r\n { value: 'never', label: m.events.never },\r\n ...RECURRENCE_FREQUENCIES.map((frequency) => ({ value: frequency, label: m.recurrence.frequency[frequency] })),\r\n ]\r\n\r\n const endOptions: SelectOption<EndMode>[] = [\r\n { value: 'never', label: m.events.never },\r\n { value: 'date', label: m.events.endsOnDate },\r\n { value: 'count', label: m.events.endsAfterCount },\r\n ]\r\n\r\n const changeFrequency = (frequency: RecurrenceFrequency | 'never') => {\r\n if (frequency === 'never') onChange(null)\r\n else if (value) onChange({ ...value, frequency })\r\n else if (hasValidStart) onChange(createRecurrence(frequency, startDate))\r\n }\r\n\r\n const changeEndMode = (mode: EndMode) => {\r\n if (!value) return\r\n onChange({\r\n ...value,\r\n until: mode === 'date' && hasValidStart ? addMonthsToISODate(startDate, DEFAULT_UNTIL_MONTHS) : null,\r\n count: mode === 'count' ? DEFAULT_COUNT : null,\r\n })\r\n }\r\n\r\n const toggleWeekday = (weekday: number) => {\r\n if (!value) return\r\n const weekdays = value.weekdays.includes(weekday)\r\n ? value.weekdays.filter((day) => day !== weekday)\r\n : normalizeWeekdays([...value.weekdays, weekday])\r\n onChange({ ...value, weekdays })\r\n }\r\n\r\n const unit = value ? m.recurrence.units[value.frequency] : null\r\n const endMode = value ? getEndMode(value) : 'never'\r\n\r\n return (\r\n <div className=\"formSection\">\r\n <div className=\"formRow\">\r\n <SelectField\r\n label={m.events.repeat}\r\n name=\"recurrenceFrequency\"\r\n value={value?.frequency ?? 'never'}\r\n options={frequencyOptions}\r\n onChange={changeFrequency}\r\n />\r\n {value && unit && (\r\n <NumberField\r\n label={m.events.every}\r\n name=\"recurrenceInterval\"\r\n value={value.interval}\r\n min={1}\r\n max={RECURRENCE_INTERVAL_MAX}\r\n unit={pluralize(value.interval, unit.one, unit.many)}\r\n error={errors.interval}\r\n onChange={(interval) => onChange({ ...value, interval })}\r\n />\r\n )}\r\n </div>\r\n\r\n {value?.frequency === 'weekly' && (\r\n <FormField as=\"fieldset\" label={m.events.onTheseDays} error={errors.weekdays}>\r\n <div className=\"choiceList\">\r\n {format.shortWeekdays.map(({ weekday, label }) => (\r\n <ChoiceChip\r\n key={weekday}\r\n type=\"checkbox\"\r\n label={label}\r\n checked={value.weekdays.includes(weekday)}\r\n onChange={() => toggleWeekday(weekday)}\r\n className=\"weekday\"\r\n >\r\n {label}\r\n </ChoiceChip>\r\n ))}\r\n </div>\r\n </FormField>\r\n )}\r\n\r\n {value?.frequency === 'monthly' && hasValidStart && (\r\n <SelectField\r\n label={m.events.inMonth}\r\n name=\"recurrenceMonthlyMode\"\r\n value={value.monthlyMode}\r\n options={getMonthlyModeOptions(startDate).map((mode) => ({\r\n value: mode,\r\n label: formatMonthlyMode(mode, startDate, i18n),\r\n }))}\r\n onChange={(monthlyMode) => onChange({ ...value, monthlyMode })}\r\n />\r\n )}\r\n\r\n {value && (\r\n <div className=\"formRow\">\r\n <SelectField\r\n label={m.events.ends}\r\n name=\"recurrenceEnds\"\r\n value={endMode}\r\n options={endOptions}\r\n onChange={changeEndMode}\r\n />\r\n\r\n {endMode === 'date' && (\r\n <FormField label={m.events.lastOccurrence} error={errors.until}>\r\n <input\r\n className=\"input\"\r\n type=\"date\"\r\n name=\"recurrenceUntil\"\r\n min={startDate}\r\n value={value.until ?? ''}\r\n aria-invalid={Boolean(errors.until)}\r\n onChange={(event) => onChange({ ...value, until: event.target.value })}\r\n />\r\n </FormField>\r\n )}\r\n\r\n {endMode === 'count' && (\r\n <NumberField\r\n label={m.events.after}\r\n name=\"recurrenceCount\"\r\n value={value.count}\r\n min={1}\r\n max={RECURRENCE_COUNT_MAX}\r\n unit={pluralize(value.count, m.events.occurrences.one, m.events.occurrences.many)}\r\n error={errors.count}\r\n onChange={(count) => onChange({ ...value, count })}\r\n />\r\n )}\r\n </div>\r\n )}\r\n\r\n {value && canSummarize(value, startDate, errors) && (\r\n <p className=\"formHint\">{formatRecurrence(value, startDate, i18n)}</p>\r\n )}\r\n </div>\r\n )\r\n}\r\n","import type { EditScope } from '../../../utils/event.ts'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\n\r\ntype ScopeButtonsProps = {\r\n options: readonly EditScope[]\r\n variant?: 'default' | 'danger'\r\n disabled?: boolean\r\n onSelect: (scope: EditScope) => void\r\n onCancel: () => void\r\n}\r\n\r\nexport function ScopeButtons({ options, variant = 'default', disabled, onSelect, onCancel }: ScopeButtonsProps) {\r\n const { m } = useI18n()\r\n const focusCancel = variant === 'danger'\r\n return (\r\n <div className=\"modalActions modalActions--stacked\">\r\n {options.map((scope, index) => (\r\n <Button\r\n key={scope}\r\n variant={variant === 'danger' ? 'danger' : 'primary'}\r\n block\r\n disabled={disabled}\r\n onClick={() => onSelect(scope)}\r\n data-autofocus={!focusCancel && index === 0 ? true : undefined}\r\n >\r\n {m.events.scopes[scope]}\r\n </Button>\r\n ))}\r\n <Button variant=\"secondary\" block onClick={onCancel} data-autofocus={focusCancel ? true : undefined}>\r\n {m.common.cancel}\r\n </Button>\r\n </div>\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { Modal } from '../../../components/Modal.tsx'\r\nimport type { EditScope } from '../../../utils/event.ts'\r\nimport { ScopeButtons } from './ScopeButtons.tsx'\r\n\r\ntype RecurrenceScopeModalProps = {\r\n options: readonly EditScope[]\r\n onSelect: (scope: EditScope) => void\r\n onClose: () => void\r\n}\r\n\r\nexport function RecurrenceScopeModal({ options, onSelect, onClose }: RecurrenceScopeModalProps) {\r\n const { m } = useI18n()\r\n return (\r\n <Modal title={m.events.scopeTitle} onClose={onClose}>\r\n <p className=\"modalMessage\">{m.events.scopeMessage}</p>\r\n <ScopeButtons options={options} onSelect={onSelect} onCancel={onClose} />\r\n </Modal>\r\n )\r\n}\r\n","import { useState, type SubmitEventHandler } from 'react'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { DateTimeField } from '../../../components/DateTimeField.tsx'\r\nimport { Form } from '../../../components/Form.tsx'\r\nimport { ErrorMessage } from '../../../components/StatusMessage.tsx'\r\nimport { FormField } from '../../../components/FormField.tsx'\r\nimport { Modal } from '../../../components/Modal.tsx'\r\nimport { TextField } from '../../../components/TextField.tsx'\r\nimport { useAsyncAction } from '../../../hooks/useAsyncAction.ts'\r\nimport { isISODate } from '../../../utils/date.ts'\r\nimport {\r\n EVENT_DESCRIPTION_MAX_LENGTH,\r\n EVENT_TITLE_MAX_LENGTH,\r\n hasValidationErrors,\r\n moveToStartDate,\r\n normalizeEventInput,\r\n validateEventInput,\r\n type EditScope,\r\n type EventInput,\r\n type EventOccurrence,\r\n type EventValidationErrors,\r\n} from '../../../utils/event.ts'\r\nimport { adaptRecurrenceToStart, type Recurrence } from '../../../utils/recurrence.ts'\r\nimport type { EventModalMode } from '../types/eventModal.ts'\r\nimport { getScopeOptions } from '../utils/scopeOptions.ts'\r\nimport { ColorPicker } from './ColorPicker.tsx'\r\nimport { RecurrenceFields } from './RecurrenceFields.tsx'\r\nimport { RecurrenceScopeModal } from './RecurrenceScopeModal.tsx'\r\n\r\ntype EventModalProps = {\r\n initialValue: EventInput\r\n occurrence?: EventOccurrence | null\r\n notice?: string\r\n onSave: (input: EventInput, scope: EditScope) => Promise<void>\r\n onDelete?: () => void\r\n onClose: () => void\r\n}\r\n\r\ntype PendingSave = {\r\n input: EventInput\r\n options: EditScope[]\r\n}\r\n\r\nexport function EventModal({ initialValue, occurrence = null, notice, onSave, onDelete, onClose }: EventModalProps) {\r\n const i18n = useI18n()\r\n const { m } = i18n\r\n const mode: EventModalMode = occurrence ? 'edit' : 'create'\r\n const [values, setValues] = useState(initialValue)\r\n const [errors, setErrors] = useState<EventValidationErrors>({})\r\n const [pendingSave, setPendingSave] = useState<PendingSave | null>(null)\r\n const { run: save, isPending, error: submitError } = useAsyncAction(onSave)\r\n\r\n const update = (changes: Partial<EventInput>, clearedErrors: readonly (keyof EventValidationErrors)[]) => {\r\n setValues((current) => ({ ...current, ...changes }))\r\n setErrors((current) => ({ ...current, ...Object.fromEntries(clearedErrors.map((key) => [key, undefined])) }))\r\n }\r\n\r\n const setField = <K extends Exclude<keyof EventInput, 'recurrence'>>(field: K, value: EventInput[K]) =>\r\n update({ [field]: value }, [field])\r\n\r\n const changeStartDate = (startDate: string) =>\r\n update(\r\n {\r\n ...(isISODate(values.startDate) && isISODate(values.endDate) && isISODate(startDate)\r\n ? moveToStartDate(values, startDate)\r\n : { startDate }),\r\n recurrence: adaptRecurrenceToStart(values.recurrence, values.startDate, startDate),\r\n },\r\n ['startDate', 'endDate'],\r\n )\r\n\r\n const setRecurrence = (recurrence: Recurrence | null) => update({ recurrence }, ['recurrence'])\r\n\r\n const handleSubmit: SubmitEventHandler<HTMLFormElement> = (event) => {\r\n event.preventDefault()\r\n const input = normalizeEventInput(values)\r\n const nextErrors = validateEventInput(input, m)\r\n setErrors(nextErrors)\r\n if (hasValidationErrors(nextErrors)) return\r\n\r\n const options = getScopeOptions(occurrence, input.recurrence)\r\n if (options.length > 1) setPendingSave({ input, options })\r\n else void save(input, options[0])\r\n }\r\n\r\n const handleScopeSelect = (scope: EditScope) => {\r\n if (!pendingSave) return\r\n setPendingSave(null)\r\n void save(pendingSave.input, scope)\r\n }\r\n\r\n return (\r\n <>\r\n <Modal title={mode === 'create' ? m.events.createTitle : m.events.editTitle} onClose={onClose}>\r\n <Form className=\"eventForm\" onSubmit={handleSubmit}>\r\n {notice && <p className=\"formHint eventNotice\">{notice}</p>}\r\n <TextField\r\n label={m.events.title}\r\n name=\"title\"\r\n autoComplete=\"off\"\r\n maxLength={EVENT_TITLE_MAX_LENGTH}\r\n value={values.title}\r\n error={errors.title}\r\n onChange={(title) => setField('title', title)}\r\n data-autofocus\r\n />\r\n\r\n <DateTimeField\r\n name=\"start\"\r\n dateLabel={m.events.startDate}\r\n timeLabel={m.events.startTime}\r\n date={values.startDate}\r\n time={values.start}\r\n dateError={errors.startDate}\r\n timeError={errors.start}\r\n onDateChange={changeStartDate}\r\n onTimeChange={(start) => setField('start', start)}\r\n />\r\n\r\n <DateTimeField\r\n name=\"end\"\r\n dateLabel={m.events.endDate}\r\n timeLabel={m.events.endTime}\r\n date={values.endDate}\r\n time={values.end}\r\n minDate={values.startDate}\r\n dateError={errors.endDate}\r\n timeError={errors.end}\r\n onDateChange={(endDate) => setField('endDate', endDate)}\r\n onTimeChange={(end) => setField('end', end)}\r\n />\r\n\r\n <RecurrenceFields\r\n value={values.recurrence}\r\n startDate={values.startDate}\r\n errors={errors.recurrence ?? {}}\r\n onChange={setRecurrence}\r\n />\r\n\r\n <FormField label={m.events.description} error={errors.description}>\r\n <textarea\r\n className=\"textarea eventDescription\"\r\n name=\"description\"\r\n maxLength={EVENT_DESCRIPTION_MAX_LENGTH}\r\n value={values.description}\r\n onChange={(event) => setField('description', event.target.value)}\r\n />\r\n </FormField>\r\n\r\n <ColorPicker value={values.color} onChange={(color) => setField('color', color)} />\r\n\r\n <ErrorMessage message={submitError} />\r\n\r\n <div className=\"modalActions\">\r\n <Button type=\"submit\" isPending={isPending} pendingLabel={m.common.saving}>\r\n {m.common.save}\r\n </Button>\r\n {onDelete && (\r\n <Button variant=\"danger\" disabled={isPending} onClick={onDelete}>\r\n {m.common.delete}\r\n </Button>\r\n )}\r\n <Button variant=\"secondary\" onClick={onClose}>\r\n {m.common.cancel}\r\n </Button>\r\n </div>\r\n </Form>\r\n </Modal>\r\n\r\n {pendingSave && (\r\n <RecurrenceScopeModal\r\n options={pendingSave.options}\r\n onSelect={handleScopeSelect}\r\n onClose={() => setPendingSave(null)}\r\n />\r\n )}\r\n </>\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { ErrorMessage } from '../../../components/StatusMessage.tsx'\r\nimport { Modal } from '../../../components/Modal.tsx'\r\nimport { useAsyncAction } from '../../../hooks/useAsyncAction.ts'\r\nimport type { EditScope, EventOccurrence } from '../../../utils/event.ts'\r\nimport { getScopeOptions } from '../utils/scopeOptions.ts'\r\nimport { ScopeButtons } from './ScopeButtons.tsx'\r\n\r\ntype DeleteEventModalProps = {\r\n occurrence: EventOccurrence\r\n onConfirm: (scope: EditScope) => Promise<void>\r\n onClose: () => void\r\n}\r\n\r\nexport function DeleteEventModal({ occurrence, onConfirm, onClose }: DeleteEventModalProps) {\r\n const { m } = useI18n()\r\n const { run, isPending, error } = useAsyncAction(onConfirm)\r\n const options = getScopeOptions(occurrence)\r\n const isSeries = options.length > 1\r\n\r\n return (\r\n <Modal title={m.events.deleteTitle} variant=\"danger\" onClose={onClose}>\r\n <p className=\"modalMessage\">\r\n {isSeries ? m.events.deleteSeriesMessage(occurrence.title) : m.events.deleteMessage(occurrence.title)}\r\n </p>\r\n\r\n <ErrorMessage message={error} />\r\n\r\n {isSeries ? (\r\n <ScopeButtons\r\n options={options}\r\n variant=\"danger\"\r\n disabled={isPending}\r\n onSelect={(scope) => void run(scope)}\r\n onCancel={onClose}\r\n />\r\n ) : (\r\n <div className=\"modalActions modalActions--split\">\r\n <Button variant=\"danger\" disabled={isPending} onClick={() => void run('all')}>\r\n {m.events.yes}\r\n </Button>\r\n <Button variant=\"success\" onClick={onClose} data-autofocus>\r\n {m.events.no}\r\n </Button>\r\n </div>\r\n )}\r\n </Modal>\r\n )\r\n}\r\n","import type { ReactNode } from 'react'\r\nimport { classNames } from '../utils/classNames.ts'\r\n\r\ntype IconButtonProps = {\r\n label: string\r\n title?: string\r\n plain?: boolean\r\n disabled?: boolean\r\n onClick: () => void\r\n children: ReactNode\r\n}\r\n\r\nexport function IconButton({ label, title = label, plain, disabled, onClick, children }: IconButtonProps) {\r\n return (\r\n <button\r\n type=\"button\"\r\n className={classNames('iconButton', plain && 'iconButton--plain')}\r\n aria-label={label}\r\n title={title}\r\n disabled={disabled}\r\n onClick={onClick}\r\n >\r\n {children}\r\n </button>\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { IconButton } from '../../../components/IconButton.tsx'\r\nimport { PageSection } from '../../../components/PageSection.tsx'\r\nimport { ErrorMessage } from '../../../components/StatusMessage.tsx'\r\nimport { useAsyncAction } from '../../../hooks/useAsyncAction.ts'\r\nimport { getEventColorAttributes, getEventColorLabel } from '../../../utils/event.ts'\r\nimport { MAX_CUSTOM_COLORS } from '../constants/colors.ts'\r\nimport { useCustomColors } from '../hooks/useCustomColors.ts'\r\n\r\nexport function CustomColorSettings() {\r\n const { m } = useI18n()\r\n const { colors, error: loadError, removeColor } = useCustomColors()\r\n const { run, isPending, error } = useAsyncAction(removeColor)\r\n\r\n return (\r\n <PageSection\r\n title={m.events.customColors}\r\n description={m.events.customColorsDescription(MAX_CUSTOM_COLORS)}\r\n >\r\n {colors.length === 0 ? (\r\n <p className=\"emptyHint\">{m.events.noCustomColors}</p>\r\n ) : (\r\n <ul className=\"itemList\">\r\n {colors.map((color) => {\r\n const label = getEventColorLabel(color, m)\r\n return (\r\n <li key={color} className=\"itemRow\">\r\n <span {...getEventColorAttributes(color, 'colorSwatch')} aria-hidden=\"true\" />\r\n <span className=\"itemRowMain colorCode\">{label}</span>\r\n <IconButton\r\n label={m.events.removeColor(label)}\r\n plain\r\n disabled={isPending}\r\n onClick={() => void run(color)}\r\n >\r\n ×\r\n </IconButton>\r\n </li>\r\n )\r\n })}\r\n </ul>\r\n )}\r\n <ErrorMessage message={loadError ?? error} />\r\n </PageSection>\r\n )\r\n}\r\n","import { createContext } from 'react'\r\nimport type { EventSources } from '../types/eventSource.ts'\r\n\r\nexport const NO_EVENT_SOURCES: EventSources = new Map()\r\n\r\nexport const EventSourcesContext = createContext<EventSources>(NO_EVENT_SOURCES)\r\n","import type { Messages } from '../../../i18n/index.ts'\r\nimport {\r\n addDaysToISODate,\r\n addMonthsToISODate,\r\n DAYS_PER_WEEK,\r\n endOfMonthISO,\r\n endOfWeekISO,\r\n endOfYearISO,\r\n fromISODate,\r\n getWeekNumber,\r\n startOfMonthISO,\r\n startOfWeekISO,\r\n startOfYearISO,\r\n} from '../../../utils/date.ts'\r\nimport { CALENDAR_VIEWS, type CalendarView, type ViewDefinition } from '../types/view.ts'\r\n\r\nconst MONTHS_PER_YEAR = 12\r\n\r\nexport const VIEW_DEFINITIONS: Record<CalendarView, ViewDefinition> = {\r\n day: {\r\n getRange: (anchor) => ({ from: anchor, to: anchor }),\r\n step: (anchor, direction) => addDaysToISODate(anchor, direction),\r\n getTitle: (anchor, { format }) => format.longDate(anchor),\r\n },\r\n week: {\r\n getRange: (anchor, firstDay) => ({ from: startOfWeekISO(anchor, firstDay), to: endOfWeekISO(anchor, firstDay) }),\r\n step: (anchor, direction) => addDaysToISODate(anchor, direction * DAYS_PER_WEEK),\r\n getTitle: (anchor, { format, weekInfo }) => format.weekTitle(fromISODate(startOfWeekISO(anchor, weekInfo.firstDay))),\r\n getSubtitle: (anchor, { m, weekInfo }) => m.views.weekNumber(getWeekNumber(fromISODate(anchor), weekInfo)),\r\n },\r\n month: {\r\n getRange: (anchor, firstDay) => ({\r\n from: startOfWeekISO(startOfMonthISO(anchor), firstDay),\r\n to: endOfWeekISO(endOfMonthISO(anchor), firstDay),\r\n }),\r\n step: (anchor, direction) => addMonthsToISODate(anchor, direction),\r\n getTitle: (anchor, { format }) => format.monthYear(anchor),\r\n },\r\n year: {\r\n getRange: (anchor) => ({ from: startOfYearISO(anchor), to: endOfYearISO(anchor) }),\r\n step: (anchor, direction) => addMonthsToISODate(anchor, direction * MONTHS_PER_YEAR),\r\n getTitle: (anchor) => anchor.slice(0, 4),\r\n },\r\n}\r\n\r\nexport const getViewOptions = (m: Messages) => CALENDAR_VIEWS.map((view) => ({ value: view, label: m.views[view].label }))\r\n","import { useCallback, useMemo, useState } from 'react'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { listISODates, toISODate } from '../../../utils/date.ts'\r\nimport { VIEW_DEFINITIONS } from '../constants/views.ts'\r\nimport type { CalendarView } from '../types/view.ts'\r\n\r\nconst today = () => toISODate(new Date())\r\n\r\nexport function useCalendarView(initialView: CalendarView = 'week', initialDate = today()) {\r\n const i18n = useI18n()\r\n const [view, setView] = useState(initialView)\r\n const [anchor, setAnchor] = useState(initialDate)\r\n const definition = VIEW_DEFINITIONS[view]\r\n\r\n const { from, to } = definition.getRange(anchor, i18n.weekInfo.firstDay)\r\n const range = useMemo(() => ({ from, to }), [from, to])\r\n const dates = useMemo(() => listISODates(from, to), [from, to])\r\n\r\n const previous = useCallback(() => setAnchor((current) => VIEW_DEFINITIONS[view].step(current, -1)), [view])\r\n const next = useCallback(() => setAnchor((current) => VIEW_DEFINITIONS[view].step(current, 1)), [view])\r\n const goToToday = useCallback(() => setAnchor(today()), [])\r\n const goToDate = useCallback((date: string) => setAnchor(date), [])\r\n const show = useCallback((nextView: CalendarView, date: string) => {\r\n setView(nextView)\r\n setAnchor(date)\r\n }, [])\r\n\r\n return {\r\n view,\r\n setView,\r\n anchor,\r\n range,\r\n dates,\r\n definition,\r\n title: definition.getTitle(anchor, i18n),\r\n subtitle: definition.getSubtitle?.(anchor, i18n),\r\n previous,\r\n next,\r\n goToToday,\r\n goToDate,\r\n show,\r\n }\r\n}\r\n","import { useEffect, useState } from 'react'\r\n\r\nconst MINUTE = 60_000\r\n\r\nexport function useNow() {\r\n const [now, setNow] = useState(() => new Date())\r\n\r\n useEffect(() => {\r\n let interval: number | undefined\r\n const tick = () => setNow(new Date())\r\n const timeout = window.setTimeout(\r\n () => {\r\n tick()\r\n interval = window.setInterval(tick, MINUTE)\r\n },\r\n MINUTE - (Date.now() % MINUTE),\r\n )\r\n\r\n return () => {\r\n window.clearTimeout(timeout)\r\n window.clearInterval(interval)\r\n }\r\n }, [])\r\n\r\n return now\r\n}\r\n","import type { I18n } from '../../../i18n/index.ts'\r\nimport { formatEventPeriod, getEventColorAttributes, type EventOccurrence } from '../../../utils/event.ts'\r\nimport { formatRecurrence } from '../../../utils/recurrence.ts'\r\nimport type { ClassNameValue } from '../../../utils/classNames.ts'\r\nimport type { EventSegment } from '../types/eventLayout.ts'\r\nimport type { EventSource } from '../types/eventSource.ts'\r\n\r\ntype LabelI18n = Pick<I18n, 'm' | 'format'>\r\n\r\nexport const getRecurrenceText = (event: EventOccurrence, i18n: LabelI18n) =>\r\n event.recurrence ? formatRecurrence(event.recurrence, event.startDate, i18n) : null\r\n\r\nexport const getSourceText = (source: EventSource, { m }: LabelI18n) => m.calendar.fromCalendar(source.name)\r\n\r\nexport const getEventTooltip = (event: EventOccurrence, source: EventSource | undefined, i18n: LabelI18n) =>\r\n [\r\n `${formatEventPeriod(event, i18n)}: ${event.title}`,\r\n getRecurrenceText(event, i18n),\r\n source && getSourceText(source, i18n),\r\n ]\r\n .filter(Boolean)\r\n .join('\\n')\r\n\r\nexport const getSegmentAttributes = (\r\n { event, continuesBefore, continuesAfter }: EventSegment,\r\n source: EventSource | undefined,\r\n i18n: LabelI18n,\r\n ...classNamesToMerge: ClassNameValue[]\r\n) => ({\r\n ...getEventColorAttributes(\r\n event.color,\r\n ...classNamesToMerge,\r\n continuesBefore && 'eventContinuesBefore',\r\n continuesAfter && 'eventContinuesAfter',\r\n ),\r\n title: getEventTooltip(event, source, i18n),\r\n})\r\n","import {\r\n addDaysToISODate,\r\n daysBetween,\r\n maxISODate,\r\n minISODate,\r\n MINUTES_PER_DAY,\r\n timeToMinutes,\r\n type DateRange,\r\n} from '../../../utils/date.ts'\r\nimport { getEventDuration, type EventOccurrence } from '../../../utils/event.ts'\r\nimport type { EventSegment } from '../types/eventLayout.ts'\r\n\r\nexport function splitEventIntoSegments(event: EventOccurrence, { from, to }: DateRange): EventSegment[] {\r\n const eventStart = timeToMinutes(event.start)\r\n const eventEnd = eventStart + getEventDuration(event)\r\n const firstDate = maxISODate(event.startDate, from)\r\n const lastDate = minISODate(event.endDate, to)\r\n const segments: EventSegment[] = []\r\n\r\n for (let date = firstDate; date <= lastDate; date = addDaysToISODate(date, 1)) {\r\n const dayOffset = daysBetween(event.startDate, date) * MINUTES_PER_DAY\r\n const start = Math.max(eventStart - dayOffset, 0)\r\n const end = Math.min(eventEnd - dayOffset, MINUTES_PER_DAY)\r\n if (end <= start) continue\r\n\r\n segments.push({\r\n event,\r\n date,\r\n start,\r\n end,\r\n continuesBefore: dayOffset + start > eventStart,\r\n continuesAfter: dayOffset + end < eventEnd,\r\n })\r\n }\r\n\r\n return segments\r\n}\r\n\r\nexport function groupSegmentsByDate(events: readonly EventOccurrence[], range: DateRange) {\r\n const groups = new Map<string, EventSegment[]>()\r\n for (const event of events) {\r\n for (const segment of splitEventIntoSegments(event, range)) {\r\n const group = groups.get(segment.date)\r\n if (group) group.push(segment)\r\n else groups.set(segment.date, [segment])\r\n }\r\n }\r\n return groups\r\n}\r\n","import { classNames } from '../utils/classNames.ts'\r\n\r\ntype SegmentedControlProps<T extends string> = {\r\n label: string\r\n value: T\r\n options: readonly { value: T; label: string }[]\r\n onChange: (value: T) => void\r\n}\r\n\r\nexport function SegmentedControl<T extends string>({ label, value, options, onChange }: SegmentedControlProps<T>) {\r\n return (\r\n <div className=\"segmentedControl\" role=\"group\" aria-label={label}>\r\n {options.map((option) => (\r\n <button\r\n key={option.value}\r\n type=\"button\"\r\n className={classNames('segment', option.value === value && 'active')}\r\n aria-pressed={option.value === value}\r\n onClick={() => onChange(option.value)}\r\n >\r\n {option.label}\r\n </button>\r\n ))}\r\n </div>\r\n )\r\n}\r\n","import type { ReactNode } from 'react'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { IconButton } from '../../../components/IconButton.tsx'\r\nimport { SegmentedControl } from '../../../components/SegmentedControl.tsx'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { getViewOptions } from '../constants/views.ts'\r\nimport type { CalendarView } from '../types/view.ts'\r\nimport { ChevronLeftIcon, ChevronRightIcon, PlusIcon } from '../../../components/Icons.tsx'\r\n\r\ntype CalendarHeaderProps = {\r\n view: CalendarView\r\n title: string\r\n subtitle?: string\r\n onViewChange: (view: CalendarView) => void\r\n onPrevious: () => void\r\n onNext: () => void\r\n onToday: () => void\r\n onCreateEvent?: () => void\r\n context?: ReactNode\r\n accessory?: ReactNode\r\n}\r\n\r\nexport function CalendarHeader({\r\n view,\r\n title,\r\n subtitle,\r\n onViewChange,\r\n onPrevious,\r\n onNext,\r\n onToday,\r\n onCreateEvent,\r\n context,\r\n accessory,\r\n}: CalendarHeaderProps) {\r\n const { m } = useI18n()\r\n const { previous: previousLabel, next: nextLabel } = m.views[view]\r\n return (\r\n <header className=\"header\">\r\n <div className=\"headerNav\">\r\n <IconButton label={previousLabel} title={`${previousLabel} (←)`} plain onClick={onPrevious}>\r\n <ChevronLeftIcon />\r\n </IconButton>\r\n <IconButton label={nextLabel} title={`${nextLabel} (→)`} plain onClick={onNext}>\r\n <ChevronRightIcon />\r\n </IconButton>\r\n <Button variant=\"outline\" className=\"todayButton\" onClick={onToday}>\r\n {m.calendar.today}\r\n </Button>\r\n </div>\r\n\r\n <div className=\"headerCenter\">\r\n <h1 className=\"headerTitle\">\r\n {title}\r\n {subtitle && <span className=\"headerSubtitle\">{subtitle}</span>}\r\n </h1>\r\n {context}\r\n </div>\r\n\r\n <div className=\"headerActions\">\r\n <SegmentedControl label={m.views.label} value={view} options={getViewOptions(m)} onChange={onViewChange} />\r\n <span className=\"headerCreate\">\r\n {onCreateEvent && (\r\n <IconButton label={m.calendar.newEvent} onClick={onCreateEvent}>\r\n <PlusIcon size={16} />\r\n </IconButton>\r\n )}\r\n {accessory}\r\n </span>\r\n </div>\r\n </header>\r\n )\r\n}\r\n","export const withoutPropagation = (action: () => void) => (event: { stopPropagation: () => void }) => {\r\n event.stopPropagation()\r\n action()\r\n}\r\n","import { HOURS_PER_DAY } from '../../../utils/date.ts'\r\n\r\nexport const HOURS = Array.from({ length: HOURS_PER_DAY }, (_, hour) => hour)\r\n\r\nexport const MIN_VISIBLE_DURATION = 15\r\n\r\nexport const DEFAULT_EVENT_HOUR = 9\r\n\r\nexport const MAX_EVENTS_PER_MONTH_CELL = 3\r\n","import { MIN_VISIBLE_DURATION } from '../constants/grid.ts'\r\nimport type { EventSegment } from '../types/eventLayout.ts'\r\n\r\nexport const getVisibleEnd = ({ start, end }: Pick<EventSegment, 'start' | 'end'>) =>\r\n Math.max(end, start + MIN_VISIBLE_DURATION)\r\n\r\nexport const getVisibleDuration = (segment: Pick<EventSegment, 'start' | 'end'>) =>\r\n getVisibleEnd(segment) - segment.start\r\n","import type { EventSegment, PositionedSegment } from '../types/eventLayout.ts'\r\nimport { getVisibleEnd } from './eventGeometry.ts'\r\n\r\nconst compareSegments = (a: EventSegment, b: EventSegment) =>\r\n a.start - b.start || b.end - b.start - (a.end - a.start) || a.event.title.localeCompare(b.event.title)\r\n\r\nexport const sortSegments = (segments: readonly EventSegment[]) => segments.toSorted(compareSegments)\r\n\r\nexport function layoutEvents(segments: readonly EventSegment[]): PositionedSegment[] {\r\n const positioned: PositionedSegment[] = []\r\n let cluster: { segment: EventSegment; column: number }[] = []\r\n let columnEnds: number[] = []\r\n let clusterEnd = -1\r\n\r\n const flushCluster = () => {\r\n for (const item of cluster) positioned.push({ ...item, columns: columnEnds.length })\r\n cluster = []\r\n columnEnds = []\r\n }\r\n\r\n for (const segment of sortSegments(segments)) {\r\n const { start } = segment\r\n const end = getVisibleEnd(segment)\r\n if (start >= clusterEnd) flushCluster()\r\n\r\n const freeColumn = columnEnds.findIndex((columnEnd) => columnEnd <= start)\r\n const column = freeColumn === -1 ? columnEnds.length : freeColumn\r\n columnEnds[column] = end\r\n cluster.push({ segment, column })\r\n clusterEnd = Math.max(clusterEnd, end)\r\n }\r\n\r\n flushCluster()\r\n return positioned\r\n}\r\n","import { use } from 'react'\r\nimport type { CalendarEvent } from '../../../utils/event.ts'\r\nimport { EventSourcesContext } from '../context/EventSourcesContext.ts'\r\n\r\nexport const useEventSource = ({ calendarId }: Pick<CalendarEvent, 'calendarId'>) =>\r\n use(EventSourcesContext).get(calendarId)\r\n","import type { EventOccurrence } from '../../../utils/event.ts'\r\nimport { RepeatIcon, TeamIcon } from '../../../components/Icons.tsx'\r\nimport type { EventSource } from '../types/eventSource.ts'\r\n\r\ntype EventTitleProps = {\r\n event: EventOccurrence\r\n source?: EventSource\r\n}\r\n\r\nexport function EventTitle({ event, source }: EventTitleProps) {\r\n return (\r\n <span className=\"eventName\">\r\n {source && <TeamIcon size={11} />}\r\n {event.recurrence && <RepeatIcon size={11} />}\r\n {event.title}\r\n </span>\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { withoutPropagation } from '../../../utils/dom.ts'\r\nimport type { EventOccurrence } from '../../../utils/event.ts'\r\nimport type { EventSegment } from '../types/eventLayout.ts'\r\nimport { useEventSource } from '../hooks/useEventSource.ts'\r\nimport { getSegmentAttributes } from '../utils/eventLabels.ts'\r\nimport { EventTitle } from './EventTitle.tsx'\r\n\r\ntype EventChipProps = {\r\n segment: EventSegment\r\n onSelect: (event: EventOccurrence) => void\r\n}\r\n\r\nexport function EventChip({ segment, onSelect }: EventChipProps) {\r\n const { event, start, continuesBefore } = segment\r\n const i18n = useI18n()\r\n const source = useEventSource(event)\r\n\r\n return (\r\n <button\r\n type=\"button\"\r\n {...getSegmentAttributes(segment, source, i18n, 'eventChip')}\r\n onClick={withoutPropagation(() => onSelect(event))}\r\n >\r\n {!continuesBefore && <span className=\"eventChipTime\">{i18n.format.time(start)}</span>}\r\n <EventTitle event={event} source={source} />\r\n </button>\r\n )\r\n}\r\n","import type { ReactNode } from 'react'\r\nimport { classNames } from '../../../utils/classNames.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { getMonthWeeks, isSameMonthISO } from '../../../utils/date.ts'\r\n\r\ntype MonthGridProps = {\r\n month: string\r\n className?: string\r\n renderDay: (date: string, isInMonth: boolean) => ReactNode\r\n}\r\n\r\nexport function MonthGrid({ month, className, renderDay }: MonthGridProps) {\r\n const { format } = useI18n()\r\n return (\r\n <div className={classNames('monthGrid', className)}>\r\n {format.shortWeekdays.map(({ weekday, label }) => (\r\n <div key={weekday} className=\"monthGridWeekday\" aria-hidden=\"true\">\r\n {label}\r\n </div>\r\n ))}\r\n {getMonthWeeks(month, format.firstDay)\r\n .flat()\r\n .map((date) => renderDay(date, isSameMonthISO(date, month)))}\r\n </div>\r\n )\r\n}\r\n","import { classNames } from '../../../utils/classNames.ts'\r\nimport { withoutPropagation } from '../../../utils/dom.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { getDayOfMonth } from '../../../utils/date.ts'\r\nimport { DEFAULT_EVENT_HOUR, MAX_EVENTS_PER_MONTH_CELL } from '../constants/grid.ts'\r\nimport type { CalendarViewProps } from '../types/view.ts'\r\nimport { sortSegments } from '../utils/layoutEvents.ts'\r\nimport { EventChip } from './EventChip.tsx'\r\nimport { MonthGrid } from './MonthGrid.tsx'\r\n\r\nexport function MonthView({ anchor, today, segmentsByDate, onCreate, onEventSelect, onShowDay }: CalendarViewProps) {\r\n const { m, format } = useI18n()\r\n return (\r\n <MonthGrid\r\n month={anchor}\r\n className=\"monthView\"\r\n renderDay={(date, isInMonth) => {\r\n const segments = sortSegments(segmentsByDate.get(date) ?? [])\r\n const visibleCount =\r\n segments.length > MAX_EVENTS_PER_MONTH_CELL ? MAX_EVENTS_PER_MONTH_CELL - 1 : segments.length\r\n const moreCount = segments.length - visibleCount\r\n const showDay = withoutPropagation(() => onShowDay(date))\r\n return (\r\n <div\r\n key={date}\r\n className={classNames('monthCell', !isInMonth && 'outsideMonth', date === today && 'today')}\r\n data-date={date}\r\n onClick={() => onCreate(date, DEFAULT_EVENT_HOUR)}\r\n >\r\n <button type=\"button\" className=\"dayNumber\" title={m.calendar.openDay(format.longDate(date))} onClick={showDay}>\r\n {getDayOfMonth(date)}\r\n </button>\r\n <div className=\"monthCellEvents\">\r\n {segments.slice(0, visibleCount).map((segment) => (\r\n <EventChip key={segment.event.occurrenceKey} segment={segment} onSelect={onEventSelect} />\r\n ))}\r\n {moreCount > 0 && (\r\n <button type=\"button\" className=\"moreEvents\" onClick={showDay}>\r\n {m.calendar.moreEvents(moreCount)}\r\n </button>\r\n )}\r\n </div>\r\n {segments.length > 0 && (\r\n <span className=\"eventDots\" aria-hidden=\"true\">\r\n {segments.length}\r\n </span>\r\n )}\r\n </div>\r\n )\r\n }}\r\n />\r\n )\r\n}\r\n","import type { HourSlot } from '../../../utils/event.ts'\r\nimport { HOURS_PER_DAY } from '../../../utils/date.ts'\r\n\r\nexport type SlotSelection = { anchor: HourSlot; current: HourSlot }\r\n\r\nexport type SlotRange = { first: HourSlot; last: HourSlot }\r\n\r\nconst slotKey = ({ date, hour }: HourSlot) => `${date}T${String(hour).padStart(2, '0')}`\r\n\r\nexport const isSameSlot = (a: HourSlot | null, b: HourSlot | null) =>\r\n a !== null && b !== null && slotKey(a) === slotKey(b)\r\n\r\nexport const toSlotRange = ({ anchor, current }: SlotSelection): SlotRange =>\r\n slotKey(anchor) <= slotKey(current) ? { first: anchor, last: current } : { first: current, last: anchor }\r\n\r\nexport const getHoursOnDate = ({ first, last }: SlotRange, date: string) => {\r\n if (date < first.date || date > last.date) return null\r\n const fromHour = date === first.date ? first.hour : 0\r\n const toHour = date === last.date ? last.hour : HOURS_PER_DAY - 1\r\n return { fromHour, toHour }\r\n}\r\n\r\nexport const findSlotAt = (scope: Document | ShadowRoot, x: number, y: number): HourSlot | null => {\r\n const day = scope.elementFromPoint(x, y)?.closest<HTMLElement>('.day[data-date]')\r\n const slots = day?.querySelector<HTMLElement>('.slots')\r\n if (!day?.dataset.date || !slots) return null\r\n const { top, height } = slots.getBoundingClientRect()\r\n const hour = Math.floor(((y - top) / height) * HOURS_PER_DAY)\r\n return { date: day.dataset.date, hour: Math.min(Math.max(hour, 0), HOURS_PER_DAY - 1) }\r\n}\r\n\r\nexport const getSlotFromTarget = (target: EventTarget | null): HourSlot | null => {\r\n if (!(target instanceof Element)) return null\r\n const slot = target.closest<HTMLElement>('.slot[data-hour]')\r\n const date = slot?.closest<HTMLElement>('.day[data-date]')?.dataset.date\r\n return slot && date ? { date, hour: Number(slot.dataset.hour) } : null\r\n}\r\n","import { useCallback, useEffect, useRef, useState, type RefObject } from 'react'\r\nimport type { HourSlot } from '../../../utils/event.ts'\r\nimport {\r\n findSlotAt,\r\n getSlotFromTarget,\r\n isSameSlot,\r\n toSlotRange,\r\n type SlotRange,\r\n type SlotSelection,\r\n} from '../utils/slotSelection.ts'\r\n\r\nconst LONG_PRESS_MS = 350\r\nconst MOVE_TOLERANCE_PX = 8\r\nconst EDGE_PX = 48\r\nconst SCROLL_STEP_PX = 12\r\nconst CLICK_SUPPRESSION_MS = 500\r\n\r\ntype Point = { x: number; y: number }\r\n\r\nexport function useSlotSelection(\r\n containerRef: RefObject<HTMLElement | null>,\r\n enabled: boolean,\r\n onSelect: (range: SlotRange) => void,\r\n) {\r\n const [selection, setSelection] = useState<SlotSelection | null>(null)\r\n const onSelectRef = useRef(onSelect)\r\n const suppressClickUntil = useRef(0)\r\n\r\n useEffect(() => {\r\n onSelectRef.current = onSelect\r\n })\r\n\r\n useEffect(() => {\r\n const container = containerRef.current\r\n if (!container || !enabled) return\r\n\r\n let anchor: HourSlot | null = null\r\n let current: HourSlot | null = null\r\n let isActive = false\r\n let pressTimer: ReturnType<typeof setTimeout> | undefined\r\n let frame = 0\r\n let pressPoint: Point | null = null\r\n let lastPoint: Point | null = null\r\n const scroller = container.closest<HTMLElement>('.scrollArea')\r\n const scope = container.getRootNode() as Document | ShadowRoot\r\n\r\n const moveTo = ({ x, y }: Point) => {\r\n const slot = findSlotAt(scope, x, y)\r\n if (!slot || !anchor || isSameSlot(slot, current)) return\r\n current = slot\r\n setSelection({ anchor, current })\r\n }\r\n\r\n const autoScroll = () => {\r\n if (!isActive) return\r\n if (scroller && lastPoint) {\r\n const { top, bottom } = scroller.getBoundingClientRect()\r\n const step = lastPoint.y < top + EDGE_PX ? -SCROLL_STEP_PX : lastPoint.y > bottom - EDGE_PX ? SCROLL_STEP_PX : 0\r\n if (step !== 0) {\r\n scroller.scrollTop += step\r\n moveTo(lastPoint)\r\n }\r\n }\r\n frame = requestAnimationFrame(autoScroll)\r\n }\r\n\r\n const activate = (slot: HourSlot) => {\r\n isActive = true\r\n anchor = slot\r\n current = slot\r\n setSelection({ anchor, current })\r\n frame = requestAnimationFrame(autoScroll)\r\n }\r\n\r\n const finish = (commit: boolean) => {\r\n clearTimeout(pressTimer)\r\n pressTimer = undefined\r\n cancelAnimationFrame(frame)\r\n if (isActive && commit && anchor && current) {\r\n suppressClickUntil.current = Date.now() + CLICK_SUPPRESSION_MS\r\n onSelectRef.current(toSlotRange({ anchor, current }))\r\n }\r\n if (isActive) setSelection(null)\r\n isActive = false\r\n anchor = null\r\n current = null\r\n }\r\n\r\n const handlePointerDown = (event: PointerEvent) => {\r\n if (event.pointerType !== 'mouse' || event.button !== 0) return\r\n const slot = getSlotFromTarget(event.target)\r\n if (!slot) return\r\n event.preventDefault()\r\n lastPoint = { x: event.clientX, y: event.clientY }\r\n activate(slot)\r\n }\r\n\r\n const handlePointerMove = (event: PointerEvent) => {\r\n if (!isActive || event.pointerType !== 'mouse') return\r\n lastPoint = { x: event.clientX, y: event.clientY }\r\n moveTo(lastPoint)\r\n }\r\n\r\n const handlePointerUp = (event: PointerEvent) => {\r\n if (event.pointerType === 'mouse') finish(true)\r\n }\r\n\r\n const handleTouchStart = (event: TouchEvent) => {\r\n if (event.touches.length !== 1) return finish(false)\r\n const slot = getSlotFromTarget(event.target)\r\n if (!slot) return\r\n const touch = event.touches[0]\r\n pressPoint = lastPoint = { x: touch.clientX, y: touch.clientY }\r\n pressTimer = setTimeout(() => {\r\n pressTimer = undefined\r\n activate(slot)\r\n navigator.vibrate?.(10)\r\n }, LONG_PRESS_MS)\r\n }\r\n\r\n const handleTouchMove = (event: TouchEvent) => {\r\n const touch = event.touches[0]\r\n lastPoint = { x: touch.clientX, y: touch.clientY }\r\n if (isActive) {\r\n event.preventDefault()\r\n moveTo(lastPoint)\r\n } else if (pressTimer && pressPoint) {\r\n const distance = Math.hypot(lastPoint.x - pressPoint.x, lastPoint.y - pressPoint.y)\r\n if (distance > MOVE_TOLERANCE_PX) finish(false)\r\n }\r\n }\r\n\r\n const handleTouchEnd = () => finish(true)\r\n const handleTouchCancel = () => finish(false)\r\n\r\n const handleContextMenu = (event: Event) => {\r\n if (isActive || pressTimer || getSlotFromTarget(event.target)) event.preventDefault()\r\n }\r\n\r\n container.addEventListener('pointerdown', handlePointerDown)\r\n window.addEventListener('pointermove', handlePointerMove)\r\n window.addEventListener('pointerup', handlePointerUp)\r\n container.addEventListener('touchstart', handleTouchStart, { passive: true })\r\n container.addEventListener('touchmove', handleTouchMove, { passive: false })\r\n container.addEventListener('touchend', handleTouchEnd)\r\n container.addEventListener('touchcancel', handleTouchCancel)\r\n container.addEventListener('contextmenu', handleContextMenu)\r\n\r\n return () => {\r\n finish(false)\r\n container.removeEventListener('pointerdown', handlePointerDown)\r\n window.removeEventListener('pointermove', handlePointerMove)\r\n window.removeEventListener('pointerup', handlePointerUp)\r\n container.removeEventListener('touchstart', handleTouchStart)\r\n container.removeEventListener('touchmove', handleTouchMove)\r\n container.removeEventListener('touchend', handleTouchEnd)\r\n container.removeEventListener('touchcancel', handleTouchCancel)\r\n container.removeEventListener('contextmenu', handleContextMenu)\r\n }\r\n }, [containerRef, enabled])\r\n\r\n const isClickSuppressed = useCallback(() => Date.now() < suppressClickUntil.current, [])\r\n\r\n return { selection, isClickSuppressed }\r\n}\r\n","import type { CSSProperties } from 'react'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { formatEventPeriod, type EventOccurrence } from '../../../utils/event.ts'\r\nimport type { EventSegment } from '../types/eventLayout.ts'\r\nimport { useEventSource } from '../hooks/useEventSource.ts'\r\nimport { getVisibleDuration } from '../utils/eventGeometry.ts'\r\nimport { getSegmentAttributes } from '../utils/eventLabels.ts'\r\nimport { EventTitle } from './EventTitle.tsx'\r\n\r\ntype EventBlockProps = {\r\n segment: EventSegment\r\n column: number\r\n columns: number\r\n onSelect: (event: EventOccurrence) => void\r\n}\r\n\r\nconst getSizeClass = (duration: number) => (duration <= 30 ? 'veryShortEvent' : duration < 60 ? 'shortEvent' : null)\r\n\r\nexport function EventBlock({ segment, column, columns, onSelect }: EventBlockProps) {\r\n const { event, start } = segment\r\n const i18n = useI18n()\r\n const source = useEventSource(event)\r\n const duration = getVisibleDuration(segment)\r\n const { style: colorStyle, ...attributes } = getSegmentAttributes(segment, source, i18n, 'event', getSizeClass(duration))\r\n const style = {\r\n '--event-start': start,\r\n '--event-duration': duration,\r\n '--event-column': column,\r\n '--event-columns': columns,\r\n ...colorStyle,\r\n } as CSSProperties\r\n\r\n return (\r\n <button type=\"button\" {...attributes} style={style} onClick={() => onSelect(event)}>\r\n <EventTitle event={event} source={source} />\r\n {source && duration >= 120 && <span className=\"eventSource\">{source.name}</span>}\r\n {duration >= 90 && <span className=\"eventTime\">{formatEventPeriod(event, i18n)}</span>}\r\n </button>\r\n )\r\n}\r\n","import type { CSSProperties } from 'react'\r\nimport { classNames } from '../../../utils/classNames.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\n\r\ntype NowIndicatorProps = {\r\n minutes: number\r\n isToday: boolean\r\n}\r\n\r\nexport function NowIndicator({ minutes, isToday }: NowIndicatorProps) {\r\n const { m, format } = useI18n()\r\n return (\r\n <div\r\n className={classNames('nowIndicator', isToday && 'nowIndicator--today')}\r\n style={{ '--now-minutes': minutes } as CSSProperties}\r\n title={isToday ? m.calendar.now(format.time(minutes)) : undefined}\r\n aria-hidden=\"true\"\r\n />\r\n )\r\n}\r\n","import { useMemo, type CSSProperties } from 'react'\r\nimport { classNames } from '../../../utils/classNames.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { fromISODate, getDayOfMonth } from '../../../utils/date.ts'\r\nimport type { EventOccurrence } from '../../../utils/event.ts'\r\nimport { HOURS } from '../constants/grid.ts'\r\nimport type { EventSegment } from '../types/eventLayout.ts'\r\nimport { layoutEvents } from '../utils/layoutEvents.ts'\r\nimport { EventBlock } from './EventBlock.tsx'\r\nimport { NowIndicator } from './NowIndicator.tsx'\r\n\r\ntype DayColumnProps = {\r\n date: string\r\n isToday: boolean\r\n nowMinutes: number | null\r\n segments: readonly EventSegment[]\r\n selection?: { fromHour: number; toHour: number; label: string | null } | null\r\n onSlotSelect: (date: string, hour: number) => void\r\n onEventSelect: (event: EventOccurrence) => void\r\n onHeaderSelect?: (date: string) => void\r\n}\r\n\r\nexport function DayColumn({\r\n date,\r\n isToday,\r\n nowMinutes,\r\n segments,\r\n selection = null,\r\n onSlotSelect,\r\n onEventSelect,\r\n onHeaderSelect,\r\n}: DayColumnProps) {\r\n const { m, format } = useI18n()\r\n const day = fromISODate(date)\r\n const dayLabel = format.longDate(date)\r\n const positionedSegments = useMemo(() => layoutEvents(segments), [segments])\r\n const header = (\r\n <>\r\n <span className=\"dayName\">\r\n <span className=\"compactHidden\">{format.weekday(day)}</span>\r\n <span className=\"compactOnly\">{format.shortWeekday(day)}</span>\r\n </span>\r\n <span className=\"dayDisplay\">\r\n <span className=\"compactHidden\">{format.day(day)}</span>\r\n <span className=\"compactOnly\">{getDayOfMonth(date)}</span>\r\n </span>\r\n </>\r\n )\r\n\r\n return (\r\n <div className={classNames('day', isToday && 'currentDay')} data-date={date}>\r\n {onHeaderSelect ? (\r\n <button\r\n type=\"button\"\r\n className=\"columnHeader\"\r\n title={m.calendar.openDay(dayLabel)}\r\n onClick={() => onHeaderSelect(date)}\r\n >\r\n {header}\r\n </button>\r\n ) : (\r\n <div className=\"columnHeader\">{header}</div>\r\n )}\r\n <div className=\"slots\">\r\n {HOURS.map((hour) => (\r\n <div\r\n key={hour}\r\n className=\"slot\"\r\n data-hour={hour}\r\n title={`${dayLabel} ${format.hour(hour)}`}\r\n onClick={() => onSlotSelect(date, hour)}\r\n />\r\n ))}\r\n {positionedSegments.map(({ segment, column, columns }) => (\r\n <EventBlock\r\n key={segment.event.occurrenceKey}\r\n segment={segment}\r\n column={column}\r\n columns={columns}\r\n onSelect={onEventSelect}\r\n />\r\n ))}\r\n {selection && (\r\n <div\r\n className=\"slotSelection\"\r\n style={\r\n {\r\n '--selection-start': selection.fromHour,\r\n '--selection-hours': selection.toHour - selection.fromHour + 1,\r\n } as CSSProperties\r\n }\r\n aria-hidden=\"true\"\r\n >\r\n {selection.label && <span className=\"slotSelectionLabel\">{selection.label}</span>}\r\n </div>\r\n )}\r\n {nowMinutes !== null && <NowIndicator minutes={nowMinutes} isToday={isToday} />}\r\n </div>\r\n </div>\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { HOURS } from '../constants/grid.ts'\r\n\r\nexport function TimeColumn() {\r\n const { format } = useI18n()\r\n return (\r\n <div className=\"dayTime\" aria-hidden=\"true\">\r\n <div className=\"columnHeader\" />\r\n <div className=\"slots\">\r\n {HOURS.map((hour) => (\r\n <div key={hour} className=\"time\">\r\n <span className=\"compactHidden\">{format.hour(hour)}</span>\r\n <span className=\"compactOnly\">{format.compactHour(hour)}</span>\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n )\r\n}\r\n","import { useMemo, useRef } from 'react'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { classNames } from '../../../utils/classNames.ts'\r\nimport { createEventInputForSlots, formatEventPeriod } from '../../../utils/event.ts'\r\nimport { useSlotSelection } from '../hooks/useSlotSelection.ts'\r\nimport type { EventSegment } from '../types/eventLayout.ts'\r\nimport type { CalendarViewProps } from '../types/view.ts'\r\nimport { getHoursOnDate, toSlotRange } from '../utils/slotSelection.ts'\r\nimport { DayColumn } from './DayColumn.tsx'\r\nimport { TimeColumn } from './TimeColumn.tsx'\r\n\r\nconst NO_SEGMENTS: readonly EventSegment[] = []\r\n\r\nexport function TimeGridView({\r\n dates,\r\n today,\r\n currentMinutes,\r\n segmentsByDate,\r\n canCreate,\r\n onCreate,\r\n onCreateRange,\r\n onEventSelect,\r\n onShowDay,\r\n}: CalendarViewProps) {\r\n const i18n = useI18n()\r\n const containerRef = useRef<HTMLDivElement>(null)\r\n const { selection, isClickSuppressed } = useSlotSelection(containerRef, canCreate, onCreateRange)\r\n const range = useMemo(() => (selection ? toSlotRange(selection) : null), [selection])\r\n const rangeLabel = range ? formatEventPeriod(createEventInputForSlots(range.first, range.last), i18n) : null\r\n const isSingleDay = dates.length === 1\r\n const showsToday = dates.includes(today)\r\n\r\n return (\r\n <div\r\n ref={containerRef}\r\n className={classNames('calendar', isSingleDay ? 'calendar--day' : 'calendar--week', range && 'isSelecting')}\r\n >\r\n <TimeColumn />\r\n {dates.map((date) => {\r\n const hours = range && getHoursOnDate(range, date)\r\n return (\r\n <DayColumn\r\n key={date}\r\n date={date}\r\n isToday={date === today}\r\n nowMinutes={showsToday ? currentMinutes : null}\r\n segments={segmentsByDate.get(date) ?? NO_SEGMENTS}\r\n selection={hours && { ...hours, label: date === range.first.date ? rangeLabel : null }}\r\n onSlotSelect={(slotDate, hour) => {\r\n if (!isClickSuppressed()) onCreate(slotDate, hour)\r\n }}\r\n onEventSelect={onEventSelect}\r\n onHeaderSelect={isSingleDay ? undefined : onShowDay}\r\n />\r\n )\r\n })}\r\n </div>\r\n )\r\n}\r\n","import { classNames } from '../../../utils/classNames.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { getDayOfMonth } from '../../../utils/date.ts'\r\nimport { MonthGrid } from './MonthGrid.tsx'\r\n\r\ntype MiniMonthProps = {\r\n month: string\r\n today: string\r\n className?: string\r\n hasEvents?: (date: string) => boolean\r\n onSelectDay?: (date: string) => void\r\n}\r\n\r\nexport function MiniMonth({ month, today, className, hasEvents, onSelectDay }: MiniMonthProps) {\r\n const { format } = useI18n()\r\n return (\r\n <MonthGrid\r\n month={month}\r\n className={classNames('miniMonth', className)}\r\n renderDay={(date, isInMonth) => {\r\n if (!isInMonth) return <span key={date} className=\"miniDay outsideMonth\" aria-hidden=\"true\" />\r\n const dayClassName = classNames('miniDay', date === today && 'today', hasEvents?.(date) && 'hasEvents')\r\n return onSelectDay ? (\r\n <button\r\n key={date}\r\n type=\"button\"\r\n className={dayClassName}\r\n title={format.longDate(date)}\r\n onClick={() => onSelectDay(date)}\r\n >\r\n {getDayOfMonth(date)}\r\n </button>\r\n ) : (\r\n <span key={date} className={dayClassName}>\r\n {getDayOfMonth(date)}\r\n </span>\r\n )\r\n }}\r\n />\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport type { CalendarViewProps } from '../types/view.ts'\r\nimport { MiniMonth } from './MiniMonth.tsx'\r\n\r\nconst MONTHS = Array.from({ length: 12 }, (_, index) => String(index + 1).padStart(2, '0'))\r\n\r\nexport function YearView({ anchor, today, segmentsByDate, onShowDay, onShowMonth }: CalendarViewProps) {\r\n const { format } = useI18n()\r\n const year = anchor.slice(0, 4)\r\n return (\r\n <div className=\"yearView\">\r\n {MONTHS.map((month) => {\r\n const firstDay = `${year}-${month}-01`\r\n return (\r\n <section key={month} className=\"yearMonth\">\r\n <h2>\r\n <button type=\"button\" className=\"yearMonthTitle\" onClick={() => onShowMonth(firstDay)}>\r\n {format.monthName(firstDay)}\r\n </button>\r\n </h2>\r\n <MiniMonth\r\n month={firstDay}\r\n today={today}\r\n hasEvents={(date) => segmentsByDate.has(date)}\r\n onSelectDay={onShowDay}\r\n />\r\n </section>\r\n )\r\n })}\r\n </div>\r\n )\r\n}\r\n","import { useCallback, useMemo, useState, type ComponentType, type ReactNode } from 'react'\r\nimport { ErrorMessage } from '../../../components/StatusMessage.tsx'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { useArrowKeyNavigation } from '../../../hooks/useArrowKeyNavigation.ts'\r\nimport { MINUTES_PER_HOUR, toISODate } from '../../../utils/date.ts'\r\nimport {\r\n createEventInput,\r\n createEventInputForSlots,\r\n expandEvents,\r\n toEventInput,\r\n type EditScope,\r\n type EventInput,\r\n type EventOccurrence,\r\n} from '../../../utils/event.ts'\r\nimport { DeleteEventModal, EventModal, useEvents } from '../../events/index.ts'\r\nimport { EventSourcesContext, NO_EVENT_SOURCES } from '../context/EventSourcesContext.ts'\r\nimport { useCalendarView } from '../hooks/useCalendarView.ts'\r\nimport { useNow } from '../hooks/useNow.ts'\r\nimport type { EditorState } from '../types/editor.ts'\r\nimport type { EventSources } from '../types/eventSource.ts'\r\nimport { getSourceText } from '../utils/eventLabels.ts'\r\nimport type { SlotRange } from '../utils/slotSelection.ts'\r\nimport type { CalendarView, CalendarViewProps } from '../types/view.ts'\r\nimport { groupSegmentsByDate } from '../utils/segmentEvents.ts'\r\nimport { CalendarHeader } from './CalendarHeader.tsx'\r\nimport { MonthView } from './MonthView.tsx'\r\nimport { TimeGridView } from './TimeGridView.tsx'\r\nimport { YearView } from './YearView.tsx'\r\n\r\nconst VIEW_COMPONENTS: Record<CalendarView, ComponentType<CalendarViewProps>> = {\r\n day: TimeGridView,\r\n week: TimeGridView,\r\n month: MonthView,\r\n year: YearView,\r\n}\r\n\r\ntype CalendarProps = {\r\n calendarIds: readonly string[]\r\n targetCalendarId: string\r\n canCreate?: boolean\r\n eventSources?: EventSources\r\n initialView?: CalendarView\r\n headerContext?: ReactNode\r\n headerAccessory?: ReactNode\r\n}\r\n\r\nexport function Calendar({\r\n calendarIds,\r\n targetCalendarId,\r\n canCreate = true,\r\n eventSources = NO_EVENT_SOURCES,\r\n initialView,\r\n headerContext,\r\n headerAccessory,\r\n}: CalendarProps) {\r\n const i18n = useI18n()\r\n const now = useNow()\r\n const today = toISODate(now)\r\n const { view, setView, anchor, range, dates, title, subtitle, previous, next, goToToday, goToDate, show } =\r\n useCalendarView(initialView)\r\n const { events, error, createEvent, updateEvent, deleteEvent } = useEvents({\r\n ...range,\r\n calendarIds,\r\n targetCalendarId,\r\n })\r\n const segmentsByDate = useMemo(\r\n () => groupSegmentsByDate(expandEvents(events, range.from, range.to), range),\r\n [events, range],\r\n )\r\n const [editor, setEditor] = useState<EditorState | null>(null)\r\n const [eventToDelete, setEventToDelete] = useState<EventOccurrence | null>(null)\r\n\r\n useArrowKeyNavigation({ onPrevious: previous, onNext: next })\r\n\r\n const openCreate = useCallback(\r\n (date: string, hour: number) => {\r\n if (canCreate) setEditor({ initialValue: createEventInput(date, hour), occurrence: null })\r\n },\r\n [canCreate],\r\n )\r\n\r\n const openCreateRange = useCallback(\r\n ({ first, last }: SlotRange) => {\r\n if (canCreate) setEditor({ initialValue: createEventInputForSlots(first, last), occurrence: null })\r\n },\r\n [canCreate],\r\n )\r\n\r\n const openEdit = useCallback((occurrence: EventOccurrence) => {\r\n setEditor({ initialValue: toEventInput(occurrence), occurrence })\r\n }, [])\r\n\r\n const handleSave = async (input: EventInput, scope: EditScope) => {\r\n if (editor?.occurrence) await updateEvent(editor.occurrence, input, scope)\r\n else await createEvent(input)\r\n setEditor(null)\r\n goToDate(input.startDate)\r\n }\r\n\r\n const handleDelete = async (scope: EditScope) => {\r\n if (!eventToDelete) return\r\n await deleteEvent(eventToDelete, scope)\r\n setEventToDelete(null)\r\n setEditor(null)\r\n }\r\n\r\n const ViewComponent = VIEW_COMPONENTS[view]\r\n const editorSource = editor?.occurrence ? eventSources.get(editor.occurrence.calendarId) : undefined\r\n\r\n return (\r\n <EventSourcesContext value={eventSources}>\r\n <CalendarHeader\r\n view={view}\r\n title={title}\r\n subtitle={subtitle}\r\n onViewChange={setView}\r\n onPrevious={previous}\r\n onNext={next}\r\n onToday={goToToday}\r\n onCreateEvent={canCreate ? () => openCreate(view === 'day' ? anchor : today, now.getHours()) : undefined}\r\n context={headerContext}\r\n accessory={headerAccessory}\r\n />\r\n\r\n <ErrorMessage message={error} className=\"textCenter\" />\r\n\r\n <main className=\"main scrollArea\" data-view={view}>\r\n <ViewComponent\r\n anchor={anchor}\r\n dates={dates}\r\n today={today}\r\n currentMinutes={now.getHours() * MINUTES_PER_HOUR + now.getMinutes()}\r\n segmentsByDate={segmentsByDate}\r\n canCreate={canCreate}\r\n onCreate={openCreate}\r\n onCreateRange={openCreateRange}\r\n onEventSelect={openEdit}\r\n onShowDay={(date) => show('day', date)}\r\n onShowMonth={(date) => show('month', date)}\r\n />\r\n </main>\r\n\r\n {editor && (\r\n <EventModal\r\n key={editor.occurrence?.occurrenceKey ?? 'new'}\r\n initialValue={editor.initialValue}\r\n occurrence={editor.occurrence}\r\n notice={editorSource && i18n.m.calendar.sharedEventNotice(getSourceText(editorSource, i18n))}\r\n onSave={handleSave}\r\n onDelete={editor.occurrence ? () => setEventToDelete(editor.occurrence) : undefined}\r\n onClose={() => setEditor(null)}\r\n />\r\n )}\r\n\r\n {eventToDelete && (\r\n <DeleteEventModal occurrence={eventToDelete} onConfirm={handleDelete} onClose={() => setEventToDelete(null)} />\r\n )}\r\n </EventSourcesContext>\r\n )\r\n}\r\n","import { useI18n } from '../../../i18n/index.ts'\r\nimport { toISODate } from '../../../utils/date.ts'\r\nimport { getEventColorAttributes, type EventColor } from '../../../utils/event.ts'\r\nimport { MiniMonth } from '../../calendar/index.ts'\r\n\r\nexport function CalendarPreview({ color }: { color: EventColor }) {\r\n const { format } = useI18n()\r\n const today = toISODate(new Date())\r\n\r\n return (\r\n <div {...getEventColorAttributes(color, 'calendarPreview')} aria-hidden=\"true\">\r\n <div className=\"calendarPreviewHeader\">{format.monthYear(today)}</div>\r\n <MiniMonth month={today} today={today} className=\"calendarPreviewMonth\" />\r\n </div>\r\n )\r\n}\r\n","import type { EventColor } from '../../../../utils/event.ts'\r\nimport { ColorPicker } from '../../../events/index.ts'\r\nimport { CalendarPreview } from '../CalendarPreview.tsx'\r\n\r\ntype ColorStepProps = {\r\n color: EventColor\r\n onChange: (color: EventColor) => void\r\n}\r\n\r\nexport function ColorStep({ color, onChange }: ColorStepProps) {\r\n return (\r\n <div className=\"wizardSplit\">\r\n <ColorPicker value={color} onChange={onChange} />\r\n <CalendarPreview color={color} />\r\n </div>\r\n )\r\n}\r\n","import { useI18n } from '../../../../i18n/index.ts'\r\nimport { FormField } from '../../../../components/FormField.tsx'\r\nimport { TextField } from '../../../../components/TextField.tsx'\r\nimport type { FieldErrors } from '../../../../utils/validation.ts'\r\nimport { CALENDAR_DESCRIPTION_MAX_LENGTH, CALENDAR_NAME_MAX_LENGTH } from '../../constants/calendars.ts'\r\nimport type { DetailsValues } from '../../utils/draft.ts'\r\n\r\ntype DetailsStepProps = {\r\n values: DetailsValues\r\n errors: FieldErrors<DetailsValues>\r\n disabled?: Partial<Record<keyof DetailsValues, boolean>>\r\n hideDescription?: boolean\r\n autoFocus?: boolean\r\n onChange: (changes: Partial<DetailsValues>) => void\r\n}\r\n\r\nexport function DetailsStep({\r\n values,\r\n errors,\r\n disabled = {},\r\n hideDescription = false,\r\n autoFocus = false,\r\n onChange,\r\n}: DetailsStepProps) {\r\n const { m } = useI18n()\r\n const { details } = m.calendars\r\n return (\r\n <>\r\n <TextField\r\n label={details.name}\r\n name=\"name\"\r\n autoComplete=\"off\"\r\n maxLength={CALENDAR_NAME_MAX_LENGTH}\r\n placeholder={details.namePlaceholder}\r\n value={values.name}\r\n error={errors.name}\r\n disabled={disabled.name}\r\n onChange={(name) => onChange({ name })}\r\n autoFocus={autoFocus}\r\n />\r\n {!hideDescription && (\r\n <FormField label={details.descriptionOptional} error={errors.description}>\r\n <textarea\r\n className=\"textarea\"\r\n name=\"description\"\r\n maxLength={CALENDAR_DESCRIPTION_MAX_LENGTH}\r\n placeholder={details.descriptionPlaceholder}\r\n value={values.description}\r\n disabled={disabled.description}\r\n onChange={(event) => onChange({ description: event.target.value })}\r\n />\r\n </FormField>\r\n )}\r\n </>\r\n )\r\n}\r\n","import { useI18n } from '../../../../i18n/index.ts'\r\nimport { Button } from '../../../../components/Button.tsx'\r\nimport { Form } from '../../../../components/Form.tsx'\r\nimport { PageSection } from '../../../../components/PageSection.tsx'\r\nimport { ActionFeedback } from '../../../../components/StatusMessage.tsx'\r\nimport { useForm } from '../../../../hooks/useForm.ts'\r\nimport type { EventColor } from '../../../../utils/event.ts'\r\nimport { useCalendars } from '../../hooks/useCalendars.ts'\r\nimport type { CalendarSummary } from '../../types/calendar.ts'\r\nimport { validateDetails } from '../../utils/draft.ts'\r\nimport { hasPermission, isPersonalCalendar } from '../../utils/permissions.ts'\r\nimport { CalendarPreview } from '../CalendarPreview.tsx'\r\nimport { ColorStep } from '../create/ColorStep.tsx'\r\nimport { DetailsStep } from '../create/DetailsStep.tsx'\r\n\r\ntype GeneralValues = { name: string; description: string; color: EventColor }\r\n\r\nexport function GeneralSection({ calendar }: { calendar: CalendarSummary }) {\r\n const { m } = useI18n()\r\n const { general } = m.calendars\r\n const { updateCalendar, updateTeam } = useCalendars()\r\n const isTeam = !isPersonalCalendar(calendar)\r\n const canEditCalendar = hasPermission(calendar, 'manage_calendars')\r\n const canEditTeam = isTeam && hasPermission(calendar, 'manage_team')\r\n const { values, errors, setField, handleSubmit, isPending, isSuccess, error } = useForm<GeneralValues>({\r\n initialValues: { name: calendar.name, description: calendar.description, color: calendar.color },\r\n validate: (input) => validateDetails(input, m),\r\n prepare: (input) => ({ ...input, name: input.name.trim(), description: input.description.trim() }),\r\n onSubmit: async ({ name, description, color }) => {\r\n if (canEditCalendar && (name !== calendar.name || color !== calendar.color))\r\n await updateCalendar(calendar, { name, color })\r\n if (canEditTeam && (name !== calendar.teamName || description !== calendar.description))\r\n await updateTeam(calendar, { name, description })\r\n },\r\n })\r\n const isDirty =\r\n values.name.trim() !== calendar.name ||\r\n values.description.trim() !== calendar.description ||\r\n values.color !== calendar.color\r\n\r\n return (\r\n <PageSection\r\n title={general.title}\r\n description={isTeam ? general.teamDescription : general.personalDescription}\r\n >\r\n <Form onSubmit={handleSubmit}>\r\n {isTeam ? (\r\n <DetailsStep\r\n values={values}\r\n errors={errors}\r\n disabled={{ name: !canEditCalendar, description: !canEditTeam }}\r\n onChange={(changes) => {\r\n if (changes.name !== undefined) setField('name', changes.name)\r\n if (changes.description !== undefined) setField('description', changes.description)\r\n }}\r\n />\r\n ) : (\r\n <DetailsStep\r\n values={values}\r\n errors={errors}\r\n hideDescription\r\n disabled={{ name: !canEditCalendar }}\r\n onChange={({ name }) => name !== undefined && setField('name', name)}\r\n />\r\n )}\r\n {canEditCalendar ? (\r\n <ColorStep color={values.color} onChange={(color) => setField('color', color)} />\r\n ) : (\r\n <CalendarPreview color={values.color} />\r\n )}\r\n <ActionFeedback error={error} success={isSuccess && !isDirty && m.common.saved} />\r\n {(canEditCalendar || canEditTeam) && (\r\n <div className=\"formActions\">\r\n <Button type=\"submit\" isPending={isPending} pendingLabel={general.pending} disabled={!isDirty}>\r\n {m.common.save}\r\n </Button>\r\n </div>\r\n )}\r\n </Form>\r\n </PageSection>\r\n )\r\n}\r\n","import { useState } from 'react'\r\nimport { Button } from '../../../../components/Button.tsx'\r\nimport { ConfirmModal } from '../../../../components/ConfirmModal.tsx'\r\nimport { PageSection } from '../../../../components/PageSection.tsx'\r\nimport { ActionFeedback, ErrorMessage } from '../../../../components/StatusMessage.tsx'\r\nimport { useAsyncAction } from '../../../../hooks/useAsyncAction.ts'\r\nimport { useI18n } from '../../../../i18n/index.ts'\r\nimport type { CalendarSummary, TeamMember, TeamRole } from '../../types/calendar.ts'\r\nimport { getAssignableRoles, hasPermission, outranks } from '../../utils/permissions.ts'\r\n\r\ntype MembersSectionProps = {\r\n calendar: CalendarSummary\r\n members: readonly TeamMember[]\r\n error: string | null\r\n currentUserId: string | null\r\n onChangeRole: (userId: string, role: TeamRole) => Promise<void>\r\n onRemove: (userId: string) => Promise<void>\r\n}\r\n\r\ntype MemberRowProps = {\r\n member: TeamMember\r\n isSelf: boolean\r\n canManage: boolean\r\n roles: readonly TeamRole[]\r\n onChangeRole: (role: TeamRole) => Promise<void>\r\n onRemove: () => void\r\n}\r\n\r\nfunction MemberRow({ member, isSelf, canManage, roles, onChangeRole, onRemove }: MemberRowProps) {\r\n const { m } = useI18n()\r\n const { members: text, roles: roleLabels } = m.calendars\r\n const { run, isPending, error } = useAsyncAction(onChangeRole)\r\n const options = roles.includes(member.role) ? roles : [member.role, ...roles]\r\n\r\n return (\r\n <li className=\"itemRow memberRow\">\r\n <span className=\"itemRowMain\">\r\n <span className=\"itemRowTitle\">\r\n {member.name}\r\n {isSelf && text.you}\r\n </span>\r\n <span className=\"itemRowMeta\">{member.email}</span>\r\n <ActionFeedback error={error} />\r\n </span>\r\n {canManage ? (\r\n <>\r\n <select\r\n className=\"input memberRole\"\r\n aria-label={text.roleOf(member.name)}\r\n value={member.role}\r\n disabled={isPending}\r\n onChange={(event) => void run(event.target.value as TeamRole)}\r\n >\r\n {options.map((role) => (\r\n <option key={role} value={role}>\r\n {roleLabels[role]}\r\n </option>\r\n ))}\r\n </select>\r\n <Button variant=\"outline\" onClick={onRemove}>\r\n {text.remove}\r\n </Button>\r\n </>\r\n ) : (\r\n <span className=\"badge\">{roleLabels[member.role]}</span>\r\n )}\r\n </li>\r\n )\r\n}\r\n\r\nexport function MembersSection({\r\n calendar,\r\n members,\r\n error,\r\n currentUserId,\r\n onChangeRole,\r\n onRemove,\r\n}: MembersSectionProps) {\r\n const { m } = useI18n()\r\n const { members: text } = m.calendars\r\n const [memberToRemove, setMemberToRemove] = useState<TeamMember | null>(null)\r\n const canManageMembers = hasPermission(calendar, 'manage_members')\r\n const roles = getAssignableRoles(calendar.role)\r\n\r\n return (\r\n <PageSection\r\n title={text.title}\r\n description={text.description}\r\n >\r\n <ErrorMessage message={error} />\r\n <ul className=\"itemList\">\r\n {members.map((member) => {\r\n const isSelf = member.userId === currentUserId\r\n return (\r\n <MemberRow\r\n key={member.userId}\r\n member={member}\r\n isSelf={isSelf}\r\n canManage={canManageMembers && !isSelf && outranks(calendar.role, member.role)}\r\n roles={roles}\r\n onChangeRole={(role) => onChangeRole(member.userId, role)}\r\n onRemove={() => setMemberToRemove(member)}\r\n />\r\n )\r\n })}\r\n </ul>\r\n {memberToRemove && (\r\n <ConfirmModal\r\n title={text.removeTitle}\r\n confirmLabel={text.remove}\r\n pendingLabel={text.removing}\r\n onConfirm={async () => {\r\n await onRemove(memberToRemove.userId)\r\n setMemberToRemove(null)\r\n }}\r\n onClose={() => setMemberToRemove(null)}\r\n >\r\n {text.removeMessage(memberToRemove.name, calendar.name)}\r\n </ConfirmModal>\r\n )}\r\n </PageSection>\r\n )\r\n}\r\n","import { useState } from 'react'\r\nimport { Button } from '../../../../components/Button.tsx'\r\nimport { Form } from '../../../../components/Form.tsx'\r\nimport { PageSection } from '../../../../components/PageSection.tsx'\r\nimport { SelectField } from '../../../../components/SelectField.tsx'\r\nimport { ActionFeedback, ErrorMessage } from '../../../../components/StatusMessage.tsx'\r\nimport { TextField } from '../../../../components/TextField.tsx'\r\nimport { useAsyncAction } from '../../../../hooks/useAsyncAction.ts'\r\nimport { useI18n } from '../../../../i18n/index.ts'\r\nimport { toISODate } from '../../../../utils/date.ts'\r\nimport { EMAIL_MAX_LENGTH, normalizeEmail } from '../../../../utils/validation.ts'\r\nimport { DEFAULT_INVITATION_ROLE } from '../../constants/calendars.ts'\r\nimport type { CalendarSummary, InvitableRole, Invitation, TeamInvitation, TeamMember } from '../../types/calendar.ts'\r\nimport { validateInvitation } from '../../utils/draft.ts'\r\nimport { getInvitableRoles, outranks } from '../../utils/permissions.ts'\r\n\r\ntype TeamInvitationsSectionProps = {\r\n calendar: CalendarSummary\r\n invitations: readonly TeamInvitation[]\r\n members: readonly TeamMember[]\r\n error: string | null\r\n ownEmail: string | null\r\n onInvite: (invitation: Invitation) => Promise<void>\r\n onRevoke: (invitationId: string) => Promise<void>\r\n}\r\n\r\nfunction InvitationRow({\r\n invitation,\r\n canRevoke,\r\n onRevoke,\r\n}: {\r\n invitation: TeamInvitation\r\n canRevoke: boolean\r\n onRevoke: () => Promise<void>\r\n}) {\r\n const { m, format } = useI18n()\r\n const { teamInvitations: text, invitations, roles } = m.calendars\r\n const { run, isPending, error } = useAsyncAction(onRevoke)\r\n return (\r\n <li className=\"itemRow\">\r\n <span className=\"itemRowMain\">\r\n <span className=\"itemRowTitle\">{invitation.email}</span>\r\n <span className=\"itemRowMeta\">\r\n {roles[invitation.role]} · {invitations.validUntil(format.longDate(toISODate(new Date(invitation.expiresAt))))}\r\n </span>\r\n <ActionFeedback error={error} />\r\n </span>\r\n {canRevoke && (\r\n <Button variant=\"outline\" isPending={isPending} pendingLabel={text.revoking} onClick={() => void run()}>\r\n {text.revoke}\r\n </Button>\r\n )}\r\n </li>\r\n )\r\n}\r\n\r\nexport function TeamInvitationsSection({\r\n calendar,\r\n invitations,\r\n members,\r\n error,\r\n ownEmail,\r\n onInvite,\r\n onRevoke,\r\n}: TeamInvitationsSectionProps) {\r\n const { m } = useI18n()\r\n const { teamInvitations: text, invite, roles: roleLabels, roleDescriptions } = m.calendars\r\n const roles = getInvitableRoles(calendar.role)\r\n const [email, setEmail] = useState('')\r\n const [role, setRole] = useState<InvitableRole>(\r\n roles.includes(DEFAULT_INVITATION_ROLE) ? DEFAULT_INVITATION_ROLE : roles[0],\r\n )\r\n const [fieldError, setFieldError] = useState<string>()\r\n const [sentTo, setSentTo] = useState<string | null>(null)\r\n const send = useAsyncAction(async (invitation: Invitation) => {\r\n await onInvite(invitation)\r\n setSentTo(invitation.email)\r\n setEmail('')\r\n })\r\n\r\n const submit = () => {\r\n const invitation = { email: normalizeEmail(email), role }\r\n const memberError = members.some((member) => member.email === invitation.email)\r\n ? m.calendars.validation.alreadyMember\r\n : undefined\r\n const errors = validateInvitation(invitation, invitations, ownEmail, m)\r\n const message = memberError ?? errors.email\r\n setFieldError(message)\r\n setSentTo(null)\r\n if (!message) void send.run(invitation)\r\n }\r\n\r\n return (\r\n <PageSection\r\n title={text.title}\r\n description={text.description}\r\n >\r\n <Form\r\n onSubmit={(event) => {\r\n event.preventDefault()\r\n submit()\r\n }}\r\n >\r\n <div className=\"formRow inviteRow\">\r\n <TextField\r\n label={invite.email}\r\n name=\"inviteEmail\"\r\n type=\"email\"\r\n inputMode=\"email\"\r\n autoComplete=\"off\"\r\n maxLength={EMAIL_MAX_LENGTH}\r\n value={email}\r\n error={fieldError}\r\n onChange={(value) => {\r\n setEmail(value)\r\n setFieldError(undefined)\r\n }}\r\n />\r\n <SelectField\r\n label={invite.role}\r\n name=\"inviteRole\"\r\n value={role}\r\n options={roles.map((value) => ({ value, label: roleLabels[value] }))}\r\n onChange={setRole}\r\n />\r\n <Button type=\"submit\" className=\"inviteAdd\" isPending={send.isPending} pendingLabel={text.sending}>\r\n {text.submit}\r\n </Button>\r\n </div>\r\n <p className=\"formHint\">{m.calendars.roleHint(roleLabels[role], roleDescriptions[role])}</p>\r\n <ActionFeedback error={send.error} success={sentTo && text.sent(sentTo)} />\r\n </Form>\r\n\r\n <ErrorMessage message={error} />\r\n {invitations.length === 0 ? (\r\n <p className=\"emptyHint\">{text.none}</p>\r\n ) : (\r\n <ul className=\"itemList\">\r\n {invitations.map((invitation) => (\r\n <InvitationRow\r\n key={invitation.id}\r\n invitation={invitation}\r\n canRevoke={outranks(calendar.role, invitation.role)}\r\n onRevoke={() => onRevoke(invitation.id)}\r\n />\r\n ))}\r\n </ul>\r\n )}\r\n </PageSection>\r\n )\r\n}\r\n","import { useParams } from 'react-router'\r\nimport { useI18n } from '../../../../i18n/index.ts'\r\nimport { PageLayout } from '../../../../components/PageLayout.tsx'\r\nimport { PageSection } from '../../../../components/PageSection.tsx'\r\nimport { Switch } from '../../../../components/Switch.tsx'\r\nimport { Tabs, type TabDefinition } from '../../../../components/Tabs.tsx'\r\nimport { ActionFeedback } from '../../../../components/StatusMessage.tsx'\r\nimport { SETTINGS_CALENDARS_PATH } from '../../../../config/routes.ts'\r\nimport { useAsyncAction } from '../../../../hooks/useAsyncAction.ts'\r\nimport { useTabParam } from '../../../../hooks/useTabParam.ts'\r\nimport { useAuth } from '../../../authorization/index.ts'\r\nimport { useCalendars } from '../../hooks/useCalendars.ts'\r\nimport { useTeam } from '../../hooks/useTeam.ts'\r\nimport type { CalendarSummary } from '../../types/calendar.ts'\r\nimport { hasPermission, isPersonalCalendar } from '../../utils/permissions.ts'\r\nimport { DangerSection } from './DangerSection.tsx'\r\nimport { GeneralSection } from './GeneralSection.tsx'\r\nimport { MembersSection } from './MembersSection.tsx'\r\nimport { TeamInvitationsSection } from './TeamInvitationsSection.tsx'\r\n\r\nfunction DisplaySection({ calendar }: { calendar: CalendarSummary }) {\r\n const { m } = useI18n()\r\n const { setShowInPersonal } = useCalendars()\r\n const { run, error } = useAsyncAction(setShowInPersonal)\r\n return (\r\n <PageSection title={m.calendars.settings.displayTitle} description={m.calendars.settings.displayDescription}>\r\n <Switch\r\n label={m.calendars.list.showInPersonal}\r\n checked={calendar.showInPersonal}\r\n onChange={(checked) => void run(calendar.id, checked)}\r\n />\r\n <ActionFeedback error={error} />\r\n </PageSection>\r\n )\r\n}\r\n\r\ntype TeamTab = 'general' | 'members' | 'invitations' | 'danger'\r\n\r\nfunction TeamSettings({ calendar }: { calendar: CalendarSummary }) {\r\n const { m } = useI18n()\r\n const { settings } = m.calendars\r\n const { withCount } = settings\r\n const { user } = useAuth()\r\n const team = useTeam(calendar)\r\n const tabs: TabDefinition<TeamTab>[] = [\r\n {\r\n value: 'general',\r\n label: settings.tabs.general,\r\n content: (\r\n <>\r\n <GeneralSection calendar={calendar} />\r\n <DisplaySection calendar={calendar} />\r\n </>\r\n ),\r\n },\r\n {\r\n value: 'members',\r\n label: withCount(settings.tabs.members, team.members.length),\r\n content: (\r\n <MembersSection\r\n calendar={calendar}\r\n members={team.members}\r\n error={team.membersError}\r\n currentUserId={user?.id ?? null}\r\n onChangeRole={team.changeRole}\r\n onRemove={team.removeMember}\r\n />\r\n ),\r\n },\r\n ...(hasPermission(calendar, 'invite_members')\r\n ? [\r\n {\r\n value: 'invitations' as const,\r\n label: withCount(settings.tabs.invitations, team.invitations.length),\r\n content: (\r\n <TeamInvitationsSection\r\n calendar={calendar}\r\n invitations={team.invitations}\r\n members={team.members}\r\n error={team.invitationsError}\r\n ownEmail={user?.email ?? null}\r\n onInvite={team.invite}\r\n onRevoke={team.revokeInvitation}\r\n />\r\n ),\r\n },\r\n ]\r\n : []),\r\n {\r\n value: 'danger',\r\n label: settings.tabs.danger,\r\n content: (\r\n <DangerSection\r\n calendar={calendar}\r\n members={team.members}\r\n currentUserId={user?.id ?? null}\r\n onOwnershipTransferred={team.reloadMembers}\r\n />\r\n ),\r\n },\r\n ]\r\n const [active, select] = useTabParam(tabs)\r\n\r\n return <Tabs label={settings.tabsLabel} tabs={tabs} value={active} onChange={select} />\r\n}\r\n\r\nexport function CalendarSettingsPage() {\r\n const { m } = useI18n()\r\n const { settings } = m.calendars\r\n const back = { to: SETTINGS_CALENDARS_PATH, label: m.common.backToSettings }\r\n const { calendarId } = useParams()\r\n const { calendars, isLoading } = useCalendars()\r\n const calendar = calendars.find((entry) => entry.id === calendarId)\r\n\r\n if (!calendar)\r\n return (\r\n <PageLayout title={settings.title} back={back} variant=\"full\">\r\n <p className=\"emptyHint\">{isLoading ? m.common.loading : settings.notFound}</p>\r\n </PageLayout>\r\n )\r\n\r\n return (\r\n <PageLayout title={settings.pageTitle(calendar.name)} back={back} variant=\"full\">\r\n {isPersonalCalendar(calendar) ? (\r\n <>\r\n <GeneralSection calendar={calendar} />\r\n <PageSection title={settings.personalTitle}>\r\n <p className=\"formHint\">{settings.personalHint}</p>\r\n </PageSection>\r\n </>\r\n ) : (\r\n <TeamSettings calendar={calendar} />\r\n )}\r\n </PageLayout>\r\n )\r\n}\r\n","import { useI18n } from '../i18n/index.ts'\r\nimport { classNames } from '../utils/classNames.ts'\r\n\r\ntype StepperProps = {\r\n steps: readonly { label: string }[]\r\n current: number\r\n onSelect?: (index: number) => void\r\n}\r\n\r\nconst getState = (index: number, current: number) =>\r\n index < current ? 'done' : index === current ? 'current' : 'upcoming'\r\n\r\nexport function Stepper({ steps, current, onSelect }: StepperProps) {\r\n const { m } = useI18n()\r\n return (\r\n <ol className=\"stepper\" aria-label={m.common.progress}>\r\n {steps.map((step, index) => {\r\n const state = getState(index, current)\r\n const content = (\r\n <>\r\n <span className=\"stepNumber\" aria-hidden=\"true\">\r\n {state === 'done' ? '✓' : index + 1}\r\n </span>\r\n <span className=\"stepLabel\">{step.label}</span>\r\n </>\r\n )\r\n return (\r\n <li\r\n key={step.label}\r\n className={classNames('step', `step--${state}`)}\r\n aria-current={state === 'current' ? 'step' : undefined}\r\n >\r\n {onSelect && state === 'done' ? (\r\n <button type=\"button\" className=\"stepContent\" onClick={() => onSelect(index)}>\r\n {content}\r\n </button>\r\n ) : (\r\n <span className=\"stepContent\">{content}</span>\r\n )}\r\n </li>\r\n )\r\n })}\r\n </ol>\r\n )\r\n}\r\n","import { useState } from 'react'\r\nimport { Button } from '../../../../components/Button.tsx'\r\nimport { IconButton } from '../../../../components/IconButton.tsx'\r\nimport { SelectField } from '../../../../components/SelectField.tsx'\r\nimport { TextField } from '../../../../components/TextField.tsx'\r\nimport { normalizeEmail, EMAIL_MAX_LENGTH } from '../../../../utils/validation.ts'\r\nimport { useI18n } from '../../../../i18n/index.ts'\r\nimport { DEFAULT_INVITATION_ROLE, INVITABLE_ROLES } from '../../constants/calendars.ts'\r\nimport type { InvitableRole, Invitation } from '../../types/calendar.ts'\r\nimport { validateInvitation } from '../../utils/draft.ts'\r\n\r\ntype MembersStepProps = {\r\n invitations: readonly Invitation[]\r\n ownEmail: string | null\r\n onChange: (invitations: Invitation[]) => void\r\n}\r\n\r\nexport function MembersStep({ invitations, ownEmail, onChange }: MembersStepProps) {\r\n const { m } = useI18n()\r\n const { invite, roles, roleDescriptions } = m.calendars\r\n const roleOptions = INVITABLE_ROLES.map((value) => ({ value, label: roles[value] }))\r\n const [email, setEmail] = useState('')\r\n const [role, setRole] = useState<InvitableRole>(DEFAULT_INVITATION_ROLE)\r\n const [error, setError] = useState<string>()\r\n\r\n const add = () => {\r\n const invitation = { email: normalizeEmail(email), role }\r\n const errors = validateInvitation(invitation, invitations, ownEmail, m)\r\n setError(errors.email)\r\n if (errors.email) return\r\n onChange([...invitations, invitation])\r\n setEmail('')\r\n }\r\n\r\n return (\r\n <>\r\n <div className=\"formRow inviteRow\">\r\n <TextField\r\n label={invite.email}\r\n name=\"inviteEmail\"\r\n type=\"email\"\r\n inputMode=\"email\"\r\n autoComplete=\"off\"\r\n maxLength={EMAIL_MAX_LENGTH}\r\n value={email}\r\n error={error}\r\n onChange={(value) => {\r\n setEmail(value)\r\n setError(undefined)\r\n }}\r\n onKeyDown={(event) => {\r\n if (event.key !== 'Enter') return\r\n event.preventDefault()\r\n add()\r\n }}\r\n />\r\n <SelectField label={invite.role} name=\"inviteRole\" value={role} options={roleOptions} onChange={setRole} />\r\n <Button variant=\"outline\" className=\"inviteAdd\" onClick={add}>\r\n {invite.add}\r\n </Button>\r\n </div>\r\n <p className=\"formHint\">{m.calendars.roleHint(roles[role], roleDescriptions[role])}</p>\r\n\r\n {invitations.length === 0 ? (\r\n <p className=\"emptyHint\">{invite.nobodyYet}</p>\r\n ) : (\r\n <ul className=\"itemList\">\r\n {invitations.map((invitation) => (\r\n <li key={invitation.email} className=\"itemRow\">\r\n <span className=\"itemRowMain\">\r\n <span className=\"itemRowTitle\">{invitation.email}</span>\r\n <span className=\"itemRowMeta\">{roles[invitation.role]}</span>\r\n </span>\r\n <IconButton\r\n label={invite.remove(invitation.email)}\r\n plain\r\n onClick={() => onChange(invitations.filter((entry) => entry.email !== invitation.email))}\r\n >\r\n ×\r\n </IconButton>\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n </>\r\n )\r\n}\r\n","import { useI18n } from '../../../../i18n/index.ts'\r\nimport type { CalendarDraft } from '../../types/calendar.ts'\r\nimport { CalendarPreview } from '../CalendarPreview.tsx'\r\n\r\nexport function ReviewStep({ draft }: { draft: CalendarDraft }) {\r\n const { m } = useI18n()\r\n const { details, roles } = m.calendars\r\n return (\r\n <div className=\"wizardSplit\">\r\n <dl className=\"summaryList\">\r\n <dt>{details.name}</dt>\r\n <dd>{draft.name.trim()}</dd>\r\n <dt>{details.description}</dt>\r\n <dd>{draft.description.trim() || '–'}</dd>\r\n <dt>{details.yourRole}</dt>\r\n <dd>{roles.owner}</dd>\r\n <dt>{details.invitations}</dt>\r\n <dd>\r\n {draft.invitations.length === 0 ? (\r\n details.none\r\n ) : (\r\n <ul className=\"summaryInvitations\">\r\n {draft.invitations.map((invitation) => (\r\n <li key={invitation.email}>\r\n {invitation.email} <span className=\"itemRowMeta\">· {roles[invitation.role]}</span>\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n </dd>\r\n </dl>\r\n <CalendarPreview color={draft.color} />\r\n </div>\r\n )\r\n}\r\n","import { useState, type SubmitEventHandler } from 'react'\r\nimport { useNavigate } from 'react-router'\r\nimport { useI18n } from '../../../../i18n/index.ts'\r\nimport { Button } from '../../../../components/Button.tsx'\r\nimport { Form } from '../../../../components/Form.tsx'\r\nimport { PageLayout } from '../../../../components/PageLayout.tsx'\r\nimport { ActionFeedback } from '../../../../components/StatusMessage.tsx'\r\nimport { Stepper } from '../../../../components/Stepper.tsx'\r\nimport { ROUTES } from '../../../../config/routes.ts'\r\nimport { useAsyncAction } from '../../../../hooks/useAsyncAction.ts'\r\nimport { hasFieldErrors, type FieldErrors } from '../../../../utils/validation.ts'\r\nimport { useAuth } from '../../../authorization/index.ts'\r\nimport { EMPTY_CALENDAR_DRAFT } from '../../constants/calendars.ts'\r\nimport { useCalendars } from '../../hooks/useCalendars.ts'\r\nimport type { CalendarDraft } from '../../types/calendar.ts'\r\nimport { validateDetails, type DetailsValues } from '../../utils/draft.ts'\r\nimport { ColorStep } from './ColorStep.tsx'\r\nimport { DetailsStep } from './DetailsStep.tsx'\r\nimport { MembersStep } from './MembersStep.tsx'\r\nimport { ReviewStep } from './ReviewStep.tsx'\r\n\r\nexport function CreateCalendarPage() {\r\n const { m } = useI18n()\r\n const { create: text } = m.calendars\r\n const steps = text.steps\r\n const lastStep = steps.length - 1\r\n const { user } = useAuth()\r\n const { createCalendar, selectCalendar } = useCalendars()\r\n const navigate = useNavigate()\r\n const [step, setStep] = useState(0)\r\n const [draft, setDraft] = useState<CalendarDraft>(EMPTY_CALENDAR_DRAFT)\r\n const [detailErrors, setDetailErrors] = useState<FieldErrors<DetailsValues>>({})\r\n const {\r\n run: create,\r\n isPending,\r\n error,\r\n } = useAsyncAction(async () => {\r\n const calendar = await createCalendar(draft)\r\n selectCalendar(calendar.id)\r\n await navigate(ROUTES.calendar)\r\n })\r\n\r\n const update = (changes: Partial<CalendarDraft>) => setDraft((current) => ({ ...current, ...changes }))\r\n\r\n const handleSubmit: SubmitEventHandler<HTMLFormElement> = (event) => {\r\n event.preventDefault()\r\n if (step === 0) {\r\n const errors = validateDetails(draft, m)\r\n setDetailErrors(errors)\r\n if (hasFieldErrors(errors)) return\r\n }\r\n if (step === lastStep) void create()\r\n else setStep(step + 1)\r\n }\r\n\r\n const renderStep = () => {\r\n switch (step) {\r\n case 0:\r\n return (\r\n <DetailsStep\r\n autoFocus\r\n values={draft}\r\n errors={detailErrors}\r\n onChange={(changes) => {\r\n update(changes)\r\n setDetailErrors({})\r\n }}\r\n />\r\n )\r\n case 1:\r\n return <ColorStep color={draft.color} onChange={(color) => update({ color })} />\r\n case 2:\r\n return (\r\n <MembersStep\r\n invitations={draft.invitations}\r\n ownEmail={user?.email ?? null}\r\n onChange={(invitations) => update({ invitations })}\r\n />\r\n )\r\n default:\r\n return <ReviewStep draft={draft} />\r\n }\r\n }\r\n\r\n const { title, hint } = steps[step]\r\n\r\n return (\r\n <PageLayout title={text.title} variant=\"full\">\r\n <div className=\"wizard\">\r\n <Stepper steps={steps} current={step} onSelect={setStep} />\r\n <Form onSubmit={handleSubmit} className=\"wizardPanel\">\r\n <header className=\"wizardHeader\">\r\n <p className=\"wizardStepCount\">{text.stepCount(step + 1, steps.length)}</p>\r\n <h2 className=\"wizardTitle\">{title}</h2>\r\n <p className=\"formHint\">{hint}</p>\r\n </header>\r\n {renderStep()}\r\n <ActionFeedback error={error} />\r\n <div className=\"wizardActions\">\r\n {step > 0 && (\r\n <Button variant=\"secondary\" onClick={() => setStep(step - 1)}>\r\n {m.common.back}\r\n </Button>\r\n )}\r\n <Button type=\"submit\" isPending={isPending} pendingLabel={text.pending}>\r\n {step === lastStep ? text.submit : text.next}\r\n </Button>\r\n </div>\r\n </Form>\r\n </div>\r\n </PageLayout>\r\n )\r\n}\r\n","import { useState, type ReactNode } from 'react'\r\nimport { Link } from 'react-router'\r\nimport { PlusIcon } from '../../../components/Icons.tsx'\r\nimport { ROUTES, SETTINGS_CALENDARS_PATH } from '../../../config/routes.ts'\r\nimport { getDistinctTeamName, isPersonalCalendar } from '../utils/permissions.ts'\r\nimport { Button } from '../../../components/Button.tsx'\r\nimport { Modal } from '../../../components/Modal.tsx'\r\nimport { classNames } from '../../../utils/classNames.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { useCalendars } from '../hooks/useCalendars.ts'\r\nimport type { CalendarSummary } from '../types/calendar.ts'\r\nimport { CalendarPreview } from './CalendarPreview.tsx'\r\n\r\ntype CalendarCardProps = {\r\n calendar: CalendarSummary\r\n isActive: boolean\r\n onSelect: () => void\r\n}\r\n\r\nfunction CalendarCard({ calendar, isActive, onSelect }: CalendarCardProps) {\r\n const { m } = useI18n()\r\n return (\r\n <li>\r\n <button\r\n type=\"button\"\r\n className={classNames('calendarCard', isActive && 'active')}\r\n aria-current={isActive}\r\n onClick={onSelect}\r\n >\r\n <CalendarPreview color={calendar.color} />\r\n <span className=\"calendarCardInfo\">\r\n <span className=\"calendarCardName\">{calendar.name}</span>\r\n <span className=\"calendarCardMeta\">\r\n {[getDistinctTeamName(calendar), m.calendars.roles[calendar.role]].filter(Boolean).join(' · ')}\r\n </span>\r\n </span>\r\n {isActive && (\r\n <span className=\"calendarCardBadge\" aria-label={m.calendars.switcher.active}>\r\n ✓\r\n </span>\r\n )}\r\n </button>\r\n </li>\r\n )\r\n}\r\n\r\nfunction CalendarSwitcherModal({ onClose }: { onClose: () => void }) {\r\n const { m } = useI18n()\r\n const { switcher } = m.calendars\r\n const { calendars, invitations, activeCalendar, selectCalendar } = useCalendars()\r\n const personal = calendars.filter(isPersonalCalendar)\r\n const teams = calendars.filter((calendar) => !isPersonalCalendar(calendar))\r\n\r\n const renderCards = (list: readonly CalendarSummary[], extra?: ReactNode) => (\r\n <ul className=\"calendarCards\">\r\n {list.map((calendar) => (\r\n <CalendarCard\r\n key={calendar.id}\r\n calendar={calendar}\r\n isActive={calendar.id === activeCalendar.id}\r\n onSelect={() => {\r\n selectCalendar(calendar.id)\r\n onClose()\r\n }}\r\n />\r\n ))}\r\n {extra}\r\n </ul>\r\n )\r\n\r\n return (\r\n <Modal title={switcher.title} size=\"large\" onClose={onClose}>\r\n <div className=\"formSection\">\r\n <section className=\"calendarGroup\">\r\n <h3 className=\"calendarGroupTitle\">{switcher.personal}</h3>\r\n {renderCards(personal)}\r\n </section>\r\n {invitations.length > 0 && (\r\n <p className=\"formHint\">\r\n {switcher.openInvitations(invitations.length)}{' '}\r\n <Link to={SETTINGS_CALENDARS_PATH} onClick={onClose}>\r\n {switcher.view}\r\n </Link>\r\n </p>\r\n )}\r\n <section className=\"calendarGroup\">\r\n <h3 className=\"calendarGroupTitle\">{switcher.teams}</h3>\r\n {teams.length === 0 && (\r\n <p className=\"emptyHint\">{switcher.noTeams}</p>\r\n )}\r\n {renderCards(\r\n teams,\r\n <li>\r\n <Link to={ROUTES.createCalendar} className=\"calendarCard calendarCardNew\">\r\n <PlusIcon size={28} />\r\n <span className=\"calendarCardName\">{switcher.newCalendar}</span>\r\n </Link>\r\n </li>,\r\n )}\r\n </section>\r\n </div>\r\n </Modal>\r\n )\r\n}\r\n\r\nexport function CalendarSwitcher() {\r\n const { m } = useI18n()\r\n const [isOpen, setIsOpen] = useState(false)\r\n return (\r\n <>\r\n <Button variant=\"outline\" block onClick={() => setIsOpen(true)}>\r\n {m.calendars.switcher.open}\r\n </Button>\r\n {isOpen && <CalendarSwitcherModal onClose={() => setIsOpen(false)} />}\r\n </>\r\n )\r\n}\r\n","import { getEventColorAttributes } from '../../../utils/event.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { useCalendars } from '../hooks/useCalendars.ts'\r\nimport { isPersonalCalendar } from '../utils/permissions.ts'\r\n\r\nexport function ActiveCalendarIndicator() {\r\n const { m } = useI18n()\r\n const { activeCalendar } = useCalendars()\r\n const { indicator, roles } = m.calendars\r\n const meta = isPersonalCalendar(activeCalendar) ? indicator.onlyYou : indicator.team(roles[activeCalendar.role])\r\n\r\n return (\r\n <p\r\n {...getEventColorAttributes(activeCalendar.color, 'activeCalendar')}\r\n aria-label={indicator.current(activeCalendar.name)}\r\n >\r\n <span className=\"activeCalendarDot\" aria-hidden=\"true\" />\r\n <span className=\"activeCalendarName\">{activeCalendar.name}</span>\r\n <span className=\"activeCalendarMeta\">{meta}</span>\r\n </p>\r\n )\r\n}\r\n","import { AppError } from '../../../utils/appError.ts'\r\nimport { PERSONAL_CALENDAR } from '../constants/calendars.ts'\r\nimport type { CalendarRepository } from '../types/calendar.ts'\r\n\r\nconst requireAccount = async (): Promise<never> => {\r\n throw new AppError('accountRequired')\r\n}\r\n\r\nexport class LocalCalendarRepository implements CalendarRepository {\r\n async list() {\r\n return [PERSONAL_CALENDAR]\r\n }\r\n\r\n async listInvitations() {\r\n return []\r\n }\r\n\r\n create = requireAccount\r\n leave = requireAccount\r\n setShowInPersonal = requireAccount\r\n acceptInvitation = requireAccount\r\n declineInvitation = requireAccount\r\n updateCalendar = requireAccount\r\n updateTeam = requireAccount\r\n deleteTeam = requireAccount\r\n transferOwnership = requireAccount\r\n listMembers = requireAccount\r\n changeMemberRole = requireAccount\r\n removeMember = requireAccount\r\n listTeamInvitations = requireAccount\r\n invite = requireAccount\r\n revokeInvitation = requireAccount\r\n}\r\n","import { encodePathSegment, type ApiClient } from '../../../utils/api.ts'\r\nimport type {\r\n CalendarChanges,\r\n CalendarDraft,\r\n CalendarRepository,\r\n CalendarSummary,\r\n Invitation,\r\n PendingInvitation,\r\n TeamChanges,\r\n TeamInvitation,\r\n TeamMember,\r\n TeamRole,\r\n} from '../types/calendar.ts'\r\n\r\nconst segment = encodePathSegment\r\n\r\nconst teamPath = (teamId: string, ...rest: string[]) =>\r\n ['/teams', teamId, ...rest].map((part, index) => (index === 0 ? part : segment(part))).join('/')\r\n\r\nexport class RemoteCalendarRepository implements CalendarRepository {\r\n readonly #api: ApiClient\r\n\r\n constructor(api: ApiClient) {\r\n this.#api = api\r\n }\r\n\r\n list() {\r\n return this.#api.get<CalendarSummary[]>('/calendars')\r\n }\r\n\r\n create({ name, description, color, invitations }: CalendarDraft) {\r\n return this.#api.post<CalendarSummary>('/calendars', { name, description, color, invitations })\r\n }\r\n\r\n leave(teamId: string) {\r\n return this.#api.delete(teamPath(teamId, 'membership'))\r\n }\r\n\r\n updateCalendar(calendarId: string, changes: CalendarChanges) {\r\n return this.#api.patch<CalendarSummary>(`/calendars/${segment(calendarId)}`, changes)\r\n }\r\n\r\n updateTeam(teamId: string, changes: TeamChanges) {\r\n return this.#api.patch<CalendarSummary[]>(teamPath(teamId), changes)\r\n }\r\n\r\n deleteTeam(teamId: string) {\r\n return this.#api.delete(teamPath(teamId))\r\n }\r\n\r\n transferOwnership(teamId: string, userId: string) {\r\n return this.#api.post<CalendarSummary[]>(teamPath(teamId, 'transfer-ownership'), { userId })\r\n }\r\n\r\n listMembers(teamId: string) {\r\n return this.#api.get<TeamMember[]>(teamPath(teamId, 'members'))\r\n }\r\n\r\n changeMemberRole(teamId: string, userId: string, role: TeamRole) {\r\n return this.#api.patch<TeamMember>(teamPath(teamId, 'members', userId), { role })\r\n }\r\n\r\n removeMember(teamId: string, userId: string) {\r\n return this.#api.delete(teamPath(teamId, 'members', userId))\r\n }\r\n\r\n listTeamInvitations(teamId: string) {\r\n return this.#api.get<TeamInvitation[]>(teamPath(teamId, 'invitations'))\r\n }\r\n\r\n invite(teamId: string, invitation: Invitation) {\r\n return this.#api.post<TeamInvitation>(teamPath(teamId, 'invitations'), invitation)\r\n }\r\n\r\n revokeInvitation(teamId: string, invitationId: string) {\r\n return this.#api.delete(teamPath(teamId, 'invitations', invitationId))\r\n }\r\n\r\n setShowInPersonal(calendarId: string, showInPersonal: boolean) {\r\n return this.#api.put<CalendarSummary>(`/calendars/${segment(calendarId)}/settings`, { showInPersonal })\r\n }\r\n\r\n listInvitations() {\r\n return this.#api.get<PendingInvitation[]>('/invitations')\r\n }\r\n\r\n acceptInvitation(id: string) {\r\n return this.#api.post<CalendarSummary[]>(`/invitations/${segment(id)}/accept`)\r\n }\r\n\r\n declineInvitation(id: string) {\r\n return this.#api.post<void>(`/invitations/${segment(id)}/decline`)\r\n }\r\n}\r\n","import { LocalCalendarRepository } from '../features/calendars/index.ts'\r\nimport { LocalColorRepository, LocalEventRepository, LocalPreferencesRepository } from '../features/storage/index.ts'\r\nimport type { CalendarDataSource, DataRepositories } from './types.ts'\r\n\r\nexport const createLocalRepositories = (): DataRepositories => ({\r\n mode: 'local',\r\n events: new LocalEventRepository(),\r\n calendars: new LocalCalendarRepository(),\r\n colors: new LocalColorRepository(),\r\n preferences: new LocalPreferencesRepository(),\r\n})\r\n\r\nexport const localDataSource = (): CalendarDataSource => ({ connect: createLocalRepositories })\r\n","import {\r\n HostTokenAuthRepository,\r\n RemoteAuthRepository,\r\n type UserTokenProvider,\r\n} from '../features/authorization/index.ts'\r\nimport { RemoteCalendarRepository } from '../features/calendars/index.ts'\r\nimport { RemoteColorRepository, RemoteEventRepository, RemotePreferencesRepository } from '../features/storage/index.ts'\r\nimport { createApiClient } from '../utils/api.ts'\r\nimport { createLocalRepositories } from './localDataSource.ts'\r\nimport type { CalendarDataSource, DataRepositories, DataSourceContext } from './types.ts'\r\n\r\nexport type RestDataSourceOptions = {\r\n baseUrl: string\r\n timeoutMs?: number\r\n auth?: boolean\r\n headers?: HeadersInit\r\n getAccessToken?: () => string | null\r\n getUserToken?: UserTokenProvider\r\n}\r\n\r\nexport function restDataSource({\r\n baseUrl,\r\n timeoutMs,\r\n auth = true,\r\n headers,\r\n getAccessToken,\r\n getUserToken,\r\n}: RestDataSourceOptions): CalendarDataSource {\r\n const normalizedBaseUrl = baseUrl.replace(/\\/+$/, '')\r\n const createApi = ({ getLanguage, onUnauthorized }: Partial<DataSourceContext>) =>\r\n createApiClient({ baseUrl: normalizedBaseUrl, timeoutMs, headers, getAccessToken, getLanguage, onUnauthorized })\r\n\r\n const createRemoteRepositories = (context: DataSourceContext): DataRepositories => {\r\n const api = createApi(context)\r\n return {\r\n mode: 'remote',\r\n events: new RemoteEventRepository(api),\r\n calendars: new RemoteCalendarRepository(api),\r\n colors: new RemoteColorRepository(api),\r\n preferences: new RemotePreferencesRepository(api),\r\n }\r\n }\r\n\r\n return {\r\n createAuthRepository: !auth\r\n ? undefined\r\n : getUserToken\r\n ? (context) => new HostTokenAuthRepository(createApi(context), getUserToken)\r\n : (context) => new RemoteAuthRepository(createApi(context)),\r\n connect: (session, context) =>\r\n auth && !session.isAuthenticated ? createLocalRepositories() : createRemoteRepositories(context),\r\n }\r\n}\r\n","import type { UserTokenProvider } from '../features/authorization/index.ts'\r\nimport { restDataSource } from './restDataSource.ts'\r\nimport type { CalendarDataSource } from './types.ts'\r\n\r\nexport const TENANT_HEADER = 'X-Calendar-Tenant'\r\n\r\nexport type TenantDataSourceOptions = {\r\n tenant: string\r\n baseUrl: string\r\n timeoutMs?: number\r\n getUserToken?: UserTokenProvider\r\n}\r\n\r\nexport const tenantDataSource = ({ tenant, baseUrl, timeoutMs, getUserToken }: TenantDataSourceOptions): CalendarDataSource =>\r\n restDataSource({ baseUrl, timeoutMs, auth: true, headers: { [TENANT_HEADER]: tenant }, getUserToken })\r\n","import { createContext } from 'react'\r\nimport type { Preferences } from '../../../utils/preferences.ts'\r\n\r\nexport type PreferencesContextValue = {\r\n preferences: Preferences\r\n updatePreferences: (changes: Partial<Preferences>) => Promise<void>\r\n}\r\n\r\nexport const PreferencesContext = createContext<PreferencesContextValue | null>(null)\r\n","import { useCallback, useEffect, useMemo, type ReactNode } from 'react'\r\nimport { useHost } from '../../../context/HostContext.ts'\r\nimport { useRootElement } from '../../../context/RootElementContext.ts'\r\nimport { useI18n } from '../../../i18n/index.ts'\r\nimport { useAsyncResource } from '../../../hooks/useAsyncResource.ts'\r\nimport { DEFAULT_PREFERENCES, type Preferences, type Theme } from '../../../utils/preferences.ts'\r\nimport { usePreferencesRepository } from '../../storage/index.ts'\r\nimport { PreferencesContext, type PreferencesContextValue } from './PreferencesContext.ts'\r\n\r\nconst applyTheme = (root: HTMLElement, theme: Theme | undefined) => {\r\n if (!theme || theme === 'system') delete root.dataset.theme\r\n else root.dataset.theme = theme\r\n}\r\n\r\nexport function PreferencesProvider({ children }: { children: ReactNode }) {\r\n const root = useRootElement()\r\n const { theme: hostTheme } = useHost()\r\n const { setUserLocale } = useI18n()\r\n const repository = usePreferencesRepository()\r\n const load = useCallback(() => repository.get(), [repository])\r\n const { data: preferences, isLoading, apply } = useAsyncResource(load, DEFAULT_PREFERENCES)\r\n\r\n const theme = preferences.theme === 'system' ? hostTheme : preferences.theme\r\n useEffect(() => applyTheme(root, theme), [root, theme])\r\n\r\n useEffect(() => {\r\n setUserLocale(preferences.locale)\r\n return () => setUserLocale(null)\r\n }, [setUserLocale, preferences.locale])\r\n\r\n const updatePreferences = useCallback(\r\n async (changes: Partial<Preferences>) => {\r\n await apply(repository.update(changes))\r\n },\r\n [repository, apply],\r\n )\r\n\r\n const value = useMemo<PreferencesContextValue>(\r\n () => ({ preferences, updatePreferences }),\r\n [preferences, updatePreferences],\r\n )\r\n\r\n if (isLoading) return null\r\n return <PreferencesContext value={value}>{children}</PreferencesContext>\r\n}\r\n","import { useRequiredContext } from '../../../hooks/useRequiredContext.ts'\r\nimport { PreferencesContext } from '../context/PreferencesContext.ts'\r\n\r\nexport const usePreferences = () => useRequiredContext(PreferencesContext, 'PreferencesProvider')\r\n","import { FormField } from './FormField.tsx'\r\nimport { SegmentedControl } from './SegmentedControl.tsx'\r\n\r\ntype SegmentedFieldProps<T extends string> = {\r\n label: string\r\n value: T\r\n options: readonly { value: T; label: string }[]\r\n onChange: (value: T) => void\r\n}\r\n\r\nexport function SegmentedField<T extends string>({ label, ...controlProps }: SegmentedFieldProps<T>) {\r\n return (\r\n <FormField as=\"fieldset\" label={label}>\r\n <SegmentedControl label={label} {...controlProps} />\r\n </FormField>\r\n )\r\n}\r\n","import { PageSection } from '../../../components/PageSection.tsx'\r\nimport { SegmentedField } from '../../../components/SegmentedField.tsx'\r\nimport { SelectField } from '../../../components/SelectField.tsx'\r\nimport { ErrorMessage } from '../../../components/StatusMessage.tsx'\r\nimport { useAsyncAction } from '../../../hooks/useAsyncAction.ts'\r\nimport { LOCALE_CHOICES, useI18n } from '../../../i18n/index.ts'\r\nimport { THEMES } from '../../../utils/preferences.ts'\r\nimport { getViewOptions } from '../../calendar/index.ts'\r\nimport { usePreferences } from '../hooks/usePreferences.ts'\r\n\r\nexport function PreferencesSettings() {\r\n const { m } = useI18n()\r\n const { preferences, updatePreferences } = usePreferences()\r\n const { run, error } = useAsyncAction(updatePreferences)\r\n const themeOptions = THEMES.map((theme) => ({ value: theme, label: m.themes[theme] }))\r\n const languageOptions = LOCALE_CHOICES.map((choice) => ({ value: choice, label: m.settings.languages[choice] }))\r\n const viewOptions = getViewOptions(m)\r\n\r\n return (\r\n <>\r\n <PageSection title={m.settings.languageTitle} description={m.settings.languageDescription}>\r\n <SelectField\r\n label={m.settings.languageLabel}\r\n name=\"language\"\r\n value={preferences.locale}\r\n options={languageOptions}\r\n onChange={(locale) => void run({ locale })}\r\n />\r\n </PageSection>\r\n\r\n <PageSection title={m.settings.themeTitle}>\r\n <SegmentedField\r\n label={m.settings.themeLabel}\r\n value={preferences.theme}\r\n options={themeOptions}\r\n onChange={(theme) => void run({ theme })}\r\n />\r\n </PageSection>\r\n\r\n <PageSection title={m.settings.startViewTitle} description={m.settings.startViewDescription}>\r\n <SegmentedField\r\n label={m.settings.desktop}\r\n value={preferences.defaultView}\r\n options={viewOptions}\r\n onChange={(defaultView) => void run({ defaultView })}\r\n />\r\n <SegmentedField\r\n label={m.settings.mobile}\r\n value={preferences.mobileDefaultView}\r\n options={viewOptions}\r\n onChange={(mobileDefaultView) => void run({ mobileDefaultView })}\r\n />\r\n </PageSection>\r\n\r\n <ErrorMessage message={error} />\r\n </>\r\n )\r\n}\r\n","import type { ReactNode } from 'react'\r\nimport { Navigate } from 'react-router'\r\nimport { ROUTES } from '../config/routes.ts'\r\nimport { useHost } from '../context/HostContext.ts'\r\n\r\nexport function TeamsGate({ children }: { children: ReactNode }) {\r\n const { teams } = useHost()\r\n return teams ? children : <Navigate to={ROUTES.settings} replace />\r\n}\r\n","import { useMemo } from 'react'\r\nimport { Link } from 'react-router'\r\nimport { SettingsIcon } from '../components/Icons.tsx'\r\nimport { ROUTES } from '../config/routes.ts'\r\nimport { AccountMenu, EmailVerificationBanner, useAuth } from '../features/authorization/index.ts'\r\nimport { Calendar } from '../features/calendar/index.ts'\r\nimport {\r\n ActiveCalendarIndicator,\r\n CalendarSwitcher,\r\n getSharedCalendars,\r\n hasPermission,\r\n useCalendars,\r\n} from '../features/calendars/index.ts'\r\nimport { usePreferences } from '../features/preferences/index.ts'\r\nimport { LocalImportPrompt } from '../features/storage/index.ts'\r\nimport { useI18n } from '../i18n/index.ts'\r\nimport { useHost } from '../context/HostContext.ts'\r\nimport { useRootElement } from '../context/RootElementContext.ts'\r\nimport { getStartView, isCompactWidth } from '../utils/preferences.ts'\r\n\r\nexport function CalendarPage() {\r\n const root = useRootElement()\r\n const host = useHost()\r\n const { enabled, method, user } = useAuth()\r\n const hasAccountMenu = enabled && (user !== null || method === 'password')\r\n const { preferences } = usePreferences()\r\n const { m } = useI18n()\r\n const { calendars, activeCalendar, visibleCalendarIds } = useCalendars()\r\n const eventSources = useMemo(\r\n () => new Map(getSharedCalendars(calendars, activeCalendar).map(({ id, name, color }) => [id, { name, color }])),\r\n [calendars, activeCalendar],\r\n )\r\n const initialView = host.initialView ?? getStartView(preferences, isCompactWidth(root.clientWidth))\r\n\r\n return (\r\n <div className=\"app\">\r\n <EmailVerificationBanner />\r\n <Calendar\r\n calendarIds={visibleCalendarIds}\r\n targetCalendarId={activeCalendar.id}\r\n canCreate={hasPermission(activeCalendar, 'create_entry')}\r\n eventSources={eventSources}\r\n initialView={initialView}\r\n headerContext={<ActiveCalendarIndicator />}\r\n headerAccessory={\r\n <>\r\n {!hasAccountMenu && (\r\n <Link to={ROUTES.settings} className=\"iconLink\" aria-label={m.common.settings} title={m.common.settings}>\r\n <SettingsIcon size={20} />\r\n </Link>\r\n )}\r\n <AccountMenu menuItems={host.teams ? <CalendarSwitcher /> : undefined} />\r\n </>\r\n }\r\n />\r\n {user && <LocalImportPrompt userId={user.id} />}\r\n </div>\r\n )\r\n}\r\n","import { PageLayout } from '../components/PageLayout.tsx'\r\nimport { Tabs, type TabDefinition } from '../components/Tabs.tsx'\r\nimport { useTabParam } from '../hooks/useTabParam.ts'\r\nimport { AccountSettings, useAuth } from '../features/authorization/index.ts'\r\nimport { CalendarSettings } from '../features/calendars/index.ts'\r\nimport { CustomColorSettings } from '../features/events/index.ts'\r\nimport { PreferencesSettings } from '../features/preferences/index.ts'\r\nimport { useI18n } from '../i18n/index.ts'\r\n\r\ntype SettingsTab = 'calendars' | 'appearance' | 'account'\r\n\r\nexport function SettingsPage() {\r\n const { m } = useI18n()\r\n const { enabled, method, user } = useAuth()\r\n const tabs: TabDefinition<SettingsTab>[] = [\r\n { value: 'calendars', label: m.settings.tabs.calendars, content: <CalendarSettings /> },\r\n {\r\n value: 'appearance',\r\n label: m.settings.tabs.appearance,\r\n content: (\r\n <>\r\n <PreferencesSettings />\r\n <CustomColorSettings />\r\n </>\r\n ),\r\n },\r\n ]\r\n if (enabled && user && method === 'password') tabs.push({ value: 'account', label: m.settings.tabs.account, content: <AccountSettings /> })\r\n const [active, select] = useTabParam(tabs)\r\n\r\n return (\r\n <PageLayout title={m.common.settings} variant=\"full\">\r\n <Tabs label={m.settings.tabsLabel} tabs={tabs} value={active} onChange={select} />\r\n </PageLayout>\r\n )\r\n}\r\n","import type { ReactNode } from 'react'\r\nimport { createBrowserRouter, createMemoryRouter, Navigate, type RouteObject } from 'react-router'\r\nimport type { CalendarRouting } from './lib/config.ts'\r\nimport { TeamsGate } from './components/TeamsGate.tsx'\r\nimport { ROUTES } from './config/routes.ts'\r\nimport {\r\n AuthGate,\r\n ForgotPasswordPage,\r\n LoginPage,\r\n RegisterPage,\r\n ResetPasswordPage,\r\n VerifyEmailPage,\r\n} from './features/authorization/index.ts'\r\nimport { CalendarSettingsPage, CreateCalendarPage } from './features/calendars/index.ts'\r\nimport { CalendarPage } from './pages/CalendarPage.tsx'\r\nimport { SettingsPage } from './pages/SettingsPage.tsx'\r\n\r\nconst guestOnly = (page: ReactNode) => <AuthGate access=\"guest\">{page}</AuthGate>\r\n\r\nconst withAuth = (page: ReactNode) => <AuthGate access=\"any\">{page}</AuthGate>\r\n\r\nconst usersOnly = (page: ReactNode) => <AuthGate access=\"user\">{page}</AuthGate>\r\n\r\nconst accountsOnly = (page: ReactNode) => <AuthGate access=\"account\">{page}</AuthGate>\r\n\r\nconst teamsOnly = (page: ReactNode) => <TeamsGate>{accountsOnly(page)}</TeamsGate>\r\n\r\nconst routes: RouteObject[] = [\r\n { path: ROUTES.calendar, element: <CalendarPage /> },\r\n { path: ROUTES.settings, element: usersOnly(<SettingsPage />) },\r\n { path: ROUTES.createCalendar, element: teamsOnly(<CreateCalendarPage />) },\r\n { path: ROUTES.calendarSettings, element: accountsOnly(<CalendarSettingsPage />) },\r\n { path: ROUTES.login, element: guestOnly(<LoginPage />) },\r\n { path: ROUTES.register, element: guestOnly(<RegisterPage />) },\r\n { path: ROUTES.forgotPassword, element: guestOnly(<ForgotPasswordPage />) },\r\n { path: ROUTES.resetPassword, element: withAuth(<ResetPasswordPage />) },\r\n { path: ROUTES.verifyEmail, element: withAuth(<VerifyEmailPage />) },\r\n { path: '*', element: <Navigate to={ROUTES.calendar} replace /> },\r\n]\r\n\r\ntype RouterOptions = {\r\n basename?: string\r\n initialPath?: string\r\n}\r\n\r\nexport function createCalendarRouter(routing: CalendarRouting, { basename, initialPath }: RouterOptions = {}) {\r\n if (routing === 'browser') return createBrowserRouter(routes, { basename })\r\n return createMemoryRouter(routes, { initialEntries: [initialPath ?? ROUTES.calendar] })\r\n}\r\n","import type { EventRepository } from '../features/storage/index.ts'\r\nimport type { CalendarEvent } from '../utils/event.ts'\r\n\r\nexport type DeletedEvent = { id: string }\r\n\r\nexport type EventCallbacks = {\r\n onEventCreate?: (event: CalendarEvent) => void\r\n onEventUpdate?: (event: CalendarEvent) => void\r\n onEventDelete?: (event: DeletedEvent) => void\r\n}\r\n\r\nexport const withEventCallbacks = (\r\n repository: EventRepository,\r\n getCallbacks: () => EventCallbacks,\r\n): EventRepository => ({\r\n list: (query) => repository.list(query),\r\n listSeries: (seriesId) => repository.listSeries(seriesId),\r\n async create(calendarId, input) {\r\n const event = await repository.create(calendarId, input)\r\n getCallbacks().onEventCreate?.(event)\r\n return event\r\n },\r\n async update(id, input) {\r\n const event = await repository.update(id, input)\r\n getCallbacks().onEventUpdate?.(event)\r\n return event\r\n },\r\n async remove(id) {\r\n await repository.remove(id)\r\n getCallbacks().onEventDelete?.({ id })\r\n },\r\n})\r\n","import { useMemo, useState, type ReactNode, type RefObject } from 'react'\r\nimport { RouterProvider } from 'react-router'\r\nimport type { CalendarDataSource } from '../data/index.ts'\r\nimport { AuthProvider, useAuth } from '../features/authorization/index.ts'\r\nimport { CalendarsProvider } from '../features/calendars/index.ts'\r\nimport { PreferencesProvider } from '../features/preferences/index.ts'\r\nimport { StorageProvider } from '../features/storage/index.ts'\r\nimport { useI18n, useLocaleGetter } from '../i18n/index.ts'\r\nimport { createCalendarRouter } from '../router.tsx'\r\nimport type { CalendarRouting } from './config.ts'\r\nimport { withEventCallbacks, type EventCallbacks } from './eventCallbacks.ts'\r\n\r\ntype EventCallbacksRef = RefObject<EventCallbacks>\r\n\r\ntype SessionProvidersProps = {\r\n dataSource: CalendarDataSource\r\n eventCallbacks: EventCallbacksRef\r\n children: ReactNode\r\n}\r\n\r\nfunction SessionProviders({ dataSource, eventCallbacks, children }: SessionProvidersProps) {\r\n const { m } = useI18n()\r\n const getLanguage = useLocaleGetter()\r\n const { status, user, expireSession } = useAuth()\r\n const isAuthenticated = status === 'authenticated'\r\n const repositories = useMemo(\r\n () => dataSource.connect({ isAuthenticated }, { getLanguage, onUnauthorized: expireSession }),\r\n [dataSource, isAuthenticated, getLanguage, expireSession],\r\n )\r\n const storage = useMemo(\r\n () => ({\r\n mode: repositories.mode,\r\n events: withEventCallbacks(repositories.events, () => eventCallbacks.current),\r\n colors: repositories.colors,\r\n preferences: repositories.preferences,\r\n }),\r\n [repositories, eventCallbacks],\r\n )\r\n\r\n if (status === 'loading') return <p className=\"appLoading\">{m.common.loading}</p>\r\n return (\r\n <StorageProvider repositories={storage}>\r\n <PreferencesProvider>\r\n <CalendarsProvider key={user?.id ?? 'guest'} repository={repositories.calendars}>\r\n {children}\r\n </CalendarsProvider>\r\n </PreferencesProvider>\r\n </StorageProvider>\r\n )\r\n}\r\n\r\ntype CalendarAppProps = {\r\n dataSource: CalendarDataSource\r\n eventCallbacks: EventCallbacksRef\r\n routing: CalendarRouting\r\n basename?: string\r\n initialPath?: string\r\n}\r\n\r\nexport function CalendarApp({ dataSource, eventCallbacks, routing, basename, initialPath }: CalendarAppProps) {\r\n const getLanguage = useLocaleGetter()\r\n const authRepository = useMemo(\r\n () => dataSource.createAuthRepository?.({ getLanguage }) ?? null,\r\n [dataSource, getLanguage],\r\n )\r\n const [router] = useState(() => createCalendarRouter(routing, { basename, initialPath }))\r\n\r\n return (\r\n <AuthProvider repository={authRepository}>\r\n <SessionProviders dataSource={dataSource} eventCallbacks={eventCallbacks}>\r\n <RouterProvider router={router} />\r\n </SessionProviders>\r\n </AuthProvider>\r\n )\r\n}\r\n","export const STORAGE_MODES = ['local', 'remote'] as const\r\n\r\nexport type StorageMode = (typeof STORAGE_MODES)[number]\r\n\r\nexport type CalendarFeatures = {\r\n auth: boolean\r\n teams: boolean\r\n}\r\n\r\nexport type CalendarConfig = {\r\n storageMode: StorageMode\r\n apiBaseUrl: string\r\n apiTimeoutMs: number\r\n features: CalendarFeatures\r\n}\r\n\r\nexport const DEFAULT_CONFIG: CalendarConfig = {\r\n storageMode: 'local',\r\n apiBaseUrl: '/api',\r\n apiTimeoutMs: 10_000,\r\n features: { auth: false, teams: true },\r\n}\r\n","@import \"./variables.css\";\r\n@import \"./base.css\";\r\n@import \"./layout.css\";\r\n@import \"./buttons.css\";\r\n@import \"./forms.css\";\r\n@import \"./modal.css\";\r\n@import \"./calendar.css\";\r\n@import \"./events.css\";\r\n@import \"./calendars.css\";\r\n@import \"./auth.css\";\r\n@import \"./colors.css\";\r\n@import \"./utilities.css\";\r\n","import { useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react'\r\nimport { createPortal } from 'react-dom'\r\nimport styles from '../assets/css/index.css?inline'\r\nimport { RootElementContext } from '../context/RootElementContext.ts'\r\n\r\nconst ROOT_CLASS = 'calendarRoot'\r\n\r\nlet sharedSheet: CSSStyleSheet | null = null\r\n\r\nconst getStyleSheet = () => {\r\n if (!sharedSheet) {\r\n sharedSheet = new CSSStyleSheet()\r\n sharedSheet.replaceSync(styles)\r\n }\r\n return sharedSheet\r\n}\r\n\r\ntype IsolatedRootProps = {\r\n className?: string\r\n style?: CSSProperties\r\n autoFocus?: boolean\r\n children: ReactNode\r\n}\r\n\r\nexport function IsolatedRoot({ className, style, autoFocus = false, children }: IsolatedRootProps) {\r\n const hostRef = useRef<HTMLDivElement>(null)\r\n const [root, setRoot] = useState<HTMLElement | null>(null)\r\n\r\n useLayoutEffect(() => {\r\n const host = hostRef.current\r\n if (!host) return\r\n const shadow = host.shadowRoot ?? host.attachShadow({ mode: 'open' })\r\n shadow.adoptedStyleSheets = [getStyleSheet()]\r\n const element = document.createElement('div')\r\n element.className = ROOT_CLASS\r\n element.tabIndex = -1\r\n shadow.append(element)\r\n setRoot(element)\r\n if (autoFocus) element.focus({ preventScroll: true })\r\n return () => {\r\n element.remove()\r\n setRoot(null)\r\n }\r\n }, [autoFocus])\r\n\r\n return (\r\n <div ref={hostRef} className={className} style={style}>\r\n {root && createPortal(<RootElementContext value={root}>{children}</RootElementContext>, root)}\r\n </div>\r\n )\r\n}\r\n","export const DEFAULT_LINK_PARAM = 'calendarPath'\r\n\r\nexport const readLinkedPath = (param: string) => {\r\n if (typeof window === 'undefined') return undefined\r\n const path = new URLSearchParams(window.location.search).get(param)\r\n return path?.startsWith('/') && !path.startsWith('//') ? path : undefined\r\n}\r\n","import { useEffect, useMemo, useRef } from 'react'\r\nimport { HostContext, type HostOptions } from '../context/HostContext.ts'\r\nimport { localDataSource, restDataSource, tenantDataSource } from '../data/index.ts'\r\nimport { I18nProvider } from '../i18n/index.ts'\r\nimport { CalendarApp } from './CalendarApp.tsx'\r\nimport { DEFAULT_CONFIG, type CalendarProps } from './config.ts'\r\nimport type { EventCallbacks } from './eventCallbacks.ts'\r\nimport { IsolatedRoot } from './IsolatedRoot.tsx'\r\nimport { DEFAULT_LINK_PARAM, readLinkedPath } from './linkParam.ts'\r\n\r\nexport function CalendarWidget({\r\n dataSource: providedDataSource,\r\n tenant,\r\n getUserToken,\r\n storageMode = DEFAULT_CONFIG.storageMode,\r\n apiBaseUrl = DEFAULT_CONFIG.apiBaseUrl,\r\n apiTimeoutMs = DEFAULT_CONFIG.apiTimeoutMs,\r\n features,\r\n routing = 'memory',\r\n basename,\r\n initialPath,\r\n linkParam = DEFAULT_LINK_PARAM,\r\n locale,\r\n theme,\r\n initialView,\r\n onEventCreate,\r\n onEventUpdate,\r\n onEventDelete,\r\n className,\r\n style,\r\n}: CalendarProps) {\r\n const auth = features?.auth ?? DEFAULT_CONFIG.features.auth\r\n const teams = features?.teams ?? DEFAULT_CONFIG.features.teams\r\n const dataSource = useMemo(\r\n () =>\r\n providedDataSource ??\r\n (tenant\r\n ? tenantDataSource({ tenant, baseUrl: apiBaseUrl, timeoutMs: apiTimeoutMs, getUserToken })\r\n : auth || storageMode === 'remote'\r\n ? restDataSource({ baseUrl: apiBaseUrl, timeoutMs: apiTimeoutMs, auth, getUserToken })\r\n : localDataSource()),\r\n [providedDataSource, tenant, getUserToken, auth, storageMode, apiBaseUrl, apiTimeoutMs],\r\n )\r\n const host = useMemo<HostOptions>(() => ({ teams, theme, initialView }), [teams, theme, initialView])\r\n const callbacks = useRef<EventCallbacks>({})\r\n useEffect(() => {\r\n callbacks.current = { onEventCreate, onEventUpdate, onEventDelete }\r\n }, [onEventCreate, onEventUpdate, onEventDelete])\r\n const startPath = initialPath ?? (routing === 'memory' && linkParam ? readLinkedPath(linkParam) : undefined)\r\n\r\n return (\r\n <IsolatedRoot className={className} style={style} autoFocus={routing === 'browser'}>\r\n <HostContext value={host}>\r\n <I18nProvider locale={locale}>\r\n <CalendarApp\r\n dataSource={dataSource}\r\n eventCallbacks={callbacks}\r\n routing={routing}\r\n basename={basename}\r\n initialPath={startPath}\r\n />\r\n </I18nProvider>\r\n </HostContext>\r\n </IsolatedRoot>\r\n )\r\n}\r\n","export const VERSION: string = __CALENDAR_VERSION__\r\n","import { StrictMode } from 'react'\r\nimport { createRoot, type Root } from 'react-dom/client'\r\nimport type { CalendarDataSource } from '../data/index.ts'\r\nimport type { UserTokenProvider } from '../features/authorization/index.ts'\r\nimport { isCalendarView } from '../utils/calendarView.ts'\r\nimport type { CalendarEvent } from '../utils/event.ts'\r\nimport { isOneOf } from '../utils/object.ts'\r\nimport { CalendarWidget } from './CalendarWidget.tsx'\r\nimport { STORAGE_MODES, type CalendarProps } from './config.ts'\r\nimport type { DeletedEvent } from './eventCallbacks.ts'\r\nimport { VERSION } from './version.ts'\r\n\r\nexport const DEFAULT_ELEMENT_NAME = 'calendar-widget'\r\n\r\nconst FILL = { height: '100%' }\r\n\r\nconst THEMES = ['light', 'dark'] as const\r\n\r\nconst ATTRIBUTES = ['storage-mode', 'api-base-url', 'api-timeout-ms', 'auth', 'teams', 'initial-path', 'locale', 'tenant', 'theme', 'initial-view', 'link-param'] as const\r\n\r\nexport class CalendarElement extends HTMLElement {\r\n static observedAttributes = ATTRIBUTES\r\n static readonly version = VERSION\r\n\r\n #root: Root | null = null\r\n #dataSource: CalendarDataSource | undefined\r\n #getUserToken: UserTokenProvider | undefined\r\n\r\n get dataSource() {\r\n return this.#dataSource\r\n }\r\n\r\n set dataSource(value: CalendarDataSource | undefined) {\r\n this.#dataSource = value\r\n if (this.#root) this.#render()\r\n }\r\n\r\n get getUserToken() {\r\n return this.#getUserToken\r\n }\r\n\r\n set getUserToken(value: UserTokenProvider | undefined) {\r\n this.#getUserToken = value\r\n if (this.#root) this.#render()\r\n }\r\n\r\n connectedCallback() {\r\n this.#adoptEarlyProperty('dataSource')\r\n this.#adoptEarlyProperty('getUserToken')\r\n if (!this.style.display) this.style.display = 'block'\r\n this.#root ??= createRoot(this)\r\n this.#render()\r\n }\r\n\r\n #adoptEarlyProperty(name: 'dataSource' | 'getUserToken') {\r\n if (!Object.hasOwn(this, name)) return\r\n const value = this[name]\r\n delete (this as Partial<Record<typeof name, unknown>>)[name]\r\n this[name] = value as never\r\n }\r\n\r\n disconnectedCallback() {\r\n const root = this.#root\r\n this.#root = null\r\n queueMicrotask(() => root?.unmount())\r\n }\r\n\r\n attributeChangedCallback() {\r\n if (this.#root) this.#render()\r\n }\r\n\r\n #flag(name: 'auth' | 'teams') {\r\n const value = this.getAttribute(name)\r\n return value === null ? undefined : value !== 'false'\r\n }\r\n\r\n #emit(type: string, detail: CalendarEvent | DeletedEvent) {\r\n this.dispatchEvent(new CustomEvent(type, { detail, bubbles: true, composed: true }))\r\n }\r\n\r\n #onEventCreate = (event: CalendarEvent) => this.#emit('event-create', event)\r\n #onEventUpdate = (event: CalendarEvent) => this.#emit('event-update', event)\r\n #onEventDelete = (event: DeletedEvent) => this.#emit('event-delete', event)\r\n\r\n #props(): CalendarProps {\r\n const storageMode = this.getAttribute('storage-mode')\r\n const timeout = Number(this.getAttribute('api-timeout-ms'))\r\n const theme = this.getAttribute('theme')\r\n const initialView = this.getAttribute('initial-view')\r\n const linkParam = this.getAttribute('link-param')\r\n return {\r\n storageMode: isOneOf(STORAGE_MODES, storageMode) ? storageMode : undefined,\r\n apiBaseUrl: this.getAttribute('api-base-url') ?? undefined,\r\n apiTimeoutMs: Number.isInteger(timeout) && timeout > 0 ? timeout : undefined,\r\n features: { auth: this.#flag('auth'), teams: this.#flag('teams') },\r\n initialPath: this.getAttribute('initial-path') ?? undefined,\r\n locale: this.getAttribute('locale') ?? undefined,\r\n tenant: this.getAttribute('tenant') ?? undefined,\r\n theme: isOneOf(THEMES, theme) ? theme : undefined,\r\n initialView: isCalendarView(initialView) ? initialView : undefined,\r\n linkParam: linkParam === 'false' ? false : (linkParam ?? undefined),\r\n onEventCreate: this.#onEventCreate,\r\n onEventUpdate: this.#onEventUpdate,\r\n onEventDelete: this.#onEventDelete,\r\n dataSource: this.#dataSource,\r\n getUserToken: this.#getUserToken,\r\n }\r\n }\r\n\r\n #render() {\r\n this.#root?.render(\r\n <StrictMode>\r\n <CalendarWidget {...this.#props()} routing=\"memory\" style={FILL} />\r\n </StrictMode>,\r\n )\r\n }\r\n}\r\n\r\nexport function defineCalendarElement(name = DEFAULT_ELEMENT_NAME) {\r\n if (!customElements.get(name)) customElements.define(name, class extends CalendarElement {})\r\n}\r\n"],"ignoreList":[41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61],"mappings":";;;;;;;AAWA,IAAa,cAAc,cAA2B,EAAE,OAAO,KAAK,CAAC;AAErE,IAAa,gBAAgB,IAAI,WAAW;;;ACb5C,IAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAa,eAAe,UAC1B,OAAO,UAAU,YAAa,YAAkC,SAAS,KAAK;AAIhF,IAAa,WAAb,cAA8B,MAAM;CAClC;CAEA,YAAY,MAAiB,SAA+B;EAC1D,MAAM,MAAM,OAAO;EACnB,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF;AAEA,IAAa,cAAc,UAAsC,iBAAiB;;;AC5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