@remit/web-client-dist 0.0.690 → 0.0.691

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 (233) hide show
  1. package/assets/{BriefPane-uF6csCem.js → BriefPane-uBrSdO9E.js} +1 -1
  2. package/assets/{CalendarEventEditor-B0SWzPqQ.js → CalendarEventEditor-CW-VkuRj.js} +1 -1
  3. package/assets/{CalendarEventPopup-V9BZRnwN.js → CalendarEventPopup-Dr1Zl88E.js} +1 -1
  4. package/assets/{CalendarLoadFailed-CU4C4nFf.js → CalendarLoadFailed-CqaZI6s0.js} +1 -1
  5. package/assets/CalendarQuickCreate-BSauej6s.js +1 -0
  6. package/assets/{CalendarSession-Ub9ZzsQN.js → CalendarSession-UbavgUO4.js} +1 -1
  7. package/assets/DesktopChrome-DSs02PMr.js +1 -0
  8. package/assets/{DropdownMenu-CGhv-K3k.js → DropdownMenu-DlTVA419.js} +1 -1
  9. package/assets/{EmptyState-B_Kthrla.js → EmptyState-3mzd9Rr2.js} +1 -1
  10. package/assets/{ErrorState-BB0xpcCi.js → ErrorState-Czrn8Njd.js} +1 -1
  11. package/assets/{FlaggedPane-CyyX0x8y.js → FlaggedPane-Duxks4wd.js} +1 -1
  12. package/assets/{FullCompose-sAZlqUaR.js → FullCompose-C6ydcOqj.js} +1 -1
  13. package/assets/{LabelApplyTrigger-ChzWyjHs.js → LabelApplyTrigger-BeYgQjx0.js} +1 -1
  14. package/assets/{MailShell-DY2Ot0ah.js → MailShell-qe4eiESL.js} +1 -1
  15. package/assets/{MailViewChrome-U9YpZx_B.js → MailViewChrome-DmD7yKe9.js} +1 -1
  16. package/assets/{MailboxPane-DszlAx2f.js → MailboxPane-Cd7n8_0e.js} +1 -1
  17. package/assets/MessageBody-Dx9mvb7l.js +84 -0
  18. package/assets/MessageToolbar-D_XE8m4l.js +1 -0
  19. package/assets/{NavMenuButton-B_c3nIpV.js → NavMenuButton-B9iy2p3f.js} +1 -1
  20. package/assets/OnboardingWizard-Cb8hwkpv.js +1 -0
  21. package/assets/{OutboxPane-D47KP_dW.js → OutboxPane-CByBDVdV.js} +1 -1
  22. package/assets/{ReportLink-C4yyzfnn.js → ReportLink-CVPckN6-.js} +1 -1
  23. package/assets/_calendarObjectId-Dus6Z_aO.js +1 -0
  24. package/assets/_mailboxId-DA2rNZ6D.js +1 -0
  25. package/assets/_messageId-CBEFnj_-.js +1 -0
  26. package/assets/_messageId-CoU9lExJ.js +1 -0
  27. package/assets/_messageId-UN1wPrb5.js +1 -0
  28. package/assets/_outboxMessageId-Crw8NNd4.js +1 -0
  29. package/assets/_recurrenceId-DN3W2Byk.js +1 -0
  30. package/assets/_slotId-BLO1Rmfd.js +1 -0
  31. package/assets/_threadId-CGEJtUok.js +1 -0
  32. package/assets/_threadId-CrzKmCrt.js +1 -0
  33. package/assets/_threadId-D5at7_2j.js +1 -0
  34. package/assets/_view._date-CZiRXVFR.js +1 -0
  35. package/assets/account-service-status-DLPjTYw9.js +1 -0
  36. package/assets/accounts-Dl4YCzpm.js +1 -0
  37. package/assets/advanced-CgXbUOtb.js +1 -0
  38. package/assets/agenda-time-KJVZW5dD.js +1 -0
  39. package/assets/{app-chrome-BI9iJnw3.js → app-chrome-1USNGfE3.js} +1 -1
  40. package/assets/appearance-C6nkCe1H.js +1 -0
  41. package/assets/{avatar-COXPYlBH.js → avatar-Bo0EUTkm.js} +1 -1
  42. package/assets/{badge-DLlDkvBl.js → badge-C7MFP1pN.js} +1 -1
  43. package/assets/{bottom-sheet-BUOc_BG6.js → bottom-sheet-C9u72VJg.js} +1 -1
  44. package/assets/{brief-iq8Ra5O_.js → brief-CMzu4LMD.js} +1 -1
  45. package/assets/brief-DYSQ_oRb.js +1 -0
  46. package/assets/{calendar-Cmzt0eKc.js → calendar-B8lLrLAb.js} +1 -1
  47. package/assets/{calendar-event-popup-BvI6Qwla.js → calendar-event-popup-C92tAdsE.js} +1 -1
  48. package/assets/{calendar-event-sidebar-Dx3WbbPv.js → calendar-event-sidebar-CahohNiL.js} +1 -1
  49. package/assets/{calendar-failure-note-BRyIsChq.js → calendar-failure-note-D746wu0r.js} +1 -1
  50. package/assets/calendar-guests-DnrOkTr7.js +1 -0
  51. package/assets/{calendar-DCTglXEB.js → calendar-iY8BLzO2.js} +1 -1
  52. package/assets/calendar-suggestion-yCUw5guW.js +1 -0
  53. package/assets/calendars-ZADJ8TZ1.js +1 -0
  54. package/assets/{card-XAEgDd1b.js → card-5b65wlka.js} +1 -1
  55. package/assets/checkbox-CvgfSohd.js +1 -0
  56. package/assets/chevron-down-CR89KUgK.js +1 -0
  57. package/assets/chevron-left-DSaOqH7y.js +1 -0
  58. package/assets/circle-check-9HYVTIrG.js +1 -0
  59. package/assets/circle-check-big-p6il4Jr3.js +1 -0
  60. package/assets/circle-question-mark-BVVFmkJG.js +1 -0
  61. package/assets/classification-BoqrRObl.js +1 -0
  62. package/assets/clock-D6gctGNH.js +1 -0
  63. package/assets/compose._-_outboxMessageId_-Cv8p7Ifc.js +1 -0
  64. package/assets/compose._-_outboxMessageId_-Dj0vXnYT.js +1 -0
  65. package/assets/compose._-_outboxMessageId_-Dsv-7Ma0.js +1 -0
  66. package/assets/compose._-_outboxMessageId_-_t-bMwDD.js +1 -0
  67. package/assets/{config-import-DZkZ73sW.js → config-import-BtJdN8VN.js} +1 -1
  68. package/assets/{confirm-dialog-D33DXPkQ.js → confirm-dialog-DYNhLVrG.js} +1 -1
  69. package/assets/copy-BwtY4IWi.js +1 -0
  70. package/assets/credential-steps-Czm9bF6Y.js +1 -0
  71. package/assets/download-V38kBiT1.js +1 -0
  72. package/assets/{draft--MHSP3BT.js → draft-C849UdJB.js} +1 -1
  73. package/assets/edit-D9CdMYNH.js +1 -0
  74. package/assets/edit-Dhgn_BMZ.js +1 -0
  75. package/assets/external-link-BVJU7bpX.js +1 -0
  76. package/assets/file-braces-CEQVt7jm.js +1 -0
  77. package/assets/filters-D9G5dAF4.js +1 -0
  78. package/assets/{flagged-C-DEfMAa.js → flagged-CwOw5Xxs.js} +1 -1
  79. package/assets/flagged-aucGpj-Z.js +1 -0
  80. package/assets/folder-input-Bgx-bBiO.js +1 -0
  81. package/assets/folders-Bn_4Y9H0.js +1 -0
  82. package/assets/{help-copy-DodnPf1K.js → help-copy-Bo651f-_.js} +1 -1
  83. package/assets/import-BfiMMK8M.js +1 -0
  84. package/assets/index--IxFGldl.js +1 -0
  85. package/assets/{index-DqlUjB9k.js → index-B7CBca9v.js} +15 -15
  86. package/assets/index-BWpSJ9nc.js +1 -0
  87. package/assets/index-BkkdzHr6.js +1 -0
  88. package/assets/{index-9JWzpiiR.js → index-BnBpXn45.js} +65 -65
  89. package/assets/index-CBEFnj_-.js +1 -0
  90. package/assets/index-CoU9lExJ.js +1 -0
  91. package/assets/index-CqG3g67K.js +1 -0
  92. package/assets/index-DL3ZaCDr.js +1 -0
  93. package/assets/index-DlNRygfs.js +1 -0
  94. package/assets/index-Dw2xSkAT.js +1 -0
  95. package/assets/index-UN1wPrb5.js +1 -0
  96. package/assets/{kbd-D_0s6Sx_.js → kbd-CE7JGsTx.js} +1 -1
  97. package/assets/{label-chip-zJi2r8mQ.js → label-chip-CbKg_yMt.js} +1 -1
  98. package/assets/labels-DWadctIQ.js +1 -0
  99. package/assets/mail-BG3D2i2e.js +1 -0
  100. package/assets/mail-DtD-4wOO.js +1 -0
  101. package/assets/menu-B8nM2lya.js +1 -0
  102. package/assets/{nav-link-8l24_oWF.js → nav-link-CjSE3MDU.js} +1 -1
  103. package/assets/new-C7PkD0CK.js +1 -0
  104. package/assets/onboarding-BSC6mmKf.js +1 -0
  105. package/assets/{onboarding-completion-Z1EOTA33.js → onboarding-completion-EUidFdVK.js} +1 -1
  106. package/assets/outbox-DQD-mHZK.js +1 -0
  107. package/assets/pencil-rhg9PvnD.js +1 -0
  108. package/assets/people-DWWALdDd.js +1 -0
  109. package/assets/plus-B2EF0VhA.js +1 -0
  110. package/assets/popover-menu-nz-n7B2h.js +1 -0
  111. package/assets/refresh-cw-COcXRex1.js +1 -0
  112. package/assets/{reply-BUVhW3yq.js → reply-CzX8Q1T1.js} +1 -1
  113. package/assets/{rich-text-HpMiPjFH.js → rich-text-BIDloC3-.js} +23 -23
  114. package/assets/{rich-text-spellcheck-worker-provider-BfhfcGZ2.js → rich-text-spellcheck-worker-provider-BahuahVp.js} +1 -1
  115. package/assets/rotate-ccw-D5rIVkpa.js +1 -0
  116. package/assets/{roving-focus-C87O2raY.js → roving-focus-DWCPniMZ.js} +1 -1
  117. package/assets/{row-actions-cUhOCilI.js → row-actions-CLp_pk6R.js} +1 -1
  118. package/assets/{search-mirror-B0C9oCpr.js → search-mirror-CM2HNuGA.js} +1 -1
  119. package/assets/{search-scope-aZ2AZX-k.js → search-scope-fyP_uHeh.js} +1 -1
  120. package/assets/search-token-index-YOjFNFJN.js +1 -0
  121. package/assets/{sections-BtFAPYYy.js → sections-DsqY4M13.js} +1 -1
  122. package/assets/{segmented-control-tpWp-yev.js → segmented-control-IDK8fpO7.js} +1 -1
  123. package/assets/{select-Dv65Mqkl.js → select-DWBegMNA.js} +1 -1
  124. package/assets/senders-ap9QQK-k.js +1 -0
  125. package/assets/settings-D2KYecr5.js +1 -0
  126. package/assets/settings-screen-BN-3qNrj.js +1 -0
  127. package/assets/shield-check-CW6Yah30.js +1 -0
  128. package/assets/{suggest-list-xX77W_hF.js → suggest-list-DMRnmTaR.js} +1 -1
  129. package/assets/{suggested-vips-DRijwoFY.js → suggested-vips-Gtwi6sFb.js} +1 -1
  130. package/assets/suggestion._suggestionId-BHxPFUy0.js +1 -0
  131. package/assets/{switch-CGmUk-Wh.js → switch-B87JY9ce.js} +1 -1
  132. package/assets/task._calendarTaskId-r7Jl9ABh.js +1 -0
  133. package/assets/undo-2-D-cmVG46.js +1 -0
  134. package/assets/{useCalendarData-D07VZ1QE.js → useCalendarData-Djtg1pj2.js} +1 -1
  135. package/assets/{useCalendarScheduling-CnlDrC-W.js → useCalendarScheduling-D222yR_U.js} +1 -1
  136. package/assets/useCalendarSuggestions-COzKAJgT.js +1 -0
  137. package/assets/{useCalendarTasks-CV-ORktM.js → useCalendarTasks-D5yN61q_.js} +1 -1
  138. package/assets/{useDebouncedValue-DRrHzwce.js → useDebouncedValue-CahHw3v4.js} +1 -1
  139. package/assets/{useFilters-DdYKMP_s.js → useFilters-CmYwNOKM.js} +1 -1
  140. package/assets/{useLabels-ouqsQR1c.js → useLabels-BxK35B_o.js} +1 -1
  141. package/assets/{useLayoutTier-CeBSbbkD.js → useLayoutTier-xkhKNk1V.js} +1 -1
  142. package/assets/{useMediaQuery-BzGo-bVp.js → useMediaQuery-DOpCuIgp.js} +1 -1
  143. package/assets/{useMessageBodyContent-D9UpR1Dh.js → useMessageBodyContent-DzlZ514L.js} +1 -1
  144. package/assets/{useQueries-Des6lpmI.js → useQueries-BomGTQs-.js} +1 -1
  145. package/assets/{useRefreshControl-CWSpNwGo.js → useRefreshControl-BAZSbaBz.js} +1 -1
  146. package/assets/useResultFolderIndex-D9sJhyey.js +1 -0
  147. package/assets/{useSignature-CQsNwcJm.js → useSignature-Boz2_w0h.js} +1 -1
  148. package/assets/{warnings-CDdQ-K5m.js → warnings-BEW4lkgR.js} +1 -1
  149. package/index.html +1 -1
  150. package/package.json +1 -1
  151. package/assets/CalendarQuickCreate-CaO2GHZr.js +0 -1
  152. package/assets/DesktopChrome-H9yEQYFf.js +0 -1
  153. package/assets/MessageBody-zT-at0bi.js +0 -84
  154. package/assets/MessageToolbar-mGmOl_Xf.js +0 -1
  155. package/assets/OnboardingWizard-ezuAE6sx.js +0 -1
  156. package/assets/_calendarObjectId-5z-o0pQB.js +0 -1
  157. package/assets/_mailboxId-CBxHNU1m.js +0 -1
  158. package/assets/_messageId-DHvQcDnk.js +0 -1
  159. package/assets/_messageId-Dk8Pv3WS.js +0 -1
  160. package/assets/_messageId-q5-pR6qn.js +0 -1
  161. package/assets/_outboxMessageId-Akv-3HPP.js +0 -1
  162. package/assets/_recurrenceId-DrNRvEqM.js +0 -1
  163. package/assets/_slotId-BbhN8swS.js +0 -1
  164. package/assets/_threadId-9uIkuh2L.js +0 -1
  165. package/assets/_threadId-DdQZmst0.js +0 -1
  166. package/assets/_threadId-mITrrqLR.js +0 -1
  167. package/assets/_view._date-DyseRkCh.js +0 -1
  168. package/assets/account-service-status-HIGoykok.js +0 -1
  169. package/assets/accounts-DwJx265B.js +0 -1
  170. package/assets/advanced-4BQF-R7r.js +0 -1
  171. package/assets/agenda-time-hKUG2dhl.js +0 -1
  172. package/assets/appearance-BHnbKYJT.js +0 -1
  173. package/assets/brief-CJySko3D.js +0 -1
  174. package/assets/calendar-guests-7MqnVXzX.js +0 -1
  175. package/assets/calendar-suggestion-CpOWds4W.js +0 -1
  176. package/assets/calendars-CbchUImt.js +0 -1
  177. package/assets/checkbox-CzFLh5Dk.js +0 -1
  178. package/assets/chevron-down-Q4i_URUt.js +0 -1
  179. package/assets/chevron-left-gBxhdHb5.js +0 -1
  180. package/assets/circle-check-BucqMsie.js +0 -1
  181. package/assets/circle-check-big-CDjntmXC.js +0 -1
  182. package/assets/circle-help-B6Fn573l.js +0 -1
  183. package/assets/classification-DzmiHklC.js +0 -1
  184. package/assets/clock-jwuPTxhb.js +0 -1
  185. package/assets/compose._-_outboxMessageId_-B7D1W3Sx.js +0 -1
  186. package/assets/compose._-_outboxMessageId_-CO4UJXl9.js +0 -1
  187. package/assets/compose._-_outboxMessageId_-D0T64VP0.js +0 -1
  188. package/assets/compose._-_outboxMessageId_-pcn-0-gQ.js +0 -1
  189. package/assets/copy-Be7MLulJ.js +0 -1
  190. package/assets/credential-steps-MLDe683C.js +0 -1
  191. package/assets/download-BSz8KKlH.js +0 -1
  192. package/assets/edit-DCtOcxf9.js +0 -1
  193. package/assets/edit-DbSsj2wh.js +0 -1
  194. package/assets/external-link-o4VBX-Sp.js +0 -1
  195. package/assets/file-json-B3Qb4sPC.js +0 -1
  196. package/assets/filters-Mgogmt5O.js +0 -1
  197. package/assets/flagged-D0pl5Vka.js +0 -1
  198. package/assets/folder-input-C8-nffA0.js +0 -1
  199. package/assets/folders-DodnBZua.js +0 -1
  200. package/assets/import-C-0_jeuq.js +0 -1
  201. package/assets/index-BnElevbT.js +0 -1
  202. package/assets/index-DHvQcDnk.js +0 -1
  203. package/assets/index-DcMLhAhx.js +0 -1
  204. package/assets/index-DfAafcCq.js +0 -1
  205. package/assets/index-Dk8Pv3WS.js +0 -1
  206. package/assets/index-Dvms4bLC.js +0 -1
  207. package/assets/index-DxDWr9QM.js +0 -1
  208. package/assets/index-JdYKPBmV.js +0 -1
  209. package/assets/index-Tl1Nlwxt.js +0 -1
  210. package/assets/index-q5-pR6qn.js +0 -1
  211. package/assets/labels-BLy-VSyB.js +0 -1
  212. package/assets/mail-Bh469T8t.js +0 -1
  213. package/assets/mail-CXavFmSm.js +0 -1
  214. package/assets/menu-Dro5vzLW.js +0 -1
  215. package/assets/new-D7laO9Pg.js +0 -1
  216. package/assets/onboarding-D-4ZdWHj.js +0 -1
  217. package/assets/outbox-DzVji2w9.js +0 -1
  218. package/assets/pencil-Dz-yZ9zw.js +0 -1
  219. package/assets/people-DoJm1MLz.js +0 -1
  220. package/assets/plus-Cp9K9QJ4.js +0 -1
  221. package/assets/popover-menu-BCEzStJs.js +0 -1
  222. package/assets/refresh-cw-0FbK4O4v.js +0 -1
  223. package/assets/rotate-ccw-DCzt84SY.js +0 -1
  224. package/assets/search-token-index--Pzg9wI2.js +0 -1
  225. package/assets/senders-BjvP6Oq9.js +0 -1
  226. package/assets/settings-fP9o8EL9.js +0 -1
  227. package/assets/settings-screen-DPboZsK5.js +0 -1
  228. package/assets/shield-check-BbF5QmrH.js +0 -1
  229. package/assets/suggestion._suggestionId-Ca3k8ej7.js +0 -1
  230. package/assets/task._calendarTaskId-CvuxUcFe.js +0 -1
  231. package/assets/undo-2-CGWL2haZ.js +0 -1
  232. package/assets/useCalendarSuggestions-DW7WFMvd.js +0 -1
  233. package/assets/useResultFolderIndex-DRfqL3r_.js +0 -1
