@riverbankcms/sdk 0.153.0 → 0.155.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 (357) hide show
  1. package/README.md +2 -0
  2. package/dist/{EventEmbeddedCheckoutStep-veN-QiAE.mjs → EventEmbeddedCheckoutStep-DALtAjqG.mjs} +1 -1
  3. package/dist/{PreviewEditorSidebar-jI_4DTZY.mjs → PreviewEditorSidebar-CbSbqmz3.mjs} +219 -38
  4. package/dist/{PreviewEditorUI-ORkVZhfu.mjs → PreviewEditorUI-CKKnAw11.mjs} +26 -58
  5. package/dist/{SdkPreviewModeRuntime-DaNqevI1.mjs → SdkPreviewModeRuntime-wLkXrWy9.mjs} +177 -84
  6. package/dist/{SiteChromeCustomizeContext-CgNuBHC0.mjs → SiteChromeCustomizeContext-BQ8vvKb-.mjs} +9824 -5829
  7. package/dist/{ThemedButton-X2UxhW6F.mjs → ThemedButton-Bi0rgijy.mjs} +482 -85
  8. package/dist/_dts/ai/src/contracts/proposals.d.ts +42873 -16847
  9. package/dist/_dts/ai/src/contracts/siteStyleProposalSchemas.d.ts +5432 -1810
  10. package/dist/_dts/api/src/billing.d.ts +2 -0
  11. package/dist/_dts/api/src/billingEndpointDefinitions.d.ts +78 -0
  12. package/dist/_dts/api/src/bookingAdjustments.d.ts +3 -2
  13. package/dist/_dts/api/src/bookingConfig.d.ts +4 -12
  14. package/dist/_dts/api/src/bookingManagementEventEndpointTypes.d.ts +2 -2
  15. package/dist/_dts/api/src/bookingOperations.d.ts +11 -2
  16. package/dist/_dts/api/src/bookingPeople.d.ts +20 -1
  17. package/dist/_dts/api/src/bookingPeopleEndpointDefinitions.d.ts +8 -0
  18. package/dist/_dts/api/src/bookingRecords.d.ts +5 -106
  19. package/dist/_dts/api/src/bookings.d.ts +10 -4
  20. package/dist/_dts/api/src/commercePortalEndpoints.d.ts +1 -1
  21. package/dist/_dts/api/src/common/envelope.d.ts +2 -2
  22. package/dist/_dts/api/src/contentRuntime.d.ts +5 -3
  23. package/dist/_dts/api/src/endpoints.d.ts +89 -44
  24. package/dist/_dts/api/src/eventManagementContracts.d.ts +20 -11
  25. package/dist/_dts/api/src/eventManagementEndpointDefinitions.d.ts +1 -1
  26. package/dist/_dts/api/src/index.d.ts +9 -4
  27. package/dist/_dts/api/src/indexCoreTypes.d.ts +1 -0
  28. package/dist/_dts/api/src/moneyPayments.d.ts +116 -0
  29. package/dist/_dts/api/src/onboarding/surfaceData.d.ts +2 -0
  30. package/dist/_dts/api/src/privacyPolicy.d.ts +20 -2
  31. package/dist/_dts/api/src/public/types.d.ts +1 -0
  32. package/dist/_dts/api/src/publicAppointmentBookingContracts.d.ts +1 -0
  33. package/dist/_dts/api/src/publicBookingService.d.ts +1 -0
  34. package/dist/_dts/api/src/publicExperience/commerceEndpoints.d.ts +4 -0
  35. package/dist/_dts/api/src/sdk-event-management.d.ts +1 -0
  36. package/dist/_dts/api/src/sdk-event-upsert.d.ts +24 -9
  37. package/dist/_dts/api/src/sdkContracts.d.ts +2 -0
  38. package/dist/_dts/api/src/sdkManagedEventContracts.d.ts +5 -3
  39. package/dist/_dts/api/src/sdkPullEventContracts.d.ts +15 -4
  40. package/dist/_dts/api/src/sdkThemeWire.d.ts +172 -103
  41. package/dist/_dts/api/src/siteManagementEndpoints.d.ts +2 -2
  42. package/dist/_dts/api/src/sitePlatformEndpoints.d.ts +18 -0
  43. package/dist/_dts/api/src/siteRuntimeEndpoints.d.ts +17 -16
  44. package/dist/_dts/api/src/siteSettings.d.ts +1 -0
  45. package/dist/_dts/api/src/siteTerms.d.ts +100 -0
  46. package/dist/_dts/api/src/stripeConnectSetup.d.ts +90 -0
  47. package/dist/_dts/api/src/types.d.ts +13 -32
  48. package/dist/_dts/api/src/webhooks.d.ts +9 -9
  49. package/dist/_dts/api/src/wholeSeriesRuns.d.ts +2 -4
  50. package/dist/_dts/block-form/src/client/index.d.ts +2 -1
  51. package/dist/_dts/block-form/src/widgets/DateField/DateField.d.ts +3 -1
  52. package/dist/_dts/block-form/src/widgets/DateField/datePickerPopover.d.ts +3 -1
  53. package/dist/_dts/block-form/src/widgets/DateTimeField/DateTimeField.d.ts +3 -1
  54. package/dist/_dts/blocks/src/client/carousel.d.ts +1 -0
  55. package/dist/_dts/blocks/src/client/site-chrome.d.ts +1 -1
  56. package/dist/_dts/blocks/src/contracts/non-block-islands.d.ts +12 -33
  57. package/dist/_dts/blocks/src/contracts/proof-block-islands.d.ts +30 -118
  58. package/dist/_dts/blocks/src/index.d.ts +2 -2
  59. package/dist/_dts/blocks/src/pageRenderAdmission.d.ts +1 -0
  60. package/dist/_dts/blocks/src/pageRenderPlan.d.ts +8 -1
  61. package/dist/_dts/blocks/src/pageRendererContracts.d.ts +1 -0
  62. package/dist/_dts/blocks/src/primitives/content/components/RichText.d.ts +1 -1
  63. package/dist/_dts/blocks/src/primitives/content/primitives.d.ts +4 -1
  64. package/dist/_dts/blocks/src/primitives/layout/Section.d.ts +1 -0
  65. package/dist/_dts/blocks/src/rendering/server.d.ts +1 -0
  66. package/dist/_dts/blocks/src/system/blocks/events/event-calendar.d.ts +1 -1
  67. package/dist/_dts/blocks/src/system/blocks/events/eventSelectionFields.d.ts +1 -1
  68. package/dist/_dts/blocks/src/system/blocks/events/shared/fields.d.ts +0 -4
  69. package/dist/_dts/blocks/src/system/blocks/events/shared/index.d.ts +0 -1
  70. package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +13 -9
  71. package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +1 -0
  72. package/dist/_dts/blocks/src/system/blocks/form.d.ts +10 -0
  73. package/dist/_dts/blocks/src/system/blocks/image-gallery/fields.d.ts +1 -0
  74. package/dist/_dts/blocks/src/system/blocks/image-gallery.d.ts +6 -1
  75. package/dist/_dts/blocks/src/system/blocks/location-map.d.ts +1 -1
  76. package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +47 -45
  77. package/dist/_dts/blocks/src/system/blocks/newsletter-signup.d.ts +12 -0
  78. package/dist/_dts/blocks/src/system/blocks/offerings-preview/catalogue.d.ts +7 -1
  79. package/dist/_dts/blocks/src/system/blocks/offerings-preview/index.d.ts +14 -0
  80. package/dist/_dts/blocks/src/system/blocks/offerings-preview/itemData.d.ts +12 -0
  81. package/dist/_dts/blocks/src/system/blocks/offerings-preview/model.d.ts +56 -6
  82. package/dist/_dts/blocks/src/system/blocks/offerings-preview/photoCount.d.ts +3 -12
  83. package/dist/_dts/blocks/src/system/blocks/shared/siteTerms.d.ts +17 -0
  84. package/dist/_dts/blocks/src/system/blocks/site-footer-runtime-layout.d.ts +23 -0
  85. package/dist/_dts/blocks/src/system/blocks/site-footer-runtime-profile.d.ts +20 -0
  86. package/dist/_dts/blocks/src/system/blocks/site-footer-runtime.d.ts +17 -16
  87. package/dist/_dts/blocks/src/system/blocks/site-footer.d.ts +1 -1
  88. package/dist/_dts/blocks/src/system/customize/facets.d.ts +119 -9
  89. package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +2 -1
  90. package/dist/_dts/blocks/src/system/manifest/schema.d.ts +24 -24
  91. package/dist/_dts/blocks/src/system/manifest/validation.d.ts +3 -1
  92. package/dist/_dts/blocks/src/system/node/fragments/backgroundLayer.d.ts +6 -0
  93. package/dist/_dts/blocks/src/system/node/fragments/index.d.ts +1 -0
  94. package/dist/_dts/blocks/src/system/node/fragments/lookSlot.d.ts +22 -3
  95. package/dist/_dts/blocks/src/system/node/fragments/responsiveTwoColumn.d.ts +3 -1
  96. package/dist/_dts/blocks/src/system/node/fragments/sectionHead.d.ts +15 -0
  97. package/dist/_dts/blocks/src/system/node/fragments/styledSection.d.ts +4 -0
  98. package/dist/_dts/blocks/src/system/runtime/api/client.d.ts +2 -0
  99. package/dist/_dts/blocks/src/system/runtime/api/endpoints.d.ts +7 -0
  100. package/dist/_dts/blocks/src/system/runtime/api/types/events.d.ts +2 -0
  101. package/dist/_dts/blocks/src/system/runtime/api/types/portal.d.ts +1 -0
  102. package/dist/_dts/blocks/src/system/runtime/api/types/shop.d.ts +3 -0
  103. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +51 -198
  104. package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +21 -99
  105. package/dist/_dts/blocks/src/system/runtime/hooks/useBookingFlowController.d.ts +2 -0
  106. package/dist/_dts/blocks/src/system/runtime/hooks/useBookingSubmission.d.ts +3 -2
  107. package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.d.ts +4 -0
  108. package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessEventRegistrationFlow.d.ts +2 -0
  109. package/dist/_dts/blocks/src/system/runtime/hooks/useSiteTermsAgreement.d.ts +17 -0
  110. package/dist/_dts/blocks/src/system/runtime/hooks/useSiteTermsAgreement.state.d.ts +42 -0
  111. package/dist/_dts/blocks/src/system/runtime/lookSurfaces.d.ts +22 -4
  112. package/dist/_dts/blocks/src/system/runtime/nodes/appointment-services.d.ts +6 -2
  113. package/dist/_dts/blocks/src/system/runtime/nodes/basic.d.ts +2 -1
  114. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.headless.state.d.ts +4 -0
  115. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.interactive.d.ts +15 -0
  116. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.state.d.ts +1 -0
  117. package/dist/_dts/blocks/src/system/runtime/nodes/booking-runtime-sources.d.ts +3 -0
  118. package/dist/_dts/blocks/src/system/runtime/nodes/carousel.client.d.ts +5 -30
  119. package/dist/_dts/blocks/src/system/runtime/nodes/carousel.server.d.ts +3 -12
  120. package/dist/_dts/blocks/src/system/runtime/nodes/carousel.shared.d.ts +71 -1
  121. package/dist/_dts/blocks/src/system/runtime/nodes/event-details/lookPresentation.d.ts +16 -4
  122. package/dist/_dts/blocks/src/system/runtime/nodes/event-details/presentation.d.ts +1 -1
  123. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/AttendeeDetailsStep.d.ts +3 -0
  124. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/CalendarAction.d.ts +5 -0
  125. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/SuccessStep.d.ts +2 -0
  126. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/bookingCalendar.d.ts +16 -0
  127. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.contract.d.ts +2 -0
  128. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/finishedBooking.d.ts +8 -0
  129. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationStateMachine.d.ts +2 -0
  130. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/types.d.ts +3 -1
  131. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +42 -0
  132. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration.interactive.d.ts +5 -0
  133. package/dist/_dts/blocks/src/system/runtime/nodes/events/domain/dates.d.ts +1 -1
  134. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/CardListItem.d.ts +26 -1
  135. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventItem.d.ts +17 -3
  136. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCardListContent.d.ts +9 -1
  137. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCollectionContract.d.ts +49 -21
  138. package/dist/_dts/blocks/src/system/runtime/nodes/form.fields.d.ts +5 -2
  139. package/dist/_dts/blocks/src/system/runtime/nodes/form.interactive.d.ts +11 -79
  140. package/dist/_dts/blocks/src/system/runtime/nodes/form.parts.d.ts +7 -0
  141. package/dist/_dts/blocks/src/system/runtime/nodes/form.server.d.ts +2 -13
  142. package/dist/_dts/blocks/src/system/runtime/nodes/gifting.interactive.d.ts +8 -0
  143. package/dist/_dts/blocks/src/system/runtime/nodes/newsletter-form.interactive.d.ts +8 -72
  144. package/dist/_dts/blocks/src/system/runtime/nodes/newsletter-form.parts.d.ts +6 -6
  145. package/dist/_dts/blocks/src/system/runtime/nodes/newsletter-form.types.d.ts +3 -2
  146. package/dist/_dts/blocks/src/system/runtime/nodes/offerings-preview-catalogue.d.ts +5 -3
  147. package/dist/_dts/blocks/src/system/runtime/nodes/offerings-preview-content.d.ts +4 -2
  148. package/dist/_dts/blocks/src/system/runtime/nodes/offerings-preview.d.ts +2 -2
  149. package/dist/_dts/blocks/src/system/runtime/nodes/shared/contract-schemas.d.ts +2 -2
  150. package/dist/_dts/blocks/src/system/runtime/nodes/shop.interactive.d.ts +14 -0
  151. package/dist/_dts/blocks/src/system/runtime/shared/components/CheckboxChoice.d.ts +3 -1
  152. package/dist/_dts/blocks/src/system/runtime/shared/components/SiteTermsAgreementField.d.ts +13 -0
  153. package/dist/_dts/blocks/src/system/runtime/shared/siteTermsAgreement.d.ts +81 -0
  154. package/dist/_dts/blocks/src/system/runtime/shared/siteTermsCheckoutApi.d.ts +14 -0
  155. package/dist/_dts/blocks/src/system/transforms/registry/_utils/surfaceForegroundStyles.d.ts +3 -0
  156. package/dist/_dts/blocks/src/system/transforms/registry/boxStyles.d.ts +2 -0
  157. package/dist/_dts/blocks/src/system/transforms/registry/footerArrangement.d.ts +6 -0
  158. package/dist/_dts/blocks/src/system/transforms/registry/layout.d.ts +0 -11
  159. package/dist/_dts/blocks/src/system/transforms/typed.d.ts +3 -10
  160. package/dist/_dts/blocks/src/system/types/link.d.ts +2 -0
  161. package/dist/_dts/calendar/src/icsRenderer.d.ts +23 -0
  162. package/dist/_dts/calendar/src/index.d.ts +2 -0
  163. package/dist/_dts/commerce/src/purchase/checkoutErrorCodes.d.ts +1 -1
  164. package/dist/_dts/commerce/src/purchase/orderConfirmationPlanning.d.ts +1 -0
  165. package/dist/_dts/commerce/src/purchase/types.d.ts +5 -0
  166. package/dist/_dts/content-editor/src/FooterComposerOverview.d.ts +5 -2
  167. package/dist/_dts/content-editor/src/FooterComposerPanel.d.ts +1 -1
  168. package/dist/_dts/content-editor/src/FooterNavigationLayoutControl.d.ts +6 -3
  169. package/dist/_dts/content-editor/src/controller/EntryControllerProvider.d.ts +3 -1
  170. package/dist/_dts/content-editor/src/controller/editorLeaseParticipation.d.ts +1 -1
  171. package/dist/_dts/content-editor/src/controller/publicationDate.d.ts +5 -0
  172. package/dist/_dts/content-editor/src/footerComposer.d.ts +2 -1
  173. package/dist/_dts/content-editor/src/footerComposerPanelTypes.d.ts +3 -1
  174. package/dist/_dts/content-editor/src/footerNavigationLayoutState.d.ts +56 -0
  175. package/dist/_dts/content-editor/src/footerPreviewRuntime.d.ts +2 -1
  176. package/dist/_dts/content-editor/src/useFooterComposerState.d.ts +3 -4
  177. package/dist/_dts/content-editor/src/useFooterNavigationLayout.d.ts +11 -8
  178. package/dist/_dts/content-model/src/content-types/entryValidation.d.ts +6 -5
  179. package/dist/_dts/content-model/src/content-types/schema.d.ts +4 -0
  180. package/dist/_dts/content-model/src/contentManifest.d.ts +10 -2
  181. package/dist/_dts/content-model/src/definitions/shared.d.ts +2 -0
  182. package/dist/_dts/core/src/booking-date-time.d.ts +5 -0
  183. package/dist/_dts/core/src/booking-refunds.d.ts +43 -0
  184. package/dist/_dts/core/src/branded.d.ts +6 -0
  185. package/dist/_dts/core/src/date-display.d.ts +90 -0
  186. package/dist/_dts/core/src/date-time-formatter.d.ts +2 -0
  187. package/dist/_dts/core/src/footer-arrangement.d.ts +8 -1
  188. package/dist/_dts/core/src/footer-composition-types.d.ts +6 -1
  189. package/dist/_dts/core/src/footer-composition.d.ts +1 -1
  190. package/dist/_dts/core/src/footer-navigation-layout.d.ts +3 -0
  191. package/dist/_dts/core/src/index.d.ts +4 -1
  192. package/dist/_dts/core/src/mailing-list-setup.d.ts +3 -0
  193. package/dist/_dts/core/src/mailing-list-submission.d.ts +6 -1
  194. package/dist/_dts/core/src/public-profile.d.ts +3 -1
  195. package/dist/_dts/core/src/scheduled-date-time.d.ts +69 -0
  196. package/dist/_dts/core/src/site-terms.d.ts +94 -0
  197. package/dist/_dts/core/src/whole-series-run-schedule.d.ts +2 -0
  198. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +356 -9
  199. package/dist/_dts/db/src/schemas/forms.d.ts +32 -32
  200. package/dist/_dts/editor/src/chrome/EditorChrome.d.ts +2 -2
  201. package/dist/_dts/editor/src/chrome/EditorStatusBar.d.ts +3 -2
  202. package/dist/_dts/editor/src/chrome/statusBarPresentation.d.ts +2 -2
  203. package/dist/_dts/editor-blocks/src/widgets/link/LinkContentList.d.ts +2 -1
  204. package/dist/_dts/editor-blocks/src/widgets/link/LinkPicker.d.ts +3 -0
  205. package/dist/_dts/editor-blocks/src/widgets/link/LinkPickerDialog.d.ts +1 -1
  206. package/dist/_dts/editor-blocks/src/widgets/link/LinkWidget.d.ts +3 -0
  207. package/dist/_dts/editor-blocks/src/widgets/link/draft.d.ts +6 -1
  208. package/dist/_dts/editor-blocks/src/widgets/link/index.d.ts +1 -0
  209. package/dist/_dts/preview-next/src/client/blocks/ArrangementBlockToolbar.d.ts +2 -1
  210. package/dist/_dts/preview-next/src/client/blocks/arrangementControlsModel.d.ts +8 -1
  211. package/dist/_dts/preview-next/src/client/blocks/previewCustomizeControlPlan.d.ts +4 -1
  212. package/dist/_dts/preview-next/src/client/preview/PreviewEntryControllerProvider.d.ts +3 -1
  213. package/dist/_dts/preview-next/src/client/preview/PreviewShell.d.ts +3 -0
  214. package/dist/_dts/preview-next/src/client/preview/PreviewShellLayout.d.ts +1 -0
  215. package/dist/_dts/preview-next/src/client/preview/SiteChromeCustomizeContext.d.ts +4 -1
  216. package/dist/_dts/preview-next/src/client/preview/siteChromeSavePlan.d.ts +27 -5
  217. package/dist/_dts/preview-next/src/client/preview/siteStylePreviewPlanner.d.ts +2 -0
  218. package/dist/_dts/preview-next/src/client/preview/useConfirmedPreferenceRecord.d.ts +12 -0
  219. package/dist/_dts/preview-next/src/client/preview/usePersistedFooterPreferences.d.ts +26 -0
  220. package/dist/_dts/preview-next/src/client/preview/usePersistedHeaderPreferences.d.ts +40 -2
  221. package/dist/_dts/preview-next/src/client/sdk/SdkPreviewMode.d.ts +2 -0
  222. package/dist/_dts/sdk/src/config/typed-entry-links.test-d.d.ts +1 -0
  223. package/dist/_dts/sdk/src/config/validation.d.ts +3 -3
  224. package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +4 -46
  225. package/dist/_dts/sdk/src/date-time/index.d.ts +2 -68
  226. package/dist/_dts/sdk/src/public-api/contracts.d.ts +4 -2
  227. package/dist/_dts/sdk/src/rendering/blocks-page-renderer.d.ts +1 -0
  228. package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +3 -1
  229. package/dist/_dts/sdk/src/rendering/helpers/loadContent.d.ts +7 -4
  230. package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +3 -1
  231. package/dist/_dts/sdk/src/rendering/islands/types.d.ts +1 -1
  232. package/dist/_dts/sdk/src/version.d.ts +1 -1
  233. package/dist/_dts/theme-core/src/ThemeFontLoader.d.ts +1 -0
  234. package/dist/_dts/theme-core/src/buttons/buttonColourContract.d.ts +2 -0
  235. package/dist/_dts/theme-core/src/buttons/resolveButtonColourStates.d.ts +2 -0
  236. package/dist/_dts/theme-core/src/buttons/styles/recipes/lanternRecipes.d.ts +60 -0
  237. package/dist/_dts/theme-core/src/buttons/styles/recipes/quietArrow.d.ts +12 -8
  238. package/dist/_dts/theme-core/src/buttons/styles/registry.d.ts +69 -8
  239. package/dist/_dts/theme-core/src/buttons/styles/selection.d.ts +22 -1
  240. package/dist/_dts/theme-core/src/buttons/types.d.ts +358 -46
  241. package/dist/_dts/theme-core/src/buttons/typography.d.ts +24 -0
  242. package/dist/_dts/theme-core/src/cards/types.d.ts +8 -8
  243. package/dist/_dts/theme-core/src/footer/effectiveNavLinkStyle.d.ts +1 -1
  244. package/dist/_dts/theme-core/src/footer/generateFooterCss.d.ts +4 -1
  245. package/dist/_dts/theme-core/src/footer/mode.d.ts +2 -11
  246. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  247. package/dist/_dts/theme-core/src/header/containerSchema.d.ts +1 -0
  248. package/dist/_dts/theme-core/src/header/generateHeaderCss.d.ts +3 -0
  249. package/dist/_dts/theme-core/src/inputs/checkable.d.ts +6 -0
  250. package/dist/_dts/theme-core/src/mock-themes/all.d.ts +249 -147
  251. package/dist/_dts/theme-core/src/navigation/types.d.ts +4 -4
  252. package/dist/_dts/theme-core/src/schema.d.ts +321 -192
  253. package/dist/_dts/theme-core/src/site-styles/accessibleSurfaces.d.ts +2 -0
  254. package/dist/_dts/theme-core/src/site-styles/appearancePresetTypes.d.ts +24 -7
  255. package/dist/_dts/theme-core/src/site-styles/backgroundAppearance.d.ts +2 -2
  256. package/dist/_dts/theme-core/src/site-styles/compilationPlan.d.ts +4 -6
  257. package/dist/_dts/theme-core/src/site-styles/compileFooterAgainstRow.d.ts +121 -0
  258. package/dist/_dts/theme-core/src/site-styles/curatedSiteStyles.d.ts +81 -1
  259. package/dist/_dts/theme-core/src/site-styles/footerLookDefaults.d.ts +45 -0
  260. package/dist/_dts/theme-core/src/site-styles/footerLookRecipe.d.ts +50 -0
  261. package/dist/_dts/theme-core/src/site-styles/footerLooks.d.ts +9 -35
  262. package/dist/_dts/theme-core/src/site-styles/footerPreferences.d.ts +29 -0
  263. package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +4 -2
  264. package/dist/_dts/theme-core/src/site-styles/headerOpeningForeground.d.ts +4 -0
  265. package/dist/_dts/theme-core/src/site-styles/headerPreferencesPersistence.d.ts +2 -3
  266. package/dist/_dts/theme-core/src/site-styles/headerStyleRecipe.d.ts +13 -1
  267. package/dist/_dts/theme-core/src/site-styles/index.d.ts +4 -0
  268. package/dist/_dts/theme-core/src/site-styles/lookResolution.d.ts +2 -2
  269. package/dist/_dts/theme-core/src/site-styles/previewCompiler.d.ts +1 -1
  270. package/dist/_dts/theme-core/src/site-styles/runtimeBackgroundResolution.d.ts +5 -0
  271. package/dist/_dts/theme-core/src/site-styles/siteChromeBackgrounds.d.ts +8 -0
  272. package/dist/_dts/theme-core/src/site-styles/siteStyleTypography.d.ts +46 -0
  273. package/dist/_dts/theme-core/src/site-styles/themeParity.d.ts +1 -1
  274. package/dist/_dts/theme-core/src/site-styles/tokenRecipes.d.ts +1 -1
  275. package/dist/_dts/theme-core/src/status/generateStatusCss.d.ts +4 -1
  276. package/dist/_dts/theme-core/src/surfaces/resolveSurfaceForeground.d.ts +2 -0
  277. package/dist/_dts/theme-core/src/typography/schema.d.ts +9 -0
  278. package/dist/_dts/ui/src/calendar.d.ts +6 -1
  279. package/dist/_dts/ui/src/card.d.ts +1 -1
  280. package/dist/_dts/ui/src/index.d.ts +1 -1
  281. package/dist/client/{BookingMailingListNote-DrchYW1m.mjs → BookingMailingListNote-CiW1dsz7.mjs} +3 -3
  282. package/dist/client/{CardListItem-CC_GVmF6.mjs → CardListItem-DVYTlYpS.mjs} +70 -13
  283. package/dist/client/CheckboxChoice-CUnPrBlC.mjs +44 -0
  284. package/dist/client/DemoBookingPortalAccess-DEsn5F2C.mjs +770 -0
  285. package/dist/client/{EventCombined.client-DyN0v0Xk.mjs → EventCombined.client-BdctbwnV.mjs} +5 -5
  286. package/dist/client/{EventEmbeddedCheckoutStep-CgfpKc3n.mjs → EventEmbeddedCheckoutStep-DAhQs6Jb.mjs} +2 -5
  287. package/dist/client/{EventListing.client-CuOuvYMz.mjs → EventListing.client-BviZXfAE.mjs} +2 -2
  288. package/dist/client/{mailingListSignupCopy-DZSHZrm6.mjs → FieldValidationMessage-AYanWFb-.mjs} +1 -14
  289. package/dist/client/{LeafletStaticMap-B0WhRr3j.mjs → LeafletStaticMap-BLTECfjU.mjs} +1 -1
  290. package/dist/client/{RichText-C1fIXBzA.mjs → RichText-D3oE1_pw.mjs} +77 -44
  291. package/dist/client/ThemedButton-Ckj0Rfr_.mjs +1256 -0
  292. package/dist/client/{accordion-DCDVWSye.mjs → accordion-yBx6d4O2.mjs} +1 -1
  293. package/dist/client/{bookingForm-BJ3C4GlM.mjs → bookingForm-CPDEsQci.mjs} +64 -35
  294. package/dist/client/bookings.mjs +19252 -15228
  295. package/dist/client/carousel-DCqjwd2s.mjs +71 -0
  296. package/dist/client/{carousel.client-GEtOGsxo.mjs → carousel.client-Bx7XMF8-.mjs} +114 -39
  297. package/dist/client/{cart-Yv-aAtck.mjs → cart-DWJXrQxs.mjs} +3 -3
  298. package/dist/client/{checkout-B9xDkl30.mjs → checkout-CH4ypSLS.mjs} +3 -3
  299. package/dist/client/client.mjs +13559 -7353
  300. package/dist/client/{context-BOGe3rIA.mjs → context-BOs0m_iw.mjs} +16 -12
  301. package/dist/client/{eventCalendar-D6M0T9hs.mjs → eventCalendar-CRylMllc.mjs} +8 -319
  302. package/dist/client/{eventCombined-NM4UFBq8.mjs → eventCombined-DohTS3kp.mjs} +4 -4
  303. package/dist/client/{eventDetails-f_FhV4O8.mjs → eventDetails-qf-u9zcF.mjs} +108 -36
  304. package/dist/client/{eventListing-WLkfAROh.mjs → eventListing-Cg__X2vy.mjs} +4 -4
  305. package/dist/client/{eventRegistration-D3ejfLvW.mjs → eventRegistration-CybWxswy.mjs} +215 -237
  306. package/dist/client/{form-D5Or2Jyu.mjs → form-C-SGk6nq.mjs} +115 -51
  307. package/dist/client/{headerSection-hWgnv27V.mjs → headerSection-BdzPaHqo.mjs} +3 -3
  308. package/dist/client/hooks.mjs +3280 -1362
  309. package/dist/client/{locationMap-Di1K0O2S.mjs → locationMap-CEwIKmMb.mjs} +3 -3
  310. package/dist/client/mailingListSignupCopy-DS-_ePzG.mjs +14 -0
  311. package/dist/client/{media-D29-F1u_.mjs → media-V_ShXXru.mjs} +3 -3
  312. package/dist/client/{mediaContext-CwbbimYB.mjs → mediaContext-D-0tNVxE.mjs} +1 -1
  313. package/dist/client/{newsletterForm-CwxcwTNO.mjs → newsletterForm-CmwTltoS.mjs} +52 -15
  314. package/dist/client/{productDetail-BLSnhPdA.mjs → productDetail-DjIzUwg3.mjs} +3 -3
  315. package/dist/client/{productList-oGytONOX.mjs → productList-D6JGFnMF.mjs} +3 -3
  316. package/dist/client/{propsDecoder-lf_dTeZS.mjs → propsDecoder-BRKz13eg.mjs} +17944 -14861
  317. package/dist/client/{renderableMediaAssetAdmission-CHkXYDC_.mjs → renderableMediaAssetAdmission-Cd3JSw2H.mjs} +3 -1
  318. package/dist/client/rendering/client.mjs +15893 -11685
  319. package/dist/client/rendering/islands.mjs +19 -19
  320. package/dist/client/rendering.mjs +14451 -8139
  321. package/dist/client/{routeIslandApiConfig-Bc_WVPS8.mjs → routeIslandApiConfig-slAAILQ5.mjs} +1 -1
  322. package/dist/client/{shop-BQ3bR7fA.mjs → shop-C45K96_0.mjs} +178 -157
  323. package/dist/client/{shop-commerce-DDPll6ZC.mjs → shop-commerce-oGBiKT5d.mjs} +23 -10
  324. package/dist/client/{shop-commerce-store-DO-e1pTe.mjs → shop-commerce-store-H_HFPFZ8.mjs} +1 -1
  325. package/dist/client/{shopShared-BylM9jh1.mjs → shopShared-D54T_LAV.mjs} +5 -5
  326. package/dist/client/{useDiscountCodeUi-B1Puub2v.mjs → useDiscountCodeUi-Dm2EUa03.mjs} +1 -1
  327. package/dist/client/{useEventPagination-BBhkmQaT.mjs → useEventPagination-0l_A8CxG.mjs} +62 -24
  328. package/dist/preview-next/before-render.mjs +134 -51
  329. package/dist/preview-next/client/runtime.mjs +3 -3
  330. package/dist/preview-next/editor-chrome.css +5 -2
  331. package/dist/preview-next/keepAlive.mjs +134 -51
  332. package/dist/preview-next/middleware.mjs +134 -51
  333. package/dist/{sdk-runtime-DWCvhJGu.mjs → sdk-runtime-CjTM32Ah.mjs} +1 -1
  334. package/dist/server/components.mjs +15231 -10855
  335. package/dist/server/config-validation.mjs +3153 -1323
  336. package/dist/server/config.mjs +3119 -1321
  337. package/dist/server/data.mjs +3201 -1329
  338. package/dist/server/date-time.mjs +270 -117
  339. package/dist/server/index.mjs +137 -52
  340. package/dist/server/next.mjs +14713 -10388
  341. package/dist/server/page-converter.mjs +2642 -1073
  342. package/dist/server/prebuild.mjs +1 -1
  343. package/dist/server/rendering/server.mjs +14674 -10630
  344. package/dist/server/rendering.mjs +15055 -10670
  345. package/dist/server/routing.mjs +3483 -1488
  346. package/dist/server/server.mjs +3620 -1740
  347. package/dist/server/theme-bridge.mjs +2694 -189
  348. package/dist/server/theme.mjs +422 -67
  349. package/dist/{spinner-BYM-Y81w.mjs → spinner-KVVZh8jd.mjs} +1 -1
  350. package/dist/src-BgmWy3P1.mjs +1667 -0
  351. package/dist/styles/index.css +1196 -2
  352. package/package.json +1 -1
  353. package/dist/_dts/blocks/src/system/blocks/events/shared/layout.d.ts +0 -12
  354. package/dist/client/CheckboxChoice-Dq30m3DO.mjs +0 -24
  355. package/dist/client/DemoBookingPortalAccess-ojwbVUmx.mjs +0 -344
  356. package/dist/client/ThemedButton-B7HFqFBg.mjs +0 -411
  357. package/dist/client/carousel-BSCBhfHY.mjs +0 -38
