@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 e,p as S,e as C,r as f,bS as A,a as k,f as E,bT as O,bU as q,B as N,X as L,u as G,af as D,bV as M,bW as Q,ar as F,bX as K,bY as B,bZ as T,q as _}from"./index-fsuIswbe.js";import{u as U}from"./useDebouncedValue-CFZ4EPXW.js";import{a as H}from"./sections-DpRVKuXF.js";import{s as X}from"./help-copy-DUjzIPXf.js";import{K as v}from"./kbd-jzPSd-a2.js";import{E as V}from"./ErrorState-BTHOmsYP.js";import{a as R,S as W}from"./settings-screen-DTYVWAkg.js";import"./avatar-Bq7beWCy.js";import"./badge-BB80tGxy.js";import"./chevron-left-CUHU8UT9.js";import"./menu-Bh94jr77.js";import"./circle-question-mark-DhNa_A16.js";function Y({options:s,active:o,onSelect:u}){return e.jsx("div",{role:"tablist",className:S("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:s.map(n=>{const d=n.id===o;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>u(n.id),className:S("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:n.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:n.count??"—"})]},n.id)})})}const I={vip:"VIPs",muted:"Muted",blocked:"Blocked (reported)",neverSpam:"Never in Spam"},Z=500,h={vip:"VIP",muted:"muted",blocked:"blocked",neverSpam:"never-in-spam"},P=(s,o)=>s.flags?.[o];function J({query:s}){const{data:o,isPending:u,isError:n,error:d}=k(B()),m=C(),c=E({...O(),onSettled:()=>{m.invalidateQueries({queryKey:T()}),m.invalidateQueries({queryKey:[{_id:"addressOperationsSearchAddresses"}]})}}),i=o?.suggestions??[],l=s.trim().toLowerCase(),p=l?i.filter(r=>(r.displayName??"").toLowerCase().includes(l)||r.normalizedEmail.toLowerCase().includes(l)):i;return u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):n?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:d})}):i.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(v,{children:"v"})," on any message to promote a sender to VIP."]}):p.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",s,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),p.map(r=>e.jsx(R,{name:r.displayName??r.normalizedEmail,email:r.normalizedEmail,meta:r.replyCount>0?`${r.inboundCount} received · you replied ${r.replyCount}×`:`${r.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(_,{className:"size-3.5"}),"aria-busy":c.isPending,onClick:()=>{c.isPending||c.mutate({path:{addressId:r.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},r.addressId))]})}function ee({group:s,query:o,onCount:u}){const n=U(o.trim(),300),d=C(),[m,c]=f.useState(null),i=s==="muted"?void 0:s,l=i!==void 0||n.length>=2,p=A({query:{q:n,limit:i?Z:50,flag:i}}),{data:r,isPending:b,isError:y,error:j}=k({...p,enabled:l}),x=E({...O(),onSuccess:()=>{d.invalidateQueries({queryKey:p.queryKey})}}),t=i?r?.items??[]:(r?.items??[]).filter(a=>P(a,s)?.value??!1);return f.useEffect(()=>{u?.(l?t.length:0,i?t.length:null)},[u,l,t.length,i]),l?b?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):y?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):t.length===0?e.jsx("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:n?`No ${h[s]} senders matching “${n}”.`:`No ${h[s]} senders yet.`}):e.jsx(e.Fragment,{children:t.map(a=>{const g=P(a,s),$=g?[h[s],g.setAt&&q(g.setAt,{month:"short",year:"numeric"})||null,g.reason?`— ${g.reason}`:null].filter(Boolean).join(" "):h[s],w=x.isPending&&x.variables?.path.addressId===a.addressId,z=x.isError&&m===a.addressId;return e.jsx(R,{name:a.displayName??a.normalizedEmail,email:a.normalizedEmail,danger:s==="blocked",meta:$,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{c(a.addressId),x.mutate({path:{addressId:a.addressId},body:{flags:{[s]:{value:!1,setAt:Date.now()}}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(L,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${h[s]} flag`,onClick:()=>{w||(c(a.addressId),x.mutate({path:{addressId:a.addressId},body:{flags:{[s]:{value:!1,setAt:Date.now()}}}}))}})},a.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",h[s]," senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Press ",e.jsx(v,{children:"m"})," on any message to mute its sender; ",e.jsx(v,{children:"b"})," to block."]})]})}function pe(){const s=G(),o=D(),u=H(),n=M.useSearch({select:t=>t.group??"vip"}),d=t=>{s({to:"/settings/senders",search:{group:t},replace:!0})},[m,c]=f.useState(""),[i,l]=f.useState(!0),[p,r]=f.useState(0),[b,y]=f.useState({vip:null,muted:null,blocked:null,neverSpam:null}),j=f.useCallback((t,a)=>{r(t),y(g=>({...g,[n]:t}))},[n]),x=b[n];return e.jsx(W,{items:o,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:X,helpOpen:i,onToggleHelp:()=>l(t=>!t),onSelect:u,onBackToMail:()=>{s({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(Y,{active:n,onSelect:t=>{d(t),c("")},options:Q.map(t=>({id:t,label:I[t],count:b[t]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(F,{icon:e.jsx(K,{className:"size-4"}),placeholder:`Filter ${I[n].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:m,onChange:t=>c(t.target.value)})}),e.jsxs("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:[e.jsx(ee,{group:n,query:m,onCount:j}),n==="vip"&&e.jsx(J,{query:m})]}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:x!=null?`${p} of ${x} flagged senders`:`${p} flagged senders`}),e.jsxs("span",{children:[e.jsx(v,{children:"j"})," ",e.jsx(v,{children:"k"})," navigate · ",e.jsx(v,{children:"⌫"})," remove flag"]})]})]})]})})}export{ee as SearchGroupPane,pe as component};
1
+ import{j as e,p as S,e as C,r as f,bS as A,a as k,f as E,bT as O,bU as q,B as N,X as L,u as G,af as D,bV as M,bW as Q,ar as F,bX as K,bY as B,bZ as T,q as _}from"./index-C2US5ZnK.js";import{u as U}from"./useDebouncedValue-C3FljUyl.js";import{a as H}from"./sections-FtpeSpRq.js";import{s as X}from"./help-copy-Cy9gka_E.js";import{K as v}from"./kbd-C052hWKm.js";import{E as V}from"./ErrorState-g7-Y1uhe.js";import{a as R,S as W}from"./settings-screen-zihVEeS9.js";import"./avatar-CVmRGlvx.js";import"./badge-CDOouHHB.js";import"./chevron-left-Co8HGTow.js";import"./menu-CEGeda9s.js";import"./circle-question-mark-DuTpeMvV.js";function Y({options:s,active:o,onSelect:u}){return e.jsx("div",{role:"tablist",className:S("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:s.map(n=>{const d=n.id===o;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>u(n.id),className:S("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:n.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:n.count??"—"})]},n.id)})})}const I={vip:"VIPs",muted:"Muted",blocked:"Blocked (reported)",neverSpam:"Never in Spam"},Z=500,h={vip:"VIP",muted:"muted",blocked:"blocked",neverSpam:"never-in-spam"},P=(s,o)=>s.flags?.[o];function J({query:s}){const{data:o,isPending:u,isError:n,error:d}=k(B()),m=C(),c=E({...O(),onSettled:()=>{m.invalidateQueries({queryKey:T()}),m.invalidateQueries({queryKey:[{_id:"addressOperationsSearchAddresses"}]})}}),i=o?.suggestions??[],l=s.trim().toLowerCase(),p=l?i.filter(r=>(r.displayName??"").toLowerCase().includes(l)||r.normalizedEmail.toLowerCase().includes(l)):i;return u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):n?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:d})}):i.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(v,{children:"v"})," on any message to promote a sender to VIP."]}):p.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",s,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),p.map(r=>e.jsx(R,{name:r.displayName??r.normalizedEmail,email:r.normalizedEmail,meta:r.replyCount>0?`${r.inboundCount} received · you replied ${r.replyCount}×`:`${r.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(_,{className:"size-3.5"}),"aria-busy":c.isPending,onClick:()=>{c.isPending||c.mutate({path:{addressId:r.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},r.addressId))]})}function ee({group:s,query:o,onCount:u}){const n=U(o.trim(),300),d=C(),[m,c]=f.useState(null),i=s==="muted"?void 0:s,l=i!==void 0||n.length>=2,p=A({query:{q:n,limit:i?Z:50,flag:i}}),{data:r,isPending:b,isError:y,error:j}=k({...p,enabled:l}),x=E({...O(),onSuccess:()=>{d.invalidateQueries({queryKey:p.queryKey})}}),t=i?r?.items??[]:(r?.items??[]).filter(a=>P(a,s)?.value??!1);return f.useEffect(()=>{u?.(l?t.length:0,i?t.length:null)},[u,l,t.length,i]),l?b?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):y?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):t.length===0?e.jsx("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:n?`No ${h[s]} senders matching “${n}”.`:`No ${h[s]} senders yet.`}):e.jsx(e.Fragment,{children:t.map(a=>{const g=P(a,s),$=g?[h[s],g.setAt&&q(g.setAt,{month:"short",year:"numeric"})||null,g.reason?`— ${g.reason}`:null].filter(Boolean).join(" "):h[s],w=x.isPending&&x.variables?.path.addressId===a.addressId,z=x.isError&&m===a.addressId;return e.jsx(R,{name:a.displayName??a.normalizedEmail,email:a.normalizedEmail,danger:s==="blocked",meta:$,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{c(a.addressId),x.mutate({path:{addressId:a.addressId},body:{flags:{[s]:{value:!1,setAt:Date.now()}}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(L,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${h[s]} flag`,onClick:()=>{w||(c(a.addressId),x.mutate({path:{addressId:a.addressId},body:{flags:{[s]:{value:!1,setAt:Date.now()}}}}))}})},a.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",h[s]," senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Press ",e.jsx(v,{children:"m"})," on any message to mute its sender; ",e.jsx(v,{children:"b"})," to block."]})]})}function pe(){const s=G(),o=D(),u=H(),n=M.useSearch({select:t=>t.group??"vip"}),d=t=>{s({to:"/settings/senders",search:{group:t},replace:!0})},[m,c]=f.useState(""),[i,l]=f.useState(!0),[p,r]=f.useState(0),[b,y]=f.useState({vip:null,muted:null,blocked:null,neverSpam:null}),j=f.useCallback((t,a)=>{r(t),y(g=>({...g,[n]:t}))},[n]),x=b[n];return e.jsx(W,{items:o,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:X,helpOpen:i,onToggleHelp:()=>l(t=>!t),onSelect:u,onBackToMail:()=>{s({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(Y,{active:n,onSelect:t=>{d(t),c("")},options:Q.map(t=>({id:t,label:I[t],count:b[t]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(F,{icon:e.jsx(K,{className:"size-4"}),placeholder:`Filter ${I[n].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:m,onChange:t=>c(t.target.value)})}),e.jsxs("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:[e.jsx(ee,{group:n,query:m,onCount:j}),n==="vip"&&e.jsx(J,{query:m})]}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:x!=null?`${p} of ${x} flagged senders`:`${p} flagged senders`}),e.jsxs("span",{children:[e.jsx(v,{children:"j"})," ",e.jsx(v,{children:"k"})," navigate · ",e.jsx(v,{children:"⌫"})," remove flag"]})]})]})]})})}export{ee as SearchGroupPane,pe as component};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-C2US5ZnK.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -1 +1 @@
1
- import{r as j,j as e,p as f,B as i,X as N}from"./index-fsuIswbe.js";import{A as w}from"./avatar-Bq7beWCy.js";import{B as z}from"./badge-BB80tGxy.js";import{C as h}from"./chevron-left-CUHU8UT9.js";import{M as S}from"./menu-Bh94jr77.js";import{C as v}from"./circle-question-mark-DhNa_A16.js";function L({items:l,activeId:t,title:x,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:u,onBackToMail:m}){const[y,c]=j.useState(!1),[p,C]=j.useState(!1),b=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),c(!1)},className:f("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:f("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"safe-area-frame flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:m,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),g]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>c(!1)}),e.jsxs("aside",{className:"safe-area-frame relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{m?.(),c(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),onClick:()=>c(!1),"aria-label":"Close menu"})]}),g]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[m&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(h,{className:"size-4"}),className:"-ml-1 lg:hidden",onClick:m,"aria-label":"Back to mail"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(S,{className:"size-4"}),className:"lg:hidden",onClick:()=>c(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:x}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":p}),s&&!b&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&p&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),b&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function M({name:l,email:t,meta:x,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:f(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[x,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const B={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function Q({label:l,email:t,connector:x,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=B[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(z,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",x," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{Q as A,L as S,M as a};
1
+ import{r as j,j as e,p as f,B as i,X as N}from"./index-C2US5ZnK.js";import{A as w}from"./avatar-CVmRGlvx.js";import{B as z}from"./badge-CDOouHHB.js";import{C as h}from"./chevron-left-Co8HGTow.js";import{M as S}from"./menu-CEGeda9s.js";import{C as v}from"./circle-question-mark-DuTpeMvV.js";function L({items:l,activeId:t,title:x,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:u,onBackToMail:m}){const[y,c]=j.useState(!1),[p,C]=j.useState(!1),b=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),c(!1)},className:f("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:f("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"safe-area-frame flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:m,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),g]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>c(!1)}),e.jsxs("aside",{className:"safe-area-frame relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{m?.(),c(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),onClick:()=>c(!1),"aria-label":"Close menu"})]}),g]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[m&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(h,{className:"size-4"}),className:"-ml-1 lg:hidden",onClick:m,"aria-label":"Back to mail"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(S,{className:"size-4"}),className:"lg:hidden",onClick:()=>c(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:x}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":p}),s&&!b&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&p&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),b&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function M({name:l,email:t,meta:x,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:f(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[x,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const B={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function Q({label:l,email:t,connector:x,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=B[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(z,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",x," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{Q as A,L as S,M as a};
@@ -1 +1 @@
1
- import{b as a}from"./index-fsuIswbe.js";const e={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};e.node;const o=a(e);export{o as S};
1
+ import{b as a}from"./index-C2US5ZnK.js";const e={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};e.node;const o=a(e);export{o as S};
@@ -0,0 +1 @@
1
+ import{j as e,p as g,r as f,a as j,b_ as E,c as M,b$ as y,c0 as P,c1 as D,c2 as C,c3 as R,c4 as A,a5 as F,c5 as T,c6 as w,s as W,c7 as _,u as z,af as B}from"./index-C2US5ZnK.js";import{F as $,u as q}from"./useClassificationSettings-Dh7qfWbF.js";import{u as U}from"./useJunkMailboxIds-D3M8TbeX.js";import{u as V}from"./useLabels-DnF0cYWq.js";import{N as u}from"./nav-link-Df_MDzvJ.js";import"./reply-CijQsg4o.js";import{L as Y}from"./label-chip-D_oZixyY.js";import{f as v}from"./ErrorState-g7-Y1uhe.js";import{S as G}from"./segmented-control-CMV1-H2S.js";import{a as H}from"./sections-FtpeSpRq.js";import{S as J}from"./settings-screen-zihVEeS9.js";import"./list-pages-BCUbyyea.js";import"./useMediaQuery-BaUDTtu8.js";import"./avatar-CVmRGlvx.js";import"./badge-CDOouHHB.js";import"./chevron-left-Co8HGTow.js";import"./menu-CEGeda9s.js";import"./circle-question-mark-DuTpeMvV.js";const K={warning:{moved:"bg-warning",warned:"bg-warning/35"},danger:{moved:"bg-danger",warned:"bg-danger/35"}},Q=s=>`${s.date}: ${s.moved} moved, ${s.warned} warned`;function I({title:s,tone:t,days:a}){const n=Math.max(1,...a.map(l=>l.moved+l.warned)),c=K[t],m=a[0],r=a[a.length-1];return e.jsxs("figure",{className:"min-w-0",children:[e.jsx("figcaption",{className:"text-xs font-semibold text-fg",children:s}),e.jsx("ul",{className:"mt-2 flex h-24 list-none items-end gap-px border-b border-line",children:a.map(l=>e.jsx("li",{className:"h-full min-w-0 flex-1",children:e.jsxs("span",{role:"img","aria-label":Q(l),className:"flex h-full flex-col justify-end",children:[e.jsx("span",{className:g("w-full rounded-t-sm",c.warned),style:{height:`${l.warned/n*100}%`}}),e.jsx("span",{className:g("w-full",c.moved),style:{height:`${l.moved/n*100}%`}})]})},l.date))}),m&&r&&e.jsxs("div",{"aria-hidden":"true",className:"mt-1 flex justify-between text-2xs text-fg-subtle tabular-nums",children:[e.jsx("span",{children:m.date}),e.jsx("span",{children:r.date})]})]})}const k=30,b=s=>String(s).padStart(2,"0"),O=s=>`${s.getFullYear()}-${b(s.getMonth()+1)}-${b(s.getDate())}`,X=s=>{const t=-s.getTimezoneOffset(),a=t>=0?"+":"-",n=Math.abs(t);return`${a}${b(Math.floor(n/60))}:${b(n%60)}`},Z=(s,t=k)=>{const a=new Date(s.getFullYear(),s.getMonth(),s.getDate()-(t-1));return`${O(a)}T00:00:00${X(a)}`},ee=(s,t=k)=>Array.from({length:t},(a,n)=>O(new Date(s.getFullYear(),s.getMonth(),s.getDate()-(t-1-n)))),se=(s,t)=>{const a=r=>t.map(l=>{const x=i=>s.spamByDay.filter(o=>o.date===l&&o.kind===r&&o.action===i).reduce((o,p)=>o+p.count,0);return{date:l,moved:x("Junk"),warned:x("Warn")}}),n=a("Spam"),c=a("Phishing"),m=r=>[...n,...c].reduce((l,x)=>l+r(x),0);return{checkedAny:s.spamScoreBands.some(r=>r.count>0),moved:m(r=>r.moved),warned:m(r=>r.warned),spam:n,phishing:c}},te="text-xs font-semibold uppercase tracking-wider text-fg-subtle",N=W(400,403,404),L=10;function d({title:s,children:t,aside:a}){const n=f.useId();return e.jsxs("section",{"aria-labelledby":n,className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[e.jsx("h2",{id:n,className:te,children:s}),a]}),t]})}function h({className:s}){return e.jsx("div",{"aria-hidden":"true",className:g("animate-pulse rounded-md bg-surface-sunken",s)})}function S({title:s,error:t,onRetry:a,skeleton:n}){if(F(t))return n;const c=v(t);return e.jsx($,{title:s,message:c,reportHref:T(s,c),onRetry:a})}function ae(){const[s]=f.useState(()=>new Date),t=j({...E({query:{since:Z(s)}}),meta:N}),a=e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"h-4 w-64"}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsx(h,{className:"h-32"}),e.jsx(h,{className:"h-32"})]})]});if(t.isPending)return e.jsx(d,{title:"Last 30 days",children:a});if(t.isError)return e.jsx(d,{title:"Last 30 days",children:e.jsx(S,{title:"Couldn't count the last 30 days",error:t.error,onRetry:()=>{t.refetch()},skeleton:a})});const n=se(t.data,ee(s));return n.checkedAny?e.jsxs(d,{title:"Last 30 days",children:[e.jsx("p",{className:"text-sm text-fg tabular-nums",children:`Reached Spam ${n.moved} · Warned ${n.warned}`}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsx(I,{title:"Spam",tone:"warning",days:n.spam}),e.jsx(I,{title:"Phishing",tone:"danger",days:n.phishing})]}),e.jsxs("ul",{className:"flex list-none flex-wrap gap-x-4 gap-y-1 text-2xs text-fg-muted",children:[e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"size-2 rounded-sm bg-fg-muted","aria-hidden":"true"}),"Reached the Move to Spam threshold"]}),e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"size-2 rounded-sm bg-fg-muted/35","aria-hidden":"true"}),"Warned"]})]})]}):e.jsx(d,{title:"Last 30 days",children:e.jsxs("div",{className:"rounded-md border border-line px-4 py-6 text-center",children:[e.jsx("p",{className:"font-medium text-fg",children:"Remit has not checked any mail yet"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"Counts appear here once new mail arrives."})]})})}const ne=async s=>{const{data:t}=await _({query:{labelId:s,order:"desc",limit:L},throwOnError:!0});return t.items??[]};function re(){const s=U(),t=j({...M(),staleTime:1/0}),a=V(t.data?.accounts[0]?.accountId),n=a.labels.find(i=>i.name==="Spam"),c=a.labels.find(i=>i.name==="Phishing"),m=[n,c].flatMap(i=>i?[i.labelId]:[]),r=j({queryKey:["spam-settings","latest-flagged",...m],queryFn:async()=>(await Promise.all(m.map(ne))).flat().filter(i=>!i.spamCleared&&y(i.labels)!==void 0).sort((i,o)=>o.sentDate-i.sentDate).slice(0,L),enabled:a.isSuccess,meta:N}),l=e.jsx("div",{className:"space-y-2",children:["a","b","c","d"].map(i=>e.jsx(h,{className:"h-10"},i))}),x=t.isError?{error:t.error,retry:()=>{t.refetch()}}:a.isError?{error:a.error,retry:()=>{a.refetch()}}:r.isError?{error:r.error,retry:()=>{r.refetch()}}:void 0;return x?e.jsx(d,{title:"Latest flagged",children:e.jsx(S,{title:"Couldn't load the latest flagged mail",error:x.error,onRetry:x.retry,skeleton:l})}):r.isSuccess?r.data.length===0?e.jsx(d,{title:"Latest flagged",children:e.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing flagged yet."})}):e.jsx(d,{title:"Latest flagged",aside:e.jsxs("span",{className:"flex gap-4 text-sm",children:[n&&e.jsx(u,{to:"/mail/label/$labelId",params:{labelId:n.labelId},variant:"inline",children:"Review all in Spam"}),c&&e.jsx(u,{to:"/mail/label/$labelId",params:{labelId:c.labelId},variant:"inline",children:"Open Phishing"})]}),children:e.jsx("div",{className:"overflow-x-auto rounded-md border border-line",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-line text-2xs uppercase tracking-wide text-fg-subtle",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 font-medium",children:"Sender"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Subject and top reason"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Date"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Label"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-line",children:r.data.map(i=>{const o=y(i.labels);if(!o)return null;const p=P(i.spamVerdict);return e.jsxs("tr",{className:"hover:bg-surface-sunken",children:[e.jsx("td",{className:"px-3 py-2 align-top text-fg",children:i.fromName??i.fromEmail??"Unknown"}),e.jsxs("td",{className:"px-3 py-2 align-top",children:[e.jsx(u,{to:"/mail/label/$labelId/$threadId/$messageId",params:{labelId:o.labelId,threadId:i.threadId,messageId:i.messageId},variant:"inline",className:"text-fg",children:i.subject??"(No subject)"}),p&&e.jsx("p",{className:"text-xs text-fg-muted",children:D(p.reasons)})]}),e.jsx("td",{className:"whitespace-nowrap px-3 py-2 align-top text-fg-muted tabular-nums",children:C(i.sentDate)}),e.jsx("td",{className:"px-3 py-2 align-top",children:e.jsx(Y,{label:o})}),e.jsx("td",{className:"px-3 py-2 align-top text-fg-muted",children:s.has(i.mailboxId)?"Moved":"Warned"})]},i.messageId)})})]})})}):e.jsx(d,{title:"Latest flagged",children:l})}function ie({spam:s}){const{thresholds:t}=s;return e.jsxs(d,{title:"Thresholds",children:[t.state==="Set"?e.jsxs("dl",{className:"flex flex-wrap gap-x-8 gap-y-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-fg-muted",children:"Warn from"}),e.jsx("dd",{className:"font-medium text-fg tabular-nums",children:w(t.cleanBelow)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-fg-muted",children:"Move to Spam from"}),e.jsx("dd",{className:"font-medium text-fg tabular-nums",children:w(t.spamAt)})]})]}):e.jsx("p",{className:"text-sm text-fg",children:"The spam service applies its own thresholds."}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Scores run from 0 to 1. The deployment sets these values, and they apply to mail arriving from now on. Check again in any list updates older mail."})]})}const le=[{value:"WarnOnly",label:"Warn only"},{value:"MoveToSpam",label:"Move to Spam"}];function ce({spam:s}){const t=q(),[a,n]=f.useState(""),c=f.useId(),m=[{field:"spamPlacementSpam",label:"Spam",value:s.spamPlacement},{field:"spamPlacementPhishing",label:"Phishing",value:s.phishingPlacement}];return e.jsxs(d,{title:"Per label",children:[e.jsx("div",{className:"space-y-2",children:m.map(r=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"w-20 text-sm text-fg",children:r.label}),e.jsx(G,{name:`${c}-${r.field}`,"aria-label":`${r.label} label`,size:"sm",options:le,value:r.value,onChange:l=>{n(""),t.mutate({body:{[r.field]:l}},{onSuccess:()=>n("Saved")})}})]},r.field))}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Warn only keeps the message where it arrived, under the warning banner."}),t.isError&&e.jsx($,{title:"The label setting was not saved",message:v(t.error),reportHref:T("The label setting was not saved",v(t.error)),onRetry:()=>t.variables&&t.mutate(t.variables)}),e.jsx("p",{"aria-live":"polite",className:"text-xs text-positive",children:a})]})}function de(){const s=j({...R(),meta:N}),t=e.jsxs(e.Fragment,{children:[e.jsx(d,{title:"Thresholds",children:e.jsx(h,{className:"h-11 w-64"})}),e.jsxs(d,{title:"Per label",children:[e.jsx(h,{className:"h-9 w-48"}),e.jsx(h,{className:"h-9 w-48"})]})]});return s.isPending?t:s.isError?e.jsx(d,{title:"Thresholds",children:e.jsx(S,{title:"Couldn't load the spam settings",error:s.error,onRetry:()=>{s.refetch()},skeleton:t})}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{spam:s.data.spam}),e.jsx(ce,{spam:s.data.spam})]})}function oe(){const s=[{title:"Never in Spam",hint:"Their mail skips the spam check.",group:"neverSpam"},{title:"Reported",hint:"Their mail goes straight to Spam.",group:"blocked"}];return e.jsx(d,{title:"Senders",children:e.jsx("ul",{className:"list-none divide-y divide-line rounded-md border border-line",children:s.map(t=>e.jsxs("li",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:t.title}),e.jsx("p",{className:"text-xs text-fg-muted",children:t.hint})]}),e.jsx(u,{to:"/settings/senders",search:{group:t.group},variant:"inline",className:g(A({variant:"secondary"}),"min-h-11 hover:no-underline"),"aria-label":`Manage ${t.title}`,children:"Manage"})]},t.title))})})}function me(){return e.jsxs("div",{className:"max-w-3xl space-y-8",children:[e.jsx(ae,{}),e.jsx(re,{}),e.jsx(de,{}),e.jsx(oe,{})]})}function Le(){const s=z(),t=B(),a=H();return e.jsx(J,{items:t,activeId:"spam",title:"Spam & phishing",description:"What Remit flagged, and when it acts.",onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:e.jsx(me,{})})}export{Le as component};
@@ -1 +1 @@
1
- import{r as s,j as x,p as b}from"./index-fsuIswbe.js";const v={type:"none"};function I(e){if(!e.open||e.count<=0)return v;if(e.key==="ArrowDown"){const t=e.activeIndex+1;return{type:"move",index:t>=e.count?0:t}}if(e.key==="ArrowUp"){const t=e.activeIndex-1;return{type:"move",index:t<0?e.count-1:t}}return e.key==="Escape"?{type:"dismiss"}:(e.key==="Enter"||(e.acceptKeys??[]).includes(e.key))&&e.activeIndex>=0&&e.activeIndex<e.count?{type:"accept",index:e.activeIndex}:v}function j({count:e,onAccept:a,acceptKeys:t}){const[m,i]=s.useState(!1),[c,u]=s.useState(-1),p=s.useId().replace(/[^a-zA-Z0-9_-]/g,""),n=`suggest-${p}`,r=s.useCallback(f=>`suggest-${p}-option-${f}`,[p]);s.useEffect(()=>{u(-1),i(!1)},[e]);const o=e>0&&!m,y=s.useRef({open:o,count:e,activeIndex:c,acceptKeys:t,onAccept:a});y.current={open:o,count:e,activeIndex:c,acceptKeys:t,onAccept:a};const h=s.useCallback(f=>{const d=y.current,l=I({key:f.key,open:d.open,count:d.count,activeIndex:d.activeIndex,acceptKeys:d.acceptKeys});return l.type==="none"?!1:(f.preventDefault(),l.type==="move"&&u(l.index),l.type==="dismiss"&&i(!0),l.type==="accept"&&d.onAccept(l.index),!0)},[]),k=s.useMemo(()=>({role:"combobox","aria-expanded":o,"aria-controls":n,"aria-autocomplete":"list",...c>=0?{"aria-activedescendant":r(c)}:{},...o?{"data-escape-owner":""}:{}}),[o,n,c,r]);return{open:o,activeIndex:c,setActiveIndex:u,dismiss:s.useCallback(()=>i(!0),[]),reopen:s.useCallback(()=>i(!1),[]),handleKeyDown:h,listId:n,optionId:r,comboboxProps:k}}function E({id:e,suggestions:a,activeIndex:t,optionId:m,onPick:i,onHighlight:c,label:u,className:p}){return a.length===0?null:x.jsx("div",{id:e,role:"listbox","aria-label":u,className:b("max-h-44 overflow-y-auto rounded-md border border-line bg-surface py-1 shadow-sm",p),children:a.map((n,r)=>x.jsxs("div",{id:m(r),role:"option",tabIndex:-1,"aria-selected":r===t,className:b("flex cursor-pointer items-baseline gap-2 px-3 py-2 text-sm text-fg",r===t&&"bg-accent-2-soft"),onMouseDown:o=>{o.preventDefault(),i(n)},onMouseEnter:()=>c(r),children:[x.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.label??n.value}),n.hint&&x.jsx("span",{className:"shrink-0 truncate text-2xs text-fg-subtle",children:n.hint}),n.source&&x.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:n.source})]},n.value))})}export{E as S,j as u};
1
+ import{r as s,j as x,p as b}from"./index-C2US5ZnK.js";const v={type:"none"};function I(e){if(!e.open||e.count<=0)return v;if(e.key==="ArrowDown"){const t=e.activeIndex+1;return{type:"move",index:t>=e.count?0:t}}if(e.key==="ArrowUp"){const t=e.activeIndex-1;return{type:"move",index:t<0?e.count-1:t}}return e.key==="Escape"?{type:"dismiss"}:(e.key==="Enter"||(e.acceptKeys??[]).includes(e.key))&&e.activeIndex>=0&&e.activeIndex<e.count?{type:"accept",index:e.activeIndex}:v}function j({count:e,onAccept:a,acceptKeys:t}){const[m,i]=s.useState(!1),[c,u]=s.useState(-1),p=s.useId().replace(/[^a-zA-Z0-9_-]/g,""),n=`suggest-${p}`,r=s.useCallback(f=>`suggest-${p}-option-${f}`,[p]);s.useEffect(()=>{u(-1),i(!1)},[e]);const o=e>0&&!m,y=s.useRef({open:o,count:e,activeIndex:c,acceptKeys:t,onAccept:a});y.current={open:o,count:e,activeIndex:c,acceptKeys:t,onAccept:a};const h=s.useCallback(f=>{const d=y.current,l=I({key:f.key,open:d.open,count:d.count,activeIndex:d.activeIndex,acceptKeys:d.acceptKeys});return l.type==="none"?!1:(f.preventDefault(),l.type==="move"&&u(l.index),l.type==="dismiss"&&i(!0),l.type==="accept"&&d.onAccept(l.index),!0)},[]),k=s.useMemo(()=>({role:"combobox","aria-expanded":o,"aria-controls":n,"aria-autocomplete":"list",...c>=0?{"aria-activedescendant":r(c)}:{},...o?{"data-escape-owner":""}:{}}),[o,n,c,r]);return{open:o,activeIndex:c,setActiveIndex:u,dismiss:s.useCallback(()=>i(!0),[]),reopen:s.useCallback(()=>i(!1),[]),handleKeyDown:h,listId:n,optionId:r,comboboxProps:k}}function E({id:e,suggestions:a,activeIndex:t,optionId:m,onPick:i,onHighlight:c,label:u,className:p}){return a.length===0?null:x.jsx("div",{id:e,role:"listbox","aria-label":u,className:b("max-h-44 overflow-y-auto rounded-md border border-line bg-surface py-1 shadow-sm",p),children:a.map((n,r)=>x.jsxs("div",{id:m(r),role:"option",tabIndex:-1,"aria-selected":r===t,className:b("flex cursor-pointer items-baseline gap-2 px-3 py-2 text-sm text-fg",r===t&&"bg-accent-2-soft"),onMouseDown:o=>{o.preventDefault(),i(n)},onMouseEnter:()=>c(r),children:[x.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.label??n.value}),n.hint&&x.jsx("span",{className:"shrink-0 truncate text-2xs text-fg-subtle",children:n.hint}),n.source&&x.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:n.source})]},n.value))})}export{E as S,j as u};
@@ -1 +1 @@
1
- import{j as t,ad as e}from"./index-fsuIswbe.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
1
+ import{j as t,ad as e}from"./index-C2US5ZnK.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
@@ -0,0 +1 @@
1
+ import{j as i,X as Z,p as O,f5 as R,f7 as $,f6 as v,r as u,cl as E}from"./index-C2US5ZnK.js";import{b as S,n as F,f as h,o as L,t as W,U as j,y as z,l as k,k as B,p as H}from"./useCalendarSuggestions-CJGnqdiK.js";import{e as w,p as U,a as _}from"./draft-B-aWKHzd.js";import{f as P}from"./calendar-format-BwCpz-JZ.js";import{t as M}from"./agenda-time-BwFncCBt.js";import{a as V}from"./CalendarSession-D2sxMFYX.js";import{C as G}from"./calendar-failure-note-_XD99AnH.js";import{E as X,C as Y}from"./EmptyState-DEGumQTC.js";import{C as q}from"./calendar-event-sidebar-BUwhXGT2.js";import"./nav-link-Df_MDzvJ.js";import{k as J,b as K}from"./calendar-BHWGBart.js";import"./reply-CijQsg4o.js";import"./ErrorState-g7-Y1uhe.js";import"./useQueries-B-1XtDe8.js";import"./list-pages-BCUbyyea.js";import"./calendar-guests-BVwUAczN.js";import"./calendar-event-popup-O-JrsyRu.js";import"./pencil-C1yBZXUb.js";import"./circle-question-mark-DuTpeMvV.js";import"./select-DhVwx5IO.js";import"./chevron-down-DeNyJr8d.js";import"./useMediaQuery-BaUDTtu8.js";function I({title:e,subtitle:a,onClose:r,children:s,className:o}){return i.jsxs("section",{className:O("flex h-full w-full flex-col bg-surface",o),children:[i.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[i.jsx("h2",{className:"shrink-0 text-xs font-medium text-fg",children:e}),a!==void 0&&a!==""&&i.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:a}),i.jsx("button",{type:"button","aria-label":"Close editor",onClick:r,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:i.jsx(Z,{className:"size-4"})})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:i.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}function Q(e,a,r){const s={title:e.summary,location:e.location};if(e.allDay){const t=e.dtStart.slice(0,10),c=e.dtEnd.slice(0,10);return{...w(t,a),...s,allDay:!0,startTime:"",endDate:c>t?R(c,-1):t,endTime:""}}const o=t=>e.zoneCertainty==="Ambiguous"?t:$(t,r),l=o(e.dtStart),d=o(e.dtEnd);return{...w(l.slice(0,10),a),...s,startTime:l.slice(11,16),endDate:d.slice(0,10),endTime:d.slice(11,16)}}function ee(e,a,r,s){const o=U(a,r,s);if(!o.ok)return o;const d=e.zoneCertainty==="Ambiguous"||o.patch.start!==void 0?{...o.patch,..._(r,s.clock),allDay:r.allDay,timeZone:s.anchor}:o.patch;return{ok:!0,input:{calendarId:r.calendarId,event:d}}}const te=[],ae={from:"",to:""};function ne(e,a=""){const{timeZoneByCalendarId:r}=S(),s=e.date!==""&&!e.allDay&&e.endDate!==""&&e.startTime!==""&&e.endTime!==""&&`${e.endDate}T${e.endTime}`>`${e.date}T${e.startTime}`,{instances:o,isLoading:l,error:d}=F({...s?{from:v("week",e.date).from,to:v("week",e.endDate).to}:ae,calendarIds:te,enabled:s}),t=h();return u.useMemo(()=>{if(!s||l||d)return;const c=E(e.date,e.startTime,t),p=E(e.endDate,e.endTime,t),f=o.filter(m=>L(m)&&m.calendarObjectId!==a).map(m=>W(m,r[m.calendarId]??j,t));return M({start:c,end:p},f).map(m=>({id:m.id,label:`${m.title}, ${P(m)}`}))},[s,l,d,e.date,e.endDate,e.startTime,e.endTime,t,o,a,r])}const y="Add from mail",se="The invitation named a time zone nothing could resolve. The time below is as the mail wrote it — check it before adding.";function oe({suggestionId:e,onClose:a}){const{suggestion:r,isLoading:s,error:o}=z(e),l=r??void 0,[d,t]=u.useState(void 0);l!==void 0&&d===void 0&&t(l);const c=d??l;if(c!==void 0)return i.jsx(ie,{suggestion:c,onClose:a},c.suggestionId);if(o!==null){const p="Couldn't read what your mail is waiting on.";return i.jsx(I,{title:y,onClose:a,children:i.jsx(G,{text:`${p} Close this and try again.`,reportHref:k(p),className:"m-row-inset"})})}return i.jsx(I,{title:y,onClose:a,children:i.jsx(X,{message:s?"Reading the suggestion…":"This suggestion is no longer waiting on you. It was answered, or a later message replaced it."})})}function ie({suggestion:e,onClose:a}){const{calendars:r,defaultCalendarId:s,timeZoneByCalendarId:o}=S(),l=r.filter(n=>!n.readOnly),d=B(),[t]=u.useState(()=>Q(e,"",h())),[c,p]=u.useState(t),f=V()?.dispatch;u.useEffect(()=>{f?.({type:"sidebar-range",range:{date:t.date,endDate:t.endDate,startTime:t.allDay?"":t.startTime,endTime:t.allDay?"":t.endTime,allDay:t.allDay}})},[t,f]);const[m,D]=u.useState(""),[N,A]=u.useState(),x=ne(c),g=l.some(n=>n.id===s)?s:l[0]?.id??"";u.useEffect(()=>{g!==""&&p(n=>n.calendarId===""?{...n,calendarId:g}:n)},[g]);const C=()=>{const n=ee(e,t,c,{clock:h(),anchor:H(o[c.calendarId]??j)});if(!n.ok){D(n.problem);return}D(""),d.acceptEdited(e.suggestionId,n.input).then(b=>{if(b.kind==="answered"){a();return}const T=`Couldn't add this to your calendar: ${b.message}`;A({text:T,reportHref:k(T),onRetry:C})})};return i.jsx(q,{heading:y,draft:c,onChange:n=>{p(n),f?.({type:"sidebar-range",range:{date:n.date,endDate:n.endDate,startTime:n.allDay?"":n.startTime,endTime:n.allDay?"":n.endTime,allDay:n.allDay}})},calendars:l,calendarEditable:!0,repeatEditable:!1,timeZone:h(),timeZones:[h()],onTimeZone:()=>{},busy:!0,onBusy:()=>{},onSave:C,onCancel:a,saving:d.isAnswering,saveLabel:"Add",failure:N,problem:m!==""?m:e.zoneCertainty==="Ambiguous"?se:"",children:x&&i.jsx(Y,{clashes:x})})}function ke(){const e=J(),{closeToView:a}=K();return e===void 0?null:i.jsx(oe,{suggestionId:e,onClose:a})}export{ke as component};
@@ -1 +1 @@
1
- import{j as n,p as i}from"./index-fsuIswbe.js";function d({checked:e,onToggle:a,disabled:t,className:l,ref:u,...s}){const o=s["aria-disabled"],r=t===!0||o===!0||o==="true";return n.jsx("button",{type:"button",role:"switch",ref:u,"aria-checked":e,disabled:t,onClick:()=>{r||a()},className:i("group inline-flex h-11 w-14 shrink-0 items-center justify-center rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"cursor-not-allowed":"cursor-pointer",l),...s,children:n.jsx("span",{"aria-hidden":!0,className:i("relative inline-flex h-6 w-11 items-center rounded-full border transition-colors",e?"border-positive bg-positive":"border-line-strong bg-surface-sunken",r&&"opacity-60"),children:n.jsx("span",{className:i("size-4 rounded-full bg-canvas transition-transform",e?"translate-x-6":"translate-x-1")})})})}export{d as S};
1
+ import{j as n,p as i}from"./index-C2US5ZnK.js";function d({checked:e,onToggle:a,disabled:t,className:l,ref:u,...s}){const o=s["aria-disabled"],r=t===!0||o===!0||o==="true";return n.jsx("button",{type:"button",role:"switch",ref:u,"aria-checked":e,disabled:t,onClick:()=>{r||a()},className:i("group inline-flex h-11 w-14 shrink-0 items-center justify-center rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"cursor-not-allowed":"cursor-pointer",l),...s,children:n.jsx("span",{"aria-hidden":!0,className:i("relative inline-flex h-6 w-11 items-center rounded-full border transition-colors",e?"border-positive bg-positive":"border-line-strong bg-surface-sunken",r&&"opacity-60"),children:n.jsx("span",{className:i("size-4 rounded-full bg-canvas transition-transform",e?"translate-x-6":"translate-x-1")})})})}export{d as S};
@@ -0,0 +1 @@
1
+ import{b as w,r as d,j as e,T as E,X as $,p as q,C as B,f7 as L,cl as F,fy as P}from"./index-C2US5ZnK.js";import{b as V,f as Z,c as _}from"./useCalendarSuggestions-CJGnqdiK.js";import{b as H,C as j,u as K}from"./useCalendarTasks-BBv_7Q0J.js";import"./nav-link-Df_MDzvJ.js";import{b as S}from"./calendar-BHWGBart.js";import"./reply-CijQsg4o.js";import{C as M}from"./CalendarLoadFailed-Bq0_jt4H.js";import{C as A}from"./calendar-event-popup-O-JrsyRu.js";import"./ErrorState-g7-Y1uhe.js";import"./useQueries-B-1XtDe8.js";import"./list-pages-BCUbyyea.js";import"./useMediaQuery-BaUDTtu8.js";import"./pencil-C1yBZXUb.js";const I={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};I.node;const O=w(I);const R={name:"square-check-big",size:24,node:[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-square"]};R.node;const W=w(R),D="flex size-9 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40",v="h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30";function U({headingId:s,headingRef:i,fields:l,dueText:r,listName:u,completed:c,onToggle:f,onSave:p,onDelete:g,onClose:x,busy:m=!1,failure:h}){const[t,o]=d.useState(null);return e.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[e.jsxs("div",{className:"flex justify-end gap-1",children:[t===null&&e.jsx("button",{type:"button",onClick:()=>o(l),className:"rounded-md px-3 text-sm font-medium text-accent hover:bg-accent-soft focus-visible:ring-2 focus-visible:ring-ring",children:"Edit"}),e.jsx("button",{type:"button","aria-label":"Delete",onClick:g,disabled:m,className:D,children:e.jsx(E,{className:"size-4"})}),e.jsx("button",{type:"button","aria-label":"Close",onClick:x,className:D,children:e.jsx($,{className:"size-4"})})]}),t===null?e.jsxs("div",{className:"flex flex-col gap-2 px-2",children:[e.jsx("h2",{id:s,ref:i,tabIndex:-1,className:q("text-xl font-normal break-words text-fg outline-none",c&&"text-fg-muted line-through"),children:l.title===""?"(No title)":l.title}),e.jsx("p",{className:"text-sm text-fg-muted",children:r}),e.jsxs("p",{className:"flex items-center gap-2 text-sm",children:[e.jsx(B,{className:"size-4 text-fg-subtle","aria-label":"List"}),u]}),l.description!==""&&e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:l.description})]}):e.jsxs("form",{className:"flex flex-col gap-2 px-2",onSubmit:n=>{n.preventDefault(),p(t),o(null)},children:[e.jsx("h2",{id:s,className:"sr-only",children:"Edit task"}),e.jsx("input",{"aria-label":"Title",value:t.title,onChange:n=>o({...t,title:n.target.value}),className:v}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"date","aria-label":"Due date",value:t.dueDate,onChange:n=>n.target.value!==""&&o({...t,dueDate:n.target.value}),className:v}),e.jsx("input",{type:"time","aria-label":"Due time",value:t.dueTime,onChange:n=>o({...t,dueTime:n.target.value}),className:v})]}),e.jsx("textarea",{"aria-label":"Description",rows:3,value:t.description,onChange:n=>o({...t,description:n.target.value}),className:"w-full rounded-md border border-line bg-surface-sunken px-2 py-1 text-sm"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>o(null),className:"h-9 rounded-md border border-line px-3 text-sm font-medium",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:m,className:"h-9 rounded-md bg-accent px-4 text-sm font-medium text-accent-fg disabled:opacity-50",children:"Save"})]})]}),h&&e.jsx(A,{failure:h}),t===null&&e.jsx("div",{className:"flex justify-end px-2",children:e.jsxs("button",{type:"button",onClick:f,disabled:m,className:"inline-flex h-9 items-center gap-2 rounded-md border border-line px-3 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:[c?e.jsx(O,{className:"size-4","aria-hidden":"true"}):e.jsx(W,{className:"size-4","aria-hidden":"true"}),c?"Mark not done":"Mark done"]})})]})}const X=(s,i)=>{const l=new Date(`${s.slice(0,10)}T00:00:00Z`),r=new Intl.DateTimeFormat(void 0,{weekday:"long",day:"numeric",month:"long",timeZone:"UTC"}).format(l);return i?`Due ${r}`:`Due ${r} · ${s.slice(11,16)}`};function G({calendarTaskId:s}){const i=H(s),{closeToView:l}=S(),r=d.useId(),u=d.useRef(null),c=i.kind==="gone";return d.useEffect(()=>{c&&u.current?.focus()},[c]),i.kind==="loading"?null:i.kind==="found"?e.jsx(J,{task:i.task}):i.kind==="failed"?e.jsx(j,{anchor:null,anchorKey:"failed",labelledBy:r,children:e.jsx("div",{id:r,className:"p-4",children:e.jsx(M,{title:"Couldn't open this task",error:i.error,onRetry:i.retry,compact:!0})})}):e.jsx(j,{anchor:null,anchorKey:"gone",labelledBy:r,children:e.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[e.jsx("h2",{id:r,className:"text-base font-medium text-fg",children:"This task was deleted or moved"}),e.jsx("button",{ref:u,type:"button",onClick:l,className:"self-end rounded-md border border-line px-3 py-1.5 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Close"})]})})}function J({task:s}){const{taskLists:i}=V(),{closeToView:l}=S(),{updateTask:r,deleteTask:u,isWriting:c}=K(),f=d.useId(),p=d.useRef(null),[g,x]=d.useState(),[m,h]=d.useState(null),{calendarTaskId:t}=s;d.useLayoutEffect(()=>{h(document.querySelector(`[data-task-id="${CSS.escape(t)}"]`))},[t]),d.useEffect(()=>{p.current?.focus()},[]);const o=Z(),n=s.allDay?s.due:L(s.due,o),z={title:s.summary,dueDate:n.slice(0,10),dueTime:s.allDay?"":n.slice(11,16),description:s.description},b=a=>N=>{if(N.kind==="written"){x(void 0);return}const T=`Couldn't save the task: ${N.message}`;x({text:T,reportHref:_(T),onRetry:a})},y=()=>{r(s,{completed:!s.completed}).then(b(y))},k=a=>{r(s,{summary:a.title,description:a.description,allDay:a.dueTime==="",due:a.dueTime===""?a.dueDate:F(a.dueDate,a.dueTime,o)}).then(b(()=>k(a)))},C=()=>{u(s).then(a=>{if(a.kind==="written"){l();return}b(C)(a)})};return e.jsx(j,{anchor:m,anchorKey:`${t}:${m?"chip":"none"}`,labelledBy:f,children:e.jsx(U,{headingId:f,headingRef:p,fields:z,dueText:X(n,s.allDay),listName:i.find(a=>a.id===s.calendarId)?.name??"Tasks",completed:s.completed,onToggle:y,onSave:k,onDelete:C,onClose:l,busy:c,failure:g})})}function ue(){const{calendarTaskId:s}=P.useParams();return e.jsx(G,{calendarTaskId:s})}export{ue as component};
@@ -1 +1 @@
1
- import{b as a}from"./index-fsuIswbe.js";const o={name:"undo-2",size:24,node:[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]};o.node;const n=a(o);export{n as U};
1
+ import{b as a}from"./index-C2US5ZnK.js";const o={name:"undo-2",size:24,node:[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]};o.node;const n=a(o);export{n as U};
@@ -1,2 +1,2 @@
1
- import{j as c,p as x,B as E,r as f,f4 as S}from"./index-fsuIswbe.js";import{p as A,b as L,f as O,o as W,t as Z,U as B,n as P,q as U,i as F,r as M}from"./useCalendarSuggestions-DXbA0boT.js";import{a as q,t as z}from"./useCalendarTasks-b_UNFPQH.js";const K=[{scope:"this",label:"This event",note:"Leaves the rest of the series alone"},{scope:"following",label:"This and everything after",note:"Splits the series here"},{scope:"all",label:"The whole series",note:"Rewrites the rule itself"}];function Q({title:e,ruleText:s,instanceText:n,onChoose:t,onCancel:r,scopes:a,touch:o,className:d}){return c.jsxs("div",{className:x("flex flex-col gap-3",d),children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-md font-semibold text-fg",children:[e," repeats"]}),c.jsx("p",{className:"text-xs text-fg-muted",children:s}),c.jsxs("p",{className:"text-xs text-fg-subtle",children:["You clicked ",n,"."]})]}),c.jsx("p",{className:"text-sm text-fg",children:"What should the change apply to?"}),c.jsx("div",{className:"flex flex-col gap-1.5",children:K.filter(l=>a===void 0||a.includes(l.scope)).map(l=>c.jsxs("button",{type:"button",onClick:()=>t(l.scope),className:x("flex flex-col rounded-md border border-line bg-surface px-3 py-2 text-left outline-none transition-colors hover:border-line-strong hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",o&&"min-h-11 justify-center"),children:[c.jsx("span",{className:"text-sm font-medium text-fg",children:l.label}),c.jsx("span",{className:"text-2xs text-fg-subtle",children:l.note})]},l.scope))}),c.jsx(E,{variant:"ghost",size:o?"md":"sm",onClick:r,className:x("self-start",o&&"min-h-11"),children:"Cancel"})]})}const C=e=>e.replace(/\r?\n[ \t]/g,""),I=e=>e.replace(/\\n/gi,`
1
+ import{j as c,p as x,B as E,r as f,f6 as S}from"./index-C2US5ZnK.js";import{p as A,b as L,f as O,o as W,t as Z,U as B,n as P,q as U,i as F,r as M}from"./useCalendarSuggestions-CJGnqdiK.js";import{a as q,t as z}from"./useCalendarTasks-BBv_7Q0J.js";const K=[{scope:"this",label:"This event",note:"Leaves the rest of the series alone"},{scope:"following",label:"This and everything after",note:"Splits the series here"},{scope:"all",label:"The whole series",note:"Rewrites the rule itself"}];function Q({title:e,ruleText:s,instanceText:n,onChoose:t,onCancel:r,scopes:a,touch:o,className:d}){return c.jsxs("div",{className:x("flex flex-col gap-3",d),children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-md font-semibold text-fg",children:[e," repeats"]}),c.jsx("p",{className:"text-xs text-fg-muted",children:s}),c.jsxs("p",{className:"text-xs text-fg-subtle",children:["You clicked ",n,"."]})]}),c.jsx("p",{className:"text-sm text-fg",children:"What should the change apply to?"}),c.jsx("div",{className:"flex flex-col gap-1.5",children:K.filter(l=>a===void 0||a.includes(l.scope)).map(l=>c.jsxs("button",{type:"button",onClick:()=>t(l.scope),className:x("flex flex-col rounded-md border border-line bg-surface px-3 py-2 text-left outline-none transition-colors hover:border-line-strong hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",o&&"min-h-11 justify-center"),children:[c.jsx("span",{className:"text-sm font-medium text-fg",children:l.label}),c.jsx("span",{className:"text-2xs text-fg-subtle",children:l.note})]},l.scope))}),c.jsx(E,{variant:"ghost",size:o?"md":"sm",onClick:r,className:x("self-start",o&&"min-h-11"),children:"Cancel"})]})}const C=e=>e.replace(/\r?\n[ \t]/g,""),I=e=>e.replace(/\\n/gi,`
2
2
  `).replace(/\\,/g,",").replace(/\\;/g,";").replace(/\\\\/g,"\\");function g(e,s){let n=!1;for(let t=s.length;t<e.length;t+=1){const r=e[t];if(t===s.length&&r!==";"&&r!==":")return;if(r==='"'){n=!n;continue}if(!n&&r===":")return e.slice(t+1).trim()}}function v(e,s){for(const n of C(e).split(/\r?\n/)){if(!n.startsWith(s))continue;const t=g(n,s);if(t!==void 0)return t}return""}const X=e=>v(e,"RRULE"),$=e=>({location:I(v(e,"LOCATION")),description:I(v(e,"DESCRIPTION"))});function ee(e,s){const n=C(e).split(/\r?\n/).find(r=>r.startsWith("DTSTART")&&g(r,"DTSTART")!==void 0);if(n===void 0)return A(s);const t=/;TZID="?([^;:"]+)"?/i.exec(n)?.[1];return t!==void 0?Intl.supportedValuesOf("timeZone").includes(t)?t:s:g(n,"DTSTART")?.toUpperCase().endsWith("Z")?"":s}function V(e,s){const n=e.map(a=>a.id);if(s.length===0)return n;const t=new Set(s),r=n.filter(a=>t.has(a));return r.length===0?n:r}function Y(e){const{calendars:s,colorByCalendarId:n,timeZoneByCalendarId:t,isLoading:r}=L(),a=V(s,e),o=a.length===s.length?[]:a,d=e.length===0||s.length>0;return{calendars:s,colorByCalendarId:n,timeZoneByCalendarId:t,shown:a,narrowed:o,resolved:d,isLoading:r}}function _(e,s,n){const t=n.join(",");return f.useMemo(()=>{const r=O(),a=new Set(t===""?[]:t.split(","));return e.filter(o=>W(o)&&a.has(o.calendarId)).map(o=>Z(o,s[o.calendarId]??B,r))},[e,s,t])}function se({view:e,date:s,calendarIds:n,enabled:t=!0}){const{calendars:r,colorByCalendarId:a,timeZoneByCalendarId:o,shown:d,narrowed:l,resolved:j,isLoading:N}=Y(n),w=S(e,s),h=t&&j,i=P({...w,calendarIds:l,enabled:h});U(e,s,l,h);const k=_(i.instances,o,d),p=q(w,h),m=p.tasks,D=f.useMemo(()=>m.map(z),[m]),T=i.refetch,b=p.refetch,y=f.useCallback(()=>{T(),b()},[T,b]),R=f.useMemo(()=>new Set(i.instances.filter(u=>u.transparency==="Transparent").map(u=>F(u.calendarObjectId,u.recurrenceId))),[i.instances]);return{calendars:r,events:k,colorByCalendarId:a,timeZoneByCalendarId:o,isLoading:N||i.isLoading,error:i.error??p.error,retry:y,storedTasks:m,tasks:D,instanceOf:M,freeIds:R}}export{Q as R,_ as a,V as b,se as c,X as r,ee as s,$ as t,Y as u};
@@ -1 +1 @@
1
- import{e as y,a as f,c as S,c3 as m,f as b,ca as g,r as d,cL as M,cK as p,aS as I,bS as h}from"./index-fsuIswbe.js";import{u as x}from"./useQueries-DPH-PeHV.js";import{u as O}from"./useDebouncedValue-CFZ4EPXW.js";function Q(){const s=y(),{data:a}=f({...S(),staleTime:6e4}),{data:o}=f(m()),r=b(g()),i=d.useMemo(()=>(a?.accounts??[]).filter(n=>n.syncedServices.includes("Mail")).map(n=>({accountId:n.accountId,email:n.email})),[a?.accounts]),l=o?.defaultInvitationSenderAccountId,c=d.useCallback(async n=>{await r.mutateAsync({body:{defaultInvitationSenderAccountId:n}}),await s.invalidateQueries({queryKey:m().queryKey})},[r,s]);return{senders:i,defaultSenderId:l,setDefaultSender:c}}const E=2;function w(s){const a=O(s.trim(),200),{data:o}=f({...h({query:{q:a,limit:8}}),enabled:a.length>=E});return d.useMemo(()=>(o?.items??[]).map(r=>({email:r.normalizedEmail,name:r.displayName??""})),[o?.items])}const q=["sent","unfiled","failed","blocked"],v=["failed","blocked"];function A(s){const a=y(),o=b(M()),r=x({queries:s.map(e=>({...p({path:{outboxMessageId:e.outboxMessageId}}),meta:{softErrorStatuses:[404]},retry:!1,refetchInterval:u=>{if(u.state.error)return!1;const t=u.state.data?.status;return t&&q.includes(t)?!1:1500}}))}),i=s.flatMap((e,u)=>{const t=r[u];return!t?.error||I(t.error)===404?[]:[{send:e,error:t.error,refetch:t.refetch}]}),l=()=>{for(const e of i)e.refetch()},c=s.filter((e,u)=>{const t=r[u]?.data?.status;return t!==void 0&&v.includes(t)}),n=d.useCallback(async()=>{for(const e of c)await o.mutateAsync({path:{outboxMessageId:e.outboxMessageId}}),await a.invalidateQueries({queryKey:p({path:{outboxMessageId:e.outboxMessageId}}).queryKey})},[c,o,a]);return{missed:c.map(e=>e.email),retry:n,checkError:i[0]?.error??null,unchecked:i.map(e=>e.send.email),recheck:l}}export{A as a,w as b,Q as u};
1
+ import{e as y,a as f,c as S,c3 as m,f as b,ca as g,r as d,cL as M,cK as p,aS as I,bS as h}from"./index-C2US5ZnK.js";import{u as x}from"./useQueries-B-1XtDe8.js";import{u as O}from"./useDebouncedValue-C3FljUyl.js";function Q(){const s=y(),{data:a}=f({...S(),staleTime:6e4}),{data:o}=f(m()),r=b(g()),i=d.useMemo(()=>(a?.accounts??[]).filter(n=>n.syncedServices.includes("Mail")).map(n=>({accountId:n.accountId,email:n.email})),[a?.accounts]),l=o?.defaultInvitationSenderAccountId,c=d.useCallback(async n=>{await r.mutateAsync({body:{defaultInvitationSenderAccountId:n}}),await s.invalidateQueries({queryKey:m().queryKey})},[r,s]);return{senders:i,defaultSenderId:l,setDefaultSender:c}}const E=2;function w(s){const a=O(s.trim(),200),{data:o}=f({...h({query:{q:a,limit:8}}),enabled:a.length>=E});return d.useMemo(()=>(o?.items??[]).map(r=>({email:r.normalizedEmail,name:r.displayName??""})),[o?.items])}const q=["sent","unfiled","failed","blocked"],v=["failed","blocked"];function A(s){const a=y(),o=b(M()),r=x({queries:s.map(e=>({...p({path:{outboxMessageId:e.outboxMessageId}}),meta:{softErrorStatuses:[404]},retry:!1,refetchInterval:u=>{if(u.state.error)return!1;const t=u.state.data?.status;return t&&q.includes(t)?!1:1500}}))}),i=s.flatMap((e,u)=>{const t=r[u];return!t?.error||I(t.error)===404?[]:[{send:e,error:t.error,refetch:t.refetch}]}),l=()=>{for(const e of i)e.refetch()},c=s.filter((e,u)=>{const t=r[u]?.data?.status;return t!==void 0&&v.includes(t)}),n=d.useCallback(async()=>{for(const e of c)await o.mutateAsync({path:{outboxMessageId:e.outboxMessageId}}),await a.invalidateQueries({queryKey:p({path:{outboxMessageId:e.outboxMessageId}}).queryKey})},[c,o,a]);return{missed:c.map(e=>e.email),retry:n,checkError:i[0]?.error??null,unchecked:i.map(e=>e.send.email),recheck:l}}export{A as a,w as b,Q as u};
@@ -0,0 +1 @@
1
+ import{b as ee,az as Q,aA as B,f7 as N,a as C,f8 as te,r as d,e as v,s as y,f as m,f9 as ae,fa as ne,fb as se,aS as A,b2 as re,b0 as oe,b1 as ie,fc as ce,cj as w,fd as S,f6 as de,co as le,fe as ue,ff as fe,fg as ge,fh as pe,fi as me,fj as Ce,fk as ye,fl as be}from"./index-C2US5ZnK.js";import{f as I}from"./ErrorState-g7-Y1uhe.js";import{u as G}from"./useQueries-B-1XtDe8.js";import{l as Ee}from"./list-pages-BCUbyyea.js";const z={name:"map-pin",size:24,node:[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]};z.node;const Ue=ee(z),Oe={"cal-1":{solid:"bg-cal-1",soft:"bg-cal-1-soft",text:"text-cal-1",border:"border-cal-1",rail:"border-l-cal-1"},"cal-2":{solid:"bg-cal-2",soft:"bg-cal-2-soft",text:"text-cal-2",border:"border-cal-2",rail:"border-l-cal-2"},"cal-3":{solid:"bg-cal-3",soft:"bg-cal-3-soft",text:"text-cal-3",border:"border-cal-3",rail:"border-l-cal-3"},"cal-4":{solid:"bg-cal-4",soft:"bg-cal-4-soft",text:"text-cal-4",border:"border-cal-4",rail:"border-l-cal-4"},"cal-5":{solid:"bg-cal-5",soft:"bg-cal-5-soft",text:"text-cal-5",border:"border-cal-5",rail:"border-l-cal-5"},"cal-6":{solid:"bg-cal-6",soft:"bg-cal-6-soft",text:"text-cal-6",border:"border-cal-6",rail:"border-l-cal-6"}};function $e(e){return Oe[e]}function Qe(e){return Q(B({title:`Calendar invitation: ${e}`,errorMessage:e}))}function Be(e){return Q(B({title:`Calendar event: ${e}`,errorMessage:e}))}const K=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,x="";function we(e){if(e!==x)return e;const t=K();return Intl.supportedValuesOf("timeZone").includes(t)?t:x}const Se={Cal1:"cal-1",Cal2:"cal-2",Cal3:"cal-3",Cal4:"cal-4",Cal5:"cal-5",Cal6:"cal-6"},Z={Unscheduled:"accepted",Organizer:"accepted",Accepted:"accepted",Tentative:"tentative",Declined:"declined",NeedsAction:"noReply"},Ge=e=>Z[e],he={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},H="#";function ve(e,t){return t===""?e:`${e}${H}${t}`}function R(e){const t=e.indexOf(H);return t===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,t),recurrenceId:e.slice(t+1)}}const V=(e,t)=>{const a=[...e].sort((n,s)=>Date.parse(n.start)-Date.parse(s.start));return a.find(n=>Date.parse(n.end)>Date.parse(t))??a[0]};function ze(e,t,a){const n=V(e.filter(s=>{const o=R(s.id);return o.calendarObjectId===t&&o.recurrenceId!==""}),a);return n?R(n.id):void 0}function q(e,t,a,n){const s=V(e.filter(o=>o.calendarObjectId===t&&Ie(o)).map(o=>Ae(o,"",n)),a);if(s)return{...R(s.id),calendarId:s.calendarId,date:s.start.slice(0,10)}}function j(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:Se[e.color]??"cal-1",...e.source==="Subscribed"?{readOnly:!0,sync:e.subscriptionEnabled?"live":"paused",syncError:e.subscriptionError}:{}}}function Ae(e,t,a){return{id:ve(e.calendarObjectId,e.recurrenceId),calendarId:e.calendarId,title:e.summary,start:e.allDay?e.start.slice(0,10):N(e.start,a),end:e.allDay?e.end.slice(0,10):N(e.end,a),allDay:e.allDay,location:"",notes:"",attendees:[],myRsvp:Z[e.participation],threadId:"",threadSubject:"",timeZone:t,zoneCertainty:he[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const Ie=e=>e.status!=="Cancelled";function Ke(){const{data:e,isLoading:t,error:a,refetch:n}=C(te());return d.useMemo(()=>{const s=e?.items??[],o=s.filter(i=>i.componentSet!=="VtodoOnly"),l=o.map(j),r=s.filter(i=>i.componentSet==="VtodoOnly").map(j);return{calendars:l,taskLists:r,collections:s,colorByCalendarId:Object.fromEntries(l.map(i=>[i.id,i.color])),timeZoneByCalendarId:Object.fromEntries(s.map(i=>[i.calendarId,i.timezone])),defaultCalendarId:(o.find(i=>i.source==="Default")??o[0])?.calendarId??"",isLoading:t,error:a??null,retry:()=>{n()}}},[e,t,a,n])}const D=y(400,404,412),ke=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy","calendarTaskOperationsListCalendarTasks","calendarTaskDetailOperationsGetCalendarTask"]),F=e=>A(e)===412?{kind:"conflict"}:{kind:"refused",message:I(e)},De={this:"This",following:"Following",all:"All"};function Y(){const e=v();return d.useCallback(()=>{e.invalidateQueries({predicate:t=>{const a=t.queryKey[0];if(typeof a!="object"||a===null)return!1;const n=a._id;return typeof n=="string"&&ke.has(n)}})},[e])}const W=({scope:e,recurrenceId:t})=>e===void 0?{}:{scope:De[e],recurrenceId:t};function Ze(){const e=Y(),t=m({...ae(),meta:D,onSuccess:e}),a=m({...ne(),meta:D,onSuccess:e}),n=m({...se(),meta:D,onSuccess:e}),s=d.useCallback(r=>t.mutateAsync({body:r}).then(i=>({kind:"created",calendarObjectId:i.calendarObjectId,sends:i.sends})).catch(i=>A(i)===412?{kind:"conflict"}:{kind:"refused",message:I(i)}),[t]),o=d.useCallback((r,i)=>a.mutateAsync({path:{calendarObjectId:r.calendarObjectId},query:{calendarId:r.calendarId,...W(r)},headers:{"If-Match":r.etag},body:i}).then(f=>({kind:"written",sends:f.sends})).catch(F),[a]),l=d.useCallback(r=>n.mutateAsync({path:{calendarObjectId:r.calendarObjectId},query:{calendarId:r.calendarId,...W(r)},headers:{"If-Match":r.etag}}).then(i=>({kind:"written",sends:i.sends})).catch(F),[n]);return d.useMemo(()=>({createEvent:s,updateEvent:o,deleteEvent:l,isWriting:t.isPending||a.isPending||n.isPending}),[s,o,l,t.isPending,a.isPending,n.isPending])}const M=y(400,404),L={kind:"written"},P=e=>({kind:"refused",message:I(e)});function He(){const e=v(),t=Y(),a=d.useCallback(()=>e.invalidateQueries({queryKey:re()}),[e]),n=d.useCallback(()=>(t(),a()),[t,a]),s=m({...oe(),meta:M,onSuccess:a}),o=m({...ie(),meta:M,onSuccess:n}),l=m({...ce(),meta:M,onSuccess:n}),r=d.useCallback(c=>s.mutateAsync({body:c}).then(()=>L).catch(P),[s]),i=d.useCallback((c,g)=>o.mutateAsync({path:{calendarId:c},body:g}).then(()=>L).catch(P),[o]),f=d.useCallback(c=>l.mutateAsync({path:{calendarId:c}}).then(()=>L).catch(P),[l]);return d.useMemo(()=>({createCalendar:r,updateCalendar:i,deleteCalendar:f,isWriting:s.isPending||o.isPending||l.isPending}),[r,i,f,s.isPending,o.isPending,l.isPending])}const Me=y(404);function Ve(e,t){const{data:a,isLoading:n,error:s,refetch:o}=C({...w({path:{calendarObjectId:e},query:{calendarId:t}}),meta:Me,enabled:e!==""&&t!==""});return{resource:a,isLoading:n,error:s,refetch:()=>{o()}}}const J=y(400,404),k=5*6e4,T=({from:e,to:t,calendarIds:a})=>({query:a.length===0?{from:e,to:t}:{from:e,to:t,calendarId:[...a]}});function Ye(e){const{data:t,isLoading:a,error:n,refetch:s}=C({...S(T(e)),meta:J,staleTime:k,enabled:e.enabled??!0});return{instances:t?.items??[],isLoading:a,error:n,refetch:()=>{s()}}}function Je(e,t,a){const n=G({queries:e.map(c=>({...S(T({...c,calendarIds:t})),meta:J,staleTime:k,enabled:a}))}),s=e.map(c=>c.from).join("|"),o=n.map(c=>c.data),l=n.map(c=>c.isPending).join("|"),r=n.find(c=>c.error)?.error??null,i=d.useMemo(()=>o.flatMap(c=>c?.items??[]),[s,l]),f=d.useMemo(()=>{const c=new Set;return e.forEach((g,u)=>{n[u]?.isPending&&c.add(g.from)}),c},[s,l]);return{instances:i,pendingWindows:f,error:r,refetch:()=>{for(const c of n)c.error&&c.refetch()}}}function Xe(e,t,a,n){const s=v(),o=[...a].join(",");d.useEffect(()=>{if(!n)return;const l=o===""?[]:o.split(",");for(const r of[-1,1]){const i=de(e,le(t,e,r));s.prefetchQuery({...S(T({...i,calendarIds:l})),staleTime:k})}},[s,e,t,o,n])}const Le=y(400,404);function et(e){const t=G({queries:e.map(r=>({...ue({query:{from:r.from,to:r.to}}),meta:Le,staleTime:k}))}),a=e.map(r=>r.from).join("|"),n=t.map(r=>r.data),s=t.map(r=>r.isPending).join("|"),o=d.useMemo(()=>n.flatMap(r=>r?.items??[]),[a,s]),l=d.useMemo(()=>{const r=new Set;return e.forEach((i,f)=>{t[f]?.isPending&&r.add(i.from)}),r},[a,s]);return{spans:o,pendingWindows:l,error:t.find(r=>r.error)?.error??null,refetch:()=>{for(const r of t)r.error&&r.refetch()}}}const U=365*24*60*6e4,Pe=1440*6e4,$=y(),Re=y(404),h=e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"+00:00"),Te=e=>{const t=e instanceof Error&&e.message!==""?e.message:"no reason given",a=A(e);return a===void 0?t:`${t} (HTTP ${a})`};function tt(e,t){const[a]=d.useState(()=>Date.now()),n=K(),s=new Date(a).toISOString(),o=C({...S({query:{from:h(a),to:h(a+U),calendarObjectId:e}}),meta:$,retry:!1,enabled:t}),l=o.data?q(o.data.items,e,s,n):void 0,r=C({...w({path:{calendarObjectId:e}}),meta:Re,retry:!1,enabled:t&&o.data!==void 0&&l===void 0}),i=Date.parse(r.data?.dtStart??""),f=r.data!==void 0&&Number.isNaN(i),c=Number.isNaN(i)?0:i-Pe,g=C({...S({query:{from:h(c),to:h(c+U),calendarObjectId:e}}),meta:$,retry:!1,enabled:t&&r.data!==void 0&&!f}),u=g.data?q(g.data.items,e,s,n):void 0;if(!t)return{kind:"Idle"};if(l)return{kind:"Found",jump:l};if(u)return{kind:"Found",jump:u};const p=A(r.error)===404,_=[o.error,p?null:r.error,g.error].find(X=>X!==null);return _!==void 0?{kind:"Failed",reason:Te(_)}:p?{kind:"Deleted"}:f?{kind:"Failed",reason:`the stored event names no readable start (${r.data?.dtStart??""})`}:g.data!==void 0?{kind:"NoOccurrenceFound"}:{kind:"Searching"}}const b=y(400,404),_e=new Set(["calendarSuggestionOperationsListCalendarSuggestions","messageCalendarSuggestionOperationsListMessageCalendarSuggestions","calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy","filterOperationsListFilters"]),Ne=e=>e.invalidateQueries({predicate:t=>{const a=t.queryKey[0];if(typeof a!="object"||a===null)return!1;const n=a._id;return typeof n=="string"&&_e.has(n)}});function at(e){const{data:t,isLoading:a,error:n}=C({...fe({path:{messageId:e}}),meta:b});return{suggestions:t?.items??[],isLoading:a,error:n??null}}function nt(){const{data:e,isLoading:t,error:a}=C({...ye({query:{state:"Pending"}}),meta:b});return{suggestions:e?.items??[],isLoading:t,error:a??null}}const xe=async(e,t)=>{const a=Ee(async n=>{const{data:s}=await be({query:{state:"Pending",continuationToken:n},signal:t,throwOnError:!0});return s});for await(const n of a){const s=n.find(o=>o.suggestionId===e);if(s)return s}return null};function st(e){const{data:t,isLoading:a,error:n}=C({queryKey:[{_id:"calendarSuggestionOperationsListCalendarSuggestions",suggestionId:e}],queryFn:({signal:s})=>xe(e,s),meta:b});return{suggestion:t,isLoading:a,error:n??null}}const E={kind:"answered"},O=e=>({kind:"refused",message:I(e)});function rt(){const e=v(),t=d.useCallback(()=>Ne(e),[e]),a=m({...ge(),meta:b,onSuccess:t}),n=m({...pe(),meta:b,onSuccess:t}),s=m({...me(),meta:b,onSuccess:t}),o=m({...Ce(),meta:b,onSuccess:t}),l=d.useCallback((u,p)=>a.mutateAsync({path:{suggestionId:u},body:{calendarId:p}}).then(()=>E).catch(O),[a]),r=d.useCallback((u,p)=>a.mutateAsync({path:{suggestionId:u},body:{calendarId:p,answer:"Tentative"}}).then(()=>E).catch(O),[a]),i=d.useCallback((u,p)=>a.mutateAsync({path:{suggestionId:u},body:p}).then(()=>E).catch(O),[a]),f=d.useCallback(u=>n.mutateAsync({path:{suggestionId:u}}).then(()=>E).catch(O),[n]),c=d.useCallback((u,p)=>s.mutateAsync({path:{suggestionId:u},body:{muteSender:p}}).then(()=>E).catch(O),[s]),g=d.useCallback(u=>o.mutateAsync({path:{suggestionId:u}}).then(()=>E).catch(O),[o]);return d.useMemo(()=>({accept:l,tentative:r,acceptEdited:i,decline:f,dismiss:c,reopen:g,isAnswering:a.isPending||n.isPending||s.isPending||o.isPending}),[l,r,i,f,c,g,a.isPending,n.isPending,s.isPending,o.isPending])}export{D as C,Ue as M,x as U,Y as a,Ke as b,Be as c,$e as d,Ze as e,K as f,Je as g,et as h,ve as i,nt as j,rt as k,Qe as l,at as m,Ye as n,Ie as o,we as p,Xe as q,R as r,Ve as s,Ae as t,He as u,ze as v,tt as w,Ge as x,st as y};
@@ -1 +1 @@
1
- import{r as u,j as O,p as v,f as y,fn as P,fo as q,fp as W,a as E,fq as R,aS as I,fr as j,s as D}from"./index-fsuIswbe.js";import{a as z,C as k}from"./useCalendarSuggestions-DXbA0boT.js";import{f as B}from"./ErrorState-BTHOmsYP.js";const i=8,x=(e,t,a)=>Math.min(Math.max(e,t),Math.max(t,a)),G=(e,t)=>e.width>0&&e.height>0&&e.left<t.width&&e.left+e.width>0&&e.top<t.height&&e.top+e.height>0;function C(e,t){return{left:Math.max(i,(t.width-e.width)/2),top:Math.max(i,(t.height-e.height)/2),side:"center"}}function H(e,t,a){if(!e||!G(e,a))return C(t,a);const r=x(e.top,i,a.height-t.height-i),c=e.left+e.width+i;if(c+t.width<=a.width-i)return{left:c,top:r,side:"right"};const f=e.left-i-t.width;if(f>=i)return{left:f,top:r,side:"left"};const l=x(e.left,i,a.width-t.width-i),s=e.top+e.height+i;if(s+t.height<=a.height-i)return{left:l,top:s,side:"below"};const h=e.top-i-t.height;return h>=i?{left:l,top:h,side:"above"}:C(t,a)}const N='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function _({anchor:e,anchorKey:t,labelledBy:a,children:r,header:c,wrapTab:f=!1,panelRef:l,className:s}){const h=u.useRef(null),[w,M]=u.useState(null),[p,A]=u.useState({key:t,x:0,y:0}),g=p.key===t?p:{x:0,y:0};u.useLayoutEffect(()=>{const n=h.current;if(!n||t==="")return;const d=()=>{const o=(typeof e=="string"?document.querySelector(e):e)?.getBoundingClientRect();M(H(o?{left:o.left,top:o.top,width:o.width,height:o.height}:null,{width:n.offsetWidth,height:n.offsetHeight},{width:window.innerWidth,height:window.innerHeight}))};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[e,t]);const S=n=>{if(n.button!==0||n.target instanceof Element&&n.target.closest("button, input, select, a"))return;n.preventDefault();const d={x:n.clientX-g.x,y:n.clientY-g.y},m=b=>A({key:t,x:b.clientX-d.x,y:b.clientY-d.y}),o=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",o)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",o)},L=n=>{if(!f||n.key!=="Tab")return;const d=Array.from(n.currentTarget.querySelectorAll(N));if(d.length===0)return;const m=d[0],o=d[d.length-1];n.shiftKey&&document.activeElement===m?(n.preventDefault(),o.focus()):!n.shiftKey&&document.activeElement===o&&(n.preventDefault(),m.focus())};return O.jsxs("div",{ref:n=>{h.current=n,typeof l=="function"?l(n):l&&(l.current=n)},role:"dialog","aria-modal":"false","aria-labelledby":a,"data-calendar-popover":"",onKeyDown:L,className:v("fixed z-40 w-[26rem] max-w-[calc(100vw-1rem)] rounded-xl border border-line bg-surface-raised text-fg shadow-xl shadow-black/20",w===null&&"opacity-0",s),style:{left:(w?.left??0)+g.x,top:(w?.top??0)+g.y},children:[c?.({onPointerDown:S}),r]})}const F=e=>({calendarTaskId:e.calendarTaskId,calendarId:e.calendarId,title:e.summary,due:e.allDay?e.due.slice(0,10):e.dueAt,allDay:e.allDay,completed:e.completed});function Q(e,t=!0){const{data:a,error:r,refetch:c}=E({...R({query:{from:e.from,to:e.to}}),meta:D(400,404),enabled:t});return{tasks:u.useMemo(()=>a?.items??[],[a?.items]),error:r,refetch:c}}function V(e){const{data:t,error:a,refetch:r}=E({...j({path:{calendarTaskId:e}}),meta:D(404),retry:!1});return t?{kind:"found",task:t}:a===null?{kind:"loading"}:I(a)===404?{kind:"gone"}:{kind:"failed",error:a,retry:()=>{r()}}}const T=e=>({kind:"refused",message:I(e)===412?"This task changed while you were looking at it. Close it and open it again.":B(e)});function J(){const e=z(),t=y({...P(),meta:k,onSuccess:e}),a=y({...q(),meta:k,onSuccess:e}),r=y({...W(),meta:k,onSuccess:e}),c=u.useCallback(s=>t.mutateAsync({body:s}).then(()=>({kind:"written"})).catch(T),[t]),f=u.useCallback((s,h)=>a.mutateAsync({path:{calendarTaskId:s.calendarTaskId},query:{calendarId:s.calendarId},headers:{"If-Match":s.etag},body:h}).then(()=>({kind:"written"})).catch(T),[a]),l=u.useCallback(s=>r.mutateAsync({path:{calendarTaskId:s.calendarTaskId},query:{calendarId:s.calendarId},headers:{"If-Match":s.etag}}).then(()=>({kind:"written"})).catch(T),[r]);return{createTask:c,updateTask:f,deleteTask:l,isWriting:t.isPending||a.isPending||r.isPending}}export{_ as C,Q as a,V as b,F as t,J as u};
1
+ import{r as u,j as O,p as v,f as y,fp as P,fq as q,fr as W,a as E,fs as R,aS as I,ft as j,s as D}from"./index-C2US5ZnK.js";import{a as z,C as k}from"./useCalendarSuggestions-CJGnqdiK.js";import{f as B}from"./ErrorState-g7-Y1uhe.js";const i=8,x=(e,t,a)=>Math.min(Math.max(e,t),Math.max(t,a)),G=(e,t)=>e.width>0&&e.height>0&&e.left<t.width&&e.left+e.width>0&&e.top<t.height&&e.top+e.height>0;function C(e,t){return{left:Math.max(i,(t.width-e.width)/2),top:Math.max(i,(t.height-e.height)/2),side:"center"}}function H(e,t,a){if(!e||!G(e,a))return C(t,a);const r=x(e.top,i,a.height-t.height-i),c=e.left+e.width+i;if(c+t.width<=a.width-i)return{left:c,top:r,side:"right"};const f=e.left-i-t.width;if(f>=i)return{left:f,top:r,side:"left"};const l=x(e.left,i,a.width-t.width-i),s=e.top+e.height+i;if(s+t.height<=a.height-i)return{left:l,top:s,side:"below"};const h=e.top-i-t.height;return h>=i?{left:l,top:h,side:"above"}:C(t,a)}const N='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function _({anchor:e,anchorKey:t,labelledBy:a,children:r,header:c,wrapTab:f=!1,panelRef:l,className:s}){const h=u.useRef(null),[w,M]=u.useState(null),[p,A]=u.useState({key:t,x:0,y:0}),g=p.key===t?p:{x:0,y:0};u.useLayoutEffect(()=>{const n=h.current;if(!n||t==="")return;const d=()=>{const o=(typeof e=="string"?document.querySelector(e):e)?.getBoundingClientRect();M(H(o?{left:o.left,top:o.top,width:o.width,height:o.height}:null,{width:n.offsetWidth,height:n.offsetHeight},{width:window.innerWidth,height:window.innerHeight}))};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[e,t]);const S=n=>{if(n.button!==0||n.target instanceof Element&&n.target.closest("button, input, select, a"))return;n.preventDefault();const d={x:n.clientX-g.x,y:n.clientY-g.y},m=b=>A({key:t,x:b.clientX-d.x,y:b.clientY-d.y}),o=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",o)};window.addEventListener("pointermove",m),window.addEventListener("pointerup",o)},L=n=>{if(!f||n.key!=="Tab")return;const d=Array.from(n.currentTarget.querySelectorAll(N));if(d.length===0)return;const m=d[0],o=d[d.length-1];n.shiftKey&&document.activeElement===m?(n.preventDefault(),o.focus()):!n.shiftKey&&document.activeElement===o&&(n.preventDefault(),m.focus())};return O.jsxs("div",{ref:n=>{h.current=n,typeof l=="function"?l(n):l&&(l.current=n)},role:"dialog","aria-modal":"false","aria-labelledby":a,"data-calendar-popover":"",onKeyDown:L,className:v("fixed z-40 w-[26rem] max-w-[calc(100vw-1rem)] rounded-xl border border-line bg-surface-raised text-fg shadow-xl shadow-black/20",w===null&&"opacity-0",s),style:{left:(w?.left??0)+g.x,top:(w?.top??0)+g.y},children:[c?.({onPointerDown:S}),r]})}const F=e=>({calendarTaskId:e.calendarTaskId,calendarId:e.calendarId,title:e.summary,due:e.allDay?e.due.slice(0,10):e.dueAt,allDay:e.allDay,completed:e.completed});function Q(e,t=!0){const{data:a,error:r,refetch:c}=E({...R({query:{from:e.from,to:e.to}}),meta:D(400,404),enabled:t});return{tasks:u.useMemo(()=>a?.items??[],[a?.items]),error:r,refetch:c}}function V(e){const{data:t,error:a,refetch:r}=E({...j({path:{calendarTaskId:e}}),meta:D(404),retry:!1});return t?{kind:"found",task:t}:a===null?{kind:"loading"}:I(a)===404?{kind:"gone"}:{kind:"failed",error:a,retry:()=>{r()}}}const T=e=>({kind:"refused",message:I(e)===412?"This task changed while you were looking at it. Close it and open it again.":B(e)});function J(){const e=z(),t=y({...P(),meta:k,onSuccess:e}),a=y({...q(),meta:k,onSuccess:e}),r=y({...W(),meta:k,onSuccess:e}),c=u.useCallback(s=>t.mutateAsync({body:s}).then(()=>({kind:"written"})).catch(T),[t]),f=u.useCallback((s,h)=>a.mutateAsync({path:{calendarTaskId:s.calendarTaskId},query:{calendarId:s.calendarId},headers:{"If-Match":s.etag},body:h}).then(()=>({kind:"written"})).catch(T),[a]),l=u.useCallback(s=>r.mutateAsync({path:{calendarTaskId:s.calendarTaskId},query:{calendarId:s.calendarId},headers:{"If-Match":s.etag}}).then(()=>({kind:"written"})).catch(T),[r]);return{createTask:c,updateTask:f,deleteTask:l,isWriting:t.isPending||a.isPending||r.isPending}}export{_ as C,Q as a,V as b,F as t,J as u};
@@ -1 +1 @@
1
- import{j as a,d as U,B as C,aS as k,az as x,aA as N,c8 as E,b3 as n,bU as P,s as y,c9 as w,a as K,c3 as I,r as M,bN as S,e as g,f as u,ca as A,cb as B,cc as $}from"./index-fsuIswbe.js";function V({title:e,message:s,reportHref:t,onRetry:r,retryLabel:o="Retry",retryRef:c}){return a.jsxs(U,{tone:"danger",variant:"soft",children:[a.jsx("p",{className:"font-medium",children:e}),a.jsx("p",{className:"mt-0.5 break-words text-fg-muted",children:s}),a.jsxs("p",{className:"flex flex-wrap items-center gap-x-4",children:[r&&a.jsx(C,{ref:c,variant:"secondary",className:"min-h-11",onClick:r,children:o}),a.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-11 items-center font-medium text-accent hover:underline",children:"Report an issue"})]})]})}const L=y(403),d={...y(400,403,404,409,422,429),...E},v=e=>k(e)===403,i=e=>e.state==="NotConfigured"?{presetId:void 0,sources:void 0}:e.state==="Unrunnable"?{presetId:e.presetId,sources:void 0}:{presetId:e.presetId,sources:e.sources},O=(e,s)=>{const t=i(e);return t.presetId===s?t.sources:void 0},f=(e,s)=>e.state==="Configured"&&e.sources[s]===n.Saved?e[s]:"",R=(e,s,t)=>e.state==="Configured"&&e.presetId===s&&e[t]!==""?e[t]:void 0,F=e=>({presetId:i(e).presetId,model:f(e,"model"),baseUrl:f(e,"baseUrl"),apiKey:""}),G=(e,s)=>i(s).presetId===e.presetId?F(s):{presetId:e.presetId,model:"",baseUrl:"",apiKey:""},Y=e=>e.state==="Unrunnable"?!0:e.state==="NotConfigured"?!1:Object.values(e.sources).includes(n.Saved),j={Hosted:"Hosted",Custom:"Your own endpoint",Local:"Self-hosted"},z=e=>{const s=[];for(const t of e){const r=s.find(o=>o.group===t.group);if(r){r.presets.push(t);continue}s.push({group:t.group,label:j[t.group],presets:[t]})}return s},D=e=>e.defaultBaseUrl===void 0,X=(e,s)=>s===n.Saved?`${e} Saved by you.`:s===n.Deployment?`${e} Provided by the deployment.`:e,T="Paste an API key",Z=e=>w(e)?.code==="ClassificationApiKeyRequired",p="Enter a URL that starts with http:// or https://",q=e=>{if(!URL.canParse(e))return!1;const{protocol:s}=new URL(e);return s==="http:"||s==="https:"},J=(e,s,t)=>{const r=e.baseUrl.trim(),o=e.apiKey.trim(),c=O(t,s.presetId);if(r!==""&&!q(r))return{ok:!1,field:"BaseUrl",message:p};if(r===""&&D(s)&&R(t,s.presetId,"baseUrl")===void 0)return{ok:!1,field:"BaseUrl",message:p};const b=c?.apiKey??n.Default;return s.needsKey&&o===""&&b===n.Default?{ok:!1,field:"ApiKey",message:T}:{ok:!0,body:{...i(t).presetId!==s.presetId?{classificationPresetId:s.presetId}:{},classificationModel:e.model.trim(),classificationBaseUrl:r,...s.needsKey&&o!==""?{classificationApiKey:o}:{}}}},W=(e,s,t)=>{const r=i(e).presetId;if(!(r===void 0||s===void 0)&&r!==s)return t.find(o=>o.presetId===r)},ee=e=>{const s=e.status===void 0?e.kind:`${e.status}`;return`Test failed after ${e.latencyMs} ms: ${s}`},se=(e,s)=>x(N({title:`Mail classification: ${e}`,errorMessage:`${e}. ${s}`})),te=e=>{const s=e.needsKey?"Needs an API key.":"No key needed.";if(e.price.state!=="Priced")return s;const t=new Intl.NumberFormat("en",{style:"currency",currency:e.price.currency,maximumFractionDigits:4}).format(e.price.perMillionInputTokens);return`${s} ${t} per million input tokens.`},m="Enter a whole number of 1 or more.",H=2147483647,re=e=>{const s=e.trim();if(!/^\d+$/.test(s))return{ok:!1,message:m};const t=Number(s);return t<1||t>H?{ok:!1,message:m}:{ok:!0,limit:t}},oe=e=>e.calls>=e.dailyLimit,ae=(e,s)=>{const{cost:t}=e;if(t.state==="Priced"){const r=new Intl.NumberFormat("en",{style:"currency",currency:t.currency,maximumFractionDigits:2});return t.amount>0&&t.amount<.01?`under ${r.format(.01)}`:t.amount===0?r.format(0):`about ${r.format(t.amount)}`}return s?.group==="Local"?"no price, self-hosted":"no price"},ne=e=>P(e,{hour:"2-digit",minute:"2-digit",timeZoneName:"shortOffset"}),l=e=>{v(e)&&S()},h=e=>s=>{e.setQueryData(I().queryKey,s)},ie=()=>{const e=K({...I(),meta:L}),s=e.isError&&v(e.error);return M.useEffect(()=>{s&&S()},[s]),{...e,signedOut:s}},ce=()=>{const e=g();return u({...A(),meta:d,onSuccess:h(e),onError:l})},ue=()=>{const e=g();return u({...B(),meta:d,onSuccess:h(e),onError:l})},de=()=>u({...$(),meta:d,onError:l});export{V as F,T as P,ue as a,te as b,se as c,F as d,i as e,de as f,z as g,Y as h,G as i,O as j,R as k,J as l,Z as m,D as n,ie as o,re as p,oe as q,ne as r,W as s,ee as t,ce as u,ae as v,X as w};
1
+ import{j as a,d as U,B as C,aS as k,az as x,aA as N,c8 as E,b3 as n,bU as P,s as y,c9 as w,a as K,c3 as I,r as M,bN as S,e as g,f as u,ca as A,cb as B,cc as $}from"./index-C2US5ZnK.js";function V({title:e,message:s,reportHref:t,onRetry:r,retryLabel:o="Retry",retryRef:c}){return a.jsxs(U,{tone:"danger",variant:"soft",children:[a.jsx("p",{className:"font-medium",children:e}),a.jsx("p",{className:"mt-0.5 break-words text-fg-muted",children:s}),a.jsxs("p",{className:"flex flex-wrap items-center gap-x-4",children:[r&&a.jsx(C,{ref:c,variant:"secondary",className:"min-h-11",onClick:r,children:o}),a.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-11 items-center font-medium text-accent hover:underline",children:"Report an issue"})]})]})}const L=y(403),d={...y(400,403,404,409,422,429),...E},v=e=>k(e)===403,i=e=>e.state==="NotConfigured"?{presetId:void 0,sources:void 0}:e.state==="Unrunnable"?{presetId:e.presetId,sources:void 0}:{presetId:e.presetId,sources:e.sources},O=(e,s)=>{const t=i(e);return t.presetId===s?t.sources:void 0},f=(e,s)=>e.state==="Configured"&&e.sources[s]===n.Saved?e[s]:"",R=(e,s,t)=>e.state==="Configured"&&e.presetId===s&&e[t]!==""?e[t]:void 0,F=e=>({presetId:i(e).presetId,model:f(e,"model"),baseUrl:f(e,"baseUrl"),apiKey:""}),G=(e,s)=>i(s).presetId===e.presetId?F(s):{presetId:e.presetId,model:"",baseUrl:"",apiKey:""},Y=e=>e.state==="Unrunnable"?!0:e.state==="NotConfigured"?!1:Object.values(e.sources).includes(n.Saved),j={Hosted:"Hosted",Custom:"Your own endpoint",Local:"Self-hosted"},z=e=>{const s=[];for(const t of e){const r=s.find(o=>o.group===t.group);if(r){r.presets.push(t);continue}s.push({group:t.group,label:j[t.group],presets:[t]})}return s},D=e=>e.defaultBaseUrl===void 0,X=(e,s)=>s===n.Saved?`${e} Saved by you.`:s===n.Deployment?`${e} Provided by the deployment.`:e,T="Paste an API key",Z=e=>w(e)?.code==="ClassificationApiKeyRequired",p="Enter a URL that starts with http:// or https://",q=e=>{if(!URL.canParse(e))return!1;const{protocol:s}=new URL(e);return s==="http:"||s==="https:"},J=(e,s,t)=>{const r=e.baseUrl.trim(),o=e.apiKey.trim(),c=O(t,s.presetId);if(r!==""&&!q(r))return{ok:!1,field:"BaseUrl",message:p};if(r===""&&D(s)&&R(t,s.presetId,"baseUrl")===void 0)return{ok:!1,field:"BaseUrl",message:p};const b=c?.apiKey??n.Default;return s.needsKey&&o===""&&b===n.Default?{ok:!1,field:"ApiKey",message:T}:{ok:!0,body:{...i(t).presetId!==s.presetId?{classificationPresetId:s.presetId}:{},classificationModel:e.model.trim(),classificationBaseUrl:r,...s.needsKey&&o!==""?{classificationApiKey:o}:{}}}},W=(e,s,t)=>{const r=i(e).presetId;if(!(r===void 0||s===void 0)&&r!==s)return t.find(o=>o.presetId===r)},ee=e=>{const s=e.status===void 0?e.kind:`${e.status}`;return`Test failed after ${e.latencyMs} ms: ${s}`},se=(e,s)=>x(N({title:`Mail classification: ${e}`,errorMessage:`${e}. ${s}`})),te=e=>{const s=e.needsKey?"Needs an API key.":"No key needed.";if(e.price.state!=="Priced")return s;const t=new Intl.NumberFormat("en",{style:"currency",currency:e.price.currency,maximumFractionDigits:4}).format(e.price.perMillionInputTokens);return`${s} ${t} per million input tokens.`},m="Enter a whole number of 1 or more.",H=2147483647,re=e=>{const s=e.trim();if(!/^\d+$/.test(s))return{ok:!1,message:m};const t=Number(s);return t<1||t>H?{ok:!1,message:m}:{ok:!0,limit:t}},oe=e=>e.calls>=e.dailyLimit,ae=(e,s)=>{const{cost:t}=e;if(t.state==="Priced"){const r=new Intl.NumberFormat("en",{style:"currency",currency:t.currency,maximumFractionDigits:2});return t.amount>0&&t.amount<.01?`under ${r.format(.01)}`:t.amount===0?r.format(0):`about ${r.format(t.amount)}`}return s?.group==="Local"?"no price, self-hosted":"no price"},ne=e=>P(e,{hour:"2-digit",minute:"2-digit",timeZoneName:"shortOffset"}),l=e=>{v(e)&&S()},h=e=>s=>{e.setQueryData(I().queryKey,s)},ie=()=>{const e=K({...I(),meta:L}),s=e.isError&&v(e.error);return M.useEffect(()=>{s&&S()},[s]),{...e,signedOut:s}},ce=()=>{const e=g();return u({...A(),meta:d,onSuccess:h(e),onError:l})},ue=()=>{const e=g();return u({...B(),meta:d,onSuccess:h(e),onError:l})},de=()=>u({...$(),meta:d,onError:l});export{V as F,T as P,ue as a,te as b,se as c,F as d,i as e,de as f,z as g,Y as h,G as i,O as j,R as k,J as l,Z as m,D as n,ie as o,re as p,oe as q,ne as r,W as s,ee as t,ce as u,ae as v,X as w};
@@ -1 +1 @@
1
- import{r as u,c7 as i,d6 as c,a as g}from"./index-fsuIswbe.js";import{u as T}from"./useQueries-DPH-PeHV.js";import{u as q}from"./useInfiniteQuery-B-vOuANs.js";const s=(e,t)=>({...t,...e,order:"desc"}),P=(e,t={})=>c({query:s(e,t)});function M(e,t={}){const{data:r,isLoading:n,isError:o,error:y,refetch:f,fetchNextPage:m,hasNextPage:p,isFetchingNextPage:h}=q({queryKey:P(e,t),queryFn:async({pageParam:a})=>{const{data:l}=await i({query:{...s(e,t),continuationToken:a},throwOnError:!0});return l},initialPageParam:void 0,getNextPageParam:a=>a.continuationToken,staleTime:6e4});return{threads:u.useMemo(()=>(r?.pages??[]).flatMap(a=>a.items??[]),[r]),isLoading:n,isError:o,error:y,refetch:f,fetchNextPage:m,hasNextPage:p,isFetchingNextPage:h}}function E(e,t={}){const{data:r}=g(d(e,t));return r?.count}function K(e){const t=T({queries:e.map(r=>d({labelId:r})),combine:x});return u.useMemo(()=>new Map(e.flatMap((r,n)=>{const o=t[n];return o===void 0?[]:[[r,o]]})),[e,t])}const x=e=>e.map(t=>t.data?.count);function d(e,t={}){const r={...s(e,t),unread:!0,count:!0,results:!1};return{queryKey:c({query:r}),queryFn:async()=>{const{data:n}=await i({query:r,throwOnError:!0});return n},staleTime:6e4}}export{M as a,E as b,K as u};
1
+ import{r as u,c7 as i,d6 as c,a as g}from"./index-C2US5ZnK.js";import{u as T}from"./useQueries-B-1XtDe8.js";import{u as q}from"./useInfiniteQuery-Dd0GYAxg.js";const s=(e,t)=>({...t,...e,order:"desc"}),P=(e,t={})=>c({query:s(e,t)});function M(e,t={}){const{data:r,isLoading:n,isError:o,error:y,refetch:f,fetchNextPage:m,hasNextPage:p,isFetchingNextPage:h}=q({queryKey:P(e,t),queryFn:async({pageParam:a})=>{const{data:l}=await i({query:{...s(e,t),continuationToken:a},throwOnError:!0});return l},initialPageParam:void 0,getNextPageParam:a=>a.continuationToken,staleTime:6e4});return{threads:u.useMemo(()=>(r?.pages??[]).flatMap(a=>a.items??[]),[r]),isLoading:n,isError:o,error:y,refetch:f,fetchNextPage:m,hasNextPage:p,isFetchingNextPage:h}}function E(e,t={}){const{data:r}=g(d(e,t));return r?.count}function K(e){const t=T({queries:e.map(r=>d({labelId:r})),combine:x});return u.useMemo(()=>new Map(e.flatMap((r,n)=>{const o=t[n];return o===void 0?[]:[[r,o]]})),[e,t])}const x=e=>e.map(t=>t.data?.count);function d(e,t={}){const r={...s(e,t),unread:!0,count:!0,results:!1};return{queryKey:c({query:r}),queryFn:async()=>{const{data:n}=await i({query:r,throwOnError:!0});return n},staleTime:6e4}}export{M as a,E as b,K as u};
@@ -1 +1 @@
1
- import{r as o}from"./index-fsuIswbe.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
1
+ import{r as o}from"./index-C2US5ZnK.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
@@ -1 +1 @@
1
- import{j as u,eU as x,X as E,p as M,eV as z,eW as L,ar as w,B as O,r as p,f as v,eX as T,a as D,eY as R,eZ as $,e_ as _,e$ as J,e as S,f0 as U,f1 as q,f2 as B,bd as K}from"./index-fsuIswbe.js";import{u as Q,S as H}from"./suggest-list-BCqr1j26.js";import{S as W}from"./select-TYdrgtW5.js";import{P as X}from"./plus-D5-2sA5v.js";const P="inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs";function pe({clause:e,onEdit:t,onRemove:r}){return u.jsxs("span",{className:M(P,e.derived?"border-dashed border-line-strong bg-surface-sunken":"border-line bg-surface"),children:[u.jsxs("button",{type:"button",onClick:t,"aria-label":`Edit ${x(e.field)} clause`,className:"flex items-center gap-1 text-left",children:[u.jsx("span",{className:"font-medium text-fg-muted",children:x(e.field)}),u.jsx("span",{className:"text-fg",children:e.value})]}),e.derived&&u.jsx("span",{className:"text-2xs text-fg-subtle",children:"from sender"}),r&&u.jsx("button",{type:"button",onClick:r,"aria-label":`Remove ${x(e.field)} clause`,className:"flex size-4 items-center justify-center rounded-full text-fg-subtle hover:bg-surface-sunken hover:text-fg-muted",children:u.jsx(E,{className:"size-3"})})]})}function fe({label:e,onClick:t}){return u.jsxs("button",{type:"button",onClick:t,className:M(P,"border-dashed border-line-strong text-fg-muted hover:border-accent-2 hover:text-accent-2"),children:[u.jsx(X,{className:"size-3","aria-hidden":"true"}),e]})}function be({draft:e,mode:t,fields:r=L,suggestions:s=[],onChangeField:o,onChangeValue:a,onSubmit:n,onCancel:c}){const d=z(e.field),l=Q({count:s.length,onAccept:i=>a?.(s[i].value)});return u.jsxs("div",{className:"space-y-1.5 rounded-lg border border-accent-2 bg-surface p-2",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(W,{"aria-label":"Clause field",value:e.field,onChange:i=>o?.(i.target.value),className:"h-8 w-32 shrink-0",children:r.map(i=>u.jsx("option",{value:i,children:x(i)},i))}),u.jsx(w,{"aria-label":"Clause value",value:e.value,placeholder:"value…",autoComplete:"off",onChange:i=>{l.reopen(),a?.(i.target.value)},onKeyDown:i=>{l.handleKeyDown(i)||i.key==="Enter"&&n?.()},className:"h-8 min-w-40 flex-1",...l.comboboxProps}),u.jsx(O,{variant:"primary",size:"sm",onClick:n,disabled:e.value.trim()==="",className:"shrink-0",children:t==="add"?"Add":"Save"}),u.jsx(O,{variant:"ghost",size:"sm",onClick:c,"aria-label":"Cancel clause edit",icon:u.jsx(E,{className:"size-4"}),className:"shrink-0 px-2"})]}),l.open&&u.jsx(H,{id:l.listId,suggestions:s,activeIndex:l.activeIndex,optionId:l.optionId,onPick:i=>{a?.(i.value),l.dismiss()},onHighlight:l.setActiveIndex,label:`${x(e.field)} suggestions`}),d&&u.jsx("p",{className:"px-0.5 text-2xs text-fg-subtle",children:d})]})}const ge=(e,t)=>{if(e.state==="Expired")return"Expired";const r=e.state==="Disabled"?"Disabled":"Active";if(e.scope!=="Temporary"||!e.expiresAt)return r;const s=Date.parse(e.expiresAt);return Number.isNaN(s)?r:s<=t?"Expired":r},N={UserDisabled:"Turned off. Turn it on to run it on new mail again.",AwaitingFolder:"Off until its folder exists on the mail server. It turns on by itself once the folder is created.",FolderCreateFailed:"Off: the mail server refused to create its folder. Pick another folder in the rule, then turn it on.",FolderMissing:"Off: the folder it moves mail into no longer exists. Pick another folder in the rule, then turn it on."},he=e=>e.disabledReason==="None"?void 0:(e.disabledReason==="AwaitingFolder"||e.disabledReason==="FolderCreateFailed")&&e.actionMailboxId!=="None"?N.UserDisabled:N[e.disabledReason],xe=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},j=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,s,o,a]=r,n=new Date(Number(s),Number(o)-1,Number(a),23,59,59,0);if(Number.isNaN(n.getTime()))return;const c=-t.getTimezoneOffset(),d=c>=0?"+":"-",l=Math.abs(c),i=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),m=b=>String(b).padStart(2,"0");return`${n.getFullYear()}-${m(n.getMonth()+1)}-${m(n.getDate())}T${m(n.getHours())}:${m(n.getMinutes())}:${m(n.getSeconds())}${d}${i}:${f}`},h="None",Y=e=>({filterId:e,matchOperator:"And",literalClauses:[],actionLabelId:h,actionMailboxId:h}),k=e=>({matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),ve=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",Ce=({ruleScope:e,clauses:t,matchOperator:r,moveMailboxId:s,until:o})=>({matchOperator:r==="all"?"And":"Or",literalClauses:t.map(a=>({field:a.field,value:a.value})),moveMailboxId:s,expiresAt:e==="until"?j(o??""):void 0}),F=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),G=new Set(["Complete","Failed"]),A=e=>e!==void 0&&G.has(e),V=1e3,Z=15e3,ee=e=>{const t=Math.max(0,e),r=V*2**t;return Math.min(r,Z)},te=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Se=e=>{const[t,r]=p.useState(),s=v({...T(),onSuccess:g=>r(g.organizeJobId)}),{mutate:o}=s,a=D({...R({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return A(I)?!1:ee(g.state.dataUpdateCount)}}),n=p.useCallback(g=>{e&&o({path:{accountId:e},body:k(g)})},[e,o]),c=p.useCallback(g=>{e&&o({path:{accountId:e},body:Y(g)})},[e,o]),{refetch:d}=a,l=p.useCallback(()=>{d()},[d]),i=a.data,f=s.isPending?void 0:i,m=f?.state??s.data?.state,b=A(f?.state),C={state:m,matchedCount:f?.matchedCount??0,appliedCount:f?.appliedCount??0,failedCount:f?.failedCount??0,errorMessage:f?.errorMessage??""};return{start:n,startForFilter:c,watch:r,refreshStatus:l,progress:C,isStarting:s.isPending,isRunning:!!t&&!b,isDone:b,failure:te(s.error,a.error,!!i)}},ye=["From","Subject","HasWords","ListId","FromDomain"],re=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},Oe=(e,t)=>e==="ListId"?re(t):t.trim(),se=e=>e==="all"?"And":"Or",ae=e=>({matchOperator:se(e.matchOperator),literalClauses:e.clauses.map(t=>({field:t.field,value:t.value}))}),ie=e=>!e.literalClauses.some(t=>t.field==="HasWords"),ne=e=>JSON.stringify({operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),Ne=e=>{const t=ae(e);return{matchOperator:t.matchOperator,literalClauses:t.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?j(e.until??""):void 0}},oe=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},le=350,Fe=(e,t,r)=>{const s=v($()),{mutateAsync:o}=s,a=ne(t),[n,c]=p.useState(()=>({})),d=p.useRef(t);d.current=t;const l=p.useRef(a),i=ie(t);return p.useEffect(()=>{if(!e||!i||a===n.previewedSignature||a===n.errorSignature)return;const f=setTimeout(()=>{const m=a;l.current=m,o({path:{accountId:e},body:k({...d.current})}).then(b=>{l.current===m&&c({count:b.matchedCount,matchedIds:b.messageIds,previewedSignature:m})}).catch(b=>{l.current===m&&c(C=>({...C,error:b instanceof Error?b.message:"Couldn't count matches.",errorSignature:m}))})},le);return()=>clearTimeout(f)},[e,i,a,n.previewedSignature,n.errorSignature,o]),i?{count:oe(n,a),matchedIds:n.previewedSignature===a?n.matchedIds??[]:[]}:{count:{status:"error",reason:_},matchedIds:[]}},y=e=>q({path:{accountId:e}}),Ae=e=>{const t=D({...J({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},Ee=e=>{const t=S(),r=v({...U(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s,mutateAsync:o}=r,a=p.useCallback((c,d,l)=>{e&&s({path:{accountId:e},body:F(c,d,l)})},[e,s]),n=p.useCallback(async(c,d,l)=>{if(e)return o({path:{accountId:e},body:F(c,d,l)}).then(i=>i,()=>{})},[e,o]);return{createFilter:a,createFilterAsync:n,data:r.data,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},Me=e=>{const t=S(),r=v({...B(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s}=r;return{deleteFilter:p.useCallback(a=>{e&&s({path:{accountId:e,filterId:a}})},[e,s]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}},De=e=>{const t=S(),r=v({...K(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s,variables:o}=r,a=p.useCallback((c,d)=>{e&&s({path:{accountId:e,filterId:c},body:{state:d?"Active":"Disabled"}})},[e,s]),n=p.useCallback(()=>{o&&s(o)},[s,o]);return{toggleFilter:a,retry:n,togglingFilterId:r.isPending?o?.path.filterId:void 0,isError:r.isError,error:r.error,enabling:o?.body?.state==="Active"}};export{fe as A,pe as C,h as N,ye as S,be as a,y as b,Se as c,Ne as d,he as e,ge as f,xe as g,Ae as h,Me as i,De as j,Ee as k,Ce as l,Oe as n,ve as o,j as p,ae as r,Fe as u};
1
+ import{j as u,eW as x,X as E,p as M,eX as z,eY as L,ar as w,B as O,r as p,f as v,eZ as T,a as D,e_ as R,e$ as $,f0 as _,f1 as J,e as S,f2 as U,f3 as q,f4 as B,bd as K}from"./index-C2US5ZnK.js";import{u as Q,S as H}from"./suggest-list-DJUWGfG3.js";import{S as W}from"./select-DhVwx5IO.js";import{P as X}from"./plus-DY_LOTJC.js";const P="inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs";function pe({clause:e,onEdit:t,onRemove:r}){return u.jsxs("span",{className:M(P,e.derived?"border-dashed border-line-strong bg-surface-sunken":"border-line bg-surface"),children:[u.jsxs("button",{type:"button",onClick:t,"aria-label":`Edit ${x(e.field)} clause`,className:"flex items-center gap-1 text-left",children:[u.jsx("span",{className:"font-medium text-fg-muted",children:x(e.field)}),u.jsx("span",{className:"text-fg",children:e.value})]}),e.derived&&u.jsx("span",{className:"text-2xs text-fg-subtle",children:"from sender"}),r&&u.jsx("button",{type:"button",onClick:r,"aria-label":`Remove ${x(e.field)} clause`,className:"flex size-4 items-center justify-center rounded-full text-fg-subtle hover:bg-surface-sunken hover:text-fg-muted",children:u.jsx(E,{className:"size-3"})})]})}function fe({label:e,onClick:t}){return u.jsxs("button",{type:"button",onClick:t,className:M(P,"border-dashed border-line-strong text-fg-muted hover:border-accent-2 hover:text-accent-2"),children:[u.jsx(X,{className:"size-3","aria-hidden":"true"}),e]})}function be({draft:e,mode:t,fields:r=L,suggestions:s=[],onChangeField:o,onChangeValue:a,onSubmit:n,onCancel:c}){const d=z(e.field),l=Q({count:s.length,onAccept:i=>a?.(s[i].value)});return u.jsxs("div",{className:"space-y-1.5 rounded-lg border border-accent-2 bg-surface p-2",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(W,{"aria-label":"Clause field",value:e.field,onChange:i=>o?.(i.target.value),className:"h-8 w-32 shrink-0",children:r.map(i=>u.jsx("option",{value:i,children:x(i)},i))}),u.jsx(w,{"aria-label":"Clause value",value:e.value,placeholder:"value…",autoComplete:"off",onChange:i=>{l.reopen(),a?.(i.target.value)},onKeyDown:i=>{l.handleKeyDown(i)||i.key==="Enter"&&n?.()},className:"h-8 min-w-40 flex-1",...l.comboboxProps}),u.jsx(O,{variant:"primary",size:"sm",onClick:n,disabled:e.value.trim()==="",className:"shrink-0",children:t==="add"?"Add":"Save"}),u.jsx(O,{variant:"ghost",size:"sm",onClick:c,"aria-label":"Cancel clause edit",icon:u.jsx(E,{className:"size-4"}),className:"shrink-0 px-2"})]}),l.open&&u.jsx(H,{id:l.listId,suggestions:s,activeIndex:l.activeIndex,optionId:l.optionId,onPick:i=>{a?.(i.value),l.dismiss()},onHighlight:l.setActiveIndex,label:`${x(e.field)} suggestions`}),d&&u.jsx("p",{className:"px-0.5 text-2xs text-fg-subtle",children:d})]})}const ge=(e,t)=>{if(e.state==="Expired")return"Expired";const r=e.state==="Disabled"?"Disabled":"Active";if(e.scope!=="Temporary"||!e.expiresAt)return r;const s=Date.parse(e.expiresAt);return Number.isNaN(s)?r:s<=t?"Expired":r},N={UserDisabled:"Turned off. Turn it on to run it on new mail again.",AwaitingFolder:"Off until its folder exists on the mail server. It turns on by itself once the folder is created.",FolderCreateFailed:"Off: the mail server refused to create its folder. Pick another folder in the rule, then turn it on.",FolderMissing:"Off: the folder it moves mail into no longer exists. Pick another folder in the rule, then turn it on."},he=e=>e.disabledReason==="None"?void 0:(e.disabledReason==="AwaitingFolder"||e.disabledReason==="FolderCreateFailed")&&e.actionMailboxId!=="None"?N.UserDisabled:N[e.disabledReason],xe=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},j=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,s,o,a]=r,n=new Date(Number(s),Number(o)-1,Number(a),23,59,59,0);if(Number.isNaN(n.getTime()))return;const c=-t.getTimezoneOffset(),d=c>=0?"+":"-",l=Math.abs(c),i=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),m=b=>String(b).padStart(2,"0");return`${n.getFullYear()}-${m(n.getMonth()+1)}-${m(n.getDate())}T${m(n.getHours())}:${m(n.getMinutes())}:${m(n.getSeconds())}${d}${i}:${f}`},h="None",Y=e=>({filterId:e,matchOperator:"And",literalClauses:[],actionLabelId:h,actionMailboxId:h}),k=e=>({matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),ve=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",Ce=({ruleScope:e,clauses:t,matchOperator:r,moveMailboxId:s,until:o})=>({matchOperator:r==="all"?"And":"Or",literalClauses:t.map(a=>({field:a.field,value:a.value})),moveMailboxId:s,expiresAt:e==="until"?j(o??""):void 0}),F=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),G=new Set(["Complete","Failed"]),A=e=>e!==void 0&&G.has(e),Z=1e3,V=15e3,ee=e=>{const t=Math.max(0,e),r=Z*2**t;return Math.min(r,V)},te=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Se=e=>{const[t,r]=p.useState(),s=v({...T(),onSuccess:g=>r(g.organizeJobId)}),{mutate:o}=s,a=D({...R({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return A(I)?!1:ee(g.state.dataUpdateCount)}}),n=p.useCallback(g=>{e&&o({path:{accountId:e},body:k(g)})},[e,o]),c=p.useCallback(g=>{e&&o({path:{accountId:e},body:Y(g)})},[e,o]),{refetch:d}=a,l=p.useCallback(()=>{d()},[d]),i=a.data,f=s.isPending?void 0:i,m=f?.state??s.data?.state,b=A(f?.state),C={state:m,matchedCount:f?.matchedCount??0,appliedCount:f?.appliedCount??0,failedCount:f?.failedCount??0,errorMessage:f?.errorMessage??""};return{start:n,startForFilter:c,watch:r,refreshStatus:l,progress:C,isStarting:s.isPending,isRunning:!!t&&!b,isDone:b,failure:te(s.error,a.error,!!i)}},ye=["From","Subject","HasWords","ListId","FromDomain"],re=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},Oe=(e,t)=>e==="ListId"?re(t):t.trim(),se=e=>e==="all"?"And":"Or",ae=e=>({matchOperator:se(e.matchOperator),literalClauses:e.clauses.map(t=>({field:t.field,value:t.value}))}),ie=e=>!e.literalClauses.some(t=>t.field==="HasWords"),ne=e=>JSON.stringify({operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),Ne=e=>{const t=ae(e);return{matchOperator:t.matchOperator,literalClauses:t.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?j(e.until??""):void 0}},oe=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},le=350,Fe=(e,t,r)=>{const s=v($()),{mutateAsync:o}=s,a=ne(t),[n,c]=p.useState(()=>({})),d=p.useRef(t);d.current=t;const l=p.useRef(a),i=ie(t);return p.useEffect(()=>{if(!e||!i||a===n.previewedSignature||a===n.errorSignature)return;const f=setTimeout(()=>{const m=a;l.current=m,o({path:{accountId:e},body:k({...d.current})}).then(b=>{l.current===m&&c({count:b.matchedCount,matchedIds:b.messageIds,previewedSignature:m})}).catch(b=>{l.current===m&&c(C=>({...C,error:b instanceof Error?b.message:"Couldn't count matches.",errorSignature:m}))})},le);return()=>clearTimeout(f)},[e,i,a,n.previewedSignature,n.errorSignature,o]),i?{count:oe(n,a),matchedIds:n.previewedSignature===a?n.matchedIds??[]:[]}:{count:{status:"error",reason:_},matchedIds:[]}},y=e=>q({path:{accountId:e}}),Ae=e=>{const t=D({...J({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},Ee=e=>{const t=S(),r=v({...U(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s,mutateAsync:o}=r,a=p.useCallback((c,d,l)=>{e&&s({path:{accountId:e},body:F(c,d,l)})},[e,s]),n=p.useCallback(async(c,d,l)=>{if(e)return o({path:{accountId:e},body:F(c,d,l)}).then(i=>i,()=>{})},[e,o]);return{createFilter:a,createFilterAsync:n,data:r.data,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},Me=e=>{const t=S(),r=v({...B(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s}=r;return{deleteFilter:p.useCallback(a=>{e&&s({path:{accountId:e,filterId:a}})},[e,s]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}},De=e=>{const t=S(),r=v({...K(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:y(e)})}}),{mutate:s,variables:o}=r,a=p.useCallback((c,d)=>{e&&s({path:{accountId:e,filterId:c},body:{state:d?"Active":"Disabled"}})},[e,s]),n=p.useCallback(()=>{o&&s(o)},[s,o]);return{toggleFilter:a,retry:n,togglingFilterId:r.isPending?o?.path.filterId:void 0,isError:r.isError,error:r.error,enabling:o?.body?.state==="Active"}};export{fe as A,pe as C,h as N,ye as S,be as a,y as b,Se as c,Ne as d,he as e,ge as f,xe as g,Ae as h,Me as i,De as j,Ee as k,Ce as l,Oe as n,ve as o,j as p,ae as r,Fe as u};
@@ -1 +1 @@
1
- import{cY as g,dc as d,dd as v,de as x}from"./index-fsuIswbe.js";var p=class extends g{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:c,isRefetching:f,isError:a,isRefetchError:P}=i,r=s.fetchMeta?.fetchMore?.direction,h=a&&r==="forward",n=c&&r==="forward",o=a&&r==="backward",u=c&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,s.data),hasPreviousPage:d(t,s.data),isFetchNextPageError:h,isFetchingNextPage:n,isFetchPreviousPageError:o,isFetchingPreviousPage:u,isRefetchError:P&&!h&&!o,isRefetching:f&&!n&&!u}}};function N(e,t){return x(e,p)}export{N as u};
1
+ import{cY as g,dc as d,dd as v,de as x}from"./index-C2US5ZnK.js";var p=class extends g{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:s}=e,i=super.createResult(e,t),{isFetching:c,isRefetching:f,isError:a,isRefetchError:P}=i,r=s.fetchMeta?.fetchMore?.direction,h=a&&r==="forward",n=c&&r==="forward",o=a&&r==="backward",u=c&&r==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,s.data),hasPreviousPage:d(t,s.data),isFetchNextPageError:h,isFetchingNextPage:n,isFetchPreviousPageError:o,isFetchingPreviousPage:u,isRefetchError:P&&!h&&!o,isRefetching:f&&!n&&!u}}};function N(e,t){return x(e,p)}export{N as u};
@@ -1 +1 @@
1
- import{a,c as n,r}from"./index-fsuIswbe.js";const c=new Set,u=()=>{const{data:s}=a({...n(),staleTime:1/0});return r.useMemo(()=>{const e=(s?.accounts??[]).flatMap(o=>o.folderAppointments.flatMap(t=>t.role==="Junk"&&t.mailboxId?[t.mailboxId]:[]));return e.length===0?c:new Set(e)},[s?.accounts])};export{u};
1
+ import{a,c as n,r}from"./index-C2US5ZnK.js";const c=new Set,u=()=>{const{data:s}=a({...n(),staleTime:1/0});return r.useMemo(()=>{const e=(s?.accounts??[]).flatMap(o=>o.folderAppointments.flatMap(t=>t.role==="Junk"&&t.mailboxId?[t.mailboxId]:[]));return e.length===0?c:new Set(e)},[s?.accounts])};export{u};
@@ -0,0 +1 @@
1
+ import{a as g,d7 as d,e as o,f as u,d8 as p,r as b,d9 as y,da as L,db as c}from"./index-C2US5ZnK.js";import{l as f}from"./list-pages-BCUbyyea.js";const P={Default:"bg-fg-subtle",Red:"bg-red-500",Orange:"bg-orange-500",Yellow:"bg-yellow-500",Green:"bg-green-500",Teal:"bg-teal-500",Blue:"bg-blue-500",Purple:"bg-purple-500",Gray:"bg-gray-500"},q=["Default","Red","Orange","Yellow","Green","Teal","Blue","Purple","Gray"],w=e=>Object.hasOwn(P,e),n=e=>d({path:{accountId:e}}),h=async e=>{const a=[],s=f(async r=>{const{data:l}=await c({path:{accountId:e},query:{continuationToken:r},throwOnError:!0});return l});for await(const r of s)a.push(...r);return a},m=[],D=e=>{const a=g({queryKey:n(e??""),queryFn:()=>h(e??""),enabled:!!e});return{labels:a.data??m,isSuccess:a.isSuccess,isPending:a.isPending,isError:a.isError,error:a.error,refetch:a.refetch}},E=e=>{const a=o(),s=u({...p(),onSuccess:()=>{e&&a.invalidateQueries({queryKey:n(e)})}}),{mutateAsync:r}=s;return{createLabel:b.useCallback((t,i="Default")=>e?r({path:{accountId:e},body:{name:t,color:i}}):Promise.reject(new Error("No account")),[e,r]),isPending:s.isPending,isError:s.isError,error:s.error,reset:s.reset}},v=e=>{const a=o(),s=u({...y(),onSuccess:()=>{e&&a.invalidateQueries({queryKey:n(e)})}}),{mutate:r}=s;return{updateLabel:b.useCallback((t,i)=>{e&&r({path:{accountId:e,labelId:t},body:i})},[e,r]),isPending:s.isPending,updatingLabelId:s.isPending?s.variables?.path.labelId:void 0}},K=e=>{const a=o(),s=u({...L(),onSuccess:()=>{e&&a.invalidateQueries({queryKey:n(e)})}}),{mutate:r}=s;return{deleteLabel:b.useCallback(t=>{e&&r({path:{accountId:e,labelId:t}})},[e,r]),isPending:s.isPending,deletingLabelId:s.isPending?s.variables?.path.labelId:void 0}};export{E as a,q as b,v as c,K as d,w as i,P as l,D as u};
@@ -1 +1 @@
1
- import{a as s,D as e}from"./useMediaQuery-Hy81MQ2M.js";const i=768,a=t=>t!=="desktop",r=()=>{const t=s(`(min-width: ${i}px)`);return s(e)?"desktop":t?"tablet":"phone"};export{a as i,r as u};
1
+ import{a as s,D as e}from"./useMediaQuery-BaUDTtu8.js";const i=768,a=t=>t!=="desktop",r=()=>{const t=s(`(min-width: ${i}px)`);return s(e)?"desktop":t?"tablet":"phone"};export{a as i,r as u};
@@ -1 +1 @@
1
- import{r as s}from"./index-fsuIswbe.js";const r=1024,c=`(min-width: ${r}px) and (not ((orientation: portrait) and (pointer: coarse)))`,d=e=>{const[o,n]=s.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return s.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=i=>n(i.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o},m=()=>d(c);export{c as D,d as a,m as u};
1
+ import{r as s}from"./index-C2US5ZnK.js";const r=1024,c=`(min-width: ${r}px) and (not ((orientation: portrait) and (pointer: coarse)))`,d=e=>{const[o,n]=s.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return s.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=i=>n(i.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o},m=()=>d(c);export{c as D,d as a,m as u};
@@ -1,3 +1,3 @@
1
- import{r as V,u as _o,cw as Eo,K as De,l as yo,aa as Ao,e as bo,a as So,cT as Ro,cG as Oo}from"./index-fsuIswbe.js";import{d as wo,e as Do}from"./reply-CXuSMyqp.js";import{c as Lo}from"./nav-link-ed0mFCCx.js";function fn(n,o){(o==null||o>n.length)&&(o=n.length);for(var a=0,l=Array(o);a<o;a++)l[a]=n[a];return l}function Co(n){if(Array.isArray(n))return n}function No(n,o){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var l,c,m,h,F=[],A=!0,G=!1;try{if(m=(a=a.call(n)).next,o!==0)for(;!(A=(l=m.call(a)).done)&&(F.push(l.value),F.length!==o);A=!0);}catch(W){G=!0,c=W}finally{try{if(!A&&a.return!=null&&(h=a.return(),Object(h)!==h))return}finally{if(G)throw c}}return F}}function Io(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as V,u as _o,cw as Eo,K as De,l as yo,aa as Ao,e as bo,a as So,cT as Ro,cG as Oo}from"./index-C2US5ZnK.js";import{d as wo,e as Do}from"./reply-CijQsg4o.js";import{c as Lo}from"./nav-link-Df_MDzvJ.js";function fn(n,o){(o==null||o>n.length)&&(o=n.length);for(var a=0,l=Array(o);a<o;a++)l[a]=n[a];return l}function Co(n){if(Array.isArray(n))return n}function No(n,o){var a=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(a!=null){var l,c,m,h,F=[],A=!0,G=!1;try{if(m=(a=a.call(n)).next,o!==0)for(;!(A=(l=m.call(a)).done)&&(F.push(l.value),F.length!==o);A=!0);}catch(W){G=!0,c=W}finally{try{if(!A&&a.return!=null&&(h=a.return(),Object(h)!==h))return}finally{if(G)throw c}}return F}}function Io(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mo(n,o){return Co(n)||No(n,o)||Po(n,o)||Io()}function Po(n,o){if(n){if(typeof n=="string")return fn(n,o);var a={}.toString.call(n).slice(8,-1);return a==="Object"&&n.constructor&&(a=n.constructor.name),a==="Map"||a==="Set"?Array.from(n):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?fn(n,o):void 0}}const wn=Object.entries,pn=Object.setPrototypeOf,xo=Object.isFrozen,Dn=Object.getPrototypeOf,Ln=Object.getOwnPropertyDescriptor;let O=Object.freeze,D=Object.seal,Te=Object.create,Cn=typeof Reflect<"u"&&Reflect,Dt=Cn.apply,Lt=Cn.construct;O||(O=function(o){return o});D||(D=function(o){return o});Dt||(Dt=function(o,a){for(var l=arguments.length,c=new Array(l>2?l-2:0),m=2;m<l;m++)c[m-2]=arguments[m];return o.apply(a,c)});Lt||(Lt=function(o){for(var a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];return new o(...l)});const $=E(Array.prototype.forEach),vo=E(Array.prototype.lastIndexOf),mn=E(Array.prototype.pop),Le=E(Array.prototype.push),ko=E(Array.prototype.slice),Uo=E(Array.prototype.splice),_e=Array.isArray,_t=Nn(Set),Et=E(Set.prototype.add),Ce=E(Set.prototype.has),se=E(String.prototype.toLowerCase),yt=E(String.prototype.toString),dn=E(String.prototype.match),Ne=E(String.prototype.replace),hn=E(String.prototype.indexOf),Fo=E(String.prototype.trim),zo=E(Number.prototype.toString),Ho=E(Boolean.prototype.toString),Tn=typeof BigInt>"u"?null:E(BigInt.prototype.toString),gn=typeof Symbol>"u"?null:E(Symbol.prototype.toString),P=E(Object.prototype.hasOwnProperty),Ie=E(Object.prototype.toString),w=E(RegExp.prototype.test),j=Nn(TypeError);function E(n){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];return Dt(n,o,l)}}function Nn(n){return function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return Lt(n,a)}}function d(n,o){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:se;if(pn&&pn(n,null),!_e(o))return n;let l=o.length;for(;l--;){let c=o[l];if(typeof c=="string"){const m=a(c);m!==c&&(xo(o)||(o[l]=m),c=m)}n[c]=!0}return n}function Bo(n){for(let o=0;o<n.length;o++)P(n,o)||(n[o]=null);return n}function x(n){const o=Te(null);for(const l of wn(n)){var a=Mo(l,2);const c=a[0],m=a[1];P(n,c)&&(_e(m)?o[c]=Bo(m):m&&typeof m=="object"&&m.constructor===Object?o[c]=x(m):o[c]=m)}return o}function Go(n){switch(typeof n){case"string":return n;case"number":return zo(n);case"boolean":return Ho(n);case"bigint":return Tn?Tn(n):"0";case"symbol":return gn?gn(n):"Symbol()";case"undefined":return Ie(n);case"function":case"object":{if(n===null)return Ie(n);const o=n,a=k(o,"toString");if(typeof a=="function"){const l=a(o);return typeof l=="string"?l:Ie(l)}return Ie(n)}default:return Ie(n)}}function k(n,o){for(;n!==null;){const l=Ln(n,o);if(l){if(l.get)return E(l.get);if(typeof l.value=="function")return E(l.value)}n=Dn(n)}function a(){return null}return a}function Wo(n,o){for(;n!==null;){const a=Ln(n,o);if(a)return a.get?E(a.get):null;n=Dn(n)}return null}function Yo(n){try{return w(n,""),!0}catch{return!1}}const _n=O(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),At=O(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bt=O(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),$o=O(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),St=O(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),jo=O(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),En=O(["#text"]),yn=O(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Rt=O(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),An=O(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ye=O(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Vo=D(/{{[\w\W]*|^[\w\W]*}}/g),Xo=D(/<%[\w\W]*|^[\w\W]*%>/g),Ko=D(/\${[\w\W]*/g),qo=D(/^data-[\-\w.\u00B7-\uFFFF]+$/),Qo=D(/^aria-[\-\w]+$/),bn=D(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zo=D(/^(?:\w+script|data):/i),Jo=D(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),er=D(/^html$/i),tr=D(/^[a-z][.\w]*(-[.\w]+)+$/i),Ot=D(/<[/\w!]/g),Sn=D(/<[/\w]/g),nr=D(/<\/no(script|embed|frames)/i),Rn=D(/\/>/i),b={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},or=O(d({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),rr=function(){return typeof window>"u"?null:window},ir=function(o,a){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let l=null;const c="data-tt-policy-suffix";a&&a.hasAttribute(c)&&(l=a.getAttribute(c));const m="dompurify"+(l?"#"+l:"");try{return o.createPolicy(m,{createHTML(h){return h},createScriptURL(h){return h}})}catch{return console.warn("TrustedTypes policy "+m+" could not be created."),null}},On=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Z=function(o,a,l,c){return P(o,a)&&_e(o[a])?d(c.base?x(c.base):{},o[a],c.transform):l},wt=function(o,a,l){const c=P(o,a)?o[a]:void 0;return c&&typeof c=="object"?x(c):l()};function In(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rr();const o=s=>In(s);if(o.version="3.4.17",o.removed=[],!n||!n.document||n.document.nodeType!==b.document||!n.Element)return o.isSupported=!1,o;let a=n.document;const l=a,c=l.currentScript;n.DocumentFragment;const m=n.HTMLTemplateElement,h=n.Node,F=n.Element,A=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const G=n.DOMParser,W=n.trustedTypes,R=F.prototype,Ee=k(R,"cloneNode"),ye=k(R,"remove"),Me=k(R,"removeAttributeNode"),J=k(R,"nextSibling"),C=k(R,"childNodes"),X=k(R,"parentNode"),$e=k(R,"shadowRoot"),je=k(R,"attributes"),ee=h&&h.prototype?k(h.prototype,"nodeType"):null,ae=h&&h.prototype?k(h.prototype,"nodeName"):null,Pe=h&&h.prototype?k(h.prototype,"ownerDocument"):null,v=function(e){return ee?ee(e):e.nodeType},Ae=function(e){return ae?ae(e):e.nodeName},It=Wo(R,"namespaceURI"),Ve=function(e){return It?It(e):e.namespaceURI};if(typeof m=="function"){const s=a.createElement("template");s.content&&s.content.ownerDocument&&(a=s.content.ownerDocument)}let N,te="",Xe,Mt=!1,be=0;const Pt=function(){if(be>0)throw j('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},le=function(e){Pt(),be++;try{return N.createHTML(e)}finally{be--}},zn=function(e){Pt(),be++;try{return N.createScriptURL(e)}finally{be--}},Hn=function(){return Mt||(Xe=ir(W,c),Mt=!0),Xe},xe=a,Ke=xe.implementation,xt=xe.createNodeIterator,Bn=xe.createDocumentFragment,Gn=xe.getElementsByTagName,Wn=l.importNode;let T=On();o.isSupported=typeof wn=="function"&&typeof X=="function"&&Ke&&Ke.createHTMLDocument!==void 0;const Yn=Vo,$n=Xo,jn=Ko,Vn=qo,Xn=Qo,Kn=Zo,vt=Jo,qn=tr;let kt=bn,g=null;const qe=d({},[..._n,...At,...bt,...St,...En]);let _=null;const Qe=d({},[...yn,...Rt,...An,...Ye]);let z=Object.seal(Te(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Se=null,Ut=null;const K=Object.seal(Te(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ft=!0,Ze=!0,zt=!1,Je=!0,Y=!1,ne=!0,oe=!1,et=!1,ve=null,ke=null,tt=!1,ce=!1,Ue=!1,Fe=!1,Ht=!0,Bt=!1;const Gt="user-content-";let nt=!0,ot=!1,re=null,ue={},ie=null;const Wt=d({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Yt=null;const $t=d({},["audio","video","img","source","image","track"]);let jt=null;const Vt=d({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ze="http://www.w3.org/1998/Math/MathML",He="http://www.w3.org/2000/svg",H="http://www.w3.org/1999/xhtml";let fe=H,rt=!1,it=null;const Qn=d({},[ze,He,H],yt),Xt=O(["mi","mo","mn","ms","mtext"]);let st=d({},Xt);const Kt=O(["annotation-xml"]);let at=d({},Kt);const Zn=d({},["title","style","font","a","script"]);let Re=null;const Jn=["application/xhtml+xml","text/html"],eo="text/html";let y=null,pe=null;const to=a.createElement("form"),qt=function(e){return e instanceof RegExp||e instanceof Function},lt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(pe&&pe===e)return;(!e||typeof e!="object")&&(e={}),e=x(e),Re=Jn.indexOf(e.PARSER_MEDIA_TYPE)===-1?eo:e.PARSER_MEDIA_TYPE,y=Re==="application/xhtml+xml"?yt:se,g=Z(e,"ALLOWED_TAGS",qe,{transform:y}),_=Z(e,"ALLOWED_ATTR",Qe,{transform:y}),it=Z(e,"ALLOWED_NAMESPACES",Qn,{transform:yt}),jt=Z(e,"ADD_URI_SAFE_ATTR",Vt,{transform:y,base:Vt}),Yt=Z(e,"ADD_DATA_URI_TAGS",$t,{transform:y,base:$t}),ie=Z(e,"FORBID_CONTENTS",Wt,{transform:y}),Se=Z(e,"FORBID_TAGS",x({}),{transform:y}),Ut=Z(e,"FORBID_ATTR",x({}),{transform:y}),ue=P(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?x(e.USE_PROFILES):e.USE_PROFILES:!1,Ft=e.ALLOW_ARIA_ATTR!==!1,Ze=e.ALLOW_DATA_ATTR!==!1,zt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Je=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=e.SAFE_FOR_TEMPLATES||!1,ne=e.SAFE_FOR_XML!==!1,oe=e.WHOLE_DOCUMENT||!1,ce=e.RETURN_DOM||!1,Ue=e.RETURN_DOM_FRAGMENT||!1,Fe=e.RETURN_TRUSTED_TYPE||!1,tt=e.FORCE_BODY||!1,Ht=e.SANITIZE_DOM!==!1,Bt=e.SANITIZE_NAMED_PROPS||!1,nt=e.KEEP_CONTENT!==!1,ot=e.IN_PLACE||!1,kt=Yo(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:bn,fe=typeof e.NAMESPACE=="string"?e.NAMESPACE:H,st=wt(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>d({},Xt)),at=wt(e,"HTML_INTEGRATION_POINTS",()=>d({},Kt));const t=wt(e,"CUSTOM_ELEMENT_HANDLING",()=>Te(null));if(z=Te(null),P(t,"tagNameCheck")&&qt(t.tagNameCheck)&&(z.tagNameCheck=t.tagNameCheck),P(t,"attributeNameCheck")&&qt(t.attributeNameCheck)&&(z.attributeNameCheck=t.attributeNameCheck),P(t,"allowCustomizedBuiltInElements")&&typeof t.allowCustomizedBuiltInElements=="boolean"&&(z.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),D(z),Y&&(Ze=!1),Ue&&(ce=!0),ue&&(g=d({},En),_=Te(null),ue.html===!0&&(d(g,_n),d(_,yn)),ue.svg===!0&&(d(g,At),d(_,Rt),d(_,Ye)),ue.svgFilters===!0&&(d(g,bt),d(_,Rt),d(_,Ye)),ue.mathMl===!0&&(d(g,St),d(_,An),d(_,Ye))),K.tagCheck=null,K.attributeCheck=null,P(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?K.tagCheck=e.ADD_TAGS:_e(e.ADD_TAGS)&&(g===qe&&(g=x(g)),d(g,e.ADD_TAGS,y))),P(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?K.attributeCheck=e.ADD_ATTR:_e(e.ADD_ATTR)&&(_===Qe&&(_=x(_)),d(_,e.ADD_ATTR,y))),P(e,"ADD_FORBID_CONTENTS")&&_e(e.ADD_FORBID_CONTENTS)&&(ie===Wt&&(ie=x(ie)),d(ie,e.ADD_FORBID_CONTENTS,y)),nt&&(g["#text"]=!0),oe&&d(g,["html","head","body"]),g.table&&(d(g,["tbody"]),delete Se.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw j('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw j('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const r=N;N=e.TRUSTED_TYPES_POLICY;try{te=le("")}catch(i){throw N=r,i}}else e.TRUSTED_TYPES_POLICY===null?(N=void 0,te=""):(N===void 0&&(N=Hn()),N&&typeof te=="string"&&(te=le("")));O&&O(e),pe=e},Qt=d({},[...At,...bt,...$o]),Zt=d({},[...St,...jo]),no=function(e,t,r){return t.namespaceURI===H?e==="svg":t.namespaceURI===ze?e==="svg"&&(r==="annotation-xml"||st[r]):!!Qt[e]},oo=function(e,t,r){return t.namespaceURI===H?e==="math":t.namespaceURI===He?e==="math"&&at[r]:!!Zt[e]},ro=function(e,t,r){return t.namespaceURI===He&&!at[r]||t.namespaceURI===ze&&!st[r]?!1:!Zt[e]&&(Zn[e]||!Qt[e])},io=function(e){const t=Ve(e),r=se(Ae(e)),i=X(e);let u,f;return i&&v(i)===b.element?(u={namespaceURI:Ve(i)},f=se(Ae(i))):(u={namespaceURI:fe},f="template"),it[t]?t===He?no(r,u,f):t===ze?oo(r,u,f):t===H?ro(r,u,f):!!(Re==="application/xhtml+xml"&&it[t]):!1},q=function(e){Le(o.removed,{element:e});try{X(e).removeChild(e)}catch{if(ye(e),!X(e))throw j("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Jt=function(e,t,r){try{Me(e,t)}catch{try{e.removeAttribute(r)}catch{}}},ct=function(e){ft(e);const t=C(e);t&&$(ko(t),i=>{try{ye(i)}catch{}});const r=v(e)===b.element?je(e):null;if(r)for(let i=r.length-1;i>=0;--i){const u=r[i],f=u&&u.name;typeof f=="string"&&Jt(e,u,f)}},me=function(e,t,r){if(!r)try{r=t.getAttributeNode(e)}catch{r=null}Le(o.removed,{attribute:r||null,from:t});try{r?Me(t,r):t.removeAttribute(e)}catch{try{t.removeAttribute(e)}catch{}}if(e==="is")if(ce||Ue)try{q(t)}catch{}else try{t.setAttribute(e,"")}catch{}},en=function(e){const t=je(e);if(t)for(let r=t.length-1;r>=0;--r){const i=t[r],u=i&&i.name;typeof u!="string"||_[y(u)]||Jt(e,i,u)}},ut=function(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const i=[e];for(;i.length>0;){const u=i.pop();if(t(u)===!1)continue;if(r&&v(u)===b.element){const p=$e(u);Q(p)&&i.push(p)}const f=C(u);if(f)for(let p=f.length-1;p>=0;--p)i.push(f[p])}},ft=function(e){ut(e,t=>{v(t)===b.element&&en(t)})},pt=function(e){const t=[];return ut(e,r=>{t.push(r)},!0),t},so=function(e,t){const r=_t();$(pt(e),i=>{v(i)===b.element&&Et(r,i)}),$(t,i=>{v(i)===b.element&&!Ce(r,i)&&en(i)})},tn=function(e,t){let r=!1;return $(o.removed,i=>{i.element&&(r=r||i.element===e,ft(i.element))}),so(e,t),r},ao=8,lo=function(e,t){const r=re;let i=null;const u=()=>(i||(i=_t(),$(t,f=>{Et(i,f)})),i);for(let f=0;;f++){const p=pt(e),S=[e];let B=!1;if($(p,L=>{v(L)===b.documentFragment?Le(S,L):!B&&!Ce(r,L)&&(B=Ce(u(),L))}),!B)return;if(f>=ao)throw j("the tree kept changing during in-place sanitization; refusing to return it");$(S,(L,I)=>{co(L,I>0,e,u())})}},co=function(e,t,r,i){const u=mt(e);let f;for(;f=u.nextNode();)!Ce(i,f)||Ce(re,f)||(t&&U(T.uponSanitizeShadowNode,f,null),ht(f,r),Tt(f,r),Q(f.content)&&we(f.content))},uo=function(e){re&&Et(re,e)},nn=function(e,t){return ne?e==="patchsrc"?!0:e==="for"&&t!=="label"&&t!=="output":!1},fo=function(e){ne&&ut(e,t=>{const r=v(t);if(r===b.processingInstruction||r===b.comment&&w(Sn,t.data)){try{ye(t)}catch{}return!1}if(r===b.element){const i=t,u=y(Ae(t));try{i.hasAttribute&&i.hasAttribute("patchsrc")&&i.removeAttribute("patchsrc"),i.hasAttribute&&i.hasAttribute("for")&&nn("for",u)&&i.removeAttribute("for")}catch{}}return!0})},on=function(e){let t=null,r=null;if(tt)e="<remove></remove>"+e;else{const f=dn(e,/^[\r\n\t ]+/);r=f&&f[0]}Re==="application/xhtml+xml"&&fe===H&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=N?le(e):e;if(fe===H)try{t=new G().parseFromString(i,Re)}catch{}if(!t||!t.documentElement){t=Ke.createDocument(fe,"template",null);try{t.documentElement.innerHTML=rt?te:i}catch{}}const u=t.body||t.documentElement;return e&&r&&u.insertBefore(a.createTextNode(r),u.childNodes[0]||null),fe===H?Gn.call(t,oe?"html":"body")[0]:oe?t.documentElement:u},mt=function(e){const t=Pe?Pe(e):e.ownerDocument;return xt.call(t||e,e,A.SHOW_ELEMENT|A.SHOW_COMMENT|A.SHOW_TEXT|A.SHOW_PROCESSING_INSTRUCTION|A.SHOW_CDATA_SECTION,null)},Be=function(e){return e=Ne(e,Yn," "),e=Ne(e,$n," "),e=Ne(e,jn," "),e},dt=function(e){var t;rn(e);const r=(t=e.querySelectorAll)===null||t===void 0?void 0:t.call(e,"template");r&&$(r,i=>{Q(i.content)&&dt(i.content)})},rn=function(e){e.normalize();const t=Pe?Pe(e):e.ownerDocument,r=xt.call(t||e,e,A.SHOW_TEXT|A.SHOW_COMMENT|A.SHOW_CDATA_SECTION|A.SHOW_PROCESSING_INSTRUCTION,null);let i=r.nextNode();for(;i;)i.data=Be(i.data),i=r.nextNode()},Ge=function(e){const t=ae?ae(e):null;return typeof t!="string"||y(t)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==je(e)||typeof e.removeAttribute!="function"||typeof e.removeAttributeNode!="function"||typeof e.getAttributeNode!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==ee(e)||e.childNodes!==C(e)},Q=function(e){if(!ee||typeof e!="object"||e===null)return!1;try{return ee(e)===b.documentFragment}catch{return!1}},Oe=function(e){if(!ee||typeof e!="object"||e===null)return!1;try{return typeof ee(e)=="number"}catch{return!1}};function U(s,e,t){s.length!==0&&$(s,r=>{r.call(o,e,t,pe)})}const po=function(e,t){return!!(ne&&e.hasChildNodes()&&!Oe(e.firstElementChild)&&w(Ot,e.textContent)&&w(Ot,e.innerHTML)||ne&&or[t]&&v(e)===b.element&&Ve(e)===H&&(Oe(e.firstElementChild)||typeof e.textContent=="string"&&w(Ot,e.textContent))||e.nodeType===b.processingInstruction||ne&&e.nodeType===b.comment&&w(Sn,e.data))},We=function(e,t){if(e instanceof RegExp)return w(e,t);if(e instanceof Function){for(var r=arguments.length,i=new Array(r>2?r-2:0),u=2;u<r;u++)i[u-2]=arguments[u];return!!e(t,...i)}return!1},mo=function(e,t,r){if(!Se[t]&&ln(t)&&We(z.tagNameCheck,t))return!1;if(nt&&!ie[t]&&!ie[se(t)]){const i=X(e),u=C(e);if(u&&i){const f=u.length;for(let p=f-1;p>=0;--p){const S=e===r?Ee(u[p],!0):u[p];i.insertBefore(S,J(e))}}}return q(e),!0},sn=function(e,t,r,i){return e.length===0?t:t===r||t===i?x(t):t},de=function(e,t){return e===t||X(e)!==null?!1:(ot&&ft(e),!0)},ht=function(e,t){if(uo(e),U(T.beforeSanitizeElements,e,null),de(e,t))return!0;if(Ge(e))return q(e),!0;const r=y(Ae(e));if(g=sn(T.uponSanitizeElement,g,qe,ve),U(T.uponSanitizeElement,e,{tagName:r,allowedTags:g}),de(e,t))return!0;if(po(e,r))return q(e),!0;if(Se[r]||!(K.tagCheck instanceof Function&&K.tagCheck(r))&&!g[r]){const i=mo(e,r,t);return i===!1&&(U(T.afterSanitizeElements,e,null),de(e,t))?!0:i}if(v(e)===b.element&&!io(e)||(r==="noscript"||r==="noembed"||r==="noframes")&&w(nr,e.innerHTML))return q(e),!0;if(Y&&e.nodeType===b.text){const i=Be(e.textContent);e.textContent!==i&&(Le(o.removed,{element:e.cloneNode()}),e.textContent=i)}return U(T.afterSanitizeElements,e,null),de(e,t)},an=function(e,t,r){if(Ut[t]||nn(t,e)||Ht&&(t==="id"||t==="name")&&(r in a||r in to))return!1;const i=_[t]||K.attributeCheck instanceof Function&&K.attributeCheck(t,e);return Ze&&w(Vn,t)||Ft&&w(Xn,t)?!0:i?jt[t]||w(kt,Ne(r,vt,""))||(t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&hn(r,"data:")===0&&Yt[e]||zt&&!w(Kn,Ne(r,vt,""))?!0:!r:ln(e)&&We(z.tagNameCheck,e)&&We(z.attributeNameCheck,t,e)||t==="is"&&z.allowCustomizedBuiltInElements&&We(z.tagNameCheck,r)},ho=d({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ln=function(e){return!ho[se(e)]&&w(qn,e)},To=function(e,t,r,i){if(N&&typeof W=="object"&&typeof W.getAttributeType=="function"&&!r)switch(W.getAttributeType(e,t)){case"TrustedHTML":return le(i);case"TrustedScriptURL":return zn(i)}return i},go=function(e,t,r,i){try{return r?e.setAttributeNS(r,t,i):e.setAttribute(t,i),Ge(e)?(q(e),!1):!0}catch{return me(t,e),!1}},cn=function(e,t){return ne&&w(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:se(e)==="attributename"&&dn(t,"href")!==null},Tt=function(e,t){if(U(T.beforeSanitizeAttributes,e,null),de(e,t))return;const r=e.attributes;if(!r||Ge(e))return;_=sn(T.uponSanitizeAttribute,_,Qe,ke);const i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_,forceKeepAttr:void 0};let u=r.length;const f=y(e.nodeName);for(;u--;){const p=r[u],S=p.name,B=p.namespaceURI,L=p.value,I=y(S),he=L;let M=S==="value"?he:Fo(he),un=!1;if(i.attrName=I,i.attrValue=M,i.keepAttr=!0,i.forceKeepAttr=void 0,U(T.uponSanitizeAttribute,e,i),M=i.attrValue,Bt&&(I==="id"||I==="name")&&hn(M,Gt)!==0&&(me(S,e,p),M=Gt+M,un=!0),cn(S,M)){me(S,e,p);continue}if(!i.forceKeepAttr){if(!i.keepAttr){me(S,e,p);continue}if(!Je&&w(Rn,M)){me(S,e,p);continue}if(Y&&(M=Be(M)),!an(f,I,M)){me(S,e,p);continue}M=To(f,I,B,M),M!==he&&go(e,S,B,M)&&un&&mn(o.removed)}}U(T.afterSanitizeAttributes,e,null),de(e,t)},we=function(e){let t=null;const r=mt(e);for(U(T.beforeSanitizeShadowDOM,e,null);t=r.nextNode();)if(U(T.uponSanitizeShadowNode,t,null),ht(t,e),Tt(t,e),Q(t.content)&&we(t.content),v(t)===b.element){const i=$e(t);Q(i)&&(gt(i),we(i))}Y&&rn(e),U(T.afterSanitizeShadowDOM,e,null)},gt=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const r=t.pop();if(r.shadow){we(r.shadow);continue}const i=r.node,u=v(i)===b.element,f=C(i);if(f)for(let p=f.length-1;p>=0;--p)t.push({node:f[p],shadow:null});if(u){const p=ae?ae(i):null;if(typeof p=="string"&&y(p)==="template"){const S=i.content;Q(S)&&t.push({node:S,shadow:null})}}if(u){const p=$e(i);Q(p)&&t.push({node:null,shadow:p},{node:p,shadow:null})}}};return o.sanitize=function(s){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,r=null,i=null,u=null;if(rt=!s,rt&&(s="<!-->"),typeof s!="string"&&!Oe(s)&&(s=Go(s),typeof s!="string"))throw j("dirty is not a string, aborting");if(!o.isSupported)return s;et?(g=ve,_=ke):lt(e),(T.uponSanitizeElement.length>0||T.uponSanitizeAttribute.length>0)&&(g=x(g)),T.uponSanitizeAttribute.length>0&&(_=x(_)),o.removed=[];const f=ot&&typeof s!="string"&&Oe(s);let p=[];const S=re;if(f){fo(s);const I=Ae(s);if(typeof I=="string"){const he=y(I);if(!g[he]||Se[he])throw ct(s),j("root node is forbidden and cannot be sanitized in-place")}if(Ge(s))throw ct(s),j("root node is clobbered and cannot be sanitized in-place");p=pt(s),re=_t()}else if(Oe(s))t=on("<!---->"),r=t.ownerDocument.importNode(s,!0),r.nodeType===b.element&&r.nodeName==="BODY"||r.nodeName==="HTML"?t=r:t.appendChild(r),gt(t);else{if(!ce&&!Y&&!oe&&s.indexOf("<")===-1)return N&&Fe?le(s):s;if(t=on(s),!t)return ce?null:Fe?te:""}t&&tt&&q(t.firstChild);const B=f?s:t;try{f&&gt(s);const I=mt(B);for(;i=I.nextNode();)ht(i,B),Tt(i,B),Q(i.content)&&we(i.content);f&&lo(s,p)}catch(I){throw f&&(ct(s),tn(s,p)),I}finally{re=S}if(f){if(tn(s,p))throw j("a node selected for removal could not be safely returned; refusing to sanitize in place");return Y&&dt(s),s}if(ce){if(Y&&dt(t),Ue)for(u=Bn.call(t.ownerDocument);t.firstChild;)u.appendChild(t.firstChild);else u=t;return(_.shadowroot||_.shadowrootmode)&&(u=Wn.call(l,u,!0)),u}let L=oe?t.outerHTML:t.innerHTML;return oe&&g["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&w(er,t.ownerDocument.doctype.name)&&(L="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
3
3
  `+L),Y&&(L=Be(L)),N&&Fe?le(L):L},o.setConfig=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lt(s),et=!0,ve=g,ke=_},o.clearConfig=function(){pe=null,et=!1,ve=null,ke=null,N=Xe,te=""},o.isValidAttribute=function(s,e,t){pe||lt({});const r=y(s),i=y(e);return typeof t=="string"&&(cn(e,t)||!Je&&w(Rn,t))?!1:an(r,i,t)},o.addHook=function(s,e){typeof e=="function"&&P(T,s)&&Le(T[s],e)},o.removeHook=function(s,e){if(P(T,s)){if(e!==void 0){const t=vo(T[s],e);return t===-1?void 0:Uo(T[s],t,1)[0]}return mn(T[s])}},o.removeHooks=function(s){P(T,s)&&(T[s]=[])},o.removeAllHooks=function(){T=On()},o}var br=In();const Mn="/mail/brief/compose/{-$outboxMessageId}",Pn="/mail/flagged/compose/{-$outboxMessageId}",xn="/mail/outbox/compose/{-$outboxMessageId}",vn="/mail/$mailboxId/compose/{-$outboxMessageId}",kn="/mail/label/$labelId/compose/{-$outboxMessageId}";function Un(){const n=De({from:Mn,shouldThrow:!1}),o=De({from:Pn,shouldThrow:!1}),a=De({from:xn,shouldThrow:!1}),l=De({from:vn,shouldThrow:!1}),c=De({from:kn,shouldThrow:!1});return n??o??a??l??c}function Sr(){return Un()!==void 0}function Rr(){return Un()?.outboxMessageId}function sr({list:n,mailboxId:o,labelId:a},l){return n==="flagged"?{to:Pn,params:{outboxMessageId:l}}:n==="outbox"?{to:xn,params:{outboxMessageId:l}}:n==="mailbox"&&o?{to:vn,params:{mailboxId:o,outboxMessageId:l}}:n==="label"&&a?{to:kn,params:{labelId:a,outboxMessageId:l}}:{to:Mn,params:{outboxMessageId:l}}}function Nt(){const n=_o(),o=Lo(),a=wo();return V.useCallback((l,c)=>{n({...sr(a,l),search:Eo,hash:c?.keepPanels?!0:o,replace:c?.replace??!1})},[n,o,a])}function Or(){const n=Nt();return V.useCallback(()=>n(void 0),[n])}function wr(){const n=Nt();return V.useCallback(o=>n(o),[n])}function Dr(){const n=Nt();return V.useCallback(o=>n(o,{replace:!0,keepPanels:!0}),[n])}function Lr(){return Do()}const ar=new Set(["rfc822","global"]),lr=n=>n.mediaType.toUpperCase()==="MESSAGE"&&ar.has(n.mediaSubtype.toLowerCase()),Fn=(n,o)=>n.partPath.startsWith(`${o}.`),cr=n=>{const o=n.filter(lr);return n.filter(a=>!o.some(l=>Fn(a,l.partPath)))},Cr=(n,o)=>n.filter(a=>Fn(a,o)),ur=n=>{const o=cr(n).filter(c=>!c.isMultipart&&c.disposition!=="attachment"&&c.mediaType==="TEXT"&&c.contentUrl.length>0),a=o.find(c=>c.mediaSubtype.toUpperCase()==="HTML");if(a)return{kind:"html",contentUrl:a.contentUrl};const l=o.find(c=>c.mediaSubtype.toUpperCase()==="PLAIN");return l?{kind:"text",contentUrl:l.contentUrl}:null},Ct={all:["messages"],detail:n=>[...Ct.all,"detail",n],body:n=>[...Ct.detail(n),"body"]};class ge extends Error{reason;status;retryAfterSeconds;constructor(o,a,l,c){super(a),this.name="BodyFetchError",this.reason=o,this.status=l,this.retryAfterSeconds=c}}const fr=n=>{const o=Number.parseInt(n??"",10);return!Number.isFinite(o)||o<=0?1:Math.min(o,30)},pr=8,mr="x-remit-403-reason",dr=(n,o)=>{const a=o?.trim()??"";return n===401?"auth":n===403?a.length>0?"auth":"body-missing":n===404?"body-missing":"generic"},hr=(n,o)=>(o??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(n):!1,Tr=(n,o)=>{const a=(o??"").toLowerCase();return!!(n==="text"&&a.startsWith("text/html"))},gr=async(n,o,a=async()=>null)=>{const l={},c=await a();c&&(l.Authorization=`Bearer ${c}`);const m=await Oo(n,{headers:l});if(m.status===202)throw new ge("not-ready","Message body is still syncing",202,fr(m.headers.get("Retry-After")));if(!m.ok){const A=m.headers.get(mr),G=dr(m.status,A);throw new ge(G,`Failed to load message body (${m.status} ${m.statusText})`,m.status)}const h=m.headers.get("content-type");if(Tr(o,h))throw new ge("content-type-mismatch",`Refusing to render message body — expected ${o}, got Content-Type ${h}`);const F=await m.text();if(hr(F,h))throw new ge("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return F},_r=async(n,o)=>(o.isRetryAfterNotReady&&await n.refetchDescribeMessage(),n.fetchContent(o.contentUrl,o.kind)),Nr=({messageId:n,bodyParts:o,enabled:a=!0})=>{const l=o?ur(o):null,c=yo(),{getToken:m}=Ao(),h=V.useRef(null),F=bo(),A=V.useRef(!1),G=V.useRef(null),W=n&&l?`${n}:${l.contentUrl}`:null;G.current!==W&&(G.current=W,A.current=!1);const R=So({queryKey:n?[...Ct.body(n),l?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!l)throw new Error("No renderable body part");if(!n)throw new Error("No messageId");const J=A.current;return A.current=!1,_r({fetchContent:(C,X)=>gr(C,X,m),refetchDescribeMessage:()=>F.refetchQueries({queryKey:Ro({path:{messageId:n}})})},{contentUrl:l.contentUrl,kind:l.kind,isRetryAfterNotReady:J})},enabled:a&&!!n&&!!l,staleTime:300*1e3,gcTime:1800*1e3,retry:(J,C)=>C instanceof ge&&C.reason==="not-ready"?J<pr:J<1,retryDelay:(J,C)=>C instanceof ge&&C.reason==="not-ready"?(A.current=!0,(C.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),Ee=R.isLoading&&!!l,ye=o!==void 0&&l===null;V.useEffect(()=>{Ee&&(h.current=performance.now())},[Ee]),V.useEffect(()=>{R.isSuccess&&h.current!==null&&(c.recordTiming("message.body.load",Math.round(performance.now()-h.current)),h.current=null)},[R.isSuccess,c]);const Me=R.data&&l?{kind:l.kind,body:R.data}:void 0;return{picked:l,data:Me,isLoading:Ee,hasNoRenderablePart:ye,isError:R.isError,error:R.error,refetch:R.refetch}};export{ge as B,Sr as a,Nr as b,dr as c,Rr as d,Dr as e,Lr as f,wr as g,Cr as h,lr as i,cr as o,br as p,Or as u};
@@ -1 +1 @@
1
- import{cU as Q,cV as y,cW as S,cX as w,cY as C,e as k,cZ as q,c_ as x,r as p,c$ as M,d0 as H,d1 as L,d2 as P,d3 as O,d4 as B,d5 as A}from"./index-fsuIswbe.js";function R(r,e){const s=new Set(e);return r.filter(t=>!s.has(t))}function T(r,e,s){const t=r.slice(0);return t[e]=s,t}var U=class extends Q{#i;#e;#n;#r;#s;#t;#o;#u;#h;#c=[];constructor(r,e,s){super(),this.#i=r,this.#r=s,this.#n=[],this.#s=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(r=>{r.subscribe(e=>{this.#f(r,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(r=>{r.destroy()})}setQueries(r,e){this.#n=r,this.#r=e,y.batch(()=>{const s=this.#s,t=this.#d(this.#n);t.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const i=t.map(o=>o.observer),n=i.map(o=>o.getCurrentResult()),u=s.length!==i.length,a=i.some((o,f)=>o!==s[f]),d=u||a,b=d?!0:n.some((o,f)=>{const g=this.#e[f];return!g||!S(o,g)});!d&&!b||(d&&(this.#c=t,this.#s=i),this.#e=n,this.hasListeners()&&(d&&(R(s,i).forEach(o=>{o.destroy()}),R(i,s).forEach(o=>{o.subscribe(f=>{this.#f(o,f)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(r=>r.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(r,e){const s=this.#d(r),t=s.map(n=>n.observer.getOptimisticResult(n.defaultedQueryOptions)),i=s.map(n=>n.defaultedQueryOptions.queryHash);return[t,n=>this.#l(n??t,e,i),()=>this.#a(t,s)]}#a(r,e){return e.map((s,t)=>{const i=r[t];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,n=>{e.forEach(u=>{u.observer.trackProp(n)})})})}#l(r,e,s){if(e){const t=this.#h,i=s!==void 0&&t!==void 0&&(t.length!==s.length||s.some((n,u)=>n!==t[u]));return(!this.#t||this.#e!==this.#u||i||e!==this.#o)&&(this.#o=e,this.#u=this.#e,s!==void 0&&(this.#h=s),this.#t=w(this.#t,e(r))),this.#t}return r}#b(){return this.#r?.combine!==void 0&&this.#s.some((r,e)=>r.options.suspense&&this.#e[e]?.data===void 0)}#d(r){const e=new Map;this.#s.forEach(t=>{const i=t.options.queryHash;if(!i)return;const n=e.get(i);n?n.push(t):e.set(i,[t])});const s=[];return r.forEach(t=>{const i=this.#i.defaultQueryOptions(t),u=e.get(i.queryHash)?.shift()??new C(this.#i,i);s.push({defaultedQueryOptions:i,observer:u})}),s}#f(r,e){const s=this.#s.indexOf(r);s!==-1&&(this.#e=T(this.#e,s,e),this.#p())}#p(){if(this.hasListeners()){const r=this.#a(this.#e,this.#c),e=this.#b(),s=this.#t,t=e?s:this.#l(r,this.#r?.combine);(e||s!==t)&&y.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function I({queries:r,...e},s){const t=k(),i=q(),n=x(),u=p.useMemo(()=>r.map(h=>{const c=t.defaultQueryOptions(h);return c._optimisticResults=i?"isRestoring":"optimistic",c}),[r,t,i]);u.forEach(h=>{M(h);const c=t.getQueryCache().get(h.queryHash);H(h,n,c)}),L(n);const[a]=p.useState(()=>new U(t,u,e)),[d,b,o]=a.getOptimisticResult(u,e.combine),f=!i&&e.subscribed!==!1;p.useSyncExternalStore(p.useCallback(h=>f?a.subscribe(y.batchCalls(h)):P,[a,f]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),p.useEffect(()=>{a.setQueries(u,e)},[u,e,a]);const m=d.some((h,c)=>O(u[c],h))?d.flatMap((h,c)=>{const l=u[c];if(l&&O(l,h)){const E=new C(t,l);return B(l,E,n)}return[]}):[];if(m.length>0)throw Promise.all(m);const v=d.find((h,c)=>{const l=u[c];return l&&A({result:h,errorResetBoundary:n,throwOnError:l.throwOnError,query:t.getQueryCache().get(l.queryHash),suspense:l.suspense})});if(v?.error)throw v.error;return b(o())}export{I as u};
1
+ import{cU as Q,cV as y,cW as S,cX as w,cY as C,e as k,cZ as q,c_ as x,r as p,c$ as M,d0 as H,d1 as L,d2 as P,d3 as O,d4 as B,d5 as A}from"./index-C2US5ZnK.js";function R(r,e){const s=new Set(e);return r.filter(t=>!s.has(t))}function T(r,e,s){const t=r.slice(0);return t[e]=s,t}var U=class extends Q{#i;#e;#n;#r;#s;#t;#o;#u;#h;#c=[];constructor(r,e,s){super(),this.#i=r,this.#r=s,this.#n=[],this.#s=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(r=>{r.subscribe(e=>{this.#f(r,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(r=>{r.destroy()})}setQueries(r,e){this.#n=r,this.#r=e,y.batch(()=>{const s=this.#s,t=this.#d(this.#n);t.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const i=t.map(o=>o.observer),n=i.map(o=>o.getCurrentResult()),u=s.length!==i.length,a=i.some((o,f)=>o!==s[f]),d=u||a,b=d?!0:n.some((o,f)=>{const g=this.#e[f];return!g||!S(o,g)});!d&&!b||(d&&(this.#c=t,this.#s=i),this.#e=n,this.hasListeners()&&(d&&(R(s,i).forEach(o=>{o.destroy()}),R(i,s).forEach(o=>{o.subscribe(f=>{this.#f(o,f)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(r=>r.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(r,e){const s=this.#d(r),t=s.map(n=>n.observer.getOptimisticResult(n.defaultedQueryOptions)),i=s.map(n=>n.defaultedQueryOptions.queryHash);return[t,n=>this.#l(n??t,e,i),()=>this.#a(t,s)]}#a(r,e){return e.map((s,t)=>{const i=r[t];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,n=>{e.forEach(u=>{u.observer.trackProp(n)})})})}#l(r,e,s){if(e){const t=this.#h,i=s!==void 0&&t!==void 0&&(t.length!==s.length||s.some((n,u)=>n!==t[u]));return(!this.#t||this.#e!==this.#u||i||e!==this.#o)&&(this.#o=e,this.#u=this.#e,s!==void 0&&(this.#h=s),this.#t=w(this.#t,e(r))),this.#t}return r}#b(){return this.#r?.combine!==void 0&&this.#s.some((r,e)=>r.options.suspense&&this.#e[e]?.data===void 0)}#d(r){const e=new Map;this.#s.forEach(t=>{const i=t.options.queryHash;if(!i)return;const n=e.get(i);n?n.push(t):e.set(i,[t])});const s=[];return r.forEach(t=>{const i=this.#i.defaultQueryOptions(t),u=e.get(i.queryHash)?.shift()??new C(this.#i,i);s.push({defaultedQueryOptions:i,observer:u})}),s}#f(r,e){const s=this.#s.indexOf(r);s!==-1&&(this.#e=T(this.#e,s,e),this.#p())}#p(){if(this.hasListeners()){const r=this.#a(this.#e,this.#c),e=this.#b(),s=this.#t,t=e?s:this.#l(r,this.#r?.combine);(e||s!==t)&&y.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function I({queries:r,...e},s){const t=k(),i=q(),n=x(),u=p.useMemo(()=>r.map(h=>{const c=t.defaultQueryOptions(h);return c._optimisticResults=i?"isRestoring":"optimistic",c}),[r,t,i]);u.forEach(h=>{M(h);const c=t.getQueryCache().get(h.queryHash);H(h,n,c)}),L(n);const[a]=p.useState(()=>new U(t,u,e)),[d,b,o]=a.getOptimisticResult(u,e.combine),f=!i&&e.subscribed!==!1;p.useSyncExternalStore(p.useCallback(h=>f?a.subscribe(y.batchCalls(h)):P,[a,f]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),p.useEffect(()=>{a.setQueries(u,e)},[u,e,a]);const m=d.some((h,c)=>O(u[c],h))?d.flatMap((h,c)=>{const l=u[c];if(l&&O(l,h)){const E=new C(t,l);return B(l,E,n)}return[]}):[];if(m.length>0)throw Promise.all(m);const v=d.find((h,c)=>{const l=u[c];return l&&A({result:h,errorResetBoundary:n,throwOnError:l.throwOnError,query:t.getQueryCache().get(l.queryHash),suspense:l.suspense})});if(v?.error)throw v.error;return b(o())}export{I as u};