@remit/web-client-dist 0.0.698 → 0.0.700

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 (201) hide show
  1. package/assets/{BriefPane-OvZiBDtW.js → BriefPane-1X78pLE1.js} +1 -1
  2. package/assets/{CalendarEventEditor-JBfO_GQa.js → CalendarEventEditor-GVmbgsnz.js} +1 -1
  3. package/assets/{CalendarEventPopup-U6Ndkn2v.js → CalendarEventPopup-BXpx-Ku2.js} +1 -1
  4. package/assets/{CalendarLoadFailed-CNaVKDtW.js → CalendarLoadFailed-C47ken4G.js} +1 -1
  5. package/assets/{CalendarQuickCreate-C-yc6zce.js → CalendarQuickCreate-Icz8bbCP.js} +1 -1
  6. package/assets/{CalendarSession-C_XnZoOI.js → CalendarSession-B6dbruSb.js} +1 -1
  7. package/assets/{CollectionPane-C6EYtyWc.js → CollectionPane-CHKXUrhZ.js} +1 -1
  8. package/assets/{DesktopChrome-DXIJ6wUA.js → DesktopChrome-Dv5ZCeNJ.js} +1 -1
  9. package/assets/{DropdownMenu-DsxemHc4.js → DropdownMenu-BaLCJNxL.js} +1 -1
  10. package/assets/{EmptyState-Dv8xCRkX.js → EmptyState-DNcM-EnL.js} +1 -1
  11. package/assets/{ErrorState-BptbbJAv.js → ErrorState-BTTbYobA.js} +1 -1
  12. package/assets/{FullCompose-BGLjrGst.js → FullCompose-CfHgzwr4.js} +1 -1
  13. package/assets/{LabelApplyTrigger-DzgVUcax.js → LabelApplyTrigger-C3JLcO9V.js} +1 -1
  14. package/assets/{MailShell-DE0ZN2ct.js → MailShell-F1IPFnEY.js} +1 -1
  15. package/assets/{MailViewChrome-DoBZYTxQ.js → MailViewChrome-0kmIcU2a.js} +1 -1
  16. package/assets/{MailboxPane-CxaGFC0R.js → MailboxPane-BH4Wy3IV.js} +1 -1
  17. package/assets/{MessageBody-BYYCZieC.js → MessageBody-Djhcr7mH.js} +1 -1
  18. package/assets/{MessageToolbar-CnhMX7Ap.js → MessageToolbar-DsaMB1As.js} +1 -1
  19. package/assets/{NavMenuButton-B28Nb9kR.js → NavMenuButton-DYR0-1E6.js} +1 -1
  20. package/assets/{OnboardingWizard-dQ9c99Ni.js → OnboardingWizard-wyK1Mh9q.js} +1 -1
  21. package/assets/{OutboxPane-ByJt4RDv.js → OutboxPane-BGB85Zw5.js} +1 -1
  22. package/assets/{ReportLink-D0tCso5T.js → ReportLink-BIbpn8n0.js} +1 -1
  23. package/assets/_calendarObjectId-UGnLOBrz.js +1 -0
  24. package/assets/_labelId-BEYs4sLQ.js +1 -0
  25. package/assets/_mailboxId-Cs76zwUj.js +1 -0
  26. package/assets/_messageId-BgokXSax.js +1 -0
  27. package/assets/_messageId-CfxVb_fy.js +1 -0
  28. package/assets/_messageId-CrEJ-3q6.js +1 -0
  29. package/assets/_messageId-CuuCAE3l.js +1 -0
  30. package/assets/_outboxMessageId-CVN9Jsje.js +1 -0
  31. package/assets/_recurrenceId-CpO73ca1.js +1 -0
  32. package/assets/{_slotId-BgSRkGdw.js → _slotId-Dup1VJ9f.js} +1 -1
  33. package/assets/_threadId-CeXaxU5-.js +1 -0
  34. package/assets/_threadId-DmBbZCRQ.js +1 -0
  35. package/assets/_threadId-Fpo0BNhS.js +1 -0
  36. package/assets/_threadId-KbaehKOy.js +1 -0
  37. package/assets/{_view._date-BCOouUgc.js → _view._date-Cyt_qJFk.js} +1 -1
  38. package/assets/{account-service-status-C6hq8flJ.js → account-service-status-DfJaPtgF.js} +1 -1
  39. package/assets/{accounts-B2HAE5Mp.js → accounts-CSTgaqDu.js} +1 -1
  40. package/assets/{advanced-BBWKSR4H.js → advanced-BMIK5PED.js} +1 -1
  41. package/assets/{agenda-time-C9jExuVe.js → agenda-time-jh144Gvm.js} +1 -1
  42. package/assets/{app-chrome-CS-vT-4r.js → app-chrome-D1NIvvpc.js} +1 -1
  43. package/assets/{appearance-oUeDfZvm.js → appearance-7JHpRG--.js} +1 -1
  44. package/assets/{avatar-B60PZejm.js → avatar-BL40ICSJ.js} +1 -1
  45. package/assets/{badge-DYFkBshe.js → badge-BuEj66zZ.js} +1 -1
  46. package/assets/{bottom-sheet-B0y_-mKC.js → bottom-sheet-BnrQALZr.js} +1 -1
  47. package/assets/brief-3bPqDpxR.js +1 -0
  48. package/assets/{brief-DBLwMpYO.js → brief-DhZbrkct.js} +1 -1
  49. package/assets/{calendar-Cf7D8za1.js → calendar-1FVjmRTn.js} +1 -1
  50. package/assets/{calendar-DON3hXqq.js → calendar-DWDr32Pg.js} +1 -1
  51. package/assets/{calendar-event-popup-BqE6svk6.js → calendar-event-popup-PVY1kYQF.js} +1 -1
  52. package/assets/{calendar-event-sidebar-BGvCPmWa.js → calendar-event-sidebar-BUfI3YjI.js} +1 -1
  53. package/assets/{calendar-failure-note-sEjmPcbo.js → calendar-failure-note-BVioFwWu.js} +1 -1
  54. package/assets/{calendar-guests-CuFcAD3k.js → calendar-guests-BqL_oNsB.js} +1 -1
  55. package/assets/{calendar-suggestion-CZ6ssHct.js → calendar-suggestion-k_ABH6QD.js} +1 -1
  56. package/assets/{calendars-9OZeuRv6.js → calendars-D4eBXLYf.js} +1 -1
  57. package/assets/{card-13z0qC0r.js → card-DT547OCZ.js} +1 -1
  58. package/assets/{checkbox-ZdvWSWRN.js → checkbox-BQtzZS8k.js} +1 -1
  59. package/assets/{chevron-down-wpFtElCn.js → chevron-down-pXHA84n5.js} +1 -1
  60. package/assets/{chevron-left-HeNgNNR2.js → chevron-left-BahGQZIk.js} +1 -1
  61. package/assets/{circle-check-Q9IHsvBp.js → circle-check-AS6dW8bL.js} +1 -1
  62. package/assets/{circle-check-big-C2cm1OoH.js → circle-check-big-CB4KqzoP.js} +1 -1
  63. package/assets/{circle-question-mark-CYsyue28.js → circle-question-mark-BaR50kvR.js} +1 -1
  64. package/assets/{classification-BxsZLEnC.js → classification-Dc4amyUU.js} +1 -1
  65. package/assets/{clock-D8a14yMJ.js → clock-Nfb5MDhL.js} +1 -1
  66. package/assets/{cloud-off-I2wH-wZi.js → cloud-off-BgkpB7KU.js} +1 -1
  67. package/assets/compose._-_outboxMessageId_-COLqOsyy.js +1 -0
  68. package/assets/compose._-_outboxMessageId_-DCQmLiHN.js +1 -0
  69. package/assets/compose._-_outboxMessageId_-DHsEuAW4.js +1 -0
  70. package/assets/compose._-_outboxMessageId_-DUhN13RX.js +1 -0
  71. package/assets/compose._-_outboxMessageId_-qlcrUpQ6.js +1 -0
  72. package/assets/{config-import-DTqOa38a.js → config-import-BZQDs381.js} +1 -1
  73. package/assets/{confirm-dialog-CsttDS5u.js → confirm-dialog-DYq0xqzk.js} +1 -1
  74. package/assets/{copy-V6gKiItu.js → copy-DQUWdx9U.js} +1 -1
  75. package/assets/{credential-steps-BPun50HH.js → credential-steps-CCGZ6JdD.js} +1 -1
  76. package/assets/{download-CHIm9QMw.js → download-Brw9q_-P.js} +1 -1
  77. package/assets/{draft-CUl68Y86.js → draft-Cd-2kcmd.js} +1 -1
  78. package/assets/edit-Cl3as_cw.js +1 -0
  79. package/assets/edit-DT7h9lL5.js +1 -0
  80. package/assets/{external-link-DinDD_TS.js → external-link-Dk90khCr.js} +1 -1
  81. package/assets/{file-braces-DSnr6-a7.js → file-braces-D8FfI4WO.js} +1 -1
  82. package/assets/{filters-BOpD_izN.js → filters-CHZmyfZw.js} +1 -1
  83. package/assets/{flagged-Cj4ARwpT.js → flagged-By_YD4cC.js} +1 -1
  84. package/assets/flagged-D7BRH9c-.js +1 -0
  85. package/assets/{folder-input-BqAxe_6s.js → folder-input-DKDXDpie.js} +1 -1
  86. package/assets/{folders-NwCVYN5L.js → folders-CHad3XAp.js} +1 -1
  87. package/assets/{help-copy-EtAi1Aq7.js → help-copy-CUON12Au.js} +1 -1
  88. package/assets/{import-DJMjk1Ri.js → import-LtyqW8iL.js} +1 -1
  89. package/assets/index-BZiOavIe.js +57 -0
  90. package/assets/index-CK8liNXs.js +1 -0
  91. package/assets/index-CXyrhsSF.js +1 -0
  92. package/assets/index-CrEJ-3q6.js +1 -0
  93. package/assets/index-CrdNZQNf.js +1 -0
  94. package/assets/index-CuuCAE3l.js +1 -0
  95. package/assets/index-D8Xl9aln.js +1 -0
  96. package/assets/{index-CKFdaY9c.js → index-DAdnmNGF.js} +3 -3
  97. package/assets/index-DS9vrT_q.js +1 -0
  98. package/assets/index-DfFfr-F8.js +1 -0
  99. package/assets/index-DiBpocpZ.js +1 -0
  100. package/assets/index-IJSR-1EH.js +1 -0
  101. package/assets/index-PL2et9Cy.js +1 -0
  102. package/assets/index-x7B0xpK4.js +1 -0
  103. package/assets/{kbd-qpWA48X9.js → kbd-Dck-H7HI.js} +1 -1
  104. package/assets/{label-chip-zwUAXSWu.js → label-chip-PA6sFIAt.js} +1 -1
  105. package/assets/{labels-CwGUliq_.js → labels-DsTLyF02.js} +1 -1
  106. package/assets/{mail-B-_K5JCo.js → mail-Bc_qCbu3.js} +1 -1
  107. package/assets/{mail-Bsgov7FY.js → mail-CNc7ptBm.js} +1 -1
  108. package/assets/{menu-CKmdL0us.js → menu-0smgSLZN.js} +1 -1
  109. package/assets/{nav-link-YOSchPy9.js → nav-link-DsF82VIK.js} +1 -1
  110. package/assets/new-DQ1DUWtx.js +1 -0
  111. package/assets/onboarding-ZeQ8izEG.js +1 -0
  112. package/assets/{onboarding-completion-cX9HM-aL.js → onboarding-completion-Bpy8dmzE.js} +1 -1
  113. package/assets/outbox-CfYm1ISa.js +1 -0
  114. package/assets/{pencil-C6KO5975.js → pencil-DzsoMa_O.js} +1 -1
  115. package/assets/{people-BhhvdCU4.js → people-C_xBLBOV.js} +1 -1
  116. package/assets/{plus-DsSkq30M.js → plus-B59D825u.js} +1 -1
  117. package/assets/{popover-menu-DP-hyKpu.js → popover-menu-CklSwxyo.js} +1 -1
  118. package/assets/{refresh-cw-CCcTeH3S.js → refresh-cw-CHIH0Wcb.js} +1 -1
  119. package/assets/{reply-SkF_KCOk.js → reply-iVDGWyKD.js} +1 -1
  120. package/assets/{rich-text-By6rXXKy.js → rich-text-BG71v2el.js} +1 -1
  121. package/assets/{rich-text-spellcheck-worker-provider-DQbI8hMR.js → rich-text-spellcheck-worker-provider-CYOVgYAu.js} +1 -1
  122. package/assets/{rotate-ccw-lh0BmpDo.js → rotate-ccw-DCz7Obdq.js} +1 -1
  123. package/assets/{roving-focus-DlzLpO4G.js → roving-focus-BKvgV51a.js} +1 -1
  124. package/assets/{row-actions-0g39M7ib.js → row-actions-BuX34ZFc.js} +1 -1
  125. package/assets/{search-mirror-D9nwr5km.js → search-mirror-zI1Wto7m.js} +1 -1
  126. package/assets/{search-scope-DNDpRNp9.js → search-scope-CCaj49Vd.js} +1 -1
  127. package/assets/{search-token-index-cy3uaYXm.js → search-token-index-BWG-pAOC.js} +1 -1
  128. package/assets/{sections-ZsRsk30_.js → sections-2qhslMDR.js} +1 -1
  129. package/assets/{segmented-control-CeqFpYfk.js → segmented-control-DAjB5Iim.js} +1 -1
  130. package/assets/{select-yGv73aji.js → select-C4OaQe9Y.js} +1 -1
  131. package/assets/{senders-lMWjFLIX.js → senders-CyRl3YXt.js} +1 -1
  132. package/assets/settings-DoyBSz9G.js +1 -0
  133. package/assets/{settings-screen-C8z8YwuM.js → settings-screen-CkqdkWAP.js} +1 -1
  134. package/assets/{shield-check-CIZoP3AE.js → shield-check-CtR5JIeP.js} +1 -1
  135. package/assets/{spam-D6paxCM2.js → spam-BcCIVQmt.js} +1 -1
  136. package/assets/{suggest-list-czu9q5H4.js → suggest-list-DfFvQ4CV.js} +1 -1
  137. package/assets/{suggested-vips-DXCCMmOn.js → suggested-vips-dDCIbwv4.js} +1 -1
  138. package/assets/{suggestion._suggestionId-zlbObxkn.js → suggestion._suggestionId-YO-ZCSDh.js} +1 -1
  139. package/assets/{switch-BezKd3gx.js → switch-D8q_07j1.js} +1 -1
  140. package/assets/{task._calendarTaskId-CgBc-n43.js → task._calendarTaskId-BNRB4ElI.js} +1 -1
  141. package/assets/{undo-2-CgG5m84e.js → undo-2-BVQZakOw.js} +1 -1
  142. package/assets/{useCalendarData-CgRGDHYQ.js → useCalendarData-Dw0DbJWn.js} +1 -1
  143. package/assets/{useCalendarScheduling-BhFuxgru.js → useCalendarScheduling-CdGHvRHZ.js} +1 -1
  144. package/assets/{useCalendarSuggestions-BaIFwYBZ.js → useCalendarSuggestions-p-hH5nuf.js} +1 -1
  145. package/assets/{useCalendarTasks-CnP7DfUR.js → useCalendarTasks-DMazKBtK.js} +1 -1
  146. package/assets/{useClassificationSettings-Bk89yu99.js → useClassificationSettings-CO0hn9NU.js} +1 -1
  147. package/assets/{useCollectionThreads-BMsppZhN.js → useCollectionThreads-CPr4txVm.js} +1 -1
  148. package/assets/{useDebouncedValue-BpDHcfPe.js → useDebouncedValue-C9NNbS8g.js} +1 -1
  149. package/assets/{useFilters-Cv2IfE4J.js → useFilters-BMKRyTCu.js} +1 -1
  150. package/assets/{useInfiniteQuery-DwTTxcsy.js → useInfiniteQuery-CK5IyvrU.js} +1 -1
  151. package/assets/{useJunkMailboxIds-CDFS8XJA.js → useJunkMailboxIds-CdTwA43P.js} +1 -1
  152. package/assets/{useLabels-BIArT792.js → useLabels-CX2FfltE.js} +1 -1
  153. package/assets/{useLayoutTier-Y7Z9Nnsm.js → useLayoutTier-D0BFfVm6.js} +1 -1
  154. package/assets/{useMediaQuery-CjE8xNMz.js → useMediaQuery-CH9DMslv.js} +1 -1
  155. package/assets/{useMessageBodyContent-D5mskS3v.js → useMessageBodyContent-B2YcWG0V.js} +1 -1
  156. package/assets/{useQueries-CQ_R-NWg.js → useQueries-D7oIAKqU.js} +1 -1
  157. package/assets/{useRefreshControl-DwtRYeei.js → useRefreshControl-BYVDaLtF.js} +1 -1
  158. package/assets/{useResultFolderIndex-ZNSoZByc.js → useResultFolderIndex-B4dE8eq5.js} +1 -1
  159. package/assets/{useSignature-CnLh1XFv.js → useSignature-CrwNi268.js} +1 -1
  160. package/assets/{warnings-zZSUr-_I.js → warnings-DweDlyG4.js} +1 -1
  161. package/index.html +1 -1
  162. package/package.json +1 -1
  163. package/assets/_calendarObjectId-DA9THlEZ.js +0 -1
  164. package/assets/_labelId-QQEJSaaH.js +0 -1
  165. package/assets/_mailboxId-CjHcitFP.js +0 -1
  166. package/assets/_messageId-BR_TgwKr.js +0 -1
  167. package/assets/_messageId-CAxQBVFC.js +0 -1
  168. package/assets/_messageId-CO7AhNVu.js +0 -1
  169. package/assets/_messageId-D0sfforj.js +0 -1
  170. package/assets/_outboxMessageId-CuYUqctH.js +0 -1
  171. package/assets/_recurrenceId-CLQuwNQw.js +0 -1
  172. package/assets/_threadId-BGKDrxuA.js +0 -1
  173. package/assets/_threadId-Ba8E2aAx.js +0 -1
  174. package/assets/_threadId-Br_FU4M4.js +0 -1
  175. package/assets/_threadId-D9ge4hnK.js +0 -1
  176. package/assets/brief--Wmhw18k.js +0 -1
  177. package/assets/compose._-_outboxMessageId_-BGkih4eY.js +0 -1
  178. package/assets/compose._-_outboxMessageId_-CivLnC_Q.js +0 -1
  179. package/assets/compose._-_outboxMessageId_-DhaK6pb5.js +0 -1
  180. package/assets/compose._-_outboxMessageId_-cX-iEK_S.js +0 -1
  181. package/assets/compose._-_outboxMessageId_-nFk2BCjJ.js +0 -1
  182. package/assets/edit-CO4QGWtB.js +0 -1
  183. package/assets/edit-DRr0H801.js +0 -1
  184. package/assets/flagged-BLzcJrUz.js +0 -1
  185. package/assets/index-6MdUWIJB.js +0 -1
  186. package/assets/index-B3pRGruo.js +0 -1
  187. package/assets/index-BDF8UTpu.js +0 -1
  188. package/assets/index-BQ2vE6gp.js +0 -57
  189. package/assets/index-BoKIe_Hw.js +0 -1
  190. package/assets/index-CO7AhNVu.js +0 -1
  191. package/assets/index-CR5Op_4t.js +0 -1
  192. package/assets/index-D0sfforj.js +0 -1
  193. package/assets/index-DLuz5acm.js +0 -1
  194. package/assets/index-DqCcXbbs.js +0 -1
  195. package/assets/index-GZXGsbCN.js +0 -1
  196. package/assets/index-PBPFqVVA.js +0 -1
  197. package/assets/index-h2rbe_XB.js +0 -1
  198. package/assets/new-DKJdGwfE.js +0 -1
  199. package/assets/onboarding-pnezHKXj.js +0 -1
  200. package/assets/outbox-CLnMeXYO.js +0 -1
  201. package/assets/settings-C8z99CK0.js +0 -1
@@ -1 +1 @@
1
- import{b as Wn,r as S,j as d,p as j,x as Vn,ch as lc,ci as Yt,aj as Ys,at as cc,ag as Sa,e as dc,s as uc,cj as fc,ck as Rn,X as hc,aE as wa,cl as Gs,S as gc,cm as mc,cn as Zs,L as pc,co as qs,cp as vc,O as yc}from"./index-CKFdaY9c.js";import{d as sn,M as bc,e as Ec,r as Da,f as vt,U as Sc,g as wc,h as Dc,i as xa,b as Ca,c as Ir,j as xc,k as Cc,l as Tc}from"./useCalendarSuggestions-BaIFwYBZ.js";import{a as Rc}from"./useCalendarScheduling-BhFuxgru.js";import{u as Nc}from"./useCalendarTasks-CnP7DfUR.js";import{s as Mc,u as Ic,a as kc,b as Pc,R as jc,c as Hc}from"./useCalendarData-CgRGDHYQ.js";import{a as Oc,b as Ac,p as Xs}from"./nav-link-YOSchPy9.js";import"./reply-SkF_KCOk.js";import{a as ts,b as ns,c as Ta,d as Lc,e as _c,u as Uc}from"./calendar-DON3hXqq.js";import{C as Ra,a as Na,c as kr,r as Fc,b as Bc,d as Wc,w as Vc,e as Ks,f as zc,g as $c,h as Yc,l as Gc,i as Zc,j as qc,k as Xc,m as Kc,E as Qc,s as Jc,t as ed,n as td,o as nd,p as rd}from"./calendar-suggestion-CZ6ssHct.js";import{u as sd}from"./useDebouncedValue-BpDHcfPe.js";import{b as id,w as ad,m as od,f as Pr,a as ld,g as cd,c as Gt,d as ze,e as dd,D as fr,h as Qs,i as nt,j as ke,k as ud,r as fd,l as hd}from"./agenda-time-C9jExuVe.js";import{f as gd,E as md}from"./ErrorState-BptbbJAv.js";import{C as pd}from"./clock-D8a14yMJ.js";import{C as jr}from"./CalendarLoadFailed-CNaVKDtW.js";import{P as Ma}from"./plus-DsSkq30M.js";import{C as vd,A as yd}from"./account-service-status-C6hq8flJ.js";import{C as bd}from"./chevron-down-wpFtElCn.js";import{C as Ia}from"./chevron-left-HeNgNNR2.js";import{C as Ed}from"./CalendarQuickCreate-C-yc6zce.js";import{C as Sd}from"./CalendarSession-C_XnZoOI.js";import{f as wd}from"./calendar-format-BwCpz-JZ.js";import{d as Dd,p as xd}from"./draft-CUl68Y86.js";import{C as ka}from"./calendar-event-popup-BqE6svk6.js";import{C as Cd}from"./calendar-failure-note-sEjmPcbo.js";import{S as Td}from"./select-yGv73aji.js";import{M as Rd}from"./menu-CKmdL0us.js";import{a as Nd,b as Md}from"./calendar-guests-CuFcAD3k.js";import{u as Id}from"./useLayoutTier-Y7Z9Nnsm.js";import"./useQueries-CQ_R-NWg.js";import"./list-pages-BCUbyyea.js";import"./useMediaQuery-CjE8xNMz.js";import"./mail-Bsgov7FY.js";import"./pencil-C6KO5975.js";import"./circle-question-mark-CYsyue28.js";const Pa={name:"calendar-off",size:24,node:[["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 9h-5.5",key:"1g344v"}],["path",{d:"M3 9h6",key:"1q2djq"}],["path",{d:"M3.586 3.586A2 2 0 003 5v14a2 2 0 002 2h14a2 2 0 001.414-.586",key:"1g7ltu"}],["path",{d:"M8.656 3H19a2 2 0 012 2v10.344",key:"1bwpd1"}]]};Pa.node;const kd=Wn(Pa);const ja={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]};ja.node;const Pd=Wn(ja);const Ha={name:"radio",size:24,node:[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};Ha.node;const jd=Wn(Ha);const Oa={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};Oa.node;const Hd=Wn(Oa),lt=globalThis.Temporal,Od=(t,e)=>`Non-positive ${t}: ${e}`,Ad=(t,e)=>`Non-finite ${t}: ${e}`,Ld=t=>`Cannot convert bigint to ${t}`,_d="Invalid object",Ud=(t,e,n,r)=>zn(t,e)+`; must be between ${n}-${r}`,zn=(t,e)=>`Invalid ${t}: ${e}`,Fd=1e3,Bd=1e6,Wd=1e9,Vd=6e10,zd=36e11;function $d(t){return t===void 0?Object.create(null):Zd(t)}function Aa(t,e="number"){if(typeof t=="bigint")throw new TypeError(Ld(e));if(t=Number(t),!Number.isFinite(t))throw new RangeError(Ad(e,t));return t}function rs(t,e){return Math.trunc(Aa(t,e))||0}function Js(t,e){return Yd(rs(t,e),e)}function Yd(t,e="number"){if(t<=0)throw new RangeError(Od(e,t));return t}function Gd(t,e,n){return Math.min(Math.max(t,e),n)}function La(t){return t!==null&&(typeof t=="object"||typeof t=="function")}function Zd(t){if(!La(t))throw new TypeError(_d);return t}const qd=zn,Xd=t=>`Missing ${t}`,Kd=(t,e,n)=>zn(t,e)+"; must be "+Object.keys(n).join(),Qd="Cannot use valueOf",Jd="Invalid calling context",eu=(t,e)=>`Unknown calendar ${t}; might need ${e}`,tu=t=>zn("TimeZone",t),$n="Out-of-bounds date",nu=t=>`Invalid substring: ${t}`,_a=Gd;function be(t){throw new RangeError(t)}function It(t){throw new TypeError(t)}function ei(t,e,n,r,s){return Ua(e,((i,a)=>{const o=i[a];return o===void 0&&It(Xd(a)),o})(t,e),n,r)}function Ua(t,e,n,r,s,i){const a=_a(e,n,r);return e!==a&&be(((o,l,c,u,f)=>Ud(o,l,c,u))(t,e,n,r)),a}function Ct(t,e=Map){const n=new e;return(r,...s)=>{if(n.has(r))return n.get(r);const i=t(r,...s);return n.set(r,i),i}}const ru=t=>su({name:t}),su=(t,e)=>ss(n=>({value:n,configurable:1,writable:!1}),t),iu=t=>({[Symbol.toStringTag]:{value:t,configurable:1}});function ss(t,e){const n={};for(const r in e)n[r]=t(e[r],r);return n}function au(t,e){const n={};for(const r of t)n[r]=e;return n}function Fa(t){const e={};for(const n of t)e[n]=r=>r[n];return e}function Ba(t,e,n=Object.create(null)){for(const r of t)n[r]=e[r];return n}function is(t,...e){return(...n)=>t(...e,...n)}function ti(){}function ni(t){return t[0].toUpperCase()+t.substring(1)}function ou(t){return new RegExp(`^${t}$`,"i")}function lu(t){return parseInt(t.padEnd(9,"0"))}function cu(t){return t&&t!=="+"?-1:1}function hr(t){return t===void 0?0:parseInt(t)}function Nn(t,e){return String(e).padStart(t,"0")}const Ae=is(Nn,2);function du(t,e){return Math.sign(t-e)}function Wa(t,e){const n=t/e;return t%e<0n?n-1n:n}function Va(t,e){const n=Wa(t,e);return[n,t-n*e]}function Ve(t,e){return[Math.floor(t/e),Yn(t,e)]}function Yn(t,e){return(t%e+e)%e}function uu(t,e){return Math.trunc(t/e)||0}function gn(t){return Math.abs(t%1)===.5}function fu(t){const e=t.normalize("NFD").toLowerCase().replace(/[^a-z0-9]/g,"");return e==="bc"||e==="b"?"bce":e==="ad"||e==="a"?"ce":e}const kt=void 0;function Gn(t){return t===kt?"iso8601":t===0?"gregory":t.id}function hu(t,e){return"M"+Ae(t)+(e?"L":"")}const gu={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},mu=Object.keys(gu),as=Fd,Zn=Bd,an=Wd,os=Vd,za=zd,ls=864e11,$a=BigInt(Zn),Hr=BigInt(an),rt=BigInt(ls),qn=mu.slice(0,6),cs=Fa(qn),pu=["day","month","year"];function vu(t){return bu(t),t}const yu={hour:23,minute:59,second:59};function bu(t,e){const n={};for(const r of qn)n[r]=Ua(r,t[r],0,yu[r]||999);return n}function ds(t){return Ya(t)*an+Ga(t)}function Ya(t){return 3600*t.hour+60*t.minute+t.second}function Ga(t){return t.millisecond*Zn+t.microsecond*as+t.nanosecond}function Eu(t){const[e,n]=Ve(t,Zn),[r,s]=Ve(n,as);return Su(e,r,s)}function Su(t,e=0,n=0){const[r,s]=Ve(t,36e5),[i,a]=Ve(s,6e4),[o,l]=Ve(a,1e3);return{hour:r,minute:i,second:o,millisecond:l,microsecond:e,nanosecond:n}}function ri(t){const[e,n]=Va(t,Hr);return[Number(e),Number(n)]}function wu(t){return us(t)+BigInt(ds(t))}function us(t){return BigInt(Mn(t))*rt}function Mn(t){return Zt(t.year,t.month,t.day)}function Zt(t,e=1,n=1){const r=e-1;return t+=Math.floor(r/12),e=Yn(r,12),Date.UTC(t%400-400,e,0)/864e5+146097*(uu(t,400)+1)+n}function Xn(t){const[e,n]=Va(t,rt);return{...Du(Number(e)),...Eu(Number(n))}}function Du(t){const e=new Date(864e5*Yn(t,146097));return{year:e.getUTCFullYear()+400*Math.floor(t/146097),month:e.getUTCMonth()+1,day:e.getUTCDate()}}function xu(t){return[t,0]}function Cu(t,e,n){return{year:t,month:e,day:n}}function Za(t,e){switch(e){case 2:return Kn(t)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function Tu(t){return Kn(t)?366:365}function Kn(t){return t%4==0&&(t%100!=0||t%400==0)}function fs(t){return Yn(Zt(t.year,t.month,t.day)+4,7)||7}function qa(t){return Zt(t.year,t.month,t.day)-Zt(t.year)+1}function Xa(t){let e=t.year,n=Math.floor((qa(t)-fs(t)+10)/7),r=gr(e);return n<1?n=r=gr(--e):n>r&&(n=1,r=gr(++e)),{weekOfYear:n,yearOfWeek:e,Be:r}}function gr(t){const e=fs({year:t,month:1,day:1});return e===4||e===3&&Kn(t)?53:52}function Ru({year:t}){return t<1?{era:"bce",eraYear:1-t}:{era:"ce",eraYear:t}}function Nu(t){return Mu(t),vu(t)}function Mu(t){return Iu(t),t}function Iu(t,e){const{year:n}=t,r=ei(t,"month",1,12);return{year:n,month:r,day:ei(t,"day",1,Za(n,r))}}function Le(t,e){return t?t.ae(e):e}function ku(t,e,n){return t?t.L(e,n):xu(n)}function si(t,e){return t===0?Ru(e):t&&t.h?.(e)||{}}function Pu(t,e,n,r){return t?t.de(e,n,r):Cu(e,n,r)}function ju(t,e){return t?t.j(e):12}function Hu(t,e,n){return t?t.o(e,n):Za(e,n)}function Ou(t,e){const{year:n,month:r}=Le(t,e),[s,i]=ku(t,n,r);return hu(s,i)}function Ka(t,e){const{year:n}=Le(t,e);return t?t.q(n):Kn(n)}function Qa(t,e){const{year:n}=Le(t,e);return ju(t,n)}function Ja(t,e){const{year:n,month:r}=Le(t,e);return Hu(t,n,r)}function eo(t,e){const{year:n}=Le(t,e);return t?t.i(n):Tu(n)}function Au(t,e){if(!t)return qa(e);const{year:n}=Le(t,e),r=Pu(t,n,1,1);return Mn(e)-Mn(r)+1}function Lu(t,e){return t===kt?Xa(e).weekOfYear:void 0}function _u(t,e){return t===kt?Xa(e).yearOfWeek:void 0}const In=is(Uu,"string");function Uu(t,e,n=t){return typeof e!==t&&It(qd(n,e)),e}function Fu(t,e="number"){return Number.isInteger(t)||be(((n,r)=>`Non-integer ${n}: ${r}`)(e,t)),t||0}function Bu(t){return typeof t=="symbol"&&It("Cannot convert Symbol to string"),String(t)}function Wu(t,e){return La(t)?String(t):In(t,e)}function Vu(t,e){return Fu(Aa(t,e),e)}const zu={compatible:0,reject:1,earlier:2,later:3},$u=[Math.floor,t=>gn(t)?Math.floor(t):Math.round(t),Math.ceil,t=>gn(t)?Math.ceil(t):Math.round(t),Math.trunc,t=>gn(t)?Math.trunc(t)||0:Math.round(t),t=>t<0?Math.floor(t):Math.ceil(t),t=>Math.sign(t)*Math.round(Math.abs(t))||0,t=>gn(t)?(t=Math.trunc(t)||0)+t%2:Math.round(t)];function Yu(t,e,n,r=0){const s=n[t];if(s===void 0)return r;const i=Bu(s),a=e[i];return a===void 0&&be(Kd(t,i,e)),a}const Gu=is(Yu,"disambiguation",zu),to=BigInt(1e8)*rt,hs=BigInt(-1e8)*rt,no=hs-rt;function Zu(t){const e=us(t);return qu(e),e!==no||ds(t)||be($n),t}function qu(t,e=1){(t<(e?no:hs)||t>to)&&be($n)}function Qn(t){return(t<hs||t>to)&&be($n),t}function Xu(t,e){return Qn(us(t)+BigInt(ds(t)-e))}function Ku(t){return{epochNanoseconds:t}}function ro(t,e,n){return{calendar:n,timeZone:e,epochNanoseconds:t}}function Qu(t,e){return Ba(qn,t,Ju(t,e))}function Ju(t,e){return Ba(pu,t,{calendar:e})}function so(t){return e=t.epochNanoseconds,Number(Wa(e,$a));var e}function io(t){return t.epochNanoseconds}function ef(t){return tf(t,os,7)}function tf(t,e,n){return nf(t/e,n)*e}function nf(t,e){return $u[e](t)}const ao=Ct(rf,WeakMap);function rf(t){const{epochNanoseconds:e,timeZone:n}=t,r=n.B(e);return{...Xn(e+BigInt(r)),offsetNanoseconds:r}}function sf(t,e,n=0,r=t.N(e)){if(r.length===1)return r[0];if(n===1&&be("Ambiguous offset"),r.length)return r[n===3?1:0];const s=wu(e),i=((o,l)=>{const c=o.B(l-rt);return(u=>(u>ls&&be("Out-of-bounds TimeZone gap"),u))(o.B(l+rt)-c)})(t,s),a=Xn(s+BigInt(i*(n===2?-1:1)));return(r=t.N(a))[n===2?0:r.length-1]}const af=ou("([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?");function of(t,e){const n=af.exec(t);if(n&&(r=>(s=>{s[0]!=="T"&&s[0]!=="t"||(s=s.slice(1));const i=s.search(/[.,]/),a=i<0?s:s.slice(0,i),o=a.split(":");return o.length===1?/^(?:\d{2}|\d{4}|\d{6})$/i.test(a):(o.length===2||o.length===3)&&o.every(l=>l.length===2&&/^\d{2}$/i.test(l))})(r.slice(1)))(n[0]))return((r,s)=>{const i=r[4]||r[5];return i&&be(nu(i)),o=(hr(r[2])*za+hr(r[3])*os+hr(r[4])*an+lu(r[5]||""))*cu(r[1]),Math.abs(o)>=ls&&be("Out-of-bounds offset"),o;var o})(n)}const lf={era:Wu,month:Js,monthCode(t,e){if(typeof t=="string")return t;if(t&&typeof t=="object"){const n=t.toString;if(typeof n=="function")return In(n.call(t),e)}return In(t,e)},day:Js},cf=au(qn,rs),df=Object.assign({},lf,cf);({...df});const uf=Intl.DateTimeFormat;function ff(t,e){e<-864e13&&be($n);const n=t.formatToParts(e),r={};for(const s of n)r[s.type]=s.value;return r}const hf={El_Aaiun:17,Tucuman:12,Tirane:11,Riga:10,Simferopol:9,Vienna:9,Tunis:8,Boa_Vista:6,Fortaleza:6,Maceio:6,Noronha:6,Recife:6,Gaza:6,Hebron:6,DeNoronha:6},mr=-388152e4;function gf(t){return gs(Xn(t.epochNanoseconds))+"Z"}function mf(t){const e=t.calendar,n=t.timeZone,r=n.B(t.epochNanoseconds);return gs(Xn(t.epochNanoseconds+BigInt(r)))+oo(ef(r))+Ef(n.id)+(e===kt?"":lo(Gn(e)))}function pf(t){const e=t.calendar;return gs(t)+(e===kt?"":lo(Gn(e)))}function gs(t,e){return vf(t)+"T"+bf(t)}function vf(t){return yf(t)+"-"+Ae(t.day)}function yf(t){const{year:e}=t;return(e<0||e>9999?uo(e)+Nn(6,Math.abs(e)):Nn(4,e))+"-"+Ae(t.month)}function bf(t,e){const n=[Ae(t.hour),Ae(t.minute)];return n.push(Ae(t.second)+((r,s,i,a)=>co(r*Zn+s*as+i))(t.millisecond,t.microsecond,t.nanosecond)),n.join(":")}function oo(t,e=0){if(e===1)return"";const[n,r]=Ve(Math.abs(t),za),[s,i]=Ve(r,os),[a,o]=Ve(i,an);return uo(t)+Ae(n)+":"+Ae(s)+(a||o?":"+Ae(a)+co(o):"")}function Ef(t,e){return"["+t+"]"}function lo(t,e){return"[u-ca="+t+"]"}const Sf=/0+$/;function co(t,e){let n=Nn(9,t);return n=n.replace(Sf,""),n?"."+n:""}function uo(t){return t<0?"-":"+"}const wf=/^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/,Df=/[^\w\/:+-]+/;function fo(t){return xf(In(t))}function xf(t){return ho(t).id}function ho(t){const e=t.toUpperCase(),n=(s=>{const i=of(s);if(i!==void 0)return{id:oo(i),X:i,m:i}})(e);if(n)return{kind:"fixed",...n};const r=e==="UTC"?"UTC":(s=>(Df.test(s)&&be(tu(s)),wf.test(s)&&be("Forbidden ICU TimeZone"),s.toLowerCase().split("/").map((i,a)=>(i.length<=3||/\d/.test(i))&&!/etc|yap/.test(i)?i.toUpperCase():i.replace(/baja|dumont|[a-z]+/g,(o,l)=>o.length<=2&&!a||o==="in"||o==="chat"?o.toUpperCase():o.length>2||!l?ni(o).replace(/island|noronha|murdo|rivadavia|urville/,ni):o)).join("/")))(t);return Cf(r)}const Cf=Ct(t=>{if(t==="UTC")return{kind:"utc",id:t,m:t};const e=t.toUpperCase(),n=Tf(e);return{kind:"named",id:t,format:n,m:n.resolvedOptions().timeZone}}),Tf=Ct(t=>new uf("en-u-hc-h23",{calendar:"iso8601",timeZone:t,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}));function go(t){const e=ho(t);return Rf(e.id,e)}const Rf=Ct((t,e)=>e.kind==="named"?new Mf(t,e.m,e.format):new Nf(t,e.m,e.kind==="fixed"?e.X:0));class Nf{constructor(e,n,r){this.id=e,this.m=n,this.X=r}B(){return this.X}N(e){return[Xu(e,this.X)]}O(){}}class Mf{constructor(e,n,r){this.id=e,this.m=n,this.ke=((s,i)=>{const a=Ct(s),o=Ct(If),l=86400*i;function c(f){const[h,g]=ai(f,l),v=mn(h),m=mn(g),E=a(v),C=a(m);return E===C?E:u(o(v,m),E,C,f)}function u(f,h,g,v){let m,E;for(;(v===void 0||(m=v<f[0]?h:v>=f[1]?g:void 0)===void 0)&&(E=f[1]-f[0]);){const C=f[0]+Math.floor(E/2);s(C)===g?f[1]=C:f[0]=C+1}return m}return{xe(f){const h=c(f-86400),g=c(f+86400),v=f-h,m=f-g;if(h===g)return[v];const E=c(v);return E===c(m)?[f-E]:h>g?[v,m]:[]},we:c,O:function f(h,g){if(g>0&&h>=864e10)return;if(g<0){if(h<=mr)return;const T=ii()+94867200;if(h>T)return f(T,-1)}const v=g>0?Math.max(h,mr):h;let[m,E]=ai(v,l);const C=l*g,R=g>0?Math.max(h,ii())+94867200:mr,x=()=>g<0?E>R:m<R;for(;x();){const T=mn(m),M=mn(E),D=a(T),N=a(M);if(D!==N){const P=o(T,M);u(P,D,N);const H=P[0];if((du(H,h)||1)===g)return H}m+=C,E+=C}}}})((s=>i=>{const a=ff(s,1e3*i);return 86400*Zt((o=>{const l=o.relatedYear;if(l!==void 0)return parseInt(l);const c=parseInt(o.year);return o.era!==void 0&&fu(o.era)==="bce"?1-c:c})(a),parseInt(a.month),parseInt(a.day))+3600*parseInt(a.hour)+60*parseInt(a.minute)+parseInt(a.second)-i})(r),(s=>{const i=s.split("/").pop();return hf[i]||60})(e))}B(e){return this.ke.we((n=>ri(n)[0])(e))*an}N(e){const n=86400*Mn(e)+Ya(e),r=Ga(e);return this.ke.xe(n).map(s=>Qn(BigInt(s)*Hr+BigInt(r)))}O(e,n){const[r,s]=ri(e),i=this.ke.O(r+(n>0||s?1:0),n);if(i!==void 0)return BigInt(i)*Hr}}function ii(){return Math.floor(Date.now()/1e3)}function If(t,e){return[t,e]}function ai(t,e){const n=Math.floor(t/e)*e;return[n,n+e]}function mn(t){return _a(t,-1e10,864e10)}function kf(t,e,n){return ro(t.epochNanoseconds,e,n)}function Pf(t,e,n){const r=sf(e,t,(s=>Gu($d(s)))(n));return ro(Qn(r),e,t.calendar)}function jf(t){return Ku(Qn(BigInt(Vu(t))*$a))}function Hf(t,e,n,r,s){const i=new Set(t),a=new Set(e),o=new Set(n);return(l,c)=>{let u,f;const h={},g={},v={};let m=0,E=0;for(const H of Object.keys(l)){const U=l[H];U===void 0||o.has(H)||(i.has(H)?H==="dateStyle"?u=U:H==="timeStyle"?f=U:h[H]=U:H==="era"?g[H]=U:a.has(H)?H==="dateStyle"||H==="timeStyle"?E=1:m=1:v[H]=U)}const C=u!==void 0,R=f!==void 0,x=C||R,T=Object.keys(h).length>0,M=m||E,D=T||C||R,N=Object.keys(g).length>0;(!c&&M||c&&M&&!D||x&&(T||N||m))&&It("Invalid formatting options");const P={};return x||D||Object.assign(P,r),Object.assign(P,h,g,v),C&&(s?Object.assign(P,s[u]):P.dateStyle=u),R&&(P.timeStyle=f),P}}const Of={year:"numeric",month:"numeric",day:"numeric"},Af={hour:"numeric",minute:"numeric",second:"numeric"},Lf=Object.assign({},Of,Af),_f=["weekday","year","month","day","dateStyle"],Uf=["dayPeriod","hour","minute","second","fractionalSecondDigits","timeStyle"],Ff=_f.concat(Uf);({...Lf});const Bf="PlainDateTime",Wf="ZonedDateTime",Vf="Instant";function Pt(t,e,n,...r){return Object.defineProperties(e,ru(t)),Object.defineProperties(e.prototype,iu("Temporal."+t)),Object.defineProperties(e.prototype,ss(s=>({get(){return s(n(this))},configurable:1}),Object.assign({},...r))),e}const jt=ti.name==="noop"?t=>{Object.defineProperty(t,"_str_",{value:t.toJSON()})}:ti;function Jn(){It(Jd)}function ms(){It(Qd)}const ps={era(t){return si(t.calendar,t).era},eraYear(t){return si(t.calendar,t).eraYear},year(t){return Le(t.calendar,t).year},month(t){return Le(t.calendar,t).month},monthCode(t){return Ou(t.calendar,t)},day(t){return Le(t.calendar,t).day}},zf={daysInMonth(t){return Ja(t.calendar,t)},daysInYear(t){return eo(t.calendar,t)},monthsInYear(t){return Qa(t.calendar,t)},inLeapYear(t){return Ka(t.calendar,t)}},$f={dayOfWeek(t){return fs(t)},dayOfYear(t){return Au(t.calendar,t)},weekOfYear(t){return Lu(t.calendar,t)},yearOfWeek(t){return _u(t.calendar,t)},daysInWeek(){return 7},daysInMonth(t){return Ja(t.calendar,t)},daysInYear(t){return eo(t.calendar,t)},monthsInYear(t){return Qa(t.calendar,t)},inLeapYear(t){return Ka(t.calendar,t)}};function kn(t){return Fa(Object.keys(t))}const mo=kn(cs),po=kn(ps);kn(zf),kn($f);const pr=32,vo=150,Yf="cal-1",Gf=600,Zf=900,qf=1500,Xf=new Set;function Kf(t){const e=new Map(t.map(n=>[n.id,n]));return{color:n=>e.get(n)?.color??Yf,name:n=>e.get(n)?.name??""}}function Qf({days:t,calendars:e,density:n,today:r,focusDate:s,selectedEventId:i,onSelectEvent:a,onPickSlot:o,onZoomDay:l,onReachStart:c,onReachEnd:u,onVisibleDayChange:f,atStartCap:h=!1,atEndCap:g=!1,onLoadEarlier:v,onLoadLater:m,loadingDates:E=Xf,freeOn:C=Pr,scrollTarget:R,todayLead:x,touch:T,className:M}){const D=S.useRef(null),N=S.useRef(new Map),P=S.useRef(t[0]?.date??""),H=S.useRef(0),U=S.useRef(""),te=S.useRef(""),W=S.useRef(!1),V=S.useRef(0),ne=S.useRef(0),[ae,le]=S.useState(s),Pe=S.useMemo(()=>Kf(e),[e]),Ie=id(t,[r,s,...E]),re=t[0]?.date??"",xe=t[t.length-1]?.date??"";S.useLayoutEffect(()=>{const _=D.current;_&&(re!==""&&re<P.current&&(_.scrollTop+=_.scrollHeight-H.current),P.current=re,H.current=_.scrollHeight,V.current=_.scrollTop)}),S.useEffect(()=>{if(W.current)return;const _=D.current;if(!_)return;W.current=!0;let q=!1;const oe=()=>{const F=N.current.get(s);q||!F||(_.scrollTop=F.offsetTop-pr,V.current=_.scrollTop)};oe(),le(s);const ce=requestAnimationFrame(oe);return document.fonts?.ready.then(oe),()=>{q=!0,cancelAnimationFrame(ce)}},[s]),S.useEffect(()=>{if(!R)return;const _=D.current,q=N.current.get(R.date);!_||!q||(_.scrollTop=q.offsetTop-pr,V.current=_.scrollTop,le(R.date),f(R.date))},[R,f]),S.useEffect(()=>{const _=D.current;if(!_)return;const q=()=>{ne.current=Date.now()},oe=["wheel","pointerdown","touchstart","touchmove","keydown"],ce=F=>{F.buttons!==0&&q()};for(const F of oe)_.addEventListener(F,q,{passive:!0});return _.addEventListener("pointermove",ce,{passive:!0}),()=>{for(const F of oe)_.removeEventListener(F,q);_.removeEventListener("pointermove",ce)}},[]);const Ge=()=>{const _=D.current;if(!_)return;const q=_.scrollTop,oe=q-V.current;if(V.current=q,oe===0||Date.now()-ne.current>qf)return;const ce=[...N.current.entries()].filter(([,de])=>de.isConnected).sort((de,je)=>de[1].offsetTop-je[1].offsetTop);let F="";for(const[de,je]of ce){if(je.offsetTop-pr-8>q)break;F=de}F!==""&&F!==ae&&(le(F),f(F)),oe<0&&q<Gf&&U.current!==re&&(U.current=re,c()),oe>0&&q+_.clientHeight>_.scrollHeight-Zf&&te.current!==xe&&(te.current=xe,u())},Ze=_=>q=>{q?N.current.set(_,q):N.current.delete(_)};return d.jsxs("div",{ref:D,onScroll:Ge,"data-testid":"agenda-strip",className:j("relative min-h-0 flex-1 overflow-y-auto bg-surface",M),children:[d.jsxs("div",{className:"sticky top-0 z-20 flex h-8 items-center gap-2 border-b border-line bg-surface/95 px-row-inset backdrop-blur",children:[d.jsx("span",{className:"text-xs font-semibold text-fg",children:ad(ae)}),d.jsx("span",{className:"text-xs text-fg-subtle",children:od(ae)}),ae===r&&d.jsx("span",{className:"rounded-full bg-accent-soft px-1.5 text-2xs font-medium text-accent",children:"Today"})]}),h&&v&&d.jsx(oi,{label:"Show earlier days",testId:"agenda-load-earlier",onLoad:v,touch:T}),Ie.map(_=>d.jsx(Jf,{row:_,lookup:Pe,density:n,today:r,pending:_.kind==="day"&&E.has(_.day.date),freeOn:C,selectedEventId:i,onSelectEvent:a,onPickSlot:o,onZoomDay:l,anchorRef:Ze(_.kind==="day"?_.day.date:_.from),lead:_.kind==="day"&&_.day.date===r?x:null,touch:T},_.key)),g&&m&&d.jsx(oi,{label:"Show later days",testId:"agenda-load-later",onLoad:m,touch:T})]})}function oi({label:t,testId:e,onLoad:n,touch:r}){return d.jsx("button",{type:"button",onClick:n,"data-testid":e,className:j("flex w-full items-center justify-center gap-2 border-y border-dashed border-line bg-surface-sunken px-row-inset text-xs font-medium text-fg-muted outline-none transition-colors hover:border-accent hover:text-accent focus-visible:ring-2 focus-visible:ring-ring",r?"min-h-14 py-3":"py-2"),children:t})}function Jf({row:t,lookup:e,density:n,today:r,pending:s,freeOn:i,selectedEventId:a,onSelectEvent:o,onPickSlot:l,onZoomDay:c,anchorRef:u,lead:f,touch:h}){return t.kind==="run"?d.jsx("div",{ref:u,children:d.jsx(eh,{from:t.from,to:t.to,days:t.days,onPickSlot:l,touch:h})}):s?d.jsx("div",{ref:u,children:d.jsx(th,{day:t.day,today:r})}):n==="dots"?d.jsxs("div",{ref:u,children:[f,d.jsx(nh,{day:t.day,lookup:e,today:r,freeOn:i,onSelectEvent:o,onZoomDay:c,selectedEventId:a})]}):d.jsxs("div",{ref:u,children:[f,d.jsx(sh,{day:t.day,lookup:e,density:n,today:r,freeOn:i,selectedEventId:a,onSelectEvent:o,onPickSlot:l,onZoomDay:c,touch:h})]})}function eh({from:t,to:e,days:n,onPickSlot:r,touch:s}){return d.jsxs("button",{type:"button",onClick:()=>r({date:t,endDate:t,startTime:"10:00",endTime:"11:00",allDay:!1}),className:j("flex w-full items-center gap-3 border-y border-dashed border-line bg-surface-sunken px-row-inset text-left outline-none transition-colors hover:border-accent focus-visible:ring-2 focus-visible:ring-ring",s?"min-h-14 py-3":"py-2"),children:[d.jsx(kd,{className:"size-4 shrink-0 text-accent"}),d.jsx("span",{className:"text-sm font-medium text-fg",children:ld(t,e)}),d.jsxs("span",{className:"text-xs text-fg-muted",children:[n," days with nothing booked"]}),d.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:"Add"})]})}function th({day:t,today:e}){const n=t.date===e;return d.jsxs("section",{"aria-busy":"true","data-testid":`agenda-day-pending-${t.date}`,className:j("border-b border-line",n&&"border-l-2 border-l-accent bg-accent-soft/20"),children:[d.jsxs("header",{className:"flex h-section-row items-center gap-3 px-row-inset",children:[d.jsxs("div",{className:"flex w-16 shrink-0 items-baseline gap-1.5",children:[d.jsx("span",{className:j("text-lg font-semibold tabular-nums",n?"text-accent":"text-fg"),children:t.dayNumber}),d.jsx("span",{className:"text-2xs uppercase tracking-wider text-fg-subtle",children:t.weekdayLabel})]}),d.jsxs("span",{className:"sr-only",children:["Loading ",t.date]}),d.jsx("span",{className:"h-3 min-w-0 flex-1 animate-pulse rounded-full bg-surface-sunken"})]}),d.jsx("div",{className:"flex flex-col gap-1 pb-2",children:d.jsx("span",{className:"mx-row-inset h-7 animate-pulse rounded-md bg-surface-sunken"})})]})}function nh({day:t,lookup:e,today:n,freeOn:r,selectedEventId:s,onSelectEvent:i,onZoomDay:a}){const o=t.date===n,l=[...t.allDay,...t.timed];return d.jsxs("div",{className:j("flex h-8 items-center gap-2 border-b border-line px-row-inset",o&&"bg-accent-soft/30"),children:[d.jsxs("button",{type:"button",onClick:()=>a(t.date),className:j("w-16 shrink-0 rounded-sm text-left text-xs tabular-nums outline-none focus-visible:ring-2 focus-visible:ring-ring",o?"font-semibold text-accent":"text-fg-muted"),children:[t.weekdayLabel," ",t.dayNumber]}),d.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden",children:l.map(c=>d.jsx("button",{type:"button",title:c.title,"aria-label":c.title,"aria-pressed":c.id===s,onClick:()=>i(c.id),className:j("size-2 shrink-0 rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring",sn(e.color(c.calendarId)).solid,c.id===s&&"ring-2 ring-ring",c.myRsvp==="declined"&&"opacity-40")},c.id))}),d.jsx(bo,{day:t,className:"w-24 shrink-0"}),d.jsx("span",{className:"w-24 shrink-0 text-right text-2xs text-fg-subtle",children:rh(t,r)})]})}function rh(t,e){const n=e(t);if(t.timed.length===0&&yo(n))return"clear";const r=n.reduce((s,i)=>Math.max(s,i.minutes),0);return r>=vo?`${nt(r)} free`:`${nt(t.busyMinutes)} booked`}function yo(t){return t.length===1&&t[0].wholeDay}function sh({day:t,lookup:e,density:n,today:r,freeOn:s,selectedEventId:i,onSelectEvent:a,onPickSlot:o,onZoomDay:l,touch:c}){const u=t.date===r,f=cd(t.timed),h=s(t),g=h.filter(E=>!E.wholeDay),v=t.timed.length===0&&yo(h),m=[...f.map(E=>({key:E[0].id,at:Gt(E[0].start),node:E.length===1?d.jsx(So,{event:E[0],lookup:e,density:n,selected:E[0].id===i,onSelect:()=>a(E[0].id),touch:c}):d.jsx(ch,{events:E,lookup:e,density:n,selectedEventId:i,onSelectEvent:a,onZoomDay:()=>l(t.date),touch:c})})),...g.map(E=>({key:`free_${E.startMinute}`,at:E.startMinute,node:d.jsx(oh,{stretch:E,onPick:()=>o({date:E.date,endDate:E.date,startTime:ze(E.startMinute),endTime:ze(Math.min(E.startMinute+60,E.endMinute)),allDay:!1}),touch:c})}))].sort((E,C)=>E.at-C.at);return d.jsxs("section",{className:j("border-b border-line",u&&"border-l-2 border-l-accent bg-accent-soft/20"),children:[d.jsxs("header",{className:"flex h-section-row items-center gap-3 px-row-inset",children:[d.jsxs("div",{className:"flex w-16 shrink-0 items-baseline gap-1.5",children:[d.jsx("span",{className:j("text-lg font-semibold tabular-nums",u?"text-accent":"text-fg"),children:t.dayNumber}),d.jsx("span",{className:"text-2xs uppercase tracking-wider text-fg-subtle",children:t.weekdayLabel})]}),d.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:ih(t)}),d.jsx(bo,{day:t,className:"hidden w-32 shrink-0 sm:block"}),d.jsxs("button",{type:"button",onClick:()=>l(t.date),className:j("flex shrink-0 items-center gap-0.5 rounded-md border px-2 text-2xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",c?"min-h-9":"h-6",t.conflicts.length>0?"border-warning text-warning hover:bg-warning-soft":"border-line text-fg-subtle hover:border-line-strong hover:text-fg"),children:["Grid",d.jsx(Vn,{className:"size-3"})]})]}),d.jsxs("div",{className:"flex flex-col gap-1 pb-2",children:[t.allDay.map(E=>d.jsx(lh,{event:E,lookup:e,density:n,selected:E.id===i,onSelect:()=>a(E.id),touch:c},E.id)),v?d.jsx(ah,{day:t,onPickSlot:o,touch:c}):m.map(E=>d.jsx("div",{children:E.node},E.key))]})]})}function ih(t){if(t.timed.length===0)return"Nothing booked";const e=[`${t.timed.length} ${t.timed.length===1?"event":"events"}`,`${nt(t.busyMinutes)} booked`];return t.conflicts.length>0&&e.push(`${t.conflicts.length} ${t.conflicts.length===1?"clash":"clashes"}`),e.join(" · ")}function bo({day:t,className:e}){const n=Qs-fr;return d.jsx("div",{"aria-hidden":!0,className:j("relative h-1.5 overflow-hidden rounded-full bg-surface-sunken",e),children:dd(t).map(r=>{const s=Math.max(r.from,fr),i=Math.min(r.to,Qs);return i<=s?null:d.jsx("span",{className:"absolute inset-y-0 rounded-full bg-fg-subtle",style:{left:`${(s-fr)/n*100}%`,width:`${(i-s)/n*100}%`}},`${r.from}-${r.to}`)})})}function ah({day:t,onPickSlot:e,touch:n}){return d.jsx("button",{type:"button",onClick:()=>e({date:t.date,endDate:t.date,startTime:"10:00",endTime:"11:00",allDay:!1}),className:j("mx-row-inset flex items-center gap-2 rounded-md border border-dashed border-line px-2 text-left text-xs text-fg-muted outline-none transition-colors hover:border-accent hover:text-accent focus-visible:ring-2 focus-visible:ring-ring",n?"min-h-11":"h-8"),children:"Free all day"})}function oh({stretch:t,onPick:e,touch:n}){const r=t.minutes>=vo;return d.jsxs("button",{type:"button",onClick:e,className:j("ml-16 mr-row-inset flex items-center gap-2 rounded-md border border-dashed text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",n?"min-h-11 px-3":"h-7 px-2",r?"border-accent-2 bg-accent-2-soft/40 text-accent-2 hover:bg-accent-2-soft":"border-line text-fg-subtle hover:border-line-strong hover:text-fg-muted"),children:[d.jsxs("span",{className:j("text-xs",r&&"font-medium"),children:[nt(t.minutes)," free"]}),d.jsxs("span",{className:"text-2xs tabular-nums opacity-80",children:[ze(t.startMinute)," – ",ze(t.endMinute)]})]})}function Eo(t){return t==="detail"?"comfortable":"compact"}function lh({event:t,lookup:e,density:n,selected:r,onSelect:s,touch:i}){return d.jsx("div",{className:j("mx-row-inset",i&&"min-h-11"),children:d.jsx(Ra,{title:t.title,timeText:"",color:e.color(t.calendarId),layout:"row",density:Eo(n),rsvp:t.myRsvp,status:t.status,hasThread:t.threadId!=="",isRecurring:t.recurrenceRule!=="",zoneCertainty:t.zoneCertainty,selected:r,onClick:s,trailing:d.jsx("span",{className:"text-2xs",children:"All day"})})})}function ch({events:t,lookup:e,density:n,selectedEventId:r,onSelectEvent:s,onZoomDay:i,touch:a}){const o=Math.min(...t.map(c=>Gt(c.start))),l=Math.max(...t.map(c=>Gt(c.end)));return d.jsxs("div",{className:"mx-row-inset rounded-md border border-warning/50 bg-warning-soft/30",children:[d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[d.jsx(Pd,{className:"size-3 shrink-0 text-warning"}),d.jsxs("span",{className:"text-2xs font-medium text-warning",children:[t.length," at once · ",ze(o)," – ",ze(l)]}),d.jsx("button",{type:"button",onClick:i,className:j("ml-auto rounded-sm px-1.5 text-2xs font-medium text-warning underline underline-offset-2 outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",a&&"min-h-9"),children:"Open the grid"})]}),d.jsx("div",{className:"flex flex-col gap-0.5 pb-1",children:t.map(c=>d.jsx(So,{event:c,lookup:e,density:n,selected:c.id===r,onSelect:()=>s(c.id),inset:!1,touch:a},c.id))})]})}function So({event:t,lookup:e,density:n,selected:r,onSelect:s,inset:i=!0,touch:a}){const o=n==="detail",l=Gt(t.end)-Gt(t.start),c=[e.name(t.calendarId),t.location].filter(u=>u!=="").join(" · ");return d.jsx("div",{className:j(i?"px-row-inset":"px-2",a&&"min-h-12"),children:d.jsx(Ra,{title:t.title,timeText:"",color:e.color(t.calendarId),layout:"row",density:Eo(n),rsvp:t.myRsvp,status:t.status,hasThread:t.threadId!=="",isRecurring:t.recurrenceRule!=="",zoneCertainty:t.zoneCertainty,selected:r,onClick:s,leading:d.jsxs("span",{className:j("shrink-0 pt-1 text-2xs tabular-nums text-fg-subtle",i?"w-14":"w-11"),children:[t.start.slice(11,16),o&&d.jsx("span",{className:"block opacity-70",children:t.end.slice(11,16)})]}),trailing:d.jsx("span",{className:"text-2xs tabular-nums",children:nt(l)}),detail:o&&c!==""?d.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-2xs opacity-80",children:[t.location!==""&&d.jsx(bc,{className:"size-3 shrink-0"}),d.jsx("span",{className:"truncate",children:c}),t.attendees.length>0&&d.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[d.jsx(lc,{className:"size-3"}),t.attendees.length]})]}):void 0})})}function dh({nextUp:t,calendars:e,today:n,onSelectEvent:r,onGoTo:s,touch:i,className:a}){const{running:o,next:l,minutesUntilNext:c,after:u,free:f}=t,h=S.useMemo(()=>{const g=new Map(e.map(v=>[v.id,v.color]));return v=>g.get(v)??"cal-1"},[e]);return d.jsxs("section",{className:j("flex flex-col gap-2 rounded-lg border border-line bg-surface-raised p-3",a),children:[o.length>0&&d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx(li,{icon:d.jsx(jd,{className:"size-3 text-danger"}),children:"Now"}),o.map(g=>d.jsx(ci,{eventId:g.id,title:g.title,color:h(g.calendarId),meta:`until ${g.end.slice(11,16)}`,onSelect:r,touch:i},g.id))]}),d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx(li,{icon:d.jsx(pd,{className:"size-3"}),children:l?`Next · in ${nt(c)}`:"Next"}),l?d.jsx(ci,{eventId:l.id,title:l.title,color:h(l.calendarId),meta:`${vr(l.start.slice(0,10),n)}${l.start.slice(11,16)}${l.location===""?"":` · ${l.location}`}`,onSelect:r,touch:i}):d.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing else booked."}),u&&d.jsxs("p",{className:"truncate pl-1 text-2xs text-fg-subtle",children:["then ",u.title," · ",vr(u.start.slice(0,10),n),u.start.slice(11,16)]})]}),f&&d.jsxs("button",{type:"button",onClick:()=>s(f.date),className:j("flex items-center gap-2 rounded-md border border-dashed border-accent-2 bg-accent-2-soft/40 px-2 text-left text-accent-2 outline-none transition-colors hover:bg-accent-2-soft focus-visible:ring-2 focus-visible:ring-ring",i?"min-h-11":"min-h-8"),children:[d.jsx(Hd,{className:"size-3.5 shrink-0"}),d.jsxs("span",{className:"text-xs font-medium",children:[nt(f.minutes)," free"]}),d.jsxs("span",{className:"text-2xs tabular-nums opacity-80",children:[vr(f.date,n),ze(f.startMinute)," – ",ze(f.endMinute)]})]})]})}function li({icon:t,children:e}){return d.jsxs("h3",{className:"flex items-center gap-1.5 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:[t,e]})}function ci({eventId:t,title:e,color:n,meta:r,onSelect:s,touch:i}){const a=sn(n);return d.jsx("button",{type:"button",onClick:()=>s(t),className:j("flex w-full items-center gap-2 rounded-md border-l-2 px-2 py-1 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",a.soft,a.text,a.rail,i&&"min-h-12"),children:d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block truncate text-sm font-medium",children:e}),d.jsx("span",{className:"block truncate text-2xs opacity-80",children:r})]})})}function vr(t,e){return t===e?"":t===ke(e,1)?"tomorrow · ":`${ud(t)} · `}const wo=`${Bf}Record`,Do=`${Wf}Record`,xo=`${Vf}Record`,uh=new WeakMap,Co=new WeakMap,To=new WeakMap,Ro=new WeakMap;function No(t){return fh(t)||Jn()}function fh(t){return uh.get(t)}function Mo(t){return hh(t)||Jn()}function hh(t){return Co.get(t)}function Io(t,e){Co.set(t,e)}function ko(t){return gh(t)||Jn()}function gh(t){return To.get(t)}function Po(t,e){To.set(t,e)}function jo(t){return mh(t)||Jn()}function mh(t){return Ro.get(t)}function Ho(t,e){Ro.set(t,e)}function Oo(t){return No(t).id}function Ao(t){const e=No(t).ue;return e||be(eu(Oo(t),"getExotic or getAny")),e}function ph(t){if(t!==void 0)return vh(t)}function vh(t){return Ao(t),Oo(t)}const Wt=jo,yh=Pt(wo,class{get calendarId(){return Wt(this).calendarId}toJSON(){return Wt(this).toJSON()}valueOf(){return Wt(this).valueOf()}},Wt,po,mo);function bh(t){const e=Object.create(yh.prototype);return Ho(e,t),jt(e),e}function Eh(t,e,n,r,s,i,a,o,l,c){return bh(new lt.PlainDateTime(t,e,n,r,s,i,a,o,l,ph(c)))}function Sh(t,e,n){return Lo(Wt(t).toZonedDateTime(e,n))}const We=ko,wh=Pt(Do,class{get calendarId(){return We(this).calendarId}get timeZoneId(){return We(this).timeZoneId}get epochMilliseconds(){return We(this).epochMilliseconds}get epochNanoseconds(){return We(this).epochNanoseconds}toJSON(){return We(this).toJSON()}valueOf(){return We(this).valueOf()}},We,po,mo);function Lo(t){const e=Object.create(wh.prototype);return Po(e,t),jt(e),e}function Dh(t){return We(t).offsetNanoseconds}const Vt=Mo,xh=Pt(xo,class{get epochMilliseconds(){return Vt(this).epochMilliseconds}get epochNanoseconds(){return Vt(this).epochNanoseconds}toJSON(){return Vt(this).toJSON()}valueOf(){return Vt(this).valueOf()}});function Ch(t){const e=Object.create(xh.prototype);return Io(e,t),jt(e),e}function Th(t){return Ch(lt.Instant.fromEpochMilliseconds(t))}function Rh(t,e){return Lo(Vt(t).toZonedDateTimeISO(e))}function Nh(t){return t===void 0?kt:Mh(t)}function Mh(t){return Ao(t)()}const Sn=jo,Ih=Pt(wo,class{get calendarId(){return Gn(Sn(this).calendar)}toJSON(){return pf(Sn(this))}valueOf(){return ms()}},Sn,ps,cs);function kh(t){const e=Object.create(Ih.prototype);return Ho(e,t),jt(e),e}function Ph(t,e,n,r=0,s=0,i=0,a=0,o=0,l=0,c){const u=Zu(Nu(ss(rs,{year:t,month:e,day:n,hour:r,minute:s,second:i,millisecond:a,microsecond:o,nanosecond:l}))),f=Nh(c);return kh(Qu(u,f))}function jh(t,e,n){return _o(Pf(Sn(t),go(fo(e)),n))}const Qe=ko,Hh=Pt(Do,class{get calendarId(){return Gn(Qe(this).calendar)}get timeZoneId(){return Qe(this).timeZone.id}get epochMilliseconds(){return so(Qe(this))}get epochNanoseconds(){return io(Qe(this))}toJSON(){return mf(Qe(this))}valueOf(){return ms()}},Oh,ps,cs);function _o(t){const e=Object.create(Hh.prototype);return Po(e,t),jt(e),e}function Oh(t){const e=Qe(t);return{...ao(e),calendar:e.calendar}}function Ah(t){return ao(Qe(t)).offsetNanoseconds}const wn=Mo,Lh=Pt(xo,class{get epochMilliseconds(){return so(wn(this))}get epochNanoseconds(){return io(wn(this))}toJSON(){return gf(wn(this))}valueOf(){return ms()}});function _h(t){const e=Object.create(Lh.prototype);return Io(e,t),jt(e),e}function Uh(t){return _h(jf(t))}function Fh(t,e){return _o(kf(wn(t),go(fo(e))))}const Bh=lt?Dh:Ah,di=lt?Eh:Ph,ui=lt?Sh:jh,Wh=lt?Th:Uh,Vh=lt?Rh:Fh;function fi(t,e){let n=Tt(t);return n[2]+=e*7,De(n)}function fe(t,e){let n=Tt(t);return n[2]+=e,De(n)}function st(t,e){let n=Tt(t);return n[6]+=e,De(n)}function zh(t,e){return Ht(t,e)/7}function Ht(t,e){return(e.valueOf()-t.valueOf())/(1e3*60*60*24)}function $h(t,e){return(e.valueOf()-t.valueOf())/(1e3*60*60)}function Yh(t,e){return(e.valueOf()-t.valueOf())/(1e3*60)}function Gh(t,e){return(e.valueOf()-t.valueOf())/1e3}function Zh(t,e){let n=X(t),r=X(e);return{years:0,months:0,days:Math.round(Ht(n,r)),milliseconds:e.valueOf()-r.valueOf()-(t.valueOf()-n.valueOf())}}function Uo(t,e){let n=qt(t,e);return n!==null&&n%7===0?n/7:null}function qt(t,e){return yt(t)===yt(e)?Math.round(Ht(t,e)):null}function X(t){return De([t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()])}function qh(t){return De([t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours()])}function Xh(t){return De([t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes()])}function Kh(t){return De([t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds()])}function Qh(t,e,n){let r=t.getUTCFullYear(),s=yr(t,r,e,n);if(s<1)return yr(t,r-1,e,n);let i=yr(t,r+1,e,n);return i>=1?Math.min(s,i):s}function yr(t,e,n,r){let s=De([e,0,1+Jh(e,n,r)]),i=X(t),a=Math.round(Ht(s,i));return Math.floor(a/7)+1}function Jh(t,e,n){let r=7+e-n;return-((7+De([t,0,r]).getUTCDay()-e)%7)+r-1}function eg(t){return[t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]}function hi(t){return new Date(t[0],t[1]||0,t[2]==null?1:t[2],t[3]||0,t[4]||0,t[5]||0)}function Tt(t){return[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()]}function De(t){return t.length===1&&(t=t.concat([0])),new Date(Date.UTC(...t))}function Fo(t){return!isNaN(t.valueOf())}function yt(t){return t.getUTCHours()*1e3*60*60+t.getUTCMinutes()*1e3*60+t.getUTCSeconds()*1e3+t.getUTCMilliseconds()}let Bo={};function tg(t,e){Bo[t]=e}function ng(t){return new Bo[t]}class rg{getMarkerYear(e){return e.getUTCFullYear()}getMarkerMonth(e){return e.getUTCMonth()}getMarkerDay(e){return e.getUTCDate()}arrayToMarker(e){return De(e)}markerToArray(e){return Tt(e)}}tg("gregory",rg);function sg(t,e){let n=null,r=null;return t.start&&(n=e.createMarker(t.start)),t.end&&(r=e.createMarker(t.end)),!n&&!r||n&&r&&r<n?null:{start:n,end:r}}function gi(t,e){let n=[],{start:r}=e,s,i;for(t.sort(ig),s=0;s<t.length;s+=1)i=t[s],i.start>r&&n.push({start:r,end:i.start}),i.end>r&&(r=i.end);return r<e.end&&n.push({start:r,end:e.end}),n}function ig(t,e){return t.start.valueOf()-e.start.valueOf()}function Xt(t,e){let{start:n,end:r}=t,s=null;return e.start!==null&&(n===null?n=e.start:n=new Date(Math.max(n.valueOf(),e.start.valueOf()))),e.end!=null&&(r===null?r=e.end:r=new Date(Math.min(r.valueOf(),e.end.valueOf()))),(n===null||r===null||n<r)&&(s={start:n,end:r}),s}function ag(t,e){return(t.start===null?null:t.start.valueOf())===(e.start===null?null:e.start.valueOf())&&(t.end===null?null:t.end.valueOf())===(e.end===null?null:e.end.valueOf())}function vs(t,e){return(t.end===null||e.start===null||t.end>e.start)&&(t.start===null||e.end===null||t.start<e.end)}function er(t,e){return(t.start===null||e.start!==null&&e.start>=t.start)&&(t.end===null||e.end!==null&&e.end<=t.end)}function et(t,e){return(t.start===null||e>=t.start)&&(t.end===null||e<t.end)}function og(t,e){return e.start!=null&&t<e.start?e.start:e.end!=null&&t>=e.end?new Date(e.end.valueOf()-1):t}function mi(t,e){let n=e.markerToArray(t.marker);return{marker:t.marker,timeZoneOffset:t.timeZoneOffset,array:n,year:n[0],month:n[1],day:n[2],hour:n[3],minute:n[4],second:n[5],millisecond:n[6]}}function Pn(t,e,n){let r=mi(t,n.calendarSystem),s=e?mi(e,n.calendarSystem):null;return{date:r,start:r,end:s,timeZone:n.timeZone,localeCodes:n.locale.codes}}function br(t){return t%1===0}function Er(t,e){let n=String(t);return"000".substr(0,e-n.length)+n}const lg=/^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/;function $(t,e){return typeof t=="string"?cg(t):typeof t=="object"&&t?pi(t):typeof t=="number"?pi({[e||"milliseconds"]:t}):null}function cg(t){let e=lg.exec(t);if(e){let n=e[1]?-1:1;return{years:0,months:0,days:n*(e[2]?parseInt(e[2],10):0),milliseconds:n*((e[3]?parseInt(e[3],10):0)*60*60*1e3+(e[4]?parseInt(e[4],10):0)*60*1e3+(e[5]?parseInt(e[5],10):0)*1e3+(e[6]?parseInt(e[6],10):0))}}return null}function pi(t){let e={years:t.years||t.year||0,months:t.months||t.month||0,days:t.days||t.day||0,milliseconds:(t.hours||t.hour||0)*60*60*1e3+(t.minutes||t.minute||0)*60*1e3+(t.seconds||t.second||0)*1e3+(t.milliseconds||t.millisecond||t.ms||0)},n=t.weeks||t.week;return n&&(e.days+=n*7,e.specifiedWeeks=!0),e}function dg(t,e){return t.years===e.years&&t.months===e.months&&t.days===e.days&&t.milliseconds===e.milliseconds}function ug(t,e){return{years:t.years-e.years,months:t.months-e.months,days:t.days-e.days,milliseconds:t.milliseconds-e.milliseconds}}function fg(t){return Dt(t)/365}function hg(t){return Dt(t)/30}function Dt(t){return Kt(t)/864e5}function Kt(t){return t.years*(365*864e5)+t.months*(30*864e5)+t.days*864e5+t.milliseconds}function Or(t){let e=t.milliseconds;if(e){if(e%1e3!==0)return{unit:"millisecond",value:e};if(e%(1e3*60)!==0)return{unit:"second",value:e/1e3};if(e%(1e3*60*60)!==0)return{unit:"minute",value:e/(1e3*60)};if(e)return{unit:"hour",value:e/(1e3*60*60)}}return t.days?t.specifiedWeeks&&t.days%7===0?{unit:"week",value:t.days/7}:{unit:"day",value:t.days}:t.months?{unit:"month",value:t.months}:t.years?{unit:"year",value:t.years}:{unit:"millisecond",value:0}}function gg(t,e,n=!1){let r=t.toISOString();return r=r.replace(".000",""),n&&(r=r.replace("T00:00:00Z","")),r.length>10&&(e==null?r=r.replace("Z",""):e!==0&&(r=r.replace("Z",tr(e,!0)))),r}function ys(t){return t.toISOString().replace(/T.*$/,"")}function tr(t,e=!1){let n=t<0?"-":"+",r=Math.abs(t),s=Math.floor(r/60),i=Math.round(r%60);return e?`${n+Er(s,2)}:${Er(i,2)}`:`GMT${n}${s}${i?`:${Er(i,2)}`:""}`}function ye(t){let e="";for(const n of t)e+=n.value;return e}const mg=/^\s*(\d{4})(-?(\d{2})(-?(\d{2})([T ](\d{2}):?(\d{2})(:?(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/;function pg(t){let e=mg.exec(t);if(e){let n=new Date(Date.UTC(Number(e[1]),e[3]?Number(e[3])-1:0,Number(e[5]||1),Number(e[7]||0),Number(e[8]||0),Number(e[10]||0),e[12]?+`0.${e[12]}`*1e3:0));if(Fo(n)){let r=null;return e[13]&&(r=(e[15]==="-"?-1:1)*(Number(e[16]||0)*60+Number(e[18]||0))),{marker:n,isTimeUnspecified:!e[6],timeZoneOffset:r}}}return null}class vg{constructor(e){this.timeZone=e.timeZone,this.calendarSystem=ng(e.calendarSystem),this.locale=e.locale,this.weekDow=e.locale.week.dow,this.weekDoy=e.locale.week.doy,e.weekNumberCalculation==="ISO"&&(this.weekDow=1,this.weekDoy=4),typeof e.firstDay=="number"&&(this.weekDow=e.firstDay),typeof e.weekNumberCalculation=="function"&&(this.weekNumberFunc=e.weekNumberCalculation),this.weekTextLong=e.weekTextLong,this.weekTextShort=e.weekTextShort??e.weekTextLong,this.cmdFormatter=e.cmdFormatter}createMarker(e){let n=this.createMarkerMeta(e);return n===null?null:n.marker}createNowMarker(){return this.timestampToMarker(new Date().valueOf())}createMarkerMeta(e){if(typeof e=="string")return this.parse(e);let n=null;return typeof e=="number"?n=this.timestampToMarker(e):e instanceof Date?(e=e.valueOf(),isNaN(e)||(n=this.timestampToMarker(e))):Array.isArray(e)&&(n=De(e)),n===null||!Fo(n)?null:{marker:n,isTimeUnspecified:!1}}parse(e){let n=pg(e);if(n===null)return null;let{marker:r}=n;return n.timeZoneOffset!==null&&(r=this.timestampToMarker(r.valueOf()-n.timeZoneOffset*60*1e3)),{marker:r,isTimeUnspecified:n.isTimeUnspecified}}getYear(e){return this.calendarSystem.getMarkerYear(e)}getMonth(e){return this.calendarSystem.getMarkerMonth(e)}getDay(e){return this.calendarSystem.getMarkerDay(e)}add(e,n){let r=this.calendarSystem.markerToArray(e);return r[0]+=n.years,r[1]+=n.months,r[2]+=n.days,r[6]+=n.milliseconds,this.calendarSystem.arrayToMarker(r)}subtract(e,n){let r=this.calendarSystem.markerToArray(e);return r[0]-=n.years,r[1]-=n.months,r[2]-=n.days,r[6]-=n.milliseconds,this.calendarSystem.arrayToMarker(r)}addYears(e,n){let r=this.calendarSystem.markerToArray(e);return r[0]+=n,this.calendarSystem.arrayToMarker(r)}addMonths(e,n){let r=this.calendarSystem.markerToArray(e);return r[1]+=n,this.calendarSystem.arrayToMarker(r)}diffWholeYears(e,n){let{calendarSystem:r}=this;return yt(e)===yt(n)&&r.getMarkerDay(e)===r.getMarkerDay(n)&&r.getMarkerMonth(e)===r.getMarkerMonth(n)?r.getMarkerYear(n)-r.getMarkerYear(e):null}diffWholeMonths(e,n){let{calendarSystem:r}=this;return yt(e)===yt(n)&&r.getMarkerDay(e)===r.getMarkerDay(n)?r.getMarkerMonth(n)-r.getMarkerMonth(e)+(r.getMarkerYear(n)-r.getMarkerYear(e))*12:null}greatestWholeUnit(e,n){let r=this.diffWholeYears(e,n);return r!==null?{unit:"year",value:r}:(r=this.diffWholeMonths(e,n),r!==null?{unit:"month",value:r}:(r=Uo(e,n),r!==null?{unit:"week",value:r}:(r=qt(e,n),r!==null?{unit:"day",value:r}:(r=$h(e,n),br(r)?{unit:"hour",value:r}:(r=Yh(e,n),br(r)?{unit:"minute",value:r}:(r=Gh(e,n),br(r)?{unit:"second",value:r}:{unit:"millisecond",value:n.valueOf()-e.valueOf()}))))))}countDurationsBetween(e,n,r){let s;return r.years&&(s=this.diffWholeYears(e,n),s!==null)?s/fg(r):r.months&&(s=this.diffWholeMonths(e,n),s!==null)?s/hg(r):r.days&&(s=qt(e,n),s!==null)?s/Dt(r):(n.valueOf()-e.valueOf())/Kt(r)}startOf(e,n){return n==="year"?this.startOfYear(e):n==="month"?this.startOfMonth(e):n==="week"?this.startOfWeek(e):n==="day"?X(e):n==="hour"?qh(e):n==="minute"?Xh(e):n==="second"?Kh(e):null}startOfYear(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e)])}startOfMonth(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e),this.calendarSystem.getMarkerMonth(e)])}startOfWeek(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e),this.calendarSystem.getMarkerMonth(e),e.getUTCDate()-(e.getUTCDay()-this.weekDow+7)%7])}computeWeekNumber(e){return this.weekNumberFunc?this.weekNumberFunc(this.toDate(e)):Qh(e,this.weekDow,this.weekDoy)}formatToParts(e,n){return n.formatToParts({marker:e,timeZoneOffset:this.offsetForMarker(e)},this)}formatRangeToParts(e,n,r,s={}){return s.isEndExclusive&&(n=st(n,-1)),r.formatRangeToParts({marker:e,timeZoneOffset:this.offsetForMarker(e)},{marker:n,timeZoneOffset:this.offsetForMarker(n)},this)}formatIso(e,n={}){let r=null;return n.omitTimeZoneOffset||(r=this.offsetForMarker(e)),gg(e,r,n.omitTime)}timestampToMarker(e){if(this.timeZone==="local")return De(eg(new Date(e)));if(this.timeZone==="UTC")return new Date(e);const n=Vh(Wh(e),this.timeZone);return new Date(Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond))}offsetForMarker(e){return this.timeZone==="local"?-hi(Tt(e)).getTimezoneOffset():this.timeZone==="UTC"?0:Bh(ui(di(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),this.timeZone))/(1e9*60)}toDate(e){return this.timeZone==="local"?hi(Tt(e)):this.timeZone==="UTC"?new Date(e.valueOf()):new Date(ui(di(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),this.timeZone).epochMilliseconds)}}const yg=new Set(["week","meridiem","omitZeroMinute","omitCommas","forceCommas","omitTrailing","weekdayJustify"]),pn=/([ap])\.?m\.?/i,bg=/,/g,Eg=/\u200e/g,Sg=/[\s.,]+$/,Ar=/^\s+$/;class wg{constructor(e){const n={},r={};for(const s in e)yg.has(s)?r[s]=e[s]:n[s]=e[s];n.timeZoneName==="long"&&(n.timeZoneName="short"),this.timeZoneOnly=Object.keys(n).length===1&&n.timeZoneName==="short",this.weekOnly=!!(!Object.keys(n).length&&r.week),this.timeZoneOnly||(n.timeZoneName&&(n.hour||(n.hour="2-digit"),n.minute||(n.minute="2-digit")),r.omitZeroMinute&&(n.second||n.fractionalSecondDigits)&&delete r.omitZeroMinute,n.timeZone="UTC"),this.standardOptions=n,this.extendedOptions=r}formatToParts(e,n){const{standardOptions:r,extendedOptions:s}=this;if(this.timeZoneOnly)return[{type:"timeZoneName",value:tr(e.timeZoneOffset)}];if(this.weekOnly)return Cg(n.computeWeekNumber(e.marker),n.weekTextLong,n.weekTextShort,n.locale,s.week);const{normalFormat:i,zeroFormat:a}=this.getFormats(n),l=(a&&!e.marker.getUTCMinutes()?a:i).formatToParts(e.marker);return Dg(l,e,r,s)}formatRangeToParts(e,n,r){const{standardOptions:s,extendedOptions:i}=this;if(this.timeZoneOnly||this.weekOnly)return this.formatToParts(e,r).map(u=>({source:u.type==="literal"?"shared":"startRange",...u}));const{normalFormat:a,zeroFormat:o}=this.getFormats(r),c=(o&&!e.marker.getUTCMinutes()&&!n.marker.getUTCMinutes()?o:a).formatRangeToParts(e.marker,n.marker);return xg(c,e,n,s,i)}getFormats(e){if(this.cachedContext!==e){const{standardOptions:n,extendedOptions:r}=this,{codes:s}=e.locale,i=new Intl.DateTimeFormat(s,n);let a;if(r.omitZeroMinute){const o={...n};delete o.minute,a=new Intl.DateTimeFormat(s,o)}this.cachedContext=e,this.cachedFormats={normalFormat:i,zeroFormat:a}}return this.cachedFormats}}function Wo(t,e,n){let r=!1,s;for(const i of t){const a=i.type==="literal";if(a||i.type==="dayPeriod"){let o=i.value;if(o=o.replace(Eg,""),e.omitCommas&&(o=o.replace(bg,"")),!a){const{meridiem:l}=e;l===!1?o=o.replace(pn,""):l==="narrow"?o=o.replace(pn,(c,u)=>u.toLocaleLowerCase()):l==="short"?o=o.replace(pn,(c,u)=>`${u.toLocaleLowerCase()}m`):l==="lowercase"&&(o=o.replace(pn,c=>c.toLocaleLowerCase())),s&&(s.value=s.value.trimEnd())}i.value=o}else if(i.type==="timeZoneName"){const o=n(i);o!=null&&(i.value=o,r=!0)}s=a?i:void 0}return{lastLiteral:s,anyTzInjected:r}}function Dg(t,e,n,r){const s=n.timeZoneName==="short"?e.timeZoneOffset==null?"UTC":tr(e.timeZoneOffset):void 0,{lastLiteral:i,anyTzInjected:a}=Wo(t,r,()=>s);if(s&&!a&&(i?i.value+=" ":t.push({type:"literal",value:" "}),t.push({type:"timeZoneName",value:s})),r.weekdayJustify&&t.length===3&&Ar.test(t[1].value)&&t[r.weekdayJustify==="start"?2:0].type==="weekday"&&t.reverse(),r.forceCommas)for(const o of t)o.type==="literal"&&Ar.test(o.value)&&(o.value=`,${o.value}`);return r.omitTrailing&&Vo(t),t.filter(o=>o.value)}function xg(t,e,n,r,s){const i=r.timeZoneName==="short";if(Wo(t,s,a=>{if(!i)return;const o=a.source==="endRange"?n.timeZoneOffset:e.timeZoneOffset;return o==null?"UTC":tr(o)}),s.forceCommas)for(const a of t)a.type==="literal"&&Ar.test(a.value)&&(a.value=`,${a.value}`);return s.omitTrailing&&Vo(t),t.filter(a=>a.value)}function Vo(t){const e=t[t.length-1];e?.type==="literal"&&(e.value=e.value.replace(Sg,""),e.value||t.pop())}function Cg(t,e,n,r,s){const i=[];return s==="long"?i.push({type:"literal",value:e}):(s==="short"||s==="narrow")&&i.push({type:"literal",value:n}),(s==="long"||s==="short")&&i.push({type:"literal",value:" "}),i.push({type:"week",value:r.simpleNumberFormat.format(t)}),r.options.direction==="rtl"&&i.reverse(),i}class Tg{constructor(e){this.cmdStr=e}formatToParts(e,n){const r=n.cmdFormatter(this.cmdStr,Pn(e,null,n));return Array.isArray(r)?r:[{type:"literal",value:r}]}formatRangeToParts(e,n,r){const s=r.cmdFormatter(this.cmdStr,Pn(e,n,r));return Array.isArray(s)?s.map(i=>({source:"shared",...i})):[{source:"shared",type:"literal",value:s}]}}class Rg{constructor(e){this.func=e}formatToParts(e,n){return[{type:"literal",value:this.func(Pn(e,null,n))}]}formatRangeToParts(e,n,r){return[{source:"shared",type:"literal",value:this.func(Pn(e,n,r))}]}}var y={popoverZ:"fc-nH",isolate:"fc-7s",borderBoxRoot:"fc-wa",notAllowed:"fc-4m",noScrollbars:"fc-eM",noShrink:"fc-Qo",calendarScreenRoot:"fc-fi",calendarPrintRoot:"fc-Jf",cursorPointer:"fc-DP",cursorResizeT:"fc-An",cursorResizeB:"fc-lZ",cursorResizeS:"fc-9V",cursorResizeE:"fc-70",hit:"fc-mN",hitX:"fc-2d",hitY:"fc-B0",borderNone:"fc-Tu",borderOnlyB:"fc-3e",borderOnlyS:"fc-PB",fakeBorderS:"fc-2l",flexRow:"fc-Ao",flexCol:"fc-HH",grow:"fc-GV",liquid:"fc-g2",minHeight0:"fc-Ot",printRoot:"fc-uD",printHeader:"fc-jM",noPadding:"fc-OJ",noMargin:"fc-oE",whiteSpaceNoWrap:"fc-y2",overflowAnchorNone:"fc-gZ",crop:"fc-FA",rel:"fc-cc",abs:"fc-H0",fill:"fc-ct",fillTop:"fc-iv",fillY:"fc-7k",fillStart:"fc-Yw",sticky:"fc-Ip",stickyT:"fc-CS",stickyS:"fc-tT",tableHeaderSticky:"fc-hy",contentBox:"fc-Np",alignCenter:"fc-6H",alignStart:"fc-K8",alignEnd:"fc-E3",footerScrollbarSticky:"fc-Px",footerScrollbar:"fc-J4",breakInsideAvoid:"fc-Yi",printSiblingRow:"fc-fx",z0:"fc-BS",z1:"fc-iu",focusZ2:"fc-Bk",internalEvent:"fc-Ft",internalEventMirror:"fc-lc",internalEventDraggable:"fc-uL",internalEventSelected:"fc-Bv",internalEventResizable:"fc-Qk",internalEventResizer:"fc-9X",internalEventResizerStart:"fc-Sj",internalEventResizerEnd:"fc-DL",internalBgEvent:"fc-oP",internalMoreLink:"fc-R2",internalNavLink:"fc-SW",internalPopover:"fc-Cs",internalView:"fc-LQ",internalScroller:"fc-dT"};function O(...t){return t.filter(Boolean).join(" ")}function vi(t){return t*100+"%"}function J(t){return typeof t=="object"&&t?new wg(t):typeof t=="string"?new Tg(t):typeof t=="function"?new Rg(t):null}function $e(...t){console.warn("FullCalendar:",...t)}const yi={};function se(t,e){return!t||typeof t=="string"?t:(Ng(e),"")}function I(t,e){return typeof t=="function"?n=>se(t(n),e):se(t,e)}function Ng(t){yi[t]||($e(`Invalid option \`${t}\`: expected a className string or a falsy value.`),yi[t]=!0)}function nr(t){t.preventDefault()}function Mg(t,e){return n=>{let r=n.target.closest(t);r&&e.call(r,n,r)}}function zo(t,e,n,r){let s=Mg(n,r);return t.addEventListener(e,s),()=>{t.removeEventListener(e,s)}}function Ig(t,e,n,r){let s;return zo(t,"mouseover",e,(i,a)=>{if(a!==s){s=a,n(i,a);let o=l=>{s=null,r(l,a),a.removeEventListener("mouseleave",o)};a.addEventListener("mouseleave",o)}})}const bi=["webkitTransitionEnd","otransitionend","oTransitionEnd","msTransitionEnd","transitionend"];function kg(t,e){let n=r=>{e(r),bi.forEach(s=>{t.removeEventListener(s,n)})};bi.forEach(r=>{t.addEventListener(r,n)})}function bs(t){return{onClick:t,...$o(t)}}function $o(t){return{tabIndex:0,onKeyDown(e){(e.key==="Enter"||e.key===" ")&&(t(e),e.preventDefault())}}}let Ei=0;function _e(){return Ei+=1,String(Ei)}function Es(){document.body.classList.add(y.notAllowed)}function Ss(){document.body.classList.remove(y.notAllowed)}function Pg(t){t.style.userSelect="none",t.style.webkitUserSelect="none",t.addEventListener("selectstart",nr)}function jg(t){t.style.userSelect="",t.style.webkitUserSelect="",t.removeEventListener("selectstart",nr)}function Hg(t){t.addEventListener("contextmenu",nr)}function Og(t){t.removeEventListener("contextmenu",nr)}function Ag(t){let e=[],n=[],r,s;for(typeof t=="string"?n=t.split(/\s*,\s*/):typeof t=="function"?n=[t]:Array.isArray(t)&&(n=t),r=0;r<n.length;r+=1)s=n[r],typeof s=="string"?e.push(s.charAt(0)==="-"?{field:s.substring(1),order:-1}:{field:s,order:1}):typeof s=="function"&&e.push({func:s});return e}function Lg(t,e,n){let r,s;for(r=0;r<n.length;r+=1)if(s=_g(t,e,n[r]),s)return s;return 0}function _g(t,e,n){return n.func?n.func(t,e):Ug(t[n.field],e[n.field])*(n.order||1)}function Ug(t,e){return!t&&!e?0:e==null?-1:t==null?1:typeof t=="string"||typeof e=="string"?String(t).localeCompare(String(e)):t-e}function we(t,e,n){return typeof t=="function"?t(...e):typeof t=="string"?e.reduce((r,s,i)=>r.replace("$"+i,s||""),t):n}function Fg(t,e){return t-e}function Yo(t,e){return t===e}function Ot(t){const e=t.borderless;return{borderlessX:!!(t.borderlessX??e),borderlessTop:!!(t.borderlessTop??e),borderlessBottom:!!(t.borderlessBottom??e)}}const{hasOwnProperty:Rt}=Object.prototype;function it(t,e){let n={};for(let r in t)e(t[r],r)&&(n[r]=t[r]);return n}function ct(t,e){let n={};for(let r in t)n[r]=e(t[r],r);return n}function Go(t){let e=[];for(let n in t)e.push(t[n]);return e}function Zo(t){let e={};for(let n of t)e[n]=!0;return e}function Bg(t,e){return typeof t=="object"&&t&&typeof e=="object"&&e?ws(t,e,at):t===e}function ws(t,e,n){if(t===e)return!0;for(let r in t)if(Rt.call(t,r)&&!(r in e))return!1;for(let r in e)if(Rt.call(e,r)&&(!(r in t)||!n(t[r],e[r],r)))return!1;return!0}function Sr(t,e){return typeof t=="object"&&typeof e=="object"&&t&&e?at(t,e):t===e}function at(t,e){return ws(t,e,Yo)}function Si(t,e,n){return ws(t,e,(r,s,i)=>{const a=n[i];return a?a(r,s):r===s})}function Wg(t,e){let n=[];for(let r in t)Rt.call(t,r)&&(r in e||n.push(r));for(let r in e)Rt.call(e,r)&&t[r]!==e[r]&&n.push(r);return n}function Vg(t,e){return t?zg(t,e,$g):e}function zg(t,e,n){const r={};for(let s in t)Rt.call(t,s)&&(s in e||(r[s]=t[s]));for(let s in e)Rt.call(e,s)&&(s in t?r[s]=n(t[s],e[s]):r[s]=e[s]);return r}function $g(t,e){return Object.assign({},t,e)}function vn(t,e){return Array.isArray(t)&&Array.isArray(e)?Qt(t,e):t===e}function Qt(t,e,n=Yo){if(t===e)return!0;let r=t.length,s;if(r!==e.length)return!1;for(s=0;s<r;s+=1)if(!n(t[s],e[s]))return!1;return!0}const wi={navLinkDayClick:b,navLinkWeekClick:b,duration:$,buttons:b,toolbarElements:b,prevText:String,nextText:String,prevYearText:String,nextYearText:String,todayText:String,yearText:String,monthText:String,weekTextLong:String,weekTextShort:String,dayText:String,listText:b,todayHint:b,prevHint:b,nextHint:b,buttonDisplay:b,buttonGroupClass:I,buttonClass:I,defaultAllDayEventDuration:$,defaultTimedEventDuration:$,nextDayThreshold:$,scrollTime:$,scrollTimeReset:Boolean,slotMinTime:$,slotMaxTime:$,popoverFormat:J,slotDuration:$,snapDuration:$,headerToolbar:b,footerToolbar:b,forceEventDuration:Boolean,dayLaneClass:I,dayLaneInnerClass:I,dayLaneDidMount:b,dayLaneWillUnmount:b,initialView:String,aspectRatio:Number,weekends:Boolean,weekNumberCalculation:b,weekNumbers:Boolean,weekNumberHeaderClass:I,weekNumberHeaderInnerClass:I,weekNumberHeaderContent:b,weekNumberHeaderDidMount:b,weekNumberHeaderWillUnmount:b,inlineWeekNumberClass:I,inlineWeekNumberContent:b,inlineWeekNumberDidMount:b,inlineWeekNumberWillUnmount:b,editable:Boolean,controller:b,nowIndicator:Boolean,nowIndicatorSnap:b,nowIndicatorHeaderClass:I,nowIndicatorHeaderContent:b,nowIndicatorHeaderDidMount:b,nowIndicatorHeaderWillUnmount:b,nowIndicatorDotClass:se,nowIndicatorLineClass:I,nowIndicatorLineContent:b,nowIndicatorLineDidMount:b,nowIndicatorLineWillUnmount:b,showNonCurrentDates:Boolean,lazyFetching:Boolean,startParam:String,endParam:String,timeZoneParam:String,timeZone:String,locales:b,locale:b,dragRevertDuration:Number,dragScroll:Boolean,allDayMaintainDuration:Boolean,unselectAuto:Boolean,dropAccept:b,eventOrder:Ag,eventOrderStrict:Boolean,eventSlicing:Boolean,eventPrintLayout:String,longPressDelay:Number,eventDragMinDistance:Number,expandRows:Boolean,height:b,contentHeight:b,direction:String,colorScheme:String,weekNumberFormat:J,eventResizableFromStart:Boolean,displayEventTime:Boolean,displayEventEnd:Boolean,progressiveEventRendering:Boolean,businessHours:b,initialDate:b,now:b,eventDataTransform:b,tableHeaderSticky:b,footerScrollbarSticky:b,defaultAllDay:Boolean,eventSourceFailure:b,eventSourceSuccess:b,eventDisplay:String,eventStartEditable:Boolean,eventDurationEditable:Boolean,eventOverlap:b,eventConstraint:b,eventAllow:b,eventColor:String,eventContrastColor:String,eventDidMount:b,eventWillUnmount:b,eventContent:b,eventClass:I,eventInnerClass:I,eventTimeClass:I,eventTitleClass:I,eventBeforeClass:I,eventAfterClass:I,listItemEventClass:I,listItemEventInnerClass:I,listItemEventTimeClass:I,listItemEventTitleClass:I,listItemEventBeforeClass:I,listItemEventAfterClass:I,blockEventClass:I,blockEventInnerClass:I,blockEventTimeClass:I,blockEventTitleClass:I,blockEventBeforeClass:I,blockEventAfterClass:I,rowEventClass:I,rowEventInnerClass:I,rowEventTimeClass:I,rowEventTitleClass:I,rowEventTitleSticky:Boolean,rowEventBeforeClass:I,rowEventBeforeContent:b,rowEventAfterClass:I,rowEventAfterContent:b,columnEventClass:I,columnEventInnerClass:I,columnEventTimeClass:I,columnEventTitleClass:I,columnEventTitleSticky:Boolean,columnEventBeforeClass:I,columnEventAfterClass:I,backgroundEventClass:I,backgroundEventDidMount:b,backgroundEventWillUnmount:b,backgroundEventContent:b,backgroundEventInnerClass:I,backgroundEventTitleClass:I,backgroundEventColor:String,selectConstraint:b,selectOverlap:b,selectAllow:b,droppable:Boolean,unselectCancel:String,slotHeaderFormat:b,slotLaneClass:I,slotLaneDidMount:b,slotLaneWillUnmount:b,slotHeaderClass:I,slotHeaderInnerClass:I,slotHeaderContent:b,slotHeaderDidMount:b,slotHeaderWillUnmount:b,slotHeaderAlign:b,slotHeaderSticky:b,slotHeaderRowClass:se,slotHeaderDividerClass:I,dayMaxEvents:b,dayMaxEventRows:b,dayMinWidth:Number,slotHeaderInterval:$,dayHeaderClass:I,dayHeaderInnerClass:I,dayHeaderContent:b,dayHeaderDidMount:b,dayHeaderWillUnmount:b,dayHeaderAlign:b,_dayHeaderSticky:b,dayHeaderRowClass:se,dayHeaderDividerClass:I,dayRowClass:se,dayCellDidMount:b,dayCellWillUnmount:b,dayCellClass:I,dayCellInnerClass:I,dayCellTopContent:b,dayCellTopClass:I,dayCellTopInnerClass:I,dayCellBottomClass:I,allDaySlot:Boolean,allDayText:String,allDayHeaderClass:I,allDayHeaderInnerClass:I,allDayHeaderContent:b,allDayHeaderDidMount:b,allDayHeaderWillUnmount:b,timedText:String,slotMinWidth:Number,slotMinHeight:Number,navLinks:Boolean,eventTimeFormat:J,rerenderDelay:Number,moreLinkText:b,moreLinkHint:b,selectMinDistance:Number,selectable:Boolean,selectLongPressDelay:Number,eventLongPressDelay:Number,selectMirror:Boolean,eventMaxStack:Number,eventMinHeight:Number,eventMinWidth:Number,eventShortHeight:Number,slotEventOverlap:Boolean,firstDay:Number,dayCount:Number,dateAlignment:String,dateIncrement:$,hiddenDays:b,fixedWeekCount:Boolean,validRange:b,visibleRange:b,titleFormat:b,eventInteractive:Boolean,noEventsText:String,viewHint:b,viewChangeHint:String,navLinkHint:b,closeHint:String,eventsHint:String,headingLevel:Number,moreLinkClick:b,moreLinkContent:b,moreLinkDidMount:b,moreLinkWillUnmount:b,moreLinkClass:I,moreLinkInnerClass:I,rowMoreLinkClass:I,rowMoreLinkInnerClass:I,columnMoreLinkClass:I,columnMoreLinkInnerClass:I,navLinkClass:se,monthStartFormat:J,dayCellFormat:J,handleCustomRendering:b,customRenderingMetaMap:b,popoverClass:se,popoverCloseClass:se,popoverCloseContent:b,dayNarrowWidth:Number,borderless:Boolean,borderlessX:Boolean,borderlessTop:Boolean,borderlessBottom:Boolean,fillerClass:I,headerToolbarClass:I,footerToolbarClass:I,toolbarClass:I,toolbarSectionClass:I,toolbarTitleClass:se,tableClass:I,tableHeaderClass:I,tableBodyClass:I,nonBusinessHoursClass:se,highlightClass:se,dayHeaders:Boolean,dayHeaderFormat:J,allDayDividerClass:se,listDaysClass:se,listDayClass:I,listDayFormat:Ci,listDayAltFormat:Ci,listDayHeaderDidMount:b,listDayHeaderWillUnmount:b,listDayHeaderClass:I,listDayHeaderInnerClass:I,listDayHeaderContent:b,listDayBodyClass:I,noEventsClass:I,noEventsInnerClass:I,noEventsContent:b,noEventsDidMount:b,noEventsWillUnmount:b,multiMonthMaxColumns:Number,singleMonthMinWidth:Number,singleMonthTitleFormat:J,singleMonthDidMount:b,singleMonthWillUnmount:b,singleMonthClass:I,singleMonthHeaderClass:I,singleMonthHeaderInnerClass:I},wr={buttonDisplay:"auto",eventDisplay:"auto",defaultTimedEventDuration:"01:00:00",defaultAllDayEventDuration:{day:1},forceEventDuration:!1,nextDayThreshold:"00:00:00",initialView:"",aspectRatio:1.35,weekends:!0,weekNumbers:!1,weekNumberCalculation:"local",editable:!1,nowIndicator:!1,scrollTime:"06:00:00",scrollTimeReset:!0,slotMinTime:"00:00:00",slotMaxTime:"24:00:00",showNonCurrentDates:!0,lazyFetching:!0,startParam:"start",endParam:"end",timeZoneParam:"timeZone",timeZone:"local",locales:[],locale:"",dragRevertDuration:500,dragScroll:!0,allDayMaintainDuration:!1,unselectAuto:!0,dropAccept:"*",eventOrder:"start,-duration,allDay,title",eventPrintLayout:"auto",popoverFormat:{month:"long",day:"numeric",year:"numeric"},longPressDelay:1e3,eventDragMinDistance:5,expandRows:!1,navLinks:!1,selectable:!1,eventMinHeight:15,eventMinWidth:30,eventShortHeight:30,monthStartFormat:{month:"long",day:"numeric"},dayCellFormat:{day:"numeric",omitTrailing:!0},headingLevel:2,outerBorder:!0,dayNarrowWidth:80,eventOverlap:!0,slotHeaderAlign:"start",slotHeaderSticky:!0,dayHeaderAlign:"start",_dayHeaderSticky:!0,rowEventTitleSticky:!0,columnEventTitleSticky:!0,nowIndicatorSnap:"auto",dayHeaders:!0},Di={datesSet:b,eventsSet:b,eventAdd:b,eventChange:b,eventRemove:b,eventClick:b,eventMouseEnter:b,eventMouseLeave:b,select:b,unselect:b,loading:b,_unmount:b,_beforeprint:b,_afterprint:b,_noDateSelect:b,_noEventDrop:b,_noEventResize:b,_timeScrollRequest:b,dateClick:b,eventDragStart:b,eventDragStop:b,eventDrop:b,eventResizeStart:b,eventResizeStop:b,eventResize:b,drop:b,eventReceive:b,eventLeave:b},xi={class:I,className:I,viewClass:I,viewDidMount:b,viewWillUnmount:b,views:b,plugins:b,initialEvents:b,events:b,eventSources:b},Yg={type:String,component:b,class:I,className:I,content:b,didMount:b,willUnmount:b,buttonTextKey:String,dateProfileGeneratorClass:b,usesMinMaxTime:Boolean,disallowAmbigTitle:Boolean},gt={dateIncrement:Sr,headerToolbar:Sr,footerToolbar:Sr,buttons:Bg,plugins:vn,events:vn,eventSources:vn,resources:vn};function Ds(t,e){let n={},r={};for(let s in e)s in t&&(n[s]=e[s](t[s],s));for(let s in t)s in e||(r[s]=t[s]);return{refined:n,extra:r}}function b(t){return t}function Ci(t){return t===!1?null:J(t)}function qo(t){let e=Math.floor(Ht(t.start,t.end))||1,n=X(t.start),r=fe(n,e);return{start:n,end:r}}function Xo(t,e=$(0)){let n=null,r=null;if(t.end){r=X(t.end);let s=t.end.valueOf()-r.valueOf();s&&s>=Kt(e)&&(r=fe(r,1))}return t.start&&(n=X(t.start),r&&r<=n&&(r=fe(n,1))),{start:n,end:r}}function bt(t,e,n,r){return r==="year"?$(n.diffWholeYears(t,e),"year"):r==="month"?$(n.diffWholeMonths(t,e),"month"):Zh(t,e)}function xs(t,e){return{instanceId:_e(),defId:t,range:e}}function Gg(t,e,n,r){for(let s=0;s<r.length;s+=1){let i=r[s].parse(t,n);if(i){let{allDay:a}=t;return a==null&&(a=e,a==null&&(a=i.allDayGuess,a==null&&(a=!1))),{allDay:a,duration:i.duration,typeData:i.typeData,typeId:s}}}return null}function ot(t,e,n){let{dateEnv:r,pluginHooks:s,options:i}=n,{defs:a,instances:o}=t;o=it(o,l=>!a[l.defId].recurringDef);for(let l in a){let c=a[l];if(c.recurringDef){let{duration:u}=c.recurringDef;u||(u=c.allDay?i.defaultAllDayEventDuration:i.defaultTimedEventDuration);let f=Zg(c,u,e,r,s.recurringTypes);for(let h of f){let g=xs(l,{start:h,end:r.add(h,u)});o[g.instanceId]=g}}}return{defs:a,instances:o}}function Zg(t,e,n,r,s){let a=s[t.recurringDef.typeId].expand(t.recurringDef.typeData,{start:r.subtract(n.start,e),end:n.end},r);return t.allDay&&(a=a.map(X)),a}function Jt(t,e,n,r,s,i){let a=Me(),o=Rs(n);for(let l of t){let c=Qo(l,e,n,r,o,s,i);c&&Lr(c,a)}return a}function Lr(t,e=Me()){return e.defs[t.def.defId]=t.def,t.instance&&(e.instances[t.instance.instanceId]=t.instance),e}function Cs(t,e){let n=t.instances[e];if(n){let r=t.defs[n.defId],s=rr(t,i=>qg(r,i));return s.defs[r.defId]=r,s.instances[n.instanceId]=n,s}return Me()}function qg(t,e){return!!(t.groupId&&t.groupId===e.groupId)}function Me(){return{defs:{},instances:{}}}function Ts(t,e){return{defs:{...t.defs,...e.defs},instances:{...t.instances,...e.instances}}}function rr(t,e){let n=it(t.defs,e),r=it(t.instances,s=>n[s.defId]);return{defs:n,instances:r}}function Xg(t,e){let{defs:n,instances:r}=t,s={},i={};for(let a in n)e.defs[a]||(s[a]=n[a]);for(let a in r)!e.instances[a]&&s[r[a].defId]&&(i[a]=r[a]);return{defs:s,instances:i}}function Kg(t,e){return Array.isArray(t)?Jt(t,null,e,!0):typeof t=="object"&&t?Jt([t],null,e,!0):t!=null?String(t):null}const jn={display:String,editable:Boolean,startEditable:Boolean,durationEditable:Boolean,constraint:b,overlap:b,allow:b,class:se,className:se,color:String,contrastColor:String},Qg={display:null,startEditable:null,durationEditable:null,constraints:[],overlap:null,allows:[],color:"",contrastColor:"",className:""};function Hn(t,e){let n=Kg(t.constraint,e);return{display:t.display||null,startEditable:t.startEditable!=null?t.startEditable:t.editable,durationEditable:t.durationEditable!=null?t.durationEditable:t.editable,constraints:n!=null?[n]:[],overlap:t.overlap!=null?t.overlap:null,allows:t.allow!=null?[t.allow]:[],color:t.color||"",contrastColor:t.contrastColor||"",className:(t.class??t.className)||""}}function Jg(t){return t.reduce(em,Qg)}function em(t,e){return{display:e.display!=null?e.display:t.display,startEditable:e.startEditable!=null?e.startEditable:t.startEditable,durationEditable:e.durationEditable!=null?e.durationEditable:t.durationEditable,constraints:t.constraints.concat(e.constraints),overlap:typeof e.overlap=="boolean"?e.overlap:t.overlap,allows:t.allows.concat(e.allows),color:e.color||t.color,contrastColor:e.contrastColor||t.contrastColor,className:O(t.className,e.className)}}const Dn={id:String,groupId:String,title:String,url:String,interactive:Boolean},Ko={start:b,end:b,date:b,allDay:Boolean},tm={...Dn,...Ko,extendedProps:b};function Qo(t,e,n,r,s=Rs(n),i,a){let{refined:o,extra:l}=Jo(t,n,s),c=rm(e,n),u=Gg(o,c,n.dateEnv,n.pluginHooks.recurringTypes);if(u){let h=_r(o,l,e?e.sourceId:"",u.allDay,!!u.duration,n,i);return h.recurringDef={typeId:u.typeId,typeData:u.typeData,duration:u.duration},{def:h,instance:null}}let f=nm(o,c,n,r);if(f){let h=_r(o,l,e?e.sourceId:"",f.allDay,f.hasEnd,n,i),g=xs(h.defId,f.range);return a&&h.publicId&&a[h.publicId]&&(g.instanceId=a[h.publicId]),{def:h,instance:g}}return null}function Jo(t,e,n=Rs(e)){return Ds(t,n)}function Rs(t){return{...jn,...tm,...t.pluginHooks.eventRefiners}}function _r(t,e,n,r,s,i,a){let o={title:t.title||"",groupId:t.groupId||"",publicId:t.id||"",url:t.url||"",recurringDef:null,defId:(a&&t.id?a[t.id]:"")||_e(),sourceId:n,allDay:r,hasEnd:s,interactive:t.interactive,ui:Hn(t,i),extendedProps:{...t.extendedProps||{},...e}};for(let l of i.pluginHooks.eventDefMemberAdders)Object.assign(o,l(t));return Object.freeze(o.ui.className),Object.freeze(o.extendedProps),o}function nm(t,e,n,r){let{allDay:s}=t,i,a=null,o=!1,l,c=null,u=t.start!=null?t.start:t.date;if(i=n.dateEnv.createMarkerMeta(u),i)a=i.marker;else if(!r)return null;return t.end!=null&&(l=n.dateEnv.createMarkerMeta(t.end)),s==null&&(e!=null?s=e:s=(!i||i.isTimeUnspecified)&&(!l||l.isTimeUnspecified)),s&&a&&(a=X(a)),l&&(c=l.marker,s&&(c=X(c)),a&&c<=a&&(c=null)),c?o=!0:r||(o=n.options.forceEventDuration||!1,c=n.dateEnv.add(a,s?n.options.defaultAllDayEventDuration:n.options.defaultTimedEventDuration)),{allDay:s,hasEnd:o,range:{start:a,end:c}}}function rm(t,e){let n=null;return t&&(n=t.defaultAllDay),n==null&&(n=e.options.defaultAllDay),n}const sm={start:b,end:b,allDay:Boolean};function im(t,e,n){let r=am(t,e),{range:s}=r;if(!s.start)return null;if(!s.end){if(n==null)return null;s.end=e.add(s.start,n)}return r}function am(t,e){let{refined:n,extra:r}=Ds(t,sm),s=n.start?e.createMarkerMeta(n.start):null,i=n.end?e.createMarkerMeta(n.end):null,{allDay:a}=n;return a==null&&(a=s&&s.isTimeUnspecified&&(!i||i.isTimeUnspecified)),{range:{start:s?s.marker:null,end:i?i.marker:null},allDay:a,...r}}function om(t,e){return ag(t.range,e.range)&&t.allDay===e.allDay&&lm(t,e)}function lm(t,e){for(let n in e)if(n!=="range"&&n!=="allDay"&&t[n]!==e[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}function cm(t,e){return{...tl(t.range,e,t.allDay),allDay:t.allDay}}function el(t,e,n){return{...tl(t,e,n),timeZone:e.timeZone}}function tl(t,e,n){return{start:e.toDate(t.start),end:e.toDate(t.end),startStr:e.formatIso(t.start,{omitTime:n}),endStr:e.formatIso(t.end,{omitTime:n})}}function dm(t,e,n){let r=Jo({editable:!1},n),s=_r(r.refined,r.extra,"",t.allDay,!0,n);return{def:s,ui:sl(s,e),instance:xs(s.defId,t.range),range:t.range,isStart:!0,isEnd:!0}}function nl(t,e,n){n.emitter.trigger("select",{...Ns(t,n),jsEvent:e?e.origEvent:null,view:n.viewApi||n.calendarApi.view})}function um(t,e){e.emitter.trigger("unselect",{jsEvent:t?t.origEvent:null,view:e.viewApi||e.calendarApi.view})}function Ns(t,e){let n={};for(let r of e.pluginHooks.dateSpanTransforms)Object.assign(n,r(t,e));return Object.assign(n,cm(t,e.dateEnv)),n}function Ti(t,e,n){let{dateEnv:r,options:s}=n,i=e;return t?(i=X(i),i=r.add(i,s.defaultAllDayEventDuration)):i=r.add(i,s.defaultTimedEventDuration),i}function Ms(t,e,n,r){let s=An(t.defs,e),i=Me();for(let a in t.defs){let o=t.defs[a];i.defs[a]=fm(o,s[a],n,r)}for(let a in t.instances){let o=t.instances[a],l=i.defs[o.defId];i.instances[a]=hm(o,l,s[o.defId],n,r)}return i}function fm(t,e,n,r){let s=n.standardProps||{};s.hasEnd==null&&e.durationEditable&&(n.startDelta||n.endDelta)&&(s.hasEnd=!0);let i={...t,...s,ui:{...t.ui,...s.ui}};n.extendedProps&&(i.extendedProps={...i.extendedProps,...n.extendedProps});for(let a of r.pluginHooks.eventDefMutationAppliers)a(i,n,r);return!i.hasEnd&&r.options.forceEventDuration&&(i.hasEnd=!0),i}function hm(t,e,n,r,s){let{dateEnv:i}=s,a=r.standardProps&&r.standardProps.allDay===!0,o=r.standardProps&&r.standardProps.hasEnd===!1,l={...t};return a&&(l.range=qo(l.range)),r.datesDelta&&n.startEditable&&(l.range={start:i.add(l.range.start,r.datesDelta),end:i.add(l.range.end,r.datesDelta)}),r.startDelta&&n.durationEditable&&(l.range={start:i.add(l.range.start,r.startDelta),end:l.range.end}),r.endDelta&&n.durationEditable&&(l.range={start:l.range.start,end:i.add(l.range.end,r.endDelta)}),o&&(l.range={start:l.range.start,end:Ti(e.allDay,l.range.start,s)}),e.allDay&&(l.range={start:X(l.range.start),end:X(l.range.end)}),l.range.end<l.range.start&&(l.range.end=Ti(e.allDay,l.range.start,s)),l}class pt{constructor(e,n){this.context=e,this.internalEventSource=n}remove(){this.context.dispatch({type:"REMOVE_EVENT_SOURCE",sourceId:this.internalEventSource.sourceId})}refetch(){this.context.dispatch({type:"FETCH_EVENT_SOURCES",sourceIds:[this.internalEventSource.sourceId],isRefetch:!0})}get id(){return this.internalEventSource.publicId}get url(){return this.internalEventSource.meta.url}get format(){return this.internalEventSource.meta.format}}class K{constructor(e,n,r){this._context=e,this._def=n,this._instance=r||null}setProp(e,n){if(e in Ko)$e(`Cannot set date-related event property \`${e}\`. Use a method instead.`);else if(e==="id")n=Dn[e](n),this.mutate({standardProps:{publicId:n}});else if(e in Dn)n=Dn[e](n),this.mutate({standardProps:{[e]:n}});else if(e in jn){let r=jn[e](n);e==="editable"?r={startEditable:n,durationEditable:n}:r={[e]:n},this.mutate({standardProps:{ui:r}})}else $e(`Cannot set event property \`${e}\`. Use setExtendedProp instead.`)}setExtendedProp(e,n){this.mutate({extendedProps:{[e]:n}})}setStart(e,n={}){let{dateEnv:r}=this._context,s=r.createMarker(e);if(s&&this._instance){let i=this._instance.range,a=bt(i.start,s,r,n.granularity);n.maintainDuration?this.mutate({datesDelta:a}):this.mutate({startDelta:a})}}setEnd(e,n={}){let{dateEnv:r}=this._context,s;if(!(e!=null&&(s=r.createMarker(e),!s))&&this._instance)if(s){let i=bt(this._instance.range.end,s,r,n.granularity);this.mutate({endDelta:i})}else this.mutate({standardProps:{hasEnd:!1}})}setDates(e,n,r={}){let{dateEnv:s}=this._context,i={allDay:r.allDay},a=s.createMarker(e),o;if(a&&!(n!=null&&(o=s.createMarker(n),!o))&&this._instance){let l=this._instance.range;r.allDay===!0&&(l=qo(l));let c=bt(l.start,a,s,r.granularity);if(o){let u=bt(l.end,o,s,r.granularity);dg(c,u)?this.mutate({datesDelta:c,standardProps:i}):this.mutate({startDelta:c,endDelta:u,standardProps:i})}else i.hasEnd=!1,this.mutate({datesDelta:c,standardProps:i})}}moveStart(e){let n=$(e);n&&this.mutate({startDelta:n})}moveEnd(e){let n=$(e);n&&this.mutate({endDelta:n})}moveDates(e){let n=$(e);n&&this.mutate({datesDelta:n})}setAllDay(e,n={}){let r={allDay:e},{maintainDuration:s}=n;s==null&&(s=this._context.options.allDayMaintainDuration),this._def.allDay!==e&&(r.hasEnd=s),this.mutate({standardProps:r})}formatRange(e){let{dateEnv:n}=this._context,r=this._instance,s=J(e);return this._def.hasEnd?ye(n.formatRangeToParts(r.range.start,r.range.end,s)):ye(n.formatToParts(r.range.start,s))}mutate(e){let n=this._instance;if(n){let r=this._def,s=this._context,{eventStore:i}=s.getCurrentData(),a=Cs(i,n.instanceId);a=Ms(a,{"":{display:"",startEditable:!0,durationEditable:!0,constraints:[],overlap:null,allows:[],color:"",contrastColor:"",className:""}},e,s);let l=new K(s,r,n);this._def=a.defs[r.defId],this._instance=a.instances[n.instanceId],s.dispatch({type:"MERGE_EVENTS",eventStore:a}),s.emitter.trigger("eventChange",{oldEvent:l,event:this,relatedEvents:tt(a,s,n),revert(){s.dispatch({type:"RESET_EVENTS",eventStore:i})}})}}remove(){let e=this._context,n=rl(this);e.dispatch({type:"REMOVE_EVENTS",eventStore:n}),e.emitter.trigger("eventRemove",{event:this,relatedEvents:[],revert(){e.dispatch({type:"MERGE_EVENTS",eventStore:n})}})}get source(){let{sourceId:e}=this._def;return e?new pt(this._context,this._context.getCurrentData().eventSources[e]):null}get start(){return this._instance?this._context.dateEnv.toDate(this._instance.range.start):null}get end(){return this._instance&&this._def.hasEnd?this._context.dateEnv.toDate(this._instance.range.end):null}get startStr(){let e=this._instance;return e?this._context.dateEnv.formatIso(e.range.start,{omitTime:this._def.allDay}):""}get endStr(){let e=this._instance;return e&&this._def.hasEnd?this._context.dateEnv.formatIso(e.range.end,{omitTime:this._def.allDay}):""}get id(){return this._def.publicId}get groupId(){return this._def.groupId}get allDay(){return this._def.allDay}get title(){return this._def.title}get url(){return this._def.url}get display(){return this._def.ui.display||"auto"}get startEditable(){return this._def.ui.startEditable}get durationEditable(){return this._def.ui.durationEditable}get constraint(){return this._def.ui.constraints[0]||null}get overlap(){return this._def.ui.overlap}get allow(){return this._def.ui.allows[0]||null}get color(){return this._def.ui.color}get contrastColor(){return this._def.ui.contrastColor}get className(){return this._def.ui.className}get extendedProps(){return this._def.extendedProps}toPlainObject(e={}){let n=this._def,{ui:r}=n,{startStr:s,endStr:i}=this,a={allDay:n.allDay};return n.title&&(a.title=n.title),s&&(a.start=s),i&&(a.end=i),n.publicId&&(a.id=n.publicId),n.groupId&&(a.groupId=n.groupId),n.url&&(a.url=n.url),r.display&&r.display!=="auto"&&(a.display=r.display),r.color&&(a.color=r.color),r.contrastColor&&(a.contrastColor=r.contrastColor),r.className&&(a.className=r.className),Object.keys(n.extendedProps).length&&(e.collapseExtendedProps?Object.assign(a,n.extendedProps):a.extendedProps=n.extendedProps),a}toJSON(){return this.toPlainObject()}}function rl(t){let e=t._def,n=t._instance;return{defs:{[e.defId]:e},instances:n?{[n.instanceId]:n}:{}}}function tt(t,e,n){let{defs:r,instances:s}=t,i=[],a=n?n.instanceId:"";for(let o in s){let l=s[o],c=r[l.defId];l.instanceId!==a&&i.push(new K(e,c,l))}return i}function gm(t){return t.eventRange.instance.instanceId}function Ri(t,e,n,r){let s={},i={},a={},o=[],l=[],c=An(t.defs,e);for(let u in t.defs){let f=t.defs[u];c[f.defId].display==="inverse-background"&&(f.groupId?(s[f.groupId]=[],a[f.groupId]||(a[f.groupId]=f)):i[u]=[])}for(let u in t.instances){let f=t.instances[u],h=t.defs[f.defId],g=c[h.defId],v=f.range,m=!h.allDay&&r?Xo(v,r):v,E=Xt(m,n);E&&(g.display==="inverse-background"?h.groupId?s[h.groupId].push(E):i[f.defId].push(E):g.display!=="none"&&(g.display==="background"?o:l).push({def:h,ui:g,instance:f,range:E,isStart:m.start&&m.start.valueOf()===E.start.valueOf(),isEnd:m.end&&m.end.valueOf()===E.end.valueOf()}))}for(let u in s){let f=s[u],h=gi(f,n);for(let g of h){let v=a[u],m=c[v.defId];o.push({def:v,ui:m,instance:null,range:g,isStart:!1,isEnd:!1})}}for(let u in i){let f=i[u],h=gi(f,n);for(let g of h)o.push({def:t.defs[u],ui:c[u],instance:null,range:g,isStart:!1,isEnd:!1})}return{bg:o,fg:l}}function On(t,e){t.fcEventRange=e}function Nt(t){return t.fcEventRange||t.parentNode.fcEventRange||null}function An(t,e){return ct(t,n=>sl(n,e))}function sl(t,e){const n=[],r=e[""],s=e[t.defId];return r&&n.push(r),s&&n.push(s),n.push(t.ui),Jg(n)}function mm(t,e){let n=t.map(pm);return n.sort((r,s)=>Lg(r,s,e)),n.map(r=>r._seg)}function pm(t){let{eventRange:e}=t,n=e.def,r=e.instance?e.instance.range:e.range,s=r.start?r.start.valueOf():0,i=r.end?r.end.valueOf():0;return{...n.extendedProps,...n,id:n.publicId,start:s,end:i,duration:i-s,allDay:Number(n.allDay),_seg:t}}function vm(t,e){let{pluginHooks:n}=e,r=n.isDraggableTransformers,{def:s,ui:i}=t,a=i.startEditable;for(let o of r)a=o(a,s,i,e);return a}function ym(t,e,n,r,s,i,a,o=!0,l=!0){const{dateEnv:c,options:u}=a,{def:f}=e;let{displayEventTime:h,displayEventEnd:g}=u;h==null&&(h=o!==!1),g==null&&(g=l!==!1);const v=!s&&n&&X(n).valueOf()!==X(e.instance.range.start).valueOf()?n:e.instance.range.start,m=!i&&r&&X(st(r,-1)).valueOf()!==X(st(e.instance.range.end,-1)).valueOf()?r:e.instance.range.end;if(h&&!f.allDay){if(g&&(s||i)&&f.hasEnd){const E=c.formatRangeToParts(v,m,t),C=Em(E);return C!=null?ye(c.formatToParts(v,t))+C+ye(c.formatToParts(m,t)):ye(E)}if(s)return ye(c.formatToParts(v,t))}return""}const bm=new Set(["year","month","day"]);function Em(t){let e,n=!1;for(const r of t)r.source==="shared"&&(e=r),bm.has(r.type)&&(n=!0);return n?e.value:void 0}function Ur(t,e,n){let r=t.range;return{isPast:r.end<=e.start,isFuture:r.start>=e.end,isToday:e&&et(e,r.start)}}function Sm(t,e){let{def:n,instance:r}=t,{url:s}=n;if(s)return["a",{href:s},!0];let{emitter:i,options:a}=e,{eventInteractive:o}=a;o==null&&(o=n.interactive,o==null&&(o=!!i.hasHandlers("eventClick")));let l;return o&&(l=$o(c=>{i.trigger("eventClick",{el:c.target,event:new K(e,n,r),jsEvent:c,view:e.viewApi})}),l={role:"button",...l}),["div",l,o]}const wm=/(^c|C)lass(Name)?$/,Dm=/Content$/,xm=/(DidMount|WillUnmount)$/,Cm=/^on[A-Z]/,Tm={buttons:Vg};function Rm(...t){const e={};for(const n of t)for(const r in n){const s=n[r];e[r]?e[r]=Oe(e[r],s):e[r]=s}return e}function Oe(...t){let e={};for(const n of t)for(let r in n)if(r in e){const s=Tm[r]||(wm.test(r)?Nm:Dm.test(r)?Mm:xm.test(r)?Im:void 0);e[r]=s?s(e[r],n[r],r):n[r]}else e[r]=n[r];return e}function Nm(t,e,n){const r=typeof t=="function",s=typeof e=="function";if(r||s){const i=a=>O(se(r?t(a):t,n),se(s?e(a):e,n));return i.parts=[t,e],i}return O(se(t,n),se(e,n))}function Mm(t,e){if(typeof e=="function"){const n=r=>{const s=e(r);return s===!0?typeof t=="function"?t(r):t:s};return n.parts=[t,e],n}return e??t}function Im(t,e){if(t&&e){const n=(...r)=>{t(...r),e(...r)};return n.parts=[t,e],n}return t||e}function km(t,e){const n=Wg(t,e);for(let r of n)if(!Cm.test(r))return!1;return!0}function Fr(t,e){const n=t&&t.parts,r=e&&e.parts;if(n&&r){const s=n.length,i=r.length;if(s!==i)return!1;for(let a=0;a<s;a++)if(!(n[a]===r[a]||Fr(n[a],r[a])))return!1;return!0}return!1}const Pm=[],il={code:"en",week:{dow:0,doy:4},direction:"ltr",todayText:"Today",prevText:"Prev",nextText:"Next",prevYearText:"Prev year",nextYearText:"Next year",yearText:"Year",monthText:"Month",weekTextLong:"Week",dayText:"Day",listText:"List",closeHint:"Close",eventsHint:"Events",allDayText:"All-day",timedText:"Timed",moreLinkText:"more",noEventsText:"No events to display"},al={...il,weekTextShort:"W",todayHint:(t,e)=>e==="day"?"Today":`This ${t}`,prevHint:"Previous $0",nextHint:"Next $0",viewHint:"$0 view",viewChangeHint:"Change view",navLinkHint:"Go to $0",moreLinkHint(t){return`Show ${t} more event${t===1?"":"s"}`}};function jm(t){let e=t.length>0?t[0].code:"en",n=Pm.concat(t),r={en:al};for(let s of n)r[s.code]=s;return{map:r,defaultCode:e}}function ol(t,e){return typeof t=="object"&&!Array.isArray(t)?ll(t.code,[t.code],t):Hm(t,e)}function Hm(t,e){let n=[].concat(t||[]),r=Om(n,e)||al;return ll(t,n,r)}function Om(t,e){for(let n=0;n<t.length;n+=1){let r=t[n].toLocaleLowerCase().split("-");for(let s=r.length;s>0;s-=1){let i=r.slice(0,s).join("-");if(e[i])return e[i]}}return null}function ll(t,e,n){let r=Oe(il,n);delete r.code;let{week:s}=r;return delete r.week,{codeArg:t,codes:e,week:s,simpleNumberFormat:new Intl.NumberFormat(t),options:r}}class Ni extends Error{constructor(e,n){super(e),this.response=n}}function Am(t,e,n){t=t.toUpperCase();const r={method:t};return t==="GET"?e+=(e.indexOf("?")===-1?"?":"&")+new URLSearchParams(n):(r.body=new URLSearchParams(n),r.headers={"Content-Type":"application/x-www-form-urlencoded"}),fetch(e,r).then(s=>{if(s.ok)return s.json().then(i=>[i,s],()=>{throw new Ni("Failure parsing JSON",s)});throw new Ni("Request failed",s)})}function Lm(t,e){e.emitter.trigger("datesSet",{...el(t.activeRange,e.dateEnv),view:e.viewApi})}function _m(t,e){let{emitter:n}=e;n.hasHandlers("eventsSet")&&n.trigger("eventsSet",tt(t,e))}let Um={ignoreRange:!0,parseMeta(t){return Array.isArray(t.events)?t.events:null},fetch(t,e){e({rawEvents:t.eventSource.meta})}};const Fm={name:"array-event-source",eventSourceDefs:[Um]};function Bm(t,e,n){let r=!1,s=function(o){r||(r=!0,e(o))},i=function(o){r||(r=!0,n(o))},a=t(s,i);a&&typeof a.then=="function"&&a.then(s,i)}let Wm={parseMeta(t){return typeof t.events=="function"?t.events:null},fetch(t,e,n){const{dateEnv:r}=t.context,s=t.eventSource.meta;Bm(s.bind(null,el(t.range,r)),i=>e({rawEvents:i}),n)}};const Vm={name:"func-event-source",eventSourceDefs:[Wm]},zm={method:String,extraParams:b,startParam:String,endParam:String,timeZoneParam:String};let $m={parseMeta(t){return t.url&&(t.format==="json"||!t.format)?{url:t.url,format:"json",method:(t.method||"GET").toUpperCase(),extraParams:t.extraParams,startParam:t.startParam,endParam:t.endParam,timeZoneParam:t.timeZoneParam}:null},fetch(t,e,n){const{meta:r}=t.eventSource,s=Gm(r,t.range,t.context);Am(r.method,r.url,s).then(([i,a])=>{e({rawEvents:i,response:a})},n)}};const Ym={name:"json-event-source",eventSourceRefiners:zm,eventSourceDefs:[$m]};function Gm(t,e,n){let{dateEnv:r,options:s}=n,i,a,o,l,c={};return i=t.startParam,i==null&&(i=s.startParam),a=t.endParam,a==null&&(a=s.endParam),o=t.timeZoneParam,o==null&&(o=s.timeZoneParam),typeof t.extraParams=="function"?l=t.extraParams():l=t.extraParams||{},Object.assign(c,l),c[i]=r.formatIso(e.start),c[a]=r.formatIso(e.end),r.timeZone!=="local"&&(c[o]=r.timeZone),c}const Zm={name:"change-handler",optionChangeHandlers:{controller(t,e){t._setApi(e.calendarApi)},events(t,e){Mi([t],e)},eventSources:Mi}};function Mi(t,e){let n=Go(e.getCurrentData().eventSources);if(n.length===1&&t.length===1&&Array.isArray(n[0]._raw)&&Array.isArray(t[0])){e.dispatch({type:"RESET_RAW_EVENTS",sourceId:n[0].sourceId,rawEvents:t[0]});return}let r=[];for(let s of t){let i=!1;for(let a=0;a<n.length;a+=1)if(n[a]._raw===s){n.splice(a,1),i=!0;break}i||r.push(s)}for(let s of n)e.dispatch({type:"REMOVE_EVENT_SOURCE",sourceId:s.sourceId});for(let s of r)e.calendarApi.addEventSource(s)}const qm={id:String,defaultAllDay:Boolean,url:String,format:String,events:b,eventDataTransform:b,success:b,failure:b};function cl(t,e,n=dl(e)){let r;if(typeof t=="string"?r={url:t}:typeof t=="function"||Array.isArray(t)?r={events:t}:typeof t=="object"&&t&&(r=t),r){let{refined:s,extra:i}=Ds(r,n),a=Xm(s,e);if(a)return{_raw:t,isFetching:!1,latestFetchId:"",fetchRange:null,defaultAllDay:s.defaultAllDay,eventDataTransform:s.eventDataTransform,success:s.success,failure:s.failure,publicId:s.id||"",sourceId:_e(),sourceDefId:a.sourceDefId,meta:a.meta,ui:Hn(s,e),extendedProps:i}}return null}function dl(t){return{...jn,...qm,...t.pluginHooks.eventSourceRefiners}}function Xm(t,e){let n=e.pluginHooks.eventSourceDefs;for(let r=n.length-1;r>=0;r-=1){let i=n[r].parseMeta(t);if(i)return{sourceDefId:r,meta:i}}return null}function Km(t,e,n){let r=e?e.activeRange:null;return fl({},sp(t,n),r,n)}function Qm(t,e,n,r){let s=n?n.activeRange:null;switch(e.type){case"ADD_EVENT_SOURCES":return fl(t,e.sources,s,r);case"REMOVE_EVENT_SOURCE":return ep(t,e.sourceId);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return n?hl(t,s,r):t;case"FETCH_EVENT_SOURCES":return Is(t,e.sourceIds?Zo(e.sourceIds):gl(t,r),s,e.isRefetch||!1,r);case"RECEIVE_EVENTS":case"RECEIVE_EVENT_ERROR":return rp(t,e.sourceId,e.fetchId,e.fetchRange);case"REMOVE_ALL_EVENT_SOURCES":return{};default:return t}}function Jm(t,e,n){let r=e?e.activeRange:null;return Is(t,gl(t,n),r,!0,n)}function ul(t){for(let e in t)if(t[e].isFetching)return!0;return!1}function fl(t,e,n,r){let s={};for(let i of e)s[i.sourceId]=i;return n&&(s=hl(s,n,r)),{...t,...s}}function ep(t,e){return it(t,n=>n.sourceId!==e)}function hl(t,e,n){return Is(t,it(t,r=>tp(r,e,n)),e,!1,n)}function tp(t,e,n){return ml(t,n)?!n.options.lazyFetching||!t.fetchRange||t.isFetching||e.start<t.fetchRange.start||e.end>t.fetchRange.end:!t.latestFetchId}function Is(t,e,n,r,s){let i={};for(let a in t){let o=t[a];e[a]?i[a]=np(o,n,r,s):i[a]=o}return i}function np(t,e,n,r){let{options:s,calendarApi:i}=r,a=r.pluginHooks.eventSourceDefs[t.sourceDefId],o=_e();return a.fetch({eventSource:t,range:e,isRefetch:n,context:r},l=>{let{rawEvents:c}=l;s.eventSourceSuccess&&(c=s.eventSourceSuccess.call(i,c,l.response)||c),t.success&&(c=t.success.call(i,c,l.response)||c),r.dispatch({type:"RECEIVE_EVENTS",sourceId:t.sourceId,fetchId:o,fetchRange:e,rawEvents:c})},l=>{let c=!1;s.eventSourceFailure&&(s.eventSourceFailure.call(i,l),c=!0),t.failure&&(t.failure(l),c=!0),c||$e(`Unhandled event source error: ${l.message}`,l),r.dispatch({type:"RECEIVE_EVENT_ERROR",sourceId:t.sourceId,fetchId:o,fetchRange:e,error:l})}),{...t,isFetching:!0,latestFetchId:o}}function rp(t,e,n,r){let s=t[e];return s&&n===s.latestFetchId?{...t,[e]:{...s,isFetching:!1,fetchRange:r}}:t}function gl(t,e){return it(t,n=>ml(n,e))}function sp(t,e){let n=dl(e),r=[].concat(t.eventSources||[]),s=[];t.initialEvents&&r.unshift(t.initialEvents),t.events&&r.unshift(t.events);for(let i of r){let a=cl(i,e,n);a&&s.push(a)}return s}function ml(t,e){return!e.pluginHooks.eventSourceDefs[t.sourceDefId].ignoreRange}const ip={daysOfWeek:b,startTime:$,endTime:$,duration:$,startRecur:b,endRecur:b};let ap={parse(t,e){if(t.daysOfWeek||t.startTime||t.endTime||t.startRecur||t.endRecur){let n={daysOfWeek:t.daysOfWeek||null,startTime:t.startTime||null,endTime:t.endTime||null,startRecur:t.startRecur?e.createMarker(t.startRecur):null,endRecur:t.endRecur?e.createMarker(t.endRecur):null,dateEnv:e},r;return t.duration&&(r=t.duration),!r&&t.startTime&&t.endTime&&(r=ug(t.endTime,t.startTime)),{allDayGuess:!t.startTime&&!t.endTime,duration:r,typeData:n}}return null},expand(t,e,n){let r=Xt(e,{start:t.startRecur,end:t.endRecur});return r?lp(t.daysOfWeek,t.startTime,t.dateEnv,n,r):[]}};const op={name:"simple-recurring-event",recurringTypes:[ap],eventRefiners:ip};function lp(t,e,n,r,s){let i=t?Zo(t):null,a=X(s.start),o=s.end,l=[];for(e&&(e.milliseconds<0?o=fe(o,1):e.milliseconds>=1e3*60*60*24&&(a=fe(a,-1)));a<o;){let c;(!i||i[a.getUTCDay()])&&(e?c=r.add(a,e):c=a,l.push(r.createMarker(n.toDate(c)))),a=fe(a,1)}return l}const cp=[Fm,Vm,Ym,op,Zm,{name:"misc",isLoadingFuncs:[t=>ul(t.eventSources)],propSetHandlers:{dateProfile:Lm,eventStore:_m}}];function B(t,e,n){let r,s;return function(...i){if(!r)s=t.apply(this,i);else if(!Qt(r,i)){let a=t.apply(this,i);(!e||!e(a,s))&&(s=a)}return r=i,s}}function zt(t,e,n){let r,s;return i=>(r?at(r,i)||(s=t.call(this,i)):s=t.call(this,i),r=i,s)}const At=S.createContext({});function dp(t,e,n,r,s,i,a,o,l,c,u,f,h,g){return{dateEnv:s,nowManager:i,options:n,pluginHooks:a,emitter:c,dispatch:o,getCurrentData:l,calendarApi:u,viewSpec:t,viewApi:e,dateProfileGenerator:r,baseId:f,registerInteractiveComponent:h,unregisterInteractiveComponent:g}}class dt extends S.Component{shouldComponentUpdate(e,n){return!Si(this.props,e,this.propEquality)||!Si(this.state,n,this.stateEquality)}}dt.addPropsEquality=up;dt.addStateEquality=fp;dt.contextType=At;dt.prototype.propEquality={};dt.prototype.stateEquality={};class ee extends dt{}ee.contextType=At;function up(t){let e=Object.create(this.prototype.propEquality);Object.assign(e,t),this.prototype.propEquality=e}function fp(t){let e=Object.create(this.prototype.stateEquality);Object.assign(e,t),this.prototype.stateEquality=e}function G(t,e){typeof t=="function"?t(e):t&&(t.current=e)}class ks extends ee{constructor(){super(...arguments),this.id=_e(),this.queuedDomNodes=[],this.currentDomNodes=[],this.handleEl=e=>{this.el=e,this.props.elRef&&G(this.props.elRef,e)}}render(){const{props:e,context:n}=this,{options:r}=n,{customGenerator:s,defaultGenerator:i,renderProps:a}=e,o=pl(e,"",this.handleEl);let l=!1,c,u=[],f;if(s!=null){const h=typeof s=="function"?s(a):s;if(h===!0)l=!0;else{const g=h&&typeof h=="object";g&&"html"in h?o.dangerouslySetInnerHTML={__html:h.html}:g&&"domNodes"in h?u=Array.prototype.slice.call(h.domNodes):(g?S.isValidElement(h):typeof h!="function")?c=h:f=h}}else l=!hp(e.generatorName,r);return l&&i&&(c=i(a)),this.queuedDomNodes=u,this.currentGeneratorMeta=f,S.createElement(e.tag,o,c)}componentDidMount(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentDidUpdate(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentWillUnmount(){this.triggerCustomRendering(!1)}triggerCustomRendering(e){const{props:n,context:r}=this,{handleCustomRendering:s,customRenderingMetaMap:i}=r.options;if(s){const a=this.currentGeneratorMeta??i?.[n.generatorName];a&&s({id:this.id,isActive:e,containerEl:this.el,generatorMeta:a,renderProps:n.renderProps})}}applyQueueudDomNodes(){const{queuedDomNodes:e,currentDomNodes:n}=this,{el:r}=this;if(!Qt(e,n)){for(const s of n)s.remove();for(let s of e)r.appendChild(s);this.currentDomNodes=e}}}ks.addPropsEquality({renderProps:at,attrs:km,style:at});function hp(t,e){return!!(e.handleCustomRendering&&t&&e.customRenderingMetaMap?.[t])}function pl(t,e,n){const r={...t.attrs,ref:n};return(t.className||e)&&(r.className=O(e,t.className,r.className)),t.style&&(r.style=t.style),r}const gp=S.createContext(0);class me extends S.Component{constructor(){super(...arguments),this.InnerContent=mp.bind(void 0,this),this.handleEl=e=>{this.el=e,this.props.elRef&&(G(this.props.elRef,e),e&&this.didMountMisfire&&this.componentDidMount())}}render(){const{props:e}=this,n=k(e.classNameGenerator,e.renderProps);if(e.children){const r=pl(e,n,this.handleEl),s=e.children(this.InnerContent,e.renderProps,r);return e.tag?S.createElement(e.tag,r,s):s}else return S.createElement(ks,{...e,elRef:this.handleEl,tag:e.tag||"div",className:O(e.className,n),renderId:this.context})}componentDidMount(){this.el?this.props.didMount?.({...this.props.renderProps,el:this.el}):this.didMountMisfire=!0}componentWillUnmount(){this.props.willUnmount?.({...this.props.renderProps,el:this.el})}}me.contextType=gp;function mp(t,e){const n=t.props;return S.createElement(ks,{renderProps:n.renderProps,generatorName:n.generatorName,customGenerator:n.customGenerator,defaultGenerator:n.defaultGenerator,renderId:t.context,...e})}function k(t,e){return(typeof t=="function"?t(e):t)||""}function vl(t){return t.text}function Ye(t){return t.height==="auto"||t.contentHeight==="auto"}function yl(t){let{tableHeaderSticky:e}=t;return(e==null||e==="auto")&&(e=Ye(t)),e}function pp(t){const e=Ye(t);let{footerScrollbarSticky:n}=t;return(n==null||n==="auto")&&(n=e),!!n&&e}function vp(t){const e=t.scrollerSyncerClass;if(!e)throw new RangeError("Must import @fullcalendar/scrollgrid");return e}class bl{constructor(e){this.handleChange=e,this.isMounted=!1,this.handleRefresh=()=>{let n=this.computeTiming();n.nowDate.valueOf()!==this.nowDate.valueOf()&&(this.nowDate=n.nowDate,this.todayRange=n.todayRange,this.handleChange()),this.clearTimeout(),this.setTimeout(n.waitMs)},this.handleVisibilityChange=()=>{document.hidden||this.handleRefresh()}}update(e){if(this.isMounted)(e.unit!==this.unit||e.unitValue!==this.unitValue||e.nowIndicatorSnap!==this.nowIndicatorSnap||e.nowManager!==this.nowManager||e.dateEnv!==this.dateEnv)&&(this.unit=e.unit,this.unitValue=e.unitValue,this.nowIndicatorSnap=e.nowIndicatorSnap,this.nowManager=e.nowManager,this.dateEnv=e.dateEnv,this.clearTimeout(),this.setTimeout());else{this.isMounted=!0,this.unit=e.unit,this.unitValue=e.unitValue,this.nowIndicatorSnap=e.nowIndicatorSnap,this.nowManager=e.nowManager,this.dateEnv=e.dateEnv;const n=this.computeTiming();this.nowDate=n.nowDate,this.todayRange=n.todayRange,this.setTimeout(),this.nowManager.addResetListener(this.handleRefresh),typeof document<"u"&&document.addEventListener("visibilitychange",this.handleVisibilityChange)}return{nowDate:this.nowDate,todayRange:this.todayRange}}destroy(){this.isMounted&&(this.isMounted=!1,this.clearTimeout(),this.nowManager.removeResetListener(this.handleRefresh),typeof document<"u"&&document.removeEventListener("visibilitychange",this.handleVisibilityChange))}computeTiming(){let e=this.nowManager.getDateMarker(),{unit:n,unitValue:r,nowIndicatorSnap:s,dateEnv:i}=this;s==="auto"&&(s=/year|month|week|day/.test(n)||(r||1)===1);let a,o;return s?(a=i.startOf(e,n),o=i.add(a,$(1,n)).valueOf()-e.valueOf()):(a=e,o=1e3*60),o=Math.min(1e3*60*60*24,o),{nowDate:a,todayRange:yp(a),waitMs:o}}setTimeout(e=this.computeTiming().waitMs){this.timeoutId=setTimeout(()=>{const n=this.computeTiming();this.nowDate=n.nowDate,this.todayRange=n.todayRange,this.handleChange(),this.setTimeout(n.waitMs)},e)}clearTimeout(){this.timeoutId&&clearTimeout(this.timeoutId)}}function yp(t){let e=X(t),n=fe(e,1);return{start:e,end:n}}class El{constructor(e){this.props=e,this.initHiddenDays()}buildPrev(e,n,r,s){let{dateEnv:i}=this.props,a=i.subtract(i.startOf(n,e.currentRangeUnit),e.dateIncrement);return this.build(a,r,-1,s)}buildNext(e,n,r,s){let{dateEnv:i}=this.props,a=i.add(i.startOf(n,e.currentRangeUnit),e.dateIncrement);return this.build(a,r,1,s)}build(e,n,r,s=!0){let{props:i}=this,a,o,l,c,u,f;return a=this.buildValidRange(n),a=this.trimHiddenDays(a),s&&(e=og(e,a)),o=this.buildCurrentRangeInfo(e,r),l=/^(year|month|week|day)$/.test(o.unit),c=this.buildRenderRange(this.trimHiddenDays(o.range),o.unit,l),c=this.trimHiddenDays(c),u=c,i.showNonCurrentDates||(u=Xt(u,o.range)),u=this.adjustActiveRange(u),u=Xt(u,a),f=vs(o.range,a),et(c,e)||(e=c.start),{currentDate:e,validRange:a,currentRange:o.range,currentRangeUnit:o.unit,isRangeAllDay:l,activeRange:u,renderRange:c,slotMinTime:i.slotMinTime,slotMaxTime:i.slotMaxTime,isValid:f,dateIncrement:this.buildDateIncrement(o.duration)}}buildValidRange(e){let n=this.props.validRangeInput,r=typeof n=="function"?n.call(this.props.calendarApi,this.props.dateEnv.toDate(e)):n;return this.refineRange(r)||{start:null,end:null}}buildCurrentRangeInfo(e,n){let{props:r}=this,s=null,i=null,a=null,o;return r.duration?(s=r.duration,i=r.durationUnit,a=this.buildRangeFromDuration(e,n,s,i)):(o=this.props.dayCount)?(i="day",a=this.buildRangeFromDayCount(e,n,o)):(a=this.buildCustomVisibleRange(e))?i=r.dateEnv.greatestWholeUnit(a.start,a.end).unit:(s=this.getFallbackDuration(),i=Or(s).unit,a=this.buildRangeFromDuration(e,n,s,i)),{duration:s,unit:i,range:a}}getFallbackDuration(){return $({day:1})}adjustActiveRange(e){let{dateEnv:n,usesMinMaxTime:r,slotMinTime:s,slotMaxTime:i}=this.props,{start:a,end:o}=e;return r&&(Dt(s)<0&&(a=X(a),a=n.add(a,s)),Dt(i)>1&&(o=X(o),o=fe(o,-1),o=n.add(o,i))),{start:a,end:o}}buildRangeFromDuration(e,n,r,s){let{dateEnv:i,dateAlignment:a}=this.props,o,l,c;if(!a){let{dateIncrement:f}=this.props;f&&Kt(f)<Kt(r)?a=Or(f).unit:a=s}Dt(r)<=1&&this.isHiddenDay(o)&&(o=this.skipHiddenDays(o,n),o=X(o));function u(){o=i.startOf(e,a),l=i.add(o,r),c={start:o,end:l}}return u(),this.trimHiddenDays(c)||(e=this.skipHiddenDays(e,n),u()),c}buildRangeFromDayCount(e,n,r){let{dateEnv:s,dateAlignment:i}=this.props,a=0,o=e,l;i&&(o=s.startOf(o,i)),o=X(o),o=this.skipHiddenDays(o,n),l=o;do l=fe(l,1),this.isHiddenDay(l)||(a+=1);while(a<r);return{start:o,end:l}}buildCustomVisibleRange(e){let{props:n}=this,r=n.visibleRangeInput,s=typeof r=="function"?r.call(n.calendarApi,n.dateEnv.toDate(e)):r,i=this.refineRange(s);return i&&(i.start==null||i.end==null)?null:i}buildRenderRange(e,n,r){return e}buildDateIncrement(e){let{dateIncrement:n}=this.props,r;return n||((r=this.props.dateAlignment)?$(1,r):e||$({days:1}))}refineRange(e){if(e){let n=sg(e,this.props.dateEnv);return n&&(n=Xo(n)),n}return null}initHiddenDays(){let e=this.props.hiddenDays||[],n=[],r=0,s;for(this.props.weekends===!1&&e.push(0,6),s=0;s<7;s+=1)(n[s]=e.indexOf(s)!==-1)||(r+=1);if(!r)throw new Error("invalid hiddenDays");this.isHiddenDayHash=n}trimHiddenDays(e){let{start:n,end:r}=e;return n&&(n=this.skipHiddenDays(n)),r&&(r=this.skipHiddenDays(r,-1,!0)),n==null||r==null||n<r?{start:n,end:r}:null}isHiddenDay(e){return e instanceof Date&&(e=e.getUTCDay()),this.isHiddenDayHash[e]}skipHiddenDays(e,n=1,r=!1){for(;this.isHiddenDayHash[(e.getUTCDay()+(r?n:0)+7)%7];)e=fe(e,n);return e}}function Sl(t,e){const{currentRange:n}=t;if(t.currentRangeUnit==="year")return e.diffWholeYears(n.start,n.end)>1?"year":"month";if(t.currentRangeUnit==="month"){if(e.diffWholeMonths(n.start,n.end)>1)return"month"}else if(t.currentRangeUnit==="week"){if(Uo(n.start,n.end)>1)return"week"}else if(t.currentRangeUnit==="day"&&qt(n.start,n.end)>1)return"day"}function wl(t,e,n){if(t.valueOf()===X(t).valueOf()){if(e==="year")return!n.getMonth(t)&&n.getDay(t)===1;if(e==="month")return n.getDay(t)===1;if(e==="week")return t.getUTCDay()===n.weekDow;if(e==="day")return!0}return!1}function bp(t,e,n,r,s){switch(e.type){case"RECEIVE_EVENTS":return Ep(t,n[e.sourceId],e.fetchId,e.fetchRange,e.rawEvents,s);case"RESET_RAW_EVENTS":return Sp(t,n[e.sourceId],e.rawEvents,r.activeRange,s);case"ADD_EVENTS":return wp(t,e.eventStore,r?r.activeRange:null,s);case"RESET_EVENTS":return e.eventStore;case"MERGE_EVENTS":return Ts(t,e.eventStore);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return r?ot(t,r.activeRange,s):t;case"REMOVE_EVENTS":return Xg(t,e.eventStore);case"REMOVE_EVENT_SOURCE":return xl(t,e.sourceId);case"REMOVE_ALL_EVENT_SOURCES":return rr(t,i=>!i.sourceId);case"REMOVE_ALL_EVENTS":return Me();default:return t}}function Ep(t,e,n,r,s,i){if(e&&n===e.latestFetchId){let a=Jt(Dl(s,e,i),e,i);return r&&(a=ot(a,r,i)),Ts(xl(t,e.sourceId),a)}return t}function Sp(t,e,n,r,s){const{defIdMap:i,instanceIdMap:a}=xp(t);let o=Jt(Dl(n,e,s),e,s,!1,i,a);return ot(o,r,s)}function Dl(t,e,n){let r=n.options.eventDataTransform,s=e?e.eventDataTransform:null;return s&&(t=Ii(t,s)),r&&(t=Ii(t,r)),t}function Ii(t,e){let n;if(!e)n=t;else{n=[];for(let r of t){let s=e(r);s?n.push(s):s==null&&n.push(r)}}return n}function wp(t,e,n,r){return n&&(e=ot(e,n,r)),Ts(t,e)}function ki(t,e,n){let{defs:r}=t,s=ct(t.instances,i=>r[i.defId].allDay?i:{...i,range:{start:n.createMarker(e.toDate(i.range.start)),end:n.createMarker(e.toDate(i.range.end))}});return{defs:r,instances:s}}function xl(t,e){return rr(t,n=>n.sourceId!==e)}function Dp(t,e){return{defs:t.defs,instances:it(t.instances,n=>!e[n.instanceId])}}function xp(t){const{defs:e,instances:n}=t,r={},s={};for(let i in e){const a=e[i],{publicId:o}=a;o&&(r[o]=i)}for(let i in n){const a=n[i],o=e[a.defId],{publicId:l}=o;l&&(s[l]=i)}return{defIdMap:r,instanceIdMap:s}}class Lt{constructor(e){this.component=e.component,this.isHitComboAllowed=e.isHitComboAllowed||null}destroy(){}}function Cp(t,e){return{component:t,el:e.el,useEventCenter:e.useEventCenter!=null?e.useEventCenter:!0,isHitComboAllowed:e.isHitComboAllowed||null}}function Ps(t){return{[t.component.uid]:t}}const Br={};class on{constructor(){this.handlers={},this.thisContext=null}setThisContext(e){this.thisContext=e}setOptions(e){this.options=e}on(e,n){Tp(this.handlers,e,n)}off(e,n){Rp(this.handlers,e,n)}trigger(e,...n){let r=this.handlers[e]||[],s=this.options&&this.options[e],i=[].concat(s||[],r);for(let a of i)a.apply(this.thisContext,n)}hasHandlers(e){return!!(this.handlers[e]&&this.handlers[e].length||this.options&&this.options[e])}}function Tp(t,e,n){(t[e]||(t[e]=[])).push(n)}function Rp(t,e,n){n?t[e]&&(t[e]=t[e].filter(r=>r!==n)):delete t[e]}function Np(t){return{name:t.name,premiumReleaseDate:t.premiumReleaseDate?new Date(t.premiumReleaseDate):void 0,reducers:t.reducers||[],isLoadingFuncs:t.isLoadingFuncs||[],contextInit:[].concat(t.contextInit||[]),eventRefiners:t.eventRefiners||{},eventDefMemberAdders:t.eventDefMemberAdders||[],eventSourceRefiners:t.eventSourceRefiners||{},isDraggableTransformers:t.isDraggableTransformers||[],eventDragMutationMassagers:t.eventDragMutationMassagers||[],eventDefMutationAppliers:t.eventDefMutationAppliers||[],dateSelectionTransformers:t.dateSelectionTransformers||[],datePointTransforms:t.datePointTransforms||[],dateSpanTransforms:t.dateSpanTransforms||[],views:t.views||{},viewPropsTransformers:t.viewPropsTransformers||[],isPropsValid:t.isPropsValid||null,externalDefTransforms:t.externalDefTransforms||[],viewContainerAppends:t.viewContainerAppends||[],eventDropTransformers:t.eventDropTransformers||[],componentInteractions:t.componentInteractions||[],calendarInteractions:t.calendarInteractions||[],eventSourceDefs:t.eventSourceDefs||[],cmdFormatter:t.cmdFormatter,recurringTypes:t.recurringTypes||[],initialView:t.initialView||"",elementDraggingImpl:t.elementDraggingImpl,optionChangeHandlers:t.optionChangeHandlers||{},scrollerSyncerClass:t.scrollerSyncerClass||null,listenerRefiners:t.listenerRefiners||{},optionRefiners:t.optionRefiners||{},optionDefaults:t.optionDefaults?[t.optionDefaults]:[],propSetHandlers:t.propSetHandlers||{}}}function Mp(t,e){let n={},r={premiumReleaseDate:void 0,reducers:[],isLoadingFuncs:[],contextInit:[],eventRefiners:{},eventDefMemberAdders:[],eventSourceRefiners:{},isDraggableTransformers:[],eventDragMutationMassagers:[],eventDefMutationAppliers:[],dateSelectionTransformers:[],datePointTransforms:[],dateSpanTransforms:[],views:{},viewPropsTransformers:[],isPropsValid:null,externalDefTransforms:[],viewContainerAppends:[],eventDropTransformers:[],componentInteractions:[],calendarInteractions:[],eventSourceDefs:[],cmdFormatter:null,recurringTypes:[],initialView:"",elementDraggingImpl:null,optionChangeHandlers:{},scrollerSyncerClass:null,listenerRefiners:{},optionRefiners:{},optionDefaults:[],propSetHandlers:{}};function s(i){for(let a of i){const{name:o}=a;if(!o)throw new Error("Plugin must specify a name");if(!n[o]){const l=n[o]=Np(a);r=kp(r,l),s(a.deps||[])}}}return t&&s(t),s(e),r}function Ip(){let t=[],e=[],n;return(r,s)=>((!n||!Qt(r,t)||!Qt(s,e))&&(n=Mp(r,s)),t=r,e=s,n)}function kp(t,e){return{premiumReleaseDate:Pp(t.premiumReleaseDate,e.premiumReleaseDate),reducers:t.reducers.concat(e.reducers),isLoadingFuncs:t.isLoadingFuncs.concat(e.isLoadingFuncs),contextInit:t.contextInit.concat(e.contextInit),eventRefiners:{...t.eventRefiners,...e.eventRefiners},eventDefMemberAdders:t.eventDefMemberAdders.concat(e.eventDefMemberAdders),eventSourceRefiners:{...t.eventSourceRefiners,...e.eventSourceRefiners},isDraggableTransformers:t.isDraggableTransformers.concat(e.isDraggableTransformers),eventDragMutationMassagers:t.eventDragMutationMassagers.concat(e.eventDragMutationMassagers),eventDefMutationAppliers:t.eventDefMutationAppliers.concat(e.eventDefMutationAppliers),dateSelectionTransformers:t.dateSelectionTransformers.concat(e.dateSelectionTransformers),datePointTransforms:t.datePointTransforms.concat(e.datePointTransforms),dateSpanTransforms:t.dateSpanTransforms.concat(e.dateSpanTransforms),views:Rm(t.views,e.views),viewPropsTransformers:t.viewPropsTransformers.concat(e.viewPropsTransformers),isPropsValid:e.isPropsValid||t.isPropsValid,externalDefTransforms:t.externalDefTransforms.concat(e.externalDefTransforms),viewContainerAppends:t.viewContainerAppends.concat(e.viewContainerAppends),eventDropTransformers:t.eventDropTransformers.concat(e.eventDropTransformers),calendarInteractions:t.calendarInteractions.concat(e.calendarInteractions),componentInteractions:t.componentInteractions.concat(e.componentInteractions),eventSourceDefs:t.eventSourceDefs.concat(e.eventSourceDefs),cmdFormatter:e.cmdFormatter||t.cmdFormatter,recurringTypes:t.recurringTypes.concat(e.recurringTypes),initialView:t.initialView||e.initialView,elementDraggingImpl:t.elementDraggingImpl||e.elementDraggingImpl,optionChangeHandlers:{...t.optionChangeHandlers,...e.optionChangeHandlers},scrollerSyncerClass:t.scrollerSyncerClass||e.scrollerSyncerClass,listenerRefiners:{...t.listenerRefiners,...e.listenerRefiners},optionRefiners:{...t.optionRefiners,...e.optionRefiners},optionDefaults:t.optionDefaults.concat(e.optionDefaults),propSetHandlers:{...t.propSetHandlers,...e.propSetHandlers}}}function Pp(t,e){return t===void 0?e:e===void 0?t:new Date(Math.max(t.valueOf(),e.valueOf()))}function jp(t,e){let n={},r;for(r in t)Wr(r,n,t,e);for(r in e)Wr(r,n,t,e);return n}function Wr(t,e,n,r){if(e[t])return e[t];let s=Hp(t,e,n,r);return s&&(e[t]=s),s}function Hp(t,e,n,r){let s=n[t],i=r[t],a=u=>s&&s[u]!==null?s[u]:i&&i[u]!==null?i[u]:null,o=a("component"),l=a("superType"),c=null;if(l){if(l===t)throw new Error("Can't have a custom view type that references itself");c=Wr(l,e,n,r)}return!o&&c&&(o=c.component),o?{type:t,component:o,defaults:Oe(c?c.defaults:{},s?s.rawOptions:{}),overrides:Oe(c?c.overrides:{},i?i.rawOptions:{})}:null}function Pi(t){return ct(t,Op)}function Op(t){let e=typeof t=="function"?{component:t}:t,{component:n}=e;return e.content?n=ji(e.content):n&&!(n.prototype instanceof ee)&&(n=ji(n)),{superType:e.type,component:n,rawOptions:e}}function ji(t){return e=>d.jsx(At.Consumer,{children:n=>{const{options:r,viewSpec:s}=n,i={...e,nextDayThreshold:r.nextDayThreshold,...Ot(r),options:{headerToolbar:r.headerToolbar,footerToolbar:r.footerToolbar},isHeightAuto:Ye(r),view:n.viewApi};return d.jsx(me,{tag:"div",className:O(k(r.viewClass,i),k(s.optionDefaults.class,i),k(s.optionDefaults.className,i),k(s.optionOverrides.class,i),k(s.optionOverrides.className,i)),renderProps:i,generatorName:void 0,customGenerator:t,didMount:r.didMount||r.viewDidMount,willUnmount:r.willUnmount||r.viewWillUnmount})}})}function Ap(t,e,n){let r=Pi(t),s=Pi(e.views),i=jp(r,s);return ct(i,a=>Lp(a,s,e,n))}function Lp(t,e,n,r){let s=t.overrides.duration||t.defaults.duration||r.duration||n.duration,i=null,a="",o="",l={};if(s&&(i=_p(s),i)){let c=Or(i);a=c.unit,c.value===1&&(o=a,l=e[a]?e[a].rawOptions:{})}return{type:t.type,component:t.component,duration:i,durationUnit:a,singleUnit:o,optionDefaults:t.defaults,optionOverrides:{...l,...t.overrides}}}let Hi={};function _p(t){let e=JSON.stringify(t),n=Hi[e];return n===void 0&&(n=$(t),Hi[e]=n),n}function Up(t,e){return e.type==="CHANGE_VIEW_TYPE"&&(t=e.viewType),t}function Fp(t,e){return e.type==="CHANGE_DATE"?e.dateMarker:t}function Bp(t,e,n){let r=t.initialDate;return r!=null?e.createMarker(r):n.getDateMarker()}function Wp(t,e){return e.type==="SET_OPTION"?{...t,[e.optionName]:e.rawOptionValue}:t}function Vp(t,e,n,r,s){let i;switch(e.type){case"CHANGE_VIEW_TYPE":return s.build(e.dateMarker||n,r);case"CHANGE_DATE":return s.build(e.dateMarker,r);case"PREV":if(i=s.buildPrev(t,n,r),i.isValid)return i;break;case"NEXT":if(i=s.buildNext(t,n,r),i.isValid)return i;break}return t}function zp(t,e){switch(e.type){case"UNSELECT_DATES":return null;case"SELECT_DATES":return e.selection;default:return t}}function $p(t,e){switch(e.type){case"UNSELECT_EVENT":return"";case"SELECT_EVENT":return e.eventInstanceId;default:return t}}function Yp(t,e){let n;switch(e.type){case"UNSET_EVENT_DRAG":return null;case"SET_EVENT_DRAG":return n=e.state,{affectedEvents:n.affectedEvents,mutatedEvents:n.mutatedEvents,isEvent:n.isEvent};default:return t}}function Gp(t,e){let n;switch(e.type){case"UNSET_EVENT_RESIZE":return null;case"SET_EVENT_RESIZE":return n=e.state,{affectedEvents:n.affectedEvents,mutatedEvents:n.mutatedEvents,isEvent:n.isEvent};default:return t}}function Zp(t,e,n){let r=t.headerToolbar?Oi(t.headerToolbar,t,e,n):null,s=t.footerToolbar?Oi(t.footerToolbar,t,e,n):null;return{header:r,footer:s}}function Oi(t,e,n,r){let s=e.direction==="rtl",i=[],a=!1;function o(c){let u=qp(c,e,n,r);return i.push(...u.viewsWithButtons),a=a||u.hasTitle,u.widgets}return{sectionWidgets:{start:o(t[s?"right":"left"]||t.start||""),center:o(t.center||""),end:o(t[s?"left":"right"]||t.end||"")},viewsWithButtons:i,hasTitle:a}}function qp(t,e,n,r){let s=e.buttons||{},i=e.toolbarElements||{},a=t?t.split(" "):[],o=[],l=!1;return{widgets:a.map(u=>u.split(",").map(f=>{if(f==="title")return l=!0,{name:f};if(i[f])return{name:f,customElement:i[f]};let h,g=s[f]||{},v,m,E;if(h=n[f]){o.push(f);const C=h.optionDefaults.buttonTextKey;v=g.text||(C?e[C]:"")||(h.singleUnit?e[h.singleUnit+"TextLong"]||e[h.singleUnit+"Text"]:"")||f,m=we(g.hint||e.viewHint,[v,f],v),E=R=>{g?.click?.(R),R.defaultPrevented||r.changeView(f)}}else v=g.text||e[f+"TextLong"]||e[f+"Text"]||f,f==="prevYear"?m=we(g.hint||e.prevHint,[e.yearText,"year"],v):f==="nextYear"?m=we(g.hint||e.nextHint,[e.yearText,"year"],v):m=C=>we(g.hint||e[f+"Hint"],[e[C+"TextLong"]||e[C+"Text"],C],v),E=C=>{g?.click?.(C),C.defaultPrevented||r[f]?.()};return{name:f,isView:!!h,buttonText:v,buttonHint:m,buttonDisplay:g.display,buttonIconClass:g.iconClass,buttonIconContent:g.iconContent,buttonClick:E,buttonIsPrimary:g.isPrimary||!1,buttonClass:g.class??g.className,buttonDidMount:g.didMount,buttonWillUnmount:g.willUnmount}})),viewsWithButtons:o,hasTitle:l}}class Xp{constructor(e,n,r){this.type=e,this.getCurrentData=n,this.dateEnv=r}get calendar(){return this.getCurrentData().calendarApi}get title(){return this.getCurrentData().viewTitle}get activeStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.start)}get activeEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.end)}get currentStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.start)}get currentEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.end)}getOption(e){return this.getCurrentData().options[e]}}const Kp={startTime:"09:00",endTime:"17:00",daysOfWeek:[1,2,3,4,5],display:"inverse-background",className:"",groupId:"_businessHours"};function Qp(t,e){return Jt(Jp(t),null,e)}function Jp(t){let e;return t===!0?e=[{}]:Array.isArray(t)?e=t.filter(n=>n.daysOfWeek):typeof t=="object"&&t?e=[t]:e=[],e=e.map(n=>({...Kp,...n})),e}function ev(t,e,n){let r;/^(year|month)$/.test(t.currentRangeUnit)?r=t.currentRange:r=t.activeRange;let s;const i={isEndExclusive:t.isRangeAllDay};return e.titleFormat?s=n.formatRangeToParts(r.start,r.end,J(e.titleFormat),i):(s=n.formatRangeToParts(r.start,r.end,J(Ai(t,e.disallowAmbigTitle,"long")),i),tv(s)&&(s=n.formatRangeToParts(r.start,r.end,J(Ai(t,e.disallowAmbigTitle,"short")),i))),ye(s)}function Ai(t,e,n){const{currentRangeUnit:r}=t;if(r==="year")return{year:"numeric"};if(r==="month")return{year:"numeric",month:n};if(!e){const s=qt(t.currentRange.start,t.currentRange.end);if(s!==null&&s>1)return{year:"numeric",month:n}}return{year:"numeric",month:"long",day:"numeric"}}function tv(t){let e=!1,n=!1;for(const r of t)r.type==="month"&&(r.source==="startRange"&&(e=!0),r.source==="endRange"&&(n=!0));return e&&n}class Li{constructor(){this.resetListeners=new Set}handleInput(e,n){const r=this.dateEnv;if(e!==r&&(typeof n=="function"?this.nowFn=n:r||(this.nowAnchorDate=e.toDate(n?e.createMarker(n):e.createNowMarker()),this.nowAnchorQueried=Date.now()),this.dateEnv=e,r))for(const s of this.resetListeners.values())s()}getDateMarker(){return this.nowAnchorDate?this.dateEnv.timestampToMarker(this.nowAnchorDate.valueOf()+(Date.now()-this.nowAnchorQueried)):this.dateEnv.createMarker(this.nowFn())}addResetListener(e){this.resetListeners.add(e)}removeResetListener(e){this.resetListeners.delete(e)}}class nv{constructor(e){this.computeCurrentViewData=B(this._computeCurrentViewData),this.organizeRawLocales=B(jm),this.buildLocale=B(ol),this.buildPluginHooks=Ip(),this.buildDateEnv=B(rv),this.parseToolbars=B(Zp),this.buildViewSpecs=B(Ap),this.buildDateProfileGenerator=zt(sv),this.buildViewApi=B(iv),this.buildViewUiProps=zt(lv),this.buildEventUiBySource=B(av,at),this.buildEventUiBases=B(ov),this.parseContextBusinessHours=zt(cv),this.buildToolbarProps=B(dv),this.buildTitle=B(ev),this.nowManager=new Li,this.isDrainingActionQueue=!1,this.actionQueue=[],this.optionOverrides={},this.emitter=new on,this.currentCalendarOptionsRefiners={},this.currentCalendarOptionsInput={},this.currentCalendarOptionsRefined={},this.currentViewOptionsInput={},this.currentViewOptionsRefined={},this.optionsForRefining=[],this.optionsForHandling=[],this.getCurrentData=()=>this.data,this.handleNowChange=()=>{this.dispatch({type:"UPDATE_NOW"})},this.dispatch=n=>{this.actionQueue.push(n),this.isDrainingActionQueue||this.drainActionQueue()},this.config=e,this.nowManager=new Li,this.nowTimer=new bl(this.handleNowChange)}destroy(){this.nowTimer.destroy()}update(e){return this.optionOverrides=e,this.actionQueue.push({type:"IDLE"}),this.drainActionQueue(),this.data}resetOptions(e,n){n===void 0?this.optionOverrides=e:(this.optionOverrides={...this.optionOverrides,...e},this.optionsForRefining.push(...n)),this.dispatch({type:"RESET_OPTIONS"})}drainActionQueue(){let e,{state:n,data:r}=this;const s=!n,{actionQueue:i}=this,a=[];for(this.isDrainingActionQueue=!0;i.length;){const o=i.shift();({state:n,data:r,calendarContext:e}=this.reduce(n,r,o)),this.state=n,this.data=r,o.type!=="IDLE"&&a.push(o)}if(this.isDrainingActionQueue=!1,s){const o=e.options.controller;o&&o._setApi(this.config.calendarApi)}if(!s&&a.length){const{onDataChange:o}=this.config;o&&o(this.data,a)}}reduce(e,n,r){let{config:s}=this,i=!e,a=i?{}:Wp(e.dynamicOptionOverrides,r),o=this.computeOptionsData(this.optionOverrides,a,s.calendarApi),l=i?o.calendarOptions.initialView||o.pluginHooks.initialView:Up(e.currentViewType,r),c=this.computeCurrentViewData(l,o,this.optionOverrides,a);s.calendarApi.currentDataManager=this,this.emitter.setThisContext(s.calendarApi),this.emitter.setOptions(c.options);let u={nowManager:this.nowManager,dateEnv:o.dateEnv,options:o.calendarOptions,pluginHooks:o.pluginHooks,calendarApi:s.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData},{nowDate:f}=this.nowTimer.update({unit:"day",unitValue:1,nowIndicatorSnap:"auto",nowManager:this.nowManager,dateEnv:o.dateEnv}),h=i?Bp(o.calendarOptions,o.dateEnv,this.nowManager):Fp(e.currentDate,r),g;i?g=c.dateProfileGenerator.build(h,f):(g=e.dateProfile,n&&n.dateProfileGenerator!==c.dateProfileGenerator&&(g=c.dateProfileGenerator.build(h,f)),g=Vp(g,r,h,f,c.dateProfileGenerator)),(r&&(r.type==="PREV"||r.type==="NEXT")||!et(g.activeRange,h))&&(h=g.currentRange.start);let v=i?Km(o.calendarOptions,g,u):Qm(e.eventSources,r,g,u),m=i?Me():bp(e.eventStore,r,v,g,u),E=ul(v),C=i?Me():E&&!c.options.progressiveEventRendering&&e.renderableEventStore||m,{eventUiSingleBase:R,selectionConfig:x}=this.buildViewUiProps(u),T=this.buildEventUiBySource(v),M=i?{}:this.buildEventUiBases(C.defs,R,T),D={dynamicOptionOverrides:a,currentViewType:l,currentDate:h,dateProfile:g,eventSources:v,eventStore:m,renderableEventStore:C,selectionConfig:x,eventUiBases:M,businessHours:this.parseContextBusinessHours(u),dateSelection:i?null:zp(e.dateSelection,r),eventSelection:i?"":$p(e.eventSelection,r),eventDrag:i?null:Yp(e.eventDrag,r),eventResize:i?null:Gp(e.eventResize,r),nowDate:f},N={...u,...D};for(let le of o.pluginHooks.reducers)Object.assign(D,le(e,r,N));let P=e?_i(e,u):!1,H=_i(D,u);!P&&H?this.emitter.trigger("loading",!0):P&&!H&&this.emitter.trigger("loading",!1);let U=this.buildTitle(g,c.options,o.dateEnv),te=this.buildToolbarProps(c.viewSpec,g,c.dateProfileGenerator,h,f,U),W={viewTitle:U,nowManager:this.nowManager,calendarApi:s.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData,toolbarProps:te,...o,...c,...D},V=o.pluginHooks.optionChangeHandlers,ne=n&&n.calendarOptions,ae=o.calendarOptions;if(ne&&ne!==ae){ne.timeZone!==ae.timeZone&&(D.eventSources=W.eventSources=Jm(W.eventSources,g,W),D.eventStore=W.eventStore=ki(W.eventStore,n.dateEnv,W.dateEnv),D.renderableEventStore=W.renderableEventStore=ki(W.renderableEventStore,n.dateEnv,W.dateEnv));for(let le in V)(this.optionsForHandling.indexOf(le)!==-1||ne[le]!==ae[le])&&V[le](ae[le],W)}return this.optionsForHandling=[],{state:D,data:W,calendarContext:u}}computeOptionsData(e,n,r){if(!this.optionsForRefining.length&&e===this.stableOptionOverrides&&n===this.stableDynamicOptionOverrides)return this.stableCalendarOptionsData;let{refinedOptions:s,pluginHooks:i,localeDefaults:a,availableLocaleData:o}=this.processRawCalendarOptions(e,n),l=this.buildDateEnv(s.timeZone,s.locale,s.weekNumberCalculation,s.firstDay,s.weekTextLong,s.weekTextShort,i,o),c=this.buildViewSpecs(i.views,this.stableOptionOverrides,this.stableDynamicOptionOverrides),u=this.parseToolbars(s,c,r);return this.stableCalendarOptionsData={calendarOptions:s,pluginHooks:i,dateEnv:l,viewSpecs:c,toolbarConfig:u,localeDefaults:a,availableRawLocales:o.map}}processRawCalendarOptions(e,n){let{locales:r,locale:s}=Oe(wr,e,n),i=this.organizeRawLocales(r),a=i.map,o=this.buildLocale(s||i.defaultCode,a).options,l=this.buildPluginHooks(e.plugins||[],cp),c=this.currentCalendarOptionsRefiners={...wi,...Di,...xi,...l.listenerRefiners,...l.optionRefiners},u=Oe(wr,...l.optionDefaults,o,Fi(Oe(e,n),c)),f={},h=this.currentCalendarOptionsInput,g=this.currentCalendarOptionsRefined,v=!1;for(let m in u)this.optionsForRefining.indexOf(m)===-1&&(u[m]===h[m]||gt[m]&&m in h&&gt[m](h[m],u[m])||Fr(h[m],u[m]))?f[m]=g[m]:c[m]&&(f[m]=c[m](u[m],m),v=!0);return v&&(this.currentCalendarOptionsInput=u,this.currentCalendarOptionsRefined=f,this.stableOptionOverrides=e,this.stableDynamicOptionOverrides=n),this.optionsForHandling.push(...this.optionsForRefining),this.optionsForRefining=[],{rawOptions:this.currentCalendarOptionsInput,refinedOptions:this.currentCalendarOptionsRefined,pluginHooks:l,availableLocaleData:i,localeDefaults:o}}_computeCurrentViewData(e,n,r,s){let i=n.viewSpecs[e];if(!i)throw new Error(`viewType "${e}" is not available. Please make sure you've loaded all neccessary plugins`);let{refinedOptions:a}=this.processRawViewOptions(i,n.pluginHooks,n.localeDefaults,r,s);this.nowManager.handleInput(n.dateEnv,a.now);let o=this.buildDateProfileGenerator({dateProfileGeneratorClass:i.optionDefaults.dateProfileGeneratorClass,duration:i.duration,durationUnit:i.durationUnit,usesMinMaxTime:i.optionDefaults.usesMinMaxTime,dateEnv:n.dateEnv,calendarApi:this.config.calendarApi,slotMinTime:a.slotMinTime,slotMaxTime:a.slotMaxTime,showNonCurrentDates:a.showNonCurrentDates,dayCount:a.dayCount,dateAlignment:a.dateAlignment,dateIncrement:a.dateIncrement,hiddenDays:a.hiddenDays,weekends:a.weekends,validRangeInput:a.validRange,visibleRangeInput:a.visibleRange,fixedWeekCount:a.fixedWeekCount}),l=this.buildViewApi(e,this.getCurrentData,n.dateEnv);return{viewSpec:i,options:a,dateProfileGenerator:o,viewApi:l}}processRawViewOptions(e,n,r,s,i){let a={...wi,...Di,...xi,...Yg,...n.listenerRefiners,...n.optionRefiners},o=Oe(wr,...n.optionDefaults,e.optionDefaults,r,Fi(Oe(s,e.optionOverrides,i),a)),l={},c=this.currentViewOptionsInput,u=this.currentViewOptionsRefined,f=!1;for(let h in o)o[h]===c[h]||gt[h]&&gt[h](o[h],c[h])||Fr(c[h],o[h])?l[h]=u[h]:(o[h]===this.currentCalendarOptionsInput[h]||gt[h]&&gt[h](o[h],this.currentCalendarOptionsInput[h])?h in this.currentCalendarOptionsRefined&&(l[h]=this.currentCalendarOptionsRefined[h]):a[h]&&(l[h]=a[h](o[h],h)),f=!0);return f&&(this.currentViewOptionsInput=o,this.currentViewOptionsRefined=l),{rawOptions:this.currentViewOptionsInput,refinedOptions:this.currentViewOptionsRefined}}}function rv(t,e,n,r,s,i,a,o){let l=ol(e||o.defaultCode,o.map);return new vg({calendarSystem:"gregory",timeZone:t,locale:l,weekNumberCalculation:n,firstDay:r,weekTextLong:s,weekTextShort:i,cmdFormatter:a.cmdFormatter})}function sv(t){let e=t.dateProfileGeneratorClass||El;return new e(t)}function iv(t,e,n){return new Xp(t,e,n)}function av(t){return ct(t,e=>e.ui)}function ov(t,e,n){let r={"":e};for(let s in t){let i=t[s];i.sourceId&&n[i.sourceId]&&(r[s]=n[i.sourceId])}return r}function lv(t){const{options:e}=t;return{eventUiSingleBase:Hn({display:e.eventDisplay,editable:e.editable,startEditable:e.eventStartEditable,durationEditable:e.eventDurationEditable,constraint:e.eventConstraint,overlap:typeof e.eventOverlap=="boolean"?e.eventOverlap:void 0,allow:e.eventAllow},t),selectionConfig:Hn({constraint:e.selectConstraint,overlap:typeof e.selectOverlap=="boolean"?e.selectOverlap:void 0,allow:e.selectAllow},t)}}function _i(t,e){for(let n of e.pluginHooks.isLoadingFuncs)if(n(t))return!0;return!1}function cv(t){return Qp(t.options.businessHours,t)}const Ui={};function Fi(t,e){const n={};for(const r in t)e[r]?n[r]=t[r]:Ui[r]||($e(`Unknown option \`${r}\`.`),Ui[r]=!0);return n}function dv(t,e,n,r,s,i){let a=n.build(s,s,void 0,!1),o=n.buildPrev(e,r,s,!1),l=n.buildNext(e,r,s,!1);return{title:i,selectedButton:t.type,navUnit:t.singleUnit,isTodayEnabled:a.isValid&&!et(e.currentRange,s),isPrevEnabled:o.isValid,isNextEnabled:l.isValid}}class uv{getCurrentData(){return this.currentDataManager.getCurrentData()}dispatch(e){this.currentDataManager.dispatch(e)}get view(){return this.getCurrentData().viewApi}batchRendering(e){e()}setOption(e,n){this.dispatch({type:"SET_OPTION",optionName:e,rawOptionValue:n})}getOption(e){return this.currentDataManager.currentCalendarOptionsInput[e]}getAvailableLocaleCodes(){return Object.keys(this.getCurrentData().availableRawLocales)}on(e,n){let{currentDataManager:r}=this;r.currentCalendarOptionsRefiners[e]?r.emitter.on(e,n):$e(`Unknown listener \`${e}\`.`)}off(e,n){this.currentDataManager.emitter.off(e,n)}trigger(e,...n){this.currentDataManager.emitter.trigger(e,...n)}changeView(e,n){this.batchRendering(()=>{if(this.unselect(),n)if(n.start&&n.end)this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e}),this.dispatch({type:"SET_OPTION",optionName:"visibleRange",rawOptionValue:n});else{let{dateEnv:r}=this.getCurrentData();this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e,dateMarker:r.createMarker(n)})}else this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e})})}zoomTo(e,n){let r=this.getCurrentData(),s;n=n||"day",s=r.viewSpecs[n]||this.getUnitViewSpec(n),this.unselect(),s?this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:s.type,dateMarker:e}):this.dispatch({type:"CHANGE_DATE",dateMarker:e})}getUnitViewSpec(e){let{viewSpecs:n,toolbarConfig:r}=this.getCurrentData(),s=[].concat(r.header?r.header.viewsWithButtons:[],r.footer?r.footer.viewsWithButtons:[]),i,a;for(let o in n)s.push(o);for(i=0;i<s.length;i+=1)if(a=n[s[i]],a&&a.singleUnit===e)return a;return null}prev(){this.unselect(),this.dispatch({type:"PREV"})}next(){this.unselect(),this.dispatch({type:"NEXT"})}prevYear(){let e=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:e.dateEnv.addYears(e.currentDate,-1)})}nextYear(){let e=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:e.dateEnv.addYears(e.currentDate,1)})}today(){let e=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:e.nowManager.getDateMarker()})}gotoDate(e){let n=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:n.dateEnv.createMarker(e)})}incrementDate(e){let n=this.getCurrentData(),r=$(e);r&&(this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:n.dateEnv.add(n.currentDate,r)}))}getDate(){let e=this.getCurrentData();return e.dateEnv.toDate(e.currentDate)}formatDate(e,n){let{dateEnv:r}=this.getCurrentData();return ye(r.formatToParts(r.createMarker(e),J(n)))}formatRange(e,n,r){let{dateEnv:s}=this.getCurrentData();return ye(s.formatRangeToParts(s.createMarker(e),s.createMarker(n),J(r),r))}formatIso(e,n){let{dateEnv:r}=this.getCurrentData();return r.formatIso(r.createMarker(e),{omitTime:n})}select(e,n){let r;n==null?e.start!=null?r=e:r={start:e,end:null}:r={start:e,end:n};let s=this.getCurrentData(),i=im(r,s.dateEnv,$({days:1}));i&&(this.dispatch({type:"SELECT_DATES",selection:i}),nl(i,null,s))}unselect(e){let n=this.getCurrentData();n.dateSelection&&(this.dispatch({type:"UNSELECT_DATES"}),um(e,n))}addEvent(e,n){if(e instanceof K){let a=e._def,o=e._instance;return this.getCurrentData().eventStore.defs[a.defId]||(this.dispatch({type:"ADD_EVENTS",eventStore:Lr({def:a,instance:o})}),this.triggerEventAdd(e)),e}let r=this.getCurrentData(),s;if(n instanceof pt)s=n.internalEventSource;else if(typeof n=="boolean")n&&([s]=Go(r.eventSources));else if(n!=null){let a=this.getEventSourceById(n);if(!a)return $e(`Unknown event source ID \`${n}\`.`),null;s=a.internalEventSource}let i=Qo(e,s,r,!1);if(i){let a=new K(r,i.def,i.def.recurringDef?null:i.instance);return this.dispatch({type:"ADD_EVENTS",eventStore:Lr(i)}),this.triggerEventAdd(a),a}return null}triggerEventAdd(e){let{emitter:n}=this.getCurrentData();n.trigger("eventAdd",{event:e,relatedEvents:[],revert:()=>{this.dispatch({type:"REMOVE_EVENTS",eventStore:rl(e)})}})}getEventById(e){let n=this.getCurrentData(),{defs:r,instances:s}=n.eventStore;e=String(e);for(let i in r){let a=r[i];if(a.publicId===e){if(a.recurringDef)return new K(n,a,null);for(let o in s){let l=s[o];if(l.defId===a.defId)return new K(n,a,l)}}}return null}getEvents(){let e=this.getCurrentData();return tt(e.eventStore,e)}removeAllEvents(){this.dispatch({type:"REMOVE_ALL_EVENTS"})}getEventSources(){let e=this.getCurrentData(),n=e.eventSources,r=[];for(let s in n)r.push(new pt(e,n[s]));return r}getEventSourceById(e){let n=this.getCurrentData(),r=n.eventSources;e=String(e);for(let s in r)if(r[s].publicId===e)return new pt(n,r[s]);return null}addEventSource(e){let n=this.getCurrentData();if(e instanceof pt)return n.eventSources[e.internalEventSource.sourceId]||this.dispatch({type:"ADD_EVENT_SOURCES",sources:[e.internalEventSource]}),e;let r=cl(e,n);return r?(this.dispatch({type:"ADD_EVENT_SOURCES",sources:[r]}),new pt(n,r)):null}removeAllEventSources(){this.dispatch({type:"REMOVE_ALL_EVENT_SOURCES"})}refetchEvents(){this.dispatch({type:"FETCH_EVENT_SOURCES",isRefetch:!0})}scrollToTime(e){let n=$(e);n&&this.trigger("_timeScrollRequest",n)}getButtonState(){const e=this.getCurrentData(),{toolbarProps:n}=e,r=e.calendarOptions,s=r.buttons||{},i=e.viewSpecs,a=e.viewSpec.singleUnit,o=[a?Bi(a,r):"",a],l={today:{text:r.todayText,hint:we(r.todayHint,o,r.todayText),isDisabled:!n.isTodayEnabled},prev:{text:r.prevText,hint:we(r.prevHint,o,r.prevText),isDisabled:!n.isPrevEnabled},next:{text:r.nextText,hint:we(r.nextHint,o,r.nextText),isDisabled:!n.isNextEnabled},prevYear:{text:r.prevYearText,hint:we(r.prevHint,[r.yearText,"year"],r.prevYearText),isDisabled:!1},nextYear:{text:r.prevYearText,hint:we(r.nextHint,[r.yearText,"year"],r.nextYearText),isDisabled:!1}};for(const c in i){const u=i[c],{singleUnit:f}=u,h=u.optionDefaults.buttonTextKey,g=s[c]?.text||(h?r[h]:"")||(f?Bi(f,r):"")||c,v=we(r.viewHint,[g,c],g);l[c]={text:g,hint:v}}return l}}function Bi(t,e){return e[t+"TextLong"]||e[t+"Text"]}class fv extends S.Component{constructor(){super(...arguments),this.state={forPrint:!1},this.handleBeforePrint=()=>{Yt.flushSync(()=>{this.setState({forPrint:!0})})},this.handleAfterPrint=()=>{Yt.flushSync(()=>{this.setState({forPrint:!1})})}}render(){return this.props?.children(this.state.forPrint)}componentDidMount(){const{props:e}=this,{emitter:n}=e;n.on("_beforeprint",this.handleBeforePrint),n.on("_afterprint",this.handleAfterPrint)}componentWillUnmount(){const{props:e}=this,{emitter:n}=e;n.off("_beforeprint",this.handleBeforePrint),n.off("_afterprint",this.handleAfterPrint)}}function hv(t,e){let n=t.borderlessX??t.borderless,r=t.borderlessTop??t.borderless,s=t.borderlessBottom??t.borderless;const i={borderlessX:!!n,borderlessTop:!!r,borderlessBottom:!!s};return O(k(t.class,i),k(t.className,i),y.borderBoxRoot,y.isolate,y.flexCol,e?y.calendarPrintRoot:y.calendarScreenRoot)}class gv extends ee{render(){const{contentGenerator:e,className:n}=this.props;if(e)return d.jsx(me,{tag:"span",style:{display:"contents"},attrs:{"aria-hidden":!0},renderProps:{},generatorName:void 0,customGenerator:e});if(n!==void 0)return d.jsx("span",{"aria-hidden":!0,className:n})}}class mv extends ee{render(){let{props:e}=this,{options:n}=this.context,r=e.widgetGroups.map(s=>this.renderWidgetGroup(s));return S.createElement("div",{className:k(n.toolbarSectionClass,{name:e.name})},...r)}renderWidgetGroup(e){let{props:n,context:r}=this,{options:s}=r,i=[],a=!0,o=!0;for(const l of e){const{name:c,isView:u}=l;c==="title"?a=!1:u||(o=!1)}for(let l of e){let{name:c,customElement:u,buttonHint:f}=l;if(c==="title")i.push(d.jsx("div",{role:"heading","aria-level":s.headingLevel,id:n.titleId,className:O(s.toolbarTitleClass),children:n.title}));else if(u)i.push(d.jsx(me,{tag:"span",style:{display:"contents"},renderProps:{},generatorName:void 0,customGenerator:u}));else{let h=c===n.selectedButton,g=!n.isTodayEnabled&&c==="today"||!n.isPrevEnabled&&c==="prev"||!n.isNextEnabled&&c==="next",v=l.buttonDisplay??s.buttonDisplay;v==="auto"&&(v=l.buttonIconContent||l.buttonIconClass?"icon":"text");let m;v!=="text"&&(m=d.jsx(gv,{className:l.buttonIconClass,contentGenerator:l.buttonIconContent}));let E=e.length>1&&a,C=E?{hasSelection:o}:null,R={name:c,text:l.buttonText,isPrimary:l.buttonIsPrimary,isSelected:h,isDisabled:g,isIconOnly:v==="icon",buttonGroup:C};i.push(d.jsx(me,{tag:"button",attrs:{type:"button",disabled:g,...a&&o?{role:"tab","aria-selected":h}:{"aria-pressed":h},"aria-label":typeof f=="function"?f(n.navUnit):f,onClick:l.buttonClick},className:O(k(s.buttonClass,R),!g&&y.cursorPointer,E&&O(h?y.z1:y.z0,y.focusZ2)),renderProps:R,generatorName:void 0,classNameGenerator:l.buttonClass,didMount:l.buttonDidMount,willUnmount:l.buttonWillUnmount,children:()=>v==="text"?l.buttonText:v==="icon"?m:v==="icon-text"?d.jsxs(d.Fragment,{children:[m,l.buttonText]}):d.jsxs(d.Fragment,{children:[l.buttonText,m]})}))}}return i.length>1?S.createElement("div",{role:a&&o?"tablist":void 0,"aria-label":a&&o?s.viewChangeHint:void 0,className:O(k(s.buttonGroupClass,{hasSelection:o}),y.isolate)},...i):i[0]}}class Wi extends ee{render(){let{props:e}=this,n=this.context.options,{sectionWidgets:r}=e.model;const{borderlessX:s,borderlessTop:i,borderlessBottom:a}=Ot(n),o=e.isHeader?n.headerToolbarClass:n.footerToolbarClass;return d.jsxs("div",{className:O(k(o,{borderlessX:s,borderlessTop:i,borderlessBottom:a}),k(n.toolbarClass,{borderlessX:s,borderlessTop:i,borderlessBottom:a})),children:[this.renderSection("start",r.start),this.renderSection("center",r.center),this.renderSection("end",r.end)]})}renderSection(e,n){let{props:r}=this;return d.jsx(mv,{name:e,widgetGroups:n,title:r.title,titleId:r.titleId,navUnit:r.navUnit,selectedButton:r.selectedButton,isTodayEnabled:r.isTodayEnabled,isPrevEnabled:r.isPrevEnabled,isNextEnabled:r.isNextEnabled},e)}}class pv extends Lt{constructor(e){super(e),this.handleSegClick=(n,r)=>{let{component:s}=this,{context:i}=s,a=Nt(r);a&&s.isValidSegDownEl(n.target)&&i.emitter.trigger("eventClick",{el:r,event:new K(s.context,a.def,a.instance),jsEvent:n,view:i.viewApi})},this.destroy=zo(e.el,"click",`.${y.internalEvent}`,this.handleSegClick)}}class vv extends Lt{constructor(e){super(e),this.handleEventElRemove=n=>{n===this.currentSegEl&&this.handleSegLeave(null,this.currentSegEl)},this.handleSegEnter=(n,r)=>{Nt(r)&&(this.currentSegEl=r,this.triggerEvent("eventMouseEnter",n,r))},this.handleSegLeave=(n,r)=>{this.currentSegEl&&(this.currentSegEl=null,this.triggerEvent("eventMouseLeave",n,r))},this.removeHoverListeners=Ig(e.el,`.${y.internalEvent}`,this.handleSegEnter,this.handleSegLeave)}destroy(){this.removeHoverListeners()}triggerEvent(e,n,r){let{component:s}=this,{context:i}=s,a=Nt(r);(!n||s.isValidSegDownEl(n.target))&&i.emitter.trigger(e,{el:r,event:new K(i,a.def,a.instance),jsEvent:n,view:i.viewApi})}}class yv extends dt{constructor(){super(...arguments),this.buildViewContext=B(dp),this.buildViewPropTransformers=B(bv),this.interactionsStore={},this.calendarInteractions=[],this.registerInteractiveComponent=(e,n)=>{let r=Cp(e,n),i=[pv,vv];n.disableHits||(i=i.concat(this.props.pluginHooks.componentInteractions));let a=i.map(o=>new o(r));this.interactionsStore[e.uid]=a,Br[e.uid]=r},this.unregisterInteractiveComponent=e=>{let n=this.interactionsStore[e.uid];if(n){for(let r of n)r.destroy();delete this.interactionsStore[e.uid]}delete Br[e.uid]}}get viewTitleId(){return this.props.baseId+"title"}render(){const{props:e}=this;let{toolbarConfig:n,options:r}=e,s,i=!1,a;e.forPrint||Ye(r)||(r.height!=null?i=!0:r.contentHeight!=null?s=r.contentHeight:a=Math.max(r.aspectRatio,.5));let o=this.buildViewContext(e.viewSpec,e.viewApi,e.options,e.dateProfileGenerator,e.dateEnv,e.nowManager,e.pluginHooks,e.dispatch,e.getCurrentData,e.emitter,e.calendarApi,e.baseId,this.registerInteractiveComponent,this.unregisterInteractiveComponent);return d.jsxs(At.Provider,{value:o,children:[n.header&&d.jsx(Wi,{model:n.header,isHeader:!0,titleId:this.viewTitleId,...e.toolbarProps}),d.jsxs("div",{className:O(y.flexCol,y.rel,y.overflowAnchorNone,y.minHeight0,i&&y.liquid),style:{height:s,aspectRatio:a!=null?String(a):void 0},children:[this.renderView(O((i||s)&&y.liquid,a!=null&&y.fill,y.internalView)),this.buildAppendContent()]}),n.footer&&d.jsx(Wi,{model:n.footer,isHeader:!1,...e.toolbarProps})]})}renderView(e){const{props:n}=this,{pluginHooks:r,viewSpec:s,toolbarConfig:i,toolbarProps:a}=n;let o={className:e,dateProfile:n.dateProfile,businessHours:n.businessHours,eventStore:n.renderableEventStore,eventUiBases:n.eventUiBases,dateSelection:n.dateSelection,eventSelection:n.eventSelection,eventDrag:n.eventDrag,eventResize:n.eventResize,forPrint:n.forPrint,labelId:i.header&&i.header.hasTitle?this.viewTitleId:void 0,labelStr:i.header&&i.header.hasTitle?void 0:a.title},l=this.buildViewPropTransformers(r.viewPropsTransformers),c={...n,toolbarProps:a,forPrint:n.forPrint};for(let f of l)Object.assign(o,f.transform(o,c));let u=s.component;return d.jsx(u,{...o})}buildAppendContent(){const{props:e}=this;return d.jsx(d.Fragment,{children:e.pluginHooks.viewContainerAppends.map((n,r)=>d.jsx(S.Fragment,{children:n(e)},r))})}componentDidMount(){const{props:e}=this;this.calendarInteractions=e.pluginHooks.calendarInteractions.map(r=>new r(e));let{propSetHandlers:n}=e.pluginHooks;for(let r in n)n[r](e[r],e);for(let r of e.pluginHooks.contextInit)r(e)}componentDidUpdate(e){const{props:n}=this;let{propSetHandlers:r}=n.pluginHooks;for(let s in r)n[s]!==e[s]&&r[s](n[s],n)}componentWillUnmount(){const{props:e}=this;for(let n of this.calendarInteractions)n.destroy();this.calendarInteractions=[],e.emitter.trigger("_unmount")}}function bv(t){return t.map(e=>new e)}const Ev=S.forwardRef((t,e)=>{const n=Dv(t.id),[r,s]=S.useState("");function i(c,u){(Sv(u)?Yt.flushSync:wv)(()=>{s(_e())})}const[a]=S.useState(()=>new uv),[o]=S.useState(()=>new nv({calendarApi:a,onDataChange:i}));S.useEffect(()=>()=>{o.destroy()},[]),S.useImperativeHandle(e,()=>({getApi:()=>a}),[]);const l=o.update(t);return d.jsx(fv,{emitter:l.emitter,children:c=>{const u=l.calendarOptions,f=u.direction==="rtl",h=hv(u,c);return d.jsx("div",{dir:f?"rtl":void 0,className:h,style:{height:u.height},"data-color-scheme":u.colorScheme||void 0,children:d.jsx(yv,{...l,baseId:n,forPrint:c})})}})});function Sv(t){for(const e of t)if(e.type==="SET_EVENT_DRAG"||e.type==="UNSET_EVENT_DRAG"||e.type==="SET_EVENT_RESIZE"||e.type==="UNSET_EVENT_RESIZE"||e.type==="MERGE_EVENTS")return!0;return!1}function wv(t){t()}let Vi=!1;function Dv(t){if(Ys.useId)return Ys.useId();const[e]=S.useState(()=>_e());return t?t+":":(Vi||(Vi=!0,$e("Missing `id` prop. Provide one for better SSR support in React 17.")),`fc:${e}:`)}function Cl(t){const e=t.getRootNode();return e instanceof Document?e.body||e.documentElement:e}function en(t){return getComputedStyle(t).direction==="rtl"}const xv=/(top|left|right|bottom|width|height)$/i;function xn(t,e){for(let n in e)Cv(t,n,e[n])}function Cv(t,e,n){n==null?t.style[e]="":typeof n=="number"&&xv.test(e)?t.style[e]=`${n}px`:t.style[e]=n}function Tl(t){return t.composedPath?.()[0]??t.target}class Rl extends S.Component{constructor(e,n){super(e,n),this.handleChange=()=>{this.forceUpdate()},this.runner=new bl(this.handleChange)}render(){const{props:e,context:n}=this,{nowDate:r,todayRange:s}=this.runner.update({nowManager:n.nowManager,unit:e.unit,unitValue:e.unitValue,nowIndicatorSnap:n.options.nowIndicatorSnap,dateEnv:n.dateEnv});return e.children(r,s)}componentWillUnmount(){this.runner.destroy()}}Rl.contextType=At;const Tv=J({year:"numeric",month:"long",day:"numeric"}),Rv=J({week:"long"}),Nv=J({weekday:"long"});function Ln(t){for(const e of t)if(e.type==="weekday")return e.value;return""}function _n(t){for(const e of t)if(e.type==="day")return e.value;return""}function Nl(t){for(const e of t)if(e.type==="month")return e.value;return""}function sr(t,e,n="day"){return ye(t.dateEnv.formatToParts(e,n==="week"?Rv:Tv))}function js(t,e,n="day",r=sr(t,e,n),s=!0){const{dateEnv:i,options:a,calendarApi:o}=t,l=i.toDate(e),c=u=>{let f=n==="day"?a.navLinkDayClick:n==="week"?a.navLinkWeekClick:null;typeof f=="function"?f.call(o,i.toDate(e),u):(typeof f=="string"&&(n=f),o.zoomTo(e,n))};return{role:"link","aria-label":we(a.navLinkHint,[r,l],r),className:O(a.navLinkClass,y.cursorPointer,y.internalNavLink),...s?bs(c):{onClick:c}}}function Hs(t,e,n,r,s){const i=!!(n&&(!n.activeRange||!et(n.activeRange,t)));return{date:e.toDate(t),dow:t.getUTCDay(),isDisabled:i,isOther:!i&&!!(n&&!et(n.currentRange,t)),isToday:!i&&!!(r&&et(r,t)),isPast:!i&&!!(s?t<s:r&&t<r.start),isFuture:!i&&!!(s?t>s:r&&t>=r.end)}}function Vr(t,e){return t!=null&&(t===e||Math.abs(t-e)<.01)}const Mv=!0,zr=new Map,$r=new Set;let Yr=!1,Dr=!1;function $t(t){$r.add(t),!Yr&&!Dr&&(Dr=!0,requestAnimationFrame(()=>{Dr=!1,Ml()}))}function Ml(){for(const t of $r.values())t(),$r.delete(t)}const yn=typeof ResizeObserver<"u"&&new ResizeObserver(t=>{Yr=!0;for(let e of t){const n=e.target,r=zr.get(n);let s,i;if(e.borderBoxSize&&Mv){const o=e.borderBoxSize[0]||e.borderBoxSize;s=o.inlineSize,i=o.blockSize}else({width:s,height:i}=n.getBoundingClientRect());let a=!1;Vr(r.width,s)||(r.width=s,a=r.watchWidth),Vr(r.height,i)||(r.height=i,a||(a=r.watchHeight)),a&&r.callback(s,i)}Yt.flushSync(()=>{Ml(),Yr=!1})});function ir(t,e,n=!0,r=!0){return zr.set(t,{callback:e,watchWidth:n,watchHeight:r}),yn&&yn.observe(t,{box:"border-box"}),()=>{zr.delete(t),yn&&yn.unobserve(t)}}function Il(t,e){return ir(t,e,!0)}function ar(t,e){return ir(t,(n,r)=>e(r),!1,!0)}class Iv extends ee{constructor(){super(...arguments),this.refineRenderProps=zt(kv)}render(){const{props:e,context:n}=this,{options:r,viewSpec:s}=n,i=this.refineRenderProps({...Ot(r),options:{headerToolbar:r.headerToolbar,footerToolbar:r.footerToolbar},isHeightAuto:Ye(r),viewApi:n.viewApi});return d.jsx(me,{elRef:e.elRef,tag:e.tag||"div",attrs:e.attrs,style:e.style,className:O(e.className,k(r.viewClass,i),k(s.optionDefaults.class,i),k(s.optionDefaults.className,i),k(s.optionOverrides.class,i),k(s.optionOverrides.className,i)),renderProps:i,generatorName:void 0,didMount:r.didMount||r.viewDidMount,willUnmount:r.willUnmount||r.viewWillUnmount,children:()=>e.children})}}function kv(t){return{view:t.viewApi,borderlessX:t.borderlessX,borderlessTop:t.borderlessTop,borderlessBottom:t.borderlessBottom,options:t.options,isHeightAuto:t.isHeightAuto}}class or extends ee{constructor(){super(...arguments),this.uid=_e()}prepareHits(){}queryHit(e,n,r,s,i){return null}isValidSegDownEl(e){return!this.props.eventDrag&&!this.props.eventResize&&!e.closest(`.${y.internalEventMirror}`)}isValidDateDownEl(e){return!e.closest(`.${y.internalEvent}:not(.${y.internalBgEvent})`)&&!e.closest(`.${y.internalMoreLink}`)&&!e.closest(`.${y.internalNavLink}`)&&!e.closest(`.${y.internalPopover}`)}}class zi{constructor(e){this.drainedOption=e,this.isRunning=!1,this.isDirty=!1,this.pauseDepths={},this.timeoutId=0}request(e){this.isDirty=!0,this.isPaused()||(this.clearTimeout(),e==null?this.tryDrain():this.timeoutId=setTimeout(this.tryDrain.bind(this),e))}pause(e=""){let{pauseDepths:n}=this;n[e]=(n[e]||0)+1,this.clearTimeout()}resume(e="",n){let{pauseDepths:r}=this;e in r&&(n?delete r[e]:(r[e]-=1,r[e]<=0&&delete r[e]),this.tryDrain())}isPaused(){return Object.keys(this.pauseDepths).length}tryDrain(){if(!this.isRunning&&!this.isPaused()){for(this.isRunning=!0;this.isDirty;)this.isDirty=!1,this.drained();this.isRunning=!1}}clear(){this.clearTimeout(),this.isDirty=!1,this.pauseDepths={}}clearTimeout(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=0)}drained(){this.drainedOption&&this.drainedOption()}}class Pv{constructor(e){this.el=e,this.emitter=new on,this.isScroll=!1,this.isScrollRecent=!1,this.isWheelRecent=!1,this.isMouseDown=!1,this.isTouchDown=!1,this.isMouse=!1,this.isTouch=!1,this.isWheel=!1,this.handleScroll=()=>{this.isScrollRecent=!0,this.isMouseDown&&(this.isMouse=!0),this.isTouchDown&&(this.isTouch=!0),this.isWheelRecent&&(this.isWheel=!0),this.startScroll(),this.emitter.trigger("scroll",this.getIsDevice()),this.scrollWaiter.request(500)},this.handleScrollWait=()=>{this.isScrollRecent=!1,this.isTouchDown||this.endScroll()},this.handleWheel=()=>{this.isWheelRecent=!0,this.wheelWaiter.request(500)},this.handleWheelWait=()=>{this.isWheelRecent=!1},this.handleMouseDown=()=>{this.isMouseDown=!0},this.handleMouseUp=()=>{this.isMouseDown=!1},this.handleTouchStart=()=>{this.isTouchDown=!0},this.handleTouchEnd=()=>{this.isTouchDown=!1,this.isScrollRecent||this.endScroll()},this.wheelWaiter=new zi(this.handleWheelWait),this.scrollWaiter=new zi(this.handleScrollWait),e.addEventListener("scroll",this.handleScroll,{passive:!0}),e.addEventListener("wheel",this.handleWheel,{passive:!0}),e.addEventListener("mousedown",this.handleMouseDown),e.addEventListener("mouseup",this.handleMouseUp),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.addEventListener("touchend",this.handleTouchEnd)}destroy(){let{el:e}=this;e.removeEventListener("scroll",this.handleScroll,{passive:!0}),e.removeEventListener("wheel",this.handleWheel,{passive:!0}),e.removeEventListener("mousedown",this.handleMouseDown),e.removeEventListener("mouseup",this.handleMouseUp),e.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.removeEventListener("touchend",this.handleTouchEnd)}startScroll(){this.isScroll||(this.isScroll=!0,this.emitter.trigger("scrollStart",this.getIsDevice()))}endScroll(){this.isScroll&&(this.scrollWaiter.clear(),this.wheelWaiter.clear(),this.isScroll=!1,this.isWheelRecent=!1,this.emitter.trigger("scrollEnd",this.getIsDevice()),this.isMouse=!1,this.isTouch=!1,this.isWheel=!1)}getIsDevice(){return this.isWheel||this.isMouse||this.isTouch}}class Un extends or{constructor(){super(...arguments),this.handleEl=e=>{this.el&&(this.el=null,this._isUnmounting=!0,this.listener.destroy()),e&&(this.el=e,this._isUnmounting=!1,this.listener=new Pv(e))},this.handleHRuler=e=>{this.disconnectHRuler&&(this.disconnectHRuler(),this.disconnectHRuler=void 0,this.clientWidth!==void 0&&(this.clientWidth=void 0,G(this.props.clientWidthRef,null))),e&&(this.disconnectHRuler=Il(e,n=>{this._isUnmounting||n!==this.clientWidth&&(this.clientWidth=n,G(this.props.clientWidthRef,n))}))},this.handleVRuler=e=>{this.disconnectVRuler&&(this.disconnectVRuler(),this.disconnectVRuler=void 0,this.clientHeight!==void 0&&(this.clientHeight=void 0,G(this.props.clientHeightRef,null))),e&&(this.disconnectVRuler=ar(e,n=>{if(this._isUnmounting)return;n!==this.clientHeight&&(this.clientHeight=n,G(this.props.clientHeightRef,n));const r=Math.round(this.el.getBoundingClientRect().height-n);r!==this.bottomScrollbarWidth&&(this.bottomScrollbarWidth=r,G(this.props.bottomScrollbarWidthRef,r))}))}}render(){const{props:e}=this,n=e.horizontal||e.vertical?"hidden":"";return d.jsxs("div",{ref:this.handleEl,className:O(e.className,y.noPadding,y.rel,e.hideScrollbars&&y.noScrollbars,y.internalScroller),style:{...e.style,overflowX:e.horizontal?"auto":n,overflowY:e.vertical?"auto":n},children:[e.children,!!e.clientWidthRef&&d.jsx("div",{ref:this.handleHRuler,className:y.fillTop}),!!(e.clientHeightRef||e.bottomScrollbarWidthRef)&&d.jsx("div",{ref:this.handleVRuler,className:y.fillStart})]})}endScroll(){this.listener.endScroll()}get x(){const{el:e}=this;return e?jv(e):0}get y(){const{el:e}=this;return e?e.scrollTop:0}scrollTo({x:e,y:n}){const{el:r}=this;r&&(n!=null&&(r.scrollTop=n),e!=null&&Hv(r,e))}addScrollStartListener(e){this.listener.emitter.on("scrollStart",e)}removeScrollStartListener(e){this.listener.emitter.off("scrollStart",e)}addScrollEndListener(e){this.listener.emitter.on("scrollEnd",e)}removeScrollEndListener(e){this.listener.emitter.off("scrollEnd",e)}}function jv(t){const{scrollLeft:e}=t;return en(t)?Ov(e,t):e}function Hv(t,e){const n=en(t);t.scrollLeft=n?Av(e,t):e}function Ov(t,e){switch(kl()){case"positive":return e.scrollWidth-e.clientWidth-t;case"negative":return-t}return t}function Av(t,e){switch(kl()){case"positive":return e.scrollWidth-e.clientWidth-t;case"negative":return-t}return t}let $i;function kl(){return $i||($i=Lv())}function Lv(){let t=document.createElement("div");t.style.position="absolute",t.style.top="-1000px",t.style.width="100px",t.style.height="100px",t.style.overflow="scroll",t.style.direction="rtl";let e=document.createElement("div");e.style.width="200px",e.style.height="200px",t.appendChild(e),document.body.appendChild(t);let n;return t.scrollLeft>0?n="positive":(t.scrollLeft=50,t.scrollLeft>0?n="reverse":n="negative"),t.remove(),n}class Os extends ee{constructor(){super(...arguments),this.buildPublicEvent=B((e,n,r)=>new K(e,n,r)),this.handleEl=e=>{this.el=e,G(this.props.elRef,e),e&&On(e,this.props.eventRange)}}render(){const{props:e,context:n}=this,{options:r}=n,{eventRange:s}=e,i=s.ui,a=r.eventTimeFormat||e.defaultTimeFormat,o=e.forcedTimeText??ym(a,s,e.slicedStart,e.slicedEnd,e.isStart,e.isEnd,n,e.defaultDisplayEventTime,e.defaultDisplayEventEnd),[l,c,u]=Sm(s,n),f=this.buildPublicEvent(n,s.def,s.instance),h=!e.disableDragging&&vm(s,n),g=/row|column/.test(e.display),v={event:f,isNarrow:e.isNarrow||!1,isShort:e.isShort||!1,timeText:o},m={event:f,view:n.viewApi,timeText:o,color:i.color||r.eventColor,contrastColor:i.contrastColor||r.eventContrastColor,isDraggable:h,isStartResizable:!e.disableResizing&&e.isStart&&i.durationEditable&&r.eventResizableFromStart,isEndResizable:!e.disableResizing&&e.isEnd&&i.durationEditable,isMirror:e.isMirror,isStart:!!e.isStart,isEnd:!!e.isEnd,isFirst:!!e.isFirst,isLast:!!e.isLast,isPast:!!e.isPast,isFuture:!!e.isFuture,isToday:!!e.isToday,isSelected:!!e.isSelected,isDragging:!!e.isDragging,isResizing:!!e.isResizing,isInteractive:u,isNarrow:e.isNarrow||!1,isShort:e.isShort||!1,level:e.level||0,timeClass:O(k(r.eventTimeClass,v),g&&k(r.blockEventTimeClass,v),e.display==="row"&&k(r.rowEventTimeClass,v),e.display==="column"&&k(r.columnEventTimeClass,v),e.display==="list-item"&&k(r.listItemEventTimeClass,v)),titleClass:O(k(r.eventTitleClass,v),g&&k(r.blockEventTitleClass,v),e.display==="row"&&k(r.rowEventTitleClass,v),e.display==="column"&&k(r.columnEventTitleClass,v),e.display==="list-item"&&k(r.listItemEventTitleClass,v),e.display==="row"&&r.rowEventTitleSticky&&y.stickyS,e.display==="column"&&r.columnEventTitleSticky&&y.stickyT),options:{eventOverlap:!!r.eventOverlap}},E=O(g&&k(r.blockEventClass,m),e.display==="row"&&k(r.rowEventClass,m),e.display==="column"&&k(r.columnEventClass,m),e.display==="list-item"&&k(r.listItemEventClass,m),i.className,e.className,e.display==="column"?y.flexCol:y.flexRow,(s.def.url||h)&&y.cursorPointer,y.internalEvent,e.isMirror&&y.internalEventMirror,h&&y.internalEventDraggable,m.isSelected&&y.internalEventSelected,(m.isStartResizable||m.isEndResizable)&&y.internalEventResizable),C=O(k(r.eventBeforeClass,m),g&&k(r.blockEventBeforeClass,m),e.display==="row"&&k(r.rowEventBeforeClass,m),e.display==="column"&&k(r.columnEventBeforeClass,m),e.display==="list-item"&&k(r.listItemEventBeforeClass,m)),R=O(k(r.eventAfterClass,m),g&&k(r.blockEventAfterClass,m),e.display==="row"&&k(r.rowEventAfterClass,m),e.display==="column"&&k(r.columnEventAfterClass,m),e.display==="list-item"&&k(r.listItemEventAfterClass,m)),x=O(k(r.eventInnerClass,m),g&&k(r.blockEventInnerClass,m),e.display==="row"&&k(r.rowEventInnerClass,m),e.display==="column"&&k(r.columnEventInnerClass,m),e.display==="list-item"&&k(r.listItemEventInnerClass,m),!e.disableLiquid&&y.liquid),T=e.display==="row"&&r.rowEventBeforeContent,M=e.display==="row"&&r.rowEventAfterContent;return d.jsx(me,{tag:l,attrs:{...e.attrs,...c,dir:e.isDragging&&r.direction==="rtl"?"rtl":void 0},className:E,style:{"--fc-event-color":m.color,"--fc-event-contrast-color":m.contrastColor},elRef:this.handleEl,renderProps:m,generatorName:"eventContent",customGenerator:r.eventContent,defaultGenerator:_v,classNameGenerator:r.eventClass,didMount:r.eventDidMount,willUnmount:r.eventWillUnmount,children:D=>d.jsxs(d.Fragment,{children:[!!(m.isSelected&&g)&&d.jsx("div",{className:e.display==="column"?y.hitX:y.hitY}),(C||T)&&d.jsxs("div",{className:O(C,!e.disableZindexes&&y.z1,m.isStartResizable&&O(e.display==="column"?y.cursorResizeT:y.cursorResizeS,y.internalEventResizer,y.internalEventResizerStart)),children:[T&&d.jsx(me,{tag:"div",style:{display:"contents"},attrs:{"aria-hidden":!0},renderProps:m,generatorName:void 0,customGenerator:T}),!!(m.isStartResizable&&m.isSelected)&&d.jsx("div",{className:y.hit})]}),d.jsx(D,{tag:"div",className:O(x,!e.disableZindexes&&y.z0)}),(R||M)&&d.jsxs("div",{className:O(R,!e.disableZindexes&&y.z1,m.isEndResizable&&O(e.display==="column"?y.cursorResizeB:y.cursorResizeE,y.internalEventResizer,y.internalEventResizerEnd)),children:[M&&d.jsx(me,{tag:"div",style:{display:"contents"},attrs:{"aria-hidden":!0},renderProps:m,generatorName:void 0,customGenerator:M}),!!(m.isEndResizable&&m.isSelected)&&d.jsx("div",{className:y.hit})]})]})})}componentDidUpdate(e){this.el&&this.props.eventRange!==e.eventRange&&On(this.el,this.props.eventRange)}}Os.addPropsEquality({seg:at});function _v(t){return d.jsxs(d.Fragment,{children:[t.timeText&&d.jsx("div",{className:t.timeClass,children:t.timeText}),d.jsx("div",{className:t.titleClass,children:t.event.title||d.jsx(d.Fragment,{children:" "})})]})}function Uv(t,e){return t.left>=e.left&&t.left<e.right&&t.top>=e.top&&t.top<e.bottom}function Pl(t,e){let n={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)};return n.left<n.right&&n.top<n.bottom?n:!1}function Fv(t,e){return{left:Math.min(Math.max(t.left,e.left),e.right),top:Math.min(Math.max(t.top,e.top),e.bottom)}}function Bv(t){return{left:(t.left+t.right)/2,top:(t.top+t.bottom)/2}}function Wv(t,e){return{left:t.left-e.left,top:t.top-e.top}}function Vv(t,e=!1){let n=window.getComputedStyle(t),r=parseInt(n.borderLeftWidth,10)||0,s=parseInt(n.borderRightWidth,10)||0,i=parseInt(n.borderTopWidth,10)||0,a=parseInt(n.borderBottomWidth,10)||0,o=Yv(t),l=o.y-r-s,c=o.x-i-a,u={borderLeft:r,borderRight:s,borderTop:i,borderBottom:a,scrollbarBottom:c,scrollbarLeft:0,scrollbarRight:0};return n.direction==="rtl"?u.scrollbarLeft=l:u.scrollbarRight=l,e&&(u.paddingLeft=parseInt(n.paddingLeft,10)||0,u.paddingRight=parseInt(n.paddingRight,10)||0,u.paddingTop=parseInt(n.paddingTop,10)||0,u.paddingBottom=parseInt(n.paddingBottom,10)||0),u}function zv(t,e=!1,n){let r=As(t),s=Vv(t,e),i={left:r.left+s.borderLeft+s.scrollbarLeft,right:r.right-s.borderRight-s.scrollbarRight,top:r.top+s.borderTop,bottom:r.bottom-s.borderBottom-s.scrollbarBottom};return e&&(i.left+=s.paddingLeft,i.right-=s.paddingRight,i.top+=s.paddingTop,i.bottom-=s.paddingBottom),i}function As(t){let e=t.getBoundingClientRect();return{left:e.left+window.scrollX,top:e.top+window.scrollY,right:e.right+window.scrollX,bottom:e.bottom+window.scrollY}}function $v(t){let e=jl(t),n=t.getBoundingClientRect();for(let r of e){let s=Pl(n,r.getBoundingClientRect());if(s)n=s;else return null}return n}function jl(t){let e=[];for(;t instanceof HTMLElement;){let n=window.getComputedStyle(t);if(n.position==="fixed")break;/(auto|scroll)/.test(n.overflow+n.overflowY+n.overflowX)&&e.push(t),t=t.parentNode}return e}function Yv(t){return{x:t.offsetHeight-t.clientHeight,y:t.offsetWidth-t.clientWidth}}class Gv{constructor(){this.sliceBusinessHours=B(this._sliceBusinessHours),this.sliceDateSelection=B(this._sliceDateSpan),this.sliceEventStore=B(this._sliceEventStore),this.sliceEventDrag=B(this._sliceInteraction),this.sliceEventResize=B(this._sliceInteraction),this.forceDayIfListItem=!1}sliceProps(e,n,r,s,...i){let{eventUiBases:a}=e,o=this.sliceEventStore(e.eventStore,a,n,r,...i);return{dateSelectionSegs:this.sliceDateSelection(e.dateSelection,n,r,a,s,...i),businessHourSegs:this.sliceBusinessHours(e.businessHours,n,r,s,...i),fgEventSegs:o.fg,bgEventSegs:o.bg,eventDrag:this.sliceEventDrag(e.eventDrag,a,n,r,...i),eventResize:this.sliceEventResize(e.eventResize,a,n,r,...i),eventSelection:e.eventSelection}}sliceNowDate(e,n,r,s,...i){return this._sliceDateSpan({range:{start:e,end:st(e,1)},allDay:!1},n,r,{},s,...i)}_sliceBusinessHours(e,n,r,s,...i){return e?this._sliceEventStore(ot(e,bn(n,!!r),s),{},n,r,...i).bg:[]}_sliceEventStore(e,n,r,s,...i){if(e){let a=Ri(e,n,bn(r,!!s),s);return{bg:this.sliceEventRanges(a.bg,i),fg:this.sliceEventRanges(a.fg,i)}}return{bg:[],fg:[]}}_sliceInteraction(e,n,r,s,...i){if(!e)return null;let a=Ri(e.mutatedEvents,n,bn(r,!!s),s);return{segs:this.sliceEventRanges(a.fg,i),affectedInstances:e.affectedEvents.instances,isEvent:e.isEvent}}_sliceDateSpan(e,n,r,s,i,...a){if(!e)return[];let o=bn(n,!!r),l=Xt(e.range,o);if(l){e={...e,range:l};let c=dm(e,s,i),u=this.sliceRange(e.range,...a);for(let f of u)f.eventRange=c;return u}return[]}sliceEventRanges(e,n){let r=[];for(let s of e)r.push(...this.sliceEventRange(s,n));return r}sliceEventRange(e,n){let r=e.range;this.forceDayIfListItem&&e.ui.display==="list-item"&&(r={start:r.start,end:fe(r.start,1)});let s=this.sliceRange(r,...n);for(let i of s)i.eventRange=e,i.isStart=e.isStart&&i.isStart,i.isEnd=e.isEnd&&i.isEnd;return s}}function bn(t,e){let n=t.activeRange;return e?n:{start:st(n.start,t.slotMinTime.milliseconds),end:st(n.end,t.slotMaxTime.milliseconds-864e5)}}class Zv extends Gv{constructor(){super(...arguments),this.forceDayIfListItem=!0}sliceRange(e,n){return n.sliceRange(e)}}const qv=new Date(2592e5);function Xv(t,e,n,r,s,i){const a=Kv(t,e,n,r,s,i),o=Sl(n,i.dateEnv);if(e&&o!=="day")for(const l of a.dataConfigs)wl(l.dateMarker,o,i.dateEnv)&&(l.renderProps.isMajor=!0);return[a]}function Kv(t,e,n,r,s,i,a,o){return{isDateRow:!0,renderConfig:Qv(s,e,i),dataConfigs:Jv(t,e,n,r,s,i,a,void 0,void 0,void 0,void 0,o)}}function Qv(t,e,n){const{options:r}=n;return{generatorName:"dayHeaderContent",customGenerator:r.dayHeaderContent,classNameGenerator:r.dayHeaderClass,innerClassNameGenerator:r.dayHeaderInnerClass,didMount:r.dayHeaderDidMount,willUnmount:r.dayHeaderWillUnmount,align:r.dayHeaderAlign,sticky:r._dayHeaderSticky,dayHeaderFormat:t,datesRepDistinctDays:e}}const Hl=[];for(let t=0;t<7;t++)Hl.push(fe(new Date(2592e5),t));function Jv(t,e,n,r,s,i,a=1,o="",l={},c={},u="",f){const{dateEnv:h,viewApi:g,options:v}=i;return e?t.map((m,E)=>{const C=Hs(m,h,n,r),R=f!=null,x=v.navLinks&&!C.isDisabled&&t.length>1,T={...C,...l,isMajor:R,isSticky:!1,inPopover:!1,hasNavLink:x,view:g},M=sr(i,m);return{key:o+m.toUTCString(),dateMarker:m,renderProps:T,attrs:{"aria-label":M,...C.isToday?{"aria-current":"date"}:{},"data-date":ys(m),...c},innerAttrs:x?js(i,m,void 0,M):{"aria-hidden":!0},colSpan:a,hasNavLink:x,className:u}}):t.map((m,E)=>{const C=m.getUTCDay(),R=fe(qv,C),x={date:h.toDate(m),dow:C,isDisabled:!1,isFuture:!1,isPast:!1,isToday:!1,isOther:!1},T=f!=null,M={...x,date:Hl[C],isMajor:T,isSticky:!1,inPopover:!1,hasNavLink:!1,view:g,...l},D=ye(h.formatToParts(R,Nv));return{key:o+String(C),dateMarker:m,renderProps:M,attrs:{"aria-label":D,...c},innerAttrs:{"aria-hidden":!0},colSpan:a,className:u}})}class xt{constructor(e,n=!1){this.masterCallback=e,this.ignoreDeletes=n,this.rev="",this.current=new Map,this.callbacks=new Map,this.handleValue=(r,s)=>{let{current:i,callbacks:a}=this;r===null?this.ignoreDeletes||(i.delete(s),a.delete(s)):i.set(s,r),this.rev=_e(),this.masterCallback&&this.masterCallback(r,s)}}createRef(e){let n=this.callbacks.get(e);return n||(n=r=>{this.handleValue(r,e)},this.callbacks.set(e,n)),n}}class Ol extends ee{constructor(){super(...arguments),this.elRef=S.createRef()}render(){return d.jsx("div",{ref:this.elRef})}componentDidMount(){this._isUnmounting=!1;const{props:e}=this,n=this.elRef.current;this.disconnectWidth=Il(n,r=>{this._isUnmounting||G(e.widthRef,r)})}componentWillUnmount(){this._isUnmounting=!0,this.disconnectWidth();const{props:e}=this;e.widthRef&&G(e.widthRef,null)}}function Je(t){return gm(t)+":"+t.start+(t.standinFor?":standin":t.isSlice?":slice":"")}function Cn(t,e){const n=[];for(let r=0;r<e;r++)n[r]=[];for(const r of t)n[r.row].push(r);return n}function Yi(t,e){const n=[];if(t){for(let r=0;r<e;r++)n[r]={affectedInstances:t.affectedInstances,isEvent:t.isEvent,segs:[]};for(const r of t.segs)n[r.row].segs.push(r)}else for(let r=0;r<e;r++)n[r]=null;return n}function Gi(t,e){return{...t,start:e,end:e+1,isStart:t.isStart&&t.start===e,isEnd:t.isEnd&&t.end-1===e,standinFor:t}}class ey extends ee{constructor(){super(...arguments),this.buildPublicEvent=B((e,n,r)=>new K(e,n,r)),this.handleEl=e=>{this.el=e,e&&On(e,this.props.eventRange)}}render(){const{props:e,context:n}=this,{eventRange:r}=e,{options:s}=n,i=r.ui,a=this.buildPublicEvent(n,r.def,r.instance),o={event:a,isNarrow:e.isNarrow||!1,isShort:e.isShort||!1},l={event:a,view:n.viewApi,timeText:"",color:i.color||s.backgroundEventColor,contrastColor:i.contrastColor,isDraggable:!1,isStartResizable:!1,isEndResizable:!1,isMirror:!1,isStart:e.isStart,isEnd:e.isEnd,isFirst:!1,isLast:!1,isPast:e.isPast,isFuture:e.isFuture,isToday:e.isToday,isSelected:!1,isDragging:!1,isResizing:!1,isInteractive:!1,level:0,isNarrow:e.isNarrow||!1,isShort:e.isShort||!1,timeClass:"",titleClass:k(s.backgroundEventTitleClass,o),options:{eventOverlap:!!s.eventOverlap}},c=O(i.className,y.fill,y.internalEvent,y.internalBgEvent,e.isVertical?y.flexCol:y.flexRow),u=O(k(s.backgroundEventInnerClass,l),y.liquid);return d.jsx(me,{tag:"div",className:c,style:{"--fc-event-color":l.color,"--fc-event-contrast-color":l.contrastColor},defaultGenerator:ty,elRef:this.handleEl,renderProps:l,generatorName:"backgroundEventContent",customGenerator:s.backgroundEventContent,classNameGenerator:s.backgroundEventClass,didMount:s.backgroundEventDidMount,willUnmount:s.backgroundEventWillUnmount,children:f=>d.jsx(f,{tag:"div",className:u})})}componentDidUpdate(e){this.el&&this.props.eventRange!==e.eventRange&&On(this.el,this.props.eventRange)}}function ty(t){let{title:e}=t.event;return e&&d.jsx("div",{className:t.titleClass,children:t.event.title})}function ny(t,e){return d.jsx("div",{className:O(t==="non-business"?e.nonBusinessHoursClass:t==="highlight"?e.highlightClass:void 0,y.fill)})}const xr=10,ry=1;class sy extends or{constructor(){super(...arguments),this.getDateMeta=B(Hs),this.closeRef=S.createRef(),this.focusStartRef=S.createRef(),this.focusEndRef=S.createRef(),this.handleRootEl=e=>{this.rootEl=e,e?this.context.registerInteractiveComponent(this,{el:e,useEventCenter:!1}):this.context.unregisterInteractiveComponent(this)},this.handleDocumentMouseDown=e=>{const n=Tl(e);this.rootEl.contains(n)||this.handleClose()},this.handleDocumentKeyDown=e=>{e.key==="Escape"&&this.handleClose()},this.handleClose=()=>{let{onClose:e}=this.props;e&&e()}}render(){let{props:e,context:n}=this,{options:r,dateEnv:s,viewApi:i}=n,{startDate:a,todayRange:o,dateProfile:l}=e,c=this.getDateMeta(a,s,l,o),u=s.formatToParts(a,r.popoverFormat),f=ye(u);const h={...c,isMajor:!1,isNarrow:!1,isSticky:!1,inPopover:!0,level:0,hasNavLink:!1,text:f,textParts:u,get weekdayText(){return Ln(u)},get dayNumberText(){return _n(u)},view:i},g={...c,isMajor:!1,isNarrow:!1,inPopover:!0,hasNavLink:!1,get weekdayText(){return Ln(u)},get dayNumberText(){return _n(u)},get monthText(){return Nl(u)},view:i,text:"",textParts:[],options:{businessHours:!!r.businessHours}},v=ys(a),{dayHeaderAlign:m}=r,E=typeof m=="function"?m({level:0,inPopover:!0,isNarrow:!1}):m,C=en(e.alignEl);return Yt.createPortal(d.jsxs("div",{"data-date":v,id:e.id,role:"dialog","aria-labelledby":e.titleId,className:O(r.popoverClass,y.flexCol,y.popoverZ,y.abs,y.borderBoxRoot,y.internalPopover),style:{top:0,left:0},dir:C?"rtl":void 0,"data-color-scheme":r.colorScheme||void 0,ref:this.handleRootEl,children:[d.jsx("div",{tabIndex:0,style:{outline:"none"},ref:this.focusStartRef}),d.jsxs("div",{className:O(k(r.dayHeaderClass,h),y.flexCol,y.borderOnlyB,E==="center"?y.alignCenter:E==="end"?y.alignEnd:y.alignStart),children:[d.jsx("div",{children:d.jsx(me,{tag:"div",attrs:{id:e.titleId},generatorName:"dayHeaderContent",renderProps:h,customGenerator:r.dayHeaderContent,defaultGenerator:iy,classNameGenerator:r.dayHeaderInnerClass,didMount:r.dayHeaderDidMount,willUnmount:r.dayHeaderWillUnmount})}),d.jsx(me,{tag:"button",attrs:{"aria-label":r.closeHint,...bs(this.handleClose)},elRef:this.closeRef,className:O(r.popoverCloseClass,y.flexRow,y.cursorPointer),renderProps:{},customGenerator:r.popoverCloseContent,generatorName:"popoverCloseContent"})]}),d.jsx("div",{className:O(k(r.dayCellClass,g),y.flexCol,y.borderNone),children:d.jsx("div",{className:k(r.dayCellInnerClass,g),children:e.children})}),d.jsx("div",{tabIndex:0,style:{outline:"none"},ref:this.focusEndRef})]}),Cl(e.alignEl))}queryHit(e,n,r,s,i){let{rootEl:a,props:o}=this;return n>=0&&n<s&&r>=0&&r<i?{dateProfile:o.dateProfile,dateSpan:{allDay:!o.forceTimed,range:{start:o.startDate,end:o.endDate},...o.dateSpanProps},getDayEl:()=>a,rect:{left:0,top:0,right:s,bottom:i},layer:1}:null}componentDidMount(){document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleDocumentKeyDown),this.focusStartRef.current.addEventListener("focus",this.handleClose),this.focusEndRef.current.addEventListener("focus",this.handleClose),this.closeRef.current.focus({preventScroll:!0}),this.updateSize()}componentWillUnmount(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleDocumentKeyDown),this.focusStartRef.current.removeEventListener("focus",this.handleClose),this.focusEndRef.current.removeEventListener("focus",this.handleClose)}updateSize(){let{alignEl:e,alignParentTop:n}=this.props,{rootEl:r}=this;const s=en(e),i=$v(e);if(i){let a=r.getBoundingClientRect(),o=n?e.closest(n).getBoundingClientRect().top-ry:i.top,l=s?i.right-a.width:i.left;o=Math.max(o,xr),l=Math.min(l,document.documentElement.clientWidth-xr-a.width),l=Math.max(l,xr);const{offsetParent:c}=r;let u,f;if(!c||c===document.body)u=o+window.scrollY,f=l+window.scrollX;else{const h=c.getBoundingClientRect();u=o-h.top+c.scrollTop,f=l-h.left+c.scrollLeft}xn(r,{top:u,left:f})}}}function iy(t){return t.text}function Zi(t,e){const n=Math.max(t.start,e.start),r=Math.min(t.end,e.end);if(n<r)return{start:n,end:r,isStart:t.isStart&&n===t.start,isEnd:t.isEnd&&r===t.end}}function qi(t){return t.end}function ay(t){return t.reduce(ly).eventRange.range.start}function oy(t){return t.reduce(cy).eventRange.range.end}function ly(t,e){return t.eventRange.range.start<e.eventRange.range.start?t:e}function cy(t,e){return t.eventRange.range.end>e.eventRange.range.end?t:e}class dy extends ee{constructor(){super(...arguments),this.state={isPopoverOpen:!1},this.handleLinkEl=e=>{this.linkEl=e,this.props.elRef&&G(this.props.elRef,e)},this.handleClick=e=>{let{props:n,context:r}=this,{dateEnv:s,options:i}=r,{moreLinkClick:a}=i,o=Xi(n).start;function l(c){let{def:u,instance:f,range:h}=c.eventRange;return{event:new K(r,u,f),start:s.toDate(h.start),end:s.toDate(h.end),isStart:c.isStart,isEnd:c.isEnd}}typeof a=="function"&&(a=a({date:s.toDate(o),allDay:!!n.allDayDate,allSegs:n.segs.map(l),hiddenSegs:n.hiddenSegs.map(l),jsEvent:e,view:r.viewApi})),!a||a==="popover"?this.setState({isPopoverOpen:!0}):typeof a=="string"&&r.calendarApi.zoomTo(o,a)},this.handlePopoverClose=()=>{this.linkEl&&this.linkEl.focus(),this.setState({isPopoverOpen:!1})}}render(){let{props:e,state:n}=this;return d.jsx(At.Consumer,{children:r=>{let{viewApi:s,options:i,calendarApi:a,baseId:o}=r,{moreLinkText:l}=i,c=e.hiddenSegs.length,u=Xi(e),f=o+"popover-"+u.start.toISOString(),h=`+${c}`,g=typeof l=="function"?l.call(a,c):`${h} ${l}`,v=we(i.moreLinkHint,[c],g),m={num:c,numericText:h,longText:g,text:e.isMicro||e.display==="column"?h:g,isNarrow:e.isNarrow,view:s};return d.jsxs(d.Fragment,{children:[!!c&&d.jsx(me,{tag:"div",elRef:this.handleLinkEl,className:O(k(e.display==="row"?i.rowMoreLinkClass:i.columnMoreLinkClass,m),e.className,e.display==="row"?y.flexRow:y.flexCol,y.internalMoreLink,y.cursorPointer),style:e.style,attrs:{...e.attrs,...bs(this.handleClick),title:v,role:"button","aria-haspopup":"dialog","aria-expanded":n.isPopoverOpen,"aria-controls":n.isPopoverOpen?f:void 0},renderProps:m,generatorName:"moreLinkContent",customGenerator:i.moreLinkContent,defaultGenerator:uy,classNameGenerator:i.moreLinkClass,didMount:i.moreLinkDidMount,willUnmount:i.moreLinkWillUnmount,children:E=>d.jsx(E,{tag:"div",className:O(k(i.moreLinkInnerClass,m),k(e.display==="row"?i.rowMoreLinkInnerClass:i.columnMoreLinkInnerClass,m),e.display==="row"?y.stickyS:y.stickyT)})}),n.isPopoverOpen&&d.jsx(sy,{id:f,titleId:f+"-title",startDate:u.start,endDate:u.end,dateProfile:e.dateProfile,todayRange:e.todayRange,dateSpanProps:e.dateSpanProps,alignEl:e.alignElRef?e.alignElRef.current:this.linkEl,alignParentTop:e.alignParentTop,forceTimed:e.forceTimed,onClose:this.handlePopoverClose,children:e.popoverContent()})]})}})}}function uy(t){return t.text}function Xi(t){return t.allDayDate?{start:t.allDayDate,end:fe(t.allDayDate,1)}:{start:ay(t.hiddenSegs),end:oy(t.hiddenSegs)}}const Al=J({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"narrow"});function Ll(t){let{display:e}=t.eventRange.ui;return e==="list-item"||e==="auto"&&!t.eventRange.def.allDay&&t.end-t.start===1&&t.isStart&&t.isEnd}class fy extends ee{render(){let{props:e}=this;return d.jsx(dy,{display:"row",className:e.className,isNarrow:e.isNarrow,isMicro:e.isMicro,dateProfile:e.dateProfile,todayRange:e.todayRange,allDayDate:e.allDayDate,segs:e.segs,hiddenSegs:e.hiddenSegs,alignElRef:e.alignElRef,alignParentTop:e.alignParentTop,dateSpanProps:e.dateSpanProps,popoverContent:()=>d.jsx(d.Fragment,{children:e.segs.map(n=>{let{eventRange:r}=n,{instanceId:s}=r.instance,i=!!(e.eventDrag&&e.eventDrag.affectedInstances[s]),a=!!(e.eventResize&&e.eventResize.affectedInstances[s]),o=i||a;return d.jsx("div",{style:{visibility:o?"hidden":void 0},children:d.jsx(Os,{display:Ll(n)?"list-item":"row",eventRange:r,isStart:n.isStart,isEnd:n.isEnd,isDragging:i,isResizing:a,isMirror:!1,isSelected:s===e.eventSelection,defaultTimeFormat:Al,defaultDisplayEventEnd:!1,...Ur(r,e.todayRange)})},s)})})})}}class hy extends or{constructor(){super(...arguments),this.getDateMeta=B(Hs),this.refineRenderProps=zt(py),this.rootElRef=S.createRef(),this.handleBodyEl=e=>{this.disconnectBodyHeight&&(this.disconnectBodyHeight(),this.disconnectBodyHeight=void 0,G(this.props.headerHeightRef,null),G(this.props.mainHeightRef,null)),e&&(this.disconnectBodyHeight=ir(e,(n,r)=>{if(this._isUnmounting)return;const{props:s}=this,i=e.getBoundingClientRect(),a=this.rootElRef.current.getBoundingClientRect(),o=i.top-a.top;Vr(this.headerHeight,o)||(this.headerHeight=o,G(s.headerHeightRef,o)),s.fgLiquidHeight&&G(s.mainHeightRef,r)}))}}render(){let{props:e,context:n}=this,{options:r,dateEnv:s}=n;const i=e.showDayNumber&&my(e.date,e.dateProfile.currentRange,s),a=this.getDateMeta(e.date,s,e.dateProfile,e.todayRange),o=O(e.borderStart?y.borderOnlyS:y.borderNone,e.width!=null?"":y.liquid,y.flexCol,y.noMargin,y.noPadding),l=r.navLinks,c=this.refineRenderProps({date:e.date,isMajor:e.isMajor,isNarrow:e.isNarrow,dateMeta:a,hasLabel:e.showDayNumber,hasMonthLabel:i,hasNavLink:l,renderProps:e.renderProps,viewApi:n.viewApi,dateEnv:n.dateEnv,monthStartFormat:r.monthStartFormat,dayCellFormat:r.dayCellFormat,businessHours:!!r.businessHours});if(a.isDisabled)return d.jsx("div",{role:"gridcell","aria-disabled":!0,className:O(k(r.dayCellClass,c),e.className,o),style:{width:e.width}});const u=sr(n,e.date);return d.jsx(me,{tag:"div",elRef:this.rootElRef,className:O(e.className,o),attrs:{...e.attrs,role:"gridcell","aria-label":u,...c.isToday?{"aria-current":"date"}:{},"data-date":ys(e.date)},style:{width:e.width},renderProps:c,generatorName:"dayCellTopContent",customGenerator:r.dayCellTopContent,defaultGenerator:gy,classNameGenerator:r.dayCellClass,didMount:r.dayCellDidMount,willUnmount:r.dayCellWillUnmount,children:f=>d.jsxs(d.Fragment,{children:[d.jsx("div",{className:O(y.rel,k(r.dayCellTopClass,c)),children:e.showDayNumber&&d.jsx(f,{tag:"div",attrs:l?js(n,e.date,void 0,u):{"aria-hidden":!0},className:k(r.dayCellTopInnerClass,c)})}),d.jsxs("div",{className:O(y.flexCol,e.fgLiquidHeight?y.liquid:y.grow),ref:this.handleBodyEl,children:[d.jsx("div",{className:k(r.dayCellInnerClass,c),style:{minHeight:e.fgHeight},children:e.fg}),d.jsx(fy,{className:y.rel,allDayDate:e.date,segs:e.segs,hiddenSegs:e.hiddenSegs,alignElRef:this.rootElRef,alignParentTop:e.showDayNumber?"[role=row]":`.${y.internalView}`,dateSpanProps:e.dateSpanProps,dateProfile:e.dateProfile,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,todayRange:e.todayRange,isNarrow:e.isNarrow,isMicro:e.isMicro})]}),d.jsx("div",{className:O(y.rel,k(r.dayCellBottomClass,c))})]})})}componentDidMount(){this._isUnmounting=!1}componentWillUnmount(){this._isUnmounting=!0}}function gy(t){return t.text||d.jsx(d.Fragment,{children:" "})}function my(t,e,n){const{start:r,end:s}=e,i=st(s,-1),a=n.getYear(r),o=n.getMonth(r),l=n.getYear(i),c=n.getMonth(i);return!(a===l&&o===c)&&(t.valueOf()===r.valueOf()||n.getDay(t)===1&&t.valueOf()<s.valueOf())}function py(t){let{date:e,dateEnv:n,hasLabel:r,hasMonthLabel:s,hasNavLink:i,businessHours:a}=t,o=[],l="";return r&&(o=n.formatToParts(e,s?t.monthStartFormat:t.dayCellFormat),l=ye(o)),{...t.dateMeta,...t.renderProps,text:l,textParts:o,isMajor:t.isMajor,isNarrow:t.isNarrow,inPopover:!1,hasNavLink:i,get weekdayText(){return Ln(o)},get dayNumberText(){return _n(o)},get monthText(){return Nl(o)},options:{businessHours:a},view:t.viewApi}}class Ki{constructor(e,n=l=>1,r=!1,s,i,a=!1,o=!1){this.getSegThickness=n,this.strictOrder=r,this.maxCoord=s,this.maxDepth=i,this.hiddenConsumes=a,this.allowSlicing=o,this.placementsByLevel=[],this.levelCoords=[],this.hiddenSegs=[];for(const l of e)this.insertSeg(l,this.getSegThickness(l))}insertSeg(e,n,r){if(n!=null){const s=this.findInsertion(e,n);if(this.isInsertionValid(s,n))this.insertSegAt(e,s,n,r);else{const{touchingPlacement:i}=s;if(i){if(this.hiddenConsumes&&!i.isZombie&&(i.isZombie=!0,this.hiddenSegs.push(i),this.allowSlicing)){const a=Object.assign({},i);Object.assign(i,Zi(i,e)),i.isSlice=!0,this.splitSeg(a,i.thickness,i)}this.allowSlicing?(this.hiddenSegs.push({...e,...Zi(e,i)}),this.splitSeg(e,n,i)):this.hiddenSegs.push(e)}else this.hiddenSegs.push(e)}}}isInsertionValid(e,n){return(this.maxCoord==null||e.levelCoord+n<=this.maxCoord)&&(this.maxDepth==null||e.depth<this.maxDepth)}splitSeg(e,n,r){e.start<r.start&&this.insertSeg({...e,end:r.start,isEnd:!1},n,!0),e.end>r.end&&this.insertSeg({...e,start:r.end,isStart:!1},n,!0)}insertSegAt(e,n,r,s){const i={...e,thickness:r,depth:n.depth,isSlice:s||e.isSlice||!1,isZombie:!1};n.lateralIndex===-1?(Cr(this.placementsByLevel,n.levelIndex,[i]),Cr(this.levelCoords,n.levelIndex,n.levelCoord)):Cr(this.placementsByLevel[n.levelIndex],n.lateralIndex,i)}findInsertion(e,n){let{placementsByLevel:r,levelCoords:s}=this,i=r.length,a=0,o,l,c=0;for(let h=0;h<i;h+=1){const g=s[h];if(!this.strictOrder&&g>=a+n)break;let v=r[h],m,[E,C]=Qi(v,e.start,qi),R=E+C;for(;(m=v[R])&&m.start<e.end;){let x=g+m.thickness;x>a&&(a=x,o=m,l=h),x===a&&(c=Math.max(c,m.depth+1)),R+=1}}let u=0;if(o)for(u=l+1;u<i&&s[u]<a;)u+=1;let f=-1;return u<i&&s[u]===a&&([f]=Qi(r[u],e.end,qi)),{touchingPlacement:o,levelCoord:a,levelIndex:u,lateralIndex:f,depth:c}}traverseSegs(e){const{placementsByLevel:n,levelCoords:r}=this;for(let s=0;s<n.length;s++){const i=n[s],a=r[s];for(const o of i)o.isZombie||e(o,a)}}}function Cr(t,e,n){t.splice(e,0,n)}function Qi(t,e,n){let r=0,s=t.length;if(!s||e<n(t[r]))return[0,0];if(e>n(t[s-1]))return[s,0];for(;r<s;){let i=Math.floor(r+(s-r)/2),a=n(t[i]);if(e<a)s=i;else if(e>a)r=i+1;else return[i,1]}return[r,0]}function vy(t,e,n,r,s,i=!0,a,o){let l,c,u;a===!0||o===!0?(l=r,u=!0):typeof a=="number"?(c=a,u=!1):typeof o=="number"&&(c=o,u=!0);const f=new Map,h=new Map,g=new Map,v=new Map;let m=new Ki(t,T=>e.get(Je(T)),s,l,c,u,i);m.traverseSegs((T,M)=>{Tr(f,T),g.set(Je(T),M),T.isSlice&&v.set(T.eventRange,!0)});for(const T of m.hiddenSegs)Tr(h,T);if(v.size){g.clear(),m=new Ki(yy(t,f),T=>e.get(Je(T)),s,l,c,u),m.traverseSegs((T,M)=>{g.set(Je(T),M)});for(const T of m.hiddenSegs)Tr(h,T)}const E=[],C=[],R=[],x=[];for(let T=0;T<n.length;T++)E.push([]),C.push([]),R.push([]),x.push(0);for(const T of t){const{eventRange:M}=T,D=f.get(M)||[],N=h.get(M)||[],P=v.get(M)||!1;if(R[T.start].push(T),P)for(const H of D)R[H.start].push(H);for(const H of D){for(let W=H.start;W<H.end;W++){const V=Gi(H,W);E[W].push(V)}const U=Je(H),te=g.get(U);if(te!=null){const W=e.get(U);for(let V=H.start;V<H.end;V++)x[V]=Math.max(x[V],te+W)}}for(const H of N)for(let U=H.start;U<H.end;U++){const te=Gi(H,U);E[U].push(te),C[U].push(te)}}return[E,C,R,g,x]}function Tr(t,e){let n=t.get(e.eventRange);n||t.set(e.eventRange,n=[]),n.push(e)}function yy(t,e){const n=[];for(const r of t)n.push(...e.get(r.eventRange)||[]);return n}class by{constructor(e,n){let r=e.start,{end:s}=e,i=[],a=[],o=-1;for(;r<s;)n.isHiddenDay(r)?i.push(o+.5):(o+=1,i.push(o),a.push(r)),r=fe(r,1);this.dates=a,this.indices=i,this.cnt=a.length}sliceRange(e){let n=this.getDateDayIndex(e.start),r=this.getDateDayIndex(fe(e.end,-1)),s=Math.max(0,n),i=Math.min(this.cnt-1,r);return s=Math.ceil(s),i=Math.floor(i),s<=i?{start:s,end:i+1,isStart:n===s,isEnd:r===i}:null}getDateDayIndex(e){let{indices:n}=this,r=Math.floor(Ht(this.dates[0],e));return r<0?n[0]-1:r>=n.length?n[n.length-1]+1:n[r]}}class Ey{constructor(e,n,r,s=""){this.dateEnv=r,this.majorUnit=s;let{dates:i}=e,a,o,l;if(n){for(o=i[0].getUTCDay(),a=1;a<i.length&&i[a].getUTCDay()!==o;a+=1);l=Math.ceil(i.length/a)}else l=1,a=i.length;this.rowCount=l,this.colCount=a,this.daySeries=e,this.cellRows=this.buildCells(),this.headerDates=this.buildHeaderDates()}buildCells(){let e=[];for(let n=0;n<this.rowCount;n+=1){let r=[];for(let s=0;s<this.colCount;s+=1)r.push(this.buildCell(n,s));e.push(r)}return e}buildCell(e,n){let r=this.daySeries.dates[e*this.colCount+n];return{key:r.toISOString(),date:r,isMajor:this.cellIsMajor(r)}}cellIsMajor(e){return this.majorUnit?wl(e,this.majorUnit,this.dateEnv):!1}buildHeaderDates(){let e=[];for(let n=0;n<this.colCount;n+=1)e.push(this.cellRows[0][n].date);return e}sliceRange(e){let{colCount:n}=this,r=this.daySeries.sliceRange(e),s=[];if(r){const{start:i,end:a}=r;let o=i;for(;o<a;){let l=Math.floor(o/n),c=Math.min((l+1)*n,a);s.push({row:l,start:o%n,end:(c-1)%n+1,isStart:r.isStart&&o===i,isEnd:r.isEnd&&c===a}),o=c}}return s}}function Sy(t,e,n){const r=new by(t.renderRange,e),s=/year|month|week/.test(t.currentRangeUnit),i=!s&&Sl(t,n);return new Ey(r,s,n,i!=="day"?i:void 0)}function wy(t,e,n){return n==null?[void 0,void 0]:n/t<e?[e*t,e]:[n,void 0]}function Dy(t,e,n){let r=0;for(const s of e){const i=s[0].key,a=s[0].date,o=s[s.length-1].date;if(t>=a&&t<=o)return r;const l=n.get(i);if(l==null)return;r+=l}return r}function Ji(t,e,n){let r,s;if(e!=null)r=t.start*e,s=(n-t.end)*e;else{const i=1/n;r=vi(t.start*i),s=vi(1-t.end*i)}return{insetInlineStart:r,insetInlineEnd:s}}function xy(t,e,n,r,s){const i=n??e/r,a=Math.floor(t/i),o=s?r-a-1:a,l=a*i,c=l+i;return{col:o,left:l,right:c}}function Cy(t,e,n){let r=0,s=0,i=0;for(const a of e){const o=a[0].key;if(s=i,i=s+n.get(o),t<i)break;r++}return{row:r,top:s,bottom:i}}function Ty(t,e){return t.querySelectorAll("[role=row]")[e]}function Ry(t,e){return t.querySelectorAll("[role=gridcell]")[e]}const _l=60,Ny=J({weekday:"narrow"});function My(t,e,n){return t||Iy(e,n)}function Iy(t,e){return t?e>1?J({weekday:"short",weekdayJustify:"start",day:"numeric",omitCommas:!0,omitTrailing:!0}):J({weekday:"long",weekdayJustify:"start",day:"numeric",omitCommas:!0,omitTrailing:!0}):J({weekday:"short"})}class ky extends S.Component{constructor(){super(...arguments),this.rootElRef=S.createRef()}render(){const{props:e}=this;return d.jsx("div",{className:O(e.className,y.abs),style:e.style,ref:this.rootElRef,children:e.children})}componentDidMount(){this._isUnmounting=!1;const e=this.rootElRef.current;this.disconnectHeight=ar(e,n=>{this._isUnmounting||G(this.props.heightRef,n)})}componentWillUnmount(){this._isUnmounting=!0,this.disconnectHeight(),G(this.props.heightRef,null)}}const Py=J({week:"narrow"});class jy extends ee{constructor(){super(...arguments),this.headerHeightRefMap=new xt(()=>{$t(this.handleSegPositioning)}),this.mainHeightRefMap=new xt(()=>{(this.props.dayMaxEvents===!0||this.props.dayMaxEventRows===!0)&&$t(this.handleSegPositioning)}),this.segHeightRefMap=new xt(()=>{$t(this.handleSegPositioning)}),this.buildWeekNumberRenderProps=B(Hy),this.handleRootEl=e=>{this.rootEl=e,G(this.props.rootElRef,e)},this.handleSegPositioning=()=>{this._isUnmounting||this.forceUpdate()}}render(){const{props:e,context:n,headerHeightRefMap:r,mainHeightRefMap:s}=this,{cells:i}=e,{options:a}=n,o=e.cells[0].date,l=e.dayMaxEvents===!0||e.dayMaxEventRows===!0,c=mm(e.fgEventSegs,a.eventOrder),[u,f]=this.computeFgDims(),[h,g,v,m,E]=vy(c,this.segHeightRefMap.current,i,l?f:void 0,a.eventOrderStrict,a.eventSlicing,e.dayMaxEvents,e.dayMaxEventRows),C=[];if(u!=null){let N=0;for(const P of i){const H=r.current.get(P.key);if(H!=null){const U=u-H;C.push(E[N]+U)}else C.push(void 0);N++}}const R=this.getHighlightSegs(),x=this.getMirrorSegs(),T=a.navLinks,M=sr(n,o,"week"),D=this.buildWeekNumberRenderProps(o,n,e.cellIsNarrow,T);return d.jsxs("div",{role:e.role,"aria-label":e.role==="row"?M:void 0,className:O(a.dayRowClass,e.className,y.flexRow,y.rel,y.isolate,e.forPrint&&e.basis!==void 0&&y.printSiblingRow),style:{flexBasis:e.basis},ref:this.handleRootEl,children:[e.showWeekNumbers&&!e.cellIsMicro&&d.jsx(me,{tag:"div",attrs:{...T?js(n,o,"week",M,!1):{},role:void 0,"aria-hidden":!0},className:y.z1,renderProps:D,generatorName:"inlineWeekNumberContent",customGenerator:a.inlineWeekNumberContent,defaultGenerator:vl,classNameGenerator:a.inlineWeekNumberClass,didMount:a.inlineWeekNumberDidMount,willUnmount:a.inlineWeekNumberWillUnmount}),this.renderFillSegs(e.businessHourSegs,"non-business"),this.renderFillSegs(e.bgEventSegs,"bg-event"),this.renderFillSegs(R,"highlight"),e.cells.map((N,P)=>{const H=this.renderFgSegs(u,v[P],m,e.todayRange,!1);return d.jsx(hy,{dateProfile:e.dateProfile,todayRange:e.todayRange,date:N.date,isMajor:N.isMajor,showDayNumber:e.showDayNumbers,isNarrow:e.cellIsNarrow,isMicro:e.cellIsMicro,borderStart:!!P,segs:h[P],hiddenSegs:g[P],fgLiquidHeight:l,fg:d.jsx(d.Fragment,{children:H}),eventDrag:e.eventDrag,eventResize:e.eventResize,eventSelection:e.eventSelection,renderProps:N.renderProps,dateSpanProps:N.dateSpanProps,attrs:N.attrs,className:N.className,fgHeight:C[P],width:e.colWidth,headerHeightRef:r.createRef(N.key),mainHeightRef:s.createRef(N.key)},N.key)}),this.renderFgSegs(u,x,m,e.todayRange,!0)]})}renderFgSegs(e,n,r,s,i){const{props:a,segHeightRefMap:o}=this,{colWidth:l,eventSelection:c,cellIsMicro:u}=a,f=a.cells.length,h=a.cells.length===1,g=[];for(const v of n){const m=Je(v),{standinFor:E,eventRange:C}=v,{instanceId:R}=C.instance;if(E)continue;const{insetInlineStart:x,insetInlineEnd:T}=Ji(v,l,f),M=r.get(E?Je(E):m)??(i?0:void 0),D=e!=null&&M!=null?e+M:void 0,N=!!(a.eventDrag&&a.eventDrag.affectedInstances[R]),P=!!(a.eventResize&&a.eventResize.affectedInstances[R]),H=!i&&(N||P||E||D==null),U=Ll(v),te=R===c;g.push(d.jsx(ky,{className:v.start?y.fakeBorderS:"",style:{visibility:H?"hidden":void 0,top:D,insetInlineStart:x,insetInlineEnd:T,zIndex:te?1e3:0},heightRef:!E&&!i?o.createRef(m):null,children:d.jsx(Os,{display:U?"list-item":"row",eventRange:C,isStart:v.isStart,isEnd:v.isEnd,isDragging:N,isResizing:P,isMirror:i,isSelected:te,isNarrow:a.cellIsNarrow,defaultTimeFormat:Al,defaultDisplayEventEnd:h,disableResizing:U,forcedTimeText:u?"":void 0,...Ur(C,s)})},m))}return g}renderFillSegs(e,n){const{props:r,context:s}=this,{todayRange:i,colWidth:a}=r,o=r.cells.length,l=[];for(const c of e){const u=c.start+":"+c.end,{insetInlineStart:f,insetInlineEnd:h}=Ji(c,a,o),g=!c.standinFor;l.push(d.jsx("div",{className:y.fillY,style:{visibility:g?"":"hidden",insetInlineStart:f,insetInlineEnd:h},children:n==="bg-event"?d.jsx(ey,{eventRange:c.eventRange,isStart:c.isStart,isEnd:c.isEnd,isNarrow:r.cellIsNarrow,isVertical:!1,...Ur(c.eventRange,i)}):ny(n,s.options)},u))}return d.jsx(d.Fragment,{children:l})}componentDidMount(){this._isUnmounting=!1;const{rootEl:e}=this;this.disconnectHeight=ar(e,n=>{G(this.props.heightRef,n)})}componentWillUnmount(){this._isUnmounting=!0,this.disconnectHeight(),G(this.props.heightRef,null)}computeFgDims(){const{cells:e}=this.props,n=this.headerHeightRefMap.current,r=this.mainHeightRefMap.current;let s,i;for(const a of e){const o=n.get(a.key),l=r.get(a.key);if(o!=null&&((s===void 0||o>s)&&(s=o),l!=null)){const c=o+l;(i===void 0||c<i)&&(i=c)}}return[s,i!=null&&s!=null?i-s:void 0]}getMirrorSegs(){let{props:e}=this;return e.eventResize&&e.eventResize.segs.length?e.eventResize.segs:[]}getHighlightSegs(){let{props:e}=this;return e.eventDrag&&e.eventDrag.segs.length?e.eventDrag.segs:e.eventResize&&e.eventResize.segs.length?e.eventResize.segs:e.dateSelectionSegs}}function Hy(t,e,n,r){const{dateEnv:s,options:i}=e,a=s.computeWeekNumber(t),o=s.formatToParts(t,i.weekNumberFormat||Py),l=ye(o),c=s.toDate(t);return{num:a,text:l,textParts:o,date:c,isNarrow:n,hasNavLink:r}}class Ul extends or{constructor(){super(...arguments),this.splitBusinessHourSegs=B(Cn),this.splitBgEventSegs=B(Ay),this.splitFgEventSegs=B(Cn),this.splitDateSelectionSegs=B(Cn),this.splitEventDrag=B(Yi),this.splitEventResize=B(Yi),this.rowHeightRefMap=new xt((e,n)=>{const{rowHeightRefMap:r}=this.props;r&&r.handleValue(e,n)}),this.handleRootEl=e=>{this.rootEl=e,e?this.context.registerInteractiveComponent(this,{el:e,isHitComboAllowed:this.props.isHitComboAllowed}):this.context.unregisterInteractiveComponent(this)}}render(){let{props:e,context:n,rowHeightRefMap:r}=this,{options:s}=n,{cellRows:i}=e,a=i.length,o=i[0]?.[0]?.key||"",l=this.splitFgEventSegs(e.fgEventSegs,a),c=this.splitBgEventSegs(e.bgEventSegs,a),u=this.splitBusinessHourSegs(e.businessHourSegs,a),f=this.splitDateSelectionSegs(e.dateSelectionSegs,a),h=this.splitEventDrag(e.eventDrag,a),g=this.splitEventResize(e.eventResize,a),v=Ye(s),m=!e.forPrint&&!v,E=Ly(e.visibleWidth,a,v,s);return d.jsx("div",{role:"rowgroup",className:O(e.className,!e.forPrint&&y.flexCol),style:{width:e.width},ref:this.handleRootEl,children:i.map((C,R)=>d.jsx(jy,{role:"row",dateProfile:e.dateProfile,todayRange:e.todayRange,cells:C,cellIsNarrow:e.cellIsNarrow,cellIsMicro:e.cellIsMicro,showDayNumbers:a>1,showWeekNumbers:a>1&&s.weekNumbers,forPrint:e.forPrint,className:O(m&&y.grow,a>1&&y.breakInsideAvoid,R<a-1?y.borderOnlyB:y.borderNone),fgEventSegs:l[R],bgEventSegs:c[R],businessHourSegs:u[R],dateSelectionSegs:f[R],eventSelection:e.eventSelection,eventDrag:h[R],eventResize:g[R],dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,colWidth:e.colWidth,basis:E,heightRef:r.createRef(C[0].key)},o+":"+C[0].key))})}queryHit(e,n,r,s){const{props:i}=this,a=i.cellRows[0].length,{col:o,left:l,right:c}=xy(n,s,i.colWidth,a,e),{row:u,top:f,bottom:h}=Cy(r,i.cellRows,this.rowHeightRefMap.current),g=i.cellRows[u][o],v=g.date,m=fe(v,1);return{dateProfile:i.dateProfile,dateSpan:{range:{start:v,end:m},allDay:!0,...g.dateSpanProps},getDayEl:()=>Ry(Ty(this.rootEl,u),o),rect:{left:l,right:c,top:f,bottom:h},layer:0}}}function Oy(t){return t.eventRange.def.allDay}function Ay(t,e){return Cn(t.filter(Oy),e)}function Ly(t,e,n,r){if(t!=null){const s=t/r.aspectRatio/6;return e>6||n?s:0}return 0}class _y extends ee{constructor(){super(...arguments),this.state={},this.buildDayHeaderText=B(Uy),this.handleInnerEl=e=>{this.disconnectSize&&(this.disconnectSize(),this.disconnectSize=void 0),e?this.disconnectSize=ir(e,(n,r)=>{this._isUnmounting||(G(this.props.innerHeightRef,r),this.setState({innerWidth:n}))}):G(this.props.innerHeightRef,null)}}render(){const{props:e,state:n,context:r}=this,{renderConfig:s,dataConfig:i}=e,a=e.colWidth!=null?e.colWidth*(i.colSpan||1):void 0,o=i.renderProps.isDisabled,l=s.dayHeaderFormat?this.buildDayHeaderRenderProps(i.renderProps,e.cellIsNarrow,e.rowLevel,e.cellIsMicro,i.dateMarker,s.dayHeaderFormat,!!s.datesRepDistinctDays,r.dateEnv):{...i.renderProps,isNarrow:e.cellIsNarrow,level:e.rowLevel},c=s.align,u=typeof c=="function"?c({level:e.rowLevel,inPopover:i.renderProps.inPopover,isNarrow:e.cellIsNarrow}):c,f=s.sticky,h=e.rowLevel>0&&f!==!1&&(u!=="center"||a!=null&&e.viewportWidth!=null&&a>e.viewportWidth*.75);let g;return h&&(u==="center"?n.innerWidth!=null&&(g=`calc(50% - ${n.innerWidth/2}px)`):g=typeof f=="number"||typeof f=="string"?f:0),d.jsx(me,{tag:"div",attrs:{role:"columnheader","aria-colspan":i.colSpan,...i.attrs},className:O(i.className,y.noMargin,y.noPadding,y.flexCol,e.borderStart?y.borderOnlyS:y.borderNone,u==="center"?y.alignCenter:u==="end"?y.alignEnd:y.alignStart,e.colWidth==null&&y.liquid,!h&&y.crop),style:{width:a},renderProps:l,generatorName:s.generatorName,customGenerator:s.customGenerator,defaultGenerator:vl,classNameGenerator:o?void 0:s.classNameGenerator,didMount:s.didMount,willUnmount:s.willUnmount,children:v=>d.jsx("div",{ref:this.handleInnerEl,className:O(y.flexCol,y.noShrink,y.whiteSpaceNoWrap,h&&y.sticky),style:{left:g,right:g},children:d.jsx(v,{tag:"div",attrs:i.innerAttrs,className:k(s.innerClassNameGenerator,l)})})})}componentDidMount(){this._isUnmounting=!1}componentWillUnmount(){this._isUnmounting=!0}buildDayHeaderRenderProps(e,n,r,s,i,a,o,l){const c=this.buildDayHeaderText(o?i:e.date,a,o,l),u=s?this.buildDayHeaderText(i,Ny,!1,l):c;return{...e,isNarrow:n,level:r,text:u.text,textParts:u.textParts,weekdayText:s?u.text:c.weekdayText,dayNumberText:c.dayNumberText}}}function Uy(t,e,n,r){const s=r.formatToParts(t,e);return{text:ye(s),textParts:s,weekdayText:Ln(s),dayNumberText:n?_n(s):""}}class Fy extends ee{constructor(){super(...arguments),this.innerHeightRefMap=new xt(()=>{$t(this.handleInnerHeights)}),this.handleInnerHeights=()=>{if(this._isUnmounting)return;const e=this.innerHeightRefMap.current;let n=0;for(const r of e.values())n=Math.max(n,r);this.currentInnerHeight!==n&&(this.currentInnerHeight=n,G(this.props.innerHeightRef,n))}}render(){const{props:e,context:n}=this,{options:r}=n;return d.jsx("div",{role:e.role,"aria-rowindex":e.rowIndex!=null?1+e.rowIndex:void 0,className:O(r.dayHeaderRowClass,e.className,y.flexRow,y.contentBox,e.borderBottom?y.borderOnlyB:y.borderNone),style:{height:e.height},children:e.dataConfigs.map((s,i)=>d.jsx(_y,{renderConfig:e.renderConfig,dataConfig:s,borderStart:!!i,colWidth:e.colWidth,viewportWidth:e.viewportWidth,innerHeightRef:this.innerHeightRefMap.createRef(s.key),cellIsNarrow:e.cellIsNarrow,cellIsMicro:e.cellIsMicro,rowLevel:e.rowLevel},s.key))})}componentDidMount(){this._isUnmounting=!1}componentWillUnmount(){this._isUnmounting=!0,this.currentInnerHeight=void 0,G(this.props.innerHeightRef,null)}}class Fl extends ee{render(){const{props:e}=this,{headerTiers:n}=e;return d.jsx("div",{role:"rowgroup",className:O(e.className,y.flexCol,e.width==null&&y.liquid),style:{width:e.width},children:n.map((r,s)=>S.createElement(Fy,{...r,key:s,role:"row",borderBottom:s<n.length-1,colWidth:e.colWidth,viewportWidth:e.viewportWidth,cellIsNarrow:e.cellIsNarrow,cellIsMicro:e.cellIsMicro,rowLevel:n.length-s-1}))})}}class By extends ee{constructor(){super(...arguments),this.state={},this.handleScroller=e=>{G(this.props.scrollerRef,e)},this.handleTotalWidth=e=>{this._isUnmounting||this.setState({totalWidth:e})},this.handleClientWidth=e=>{this._isUnmounting||this.setState({clientWidth:e})}}render(){const{props:e,state:n,context:r}=this,{options:s}=r,{borderlessX:i,borderlessTop:a,borderlessBottom:o}=Ot(s),{totalWidth:l,clientWidth:c}=n;let u=l!=null&&c!=null?l-c:void 0;u<3&&(u=0);const f=!e.forPrint&&!Ye(s),h=!e.forPrint&&yl(s),g=e.cellRows[0].length,v=c!=null?c/g:void 0,m=v!=null&&v<=_l,E=m||v!=null&&v<=s.dayNarrowWidth;return d.jsxs(d.Fragment,{children:[s.dayHeaders&&d.jsxs("div",{className:O(k(s.tableHeaderClass,{isSticky:h,borderlessX:i,borderlessTop:a,borderlessBottom:o,multiMonthColumns:0}),y.printHeader,h&&y.tableHeaderSticky),children:[d.jsxs("div",{className:y.flexRow,children:[d.jsx(Fl,{headerTiers:e.headerTiers,cellIsNarrow:E,cellIsMicro:m}),!!u&&d.jsx("div",{className:O(k(s.fillerClass,{inTableHeader:!0}),y.borderOnlyS),style:{minWidth:u}})]}),d.jsx("div",{className:k(s.dayHeaderDividerClass,{isSticky:h,multiMonthColumns:0,options:{allDaySlot:!!s.allDaySlot}})})]}),d.jsx(Un,{vertical:f,className:O(k(s.tableBodyClass,{borderlessX:i,borderlessTop:a,borderlessBottom:o,multiMonthColumns:0}),!e.forPrint&&y.flexCol,f&&y.liquid),ref:this.handleScroller,clientWidthRef:this.handleClientWidth,children:d.jsx(Ul,{dateProfile:e.dateProfile,todayRange:e.todayRange,cellRows:e.cellRows,forPrint:e.forPrint,isHitComboAllowed:e.isHitComboAllowed,className:y.grow,dayMaxEvents:e.forPrint?void 0:s.dayMaxEvents,dayMaxEventRows:s.dayMaxEventRows,fgEventSegs:e.fgEventSegs,bgEventSegs:e.bgEventSegs,businessHourSegs:e.businessHourSegs,dateSelectionSegs:e.dateSelectionSegs,eventDrag:e.eventDrag,eventResize:e.eventResize,eventSelection:e.eventSelection,visibleWidth:l,cellIsNarrow:E,cellIsMicro:m,rowHeightRefMap:e.rowHeightRefMap})}),d.jsx(Ol,{widthRef:this.handleTotalWidth})]})}componentDidMount(){this._isUnmounting=!1}componentWillUnmount(){this._isUnmounting=!0}}class Wy extends ee{constructor(){super(...arguments),this.rootElRef=S.createRef()}render(){const{props:e}=this;return d.jsx("div",{ref:this.rootElRef,className:O(y.footerScrollbar,e.isSticky&&y.footerScrollbarSticky),children:d.jsx(Un,{horizontal:!0,ref:e.scrollerRef,children:d.jsx("div",{style:{minWidth:e.canvasWidth}})})})}componentDidMount(){this._isUnmounting=!1,this.disconnectHeight=ar(this.rootElRef.current,e=>{this._isUnmounting||G(this.props.scrollbarWidthRef,e)})}componentWillUnmount(){this._isUnmounting=!0,this.disconnectHeight(),G(this.props.scrollbarWidthRef,null)}}class Vy extends ee{constructor(){super(...arguments),this.state={},this.headerScrollerRef=S.createRef(),this.bodyScrollerRef=S.createRef(),this.footerScrollerRef=S.createRef(),this.handleTotalWidth=e=>{this._isUnmounting||this.setState({totalWidth:e})},this.handleClientWidth=e=>{this._isUnmounting||this.setState({clientWidth:e})}}render(){const{props:e,state:n,context:r}=this,{options:s}=r,{borderlessX:i,borderlessTop:a,borderlessBottom:o}=Ot(s),{totalWidth:l,clientWidth:c}=n,u=l!=null&&c!=null?l-c:void 0,f=!e.forPrint&&!Ye(s),h=!e.forPrint&&yl(s),g=!e.forPrint&&pp(s),v=e.cellRows[0].length,[m,E]=wy(v,e.dayMinWidth,c),C=E!=null&&E<=_l,R=C||E!=null&&E<=s.dayNarrowWidth;return d.jsxs(d.Fragment,{children:[s.dayHeaders&&d.jsxs("div",{className:O(k(s.tableHeaderClass,{isSticky:h,borderlessX:i,borderlessTop:a,borderlessBottom:o,multiMonthColumns:0}),y.printHeader,h&&y.tableHeaderSticky),children:[d.jsxs(Un,{horizontal:!0,hideScrollbars:!0,className:y.flexRow,ref:this.headerScrollerRef,children:[d.jsx(Fl,{headerTiers:e.headerTiers,colWidth:E,viewportWidth:c,width:m,cellIsNarrow:R,cellIsMicro:C}),!!u&&d.jsx("div",{className:O(k(s.fillerClass,{inTableHeader:!0}),y.borderOnlyS),style:{minWidth:u}})]}),d.jsx("div",{className:k(s.dayHeaderDividerClass,{isSticky:h,multiMonthColumns:0,options:{allDaySlot:!!s.allDaySlot}})})]}),d.jsx(Un,{vertical:f,horizontal:!0,hideScrollbars:g||e.forPrint,className:O(k(s.tableBodyClass,{borderlessX:i,borderlessTop:a,borderlessBottom:o,multiMonthColumns:0}),!e.forPrint&&y.flexCol,f&&y.liquid),ref:this.bodyScrollerRef,clientWidthRef:this.handleClientWidth,children:d.jsx(Ul,{dateProfile:e.dateProfile,todayRange:e.todayRange,cellRows:e.cellRows,forPrint:e.forPrint,isHitComboAllowed:e.isHitComboAllowed,className:y.grow,dayMaxEvents:e.forPrint?void 0:s.dayMaxEvents,dayMaxEventRows:s.dayMaxEventRows,fgEventSegs:e.fgEventSegs,bgEventSegs:e.bgEventSegs,businessHourSegs:e.businessHourSegs,dateSelectionSegs:e.dateSelectionSegs,eventDrag:e.eventDrag,eventResize:e.eventResize,eventSelection:e.eventSelection,colWidth:E,width:m,visibleWidth:l,cellIsNarrow:R,cellIsMicro:C,rowHeightRefMap:e.rowHeightRefMap})}),!!g&&d.jsx(Wy,{isSticky:!0,canvasWidth:m,scrollerRef:this.footerScrollerRef}),d.jsx(Ol,{widthRef:this.handleTotalWidth})]})}componentDidMount(){this._isUnmounting=!1;const e=vp(this.context.pluginHooks);this.syncedScroller=new e(!0),G(this.props.scrollerRef,this.syncedScroller),this.updateSyncedScroller()}componentDidUpdate(){this.updateSyncedScroller()}componentWillUnmount(){this._isUnmounting=!0,this.syncedScroller.destroy()}updateSyncedScroller(){this.syncedScroller.handleChildren([this.headerScrollerRef.current,this.bodyScrollerRef.current,this.footerScrollerRef.current])}}class zy extends ee{constructor(){super(...arguments),this.scrollerRef=S.createRef(),this.rowHeightRefMap=new xt(()=>{$t(this.updateScrollY)}),this.scrollDate=null,this.updateScrollY=()=>{if(this._isUnmounting)return;const e=this.rowHeightRefMap.current,n=this.scrollerRef.current;if(n&&this.scrollDate){let r=Dy(this.scrollDate,this.props.cellRows,e);r!=null&&(r&&r++,n.scrollTo({y:r}))}},this.handleScrollEnd=e=>{e&&(this.scrollDate=null)}}render(){const{props:e,context:n}=this,{options:r}=n,{borderlessX:s,borderlessTop:i,borderlessBottom:a}=Ot(r),o=e.forPrint?[]:e.businessHourSegs,l=e.forPrint?[]:e.dateSelectionSegs,c=e.forPrint?null:e.eventDrag,u=e.forPrint?null:e.eventResize,f={...e,businessHourSegs:o,dateSelectionSegs:l,eventDrag:c,eventResize:u,scrollerRef:this.scrollerRef,rowHeightRefMap:this.rowHeightRefMap};return d.jsx(Iv,{viewSpec:n.viewSpec,attrs:{role:"grid","aria-rowcount":e.headerTiers.length+e.cellRows.length,"aria-colcount":e.cellRows[0].length,"aria-labelledby":e.labelId,"aria-label":e.labelStr},className:O(e.className,y.printRoot,k(r.tableClass,{borderlessX:s,borderlessTop:i,borderlessBottom:a,multiMonthColumns:0})),children:r.dayMinWidth?d.jsx(Vy,{...f,dayMinWidth:r.dayMinWidth}):d.jsx(By,{...f})})}componentDidMount(){this._isUnmounting=!1,this.resetScroll(),this.scrollerRef.current.addScrollEndListener(this.handleScrollEnd)}componentDidUpdate(e){e.dateProfile!==this.props.dateProfile&&this.context.options.scrollTimeReset&&this.resetScroll()}componentWillUnmount(){this._isUnmounting=!0,this.scrollerRef.current.removeScrollEndListener(this.handleScrollEnd)}resetScroll(){this.scrollDate=this.props.dateProfile.currentDate,this.updateScrollY(),this.scrollerRef.current.scrollTo({x:0})}}class $y extends El{buildRenderRange(e,n,r){let s=super.buildRenderRange(e,n,r),{props:i}=this;return Yy({currentRange:s,snapToWeek:/^(year|month)$/.test(n),fixedWeekCount:i.fixedWeekCount,dateEnv:i.dateEnv})}}function Yy(t){let{dateEnv:e,currentRange:n}=t,{start:r,end:s}=n,i;if(t.snapToWeek&&(r=e.startOfWeek(r),i=e.startOfWeek(s),i.valueOf()!==s.valueOf()&&(s=fi(i,1))),t.fixedWeekCount){let a=e.startOfWeek(e.startOfMonth(fe(n.end,-1))),o=Math.ceil(zh(a,s));s=fi(s,6-o)}return{start:r,end:s}}class Gy extends ee{constructor(){super(...arguments),this.buildDayTableModel=B(Sy),this.buildDateRowConfigs=B(Xv),this.createDayHeaderFormatter=B(My),this.slicer=new Zv}render(){const{props:e,context:n}=this,{dateProfile:r}=e,{options:s,dateEnv:i}=n,a=this.buildDayTableModel(r,n.dateProfileGenerator,i),o=a.rowCount===1,l=this.createDayHeaderFormatter(n.options.dayHeaderFormat,o,a.colCount),c=this.slicer.sliceProps(e,r,s.nextDayThreshold,n,a);return d.jsx(Rl,{unit:"day",children:(u,f)=>{const h=this.buildDateRowConfigs(a.headerDates,o,r,f,l,n);return d.jsx(zy,{labelId:e.labelId,labelStr:e.labelStr,dateProfile:r,todayRange:f,cellRows:a.cellRows,forPrint:e.forPrint,className:e.className,headerTiers:h,fgEventSegs:c.fgEventSegs,bgEventSegs:c.bgEventSegs,businessHourSegs:c.businessHourSegs,dateSelectionSegs:c.dateSelectionSegs,eventDrag:c.eventDrag,eventResize:c.eventResize,eventSelection:c.eventSelection})}})}}var Zy={name:"daygrid",initialView:"dayGridMonth",views:{dayGrid:{component:Gy,dateProfileGeneratorClass:$y},dayGridDay:{type:"dayGrid",duration:{days:1}},dayGridWeek:{type:"dayGrid",duration:{weeks:1}},dayGridMonth:{type:"dayGrid",duration:{months:1},fixedWeekCount:!0},dayGridYear:{type:"dayGrid",duration:{years:1}}}};class qy{constructor(e,n){this.emitter=new on}destroy(){}setMirrorIsVisible(e){}setMirrorNeedsRevert(e){}setAutoScrollEnabled(e){}}const Bl={};function Wl(t,e,n){let{instances:r}=t.mutatedEvents;for(let s in r)if(!er(e.validRange,r[s].range))return!1;return Vl({eventDrag:t},n)}function Xy(t,e,n){return er(e.validRange,t.range)?Vl({dateSelection:t},n):!1}function Vl(t,e){let n=e.getCurrentData(),r={businessHours:n.businessHours,dateSelection:"",eventStore:n.eventStore,eventUiBases:n.eventUiBases,eventSelection:"",eventDrag:null,eventResize:null,...t};return(e.pluginHooks.isPropsValid||Ky)(r,e)}function Ky(t,e,n={},r){return!(t.eventDrag&&!Qy(t,e,n,r)||t.dateSelection&&!Jy(t,e,n,r))}function Qy(t,e,n,r){let s=e.getCurrentData(),i=t.eventDrag,a=i.mutatedEvents,o=a.defs,l=a.instances,c=An(o,i.isEvent?t.eventUiBases:{"":s.selectionConfig});r&&(c=ct(c,r));let u=Dp(t.eventStore,i.affectedEvents.instances),f=u.defs,h=u.instances,g=An(f,t.eventUiBases);for(let v in l){let m=l[v],E=m.range,C=c[m.defId],R=o[m.defId];if(!zl(C.constraints,E,u,t.businessHours,e))return!1;let{eventOverlap:x}=e.options,T=typeof x=="function"?x:null;for(let D in h){let N=h[D];if(vs(E,N.range)&&(g[N.defId].overlap===!1&&i.isEvent||C.overlap===!1||T&&!T(new K(e,f[N.defId],N),new K(e,R,m))))return!1}let M=s.eventStore;for(let D of C.allows){let N={...n,range:m.range,allDay:R.allDay},P=M.defs[R.defId],H=M.instances[v],U;if(P?U=new K(e,P,H):U=new K(e,R),!D(Ns(N,e),U))return!1}}return!0}function Jy(t,e,n,r){let s=t.eventStore,i=s.defs,a=s.instances,o=t.dateSelection,l=o.range,{selectionConfig:c}=e.getCurrentData();if(r&&(c=r(c)),!zl(c.constraints,l,s,t.businessHours,e))return!1;let{selectOverlap:u}=e.options,f=typeof u=="function"?u:null;for(let h in a){let g=a[h];if(vs(l,g.range)&&(c.overlap===!1||f&&!f(new K(e,i[g.defId],g),null)))return!1}for(let h of c.allows){let g={...n,...o};if(!h(Ns(g,e),null))return!1}return!0}function zl(t,e,n,r,s){for(let i of t)if(!tb(eb(i,e,n,r,s),e))return!1;return!0}function eb(t,e,n,r,s){return t==="businessHours"?Rr(ot(r,e,s)):typeof t=="string"?Rr(rr(n,i=>i.groupId===t)):typeof t=="object"&&t?Rr(ot(t,e,s)):[]}function Rr(t){let{instances:e}=t,n=[];for(let r in e)n.push(e[r].range);return n}function tb(t,e){for(let n of t)if(er(n,e))return!0;return!1}Bl.touchMouseIgnoreWait=500;let Gr=0,Fn=0,Zr=!1;class $l{constructor(e){this.subjectEl=null,this.selector="",this.handleSelector="",this.shouldIgnoreMove=!1,this.shouldWatchScroll=!0,this.isDragging=!1,this.isTouchDragging=!1,this.wasTouchScroll=!1,this.handleMouseDown=n=>{if(!this.shouldIgnoreMouse()&&nb(n)&&this.tryStart(n)){let r=this.createEventFromMouse(n,!0);this.emitter.trigger("pointerdown",r),this.initScrollWatch(r),this.shouldIgnoreMove||document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}},this.handleMouseMove=n=>{let r=this.createEventFromMouse(n);this.recordCoords(r),this.emitter.trigger("pointermove",r)},this.handleMouseUp=n=>{document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.emitter.trigger("pointerup",this.createEventFromMouse(n)),this.cleanup()},this.handleTouchStart=n=>{if(this.tryStart(n)){this.isTouchDragging=!0;let r=this.createEventFromTouch(n,!0);this.emitter.trigger("pointerdown",r),this.initScrollWatch(r);let s=n.target;this.shouldIgnoreMove||s.addEventListener("touchmove",this.handleTouchMove),s.addEventListener("touchend",this.handleTouchEnd),s.addEventListener("touchcancel",this.handleTouchEnd),window.addEventListener("scroll",this.handleTouchScroll,!0)}},this.handleTouchMove=n=>{if(this.isDragging){let r=this.createEventFromTouch(n);this.recordCoords(r),this.emitter.trigger("pointermove",r)}},this.handleTouchEnd=n=>{if(this.isDragging){let r=n.target;r.removeEventListener("touchmove",this.handleTouchMove),r.removeEventListener("touchend",this.handleTouchEnd),r.removeEventListener("touchcancel",this.handleTouchEnd),window.removeEventListener("scroll",this.handleTouchScroll,!0),this.emitter.trigger("pointerup",this.createEventFromTouch(n)),this.cleanup(),this.isTouchDragging=!1,rb()}},this.handleTouchScroll=()=>{this.wasTouchScroll=!0},this.handleScroll=n=>{if(!this.shouldIgnoreMove){let r=window.scrollX-this.prevScrollX+this.prevPageX,s=window.scrollY-this.prevScrollY+this.prevPageY;this.emitter.trigger("pointermove",{origEvent:n,isTouch:this.isTouchDragging,subjectEl:this.subjectEl,pageX:r,pageY:s,deltaX:r-this.origPageX,deltaY:s-this.origPageY})}},this.containerEl=e,this.emitter=new on,e.addEventListener("mousedown",this.handleMouseDown),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),sb()}destroy(){this.containerEl.removeEventListener("mousedown",this.handleMouseDown),this.containerEl.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),ib()}cancel(){this.isDragging&&this.cleanup()}tryStart(e){let n=this.querySubjectEl(e),r=e.target;return n&&(!this.handleSelector||r.closest(this.handleSelector))?(this.subjectEl=n,this.isDragging=!0,this.wasTouchScroll=!1,!0):!1}cleanup(){Zr=!1,this.isDragging=!1,this.subjectEl=null,this.destroyScrollWatch()}querySubjectEl(e){return this.selector?e.target.closest(this.selector):this.containerEl}shouldIgnoreMouse(){return Gr||this.isTouchDragging}cancelTouchScroll(){this.isDragging&&(Zr=!0)}initScrollWatch(e){this.shouldWatchScroll&&(this.recordCoords(e),window.addEventListener("scroll",this.handleScroll,!0))}recordCoords(e){this.shouldWatchScroll&&(this.prevPageX=e.pageX,this.prevPageY=e.pageY,this.prevScrollX=window.scrollX,this.prevScrollY=window.scrollY)}destroyScrollWatch(){this.shouldWatchScroll&&window.removeEventListener("scroll",this.handleScroll,!0)}createEventFromMouse(e,n){let r=0,s=0;return n?(this.origPageX=e.pageX,this.origPageY=e.pageY):(r=e.pageX-this.origPageX,s=e.pageY-this.origPageY),{origEvent:e,isTouch:!1,subjectEl:this.subjectEl,pageX:e.pageX,pageY:e.pageY,deltaX:r,deltaY:s}}createEventFromTouch(e,n){let r=e.touches,s,i,a=0,o=0;return r&&r.length?(s=r[0].pageX,i=r[0].pageY):(s=e.pageX,i=e.pageY),n?(this.origPageX=s,this.origPageY=i):(a=s-this.origPageX,o=i-this.origPageY),{origEvent:e,isTouch:!0,subjectEl:this.subjectEl,pageX:s,pageY:i,deltaX:a,deltaY:o}}}function nb(t){return t.button===0&&!t.ctrlKey}function rb(){Gr+=1,setTimeout(()=>{Gr-=1},Bl.touchMouseIgnoreWait)}function sb(){Fn+=1,Fn===1&&window.addEventListener("touchmove",Yl,{passive:!1})}function ib(){Fn-=1,Fn||window.removeEventListener("touchmove",Yl,{passive:!1})}function Yl(t){Zr&&t.preventDefault()}class ab{constructor(){this.isVisible=!1,this.sourceEl=null,this.mirrorEl=null,this.sourceElRect=null,this.parentNode=document.body,this.zIndex=9999,this.revertDuration=0,this.colorScheme=""}start(e,n,r){this.sourceEl=e,this.sourceElRect=this.sourceEl.getBoundingClientRect(),this.origScreenX=n-window.scrollX,this.origScreenY=r-window.scrollY,this.deltaX=0,this.deltaY=0,this.updateElPosition()}handleMove(e,n){this.deltaX=e-window.scrollX-this.origScreenX,this.deltaY=n-window.scrollY-this.origScreenY,this.updateElPosition()}setIsVisible(e){e?this.isVisible||(this.mirrorEl&&this.mirrorEl.style.setProperty("display","","important"),this.isVisible=e,this.updateElPosition()):this.isVisible&&(this.mirrorEl&&this.mirrorEl.style.setProperty("display","none","important"),this.isVisible=e)}stop(e,n){let r=()=>{this.cleanup(),n()};e&&this.mirrorEl&&this.isVisible&&this.revertDuration&&(this.deltaX||this.deltaY)?this.doRevertAnimation(r,this.revertDuration):setTimeout(r,0)}doRevertAnimation(e,n){let r=this.mirrorEl,s=this.sourceEl.getBoundingClientRect();r.style.transition="top "+n+"ms,left "+n+"ms",xn(r,{left:s.left,top:s.top}),kg(r,()=>{r.style.transition="",e()})}cleanup(){this.mirrorEl&&(this.mirrorEl.remove(),this.mirrorEl=null),this.sourceEl=null}updateElPosition(){this.sourceEl&&this.isVisible&&xn(this.getMirrorEl(),{left:this.sourceElRect.left+this.deltaX,top:this.sourceElRect.top+this.deltaY})}getMirrorEl(){let e=this.sourceElRect,n=this.mirrorEl;return n||(n=this.mirrorEl=this.sourceEl.cloneNode(!0),n.style.userSelect="none",n.style.webkitUserSelect="none",n.style.pointerEvents="none",this.colorScheme&&n.setAttribute("data-color-scheme",this.colorScheme),n.classList.add(y.borderBoxRoot),xn(n,{position:"fixed",zIndex:this.zIndex,visibility:"",width:e.right-e.left,height:e.bottom-e.top,right:"auto",bottom:"auto",margin:0}),this.parentNode.appendChild(n)),n}}class Ls{getMaxScrollTop(){return this.getScrollHeight()-this.getClientHeight()}getMaxScrollLeft(){return this.getScrollWidth()-this.getClientWidth()}canScrollVertically(){return this.getMaxScrollTop()>0}canScrollHorizontally(){return this.getMaxScrollLeft()>0}canScrollUp(){return this.getScrollTop()>0}canScrollDown(){return this.getScrollTop()<this.getMaxScrollTop()}canScrollLeft(){return this.getScrollLeft()>0}canScrollRight(){return this.getScrollLeft()<this.getMaxScrollLeft()}}class ob extends Ls{constructor(e){super(),this.el=e}getScrollTop(){return this.el.scrollTop}getScrollLeft(){return this.el.scrollLeft}setScrollTop(e){this.el.scrollTop=e}setScrollLeft(e){this.el.scrollLeft=e}getScrollWidth(){return this.el.scrollWidth}getScrollHeight(){return this.el.scrollHeight}getClientHeight(){return this.el.clientHeight}getClientWidth(){return this.el.clientWidth}}class lb extends Ls{getScrollTop(){return window.scrollY}getScrollLeft(){return window.scrollX}setScrollTop(e){window.scroll(window.scrollX,e)}setScrollLeft(e){window.scroll(e,window.scrollY)}getScrollWidth(){return document.documentElement.scrollWidth}getScrollHeight(){return document.documentElement.scrollHeight}getClientHeight(){return document.documentElement.clientHeight}getClientWidth(){return document.documentElement.clientWidth}}class Gl extends Ls{constructor(e,n){super(),this.handleScroll=()=>{this.scrollTop=this.scrollController.getScrollTop(),this.scrollLeft=this.scrollController.getScrollLeft(),this.handleScrollChange()},this.scrollController=e,this.doesListening=n,this.scrollTop=this.origScrollTop=e.getScrollTop(),this.scrollLeft=this.origScrollLeft=e.getScrollLeft(),this.scrollWidth=e.getScrollWidth(),this.scrollHeight=e.getScrollHeight(),this.clientWidth=e.getClientWidth(),this.clientHeight=e.getClientHeight(),this.clientRect=this.computeClientRect(),this.doesListening&&this.getEventTarget().addEventListener("scroll",this.handleScroll)}destroy(){this.doesListening&&this.getEventTarget().removeEventListener("scroll",this.handleScroll)}getScrollTop(){return this.scrollTop}getScrollLeft(){return this.scrollLeft}setScrollTop(e){this.scrollController.setScrollTop(e),this.doesListening||(this.scrollTop=Math.max(Math.min(e,this.getMaxScrollTop()),0),this.handleScrollChange())}setScrollLeft(e){this.scrollController.setScrollLeft(e),this.doesListening||(this.scrollLeft=Math.max(Math.min(e,this.getMaxScrollLeft()),0),this.handleScrollChange())}getClientWidth(){return this.clientWidth}getClientHeight(){return this.clientHeight}getScrollWidth(){return this.scrollWidth}getScrollHeight(){return this.scrollHeight}handleScrollChange(){}}class Zl extends Gl{constructor(e,n){super(new ob(e),n)}getEventTarget(){return this.scrollController.el}computeClientRect(){return zv(this.scrollController.el)}}class cb extends Gl{constructor(e){super(new lb,e)}getEventTarget(){return window}computeClientRect(){return{left:this.scrollLeft,right:this.scrollLeft+this.clientWidth,top:this.scrollTop,bottom:this.scrollTop+this.clientHeight}}handleScrollChange(){this.clientRect=this.computeClientRect()}}const ea=typeof performance=="function"?performance.now:Date.now;class db{constructor(){this.isEnabled=!0,this.scrollQuery=[window,`.${y.internalScroller}`],this.edgeThreshold=50,this.maxVelocity=300,this.pointerScreenX=null,this.pointerScreenY=null,this.isAnimating=!1,this.scrollCaches=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.animate=()=>{if(this.isAnimating){let e=this.computeBestEdge(this.pointerScreenX+window.scrollX,this.pointerScreenY+window.scrollY);if(e){let n=ea();this.handleSide(e,(n-this.msSinceRequest)/1e3),this.requestAnimation(n)}else this.isAnimating=!1}}}start(e,n,r){this.isEnabled&&(this.scrollCaches=this.buildCaches(r),this.pointerScreenX=null,this.pointerScreenY=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.handleMove(e,n))}handleMove(e,n){if(this.isEnabled){let r=e-window.scrollX,s=n-window.scrollY,i=this.pointerScreenY===null?0:s-this.pointerScreenY,a=this.pointerScreenX===null?0:r-this.pointerScreenX;i<0?this.everMovedUp=!0:i>0&&(this.everMovedDown=!0),a<0?this.everMovedLeft=!0:a>0&&(this.everMovedRight=!0),this.pointerScreenX=r,this.pointerScreenY=s,this.isAnimating||(this.isAnimating=!0,this.requestAnimation(ea()))}}stop(){if(this.isEnabled){this.isAnimating=!1;for(let e of this.scrollCaches)e.destroy();this.scrollCaches=null}}requestAnimation(e){this.msSinceRequest=e,requestAnimationFrame(this.animate)}handleSide(e,n){let{scrollCache:r}=e,{edgeThreshold:s}=this,i=s-e.distance,a=i*i/(s*s)*this.maxVelocity*n,o=1;switch(e.name){case"left":o=-1;case"right":r.setScrollLeft(r.getScrollLeft()+a*o);break;case"top":o=-1;case"bottom":r.setScrollTop(r.getScrollTop()+a*o);break}}computeBestEdge(e,n){let{edgeThreshold:r}=this,s=null,i=this.scrollCaches||[];for(let a of i){let o=a.clientRect,l=e-o.left,c=o.right-e,u=n-o.top,f=o.bottom-n;l>=0&&c>=0&&u>=0&&f>=0&&(u<=r&&this.everMovedUp&&a.canScrollUp()&&(!s||s.distance>u)&&(s={scrollCache:a,name:"top",distance:u}),f<=r&&this.everMovedDown&&a.canScrollDown()&&(!s||s.distance>f)&&(s={scrollCache:a,name:"bottom",distance:f}),l<=r&&this.everMovedLeft&&a.canScrollLeft()&&(!s||s.distance>l)&&(s={scrollCache:a,name:"left",distance:l}),c<=r&&this.everMovedRight&&a.canScrollRight()&&(!s||s.distance>c)&&(s={scrollCache:a,name:"right",distance:c}))}return s}buildCaches(e){return this.queryScrollEls(e).map(n=>n===window?new cb(!1):new Zl(n,!1))}queryScrollEls(e){let n=[];for(let r of this.scrollQuery)typeof r=="object"?n.push(r):n.push(...Array.prototype.slice.call(e.getRootNode().querySelectorAll(r)));return n}}class ln extends qy{constructor(e,n){super(e),this.containerEl=e,this.delay=null,this.minDistance=0,this.touchScrollAllowed=!0,this.mirrorNeedsRevert=!1,this.isInteracting=!1,this.isDragging=!1,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,this.delayTimeoutId=null,this.onPointerDown=s=>{this.isDragging||(this.isInteracting=!0,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,this.emitter.trigger("pointerdown",s),this.isInteracting&&(Pg(document.body),Hg(document.body),s.isTouch||s.origEvent.preventDefault(),this.mirror.setIsVisible(!1),this.mirror.start(s.subjectEl,s.pageX,s.pageY),this.startDelay(s),this.minDistance||this.handleDistanceSurpassed(s)))},this.onPointerMove=s=>{if(this.isInteracting){if(this.emitter.trigger("pointermove",s),!this.isDistanceSurpassed){let i=this.minDistance,a,{deltaX:o,deltaY:l}=s;a=o*o+l*l,a>=i*i&&this.handleDistanceSurpassed(s)}this.isDragging&&(s.origEvent.type!=="scroll"&&(this.mirror.handleMove(s.pageX,s.pageY),this.autoScroller.handleMove(s.pageX,s.pageY)),this.emitter.trigger("dragmove",s))}},this.onPointerUp=s=>{this.isInteracting&&(this.isInteracting=!1,jg(document.body),Og(document.body),this.emitter.trigger("pointerup",s),this.isDragging&&(this.autoScroller.stop(),this.tryStopDrag(s)),this.delayTimeoutId&&(clearTimeout(this.delayTimeoutId),this.delayTimeoutId=null))};let r=this.pointer=new $l(e);r.emitter.on("pointerdown",this.onPointerDown),r.emitter.on("pointermove",this.onPointerMove),r.emitter.on("pointerup",this.onPointerUp),n&&(r.selector=n),this.mirror=new ab,this.autoScroller=new db}destroy(){this.pointer.destroy(),this.onPointerUp({})}startDelay(e){typeof this.delay=="number"?this.delayTimeoutId=setTimeout(()=>{this.delayTimeoutId=null,this.handleDelayEnd(e)},this.delay):this.handleDelayEnd(e)}handleDelayEnd(e){this.isDelayEnded=!0,this.tryStartDrag(e)}handleDistanceSurpassed(e){this.isDistanceSurpassed=!0,this.tryStartDrag(e)}tryStartDrag(e){this.isDelayEnded&&this.isDistanceSurpassed&&(!this.pointer.wasTouchScroll||this.touchScrollAllowed)&&(this.isDragging=!0,this.mirrorNeedsRevert=!1,this.autoScroller.start(e.pageX,e.pageY,this.containerEl),this.emitter.trigger("dragstart",e),this.touchScrollAllowed===!1&&this.pointer.cancelTouchScroll())}tryStopDrag(e){this.mirror.stop(this.mirrorNeedsRevert,this.stopDrag.bind(this,e))}stopDrag(e){this.isDragging=!1,this.emitter.trigger("dragend",e)}cancel(){this.isInteracting&&(this.isInteracting=!1,this.pointer.cancel())}setMirrorIsVisible(e){this.mirror.setIsVisible(e)}setMirrorNeedsRevert(e){this.mirrorNeedsRevert=e}setAutoScrollEnabled(e){this.autoScroller.isEnabled=e}}class ub{constructor(e){this.el=e,this.origRect=As(e),this.isRtl=en(e),this.scrollCaches=jl(e).map(n=>new Zl(n,!0))}destroy(){for(let e of this.scrollCaches)e.destroy()}computeLeft(){let e=this.origRect.left;for(let n of this.scrollCaches)e+=n.origScrollLeft-n.getScrollLeft();return e}computeTop(){let e=this.origRect.top;for(let n of this.scrollCaches)e+=n.origScrollTop-n.getScrollTop();return e}isWithinClipping(e,n){let r={left:e,top:n};for(let s of this.scrollCaches)if(!fb(s.getEventTarget())&&!Uv(r,s.clientRect))return!1;return!0}}function fb(t){let e=t.tagName;return e==="HTML"||e==="BODY"}class lr{constructor(e,n){this.useSubjectCenter=!1,this.requireInitial=!0,this.disablePointCheck=!1,this.initialHit=null,this.movingHit=null,this.finalHit=null,this.handlePointerDown=r=>{let{dragging:s}=this;this.initialHit=null,this.movingHit=null,this.finalHit=null,this.prepareHits(),this.processFirstCoord(r),this.initialHit||!this.requireInitial?this.emitter.trigger("pointerdown",r):s.cancel()},this.handleDragStart=r=>{this.emitter.trigger("dragstart",r),this.handleMove(r,!0)},this.handleDragMove=r=>{this.emitter.trigger("dragmove",r),this.handleMove(r)},this.handlePointerUp=r=>{this.releaseHits(),this.emitter.trigger("pointerup",r)},this.handleDragEnd=r=>{this.movingHit&&this.emitter.trigger("hitupdate",null,!0,r),this.finalHit=this.movingHit,this.movingHit=null,this.emitter.trigger("dragend",r)},this.droppableStore=n,e.emitter.on("pointerdown",this.handlePointerDown),e.emitter.on("dragstart",this.handleDragStart),e.emitter.on("dragmove",this.handleDragMove),e.emitter.on("pointerup",this.handlePointerUp),e.emitter.on("dragend",this.handleDragEnd),this.dragging=e,this.emitter=new on}processFirstCoord(e){let n={left:e.pageX,top:e.pageY},r=n,s=e.subjectEl,i;s instanceof HTMLElement&&(i=As(s),r=Fv(r,i));let a=this.initialHit=this.queryHitForOffset(r.left,r.top);if(a){if(this.useSubjectCenter&&i){let o=Pl(i,a.rect);o&&(r=Bv(o))}this.coordAdjust=Wv(r,n)}else this.coordAdjust={left:0,top:0}}handleMove(e,n){let r=this.queryHitForOffset(e.pageX+this.coordAdjust.left,e.pageY+this.coordAdjust.top);(n||!cr(this.movingHit,r))&&(this.movingHit=r,this.emitter.trigger("hitupdate",r,!1,e))}prepareHits(){this.offsetTrackers=ct(this.droppableStore,e=>(e.component.prepareHits(),new ub(e.el)))}releaseHits(){let{offsetTrackers:e}=this;for(let n in e)e[n].destroy();this.offsetTrackers={}}queryHitForOffset(e,n){let{droppableStore:r,offsetTrackers:s}=this,i=null;for(let a in r){let o=r[a].component,l=s[a];if(l&&l.isWithinClipping(e,n)){let c=l.computeLeft(),u=l.computeTop(),f=e-c,h=n-u,{origRect:g}=l,v=g.right-g.left,m=g.bottom-g.top;if(f>=0&&f<v&&h>=0&&h<m){let E=o.queryHit(l.isRtl,f,h,v,m);E&&er(E.dateProfile.activeRange,E.dateSpan.range)&&(this.disablePointCheck||l.el.contains(l.el.getRootNode().elementFromPoint(f+c-window.scrollX,h+u-window.scrollY)))&&(!i||E.layer>i.layer)&&(E.componentId=a,E.context=o.context,E.rect.left+=c,E.rect.right+=c,E.rect.top+=u,E.rect.bottom+=u,i=E)}}}return i}}function cr(t,e){return!t&&!e?!0:!!t!=!!e?!1:om(t.dateSpan,e.dateSpan)}function ql(t,e){let n={};for(let r of e.pluginHooks.datePointTransforms)Object.assign(n,r(t,e));return Object.assign(n,hb(t,e.dateEnv)),n}function hb(t,e){return{date:e.toDate(t.range.start),dateStr:e.formatIso(t.range.start,{omitTime:t.allDay}),allDay:t.allDay}}class gb extends Lt{constructor(e){super(e),this.handlePointerDown=r=>{let{dragging:s}=this,i=r.origEvent.target;this.component.context.emitter.hasHandlers("dateClick")&&this.component.isValidDateDownEl(i)||s.cancel()},this.handleDragEnd=r=>{let{component:s}=this,{pointer:i}=this.dragging;if(!i.wasTouchScroll){let{initialHit:a,finalHit:o}=this.hitDragging;if(a&&o&&cr(a,o)){let{context:l}=s,c={...ql(a.dateSpan,l),dayEl:a.getDayEl(),jsEvent:r.origEvent,view:l.viewApi||l.calendarApi.view};l.emitter.trigger("dateClick",c)}}},this.dragging=new ln(e.el),this.dragging.autoScroller.isEnabled=!1;let n=this.hitDragging=new lr(this.dragging,Ps(e));n.emitter.on("pointerdown",this.handlePointerDown),n.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}}class mb extends Lt{constructor(e){super(e),this.dragSelection=null,this.handlePointerDown=a=>{let{component:o,dragging:l}=this,{options:c}=o.context;c.selectable&&o.isValidDateDownEl(a.origEvent.target)?l.delay=a.isTouch?pb(o):null:l.cancel()},this.handleDragStart=a=>{this.component.context.calendarApi.unselect(a)},this.handleHitUpdate=(a,o)=>{let{context:l}=this.component,c=null,u=!1;if(a){let f=this.hitDragging.initialHit;a.componentId===f.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(f,a)||(c=vb(f,a,l.pluginHooks.dateSelectionTransformers)),(!c||!Xy(c,a.dateProfile,l))&&(u=!0,c=null)}c?l.dispatch({type:"SELECT_DATES",selection:c}):o||l.dispatch({type:"UNSELECT_DATES"}),u?Es():Ss(),o||(this.dragSelection=c)},this.handlePointerUp=a=>{this.dragSelection?(nl(this.dragSelection,a,this.component.context),this.dragSelection=null):this.component.context.emitter.trigger("_noDateSelect")};let{component:n}=e,{options:r}=n.context,s=this.dragging=new ln(e.el);s.touchScrollAllowed=!1,s.minDistance=r.selectMinDistance||0,s.autoScroller.isEnabled=r.dragScroll;let i=this.hitDragging=new lr(this.dragging,Ps(e));i.emitter.on("pointerdown",this.handlePointerDown),i.emitter.on("dragstart",this.handleDragStart),i.emitter.on("hitupdate",this.handleHitUpdate),i.emitter.on("pointerup",this.handlePointerUp)}destroy(){this.dragging.destroy()}}function pb(t){let{options:e}=t.context,n=e.selectLongPressDelay;return n==null&&(n=e.longPressDelay),n}function vb(t,e,n){let r=t.dateSpan,s=e.dateSpan,i=[r.range.start,r.range.end,s.range.start,s.range.end];i.sort(Fg);let a={};for(let o of n){let l=o(t,e);if(l===!1)return null;l&&Object.assign(a,l)}return a.range={start:i[0],end:i[3]},a.allDay=r.allDay,a}class cn extends Lt{constructor(e){super(e),this.subjectEl=null,this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=a=>{let o=a.origEvent.target,{component:l,dragging:c}=this,{mirror:u}=c,{options:f}=l.context,h=l.context;this.subjectEl=a.subjectEl;let v=(this.eventRange=Nt(a.subjectEl)).instance.instanceId;this.relevantEvents=Cs(h.getCurrentData().eventStore,v),c.minDistance=a.isTouch?0:f.eventDragMinDistance,c.delay=a.isTouch&&v!==l.props.eventSelection?bb(l):null,u.parentNode=Cl(o),u.revertDuration=f.dragRevertDuration,u.colorScheme=f.colorScheme||"",l.isValidSegDownEl(o)&&!o.closest(`.${y.internalEventResizer}`)?this.isDragging=a.subjectEl.classList.contains(y.internalEventDraggable):c.cancel()},this.handleDragStart=a=>{let o=this.component.context,l=this.eventRange,c=l.instance.instanceId;a.isTouch?c!==this.component.props.eventSelection&&o.dispatch({type:"SELECT_EVENT",eventInstanceId:c}):o.dispatch({type:"UNSELECT_EVENT"}),this.isDragging&&(o.calendarApi.unselect(a),o.emitter.trigger("eventDragStart",{el:this.subjectEl,event:new K(o,l.def,l.instance),jsEvent:a.origEvent,view:o.viewApi}))},this.handleHitUpdate=(a,o)=>{if(!this.isDragging)return;let l=this.relevantEvents,c=this.hitDragging.initialHit,u=this.component.context,f=null,h=null,g=null,v=!1,m={affectedEvents:l,mutatedEvents:Me(),isEvent:!0};if(a){f=a.context;let E=f.options;u===f||E.editable&&E.droppable?(h=yb(c,a,this.eventRange.instance.range.start,f.getCurrentData().pluginHooks.eventDragMutationMassagers),h&&(g=Ms(l,f.getCurrentData().eventUiBases,h,f),m.mutatedEvents=g,Wl(m,a.dateProfile,f)||(v=!0,h=null,g=null,m.mutatedEvents=Me()))):f=null}this.displayDrag(f,m),v?Es():Ss(),o||(u===f&&cr(c,a)&&(h=null),this.dragging.setMirrorNeedsRevert(!h),this.dragging.setMirrorIsVisible(!a||!this.subjectEl.getRootNode().querySelector(`.${y.internalEventMirror}`)),this.receivingContext=f,this.validMutation=h,this.mutatedRelevantEvents=g)},this.handlePointerUp=()=>{this.isDragging||this.cleanup()},this.handleDragEnd=a=>{if(this.isDragging){let o=this.component.context,l=o.viewApi,{receivingContext:c,validMutation:u}=this,f=this.eventRange.def,h=this.eventRange.instance,g=new K(o,f,h),v=this.relevantEvents,m=this.mutatedRelevantEvents,{finalHit:E}=this.hitDragging;if(this.clearDrag(),o.emitter.trigger("eventDragStop",{el:this.subjectEl,event:g,jsEvent:a.origEvent,view:l}),u){if(c===o){let C=new K(o,m.defs[f.defId],h?m.instances[h.instanceId]:null);o.dispatch({type:"MERGE_EVENTS",eventStore:m});let R={oldEvent:g,event:C,relatedEvents:tt(m,o,h),revert(){o.dispatch({type:"MERGE_EVENTS",eventStore:v})}},x={};for(let T of o.getCurrentData().pluginHooks.eventDropTransformers)Object.assign(x,T(u,o));o.emitter.trigger("eventDrop",{...R,...x,el:a.subjectEl,delta:u.datesDelta,jsEvent:a.origEvent,view:l}),o.emitter.trigger("eventChange",R)}else if(c){let C={event:g,relatedEvents:tt(v,o,h),revert(){o.dispatch({type:"MERGE_EVENTS",eventStore:v})}};o.emitter.trigger("eventLeave",{...C,draggedEl:a.subjectEl,view:l}),o.dispatch({type:"REMOVE_EVENTS",eventStore:v}),o.emitter.trigger("eventRemove",C);let R=m.defs[f.defId],x=m.instances[h.instanceId],T=new K(c,R,x);c.dispatch({type:"MERGE_EVENTS",eventStore:m});let M={event:T,relatedEvents:tt(m,c,x),revert(){c.dispatch({type:"REMOVE_EVENTS",eventStore:m})}};c.emitter.trigger("eventAdd",M),a.isTouch&&c.dispatch({type:"SELECT_EVENT",eventInstanceId:h.instanceId}),c.emitter.trigger("drop",{...ql(E.dateSpan,c),draggedEl:a.subjectEl,jsEvent:a.origEvent,view:E.context.viewApi}),c.emitter.trigger("eventReceive",{...M,draggedEl:a.subjectEl,view:E.context.viewApi})}}else o.emitter.trigger("_noEventDrop")}this.cleanup()};let{component:n}=this,{options:r}=n.context,s=this.dragging=new ln(e.el);s.pointer.selector=cn.SELECTOR,s.touchScrollAllowed=!1,s.autoScroller.isEnabled=r.dragScroll;let i=this.hitDragging=new lr(this.dragging,Br);i.useSubjectCenter=e.useEventCenter,i.emitter.on("pointerdown",this.handlePointerDown),i.emitter.on("dragstart",this.handleDragStart),i.emitter.on("hitupdate",this.handleHitUpdate),i.emitter.on("pointerup",this.handlePointerUp),i.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}displayDrag(e,n){let r=this.component.context,s=this.receivingContext;s&&s!==e&&(s===r?s.dispatch({type:"SET_EVENT_DRAG",state:{affectedEvents:n.affectedEvents,mutatedEvents:Me(),isEvent:!0}}):s.dispatch({type:"UNSET_EVENT_DRAG"})),e&&e.dispatch({type:"SET_EVENT_DRAG",state:n})}clearDrag(){let e=this.component.context,{receivingContext:n}=this;n&&n.dispatch({type:"UNSET_EVENT_DRAG"}),e!==n&&e.dispatch({type:"UNSET_EVENT_DRAG"})}cleanup(){this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null}}cn.SELECTOR=`.${y.internalEventDraggable}, .${y.internalEventResizable}`;function yb(t,e,n,r){let s=t.dateSpan,i=e.dateSpan,a=s.range.start,o=i.range.start,l={};s.allDay!==i.allDay&&(l.allDay=i.allDay,l.hasEnd=e.context.options.allDayMaintainDuration,i.allDay?a=X(n):a=n);let c=bt(a,o,t.context.dateEnv,t.componentId===e.componentId?t.largeUnit:null);c.milliseconds&&(l.allDay=!1);let u={datesDelta:c,standardProps:l};for(let f of r)f(u,t,e);return u}function bb(t){let{options:e}=t.context,n=e.eventLongPressDelay;return n==null&&(n=e.longPressDelay),n}class Eb extends Lt{constructor(e){super(e),this.draggingSegEl=null,this.draggingEventRange=null,this.eventRange=null,this.relevantEvents=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=i=>{let{component:a}=this,o=this.querySegEl(i),l=this.eventRange=Nt(o);this.dragging.minDistance=a.context.options.eventDragMinDistance,this.component.isValidSegDownEl(i.origEvent.target)&&!(i.isTouch&&this.component.props.eventSelection!==l.instance.instanceId)||this.dragging.cancel()},this.handleDragStart=i=>{let{context:a}=this.component,o=this.eventRange;this.relevantEvents=Cs(a.getCurrentData().eventStore,this.eventRange.instance.instanceId);let l=this.querySegEl(i);this.draggingSegEl=l,this.draggingEventRange=Nt(l),a.calendarApi.unselect(),a.emitter.trigger("eventResizeStart",{el:l,event:new K(a,o.def,o.instance),jsEvent:i.origEvent,view:a.viewApi})},this.handleHitUpdate=(i,a,o)=>{let{context:l}=this.component,c=this.relevantEvents,u=this.hitDragging.initialHit,f=this.eventRange.instance,h=null,g=null,v=!1,m={affectedEvents:c,mutatedEvents:Me(),isEvent:!0};i&&(i.componentId===u.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(u,i)||(h=Sb(u,i,o.subjectEl.classList.contains(y.internalEventResizerStart),f.range))),h&&(g=Ms(c,l.getCurrentData().eventUiBases,h,l),m.mutatedEvents=g,Wl(m,i.dateProfile,l)||(v=!0,h=null,g=null,m.mutatedEvents=null)),g?l.dispatch({type:"SET_EVENT_RESIZE",state:m}):l.dispatch({type:"UNSET_EVENT_RESIZE"}),v?Es():Ss(),a||(h&&cr(u,i)&&(h=null),this.validMutation=h,this.mutatedRelevantEvents=g)},this.handleDragEnd=i=>{let{context:a}=this.component,o=this.eventRange.def,l=this.eventRange.instance,c=new K(a,o,l),u=this.relevantEvents,f=this.mutatedRelevantEvents;if(a.emitter.trigger("eventResizeStop",{el:this.draggingSegEl,event:c,jsEvent:i.origEvent,view:a.viewApi}),this.validMutation){let h=new K(a,f.defs[o.defId],l?f.instances[l.instanceId]:null);a.dispatch({type:"MERGE_EVENTS",eventStore:f});let g={oldEvent:c,event:h,relatedEvents:tt(f,a,l),revert(){a.dispatch({type:"MERGE_EVENTS",eventStore:u})}};a.emitter.trigger("eventResize",{...g,el:this.draggingSegEl,startDelta:this.validMutation.startDelta||$(0),endDelta:this.validMutation.endDelta||$(0),jsEvent:i.origEvent,view:a.viewApi}),a.emitter.trigger("eventChange",g)}else a.emitter.trigger("_noEventResize");this.draggingEventRange=null,this.relevantEvents=null,this.validMutation=null};let{component:n}=e,r=this.dragging=new ln(e.el);r.pointer.selector=`.${y.internalEventResizer}`,r.touchScrollAllowed=!1,r.autoScroller.isEnabled=n.context.options.dragScroll;let s=this.hitDragging=new lr(this.dragging,Ps(e));s.emitter.on("pointerdown",this.handlePointerDown),s.emitter.on("dragstart",this.handleDragStart),s.emitter.on("hitupdate",this.handleHitUpdate),s.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}querySegEl(e){return e.subjectEl.closest(`.${y.internalEvent}`)}}function Sb(t,e,n,r){let s=t.context.dateEnv,i=t.dateSpan.range.start,a=e.dateSpan.range.start,o=bt(i,a,s,t.largeUnit);if(n){if(s.add(r.start,o)<r.end)return{startDelta:o}}else if(s.add(r.end,o)>r.start)return{endDelta:o};return null}class wb{constructor(e){this.context=e,this.isRecentPointerDateSelect=!1,this.matchesCancel=!1,this.matchesEvent=!1,this.onSelect=r=>{r.jsEvent&&(this.isRecentPointerDateSelect=!0)},this.onDocumentPointerDown=r=>{let s=this.context.options.unselectCancel,i=Tl(r.origEvent);this.matchesCancel=!!i.closest(s),this.matchesEvent=!!i.closest(cn.SELECTOR)},this.onDocumentPointerUp=r=>{let{context:s}=this,{documentPointer:i}=this,a=s.getCurrentData();if(!i.wasTouchScroll){if(a.dateSelection&&!this.isRecentPointerDateSelect){let o=s.options.unselectAuto;o&&(!o||!this.matchesCancel)&&s.calendarApi.unselect(r)}a.eventSelection&&!this.matchesEvent&&s.dispatch({type:"UNSELECT_EVENT"})}this.isRecentPointerDateSelect=!1};let n=this.documentPointer=new $l(document);n.shouldIgnoreMove=!0,n.shouldWatchScroll=!1,n.emitter.on("pointerdown",this.onDocumentPointerDown),n.emitter.on("pointerup",this.onDocumentPointerUp),e.emitter.on("select",this.onSelect)}destroy(){this.context.emitter.off("select",this.onSelect),this.documentPointer.destroy()}}var Db={name:"interaction",componentInteractions:[gb,mb,cn,Eb],calendarInteractions:[wb],elementDraggingImpl:ln};function ta(t){return String(t).padStart(2,"0")}function xb(t,e){if(t==="")return"";const[n,r]=t.split(":").map(Number),s=(n*60+r+e)%1440;return`${ta(Math.floor(s/60))}:${ta(s%60)}`}const Xl=60,Cb=864e5;function na(t,e,n){if(n){const r=t.slice(0,10),s=ke(e.slice(0,10),-1);return{...Kl(t),endDate:s<r?r:s}}return{date:t.slice(0,10),endDate:e.slice(0,10),startTime:t.slice(11,16),endTime:e.slice(11,16),allDay:!1}}function Tb(t,e){if(e)return Kl(t);const n=t.slice(11,16),r=xb(n,Xl),s=t.slice(0,10);return{date:s,endDate:r<n?ke(s,1):s,startTime:n,endTime:r,allDay:!1}}function Kl(t){return{date:t.slice(0,10),endDate:t.slice(0,10),startTime:"",endTime:"",allDay:!0}}function Rb(t,e,n,r){const s=Date.parse(e)-Date.parse(t);return Math.round(s/Cb)>1}const ie=15,Nb=4,_s=1440;function ra(t,e){return Math.hypot(t,e)>=Nb}function Mb(t,e){const n=t/e*60,r=Math.floor(n/ie)*ie;return Math.min(Math.max(r,0),_s-ie)}const sa=t=>String(t).padStart(2,"0");function qr(t){return`${sa(Math.floor(t/60))}:${sa(t%60)}`}function ia(t){const[e,n]=t.split(":").map(Number);return e*60+n}function Ib(t,e,n){const r=Math.min(e,n),s=Math.max(e,n)+ie;return Mt(t,r,s)}function Mt(t,e,n){const r=n>=_s;return{date:t,endDate:r?ke(t,1):t,startTime:qr(e),endTime:r?"00:00":qr(n),allDay:!1}}function Ke(t,e){return Mt(t,e,e+Xl)}function aa(t,e){const[n,r]=t<=e?[t,e]:[e,t];return{date:n,endDate:r,startTime:"",endTime:"",allDay:!0}}function Xr(t){const e=ia(t.startTime),n=t.endDate>t.date?_s:ia(t.endTime);return{start:e,end:n}}const kb=[Zy,Db],Pb={comfortable:3,compact:2},Ql="cal-1",jb={color:Ql,rsvp:"accepted",status:"confirmed",hasThread:!1,isRecurring:!1,zoneCertainty:"local"},Hb=(t,e)=>new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit"}).format(t),Ob=t=>t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey;function Ab({date:t,events:e,colorByCalendarId:n,density:r,selectedEventId:s,timeZone:i,now:a,onSelectEvent:o,onPickSlot:l,dayHref:c,onZoomDay:u,canMove:f=()=>!1,onMoveEvent:h,tasks:g=[],onSelectTask:v,className:m}){const E=S.useRef(null);S.useEffect(()=>{E.current?.getApi().gotoDate(t)},[t]);const C=S.useMemo(()=>new Map(g.map(D=>[D.calendarTaskId,D])),[g]),R=S.useMemo(()=>[...e.map(D=>({id:D.id,title:D.title,start:D.start,end:D.end,allDay:D.allDay,editable:h!==void 0&&f(D.id)})),...g.map(D=>({id:D.calendarTaskId,title:D.title,start:D.due,allDay:D.allDay,editable:!1}))],[e,g,f,h]),x=D=>{D.revert(),h?.(D.event.id,na(D.event.startStr,D.event.endStr===""?D.event.startStr:D.event.endStr,D.event.allDay))},T=S.useMemo(()=>new Map(e.map(D=>[D.id,{color:n[D.calendarId]??Ql,rsvp:D.myRsvp,status:D.status,hasThread:D.threadId!=="",isRecurring:D.recurrenceRule!=="",zoneCertainty:D.zoneCertainty}])),[e,n]),M=D=>T.get(D)??jb;return d.jsx("div",{"data-testid":"calendar-grid",className:j("h-full min-h-0 w-full text-fg",m),children:d.jsx(Ev,{ref:E,plugins:kb,initialView:"dayGridMonth",initialDate:t,now:a,timeZone:i,height:"100%",headerToolbar:!1,firstDay:1,fixedWeekCount:!1,selectable:!0,editable:!1,eventInteractive:!0,expandRows:!0,dayMaxEvents:Pb[r],dayCellTopContent:D=>{const N=Hb(D.date,i);return d.jsx("a",{href:c(N),"aria-label":`Open ${D.date.toLocaleDateString("en-GB",{dateStyle:"full",timeZone:i})}`,className:"hover:underline",onClick:P=>{Ob(P)||(P.preventDefault(),u(N))},children:Number(N.slice(8))})},dayCellDidMount:D=>{D.el.querySelector(":scope [aria-hidden='true']:has(> a)")?.removeAttribute("aria-hidden");const N=D.el.querySelector("a");for(const P of["mousedown","touchstart","pointerdown"])N?.addEventListener(P,H=>H.stopPropagation())},moreLinkClick:"popover",moreLinkText:D=>`+${D}`,displayEventEnd:!1,eventTimeFormat:{hour:"2-digit",minute:"2-digit",hour12:!1},dayHeaderFormat:{weekday:"short"},events:R,eventClick:D=>C.has(D.event.id)?v?.(D.event.id):o(D.event.id),eventDrop:x,eventResize:x,eventDidMount:D=>{D.el.setAttribute(C.has(D.event.id)?"data-task-id":"data-event-id",D.event.id)},dateClick:D=>l(Tb(D.dateStr,D.allDay)),select:D=>{if(!Rb(D.startStr,D.endStr)){D.view.calendar.unselect();return}l(na(D.startStr,D.endStr,!0))},viewClass:"bg-surface",tableClass:"border-line",tableHeaderClass:"bg-surface",fillerClass:"border-line",dayHeaderRowClass:"h-pane-header",dayHeaderClass:D=>j("border-b border-line bg-surface",D.isToday?"text-accent":"text-fg-subtle"),dayHeaderInnerClass:"px-1 py-1 text-2xs font-semibold uppercase tracking-wider",dayHeaderDividerClass:"border-b border-line",dayCellClass:D=>j("border-line",D.isOther&&"bg-surface-sunken"),dayCellTopInnerClass:D=>j("px-1 py-0.5 text-2xs tabular-nums",D.isToday?"font-semibold text-accent":"text-fg-muted"),dayRowClass:"border-line",highlightClass:"bg-accent-soft",moreLinkClass:"rounded-sm bg-surface-sunken text-2xs font-semibold text-fg-muted hover:bg-line hover:text-fg",moreLinkInnerClass:"px-1 py-0.5",popoverClass:"rounded-lg border border-line bg-surface-raised shadow-xl shadow-black/20",popoverCloseClass:"text-fg-subtle hover:text-fg",eventClass:D=>j(kr({color:M(D.event.id).color,layout:"row",density:"compact",rsvp:M(D.event.id).rsvp,status:M(D.event.id).status,selected:D.event.id===s,stacked:!1}),"my-px cursor-pointer px-1 py-0 outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring"),eventContent:D=>{const N=C.get(D.event.id);if(N)return d.jsxs("span",{className:j("flex min-w-0 items-center gap-1 truncate",N.completed&&"line-through opacity-60"),children:[d.jsx("span",{"aria-hidden":"true",children:N.completed?"☑":"☐"}),d.jsx("span",{className:"truncate",children:N.title===""?"(No title)":N.title})]});const P=M(D.event.id);return d.jsx(Na,{title:D.event.title,timeText:r==="compact"?"":D.timeText,layout:"row",rsvp:P.rsvp,hasThread:P.hasThread,isRecurring:P.isRecurring,zoneCertainty:P.zoneCertainty})}})})}function Lb(t){const e=[],n=new Map;for(const r of t){let s=n.get(r.accountId);s||(s={accountId:r.accountId,accountLabel:r.accountLabel,calendars:[]},n.set(r.accountId,s),e.push(r.accountId)),s.calendars.push(r)}return e.map(r=>n.get(r))}function _b({calendars:t,visible:e,onToggle:n,onToggleAccount:r,layout:s="list",touch:i,closedAccountIds:a,className:o}){const[l,c]=S.useState(()=>new Set(a??[])),u=f=>c(h=>{const g=new Set(h);return g.delete(f)||g.add(f),g});return s==="strip"?d.jsx("div",{className:j("flex items-center gap-1.5 overflow-x-auto px-row-inset",o),children:t.map(f=>{const h=sn(f.color),g=e.has(f.id);return d.jsxs("label",{className:j("inline-flex shrink-0 cursor-pointer items-center gap-1.5 rounded-full border px-2.5 text-xs transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",i?"min-h-9":"h-7",g?j(h.soft,h.text,h.border):"border-line text-fg-subtle"),children:[d.jsx("input",{type:"checkbox",checked:g,onChange:()=>n(f.id),className:"sr-only"}),d.jsx("span",{className:j("size-2 rounded-full border",h.border,g?h.solid:"bg-transparent")}),f.name]},f.id)})}):d.jsx("div",{className:j("flex flex-col gap-3",o),children:Lb(t).map(f=>{const h=f.calendars.every(v=>e.has(v.id)),g=!l.has(f.accountId);return d.jsxs("section",{className:"flex flex-col",children:[d.jsxs("div",{className:"flex items-center gap-2 px-row-inset pb-1",children:[d.jsxs("button",{type:"button",onClick:()=>u(f.accountId),"aria-expanded":g,className:j("flex min-w-0 flex-1 items-center gap-1.5 rounded-sm text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle outline-none transition-colors hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",i&&"min-h-11"),children:[g?d.jsx(bd,{className:"size-3 shrink-0"}):d.jsx(Vn,{className:"size-3 shrink-0"}),d.jsx("span",{className:"truncate",children:f.accountLabel})]}),r&&d.jsx("button",{type:"button",onClick:()=>r(f.accountId,!h),className:"rounded-sm text-2xs text-fg-subtle outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:h?"None":"All"})]}),g&&f.calendars.map(v=>d.jsx(Ub,{calendar:v,checked:e.has(v.id),touch:i,onToggle:()=>n(v.id)},v.id))]},f.accountId)})})}function Ub({calendar:t,checked:e,touch:n,onToggle:r}){const s=sn(t.color),i=t.sync==="paused",a=t.syncError??"";return d.jsxs("div",{className:"flex flex-col",children:[d.jsxs("label",{className:j("flex cursor-pointer items-center gap-2.5 rounded-sm px-row-inset hover:bg-surface-sunken",n?"min-h-11":"min-h-9"),children:[d.jsx("input",{type:"checkbox",checked:e,onChange:r,className:"peer sr-only"}),d.jsx("span",{"aria-hidden":!0,className:j("flex size-4 shrink-0 items-center justify-center rounded-xs border transition-colors","peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-1 peer-focus-visible:ring-offset-surface",e?j(s.solid,s.border):j("bg-transparent",s.border)),children:e&&d.jsx(cc,{className:"size-3 text-canvas",strokeWidth:3})}),d.jsx("span",{className:j("min-w-0 flex-1 truncate text-sm",e?"text-fg":"text-fg-subtle"),children:t.name}),i&&d.jsx(vd,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),a!==""&&d.jsx(Sa,{className:"size-3.5 shrink-0 text-danger","aria-hidden":!0})]}),i&&d.jsx("span",{className:"sr-only",children:`${t.name}: ${yd.Calendar}`}),a!==""&&d.jsx("p",{className:"px-row-inset pb-1 text-xs text-danger",children:d.jsx("span",{className:"block pl-6.5",children:`Not refreshed: ${a}`})})]})}const Nr={year:"Year",month:"Month",week:"Week",day:"Day",agenda:"Agenda"},Fb=["day","week","month","year","agenda"];function Bb({view:t,title:e,weekNumber:n,views:r=Fb,onChangeView:s,onPrev:i,onNext:a,onToday:o,sidePane:l,trailing:c,touch:u=!1,className:f}){const h=j("flex shrink-0 items-center justify-center rounded-full text-fg-muted outline-none transition-colors hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",u?"size-11":"size-9");return d.jsxs("div",{role:"toolbar","aria-label":"Calendar","data-calendar-toolbar":"",className:j("flex shrink-0 items-center gap-1 border-b border-line bg-surface px-2",u?"h-14":"h-14 gap-2",f),children:[l&&d.jsx("button",{type:"button","aria-label":"Side pane","aria-expanded":l.open,"aria-controls":l.controls,onClick:l.onToggle,className:h,children:d.jsx(Rd,{className:"size-5"})}),d.jsx("button",{type:"button",onClick:o,className:j("shrink-0 rounded-full border border-line px-4 text-sm font-medium text-fg outline-none transition-colors hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",u?"min-h-11":"h-9"),children:"Today"}),d.jsx("button",{type:"button",onClick:i,"aria-label":`Previous ${Nr[t].toLowerCase()}`,className:h,children:d.jsx(Ia,{className:"size-5"})}),d.jsx("button",{type:"button",onClick:a,"aria-label":`Next ${Nr[t].toLowerCase()}`,className:h,children:d.jsx(Vn,{className:"size-5"})}),d.jsx("h1",{className:j("min-w-0 truncate font-normal text-fg",u?"text-base":"text-xl"),children:e}),n!==void 0&&d.jsxs("span",{className:"shrink-0 rounded-md bg-surface-sunken px-2 py-0.5 text-xs font-medium text-fg-muted",children:["Week ",n]}),d.jsx("div",{className:"min-w-0 flex-1"}),!u&&c,d.jsx(Td,{"aria-label":"View",value:t,onChange:g=>{const v=r.find(m=>m===g.target.value);v&&s(v)},className:j("shrink-0",u?"h-11 w-24":"w-28"),children:r.map(g=>d.jsx("option",{value:g,children:Nr[g]},g))})]})}function Wb({id:t,onNewEvent:e,newEventRef:n,month:r,calendars:s,className:i}){return d.jsxs("section",{id:t,"aria-label":"Calendar side pane",className:j("flex w-64 shrink-0 flex-col gap-4 overflow-y-auto bg-surface px-3 py-3",i),children:[d.jsxs("button",{ref:n,type:"button",onClick:e,className:"flex h-12 w-fit items-center gap-3 rounded-2xl bg-surface-raised px-5 text-sm font-medium text-fg shadow-md outline-none transition-shadow hover:shadow-lg focus-visible:ring-2 focus-visible:ring-ring",children:[d.jsx(Ma,{className:"size-5 text-accent","aria-hidden":"true"}),"New event"]}),r,d.jsxs("section",{"aria-label":"My calendars",className:"flex flex-col gap-1",children:[d.jsx("h2",{className:"px-1 text-sm font-medium text-fg",children:"My calendars"}),s]})]})}function oa({onNewEvent:t,newEventRef:e,className:n}){return d.jsx("button",{ref:e,type:"button","aria-label":"New event",onClick:t,className:j("flex size-12 items-center justify-center rounded-2xl bg-surface-raised text-accent shadow-md outline-none hover:shadow-lg focus-visible:ring-2 focus-visible:ring-ring",n),children:d.jsx(Ma,{className:"size-6","aria-hidden":"true"})})}const Bn=1440;function Vb(t,e){return Math.round(t/e*60/ie)*ie}function Tn(t,e){const n=t.minute+e,r=Math.floor(n/Bn);return{date:ke(t.date,r),minute:n-r*Bn}}const Jl=(t,e)=>{let n=0,r=t.date;for(;r<e.date;)r=ke(r,1),n+=1;return n*Bn+e.minute-t.minute};function zb(t,e,n,r){const s=Jl(t,e),i=Tn({date:ke(t.date,n),minute:t.minute},r),a={date:i.date,minute:Math.round(i.minute/ie)*ie},o=a.minute===Bn?Tn(a,0):a;return{start:o,end:Tn(o,s)}}function $b(t,e,n){const r=Math.max(Jl(t,e)+n,ie),s=Math.round(r/ie)*ie;return Tn(t,s)}function Yb(t,e,n){return{first:ke(t,n),last:ke(e,n)}}function Gb(t,e,n){const r=ke(e,n);return r<t?t:r}const Zb=1440-ie;function Kr(t,e,n){return{date:t.includes(e)?e:t[0],minute:Math.floor(n/60)*60}}function qb(t,e,n){const r=n.indexOf(t.date);switch(e){case"ArrowUp":return{...t,minute:Math.max(0,t.minute-ie)};case"ArrowDown":return{...t,minute:Math.min(Zb,t.minute+ie)};case"ArrowLeft":return{...t,date:n[Math.max(0,r-1)]};case"ArrowRight":return{...t,date:n[Math.min(n.length-1,r+1)]};default:return null}}const Xb=(t,e)=>t.date===e.date?t.minute-e.minute:t.date<e.date?-1:1;function la(t,e){const[n,r]=Xb(t,e)<=0?[t,e]:[e,t];if(n.date===r.date)return Mt(n.date,n.minute,r.minute+ie);const s=Mt(r.date,r.minute,r.minute+ie);return{date:n.date,startTime:qr(n.minute),endDate:s.endDate,endTime:s.endTime,allDay:!1}}const Qr=500,Kb=8;function ca(t,e,n){return{phase:"pending",x:t,y:e,at:n}}function da(t,e,n){return t.phase!=="pending"?t:Math.hypot(e-t.x,n-t.y)>Kb?{phase:"scrolled"}:t}function ua(t,e){return t.phase!=="pending"?t:e-t.at>=Qr?{phase:"held"}:t}function fa(t,e,n,r){const s=Math.round(n/r*(60/ie)),{start:i,end:a}=Xr(t),o=s*ie;if(e==="start"){const c=Math.min(Math.max(0,i+o),a-ie);return Mt(t.date,c,a)}const l=Math.max(Math.min(1440,a+o),i+ie);return Mt(t.date,i,l)}const ha=new Map;function Qb(t){let e=ha.get(t);return e||(e=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),ha.set(t,e)),e}function Se(t,e){const n=Object.fromEntries(Qb(e).formatToParts(new Date(t)).map(r=>[r.type,r.value]));return{date:`${n.year}-${n.month}-${n.day}`,minute:Number(n.hour)*60+Number(n.minute)}}function Jb(t,e){const n=e.filter(o=>o.start.date<=t&&o.end.date>=t).map(o=>({id:o.id,top:o.start.date<t?0:o.start.minute,bottom:o.end.date>t?1440:o.end.minute})).filter(o=>o.bottom>o.top||o.top===o.bottom).map(o=>({...o,bottom:Math.max(o.bottom,o.top+15)})).sort((o,l)=>o.top-l.top||l.bottom-o.bottom),r=[];let s=[],i=-1;const a=()=>{const o=Math.max(0,...s.map(l=>l.column))+1;for(const l of s)l.columns=o;r.push(...s),s=[]};for(const o of n){o.top>=i&&s.length>0&&a();const l=new Set(s.filter(u=>u.bottom>o.top).map(u=>u.column));let c=0;for(;l.has(c);)c+=1;s.push({...o,column:c,columns:1}),i=Math.max(i,o.bottom)}return s.length>0&&a(),r}function Mr(t,e){const n=[],r=[],s=e.filter(i=>i.last>=t[0]&&i.first<=t[t.length-1]).sort((i,a)=>i.first.localeCompare(a.first)||a.last.localeCompare(i.last));for(const i of s){const a=Math.max(0,t.indexOf(i.first<t[0]?t[0]:i.first)),o=i.last>t[t.length-1]?t[t.length-1]:i.last,l=t.indexOf(o);let c=n.findIndex(u=>u.every(f=>f<a||f>l));c===-1&&(c=n.length,n.push([]));for(let u=a;u<=l;u+=1)n[c].push(u);r.push({id:i.id,startIndex:a,span:l-a+1,lane:c})}return r}const eE={comfortable:48,compact:24},tE=Array.from({length:24},(t,e)=>e),mt=22,ga="cal-1",Jr=t=>String(t).padStart(2,"0"),Et=t=>`${Jr(Math.floor(t/60)%24)}:${Jr(t%60)}`,St=(t,e)=>new Intl.DateTimeFormat(void 0,{...e,timeZone:"UTC"}).format(new Date(`${t}T00:00:00Z`));function ma(t){const e=St(t.date,{weekday:"long",day:"numeric",month:"long"});return t.allDay?t.endDate===t.date?`${e}, all day`:`${e} to ${St(t.endDate,{weekday:"long",day:"numeric",month:"long"})}, all day`:`${e}, ${t.startTime} to ${t.endTime}`}function nE(t,e){return new Intl.DateTimeFormat("en-GB",{timeZone:t,timeZoneName:"short"}).formatToParts(new Date(e)).find(r=>r.type==="timeZoneName")?.value??""}function rE({days:t,events:e,colorByCalendarId:n,density:r,timeZone:s,now:i,selectedEventId:a="",draft:o,onGesture:l,onSelectEvent:c,onOpenDay:u,touch:f=!1,canMove:h=()=>!1,onMoveEvent:g,tasks:v=[],selectedTaskId:m="",onSelectTask:E,onToggleTask:C,className:R}){const x=eE[r],T=S.useRef(null),M=S.useRef(null),D=S.useRef(null),N=S.useRef(null),P=S.useRef(null),H=S.useRef(void 0),[U,te]=S.useState(null),[W,V]=S.useState(null),[ne,ae]=S.useState(!1),[le,Pe]=S.useState(""),Ie=S.useId(),re=Se(i,s),xe=S.useMemo(()=>e.map(p=>({event:p,start:Se(p.start,s),end:Se(p.end,s)})),[e,s]),Ge=xe.filter(p=>!p.event.allDay),Ze=xe.filter(p=>p.event.allDay),_=S.useMemo(()=>new Map(xe.map(p=>[p.event.id,p.event])),[xe]),q=S.useMemo(()=>new Map(v.map(p=>[p.calendarTaskId,{task:p,date:p.allDay?p.due.slice(0,10):Se(p.due,s).date,minute:p.allDay?0:Se(p.due,s).minute}])),[v,s]),oe=Mr(t,[...Ze.map(p=>({id:p.event.id,first:p.event.start.slice(0,10),last:pa(p.event)})),...[...q.values()].map(({task:p,date:w})=>({id:p.calendarTaskId,first:w,last:w}))]),ce=o?.range.allDay===!0?Mr(t,[{id:"draft",first:o.range.date,last:o.range.endDate}])[0]:void 0,F=Math.max(1,...oe.map(p=>p.lane+1),ce?1:0),de=t.join(","),je=t.includes(re.date)?Math.max(0,re.minute-90):480,ut=S.useRef(je);ut.current=je,S.useLayoutEffect(()=>{const p=T.current;!p||de===""||(p.scrollTop=ut.current/60*x)},[de,x]);const Ee=S.useRef(null),Q=S.useRef(null),Ce=S.useRef(void 0),ft=S.useRef(!1),[pe,_t]=S.useState(null),Te=S.useCallback(()=>{Q.current=null,clearTimeout(Ce.current),_t(null)},[]),Re=S.useCallback(()=>{N.current=null,P.current=null,clearTimeout(H.current)},[]);S.useEffect(()=>{const p=w=>{if(w.key==="Escape"){if(Q.current?.dragging){w.preventDefault(),w.stopImmediatePropagation(),ft.current=!0,Te();return}N.current&&(w.preventDefault(),w.stopImmediatePropagation(),Re(),l({type:"drag-cancel"}))}};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[Re,Te,l]),S.useEffect(()=>{const p=T.current;if(!p)return;const w=A=>{(P.current?.phase==="held"||N.current?.dragging||Q.current?.dragging)&&A.preventDefault()};return p.addEventListener("touchmove",w,{passive:!1}),()=>p.removeEventListener("touchmove",w)},[]);const qe=p=>{const w=M.current;if(!w)return;const A=w.getBoundingClientRect(),L=Math.floor((p-A.left)/A.width*t.length);return t[Math.min(t.length-1,Math.max(0,L))]},dn=p=>{const w=M.current;return w?Mb(p-w.getBoundingClientRect().top,x):0},He=p=>Pe(ma(p)),un=(p,w,A)=>{if(p.stopPropagation(),p.button!==0||!h(w.id)||!g)return;const L=qe(p.clientX);if(!L)return;En(p.currentTarget,p.pointerId);const z=f&&p.pointerType==="touch";Q.current={id:w.id,kind:A,allDay:w.allDay,pointerId:p.pointerId,x:p.clientX,y:p.clientY,startColumn:L,start:Se(w.start,s),end:Se(w.end,s),first:w.start.slice(0,10),last:pa(w),dragging:!1,press:z?ca(p.clientX,p.clientY,Date.now()):null,range:null,invalid:!1},z&&(Ce.current=setTimeout(()=>{const Y=Q.current;Y?.press&&(Y.press=ua(Y.press,Date.now()+1),Y.press.phase==="held"&&(Y.dragging=!0,navigator.vibrate?.(10),Ut(Y,Y.x,Y.y)))},Qr))},Ut=(p,w,A)=>{const L=t.indexOf(qe(w)??p.startColumn)-t.indexOf(p.startColumn),z=Vb(A-p.y,x);let Y;if(p.allDay){const Xe=p.kind==="move"?Yb(p.first,p.last,L):{first:p.first,last:Gb(p.first,p.last,L)};Y={date:Xe.first,endDate:Xe.last,startTime:"",endTime:"",allDay:!0}}else{const Xe=p.kind==="move"?zb(p.start,p.end,L,z):{start:p.start,end:$b(p.start,p.end,z)};Y={date:Xe.start.date,endDate:Xe.end.date,startTime:Et(Xe.start.minute),endTime:Et(Xe.end.minute),allDay:!1}}const Ne=Ee.current?.getBoundingClientRect(),$s=Ne!==void 0&&(w<Ne.left||w>Ne.right||A<Ne.top||A>Ne.bottom);p.range=Y,p.invalid=$s,_t({id:p.id,range:Y,invalid:$s})},ue=p=>{const w=Q.current;if(!(!w||w.pointerId!==p.pointerId)){if(w.press){if(w.press=da(w.press,p.clientX,p.clientY),w.press.phase==="scrolled"){Te();return}if(w.press.phase!=="held")return}else if(!w.dragging&&!ra(p.clientX-w.x,p.clientY-w.y))return;w.dragging=!0,Ut(w,p.clientX,p.clientY)}},Ft=p=>{const w=Q.current;if(!w||w.pointerId!==p.pointerId)return;w.dragging&&(ft.current=!0);const{range:A,invalid:L,dragging:z,id:Y}=w;Te(),!(!z||!A||L)&&(He(A),g?.(Y,A))},dr=p=>{if(p.button!==0)return;const w=qe(p.clientX);if(!w)return;const A=p.currentTarget;En(A,p.pointerId);const L=dn(p.clientY);if(f&&p.pointerType==="touch"){P.current=ca(p.clientX,p.clientY,Date.now()),N.current={kind:"touch",pointerId:p.pointerId,date:w,anchorMinute:L,x:p.clientX,y:p.clientY,dragging:!1,range:null,origin:A},H.current=setTimeout(()=>{if(!P.current||!N.current||(P.current=ua(P.current,Date.now()+1),P.current.phase!=="held"))return;const z=Ke(w,L);N.current.dragging=!0,N.current.range=z,navigator.vibrate?.(10),l({type:"drag",range:z})},Qr);return}N.current={kind:"timed",pointerId:p.pointerId,date:w,anchorMinute:L,x:p.clientX,y:p.clientY,dragging:!1,range:null,origin:A}},ht=p=>{if(p.button!==0||f&&p.pointerType==="touch")return;const w=qe(p.clientX);w&&(En(p.currentTarget,p.pointerId),N.current={kind:"all-day",pointerId:p.pointerId,date:w,anchorMinute:0,x:p.clientX,y:p.clientY,dragging:!1,range:null,origin:p.currentTarget})},fn=(p,w)=>{o&&(w.stopPropagation(),En(w.currentTarget,w.pointerId),N.current={kind:p==="start"?"handle-start":"handle-end",pointerId:w.pointerId,date:o.range.date,anchorMinute:0,x:w.clientX,y:w.clientY,dragging:!0,range:o.range,origin:w.currentTarget})},Ue=p=>{const w=N.current;if(!w||w.pointerId!==p.pointerId)return;const A=p.clientX-w.x,L=p.clientY-w.y;if(w.kind==="touch"){if(!P.current)return;if(P.current=da(P.current,p.clientX,p.clientY),P.current.phase==="scrolled"){Re();return}if(P.current.phase!=="held")return;const Y=fa(Ke(w.date,w.anchorMinute),"end",L,x);w.range=Y,l({type:"drag",range:Y});return}if(w.kind==="handle-start"||w.kind==="handle-end"){if(!o)return;const Y=fa(w.range??o.range,w.kind==="handle-start"?"start":"end",L,x);l({type:"drag",range:Y});return}if(!w.dragging&&!ra(A,L))return;w.dragging=!0;const z=w.kind==="all-day"?aa(w.date,qe(p.clientX)??w.date):Ib(w.date,w.anchorMinute,dn(p.clientY));w.range=z,l({type:"drag",range:z})},Fe=p=>{const w=N.current;if(!w||w.pointerId!==p.pointerId)return;if(w.kind==="handle-start"||w.kind==="handle-end"){const L=o?.range;Re(),L&&(He(L),l({type:"drag-end",range:L}));return}if(w.kind==="touch"){const L=w.range,z=P.current?.phase==="pending";if(Re(),L){He(L),l({type:"drag-end",range:L});return}z&&l({type:"click",range:Ke(w.date,w.anchorMinute),origin:w.origin});return}if(Re(),w.dragging&&w.range){He(w.range),l({type:"drag-end",range:w.range});return}const A=w.kind==="all-day"?aa(w.date,w.date):Ke(w.date,w.anchorMinute);l({type:"click",range:A,origin:w.origin})},Bt=p=>{const w=N.current;if(!w||w.pointerId!==p.pointerId)return;const A=w.dragging;Re(),A&&l({type:"drag-cancel"})},ur=p=>{if(p.target!==p.currentTarget)return;ae(!0);const w=U??Kr(t,re.date,re.minute);if(p.key==="Enter"){p.preventDefault();const L=W?la(W,w):Ke(w.date,w.minute),z=document.getElementById(Ie);V(null),He(L),l({type:"keyboard",range:L,origin:z});return}if(p.key==="Escape"&&W){p.preventDefault(),p.stopPropagation(),V(null),l({type:"drag-cancel"});return}const A=qb(w,p.key,t);if(A){if(p.preventDefault(),te(A),Z(A.minute),p.shiftKey){const L=W??w;V(L);const z=la(L,A);He(z),l({type:"drag",range:z});return}W&&(V(null),l({type:"drag-cancel"}))}},Z=p=>{const w=T.current;if(!w)return;const A=p/60*x;A<w.scrollTop?w.scrollTop=A:A+x>w.scrollTop+w.clientHeight&&(w.scrollTop=A+x-w.clientHeight)},he=U&&t.includes(U.date)?U:Kr(t,re.date,re.minute),ge=(p,w,A)=>{const L=n[p.calendarId]??ga,z=p.allDay||r==="compact"&&!A?"":Et(Se(p.start,s).minute),Y=g!==void 0&&h(p.id);return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button","data-event-id":p.id,onPointerDown:Ne=>un(Ne,p,"move"),onPointerMove:ue,onPointerUp:Ft,onPointerCancel:Te,onClick:Ne=>{if(ft.current){ft.current=!1;return}c(p.id,Ne.currentTarget)},"aria-label":`${p.title}, ${sE(p,s)}`,className:j(kr({color:L,layout:w,density:"compact",rsvp:p.myRsvp,status:p.status,selected:p.id===a,stacked:!1}),"h-full w-full cursor-pointer text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",f&&"touch-pan-y",pe?.id===p.id&&"opacity-40"),children:d.jsx(Na,{title:p.title===""?"(No title)":p.title,timeText:z,layout:w,rsvp:p.myRsvp,hasThread:p.threadId!=="",isRecurring:p.recurrenceRule!=="",zoneCertainty:p.zoneCertainty})}),Y&&d.jsx("span",{"aria-hidden":"true","data-resize-handle":"",onPointerDown:Ne=>un(Ne,p,"resize"),onPointerMove:ue,onPointerUp:Ft,onPointerCancel:Te,className:j("absolute",w==="column"?"inset-x-0 bottom-0 h-1.5 cursor-ns-resize":"inset-y-0 right-0 w-1.5 cursor-ew-resize"),style:{touchAction:"none"}})]})},ve=(p,w)=>{const A=p.title===""?"(No title)":p.title,L=n[p.calendarId]??ga,z=w===void 0?"":Et(w);return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button","data-task-id":p.calendarTaskId,onPointerDown:Y=>Y.stopPropagation(),onClick:()=>E?.(p.calendarTaskId),"aria-label":`Task: ${A}${z===""?"":`, due ${z}`}`,className:j(kr({color:L,layout:"row",density:"compact",rsvp:"accepted",status:"confirmed",selected:p.calendarTaskId===m,stacked:!1}),"h-full w-full cursor-pointer truncate pl-5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",p.completed&&"line-through opacity-60"),children:z===""?A:`${z} ${A}`}),d.jsx("input",{type:"checkbox","aria-label":A,checked:p.completed,onPointerDown:Y=>Y.stopPropagation(),onChange:()=>C?.(p.calendarTaskId),className:"absolute top-1 left-1.5 z-10 size-3.5 accent-current"})]})},hn=p=>p.allDay?St(p.date,{weekday:"short",day:"numeric"}):`${St(p.date,{weekday:"short",day:"numeric"})} · ${p.startTime} – ${p.endTime}`,Bs=(p,w)=>d.jsx("div",{"data-lifted-event":"",className:j("pointer-events-none absolute inset-0 z-30 flex flex-col overflow-hidden rounded-sm border-2 border-accent bg-accent-soft px-1.5 py-0.5 text-xs text-fg shadow-lg",w&&"border-dashed opacity-60"),children:d.jsx("span",{className:"truncate font-medium tabular-nums",children:hn(p)})}),Ws=(p,w)=>{if(!o)return null;const A=sn("cal-1");return d.jsx("div",{"data-draft-block":"",className:j("pointer-events-auto absolute z-20 flex flex-col overflow-hidden rounded-sm px-1.5 py-0.5 text-xs shadow-md",o.tone==="draft"?j("border-2 border-dashed bg-surface/90",A.border,A.text):"bg-accent text-accent-fg",w),children:p})},Vs=o?.title===""?"New event":o?.title??"",zs=p=>d.jsx("span",{"data-handle":p,"aria-hidden":"true",onPointerDown:w=>fn(p,w),onPointerMove:Ue,onPointerUp:Fe,onPointerCancel:Bt,className:j("absolute inset-x-0 cursor-ns-resize",p==="start"?"top-0":"bottom-0",f?"h-6":"h-2"),style:{touchAction:"none"},children:f&&d.jsx("span",{className:j("absolute size-3 rounded-full border-2 border-accent bg-surface",p==="start"?"top-0 left-3 -translate-y-1/2":"right-3 bottom-0 translate-y-1/2")})}),oc=o?d.jsxs(d.Fragment,{children:[o.tone==="draft"&&d.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider",children:"Draft"}),d.jsxs("span",{className:"flex items-center gap-1 truncate font-medium",children:[o.warning&&d.jsx(Sa,{className:"size-3.5 shrink-0","aria-label":"Not saved"}),Vs]}),d.jsxs("span",{className:"tabular-nums opacity-90",children:[o.range.startTime," – ",o.range.endTime]}),o.handles&&d.jsxs(d.Fragment,{children:[zs("start"),zs("end")]})]}):null;return d.jsxs("div",{ref:Ee,"data-testid":"calendar-grid",className:j("flex h-full min-h-0 flex-col bg-surface text-fg select-none",R),children:[d.jsxs("div",{className:"flex shrink-0 border-b border-line",children:[d.jsx("div",{className:"flex w-14 shrink-0 items-end justify-end pr-2 pb-1 text-2xs text-fg-subtle",children:nE(s,i)}),d.jsx("div",{className:"grid flex-1",style:{gridTemplateColumns:`repeat(${t.length}, minmax(0, 1fr))`},children:t.map(p=>{const w=p===re.date;return d.jsxs("div",{className:"flex flex-col items-center gap-0.5 border-l border-line py-1",children:[d.jsx("span",{className:j("text-2xs font-medium uppercase tracking-wider",w?"text-accent":"text-fg-subtle"),children:St(p,{weekday:"short"})}),d.jsx("button",{type:"button",onClick:()=>u?.(p),"aria-label":St(p,{weekday:"long",day:"numeric",month:"long",year:"numeric"}),"aria-current":w?"date":void 0,className:j("flex size-9 items-center justify-center rounded-full text-xl tabular-nums outline-none focus-visible:ring-2 focus-visible:ring-ring",w?"bg-accent text-accent-fg":"text-fg hover:bg-surface-sunken"),children:Number(p.slice(8))})]},p)})})]}),d.jsxs("div",{className:"flex shrink-0 border-b border-line-strong",children:[d.jsx("div",{className:"flex w-14 shrink-0 items-start justify-end pt-1 pr-2 text-2xs text-fg-subtle",children:"All day"}),d.jsxs("div",{ref:D,"data-all-day-row":"",onPointerDown:ht,onPointerMove:Ue,onPointerUp:Fe,onPointerCancel:Bt,className:"relative flex-1",style:{height:F*mt+6},children:[d.jsx("div",{className:"pointer-events-none absolute inset-0 grid",style:{gridTemplateColumns:`repeat(${t.length}, minmax(0, 1fr))`},children:t.map(p=>d.jsx("div",{className:"border-l border-line"},p))}),oe.map(p=>{const w=_.get(p.id),A=q.get(p.id);return!w&&!A?null:d.jsx("div",{className:"absolute px-0.5",style:{left:`${p.startIndex/t.length*100}%`,width:`${p.span/t.length*100}%`,top:2+p.lane*mt,height:mt-2},children:w?ge(w,"row",!1):A&&ve(A.task,A.task.allDay?void 0:A.minute)},p.id)}),pe?.range.allDay&&(()=>{const p=Mr(t,[{id:"lifted",first:pe.range.date,last:pe.range.endDate}])[0];return p?d.jsx("div",{className:"absolute px-0.5",style:{left:`${p.startIndex/t.length*100}%`,width:`${p.span/t.length*100}%`,top:2,height:mt-2},children:Bs(pe.range,pe.invalid)}):null})(),ce&&d.jsx("div",{className:"absolute px-0.5",style:{left:`${ce.startIndex/t.length*100}%`,width:`${ce.span/t.length*100}%`,top:2+(F-1)*mt,height:mt-2},children:Ws(d.jsx("span",{className:"truncate font-medium",children:Vs}),"inset-0")})]})]}),d.jsx("div",{ref:T,role:"grid","aria-label":"Time grid","aria-activedescendant":ne?Ie:void 0,tabIndex:0,onKeyDown:ur,onFocus:p=>{p.target===p.currentTarget&&p.currentTarget.matches(":focus-visible")&&ae(!0)},onBlur:()=>ae(!1),className:"relative min-h-0 flex-1 overflow-y-auto outline-none",children:d.jsxs("div",{className:"flex",style:{height:24*x},children:[d.jsx("div",{className:"relative w-14 shrink-0","aria-hidden":"true",children:tE.slice(1).map(p=>d.jsxs("span",{className:"absolute right-2 -translate-y-1/2 text-2xs tabular-nums text-fg-subtle",style:{top:p*x},children:[Jr(p),":00"]},p))}),d.jsx("div",{ref:M,"data-time-columns":"",onPointerDown:dr,onPointerMove:Ue,onPointerUp:Fe,onPointerCancel:Bt,className:"relative grid flex-1",style:{gridTemplateColumns:`repeat(${t.length}, minmax(0, 1fr))`,touchAction:f?"pan-y":void 0,backgroundImage:`repeating-linear-gradient(to bottom, var(--color-line) 0 1px, transparent 1px ${x}px)`},children:t.map(p=>{const w=Jb(p,Ge.map(L=>({id:L.event.id,start:L.start,end:L.end}))),A=o&&!o.range.allDay&&o.range.date===p?Xr(o.range):void 0;return d.jsxs("div",{"data-date":p,className:"relative border-l border-line",children:[w.map(L=>{const z=_.get(L.id);if(!z)return null;const Y=(L.bottom-L.top)/60*x;return d.jsx("div",{className:"absolute px-px",style:{top:L.top/60*x,height:Math.max(Y,12),left:`${L.column/L.columns*100}%`,width:`${100/L.columns}%`},children:ge(z,"column",Y>=36)},L.id)}),p===re.date&&d.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute right-0 left-0 z-10 border-t-2 border-danger",style:{top:re.minute/60*x},children:d.jsx("span",{className:"absolute -top-[5px] -left-1 size-2 rounded-full bg-danger"})}),ne&&he.date===p&&d.jsx("div",{role:"row",tabIndex:-1,className:"pointer-events-none absolute right-0 left-0 z-30",style:{top:he.minute/60*x,height:x/4},children:d.jsx("div",{id:Ie,role:"gridcell",tabIndex:-1,"aria-label":ma(Ke(he.date,he.minute)).replace(/ to .*/,""),className:"h-full rounded-xs ring-2 ring-ring"})}),pe&&!pe.range.allDay&&pe.range.date===p&&(()=>{const L=Xr(pe.range);return d.jsx("div",{className:"absolute right-1 left-0",style:{top:L.start/60*x,height:Math.max((L.end-L.start)/60*x,12)},children:Bs(pe.range,pe.invalid)})})(),A&&d.jsx("div",{className:"absolute right-1 left-0",style:{top:A.start/60*x,height:(A.end-A.start)/60*x},children:Ws(oc,"inset-0")})]},p)})})]})}),d.jsx("div",{"aria-live":"polite",className:"sr-only",children:le})]})}function En(t,e){try{t.setPointerCapture(e)}catch{}}function pa(t){const e=t.end.slice(0,10);if(!t.allDay)return e;const[n,r,s]=e.split("-").map(Number),a=new Date(Date.UTC(n,r-1,s-1)).toISOString().slice(0,10);return a<t.start.slice(0,10)?t.start.slice(0,10):a}function sE(t,e){if(t.allDay)return"all day";const n=Se(t.start,e),r=Se(t.end,e);return`${Et(n.minute)} to ${Et(r.minute)}`}function iE(t){return j("flex cursor-pointer items-center justify-center rounded-md px-2 font-medium transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",t?"bg-accent-2-soft text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg")}function aE({options:t,value:e,onChange:n,touch:r,ariaLabel:s,className:i}){const a=S.useId();return d.jsxs("fieldset",{className:j("inline-flex items-center gap-0.5",i),children:[d.jsx("legend",{className:"sr-only",children:s}),t.map(o=>d.jsxs("label",{className:j(iE(e===o.value),r?"min-h-11 flex-1 text-sm":"h-7 text-xs"),children:[d.jsx("input",{type:"radio",name:a,value:o.value,checked:e===o.value,onChange:()=>n(o.value),className:"sr-only"}),r?o.shortLabel:o.label]},o.value))]})}const Us=t=>{const[e,n,r]=t.split("-").map(Number);return new Date(Date.UTC(e,n-1,r))},ec=t=>t.toISOString().slice(0,10);function tn(t){const e=Us(t);return e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+6)%7),ec(e)}function nn(t,e){const n=Us(t);return Array.from({length:e},(r,s)=>{const i=new Date(n);return i.setUTCDate(n.getUTCDate()+s),ec(i)})}const Be=(t,e,n)=>new Intl.DateTimeFormat(n,{...e,timeZone:"UTC"}).format(Us(t));function oE(t,e,n){if(t==="year")return Be(e,{year:"numeric"},n);if(t==="day")return Be(e,{weekday:"long",day:"numeric",month:"long",year:"numeric"},n);if(t!=="week")return Be(e,{month:"long",year:"numeric"},n);const[r,,,,,,s]=nn(tn(e),7);return r.slice(0,7)===s.slice(0,7)?Be(r,{month:"long",year:"numeric"},n):r.slice(0,4)===s.slice(0,4)?`${Be(r,{month:"short"},n)} – ${Be(s,{month:"short",year:"numeric"},n)}`:`${Be(r,{month:"short",year:"numeric"},n)} – ${Be(s,{month:"short",year:"numeric"},n)}`}const va=864e5,lE=t=>{const[e,n,r]=t.split("-").map(Number);return new Date(Date.UTC(e,n-1,r))};function tc(t){const e=lE(t),n=(e.getUTCDay()+6)%7,r=new Date(e.getTime()+(3-n)*va),s=Date.UTC(r.getUTCFullYear(),0,1);return Math.floor((r.getTime()-s)/va/7)+1}function es(t,e){const[n,r]=t.split("-").map(Number),s=n*12+(r-1)+e,i=Math.floor(s/12),a=s%12+1;return`${i}-${String(a).padStart(2,"0")}-01`}function cE({month:t,today:e,rangeStart:n,rangeEnd:r}){const s=`${t.slice(0,7)}-01`,i=es(s,1),a=[];let o=tn(s);for(;o<i;){const l=nn(o,7).map(c=>({date:c,day:Number(c.slice(8)),inMonth:c.slice(0,7)===s.slice(0,7),isToday:c===e,inRange:n!==""&&c>=n&&c<=r}));a.push({weekNumber:tc(o),days:l}),o=nn(o,8)[7]}return a}const dE=["M","T","W","T","F","S","S"],ya=t=>new Intl.DateTimeFormat(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric",timeZone:"UTC"}).format(new Date(`${t}T00:00:00Z`)),uE=t=>new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric",timeZone:"UTC"}).format(new Date(`${t.slice(0,7)}-01T00:00:00Z`));function nc({month:t,today:e,rangeStart:n="",rangeEnd:r="",onPickDay:s,onShowMonth:i,counts:a,className:o}){const l=cE({month:t,today:e,rangeStart:n,rangeEnd:r}),c=uE(t);return d.jsxs("section",{"aria-label":c,className:j("select-none",o),children:[d.jsxs("div",{className:"flex items-center justify-between px-1 pb-1",children:[d.jsx("h2",{className:"text-sm font-medium text-fg",children:c}),i&&d.jsxs("div",{className:"flex",children:[d.jsx("button",{type:"button","aria-label":"Previous month",onClick:()=>i(es(t,-1)),className:"flex size-7 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:d.jsx(Ia,{className:"size-4"})}),d.jsx("button",{type:"button","aria-label":"Next month",onClick:()=>i(es(t,1)),className:"flex size-7 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:d.jsx(Vn,{className:"size-4"})})]})]}),d.jsxs("table",{className:"w-full border-collapse text-center text-2xs",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"text-fg-subtle",children:[d.jsx("th",{scope:"col",className:"w-6 font-normal",children:d.jsx("span",{className:"sr-only",children:"Week"})}),dE.map((u,f)=>d.jsx("th",{scope:"col",className:"h-6 font-normal",children:u},f))]})}),d.jsx("tbody",{children:l.map(u=>d.jsxs("tr",{children:[d.jsx("th",{scope:"row",className:"font-normal text-fg-subtle tabular-nums",children:u.weekNumber}),u.days.map(f=>{const h=a?.[f.date]??0,g=a===void 0?ya(f.date):`${ya(f.date)}, ${h===1?"1 event":`${h} events`}`;return d.jsx("td",{className:j("p-0",f.inRange&&"bg-accent-soft"),children:d.jsxs("button",{type:"button","aria-label":g,"aria-current":f.isToday?"date":void 0,"data-date":f.date,onClick:()=>s(f.date),className:j("relative mx-auto flex size-7 items-center justify-center rounded-full tabular-nums outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",f.isToday?"bg-accent font-semibold text-accent-fg":"hover:bg-surface-sunken",!f.isToday&&!f.inMonth&&"text-fg-subtle"),children:[f.day,h>0&&!f.isToday&&d.jsx("span",{"aria-hidden":"true",className:"absolute bottom-0.5 size-1 rounded-full bg-accent"})]})},f.date)})]},u.days[0].date))})]})]})}const fE=Array.from({length:12},(t,e)=>String(e+1).padStart(2,"0"));function hE({date:t,today:e,counts:n,onPickDay:r,className:s}){const i=t.slice(0,4);return d.jsx("div",{"data-calendar-year":"",className:j("grid h-full content-start gap-x-8 gap-y-6 overflow-y-auto p-6 [grid-template-columns:repeat(auto-fill,minmax(15rem,1fr))]",s),children:fE.map(a=>d.jsx(nc,{month:`${i}-${a}-01`,today:e,onPickDay:r,counts:n},a))})}function gE(){const t=dc(),{updateEvent:e}=Ec();return S.useCallback(async(n,r,s,i)=>{const{calendarObjectId:a,recurrenceId:o}=Da(n.id),l=await t.fetchQuery({...fc({path:{calendarObjectId:a},query:{calendarId:n.calendarId}}),meta:uc(404),staleTime:0}).catch(h=>({unread:gd(h)}));if("unread"in l)return{kind:"refused",message:l.unread};const c=Dd(n,{repeat:"",location:"",notes:"",guests:[]}),u={...c,date:r.date,endDate:r.endDate,startTime:r.startTime,endTime:r.endTime,allDay:r.allDay},f=xd(c,u,{clock:vt(),anchor:Mc(l.icalData,i===""?Sc:i)});return f.ok?e({calendarObjectId:a,calendarId:n.calendarId,recurrenceId:o,scope:s,etag:l.etag},f.patch):{kind:"refused",message:f.problem}},[t,e])}const wt={mode:"idle",dragging:null},Fs=t=>({mode:"quick",dragging:null,draft:t,status:"editing",problem:""}),rn=t=>({range:t,title:"",location:"",calendarId:"",guests:[]});function rc(t,e){return t.dragging?"drag":t.mode==="quick"?"popup":e.eventPopup?"event-popup":e.sidebar?"sidebar":e.nav?"nav":null}function mE(t,e){return t.mode==="quick"?{...t,dragging:null,draft:{...t.draft,range:e},status:t.status==="saving"?"saving":"editing"}:t.mode==="sidebar"?{...t,dragging:null,draft:{...t.draft,range:e}}:Fs(rn(e))}function pE(t,e,n){switch(e.type){case"drag":return{...t,dragging:e.range};case"drag-cancel":return{...t,dragging:null};case"drag-end":case"keyboard":return n.sidebar&&t.mode!=="sidebar"?{mode:"sidebar",dragging:null,draft:rn(e.range)}:mE(t,e.range);case"click":return t.mode==="quick"?wt:t.mode==="sidebar"||n.sidebar?{...t,dragging:null}:n.eventPopup?{...t,dragging:null}:Fs(rn(e.range))}}function vE(t,e){switch(e.type){case"gesture":return pE(t,e.gesture,e.layers);case"new-event":return Fs(rn(e.range));case"outside":return t.mode==="quick"?wt:t;case"escape":{const n=rc(t,e.layers);return n==="drag"?{...t,dragging:null}:n==="popup"?wt:t}case"change":return t.mode==="idle"?t:{...t,draft:e.draft};case"save":return t.mode!=="quick"?t:{...t,status:"saving",problem:""};case"saved":return wt;case"save-failed":return t.mode!=="quick"?t:{...t,status:"failed",problem:e.problem};case"expand":return t.mode!=="quick"?t:{mode:"sidebar",dragging:null,draft:t.draft};case"sidebar-range":return t.mode==="sidebar"?{...t,draft:{...t.draft,range:e.range}}:{mode:"sidebar",dragging:null,draft:rn(e.range)};case"sidebar-closed":return t.mode==="sidebar"?wt:t}}function yE(t){return t.dragging?t.dragging:t.mode==="idle"?null:t.draft.range}const bE="[data-calendar-popover], [data-event-id], [data-task-id], [data-time-columns], [data-all-day-row], [role='dialog']";function EE({layers:t,isPhone:e,closeToView:n,closeNav:r,drawnEvents:s}){const[i,a]=S.useReducer(vE,wt),o=S.useRef({session:i,layers:t,isPhone:e,closeToView:n,closeNav:r});o.current={session:i,layers:t,isPhone:e,closeToView:n,closeNav:r};const l=S.useRef(null),c=S.useRef(null),u=S.useRef(""),f=S.useRef(!1),h=S.useRef(!1),[g,v]=S.useState(""),m=S.useCallback(x=>{const T=o.current,M=T.session.mode==="idle";if(T.isPhone&&x.type==="click"&&M&&!T.layers.eventPopup)return;(x.type==="click"||x.type==="drag-end"||x.type==="keyboard")&&T.layers.eventPopup&&T.closeToView(),M&&(x.type==="click"||x.type==="keyboard")&&(l.current=x.origin),M&&x.type==="drag-end"&&(l.current=document.querySelector("[role='grid'][aria-label='Time grid']")),a({type:"gesture",gesture:x,layers:T.layers})},[]);S.useEffect(()=>{const x=M=>{M.target instanceof Element&&(M.target.closest(bE)||(o.current.layers.eventPopup&&o.current.closeToView(),a({type:"outside"})))},T=M=>{if(M.key!=="Escape"||M.defaultPrevented)return;const{session:D,layers:N}=o.current,P=rc(D,N);P===null||P==="drag"||(M.preventDefault(),P==="event-popup"?o.current.closeToView():P==="sidebar"?c.current?.():P==="nav"?o.current.closeNav():a({type:"escape",layers:N}))};return document.addEventListener("pointerdown",x,!0),window.addEventListener("keydown",T),()=>{document.removeEventListener("pointerdown",x,!0),window.removeEventListener("keydown",T)}},[]),S.useEffect(()=>{const x=i.mode==="quick";h.current&&i.mode==="idle"&&!f.current&&l.current?.focus(),x&&(f.current=!1),h.current=x},[i.mode]),S.useEffect(()=>{if(g===""||s.length===0)return;const x=document.querySelector(`[data-event-id^="${CSS.escape(g)}"]`);x&&(x.focus(),v(""))},[g,s]);const E=t.sidebar;S.useEffect(()=>{E||a({type:"sidebar-closed"})},[E]);const C=S.useCallback(x=>{l.current=x},[]),R=S.useCallback(x=>{f.current=!0,v(x)},[]);return{session:i,dispatch:a,takeGesture:m,setOrigin:C,requestClose:c,carriedFocus:u,focusSaved:R}}const sc="remit:calendar-side-pane";function SE(){try{return localStorage.getItem(sc)!=="closed"}catch{return!0}}function wE(t){try{localStorage.setItem(sc,t?"open":"closed")}catch{}}function DE(t,e){return t.includes("sidebar")?!0:!t.some(r=>r!=="intelligence")&&e}function xE(t){const e=Oc(),n=Ac(),[r,s]=S.useState(SE),i=!t&&DE(e,r),a=t&&e.includes("nav"),o=S.useCallback(()=>{if(t){n(Xs(e,a?void 0:"nav"));return}const c=!i;wE(c),s(c);const u=e.filter(f=>f!=="sidebar");n(c?[...u,"sidebar"]:u)},[t,a,i,e,n]),l=S.useCallback(c=>{n(Xs(e,c?"nav":void 0))},[e,n]);return{open:i,toggle:o,navOpen:a,setNavOpen:l}}const ic="remit:calendar-density",ba="comfortable";function CE(){try{return localStorage.getItem(ic)==="compact"?"compact":ba}catch{return ba}}function TE(t){try{localStorage.setItem(ic,t)}catch{}}const RE=t=>t==="compact"?"pills":"detail";function NE({days:t,calendars:e,density:n,today:r,anchorDate:s,now:i,selectedEventId:a,freeOn:o,loadingDates:l,error:c,onRetry:u,scrollTarget:f,onSelectEvent:h,onPickSlot:g,onZoomDay:v,onGoToDate:m,onReachStart:E,onReachEnd:C,atStartCap:R,atEndCap:x,onLoadEarlier:T,onLoadLater:M,onVisibleDayChange:D}){const N=S.useMemo(()=>fd(t,i),[t,i]),P=!l.has(r);return c!=null?d.jsx("div",{className:"flex h-full items-center justify-center bg-surface",children:d.jsx(md,{title:"Couldn't load these days",error:c,onRetry:u})}):d.jsx(Qf,{days:t,calendars:e,density:RE(n),today:r,focusDate:s,selectedEventId:a,freeOn:o,loadingDates:l,scrollTarget:f,onSelectEvent:h,onPickSlot:g,onZoomDay:v,onReachStart:E,onReachEnd:C,atStartCap:R,atEndCap:x,onLoadEarlier:T,onLoadLater:M,onVisibleDayChange:D,todayLead:P?d.jsx("div",{className:"border-b border-line bg-surface-sunken p-3",children:d.jsx(dh,{nextUp:N,calendars:e,today:r,onSelectEvent:h,onGoTo:m})}):void 0})}const ME=400;function IE({density:t,onPickSlot:e}){const{date:n,calendarIds:r}=ts(),{openEvent:s,setAnchorDate:i,zoomToDay:a}=ns(),o=Ta(),[l]=S.useState(()=>new Date),c=S.useMemo(()=>Rn(l),[l]),u=S.useMemo(()=>l.toISOString(),[l]),[f,h]=S.useState(()=>Fc(n)),[g,v]=S.useState(),[m,E]=S.useState(n),C=S.useRef(0),R=S.useRef(n),x=S.useCallback(F=>{R.current=F,E(F),h(de=>Bc(de,F)),C.current+=1,v({date:F,token:C.current})},[]);S.useEffect(()=>{n!==R.current&&x(n)},[n,x]);const T=sd(m,ME);S.useEffect(()=>{T!==R.current&&(R.current=T,i(T))},[T,i]);const M=S.useMemo(()=>Wc(f),[f]),D=S.useMemo(()=>Vc(M),[M]),{calendars:N,timeZoneByCalendarId:P,shown:H,narrowed:U,resolved:te,isLoading:W}=Ic(r),V=wc(D,U,te),ne=Dc(D),ae=kc(V.instances,P,H),le=S.useMemo(()=>M.map(F=>hd(F,ae,c)),[M,ae,c]),Pe=S.useMemo(()=>{const F=new Set;if(W||!te)return new Set(M);for(const de of M)V.pendingWindows.has(Ks(de))&&F.add(de);return F},[M,V.pendingWindows,W,te]),Ie=S.useMemo(()=>zc(M,ne.spans),[M,ne.spans]),re=S.useCallback(F=>ne.pendingWindows.has(Ks(F.date))?Pr(F):Ie.get(F.date)??Pr(F),[Ie,ne.pendingWindows]),xe=S.useCallback(F=>{x(F),i(F)},[x,i]),Ge=S.useCallback(F=>{const de=Da(F);s(de.calendarObjectId,de.recurrenceId)},[s]),Ze=S.useCallback(()=>h($c),[]),_=S.useCallback(()=>h(Yc),[]),q=S.useCallback(()=>h(Gc),[]),oe=S.useCallback(()=>h(Zc),[]),ce=S.useCallback(()=>{V.refetch(),ne.refetch()},[V.refetch,ne.refetch]);return d.jsx(NE,{days:le,calendars:N,density:t,today:c,anchorDate:n,now:u,selectedEventId:o?xa(o.calendarObjectId,o.recurrenceId??""):"",freeOn:re,loadingDates:Pe,error:V.error??ne.error,onRetry:ce,scrollTarget:g,onSelectEvent:Ge,onPickSlot:e,onZoomDay:a,onGoToDate:xe,onReachStart:Ze,onReachEnd:_,atStartCap:Xc(f),atEndCap:qc(f),onLoadEarlier:q,onLoadLater:oe,onVisibleDayChange:E})}const ac="calendar-side-pane";function kE(t,e){if(t==="day")return[e,e];if(t==="week"){const n=nn(tn(e),7);return[n[0],n[6]]}return["",""]}function Ea({onNewEvent:t,newEventRef:e,onPicked:n,className:r}){const{view:s,date:i,calendarIds:a}=ts(),{goToDate:o,setCalendarIds:l}=ns(),{calendars:c,error:u,retry:f}=Ca(),[h,g]=S.useState({for:i,month:i}),v=h.for===i?h.month:i,[m,E]=kE(s,i),C=new Set(Pc(c,a)),R=x=>{const T=new Set(C);T.has(x)?T.delete(x):T.add(x),l(T.size===c.length?[]:c.map(M=>M.id).filter(M=>T.has(M)))};return d.jsx(Wb,{id:ac,className:r,onNewEvent:t,newEventRef:e,month:d.jsx(nc,{month:v,today:Rn(new Date),rangeStart:m,rangeEnd:E,onPickDay:x=>{o(x),n?.()},onShowMonth:x=>g({for:i,month:x})}),calendars:u!==null&&c.length===0?d.jsx(jr,{title:"Couldn't load your calendars",error:u,onRetry:f,compact:!0}):d.jsx(_b,{calendars:c,visible:C,onToggle:R,onToggleAccount:(x,T)=>{const M=new Set(c.filter(N=>N.accountId===x).map(N=>N.id)),D=c.map(N=>N.id).filter(N=>M.has(N)?T:C.has(N));l(D.length===c.length?[]:D)}})})}const PE="This calendar changed while you were writing.",jE=(t,e)=>{if(e.allDay)return{...t,start:`${e.date}T00:00:00`,end:`${HE(e.endDate)}T00:00:00`};const n=vt();return{...t,start:Gs(e.date,e.startTime,n),end:Gs(e.endDate,e.endTime,n)}};function HE(t){const[e,n,r]=t.split("-").map(Number);return new Date(Date.UTC(e,n-1,r+1)).toISOString().slice(0,10)}function OE(t,e,n,r){const s=gE(),[i,a]=S.useState(()=>new Map),[o,l]=S.useState(),[c,u]=S.useState(),f=S.useRef(null),h=S.useMemo(()=>new Set(e.filter(R=>R.readOnly).map(R=>R.id)),[e]),g=S.useCallback((R,x)=>{l(void 0),u(void 0),a(T=>new Map(T).set(R.event.id,R.range)),s(R.event,R.range,x,n[R.event.calendarId]??"").then(T=>{a(M=>{const D=new Map(M);return D.delete(R.event.id),D}),T.kind!=="written"&&(u({text:T.kind==="conflict"?PE:`Couldn't move ${R.event.title}: ${T.message}`,retry:()=>g(R,x),conflict:T.kind==="conflict"}),requestAnimationFrame(()=>f.current?.focus()))})},[s,n]),v=S.useCallback((R,x)=>{const T=t.find(D=>D.id===R);if(!T)return;const M={event:T,range:x};if(T.seriesId!==""){l(M);return}g(M,void 0)},[t,g]),m=S.useMemo(()=>i.size===0?t:t.map(R=>{const x=i.get(R.id);return x?jE(R,x):R}),[t,i]),E=c&&d.jsxs("div",{className:"flex items-start gap-2 border-b border-line px-3 py-2",children:[d.jsx("div",{className:"min-w-0 flex-1",children:d.jsx(ka,{focusRef:f,failure:{text:c.text,reportHref:Ir(c.text),onRetry:c.conflict?()=>{u(void 0),r()}:c.retry,retryLabel:c.conflict?"Reload the week":void 0}})}),d.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>u(void 0),className:"flex size-8 items-center justify-center rounded-full text-fg-muted hover:bg-surface-sunken",children:d.jsx(hc,{className:"size-4"})})]}),C=d.jsx(wa,{open:o!==void 0,onClose:()=>l(void 0),title:"Move a repeating event",children:o&&d.jsx(jc,{title:o.event.title,ruleText:"It repeats",instanceText:wd(o.event),onChoose:R=>g(o,R),onCancel:()=>l(void 0)})});return{events:m,canMove:R=>{const x=t.find(T=>T.id===R);return x!==void 0&&!h.has(x.calendarId)},onMoveEvent:v,banner:E,prompt:C}}function AE({suggestions:t,busy:e,failure:n,reportHref:r,addBlocked:s,onAdd:i,onChangeFirst:a,onDismiss:o}){return d.jsxs("aside",{"aria-label":"Waiting for you",className:"hidden w-72 shrink-0 flex-col gap-2 overflow-y-auto border-r border-line bg-surface-sunken py-3 lg:flex",children:[d.jsxs("h3",{className:"flex items-center gap-1.5 px-row-inset text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:[d.jsx(gc,{className:"size-3","aria-hidden":!0}),"Waiting for you"]}),n!==""&&d.jsx(Cd,{text:n,reportHref:r,className:"mx-row-inset"}),s!==void 0&&d.jsx("div",{className:"mx-row-inset rounded-md border border-warning/40 bg-warning-soft p-2 text-xs text-fg",children:s}),d.jsx(Kc,{className:"px-row-inset",items:t.map(({suggestion:l,whenText:c})=>({id:l.id,card:d.jsx(Qc,{suggestion:l,whenText:c,onAdd:()=>i(l.id),onReview:a&&(()=>a(l.id)),onDismiss:()=>o(l.id),addLabel:"Add to calendar",busy:e,addBlocked:s!==void 0})}))}),d.jsx("p",{className:"px-row-inset text-2xs text-fg-subtle",children:"None of this is on your calendar until you add it. Adding sends the organiser nothing."})]})}const LE=(t,e)=>e.kind==="refused"?`Couldn't ${t}: ${e.message}`:"";function _E({onChangeFirst:t}){const{suggestions:e,error:n}=xc(),r=Ca(),{defaultCalendarId:s}=r,i=Cc(),[a,o]=S.useState(""),l=e.map(m=>({suggestion:ed(m,{threadId:"",threadSubject:"",calendarId:s,sender:m.organizer===""?"From your mail":m.organizer}),whenText:Jc(m)})),c=n===null?"":"Couldn't read what your mail is waiting on.";if(l.length===0&&c===""&&a==="")return null;const u=Tc(c||a||"pending invitations could not be answered"),f=m=>{const E=e.find(C=>C.suggestionId===m);E&&t(m,rd(E))},h=m=>{const E=e.find(C=>C.suggestionId===m);return E?.zoneCertainty==="Ambiguous"&&E.method!=="Cancel"},g=e[0]?.method==="Cancel",v=(m,E)=>{o(""),E().then(C=>o(LE(m,C)))};return d.jsx(AE,{suggestions:l,busy:i.isAnswering,failure:c||a,reportHref:u,addBlocked:td(nd(r),u),onAdd:m=>{if(h(m)){f(m);return}v("add this to your calendar",()=>i.accept(m,s))},onChangeFirst:g?void 0:f,onDismiss:m=>v("dismiss this",()=>i.dismiss(m,!1))})}const UE=["day","month","agenda"],FE=[{value:"comfortable",label:"Detail",shortLabel:"Detail"},{value:"compact",label:"Glance",shortLabel:"Glance"}],BE={year:"Couldn't load this year",month:"Couldn't load this month",week:"Couldn't load this week",day:"Couldn't load this day",agenda:"Couldn't load these days"};function WE({isPhone:t,detail:e}){const{view:n,date:r,calendarIds:s}=ts(),i=!Zs(n),{events:a,calendars:o,timeZoneByCalendarId:l,colorByCalendarId:c,isLoading:u,error:f,retry:h,instanceOf:g,tasks:v,storedTasks:m}=Hc({view:n,date:r,calendarIds:s,enabled:i}),{updateTask:E}=Nc(),[C,R]=S.useState(),x=S.useCallback(function Z(he){const ge=m.find(ve=>ve.calendarTaskId===he);if(!ge)throw new Error(`task ${he} is drawn but was not read`);R(void 0),E(ge,{completed:!ge.completed}).then(ve=>{if(ve.kind==="written")return;const hn=`Couldn't save "${ge.summary}": ${ve.message}`;R({text:hn,reportHref:Ir(hn),onRetry:()=>Z(he)})})},[m,E]),[T,M]=S.useState([]),D=S.useCallback(Z=>M([...Z]),[]),N=Rc(T),P=T.filter(Z=>Z.method==="Cancel").map(Z=>Z.email),H=OE(a,o,l,h),U=H.events,{goToView:te,goToToday:W,goToDate:V,openEvent:ne,openTask:ae,openNewEvent:le,closeToView:Pe,changeSuggestionFirst:Ie,zoomToDay:re,dayHref:xe}=ns(),Ge=Lc(),Ze=Ta(),_=Ge?void 0:Ze,q=_c(),oe=Uc(),[ce,F]=S.useState(CE),de=S.useCallback(Z=>{TE(Z),F(Z)},[]),je=S.useCallback(Z=>{const he=g(Z);ne(he.calendarObjectId,he.recurrenceId)},[g,ne]),ut=oe,Ee=xE(t),{session:Q,dispatch:Ce,takeGesture:ft,setOrigin:pe,requestClose:_t,carriedFocus:Te,focusSaved:Re}=EE({layers:{eventPopup:_!==void 0||q!==void 0,sidebar:oe,nav:Ee.navOpen},isPhone:t,closeToView:Pe,closeNav:()=>Ee.setNavOpen(!1),drawnEvents:U}),qe=S.useCallback(Z=>{Q.mode==="quick"&&(Te.current=Z,Ce({type:"expand"}),le(mc(Q.draft.range,vt())))},[Q,Te,Ce,le]),dn=S.useMemo(()=>({session:Q,dispatch:Ce,requestClose:_t,carriedFocus:Te,focusSaved:Re,trackSends:D}),[Q,Ce,_t,Te,Re,D]),He=yE(Q),un=He?{range:He,title:Q.mode==="idle"?"":Q.draft.title,tone:Q.mode==="sidebar"&&!Q.dragging?"draft":"selection",warning:Q.mode==="quick"&&Q.status==="failed",handles:Q.mode==="sidebar"}:void 0,Ut=new Date().toISOString(),ue=vc(n,t),Ft=Z=>Ce({type:"new-event",range:Z}),dr=S.useMemo(()=>{const Z={};if(ue!=="year")return Z;const he=vt();for(const ge of U){const ve=ge.allDay?ge.start.slice(0,10):Se(ge.start,he).date;Z[ve]=(Z[ve]??0)+1}for(const ge of v){const ve=ge.allDay?ge.due.slice(0,10):Se(ge.due,he).date;Z[ve]=(Z[ve]??0)+1}return Z},[U,v,ue]),ht=ue==="day"?[r]:ue==="week"?nn(tn(r),7):void 0,fn=_?xa(_.calendarObjectId,_.recurrenceId??""):"",Ue=S.useRef(null),Fe=S.useCallback(()=>{const Z=Rn(new Date),he=new Date().getHours()*60,ve=Kr(ht??[r],Z,he);pe(document.activeElement instanceof HTMLElement?document.activeElement:Ue.current),_&&Pe(),Ce({type:"new-event",range:Ke(ve.date,ve.minute)})},[ht,r,_,Pe,pe,Ce]),Bt=ue==="week"||ue==="day"?tc(ue==="week"?tn(r):r):void 0,ur=Zs(n)?d.jsx(IE,{density:ce,onPickSlot:Ft}):f!=null?d.jsx(jr,{title:BE[n],error:f,onRetry:h}):u?d.jsx("div",{role:"status","aria-label":"Loading the calendar",className:"flex h-full items-center justify-center bg-surface",children:d.jsx(pc,{className:"size-6 animate-spin text-fg-subtle"})}):ue==="year"?d.jsx(hE,{date:r,today:Rn(new Date),counts:dr,onPickDay:re}):ht?d.jsx(rE,{days:ht,events:U,colorByCalendarId:c,density:ce,timeZone:vt(),now:Ut,selectedEventId:fn,draft:un,onGesture:ft,onSelectEvent:je,onOpenDay:re,touch:t,canMove:H.canMove,onMoveEvent:H.onMoveEvent,tasks:v,selectedTaskId:q??"",onSelectTask:ae,onToggleTask:x}):d.jsx(Ab,{date:r,events:U,colorByCalendarId:c,density:ce,selectedEventId:fn,timeZone:vt(),now:Ut,onSelectEvent:je,onPickSlot:Ft,dayHref:xe,onZoomDay:re,canMove:H.canMove,onMoveEvent:H.onMoveEvent,tasks:v,onSelectTask:ae});return d.jsxs(Sd.Provider,{value:dn,children:[d.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-surface text-fg",children:[d.jsx(Bb,{view:ue,views:t?UE:void 0,title:t&&ue==="day"?new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short",timeZone:"UTC"}).format(new Date(`${r}T00:00:00Z`)):oE(ue,r),weekNumber:Bt,onChangeView:te,onPrev:()=>V(qs(r,ue,-1)),onNext:()=>V(qs(r,ue,1)),onToday:W,touch:t,sidePane:{open:t?Ee.navOpen:Ee.open,controls:ac,onToggle:Ee.toggle},trailing:ue==="week"||ue==="day"?d.jsx(aE,{ariaLabel:"Calendar density",options:FE,value:ce,onChange:de,touch:t,className:"shrink-0"}):void 0}),d.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[Ee.open&&d.jsx(Ea,{onNewEvent:Fe,newEventRef:Ue}),!(t&&ut)&&d.jsxs(d.Fragment,{children:[t&&Q.mode==="idle"&&d.jsx(oa,{onNewEvent:Fe,newEventRef:Ue,className:"fixed right-4 bottom-[calc(var(--app-tab-bar,0px)+1rem)] z-30 size-14 rounded-full"}),!Ee.open&&!t&&d.jsx(oa,{onNewEvent:Fe,newEventRef:Ue,className:"absolute top-2 left-2 z-20"}),!oe&&d.jsx(_E,{onChangeFirst:Ie}),d.jsxs("div",{"data-calendar-body":"",className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[H.banner,P.length>0&&d.jsx("div",{className:"p-2",children:d.jsx(Nd,{guests:P,onDismiss:()=>M([])})}),C&&d.jsx("div",{className:"p-2",children:d.jsx(ka,{failure:C})}),N.checkError!==null&&d.jsx("div",{className:"p-2",children:d.jsx(jr,{title:`Couldn't check whether the messages to ${N.unchecked.join(", ")} went out`,error:N.checkError,onRetry:N.recheck,compact:!0})}),N.missed.length>0&&d.jsx("div",{className:"p-2",children:d.jsx(Md,{missed:N.missed,onRetry:()=>{N.retry()},reportHref:Ir(`Invitations not sent to ${N.missed.join(", ")}`),onDismiss:()=>M([])})}),ur]})]}),!ut&&e,Q.mode==="quick"&&d.jsx(Ed,{session:Q,dispatch:Ce,onMoreOptions:qe,onSaved:Re,touch:t}),ut&&d.jsx("aside",{"aria-label":"Event",className:t?"min-h-0 min-w-0 flex-1":"w-[26rem] shrink-0 border-l border-line",children:e})]})]}),H.prompt,t&&d.jsx(wa,{open:Ee.navOpen,onClose:()=>Ee.setNavOpen(!1),title:"Calendars",anchor:"left",children:d.jsx(Ea,{onNewEvent:Fe,onPicked:()=>Ee.setNavOpen(!1),className:"w-full"})})]})}function DS(){const t=Id()==="phone";return d.jsx(WE,{isPhone:t,detail:d.jsx(yc,{})})}export{DS as component};
1
+ import{b as Wn,r as S,j as d,p as j,x as Vn,ch as lc,ci as Yt,aj as Ys,at as cc,ag as Sa,e as dc,s as uc,cj as fc,ck as Rn,X as hc,aE as wa,cl as Gs,S as gc,cm as mc,cn as Zs,L as pc,co as qs,cp as vc,O as yc}from"./index-DAdnmNGF.js";import{d as sn,M as bc,e as Ec,r as Da,f as vt,U as Sc,g as wc,h as Dc,i as xa,b as Ca,c as Ir,j as xc,k as Cc,l as Tc}from"./useCalendarSuggestions-p-hH5nuf.js";import{a as Rc}from"./useCalendarScheduling-CdGHvRHZ.js";import{u as Nc}from"./useCalendarTasks-DMazKBtK.js";import{s as Mc,u as Ic,a as kc,b as Pc,R as jc,c as Hc}from"./useCalendarData-Dw0DbJWn.js";import{a as Oc,b as Ac,p as Xs}from"./nav-link-DsF82VIK.js";import"./reply-iVDGWyKD.js";import{a as ts,b as ns,c as Ta,d as Lc,e as _c,u as Uc}from"./calendar-DWDr32Pg.js";import{C as Ra,a as Na,c as kr,r as Fc,b as Bc,d as Wc,w as Vc,e as Ks,f as zc,g as $c,h as Yc,l as Gc,i as Zc,j as qc,k as Xc,m as Kc,E as Qc,s as Jc,t as ed,n as td,o as nd,p as rd}from"./calendar-suggestion-k_ABH6QD.js";import{u as sd}from"./useDebouncedValue-C9NNbS8g.js";import{b as id,w as ad,m as od,f as Pr,a as ld,g as cd,c as Gt,d as ze,e as dd,D as fr,h as Qs,i as nt,j as ke,k as ud,r as fd,l as hd}from"./agenda-time-jh144Gvm.js";import{f as gd,E as md}from"./ErrorState-BTTbYobA.js";import{C as pd}from"./clock-Nfb5MDhL.js";import{C as jr}from"./CalendarLoadFailed-C47ken4G.js";import{P as Ma}from"./plus-B59D825u.js";import{C as vd,A as yd}from"./account-service-status-DfJaPtgF.js";import{C as bd}from"./chevron-down-pXHA84n5.js";import{C as Ia}from"./chevron-left-BahGQZIk.js";import{C as Ed}from"./CalendarQuickCreate-Icz8bbCP.js";import{C as Sd}from"./CalendarSession-B6dbruSb.js";import{f as wd}from"./calendar-format-BwCpz-JZ.js";import{d as Dd,p as xd}from"./draft-Cd-2kcmd.js";import{C as ka}from"./calendar-event-popup-PVY1kYQF.js";import{C as Cd}from"./calendar-failure-note-BVioFwWu.js";import{S as Td}from"./select-C4OaQe9Y.js";import{M as Rd}from"./menu-0smgSLZN.js";import{a as Nd,b as Md}from"./calendar-guests-BqL_oNsB.js";import{u as Id}from"./useLayoutTier-D0BFfVm6.js";import"./useQueries-D7oIAKqU.js";import"./list-pages-BCUbyyea.js";import"./useMediaQuery-CH9DMslv.js";import"./mail-CNc7ptBm.js";import"./pencil-DzsoMa_O.js";import"./circle-question-mark-BaR50kvR.js";const Pa={name:"calendar-off",size:24,node:[["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 9h-5.5",key:"1g344v"}],["path",{d:"M3 9h6",key:"1q2djq"}],["path",{d:"M3.586 3.586A2 2 0 003 5v14a2 2 0 002 2h14a2 2 0 001.414-.586",key:"1g7ltu"}],["path",{d:"M8.656 3H19a2 2 0 012 2v10.344",key:"1bwpd1"}]]};Pa.node;const kd=Wn(Pa);const ja={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]};ja.node;const Pd=Wn(ja);const Ha={name:"radio",size:24,node:[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};Ha.node;const jd=Wn(Ha);const Oa={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};Oa.node;const Hd=Wn(Oa),lt=globalThis.Temporal,Od=(t,e)=>`Non-positive ${t}: ${e}`,Ad=(t,e)=>`Non-finite ${t}: ${e}`,Ld=t=>`Cannot convert bigint to ${t}`,_d="Invalid object",Ud=(t,e,n,r)=>zn(t,e)+`; must be between ${n}-${r}`,zn=(t,e)=>`Invalid ${t}: ${e}`,Fd=1e3,Bd=1e6,Wd=1e9,Vd=6e10,zd=36e11;function $d(t){return t===void 0?Object.create(null):Zd(t)}function Aa(t,e="number"){if(typeof t=="bigint")throw new TypeError(Ld(e));if(t=Number(t),!Number.isFinite(t))throw new RangeError(Ad(e,t));return t}function rs(t,e){return Math.trunc(Aa(t,e))||0}function Js(t,e){return Yd(rs(t,e),e)}function Yd(t,e="number"){if(t<=0)throw new RangeError(Od(e,t));return t}function Gd(t,e,n){return Math.min(Math.max(t,e),n)}function La(t){return t!==null&&(typeof t=="object"||typeof t=="function")}function Zd(t){if(!La(t))throw new TypeError(_d);return t}const qd=zn,Xd=t=>`Missing ${t}`,Kd=(t,e,n)=>zn(t,e)+"; must be "+Object.keys(n).join(),Qd="Cannot use valueOf",Jd="Invalid calling context",eu=(t,e)=>`Unknown calendar ${t}; might need ${e}`,tu=t=>zn("TimeZone",t),$n="Out-of-bounds date",nu=t=>`Invalid substring: ${t}`,_a=Gd;function be(t){throw new RangeError(t)}function It(t){throw new TypeError(t)}function ei(t,e,n,r,s){return Ua(e,((i,a)=>{const o=i[a];return o===void 0&&It(Xd(a)),o})(t,e),n,r)}function Ua(t,e,n,r,s,i){const a=_a(e,n,r);return e!==a&&be(((o,l,c,u,f)=>Ud(o,l,c,u))(t,e,n,r)),a}function Ct(t,e=Map){const n=new e;return(r,...s)=>{if(n.has(r))return n.get(r);const i=t(r,...s);return n.set(r,i),i}}const ru=t=>su({name:t}),su=(t,e)=>ss(n=>({value:n,configurable:1,writable:!1}),t),iu=t=>({[Symbol.toStringTag]:{value:t,configurable:1}});function ss(t,e){const n={};for(const r in e)n[r]=t(e[r],r);return n}function au(t,e){const n={};for(const r of t)n[r]=e;return n}function Fa(t){const e={};for(const n of t)e[n]=r=>r[n];return e}function Ba(t,e,n=Object.create(null)){for(const r of t)n[r]=e[r];return n}function is(t,...e){return(...n)=>t(...e,...n)}function ti(){}function ni(t){return t[0].toUpperCase()+t.substring(1)}function ou(t){return new RegExp(`^${t}$`,"i")}function lu(t){return parseInt(t.padEnd(9,"0"))}function cu(t){return t&&t!=="+"?-1:1}function hr(t){return t===void 0?0:parseInt(t)}function Nn(t,e){return String(e).padStart(t,"0")}const Ae=is(Nn,2);function du(t,e){return Math.sign(t-e)}function Wa(t,e){const n=t/e;return t%e<0n?n-1n:n}function Va(t,e){const n=Wa(t,e);return[n,t-n*e]}function Ve(t,e){return[Math.floor(t/e),Yn(t,e)]}function Yn(t,e){return(t%e+e)%e}function uu(t,e){return Math.trunc(t/e)||0}function gn(t){return Math.abs(t%1)===.5}function fu(t){const e=t.normalize("NFD").toLowerCase().replace(/[^a-z0-9]/g,"");return e==="bc"||e==="b"?"bce":e==="ad"||e==="a"?"ce":e}const kt=void 0;function Gn(t){return t===kt?"iso8601":t===0?"gregory":t.id}function hu(t,e){return"M"+Ae(t)+(e?"L":"")}const gu={nanosecond:0,microsecond:1,millisecond:2,second:3,minute:4,hour:5,day:6,week:7,month:8,year:9},mu=Object.keys(gu),as=Fd,Zn=Bd,an=Wd,os=Vd,za=zd,ls=864e11,$a=BigInt(Zn),Hr=BigInt(an),rt=BigInt(ls),qn=mu.slice(0,6),cs=Fa(qn),pu=["day","month","year"];function vu(t){return bu(t),t}const yu={hour:23,minute:59,second:59};function bu(t,e){const n={};for(const r of qn)n[r]=Ua(r,t[r],0,yu[r]||999);return n}function ds(t){return Ya(t)*an+Ga(t)}function Ya(t){return 3600*t.hour+60*t.minute+t.second}function Ga(t){return t.millisecond*Zn+t.microsecond*as+t.nanosecond}function Eu(t){const[e,n]=Ve(t,Zn),[r,s]=Ve(n,as);return Su(e,r,s)}function Su(t,e=0,n=0){const[r,s]=Ve(t,36e5),[i,a]=Ve(s,6e4),[o,l]=Ve(a,1e3);return{hour:r,minute:i,second:o,millisecond:l,microsecond:e,nanosecond:n}}function ri(t){const[e,n]=Va(t,Hr);return[Number(e),Number(n)]}function wu(t){return us(t)+BigInt(ds(t))}function us(t){return BigInt(Mn(t))*rt}function Mn(t){return Zt(t.year,t.month,t.day)}function Zt(t,e=1,n=1){const r=e-1;return t+=Math.floor(r/12),e=Yn(r,12),Date.UTC(t%400-400,e,0)/864e5+146097*(uu(t,400)+1)+n}function Xn(t){const[e,n]=Va(t,rt);return{...Du(Number(e)),...Eu(Number(n))}}function Du(t){const e=new Date(864e5*Yn(t,146097));return{year:e.getUTCFullYear()+400*Math.floor(t/146097),month:e.getUTCMonth()+1,day:e.getUTCDate()}}function xu(t){return[t,0]}function Cu(t,e,n){return{year:t,month:e,day:n}}function Za(t,e){switch(e){case 2:return Kn(t)?29:28;case 4:case 6:case 9:case 11:return 30}return 31}function Tu(t){return Kn(t)?366:365}function Kn(t){return t%4==0&&(t%100!=0||t%400==0)}function fs(t){return Yn(Zt(t.year,t.month,t.day)+4,7)||7}function qa(t){return Zt(t.year,t.month,t.day)-Zt(t.year)+1}function Xa(t){let e=t.year,n=Math.floor((qa(t)-fs(t)+10)/7),r=gr(e);return n<1?n=r=gr(--e):n>r&&(n=1,r=gr(++e)),{weekOfYear:n,yearOfWeek:e,Be:r}}function gr(t){const e=fs({year:t,month:1,day:1});return e===4||e===3&&Kn(t)?53:52}function Ru({year:t}){return t<1?{era:"bce",eraYear:1-t}:{era:"ce",eraYear:t}}function Nu(t){return Mu(t),vu(t)}function Mu(t){return Iu(t),t}function Iu(t,e){const{year:n}=t,r=ei(t,"month",1,12);return{year:n,month:r,day:ei(t,"day",1,Za(n,r))}}function Le(t,e){return t?t.ae(e):e}function ku(t,e,n){return t?t.L(e,n):xu(n)}function si(t,e){return t===0?Ru(e):t&&t.h?.(e)||{}}function Pu(t,e,n,r){return t?t.de(e,n,r):Cu(e,n,r)}function ju(t,e){return t?t.j(e):12}function Hu(t,e,n){return t?t.o(e,n):Za(e,n)}function Ou(t,e){const{year:n,month:r}=Le(t,e),[s,i]=ku(t,n,r);return hu(s,i)}function Ka(t,e){const{year:n}=Le(t,e);return t?t.q(n):Kn(n)}function Qa(t,e){const{year:n}=Le(t,e);return ju(t,n)}function Ja(t,e){const{year:n,month:r}=Le(t,e);return Hu(t,n,r)}function eo(t,e){const{year:n}=Le(t,e);return t?t.i(n):Tu(n)}function Au(t,e){if(!t)return qa(e);const{year:n}=Le(t,e),r=Pu(t,n,1,1);return Mn(e)-Mn(r)+1}function Lu(t,e){return t===kt?Xa(e).weekOfYear:void 0}function _u(t,e){return t===kt?Xa(e).yearOfWeek:void 0}const In=is(Uu,"string");function Uu(t,e,n=t){return typeof e!==t&&It(qd(n,e)),e}function Fu(t,e="number"){return Number.isInteger(t)||be(((n,r)=>`Non-integer ${n}: ${r}`)(e,t)),t||0}function Bu(t){return typeof t=="symbol"&&It("Cannot convert Symbol to string"),String(t)}function Wu(t,e){return La(t)?String(t):In(t,e)}function Vu(t,e){return Fu(Aa(t,e),e)}const zu={compatible:0,reject:1,earlier:2,later:3},$u=[Math.floor,t=>gn(t)?Math.floor(t):Math.round(t),Math.ceil,t=>gn(t)?Math.ceil(t):Math.round(t),Math.trunc,t=>gn(t)?Math.trunc(t)||0:Math.round(t),t=>t<0?Math.floor(t):Math.ceil(t),t=>Math.sign(t)*Math.round(Math.abs(t))||0,t=>gn(t)?(t=Math.trunc(t)||0)+t%2:Math.round(t)];function Yu(t,e,n,r=0){const s=n[t];if(s===void 0)return r;const i=Bu(s),a=e[i];return a===void 0&&be(Kd(t,i,e)),a}const Gu=is(Yu,"disambiguation",zu),to=BigInt(1e8)*rt,hs=BigInt(-1e8)*rt,no=hs-rt;function Zu(t){const e=us(t);return qu(e),e!==no||ds(t)||be($n),t}function qu(t,e=1){(t<(e?no:hs)||t>to)&&be($n)}function Qn(t){return(t<hs||t>to)&&be($n),t}function Xu(t,e){return Qn(us(t)+BigInt(ds(t)-e))}function Ku(t){return{epochNanoseconds:t}}function ro(t,e,n){return{calendar:n,timeZone:e,epochNanoseconds:t}}function Qu(t,e){return Ba(qn,t,Ju(t,e))}function Ju(t,e){return Ba(pu,t,{calendar:e})}function so(t){return e=t.epochNanoseconds,Number(Wa(e,$a));var e}function io(t){return t.epochNanoseconds}function ef(t){return tf(t,os,7)}function tf(t,e,n){return nf(t/e,n)*e}function nf(t,e){return $u[e](t)}const ao=Ct(rf,WeakMap);function rf(t){const{epochNanoseconds:e,timeZone:n}=t,r=n.B(e);return{...Xn(e+BigInt(r)),offsetNanoseconds:r}}function sf(t,e,n=0,r=t.N(e)){if(r.length===1)return r[0];if(n===1&&be("Ambiguous offset"),r.length)return r[n===3?1:0];const s=wu(e),i=((o,l)=>{const c=o.B(l-rt);return(u=>(u>ls&&be("Out-of-bounds TimeZone gap"),u))(o.B(l+rt)-c)})(t,s),a=Xn(s+BigInt(i*(n===2?-1:1)));return(r=t.N(a))[n===2?0:r.length-1]}const af=ou("([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?");function of(t,e){const n=af.exec(t);if(n&&(r=>(s=>{s[0]!=="T"&&s[0]!=="t"||(s=s.slice(1));const i=s.search(/[.,]/),a=i<0?s:s.slice(0,i),o=a.split(":");return o.length===1?/^(?:\d{2}|\d{4}|\d{6})$/i.test(a):(o.length===2||o.length===3)&&o.every(l=>l.length===2&&/^\d{2}$/i.test(l))})(r.slice(1)))(n[0]))return((r,s)=>{const i=r[4]||r[5];return i&&be(nu(i)),o=(hr(r[2])*za+hr(r[3])*os+hr(r[4])*an+lu(r[5]||""))*cu(r[1]),Math.abs(o)>=ls&&be("Out-of-bounds offset"),o;var o})(n)}const lf={era:Wu,month:Js,monthCode(t,e){if(typeof t=="string")return t;if(t&&typeof t=="object"){const n=t.toString;if(typeof n=="function")return In(n.call(t),e)}return In(t,e)},day:Js},cf=au(qn,rs),df=Object.assign({},lf,cf);({...df});const uf=Intl.DateTimeFormat;function ff(t,e){e<-864e13&&be($n);const n=t.formatToParts(e),r={};for(const s of n)r[s.type]=s.value;return r}const hf={El_Aaiun:17,Tucuman:12,Tirane:11,Riga:10,Simferopol:9,Vienna:9,Tunis:8,Boa_Vista:6,Fortaleza:6,Maceio:6,Noronha:6,Recife:6,Gaza:6,Hebron:6,DeNoronha:6},mr=-388152e4;function gf(t){return gs(Xn(t.epochNanoseconds))+"Z"}function mf(t){const e=t.calendar,n=t.timeZone,r=n.B(t.epochNanoseconds);return gs(Xn(t.epochNanoseconds+BigInt(r)))+oo(ef(r))+Ef(n.id)+(e===kt?"":lo(Gn(e)))}function pf(t){const e=t.calendar;return gs(t)+(e===kt?"":lo(Gn(e)))}function gs(t,e){return vf(t)+"T"+bf(t)}function vf(t){return yf(t)+"-"+Ae(t.day)}function yf(t){const{year:e}=t;return(e<0||e>9999?uo(e)+Nn(6,Math.abs(e)):Nn(4,e))+"-"+Ae(t.month)}function bf(t,e){const n=[Ae(t.hour),Ae(t.minute)];return n.push(Ae(t.second)+((r,s,i,a)=>co(r*Zn+s*as+i))(t.millisecond,t.microsecond,t.nanosecond)),n.join(":")}function oo(t,e=0){if(e===1)return"";const[n,r]=Ve(Math.abs(t),za),[s,i]=Ve(r,os),[a,o]=Ve(i,an);return uo(t)+Ae(n)+":"+Ae(s)+(a||o?":"+Ae(a)+co(o):"")}function Ef(t,e){return"["+t+"]"}function lo(t,e){return"[u-ca="+t+"]"}const Sf=/0+$/;function co(t,e){let n=Nn(9,t);return n=n.replace(Sf,""),n?"."+n:""}function uo(t){return t<0?"-":"+"}const wf=/^(AC|AE|AG|AR|AS|BE|BS|CA|CN|CS|CT|EA|EC|IE|IS|JS|MI|NE|NS|PL|PN|PR|PS|SS|VS)T$/,Df=/[^\w\/:+-]+/;function fo(t){return xf(In(t))}function xf(t){return ho(t).id}function ho(t){const e=t.toUpperCase(),n=(s=>{const i=of(s);if(i!==void 0)return{id:oo(i),X:i,m:i}})(e);if(n)return{kind:"fixed",...n};const r=e==="UTC"?"UTC":(s=>(Df.test(s)&&be(tu(s)),wf.test(s)&&be("Forbidden ICU TimeZone"),s.toLowerCase().split("/").map((i,a)=>(i.length<=3||/\d/.test(i))&&!/etc|yap/.test(i)?i.toUpperCase():i.replace(/baja|dumont|[a-z]+/g,(o,l)=>o.length<=2&&!a||o==="in"||o==="chat"?o.toUpperCase():o.length>2||!l?ni(o).replace(/island|noronha|murdo|rivadavia|urville/,ni):o)).join("/")))(t);return Cf(r)}const Cf=Ct(t=>{if(t==="UTC")return{kind:"utc",id:t,m:t};const e=t.toUpperCase(),n=Tf(e);return{kind:"named",id:t,format:n,m:n.resolvedOptions().timeZone}}),Tf=Ct(t=>new uf("en-u-hc-h23",{calendar:"iso8601",timeZone:t,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}));function go(t){const e=ho(t);return Rf(e.id,e)}const Rf=Ct((t,e)=>e.kind==="named"?new Mf(t,e.m,e.format):new Nf(t,e.m,e.kind==="fixed"?e.X:0));class Nf{constructor(e,n,r){this.id=e,this.m=n,this.X=r}B(){return this.X}N(e){return[Xu(e,this.X)]}O(){}}class Mf{constructor(e,n,r){this.id=e,this.m=n,this.ke=((s,i)=>{const a=Ct(s),o=Ct(If),l=86400*i;function c(f){const[h,g]=ai(f,l),v=mn(h),m=mn(g),E=a(v),C=a(m);return E===C?E:u(o(v,m),E,C,f)}function u(f,h,g,v){let m,E;for(;(v===void 0||(m=v<f[0]?h:v>=f[1]?g:void 0)===void 0)&&(E=f[1]-f[0]);){const C=f[0]+Math.floor(E/2);s(C)===g?f[1]=C:f[0]=C+1}return m}return{xe(f){const h=c(f-86400),g=c(f+86400),v=f-h,m=f-g;if(h===g)return[v];const E=c(v);return E===c(m)?[f-E]:h>g?[v,m]:[]},we:c,O:function f(h,g){if(g>0&&h>=864e10)return;if(g<0){if(h<=mr)return;const T=ii()+94867200;if(h>T)return f(T,-1)}const v=g>0?Math.max(h,mr):h;let[m,E]=ai(v,l);const C=l*g,R=g>0?Math.max(h,ii())+94867200:mr,x=()=>g<0?E>R:m<R;for(;x();){const T=mn(m),M=mn(E),D=a(T),N=a(M);if(D!==N){const P=o(T,M);u(P,D,N);const H=P[0];if((du(H,h)||1)===g)return H}m+=C,E+=C}}}})((s=>i=>{const a=ff(s,1e3*i);return 86400*Zt((o=>{const l=o.relatedYear;if(l!==void 0)return parseInt(l);const c=parseInt(o.year);return o.era!==void 0&&fu(o.era)==="bce"?1-c:c})(a),parseInt(a.month),parseInt(a.day))+3600*parseInt(a.hour)+60*parseInt(a.minute)+parseInt(a.second)-i})(r),(s=>{const i=s.split("/").pop();return hf[i]||60})(e))}B(e){return this.ke.we((n=>ri(n)[0])(e))*an}N(e){const n=86400*Mn(e)+Ya(e),r=Ga(e);return this.ke.xe(n).map(s=>Qn(BigInt(s)*Hr+BigInt(r)))}O(e,n){const[r,s]=ri(e),i=this.ke.O(r+(n>0||s?1:0),n);if(i!==void 0)return BigInt(i)*Hr}}function ii(){return Math.floor(Date.now()/1e3)}function If(t,e){return[t,e]}function ai(t,e){const n=Math.floor(t/e)*e;return[n,n+e]}function mn(t){return _a(t,-1e10,864e10)}function kf(t,e,n){return ro(t.epochNanoseconds,e,n)}function Pf(t,e,n){const r=sf(e,t,(s=>Gu($d(s)))(n));return ro(Qn(r),e,t.calendar)}function jf(t){return Ku(Qn(BigInt(Vu(t))*$a))}function Hf(t,e,n,r,s){const i=new Set(t),a=new Set(e),o=new Set(n);return(l,c)=>{let u,f;const h={},g={},v={};let m=0,E=0;for(const H of Object.keys(l)){const U=l[H];U===void 0||o.has(H)||(i.has(H)?H==="dateStyle"?u=U:H==="timeStyle"?f=U:h[H]=U:H==="era"?g[H]=U:a.has(H)?H==="dateStyle"||H==="timeStyle"?E=1:m=1:v[H]=U)}const C=u!==void 0,R=f!==void 0,x=C||R,T=Object.keys(h).length>0,M=m||E,D=T||C||R,N=Object.keys(g).length>0;(!c&&M||c&&M&&!D||x&&(T||N||m))&&It("Invalid formatting options");const P={};return x||D||Object.assign(P,r),Object.assign(P,h,g,v),C&&(s?Object.assign(P,s[u]):P.dateStyle=u),R&&(P.timeStyle=f),P}}const Of={year:"numeric",month:"numeric",day:"numeric"},Af={hour:"numeric",minute:"numeric",second:"numeric"},Lf=Object.assign({},Of,Af),_f=["weekday","year","month","day","dateStyle"],Uf=["dayPeriod","hour","minute","second","fractionalSecondDigits","timeStyle"],Ff=_f.concat(Uf);({...Lf});const Bf="PlainDateTime",Wf="ZonedDateTime",Vf="Instant";function Pt(t,e,n,...r){return Object.defineProperties(e,ru(t)),Object.defineProperties(e.prototype,iu("Temporal."+t)),Object.defineProperties(e.prototype,ss(s=>({get(){return s(n(this))},configurable:1}),Object.assign({},...r))),e}const jt=ti.name==="noop"?t=>{Object.defineProperty(t,"_str_",{value:t.toJSON()})}:ti;function Jn(){It(Jd)}function ms(){It(Qd)}const ps={era(t){return si(t.calendar,t).era},eraYear(t){return si(t.calendar,t).eraYear},year(t){return Le(t.calendar,t).year},month(t){return Le(t.calendar,t).month},monthCode(t){return Ou(t.calendar,t)},day(t){return Le(t.calendar,t).day}},zf={daysInMonth(t){return Ja(t.calendar,t)},daysInYear(t){return eo(t.calendar,t)},monthsInYear(t){return Qa(t.calendar,t)},inLeapYear(t){return Ka(t.calendar,t)}},$f={dayOfWeek(t){return fs(t)},dayOfYear(t){return Au(t.calendar,t)},weekOfYear(t){return Lu(t.calendar,t)},yearOfWeek(t){return _u(t.calendar,t)},daysInWeek(){return 7},daysInMonth(t){return Ja(t.calendar,t)},daysInYear(t){return eo(t.calendar,t)},monthsInYear(t){return Qa(t.calendar,t)},inLeapYear(t){return Ka(t.calendar,t)}};function kn(t){return Fa(Object.keys(t))}const mo=kn(cs),po=kn(ps);kn(zf),kn($f);const pr=32,vo=150,Yf="cal-1",Gf=600,Zf=900,qf=1500,Xf=new Set;function Kf(t){const e=new Map(t.map(n=>[n.id,n]));return{color:n=>e.get(n)?.color??Yf,name:n=>e.get(n)?.name??""}}function Qf({days:t,calendars:e,density:n,today:r,focusDate:s,selectedEventId:i,onSelectEvent:a,onPickSlot:o,onZoomDay:l,onReachStart:c,onReachEnd:u,onVisibleDayChange:f,atStartCap:h=!1,atEndCap:g=!1,onLoadEarlier:v,onLoadLater:m,loadingDates:E=Xf,freeOn:C=Pr,scrollTarget:R,todayLead:x,touch:T,className:M}){const D=S.useRef(null),N=S.useRef(new Map),P=S.useRef(t[0]?.date??""),H=S.useRef(0),U=S.useRef(""),te=S.useRef(""),W=S.useRef(!1),V=S.useRef(0),ne=S.useRef(0),[ae,le]=S.useState(s),Pe=S.useMemo(()=>Kf(e),[e]),Ie=id(t,[r,s,...E]),re=t[0]?.date??"",xe=t[t.length-1]?.date??"";S.useLayoutEffect(()=>{const _=D.current;_&&(re!==""&&re<P.current&&(_.scrollTop+=_.scrollHeight-H.current),P.current=re,H.current=_.scrollHeight,V.current=_.scrollTop)}),S.useEffect(()=>{if(W.current)return;const _=D.current;if(!_)return;W.current=!0;let q=!1;const oe=()=>{const F=N.current.get(s);q||!F||(_.scrollTop=F.offsetTop-pr,V.current=_.scrollTop)};oe(),le(s);const ce=requestAnimationFrame(oe);return document.fonts?.ready.then(oe),()=>{q=!0,cancelAnimationFrame(ce)}},[s]),S.useEffect(()=>{if(!R)return;const _=D.current,q=N.current.get(R.date);!_||!q||(_.scrollTop=q.offsetTop-pr,V.current=_.scrollTop,le(R.date),f(R.date))},[R,f]),S.useEffect(()=>{const _=D.current;if(!_)return;const q=()=>{ne.current=Date.now()},oe=["wheel","pointerdown","touchstart","touchmove","keydown"],ce=F=>{F.buttons!==0&&q()};for(const F of oe)_.addEventListener(F,q,{passive:!0});return _.addEventListener("pointermove",ce,{passive:!0}),()=>{for(const F of oe)_.removeEventListener(F,q);_.removeEventListener("pointermove",ce)}},[]);const Ge=()=>{const _=D.current;if(!_)return;const q=_.scrollTop,oe=q-V.current;if(V.current=q,oe===0||Date.now()-ne.current>qf)return;const ce=[...N.current.entries()].filter(([,de])=>de.isConnected).sort((de,je)=>de[1].offsetTop-je[1].offsetTop);let F="";for(const[de,je]of ce){if(je.offsetTop-pr-8>q)break;F=de}F!==""&&F!==ae&&(le(F),f(F)),oe<0&&q<Gf&&U.current!==re&&(U.current=re,c()),oe>0&&q+_.clientHeight>_.scrollHeight-Zf&&te.current!==xe&&(te.current=xe,u())},Ze=_=>q=>{q?N.current.set(_,q):N.current.delete(_)};return d.jsxs("div",{ref:D,onScroll:Ge,"data-testid":"agenda-strip",className:j("relative min-h-0 flex-1 overflow-y-auto bg-surface",M),children:[d.jsxs("div",{className:"sticky top-0 z-20 flex h-8 items-center gap-2 border-b border-line bg-surface/95 px-row-inset backdrop-blur",children:[d.jsx("span",{className:"text-xs font-semibold text-fg",children:ad(ae)}),d.jsx("span",{className:"text-xs text-fg-subtle",children:od(ae)}),ae===r&&d.jsx("span",{className:"rounded-full bg-accent-soft px-1.5 text-2xs font-medium text-accent",children:"Today"})]}),h&&v&&d.jsx(oi,{label:"Show earlier days",testId:"agenda-load-earlier",onLoad:v,touch:T}),Ie.map(_=>d.jsx(Jf,{row:_,lookup:Pe,density:n,today:r,pending:_.kind==="day"&&E.has(_.day.date),freeOn:C,selectedEventId:i,onSelectEvent:a,onPickSlot:o,onZoomDay:l,anchorRef:Ze(_.kind==="day"?_.day.date:_.from),lead:_.kind==="day"&&_.day.date===r?x:null,touch:T},_.key)),g&&m&&d.jsx(oi,{label:"Show later days",testId:"agenda-load-later",onLoad:m,touch:T})]})}function oi({label:t,testId:e,onLoad:n,touch:r}){return d.jsx("button",{type:"button",onClick:n,"data-testid":e,className:j("flex w-full items-center justify-center gap-2 border-y border-dashed border-line bg-surface-sunken px-row-inset text-xs font-medium text-fg-muted outline-none transition-colors hover:border-accent hover:text-accent focus-visible:ring-2 focus-visible:ring-ring",r?"min-h-14 py-3":"py-2"),children:t})}function Jf({row:t,lookup:e,density:n,today:r,pending:s,freeOn:i,selectedEventId:a,onSelectEvent:o,onPickSlot:l,onZoomDay:c,anchorRef:u,lead:f,touch:h}){return t.kind==="run"?d.jsx("div",{ref:u,children:d.jsx(eh,{from:t.from,to:t.to,days:t.days,onPickSlot:l,touch:h})}):s?d.jsx("div",{ref:u,children:d.jsx(th,{day:t.day,today:r})}):n==="dots"?d.jsxs("div",{ref:u,children:[f,d.jsx(nh,{day:t.day,lookup:e,today:r,freeOn:i,onSelectEvent:o,onZoomDay:c,selectedEventId:a})]}):d.jsxs("div",{ref:u,children:[f,d.jsx(sh,{day:t.day,lookup:e,density:n,today:r,freeOn:i,selectedEventId:a,onSelectEvent:o,onPickSlot:l,onZoomDay:c,touch:h})]})}function eh({from:t,to:e,days:n,onPickSlot:r,touch:s}){return d.jsxs("button",{type:"button",onClick:()=>r({date:t,endDate:t,startTime:"10:00",endTime:"11:00",allDay:!1}),className:j("flex w-full items-center gap-3 border-y border-dashed border-line bg-surface-sunken px-row-inset text-left outline-none transition-colors hover:border-accent focus-visible:ring-2 focus-visible:ring-ring",s?"min-h-14 py-3":"py-2"),children:[d.jsx(kd,{className:"size-4 shrink-0 text-accent"}),d.jsx("span",{className:"text-sm font-medium text-fg",children:ld(t,e)}),d.jsxs("span",{className:"text-xs text-fg-muted",children:[n," days with nothing booked"]}),d.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:"Add"})]})}function th({day:t,today:e}){const n=t.date===e;return d.jsxs("section",{"aria-busy":"true","data-testid":`agenda-day-pending-${t.date}`,className:j("border-b border-line",n&&"border-l-2 border-l-accent bg-accent-soft/20"),children:[d.jsxs("header",{className:"flex h-section-row items-center gap-3 px-row-inset",children:[d.jsxs("div",{className:"flex w-16 shrink-0 items-baseline gap-1.5",children:[d.jsx("span",{className:j("text-lg font-semibold tabular-nums",n?"text-accent":"text-fg"),children:t.dayNumber}),d.jsx("span",{className:"text-2xs uppercase tracking-wider text-fg-subtle",children:t.weekdayLabel})]}),d.jsxs("span",{className:"sr-only",children:["Loading ",t.date]}),d.jsx("span",{className:"h-3 min-w-0 flex-1 animate-pulse rounded-full bg-surface-sunken"})]}),d.jsx("div",{className:"flex flex-col gap-1 pb-2",children:d.jsx("span",{className:"mx-row-inset h-7 animate-pulse rounded-md bg-surface-sunken"})})]})}function nh({day:t,lookup:e,today:n,freeOn:r,selectedEventId:s,onSelectEvent:i,onZoomDay:a}){const o=t.date===n,l=[...t.allDay,...t.timed];return d.jsxs("div",{className:j("flex h-8 items-center gap-2 border-b border-line px-row-inset",o&&"bg-accent-soft/30"),children:[d.jsxs("button",{type:"button",onClick:()=>a(t.date),className:j("w-16 shrink-0 rounded-sm text-left text-xs tabular-nums outline-none focus-visible:ring-2 focus-visible:ring-ring",o?"font-semibold text-accent":"text-fg-muted"),children:[t.weekdayLabel," ",t.dayNumber]}),d.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden",children:l.map(c=>d.jsx("button",{type:"button",title:c.title,"aria-label":c.title,"aria-pressed":c.id===s,onClick:()=>i(c.id),className:j("size-2 shrink-0 rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring",sn(e.color(c.calendarId)).solid,c.id===s&&"ring-2 ring-ring",c.myRsvp==="declined"&&"opacity-40")},c.id))}),d.jsx(bo,{day:t,className:"w-24 shrink-0"}),d.jsx("span",{className:"w-24 shrink-0 text-right text-2xs text-fg-subtle",children:rh(t,r)})]})}function rh(t,e){const n=e(t);if(t.timed.length===0&&yo(n))return"clear";const r=n.reduce((s,i)=>Math.max(s,i.minutes),0);return r>=vo?`${nt(r)} free`:`${nt(t.busyMinutes)} booked`}function yo(t){return t.length===1&&t[0].wholeDay}function sh({day:t,lookup:e,density:n,today:r,freeOn:s,selectedEventId:i,onSelectEvent:a,onPickSlot:o,onZoomDay:l,touch:c}){const u=t.date===r,f=cd(t.timed),h=s(t),g=h.filter(E=>!E.wholeDay),v=t.timed.length===0&&yo(h),m=[...f.map(E=>({key:E[0].id,at:Gt(E[0].start),node:E.length===1?d.jsx(So,{event:E[0],lookup:e,density:n,selected:E[0].id===i,onSelect:()=>a(E[0].id),touch:c}):d.jsx(ch,{events:E,lookup:e,density:n,selectedEventId:i,onSelectEvent:a,onZoomDay:()=>l(t.date),touch:c})})),...g.map(E=>({key:`free_${E.startMinute}`,at:E.startMinute,node:d.jsx(oh,{stretch:E,onPick:()=>o({date:E.date,endDate:E.date,startTime:ze(E.startMinute),endTime:ze(Math.min(E.startMinute+60,E.endMinute)),allDay:!1}),touch:c})}))].sort((E,C)=>E.at-C.at);return d.jsxs("section",{className:j("border-b border-line",u&&"border-l-2 border-l-accent bg-accent-soft/20"),children:[d.jsxs("header",{className:"flex h-section-row items-center gap-3 px-row-inset",children:[d.jsxs("div",{className:"flex w-16 shrink-0 items-baseline gap-1.5",children:[d.jsx("span",{className:j("text-lg font-semibold tabular-nums",u?"text-accent":"text-fg"),children:t.dayNumber}),d.jsx("span",{className:"text-2xs uppercase tracking-wider text-fg-subtle",children:t.weekdayLabel})]}),d.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:ih(t)}),d.jsx(bo,{day:t,className:"hidden w-32 shrink-0 sm:block"}),d.jsxs("button",{type:"button",onClick:()=>l(t.date),className:j("flex shrink-0 items-center gap-0.5 rounded-md border px-2 text-2xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",c?"min-h-9":"h-6",t.conflicts.length>0?"border-warning text-warning hover:bg-warning-soft":"border-line text-fg-subtle hover:border-line-strong hover:text-fg"),children:["Grid",d.jsx(Vn,{className:"size-3"})]})]}),d.jsxs("div",{className:"flex flex-col gap-1 pb-2",children:[t.allDay.map(E=>d.jsx(lh,{event:E,lookup:e,density:n,selected:E.id===i,onSelect:()=>a(E.id),touch:c},E.id)),v?d.jsx(ah,{day:t,onPickSlot:o,touch:c}):m.map(E=>d.jsx("div",{children:E.node},E.key))]})]})}function ih(t){if(t.timed.length===0)return"Nothing booked";const e=[`${t.timed.length} ${t.timed.length===1?"event":"events"}`,`${nt(t.busyMinutes)} booked`];return t.conflicts.length>0&&e.push(`${t.conflicts.length} ${t.conflicts.length===1?"clash":"clashes"}`),e.join(" · ")}function bo({day:t,className:e}){const n=Qs-fr;return d.jsx("div",{"aria-hidden":!0,className:j("relative h-1.5 overflow-hidden rounded-full bg-surface-sunken",e),children:dd(t).map(r=>{const s=Math.max(r.from,fr),i=Math.min(r.to,Qs);return i<=s?null:d.jsx("span",{className:"absolute inset-y-0 rounded-full bg-fg-subtle",style:{left:`${(s-fr)/n*100}%`,width:`${(i-s)/n*100}%`}},`${r.from}-${r.to}`)})})}function ah({day:t,onPickSlot:e,touch:n}){return d.jsx("button",{type:"button",onClick:()=>e({date:t.date,endDate:t.date,startTime:"10:00",endTime:"11:00",allDay:!1}),className:j("mx-row-inset flex items-center gap-2 rounded-md border border-dashed border-line px-2 text-left text-xs text-fg-muted outline-none transition-colors hover:border-accent hover:text-accent focus-visible:ring-2 focus-visible:ring-ring",n?"min-h-11":"h-8"),children:"Free all day"})}function oh({stretch:t,onPick:e,touch:n}){const r=t.minutes>=vo;return d.jsxs("button",{type:"button",onClick:e,className:j("ml-16 mr-row-inset flex items-center gap-2 rounded-md border border-dashed text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",n?"min-h-11 px-3":"h-7 px-2",r?"border-accent-2 bg-accent-2-soft/40 text-accent-2 hover:bg-accent-2-soft":"border-line text-fg-subtle hover:border-line-strong hover:text-fg-muted"),children:[d.jsxs("span",{className:j("text-xs",r&&"font-medium"),children:[nt(t.minutes)," free"]}),d.jsxs("span",{className:"text-2xs tabular-nums opacity-80",children:[ze(t.startMinute)," – ",ze(t.endMinute)]})]})}function Eo(t){return t==="detail"?"comfortable":"compact"}function lh({event:t,lookup:e,density:n,selected:r,onSelect:s,touch:i}){return d.jsx("div",{className:j("mx-row-inset",i&&"min-h-11"),children:d.jsx(Ra,{title:t.title,timeText:"",color:e.color(t.calendarId),layout:"row",density:Eo(n),rsvp:t.myRsvp,status:t.status,hasThread:t.threadId!=="",isRecurring:t.recurrenceRule!=="",zoneCertainty:t.zoneCertainty,selected:r,onClick:s,trailing:d.jsx("span",{className:"text-2xs",children:"All day"})})})}function ch({events:t,lookup:e,density:n,selectedEventId:r,onSelectEvent:s,onZoomDay:i,touch:a}){const o=Math.min(...t.map(c=>Gt(c.start))),l=Math.max(...t.map(c=>Gt(c.end)));return d.jsxs("div",{className:"mx-row-inset rounded-md border border-warning/50 bg-warning-soft/30",children:[d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[d.jsx(Pd,{className:"size-3 shrink-0 text-warning"}),d.jsxs("span",{className:"text-2xs font-medium text-warning",children:[t.length," at once · ",ze(o)," – ",ze(l)]}),d.jsx("button",{type:"button",onClick:i,className:j("ml-auto rounded-sm px-1.5 text-2xs font-medium text-warning underline underline-offset-2 outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",a&&"min-h-9"),children:"Open the grid"})]}),d.jsx("div",{className:"flex flex-col gap-0.5 pb-1",children:t.map(c=>d.jsx(So,{event:c,lookup:e,density:n,selected:c.id===r,onSelect:()=>s(c.id),inset:!1,touch:a},c.id))})]})}function So({event:t,lookup:e,density:n,selected:r,onSelect:s,inset:i=!0,touch:a}){const o=n==="detail",l=Gt(t.end)-Gt(t.start),c=[e.name(t.calendarId),t.location].filter(u=>u!=="").join(" · ");return d.jsx("div",{className:j(i?"px-row-inset":"px-2",a&&"min-h-12"),children:d.jsx(Ra,{title:t.title,timeText:"",color:e.color(t.calendarId),layout:"row",density:Eo(n),rsvp:t.myRsvp,status:t.status,hasThread:t.threadId!=="",isRecurring:t.recurrenceRule!=="",zoneCertainty:t.zoneCertainty,selected:r,onClick:s,leading:d.jsxs("span",{className:j("shrink-0 pt-1 text-2xs tabular-nums text-fg-subtle",i?"w-14":"w-11"),children:[t.start.slice(11,16),o&&d.jsx("span",{className:"block opacity-70",children:t.end.slice(11,16)})]}),trailing:d.jsx("span",{className:"text-2xs tabular-nums",children:nt(l)}),detail:o&&c!==""?d.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-2xs opacity-80",children:[t.location!==""&&d.jsx(bc,{className:"size-3 shrink-0"}),d.jsx("span",{className:"truncate",children:c}),t.attendees.length>0&&d.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[d.jsx(lc,{className:"size-3"}),t.attendees.length]})]}):void 0})})}function dh({nextUp:t,calendars:e,today:n,onSelectEvent:r,onGoTo:s,touch:i,className:a}){const{running:o,next:l,minutesUntilNext:c,after:u,free:f}=t,h=S.useMemo(()=>{const g=new Map(e.map(v=>[v.id,v.color]));return v=>g.get(v)??"cal-1"},[e]);return d.jsxs("section",{className:j("flex flex-col gap-2 rounded-lg border border-line bg-surface-raised p-3",a),children:[o.length>0&&d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx(li,{icon:d.jsx(jd,{className:"size-3 text-danger"}),children:"Now"}),o.map(g=>d.jsx(ci,{eventId:g.id,title:g.title,color:h(g.calendarId),meta:`until ${g.end.slice(11,16)}`,onSelect:r,touch:i},g.id))]}),d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsx(li,{icon:d.jsx(pd,{className:"size-3"}),children:l?`Next · in ${nt(c)}`:"Next"}),l?d.jsx(ci,{eventId:l.id,title:l.title,color:h(l.calendarId),meta:`${vr(l.start.slice(0,10),n)}${l.start.slice(11,16)}${l.location===""?"":` · ${l.location}`}`,onSelect:r,touch:i}):d.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing else booked."}),u&&d.jsxs("p",{className:"truncate pl-1 text-2xs text-fg-subtle",children:["then ",u.title," · ",vr(u.start.slice(0,10),n),u.start.slice(11,16)]})]}),f&&d.jsxs("button",{type:"button",onClick:()=>s(f.date),className:j("flex items-center gap-2 rounded-md border border-dashed border-accent-2 bg-accent-2-soft/40 px-2 text-left text-accent-2 outline-none transition-colors hover:bg-accent-2-soft focus-visible:ring-2 focus-visible:ring-ring",i?"min-h-11":"min-h-8"),children:[d.jsx(Hd,{className:"size-3.5 shrink-0"}),d.jsxs("span",{className:"text-xs font-medium",children:[nt(f.minutes)," free"]}),d.jsxs("span",{className:"text-2xs tabular-nums opacity-80",children:[vr(f.date,n),ze(f.startMinute)," – ",ze(f.endMinute)]})]})]})}function li({icon:t,children:e}){return d.jsxs("h3",{className:"flex items-center gap-1.5 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:[t,e]})}function ci({eventId:t,title:e,color:n,meta:r,onSelect:s,touch:i}){const a=sn(n);return d.jsx("button",{type:"button",onClick:()=>s(t),className:j("flex w-full items-center gap-2 rounded-md border-l-2 px-2 py-1 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",a.soft,a.text,a.rail,i&&"min-h-12"),children:d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("span",{className:"block truncate text-sm font-medium",children:e}),d.jsx("span",{className:"block truncate text-2xs opacity-80",children:r})]})})}function vr(t,e){return t===e?"":t===ke(e,1)?"tomorrow · ":`${ud(t)} · `}const wo=`${Bf}Record`,Do=`${Wf}Record`,xo=`${Vf}Record`,uh=new WeakMap,Co=new WeakMap,To=new WeakMap,Ro=new WeakMap;function No(t){return fh(t)||Jn()}function fh(t){return uh.get(t)}function Mo(t){return hh(t)||Jn()}function hh(t){return Co.get(t)}function Io(t,e){Co.set(t,e)}function ko(t){return gh(t)||Jn()}function gh(t){return To.get(t)}function Po(t,e){To.set(t,e)}function jo(t){return mh(t)||Jn()}function mh(t){return Ro.get(t)}function Ho(t,e){Ro.set(t,e)}function Oo(t){return No(t).id}function Ao(t){const e=No(t).ue;return e||be(eu(Oo(t),"getExotic or getAny")),e}function ph(t){if(t!==void 0)return vh(t)}function vh(t){return Ao(t),Oo(t)}const Wt=jo,yh=Pt(wo,class{get calendarId(){return Wt(this).calendarId}toJSON(){return Wt(this).toJSON()}valueOf(){return Wt(this).valueOf()}},Wt,po,mo);function bh(t){const e=Object.create(yh.prototype);return Ho(e,t),jt(e),e}function Eh(t,e,n,r,s,i,a,o,l,c){return bh(new lt.PlainDateTime(t,e,n,r,s,i,a,o,l,ph(c)))}function Sh(t,e,n){return Lo(Wt(t).toZonedDateTime(e,n))}const We=ko,wh=Pt(Do,class{get calendarId(){return We(this).calendarId}get timeZoneId(){return We(this).timeZoneId}get epochMilliseconds(){return We(this).epochMilliseconds}get epochNanoseconds(){return We(this).epochNanoseconds}toJSON(){return We(this).toJSON()}valueOf(){return We(this).valueOf()}},We,po,mo);function Lo(t){const e=Object.create(wh.prototype);return Po(e,t),jt(e),e}function Dh(t){return We(t).offsetNanoseconds}const Vt=Mo,xh=Pt(xo,class{get epochMilliseconds(){return Vt(this).epochMilliseconds}get epochNanoseconds(){return Vt(this).epochNanoseconds}toJSON(){return Vt(this).toJSON()}valueOf(){return Vt(this).valueOf()}});function Ch(t){const e=Object.create(xh.prototype);return Io(e,t),jt(e),e}function Th(t){return Ch(lt.Instant.fromEpochMilliseconds(t))}function Rh(t,e){return Lo(Vt(t).toZonedDateTimeISO(e))}function Nh(t){return t===void 0?kt:Mh(t)}function Mh(t){return Ao(t)()}const Sn=jo,Ih=Pt(wo,class{get calendarId(){return Gn(Sn(this).calendar)}toJSON(){return pf(Sn(this))}valueOf(){return ms()}},Sn,ps,cs);function kh(t){const e=Object.create(Ih.prototype);return Ho(e,t),jt(e),e}function Ph(t,e,n,r=0,s=0,i=0,a=0,o=0,l=0,c){const u=Zu(Nu(ss(rs,{year:t,month:e,day:n,hour:r,minute:s,second:i,millisecond:a,microsecond:o,nanosecond:l}))),f=Nh(c);return kh(Qu(u,f))}function jh(t,e,n){return _o(Pf(Sn(t),go(fo(e)),n))}const Qe=ko,Hh=Pt(Do,class{get calendarId(){return Gn(Qe(this).calendar)}get timeZoneId(){return Qe(this).timeZone.id}get epochMilliseconds(){return so(Qe(this))}get epochNanoseconds(){return io(Qe(this))}toJSON(){return mf(Qe(this))}valueOf(){return ms()}},Oh,ps,cs);function _o(t){const e=Object.create(Hh.prototype);return Po(e,t),jt(e),e}function Oh(t){const e=Qe(t);return{...ao(e),calendar:e.calendar}}function Ah(t){return ao(Qe(t)).offsetNanoseconds}const wn=Mo,Lh=Pt(xo,class{get epochMilliseconds(){return so(wn(this))}get epochNanoseconds(){return io(wn(this))}toJSON(){return gf(wn(this))}valueOf(){return ms()}});function _h(t){const e=Object.create(Lh.prototype);return Io(e,t),jt(e),e}function Uh(t){return _h(jf(t))}function Fh(t,e){return _o(kf(wn(t),go(fo(e))))}const Bh=lt?Dh:Ah,di=lt?Eh:Ph,ui=lt?Sh:jh,Wh=lt?Th:Uh,Vh=lt?Rh:Fh;function fi(t,e){let n=Tt(t);return n[2]+=e*7,De(n)}function fe(t,e){let n=Tt(t);return n[2]+=e,De(n)}function st(t,e){let n=Tt(t);return n[6]+=e,De(n)}function zh(t,e){return Ht(t,e)/7}function Ht(t,e){return(e.valueOf()-t.valueOf())/(1e3*60*60*24)}function $h(t,e){return(e.valueOf()-t.valueOf())/(1e3*60*60)}function Yh(t,e){return(e.valueOf()-t.valueOf())/(1e3*60)}function Gh(t,e){return(e.valueOf()-t.valueOf())/1e3}function Zh(t,e){let n=X(t),r=X(e);return{years:0,months:0,days:Math.round(Ht(n,r)),milliseconds:e.valueOf()-r.valueOf()-(t.valueOf()-n.valueOf())}}function Uo(t,e){let n=qt(t,e);return n!==null&&n%7===0?n/7:null}function qt(t,e){return yt(t)===yt(e)?Math.round(Ht(t,e)):null}function X(t){return De([t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()])}function qh(t){return De([t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours()])}function Xh(t){return De([t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes()])}function Kh(t){return De([t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds()])}function Qh(t,e,n){let r=t.getUTCFullYear(),s=yr(t,r,e,n);if(s<1)return yr(t,r-1,e,n);let i=yr(t,r+1,e,n);return i>=1?Math.min(s,i):s}function yr(t,e,n,r){let s=De([e,0,1+Jh(e,n,r)]),i=X(t),a=Math.round(Ht(s,i));return Math.floor(a/7)+1}function Jh(t,e,n){let r=7+e-n;return-((7+De([t,0,r]).getUTCDay()-e)%7)+r-1}function eg(t){return[t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]}function hi(t){return new Date(t[0],t[1]||0,t[2]==null?1:t[2],t[3]||0,t[4]||0,t[5]||0)}function Tt(t){return[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()]}function De(t){return t.length===1&&(t=t.concat([0])),new Date(Date.UTC(...t))}function Fo(t){return!isNaN(t.valueOf())}function yt(t){return t.getUTCHours()*1e3*60*60+t.getUTCMinutes()*1e3*60+t.getUTCSeconds()*1e3+t.getUTCMilliseconds()}let Bo={};function tg(t,e){Bo[t]=e}function ng(t){return new Bo[t]}class rg{getMarkerYear(e){return e.getUTCFullYear()}getMarkerMonth(e){return e.getUTCMonth()}getMarkerDay(e){return e.getUTCDate()}arrayToMarker(e){return De(e)}markerToArray(e){return Tt(e)}}tg("gregory",rg);function sg(t,e){let n=null,r=null;return t.start&&(n=e.createMarker(t.start)),t.end&&(r=e.createMarker(t.end)),!n&&!r||n&&r&&r<n?null:{start:n,end:r}}function gi(t,e){let n=[],{start:r}=e,s,i;for(t.sort(ig),s=0;s<t.length;s+=1)i=t[s],i.start>r&&n.push({start:r,end:i.start}),i.end>r&&(r=i.end);return r<e.end&&n.push({start:r,end:e.end}),n}function ig(t,e){return t.start.valueOf()-e.start.valueOf()}function Xt(t,e){let{start:n,end:r}=t,s=null;return e.start!==null&&(n===null?n=e.start:n=new Date(Math.max(n.valueOf(),e.start.valueOf()))),e.end!=null&&(r===null?r=e.end:r=new Date(Math.min(r.valueOf(),e.end.valueOf()))),(n===null||r===null||n<r)&&(s={start:n,end:r}),s}function ag(t,e){return(t.start===null?null:t.start.valueOf())===(e.start===null?null:e.start.valueOf())&&(t.end===null?null:t.end.valueOf())===(e.end===null?null:e.end.valueOf())}function vs(t,e){return(t.end===null||e.start===null||t.end>e.start)&&(t.start===null||e.end===null||t.start<e.end)}function er(t,e){return(t.start===null||e.start!==null&&e.start>=t.start)&&(t.end===null||e.end!==null&&e.end<=t.end)}function et(t,e){return(t.start===null||e>=t.start)&&(t.end===null||e<t.end)}function og(t,e){return e.start!=null&&t<e.start?e.start:e.end!=null&&t>=e.end?new Date(e.end.valueOf()-1):t}function mi(t,e){let n=e.markerToArray(t.marker);return{marker:t.marker,timeZoneOffset:t.timeZoneOffset,array:n,year:n[0],month:n[1],day:n[2],hour:n[3],minute:n[4],second:n[5],millisecond:n[6]}}function Pn(t,e,n){let r=mi(t,n.calendarSystem),s=e?mi(e,n.calendarSystem):null;return{date:r,start:r,end:s,timeZone:n.timeZone,localeCodes:n.locale.codes}}function br(t){return t%1===0}function Er(t,e){let n=String(t);return"000".substr(0,e-n.length)+n}const lg=/^(-?)(?:(\d+)\.)?(\d+):(\d\d)(?::(\d\d)(?:\.(\d\d\d))?)?/;function $(t,e){return typeof t=="string"?cg(t):typeof t=="object"&&t?pi(t):typeof t=="number"?pi({[e||"milliseconds"]:t}):null}function cg(t){let e=lg.exec(t);if(e){let n=e[1]?-1:1;return{years:0,months:0,days:n*(e[2]?parseInt(e[2],10):0),milliseconds:n*((e[3]?parseInt(e[3],10):0)*60*60*1e3+(e[4]?parseInt(e[4],10):0)*60*1e3+(e[5]?parseInt(e[5],10):0)*1e3+(e[6]?parseInt(e[6],10):0))}}return null}function pi(t){let e={years:t.years||t.year||0,months:t.months||t.month||0,days:t.days||t.day||0,milliseconds:(t.hours||t.hour||0)*60*60*1e3+(t.minutes||t.minute||0)*60*1e3+(t.seconds||t.second||0)*1e3+(t.milliseconds||t.millisecond||t.ms||0)},n=t.weeks||t.week;return n&&(e.days+=n*7,e.specifiedWeeks=!0),e}function dg(t,e){return t.years===e.years&&t.months===e.months&&t.days===e.days&&t.milliseconds===e.milliseconds}function ug(t,e){return{years:t.years-e.years,months:t.months-e.months,days:t.days-e.days,milliseconds:t.milliseconds-e.milliseconds}}function fg(t){return Dt(t)/365}function hg(t){return Dt(t)/30}function Dt(t){return Kt(t)/864e5}function Kt(t){return t.years*(365*864e5)+t.months*(30*864e5)+t.days*864e5+t.milliseconds}function Or(t){let e=t.milliseconds;if(e){if(e%1e3!==0)return{unit:"millisecond",value:e};if(e%(1e3*60)!==0)return{unit:"second",value:e/1e3};if(e%(1e3*60*60)!==0)return{unit:"minute",value:e/(1e3*60)};if(e)return{unit:"hour",value:e/(1e3*60*60)}}return t.days?t.specifiedWeeks&&t.days%7===0?{unit:"week",value:t.days/7}:{unit:"day",value:t.days}:t.months?{unit:"month",value:t.months}:t.years?{unit:"year",value:t.years}:{unit:"millisecond",value:0}}function gg(t,e,n=!1){let r=t.toISOString();return r=r.replace(".000",""),n&&(r=r.replace("T00:00:00Z","")),r.length>10&&(e==null?r=r.replace("Z",""):e!==0&&(r=r.replace("Z",tr(e,!0)))),r}function ys(t){return t.toISOString().replace(/T.*$/,"")}function tr(t,e=!1){let n=t<0?"-":"+",r=Math.abs(t),s=Math.floor(r/60),i=Math.round(r%60);return e?`${n+Er(s,2)}:${Er(i,2)}`:`GMT${n}${s}${i?`:${Er(i,2)}`:""}`}function ye(t){let e="";for(const n of t)e+=n.value;return e}const mg=/^\s*(\d{4})(-?(\d{2})(-?(\d{2})([T ](\d{2}):?(\d{2})(:?(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/;function pg(t){let e=mg.exec(t);if(e){let n=new Date(Date.UTC(Number(e[1]),e[3]?Number(e[3])-1:0,Number(e[5]||1),Number(e[7]||0),Number(e[8]||0),Number(e[10]||0),e[12]?+`0.${e[12]}`*1e3:0));if(Fo(n)){let r=null;return e[13]&&(r=(e[15]==="-"?-1:1)*(Number(e[16]||0)*60+Number(e[18]||0))),{marker:n,isTimeUnspecified:!e[6],timeZoneOffset:r}}}return null}class vg{constructor(e){this.timeZone=e.timeZone,this.calendarSystem=ng(e.calendarSystem),this.locale=e.locale,this.weekDow=e.locale.week.dow,this.weekDoy=e.locale.week.doy,e.weekNumberCalculation==="ISO"&&(this.weekDow=1,this.weekDoy=4),typeof e.firstDay=="number"&&(this.weekDow=e.firstDay),typeof e.weekNumberCalculation=="function"&&(this.weekNumberFunc=e.weekNumberCalculation),this.weekTextLong=e.weekTextLong,this.weekTextShort=e.weekTextShort??e.weekTextLong,this.cmdFormatter=e.cmdFormatter}createMarker(e){let n=this.createMarkerMeta(e);return n===null?null:n.marker}createNowMarker(){return this.timestampToMarker(new Date().valueOf())}createMarkerMeta(e){if(typeof e=="string")return this.parse(e);let n=null;return typeof e=="number"?n=this.timestampToMarker(e):e instanceof Date?(e=e.valueOf(),isNaN(e)||(n=this.timestampToMarker(e))):Array.isArray(e)&&(n=De(e)),n===null||!Fo(n)?null:{marker:n,isTimeUnspecified:!1}}parse(e){let n=pg(e);if(n===null)return null;let{marker:r}=n;return n.timeZoneOffset!==null&&(r=this.timestampToMarker(r.valueOf()-n.timeZoneOffset*60*1e3)),{marker:r,isTimeUnspecified:n.isTimeUnspecified}}getYear(e){return this.calendarSystem.getMarkerYear(e)}getMonth(e){return this.calendarSystem.getMarkerMonth(e)}getDay(e){return this.calendarSystem.getMarkerDay(e)}add(e,n){let r=this.calendarSystem.markerToArray(e);return r[0]+=n.years,r[1]+=n.months,r[2]+=n.days,r[6]+=n.milliseconds,this.calendarSystem.arrayToMarker(r)}subtract(e,n){let r=this.calendarSystem.markerToArray(e);return r[0]-=n.years,r[1]-=n.months,r[2]-=n.days,r[6]-=n.milliseconds,this.calendarSystem.arrayToMarker(r)}addYears(e,n){let r=this.calendarSystem.markerToArray(e);return r[0]+=n,this.calendarSystem.arrayToMarker(r)}addMonths(e,n){let r=this.calendarSystem.markerToArray(e);return r[1]+=n,this.calendarSystem.arrayToMarker(r)}diffWholeYears(e,n){let{calendarSystem:r}=this;return yt(e)===yt(n)&&r.getMarkerDay(e)===r.getMarkerDay(n)&&r.getMarkerMonth(e)===r.getMarkerMonth(n)?r.getMarkerYear(n)-r.getMarkerYear(e):null}diffWholeMonths(e,n){let{calendarSystem:r}=this;return yt(e)===yt(n)&&r.getMarkerDay(e)===r.getMarkerDay(n)?r.getMarkerMonth(n)-r.getMarkerMonth(e)+(r.getMarkerYear(n)-r.getMarkerYear(e))*12:null}greatestWholeUnit(e,n){let r=this.diffWholeYears(e,n);return r!==null?{unit:"year",value:r}:(r=this.diffWholeMonths(e,n),r!==null?{unit:"month",value:r}:(r=Uo(e,n),r!==null?{unit:"week",value:r}:(r=qt(e,n),r!==null?{unit:"day",value:r}:(r=$h(e,n),br(r)?{unit:"hour",value:r}:(r=Yh(e,n),br(r)?{unit:"minute",value:r}:(r=Gh(e,n),br(r)?{unit:"second",value:r}:{unit:"millisecond",value:n.valueOf()-e.valueOf()}))))))}countDurationsBetween(e,n,r){let s;return r.years&&(s=this.diffWholeYears(e,n),s!==null)?s/fg(r):r.months&&(s=this.diffWholeMonths(e,n),s!==null)?s/hg(r):r.days&&(s=qt(e,n),s!==null)?s/Dt(r):(n.valueOf()-e.valueOf())/Kt(r)}startOf(e,n){return n==="year"?this.startOfYear(e):n==="month"?this.startOfMonth(e):n==="week"?this.startOfWeek(e):n==="day"?X(e):n==="hour"?qh(e):n==="minute"?Xh(e):n==="second"?Kh(e):null}startOfYear(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e)])}startOfMonth(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e),this.calendarSystem.getMarkerMonth(e)])}startOfWeek(e){return this.calendarSystem.arrayToMarker([this.calendarSystem.getMarkerYear(e),this.calendarSystem.getMarkerMonth(e),e.getUTCDate()-(e.getUTCDay()-this.weekDow+7)%7])}computeWeekNumber(e){return this.weekNumberFunc?this.weekNumberFunc(this.toDate(e)):Qh(e,this.weekDow,this.weekDoy)}formatToParts(e,n){return n.formatToParts({marker:e,timeZoneOffset:this.offsetForMarker(e)},this)}formatRangeToParts(e,n,r,s={}){return s.isEndExclusive&&(n=st(n,-1)),r.formatRangeToParts({marker:e,timeZoneOffset:this.offsetForMarker(e)},{marker:n,timeZoneOffset:this.offsetForMarker(n)},this)}formatIso(e,n={}){let r=null;return n.omitTimeZoneOffset||(r=this.offsetForMarker(e)),gg(e,r,n.omitTime)}timestampToMarker(e){if(this.timeZone==="local")return De(eg(new Date(e)));if(this.timeZone==="UTC")return new Date(e);const n=Vh(Wh(e),this.timeZone);return new Date(Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond))}offsetForMarker(e){return this.timeZone==="local"?-hi(Tt(e)).getTimezoneOffset():this.timeZone==="UTC"?0:Bh(ui(di(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),this.timeZone))/(1e9*60)}toDate(e){return this.timeZone==="local"?hi(Tt(e)):this.timeZone==="UTC"?new Date(e.valueOf()):new Date(ui(di(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),this.timeZone).epochMilliseconds)}}const yg=new Set(["week","meridiem","omitZeroMinute","omitCommas","forceCommas","omitTrailing","weekdayJustify"]),pn=/([ap])\.?m\.?/i,bg=/,/g,Eg=/\u200e/g,Sg=/[\s.,]+$/,Ar=/^\s+$/;class wg{constructor(e){const n={},r={};for(const s in e)yg.has(s)?r[s]=e[s]:n[s]=e[s];n.timeZoneName==="long"&&(n.timeZoneName="short"),this.timeZoneOnly=Object.keys(n).length===1&&n.timeZoneName==="short",this.weekOnly=!!(!Object.keys(n).length&&r.week),this.timeZoneOnly||(n.timeZoneName&&(n.hour||(n.hour="2-digit"),n.minute||(n.minute="2-digit")),r.omitZeroMinute&&(n.second||n.fractionalSecondDigits)&&delete r.omitZeroMinute,n.timeZone="UTC"),this.standardOptions=n,this.extendedOptions=r}formatToParts(e,n){const{standardOptions:r,extendedOptions:s}=this;if(this.timeZoneOnly)return[{type:"timeZoneName",value:tr(e.timeZoneOffset)}];if(this.weekOnly)return Cg(n.computeWeekNumber(e.marker),n.weekTextLong,n.weekTextShort,n.locale,s.week);const{normalFormat:i,zeroFormat:a}=this.getFormats(n),l=(a&&!e.marker.getUTCMinutes()?a:i).formatToParts(e.marker);return Dg(l,e,r,s)}formatRangeToParts(e,n,r){const{standardOptions:s,extendedOptions:i}=this;if(this.timeZoneOnly||this.weekOnly)return this.formatToParts(e,r).map(u=>({source:u.type==="literal"?"shared":"startRange",...u}));const{normalFormat:a,zeroFormat:o}=this.getFormats(r),c=(o&&!e.marker.getUTCMinutes()&&!n.marker.getUTCMinutes()?o:a).formatRangeToParts(e.marker,n.marker);return xg(c,e,n,s,i)}getFormats(e){if(this.cachedContext!==e){const{standardOptions:n,extendedOptions:r}=this,{codes:s}=e.locale,i=new Intl.DateTimeFormat(s,n);let a;if(r.omitZeroMinute){const o={...n};delete o.minute,a=new Intl.DateTimeFormat(s,o)}this.cachedContext=e,this.cachedFormats={normalFormat:i,zeroFormat:a}}return this.cachedFormats}}function Wo(t,e,n){let r=!1,s;for(const i of t){const a=i.type==="literal";if(a||i.type==="dayPeriod"){let o=i.value;if(o=o.replace(Eg,""),e.omitCommas&&(o=o.replace(bg,"")),!a){const{meridiem:l}=e;l===!1?o=o.replace(pn,""):l==="narrow"?o=o.replace(pn,(c,u)=>u.toLocaleLowerCase()):l==="short"?o=o.replace(pn,(c,u)=>`${u.toLocaleLowerCase()}m`):l==="lowercase"&&(o=o.replace(pn,c=>c.toLocaleLowerCase())),s&&(s.value=s.value.trimEnd())}i.value=o}else if(i.type==="timeZoneName"){const o=n(i);o!=null&&(i.value=o,r=!0)}s=a?i:void 0}return{lastLiteral:s,anyTzInjected:r}}function Dg(t,e,n,r){const s=n.timeZoneName==="short"?e.timeZoneOffset==null?"UTC":tr(e.timeZoneOffset):void 0,{lastLiteral:i,anyTzInjected:a}=Wo(t,r,()=>s);if(s&&!a&&(i?i.value+=" ":t.push({type:"literal",value:" "}),t.push({type:"timeZoneName",value:s})),r.weekdayJustify&&t.length===3&&Ar.test(t[1].value)&&t[r.weekdayJustify==="start"?2:0].type==="weekday"&&t.reverse(),r.forceCommas)for(const o of t)o.type==="literal"&&Ar.test(o.value)&&(o.value=`,${o.value}`);return r.omitTrailing&&Vo(t),t.filter(o=>o.value)}function xg(t,e,n,r,s){const i=r.timeZoneName==="short";if(Wo(t,s,a=>{if(!i)return;const o=a.source==="endRange"?n.timeZoneOffset:e.timeZoneOffset;return o==null?"UTC":tr(o)}),s.forceCommas)for(const a of t)a.type==="literal"&&Ar.test(a.value)&&(a.value=`,${a.value}`);return s.omitTrailing&&Vo(t),t.filter(a=>a.value)}function Vo(t){const e=t[t.length-1];e?.type==="literal"&&(e.value=e.value.replace(Sg,""),e.value||t.pop())}function Cg(t,e,n,r,s){const i=[];return s==="long"?i.push({type:"literal",value:e}):(s==="short"||s==="narrow")&&i.push({type:"literal",value:n}),(s==="long"||s==="short")&&i.push({type:"literal",value:" "}),i.push({type:"week",value:r.simpleNumberFormat.format(t)}),r.options.direction==="rtl"&&i.reverse(),i}class Tg{constructor(e){this.cmdStr=e}formatToParts(e,n){const r=n.cmdFormatter(this.cmdStr,Pn(e,null,n));return Array.isArray(r)?r:[{type:"literal",value:r}]}formatRangeToParts(e,n,r){const s=r.cmdFormatter(this.cmdStr,Pn(e,n,r));return Array.isArray(s)?s.map(i=>({source:"shared",...i})):[{source:"shared",type:"literal",value:s}]}}class Rg{constructor(e){this.func=e}formatToParts(e,n){return[{type:"literal",value:this.func(Pn(e,null,n))}]}formatRangeToParts(e,n,r){return[{source:"shared",type:"literal",value:this.func(Pn(e,n,r))}]}}var y={popoverZ:"fc-nH",isolate:"fc-7s",borderBoxRoot:"fc-wa",notAllowed:"fc-4m",noScrollbars:"fc-eM",noShrink:"fc-Qo",calendarScreenRoot:"fc-fi",calendarPrintRoot:"fc-Jf",cursorPointer:"fc-DP",cursorResizeT:"fc-An",cursorResizeB:"fc-lZ",cursorResizeS:"fc-9V",cursorResizeE:"fc-70",hit:"fc-mN",hitX:"fc-2d",hitY:"fc-B0",borderNone:"fc-Tu",borderOnlyB:"fc-3e",borderOnlyS:"fc-PB",fakeBorderS:"fc-2l",flexRow:"fc-Ao",flexCol:"fc-HH",grow:"fc-GV",liquid:"fc-g2",minHeight0:"fc-Ot",printRoot:"fc-uD",printHeader:"fc-jM",noPadding:"fc-OJ",noMargin:"fc-oE",whiteSpaceNoWrap:"fc-y2",overflowAnchorNone:"fc-gZ",crop:"fc-FA",rel:"fc-cc",abs:"fc-H0",fill:"fc-ct",fillTop:"fc-iv",fillY:"fc-7k",fillStart:"fc-Yw",sticky:"fc-Ip",stickyT:"fc-CS",stickyS:"fc-tT",tableHeaderSticky:"fc-hy",contentBox:"fc-Np",alignCenter:"fc-6H",alignStart:"fc-K8",alignEnd:"fc-E3",footerScrollbarSticky:"fc-Px",footerScrollbar:"fc-J4",breakInsideAvoid:"fc-Yi",printSiblingRow:"fc-fx",z0:"fc-BS",z1:"fc-iu",focusZ2:"fc-Bk",internalEvent:"fc-Ft",internalEventMirror:"fc-lc",internalEventDraggable:"fc-uL",internalEventSelected:"fc-Bv",internalEventResizable:"fc-Qk",internalEventResizer:"fc-9X",internalEventResizerStart:"fc-Sj",internalEventResizerEnd:"fc-DL",internalBgEvent:"fc-oP",internalMoreLink:"fc-R2",internalNavLink:"fc-SW",internalPopover:"fc-Cs",internalView:"fc-LQ",internalScroller:"fc-dT"};function O(...t){return t.filter(Boolean).join(" ")}function vi(t){return t*100+"%"}function J(t){return typeof t=="object"&&t?new wg(t):typeof t=="string"?new Tg(t):typeof t=="function"?new Rg(t):null}function $e(...t){console.warn("FullCalendar:",...t)}const yi={};function se(t,e){return!t||typeof t=="string"?t:(Ng(e),"")}function I(t,e){return typeof t=="function"?n=>se(t(n),e):se(t,e)}function Ng(t){yi[t]||($e(`Invalid option \`${t}\`: expected a className string or a falsy value.`),yi[t]=!0)}function nr(t){t.preventDefault()}function Mg(t,e){return n=>{let r=n.target.closest(t);r&&e.call(r,n,r)}}function zo(t,e,n,r){let s=Mg(n,r);return t.addEventListener(e,s),()=>{t.removeEventListener(e,s)}}function Ig(t,e,n,r){let s;return zo(t,"mouseover",e,(i,a)=>{if(a!==s){s=a,n(i,a);let o=l=>{s=null,r(l,a),a.removeEventListener("mouseleave",o)};a.addEventListener("mouseleave",o)}})}const bi=["webkitTransitionEnd","otransitionend","oTransitionEnd","msTransitionEnd","transitionend"];function kg(t,e){let n=r=>{e(r),bi.forEach(s=>{t.removeEventListener(s,n)})};bi.forEach(r=>{t.addEventListener(r,n)})}function bs(t){return{onClick:t,...$o(t)}}function $o(t){return{tabIndex:0,onKeyDown(e){(e.key==="Enter"||e.key===" ")&&(t(e),e.preventDefault())}}}let Ei=0;function _e(){return Ei+=1,String(Ei)}function Es(){document.body.classList.add(y.notAllowed)}function Ss(){document.body.classList.remove(y.notAllowed)}function Pg(t){t.style.userSelect="none",t.style.webkitUserSelect="none",t.addEventListener("selectstart",nr)}function jg(t){t.style.userSelect="",t.style.webkitUserSelect="",t.removeEventListener("selectstart",nr)}function Hg(t){t.addEventListener("contextmenu",nr)}function Og(t){t.removeEventListener("contextmenu",nr)}function Ag(t){let e=[],n=[],r,s;for(typeof t=="string"?n=t.split(/\s*,\s*/):typeof t=="function"?n=[t]:Array.isArray(t)&&(n=t),r=0;r<n.length;r+=1)s=n[r],typeof s=="string"?e.push(s.charAt(0)==="-"?{field:s.substring(1),order:-1}:{field:s,order:1}):typeof s=="function"&&e.push({func:s});return e}function Lg(t,e,n){let r,s;for(r=0;r<n.length;r+=1)if(s=_g(t,e,n[r]),s)return s;return 0}function _g(t,e,n){return n.func?n.func(t,e):Ug(t[n.field],e[n.field])*(n.order||1)}function Ug(t,e){return!t&&!e?0:e==null?-1:t==null?1:typeof t=="string"||typeof e=="string"?String(t).localeCompare(String(e)):t-e}function we(t,e,n){return typeof t=="function"?t(...e):typeof t=="string"?e.reduce((r,s,i)=>r.replace("$"+i,s||""),t):n}function Fg(t,e){return t-e}function Yo(t,e){return t===e}function Ot(t){const e=t.borderless;return{borderlessX:!!(t.borderlessX??e),borderlessTop:!!(t.borderlessTop??e),borderlessBottom:!!(t.borderlessBottom??e)}}const{hasOwnProperty:Rt}=Object.prototype;function it(t,e){let n={};for(let r in t)e(t[r],r)&&(n[r]=t[r]);return n}function ct(t,e){let n={};for(let r in t)n[r]=e(t[r],r);return n}function Go(t){let e=[];for(let n in t)e.push(t[n]);return e}function Zo(t){let e={};for(let n of t)e[n]=!0;return e}function Bg(t,e){return typeof t=="object"&&t&&typeof e=="object"&&e?ws(t,e,at):t===e}function ws(t,e,n){if(t===e)return!0;for(let r in t)if(Rt.call(t,r)&&!(r in e))return!1;for(let r in e)if(Rt.call(e,r)&&(!(r in t)||!n(t[r],e[r],r)))return!1;return!0}function Sr(t,e){return typeof t=="object"&&typeof e=="object"&&t&&e?at(t,e):t===e}function at(t,e){return ws(t,e,Yo)}function Si(t,e,n){return ws(t,e,(r,s,i)=>{const a=n[i];return a?a(r,s):r===s})}function Wg(t,e){let n=[];for(let r in t)Rt.call(t,r)&&(r in e||n.push(r));for(let r in e)Rt.call(e,r)&&t[r]!==e[r]&&n.push(r);return n}function Vg(t,e){return t?zg(t,e,$g):e}function zg(t,e,n){const r={};for(let s in t)Rt.call(t,s)&&(s in e||(r[s]=t[s]));for(let s in e)Rt.call(e,s)&&(s in t?r[s]=n(t[s],e[s]):r[s]=e[s]);return r}function $g(t,e){return Object.assign({},t,e)}function vn(t,e){return Array.isArray(t)&&Array.isArray(e)?Qt(t,e):t===e}function Qt(t,e,n=Yo){if(t===e)return!0;let r=t.length,s;if(r!==e.length)return!1;for(s=0;s<r;s+=1)if(!n(t[s],e[s]))return!1;return!0}const wi={navLinkDayClick:b,navLinkWeekClick:b,duration:$,buttons:b,toolbarElements:b,prevText:String,nextText:String,prevYearText:String,nextYearText:String,todayText:String,yearText:String,monthText:String,weekTextLong:String,weekTextShort:String,dayText:String,listText:b,todayHint:b,prevHint:b,nextHint:b,buttonDisplay:b,buttonGroupClass:I,buttonClass:I,defaultAllDayEventDuration:$,defaultTimedEventDuration:$,nextDayThreshold:$,scrollTime:$,scrollTimeReset:Boolean,slotMinTime:$,slotMaxTime:$,popoverFormat:J,slotDuration:$,snapDuration:$,headerToolbar:b,footerToolbar:b,forceEventDuration:Boolean,dayLaneClass:I,dayLaneInnerClass:I,dayLaneDidMount:b,dayLaneWillUnmount:b,initialView:String,aspectRatio:Number,weekends:Boolean,weekNumberCalculation:b,weekNumbers:Boolean,weekNumberHeaderClass:I,weekNumberHeaderInnerClass:I,weekNumberHeaderContent:b,weekNumberHeaderDidMount:b,weekNumberHeaderWillUnmount:b,inlineWeekNumberClass:I,inlineWeekNumberContent:b,inlineWeekNumberDidMount:b,inlineWeekNumberWillUnmount:b,editable:Boolean,controller:b,nowIndicator:Boolean,nowIndicatorSnap:b,nowIndicatorHeaderClass:I,nowIndicatorHeaderContent:b,nowIndicatorHeaderDidMount:b,nowIndicatorHeaderWillUnmount:b,nowIndicatorDotClass:se,nowIndicatorLineClass:I,nowIndicatorLineContent:b,nowIndicatorLineDidMount:b,nowIndicatorLineWillUnmount:b,showNonCurrentDates:Boolean,lazyFetching:Boolean,startParam:String,endParam:String,timeZoneParam:String,timeZone:String,locales:b,locale:b,dragRevertDuration:Number,dragScroll:Boolean,allDayMaintainDuration:Boolean,unselectAuto:Boolean,dropAccept:b,eventOrder:Ag,eventOrderStrict:Boolean,eventSlicing:Boolean,eventPrintLayout:String,longPressDelay:Number,eventDragMinDistance:Number,expandRows:Boolean,height:b,contentHeight:b,direction:String,colorScheme:String,weekNumberFormat:J,eventResizableFromStart:Boolean,displayEventTime:Boolean,displayEventEnd:Boolean,progressiveEventRendering:Boolean,businessHours:b,initialDate:b,now:b,eventDataTransform:b,tableHeaderSticky:b,footerScrollbarSticky:b,defaultAllDay:Boolean,eventSourceFailure:b,eventSourceSuccess:b,eventDisplay:String,eventStartEditable:Boolean,eventDurationEditable:Boolean,eventOverlap:b,eventConstraint:b,eventAllow:b,eventColor:String,eventContrastColor:String,eventDidMount:b,eventWillUnmount:b,eventContent:b,eventClass:I,eventInnerClass:I,eventTimeClass:I,eventTitleClass:I,eventBeforeClass:I,eventAfterClass:I,listItemEventClass:I,listItemEventInnerClass:I,listItemEventTimeClass:I,listItemEventTitleClass:I,listItemEventBeforeClass:I,listItemEventAfterClass:I,blockEventClass:I,blockEventInnerClass:I,blockEventTimeClass:I,blockEventTitleClass:I,blockEventBeforeClass:I,blockEventAfterClass:I,rowEventClass:I,rowEventInnerClass:I,rowEventTimeClass:I,rowEventTitleClass:I,rowEventTitleSticky:Boolean,rowEventBeforeClass:I,rowEventBeforeContent:b,rowEventAfterClass:I,rowEventAfterContent:b,columnEventClass:I,columnEventInnerClass:I,columnEventTimeClass:I,columnEventTitleClass:I,columnEventTitleSticky:Boolean,columnEventBeforeClass:I,columnEventAfterClass:I,backgroundEventClass:I,backgroundEventDidMount:b,backgroundEventWillUnmount:b,backgroundEventContent:b,backgroundEventInnerClass:I,backgroundEventTitleClass:I,backgroundEventColor:String,selectConstraint:b,selectOverlap:b,selectAllow:b,droppable:Boolean,unselectCancel:String,slotHeaderFormat:b,slotLaneClass:I,slotLaneDidMount:b,slotLaneWillUnmount:b,slotHeaderClass:I,slotHeaderInnerClass:I,slotHeaderContent:b,slotHeaderDidMount:b,slotHeaderWillUnmount:b,slotHeaderAlign:b,slotHeaderSticky:b,slotHeaderRowClass:se,slotHeaderDividerClass:I,dayMaxEvents:b,dayMaxEventRows:b,dayMinWidth:Number,slotHeaderInterval:$,dayHeaderClass:I,dayHeaderInnerClass:I,dayHeaderContent:b,dayHeaderDidMount:b,dayHeaderWillUnmount:b,dayHeaderAlign:b,_dayHeaderSticky:b,dayHeaderRowClass:se,dayHeaderDividerClass:I,dayRowClass:se,dayCellDidMount:b,dayCellWillUnmount:b,dayCellClass:I,dayCellInnerClass:I,dayCellTopContent:b,dayCellTopClass:I,dayCellTopInnerClass:I,dayCellBottomClass:I,allDaySlot:Boolean,allDayText:String,allDayHeaderClass:I,allDayHeaderInnerClass:I,allDayHeaderContent:b,allDayHeaderDidMount:b,allDayHeaderWillUnmount:b,timedText:String,slotMinWidth:Number,slotMinHeight:Number,navLinks:Boolean,eventTimeFormat:J,rerenderDelay:Number,moreLinkText:b,moreLinkHint:b,selectMinDistance:Number,selectable:Boolean,selectLongPressDelay:Number,eventLongPressDelay:Number,selectMirror:Boolean,eventMaxStack:Number,eventMinHeight:Number,eventMinWidth:Number,eventShortHeight:Number,slotEventOverlap:Boolean,firstDay:Number,dayCount:Number,dateAlignment:String,dateIncrement:$,hiddenDays:b,fixedWeekCount:Boolean,validRange:b,visibleRange:b,titleFormat:b,eventInteractive:Boolean,noEventsText:String,viewHint:b,viewChangeHint:String,navLinkHint:b,closeHint:String,eventsHint:String,headingLevel:Number,moreLinkClick:b,moreLinkContent:b,moreLinkDidMount:b,moreLinkWillUnmount:b,moreLinkClass:I,moreLinkInnerClass:I,rowMoreLinkClass:I,rowMoreLinkInnerClass:I,columnMoreLinkClass:I,columnMoreLinkInnerClass:I,navLinkClass:se,monthStartFormat:J,dayCellFormat:J,handleCustomRendering:b,customRenderingMetaMap:b,popoverClass:se,popoverCloseClass:se,popoverCloseContent:b,dayNarrowWidth:Number,borderless:Boolean,borderlessX:Boolean,borderlessTop:Boolean,borderlessBottom:Boolean,fillerClass:I,headerToolbarClass:I,footerToolbarClass:I,toolbarClass:I,toolbarSectionClass:I,toolbarTitleClass:se,tableClass:I,tableHeaderClass:I,tableBodyClass:I,nonBusinessHoursClass:se,highlightClass:se,dayHeaders:Boolean,dayHeaderFormat:J,allDayDividerClass:se,listDaysClass:se,listDayClass:I,listDayFormat:Ci,listDayAltFormat:Ci,listDayHeaderDidMount:b,listDayHeaderWillUnmount:b,listDayHeaderClass:I,listDayHeaderInnerClass:I,listDayHeaderContent:b,listDayBodyClass:I,noEventsClass:I,noEventsInnerClass:I,noEventsContent:b,noEventsDidMount:b,noEventsWillUnmount:b,multiMonthMaxColumns:Number,singleMonthMinWidth:Number,singleMonthTitleFormat:J,singleMonthDidMount:b,singleMonthWillUnmount:b,singleMonthClass:I,singleMonthHeaderClass:I,singleMonthHeaderInnerClass:I},wr={buttonDisplay:"auto",eventDisplay:"auto",defaultTimedEventDuration:"01:00:00",defaultAllDayEventDuration:{day:1},forceEventDuration:!1,nextDayThreshold:"00:00:00",initialView:"",aspectRatio:1.35,weekends:!0,weekNumbers:!1,weekNumberCalculation:"local",editable:!1,nowIndicator:!1,scrollTime:"06:00:00",scrollTimeReset:!0,slotMinTime:"00:00:00",slotMaxTime:"24:00:00",showNonCurrentDates:!0,lazyFetching:!0,startParam:"start",endParam:"end",timeZoneParam:"timeZone",timeZone:"local",locales:[],locale:"",dragRevertDuration:500,dragScroll:!0,allDayMaintainDuration:!1,unselectAuto:!0,dropAccept:"*",eventOrder:"start,-duration,allDay,title",eventPrintLayout:"auto",popoverFormat:{month:"long",day:"numeric",year:"numeric"},longPressDelay:1e3,eventDragMinDistance:5,expandRows:!1,navLinks:!1,selectable:!1,eventMinHeight:15,eventMinWidth:30,eventShortHeight:30,monthStartFormat:{month:"long",day:"numeric"},dayCellFormat:{day:"numeric",omitTrailing:!0},headingLevel:2,outerBorder:!0,dayNarrowWidth:80,eventOverlap:!0,slotHeaderAlign:"start",slotHeaderSticky:!0,dayHeaderAlign:"start",_dayHeaderSticky:!0,rowEventTitleSticky:!0,columnEventTitleSticky:!0,nowIndicatorSnap:"auto",dayHeaders:!0},Di={datesSet:b,eventsSet:b,eventAdd:b,eventChange:b,eventRemove:b,eventClick:b,eventMouseEnter:b,eventMouseLeave:b,select:b,unselect:b,loading:b,_unmount:b,_beforeprint:b,_afterprint:b,_noDateSelect:b,_noEventDrop:b,_noEventResize:b,_timeScrollRequest:b,dateClick:b,eventDragStart:b,eventDragStop:b,eventDrop:b,eventResizeStart:b,eventResizeStop:b,eventResize:b,drop:b,eventReceive:b,eventLeave:b},xi={class:I,className:I,viewClass:I,viewDidMount:b,viewWillUnmount:b,views:b,plugins:b,initialEvents:b,events:b,eventSources:b},Yg={type:String,component:b,class:I,className:I,content:b,didMount:b,willUnmount:b,buttonTextKey:String,dateProfileGeneratorClass:b,usesMinMaxTime:Boolean,disallowAmbigTitle:Boolean},gt={dateIncrement:Sr,headerToolbar:Sr,footerToolbar:Sr,buttons:Bg,plugins:vn,events:vn,eventSources:vn,resources:vn};function Ds(t,e){let n={},r={};for(let s in e)s in t&&(n[s]=e[s](t[s],s));for(let s in t)s in e||(r[s]=t[s]);return{refined:n,extra:r}}function b(t){return t}function Ci(t){return t===!1?null:J(t)}function qo(t){let e=Math.floor(Ht(t.start,t.end))||1,n=X(t.start),r=fe(n,e);return{start:n,end:r}}function Xo(t,e=$(0)){let n=null,r=null;if(t.end){r=X(t.end);let s=t.end.valueOf()-r.valueOf();s&&s>=Kt(e)&&(r=fe(r,1))}return t.start&&(n=X(t.start),r&&r<=n&&(r=fe(n,1))),{start:n,end:r}}function bt(t,e,n,r){return r==="year"?$(n.diffWholeYears(t,e),"year"):r==="month"?$(n.diffWholeMonths(t,e),"month"):Zh(t,e)}function xs(t,e){return{instanceId:_e(),defId:t,range:e}}function Gg(t,e,n,r){for(let s=0;s<r.length;s+=1){let i=r[s].parse(t,n);if(i){let{allDay:a}=t;return a==null&&(a=e,a==null&&(a=i.allDayGuess,a==null&&(a=!1))),{allDay:a,duration:i.duration,typeData:i.typeData,typeId:s}}}return null}function ot(t,e,n){let{dateEnv:r,pluginHooks:s,options:i}=n,{defs:a,instances:o}=t;o=it(o,l=>!a[l.defId].recurringDef);for(let l in a){let c=a[l];if(c.recurringDef){let{duration:u}=c.recurringDef;u||(u=c.allDay?i.defaultAllDayEventDuration:i.defaultTimedEventDuration);let f=Zg(c,u,e,r,s.recurringTypes);for(let h of f){let g=xs(l,{start:h,end:r.add(h,u)});o[g.instanceId]=g}}}return{defs:a,instances:o}}function Zg(t,e,n,r,s){let a=s[t.recurringDef.typeId].expand(t.recurringDef.typeData,{start:r.subtract(n.start,e),end:n.end},r);return t.allDay&&(a=a.map(X)),a}function Jt(t,e,n,r,s,i){let a=Me(),o=Rs(n);for(let l of t){let c=Qo(l,e,n,r,o,s,i);c&&Lr(c,a)}return a}function Lr(t,e=Me()){return e.defs[t.def.defId]=t.def,t.instance&&(e.instances[t.instance.instanceId]=t.instance),e}function Cs(t,e){let n=t.instances[e];if(n){let r=t.defs[n.defId],s=rr(t,i=>qg(r,i));return s.defs[r.defId]=r,s.instances[n.instanceId]=n,s}return Me()}function qg(t,e){return!!(t.groupId&&t.groupId===e.groupId)}function Me(){return{defs:{},instances:{}}}function Ts(t,e){return{defs:{...t.defs,...e.defs},instances:{...t.instances,...e.instances}}}function rr(t,e){let n=it(t.defs,e),r=it(t.instances,s=>n[s.defId]);return{defs:n,instances:r}}function Xg(t,e){let{defs:n,instances:r}=t,s={},i={};for(let a in n)e.defs[a]||(s[a]=n[a]);for(let a in r)!e.instances[a]&&s[r[a].defId]&&(i[a]=r[a]);return{defs:s,instances:i}}function Kg(t,e){return Array.isArray(t)?Jt(t,null,e,!0):typeof t=="object"&&t?Jt([t],null,e,!0):t!=null?String(t):null}const jn={display:String,editable:Boolean,startEditable:Boolean,durationEditable:Boolean,constraint:b,overlap:b,allow:b,class:se,className:se,color:String,contrastColor:String},Qg={display:null,startEditable:null,durationEditable:null,constraints:[],overlap:null,allows:[],color:"",contrastColor:"",className:""};function Hn(t,e){let n=Kg(t.constraint,e);return{display:t.display||null,startEditable:t.startEditable!=null?t.startEditable:t.editable,durationEditable:t.durationEditable!=null?t.durationEditable:t.editable,constraints:n!=null?[n]:[],overlap:t.overlap!=null?t.overlap:null,allows:t.allow!=null?[t.allow]:[],color:t.color||"",contrastColor:t.contrastColor||"",className:(t.class??t.className)||""}}function Jg(t){return t.reduce(em,Qg)}function em(t,e){return{display:e.display!=null?e.display:t.display,startEditable:e.startEditable!=null?e.startEditable:t.startEditable,durationEditable:e.durationEditable!=null?e.durationEditable:t.durationEditable,constraints:t.constraints.concat(e.constraints),overlap:typeof e.overlap=="boolean"?e.overlap:t.overlap,allows:t.allows.concat(e.allows),color:e.color||t.color,contrastColor:e.contrastColor||t.contrastColor,className:O(t.className,e.className)}}const Dn={id:String,groupId:String,title:String,url:String,interactive:Boolean},Ko={start:b,end:b,date:b,allDay:Boolean},tm={...Dn,...Ko,extendedProps:b};function Qo(t,e,n,r,s=Rs(n),i,a){let{refined:o,extra:l}=Jo(t,n,s),c=rm(e,n),u=Gg(o,c,n.dateEnv,n.pluginHooks.recurringTypes);if(u){let h=_r(o,l,e?e.sourceId:"",u.allDay,!!u.duration,n,i);return h.recurringDef={typeId:u.typeId,typeData:u.typeData,duration:u.duration},{def:h,instance:null}}let f=nm(o,c,n,r);if(f){let h=_r(o,l,e?e.sourceId:"",f.allDay,f.hasEnd,n,i),g=xs(h.defId,f.range);return a&&h.publicId&&a[h.publicId]&&(g.instanceId=a[h.publicId]),{def:h,instance:g}}return null}function Jo(t,e,n=Rs(e)){return Ds(t,n)}function Rs(t){return{...jn,...tm,...t.pluginHooks.eventRefiners}}function _r(t,e,n,r,s,i,a){let o={title:t.title||"",groupId:t.groupId||"",publicId:t.id||"",url:t.url||"",recurringDef:null,defId:(a&&t.id?a[t.id]:"")||_e(),sourceId:n,allDay:r,hasEnd:s,interactive:t.interactive,ui:Hn(t,i),extendedProps:{...t.extendedProps||{},...e}};for(let l of i.pluginHooks.eventDefMemberAdders)Object.assign(o,l(t));return Object.freeze(o.ui.className),Object.freeze(o.extendedProps),o}function nm(t,e,n,r){let{allDay:s}=t,i,a=null,o=!1,l,c=null,u=t.start!=null?t.start:t.date;if(i=n.dateEnv.createMarkerMeta(u),i)a=i.marker;else if(!r)return null;return t.end!=null&&(l=n.dateEnv.createMarkerMeta(t.end)),s==null&&(e!=null?s=e:s=(!i||i.isTimeUnspecified)&&(!l||l.isTimeUnspecified)),s&&a&&(a=X(a)),l&&(c=l.marker,s&&(c=X(c)),a&&c<=a&&(c=null)),c?o=!0:r||(o=n.options.forceEventDuration||!1,c=n.dateEnv.add(a,s?n.options.defaultAllDayEventDuration:n.options.defaultTimedEventDuration)),{allDay:s,hasEnd:o,range:{start:a,end:c}}}function rm(t,e){let n=null;return t&&(n=t.defaultAllDay),n==null&&(n=e.options.defaultAllDay),n}const sm={start:b,end:b,allDay:Boolean};function im(t,e,n){let r=am(t,e),{range:s}=r;if(!s.start)return null;if(!s.end){if(n==null)return null;s.end=e.add(s.start,n)}return r}function am(t,e){let{refined:n,extra:r}=Ds(t,sm),s=n.start?e.createMarkerMeta(n.start):null,i=n.end?e.createMarkerMeta(n.end):null,{allDay:a}=n;return a==null&&(a=s&&s.isTimeUnspecified&&(!i||i.isTimeUnspecified)),{range:{start:s?s.marker:null,end:i?i.marker:null},allDay:a,...r}}function om(t,e){return ag(t.range,e.range)&&t.allDay===e.allDay&&lm(t,e)}function lm(t,e){for(let n in e)if(n!=="range"&&n!=="allDay"&&t[n]!==e[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}function cm(t,e){return{...tl(t.range,e,t.allDay),allDay:t.allDay}}function el(t,e,n){return{...tl(t,e,n),timeZone:e.timeZone}}function tl(t,e,n){return{start:e.toDate(t.start),end:e.toDate(t.end),startStr:e.formatIso(t.start,{omitTime:n}),endStr:e.formatIso(t.end,{omitTime:n})}}function dm(t,e,n){let r=Jo({editable:!1},n),s=_r(r.refined,r.extra,"",t.allDay,!0,n);return{def:s,ui:sl(s,e),instance:xs(s.defId,t.range),range:t.range,isStart:!0,isEnd:!0}}function nl(t,e,n){n.emitter.trigger("select",{...Ns(t,n),jsEvent:e?e.origEvent:null,view:n.viewApi||n.calendarApi.view})}function um(t,e){e.emitter.trigger("unselect",{jsEvent:t?t.origEvent:null,view:e.viewApi||e.calendarApi.view})}function Ns(t,e){let n={};for(let r of e.pluginHooks.dateSpanTransforms)Object.assign(n,r(t,e));return Object.assign(n,cm(t,e.dateEnv)),n}function Ti(t,e,n){let{dateEnv:r,options:s}=n,i=e;return t?(i=X(i),i=r.add(i,s.defaultAllDayEventDuration)):i=r.add(i,s.defaultTimedEventDuration),i}function Ms(t,e,n,r){let s=An(t.defs,e),i=Me();for(let a in t.defs){let o=t.defs[a];i.defs[a]=fm(o,s[a],n,r)}for(let a in t.instances){let o=t.instances[a],l=i.defs[o.defId];i.instances[a]=hm(o,l,s[o.defId],n,r)}return i}function fm(t,e,n,r){let s=n.standardProps||{};s.hasEnd==null&&e.durationEditable&&(n.startDelta||n.endDelta)&&(s.hasEnd=!0);let i={...t,...s,ui:{...t.ui,...s.ui}};n.extendedProps&&(i.extendedProps={...i.extendedProps,...n.extendedProps});for(let a of r.pluginHooks.eventDefMutationAppliers)a(i,n,r);return!i.hasEnd&&r.options.forceEventDuration&&(i.hasEnd=!0),i}function hm(t,e,n,r,s){let{dateEnv:i}=s,a=r.standardProps&&r.standardProps.allDay===!0,o=r.standardProps&&r.standardProps.hasEnd===!1,l={...t};return a&&(l.range=qo(l.range)),r.datesDelta&&n.startEditable&&(l.range={start:i.add(l.range.start,r.datesDelta),end:i.add(l.range.end,r.datesDelta)}),r.startDelta&&n.durationEditable&&(l.range={start:i.add(l.range.start,r.startDelta),end:l.range.end}),r.endDelta&&n.durationEditable&&(l.range={start:l.range.start,end:i.add(l.range.end,r.endDelta)}),o&&(l.range={start:l.range.start,end:Ti(e.allDay,l.range.start,s)}),e.allDay&&(l.range={start:X(l.range.start),end:X(l.range.end)}),l.range.end<l.range.start&&(l.range.end=Ti(e.allDay,l.range.start,s)),l}class pt{constructor(e,n){this.context=e,this.internalEventSource=n}remove(){this.context.dispatch({type:"REMOVE_EVENT_SOURCE",sourceId:this.internalEventSource.sourceId})}refetch(){this.context.dispatch({type:"FETCH_EVENT_SOURCES",sourceIds:[this.internalEventSource.sourceId],isRefetch:!0})}get id(){return this.internalEventSource.publicId}get url(){return this.internalEventSource.meta.url}get format(){return this.internalEventSource.meta.format}}class K{constructor(e,n,r){this._context=e,this._def=n,this._instance=r||null}setProp(e,n){if(e in Ko)$e(`Cannot set date-related event property \`${e}\`. Use a method instead.`);else if(e==="id")n=Dn[e](n),this.mutate({standardProps:{publicId:n}});else if(e in Dn)n=Dn[e](n),this.mutate({standardProps:{[e]:n}});else if(e in jn){let r=jn[e](n);e==="editable"?r={startEditable:n,durationEditable:n}:r={[e]:n},this.mutate({standardProps:{ui:r}})}else $e(`Cannot set event property \`${e}\`. Use setExtendedProp instead.`)}setExtendedProp(e,n){this.mutate({extendedProps:{[e]:n}})}setStart(e,n={}){let{dateEnv:r}=this._context,s=r.createMarker(e);if(s&&this._instance){let i=this._instance.range,a=bt(i.start,s,r,n.granularity);n.maintainDuration?this.mutate({datesDelta:a}):this.mutate({startDelta:a})}}setEnd(e,n={}){let{dateEnv:r}=this._context,s;if(!(e!=null&&(s=r.createMarker(e),!s))&&this._instance)if(s){let i=bt(this._instance.range.end,s,r,n.granularity);this.mutate({endDelta:i})}else this.mutate({standardProps:{hasEnd:!1}})}setDates(e,n,r={}){let{dateEnv:s}=this._context,i={allDay:r.allDay},a=s.createMarker(e),o;if(a&&!(n!=null&&(o=s.createMarker(n),!o))&&this._instance){let l=this._instance.range;r.allDay===!0&&(l=qo(l));let c=bt(l.start,a,s,r.granularity);if(o){let u=bt(l.end,o,s,r.granularity);dg(c,u)?this.mutate({datesDelta:c,standardProps:i}):this.mutate({startDelta:c,endDelta:u,standardProps:i})}else i.hasEnd=!1,this.mutate({datesDelta:c,standardProps:i})}}moveStart(e){let n=$(e);n&&this.mutate({startDelta:n})}moveEnd(e){let n=$(e);n&&this.mutate({endDelta:n})}moveDates(e){let n=$(e);n&&this.mutate({datesDelta:n})}setAllDay(e,n={}){let r={allDay:e},{maintainDuration:s}=n;s==null&&(s=this._context.options.allDayMaintainDuration),this._def.allDay!==e&&(r.hasEnd=s),this.mutate({standardProps:r})}formatRange(e){let{dateEnv:n}=this._context,r=this._instance,s=J(e);return this._def.hasEnd?ye(n.formatRangeToParts(r.range.start,r.range.end,s)):ye(n.formatToParts(r.range.start,s))}mutate(e){let n=this._instance;if(n){let r=this._def,s=this._context,{eventStore:i}=s.getCurrentData(),a=Cs(i,n.instanceId);a=Ms(a,{"":{display:"",startEditable:!0,durationEditable:!0,constraints:[],overlap:null,allows:[],color:"",contrastColor:"",className:""}},e,s);let l=new K(s,r,n);this._def=a.defs[r.defId],this._instance=a.instances[n.instanceId],s.dispatch({type:"MERGE_EVENTS",eventStore:a}),s.emitter.trigger("eventChange",{oldEvent:l,event:this,relatedEvents:tt(a,s,n),revert(){s.dispatch({type:"RESET_EVENTS",eventStore:i})}})}}remove(){let e=this._context,n=rl(this);e.dispatch({type:"REMOVE_EVENTS",eventStore:n}),e.emitter.trigger("eventRemove",{event:this,relatedEvents:[],revert(){e.dispatch({type:"MERGE_EVENTS",eventStore:n})}})}get source(){let{sourceId:e}=this._def;return e?new pt(this._context,this._context.getCurrentData().eventSources[e]):null}get start(){return this._instance?this._context.dateEnv.toDate(this._instance.range.start):null}get end(){return this._instance&&this._def.hasEnd?this._context.dateEnv.toDate(this._instance.range.end):null}get startStr(){let e=this._instance;return e?this._context.dateEnv.formatIso(e.range.start,{omitTime:this._def.allDay}):""}get endStr(){let e=this._instance;return e&&this._def.hasEnd?this._context.dateEnv.formatIso(e.range.end,{omitTime:this._def.allDay}):""}get id(){return this._def.publicId}get groupId(){return this._def.groupId}get allDay(){return this._def.allDay}get title(){return this._def.title}get url(){return this._def.url}get display(){return this._def.ui.display||"auto"}get startEditable(){return this._def.ui.startEditable}get durationEditable(){return this._def.ui.durationEditable}get constraint(){return this._def.ui.constraints[0]||null}get overlap(){return this._def.ui.overlap}get allow(){return this._def.ui.allows[0]||null}get color(){return this._def.ui.color}get contrastColor(){return this._def.ui.contrastColor}get className(){return this._def.ui.className}get extendedProps(){return this._def.extendedProps}toPlainObject(e={}){let n=this._def,{ui:r}=n,{startStr:s,endStr:i}=this,a={allDay:n.allDay};return n.title&&(a.title=n.title),s&&(a.start=s),i&&(a.end=i),n.publicId&&(a.id=n.publicId),n.groupId&&(a.groupId=n.groupId),n.url&&(a.url=n.url),r.display&&r.display!=="auto"&&(a.display=r.display),r.color&&(a.color=r.color),r.contrastColor&&(a.contrastColor=r.contrastColor),r.className&&(a.className=r.className),Object.keys(n.extendedProps).length&&(e.collapseExtendedProps?Object.assign(a,n.extendedProps):a.extendedProps=n.extendedProps),a}toJSON(){return this.toPlainObject()}}function rl(t){let e=t._def,n=t._instance;return{defs:{[e.defId]:e},instances:n?{[n.instanceId]:n}:{}}}function tt(t,e,n){let{defs:r,instances:s}=t,i=[],a=n?n.instanceId:"";for(let o in s){let l=s[o],c=r[l.defId];l.instanceId!==a&&i.push(new K(e,c,l))}return i}function gm(t){return t.eventRange.instance.instanceId}function Ri(t,e,n,r){let s={},i={},a={},o=[],l=[],c=An(t.defs,e);for(let u in t.defs){let f=t.defs[u];c[f.defId].display==="inverse-background"&&(f.groupId?(s[f.groupId]=[],a[f.groupId]||(a[f.groupId]=f)):i[u]=[])}for(let u in t.instances){let f=t.instances[u],h=t.defs[f.defId],g=c[h.defId],v=f.range,m=!h.allDay&&r?Xo(v,r):v,E=Xt(m,n);E&&(g.display==="inverse-background"?h.groupId?s[h.groupId].push(E):i[f.defId].push(E):g.display!=="none"&&(g.display==="background"?o:l).push({def:h,ui:g,instance:f,range:E,isStart:m.start&&m.start.valueOf()===E.start.valueOf(),isEnd:m.end&&m.end.valueOf()===E.end.valueOf()}))}for(let u in s){let f=s[u],h=gi(f,n);for(let g of h){let v=a[u],m=c[v.defId];o.push({def:v,ui:m,instance:null,range:g,isStart:!1,isEnd:!1})}}for(let u in i){let f=i[u],h=gi(f,n);for(let g of h)o.push({def:t.defs[u],ui:c[u],instance:null,range:g,isStart:!1,isEnd:!1})}return{bg:o,fg:l}}function On(t,e){t.fcEventRange=e}function Nt(t){return t.fcEventRange||t.parentNode.fcEventRange||null}function An(t,e){return ct(t,n=>sl(n,e))}function sl(t,e){const n=[],r=e[""],s=e[t.defId];return r&&n.push(r),s&&n.push(s),n.push(t.ui),Jg(n)}function mm(t,e){let n=t.map(pm);return n.sort((r,s)=>Lg(r,s,e)),n.map(r=>r._seg)}function pm(t){let{eventRange:e}=t,n=e.def,r=e.instance?e.instance.range:e.range,s=r.start?r.start.valueOf():0,i=r.end?r.end.valueOf():0;return{...n.extendedProps,...n,id:n.publicId,start:s,end:i,duration:i-s,allDay:Number(n.allDay),_seg:t}}function vm(t,e){let{pluginHooks:n}=e,r=n.isDraggableTransformers,{def:s,ui:i}=t,a=i.startEditable;for(let o of r)a=o(a,s,i,e);return a}function ym(t,e,n,r,s,i,a,o=!0,l=!0){const{dateEnv:c,options:u}=a,{def:f}=e;let{displayEventTime:h,displayEventEnd:g}=u;h==null&&(h=o!==!1),g==null&&(g=l!==!1);const v=!s&&n&&X(n).valueOf()!==X(e.instance.range.start).valueOf()?n:e.instance.range.start,m=!i&&r&&X(st(r,-1)).valueOf()!==X(st(e.instance.range.end,-1)).valueOf()?r:e.instance.range.end;if(h&&!f.allDay){if(g&&(s||i)&&f.hasEnd){const E=c.formatRangeToParts(v,m,t),C=Em(E);return C!=null?ye(c.formatToParts(v,t))+C+ye(c.formatToParts(m,t)):ye(E)}if(s)return ye(c.formatToParts(v,t))}return""}const bm=new Set(["year","month","day"]);function Em(t){let e,n=!1;for(const r of t)r.source==="shared"&&(e=r),bm.has(r.type)&&(n=!0);return n?e.value:void 0}function Ur(t,e,n){let r=t.range;return{isPast:r.end<=e.start,isFuture:r.start>=e.end,isToday:e&&et(e,r.start)}}function Sm(t,e){let{def:n,instance:r}=t,{url:s}=n;if(s)return["a",{href:s},!0];let{emitter:i,options:a}=e,{eventInteractive:o}=a;o==null&&(o=n.interactive,o==null&&(o=!!i.hasHandlers("eventClick")));let l;return o&&(l=$o(c=>{i.trigger("eventClick",{el:c.target,event:new K(e,n,r),jsEvent:c,view:e.viewApi})}),l={role:"button",...l}),["div",l,o]}const wm=/(^c|C)lass(Name)?$/,Dm=/Content$/,xm=/(DidMount|WillUnmount)$/,Cm=/^on[A-Z]/,Tm={buttons:Vg};function Rm(...t){const e={};for(const n of t)for(const r in n){const s=n[r];e[r]?e[r]=Oe(e[r],s):e[r]=s}return e}function Oe(...t){let e={};for(const n of t)for(let r in n)if(r in e){const s=Tm[r]||(wm.test(r)?Nm:Dm.test(r)?Mm:xm.test(r)?Im:void 0);e[r]=s?s(e[r],n[r],r):n[r]}else e[r]=n[r];return e}function Nm(t,e,n){const r=typeof t=="function",s=typeof e=="function";if(r||s){const i=a=>O(se(r?t(a):t,n),se(s?e(a):e,n));return i.parts=[t,e],i}return O(se(t,n),se(e,n))}function Mm(t,e){if(typeof e=="function"){const n=r=>{const s=e(r);return s===!0?typeof t=="function"?t(r):t:s};return n.parts=[t,e],n}return e??t}function Im(t,e){if(t&&e){const n=(...r)=>{t(...r),e(...r)};return n.parts=[t,e],n}return t||e}function km(t,e){const n=Wg(t,e);for(let r of n)if(!Cm.test(r))return!1;return!0}function Fr(t,e){const n=t&&t.parts,r=e&&e.parts;if(n&&r){const s=n.length,i=r.length;if(s!==i)return!1;for(let a=0;a<s;a++)if(!(n[a]===r[a]||Fr(n[a],r[a])))return!1;return!0}return!1}const Pm=[],il={code:"en",week:{dow:0,doy:4},direction:"ltr",todayText:"Today",prevText:"Prev",nextText:"Next",prevYearText:"Prev year",nextYearText:"Next year",yearText:"Year",monthText:"Month",weekTextLong:"Week",dayText:"Day",listText:"List",closeHint:"Close",eventsHint:"Events",allDayText:"All-day",timedText:"Timed",moreLinkText:"more",noEventsText:"No events to display"},al={...il,weekTextShort:"W",todayHint:(t,e)=>e==="day"?"Today":`This ${t}`,prevHint:"Previous $0",nextHint:"Next $0",viewHint:"$0 view",viewChangeHint:"Change view",navLinkHint:"Go to $0",moreLinkHint(t){return`Show ${t} more event${t===1?"":"s"}`}};function jm(t){let e=t.length>0?t[0].code:"en",n=Pm.concat(t),r={en:al};for(let s of n)r[s.code]=s;return{map:r,defaultCode:e}}function ol(t,e){return typeof t=="object"&&!Array.isArray(t)?ll(t.code,[t.code],t):Hm(t,e)}function Hm(t,e){let n=[].concat(t||[]),r=Om(n,e)||al;return ll(t,n,r)}function Om(t,e){for(let n=0;n<t.length;n+=1){let r=t[n].toLocaleLowerCase().split("-");for(let s=r.length;s>0;s-=1){let i=r.slice(0,s).join("-");if(e[i])return e[i]}}return null}function ll(t,e,n){let r=Oe(il,n);delete r.code;let{week:s}=r;return delete r.week,{codeArg:t,codes:e,week:s,simpleNumberFormat:new Intl.NumberFormat(t),options:r}}class Ni extends Error{constructor(e,n){super(e),this.response=n}}function Am(t,e,n){t=t.toUpperCase();const r={method:t};return t==="GET"?e+=(e.indexOf("?")===-1?"?":"&")+new URLSearchParams(n):(r.body=new URLSearchParams(n),r.headers={"Content-Type":"application/x-www-form-urlencoded"}),fetch(e,r).then(s=>{if(s.ok)return s.json().then(i=>[i,s],()=>{throw new Ni("Failure parsing JSON",s)});throw new Ni("Request failed",s)})}function Lm(t,e){e.emitter.trigger("datesSet",{...el(t.activeRange,e.dateEnv),view:e.viewApi})}function _m(t,e){let{emitter:n}=e;n.hasHandlers("eventsSet")&&n.trigger("eventsSet",tt(t,e))}let Um={ignoreRange:!0,parseMeta(t){return Array.isArray(t.events)?t.events:null},fetch(t,e){e({rawEvents:t.eventSource.meta})}};const Fm={name:"array-event-source",eventSourceDefs:[Um]};function Bm(t,e,n){let r=!1,s=function(o){r||(r=!0,e(o))},i=function(o){r||(r=!0,n(o))},a=t(s,i);a&&typeof a.then=="function"&&a.then(s,i)}let Wm={parseMeta(t){return typeof t.events=="function"?t.events:null},fetch(t,e,n){const{dateEnv:r}=t.context,s=t.eventSource.meta;Bm(s.bind(null,el(t.range,r)),i=>e({rawEvents:i}),n)}};const Vm={name:"func-event-source",eventSourceDefs:[Wm]},zm={method:String,extraParams:b,startParam:String,endParam:String,timeZoneParam:String};let $m={parseMeta(t){return t.url&&(t.format==="json"||!t.format)?{url:t.url,format:"json",method:(t.method||"GET").toUpperCase(),extraParams:t.extraParams,startParam:t.startParam,endParam:t.endParam,timeZoneParam:t.timeZoneParam}:null},fetch(t,e,n){const{meta:r}=t.eventSource,s=Gm(r,t.range,t.context);Am(r.method,r.url,s).then(([i,a])=>{e({rawEvents:i,response:a})},n)}};const Ym={name:"json-event-source",eventSourceRefiners:zm,eventSourceDefs:[$m]};function Gm(t,e,n){let{dateEnv:r,options:s}=n,i,a,o,l,c={};return i=t.startParam,i==null&&(i=s.startParam),a=t.endParam,a==null&&(a=s.endParam),o=t.timeZoneParam,o==null&&(o=s.timeZoneParam),typeof t.extraParams=="function"?l=t.extraParams():l=t.extraParams||{},Object.assign(c,l),c[i]=r.formatIso(e.start),c[a]=r.formatIso(e.end),r.timeZone!=="local"&&(c[o]=r.timeZone),c}const Zm={name:"change-handler",optionChangeHandlers:{controller(t,e){t._setApi(e.calendarApi)},events(t,e){Mi([t],e)},eventSources:Mi}};function Mi(t,e){let n=Go(e.getCurrentData().eventSources);if(n.length===1&&t.length===1&&Array.isArray(n[0]._raw)&&Array.isArray(t[0])){e.dispatch({type:"RESET_RAW_EVENTS",sourceId:n[0].sourceId,rawEvents:t[0]});return}let r=[];for(let s of t){let i=!1;for(let a=0;a<n.length;a+=1)if(n[a]._raw===s){n.splice(a,1),i=!0;break}i||r.push(s)}for(let s of n)e.dispatch({type:"REMOVE_EVENT_SOURCE",sourceId:s.sourceId});for(let s of r)e.calendarApi.addEventSource(s)}const qm={id:String,defaultAllDay:Boolean,url:String,format:String,events:b,eventDataTransform:b,success:b,failure:b};function cl(t,e,n=dl(e)){let r;if(typeof t=="string"?r={url:t}:typeof t=="function"||Array.isArray(t)?r={events:t}:typeof t=="object"&&t&&(r=t),r){let{refined:s,extra:i}=Ds(r,n),a=Xm(s,e);if(a)return{_raw:t,isFetching:!1,latestFetchId:"",fetchRange:null,defaultAllDay:s.defaultAllDay,eventDataTransform:s.eventDataTransform,success:s.success,failure:s.failure,publicId:s.id||"",sourceId:_e(),sourceDefId:a.sourceDefId,meta:a.meta,ui:Hn(s,e),extendedProps:i}}return null}function dl(t){return{...jn,...qm,...t.pluginHooks.eventSourceRefiners}}function Xm(t,e){let n=e.pluginHooks.eventSourceDefs;for(let r=n.length-1;r>=0;r-=1){let i=n[r].parseMeta(t);if(i)return{sourceDefId:r,meta:i}}return null}function Km(t,e,n){let r=e?e.activeRange:null;return fl({},sp(t,n),r,n)}function Qm(t,e,n,r){let s=n?n.activeRange:null;switch(e.type){case"ADD_EVENT_SOURCES":return fl(t,e.sources,s,r);case"REMOVE_EVENT_SOURCE":return ep(t,e.sourceId);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return n?hl(t,s,r):t;case"FETCH_EVENT_SOURCES":return Is(t,e.sourceIds?Zo(e.sourceIds):gl(t,r),s,e.isRefetch||!1,r);case"RECEIVE_EVENTS":case"RECEIVE_EVENT_ERROR":return rp(t,e.sourceId,e.fetchId,e.fetchRange);case"REMOVE_ALL_EVENT_SOURCES":return{};default:return t}}function Jm(t,e,n){let r=e?e.activeRange:null;return Is(t,gl(t,n),r,!0,n)}function ul(t){for(let e in t)if(t[e].isFetching)return!0;return!1}function fl(t,e,n,r){let s={};for(let i of e)s[i.sourceId]=i;return n&&(s=hl(s,n,r)),{...t,...s}}function ep(t,e){return it(t,n=>n.sourceId!==e)}function hl(t,e,n){return Is(t,it(t,r=>tp(r,e,n)),e,!1,n)}function tp(t,e,n){return ml(t,n)?!n.options.lazyFetching||!t.fetchRange||t.isFetching||e.start<t.fetchRange.start||e.end>t.fetchRange.end:!t.latestFetchId}function Is(t,e,n,r,s){let i={};for(let a in t){let o=t[a];e[a]?i[a]=np(o,n,r,s):i[a]=o}return i}function np(t,e,n,r){let{options:s,calendarApi:i}=r,a=r.pluginHooks.eventSourceDefs[t.sourceDefId],o=_e();return a.fetch({eventSource:t,range:e,isRefetch:n,context:r},l=>{let{rawEvents:c}=l;s.eventSourceSuccess&&(c=s.eventSourceSuccess.call(i,c,l.response)||c),t.success&&(c=t.success.call(i,c,l.response)||c),r.dispatch({type:"RECEIVE_EVENTS",sourceId:t.sourceId,fetchId:o,fetchRange:e,rawEvents:c})},l=>{let c=!1;s.eventSourceFailure&&(s.eventSourceFailure.call(i,l),c=!0),t.failure&&(t.failure(l),c=!0),c||$e(`Unhandled event source error: ${l.message}`,l),r.dispatch({type:"RECEIVE_EVENT_ERROR",sourceId:t.sourceId,fetchId:o,fetchRange:e,error:l})}),{...t,isFetching:!0,latestFetchId:o}}function rp(t,e,n,r){let s=t[e];return s&&n===s.latestFetchId?{...t,[e]:{...s,isFetching:!1,fetchRange:r}}:t}function gl(t,e){return it(t,n=>ml(n,e))}function sp(t,e){let n=dl(e),r=[].concat(t.eventSources||[]),s=[];t.initialEvents&&r.unshift(t.initialEvents),t.events&&r.unshift(t.events);for(let i of r){let a=cl(i,e,n);a&&s.push(a)}return s}function ml(t,e){return!e.pluginHooks.eventSourceDefs[t.sourceDefId].ignoreRange}const ip={daysOfWeek:b,startTime:$,endTime:$,duration:$,startRecur:b,endRecur:b};let ap={parse(t,e){if(t.daysOfWeek||t.startTime||t.endTime||t.startRecur||t.endRecur){let n={daysOfWeek:t.daysOfWeek||null,startTime:t.startTime||null,endTime:t.endTime||null,startRecur:t.startRecur?e.createMarker(t.startRecur):null,endRecur:t.endRecur?e.createMarker(t.endRecur):null,dateEnv:e},r;return t.duration&&(r=t.duration),!r&&t.startTime&&t.endTime&&(r=ug(t.endTime,t.startTime)),{allDayGuess:!t.startTime&&!t.endTime,duration:r,typeData:n}}return null},expand(t,e,n){let r=Xt(e,{start:t.startRecur,end:t.endRecur});return r?lp(t.daysOfWeek,t.startTime,t.dateEnv,n,r):[]}};const op={name:"simple-recurring-event",recurringTypes:[ap],eventRefiners:ip};function lp(t,e,n,r,s){let i=t?Zo(t):null,a=X(s.start),o=s.end,l=[];for(e&&(e.milliseconds<0?o=fe(o,1):e.milliseconds>=1e3*60*60*24&&(a=fe(a,-1)));a<o;){let c;(!i||i[a.getUTCDay()])&&(e?c=r.add(a,e):c=a,l.push(r.createMarker(n.toDate(c)))),a=fe(a,1)}return l}const cp=[Fm,Vm,Ym,op,Zm,{name:"misc",isLoadingFuncs:[t=>ul(t.eventSources)],propSetHandlers:{dateProfile:Lm,eventStore:_m}}];function B(t,e,n){let r,s;return function(...i){if(!r)s=t.apply(this,i);else if(!Qt(r,i)){let a=t.apply(this,i);(!e||!e(a,s))&&(s=a)}return r=i,s}}function zt(t,e,n){let r,s;return i=>(r?at(r,i)||(s=t.call(this,i)):s=t.call(this,i),r=i,s)}const At=S.createContext({});function dp(t,e,n,r,s,i,a,o,l,c,u,f,h,g){return{dateEnv:s,nowManager:i,options:n,pluginHooks:a,emitter:c,dispatch:o,getCurrentData:l,calendarApi:u,viewSpec:t,viewApi:e,dateProfileGenerator:r,baseId:f,registerInteractiveComponent:h,unregisterInteractiveComponent:g}}class dt extends S.Component{shouldComponentUpdate(e,n){return!Si(this.props,e,this.propEquality)||!Si(this.state,n,this.stateEquality)}}dt.addPropsEquality=up;dt.addStateEquality=fp;dt.contextType=At;dt.prototype.propEquality={};dt.prototype.stateEquality={};class ee extends dt{}ee.contextType=At;function up(t){let e=Object.create(this.prototype.propEquality);Object.assign(e,t),this.prototype.propEquality=e}function fp(t){let e=Object.create(this.prototype.stateEquality);Object.assign(e,t),this.prototype.stateEquality=e}function G(t,e){typeof t=="function"?t(e):t&&(t.current=e)}class ks extends ee{constructor(){super(...arguments),this.id=_e(),this.queuedDomNodes=[],this.currentDomNodes=[],this.handleEl=e=>{this.el=e,this.props.elRef&&G(this.props.elRef,e)}}render(){const{props:e,context:n}=this,{options:r}=n,{customGenerator:s,defaultGenerator:i,renderProps:a}=e,o=pl(e,"",this.handleEl);let l=!1,c,u=[],f;if(s!=null){const h=typeof s=="function"?s(a):s;if(h===!0)l=!0;else{const g=h&&typeof h=="object";g&&"html"in h?o.dangerouslySetInnerHTML={__html:h.html}:g&&"domNodes"in h?u=Array.prototype.slice.call(h.domNodes):(g?S.isValidElement(h):typeof h!="function")?c=h:f=h}}else l=!hp(e.generatorName,r);return l&&i&&(c=i(a)),this.queuedDomNodes=u,this.currentGeneratorMeta=f,S.createElement(e.tag,o,c)}componentDidMount(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentDidUpdate(){this.applyQueueudDomNodes(),this.triggerCustomRendering(!0)}componentWillUnmount(){this.triggerCustomRendering(!1)}triggerCustomRendering(e){const{props:n,context:r}=this,{handleCustomRendering:s,customRenderingMetaMap:i}=r.options;if(s){const a=this.currentGeneratorMeta??i?.[n.generatorName];a&&s({id:this.id,isActive:e,containerEl:this.el,generatorMeta:a,renderProps:n.renderProps})}}applyQueueudDomNodes(){const{queuedDomNodes:e,currentDomNodes:n}=this,{el:r}=this;if(!Qt(e,n)){for(const s of n)s.remove();for(let s of e)r.appendChild(s);this.currentDomNodes=e}}}ks.addPropsEquality({renderProps:at,attrs:km,style:at});function hp(t,e){return!!(e.handleCustomRendering&&t&&e.customRenderingMetaMap?.[t])}function pl(t,e,n){const r={...t.attrs,ref:n};return(t.className||e)&&(r.className=O(e,t.className,r.className)),t.style&&(r.style=t.style),r}const gp=S.createContext(0);class me extends S.Component{constructor(){super(...arguments),this.InnerContent=mp.bind(void 0,this),this.handleEl=e=>{this.el=e,this.props.elRef&&(G(this.props.elRef,e),e&&this.didMountMisfire&&this.componentDidMount())}}render(){const{props:e}=this,n=k(e.classNameGenerator,e.renderProps);if(e.children){const r=pl(e,n,this.handleEl),s=e.children(this.InnerContent,e.renderProps,r);return e.tag?S.createElement(e.tag,r,s):s}else return S.createElement(ks,{...e,elRef:this.handleEl,tag:e.tag||"div",className:O(e.className,n),renderId:this.context})}componentDidMount(){this.el?this.props.didMount?.({...this.props.renderProps,el:this.el}):this.didMountMisfire=!0}componentWillUnmount(){this.props.willUnmount?.({...this.props.renderProps,el:this.el})}}me.contextType=gp;function mp(t,e){const n=t.props;return S.createElement(ks,{renderProps:n.renderProps,generatorName:n.generatorName,customGenerator:n.customGenerator,defaultGenerator:n.defaultGenerator,renderId:t.context,...e})}function k(t,e){return(typeof t=="function"?t(e):t)||""}function vl(t){return t.text}function Ye(t){return t.height==="auto"||t.contentHeight==="auto"}function yl(t){let{tableHeaderSticky:e}=t;return(e==null||e==="auto")&&(e=Ye(t)),e}function pp(t){const e=Ye(t);let{footerScrollbarSticky:n}=t;return(n==null||n==="auto")&&(n=e),!!n&&e}function vp(t){const e=t.scrollerSyncerClass;if(!e)throw new RangeError("Must import @fullcalendar/scrollgrid");return e}class bl{constructor(e){this.handleChange=e,this.isMounted=!1,this.handleRefresh=()=>{let n=this.computeTiming();n.nowDate.valueOf()!==this.nowDate.valueOf()&&(this.nowDate=n.nowDate,this.todayRange=n.todayRange,this.handleChange()),this.clearTimeout(),this.setTimeout(n.waitMs)},this.handleVisibilityChange=()=>{document.hidden||this.handleRefresh()}}update(e){if(this.isMounted)(e.unit!==this.unit||e.unitValue!==this.unitValue||e.nowIndicatorSnap!==this.nowIndicatorSnap||e.nowManager!==this.nowManager||e.dateEnv!==this.dateEnv)&&(this.unit=e.unit,this.unitValue=e.unitValue,this.nowIndicatorSnap=e.nowIndicatorSnap,this.nowManager=e.nowManager,this.dateEnv=e.dateEnv,this.clearTimeout(),this.setTimeout());else{this.isMounted=!0,this.unit=e.unit,this.unitValue=e.unitValue,this.nowIndicatorSnap=e.nowIndicatorSnap,this.nowManager=e.nowManager,this.dateEnv=e.dateEnv;const n=this.computeTiming();this.nowDate=n.nowDate,this.todayRange=n.todayRange,this.setTimeout(),this.nowManager.addResetListener(this.handleRefresh),typeof document<"u"&&document.addEventListener("visibilitychange",this.handleVisibilityChange)}return{nowDate:this.nowDate,todayRange:this.todayRange}}destroy(){this.isMounted&&(this.isMounted=!1,this.clearTimeout(),this.nowManager.removeResetListener(this.handleRefresh),typeof document<"u"&&document.removeEventListener("visibilitychange",this.handleVisibilityChange))}computeTiming(){let e=this.nowManager.getDateMarker(),{unit:n,unitValue:r,nowIndicatorSnap:s,dateEnv:i}=this;s==="auto"&&(s=/year|month|week|day/.test(n)||(r||1)===1);let a,o;return s?(a=i.startOf(e,n),o=i.add(a,$(1,n)).valueOf()-e.valueOf()):(a=e,o=1e3*60),o=Math.min(1e3*60*60*24,o),{nowDate:a,todayRange:yp(a),waitMs:o}}setTimeout(e=this.computeTiming().waitMs){this.timeoutId=setTimeout(()=>{const n=this.computeTiming();this.nowDate=n.nowDate,this.todayRange=n.todayRange,this.handleChange(),this.setTimeout(n.waitMs)},e)}clearTimeout(){this.timeoutId&&clearTimeout(this.timeoutId)}}function yp(t){let e=X(t),n=fe(e,1);return{start:e,end:n}}class El{constructor(e){this.props=e,this.initHiddenDays()}buildPrev(e,n,r,s){let{dateEnv:i}=this.props,a=i.subtract(i.startOf(n,e.currentRangeUnit),e.dateIncrement);return this.build(a,r,-1,s)}buildNext(e,n,r,s){let{dateEnv:i}=this.props,a=i.add(i.startOf(n,e.currentRangeUnit),e.dateIncrement);return this.build(a,r,1,s)}build(e,n,r,s=!0){let{props:i}=this,a,o,l,c,u,f;return a=this.buildValidRange(n),a=this.trimHiddenDays(a),s&&(e=og(e,a)),o=this.buildCurrentRangeInfo(e,r),l=/^(year|month|week|day)$/.test(o.unit),c=this.buildRenderRange(this.trimHiddenDays(o.range),o.unit,l),c=this.trimHiddenDays(c),u=c,i.showNonCurrentDates||(u=Xt(u,o.range)),u=this.adjustActiveRange(u),u=Xt(u,a),f=vs(o.range,a),et(c,e)||(e=c.start),{currentDate:e,validRange:a,currentRange:o.range,currentRangeUnit:o.unit,isRangeAllDay:l,activeRange:u,renderRange:c,slotMinTime:i.slotMinTime,slotMaxTime:i.slotMaxTime,isValid:f,dateIncrement:this.buildDateIncrement(o.duration)}}buildValidRange(e){let n=this.props.validRangeInput,r=typeof n=="function"?n.call(this.props.calendarApi,this.props.dateEnv.toDate(e)):n;return this.refineRange(r)||{start:null,end:null}}buildCurrentRangeInfo(e,n){let{props:r}=this,s=null,i=null,a=null,o;return r.duration?(s=r.duration,i=r.durationUnit,a=this.buildRangeFromDuration(e,n,s,i)):(o=this.props.dayCount)?(i="day",a=this.buildRangeFromDayCount(e,n,o)):(a=this.buildCustomVisibleRange(e))?i=r.dateEnv.greatestWholeUnit(a.start,a.end).unit:(s=this.getFallbackDuration(),i=Or(s).unit,a=this.buildRangeFromDuration(e,n,s,i)),{duration:s,unit:i,range:a}}getFallbackDuration(){return $({day:1})}adjustActiveRange(e){let{dateEnv:n,usesMinMaxTime:r,slotMinTime:s,slotMaxTime:i}=this.props,{start:a,end:o}=e;return r&&(Dt(s)<0&&(a=X(a),a=n.add(a,s)),Dt(i)>1&&(o=X(o),o=fe(o,-1),o=n.add(o,i))),{start:a,end:o}}buildRangeFromDuration(e,n,r,s){let{dateEnv:i,dateAlignment:a}=this.props,o,l,c;if(!a){let{dateIncrement:f}=this.props;f&&Kt(f)<Kt(r)?a=Or(f).unit:a=s}Dt(r)<=1&&this.isHiddenDay(o)&&(o=this.skipHiddenDays(o,n),o=X(o));function u(){o=i.startOf(e,a),l=i.add(o,r),c={start:o,end:l}}return u(),this.trimHiddenDays(c)||(e=this.skipHiddenDays(e,n),u()),c}buildRangeFromDayCount(e,n,r){let{dateEnv:s,dateAlignment:i}=this.props,a=0,o=e,l;i&&(o=s.startOf(o,i)),o=X(o),o=this.skipHiddenDays(o,n),l=o;do l=fe(l,1),this.isHiddenDay(l)||(a+=1);while(a<r);return{start:o,end:l}}buildCustomVisibleRange(e){let{props:n}=this,r=n.visibleRangeInput,s=typeof r=="function"?r.call(n.calendarApi,n.dateEnv.toDate(e)):r,i=this.refineRange(s);return i&&(i.start==null||i.end==null)?null:i}buildRenderRange(e,n,r){return e}buildDateIncrement(e){let{dateIncrement:n}=this.props,r;return n||((r=this.props.dateAlignment)?$(1,r):e||$({days:1}))}refineRange(e){if(e){let n=sg(e,this.props.dateEnv);return n&&(n=Xo(n)),n}return null}initHiddenDays(){let e=this.props.hiddenDays||[],n=[],r=0,s;for(this.props.weekends===!1&&e.push(0,6),s=0;s<7;s+=1)(n[s]=e.indexOf(s)!==-1)||(r+=1);if(!r)throw new Error("invalid hiddenDays");this.isHiddenDayHash=n}trimHiddenDays(e){let{start:n,end:r}=e;return n&&(n=this.skipHiddenDays(n)),r&&(r=this.skipHiddenDays(r,-1,!0)),n==null||r==null||n<r?{start:n,end:r}:null}isHiddenDay(e){return e instanceof Date&&(e=e.getUTCDay()),this.isHiddenDayHash[e]}skipHiddenDays(e,n=1,r=!1){for(;this.isHiddenDayHash[(e.getUTCDay()+(r?n:0)+7)%7];)e=fe(e,n);return e}}function Sl(t,e){const{currentRange:n}=t;if(t.currentRangeUnit==="year")return e.diffWholeYears(n.start,n.end)>1?"year":"month";if(t.currentRangeUnit==="month"){if(e.diffWholeMonths(n.start,n.end)>1)return"month"}else if(t.currentRangeUnit==="week"){if(Uo(n.start,n.end)>1)return"week"}else if(t.currentRangeUnit==="day"&&qt(n.start,n.end)>1)return"day"}function wl(t,e,n){if(t.valueOf()===X(t).valueOf()){if(e==="year")return!n.getMonth(t)&&n.getDay(t)===1;if(e==="month")return n.getDay(t)===1;if(e==="week")return t.getUTCDay()===n.weekDow;if(e==="day")return!0}return!1}function bp(t,e,n,r,s){switch(e.type){case"RECEIVE_EVENTS":return Ep(t,n[e.sourceId],e.fetchId,e.fetchRange,e.rawEvents,s);case"RESET_RAW_EVENTS":return Sp(t,n[e.sourceId],e.rawEvents,r.activeRange,s);case"ADD_EVENTS":return wp(t,e.eventStore,r?r.activeRange:null,s);case"RESET_EVENTS":return e.eventStore;case"MERGE_EVENTS":return Ts(t,e.eventStore);case"PREV":case"NEXT":case"CHANGE_DATE":case"CHANGE_VIEW_TYPE":return r?ot(t,r.activeRange,s):t;case"REMOVE_EVENTS":return Xg(t,e.eventStore);case"REMOVE_EVENT_SOURCE":return xl(t,e.sourceId);case"REMOVE_ALL_EVENT_SOURCES":return rr(t,i=>!i.sourceId);case"REMOVE_ALL_EVENTS":return Me();default:return t}}function Ep(t,e,n,r,s,i){if(e&&n===e.latestFetchId){let a=Jt(Dl(s,e,i),e,i);return r&&(a=ot(a,r,i)),Ts(xl(t,e.sourceId),a)}return t}function Sp(t,e,n,r,s){const{defIdMap:i,instanceIdMap:a}=xp(t);let o=Jt(Dl(n,e,s),e,s,!1,i,a);return ot(o,r,s)}function Dl(t,e,n){let r=n.options.eventDataTransform,s=e?e.eventDataTransform:null;return s&&(t=Ii(t,s)),r&&(t=Ii(t,r)),t}function Ii(t,e){let n;if(!e)n=t;else{n=[];for(let r of t){let s=e(r);s?n.push(s):s==null&&n.push(r)}}return n}function wp(t,e,n,r){return n&&(e=ot(e,n,r)),Ts(t,e)}function ki(t,e,n){let{defs:r}=t,s=ct(t.instances,i=>r[i.defId].allDay?i:{...i,range:{start:n.createMarker(e.toDate(i.range.start)),end:n.createMarker(e.toDate(i.range.end))}});return{defs:r,instances:s}}function xl(t,e){return rr(t,n=>n.sourceId!==e)}function Dp(t,e){return{defs:t.defs,instances:it(t.instances,n=>!e[n.instanceId])}}function xp(t){const{defs:e,instances:n}=t,r={},s={};for(let i in e){const a=e[i],{publicId:o}=a;o&&(r[o]=i)}for(let i in n){const a=n[i],o=e[a.defId],{publicId:l}=o;l&&(s[l]=i)}return{defIdMap:r,instanceIdMap:s}}class Lt{constructor(e){this.component=e.component,this.isHitComboAllowed=e.isHitComboAllowed||null}destroy(){}}function Cp(t,e){return{component:t,el:e.el,useEventCenter:e.useEventCenter!=null?e.useEventCenter:!0,isHitComboAllowed:e.isHitComboAllowed||null}}function Ps(t){return{[t.component.uid]:t}}const Br={};class on{constructor(){this.handlers={},this.thisContext=null}setThisContext(e){this.thisContext=e}setOptions(e){this.options=e}on(e,n){Tp(this.handlers,e,n)}off(e,n){Rp(this.handlers,e,n)}trigger(e,...n){let r=this.handlers[e]||[],s=this.options&&this.options[e],i=[].concat(s||[],r);for(let a of i)a.apply(this.thisContext,n)}hasHandlers(e){return!!(this.handlers[e]&&this.handlers[e].length||this.options&&this.options[e])}}function Tp(t,e,n){(t[e]||(t[e]=[])).push(n)}function Rp(t,e,n){n?t[e]&&(t[e]=t[e].filter(r=>r!==n)):delete t[e]}function Np(t){return{name:t.name,premiumReleaseDate:t.premiumReleaseDate?new Date(t.premiumReleaseDate):void 0,reducers:t.reducers||[],isLoadingFuncs:t.isLoadingFuncs||[],contextInit:[].concat(t.contextInit||[]),eventRefiners:t.eventRefiners||{},eventDefMemberAdders:t.eventDefMemberAdders||[],eventSourceRefiners:t.eventSourceRefiners||{},isDraggableTransformers:t.isDraggableTransformers||[],eventDragMutationMassagers:t.eventDragMutationMassagers||[],eventDefMutationAppliers:t.eventDefMutationAppliers||[],dateSelectionTransformers:t.dateSelectionTransformers||[],datePointTransforms:t.datePointTransforms||[],dateSpanTransforms:t.dateSpanTransforms||[],views:t.views||{},viewPropsTransformers:t.viewPropsTransformers||[],isPropsValid:t.isPropsValid||null,externalDefTransforms:t.externalDefTransforms||[],viewContainerAppends:t.viewContainerAppends||[],eventDropTransformers:t.eventDropTransformers||[],componentInteractions:t.componentInteractions||[],calendarInteractions:t.calendarInteractions||[],eventSourceDefs:t.eventSourceDefs||[],cmdFormatter:t.cmdFormatter,recurringTypes:t.recurringTypes||[],initialView:t.initialView||"",elementDraggingImpl:t.elementDraggingImpl,optionChangeHandlers:t.optionChangeHandlers||{},scrollerSyncerClass:t.scrollerSyncerClass||null,listenerRefiners:t.listenerRefiners||{},optionRefiners:t.optionRefiners||{},optionDefaults:t.optionDefaults?[t.optionDefaults]:[],propSetHandlers:t.propSetHandlers||{}}}function Mp(t,e){let n={},r={premiumReleaseDate:void 0,reducers:[],isLoadingFuncs:[],contextInit:[],eventRefiners:{},eventDefMemberAdders:[],eventSourceRefiners:{},isDraggableTransformers:[],eventDragMutationMassagers:[],eventDefMutationAppliers:[],dateSelectionTransformers:[],datePointTransforms:[],dateSpanTransforms:[],views:{},viewPropsTransformers:[],isPropsValid:null,externalDefTransforms:[],viewContainerAppends:[],eventDropTransformers:[],componentInteractions:[],calendarInteractions:[],eventSourceDefs:[],cmdFormatter:null,recurringTypes:[],initialView:"",elementDraggingImpl:null,optionChangeHandlers:{},scrollerSyncerClass:null,listenerRefiners:{},optionRefiners:{},optionDefaults:[],propSetHandlers:{}};function s(i){for(let a of i){const{name:o}=a;if(!o)throw new Error("Plugin must specify a name");if(!n[o]){const l=n[o]=Np(a);r=kp(r,l),s(a.deps||[])}}}return t&&s(t),s(e),r}function Ip(){let t=[],e=[],n;return(r,s)=>((!n||!Qt(r,t)||!Qt(s,e))&&(n=Mp(r,s)),t=r,e=s,n)}function kp(t,e){return{premiumReleaseDate:Pp(t.premiumReleaseDate,e.premiumReleaseDate),reducers:t.reducers.concat(e.reducers),isLoadingFuncs:t.isLoadingFuncs.concat(e.isLoadingFuncs),contextInit:t.contextInit.concat(e.contextInit),eventRefiners:{...t.eventRefiners,...e.eventRefiners},eventDefMemberAdders:t.eventDefMemberAdders.concat(e.eventDefMemberAdders),eventSourceRefiners:{...t.eventSourceRefiners,...e.eventSourceRefiners},isDraggableTransformers:t.isDraggableTransformers.concat(e.isDraggableTransformers),eventDragMutationMassagers:t.eventDragMutationMassagers.concat(e.eventDragMutationMassagers),eventDefMutationAppliers:t.eventDefMutationAppliers.concat(e.eventDefMutationAppliers),dateSelectionTransformers:t.dateSelectionTransformers.concat(e.dateSelectionTransformers),datePointTransforms:t.datePointTransforms.concat(e.datePointTransforms),dateSpanTransforms:t.dateSpanTransforms.concat(e.dateSpanTransforms),views:Rm(t.views,e.views),viewPropsTransformers:t.viewPropsTransformers.concat(e.viewPropsTransformers),isPropsValid:e.isPropsValid||t.isPropsValid,externalDefTransforms:t.externalDefTransforms.concat(e.externalDefTransforms),viewContainerAppends:t.viewContainerAppends.concat(e.viewContainerAppends),eventDropTransformers:t.eventDropTransformers.concat(e.eventDropTransformers),calendarInteractions:t.calendarInteractions.concat(e.calendarInteractions),componentInteractions:t.componentInteractions.concat(e.componentInteractions),eventSourceDefs:t.eventSourceDefs.concat(e.eventSourceDefs),cmdFormatter:e.cmdFormatter||t.cmdFormatter,recurringTypes:t.recurringTypes.concat(e.recurringTypes),initialView:t.initialView||e.initialView,elementDraggingImpl:t.elementDraggingImpl||e.elementDraggingImpl,optionChangeHandlers:{...t.optionChangeHandlers,...e.optionChangeHandlers},scrollerSyncerClass:t.scrollerSyncerClass||e.scrollerSyncerClass,listenerRefiners:{...t.listenerRefiners,...e.listenerRefiners},optionRefiners:{...t.optionRefiners,...e.optionRefiners},optionDefaults:t.optionDefaults.concat(e.optionDefaults),propSetHandlers:{...t.propSetHandlers,...e.propSetHandlers}}}function Pp(t,e){return t===void 0?e:e===void 0?t:new Date(Math.max(t.valueOf(),e.valueOf()))}function jp(t,e){let n={},r;for(r in t)Wr(r,n,t,e);for(r in e)Wr(r,n,t,e);return n}function Wr(t,e,n,r){if(e[t])return e[t];let s=Hp(t,e,n,r);return s&&(e[t]=s),s}function Hp(t,e,n,r){let s=n[t],i=r[t],a=u=>s&&s[u]!==null?s[u]:i&&i[u]!==null?i[u]:null,o=a("component"),l=a("superType"),c=null;if(l){if(l===t)throw new Error("Can't have a custom view type that references itself");c=Wr(l,e,n,r)}return!o&&c&&(o=c.component),o?{type:t,component:o,defaults:Oe(c?c.defaults:{},s?s.rawOptions:{}),overrides:Oe(c?c.overrides:{},i?i.rawOptions:{})}:null}function Pi(t){return ct(t,Op)}function Op(t){let e=typeof t=="function"?{component:t}:t,{component:n}=e;return e.content?n=ji(e.content):n&&!(n.prototype instanceof ee)&&(n=ji(n)),{superType:e.type,component:n,rawOptions:e}}function ji(t){return e=>d.jsx(At.Consumer,{children:n=>{const{options:r,viewSpec:s}=n,i={...e,nextDayThreshold:r.nextDayThreshold,...Ot(r),options:{headerToolbar:r.headerToolbar,footerToolbar:r.footerToolbar},isHeightAuto:Ye(r),view:n.viewApi};return d.jsx(me,{tag:"div",className:O(k(r.viewClass,i),k(s.optionDefaults.class,i),k(s.optionDefaults.className,i),k(s.optionOverrides.class,i),k(s.optionOverrides.className,i)),renderProps:i,generatorName:void 0,customGenerator:t,didMount:r.didMount||r.viewDidMount,willUnmount:r.willUnmount||r.viewWillUnmount})}})}function Ap(t,e,n){let r=Pi(t),s=Pi(e.views),i=jp(r,s);return ct(i,a=>Lp(a,s,e,n))}function Lp(t,e,n,r){let s=t.overrides.duration||t.defaults.duration||r.duration||n.duration,i=null,a="",o="",l={};if(s&&(i=_p(s),i)){let c=Or(i);a=c.unit,c.value===1&&(o=a,l=e[a]?e[a].rawOptions:{})}return{type:t.type,component:t.component,duration:i,durationUnit:a,singleUnit:o,optionDefaults:t.defaults,optionOverrides:{...l,...t.overrides}}}let Hi={};function _p(t){let e=JSON.stringify(t),n=Hi[e];return n===void 0&&(n=$(t),Hi[e]=n),n}function Up(t,e){return e.type==="CHANGE_VIEW_TYPE"&&(t=e.viewType),t}function Fp(t,e){return e.type==="CHANGE_DATE"?e.dateMarker:t}function Bp(t,e,n){let r=t.initialDate;return r!=null?e.createMarker(r):n.getDateMarker()}function Wp(t,e){return e.type==="SET_OPTION"?{...t,[e.optionName]:e.rawOptionValue}:t}function Vp(t,e,n,r,s){let i;switch(e.type){case"CHANGE_VIEW_TYPE":return s.build(e.dateMarker||n,r);case"CHANGE_DATE":return s.build(e.dateMarker,r);case"PREV":if(i=s.buildPrev(t,n,r),i.isValid)return i;break;case"NEXT":if(i=s.buildNext(t,n,r),i.isValid)return i;break}return t}function zp(t,e){switch(e.type){case"UNSELECT_DATES":return null;case"SELECT_DATES":return e.selection;default:return t}}function $p(t,e){switch(e.type){case"UNSELECT_EVENT":return"";case"SELECT_EVENT":return e.eventInstanceId;default:return t}}function Yp(t,e){let n;switch(e.type){case"UNSET_EVENT_DRAG":return null;case"SET_EVENT_DRAG":return n=e.state,{affectedEvents:n.affectedEvents,mutatedEvents:n.mutatedEvents,isEvent:n.isEvent};default:return t}}function Gp(t,e){let n;switch(e.type){case"UNSET_EVENT_RESIZE":return null;case"SET_EVENT_RESIZE":return n=e.state,{affectedEvents:n.affectedEvents,mutatedEvents:n.mutatedEvents,isEvent:n.isEvent};default:return t}}function Zp(t,e,n){let r=t.headerToolbar?Oi(t.headerToolbar,t,e,n):null,s=t.footerToolbar?Oi(t.footerToolbar,t,e,n):null;return{header:r,footer:s}}function Oi(t,e,n,r){let s=e.direction==="rtl",i=[],a=!1;function o(c){let u=qp(c,e,n,r);return i.push(...u.viewsWithButtons),a=a||u.hasTitle,u.widgets}return{sectionWidgets:{start:o(t[s?"right":"left"]||t.start||""),center:o(t.center||""),end:o(t[s?"left":"right"]||t.end||"")},viewsWithButtons:i,hasTitle:a}}function qp(t,e,n,r){let s=e.buttons||{},i=e.toolbarElements||{},a=t?t.split(" "):[],o=[],l=!1;return{widgets:a.map(u=>u.split(",").map(f=>{if(f==="title")return l=!0,{name:f};if(i[f])return{name:f,customElement:i[f]};let h,g=s[f]||{},v,m,E;if(h=n[f]){o.push(f);const C=h.optionDefaults.buttonTextKey;v=g.text||(C?e[C]:"")||(h.singleUnit?e[h.singleUnit+"TextLong"]||e[h.singleUnit+"Text"]:"")||f,m=we(g.hint||e.viewHint,[v,f],v),E=R=>{g?.click?.(R),R.defaultPrevented||r.changeView(f)}}else v=g.text||e[f+"TextLong"]||e[f+"Text"]||f,f==="prevYear"?m=we(g.hint||e.prevHint,[e.yearText,"year"],v):f==="nextYear"?m=we(g.hint||e.nextHint,[e.yearText,"year"],v):m=C=>we(g.hint||e[f+"Hint"],[e[C+"TextLong"]||e[C+"Text"],C],v),E=C=>{g?.click?.(C),C.defaultPrevented||r[f]?.()};return{name:f,isView:!!h,buttonText:v,buttonHint:m,buttonDisplay:g.display,buttonIconClass:g.iconClass,buttonIconContent:g.iconContent,buttonClick:E,buttonIsPrimary:g.isPrimary||!1,buttonClass:g.class??g.className,buttonDidMount:g.didMount,buttonWillUnmount:g.willUnmount}})),viewsWithButtons:o,hasTitle:l}}class Xp{constructor(e,n,r){this.type=e,this.getCurrentData=n,this.dateEnv=r}get calendar(){return this.getCurrentData().calendarApi}get title(){return this.getCurrentData().viewTitle}get activeStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.start)}get activeEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.activeRange.end)}get currentStart(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.start)}get currentEnd(){return this.dateEnv.toDate(this.getCurrentData().dateProfile.currentRange.end)}getOption(e){return this.getCurrentData().options[e]}}const Kp={startTime:"09:00",endTime:"17:00",daysOfWeek:[1,2,3,4,5],display:"inverse-background",className:"",groupId:"_businessHours"};function Qp(t,e){return Jt(Jp(t),null,e)}function Jp(t){let e;return t===!0?e=[{}]:Array.isArray(t)?e=t.filter(n=>n.daysOfWeek):typeof t=="object"&&t?e=[t]:e=[],e=e.map(n=>({...Kp,...n})),e}function ev(t,e,n){let r;/^(year|month)$/.test(t.currentRangeUnit)?r=t.currentRange:r=t.activeRange;let s;const i={isEndExclusive:t.isRangeAllDay};return e.titleFormat?s=n.formatRangeToParts(r.start,r.end,J(e.titleFormat),i):(s=n.formatRangeToParts(r.start,r.end,J(Ai(t,e.disallowAmbigTitle,"long")),i),tv(s)&&(s=n.formatRangeToParts(r.start,r.end,J(Ai(t,e.disallowAmbigTitle,"short")),i))),ye(s)}function Ai(t,e,n){const{currentRangeUnit:r}=t;if(r==="year")return{year:"numeric"};if(r==="month")return{year:"numeric",month:n};if(!e){const s=qt(t.currentRange.start,t.currentRange.end);if(s!==null&&s>1)return{year:"numeric",month:n}}return{year:"numeric",month:"long",day:"numeric"}}function tv(t){let e=!1,n=!1;for(const r of t)r.type==="month"&&(r.source==="startRange"&&(e=!0),r.source==="endRange"&&(n=!0));return e&&n}class Li{constructor(){this.resetListeners=new Set}handleInput(e,n){const r=this.dateEnv;if(e!==r&&(typeof n=="function"?this.nowFn=n:r||(this.nowAnchorDate=e.toDate(n?e.createMarker(n):e.createNowMarker()),this.nowAnchorQueried=Date.now()),this.dateEnv=e,r))for(const s of this.resetListeners.values())s()}getDateMarker(){return this.nowAnchorDate?this.dateEnv.timestampToMarker(this.nowAnchorDate.valueOf()+(Date.now()-this.nowAnchorQueried)):this.dateEnv.createMarker(this.nowFn())}addResetListener(e){this.resetListeners.add(e)}removeResetListener(e){this.resetListeners.delete(e)}}class nv{constructor(e){this.computeCurrentViewData=B(this._computeCurrentViewData),this.organizeRawLocales=B(jm),this.buildLocale=B(ol),this.buildPluginHooks=Ip(),this.buildDateEnv=B(rv),this.parseToolbars=B(Zp),this.buildViewSpecs=B(Ap),this.buildDateProfileGenerator=zt(sv),this.buildViewApi=B(iv),this.buildViewUiProps=zt(lv),this.buildEventUiBySource=B(av,at),this.buildEventUiBases=B(ov),this.parseContextBusinessHours=zt(cv),this.buildToolbarProps=B(dv),this.buildTitle=B(ev),this.nowManager=new Li,this.isDrainingActionQueue=!1,this.actionQueue=[],this.optionOverrides={},this.emitter=new on,this.currentCalendarOptionsRefiners={},this.currentCalendarOptionsInput={},this.currentCalendarOptionsRefined={},this.currentViewOptionsInput={},this.currentViewOptionsRefined={},this.optionsForRefining=[],this.optionsForHandling=[],this.getCurrentData=()=>this.data,this.handleNowChange=()=>{this.dispatch({type:"UPDATE_NOW"})},this.dispatch=n=>{this.actionQueue.push(n),this.isDrainingActionQueue||this.drainActionQueue()},this.config=e,this.nowManager=new Li,this.nowTimer=new bl(this.handleNowChange)}destroy(){this.nowTimer.destroy()}update(e){return this.optionOverrides=e,this.actionQueue.push({type:"IDLE"}),this.drainActionQueue(),this.data}resetOptions(e,n){n===void 0?this.optionOverrides=e:(this.optionOverrides={...this.optionOverrides,...e},this.optionsForRefining.push(...n)),this.dispatch({type:"RESET_OPTIONS"})}drainActionQueue(){let e,{state:n,data:r}=this;const s=!n,{actionQueue:i}=this,a=[];for(this.isDrainingActionQueue=!0;i.length;){const o=i.shift();({state:n,data:r,calendarContext:e}=this.reduce(n,r,o)),this.state=n,this.data=r,o.type!=="IDLE"&&a.push(o)}if(this.isDrainingActionQueue=!1,s){const o=e.options.controller;o&&o._setApi(this.config.calendarApi)}if(!s&&a.length){const{onDataChange:o}=this.config;o&&o(this.data,a)}}reduce(e,n,r){let{config:s}=this,i=!e,a=i?{}:Wp(e.dynamicOptionOverrides,r),o=this.computeOptionsData(this.optionOverrides,a,s.calendarApi),l=i?o.calendarOptions.initialView||o.pluginHooks.initialView:Up(e.currentViewType,r),c=this.computeCurrentViewData(l,o,this.optionOverrides,a);s.calendarApi.currentDataManager=this,this.emitter.setThisContext(s.calendarApi),this.emitter.setOptions(c.options);let u={nowManager:this.nowManager,dateEnv:o.dateEnv,options:o.calendarOptions,pluginHooks:o.pluginHooks,calendarApi:s.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData},{nowDate:f}=this.nowTimer.update({unit:"day",unitValue:1,nowIndicatorSnap:"auto",nowManager:this.nowManager,dateEnv:o.dateEnv}),h=i?Bp(o.calendarOptions,o.dateEnv,this.nowManager):Fp(e.currentDate,r),g;i?g=c.dateProfileGenerator.build(h,f):(g=e.dateProfile,n&&n.dateProfileGenerator!==c.dateProfileGenerator&&(g=c.dateProfileGenerator.build(h,f)),g=Vp(g,r,h,f,c.dateProfileGenerator)),(r&&(r.type==="PREV"||r.type==="NEXT")||!et(g.activeRange,h))&&(h=g.currentRange.start);let v=i?Km(o.calendarOptions,g,u):Qm(e.eventSources,r,g,u),m=i?Me():bp(e.eventStore,r,v,g,u),E=ul(v),C=i?Me():E&&!c.options.progressiveEventRendering&&e.renderableEventStore||m,{eventUiSingleBase:R,selectionConfig:x}=this.buildViewUiProps(u),T=this.buildEventUiBySource(v),M=i?{}:this.buildEventUiBases(C.defs,R,T),D={dynamicOptionOverrides:a,currentViewType:l,currentDate:h,dateProfile:g,eventSources:v,eventStore:m,renderableEventStore:C,selectionConfig:x,eventUiBases:M,businessHours:this.parseContextBusinessHours(u),dateSelection:i?null:zp(e.dateSelection,r),eventSelection:i?"":$p(e.eventSelection,r),eventDrag:i?null:Yp(e.eventDrag,r),eventResize:i?null:Gp(e.eventResize,r),nowDate:f},N={...u,...D};for(let le of o.pluginHooks.reducers)Object.assign(D,le(e,r,N));let P=e?_i(e,u):!1,H=_i(D,u);!P&&H?this.emitter.trigger("loading",!0):P&&!H&&this.emitter.trigger("loading",!1);let U=this.buildTitle(g,c.options,o.dateEnv),te=this.buildToolbarProps(c.viewSpec,g,c.dateProfileGenerator,h,f,U),W={viewTitle:U,nowManager:this.nowManager,calendarApi:s.calendarApi,dispatch:this.dispatch,emitter:this.emitter,getCurrentData:this.getCurrentData,toolbarProps:te,...o,...c,...D},V=o.pluginHooks.optionChangeHandlers,ne=n&&n.calendarOptions,ae=o.calendarOptions;if(ne&&ne!==ae){ne.timeZone!==ae.timeZone&&(D.eventSources=W.eventSources=Jm(W.eventSources,g,W),D.eventStore=W.eventStore=ki(W.eventStore,n.dateEnv,W.dateEnv),D.renderableEventStore=W.renderableEventStore=ki(W.renderableEventStore,n.dateEnv,W.dateEnv));for(let le in V)(this.optionsForHandling.indexOf(le)!==-1||ne[le]!==ae[le])&&V[le](ae[le],W)}return this.optionsForHandling=[],{state:D,data:W,calendarContext:u}}computeOptionsData(e,n,r){if(!this.optionsForRefining.length&&e===this.stableOptionOverrides&&n===this.stableDynamicOptionOverrides)return this.stableCalendarOptionsData;let{refinedOptions:s,pluginHooks:i,localeDefaults:a,availableLocaleData:o}=this.processRawCalendarOptions(e,n),l=this.buildDateEnv(s.timeZone,s.locale,s.weekNumberCalculation,s.firstDay,s.weekTextLong,s.weekTextShort,i,o),c=this.buildViewSpecs(i.views,this.stableOptionOverrides,this.stableDynamicOptionOverrides),u=this.parseToolbars(s,c,r);return this.stableCalendarOptionsData={calendarOptions:s,pluginHooks:i,dateEnv:l,viewSpecs:c,toolbarConfig:u,localeDefaults:a,availableRawLocales:o.map}}processRawCalendarOptions(e,n){let{locales:r,locale:s}=Oe(wr,e,n),i=this.organizeRawLocales(r),a=i.map,o=this.buildLocale(s||i.defaultCode,a).options,l=this.buildPluginHooks(e.plugins||[],cp),c=this.currentCalendarOptionsRefiners={...wi,...Di,...xi,...l.listenerRefiners,...l.optionRefiners},u=Oe(wr,...l.optionDefaults,o,Fi(Oe(e,n),c)),f={},h=this.currentCalendarOptionsInput,g=this.currentCalendarOptionsRefined,v=!1;for(let m in u)this.optionsForRefining.indexOf(m)===-1&&(u[m]===h[m]||gt[m]&&m in h&&gt[m](h[m],u[m])||Fr(h[m],u[m]))?f[m]=g[m]:c[m]&&(f[m]=c[m](u[m],m),v=!0);return v&&(this.currentCalendarOptionsInput=u,this.currentCalendarOptionsRefined=f,this.stableOptionOverrides=e,this.stableDynamicOptionOverrides=n),this.optionsForHandling.push(...this.optionsForRefining),this.optionsForRefining=[],{rawOptions:this.currentCalendarOptionsInput,refinedOptions:this.currentCalendarOptionsRefined,pluginHooks:l,availableLocaleData:i,localeDefaults:o}}_computeCurrentViewData(e,n,r,s){let i=n.viewSpecs[e];if(!i)throw new Error(`viewType "${e}" is not available. Please make sure you've loaded all neccessary plugins`);let{refinedOptions:a}=this.processRawViewOptions(i,n.pluginHooks,n.localeDefaults,r,s);this.nowManager.handleInput(n.dateEnv,a.now);let o=this.buildDateProfileGenerator({dateProfileGeneratorClass:i.optionDefaults.dateProfileGeneratorClass,duration:i.duration,durationUnit:i.durationUnit,usesMinMaxTime:i.optionDefaults.usesMinMaxTime,dateEnv:n.dateEnv,calendarApi:this.config.calendarApi,slotMinTime:a.slotMinTime,slotMaxTime:a.slotMaxTime,showNonCurrentDates:a.showNonCurrentDates,dayCount:a.dayCount,dateAlignment:a.dateAlignment,dateIncrement:a.dateIncrement,hiddenDays:a.hiddenDays,weekends:a.weekends,validRangeInput:a.validRange,visibleRangeInput:a.visibleRange,fixedWeekCount:a.fixedWeekCount}),l=this.buildViewApi(e,this.getCurrentData,n.dateEnv);return{viewSpec:i,options:a,dateProfileGenerator:o,viewApi:l}}processRawViewOptions(e,n,r,s,i){let a={...wi,...Di,...xi,...Yg,...n.listenerRefiners,...n.optionRefiners},o=Oe(wr,...n.optionDefaults,e.optionDefaults,r,Fi(Oe(s,e.optionOverrides,i),a)),l={},c=this.currentViewOptionsInput,u=this.currentViewOptionsRefined,f=!1;for(let h in o)o[h]===c[h]||gt[h]&&gt[h](o[h],c[h])||Fr(c[h],o[h])?l[h]=u[h]:(o[h]===this.currentCalendarOptionsInput[h]||gt[h]&&gt[h](o[h],this.currentCalendarOptionsInput[h])?h in this.currentCalendarOptionsRefined&&(l[h]=this.currentCalendarOptionsRefined[h]):a[h]&&(l[h]=a[h](o[h],h)),f=!0);return f&&(this.currentViewOptionsInput=o,this.currentViewOptionsRefined=l),{rawOptions:this.currentViewOptionsInput,refinedOptions:this.currentViewOptionsRefined}}}function rv(t,e,n,r,s,i,a,o){let l=ol(e||o.defaultCode,o.map);return new vg({calendarSystem:"gregory",timeZone:t,locale:l,weekNumberCalculation:n,firstDay:r,weekTextLong:s,weekTextShort:i,cmdFormatter:a.cmdFormatter})}function sv(t){let e=t.dateProfileGeneratorClass||El;return new e(t)}function iv(t,e,n){return new Xp(t,e,n)}function av(t){return ct(t,e=>e.ui)}function ov(t,e,n){let r={"":e};for(let s in t){let i=t[s];i.sourceId&&n[i.sourceId]&&(r[s]=n[i.sourceId])}return r}function lv(t){const{options:e}=t;return{eventUiSingleBase:Hn({display:e.eventDisplay,editable:e.editable,startEditable:e.eventStartEditable,durationEditable:e.eventDurationEditable,constraint:e.eventConstraint,overlap:typeof e.eventOverlap=="boolean"?e.eventOverlap:void 0,allow:e.eventAllow},t),selectionConfig:Hn({constraint:e.selectConstraint,overlap:typeof e.selectOverlap=="boolean"?e.selectOverlap:void 0,allow:e.selectAllow},t)}}function _i(t,e){for(let n of e.pluginHooks.isLoadingFuncs)if(n(t))return!0;return!1}function cv(t){return Qp(t.options.businessHours,t)}const Ui={};function Fi(t,e){const n={};for(const r in t)e[r]?n[r]=t[r]:Ui[r]||($e(`Unknown option \`${r}\`.`),Ui[r]=!0);return n}function dv(t,e,n,r,s,i){let a=n.build(s,s,void 0,!1),o=n.buildPrev(e,r,s,!1),l=n.buildNext(e,r,s,!1);return{title:i,selectedButton:t.type,navUnit:t.singleUnit,isTodayEnabled:a.isValid&&!et(e.currentRange,s),isPrevEnabled:o.isValid,isNextEnabled:l.isValid}}class uv{getCurrentData(){return this.currentDataManager.getCurrentData()}dispatch(e){this.currentDataManager.dispatch(e)}get view(){return this.getCurrentData().viewApi}batchRendering(e){e()}setOption(e,n){this.dispatch({type:"SET_OPTION",optionName:e,rawOptionValue:n})}getOption(e){return this.currentDataManager.currentCalendarOptionsInput[e]}getAvailableLocaleCodes(){return Object.keys(this.getCurrentData().availableRawLocales)}on(e,n){let{currentDataManager:r}=this;r.currentCalendarOptionsRefiners[e]?r.emitter.on(e,n):$e(`Unknown listener \`${e}\`.`)}off(e,n){this.currentDataManager.emitter.off(e,n)}trigger(e,...n){this.currentDataManager.emitter.trigger(e,...n)}changeView(e,n){this.batchRendering(()=>{if(this.unselect(),n)if(n.start&&n.end)this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e}),this.dispatch({type:"SET_OPTION",optionName:"visibleRange",rawOptionValue:n});else{let{dateEnv:r}=this.getCurrentData();this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e,dateMarker:r.createMarker(n)})}else this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:e})})}zoomTo(e,n){let r=this.getCurrentData(),s;n=n||"day",s=r.viewSpecs[n]||this.getUnitViewSpec(n),this.unselect(),s?this.dispatch({type:"CHANGE_VIEW_TYPE",viewType:s.type,dateMarker:e}):this.dispatch({type:"CHANGE_DATE",dateMarker:e})}getUnitViewSpec(e){let{viewSpecs:n,toolbarConfig:r}=this.getCurrentData(),s=[].concat(r.header?r.header.viewsWithButtons:[],r.footer?r.footer.viewsWithButtons:[]),i,a;for(let o in n)s.push(o);for(i=0;i<s.length;i+=1)if(a=n[s[i]],a&&a.singleUnit===e)return a;return null}prev(){this.unselect(),this.dispatch({type:"PREV"})}next(){this.unselect(),this.dispatch({type:"NEXT"})}prevYear(){let e=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:e.dateEnv.addYears(e.currentDate,-1)})}nextYear(){let e=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:e.dateEnv.addYears(e.currentDate,1)})}today(){let e=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:e.nowManager.getDateMarker()})}gotoDate(e){let n=this.getCurrentData();this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:n.dateEnv.createMarker(e)})}incrementDate(e){let n=this.getCurrentData(),r=$(e);r&&(this.unselect(),this.dispatch({type:"CHANGE_DATE",dateMarker:n.dateEnv.add(n.currentDate,r)}))}getDate(){let e=this.getCurrentData();return e.dateEnv.toDate(e.currentDate)}formatDate(e,n){let{dateEnv:r}=this.getCurrentData();return ye(r.formatToParts(r.createMarker(e),J(n)))}formatRange(e,n,r){let{dateEnv:s}=this.getCurrentData();return ye(s.formatRangeToParts(s.createMarker(e),s.createMarker(n),J(r),r))}formatIso(e,n){let{dateEnv:r}=this.getCurrentData();return r.formatIso(r.createMarker(e),{omitTime:n})}select(e,n){let r;n==null?e.start!=null?r=e:r={start:e,end:null}:r={start:e,end:n};let s=this.getCurrentData(),i=im(r,s.dateEnv,$({days:1}));i&&(this.dispatch({type:"SELECT_DATES",selection:i}),nl(i,null,s))}unselect(e){let n=this.getCurrentData();n.dateSelection&&(this.dispatch({type:"UNSELECT_DATES"}),um(e,n))}addEvent(e,n){if(e instanceof K){let a=e._def,o=e._instance;return this.getCurrentData().eventStore.defs[a.defId]||(this.dispatch({type:"ADD_EVENTS",eventStore:Lr({def:a,instance:o})}),this.triggerEventAdd(e)),e}let r=this.getCurrentData(),s;if(n instanceof pt)s=n.internalEventSource;else if(typeof n=="boolean")n&&([s]=Go(r.eventSources));else if(n!=null){let a=this.getEventSourceById(n);if(!a)return $e(`Unknown event source ID \`${n}\`.`),null;s=a.internalEventSource}let i=Qo(e,s,r,!1);if(i){let a=new K(r,i.def,i.def.recurringDef?null:i.instance);return this.dispatch({type:"ADD_EVENTS",eventStore:Lr(i)}),this.triggerEventAdd(a),a}return null}triggerEventAdd(e){let{emitter:n}=this.getCurrentData();n.trigger("eventAdd",{event:e,relatedEvents:[],revert:()=>{this.dispatch({type:"REMOVE_EVENTS",eventStore:rl(e)})}})}getEventById(e){let n=this.getCurrentData(),{defs:r,instances:s}=n.eventStore;e=String(e);for(let i in r){let a=r[i];if(a.publicId===e){if(a.recurringDef)return new K(n,a,null);for(let o in s){let l=s[o];if(l.defId===a.defId)return new K(n,a,l)}}}return null}getEvents(){let e=this.getCurrentData();return tt(e.eventStore,e)}removeAllEvents(){this.dispatch({type:"REMOVE_ALL_EVENTS"})}getEventSources(){let e=this.getCurrentData(),n=e.eventSources,r=[];for(let s in n)r.push(new pt(e,n[s]));return r}getEventSourceById(e){let n=this.getCurrentData(),r=n.eventSources;e=String(e);for(let s in r)if(r[s].publicId===e)return new pt(n,r[s]);return null}addEventSource(e){let n=this.getCurrentData();if(e instanceof pt)return n.eventSources[e.internalEventSource.sourceId]||this.dispatch({type:"ADD_EVENT_SOURCES",sources:[e.internalEventSource]}),e;let r=cl(e,n);return r?(this.dispatch({type:"ADD_EVENT_SOURCES",sources:[r]}),new pt(n,r)):null}removeAllEventSources(){this.dispatch({type:"REMOVE_ALL_EVENT_SOURCES"})}refetchEvents(){this.dispatch({type:"FETCH_EVENT_SOURCES",isRefetch:!0})}scrollToTime(e){let n=$(e);n&&this.trigger("_timeScrollRequest",n)}getButtonState(){const e=this.getCurrentData(),{toolbarProps:n}=e,r=e.calendarOptions,s=r.buttons||{},i=e.viewSpecs,a=e.viewSpec.singleUnit,o=[a?Bi(a,r):"",a],l={today:{text:r.todayText,hint:we(r.todayHint,o,r.todayText),isDisabled:!n.isTodayEnabled},prev:{text:r.prevText,hint:we(r.prevHint,o,r.prevText),isDisabled:!n.isPrevEnabled},next:{text:r.nextText,hint:we(r.nextHint,o,r.nextText),isDisabled:!n.isNextEnabled},prevYear:{text:r.prevYearText,hint:we(r.prevHint,[r.yearText,"year"],r.prevYearText),isDisabled:!1},nextYear:{text:r.prevYearText,hint:we(r.nextHint,[r.yearText,"year"],r.nextYearText),isDisabled:!1}};for(const c in i){const u=i[c],{singleUnit:f}=u,h=u.optionDefaults.buttonTextKey,g=s[c]?.text||(h?r[h]:"")||(f?Bi(f,r):"")||c,v=we(r.viewHint,[g,c],g);l[c]={text:g,hint:v}}return l}}function Bi(t,e){return e[t+"TextLong"]||e[t+"Text"]}class fv extends S.Component{constructor(){super(...arguments),this.state={forPrint:!1},this.handleBeforePrint=()=>{Yt.flushSync(()=>{this.setState({forPrint:!0})})},this.handleAfterPrint=()=>{Yt.flushSync(()=>{this.setState({forPrint:!1})})}}render(){return this.props?.children(this.state.forPrint)}componentDidMount(){const{props:e}=this,{emitter:n}=e;n.on("_beforeprint",this.handleBeforePrint),n.on("_afterprint",this.handleAfterPrint)}componentWillUnmount(){const{props:e}=this,{emitter:n}=e;n.off("_beforeprint",this.handleBeforePrint),n.off("_afterprint",this.handleAfterPrint)}}function hv(t,e){let n=t.borderlessX??t.borderless,r=t.borderlessTop??t.borderless,s=t.borderlessBottom??t.borderless;const i={borderlessX:!!n,borderlessTop:!!r,borderlessBottom:!!s};return O(k(t.class,i),k(t.className,i),y.borderBoxRoot,y.isolate,y.flexCol,e?y.calendarPrintRoot:y.calendarScreenRoot)}class gv extends ee{render(){const{contentGenerator:e,className:n}=this.props;if(e)return d.jsx(me,{tag:"span",style:{display:"contents"},attrs:{"aria-hidden":!0},renderProps:{},generatorName:void 0,customGenerator:e});if(n!==void 0)return d.jsx("span",{"aria-hidden":!0,className:n})}}class mv extends ee{render(){let{props:e}=this,{options:n}=this.context,r=e.widgetGroups.map(s=>this.renderWidgetGroup(s));return S.createElement("div",{className:k(n.toolbarSectionClass,{name:e.name})},...r)}renderWidgetGroup(e){let{props:n,context:r}=this,{options:s}=r,i=[],a=!0,o=!0;for(const l of e){const{name:c,isView:u}=l;c==="title"?a=!1:u||(o=!1)}for(let l of e){let{name:c,customElement:u,buttonHint:f}=l;if(c==="title")i.push(d.jsx("div",{role:"heading","aria-level":s.headingLevel,id:n.titleId,className:O(s.toolbarTitleClass),children:n.title}));else if(u)i.push(d.jsx(me,{tag:"span",style:{display:"contents"},renderProps:{},generatorName:void 0,customGenerator:u}));else{let h=c===n.selectedButton,g=!n.isTodayEnabled&&c==="today"||!n.isPrevEnabled&&c==="prev"||!n.isNextEnabled&&c==="next",v=l.buttonDisplay??s.buttonDisplay;v==="auto"&&(v=l.buttonIconContent||l.buttonIconClass?"icon":"text");let m;v!=="text"&&(m=d.jsx(gv,{className:l.buttonIconClass,contentGenerator:l.buttonIconContent}));let E=e.length>1&&a,C=E?{hasSelection:o}:null,R={name:c,text:l.buttonText,isPrimary:l.buttonIsPrimary,isSelected:h,isDisabled:g,isIconOnly:v==="icon",buttonGroup:C};i.push(d.jsx(me,{tag:"button",attrs:{type:"button",disabled:g,...a&&o?{role:"tab","aria-selected":h}:{"aria-pressed":h},"aria-label":typeof f=="function"?f(n.navUnit):f,onClick:l.buttonClick},className:O(k(s.buttonClass,R),!g&&y.cursorPointer,E&&O(h?y.z1:y.z0,y.focusZ2)),renderProps:R,generatorName:void 0,classNameGenerator:l.buttonClass,didMount:l.buttonDidMount,willUnmount:l.buttonWillUnmount,children:()=>v==="text"?l.buttonText:v==="icon"?m:v==="icon-text"?d.jsxs(d.Fragment,{children:[m,l.buttonText]}):d.jsxs(d.Fragment,{children:[l.buttonText,m]})}))}}return i.length>1?S.createElement("div",{role:a&&o?"tablist":void 0,"aria-label":a&&o?s.viewChangeHint:void 0,className:O(k(s.buttonGroupClass,{hasSelection:o}),y.isolate)},...i):i[0]}}class Wi extends ee{render(){let{props:e}=this,n=this.context.options,{sectionWidgets:r}=e.model;const{borderlessX:s,borderlessTop:i,borderlessBottom:a}=Ot(n),o=e.isHeader?n.headerToolbarClass:n.footerToolbarClass;return d.jsxs("div",{className:O(k(o,{borderlessX:s,borderlessTop:i,borderlessBottom:a}),k(n.toolbarClass,{borderlessX:s,borderlessTop:i,borderlessBottom:a})),children:[this.renderSection("start",r.start),this.renderSection("center",r.center),this.renderSection("end",r.end)]})}renderSection(e,n){let{props:r}=this;return d.jsx(mv,{name:e,widgetGroups:n,title:r.title,titleId:r.titleId,navUnit:r.navUnit,selectedButton:r.selectedButton,isTodayEnabled:r.isTodayEnabled,isPrevEnabled:r.isPrevEnabled,isNextEnabled:r.isNextEnabled},e)}}class pv extends Lt{constructor(e){super(e),this.handleSegClick=(n,r)=>{let{component:s}=this,{context:i}=s,a=Nt(r);a&&s.isValidSegDownEl(n.target)&&i.emitter.trigger("eventClick",{el:r,event:new K(s.context,a.def,a.instance),jsEvent:n,view:i.viewApi})},this.destroy=zo(e.el,"click",`.${y.internalEvent}`,this.handleSegClick)}}class vv extends Lt{constructor(e){super(e),this.handleEventElRemove=n=>{n===this.currentSegEl&&this.handleSegLeave(null,this.currentSegEl)},this.handleSegEnter=(n,r)=>{Nt(r)&&(this.currentSegEl=r,this.triggerEvent("eventMouseEnter",n,r))},this.handleSegLeave=(n,r)=>{this.currentSegEl&&(this.currentSegEl=null,this.triggerEvent("eventMouseLeave",n,r))},this.removeHoverListeners=Ig(e.el,`.${y.internalEvent}`,this.handleSegEnter,this.handleSegLeave)}destroy(){this.removeHoverListeners()}triggerEvent(e,n,r){let{component:s}=this,{context:i}=s,a=Nt(r);(!n||s.isValidSegDownEl(n.target))&&i.emitter.trigger(e,{el:r,event:new K(i,a.def,a.instance),jsEvent:n,view:i.viewApi})}}class yv extends dt{constructor(){super(...arguments),this.buildViewContext=B(dp),this.buildViewPropTransformers=B(bv),this.interactionsStore={},this.calendarInteractions=[],this.registerInteractiveComponent=(e,n)=>{let r=Cp(e,n),i=[pv,vv];n.disableHits||(i=i.concat(this.props.pluginHooks.componentInteractions));let a=i.map(o=>new o(r));this.interactionsStore[e.uid]=a,Br[e.uid]=r},this.unregisterInteractiveComponent=e=>{let n=this.interactionsStore[e.uid];if(n){for(let r of n)r.destroy();delete this.interactionsStore[e.uid]}delete Br[e.uid]}}get viewTitleId(){return this.props.baseId+"title"}render(){const{props:e}=this;let{toolbarConfig:n,options:r}=e,s,i=!1,a;e.forPrint||Ye(r)||(r.height!=null?i=!0:r.contentHeight!=null?s=r.contentHeight:a=Math.max(r.aspectRatio,.5));let o=this.buildViewContext(e.viewSpec,e.viewApi,e.options,e.dateProfileGenerator,e.dateEnv,e.nowManager,e.pluginHooks,e.dispatch,e.getCurrentData,e.emitter,e.calendarApi,e.baseId,this.registerInteractiveComponent,this.unregisterInteractiveComponent);return d.jsxs(At.Provider,{value:o,children:[n.header&&d.jsx(Wi,{model:n.header,isHeader:!0,titleId:this.viewTitleId,...e.toolbarProps}),d.jsxs("div",{className:O(y.flexCol,y.rel,y.overflowAnchorNone,y.minHeight0,i&&y.liquid),style:{height:s,aspectRatio:a!=null?String(a):void 0},children:[this.renderView(O((i||s)&&y.liquid,a!=null&&y.fill,y.internalView)),this.buildAppendContent()]}),n.footer&&d.jsx(Wi,{model:n.footer,isHeader:!1,...e.toolbarProps})]})}renderView(e){const{props:n}=this,{pluginHooks:r,viewSpec:s,toolbarConfig:i,toolbarProps:a}=n;let o={className:e,dateProfile:n.dateProfile,businessHours:n.businessHours,eventStore:n.renderableEventStore,eventUiBases:n.eventUiBases,dateSelection:n.dateSelection,eventSelection:n.eventSelection,eventDrag:n.eventDrag,eventResize:n.eventResize,forPrint:n.forPrint,labelId:i.header&&i.header.hasTitle?this.viewTitleId:void 0,labelStr:i.header&&i.header.hasTitle?void 0:a.title},l=this.buildViewPropTransformers(r.viewPropsTransformers),c={...n,toolbarProps:a,forPrint:n.forPrint};for(let f of l)Object.assign(o,f.transform(o,c));let u=s.component;return d.jsx(u,{...o})}buildAppendContent(){const{props:e}=this;return d.jsx(d.Fragment,{children:e.pluginHooks.viewContainerAppends.map((n,r)=>d.jsx(S.Fragment,{children:n(e)},r))})}componentDidMount(){const{props:e}=this;this.calendarInteractions=e.pluginHooks.calendarInteractions.map(r=>new r(e));let{propSetHandlers:n}=e.pluginHooks;for(let r in n)n[r](e[r],e);for(let r of e.pluginHooks.contextInit)r(e)}componentDidUpdate(e){const{props:n}=this;let{propSetHandlers:r}=n.pluginHooks;for(let s in r)n[s]!==e[s]&&r[s](n[s],n)}componentWillUnmount(){const{props:e}=this;for(let n of this.calendarInteractions)n.destroy();this.calendarInteractions=[],e.emitter.trigger("_unmount")}}function bv(t){return t.map(e=>new e)}const Ev=S.forwardRef((t,e)=>{const n=Dv(t.id),[r,s]=S.useState("");function i(c,u){(Sv(u)?Yt.flushSync:wv)(()=>{s(_e())})}const[a]=S.useState(()=>new uv),[o]=S.useState(()=>new nv({calendarApi:a,onDataChange:i}));S.useEffect(()=>()=>{o.destroy()},[]),S.useImperativeHandle(e,()=>({getApi:()=>a}),[]);const l=o.update(t);return d.jsx(fv,{emitter:l.emitter,children:c=>{const u=l.calendarOptions,f=u.direction==="rtl",h=hv(u,c);return d.jsx("div",{dir:f?"rtl":void 0,className:h,style:{height:u.height},"data-color-scheme":u.colorScheme||void 0,children:d.jsx(yv,{...l,baseId:n,forPrint:c})})}})});function Sv(t){for(const e of t)if(e.type==="SET_EVENT_DRAG"||e.type==="UNSET_EVENT_DRAG"||e.type==="SET_EVENT_RESIZE"||e.type==="UNSET_EVENT_RESIZE"||e.type==="MERGE_EVENTS")return!0;return!1}function wv(t){t()}let Vi=!1;function Dv(t){if(Ys.useId)return Ys.useId();const[e]=S.useState(()=>_e());return t?t+":":(Vi||(Vi=!0,$e("Missing `id` prop. Provide one for better SSR support in React 17.")),`fc:${e}:`)}function Cl(t){const e=t.getRootNode();return e instanceof Document?e.body||e.documentElement:e}function en(t){return getComputedStyle(t).direction==="rtl"}const xv=/(top|left|right|bottom|width|height)$/i;function xn(t,e){for(let n in e)Cv(t,n,e[n])}function Cv(t,e,n){n==null?t.style[e]="":typeof n=="number"&&xv.test(e)?t.style[e]=`${n}px`:t.style[e]=n}function Tl(t){return t.composedPath?.()[0]??t.target}class Rl extends S.Component{constructor(e,n){super(e,n),this.handleChange=()=>{this.forceUpdate()},this.runner=new bl(this.handleChange)}render(){const{props:e,context:n}=this,{nowDate:r,todayRange:s}=this.runner.update({nowManager:n.nowManager,unit:e.unit,unitValue:e.unitValue,nowIndicatorSnap:n.options.nowIndicatorSnap,dateEnv:n.dateEnv});return e.children(r,s)}componentWillUnmount(){this.runner.destroy()}}Rl.contextType=At;const Tv=J({year:"numeric",month:"long",day:"numeric"}),Rv=J({week:"long"}),Nv=J({weekday:"long"});function Ln(t){for(const e of t)if(e.type==="weekday")return e.value;return""}function _n(t){for(const e of t)if(e.type==="day")return e.value;return""}function Nl(t){for(const e of t)if(e.type==="month")return e.value;return""}function sr(t,e,n="day"){return ye(t.dateEnv.formatToParts(e,n==="week"?Rv:Tv))}function js(t,e,n="day",r=sr(t,e,n),s=!0){const{dateEnv:i,options:a,calendarApi:o}=t,l=i.toDate(e),c=u=>{let f=n==="day"?a.navLinkDayClick:n==="week"?a.navLinkWeekClick:null;typeof f=="function"?f.call(o,i.toDate(e),u):(typeof f=="string"&&(n=f),o.zoomTo(e,n))};return{role:"link","aria-label":we(a.navLinkHint,[r,l],r),className:O(a.navLinkClass,y.cursorPointer,y.internalNavLink),...s?bs(c):{onClick:c}}}function Hs(t,e,n,r,s){const i=!!(n&&(!n.activeRange||!et(n.activeRange,t)));return{date:e.toDate(t),dow:t.getUTCDay(),isDisabled:i,isOther:!i&&!!(n&&!et(n.currentRange,t)),isToday:!i&&!!(r&&et(r,t)),isPast:!i&&!!(s?t<s:r&&t<r.start),isFuture:!i&&!!(s?t>s:r&&t>=r.end)}}function Vr(t,e){return t!=null&&(t===e||Math.abs(t-e)<.01)}const Mv=!0,zr=new Map,$r=new Set;let Yr=!1,Dr=!1;function $t(t){$r.add(t),!Yr&&!Dr&&(Dr=!0,requestAnimationFrame(()=>{Dr=!1,Ml()}))}function Ml(){for(const t of $r.values())t(),$r.delete(t)}const yn=typeof ResizeObserver<"u"&&new ResizeObserver(t=>{Yr=!0;for(let e of t){const n=e.target,r=zr.get(n);let s,i;if(e.borderBoxSize&&Mv){const o=e.borderBoxSize[0]||e.borderBoxSize;s=o.inlineSize,i=o.blockSize}else({width:s,height:i}=n.getBoundingClientRect());let a=!1;Vr(r.width,s)||(r.width=s,a=r.watchWidth),Vr(r.height,i)||(r.height=i,a||(a=r.watchHeight)),a&&r.callback(s,i)}Yt.flushSync(()=>{Ml(),Yr=!1})});function ir(t,e,n=!0,r=!0){return zr.set(t,{callback:e,watchWidth:n,watchHeight:r}),yn&&yn.observe(t,{box:"border-box"}),()=>{zr.delete(t),yn&&yn.unobserve(t)}}function Il(t,e){return ir(t,e,!0)}function ar(t,e){return ir(t,(n,r)=>e(r),!1,!0)}class Iv extends ee{constructor(){super(...arguments),this.refineRenderProps=zt(kv)}render(){const{props:e,context:n}=this,{options:r,viewSpec:s}=n,i=this.refineRenderProps({...Ot(r),options:{headerToolbar:r.headerToolbar,footerToolbar:r.footerToolbar},isHeightAuto:Ye(r),viewApi:n.viewApi});return d.jsx(me,{elRef:e.elRef,tag:e.tag||"div",attrs:e.attrs,style:e.style,className:O(e.className,k(r.viewClass,i),k(s.optionDefaults.class,i),k(s.optionDefaults.className,i),k(s.optionOverrides.class,i),k(s.optionOverrides.className,i)),renderProps:i,generatorName:void 0,didMount:r.didMount||r.viewDidMount,willUnmount:r.willUnmount||r.viewWillUnmount,children:()=>e.children})}}function kv(t){return{view:t.viewApi,borderlessX:t.borderlessX,borderlessTop:t.borderlessTop,borderlessBottom:t.borderlessBottom,options:t.options,isHeightAuto:t.isHeightAuto}}class or extends ee{constructor(){super(...arguments),this.uid=_e()}prepareHits(){}queryHit(e,n,r,s,i){return null}isValidSegDownEl(e){return!this.props.eventDrag&&!this.props.eventResize&&!e.closest(`.${y.internalEventMirror}`)}isValidDateDownEl(e){return!e.closest(`.${y.internalEvent}:not(.${y.internalBgEvent})`)&&!e.closest(`.${y.internalMoreLink}`)&&!e.closest(`.${y.internalNavLink}`)&&!e.closest(`.${y.internalPopover}`)}}class zi{constructor(e){this.drainedOption=e,this.isRunning=!1,this.isDirty=!1,this.pauseDepths={},this.timeoutId=0}request(e){this.isDirty=!0,this.isPaused()||(this.clearTimeout(),e==null?this.tryDrain():this.timeoutId=setTimeout(this.tryDrain.bind(this),e))}pause(e=""){let{pauseDepths:n}=this;n[e]=(n[e]||0)+1,this.clearTimeout()}resume(e="",n){let{pauseDepths:r}=this;e in r&&(n?delete r[e]:(r[e]-=1,r[e]<=0&&delete r[e]),this.tryDrain())}isPaused(){return Object.keys(this.pauseDepths).length}tryDrain(){if(!this.isRunning&&!this.isPaused()){for(this.isRunning=!0;this.isDirty;)this.isDirty=!1,this.drained();this.isRunning=!1}}clear(){this.clearTimeout(),this.isDirty=!1,this.pauseDepths={}}clearTimeout(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=0)}drained(){this.drainedOption&&this.drainedOption()}}class Pv{constructor(e){this.el=e,this.emitter=new on,this.isScroll=!1,this.isScrollRecent=!1,this.isWheelRecent=!1,this.isMouseDown=!1,this.isTouchDown=!1,this.isMouse=!1,this.isTouch=!1,this.isWheel=!1,this.handleScroll=()=>{this.isScrollRecent=!0,this.isMouseDown&&(this.isMouse=!0),this.isTouchDown&&(this.isTouch=!0),this.isWheelRecent&&(this.isWheel=!0),this.startScroll(),this.emitter.trigger("scroll",this.getIsDevice()),this.scrollWaiter.request(500)},this.handleScrollWait=()=>{this.isScrollRecent=!1,this.isTouchDown||this.endScroll()},this.handleWheel=()=>{this.isWheelRecent=!0,this.wheelWaiter.request(500)},this.handleWheelWait=()=>{this.isWheelRecent=!1},this.handleMouseDown=()=>{this.isMouseDown=!0},this.handleMouseUp=()=>{this.isMouseDown=!1},this.handleTouchStart=()=>{this.isTouchDown=!0},this.handleTouchEnd=()=>{this.isTouchDown=!1,this.isScrollRecent||this.endScroll()},this.wheelWaiter=new zi(this.handleWheelWait),this.scrollWaiter=new zi(this.handleScrollWait),e.addEventListener("scroll",this.handleScroll,{passive:!0}),e.addEventListener("wheel",this.handleWheel,{passive:!0}),e.addEventListener("mousedown",this.handleMouseDown),e.addEventListener("mouseup",this.handleMouseUp),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.addEventListener("touchend",this.handleTouchEnd)}destroy(){let{el:e}=this;e.removeEventListener("scroll",this.handleScroll,{passive:!0}),e.removeEventListener("wheel",this.handleWheel,{passive:!0}),e.removeEventListener("mousedown",this.handleMouseDown),e.removeEventListener("mouseup",this.handleMouseUp),e.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.removeEventListener("touchend",this.handleTouchEnd)}startScroll(){this.isScroll||(this.isScroll=!0,this.emitter.trigger("scrollStart",this.getIsDevice()))}endScroll(){this.isScroll&&(this.scrollWaiter.clear(),this.wheelWaiter.clear(),this.isScroll=!1,this.isWheelRecent=!1,this.emitter.trigger("scrollEnd",this.getIsDevice()),this.isMouse=!1,this.isTouch=!1,this.isWheel=!1)}getIsDevice(){return this.isWheel||this.isMouse||this.isTouch}}class Un extends or{constructor(){super(...arguments),this.handleEl=e=>{this.el&&(this.el=null,this._isUnmounting=!0,this.listener.destroy()),e&&(this.el=e,this._isUnmounting=!1,this.listener=new Pv(e))},this.handleHRuler=e=>{this.disconnectHRuler&&(this.disconnectHRuler(),this.disconnectHRuler=void 0,this.clientWidth!==void 0&&(this.clientWidth=void 0,G(this.props.clientWidthRef,null))),e&&(this.disconnectHRuler=Il(e,n=>{this._isUnmounting||n!==this.clientWidth&&(this.clientWidth=n,G(this.props.clientWidthRef,n))}))},this.handleVRuler=e=>{this.disconnectVRuler&&(this.disconnectVRuler(),this.disconnectVRuler=void 0,this.clientHeight!==void 0&&(this.clientHeight=void 0,G(this.props.clientHeightRef,null))),e&&(this.disconnectVRuler=ar(e,n=>{if(this._isUnmounting)return;n!==this.clientHeight&&(this.clientHeight=n,G(this.props.clientHeightRef,n));const r=Math.round(this.el.getBoundingClientRect().height-n);r!==this.bottomScrollbarWidth&&(this.bottomScrollbarWidth=r,G(this.props.bottomScrollbarWidthRef,r))}))}}render(){const{props:e}=this,n=e.horizontal||e.vertical?"hidden":"";return d.jsxs("div",{ref:this.handleEl,className:O(e.className,y.noPadding,y.rel,e.hideScrollbars&&y.noScrollbars,y.internalScroller),style:{...e.style,overflowX:e.horizontal?"auto":n,overflowY:e.vertical?"auto":n},children:[e.children,!!e.clientWidthRef&&d.jsx("div",{ref:this.handleHRuler,className:y.fillTop}),!!(e.clientHeightRef||e.bottomScrollbarWidthRef)&&d.jsx("div",{ref:this.handleVRuler,className:y.fillStart})]})}endScroll(){this.listener.endScroll()}get x(){const{el:e}=this;return e?jv(e):0}get y(){const{el:e}=this;return e?e.scrollTop:0}scrollTo({x:e,y:n}){const{el:r}=this;r&&(n!=null&&(r.scrollTop=n),e!=null&&Hv(r,e))}addScrollStartListener(e){this.listener.emitter.on("scrollStart",e)}removeScrollStartListener(e){this.listener.emitter.off("scrollStart",e)}addScrollEndListener(e){this.listener.emitter.on("scrollEnd",e)}removeScrollEndListener(e){this.listener.emitter.off("scrollEnd",e)}}function jv(t){const{scrollLeft:e}=t;return en(t)?Ov(e,t):e}function Hv(t,e){const n=en(t);t.scrollLeft=n?Av(e,t):e}function Ov(t,e){switch(kl()){case"positive":return e.scrollWidth-e.clientWidth-t;case"negative":return-t}return t}function Av(t,e){switch(kl()){case"positive":return e.scrollWidth-e.clientWidth-t;case"negative":return-t}return t}let $i;function kl(){return $i||($i=Lv())}function Lv(){let t=document.createElement("div");t.style.position="absolute",t.style.top="-1000px",t.style.width="100px",t.style.height="100px",t.style.overflow="scroll",t.style.direction="rtl";let e=document.createElement("div");e.style.width="200px",e.style.height="200px",t.appendChild(e),document.body.appendChild(t);let n;return t.scrollLeft>0?n="positive":(t.scrollLeft=50,t.scrollLeft>0?n="reverse":n="negative"),t.remove(),n}class Os extends ee{constructor(){super(...arguments),this.buildPublicEvent=B((e,n,r)=>new K(e,n,r)),this.handleEl=e=>{this.el=e,G(this.props.elRef,e),e&&On(e,this.props.eventRange)}}render(){const{props:e,context:n}=this,{options:r}=n,{eventRange:s}=e,i=s.ui,a=r.eventTimeFormat||e.defaultTimeFormat,o=e.forcedTimeText??ym(a,s,e.slicedStart,e.slicedEnd,e.isStart,e.isEnd,n,e.defaultDisplayEventTime,e.defaultDisplayEventEnd),[l,c,u]=Sm(s,n),f=this.buildPublicEvent(n,s.def,s.instance),h=!e.disableDragging&&vm(s,n),g=/row|column/.test(e.display),v={event:f,isNarrow:e.isNarrow||!1,isShort:e.isShort||!1,timeText:o},m={event:f,view:n.viewApi,timeText:o,color:i.color||r.eventColor,contrastColor:i.contrastColor||r.eventContrastColor,isDraggable:h,isStartResizable:!e.disableResizing&&e.isStart&&i.durationEditable&&r.eventResizableFromStart,isEndResizable:!e.disableResizing&&e.isEnd&&i.durationEditable,isMirror:e.isMirror,isStart:!!e.isStart,isEnd:!!e.isEnd,isFirst:!!e.isFirst,isLast:!!e.isLast,isPast:!!e.isPast,isFuture:!!e.isFuture,isToday:!!e.isToday,isSelected:!!e.isSelected,isDragging:!!e.isDragging,isResizing:!!e.isResizing,isInteractive:u,isNarrow:e.isNarrow||!1,isShort:e.isShort||!1,level:e.level||0,timeClass:O(k(r.eventTimeClass,v),g&&k(r.blockEventTimeClass,v),e.display==="row"&&k(r.rowEventTimeClass,v),e.display==="column"&&k(r.columnEventTimeClass,v),e.display==="list-item"&&k(r.listItemEventTimeClass,v)),titleClass:O(k(r.eventTitleClass,v),g&&k(r.blockEventTitleClass,v),e.display==="row"&&k(r.rowEventTitleClass,v),e.display==="column"&&k(r.columnEventTitleClass,v),e.display==="list-item"&&k(r.listItemEventTitleClass,v),e.display==="row"&&r.rowEventTitleSticky&&y.stickyS,e.display==="column"&&r.columnEventTitleSticky&&y.stickyT),options:{eventOverlap:!!r.eventOverlap}},E=O(g&&k(r.blockEventClass,m),e.display==="row"&&k(r.rowEventClass,m),e.display==="column"&&k(r.columnEventClass,m),e.display==="list-item"&&k(r.listItemEventClass,m),i.className,e.className,e.display==="column"?y.flexCol:y.flexRow,(s.def.url||h)&&y.cursorPointer,y.internalEvent,e.isMirror&&y.internalEventMirror,h&&y.internalEventDraggable,m.isSelected&&y.internalEventSelected,(m.isStartResizable||m.isEndResizable)&&y.internalEventResizable),C=O(k(r.eventBeforeClass,m),g&&k(r.blockEventBeforeClass,m),e.display==="row"&&k(r.rowEventBeforeClass,m),e.display==="column"&&k(r.columnEventBeforeClass,m),e.display==="list-item"&&k(r.listItemEventBeforeClass,m)),R=O(k(r.eventAfterClass,m),g&&k(r.blockEventAfterClass,m),e.display==="row"&&k(r.rowEventAfterClass,m),e.display==="column"&&k(r.columnEventAfterClass,m),e.display==="list-item"&&k(r.listItemEventAfterClass,m)),x=O(k(r.eventInnerClass,m),g&&k(r.blockEventInnerClass,m),e.display==="row"&&k(r.rowEventInnerClass,m),e.display==="column"&&k(r.columnEventInnerClass,m),e.display==="list-item"&&k(r.listItemEventInnerClass,m),!e.disableLiquid&&y.liquid),T=e.display==="row"&&r.rowEventBeforeContent,M=e.display==="row"&&r.rowEventAfterContent;return d.jsx(me,{tag:l,attrs:{...e.attrs,...c,dir:e.isDragging&&r.direction==="rtl"?"rtl":void 0},className:E,style:{"--fc-event-color":m.color,"--fc-event-contrast-color":m.contrastColor},elRef:this.handleEl,renderProps:m,generatorName:"eventContent",customGenerator:r.eventContent,defaultGenerator:_v,classNameGenerator:r.eventClass,didMount:r.eventDidMount,willUnmount:r.eventWillUnmount,children:D=>d.jsxs(d.Fragment,{children:[!!(m.isSelected&&g)&&d.jsx("div",{className:e.display==="column"?y.hitX:y.hitY}),(C||T)&&d.jsxs("div",{className:O(C,!e.disableZindexes&&y.z1,m.isStartResizable&&O(e.display==="column"?y.cursorResizeT:y.cursorResizeS,y.internalEventResizer,y.internalEventResizerStart)),children:[T&&d.jsx(me,{tag:"div",style:{display:"contents"},attrs:{"aria-hidden":!0},renderProps:m,generatorName:void 0,customGenerator:T}),!!(m.isStartResizable&&m.isSelected)&&d.jsx("div",{className:y.hit})]}),d.jsx(D,{tag:"div",className:O(x,!e.disableZindexes&&y.z0)}),(R||M)&&d.jsxs("div",{className:O(R,!e.disableZindexes&&y.z1,m.isEndResizable&&O(e.display==="column"?y.cursorResizeB:y.cursorResizeE,y.internalEventResizer,y.internalEventResizerEnd)),children:[M&&d.jsx(me,{tag:"div",style:{display:"contents"},attrs:{"aria-hidden":!0},renderProps:m,generatorName:void 0,customGenerator:M}),!!(m.isEndResizable&&m.isSelected)&&d.jsx("div",{className:y.hit})]})]})})}componentDidUpdate(e){this.el&&this.props.eventRange!==e.eventRange&&On(this.el,this.props.eventRange)}}Os.addPropsEquality({seg:at});function _v(t){return d.jsxs(d.Fragment,{children:[t.timeText&&d.jsx("div",{className:t.timeClass,children:t.timeText}),d.jsx("div",{className:t.titleClass,children:t.event.title||d.jsx(d.Fragment,{children:" "})})]})}function Uv(t,e){return t.left>=e.left&&t.left<e.right&&t.top>=e.top&&t.top<e.bottom}function Pl(t,e){let n={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)};return n.left<n.right&&n.top<n.bottom?n:!1}function Fv(t,e){return{left:Math.min(Math.max(t.left,e.left),e.right),top:Math.min(Math.max(t.top,e.top),e.bottom)}}function Bv(t){return{left:(t.left+t.right)/2,top:(t.top+t.bottom)/2}}function Wv(t,e){return{left:t.left-e.left,top:t.top-e.top}}function Vv(t,e=!1){let n=window.getComputedStyle(t),r=parseInt(n.borderLeftWidth,10)||0,s=parseInt(n.borderRightWidth,10)||0,i=parseInt(n.borderTopWidth,10)||0,a=parseInt(n.borderBottomWidth,10)||0,o=Yv(t),l=o.y-r-s,c=o.x-i-a,u={borderLeft:r,borderRight:s,borderTop:i,borderBottom:a,scrollbarBottom:c,scrollbarLeft:0,scrollbarRight:0};return n.direction==="rtl"?u.scrollbarLeft=l:u.scrollbarRight=l,e&&(u.paddingLeft=parseInt(n.paddingLeft,10)||0,u.paddingRight=parseInt(n.paddingRight,10)||0,u.paddingTop=parseInt(n.paddingTop,10)||0,u.paddingBottom=parseInt(n.paddingBottom,10)||0),u}function zv(t,e=!1,n){let r=As(t),s=Vv(t,e),i={left:r.left+s.borderLeft+s.scrollbarLeft,right:r.right-s.borderRight-s.scrollbarRight,top:r.top+s.borderTop,bottom:r.bottom-s.borderBottom-s.scrollbarBottom};return e&&(i.left+=s.paddingLeft,i.right-=s.paddingRight,i.top+=s.paddingTop,i.bottom-=s.paddingBottom),i}function As(t){let e=t.getBoundingClientRect();return{left:e.left+window.scrollX,top:e.top+window.scrollY,right:e.right+window.scrollX,bottom:e.bottom+window.scrollY}}function $v(t){let e=jl(t),n=t.getBoundingClientRect();for(let r of e){let s=Pl(n,r.getBoundingClientRect());if(s)n=s;else return null}return n}function jl(t){let e=[];for(;t instanceof HTMLElement;){let n=window.getComputedStyle(t);if(n.position==="fixed")break;/(auto|scroll)/.test(n.overflow+n.overflowY+n.overflowX)&&e.push(t),t=t.parentNode}return e}function Yv(t){return{x:t.offsetHeight-t.clientHeight,y:t.offsetWidth-t.clientWidth}}class Gv{constructor(){this.sliceBusinessHours=B(this._sliceBusinessHours),this.sliceDateSelection=B(this._sliceDateSpan),this.sliceEventStore=B(this._sliceEventStore),this.sliceEventDrag=B(this._sliceInteraction),this.sliceEventResize=B(this._sliceInteraction),this.forceDayIfListItem=!1}sliceProps(e,n,r,s,...i){let{eventUiBases:a}=e,o=this.sliceEventStore(e.eventStore,a,n,r,...i);return{dateSelectionSegs:this.sliceDateSelection(e.dateSelection,n,r,a,s,...i),businessHourSegs:this.sliceBusinessHours(e.businessHours,n,r,s,...i),fgEventSegs:o.fg,bgEventSegs:o.bg,eventDrag:this.sliceEventDrag(e.eventDrag,a,n,r,...i),eventResize:this.sliceEventResize(e.eventResize,a,n,r,...i),eventSelection:e.eventSelection}}sliceNowDate(e,n,r,s,...i){return this._sliceDateSpan({range:{start:e,end:st(e,1)},allDay:!1},n,r,{},s,...i)}_sliceBusinessHours(e,n,r,s,...i){return e?this._sliceEventStore(ot(e,bn(n,!!r),s),{},n,r,...i).bg:[]}_sliceEventStore(e,n,r,s,...i){if(e){let a=Ri(e,n,bn(r,!!s),s);return{bg:this.sliceEventRanges(a.bg,i),fg:this.sliceEventRanges(a.fg,i)}}return{bg:[],fg:[]}}_sliceInteraction(e,n,r,s,...i){if(!e)return null;let a=Ri(e.mutatedEvents,n,bn(r,!!s),s);return{segs:this.sliceEventRanges(a.fg,i),affectedInstances:e.affectedEvents.instances,isEvent:e.isEvent}}_sliceDateSpan(e,n,r,s,i,...a){if(!e)return[];let o=bn(n,!!r),l=Xt(e.range,o);if(l){e={...e,range:l};let c=dm(e,s,i),u=this.sliceRange(e.range,...a);for(let f of u)f.eventRange=c;return u}return[]}sliceEventRanges(e,n){let r=[];for(let s of e)r.push(...this.sliceEventRange(s,n));return r}sliceEventRange(e,n){let r=e.range;this.forceDayIfListItem&&e.ui.display==="list-item"&&(r={start:r.start,end:fe(r.start,1)});let s=this.sliceRange(r,...n);for(let i of s)i.eventRange=e,i.isStart=e.isStart&&i.isStart,i.isEnd=e.isEnd&&i.isEnd;return s}}function bn(t,e){let n=t.activeRange;return e?n:{start:st(n.start,t.slotMinTime.milliseconds),end:st(n.end,t.slotMaxTime.milliseconds-864e5)}}class Zv extends Gv{constructor(){super(...arguments),this.forceDayIfListItem=!0}sliceRange(e,n){return n.sliceRange(e)}}const qv=new Date(2592e5);function Xv(t,e,n,r,s,i){const a=Kv(t,e,n,r,s,i),o=Sl(n,i.dateEnv);if(e&&o!=="day")for(const l of a.dataConfigs)wl(l.dateMarker,o,i.dateEnv)&&(l.renderProps.isMajor=!0);return[a]}function Kv(t,e,n,r,s,i,a,o){return{isDateRow:!0,renderConfig:Qv(s,e,i),dataConfigs:Jv(t,e,n,r,s,i,a,void 0,void 0,void 0,void 0,o)}}function Qv(t,e,n){const{options:r}=n;return{generatorName:"dayHeaderContent",customGenerator:r.dayHeaderContent,classNameGenerator:r.dayHeaderClass,innerClassNameGenerator:r.dayHeaderInnerClass,didMount:r.dayHeaderDidMount,willUnmount:r.dayHeaderWillUnmount,align:r.dayHeaderAlign,sticky:r._dayHeaderSticky,dayHeaderFormat:t,datesRepDistinctDays:e}}const Hl=[];for(let t=0;t<7;t++)Hl.push(fe(new Date(2592e5),t));function Jv(t,e,n,r,s,i,a=1,o="",l={},c={},u="",f){const{dateEnv:h,viewApi:g,options:v}=i;return e?t.map((m,E)=>{const C=Hs(m,h,n,r),R=f!=null,x=v.navLinks&&!C.isDisabled&&t.length>1,T={...C,...l,isMajor:R,isSticky:!1,inPopover:!1,hasNavLink:x,view:g},M=sr(i,m);return{key:o+m.toUTCString(),dateMarker:m,renderProps:T,attrs:{"aria-label":M,...C.isToday?{"aria-current":"date"}:{},"data-date":ys(m),...c},innerAttrs:x?js(i,m,void 0,M):{"aria-hidden":!0},colSpan:a,hasNavLink:x,className:u}}):t.map((m,E)=>{const C=m.getUTCDay(),R=fe(qv,C),x={date:h.toDate(m),dow:C,isDisabled:!1,isFuture:!1,isPast:!1,isToday:!1,isOther:!1},T=f!=null,M={...x,date:Hl[C],isMajor:T,isSticky:!1,inPopover:!1,hasNavLink:!1,view:g,...l},D=ye(h.formatToParts(R,Nv));return{key:o+String(C),dateMarker:m,renderProps:M,attrs:{"aria-label":D,...c},innerAttrs:{"aria-hidden":!0},colSpan:a,className:u}})}class xt{constructor(e,n=!1){this.masterCallback=e,this.ignoreDeletes=n,this.rev="",this.current=new Map,this.callbacks=new Map,this.handleValue=(r,s)=>{let{current:i,callbacks:a}=this;r===null?this.ignoreDeletes||(i.delete(s),a.delete(s)):i.set(s,r),this.rev=_e(),this.masterCallback&&this.masterCallback(r,s)}}createRef(e){let n=this.callbacks.get(e);return n||(n=r=>{this.handleValue(r,e)},this.callbacks.set(e,n)),n}}class Ol extends ee{constructor(){super(...arguments),this.elRef=S.createRef()}render(){return d.jsx("div",{ref:this.elRef})}componentDidMount(){this._isUnmounting=!1;const{props:e}=this,n=this.elRef.current;this.disconnectWidth=Il(n,r=>{this._isUnmounting||G(e.widthRef,r)})}componentWillUnmount(){this._isUnmounting=!0,this.disconnectWidth();const{props:e}=this;e.widthRef&&G(e.widthRef,null)}}function Je(t){return gm(t)+":"+t.start+(t.standinFor?":standin":t.isSlice?":slice":"")}function Cn(t,e){const n=[];for(let r=0;r<e;r++)n[r]=[];for(const r of t)n[r.row].push(r);return n}function Yi(t,e){const n=[];if(t){for(let r=0;r<e;r++)n[r]={affectedInstances:t.affectedInstances,isEvent:t.isEvent,segs:[]};for(const r of t.segs)n[r.row].segs.push(r)}else for(let r=0;r<e;r++)n[r]=null;return n}function Gi(t,e){return{...t,start:e,end:e+1,isStart:t.isStart&&t.start===e,isEnd:t.isEnd&&t.end-1===e,standinFor:t}}class ey extends ee{constructor(){super(...arguments),this.buildPublicEvent=B((e,n,r)=>new K(e,n,r)),this.handleEl=e=>{this.el=e,e&&On(e,this.props.eventRange)}}render(){const{props:e,context:n}=this,{eventRange:r}=e,{options:s}=n,i=r.ui,a=this.buildPublicEvent(n,r.def,r.instance),o={event:a,isNarrow:e.isNarrow||!1,isShort:e.isShort||!1},l={event:a,view:n.viewApi,timeText:"",color:i.color||s.backgroundEventColor,contrastColor:i.contrastColor,isDraggable:!1,isStartResizable:!1,isEndResizable:!1,isMirror:!1,isStart:e.isStart,isEnd:e.isEnd,isFirst:!1,isLast:!1,isPast:e.isPast,isFuture:e.isFuture,isToday:e.isToday,isSelected:!1,isDragging:!1,isResizing:!1,isInteractive:!1,level:0,isNarrow:e.isNarrow||!1,isShort:e.isShort||!1,timeClass:"",titleClass:k(s.backgroundEventTitleClass,o),options:{eventOverlap:!!s.eventOverlap}},c=O(i.className,y.fill,y.internalEvent,y.internalBgEvent,e.isVertical?y.flexCol:y.flexRow),u=O(k(s.backgroundEventInnerClass,l),y.liquid);return d.jsx(me,{tag:"div",className:c,style:{"--fc-event-color":l.color,"--fc-event-contrast-color":l.contrastColor},defaultGenerator:ty,elRef:this.handleEl,renderProps:l,generatorName:"backgroundEventContent",customGenerator:s.backgroundEventContent,classNameGenerator:s.backgroundEventClass,didMount:s.backgroundEventDidMount,willUnmount:s.backgroundEventWillUnmount,children:f=>d.jsx(f,{tag:"div",className:u})})}componentDidUpdate(e){this.el&&this.props.eventRange!==e.eventRange&&On(this.el,this.props.eventRange)}}function ty(t){let{title:e}=t.event;return e&&d.jsx("div",{className:t.titleClass,children:t.event.title})}function ny(t,e){return d.jsx("div",{className:O(t==="non-business"?e.nonBusinessHoursClass:t==="highlight"?e.highlightClass:void 0,y.fill)})}const xr=10,ry=1;class sy extends or{constructor(){super(...arguments),this.getDateMeta=B(Hs),this.closeRef=S.createRef(),this.focusStartRef=S.createRef(),this.focusEndRef=S.createRef(),this.handleRootEl=e=>{this.rootEl=e,e?this.context.registerInteractiveComponent(this,{el:e,useEventCenter:!1}):this.context.unregisterInteractiveComponent(this)},this.handleDocumentMouseDown=e=>{const n=Tl(e);this.rootEl.contains(n)||this.handleClose()},this.handleDocumentKeyDown=e=>{e.key==="Escape"&&this.handleClose()},this.handleClose=()=>{let{onClose:e}=this.props;e&&e()}}render(){let{props:e,context:n}=this,{options:r,dateEnv:s,viewApi:i}=n,{startDate:a,todayRange:o,dateProfile:l}=e,c=this.getDateMeta(a,s,l,o),u=s.formatToParts(a,r.popoverFormat),f=ye(u);const h={...c,isMajor:!1,isNarrow:!1,isSticky:!1,inPopover:!0,level:0,hasNavLink:!1,text:f,textParts:u,get weekdayText(){return Ln(u)},get dayNumberText(){return _n(u)},view:i},g={...c,isMajor:!1,isNarrow:!1,inPopover:!0,hasNavLink:!1,get weekdayText(){return Ln(u)},get dayNumberText(){return _n(u)},get monthText(){return Nl(u)},view:i,text:"",textParts:[],options:{businessHours:!!r.businessHours}},v=ys(a),{dayHeaderAlign:m}=r,E=typeof m=="function"?m({level:0,inPopover:!0,isNarrow:!1}):m,C=en(e.alignEl);return Yt.createPortal(d.jsxs("div",{"data-date":v,id:e.id,role:"dialog","aria-labelledby":e.titleId,className:O(r.popoverClass,y.flexCol,y.popoverZ,y.abs,y.borderBoxRoot,y.internalPopover),style:{top:0,left:0},dir:C?"rtl":void 0,"data-color-scheme":r.colorScheme||void 0,ref:this.handleRootEl,children:[d.jsx("div",{tabIndex:0,style:{outline:"none"},ref:this.focusStartRef}),d.jsxs("div",{className:O(k(r.dayHeaderClass,h),y.flexCol,y.borderOnlyB,E==="center"?y.alignCenter:E==="end"?y.alignEnd:y.alignStart),children:[d.jsx("div",{children:d.jsx(me,{tag:"div",attrs:{id:e.titleId},generatorName:"dayHeaderContent",renderProps:h,customGenerator:r.dayHeaderContent,defaultGenerator:iy,classNameGenerator:r.dayHeaderInnerClass,didMount:r.dayHeaderDidMount,willUnmount:r.dayHeaderWillUnmount})}),d.jsx(me,{tag:"button",attrs:{"aria-label":r.closeHint,...bs(this.handleClose)},elRef:this.closeRef,className:O(r.popoverCloseClass,y.flexRow,y.cursorPointer),renderProps:{},customGenerator:r.popoverCloseContent,generatorName:"popoverCloseContent"})]}),d.jsx("div",{className:O(k(r.dayCellClass,g),y.flexCol,y.borderNone),children:d.jsx("div",{className:k(r.dayCellInnerClass,g),children:e.children})}),d.jsx("div",{tabIndex:0,style:{outline:"none"},ref:this.focusEndRef})]}),Cl(e.alignEl))}queryHit(e,n,r,s,i){let{rootEl:a,props:o}=this;return n>=0&&n<s&&r>=0&&r<i?{dateProfile:o.dateProfile,dateSpan:{allDay:!o.forceTimed,range:{start:o.startDate,end:o.endDate},...o.dateSpanProps},getDayEl:()=>a,rect:{left:0,top:0,right:s,bottom:i},layer:1}:null}componentDidMount(){document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("keydown",this.handleDocumentKeyDown),this.focusStartRef.current.addEventListener("focus",this.handleClose),this.focusEndRef.current.addEventListener("focus",this.handleClose),this.closeRef.current.focus({preventScroll:!0}),this.updateSize()}componentWillUnmount(){document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("keydown",this.handleDocumentKeyDown),this.focusStartRef.current.removeEventListener("focus",this.handleClose),this.focusEndRef.current.removeEventListener("focus",this.handleClose)}updateSize(){let{alignEl:e,alignParentTop:n}=this.props,{rootEl:r}=this;const s=en(e),i=$v(e);if(i){let a=r.getBoundingClientRect(),o=n?e.closest(n).getBoundingClientRect().top-ry:i.top,l=s?i.right-a.width:i.left;o=Math.max(o,xr),l=Math.min(l,document.documentElement.clientWidth-xr-a.width),l=Math.max(l,xr);const{offsetParent:c}=r;let u,f;if(!c||c===document.body)u=o+window.scrollY,f=l+window.scrollX;else{const h=c.getBoundingClientRect();u=o-h.top+c.scrollTop,f=l-h.left+c.scrollLeft}xn(r,{top:u,left:f})}}}function iy(t){return t.text}function Zi(t,e){const n=Math.max(t.start,e.start),r=Math.min(t.end,e.end);if(n<r)return{start:n,end:r,isStart:t.isStart&&n===t.start,isEnd:t.isEnd&&r===t.end}}function qi(t){return t.end}function ay(t){return t.reduce(ly).eventRange.range.start}function oy(t){return t.reduce(cy).eventRange.range.end}function ly(t,e){return t.eventRange.range.start<e.eventRange.range.start?t:e}function cy(t,e){return t.eventRange.range.end>e.eventRange.range.end?t:e}class dy extends ee{constructor(){super(...arguments),this.state={isPopoverOpen:!1},this.handleLinkEl=e=>{this.linkEl=e,this.props.elRef&&G(this.props.elRef,e)},this.handleClick=e=>{let{props:n,context:r}=this,{dateEnv:s,options:i}=r,{moreLinkClick:a}=i,o=Xi(n).start;function l(c){let{def:u,instance:f,range:h}=c.eventRange;return{event:new K(r,u,f),start:s.toDate(h.start),end:s.toDate(h.end),isStart:c.isStart,isEnd:c.isEnd}}typeof a=="function"&&(a=a({date:s.toDate(o),allDay:!!n.allDayDate,allSegs:n.segs.map(l),hiddenSegs:n.hiddenSegs.map(l),jsEvent:e,view:r.viewApi})),!a||a==="popover"?this.setState({isPopoverOpen:!0}):typeof a=="string"&&r.calendarApi.zoomTo(o,a)},this.handlePopoverClose=()=>{this.linkEl&&this.linkEl.focus(),this.setState({isPopoverOpen:!1})}}render(){let{props:e,state:n}=this;return d.jsx(At.Consumer,{children:r=>{let{viewApi:s,options:i,calendarApi:a,baseId:o}=r,{moreLinkText:l}=i,c=e.hiddenSegs.length,u=Xi(e),f=o+"popover-"+u.start.toISOString(),h=`+${c}`,g=typeof l=="function"?l.call(a,c):`${h} ${l}`,v=we(i.moreLinkHint,[c],g),m={num:c,numericText:h,longText:g,text:e.isMicro||e.display==="column"?h:g,isNarrow:e.isNarrow,view:s};return d.jsxs(d.Fragment,{children:[!!c&&d.jsx(me,{tag:"div",elRef:this.handleLinkEl,className:O(k(e.display==="row"?i.rowMoreLinkClass:i.columnMoreLinkClass,m),e.className,e.display==="row"?y.flexRow:y.flexCol,y.internalMoreLink,y.cursorPointer),style:e.style,attrs:{...e.attrs,...bs(this.handleClick),title:v,role:"button","aria-haspopup":"dialog","aria-expanded":n.isPopoverOpen,"aria-controls":n.isPopoverOpen?f:void 0},renderProps:m,generatorName:"moreLinkContent",customGenerator:i.moreLinkContent,defaultGenerator:uy,classNameGenerator:i.moreLinkClass,didMount:i.moreLinkDidMount,willUnmount:i.moreLinkWillUnmount,children:E=>d.jsx(E,{tag:"div",className:O(k(i.moreLinkInnerClass,m),k(e.display==="row"?i.rowMoreLinkInnerClass:i.columnMoreLinkInnerClass,m),e.display==="row"?y.stickyS:y.stickyT)})}),n.isPopoverOpen&&d.jsx(sy,{id:f,titleId:f+"-title",startDate:u.start,endDate:u.end,dateProfile:e.dateProfile,todayRange:e.todayRange,dateSpanProps:e.dateSpanProps,alignEl:e.alignElRef?e.alignElRef.current:this.linkEl,alignParentTop:e.alignParentTop,forceTimed:e.forceTimed,onClose:this.handlePopoverClose,children:e.popoverContent()})]})}})}}function uy(t){return t.text}function Xi(t){return t.allDayDate?{start:t.allDayDate,end:fe(t.allDayDate,1)}:{start:ay(t.hiddenSegs),end:oy(t.hiddenSegs)}}const Al=J({hour:"numeric",minute:"2-digit",omitZeroMinute:!0,meridiem:"narrow"});function Ll(t){let{display:e}=t.eventRange.ui;return e==="list-item"||e==="auto"&&!t.eventRange.def.allDay&&t.end-t.start===1&&t.isStart&&t.isEnd}class fy extends ee{render(){let{props:e}=this;return d.jsx(dy,{display:"row",className:e.className,isNarrow:e.isNarrow,isMicro:e.isMicro,dateProfile:e.dateProfile,todayRange:e.todayRange,allDayDate:e.allDayDate,segs:e.segs,hiddenSegs:e.hiddenSegs,alignElRef:e.alignElRef,alignParentTop:e.alignParentTop,dateSpanProps:e.dateSpanProps,popoverContent:()=>d.jsx(d.Fragment,{children:e.segs.map(n=>{let{eventRange:r}=n,{instanceId:s}=r.instance,i=!!(e.eventDrag&&e.eventDrag.affectedInstances[s]),a=!!(e.eventResize&&e.eventResize.affectedInstances[s]),o=i||a;return d.jsx("div",{style:{visibility:o?"hidden":void 0},children:d.jsx(Os,{display:Ll(n)?"list-item":"row",eventRange:r,isStart:n.isStart,isEnd:n.isEnd,isDragging:i,isResizing:a,isMirror:!1,isSelected:s===e.eventSelection,defaultTimeFormat:Al,defaultDisplayEventEnd:!1,...Ur(r,e.todayRange)})},s)})})})}}class hy extends or{constructor(){super(...arguments),this.getDateMeta=B(Hs),this.refineRenderProps=zt(py),this.rootElRef=S.createRef(),this.handleBodyEl=e=>{this.disconnectBodyHeight&&(this.disconnectBodyHeight(),this.disconnectBodyHeight=void 0,G(this.props.headerHeightRef,null),G(this.props.mainHeightRef,null)),e&&(this.disconnectBodyHeight=ir(e,(n,r)=>{if(this._isUnmounting)return;const{props:s}=this,i=e.getBoundingClientRect(),a=this.rootElRef.current.getBoundingClientRect(),o=i.top-a.top;Vr(this.headerHeight,o)||(this.headerHeight=o,G(s.headerHeightRef,o)),s.fgLiquidHeight&&G(s.mainHeightRef,r)}))}}render(){let{props:e,context:n}=this,{options:r,dateEnv:s}=n;const i=e.showDayNumber&&my(e.date,e.dateProfile.currentRange,s),a=this.getDateMeta(e.date,s,e.dateProfile,e.todayRange),o=O(e.borderStart?y.borderOnlyS:y.borderNone,e.width!=null?"":y.liquid,y.flexCol,y.noMargin,y.noPadding),l=r.navLinks,c=this.refineRenderProps({date:e.date,isMajor:e.isMajor,isNarrow:e.isNarrow,dateMeta:a,hasLabel:e.showDayNumber,hasMonthLabel:i,hasNavLink:l,renderProps:e.renderProps,viewApi:n.viewApi,dateEnv:n.dateEnv,monthStartFormat:r.monthStartFormat,dayCellFormat:r.dayCellFormat,businessHours:!!r.businessHours});if(a.isDisabled)return d.jsx("div",{role:"gridcell","aria-disabled":!0,className:O(k(r.dayCellClass,c),e.className,o),style:{width:e.width}});const u=sr(n,e.date);return d.jsx(me,{tag:"div",elRef:this.rootElRef,className:O(e.className,o),attrs:{...e.attrs,role:"gridcell","aria-label":u,...c.isToday?{"aria-current":"date"}:{},"data-date":ys(e.date)},style:{width:e.width},renderProps:c,generatorName:"dayCellTopContent",customGenerator:r.dayCellTopContent,defaultGenerator:gy,classNameGenerator:r.dayCellClass,didMount:r.dayCellDidMount,willUnmount:r.dayCellWillUnmount,children:f=>d.jsxs(d.Fragment,{children:[d.jsx("div",{className:O(y.rel,k(r.dayCellTopClass,c)),children:e.showDayNumber&&d.jsx(f,{tag:"div",attrs:l?js(n,e.date,void 0,u):{"aria-hidden":!0},className:k(r.dayCellTopInnerClass,c)})}),d.jsxs("div",{className:O(y.flexCol,e.fgLiquidHeight?y.liquid:y.grow),ref:this.handleBodyEl,children:[d.jsx("div",{className:k(r.dayCellInnerClass,c),style:{minHeight:e.fgHeight},children:e.fg}),d.jsx(fy,{className:y.rel,allDayDate:e.date,segs:e.segs,hiddenSegs:e.hiddenSegs,alignElRef:this.rootElRef,alignParentTop:e.showDayNumber?"[role=row]":`.${y.internalView}`,dateSpanProps:e.dateSpanProps,dateProfile:e.dateProfile,eventSelection:e.eventSelection,eventDrag:e.eventDrag,eventResize:e.eventResize,todayRange:e.todayRange,isNarrow:e.isNarrow,isMicro:e.isMicro})]}),d.jsx("div",{className:O(y.rel,k(r.dayCellBottomClass,c))})]})})}componentDidMount(){this._isUnmounting=!1}componentWillUnmount(){this._isUnmounting=!0}}function gy(t){return t.text||d.jsx(d.Fragment,{children:" "})}function my(t,e,n){const{start:r,end:s}=e,i=st(s,-1),a=n.getYear(r),o=n.getMonth(r),l=n.getYear(i),c=n.getMonth(i);return!(a===l&&o===c)&&(t.valueOf()===r.valueOf()||n.getDay(t)===1&&t.valueOf()<s.valueOf())}function py(t){let{date:e,dateEnv:n,hasLabel:r,hasMonthLabel:s,hasNavLink:i,businessHours:a}=t,o=[],l="";return r&&(o=n.formatToParts(e,s?t.monthStartFormat:t.dayCellFormat),l=ye(o)),{...t.dateMeta,...t.renderProps,text:l,textParts:o,isMajor:t.isMajor,isNarrow:t.isNarrow,inPopover:!1,hasNavLink:i,get weekdayText(){return Ln(o)},get dayNumberText(){return _n(o)},get monthText(){return Nl(o)},options:{businessHours:a},view:t.viewApi}}class Ki{constructor(e,n=l=>1,r=!1,s,i,a=!1,o=!1){this.getSegThickness=n,this.strictOrder=r,this.maxCoord=s,this.maxDepth=i,this.hiddenConsumes=a,this.allowSlicing=o,this.placementsByLevel=[],this.levelCoords=[],this.hiddenSegs=[];for(const l of e)this.insertSeg(l,this.getSegThickness(l))}insertSeg(e,n,r){if(n!=null){const s=this.findInsertion(e,n);if(this.isInsertionValid(s,n))this.insertSegAt(e,s,n,r);else{const{touchingPlacement:i}=s;if(i){if(this.hiddenConsumes&&!i.isZombie&&(i.isZombie=!0,this.hiddenSegs.push(i),this.allowSlicing)){const a=Object.assign({},i);Object.assign(i,Zi(i,e)),i.isSlice=!0,this.splitSeg(a,i.thickness,i)}this.allowSlicing?(this.hiddenSegs.push({...e,...Zi(e,i)}),this.splitSeg(e,n,i)):this.hiddenSegs.push(e)}else this.hiddenSegs.push(e)}}}isInsertionValid(e,n){return(this.maxCoord==null||e.levelCoord+n<=this.maxCoord)&&(this.maxDepth==null||e.depth<this.maxDepth)}splitSeg(e,n,r){e.start<r.start&&this.insertSeg({...e,end:r.start,isEnd:!1},n,!0),e.end>r.end&&this.insertSeg({...e,start:r.end,isStart:!1},n,!0)}insertSegAt(e,n,r,s){const i={...e,thickness:r,depth:n.depth,isSlice:s||e.isSlice||!1,isZombie:!1};n.lateralIndex===-1?(Cr(this.placementsByLevel,n.levelIndex,[i]),Cr(this.levelCoords,n.levelIndex,n.levelCoord)):Cr(this.placementsByLevel[n.levelIndex],n.lateralIndex,i)}findInsertion(e,n){let{placementsByLevel:r,levelCoords:s}=this,i=r.length,a=0,o,l,c=0;for(let h=0;h<i;h+=1){const g=s[h];if(!this.strictOrder&&g>=a+n)break;let v=r[h],m,[E,C]=Qi(v,e.start,qi),R=E+C;for(;(m=v[R])&&m.start<e.end;){let x=g+m.thickness;x>a&&(a=x,o=m,l=h),x===a&&(c=Math.max(c,m.depth+1)),R+=1}}let u=0;if(o)for(u=l+1;u<i&&s[u]<a;)u+=1;let f=-1;return u<i&&s[u]===a&&([f]=Qi(r[u],e.end,qi)),{touchingPlacement:o,levelCoord:a,levelIndex:u,lateralIndex:f,depth:c}}traverseSegs(e){const{placementsByLevel:n,levelCoords:r}=this;for(let s=0;s<n.length;s++){const i=n[s],a=r[s];for(const o of i)o.isZombie||e(o,a)}}}function Cr(t,e,n){t.splice(e,0,n)}function Qi(t,e,n){let r=0,s=t.length;if(!s||e<n(t[r]))return[0,0];if(e>n(t[s-1]))return[s,0];for(;r<s;){let i=Math.floor(r+(s-r)/2),a=n(t[i]);if(e<a)s=i;else if(e>a)r=i+1;else return[i,1]}return[r,0]}function vy(t,e,n,r,s,i=!0,a,o){let l,c,u;a===!0||o===!0?(l=r,u=!0):typeof a=="number"?(c=a,u=!1):typeof o=="number"&&(c=o,u=!0);const f=new Map,h=new Map,g=new Map,v=new Map;let m=new Ki(t,T=>e.get(Je(T)),s,l,c,u,i);m.traverseSegs((T,M)=>{Tr(f,T),g.set(Je(T),M),T.isSlice&&v.set(T.eventRange,!0)});for(const T of m.hiddenSegs)Tr(h,T);if(v.size){g.clear(),m=new Ki(yy(t,f),T=>e.get(Je(T)),s,l,c,u),m.traverseSegs((T,M)=>{g.set(Je(T),M)});for(const T of m.hiddenSegs)Tr(h,T)}const E=[],C=[],R=[],x=[];for(let T=0;T<n.length;T++)E.push([]),C.push([]),R.push([]),x.push(0);for(const T of t){const{eventRange:M}=T,D=f.get(M)||[],N=h.get(M)||[],P=v.get(M)||!1;if(R[T.start].push(T),P)for(const H of D)R[H.start].push(H);for(const H of D){for(let W=H.start;W<H.end;W++){const V=Gi(H,W);E[W].push(V)}const U=Je(H),te=g.get(U);if(te!=null){const W=e.get(U);for(let V=H.start;V<H.end;V++)x[V]=Math.max(x[V],te+W)}}for(const H of N)for(let U=H.start;U<H.end;U++){const te=Gi(H,U);E[U].push(te),C[U].push(te)}}return[E,C,R,g,x]}function Tr(t,e){let n=t.get(e.eventRange);n||t.set(e.eventRange,n=[]),n.push(e)}function yy(t,e){const n=[];for(const r of t)n.push(...e.get(r.eventRange)||[]);return n}class by{constructor(e,n){let r=e.start,{end:s}=e,i=[],a=[],o=-1;for(;r<s;)n.isHiddenDay(r)?i.push(o+.5):(o+=1,i.push(o),a.push(r)),r=fe(r,1);this.dates=a,this.indices=i,this.cnt=a.length}sliceRange(e){let n=this.getDateDayIndex(e.start),r=this.getDateDayIndex(fe(e.end,-1)),s=Math.max(0,n),i=Math.min(this.cnt-1,r);return s=Math.ceil(s),i=Math.floor(i),s<=i?{start:s,end:i+1,isStart:n===s,isEnd:r===i}:null}getDateDayIndex(e){let{indices:n}=this,r=Math.floor(Ht(this.dates[0],e));return r<0?n[0]-1:r>=n.length?n[n.length-1]+1:n[r]}}class Ey{constructor(e,n,r,s=""){this.dateEnv=r,this.majorUnit=s;let{dates:i}=e,a,o,l;if(n){for(o=i[0].getUTCDay(),a=1;a<i.length&&i[a].getUTCDay()!==o;a+=1);l=Math.ceil(i.length/a)}else l=1,a=i.length;this.rowCount=l,this.colCount=a,this.daySeries=e,this.cellRows=this.buildCells(),this.headerDates=this.buildHeaderDates()}buildCells(){let e=[];for(let n=0;n<this.rowCount;n+=1){let r=[];for(let s=0;s<this.colCount;s+=1)r.push(this.buildCell(n,s));e.push(r)}return e}buildCell(e,n){let r=this.daySeries.dates[e*this.colCount+n];return{key:r.toISOString(),date:r,isMajor:this.cellIsMajor(r)}}cellIsMajor(e){return this.majorUnit?wl(e,this.majorUnit,this.dateEnv):!1}buildHeaderDates(){let e=[];for(let n=0;n<this.colCount;n+=1)e.push(this.cellRows[0][n].date);return e}sliceRange(e){let{colCount:n}=this,r=this.daySeries.sliceRange(e),s=[];if(r){const{start:i,end:a}=r;let o=i;for(;o<a;){let l=Math.floor(o/n),c=Math.min((l+1)*n,a);s.push({row:l,start:o%n,end:(c-1)%n+1,isStart:r.isStart&&o===i,isEnd:r.isEnd&&c===a}),o=c}}return s}}function Sy(t,e,n){const r=new by(t.renderRange,e),s=/year|month|week/.test(t.currentRangeUnit),i=!s&&Sl(t,n);return new Ey(r,s,n,i!=="day"?i:void 0)}function wy(t,e,n){return n==null?[void 0,void 0]:n/t<e?[e*t,e]:[n,void 0]}function Dy(t,e,n){let r=0;for(const s of e){const i=s[0].key,a=s[0].date,o=s[s.length-1].date;if(t>=a&&t<=o)return r;const l=n.get(i);if(l==null)return;r+=l}return r}function Ji(t,e,n){let r,s;if(e!=null)r=t.start*e,s=(n-t.end)*e;else{const i=1/n;r=vi(t.start*i),s=vi(1-t.end*i)}return{insetInlineStart:r,insetInlineEnd:s}}function xy(t,e,n,r,s){const i=n??e/r,a=Math.floor(t/i),o=s?r-a-1:a,l=a*i,c=l+i;return{col:o,left:l,right:c}}function Cy(t,e,n){let r=0,s=0,i=0;for(const a of e){const o=a[0].key;if(s=i,i=s+n.get(o),t<i)break;r++}return{row:r,top:s,bottom:i}}function Ty(t,e){return t.querySelectorAll("[role=row]")[e]}function Ry(t,e){return t.querySelectorAll("[role=gridcell]")[e]}const _l=60,Ny=J({weekday:"narrow"});function My(t,e,n){return t||Iy(e,n)}function Iy(t,e){return t?e>1?J({weekday:"short",weekdayJustify:"start",day:"numeric",omitCommas:!0,omitTrailing:!0}):J({weekday:"long",weekdayJustify:"start",day:"numeric",omitCommas:!0,omitTrailing:!0}):J({weekday:"short"})}class ky extends S.Component{constructor(){super(...arguments),this.rootElRef=S.createRef()}render(){const{props:e}=this;return d.jsx("div",{className:O(e.className,y.abs),style:e.style,ref:this.rootElRef,children:e.children})}componentDidMount(){this._isUnmounting=!1;const e=this.rootElRef.current;this.disconnectHeight=ar(e,n=>{this._isUnmounting||G(this.props.heightRef,n)})}componentWillUnmount(){this._isUnmounting=!0,this.disconnectHeight(),G(this.props.heightRef,null)}}const Py=J({week:"narrow"});class jy extends ee{constructor(){super(...arguments),this.headerHeightRefMap=new xt(()=>{$t(this.handleSegPositioning)}),this.mainHeightRefMap=new xt(()=>{(this.props.dayMaxEvents===!0||this.props.dayMaxEventRows===!0)&&$t(this.handleSegPositioning)}),this.segHeightRefMap=new xt(()=>{$t(this.handleSegPositioning)}),this.buildWeekNumberRenderProps=B(Hy),this.handleRootEl=e=>{this.rootEl=e,G(this.props.rootElRef,e)},this.handleSegPositioning=()=>{this._isUnmounting||this.forceUpdate()}}render(){const{props:e,context:n,headerHeightRefMap:r,mainHeightRefMap:s}=this,{cells:i}=e,{options:a}=n,o=e.cells[0].date,l=e.dayMaxEvents===!0||e.dayMaxEventRows===!0,c=mm(e.fgEventSegs,a.eventOrder),[u,f]=this.computeFgDims(),[h,g,v,m,E]=vy(c,this.segHeightRefMap.current,i,l?f:void 0,a.eventOrderStrict,a.eventSlicing,e.dayMaxEvents,e.dayMaxEventRows),C=[];if(u!=null){let N=0;for(const P of i){const H=r.current.get(P.key);if(H!=null){const U=u-H;C.push(E[N]+U)}else C.push(void 0);N++}}const R=this.getHighlightSegs(),x=this.getMirrorSegs(),T=a.navLinks,M=sr(n,o,"week"),D=this.buildWeekNumberRenderProps(o,n,e.cellIsNarrow,T);return d.jsxs("div",{role:e.role,"aria-label":e.role==="row"?M:void 0,className:O(a.dayRowClass,e.className,y.flexRow,y.rel,y.isolate,e.forPrint&&e.basis!==void 0&&y.printSiblingRow),style:{flexBasis:e.basis},ref:this.handleRootEl,children:[e.showWeekNumbers&&!e.cellIsMicro&&d.jsx(me,{tag:"div",attrs:{...T?js(n,o,"week",M,!1):{},role:void 0,"aria-hidden":!0},className:y.z1,renderProps:D,generatorName:"inlineWeekNumberContent",customGenerator:a.inlineWeekNumberContent,defaultGenerator:vl,classNameGenerator:a.inlineWeekNumberClass,didMount:a.inlineWeekNumberDidMount,willUnmount:a.inlineWeekNumberWillUnmount}),this.renderFillSegs(e.businessHourSegs,"non-business"),this.renderFillSegs(e.bgEventSegs,"bg-event"),this.renderFillSegs(R,"highlight"),e.cells.map((N,P)=>{const H=this.renderFgSegs(u,v[P],m,e.todayRange,!1);return d.jsx(hy,{dateProfile:e.dateProfile,todayRange:e.todayRange,date:N.date,isMajor:N.isMajor,showDayNumber:e.showDayNumbers,isNarrow:e.cellIsNarrow,isMicro:e.cellIsMicro,borderStart:!!P,segs:h[P],hiddenSegs:g[P],fgLiquidHeight:l,fg:d.jsx(d.Fragment,{children:H}),eventDrag:e.eventDrag,eventResize:e.eventResize,eventSelection:e.eventSelection,renderProps:N.renderProps,dateSpanProps:N.dateSpanProps,attrs:N.attrs,className:N.className,fgHeight:C[P],width:e.colWidth,headerHeightRef:r.createRef(N.key),mainHeightRef:s.createRef(N.key)},N.key)}),this.renderFgSegs(u,x,m,e.todayRange,!0)]})}renderFgSegs(e,n,r,s,i){const{props:a,segHeightRefMap:o}=this,{colWidth:l,eventSelection:c,cellIsMicro:u}=a,f=a.cells.length,h=a.cells.length===1,g=[];for(const v of n){const m=Je(v),{standinFor:E,eventRange:C}=v,{instanceId:R}=C.instance;if(E)continue;const{insetInlineStart:x,insetInlineEnd:T}=Ji(v,l,f),M=r.get(E?Je(E):m)??(i?0:void 0),D=e!=null&&M!=null?e+M:void 0,N=!!(a.eventDrag&&a.eventDrag.affectedInstances[R]),P=!!(a.eventResize&&a.eventResize.affectedInstances[R]),H=!i&&(N||P||E||D==null),U=Ll(v),te=R===c;g.push(d.jsx(ky,{className:v.start?y.fakeBorderS:"",style:{visibility:H?"hidden":void 0,top:D,insetInlineStart:x,insetInlineEnd:T,zIndex:te?1e3:0},heightRef:!E&&!i?o.createRef(m):null,children:d.jsx(Os,{display:U?"list-item":"row",eventRange:C,isStart:v.isStart,isEnd:v.isEnd,isDragging:N,isResizing:P,isMirror:i,isSelected:te,isNarrow:a.cellIsNarrow,defaultTimeFormat:Al,defaultDisplayEventEnd:h,disableResizing:U,forcedTimeText:u?"":void 0,...Ur(C,s)})},m))}return g}renderFillSegs(e,n){const{props:r,context:s}=this,{todayRange:i,colWidth:a}=r,o=r.cells.length,l=[];for(const c of e){const u=c.start+":"+c.end,{insetInlineStart:f,insetInlineEnd:h}=Ji(c,a,o),g=!c.standinFor;l.push(d.jsx("div",{className:y.fillY,style:{visibility:g?"":"hidden",insetInlineStart:f,insetInlineEnd:h},children:n==="bg-event"?d.jsx(ey,{eventRange:c.eventRange,isStart:c.isStart,isEnd:c.isEnd,isNarrow:r.cellIsNarrow,isVertical:!1,...Ur(c.eventRange,i)}):ny(n,s.options)},u))}return d.jsx(d.Fragment,{children:l})}componentDidMount(){this._isUnmounting=!1;const{rootEl:e}=this;this.disconnectHeight=ar(e,n=>{G(this.props.heightRef,n)})}componentWillUnmount(){this._isUnmounting=!0,this.disconnectHeight(),G(this.props.heightRef,null)}computeFgDims(){const{cells:e}=this.props,n=this.headerHeightRefMap.current,r=this.mainHeightRefMap.current;let s,i;for(const a of e){const o=n.get(a.key),l=r.get(a.key);if(o!=null&&((s===void 0||o>s)&&(s=o),l!=null)){const c=o+l;(i===void 0||c<i)&&(i=c)}}return[s,i!=null&&s!=null?i-s:void 0]}getMirrorSegs(){let{props:e}=this;return e.eventResize&&e.eventResize.segs.length?e.eventResize.segs:[]}getHighlightSegs(){let{props:e}=this;return e.eventDrag&&e.eventDrag.segs.length?e.eventDrag.segs:e.eventResize&&e.eventResize.segs.length?e.eventResize.segs:e.dateSelectionSegs}}function Hy(t,e,n,r){const{dateEnv:s,options:i}=e,a=s.computeWeekNumber(t),o=s.formatToParts(t,i.weekNumberFormat||Py),l=ye(o),c=s.toDate(t);return{num:a,text:l,textParts:o,date:c,isNarrow:n,hasNavLink:r}}class Ul extends or{constructor(){super(...arguments),this.splitBusinessHourSegs=B(Cn),this.splitBgEventSegs=B(Ay),this.splitFgEventSegs=B(Cn),this.splitDateSelectionSegs=B(Cn),this.splitEventDrag=B(Yi),this.splitEventResize=B(Yi),this.rowHeightRefMap=new xt((e,n)=>{const{rowHeightRefMap:r}=this.props;r&&r.handleValue(e,n)}),this.handleRootEl=e=>{this.rootEl=e,e?this.context.registerInteractiveComponent(this,{el:e,isHitComboAllowed:this.props.isHitComboAllowed}):this.context.unregisterInteractiveComponent(this)}}render(){let{props:e,context:n,rowHeightRefMap:r}=this,{options:s}=n,{cellRows:i}=e,a=i.length,o=i[0]?.[0]?.key||"",l=this.splitFgEventSegs(e.fgEventSegs,a),c=this.splitBgEventSegs(e.bgEventSegs,a),u=this.splitBusinessHourSegs(e.businessHourSegs,a),f=this.splitDateSelectionSegs(e.dateSelectionSegs,a),h=this.splitEventDrag(e.eventDrag,a),g=this.splitEventResize(e.eventResize,a),v=Ye(s),m=!e.forPrint&&!v,E=Ly(e.visibleWidth,a,v,s);return d.jsx("div",{role:"rowgroup",className:O(e.className,!e.forPrint&&y.flexCol),style:{width:e.width},ref:this.handleRootEl,children:i.map((C,R)=>d.jsx(jy,{role:"row",dateProfile:e.dateProfile,todayRange:e.todayRange,cells:C,cellIsNarrow:e.cellIsNarrow,cellIsMicro:e.cellIsMicro,showDayNumbers:a>1,showWeekNumbers:a>1&&s.weekNumbers,forPrint:e.forPrint,className:O(m&&y.grow,a>1&&y.breakInsideAvoid,R<a-1?y.borderOnlyB:y.borderNone),fgEventSegs:l[R],bgEventSegs:c[R],businessHourSegs:u[R],dateSelectionSegs:f[R],eventSelection:e.eventSelection,eventDrag:h[R],eventResize:g[R],dayMaxEvents:e.dayMaxEvents,dayMaxEventRows:e.dayMaxEventRows,colWidth:e.colWidth,basis:E,heightRef:r.createRef(C[0].key)},o+":"+C[0].key))})}queryHit(e,n,r,s){const{props:i}=this,a=i.cellRows[0].length,{col:o,left:l,right:c}=xy(n,s,i.colWidth,a,e),{row:u,top:f,bottom:h}=Cy(r,i.cellRows,this.rowHeightRefMap.current),g=i.cellRows[u][o],v=g.date,m=fe(v,1);return{dateProfile:i.dateProfile,dateSpan:{range:{start:v,end:m},allDay:!0,...g.dateSpanProps},getDayEl:()=>Ry(Ty(this.rootEl,u),o),rect:{left:l,right:c,top:f,bottom:h},layer:0}}}function Oy(t){return t.eventRange.def.allDay}function Ay(t,e){return Cn(t.filter(Oy),e)}function Ly(t,e,n,r){if(t!=null){const s=t/r.aspectRatio/6;return e>6||n?s:0}return 0}class _y extends ee{constructor(){super(...arguments),this.state={},this.buildDayHeaderText=B(Uy),this.handleInnerEl=e=>{this.disconnectSize&&(this.disconnectSize(),this.disconnectSize=void 0),e?this.disconnectSize=ir(e,(n,r)=>{this._isUnmounting||(G(this.props.innerHeightRef,r),this.setState({innerWidth:n}))}):G(this.props.innerHeightRef,null)}}render(){const{props:e,state:n,context:r}=this,{renderConfig:s,dataConfig:i}=e,a=e.colWidth!=null?e.colWidth*(i.colSpan||1):void 0,o=i.renderProps.isDisabled,l=s.dayHeaderFormat?this.buildDayHeaderRenderProps(i.renderProps,e.cellIsNarrow,e.rowLevel,e.cellIsMicro,i.dateMarker,s.dayHeaderFormat,!!s.datesRepDistinctDays,r.dateEnv):{...i.renderProps,isNarrow:e.cellIsNarrow,level:e.rowLevel},c=s.align,u=typeof c=="function"?c({level:e.rowLevel,inPopover:i.renderProps.inPopover,isNarrow:e.cellIsNarrow}):c,f=s.sticky,h=e.rowLevel>0&&f!==!1&&(u!=="center"||a!=null&&e.viewportWidth!=null&&a>e.viewportWidth*.75);let g;return h&&(u==="center"?n.innerWidth!=null&&(g=`calc(50% - ${n.innerWidth/2}px)`):g=typeof f=="number"||typeof f=="string"?f:0),d.jsx(me,{tag:"div",attrs:{role:"columnheader","aria-colspan":i.colSpan,...i.attrs},className:O(i.className,y.noMargin,y.noPadding,y.flexCol,e.borderStart?y.borderOnlyS:y.borderNone,u==="center"?y.alignCenter:u==="end"?y.alignEnd:y.alignStart,e.colWidth==null&&y.liquid,!h&&y.crop),style:{width:a},renderProps:l,generatorName:s.generatorName,customGenerator:s.customGenerator,defaultGenerator:vl,classNameGenerator:o?void 0:s.classNameGenerator,didMount:s.didMount,willUnmount:s.willUnmount,children:v=>d.jsx("div",{ref:this.handleInnerEl,className:O(y.flexCol,y.noShrink,y.whiteSpaceNoWrap,h&&y.sticky),style:{left:g,right:g},children:d.jsx(v,{tag:"div",attrs:i.innerAttrs,className:k(s.innerClassNameGenerator,l)})})})}componentDidMount(){this._isUnmounting=!1}componentWillUnmount(){this._isUnmounting=!0}buildDayHeaderRenderProps(e,n,r,s,i,a,o,l){const c=this.buildDayHeaderText(o?i:e.date,a,o,l),u=s?this.buildDayHeaderText(i,Ny,!1,l):c;return{...e,isNarrow:n,level:r,text:u.text,textParts:u.textParts,weekdayText:s?u.text:c.weekdayText,dayNumberText:c.dayNumberText}}}function Uy(t,e,n,r){const s=r.formatToParts(t,e);return{text:ye(s),textParts:s,weekdayText:Ln(s),dayNumberText:n?_n(s):""}}class Fy extends ee{constructor(){super(...arguments),this.innerHeightRefMap=new xt(()=>{$t(this.handleInnerHeights)}),this.handleInnerHeights=()=>{if(this._isUnmounting)return;const e=this.innerHeightRefMap.current;let n=0;for(const r of e.values())n=Math.max(n,r);this.currentInnerHeight!==n&&(this.currentInnerHeight=n,G(this.props.innerHeightRef,n))}}render(){const{props:e,context:n}=this,{options:r}=n;return d.jsx("div",{role:e.role,"aria-rowindex":e.rowIndex!=null?1+e.rowIndex:void 0,className:O(r.dayHeaderRowClass,e.className,y.flexRow,y.contentBox,e.borderBottom?y.borderOnlyB:y.borderNone),style:{height:e.height},children:e.dataConfigs.map((s,i)=>d.jsx(_y,{renderConfig:e.renderConfig,dataConfig:s,borderStart:!!i,colWidth:e.colWidth,viewportWidth:e.viewportWidth,innerHeightRef:this.innerHeightRefMap.createRef(s.key),cellIsNarrow:e.cellIsNarrow,cellIsMicro:e.cellIsMicro,rowLevel:e.rowLevel},s.key))})}componentDidMount(){this._isUnmounting=!1}componentWillUnmount(){this._isUnmounting=!0,this.currentInnerHeight=void 0,G(this.props.innerHeightRef,null)}}class Fl extends ee{render(){const{props:e}=this,{headerTiers:n}=e;return d.jsx("div",{role:"rowgroup",className:O(e.className,y.flexCol,e.width==null&&y.liquid),style:{width:e.width},children:n.map((r,s)=>S.createElement(Fy,{...r,key:s,role:"row",borderBottom:s<n.length-1,colWidth:e.colWidth,viewportWidth:e.viewportWidth,cellIsNarrow:e.cellIsNarrow,cellIsMicro:e.cellIsMicro,rowLevel:n.length-s-1}))})}}class By extends ee{constructor(){super(...arguments),this.state={},this.handleScroller=e=>{G(this.props.scrollerRef,e)},this.handleTotalWidth=e=>{this._isUnmounting||this.setState({totalWidth:e})},this.handleClientWidth=e=>{this._isUnmounting||this.setState({clientWidth:e})}}render(){const{props:e,state:n,context:r}=this,{options:s}=r,{borderlessX:i,borderlessTop:a,borderlessBottom:o}=Ot(s),{totalWidth:l,clientWidth:c}=n;let u=l!=null&&c!=null?l-c:void 0;u<3&&(u=0);const f=!e.forPrint&&!Ye(s),h=!e.forPrint&&yl(s),g=e.cellRows[0].length,v=c!=null?c/g:void 0,m=v!=null&&v<=_l,E=m||v!=null&&v<=s.dayNarrowWidth;return d.jsxs(d.Fragment,{children:[s.dayHeaders&&d.jsxs("div",{className:O(k(s.tableHeaderClass,{isSticky:h,borderlessX:i,borderlessTop:a,borderlessBottom:o,multiMonthColumns:0}),y.printHeader,h&&y.tableHeaderSticky),children:[d.jsxs("div",{className:y.flexRow,children:[d.jsx(Fl,{headerTiers:e.headerTiers,cellIsNarrow:E,cellIsMicro:m}),!!u&&d.jsx("div",{className:O(k(s.fillerClass,{inTableHeader:!0}),y.borderOnlyS),style:{minWidth:u}})]}),d.jsx("div",{className:k(s.dayHeaderDividerClass,{isSticky:h,multiMonthColumns:0,options:{allDaySlot:!!s.allDaySlot}})})]}),d.jsx(Un,{vertical:f,className:O(k(s.tableBodyClass,{borderlessX:i,borderlessTop:a,borderlessBottom:o,multiMonthColumns:0}),!e.forPrint&&y.flexCol,f&&y.liquid),ref:this.handleScroller,clientWidthRef:this.handleClientWidth,children:d.jsx(Ul,{dateProfile:e.dateProfile,todayRange:e.todayRange,cellRows:e.cellRows,forPrint:e.forPrint,isHitComboAllowed:e.isHitComboAllowed,className:y.grow,dayMaxEvents:e.forPrint?void 0:s.dayMaxEvents,dayMaxEventRows:s.dayMaxEventRows,fgEventSegs:e.fgEventSegs,bgEventSegs:e.bgEventSegs,businessHourSegs:e.businessHourSegs,dateSelectionSegs:e.dateSelectionSegs,eventDrag:e.eventDrag,eventResize:e.eventResize,eventSelection:e.eventSelection,visibleWidth:l,cellIsNarrow:E,cellIsMicro:m,rowHeightRefMap:e.rowHeightRefMap})}),d.jsx(Ol,{widthRef:this.handleTotalWidth})]})}componentDidMount(){this._isUnmounting=!1}componentWillUnmount(){this._isUnmounting=!0}}class Wy extends ee{constructor(){super(...arguments),this.rootElRef=S.createRef()}render(){const{props:e}=this;return d.jsx("div",{ref:this.rootElRef,className:O(y.footerScrollbar,e.isSticky&&y.footerScrollbarSticky),children:d.jsx(Un,{horizontal:!0,ref:e.scrollerRef,children:d.jsx("div",{style:{minWidth:e.canvasWidth}})})})}componentDidMount(){this._isUnmounting=!1,this.disconnectHeight=ar(this.rootElRef.current,e=>{this._isUnmounting||G(this.props.scrollbarWidthRef,e)})}componentWillUnmount(){this._isUnmounting=!0,this.disconnectHeight(),G(this.props.scrollbarWidthRef,null)}}class Vy extends ee{constructor(){super(...arguments),this.state={},this.headerScrollerRef=S.createRef(),this.bodyScrollerRef=S.createRef(),this.footerScrollerRef=S.createRef(),this.handleTotalWidth=e=>{this._isUnmounting||this.setState({totalWidth:e})},this.handleClientWidth=e=>{this._isUnmounting||this.setState({clientWidth:e})}}render(){const{props:e,state:n,context:r}=this,{options:s}=r,{borderlessX:i,borderlessTop:a,borderlessBottom:o}=Ot(s),{totalWidth:l,clientWidth:c}=n,u=l!=null&&c!=null?l-c:void 0,f=!e.forPrint&&!Ye(s),h=!e.forPrint&&yl(s),g=!e.forPrint&&pp(s),v=e.cellRows[0].length,[m,E]=wy(v,e.dayMinWidth,c),C=E!=null&&E<=_l,R=C||E!=null&&E<=s.dayNarrowWidth;return d.jsxs(d.Fragment,{children:[s.dayHeaders&&d.jsxs("div",{className:O(k(s.tableHeaderClass,{isSticky:h,borderlessX:i,borderlessTop:a,borderlessBottom:o,multiMonthColumns:0}),y.printHeader,h&&y.tableHeaderSticky),children:[d.jsxs(Un,{horizontal:!0,hideScrollbars:!0,className:y.flexRow,ref:this.headerScrollerRef,children:[d.jsx(Fl,{headerTiers:e.headerTiers,colWidth:E,viewportWidth:c,width:m,cellIsNarrow:R,cellIsMicro:C}),!!u&&d.jsx("div",{className:O(k(s.fillerClass,{inTableHeader:!0}),y.borderOnlyS),style:{minWidth:u}})]}),d.jsx("div",{className:k(s.dayHeaderDividerClass,{isSticky:h,multiMonthColumns:0,options:{allDaySlot:!!s.allDaySlot}})})]}),d.jsx(Un,{vertical:f,horizontal:!0,hideScrollbars:g||e.forPrint,className:O(k(s.tableBodyClass,{borderlessX:i,borderlessTop:a,borderlessBottom:o,multiMonthColumns:0}),!e.forPrint&&y.flexCol,f&&y.liquid),ref:this.bodyScrollerRef,clientWidthRef:this.handleClientWidth,children:d.jsx(Ul,{dateProfile:e.dateProfile,todayRange:e.todayRange,cellRows:e.cellRows,forPrint:e.forPrint,isHitComboAllowed:e.isHitComboAllowed,className:y.grow,dayMaxEvents:e.forPrint?void 0:s.dayMaxEvents,dayMaxEventRows:s.dayMaxEventRows,fgEventSegs:e.fgEventSegs,bgEventSegs:e.bgEventSegs,businessHourSegs:e.businessHourSegs,dateSelectionSegs:e.dateSelectionSegs,eventDrag:e.eventDrag,eventResize:e.eventResize,eventSelection:e.eventSelection,colWidth:E,width:m,visibleWidth:l,cellIsNarrow:R,cellIsMicro:C,rowHeightRefMap:e.rowHeightRefMap})}),!!g&&d.jsx(Wy,{isSticky:!0,canvasWidth:m,scrollerRef:this.footerScrollerRef}),d.jsx(Ol,{widthRef:this.handleTotalWidth})]})}componentDidMount(){this._isUnmounting=!1;const e=vp(this.context.pluginHooks);this.syncedScroller=new e(!0),G(this.props.scrollerRef,this.syncedScroller),this.updateSyncedScroller()}componentDidUpdate(){this.updateSyncedScroller()}componentWillUnmount(){this._isUnmounting=!0,this.syncedScroller.destroy()}updateSyncedScroller(){this.syncedScroller.handleChildren([this.headerScrollerRef.current,this.bodyScrollerRef.current,this.footerScrollerRef.current])}}class zy extends ee{constructor(){super(...arguments),this.scrollerRef=S.createRef(),this.rowHeightRefMap=new xt(()=>{$t(this.updateScrollY)}),this.scrollDate=null,this.updateScrollY=()=>{if(this._isUnmounting)return;const e=this.rowHeightRefMap.current,n=this.scrollerRef.current;if(n&&this.scrollDate){let r=Dy(this.scrollDate,this.props.cellRows,e);r!=null&&(r&&r++,n.scrollTo({y:r}))}},this.handleScrollEnd=e=>{e&&(this.scrollDate=null)}}render(){const{props:e,context:n}=this,{options:r}=n,{borderlessX:s,borderlessTop:i,borderlessBottom:a}=Ot(r),o=e.forPrint?[]:e.businessHourSegs,l=e.forPrint?[]:e.dateSelectionSegs,c=e.forPrint?null:e.eventDrag,u=e.forPrint?null:e.eventResize,f={...e,businessHourSegs:o,dateSelectionSegs:l,eventDrag:c,eventResize:u,scrollerRef:this.scrollerRef,rowHeightRefMap:this.rowHeightRefMap};return d.jsx(Iv,{viewSpec:n.viewSpec,attrs:{role:"grid","aria-rowcount":e.headerTiers.length+e.cellRows.length,"aria-colcount":e.cellRows[0].length,"aria-labelledby":e.labelId,"aria-label":e.labelStr},className:O(e.className,y.printRoot,k(r.tableClass,{borderlessX:s,borderlessTop:i,borderlessBottom:a,multiMonthColumns:0})),children:r.dayMinWidth?d.jsx(Vy,{...f,dayMinWidth:r.dayMinWidth}):d.jsx(By,{...f})})}componentDidMount(){this._isUnmounting=!1,this.resetScroll(),this.scrollerRef.current.addScrollEndListener(this.handleScrollEnd)}componentDidUpdate(e){e.dateProfile!==this.props.dateProfile&&this.context.options.scrollTimeReset&&this.resetScroll()}componentWillUnmount(){this._isUnmounting=!0,this.scrollerRef.current.removeScrollEndListener(this.handleScrollEnd)}resetScroll(){this.scrollDate=this.props.dateProfile.currentDate,this.updateScrollY(),this.scrollerRef.current.scrollTo({x:0})}}class $y extends El{buildRenderRange(e,n,r){let s=super.buildRenderRange(e,n,r),{props:i}=this;return Yy({currentRange:s,snapToWeek:/^(year|month)$/.test(n),fixedWeekCount:i.fixedWeekCount,dateEnv:i.dateEnv})}}function Yy(t){let{dateEnv:e,currentRange:n}=t,{start:r,end:s}=n,i;if(t.snapToWeek&&(r=e.startOfWeek(r),i=e.startOfWeek(s),i.valueOf()!==s.valueOf()&&(s=fi(i,1))),t.fixedWeekCount){let a=e.startOfWeek(e.startOfMonth(fe(n.end,-1))),o=Math.ceil(zh(a,s));s=fi(s,6-o)}return{start:r,end:s}}class Gy extends ee{constructor(){super(...arguments),this.buildDayTableModel=B(Sy),this.buildDateRowConfigs=B(Xv),this.createDayHeaderFormatter=B(My),this.slicer=new Zv}render(){const{props:e,context:n}=this,{dateProfile:r}=e,{options:s,dateEnv:i}=n,a=this.buildDayTableModel(r,n.dateProfileGenerator,i),o=a.rowCount===1,l=this.createDayHeaderFormatter(n.options.dayHeaderFormat,o,a.colCount),c=this.slicer.sliceProps(e,r,s.nextDayThreshold,n,a);return d.jsx(Rl,{unit:"day",children:(u,f)=>{const h=this.buildDateRowConfigs(a.headerDates,o,r,f,l,n);return d.jsx(zy,{labelId:e.labelId,labelStr:e.labelStr,dateProfile:r,todayRange:f,cellRows:a.cellRows,forPrint:e.forPrint,className:e.className,headerTiers:h,fgEventSegs:c.fgEventSegs,bgEventSegs:c.bgEventSegs,businessHourSegs:c.businessHourSegs,dateSelectionSegs:c.dateSelectionSegs,eventDrag:c.eventDrag,eventResize:c.eventResize,eventSelection:c.eventSelection})}})}}var Zy={name:"daygrid",initialView:"dayGridMonth",views:{dayGrid:{component:Gy,dateProfileGeneratorClass:$y},dayGridDay:{type:"dayGrid",duration:{days:1}},dayGridWeek:{type:"dayGrid",duration:{weeks:1}},dayGridMonth:{type:"dayGrid",duration:{months:1},fixedWeekCount:!0},dayGridYear:{type:"dayGrid",duration:{years:1}}}};class qy{constructor(e,n){this.emitter=new on}destroy(){}setMirrorIsVisible(e){}setMirrorNeedsRevert(e){}setAutoScrollEnabled(e){}}const Bl={};function Wl(t,e,n){let{instances:r}=t.mutatedEvents;for(let s in r)if(!er(e.validRange,r[s].range))return!1;return Vl({eventDrag:t},n)}function Xy(t,e,n){return er(e.validRange,t.range)?Vl({dateSelection:t},n):!1}function Vl(t,e){let n=e.getCurrentData(),r={businessHours:n.businessHours,dateSelection:"",eventStore:n.eventStore,eventUiBases:n.eventUiBases,eventSelection:"",eventDrag:null,eventResize:null,...t};return(e.pluginHooks.isPropsValid||Ky)(r,e)}function Ky(t,e,n={},r){return!(t.eventDrag&&!Qy(t,e,n,r)||t.dateSelection&&!Jy(t,e,n,r))}function Qy(t,e,n,r){let s=e.getCurrentData(),i=t.eventDrag,a=i.mutatedEvents,o=a.defs,l=a.instances,c=An(o,i.isEvent?t.eventUiBases:{"":s.selectionConfig});r&&(c=ct(c,r));let u=Dp(t.eventStore,i.affectedEvents.instances),f=u.defs,h=u.instances,g=An(f,t.eventUiBases);for(let v in l){let m=l[v],E=m.range,C=c[m.defId],R=o[m.defId];if(!zl(C.constraints,E,u,t.businessHours,e))return!1;let{eventOverlap:x}=e.options,T=typeof x=="function"?x:null;for(let D in h){let N=h[D];if(vs(E,N.range)&&(g[N.defId].overlap===!1&&i.isEvent||C.overlap===!1||T&&!T(new K(e,f[N.defId],N),new K(e,R,m))))return!1}let M=s.eventStore;for(let D of C.allows){let N={...n,range:m.range,allDay:R.allDay},P=M.defs[R.defId],H=M.instances[v],U;if(P?U=new K(e,P,H):U=new K(e,R),!D(Ns(N,e),U))return!1}}return!0}function Jy(t,e,n,r){let s=t.eventStore,i=s.defs,a=s.instances,o=t.dateSelection,l=o.range,{selectionConfig:c}=e.getCurrentData();if(r&&(c=r(c)),!zl(c.constraints,l,s,t.businessHours,e))return!1;let{selectOverlap:u}=e.options,f=typeof u=="function"?u:null;for(let h in a){let g=a[h];if(vs(l,g.range)&&(c.overlap===!1||f&&!f(new K(e,i[g.defId],g),null)))return!1}for(let h of c.allows){let g={...n,...o};if(!h(Ns(g,e),null))return!1}return!0}function zl(t,e,n,r,s){for(let i of t)if(!tb(eb(i,e,n,r,s),e))return!1;return!0}function eb(t,e,n,r,s){return t==="businessHours"?Rr(ot(r,e,s)):typeof t=="string"?Rr(rr(n,i=>i.groupId===t)):typeof t=="object"&&t?Rr(ot(t,e,s)):[]}function Rr(t){let{instances:e}=t,n=[];for(let r in e)n.push(e[r].range);return n}function tb(t,e){for(let n of t)if(er(n,e))return!0;return!1}Bl.touchMouseIgnoreWait=500;let Gr=0,Fn=0,Zr=!1;class $l{constructor(e){this.subjectEl=null,this.selector="",this.handleSelector="",this.shouldIgnoreMove=!1,this.shouldWatchScroll=!0,this.isDragging=!1,this.isTouchDragging=!1,this.wasTouchScroll=!1,this.handleMouseDown=n=>{if(!this.shouldIgnoreMouse()&&nb(n)&&this.tryStart(n)){let r=this.createEventFromMouse(n,!0);this.emitter.trigger("pointerdown",r),this.initScrollWatch(r),this.shouldIgnoreMove||document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}},this.handleMouseMove=n=>{let r=this.createEventFromMouse(n);this.recordCoords(r),this.emitter.trigger("pointermove",r)},this.handleMouseUp=n=>{document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.emitter.trigger("pointerup",this.createEventFromMouse(n)),this.cleanup()},this.handleTouchStart=n=>{if(this.tryStart(n)){this.isTouchDragging=!0;let r=this.createEventFromTouch(n,!0);this.emitter.trigger("pointerdown",r),this.initScrollWatch(r);let s=n.target;this.shouldIgnoreMove||s.addEventListener("touchmove",this.handleTouchMove),s.addEventListener("touchend",this.handleTouchEnd),s.addEventListener("touchcancel",this.handleTouchEnd),window.addEventListener("scroll",this.handleTouchScroll,!0)}},this.handleTouchMove=n=>{if(this.isDragging){let r=this.createEventFromTouch(n);this.recordCoords(r),this.emitter.trigger("pointermove",r)}},this.handleTouchEnd=n=>{if(this.isDragging){let r=n.target;r.removeEventListener("touchmove",this.handleTouchMove),r.removeEventListener("touchend",this.handleTouchEnd),r.removeEventListener("touchcancel",this.handleTouchEnd),window.removeEventListener("scroll",this.handleTouchScroll,!0),this.emitter.trigger("pointerup",this.createEventFromTouch(n)),this.cleanup(),this.isTouchDragging=!1,rb()}},this.handleTouchScroll=()=>{this.wasTouchScroll=!0},this.handleScroll=n=>{if(!this.shouldIgnoreMove){let r=window.scrollX-this.prevScrollX+this.prevPageX,s=window.scrollY-this.prevScrollY+this.prevPageY;this.emitter.trigger("pointermove",{origEvent:n,isTouch:this.isTouchDragging,subjectEl:this.subjectEl,pageX:r,pageY:s,deltaX:r-this.origPageX,deltaY:s-this.origPageY})}},this.containerEl=e,this.emitter=new on,e.addEventListener("mousedown",this.handleMouseDown),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),sb()}destroy(){this.containerEl.removeEventListener("mousedown",this.handleMouseDown),this.containerEl.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),ib()}cancel(){this.isDragging&&this.cleanup()}tryStart(e){let n=this.querySubjectEl(e),r=e.target;return n&&(!this.handleSelector||r.closest(this.handleSelector))?(this.subjectEl=n,this.isDragging=!0,this.wasTouchScroll=!1,!0):!1}cleanup(){Zr=!1,this.isDragging=!1,this.subjectEl=null,this.destroyScrollWatch()}querySubjectEl(e){return this.selector?e.target.closest(this.selector):this.containerEl}shouldIgnoreMouse(){return Gr||this.isTouchDragging}cancelTouchScroll(){this.isDragging&&(Zr=!0)}initScrollWatch(e){this.shouldWatchScroll&&(this.recordCoords(e),window.addEventListener("scroll",this.handleScroll,!0))}recordCoords(e){this.shouldWatchScroll&&(this.prevPageX=e.pageX,this.prevPageY=e.pageY,this.prevScrollX=window.scrollX,this.prevScrollY=window.scrollY)}destroyScrollWatch(){this.shouldWatchScroll&&window.removeEventListener("scroll",this.handleScroll,!0)}createEventFromMouse(e,n){let r=0,s=0;return n?(this.origPageX=e.pageX,this.origPageY=e.pageY):(r=e.pageX-this.origPageX,s=e.pageY-this.origPageY),{origEvent:e,isTouch:!1,subjectEl:this.subjectEl,pageX:e.pageX,pageY:e.pageY,deltaX:r,deltaY:s}}createEventFromTouch(e,n){let r=e.touches,s,i,a=0,o=0;return r&&r.length?(s=r[0].pageX,i=r[0].pageY):(s=e.pageX,i=e.pageY),n?(this.origPageX=s,this.origPageY=i):(a=s-this.origPageX,o=i-this.origPageY),{origEvent:e,isTouch:!0,subjectEl:this.subjectEl,pageX:s,pageY:i,deltaX:a,deltaY:o}}}function nb(t){return t.button===0&&!t.ctrlKey}function rb(){Gr+=1,setTimeout(()=>{Gr-=1},Bl.touchMouseIgnoreWait)}function sb(){Fn+=1,Fn===1&&window.addEventListener("touchmove",Yl,{passive:!1})}function ib(){Fn-=1,Fn||window.removeEventListener("touchmove",Yl,{passive:!1})}function Yl(t){Zr&&t.preventDefault()}class ab{constructor(){this.isVisible=!1,this.sourceEl=null,this.mirrorEl=null,this.sourceElRect=null,this.parentNode=document.body,this.zIndex=9999,this.revertDuration=0,this.colorScheme=""}start(e,n,r){this.sourceEl=e,this.sourceElRect=this.sourceEl.getBoundingClientRect(),this.origScreenX=n-window.scrollX,this.origScreenY=r-window.scrollY,this.deltaX=0,this.deltaY=0,this.updateElPosition()}handleMove(e,n){this.deltaX=e-window.scrollX-this.origScreenX,this.deltaY=n-window.scrollY-this.origScreenY,this.updateElPosition()}setIsVisible(e){e?this.isVisible||(this.mirrorEl&&this.mirrorEl.style.setProperty("display","","important"),this.isVisible=e,this.updateElPosition()):this.isVisible&&(this.mirrorEl&&this.mirrorEl.style.setProperty("display","none","important"),this.isVisible=e)}stop(e,n){let r=()=>{this.cleanup(),n()};e&&this.mirrorEl&&this.isVisible&&this.revertDuration&&(this.deltaX||this.deltaY)?this.doRevertAnimation(r,this.revertDuration):setTimeout(r,0)}doRevertAnimation(e,n){let r=this.mirrorEl,s=this.sourceEl.getBoundingClientRect();r.style.transition="top "+n+"ms,left "+n+"ms",xn(r,{left:s.left,top:s.top}),kg(r,()=>{r.style.transition="",e()})}cleanup(){this.mirrorEl&&(this.mirrorEl.remove(),this.mirrorEl=null),this.sourceEl=null}updateElPosition(){this.sourceEl&&this.isVisible&&xn(this.getMirrorEl(),{left:this.sourceElRect.left+this.deltaX,top:this.sourceElRect.top+this.deltaY})}getMirrorEl(){let e=this.sourceElRect,n=this.mirrorEl;return n||(n=this.mirrorEl=this.sourceEl.cloneNode(!0),n.style.userSelect="none",n.style.webkitUserSelect="none",n.style.pointerEvents="none",this.colorScheme&&n.setAttribute("data-color-scheme",this.colorScheme),n.classList.add(y.borderBoxRoot),xn(n,{position:"fixed",zIndex:this.zIndex,visibility:"",width:e.right-e.left,height:e.bottom-e.top,right:"auto",bottom:"auto",margin:0}),this.parentNode.appendChild(n)),n}}class Ls{getMaxScrollTop(){return this.getScrollHeight()-this.getClientHeight()}getMaxScrollLeft(){return this.getScrollWidth()-this.getClientWidth()}canScrollVertically(){return this.getMaxScrollTop()>0}canScrollHorizontally(){return this.getMaxScrollLeft()>0}canScrollUp(){return this.getScrollTop()>0}canScrollDown(){return this.getScrollTop()<this.getMaxScrollTop()}canScrollLeft(){return this.getScrollLeft()>0}canScrollRight(){return this.getScrollLeft()<this.getMaxScrollLeft()}}class ob extends Ls{constructor(e){super(),this.el=e}getScrollTop(){return this.el.scrollTop}getScrollLeft(){return this.el.scrollLeft}setScrollTop(e){this.el.scrollTop=e}setScrollLeft(e){this.el.scrollLeft=e}getScrollWidth(){return this.el.scrollWidth}getScrollHeight(){return this.el.scrollHeight}getClientHeight(){return this.el.clientHeight}getClientWidth(){return this.el.clientWidth}}class lb extends Ls{getScrollTop(){return window.scrollY}getScrollLeft(){return window.scrollX}setScrollTop(e){window.scroll(window.scrollX,e)}setScrollLeft(e){window.scroll(e,window.scrollY)}getScrollWidth(){return document.documentElement.scrollWidth}getScrollHeight(){return document.documentElement.scrollHeight}getClientHeight(){return document.documentElement.clientHeight}getClientWidth(){return document.documentElement.clientWidth}}class Gl extends Ls{constructor(e,n){super(),this.handleScroll=()=>{this.scrollTop=this.scrollController.getScrollTop(),this.scrollLeft=this.scrollController.getScrollLeft(),this.handleScrollChange()},this.scrollController=e,this.doesListening=n,this.scrollTop=this.origScrollTop=e.getScrollTop(),this.scrollLeft=this.origScrollLeft=e.getScrollLeft(),this.scrollWidth=e.getScrollWidth(),this.scrollHeight=e.getScrollHeight(),this.clientWidth=e.getClientWidth(),this.clientHeight=e.getClientHeight(),this.clientRect=this.computeClientRect(),this.doesListening&&this.getEventTarget().addEventListener("scroll",this.handleScroll)}destroy(){this.doesListening&&this.getEventTarget().removeEventListener("scroll",this.handleScroll)}getScrollTop(){return this.scrollTop}getScrollLeft(){return this.scrollLeft}setScrollTop(e){this.scrollController.setScrollTop(e),this.doesListening||(this.scrollTop=Math.max(Math.min(e,this.getMaxScrollTop()),0),this.handleScrollChange())}setScrollLeft(e){this.scrollController.setScrollLeft(e),this.doesListening||(this.scrollLeft=Math.max(Math.min(e,this.getMaxScrollLeft()),0),this.handleScrollChange())}getClientWidth(){return this.clientWidth}getClientHeight(){return this.clientHeight}getScrollWidth(){return this.scrollWidth}getScrollHeight(){return this.scrollHeight}handleScrollChange(){}}class Zl extends Gl{constructor(e,n){super(new ob(e),n)}getEventTarget(){return this.scrollController.el}computeClientRect(){return zv(this.scrollController.el)}}class cb extends Gl{constructor(e){super(new lb,e)}getEventTarget(){return window}computeClientRect(){return{left:this.scrollLeft,right:this.scrollLeft+this.clientWidth,top:this.scrollTop,bottom:this.scrollTop+this.clientHeight}}handleScrollChange(){this.clientRect=this.computeClientRect()}}const ea=typeof performance=="function"?performance.now:Date.now;class db{constructor(){this.isEnabled=!0,this.scrollQuery=[window,`.${y.internalScroller}`],this.edgeThreshold=50,this.maxVelocity=300,this.pointerScreenX=null,this.pointerScreenY=null,this.isAnimating=!1,this.scrollCaches=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.animate=()=>{if(this.isAnimating){let e=this.computeBestEdge(this.pointerScreenX+window.scrollX,this.pointerScreenY+window.scrollY);if(e){let n=ea();this.handleSide(e,(n-this.msSinceRequest)/1e3),this.requestAnimation(n)}else this.isAnimating=!1}}}start(e,n,r){this.isEnabled&&(this.scrollCaches=this.buildCaches(r),this.pointerScreenX=null,this.pointerScreenY=null,this.everMovedUp=!1,this.everMovedDown=!1,this.everMovedLeft=!1,this.everMovedRight=!1,this.handleMove(e,n))}handleMove(e,n){if(this.isEnabled){let r=e-window.scrollX,s=n-window.scrollY,i=this.pointerScreenY===null?0:s-this.pointerScreenY,a=this.pointerScreenX===null?0:r-this.pointerScreenX;i<0?this.everMovedUp=!0:i>0&&(this.everMovedDown=!0),a<0?this.everMovedLeft=!0:a>0&&(this.everMovedRight=!0),this.pointerScreenX=r,this.pointerScreenY=s,this.isAnimating||(this.isAnimating=!0,this.requestAnimation(ea()))}}stop(){if(this.isEnabled){this.isAnimating=!1;for(let e of this.scrollCaches)e.destroy();this.scrollCaches=null}}requestAnimation(e){this.msSinceRequest=e,requestAnimationFrame(this.animate)}handleSide(e,n){let{scrollCache:r}=e,{edgeThreshold:s}=this,i=s-e.distance,a=i*i/(s*s)*this.maxVelocity*n,o=1;switch(e.name){case"left":o=-1;case"right":r.setScrollLeft(r.getScrollLeft()+a*o);break;case"top":o=-1;case"bottom":r.setScrollTop(r.getScrollTop()+a*o);break}}computeBestEdge(e,n){let{edgeThreshold:r}=this,s=null,i=this.scrollCaches||[];for(let a of i){let o=a.clientRect,l=e-o.left,c=o.right-e,u=n-o.top,f=o.bottom-n;l>=0&&c>=0&&u>=0&&f>=0&&(u<=r&&this.everMovedUp&&a.canScrollUp()&&(!s||s.distance>u)&&(s={scrollCache:a,name:"top",distance:u}),f<=r&&this.everMovedDown&&a.canScrollDown()&&(!s||s.distance>f)&&(s={scrollCache:a,name:"bottom",distance:f}),l<=r&&this.everMovedLeft&&a.canScrollLeft()&&(!s||s.distance>l)&&(s={scrollCache:a,name:"left",distance:l}),c<=r&&this.everMovedRight&&a.canScrollRight()&&(!s||s.distance>c)&&(s={scrollCache:a,name:"right",distance:c}))}return s}buildCaches(e){return this.queryScrollEls(e).map(n=>n===window?new cb(!1):new Zl(n,!1))}queryScrollEls(e){let n=[];for(let r of this.scrollQuery)typeof r=="object"?n.push(r):n.push(...Array.prototype.slice.call(e.getRootNode().querySelectorAll(r)));return n}}class ln extends qy{constructor(e,n){super(e),this.containerEl=e,this.delay=null,this.minDistance=0,this.touchScrollAllowed=!0,this.mirrorNeedsRevert=!1,this.isInteracting=!1,this.isDragging=!1,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,this.delayTimeoutId=null,this.onPointerDown=s=>{this.isDragging||(this.isInteracting=!0,this.isDelayEnded=!1,this.isDistanceSurpassed=!1,this.emitter.trigger("pointerdown",s),this.isInteracting&&(Pg(document.body),Hg(document.body),s.isTouch||s.origEvent.preventDefault(),this.mirror.setIsVisible(!1),this.mirror.start(s.subjectEl,s.pageX,s.pageY),this.startDelay(s),this.minDistance||this.handleDistanceSurpassed(s)))},this.onPointerMove=s=>{if(this.isInteracting){if(this.emitter.trigger("pointermove",s),!this.isDistanceSurpassed){let i=this.minDistance,a,{deltaX:o,deltaY:l}=s;a=o*o+l*l,a>=i*i&&this.handleDistanceSurpassed(s)}this.isDragging&&(s.origEvent.type!=="scroll"&&(this.mirror.handleMove(s.pageX,s.pageY),this.autoScroller.handleMove(s.pageX,s.pageY)),this.emitter.trigger("dragmove",s))}},this.onPointerUp=s=>{this.isInteracting&&(this.isInteracting=!1,jg(document.body),Og(document.body),this.emitter.trigger("pointerup",s),this.isDragging&&(this.autoScroller.stop(),this.tryStopDrag(s)),this.delayTimeoutId&&(clearTimeout(this.delayTimeoutId),this.delayTimeoutId=null))};let r=this.pointer=new $l(e);r.emitter.on("pointerdown",this.onPointerDown),r.emitter.on("pointermove",this.onPointerMove),r.emitter.on("pointerup",this.onPointerUp),n&&(r.selector=n),this.mirror=new ab,this.autoScroller=new db}destroy(){this.pointer.destroy(),this.onPointerUp({})}startDelay(e){typeof this.delay=="number"?this.delayTimeoutId=setTimeout(()=>{this.delayTimeoutId=null,this.handleDelayEnd(e)},this.delay):this.handleDelayEnd(e)}handleDelayEnd(e){this.isDelayEnded=!0,this.tryStartDrag(e)}handleDistanceSurpassed(e){this.isDistanceSurpassed=!0,this.tryStartDrag(e)}tryStartDrag(e){this.isDelayEnded&&this.isDistanceSurpassed&&(!this.pointer.wasTouchScroll||this.touchScrollAllowed)&&(this.isDragging=!0,this.mirrorNeedsRevert=!1,this.autoScroller.start(e.pageX,e.pageY,this.containerEl),this.emitter.trigger("dragstart",e),this.touchScrollAllowed===!1&&this.pointer.cancelTouchScroll())}tryStopDrag(e){this.mirror.stop(this.mirrorNeedsRevert,this.stopDrag.bind(this,e))}stopDrag(e){this.isDragging=!1,this.emitter.trigger("dragend",e)}cancel(){this.isInteracting&&(this.isInteracting=!1,this.pointer.cancel())}setMirrorIsVisible(e){this.mirror.setIsVisible(e)}setMirrorNeedsRevert(e){this.mirrorNeedsRevert=e}setAutoScrollEnabled(e){this.autoScroller.isEnabled=e}}class ub{constructor(e){this.el=e,this.origRect=As(e),this.isRtl=en(e),this.scrollCaches=jl(e).map(n=>new Zl(n,!0))}destroy(){for(let e of this.scrollCaches)e.destroy()}computeLeft(){let e=this.origRect.left;for(let n of this.scrollCaches)e+=n.origScrollLeft-n.getScrollLeft();return e}computeTop(){let e=this.origRect.top;for(let n of this.scrollCaches)e+=n.origScrollTop-n.getScrollTop();return e}isWithinClipping(e,n){let r={left:e,top:n};for(let s of this.scrollCaches)if(!fb(s.getEventTarget())&&!Uv(r,s.clientRect))return!1;return!0}}function fb(t){let e=t.tagName;return e==="HTML"||e==="BODY"}class lr{constructor(e,n){this.useSubjectCenter=!1,this.requireInitial=!0,this.disablePointCheck=!1,this.initialHit=null,this.movingHit=null,this.finalHit=null,this.handlePointerDown=r=>{let{dragging:s}=this;this.initialHit=null,this.movingHit=null,this.finalHit=null,this.prepareHits(),this.processFirstCoord(r),this.initialHit||!this.requireInitial?this.emitter.trigger("pointerdown",r):s.cancel()},this.handleDragStart=r=>{this.emitter.trigger("dragstart",r),this.handleMove(r,!0)},this.handleDragMove=r=>{this.emitter.trigger("dragmove",r),this.handleMove(r)},this.handlePointerUp=r=>{this.releaseHits(),this.emitter.trigger("pointerup",r)},this.handleDragEnd=r=>{this.movingHit&&this.emitter.trigger("hitupdate",null,!0,r),this.finalHit=this.movingHit,this.movingHit=null,this.emitter.trigger("dragend",r)},this.droppableStore=n,e.emitter.on("pointerdown",this.handlePointerDown),e.emitter.on("dragstart",this.handleDragStart),e.emitter.on("dragmove",this.handleDragMove),e.emitter.on("pointerup",this.handlePointerUp),e.emitter.on("dragend",this.handleDragEnd),this.dragging=e,this.emitter=new on}processFirstCoord(e){let n={left:e.pageX,top:e.pageY},r=n,s=e.subjectEl,i;s instanceof HTMLElement&&(i=As(s),r=Fv(r,i));let a=this.initialHit=this.queryHitForOffset(r.left,r.top);if(a){if(this.useSubjectCenter&&i){let o=Pl(i,a.rect);o&&(r=Bv(o))}this.coordAdjust=Wv(r,n)}else this.coordAdjust={left:0,top:0}}handleMove(e,n){let r=this.queryHitForOffset(e.pageX+this.coordAdjust.left,e.pageY+this.coordAdjust.top);(n||!cr(this.movingHit,r))&&(this.movingHit=r,this.emitter.trigger("hitupdate",r,!1,e))}prepareHits(){this.offsetTrackers=ct(this.droppableStore,e=>(e.component.prepareHits(),new ub(e.el)))}releaseHits(){let{offsetTrackers:e}=this;for(let n in e)e[n].destroy();this.offsetTrackers={}}queryHitForOffset(e,n){let{droppableStore:r,offsetTrackers:s}=this,i=null;for(let a in r){let o=r[a].component,l=s[a];if(l&&l.isWithinClipping(e,n)){let c=l.computeLeft(),u=l.computeTop(),f=e-c,h=n-u,{origRect:g}=l,v=g.right-g.left,m=g.bottom-g.top;if(f>=0&&f<v&&h>=0&&h<m){let E=o.queryHit(l.isRtl,f,h,v,m);E&&er(E.dateProfile.activeRange,E.dateSpan.range)&&(this.disablePointCheck||l.el.contains(l.el.getRootNode().elementFromPoint(f+c-window.scrollX,h+u-window.scrollY)))&&(!i||E.layer>i.layer)&&(E.componentId=a,E.context=o.context,E.rect.left+=c,E.rect.right+=c,E.rect.top+=u,E.rect.bottom+=u,i=E)}}}return i}}function cr(t,e){return!t&&!e?!0:!!t!=!!e?!1:om(t.dateSpan,e.dateSpan)}function ql(t,e){let n={};for(let r of e.pluginHooks.datePointTransforms)Object.assign(n,r(t,e));return Object.assign(n,hb(t,e.dateEnv)),n}function hb(t,e){return{date:e.toDate(t.range.start),dateStr:e.formatIso(t.range.start,{omitTime:t.allDay}),allDay:t.allDay}}class gb extends Lt{constructor(e){super(e),this.handlePointerDown=r=>{let{dragging:s}=this,i=r.origEvent.target;this.component.context.emitter.hasHandlers("dateClick")&&this.component.isValidDateDownEl(i)||s.cancel()},this.handleDragEnd=r=>{let{component:s}=this,{pointer:i}=this.dragging;if(!i.wasTouchScroll){let{initialHit:a,finalHit:o}=this.hitDragging;if(a&&o&&cr(a,o)){let{context:l}=s,c={...ql(a.dateSpan,l),dayEl:a.getDayEl(),jsEvent:r.origEvent,view:l.viewApi||l.calendarApi.view};l.emitter.trigger("dateClick",c)}}},this.dragging=new ln(e.el),this.dragging.autoScroller.isEnabled=!1;let n=this.hitDragging=new lr(this.dragging,Ps(e));n.emitter.on("pointerdown",this.handlePointerDown),n.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}}class mb extends Lt{constructor(e){super(e),this.dragSelection=null,this.handlePointerDown=a=>{let{component:o,dragging:l}=this,{options:c}=o.context;c.selectable&&o.isValidDateDownEl(a.origEvent.target)?l.delay=a.isTouch?pb(o):null:l.cancel()},this.handleDragStart=a=>{this.component.context.calendarApi.unselect(a)},this.handleHitUpdate=(a,o)=>{let{context:l}=this.component,c=null,u=!1;if(a){let f=this.hitDragging.initialHit;a.componentId===f.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(f,a)||(c=vb(f,a,l.pluginHooks.dateSelectionTransformers)),(!c||!Xy(c,a.dateProfile,l))&&(u=!0,c=null)}c?l.dispatch({type:"SELECT_DATES",selection:c}):o||l.dispatch({type:"UNSELECT_DATES"}),u?Es():Ss(),o||(this.dragSelection=c)},this.handlePointerUp=a=>{this.dragSelection?(nl(this.dragSelection,a,this.component.context),this.dragSelection=null):this.component.context.emitter.trigger("_noDateSelect")};let{component:n}=e,{options:r}=n.context,s=this.dragging=new ln(e.el);s.touchScrollAllowed=!1,s.minDistance=r.selectMinDistance||0,s.autoScroller.isEnabled=r.dragScroll;let i=this.hitDragging=new lr(this.dragging,Ps(e));i.emitter.on("pointerdown",this.handlePointerDown),i.emitter.on("dragstart",this.handleDragStart),i.emitter.on("hitupdate",this.handleHitUpdate),i.emitter.on("pointerup",this.handlePointerUp)}destroy(){this.dragging.destroy()}}function pb(t){let{options:e}=t.context,n=e.selectLongPressDelay;return n==null&&(n=e.longPressDelay),n}function vb(t,e,n){let r=t.dateSpan,s=e.dateSpan,i=[r.range.start,r.range.end,s.range.start,s.range.end];i.sort(Fg);let a={};for(let o of n){let l=o(t,e);if(l===!1)return null;l&&Object.assign(a,l)}return a.range={start:i[0],end:i[3]},a.allDay=r.allDay,a}class cn extends Lt{constructor(e){super(e),this.subjectEl=null,this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=a=>{let o=a.origEvent.target,{component:l,dragging:c}=this,{mirror:u}=c,{options:f}=l.context,h=l.context;this.subjectEl=a.subjectEl;let v=(this.eventRange=Nt(a.subjectEl)).instance.instanceId;this.relevantEvents=Cs(h.getCurrentData().eventStore,v),c.minDistance=a.isTouch?0:f.eventDragMinDistance,c.delay=a.isTouch&&v!==l.props.eventSelection?bb(l):null,u.parentNode=Cl(o),u.revertDuration=f.dragRevertDuration,u.colorScheme=f.colorScheme||"",l.isValidSegDownEl(o)&&!o.closest(`.${y.internalEventResizer}`)?this.isDragging=a.subjectEl.classList.contains(y.internalEventDraggable):c.cancel()},this.handleDragStart=a=>{let o=this.component.context,l=this.eventRange,c=l.instance.instanceId;a.isTouch?c!==this.component.props.eventSelection&&o.dispatch({type:"SELECT_EVENT",eventInstanceId:c}):o.dispatch({type:"UNSELECT_EVENT"}),this.isDragging&&(o.calendarApi.unselect(a),o.emitter.trigger("eventDragStart",{el:this.subjectEl,event:new K(o,l.def,l.instance),jsEvent:a.origEvent,view:o.viewApi}))},this.handleHitUpdate=(a,o)=>{if(!this.isDragging)return;let l=this.relevantEvents,c=this.hitDragging.initialHit,u=this.component.context,f=null,h=null,g=null,v=!1,m={affectedEvents:l,mutatedEvents:Me(),isEvent:!0};if(a){f=a.context;let E=f.options;u===f||E.editable&&E.droppable?(h=yb(c,a,this.eventRange.instance.range.start,f.getCurrentData().pluginHooks.eventDragMutationMassagers),h&&(g=Ms(l,f.getCurrentData().eventUiBases,h,f),m.mutatedEvents=g,Wl(m,a.dateProfile,f)||(v=!0,h=null,g=null,m.mutatedEvents=Me()))):f=null}this.displayDrag(f,m),v?Es():Ss(),o||(u===f&&cr(c,a)&&(h=null),this.dragging.setMirrorNeedsRevert(!h),this.dragging.setMirrorIsVisible(!a||!this.subjectEl.getRootNode().querySelector(`.${y.internalEventMirror}`)),this.receivingContext=f,this.validMutation=h,this.mutatedRelevantEvents=g)},this.handlePointerUp=()=>{this.isDragging||this.cleanup()},this.handleDragEnd=a=>{if(this.isDragging){let o=this.component.context,l=o.viewApi,{receivingContext:c,validMutation:u}=this,f=this.eventRange.def,h=this.eventRange.instance,g=new K(o,f,h),v=this.relevantEvents,m=this.mutatedRelevantEvents,{finalHit:E}=this.hitDragging;if(this.clearDrag(),o.emitter.trigger("eventDragStop",{el:this.subjectEl,event:g,jsEvent:a.origEvent,view:l}),u){if(c===o){let C=new K(o,m.defs[f.defId],h?m.instances[h.instanceId]:null);o.dispatch({type:"MERGE_EVENTS",eventStore:m});let R={oldEvent:g,event:C,relatedEvents:tt(m,o,h),revert(){o.dispatch({type:"MERGE_EVENTS",eventStore:v})}},x={};for(let T of o.getCurrentData().pluginHooks.eventDropTransformers)Object.assign(x,T(u,o));o.emitter.trigger("eventDrop",{...R,...x,el:a.subjectEl,delta:u.datesDelta,jsEvent:a.origEvent,view:l}),o.emitter.trigger("eventChange",R)}else if(c){let C={event:g,relatedEvents:tt(v,o,h),revert(){o.dispatch({type:"MERGE_EVENTS",eventStore:v})}};o.emitter.trigger("eventLeave",{...C,draggedEl:a.subjectEl,view:l}),o.dispatch({type:"REMOVE_EVENTS",eventStore:v}),o.emitter.trigger("eventRemove",C);let R=m.defs[f.defId],x=m.instances[h.instanceId],T=new K(c,R,x);c.dispatch({type:"MERGE_EVENTS",eventStore:m});let M={event:T,relatedEvents:tt(m,c,x),revert(){c.dispatch({type:"REMOVE_EVENTS",eventStore:m})}};c.emitter.trigger("eventAdd",M),a.isTouch&&c.dispatch({type:"SELECT_EVENT",eventInstanceId:h.instanceId}),c.emitter.trigger("drop",{...ql(E.dateSpan,c),draggedEl:a.subjectEl,jsEvent:a.origEvent,view:E.context.viewApi}),c.emitter.trigger("eventReceive",{...M,draggedEl:a.subjectEl,view:E.context.viewApi})}}else o.emitter.trigger("_noEventDrop")}this.cleanup()};let{component:n}=this,{options:r}=n.context,s=this.dragging=new ln(e.el);s.pointer.selector=cn.SELECTOR,s.touchScrollAllowed=!1,s.autoScroller.isEnabled=r.dragScroll;let i=this.hitDragging=new lr(this.dragging,Br);i.useSubjectCenter=e.useEventCenter,i.emitter.on("pointerdown",this.handlePointerDown),i.emitter.on("dragstart",this.handleDragStart),i.emitter.on("hitupdate",this.handleHitUpdate),i.emitter.on("pointerup",this.handlePointerUp),i.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}displayDrag(e,n){let r=this.component.context,s=this.receivingContext;s&&s!==e&&(s===r?s.dispatch({type:"SET_EVENT_DRAG",state:{affectedEvents:n.affectedEvents,mutatedEvents:Me(),isEvent:!0}}):s.dispatch({type:"UNSET_EVENT_DRAG"})),e&&e.dispatch({type:"SET_EVENT_DRAG",state:n})}clearDrag(){let e=this.component.context,{receivingContext:n}=this;n&&n.dispatch({type:"UNSET_EVENT_DRAG"}),e!==n&&e.dispatch({type:"UNSET_EVENT_DRAG"})}cleanup(){this.isDragging=!1,this.eventRange=null,this.relevantEvents=null,this.receivingContext=null,this.validMutation=null,this.mutatedRelevantEvents=null}}cn.SELECTOR=`.${y.internalEventDraggable}, .${y.internalEventResizable}`;function yb(t,e,n,r){let s=t.dateSpan,i=e.dateSpan,a=s.range.start,o=i.range.start,l={};s.allDay!==i.allDay&&(l.allDay=i.allDay,l.hasEnd=e.context.options.allDayMaintainDuration,i.allDay?a=X(n):a=n);let c=bt(a,o,t.context.dateEnv,t.componentId===e.componentId?t.largeUnit:null);c.milliseconds&&(l.allDay=!1);let u={datesDelta:c,standardProps:l};for(let f of r)f(u,t,e);return u}function bb(t){let{options:e}=t.context,n=e.eventLongPressDelay;return n==null&&(n=e.longPressDelay),n}class Eb extends Lt{constructor(e){super(e),this.draggingSegEl=null,this.draggingEventRange=null,this.eventRange=null,this.relevantEvents=null,this.validMutation=null,this.mutatedRelevantEvents=null,this.handlePointerDown=i=>{let{component:a}=this,o=this.querySegEl(i),l=this.eventRange=Nt(o);this.dragging.minDistance=a.context.options.eventDragMinDistance,this.component.isValidSegDownEl(i.origEvent.target)&&!(i.isTouch&&this.component.props.eventSelection!==l.instance.instanceId)||this.dragging.cancel()},this.handleDragStart=i=>{let{context:a}=this.component,o=this.eventRange;this.relevantEvents=Cs(a.getCurrentData().eventStore,this.eventRange.instance.instanceId);let l=this.querySegEl(i);this.draggingSegEl=l,this.draggingEventRange=Nt(l),a.calendarApi.unselect(),a.emitter.trigger("eventResizeStart",{el:l,event:new K(a,o.def,o.instance),jsEvent:i.origEvent,view:a.viewApi})},this.handleHitUpdate=(i,a,o)=>{let{context:l}=this.component,c=this.relevantEvents,u=this.hitDragging.initialHit,f=this.eventRange.instance,h=null,g=null,v=!1,m={affectedEvents:c,mutatedEvents:Me(),isEvent:!0};i&&(i.componentId===u.componentId&&this.isHitComboAllowed&&!this.isHitComboAllowed(u,i)||(h=Sb(u,i,o.subjectEl.classList.contains(y.internalEventResizerStart),f.range))),h&&(g=Ms(c,l.getCurrentData().eventUiBases,h,l),m.mutatedEvents=g,Wl(m,i.dateProfile,l)||(v=!0,h=null,g=null,m.mutatedEvents=null)),g?l.dispatch({type:"SET_EVENT_RESIZE",state:m}):l.dispatch({type:"UNSET_EVENT_RESIZE"}),v?Es():Ss(),a||(h&&cr(u,i)&&(h=null),this.validMutation=h,this.mutatedRelevantEvents=g)},this.handleDragEnd=i=>{let{context:a}=this.component,o=this.eventRange.def,l=this.eventRange.instance,c=new K(a,o,l),u=this.relevantEvents,f=this.mutatedRelevantEvents;if(a.emitter.trigger("eventResizeStop",{el:this.draggingSegEl,event:c,jsEvent:i.origEvent,view:a.viewApi}),this.validMutation){let h=new K(a,f.defs[o.defId],l?f.instances[l.instanceId]:null);a.dispatch({type:"MERGE_EVENTS",eventStore:f});let g={oldEvent:c,event:h,relatedEvents:tt(f,a,l),revert(){a.dispatch({type:"MERGE_EVENTS",eventStore:u})}};a.emitter.trigger("eventResize",{...g,el:this.draggingSegEl,startDelta:this.validMutation.startDelta||$(0),endDelta:this.validMutation.endDelta||$(0),jsEvent:i.origEvent,view:a.viewApi}),a.emitter.trigger("eventChange",g)}else a.emitter.trigger("_noEventResize");this.draggingEventRange=null,this.relevantEvents=null,this.validMutation=null};let{component:n}=e,r=this.dragging=new ln(e.el);r.pointer.selector=`.${y.internalEventResizer}`,r.touchScrollAllowed=!1,r.autoScroller.isEnabled=n.context.options.dragScroll;let s=this.hitDragging=new lr(this.dragging,Ps(e));s.emitter.on("pointerdown",this.handlePointerDown),s.emitter.on("dragstart",this.handleDragStart),s.emitter.on("hitupdate",this.handleHitUpdate),s.emitter.on("dragend",this.handleDragEnd)}destroy(){this.dragging.destroy()}querySegEl(e){return e.subjectEl.closest(`.${y.internalEvent}`)}}function Sb(t,e,n,r){let s=t.context.dateEnv,i=t.dateSpan.range.start,a=e.dateSpan.range.start,o=bt(i,a,s,t.largeUnit);if(n){if(s.add(r.start,o)<r.end)return{startDelta:o}}else if(s.add(r.end,o)>r.start)return{endDelta:o};return null}class wb{constructor(e){this.context=e,this.isRecentPointerDateSelect=!1,this.matchesCancel=!1,this.matchesEvent=!1,this.onSelect=r=>{r.jsEvent&&(this.isRecentPointerDateSelect=!0)},this.onDocumentPointerDown=r=>{let s=this.context.options.unselectCancel,i=Tl(r.origEvent);this.matchesCancel=!!i.closest(s),this.matchesEvent=!!i.closest(cn.SELECTOR)},this.onDocumentPointerUp=r=>{let{context:s}=this,{documentPointer:i}=this,a=s.getCurrentData();if(!i.wasTouchScroll){if(a.dateSelection&&!this.isRecentPointerDateSelect){let o=s.options.unselectAuto;o&&(!o||!this.matchesCancel)&&s.calendarApi.unselect(r)}a.eventSelection&&!this.matchesEvent&&s.dispatch({type:"UNSELECT_EVENT"})}this.isRecentPointerDateSelect=!1};let n=this.documentPointer=new $l(document);n.shouldIgnoreMove=!0,n.shouldWatchScroll=!1,n.emitter.on("pointerdown",this.onDocumentPointerDown),n.emitter.on("pointerup",this.onDocumentPointerUp),e.emitter.on("select",this.onSelect)}destroy(){this.context.emitter.off("select",this.onSelect),this.documentPointer.destroy()}}var Db={name:"interaction",componentInteractions:[gb,mb,cn,Eb],calendarInteractions:[wb],elementDraggingImpl:ln};function ta(t){return String(t).padStart(2,"0")}function xb(t,e){if(t==="")return"";const[n,r]=t.split(":").map(Number),s=(n*60+r+e)%1440;return`${ta(Math.floor(s/60))}:${ta(s%60)}`}const Xl=60,Cb=864e5;function na(t,e,n){if(n){const r=t.slice(0,10),s=ke(e.slice(0,10),-1);return{...Kl(t),endDate:s<r?r:s}}return{date:t.slice(0,10),endDate:e.slice(0,10),startTime:t.slice(11,16),endTime:e.slice(11,16),allDay:!1}}function Tb(t,e){if(e)return Kl(t);const n=t.slice(11,16),r=xb(n,Xl),s=t.slice(0,10);return{date:s,endDate:r<n?ke(s,1):s,startTime:n,endTime:r,allDay:!1}}function Kl(t){return{date:t.slice(0,10),endDate:t.slice(0,10),startTime:"",endTime:"",allDay:!0}}function Rb(t,e,n,r){const s=Date.parse(e)-Date.parse(t);return Math.round(s/Cb)>1}const ie=15,Nb=4,_s=1440;function ra(t,e){return Math.hypot(t,e)>=Nb}function Mb(t,e){const n=t/e*60,r=Math.floor(n/ie)*ie;return Math.min(Math.max(r,0),_s-ie)}const sa=t=>String(t).padStart(2,"0");function qr(t){return`${sa(Math.floor(t/60))}:${sa(t%60)}`}function ia(t){const[e,n]=t.split(":").map(Number);return e*60+n}function Ib(t,e,n){const r=Math.min(e,n),s=Math.max(e,n)+ie;return Mt(t,r,s)}function Mt(t,e,n){const r=n>=_s;return{date:t,endDate:r?ke(t,1):t,startTime:qr(e),endTime:r?"00:00":qr(n),allDay:!1}}function Ke(t,e){return Mt(t,e,e+Xl)}function aa(t,e){const[n,r]=t<=e?[t,e]:[e,t];return{date:n,endDate:r,startTime:"",endTime:"",allDay:!0}}function Xr(t){const e=ia(t.startTime),n=t.endDate>t.date?_s:ia(t.endTime);return{start:e,end:n}}const kb=[Zy,Db],Pb={comfortable:3,compact:2},Ql="cal-1",jb={color:Ql,rsvp:"accepted",status:"confirmed",hasThread:!1,isRecurring:!1,zoneCertainty:"local"},Hb=(t,e)=>new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit"}).format(t),Ob=t=>t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey;function Ab({date:t,events:e,colorByCalendarId:n,density:r,selectedEventId:s,timeZone:i,now:a,onSelectEvent:o,onPickSlot:l,dayHref:c,onZoomDay:u,canMove:f=()=>!1,onMoveEvent:h,tasks:g=[],onSelectTask:v,className:m}){const E=S.useRef(null);S.useEffect(()=>{E.current?.getApi().gotoDate(t)},[t]);const C=S.useMemo(()=>new Map(g.map(D=>[D.calendarTaskId,D])),[g]),R=S.useMemo(()=>[...e.map(D=>({id:D.id,title:D.title,start:D.start,end:D.end,allDay:D.allDay,editable:h!==void 0&&f(D.id)})),...g.map(D=>({id:D.calendarTaskId,title:D.title,start:D.due,allDay:D.allDay,editable:!1}))],[e,g,f,h]),x=D=>{D.revert(),h?.(D.event.id,na(D.event.startStr,D.event.endStr===""?D.event.startStr:D.event.endStr,D.event.allDay))},T=S.useMemo(()=>new Map(e.map(D=>[D.id,{color:n[D.calendarId]??Ql,rsvp:D.myRsvp,status:D.status,hasThread:D.threadId!=="",isRecurring:D.recurrenceRule!=="",zoneCertainty:D.zoneCertainty}])),[e,n]),M=D=>T.get(D)??jb;return d.jsx("div",{"data-testid":"calendar-grid",className:j("h-full min-h-0 w-full text-fg",m),children:d.jsx(Ev,{ref:E,plugins:kb,initialView:"dayGridMonth",initialDate:t,now:a,timeZone:i,height:"100%",headerToolbar:!1,firstDay:1,fixedWeekCount:!1,selectable:!0,editable:!1,eventInteractive:!0,expandRows:!0,dayMaxEvents:Pb[r],dayCellTopContent:D=>{const N=Hb(D.date,i);return d.jsx("a",{href:c(N),"aria-label":`Open ${D.date.toLocaleDateString("en-GB",{dateStyle:"full",timeZone:i})}`,className:"hover:underline",onClick:P=>{Ob(P)||(P.preventDefault(),u(N))},children:Number(N.slice(8))})},dayCellDidMount:D=>{D.el.querySelector(":scope [aria-hidden='true']:has(> a)")?.removeAttribute("aria-hidden");const N=D.el.querySelector("a");for(const P of["mousedown","touchstart","pointerdown"])N?.addEventListener(P,H=>H.stopPropagation())},moreLinkClick:"popover",moreLinkText:D=>`+${D}`,displayEventEnd:!1,eventTimeFormat:{hour:"2-digit",minute:"2-digit",hour12:!1},dayHeaderFormat:{weekday:"short"},events:R,eventClick:D=>C.has(D.event.id)?v?.(D.event.id):o(D.event.id),eventDrop:x,eventResize:x,eventDidMount:D=>{D.el.setAttribute(C.has(D.event.id)?"data-task-id":"data-event-id",D.event.id)},dateClick:D=>l(Tb(D.dateStr,D.allDay)),select:D=>{if(!Rb(D.startStr,D.endStr)){D.view.calendar.unselect();return}l(na(D.startStr,D.endStr,!0))},viewClass:"bg-surface",tableClass:"border-line",tableHeaderClass:"bg-surface",fillerClass:"border-line",dayHeaderRowClass:"h-pane-header",dayHeaderClass:D=>j("border-b border-line bg-surface",D.isToday?"text-accent":"text-fg-subtle"),dayHeaderInnerClass:"px-1 py-1 text-2xs font-semibold uppercase tracking-wider",dayHeaderDividerClass:"border-b border-line",dayCellClass:D=>j("border-line",D.isOther&&"bg-surface-sunken"),dayCellTopInnerClass:D=>j("px-1 py-0.5 text-2xs tabular-nums",D.isToday?"font-semibold text-accent":"text-fg-muted"),dayRowClass:"border-line",highlightClass:"bg-accent-soft",moreLinkClass:"rounded-sm bg-surface-sunken text-2xs font-semibold text-fg-muted hover:bg-line hover:text-fg",moreLinkInnerClass:"px-1 py-0.5",popoverClass:"rounded-lg border border-line bg-surface-raised shadow-xl shadow-black/20",popoverCloseClass:"text-fg-subtle hover:text-fg",eventClass:D=>j(kr({color:M(D.event.id).color,layout:"row",density:"compact",rsvp:M(D.event.id).rsvp,status:M(D.event.id).status,selected:D.event.id===s,stacked:!1}),"my-px cursor-pointer px-1 py-0 outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring"),eventContent:D=>{const N=C.get(D.event.id);if(N)return d.jsxs("span",{className:j("flex min-w-0 items-center gap-1 truncate",N.completed&&"line-through opacity-60"),children:[d.jsx("span",{"aria-hidden":"true",children:N.completed?"☑":"☐"}),d.jsx("span",{className:"truncate",children:N.title===""?"(No title)":N.title})]});const P=M(D.event.id);return d.jsx(Na,{title:D.event.title,timeText:r==="compact"?"":D.timeText,layout:"row",rsvp:P.rsvp,hasThread:P.hasThread,isRecurring:P.isRecurring,zoneCertainty:P.zoneCertainty})}})})}function Lb(t){const e=[],n=new Map;for(const r of t){let s=n.get(r.accountId);s||(s={accountId:r.accountId,accountLabel:r.accountLabel,calendars:[]},n.set(r.accountId,s),e.push(r.accountId)),s.calendars.push(r)}return e.map(r=>n.get(r))}function _b({calendars:t,visible:e,onToggle:n,onToggleAccount:r,layout:s="list",touch:i,closedAccountIds:a,className:o}){const[l,c]=S.useState(()=>new Set(a??[])),u=f=>c(h=>{const g=new Set(h);return g.delete(f)||g.add(f),g});return s==="strip"?d.jsx("div",{className:j("flex items-center gap-1.5 overflow-x-auto px-row-inset",o),children:t.map(f=>{const h=sn(f.color),g=e.has(f.id);return d.jsxs("label",{className:j("inline-flex shrink-0 cursor-pointer items-center gap-1.5 rounded-full border px-2.5 text-xs transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",i?"min-h-9":"h-7",g?j(h.soft,h.text,h.border):"border-line text-fg-subtle"),children:[d.jsx("input",{type:"checkbox",checked:g,onChange:()=>n(f.id),className:"sr-only"}),d.jsx("span",{className:j("size-2 rounded-full border",h.border,g?h.solid:"bg-transparent")}),f.name]},f.id)})}):d.jsx("div",{className:j("flex flex-col gap-3",o),children:Lb(t).map(f=>{const h=f.calendars.every(v=>e.has(v.id)),g=!l.has(f.accountId);return d.jsxs("section",{className:"flex flex-col",children:[d.jsxs("div",{className:"flex items-center gap-2 px-row-inset pb-1",children:[d.jsxs("button",{type:"button",onClick:()=>u(f.accountId),"aria-expanded":g,className:j("flex min-w-0 flex-1 items-center gap-1.5 rounded-sm text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle outline-none transition-colors hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",i&&"min-h-11"),children:[g?d.jsx(bd,{className:"size-3 shrink-0"}):d.jsx(Vn,{className:"size-3 shrink-0"}),d.jsx("span",{className:"truncate",children:f.accountLabel})]}),r&&d.jsx("button",{type:"button",onClick:()=>r(f.accountId,!h),className:"rounded-sm text-2xs text-fg-subtle outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:h?"None":"All"})]}),g&&f.calendars.map(v=>d.jsx(Ub,{calendar:v,checked:e.has(v.id),touch:i,onToggle:()=>n(v.id)},v.id))]},f.accountId)})})}function Ub({calendar:t,checked:e,touch:n,onToggle:r}){const s=sn(t.color),i=t.sync==="paused",a=t.syncError??"";return d.jsxs("div",{className:"flex flex-col",children:[d.jsxs("label",{className:j("flex cursor-pointer items-center gap-2.5 rounded-sm px-row-inset hover:bg-surface-sunken",n?"min-h-11":"min-h-9"),children:[d.jsx("input",{type:"checkbox",checked:e,onChange:r,className:"peer sr-only"}),d.jsx("span",{"aria-hidden":!0,className:j("flex size-4 shrink-0 items-center justify-center rounded-xs border transition-colors","peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-1 peer-focus-visible:ring-offset-surface",e?j(s.solid,s.border):j("bg-transparent",s.border)),children:e&&d.jsx(cc,{className:"size-3 text-canvas",strokeWidth:3})}),d.jsx("span",{className:j("min-w-0 flex-1 truncate text-sm",e?"text-fg":"text-fg-subtle"),children:t.name}),i&&d.jsx(vd,{className:"size-3.5 shrink-0 text-fg-subtle","aria-hidden":!0}),a!==""&&d.jsx(Sa,{className:"size-3.5 shrink-0 text-danger","aria-hidden":!0})]}),i&&d.jsx("span",{className:"sr-only",children:`${t.name}: ${yd.Calendar}`}),a!==""&&d.jsx("p",{className:"px-row-inset pb-1 text-xs text-danger",children:d.jsx("span",{className:"block pl-6.5",children:`Not refreshed: ${a}`})})]})}const Nr={year:"Year",month:"Month",week:"Week",day:"Day",agenda:"Agenda"},Fb=["day","week","month","year","agenda"];function Bb({view:t,title:e,weekNumber:n,views:r=Fb,onChangeView:s,onPrev:i,onNext:a,onToday:o,sidePane:l,trailing:c,touch:u=!1,className:f}){const h=j("flex shrink-0 items-center justify-center rounded-full text-fg-muted outline-none transition-colors hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",u?"size-11":"size-9");return d.jsxs("div",{role:"toolbar","aria-label":"Calendar","data-calendar-toolbar":"",className:j("flex shrink-0 items-center gap-1 border-b border-line bg-surface px-2",u?"h-14":"h-14 gap-2",f),children:[l&&d.jsx("button",{type:"button","aria-label":"Side pane","aria-expanded":l.open,"aria-controls":l.controls,onClick:l.onToggle,className:h,children:d.jsx(Rd,{className:"size-5"})}),d.jsx("button",{type:"button",onClick:o,className:j("shrink-0 rounded-full border border-line px-4 text-sm font-medium text-fg outline-none transition-colors hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",u?"min-h-11":"h-9"),children:"Today"}),d.jsx("button",{type:"button",onClick:i,"aria-label":`Previous ${Nr[t].toLowerCase()}`,className:h,children:d.jsx(Ia,{className:"size-5"})}),d.jsx("button",{type:"button",onClick:a,"aria-label":`Next ${Nr[t].toLowerCase()}`,className:h,children:d.jsx(Vn,{className:"size-5"})}),d.jsx("h1",{className:j("min-w-0 truncate font-normal text-fg",u?"text-base":"text-xl"),children:e}),n!==void 0&&d.jsxs("span",{className:"shrink-0 rounded-md bg-surface-sunken px-2 py-0.5 text-xs font-medium text-fg-muted",children:["Week ",n]}),d.jsx("div",{className:"min-w-0 flex-1"}),!u&&c,d.jsx(Td,{"aria-label":"View",value:t,onChange:g=>{const v=r.find(m=>m===g.target.value);v&&s(v)},className:j("shrink-0",u?"h-11 w-24":"w-28"),children:r.map(g=>d.jsx("option",{value:g,children:Nr[g]},g))})]})}function Wb({id:t,onNewEvent:e,newEventRef:n,month:r,calendars:s,className:i}){return d.jsxs("section",{id:t,"aria-label":"Calendar side pane",className:j("flex w-64 shrink-0 flex-col gap-4 overflow-y-auto bg-surface px-3 py-3",i),children:[d.jsxs("button",{ref:n,type:"button",onClick:e,className:"flex h-12 w-fit items-center gap-3 rounded-2xl bg-surface-raised px-5 text-sm font-medium text-fg shadow-md outline-none transition-shadow hover:shadow-lg focus-visible:ring-2 focus-visible:ring-ring",children:[d.jsx(Ma,{className:"size-5 text-accent","aria-hidden":"true"}),"New event"]}),r,d.jsxs("section",{"aria-label":"My calendars",className:"flex flex-col gap-1",children:[d.jsx("h2",{className:"px-1 text-sm font-medium text-fg",children:"My calendars"}),s]})]})}function oa({onNewEvent:t,newEventRef:e,className:n}){return d.jsx("button",{ref:e,type:"button","aria-label":"New event",onClick:t,className:j("flex size-12 items-center justify-center rounded-2xl bg-surface-raised text-accent shadow-md outline-none hover:shadow-lg focus-visible:ring-2 focus-visible:ring-ring",n),children:d.jsx(Ma,{className:"size-6","aria-hidden":"true"})})}const Bn=1440;function Vb(t,e){return Math.round(t/e*60/ie)*ie}function Tn(t,e){const n=t.minute+e,r=Math.floor(n/Bn);return{date:ke(t.date,r),minute:n-r*Bn}}const Jl=(t,e)=>{let n=0,r=t.date;for(;r<e.date;)r=ke(r,1),n+=1;return n*Bn+e.minute-t.minute};function zb(t,e,n,r){const s=Jl(t,e),i=Tn({date:ke(t.date,n),minute:t.minute},r),a={date:i.date,minute:Math.round(i.minute/ie)*ie},o=a.minute===Bn?Tn(a,0):a;return{start:o,end:Tn(o,s)}}function $b(t,e,n){const r=Math.max(Jl(t,e)+n,ie),s=Math.round(r/ie)*ie;return Tn(t,s)}function Yb(t,e,n){return{first:ke(t,n),last:ke(e,n)}}function Gb(t,e,n){const r=ke(e,n);return r<t?t:r}const Zb=1440-ie;function Kr(t,e,n){return{date:t.includes(e)?e:t[0],minute:Math.floor(n/60)*60}}function qb(t,e,n){const r=n.indexOf(t.date);switch(e){case"ArrowUp":return{...t,minute:Math.max(0,t.minute-ie)};case"ArrowDown":return{...t,minute:Math.min(Zb,t.minute+ie)};case"ArrowLeft":return{...t,date:n[Math.max(0,r-1)]};case"ArrowRight":return{...t,date:n[Math.min(n.length-1,r+1)]};default:return null}}const Xb=(t,e)=>t.date===e.date?t.minute-e.minute:t.date<e.date?-1:1;function la(t,e){const[n,r]=Xb(t,e)<=0?[t,e]:[e,t];if(n.date===r.date)return Mt(n.date,n.minute,r.minute+ie);const s=Mt(r.date,r.minute,r.minute+ie);return{date:n.date,startTime:qr(n.minute),endDate:s.endDate,endTime:s.endTime,allDay:!1}}const Qr=500,Kb=8;function ca(t,e,n){return{phase:"pending",x:t,y:e,at:n}}function da(t,e,n){return t.phase!=="pending"?t:Math.hypot(e-t.x,n-t.y)>Kb?{phase:"scrolled"}:t}function ua(t,e){return t.phase!=="pending"?t:e-t.at>=Qr?{phase:"held"}:t}function fa(t,e,n,r){const s=Math.round(n/r*(60/ie)),{start:i,end:a}=Xr(t),o=s*ie;if(e==="start"){const c=Math.min(Math.max(0,i+o),a-ie);return Mt(t.date,c,a)}const l=Math.max(Math.min(1440,a+o),i+ie);return Mt(t.date,i,l)}const ha=new Map;function Qb(t){let e=ha.get(t);return e||(e=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),ha.set(t,e)),e}function Se(t,e){const n=Object.fromEntries(Qb(e).formatToParts(new Date(t)).map(r=>[r.type,r.value]));return{date:`${n.year}-${n.month}-${n.day}`,minute:Number(n.hour)*60+Number(n.minute)}}function Jb(t,e){const n=e.filter(o=>o.start.date<=t&&o.end.date>=t).map(o=>({id:o.id,top:o.start.date<t?0:o.start.minute,bottom:o.end.date>t?1440:o.end.minute})).filter(o=>o.bottom>o.top||o.top===o.bottom).map(o=>({...o,bottom:Math.max(o.bottom,o.top+15)})).sort((o,l)=>o.top-l.top||l.bottom-o.bottom),r=[];let s=[],i=-1;const a=()=>{const o=Math.max(0,...s.map(l=>l.column))+1;for(const l of s)l.columns=o;r.push(...s),s=[]};for(const o of n){o.top>=i&&s.length>0&&a();const l=new Set(s.filter(u=>u.bottom>o.top).map(u=>u.column));let c=0;for(;l.has(c);)c+=1;s.push({...o,column:c,columns:1}),i=Math.max(i,o.bottom)}return s.length>0&&a(),r}function Mr(t,e){const n=[],r=[],s=e.filter(i=>i.last>=t[0]&&i.first<=t[t.length-1]).sort((i,a)=>i.first.localeCompare(a.first)||a.last.localeCompare(i.last));for(const i of s){const a=Math.max(0,t.indexOf(i.first<t[0]?t[0]:i.first)),o=i.last>t[t.length-1]?t[t.length-1]:i.last,l=t.indexOf(o);let c=n.findIndex(u=>u.every(f=>f<a||f>l));c===-1&&(c=n.length,n.push([]));for(let u=a;u<=l;u+=1)n[c].push(u);r.push({id:i.id,startIndex:a,span:l-a+1,lane:c})}return r}const eE={comfortable:48,compact:24},tE=Array.from({length:24},(t,e)=>e),mt=22,ga="cal-1",Jr=t=>String(t).padStart(2,"0"),Et=t=>`${Jr(Math.floor(t/60)%24)}:${Jr(t%60)}`,St=(t,e)=>new Intl.DateTimeFormat(void 0,{...e,timeZone:"UTC"}).format(new Date(`${t}T00:00:00Z`));function ma(t){const e=St(t.date,{weekday:"long",day:"numeric",month:"long"});return t.allDay?t.endDate===t.date?`${e}, all day`:`${e} to ${St(t.endDate,{weekday:"long",day:"numeric",month:"long"})}, all day`:`${e}, ${t.startTime} to ${t.endTime}`}function nE(t,e){return new Intl.DateTimeFormat("en-GB",{timeZone:t,timeZoneName:"short"}).formatToParts(new Date(e)).find(r=>r.type==="timeZoneName")?.value??""}function rE({days:t,events:e,colorByCalendarId:n,density:r,timeZone:s,now:i,selectedEventId:a="",draft:o,onGesture:l,onSelectEvent:c,onOpenDay:u,touch:f=!1,canMove:h=()=>!1,onMoveEvent:g,tasks:v=[],selectedTaskId:m="",onSelectTask:E,onToggleTask:C,className:R}){const x=eE[r],T=S.useRef(null),M=S.useRef(null),D=S.useRef(null),N=S.useRef(null),P=S.useRef(null),H=S.useRef(void 0),[U,te]=S.useState(null),[W,V]=S.useState(null),[ne,ae]=S.useState(!1),[le,Pe]=S.useState(""),Ie=S.useId(),re=Se(i,s),xe=S.useMemo(()=>e.map(p=>({event:p,start:Se(p.start,s),end:Se(p.end,s)})),[e,s]),Ge=xe.filter(p=>!p.event.allDay),Ze=xe.filter(p=>p.event.allDay),_=S.useMemo(()=>new Map(xe.map(p=>[p.event.id,p.event])),[xe]),q=S.useMemo(()=>new Map(v.map(p=>[p.calendarTaskId,{task:p,date:p.allDay?p.due.slice(0,10):Se(p.due,s).date,minute:p.allDay?0:Se(p.due,s).minute}])),[v,s]),oe=Mr(t,[...Ze.map(p=>({id:p.event.id,first:p.event.start.slice(0,10),last:pa(p.event)})),...[...q.values()].map(({task:p,date:w})=>({id:p.calendarTaskId,first:w,last:w}))]),ce=o?.range.allDay===!0?Mr(t,[{id:"draft",first:o.range.date,last:o.range.endDate}])[0]:void 0,F=Math.max(1,...oe.map(p=>p.lane+1),ce?1:0),de=t.join(","),je=t.includes(re.date)?Math.max(0,re.minute-90):480,ut=S.useRef(je);ut.current=je,S.useLayoutEffect(()=>{const p=T.current;!p||de===""||(p.scrollTop=ut.current/60*x)},[de,x]);const Ee=S.useRef(null),Q=S.useRef(null),Ce=S.useRef(void 0),ft=S.useRef(!1),[pe,_t]=S.useState(null),Te=S.useCallback(()=>{Q.current=null,clearTimeout(Ce.current),_t(null)},[]),Re=S.useCallback(()=>{N.current=null,P.current=null,clearTimeout(H.current)},[]);S.useEffect(()=>{const p=w=>{if(w.key==="Escape"){if(Q.current?.dragging){w.preventDefault(),w.stopImmediatePropagation(),ft.current=!0,Te();return}N.current&&(w.preventDefault(),w.stopImmediatePropagation(),Re(),l({type:"drag-cancel"}))}};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[Re,Te,l]),S.useEffect(()=>{const p=T.current;if(!p)return;const w=A=>{(P.current?.phase==="held"||N.current?.dragging||Q.current?.dragging)&&A.preventDefault()};return p.addEventListener("touchmove",w,{passive:!1}),()=>p.removeEventListener("touchmove",w)},[]);const qe=p=>{const w=M.current;if(!w)return;const A=w.getBoundingClientRect(),L=Math.floor((p-A.left)/A.width*t.length);return t[Math.min(t.length-1,Math.max(0,L))]},dn=p=>{const w=M.current;return w?Mb(p-w.getBoundingClientRect().top,x):0},He=p=>Pe(ma(p)),un=(p,w,A)=>{if(p.stopPropagation(),p.button!==0||!h(w.id)||!g)return;const L=qe(p.clientX);if(!L)return;En(p.currentTarget,p.pointerId);const z=f&&p.pointerType==="touch";Q.current={id:w.id,kind:A,allDay:w.allDay,pointerId:p.pointerId,x:p.clientX,y:p.clientY,startColumn:L,start:Se(w.start,s),end:Se(w.end,s),first:w.start.slice(0,10),last:pa(w),dragging:!1,press:z?ca(p.clientX,p.clientY,Date.now()):null,range:null,invalid:!1},z&&(Ce.current=setTimeout(()=>{const Y=Q.current;Y?.press&&(Y.press=ua(Y.press,Date.now()+1),Y.press.phase==="held"&&(Y.dragging=!0,navigator.vibrate?.(10),Ut(Y,Y.x,Y.y)))},Qr))},Ut=(p,w,A)=>{const L=t.indexOf(qe(w)??p.startColumn)-t.indexOf(p.startColumn),z=Vb(A-p.y,x);let Y;if(p.allDay){const Xe=p.kind==="move"?Yb(p.first,p.last,L):{first:p.first,last:Gb(p.first,p.last,L)};Y={date:Xe.first,endDate:Xe.last,startTime:"",endTime:"",allDay:!0}}else{const Xe=p.kind==="move"?zb(p.start,p.end,L,z):{start:p.start,end:$b(p.start,p.end,z)};Y={date:Xe.start.date,endDate:Xe.end.date,startTime:Et(Xe.start.minute),endTime:Et(Xe.end.minute),allDay:!1}}const Ne=Ee.current?.getBoundingClientRect(),$s=Ne!==void 0&&(w<Ne.left||w>Ne.right||A<Ne.top||A>Ne.bottom);p.range=Y,p.invalid=$s,_t({id:p.id,range:Y,invalid:$s})},ue=p=>{const w=Q.current;if(!(!w||w.pointerId!==p.pointerId)){if(w.press){if(w.press=da(w.press,p.clientX,p.clientY),w.press.phase==="scrolled"){Te();return}if(w.press.phase!=="held")return}else if(!w.dragging&&!ra(p.clientX-w.x,p.clientY-w.y))return;w.dragging=!0,Ut(w,p.clientX,p.clientY)}},Ft=p=>{const w=Q.current;if(!w||w.pointerId!==p.pointerId)return;w.dragging&&(ft.current=!0);const{range:A,invalid:L,dragging:z,id:Y}=w;Te(),!(!z||!A||L)&&(He(A),g?.(Y,A))},dr=p=>{if(p.button!==0)return;const w=qe(p.clientX);if(!w)return;const A=p.currentTarget;En(A,p.pointerId);const L=dn(p.clientY);if(f&&p.pointerType==="touch"){P.current=ca(p.clientX,p.clientY,Date.now()),N.current={kind:"touch",pointerId:p.pointerId,date:w,anchorMinute:L,x:p.clientX,y:p.clientY,dragging:!1,range:null,origin:A},H.current=setTimeout(()=>{if(!P.current||!N.current||(P.current=ua(P.current,Date.now()+1),P.current.phase!=="held"))return;const z=Ke(w,L);N.current.dragging=!0,N.current.range=z,navigator.vibrate?.(10),l({type:"drag",range:z})},Qr);return}N.current={kind:"timed",pointerId:p.pointerId,date:w,anchorMinute:L,x:p.clientX,y:p.clientY,dragging:!1,range:null,origin:A}},ht=p=>{if(p.button!==0||f&&p.pointerType==="touch")return;const w=qe(p.clientX);w&&(En(p.currentTarget,p.pointerId),N.current={kind:"all-day",pointerId:p.pointerId,date:w,anchorMinute:0,x:p.clientX,y:p.clientY,dragging:!1,range:null,origin:p.currentTarget})},fn=(p,w)=>{o&&(w.stopPropagation(),En(w.currentTarget,w.pointerId),N.current={kind:p==="start"?"handle-start":"handle-end",pointerId:w.pointerId,date:o.range.date,anchorMinute:0,x:w.clientX,y:w.clientY,dragging:!0,range:o.range,origin:w.currentTarget})},Ue=p=>{const w=N.current;if(!w||w.pointerId!==p.pointerId)return;const A=p.clientX-w.x,L=p.clientY-w.y;if(w.kind==="touch"){if(!P.current)return;if(P.current=da(P.current,p.clientX,p.clientY),P.current.phase==="scrolled"){Re();return}if(P.current.phase!=="held")return;const Y=fa(Ke(w.date,w.anchorMinute),"end",L,x);w.range=Y,l({type:"drag",range:Y});return}if(w.kind==="handle-start"||w.kind==="handle-end"){if(!o)return;const Y=fa(w.range??o.range,w.kind==="handle-start"?"start":"end",L,x);l({type:"drag",range:Y});return}if(!w.dragging&&!ra(A,L))return;w.dragging=!0;const z=w.kind==="all-day"?aa(w.date,qe(p.clientX)??w.date):Ib(w.date,w.anchorMinute,dn(p.clientY));w.range=z,l({type:"drag",range:z})},Fe=p=>{const w=N.current;if(!w||w.pointerId!==p.pointerId)return;if(w.kind==="handle-start"||w.kind==="handle-end"){const L=o?.range;Re(),L&&(He(L),l({type:"drag-end",range:L}));return}if(w.kind==="touch"){const L=w.range,z=P.current?.phase==="pending";if(Re(),L){He(L),l({type:"drag-end",range:L});return}z&&l({type:"click",range:Ke(w.date,w.anchorMinute),origin:w.origin});return}if(Re(),w.dragging&&w.range){He(w.range),l({type:"drag-end",range:w.range});return}const A=w.kind==="all-day"?aa(w.date,w.date):Ke(w.date,w.anchorMinute);l({type:"click",range:A,origin:w.origin})},Bt=p=>{const w=N.current;if(!w||w.pointerId!==p.pointerId)return;const A=w.dragging;Re(),A&&l({type:"drag-cancel"})},ur=p=>{if(p.target!==p.currentTarget)return;ae(!0);const w=U??Kr(t,re.date,re.minute);if(p.key==="Enter"){p.preventDefault();const L=W?la(W,w):Ke(w.date,w.minute),z=document.getElementById(Ie);V(null),He(L),l({type:"keyboard",range:L,origin:z});return}if(p.key==="Escape"&&W){p.preventDefault(),p.stopPropagation(),V(null),l({type:"drag-cancel"});return}const A=qb(w,p.key,t);if(A){if(p.preventDefault(),te(A),Z(A.minute),p.shiftKey){const L=W??w;V(L);const z=la(L,A);He(z),l({type:"drag",range:z});return}W&&(V(null),l({type:"drag-cancel"}))}},Z=p=>{const w=T.current;if(!w)return;const A=p/60*x;A<w.scrollTop?w.scrollTop=A:A+x>w.scrollTop+w.clientHeight&&(w.scrollTop=A+x-w.clientHeight)},he=U&&t.includes(U.date)?U:Kr(t,re.date,re.minute),ge=(p,w,A)=>{const L=n[p.calendarId]??ga,z=p.allDay||r==="compact"&&!A?"":Et(Se(p.start,s).minute),Y=g!==void 0&&h(p.id);return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button","data-event-id":p.id,onPointerDown:Ne=>un(Ne,p,"move"),onPointerMove:ue,onPointerUp:Ft,onPointerCancel:Te,onClick:Ne=>{if(ft.current){ft.current=!1;return}c(p.id,Ne.currentTarget)},"aria-label":`${p.title}, ${sE(p,s)}`,className:j(kr({color:L,layout:w,density:"compact",rsvp:p.myRsvp,status:p.status,selected:p.id===a,stacked:!1}),"h-full w-full cursor-pointer text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",f&&"touch-pan-y",pe?.id===p.id&&"opacity-40"),children:d.jsx(Na,{title:p.title===""?"(No title)":p.title,timeText:z,layout:w,rsvp:p.myRsvp,hasThread:p.threadId!=="",isRecurring:p.recurrenceRule!=="",zoneCertainty:p.zoneCertainty})}),Y&&d.jsx("span",{"aria-hidden":"true","data-resize-handle":"",onPointerDown:Ne=>un(Ne,p,"resize"),onPointerMove:ue,onPointerUp:Ft,onPointerCancel:Te,className:j("absolute",w==="column"?"inset-x-0 bottom-0 h-1.5 cursor-ns-resize":"inset-y-0 right-0 w-1.5 cursor-ew-resize"),style:{touchAction:"none"}})]})},ve=(p,w)=>{const A=p.title===""?"(No title)":p.title,L=n[p.calendarId]??ga,z=w===void 0?"":Et(w);return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button","data-task-id":p.calendarTaskId,onPointerDown:Y=>Y.stopPropagation(),onClick:()=>E?.(p.calendarTaskId),"aria-label":`Task: ${A}${z===""?"":`, due ${z}`}`,className:j(kr({color:L,layout:"row",density:"compact",rsvp:"accepted",status:"confirmed",selected:p.calendarTaskId===m,stacked:!1}),"h-full w-full cursor-pointer truncate pl-5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",p.completed&&"line-through opacity-60"),children:z===""?A:`${z} ${A}`}),d.jsx("input",{type:"checkbox","aria-label":A,checked:p.completed,onPointerDown:Y=>Y.stopPropagation(),onChange:()=>C?.(p.calendarTaskId),className:"absolute top-1 left-1.5 z-10 size-3.5 accent-current"})]})},hn=p=>p.allDay?St(p.date,{weekday:"short",day:"numeric"}):`${St(p.date,{weekday:"short",day:"numeric"})} · ${p.startTime} – ${p.endTime}`,Bs=(p,w)=>d.jsx("div",{"data-lifted-event":"",className:j("pointer-events-none absolute inset-0 z-30 flex flex-col overflow-hidden rounded-sm border-2 border-accent bg-accent-soft px-1.5 py-0.5 text-xs text-fg shadow-lg",w&&"border-dashed opacity-60"),children:d.jsx("span",{className:"truncate font-medium tabular-nums",children:hn(p)})}),Ws=(p,w)=>{if(!o)return null;const A=sn("cal-1");return d.jsx("div",{"data-draft-block":"",className:j("pointer-events-auto absolute z-20 flex flex-col overflow-hidden rounded-sm px-1.5 py-0.5 text-xs shadow-md",o.tone==="draft"?j("border-2 border-dashed bg-surface/90",A.border,A.text):"bg-accent text-accent-fg",w),children:p})},Vs=o?.title===""?"New event":o?.title??"",zs=p=>d.jsx("span",{"data-handle":p,"aria-hidden":"true",onPointerDown:w=>fn(p,w),onPointerMove:Ue,onPointerUp:Fe,onPointerCancel:Bt,className:j("absolute inset-x-0 cursor-ns-resize",p==="start"?"top-0":"bottom-0",f?"h-6":"h-2"),style:{touchAction:"none"},children:f&&d.jsx("span",{className:j("absolute size-3 rounded-full border-2 border-accent bg-surface",p==="start"?"top-0 left-3 -translate-y-1/2":"right-3 bottom-0 translate-y-1/2")})}),oc=o?d.jsxs(d.Fragment,{children:[o.tone==="draft"&&d.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider",children:"Draft"}),d.jsxs("span",{className:"flex items-center gap-1 truncate font-medium",children:[o.warning&&d.jsx(Sa,{className:"size-3.5 shrink-0","aria-label":"Not saved"}),Vs]}),d.jsxs("span",{className:"tabular-nums opacity-90",children:[o.range.startTime," – ",o.range.endTime]}),o.handles&&d.jsxs(d.Fragment,{children:[zs("start"),zs("end")]})]}):null;return d.jsxs("div",{ref:Ee,"data-testid":"calendar-grid",className:j("flex h-full min-h-0 flex-col bg-surface text-fg select-none",R),children:[d.jsxs("div",{className:"flex shrink-0 border-b border-line",children:[d.jsx("div",{className:"flex w-14 shrink-0 items-end justify-end pr-2 pb-1 text-2xs text-fg-subtle",children:nE(s,i)}),d.jsx("div",{className:"grid flex-1",style:{gridTemplateColumns:`repeat(${t.length}, minmax(0, 1fr))`},children:t.map(p=>{const w=p===re.date;return d.jsxs("div",{className:"flex flex-col items-center gap-0.5 border-l border-line py-1",children:[d.jsx("span",{className:j("text-2xs font-medium uppercase tracking-wider",w?"text-accent":"text-fg-subtle"),children:St(p,{weekday:"short"})}),d.jsx("button",{type:"button",onClick:()=>u?.(p),"aria-label":St(p,{weekday:"long",day:"numeric",month:"long",year:"numeric"}),"aria-current":w?"date":void 0,className:j("flex size-9 items-center justify-center rounded-full text-xl tabular-nums outline-none focus-visible:ring-2 focus-visible:ring-ring",w?"bg-accent text-accent-fg":"text-fg hover:bg-surface-sunken"),children:Number(p.slice(8))})]},p)})})]}),d.jsxs("div",{className:"flex shrink-0 border-b border-line-strong",children:[d.jsx("div",{className:"flex w-14 shrink-0 items-start justify-end pt-1 pr-2 text-2xs text-fg-subtle",children:"All day"}),d.jsxs("div",{ref:D,"data-all-day-row":"",onPointerDown:ht,onPointerMove:Ue,onPointerUp:Fe,onPointerCancel:Bt,className:"relative flex-1",style:{height:F*mt+6},children:[d.jsx("div",{className:"pointer-events-none absolute inset-0 grid",style:{gridTemplateColumns:`repeat(${t.length}, minmax(0, 1fr))`},children:t.map(p=>d.jsx("div",{className:"border-l border-line"},p))}),oe.map(p=>{const w=_.get(p.id),A=q.get(p.id);return!w&&!A?null:d.jsx("div",{className:"absolute px-0.5",style:{left:`${p.startIndex/t.length*100}%`,width:`${p.span/t.length*100}%`,top:2+p.lane*mt,height:mt-2},children:w?ge(w,"row",!1):A&&ve(A.task,A.task.allDay?void 0:A.minute)},p.id)}),pe?.range.allDay&&(()=>{const p=Mr(t,[{id:"lifted",first:pe.range.date,last:pe.range.endDate}])[0];return p?d.jsx("div",{className:"absolute px-0.5",style:{left:`${p.startIndex/t.length*100}%`,width:`${p.span/t.length*100}%`,top:2,height:mt-2},children:Bs(pe.range,pe.invalid)}):null})(),ce&&d.jsx("div",{className:"absolute px-0.5",style:{left:`${ce.startIndex/t.length*100}%`,width:`${ce.span/t.length*100}%`,top:2+(F-1)*mt,height:mt-2},children:Ws(d.jsx("span",{className:"truncate font-medium",children:Vs}),"inset-0")})]})]}),d.jsx("div",{ref:T,role:"grid","aria-label":"Time grid","aria-activedescendant":ne?Ie:void 0,tabIndex:0,onKeyDown:ur,onFocus:p=>{p.target===p.currentTarget&&p.currentTarget.matches(":focus-visible")&&ae(!0)},onBlur:()=>ae(!1),className:"relative min-h-0 flex-1 overflow-y-auto outline-none",children:d.jsxs("div",{className:"flex",style:{height:24*x},children:[d.jsx("div",{className:"relative w-14 shrink-0","aria-hidden":"true",children:tE.slice(1).map(p=>d.jsxs("span",{className:"absolute right-2 -translate-y-1/2 text-2xs tabular-nums text-fg-subtle",style:{top:p*x},children:[Jr(p),":00"]},p))}),d.jsx("div",{ref:M,"data-time-columns":"",onPointerDown:dr,onPointerMove:Ue,onPointerUp:Fe,onPointerCancel:Bt,className:"relative grid flex-1",style:{gridTemplateColumns:`repeat(${t.length}, minmax(0, 1fr))`,touchAction:f?"pan-y":void 0,backgroundImage:`repeating-linear-gradient(to bottom, var(--color-line) 0 1px, transparent 1px ${x}px)`},children:t.map(p=>{const w=Jb(p,Ge.map(L=>({id:L.event.id,start:L.start,end:L.end}))),A=o&&!o.range.allDay&&o.range.date===p?Xr(o.range):void 0;return d.jsxs("div",{"data-date":p,className:"relative border-l border-line",children:[w.map(L=>{const z=_.get(L.id);if(!z)return null;const Y=(L.bottom-L.top)/60*x;return d.jsx("div",{className:"absolute px-px",style:{top:L.top/60*x,height:Math.max(Y,12),left:`${L.column/L.columns*100}%`,width:`${100/L.columns}%`},children:ge(z,"column",Y>=36)},L.id)}),p===re.date&&d.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute right-0 left-0 z-10 border-t-2 border-danger",style:{top:re.minute/60*x},children:d.jsx("span",{className:"absolute -top-[5px] -left-1 size-2 rounded-full bg-danger"})}),ne&&he.date===p&&d.jsx("div",{role:"row",tabIndex:-1,className:"pointer-events-none absolute right-0 left-0 z-30",style:{top:he.minute/60*x,height:x/4},children:d.jsx("div",{id:Ie,role:"gridcell",tabIndex:-1,"aria-label":ma(Ke(he.date,he.minute)).replace(/ to .*/,""),className:"h-full rounded-xs ring-2 ring-ring"})}),pe&&!pe.range.allDay&&pe.range.date===p&&(()=>{const L=Xr(pe.range);return d.jsx("div",{className:"absolute right-1 left-0",style:{top:L.start/60*x,height:Math.max((L.end-L.start)/60*x,12)},children:Bs(pe.range,pe.invalid)})})(),A&&d.jsx("div",{className:"absolute right-1 left-0",style:{top:A.start/60*x,height:(A.end-A.start)/60*x},children:Ws(oc,"inset-0")})]},p)})})]})}),d.jsx("div",{"aria-live":"polite",className:"sr-only",children:le})]})}function En(t,e){try{t.setPointerCapture(e)}catch{}}function pa(t){const e=t.end.slice(0,10);if(!t.allDay)return e;const[n,r,s]=e.split("-").map(Number),a=new Date(Date.UTC(n,r-1,s-1)).toISOString().slice(0,10);return a<t.start.slice(0,10)?t.start.slice(0,10):a}function sE(t,e){if(t.allDay)return"all day";const n=Se(t.start,e),r=Se(t.end,e);return`${Et(n.minute)} to ${Et(r.minute)}`}function iE(t){return j("flex cursor-pointer items-center justify-center rounded-md px-2 font-medium transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",t?"bg-accent-2-soft text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg")}function aE({options:t,value:e,onChange:n,touch:r,ariaLabel:s,className:i}){const a=S.useId();return d.jsxs("fieldset",{className:j("inline-flex items-center gap-0.5",i),children:[d.jsx("legend",{className:"sr-only",children:s}),t.map(o=>d.jsxs("label",{className:j(iE(e===o.value),r?"min-h-11 flex-1 text-sm":"h-7 text-xs"),children:[d.jsx("input",{type:"radio",name:a,value:o.value,checked:e===o.value,onChange:()=>n(o.value),className:"sr-only"}),r?o.shortLabel:o.label]},o.value))]})}const Us=t=>{const[e,n,r]=t.split("-").map(Number);return new Date(Date.UTC(e,n-1,r))},ec=t=>t.toISOString().slice(0,10);function tn(t){const e=Us(t);return e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+6)%7),ec(e)}function nn(t,e){const n=Us(t);return Array.from({length:e},(r,s)=>{const i=new Date(n);return i.setUTCDate(n.getUTCDate()+s),ec(i)})}const Be=(t,e,n)=>new Intl.DateTimeFormat(n,{...e,timeZone:"UTC"}).format(Us(t));function oE(t,e,n){if(t==="year")return Be(e,{year:"numeric"},n);if(t==="day")return Be(e,{weekday:"long",day:"numeric",month:"long",year:"numeric"},n);if(t!=="week")return Be(e,{month:"long",year:"numeric"},n);const[r,,,,,,s]=nn(tn(e),7);return r.slice(0,7)===s.slice(0,7)?Be(r,{month:"long",year:"numeric"},n):r.slice(0,4)===s.slice(0,4)?`${Be(r,{month:"short"},n)} – ${Be(s,{month:"short",year:"numeric"},n)}`:`${Be(r,{month:"short",year:"numeric"},n)} – ${Be(s,{month:"short",year:"numeric"},n)}`}const va=864e5,lE=t=>{const[e,n,r]=t.split("-").map(Number);return new Date(Date.UTC(e,n-1,r))};function tc(t){const e=lE(t),n=(e.getUTCDay()+6)%7,r=new Date(e.getTime()+(3-n)*va),s=Date.UTC(r.getUTCFullYear(),0,1);return Math.floor((r.getTime()-s)/va/7)+1}function es(t,e){const[n,r]=t.split("-").map(Number),s=n*12+(r-1)+e,i=Math.floor(s/12),a=s%12+1;return`${i}-${String(a).padStart(2,"0")}-01`}function cE({month:t,today:e,rangeStart:n,rangeEnd:r}){const s=`${t.slice(0,7)}-01`,i=es(s,1),a=[];let o=tn(s);for(;o<i;){const l=nn(o,7).map(c=>({date:c,day:Number(c.slice(8)),inMonth:c.slice(0,7)===s.slice(0,7),isToday:c===e,inRange:n!==""&&c>=n&&c<=r}));a.push({weekNumber:tc(o),days:l}),o=nn(o,8)[7]}return a}const dE=["M","T","W","T","F","S","S"],ya=t=>new Intl.DateTimeFormat(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric",timeZone:"UTC"}).format(new Date(`${t}T00:00:00Z`)),uE=t=>new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric",timeZone:"UTC"}).format(new Date(`${t.slice(0,7)}-01T00:00:00Z`));function nc({month:t,today:e,rangeStart:n="",rangeEnd:r="",onPickDay:s,onShowMonth:i,counts:a,className:o}){const l=cE({month:t,today:e,rangeStart:n,rangeEnd:r}),c=uE(t);return d.jsxs("section",{"aria-label":c,className:j("select-none",o),children:[d.jsxs("div",{className:"flex items-center justify-between px-1 pb-1",children:[d.jsx("h2",{className:"text-sm font-medium text-fg",children:c}),i&&d.jsxs("div",{className:"flex",children:[d.jsx("button",{type:"button","aria-label":"Previous month",onClick:()=>i(es(t,-1)),className:"flex size-7 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:d.jsx(Ia,{className:"size-4"})}),d.jsx("button",{type:"button","aria-label":"Next month",onClick:()=>i(es(t,1)),className:"flex size-7 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:d.jsx(Vn,{className:"size-4"})})]})]}),d.jsxs("table",{className:"w-full border-collapse text-center text-2xs",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"text-fg-subtle",children:[d.jsx("th",{scope:"col",className:"w-6 font-normal",children:d.jsx("span",{className:"sr-only",children:"Week"})}),dE.map((u,f)=>d.jsx("th",{scope:"col",className:"h-6 font-normal",children:u},f))]})}),d.jsx("tbody",{children:l.map(u=>d.jsxs("tr",{children:[d.jsx("th",{scope:"row",className:"font-normal text-fg-subtle tabular-nums",children:u.weekNumber}),u.days.map(f=>{const h=a?.[f.date]??0,g=a===void 0?ya(f.date):`${ya(f.date)}, ${h===1?"1 event":`${h} events`}`;return d.jsx("td",{className:j("p-0",f.inRange&&"bg-accent-soft"),children:d.jsxs("button",{type:"button","aria-label":g,"aria-current":f.isToday?"date":void 0,"data-date":f.date,onClick:()=>s(f.date),className:j("relative mx-auto flex size-7 items-center justify-center rounded-full tabular-nums outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",f.isToday?"bg-accent font-semibold text-accent-fg":"hover:bg-surface-sunken",!f.isToday&&!f.inMonth&&"text-fg-subtle"),children:[f.day,h>0&&!f.isToday&&d.jsx("span",{"aria-hidden":"true",className:"absolute bottom-0.5 size-1 rounded-full bg-accent"})]})},f.date)})]},u.days[0].date))})]})]})}const fE=Array.from({length:12},(t,e)=>String(e+1).padStart(2,"0"));function hE({date:t,today:e,counts:n,onPickDay:r,className:s}){const i=t.slice(0,4);return d.jsx("div",{"data-calendar-year":"",className:j("grid h-full content-start gap-x-8 gap-y-6 overflow-y-auto p-6 [grid-template-columns:repeat(auto-fill,minmax(15rem,1fr))]",s),children:fE.map(a=>d.jsx(nc,{month:`${i}-${a}-01`,today:e,onPickDay:r,counts:n},a))})}function gE(){const t=dc(),{updateEvent:e}=Ec();return S.useCallback(async(n,r,s,i)=>{const{calendarObjectId:a,recurrenceId:o}=Da(n.id),l=await t.fetchQuery({...fc({path:{calendarObjectId:a},query:{calendarId:n.calendarId}}),meta:uc(404),staleTime:0}).catch(h=>({unread:gd(h)}));if("unread"in l)return{kind:"refused",message:l.unread};const c=Dd(n,{repeat:"",location:"",notes:"",guests:[]}),u={...c,date:r.date,endDate:r.endDate,startTime:r.startTime,endTime:r.endTime,allDay:r.allDay},f=xd(c,u,{clock:vt(),anchor:Mc(l.icalData,i===""?Sc:i)});return f.ok?e({calendarObjectId:a,calendarId:n.calendarId,recurrenceId:o,scope:s,etag:l.etag},f.patch):{kind:"refused",message:f.problem}},[t,e])}const wt={mode:"idle",dragging:null},Fs=t=>({mode:"quick",dragging:null,draft:t,status:"editing",problem:""}),rn=t=>({range:t,title:"",location:"",calendarId:"",guests:[]});function rc(t,e){return t.dragging?"drag":t.mode==="quick"?"popup":e.eventPopup?"event-popup":e.sidebar?"sidebar":e.nav?"nav":null}function mE(t,e){return t.mode==="quick"?{...t,dragging:null,draft:{...t.draft,range:e},status:t.status==="saving"?"saving":"editing"}:t.mode==="sidebar"?{...t,dragging:null,draft:{...t.draft,range:e}}:Fs(rn(e))}function pE(t,e,n){switch(e.type){case"drag":return{...t,dragging:e.range};case"drag-cancel":return{...t,dragging:null};case"drag-end":case"keyboard":return n.sidebar&&t.mode!=="sidebar"?{mode:"sidebar",dragging:null,draft:rn(e.range)}:mE(t,e.range);case"click":return t.mode==="quick"?wt:t.mode==="sidebar"||n.sidebar?{...t,dragging:null}:n.eventPopup?{...t,dragging:null}:Fs(rn(e.range))}}function vE(t,e){switch(e.type){case"gesture":return pE(t,e.gesture,e.layers);case"new-event":return Fs(rn(e.range));case"outside":return t.mode==="quick"?wt:t;case"escape":{const n=rc(t,e.layers);return n==="drag"?{...t,dragging:null}:n==="popup"?wt:t}case"change":return t.mode==="idle"?t:{...t,draft:e.draft};case"save":return t.mode!=="quick"?t:{...t,status:"saving",problem:""};case"saved":return wt;case"save-failed":return t.mode!=="quick"?t:{...t,status:"failed",problem:e.problem};case"expand":return t.mode!=="quick"?t:{mode:"sidebar",dragging:null,draft:t.draft};case"sidebar-range":return t.mode==="sidebar"?{...t,draft:{...t.draft,range:e.range}}:{mode:"sidebar",dragging:null,draft:rn(e.range)};case"sidebar-closed":return t.mode==="sidebar"?wt:t}}function yE(t){return t.dragging?t.dragging:t.mode==="idle"?null:t.draft.range}const bE="[data-calendar-popover], [data-event-id], [data-task-id], [data-time-columns], [data-all-day-row], [role='dialog']";function EE({layers:t,isPhone:e,closeToView:n,closeNav:r,drawnEvents:s}){const[i,a]=S.useReducer(vE,wt),o=S.useRef({session:i,layers:t,isPhone:e,closeToView:n,closeNav:r});o.current={session:i,layers:t,isPhone:e,closeToView:n,closeNav:r};const l=S.useRef(null),c=S.useRef(null),u=S.useRef(""),f=S.useRef(!1),h=S.useRef(!1),[g,v]=S.useState(""),m=S.useCallback(x=>{const T=o.current,M=T.session.mode==="idle";if(T.isPhone&&x.type==="click"&&M&&!T.layers.eventPopup)return;(x.type==="click"||x.type==="drag-end"||x.type==="keyboard")&&T.layers.eventPopup&&T.closeToView(),M&&(x.type==="click"||x.type==="keyboard")&&(l.current=x.origin),M&&x.type==="drag-end"&&(l.current=document.querySelector("[role='grid'][aria-label='Time grid']")),a({type:"gesture",gesture:x,layers:T.layers})},[]);S.useEffect(()=>{const x=M=>{M.target instanceof Element&&(M.target.closest(bE)||(o.current.layers.eventPopup&&o.current.closeToView(),a({type:"outside"})))},T=M=>{if(M.key!=="Escape"||M.defaultPrevented)return;const{session:D,layers:N}=o.current,P=rc(D,N);P===null||P==="drag"||(M.preventDefault(),P==="event-popup"?o.current.closeToView():P==="sidebar"?c.current?.():P==="nav"?o.current.closeNav():a({type:"escape",layers:N}))};return document.addEventListener("pointerdown",x,!0),window.addEventListener("keydown",T),()=>{document.removeEventListener("pointerdown",x,!0),window.removeEventListener("keydown",T)}},[]),S.useEffect(()=>{const x=i.mode==="quick";h.current&&i.mode==="idle"&&!f.current&&l.current?.focus(),x&&(f.current=!1),h.current=x},[i.mode]),S.useEffect(()=>{if(g===""||s.length===0)return;const x=document.querySelector(`[data-event-id^="${CSS.escape(g)}"]`);x&&(x.focus(),v(""))},[g,s]);const E=t.sidebar;S.useEffect(()=>{E||a({type:"sidebar-closed"})},[E]);const C=S.useCallback(x=>{l.current=x},[]),R=S.useCallback(x=>{f.current=!0,v(x)},[]);return{session:i,dispatch:a,takeGesture:m,setOrigin:C,requestClose:c,carriedFocus:u,focusSaved:R}}const sc="remit:calendar-side-pane";function SE(){try{return localStorage.getItem(sc)!=="closed"}catch{return!0}}function wE(t){try{localStorage.setItem(sc,t?"open":"closed")}catch{}}function DE(t,e){return t.includes("sidebar")?!0:!t.some(r=>r!=="intelligence")&&e}function xE(t){const e=Oc(),n=Ac(),[r,s]=S.useState(SE),i=!t&&DE(e,r),a=t&&e.includes("nav"),o=S.useCallback(()=>{if(t){n(Xs(e,a?void 0:"nav"));return}const c=!i;wE(c),s(c);const u=e.filter(f=>f!=="sidebar");n(c?[...u,"sidebar"]:u)},[t,a,i,e,n]),l=S.useCallback(c=>{n(Xs(e,c?"nav":void 0))},[e,n]);return{open:i,toggle:o,navOpen:a,setNavOpen:l}}const ic="remit:calendar-density",ba="comfortable";function CE(){try{return localStorage.getItem(ic)==="compact"?"compact":ba}catch{return ba}}function TE(t){try{localStorage.setItem(ic,t)}catch{}}const RE=t=>t==="compact"?"pills":"detail";function NE({days:t,calendars:e,density:n,today:r,anchorDate:s,now:i,selectedEventId:a,freeOn:o,loadingDates:l,error:c,onRetry:u,scrollTarget:f,onSelectEvent:h,onPickSlot:g,onZoomDay:v,onGoToDate:m,onReachStart:E,onReachEnd:C,atStartCap:R,atEndCap:x,onLoadEarlier:T,onLoadLater:M,onVisibleDayChange:D}){const N=S.useMemo(()=>fd(t,i),[t,i]),P=!l.has(r);return c!=null?d.jsx("div",{className:"flex h-full items-center justify-center bg-surface",children:d.jsx(md,{title:"Couldn't load these days",error:c,onRetry:u})}):d.jsx(Qf,{days:t,calendars:e,density:RE(n),today:r,focusDate:s,selectedEventId:a,freeOn:o,loadingDates:l,scrollTarget:f,onSelectEvent:h,onPickSlot:g,onZoomDay:v,onReachStart:E,onReachEnd:C,atStartCap:R,atEndCap:x,onLoadEarlier:T,onLoadLater:M,onVisibleDayChange:D,todayLead:P?d.jsx("div",{className:"border-b border-line bg-surface-sunken p-3",children:d.jsx(dh,{nextUp:N,calendars:e,today:r,onSelectEvent:h,onGoTo:m})}):void 0})}const ME=400;function IE({density:t,onPickSlot:e}){const{date:n,calendarIds:r}=ts(),{openEvent:s,setAnchorDate:i,zoomToDay:a}=ns(),o=Ta(),[l]=S.useState(()=>new Date),c=S.useMemo(()=>Rn(l),[l]),u=S.useMemo(()=>l.toISOString(),[l]),[f,h]=S.useState(()=>Fc(n)),[g,v]=S.useState(),[m,E]=S.useState(n),C=S.useRef(0),R=S.useRef(n),x=S.useCallback(F=>{R.current=F,E(F),h(de=>Bc(de,F)),C.current+=1,v({date:F,token:C.current})},[]);S.useEffect(()=>{n!==R.current&&x(n)},[n,x]);const T=sd(m,ME);S.useEffect(()=>{T!==R.current&&(R.current=T,i(T))},[T,i]);const M=S.useMemo(()=>Wc(f),[f]),D=S.useMemo(()=>Vc(M),[M]),{calendars:N,timeZoneByCalendarId:P,shown:H,narrowed:U,resolved:te,isLoading:W}=Ic(r),V=wc(D,U,te),ne=Dc(D),ae=kc(V.instances,P,H),le=S.useMemo(()=>M.map(F=>hd(F,ae,c)),[M,ae,c]),Pe=S.useMemo(()=>{const F=new Set;if(W||!te)return new Set(M);for(const de of M)V.pendingWindows.has(Ks(de))&&F.add(de);return F},[M,V.pendingWindows,W,te]),Ie=S.useMemo(()=>zc(M,ne.spans),[M,ne.spans]),re=S.useCallback(F=>ne.pendingWindows.has(Ks(F.date))?Pr(F):Ie.get(F.date)??Pr(F),[Ie,ne.pendingWindows]),xe=S.useCallback(F=>{x(F),i(F)},[x,i]),Ge=S.useCallback(F=>{const de=Da(F);s(de.calendarObjectId,de.recurrenceId)},[s]),Ze=S.useCallback(()=>h($c),[]),_=S.useCallback(()=>h(Yc),[]),q=S.useCallback(()=>h(Gc),[]),oe=S.useCallback(()=>h(Zc),[]),ce=S.useCallback(()=>{V.refetch(),ne.refetch()},[V.refetch,ne.refetch]);return d.jsx(NE,{days:le,calendars:N,density:t,today:c,anchorDate:n,now:u,selectedEventId:o?xa(o.calendarObjectId,o.recurrenceId??""):"",freeOn:re,loadingDates:Pe,error:V.error??ne.error,onRetry:ce,scrollTarget:g,onSelectEvent:Ge,onPickSlot:e,onZoomDay:a,onGoToDate:xe,onReachStart:Ze,onReachEnd:_,atStartCap:Xc(f),atEndCap:qc(f),onLoadEarlier:q,onLoadLater:oe,onVisibleDayChange:E})}const ac="calendar-side-pane";function kE(t,e){if(t==="day")return[e,e];if(t==="week"){const n=nn(tn(e),7);return[n[0],n[6]]}return["",""]}function Ea({onNewEvent:t,newEventRef:e,onPicked:n,className:r}){const{view:s,date:i,calendarIds:a}=ts(),{goToDate:o,setCalendarIds:l}=ns(),{calendars:c,error:u,retry:f}=Ca(),[h,g]=S.useState({for:i,month:i}),v=h.for===i?h.month:i,[m,E]=kE(s,i),C=new Set(Pc(c,a)),R=x=>{const T=new Set(C);T.has(x)?T.delete(x):T.add(x),l(T.size===c.length?[]:c.map(M=>M.id).filter(M=>T.has(M)))};return d.jsx(Wb,{id:ac,className:r,onNewEvent:t,newEventRef:e,month:d.jsx(nc,{month:v,today:Rn(new Date),rangeStart:m,rangeEnd:E,onPickDay:x=>{o(x),n?.()},onShowMonth:x=>g({for:i,month:x})}),calendars:u!==null&&c.length===0?d.jsx(jr,{title:"Couldn't load your calendars",error:u,onRetry:f,compact:!0}):d.jsx(_b,{calendars:c,visible:C,onToggle:R,onToggleAccount:(x,T)=>{const M=new Set(c.filter(N=>N.accountId===x).map(N=>N.id)),D=c.map(N=>N.id).filter(N=>M.has(N)?T:C.has(N));l(D.length===c.length?[]:D)}})})}const PE="This calendar changed while you were writing.",jE=(t,e)=>{if(e.allDay)return{...t,start:`${e.date}T00:00:00`,end:`${HE(e.endDate)}T00:00:00`};const n=vt();return{...t,start:Gs(e.date,e.startTime,n),end:Gs(e.endDate,e.endTime,n)}};function HE(t){const[e,n,r]=t.split("-").map(Number);return new Date(Date.UTC(e,n-1,r+1)).toISOString().slice(0,10)}function OE(t,e,n,r){const s=gE(),[i,a]=S.useState(()=>new Map),[o,l]=S.useState(),[c,u]=S.useState(),f=S.useRef(null),h=S.useMemo(()=>new Set(e.filter(R=>R.readOnly).map(R=>R.id)),[e]),g=S.useCallback((R,x)=>{l(void 0),u(void 0),a(T=>new Map(T).set(R.event.id,R.range)),s(R.event,R.range,x,n[R.event.calendarId]??"").then(T=>{a(M=>{const D=new Map(M);return D.delete(R.event.id),D}),T.kind!=="written"&&(u({text:T.kind==="conflict"?PE:`Couldn't move ${R.event.title}: ${T.message}`,retry:()=>g(R,x),conflict:T.kind==="conflict"}),requestAnimationFrame(()=>f.current?.focus()))})},[s,n]),v=S.useCallback((R,x)=>{const T=t.find(D=>D.id===R);if(!T)return;const M={event:T,range:x};if(T.seriesId!==""){l(M);return}g(M,void 0)},[t,g]),m=S.useMemo(()=>i.size===0?t:t.map(R=>{const x=i.get(R.id);return x?jE(R,x):R}),[t,i]),E=c&&d.jsxs("div",{className:"flex items-start gap-2 border-b border-line px-3 py-2",children:[d.jsx("div",{className:"min-w-0 flex-1",children:d.jsx(ka,{focusRef:f,failure:{text:c.text,reportHref:Ir(c.text),onRetry:c.conflict?()=>{u(void 0),r()}:c.retry,retryLabel:c.conflict?"Reload the week":void 0}})}),d.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>u(void 0),className:"flex size-8 items-center justify-center rounded-full text-fg-muted hover:bg-surface-sunken",children:d.jsx(hc,{className:"size-4"})})]}),C=d.jsx(wa,{open:o!==void 0,onClose:()=>l(void 0),title:"Move a repeating event",children:o&&d.jsx(jc,{title:o.event.title,ruleText:"It repeats",instanceText:wd(o.event),onChoose:R=>g(o,R),onCancel:()=>l(void 0)})});return{events:m,canMove:R=>{const x=t.find(T=>T.id===R);return x!==void 0&&!h.has(x.calendarId)},onMoveEvent:v,banner:E,prompt:C}}function AE({suggestions:t,busy:e,failure:n,reportHref:r,addBlocked:s,onAdd:i,onChangeFirst:a,onDismiss:o}){return d.jsxs("aside",{"aria-label":"Waiting for you",className:"hidden w-72 shrink-0 flex-col gap-2 overflow-y-auto border-r border-line bg-surface-sunken py-3 lg:flex",children:[d.jsxs("h3",{className:"flex items-center gap-1.5 px-row-inset text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:[d.jsx(gc,{className:"size-3","aria-hidden":!0}),"Waiting for you"]}),n!==""&&d.jsx(Cd,{text:n,reportHref:r,className:"mx-row-inset"}),s!==void 0&&d.jsx("div",{className:"mx-row-inset rounded-md border border-warning/40 bg-warning-soft p-2 text-xs text-fg",children:s}),d.jsx(Kc,{className:"px-row-inset",items:t.map(({suggestion:l,whenText:c})=>({id:l.id,card:d.jsx(Qc,{suggestion:l,whenText:c,onAdd:()=>i(l.id),onReview:a&&(()=>a(l.id)),onDismiss:()=>o(l.id),addLabel:"Add to calendar",busy:e,addBlocked:s!==void 0})}))}),d.jsx("p",{className:"px-row-inset text-2xs text-fg-subtle",children:"None of this is on your calendar until you add it. Adding sends the organiser nothing."})]})}const LE=(t,e)=>e.kind==="refused"?`Couldn't ${t}: ${e.message}`:"";function _E({onChangeFirst:t}){const{suggestions:e,error:n}=xc(),r=Ca(),{defaultCalendarId:s}=r,i=Cc(),[a,o]=S.useState(""),l=e.map(m=>({suggestion:ed(m,{threadId:"",threadSubject:"",calendarId:s,sender:m.organizer===""?"From your mail":m.organizer}),whenText:Jc(m)})),c=n===null?"":"Couldn't read what your mail is waiting on.";if(l.length===0&&c===""&&a==="")return null;const u=Tc(c||a||"pending invitations could not be answered"),f=m=>{const E=e.find(C=>C.suggestionId===m);E&&t(m,rd(E))},h=m=>{const E=e.find(C=>C.suggestionId===m);return E?.zoneCertainty==="Ambiguous"&&E.method!=="Cancel"},g=e[0]?.method==="Cancel",v=(m,E)=>{o(""),E().then(C=>o(LE(m,C)))};return d.jsx(AE,{suggestions:l,busy:i.isAnswering,failure:c||a,reportHref:u,addBlocked:td(nd(r),u),onAdd:m=>{if(h(m)){f(m);return}v("add this to your calendar",()=>i.accept(m,s))},onChangeFirst:g?void 0:f,onDismiss:m=>v("dismiss this",()=>i.dismiss(m,!1))})}const UE=["day","month","agenda"],FE=[{value:"comfortable",label:"Detail",shortLabel:"Detail"},{value:"compact",label:"Glance",shortLabel:"Glance"}],BE={year:"Couldn't load this year",month:"Couldn't load this month",week:"Couldn't load this week",day:"Couldn't load this day",agenda:"Couldn't load these days"};function WE({isPhone:t,detail:e}){const{view:n,date:r,calendarIds:s}=ts(),i=!Zs(n),{events:a,calendars:o,timeZoneByCalendarId:l,colorByCalendarId:c,isLoading:u,error:f,retry:h,instanceOf:g,tasks:v,storedTasks:m}=Hc({view:n,date:r,calendarIds:s,enabled:i}),{updateTask:E}=Nc(),[C,R]=S.useState(),x=S.useCallback(function Z(he){const ge=m.find(ve=>ve.calendarTaskId===he);if(!ge)throw new Error(`task ${he} is drawn but was not read`);R(void 0),E(ge,{completed:!ge.completed}).then(ve=>{if(ve.kind==="written")return;const hn=`Couldn't save "${ge.summary}": ${ve.message}`;R({text:hn,reportHref:Ir(hn),onRetry:()=>Z(he)})})},[m,E]),[T,M]=S.useState([]),D=S.useCallback(Z=>M([...Z]),[]),N=Rc(T),P=T.filter(Z=>Z.method==="Cancel").map(Z=>Z.email),H=OE(a,o,l,h),U=H.events,{goToView:te,goToToday:W,goToDate:V,openEvent:ne,openTask:ae,openNewEvent:le,closeToView:Pe,changeSuggestionFirst:Ie,zoomToDay:re,dayHref:xe}=ns(),Ge=Lc(),Ze=Ta(),_=Ge?void 0:Ze,q=_c(),oe=Uc(),[ce,F]=S.useState(CE),de=S.useCallback(Z=>{TE(Z),F(Z)},[]),je=S.useCallback(Z=>{const he=g(Z);ne(he.calendarObjectId,he.recurrenceId)},[g,ne]),ut=oe,Ee=xE(t),{session:Q,dispatch:Ce,takeGesture:ft,setOrigin:pe,requestClose:_t,carriedFocus:Te,focusSaved:Re}=EE({layers:{eventPopup:_!==void 0||q!==void 0,sidebar:oe,nav:Ee.navOpen},isPhone:t,closeToView:Pe,closeNav:()=>Ee.setNavOpen(!1),drawnEvents:U}),qe=S.useCallback(Z=>{Q.mode==="quick"&&(Te.current=Z,Ce({type:"expand"}),le(mc(Q.draft.range,vt())))},[Q,Te,Ce,le]),dn=S.useMemo(()=>({session:Q,dispatch:Ce,requestClose:_t,carriedFocus:Te,focusSaved:Re,trackSends:D}),[Q,Ce,_t,Te,Re,D]),He=yE(Q),un=He?{range:He,title:Q.mode==="idle"?"":Q.draft.title,tone:Q.mode==="sidebar"&&!Q.dragging?"draft":"selection",warning:Q.mode==="quick"&&Q.status==="failed",handles:Q.mode==="sidebar"}:void 0,Ut=new Date().toISOString(),ue=vc(n,t),Ft=Z=>Ce({type:"new-event",range:Z}),dr=S.useMemo(()=>{const Z={};if(ue!=="year")return Z;const he=vt();for(const ge of U){const ve=ge.allDay?ge.start.slice(0,10):Se(ge.start,he).date;Z[ve]=(Z[ve]??0)+1}for(const ge of v){const ve=ge.allDay?ge.due.slice(0,10):Se(ge.due,he).date;Z[ve]=(Z[ve]??0)+1}return Z},[U,v,ue]),ht=ue==="day"?[r]:ue==="week"?nn(tn(r),7):void 0,fn=_?xa(_.calendarObjectId,_.recurrenceId??""):"",Ue=S.useRef(null),Fe=S.useCallback(()=>{const Z=Rn(new Date),he=new Date().getHours()*60,ve=Kr(ht??[r],Z,he);pe(document.activeElement instanceof HTMLElement?document.activeElement:Ue.current),_&&Pe(),Ce({type:"new-event",range:Ke(ve.date,ve.minute)})},[ht,r,_,Pe,pe,Ce]),Bt=ue==="week"||ue==="day"?tc(ue==="week"?tn(r):r):void 0,ur=Zs(n)?d.jsx(IE,{density:ce,onPickSlot:Ft}):f!=null?d.jsx(jr,{title:BE[n],error:f,onRetry:h}):u?d.jsx("div",{role:"status","aria-label":"Loading the calendar",className:"flex h-full items-center justify-center bg-surface",children:d.jsx(pc,{className:"size-6 animate-spin text-fg-subtle"})}):ue==="year"?d.jsx(hE,{date:r,today:Rn(new Date),counts:dr,onPickDay:re}):ht?d.jsx(rE,{days:ht,events:U,colorByCalendarId:c,density:ce,timeZone:vt(),now:Ut,selectedEventId:fn,draft:un,onGesture:ft,onSelectEvent:je,onOpenDay:re,touch:t,canMove:H.canMove,onMoveEvent:H.onMoveEvent,tasks:v,selectedTaskId:q??"",onSelectTask:ae,onToggleTask:x}):d.jsx(Ab,{date:r,events:U,colorByCalendarId:c,density:ce,selectedEventId:fn,timeZone:vt(),now:Ut,onSelectEvent:je,onPickSlot:Ft,dayHref:xe,onZoomDay:re,canMove:H.canMove,onMoveEvent:H.onMoveEvent,tasks:v,onSelectTask:ae});return d.jsxs(Sd.Provider,{value:dn,children:[d.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-surface text-fg",children:[d.jsx(Bb,{view:ue,views:t?UE:void 0,title:t&&ue==="day"?new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short",timeZone:"UTC"}).format(new Date(`${r}T00:00:00Z`)):oE(ue,r),weekNumber:Bt,onChangeView:te,onPrev:()=>V(qs(r,ue,-1)),onNext:()=>V(qs(r,ue,1)),onToday:W,touch:t,sidePane:{open:t?Ee.navOpen:Ee.open,controls:ac,onToggle:Ee.toggle},trailing:ue==="week"||ue==="day"?d.jsx(aE,{ariaLabel:"Calendar density",options:FE,value:ce,onChange:de,touch:t,className:"shrink-0"}):void 0}),d.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[Ee.open&&d.jsx(Ea,{onNewEvent:Fe,newEventRef:Ue}),!(t&&ut)&&d.jsxs(d.Fragment,{children:[t&&Q.mode==="idle"&&d.jsx(oa,{onNewEvent:Fe,newEventRef:Ue,className:"fixed right-4 bottom-[calc(var(--app-tab-bar,0px)+1rem)] z-30 size-14 rounded-full"}),!Ee.open&&!t&&d.jsx(oa,{onNewEvent:Fe,newEventRef:Ue,className:"absolute top-2 left-2 z-20"}),!oe&&d.jsx(_E,{onChangeFirst:Ie}),d.jsxs("div",{"data-calendar-body":"",className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[H.banner,P.length>0&&d.jsx("div",{className:"p-2",children:d.jsx(Nd,{guests:P,onDismiss:()=>M([])})}),C&&d.jsx("div",{className:"p-2",children:d.jsx(ka,{failure:C})}),N.checkError!==null&&d.jsx("div",{className:"p-2",children:d.jsx(jr,{title:`Couldn't check whether the messages to ${N.unchecked.join(", ")} went out`,error:N.checkError,onRetry:N.recheck,compact:!0})}),N.missed.length>0&&d.jsx("div",{className:"p-2",children:d.jsx(Md,{missed:N.missed,onRetry:()=>{N.retry()},reportHref:Ir(`Invitations not sent to ${N.missed.join(", ")}`),onDismiss:()=>M([])})}),ur]})]}),!ut&&e,Q.mode==="quick"&&d.jsx(Ed,{session:Q,dispatch:Ce,onMoreOptions:qe,onSaved:Re,touch:t}),ut&&d.jsx("aside",{"aria-label":"Event",className:t?"min-h-0 min-w-0 flex-1":"w-[26rem] shrink-0 border-l border-line",children:e})]})]}),H.prompt,t&&d.jsx(wa,{open:Ee.navOpen,onClose:()=>Ee.setNavOpen(!1),title:"Calendars",anchor:"left",children:d.jsx(Ea,{onNewEvent:Fe,onPicked:()=>Ee.setNavOpen(!1),className:"w-full"})})]})}function DS(){const t=Id()==="phone";return d.jsx(WE,{isPhone:t,detail:d.jsx(yc,{})})}export{DS as component};