@@ -0,0 +1,1667 @@
1
+ "use client";
2
+ import { Ui as __exportAll } from "./ThemedButton-Bi0rgijy.mjs";
3
+ //#region ../calendar/src/grid.ts
4
+ const DAY_NAMES = [
5
+ "Sun",
6
+ "Mon",
7
+ "Tue",
8
+ "Wed",
9
+ "Thu",
10
+ "Fri",
11
+ "Sat"
12
+ ];
13
+ const MONTH_NAMES = [
14
+ "January",
15
+ "February",
16
+ "March",
17
+ "April",
18
+ "May",
19
+ "June",
20
+ "July",
21
+ "August",
22
+ "September",
23
+ "October",
24
+ "November",
25
+ "December"
26
+ ];
27
+ function formatDateKey(date) {
28
+ return `${String(date.year).padStart(4, "0")}-${String(date.month).padStart(2, "0")}-${String(date.day).padStart(2, "0")}`;
29
+ }
30
+ function isToday(date, today) {
31
+ return isSameCalendarDay(date, today);
32
+ }
33
+ function isSameCalendarDay(left, right) {
34
+ return left.year === right.year && left.month === right.month && left.day === right.day;
35
+ }
36
+ function addMonths(date, months) {
37
+ const target = new Date(Date.UTC(date.year, date.month - 1 + months, 1, 12));
38
+ const year = target.getUTCFullYear();
39
+ const month = target.getUTCMonth() + 1;
40
+ const lastDay = new Date(Date.UTC(year, month, 0, 12)).getUTCDate();
41
+ return {
42
+ year,
43
+ month,
44
+ day: Math.min(date.day, lastDay)
45
+ };
46
+ }
47
+ function addDays(date, days) {
48
+ const result = new Date(Date.UTC(date.year, date.month - 1, date.day + days, 12));
49
+ return {
50
+ year: result.getUTCFullYear(),
51
+ month: result.getUTCMonth() + 1,
52
+ day: result.getUTCDate()
53
+ };
54
+ }
55
+ function shiftCalendarAnchorDate(date, view, steps) {
56
+ return view === "week" ? addDays(date, steps * 7) : addMonths(date, steps);
57
+ }
58
+ function getMonthCalendarDays(year, month, startOfWeek) {
59
+ const firstDay = {
60
+ year,
61
+ month,
62
+ day: 1
63
+ };
64
+ const dayOfWeek = getDayOfWeek(firstDay);
65
+ const gridStart = addDays(firstDay, -(startOfWeek === "monday" ? dayOfWeek === 0 ? 6 : dayOfWeek - 1 : dayOfWeek));
66
+ return Array.from({ length: 42 }, (_, index) => addDays(gridStart, index));
67
+ }
68
+ function getWeekCalendarDays(baseDate, startOfWeek) {
69
+ const dayOfWeek = getDayOfWeek(baseDate);
70
+ const weekStart = addDays(baseDate, -(startOfWeek === "monday" ? dayOfWeek === 0 ? 6 : dayOfWeek - 1 : dayOfWeek));
71
+ return Array.from({ length: 7 }, (_, index) => addDays(weekStart, index));
72
+ }
73
+ function getDayOfWeek(date) {
74
+ return new Date(Date.UTC(date.year, date.month - 1, date.day, 12)).getUTCDay();
75
+ }
76
+ function getWeekCalendarDayTuple(baseDate, startOfWeek) {
77
+ const days = getWeekCalendarDays(baseDate, startOfWeek);
78
+ assertWeekCalendarDays(days);
79
+ return days;
80
+ }
81
+ function assertWeekCalendarDays(days) {
82
+ if (days.length !== 7) throw new Error("Expected exactly 7 calendar days");
83
+ }
84
+ function getOrderedDayNames(startOfWeek, dayNames = DAY_NAMES) {
85
+ if (startOfWeek === "monday") {
86
+ const sunday = dayNames[0] ?? "Sun";
87
+ return [...dayNames.slice(1), sunday];
88
+ }
89
+ return [...dayNames];
90
+ }
91
+ function formatCalendarTitle(viewDate, view, days, monthNames = MONTH_NAMES) {
92
+ if (view === "week") {
93
+ const weekStart = days[0];
94
+ const weekEnd = days[6];
95
+ if (weekStart === void 0 || weekEnd === void 0) return `${monthNames[viewDate.month - 1] ?? ""} ${viewDate.year}`;
96
+ const startMonth = monthNames[weekStart.month - 1] ?? "";
97
+ const endMonth = monthNames[weekEnd.month - 1] ?? "";
98
+ if (weekStart.month === weekEnd.month) return `${startMonth} ${weekStart.day} - ${weekEnd.day}, ${weekEnd.year}`;
99
+ return `${startMonth} ${weekStart.day} - ${endMonth} ${weekEnd.day}, ${weekEnd.year}`;
100
+ }
101
+ return `${monthNames[viewDate.month - 1] ?? ""} ${viewDate.year}`;
102
+ }
103
+ function buildCalendarViewport(input) {
104
+ const monthNames = input.monthNames ?? MONTH_NAMES;
105
+ if (input.view === "week") {
106
+ const days = getWeekCalendarDayTuple(input.anchorDate, input.startOfWeek);
107
+ return {
108
+ kind: "week",
109
+ anchorDate: input.anchorDate,
110
+ days,
111
+ title: formatCalendarTitle(input.anchorDate, "week", days, monthNames)
112
+ };
113
+ }
114
+ const days = getMonthCalendarDays(input.anchorDate.year, input.anchorDate.month, input.startOfWeek);
115
+ return {
116
+ kind: "month",
117
+ anchorDate: input.anchorDate,
118
+ days,
119
+ title: formatCalendarTitle(input.anchorDate, "month", days, monthNames)
120
+ };
121
+ }
122
+ //#endregion
123
+ //#region ../calendar/src/lane-packing.ts
124
+ /**
125
+ * Assign lanes to a list of intervals.
126
+ *
127
+ * Returns one result per input in the same order as the input. Internally
128
+ * sorts a copy by `(start, end, orderKey)` to ensure determinism, then
129
+ * permutes results back to input order.
130
+ */
131
+ function assignLanes(intervals) {
132
+ if (intervals.length === 0) return [];
133
+ const indexed = intervals.map((interval, index) => ({
134
+ interval,
135
+ index
136
+ }));
137
+ indexed.sort((left, right) => left.interval.start - right.interval.start || left.interval.end - right.interval.end || left.interval.orderKey.localeCompare(right.interval.orderKey));
138
+ const results = new Array(intervals.length);
139
+ let cluster = [];
140
+ let activeLaneEnds = [];
141
+ let clusterMaxEnd = -Infinity;
142
+ const closeCluster = () => {
143
+ if (cluster.length === 0) return;
144
+ const laneCount = Math.max(1, cluster.reduce((max, entry) => Math.max(max, entry.laneIndex + 1), 0));
145
+ for (const entry of cluster) results[entry.index] = {
146
+ laneIndex: entry.laneIndex,
147
+ laneCount
148
+ };
149
+ cluster = [];
150
+ activeLaneEnds = [];
151
+ clusterMaxEnd = -Infinity;
152
+ };
153
+ for (const { interval, index } of indexed) {
154
+ if (interval.start >= clusterMaxEnd) closeCluster();
155
+ const laneIndex = firstAvailableLane(activeLaneEnds, interval.start);
156
+ activeLaneEnds[laneIndex] = interval.end;
157
+ clusterMaxEnd = Math.max(clusterMaxEnd, interval.end);
158
+ cluster.push({
159
+ index,
160
+ laneIndex
161
+ });
162
+ }
163
+ closeCluster();
164
+ return results;
165
+ }
166
+ function firstAvailableLane(activeLaneEnds, start) {
167
+ const laneIndex = activeLaneEnds.findIndex((end) => end <= start);
168
+ return laneIndex >= 0 ? laneIndex : activeLaneEnds.length;
169
+ }
170
+ //#endregion
171
+ //#region ../calendar/src/timezone.ts
172
+ /**
173
+ * Timezone boundary helpers — internal.
174
+ *
175
+ * Both functions read an ISO instant in a given IANA timezone and project it
176
+ * onto the wall clock of that zone. They use Intl.DateTimeFormat with
177
+ * hourCycle: 'h23' to avoid 12/24-hour ambiguity. Used internally by the
178
+ * timetable model and `groupItemsByDate`; not exported from the package's
179
+ * public surface.
180
+ */
181
+ const MINUTES_PER_HOUR = 60;
182
+ /**
183
+ * Local minute-of-day [0, 24*60) for an ISO instant in the given zone.
184
+ * Returns NaN if the inputs cannot be parsed (caller should drop the item).
185
+ */
186
+ function getLocalMinuteOfDay(isoTimestamp, timeZone) {
187
+ const date = new Date(isoTimestamp);
188
+ if (Number.isNaN(date.getTime())) return NaN;
189
+ if (!isValidTimeZone(timeZone)) return NaN;
190
+ const parts = new Intl.DateTimeFormat("en-GB", {
191
+ timeZone,
192
+ hour: "2-digit",
193
+ minute: "2-digit",
194
+ hourCycle: "h23"
195
+ }).formatToParts(date);
196
+ const hourPart = Number(parts.find((part) => part.type === "hour")?.value);
197
+ const minute = Number(parts.find((part) => part.type === "minute")?.value);
198
+ const hour = hourPart === 24 ? 0 : hourPart;
199
+ if (Number.isNaN(hour) || Number.isNaN(minute)) return NaN;
200
+ return hour * MINUTES_PER_HOUR + minute;
201
+ }
202
+ /**
203
+ * Local YYYY-MM-DD for an ISO instant in the given zone.
204
+ * Returns null if the inputs cannot be parsed.
205
+ */
206
+ function getLocalDateKey(isoTimestamp, timeZone) {
207
+ const date = new Date(isoTimestamp);
208
+ if (Number.isNaN(date.getTime())) return null;
209
+ if (!isValidTimeZone(timeZone)) return null;
210
+ const parts = new Intl.DateTimeFormat("en-CA", {
211
+ timeZone,
212
+ year: "numeric",
213
+ month: "2-digit",
214
+ day: "2-digit"
215
+ }).formatToParts(date);
216
+ const year = parts.find((part) => part.type === "year")?.value;
217
+ const month = parts.find((part) => part.type === "month")?.value;
218
+ const day = parts.find((part) => part.type === "day")?.value;
219
+ if (year === void 0 || year.length === 0) return null;
220
+ if (month === void 0 || month.length === 0) return null;
221
+ if (day === void 0 || day.length === 0) return null;
222
+ return `${year}-${month}-${day}`;
223
+ }
224
+ const validTimeZoneCache = /* @__PURE__ */ new Map();
225
+ function isValidTimeZone(timeZone) {
226
+ if (typeof timeZone !== "string" || timeZone.length === 0) return false;
227
+ const cached = validTimeZoneCache.get(timeZone);
228
+ if (cached !== void 0) return cached;
229
+ try {
230
+ new Intl.DateTimeFormat("en-US", { timeZone });
231
+ validTimeZoneCache.set(timeZone, true);
232
+ return true;
233
+ } catch {
234
+ validTimeZoneCache.set(timeZone, false);
235
+ return false;
236
+ }
237
+ }
238
+ //#endregion
239
+ //#region ../calendar/src/timetable.ts
240
+ /**
241
+ * Timetable model — the package's core surface.
242
+ *
243
+ * Generic over `T`. Takes a list of timed items + a viewport; returns a
244
+ * day-by-day layout with overlap-packed lanes and percent-based positions
245
+ * plus a diagnostics list for items dropped during processing.
246
+ *
247
+ * The function is pure: given identical input (including `now`), it returns
248
+ * the same output. The model has no opinion on what an item is — pass
249
+ * accessors.
250
+ */
251
+ const DEFAULT_BOUNDS = {
252
+ minStartHour: 5,
253
+ maxEndHour: 23,
254
+ defaultStartHour: 6,
255
+ defaultEndHour: 21,
256
+ minHeightPercent: 2.5
257
+ };
258
+ function buildTimetableModel(input) {
259
+ const bounds = resolveBounds(input.bounds);
260
+ const viewportDays = getTimetableDays(input.viewDate, input.view ?? "week", input.startOfWeek);
261
+ const viewportKeys = new Set(viewportDays.map(formatDateKey));
262
+ const parsed = parseAllItems(input.items, input);
263
+ const inViewport = deriveVisibleSegments(parsed.drafts, viewportKeys);
264
+ const hourRange = resolveHourRange(inViewport, bounds);
265
+ const laid = layoutCellsByDate(inViewport, hourRange, bounds);
266
+ return {
267
+ days: assembleDays(viewportDays, laid.cellsByDate, input.today),
268
+ hourTicks: buildHourTicks(hourRange.startHour, hourRange.endHour),
269
+ startHour: hourRange.startHour,
270
+ endHour: hourRange.endHour,
271
+ rangeMinutes: (hourRange.endHour - hourRange.startHour) * 60,
272
+ hasItems: inViewport.length > 0,
273
+ diagnostics: [...parsed.diagnostics, ...laid.diagnostics]
274
+ };
275
+ }
276
+ function parseAllItems(items, accessors) {
277
+ const drafts = [];
278
+ const diagnostics = [];
279
+ for (const item of items) {
280
+ const result = parseDraft(item, accessors);
281
+ if (result.ok) drafts.push(result.draft);
282
+ else diagnostics.push({
283
+ item,
284
+ reason: result.reason
285
+ });
286
+ }
287
+ return {
288
+ drafts,
289
+ diagnostics
290
+ };
291
+ }
292
+ function layoutCellsByDate(segments, hourRange, bounds) {
293
+ const rangeMinutes = (hourRange.endHour - hourRange.startHour) * 60;
294
+ const rangeStartMinutes = hourRange.startHour * 60;
295
+ const rangeEndMinutes = hourRange.endHour * 60;
296
+ const segmentsByDate = groupSegmentsByDate(segments);
297
+ const cellsByDate = /* @__PURE__ */ new Map();
298
+ const diagnostics = [];
299
+ for (const [dateKey, daySegments] of segmentsByDate) {
300
+ const clipped = [];
301
+ for (const segment of daySegments) {
302
+ const result = clipDraft(segment, rangeStartMinutes, rangeEndMinutes);
303
+ if (result.ok) clipped.push(result.clipped);
304
+ else diagnostics.push({
305
+ item: segment.draft.item,
306
+ reason: result.reason
307
+ });
308
+ }
309
+ const laneResults = assignLanes(clipped.map((entry) => ({
310
+ start: entry.visibleStart,
311
+ end: entry.visibleEnd,
312
+ orderKey: entry.segment.draft.orderKey
313
+ })));
314
+ cellsByDate.set(dateKey, clipped.map((entry, idx) => buildCell(entry, laneResults[idx] ?? {
315
+ laneIndex: 0,
316
+ laneCount: 1
317
+ }, rangeStartMinutes, rangeMinutes, bounds.minHeightPercent)));
318
+ }
319
+ return {
320
+ cellsByDate,
321
+ diagnostics
322
+ };
323
+ }
324
+ function assembleDays(viewportDays, cellsByDate, today) {
325
+ return viewportDays.map((date) => {
326
+ const dateKey = formatDateKey(date);
327
+ return {
328
+ date,
329
+ dateKey,
330
+ isToday: isSameCalendarDay(date, today),
331
+ cells: cellsByDate.get(dateKey) ?? []
332
+ };
333
+ });
334
+ }
335
+ function parseDraft(item, accessors) {
336
+ const startsAtIso = accessors.getStartsAt(item);
337
+ const endsAtIso = accessors.getEndsAt(item);
338
+ const timeZone = accessors.getTimeZone(item);
339
+ const startsAtMinutes = getLocalMinuteOfDay(startsAtIso, timeZone);
340
+ if (Number.isNaN(startsAtMinutes)) return {
341
+ ok: false,
342
+ reason: "invalid-start"
343
+ };
344
+ const startDateKey = getLocalDateKey(startsAtIso, timeZone);
345
+ if (startDateKey == null) return {
346
+ ok: false,
347
+ reason: "invalid-timezone"
348
+ };
349
+ const endDateKey = getLocalDateKey(endsAtIso, timeZone);
350
+ if (endDateKey == null) return {
351
+ ok: false,
352
+ reason: "invalid-end"
353
+ };
354
+ const endsAtMinutesRaw = getLocalMinuteOfDay(endsAtIso, timeZone);
355
+ if (Number.isNaN(endsAtMinutesRaw)) return {
356
+ ok: false,
357
+ reason: "invalid-end"
358
+ };
359
+ const spansMultipleDays = startDateKey < endDateKey;
360
+ const endsAtMinutes = spansMultipleDays || endsAtMinutesRaw > startsAtMinutes ? endsAtMinutesRaw : Math.min(1440, startsAtMinutes + 60);
361
+ if (!spansMultipleDays && endsAtMinutes <= startsAtMinutes) return {
362
+ ok: false,
363
+ reason: "non-positive-duration"
364
+ };
365
+ return {
366
+ ok: true,
367
+ draft: {
368
+ item,
369
+ startDateKey,
370
+ endDateKey,
371
+ startsAtMinutes,
372
+ endsAtMinutes,
373
+ color: accessors.getColor?.(item) ?? null,
374
+ orderKey: accessors.getOrderKey?.(item) ?? accessors.getId(item)
375
+ }
376
+ };
377
+ }
378
+ function deriveVisibleSegments(drafts, viewportKeys) {
379
+ const segments = [];
380
+ for (const draft of drafts) for (const dateKey of enumerateDateKeys(draft.startDateKey, draft.endDateKey)) {
381
+ if (!viewportKeys.has(dateKey)) continue;
382
+ const isStartDay = dateKey === draft.startDateKey;
383
+ const isEndDay = dateKey === draft.endDateKey;
384
+ const startsAtMinutes = isStartDay ? draft.startsAtMinutes : 0;
385
+ const endsAtMinutes = isEndDay ? draft.endsAtMinutes : 1440;
386
+ if (endsAtMinutes <= startsAtMinutes) continue;
387
+ segments.push({
388
+ draft,
389
+ dateKey,
390
+ startsAtMinutes,
391
+ endsAtMinutes,
392
+ continuesBefore: !isStartDay,
393
+ continuesAfter: !isEndDay
394
+ });
395
+ }
396
+ return segments;
397
+ }
398
+ function clipDraft(segment, rangeStartMinutes, rangeEndMinutes) {
399
+ const visibleStart = Math.max(rangeStartMinutes, segment.startsAtMinutes);
400
+ const visibleEnd = Math.min(rangeEndMinutes, segment.endsAtMinutes);
401
+ if (visibleEnd <= visibleStart) return {
402
+ ok: false,
403
+ reason: "out-of-visible-hours"
404
+ };
405
+ return {
406
+ ok: true,
407
+ clipped: {
408
+ segment,
409
+ visibleStart,
410
+ visibleEnd
411
+ }
412
+ };
413
+ }
414
+ function buildCell(entry, lane, rangeStartMinutes, rangeMinutes, minHeightPercent) {
415
+ const heightPercent = Math.max(minHeightPercent, toRangePercent(entry.visibleEnd - entry.visibleStart, rangeMinutes));
416
+ const rawTopPercent = toRangePercent(entry.visibleStart - rangeStartMinutes, rangeMinutes);
417
+ const topPercent = Math.min(rawTopPercent, 100 - heightPercent);
418
+ return {
419
+ item: entry.segment.draft.item,
420
+ dateKey: entry.segment.dateKey,
421
+ startsAtMinutes: entry.segment.startsAtMinutes,
422
+ endsAtMinutes: entry.segment.endsAtMinutes,
423
+ visibleStartsAtMinutes: entry.visibleStart,
424
+ visibleEndsAtMinutes: entry.visibleEnd,
425
+ topPercent,
426
+ heightPercent,
427
+ isClippedStart: entry.segment.continuesBefore || entry.segment.startsAtMinutes < entry.visibleStart,
428
+ isClippedEnd: entry.segment.continuesAfter || entry.segment.endsAtMinutes > entry.visibleEnd,
429
+ laneIndex: lane.laneIndex,
430
+ laneCount: lane.laneCount,
431
+ color: entry.segment.draft.color
432
+ };
433
+ }
434
+ function resolveBounds(bounds) {
435
+ return {
436
+ minStartHour: bounds?.minStartHour ?? DEFAULT_BOUNDS.minStartHour,
437
+ maxEndHour: bounds?.maxEndHour ?? DEFAULT_BOUNDS.maxEndHour,
438
+ defaultStartHour: bounds?.defaultStartHour ?? DEFAULT_BOUNDS.defaultStartHour,
439
+ defaultEndHour: bounds?.defaultEndHour ?? DEFAULT_BOUNDS.defaultEndHour,
440
+ minHeightPercent: bounds?.minHeightPercent ?? DEFAULT_BOUNDS.minHeightPercent
441
+ };
442
+ }
443
+ function resolveHourRange(segments, bounds) {
444
+ if (segments.length === 0) return {
445
+ startHour: bounds.defaultStartHour,
446
+ endHour: bounds.defaultEndHour
447
+ };
448
+ const earliestStart = Math.min(...segments.map((segment) => segment.startsAtMinutes));
449
+ const latestEnd = Math.max(...segments.map((segment) => segment.endsAtMinutes));
450
+ const startHour = Math.max(bounds.minStartHour, Math.floor(earliestStart / 60));
451
+ const endHour = Math.min(bounds.maxEndHour, Math.ceil(latestEnd / 60));
452
+ return {
453
+ startHour,
454
+ endHour: Math.max(startHour + 1, endHour)
455
+ };
456
+ }
457
+ function buildHourTicks(startHour, endHour) {
458
+ const ticks = [];
459
+ for (let hour = startHour; hour <= endHour; hour += 1) ticks.push(hour);
460
+ return ticks;
461
+ }
462
+ function groupSegmentsByDate(segments) {
463
+ const grouped = /* @__PURE__ */ new Map();
464
+ for (const segment of segments) {
465
+ const existing = grouped.get(segment.dateKey) ?? [];
466
+ existing.push(segment);
467
+ grouped.set(segment.dateKey, existing);
468
+ }
469
+ return grouped;
470
+ }
471
+ function toRangePercent(minutes, rangeMinutes) {
472
+ if (rangeMinutes <= 0) return 0;
473
+ return minutes / rangeMinutes * 100;
474
+ }
475
+ function getTimetableDays(viewDate, view, startOfWeek) {
476
+ if (view === "day") return [viewDate];
477
+ return getWeekCalendarDays(viewDate, startOfWeek);
478
+ }
479
+ function enumerateDateKeys(startDateKey, endDateKey) {
480
+ if (startDateKey > endDateKey) throw new Error(`Invalid timetable date range: ${startDateKey} is after ${endDateKey}`);
481
+ const start = parseDateKey(startDateKey);
482
+ parseDateKey(endDateKey);
483
+ const keys = [];
484
+ let cursor = start;
485
+ while (formatDateKey(cursor) <= endDateKey) {
486
+ keys.push(formatDateKey(cursor));
487
+ cursor = addDays(cursor, 1);
488
+ }
489
+ return keys;
490
+ }
491
+ function parseDateKey(dateKey) {
492
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(dateKey);
493
+ if (match === null) throw new Error(`Invalid timetable date key: ${dateKey}`);
494
+ const [, year, month, day] = match;
495
+ return {
496
+ year: Number(year),
497
+ month: Number(month),
498
+ day: Number(day)
499
+ };
500
+ }
501
+ //#endregion
502
+ //#region ../calendar/src/group.ts
503
+ /**
504
+ * Group items by their local date (YYYY-MM-DD in the item's own timezone).
505
+ *
506
+ * Generic over `T`. Items with un-parseable startsAt or invalid timezone are
507
+ * silently dropped — call sites that need diagnostics should validate upstream.
508
+ *
509
+ * The output map preserves insertion order of dates (ES2015 spec) and the
510
+ * relative order of items within each date matches input order.
511
+ */
512
+ function groupItemsByDate(items, accessors) {
513
+ const grouped = /* @__PURE__ */ new Map();
514
+ for (const item of items) {
515
+ const dateKey = getLocalDateKey(accessors.getStartsAt(item), accessors.getTimeZone(item));
516
+ if (dateKey == null) continue;
517
+ const existing = grouped.get(dateKey);
518
+ if (existing !== void 0) existing.push(item);
519
+ else grouped.set(dateKey, [item]);
520
+ }
521
+ return grouped;
522
+ }
523
+ //#endregion
524
+ //#region ../../node_modules/.pnpm/@date-fns+tz@1.5.0/node_modules/@date-fns/tz/tzName/index.js
525
+ /**
526
+ * Time zone name format.
527
+ */
528
+ /**
529
+ * The function returns the time zone name for the given date in the specified
530
+ * time zone.
531
+ *
532
+ * It uses the `Intl.DateTimeFormat` API and by default outputs the time zone
533
+ * name in a long format, e.g. "Pacific Standard Time" or
534
+ * "Singapore Standard Time".
535
+ *
536
+ * It is possible to specify the format as the third argument using one of the following options
537
+ *
538
+ * - "short": e.g. "EDT" or "GMT+8".
539
+ * - "long": e.g. "Eastern Daylight Time".
540
+ * - "shortGeneric": e.g. "ET" or "Singapore Time".
541
+ * - "longGeneric": e.g. "Eastern Time" or "Singapore Standard Time".
542
+ *
543
+ * These options correspond to TR35 tokens `z..zzz`, `zzzz`, `v`, and `vvvv` respectively: https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone
544
+ *
545
+ * @param timeZone - Time zone name (IANA or UTC offset)
546
+ * @param date - Date object to get the time zone name for
547
+ * @param format - Optional format of the time zone name. Defaults to "long". Can be "short", "long", "shortGeneric", or "longGeneric".
548
+ *
549
+ * @returns Time zone name (e.g. "Singapore Standard Time")
550
+ */
551
+ function tzName(timeZone, date, format = "long") {
552
+ return new Intl.DateTimeFormat("en-US", {
553
+ hour: "numeric",
554
+ timeZone,
555
+ timeZoneName: format
556
+ }).format(date).split(/\s/g).slice(2).join(" ");
557
+ }
558
+ //#endregion
559
+ //#region ../../node_modules/.pnpm/@date-fns+tz@1.5.0/node_modules/@date-fns/tz/tzOffset/index.js
560
+ const offsetFormatCache = {};
561
+ const offsetCache = {};
562
+ /**
563
+ * The function returns UTC offset in minutes for the given date in specified
564
+ * time zone.
565
+ *
566
+ * Unlike `Date.prototype.getTimezoneOffset`, this function returns the value
567
+ * mirrored to the sign of the offset in the time zone. For Asia/Singapore
568
+ * (UTC+8), `tzOffset` returns `480`, while `getTimezoneOffset` returns `-480`.
569
+ *
570
+ * It uses `Intl.DateTimeFormat` internally to access otherwise unavailable
571
+ * runtime's time zone data, and falls back to basic manual parsing if Intl API
572
+ * is not supported (e.g., older Node.js versions, React Native's Hermes, etc.).
573
+ *
574
+ * @param timeZone - Time zone name (IANA or UTC offset).
575
+ * @param date - Date to check the offset for.
576
+ *
577
+ * @returns UTC offset in minutes (e.g., `480` for date in UTC+8).
578
+ */
579
+ function tzOffset(timeZone, date) {
580
+ try {
581
+ const offsetStr = (offsetFormatCache[timeZone] || (offsetFormatCache[timeZone] = new Intl.DateTimeFormat("en-US", {
582
+ timeZone,
583
+ timeZoneName: "longOffset"
584
+ }).format))(date).split("GMT")[1];
585
+ if (offsetStr in offsetCache) return offsetCache[offsetStr];
586
+ return calcOffset(offsetStr, offsetStr.split(":"));
587
+ } catch {
588
+ if (timeZone in offsetCache) return offsetCache[timeZone];
589
+ const captures = timeZone?.match(offsetRe);
590
+ if (captures) return calcOffset(timeZone, captures.slice(1));
591
+ return NaN;
592
+ }
593
+ }
594
+ const offsetRe = /([+-]\d\d):?(\d\d)?/;
595
+ function calcOffset(cacheStr, values) {
596
+ const hours = +(values[0] || 0);
597
+ const minutes = +(values[1] || 0);
598
+ const seconds = +(values[2] || 0) / 60;
599
+ return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
600
+ }
601
+ //#endregion
602
+ //#region ../../node_modules/.pnpm/@date-fns+tz@1.5.0/node_modules/@date-fns/tz/date/mini.js
603
+ var TZDateMini = class TZDateMini extends Date {
604
+ constructor(...args) {
605
+ super();
606
+ if (args.length > 1 && typeof args[args.length - 1] === "string") this.timeZone = args.pop();
607
+ this.internal = /* @__PURE__ */ new Date();
608
+ if (isNaN(tzOffset(this.timeZone, this))) this.setTime(NaN);
609
+ else if (!args.length) this.setTime(Date.now());
610
+ else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) this.setTime(args[0]);
611
+ else if (typeof args[0] === "string") this.setTime(+new Date(args[0]));
612
+ else if (args[0] instanceof Date) this.setTime(+args[0]);
613
+ else {
614
+ this.setTime(+new Date(...args));
615
+ adjustToSystemTZ(this, args);
616
+ }
617
+ }
618
+ static tz(tz, ...args) {
619
+ return args.length ? new TZDateMini(...args, tz) : new TZDateMini(Date.now(), tz);
620
+ }
621
+ withTimeZone(timeZone) {
622
+ return new TZDateMini(+this, timeZone);
623
+ }
624
+ getTimezoneOffset() {
625
+ const offset = -tzOffset(this.timeZone, this);
626
+ return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
627
+ }
628
+ setTime(_time) {
629
+ Date.prototype.setTime.apply(this, arguments);
630
+ syncToInternal(this);
631
+ return +this;
632
+ }
633
+ [Symbol.for("constructDateFrom")](date) {
634
+ return new TZDateMini(+new Date(date), this.timeZone);
635
+ }
636
+ };
637
+ const re = /^(get|set)(?!UTC)/;
638
+ Object.getOwnPropertyNames(Date.prototype).forEach((method) => {
639
+ if (!re.test(method)) return;
640
+ const utcMethod = method.replace(re, "$1UTC");
641
+ if (!TZDateMini.prototype[utcMethod]) return;
642
+ if (method.startsWith("get")) TZDateMini.prototype[method] = function() {
643
+ return this.internal[utcMethod]();
644
+ };
645
+ else {
646
+ TZDateMini.prototype[method] = function() {
647
+ Date.prototype[utcMethod].apply(this.internal, arguments);
648
+ syncFromInternal(this);
649
+ return +this;
650
+ };
651
+ TZDateMini.prototype[utcMethod] = function() {
652
+ Date.prototype[utcMethod].apply(this, arguments);
653
+ syncToInternal(this);
654
+ return +this;
655
+ };
656
+ }
657
+ });
658
+ /**
659
+ * @internal
660
+ * Function syncs time to internal date, applying the current time zone offset.
661
+ *
662
+ * @param {Date} date - `Date` to sync
663
+ */
664
+ function syncToInternal(date) {
665
+ date.internal.setTime(+date);
666
+ date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
667
+ }
668
+ /**
669
+ * @internal
670
+ * Function syncs internal wall-clock fields into the external date.
671
+ *
672
+ * @param {Date} date - The date to sync
673
+ */
674
+ function syncFromInternal(date) {
675
+ Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
676
+ Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
677
+ adjustToSystemTZ(date);
678
+ }
679
+ /**
680
+ * @internal
681
+ * Function adjusts the date to the system time zone. It uses the time zone
682
+ * differences to calculate the offset and adjust the date.
683
+ *
684
+ * We use it when constructing `TZDate` and syncing the external date from
685
+ * the internal one.
686
+ *
687
+ * @param {TZDate} date - `TZDate` to adjust.
688
+ */
689
+ function adjustToSystemTZ(date, constructorArgs) {
690
+ const expectedInternalTime = Array.isArray(constructorArgs) ? constructorArgsToInternalTime(constructorArgs) : +date.internal;
691
+ const offsetWithSeconds = tzOffset(date.timeZone, date);
692
+ const offset = offsetWithSeconds > 0 ? Math.floor(offsetWithSeconds) : Math.ceil(offsetWithSeconds);
693
+ const prevHour = /* @__PURE__ */ new Date(+date);
694
+ prevHour.setUTCHours(prevHour.getUTCHours() - 1);
695
+ const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
696
+ const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset();
697
+ const systemDSTChange = systemOffset - prevHourSystemOffset;
698
+ let systemOffsetForDiff = systemOffset;
699
+ if (systemDSTChange && systemOffset !== offset) {
700
+ if (Date.prototype.getHours.apply(date) !== (Array.isArray(constructorArgs) ? constructorArgs[3] || 0 : date.internal.getUTCHours())) {
701
+ const testDate = /* @__PURE__ */ new Date(+date);
702
+ const testOffsetDiff = systemOffset - offset;
703
+ if (testOffsetDiff) testDate.setUTCMinutes(testDate.getUTCMinutes() + testOffsetDiff);
704
+ const testOffsetWithSeconds = tzOffset(date.timeZone, testDate);
705
+ if ((testOffsetWithSeconds > 0 ? Math.floor(testOffsetWithSeconds) : Math.ceil(testOffsetWithSeconds)) === offset) systemOffsetForDiff = prevHourSystemOffset;
706
+ }
707
+ }
708
+ const offsetDiff = systemOffsetForDiff - offset;
709
+ if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
710
+ const systemDate = /* @__PURE__ */ new Date(+date);
711
+ systemDate.setUTCSeconds(0);
712
+ const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
713
+ const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
714
+ if (secondsOffset || systemSecondsOffset) Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
715
+ const postOffsetWithSeconds = tzOffset(date.timeZone, date);
716
+ const postOffset = postOffsetWithSeconds > 0 ? Math.floor(postOffsetWithSeconds) : Math.ceil(postOffsetWithSeconds);
717
+ const postOffsetDiff = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset() - postOffset;
718
+ const offsetChanged = postOffset !== offset;
719
+ const postDiff = postOffsetDiff - offsetDiff;
720
+ const targetDSTShift = postOffset - offset;
721
+ const postOffsetCandidate = expectedInternalTime - postOffset * 60 * 1e3;
722
+ const normalizedTargetDSTGap = targetDSTShift > 0 && targetInternalTime(date) - expectedInternalTime === targetDSTShift * 60 * 1e3 && targetInternalTime(date, postOffsetCandidate) !== expectedInternalTime;
723
+ if (offsetChanged && postDiff && !normalizedTargetDSTGap) {
724
+ Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
725
+ const newOffsetWithSeconds = tzOffset(date.timeZone, date);
726
+ const offsetChange = postOffset - (newOffsetWithSeconds > 0 ? Math.floor(newOffsetWithSeconds) : Math.ceil(newOffsetWithSeconds));
727
+ if (offsetChange && postDiff < 0) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
728
+ }
729
+ syncToInternal(date);
730
+ const drift = (constructorArgs ? expectedInternalTime : expectedInternalTime + secondsOffset * 1e3) - +date.internal;
731
+ if (drift && Math.abs(drift) < 1800 * 1e3) {
732
+ Date.prototype.setTime.call(date, +date + drift);
733
+ syncToInternal(date);
734
+ }
735
+ }
736
+ function constructorArgsToInternalTime(args) {
737
+ return Date.UTC(args[0], args.length > 1 ? args[1] : 0, args.length > 2 ? args[2] : 1, ...args.slice(3));
738
+ }
739
+ function targetInternalTime(date, time) {
740
+ const internal = new Date(time ?? +date);
741
+ internal.setUTCSeconds(internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, internal) * 60));
742
+ return +internal;
743
+ }
744
+ //#endregion
745
+ //#region ../../node_modules/.pnpm/@date-fns+tz@1.5.0/node_modules/@date-fns/tz/date/index.js
746
+ var TZDate = class TZDate extends TZDateMini {
747
+ static tz(tz, ...args) {
748
+ return args.length ? new TZDate(...args, tz) : new TZDate(Date.now(), tz);
749
+ }
750
+ toISOString() {
751
+ const [sign, hours, minutes] = this.tzComponents();
752
+ const tz = `${sign}${hours}:${minutes}`;
753
+ return this.internal.toISOString().slice(0, -1) + tz;
754
+ }
755
+ toString() {
756
+ return `${this.toDateString()} ${this.toTimeString()}`;
757
+ }
758
+ toDateString() {
759
+ const [day, date, month, year] = this.internal.toUTCString().split(" ");
760
+ return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
761
+ }
762
+ toTimeString() {
763
+ const time = this.internal.toUTCString().split(" ")[4];
764
+ const [sign, hours, minutes] = this.tzComponents();
765
+ return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
766
+ }
767
+ toLocaleString(locales, options) {
768
+ return Date.prototype.toLocaleString.call(this, locales, {
769
+ ...options,
770
+ timeZone: options?.timeZone || this.timeZone
771
+ });
772
+ }
773
+ toLocaleDateString(locales, options) {
774
+ return Date.prototype.toLocaleDateString.call(this, locales, {
775
+ ...options,
776
+ timeZone: options?.timeZone || this.timeZone
777
+ });
778
+ }
779
+ toLocaleTimeString(locales, options) {
780
+ return Date.prototype.toLocaleTimeString.call(this, locales, {
781
+ ...options,
782
+ timeZone: options?.timeZone || this.timeZone
783
+ });
784
+ }
785
+ tzComponents() {
786
+ const offset = this.getTimezoneOffset();
787
+ return [
788
+ offset > 0 ? "-" : "+",
789
+ String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0"),
790
+ String(Math.abs(offset) % 60).padStart(2, "0")
791
+ ];
792
+ }
793
+ withTimeZone(timeZone) {
794
+ return new TZDate(+this, timeZone);
795
+ }
796
+ [Symbol.for("constructDateFrom")](date) {
797
+ return new TZDate(+new Date(date), this.timeZone);
798
+ }
799
+ };
800
+ //#endregion
801
+ //#region ../../node_modules/.pnpm/ical-generator@10.2.0_@touch4it+ical-timezones@1.9.0_@types+node@22.18.5/node_modules/ical-generator/dist/index.mjs
802
+ let e = function(e) {
803
+ return e.DAILY = `DAILY`, e.HOURLY = `HOURLY`, e.MINUTELY = `MINUTELY`, e.MONTHLY = `MONTHLY`, e.SECONDLY = `SECONDLY`, e.WEEKLY = `WEEKLY`, e.YEARLY = `YEARLY`, e;
804
+ }({});
805
+ (function(e) {
806
+ return e.AUTOMATIC = `AUTOMATIC`, e.DISABLED = `DISABLED`, e.ENABLED = `ENABLED`, e;
807
+ })({});
808
+ (function(e) {
809
+ return e.BICYCLE = `BICYCLE`, e.CAR = `CAR`, e.TRANSIT = `TRANSIT`, e.WALKING = `WALKING`, e;
810
+ })({});
811
+ let r = function(e) {
812
+ return e.FR = `FR`, e.MO = `MO`, e.SA = `SA`, e.SU = `SU`, e.TH = `TH`, e.TU = `TU`, e.WE = `WE`, e;
813
+ }({});
814
+ function i(e, t, n) {
815
+ if (Array.isArray(t)) e.x = t.map((e) => {
816
+ if (Array.isArray(e)) return e;
817
+ if (typeof e.key != `string` || typeof e.value != `string`) throw Error(`Either key or value is not a string!`);
818
+ if (e.key.substr(0, 2) !== `X-`) throw Error("Key has to start with `X-`!");
819
+ return [e.key, e.value];
820
+ });
821
+ else if (typeof t == `object`) e.x = Object.entries(t).map(([e, t]) => {
822
+ if (typeof e != `string` || typeof t != `string`) throw Error(`Either key or value is not a string!`);
823
+ if (e.substr(0, 2) !== `X-`) throw Error("Key has to start with `X-`!");
824
+ return [e, t];
825
+ });
826
+ else if (typeof t == `string` && typeof n == `string`) {
827
+ if (t.substr(0, 2) !== `X-`) throw Error("Key has to start with `X-`!");
828
+ e.x.push([t, n]);
829
+ } else return e.x.map((e) => ({
830
+ key: e[0],
831
+ value: e[1]
832
+ }));
833
+ }
834
+ function a(e, t) {
835
+ if (e instanceof Date && isNaN(e.getTime()) || typeof e == `string` && isNaN(new Date(e).getTime())) throw Error(`\`${t}\` has to be a valid date!`);
836
+ if (e instanceof Date || typeof e == `string` || typeof e == `object` && e && (C(e) || S(e) || x(e) || b(e)) || m(e) && e.isValid === !0 || (h(e) || p(e)) && e.isValid()) return e;
837
+ throw Error(`\`${t}\` has to be a valid date!`);
838
+ }
839
+ function o(e, t) {
840
+ let n = Object.values(e), r = String(t).toUpperCase();
841
+ if (!r || !n.includes(r)) throw Error(`Input must be one of the following: ${n.join(`, `)}`);
842
+ return r;
843
+ }
844
+ function s(e, t) {
845
+ let n = null;
846
+ if (typeof t == `string`) {
847
+ let e = t.match(/^(.+) ?<([^>]+)>$/);
848
+ e ? n = {
849
+ email: e[2].trim(),
850
+ name: e[1].trim()
851
+ } : t.includes(`@`) && (n = {
852
+ email: t.trim(),
853
+ name: t.trim()
854
+ });
855
+ } else typeof t == `object` && (n = {
856
+ email: t.email,
857
+ mailto: t.mailto,
858
+ name: t.name,
859
+ sentBy: t.sentBy
860
+ });
861
+ if (!n && typeof t == `string`) throw Error("`" + e + "` isn't formated correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/interfaces/ICalOrganizer.html");
862
+ if (!n) throw Error("`" + e + "` needs to be a valid formed string or an object. See https://sebbo2002.github.io/ical-generator/develop/reference/interfaces/ICalOrganizer.html");
863
+ if (!n.name) throw Error("`" + e + ".name` is empty!");
864
+ if (!n.email) throw Error("`" + e + ".email` is empty!");
865
+ return n;
866
+ }
867
+ function c(e, t) {
868
+ return String(e).replace(t ? /[\\"]/g : /[\\;,]/g, function(e) {
869
+ return `\\` + e;
870
+ }).replace(/(?:\r\n|\r|\n)/g, `\\n`);
871
+ }
872
+ function l(e) {
873
+ return e.split(`\r
874
+ `).map(function(e) {
875
+ let t = ``, n = 0;
876
+ for (let r = 0; r < e.length; r++) {
877
+ let i = e.charAt(r);
878
+ i >= `\ud800` && i <= `\udbff` && (i += e.charAt(++r));
879
+ let a = new TextEncoder().encode(i).length;
880
+ n += a, n > 74 && (t += `\r
881
+ `, n = a), t += i;
882
+ }
883
+ return t;
884
+ }).join(`\r
885
+ `);
886
+ }
887
+ function u(e, t, n, r) {
888
+ if (e?.startsWith(`/`) && (e = e.substr(1)), typeof t == `string` || t instanceof Date) {
889
+ let i = w(t) ? t.withTimeZone(e) : new Date(t), a = i.getUTCFullYear().toString().padStart(4, `0`) + String(i.getUTCMonth() + 1).padStart(2, `0`) + i.getUTCDate().toString().padStart(2, `0`);
890
+ return e && (a = i.getFullYear().toString().padStart(2, `0`) + String(i.getMonth() + 1).padStart(2, `0`) + i.getDate().toString().padStart(2, `0`)), n ? a : e ? (a += `T` + i.getHours().toString().padStart(2, `0`) + i.getMinutes().toString().padStart(2, `0`) + i.getSeconds().toString().padStart(2, `0`), a) : (a += `T` + i.getUTCHours().toString().padStart(2, `0`) + i.getUTCMinutes().toString().padStart(2, `0`) + i.getUTCSeconds().toString().padStart(2, `0`) + (r ? `` : `Z`), a);
891
+ } else if (h(t)) {
892
+ let i = e ? _(t) && !t.tz() ? t.clone().tz(e) : t : r || n && _(t) && t.tz() ? t : t.utc();
893
+ return i.format(`YYYYMMDD`) + (n ? `` : `T` + i.format(`HHmmss`) + (r || e ? `` : `Z`));
894
+ } else if (m(t)) {
895
+ let i = e ? t.setZone(e) : r || n && t.zone.type !== `system` ? t : t.setZone(`utc`);
896
+ return i.toFormat(`yyyyLLdd`) + (n ? `` : `T` + i.toFormat(`HHmmss`) + (r || e ? `` : `Z`));
897
+ } else if (C(t)) {
898
+ let i = t;
899
+ return e && (i = t.withTimeZone(t.timeZoneId)), !e && t.timeZoneId !== `UTC` && (i = t.withTimeZone(`UTC`)), u(null, i.toPlainDateTime(), n, r || !!e);
900
+ } else if (S(t)) {
901
+ if (n) return t.year.toString().padStart(4, `0`) + t.month.toString().padStart(2, `0`) + t.day.toString().padStart(2, `0`);
902
+ if (e) {
903
+ let i = t.toZonedDateTime(e);
904
+ return u(e, i, n, r);
905
+ }
906
+ return t.year.toString().padStart(4, `0`) + t.month.toString().padStart(2, `0`) + t.day.toString().padStart(2, `0`) + `T` + t.hour.toString().padStart(2, `0`) + t.minute.toString().padStart(2, `0`) + t.second.toString().padStart(2, `0`) + (r || e ? `` : `Z`);
907
+ } else if (x(t)) return t.year.toString().padStart(4, `0`) + t.month.toString().padStart(2, `0`) + t.day.toString().padStart(2, `0`) + (n ? `` : `T000000` + (r || e ? `` : `Z`));
908
+ else if (b(t)) {
909
+ let i = e || `UTC`, a = t.toZonedDateTimeISO(i);
910
+ return u(e, a, n, r);
911
+ } else {
912
+ let i = t;
913
+ if (e) i = typeof t.tz == `function` ? t.tz(e) : t;
914
+ else if (!r) if (typeof t.utc == `function`) i = t.utc();
915
+ else throw Error(`Unable to convert dayjs object to UTC value: UTC plugin is not available!`);
916
+ return i.format(`YYYYMMDD`) + (n ? `` : `T` + i.format(`HHmmss`) + (r || e ? `` : `Z`));
917
+ }
918
+ }
919
+ function d(e, t, n, r) {
920
+ let i = ``, a = r?.floating || !1;
921
+ return r?.timezone && (i = `;TZID=` + r.timezone, a = !0), t + i + `:` + u(e, n, !1, a);
922
+ }
923
+ function f(e) {
924
+ let t = e.x.map(([e, t]) => e.toUpperCase() + `:` + c(t, !1)).join(`\r
925
+ `);
926
+ return t.length ? t + `\r
927
+ ` : ``;
928
+ }
929
+ function p(e) {
930
+ return typeof e == `object` && !!e && !(e instanceof Date) && !h(e) && !m(e) && !y(e);
931
+ }
932
+ function m(e) {
933
+ return typeof e == `object` && !!e && `toJSDate` in e && typeof e.toJSDate == `function` && !y(e);
934
+ }
935
+ function h(e) {
936
+ return e != null && e._isAMomentObject != null && !y(e);
937
+ }
938
+ function g(e) {
939
+ return typeof e == `object` && !!e && `asSeconds` in e && typeof e.asSeconds == `function`;
940
+ }
941
+ function _(e) {
942
+ return h(e) && `tz` in e && typeof e.tz == `function`;
943
+ }
944
+ function v(e) {
945
+ return typeof e == `object` && !!e && `between` in e && typeof e.between == `function` && typeof e.toString == `function`;
946
+ }
947
+ function y(e) {
948
+ return C(e) || S(e) || x(e) || b(e);
949
+ }
950
+ function b(e) {
951
+ return typeof e == `object` && !!e && !C(e) && !S(e) && !x(e) && `toZonedDateTimeISO` in e && typeof e.toZonedDateTimeISO == `function` && !(`year` in e) && !(`timeZoneId` in e);
952
+ }
953
+ function x(e) {
954
+ return typeof e == `object` && !!e && !C(e) && !S(e) && `toPlainDateTime` in e && typeof e.toPlainDateTime == `function` && `year` in e && typeof e.year == `number` && `month` in e && typeof e.month == `number` && `day` in e && typeof e.day == `number` && !(`hour` in e) && !(`timeZoneId` in e) && !(`epochSeconds` in e);
955
+ }
956
+ function S(e) {
957
+ return typeof e == `object` && !!e && !C(e) && `toZonedDateTime` in e && typeof e.toZonedDateTime == `function` && `toPlainDate` in e && typeof e.toPlainDate == `function` && `year` in e && typeof e.year == `number` && `month` in e && typeof e.month == `number` && `day` in e && typeof e.day == `number` && `hour` in e && typeof e.hour == `number` && `minute` in e && typeof e.minute == `number` && `second` in e && typeof e.second == `number` && !(`timeZone` in e);
958
+ }
959
+ function C(e) {
960
+ return typeof e == `object` && !!e && `timeZoneId` in e && typeof e.timeZoneId == `string` && `toPlainDateTime` in e && typeof e.toPlainDateTime == `function` && `year` in e && typeof e.year == `number` && `month` in e && typeof e.month == `number` && `day` in e && typeof e.day == `number` && `hour` in e && typeof e.hour == `number` && `minute` in e && typeof e.minute == `number` && `second` in e && typeof e.second == `number`;
961
+ }
962
+ function w(e) {
963
+ return e instanceof Date && `internal` in e && e.internal instanceof Date && `withTimeZone` in e && typeof e.withTimeZone == `function` && `tzComponents` in e && typeof e.tzComponents == `function`;
964
+ }
965
+ function T(e) {
966
+ if (typeof e == `string` || e instanceof Date) return new Date(e);
967
+ if (C(e)) {
968
+ let t = e.toInstant();
969
+ return new Date(t.epochMilliseconds);
970
+ }
971
+ return S(e) ? new Date(Date.UTC(e.year, e.month - 1, e.day, e.hour, e.minute, e.second)) : x(e) ? new Date(Date.UTC(e.year, e.month - 1, e.day)) : b(e) ? new Date(e.epochMilliseconds) : m(e) ? e.toJSDate() : e.toDate();
972
+ }
973
+ function E(e) {
974
+ let t = ``;
975
+ return e < 0 && (t = `-`, e *= -1), t += `P`, e >= 86400 && (t += Math.floor(e / 86400) + `D`, e %= 86400), !e && t.length > 1 ? t : (t += `T`, e >= 3600 && (t += Math.floor(e / 3600) + `H`, e %= 3600), e >= 60 && (t += Math.floor(e / 60) + `M`, e %= 60), e > 0 ? t += e + `S` : t.length <= 2 && (t += `0S`), t);
976
+ }
977
+ function D(e) {
978
+ return e ? typeof e == `string` ? e : C(e) ? D(e.withTimeZone(`UTC`).toPlainDateTime()) : (y(e), e.toJSON()) : null;
979
+ }
980
+ let O = function(e) {
981
+ return e.CHAIR = `CHAIR`, e.NON = `NON-PARTICIPANT`, e.OPT = `OPT-PARTICIPANT`, e.REQ = `REQ-PARTICIPANT`, e;
982
+ }({}), k = function(e) {
983
+ return e.CLIENT = `CLIENT`, e.NONE = `NONE`, e.SERVER = `SERVER`, e;
984
+ }({}), A = function(e) {
985
+ return e.ACCEPTED = `ACCEPTED`, e.DECLINED = `DECLINED`, e.DELEGATED = `DELEGATED`, e.NEEDSACTION = `NEEDS-ACTION`, e.TENTATIVE = `TENTATIVE`, e;
986
+ }({}), j = function(e) {
987
+ return e.GROUP = `GROUP`, e.INDIVIDUAL = `INDIVIDUAL`, e.RESOURCE = `RESOURCE`, e.ROOM = `ROOM`, e.UNKNOWN = `UNKNOWN`, e;
988
+ }({});
989
+ var M = class e {
990
+ constructor(e, t) {
991
+ if (this.data = {
992
+ delegatedFrom: null,
993
+ delegatedTo: null,
994
+ email: ``,
995
+ mailto: null,
996
+ name: null,
997
+ role: O.REQ,
998
+ rsvp: null,
999
+ scheduleAgent: null,
1000
+ sentBy: null,
1001
+ status: null,
1002
+ type: null,
1003
+ x: []
1004
+ }, this.parent = t, !this.parent) throw Error("`event` option required!");
1005
+ if (!e.email) throw Error("No value for `email` in ICalAttendee given!");
1006
+ e.name !== void 0 && this.name(e.name), e.email !== void 0 && this.email(e.email), e.mailto !== void 0 && this.mailto(e.mailto), e.sentBy !== void 0 && this.sentBy(e.sentBy), e.status !== void 0 && this.status(e.status), e.role !== void 0 && this.role(e.role), e.rsvp !== void 0 && this.rsvp(e.rsvp), e.type !== void 0 && this.type(e.type), e.delegatedTo !== void 0 && this.delegatedTo(e.delegatedTo), e.delegatedFrom !== void 0 && this.delegatedFrom(e.delegatedFrom), e.delegatesTo && this.delegatesTo(e.delegatesTo), e.delegatesFrom && this.delegatesFrom(e.delegatesFrom), e.scheduleAgent !== void 0 && this.scheduleAgent(e.scheduleAgent), e.x !== void 0 && this.x(e.x);
1007
+ }
1008
+ delegatedFrom(t) {
1009
+ return t === void 0 ? this.data.delegatedFrom : (t ? typeof t == `string` ? this.data.delegatedFrom = new e(s(`delegatedFrom`, t), this.parent) : t instanceof e ? this.data.delegatedFrom = t : this.data.delegatedFrom = new e(t, this.parent) : this.data.delegatedFrom = null, this);
1010
+ }
1011
+ delegatedTo(t) {
1012
+ return t === void 0 ? this.data.delegatedTo : t ? (typeof t == `string` ? this.data.delegatedTo = new e(s(`delegatedTo`, t), this.parent) : t instanceof e ? this.data.delegatedTo = t : this.data.delegatedTo = new e(t, this.parent), this.data.status = A.DELEGATED, this) : (this.data.delegatedTo = null, this.data.status === A.DELEGATED && (this.data.status = null), this);
1013
+ }
1014
+ delegatesFrom(t) {
1015
+ let n = t instanceof e ? t : this.parent.createAttendee(t);
1016
+ return this.delegatedFrom(n), n.delegatedTo(this), n;
1017
+ }
1018
+ delegatesTo(t) {
1019
+ let n = t instanceof e ? t : this.parent.createAttendee(t);
1020
+ return this.delegatedTo(n), n.delegatedFrom(this), n;
1021
+ }
1022
+ email(e) {
1023
+ return e ? (this.data.email = e, this) : this.data.email;
1024
+ }
1025
+ mailto(e) {
1026
+ return e === void 0 ? this.data.mailto : (this.data.mailto = e || null, this);
1027
+ }
1028
+ name(e) {
1029
+ return e === void 0 ? this.data.name : (this.data.name = e || null, this);
1030
+ }
1031
+ role(e) {
1032
+ return e === void 0 ? this.data.role : (this.data.role = o(O, e), this);
1033
+ }
1034
+ rsvp(e) {
1035
+ return e === void 0 ? this.data.rsvp : e === null ? (this.data.rsvp = null, this) : (this.data.rsvp = !!e, this);
1036
+ }
1037
+ scheduleAgent(e) {
1038
+ return e === void 0 ? this.data.scheduleAgent : e ? typeof e == `string` && e.toUpperCase().startsWith(`X-`) ? (this.data.scheduleAgent = e, this) : (this.data.scheduleAgent = o(k, e), this) : (this.data.scheduleAgent = null, this);
1039
+ }
1040
+ sentBy(e) {
1041
+ return e ? (this.data.sentBy = e, this) : this.data.sentBy;
1042
+ }
1043
+ status(e) {
1044
+ return e === void 0 ? this.data.status : e ? (this.data.status = o(A, e), this) : (this.data.status = null, this);
1045
+ }
1046
+ toJSON() {
1047
+ return Object.assign({}, this.data, {
1048
+ delegatedFrom: this.data.delegatedFrom?.email() || null,
1049
+ delegatedTo: this.data.delegatedTo?.email() || null,
1050
+ x: this.x()
1051
+ });
1052
+ }
1053
+ toString() {
1054
+ let e = `ATTENDEE`;
1055
+ if (!this.data.email) throw Error("No value for `email` in ICalAttendee given!");
1056
+ return e += `;ROLE=` + this.data.role, this.data.type && (e += `;CUTYPE=` + this.data.type), this.data.status && (e += `;PARTSTAT=` + this.data.status), this.data.rsvp !== null && (e += `;RSVP=` + this.data.rsvp.toString().toUpperCase()), this.data.sentBy !== null && (e += `;SENT-BY="mailto:` + this.data.sentBy + `"`), this.data.delegatedTo && (e += `;DELEGATED-TO="` + this.data.delegatedTo.email() + `"`), this.data.delegatedFrom && (e += `;DELEGATED-FROM="` + this.data.delegatedFrom.email() + `"`), this.data.name && (e += `;CN="` + c(this.data.name, !0) + `"`), this.data.email && this.data.mailto && (e += `;EMAIL=` + c(this.data.email, !1)), this.data.scheduleAgent && (e += `;SCHEDULE-AGENT=` + this.data.scheduleAgent), this.data.x.length && (e += `;` + this.data.x.map(([e, t]) => e.toUpperCase() + `=` + c(t, !1)).join(`;`)), e += `:MAILTO:` + c(this.data.mailto || this.data.email, !1) + `\r
1057
+ `, e;
1058
+ }
1059
+ type(e) {
1060
+ return e === void 0 ? this.data.type : e ? (this.data.type = o(j, e), this) : (this.data.type = null, this);
1061
+ }
1062
+ x(e, t) {
1063
+ if (e === void 0) return i(this.data);
1064
+ if (typeof e == `string` && typeof t == `string`) i(this.data, e, t);
1065
+ else if (typeof e == `object`) i(this.data, e);
1066
+ else throw Error(`Either key or value is not a string!`);
1067
+ return this;
1068
+ }
1069
+ };
1070
+ let N = function(e) {
1071
+ return e.audio = `audio`, e.display = `display`, e.email = `email`, e;
1072
+ }({});
1073
+ const P = {
1074
+ end: `END`,
1075
+ start: `START`
1076
+ };
1077
+ var F = class {
1078
+ constructor(e, t) {
1079
+ if (this.data = {
1080
+ attach: null,
1081
+ attendees: [],
1082
+ description: null,
1083
+ interval: null,
1084
+ relatesTo: null,
1085
+ repeat: null,
1086
+ summary: null,
1087
+ trigger: -600,
1088
+ type: N.display,
1089
+ x: []
1090
+ }, this.event = t, !t) throw Error("`event` option required!");
1091
+ e.type !== void 0 && this.type(e.type), `trigger` in e && e.trigger !== void 0 && this.trigger(e.trigger), `triggerBefore` in e && e.triggerBefore !== void 0 && this.triggerBefore(e.triggerBefore), `triggerAfter` in e && e.triggerAfter !== void 0 && this.triggerAfter(e.triggerAfter), e.repeat && this.repeat(e.repeat), e.attach !== void 0 && this.attach(e.attach), e.description !== void 0 && this.description(e.description), e.summary !== void 0 && this.summary(e.summary), e.attendees !== void 0 && this.attendees(e.attendees), e.x !== void 0 && this.x(e.x);
1092
+ }
1093
+ attach(e) {
1094
+ if (e === void 0) return this.data.attach;
1095
+ if (!e) return this.data.attach = null, this;
1096
+ let t;
1097
+ if (typeof e == `string`) t = {
1098
+ mime: null,
1099
+ uri: e
1100
+ };
1101
+ else if (typeof e == `object`) t = {
1102
+ mime: e.mime || null,
1103
+ uri: e.uri
1104
+ };
1105
+ else throw Error("`attachment` needs to be a valid formed string or an object. See https://sebbo2002.github.io/ical-generator/develop/reference/classes/ICalAlarm.html#attach");
1106
+ if (!t.uri) throw Error("`attach.uri` is empty!");
1107
+ return this.data.attach = {
1108
+ mime: t.mime,
1109
+ uri: t.uri
1110
+ }, this;
1111
+ }
1112
+ attendees(e) {
1113
+ return e ? (e.forEach((e) => this.createAttendee(e)), this) : this.data.attendees;
1114
+ }
1115
+ createAttendee(e) {
1116
+ if (e instanceof M) return this.data.attendees.push(e), e;
1117
+ typeof e == `string` && (e = s(`data`, e));
1118
+ let t = new M(e, this);
1119
+ return this.data.attendees.push(t), t;
1120
+ }
1121
+ description(e) {
1122
+ return e === void 0 ? this.data.description : e ? (this.data.description = e, this) : (this.data.description = null, this);
1123
+ }
1124
+ relatesTo(e) {
1125
+ if (e === void 0) return this.data.relatesTo;
1126
+ if (!e) return this.data.relatesTo = null, this;
1127
+ if (!Object.values(P).includes(e)) throw Error("`relatesTo` is not correct, must be either `START` or `END`!");
1128
+ return this.data.relatesTo = e, this;
1129
+ }
1130
+ repeat(e) {
1131
+ if (e === void 0) return this.data.repeat;
1132
+ if (!e) return this.data.repeat = null, this;
1133
+ if (typeof e != `object`) throw Error("`repeat` is not correct, must be an object!");
1134
+ if (typeof e.times != `number` || !isFinite(e.times)) throw Error("`repeat.times` is not correct, must be numeric!");
1135
+ if (typeof e.interval != `number` || !isFinite(e.interval)) throw Error("`repeat.interval` is not correct, must be numeric!");
1136
+ return this.data.repeat = e, this;
1137
+ }
1138
+ summary(e) {
1139
+ return e === void 0 ? this.data.summary : e ? (this.data.summary = e, this) : (this.data.summary = null, this);
1140
+ }
1141
+ toJSON() {
1142
+ let e = this.trigger();
1143
+ return Object.assign({}, this.data, {
1144
+ trigger: typeof e == `number` ? e : D(e),
1145
+ x: this.x()
1146
+ });
1147
+ }
1148
+ toString() {
1149
+ let e = `BEGIN:VALARM\r
1150
+ `;
1151
+ if (e += `ACTION:` + this.data.type.toUpperCase() + `\r
1152
+ `, typeof this.data.trigger == `number` && this.data.relatesTo === null ? this.data.trigger > 0 ? e += `TRIGGER;RELATED=END:` + E(this.data.trigger) + `\r
1153
+ ` : e += `TRIGGER:` + E(this.data.trigger) + `\r
1154
+ ` : typeof this.data.trigger == `number` ? e += `TRIGGER;RELATED=` + this.data.relatesTo?.toUpperCase() + `:` + E(this.data.trigger) + `\r
1155
+ ` : e += `TRIGGER;VALUE=DATE-TIME:` + u(this.event.timezone(), this.data.trigger) + `\r
1156
+ `, this.data.repeat) {
1157
+ if (!this.data.repeat.times) throw Error("No value for `repeat.times` in ICalAlarm given, but required for `interval`!");
1158
+ if (!this.data.repeat.interval) throw Error("No value for `repeat.interval` in ICalAlarm given, but required for `repeat`!");
1159
+ e += `REPEAT:` + this.data.repeat.times + `\r
1160
+ `, e += `DURATION:` + E(this.data.repeat.interval) + `\r
1161
+ `;
1162
+ }
1163
+ return this.data.type === `audio` && this.data.attach && this.data.attach.mime ? e += `ATTACH;FMTTYPE=` + c(this.data.attach.mime, !1) + `:` + c(this.data.attach.uri, !1) + `\r
1164
+ ` : this.data.type === `audio` && this.data.attach ? e += `ATTACH;VALUE=URI:` + c(this.data.attach.uri, !1) + `\r
1165
+ ` : this.data.type === `audio` && (e += `ATTACH;VALUE=URI:Basso\r
1166
+ `), this.data.type !== `audio` && this.data.description ? e += `DESCRIPTION:` + c(this.data.description, !1) + `\r
1167
+ ` : this.data.type !== `audio` && (e += `DESCRIPTION:` + c(this.event.summary(), !1) + `\r
1168
+ `), this.data.type === `email` && this.data.summary ? e += `SUMMARY:` + c(this.data.summary, !1) + `\r
1169
+ ` : this.data.type === `email` && (e += `SUMMARY:` + c(this.event.summary(), !1) + `\r
1170
+ `), this.data.type === `email` && this.data.attendees.forEach((t) => {
1171
+ e += t.toString();
1172
+ }), e += f(this.data), e += `END:VALARM\r
1173
+ `, e;
1174
+ }
1175
+ trigger(e) {
1176
+ if (e === void 0 && typeof this.data.trigger == `number`) return -1 * this.data.trigger;
1177
+ if (e === void 0) return this.data.trigger;
1178
+ if (typeof e == `number` && isFinite(e)) this.data.trigger = -1 * e;
1179
+ else if (!e || typeof e == `number`) throw Error("`trigger` is not correct, must be a finite number or a supported date!");
1180
+ else this.data.trigger = a(e, `trigger`);
1181
+ return this;
1182
+ }
1183
+ triggerAfter(e) {
1184
+ return e === void 0 ? this.data.trigger : this.trigger(typeof e == `number` ? -1 * e : e);
1185
+ }
1186
+ triggerBefore(e) {
1187
+ return e === void 0 ? this.trigger() : this.trigger(e);
1188
+ }
1189
+ type(e) {
1190
+ if (e === void 0) return this.data.type;
1191
+ if (!e || !Object.keys(N).includes(e)) throw Error("`type` is not correct, must be either `display` or `audio`!");
1192
+ return this.data.type = e, this;
1193
+ }
1194
+ x(e, t) {
1195
+ if (e === void 0) return i(this.data);
1196
+ if (typeof e == `string` && typeof t == `string`) i(this.data, e, t);
1197
+ else if (typeof e == `object`) i(this.data, e);
1198
+ else throw Error(`Either key or value is not a string!`);
1199
+ return this;
1200
+ }
1201
+ }, I = class {
1202
+ constructor(e) {
1203
+ if (this.data = { name: `` }, !e.name) throw Error("No value for `name` in ICalCategory given!");
1204
+ this.name(e.name);
1205
+ }
1206
+ name(e) {
1207
+ return e === void 0 ? this.data.name : (this.data.name = e, this);
1208
+ }
1209
+ toJSON() {
1210
+ return Object.assign({}, this.data);
1211
+ }
1212
+ toString() {
1213
+ return c(this.data.name, !1);
1214
+ }
1215
+ };
1216
+ let L = function(e) {
1217
+ return e.BUSY = `BUSY`, e.FREE = `FREE`, e.OOF = `OOF`, e.TENTATIVE = `TENTATIVE`, e;
1218
+ }({}), R = function(e) {
1219
+ return e.CONFIDENTIAL = `CONFIDENTIAL`, e.PRIVATE = `PRIVATE`, e.PUBLIC = `PUBLIC`, e;
1220
+ }({}), z = function(e) {
1221
+ return e.CANCELLED = `CANCELLED`, e.CONFIRMED = `CONFIRMED`, e.TENTATIVE = `TENTATIVE`, e;
1222
+ }({}), B = function(e) {
1223
+ return e.OPAQUE = `OPAQUE`, e.TRANSPARENT = `TRANSPARENT`, e;
1224
+ }({});
1225
+ var V = class {
1226
+ constructor(e, t) {
1227
+ if (this.data = {
1228
+ alarms: [],
1229
+ allDay: !1,
1230
+ attachments: [],
1231
+ attendees: [],
1232
+ busystatus: null,
1233
+ categories: [],
1234
+ class: null,
1235
+ created: null,
1236
+ description: null,
1237
+ end: null,
1238
+ floating: !1,
1239
+ id: crypto.randomUUID(),
1240
+ lastModified: null,
1241
+ location: null,
1242
+ organizer: null,
1243
+ priority: null,
1244
+ recurrenceId: null,
1245
+ repeating: null,
1246
+ sequence: 0,
1247
+ stamp: /* @__PURE__ */ new Date(),
1248
+ start: /* @__PURE__ */ new Date(),
1249
+ status: null,
1250
+ summary: ``,
1251
+ timezone: null,
1252
+ transparency: null,
1253
+ travelTime: null,
1254
+ url: null,
1255
+ x: []
1256
+ }, this.calendar = t, !t) throw Error("`calendar` option required!");
1257
+ e.id && this.id(e.id), e.sequence !== void 0 && this.sequence(e.sequence), e.start && this.start(e.start), e.end !== void 0 && this.end(e.end), e.recurrenceId !== void 0 && this.recurrenceId(e.recurrenceId), e.timezone !== void 0 && this.timezone(e.timezone), e.stamp !== void 0 && this.stamp(e.stamp), e.allDay !== void 0 && this.allDay(e.allDay), e.floating !== void 0 && this.floating(e.floating), e.repeating !== void 0 && this.repeating(e.repeating), e.summary !== void 0 && this.summary(e.summary), e.location !== void 0 && this.location(e.location), e.description !== void 0 && this.description(e.description), e.organizer !== void 0 && this.organizer(e.organizer), e.attendees !== void 0 && this.attendees(e.attendees), e.alarms !== void 0 && this.alarms(e.alarms), e.categories !== void 0 && this.categories(e.categories), e.status !== void 0 && this.status(e.status), e.busystatus !== void 0 && this.busystatus(e.busystatus), e.priority !== void 0 && this.priority(e.priority), e.url !== void 0 && this.url(e.url), e.attachments !== void 0 && this.attachments(e.attachments), e.transparency !== void 0 && this.transparency(e.transparency), e.travelTime !== void 0 && this.travelTime(e.travelTime), e.created !== void 0 && this.created(e.created), e.lastModified !== void 0 && this.lastModified(e.lastModified), e.class !== void 0 && this.class(e.class), e.x !== void 0 && this.x(e.x);
1258
+ }
1259
+ alarms(e) {
1260
+ return e ? (e.forEach((e) => this.createAlarm(e)), this) : this.data.alarms;
1261
+ }
1262
+ allDay(e) {
1263
+ return e === void 0 ? this.data.allDay : (this.data.allDay = !!e, this);
1264
+ }
1265
+ attachments(e) {
1266
+ return e ? (e.forEach((e) => this.createAttachment(e)), this) : this.data.attachments;
1267
+ }
1268
+ attendees(e) {
1269
+ return e ? (e.forEach((e) => this.createAttendee(e)), this) : this.data.attendees;
1270
+ }
1271
+ busystatus(e) {
1272
+ return e === void 0 ? this.data.busystatus : e === null ? (this.data.busystatus = null, this) : (this.data.busystatus = o(L, e), this);
1273
+ }
1274
+ categories(e) {
1275
+ return e ? (e.forEach((e) => this.createCategory(e)), this) : this.data.categories;
1276
+ }
1277
+ class(e) {
1278
+ return e === void 0 ? this.data.class : e === null ? (this.data.class = null, this) : (this.data.class = o(R, e), this);
1279
+ }
1280
+ createAlarm(e) {
1281
+ let t = e instanceof F ? e : new F(e, this);
1282
+ return this.data.alarms.push(t), t;
1283
+ }
1284
+ createAttachment(e) {
1285
+ return this.data.attachments.push(e), this;
1286
+ }
1287
+ createAttendee(e) {
1288
+ if (e instanceof M) return this.data.attendees.push(e), e;
1289
+ typeof e == `string` && (e = s(`data`, e));
1290
+ let t = new M(e, this);
1291
+ return this.data.attendees.push(t), t;
1292
+ }
1293
+ createCategory(e) {
1294
+ let t = e instanceof I ? e : new I(e);
1295
+ return this.data.categories.push(t), t;
1296
+ }
1297
+ created(e) {
1298
+ return e === void 0 ? this.data.created : e === null ? (this.data.created = null, this) : (this.data.created = a(e, `created`), this);
1299
+ }
1300
+ description(e) {
1301
+ return e === void 0 ? this.data.description : e === null ? (this.data.description = null, this) : (typeof e == `string` ? this.data.description = { plain: e } : this.data.description = e, this);
1302
+ }
1303
+ end(e) {
1304
+ return e === void 0 ? (this.swapStartAndEndIfRequired(), this.data.end) : e === null ? (this.data.end = null, this) : (this.data.end = a(e, `end`), this);
1305
+ }
1306
+ floating(e) {
1307
+ return e === void 0 ? this.data.floating : (this.data.floating = !!e, this.data.floating && (this.data.timezone = null), this);
1308
+ }
1309
+ id(e) {
1310
+ return e === void 0 ? this.data.id : (this.data.id = String(e), this);
1311
+ }
1312
+ lastModified(e) {
1313
+ return e === void 0 ? this.data.lastModified : e === null ? (this.data.lastModified = null, this) : (this.data.lastModified = a(e, `lastModified`), this);
1314
+ }
1315
+ location(e) {
1316
+ if (e === void 0) return this.data.location;
1317
+ if (typeof e == `string`) return this.data.location = { title: e }, this;
1318
+ if (e && (`title` in e && !e.title || e?.geo && (typeof e.geo.lat != `number` || !isFinite(e.geo.lat) || typeof e.geo.lon != `number` || !isFinite(e.geo.lon)) || !(`title` in e) && !e?.geo)) throw Error("`location` isn't formatted correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/classes/ICalEvent.html#location");
1319
+ return this.data.location = e || null, this;
1320
+ }
1321
+ organizer(e) {
1322
+ return e === void 0 ? this.data.organizer : e === null ? (this.data.organizer = null, this) : (this.data.organizer = s(`organizer`, e), this);
1323
+ }
1324
+ priority(e) {
1325
+ if (e === void 0) return this.data.priority;
1326
+ if (e === null) return this.data.priority = null, this;
1327
+ if (e < 0 || e > 9) throw Error("`priority` is invalid, musst be 0 ≤ priority ≤ 9.");
1328
+ return this.data.priority = Math.round(e), this;
1329
+ }
1330
+ recurrenceId(e) {
1331
+ return e === void 0 ? this.data.recurrenceId : e === null ? (this.data.recurrenceId = null, this) : (this.data.recurrenceId = a(e, `recurrenceId`), this);
1332
+ }
1333
+ repeating(t) {
1334
+ if (t === void 0) return this.data.repeating;
1335
+ if (!t) return this.data.repeating = null, this;
1336
+ if (v(t) || typeof t == `string`) return this.data.repeating = t, this;
1337
+ if (this.data.repeating = { freq: o(e, t.freq) }, t.count) {
1338
+ if (!isFinite(t.count)) throw Error("`repeating.count` must be a finite number!");
1339
+ this.data.repeating.count = t.count;
1340
+ }
1341
+ if (t.interval) {
1342
+ if (!isFinite(t.interval)) throw Error("`repeating.interval` must be a finite number!");
1343
+ this.data.repeating.interval = t.interval;
1344
+ }
1345
+ if (t.until !== void 0 && (this.data.repeating.until = a(t.until, `repeating.until`)), t.byDay) {
1346
+ let e = Array.isArray(t.byDay) ? t.byDay : [t.byDay];
1347
+ this.data.repeating.byDay = e.map((e) => o(r, e));
1348
+ }
1349
+ if (t.byMonth) {
1350
+ let e = Array.isArray(t.byMonth) ? t.byMonth : [t.byMonth];
1351
+ this.data.repeating.byMonth = e.map((e) => {
1352
+ if (typeof e != `number` || e < 1 || e > 12) throw Error("`repeating.byMonth` contains invalid value `" + e + "`!");
1353
+ return e;
1354
+ });
1355
+ }
1356
+ if (t.byMonthDay) {
1357
+ let e = Array.isArray(t.byMonthDay) ? t.byMonthDay : [t.byMonthDay];
1358
+ this.data.repeating.byMonthDay = e.map((e) => {
1359
+ if (typeof e != `number` || e < -31 || e > 31 || e === 0) throw Error("`repeating.byMonthDay` contains invalid value `" + e + "`!");
1360
+ return e;
1361
+ });
1362
+ }
1363
+ if (t.bySetPos) {
1364
+ if (!this.data.repeating.byDay) throw "`repeating.bySetPos` must be used along with `repeating.byDay`!";
1365
+ let e = Array.isArray(t.bySetPos) ? t.bySetPos : [t.bySetPos];
1366
+ this.data.repeating.bySetPos = e.map((e) => {
1367
+ if (typeof e != `number` || e < -366 || e > 366 || e === 0) throw "`repeating.bySetPos` contains invalid value `" + e + "`!";
1368
+ return e;
1369
+ });
1370
+ }
1371
+ if (t.exclude) {
1372
+ let e = Array.isArray(t.exclude) ? t.exclude : [t.exclude];
1373
+ this.data.repeating.exclude = e.map((e, t) => a(e, `repeating.exclude[${t}]`));
1374
+ }
1375
+ return t.startOfWeek && (this.data.repeating.startOfWeek = o(r, t.startOfWeek)), this;
1376
+ }
1377
+ sequence(e) {
1378
+ if (e === void 0) return this.data.sequence;
1379
+ if (isNaN(parseInt(String(e), 10))) throw Error("`sequence` must be a number!");
1380
+ return this.data.sequence = e, this;
1381
+ }
1382
+ stamp(e) {
1383
+ return e === void 0 ? this.data.stamp : (this.data.stamp = a(e, `stamp`), this);
1384
+ }
1385
+ start(e) {
1386
+ return e === void 0 ? (this.swapStartAndEndIfRequired(), this.data.start) : (this.data.start = a(e, `start`), this);
1387
+ }
1388
+ status(e) {
1389
+ return e === void 0 ? this.data.status : e === null ? (this.data.status = null, this) : (this.data.status = o(z, e), this);
1390
+ }
1391
+ summary(e) {
1392
+ return e === void 0 ? this.data.summary : (this.data.summary = e ? String(e) : ``, this);
1393
+ }
1394
+ timestamp(e) {
1395
+ return e === void 0 ? this.stamp() : this.stamp(e);
1396
+ }
1397
+ timezone(e) {
1398
+ return e === void 0 && this.data.timezone !== null ? this.data.timezone : e === void 0 ? this.calendar.timezone() : (this.data.timezone = e && e !== `UTC` ? e.toString() : null, this.data.timezone && (this.data.floating = !1), this);
1399
+ }
1400
+ toJSON() {
1401
+ let e = null;
1402
+ return v(this.data.repeating) || typeof this.data.repeating == `string` ? e = this.data.repeating.toString() : this.data.repeating && (e = Object.assign({}, this.data.repeating, {
1403
+ exclude: this.data.repeating.exclude?.map((e) => D(e)),
1404
+ until: D(this.data.repeating.until) || void 0
1405
+ })), this.swapStartAndEndIfRequired(), Object.assign({}, this.data, {
1406
+ created: D(this.data.created) || null,
1407
+ end: D(this.data.end) || null,
1408
+ lastModified: D(this.data.lastModified) || null,
1409
+ recurrenceId: D(this.data.recurrenceId) || null,
1410
+ repeating: e,
1411
+ stamp: D(this.data.stamp) || null,
1412
+ start: D(this.data.start) || null,
1413
+ x: this.x()
1414
+ });
1415
+ }
1416
+ toString() {
1417
+ let e = ``;
1418
+ if (e += `BEGIN:VEVENT\r
1419
+ `, e += `UID:` + this.data.id + `\r
1420
+ `, e += `SEQUENCE:` + this.data.sequence + `\r
1421
+ `, this.swapStartAndEndIfRequired(), e += `DTSTAMP:` + u(this.calendar.timezone(), this.data.stamp) + `\r
1422
+ `, this.data.allDay ? (e += `DTSTART;VALUE=DATE:` + u(this.timezone(), this.data.start, !0) + `\r
1423
+ `, this.data.end && (e += `DTEND;VALUE=DATE:` + u(this.timezone(), this.data.end, !0) + `\r
1424
+ `), e += `X-MICROSOFT-CDO-ALLDAYEVENT:TRUE\r
1425
+ `, e += `X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE\r
1426
+ `) : (e += d(this.timezone(), `DTSTART`, this.data.start, this.data) + `\r
1427
+ `, this.data.end && (e += d(this.timezone(), `DTEND`, this.data.end, this.data) + `\r
1428
+ `)), v(this.data.repeating) || typeof this.data.repeating == `string`) {
1429
+ let t = this.data.repeating.toString().replace(/\r\n/g, `
1430
+ `).split(`
1431
+ `).filter((e) => e && !e.startsWith(`DTSTART:`)).join(`\r
1432
+ `);
1433
+ !t.includes(`\r
1434
+ `) && !t.startsWith(`RRULE:`) && (t = `RRULE:` + t), e += t.trim() + `\r
1435
+ `;
1436
+ } else this.data.repeating && (e += `RRULE:FREQ=` + this.data.repeating.freq, this.data.repeating.count && (e += `;COUNT=` + this.data.repeating.count), this.data.repeating.interval && (e += `;INTERVAL=` + this.data.repeating.interval), this.data.repeating.until && (e += `;UNTIL=` + u(this.calendar.timezone(), this.data.repeating.until, !1, this.floating())), this.data.repeating.byDay && (e += `;BYDAY=` + this.data.repeating.byDay.join(`,`)), this.data.repeating.byMonth && (e += `;BYMONTH=` + this.data.repeating.byMonth.join(`,`)), this.data.repeating.byMonthDay && (e += `;BYMONTHDAY=` + this.data.repeating.byMonthDay.join(`,`)), this.data.repeating.bySetPos && (e += `;BYSETPOS=` + this.data.repeating.bySetPos.join(`,`)), this.data.repeating.startOfWeek && (e += `;WKST=` + this.data.repeating.startOfWeek), e += `\r
1437
+ `, this.data.repeating.exclude && (this.data.allDay ? e += `EXDATE;VALUE=DATE:` + this.data.repeating.exclude.map((e) => u(this.calendar.timezone(), e, !0)).join(`,`) + `\r
1438
+ ` : (e += `EXDATE`, this.timezone() ? e += `;TZID=` + this.timezone() + `:` + this.data.repeating.exclude.map((e) => u(this.timezone(), e, !1, !0)).join(`,`) + `\r
1439
+ ` : e += `:` + this.data.repeating.exclude.map((e) => u(this.timezone(), e, !1, this.floating())).join(`,`) + `\r
1440
+ `)));
1441
+ if (this.data.recurrenceId && (e += d(this.timezone(), `RECURRENCE-ID`, this.data.recurrenceId, this.data) + `\r
1442
+ `), e += `SUMMARY:` + c(this.data.summary, !1) + `\r
1443
+ `, this.data.transparency && (e += `TRANSP:` + c(this.data.transparency, !1) + `\r
1444
+ `), this.data.location && `title` in this.data.location && this.data.location.title && (e += `LOCATION:` + c(this.data.location.title + (this.data.location.address ? `
1445
+ ` + this.data.location.address : ``), !1) + `\r
1446
+ `, this.data.location.radius && this.data.location.geo && (e += `X-APPLE-STRUCTURED-LOCATION;VALUE=URI;` + (this.data.location.address ? `X-ADDRESS=` + c(this.data.location.address, !1) + `;` : ``) + `X-APPLE-RADIUS=` + c(this.data.location.radius, !1) + `;X-TITLE=` + c(this.data.location.title, !1) + `:geo:` + c(this.data.location.geo?.lat, !1) + `,` + c(this.data.location.geo?.lon, !1) + `\r
1447
+ `)), this.data.location?.geo?.lat && this.data.location.geo.lon && (e += `GEO:` + c(this.data.location.geo.lat, !1) + `;` + c(this.data.location.geo.lon, !1) + `\r
1448
+ `), this.data.travelTime && (e += `X-APPLE-TRAVEL-DURATION;VALUE=DURATION:` + E(this.data.travelTime.seconds) + `\r
1449
+ `, this.data.location && (this.data.travelTime.suggestionBehavior && (e += `X-APPLE-TRAVEL-ADVISORY-BEHAVIOR:` + this.data.travelTime.suggestionBehavior + `\r
1450
+ `), this.data.travelTime.startFrom))) {
1451
+ e += `X-APPLE-TRAVEL-START;`;
1452
+ let t = [];
1453
+ t.push(`ROUTING=` + this.data.travelTime.startFrom.transportation), t.push(`VALUE=URI`), `address` in this.data.travelTime.startFrom.location && this.data.travelTime.startFrom.location.address && t.push(`X-ADDRESS=` + c(this.data.travelTime.startFrom.location.address, !1)), `radius` in this.data.travelTime.startFrom.location && this.data.travelTime.startFrom.location.radius && t.push(`X-APPLE-RADIUS=` + c(this.data.travelTime.startFrom.location.radius, !1)), `title` in this.data.travelTime.startFrom.location && this.data.travelTime.startFrom.location.title && t.push(`X-TITLE=` + c(this.data.travelTime.startFrom.location.title, !1)), e += t.join(`;`), `geo` in this.data.travelTime.startFrom.location && this.data.travelTime.startFrom.location.geo && (e += `:geo:` + c(this.data.travelTime.startFrom.location.geo?.lat, !1) + `,` + c(this.data.travelTime.startFrom.location.geo?.lon, !1)), e += `\r
1454
+ `;
1455
+ }
1456
+ return this.data.description && (e += `DESCRIPTION:` + c(this.data.description.plain, !1) + `\r
1457
+ `, this.data.description.html && (e += `X-ALT-DESC;FMTTYPE=text/html:` + c(this.data.description.html, !1) + `\r
1458
+ `)), this.data.organizer && (e += `ORGANIZER;CN="` + c(this.data.organizer.name, !0) + `"`, this.data.organizer.sentBy && (e += `;SENT-BY="mailto:` + c(this.data.organizer.sentBy, !0) + `"`), this.data.organizer.email && this.data.organizer.mailto && (e += `;EMAIL=` + c(this.data.organizer.email, !1)), e += `:`, this.data.organizer.email && (e += `mailto:` + c(this.data.organizer.mailto || this.data.organizer.email, !1)), e += `\r
1459
+ `), this.data.attendees.forEach(function(t) {
1460
+ e += t.toString();
1461
+ }), this.data.alarms.forEach(function(t) {
1462
+ e += t.toString();
1463
+ }), this.data.categories.length > 0 && (e += `CATEGORIES:` + this.data.categories.map((e) => e.toString()).join() + `\r
1464
+ `), this.data.url && (e += `URL;VALUE=URI:` + c(this.data.url, !1) + `\r
1465
+ `), this.data.attachments.length > 0 && this.data.attachments.forEach((t) => {
1466
+ e += `ATTACH:` + c(t, !1) + `\r
1467
+ `;
1468
+ }), this.data.status && (e += `STATUS:` + this.data.status.toUpperCase() + `\r
1469
+ `), this.data.busystatus && (e += `X-MICROSOFT-CDO-BUSYSTATUS:` + this.data.busystatus.toUpperCase() + `\r
1470
+ `), this.data.priority !== null && (e += `PRIORITY:` + this.data.priority + `\r
1471
+ `), e += f(this.data), this.data.created && (e += `CREATED:` + u(this.calendar.timezone(), this.data.created) + `\r
1472
+ `), this.data.lastModified && (e += `LAST-MODIFIED:` + u(this.calendar.timezone(), this.data.lastModified) + `\r
1473
+ `), this.data.class && (e += `CLASS:` + this.data.class.toUpperCase() + `\r
1474
+ `), e += `END:VEVENT\r
1475
+ `, e;
1476
+ }
1477
+ transparency(e) {
1478
+ return e === void 0 ? this.data.transparency : e ? (this.data.transparency = o(B, e), this) : (this.data.transparency = null, this);
1479
+ }
1480
+ travelTime(e) {
1481
+ if (e === void 0) return this.data.travelTime;
1482
+ if (typeof e == `number` && e <= 0) throw Error("`travelTime` has to be more than 0!");
1483
+ if (e && typeof e == `object` && `seconds` in e && e.seconds <= 0) throw Error("`travelTime.seconds` has to be more than 0!");
1484
+ return typeof e == `number` ? (this.data.travelTime = { seconds: e }, this) : (this.data.travelTime = e, this);
1485
+ }
1486
+ uid(e) {
1487
+ return e === void 0 ? this.id() : this.id(e);
1488
+ }
1489
+ url(e) {
1490
+ return e === void 0 ? this.data.url : (this.data.url = e ? String(e) : null, this);
1491
+ }
1492
+ x(e, t) {
1493
+ return e === void 0 ? i(this.data) : (typeof e == `string` && typeof t == `string` && i(this.data, e, t), typeof e == `object` && i(this.data, e), this);
1494
+ }
1495
+ swapStartAndEndIfRequired() {
1496
+ if (this.data.start && this.data.end && T(this.data.start).getTime() > T(this.data.end).getTime()) {
1497
+ let e = this.data.start;
1498
+ this.data.start = this.data.end, this.data.end = e;
1499
+ }
1500
+ }
1501
+ };
1502
+ let H = function(e) {
1503
+ return e.ADD = `ADD`, e.CANCEL = `CANCEL`, e.COUNTER = `COUNTER`, e.DECLINECOUNTER = `DECLINECOUNTER`, e.PUBLISH = `PUBLISH`, e.REFRESH = `REFRESH`, e.REPLY = `REPLY`, e.REQUEST = `REQUEST`, e;
1504
+ }({});
1505
+ var U = class {
1506
+ constructor(e = {}) {
1507
+ this.data = {
1508
+ color: null,
1509
+ description: null,
1510
+ events: [],
1511
+ method: null,
1512
+ name: null,
1513
+ prodId: `//sebbo.net//ical-generator//EN`,
1514
+ scale: null,
1515
+ source: null,
1516
+ timezone: null,
1517
+ ttl: null,
1518
+ url: null,
1519
+ x: []
1520
+ }, e.prodId !== void 0 && this.prodId(e.prodId), e.method !== void 0 && this.method(e.method), e.name !== void 0 && this.name(e.name), e.description !== void 0 && this.description(e.description), e.timezone !== void 0 && this.timezone(e.timezone), e.source !== void 0 && this.source(e.source), e.url !== void 0 && this.url(e.url), e.scale !== void 0 && this.scale(e.scale), e.ttl !== void 0 && this.ttl(e.ttl), e.color !== void 0 && this.color(e.color), e.events !== void 0 && this.events(e.events), e.x !== void 0 && this.x(e.x);
1521
+ }
1522
+ clear() {
1523
+ return this.data.events = [], this;
1524
+ }
1525
+ color(e) {
1526
+ if (e === void 0) return this.data.color;
1527
+ if (typeof e == `string` && !/^#[A-F0-9]{6}$/gi.test(e)) throw Error("`color` is malformed!");
1528
+ return this.data.color = e ? String(e).toUpperCase() : null, this;
1529
+ }
1530
+ createEvent(e) {
1531
+ let t = e instanceof V ? e : new V(e, this);
1532
+ return this.data.events.push(t), t;
1533
+ }
1534
+ description(e) {
1535
+ return e === void 0 ? this.data.description : (this.data.description = e ? String(e) : null, this);
1536
+ }
1537
+ events(e) {
1538
+ return e ? (e.forEach((e) => this.createEvent(e)), this) : this.data.events;
1539
+ }
1540
+ length() {
1541
+ return this.data.events.length;
1542
+ }
1543
+ method(e) {
1544
+ return e === void 0 ? this.data.method : e ? (this.data.method = o(H, e), this) : (this.data.method = null, this);
1545
+ }
1546
+ name(e) {
1547
+ return e === void 0 ? this.data.name : (this.data.name = e ? String(e) : null, this);
1548
+ }
1549
+ prodId(e) {
1550
+ if (!e) return this.data.prodId;
1551
+ if (typeof e == `string`) return this.data.prodId = e, this;
1552
+ if (typeof e != `object`) throw Error("`prodid` needs to be a string or an object!");
1553
+ if (!e.company) throw Error("`prodid.company` is a mandatory item!");
1554
+ if (!e.product) throw Error("`prodid.product` is a mandatory item!");
1555
+ let t = (e.language || `EN`).toUpperCase();
1556
+ return this.data.prodId = `//` + e.company + `//` + e.product + `//` + t, this;
1557
+ }
1558
+ scale(e) {
1559
+ return e === void 0 ? this.data.scale : (e === null ? this.data.scale = null : this.data.scale = e.toUpperCase(), this);
1560
+ }
1561
+ source(e) {
1562
+ return e === void 0 ? this.data.source : (this.data.source = e || null, this);
1563
+ }
1564
+ timezone(e) {
1565
+ return e === void 0 ? this.data.timezone?.name || null : (e === `UTC` ? this.data.timezone = null : typeof e == `string` ? this.data.timezone = { name: e } : e === null ? this.data.timezone = null : this.data.timezone = e, this);
1566
+ }
1567
+ toJSON() {
1568
+ return Object.assign({}, this.data, {
1569
+ events: this.data.events.map((e) => e.toJSON()),
1570
+ timezone: this.timezone(),
1571
+ x: this.x()
1572
+ });
1573
+ }
1574
+ toString() {
1575
+ let e = ``;
1576
+ return e = `BEGIN:VCALENDAR\r
1577
+ VERSION:2.0\r
1578
+ `, e += `PRODID:-` + this.data.prodId + `\r
1579
+ `, this.data.url && (e += `URL:` + this.data.url + `\r
1580
+ `), this.data.source && (e += `SOURCE;VALUE=URI:` + this.data.source + `\r
1581
+ `), this.data.scale && (e += `CALSCALE:` + this.data.scale + `\r
1582
+ `), this.data.method && (e += `METHOD:` + this.data.method + `\r
1583
+ `), this.data.name && (e += `NAME:` + this.data.name + `\r
1584
+ `, e += `X-WR-CALNAME:` + this.data.name + `\r
1585
+ `), this.data.description && (e += `X-WR-CALDESC:` + this.data.description + `\r
1586
+ `), this.data.timezone?.generator && [.../* @__PURE__ */ new Set([this.timezone(), ...this.data.events.map((e) => e.timezone())])].filter((e) => e !== null && !e.startsWith(`/`)).forEach((t) => {
1587
+ if (!this.data.timezone?.generator) return;
1588
+ let n = this.data.timezone.generator(t);
1589
+ n && (e += n.replace(/\r\n/g, `
1590
+ `).replace(/\n/g, `\r
1591
+ `).trim() + `\r
1592
+ `);
1593
+ }), this.data.timezone?.name && (e += `TIMEZONE-ID:` + this.data.timezone.name + `\r
1594
+ `, e += `X-WR-TIMEZONE:` + this.data.timezone.name + `\r
1595
+ `), this.data.ttl && (e += `REFRESH-INTERVAL;VALUE=DURATION:` + E(this.data.ttl) + `\r
1596
+ `, e += `X-PUBLISHED-TTL:` + E(this.data.ttl) + `\r
1597
+ `), this.data.color && (e += `X-APPLE-CALENDAR-COLOR:` + this.data.color + `\r
1598
+ `), this.data.events.forEach((t) => e += t.toString()), e += f(this.data), e += `END:VCALENDAR`, l(e);
1599
+ }
1600
+ ttl(e) {
1601
+ return e === void 0 ? this.data.ttl : (g(e) ? this.data.ttl = e.asSeconds() : e && e > 0 ? this.data.ttl = e : this.data.ttl = null, this);
1602
+ }
1603
+ url(e) {
1604
+ return e === void 0 ? this.data.url : (this.data.url = e || null, this);
1605
+ }
1606
+ x(e, t) {
1607
+ if (e === void 0) return i(this.data);
1608
+ if (typeof e == `string` && typeof t == `string`) i(this.data, e, t);
1609
+ else if (typeof e == `object`) i(this.data, e);
1610
+ else throw Error(`Either key or value is not a string!`);
1611
+ return this;
1612
+ }
1613
+ };
1614
+ //#endregion
1615
+ //#region ../calendar/src/icsRenderer.ts
1616
+ function toIcalDate(date, timezone) {
1617
+ return new TZDate(date, timezone);
1618
+ }
1619
+ function toIcalStatus(status) {
1620
+ return status === "cancelled" ? z.CANCELLED : z.CONFIRMED;
1621
+ }
1622
+ function renderCalendarFeedIcs(feed, timezoneGenerator) {
1623
+ const calendar = new U({
1624
+ name: feed.name ?? null,
1625
+ description: feed.description ?? null,
1626
+ method: H.PUBLISH,
1627
+ prodId: {
1628
+ company: "RiverbankCMS",
1629
+ product: "Bookings Calendar Feeds",
1630
+ language: "EN"
1631
+ },
1632
+ timezone: feed.timezone === "UTC" ? null : {
1633
+ name: feed.timezone,
1634
+ generator: timezoneGenerator
1635
+ },
1636
+ url: feed.url ?? null
1637
+ });
1638
+ const generatedAt = /* @__PURE__ */ new Date();
1639
+ feed.entries.forEach((entry) => calendar.createEvent(calendarEvent(entry, generatedAt)));
1640
+ return calendar.toString();
1641
+ }
1642
+ function calendarEvent(entry, generatedAt) {
1643
+ const updatedAt = entry.updatedAt ?? generatedAt;
1644
+ return {
1645
+ id: entry.uid,
1646
+ sequence: entry.sequence,
1647
+ start: entry.timezone === "UTC" ? entry.startsAt : toIcalDate(entry.startsAt, entry.timezone),
1648
+ end: entry.timezone === "UTC" ? entry.endsAt : toIcalDate(entry.endsAt, entry.timezone),
1649
+ timezone: entry.timezone === "UTC" ? null : entry.timezone,
1650
+ summary: entry.title,
1651
+ description: entry.description,
1652
+ location: entry.location,
1653
+ url: entry.url,
1654
+ status: toIcalStatus(entry.status),
1655
+ stamp: updatedAt,
1656
+ created: updatedAt,
1657
+ lastModified: updatedAt
1658
+ };
1659
+ }
1660
+ //#endregion
1661
+ //#region ../calendar/src/index.ts
1662
+ var src_exports = /* @__PURE__ */ __exportAll({
1663
+ MAX_EVENTS_PER_DAY: () => 3,
1664
+ renderCalendarFeedIcs: () => renderCalendarFeedIcs
1665
+ });
1666
+ //#endregion
1667
+ export { MONTH_NAMES as a, formatCalendarTitle as c, getOrderedDayNames as d, getWeekCalendarDayTuple as f, shiftCalendarAnchorDate as h, buildTimetableModel as i, formatDateKey as l, isToday as m, TZDate as n, addMonths as o, isSameCalendarDay as p, groupItemsByDate as r, buildCalendarViewport as s, src_exports as t, getDayOfWeek as u };