@remit/web-client-dist 0.0.680 → 0.0.681

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 (182) hide show
  1. package/assets/{BriefPane-CcwdfBlh.js → BriefPane-Ct5mLFno.js} +1 -1
  2. package/assets/{CalendarEventEditor-Cpu5cJxJ.js → CalendarEventEditor-BDZOuAkE.js} +1 -1
  3. package/assets/{CalendarEventPopup-ecl1-NSt.js → CalendarEventPopup-Cd49o1aV.js} +1 -1
  4. package/assets/{CalendarLoadFailed-BbUr2ubu.js → CalendarLoadFailed--QaS7mCJ.js} +1 -1
  5. package/assets/{CalendarQuickCreate-DF0Uxv4V.js → CalendarQuickCreate-BYHJja5o.js} +1 -1
  6. package/assets/{CalendarSession-XIbMK3oT.js → CalendarSession-CS_x_fs5.js} +1 -1
  7. package/assets/{DesktopChrome-Ciuao7Ro.js → DesktopChrome-DGlb8cny.js} +1 -1
  8. package/assets/{DropdownMenu-fskbk1FW.js → DropdownMenu-T79mAX3f.js} +1 -1
  9. package/assets/{EmptyState-CzSAWxdK.js → EmptyState-CA538vCg.js} +1 -1
  10. package/assets/{ErrorState-KWmymUQR.js → ErrorState-DD3UfsN8.js} +1 -1
  11. package/assets/{FlaggedPane-CMZMZWbM.js → FlaggedPane-DLqwSIp0.js} +1 -1
  12. package/assets/{FullCompose-6pNo7wi4.js → FullCompose-DnUwBsN_.js} +1 -1
  13. package/assets/{LabelApplyTrigger-C0GQNIEk.js → LabelApplyTrigger-Ox3K3UZo.js} +1 -1
  14. package/assets/{MailShell--jgEGKni.js → MailShell-DVTROO5Y.js} +1 -1
  15. package/assets/{MailViewChrome-33SQAjQn.js → MailViewChrome-BXIIRW1m.js} +1 -1
  16. package/assets/{MailboxPane-CvW6x3uh.js → MailboxPane-ZTGfkp9r.js} +1 -1
  17. package/assets/{MessageBody-Ba6dVlG6.js → MessageBody-Bn9CiLsL.js} +1 -1
  18. package/assets/{MessageToolbar-BB_mPS4p.js → MessageToolbar-bKPOSy0d.js} +1 -1
  19. package/assets/{NavMenuButton-DuV5qIvO.js → NavMenuButton-DS-H9eDz.js} +1 -1
  20. package/assets/{OnboardingWizard-BHqhUNht.js → OnboardingWizard-BpOpo7pG.js} +1 -1
  21. package/assets/OutboxPane-D90GSWPB.js +1 -0
  22. package/assets/_calendarObjectId-DLrseFHy.js +1 -0
  23. package/assets/_mailboxId-ChbfZSu5.js +1 -0
  24. package/assets/_messageId-C3xB5mTr.js +1 -0
  25. package/assets/_messageId-DkZ9lbs8.js +1 -0
  26. package/assets/_messageId-sIYPsGs_.js +1 -0
  27. package/assets/_outboxMessageId-p9gMPFrF.js +1 -0
  28. package/assets/_recurrenceId-Dr6Hnp4i.js +1 -0
  29. package/assets/_threadId-CZDsH_MT.js +1 -0
  30. package/assets/_threadId-H8aKyGzF.js +1 -0
  31. package/assets/_threadId-KqET2q-N.js +1 -0
  32. package/assets/{_view._date-BcsaqrBS.js → _view._date-FIQ-o-2N.js} +1 -1
  33. package/assets/{account-service-status-u9m2wO3G.js → account-service-status-6nrumJJk.js} +1 -1
  34. package/assets/{accounts-GeT0KphS.js → accounts-BzG1i3mT.js} +1 -1
  35. package/assets/{advanced-A-kGFwE6.js → advanced-BNNZ1epf.js} +1 -1
  36. package/assets/{agenda-time-C_tFoNHA.js → agenda-time-C_THqiEa.js} +1 -1
  37. package/assets/{app-chrome-CAqI0L8I.js → app-chrome-Cb3lBdOZ.js} +1 -1
  38. package/assets/{appearance-C0uk70LK.js → appearance-BihwpGRs.js} +1 -1
  39. package/assets/{avatar-BKCZjVnK.js → avatar-COUm7SBG.js} +1 -1
  40. package/assets/{badge-BmEPIQJj.js → badge-C-N2Sfyc.js} +1 -1
  41. package/assets/{bottom-sheet-CYnEFnuG.js → bottom-sheet-DDC7O5sx.js} +1 -1
  42. package/assets/{brief-CT4sagsk.js → brief-Bs9H-S4e.js} +1 -1
  43. package/assets/brief-DJ5051HC.js +1 -0
  44. package/assets/{calendar-DEqazg7d.js → calendar-BR-28-ej.js} +1 -1
  45. package/assets/{calendar-W0j7nrh5.js → calendar-BYyDHpZa.js} +1 -1
  46. package/assets/{calendar-event-popup-GQy2blc9.js → calendar-event-popup-Clle6FA1.js} +1 -1
  47. package/assets/{calendar-event-sidebar-BdPLf9Q-.js → calendar-event-sidebar-CPgDwmOs.js} +1 -1
  48. package/assets/{calendar-failure-note-Cc_-yh_l.js → calendar-failure-note-C9fIL_8K.js} +1 -1
  49. package/assets/{calendar-guests-DCkwUUaR.js → calendar-guests-DEOe1juO.js} +1 -1
  50. package/assets/{calendar-suggestion-w5Buli06.js → calendar-suggestion-DVjK0aSt.js} +1 -1
  51. package/assets/{calendars-CN_LOe7f.js → calendars-DaDEW0oA.js} +1 -1
  52. package/assets/{card-BYFKESRL.js → card-MWxaP_DH.js} +1 -1
  53. package/assets/{checkbox-CPr2JwkJ.js → checkbox-jLurGcNS.js} +1 -1
  54. package/assets/chevron-down-B3lcZAVN.js +1 -0
  55. package/assets/chevron-left-B-i0rFYx.js +1 -0
  56. package/assets/{circle-check-DyyOWTYB.js → circle-check-QqmhC0RV.js} +1 -1
  57. package/assets/{circle-check-big-CVlYwPvW.js → circle-check-big-ChJ8pH-b.js} +1 -1
  58. package/assets/{circle-help-BSxYNH4r.js → circle-help-C9O6dqh6.js} +1 -1
  59. package/assets/{clock-DQO0Oi4O.js → clock-CNuf0kus.js} +1 -1
  60. package/assets/{cloud-off-CUN7xSDU.js → cloud-off-C48CGroa.js} +1 -1
  61. package/assets/compose._-_outboxMessageId_-7cX9IraZ.js +1 -0
  62. package/assets/compose._-_outboxMessageId_-B4dAIiSz.js +1 -0
  63. package/assets/compose._-_outboxMessageId_-B8Bi18pS.js +1 -0
  64. package/assets/compose._-_outboxMessageId_-T4c20e76.js +1 -0
  65. package/assets/{config-import-3qED7KRP.js → config-import-BAWkCcKm.js} +1 -1
  66. package/assets/{confirm-dialog-DCFAU3wg.js → confirm-dialog-CjHvZbGT.js} +1 -1
  67. package/assets/{copy-CMEksM9b.js → copy-Ixy5ZR35.js} +1 -1
  68. package/assets/{credential-steps-DjMS9JxY.js → credential-steps-CREMZs9P.js} +1 -1
  69. package/assets/{download-DpUgrnYE.js → download-DCGyf3W_.js} +1 -1
  70. package/assets/{draft-UntYYkEO.js → draft-H1bLeWg_.js} +1 -1
  71. package/assets/edit-BX860zdz.js +1 -0
  72. package/assets/edit-DvrV6duf.js +1 -0
  73. package/assets/{external-link-Dp_vrT3U.js → external-link-kBeg4Rkl.js} +1 -1
  74. package/assets/{file-json-BXCpWMKO.js → file-json-CxV9Z8Xk.js} +1 -1
  75. package/assets/{filters-BPOqWe_z.js → filters-BqpcwwPd.js} +1 -1
  76. package/assets/{flagged-DOHBcWRm.js → flagged-Bjcd8w-O.js} +1 -1
  77. package/assets/flagged-DXwt3SZW.js +1 -0
  78. package/assets/{folder-input-v9jv3QvB.js → folder-input-CmDkygvp.js} +1 -1
  79. package/assets/{folders-WZv8o8Yl.js → folders-CeYrerQG.js} +1 -1
  80. package/assets/{help-copy-BEXklmCF.js → help-copy-DLhRgp5W.js} +1 -1
  81. package/assets/{import-H021ROti.js → import-yc3QynRF.js} +1 -1
  82. package/assets/index-44Nd6hoS.js +1 -0
  83. package/assets/index-BafgExsO.js +1 -0
  84. package/assets/index-C3xB5mTr.js +1 -0
  85. package/assets/index-D4ibfGR2.js +1 -0
  86. package/assets/index-D8uIyhWM.js +1 -0
  87. package/assets/index-DXydIDl3.js +1 -0
  88. package/assets/index-D_t--guV.js +1 -0
  89. package/assets/{index-KSq98OCk.js → index-DjF679iU.js} +4 -4
  90. package/assets/index-PazExuj-.js +1 -0
  91. package/assets/{index-BVIV7uOn.js → index-X3HUQEvM.js} +3 -3
  92. package/assets/index-rv5AdzRX.js +1 -0
  93. package/assets/index-sIYPsGs_.js +1 -0
  94. package/assets/{kbd-CD9WJQDD.js → kbd-DiYloCGE.js} +1 -1
  95. package/assets/{label-chip-D6H7mAQZ.js → label-chip-tLLbdHoz.js} +1 -1
  96. package/assets/{labels-B1aYofac.js → labels-DwqUITi6.js} +1 -1
  97. package/assets/{mail-BXDRGUJS.js → mail-CDuFGyaA.js} +1 -1
  98. package/assets/{mail-CzYW0cEP.js → mail-DxkYnpSf.js} +1 -1
  99. package/assets/{menu-Cul_tOCl.js → menu-v-YxaQQ_.js} +1 -1
  100. package/assets/new-BrQZmpeT.js +1 -0
  101. package/assets/onboarding-DLvfj4LK.js +1 -0
  102. package/assets/{onboarding-completion-C5SxIJff.js → onboarding-completion-BG60cd5s.js} +1 -1
  103. package/assets/outbox-CZQb6qAX.js +1 -0
  104. package/assets/{pencil-D4t_TOKs.js → pencil-BnBK7tmS.js} +1 -1
  105. package/assets/{people-CBau3oq-.js → people-OwHrHrdJ.js} +1 -1
  106. package/assets/{plus-BSFg3ibr.js → plus-GnqfNmfx.js} +1 -1
  107. package/assets/{popover-menu-Drk7oRld.js → popover-menu-J56UZVjI.js} +1 -1
  108. package/assets/{refresh-cw-CuoE7FSQ.js → refresh-cw-3jpeaUi7.js} +1 -1
  109. package/assets/{reply-DtObeSB2.js → reply-Bs_YhRF4.js} +1 -1
  110. package/assets/{rich-text-Fi0gjjkk.js → rich-text-Bd-wRHu1.js} +1 -1
  111. package/assets/{rich-text-spellcheck-worker-provider-uKovGi4E.js → rich-text-spellcheck-worker-provider-Bnm0BFqL.js} +1 -1
  112. package/assets/{rotate-ccw-9KACcb0y.js → rotate-ccw-D8SF2xHr.js} +1 -1
  113. package/assets/{roving-focus-WwAX8-VC.js → roving-focus-nxbliQos.js} +1 -1
  114. package/assets/{row-actions-C0oNI3Ia.js → row-actions-YYjMjrwp.js} +1 -1
  115. package/assets/{search-mirror-CQaPpynv.js → search-mirror-DgYKzQ_z.js} +1 -1
  116. package/assets/{search-scope-CuQFKckU.js → search-scope-D_Xp19lV.js} +1 -1
  117. package/assets/{search-token-index-BXdRQHFC.js → search-token-index-BIZzLNv9.js} +1 -1
  118. package/assets/{sections-DssOe_S4.js → sections-CRDaS4nn.js} +1 -1
  119. package/assets/{segmented-control-DH-yNZtm.js → segmented-control-DFN0EF39.js} +1 -1
  120. package/assets/{select-CU_oR6rc.js → select-DaBof-xM.js} +1 -1
  121. package/assets/{senders-OMax5Bsf.js → senders-BReSWLlj.js} +1 -1
  122. package/assets/settings-DXQ3zZlR.js +1 -0
  123. package/assets/{settings-screen-FlCW-JB0.js → settings-screen-DU3TjNi2.js} +1 -1
  124. package/assets/{shield-check-7IzpHero.js → shield-check-DZBDPqGc.js} +1 -1
  125. package/assets/{sparkles-D9JSeha5.js → sparkles-DrZ81rOU.js} +1 -1
  126. package/assets/{suggest-list-MxpHM4zs.js → suggest-list-Bl5m8GjB.js} +1 -1
  127. package/assets/{suggested-vips-CUOrJsvn.js → suggested-vips-CjpCfM-Q.js} +1 -1
  128. package/assets/{suggestion._suggestionId-BDEu9XtG.js → suggestion._suggestionId-KbtftShf.js} +1 -1
  129. package/assets/{task._calendarTaskId-glaP1HGu.js → task._calendarTaskId-CJNNC87Y.js} +1 -1
  130. package/assets/{undo-2-BLxVGig8.js → undo-2-DT3EdJen.js} +1 -1
  131. package/assets/{useCalendarData-BHwxEmxu.js → useCalendarData-CDMAl9sB.js} +1 -1
  132. package/assets/{useCalendarScheduling-BPs-bAlU.js → useCalendarScheduling-J13iQDXH.js} +1 -1
  133. package/assets/{useCalendarSuggestions-C4O39URl.js → useCalendarSuggestions-BLiBIz-1.js} +1 -1
  134. package/assets/{useCalendarTasks-BYrDBjzg.js → useCalendarTasks-DClcdx9Q.js} +1 -1
  135. package/assets/{useDebouncedValue-CQk7uQJy.js → useDebouncedValue-CiTDV7kX.js} +1 -1
  136. package/assets/{useFilters-DXcDtC9M.js → useFilters-D_mEdyEH.js} +1 -1
  137. package/assets/{useLabels-Ds4FhWUf.js → useLabels-Beg-UxxE.js} +1 -1
  138. package/assets/{useLayoutTier-CDh6ugx0.js → useLayoutTier-B5_piqNJ.js} +1 -1
  139. package/assets/{useMediaQuery-DHHct6HU.js → useMediaQuery-9NJJDrX6.js} +1 -1
  140. package/assets/{useMessageBodyContent-Bz4eLwYW.js → useMessageBodyContent-Dhtu6I6l.js} +1 -1
  141. package/assets/{useQueries-CFXMrDWB.js → useQueries-BO8eIXDf.js} +1 -1
  142. package/assets/{useRefreshControl-CmSuQYeT.js → useRefreshControl-c8RtcGU3.js} +1 -1
  143. package/assets/{useResultFolderIndex-B-bcuKwK.js → useResultFolderIndex-CJrt60fl.js} +1 -1
  144. package/assets/{useSignature-ChD8g6V6.js → useSignature-ZAeHuLA5.js} +1 -1
  145. package/assets/{warnings-DuiY0HQB.js → warnings-CN1cP32K.js} +1 -1
  146. package/index.html +1 -1
  147. package/package.json +1 -1
  148. package/assets/OutboxPane-vxvckaxe.js +0 -1
  149. package/assets/_calendarObjectId-CysTJCDO.js +0 -1
  150. package/assets/_mailboxId-sUyLlrph.js +0 -1
  151. package/assets/_messageId-BNOLD_NW.js +0 -1
  152. package/assets/_messageId-C11dYlL_.js +0 -1
  153. package/assets/_messageId-sL5uhmsZ.js +0 -1
  154. package/assets/_outboxMessageId-D8CVGqIw.js +0 -1
  155. package/assets/_recurrenceId-BZ43TEn7.js +0 -1
  156. package/assets/_threadId-CKva01mK.js +0 -1
  157. package/assets/_threadId-Dcu-hZiA.js +0 -1
  158. package/assets/_threadId-mSRKzdYV.js +0 -1
  159. package/assets/brief-DcVaSAff.js +0 -1
  160. package/assets/chevron-down-BI1fWP0V.js +0 -1
  161. package/assets/chevron-left-BQBw-0xj.js +0 -1
  162. package/assets/compose._-_outboxMessageId_--bw-JQyQ.js +0 -1
  163. package/assets/compose._-_outboxMessageId_-9p2UwGZ2.js +0 -1
  164. package/assets/compose._-_outboxMessageId_-BKX6xXkK.js +0 -1
  165. package/assets/compose._-_outboxMessageId_-CoRtMIvt.js +0 -1
  166. package/assets/edit-C5xc8ZMZ.js +0 -1
  167. package/assets/edit-DY8bOvEH.js +0 -1
  168. package/assets/flagged-B0gfe6c8.js +0 -1
  169. package/assets/index-B0WA56eY.js +0 -1
  170. package/assets/index-BNOLD_NW.js +0 -1
  171. package/assets/index-BQRB4Hbr.js +0 -1
  172. package/assets/index-BSVI2qk3.js +0 -1
  173. package/assets/index-BTWqd0y1.js +0 -1
  174. package/assets/index-C11dYlL_.js +0 -1
  175. package/assets/index-C9L3Y4ln.js +0 -1
  176. package/assets/index-CMYDLexx.js +0 -1
  177. package/assets/index-Ct_bZm5J.js +0 -1
  178. package/assets/index-cUEB_Vmo.js +0 -1
  179. package/assets/new-CdrTfyYm.js +0 -1
  180. package/assets/onboarding-Bt28IS6_.js +0 -1
  181. package/assets/outbox-C-QNKevV.js +0 -1
  182. package/assets/settings-qYifOymR.js +0 -1
