@remit/web-client-dist 0.0.697 → 0.0.699

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 (217) hide show
  1. package/assets/{BriefPane-BQx5RRpb.js → BriefPane-CVojVy4N.js} +1 -1
  2. package/assets/{CalendarEventEditor-B3bVY-Oc.js → CalendarEventEditor-BcGWIsNu.js} +1 -1
  3. package/assets/{CalendarEventPopup-D6PNfUfu.js → CalendarEventPopup-MzsWR5GB.js} +1 -1
  4. package/assets/{CalendarLoadFailed-Cm6trTQZ.js → CalendarLoadFailed-Bq0_jt4H.js} +1 -1
  5. package/assets/{CalendarQuickCreate-B_n983kv.js → CalendarQuickCreate-m3dyD7gG.js} +1 -1
  6. package/assets/{CalendarSession-BosFoHg2.js → CalendarSession-D2sxMFYX.js} +1 -1
  7. package/assets/{CollectionPane-BzktgIp0.js → CollectionPane-BykvWdR8.js} +1 -1
  8. package/assets/{DesktopChrome-GxTHTvqD.js → DesktopChrome-D8EtAdwf.js} +1 -1
  9. package/assets/{DropdownMenu-C2J8u8zN.js → DropdownMenu-BuKAMdhw.js} +1 -1
  10. package/assets/{EmptyState-BJU14tbt.js → EmptyState-DEGumQTC.js} +1 -1
  11. package/assets/{ErrorState-BTHOmsYP.js → ErrorState-g7-Y1uhe.js} +1 -1
  12. package/assets/{FullCompose-DiZNltCL.js → FullCompose-CN22d_2q.js} +1 -1
  13. package/assets/{LabelApplyTrigger-P8IoLKME.js → LabelApplyTrigger-Ds7qPw1w.js} +1 -1
  14. package/assets/{MailShell-tKLYT5hn.js → MailShell-DemzOx8u.js} +1 -1
  15. package/assets/{MailViewChrome-CLgaFbe-.js → MailViewChrome-pi6cPv-J.js} +1 -1
  16. package/assets/MailboxPane-DGJQyeZU.js +135 -0
  17. package/assets/{MessageBody-jG4Dhul6.js → MessageBody-Lnqqwldl.js} +1 -1
  18. package/assets/MessageToolbar-HTPVoP6C.js +1 -0
  19. package/assets/{NavMenuButton-CLp6InRG.js → NavMenuButton-BWwWmGhg.js} +1 -1
  20. package/assets/{OnboardingWizard-BSlPpmI5.js → OnboardingWizard-C9TeAtWU.js} +1 -1
  21. package/assets/{OutboxPane-B6UfixBP.js → OutboxPane-dfNu0jGv.js} +1 -1
  22. package/assets/{ReportLink-BELrQR40.js → ReportLink-qkDHdkiE.js} +1 -1
  23. package/assets/_calendarObjectId-DbDEB7MM.js +1 -0
  24. package/assets/_labelId-DeoXHX88.js +1 -0
  25. package/assets/_mailboxId-BGYGT6QY.js +1 -0
  26. package/assets/_messageId-Bqhz_qdo.js +1 -0
  27. package/assets/_messageId-DNugF3h5.js +1 -0
  28. package/assets/_messageId-DXnZth67.js +1 -0
  29. package/assets/_messageId-DtLyjaix.js +1 -0
  30. package/assets/_outboxMessageId-CphlQb-y.js +1 -0
  31. package/assets/_recurrenceId-De3orc9t.js +1 -0
  32. package/assets/{_slotId-DQqfctAf.js → _slotId-Cl3N41sT.js} +1 -1
  33. package/assets/_threadId-BJhKtdZn.js +1 -0
  34. package/assets/_threadId-Bjt3wKzI.js +1 -0
  35. package/assets/_threadId-Cp8WdX2x.js +1 -0
  36. package/assets/_threadId-LaejKsjM.js +1 -0
  37. package/assets/_view._date-CjV2fY7h.js +1 -0
  38. package/assets/{account-service-status-DsLvRU-X.js → account-service-status-CHNkQEDe.js} +1 -1
  39. package/assets/{accounts-D0rPQMGH.js → accounts-BLUtQMSv.js} +1 -1
  40. package/assets/{advanced-q_hG98BB.js → advanced-Cbpc8AqG.js} +1 -1
  41. package/assets/{agenda-time-D0yU-H44.js → agenda-time-BwFncCBt.js} +1 -1
  42. package/assets/{app-chrome-BfyGOiSA.js → app-chrome-CGYf2rTW.js} +1 -1
  43. package/assets/{appearance-DM1k2Ta7.js → appearance-Pwj-DY3o.js} +1 -1
  44. package/assets/{avatar-Bq7beWCy.js → avatar-CVmRGlvx.js} +1 -1
  45. package/assets/{badge-BB80tGxy.js → badge-CDOouHHB.js} +1 -1
  46. package/assets/{bottom-sheet-DKF_Dkid.js → bottom-sheet-Bl-_mC2x.js} +1 -1
  47. package/assets/{brief-8diVJSZ9.js → brief-0MZHMWP6.js} +1 -1
  48. package/assets/brief-Cm-kx12Z.js +1 -0
  49. package/assets/{calendar-BqFIadRy.js → calendar-BDEdchBU.js} +1 -1
  50. package/assets/{calendar-Ds9kgvU8.js → calendar-BHWGBart.js} +1 -1
  51. package/assets/{calendar-event-popup-Cr_LW8IP.js → calendar-event-popup-O-JrsyRu.js} +1 -1
  52. package/assets/{calendar-event-sidebar-B_eR1h5J.js → calendar-event-sidebar-BUwhXGT2.js} +1 -1
  53. package/assets/{calendar-failure-note-C4gNXDQV.js → calendar-failure-note-_XD99AnH.js} +1 -1
  54. package/assets/{calendar-guests-Cay9Ub8h.js → calendar-guests-BVwUAczN.js} +1 -1
  55. package/assets/{calendar-suggestion-EosZrXZC.js → calendar-suggestion-DnD4hQ5U.js} +1 -1
  56. package/assets/calendars-DmhTUU22.js +1 -0
  57. package/assets/{card-CLJYKox8.js → card-D8MhhaRw.js} +1 -1
  58. package/assets/{checkbox-CYOm-zGr.js → checkbox-DQCA_mSq.js} +1 -1
  59. package/assets/{chevron-down-De4wQzka.js → chevron-down-DeNyJr8d.js} +1 -1
  60. package/assets/{chevron-left-CUHU8UT9.js → chevron-left-Co8HGTow.js} +1 -1
  61. package/assets/{circle-check-DlR8I4Hf.js → circle-check-BoVmBAEX.js} +1 -1
  62. package/assets/{circle-check-big-CMsxQSjY.js → circle-check-big-DSc97Qaj.js} +1 -1
  63. package/assets/{circle-question-mark-DhNa_A16.js → circle-question-mark-DuTpeMvV.js} +1 -1
  64. package/assets/{classification-BgDJ1gwK.js → classification-9tqOMgRd.js} +1 -1
  65. package/assets/{clock-Dds4zv6u.js → clock--ouhjt6L.js} +1 -1
  66. package/assets/{cloud-off-BYulqayx.js → cloud-off-DEwqlx6S.js} +1 -1
  67. package/assets/compose._-_outboxMessageId_-BAzIb9up.js +1 -0
  68. package/assets/compose._-_outboxMessageId_-C8ETLKa8.js +1 -0
  69. package/assets/compose._-_outboxMessageId_-CAFZwe5_.js +1 -0
  70. package/assets/compose._-_outboxMessageId_-CS88venz.js +1 -0
  71. package/assets/compose._-_outboxMessageId_-CVS1GWS6.js +1 -0
  72. package/assets/{config-import-VTZQj3gU.js → config-import-B-pJhKeZ.js} +1 -1
  73. package/assets/{confirm-dialog-XvccFJdE.js → confirm-dialog-BdT5xj08.js} +1 -1
  74. package/assets/{copy-BokIobZ4.js → copy-CCCumQLf.js} +1 -1
  75. package/assets/{credential-steps-O1OzlOow.js → credential-steps-BIgbwjRe.js} +1 -1
  76. package/assets/{download-DEuAIIIQ.js → download-BrsKwaQk.js} +1 -1
  77. package/assets/{draft-BEiHkDpm.js → draft-B-aWKHzd.js} +1 -1
  78. package/assets/edit-Cn1GEm6M.js +1 -0
  79. package/assets/edit-sXk685Tf.js +1 -0
  80. package/assets/{external-link-L7NXOTeQ.js → external-link-D__EDlgs.js} +1 -1
  81. package/assets/{file-braces-BN8-S---.js → file-braces-BtzbF80p.js} +1 -1
  82. package/assets/filters-B0cQUlmN.js +1 -0
  83. package/assets/flagged-BH8DBC_m.js +1 -0
  84. package/assets/{flagged-B-j-3yRr.js → flagged-DHdIwzxj.js} +1 -1
  85. package/assets/folder-failure-BphZCUyZ.js +1 -0
  86. package/assets/{folder-input-B0q8wLhf.js → folder-input-C_5R00h6.js} +1 -1
  87. package/assets/folders-DlGCVINx.js +1 -0
  88. package/assets/{help-copy-DUjzIPXf.js → help-copy-Cy9gka_E.js} +1 -1
  89. package/assets/{import-DLM5VFnJ.js → import-D8rex9A_.js} +1 -1
  90. package/assets/index-1RsOqxw1.js +1 -0
  91. package/assets/index-BON2Uz34.js +1 -0
  92. package/assets/index-Bc1xPJmS.js +1 -0
  93. package/assets/index-Bqhz_qdo.js +1 -0
  94. package/assets/index-C2US5ZnK.js +222 -0
  95. package/assets/index-CPXeIqob.js +1 -0
  96. package/assets/index-D4tg2bgX.js +1 -0
  97. package/assets/index-DEDbYXlC.js +1 -0
  98. package/assets/index-DNugF3h5.js +1 -0
  99. package/assets/index-Da8RbG-l.js +1 -0
  100. package/assets/index-Dq3u3q5n.js +1 -0
  101. package/assets/index-G-mQoWoq.js +1 -0
  102. package/assets/index-SJfI-AF0.js +1 -0
  103. package/assets/{index-Caon2n2j.js → index-v9nM8Dsp.js} +4 -4
  104. package/assets/{kbd-jzPSd-a2.js → kbd-C052hWKm.js} +1 -1
  105. package/assets/{label-chip-DtBVyALF.js → label-chip-D_oZixyY.js} +1 -1
  106. package/assets/labels--8vbvW8D.js +1 -0
  107. package/assets/list-pages-BCUbyyea.js +1 -0
  108. package/assets/{mail-BzFJWQZy.js → mail-Cqr91KmH.js} +1 -1
  109. package/assets/mail-DTcPvSJ6.js +1 -0
  110. package/assets/{menu-Bh94jr77.js → menu-CEGeda9s.js} +1 -1
  111. package/assets/{nav-link-ed0mFCCx.js → nav-link-Df_MDzvJ.js} +1 -1
  112. package/assets/new-B_AuEYbG.js +1 -0
  113. package/assets/onboarding-B2cpYesO.js +1 -0
  114. package/assets/{onboarding-completion-qKzJSmsI.js → onboarding-completion-2pWLyByk.js} +1 -1
  115. package/assets/outbox-BOxaEnp0.js +1 -0
  116. package/assets/{pencil-BDbmS56C.js → pencil-C1yBZXUb.js} +1 -1
  117. package/assets/{people-eWwwIt4_.js → people-BTPHUD8U.js} +1 -1
  118. package/assets/{plus-D5-2sA5v.js → plus-DY_LOTJC.js} +1 -1
  119. package/assets/{popover-menu-DhcuKv1N.js → popover-menu-D4kT-xqh.js} +1 -1
  120. package/assets/{refresh-cw-Cu9_I3cT.js → refresh-cw-CY0SJjI-.js} +1 -1
  121. package/assets/{reply-CXuSMyqp.js → reply-CijQsg4o.js} +1 -1
  122. package/assets/{rich-text-Ds4rQc2o.js → rich-text-CY6eh-tS.js} +1 -1
  123. package/assets/{rich-text-spellcheck-worker-provider-ChKzrvjg.js → rich-text-spellcheck-worker-provider-BoNiweeq.js} +1 -1
  124. package/assets/{rotate-ccw-hQhPZwrx.js → rotate-ccw-CfAs8Xij.js} +1 -1
  125. package/assets/{roving-focus-DZX7IpN4.js → roving-focus-C0jnB7ie.js} +1 -1
  126. package/assets/{row-actions-BDfQKXdD.js → row-actions-gLlnd0fC.js} +1 -1
  127. package/assets/{search-mirror-B2xnwy77.js → search-mirror-B_HO5zGq.js} +1 -1
  128. package/assets/{search-scope-B-3MTDpD.js → search-scope-7jHRUZbg.js} +1 -1
  129. package/assets/{search-token-index-BYKMNlJD.js → search-token-index-BymL-AGz.js} +1 -1
  130. package/assets/{sections-DpRVKuXF.js → sections-FtpeSpRq.js} +1 -1
  131. package/assets/{segmented-control-BwvsufVp.js → segmented-control-CMV1-H2S.js} +1 -1
  132. package/assets/{select-TYdrgtW5.js → select-DhVwx5IO.js} +1 -1
  133. package/assets/{senders-vh4OQfD0.js → senders-ZFBTlEw_.js} +1 -1
  134. package/assets/settings-aaApx7r_.js +1 -0
  135. package/assets/{settings-screen-DTYVWAkg.js → settings-screen-zihVEeS9.js} +1 -1
  136. package/assets/{shield-check-C-tOrPEx.js → shield-check-CvFo5QUy.js} +1 -1
  137. package/assets/spam-CN0HeRYz.js +1 -0
  138. package/assets/{suggest-list-BCqr1j26.js → suggest-list-DJUWGfG3.js} +1 -1
  139. package/assets/{suggested-vips--pG2iuOT.js → suggested-vips-DNc6wPf9.js} +1 -1
  140. package/assets/suggestion._suggestionId-DCu4Y3bg.js +1 -0
  141. package/assets/{switch-CyAtRlCz.js → switch-Bza9700F.js} +1 -1
  142. package/assets/task._calendarTaskId-B9lXR7O6.js +1 -0
  143. package/assets/{undo-2-D1IMLq7c.js → undo-2-BHa76eIs.js} +1 -1
  144. package/assets/{useCalendarData-DFG3pzeG.js → useCalendarData-AQi5DlI1.js} +1 -1
  145. package/assets/{useCalendarScheduling-B_INtO-h.js → useCalendarScheduling-BzXa0l-K.js} +1 -1
  146. package/assets/useCalendarSuggestions-CJGnqdiK.js +1 -0
  147. package/assets/{useCalendarTasks-b_UNFPQH.js → useCalendarTasks-BBv_7Q0J.js} +1 -1
  148. package/assets/{useClassificationSettings-DBRecrmp.js → useClassificationSettings-Dh7qfWbF.js} +1 -1
  149. package/assets/{useCollectionThreads-DgofDKen.js → useCollectionThreads-B1vimpsO.js} +1 -1
  150. package/assets/{useDebouncedValue-CFZ4EPXW.js → useDebouncedValue-C3FljUyl.js} +1 -1
  151. package/assets/{useFilters-DHWZEIQe.js → useFilters-BoddpA09.js} +1 -1
  152. package/assets/{useInfiniteQuery-B-vOuANs.js → useInfiniteQuery-Dd0GYAxg.js} +1 -1
  153. package/assets/{useJunkMailboxIds-CW7aI25D.js → useJunkMailboxIds-D3M8TbeX.js} +1 -1
  154. package/assets/useLabels-DnF0cYWq.js +1 -0
  155. package/assets/{useLayoutTier-BNUKvwJD.js → useLayoutTier-lXeQo_2w.js} +1 -1
  156. package/assets/{useMediaQuery-Hy81MQ2M.js → useMediaQuery-BaUDTtu8.js} +1 -1
  157. package/assets/{useMessageBodyContent-CpTD2HGg.js → useMessageBodyContent-DwHmQdO9.js} +1 -1
  158. package/assets/{useQueries-DPH-PeHV.js → useQueries-B-1XtDe8.js} +1 -1
  159. package/assets/{useRefreshControl-DdbTrGxq.js → useRefreshControl-CJGMdQve.js} +1 -1
  160. package/assets/{useResultFolderIndex-BVyfzXH5.js → useResultFolderIndex-D_NiyNtK.js} +1 -1
  161. package/assets/{useSignature-W9HBbZ_n.js → useSignature-cMh39FpD.js} +1 -1
  162. package/assets/{warnings-B2sNE31D.js → warnings-DzSQHNtz.js} +1 -1
  163. package/index.html +2 -2
  164. package/package.json +1 -1
  165. package/assets/MailboxPane-BxNCkl6s.js +0 -135
  166. package/assets/MessageToolbar-DeDUhCvg.js +0 -1
  167. package/assets/_calendarObjectId-BiaBDCEt.js +0 -1
  168. package/assets/_labelId-DLeWLaow.js +0 -1
  169. package/assets/_mailboxId-DWvQ-9gi.js +0 -1
  170. package/assets/_messageId-BB9xOwfs.js +0 -1
  171. package/assets/_messageId-C2YSZxRF.js +0 -1
  172. package/assets/_messageId-CPvSvBZB.js +0 -1
  173. package/assets/_messageId-DbVH08AL.js +0 -1
  174. package/assets/_outboxMessageId-BFgW_k_u.js +0 -1
  175. package/assets/_recurrenceId-96pqeQMh.js +0 -1
  176. package/assets/_threadId-Bm7b75jN.js +0 -1
  177. package/assets/_threadId-CCwEReI2.js +0 -1
  178. package/assets/_threadId-Db39B53v.js +0 -1
  179. package/assets/_threadId-Dht02PUZ.js +0 -1
  180. package/assets/_view._date-BQeaBjoE.js +0 -1
  181. package/assets/brief-CFBkxoDK.js +0 -1
  182. package/assets/calendars-52NaEZbX.js +0 -1
  183. package/assets/compose._-_outboxMessageId_-BY1Sf-7o.js +0 -1
  184. package/assets/compose._-_outboxMessageId_-ByGI1c-o.js +0 -1
  185. package/assets/compose._-_outboxMessageId_-CvOAO1iL.js +0 -1
  186. package/assets/compose._-_outboxMessageId_-EZpX9L3H.js +0 -1
  187. package/assets/compose._-_outboxMessageId_-urlj3DLH.js +0 -1
  188. package/assets/edit-B9dhadKH.js +0 -1
  189. package/assets/edit-vn6fIBd6.js +0 -1
  190. package/assets/filters-VSaDpnX3.js +0 -1
  191. package/assets/flagged-BZJepVc-.js +0 -1
  192. package/assets/folder-failure-CqkVSsrb.js +0 -1
  193. package/assets/folders-CTNX9Hcm.js +0 -1
  194. package/assets/index-B--m5QrT.js +0 -1
  195. package/assets/index-BuawSiTp.js +0 -1
  196. package/assets/index-C2YSZxRF.js +0 -1
  197. package/assets/index-CO1X8-aP.js +0 -1
  198. package/assets/index-CPvSvBZB.js +0 -1
  199. package/assets/index-ChWo5_90.js +0 -1
  200. package/assets/index-DGb7Ls8y.js +0 -1
  201. package/assets/index-DLRo9M2D.js +0 -1
  202. package/assets/index-DemsYVll.js +0 -1
  203. package/assets/index-Dylwxpr-.js +0 -1
  204. package/assets/index-YwusJB4d.js +0 -1
  205. package/assets/index-Zfii_-4V.js +0 -1
  206. package/assets/index-fsuIswbe.js +0 -213
  207. package/assets/labels-CUXsONgB.js +0 -1
  208. package/assets/mail-BodKXw3C.js +0 -1
  209. package/assets/new-DlRrHbU8.js +0 -1
  210. package/assets/onboarding-8O2rW7qq.js +0 -1
  211. package/assets/outbox-nrXvnMTk.js +0 -1
  212. package/assets/settings-MlHARJWl.js +0 -1
  213. package/assets/spam-CecFwFHS.js +0 -1
  214. package/assets/suggestion._suggestionId-DiMWWP0r.js +0 -1
  215. package/assets/task._calendarTaskId-D-wpEifQ.js +0 -1
  216. package/assets/useCalendarSuggestions-DXbA0boT.js +0 -1
  217. package/assets/useLabels-k1VKuQrr.js +0 -1