@@ -1 +1 @@
1
- import{j as r,p as a}from"./index-9JWzpiiR.js";function n({raised:s,className:e,...t}){return r.jsx("div",{className:a("rounded-sm border border-line bg-surface",s?"bg-surface-raised shadow-sm":"",e),...t})}function o({className:s,...e}){return r.jsx("div",{className:a("px-4 pt-3 pb-2",s),...e})}function i({className:s,...e}){return r.jsx("h3",{className:a("text-md font-semibold text-fg",s),...e})}function m({className:s,...e}){return r.jsx("div",{className:a("px-4 pb-3 text-sm text-fg-muted",s),...e})}export{n as C,o as a,i as b,m as c};
1
+ import{j as r,p as a}from"./index-BnBpXn45.js";function n({raised:s,className:e,...t}){return r.jsx("div",{className:a("rounded-sm border border-line bg-surface",s?"bg-surface-raised shadow-sm":"",e),...t})}function o({className:s,...e}){return r.jsx("div",{className:a("px-4 pt-3 pb-2",s),...e})}function i({className:s,...e}){return r.jsx("h3",{className:a("text-md font-semibold text-fg",s),...e})}function m({className:s,...e}){return r.jsx("div",{className:a("px-4 pb-3 text-sm text-fg-muted",s),...e})}export{n as C,o as a,i as b,m as c};
@@ -0,0 +1 @@
1
+ import{b as p,r as c,j as e,aq as m,p as t}from"./index-BnBpXn45.js";const d={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};d.node;const h=p(d),b="peer relative size-5 shrink-0 cursor-pointer appearance-none rounded-md border border-line-strong bg-surface outline-none transition-colors checked:border-positive checked:bg-positive indeterminate:border-positive indeterminate:bg-positive focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",l="pointer-events-none absolute inset-0 m-auto size-3.5 text-accent-fg";function g({label:s,description:n,indeterminate:r=!1,checked:u,onChange:f,className:o,...x}){const i=c.useRef(null);c.useEffect(()=>{i.current&&(i.current.indeterminate=r)},[r]);const a=e.jsxs("span",{className:"relative inline-flex",children:[e.jsx("input",{ref:i,type:"checkbox",checked:u,onChange:f,className:b,...x}),e.jsx(m,{className:t(l,"hidden peer-checked:block"),"aria-hidden":!0}),e.jsx(h,{className:t(l,"hidden peer-indeterminate:block"),"aria-hidden":!0})]});return s===void 0&&n===void 0?e.jsx("span",{className:o,children:a}):e.jsxs("label",{className:t("flex min-h-11 cursor-pointer items-center gap-3 text-left",o),children:[a,e.jsxs("span",{className:"flex min-w-0 flex-col",children:[s!==void 0&&e.jsx("span",{className:"text-sm text-fg",children:s}),n!==void 0&&e.jsx("span",{className:"text-xs text-fg-subtle",children:n})]})]})}export{g as C,h as M};
@@ -0,0 +1 @@
1
+ import{b as n}from"./index-BnBpXn45.js";const o={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};o.node;const a=n(o);export{a as C};
@@ -0,0 +1 @@
1
+ import{b as o}from"./index-BnBpXn45.js";const e={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};e.node;const t=o(e);export{t as C};
@@ -0,0 +1 @@
1
+ import{b as e}from"./index-BnBpXn45.js";const c={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};c.node;const o=e(c);export{o as C};
@@ -0,0 +1 @@
1
+ import{b as e}from"./index-BnBpXn45.js";const c={name:"circle-check-big",size:24,node:[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-circle"]};c.node;const i=e(c);export{i as C};
@@ -0,0 +1 @@
1
+ import{b as c}from"./index-BnBpXn45.js";const e={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};e.node;const i=c(e);export{i as C};
@@ -0,0 +1 @@
1
+ import{aP as Ke,aw as $e,ax as Ae,b0 as Ee,b1 as N,b2 as Le,s as fe,b3 as Be,a as me,b4 as pe,r as l,b5 as he,e as xe,f as Q,b6 as Fe,b7 as Me,b8 as Te,j as s,d as K,B as S,aG as De,ao as q,ap as Oe,c as He,b9 as ne,u as _e,ac as qe}from"./index-BnBpXn45.js";import{R as ye}from"./ReportLink-CVPckN6-.js";import{f as Ve}from"./ErrorState-Czrn8Njd.js";import{S as Ge}from"./select-DWBegMNA.js";import{C as Qe}from"./confirm-dialog-DYNhLVrG.js";import{S as Xe}from"./switch-B87JY9ce.js";import{B as _}from"./badge-C7MFP1pN.js";import{a as Ye}from"./sections-DsqY4M13.js";import{S as We}from"./settings-screen-BN-3qNrj.js";import"./chevron-down-CR89KUgK.js";import"./avatar-Bo0EUTkm.js";import"./chevron-left-DSaOqH7y.js";import"./menu-B8nM2lya.js";import"./circle-question-mark-BVVFmkJG.js";const Ze=fe(403),X={...fe(400,403,404,409,422,429),...Ee},be=e=>Ke(e)===403,k=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},ge=(e,t)=>{const a=k(e);return a.presetId===t?a.sources:void 0},re=(e,t)=>e.state==="Configured"&&e.sources[t]===N.Saved?e[t]:"",V=(e,t,a)=>e.state==="Configured"&&e.presetId===t&&e[a]!==""?e[a]:void 0,G=e=>({presetId:k(e).presetId,model:re(e,"model"),baseUrl:re(e,"baseUrl"),apiKey:""}),ze=(e,t)=>k(t).presetId===e.presetId?G(t):{presetId:e.presetId,model:"",baseUrl:"",apiKey:""},Je=e=>e.state==="Unrunnable"?!0:e.state==="NotConfigured"?!1:Object.values(e.sources).includes(N.Saved),es={Hosted:"Hosted",Custom:"Your own endpoint",Local:"Self-hosted"},ss=e=>{const t=[];for(const a of e){const i=t.find(n=>n.group===a.group);if(i){i.presets.push(a);continue}t.push({group:a.group,label:es[a.group],presets:[a]})}return t},ve=e=>e.defaultBaseUrl===void 0,A=(e,t)=>t===N.Saved?`${e} Saved by you.`:t===N.Deployment?`${e} Provided by the deployment.`:e,je="Paste an API key",ts=e=>Be(e)?.code==="ClassificationApiKeyRequired",oe="Enter a URL that starts with http:// or https://",as=e=>{if(!URL.canParse(e))return!1;const{protocol:t}=new URL(e);return t==="http:"||t==="https:"},is=(e,t,a)=>{const i=e.baseUrl.trim(),n=e.apiKey.trim(),o=ge(a,t.presetId);if(i!==""&&!as(i))return{ok:!1,field:"BaseUrl",message:oe};if(i===""&&ve(t)&&V(a,t.presetId,"baseUrl")===void 0)return{ok:!1,field:"BaseUrl",message:oe};const d=o?.apiKey??N.Default;return t.needsKey&&n===""&&d===N.Default?{ok:!1,field:"ApiKey",message:je}:{ok:!0,body:{...k(a).presetId!==t.presetId?{classificationPresetId:t.presetId}:{},classificationModel:e.model.trim(),classificationBaseUrl:i,...t.needsKey&&n!==""?{classificationApiKey:n}:{}}}},ns=(e,t,a)=>{const i=k(e).presetId;if(!(i===void 0||t===void 0)&&i!==t)return a.find(n=>n.presetId===i)},rs=e=>{const t=e.status===void 0?e.kind:`${e.status}`;return`Test failed after ${e.latencyMs} ms: ${t}`},Ne=(e,t)=>$e(Ae({title:`Mail classification: ${e}`,errorMessage:`${e}. ${t}`})),os=e=>{const t=e.needsKey?"Needs an API key.":"No key needed.";if(e.price.state!=="Priced")return t;const a=new Intl.NumberFormat("en",{style:"currency",currency:e.price.currency,maximumFractionDigits:4}).format(e.price.perMillionInputTokens);return`${t} ${a} per million input tokens.`},le="Enter a whole number of 1 or more.",ls=2147483647,cs=e=>{const t=e.trim();if(!/^\d+$/.test(t))return{ok:!1,message:le};const a=Number(t);return a<1||a>ls?{ok:!1,message:le}:{ok:!0,limit:a}},Se=e=>e.calls>=e.dailyLimit,ds=(e,t)=>{const{cost:a}=e;if(a.state==="Priced"){const i=new Intl.NumberFormat("en",{style:"currency",currency:a.currency,maximumFractionDigits:2});return a.amount>0&&a.amount<.01?`under ${i.format(.01)}`:a.amount===0?i.format(0):`about ${i.format(a.amount)}`}return t?.group==="Local"?"no price, self-hosted":"no price"},Ie=e=>Le(e,{hour:"2-digit",minute:"2-digit",timeZoneName:"shortOffset"}),Y=e=>{be(e)&&he()},Ce=e=>t=>{e.setQueryData(pe().queryKey,t)},us=()=>{const e=me({...pe(),meta:Ze}),t=e.isError&&be(e.error);return l.useEffect(()=>{t&&he()},[t]),{...e,signedOut:t}},W=()=>{const e=xe();return Q({...Fe(),meta:X,onSuccess:Ce(e),onError:Y})},fs=()=>{const e=xe();return Q({...Me(),meta:X,onSuccess:Ce(e),onError:Y})},ms=()=>Q({...Te(),meta:X,onError:Y});function w({failure:e,onRetry:t}){const a=Ve(e.error);return s.jsxs(K,{tone:"danger",variant:"soft",children:[s.jsx("p",{className:"font-medium",children:e.title}),s.jsx("p",{className:"mt-0.5 break-words text-fg-muted",children:a}),s.jsxs("p",{className:"flex flex-wrap items-center gap-x-4",children:[t&&s.jsx(S,{variant:"secondary",className:"min-h-11",onClick:t,children:"Retry"}),s.jsx(ye,{href:Ne(e.title,a)})]})]})}function P({id:e,label:t,hint:a,error:i,children:n}){return s.jsxs("div",{children:[s.jsx(De,{htmlFor:e,children:t}),n,i&&s.jsx("p",{id:`${e}-error`,className:"mt-1 text-xs text-danger",children:i}),a&&s.jsx("p",{id:`${e}-hint`,className:"mt-1 text-xs text-fg-subtle",children:a})]})}const R=(e,t,a)=>[a?`${e}-error`:"",t?`${e}-hint`:""].filter(Boolean).join(" ")||void 0;function ps({settings:e,inputRef:t,onAnnounce:a}){const i=W(),[n,o]=l.useState(()=>`${e.dailyLimit}`),[d,c]=l.useState(void 0),[f,m]=l.useState(null),h=l.useId(),u=`${h}-limit`,[b]=e.usage,x=b?`Counts reset at ${Ie(b.resetsAt)}. `:"",v=()=>{if(i.isPending)return;const y=cs(n);if(!y.ok){c(y.message);return}m(null),i.mutate({body:{classificationDailyLimit:y.limit}},{onSuccess:()=>a("Saved"),onError:U=>m({title:"The daily limit was not saved",error:U})})};return s.jsxs("section",{"aria-labelledby":`${h}-title`,className:"space-y-4",children:[s.jsx("h2",{id:`${h}-title`,className:"text-xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Daily limit"}),s.jsx(P,{id:u,label:"Calls per account per day",hint:A(`${x}Past the limit, that account's new mail uses built-in rules.`,e.sources.dailyLimit),error:d,children:s.jsx(q,{id:u,ref:t,className:"h-11",inputMode:"numeric",value:n,autoComplete:"off","aria-invalid":d!==void 0,"aria-describedby":R(u,!0,d!==void 0),onChange:y=>{o(y.target.value),c(void 0),a("")},onKeyDown:y=>{y.key==="Enter"&&v()}})}),s.jsx(S,{variant:"primary",className:"min-h-11","aria-disabled":i.isPending,"aria-busy":i.isPending,onClick:v,children:i.isPending?"Saving…":"Save limit"}),f&&s.jsx(w,{failure:f})]})}const hs={ApiKey:"Replace key",Model:"Fix the model",BaseUrl:"Fix the base URL"};function xs({result:e,presetLabel:t,onFix:a,shown:i}){if(e.state==="Passed")return s.jsxs(K,{tone:"success",variant:"soft",children:[s.jsxs("p",{className:"font-medium",children:["Test passed in ",e.latencyMs," ms"]}),s.jsxs("p",{className:"mt-0.5 text-fg-muted",children:["Sample message labelled ",e.label,","," ",Math.round(e.confidence*100),"% confident."]})]});const n=rs(e),o=e.field;return s.jsxs(K,{tone:"danger",variant:"soft",children:[s.jsx("p",{className:"font-medium",children:n}),s.jsxs("p",{className:"mt-0.5 break-words text-fg-muted",children:[e.fix," Nothing changed: classification stays as it was."]}),s.jsxs("p",{className:"flex flex-wrap items-center gap-x-4",children:[o!==void 0&&i[o]&&s.jsx("button",{type:"button",onClick:()=>a(o),className:"inline-flex min-h-11 items-center font-medium text-accent hover:underline",children:hs[o]}),s.jsx(ye,{href:Ne(`Test of ${t} failed`,`${n}. ${e.kind}. ${e.fix}`)})]})]})}function ys({preset:e,settings:t,onAnnounce:a}){const i=W(),n=ms(),[o,d]=l.useState(()=>ze(e,t)),[c,f]=l.useState(null),[m,h]=l.useState(null),[u,b]=l.useState(!1),[x,v]=l.useState(null),[y,U]=l.useState(null),p=l.useRef(null),j=l.useRef(null),Z=l.useRef(null),z=l.useRef(null),E=l.useId(),L=`${E}-model`,B=`${E}-base-url`,F=`${E}-key`;l.useEffect(()=>{if(!y)return;({Model:p,BaseUrl:j,ApiKey:Z,Replace:z})[y.target].current?.focus()},[y]);const M=ge(t,e.presetId),J=M?.apiKey??N.Default,T=e.needsKey&&J!==N.Default,ee=J===N.Deployment,we=e.needsKey&&(!T||u),ke={ApiKey:e.needsKey,Model:!0,BaseUrl:!0},I=r=>c?.field===r?c.message:void 0,C=r=>I(r)!==void 0||m?.state==="Failed"&&m.field===r,$=r=>U({target:r}),D=(r,H)=>{d(g=>({...g,...H})),h(g=>g?.state==="Passed"?null:g),f(g=>g?.field===r?null:g),a("")},se=()=>{b(!0),$("ApiKey")},te=()=>{b(!1),d(r=>({...r,apiKey:""})),f(r=>r?.field==="ApiKey"?null:r),$("Replace")},O=r=>{if(r==="ApiKey"&&T){se();return}$(r)},Ue=()=>{const r=is(o,e,t);if(!r.ok){f({field:r.field,message:r.message}),O(r.field);return}v(null);const H=u;i.mutate({body:r.body},{onSuccess:()=>{d(g=>({...g,apiKey:""})),b(!1),f(null),a("Saved"),H&&$("Replace")},onError:g=>{if(ts(g)){f({field:"ApiKey",message:je}),O("ApiKey");return}v({title:`${e.label} was not saved`,error:g})}})},Pe=()=>{n.isPending||(h(null),v(null),a(""),n.mutate({body:{presetId:e.presetId,model:o.model.trim(),baseUrl:o.baseUrl.trim(),apiKey:o.apiKey.trim()}},{onSuccess:h,onError:r=>v({title:`The test of ${e.label} did not run`,error:r})}))},ae=V(t,e.presetId,"model")??e.defaultModel,Re=V(t,e.presetId,"baseUrl")??e.defaultBaseUrl??"http://localhost:11434/v1",ie=I("ApiKey");return s.jsxs(s.Fragment,{children:[s.jsx(P,{id:L,label:"Model",hint:A(`Empty uses ${ae}.`,M?.model),error:I("Model"),children:s.jsx(q,{id:L,ref:p,className:"h-11",value:o.model,placeholder:ae,autoComplete:"off",spellCheck:!1,"aria-invalid":C("Model"),"aria-describedby":R(L,!0,I("Model")!==void 0),onChange:r=>D("Model",{model:r.target.value})})}),s.jsx(P,{id:B,label:"Base URL",hint:A("Remit's server calls this URL.",M?.baseUrl),error:I("BaseUrl"),children:s.jsx(q,{id:B,ref:j,className:"h-11",type:"url",inputMode:"url",value:o.baseUrl,placeholder:Re,autoComplete:"off",spellCheck:!1,required:ve(e),"aria-invalid":C("BaseUrl"),"aria-describedby":R(B,!0,I("BaseUrl")!==void 0),onChange:r=>D("BaseUrl",{baseUrl:r.target.value})})}),T&&!u&&s.jsxs("div",{children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-fg-muted",children:"API key"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[ee?s.jsx("span",{className:C("ApiKey")?"text-sm text-danger":"text-sm text-fg-muted",children:"provided by the deployment"}):s.jsx("span",{className:C("ApiKey")?"text-sm text-danger":"text-sm text-fg",children:"set"}),s.jsx("span",{className:"flex-1"}),s.jsx(S,{ref:z,variant:"secondary",className:"min-h-11","aria-invalid":C("ApiKey"),onClick:se,children:ee?"Use your own key":"Replace"})]})]}),we&&s.jsx(P,{id:F,label:u?"New API key":"API key",hint:u?"The key in use stays until you press Save.":void 0,error:ie,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Oe,{id:F,ref:Z,className:"h-11 flex-1",value:o.apiKey,placeholder:u?"Paste the new key":"Paste the key",autoComplete:"off",spellCheck:!1,"aria-invalid":C("ApiKey"),"aria-describedby":R(F,u,ie!==void 0),onChange:r=>D("ApiKey",{apiKey:r.target.value}),onKeyDown:r=>{r.key==="Escape"&&u&&(r.preventDefault(),r.stopPropagation(),te())}}),u&&s.jsx(S,{variant:"ghost",className:"min-h-11",onClick:te,children:"Cancel"})]})}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(S,{variant:"primary",className:"min-h-11","aria-disabled":i.isPending,onClick:()=>{i.isPending||Ue()},children:i.isPending?"Saving…":"Save"}),s.jsx(S,{variant:"secondary",className:"min-h-11","aria-disabled":n.isPending,"aria-busy":n.isPending,onClick:Pe,children:n.isPending?"Testing…":"Test connection"})]}),s.jsx("p",{"aria-live":"polite",className:"text-sm text-fg-muted empty:hidden",children:n.isPending?`Sending one sample message to ${e.label}`:""}),m&&s.jsx(xs,{result:m,presetLabel:e.label,onFix:O,shown:ke}),x&&s.jsx(w,{failure:x})]})}function bs({presets:e,settings:t,onAnnounce:a}){const[i,n]=l.useState(()=>G(t).presetId),o=fs(),[d,c]=l.useState(!1),[f,m]=l.useState(0),[h,u]=l.useState(null),b=l.useId(),x=e.find(p=>p.presetId===i),v=ns(t,i,e),y=t.state==="Configured"&&t.enabled,U=()=>{u(null),o.mutate({},{onSuccess:p=>{c(!1),n(G(p.classification).presetId),m(j=>j+1)},onError:p=>{c(!1),u({title:"The provider settings were not cleared",error:p})}})};return s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"flex min-h-11 items-center gap-3",children:[s.jsx("h2",{className:"flex-1 text-xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Provider"}),Je(t)&&s.jsx(S,{variant:"secondary",className:"min-h-11",onClick:()=>c(!0),children:"Clear"})]}),h&&s.jsx(w,{failure:h}),s.jsx(P,{id:b,label:"Provider",hint:x?os(x):void 0,children:s.jsxs(Ge,{id:b,className:"h-11",value:i??"",onChange:p=>n(e.find(j=>j.presetId===p.target.value)?.presetId),"aria-describedby":R(b,x!==void 0,!1),children:[s.jsx("option",{value:"",disabled:!0,children:"Choose a provider"}),ss(e).map(p=>s.jsx("optgroup",{label:p.label,children:p.presets.map(j=>s.jsx("option",{value:j.presetId,children:j.label},j.presetId))},p.group))]})}),v&&s.jsxs("p",{className:"text-sm text-warning",children:["Saving switches from ",v.label,k(t).sources?.apiKey===N.Saved?" and deletes its saved key.":"."]}),x&&s.jsx(ys,{preset:x,settings:t,onAnnounce:a},`${x.presetId}-${f}`),s.jsx(Qe,{isOpen:d,title:"Clear the provider settings?",description:y?"Classification is on. Clearing the provider switches it off, and new mail goes back to built-in rules. Every field returns to the deployment default.":"Clearing the provider returns every field to the deployment default.",confirmLabel:"Clear",destructive:!0,isBusy:o.isPending,onConfirm:U,onCancel:()=>c(!1)})]})}const ce="Mail classification settings did not load",de={[ne.NoBaseUrl]:"a base URL",[ne.NoApiKey]:"an API key"},gs=e=>{if(e.state==="NotConfigured")return"Save a provider below first. Until then, built-in rules label your mail.";if(e.state==="Unrunnable")return"The provider cannot run yet. Built-in rules label your mail.";const t=e.enabled?"New mail goes to the model. A failed call falls back to built-in rules.":"Provider saved. Built-in rules label your mail until you switch this on.";return A(t,e.sources.enabled)};function vs({settings:e}){return s.jsxs(K,{tone:"warning",variant:"soft",children:[s.jsxs("p",{className:"font-medium",children:["Classification cannot run without ",de[e.reason]]}),s.jsxs("p",{className:"mt-0.5 text-fg-muted",children:["Add ",de[e.reason]," below and save. Until then, built-in rules label your mail."]})]})}const js=e=>t=>{const a=e.find(i=>i.accountId===t);return a?.displayName?.trim()||a?.email||t};function Ns({on:e,capped:t}){return e?t?s.jsx(_,{tone:"warning",dot:!0,children:"cap reached"}):s.jsx(_,{tone:"positive",dot:!0,children:"on"}):s.jsx(_,{dot:!0,children:"off"})}function Ss({usage:e,preset:t,nameOf:a}){return s.jsx("dl",{className:"space-y-2",children:e.map(i=>s.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-3",children:[s.jsx("dt",{className:"min-w-0 truncate text-sm text-fg",children:a(i.accountId)}),s.jsxs("dd",{className:"text-right text-sm text-fg-muted",children:[s.jsxs("span",{className:"text-fg",children:[i.calls," / ",i.dailyLimit," calls"]})," ",s.jsxs("span",{className:"text-xs",children:[ds(i,t),Se(i)&&s.jsx("span",{className:"text-warning",children:" · limit reached"})]})]})]},i.accountId))})}function Is({first:e,capped:t,nameOf:a,onRaiseLimit:i}){const n=new Intl.ListFormat("en",{type:"conjunction"}).format(t.map(o=>a(o.accountId)));return s.jsxs(K,{tone:"warning",variant:"soft",children:[s.jsxs("p",{className:"font-medium",children:[n," reached the daily limit of ",e.dailyLimit," calls"]}),s.jsxs("p",{className:"mt-0.5 text-fg-muted",children:[t.length===1?"Its":"Their"," new mail uses built-in rules until ",Ie(e.resetsAt),"."]}),s.jsx(S,{variant:"secondary",className:"mt-2 min-h-11",onClick:i,children:"Raise the limit"})]})}function Cs({settings:e,presets:t,nameOf:a,onRaiseLimit:i}){const n=W(),[o,d]=l.useState(null),c=l.useId(),f=e.state==="Configured",m=f&&e.enabled,h=m?e.usage.filter(Se):[],[u]=h,b=()=>{d(null),n.mutate({body:{classificationEnabled:!m}},{onError:d})};return s.jsxs("section",{"aria-labelledby":`${c}-title`,className:"space-y-3",children:[s.jsx("h2",{id:`${c}-title`,className:"text-xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Status"}),s.jsxs("div",{className:"flex min-h-11 items-center gap-3",children:[s.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsx("span",{id:`${c}-label`,className:"text-sm text-fg",children:"Use the model"}),s.jsx("span",{id:`${c}-note`,className:"text-xs text-fg-subtle",children:gs(e)})]}),s.jsx(Ns,{on:m,capped:u!==void 0}),s.jsx(Xe,{checked:m,"aria-labelledby":`${c}-label`,"aria-describedby":`${c}-note`,"aria-disabled":!f||n.isPending,"aria-busy":n.isPending,onToggle:b})]}),e.state==="Unrunnable"&&s.jsx(vs,{settings:e}),u&&s.jsx(Is,{first:u,capped:h,nameOf:a,onRaiseLimit:i}),f&&s.jsx(Ss,{usage:e.usage,preset:t.find(x=>x.presetId===e.presetId),nameOf:a}),o!==null&&s.jsx(w,{failure:{title:m?"Classification was not switched off":"Classification was not switched on",error:o}})]})}function ue(){return s.jsx("div",{className:"h-48 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading mail classification settings"})}function ws(){const e=us(),t=me({...He(),staleTime:1/0}),[a,i]=l.useState(""),n=l.useRef(null),o=()=>{const f=n.current;f&&(f.focus(),f.select(),f.scrollIntoView({block:"center"}))};if(e.isPending)return s.jsx(ue,{});if(e.signedOut)return null;if(e.isError)return s.jsx(w,{failure:{title:ce,error:e.error},onRetry:()=>{e.refetch()}});if(t.isPending)return s.jsx(ue,{});if(t.isError)return s.jsx(w,{failure:{title:ce,error:t.error},onRetry:()=>{t.refetch()}});const{classification:d,classificationPresets:c}=e.data;return s.jsxs("div",{className:"max-w-xl space-y-8",children:[s.jsx(Cs,{settings:d,presets:c,nameOf:js(t.data.accounts),onRaiseLimit:o}),s.jsx(bs,{presets:c,settings:d,onAnnounce:i},d.state),d.state==="Configured"&&s.jsx(ps,{settings:d,inputRef:n,onAnnounce:i}),s.jsx("p",{"aria-live":"polite",className:"text-sm text-fg-muted",children:a})]})}const ks=s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{children:"A model labels new mail: spam and phishing, priority, personal, and a category. With classification off, or when a call fails, the built-in rules label it."}),s.jsx("p",{children:"The API key is stored encrypted on the server and never sent back to the browser. Test connection sends one built-in sample message, with the form as it stands, and changes nothing."})]});function Hs(){const e=_e(),t=qe(),a=Ye(),[i,n]=l.useState(!0);return s.jsx(We,{items:t,activeId:"classification",title:"Mail classification",description:"Label new mail with a model. Mail already in your folders keeps its labels.",help:ks,helpOpen:i,onToggleHelp:()=>n(o=>!o),onSelect:a,onBackToMail:()=>{e({to:"/mail"})},children:s.jsx(ws,{})})}export{Hs as component};
@@ -0,0 +1 @@
1
+ import{b as e}from"./index-BnBpXn45.js";const c={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};c.node;const a=e(c);export{a as C};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-C6ydcOqj.js";import"./index-BnBpXn45.js";import"./index-B7CBca9v.js";import"./useMessageBodyContent-DzlZ514L.js";import"./reply-CzX8Q1T1.js";import"./nav-link-CjSE3MDU.js";import"./useMediaQuery-DOpCuIgp.js";import"./useSignature-Boz2_w0h.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CahHw3v4.js";import"./suggest-list-DMRnmTaR.js";import"./sections-DsqY4M13.js";import"./chevron-down-CR89KUgK.js";import"./ErrorState-Czrn8Njd.js";import"./confirm-dialog-DYNhLVrG.js";const x=o;export{x as component};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-C6ydcOqj.js";import"./index-BnBpXn45.js";import"./index-B7CBca9v.js";import"./useMessageBodyContent-DzlZ514L.js";import"./reply-CzX8Q1T1.js";import"./nav-link-CjSE3MDU.js";import"./useMediaQuery-DOpCuIgp.js";import"./useSignature-Boz2_w0h.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CahHw3v4.js";import"./suggest-list-DMRnmTaR.js";import"./sections-DsqY4M13.js";import"./chevron-down-CR89KUgK.js";import"./ErrorState-Czrn8Njd.js";import"./confirm-dialog-DYNhLVrG.js";const x=o;export{x as component};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-C6ydcOqj.js";import"./index-BnBpXn45.js";import"./index-B7CBca9v.js";import"./useMessageBodyContent-DzlZ514L.js";import"./reply-CzX8Q1T1.js";import"./nav-link-CjSE3MDU.js";import"./useMediaQuery-DOpCuIgp.js";import"./useSignature-Boz2_w0h.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CahHw3v4.js";import"./suggest-list-DMRnmTaR.js";import"./sections-DsqY4M13.js";import"./chevron-down-CR89KUgK.js";import"./ErrorState-Czrn8Njd.js";import"./confirm-dialog-DYNhLVrG.js";const x=o;export{x as component};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-C6ydcOqj.js";import"./index-BnBpXn45.js";import"./index-B7CBca9v.js";import"./useMessageBodyContent-DzlZ514L.js";import"./reply-CzX8Q1T1.js";import"./nav-link-CjSE3MDU.js";import"./useMediaQuery-DOpCuIgp.js";import"./useSignature-Boz2_w0h.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CahHw3v4.js";import"./suggest-list-DMRnmTaR.js";import"./sections-DsqY4M13.js";import"./chevron-down-CR89KUgK.js";import"./ErrorState-Czrn8Njd.js";import"./confirm-dialog-DYNhLVrG.js";const x=o;export{x as component};
@@ -1 +1 @@
1
- import{aP as v,aQ as T}from"./index-9JWzpiiR.js";const k=e=>new Promise(n=>{n(JSON.parse(e))}),l=["accounts","labels","filters","addressFlags","settings"],g={accounts:"Accounts",labels:"Labels",filters:"Rules & filters",addressFlags:"Senders",settings:"Folders & appearance"},S=["created","updated","unchanged","skipped","rejected"],$={created:"positive",updated:"accent",unchanged:"neutral",skipped:"warning",rejected:"danger"},m=e=>S.includes(e)?e:"rejected",h="unknown",p=e=>l.includes(e)?e:void 0,I=e=>{const n=new Map;return e.forEach((t,i)=>{const a=p(t.section)??h,r=n.get(a)??[];r.push({id:`${a}-${t.key}-${i}`,label:t.key,verdict:m(t.verdict),reason:a===h?t.reason??`This instance does not know the "${t.section}" section, so it cannot say what this entry does.`:t.reason}),n.set(a,r)}),[...l,h].filter(t=>n.has(t)).map(t=>({id:t,title:t===h?"Not recognised":g[t],entries:n.get(t)??[]}))},j=e=>{const n={created:0,updated:0,unchanged:0,skipped:0,rejected:0};for(const o of e)n[m(o.verdict)]+=1;return n},E={NotAnObject:()=>({title:"That is not a Reader config file",explanation:"The file was read, but it is not a configuration document — a Reader config is a JSON object carrying a kind and a schemaVersion.",fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host."}),WrongKind:()=>({title:"That is not a Reader config file",explanation:"The file parses as JSON but does not declare itself a Reader configuration, so nothing here can be trusted to mean what it looks like.",fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host."}),UnsupportedVersion:e=>({title:"This file was written by a newer Reader",explanation:e.message||"The file declares a schema version this instance does not read, so importing it would drop settings it cannot understand.",fix:"Update this Reader, then import again. The file is unchanged and safe to keep."}),UnknownKeys:e=>({title:"The file contains settings this version does not know",explanation:"An unknown key is refused rather than quietly dropped: losing configuration without saying so is exactly what this feature exists to prevent.",fix:`Update this Reader, or remove the named keys from the file and import again. ${e.message}`}),CredentialPresent:()=>({title:"The file carries a credential",explanation:"A configuration document describes which credential an account needs; it never carries one. Reader refuses the file rather than importing around it — the secret may now be in your backups, your chat history, or a pull request.",fix:"Delete the field from the file and import again, then change that mailbox's password. Exports written by Reader never contain one."}),Malformed:e=>({title:"The file does not match the configuration format",explanation:"Every part of the document has to validate before anything is written, and this one does not.",fix:`Re-export it from the instance you are moving from. ${e.message}`}),duplicate_key:e=>({title:"The file names something twice",explanation:"A configuration names each account, label and filter once, so a document with two of the same key has no single answer to import.",fix:`Remove the duplicate and import again. ${e.message}`}),unknown_label:e=>({title:"A rule points at a label that is not here",explanation:"The file applies a label neither it nor this instance carries, so the rule would land doing nothing.",fix:`Add the label to the file, or create it here first, then import again. ${e.message}`}),unknown_account:e=>({title:"A rule points at an account that is not here",explanation:"The file files mail into a folder on an account it does not carry, so the rule has no destination to bind to.",fix:`Export the configuration again from an instance that holds both, then import that file. ${e.message}`})},R=e=>({title:"The file could not be imported",explanation:e.message||"The import was refused and nothing was written.",fix:"Re-export the configuration from the instance you are moving from and try again. If it keeps failing, report it with the line below."}),x="import_write_failed",N="config_not_empty",F=e=>{const n=v(e);if(n!==void 0&&n!==409)return;const o=e instanceof T?e.body:e;if(typeof o!="object"||o===null)return;const t=o;if(t.code===N)return{message:typeof t.message=="string"?t.message:"",details:typeof t.details=="object"&&t.details!==null?t.details:void 0}},C=e=>{const n=e.errors.find(t=>t.code!==x);return n?{...(E[n.code]??R)(n),raw:`${n.code}: ${n.message}`}:void 0},O=e=>e.errors.find(n=>n.code===x),w="Nothing from this section was written.",D=e=>{const n=O(e),o=n?.details?.section,t=o?p(o):void 0,i=!e.applied,a=new Map;for(const s of e.items){if(m(s.verdict)==="rejected")continue;const c=p(s.section);c&&a.set(c,(a.get(c)??0)+1)}const r=(s,c)=>l.map(d=>({section:d,title:g[d],state:s,detail:c}));if(!t){if(i)return r("not-landed",w);const s=o?`The import stopped in "${o}", which this instance does not recognise, so it cannot say whether this section was written.`:"The import stopped without naming where, so it cannot say whether this section was written. Open Settings to see what is here.";return r("unknown",s)}const f=l.indexOf(t);return l.map((s,c)=>{const d=g[s];if(s===t)return{section:s,title:d,state:"failed",detail:n?.message??"This section could not be written."};if(c>f)return{section:s,title:d,state:"not-attempted",detail:"Not attempted — the import stopped before this section."};if(i)return{section:s,title:d,state:"not-landed",detail:w};const u=a.get(s)??0;return{section:s,title:d,state:"landed",detail:u===0?"Nothing in the file for this section.":`${u} ${u===1?"entry":"entries"} written.`}})},_="folder_not_found_yet",L=e=>{const n=new Set,o=[];for(const t of e.warnings){if(t.code!==_)continue;const i=t.details?.folderPath;if(!i)continue;const a=t.details?.filter,r=t.details?.accountId,f=`${r??""}:${i}:${a??""}`;n.has(f)||(n.add(f),o.push({path:i,accountId:r,waitingFor:a?`Rule “${a}”`:"A folder role or a folder's own settings"}))}return o},y=2*1024*1024,b=Symbol("not json"),P=async(e,n,o)=>{if(n>y)return{ok:!1,failure:{title:"That file is too large to be a config file",explanation:`${e} is ${Math.round(n/1024)} kB. A Reader configuration is tens of kilobytes; a file this size is something else.`,fix:"Pick the .json file written by Settings › Advanced, or by remit config save.",raw:`${n} bytes > ${y} byte limit`}};let t="";const i=await k(o).catch(a=>(t=a instanceof Error?a.message:String(a),b));return i===b?{ok:!1,failure:{title:"That file is not JSON",explanation:`${e} could not be read as JSON at all, so there is nothing in it to import.`,fix:"Pick the .json file written by Settings › Advanced, or by remit config save.",raw:t}}:typeof i!="object"||i===null||Array.isArray(i)?{ok:!1,failure:{title:"That is not a Reader config file",explanation:`${e} is valid JSON but not a configuration document — a Reader config is a JSON object carrying a kind and a schemaVersion.`,fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host.",raw:`expected a JSON object, found ${Array.isArray(i)?"an array":typeof i}`}}:{ok:!0,document:i}},J=e=>`reader-config.${e.toISOString().slice(0,10)}.json`,U=e=>e<1024?`${e} B`:`${Math.round(e/1024)} kB`;export{x as W,F as a,C as b,j as c,J as e,U as f,I as g,L as p,P as r,D as s,$ as v,O as w};
1
+ import{aP as v,aQ as T}from"./index-BnBpXn45.js";const k=e=>new Promise(n=>{n(JSON.parse(e))}),l=["accounts","labels","filters","addressFlags","settings"],g={accounts:"Accounts",labels:"Labels",filters:"Rules & filters",addressFlags:"Senders",settings:"Folders & appearance"},S=["created","updated","unchanged","skipped","rejected"],$={created:"positive",updated:"accent",unchanged:"neutral",skipped:"warning",rejected:"danger"},m=e=>S.includes(e)?e:"rejected",h="unknown",p=e=>l.includes(e)?e:void 0,I=e=>{const n=new Map;return e.forEach((t,i)=>{const a=p(t.section)??h,r=n.get(a)??[];r.push({id:`${a}-${t.key}-${i}`,label:t.key,verdict:m(t.verdict),reason:a===h?t.reason??`This instance does not know the "${t.section}" section, so it cannot say what this entry does.`:t.reason}),n.set(a,r)}),[...l,h].filter(t=>n.has(t)).map(t=>({id:t,title:t===h?"Not recognised":g[t],entries:n.get(t)??[]}))},j=e=>{const n={created:0,updated:0,unchanged:0,skipped:0,rejected:0};for(const o of e)n[m(o.verdict)]+=1;return n},E={NotAnObject:()=>({title:"That is not a Reader config file",explanation:"The file was read, but it is not a configuration document — a Reader config is a JSON object carrying a kind and a schemaVersion.",fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host."}),WrongKind:()=>({title:"That is not a Reader config file",explanation:"The file parses as JSON but does not declare itself a Reader configuration, so nothing here can be trusted to mean what it looks like.",fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host."}),UnsupportedVersion:e=>({title:"This file was written by a newer Reader",explanation:e.message||"The file declares a schema version this instance does not read, so importing it would drop settings it cannot understand.",fix:"Update this Reader, then import again. The file is unchanged and safe to keep."}),UnknownKeys:e=>({title:"The file contains settings this version does not know",explanation:"An unknown key is refused rather than quietly dropped: losing configuration without saying so is exactly what this feature exists to prevent.",fix:`Update this Reader, or remove the named keys from the file and import again. ${e.message}`}),CredentialPresent:()=>({title:"The file carries a credential",explanation:"A configuration document describes which credential an account needs; it never carries one. Reader refuses the file rather than importing around it — the secret may now be in your backups, your chat history, or a pull request.",fix:"Delete the field from the file and import again, then change that mailbox's password. Exports written by Reader never contain one."}),Malformed:e=>({title:"The file does not match the configuration format",explanation:"Every part of the document has to validate before anything is written, and this one does not.",fix:`Re-export it from the instance you are moving from. ${e.message}`}),duplicate_key:e=>({title:"The file names something twice",explanation:"A configuration names each account, label and filter once, so a document with two of the same key has no single answer to import.",fix:`Remove the duplicate and import again. ${e.message}`}),unknown_label:e=>({title:"A rule points at a label that is not here",explanation:"The file applies a label neither it nor this instance carries, so the rule would land doing nothing.",fix:`Add the label to the file, or create it here first, then import again. ${e.message}`}),unknown_account:e=>({title:"A rule points at an account that is not here",explanation:"The file files mail into a folder on an account it does not carry, so the rule has no destination to bind to.",fix:`Export the configuration again from an instance that holds both, then import that file. ${e.message}`})},R=e=>({title:"The file could not be imported",explanation:e.message||"The import was refused and nothing was written.",fix:"Re-export the configuration from the instance you are moving from and try again. If it keeps failing, report it with the line below."}),x="import_write_failed",N="config_not_empty",F=e=>{const n=v(e);if(n!==void 0&&n!==409)return;const o=e instanceof T?e.body:e;if(typeof o!="object"||o===null)return;const t=o;if(t.code===N)return{message:typeof t.message=="string"?t.message:"",details:typeof t.details=="object"&&t.details!==null?t.details:void 0}},C=e=>{const n=e.errors.find(t=>t.code!==x);return n?{...(E[n.code]??R)(n),raw:`${n.code}: ${n.message}`}:void 0},O=e=>e.errors.find(n=>n.code===x),w="Nothing from this section was written.",D=e=>{const n=O(e),o=n?.details?.section,t=o?p(o):void 0,i=!e.applied,a=new Map;for(const s of e.items){if(m(s.verdict)==="rejected")continue;const c=p(s.section);c&&a.set(c,(a.get(c)??0)+1)}const r=(s,c)=>l.map(d=>({section:d,title:g[d],state:s,detail:c}));if(!t){if(i)return r("not-landed",w);const s=o?`The import stopped in "${o}", which this instance does not recognise, so it cannot say whether this section was written.`:"The import stopped without naming where, so it cannot say whether this section was written. Open Settings to see what is here.";return r("unknown",s)}const f=l.indexOf(t);return l.map((s,c)=>{const d=g[s];if(s===t)return{section:s,title:d,state:"failed",detail:n?.message??"This section could not be written."};if(c>f)return{section:s,title:d,state:"not-attempted",detail:"Not attempted — the import stopped before this section."};if(i)return{section:s,title:d,state:"not-landed",detail:w};const u=a.get(s)??0;return{section:s,title:d,state:"landed",detail:u===0?"Nothing in the file for this section.":`${u} ${u===1?"entry":"entries"} written.`}})},_="folder_not_found_yet",L=e=>{const n=new Set,o=[];for(const t of e.warnings){if(t.code!==_)continue;const i=t.details?.folderPath;if(!i)continue;const a=t.details?.filter,r=t.details?.accountId,f=`${r??""}:${i}:${a??""}`;n.has(f)||(n.add(f),o.push({path:i,accountId:r,waitingFor:a?`Rule “${a}”`:"A folder role or a folder's own settings"}))}return o},y=2*1024*1024,b=Symbol("not json"),P=async(e,n,o)=>{if(n>y)return{ok:!1,failure:{title:"That file is too large to be a config file",explanation:`${e} is ${Math.round(n/1024)} kB. A Reader configuration is tens of kilobytes; a file this size is something else.`,fix:"Pick the .json file written by Settings › Advanced, or by remit config save.",raw:`${n} bytes > ${y} byte limit`}};let t="";const i=await k(o).catch(a=>(t=a instanceof Error?a.message:String(a),b));return i===b?{ok:!1,failure:{title:"That file is not JSON",explanation:`${e} could not be read as JSON at all, so there is nothing in it to import.`,fix:"Pick the .json file written by Settings › Advanced, or by remit config save.",raw:t}}:typeof i!="object"||i===null||Array.isArray(i)?{ok:!1,failure:{title:"That is not a Reader config file",explanation:`${e} is valid JSON but not a configuration document — a Reader config is a JSON object carrying a kind and a schemaVersion.`,fix:"Export one from Settings › Advanced on the instance you are moving from, or run remit config save on its host.",raw:`expected a JSON object, found ${Array.isArray(i)?"an array":typeof i}`}}:{ok:!0,document:i}},J=e=>`reader-config.${e.toISOString().slice(0,10)}.json`,U=e=>e<1024?`${e} B`:`${Math.round(e/1024)} kB`;export{x as W,F as a,C as b,j as c,J as e,U as f,I as g,L as p,P as r,D as s,$ as v,O as w};
@@ -1 +1 @@
1
- import{r as u,n as x,o as f,j as e,D as b,p as t}from"./index-9JWzpiiR.js";const h=({isOpen:s,title:r,description:n,confirmLabel:l,cancelLabel:o="Cancel",destructive:c=!1,isBusy:d=!1,onConfirm:m,onCancel:a})=>{const i=u.useRef(null);return x({id:"confirm-dialog",open:s,answers:{back:a}}),f(i,s),s?e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[e.jsx(b,{label:"Dismiss confirmation",onDismiss:a,className:"backdrop-blur-sm"}),e.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,className:t("relative z-10 w-full max-w-sm","bg-surface border border-line rounded-sm shadow-lg","p-6"),children:[e.jsx("h2",{className:"text-lg font-semibold",children:r}),n&&e.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:n}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:a,className:t("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors","border border-line hover:bg-surface-raised"),children:o}),e.jsx("button",{type:"button",onClick:m,disabled:d,className:t("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors",c?"bg-danger text-canvas hover:bg-danger/90":"bg-accent text-accent-fg hover:bg-accent-hover","disabled:opacity-50 disabled:cursor-not-allowed"),children:l})]})]})]}):null};export{h as C};
1
+ import{r as u,n as x,o as f,j as e,D as b,p as t}from"./index-BnBpXn45.js";const h=({isOpen:s,title:r,description:n,confirmLabel:l,cancelLabel:o="Cancel",destructive:c=!1,isBusy:d=!1,onConfirm:m,onCancel:a})=>{const i=u.useRef(null);return x({id:"confirm-dialog",open:s,answers:{back:a}}),f(i,s),s?e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[e.jsx(b,{label:"Dismiss confirmation",onDismiss:a,className:"backdrop-blur-sm"}),e.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,className:t("relative z-10 w-full max-w-sm","bg-surface border border-line rounded-sm shadow-lg","p-6"),children:[e.jsx("h2",{className:"text-lg font-semibold",children:r}),n&&e.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:n}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:a,className:t("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors","border border-line hover:bg-surface-raised"),children:o}),e.jsx("button",{type:"button",onClick:m,disabled:d,className:t("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors",c?"bg-danger text-canvas hover:bg-danger/90":"bg-accent text-accent-fg hover:bg-accent-hover","disabled:opacity-50 disabled:cursor-not-allowed"),children:l})]})]})]}):null};export{h as C};
@@ -0,0 +1 @@
1
+ import{b as c}from"./index-BnBpXn45.js";const e={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};e.node;const t=c(e);export{t as C};
@@ -0,0 +1 @@
1
+ import{b as B,j as t,aq as q,p as E,r as n,aG as R,ao as C,f as G,am as X,d as J,ap as K,B as N}from"./index-BnBpXn45.js";import{S as D}from"./select-DWBegMNA.js";import{B as Q}from"./badge-C7MFP1pN.js";import{C as Y}from"./card-5b65wlka.js";const H={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};H.node;const ht=B(H);function Z({url:r}){return t.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Stored encrypted, used only to connect to your mail server."," ",r?t.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"How to create an app password"}):t.jsx("span",{children:"Check your provider's help for app password instructions."})]})}function F({value:r,defaultValue:i,onValueChange:s,...e}){return s?t.jsxs(D,{value:r,onChange:a=>s(a.target.value),...e,children:[t.jsx("option",{value:"tls",children:"TLS/SSL"}),t.jsx("option",{value:"starttls",children:"STARTTLS"}),t.jsx("option",{value:"none",children:"None (insecure)"})]}):t.jsxs(D,{defaultValue:i??r,...e,children:[t.jsx("option",{value:"tls",children:"TLS/SSL"}),t.jsx("option",{value:"starttls",children:"STARTTLS"}),t.jsx("option",{value:"none",children:"None (insecure)"})]})}function M(r){return{tls:r==="tls",startTls:r==="starttls"}}function tt({steps:r,activeStep:i}){return t.jsx("ol",{className:"flex items-center gap-1",children:r.map((s,e)=>{const a=e<i,o=e===i;return t.jsxs("li",{className:"flex items-center gap-1",children:[e>0&&t.jsx("span",{className:"h-px w-5 bg-line","aria-hidden":!0}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:E("flex size-5 items-center justify-center rounded-full text-2xs font-semibold tabular-nums",a&&"bg-accent text-accent-fg",o&&"bg-accent-soft text-accent ring-1 ring-accent",!a&&!o&&"bg-surface-sunken text-fg-subtle"),children:a?t.jsx(q,{className:"size-3"}):e+1}),t.jsx("span",{className:E("hidden text-2xs sm:inline",o?"font-medium text-fg":"text-fg-subtle"),children:s})]})]},s)})})}function U({steps:r,activeStep:i,title:s,subtitle:e,children:a,footer:o,hideSteps:c}){return t.jsxs("div",{className:"flex h-dvh w-full flex-col items-center overflow-hidden bg-canvas pb-[max(2rem,env(safe-area-inset-bottom,0px))] pl-[max(2rem,env(safe-area-inset-left,0px))] pr-[max(2rem,env(safe-area-inset-right,0px))] pt-[max(2rem,env(safe-area-inset-top,0px))] font-sans text-fg",children:[t.jsx("div",{className:"hidden shrink-[9999] basis-[30vh] sm:block"}),!c&&t.jsx("div",{className:"mb-5 w-full max-w-xl shrink-0",children:t.jsx(tt,{steps:r,activeStep:i})}),t.jsxs(Y,{raised:!0,className:"flex w-full min-h-0 max-w-xl flex-col",children:[t.jsxs("div",{className:"shrink-0 px-5 pt-5",children:[t.jsx("h1",{className:"text-xl font-semibold text-fg",children:s}),e&&t.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:e})]}),t.jsx("div",{"data-testid":"wizard-body",className:"min-h-0 overflow-y-auto px-5 py-5",children:a}),o&&t.jsx("div",{"data-testid":"wizard-footer",className:"flex shrink-0 items-center justify-between gap-3 border-t border-line px-5 py-3",children:o})]})]})}const et="Coming soon — use IMAP for now.";function xt({name:r,description:i,icon:s,comingSoon:e,selected:a,onSelect:o}){const[c,l]=n.useState(!1),m=()=>{if(o){o();return}e&&l(!0)};return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("button",{type:"button",onClick:m,"aria-disabled":e||void 0,className:E("flex flex-col items-start gap-2 rounded-sm border p-3 text-left transition-colors",a?"border-accent-2 bg-accent-2-soft":"border-line bg-surface hover:border-line-strong",e&&"opacity-55"),children:[t.jsx("span",{className:E("text-fg-muted",a&&"text-accent-2"),children:s}),t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-semibold text-fg",children:r}),e&&t.jsx("span",{className:"rounded-full bg-surface-sunken px-1.5 py-0.5 text-2xs text-fg-subtle",children:"soon"})]}),t.jsx("span",{className:"text-xs text-fg-subtle",children:i})]}),c&&t.jsx("p",{className:"text-2xs text-fg-subtle",children:et})]})}function ft({legend:r,badge:i,host:s,port:e,security:a,readOnly:o,onHostChange:c,onPortChange:l,onSecurityChange:m,hostPlaceholder:x,portPlaceholder:y}){const v=n.useId(),b=n.useId(),h=n.useId();return t.jsxs("fieldset",{children:[t.jsxs("legend",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[r,i&&t.jsx(Q,{tone:i.tone,children:i.label})]}),t.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-3 sm:grid-cols-[1fr_6rem_8rem] sm:gap-2",children:[t.jsxs("div",{children:[t.jsx(R,{htmlFor:v,children:"Host"}),c?t.jsx(C,{id:v,readOnly:o,value:s,onChange:p=>c(p.target.value),placeholder:x}):t.jsx(C,{id:v,readOnly:o,defaultValue:s,placeholder:x})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:b,children:"Port"}),l?t.jsx(C,{id:b,readOnly:o,value:e,onChange:p=>l(p.target.value),placeholder:y}):t.jsx(C,{id:b,readOnly:o,defaultValue:e,placeholder:y})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:h,children:"Security"}),m?t.jsx(F,{id:h,disabled:o,value:a,onValueChange:m}):t.jsx(F,{id:h,disabled:o,defaultValue:a})]})]})]})}function _({label:r,detail:i,state:s}){return t.jsxs("div",{className:"flex items-start gap-3 py-2",children:[t.jsxs("span",{className:E("mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full text-2xs",s==="ok"&&"bg-positive text-accent-fg",s==="failed"&&"bg-danger text-accent-fg",s==="running"&&"border border-accent text-accent",s==="pending"&&"border border-line text-fg-subtle"),children:[s==="ok"&&t.jsx(q,{className:"size-3"}),s==="failed"&&"!",s==="running"&&t.jsx("span",{className:"size-2 animate-pulse rounded-full bg-accent"})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:E("text-sm",s==="failed"?"font-medium text-danger":"text-fg"),children:r}),i&&t.jsx("div",{className:"mt-0.5 text-xs text-fg-subtle",children:i})]})]})}const st=(r,i)=>{const s=n.useRef(i);s.current=i,n.useEffect(()=>{if(!r)return;const e=()=>{document.visibilityState==="visible"&&s.current()};return document.addEventListener("visibilitychange",e),window.addEventListener("pageshow",e),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("pageshow",e)}},[r])},rt=2e4,gt="Couldn't open Microsoft's sign-in page. Check your connection, and anything blocking redirects, then try again.",yt=r=>{const i=n.useRef(!1),s=n.useRef(!1),e=n.useRef(null),a=n.useRef(r);a.current=r;const o=n.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),c=n.useCallback(()=>{!i.current||!s.current||(o(),s.current=!1,a.current("returned"))},[o]);return n.useEffect(()=>{const l=()=>{s.current=!0,o()},m=()=>{document.visibilityState==="hidden"&&l()},x=y=>{y.persisted&&(l(),c())};return document.addEventListener("visibilitychange",m),window.addEventListener("pagehide",l),window.addEventListener("pageshow",x),()=>{document.removeEventListener("visibilitychange",m),window.removeEventListener("pagehide",l),window.removeEventListener("pageshow",x),o()}},[c,o]),st(!0,c),n.useCallback(()=>{i.current=!0,s.current=!1,o(),e.current=setTimeout(()=>{e.current=null,i.current=!1,s.current=!1,a.current("stalled")},rt)},[o])},ot={"gmail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"googlemail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"outlook.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"hotmail.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"live.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"msn.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"icloud.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"me.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"mac.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"fastmail.com":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"fastmail.fm":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"yahoo.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"yahoo.co.uk":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"ymail.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"aol.com":{imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},source:"provider-table"},"zoho.com":{imap:{host:"imap.zoho.com",port:993,security:"tls"},smtp:{host:"smtp.zoho.com",port:465,security:"tls"},source:"provider-table"},"gmx.com":{imap:{host:"imap.gmx.com",port:993,security:"tls"},smtp:{host:"smtp.gmx.com",port:587,security:"starttls"},source:"provider-table"},"gmx.net":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"gmx.de":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"web.de":{imap:{host:"imap.web.de",port:993,security:"tls"},smtp:{host:"smtp.web.de",port:587,security:"starttls"},source:"provider-table"},"mail.com":{imap:{host:"imap.mail.com",port:993,security:"tls"},smtp:{host:"smtp.mail.com",port:465,security:"tls"},source:"provider-table"},"hey.com":{imap:{host:"imap.hey.com",port:993,security:"tls"},smtp:{host:"smtp.hey.com",port:465,security:"tls"},source:"provider-table"},"tutanota.com":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"tuta.io":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"posteo.de":{imap:{host:"posteo.de",port:993,security:"tls"},smtp:{host:"posteo.de",port:465,security:"tls"},source:"provider-table"},"runbox.com":{imap:{host:"imap.runbox.com",port:993,security:"tls"},smtp:{host:"smtp.runbox.com",port:587,security:"starttls"},source:"provider-table"},"mailbox.org":{imap:{host:"imap.mailbox.org",port:993,security:"tls"},smtp:{host:"smtp.mailbox.org",port:465,security:"tls"},source:"provider-table"},"hushmail.com":{imap:{host:"imap.hushmail.com",port:993,security:"tls"},smtp:{host:"smtp.hushmail.com",port:465,security:"tls"},source:"provider-table"}},it={"gmail.com":"https://support.google.com/accounts/answer/185833","googlemail.com":"https://support.google.com/accounts/answer/185833","yahoo.com":"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html","icloud.com":"https://support.apple.com/en-us/102654","me.com":"https://support.apple.com/en-us/102654","mac.com":"https://support.apple.com/en-us/102654","fastmail.com":"https://www.fastmail.help/hc/en-us/articles/360058752854","fastmail.fm":"https://www.fastmail.help/hc/en-us/articles/360058752854","outlook.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","hotmail.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","zoho.com":"https://help.zoho.com/portal/en/kb/zoho-mail/client-configuration/imap-access/articles/zoho-mail-app-passwords"};function V(r){try{const s=new DOMParser().parseFromString(r,"application/xml");if(s.querySelector("parsererror"))return null;const e=s.querySelectorAll("incomingServer[type='imap']"),a=s.querySelectorAll("outgoingServer[type='smtp']");if(!e.length||!a.length)return null;const o=e[0],c=a[0],l=o.querySelector("hostname")?.textContent?.trim(),m=o.querySelector("port")?.textContent?.trim(),x=o.querySelector("socketType")?.textContent?.trim().toUpperCase(),y=c.querySelector("hostname")?.textContent?.trim(),v=c.querySelector("port")?.textContent?.trim(),b=c.querySelector("socketType")?.textContent?.trim().toUpperCase();if(!l||!m||!y||!v)return null;const h=p=>p==="SSL"||p==="TLS"||p==="SSL/TLS"?"tls":p==="STARTTLS"?"starttls":"none";return{imap:{host:l,port:Number.parseInt(m,10),security:h(x)},smtp:{host:y,port:Number.parseInt(v,10),security:h(b)},source:"mozilla-autoconfig"}}catch{return null}}async function at(r,i){try{const s=`https://autoconfig.thunderbird.net/v1.1/${r}`,e=await fetch(s,{signal:i});if(!e.ok)return null;const a=await e.text(),o=V(a);return o||null}catch{return null}}async function nt(r,i){try{const s=`https://autoconfig.${r}/mail/config-v1.1.xml`,e=await fetch(s,{signal:i});if(!e.ok)return null;const a=await e.text(),o=V(a);return o?{...o,source:"domain-autoconfig"}:null}catch{return null}}function ct(r){return{imap:{host:`imap.${r}`,port:993,security:"tls"},smtp:{host:`smtp.${r}`,port:587,security:"starttls"},source:"heuristic"}}async function vt(r,i=1500){const s=r.indexOf("@");if(s===-1)return null;const e=r.slice(s+1).toLowerCase();if(!e)return null;const a=ot[e];if(a)return a;const o=new AbortController,c=setTimeout(()=>o.abort(),i);try{const l=await at(e,o.signal);if(l)return l;const m=await nt(e,o.signal);if(m)return m}finally{clearTimeout(c)}return ct(e)}function bt(r){const i=r.indexOf("@");return i===-1?"Looking up server settings…":`Looking up settings for ${r.slice(i+1)}…`}function lt(r){const i=r.indexOf("@");if(i===-1)return;const s=r.slice(i+1).toLowerCase();return it[s]}function wt({steps:r,activeStep:i,title:s,subtitle:e,email:a,username:o,password:c,notice:l,error:m,continueLabel:x="Test connection",backLabel:y="Back",onContinue:v,onBack:b,onChange:h}){const[p,z]=n.useState(o||a),[S,w]=n.useState(c),[T,k]=n.useState(null),I=lt(a),g=p.trim()!==""&&S.trim()!=="";n.useEffect(()=>{h(p,S)},[p,S,h]);const L=n.useCallback(()=>{if(!g){k("Enter your username and password.");return}k(null),v()},[g,v]);return n.useEffect(()=>{const u=j=>{j.key==="Enter"&&L(),j.key==="Escape"&&b()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[L,b]),t.jsx(U,{steps:r,activeStep:i,title:s,subtitle:e,footer:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:b,children:y}),t.jsx(N,{variant:"primary",onClick:L,children:x})]}),children:t.jsxs("div",{className:"space-y-3",children:[m&&t.jsx(J,{tone:"danger",children:m}),T&&t.jsx("div",{className:"rounded-md bg-danger-soft px-3 py-2 text-sm text-danger",children:T}),l,t.jsxs("div",{children:[t.jsx(R,{htmlFor:"credentials-username",children:"Username"}),t.jsx(C,{id:"credentials-username",value:p,onChange:u=>{z(u.target.value),k(null)},autoComplete:"username"})]}),t.jsxs("div",{children:[t.jsx(R,{htmlFor:"credentials-password",children:"Password or app password"}),t.jsx(K,{id:"credentials-password",value:S,onChange:u=>{w(u.target.value),k(null)},autoComplete:"current-password"})]}),t.jsx(Z,{url:I})]})})}function jt({steps:r,activeStep:i,email:s,imapConfig:e,smtpConfig:a,username:o,password:c,onSuccess:l,onBackToCredentials:m,onBackToServers:x,credentialsBackLabel:y="Back to credentials",serversBackLabel:v="Back to servers",successLabel:b="Start syncing"}){const[h,p]=n.useState({imapState:"running",smtpState:"pending",phase:"running"}),[z,S]=n.useState(0),w=a.host.trim()!=="",T=M(e.security),k=M(a.security),I=G({...X()});n.useEffect(()=>{let u=!1;const j=[];return p({imapState:"running",smtpState:"pending",phase:"running"}),I.mutate({body:{username:o,password:c,imapHost:e.host,imapPort:e.port,imapTls:T.tls,imapStartTls:T.startTls,smtpHost:a.host,smtpPort:a.port,smtpTls:k.tls,smtpStartTls:k.startTls}},{onSuccess:d=>{if(u)return;const f=d.imapSuccess,P=w?d.smtpSuccess:!0;p({imapState:f?"ok":"failed",smtpState:w?"running":"ok",imapDetail:f?`Connected — ${e.host}:${e.port}`:d.imapError,phase:"running"}),j.push(window.setTimeout(()=>{if(u)return;const $=W=>{const A=W?.toLowerCase()??"";return A.includes("auth")||A.includes("login")||A.includes("535")||A.includes("credential")},O=!f&&$(d.imapError)||f&&w&&!d.smtpSuccess&&$(d.smtpError);p({imapState:f?"ok":"failed",smtpState:w?d.smtpSuccess?"ok":"failed":"ok",imapDetail:f?`Connected — ${e.host}:${e.port}`:d.imapError,smtpDetail:w?d.smtpSuccess?`Connected — ${a.host}:${a.port}`:d.smtpError:"Not set up — receive-only",rawError:f?w&&!d.smtpSuccess?d.smtpError:void 0:d.imapError,phase:f&&P?"success":O?"auth-failure":"network-failure"}),f&&P&&j.push(window.setTimeout(()=>{u||l()},800))},400))},onError:d=>{if(u)return;const f=d instanceof Error?d.message:"Connection failed";p({imapState:"failed",smtpState:"failed",imapDetail:f,smtpDetail:f,rawError:f,phase:"network-failure"})}}),()=>{u=!0;for(const d of j)window.clearTimeout(d)}},[z]);const{phase:g}=h;n.useEffect(()=>{const u=j=>{j.key==="Escape"&&(g==="auth-failure"?m():g==="network-failure"&&x())};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[g,m,x]);const L=g==="auth-failure"?t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:m,children:y}),t.jsx(N,{variant:"primary",onClick:()=>S(u=>u+1),children:"Retry"})]}):g==="network-failure"?t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",onClick:x,children:v}),t.jsx(N,{variant:"primary",onClick:()=>S(u=>u+1),children:"Retry"})]}):g==="success"?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-2xs text-fg-subtle",children:"Connection verified"}),t.jsx(N,{variant:"primary",onClick:l,children:b})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-2xs text-fg-subtle",children:"Testing…"}),t.jsx("span",{})]});return t.jsx(U,{steps:r,activeStep:i,title:"Testing the connection",subtitle:`Checking ${s}`,footer:L,children:t.jsxs("div",{className:"divide-y divide-line",children:[t.jsx(_,{label:`IMAP — ${e.host}:${e.port}`,detail:h.imapDetail,state:h.imapState}),t.jsx(_,{label:w?`SMTP — ${a.host}:${a.port}`:"SMTP — sending",detail:w?h.smtpDetail:"Not set up — you can add sending later in Settings",state:h.smtpState}),(g==="auth-failure"||g==="network-failure")&&h.rawError&&t.jsxs("div",{className:"py-3",children:[g==="auth-failure"&&t.jsx("p",{className:"mb-2 text-xs text-fg-muted",children:"Check your password — many providers require an app password."}),t.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:h.rawError})]})]})})}export{it as A,_ as C,gt as R,ht as S,U as W,xt as a,yt as b,jt as c,wt as d,ft as e,bt as f,lt as g,vt as h,M as s,st as u};
@@ -0,0 +1 @@
1
+ import{b as o}from"./index-BnBpXn45.js";const a={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};a.node;const n=o(a);export{n as D};
@@ -1 +1 @@
1
- import{en as g,c6 as Y,ep as B}from"./index-9JWzpiiR.js";import{q as F}from"./agenda-time-hKUG2dhl.js";import{i as x}from"./calendar-guests-7MqnVXzX.js";const m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["SU","MO","TU","WE","TH","FR","SA"],E=["January","February","March","April","May","June","July","August","September","October","November","December"],$=["first","second","third","fourth","last"],D=[1,2,3,4,-1],N="MO,TU,WE,TH,FR",L=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(e){const t=L(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${N}`;const a=t.match(/^Every week on (\w+)$/);if(a){const i=m.indexOf(a[1]);return i===-1?void 0:`FREQ=WEEKLY;BYDAY=${l[i]}`}const r=t.match(/^Every month on the (\w+) (\w+)$/);if(r){const i=$.indexOf(r[1]),n=m.indexOf(r[2]);return i===-1||n===-1?void 0:`FREQ=MONTHLY;BYDAY=${D[i]}${l[n]}`}const o=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(o){const i=E.indexOf(o[2]);return i===-1?void 0:`FREQ=YEARLY;BYMONTH=${i+1};BYMONTHDAY=${Number(o[1])}`}}const w=e=>e===""?"":`, ${e}`;function S(e,t){const a=new Map(e.split(";").map(n=>n.split("=")).filter(n=>n.length===2).map(([n,c])=>[n.toUpperCase(),c.toUpperCase()])),r=w(t),o=a.get("FREQ"),i=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(o==="DAILY")return`Every day${r}`;if(o==="WEEKLY"){if(i===void 0)return;if(i===N)return`Every weekday${r}`;const n=l.indexOf(i);return n===-1?void 0:`Every week on ${m[n]}${r}`}if(o==="MONTHLY"){const n=i?.match(/^(-?\d)([A-Z]{2})$/);if(!n)return;const c=D.indexOf(Number(n[1])),s=l.indexOf(n[2]);return c===-1||s===-1?void 0:`Every month on the ${$[c]} ${m[s]}${r}`}if(o==="YEARLY"){const n=Number(a.get("BYMONTH")),c=Number(a.get("BYMONTHDAY"));return!n||!c||n>12?void 0:`Every year on ${c} ${E[n-1]}${r}`}}}const f=e=>Date.parse(`${e}T00:00:00Z`)/864e5;function C(e,t,a){const r=f(a)-f(t);if(e===""||r===0||Number.isNaN(r))return e;const[o,i,n]=a.split("-").map(Number),c=new Date(Date.UTC(o,i-1,n)).getUTCDay(),s=/FREQ=(\w+)/i.exec(e)?.[1]?.toUpperCase();return e.split(";").map(u=>{const[y,R=""]=u.split("="),d=y.toUpperCase();return d==="BYDAY"&&s==="MONTHLY"?`BYDAY=${D[Math.min(Math.floor((n-1)/7),4)]}${l[c]}`:d==="BYDAY"?`BYDAY=${R.split(",").map(p=>{const T=l.indexOf(p.toUpperCase());return T===-1?p:l[(T+r+7)%7]}).join(",")}`:d==="BYMONTH"?`BYMONTH=${i}`:d==="BYMONTHDAY"?`BYMONTHDAY=${n}`:u}).join(";")}function b(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:[],notes:"",repeat:""}}function W(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endDate:F(e),endTime:e.allDay?"":e.end.slice(11,16),allDay:e.allDay,calendarId:e.calendarId,location:t.location,guests:t.guests,notes:t.notes,repeat:t.repeat}}function A(e,t){return e.allDay?{start:e.date,end:g(e.endDate,1)}:{start:Y(e.date,e.startTime,t),end:Y(e.endDate,e.endTime,t)}}function M(e,t,a){const r=O(e.repeat)??"",o=e.allDay?e.date:B(t,a.anchor===""?"UTC":a.anchor).slice(0,10);return C(r,e.date,o)}function k(e,t){if(e.title.trim()==="")return"Give the event a title before saving it.";if(e.date==="")return"Pick the day the event is on.";if(e.endDate==="")return"Pick the day the event ends on.";if(e.calendarId==="")return"Pick the calendar to save the event in.";if(!e.allDay&&(e.startTime===""||e.endTime===""))return"Set a start and an end time, or mark the event all day.";if(e.allDay&&e.endDate<e.date)return"The last day is before the first. Move one of them.";if(!e.allDay&&`${e.endDate}T${e.endTime}`<=`${e.date}T${e.startTime}`)return"The end is not after the start. Move one of them.";const a=x(e.guests);return a?`${a.text} is not an email address. Fix or remove it to save.`:t&&O(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}const h=e=>e.guests.filter(t=>t.valid).map(t=>({email:t.email,displayName:t.displayName})),v=e=>JSON.stringify(h(e));function Q(e,t,a){const r=k(e,!0);if(r!=="")return{ok:!1,problem:r};const{start:o,end:i}=A(e,t.clock),n=h(e);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:o,end:i,allDay:e.allDay,...t.anchor===""?{}:{timeZone:t.anchor},recurrenceRule:M(e,o,t),attendees:n,...n.length===0?{}:{organizerAccountId:a}}}}function K(e,t,a){const r=t.repeat!==e.repeat,i=t.allDay!==e.allDay||t.date!==e.date||t.startTime!==e.startTime,n=i||t.endDate!==e.endDate||t.endTime!==e.endTime,c=k(t,r);if(c!=="")return{ok:!1,problem:c};const s={};t.title.trim()!==e.title.trim()&&(s.summary=t.title.trim()),t.location!==e.location&&(s.location=t.location),t.notes!==e.notes&&(s.description=t.notes);const{start:u,end:y}=A(t,a.clock);return i&&(s.start=u),n&&(s.end=y,s.allDay=t.allDay,a.anchor!==""&&(s.timeZone=a.anchor)),r&&(s.recurrenceRule=M(t,u,a)),v(t)!==v(e)&&(s.attendees=h(t)),{ok:!0,patch:s}}export{A as a,Q as c,W as d,b as e,C as m,K as p,S as t};
1
+ import{en as g,c6 as Y,ep as B}from"./index-BnBpXn45.js";import{q as F}from"./agenda-time-KJVZW5dD.js";import{i as x}from"./calendar-guests-DnrOkTr7.js";const m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["SU","MO","TU","WE","TH","FR","SA"],E=["January","February","March","April","May","June","July","August","September","October","November","December"],$=["first","second","third","fourth","last"],D=[1,2,3,4,-1],N="MO,TU,WE,TH,FR",L=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(e){const t=L(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${N}`;const a=t.match(/^Every week on (\w+)$/);if(a){const i=m.indexOf(a[1]);return i===-1?void 0:`FREQ=WEEKLY;BYDAY=${l[i]}`}const r=t.match(/^Every month on the (\w+) (\w+)$/);if(r){const i=$.indexOf(r[1]),n=m.indexOf(r[2]);return i===-1||n===-1?void 0:`FREQ=MONTHLY;BYDAY=${D[i]}${l[n]}`}const o=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(o){const i=E.indexOf(o[2]);return i===-1?void 0:`FREQ=YEARLY;BYMONTH=${i+1};BYMONTHDAY=${Number(o[1])}`}}const w=e=>e===""?"":`, ${e}`;function S(e,t){const a=new Map(e.split(";").map(n=>n.split("=")).filter(n=>n.length===2).map(([n,c])=>[n.toUpperCase(),c.toUpperCase()])),r=w(t),o=a.get("FREQ"),i=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(o==="DAILY")return`Every day${r}`;if(o==="WEEKLY"){if(i===void 0)return;if(i===N)return`Every weekday${r}`;const n=l.indexOf(i);return n===-1?void 0:`Every week on ${m[n]}${r}`}if(o==="MONTHLY"){const n=i?.match(/^(-?\d)([A-Z]{2})$/);if(!n)return;const c=D.indexOf(Number(n[1])),s=l.indexOf(n[2]);return c===-1||s===-1?void 0:`Every month on the ${$[c]} ${m[s]}${r}`}if(o==="YEARLY"){const n=Number(a.get("BYMONTH")),c=Number(a.get("BYMONTHDAY"));return!n||!c||n>12?void 0:`Every year on ${c} ${E[n-1]}${r}`}}}const f=e=>Date.parse(`${e}T00:00:00Z`)/864e5;function C(e,t,a){const r=f(a)-f(t);if(e===""||r===0||Number.isNaN(r))return e;const[o,i,n]=a.split("-").map(Number),c=new Date(Date.UTC(o,i-1,n)).getUTCDay(),s=/FREQ=(\w+)/i.exec(e)?.[1]?.toUpperCase();return e.split(";").map(u=>{const[y,R=""]=u.split("="),d=y.toUpperCase();return d==="BYDAY"&&s==="MONTHLY"?`BYDAY=${D[Math.min(Math.floor((n-1)/7),4)]}${l[c]}`:d==="BYDAY"?`BYDAY=${R.split(",").map(p=>{const T=l.indexOf(p.toUpperCase());return T===-1?p:l[(T+r+7)%7]}).join(",")}`:d==="BYMONTH"?`BYMONTH=${i}`:d==="BYMONTHDAY"?`BYMONTHDAY=${n}`:u}).join(";")}function b(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:[],notes:"",repeat:""}}function W(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endDate:F(e),endTime:e.allDay?"":e.end.slice(11,16),allDay:e.allDay,calendarId:e.calendarId,location:t.location,guests:t.guests,notes:t.notes,repeat:t.repeat}}function A(e,t){return e.allDay?{start:e.date,end:g(e.endDate,1)}:{start:Y(e.date,e.startTime,t),end:Y(e.endDate,e.endTime,t)}}function M(e,t,a){const r=O(e.repeat)??"",o=e.allDay?e.date:B(t,a.anchor===""?"UTC":a.anchor).slice(0,10);return C(r,e.date,o)}function k(e,t){if(e.title.trim()==="")return"Give the event a title before saving it.";if(e.date==="")return"Pick the day the event is on.";if(e.endDate==="")return"Pick the day the event ends on.";if(e.calendarId==="")return"Pick the calendar to save the event in.";if(!e.allDay&&(e.startTime===""||e.endTime===""))return"Set a start and an end time, or mark the event all day.";if(e.allDay&&e.endDate<e.date)return"The last day is before the first. Move one of them.";if(!e.allDay&&`${e.endDate}T${e.endTime}`<=`${e.date}T${e.startTime}`)return"The end is not after the start. Move one of them.";const a=x(e.guests);return a?`${a.text} is not an email address. Fix or remove it to save.`:t&&O(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}const h=e=>e.guests.filter(t=>t.valid).map(t=>({email:t.email,displayName:t.displayName})),v=e=>JSON.stringify(h(e));function Q(e,t,a){const r=k(e,!0);if(r!=="")return{ok:!1,problem:r};const{start:o,end:i}=A(e,t.clock),n=h(e);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:o,end:i,allDay:e.allDay,...t.anchor===""?{}:{timeZone:t.anchor},recurrenceRule:M(e,o,t),attendees:n,...n.length===0?{}:{organizerAccountId:a}}}}function K(e,t,a){const r=t.repeat!==e.repeat,i=t.allDay!==e.allDay||t.date!==e.date||t.startTime!==e.startTime,n=i||t.endDate!==e.endDate||t.endTime!==e.endTime,c=k(t,r);if(c!=="")return{ok:!1,problem:c};const s={};t.title.trim()!==e.title.trim()&&(s.summary=t.title.trim()),t.location!==e.location&&(s.location=t.location),t.notes!==e.notes&&(s.description=t.notes);const{start:u,end:y}=A(t,a.clock);return i&&(s.start=u),n&&(s.end=y,s.allDay=t.allDay,a.anchor!==""&&(s.timeZone=a.anchor)),r&&(s.recurrenceRule=M(t,u,a)),v(t)!==v(e)&&(s.attendees=h(t)),{ok:!0,patch:s}}export{A as a,Q as c,W as d,b as e,C as m,K as p,S as t};
@@ -0,0 +1 @@
1
+ import{f1 as o,j as i}from"./index-BnBpXn45.js";import{a as m}from"./CalendarEventEditor-CW-VkuRj.js";import"./draft-C849UdJB.js";import"./agenda-time-KJVZW5dD.js";import"./calendar-guests-DnrOkTr7.js";import"./calendar-event-popup-C92tAdsE.js";import"./useCalendarSuggestions-COzKAJgT.js";import"./ErrorState-Czrn8Njd.js";import"./useQueries-BomGTQs-.js";import"./pencil-rhg9PvnD.js";import"./circle-question-mark-BVVFmkJG.js";import"./useCalendarData-Djtg1pj2.js";import"./useCalendarTasks-D5yN61q_.js";import"./useCalendarScheduling-D222yR_U.js";import"./useDebouncedValue-CahHw3v4.js";import"./calendar-format-BwCpz-JZ.js";import"./nav-link-CjSE3MDU.js";import"./useMediaQuery-DOpCuIgp.js";import"./calendar-B8lLrLAb.js";import"./reply-CzX8Q1T1.js";import"./CalendarQuickCreate-BSauej6s.js";import"./CalendarSession-UbavgUO4.js";import"./calendar-event-sidebar-CahohNiL.js";import"./select-DWBegMNA.js";import"./chevron-down-CR89KUgK.js";import"./confirm-dialog-DYNhLVrG.js";function y(){const{calendarObjectId:r,recurrenceId:t}=o.useParams();return i.jsx(m,{calendarObjectId:r,recurrenceId:t})}export{y as component};
@@ -0,0 +1 @@
1
+ import{e_ as o,j as r}from"./index-BnBpXn45.js";import{a as i}from"./CalendarEventEditor-CW-VkuRj.js";import"./draft-C849UdJB.js";import"./agenda-time-KJVZW5dD.js";import"./calendar-guests-DnrOkTr7.js";import"./calendar-event-popup-C92tAdsE.js";import"./useCalendarSuggestions-COzKAJgT.js";import"./ErrorState-Czrn8Njd.js";import"./useQueries-BomGTQs-.js";import"./pencil-rhg9PvnD.js";import"./circle-question-mark-BVVFmkJG.js";import"./useCalendarData-Djtg1pj2.js";import"./useCalendarTasks-D5yN61q_.js";import"./useCalendarScheduling-D222yR_U.js";import"./useDebouncedValue-CahHw3v4.js";import"./calendar-format-BwCpz-JZ.js";import"./nav-link-CjSE3MDU.js";import"./useMediaQuery-DOpCuIgp.js";import"./calendar-B8lLrLAb.js";import"./reply-CzX8Q1T1.js";import"./CalendarQuickCreate-BSauej6s.js";import"./CalendarSession-UbavgUO4.js";import"./calendar-event-sidebar-CahohNiL.js";import"./select-DWBegMNA.js";import"./chevron-down-CR89KUgK.js";import"./confirm-dialog-DYNhLVrG.js";function q(){const{calendarObjectId:t}=o.useParams();return r.jsx(i,{calendarObjectId:t})}export{q as component};
@@ -0,0 +1 @@
1
+ import{b as e}from"./index-BnBpXn45.js";const a={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};a.node;const n=e(a);export{n as E};
@@ -0,0 +1 @@
1
+ import{b as e}from"./index-BnBpXn45.js";const a={name:"file-braces",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],aliases:["file-json"]};a.node;const s=e(a);export{s as F};
@@ -0,0 +1 @@
1
+ import{ba as ee,j as e,L as B,ad as oe,p as ce,bb as de,bc as me,r as m,ao as H,B as F,bd as ue,be as J,bf as xe,bg as pe,aP as fe,e as he,f as ge,bh as be,bi as je,bj as ve,aB as Ne,T as ye,aw as te,ax as se,a as ae,U as Ce,bk as Se,W as we,Y as ke,bl as Fe,bm as Ie,u as Me,ac as Re,c as Ee}from"./index-BnBpXn45.js";import{E as K,f as Oe}from"./ErrorState-Czrn8Njd.js";import{u as De}from"./useMediaQuery-DOpCuIgp.js";import{u as Le,a as Ae}from"./useLabels-BxK35B_o.js";import{C as Te,A as ze,a as $e,b as Pe,N as E,p as Be,u as Ue,r as _e,c as ne,S as Q,d as He,n as Ke,f as qe,e as Je,g as Qe,h as Ve,i as Ge,j as We}from"./useFilters-CmYwNOKM.js";import{L as ie}from"./label-chip-CbKg_yMt.js";import{S as V}from"./segmented-control-IDK8fpO7.js";import{S as Ye}from"./select-DWBegMNA.js";import{C as q}from"./circle-check-9HYVTIrG.js";import{B as Xe}from"./bottom-sheet-C9u72VJg.js";import{B as Ze}from"./badge-C7MFP1pN.js";import{a as et}from"./sections-DsqY4M13.js";import{S as tt}from"./settings-screen-BN-3qNrj.js";import"./suggest-list-DMRnmTaR.js";import"./plus-B2EF0VhA.js";import"./chevron-down-CR89KUgK.js";import"./avatar-Bo0EUTkm.js";import"./chevron-left-DSaOqH7y.js";import"./menu-B8nM2lya.js";import"./circle-question-mark-BVVFmkJG.js";function st({preview:t}){const s=ee(t);if(t.status==="loading")return e.jsxs("p",{className:"flex items-center gap-2 text-xs text-fg-muted","aria-live":"polite",children:[e.jsx(B,{className:"size-3.5 animate-spin","aria-hidden":"true"}),s]});if(t.status==="error")return e.jsxs("p",{className:"flex items-center gap-2 text-xs text-danger",role:"alert",children:[e.jsx(oe,{className:"size-3.5 shrink-0","aria-hidden":"true"}),s]});const a=t.count===0;return e.jsxs("p",{className:ce("flex items-center gap-2 text-xs",t.stale?"text-fg-subtle":a?"text-fg-muted":"font-medium text-fg"),"aria-live":"polite",children:[t.stale&&e.jsx(B,{className:"size-3.5 animate-spin","aria-hidden":"true"}),s]})}const at=[{value:"all",label:J("all")},{value:"any",label:J("any")}],G=[{value:"once",label:"Just once"},{value:"standing",label:"Keep doing this"},{value:"until",label:"Until a date"}],W="__filter_create_label__";function nt({folders:t,value:s,delimiter:a="/",onChangeMove:n,onCreateFolder:u}){const[x,j]=m.useState(!1),[f,h]=m.useState(),[o,g]=m.useState([]),S=m.useMemo(()=>{const v=new Set(t.map(p=>p.id));return[...t,...o.filter(p=>!v.has(p.id))]},[t,o]),l=m.useMemo(()=>{if(u)return async(v,p,r)=>{const d=await u(v,p,r);return g(w=>w.some(M=>M.id===d.id)?w:[...w,d]),d}},[u]),k=S.find(v=>v.id===s),y=S.find(v=>v.id===f),b=v=>{const p=pe(v.path,a);return p.map((r,d)=>{const w=p.slice(0,d+1).join(a);return S.find(M=>M.path===w)?.label??r}).join(" / ")},C=()=>{j(!1),h(void 0)};return x?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex h-72 min-h-0 overflow-hidden rounded-md border border-line bg-surface",children:e.jsx(xe,{folders:S,selectedId:f,delimiter:a,onSelect:h,onCreateFolder:l,onCancel:C,labels:{createPending:"Waiting for the mail server to confirm the folder…"}})}),y?e.jsx(F,{variant:"primary",onClick:()=>{n?.(y.id),C()},className:"w-full",children:e.jsx("span",{className:"truncate",children:`Move matches to ${b(y)}`})}):e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Tap a folder to open it, or make a new one where you want it."}),e.jsx(F,{variant:"ghost",size:"sm",onClick:C,className:"w-full",children:"Cancel"})]}):e.jsxs("div",{className:"rounded-md border border-line bg-surface-sunken p-3",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:k?b(k):"No folder yet"}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[e.jsx(F,{variant:"ghost",size:"sm",className:"px-0",onClick:()=>{h(s),j(!0)},children:"Choose a folder"}),k&&e.jsx(F,{variant:"ghost",size:"sm",className:"px-0",onClick:()=>n?.(""),children:"Don't move matches"})]})]})}function it({labels:t,value:s,onChangeLabel:a,onCreateLabel:n}){const[u,x]=m.useState(!1),[j,f]=m.useState(""),[h,o]=m.useState(!1),[g,S]=m.useState(),[l,k]=m.useState([]),y=m.useMemo(()=>{const r=new Set(t.map(d=>d.id));return[...t,...l.filter(d=>!r.has(d.id))]},[t,l]),b=y.find(r=>r.id===s),C=r=>{if(r===W){S(void 0),x(!0);return}a?.(r)},v=()=>{if(!n)return;const r=j.trim();r!==""&&(o(!0),S(void 0),n(r).then(d=>{k(w=>w.some(M=>M.id===d.id)?w:[...w,d]),a?.(d.id),x(!1),f(""),o(!1)}).catch(d=>{S(d instanceof Error?d.message:"Couldn't create that label. Please try again."),o(!1)}))},p=()=>{x(!1),f(""),S(void 0)};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Ye,{"aria-label":"Label to apply",value:s,onChange:r=>C(r.target.value),className:"flex-1",children:[e.jsx("option",{value:"",children:"No label"}),y.map(r=>e.jsx("option",{value:r.id,children:r.name},r.id)),n&&e.jsx("option",{value:W,children:"+ New label…"})]}),b&&e.jsx(ie,{label:{...b,labelId:b.id}})]}),u&&e.jsxs("div",{className:"space-y-2 rounded-md border border-line bg-surface-sunken p-2",children:[e.jsx(H,{value:j,onChange:r=>f(r.target.value),placeholder:"Label name","aria-label":"New label name",disabled:h,autoFocus:!0,onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),v()),r.key==="Escape"&&(r.preventDefault(),p())}}),g&&e.jsx("p",{className:"text-2xs text-danger",role:"alert",children:g}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(F,{variant:"primary",size:"sm",onClick:v,disabled:h||j.trim()==="",children:h?"Creating…":"Create label"}),e.jsx(F,{variant:"ghost",size:"sm",onClick:p,disabled:h,children:"Cancel"})]})]})]})}function rt({rule:t,folders:s,delimiter:a,labels:n=[],preview:u,notice:x,clauseFields:j,persisted:f=!1,clauseSuggestions:h,clauseEdit:o,onStartAddClause:g,onStartEditClause:S,onRemoveClause:l,onChangeDraftField:k,onChangeDraftValue:y,onSubmitClause:b,onCancelClause:C,onChangeMatchOperator:v,onChangeMove:p,onCreateFolder:r,onChangeLabel:d,onCreateLabel:w,onChangeScope:M,onChangeName:O,onChangeUntil:L,onCommit:D,onCancel:z}){const A=t.clauses.length>=2,$=de(t.matchOperator),N=me(t,u),T=t.scope==="standing"||t.scope==="until",P=f?G.filter(I=>I.value!=="once"):G;return e.jsxs("div",{className:"flex min-h-0 flex-col",children:[e.jsxs("div",{className:"border-b border-line px-5 py-3",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Filter rule"}),e.jsx("p",{className:"mt-0.5 text-xs text-fg-muted",children:"These chips are the whole rule — what you see is what applies."})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4",children:[x,e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[t.clauses.map((I,U)=>e.jsxs(m.Fragment,{children:[U>0&&e.jsx("span",{className:"text-2xs font-medium uppercase text-fg-subtle",children:$}),e.jsx(Te,{clause:I,onEdit:()=>S?.(I.id),onRemove:()=>l?.(I.id)})]},I.id)),!o&&e.jsx(ze,{label:"Add clause",onClick:g})]}),o&&e.jsx($e,{draft:o.draft,mode:o.mode,fields:j,suggestions:h,onChangeField:k,onChangeValue:y,onSubmit:b,onCancel:C}),A&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Match"}),e.jsx(V,{name:"match-operator",size:"sm","aria-label":"Match operator",options:at,value:t.matchOperator,onChange:I=>v?.(I)})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-fg-muted",children:"Move matches to"}),e.jsx(nt,{folders:s,value:t.moveMailboxId,delimiter:a,onChangeMove:p,onCreateFolder:r})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-fg-muted",children:"Apply a label"}),e.jsx(it,{labels:n,value:t.labelId??"",onChangeLabel:d,onCreateLabel:w})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-fg-muted",children:"How long"}),e.jsx(V,{name:"rule-scope",size:"sm","aria-label":"Rule scope",options:P,value:t.scope,onChange:I=>M?.(I)}),T&&e.jsx(H,{value:t.name??"",onChange:I=>O?.(I.target.value),placeholder:"Name this rule (e.g. Receipts)","aria-label":"Rule name",className:"w-full"}),t.scope==="until"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx("span",{children:"Until"}),e.jsx(H,{type:"date",value:t.until??"",onChange:I=>L?.(I.target.value),"aria-label":"Expiry date",className:"flex-1"})]})]}),e.jsx("div",{className:"border-t border-line pt-3",children:e.jsx(st,{preview:u})})]}),e.jsxs("div",{className:"space-y-2 border-t border-line px-5 py-3",children:[N&&e.jsx("p",{className:"text-xs text-fg-subtle",role:"status",children:N}),e.jsx(F,{variant:"primary",onClick:D,disabled:N!==void 0,className:"w-full",children:ue(t.scope)}),e.jsx(F,{variant:"ghost",onClick:z,className:"w-full",children:"Not now"})]})]})}const lt=t=>{const s=fe(t);return s!==void 0&&s>=400&&s<500};function Y({title:t,error:s,onRetry:a,reportHref:n}){return e.jsxs("div",{className:"space-y-1",children:[e.jsx(K,{variant:"inline",title:t,error:s,onRetry:lt(s)?void 0:a}),e.jsx("a",{href:n(Oe(s)),target:"_blank",rel:"noreferrer",className:"text-xs text-accent hover:underline",children:"Report an issue"})]})}const ot=(t,s)=>{const a=he(),n=ge({...je(),onSuccess:()=>{t&&(a.invalidateQueries({queryKey:Pe(t)}),s&&a.invalidateQueries({queryKey:be({path:{accountId:t,filterId:s}})}))}}),{mutate:u}=n;return{updateFilter:m.useCallback(j=>{!t||!s||u({path:{accountId:t,filterId:s},body:j})},[t,s,u]),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,error:n.error,reset:n.reset}},ct=t=>({clauses:t.literalClauses.map((a,n)=>({id:`clause-${n}`,field:a.field,value:a.value})),matchOperator:t.matchOperator==="And"?"all":"any",moveMailboxId:t.actionMailboxId!==E?t.actionMailboxId:void 0,labelId:t.actionLabelId!==E?t.actionLabelId:void 0,scope:t.scope==="Temporary"?"until":"standing",until:t.scope==="Temporary"?dt(t.expiresAt):void 0,name:t.name}),dt=t=>{if(!t)return"";const s=Date.parse(t);if(Number.isNaN(s))return"";const a=new Date(s),n=u=>String(u).padStart(2,"0");return`${a.getFullYear()}-${n(a.getMonth()+1)}-${n(a.getDate())}`},X=t=>JSON.stringify({clauses:t.clauses.map(s=>[s.field,s.value]),operator:t.matchOperator,move:t.moveMailboxId??null,label:t.labelId??null}),re=(t,s)=>X(t)!==X(s),Z=t=>JSON.stringify({scope:t.scope==="until"?"until":"standing",until:t.scope==="until"?t.until??"":""}),le=(t,s)=>Z(t)!==Z(s),mt=(t,s)=>{const a={},n=(t.name??"").trim();return n!==(s.name??"").trim()&&(a.name=n),re(t,s)&&(a.matchOperator=t.matchOperator==="all"?"And":"Or",a.literalClauses=t.clauses.map(u=>({field:u.field,value:u.value})),a.actionMailboxId=t.moveMailboxId??E,a.actionLabelId=t.labelId??E),le(t,s)&&(a.scope=t.scope==="until"?"Temporary":"Standing",t.scope==="until"&&(a.expiresAt=Be(t.until??""))),a};function ut({accountId:t,filter:s,folders:a,delimiter:n,labels:u,onClose:x}){const j=m.useMemo(()=>ct(s),[s]),[f,h]=m.useState(j),[o,g]=m.useState(),[S,l]=m.useState(!1),k=m.useRef(0),{count:y}=Ue(t,_e(f)),b=ot(t,s.filterId),C=ne(t),{createFolderIn:v}=ve(t),{createLabel:p}=Le(t),r=async c=>{const i=await p(c);return{id:i.labelId,name:i.name,color:i.color}},d=()=>g({mode:"add",draft:{field:Q[0],value:""}}),w=c=>{const i=f.clauses.find(R=>R.id===c);i&&g({mode:"edit",clauseId:c,draft:{field:i.field,value:i.value}})},M=c=>g(i=>i&&{...i,draft:{...i.draft,field:c}}),O=c=>g(i=>i&&{...i,draft:{...i.draft,value:c}}),L=()=>{if(!o)return;const c=o.draft.field,i=Ke(c,o.draft.value);i!==""&&(h(R=>o.mode==="edit"&&o.clauseId?{...R,clauses:R.clauses.map(_=>_.id===o.clauseId?{id:_.id,field:c,value:i}:_)}:(k.current+=1,{...R,clauses:[...R.clauses,{id:`new-${k.current}`,field:c,value:i}]})),g(void 0))},D=c=>h(i=>({...i,clauses:i.clauses.filter(R=>R.id!==c)})),z=c=>h(i=>({...i,matchOperator:c})),A=c=>h(i=>({...i,moveMailboxId:c||void 0})),$=c=>h(i=>({...i,labelId:c||void 0})),N=c=>h(i=>({...i,name:c})),T=c=>h(i=>({...i,scope:c,until:c==="until"?i.until:void 0})),P=c=>h(i=>({...i,until:c})),I=()=>{const c=re(f,j)||le(f,j),i=mt(f,j);if(Object.keys(i).length===0){x();return}l(c),b.updateFilter(i)},U=()=>C.start(He(f));return C.isStarting||C.isRunning||C.isDone?e.jsx(ht,{progress:C.progress,isDone:C.isDone,onClose:x}):b.isPending?e.jsx(xt,{}):b.isError?e.jsx(gt,{onRetry:b.reset,onClose:x}):b.isSuccess?S?e.jsx(ft,{preview:ee(y),blocked:y.status!=="ready"||y.stale===!0,onReapply:U,onClose:x}):e.jsx(pt,{onClose:x}):e.jsx(rt,{rule:f,folders:a,delimiter:n,labels:u,preview:y,clauseFields:Q,persisted:!0,clauseEdit:o,onStartAddClause:d,onStartEditClause:w,onRemoveClause:D,onChangeDraftField:M,onChangeDraftValue:O,onSubmitClause:L,onCancelClause:()=>g(void 0),onChangeMatchOperator:z,onChangeMove:A,onCreateFolder:v,onChangeLabel:$,onCreateLabel:r,onChangeName:N,onChangeScope:T,onChangeUntil:P,onCommit:I,onCancel:x})}function xt(){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function pt({onClose:t}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[e.jsx(q,{className:"size-8 text-positive"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),e.jsx(F,{variant:"primary",onClick:t,className:"mt-2",children:"Done"})]})}function ft({preview:t,blocked:s,onReapply:a,onClose:n}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[e.jsx(q,{className:"size-8 text-positive"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),e.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",t," — move the mail already in your mailbox too?"]}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(F,{variant:"primary",onClick:a,disabled:s,children:"Move existing mail"}),e.jsx(F,{variant:"ghost",onClick:n,children:"Not now"})]})]})}function ht({progress:t,isDone:s,onClose:a}){const n=t.state==="Failed";return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[s?n?e.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):e.jsx(q,{className:"size-8 text-positive"}):e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),!s&&e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),s&&!n&&e.jsxs("div",{className:"text-sm text-fg",children:[e.jsx("p",{className:"font-medium",children:"Done"}),e.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[t.appliedCount," of ",t.matchedCount," moved",t.failedCount>0?` · ${t.failedCount} failed`:"","."]})]}),s&&n&&e.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:t.errorMessage||"Something went wrong. Please try again."}),s&&e.jsx(F,{variant:"primary",onClick:a,className:"mt-2",children:"Done"})]})}function gt({onRetry:t,onClose:s}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[e.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),e.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(F,{variant:"primary",onClick:t,children:"Try again"}),e.jsx(F,{variant:"ghost",onClick:s,children:"Not now"})]})]})}function bt({accountId:t,filter:s,folders:a,delimiter:n,labels:u,onClose:x}){const j=De(),f=e.jsx(ut,{accountId:t,filter:s,folders:a,delimiter:n,labels:u,onClose:x});return j?e.jsx(Ne,{open:!0,onClose:x,title:"Filter rule",children:f}):e.jsx(Xe,{open:!0,onClose:x,label:"Filter rule",dismissLabel:"Dismiss filter rule",children:f})}const jt=t=>{switch(t.kind){case"queuing":case"running":return"Running over the inbox…";case"done":return t.matched===0?"Done. Nothing in the inbox matched.":`Done. Filed ${t.applied} of ${t.matched} matching messages in the inbox.`;case"failed":return}};function vt({filters:t,mailboxName:s,labelById:a,onEdit:n,onDelete:u,deletingFilterId:x,onToggle:j,togglingFilterId:f,onRunNow:h,runFilterId:o,runStatus:g,now:S=Date.now()}){return t.length===0?e.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):e.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:t.map(l=>{const k=qe(l,S),y=k==="Expired",b=k==="Disabled",C=b?Je(l):void 0,v=l.actionMailboxId!==E?s(l.actionMailboxId):void 0,p=l.actionLabelId!==E?a.get(l.actionLabelId):void 0,r=Qe(l.expiresAt),d=o===l.filterId?g:void 0,w=d?.kind==="queuing"||d?.kind==="running",M=d?jt(d):void 0,O=k==="Active"&&(l.actionMailboxId!==E||l.actionLabelId!==E);return e.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>n(l.filterId),"aria-label":`Edit filter ${l.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`truncate text-sm font-medium ${y||b?"text-fg-muted":"text-fg"}`,children:l.name}),e.jsx(Ze,{tone:y?"neutral":b?"warning":"positive",dot:!0,children:k})]}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[v?`Moves matches to ${v}`:"No move action",l.scope==="Temporary"&&r?y?` · expired ${r}`:` · until ${r}`:l.scope==="Standing"?" · always":""]}),C&&e.jsx("p",{className:"mt-0.5 text-xs text-warning",children:C}),M&&e.jsx("p",{role:"status",className:"mt-0.5 text-xs text-fg-muted",children:M}),p&&e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:e.jsx(ie,{label:{labelId:p.id,name:p.name,color:p.color}})})]}),O&&e.jsx(F,{variant:"ghost",size:"sm",onClick:()=>h(l.filterId),disabled:w,"aria-label":`Run now: filter ${l.name}`,children:w?"Running…":"Run now"}),!y&&e.jsx(F,{variant:"ghost",size:"sm",onClick:()=>j(l.filterId,b),disabled:f===l.filterId,"aria-label":`${b?"Turn on":"Turn off"} filter ${l.name}`,children:b?"Turn on":"Turn off"}),e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(ye,{className:"size-4 text-danger"}),onClick:()=>u(l.filterId),disabled:x===l.filterId,"aria-label":`Delete filter ${l.name}`})]},l.filterId)})})}function Nt(t){return te(se({title:`Filter toggle: ${t}`,errorMessage:t}))}function yt(t){return te(se({title:`Filter run now: ${t}`,errorMessage:t}))}const Ct=t=>{if(t.failure)return{kind:"failed",error:t.failure.error};if(t.isStarting)return{kind:"queuing"};if(t.isDone)return t.progress.state==="Failed"?{kind:"failed",error:new Error(t.progress.errorMessage||"The run over the inbox failed.")}:{kind:"done",matched:t.progress.matchedCount,applied:t.progress.appliedCount};if(t.isRunning)return{kind:"running"}},St=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",e.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",e.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),e.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."}),e.jsx("p",{children:"A filter that can't do its job turns itself off and says why, for example when its folder no longer exists. Turn it back on once that is fixed."})]});function wt({account:t}){const s=t.accountId,{filters:a,isPending:n,isError:u,error:x,refetch:j}=Ve(s),{deleteFilter:f,deletingFilterId:h}=Ge(s),o=We(s),g=ne(s),{startForFilter:S}=g,[l,k]=m.useState(),y=m.useCallback(N=>{k(N),S(N)},[S]),b=Ct(g),[C,v]=m.useState(),{data:p}=ae({...Ce({path:{accountId:s}}),staleTime:1/0}),r=Se(),d=m.useMemo(()=>we(t.folderAppointments),[t.folderAppointments]),w=m.useCallback(N=>{const T=p?.items.find(P=>P.mailboxId===N);if(T)return ke(T,d.get(N),r)},[p?.items,d,r]),M=m.useMemo(()=>Fe({mailboxes:p?.items??[],folderAppointments:t.folderAppointments,translator:r}),[p?.items,t.folderAppointments,r]),O=Ie(p?.items??[]),{labels:L}=Ae(s),D=m.useMemo(()=>L.map(N=>({id:N.labelId,name:N.name,color:N.color})),[L]),z=m.useMemo(()=>new Map(D.map(N=>[N.id,N])),[D]),A=a.find(N=>N.filterId===C),$=a.find(N=>N.filterId===l)?.name;return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:t.email}),A&&e.jsx(bt,{accountId:s,filter:A,folders:M,delimiter:O,labels:D,onClose:()=>v(void 0)}),n?e.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${t.email}`}):u?e.jsx(K,{variant:"inline",title:`Couldn't load filters for ${t.email}`,error:x,onRetry:()=>{j()}}):e.jsxs(e.Fragment,{children:[o.isError&&e.jsx(Y,{title:o.enabling?"Couldn't turn the filter on":"Couldn't turn the filter off",error:o.error,onRetry:o.retry,reportHref:Nt}),l&&b?.kind==="failed"&&e.jsx(Y,{title:`Couldn't run ${$??"the filter"} over the inbox`,error:b.error,onRetry:g.failure?.kind==="statusUnreadable"?g.refreshStatus:()=>y(l),reportHref:yt}),e.jsx(vt,{filters:a,mailboxName:w,labelById:z,onEdit:v,onDelete:f,deletingFilterId:h,onToggle:o.toggleFilter,togglingFilterId:o.togglingFilterId,onRunNow:y,runFilterId:l,runStatus:b})]})]})}function Jt(){const t=Me(),s=Re(),a=et(),[n,u]=m.useState(!0),{data:x,isPending:j,isError:f,error:h,refetch:o}=ae(Ee());return e.jsx(tt,{items:s,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:St,helpOpen:n,onToggleHelp:()=>u(g=>!g),onSelect:a,onBackToMail:()=>{t({to:"/mail"})},children:j?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):f?e.jsx(K,{title:"Couldn't load accounts",error:h,onRetry:()=>{o()}}):x.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:x.accounts.map(g=>e.jsx(wt,{account:g},g.accountId))})})}export{wt as AccountFilters,Jt as component};
@@ -1 +1 @@
1
- import{j as r}from"./index-9JWzpiiR.js";import{E as o}from"./ErrorState-BB0xpcCi.js";const l=({error:t,reset:e})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(o,{title:"Couldn't load your starred mail",error:t,onRetry:e})});export{l as errorComponent};
1
+ import{j as r}from"./index-BnBpXn45.js";import{E as o}from"./ErrorState-Czrn8Njd.js";const l=({error:t,reset:e})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(o,{title:"Couldn't load your starred mail",error:t,onRetry:e})});export{l as errorComponent};
@@ -0,0 +1 @@
1
+ import{j as o,O as i}from"./index-BnBpXn45.js";import{a as m}from"./MailShell-qe4eiESL.js";import{F as r}from"./FlaggedPane-Duxks4wd.js";import"./nav-link-CjSE3MDU.js";import{a as p}from"./search-token-index-YOjFNFJN.js";import"./reply-CzX8Q1T1.js";import{u as e}from"./search-mirror-CM2HNuGA.js";import"./useMessageBodyContent-DzlZ514L.js";import"./FullCompose-C6ydcOqj.js";import"./index-B7CBca9v.js";import"./useSignature-Boz2_w0h.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CahHw3v4.js";import"./suggest-list-DMRnmTaR.js";import"./sections-DsqY4M13.js";import"./useMediaQuery-DOpCuIgp.js";import"./chevron-down-CR89KUgK.js";import"./ErrorState-Czrn8Njd.js";import"./confirm-dialog-DYNhLVrG.js";import"./search-scope-fyP_uHeh.js";import"./app-chrome-1USNGfE3.js";import"./MessageToolbar-D_XE8m4l.js";import"./MessageBody-Dx9mvb7l.js";import"./kbd-CE7JGsTx.js";import"./roving-focus-DWCPniMZ.js";import"./useQueries-BomGTQs-.js";import"./badge-C7MFP1pN.js";import"./undo-2-D-cmVG46.js";import"./DropdownMenu-DlTVA419.js";import"./popover-menu-nz-n7B2h.js";import"./mail-BG3D2i2e.js";import"./download-V38kBiT1.js";import"./avatar-Bo0EUTkm.js";import"./EmptyState-3mzd9Rr2.js";import"./calendar-suggestion-yCUw5guW.js";import"./useCalendarSuggestions-COzKAJgT.js";import"./agenda-time-KJVZW5dD.js";import"./plus-B2EF0VhA.js";import"./calendar-format-BwCpz-JZ.js";import"./calendar-B8lLrLAb.js";import"./calendar-failure-note-D746wu0r.js";import"./checkbox-CvgfSohd.js";import"./clock-D6gctGNH.js";import"./segmented-control-IDK8fpO7.js";import"./shield-check-CW6Yah30.js";import"./useLayoutTier-xkhKNk1V.js";import"./menu-B8nM2lya.js";import"./useFilters-CmYwNOKM.js";import"./select-DWBegMNA.js";import"./folder-input-Bgx-bBiO.js";import"./label-chip-CbKg_yMt.js";import"./MailViewChrome-DmD7yKe9.js";import"./refresh-cw-COcXRex1.js";import"./wizard-selection-zWa1qc6-.js";function ao(){const t=p();return e({to:"/mail/flagged"}),o.jsx(r,{thread:t,children:o.jsx(m,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!t})})}export{ao as component};
@@ -0,0 +1 @@
1
+ import{b as e}from"./index-BnBpXn45.js";const a={name:"folder-input",size:24,node:[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]};a.node;const o=e(a);export{o as F};
@@ -0,0 +1 @@
1
+ import{j as e,B as y,T as B,bf as Y,r as c,aB as W,X,aG as he,ao as Z,F as xe,bn as H,bo as fe,aq as pe,d as z,bp as ge,bq as be,e as J,a1 as ee,k as se,br as ve,bs as je,aF as ye,a0 as Ne,bt as ke,bu as _,bv as Ce,bw as we,bx as te,by as Se,bz as K,bj as ae,bk as re,bl as Me,Y as q,W as ne,L as G,bA as Q,ad as Ie,bB as Ee,u as Ae,ac as De,a as ie,c as Oe,U as Fe,f as U,s as Re,bC as Te,bD as Pe,bE as $e,bF as Le,bG as ze,bH as _e}from"./index-BnBpXn45.js";import{F as Be}from"./folder-input-Bgx-bBiO.js";import{f as qe}from"./folder-failure-CqkVSsrb.js";import{a as Ge}from"./sections-DsqY4M13.js";import{S as He}from"./settings-screen-BN-3qNrj.js";import{E as oe}from"./ErrorState-Czrn8Njd.js";import{S as Ke}from"./select-DWBegMNA.js";import{P as Qe}from"./pencil-rhg9PvnD.js";import"./avatar-Bo0EUTkm.js";import"./badge-C7MFP1pN.js";import"./chevron-left-DSaOqH7y.js";import"./menu-B8nM2lya.js";import"./circle-question-mark-BVVFmkJG.js";import"./chevron-down-CR89KUgK.js";const Ue=({label:s,onRename:t,onDelete:r,deleteBlockedReason:l,renameLabel:d=m=>`Rename ${m}`,deleteLabel:a=m=>`Delete ${m}`})=>{const m=l?`${a(s)} — ${l}`:a(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(Qe,{className:"size-3.5"}),"aria-label":d(s),onClick:t}),e.jsx("span",{title:l,children:e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),"aria-label":m,disabled:l!==void 0,onClick:r})})]})},Ve=({folders:s,onRename:t,onDelete:r,onCreateFolder:l,delimiter:d,labels:a})=>{const m=new Map(s.map(o=>[o.id,o]));return e.jsx(Y,{folders:s,onCreateFolder:l,delimiter:d,labels:{treeAriaLabel:"Your folders",optionLabel:o=>o.label,...a},rowFailure:o=>m.get(o.id)?.failure,rowActions:o=>{const i=m.get(o.id);return i?e.jsx(Ue,{label:i.label,deleteBlockedReason:i.deleteBlockedReason,renameLabel:a?.rename,deleteLabel:a?.remove,onRename:()=>t(i),onDelete:()=>r(i)}):null}})},Ye=({open:s,folderLabel:t,defaultLabel:r,name:l,onNameChange:d,onSubmit:a,onClose:m,pending:o=!1,error:i})=>{const h=c.useId(),p=`Rename ${t}`;return s?e.jsxs(W,{open:s,onClose:m,title:p,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:p}),e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:m,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(he,{htmlFor:h,children:"Folder name"}),e.jsx(Z,{id:h,value:l,placeholder:r,onChange:g=>d(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),a())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:r}),"."]}),i&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:i})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:m,children:"Cancel"}),e.jsx(y,{variant:"primary",size:"sm",onClick:a,disabled:o,children:o?"Saving…":"Save name"})]})]}):null},We=["inbox","drafts","sent","archive","junk","trash"],V="",Xe={mailboxId:null,source:"None"};function Ze(s){const t=s.messageCount===1?"msg":"msgs";return`${H(s.providerPath,s.hierarchyDelimiter)} · ${s.messageCount} ${t}`}const le=s=>`${s} ${s===1?"message":"messages"}`,Je=(s,t)=>s==="Appointed"?"Chosen by you":s==="Flagged"?`The mail server marks it as ${t}`:s==="Reserved"?"The account's own INBOX":"Matched by name, not confirmed";function es({role:s,folders:t,appointment:r,displayName:l,onAppoint:d,onRename:a}){const[m,o]=c.useState(l),i=c.useRef(null),h=c.useRef(!1),p=c.useId(),{mailboxId:g,source:v,staleFolderPath:j}=r,u=t.find(N=>N.mailboxId===g)??null,f=ge(s),O=u!=null&&m.trim()!==l.trim();c.useEffect(()=>{!h.current||v==="Proposed"||(h.current=!1,i.current?.focus())},[v]);const I=(()=>{if(v==="None"){const N=s==="trash"?" Deleting mail needs one.":"";return e.jsx("span",{id:p,className:"pl-[7.5rem] text-xs text-fg-muted",children:`Not set — pick the folder this account uses for ${f}.${N}`})}return v==="Stale"||!u?null:e.jsx("span",{id:p,className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:u.providerPath,children:`${Je(v,f)} · ${u.providerPath} · ${le(u.messageCount)}`})})(),w=s==="trash"?" Deleting mail is stopped until you pick another one.":u?` reader is using ${H(u.providerPath,u.hierarchyDelimiter)} instead.`:"",D=`The folder you chose for ${f}${j?` — ${j} —`:""} is gone from the mail server.${w}`;return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[fe(s),f]}),e.jsxs(Ke,{ref:i,className:"w-56 shrink-0",value:u?.mailboxId??V,"aria-label":`Folder for ${f}`,"aria-describedby":I||v==="Stale"?p:void 0,onChange:N=>d(s,N.target.value),children:[!u&&e.jsx("option",{value:V,disabled:!0,children:"Choose a folder"}),t.map(N=>e.jsx("option",{value:N.mailboxId,children:Ze(N)},N.mailboxId))]}),v==="Proposed"&&u&&e.jsx(y,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{h.current=!0,d(s,u.mailboxId)},children:`Set as ${f}`}),u&&e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"flex-1",value:m,placeholder:f,"aria-label":`Display name for ${f}`,onChange:N=>o(N.target.value)}),O&&e.jsx(y,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(pe,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>a(u.mailboxId,m)})]})]}),I,v==="Stale"&&e.jsx(z,{tone:"warning",variant:"soft",className:"ml-[7.5rem]",children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:p,className:"flex-1",children:D}),e.jsx(y,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>i.current?.focus(),children:"Pick a folder"})]})})]})}function ss(){return e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]})}function ts({accountEmail:s,folders:t,appointments:r,displayNames:l={},onAppoint:d,onRename:a}){const m=new Set(Object.values(r).map(i=>i.mailboxId).filter(i=>i!=null)),o=t.filter(i=>!m.has(i.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each row says where its answer came from — your choice, the mail server's own flag, or a name reader matched."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:We.map(i=>{const h=r[i]??Xe;return e.jsx(es,{role:i,folders:t,appointment:h,displayName:h.mailboxId?l[h.mailboxId]??"":"",onAppoint:d,onRename:a},i)})}),o.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:o.map(i=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(xe,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:H(i.providerPath,i.hierarchyDelimiter)}),e.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:le(i.messageCount)})]},i.mailboxId))})]})]})}const as=12e4,rs=2e3,ns="This folder is no longer in the account's folder list, so nothing was deleted.",ce=(s,t)=>{const r=s.find(l=>l.mailboxId===t);if(!r)throw new Error(ns);return r},is=(s,t)=>ce(s,t).lastSyncedAt??0;async function os({readMailboxes:s,mailboxId:t,since:r,signal:l,segmentMs:d=as,pollIntervalMs:a=rs,delay:m=be,now:o=Date.now}){const i=o()+d;for(;;){l?.throwIfAborted();const h=ce(await s(),t);if((h.lastSyncedAt??0)>r)return{status:"fresh",messageCount:h.messagesTotal};if(o()>=i)return{status:"pending"};await m(a,l)}}const de=50,ls=s=>s instanceof Error?s.message:"Something went wrong.",$=s=>s.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:ls(t)})),cs=async(s,t,r,l)=>{const d=[];let a;for(let m=0;m<de;m+=1){if(l.aborted)return d;const{data:o}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:a},throwOnError:!0});for(const i of o.items)if(!t.has(i.messageId)&&!d.includes(i.messageId)&&(d.push(i.messageId),d.length>=r))return d;if(!o.continuationToken)break;a=o.continuationToken}return d},ds=async(s,t)=>{let r=0,l;for(let d=0;d<de;d+=1){if(t.aborted)return r;const{data:a}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:l},throwOnError:!0});if(r+=a.items.length,!a.continuationToken)break;l=a.continuationToken}return r};function ms({accountId:s,mailboxId:t,onDeleted:r}){const l=J(),[d,a]=c.useState("idle"),[m,o]=c.useState(null),[i,h]=c.useState(),[p,g]=c.useState(),v=c.useRef(null),j=c.useRef(void 0),u=c.useCallback(()=>{l.invalidateQueries({queryKey:ee({path:{accountId:s}})}),l.invalidateQueries({queryKey:se()})},[l,s]),f=c.useCallback(async()=>{a("deleting");const k=await $(ve({path:{accountId:s,mailboxId:t},throwOnError:!0}));if(!k.ok){h(k.error),a("error");return}u(),a("done"),r()},[s,t,u,r]),O=c.useCallback(()=>je({path:{accountId:s},throwOnError:!0}).then(({data:k})=>k.items.find(S=>S.mailboxId===t)?.messageCount??0),[s,t]),I=c.useCallback(()=>l.fetchQuery({...ye({path:{accountId:s}}),staleTime:0}).then(k=>k.mailboxes??[]),[l,s]),w=c.useCallback(async()=>{const k=new AbortController;v.current=k;const{signal:S}=k;a("checking"),h(void 0);const M=j.current!==void 0,C=await $((async()=>(M||(S.throwIfAborted(),j.current=is(await I(),t),S.throwIfAborted(),g(Date.now()),await Ne({path:{accountId:s},throwOnError:!0})),os({readMailboxes:I,mailboxId:t,since:j.current??0,signal:S})))());return S.aborted?(a("idle"),j.current=void 0,{status:"failed"}):C.ok?C.value.status==="pending"?(a("check-stalled"),{status:"pending"}):(j.current=void 0,C.value.messageCount>0?(a("idle"),u(),{status:"blocked",messageCount:C.value.messageCount}):(await f(),{status:"deleted"})):(j.current=void 0,h(C.error),a("error"),{status:"failed"})},[s,t,I,f,u]),D=c.useCallback(()=>{v.current?.abort()},[]),N=c.useCallback(async k=>{const S=new AbortController;v.current=S;const{signal:M}=S;a("moving"),h(void 0);const C=await $(O());if(M.aborted)return;if(!C.ok){h(C.error),a("error");return}let x=ke(C.value);o(x);const E=new Set;for(;;){if(M.aborted)return;const n=await $(cs(t,E,Se,M));if(M.aborted)return;if(!n.ok){x=_(x,n.error),o(x),h(n.error),a("error");return}const b=n.value;if(b.length===0)break;const F=await $(Ce({body:{messageIds:b,destinationMailboxId:k},throwOnError:!0}));if(M.aborted)return;if(!F.ok){x=_(x,F.error),o(x),h(F.error),a("error");return}for(const P of b)E.add(P);x=we(x,b.length),o(x)}const A=await $(ds(t,M));if(!M.aborted){if(!A.ok){x=_(x,A.error),o(x),h(A.error),a("error");return}if(A.value>0){const n=`${A.value} ${A.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;x=_(x,n),o(x),h(n),a("error"),u();return}await f()}},[t,O,f,u]),R=c.useCallback(()=>{v.current?.abort(),v.current=null,j.current=void 0,a("idle"),o(null),h(void 0),g(void 0)},[]);return{phase:d,progress:m,errorMessage:i,checkStartedAt:p,deleteMailbox:f,deleteIfEmpty:w,moveThenDelete:N,cancel:D,reset:R}}const L=s=>`${s} ${s===1?"email":"emails"}`;function us({open:s,accountId:t,folder:r,mailboxes:l,appointments:d,onClose:a}){const[m,o]=c.useState(()=>K(r.messageCount)),[i,h]=c.useState(),[p,g]=c.useState(),{createFolderIn:v}=ae(t),j=re(),{phase:u,progress:f,errorMessage:O,checkStartedAt:I,deleteMailbox:w,deleteIfEmpty:D,moveThenDelete:N,cancel:R,reset:k}=ms({accountId:t,mailboxId:r.mailboxId,onDeleted:a}),[S,M]=c.useState("0:00"),C=u==="checking"||u==="check-stalled";c.useEffect(()=>{if(!C||I===void 0)return;const T=()=>M(Ee(Date.now()-I));T();const ue=setInterval(T,1e3);return()=>clearInterval(ue)},[C,I]),c.useEffect(()=>{s&&(o(K(r.messageCount)),h(void 0),k())},[s,k]),c.useEffect(()=>{s&&g(void 0)},[s]),c.useEffect(()=>R,[R]);const x=c.useCallback(()=>{R(),a()},[R,a]),E=c.useCallback(async()=>{const T=await D();T.status==="blocked"&&(h(T.messageCount),o("choose-fate"))},[D]),A=c.useMemo(()=>Me({mailboxes:l,folderAppointments:d,excludeMailboxId:r.mailboxId,translator:j}),[l,d,r.mailboxId,j]),n=A.find(T=>T.id===p),b=c.useMemo(()=>q(r,ne(d).get(r.mailboxId),j),[r,d,j]);if(!s)return null;const F=`Delete ${b}`,P=i??r.messageCount,me=u==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:f?Q(f):"Moved 0 of 0"})]}):u==="checking"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Checking the folder on the mail server…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:`Waiting ${S}. Nothing is deleted until the server answers.`})]}):u==="check-stalled"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(z,{tone:"warning",variant:"soft",children:`The mail server hasn't reported back on this folder yet — ${S} so far. Nothing has been deleted.`}),e.jsx("p",{className:"text-xs text-fg-muted",children:"A sync covers the whole account, so a busy mailbox can take a while to come round to this folder."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(y,{size:"sm",onClick:()=>E(),children:"Keep waiting"})]})]}):u==="deleting"||u==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(G,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):u==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(z,{tone:"danger",variant:"soft",children:O??"Something went wrong. Please try again."}),f&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[Q(f),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Close"})})]}):m==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(y,{variant:"danger",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),onClick:()=>E(),children:"Delete folder"})]})]}):m==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[i!==void 0&&e.jsx(z,{tone:"warning",variant:"soft",children:`This folder is not empty: the mail server reports ${L(i)} in it. Nothing was deleted.`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:b})," holds"," ",L(P),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>o("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(B,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>o("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(Be,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(y,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"})})]}):m==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:b})," and its"," ",L(P),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(y,{variant:"secondary",size:"sm",onClick:()=>o("choose-fate"),children:"Back"}),e.jsx(y,{variant:"danger",size:"sm",icon:e.jsx(B,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",L(P)," in"," ",e.jsx("strong",{className:"text-fg",children:b})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(Y,{folders:A,selectedId:p,delimiter:l[0]?.hierarchyDelimiter??"/",onSelect:g,onCreateFolder:v,onCancel:()=>{g(void 0),o("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),n&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(y,{variant:"danger",onClick:()=>N(n.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${L(P)} to ${n.label}`})})})]});return e.jsxs(W,{open:s,onClose:x,title:F,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(Ie,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:F}),e.jsx(y,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:x,"aria-label":"Cancel"})]}),me]})}function hs({account:s}){const t=J(),r=s.accountId,l=re(),{data:d,isPending:a,isError:m,error:o,refetch:i}=ie(Fe({path:{accountId:r}})),{createFolderIn:h}=ae(r),p=U({...Te(),meta:Re(409),onSuccess:()=>{t.invalidateQueries({queryKey:se()})}}),g=U({...Pe(),onSuccess:()=>{t.invalidateQueries({queryKey:ee({path:{accountId:r}})})}}),[v,j]=c.useState(),[u,f]=c.useState(),[O,I]=c.useState(""),w=c.useMemo(()=>d?.items??[],[d]),D=c.useMemo(()=>ne(s.folderAppointments),[s.folderAppointments]),N=c.useMemo(()=>w.map(n=>({id:n.mailboxId,label:q(n,D.get(n.mailboxId),l),path:n.fullPath,deleteBlockedReason:$e(n,w,s.folderAppointments).message,failure:qe(n)})),[w,D,l,s.folderAppointments]),R=(n,b)=>{p.mutate({path:{accountId:r,role:_e[n]},body:{mailboxId:b}})},k=(n,b)=>{const F=b.trim();g.mutate({path:{accountId:r,mailboxId:n},body:{displayNameOverride:F===""?null:F}})};if(a)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(m)return e.jsx(oe,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:o,onRetry:()=>{i()}});const S=w.map(n=>({mailboxId:n.mailboxId,providerPath:n.fullPath,hierarchyDelimiter:n.hierarchyDelimiter,messageCount:n.messageCount})),M={};for(const n of s.folderAppointments){const b=Le[n.role];b&&(M[b]={mailboxId:n.mailboxId??null,source:n.source,staleFolderPath:n.staleAppointmentPath})}const C={};for(const n of w)n.displayNameOverride&&(C[n.mailboxId]=n.displayNameOverride);const x=n=>w.find(b=>b.mailboxId===n),E=x(u),A=x(v);return e.jsxs("div",{className:"space-y-4",children:[(p.isError||g.isError)&&e.jsx(z,{tone:"danger",variant:"soft",children:ze(p.error)?"That folder is still being created on the mail server — wait for it to finish, then try again.":"Couldn't save that change. Please try again."}),e.jsx(ts,{accountEmail:s.email,folders:S,appointments:M,displayNames:C,onAppoint:R,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(Ve,{folders:N,delimiter:w[0]?.hierarchyDelimiter??"/",onCreateFolder:h,onRename:n=>{f(n.id),I(x(n.id)?.displayNameOverride?.trim()??"")},onDelete:n=>j(n.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),E&&e.jsx(Ye,{open:!0,folderLabel:q(E,D.get(E.mailboxId),l),defaultLabel:q({fullPath:E.fullPath,hierarchyDelimiter:E.hierarchyDelimiter},D.get(E.mailboxId),l),name:O,onNameChange:I,pending:g.isPending,error:g.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const n=O.trim();g.mutate({path:{accountId:r,mailboxId:E.mailboxId},body:{displayNameOverride:n===""?null:n}},{onSuccess:()=>f(void 0)})},onClose:()=>f(void 0)}),A&&e.jsx(us,{open:!0,accountId:r,folder:A,mailboxes:w,appointments:s.folderAppointments,onClose:()=>j(void 0)})]})}function Is(){const s=Ae(),t=De(),r=Ge(),[l,d]=c.useState(!0),{data:a,isPending:m,isError:o,error:i,refetch:h}=ie(Oe());return e.jsx(He,{items:t,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:e.jsx(ss,{}),helpOpen:l,onToggleHelp:()=>d(p=>!p),onSelect:r,onBackToMail:()=>{s({to:"/mail"})},children:m?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):o?e.jsx(oe,{title:"Couldn't load accounts",error:i,onRetry:()=>{h()}}):a.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:a.accounts.map(p=>e.jsx(hs,{account:p},p.accountId))})})}export{Is as component};
@@ -1 +1 @@
1
- import{j as e}from"./index-9JWzpiiR.js";import{K as s}from"./kbd-D_0s6Sx_.js";const a=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"VIP"})," senders get priority surface in the daily brief and notification escalation, even when an account is quiet."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," senders never notify and stay out of the brief. Their mail still syncs and stays searchable."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Blocked"})," senders never load images and go straight to junk."]}),e.jsxs("p",{children:["Tip: flag from the keyboard on any message — ",e.jsx(s,{children:"v"})," VIP,"," ",e.jsx(s,{children:"m"})," mute, ",e.jsx(s,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]}),r=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Sync health"})," shows the IMAP connection state and the last successful sync per account."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Error"})," means the last connection attempt failed — the raw server response is shown on the card. Reconnect re-runs the connection test from the add-account wizard."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," accounts keep syncing but stay out of the daily brief and unified counts."]})]}),c=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Density"})," controls how much information fits on screen. Compact is great on smaller displays; Comfortable gives each item more breathing room."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Theme"})," switches between light, dark, and system-preference modes instantly. The change takes effect across the whole app immediately."]}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Preferences are stored locally in this browser. Server-side sync is coming soon."})]}),i=e.jsx("div",{className:"space-y-3",children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Notification rules"})," and data export are coming in a future release."]})}),o=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["A message that fails to sync three times shows here. A"," ",e.jsx("strong",{className:"text-fg",children:"retrying"})," one is tried again every sync; a body that ",e.jsx("strong",{className:"text-fg",children:"gave up"})," is not. Either leaves the list once it syncs."]}),e.jsxs("p",{children:["A message Remit cannot read is"," ",e.jsx("strong",{className:"text-fg",children:"set aside"})," rather than skipped, and the folder keeps syncing. Setting one aside is a defect in Remit, so every entry can be reported with the diagnostics already attached."]}),e.jsx("p",{children:"A report carries no folder name, subject, address, message content or error text."})]});export{r as a,i as b,c,a as s,o as w};
1
+ import{j as e}from"./index-BnBpXn45.js";import{K as s}from"./kbd-CE7JGsTx.js";const a=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"VIP"})," senders get priority surface in the daily brief and notification escalation, even when an account is quiet."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," senders never notify and stay out of the brief. Their mail still syncs and stays searchable."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Blocked"})," senders never load images and go straight to junk."]}),e.jsxs("p",{children:["Tip: flag from the keyboard on any message — ",e.jsx(s,{children:"v"})," VIP,"," ",e.jsx(s,{children:"m"})," mute, ",e.jsx(s,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]}),r=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Sync health"})," shows the IMAP connection state and the last successful sync per account."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Error"})," means the last connection attempt failed — the raw server response is shown on the card. Reconnect re-runs the connection test from the add-account wizard."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," accounts keep syncing but stay out of the daily brief and unified counts."]})]}),c=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Density"})," controls how much information fits on screen. Compact is great on smaller displays; Comfortable gives each item more breathing room."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Theme"})," switches between light, dark, and system-preference modes instantly. The change takes effect across the whole app immediately."]}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Preferences are stored locally in this browser. Server-side sync is coming soon."})]}),i=e.jsx("div",{className:"space-y-3",children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Notification rules"})," and data export are coming in a future release."]})}),o=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:["A message that fails to sync three times shows here. A"," ",e.jsx("strong",{className:"text-fg",children:"retrying"})," one is tried again every sync; a body that ",e.jsx("strong",{className:"text-fg",children:"gave up"})," is not. Either leaves the list once it syncs."]}),e.jsxs("p",{children:["A message Remit cannot read is"," ",e.jsx("strong",{className:"text-fg",children:"set aside"})," rather than skipped, and the folder keeps syncing. Setting one aside is a defect in Remit, so every entry can be reported with the diagnostics already attached."]}),e.jsx("p",{children:"A report carries no folder name, subject, address, message content or error text."})]});export{r as a,i as b,c,a as s,o as w};
@@ -0,0 +1 @@
1
+ import{b as H,j as e,d as x,B as f,L as W,X as Oe,r,I as Pe,e as pe,a as De,c as _e,f as L,s as de,g as Le,h as qe,i as He,m as We,k as X,l as Qe}from"./index-BnBpXn45.js";import{W as k,C as fe,a as le,u as Ve,b as Ge,c as Ke,d as Ue,S as Xe,R as Ye}from"./credential-steps-Czm9bF6Y.js";import{c as ge,f as Je,v as xe,r as Ze,a as et,b as ue,w as me,p as tt,W as st,s as nt,g as it}from"./config-import-BtJdN8VN.js";import{F as at}from"./file-braces-CEQVt7jm.js";import{B as z}from"./badge-C7MFP1pN.js";import{c as rt}from"./onboarding-completion-EUidFdVK.js";import"./select-DWBegMNA.js";import"./chevron-down-CR89KUgK.js";import"./card-5b65wlka.js";const je={name:"folder-clock",size:24,node:[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2",key:"1urifu"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]};je.node;const ot=H(je);const ve={name:"key-round",size:24,node:[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]};ve.node;const ct=H(ve);const ye={name:"merge",size:24,node:[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]};ye.node;const dt=H(ye);const we={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};we.node;const lt=H(we),y=["File","Review","Credentials","Folders"];function J({children:t}){return e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:t})}function ut({state:t="idle",file:n,ready:i=!1,failure:s,onChoose:d,onDragStateChange:l,onNext:h}){const w=r.useId(),u=r.useRef(null),p=t==="dragging",j=t==="reading",N=t==="checking",R=j||N,S=m=>{m.preventDefault(),l?.(!1);const b=m.dataTransfer.files.item(0);b&&d?.(b)};return e.jsx(k,{steps:y,activeStep:0,title:"Import a config file",subtitle:"Accounts, folder roles, rules, senders and appearance — everything except passwords.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Nothing is written until you have seen what will change."}),e.jsx(f,{variant:"primary",disabled:R||!i,icon:R?e.jsx(W,{className:"size-3.5 animate-spin"}):void 0,onClick:h,children:j?"Reading…":N?"Checking…":"Check the file"})]}),children:e.jsxs("div",{className:"space-y-4",children:[s&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{tone:"danger",children:s.title}),e.jsx("p",{className:"text-sm text-fg",children:s.explanation}),e.jsx("p",{className:"text-sm text-fg-muted",children:s.fix}),e.jsx(J,{children:s.raw})]}),e.jsxs("div",{onDragOver:m=>{m.preventDefault(),l?.(!0)},onDragLeave:()=>l?.(!1),onDrop:S,className:p?"flex flex-col items-center gap-3 rounded-sm border-2 border-dashed border-accent bg-accent-soft px-4 py-9 text-center":"flex flex-col items-center gap-3 rounded-sm border-2 border-dashed border-line px-4 py-9 text-center",children:[e.jsx("span",{className:"flex size-11 items-center justify-center rounded-md bg-surface-sunken",children:e.jsx(lt,{className:"size-5 text-fg-muted"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:p?"Drop it here":"Drop a config file here, or choose one"}),e.jsx("p",{className:"mt-1 text-xs text-fg-subtle",children:"A .json file written by Reader — up to 2 MB."})]}),e.jsx("input",{ref:u,id:w,type:"file",accept:"application/json,.json",className:"sr-only",onChange:m=>{const b=m.target.files?.item(0);b&&d?.(b)}}),e.jsx(f,{variant:"secondary",size:"sm",onClick:()=>u.current?.click(),children:"Choose file"})]}),n&&e.jsxs("div",{className:"flex items-start gap-3 rounded-sm border border-line px-3 py-2.5",children:[e.jsx(at,{className:"mt-0.5 size-4 shrink-0 text-fg-muted"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm text-fg",children:n.name}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[Je(n.size)," ·"," ",j?"reading it from disk":N?"checking it against this instance":i?"ready to check — nothing has been sent yet":"not a configuration this instance can read"]})]})]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Export one from Settings → Advanced on the instance you are moving from, or run"," ",e.jsx("code",{className:"rounded bg-surface-sunken px-1 py-0.5",children:"remit config save"})," ","on its host."]})]})})}function mt({sections:t}){const n=ge(t.flatMap(i=>i.entries.map(s=>({section:i.id,key:s.label,verdict:s.verdict}))));return e.jsx("div",{className:"flex flex-wrap gap-1.5",children:["created","updated","unchanged","skipped","rejected"].filter(i=>n[i]>0).map(i=>e.jsxs(z,{tone:xe[i],dot:!0,children:[n[i]," ",i]},i))})}function ht({section:t}){return e.jsxs("section",{children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:t.title}),e.jsx("ul",{className:"mt-1.5 divide-y divide-line",children:t.entries.map(n=>e.jsxs("li",{className:"flex items-start gap-3 py-2",children:[e.jsx(z,{tone:xe[n.verdict],className:"mt-0.5 shrink-0",children:n.verdict}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm text-fg",children:n.label}),n.reason&&e.jsx("p",{className:n.verdict==="rejected"?"mt-1 text-xs text-danger":"mt-1 text-xs text-warning",children:n.reason})]})]},n.id))})]})}function pt({sections:t,fileName:n,warnings:i=[],applying:s=!1,onBack:d,onNext:l}){const h=ge(t.flatMap(p=>p.entries.map(j=>({section:p.id,key:j.label,verdict:j.verdict})))),w=h.created+h.updated,u=h.skipped+h.rejected;return e.jsx(k,{steps:y,activeStep:1,title:"What this file will change",subtitle:`${n} · nothing has been written yet.`,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:d,children:"Choose another file"}),e.jsx(f,{variant:"primary",disabled:s,icon:s?e.jsx(W,{className:"size-3.5 animate-spin"}):void 0,onClick:l,children:s?"Importing…":`Import ${w} changes`})]}),children:e.jsxs("div",{className:"space-y-5",children:[e.jsx(mt,{sections:t}),u>0&&e.jsxs(x,{tone:"warning",children:[u," entries will not be imported. Each says why below — read them before you continue, because nothing here retries on its own."]}),i.length>0&&e.jsx("ul",{className:"space-y-1 text-xs text-warning",children:i.map(p=>e.jsx("li",{children:p},p))}),t.map(p=>e.jsx(ht,{section:p},p.id))]})})}function ft({choice:t,held:n,onChoose:i,onBack:s,onNext:d}){return e.jsx(k,{steps:y,activeStep:1,title:"This instance already has configuration",subtitle:n,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:s,children:"Choose another file"}),e.jsx(f,{variant:"primary",disabled:!t,onClick:d,children:t==="merge"?"Continue with merge":"Continue"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(x,{tone:"warning",children:"An import into a configured instance can only add and update — it never deletes what is here. Pick how the two should meet."}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsx(le,{name:"Stop, keep this instance",description:"Nothing is written. Use this if you meant to import into a fresh instance.",icon:e.jsx(Oe,{className:"size-5"}),selected:t==="abort",onSelect:()=>i?.("abort")}),e.jsx(le,{name:"Merge the file in",description:"Adds what is missing and updates what differs. Existing accounts keep their server settings.",icon:e.jsx(dt,{className:"size-5"}),selected:t==="merge",onSelect:()=>i?.("merge")})]}),t==="merge"&&e.jsx("p",{className:"text-xs text-fg-muted",children:"The next screen lists every add and update before anything is written."})]})})}function gt(t){return t==="entered"?e.jsx(z,{tone:"positive",children:"ready"}):t==="failed"?e.jsx(z,{tone:"danger",children:"sign-in failed"}):e.jsx(z,{tone:"danger",children:"credentials needed"})}function xt({accounts:t,busyAccountId:n,onOpen:i}){return e.jsx("ul",{className:"divide-y divide-line",children:t.map(s=>e.jsxs("li",{className:s.state==="entered"?"flex flex-wrap items-start justify-between gap-3 py-3":"flex flex-wrap items-start justify-between gap-3 border-l-2 border-danger bg-danger-soft py-3 pl-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-fg",children:s.address}),gt(s.state)]}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[s.displayName," ·"," ",s.connector==="microsoft"?"Microsoft 365":"IMAP / SMTP"," ","· ",s.server]}),s.state!=="entered"&&e.jsx("p",{className:"mt-1 text-xs text-danger",children:s.failure??(s.connector==="microsoft"?"Config files never carry OAuth tokens. Reconnect with Microsoft to start syncing this account.":"Config files never carry passwords. Enter this mailbox's password to start syncing.")})]}),s.state!=="entered"&&e.jsx(f,{variant:"primary",size:"sm",disabled:n===s.accountId,icon:n===s.accountId?e.jsx(W,{className:"size-3.5 animate-spin"}):s.connector==="microsoft"?e.jsx(Pe,{className:"size-3.5"}):e.jsx(ct,{className:"size-3.5"}),onClick:()=>i?.(s),children:n===s.accountId?"Redirecting…":s.connector==="microsoft"?"Reconnect":s.state==="failed"?"Try again":"Enter password"})]},s.accountId))})}function jt({accounts:t,busyAccountId:n,error:i,onOpen:s,onNext:d}){const l=t.filter(h=>h.state!=="entered").length;return e.jsx(k,{steps:y,activeStep:2,title:"These accounts need credentials",subtitle:"The config file carries servers and settings. Passwords and Microsoft sign-ins it deliberately leaves out.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:l>0?"Settings › Accounts keeps asking until every account is signed in.":"Every account can sync."}),e.jsx(f,{variant:"primary",onClick:d,children:l>0?"Finish later":"All accounts connected"})]}),children:e.jsxs("div",{className:"space-y-4",children:[i&&e.jsx(x,{tone:"danger",children:i}),l>0&&e.jsxs(x,{tone:"danger",children:[l," of ",t.length," accounts cannot sync yet. They stay listed in Settings, marked like this, until you sign in — no mail arrives for them in the meantime."]}),e.jsx(xt,{accounts:t,busyAccountId:n,onOpen:s})]})})}function vt({account:t,position:n,total:i,error:s,busy:d=!1,onBack:l,onNext:h}){return e.jsx(k,{steps:y,activeStep:2,title:`Reconnect ${t.address}`,subtitle:`Account ${n} of ${i} · Microsoft 365`,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:l,children:"Back"}),e.jsx(f,{variant:"primary",disabled:d,icon:d?e.jsx(W,{className:"size-3.5 animate-spin"}):void 0,onClick:h,children:d?"Redirecting…":"Sign in with Microsoft"})]}),children:e.jsxs("div",{className:"space-y-4",children:[s&&e.jsx(x,{tone:"danger",children:s}),e.jsx(x,{tone:"info",children:"A config file never carries an OAuth token — one only works for the instance it was granted to. Signing in here mints a fresh one for this instance."}),e.jsxs("div",{className:"rounded-sm border border-line px-3 py-2.5",children:[e.jsx("p",{className:"text-sm text-fg",children:t.displayName}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[t.address," · ",t.server]})]}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"You will be sent to Microsoft and returned here. If your organisation requires admin approval, the sign-in stops there and this account keeps waiting."})]})})}function yt({folders:t,onNext:n}){return e.jsx(k,{steps:y,activeStep:3,title:t.length>0?"Creating folders":"Import finished",subtitle:t.length>0?"The config names folders this account does not have yet. Reader creates them on the mail server.":"Everything in the file landed, and every folder it named resolved.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Folder discovery runs with every sync."}),e.jsx(f,{variant:"primary",onClick:n,children:"Go to inbox"})]}),children:e.jsx("div",{className:"space-y-4",children:t.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(x,{tone:"warning",children:[t.length," settings are imported but switched off. Reader creates each missing folder on the mail server the next time the account syncs, and turns the setting on once the server confirms it. A rule whose folder cannot be created stays off, and Settings → Filters says why."]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(ot,{className:"size-4"}),"Folder discovery runs with every sync of the account."]}),e.jsx("div",{className:"divide-y divide-line",children:t.map(i=>e.jsx(fe,{label:i.path,detail:i.waitingFor,state:"pending"},`${i.accountId??""}-${i.path}-${i.waitingFor}`))})]}):e.jsx(x,{tone:"success",children:"Every account, rule, label and sender in the file is live on this instance."})})})}function wt({failure:t,onBack:n}){return e.jsx(k,{steps:y,activeStep:0,title:t.title,subtitle:"Nothing was imported.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"This instance is unchanged."}),e.jsx(f,{variant:"primary",onClick:n,children:"Choose another file"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{tone:"danger",children:t.explanation}),e.jsx("p",{className:"text-sm text-fg",children:t.fix}),e.jsx(J,{children:t.raw})]})})}function bt(t){return t==="landed"?"ok":t==="failed"||t==="unknown"?"failed":"pending"}function kt({results:t,message:n,raw:i,nothingLanded:s,onBack:d,onNext:l}){const h=t.filter(u=>u.state==="landed").length,w=t.some(u=>u.state==="unknown");return e.jsx(k,{steps:y,activeStep:1,title:s?"The import stopped, and nothing landed":"The import stopped part-way",subtitle:s?"No section of the file was written.":w?"It did not say how far it got, so check Settings before importing again.":`${h} of ${t.length} sections landed.`,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:d,children:"Choose another file"}),e.jsx(f,{variant:"primary",onClick:l,children:s?"Try the import again":"Retry the rest"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(x,{tone:"danger",children:n}),e.jsx("p",{className:"text-sm text-fg-muted",children:"Retrying is safe: an import folds into what is already here rather than replacing it, so what landed is recognised and left alone."}),e.jsx("div",{className:"divide-y divide-line",children:t.map(u=>e.jsx(fe,{label:u.title,detail:u.detail,state:bt(u.state)},u.section))}),e.jsx(J,{children:i})]})})}const be=(t,n)=>t?"tls":n?"starttls":"none",Nt=t=>({host:t.imapHost,port:t.imapPort,security:be(t.imapTls,t.imapStartTls)}),St=t=>({host:t.smtpEnabled?t.smtpHost:"",port:t.smtpPort,security:be(t.smtpTls,t.smtpStartTls)}),he=(t,n,i)=>{const s=t.authType==="oauthMicrosoft"?"microsoft":"imap",d=!i&&(s==="microsoft"?t.connectionState==="reauth_required":t.connectionState==="credentials_missing");return{accountId:t.accountId,address:t.email,displayName:t.displayName?.trim()||t.email,connector:s,server:`${t.imapHost}:${t.imapPort}`,state:n?"failed":d?"needed":"entered",failure:n}},Ct=t=>{if(!t)return"This instance already holds configuration of its own.";const n=[["accounts","account"],["labels","label"],["filters","rule"],["addressFlags","flagged sender"]].map(([i,s])=>({count:Number(t[i]??0),noun:s})).filter(i=>i.count>0).map(i=>`${i.count} ${i.noun}${i.count===1?"":"s"}`);return n.length===0?"This instance already holds configuration of its own.":`${n.join(", ")} are set up here already.`},q=(t,n)=>{if(t instanceof Error)return t.message;if(typeof t=="object"&&t!==null){const i=t.message;if(typeof i=="string")return i}return n};function It({onDone:t}){const n=pe(),[i,s]=r.useState("file"),[d,l]=r.useState(!1),[h,w]=r.useState(!1),[u,p]=r.useState(void 0),[j,N]=r.useState(void 0),[R,S]=r.useState(void 0),[m,b]=r.useState(void 0),[Z,ee]=r.useState("abort"),[te,se]=r.useState(void 0),[Ne,Q]=r.useState(void 0),[C,Se]=r.useState([]),[V,Ce]=r.useState([]),[g,I]=r.useState(null),[T,G]=r.useState({username:"",password:""}),[F,K]=r.useState({}),[Ie,ne]=r.useState(void 0),[U,$]=r.useState(null),[B,Te]=r.useState([]),{data:O}=De({..._e(),enabled:C.length>0||i==="folders"}),A=r.useMemo(()=>{const a=new Map;for(const o of O?.accounts??[])a.set(o.accountId,o);return a},[O]),Re=r.useMemo(()=>C.map(a=>A.get(a)).filter(a=>!!a).map(a=>he(a,F[a.accountId],V.includes(a.accountId))),[C,A,F,V]),c=g?A.get(g):void 0,ie=g?C.indexOf(g)+1:0,P=L({...Le(),meta:de(409)}),ae=L({...qe(),meta:de(403,404)}),re=L(He()),oe=L(We());Ve(U!==null,()=>{n.invalidateQueries({queryKey:X()}),$(null)});const ce=Ge(a=>{$(null),a==="stalled"&&ne(Ye)}),Fe=r.useCallback(a=>{l(!1),w(!0),p({name:a.name,size:a.size}),S(void 0),N(void 0),a.text().then(o=>Ze(a.name,a.size,o)).then(o=>{if(w(!1),!o.ok){S(o.failure);return}N(o.document)}).catch(o=>{w(!1),S({title:"That file could not be read",explanation:`The browser could not read ${a.name} from disk, so nothing was sent.`,fix:"Check the file is still there and try again.",raw:q(o,"the file read was refused")})})},[]),D=r.useCallback((a,o)=>{j&&(Q(void 0),P.mutate({body:{mode:a,onExisting:o,document:j}},{onSuccess:v=>{if(b(v),ue(v)){s("rejected");return}if(me(v)){s("partial");return}if(a==="validate"){s("review");return}if(Te(tt(v)),n.invalidateQueries({queryKey:X()}),v.accountsNeedingCredentials.length>0){Se([...v.accountsNeedingCredentials]),s("credentials");return}s("folders")},onError:v=>{const _=et(v);if(_){Q(_),se(void 0),s("conflict");return}S({title:"The import could not be sent",explanation:"The request to this instance failed before it produced a report, so nothing was written.",fix:"Check your connection and try again.",raw:q(v,"POST /config/import failed")}),s("file")}}))},[j,P,n]),Ae=r.useCallback(a=>{if(I(a.accountId),ne(void 0),a.connector==="microsoft"){s("account-oauth");return}const o=A.get(a.accountId);G({username:o?.username||a.address,password:""}),s("account-password")},[A]),Me=r.useCallback(()=>{g&&ae.mutate({path:{accountId:g},body:{password:T.password,isActive:!0}},{onSuccess:()=>{re.mutate({path:{accountId:g}}),Ce(a=>a.includes(g)?a:[...a,g]),K(a=>{const o={...a};return delete o[g],o}),n.invalidateQueries({queryKey:X()}),G({username:"",password:""}),I(null),s("credentials")},onError:a=>{K(o=>({...o,[g]:q(a,"The password was verified but could not be stored. Try again.")})),I(null),s("credentials")}})},[g,T.password,n,re,ae]),Ee=r.useCallback(()=>{c&&($(c.accountId),oe.mutate({body:{email:c.email}},{onSuccess:a=>{ce(),window.location.assign(a.authorizationUrl)},onError:a=>{$(null),K(o=>({...o,[c.accountId]:q(a,"Microsoft sign-in could not be started.")})),I(null),s("credentials")}}))},[c,ce,oe]),ze=r.useCallback((a,o)=>G({username:a,password:o}),[]),$e=r.useMemo(()=>{const a=O?.pendingImport?.folderPaths;if(!a)return B;const o=new Set(a),v=B.filter(E=>o.has(E.path)),_=a.filter(E=>!B.some(Be=>Be.path===E)).map(E=>({path:E,waitingFor:"An imported setting"}));return[...v,..._]},[O,B]),M=r.useCallback(()=>{b(void 0),Q(void 0),S(void 0),p(void 0),N(void 0),ee("abort"),s("file")},[]);switch(i){case"file":return e.jsx(ut,{state:h?"reading":P.isPending?"checking":d?"dragging":"idle",file:u,ready:j!==void 0,failure:R,onChoose:Fe,onDragStateChange:l,onNext:()=>D("validate",Z)});case"rejected":return e.jsx(wt,{failure:(m&&ue(m))??R??{title:"The file could not be imported",explanation:"The import was refused and nothing was written.",fix:"Re-export the configuration and try again.",raw:"no error was reported"},onBack:M});case"conflict":return e.jsx(ft,{choice:te,held:Ct(Ne?.details),onChoose:se,onBack:M,onNext:()=>{if(te==="abort"){t("abandoned");return}ee("merge"),D("validate","merge")}});case"review":return e.jsx(pt,{sections:it(m?.items??[]),fileName:u?.name??"the config file",warnings:(m?.warnings??[]).map(a=>a.message),applying:P.isPending,onBack:M,onNext:()=>D("apply",Z)});case"partial":{if(!m)return e.jsx(Tt,{onBack:M});const a=me(m);return e.jsx(kt,{results:nt(m),message:a?.message??"The import stopped before it finished.",raw:`${a?.code??st}: ${a?.message??"no message"}`,nothingLanded:!m.applied,onBack:M,onNext:()=>D("apply","merge")})}case"credentials":return e.jsx(jt,{accounts:Re,busyAccountId:U??void 0,error:Ie,onOpen:Ae,onNext:()=>s("folders")});case"account-password":return c?e.jsx(Ue,{steps:y,activeStep:2,title:`Sign in to ${c.email}`,subtitle:`Account ${ie} of ${C.length} · ${c.imapHost}:${c.imapPort}`,email:c.email,username:T.username,password:T.password,error:F[c.accountId],continueLabel:"Test and continue",notice:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(Xe,{className:"size-3.5"}),"Server settings came from the config file — edit them in Settings if they are wrong."]}),onContinue:()=>s("account-test"),onBack:()=>{I(null),s("credentials")},onChange:ze}):e.jsx(Y,{onBack:()=>t("abandoned")});case"account-test":return c?e.jsx(Ke,{steps:y,activeStep:2,email:c.email,imapConfig:Nt(c),smtpConfig:St(c),username:T.username,password:T.password,credentialsBackLabel:"Back to the password",serversBackLabel:"Back to the password",successLabel:"Save and continue",onSuccess:Me,onBackToCredentials:()=>s("account-password"),onBackToServers:()=>s("account-password")}):e.jsx(Y,{onBack:()=>t("abandoned")});case"account-oauth":return c?e.jsx(vt,{account:he(c,F[c.accountId],V.includes(c.accountId)),position:ie,total:C.length,error:F[c.accountId],busy:U===c.accountId,onBack:()=>{I(null),s("credentials")},onNext:Ee}):e.jsx(Y,{onBack:()=>t("abandoned")});case"folders":return e.jsx(yt,{folders:$e,onNext:()=>t("imported")})}}function ke({children:t,label:n,onBack:i}){return e.jsxs("div",{className:"mx-auto max-w-lg p-6",children:[e.jsx(x,{tone:"danger",children:t}),e.jsx("button",{type:"button",className:"mt-3 text-sm text-accent underline",onClick:i,children:n})]})}function Y({onBack:t}){return e.jsx(ke,{label:"Go to inbox",onBack:t,children:"That account is no longer in this instance's configuration, so there is nothing left to sign in to. Open Settings › Accounts to see what is here."})}function Tt({onBack:t}){return e.jsx(ke,{label:"Choose another file",onBack:t,children:"The import stopped but produced no report, so nothing here can say what it wrote. Open Settings to see what this instance holds before importing again."})}function Pt(){const t=Qe(),n=pe(),i=r.useCallback(s=>{rt({queryClient:n,recordCompleted:()=>{s==="imported"&&t.recordEvent("config.imported")},navigateToInbox:()=>{window.location.assign("/mail")}})},[t,n]);return e.jsx(It,{onDone:i})}export{Pt as component};
@@ -0,0 +1 @@
1
+ import{eZ as o,j as r}from"./index-BnBpXn45.js";import{C as m}from"./CalendarEventPopup-Dr1Zl88E.js";import"./useCalendarSuggestions-COzKAJgT.js";import"./ErrorState-Czrn8Njd.js";import"./useQueries-BomGTQs-.js";import"./useCalendarData-Djtg1pj2.js";import"./useCalendarTasks-D5yN61q_.js";import"./calendar-format-BwCpz-JZ.js";import"./nav-link-CjSE3MDU.js";import"./useMediaQuery-DOpCuIgp.js";import"./calendar-B8lLrLAb.js";import"./reply-CzX8Q1T1.js";import"./CalendarSession-UbavgUO4.js";import"./calendar-event-popup-C92tAdsE.js";import"./pencil-rhg9PvnD.js";import"./calendar-guests-DnrOkTr7.js";import"./circle-question-mark-BVVFmkJG.js";import"./confirm-dialog-DYNhLVrG.js";function b(){const{calendarObjectId:t}=o.useParams();return r.jsx(m,{calendarObjectId:t})}export{b as component};