@@ -1 +1 @@
1
- import{b as W,j as e,d as x,B as f,L as _,X as Ee,r,I as Oe,e as pe,a as ze,c as Be,f as q,s as de,g as $e,h as Pe,i as De,m as Le,k as J,l as qe}from"./index-BVIV7uOn.js";import{W as k,C as fe,a as le,u as He,b as We,c as _e,d as Ke,S as Qe,R as Ue}from"./credential-steps-DjMS9JxY.js";import{c as ge,f as Ve,v as xe,r as Ge,a as Je,b as ue,w as me,p as Xe,W as Ye,s as Ze,g as et}from"./config-import-3qED7KRP.js";import{F as tt}from"./file-json-BXCpWMKO.js";import{B as O}from"./badge-BmEPIQJj.js";import{c as st}from"./onboarding-completion-C5SxIJff.js";import"./select-CU_oR6rc.js";import"./chevron-down-BI1fWP0V.js";import"./card-BYFKESRL.js";const nt=W("FolderClock",[["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["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"}],["path",{d:"M16 14v2l1 1",key:"xth2jh"}]]);const it=W("KeyRound",[["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"}]]);const at=W("Merge",[["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"}]]);const rt=W("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),y=["File","Review","Credentials","Folders"];function Y({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 ot({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(_,{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(Y,{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(rt,{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(tt,{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:[Ve(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 ct({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(O,{tone:xe[i],dot:!0,children:[n[i]," ",i]},i))})}function dt({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(O,{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 lt({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(_,{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(ct,{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(dt,{section:p},p.id))]})})}function ut({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(Ee,{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(at,{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 mt(t){return t==="entered"?e.jsx(O,{tone:"positive",children:"ready"}):t==="failed"?e.jsx(O,{tone:"danger",children:"sign-in failed"}):e.jsx(O,{tone:"danger",children:"credentials needed"})}function ht({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}),mt(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(_,{className:"size-3.5 animate-spin"}):s.connector==="microsoft"?e.jsx(Oe,{className:"size-3.5"}):e.jsx(it,{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 pt({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(ht,{accounts:t,busyAccountId:n,onOpen:s})]})})}function ft({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(_,{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 gt({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(nt,{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 xt({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(Y,{children:t.raw})]})})}function jt(t){return t==="landed"?"ok":t==="failed"||t==="unknown"?"failed":"pending"}function vt({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:jt(u.state)},u.section))}),e.jsx(Y,{children:i})]})})}const je=(t,n)=>t?"tls":n?"starttls":"none",yt=t=>({host:t.imapHost,port:t.imapPort,security:je(t.imapTls,t.imapStartTls)}),wt=t=>({host:t.smtpEnabled?t.smtpHost:"",port:t.smtpPort,security:je(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}},bt=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.`},H=(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 kt({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),[ye,K]=r.useState(void 0),[C,we]=r.useState([]),[Q,be]=r.useState([]),[g,I]=r.useState(null),[T,U]=r.useState({username:"",password:""}),[F,V]=r.useState({}),[ke,ne]=r.useState(void 0),[G,z]=r.useState(null),[B,Ne]=r.useState([]),{data:$}=ze({...Be(),enabled:C.length>0||i==="folders"}),A=r.useMemo(()=>{const a=new Map;for(const o of $?.accounts??[])a.set(o.accountId,o);return a},[$]),Se=r.useMemo(()=>C.map(a=>A.get(a)).filter(a=>!!a).map(a=>he(a,F[a.accountId],Q.includes(a.accountId))),[C,A,F,Q]),c=g?A.get(g):void 0,ie=g?C.indexOf(g)+1:0,P=q({...$e(),meta:de(409)}),ae=q({...Pe(),meta:de(403,404)}),re=q(De()),oe=q(Le());He(G!==null,()=>{n.invalidateQueries({queryKey:J()}),z(null)});const ce=We(a=>{z(null),a==="stalled"&&ne(Ue)}),Ce=r.useCallback(a=>{l(!1),w(!0),p({name:a.name,size:a.size}),S(void 0),N(void 0),a.text().then(o=>Ge(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:H(o,"the file read was refused")})})},[]),D=r.useCallback((a,o)=>{j&&(K(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(Ne(Xe(v)),n.invalidateQueries({queryKey:J()}),v.accountsNeedingCredentials.length>0){we([...v.accountsNeedingCredentials]),s("credentials");return}s("folders")},onError:v=>{const L=Je(v);if(L){K(L),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:H(v,"POST /config/import failed")}),s("file")}}))},[j,P,n]),Ie=r.useCallback(a=>{if(I(a.accountId),ne(void 0),a.connector==="microsoft"){s("account-oauth");return}const o=A.get(a.accountId);U({username:o?.username||a.address,password:""}),s("account-password")},[A]),Te=r.useCallback(()=>{g&&ae.mutate({path:{accountId:g},body:{password:T.password,isActive:!0}},{onSuccess:()=>{re.mutate({path:{accountId:g}}),be(a=>a.includes(g)?a:[...a,g]),V(a=>{const o={...a};return delete o[g],o}),n.invalidateQueries({queryKey:J()}),U({username:"",password:""}),I(null),s("credentials")},onError:a=>{V(o=>({...o,[g]:H(a,"The password was verified but could not be stored. Try again.")})),I(null),s("credentials")}})},[g,T.password,n,re,ae]),Re=r.useCallback(()=>{c&&(z(c.accountId),oe.mutate({body:{email:c.email}},{onSuccess:a=>{ce(),window.location.assign(a.authorizationUrl)},onError:a=>{z(null),V(o=>({...o,[c.accountId]:H(a,"Microsoft sign-in could not be started.")})),I(null),s("credentials")}}))},[c,ce,oe]),Fe=r.useCallback((a,o)=>U({username:a,password:o}),[]),Ae=r.useMemo(()=>{const a=$?.pendingImport?.folderPaths;if(!a)return B;const o=new Set(a),v=B.filter(E=>o.has(E.path)),L=a.filter(E=>!B.some(Me=>Me.path===E)).map(E=>({path:E,waitingFor:"An imported setting"}));return[...v,...L]},[$,B]),M=r.useCallback(()=>{b(void 0),K(void 0),S(void 0),p(void 0),N(void 0),ee("abort"),s("file")},[]);switch(i){case"file":return e.jsx(ot,{state:h?"reading":P.isPending?"checking":d?"dragging":"idle",file:u,ready:j!==void 0,failure:R,onChoose:Ce,onDragStateChange:l,onNext:()=>D("validate",Z)});case"rejected":return e.jsx(xt,{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(ut,{choice:te,held:bt(ye?.details),onChoose:se,onBack:M,onNext:()=>{if(te==="abort"){t("abandoned");return}ee("merge"),D("validate","merge")}});case"review":return e.jsx(lt,{sections:et(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(Nt,{onBack:M});const a=me(m);return e.jsx(vt,{results:Ze(m),message:a?.message??"The import stopped before it finished.",raw:`${a?.code??Ye}: ${a?.message??"no message"}`,nothingLanded:!m.applied,onBack:M,onNext:()=>D("apply","merge")})}case"credentials":return e.jsx(pt,{accounts:Se,busyAccountId:G??void 0,error:ke,onOpen:Ie,onNext:()=>s("folders")});case"account-password":return c?e.jsx(Ke,{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(Qe,{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:Fe}):e.jsx(X,{onBack:()=>t("abandoned")});case"account-test":return c?e.jsx(_e,{steps:y,activeStep:2,email:c.email,imapConfig:yt(c),smtpConfig:wt(c),username:T.username,password:T.password,credentialsBackLabel:"Back to the password",serversBackLabel:"Back to the password",successLabel:"Save and continue",onSuccess:Te,onBackToCredentials:()=>s("account-password"),onBackToServers:()=>s("account-password")}):e.jsx(X,{onBack:()=>t("abandoned")});case"account-oauth":return c?e.jsx(ft,{account:he(c,F[c.accountId],Q.includes(c.accountId)),position:ie,total:C.length,error:F[c.accountId],busy:G===c.accountId,onBack:()=>{I(null),s("credentials")},onNext:Re}):e.jsx(X,{onBack:()=>t("abandoned")});case"folders":return e.jsx(gt,{folders:Ae,onNext:()=>t("imported")})}}function ve({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 X({onBack:t}){return e.jsx(ve,{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 Nt({onBack:t}){return e.jsx(ve,{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 Ot(){const t=qe(),n=pe(),i=r.useCallback(s=>{st({queryClient:n,recordCompleted:()=>{s==="imported"&&t.recordEvent("config.imported")},navigateToInbox:()=>{window.location.assign("/mail")}})},[t,n]);return e.jsx(kt,{onDone:i})}export{Ot as component};
1
+ import{b as W,j as e,d as x,B as f,L as _,X as Ee,r,I as Oe,e as pe,a as ze,c as Be,f as q,s as de,g as $e,h as Pe,i as De,m as Le,k as J,l as qe}from"./index-X3HUQEvM.js";import{W as k,C as fe,a as le,u as He,b as We,c as _e,d as Ke,S as Qe,R as Ue}from"./credential-steps-CREMZs9P.js";import{c as ge,f as Ve,v as xe,r as Ge,a as Je,b as ue,w as me,p as Xe,W as Ye,s as Ze,g as et}from"./config-import-BAWkCcKm.js";import{F as tt}from"./file-json-CxV9Z8Xk.js";import{B as O}from"./badge-C-N2Sfyc.js";import{c as st}from"./onboarding-completion-BG60cd5s.js";import"./select-DaBof-xM.js";import"./chevron-down-B3lcZAVN.js";import"./card-MWxaP_DH.js";const nt=W("FolderClock",[["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["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"}],["path",{d:"M16 14v2l1 1",key:"xth2jh"}]]);const it=W("KeyRound",[["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"}]]);const at=W("Merge",[["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"}]]);const rt=W("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),y=["File","Review","Credentials","Folders"];function Y({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 ot({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(_,{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(Y,{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(rt,{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(tt,{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:[Ve(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 ct({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(O,{tone:xe[i],dot:!0,children:[n[i]," ",i]},i))})}function dt({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(O,{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 lt({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(_,{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(ct,{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(dt,{section:p},p.id))]})})}function ut({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(Ee,{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(at,{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 mt(t){return t==="entered"?e.jsx(O,{tone:"positive",children:"ready"}):t==="failed"?e.jsx(O,{tone:"danger",children:"sign-in failed"}):e.jsx(O,{tone:"danger",children:"credentials needed"})}function ht({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}),mt(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(_,{className:"size-3.5 animate-spin"}):s.connector==="microsoft"?e.jsx(Oe,{className:"size-3.5"}):e.jsx(it,{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 pt({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(ht,{accounts:t,busyAccountId:n,onOpen:s})]})})}function ft({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(_,{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 gt({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(nt,{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 xt({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(Y,{children:t.raw})]})})}function jt(t){return t==="landed"?"ok":t==="failed"||t==="unknown"?"failed":"pending"}function vt({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:jt(u.state)},u.section))}),e.jsx(Y,{children:i})]})})}const je=(t,n)=>t?"tls":n?"starttls":"none",yt=t=>({host:t.imapHost,port:t.imapPort,security:je(t.imapTls,t.imapStartTls)}),wt=t=>({host:t.smtpEnabled?t.smtpHost:"",port:t.smtpPort,security:je(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}},bt=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.`},H=(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 kt({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),[ye,K]=r.useState(void 0),[C,we]=r.useState([]),[Q,be]=r.useState([]),[g,I]=r.useState(null),[T,U]=r.useState({username:"",password:""}),[F,V]=r.useState({}),[ke,ne]=r.useState(void 0),[G,z]=r.useState(null),[B,Ne]=r.useState([]),{data:$}=ze({...Be(),enabled:C.length>0||i==="folders"}),A=r.useMemo(()=>{const a=new Map;for(const o of $?.accounts??[])a.set(o.accountId,o);return a},[$]),Se=r.useMemo(()=>C.map(a=>A.get(a)).filter(a=>!!a).map(a=>he(a,F[a.accountId],Q.includes(a.accountId))),[C,A,F,Q]),c=g?A.get(g):void 0,ie=g?C.indexOf(g)+1:0,P=q({...$e(),meta:de(409)}),ae=q({...Pe(),meta:de(403,404)}),re=q(De()),oe=q(Le());He(G!==null,()=>{n.invalidateQueries({queryKey:J()}),z(null)});const ce=We(a=>{z(null),a==="stalled"&&ne(Ue)}),Ce=r.useCallback(a=>{l(!1),w(!0),p({name:a.name,size:a.size}),S(void 0),N(void 0),a.text().then(o=>Ge(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:H(o,"the file read was refused")})})},[]),D=r.useCallback((a,o)=>{j&&(K(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(Ne(Xe(v)),n.invalidateQueries({queryKey:J()}),v.accountsNeedingCredentials.length>0){we([...v.accountsNeedingCredentials]),s("credentials");return}s("folders")},onError:v=>{const L=Je(v);if(L){K(L),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:H(v,"POST /config/import failed")}),s("file")}}))},[j,P,n]),Ie=r.useCallback(a=>{if(I(a.accountId),ne(void 0),a.connector==="microsoft"){s("account-oauth");return}const o=A.get(a.accountId);U({username:o?.username||a.address,password:""}),s("account-password")},[A]),Te=r.useCallback(()=>{g&&ae.mutate({path:{accountId:g},body:{password:T.password,isActive:!0}},{onSuccess:()=>{re.mutate({path:{accountId:g}}),be(a=>a.includes(g)?a:[...a,g]),V(a=>{const o={...a};return delete o[g],o}),n.invalidateQueries({queryKey:J()}),U({username:"",password:""}),I(null),s("credentials")},onError:a=>{V(o=>({...o,[g]:H(a,"The password was verified but could not be stored. Try again.")})),I(null),s("credentials")}})},[g,T.password,n,re,ae]),Re=r.useCallback(()=>{c&&(z(c.accountId),oe.mutate({body:{email:c.email}},{onSuccess:a=>{ce(),window.location.assign(a.authorizationUrl)},onError:a=>{z(null),V(o=>({...o,[c.accountId]:H(a,"Microsoft sign-in could not be started.")})),I(null),s("credentials")}}))},[c,ce,oe]),Fe=r.useCallback((a,o)=>U({username:a,password:o}),[]),Ae=r.useMemo(()=>{const a=$?.pendingImport?.folderPaths;if(!a)return B;const o=new Set(a),v=B.filter(E=>o.has(E.path)),L=a.filter(E=>!B.some(Me=>Me.path===E)).map(E=>({path:E,waitingFor:"An imported setting"}));return[...v,...L]},[$,B]),M=r.useCallback(()=>{b(void 0),K(void 0),S(void 0),p(void 0),N(void 0),ee("abort"),s("file")},[]);switch(i){case"file":return e.jsx(ot,{state:h?"reading":P.isPending?"checking":d?"dragging":"idle",file:u,ready:j!==void 0,failure:R,onChoose:Ce,onDragStateChange:l,onNext:()=>D("validate",Z)});case"rejected":return e.jsx(xt,{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(ut,{choice:te,held:bt(ye?.details),onChoose:se,onBack:M,onNext:()=>{if(te==="abort"){t("abandoned");return}ee("merge"),D("validate","merge")}});case"review":return e.jsx(lt,{sections:et(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(Nt,{onBack:M});const a=me(m);return e.jsx(vt,{results:Ze(m),message:a?.message??"The import stopped before it finished.",raw:`${a?.code??Ye}: ${a?.message??"no message"}`,nothingLanded:!m.applied,onBack:M,onNext:()=>D("apply","merge")})}case"credentials":return e.jsx(pt,{accounts:Se,busyAccountId:G??void 0,error:ke,onOpen:Ie,onNext:()=>s("folders")});case"account-password":return c?e.jsx(Ke,{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(Qe,{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:Fe}):e.jsx(X,{onBack:()=>t("abandoned")});case"account-test":return c?e.jsx(_e,{steps:y,activeStep:2,email:c.email,imapConfig:yt(c),smtpConfig:wt(c),username:T.username,password:T.password,credentialsBackLabel:"Back to the password",serversBackLabel:"Back to the password",successLabel:"Save and continue",onSuccess:Te,onBackToCredentials:()=>s("account-password"),onBackToServers:()=>s("account-password")}):e.jsx(X,{onBack:()=>t("abandoned")});case"account-oauth":return c?e.jsx(ft,{account:he(c,F[c.accountId],Q.includes(c.accountId)),position:ie,total:C.length,error:F[c.accountId],busy:G===c.accountId,onBack:()=>{I(null),s("credentials")},onNext:Re}):e.jsx(X,{onBack:()=>t("abandoned")});case"folders":return e.jsx(gt,{folders:Ae,onNext:()=>t("imported")})}}function ve({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 X({onBack:t}){return e.jsx(ve,{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 Nt({onBack:t}){return e.jsx(ve,{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 Ot(){const t=qe(),n=pe(),i=r.useCallback(s=>{st({queryClient:n,recordCompleted:()=>{s==="imported"&&t.recordEvent("config.imported")},navigateToInbox:()=>{window.location.assign("/mail")}})},[t,n]);return e.jsx(kt,{onDone:i})}export{Ot as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-X3HUQEvM.js";import{O as t}from"./OutboxPane-D90GSWPB.js";import"./MessageBody-Bn9CiLsL.js";import"./kbd-DiYloCGE.js";import"./search-scope-D_Xp19lV.js";import"./app-chrome-Cb3lBdOZ.js";import"./reply-Bs_YhRF4.js";import"./useMediaQuery-9NJJDrX6.js";import"./useMessageBodyContent-Dhtu6I6l.js";import"./outbox-status-BlKn6P0x.js";import"./NavMenuButton-DS-H9eDz.js";import"./menu-v-YxaQQ_.js";import"./roving-focus-nxbliQos.js";import"./circle-check-big-ChJ8pH-b.js";import"./clock-CNuf0kus.js";import"./row-actions-YYjMjrwp.js";import"./rotate-ccw-D8SF2xHr.js";function g(){return o.jsx(t.Reading,{})}export{g as component};
@@ -0,0 +1 @@
1
+ import{j as t,a8 as o}from"./index-X3HUQEvM.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-X3HUQEvM.js";import{B as o}from"./BriefPane-Ct5mLFno.js";import"./MessageToolbar-bKPOSy0d.js";import"./MessageBody-Bn9CiLsL.js";import"./kbd-DiYloCGE.js";import"./search-scope-D_Xp19lV.js";import"./app-chrome-Cb3lBdOZ.js";import"./reply-Bs_YhRF4.js";import"./useMediaQuery-9NJJDrX6.js";import"./useMessageBodyContent-Dhtu6I6l.js";import"./roving-focus-nxbliQos.js";import"./chevron-down-B3lcZAVN.js";import"./search-token-index-BIZzLNv9.js";import"./useQueries-BO8eIXDf.js";import"./index-DjF679iU.js";import"./useSignature-ZAeHuLA5.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CiTDV7kX.js";import"./suggest-list-Bl5m8GjB.js";import"./sections-CRDaS4nn.js";import"./badge-C-N2Sfyc.js";import"./undo-2-DT3EdJen.js";import"./DropdownMenu-T79mAX3f.js";import"./popover-menu-J56UZVjI.js";import"./ErrorState-DD3UfsN8.js";import"./mail-CDuFGyaA.js";import"./download-DCGyf3W_.js";import"./avatar-COUm7SBG.js";import"./EmptyState-CA538vCg.js";import"./calendar-suggestion-DVjK0aSt.js";import"./useCalendarSuggestions-BLiBIz-1.js";import"./agenda-time-C_THqiEa.js";import"./sparkles-DrZ81rOU.js";import"./plus-GnqfNmfx.js";import"./calendar-format-BwCpz-JZ.js";import"./calendar-BYyDHpZa.js";import"./calendar-failure-note-C9fIL_8K.js";import"./checkbox-jLurGcNS.js";import"./clock-CNuf0kus.js";import"./segmented-control-DFN0EF39.js";import"./shield-check-DZBDPqGc.js";import"./useLayoutTier-B5_piqNJ.js";import"./menu-v-YxaQQ_.js";import"./useFilters-D_mEdyEH.js";import"./select-DaBof-xM.js";import"./folder-input-CmDkygvp.js";import"./confirm-dialog-CjHvZbGT.js";import"./label-chip-tLLbdHoz.js";import"./cloud-off-C48CGroa.js";import"./LabelApplyTrigger-Ox3K3UZo.js";import"./useLabels-Beg-UxxE.js";import"./useRefreshControl-c8RtcGU3.js";import"./circle-check-big-ChJ8pH-b.js";import"./refresh-cw-3jpeaUi7.js";import"./wizard-selection-zWa1qc6-.js";function ir(){return r.jsx(o.Reading,{})}export{ir as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-X3HUQEvM.js";import{M as i}from"./MailboxPane-ZTGfkp9r.js";import"./MailViewChrome-BXIIRW1m.js";import"./search-token-index-BIZzLNv9.js";import"./reply-Bs_YhRF4.js";import"./useMediaQuery-9NJJDrX6.js";import"./search-scope-D_Xp19lV.js";import"./app-chrome-Cb3lBdOZ.js";import"./useQueries-BO8eIXDf.js";import"./roving-focus-nxbliQos.js";import"./MessageToolbar-bKPOSy0d.js";import"./MessageBody-Bn9CiLsL.js";import"./kbd-DiYloCGE.js";import"./useMessageBodyContent-Dhtu6I6l.js";import"./chevron-down-B3lcZAVN.js";import"./index-DjF679iU.js";import"./useSignature-ZAeHuLA5.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CiTDV7kX.js";import"./suggest-list-Bl5m8GjB.js";import"./sections-CRDaS4nn.js";import"./badge-C-N2Sfyc.js";import"./undo-2-DT3EdJen.js";import"./DropdownMenu-T79mAX3f.js";import"./popover-menu-J56UZVjI.js";import"./ErrorState-DD3UfsN8.js";import"./mail-CDuFGyaA.js";import"./download-DCGyf3W_.js";import"./avatar-COUm7SBG.js";import"./EmptyState-CA538vCg.js";import"./calendar-suggestion-DVjK0aSt.js";import"./useCalendarSuggestions-BLiBIz-1.js";import"./agenda-time-C_THqiEa.js";import"./sparkles-DrZ81rOU.js";import"./plus-GnqfNmfx.js";import"./calendar-format-BwCpz-JZ.js";import"./calendar-BYyDHpZa.js";import"./calendar-failure-note-C9fIL_8K.js";import"./checkbox-jLurGcNS.js";import"./clock-CNuf0kus.js";import"./segmented-control-DFN0EF39.js";import"./shield-check-DZBDPqGc.js";import"./useLayoutTier-B5_piqNJ.js";import"./menu-v-YxaQQ_.js";import"./useFilters-D_mEdyEH.js";import"./select-DaBof-xM.js";import"./folder-input-CmDkygvp.js";import"./confirm-dialog-CjHvZbGT.js";import"./label-chip-tLLbdHoz.js";import"./cloud-off-C48CGroa.js";import"./refresh-cw-3jpeaUi7.js";import"./useRefreshControl-c8RtcGU3.js";import"./circle-check-big-ChJ8pH-b.js";import"./LabelApplyTrigger-Ox3K3UZo.js";import"./useLabels-Beg-UxxE.js";import"./NavMenuButton-DS-H9eDz.js";import"./bottom-sheet-DDC7O5sx.js";import"./circle-help-C9O6dqh6.js";import"./circle-check-QqmhC0RV.js";function ao(){return o.jsx(i.Reading,{})}export{ao as component};
@@ -0,0 +1 @@
1
+ import{eR as o,j as r}from"./index-X3HUQEvM.js";import{C as m}from"./CalendarEventPopup-Cd49o1aV.js";import"./useCalendarSuggestions-BLiBIz-1.js";import"./ErrorState-DD3UfsN8.js";import"./useQueries-BO8eIXDf.js";import"./useCalendarData-CDMAl9sB.js";import"./useCalendarTasks-DClcdx9Q.js";import"./calendar-format-BwCpz-JZ.js";import"./reply-Bs_YhRF4.js";import"./useMediaQuery-9NJJDrX6.js";import"./calendar-BYyDHpZa.js";import"./CalendarSession-CS_x_fs5.js";import"./calendar-event-popup-Clle6FA1.js";import"./pencil-BnBK7tmS.js";import"./calendar-guests-DEOe1juO.js";import"./circle-help-C9O6dqh6.js";import"./confirm-dialog-CjHvZbGT.js";function P(){const{calendarObjectId:t}=o.useParams();return r.jsx(m,{calendarObjectId:t})}export{P as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-X3HUQEvM.js";import{M as r}from"./MailboxPane-ZTGfkp9r.js";import"./MailViewChrome-BXIIRW1m.js";import"./search-token-index-BIZzLNv9.js";import"./reply-Bs_YhRF4.js";import"./useMediaQuery-9NJJDrX6.js";import"./search-scope-D_Xp19lV.js";import"./app-chrome-Cb3lBdOZ.js";import"./useQueries-BO8eIXDf.js";import"./roving-focus-nxbliQos.js";import"./MessageToolbar-bKPOSy0d.js";import"./MessageBody-Bn9CiLsL.js";import"./kbd-DiYloCGE.js";import"./useMessageBodyContent-Dhtu6I6l.js";import"./chevron-down-B3lcZAVN.js";import"./index-DjF679iU.js";import"./useSignature-ZAeHuLA5.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CiTDV7kX.js";import"./suggest-list-Bl5m8GjB.js";import"./sections-CRDaS4nn.js";import"./badge-C-N2Sfyc.js";import"./undo-2-DT3EdJen.js";import"./DropdownMenu-T79mAX3f.js";import"./popover-menu-J56UZVjI.js";import"./ErrorState-DD3UfsN8.js";import"./mail-CDuFGyaA.js";import"./download-DCGyf3W_.js";import"./avatar-COUm7SBG.js";import"./EmptyState-CA538vCg.js";import"./calendar-suggestion-DVjK0aSt.js";import"./useCalendarSuggestions-BLiBIz-1.js";import"./agenda-time-C_THqiEa.js";import"./sparkles-DrZ81rOU.js";import"./plus-GnqfNmfx.js";import"./calendar-format-BwCpz-JZ.js";import"./calendar-BYyDHpZa.js";import"./calendar-failure-note-C9fIL_8K.js";import"./checkbox-jLurGcNS.js";import"./clock-CNuf0kus.js";import"./segmented-control-DFN0EF39.js";import"./shield-check-DZBDPqGc.js";import"./useLayoutTier-B5_piqNJ.js";import"./menu-v-YxaQQ_.js";import"./useFilters-D_mEdyEH.js";import"./select-DaBof-xM.js";import"./folder-input-CmDkygvp.js";import"./confirm-dialog-CjHvZbGT.js";import"./label-chip-tLLbdHoz.js";import"./cloud-off-C48CGroa.js";import"./refresh-cw-3jpeaUi7.js";import"./useRefreshControl-c8RtcGU3.js";import"./circle-check-big-ChJ8pH-b.js";import"./LabelApplyTrigger-Ox3K3UZo.js";import"./useLabels-Beg-UxxE.js";import"./NavMenuButton-DS-H9eDz.js";import"./bottom-sheet-DDC7O5sx.js";import"./circle-help-C9O6dqh6.js";import"./circle-check-QqmhC0RV.js";function no(){return o.jsx(r.Reading,{})}export{no as component};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-X3HUQEvM.js";import{B as o}from"./BriefPane-Ct5mLFno.js";import"./MessageToolbar-bKPOSy0d.js";import"./MessageBody-Bn9CiLsL.js";import"./kbd-DiYloCGE.js";import"./search-scope-D_Xp19lV.js";import"./app-chrome-Cb3lBdOZ.js";import"./reply-Bs_YhRF4.js";import"./useMediaQuery-9NJJDrX6.js";import"./useMessageBodyContent-Dhtu6I6l.js";import"./roving-focus-nxbliQos.js";import"./chevron-down-B3lcZAVN.js";import"./search-token-index-BIZzLNv9.js";import"./useQueries-BO8eIXDf.js";import"./index-DjF679iU.js";import"./useSignature-ZAeHuLA5.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CiTDV7kX.js";import"./suggest-list-Bl5m8GjB.js";import"./sections-CRDaS4nn.js";import"./badge-C-N2Sfyc.js";import"./undo-2-DT3EdJen.js";import"./DropdownMenu-T79mAX3f.js";import"./popover-menu-J56UZVjI.js";import"./ErrorState-DD3UfsN8.js";import"./mail-CDuFGyaA.js";import"./download-DCGyf3W_.js";import"./avatar-COUm7SBG.js";import"./EmptyState-CA538vCg.js";import"./calendar-suggestion-DVjK0aSt.js";import"./useCalendarSuggestions-BLiBIz-1.js";import"./agenda-time-C_THqiEa.js";import"./sparkles-DrZ81rOU.js";import"./plus-GnqfNmfx.js";import"./calendar-format-BwCpz-JZ.js";import"./calendar-BYyDHpZa.js";import"./calendar-failure-note-C9fIL_8K.js";import"./checkbox-jLurGcNS.js";import"./clock-CNuf0kus.js";import"./segmented-control-DFN0EF39.js";import"./shield-check-DZBDPqGc.js";import"./useLayoutTier-B5_piqNJ.js";import"./menu-v-YxaQQ_.js";import"./useFilters-D_mEdyEH.js";import"./select-DaBof-xM.js";import"./folder-input-CmDkygvp.js";import"./confirm-dialog-CjHvZbGT.js";import"./label-chip-tLLbdHoz.js";import"./cloud-off-C48CGroa.js";import"./LabelApplyTrigger-Ox3K3UZo.js";import"./useLabels-Beg-UxxE.js";import"./useRefreshControl-c8RtcGU3.js";import"./circle-check-big-ChJ8pH-b.js";import"./refresh-cw-3jpeaUi7.js";import"./wizard-selection-zWa1qc6-.js";function tr(){return r.jsx(o.Reading,{})}export{tr as component};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rich-text-spellcheck-worker-provider-uKovGi4E.js","assets/useSignature-ChD8g6V6.js","assets/index-BVIV7uOn.js","assets/index-CMNnsfzR.css","assets/rich-text-spellcheck-provider-J8m9wz6A.js","assets/rich-text-Fi0gjjkk.js","assets/roving-focus-WwAX8-VC.js","assets/confirm-dialog-DCFAU3wg.js","assets/useMediaQuery-DHHct6HU.js","assets/bottom-sheet-CYnEFnuG.js","assets/popover-menu-Drk7oRld.js","assets/undo-2-BLxVGig8.js","assets/useMessageBodyContent-Bz4eLwYW.js","assets/reply-DtObeSB2.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-CQk7uQJy.js","assets/suggest-list-MxpHM4zs.js","assets/sections-DssOe_S4.js","assets/chevron-down-BI1fWP0V.js"])))=>i.map(i=>d[i]);
2
- import{b as vr,j as d,X as gr,p as ln,B as un,L as yr,v as Fo,T as $o,r as s,t as Bo,d as wr,a9 as Uo,q as Ho,c8 as wn,bV as br,c9 as xe,ca as Er,cb as Wo,cc as zo,cd as Se,f as _e,au as Me,ce as Vo,cf as qo,cg as xr,ch as Ko,as as Sr,at as Rr,a6 as Yo,e as Cr,ci as Go,U as Xo,a as At,bK as Qo,cj as Tr,ck as Zo,bM as Jo,c as Ar,cl as ea,ag as ta,cm as _n,aV as Mn,cn as na,ah as ra,co as oa,cp as aa,ac as R}from"./index-BVIV7uOn.js";import{p as sa,c as ia,b as ca}from"./useMessageBodyContent-Bz4eLwYW.js";import{w as la,u as ua,a as da,d as fa}from"./useSignature-ChD8g6V6.js";import{b as ma}from"./account-form-helpers-DhckT_PN.js";import{u as ha}from"./useDebouncedValue-CQk7uQJy.js";import{u as pa,S as va}from"./suggest-list-MxpHM4zs.js";import"./reply-DtObeSB2.js";import{a as ga}from"./sections-DssOe_S4.js";import{u as ya}from"./useMediaQuery-DHHct6HU.js";import{C as Dr}from"./chevron-down-BI1fWP0V.js";const wa=vr("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Nr=vr("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]),ba=({email:e,displayName:t,onRemove:n,className:r})=>d.jsxs("span",{className:ln("inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-accent-2-soft text-sm max-w-[200px]",r),children:[d.jsx("span",{className:"truncate",children:t||e}),d.jsx("button",{type:"button",onClick:n,className:"shrink-0 p-0.5 rounded-full hover:bg-fg-muted/20 transition-colors","aria-label":`Remove ${e}`,children:d.jsx(gr,{className:"size-3"})})]}),Ea=/[\u0000-\u001f\u007f-\u009f\u061c\u200b-\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069\ufeff]/g,xa=/[<>:"|?*]/g,Sa=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\.|$)/i,jn=120,Ra=12,Ca="attachment",Fn=e=>{const t=[...e];if(t.length<=jn)return e;const n=e.lastIndexOf("."),r=n>0&&[...e.slice(n)].length<=Ra?e.slice(n):"",o=jn-[...r].length;return t.slice(0,o).join("")+r},xl=(e,t=Ca)=>{const r=e.replace(Ea,"").split(/[/\\]/),a=(r[r.length-1]??"").replace(xa,"_").replace(/^[.\s]+/,"").replace(/[.\s]+$/,"");if(a.length===0)return Fn(t);const i=Sa.test(a)?`_${a}`:a;return Fn(i)},$n=["KB","MB","GB","TB"],Ta=e=>{if(!Number.isFinite(e)||e<0)return"unknown size";const t=Math.round(e);if(t<1024)return t===1?"1 byte":`${t} bytes`;const n=1023.95;let r=t/1024,o=0;for(;r>=n&&o<$n.length-1;)r/=1024,o+=1;return`${r.toFixed(1).replace(/\.0$/,"")} ${$n[o]}`},Aa=({disabled:e,onAttach:t})=>{const n=s.useRef(null);return d.jsxs(d.Fragment,{children:[d.jsx(un,{variant:"ghost",size:"md","aria-label":"Attach files",title:"Attach files","aria-busy":e,className:"min-h-11 min-w-11 px-2","data-testid":"compose-attach",icon:d.jsx(Nr,{className:"size-4"}),onClick:()=>{e||n.current?.click()}}),d.jsx("input",{ref:n,type:"file",multiple:!0,hidden:!0,"data-testid":"compose-attach-input",onChange:r=>{const o=Array.from(r.currentTarget.files??[]);r.currentTarget.value="",o.length>0&&t(o)}})]})},Da=({save:e})=>e.status==="saving"?d.jsx("output",{className:"animate-pulse text-xs text-fg-muted",children:"Saving..."}):e.status==="saved"?d.jsx("output",{className:"text-xs text-fg-muted",children:"Draft saved"}):e.status==="error"?d.jsx("output",{className:"text-xs text-danger",children:"Save failed"}):e.status==="unsaved"?d.jsx("output",{className:"truncate text-xs text-warning",children:e.reason}):null;function Na({send:e,onSend:t,onBlocked:n,onDiscard:r,save:o={status:"idle"},onAttach:a}){const i=e.status==="sending",c=e.status==="blocked"?e.reason:void 0;return d.jsxs("div",{className:"flex items-center justify-between border-t border-line px-3 py-2",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[d.jsx(un,{variant:"primary",size:"md","aria-busy":i,title:c,className:"min-h-11 shrink-0 rounded-full px-4","data-testid":"compose-send",icon:i?d.jsx(yr,{className:"size-4 animate-spin"}):d.jsx(Fo,{className:"size-4"}),onClick:()=>{if(!i){if(c!==void 0){n(c);return}t()}},children:"Send"}),a&&d.jsx(Aa,{disabled:i,onAttach:a}),d.jsx(Da,{save:o})]}),d.jsx(un,{variant:"ghost",size:"md","aria-busy":i,"aria-label":"Discard",className:"min-h-11 min-w-11 px-2 hover:text-danger",icon:d.jsx($o,{className:"size-4"}),onClick:()=>{i||r()}})]})}const Bn=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),Oa=e=>{const t=e.trim();if(!t)return;const n=t.match(/^(.+?)\s*<([^>]+)>$/);if(n){const r=n[1].trim().replace(/^"(.*)"$/,"$1"),o=n[2].trim();if(Bn(o))return{email:o,displayName:r}}if(Bn(t))return{email:t}},ka=e=>{const t=[];let n="",r=!1,o=!1;for(const a of e){if(a==='"'&&(r=!r),a==="<"&&(o=!0),a===">"&&(o=!1),(a===","||a===";")&&!r&&!o){t.push(n),n="";continue}n+=a}return t.push(n),t},Ia=e=>{const t=[],n=[];for(const r of ka(e)){const o=Oa(r);if(o){t.push(o);continue}r.trim()&&n.push(r.trim())}return{entries:t,unparsed:n.join(", ")}},La=["Tab",","],Pa=150,_a=({label:e,addresses:t,onChange:n,placeholder:r,suggestions:o=[],onQueryChange:a,onPendingChange:i,ref:c})=>{const[u,m]=s.useState(""),f=s.useRef(null),l=s.useMemo(()=>Ia(u),[u]);s.useEffect(()=>{i?.(l)},[l,i]);const h=s.useRef(void 0),g=s.useCallback(()=>{h.current!==void 0&&(clearTimeout(h.current),h.current=void 0)},[]);s.useEffect(()=>g,[g]);const x=new Set(t.map(b=>b.email.toLowerCase())),p=u.length>=2?o.filter(b=>!x.has(b.email.toLowerCase())):[],E=s.useCallback(b=>{m(b),a?.(b)},[a]),w=s.useCallback(b=>{g(),!x.has(b.email.toLowerCase())&&(n([...t,b]),E(""))},[t,x,n,E,g]),A=s.useCallback(b=>{n(t.filter((P,C)=>C!==b))},[t,n]),y=s.useCallback(b=>{w(b),f.current?.focus()},[w]),v=s.useCallback(()=>{if(g(),l.entries.length===0)return{addresses:t,unparsed:l.unparsed};const b=new Set(x),P=[...t];for(const C of l.entries){const q=C.email.toLowerCase();b.has(q)||(b.add(q),P.push(C))}return n(P),E(l.unparsed),{addresses:P,unparsed:l.unparsed}},[l,t,x,n,E,g]),D=s.useCallback(()=>{g(),E("")},[E,g]);s.useImperativeHandle(c,()=>({commitPending:v,clearPending:D}),[v,D]);const _=s.useRef(v);s.useEffect(()=>{_.current=v},[v]);const S=pa({count:p.length,acceptKeys:La,onAccept:b=>y(p[b])}),k=s.useMemo(()=>p.map(b=>({value:b.email,label:b.displayName??b.email,...b.displayName?{hint:b.email}:{}})),[p]),N=s.useCallback(b=>{if(b.key==="Backspace"&&u===""&&t.length>0){A(t.length-1);return}S.handleKeyDown(b)||(b.key==="Enter"||b.key==="Tab"||b.key===",")&&u.trim()&&(b.preventDefault(),v())},[u,t.length,A,S.handleKeyDown,v]),F=s.useCallback(()=>{g(),h.current=setTimeout(()=>{h.current=void 0,_.current(),S.dismiss()},Pa)},[g,S.dismiss]);return d.jsxs("div",{className:"relative","data-address-field":e,children:[d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsxs("label",{htmlFor:`address-field-${e}`,className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:[e,":"]}),d.jsxs("div",{className:"flex-1 flex flex-wrap items-center gap-1 min-h-[36px] px-2 py-1 border rounded-md bg-canvas cursor-text",onClick:()=>f.current?.focus(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&f.current?.focus()},children:[t.map((b,P)=>d.jsx(ba,{email:b.email,displayName:b.displayName,onRemove:()=>A(P)},b.email)),d.jsx("input",{ref:f,id:`address-field-${e}`,type:"text",value:u,onChange:b=>{S.reopen(),E(b.target.value)},onKeyDown:N,onBlur:F,placeholder:t.length===0?r:"",className:"flex-1 min-w-[120px] bg-transparent outline-none text-sm py-0.5",autoComplete:"off",...S.comboboxProps})]})]}),S.open&&d.jsx(va,{id:S.listId,suggestions:k,activeIndex:S.activeIndex,optionId:S.optionId,onPick:b=>{const P=p.find(C=>C.email===b.value);P&&y(P)},onHighlight:S.setActiveIndex,label:`${e} suggestions`,className:"absolute left-12 right-0 z-50 mt-1 max-h-[200px] shadow-lg"})]})},Ma=({state:e})=>e.status==="uploading"?d.jsx(yr,{className:"size-4 shrink-0 animate-spin text-fg-subtle","aria-hidden":!0}):e.status==="failed"?d.jsx(Bo,{className:"size-4 shrink-0 text-danger","aria-hidden":!0}):d.jsx(Nr,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0});function ja({items:e,onRemove:t,onRetry:n,className:r}){return e.length===0?null:d.jsx("ul",{"aria-label":"Attached files","data-testid":"compose-attachments",className:ln("flex flex-col gap-1 px-3 py-2",r),children:e.map(o=>d.jsxs("li",{"data-testid":"compose-attachment","data-state":o.state.status,className:ln("rounded-sm border bg-surface",o.state.status==="failed"?"border-danger/40":"border-line"),children:[d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx(Ma,{state:o.state}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("bdi",{className:"block truncate text-sm text-fg",title:o.filename,children:o.filename}),d.jsxs("span",{className:"block text-2xs text-fg-subtle",children:[Ta(o.sizeBytes),o.state.status==="uploading"?" · Uploading…":""]})]}),o.state.status==="failed"&&o.state.retryable&&d.jsx("button",{type:"button",onClick:()=>n(o.key),className:"text-xs font-medium text-accent hover:underline",children:"Try again"}),d.jsx("button",{type:"button","aria-label":`Remove ${o.filename}`,onClick:()=>t(o.key),className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-sunken hover:text-fg",children:d.jsx(gr,{className:"size-4","aria-hidden":!0})})]}),o.state.status==="failed"&&d.jsx("p",{role:"alert","data-testid":"compose-attachment-error",className:"border-t border-danger/30 bg-danger-soft px-2 py-1.5 text-xs text-danger",children:o.state.reason})]},o.key))})}const Fa=()=>d.jsxs("div",{"aria-hidden":"true","data-testid":"compose-body-skeleton",className:"min-h-[120px] px-3 py-2",children:[d.jsx("div",{className:"mb-2 h-8 animate-pulse rounded bg-surface-sunken"}),d.jsx("div",{className:"min-h-[80px] animate-pulse rounded bg-surface-sunken/50"})]}),$a=e=>Array.from(e.dataTransfer?.types??[]).includes("Files");function Ba({banner:e,header:t,children:n,quoted:r,attachments:o,actionBar:a,layout:i="fill",onDropFiles:c}){const u=i==="fill",[m,f]=s.useState(!1),l=c?{onDragOver:h=>{$a(h)&&(h.preventDefault(),f(!0))},onDragLeave:h=>{h.relatedTarget instanceof Node&&h.currentTarget.contains(h.relatedTarget)||f(!1)},onDrop:h=>{f(!1);const g=Array.from(h.dataTransfer?.files??[]);g.length!==0&&(h.preventDefault(),c(g))}}:{};return d.jsxs("div",{className:[u?"flex h-full min-h-0 flex-col":"flex flex-col",m&&"outline-2 -outline-offset-2 outline-dashed outline-accent"].filter(Boolean).join(" "),"data-testid":"compose-drop-target","data-dropping":m||void 0,...l,children:[e,t,d.jsxs("div",{className:u?"flex min-h-0 flex-1 flex-col overflow-auto":"flex flex-col","data-testid":"compose-body-area",children:[n,r&&d.jsx("div",{className:"shrink-0 px-3 pb-2",children:r})]}),o&&d.jsx("div",{className:"shrink-0",children:o}),u?a:d.jsx("div",{className:"sticky bottom-0 z-10 bg-canvas",children:a})]})}const Kt=({label:e,onClick:t})=>d.jsx("button",{type:"button",onClick:t,className:"text-xs text-fg-muted hover:text-fg transition-colors",children:e}),Ua=({to:e,cc:t,bcc:n,subject:r})=>{const o=[];return e.length>0&&o.push(`To: ${e.map(a=>a.displayName??a.email).join(", ")}`),t.length>0&&o.push(`Cc: ${t.length}`),n.length>0&&o.push(`Bcc: ${n.length}`),r&&o.push(r),o.join(" · ")},Ha=({collapsed:e=!1,summary:t="",onExpand:n,from:r,to:o,cc:a,bcc:i,subject:c,onShowCc:u,onShowBcc:m})=>e?d.jsxs("button",{type:"button",onClick:n,"aria-label":"Show recipients and subject",className:"flex min-h-11 w-full items-center gap-2 overflow-hidden border-b border-line px-3 py-1.5 text-left transition-colors hover:bg-surface-sunken","data-testid":"compose-header-collapsed",children:[d.jsx("span",{className:"truncate text-xs text-fg-muted",children:t||"…"}),d.jsx(Dr,{className:"ml-auto size-4 shrink-0 text-fg-muted","aria-hidden":"true"})]}):d.jsxs("div",{className:"space-y-1 px-3 py-2 border-b border-line",children:[r,o,a??d.jsxs("div",{className:"flex gap-2 pl-14",children:[d.jsx(Kt,{label:"Cc",onClick:u}),d.jsx(Kt,{label:"Bcc",onClick:m})]}),a&&!i&&d.jsx("div",{className:"pl-14",children:d.jsx(Kt,{label:"Bcc",onClick:m})}),i,c]}),Or="This message is attachments only, and attachments aren't forwarded — a forward would arrive with nothing of the original in it.",Wa="This message is attachments only, so there's nothing to quote and your reply goes out without the original.",za=e=>e==="forward"?Or:Wa,Va=({mode:e})=>d.jsx(wr,{tone:"warning","data-testid":"compose-quote-missing",children:d.jsx("span",{children:za(e)})}),dn="This account can't send mail until SMTP is configured.",qa=({onConfigure:e,configureRef:t})=>d.jsxs("div",{role:"alert","data-testid":"compose-smtp-missing-banner",className:"flex items-start gap-3 border-b border-warning/50 bg-warning/10 px-3 py-2",children:[d.jsx(Uo,{className:"size-5 shrink-0 mt-0.5 text-warning","aria-hidden":"true"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium text-warning",children:dn}),d.jsxs("button",{ref:t,type:"button",onClick:e,"data-testid":"compose-smtp-configure",className:"mt-1 inline-flex items-center gap-1 text-xs font-medium text-warning hover:underline",children:["Configure SMTP",d.jsx(wa,{className:"size-3","aria-hidden":"true"})]})]})]}),Ka=({value:e,onChange:t})=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"Subj:"}),d.jsx("input",{type:"text",value:e,onChange:n=>t(n.target.value),className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",placeholder:"Subject","data-subject-field":!0})]}),Ya=({text:e,html:t,senderName:n,date:r})=>{const[o,a]=s.useState(!1);if(!e&&!t)return null;const i=[n,r].filter(Boolean).join(" on ");return d.jsxs("div",{className:"mt-2 px-3 pb-2",children:[d.jsxs("button",{type:"button",onClick:()=>a(!o),"aria-expanded":o,className:"flex items-center gap-1 text-xs text-fg-muted hover:text-fg transition-colors",children:[o?d.jsx(Dr,{className:"size-3"}):d.jsx(Ho,{className:"size-3"}),i?`${i} wrote:`:"Show quoted text"]}),o&&d.jsx("blockquote",{className:"mt-2 pl-3 border-l-2 border-fg-subtle/30 text-sm text-fg-muted [&_a]:text-accent [&_a]:underline [&_blockquote]:pl-3 [&_blockquote]:border-l-2 [&_blockquote]:border-fg-subtle/30",children:t?d.jsx("div",{dangerouslySetInnerHTML:{__html:t}}):e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rich-text-spellcheck-worker-provider-Bnm0BFqL.js","assets/useSignature-ZAeHuLA5.js","assets/index-X3HUQEvM.js","assets/index-CMNnsfzR.css","assets/rich-text-spellcheck-provider-J8m9wz6A.js","assets/rich-text-Bd-wRHu1.js","assets/roving-focus-nxbliQos.js","assets/confirm-dialog-CjHvZbGT.js","assets/useMediaQuery-9NJJDrX6.js","assets/bottom-sheet-DDC7O5sx.js","assets/popover-menu-J56UZVjI.js","assets/undo-2-DT3EdJen.js","assets/useMessageBodyContent-Dhtu6I6l.js","assets/reply-Bs_YhRF4.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-CiTDV7kX.js","assets/suggest-list-Bl5m8GjB.js","assets/sections-CRDaS4nn.js","assets/chevron-down-B3lcZAVN.js"])))=>i.map(i=>d[i]);
2
+ import{b as vr,j as d,X as gr,p as ln,B as un,L as yr,v as Fo,T as $o,r as s,t as Bo,d as wr,a9 as Uo,q as Ho,c8 as wn,bV as br,c9 as xe,ca as Er,cb as Wo,cc as zo,cd as Se,f as _e,au as Me,ce as Vo,cf as qo,cg as xr,ch as Ko,as as Sr,at as Rr,a6 as Yo,e as Cr,ci as Go,U as Xo,a as At,bK as Qo,cj as Tr,ck as Zo,bM as Jo,c as Ar,cl as ea,ag as ta,cm as _n,aV as Mn,cn as na,ah as ra,co as oa,cp as aa,ac as R}from"./index-X3HUQEvM.js";import{p as sa,c as ia,b as ca}from"./useMessageBodyContent-Dhtu6I6l.js";import{w as la,u as ua,a as da,d as fa}from"./useSignature-ZAeHuLA5.js";import{b as ma}from"./account-form-helpers-DhckT_PN.js";import{u as ha}from"./useDebouncedValue-CiTDV7kX.js";import{u as pa,S as va}from"./suggest-list-Bl5m8GjB.js";import"./reply-Bs_YhRF4.js";import{a as ga}from"./sections-CRDaS4nn.js";import{u as ya}from"./useMediaQuery-9NJJDrX6.js";import{C as Dr}from"./chevron-down-B3lcZAVN.js";const wa=vr("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Nr=vr("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]),ba=({email:e,displayName:t,onRemove:n,className:r})=>d.jsxs("span",{className:ln("inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-accent-2-soft text-sm max-w-[200px]",r),children:[d.jsx("span",{className:"truncate",children:t||e}),d.jsx("button",{type:"button",onClick:n,className:"shrink-0 p-0.5 rounded-full hover:bg-fg-muted/20 transition-colors","aria-label":`Remove ${e}`,children:d.jsx(gr,{className:"size-3"})})]}),Ea=/[\u0000-\u001f\u007f-\u009f\u061c\u200b-\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069\ufeff]/g,xa=/[<>:"|?*]/g,Sa=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\.|$)/i,jn=120,Ra=12,Ca="attachment",Fn=e=>{const t=[...e];if(t.length<=jn)return e;const n=e.lastIndexOf("."),r=n>0&&[...e.slice(n)].length<=Ra?e.slice(n):"",o=jn-[...r].length;return t.slice(0,o).join("")+r},xl=(e,t=Ca)=>{const r=e.replace(Ea,"").split(/[/\\]/),a=(r[r.length-1]??"").replace(xa,"_").replace(/^[.\s]+/,"").replace(/[.\s]+$/,"");if(a.length===0)return Fn(t);const i=Sa.test(a)?`_${a}`:a;return Fn(i)},$n=["KB","MB","GB","TB"],Ta=e=>{if(!Number.isFinite(e)||e<0)return"unknown size";const t=Math.round(e);if(t<1024)return t===1?"1 byte":`${t} bytes`;const n=1023.95;let r=t/1024,o=0;for(;r>=n&&o<$n.length-1;)r/=1024,o+=1;return`${r.toFixed(1).replace(/\.0$/,"")} ${$n[o]}`},Aa=({disabled:e,onAttach:t})=>{const n=s.useRef(null);return d.jsxs(d.Fragment,{children:[d.jsx(un,{variant:"ghost",size:"md","aria-label":"Attach files",title:"Attach files","aria-busy":e,className:"min-h-11 min-w-11 px-2","data-testid":"compose-attach",icon:d.jsx(Nr,{className:"size-4"}),onClick:()=>{e||n.current?.click()}}),d.jsx("input",{ref:n,type:"file",multiple:!0,hidden:!0,"data-testid":"compose-attach-input",onChange:r=>{const o=Array.from(r.currentTarget.files??[]);r.currentTarget.value="",o.length>0&&t(o)}})]})},Da=({save:e})=>e.status==="saving"?d.jsx("output",{className:"animate-pulse text-xs text-fg-muted",children:"Saving..."}):e.status==="saved"?d.jsx("output",{className:"text-xs text-fg-muted",children:"Draft saved"}):e.status==="error"?d.jsx("output",{className:"text-xs text-danger",children:"Save failed"}):e.status==="unsaved"?d.jsx("output",{className:"truncate text-xs text-warning",children:e.reason}):null;function Na({send:e,onSend:t,onBlocked:n,onDiscard:r,save:o={status:"idle"},onAttach:a}){const i=e.status==="sending",c=e.status==="blocked"?e.reason:void 0;return d.jsxs("div",{className:"flex items-center justify-between border-t border-line px-3 py-2",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[d.jsx(un,{variant:"primary",size:"md","aria-busy":i,title:c,className:"min-h-11 shrink-0 rounded-full px-4","data-testid":"compose-send",icon:i?d.jsx(yr,{className:"size-4 animate-spin"}):d.jsx(Fo,{className:"size-4"}),onClick:()=>{if(!i){if(c!==void 0){n(c);return}t()}},children:"Send"}),a&&d.jsx(Aa,{disabled:i,onAttach:a}),d.jsx(Da,{save:o})]}),d.jsx(un,{variant:"ghost",size:"md","aria-busy":i,"aria-label":"Discard",className:"min-h-11 min-w-11 px-2 hover:text-danger",icon:d.jsx($o,{className:"size-4"}),onClick:()=>{i||r()}})]})}const Bn=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),Oa=e=>{const t=e.trim();if(!t)return;const n=t.match(/^(.+?)\s*<([^>]+)>$/);if(n){const r=n[1].trim().replace(/^"(.*)"$/,"$1"),o=n[2].trim();if(Bn(o))return{email:o,displayName:r}}if(Bn(t))return{email:t}},ka=e=>{const t=[];let n="",r=!1,o=!1;for(const a of e){if(a==='"'&&(r=!r),a==="<"&&(o=!0),a===">"&&(o=!1),(a===","||a===";")&&!r&&!o){t.push(n),n="";continue}n+=a}return t.push(n),t},Ia=e=>{const t=[],n=[];for(const r of ka(e)){const o=Oa(r);if(o){t.push(o);continue}r.trim()&&n.push(r.trim())}return{entries:t,unparsed:n.join(", ")}},La=["Tab",","],Pa=150,_a=({label:e,addresses:t,onChange:n,placeholder:r,suggestions:o=[],onQueryChange:a,onPendingChange:i,ref:c})=>{const[u,m]=s.useState(""),f=s.useRef(null),l=s.useMemo(()=>Ia(u),[u]);s.useEffect(()=>{i?.(l)},[l,i]);const h=s.useRef(void 0),g=s.useCallback(()=>{h.current!==void 0&&(clearTimeout(h.current),h.current=void 0)},[]);s.useEffect(()=>g,[g]);const x=new Set(t.map(b=>b.email.toLowerCase())),p=u.length>=2?o.filter(b=>!x.has(b.email.toLowerCase())):[],E=s.useCallback(b=>{m(b),a?.(b)},[a]),w=s.useCallback(b=>{g(),!x.has(b.email.toLowerCase())&&(n([...t,b]),E(""))},[t,x,n,E,g]),A=s.useCallback(b=>{n(t.filter((P,C)=>C!==b))},[t,n]),y=s.useCallback(b=>{w(b),f.current?.focus()},[w]),v=s.useCallback(()=>{if(g(),l.entries.length===0)return{addresses:t,unparsed:l.unparsed};const b=new Set(x),P=[...t];for(const C of l.entries){const q=C.email.toLowerCase();b.has(q)||(b.add(q),P.push(C))}return n(P),E(l.unparsed),{addresses:P,unparsed:l.unparsed}},[l,t,x,n,E,g]),D=s.useCallback(()=>{g(),E("")},[E,g]);s.useImperativeHandle(c,()=>({commitPending:v,clearPending:D}),[v,D]);const _=s.useRef(v);s.useEffect(()=>{_.current=v},[v]);const S=pa({count:p.length,acceptKeys:La,onAccept:b=>y(p[b])}),k=s.useMemo(()=>p.map(b=>({value:b.email,label:b.displayName??b.email,...b.displayName?{hint:b.email}:{}})),[p]),N=s.useCallback(b=>{if(b.key==="Backspace"&&u===""&&t.length>0){A(t.length-1);return}S.handleKeyDown(b)||(b.key==="Enter"||b.key==="Tab"||b.key===",")&&u.trim()&&(b.preventDefault(),v())},[u,t.length,A,S.handleKeyDown,v]),F=s.useCallback(()=>{g(),h.current=setTimeout(()=>{h.current=void 0,_.current(),S.dismiss()},Pa)},[g,S.dismiss]);return d.jsxs("div",{className:"relative","data-address-field":e,children:[d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsxs("label",{htmlFor:`address-field-${e}`,className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:[e,":"]}),d.jsxs("div",{className:"flex-1 flex flex-wrap items-center gap-1 min-h-[36px] px-2 py-1 border rounded-md bg-canvas cursor-text",onClick:()=>f.current?.focus(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&f.current?.focus()},children:[t.map((b,P)=>d.jsx(ba,{email:b.email,displayName:b.displayName,onRemove:()=>A(P)},b.email)),d.jsx("input",{ref:f,id:`address-field-${e}`,type:"text",value:u,onChange:b=>{S.reopen(),E(b.target.value)},onKeyDown:N,onBlur:F,placeholder:t.length===0?r:"",className:"flex-1 min-w-[120px] bg-transparent outline-none text-sm py-0.5",autoComplete:"off",...S.comboboxProps})]})]}),S.open&&d.jsx(va,{id:S.listId,suggestions:k,activeIndex:S.activeIndex,optionId:S.optionId,onPick:b=>{const P=p.find(C=>C.email===b.value);P&&y(P)},onHighlight:S.setActiveIndex,label:`${e} suggestions`,className:"absolute left-12 right-0 z-50 mt-1 max-h-[200px] shadow-lg"})]})},Ma=({state:e})=>e.status==="uploading"?d.jsx(yr,{className:"size-4 shrink-0 animate-spin text-fg-subtle","aria-hidden":!0}):e.status==="failed"?d.jsx(Bo,{className:"size-4 shrink-0 text-danger","aria-hidden":!0}):d.jsx(Nr,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0});function ja({items:e,onRemove:t,onRetry:n,className:r}){return e.length===0?null:d.jsx("ul",{"aria-label":"Attached files","data-testid":"compose-attachments",className:ln("flex flex-col gap-1 px-3 py-2",r),children:e.map(o=>d.jsxs("li",{"data-testid":"compose-attachment","data-state":o.state.status,className:ln("rounded-sm border bg-surface",o.state.status==="failed"?"border-danger/40":"border-line"),children:[d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx(Ma,{state:o.state}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("bdi",{className:"block truncate text-sm text-fg",title:o.filename,children:o.filename}),d.jsxs("span",{className:"block text-2xs text-fg-subtle",children:[Ta(o.sizeBytes),o.state.status==="uploading"?" · Uploading…":""]})]}),o.state.status==="failed"&&o.state.retryable&&d.jsx("button",{type:"button",onClick:()=>n(o.key),className:"text-xs font-medium text-accent hover:underline",children:"Try again"}),d.jsx("button",{type:"button","aria-label":`Remove ${o.filename}`,onClick:()=>t(o.key),className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-sunken hover:text-fg",children:d.jsx(gr,{className:"size-4","aria-hidden":!0})})]}),o.state.status==="failed"&&d.jsx("p",{role:"alert","data-testid":"compose-attachment-error",className:"border-t border-danger/30 bg-danger-soft px-2 py-1.5 text-xs text-danger",children:o.state.reason})]},o.key))})}const Fa=()=>d.jsxs("div",{"aria-hidden":"true","data-testid":"compose-body-skeleton",className:"min-h-[120px] px-3 py-2",children:[d.jsx("div",{className:"mb-2 h-8 animate-pulse rounded bg-surface-sunken"}),d.jsx("div",{className:"min-h-[80px] animate-pulse rounded bg-surface-sunken/50"})]}),$a=e=>Array.from(e.dataTransfer?.types??[]).includes("Files");function Ba({banner:e,header:t,children:n,quoted:r,attachments:o,actionBar:a,layout:i="fill",onDropFiles:c}){const u=i==="fill",[m,f]=s.useState(!1),l=c?{onDragOver:h=>{$a(h)&&(h.preventDefault(),f(!0))},onDragLeave:h=>{h.relatedTarget instanceof Node&&h.currentTarget.contains(h.relatedTarget)||f(!1)},onDrop:h=>{f(!1);const g=Array.from(h.dataTransfer?.files??[]);g.length!==0&&(h.preventDefault(),c(g))}}:{};return d.jsxs("div",{className:[u?"flex h-full min-h-0 flex-col":"flex flex-col",m&&"outline-2 -outline-offset-2 outline-dashed outline-accent"].filter(Boolean).join(" "),"data-testid":"compose-drop-target","data-dropping":m||void 0,...l,children:[e,t,d.jsxs("div",{className:u?"flex min-h-0 flex-1 flex-col overflow-auto":"flex flex-col","data-testid":"compose-body-area",children:[n,r&&d.jsx("div",{className:"shrink-0 px-3 pb-2",children:r})]}),o&&d.jsx("div",{className:"shrink-0",children:o}),u?a:d.jsx("div",{className:"sticky bottom-0 z-10 bg-canvas",children:a})]})}const Kt=({label:e,onClick:t})=>d.jsx("button",{type:"button",onClick:t,className:"text-xs text-fg-muted hover:text-fg transition-colors",children:e}),Ua=({to:e,cc:t,bcc:n,subject:r})=>{const o=[];return e.length>0&&o.push(`To: ${e.map(a=>a.displayName??a.email).join(", ")}`),t.length>0&&o.push(`Cc: ${t.length}`),n.length>0&&o.push(`Bcc: ${n.length}`),r&&o.push(r),o.join(" · ")},Ha=({collapsed:e=!1,summary:t="",onExpand:n,from:r,to:o,cc:a,bcc:i,subject:c,onShowCc:u,onShowBcc:m})=>e?d.jsxs("button",{type:"button",onClick:n,"aria-label":"Show recipients and subject",className:"flex min-h-11 w-full items-center gap-2 overflow-hidden border-b border-line px-3 py-1.5 text-left transition-colors hover:bg-surface-sunken","data-testid":"compose-header-collapsed",children:[d.jsx("span",{className:"truncate text-xs text-fg-muted",children:t||"…"}),d.jsx(Dr,{className:"ml-auto size-4 shrink-0 text-fg-muted","aria-hidden":"true"})]}):d.jsxs("div",{className:"space-y-1 px-3 py-2 border-b border-line",children:[r,o,a??d.jsxs("div",{className:"flex gap-2 pl-14",children:[d.jsx(Kt,{label:"Cc",onClick:u}),d.jsx(Kt,{label:"Bcc",onClick:m})]}),a&&!i&&d.jsx("div",{className:"pl-14",children:d.jsx(Kt,{label:"Bcc",onClick:m})}),i,c]}),Or="This message is attachments only, and attachments aren't forwarded — a forward would arrive with nothing of the original in it.",Wa="This message is attachments only, so there's nothing to quote and your reply goes out without the original.",za=e=>e==="forward"?Or:Wa,Va=({mode:e})=>d.jsx(wr,{tone:"warning","data-testid":"compose-quote-missing",children:d.jsx("span",{children:za(e)})}),dn="This account can't send mail until SMTP is configured.",qa=({onConfigure:e,configureRef:t})=>d.jsxs("div",{role:"alert","data-testid":"compose-smtp-missing-banner",className:"flex items-start gap-3 border-b border-warning/50 bg-warning/10 px-3 py-2",children:[d.jsx(Uo,{className:"size-5 shrink-0 mt-0.5 text-warning","aria-hidden":"true"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium text-warning",children:dn}),d.jsxs("button",{ref:t,type:"button",onClick:e,"data-testid":"compose-smtp-configure",className:"mt-1 inline-flex items-center gap-1 text-xs font-medium text-warning hover:underline",children:["Configure SMTP",d.jsx(wa,{className:"size-3","aria-hidden":"true"})]})]})]}),Ka=({value:e,onChange:t})=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"Subj:"}),d.jsx("input",{type:"text",value:e,onChange:n=>t(n.target.value),className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",placeholder:"Subject","data-subject-field":!0})]}),Ya=({text:e,html:t,senderName:n,date:r})=>{const[o,a]=s.useState(!1);if(!e&&!t)return null;const i=[n,r].filter(Boolean).join(" on ");return d.jsxs("div",{className:"mt-2 px-3 pb-2",children:[d.jsxs("button",{type:"button",onClick:()=>a(!o),"aria-expanded":o,className:"flex items-center gap-1 text-xs text-fg-muted hover:text-fg transition-colors",children:[o?d.jsx(Dr,{className:"size-3"}):d.jsx(Ho,{className:"size-3"}),i?`${i} wrote:`:"Show quoted text"]}),o&&d.jsx("blockquote",{className:"mt-2 pl-3 border-l-2 border-fg-subtle/30 text-sm text-fg-muted [&_a]:text-accent [&_a]:underline [&_blockquote]:pl-3 [&_blockquote]:border-l-2 [&_blockquote]:border-fg-subtle/30",children:t?d.jsx("div",{dangerouslySetInnerHTML:{__html:t}}):e.split(`
3
3
  `).map((c,u)=>d.jsx("p",{className:"min-h-[1.2em]",children:c},u))})]})},Ga=["p","br","div","h1","h2","h3","h4","h5","h6","strong","b","em","i","u","s","ul","ol","li","blockquote","pre","code","hr","table","thead","tbody","tr","th","td","a","img"],Xa=["href","src","alt","colspan","rowspan","lang","dir"],Qa=/^(?:https?:|mailto:)/i,Za=/^(?:https:|data:image\/)/i,Ja=/^cid:(.+)$/i,fn=()=>!1;let mn=fn;const es=e=>{const t=Ja.exec(e);return t?mn(t[1]):Za.test(e)},ts="max-width:100%;height:auto",ns=e=>{const t=sa();if(!t.isSupported)throw new Error("adopted HTML cannot be sanitized: no DOM is available");return t.addHook("afterSanitizeAttributes",n=>{if(n.tagName==="A"){Qa.test(n.getAttribute("href")??"")||n.removeAttribute("href"),e==="quoted"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer nofollow"));return}if(n.tagName==="IMG"){if(e==="quoted"){n.remove();return}if(!es(n.getAttribute("src")??"")){n.remove();return}n.setAttribute("style",ts)}}),t},Un=new Map,rs=e=>{const t=Un.get(e);if(t)return t;const n=ns(e);return Un.set(e,n),n},kr=(e,t)=>rs(t).sanitize(e,{ALLOWED_TAGS:Ga,ALLOWED_ATTR:Xa,ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1}),Sl=(e,t=fn)=>{mn=t;try{return kr(e,"outgoing")}finally{mn=fn}},os=e=>kr(e,"quoted"),as=e=>typeof e=="string"&&e.length>0?"rich":"plain",Rl=(e,t)=>t.length>0,ss={plain:"Couldn't switch to plain text",rich:"Couldn't switch to rich text"},Cl=(e,t,n)=>t.trim()===""||n.trim()!==""?{outcome:"switch"}:{outcome:"blocked",title:ss[e],detail:"The conversion came back empty, so your message is unchanged."};function Re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)}}function Hn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function is(...e){return t=>{let n=!1;const r=e.map(o=>{const a=Hn(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<r.length;o++){const a=r[o];typeof a=="function"?a():Hn(e[o],null)}}}}function je(...e){return s.useCallback(is(...e),e)}function cs(e,t=[]){let n=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const u=n.length;n=[...n,i];const m=l=>{const{scope:h,children:g,...x}=l,p=h?.[e]?.[u]||c,E=s.useMemo(()=>x,Object.values(x));return d.jsx(p.Provider,{value:E,children:g})};m.displayName=a+"Provider";function f(l,h,g={}){const{optional:x=!1}=g,p=h?.[e]?.[u]||c,E=s.useContext(p);if(E)return E;if(i!==void 0)return i;if(!x)throw new Error(`\`${l}\` must be used within \`${a}\``)}return[m,f]}const o=()=>{const a=n.map(i=>s.createContext(i));return function(c){const u=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return o.scopeName=e,[r,ls(o,...t)]}function ls(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=r.reduce((c,{useScope:u,scopeName:m})=>{const l=u(a)[`__scope${m}`];return{...c,...l}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var nt=globalThis?.document?s.useLayoutEffect:()=>{},us=wn[" useInsertionEffect ".trim().toString()]||nt;function ds({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,i]=fs({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:o;{const f=s.useRef(e!==void 0);s.useEffect(()=>{const l=f.current;l!==c&&console.warn(`${r} is changing from ${l?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const m=s.useCallback(f=>{if(c){const l=ms(f)?f(e):f;l!==e&&i.current?.(l)}else a(f)},[c,e,a,i]);return[u,m]}function fs({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),o=s.useRef(n),a=s.useRef(t);return us(()=>{a.current=t},[t]),s.useEffect(()=>{o.current!==n&&(a.current?.(n),o.current=n)},[n,o]),[n,r,a]}function ms(e){return typeof e=="function"}function Ir(e){const t=s.forwardRef((n,r)=>{let{children:o,...a}=n,i=null,c=!1;const u=[];Wn(o)&&typeof pt=="function"&&(o=pt(o._payload)),s.Children.forEach(o,h=>{if(ys(h)){c=!0;const g=h;let x="child"in g.props?g.props.child:g.props.children;Wn(x)&&typeof pt=="function"&&(x=pt(x._payload)),i=ps(g,x),u.push(i?.props?.children)}else u.push(h)}),i?i=s.cloneElement(i,void 0,u):!c&&s.Children.count(o)===1&&s.isValidElement(o)&&(i=o);const m=i?gs(i):void 0,f=je(r,m);if(!i){if(o||o===0)throw new Error(c?xs(e):Es(e));return o}const l=vs(a,i.props??{});return i.type!==s.Fragment&&(l.ref=r?f:m),s.cloneElement(i,l)});return t.displayName=`${e}.Slot`,t}var hs=Symbol.for("radix.slottable"),ps=(e,t)=>{if("child"in e.props){const n=e.props.child;return s.isValidElement(n)?s.cloneElement(n,void 0,e.props.children(n.props.children)):null}return s.isValidElement(t)?t:null};function vs(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...c)=>{const u=a(...c);return o(...c),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function gs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ys(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hs}var ws=Symbol.for("react.lazy");function Wn(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ws&&"_payload"in e&&bs(e._payload)}function bs(e){return typeof e=="object"&&e!==null&&"then"in e}var Es=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,xs=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,pt=wn[" use ".trim().toString()],Ss=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=Ss.reduce((e,t)=>{const n=Ir(`Primitive.${t}`),r=s.forwardRef((o,a)=>{const{asChild:i,...c}=o,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Rs(e,t){e&&br.flushSync(()=>e.dispatchEvent(t))}function rt(e){const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>((...n)=>t.current?.(...n)),[])}var Cs="DismissableLayer",hn="dismissableLayer.update",Ts="dismissableLayer.pointerDownOutside",As="dismissableLayer.focusOutside",zn,bn=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Lr=s.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:c,onDismiss:u,...m}=e,f=s.useContext(bn),[l,h]=s.useState(null),g=l?.ownerDocument??globalThis?.document,[,x]=s.useState({}),p=je(t,h),E=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),A=w?E.indexOf(w):-1,y=l?E.indexOf(l):-1,v=f.layersWithOutsidePointerEventsDisabled.size>0,D=y>=A,_=s.useRef(!1),S=Is(b=>{a?.(b),c?.(b),b.defaultPrevented||u?.()},{ownerDocument:g,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:_,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:s.useCallback(b=>{if(!(b instanceof Node))return!1;const P=[...f.branches].some(C=>C.contains(b));return D&&!P},[f.branches,D])}),k=Ls(b=>{if(r&&_.current)return;const P=b.target;[...f.branches].some(q=>q.contains(P))||(i?.(b),c?.(b),b.defaultPrevented||u?.())},g),N=l?y===E.length-1:!1,F=rt(b=>{b.key==="Escape"&&(o?.(b),!b.defaultPrevented&&u&&(b.preventDefault(),u()))});return s.useEffect(()=>{if(N)return g.addEventListener("keydown",F,{capture:!0}),()=>g.removeEventListener("keydown",F,{capture:!0})},[g,N,F]),s.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(zn=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),Vn(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(l),f.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=zn))}},[l,g,n,f]),s.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),Vn())},[l,f]),s.useEffect(()=>{const b=()=>x({});return document.addEventListener(hn,b),()=>document.removeEventListener(hn,b)},[]),d.jsx(ge.div,{...m,ref:p,style:{pointerEvents:v?D?"auto":"none":void 0,...e.style},onFocusCapture:Re(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Re(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Re(e.onPointerDownCapture,S.onPointerDownCapture)})});Lr.displayName=Cs;var Ds="DismissableLayerBranch",Ns=s.forwardRef((e,t)=>{const n=s.useContext(bn),r=s.useRef(null),o=je(t,r);return s.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),d.jsx(ge.div,{...e,ref:o})});Ns.displayName=Ds;function Os(){const e=s.useContext(bn),[t,n]=s.useState(null);return s.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var ks=()=>!0;function Is(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:a,shouldHandlePointerDownOutside:i=ks}=t,c=rt(e),u=s.useRef(!1),m=s.useRef(!1),f=s.useRef(new Map),l=s.useRef(()=>{});return s.useEffect(()=>{function h(){m.current=!1,o.current=!1,f.current.clear()}function g(){return Array.from(f.current.values()).some(Boolean)}function x(y){if(!m.current)return;const v=y.target;v instanceof Node&&[...a].some(_=>_.contains(v))||f.current.set(y.type,!0),y.type==="click"&&window.setTimeout(()=>{m.current&&l.current()},0)}function p(y){m.current&&f.current.set(y.type,!1)}const E=y=>{if(y.target&&!u.current){let v=function(){n.removeEventListener("click",l.current);const _=g();h(),_||Pr(Ts,c,D,{discrete:!0})};if(!i(y.target)){n.removeEventListener("click",l.current),h(),u.current=!1;return}const D={originalEvent:y};m.current=!0,o.current=r&&y.button===0,f.current.clear(),!r||y.button!==0?v():(n.removeEventListener("click",l.current),l.current=v,n.addEventListener("click",l.current,{once:!0}))}else n.removeEventListener("click",l.current),h();u.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const y of w)n.addEventListener(y,x,!0),n.addEventListener(y,p);const A=window.setTimeout(()=>{n.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(A),n.removeEventListener("pointerdown",E),n.removeEventListener("click",l.current);for(const y of w)n.removeEventListener(y,x,!0),n.removeEventListener(y,p)}},[n,c,r,o,a,i]),{onPointerDownCapture:()=>u.current=!0}}function Ls(e,t=globalThis?.document){const n=rt(e),r=s.useRef(!1);return s.useEffect(()=>{const o=a=>{a.target&&!r.current&&Pr(As,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Vn(){const e=new CustomEvent(hn);document.dispatchEvent(e)}function Pr(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Rs(o,a):o.dispatchEvent(a)}var vt=0,Be=null;function Ps(){s.useEffect(()=>{Be||(Be={start:qn(),end:qn()});const{start:e,end:t}=Be;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),vt++,()=>{vt===1&&(Be?.start.remove(),Be?.end.remove(),Be=null),vt=Math.max(0,vt-1)}},[])}function qn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Yt="focusScope.autoFocusOnMount",Gt="focusScope.autoFocusOnUnmount",Kn={bubbles:!1,cancelable:!0},_s="FocusScope",_r=s.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[c,u]=s.useState(null),m=rt(o),f=rt(a),l=s.useRef(null),h=je(t,u),g=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(r){let p=function(y){if(g.paused||!c)return;const v=y.target;c.contains(v)?l.current=v:Ee(l.current,{select:!0})},E=function(y){if(g.paused||!c)return;const v=y.relatedTarget;v!==null&&(c.contains(v)||Ee(l.current,{select:!0}))},w=function(y){if(document.activeElement===document.body)for(const D of y)D.removedNodes.length>0&&Ee(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",E);const A=new MutationObserver(w);return c&&A.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",E),A.disconnect()}}},[r,c,g.paused]),s.useEffect(()=>{if(c){Gn.add(g);const p=document.activeElement;if(!c.contains(p)){const w=new CustomEvent(Yt,Kn);c.addEventListener(Yt,m),c.dispatchEvent(w),w.defaultPrevented||(Ms(Us(Mr(c)),{select:!0}),document.activeElement===p&&Ee(c))}return()=>{c.removeEventListener(Yt,m),setTimeout(()=>{const w=new CustomEvent(Gt,Kn);c.addEventListener(Gt,f),c.dispatchEvent(w),w.defaultPrevented||Ee(p??document.body,{select:!0}),c.removeEventListener(Gt,f),Gn.remove(g)},0)}}},[c,m,f,g]);const x=s.useCallback(p=>{if(!n&&!r||g.paused)return;const E=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,w=document.activeElement;if(E&&w){const A=p.currentTarget,[y,v]=js(A);y&&v?!p.shiftKey&&w===v?(p.preventDefault(),n&&Ee(y,{select:!0})):p.shiftKey&&w===y&&(p.preventDefault(),n&&Ee(v,{select:!0})):w===A&&p.preventDefault()}},[n,r,g.paused]);return d.jsx(ge.div,{tabIndex:-1,...i,ref:h,onKeyDown:x})});_r.displayName=_s;function Ms(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ee(r,{select:t}),document.activeElement!==n)return}function js(e){const t=Mr(e),n=Yn(t,e),r=Yn(t.reverse(),e);return[n,r]}function Mr(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Yn(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Fs(r,{upTo:t})))return r}function Fs(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function $s(e){return e instanceof HTMLInputElement&&"select"in e}function Ee(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&$s(e)&&t&&e.select()}}var Gn=Bs();function Bs(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Xn(e,t),e.unshift(t)},remove(t){e=Xn(e,t),e[0]?.resume()}}}function Xn(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Us(e){return e.filter(t=>t.tagName!=="A")}var Hs=wn[" useId ".trim().toString()]||(()=>{}),Ws=0;function Xt(e){const[t,n]=s.useState(Hs());return nt(()=>{n(r=>r??String(Ws++))},[e]),e||(t?`radix-${t}`:"")}var zs="Portal",jr=s.forwardRef((e,t)=>{const{container:n,...r}=e,[o,a]=s.useState(!1);nt(()=>a(!0),[]);const i=n||o&&globalThis?.document?.body;return i?br.createPortal(d.jsx(ge.div,{...r,ref:t}),i):null});jr.displayName=zs;function Vs(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}var Ot=e=>{const{present:t,children:n}=e,r=qs(t),o=typeof n=="function"?n({present:r.isPresent}):s.Children.only(n),a=Ks(r.ref,Ys(o));return typeof n=="function"||r.isPresent?s.cloneElement(o,{ref:a}):null};Ot.displayName="Presence";function qs(e){const[t,n]=s.useState(),r=s.useRef(null),o=s.useRef(e),a=s.useRef("none"),i=s.useRef(void 0),c=e?"mounted":"unmounted",[u,m]=Vs(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{u==="mounted"?(a.current=i.current??Je(r.current),i.current=void 0):a.current="none"},[u]),nt(()=>{const f=r.current,l=o.current;if(l!==e){const g=a.current,x=Je(f);e?(i.current=x,m("MOUNT")):x==="none"||f?.display==="none"?m("UNMOUNT"):m(l&&g!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,m]),nt(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,h=x=>{const E=Je(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&E&&(m("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},g=x=>{x.target===t&&(a.current=Je(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:s.useCallback(f=>{if(f){const l=getComputedStyle(f);r.current=l,i.current=Je(l)}else r.current=null;n(f)},[])}}function Qn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ks(...e){const t=s.useRef(e);return t.current=e,s.useCallback(n=>{const r=t.current;let o=!1;const a=r.map(i=>{const c=Qn(i,n);return!o&&typeof c=="function"&&(o=!0),c});if(o)return()=>{for(let i=0;i<a.length;i++){const c=a[i];typeof c=="function"?c():Qn(r[i],null)}}},[])}function Je(e){return e?.animationName||"none"}function Ys(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Gs=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ue=new WeakMap,gt=new WeakMap,yt={},Qt=0,Fr=function(e){return e&&(e.host||Fr(e.parentNode))},Xs=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Fr(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Qs=function(e,t,n,r){var o=Xs(t,Array.isArray(e)?e:[e]);yt[n]||(yt[n]=new WeakMap);var a=yt[n],i=[],c=new Set,u=new Set(o),m=function(l){!l||c.has(l)||(c.add(l),m(l.parentNode))};o.forEach(m);var f=function(l){!l||u.has(l)||Array.prototype.forEach.call(l.children,function(h){if(c.has(h))f(h);else try{var g=h.getAttribute(r),x=g!==null&&g!=="false",p=(Ue.get(h)||0)+1,E=(a.get(h)||0)+1;Ue.set(h,p),a.set(h,E),i.push(h),p===1&&x&&gt.set(h,!0),E===1&&h.setAttribute(n,"true"),x||h.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",h,w)}})};return f(t),c.clear(),Qt++,function(){i.forEach(function(l){var h=Ue.get(l)-1,g=a.get(l)-1;Ue.set(l,h),a.set(l,g),h||(gt.has(l)||l.removeAttribute(r),gt.delete(l)),g||l.removeAttribute(n)}),Qt--,Qt||(Ue=new WeakMap,Ue=new WeakMap,gt=new WeakMap,yt={})}},Zs=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Gs(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Qs(r,o,n,"aria-hidden")):function(){return null}},Rt="right-scroll-bar-position",Ct="width-before-scroll-bar",Js="with-scroll-bars-hidden",ei="--removed-body-scroll-bar-size";function Zt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ti(e,t){var n=s.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var ni=typeof window<"u"?s.useLayoutEffect:s.useEffect,Zn=new WeakMap;function ri(e,t){var n=ti(null,function(r){return e.forEach(function(o){return Zt(o,r)})});return ni(function(){var r=Zn.get(n);if(r){var o=new Set(r),a=new Set(e),i=n.current;o.forEach(function(c){a.has(c)||Zt(c,null)}),a.forEach(function(c){o.has(c)||Zt(c,i)})}Zn.set(n,e)},[e]),n}function oi(e){return e}function ai(e,t){t===void 0&&(t=oi);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var i=t(a,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(a){for(r=!0;n.length;){var i=n;n=[],i.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(a),i=n}var u=function(){var f=i;i=[],f.forEach(a)},m=function(){return Promise.resolve().then(u)};m(),n={push:function(f){i.push(f),m()},filter:function(f){return i=i.filter(f),n}}}};return o}function si(e){e===void 0&&(e={});var t=ai(null);return t.options=xe({async:!0,ssr:!1},e),t}var $r=function(e){var t=e.sideCar,n=Er(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return s.createElement(r,xe({},n))};$r.isSideCarExport=!0;function ii(e,t){return e.useMedium(t),$r}var Br=si(),Jt=function(){},kt=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:Jt,onWheelCapture:Jt,onTouchMoveCapture:Jt}),o=r[0],a=r[1],i=e.forwardProps,c=e.children,u=e.className,m=e.removeScrollBar,f=e.enabled,l=e.shards,h=e.sideCar,g=e.noRelative,x=e.noIsolation,p=e.inert,E=e.allowPinchZoom,w=e.as,A=w===void 0?"div":w,y=e.gapMode,v=Er(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=h,_=ri([n,t]),S=xe(xe({},v),o);return s.createElement(s.Fragment,null,f&&s.createElement(D,{sideCar:Br,removeScrollBar:m,shards:l,noRelative:g,noIsolation:x,inert:p,setCallbacks:a,allowPinchZoom:!!E,lockRef:n,gapMode:y}),i?s.cloneElement(s.Children.only(c),xe(xe({},S),{ref:_})):s.createElement(A,xe({},S,{className:u,ref:_}),c))});kt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};kt.classNames={fullWidth:Ct,zeroRight:Rt};var ci=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function li(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ci();return t&&e.setAttribute("nonce",t),e}function ui(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function di(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var fi=function(){var e=0,t=null;return{add:function(n){e==0&&(t=li())&&(ui(t,n),di(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},mi=function(){var e=fi();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ur=function(){var e=mi(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},hi={left:0,top:0,right:0,gap:0},en=function(e){return parseInt(e||"",10)||0},pi=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[en(n),en(r),en(o)]},vi=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return hi;var t=pi(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},gi=Ur(),ze="data-scroll-locked",yi=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
4
4
  .`.concat(Js,` {
5
5
  overflow: hidden `).concat(r,`;
@@ -40,7 +40,7 @@ import{b as vr,j as d,X as gr,p as ln,B as un,L as yr,v as Fo,T as $o,r as s,t a
40
40
  `)},Jn=function(){var e=parseInt(document.body.getAttribute(ze)||"0",10);return isFinite(e)?e:0},wi=function(){s.useEffect(function(){return document.body.setAttribute(ze,(Jn()+1).toString()),function(){var e=Jn()-1;e<=0?document.body.removeAttribute(ze):document.body.setAttribute(ze,e.toString())}},[])},bi=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;wi();var a=s.useMemo(function(){return vi(o)},[o]);return s.createElement(gi,{styles:yi(a,!t,o,n?"":"!important")})},pn=!1;if(typeof window<"u")try{var wt=Object.defineProperty({},"passive",{get:function(){return pn=!0,!0}});window.addEventListener("test",wt,wt),window.removeEventListener("test",wt,wt)}catch{pn=!1}var He=pn?{passive:!1}:!1,Ei=function(e){return e.tagName==="TEXTAREA"},Hr=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Ei(e)&&n[t]==="visible")},xi=function(e){return Hr(e,"overflowY")},Si=function(e){return Hr(e,"overflowX")},er=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Wr(e,r);if(o){var a=zr(e,r),i=a[1],c=a[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ri=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Ci=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Wr=function(e,t){return e==="v"?xi(t):Si(t)},zr=function(e,t){return e==="v"?Ri(t):Ci(t)},Ti=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ai=function(e,t,n,r,o){var a=Ti(e,window.getComputedStyle(t).direction),i=a*r,c=n.target,u=t.contains(c),m=!1,f=i>0,l=0,h=0;do{if(!c)break;var g=zr(e,c),x=g[0],p=g[1],E=g[2],w=p-E-a*x;(x||w)&&Wr(e,c)&&(l+=w,h+=x);var A=c.parentNode;c=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(f&&Math.abs(l)<1||!f&&Math.abs(h)<1)&&(m=!0),m},bt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},tr=function(e){return[e.deltaX,e.deltaY]},nr=function(e){return e&&"current"in e?e.current:e},Di=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ni=function(e){return`
41
41
  .block-interactivity-`.concat(e,` {pointer-events: none;}
42
42
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
43
- `)},Oi=0,We=[];function ki(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),o=s.useState(Oi++)[0],a=s.useState(Ur)[0],i=s.useRef(e);s.useEffect(function(){i.current=e},[e]),s.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=Wo([e.lockRef.current],(e.shards||[]).map(nr),!0).filter(Boolean);return p.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(p,E){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var w=bt(p),A=n.current,y="deltaX"in p?p.deltaX:A[0]-w[0],v="deltaY"in p?p.deltaY:A[1]-w[1],D,_=p.target,S=Math.abs(y)>Math.abs(v)?"h":"v";if("touches"in p&&S==="h"&&_.type==="range")return!1;var k=window.getSelection(),N=k&&k.anchorNode,F=N?N===_||N.contains(_):!1;if(F)return!1;var b=er(S,_);if(!b)return!0;if(b?D=S:(D=S==="v"?"h":"v",b=er(S,_)),!b)return!1;if(!r.current&&"changedTouches"in p&&(y||v)&&(r.current=D),!D)return!0;var P=r.current||D;return Ai(P,E,p,P==="h"?y:v)},[]),u=s.useCallback(function(p){var E=p;if(!(!We.length||We[We.length-1]!==a)){var w="deltaY"in E?tr(E):bt(E),A=t.current.filter(function(D){return D.name===E.type&&(D.target===E.target||E.target===D.shadowParent)&&Di(D.delta,w)})[0];if(A&&A.should){E.cancelable&&E.preventDefault();return}if(!A){var y=(i.current.shards||[]).map(nr).filter(Boolean).filter(function(D){return D.contains(E.target)}),v=y.length>0?c(E,y[0]):!i.current.noIsolation;v&&E.cancelable&&E.preventDefault()}}},[]),m=s.useCallback(function(p,E,w,A){var y={name:p,delta:E,target:w,should:A,shadowParent:Ii(w)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(v){return v!==y})},1)},[]),f=s.useCallback(function(p){n.current=bt(p),r.current=void 0},[]),l=s.useCallback(function(p){m(p.type,tr(p),p.target,c(p,e.lockRef.current))},[]),h=s.useCallback(function(p){m(p.type,bt(p),p.target,c(p,e.lockRef.current))},[]);s.useEffect(function(){return We.push(a),e.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:h}),document.addEventListener("wheel",u,He),document.addEventListener("touchmove",u,He),document.addEventListener("touchstart",f,He),function(){We=We.filter(function(p){return p!==a}),document.removeEventListener("wheel",u,He),document.removeEventListener("touchmove",u,He),document.removeEventListener("touchstart",f,He)}},[]);var g=e.removeScrollBar,x=e.inert;return s.createElement(s.Fragment,null,x?s.createElement(a,{styles:Ni(o)}):null,g?s.createElement(bi,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ii(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Li=ii(Br,ki);var Vr=s.forwardRef(function(e,t){return s.createElement(kt,xe({},e,{ref:t,sideCar:Li}))});Vr.classNames=kt.classNames;const Tl=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=s.useCallback(o=>{const a=o.target;if(!(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable))for(const i of t){if(!(o.key.toLowerCase()===i.key.toLowerCase())||i.action&&zo(i.action)||i.requireShift!==void 0&&i.requireShift!==o.shiftKey)continue;const u=o.ctrlKey||o.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==u)continue}else{const m=i.noModifiers??!0,f=u||o.altKey||i.requireShift===void 0&&o.shiftKey;if(m&&f)continue}i.preventDefault&&o.preventDefault(),i.stopPropagation&&(o.stopPropagation(),o.stopImmediatePropagation()),i.handler(o);return}},[t]);s.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},Pi=e=>typeof e=="object"&&e!==null&&"code"in e&&e.code==="attachment_rejected"&&"message"in e&&typeof e.message=="string",_i=new Set(["EmptyFile","UnusableFilename","FileTooLarge","TooManyAttachments"]),rr={status:"uploading"},qr={status:"attached"},Pe=(e,t)=>({status:"failed",reason:e,retryable:t}),tn=(e,t)=>Pi(t)?Pe(t.message,!_i.has(t.reason)):Pe(`"${e}" could not be attached: ${Se(t)??"the request failed"}. Try again.`,!0),Mi=e=>({key:e.outboxAttachmentId,serverId:e.outboxAttachmentId,file:null,placement:null,contentId:e.contentId,contentType:e.contentType,contentUrl:e.contentUrl,filename:e.filename,sizeBytes:e.sizeBytes,state:e.state==="Stored"?qr:Pe(`"${e.filename}" did not finish uploading. Remove it and attach it again.`,!1)});class ji{constructor(t){this.deps=t}deps;entries=[];snapshot=[];listeners=new Set;generation=0;draftId;nextKey=0;reservationsInFlight=new Set;inFlight=new Map;mintedAfterRemoval=new Map;removing=new Map;removedListeners=new Set;loaded=!1;subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));getSnapshot=()=>this.snapshot;owns=t=>this.entries.some(n=>n.contentId===t);storedContent=t=>{const n=this.entries.find(r=>r.contentId===t&&r.contentUrl!==null);return n?.contentUrl?{filename:n.filename,contentType:n.contentType,contentUrl:n.contentUrl}:null};isLoaded=()=>this.loaded;refreshLinks=t=>{const n=new Map(t.map(r=>[r.outboxAttachmentId,r.contentUrl]));this.set(this.entries.map(r=>{const o=r.serverId===null?void 0:n.get(r.serverId);return o===void 0?r:{...r,contentUrl:o}}))};onRemoved=t=>(this.removedListeners.add(t),()=>this.removedListeners.delete(t));blockingReason=()=>{const[t]=this.removing.values();if(t!==void 0)return`Removing "${t}"…`;const n=this.entries.find(o=>o.state.status==="uploading");if(n)return`"${n.filename}" is still uploading.`;const r=this.entries.find(o=>o.state.status==="failed");if(r)return`"${r.filename}" is not attached. Try it again or remove it before sending.`};set(t){this.entries=t,this.snapshot=t.map(({key:n,filename:r,sizeBytes:o,state:a})=>({key:n,filename:r,sizeBytes:o,state:a}));for(const n of this.listeners)n()}patch(t,n,r){t===this.generation&&this.entries.some(o=>o.key===n)&&this.set(this.entries.map(o=>o.key===n?{...o,...r}:o))}reserve(t,n){let r=()=>{};const o=new Promise(a=>{r=()=>{this.reservationsInFlight.delete(o),a()}});return this.reservationsInFlight.add(o),{minted:this.deps.transport().mint(t,n),settle:r}}upload=async(t,n,r,o,a)=>{if(a.aborted)return;const i=this.deps.transport(),{minted:c,settle:u}=this.reserve(o,r),m=await c.catch(h=>(this.patch(t,n,{state:tn(r.name,h)}),null));if(m!==null&&a.aborted&&this.mintedAfterRemoval.set(n,m.outboxAttachmentId),m!==null&&!a.aborted&&this.patch(t,n,{serverId:m.outboxAttachmentId,filename:m.filename,contentId:m.contentId,contentType:m.contentType}),u(),m===null||a.aborted)return;const f=await i.put(m.uploadUrl,r,a).then(()=>null,h=>Se(h)??"the connection dropped");if(a.aborted)return;if(f!==null){this.patch(t,n,{state:Pe(`"${m.filename}" did not finish uploading: ${f}. Try again.`,!0)});return}const l=await i.complete(o,m.outboxAttachmentId).catch(h=>(this.patch(t,n,{state:tn(m.filename,h)}),null));l===null||a.aborted||(this.patch(t,n,{state:qr,contentUrl:l.contentUrl}),t===this.generation&&this.entries.find(h=>h.key===n)?.placement?.stored(r,m.contentId))};settleFailure(t,n,r){if(t!==this.generation)return;const o=this.entries.find(a=>a.key===n);o?.state.status==="failed"&&o.placement?.failed(r)}run=async(t,n,r,o,a)=>{await this.upload(t,n,r,o,a),this.inFlight.get(n)?.signal===a&&this.inFlight.delete(n),this.settleFailure(t,n,r)};syncKept=async t=>{for(;this.reservationsInFlight.size>0;)await Promise.all([...this.reservationsInFlight]);const n=this.draftId;return t!==this.generation||n===void 0?null:this.deps.transport().keep(n,this.entries.flatMap(r=>r.serverId===null?[]:[r.serverId])).then(()=>null,r=>r??new Error("the request failed"))};attach=async(t,n)=>{const r=this.generation,o=t.map(i=>{this.nextKey+=1;const c={key:`local-${this.nextKey}`,serverId:null,file:i,placement:n??null,contentId:null,contentType:i.type||"application/octet-stream",contentUrl:null,filename:i.name,sizeBytes:i.size,state:rr},u=new AbortController;return this.inFlight.set(c.key,u),{entry:c,file:i,signal:u.signal}});this.set([...this.entries,...o.map(({entry:i})=>i)]);const a=await this.deps.ensureDraft();if(a.outcome==="refused"){for(const{entry:i,file:c}of o)this.inFlight.delete(i.key),this.patch(r,i.key,{state:Pe(a.reason,!0)}),this.settleFailure(r,i.key,c);return}r===this.generation&&(this.draftId=a.outboxMessageId,await Promise.all(o.map(({entry:i,file:c,signal:u})=>this.run(r,i.key,c,a.outboxMessageId,u))))};retry=async t=>{const n=this.entries.find(c=>c.key===t);if(!n||n.file===null||this.inFlight.has(t))return;const r=n.file,o=this.generation,a=new AbortController;this.inFlight.set(t,a),this.patch(o,t,{state:rr,serverId:null});const i=await this.deps.ensureDraft();if(i.outcome==="refused"){this.inFlight.delete(t),this.patch(o,t,{state:Pe(i.reason,!0)});return}if(this.draftId=i.outboxMessageId,n.serverId!==null){const c=await this.syncKept(o);if(c!==null){this.inFlight.delete(t),this.patch(o,t,{serverId:n.serverId,state:tn(r.name,c)});return}}await this.run(o,t,r,i.outboxMessageId,a.signal)};remove=async t=>{const n=this.entries.find(c=>c.key===t);if(!n)return;const r=this.generation,o=this.inFlight.get(t);if(this.set(this.entries.filter(c=>c.key!==t)),o&&(this.inFlight.delete(t),o.abort()),n.serverId===null&&!o)return;this.removing.set(t,n.filename),this.set(this.entries);const a=await this.syncKept(r);this.removing.delete(t),this.set(this.entries);const i=n.serverId??this.mintedAfterRemoval.get(t)??null;if(this.mintedAfterRemoval.delete(t),r===this.generation){if(a===null){if(n.contentId===null)return;for(const c of this.removedListeners)c(n.contentId);return}i!==null&&this.set([...this.entries,{...n,serverId:i,file:null,state:Pe(`"${n.filename}" could not be removed: ${Se(a)??"the request failed"}. It is still on the draft — remove it again.`,!1)}])}};load=(t,n)=>{this.draftId=t,this.loaded=!0;const r=new Set(n.map(a=>a.outboxAttachmentId)),o=this.entries.filter(a=>a.file!==null&&(a.serverId===null||!r.has(a.serverId)));this.set([...n.map(Mi),...o])};reset=t=>{this.generation+=1;for(const n of this.inFlight.values())n.abort();this.inFlight.clear(),this.mintedAfterRemoval.clear(),this.removing.clear(),this.draftId=t,this.loaded=!1,this.set([])}}const Fi=(e,t,n)=>fetch(e,{method:"PUT",body:t,signal:n}).then(r=>{if(!r.ok)throw new Error(`the server answered ${r.status}`)}),$i=({ensureDraft:e})=>{const t=_e({...Vo(),meta:Me}),n=_e({...qo(),meta:Me}),r=_e({...xr(),meta:Me}),o=s.useRef(null);o.current={mint:(u,m)=>t.mutateAsync({path:{outboxMessageId:u},body:{filename:m.name,contentType:m.type||"application/octet-stream",sizeBytes:m.size}}),put:Fi,complete:(u,m)=>n.mutateAsync({path:{outboxMessageId:u,outboxAttachmentId:m}}).then(f=>({contentUrl:f.contentUrl})),keep:(u,m)=>r.mutateAsync({path:{outboxMessageId:u},body:{attachmentIds:m}}).then(()=>{})};const a=s.useRef(e);a.current=e;const[i]=s.useState(()=>new ji({transport:()=>{const u=o.current;if(!u)throw new Error("attachment transport not ready");return u},ensureDraft:()=>a.current()}));return{items:s.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot),attach:i.attach,retry:i.retry,remove:i.remove,load:i.load,reset:i.reset,owns:i.owns,isLoaded:i.isLoaded,refreshLinks:i.refreshLinks,storedContent:i.storedContent,onRemoved:i.onRemoved,blockingReason:i.blockingReason()}},Al=e=>e==="link-expired"||e==="not-ready";class vn extends Error{reason;status;constructor(t,n,r){super(n),this.name="AttachmentFetchError",this.reason=t,this.status=r}}const Bi="x-remit-403-reason",Ui="expired",Hi=(e,t)=>{if(t?.trim()===Ui)return"link-expired";const n=ia(e,t);return n==="auth"?"auth":n==="body-missing"?"missing":"generic"},Wi=300*1e3,zi=async(e,t)=>{const n={},r=await t();r&&(n.Authorization=`Bearer ${r}`);const o=await Ko(e,{headers:n,signal:AbortSignal.timeout(Wi)});if(o.status===202)throw new vn("not-ready","Attachment is still being fetched from the mail server",202);if(!o.ok)throw new vn(Hi(o.status,o.headers.get(Bi)),`Failed to download attachment (${o.status} ${o.statusText})`,o.status);return o.blob()},Vi=(e,t,n)=>{switch(e){case"auth":return{title:"Your session expired",detail:`Sign in again, then download ${t} once more. Other parts of the app may also stop responding until you do.`};case"link-expired":return{title:"This download link expired and could not be renewed",detail:`Reload the page, then download ${t} again. If that keeps failing, this is worth reporting.`};case"missing":return{title:"This attachment is missing from storage",detail:"Remit has the message but not the file. Re-sync the account from Settings, then try again."};case"not-ready":return{title:"Still fetching this attachment",detail:"Remit is downloading it from the mail server now. Try again in a few seconds."};default:return{title:"Couldn't download this attachment",detail:n}}},or=e=>e instanceof vn?e.reason:"generic",qi=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while downloading this attachment.",Dl=(e,t,n)=>{if(e!=="auth")return Sr(Rr({title:`Bug: attachment download failed (${e})`,errorMessage:`Downloading "${t}" failed: ${n}`}))},Nl=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.rel="noopener",document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)},Ki=e=>{const{getToken:t}=Yo(),n=s.useRef({...e,getToken:t});return n.current={...e,getToken:t},s.useMemo(()=>{const r=c=>{const u=n.current;return u.isLoaded()?null:u.draftAttachments.find(m=>m.contentId===c)??null},o=c=>n.current.storedContent(c)??r(c),a=c=>zi(c.contentUrl,n.current.getToken).then(u=>URL.createObjectURL(new Blob([u],{type:c.contentType}))),i=c=>n.current.refreshLinks().then(()=>{const u=o(c);if(!u)throw new Error("the file is no longer on this draft");return a(u)});return{attach:(c,u)=>{n.current.attach(c,u)},owns:c=>n.current.owns(c)||r(c)!==null,onRemoved:c=>n.current.onRemoved(c),resolve:c=>{const u=o(c);return u?a(u).catch(m=>{if(or(m)!=="link-expired")throw m;return i(c)}).catch(m=>{const f=or(m);return n.current.pushError({...Vi(f,u.filename,qi(m)),error:f==="generic"?m:void 0}),null}):Promise.resolve(null)}}},[])},Yi=(e,t)=>e===void 0&&t.toAddresses.length===0,Gi={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},ar={status:"idle"},Xi={status:"saving"},sr={status:"saved"},ir={status:"error"},Qi=e=>e.then(()=>{},()=>{}),Zi=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(ar),[o,a]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),u=Cr(),m=s.useRef(e),f=s.useRef(e);if(m.current!==e){const y=m.current!==void 0;m.current=e,f.current=e,y&&i.current&&clearTimeout(i.current)}const l=_e({...Go(),meta:Me}),h=_e({...xr(),meta:Me}),g=s.useCallback(async y=>{r(Xi),a(null);const v=f.current;if(v){const _=await h.mutateAsync({path:{outboxMessageId:v},body:{toAddresses:y.toAddresses,ccAddresses:y.ccAddresses,bccAddresses:y.bccAddresses,subject:y.subject,textBody:y.textBody,htmlBody:y.htmlBody,inReplyTo:y.inReplyTo,references:y.references}});return r(sr),_}const D=await l.mutateAsync({body:{...y,sendImmediately:!1}});return f.current=D.outboxMessageId,t(D.outboxMessageId),r(sr),u.invalidateQueries({queryKey:Xo().queryKey}),D},[l.mutateAsync,h.mutateAsync,t,u]),x=s.useRef(Promise.resolve()),p=s.useCallback(y=>{const v=x.current.then(()=>g(y));return x.current=Qi(v),v},[g]),E=s.useCallback(y=>{if(i.current&&clearTimeout(i.current),Yi(f.current,y)){r(Gi);return}r(v=>v.status==="unsaved"?ar:v),i.current=setTimeout(()=>{const v=f.current;v&&c.current.has(v)||p(y).catch(D=>{a(D),r(ir)})},2e3)},[p]),w=s.useCallback(y=>(i.current&&clearTimeout(i.current),p(y).then(v=>({outcome:"saved",outboxMessageId:v.outboxMessageId})).catch(v=>(r(ir),{outcome:"failed",error:v}))),[p]),A=s.useCallback(y=>{i.current&&clearTimeout(i.current),y&&c.current.add(y)},[]);return{saveState:n,saveError:o,saveDraft:E,saveImmediately:w,stopAutoSave:A}},Ji=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,ec=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:Ji(e),nn=({label:e,addresses:t,onChange:n,placeholder:r,onPendingChange:o,ref:a})=>{const[i,c]=s.useState(""),u=ha(i,200),{data:m}=At({...Qo({query:{q:u,limit:8}}),enabled:u.length>=2}),f=s.useMemo(()=>(m?.items??[]).filter(ec).map(l=>({email:l.normalizedEmail,displayName:l.displayName})),[m]);return d.jsx(_a,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:f,onQueryChange:c,onPendingChange:o,ref:a})},tc=({accountId:e,configureRef:t})=>{const n=ga();return d.jsx(qa,{configureRef:t,onConfigure:()=>{n(e)}})},nc={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},rc=e=>{const t=`Spellcheck for ${e.language} is off: ${nc[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Sr(Rr({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},oc=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await Tr(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-uKovGi4E.js");return{openSpellcheckWorker:r}},__vite__mapDeps([0,1,2,3,4]));return n(t)},onStatus:t=>{t.state==="failed"&&e(rc(t))}}),ac=e=>{if(Zo(e)?.code==="mail_sync_off")return Se(e)},Kr=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Dt=e=>e.split(`
43
+ `)},Oi=0,We=[];function ki(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),o=s.useState(Oi++)[0],a=s.useState(Ur)[0],i=s.useRef(e);s.useEffect(function(){i.current=e},[e]),s.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=Wo([e.lockRef.current],(e.shards||[]).map(nr),!0).filter(Boolean);return p.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(p,E){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var w=bt(p),A=n.current,y="deltaX"in p?p.deltaX:A[0]-w[0],v="deltaY"in p?p.deltaY:A[1]-w[1],D,_=p.target,S=Math.abs(y)>Math.abs(v)?"h":"v";if("touches"in p&&S==="h"&&_.type==="range")return!1;var k=window.getSelection(),N=k&&k.anchorNode,F=N?N===_||N.contains(_):!1;if(F)return!1;var b=er(S,_);if(!b)return!0;if(b?D=S:(D=S==="v"?"h":"v",b=er(S,_)),!b)return!1;if(!r.current&&"changedTouches"in p&&(y||v)&&(r.current=D),!D)return!0;var P=r.current||D;return Ai(P,E,p,P==="h"?y:v)},[]),u=s.useCallback(function(p){var E=p;if(!(!We.length||We[We.length-1]!==a)){var w="deltaY"in E?tr(E):bt(E),A=t.current.filter(function(D){return D.name===E.type&&(D.target===E.target||E.target===D.shadowParent)&&Di(D.delta,w)})[0];if(A&&A.should){E.cancelable&&E.preventDefault();return}if(!A){var y=(i.current.shards||[]).map(nr).filter(Boolean).filter(function(D){return D.contains(E.target)}),v=y.length>0?c(E,y[0]):!i.current.noIsolation;v&&E.cancelable&&E.preventDefault()}}},[]),m=s.useCallback(function(p,E,w,A){var y={name:p,delta:E,target:w,should:A,shadowParent:Ii(w)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(v){return v!==y})},1)},[]),f=s.useCallback(function(p){n.current=bt(p),r.current=void 0},[]),l=s.useCallback(function(p){m(p.type,tr(p),p.target,c(p,e.lockRef.current))},[]),h=s.useCallback(function(p){m(p.type,bt(p),p.target,c(p,e.lockRef.current))},[]);s.useEffect(function(){return We.push(a),e.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:h}),document.addEventListener("wheel",u,He),document.addEventListener("touchmove",u,He),document.addEventListener("touchstart",f,He),function(){We=We.filter(function(p){return p!==a}),document.removeEventListener("wheel",u,He),document.removeEventListener("touchmove",u,He),document.removeEventListener("touchstart",f,He)}},[]);var g=e.removeScrollBar,x=e.inert;return s.createElement(s.Fragment,null,x?s.createElement(a,{styles:Ni(o)}):null,g?s.createElement(bi,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ii(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Li=ii(Br,ki);var Vr=s.forwardRef(function(e,t){return s.createElement(kt,xe({},e,{ref:t,sideCar:Li}))});Vr.classNames=kt.classNames;const Tl=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=s.useCallback(o=>{const a=o.target;if(!(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable))for(const i of t){if(!(o.key.toLowerCase()===i.key.toLowerCase())||i.action&&zo(i.action)||i.requireShift!==void 0&&i.requireShift!==o.shiftKey)continue;const u=o.ctrlKey||o.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==u)continue}else{const m=i.noModifiers??!0,f=u||o.altKey||i.requireShift===void 0&&o.shiftKey;if(m&&f)continue}i.preventDefault&&o.preventDefault(),i.stopPropagation&&(o.stopPropagation(),o.stopImmediatePropagation()),i.handler(o);return}},[t]);s.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},Pi=e=>typeof e=="object"&&e!==null&&"code"in e&&e.code==="attachment_rejected"&&"message"in e&&typeof e.message=="string",_i=new Set(["EmptyFile","UnusableFilename","FileTooLarge","TooManyAttachments"]),rr={status:"uploading"},qr={status:"attached"},Pe=(e,t)=>({status:"failed",reason:e,retryable:t}),tn=(e,t)=>Pi(t)?Pe(t.message,!_i.has(t.reason)):Pe(`"${e}" could not be attached: ${Se(t)??"the request failed"}. Try again.`,!0),Mi=e=>({key:e.outboxAttachmentId,serverId:e.outboxAttachmentId,file:null,placement:null,contentId:e.contentId,contentType:e.contentType,contentUrl:e.contentUrl,filename:e.filename,sizeBytes:e.sizeBytes,state:e.state==="Stored"?qr:Pe(`"${e.filename}" did not finish uploading. Remove it and attach it again.`,!1)});class ji{constructor(t){this.deps=t}deps;entries=[];snapshot=[];listeners=new Set;generation=0;draftId;nextKey=0;reservationsInFlight=new Set;inFlight=new Map;mintedAfterRemoval=new Map;removing=new Map;removedListeners=new Set;loaded=!1;subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));getSnapshot=()=>this.snapshot;owns=t=>this.entries.some(n=>n.contentId===t);storedContent=t=>{const n=this.entries.find(r=>r.contentId===t&&r.contentUrl!==null);return n?.contentUrl?{filename:n.filename,contentType:n.contentType,contentUrl:n.contentUrl}:null};isLoaded=()=>this.loaded;refreshLinks=t=>{const n=new Map(t.map(r=>[r.outboxAttachmentId,r.contentUrl]));this.set(this.entries.map(r=>{const o=r.serverId===null?void 0:n.get(r.serverId);return o===void 0?r:{...r,contentUrl:o}}))};onRemoved=t=>(this.removedListeners.add(t),()=>this.removedListeners.delete(t));blockingReason=()=>{const[t]=this.removing.values();if(t!==void 0)return`Removing "${t}"…`;const n=this.entries.find(o=>o.state.status==="uploading");if(n)return`"${n.filename}" is still uploading.`;const r=this.entries.find(o=>o.state.status==="failed");if(r)return`"${r.filename}" is not attached. Try it again or remove it before sending.`};set(t){this.entries=t,this.snapshot=t.map(({key:n,filename:r,sizeBytes:o,state:a})=>({key:n,filename:r,sizeBytes:o,state:a}));for(const n of this.listeners)n()}patch(t,n,r){t===this.generation&&this.entries.some(o=>o.key===n)&&this.set(this.entries.map(o=>o.key===n?{...o,...r}:o))}reserve(t,n){let r=()=>{};const o=new Promise(a=>{r=()=>{this.reservationsInFlight.delete(o),a()}});return this.reservationsInFlight.add(o),{minted:this.deps.transport().mint(t,n),settle:r}}upload=async(t,n,r,o,a)=>{if(a.aborted)return;const i=this.deps.transport(),{minted:c,settle:u}=this.reserve(o,r),m=await c.catch(h=>(this.patch(t,n,{state:tn(r.name,h)}),null));if(m!==null&&a.aborted&&this.mintedAfterRemoval.set(n,m.outboxAttachmentId),m!==null&&!a.aborted&&this.patch(t,n,{serverId:m.outboxAttachmentId,filename:m.filename,contentId:m.contentId,contentType:m.contentType}),u(),m===null||a.aborted)return;const f=await i.put(m.uploadUrl,r,a).then(()=>null,h=>Se(h)??"the connection dropped");if(a.aborted)return;if(f!==null){this.patch(t,n,{state:Pe(`"${m.filename}" did not finish uploading: ${f}. Try again.`,!0)});return}const l=await i.complete(o,m.outboxAttachmentId).catch(h=>(this.patch(t,n,{state:tn(m.filename,h)}),null));l===null||a.aborted||(this.patch(t,n,{state:qr,contentUrl:l.contentUrl}),t===this.generation&&this.entries.find(h=>h.key===n)?.placement?.stored(r,m.contentId))};settleFailure(t,n,r){if(t!==this.generation)return;const o=this.entries.find(a=>a.key===n);o?.state.status==="failed"&&o.placement?.failed(r)}run=async(t,n,r,o,a)=>{await this.upload(t,n,r,o,a),this.inFlight.get(n)?.signal===a&&this.inFlight.delete(n),this.settleFailure(t,n,r)};syncKept=async t=>{for(;this.reservationsInFlight.size>0;)await Promise.all([...this.reservationsInFlight]);const n=this.draftId;return t!==this.generation||n===void 0?null:this.deps.transport().keep(n,this.entries.flatMap(r=>r.serverId===null?[]:[r.serverId])).then(()=>null,r=>r??new Error("the request failed"))};attach=async(t,n)=>{const r=this.generation,o=t.map(i=>{this.nextKey+=1;const c={key:`local-${this.nextKey}`,serverId:null,file:i,placement:n??null,contentId:null,contentType:i.type||"application/octet-stream",contentUrl:null,filename:i.name,sizeBytes:i.size,state:rr},u=new AbortController;return this.inFlight.set(c.key,u),{entry:c,file:i,signal:u.signal}});this.set([...this.entries,...o.map(({entry:i})=>i)]);const a=await this.deps.ensureDraft();if(a.outcome==="refused"){for(const{entry:i,file:c}of o)this.inFlight.delete(i.key),this.patch(r,i.key,{state:Pe(a.reason,!0)}),this.settleFailure(r,i.key,c);return}r===this.generation&&(this.draftId=a.outboxMessageId,await Promise.all(o.map(({entry:i,file:c,signal:u})=>this.run(r,i.key,c,a.outboxMessageId,u))))};retry=async t=>{const n=this.entries.find(c=>c.key===t);if(!n||n.file===null||this.inFlight.has(t))return;const r=n.file,o=this.generation,a=new AbortController;this.inFlight.set(t,a),this.patch(o,t,{state:rr,serverId:null});const i=await this.deps.ensureDraft();if(i.outcome==="refused"){this.inFlight.delete(t),this.patch(o,t,{state:Pe(i.reason,!0)});return}if(this.draftId=i.outboxMessageId,n.serverId!==null){const c=await this.syncKept(o);if(c!==null){this.inFlight.delete(t),this.patch(o,t,{serverId:n.serverId,state:tn(r.name,c)});return}}await this.run(o,t,r,i.outboxMessageId,a.signal)};remove=async t=>{const n=this.entries.find(c=>c.key===t);if(!n)return;const r=this.generation,o=this.inFlight.get(t);if(this.set(this.entries.filter(c=>c.key!==t)),o&&(this.inFlight.delete(t),o.abort()),n.serverId===null&&!o)return;this.removing.set(t,n.filename),this.set(this.entries);const a=await this.syncKept(r);this.removing.delete(t),this.set(this.entries);const i=n.serverId??this.mintedAfterRemoval.get(t)??null;if(this.mintedAfterRemoval.delete(t),r===this.generation){if(a===null){if(n.contentId===null)return;for(const c of this.removedListeners)c(n.contentId);return}i!==null&&this.set([...this.entries,{...n,serverId:i,file:null,state:Pe(`"${n.filename}" could not be removed: ${Se(a)??"the request failed"}. It is still on the draft — remove it again.`,!1)}])}};load=(t,n)=>{this.draftId=t,this.loaded=!0;const r=new Set(n.map(a=>a.outboxAttachmentId)),o=this.entries.filter(a=>a.file!==null&&(a.serverId===null||!r.has(a.serverId)));this.set([...n.map(Mi),...o])};reset=t=>{this.generation+=1;for(const n of this.inFlight.values())n.abort();this.inFlight.clear(),this.mintedAfterRemoval.clear(),this.removing.clear(),this.draftId=t,this.loaded=!1,this.set([])}}const Fi=(e,t,n)=>fetch(e,{method:"PUT",body:t,signal:n}).then(r=>{if(!r.ok)throw new Error(`the server answered ${r.status}`)}),$i=({ensureDraft:e})=>{const t=_e({...Vo(),meta:Me}),n=_e({...qo(),meta:Me}),r=_e({...xr(),meta:Me}),o=s.useRef(null);o.current={mint:(u,m)=>t.mutateAsync({path:{outboxMessageId:u},body:{filename:m.name,contentType:m.type||"application/octet-stream",sizeBytes:m.size}}),put:Fi,complete:(u,m)=>n.mutateAsync({path:{outboxMessageId:u,outboxAttachmentId:m}}).then(f=>({contentUrl:f.contentUrl})),keep:(u,m)=>r.mutateAsync({path:{outboxMessageId:u},body:{attachmentIds:m}}).then(()=>{})};const a=s.useRef(e);a.current=e;const[i]=s.useState(()=>new ji({transport:()=>{const u=o.current;if(!u)throw new Error("attachment transport not ready");return u},ensureDraft:()=>a.current()}));return{items:s.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot),attach:i.attach,retry:i.retry,remove:i.remove,load:i.load,reset:i.reset,owns:i.owns,isLoaded:i.isLoaded,refreshLinks:i.refreshLinks,storedContent:i.storedContent,onRemoved:i.onRemoved,blockingReason:i.blockingReason()}},Al=e=>e==="link-expired"||e==="not-ready";class vn extends Error{reason;status;constructor(t,n,r){super(n),this.name="AttachmentFetchError",this.reason=t,this.status=r}}const Bi="x-remit-403-reason",Ui="expired",Hi=(e,t)=>{if(t?.trim()===Ui)return"link-expired";const n=ia(e,t);return n==="auth"?"auth":n==="body-missing"?"missing":"generic"},Wi=300*1e3,zi=async(e,t)=>{const n={},r=await t();r&&(n.Authorization=`Bearer ${r}`);const o=await Ko(e,{headers:n,signal:AbortSignal.timeout(Wi)});if(o.status===202)throw new vn("not-ready","Attachment is still being fetched from the mail server",202);if(!o.ok)throw new vn(Hi(o.status,o.headers.get(Bi)),`Failed to download attachment (${o.status} ${o.statusText})`,o.status);return o.blob()},Vi=(e,t,n)=>{switch(e){case"auth":return{title:"Your session expired",detail:`Sign in again, then download ${t} once more. Other parts of the app may also stop responding until you do.`};case"link-expired":return{title:"This download link expired and could not be renewed",detail:`Reload the page, then download ${t} again. If that keeps failing, this is worth reporting.`};case"missing":return{title:"This attachment is missing from storage",detail:"Remit has the message but not the file. Re-sync the account from Settings, then try again."};case"not-ready":return{title:"Still fetching this attachment",detail:"Remit is downloading it from the mail server now. Try again in a few seconds."};default:return{title:"Couldn't download this attachment",detail:n}}},or=e=>e instanceof vn?e.reason:"generic",qi=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while downloading this attachment.",Dl=(e,t,n)=>{if(e!=="auth")return Sr(Rr({title:`Bug: attachment download failed (${e})`,errorMessage:`Downloading "${t}" failed: ${n}`}))},Nl=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.rel="noopener",document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)},Ki=e=>{const{getToken:t}=Yo(),n=s.useRef({...e,getToken:t});return n.current={...e,getToken:t},s.useMemo(()=>{const r=c=>{const u=n.current;return u.isLoaded()?null:u.draftAttachments.find(m=>m.contentId===c)??null},o=c=>n.current.storedContent(c)??r(c),a=c=>zi(c.contentUrl,n.current.getToken).then(u=>URL.createObjectURL(new Blob([u],{type:c.contentType}))),i=c=>n.current.refreshLinks().then(()=>{const u=o(c);if(!u)throw new Error("the file is no longer on this draft");return a(u)});return{attach:(c,u)=>{n.current.attach(c,u)},owns:c=>n.current.owns(c)||r(c)!==null,onRemoved:c=>n.current.onRemoved(c),resolve:c=>{const u=o(c);return u?a(u).catch(m=>{if(or(m)!=="link-expired")throw m;return i(c)}).catch(m=>{const f=or(m);return n.current.pushError({...Vi(f,u.filename,qi(m)),error:f==="generic"?m:void 0}),null}):Promise.resolve(null)}}},[])},Yi=(e,t)=>e===void 0&&t.toAddresses.length===0,Gi={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},ar={status:"idle"},Xi={status:"saving"},sr={status:"saved"},ir={status:"error"},Qi=e=>e.then(()=>{},()=>{}),Zi=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(ar),[o,a]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),u=Cr(),m=s.useRef(e),f=s.useRef(e);if(m.current!==e){const y=m.current!==void 0;m.current=e,f.current=e,y&&i.current&&clearTimeout(i.current)}const l=_e({...Go(),meta:Me}),h=_e({...xr(),meta:Me}),g=s.useCallback(async y=>{r(Xi),a(null);const v=f.current;if(v){const _=await h.mutateAsync({path:{outboxMessageId:v},body:{toAddresses:y.toAddresses,ccAddresses:y.ccAddresses,bccAddresses:y.bccAddresses,subject:y.subject,textBody:y.textBody,htmlBody:y.htmlBody,inReplyTo:y.inReplyTo,references:y.references}});return r(sr),_}const D=await l.mutateAsync({body:{...y,sendImmediately:!1}});return f.current=D.outboxMessageId,t(D.outboxMessageId),r(sr),u.invalidateQueries({queryKey:Xo().queryKey}),D},[l.mutateAsync,h.mutateAsync,t,u]),x=s.useRef(Promise.resolve()),p=s.useCallback(y=>{const v=x.current.then(()=>g(y));return x.current=Qi(v),v},[g]),E=s.useCallback(y=>{if(i.current&&clearTimeout(i.current),Yi(f.current,y)){r(Gi);return}r(v=>v.status==="unsaved"?ar:v),i.current=setTimeout(()=>{const v=f.current;v&&c.current.has(v)||p(y).catch(D=>{a(D),r(ir)})},2e3)},[p]),w=s.useCallback(y=>(i.current&&clearTimeout(i.current),p(y).then(v=>({outcome:"saved",outboxMessageId:v.outboxMessageId})).catch(v=>(r(ir),{outcome:"failed",error:v}))),[p]),A=s.useCallback(y=>{i.current&&clearTimeout(i.current),y&&c.current.add(y)},[]);return{saveState:n,saveError:o,saveDraft:E,saveImmediately:w,stopAutoSave:A}},Ji=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,ec=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:Ji(e),nn=({label:e,addresses:t,onChange:n,placeholder:r,onPendingChange:o,ref:a})=>{const[i,c]=s.useState(""),u=ha(i,200),{data:m}=At({...Qo({query:{q:u,limit:8}}),enabled:u.length>=2}),f=s.useMemo(()=>(m?.items??[]).filter(ec).map(l=>({email:l.normalizedEmail,displayName:l.displayName})),[m]);return d.jsx(_a,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:f,onQueryChange:c,onPendingChange:o,ref:a})},tc=({accountId:e,configureRef:t})=>{const n=ga();return d.jsx(qa,{configureRef:t,onConfigure:()=>{n(e)}})},nc={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},rc=e=>{const t=`Spellcheck for ${e.language} is off: ${nc[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Sr(Rr({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},oc=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await Tr(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-Bnm0BFqL.js");return{openSpellcheckWorker:r}},__vite__mapDeps([0,1,2,3,4]));return n(t)},onStatus:t=>{t.state==="failed"&&e(rc(t))}}),ac=e=>{if(Zo(e)?.code==="mail_sync_off")return Se(e)},Kr=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Dt=e=>e.split(`
44
44
  `).map(t=>`<p>${Kr(t)}</p>`).join(""),sc=new Set(["ADDRESS","ARTICLE","BLOCKQUOTE","BR","DIV","H1","H2","H3","H4","H5","H6","HR","LI","OL","P","PRE","SECTION","TABLE","TR","UL"]),ic=e=>{const t=new DOMParser().parseFromString(e,"text/html"),n=[];let r="";const o=()=>{n.push(r.trim()),r=""},a=i=>{if(i.nodeType===i.TEXT_NODE){r+=(i.textContent??"").replace(/\s+/g," ");return}if(i.nodeType!==i.ELEMENT_NODE)return;const c=sc.has(i.tagName);c&&r!==""&&o();for(const u of i.childNodes)a(u);c&&o()};return a(t.body),r!==""&&o(),n.join(`
45
45
  `).replace(/\n{3,}/g,`
46
46
 
@@ -50,7 +50,7 @@ import{b as vr,j as d,X as gr,p as ln,B as un,L as yr,v as Fo,T as $o,r as s,t a
50
50
  `))}${o}`}}const a=lc(t);return{text:[a,...fc(r)].join(`