@@ -1 +1 @@
1
- import{j as r,L as jt,S as kt,c7 as ne,d6 as re,r as a,a as Ue,P as ie,dp as Et,Y as At,ei as Ft,eq as Ot,fk as Nt,y as $e,fl as Bt}from"./index-fsuIswbe.js";import{a5 as Lt,y as qt,A as Pt,an as _t,ao as Dt,ap as Qt,aq as zt,ar as _e,as as Wt,at as Ht,au as Gt,av as Kt,aw as Ut,ag as $t,M as Vt,aj as Yt,ax as Jt,ah as Zt,ay as Xt,az as es,f as ts,p as ss,ak as os,m as ns,S as rs,G as as,K as De,J as is,H as cs,e as ls,V as ds,W as xe,X as us,Z as Ve,_ as Ye,$ as fs,a0 as ms,a1 as hs}from"./MessageToolbar-DeDUhCvg.js";import"./nav-link-ed0mFCCx.js";import{a as gs}from"./useMessageBodyContent-CpTD2HGg.js";import{n as ps,e as xs,f as Is}from"./search-token-index-BYKMNlJD.js";import{g as ys,f as vs,r as bs}from"./reply-CXuSMyqp.js";import{u as Je}from"./sections-DpRVKuXF.js";import{u as ae}from"./useQueries-DPH-PeHV.js";import{t as Ze,s as Ss,r as Ts,L as Cs}from"./LabelApplyTrigger-P8IoLKME.js";import{u as ws,a as Rs,R as Ms,b as js,c as ks}from"./useRefreshControl-DdbTrGxq.js";import{u as Es}from"./useJunkMailboxIds-CW7aI25D.js";import{u as As}from"./useLabels-k1VKuQrr.js";import{u as Fs}from"./useLayoutTier-BNUKvwJD.js";import{u as Os}from"./useMediaQuery-Hy81MQ2M.js";import{o as Xe,l as Ns,m as et,w as tt,u as Bs,p as Ls,R as qs}from"./MessageBody-jG4Dhul6.js";import{d as Ps,w as _s}from"./wizard-selection-zWa1qc6-.js";import{R as Ds}from"./refresh-cw-Cu9_I3cT.js";function Qs({sync:e}){return e?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[r.jsx(jt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:zs(e)})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[r.jsx(kt,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function zs({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const st=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],ot="category",Ws={unclassified:"uncategorized"},H=e=>Ns(e).map(t=>t.raw),W=e=>e.join(" "),Ie=e=>{const t=et(e);if(t)return st.find(s=>s.name===t.name&&s.value===t.value.toLowerCase())?.id},ye=e=>{const t=et(e);if(!t||t.name!==ot)return;const s=t.value.toLowerCase(),n=Ws[s];if(n)return n;if(!(!tt(s)||s==="all"))return s},nt=e=>st.find(t=>t.id===e),rt=e=>nt(e)!==void 0,Hs=e=>{const t=new Set;for(const s of H(e)){const n=Ie(s);n&&t.add(n)}return t},Gs=e=>{let t="all";for(const s of H(e)){const n=ye(s);n&&(t=n)}return t},Ks=(e,t)=>{const s=nt(t);if(!s)return;const n=H(e),i=n.filter(u=>Ie(u)!==t);return i.length<n.length?W(i):W([...n,Xe(s.name,s.value)])},Us=(e,t)=>{const s=H(e).filter(n=>!ye(n));return W(t==="all"?s:[...s,Xe(ot,t)])},$s=e=>W(H(e).filter(t=>!Ie(t)&&!ye(t))),at=e=>e.trim().length>0,Qe=e=>{if(!at(e.query))return e.ownFilters;const t=new Set(Hs(e.query));for(const s of e.ownFilters)rt(s)||t.add(s);return t},ze=e=>at(e.query)?Gs(e.query):e.ownCategory,We=6e4,Vs=3e4,Ys={kind:"unknown"},He=e=>(t,s)=>Lt(s?.queryKey,e)?t:void 0,Js=(e,t,s)=>({...e,category:[t],limit:s,order:"desc"}),Zs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Ge=(e,t)=>({category:[t],...e.unread!==void 0?{unread:e.unread}:{},...e.starred!==void 0?{starred:e.starred}:{},...e.attachments!==void 0?{attachments:e.attachments}:{},...e.accountId!==void 0?{accountId:e.accountId}:{},...e.muted!==void 0?{muted:e.muted}:{}});function Xs({categories:e,criteria:t,limit:s,counted:n}){const i=ae({queries:e.map(c=>{const m=Js(t,c,s),h=Ge(t,c);return{queryKey:re({query:m}),queryFn:async()=>{const{data:g}=await ne({query:m,throwOnError:!0});return g},placeholderData:He(h),staleTime:We}})}),u=ae({queries:e.map(c=>{const m=Zs(t,c),h=Ge(t,c);return{queryKey:re({query:m}),queryFn:async()=>{const{data:g}=await ne({query:m,throwOnError:!0});return g},enabled:n,placeholderData:He(h),staleTime:We}})}),f=a.useMemo(()=>e.map((c,m)=>{const h=i[m],g=u[m],x=h?.data?.items??[];return{category:c,rows:x,atCap:x.length>=s,total:n?Ze(g?.data?.count):Ys,loading:h?.isPending??!0,failed:h?.isError??!1,retry:()=>{h?.refetch(),n&&g?.refetch()}}}),[e,i,u,n,s]),l=a.useCallback(()=>{for(const c of i)c.refetch();for(const c of u)c.refetch()},[i,u]);return{sections:f,isLoading:i.length>0&&i.every(c=>c.isPending),isError:i.length>0&&i.every(c=>c.isError),refetch:l}}function eo(e,t,s){const n={...e,limit:t,order:"desc"},{data:i,isLoading:u,isError:f,refetch:l}=Ue({queryKey:re({query:n}),queryFn:async()=>{const{data:m}=await ne({query:n,throwOnError:!0});return m},enabled:s,staleTime:Vs});return{rows:a.useMemo(()=>s?i?.items??[]:[],[i,s]),isLoading:s&&u,isError:s&&f,refetch:a.useCallback(()=>{l()},[l])}}const to=3e4,so={kind:"unknown"},oo=(e,t)=>({...e,mailboxId:t,order:"desc",count:!0,results:!1});function no({criteria:e,junkMailboxIds:t,enabled:s}){const n=ae({queries:t.map(i=>{const u=oo(e,i);return{queryKey:re({query:u}),queryFn:async()=>{const{data:f}=await ne({query:u,throwOnError:!0});return f},enabled:s,staleTime:to}})});return a.useMemo(()=>t.map((i,u)=>({mailboxId:i,count:s?Ze(n[u]?.data?.count):so,failed:s?n[u]?.isError??!1:!1})),[t,n,s])}const ro=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),ao=e=>[...e].sort(ro),io=["from","subject","category","unread","starred","attachments"],it=["contacts","today"],co=e=>new Set(it.filter(t=>e.has(t))),lo=(e,t,s,n)=>{const i=qt({category:e,attributes:t}),{params:u,residual:f}=Pt(s,i,io),l={...u,...i},c={muted:!1};return l.from!==void 0&&(c.from=l.from),l.subject!==void 0&&(c.subject=l.subject),l.unread!==void 0&&(c.unread=l.unread),l.starred!==void 0&&(c.starred=l.starred),l.attachments!==void 0&&(c.attachments=l.attachments),n!==void 0&&(c.accountId=n),{criteria:c,residual:f}},uo=({residual:e,attributes:t})=>e.length===0&&!it.some(s=>t.has(s)),se=e=>e.count.kind==="exact"&&e.count.value>0?3:e.pageRows>0?2:e.count.kind==="unknown"?1:0,oe=e=>e.count.kind==="exact"?e.count.value:0,fo=(e,t)=>se(e)!==se(t)?se(e)>se(t):oe(e)!==oe(t)?oe(e)>oe(t):e.pageRows>t.pageRows;function mo(e,{pageRowsByMailbox:t}){const s=e.map(h=>({...h,pageRows:t.get(h.mailboxId)??0}));for(const[h,g]of t)g<=0||s.some(x=>x.mailboxId===h)||s.push({mailboxId:h,count:{kind:"unknown"},failed:!1,pageRows:g});const n=s[0];if(!n)return;let i=0,u=!0,f=n;for(const h of s)h.count.kind==="unknown"?u=!1:i+=h.count.value,fo(h,f)&&(f=h);const l=s.some(h=>h.pageRows>0),c=s.some(h=>h.failed);if(i===0&&!l&&(u||!c))return;const m=u&&i===0&&l;return{mailboxId:f.mailboxId,count:u&&!m?{kind:"exact",value:i}:{kind:"unknown"}}}const ho=50,go=200,po=[],Ke=()=>r.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>r.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[r.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsxs("div",{className:"flex justify-between gap-2",children:[r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),xo=({accountEmail:e})=>{const t=Je();return r.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[r.jsx($e,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),r.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},Io=(e,t)=>{if(t.size===0)return{};const s=e.filter(u=>t.has(u.id)),n=Ts(s.map(u=>u.accountId));if(n.restriction)return n;const i=new Set;for(const u of s)u.mailboxId&&i.add(u.mailboxId);return i.size>1?{accountId:n.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${i.size} folders`}:{accountId:n.accountId,mailboxId:i.size===1?[...i][0]:void 0}};function yo({header:e,rows:t,wizard:s,children:n}){const{selectedIds:i,selectedCount:u,exitSelection:f,orderedIds:l,allSelected:c,toggleAllLoaded:m,checkAgainSelection:h}=es(),g=a.useMemo(()=>Io(t,i),[t,i]),{junkMailboxId:x}=ts(g.accountId),{labels:b}=As(g.accountId),L=a.useMemo(()=>Array.from(i),[i]),I=a.useMemo(()=>_s(t,i),[t,i]),S=ss(x,g.mailboxId),O=a.useMemo(()=>l.length>0?{checked:c,indeterminate:u>0&&!c,onChange:m}:void 0,[l.length,c,u,m]),T=g.moveDisabledHint?{tone:"warning",text:g.moveDisabledHint}:void 0,N=C=>r.jsx(rs,{title:C.title,navSlot:C.navSlot,titleMeta:C.titleMeta,searchSlot:C.searchSlot,searchField:C.searchField,idleSlot:C.makeFilterSlot,count:u,onCancel:f,onDelete:()=>s.start("delete"),onMove:()=>s.start("move"),onOrganize:()=>s.start("organize"),onJunk:S?()=>s.start("junk"):void 0,onMarkRead:()=>s.start("markRead"),onCheckAgain:h,overflowSlot:g.accountId&&g.mailboxId&&u>0&&b.length>0?r.jsx(Cs,{accountId:g.accountId,mailboxId:g.mailboxId,messageIds:L}):void 0,selectAll:O,notice:T});return r.jsx(os,{...e,selectionBar:N,paneOverlay:r.jsx(ns,{verb:s.verb,accountId:g.accountId,mailboxId:g.mailboxId,selection:I,selectionRestriction:g.restriction,onFinished:f}),children:n})}function vo({accounts:e,selectedMessageId:t,onOpenThread:s,commandsRef:n,onTriageContextChange:i,onDeleteMessages:u}){const{searchQuery:f,searchInput:l,resultFolderIndex:c,onSearchChange:m}=ie(),h=Bs(),g=Os(),x=Fs(),b=Et(),L=ps(),I=a.useMemo(()=>ao(e.filter(o=>!o.muted?.value)),[e]),[S,O]=a.useState("all"),[T,N]=a.useState("all"),[C,q]=a.useState(new Set),[le,M]=a.useState(!1),P=a.useCallback(o=>{q(d=>{const p=new Set(d);return p.has(o)?p.delete(o):p.add(o),p})},[]),G=a.useCallback(()=>q(new Set),[]),E=l.trim().length>0,{freeText:R,tokens:_}=Ls(f.trim().toLowerCase(),h),v=R.length>0,D=a.useMemo(()=>Qe({query:l,ownFilters:C}),[l,C]),Q=a.useMemo(()=>ze({query:l,ownCategory:T}),[l,T]),F=a.useMemo(()=>Qe({query:f,ownFilters:C}),[f,C]),w=a.useMemo(()=>ze({query:f,ownCategory:T}),[f,T]),y=a.useCallback(o=>{if(!E||!rt(o)){P(o);return}const d=Ks(l,o);d!==void 0&&m(d)},[E,l,m,P]),j=a.useCallback(o=>{if(!E){N(o);return}m(Us(l,o))},[E,l,m]),de=a.useMemo(()=>w==="all"&&!v?o=>{tt(o)&&j(o)}:void 0,[w,v,j]),ue=a.useCallback(()=>{N("all"),O("all"),G(),E&&m($s(l))},[E,l,m,G]),K=ae({queries:I.map(o=>({...At({path:{accountId:o.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),U=a.useMemo(()=>{const o=new Map;for(let d=0;d<I.length;d++){const p=I[d].accountId,te=(K[d]?.data?.items??[]).reduce((A,Mt)=>A+(Mt.unseenCount??0),0);o.set(p,te)}return o},[I,K]),dt=a.useMemo(()=>I.filter((o,d)=>{const p=K[d];return p?.isError?!Ft(p.error):!1}),[I,K]),{criteria:fe,residual:$}=a.useMemo(()=>lo(w,F,_,S==="all"?void 0:S),[w,F,_,S]),ut=a.useMemo(()=>w==="all"?[..._t]:[w],[w]),ve=a.useMemo(()=>({...fe,query:R,...w==="all"?{}:{category:[w]}}),[fe,R,w]),be=uo({residual:$,attributes:F}),{sections:V,isLoading:ft,isError:mt,refetch:Se}=Xs({categories:v?po:ut,criteria:fe,limit:w==="all"?Xt:ho,counted:be}),{rows:Te,isLoading:ht,isError:gt,refetch:Ce}=eo(ve,go,v),me=v?ht:ft,we=v?gt:mt,Re=a.useCallback(()=>{if(v){Ce();return}Se()},[v,Ce,Se]),Me=Es(),je=a.useMemo(()=>co(F),[F]),Y=a.useCallback(o=>Ps(o).map(d=>Dt(d,Me)).filter(d=>Qt(d,je)&&zt(d,$)),[je,$,Me]),J=a.useMemo(()=>V.map(o=>({category:o.category,total:o.total,atCap:o.atCap,loading:o.loading,failed:o.failed,rows:Y(o.rows)})),[V,Y]),Z=a.useMemo(()=>Y(Te).map(o=>{const{folder:d}=Ot(c,o.mailboxId?[o.mailboxId]:[]);return d?{...o,folder:d}:o}),[Te,Y,c]),pt=a.useCallback(o=>{V.find(d=>d.category===o)?.retry()},[V]),k=a.useMemo(()=>v?Z:J.flatMap(o=>o.rows),[v,Z,J]),xt=a.useMemo(()=>Nt(c),[c]),ke=no({criteria:ve,junkMailboxIds:xt,enabled:be&&Ss({hasSearchQuery:v,freeText:R,residualTokenCount:$.length})}),{spamIds:he,briefSpamOffer:X}=a.useMemo(()=>{const o={spamIds:void 0,briefSpamOffer:void 0};if(!R)return o;const d=k.map(A=>_e(A,c)),{spam:p}=Wt(d),B=new Map;for(const A of p)A.mailboxId&&B.set(A.mailboxId,(B.get(A.mailboxId)??0)+1);const te=mo(ke,{pageRowsByMailbox:B});return p.length===0&&!te?o:{spamIds:p.length>0?new Set(p.map(A=>A.id)):void 0,briefSpamOffer:te}},[k,R,c,ke]),Ee=a.useMemo(()=>{const o=d=>he===void 0?d:d.filter(p=>!he.has(p.id));return v?[{id:"matches",threads:o(Z)}]:Ht(J.map(d=>({...d,rows:o(d.rows)})))},[v,Z,J,he]),Ae=a.useCallback((o,d)=>{const p=k.find(B=>B.id===o)?.threadId;p&&s?.({threadId:p,messageId:o},d)},[k,s]),It=a.useCallback(o=>{const d=o.threadId??k.find(p=>p.id===o.id)?.threadId;d&&s?.({threadId:d,messageId:o.id})},[k,s]),ge=a.useMemo(()=>I.length<=1?[]:[{id:"all",label:"All",active:S==="all"},...I.map(o=>({id:o.accountId,label:o.email.split("@")[0]??o.email,count:U.get(o.accountId),active:S===o.accountId}))],[I,U,S]),z=a.useMemo(()=>e.filter(o=>o.muted?.value).length,[e]),yt=a.useMemo(()=>Array.from(U.values()).reduce((o,d)=>o+d,0),[U]),pe=a.useMemo(()=>I.map(o=>o.accountId),[I]),{hasNewMail:Fe}=ws(),{state:Oe,errorMessage:Ne,refresh:Be}=Rs(pe,{onSettled:()=>Re()}),vt=a.useMemo(()=>r.jsx(Ms,{state:Oe,onRefresh:Be,label:"Refresh daily brief",errorMessage:Ne,hasUpdate:Fe(pe)}),[Oe,Be,Ne,Fe,pe]),bt=a.useMemo(()=>k.map(o=>_e(o,c)),[k,c]),St=a.useMemo(()=>{const o=Gt(ge.map(d=>({id:d.id,label:d.label,count:d.count,active:d.active})));return{categories:o.categories,filters:o.filters,sources:o.sources,sourcesNote:z>0?`+${z} muted`:void 0,selectedCategory:Q,activeFilters:D,expanded:le,onExpandedChange:M,onSelectCategory:d=>j(d),onSelectSource:O,onToggleFilter:d=>y(d),onClear:ue}},[ge,z,Q,D,le,y,j,ue]),Le=Ee.length===0&&S==="all"&&R.length===0&&_.length===0,Tt=a.useMemo(()=>I.map(o=>o.accountId),[I]),Ct=a.useMemo(()=>I.some(o=>js(o.syncPhase)),[I]),ee=ks(Tt,Le||Ct),qe=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(Ke,{}),r.jsx(Ke,{})]}),Pe=!me&&!we&&!Le,wt=Kt({tier:x,hasLiveInput:E,hasCommittedQuery:f.trim().length>0,bodyRendersCommittedResults:!0}),Rt=Pe?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&r.jsx(Ut,{count:X.count,onScopeToSpam:()=>L(X.mailboxId,f)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx($t,{sections:Ee,briefCategory:Q,Row:Vt,selectedThreadId:t,onSelectThread:Ae,onShowAllSection:de,onRetrySection:pt,flat:v,onSelectBriefCategory:j,sources:ge,sourcesNote:z>0?`+${z} muted`:void 0,onSelectSource:O,activeFilters:D,onToggleFilter:y,onClearFilters:ue})})]}):me?qe:we?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[r.jsx($e,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>Re(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Ds,{className:"size-3.5"}),"Try again"]})]}):ee.resolved?r.jsx(Qs,{sync:ee.syncing?{synced:ee.synced,total:ee.total}:void 0}):qe;return r.jsx(Yt,{hasSheet:Pe&&!wt,children:r.jsx(Jt,{selectedMessageId:t,rows:k,onOpen:Ae,onDeleteMessages:u,onSelectionVerb:b.start,commandsRef:n,onTriageContextChange:i,children:r.jsx(yo,{wizard:b,header:{title:"Daily brief",unreadCount:yt,footer:g?r.jsx(Zt,{}):void 0,searchFilter:St,searchResults:bt,searchLoading:me,onSelectSearchResult:It,spamOffer:X,searchResultsInBody:!0,refreshControl:vt},rows:k,children:r.jsxs("div",{className:"flex h-full flex-col",children:[dt.map(o=>r.jsx(xo,{accountEmail:o.email,accountId:o.accountId},o.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:Rt})]})})})})}const ct=a.createContext(null);function ce(){const e=a.useContext(ct);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function bo({thread:e,children:t}){const s=xs(),n=Is(),i=Je(),{searchInput:u}=ie(),f=e?.threadId,l=e?.messageId,{data:c}=Ue({...Bt(),staleTime:6e4}),m=a.useMemo(()=>c?.items??[],[c]),h=a.useMemo(()=>{if(f)return m.find(y=>y.messageId===l)??m.find(y=>y.threadId===f)},[m,f,l]),g=as(f,l),x=h??g,b=l??x?.messageId,L=a.useMemo(()=>{if(f)return{threadId:f,mailboxId:x?.mailboxId??"",subject:x?.subject,messageId:b,row:x}},[f,x,b]),I=a.useCallback((y,j)=>{s(y,{replace:j?.replace,query:u})},[s,u]),S=a.useCallback(y=>{b&&y.includes(b)&&n()},[b,n]),O=De({thread:x,isOpen:!0,onAfterOptimisticRemove:S}),T=is(),{deleteMessages:N}=cs({mailboxId:x?.mailboxId??"",messages:m,onAfterOptimisticRemove:S}),{toggleReadFor:C}=ls({mailboxId:x?.mailboxId??"",messages:m}),q=T.focusedMessageId,M=a.useMemo(()=>m.find(y=>y.messageId===q),[m,q])??x,P=De({thread:M,isOpen:M?.messageId===b}),G=gs(),E=ys(),R=vs(),_=a.useMemo(()=>bs(R,f,b),[R,f,b]),v=a.useMemo(()=>{if(M)return y=>R({threadId:M.threadId,messageId:M.messageId,mode:y})},[R,M]),{nextMessageId:D,previousMessageId:Q}=ds({context:T,orderedIds:T.orderedIds,selectedMessageId:b,enabled:!G&&!E,hasOpenThread:f!==void 0,onClose:n,handlers:{reply:()=>v?.("reply"),replyAll:()=>v?.("reply-all"),forward:()=>v?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||M&&C([M.messageId],!M.isRead)},goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),F=a.useCallback(y=>{if(!y)return;const j=m.find(de=>de.messageId===y);return j?{threadId:j.threadId,messageId:y}:void 0},[m]),w={selectedMessageId:b,selectedThread:x,conversation:L,onOpenThread:I,onCloseThread:n,nextThread:F(D),previousThread:F(Q),actions:O,onReply:_,triage:T,onDeleteMessages:N,handleDeselectIfRemoved:S};return r.jsx(ct.Provider,{value:w,children:t})}function lt(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:n}=ce(),{accounts:i}=ie();return r.jsx(vo,{accounts:i,selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:n})}function So(){const e=xe(),{conversation:t,selectedThread:s,actions:n,onReply:i,handleDeselectIfRemoved:u,onOpenThread:f}=ce(),l=!!t,c=ms(t?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(hs,{hasThread:l,intelligenceOpen:c.isShowing,canToggleIntelligence:c.canToggle,onToggleIntelligence:c.toggle,onReply:i?()=>i("reply"):void 0,onReplyAll:i?()=>i("reply-all"):void 0,onForward:i?()=>i("forward"):void 0,onDelete:l?n.deleteThread:void 0,onToggleStar:l?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:l&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t?r.jsx(Ve,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,spamRow:t.row,onOpenIntelligence:c.open,listOnScreen:!0}):r.jsx(qs,{})})]}),r.jsx(Ye,{isOpen:c.drawerOpen,onClose:c.closeDrawer,thread:s,accountId:s?.accountId,onAfterOptimisticRemove:u,onReplyWithText:e,onOpenThread:f})]})}function To(){const e=xe(),{selectedThread:t,handleDeselectIfRemoved:s,onOpenThread:n}=ce(),{onToggleIntelligence:i}=ie();return r.jsx(fs,{onClose:i,thread:t,accountId:t?.accountId,onAfterOptimisticRemove:s,onReplyWithText:e,onOpenThread:n})}function Co(){const e=xe(),{selectedThread:t,conversation:s,onOpenThread:n,onCloseThread:i,nextThread:u,previousThread:f,handleDeselectIfRemoved:l}=ce(),c=us(s?.threadId??null);return s?r.jsxs(r.Fragment,{children:[r.jsx(Ve,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,spamRow:s.row,onBack:i,onOpenIntelligence:c.toggle,onSwipeNext:u?()=>n(u):void 0,onSwipePrevious:f?()=>n(f):void 0,mobileIntelligenceOpen:c.isOpen}),r.jsx(Ye,{isOpen:c.isOpen,onClose:c.close,thread:t,accountId:t?.accountId,onAfterOptimisticRemove:l,onReplyWithText:e,onOpenThread:n})]}):r.jsx("div",{className:"h-full",children:r.jsx(lt,{})})}const zo=Object.assign(bo,{List:lt,Reading:So,Intelligence:To,Phone:Co});export{zo as B};
1
+ import{j as r,L as jt,S as kt,c7 as ne,d6 as re,r as a,a as Ue,P as ie,dp as Et,Y as At,ek as Ft,es as Ot,fm as Nt,y as $e,fn as Bt}from"./index-C2US5ZnK.js";import{a5 as Lt,y as qt,A as Pt,an as _t,ao as Dt,ap as Qt,aq as zt,ar as _e,as as Wt,at as Ht,au as Gt,av as Kt,aw as Ut,ag as $t,M as Vt,aj as Yt,ax as Jt,ah as Zt,ay as Xt,az as es,f as ts,p as ss,ak as os,m as ns,S as rs,G as as,K as De,J as is,H as cs,e as ls,V as ds,W as xe,X as us,Z as Ve,_ as Ye,$ as fs,a0 as ms,a1 as hs}from"./MessageToolbar-HTPVoP6C.js";import"./nav-link-Df_MDzvJ.js";import{a as gs}from"./useMessageBodyContent-DwHmQdO9.js";import{n as ps,e as xs,f as Is}from"./search-token-index-BymL-AGz.js";import{g as ys,f as vs,r as bs}from"./reply-CijQsg4o.js";import{u as Je}from"./sections-FtpeSpRq.js";import{u as ae}from"./useQueries-B-1XtDe8.js";import{t as Ze,s as Ss,r as Ts,L as Cs}from"./LabelApplyTrigger-Ds7qPw1w.js";import{u as ws,a as Rs,R as Ms,b as js,c as ks}from"./useRefreshControl-CJGMdQve.js";import{u as Es}from"./useJunkMailboxIds-D3M8TbeX.js";import{u as As}from"./useLabels-DnF0cYWq.js";import{u as Fs}from"./useLayoutTier-lXeQo_2w.js";import{u as Os}from"./useMediaQuery-BaUDTtu8.js";import{o as Xe,l as Ns,m as et,w as tt,u as Bs,p as Ls,R as qs}from"./MessageBody-Lnqqwldl.js";import{d as Ps,w as _s}from"./wizard-selection-zWa1qc6-.js";import{R as Ds}from"./refresh-cw-CY0SJjI-.js";function Qs({sync:e}){return e?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[r.jsx(jt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:zs(e)})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[r.jsx(kt,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function zs({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const st=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],ot="category",Ws={unclassified:"uncategorized"},H=e=>Ns(e).map(t=>t.raw),W=e=>e.join(" "),Ie=e=>{const t=et(e);if(t)return st.find(s=>s.name===t.name&&s.value===t.value.toLowerCase())?.id},ye=e=>{const t=et(e);if(!t||t.name!==ot)return;const s=t.value.toLowerCase(),n=Ws[s];if(n)return n;if(!(!tt(s)||s==="all"))return s},nt=e=>st.find(t=>t.id===e),rt=e=>nt(e)!==void 0,Hs=e=>{const t=new Set;for(const s of H(e)){const n=Ie(s);n&&t.add(n)}return t},Gs=e=>{let t="all";for(const s of H(e)){const n=ye(s);n&&(t=n)}return t},Ks=(e,t)=>{const s=nt(t);if(!s)return;const n=H(e),i=n.filter(u=>Ie(u)!==t);return i.length<n.length?W(i):W([...n,Xe(s.name,s.value)])},Us=(e,t)=>{const s=H(e).filter(n=>!ye(n));return W(t==="all"?s:[...s,Xe(ot,t)])},$s=e=>W(H(e).filter(t=>!Ie(t)&&!ye(t))),at=e=>e.trim().length>0,Qe=e=>{if(!at(e.query))return e.ownFilters;const t=new Set(Hs(e.query));for(const s of e.ownFilters)rt(s)||t.add(s);return t},ze=e=>at(e.query)?Gs(e.query):e.ownCategory,We=6e4,Vs=3e4,Ys={kind:"unknown"},He=e=>(t,s)=>Lt(s?.queryKey,e)?t:void 0,Js=(e,t,s)=>({...e,category:[t],limit:s,order:"desc"}),Zs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Ge=(e,t)=>({category:[t],...e.unread!==void 0?{unread:e.unread}:{},...e.starred!==void 0?{starred:e.starred}:{},...e.attachments!==void 0?{attachments:e.attachments}:{},...e.accountId!==void 0?{accountId:e.accountId}:{},...e.muted!==void 0?{muted:e.muted}:{}});function Xs({categories:e,criteria:t,limit:s,counted:n}){const i=ae({queries:e.map(c=>{const m=Js(t,c,s),h=Ge(t,c);return{queryKey:re({query:m}),queryFn:async()=>{const{data:g}=await ne({query:m,throwOnError:!0});return g},placeholderData:He(h),staleTime:We}})}),u=ae({queries:e.map(c=>{const m=Zs(t,c),h=Ge(t,c);return{queryKey:re({query:m}),queryFn:async()=>{const{data:g}=await ne({query:m,throwOnError:!0});return g},enabled:n,placeholderData:He(h),staleTime:We}})}),f=a.useMemo(()=>e.map((c,m)=>{const h=i[m],g=u[m],x=h?.data?.items??[];return{category:c,rows:x,atCap:x.length>=s,total:n?Ze(g?.data?.count):Ys,loading:h?.isPending??!0,failed:h?.isError??!1,retry:()=>{h?.refetch(),n&&g?.refetch()}}}),[e,i,u,n,s]),l=a.useCallback(()=>{for(const c of i)c.refetch();for(const c of u)c.refetch()},[i,u]);return{sections:f,isLoading:i.length>0&&i.every(c=>c.isPending),isError:i.length>0&&i.every(c=>c.isError),refetch:l}}function eo(e,t,s){const n={...e,limit:t,order:"desc"},{data:i,isLoading:u,isError:f,refetch:l}=Ue({queryKey:re({query:n}),queryFn:async()=>{const{data:m}=await ne({query:n,throwOnError:!0});return m},enabled:s,staleTime:Vs});return{rows:a.useMemo(()=>s?i?.items??[]:[],[i,s]),isLoading:s&&u,isError:s&&f,refetch:a.useCallback(()=>{l()},[l])}}const to=3e4,so={kind:"unknown"},oo=(e,t)=>({...e,mailboxId:t,order:"desc",count:!0,results:!1});function no({criteria:e,junkMailboxIds:t,enabled:s}){const n=ae({queries:t.map(i=>{const u=oo(e,i);return{queryKey:re({query:u}),queryFn:async()=>{const{data:f}=await ne({query:u,throwOnError:!0});return f},enabled:s,staleTime:to}})});return a.useMemo(()=>t.map((i,u)=>({mailboxId:i,count:s?Ze(n[u]?.data?.count):so,failed:s?n[u]?.isError??!1:!1})),[t,n,s])}const ro=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),ao=e=>[...e].sort(ro),io=["from","subject","category","unread","starred","attachments"],it=["contacts","today"],co=e=>new Set(it.filter(t=>e.has(t))),lo=(e,t,s,n)=>{const i=qt({category:e,attributes:t}),{params:u,residual:f}=Pt(s,i,io),l={...u,...i},c={muted:!1};return l.from!==void 0&&(c.from=l.from),l.subject!==void 0&&(c.subject=l.subject),l.unread!==void 0&&(c.unread=l.unread),l.starred!==void 0&&(c.starred=l.starred),l.attachments!==void 0&&(c.attachments=l.attachments),n!==void 0&&(c.accountId=n),{criteria:c,residual:f}},uo=({residual:e,attributes:t})=>e.length===0&&!it.some(s=>t.has(s)),se=e=>e.count.kind==="exact"&&e.count.value>0?3:e.pageRows>0?2:e.count.kind==="unknown"?1:0,oe=e=>e.count.kind==="exact"?e.count.value:0,fo=(e,t)=>se(e)!==se(t)?se(e)>se(t):oe(e)!==oe(t)?oe(e)>oe(t):e.pageRows>t.pageRows;function mo(e,{pageRowsByMailbox:t}){const s=e.map(h=>({...h,pageRows:t.get(h.mailboxId)??0}));for(const[h,g]of t)g<=0||s.some(x=>x.mailboxId===h)||s.push({mailboxId:h,count:{kind:"unknown"},failed:!1,pageRows:g});const n=s[0];if(!n)return;let i=0,u=!0,f=n;for(const h of s)h.count.kind==="unknown"?u=!1:i+=h.count.value,fo(h,f)&&(f=h);const l=s.some(h=>h.pageRows>0),c=s.some(h=>h.failed);if(i===0&&!l&&(u||!c))return;const m=u&&i===0&&l;return{mailboxId:f.mailboxId,count:u&&!m?{kind:"exact",value:i}:{kind:"unknown"}}}const ho=50,go=200,po=[],Ke=()=>r.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>r.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[r.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsxs("div",{className:"flex justify-between gap-2",children:[r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),xo=({accountEmail:e})=>{const t=Je();return r.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[r.jsx($e,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),r.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},Io=(e,t)=>{if(t.size===0)return{};const s=e.filter(u=>t.has(u.id)),n=Ts(s.map(u=>u.accountId));if(n.restriction)return n;const i=new Set;for(const u of s)u.mailboxId&&i.add(u.mailboxId);return i.size>1?{accountId:n.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${i.size} folders`}:{accountId:n.accountId,mailboxId:i.size===1?[...i][0]:void 0}};function yo({header:e,rows:t,wizard:s,children:n}){const{selectedIds:i,selectedCount:u,exitSelection:f,orderedIds:l,allSelected:c,toggleAllLoaded:m,checkAgainSelection:h}=es(),g=a.useMemo(()=>Io(t,i),[t,i]),{junkMailboxId:x}=ts(g.accountId),{labels:b}=As(g.accountId),L=a.useMemo(()=>Array.from(i),[i]),I=a.useMemo(()=>_s(t,i),[t,i]),S=ss(x,g.mailboxId),O=a.useMemo(()=>l.length>0?{checked:c,indeterminate:u>0&&!c,onChange:m}:void 0,[l.length,c,u,m]),T=g.moveDisabledHint?{tone:"warning",text:g.moveDisabledHint}:void 0,N=C=>r.jsx(rs,{title:C.title,navSlot:C.navSlot,titleMeta:C.titleMeta,searchSlot:C.searchSlot,searchField:C.searchField,idleSlot:C.makeFilterSlot,count:u,onCancel:f,onDelete:()=>s.start("delete"),onMove:()=>s.start("move"),onOrganize:()=>s.start("organize"),onJunk:S?()=>s.start("junk"):void 0,onMarkRead:()=>s.start("markRead"),onCheckAgain:h,overflowSlot:g.accountId&&g.mailboxId&&u>0&&b.length>0?r.jsx(Cs,{accountId:g.accountId,mailboxId:g.mailboxId,messageIds:L}):void 0,selectAll:O,notice:T});return r.jsx(os,{...e,selectionBar:N,paneOverlay:r.jsx(ns,{verb:s.verb,accountId:g.accountId,mailboxId:g.mailboxId,selection:I,selectionRestriction:g.restriction,onFinished:f}),children:n})}function vo({accounts:e,selectedMessageId:t,onOpenThread:s,commandsRef:n,onTriageContextChange:i,onDeleteMessages:u}){const{searchQuery:f,searchInput:l,resultFolderIndex:c,onSearchChange:m}=ie(),h=Bs(),g=Os(),x=Fs(),b=Et(),L=ps(),I=a.useMemo(()=>ao(e.filter(o=>!o.muted?.value)),[e]),[S,O]=a.useState("all"),[T,N]=a.useState("all"),[C,q]=a.useState(new Set),[le,M]=a.useState(!1),P=a.useCallback(o=>{q(d=>{const p=new Set(d);return p.has(o)?p.delete(o):p.add(o),p})},[]),G=a.useCallback(()=>q(new Set),[]),E=l.trim().length>0,{freeText:R,tokens:_}=Ls(f.trim().toLowerCase(),h),v=R.length>0,D=a.useMemo(()=>Qe({query:l,ownFilters:C}),[l,C]),Q=a.useMemo(()=>ze({query:l,ownCategory:T}),[l,T]),F=a.useMemo(()=>Qe({query:f,ownFilters:C}),[f,C]),w=a.useMemo(()=>ze({query:f,ownCategory:T}),[f,T]),y=a.useCallback(o=>{if(!E||!rt(o)){P(o);return}const d=Ks(l,o);d!==void 0&&m(d)},[E,l,m,P]),j=a.useCallback(o=>{if(!E){N(o);return}m(Us(l,o))},[E,l,m]),de=a.useMemo(()=>w==="all"&&!v?o=>{tt(o)&&j(o)}:void 0,[w,v,j]),ue=a.useCallback(()=>{N("all"),O("all"),G(),E&&m($s(l))},[E,l,m,G]),K=ae({queries:I.map(o=>({...At({path:{accountId:o.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),U=a.useMemo(()=>{const o=new Map;for(let d=0;d<I.length;d++){const p=I[d].accountId,te=(K[d]?.data?.items??[]).reduce((A,Mt)=>A+(Mt.unseenCount??0),0);o.set(p,te)}return o},[I,K]),dt=a.useMemo(()=>I.filter((o,d)=>{const p=K[d];return p?.isError?!Ft(p.error):!1}),[I,K]),{criteria:fe,residual:$}=a.useMemo(()=>lo(w,F,_,S==="all"?void 0:S),[w,F,_,S]),ut=a.useMemo(()=>w==="all"?[..._t]:[w],[w]),ve=a.useMemo(()=>({...fe,query:R,...w==="all"?{}:{category:[w]}}),[fe,R,w]),be=uo({residual:$,attributes:F}),{sections:V,isLoading:ft,isError:mt,refetch:Se}=Xs({categories:v?po:ut,criteria:fe,limit:w==="all"?Xt:ho,counted:be}),{rows:Te,isLoading:ht,isError:gt,refetch:Ce}=eo(ve,go,v),me=v?ht:ft,we=v?gt:mt,Re=a.useCallback(()=>{if(v){Ce();return}Se()},[v,Ce,Se]),Me=Es(),je=a.useMemo(()=>co(F),[F]),Y=a.useCallback(o=>Ps(o).map(d=>Dt(d,Me)).filter(d=>Qt(d,je)&&zt(d,$)),[je,$,Me]),J=a.useMemo(()=>V.map(o=>({category:o.category,total:o.total,atCap:o.atCap,loading:o.loading,failed:o.failed,rows:Y(o.rows)})),[V,Y]),Z=a.useMemo(()=>Y(Te).map(o=>{const{folder:d}=Ot(c,o.mailboxId?[o.mailboxId]:[]);return d?{...o,folder:d}:o}),[Te,Y,c]),pt=a.useCallback(o=>{V.find(d=>d.category===o)?.retry()},[V]),k=a.useMemo(()=>v?Z:J.flatMap(o=>o.rows),[v,Z,J]),xt=a.useMemo(()=>Nt(c),[c]),ke=no({criteria:ve,junkMailboxIds:xt,enabled:be&&Ss({hasSearchQuery:v,freeText:R,residualTokenCount:$.length})}),{spamIds:he,briefSpamOffer:X}=a.useMemo(()=>{const o={spamIds:void 0,briefSpamOffer:void 0};if(!R)return o;const d=k.map(A=>_e(A,c)),{spam:p}=Wt(d),B=new Map;for(const A of p)A.mailboxId&&B.set(A.mailboxId,(B.get(A.mailboxId)??0)+1);const te=mo(ke,{pageRowsByMailbox:B});return p.length===0&&!te?o:{spamIds:p.length>0?new Set(p.map(A=>A.id)):void 0,briefSpamOffer:te}},[k,R,c,ke]),Ee=a.useMemo(()=>{const o=d=>he===void 0?d:d.filter(p=>!he.has(p.id));return v?[{id:"matches",threads:o(Z)}]:Ht(J.map(d=>({...d,rows:o(d.rows)})))},[v,Z,J,he]),Ae=a.useCallback((o,d)=>{const p=k.find(B=>B.id===o)?.threadId;p&&s?.({threadId:p,messageId:o},d)},[k,s]),It=a.useCallback(o=>{const d=o.threadId??k.find(p=>p.id===o.id)?.threadId;d&&s?.({threadId:d,messageId:o.id})},[k,s]),ge=a.useMemo(()=>I.length<=1?[]:[{id:"all",label:"All",active:S==="all"},...I.map(o=>({id:o.accountId,label:o.email.split("@")[0]??o.email,count:U.get(o.accountId),active:S===o.accountId}))],[I,U,S]),z=a.useMemo(()=>e.filter(o=>o.muted?.value).length,[e]),yt=a.useMemo(()=>Array.from(U.values()).reduce((o,d)=>o+d,0),[U]),pe=a.useMemo(()=>I.map(o=>o.accountId),[I]),{hasNewMail:Fe}=ws(),{state:Oe,errorMessage:Ne,refresh:Be}=Rs(pe,{onSettled:()=>Re()}),vt=a.useMemo(()=>r.jsx(Ms,{state:Oe,onRefresh:Be,label:"Refresh daily brief",errorMessage:Ne,hasUpdate:Fe(pe)}),[Oe,Be,Ne,Fe,pe]),bt=a.useMemo(()=>k.map(o=>_e(o,c)),[k,c]),St=a.useMemo(()=>{const o=Gt(ge.map(d=>({id:d.id,label:d.label,count:d.count,active:d.active})));return{categories:o.categories,filters:o.filters,sources:o.sources,sourcesNote:z>0?`+${z} muted`:void 0,selectedCategory:Q,activeFilters:D,expanded:le,onExpandedChange:M,onSelectCategory:d=>j(d),onSelectSource:O,onToggleFilter:d=>y(d),onClear:ue}},[ge,z,Q,D,le,y,j,ue]),Le=Ee.length===0&&S==="all"&&R.length===0&&_.length===0,Tt=a.useMemo(()=>I.map(o=>o.accountId),[I]),Ct=a.useMemo(()=>I.some(o=>js(o.syncPhase)),[I]),ee=ks(Tt,Le||Ct),qe=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(Ke,{}),r.jsx(Ke,{})]}),Pe=!me&&!we&&!Le,wt=Kt({tier:x,hasLiveInput:E,hasCommittedQuery:f.trim().length>0,bodyRendersCommittedResults:!0}),Rt=Pe?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&r.jsx(Ut,{count:X.count,onScopeToSpam:()=>L(X.mailboxId,f)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx($t,{sections:Ee,briefCategory:Q,Row:Vt,selectedThreadId:t,onSelectThread:Ae,onShowAllSection:de,onRetrySection:pt,flat:v,onSelectBriefCategory:j,sources:ge,sourcesNote:z>0?`+${z} muted`:void 0,onSelectSource:O,activeFilters:D,onToggleFilter:y,onClearFilters:ue})})]}):me?qe:we?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[r.jsx($e,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>Re(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Ds,{className:"size-3.5"}),"Try again"]})]}):ee.resolved?r.jsx(Qs,{sync:ee.syncing?{synced:ee.synced,total:ee.total}:void 0}):qe;return r.jsx(Yt,{hasSheet:Pe&&!wt,children:r.jsx(Jt,{selectedMessageId:t,rows:k,onOpen:Ae,onDeleteMessages:u,onSelectionVerb:b.start,commandsRef:n,onTriageContextChange:i,children:r.jsx(yo,{wizard:b,header:{title:"Daily brief",unreadCount:yt,footer:g?r.jsx(Zt,{}):void 0,searchFilter:St,searchResults:bt,searchLoading:me,onSelectSearchResult:It,spamOffer:X,searchResultsInBody:!0,refreshControl:vt},rows:k,children:r.jsxs("div",{className:"flex h-full flex-col",children:[dt.map(o=>r.jsx(xo,{accountEmail:o.email,accountId:o.accountId},o.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:Rt})]})})})})}const ct=a.createContext(null);function ce(){const e=a.useContext(ct);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function bo({thread:e,children:t}){const s=xs(),n=Is(),i=Je(),{searchInput:u}=ie(),f=e?.threadId,l=e?.messageId,{data:c}=Ue({...Bt(),staleTime:6e4}),m=a.useMemo(()=>c?.items??[],[c]),h=a.useMemo(()=>{if(f)return m.find(y=>y.messageId===l)??m.find(y=>y.threadId===f)},[m,f,l]),g=as(f,l),x=h??g,b=l??x?.messageId,L=a.useMemo(()=>{if(f)return{threadId:f,mailboxId:x?.mailboxId??"",subject:x?.subject,messageId:b,row:x}},[f,x,b]),I=a.useCallback((y,j)=>{s(y,{replace:j?.replace,query:u})},[s,u]),S=a.useCallback(y=>{b&&y.includes(b)&&n()},[b,n]),O=De({thread:x,isOpen:!0,onAfterOptimisticRemove:S}),T=is(),{deleteMessages:N}=cs({mailboxId:x?.mailboxId??"",messages:m,onAfterOptimisticRemove:S}),{toggleReadFor:C}=ls({mailboxId:x?.mailboxId??"",messages:m}),q=T.focusedMessageId,M=a.useMemo(()=>m.find(y=>y.messageId===q),[m,q])??x,P=De({thread:M,isOpen:M?.messageId===b}),G=gs(),E=ys(),R=vs(),_=a.useMemo(()=>bs(R,f,b),[R,f,b]),v=a.useMemo(()=>{if(M)return y=>R({threadId:M.threadId,messageId:M.messageId,mode:y})},[R,M]),{nextMessageId:D,previousMessageId:Q}=ds({context:T,orderedIds:T.orderedIds,selectedMessageId:b,enabled:!G&&!E,hasOpenThread:f!==void 0,onClose:n,handlers:{reply:()=>v?.("reply"),replyAll:()=>v?.("reply-all"),forward:()=>v?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||M&&C([M.messageId],!M.isRead)},goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),F=a.useCallback(y=>{if(!y)return;const j=m.find(de=>de.messageId===y);return j?{threadId:j.threadId,messageId:y}:void 0},[m]),w={selectedMessageId:b,selectedThread:x,conversation:L,onOpenThread:I,onCloseThread:n,nextThread:F(D),previousThread:F(Q),actions:O,onReply:_,triage:T,onDeleteMessages:N,handleDeselectIfRemoved:S};return r.jsx(ct.Provider,{value:w,children:t})}function lt(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:n}=ce(),{accounts:i}=ie();return r.jsx(vo,{accounts:i,selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:n})}function So(){const e=xe(),{conversation:t,selectedThread:s,actions:n,onReply:i,handleDeselectIfRemoved:u,onOpenThread:f}=ce(),l=!!t,c=ms(t?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(hs,{hasThread:l,intelligenceOpen:c.isShowing,canToggleIntelligence:c.canToggle,onToggleIntelligence:c.toggle,onReply:i?()=>i("reply"):void 0,onReplyAll:i?()=>i("reply-all"):void 0,onForward:i?()=>i("forward"):void 0,onDelete:l?n.deleteThread:void 0,onToggleStar:l?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:l&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t?r.jsx(Ve,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,spamRow:t.row,onOpenIntelligence:c.open,listOnScreen:!0}):r.jsx(qs,{})})]}),r.jsx(Ye,{isOpen:c.drawerOpen,onClose:c.closeDrawer,thread:s,accountId:s?.accountId,onAfterOptimisticRemove:u,onReplyWithText:e,onOpenThread:f})]})}function To(){const e=xe(),{selectedThread:t,handleDeselectIfRemoved:s,onOpenThread:n}=ce(),{onToggleIntelligence:i}=ie();return r.jsx(fs,{onClose:i,thread:t,accountId:t?.accountId,onAfterOptimisticRemove:s,onReplyWithText:e,onOpenThread:n})}function Co(){const e=xe(),{selectedThread:t,conversation:s,onOpenThread:n,onCloseThread:i,nextThread:u,previousThread:f,handleDeselectIfRemoved:l}=ce(),c=us(s?.threadId??null);return s?r.jsxs(r.Fragment,{children:[r.jsx(Ve,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,spamRow:s.row,onBack:i,onOpenIntelligence:c.toggle,onSwipeNext:u?()=>n(u):void 0,onSwipePrevious:f?()=>n(f):void 0,mobileIntelligenceOpen:c.isOpen}),r.jsx(Ye,{isOpen:c.isOpen,onClose:c.close,thread:t,accountId:t?.accountId,onAfterOptimisticRemove:l,onReplyWithText:e,onOpenThread:n})]}):r.jsx("div",{className:"h-full",children:r.jsx(lt,{})})}const zo=Object.assign(bo,{List:lt,Reading:So,Intelligence:To,Phone:Co});export{zo as B};
@@ -1 +1 @@
1
- import{r as t,ft as Ze,cm as Fe,j as v,f5 as we}from"./index-fsuIswbe.js";import{c as xe,m as Ne,d as Oe,t as Be,p as je}from"./draft-BEiHkDpm.js";import{b as le,e as fe,f as oe,p as Ae,U as me,c as ge,s as ze,i as Ge}from"./useCalendarSuggestions-DXbA0boT.js";import{c as Qe,r as Le,s as Pe,t as Ue,R as We}from"./useCalendarData-DFG3pzeG.js";import{u as pe,b as ve}from"./useCalendarScheduling-B_INtO-h.js";import{f as qe}from"./calendar-format-BwCpz-JZ.js";import"./nav-link-ed0mFCCx.js";import{a as ye,j as He,b as ie,i as Ve}from"./calendar-Ds9kgvU8.js";import"./reply-CXuSMyqp.js";import{e as $e}from"./CalendarQuickCreate-B_n983kv.js";import{u as x}from"./CalendarSession-BosFoHg2.js";import{C as Se}from"./calendar-event-sidebar-B_eR1h5J.js";import{C as Je}from"./confirm-dialog-XvccFJdE.js";import{s as _e}from"./calendar-guests-Cay9Ub8h.js";import{a as Ke}from"./calendar-event-popup-Cr_LW8IP.js";const he="This calendar changed while you were writing. Close the form and try again.",be=Intl.supportedValuesOf("timeZone"),Me=(e,n)=>e.date===n.date&&e.endDate===n.endDate&&e.startTime===n.startTime&&e.endTime===n.endTime&&e.allDay===n.allDay,$=e=>({date:e.date,endDate:e.endDate,startTime:e.allDay?"":e.startTime,endTime:e.allDay?"":e.endTime,allDay:e.allDay}),Ce=e=>e?"Opaque":"Transparent";function Ye(e,n){const{carriedFocus:l}=x(),f=t.useRef(!1);t.useEffect(()=>{if(!n||f.current)return;f.current=!0;const o=l.current;l.current="",((o===""?null:document.querySelector(`[data-event-sidebar] [aria-label="${CSS.escape(o)}"]`))??e.current)?.focus()},[l,e,n])}function Ee(e){const{requestClose:n}=x(),{closeToView:l}=ie(),[f,o]=t.useState(!1),y=t.useRef(!1);Ve(e&&!f,()=>y.current?!1:(o(!0),!0));const b=()=>{if(e){o(!0);return}l()},R=t.useRef(b);return R.current=b,t.useEffect(()=>(n.current=()=>R.current(),()=>{n.current=null}),[n]),{close:b,confirm:v.jsx(Je,{isOpen:f,title:"Discard draft?",description:"Your event has unsaved changes. Are you sure you want to discard them?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:()=>{y.current=!0,o(!1),l()},onCancel:()=>o(!1)}),leave:()=>{y.current=!0,l()}}}function vt(){const{session:e,dispatch:n,focusSaved:l}=x(),{date:f}=ye(),o=He(),{setNewEventBounds:y}=ie(),{calendars:b,defaultCalendarId:R,timeZoneByCalendarId:j}=le(),C=b.filter(s=>!s.readOnly),{createEvent:A,isWriting:J}=fe(),{senders:z,defaultSenderId:_}=pe(),[K,M]=t.useState(),[G,Y]=t.useState(""),X=ve(G),{trackSends:ee}=x(),Q=t.useRef(null),L=t.useRef(null),E=oe(),[g,T]=t.useState({notes:"",repeat:"",timeZone:E,busy:!0}),[P,N]=t.useState(""),[O,a]=t.useState(),[i]=t.useState(()=>e.mode==="sidebar"?e.draft:void 0),m=Ze(o?.start,o?.end,f,E);t.useEffect(()=>{e.mode!=="sidebar"&&n({type:"sidebar-range",range:m})},[e.mode,n,m]);const d=e.mode==="sidebar"?e.draft:void 0,r=d?.range;t.useEffect(()=>{if(!r)return;const s=Fe(r,E);s.start===o?.start&&s.end===o?.end||y(s)},[r,o,E,y]),Ye(Q,e.mode==="sidebar"),t.useEffect(()=>{O&&L.current?.focus()},[O]);const I=C.find(s=>s.id===R)?.id??C[0]?.id??"";t.useEffect(()=>{d?.calendarId!==""||I===""||n({type:"change",draft:{...d,calendarId:I}})},[d,I,n]);const k=d!==void 0&&(g.notes!==""||g.repeat!==""||!g.busy||d.title!==(i?.title??"")||d.location!==(i?.location??"")||d.guests.length!==(i?.guests.length??0)),{close:U,confirm:Z,leave:te}=Ee(k);if(!d)return null;const W=K??_??C.find(s=>s.id===d.calendarId)?.accountId??"",F={...$e(d),notes:g.notes,repeat:g.repeat},q=()=>{const s=g.timeZone,u=xe(F,{clock:s,anchor:s!==E?s:Ae(j[d.calendarId]??me)},W);if(!u.ok){N(u.problem);return}N(""),a(void 0),A({...u.input,transparency:Ce(g.busy)}).then(S=>{if(S.kind==="created"){n({type:"saved"}),ee(S.sends),l(S.calendarObjectId),te();return}const p=S.kind==="conflict"?he:`Couldn't save this event: ${S.message}`;a({text:p,reportHref:ge(p),onRetry:q})})};return v.jsxs(v.Fragment,{children:[v.jsx(Se,{heading:"New event",draft:F,onChange:s=>{n({type:"change",draft:{range:$(s),title:s.title,location:s.location,calendarId:s.calendarId,guests:s.guests}}),T(u=>({...u,notes:s.notes,repeat:s.repeat}))},calendars:C,calendarEditable:!0,repeatEditable:!0,timeZone:g.timeZone,timeZones:be,onTimeZone:s=>T(u=>({...u,timeZone:s})),busy:g.busy,onBusy:s=>T(u=>({...u,busy:s})),guests:{suggestions:X,onQuery:Y,senders:z,sender:W,onSender:M,senderEditable:!0},onSave:q,onCancel:U,saving:J,problem:P,failure:O,failureRef:L,titleRef:Q}),Z]})}function yt({calendarObjectId:e,recurrenceId:n}){const{session:l,dispatch:f,focusSaved:o}=x(),{view:y,date:b,calendarIds:R}=ye(),{events:j,isLoading:C,freeIds:A}=Qe({view:y,date:b,calendarIds:R}),{calendars:J,timeZoneByCalendarId:z}=le(),{closeToView:_}=ie(),{updateEvent:K,isWriting:M}=fe(),{senders:G,defaultSenderId:Y}=pe(),[X,ee]=t.useState(),[Q,L]=t.useState(""),E=ve(Q),{trackSends:g}=x(),T=t.useRef(null),P=t.useRef(null),N=t.useId(),O=Ge(e,n??""),a=j.find(c=>c.id===O),{resource:i}=ze(e,a?.calendarId??""),[m,d]=t.useState(),[r,I]=t.useState(),[k,U]=t.useState(!0),[Z,te]=t.useState(oe()),[W,F]=t.useState(!1),[q,s]=t.useState(""),[u,S]=t.useState();t.useEffect(()=>{if(m||!a||!i)return;const c=Le(i.icalData),h=Pe(i.icalData,z[a.calendarId]??me),B=a.allDay?"":a.start.slice(11,16),re=a.allDay?c:Ne(c,we(a.start,h===""?"UTC":h).slice(0,10),a.start.slice(0,10)),D=Ue(i.icalData),w=Oe(a,{repeat:c===""?"":Be(re,B)??"Repeats",location:D.location,notes:D.description,guests:i.attendees.filter(V=>V.role==="Guest").map(V=>_e(V.email,V.displayName))}),ue=!A.has(a.id);d({draft:w,busy:ue,anchor:h}),I(w),U(ue),f({type:"sidebar-range",range:$(w)})},[m,a,i,A,z,f]);const p=l.mode==="sidebar"?l.draft.range:void 0;t.useEffect(()=>{!p||!r||Me(p,$(r))||I({...r,date:p.date,endDate:p.endDate,startTime:p.startTime,endTime:p.endTime,allDay:p.allDay})},[p,r]);const ce=r!==void 0;t.useEffect(()=>{ce&&T.current?.focus()},[ce]),t.useEffect(()=>{u&&P.current?.focus()},[u]);const Ie=m!==void 0&&r!==void 0&&(JSON.stringify(m.draft)!==JSON.stringify(r)||k!==m.busy),{close:De,confirm:Re,leave:Te}=Ee(Ie);if(!C&&a===void 0)return v.jsx("section",{className:"flex h-full flex-col bg-surface","aria-labelledby":N,children:v.jsx(Ke,{headingId:N,onClose:_})});if(!a||!m||!r)return null;const se=J.find(c=>c.id===a.calendarId),de=a.seriesId!==""&&n!==void 0,H=i?.organizer??"",ke=i!==void 0&&(i.participation==="Organizer"||i.participation==="Unscheduled"&&H===""),ne=G.find(c=>c.email===H)?.accountId??X??Y??se?.accountId??"",ae=c=>{F(!1);const h=je(m.draft,r,{clock:Z,anchor:Z!==oe()?Z:m.anchor});if(!h.ok){s(h.problem);return}s(""),S(void 0);const B=k!==m.busy?{...h.patch,transparency:Ce(k)}:h.patch,re=B.attendees!==void 0&&H===""&&ne!==""?{...B,organizerAccountId:ne}:B;K({calendarObjectId:e,calendarId:a.calendarId,recurrenceId:n??"",scope:c,etag:i?.etag??""},re).then(D=>{if(D.kind==="written"){f({type:"saved"}),g(D.sends),o(e),Te();return}const w=D.kind==="conflict"?he:`Couldn't save this event: ${D.message}`;S({text:w,reportHref:ge(w),onRetry:()=>ae(c)})})};return v.jsxs(v.Fragment,{children:[v.jsx(Se,{heading:"Edit event",draft:r,onChange:c=>{I(c),f({type:"sidebar-range",range:$(c)})},calendars:se?[se]:[],calendarEditable:!1,repeatEditable:!de,timeZone:Z,timeZones:be,onTimeZone:te,busy:k,onBusy:U,guests:ke?{suggestions:E,onQuery:L,senders:G,sender:ne,onSender:ee,senderEditable:H===""}:void 0,onSave:()=>de?F(!0):ae(void 0),onCancel:De,saving:M,problem:q,failure:u,failureRef:P,titleRef:T,children:W&&v.jsx(We,{title:a.title,ruleText:r.repeat===""?"It repeats":r.repeat,instanceText:qe(a),onChoose:ae,onCancel:()=>F(!1)})}),Re]})}export{vt as C,yt as a};
1
+ import{r as t,fv as Ze,cm as Fe,j as v,f7 as we}from"./index-C2US5ZnK.js";import{c as xe,m as Ne,d as Oe,t as Be,p as je}from"./draft-B-aWKHzd.js";import{b as le,e as fe,f as oe,p as Ae,U as me,c as ge,s as ze,i as Ge}from"./useCalendarSuggestions-CJGnqdiK.js";import{c as Qe,r as Le,s as Pe,t as Ue,R as We}from"./useCalendarData-AQi5DlI1.js";import{u as pe,b as ve}from"./useCalendarScheduling-BzXa0l-K.js";import{f as qe}from"./calendar-format-BwCpz-JZ.js";import"./nav-link-Df_MDzvJ.js";import{a as ye,j as He,b as ie,i as Ve}from"./calendar-BHWGBart.js";import"./reply-CijQsg4o.js";import{e as $e}from"./CalendarQuickCreate-m3dyD7gG.js";import{u as x}from"./CalendarSession-D2sxMFYX.js";import{C as Se}from"./calendar-event-sidebar-BUwhXGT2.js";import{C as Je}from"./confirm-dialog-BdT5xj08.js";import{s as _e}from"./calendar-guests-BVwUAczN.js";import{a as Ke}from"./calendar-event-popup-O-JrsyRu.js";const he="This calendar changed while you were writing. Close the form and try again.",be=Intl.supportedValuesOf("timeZone"),Me=(e,n)=>e.date===n.date&&e.endDate===n.endDate&&e.startTime===n.startTime&&e.endTime===n.endTime&&e.allDay===n.allDay,$=e=>({date:e.date,endDate:e.endDate,startTime:e.allDay?"":e.startTime,endTime:e.allDay?"":e.endTime,allDay:e.allDay}),Ce=e=>e?"Opaque":"Transparent";function Ye(e,n){const{carriedFocus:l}=x(),f=t.useRef(!1);t.useEffect(()=>{if(!n||f.current)return;f.current=!0;const o=l.current;l.current="",((o===""?null:document.querySelector(`[data-event-sidebar] [aria-label="${CSS.escape(o)}"]`))??e.current)?.focus()},[l,e,n])}function Ee(e){const{requestClose:n}=x(),{closeToView:l}=ie(),[f,o]=t.useState(!1),y=t.useRef(!1);Ve(e&&!f,()=>y.current?!1:(o(!0),!0));const b=()=>{if(e){o(!0);return}l()},R=t.useRef(b);return R.current=b,t.useEffect(()=>(n.current=()=>R.current(),()=>{n.current=null}),[n]),{close:b,confirm:v.jsx(Je,{isOpen:f,title:"Discard draft?",description:"Your event has unsaved changes. Are you sure you want to discard them?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:()=>{y.current=!0,o(!1),l()},onCancel:()=>o(!1)}),leave:()=>{y.current=!0,l()}}}function vt(){const{session:e,dispatch:n,focusSaved:l}=x(),{date:f}=ye(),o=He(),{setNewEventBounds:y}=ie(),{calendars:b,defaultCalendarId:R,timeZoneByCalendarId:j}=le(),C=b.filter(s=>!s.readOnly),{createEvent:A,isWriting:J}=fe(),{senders:z,defaultSenderId:_}=pe(),[K,M]=t.useState(),[G,Y]=t.useState(""),X=ve(G),{trackSends:ee}=x(),Q=t.useRef(null),L=t.useRef(null),E=oe(),[g,T]=t.useState({notes:"",repeat:"",timeZone:E,busy:!0}),[P,N]=t.useState(""),[O,a]=t.useState(),[i]=t.useState(()=>e.mode==="sidebar"?e.draft:void 0),m=Ze(o?.start,o?.end,f,E);t.useEffect(()=>{e.mode!=="sidebar"&&n({type:"sidebar-range",range:m})},[e.mode,n,m]);const d=e.mode==="sidebar"?e.draft:void 0,r=d?.range;t.useEffect(()=>{if(!r)return;const s=Fe(r,E);s.start===o?.start&&s.end===o?.end||y(s)},[r,o,E,y]),Ye(Q,e.mode==="sidebar"),t.useEffect(()=>{O&&L.current?.focus()},[O]);const I=C.find(s=>s.id===R)?.id??C[0]?.id??"";t.useEffect(()=>{d?.calendarId!==""||I===""||n({type:"change",draft:{...d,calendarId:I}})},[d,I,n]);const k=d!==void 0&&(g.notes!==""||g.repeat!==""||!g.busy||d.title!==(i?.title??"")||d.location!==(i?.location??"")||d.guests.length!==(i?.guests.length??0)),{close:U,confirm:Z,leave:te}=Ee(k);if(!d)return null;const W=K??_??C.find(s=>s.id===d.calendarId)?.accountId??"",F={...$e(d),notes:g.notes,repeat:g.repeat},q=()=>{const s=g.timeZone,u=xe(F,{clock:s,anchor:s!==E?s:Ae(j[d.calendarId]??me)},W);if(!u.ok){N(u.problem);return}N(""),a(void 0),A({...u.input,transparency:Ce(g.busy)}).then(S=>{if(S.kind==="created"){n({type:"saved"}),ee(S.sends),l(S.calendarObjectId),te();return}const p=S.kind==="conflict"?he:`Couldn't save this event: ${S.message}`;a({text:p,reportHref:ge(p),onRetry:q})})};return v.jsxs(v.Fragment,{children:[v.jsx(Se,{heading:"New event",draft:F,onChange:s=>{n({type:"change",draft:{range:$(s),title:s.title,location:s.location,calendarId:s.calendarId,guests:s.guests}}),T(u=>({...u,notes:s.notes,repeat:s.repeat}))},calendars:C,calendarEditable:!0,repeatEditable:!0,timeZone:g.timeZone,timeZones:be,onTimeZone:s=>T(u=>({...u,timeZone:s})),busy:g.busy,onBusy:s=>T(u=>({...u,busy:s})),guests:{suggestions:X,onQuery:Y,senders:z,sender:W,onSender:M,senderEditable:!0},onSave:q,onCancel:U,saving:J,problem:P,failure:O,failureRef:L,titleRef:Q}),Z]})}function yt({calendarObjectId:e,recurrenceId:n}){const{session:l,dispatch:f,focusSaved:o}=x(),{view:y,date:b,calendarIds:R}=ye(),{events:j,isLoading:C,freeIds:A}=Qe({view:y,date:b,calendarIds:R}),{calendars:J,timeZoneByCalendarId:z}=le(),{closeToView:_}=ie(),{updateEvent:K,isWriting:M}=fe(),{senders:G,defaultSenderId:Y}=pe(),[X,ee]=t.useState(),[Q,L]=t.useState(""),E=ve(Q),{trackSends:g}=x(),T=t.useRef(null),P=t.useRef(null),N=t.useId(),O=Ge(e,n??""),a=j.find(c=>c.id===O),{resource:i}=ze(e,a?.calendarId??""),[m,d]=t.useState(),[r,I]=t.useState(),[k,U]=t.useState(!0),[Z,te]=t.useState(oe()),[W,F]=t.useState(!1),[q,s]=t.useState(""),[u,S]=t.useState();t.useEffect(()=>{if(m||!a||!i)return;const c=Le(i.icalData),h=Pe(i.icalData,z[a.calendarId]??me),B=a.allDay?"":a.start.slice(11,16),re=a.allDay?c:Ne(c,we(a.start,h===""?"UTC":h).slice(0,10),a.start.slice(0,10)),D=Ue(i.icalData),w=Oe(a,{repeat:c===""?"":Be(re,B)??"Repeats",location:D.location,notes:D.description,guests:i.attendees.filter(V=>V.role==="Guest").map(V=>_e(V.email,V.displayName))}),ue=!A.has(a.id);d({draft:w,busy:ue,anchor:h}),I(w),U(ue),f({type:"sidebar-range",range:$(w)})},[m,a,i,A,z,f]);const p=l.mode==="sidebar"?l.draft.range:void 0;t.useEffect(()=>{!p||!r||Me(p,$(r))||I({...r,date:p.date,endDate:p.endDate,startTime:p.startTime,endTime:p.endTime,allDay:p.allDay})},[p,r]);const ce=r!==void 0;t.useEffect(()=>{ce&&T.current?.focus()},[ce]),t.useEffect(()=>{u&&P.current?.focus()},[u]);const Ie=m!==void 0&&r!==void 0&&(JSON.stringify(m.draft)!==JSON.stringify(r)||k!==m.busy),{close:De,confirm:Re,leave:Te}=Ee(Ie);if(!C&&a===void 0)return v.jsx("section",{className:"flex h-full flex-col bg-surface","aria-labelledby":N,children:v.jsx(Ke,{headingId:N,onClose:_})});if(!a||!m||!r)return null;const se=J.find(c=>c.id===a.calendarId),de=a.seriesId!==""&&n!==void 0,H=i?.organizer??"",ke=i!==void 0&&(i.participation==="Organizer"||i.participation==="Unscheduled"&&H===""),ne=G.find(c=>c.email===H)?.accountId??X??Y??se?.accountId??"",ae=c=>{F(!1);const h=je(m.draft,r,{clock:Z,anchor:Z!==oe()?Z:m.anchor});if(!h.ok){s(h.problem);return}s(""),S(void 0);const B=k!==m.busy?{...h.patch,transparency:Ce(k)}:h.patch,re=B.attendees!==void 0&&H===""&&ne!==""?{...B,organizerAccountId:ne}:B;K({calendarObjectId:e,calendarId:a.calendarId,recurrenceId:n??"",scope:c,etag:i?.etag??""},re).then(D=>{if(D.kind==="written"){f({type:"saved"}),g(D.sends),o(e),Te();return}const w=D.kind==="conflict"?he:`Couldn't save this event: ${D.message}`;S({text:w,reportHref:ge(w),onRetry:()=>ae(c)})})};return v.jsxs(v.Fragment,{children:[v.jsx(Se,{heading:"Edit event",draft:r,onChange:c=>{I(c),f({type:"sidebar-range",range:$(c)})},calendars:se?[se]:[],calendarEditable:!1,repeatEditable:!de,timeZone:Z,timeZones:be,onTimeZone:te,busy:k,onBusy:U,guests:ke?{suggestions:E,onQuery:L,senders:G,sender:ne,onSender:ee,senderEditable:H===""}:void 0,onSave:()=>de?F(!0):ae(void 0),onCancel:De,saving:M,problem:q,failure:u,failureRef:P,titleRef:T,children:W&&v.jsx(We,{title:a.title,ruleText:r.repeat===""?"It repeats":r.repeat,instanceText:qe(a),onChoose:ae,onCancel:()=>F(!1)})}),Re]})}export{vt as C,yt as a};
@@ -1 +1 @@
1
- import{r,j as n,ad as k}from"./index-fsuIswbe.js";import{b as ce,e as de,v as ue,w as pe,s as fe,c as D,x as me,i as ve}from"./useCalendarSuggestions-DXbA0boT.js";import{c as he,t as Ce,R as V}from"./useCalendarData-DFG3pzeG.js";import{f as N}from"./calendar-format-BwCpz-JZ.js";import"./nav-link-ed0mFCCx.js";import{a as xe,b as ge}from"./calendar-Ds9kgvU8.js";import"./reply-CXuSMyqp.js";import{u as ye}from"./CalendarSession-BosFoHg2.js";import{C as T}from"./useCalendarTasks-b_UNFPQH.js";import{a as Se,b as Ee}from"./calendar-event-popup-Cr_LW8IP.js";import{d as $e,e as we}from"./calendar-guests-Cay9Ub8h.js";import{C as Ie}from"./confirm-dialog-XvccFJdE.js";const Re={Accepted:"accepted",Declined:"declined",Tentative:"tentative",NeedsAction:"noReply"},je=a=>({name:a.displayName,email:a.email,rsvp:Re[a.status],role:a.role==="Organizer"?"organizer":"attendee"}),ke={accepted:"Accepted",declined:"Declined",tentative:"Tentative"},J="This calendar changed while you were writing.",De=a=>a.kind==="conflict"?`${J} Close the popup and open the event again.`:a.kind==="refused"?`Couldn't delete this event: ${a.message}`:"";function He({calendarObjectId:a,recurrenceId:p}){const{view:f,date:g,calendarIds:m}=xe(),{events:A,isLoading:U,freeIds:M}=he({view:f,date:g,calendarIds:m}),{calendars:Q}=ce(),{closeToView:v,openEditor:X}=ge(),{deleteEvent:Y,updateEvent:Z,isWriting:F}=de(),b=ye(),[O,y]=r.useState(),[ee,P]=r.useState(),c=r.useId(),L=r.useRef(null),B=r.useRef(null),G=r.useRef(null),[te,h]=r.useState(!1),[ne,S]=r.useState(!1),[E,ae]=r.useState(void 0),[K,re]=r.useState(null),C=ve(a,p??""),t=A.find(e=>e.id===C),$=p===void 0&&t===void 0?ue(A,a,new Date().toISOString()):void 0,d=pe(a,t===void 0&&!U&&$===void 0),w=Q.find(e=>e.id===t?.calendarId),{resource:s}=fe(a,t?.calendarId??""),se=s?Ce(s.icalData):void 0,W=t!==void 0&&s!==void 0&&!w?.readOnly,I=t!==void 0&&t.seriesId!=="";r.useLayoutEffect(()=>{re(t?document.querySelector(`[data-event-id="${CSS.escape(t.id)}"]`):null)},[t]);const R=d.kind==="Deleted"||d.kind==="NoOccurrenceFound";r.useEffect(()=>{R?B.current?.focus():t&&L.current?.focus()},[R,t]),r.useEffect(()=>{E&&G.current?.focus()},[E]),r.useEffect(()=>{const e=`[data-event-id="${CSS.escape(C)}"]`;return()=>{document.querySelector(e)?.focus()}},[C]);const z=e=>({calendarObjectId:a,calendarId:t?.calendarId??"",recurrenceId:p??"",scope:e,etag:s?.etag??""}),H=(s?.attendees??[]).filter(e=>e.role==="Guest").map(e=>e.displayName===""?e.email:e.displayName),oe=()=>{if(H.length>0){S(!0);return}if(I){h(!0);return}x(void 0)},ie=()=>{if(S(!1),I){h(!0);return}x(void 0)},x=e=>{h(!1),Y(z(e)).then(i=>{if(i.kind==="written"){b.trackSends(i.sends),v();return}const l=De(i);ae({text:l,reportHref:D(l),onRetry:()=>x(e)})})},j=(e,i)=>{y(void 0),P(void 0),Z(z(i),{answer:ke[e]}).then(l=>{if(l.kind==="written"){b.trackSends(l.sends);return}const q=l.kind==="conflict"?`${J} Close the popup and open the event again.`:`Couldn't send your reply: ${l.message}`;P({text:q,reportHref:D(q),onRetry:()=>j(e,i)})})},u=s?.participation,le=u!==void 0&&u!=="Organizer"&&u!=="Unscheduled";if($)return n.jsx(k,{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:f,date:g,calendarObjectId:a,recurrenceId:$.recurrenceId},search:!0,hash:!0,replace:!0});const o=d.kind==="Found"?d.jump:void 0,_=o!==void 0&&m.length>0&&!m.includes(o.calendarId);if(o&&(o.date!==g||_)){const e=_?i=>({...i,calendarId:[...m,o.calendarId]}):!0;return o.recurrenceId===""?n.jsx(k,{to:"/calendar/$view/$date/$calendarObjectId",params:{view:f,date:o.date,calendarObjectId:a},search:e,hash:!0,replace:!0}):n.jsx(k,{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:f,date:o.date,calendarObjectId:a,recurrenceId:o.recurrenceId},search:e,hash:!0,replace:!0})}if(d.kind==="Failed"&&!t){const e=`Couldn't open this event: ${d.reason}`;return n.jsx(T,{anchor:null,anchorKey:"failed",labelledBy:c,children:n.jsxs("div",{className:"flex flex-col gap-3 p-4",id:c,children:[n.jsxs("p",{role:"alert",className:"text-sm text-danger",children:[e," ",n.jsx("a",{href:D(e),target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]}),n.jsx("button",{type:"button",onClick:v,className:"self-end rounded-md border border-line px-3 py-1.5 text-sm font-medium",children:"Close"})]})})}return R?n.jsx(T,{anchor:null,anchorKey:"gone",labelledBy:c,children:n.jsx(Se,{headingId:c,onClose:v,closeRef:B})}):t?n.jsxs(n.Fragment,{children:[n.jsx(T,{anchor:K,anchorKey:`${C}:${K?"chip":"none"}`,labelledBy:c,children:n.jsxs(Ee,{headingId:c,headingRef:L,title:t.title,color:w?.color??"cal-1",when:N(t).replace(", "," · "),location:se?.location??"",calendarName:w?.name??"",availability:M.has(t.id)?"Free":"Busy",onEdit:W?()=>X(a,p):void 0,onDelete:W?oe:void 0,deleting:F,onClose:v,failure:E,failureRef:G,children:[s&&n.jsx($e,{attendees:s.attendees.map(je),counts:s.attendeeCounts}),le&&u&&n.jsx(we,{current:me(u),onAnswer:e=>I?y(e):j(e,void 0),sending:F,failure:ee}),O&&n.jsx(V,{title:t.title,ruleText:"It repeats",instanceText:N(t),scopes:["this","all"],onChoose:e=>j(O,e),onCancel:()=>y(void 0)}),te&&n.jsx(V,{title:t.title,ruleText:"It repeats",instanceText:N(t),onChoose:x,onCancel:()=>h(!1)})]})}),n.jsx(Ie,{isOpen:ne,title:"Delete and tell the guests?",description:`${H.join(", ")} will get a cancellation.`,confirmLabel:"Delete and send",cancelLabel:"Keep event",destructive:!0,onConfirm:ie,onCancel:()=>S(!1)})]}):null}export{He as C};
1
+ import{r,j as n,ad as k}from"./index-C2US5ZnK.js";import{b as ce,e as de,v as ue,w as pe,s as fe,c as D,x as me,i as ve}from"./useCalendarSuggestions-CJGnqdiK.js";import{c as he,t as Ce,R as V}from"./useCalendarData-AQi5DlI1.js";import{f as N}from"./calendar-format-BwCpz-JZ.js";import"./nav-link-Df_MDzvJ.js";import{a as xe,b as ge}from"./calendar-BHWGBart.js";import"./reply-CijQsg4o.js";import{u as ye}from"./CalendarSession-D2sxMFYX.js";import{C as T}from"./useCalendarTasks-BBv_7Q0J.js";import{a as Se,b as Ee}from"./calendar-event-popup-O-JrsyRu.js";import{d as $e,e as we}from"./calendar-guests-BVwUAczN.js";import{C as Ie}from"./confirm-dialog-BdT5xj08.js";const Re={Accepted:"accepted",Declined:"declined",Tentative:"tentative",NeedsAction:"noReply"},je=a=>({name:a.displayName,email:a.email,rsvp:Re[a.status],role:a.role==="Organizer"?"organizer":"attendee"}),ke={accepted:"Accepted",declined:"Declined",tentative:"Tentative"},J="This calendar changed while you were writing.",De=a=>a.kind==="conflict"?`${J} Close the popup and open the event again.`:a.kind==="refused"?`Couldn't delete this event: ${a.message}`:"";function He({calendarObjectId:a,recurrenceId:p}){const{view:f,date:g,calendarIds:m}=xe(),{events:A,isLoading:U,freeIds:M}=he({view:f,date:g,calendarIds:m}),{calendars:Q}=ce(),{closeToView:v,openEditor:X}=ge(),{deleteEvent:Y,updateEvent:Z,isWriting:F}=de(),b=ye(),[O,y]=r.useState(),[ee,P]=r.useState(),c=r.useId(),L=r.useRef(null),B=r.useRef(null),G=r.useRef(null),[te,h]=r.useState(!1),[ne,S]=r.useState(!1),[E,ae]=r.useState(void 0),[K,re]=r.useState(null),C=ve(a,p??""),t=A.find(e=>e.id===C),$=p===void 0&&t===void 0?ue(A,a,new Date().toISOString()):void 0,d=pe(a,t===void 0&&!U&&$===void 0),w=Q.find(e=>e.id===t?.calendarId),{resource:s}=fe(a,t?.calendarId??""),se=s?Ce(s.icalData):void 0,W=t!==void 0&&s!==void 0&&!w?.readOnly,I=t!==void 0&&t.seriesId!=="";r.useLayoutEffect(()=>{re(t?document.querySelector(`[data-event-id="${CSS.escape(t.id)}"]`):null)},[t]);const R=d.kind==="Deleted"||d.kind==="NoOccurrenceFound";r.useEffect(()=>{R?B.current?.focus():t&&L.current?.focus()},[R,t]),r.useEffect(()=>{E&&G.current?.focus()},[E]),r.useEffect(()=>{const e=`[data-event-id="${CSS.escape(C)}"]`;return()=>{document.querySelector(e)?.focus()}},[C]);const z=e=>({calendarObjectId:a,calendarId:t?.calendarId??"",recurrenceId:p??"",scope:e,etag:s?.etag??""}),H=(s?.attendees??[]).filter(e=>e.role==="Guest").map(e=>e.displayName===""?e.email:e.displayName),oe=()=>{if(H.length>0){S(!0);return}if(I){h(!0);return}x(void 0)},ie=()=>{if(S(!1),I){h(!0);return}x(void 0)},x=e=>{h(!1),Y(z(e)).then(i=>{if(i.kind==="written"){b.trackSends(i.sends),v();return}const l=De(i);ae({text:l,reportHref:D(l),onRetry:()=>x(e)})})},j=(e,i)=>{y(void 0),P(void 0),Z(z(i),{answer:ke[e]}).then(l=>{if(l.kind==="written"){b.trackSends(l.sends);return}const q=l.kind==="conflict"?`${J} Close the popup and open the event again.`:`Couldn't send your reply: ${l.message}`;P({text:q,reportHref:D(q),onRetry:()=>j(e,i)})})},u=s?.participation,le=u!==void 0&&u!=="Organizer"&&u!=="Unscheduled";if($)return n.jsx(k,{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:f,date:g,calendarObjectId:a,recurrenceId:$.recurrenceId},search:!0,hash:!0,replace:!0});const o=d.kind==="Found"?d.jump:void 0,_=o!==void 0&&m.length>0&&!m.includes(o.calendarId);if(o&&(o.date!==g||_)){const e=_?i=>({...i,calendarId:[...m,o.calendarId]}):!0;return o.recurrenceId===""?n.jsx(k,{to:"/calendar/$view/$date/$calendarObjectId",params:{view:f,date:o.date,calendarObjectId:a},search:e,hash:!0,replace:!0}):n.jsx(k,{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:f,date:o.date,calendarObjectId:a,recurrenceId:o.recurrenceId},search:e,hash:!0,replace:!0})}if(d.kind==="Failed"&&!t){const e=`Couldn't open this event: ${d.reason}`;return n.jsx(T,{anchor:null,anchorKey:"failed",labelledBy:c,children:n.jsxs("div",{className:"flex flex-col gap-3 p-4",id:c,children:[n.jsxs("p",{role:"alert",className:"text-sm text-danger",children:[e," ",n.jsx("a",{href:D(e),target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]}),n.jsx("button",{type:"button",onClick:v,className:"self-end rounded-md border border-line px-3 py-1.5 text-sm font-medium",children:"Close"})]})})}return R?n.jsx(T,{anchor:null,anchorKey:"gone",labelledBy:c,children:n.jsx(Se,{headingId:c,onClose:v,closeRef:B})}):t?n.jsxs(n.Fragment,{children:[n.jsx(T,{anchor:K,anchorKey:`${C}:${K?"chip":"none"}`,labelledBy:c,children:n.jsxs(Ee,{headingId:c,headingRef:L,title:t.title,color:w?.color??"cal-1",when:N(t).replace(", "," · "),location:se?.location??"",calendarName:w?.name??"",availability:M.has(t.id)?"Free":"Busy",onEdit:W?()=>X(a,p):void 0,onDelete:W?oe:void 0,deleting:F,onClose:v,failure:E,failureRef:G,children:[s&&n.jsx($e,{attendees:s.attendees.map(je),counts:s.attendeeCounts}),le&&u&&n.jsx(we,{current:me(u),onAnswer:e=>I?y(e):j(e,void 0),sending:F,failure:ee}),O&&n.jsx(V,{title:t.title,ruleText:"It repeats",instanceText:N(t),scopes:["this","all"],onChoose:e=>j(O,e),onCancel:()=>y(void 0)}),te&&n.jsx(V,{title:t.title,ruleText:"It repeats",instanceText:N(t),onChoose:x,onCancel:()=>h(!1)})]})}),n.jsx(Ie,{isOpen:ne,title:"Delete and tell the guests?",description:`${H.join(", ")} will get a cancellation.`,confirmLabel:"Delete and send",cancelLabel:"Keep event",destructive:!0,onConfirm:ie,onCancel:()=>S(!1)})]}):null}export{He as C};
@@ -1 +1 @@
1
- import{j as e,y as d}from"./index-fsuIswbe.js";import{c as l}from"./useCalendarSuggestions-DXbA0boT.js";import{f as o}from"./ErrorState-BTHOmsYP.js";function x({title:r,error:a,onRetry:n,compact:t=!1}){const s=o(a);return e.jsxs("div",{role:"alert",className:t?"flex flex-col gap-2 rounded-md border border-danger/40 bg-danger-soft p-3 text-sm":"flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[!t&&e.jsx(d,{className:"size-8 text-danger","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-danger",children:r}),e.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:s})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:n,className:"inline-flex items-center rounded-md border border-line bg-canvas px-3 py-1.5 text-sm font-medium hover:bg-surface-raised",children:"Retry"}),e.jsx("a",{href:l(`${r}: ${s}`),target:"_blank",rel:"noreferrer",className:"text-sm font-medium text-accent hover:underline",children:"Report an issue"})]})]})}export{x as C};
1
+ import{j as e,y as d}from"./index-C2US5ZnK.js";import{c as l}from"./useCalendarSuggestions-CJGnqdiK.js";import{f as o}from"./ErrorState-g7-Y1uhe.js";function x({title:r,error:a,onRetry:n,compact:t=!1}){const s=o(a);return e.jsxs("div",{role:"alert",className:t?"flex flex-col gap-2 rounded-md border border-danger/40 bg-danger-soft p-3 text-sm":"flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[!t&&e.jsx(d,{className:"size-8 text-danger","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-danger",children:r}),e.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:s})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:n,className:"inline-flex items-center rounded-md border border-line bg-canvas px-3 py-1.5 text-sm font-medium hover:bg-surface-raised",children:"Retry"}),e.jsx("a",{href:l(`${r}: ${s}`),target:"_blank",rel:"noreferrer",className:"text-sm font-medium text-accent hover:underline",children:"Report an issue"})]})]})}export{x as C};
@@ -1 +1 @@
1
- import{b as q,p as j,j as e,X,r as c,cl as J}from"./index-fsuIswbe.js";import{c as V}from"./draft-BEiHkDpm.js";import{b as F,e as ee,c as te,p as _,U as K,f as U}from"./useCalendarSuggestions-DXbA0boT.js";import{u as ae,b as ne}from"./useCalendarScheduling-B_INtO-h.js";import{u as re,C as se}from"./useCalendarTasks-b_UNFPQH.js";import"./nav-link-ed0mFCCx.js";import{i as le}from"./calendar-Ds9kgvU8.js";import"./reply-CXuSMyqp.js";import{u as ie}from"./CalendarSession-BosFoHg2.js";import{i as oe,c as ce}from"./calendar-guests-Cay9Ub8h.js";import{C as ue}from"./calendar-event-popup-Cr_LW8IP.js";const W={name:"grip-horizontal",size:24,node:[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]};W.node;const de=q(W),me="h-9 rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",$=(s,r)=>{const m={...s.range,...r};return r.date!==void 0&&!m.allDay&&(m.endDate=r.date),r.date!==void 0&&m.allDay&&m.endDate<r.date&&(m.endDate=r.date),{...s,range:m}};function fe({headingId:s,mode:r,onMode:m,fields:i,taskFields:o,onTaskChange:u,calendars:g,taskLists:N,guestSuggestions:T,onGuestQuery:v,onChange:f,onSave:x,onMoreOptions:R,onClose:z,saving:y=!1,problem:w="",failure:S,failureRef:A,titleRef:M,settingsHref:P,dragHandle:E,touch:h=!1}){const n=r==="task",C=n?N:g,D=C.length===0,d=!n&&oe(i.guests)!==void 0,p=j(me,h&&"h-11"),G=n?o.title:i.title,I=t=>n?u({...o,title:t}):f({...i,title:t});return e.jsxs("form",{className:"relative flex flex-col",onSubmit:t=>{t.preventDefault(),!D&&!y&&!d&&x()},children:[e.jsxs("div",{onPointerDown:E?.onPointerDown,className:j("flex items-center justify-between rounded-t-xl bg-surface-sunken px-2 py-1",E&&"cursor-grab"),children:[e.jsx(de,{className:"size-4 text-fg-subtle","aria-hidden":"true"}),e.jsx("h2",{id:s,className:"sr-only",children:n?"New task":"New event"})]}),e.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[e.jsx("input",{ref:M,"aria-label":"Title",placeholder:"Add title",value:G,onChange:t=>I(t.target.value),className:j("border-b-2 border-line bg-transparent pb-1 text-xl text-fg outline-none placeholder:text-fg-subtle focus:border-accent")}),e.jsxs("fieldset",{className:"flex gap-1 self-start rounded-md bg-surface-sunken p-0.5 text-sm",children:[e.jsx("legend",{className:"sr-only",children:"Kind"}),["event","task"].map(t=>e.jsxs("label",{className:j("cursor-pointer rounded px-3 py-1 font-medium has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",r===t?"bg-surface text-fg shadow-sm":"text-fg-muted",h&&"min-h-11"),children:[e.jsx("input",{type:"radio",name:`${s}-kind`,value:t,checked:r===t,onChange:()=>m(t),className:"sr-only"}),t==="event"?"Event":"Task"]},t))]}),n?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-fg-muted",children:"Due"}),e.jsx("input",{type:"date","aria-label":"Due date",value:o.dueDate,onChange:t=>t.target.value!==""&&u({...o,dueDate:t.target.value}),className:p}),o.dueTime===""?e.jsx("button",{type:"button",onClick:()=>u({...o,dueTime:"09:00"}),className:"rounded-md px-2 font-medium text-accent hover:bg-accent-soft",children:"Add time"}):e.jsx("input",{type:"time","aria-label":"Due time",step:900,value:o.dueTime,onChange:t=>u({...o,dueTime:t.target.value}),className:p})]}):e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsx("input",{type:"date","aria-label":"Date",value:i.range.date,onChange:t=>t.target.value!==""&&f($(i,{date:t.target.value})),className:p}),i.range.allDay?e.jsx("span",{className:"text-fg-muted",children:"All day"}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"time","aria-label":"Start time",step:900,value:i.range.startTime,onChange:t=>t.target.value!==""&&f($(i,{startTime:t.target.value})),className:p}),e.jsx("span",{"aria-hidden":"true",children:"–"}),e.jsx("input",{type:"time","aria-label":"End time",step:900,value:i.range.endTime,onChange:t=>t.target.value!==""&&f($(i,{endTime:t.target.value})),className:p})]})]}),!n&&e.jsx(ce,{value:i.guests,onChange:t=>f({...i,guests:t}),suggestions:T,onQuery:v,touch:h}),n?e.jsx("textarea",{"aria-label":"Description",placeholder:"Add description",rows:2,value:o.description,onChange:t=>u({...o,description:t.target.value}),className:"w-full rounded-md border border-line bg-surface-sunken px-2 py-1 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30"}):e.jsx("input",{"aria-label":"Location",placeholder:"Add location",value:i.location,onChange:t=>f({...i,location:t.target.value}),className:p}),D?e.jsxs("p",{role:"status",tabIndex:-1,className:"text-sm text-fg-muted",children:["None of your calendars accepts new events."," ",e.jsx("a",{href:P,className:"font-medium text-accent hover:underline",children:"Calendar settings"})]}):e.jsx("select",{"aria-label":n?"Task list":"Calendar",value:n?o.calendarId:i.calendarId,onChange:t=>n?u({...o,calendarId:t.target.value}):f({...i,calendarId:t.target.value}),className:p,children:C.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))}),w!==""&&e.jsx("p",{className:"text-sm text-danger",role:"status",children:w}),S&&e.jsx(ue,{failure:S,focusRef:A})]}),e.jsxs("div",{className:"flex items-center justify-between px-4 pb-4",children:[n?e.jsx("span",{}):e.jsx("button",{type:"button",onClick:R,className:j("rounded-md px-3 text-sm font-medium text-accent outline-none hover:bg-accent-soft focus-visible:ring-2 focus-visible:ring-ring",h?"min-h-11":"h-9"),children:"More options"}),e.jsx("button",{type:"submit",disabled:D||y||d,className:j("rounded-md bg-accent px-5 text-sm font-medium text-accent-fg outline-none hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",h?"min-h-11":"h-9"),children:y?"Saving…":"Save"})]}),e.jsx("button",{type:"button","aria-label":"Close",onClick:z,className:j("absolute top-0 right-1 flex items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",h?"size-11":"size-8"),children:e.jsx(X,{className:"size-4"})})]})}const ge=80;function xe({labelledBy:s,onDismiss:r,children:m,sheetRef:i,className:o}){const u=c.useRef(null),[g,N]=c.useState(0),T=x=>{u.current=x.clientY,x.currentTarget.setPointerCapture(x.pointerId)},v=x=>{u.current!==null&&N(Math.max(0,x.clientY-u.current))},f=()=>{u.current!==null&&(u.current=null,g>ge&&r(),N(0))};return e.jsxs("div",{ref:i,role:"dialog","aria-modal":"false","aria-labelledby":s,"data-calendar-popover":"",className:j("fixed inset-x-0 bottom-0 z-50 max-h-[70dvh] overflow-y-auto rounded-t-2xl border-t border-line bg-surface-raised pb-[env(safe-area-inset-bottom,0px)] shadow-2xl shadow-black/30",o),style:{transform:`translateY(${g}px)`,transition:g===0?"transform 200ms ease-out":"none"},children:[e.jsx("div",{"aria-hidden":"true","data-sheet-grabber":"",onPointerDown:T,onPointerMove:v,onPointerUp:f,onPointerCancel:f,className:"flex h-6 cursor-grab touch-none items-center justify-center",children:e.jsx("span",{className:"h-1 w-10 rounded-full bg-line-strong"})}),m]})}const pe="/settings/calendars";function be(s){return{title:s.title,date:s.range.date,startTime:s.range.startTime,endDate:s.range.endDate,endTime:s.range.endTime,allDay:s.range.allDay,calendarId:s.calendarId,location:s.location,guests:s.guests,notes:"",repeat:""}}function Se({session:s,dispatch:r,onMoreOptions:m,onSaved:i,touch:o=!1}){const u=c.useId(),g=c.useRef(null),N=c.useRef(null),[T,v]=c.useState(""),{calendars:f,taskLists:x,defaultCalendarId:R,timeZoneByCalendarId:z}=F(),y=f.filter(a=>!a.readOnly),{createEvent:w}=ee(),{createTask:S}=re(),{defaultSenderId:A}=ae(),[M,P]=c.useState(""),E=ne(M),h=ie(),{draft:n}=s,[C,D]=c.useState("event"),[d,p]=c.useState({title:"",dueDate:"",dueTime:"",description:"",calendarId:""}),G=a=>{if(a!==C){if(D(a),a==="event"){r({type:"change",draft:{...n,title:d.title}});return}p(l=>({...l,title:n.title,dueDate:n.range.date,dueTime:n.range.allDay?"":n.range.startTime,calendarId:l.calendarId===""?x[0]?.id??"":l.calendarId}))}},I=y.find(a=>a.id===R)?.id??y[0]?.id??"",t=A??y.find(a=>a.id===n.calendarId)?.accountId??"";c.useEffect(()=>{g.current?.focus()},[]),c.useEffect(()=>{n.calendarId!==""||I===""||r({type:"change",draft:{...n,calendarId:I}})},[n,I,r]),c.useEffect(()=>{s.status==="failed"&&N.current?.focus()},[s.status]);const L=c.useRef(null),B=c.useRef(null);le(o,()=>(r({type:"outside"}),!0));const k=`${n.range.date}T${n.range.startTime}/${n.range.endDate}T${n.range.endTime}`;c.useEffect(()=>{const a=B.current;if(k==="")return;const l=document.querySelector("[data-draft-block]"),b=document.querySelector("[role='grid'][aria-label='Time grid']");if(!a||!l||!b)return;const Z=l.getBoundingClientRect().bottom-a.getBoundingClientRect().top+16;Z>0&&(b.scrollTop+=Z)},[k]);const H=c.useRef(null);c.useEffect(()=>{const a=H.current;if(!a)return;const l=b=>{(b.target instanceof HTMLInputElement||b.target instanceof HTMLSelectElement)&&(L.current=b.target)};return a.addEventListener("focusin",l),()=>a.removeEventListener("focusin",l)},[]),c.useEffect(()=>{const a=L.current;k===""||!a||document.activeElement===a||a.focus()},[k]);const Y=()=>{if(d.title.trim()===""){v("Give the task a title before saving it."),g.current?.focus();return}v(""),r({type:"save"});const a=U(),l=d.dueTime==="";S({calendarId:d.calendarId,summary:d.title.trim(),description:d.description,allDay:l,due:l?d.dueDate:J(d.dueDate,d.dueTime,a),...l?{}:{timeZone:_(K)}}).then(b=>{if(b.kind==="written"){r({type:"saved"});return}r({type:"save-failed",problem:`Couldn't save the task: ${b.message}`})})},O=()=>{if(C==="task"){Y();return}const a=V(be(n),{clock:U(),anchor:_(z[n.calendarId]??K)},t);if(!a.ok){v(a.problem),g.current?.focus();return}v(""),r({type:"save"}),w(a.input).then(l=>{if(l.kind==="created"){r({type:"saved"}),h.trackSends(l.sends),i(l.calendarObjectId);return}r({type:"save-failed",problem:l.kind==="conflict"?"This calendar changed while you were writing. Close the form and try again.":`Couldn't save this event: ${l.message}`})})},Q=a=>e.jsx("div",{ref:H,children:e.jsx(fe,{headingId:u,mode:C,onMode:G,fields:n,taskFields:d,onTaskChange:p,calendars:y,taskLists:x,guestSuggestions:E,onGuestQuery:P,onChange:l=>r({type:"change",draft:l}),onSave:O,onMoreOptions:()=>m(L.current?.getAttribute("aria-label")??""),onClose:()=>r({type:"outside"}),saving:s.status==="saving",problem:T,failure:s.status==="failed"?{text:s.problem,reportHref:te(s.problem),onRetry:O}:void 0,failureRef:N,titleRef:g,settingsHref:pe,dragHandle:a,touch:o})});return o?e.jsx(xe,{labelledBy:u,onDismiss:()=>r({type:"outside"}),sheetRef:B,children:Q()}):e.jsx(se,{anchor:"[data-draft-block]",anchorKey:k,labelledBy:u,wrapTab:!0,header:a=>Q(a),children:null})}export{Se as C,be as e};
1
+ import{b as q,p as j,j as e,X,r as c,cl as J}from"./index-C2US5ZnK.js";import{c as V}from"./draft-B-aWKHzd.js";import{b as F,e as ee,c as te,p as _,U as K,f as U}from"./useCalendarSuggestions-CJGnqdiK.js";import{u as ae,b as ne}from"./useCalendarScheduling-BzXa0l-K.js";import{u as re,C as se}from"./useCalendarTasks-BBv_7Q0J.js";import"./nav-link-Df_MDzvJ.js";import{i as le}from"./calendar-BHWGBart.js";import"./reply-CijQsg4o.js";import{u as ie}from"./CalendarSession-D2sxMFYX.js";import{i as oe,c as ce}from"./calendar-guests-BVwUAczN.js";import{C as ue}from"./calendar-event-popup-O-JrsyRu.js";const W={name:"grip-horizontal",size:24,node:[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]};W.node;const de=q(W),me="h-9 rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",$=(s,r)=>{const m={...s.range,...r};return r.date!==void 0&&!m.allDay&&(m.endDate=r.date),r.date!==void 0&&m.allDay&&m.endDate<r.date&&(m.endDate=r.date),{...s,range:m}};function fe({headingId:s,mode:r,onMode:m,fields:i,taskFields:o,onTaskChange:u,calendars:g,taskLists:N,guestSuggestions:T,onGuestQuery:v,onChange:f,onSave:x,onMoreOptions:R,onClose:z,saving:y=!1,problem:w="",failure:S,failureRef:A,titleRef:M,settingsHref:P,dragHandle:E,touch:h=!1}){const n=r==="task",C=n?N:g,D=C.length===0,d=!n&&oe(i.guests)!==void 0,p=j(me,h&&"h-11"),G=n?o.title:i.title,I=t=>n?u({...o,title:t}):f({...i,title:t});return e.jsxs("form",{className:"relative flex flex-col",onSubmit:t=>{t.preventDefault(),!D&&!y&&!d&&x()},children:[e.jsxs("div",{onPointerDown:E?.onPointerDown,className:j("flex items-center justify-between rounded-t-xl bg-surface-sunken px-2 py-1",E&&"cursor-grab"),children:[e.jsx(de,{className:"size-4 text-fg-subtle","aria-hidden":"true"}),e.jsx("h2",{id:s,className:"sr-only",children:n?"New task":"New event"})]}),e.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[e.jsx("input",{ref:M,"aria-label":"Title",placeholder:"Add title",value:G,onChange:t=>I(t.target.value),className:j("border-b-2 border-line bg-transparent pb-1 text-xl text-fg outline-none placeholder:text-fg-subtle focus:border-accent")}),e.jsxs("fieldset",{className:"flex gap-1 self-start rounded-md bg-surface-sunken p-0.5 text-sm",children:[e.jsx("legend",{className:"sr-only",children:"Kind"}),["event","task"].map(t=>e.jsxs("label",{className:j("cursor-pointer rounded px-3 py-1 font-medium has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",r===t?"bg-surface text-fg shadow-sm":"text-fg-muted",h&&"min-h-11"),children:[e.jsx("input",{type:"radio",name:`${s}-kind`,value:t,checked:r===t,onChange:()=>m(t),className:"sr-only"}),t==="event"?"Event":"Task"]},t))]}),n?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-fg-muted",children:"Due"}),e.jsx("input",{type:"date","aria-label":"Due date",value:o.dueDate,onChange:t=>t.target.value!==""&&u({...o,dueDate:t.target.value}),className:p}),o.dueTime===""?e.jsx("button",{type:"button",onClick:()=>u({...o,dueTime:"09:00"}),className:"rounded-md px-2 font-medium text-accent hover:bg-accent-soft",children:"Add time"}):e.jsx("input",{type:"time","aria-label":"Due time",step:900,value:o.dueTime,onChange:t=>u({...o,dueTime:t.target.value}),className:p})]}):e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsx("input",{type:"date","aria-label":"Date",value:i.range.date,onChange:t=>t.target.value!==""&&f($(i,{date:t.target.value})),className:p}),i.range.allDay?e.jsx("span",{className:"text-fg-muted",children:"All day"}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"time","aria-label":"Start time",step:900,value:i.range.startTime,onChange:t=>t.target.value!==""&&f($(i,{startTime:t.target.value})),className:p}),e.jsx("span",{"aria-hidden":"true",children:"–"}),e.jsx("input",{type:"time","aria-label":"End time",step:900,value:i.range.endTime,onChange:t=>t.target.value!==""&&f($(i,{endTime:t.target.value})),className:p})]})]}),!n&&e.jsx(ce,{value:i.guests,onChange:t=>f({...i,guests:t}),suggestions:T,onQuery:v,touch:h}),n?e.jsx("textarea",{"aria-label":"Description",placeholder:"Add description",rows:2,value:o.description,onChange:t=>u({...o,description:t.target.value}),className:"w-full rounded-md border border-line bg-surface-sunken px-2 py-1 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30"}):e.jsx("input",{"aria-label":"Location",placeholder:"Add location",value:i.location,onChange:t=>f({...i,location:t.target.value}),className:p}),D?e.jsxs("p",{role:"status",tabIndex:-1,className:"text-sm text-fg-muted",children:["None of your calendars accepts new events."," ",e.jsx("a",{href:P,className:"font-medium text-accent hover:underline",children:"Calendar settings"})]}):e.jsx("select",{"aria-label":n?"Task list":"Calendar",value:n?o.calendarId:i.calendarId,onChange:t=>n?u({...o,calendarId:t.target.value}):f({...i,calendarId:t.target.value}),className:p,children:C.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))}),w!==""&&e.jsx("p",{className:"text-sm text-danger",role:"status",children:w}),S&&e.jsx(ue,{failure:S,focusRef:A})]}),e.jsxs("div",{className:"flex items-center justify-between px-4 pb-4",children:[n?e.jsx("span",{}):e.jsx("button",{type:"button",onClick:R,className:j("rounded-md px-3 text-sm font-medium text-accent outline-none hover:bg-accent-soft focus-visible:ring-2 focus-visible:ring-ring",h?"min-h-11":"h-9"),children:"More options"}),e.jsx("button",{type:"submit",disabled:D||y||d,className:j("rounded-md bg-accent px-5 text-sm font-medium text-accent-fg outline-none hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",h?"min-h-11":"h-9"),children:y?"Saving…":"Save"})]}),e.jsx("button",{type:"button","aria-label":"Close",onClick:z,className:j("absolute top-0 right-1 flex items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",h?"size-11":"size-8"),children:e.jsx(X,{className:"size-4"})})]})}const ge=80;function xe({labelledBy:s,onDismiss:r,children:m,sheetRef:i,className:o}){const u=c.useRef(null),[g,N]=c.useState(0),T=x=>{u.current=x.clientY,x.currentTarget.setPointerCapture(x.pointerId)},v=x=>{u.current!==null&&N(Math.max(0,x.clientY-u.current))},f=()=>{u.current!==null&&(u.current=null,g>ge&&r(),N(0))};return e.jsxs("div",{ref:i,role:"dialog","aria-modal":"false","aria-labelledby":s,"data-calendar-popover":"",className:j("fixed inset-x-0 bottom-0 z-50 max-h-[70dvh] overflow-y-auto rounded-t-2xl border-t border-line bg-surface-raised pb-[env(safe-area-inset-bottom,0px)] shadow-2xl shadow-black/30",o),style:{transform:`translateY(${g}px)`,transition:g===0?"transform 200ms ease-out":"none"},children:[e.jsx("div",{"aria-hidden":"true","data-sheet-grabber":"",onPointerDown:T,onPointerMove:v,onPointerUp:f,onPointerCancel:f,className:"flex h-6 cursor-grab touch-none items-center justify-center",children:e.jsx("span",{className:"h-1 w-10 rounded-full bg-line-strong"})}),m]})}const pe="/settings/calendars";function be(s){return{title:s.title,date:s.range.date,startTime:s.range.startTime,endDate:s.range.endDate,endTime:s.range.endTime,allDay:s.range.allDay,calendarId:s.calendarId,location:s.location,guests:s.guests,notes:"",repeat:""}}function Se({session:s,dispatch:r,onMoreOptions:m,onSaved:i,touch:o=!1}){const u=c.useId(),g=c.useRef(null),N=c.useRef(null),[T,v]=c.useState(""),{calendars:f,taskLists:x,defaultCalendarId:R,timeZoneByCalendarId:z}=F(),y=f.filter(a=>!a.readOnly),{createEvent:w}=ee(),{createTask:S}=re(),{defaultSenderId:A}=ae(),[M,P]=c.useState(""),E=ne(M),h=ie(),{draft:n}=s,[C,D]=c.useState("event"),[d,p]=c.useState({title:"",dueDate:"",dueTime:"",description:"",calendarId:""}),G=a=>{if(a!==C){if(D(a),a==="event"){r({type:"change",draft:{...n,title:d.title}});return}p(l=>({...l,title:n.title,dueDate:n.range.date,dueTime:n.range.allDay?"":n.range.startTime,calendarId:l.calendarId===""?x[0]?.id??"":l.calendarId}))}},I=y.find(a=>a.id===R)?.id??y[0]?.id??"",t=A??y.find(a=>a.id===n.calendarId)?.accountId??"";c.useEffect(()=>{g.current?.focus()},[]),c.useEffect(()=>{n.calendarId!==""||I===""||r({type:"change",draft:{...n,calendarId:I}})},[n,I,r]),c.useEffect(()=>{s.status==="failed"&&N.current?.focus()},[s.status]);const L=c.useRef(null),B=c.useRef(null);le(o,()=>(r({type:"outside"}),!0));const k=`${n.range.date}T${n.range.startTime}/${n.range.endDate}T${n.range.endTime}`;c.useEffect(()=>{const a=B.current;if(k==="")return;const l=document.querySelector("[data-draft-block]"),b=document.querySelector("[role='grid'][aria-label='Time grid']");if(!a||!l||!b)return;const Z=l.getBoundingClientRect().bottom-a.getBoundingClientRect().top+16;Z>0&&(b.scrollTop+=Z)},[k]);const H=c.useRef(null);c.useEffect(()=>{const a=H.current;if(!a)return;const l=b=>{(b.target instanceof HTMLInputElement||b.target instanceof HTMLSelectElement)&&(L.current=b.target)};return a.addEventListener("focusin",l),()=>a.removeEventListener("focusin",l)},[]),c.useEffect(()=>{const a=L.current;k===""||!a||document.activeElement===a||a.focus()},[k]);const Y=()=>{if(d.title.trim()===""){v("Give the task a title before saving it."),g.current?.focus();return}v(""),r({type:"save"});const a=U(),l=d.dueTime==="";S({calendarId:d.calendarId,summary:d.title.trim(),description:d.description,allDay:l,due:l?d.dueDate:J(d.dueDate,d.dueTime,a),...l?{}:{timeZone:_(K)}}).then(b=>{if(b.kind==="written"){r({type:"saved"});return}r({type:"save-failed",problem:`Couldn't save the task: ${b.message}`})})},O=()=>{if(C==="task"){Y();return}const a=V(be(n),{clock:U(),anchor:_(z[n.calendarId]??K)},t);if(!a.ok){v(a.problem),g.current?.focus();return}v(""),r({type:"save"}),w(a.input).then(l=>{if(l.kind==="created"){r({type:"saved"}),h.trackSends(l.sends),i(l.calendarObjectId);return}r({type:"save-failed",problem:l.kind==="conflict"?"This calendar changed while you were writing. Close the form and try again.":`Couldn't save this event: ${l.message}`})})},Q=a=>e.jsx("div",{ref:H,children:e.jsx(fe,{headingId:u,mode:C,onMode:G,fields:n,taskFields:d,onTaskChange:p,calendars:y,taskLists:x,guestSuggestions:E,onGuestQuery:P,onChange:l=>r({type:"change",draft:l}),onSave:O,onMoreOptions:()=>m(L.current?.getAttribute("aria-label")??""),onClose:()=>r({type:"outside"}),saving:s.status==="saving",problem:T,failure:s.status==="failed"?{text:s.problem,reportHref:te(s.problem),onRetry:O}:void 0,failureRef:N,titleRef:g,settingsHref:pe,dragHandle:a,touch:o})});return o?e.jsx(xe,{labelledBy:u,onDismiss:()=>r({type:"outside"}),sheetRef:B,children:Q()}):e.jsx(se,{anchor:"[data-draft-block]",anchorKey:k,labelledBy:u,wrapTab:!0,header:a=>Q(a),children:null})}export{Se as C,be as e};
@@ -1 +1 @@
1
- import{r as e}from"./index-fsuIswbe.js";const t=e.createContext(null);function s(){const n=e.useContext(t);if(!n)throw new Error("the calendar session is not mounted");return n}function r(){return e.useContext(t)}export{t as C,r as a,s as u};
1
+ import{r as e}from"./index-C2US5ZnK.js";const t=e.createContext(null);function s(){const n=e.useContext(t);if(!n)throw new Error("the calendar session is not mounted");return n}function r(){return e.useContext(t)}export{t as C,r as a,s as u};
@@ -1 +1 @@
1
- import{P as _,dp as de,r as l,az as ce,aA as ue,j as e}from"./index-fsuIswbe.js";import{a as X,b as he}from"./useCollectionThreads-DgofDKen.js";import{y as me,A as ge,ao as pe,aq as fe,aA as xe,ar as Ie,d as Te,M as Ce,ax as be,aB as Re,az as ve,m as ye,G as we,K,J as Se,H as je,e as Me,V as Oe,W as G,X as ke,Z,_ as $,$ as Pe,a0 as Fe,a1 as Ae}from"./MessageToolbar-DeDUhCvg.js";import"./nav-link-ed0mFCCx.js";import{a as Le}from"./useMessageBodyContent-CpTD2HGg.js";import{e as De,f as Ne}from"./search-token-index-BYKMNlJD.js";import{g as Be,f as Ee,r as We}from"./reply-CXuSMyqp.js";import{u as qe}from"./sections-DpRVKuXF.js";import{u as ze}from"./useJunkMailboxIds-CW7aI25D.js";import{u as He}from"./useMediaQuery-Hy81MQ2M.js";import{u as Ve,p as U,R as _e}from"./MessageBody-jG4Dhul6.js";import{l as Ge,b as Qe,a as Je}from"./MailViewChrome-CLgaFbe-.js";import{d as Ke,w as Ue}from"./wizard-selection-zWa1qc6-.js";import{f as Xe}from"./ErrorState-BTHOmsYP.js";const Ts={starred:!0},Ze=["from","subject","category","unread","starred","attachments"],$e=(r,s,o)=>{const n=me(s),{params:d,residual:c}=ge(o,{...n,...r},Ze);return{criteria:{...d,...n},residual:c}};function Ye({rows:r,verb:s}){const{selectedIds:o,exitSelection:n}=ve(),d=l.useMemo(()=>Ue(r,o),[r,o]);return e.jsx(ye,{verb:s,selection:d,selectionRestriction:"spansAccounts",onFinished:n})}function es({collection:r,title:s,selectedMessageId:o,onOpenThread:n,commandsRef:d,onTriageContextChange:c,onDeleteMessages:f}){const{searchQuery:g,resultFolderIndex:a,onSearchClearQuery:C}=_(),p=Ve(),W=He(),P=de(),[u,h]=l.useState("all"),[v,F]=l.useState(new Set),w=l.useCallback(i=>{F(y=>{const x=new Set(y);return x.has(i)?x.delete(i):x.add(i),x})},[]),S=l.useCallback(()=>{h("all"),F(new Set)},[]),I=l.useCallback(()=>{S(),C()},[S,C]),{freeText:j,tokens:b}=U(g.trim().toLowerCase(),p),A=U(g.trim(),p).freeText,{criteria:L,residual:m}=l.useMemo(()=>$e(r,{category:u,attributes:v},b),[r,u,v,b]),M=l.useMemo(()=>j?{...L,query:j}:L,[L,j]),{threads:D,isLoading:N,isError:R,error:q,refetch:O,fetchNextPage:z,hasNextPage:H,isFetchingNextPage:k}=X(r,M),B=ze(),t=l.useMemo(()=>Ke(D).map(i=>pe(i,B)).filter(i=>fe(i,m)),[D,m,B]),T=l.useCallback((i,y)=>{const x=t.find(le=>le.id===i)?.threadId;x&&n?.({threadId:x,messageId:i},y)},[t,n]),V=l.useCallback(i=>{const y=i.threadId??t.find(x=>x.id===i.id)?.threadId;y&&n?.({threadId:y,messageId:i.id})},[t,n]),se=l.useMemo(()=>xe(),[]),te=l.useMemo(()=>t.map(i=>Ie(i,a)),[t,a]),oe=he(r,M)??null,ne=l.useMemo(()=>"starred"in r?b.filter(i=>i.type!=="isStarred"):b,[r,b]),re=Ge({chips:{category:u,attributes:v},tokens:ne,reach:m.length>0?"loaded-pages":"whole-folder",onClear:I}),Q=N?"loading":R?"error":t.length===0?"empty":"ready",ae=l.useCallback(()=>{const i=ce(ue());window.open(i,"_blank","noopener,noreferrer")},[]),J=Te(),ie=e.jsx("div",{className:"flex h-full min-h-0 flex-col",children:e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx("div",{className:"divide-y divide-line",children:t.map(i=>e.jsx(Ce,{thread:i,active:i.id===o,onClick:()=>T(i.id)},i.id))}),H?e.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>z(),disabled:k,children:k?"Loading…":"Load more"}):null]})});return e.jsx(Qe,{title:s,unreadCount:oe,preset:se,selectedCategory:u,activeFilters:v,onSelectCategory:h,onToggleFilter:w,onClearFilters:S,searchResults:te,searchLoading:N,onSelectSearchResult:V,searchResultsInBody:!0,children:e.jsxs(be,{selectedMessageId:o,rows:t,onOpen:T,onDeleteMessages:f,onSelectionVerb:P.start,commandsRef:d,onTriageContextChange:c,children:[e.jsx(Je,{listTitle:s,sections:[{id:"collection",threads:t}],flatList:!0,hideHeader:!0,listState:J.searchResults?"ready":Q,listFilter:re,listScopeLabel:s,searchQuery:A||void 0,errorMessage:R?Xe(q):void 0,onRetry:()=>O(),onReportError:ae,selectedThreadId:o,onSelectThread:T,isDesktop:W,selectionBar:e.jsx(Re,{title:s}),listBody:J.searchResults??(Q==="ready"?ie:void 0)}),e.jsx(Ye,{rows:t,verb:P.verb})]})})}const Y=l.createContext(null);function E(){const r=l.useContext(Y);if(!r)throw new Error("CollectionPane.* must be used inside <CollectionPane>");return r}function ss({collection:r,title:s,thread:o,children:n}){const d=De(),c=Ne(),f=qe(),{searchInput:g}=_(),a=o?.threadId,C=o?.messageId,{threads:p}=X(r),W=l.useMemo(()=>{if(a)return p.find(t=>t.messageId===C)??p.find(t=>t.threadId===a)},[p,a,C]),P=we(a,C),u=W??P,h=C??u?.messageId,v=l.useMemo(()=>{if(a)return{threadId:a,mailboxId:u?.mailboxId??"",subject:u?.subject,messageId:h,row:u}},[a,u,h]),F=l.useCallback((t,T)=>{d(t,{replace:T?.replace,query:g})},[d,g]),w=l.useCallback(t=>{h&&t.includes(h)&&c()},[h,c]),S=K({thread:u,isOpen:!0,onAfterOptimisticRemove:w}),I=Se(),{deleteMessages:j}=je({mailboxId:u?.mailboxId??"",messages:p,onAfterOptimisticRemove:w}),{toggleReadFor:b}=Me({mailboxId:u?.mailboxId??"",messages:p}),A=I.focusedMessageId,m=l.useMemo(()=>p.find(t=>t.messageId===A),[p,A])??u,M=K({thread:m,isOpen:m?.messageId===h}),D=Le(),N=Be(),R=Ee(),q=l.useMemo(()=>We(R,a,h),[R,a,h]),O=l.useMemo(()=>{if(m)return t=>R({threadId:m.threadId,messageId:m.messageId,mode:t})},[R,m]),{nextMessageId:z,previousMessageId:H}=Oe({context:I,orderedIds:I.orderedIds,selectedMessageId:h,enabled:!D&&!N,hasOpenThread:a!==void 0,onClose:c,handlers:{reply:()=>O?.("reply"),replyAll:()=>O?.("reply-all"),forward:()=>O?.("forward"),delete:()=>{I.listCommandsRef.current?.requestVerb("delete")||M.deleteThread()},toggleStar:M.toggleStar,toggleRead:()=>{I.listCommandsRef.current?.requestVerb("markRead")||m&&b([m.messageId],!m.isRead)},goBrief:()=>f("brief"),goSettings:()=>f("settings")}}),k=l.useCallback(t=>{if(!t)return;const T=p.find(V=>V.messageId===t);return T?{threadId:T.threadId,messageId:t}:void 0},[p]),B={collection:r,title:s,selectedMessageId:h,selectedThread:u,conversation:v,onOpenThread:F,onCloseThread:c,nextThread:k(z),previousThread:k(H),actions:S,onReply:q,triage:I,onDeleteMessages:j,handleDeselectIfRemoved:w};return e.jsx(Y.Provider,{value:B,children:n})}function ee(){const{collection:r,title:s,selectedMessageId:o,onOpenThread:n,triage:d,onDeleteMessages:c}=E();return e.jsx(es,{collection:r,title:s,selectedMessageId:o,onOpenThread:n,commandsRef:d.listCommandsRef,onTriageContextChange:d.onTriageContextChange,onDeleteMessages:c})}function ts(){const r=G(),{conversation:s,selectedThread:o,actions:n,onReply:d,handleDeselectIfRemoved:c,onOpenThread:f}=E(),g=!!s,a=Fe(s?.threadId);return e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[e.jsx(Ae,{hasThread:g,intelligenceOpen:a.isShowing,canToggleIntelligence:a.canToggle,onToggleIntelligence:a.toggle,onReply:d?()=>d("reply"):void 0,onReplyAll:d?()=>d("reply-all"):void 0,onForward:d?()=>d("forward"):void 0,onDelete:g?n.deleteThread:void 0,onToggleStar:g?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:g&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s?e.jsx(Z,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,spamRow:s.row,onOpenIntelligence:a.open,listOnScreen:!0}):e.jsx(_e,{})})]}),e.jsx($,{isOpen:a.drawerOpen,onClose:a.closeDrawer,thread:o,accountId:o?.accountId,onAfterOptimisticRemove:c,onReplyWithText:r,onOpenThread:f})]})}function os(){const r=G(),{selectedThread:s,handleDeselectIfRemoved:o,onOpenThread:n}=E(),{onToggleIntelligence:d}=_();return e.jsx(Pe,{onClose:d,thread:s,accountId:s?.accountId,onAfterOptimisticRemove:o,onReplyWithText:r,onOpenThread:n})}function ns(){const r=G(),{selectedThread:s,conversation:o,onCloseThread:n,onOpenThread:d,nextThread:c,previousThread:f,handleDeselectIfRemoved:g}=E(),a=ke(o?.threadId??null);return o?e.jsxs(e.Fragment,{children:[e.jsx(Z,{threadId:o.threadId,mailboxId:o.mailboxId,subject:o.subject,selectedMessageId:o.messageId,spamRow:o.row,onBack:n,onOpenIntelligence:a.toggle,onSwipeNext:c?()=>d(c):void 0,onSwipePrevious:f?()=>d(f):void 0,mobileIntelligenceOpen:a.isOpen}),e.jsx($,{isOpen:a.isOpen,onClose:a.close,thread:s,accountId:s?.accountId,onAfterOptimisticRemove:g,onReplyWithText:r,onOpenThread:d})]}):e.jsx("div",{className:"h-full",children:e.jsx(ee,{})})}const Cs=Object.assign(ss,{List:ee,Reading:ts,Intelligence:os,Phone:ns});export{Cs as C,Ts as S};
1
+ import{P as _,dp as de,r as l,az as ce,aA as ue,j as e}from"./index-C2US5ZnK.js";import{a as X,b as he}from"./useCollectionThreads-B1vimpsO.js";import{y as me,A as ge,ao as pe,aq as fe,aA as xe,ar as Ie,d as Te,M as Ce,ax as be,aB as Re,az as ve,m as ye,G as we,K,J as Se,H as je,e as Me,V as Oe,W as G,X as ke,Z,_ as $,$ as Pe,a0 as Fe,a1 as Ae}from"./MessageToolbar-HTPVoP6C.js";import"./nav-link-Df_MDzvJ.js";import{a as Le}from"./useMessageBodyContent-DwHmQdO9.js";import{e as De,f as Ne}from"./search-token-index-BymL-AGz.js";import{g as Be,f as Ee,r as We}from"./reply-CijQsg4o.js";import{u as qe}from"./sections-FtpeSpRq.js";import{u as ze}from"./useJunkMailboxIds-D3M8TbeX.js";import{u as He}from"./useMediaQuery-BaUDTtu8.js";import{u as Ve,p as U,R as _e}from"./MessageBody-Lnqqwldl.js";import{l as Ge,b as Qe,a as Je}from"./MailViewChrome-pi6cPv-J.js";import{d as Ke,w as Ue}from"./wizard-selection-zWa1qc6-.js";import{f as Xe}from"./ErrorState-g7-Y1uhe.js";const Ts={starred:!0},Ze=["from","subject","category","unread","starred","attachments"],$e=(r,s,o)=>{const n=me(s),{params:d,residual:c}=ge(o,{...n,...r},Ze);return{criteria:{...d,...n},residual:c}};function Ye({rows:r,verb:s}){const{selectedIds:o,exitSelection:n}=ve(),d=l.useMemo(()=>Ue(r,o),[r,o]);return e.jsx(ye,{verb:s,selection:d,selectionRestriction:"spansAccounts",onFinished:n})}function es({collection:r,title:s,selectedMessageId:o,onOpenThread:n,commandsRef:d,onTriageContextChange:c,onDeleteMessages:f}){const{searchQuery:g,resultFolderIndex:a,onSearchClearQuery:C}=_(),p=Ve(),W=He(),P=de(),[u,h]=l.useState("all"),[v,F]=l.useState(new Set),w=l.useCallback(i=>{F(y=>{const x=new Set(y);return x.has(i)?x.delete(i):x.add(i),x})},[]),S=l.useCallback(()=>{h("all"),F(new Set)},[]),I=l.useCallback(()=>{S(),C()},[S,C]),{freeText:j,tokens:b}=U(g.trim().toLowerCase(),p),A=U(g.trim(),p).freeText,{criteria:L,residual:m}=l.useMemo(()=>$e(r,{category:u,attributes:v},b),[r,u,v,b]),M=l.useMemo(()=>j?{...L,query:j}:L,[L,j]),{threads:D,isLoading:N,isError:R,error:q,refetch:O,fetchNextPage:z,hasNextPage:H,isFetchingNextPage:k}=X(r,M),B=ze(),t=l.useMemo(()=>Ke(D).map(i=>pe(i,B)).filter(i=>fe(i,m)),[D,m,B]),T=l.useCallback((i,y)=>{const x=t.find(le=>le.id===i)?.threadId;x&&n?.({threadId:x,messageId:i},y)},[t,n]),V=l.useCallback(i=>{const y=i.threadId??t.find(x=>x.id===i.id)?.threadId;y&&n?.({threadId:y,messageId:i.id})},[t,n]),se=l.useMemo(()=>xe(),[]),te=l.useMemo(()=>t.map(i=>Ie(i,a)),[t,a]),oe=he(r,M)??null,ne=l.useMemo(()=>"starred"in r?b.filter(i=>i.type!=="isStarred"):b,[r,b]),re=Ge({chips:{category:u,attributes:v},tokens:ne,reach:m.length>0?"loaded-pages":"whole-folder",onClear:I}),Q=N?"loading":R?"error":t.length===0?"empty":"ready",ae=l.useCallback(()=>{const i=ce(ue());window.open(i,"_blank","noopener,noreferrer")},[]),J=Te(),ie=e.jsx("div",{className:"flex h-full min-h-0 flex-col",children:e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx("div",{className:"divide-y divide-line",children:t.map(i=>e.jsx(Ce,{thread:i,active:i.id===o,onClick:()=>T(i.id)},i.id))}),H?e.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>z(),disabled:k,children:k?"Loading…":"Load more"}):null]})});return e.jsx(Qe,{title:s,unreadCount:oe,preset:se,selectedCategory:u,activeFilters:v,onSelectCategory:h,onToggleFilter:w,onClearFilters:S,searchResults:te,searchLoading:N,onSelectSearchResult:V,searchResultsInBody:!0,children:e.jsxs(be,{selectedMessageId:o,rows:t,onOpen:T,onDeleteMessages:f,onSelectionVerb:P.start,commandsRef:d,onTriageContextChange:c,children:[e.jsx(Je,{listTitle:s,sections:[{id:"collection",threads:t}],flatList:!0,hideHeader:!0,listState:J.searchResults?"ready":Q,listFilter:re,listScopeLabel:s,searchQuery:A||void 0,errorMessage:R?Xe(q):void 0,onRetry:()=>O(),onReportError:ae,selectedThreadId:o,onSelectThread:T,isDesktop:W,selectionBar:e.jsx(Re,{title:s}),listBody:J.searchResults??(Q==="ready"?ie:void 0)}),e.jsx(Ye,{rows:t,verb:P.verb})]})})}const Y=l.createContext(null);function E(){const r=l.useContext(Y);if(!r)throw new Error("CollectionPane.* must be used inside <CollectionPane>");return r}function ss({collection:r,title:s,thread:o,children:n}){const d=De(),c=Ne(),f=qe(),{searchInput:g}=_(),a=o?.threadId,C=o?.messageId,{threads:p}=X(r),W=l.useMemo(()=>{if(a)return p.find(t=>t.messageId===C)??p.find(t=>t.threadId===a)},[p,a,C]),P=we(a,C),u=W??P,h=C??u?.messageId,v=l.useMemo(()=>{if(a)return{threadId:a,mailboxId:u?.mailboxId??"",subject:u?.subject,messageId:h,row:u}},[a,u,h]),F=l.useCallback((t,T)=>{d(t,{replace:T?.replace,query:g})},[d,g]),w=l.useCallback(t=>{h&&t.includes(h)&&c()},[h,c]),S=K({thread:u,isOpen:!0,onAfterOptimisticRemove:w}),I=Se(),{deleteMessages:j}=je({mailboxId:u?.mailboxId??"",messages:p,onAfterOptimisticRemove:w}),{toggleReadFor:b}=Me({mailboxId:u?.mailboxId??"",messages:p}),A=I.focusedMessageId,m=l.useMemo(()=>p.find(t=>t.messageId===A),[p,A])??u,M=K({thread:m,isOpen:m?.messageId===h}),D=Le(),N=Be(),R=Ee(),q=l.useMemo(()=>We(R,a,h),[R,a,h]),O=l.useMemo(()=>{if(m)return t=>R({threadId:m.threadId,messageId:m.messageId,mode:t})},[R,m]),{nextMessageId:z,previousMessageId:H}=Oe({context:I,orderedIds:I.orderedIds,selectedMessageId:h,enabled:!D&&!N,hasOpenThread:a!==void 0,onClose:c,handlers:{reply:()=>O?.("reply"),replyAll:()=>O?.("reply-all"),forward:()=>O?.("forward"),delete:()=>{I.listCommandsRef.current?.requestVerb("delete")||M.deleteThread()},toggleStar:M.toggleStar,toggleRead:()=>{I.listCommandsRef.current?.requestVerb("markRead")||m&&b([m.messageId],!m.isRead)},goBrief:()=>f("brief"),goSettings:()=>f("settings")}}),k=l.useCallback(t=>{if(!t)return;const T=p.find(V=>V.messageId===t);return T?{threadId:T.threadId,messageId:t}:void 0},[p]),B={collection:r,title:s,selectedMessageId:h,selectedThread:u,conversation:v,onOpenThread:F,onCloseThread:c,nextThread:k(z),previousThread:k(H),actions:S,onReply:q,triage:I,onDeleteMessages:j,handleDeselectIfRemoved:w};return e.jsx(Y.Provider,{value:B,children:n})}function ee(){const{collection:r,title:s,selectedMessageId:o,onOpenThread:n,triage:d,onDeleteMessages:c}=E();return e.jsx(es,{collection:r,title:s,selectedMessageId:o,onOpenThread:n,commandsRef:d.listCommandsRef,onTriageContextChange:d.onTriageContextChange,onDeleteMessages:c})}function ts(){const r=G(),{conversation:s,selectedThread:o,actions:n,onReply:d,handleDeselectIfRemoved:c,onOpenThread:f}=E(),g=!!s,a=Fe(s?.threadId);return e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[e.jsx(Ae,{hasThread:g,intelligenceOpen:a.isShowing,canToggleIntelligence:a.canToggle,onToggleIntelligence:a.toggle,onReply:d?()=>d("reply"):void 0,onReplyAll:d?()=>d("reply-all"):void 0,onForward:d?()=>d("forward"):void 0,onDelete:g?n.deleteThread:void 0,onToggleStar:g?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:g&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s?e.jsx(Z,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,spamRow:s.row,onOpenIntelligence:a.open,listOnScreen:!0}):e.jsx(_e,{})})]}),e.jsx($,{isOpen:a.drawerOpen,onClose:a.closeDrawer,thread:o,accountId:o?.accountId,onAfterOptimisticRemove:c,onReplyWithText:r,onOpenThread:f})]})}function os(){const r=G(),{selectedThread:s,handleDeselectIfRemoved:o,onOpenThread:n}=E(),{onToggleIntelligence:d}=_();return e.jsx(Pe,{onClose:d,thread:s,accountId:s?.accountId,onAfterOptimisticRemove:o,onReplyWithText:r,onOpenThread:n})}function ns(){const r=G(),{selectedThread:s,conversation:o,onCloseThread:n,onOpenThread:d,nextThread:c,previousThread:f,handleDeselectIfRemoved:g}=E(),a=ke(o?.threadId??null);return o?e.jsxs(e.Fragment,{children:[e.jsx(Z,{threadId:o.threadId,mailboxId:o.mailboxId,subject:o.subject,selectedMessageId:o.messageId,spamRow:o.row,onBack:n,onOpenIntelligence:a.toggle,onSwipeNext:c?()=>d(c):void 0,onSwipePrevious:f?()=>d(f):void 0,mobileIntelligenceOpen:a.isOpen}),e.jsx($,{isOpen:a.isOpen,onClose:a.close,thread:s,accountId:s?.accountId,onAfterOptimisticRemove:g,onReplyWithText:r,onOpenThread:d})]}):e.jsx("div",{className:"h-full",children:e.jsx(ee,{})})}const Cs=Object.assign(ss,{List:ee,Reading:ts,Intelligence:os,Phone:ns});export{Cs as C,Ts as S};
@@ -1 +1 @@
1
- import{b as x,r as u,j as a,p as f,C as A,u as y,N as w,aa as S,ab as P}from"./index-fsuIswbe.js";import{u as h}from"./useLayoutTier-BNUKvwJD.js";import{c as M,u as k}from"./nav-link-ed0mFCCx.js";import"./reply-CXuSMyqp.js";import{a as C}from"./sections-DpRVKuXF.js";import{A as R}from"./avatar-Bq7beWCy.js";import{u as L,P as O,a as z,b as d}from"./popover-menu-DhcuKv1N.js";import{u as D}from"./roving-focus-DZX7IpN4.js";import{M as F}from"./mail-BzFJWQZy.js";import{A as T}from"./app-chrome-BfyGOiSA.js";const g={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};g.node;const E=x(g);const b={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};b.node;const ne=x(b);function _({email:e,sections:s=[],onOpenSection:n,onSignOut:o}){const t=u.useRef(null),{open:r,setOpen:i,containerRef:l,panelRef:m,getAnchor:N}=L("account-menu",()=>t.current?.focus());u.useEffect(()=>{if(!r)return;const c=requestAnimationFrame(()=>m.current?.querySelector('[role="menuitem"]')?.focus());return()=>cancelAnimationFrame(c)},[r,m]);const p=e??"Account";return a.jsxs("div",{ref:l,className:"relative",children:[a.jsx("button",{ref:t,type:"button","aria-label":"Account","aria-haspopup":"menu","aria-expanded":r,onClick:()=>i(c=>!c),className:"inline-flex min-h-11 min-w-11 items-center justify-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-raised hover:text-fg",children:a.jsx(R,{name:p,email:e??void 0,size:"sm"})}),a.jsx(O,{open:r,align:"end",panelRef:m,getAnchor:N,children:a.jsxs(z,{ref:m,label:p,children:[e&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"truncate px-4 py-2 text-xs text-fg-muted",title:e,"data-testid":"account-menu-email",children:e}),a.jsx("hr",{className:"my-1 h-px border-0 bg-line"})]}),s.map(c=>a.jsx(d,{label:c.label,icon:c.icon,onSelect:()=>{i(!1),n?.(c.id)}},c.id)),a.jsx(d,{label:"Sign out",icon:a.jsx(E,{className:"size-4"}),onSelect:()=>{i(!1),t.current?.focus(),o()}})]})})]})}const B={mail:F,calendar:A},I="[data-app-item]",K=e=>e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey;function v({item:e,active:s,onNavigate:n,className:o,iconClassName:t}){const r=B[e.id];return a.jsxs("a",{href:e.href,"data-app-item":"","aria-current":s?"page":void 0,onClick:i=>{K(i)&&(i.preventDefault(),n(e.id))},className:f("flex flex-col items-center justify-center gap-0.5 rounded-lg outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring",s?"bg-accent-soft text-accent":"text-fg-muted hover:bg-surface-sunken hover:text-fg",o),children:[a.jsx(r,{className:t,"aria-hidden":"true"}),a.jsx("span",{className:"text-2xs font-medium",children:e.label})]})}function q({items:e,active:s,onNavigate:n,className:o}){const t=u.useRef(null);return D({containerRef:t,itemSelector:I}),a.jsx("nav",{ref:t,"aria-label":"Apps",className:f("flex w-16 shrink-0 flex-col items-center gap-1 border-r border-line bg-surface py-2",o),children:e.map(r=>a.jsx(v,{item:r,active:r.id===s,onNavigate:n,className:"size-14",iconClassName:"size-5"},r.id))})}function H({items:e,active:s,onNavigate:n,className:o}){return a.jsx("nav",{"aria-label":"Apps",className:f("flex shrink-0 items-stretch justify-around border-t border-line bg-surface px-2 pt-1 pb-[max(0.25rem,env(safe-area-inset-bottom))]",o),children:e.map(t=>a.jsx(v,{item:t,active:t.id===s,onNavigate:n,className:"min-h-12 min-w-16 flex-1",iconClassName:"size-5"},t.id))})}function te({leading:e,search:s,actions:n,className:o}){return a.jsxs("header",{className:f("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",o),children:[e&&a.jsx("div",{className:"flex shrink-0 items-center gap-1",children:e}),a.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:a.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),n&&a.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n})]})}const $=e=>e.startsWith("/calendar")?"calendar":"mail";function j(){const e=y(),s=w(),n=M(),o=k({select:l=>l.pathname}),t=$(o),r=u.useMemo(()=>[{id:"mail",label:"Mail",href:s.buildLocation({to:"/mail",hash:n}).href},{id:"calendar",label:"Calendar",href:s.buildLocation({to:"/calendar",hash:n}).href}],[s,n]),i=u.useCallback(l=>{e({to:l==="calendar"?"/calendar":"/mail",hash:n})},[e,n]);return{items:r,active:t,switchTo:i}}function re({children:e,hideTabBar:s=!1}){const n=h()==="phone",{items:o,active:t,switchTo:r}=j();return n?a.jsxs("div",{className:"flex h-full w-full flex-col",style:s?void 0:{"--app-tab-bar":"3.5rem"},children:[a.jsx("div",{className:"min-h-0 flex-1",children:e}),!s&&a.jsx(H,{items:o,active:t,onNavigate:r})]}):a.jsx(a.Fragment,{children:e})}const V=({children:e})=>{const{Account:s}=S();return a.jsx(s,{children:e})},oe=()=>{const e=C(),s=P();return a.jsx(V,{children:({email:n,signOut:o})=>a.jsx(_,{email:n,sections:s.map(({id:t,label:r,icon:i})=>({id:t,label:r,icon:i})),onOpenSection:e,onSignOut:o})})};function W(){const{items:e,active:s,switchTo:n}=j();return a.jsx(q,{items:e,active:s,onNavigate:n})}function ie({topBar:e,children:s}){return h()==="phone"?a.jsx(a.Fragment,{children:s}):a.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden bg-canvas",children:a.jsx(T,{topBar:e,appBar:a.jsx(W,{}),children:s})})}export{te as A,ie as D,E as L,ne as S,oe as a,re as b,V as c,W as d};
1
+ import{b as x,r as u,j as a,p as f,C as A,u as y,N as w,aa as S,ab as P}from"./index-C2US5ZnK.js";import{u as h}from"./useLayoutTier-lXeQo_2w.js";import{c as M,u as k}from"./nav-link-Df_MDzvJ.js";import"./reply-CijQsg4o.js";import{a as C}from"./sections-FtpeSpRq.js";import{A as R}from"./avatar-CVmRGlvx.js";import{u as L,P as O,a as z,b as d}from"./popover-menu-D4kT-xqh.js";import{u as D}from"./roving-focus-C0jnB7ie.js";import{M as F}from"./mail-Cqr91KmH.js";import{A as T}from"./app-chrome-CGYf2rTW.js";const g={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};g.node;const E=x(g);const b={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};b.node;const ne=x(b);function _({email:e,sections:s=[],onOpenSection:n,onSignOut:o}){const t=u.useRef(null),{open:r,setOpen:i,containerRef:l,panelRef:m,getAnchor:N}=L("account-menu",()=>t.current?.focus());u.useEffect(()=>{if(!r)return;const c=requestAnimationFrame(()=>m.current?.querySelector('[role="menuitem"]')?.focus());return()=>cancelAnimationFrame(c)},[r,m]);const p=e??"Account";return a.jsxs("div",{ref:l,className:"relative",children:[a.jsx("button",{ref:t,type:"button","aria-label":"Account","aria-haspopup":"menu","aria-expanded":r,onClick:()=>i(c=>!c),className:"inline-flex min-h-11 min-w-11 items-center justify-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-raised hover:text-fg",children:a.jsx(R,{name:p,email:e??void 0,size:"sm"})}),a.jsx(O,{open:r,align:"end",panelRef:m,getAnchor:N,children:a.jsxs(z,{ref:m,label:p,children:[e&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"truncate px-4 py-2 text-xs text-fg-muted",title:e,"data-testid":"account-menu-email",children:e}),a.jsx("hr",{className:"my-1 h-px border-0 bg-line"})]}),s.map(c=>a.jsx(d,{label:c.label,icon:c.icon,onSelect:()=>{i(!1),n?.(c.id)}},c.id)),a.jsx(d,{label:"Sign out",icon:a.jsx(E,{className:"size-4"}),onSelect:()=>{i(!1),t.current?.focus(),o()}})]})})]})}const B={mail:F,calendar:A},I="[data-app-item]",K=e=>e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey;function v({item:e,active:s,onNavigate:n,className:o,iconClassName:t}){const r=B[e.id];return a.jsxs("a",{href:e.href,"data-app-item":"","aria-current":s?"page":void 0,onClick:i=>{K(i)&&(i.preventDefault(),n(e.id))},className:f("flex flex-col items-center justify-center gap-0.5 rounded-lg outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring",s?"bg-accent-soft text-accent":"text-fg-muted hover:bg-surface-sunken hover:text-fg",o),children:[a.jsx(r,{className:t,"aria-hidden":"true"}),a.jsx("span",{className:"text-2xs font-medium",children:e.label})]})}function q({items:e,active:s,onNavigate:n,className:o}){const t=u.useRef(null);return D({containerRef:t,itemSelector:I}),a.jsx("nav",{ref:t,"aria-label":"Apps",className:f("flex w-16 shrink-0 flex-col items-center gap-1 border-r border-line bg-surface py-2",o),children:e.map(r=>a.jsx(v,{item:r,active:r.id===s,onNavigate:n,className:"size-14",iconClassName:"size-5"},r.id))})}function H({items:e,active:s,onNavigate:n,className:o}){return a.jsx("nav",{"aria-label":"Apps",className:f("flex shrink-0 items-stretch justify-around border-t border-line bg-surface px-2 pt-1 pb-[max(0.25rem,env(safe-area-inset-bottom))]",o),children:e.map(t=>a.jsx(v,{item:t,active:t.id===s,onNavigate:n,className:"min-h-12 min-w-16 flex-1",iconClassName:"size-5"},t.id))})}function te({leading:e,search:s,actions:n,className:o}){return a.jsxs("header",{className:f("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",o),children:[e&&a.jsx("div",{className:"flex shrink-0 items-center gap-1",children:e}),a.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:a.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),n&&a.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n})]})}const $=e=>e.startsWith("/calendar")?"calendar":"mail";function j(){const e=y(),s=w(),n=M(),o=k({select:l=>l.pathname}),t=$(o),r=u.useMemo(()=>[{id:"mail",label:"Mail",href:s.buildLocation({to:"/mail",hash:n}).href},{id:"calendar",label:"Calendar",href:s.buildLocation({to:"/calendar",hash:n}).href}],[s,n]),i=u.useCallback(l=>{e({to:l==="calendar"?"/calendar":"/mail",hash:n})},[e,n]);return{items:r,active:t,switchTo:i}}function re({children:e,hideTabBar:s=!1}){const n=h()==="phone",{items:o,active:t,switchTo:r}=j();return n?a.jsxs("div",{className:"flex h-full w-full flex-col",style:s?void 0:{"--app-tab-bar":"3.5rem"},children:[a.jsx("div",{className:"min-h-0 flex-1",children:e}),!s&&a.jsx(H,{items:o,active:t,onNavigate:r})]}):a.jsx(a.Fragment,{children:e})}const V=({children:e})=>{const{Account:s}=S();return a.jsx(s,{children:e})},oe=()=>{const e=C(),s=P();return a.jsx(V,{children:({email:n,signOut:o})=>a.jsx(_,{email:n,sections:s.map(({id:t,label:r,icon:i})=>({id:t,label:r,icon:i})),onOpenSection:e,onSignOut:o})})};function W(){const{items:e,active:s,switchTo:n}=j();return a.jsx(q,{items:e,active:s,onNavigate:n})}function ie({topBar:e,children:s}){return h()==="phone"?a.jsx(a.Fragment,{children:s}):a.jsx("div",{className:"flex h-full w-full flex-col overflow-hidden bg-canvas",children:a.jsx(T,{topBar:e,appBar:a.jsx(W,{}),children:s})})}export{te as A,ie as D,E as L,ne as S,oe as a,re as b,V as c,W as d};
@@ -1 +1 @@
1
- import{r as o,n as d,j as s,p as l}from"./index-fsuIswbe.js";const m=({trigger:r,children:t,align:a="right"})=>{const[e,n]=o.useState(!1),i=o.useRef(null),c=o.useCallback(u=>{i.current&&!i.current.contains(u.target)&&n(!1)},[]);return d({id:"dropdown-menu",open:e,answers:{back:()=>n(!1)}}),o.useEffect(()=>(e&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)),[e,c]),s.jsxs("div",{ref:i,className:"relative",children:[s.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),n(!e)},className:l("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:r}),e&&s.jsx("div",{className:l("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",a==="right"?"right-0":"left-0"),children:t})]})},f=({onClick:r,disabled:t,destructive:a,children:e})=>s.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t||r()},disabled:t,className:l("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",a&&"text-danger hover:text-danger"),children:e}),x=()=>s.jsx("div",{className:"my-1 h-px bg-line"});export{m as D,f as a,x as b};
1
+ import{r as o,n as d,j as s,p as l}from"./index-C2US5ZnK.js";const m=({trigger:r,children:t,align:a="right"})=>{const[e,n]=o.useState(!1),i=o.useRef(null),c=o.useCallback(u=>{i.current&&!i.current.contains(u.target)&&n(!1)},[]);return d({id:"dropdown-menu",open:e,answers:{back:()=>n(!1)}}),o.useEffect(()=>(e&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)),[e,c]),s.jsxs("div",{ref:i,className:"relative",children:[s.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),n(!e)},className:l("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:r}),e&&s.jsx("div",{className:l("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",a==="right"?"right-0":"left-0"),children:t})]})},f=({onClick:r,disabled:t,destructive:a,children:e})=>s.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t||r()},disabled:t,className:l("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",a&&"text-danger hover:text-danger"),children:e}),x=()=>s.jsx("div",{className:"my-1 h-px bg-line"});export{m as D,f as a,x as b};
@@ -1 +1 @@
1
- import{j as e,at as d,p as i,ag as l}from"./index-fsuIswbe.js";function x({clashes:t,clearText:s="Nothing else is booked over it.",className:a}){return t.length===0?e.jsxs("p",{className:i("flex items-center gap-2 rounded-md border border-line bg-surface-sunken p-2 text-xs text-fg-muted",a),children:[e.jsx(d,{className:"size-3.5 shrink-0 text-positive","aria-hidden":!0}),s]}):e.jsxs("div",{className:i("flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft p-2",a),children:[e.jsx(l,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs font-semibold text-danger",children:t.length===1?"This clashes with something you have already agreed to.":`This clashes with ${t.length} things you have already agreed to.`}),e.jsx("ul",{className:"mt-1 flex flex-col gap-0.5",children:t.map(r=>e.jsx("li",{className:"text-xs text-fg",children:r.label},r.id))})]})]})}const m=({message:t,icon:s})=>e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[s&&e.jsx("div",{className:"mb-4 text-fg-muted",children:s}),e.jsx("p",{className:"text-fg-muted",children:t})]});export{x as C,m as E};
1
+ import{j as e,at as d,p as i,ag as l}from"./index-C2US5ZnK.js";function x({clashes:t,clearText:s="Nothing else is booked over it.",className:a}){return t.length===0?e.jsxs("p",{className:i("flex items-center gap-2 rounded-md border border-line bg-surface-sunken p-2 text-xs text-fg-muted",a),children:[e.jsx(d,{className:"size-3.5 shrink-0 text-positive","aria-hidden":!0}),s]}):e.jsxs("div",{className:i("flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft p-2",a),children:[e.jsx(l,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-xs font-semibold text-danger",children:t.length===1?"This clashes with something you have already agreed to.":`This clashes with ${t.length} things you have already agreed to.`}),e.jsx("ul",{className:"mt-1 flex flex-col gap-0.5",children:t.map(r=>e.jsx("li",{className:"text-xs text-fg",children:r.label},r.id))})]})]})}const m=({message:t,icon:s})=>e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[s&&e.jsx("div",{className:"mb-4 text-fg-muted",children:s}),e.jsx("p",{className:"text-fg-muted",children:t})]});export{x as C,m as E};
@@ -1 +1 @@
1
- import{j as t,y as r}from"./index-fsuIswbe.js";const d=e=>e instanceof Error?e.message:typeof e=="string"?e:typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:"An unexpected error occurred",l=({title:e="Couldn't load content",error:a,onRetry:s,variant:i="block"})=>{const n=d(a);return i==="inline"?t.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[t.jsx(r,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-fg-muted mt-0.5 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}):t.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[t.jsx(r,{className:"size-8 text-danger","aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-sm text-fg-muted mt-1 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center rounded-md border border-line bg-canvas px-4 py-2 text-sm font-medium hover:bg-surface-raised transition-colors",children:"Retry"})]})};export{l as E,d as f};
1
+ import{j as t,y as r}from"./index-C2US5ZnK.js";const d=e=>e instanceof Error?e.message:typeof e=="string"?e:typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:"An unexpected error occurred",l=({title:e="Couldn't load content",error:a,onRetry:s,variant:i="block"})=>{const n=d(a);return i==="inline"?t.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[t.jsx(r,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-fg-muted mt-0.5 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}):t.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[t.jsx(r,{className:"size-8 text-danger","aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-sm text-fg-muted mt-1 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center rounded-md border border-line bg-canvas px-4 py-2 text-sm font-medium hover:bg-surface-raised transition-colors",children:"Retry"})]})};export{l as E,d as f};
@@ -1 +1 @@
1
- import{r as n,a as f,c as m,n as N,j as e,X as w}from"./index-fsuIswbe.js";import{D as r,C as u,u as E}from"./index-Caon2n2j.js";import{u as k}from"./useMediaQuery-Hy81MQ2M.js";import"./nav-link-ed0mFCCx.js";import{d as x,e as p,f as h}from"./useMessageBodyContent-CpTD2HGg.js";import"./reply-CXuSMyqp.js";import{E as b}from"./ErrorState-BTHOmsYP.js";import{C as S}from"./confirm-dialog-XvccFJdE.js";const C=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},O=()=>{const t=x(),i=p(),s=h(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return N({id:"mobile-compose",open:!0}),e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:C(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(b,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(u,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(S,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},L=()=>{const t=x(),i=p(),s=h(),a=k(),{isError:l,error:o,refetch:d}=f({...m(),staleTime:1/0});if(E({bindings:[{key:"Escape",handler:s,preventDefault:!0}]}),!a)return e.jsx(O,{});const c=e.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h2",{className:"text-lg font-semibold truncate",children:C(t)})}),e.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:e.jsx(w,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(b,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(u,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{L as F};
1
+ import{r as n,a as f,c as m,n as N,j as e,X as w}from"./index-C2US5ZnK.js";import{D as r,C as u,u as E}from"./index-v9nM8Dsp.js";import{u as k}from"./useMediaQuery-BaUDTtu8.js";import"./nav-link-Df_MDzvJ.js";import{d as x,e as p,f as h}from"./useMessageBodyContent-DwHmQdO9.js";import"./reply-CijQsg4o.js";import{E as b}from"./ErrorState-g7-Y1uhe.js";import{C as S}from"./confirm-dialog-BdT5xj08.js";const C=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},O=()=>{const t=x(),i=p(),s=h(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return N({id:"mobile-compose",open:!0}),e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:C(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(b,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(u,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(S,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},L=()=>{const t=x(),i=p(),s=h(),a=k(),{isError:l,error:o,refetch:d}=f({...m(),staleTime:1/0});if(E({bindings:[{key:"Escape",handler:s,preventDefault:!0}]}),!a)return e.jsx(O,{});const c=e.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h2",{className:"text-lg font-semibold truncate",children:C(t)})}),e.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:e.jsx(w,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(b,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(u,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{L as F};
@@ -1 +1 @@
1
- import{e as g,an as f,f as b,U as y,V as v,cC as x,eS as C,r as p,eb as L,j as c,eT as h}from"./index-fsuIswbe.js";import{am as M}from"./MessageToolbar-DeDUhCvg.js";import{u as k,l as d,i as E}from"./useLabels-k1VKuQrr.js";import{c as A}from"./popover-menu-DhcuKv1N.js";const I=3,w=({hasSearchQuery:e,freeText:t,residualTokenCount:s})=>{if(!e||s>0)return!1;const a=t.trim();return a.length===0||a.length>=I},_=e=>e===void 0?{kind:"unknown"}:{kind:"exact",value:e},z=e=>{const t=new Set;for(const s of e)s&&t.add(s);return t.size>1?{accountId:void 0,restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"}:{accountId:t.size===1?[...t][0]:void 0,restriction:void 0,moveDisabledHint:void 0}},T=e=>{const{mailboxId:t,messages:s}=e,a=g(),{pushError:l}=f(),{mutateAsync:r,isPending:o}=b({...C(),onError:(n,i)=>{l({title:i.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:x(n),error:n})},onSettled:(n,i,u)=>{y(a,v(M(u.body.messageIds??[],s??[],t)))}});return{applyLabel:p.useCallback((n,i,u)=>{n.length!==0&&L(n,m=>r({body:{messageIds:m,labelId:i,action:u}}))},[r]),isPending:o}};function U({accountId:e,mailboxId:t,messageIds:s}){const{labels:a}=k(e),{applyLabel:l}=T({mailboxId:t}),r=p.useMemo(()=>a.map(o=>({key:o.labelId,label:o.name,icon:c.jsx("span",{className:`size-2.5 rounded-full ${E(o.color)?d[o.color]:d.Default}`}),onSelect:()=>l(s,o.labelId,"Apply")})),[a,s,l]);return r.length===0?null:c.jsx(A,{triggerLabel:"Apply label to selected messages",triggerIcon:c.jsx(h,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:r,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}export{U as L,z as r,w as s,_ as t};
1
+ import{e as g,an as f,f as b,U as y,V as v,cC as x,eU as C,r as p,ed as L,j as c,eV as h}from"./index-C2US5ZnK.js";import{am as M}from"./MessageToolbar-HTPVoP6C.js";import{u as k,l as d,i as E}from"./useLabels-DnF0cYWq.js";import{c as A}from"./popover-menu-D4kT-xqh.js";const I=3,S=({hasSearchQuery:e,freeText:t,residualTokenCount:s})=>{if(!e||s>0)return!1;const a=t.trim();return a.length===0||a.length>=I},U=e=>e===void 0?{kind:"unknown"}:{kind:"exact",value:e},_=e=>{const t=new Set;for(const s of e)s&&t.add(s);return t.size>1?{accountId:void 0,restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"}:{accountId:t.size===1?[...t][0]:void 0,restriction:void 0,moveDisabledHint:void 0}},j=e=>{const{mailboxId:t,messages:s}=e,a=g(),{pushError:l}=f(),{mutateAsync:r,isPending:o}=b({...C(),onError:(n,i)=>{l({title:i.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:x(n),error:n})},onSettled:(n,i,u)=>{y(a,v(M(u.body.messageIds??[],s??[],t)))}});return{applyLabel:p.useCallback((n,i,u)=>{n.length!==0&&L(n,m=>r({body:{messageIds:m,labelId:i,action:u}}))},[r]),isPending:o}};function z({accountId:e,mailboxId:t,messageIds:s}){const{labels:a}=k(e),{applyLabel:l}=j({mailboxId:t}),r=p.useMemo(()=>a.map(o=>({key:o.labelId,label:o.name,icon:c.jsx("span",{className:`size-2.5 rounded-full ${E(o.color)?d[o.color]:d.Default}`}),onSelect:()=>l(s,o.labelId,"Apply")})),[a,s,l]);return r.length===0?null:c.jsx(A,{triggerLabel:"Apply label to selected messages",triggerIcon:c.jsx(h,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:r,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}export{z as L,_ as r,S as s,U as t};
@@ -1 +1 @@
1
- import{l as m}from"./reply-CXuSMyqp.js";import{j as r,r as u,A as l}from"./index-fsuIswbe.js";import"./nav-link-ed0mFCCx.js";import{a as v}from"./useMessageBodyContent-CpTD2HGg.js";import{F as x}from"./FullCompose-DiZNltCL.js";import{A as p}from"./search-scope-B-3MTDpD.js";function C(o,n,s){if(o!==n)return s}function M(o,n){return o===""?"":n}function A({searchInput:o,committedQuery:n,urlQuery:s,pathname:t,listPath:a}){return!m(t,a)||n!==o?!1:n!==s}const c=u.createContext(null),B=({chrome:o,children:n})=>r.jsx(c.Provider,{value:o,children:n});function N({phone:o,list:n,reading:s,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=v();if(!e)return r.jsx(l,{});const i={nav:e.nav,appBar:e.appBar,overlay:e.overlay,skeleton:r.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?r.jsx(p,{...i,list:f?r.jsx(x,{}):o,intelligenceOpen:e.intelligenceOpen}):r.jsx(p,{...i,topBar:e.topBar,list:n,reading:s,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}export{B as M,N as a,A as b,M as c,C as s};
1
+ import{l as m}from"./reply-CijQsg4o.js";import{j as r,r as u,A as l}from"./index-C2US5ZnK.js";import"./nav-link-Df_MDzvJ.js";import{a as v}from"./useMessageBodyContent-DwHmQdO9.js";import{F as x}from"./FullCompose-CN22d_2q.js";import{A as p}from"./search-scope-7jHRUZbg.js";function C(o,n,s){if(o!==n)return s}function M(o,n){return o===""?"":n}function A({searchInput:o,committedQuery:n,urlQuery:s,pathname:t,listPath:a}){return!m(t,a)||n!==o?!1:n!==s}const c=u.createContext(null),B=({chrome:o,children:n})=>r.jsx(c.Provider,{value:o,children:n});function N({phone:o,list:n,reading:s,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=v();if(!e)return r.jsx(l,{});const i={nav:e.nav,appBar:e.appBar,overlay:e.overlay,skeleton:r.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?r.jsx(p,{...i,list:f?r.jsx(x,{}):o,intelligenceOpen:e.intelligenceOpen}):r.jsx(p,{...i,topBar:e.topBar,list:n,reading:s,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}export{B as M,N as a,A as b,M as c,C as s};
@@ -1 +1 @@
1
- import{j as e,L as oe,B as z,y as le,r as f,p as K,at as ce,T as de,P as ue}from"./index-fsuIswbe.js";import{j as fe,o as me}from"./search-token-index-BYKMNlJD.js";import{u as xe,L as U}from"./roving-focus-DZX7IpN4.js";import{a6 as pe,c as ge,C as X,a7 as he,a8 as je,a9 as be,aa as ve,ab as we,ac as Ne,o as ye,ad as Re,ae as Ce,af as Se,ag as ke,ah as Ee,ai as V,aj as Te,ak as Pe,al as Me}from"./MessageToolbar-DeDUhCvg.js";import{k as Ie}from"./search-scope-B-3MTDpD.js";import{d as Le,t as Ae,v as De}from"./MessageBody-jG4Dhul6.js";import{A as ze}from"./avatar-Bq7beWCy.js";import{M as Oe}from"./mail-BzFJWQZy.js";import{R as $e}from"./refresh-cw-Cu9_I3cT.js";import{M as _e}from"./menu-Bh94jr77.js";function He(){return e.jsx("div",{className:"space-y-0",role:"status","aria-busy":"true","aria-label":"Loading messages",children:Array.from({length:8}).map((s,n)=>e.jsxs("div",{className:"animate-pulse border-b border-line px-3 py-2",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-surface-sunken"}),e.jsx("div",{className:"h-3 w-16 rounded bg-surface-sunken"})]}),e.jsx("div",{className:"mb-2 h-4 w-48 rounded bg-surface-sunken"}),e.jsx("div",{className:"h-3 w-full rounded bg-surface-sunken"})]},n))})}function Fe({filter:s,scopeLabel:n,searchQuery:a}){const c=a?.trim();return s?e.jsxs(Y,{children:[e.jsx("p",{className:"font-medium text-fg",children:Ge(s.label,n,c)}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:We[s.reach]}),e.jsx(z,{variant:"secondary",size:"sm",className:"mt-4",onClick:s.onClear,children:"Clear filter"})]}):e.jsx(Y,{children:e.jsx("p",{className:"text-fg-muted",children:Be(c,n)})})}const We={"whole-folder":"Every message in this folder was checked.","loaded-pages":"Only the messages loaded so far were checked."};function Be(s,n){return s?"No messages match your search":n?`No messages in ${n}`:"No messages in this mailbox"}function Ge(s,n,a){return a?`No results for “${a}” in ${s}`:n?`No ${s} in ${n}`:`No ${s}`}function Y({children:s}){return e.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:e.jsx("div",{className:"flex max-w-sm flex-col items-center justify-center p-8 text-center",children:s})})}function us(){return e.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-fg-muted",role:"status","aria-live":"polite",children:[e.jsx(oe,{className:"size-4 animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading more…"})]})}function Ke({message:s="Something went wrong loading this mailbox.",onRetry:n,onReport:a}){return e.jsx("div",{className:"flex h-full flex-1 items-center justify-center p-4",children:e.jsxs("div",{role:"alert",className:"flex max-w-sm flex-col items-center justify-center gap-3 text-center",children:[e.jsx(le,{className:"size-8 text-danger","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load messages"}),e.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&e.jsx(z,{variant:"secondary",size:"sm",onClick:n,children:"Retry"}),a&&e.jsx(z,{variant:"ghost",size:"sm",onClick:a,children:"Report a problem"})]})]})})}const I=72;function q(s){return s==="leading"?I:s==="trailing"?-I:0}function Ue(s){return s>=I/2?"leading":s<=-I/2?"trailing":"none"}function Xe({thread:s,selectionMode:n,checked:a,active:c,peek:d,onPeek:l,onToggleCheck:h,onLongPress:j,onOpen:R,onAct:b}){const[v,C]=f.useState(null),w=f.useRef(null),m=f.useRef(!1),y=i=>{w.current=i,C(i)},x=i=>{const E=w.current,L=m.current;if(m.current=!1,y(null),!(i.event.type.endsWith("cancel")||L)){if(i.tap){if(n){h();return}if(d!=="none"){l("none");return}R();return}i.axis!=="x"||n||E===null||l(Ue(E))}},N=Le(i=>{if(!i.down){x(i);return}if(we(i)){if(n)return;m.current=!0,Ne(),j();return}if(!i.intentional||n||m.current||i.axis!=="x")return;const E=i.values[0]-i.initial[0];y(Math.max(-I,Math.min(I,q(d)+E)))},{...be(ve),tapsThreshold:De,axisThreshold:Ae.axisThreshold}),g=pe(N(),je,{"aria-description":n?void 0:"Select message"}),p=v??q(d),r=p>0?"leading":p<0?"trailing":"none",u=K("relative touch-pan-y bg-surface","select-none",ge({active:a||c})),S={transform:p!==0?`translateX(${p}px)`:void 0,transition:v===null?"transform 150ms ease":"none",minHeight:44},k=!s.isRead,P=i=>i.stopPropagation(),O=n?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:K("inline-flex size-7 shrink-0 items-center justify-center rounded-full border",a?"border-accent bg-accent text-accent-fg":"border-line-strong bg-canvas"),children:a&&e.jsx(ce,{className:"size-3.5"})}),e.jsx(X,{thread:s})]}):e.jsxs(e.Fragment,{children:[k&&e.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),e.jsx("span",{role:"checkbox",tabIndex:0,"aria-checked":a,"aria-label":`Select message from ${s.fromName}`,onPointerDown:P,onPointerMove:P,onPointerUp:P,onClick:i=>{i.preventDefault(),i.stopPropagation(),j()},onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),i.stopPropagation(),j())},className:"-m-2 inline-flex size-11 shrink-0 items-center justify-center rounded-full",children:e.jsx(ze,{name:s.fromName,email:s.fromEmail,size:"sm"})}),e.jsx(X,{thread:s})]});return e.jsxs("div",{className:"relative overflow-hidden",children:[r==="leading"&&e.jsx("button",{type:"button",onClick:()=>b("leading"),"aria-label":s.isRead?"Mark as unread":"Mark as read",className:"absolute inset-y-0 left-0 flex items-center justify-start bg-accent-2 px-6 text-accent-fg",children:s.isRead?e.jsx(Oe,{className:"size-6"}):e.jsx(he,{className:"size-6"})}),r==="trailing"&&e.jsx("button",{type:"button",onClick:()=>b("trailing"),"aria-label":"Delete message",className:"absolute inset-y-0 right-0 flex items-center justify-end bg-danger px-6 text-canvas",children:e.jsx(de,{className:"size-6"})}),e.jsx("button",{type:"button",role:n?"checkbox":void 0,"aria-checked":n?a:void 0,"data-message-row":!0,"data-message-id":s.id,...g,className:u,style:S,children:O})]})}function Ye({sections:s,selectedThreadId:n,selectionMode:a,checkedIds:c,initialPeek:d,onToggleCheck:l,onEnterSelection:h,onOpenThread:j,onRefresh:R,refreshing:b,busy:v=!1}){const[C,w]=f.useState(new Set),[m,y]=f.useState(new Map),x=s.flatMap(r=>r.threads).filter(r=>!C.has(r.id)).map(r=>{const u=m.get(r.id);return u===void 0?r:{...r,isRead:u}}),[N,g]=f.useState(d&&d!=="none"&&x[1]?{id:x[1].id,side:d}:null),p=(r,u)=>{if(u==="trailing")w(S=>new Set(S).add(r));else{const S=x.find(k=>k.id===r);y(k=>new Map(k).set(r,!S?.isRead))}g(null)};return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[b&&e.jsxs("div",{className:"flex items-center justify-center gap-2 border-b border-line py-3 text-fg-muted",children:[e.jsx($e,{className:"size-4 animate-spin"}),e.jsx("span",{className:"text-xs",children:"Checking for new mail…"})]}),e.jsx("div",{className:"divide-y divide-line",children:x.map(r=>e.jsx("div",{className:v?"pointer-events-none opacity-50":void 0,children:e.jsx(Xe,{thread:r,selectionMode:a,checked:c.has(r.id),active:r.id===n,peek:N?.id===r.id?N.side:"none",onPeek:u=>g(u==="none"?null:{id:r.id,side:u}),onToggleCheck:()=>l(r.id),onLongPress:()=>h(r.id),onOpen:()=>j(r.id),onAct:u=>p(r.id,u)})},r.id))}),!a&&!b&&!v&&e.jsx("button",{type:"button",onClick:R,className:"w-full border-t border-line py-2 text-center text-2xs text-fg-subtle transition-colors hover:bg-surface-sunken",children:"Pull to refresh"})]})}const qe=new Set;function fs({listTitle:s,listMeta:n,sections:a,briefFilters:c,flatList:d,listState:l="ready",searchQuery:h,listFilter:j,listScopeLabel:R,errorMessage:b,onRetry:v,onReportError:C,briefFilter:w,selectedThreadId:m,density:y="comfortable",onSelectThread:x,onOpenNav:N,isDesktop:g,initialTouchState:p,selection:r,keyboard:u,selectionBar:S,paneOverlay:k,listBody:P,hideHeader:O=!1}){const i=y==="compact"?Ce:Se,E=f.useRef(null),L=f.useRef(null),M=Ie(u);xe({containerRef:E,itemSelector:U,enabled:!M});const T=M?u.focusedId:void 0,$=M?T??a[0]?.threads[0]?.id:void 0,_=f.useCallback(t=>$===void 0?void 0:t===$?0:-1,[$]);f.useEffect(()=>{if(T===void 0)return;const t=L.current;if(!t)return;const o=t.querySelector(`${U}[data-message-id="${T}"]`);!o||o===t.ownerDocument.activeElement||o.focus({preventScroll:!1})},[T]),f.useEffect(()=>{if(!M)return;const t=L.current;if(!t)return;const o=t.ownerDocument.activeElement;o!==null&&o!==t.ownerDocument.body||t.focus({preventScroll:!0})},[M]);const ee=!g&&!c&&l==="ready",[se,B]=f.useState(!1),te=p==="peek-trailing"?"trailing":p==="peek-leading"?"leading":void 0,ne=()=>{B(!0),setTimeout(()=>B(!1),1400)},D=r?.selectedIds??qe,A=r?.onToggle,G=r?.onRowSelect,ae=ye(D.size,g),H=f.useCallback(t=>{if(A)return{checked:D.has(t),onToggle:o=>{o.preventDefault(),o.stopPropagation(),A(t)}}},[D,A]),F=f.useCallback((t,o)=>G?.(t,Re(o))?(o.preventDefault(),o.shiftKey&&window.getSelection()?.removeAllRanges(),!0):!1,[G]),re=f.useCallback(({thread:t,active:o,onClick:W})=>e.jsx(i,{thread:t,active:o,focused:t.id===T,tabIndex:_(t.id),selection:H(t.id),onClick:ie=>{F(t.id,ie)||W?.()}}),[i,H,F,T,_]);return e.jsxs("section",{ref:t=>{L.current=t,u?.ref(t)},tabIndex:M?-1:void 0,className:"relative flex h-full w-full flex-col bg-surface outline-none",children:[S??(O?null:e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[N&&e.jsx(z,{variant:"ghost",size:"sm",icon:e.jsx(_e,{className:"size-4"}),onClick:N,"aria-label":"Open folders",className:"-ml-1 shrink-0"}),e.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:s}),n&&e.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:n})]})),l==="loading"?e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(He,{})}):l==="empty"?e.jsx(Fe,{filter:j,scopeLabel:R,searchQuery:h}):l==="error"?e.jsx(Ke,{message:b,onRetry:v,onReport:C}):c&&w?e.jsx(ke,{...w,sections:a,selectedThreadId:m,Row:re,keyboard:u,onSelectThread:x}):P??(ee?e.jsx(Ye,{sections:a,selectedThreadId:m,selectionMode:ae,checkedIds:D,initialPeek:te,onToggleCheck:t=>A?.(t),onEnterSelection:t=>A?.(t),onOpenThread:t=>x?.(t),onRefresh:ne,refreshing:se}):e.jsx("div",{ref:E,className:"flex-1 overflow-y-auto",children:a.map(t=>e.jsxs("div",{children:[!d&&t.label&&e.jsxs("div",{className:"sticky top-0 flex h-section-row items-center justify-between border-b border-line bg-surface-sunken px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),e.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:t.threads.length})]}),e.jsx("div",{className:"divide-y divide-line",children:t.threads.map(o=>e.jsx(i,{thread:o,active:o.id===m,focused:o.id===T,tabIndex:_(o.id),selection:H(o.id),onClick:W=>{F(o.id,W)||x?.(o.id)}},o.id))})]},t.id))})),g&&e.jsx(Ee,{hints:u?me(u.handlers):fe}),k]})}const J={dimension:"read",position:"pre",text:"unread"},Ve={dimension:"read",position:"pre",text:"read"},Q={dimension:"starred",position:"pre",text:"starred"},Z={dimension:"attachment",position:"post",text:"with an attachment"},Je=[["unread",J],["flagged",Q],["attachment",Z]],Qe=s=>{switch(s.type){case"category":return{dimension:"category",position:"pre",text:V(s.category)??s.value};case"isUnread":return J;case"isRead":return Ve;case"isStarred":return Q;case"hasAttachment":return Z;case"from":return{dimension:s.raw,position:"post",text:`from ${s.value}`};case"subject":return{dimension:s.raw,position:"post",text:`about “${s.value}”`};case"before":return{dimension:s.raw,position:"post",text:`sent before ${s.value}`};case"after":return{dimension:s.raw,position:"post",text:`sent on or after ${s.value}`};case"in":return{dimension:s.raw,position:"post",text:`in ${s.value}`};case"account":return{dimension:s.raw,position:"post",text:`in the ${s.value} account`}}},Ze=(s,n)=>{const a=new Map,c=l=>{a.has(l.dimension)||a.set(l.dimension,l)},d=V(s.category);d&&c({dimension:"category",position:"pre",text:d});for(const[l,h]of Je)s.attributes.has(l)&&c(h);for(const l of n)c(Qe(l));return[...a.values()]},es=(s,n)=>{const a=Ze(s,n);if(a.length===0)return;const c=d=>a.filter(l=>l.position===d).map(l=>l.text);return[...c("pre"),"mail",...c("post")].join(" ")},ms=({chips:s,tokens:n,reach:a,onClear:c})=>{const d=es(s,n);if(d)return{label:d,reach:a,onClear:c}};function xs({title:s,unreadCount:n,preset:a,selectedCategory:c,activeFilters:d,onSelectCategory:l,onToggleFilter:h,onSelectSource:j,onClearFilters:R,children:b,footer:v,searchResults:C,searchLoading:w,onSelectSearchResult:m,searchResultsLabel:y,searchResultsInBody:x,refreshControl:N}){const{searchInput:g}=ue(),p=g.trim().length>0,r={categories:a.categories,filters:a.filters,sources:a.sources,selectedCategory:c,activeFilters:d,onSelectCategory:l,onSelectSource:j,onToggleFilter:h,onClear:R};return e.jsx(Te,{hasSheet:!p,children:e.jsx(Pe,{title:s,unreadCount:n,footer:v,searchFilter:r,searchResults:C,searchLoading:w,onSelectSearchResult:m,searchResultsLabel:y,searchResultsInBody:x,refreshControl:N,children:e.jsx(Me,{...r,hideChrome:p,children:b})})})}export{us as M,Xe as S,fs as a,xs as b,ms as l};
1
+ import{j as e,L as oe,B as z,y as le,r as f,p as K,at as ce,T as de,P as ue}from"./index-C2US5ZnK.js";import{j as fe,o as me}from"./search-token-index-BymL-AGz.js";import{u as xe,L as U}from"./roving-focus-C0jnB7ie.js";import{a6 as pe,c as ge,C as X,a7 as he,a8 as je,a9 as be,aa as ve,ab as we,ac as Ne,o as ye,ad as Re,ae as Ce,af as Se,ag as ke,ah as Ee,ai as V,aj as Te,ak as Pe,al as Me}from"./MessageToolbar-HTPVoP6C.js";import{k as Ie}from"./search-scope-7jHRUZbg.js";import{d as Le,t as Ae,v as De}from"./MessageBody-Lnqqwldl.js";import{A as ze}from"./avatar-CVmRGlvx.js";import{M as Oe}from"./mail-Cqr91KmH.js";import{R as $e}from"./refresh-cw-CY0SJjI-.js";import{M as _e}from"./menu-CEGeda9s.js";function He(){return e.jsx("div",{className:"space-y-0",role:"status","aria-busy":"true","aria-label":"Loading messages",children:Array.from({length:8}).map((s,n)=>e.jsxs("div",{className:"animate-pulse border-b border-line px-3 py-2",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-surface-sunken"}),e.jsx("div",{className:"h-3 w-16 rounded bg-surface-sunken"})]}),e.jsx("div",{className:"mb-2 h-4 w-48 rounded bg-surface-sunken"}),e.jsx("div",{className:"h-3 w-full rounded bg-surface-sunken"})]},n))})}function Fe({filter:s,scopeLabel:n,searchQuery:a}){const c=a?.trim();return s?e.jsxs(Y,{children:[e.jsx("p",{className:"font-medium text-fg",children:Ge(s.label,n,c)}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:We[s.reach]}),e.jsx(z,{variant:"secondary",size:"sm",className:"mt-4",onClick:s.onClear,children:"Clear filter"})]}):e.jsx(Y,{children:e.jsx("p",{className:"text-fg-muted",children:Be(c,n)})})}const We={"whole-folder":"Every message in this folder was checked.","loaded-pages":"Only the messages loaded so far were checked."};function Be(s,n){return s?"No messages match your search":n?`No messages in ${n}`:"No messages in this mailbox"}function Ge(s,n,a){return a?`No results for “${a}” in ${s}`:n?`No ${s} in ${n}`:`No ${s}`}function Y({children:s}){return e.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:e.jsx("div",{className:"flex max-w-sm flex-col items-center justify-center p-8 text-center",children:s})})}function us(){return e.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-fg-muted",role:"status","aria-live":"polite",children:[e.jsx(oe,{className:"size-4 animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading more…"})]})}function Ke({message:s="Something went wrong loading this mailbox.",onRetry:n,onReport:a}){return e.jsx("div",{className:"flex h-full flex-1 items-center justify-center p-4",children:e.jsxs("div",{role:"alert",className:"flex max-w-sm flex-col items-center justify-center gap-3 text-center",children:[e.jsx(le,{className:"size-8 text-danger","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load messages"}),e.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&e.jsx(z,{variant:"secondary",size:"sm",onClick:n,children:"Retry"}),a&&e.jsx(z,{variant:"ghost",size:"sm",onClick:a,children:"Report a problem"})]})]})})}const I=72;function q(s){return s==="leading"?I:s==="trailing"?-I:0}function Ue(s){return s>=I/2?"leading":s<=-I/2?"trailing":"none"}function Xe({thread:s,selectionMode:n,checked:a,active:c,peek:d,onPeek:l,onToggleCheck:h,onLongPress:j,onOpen:R,onAct:b}){const[v,C]=f.useState(null),w=f.useRef(null),m=f.useRef(!1),y=i=>{w.current=i,C(i)},x=i=>{const E=w.current,L=m.current;if(m.current=!1,y(null),!(i.event.type.endsWith("cancel")||L)){if(i.tap){if(n){h();return}if(d!=="none"){l("none");return}R();return}i.axis!=="x"||n||E===null||l(Ue(E))}},N=Le(i=>{if(!i.down){x(i);return}if(we(i)){if(n)return;m.current=!0,Ne(),j();return}if(!i.intentional||n||m.current||i.axis!=="x")return;const E=i.values[0]-i.initial[0];y(Math.max(-I,Math.min(I,q(d)+E)))},{...be(ve),tapsThreshold:De,axisThreshold:Ae.axisThreshold}),g=pe(N(),je,{"aria-description":n?void 0:"Select message"}),p=v??q(d),r=p>0?"leading":p<0?"trailing":"none",u=K("relative touch-pan-y bg-surface","select-none",ge({active:a||c})),S={transform:p!==0?`translateX(${p}px)`:void 0,transition:v===null?"transform 150ms ease":"none",minHeight:44},k=!s.isRead,P=i=>i.stopPropagation(),O=n?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:K("inline-flex size-7 shrink-0 items-center justify-center rounded-full border",a?"border-accent bg-accent text-accent-fg":"border-line-strong bg-canvas"),children:a&&e.jsx(ce,{className:"size-3.5"})}),e.jsx(X,{thread:s})]}):e.jsxs(e.Fragment,{children:[k&&e.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),e.jsx("span",{role:"checkbox",tabIndex:0,"aria-checked":a,"aria-label":`Select message from ${s.fromName}`,onPointerDown:P,onPointerMove:P,onPointerUp:P,onClick:i=>{i.preventDefault(),i.stopPropagation(),j()},onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),i.stopPropagation(),j())},className:"-m-2 inline-flex size-11 shrink-0 items-center justify-center rounded-full",children:e.jsx(ze,{name:s.fromName,email:s.fromEmail,size:"sm"})}),e.jsx(X,{thread:s})]});return e.jsxs("div",{className:"relative overflow-hidden",children:[r==="leading"&&e.jsx("button",{type:"button",onClick:()=>b("leading"),"aria-label":s.isRead?"Mark as unread":"Mark as read",className:"absolute inset-y-0 left-0 flex items-center justify-start bg-accent-2 px-6 text-accent-fg",children:s.isRead?e.jsx(Oe,{className:"size-6"}):e.jsx(he,{className:"size-6"})}),r==="trailing"&&e.jsx("button",{type:"button",onClick:()=>b("trailing"),"aria-label":"Delete message",className:"absolute inset-y-0 right-0 flex items-center justify-end bg-danger px-6 text-canvas",children:e.jsx(de,{className:"size-6"})}),e.jsx("button",{type:"button",role:n?"checkbox":void 0,"aria-checked":n?a:void 0,"data-message-row":!0,"data-message-id":s.id,...g,className:u,style:S,children:O})]})}function Ye({sections:s,selectedThreadId:n,selectionMode:a,checkedIds:c,initialPeek:d,onToggleCheck:l,onEnterSelection:h,onOpenThread:j,onRefresh:R,refreshing:b,busy:v=!1}){const[C,w]=f.useState(new Set),[m,y]=f.useState(new Map),x=s.flatMap(r=>r.threads).filter(r=>!C.has(r.id)).map(r=>{const u=m.get(r.id);return u===void 0?r:{...r,isRead:u}}),[N,g]=f.useState(d&&d!=="none"&&x[1]?{id:x[1].id,side:d}:null),p=(r,u)=>{if(u==="trailing")w(S=>new Set(S).add(r));else{const S=x.find(k=>k.id===r);y(k=>new Map(k).set(r,!S?.isRead))}g(null)};return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[b&&e.jsxs("div",{className:"flex items-center justify-center gap-2 border-b border-line py-3 text-fg-muted",children:[e.jsx($e,{className:"size-4 animate-spin"}),e.jsx("span",{className:"text-xs",children:"Checking for new mail…"})]}),e.jsx("div",{className:"divide-y divide-line",children:x.map(r=>e.jsx("div",{className:v?"pointer-events-none opacity-50":void 0,children:e.jsx(Xe,{thread:r,selectionMode:a,checked:c.has(r.id),active:r.id===n,peek:N?.id===r.id?N.side:"none",onPeek:u=>g(u==="none"?null:{id:r.id,side:u}),onToggleCheck:()=>l(r.id),onLongPress:()=>h(r.id),onOpen:()=>j(r.id),onAct:u=>p(r.id,u)})},r.id))}),!a&&!b&&!v&&e.jsx("button",{type:"button",onClick:R,className:"w-full border-t border-line py-2 text-center text-2xs text-fg-subtle transition-colors hover:bg-surface-sunken",children:"Pull to refresh"})]})}const qe=new Set;function fs({listTitle:s,listMeta:n,sections:a,briefFilters:c,flatList:d,listState:l="ready",searchQuery:h,listFilter:j,listScopeLabel:R,errorMessage:b,onRetry:v,onReportError:C,briefFilter:w,selectedThreadId:m,density:y="comfortable",onSelectThread:x,onOpenNav:N,isDesktop:g,initialTouchState:p,selection:r,keyboard:u,selectionBar:S,paneOverlay:k,listBody:P,hideHeader:O=!1}){const i=y==="compact"?Ce:Se,E=f.useRef(null),L=f.useRef(null),M=Ie(u);xe({containerRef:E,itemSelector:U,enabled:!M});const T=M?u.focusedId:void 0,$=M?T??a[0]?.threads[0]?.id:void 0,_=f.useCallback(t=>$===void 0?void 0:t===$?0:-1,[$]);f.useEffect(()=>{if(T===void 0)return;const t=L.current;if(!t)return;const o=t.querySelector(`${U}[data-message-id="${T}"]`);!o||o===t.ownerDocument.activeElement||o.focus({preventScroll:!1})},[T]),f.useEffect(()=>{if(!M)return;const t=L.current;if(!t)return;const o=t.ownerDocument.activeElement;o!==null&&o!==t.ownerDocument.body||t.focus({preventScroll:!0})},[M]);const ee=!g&&!c&&l==="ready",[se,B]=f.useState(!1),te=p==="peek-trailing"?"trailing":p==="peek-leading"?"leading":void 0,ne=()=>{B(!0),setTimeout(()=>B(!1),1400)},D=r?.selectedIds??qe,A=r?.onToggle,G=r?.onRowSelect,ae=ye(D.size,g),H=f.useCallback(t=>{if(A)return{checked:D.has(t),onToggle:o=>{o.preventDefault(),o.stopPropagation(),A(t)}}},[D,A]),F=f.useCallback((t,o)=>G?.(t,Re(o))?(o.preventDefault(),o.shiftKey&&window.getSelection()?.removeAllRanges(),!0):!1,[G]),re=f.useCallback(({thread:t,active:o,onClick:W})=>e.jsx(i,{thread:t,active:o,focused:t.id===T,tabIndex:_(t.id),selection:H(t.id),onClick:ie=>{F(t.id,ie)||W?.()}}),[i,H,F,T,_]);return e.jsxs("section",{ref:t=>{L.current=t,u?.ref(t)},tabIndex:M?-1:void 0,className:"relative flex h-full w-full flex-col bg-surface outline-none",children:[S??(O?null:e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[N&&e.jsx(z,{variant:"ghost",size:"sm",icon:e.jsx(_e,{className:"size-4"}),onClick:N,"aria-label":"Open folders",className:"-ml-1 shrink-0"}),e.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:s}),n&&e.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:n})]})),l==="loading"?e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(He,{})}):l==="empty"?e.jsx(Fe,{filter:j,scopeLabel:R,searchQuery:h}):l==="error"?e.jsx(Ke,{message:b,onRetry:v,onReport:C}):c&&w?e.jsx(ke,{...w,sections:a,selectedThreadId:m,Row:re,keyboard:u,onSelectThread:x}):P??(ee?e.jsx(Ye,{sections:a,selectedThreadId:m,selectionMode:ae,checkedIds:D,initialPeek:te,onToggleCheck:t=>A?.(t),onEnterSelection:t=>A?.(t),onOpenThread:t=>x?.(t),onRefresh:ne,refreshing:se}):e.jsx("div",{ref:E,className:"flex-1 overflow-y-auto",children:a.map(t=>e.jsxs("div",{children:[!d&&t.label&&e.jsxs("div",{className:"sticky top-0 flex h-section-row items-center justify-between border-b border-line bg-surface-sunken px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),e.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:t.threads.length})]}),e.jsx("div",{className:"divide-y divide-line",children:t.threads.map(o=>e.jsx(i,{thread:o,active:o.id===m,focused:o.id===T,tabIndex:_(o.id),selection:H(o.id),onClick:W=>{F(o.id,W)||x?.(o.id)}},o.id))})]},t.id))})),g&&e.jsx(Ee,{hints:u?me(u.handlers):fe}),k]})}const J={dimension:"read",position:"pre",text:"unread"},Ve={dimension:"read",position:"pre",text:"read"},Q={dimension:"starred",position:"pre",text:"starred"},Z={dimension:"attachment",position:"post",text:"with an attachment"},Je=[["unread",J],["flagged",Q],["attachment",Z]],Qe=s=>{switch(s.type){case"category":return{dimension:"category",position:"pre",text:V(s.category)??s.value};case"isUnread":return J;case"isRead":return Ve;case"isStarred":return Q;case"hasAttachment":return Z;case"from":return{dimension:s.raw,position:"post",text:`from ${s.value}`};case"subject":return{dimension:s.raw,position:"post",text:`about “${s.value}”`};case"before":return{dimension:s.raw,position:"post",text:`sent before ${s.value}`};case"after":return{dimension:s.raw,position:"post",text:`sent on or after ${s.value}`};case"in":return{dimension:s.raw,position:"post",text:`in ${s.value}`};case"account":return{dimension:s.raw,position:"post",text:`in the ${s.value} account`}}},Ze=(s,n)=>{const a=new Map,c=l=>{a.has(l.dimension)||a.set(l.dimension,l)},d=V(s.category);d&&c({dimension:"category",position:"pre",text:d});for(const[l,h]of Je)s.attributes.has(l)&&c(h);for(const l of n)c(Qe(l));return[...a.values()]},es=(s,n)=>{const a=Ze(s,n);if(a.length===0)return;const c=d=>a.filter(l=>l.position===d).map(l=>l.text);return[...c("pre"),"mail",...c("post")].join(" ")},ms=({chips:s,tokens:n,reach:a,onClear:c})=>{const d=es(s,n);if(d)return{label:d,reach:a,onClear:c}};function xs({title:s,unreadCount:n,preset:a,selectedCategory:c,activeFilters:d,onSelectCategory:l,onToggleFilter:h,onSelectSource:j,onClearFilters:R,children:b,footer:v,searchResults:C,searchLoading:w,onSelectSearchResult:m,searchResultsLabel:y,searchResultsInBody:x,refreshControl:N}){const{searchInput:g}=ue(),p=g.trim().length>0,r={categories:a.categories,filters:a.filters,sources:a.sources,selectedCategory:c,activeFilters:d,onSelectCategory:l,onSelectSource:j,onToggleFilter:h,onClear:R};return e.jsx(Te,{hasSheet:!p,children:e.jsx(Pe,{title:s,unreadCount:n,footer:v,searchFilter:r,searchResults:C,searchLoading:w,onSelectSearchResult:m,searchResultsLabel:y,searchResultsInBody:x,refreshControl:N,children:e.jsx(Me,{...r,hideChrome:p,children:b})})})}export{us as M,Xe as S,fs as a,xs as b,ms as l};