51
51
  `),html:`<p>${Kr(a)}</p><blockquote type="cite">${o}</blockquote>`}},hc=(e,t)=>e===""?t:`${e}
52
52
 
53
- ${t}`,rn=(e,t,n,r)=>{const o=r?hc(t.text,r.text):t.text;if(e==="plain")return{textBody:o||void 0,htmlBody:""};const a=r?`${t.html}${r.html}`:t.html;return{textBody:o||void 0,htmlBody:a?la(a,n):void 0}},cr=150,pc=()=>{const[e,t]=s.useState(()=>{if(typeof window>"u"||!window.visualViewport)return{viewportHeight:0,isKeyboardOpen:!1};const n=window.visualViewport.height;return{viewportHeight:n,isKeyboardOpen:window.innerHeight-n>cr}});return s.useEffect(()=>{if(typeof window>"u"||!window.visualViewport)return;const n=window.visualViewport,r=()=>{const o=n.height;t({viewportHeight:o,isKeyboardOpen:window.innerHeight-o>cr})};return r(),n.addEventListener("resize",r),()=>n.removeEventListener("resize",r)},[]),e},vc=({selectedAccountId:e,onSelect:t})=>{const{data:n}=At({...Ar(),staleTime:1/0}),r=n?.accounts??[];if(s.useEffect(()=>{!e&&r.length===1&&r[0]&&t(r[0])},[e,r,t]),r.length<=1){const a=r[0];return a?d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),d.jsx("div",{className:"text-sm py-1.5",children:a.email})]}):null}const o=r.some(a=>a.accountId===e);return d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{htmlFor:"from-account-selector",className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),d.jsxs("select",{id:"from-account-selector",value:o?e:"",onChange:a=>{const i=r.find(c=>c.accountId===a.target.value);i&&t(i)},className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",children:[!o&&d.jsx("option",{value:"",disabled:!0,children:"Choose an account"}),r.map(a=>d.jsx("option",{value:a.accountId,children:a.email},a.accountId))]})]})},gc=s.lazy(()=>Tr(()=>import("./rich-text-Fi0gjjkk.js"),__vite__mapDeps([5,2,3,1,6,7,8,9,10,11,4,12,13,14,15,16,17,18])).then(e=>({default:e.ComposeBody}))),lr=e=>e?`<p></p><p>-- </p>${Dt(e)}`:"",Et=(e,t)=>t?{html:`${Dt(t.body)}${lr(e)}`,text:[t.body,e].filter(Boolean).join(`
53
+ ${t}`,rn=(e,t,n,r)=>{const o=r?hc(t.text,r.text):t.text;if(e==="plain")return{textBody:o||void 0,htmlBody:""};const a=r?`${t.html}${r.html}`:t.html;return{textBody:o||void 0,htmlBody:a?la(a,n):void 0}},cr=150,pc=()=>{const[e,t]=s.useState(()=>{if(typeof window>"u"||!window.visualViewport)return{viewportHeight:0,isKeyboardOpen:!1};const n=window.visualViewport.height;return{viewportHeight:n,isKeyboardOpen:window.innerHeight-n>cr}});return s.useEffect(()=>{if(typeof window>"u"||!window.visualViewport)return;const n=window.visualViewport,r=()=>{const o=n.height;t({viewportHeight:o,isKeyboardOpen:window.innerHeight-o>cr})};return r(),n.addEventListener("resize",r),()=>n.removeEventListener("resize",r)},[]),e},vc=({selectedAccountId:e,onSelect:t})=>{const{data:n}=At({...Ar(),staleTime:1/0}),r=n?.accounts??[];if(s.useEffect(()=>{!e&&r.length===1&&r[0]&&t(r[0])},[e,r,t]),r.length<=1){const a=r[0];return a?d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),d.jsx("div",{className:"text-sm py-1.5",children:a.email})]}):null}const o=r.some(a=>a.accountId===e);return d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{htmlFor:"from-account-selector",className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),d.jsxs("select",{id:"from-account-selector",value:o?e:"",onChange:a=>{const i=r.find(c=>c.accountId===a.target.value);i&&t(i)},className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",children:[!o&&d.jsx("option",{value:"",disabled:!0,children:"Choose an account"}),r.map(a=>d.jsx("option",{value:a.accountId,children:a.email},a.accountId))]})]})},gc=s.lazy(()=>Tr(()=>import("./rich-text-Bd-wRHu1.js"),__vite__mapDeps([5,2,3,1,6,7,8,9,10,11,4,12,13,14,15,16,17,18])).then(e=>({default:e.ComposeBody}))),lr=e=>e?`<p></p><p>-- </p>${Dt(e)}`:"",Et=(e,t)=>t?{html:`${Dt(t.body)}${lr(e)}`,text:[t.body,e].filter(Boolean).join(`
54
54
 
55
55
  `)}:{html:lr(e),text:e},yc=e=>e?/^re:\s/i.test(e)?e:`Re: ${e}`:"Re: ",wc=e=>e?/^fwd?:\s/i.test(e)?e:`Fwd: ${e}`:"Fwd: ",bc=(e,t,n)=>{const{envelope:r}=e,a=(r.replyTo.length>0?r.replyTo:r.from).map(m=>({email:m.normalizedEmail,displayName:m.displayName}));if(t!=="reply-all")return{to:a,cc:[]};const i=n?.toLowerCase(),c=new Set(a.map(m=>m.email.toLowerCase())),u=[...r.to,...r.cc].filter(m=>m.normalizedEmail.toLowerCase()!==i&&!c.has(m.normalizedEmail.toLowerCase())).map(m=>({email:m.normalizedEmail,displayName:m.displayName}));return{to:a,cc:u}},ur=e=>{const t=e.envelope.messageIdValue,n=a=>e.references.filter(i=>i.referenceType===a).sort((i,c)=>i.referenceOrder-c.referenceOrder).map(i=>i.messageIdValue),r=n("references"),o=r.length>0?[...r]:n("in_reply_to");return t&&!o.includes(t)&&o.push(t),{inReplyTo:t,references:o}},Ec="Add a To address before sending.",xc="Loading the message you're quoting.",Sc="The message you're quoting couldn't be loaded, so it won't be included.",Rc="Add a To address before attaching a file — the draft the file is kept with is saved against it.",Cc=({label:e,text:t})=>`${e} holds "${t}", which is not an address.`,dr=e=>e.find(t=>t.text.trim()!==""),Tc={entries:[],unparsed:""},Ac=(e,t,n,r,o)=>e.length===0&&t.length===0&&n.length===0&&r.trim()===""&&o.text.trim()==="",Dc=({documentGeneration:e,selectedAccountId:t,onAccountChange:n,toAddresses:r,setToAddresses:o,ccAddresses:a,setCcAddresses:i,bccAddresses:c,setBccAddresses:u,showCc:m,setShowCc:f,showBcc:l,setShowBcc:h,subject:g,setSubject:x,fieldHandles:p,onToPendingChange:E})=>{const w=ya(),{isKeyboardOpen:A}=pc(),[y,v]=s.useState(void 0),D=y===e,[_,S]=s.useState(!1);return d.jsx("div",{className:"contents",onFocusCapture:()=>S(!0),onBlurCapture:k=>{k.currentTarget.contains(k.relatedTarget)||S(!1)},children:d.jsx(Ha,{collapsed:!w&&A&&!D&&!_,onExpand:()=>v(e),summary:Ua({to:r,cc:a,bcc:c,subject:g}),from:d.jsx(vc,{selectedAccountId:t,onSelect:n}),to:d.jsx(nn,{label:"To",addresses:r,onChange:o,placeholder:"Recipients",onPendingChange:E,ref:p.to}),cc:m?d.jsx(nn,{label:"Cc",addresses:a,onChange:i,ref:p.cc}):void 0,bcc:l?d.jsx(nn,{label:"Bcc",addresses:c,onChange:u,ref:p.bcc}):void 0,subject:d.jsx(Ka,{value:g,onChange:x}),onShowCc:()=>f(!0),onShowBcc:()=>h(!0)})})},Ol=({mode:e,account:t,sourceMessage:n,outboxMessageId:r,seed:o,insertion:a,onDraftCreated:i,onClose:c,onAccountChange:u,layout:m="fill"})=>{const{startSendPolling:f}=ea(),{pushError:l}=ta(),[h,g]=s.useState([]),[x,p]=s.useState([]),[E,w]=s.useState([]),[A,y]=s.useState(Tc),v=s.useRef(null),D=s.useRef(null),_=s.useRef(null),S=s.useMemo(()=>({to:v,cc:D,bcc:_}),[]),k=s.useCallback(()=>{v.current?.clearPending(),D.current?.clearPending(),_.current?.clearPending()},[]),[N,F]=s.useState(""),[b,P]=s.useState(!1),[C,q]=s.useState(!1),[$,Q]=s.useState(t?.accountId),[z,ee]=s.useState(!1),[ne,ye]=s.useState(r),Fe=s.useRef(void 0),Ce=s.useRef(!1),de=s.useRef(null),Te=s.useRef(r),Ae=s.useRef(r!==void 0),[De,Ne]=s.useState(r!==void 0),fe=s.useRef(r!==void 0?e:void 0),Oe=s.useRef(void 0),$e=s.useRef(e);$e.current=e;const me=s.useRef(t?.accountId);s.useEffect(()=>{const T=t?.accountId;!T||me.current===T||(me.current=T,!Ae.current&&Q(T))},[t?.accountId]),s.useEffect(()=>{const T=Te.current;if(T===r||(Te.current=r,T===void 0))return;Ae.current=r!==void 0,Ne(r!==void 0),fe.current=r!==void 0?$e.current:void 0,Oe.current=void 0;const U=r?{html:"",text:""}:Et(qe.current,I.current);g([]),p([]),w([]),k(),F(""),P(!1),q(!1),at(U.html),he(U.text),Xe("rich"),it(void 0),be({...U,formatting:[]}),Ye(Z=>Z+1),ee(!1),Fe.current=void 0,Ce.current=!1,ye(r)},[r,k]);const{signature:we}=ua($),qe=s.useRef(we.plainText);qe.current=we.plainText;const I=s.useRef(o);I.current=o;const[Ke,Ye]=s.useState(0),[Ge,at]=s.useState(()=>Et(we.plainText,o).html),[Lt,he]=s.useState(()=>Et(we.plainText,o).text),[ce,Xe]=s.useState("rich"),[re,Pt]=s.useState("en"),[st,it]=s.useState(),[pe,be]=s.useState(()=>({...Et(we.plainText,o),formatting:[]})),[_t,ct]=s.useState(()=>a?.version??0),Mt=a&&a.version>_t&&(r===void 0||z)?a:void 0,{data:j,error:Qe}=At({..._n({path:{outboxMessageId:r??""}}),enabled:!!r&&!z,meta:aa,retry:(T,U)=>!Mn(U)&&T<1});s.useEffect(()=>{Mn(Qe)&&c()},[Qe,c]),s.useEffect(()=>{if(!j||z)return;g(j.toAddresses.map(K=>({email:K,displayName:void 0}))),j.ccAddresses&&j.ccAddresses.length>0&&(p(j.ccAddresses.map(K=>({email:K,displayName:void 0}))),P(!0)),j.bccAddresses&&j.bccAddresses.length>0&&(w(j.bccAddresses.map(K=>({email:K,displayName:void 0}))),q(!0)),j.subject&&F(j.subject);const T=da(j.htmlBody??""),U=T.html,Z=j.textBody??"";Xe(as(j.htmlBody)),it(T.language??void 0),at(U),he(Z),be({html:U,text:Z,formatting:[]}),Ye(K=>K+1),Q(j.accountId),ee(!0),Ce.current=!0},[j,z]),s.useEffect(()=>{if(n){if(Ae.current&&fe.current===e){const T=Oe.current;if(!T||T.myEmail===t?.email)return}if(fe.current=e,Oe.current={myEmail:t?.email},k(),e==="reply"||e==="reply-all"){const{to:T,cc:U}=bc(n,e,t?.email);g(T),p(U),U.length>0&&P(!0),F(yc(n.envelope.subject))}e==="forward"&&(g([]),p([]),w([]),F(wc(n.envelope.subject)))}},[e,n,t?.email,k]);const ke=e==="reply"||e==="reply-all"||e==="forward",{data:Ie,isLoading:lt,isError:jt,hasNoRenderablePart:Ft,refetch:O}=ca({messageId:n?.message.messageId,bodyParts:n?.bodyParts,enabled:ke&&!!n}),M=e==="forward"?"forward":"reply",B=ke&&!n,L=ke&&!De&&Ft,H=L&&M==="forward",W=s.useMemo(()=>{if(!ke||!n||De||!Ie)return;const T=Ie.kind==="html"?{kind:"html",content:os(Ie.body)}:{kind:"text",content:Ie.body};return mc(e==="forward"?"forward":"reply",n.envelope,T)},[ke,n,De,Ie,e]),X=n?.envelope.from[0]?.displayName??n?.envelope.from[0]?.normalizedEmail,le=s.useCallback(T=>{ee(!0),ye(T),i(T)},[i]),{saveState:te,saveError:oe,saveDraft:se,saveImmediately:J,stopAutoSave:ue}=Zi({outboxMessageId:r,onDraftCreated:le}),ut=s.useCallback(async()=>{if(r)return{outcome:"ready",outboxMessageId:r};if(!$)return{outcome:"refused",reason:"Choose an account to send from before attaching a file."};if(h.length===0)return{outcome:"refused",reason:Rc};const{htmlBody:T,textBody:U}=rn(ce,pe,re,W),Z=await J({accountId:$,toAddresses:h.map(K=>K.email),ccAddresses:x.length>0?x.map(K=>K.email):void 0,bccAddresses:E.length>0?E.map(K=>K.email):void 0,subject:N||void 0,textBody:U,htmlBody:T,...n&&(e==="reply"||e==="reply-all")?ur(n):{}});return Z.outcome==="failed"?{outcome:"refused",reason:`The draft could not be saved, so the file was not attached: ${Se(Z.error)??"the request failed"}.`}:{outcome:"ready",outboxMessageId:Z.outboxMessageId}},[r,$,h,x,E,N,pe,ce,re,W,n,e,J]),{items:bo,attach:$t,retry:Eo,remove:xo,load:Rn,reset:Cn,owns:So,isLoaded:Ro,refreshLinks:Co,storedContent:To,onRemoved:Ao,blockingReason:Bt}=$i({ensureDraft:ut}),Do=Cr(),No=Ki({attach:$t,owns:So,isLoaded:Ro,storedContent:To,refreshLinks:()=>r?Do.fetchQuery({..._n({path:{outboxMessageId:r}}),staleTime:0}).then(T=>Co(T.attachments)):Promise.resolve(),onRemoved:Ao,draftAttachments:j&&j.outboxMessageId===r?j.attachments:[],pushError:l}),Tn=s.useRef(r);s.useEffect(()=>{const T=Tn.current;T!==r&&(Tn.current=r,T!==void 0&&Cn(r))},[r,Cn]);const An=s.useRef(void 0);s.useEffect(()=>{!j||j.outboxMessageId!==r||An.current!==j.outboxMessageId&&(An.current=j.outboxMessageId,Rn(j.outboxMessageId,j.attachments))},[j,r,Rn]),s.useEffect(()=>{oe&&l({title:"Couldn't save draft",detail:Se(oe)??"Saving the draft failed.",error:oe})},[oe,l]);const Dn=_e({...na(),meta:Me}),Nn=_e({...oa(),meta:Me,onError:T=>{l(ra("Couldn't discard draft","The draft wasn't discarded.",T))}}),{data:Oo}=At({...Ar(),staleTime:1/0}),Ze=Oo?.accounts.find(T=>T.accountId===$),Ut=Ze?ma(Ze):!1,[Ht,ko]=s.useState(),Wt=Ht&&Ht.accountId===$?Ht.reason:void 0,dt=Ze?.composeLanguages,Io=s.useMemo(()=>dt&&dt.length>0?dt:fa(navigator.languages),[dt]),Lo=s.useMemo(()=>oc(l),[l]),ft=s.useRef(!1),[On,kn]=s.useState(!1),mt=s.useCallback((T,U)=>On?{status:"sending"}:$?Wt?{status:"blocked",reason:Wt}:Ut?{status:"blocked",reason:dn}:lt||B?{status:"blocked",reason:xc}:Bt?{status:"blocked",reason:Bt}:U?{status:"blocked",reason:Cc(U)}:T===0?{status:"blocked",reason:Ec}:H?{status:"blocked",reason:Or}:{status:"ready",accountId:$}:{status:"blocked",reason:"Choose an account to send from."},[On,$,Wt,Ut,lt,B,Bt,H]),zt=s.useMemo(()=>mt(h.length+A.entries.length,dr([{label:"To",text:A.unparsed}])),[mt,h.length,A]),Po=zt;s.useEffect(()=>{if(!$||ft.current||ne!==void 0&&ne!==r||r&&!z||Ac(h,x,E,N,pe))return;const{htmlBody:T,textBody:U}=rn(ce,pe,re,W),Z={accountId:$,toAddresses:h.map(ae=>ae.email),ccAddresses:x.length>0?x.map(ae=>ae.email):void 0,bccAddresses:E.length>0?E.map(ae=>ae.email):void 0,subject:N||void 0,textBody:U,htmlBody:T},K=JSON.stringify(Z);if(Ce.current){Ce.current=!1,Fe.current=K;return}Fe.current!==K&&(Fe.current=void 0,se(Z))},[$,r,ne,z,h,x,E,N,pe,ce,re,W,se]);const In=s.useCallback(async(T,U)=>{if(!ft.current){ft.current=!0,kn(!0);try{ue();const Z=n&&(e==="reply"||e==="reply-all")?ur(n):{},{htmlBody:K,textBody:ae}=rn(ce,pe,re,W),jo=!r,ht=await J({accountId:T,toAddresses:U.to.map(ve=>ve.email),ccAddresses:U.cc.length>0?U.cc.map(ve=>ve.email):void 0,bccAddresses:U.bcc.length>0?U.bcc.map(ve=>ve.email):void 0,subject:N||void 0,textBody:ae,htmlBody:K,...Z});if(ht.outcome==="failed"){l({title:"Couldn't send message",detail:Se(ht.error)??"Saving the message failed, so nothing was sent. Try again.",error:ht.error});return}const qt=ht.outboxMessageId;if(await Dn.mutateAsync({path:{outboxMessageId:qt}}).catch(ve=>{const Pn=ac(ve);return Pn&&ko({accountId:T,reason:Pn}),l({title:"Couldn't send message",detail:Se(ve)??(jo?"The draft was saved but the send request failed. Try again from the Outbox.":"The send request failed. Try again."),error:ve}),null})===null)return;ue(qt),f(qt),c()}finally{ft.current=!1,kn(!1)}}},[N,pe,ce,re,W,e,n,r,J,Dn,ue,f,l,c]),_o=s.useCallback(()=>{ue(r),r&&Nn.mutate({path:{outboxMessageId:r}}),c()},[ue,r,Nn,c]),Vt=s.useCallback(T=>{l({title:"Can't send yet",detail:T}),T===dn&&de.current?.focus()},[l]),Ln=s.useCallback(()=>{if(zt.status==="sending")return;const T=S.to.current?.commitPending(),U=S.cc.current?.commitPending(),Z=S.bcc.current?.commitPending(),K={to:T?.addresses??h,cc:U?.addresses??x,bcc:Z?.addresses??E},ae=mt(K.to.length,dr([{label:"To",text:T?.unparsed??""},{label:"Cc",text:U?.unparsed??""},{label:"Bcc",text:Z?.unparsed??""}]));if(ae.status!=="sending"){if(ae.status==="blocked"){Vt(ae.reason);return}In(ae.accountId,K)}},[zt.status,S,h,x,E,mt,Vt,In]),Mo=s.useCallback(T=>{Q(T.accountId),u?.(T)},[u]);return d.jsx(Ba,{layout:m,onDropFiles:T=>{$t(T)},banner:d.jsxs(d.Fragment,{children:[Ze&&Ut?d.jsx(tc,{accountId:Ze.accountId,configureRef:de}):null,L?d.jsx(Va,{mode:M}):null,jt?d.jsxs(wr,{tone:"warning","data-testid":"compose-quote-failed",children:[d.jsx("span",{children:Sc})," ",d.jsx("button",{type:"button",className:"underline",onClick:()=>{O()},children:"Try again"})]}):null]}),header:d.jsx(Dc,{documentGeneration:Ke,selectedAccountId:$,onAccountChange:Mo,toAddresses:h,setToAddresses:g,ccAddresses:x,setCcAddresses:p,bccAddresses:E,setBccAddresses:w,showCc:b,setShowCc:P,showBcc:C,setShowBcc:q,subject:N,setSubject:F,fieldHandles:S,onToPendingChange:y}),quoted:W?d.jsx(Ya,{text:W.text,html:W.html,senderName:X}):void 0,attachments:d.jsx(ja,{items:bo,onRemove:T=>{xo(T)},onRetry:T=>{Eo(T)}}),actionBar:d.jsx(Na,{send:Po,onSend:Ln,onBlocked:Vt,onDiscard:_o,save:te,onAttach:T=>{$t(T)}}),children:d.jsx(s.Suspense,{fallback:d.jsx(Fa,{}),children:d.jsx(gc,{mode:ce,onModeChange:Xe,initialHtml:Ge,initialText:Lt,onChange:be,onSubmit:Ln,initialCaret:e==="new"?"start":void 0,onConversionError:l,languages:Io,initialLanguage:st,onLanguageChange:Pt,spellcheck:Lo,insertion:Mt,onInserted:ct,inlineImages:No},Ke)})})};var It="Dialog",[Gr]=cs(It),[Nc,ie]=Gr(It),Xr=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,c=s.useRef(null),u=s.useRef(null),[m,f]=ds({prop:r,defaultProp:o??!1,onChange:a,caller:It});return d.jsx(Nc,{scope:t,triggerRef:c,contentRef:u,contentId:Xt(),titleId:Xt(),descriptionId:Xt(),open:m,onOpenChange:f,onOpenToggle:s.useCallback(()=>f(l=>!l),[f]),modal:i,children:n})};Xr.displayName=It;var Qr="DialogTrigger",Oc=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ie(Qr,n),a=je(t,o.triggerRef);return d.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":xn(o.open),...r,ref:a,onClick:Re(e.onClick,o.onOpenToggle)})});Oc.displayName=Qr;var En="DialogPortal",[kc,Zr]=Gr(En,{forceMount:void 0}),Jr=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=ie(En,t);return d.jsx(kc,{scope:t,forceMount:n,children:s.Children.map(r,i=>d.jsx(Ot,{present:n||a.open,children:d.jsx(jr,{asChild:!0,container:o,children:i})}))})};Jr.displayName=En;var Nt="DialogOverlay",eo=s.forwardRef((e,t)=>{const n=Zr(Nt,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=ie(Nt,e.__scopeDialog);return a.modal?d.jsx(Ot,{present:r||a.open,children:d.jsx(Lc,{...o,ref:t})}):null});eo.displayName=Nt;var Ic=Ir("DialogOverlay.RemoveScroll"),Lc=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ie(Nt,n),a=Os(),i=je(t,a);return d.jsx(Vr,{as:Ic,allowPinchZoom:!0,shards:[o.contentRef],children:d.jsx(ge.div,{"data-state":xn(o.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),Ve="DialogContent",to=s.forwardRef((e,t)=>{const n=Zr(Ve,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=ie(Ve,e.__scopeDialog);return d.jsx(Ot,{present:r||a.open,children:a.modal?d.jsx(Pc,{...o,ref:t}):d.jsx(_c,{...o,ref:t})})});to.displayName=Ve;var Pc=s.forwardRef((e,t)=>{const n=ie(Ve,e.__scopeDialog),r=s.useRef(null),o=je(t,n.contentRef,r);return s.useEffect(()=>{const a=r.current;if(a)return Zs(a)},[]),d.jsx(no,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Re(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Re(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:Re(e.onFocusOutside,a=>a.preventDefault())})}),_c=s.forwardRef((e,t)=>{const n=ie(Ve,e.__scopeDialog),r=s.useRef(!1),o=s.useRef(!1);return d.jsx(no,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=a.target;n.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),no=s.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,c=ie(Ve,n);return Ps(),d.jsx(d.Fragment,{children:d.jsx(_r,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:d.jsx(Lr,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":xn(c.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),ro="DialogTitle",oo=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ie(ro,n);return d.jsx(ge.h2,{id:o.titleId,...r,ref:t})});oo.displayName=ro;var ao="DialogDescription",Mc=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ie(ao,n);return d.jsx(ge.p,{id:o.descriptionId,...r,ref:t})});Mc.displayName=ao;var so="DialogClose",jc=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ie(so,n);return d.jsx(ge.button,{type:"button",...r,ref:t,onClick:Re(e.onClick,()=>o.onOpenChange(!1))})});jc.displayName=so;function xn(e){return e?"open":"closed"}function Fc(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const io=R.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),ot=()=>{const e=R.useContext(io);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Fc(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
56
56
  [data-state=closed]
@@ -0,0 +1 @@
1
+ import{eU as t,j as m}from"./index-X3HUQEvM.js";import{C as p}from"./CalendarEventPopup-Cd49o1aV.js";import"./useCalendarSuggestions-BLiBIz-1.js";import"./ErrorState-DD3UfsN8.js";import"./useQueries-BO8eIXDf.js";import"./useCalendarData-CDMAl9sB.js";import"./useCalendarTasks-DClcdx9Q.js";import"./calendar-format-BwCpz-JZ.js";import"./reply-Bs_YhRF4.js";import"./useMediaQuery-9NJJDrX6.js";import"./calendar-BYyDHpZa.js";import"./CalendarSession-CS_x_fs5.js";import"./calendar-event-popup-Clle6FA1.js";import"./pencil-BnBK7tmS.js";import"./calendar-guests-DEOe1juO.js";import"./circle-help-C9O6dqh6.js";import"./confirm-dialog-CjHvZbGT.js";function P(){const{calendarObjectId:r,recurrenceId:o}=t.useParams();return m.jsx(p,{calendarObjectId:r,recurrenceId:o})}export{P as component};