@remit/web-client-dist 0.0.624 → 0.0.626

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 (167) hide show
  1. package/assets/{BriefPane-BjUmHKNU.js → BriefPane-_14jyTNU.js} +1 -1
  2. package/assets/CalendarComposePane-CvXktapf.js +1 -0
  3. package/assets/{CalendarComposeSeed-CeMPzriy.js → CalendarComposeSeed-CifBLPSk.js} +1 -1
  4. package/assets/{CalendarShell-q8nTThqJ.js → CalendarShell-CQKMfTHS.js} +1 -1
  5. package/assets/{EmptyState-DxHRPzWP.js → EmptyState-DFn4LB7J.js} +1 -1
  6. package/assets/{ErrorState-B7NbYqTc.js → ErrorState-wz9YaOol.js} +1 -1
  7. package/assets/FlaggedPane-CGhj--Hm.js +1 -0
  8. package/assets/{FullCompose-Co7TPnxX.js → FullCompose-ChHG83dJ.js} +1 -1
  9. package/assets/MailListHeader-DfOCZnRx.js +7 -0
  10. package/assets/MailNav-CjfpinUe.js +1 -0
  11. package/assets/{MailShell-CBAHJ7P0.js → MailShell-C1jECwgj.js} +1 -1
  12. package/assets/{MailViewChrome-SWxm38ad.js → MailViewChrome-XZUEJlo5.js} +1 -1
  13. package/assets/{MailboxPane-S4RjLCSn.js → MailboxPane-Czwm70WW.js} +1 -1
  14. package/assets/{NavMenuButton-CRz4o42Z.js → NavMenuButton-DeFLPsFB.js} +1 -1
  15. package/assets/{OnboardingWizard-eRXMySJ0.js → OnboardingWizard-B-CFGg5s.js} +1 -1
  16. package/assets/OpenCalendarEvent-DFERZRRh.js +2 -0
  17. package/assets/{OutboxPane-CXpqcg1M.js → OutboxPane-HIJT_kwS.js} +1 -1
  18. package/assets/_calendarObjectId-CHrSuJ4j.js +1 -0
  19. package/assets/_mailboxId-Cx59NB_O.js +1 -0
  20. package/assets/_messageId-428jqG1g.js +1 -0
  21. package/assets/_messageId-BqS3jo2k.js +1 -0
  22. package/assets/_messageId-DLcoHrvg.js +1 -0
  23. package/assets/_outboxMessageId-DgbOcdNZ.js +1 -0
  24. package/assets/_recurrenceId-BNEK4esm.js +1 -0
  25. package/assets/_threadId-BpGxTAyH.js +1 -0
  26. package/assets/_threadId-DBQCQCIO.js +1 -0
  27. package/assets/_threadId-Li52F0Cd.js +1 -0
  28. package/assets/{_view._date-hlYMd7kn.js → _view._date-CvSVriaI.js} +1 -1
  29. package/assets/accounts-UiS1FK2e.js +1 -0
  30. package/assets/{advanced-CWj1vJ3f.js → advanced-LKQZxDeW.js} +2 -2
  31. package/assets/{appearance-DXdbCOhL.js → appearance-Csl0uD9E.js} +1 -1
  32. package/assets/{attendee-row-Dgh-0GlX.js → attendee-row-BhqXy1fZ.js} +1 -1
  33. package/assets/{avatar-BuiXyp5p.js → avatar-Dq9zVRVl.js} +1 -1
  34. package/assets/{bell-off-PwhHcUK1.js → bell-off-zJIQc-fQ.js} +1 -1
  35. package/assets/{bottom-sheet-BuyceQDS.js → bottom-sheet-CqUVoKvb.js} +1 -1
  36. package/assets/brief-CuAyGW-_.js +1 -0
  37. package/assets/{brief-itwy9KeE.js → brief-i89ZY7Gu.js} +1 -1
  38. package/assets/{browser-ponyfill-XC3MKgZo.js → browser-ponyfill-32LE6w6g.js} +2 -2
  39. package/assets/{bug-CFbZ4o5k.js → bug-BX9QtfhB.js} +1 -1
  40. package/assets/calendar-DLPNVzNq.js +1 -0
  41. package/assets/{calendar-clash-strip-ChVtknHT.js → calendar-clash-strip-Bid2cYhz.js} +1 -1
  42. package/assets/calendar-format-M4S5xU7P.js +1 -0
  43. package/assets/calendar-suggestion-Dz1CYPKE.js +1 -0
  44. package/assets/{calendars-CI4Tye4t.js → calendars-D_kCUTOt.js} +1 -1
  45. package/assets/{card-Dfe50axc.js → card-DgdelB3M.js} +1 -1
  46. package/assets/chevron-left-Dd68kT1Y.js +1 -0
  47. package/assets/{circle-check-DMqAgBOj.js → circle-check-B0R88gmM.js} +1 -1
  48. package/assets/{circle-check-big-CYIqB7G_.js → circle-check-big-DrhQmTbc.js} +1 -1
  49. package/assets/{circle-help-Bn5rsX9v.js → circle-help-Bh3n-6_h.js} +1 -1
  50. package/assets/{clock-zhYrOi0n.js → clock-ByuYhL7c.js} +1 -1
  51. package/assets/compose._-_outboxMessageId_-CJP6aGKp.js +1 -0
  52. package/assets/compose._-_outboxMessageId_-CMXTsNxj.js +1 -0
  53. package/assets/compose._-_outboxMessageId_-DIUaW_Wi.js +1 -0
  54. package/assets/compose._-_outboxMessageId_-ZpGAMi--.js +1 -0
  55. package/assets/{config-import-PZAIf0rl.js → config-import-Bugb2aMh.js} +1 -1
  56. package/assets/{confirm-dialog-BBNecW64.js → confirm-dialog-D0wfxRPd.js} +1 -1
  57. package/assets/{copy-DYN1Qqcn.js → copy-baeOC0XH.js} +1 -1
  58. package/assets/{credential-steps-BvLk_5Sd.js → credential-steps-DOdW-2H8.js} +1 -1
  59. package/assets/{download-DSk-iXt6.js → download-C79uP4C7.js} +1 -1
  60. package/assets/{file-json-CnG7YYof.js → file-json-CGQXrNbO.js} +1 -1
  61. package/assets/{filters-pA2rkirY.js → filters-CAsK70Nx.js} +1 -1
  62. package/assets/flagged-CEg9zmAF.js +1 -0
  63. package/assets/{flagged-0DaGnTzF.js → flagged-uALUxb-O.js} +1 -1
  64. package/assets/folder-failure-CqkVSsrb.js +1 -0
  65. package/assets/folders-Bx3SMw7d.js +1 -0
  66. package/assets/{help-copy-DUM-3tGw.js → help-copy-C9SzNfoi.js} +1 -1
  67. package/assets/{import-iEpa-yKD.js → import-BwX6jaiD.js} +1 -1
  68. package/assets/index-B_wiLLnW.js +1 -0
  69. package/assets/index-BulHQ3Bz.js +1 -0
  70. package/assets/index-Bz3z8-Ud.js +1 -0
  71. package/assets/{index-N25dfLEk.js → index-CLg2znEx.js} +1 -1
  72. package/assets/index-Caogy7TQ.js +1 -0
  73. package/assets/index-Cfb74LIY.js +1 -0
  74. package/assets/index-CvxW8FM1.js +1 -0
  75. package/assets/index-Cy75NEgh.js +1 -0
  76. package/assets/index-D4ZeuNuq.js +55 -0
  77. package/assets/index-DLcoHrvg.js +1 -0
  78. package/assets/index-DmMeuJEG.js +1 -0
  79. package/assets/{index-Cvg1ICmg.js → index-UydO8d8c.js} +69 -69
  80. package/assets/{kbd-CqsQh3Yv.js → kbd-Dr4usi4j.js} +1 -1
  81. package/assets/{labels-d9EnCfKK.js → labels-D22q095l.js} +1 -1
  82. package/assets/mail-CWdYkVJO.js +1 -0
  83. package/assets/{mail-i5djtULt.js → mail-Db9OjHYL.js} +1 -1
  84. package/assets/{map-pin-BNehUfT9.js → map-pin-HJKJCWdt.js} +1 -1
  85. package/assets/{menu-CzfZlboy.js → menu-CbYnJN5U.js} +1 -1
  86. package/assets/new-kq63OZ83.js +1 -0
  87. package/assets/onboarding-DXy2aNhI.js +1 -0
  88. package/assets/{onboarding-completion-LMYPue3i.js → onboarding-completion-BlaYncdL.js} +1 -1
  89. package/assets/outbox-CT3Ok2c-.js +1 -0
  90. package/assets/{pencil-Cbc_bTFZ.js → pencil-u2t1F29A.js} +1 -1
  91. package/assets/{popover-menu-BOPw-RvI.js → popover-menu--AoVAv-y.js} +1 -1
  92. package/assets/{refresh-cw-gehoG8pf.js → refresh-cw-Qp6f0dRu.js} +1 -1
  93. package/assets/{rich-text-DYTexR3K.js → rich-text-D3RBxInX.js} +2 -2
  94. package/assets/{rich-text-spellcheck-worker-provider-Be6BN4oD.js → rich-text-spellcheck-worker-provider-9h-DIyCe.js} +1 -1
  95. package/assets/{rotate-ccw-BUQyyEmS.js → rotate-ccw-SdroQT7m.js} +1 -1
  96. package/assets/{roving-focus-DwDXHttZ.js → roving-focus-BNBmBfAx.js} +1 -1
  97. package/assets/{row-actions-CzWFmX-0.js → row-actions-IPR7z5tr.js} +1 -1
  98. package/assets/{search-mirror-CG0SD5Nw.js → search-mirror-Cv2S0VbB.js} +1 -1
  99. package/assets/{search-token-index-CMfLsCex.js → search-token-index-AOAqpH15.js} +1 -1
  100. package/assets/{sections-DZNHkQyT.js → sections-EqJpt3TQ.js} +1 -1
  101. package/assets/{senders-zOwXF1CW.js → senders-DnFn3aNI.js} +1 -1
  102. package/assets/settings-CNMUput2.js +1 -0
  103. package/assets/{settings-screen-BVNyrrqp.js → settings-screen-WQb7kG5A.js} +1 -1
  104. package/assets/{shield-check-gQitY-yx.js → shield-check-D7EcTf9d.js} +1 -1
  105. package/assets/{suggested-vips-DrD2TuQ1.js → suggested-vips-QYhd7mHg.js} +1 -1
  106. package/assets/undo-2-CveuEJjH.js +1 -0
  107. package/assets/useCalendarData-CMPLRued.js +1 -0
  108. package/assets/{useCalendarWrites--n8KbD7U.js → useCalendarWrites-BASehFYp.js} +1 -1
  109. package/assets/useCalendars-DR1_eTjS.js +1 -0
  110. package/assets/{useDebouncedValue-abnXV_Ax.js → useDebouncedValue-Dt6rAAol.js} +1 -1
  111. package/assets/{useFilters-e6-LOuFX.js → useFilters-Bbcl4di_.js} +1 -1
  112. package/assets/{useLabels-Dm-tUvjJ.js → useLabels-DQs2z0T7.js} +1 -1
  113. package/assets/{useLayoutTier-id3G6JgO.js → useLayoutTier-CF_kWPgV.js} +1 -1
  114. package/assets/{useMessageBodyContent-DK0INN0c.js → useMessageBodyContent-DiiU1g37.js} +1 -1
  115. package/assets/{useQueries-B8LmhXDj.js → useQueries-CJUjXxvq.js} +1 -1
  116. package/assets/{useRefreshControl-BY1Z-PWr.js → useRefreshControl-BUZDaiTn.js} +1 -1
  117. package/assets/{useResultFolderIndex-D442PBpq.js → useResultFolderIndex-D9ADFT-m.js} +1 -1
  118. package/assets/{useSearchTokenContext-8rnAiWTU.js → useSearchTokenContext-CBDSw3gJ.js} +3 -3
  119. package/assets/{useSemanticSearch-CCCY9PAD.js → useSemanticSearch-B7rQKIm8.js} +1 -1
  120. package/assets/{useSignature-BPTjqaqF.js → useSignature-DruMb0cI.js} +1 -1
  121. package/index.html +1 -1
  122. package/package.json +1 -1
  123. package/assets/CalendarComposePane-CQquoIIA.js +0 -1
  124. package/assets/FlaggedPane-C0O-H48H.js +0 -1
  125. package/assets/MailListHeader-C_n4dLUO.js +0 -7
  126. package/assets/MailNav-DsFM4Zbb.js +0 -1
  127. package/assets/OpenCalendarEvent-BgYFqkWO.js +0 -2
  128. package/assets/_calendarObjectId-CAZamn7y.js +0 -1
  129. package/assets/_mailboxId-BmIDt2GW.js +0 -1
  130. package/assets/_messageId-CigPBylW.js +0 -1
  131. package/assets/_messageId-R9ftzZBW.js +0 -1
  132. package/assets/_messageId-Xz7zDM4l.js +0 -1
  133. package/assets/_outboxMessageId-DxrO7cYW.js +0 -1
  134. package/assets/_recurrenceId-C1Ir6dGL.js +0 -1
  135. package/assets/_threadId-CIO_w6bi.js +0 -1
  136. package/assets/_threadId-CjQQJEhB.js +0 -1
  137. package/assets/_threadId-luQhGDWk.js +0 -1
  138. package/assets/accounts-BHBATOBL.js +0 -1
  139. package/assets/attachment-file-rUVfXWEQ.js +0 -1
  140. package/assets/brief-Dl4eEpFB.js +0 -1
  141. package/assets/calendar-Dabme7v4.js +0 -1
  142. package/assets/calendar-format-_D2qlvSu.js +0 -1
  143. package/assets/calendar-suggestion-DoL5BXEv.js +0 -1
  144. package/assets/chevron-left-Cp_sl0gi.js +0 -1
  145. package/assets/compose._-_outboxMessageId_-C7e7F6Id.js +0 -1
  146. package/assets/compose._-_outboxMessageId_-DMdCmVMA.js +0 -1
  147. package/assets/compose._-_outboxMessageId_-O4p9O2gf.js +0 -1
  148. package/assets/compose._-_outboxMessageId_-VcBR_Wg2.js +0 -1
  149. package/assets/flagged-CffT7Fd9.js +0 -1
  150. package/assets/folders-BZ2ei1sV.js +0 -1
  151. package/assets/index-BvAEy50E.js +0 -1
  152. package/assets/index-Bw48MPd4.js +0 -1
  153. package/assets/index-C280EmcF.js +0 -1
  154. package/assets/index-CeB8dMXm.js +0 -1
  155. package/assets/index-CigPBylW.js +0 -1
  156. package/assets/index-ClrSu-J7.js +0 -1
  157. package/assets/index-DDZEuXNA.js +0 -1
  158. package/assets/index-DK4QmBvZ.js +0 -1
  159. package/assets/index-sAVS5SaO.js +0 -1
  160. package/assets/index-yhiT7pf4.js +0 -55
  161. package/assets/mail-DvBCqkl1.js +0 -1
  162. package/assets/new-w9LeiqvV.js +0 -1
  163. package/assets/onboarding-CGyR6f-U.js +0 -1
  164. package/assets/outbox-B7-uw0-A.js +0 -1
  165. package/assets/settings-BJ3vobZ5.js +0 -1
  166. package/assets/useCalendarData-DXephWeP.js +0 -1
  167. package/assets/useCalendars-BiHQwoqg.js +0 -1
@@ -1 +1 @@
1
- import{e as H,j as e,B as x,f,L as _,X as Ee,r,I as Oe,g as O,h as pe,c as ze,d as Be,i as q,s as de,k as $e,l as Pe,m as De,n as Le,o as J,q as qe}from"./index-Cvg1ICmg.js";import{W as k,C as fe,a as le,u as We,b as He,c as _e,d as Ke,S as Qe,R as Ue}from"./credential-steps-BvLk_5Sd.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-PZAIf0rl.js";import{F as tt}from"./file-json-CnG7YYof.js";import{c as st}from"./onboarding-completion-LMYPue3i.js";import"./card-Dfe50axc.js";const nt=H("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=H("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=H("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=H("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",S=t==="checking",R=j||S,N=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…":S?"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:N,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":S?"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?"Waiting on folders":"Import finished",subtitle:t.length>0?"The config names folders this server has not shown us yet.":"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. Each turns itself on the moment its folder appears — nothing was dropped. If a folder never appears, create it in your mail client, or edit the setting in Settings → Senders & Rules."]}),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.`},W=(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,S]=r.useState(void 0),[R,N]=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,Se]=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},[$]),Ne=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());We(G!==null,()=>{n.invalidateQueries({queryKey:J()}),z(null)});const ce=He(a=>{z(null),a==="stalled"&&ne(Ue)}),Ce=r.useCallback(a=>{l(!1),w(!0),p({name:a.name,size:a.size}),N(void 0),S(void 0),a.text().then(o=>Ge(a.name,a.size,o)).then(o=>{if(w(!1),!o.ok){N(o.failure);return}S(o.document)}).catch(o=>{w(!1),N({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:W(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(Se(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}N({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:W(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]:W(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]:W(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),N(void 0),p(void 0),S(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(St,{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:Ne,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 St({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 At(){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{At as component};
1
+ import{e as H,j as e,B as x,f,L as _,X as Ee,r,I as Oe,g as O,h as pe,c as ze,d as Be,i as q,s as de,k as $e,l as Pe,m as De,n as Le,o as J,q as qe}from"./index-UydO8d8c.js";import{W as k,C as fe,a as le,u as We,b as He,c as _e,d as Ke,S as Qe,R as Ue}from"./credential-steps-DOdW-2H8.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-Bugb2aMh.js";import{F as tt}from"./file-json-CGQXrNbO.js";import{c as st}from"./onboarding-completion-BlaYncdL.js";import"./card-DgdelB3M.js";const nt=H("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=H("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=H("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=H("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",S=t==="checking",R=j||S,N=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…":S?"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:N,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":S?"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?"Waiting on folders":"Import finished",subtitle:t.length>0?"The config names folders this server has not shown us yet.":"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. Each turns itself on the moment its folder appears — nothing was dropped. If a folder never appears, create it in your mail client, or edit the setting in Settings → Senders & Rules."]}),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.`},W=(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,S]=r.useState(void 0),[R,N]=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,Se]=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},[$]),Ne=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());We(G!==null,()=>{n.invalidateQueries({queryKey:J()}),z(null)});const ce=He(a=>{z(null),a==="stalled"&&ne(Ue)}),Ce=r.useCallback(a=>{l(!1),w(!0),p({name:a.name,size:a.size}),N(void 0),S(void 0),a.text().then(o=>Ge(a.name,a.size,o)).then(o=>{if(w(!1),!o.ok){N(o.failure);return}S(o.document)}).catch(o=>{w(!1),N({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:W(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(Se(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}N({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:W(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]:W(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]:W(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),N(void 0),p(void 0),S(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(St,{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:Ne,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 St({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 At(){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{At as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-UydO8d8c.js";import{O as t}from"./OutboxPane-HIJT_kwS.js";import"./roving-focus-BNBmBfAx.js";import"./useSearchTokenContext-CBDSw3gJ.js";import"./kbd-Dr4usi4j.js";import"./useMessageBodyContent-DiiU1g37.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-DrhQmTbc.js";import"./clock-ByuYhL7c.js";import"./row-actions-IPR7z5tr.js";import"./rotate-ccw-SdroQT7m.js";import"./NavMenuButton-DeFLPsFB.js";import"./menu-CbYnJN5U.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function c(){return o.jsx(t.Reading,{})}export{c as component};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-UydO8d8c.js";import{B as o}from"./BriefPane-_14jyTNU.js";import"./useSearchTokenContext-CBDSw3gJ.js";import"./kbd-Dr4usi4j.js";import"./useMessageBodyContent-DiiU1g37.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-DfOCZnRx.js";import"./roving-focus-BNBmBfAx.js";import"./search-token-index-AOAqpH15.js";import"./useQueries-CJUjXxvq.js";import"./popover-menu--AoVAv-y.js";import"./mail-Db9OjHYL.js";import"./avatar-Dq9zVRVl.js";import"./index-D4ZeuNuq.js";import"./useSignature-DruMb0cI.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dt6rAAol.js";import"./sections-EqJpt3TQ.js";import"./EmptyState-DFn4LB7J.js";import"./ErrorState-wz9YaOol.js";import"./undo-2-CveuEJjH.js";import"./download-C79uP4C7.js";import"./calendar-suggestion-Dz1CYPKE.js";import"./calendar-format-M4S5xU7P.js";import"./useCalendars-DR1_eTjS.js";import"./map-pin-HJKJCWdt.js";import"./attendee-row-BhqXy1fZ.js";import"./clock-ByuYhL7c.js";import"./calendar-clash-strip-Bid2cYhz.js";import"./bell-off-zJIQc-fQ.js";import"./copy-baeOC0XH.js";import"./shield-check-D7EcTf9d.js";import"./useFilters-Bbcl4di_.js";import"./confirm-dialog-D0wfxRPd.js";import"./useLayoutTier-CF_kWPgV.js";import"./menu-CbYnJN5U.js";import"./useRefreshControl-BUZDaiTn.js";import"./circle-check-big-DrhQmTbc.js";import"./refresh-cw-Qp6f0dRu.js";import"./useSemanticSearch-B7rQKIm8.js";import"./useLabels-DQs2z0T7.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-DxUM65kM.js";function T(){return r.jsx(o.Reading,{})}export{T as component};
@@ -0,0 +1 @@
1
+ import{j as t,an as o}from"./index-UydO8d8c.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
@@ -1 +1 @@
1
- import{j as e,Y as a}from"./index-Cvg1ICmg.js";import{E as s}from"./EmptyState-DxHRPzWP.js";function r(){return e.jsx("div",{className:"flex h-full items-center justify-center bg-surface",children:e.jsx(s,{message:"Pick an event to read it here.",icon:e.jsx(a,{className:"size-8"})})})}export{r as component};
1
+ import{j as e,Y as a}from"./index-UydO8d8c.js";import{E as s}from"./EmptyState-DFn4LB7J.js";function r(){return e.jsx("div",{className:"flex h-full items-center justify-center bg-surface",children:e.jsx(s,{message:"Pick an event to read it here.",icon:e.jsx(a,{className:"size-8"})})})}export{r as component};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-UydO8d8c.js";import{B as o}from"./BriefPane-_14jyTNU.js";import"./useSearchTokenContext-CBDSw3gJ.js";import"./kbd-Dr4usi4j.js";import"./useMessageBodyContent-DiiU1g37.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-DfOCZnRx.js";import"./roving-focus-BNBmBfAx.js";import"./search-token-index-AOAqpH15.js";import"./useQueries-CJUjXxvq.js";import"./popover-menu--AoVAv-y.js";import"./mail-Db9OjHYL.js";import"./avatar-Dq9zVRVl.js";import"./index-D4ZeuNuq.js";import"./useSignature-DruMb0cI.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dt6rAAol.js";import"./sections-EqJpt3TQ.js";import"./EmptyState-DFn4LB7J.js";import"./ErrorState-wz9YaOol.js";import"./undo-2-CveuEJjH.js";import"./download-C79uP4C7.js";import"./calendar-suggestion-Dz1CYPKE.js";import"./calendar-format-M4S5xU7P.js";import"./useCalendars-DR1_eTjS.js";import"./map-pin-HJKJCWdt.js";import"./attendee-row-BhqXy1fZ.js";import"./clock-ByuYhL7c.js";import"./calendar-clash-strip-Bid2cYhz.js";import"./bell-off-zJIQc-fQ.js";import"./copy-baeOC0XH.js";import"./shield-check-D7EcTf9d.js";import"./useFilters-Bbcl4di_.js";import"./confirm-dialog-D0wfxRPd.js";import"./useLayoutTier-CF_kWPgV.js";import"./menu-CbYnJN5U.js";import"./useRefreshControl-BUZDaiTn.js";import"./circle-check-big-DrhQmTbc.js";import"./refresh-cw-Qp6f0dRu.js";import"./useSemanticSearch-B7rQKIm8.js";import"./useLabels-DQs2z0T7.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-DxUM65kM.js";function S(){return r.jsx(o.Reading,{})}export{S as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-UydO8d8c.js";import{F as r}from"./FlaggedPane-CGhj--Hm.js";import"./useSearchTokenContext-CBDSw3gJ.js";import"./kbd-Dr4usi4j.js";import"./useMessageBodyContent-DiiU1g37.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-DfOCZnRx.js";import"./roving-focus-BNBmBfAx.js";import"./search-token-index-AOAqpH15.js";import"./useQueries-CJUjXxvq.js";import"./popover-menu--AoVAv-y.js";import"./mail-Db9OjHYL.js";import"./avatar-Dq9zVRVl.js";import"./index-D4ZeuNuq.js";import"./useSignature-DruMb0cI.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dt6rAAol.js";import"./sections-EqJpt3TQ.js";import"./EmptyState-DFn4LB7J.js";import"./ErrorState-wz9YaOol.js";import"./undo-2-CveuEJjH.js";import"./download-C79uP4C7.js";import"./calendar-suggestion-Dz1CYPKE.js";import"./calendar-format-M4S5xU7P.js";import"./useCalendars-DR1_eTjS.js";import"./map-pin-HJKJCWdt.js";import"./attendee-row-BhqXy1fZ.js";import"./clock-ByuYhL7c.js";import"./calendar-clash-strip-Bid2cYhz.js";import"./bell-off-zJIQc-fQ.js";import"./copy-baeOC0XH.js";import"./shield-check-D7EcTf9d.js";import"./useFilters-Bbcl4di_.js";import"./confirm-dialog-D0wfxRPd.js";import"./useLayoutTier-CF_kWPgV.js";import"./menu-CbYnJN5U.js";import"./MailViewChrome-XZUEJlo5.js";import"./refresh-cw-Qp6f0dRu.js";import"./wizard-selection-DxUM65kM.js";function N(){return o.jsx(r.Reading,{})}export{N as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-UydO8d8c.js";import{M as i}from"./MailboxPane-Czwm70WW.js";import"./useSearchTokenContext-CBDSw3gJ.js";import"./kbd-Dr4usi4j.js";import"./useMessageBodyContent-DiiU1g37.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-BUZDaiTn.js";import"./circle-check-big-DrhQmTbc.js";import"./refresh-cw-Qp6f0dRu.js";import"./useQueries-CJUjXxvq.js";import"./MailListHeader-DfOCZnRx.js";import"./roving-focus-BNBmBfAx.js";import"./search-token-index-AOAqpH15.js";import"./popover-menu--AoVAv-y.js";import"./mail-Db9OjHYL.js";import"./avatar-Dq9zVRVl.js";import"./index-D4ZeuNuq.js";import"./useSignature-DruMb0cI.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dt6rAAol.js";import"./sections-EqJpt3TQ.js";import"./EmptyState-DFn4LB7J.js";import"./ErrorState-wz9YaOol.js";import"./undo-2-CveuEJjH.js";import"./download-C79uP4C7.js";import"./calendar-suggestion-Dz1CYPKE.js";import"./calendar-format-M4S5xU7P.js";import"./useCalendars-DR1_eTjS.js";import"./map-pin-HJKJCWdt.js";import"./attendee-row-BhqXy1fZ.js";import"./clock-ByuYhL7c.js";import"./calendar-clash-strip-Bid2cYhz.js";import"./bell-off-zJIQc-fQ.js";import"./copy-baeOC0XH.js";import"./shield-check-D7EcTf9d.js";import"./useFilters-Bbcl4di_.js";import"./confirm-dialog-D0wfxRPd.js";import"./useLayoutTier-CF_kWPgV.js";import"./menu-CbYnJN5U.js";import"./MailViewChrome-XZUEJlo5.js";import"./NavMenuButton-DeFLPsFB.js";import"./useLabels-DQs2z0T7.js";import"./useSemanticSearch-B7rQKIm8.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-CqUVoKvb.js";import"./circle-help-Bh3n-6_h.js";import"./circle-check-B0R88gmM.js";function X(){return o.jsx(i.Reading,{})}export{X as component};
@@ -0,0 +1 @@
1
+ import{eV as o,j as r}from"./index-UydO8d8c.js";import{O as m}from"./OpenCalendarEvent-DFERZRRh.js";import"./CalendarComposePane-CvXktapf.js";import"./calendar-format-M4S5xU7P.js";import"./useQueries-CJUjXxvq.js";import"./useCalendars-DR1_eTjS.js";import"./calendar-clash-strip-Bid2cYhz.js";import"./attendee-row-BhqXy1fZ.js";import"./avatar-Dq9zVRVl.js";import"./clock-ByuYhL7c.js";import"./map-pin-HJKJCWdt.js";import"./mail-Db9OjHYL.js";import"./pencil-u2t1F29A.js";import"./useCalendarWrites-BASehFYp.js";import"./ErrorState-wz9YaOol.js";import"./useCalendarData-CMPLRued.js";function v(){const{calendarObjectId:t}=o.useParams();return r.jsx(m,{calendarObjectId:t})}export{v as component};
@@ -0,0 +1,55 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rich-text-spellcheck-worker-provider-9h-DIyCe.js","assets/index-UydO8d8c.js","assets/index-CzAIxx9Z.css","assets/rich-text-spellcheck-provider-J8m9wz6A.js","assets/rich-text-D3RBxInX.js","assets/roving-focus-BNBmBfAx.js","assets/confirm-dialog-D0wfxRPd.js","assets/bottom-sheet-CqUVoKvb.js","assets/popover-menu--AoVAv-y.js","assets/undo-2-CveuEJjH.js","assets/useMessageBodyContent-DiiU1g37.js","assets/useSignature-DruMb0cI.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-Dt6rAAol.js","assets/sections-EqJpt3TQ.js"])))=>i.map(i=>d[i]);
2
+ import{e as la,j as d,X as ar,t as an,f as on,L as or,a1 as da,a3 as fa,r as s,cr as ma,cs as ha,a0 as pa,_ as sr,B as ir,ar as va,ct as ga,$ as ya,cu as wa,cv as mn,bY as cr,cw as Re,cx as ur,cy as ba,ci as Ea,cz as ke,i as Pe,aJ as Le,cA as xa,cB as Sa,cC as lr,h as Ra,cD as Ca,ad as Ta,c as Ot,bR as Aa,cE as dr,aH as Da,aI as Na,cF as Oa,bT as ka,d as fr,cG as Ia,at as Pa,cH as La,bk as Tn,cI as _a,cJ as Ma,av as ja,cK as Fa,au as $a,bq as Ba,cL as Ha,as as C}from"./index-UydO8d8c.js";import{b as Ua}from"./useMessageBodyContent-DiiU1g37.js";import{u as Wa}from"./useSignature-DruMb0cI.js";import{b as za}from"./account-form-helpers-DhckT_PN.js";import{u as Va}from"./useDebouncedValue-Dt6rAAol.js";import{a as qa}from"./sections-EqJpt3TQ.js";const mr=la("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"}]]),Ka=({email:e,displayName:t,onRemove:n,className:r})=>d.jsxs("span",{className:an("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(ar,{className:"size-3"})})]}),Ya=/[\u0000-\u001f\u007f-\u009f\u061c\u200b-\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069\ufeff]/g,Ga=/[<>:"|?*]/g,Xa=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\.|$)/i,An=120,Qa=12,Za="attachment",Dn=e=>{const t=[...e];if(t.length<=An)return e;const n=e.lastIndexOf("."),r=n>0&&[...e.slice(n)].length<=Qa?e.slice(n):"",a=An-[...r].length;return t.slice(0,a).join("")+r},_c=(e,t=Za)=>{const r=e.replace(Ya,"").split(/[/\\]/),o=(r[r.length-1]??"").replace(Ga,"_").replace(/^[.\s]+/,"").replace(/[.\s]+$/,"");if(o.length===0)return Dn(t);const i=Xa.test(o)?`_${o}`:o;return Dn(i)},Nn=["KB","MB","GB","TB"],Ja=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,a=0;for(;r>=n&&a<Nn.length-1;)r/=1024,a+=1;return`${r.toFixed(1).replace(/\.0$/,"")} ${Nn[a]}`},eo=({disabled:e,onAttach:t})=>{const n=s.useRef(null);return d.jsxs(d.Fragment,{children:[d.jsx(on,{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(mr,{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 a=Array.from(r.currentTarget.files??[]);r.currentTarget.value="",a.length>0&&t(a)}})]})},to=({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 no({send:e,onSend:t,onBlocked:n,onDiscard:r,save:a={status:"idle"},onAttach:o}){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(on,{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(or,{className:"size-4 animate-spin"}):d.jsx(da,{className:"size-4"}),onClick:()=>{if(!i){if(c!==void 0){n(c);return}t()}},children:"Send"}),o&&d.jsx(eo,{disabled:i,onAttach:o}),d.jsx(to,{save:a})]}),d.jsx(on,{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(fa,{className:"size-4"}),onClick:()=>{i||r()}})]})}const On=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),ro=e=>{const t=e.trim();if(!t)return;const n=t.match(/^(.+?)\s*<([^>]+)>$/);if(n){const r=n[1].trim().replace(/^"(.*)"$/,"$1"),a=n[2].trim();if(On(a))return{email:a,displayName:r}}if(On(t))return{email:t}},ao=e=>{const t=[];let n="",r=!1,a=!1;for(const o of e){if(o==='"'&&(r=!r),o==="<"&&(a=!0),o===">"&&(a=!1),(o===","||o===";")&&!r&&!a){t.push(n),n="";continue}n+=o}return t.push(n),t},oo=e=>{const t=[],n=[];for(const r of ao(e)){const a=ro(r);if(a){t.push(a);continue}r.trim()&&n.push(r.trim())}return{entries:t,unparsed:n.join(", ")}},so=["Tab",","],io=150,co=({label:e,addresses:t,onChange:n,placeholder:r,suggestions:a=[],onQueryChange:o,onPendingChange:i,ref:c})=>{const[m,f]=s.useState(""),l=s.useRef(null),u=s.useMemo(()=>oo(m),[m]);s.useEffect(()=>{i?.(u)},[u,i]);const p=s.useRef(void 0),y=s.useCallback(()=>{p.current!==void 0&&(clearTimeout(p.current),p.current=void 0)},[]);s.useEffect(()=>y,[y]);const x=new Set(t.map(w=>w.email.toLowerCase())),h=m.length>=2?a.filter(w=>!x.has(w.email.toLowerCase())):[],E=s.useCallback(w=>{f(w),o?.(w)},[o]),b=s.useCallback(w=>{y(),!x.has(w.email.toLowerCase())&&(n([...t,w]),E(""))},[t,x,n,E,y]),T=s.useCallback(w=>{n(t.filter((_,R)=>R!==w))},[t,n]),g=s.useCallback(w=>{b(w),l.current?.focus()},[b]),v=s.useCallback(()=>{if(y(),u.entries.length===0)return{addresses:t,unparsed:u.unparsed};const w=new Set(x),_=[...t];for(const R of u.entries){const W=R.email.toLowerCase();w.has(W)||(w.add(W),_.push(R))}return n(_),E(u.unparsed),{addresses:_,unparsed:u.unparsed}},[u,t,x,n,E,y]),A=s.useCallback(()=>{y(),E("")},[E,y]);s.useImperativeHandle(c,()=>({commitPending:v,clearPending:A}),[v,A]);const L=s.useRef(v);s.useEffect(()=>{L.current=v},[v]);const S=ma({count:h.length,acceptKeys:so,onAccept:w=>g(h[w])}),O=s.useMemo(()=>h.map(w=>({value:w.email,label:w.displayName??w.email,...w.displayName?{hint:w.email}:{}})),[h]),k=s.useCallback(w=>{if(w.key==="Backspace"&&m===""&&t.length>0){T(t.length-1);return}S.handleKeyDown(w)||(w.key==="Enter"||w.key==="Tab"||w.key===",")&&m.trim()&&(w.preventDefault(),v())},[m,t.length,T,S.handleKeyDown,v]),j=s.useCallback(()=>{y(),p.current=setTimeout(()=>{p.current=void 0,L.current(),S.dismiss()},io)},[y,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:()=>l.current?.focus(),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&l.current?.focus()},children:[t.map((w,_)=>d.jsx(Ka,{email:w.email,displayName:w.displayName,onRemove:()=>T(_)},w.email)),d.jsx("input",{ref:l,id:`address-field-${e}`,type:"text",value:m,onChange:w=>{S.reopen(),E(w.target.value)},onKeyDown:k,onBlur:j,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(ha,{id:S.listId,suggestions:O,activeIndex:S.activeIndex,optionId:S.optionId,onPick:w=>{const _=h.find(R=>R.email===w.value);_&&g(_)},onHighlight:S.setActiveIndex,label:`${e} suggestions`,className:"absolute left-12 right-0 z-50 mt-1 max-h-[200px] shadow-lg"})]})},uo=({state:e})=>e.status==="uploading"?d.jsx(or,{className:"size-4 shrink-0 animate-spin text-fg-subtle","aria-hidden":!0}):e.status==="failed"?d.jsx(pa,{className:"size-4 shrink-0 text-danger","aria-hidden":!0}):d.jsx(mr,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0});function lo({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:an("flex flex-col gap-1 px-3 py-2",r),children:e.map(a=>d.jsxs("li",{"data-testid":"compose-attachment","data-state":a.state.status,className:an("rounded-sm border bg-surface",a.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(uo,{state:a.state}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("bdi",{className:"block truncate text-sm text-fg",title:a.filename,children:a.filename}),d.jsxs("span",{className:"block text-2xs text-fg-subtle",children:[Ja(a.sizeBytes),a.state.status==="uploading"?" · Uploading…":""]})]}),a.state.status==="failed"&&a.state.retryable&&d.jsx("button",{type:"button",onClick:()=>n(a.key),className:"text-xs font-medium text-accent hover:underline",children:"Try again"}),d.jsx("button",{type:"button","aria-label":`Remove ${a.filename}`,onClick:()=>t(a.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(ar,{className:"size-4","aria-hidden":!0})})]}),a.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:a.state.reason})]},a.key))})}const fo=()=>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"})]});function mo({banner:e,header:t,children:n,quoted:r,attachments:a,actionBar:o,layout:i="fill"}){const c=i==="fill";return d.jsxs("div",{className:c?"flex h-full min-h-0 flex-col":"flex flex-col",children:[e,t,d.jsxs("div",{className:c?"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})]}),a&&d.jsx("div",{className:"shrink-0",children:a}),c?o:d.jsx("div",{className:"sticky bottom-0 z-10 bg-canvas",children:o})]})}const Ut=({label:e,onClick:t})=>d.jsx("button",{type:"button",onClick:t,className:"text-xs text-fg-muted hover:text-fg transition-colors",children:e}),ho=({to:e,cc:t,bcc:n,subject:r})=>{const a=[];return e.length>0&&a.push(`To: ${e.map(o=>o.displayName??o.email).join(", ")}`),t.length>0&&a.push(`Cc: ${t.length}`),n.length>0&&a.push(`Bcc: ${n.length}`),r&&a.push(r),a.join(" · ")},po=({collapsed:e=!1,summary:t="",onExpand:n,from:r,to:a,cc:o,bcc:i,subject:c,onShowCc:m,onShowBcc:f})=>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(sr,{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,a,o??d.jsxs("div",{className:"flex gap-2 pl-14",children:[d.jsx(Ut,{label:"Cc",onClick:m}),d.jsx(Ut,{label:"Bcc",onClick:f})]}),o&&!i&&d.jsx("div",{className:"pl-14",children:d.jsx(Ut,{label:"Bcc",onClick:f})}),i,c]}),hr="This message is attachments only, and attachments aren't forwarded — a forward would arrive with nothing of the original in it.",vo="This message is attachments only, so there's nothing to quote and your reply goes out without the original.",go=e=>e==="forward"?hr:vo,yo=({mode:e})=>d.jsx(ir,{tone:"warning","data-testid":"compose-quote-missing",children:d.jsx("span",{children:go(e)})}),sn="This account can't send mail until SMTP is configured.",wo=({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(va,{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:sn}),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(ga,{className:"size-3","aria-hidden":"true"})]})]})]}),bo=({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})]}),Eo=({text:e,html:t,senderName:n,date:r})=>{const[a,o]=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:()=>o(!a),"aria-expanded":a,className:"flex items-center gap-1 text-xs text-fg-muted hover:text-fg transition-colors",children:[a?d.jsx(sr,{className:"size-3"}):d.jsx(ya,{className:"size-3"}),i?`${i} wrote:`:"Show quoted text"]}),a&&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
+ `).map((c,m)=>d.jsx("p",{className:"min-h-[1.2em]",children:c},m))})]})},xo=["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"],So=["href","src","alt","colspan","rowspan","lang","dir"],Ro=/^(?:https?:|mailto:)/i,Co=/^(?:https:|data:image\/)/i,To="max-width:100%;height:auto",Ao=e=>{const t=wa();if(!t.isSupported)throw new Error("adopted HTML cannot be sanitized: no DOM is available");return t.addHook("afterSanitizeAttributes",n=>{if(n.tagName==="A"){Ro.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(!Co.test(n.getAttribute("src")??"")){n.remove();return}n.setAttribute("style",To)}}),t},kn=new Map,Do=e=>{const t=kn.get(e);if(t)return t;const n=Ao(e);return kn.set(e,n),n},pr=(e,t)=>Do(t).sanitize(e,{ALLOWED_TAGS:xo,ALLOWED_ATTR:So,ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1}),Mc=e=>pr(e,"outgoing"),No=e=>pr(e,"quoted"),Oo=e=>typeof e=="string"&&e.length>0?"rich":"plain",jc=(e,t)=>t.length>0,ko={plain:"Couldn't switch to plain text",rich:"Couldn't switch to rich text"},Fc=(e,t,n)=>t.trim()===""||n.trim()!==""?{outcome:"switch"}:{outcome:"blocked",title:ko[e],detail:"The conversion came back empty, so your message is unchanged."};function Ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a||!a.defaultPrevented)return t?.(a)}}function In(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Io(...e){return t=>{let n=!1;const r=e.map(a=>{const o=In(a,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let a=0;a<r.length;a++){const o=r[a];typeof o=="function"?o():In(e[a],null)}}}}function _e(...e){return s.useCallback(Io(...e),e)}function Po(e,t=[]){let n=[];function r(o,i){const c=s.createContext(i);c.displayName=o+"Context";const m=n.length;n=[...n,i];const f=u=>{const{scope:p,children:y,...x}=u,h=p?.[e]?.[m]||c,E=s.useMemo(()=>x,Object.values(x));return d.jsx(h.Provider,{value:E,children:y})};f.displayName=o+"Provider";function l(u,p,y={}){const{optional:x=!1}=y,h=p?.[e]?.[m]||c,E=s.useContext(h);if(E)return E;if(i!==void 0)return i;if(!x)throw new Error(`\`${u}\` must be used within \`${o}\``)}return[f,l]}const a=()=>{const o=n.map(i=>s.createContext(i));return function(c){const m=c?.[e]||o;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:m}}),[c,m])}};return a.scopeName=e,[r,Lo(a,...t)]}function Lo(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const i=r.reduce((c,{useScope:m,scopeName:f})=>{const u=m(o)[`__scope${f}`];return{...c,...u}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var rt=globalThis?.document?s.useLayoutEffect:()=>{},_o=mn[" useInsertionEffect ".trim().toString()]||rt;function Mo({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,o,i]=jo({defaultProp:t,onChange:n}),c=e!==void 0,m=c?e:a;{const l=s.useRef(e!==void 0);s.useEffect(()=>{const u=l.current;u!==c&&console.warn(`${r} is changing from ${u?"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.`),l.current=c},[c,r])}const f=s.useCallback(l=>{if(c){const u=Fo(l)?l(e):l;u!==e&&i.current?.(u)}else o(l)},[c,e,o,i]);return[m,f]}function jo({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),a=s.useRef(n),o=s.useRef(t);return _o(()=>{o.current=t},[t]),s.useEffect(()=>{a.current!==n&&(o.current?.(n),a.current=n)},[n,a]),[n,r,o]}function Fo(e){return typeof e=="function"}function vr(e){const t=s.forwardRef((n,r)=>{let{children:a,...o}=n,i=null,c=!1;const m=[];Pn(a)&&typeof wt=="function"&&(a=wt(a._payload)),s.Children.forEach(a,p=>{if(Wo(p)){c=!0;const y=p;let x="child"in y.props?y.props.child:y.props.children;Pn(x)&&typeof wt=="function"&&(x=wt(x._payload)),i=Bo(y,x),m.push(i?.props?.children)}else m.push(p)}),i?i=s.cloneElement(i,void 0,m):!c&&s.Children.count(a)===1&&s.isValidElement(a)&&(i=a);const f=i?Uo(i):void 0,l=_e(r,f);if(!i){if(a||a===0)throw new Error(c?Ko(e):qo(e));return a}const u=Ho(o,i.props??{});return i.type!==s.Fragment&&(u.ref=r?l:f),s.cloneElement(i,u)});return t.displayName=`${e}.Slot`,t}var $o=Symbol.for("radix.slottable"),Bo=(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 Ho(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...c)=>{const m=o(...c);return a(...c),m}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function Uo(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 Wo(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$o}var zo=Symbol.for("react.lazy");function Pn(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===zo&&"_payload"in e&&Vo(e._payload)}function Vo(e){return typeof e=="object"&&e!==null&&"then"in e}var qo=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Ko=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,wt=mn[" use ".trim().toString()],Yo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ye=Yo.reduce((e,t)=>{const n=vr(`Primitive.${t}`),r=s.forwardRef((a,o)=>{const{asChild:i,...c}=a,m=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Go(e,t){e&&cr.flushSync(()=>e.dispatchEvent(t))}function at(e){const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>((...n)=>t.current?.(...n)),[])}var Xo="DismissableLayer",cn="dismissableLayer.update",Qo="dismissableLayer.pointerDownOutside",Zo="dismissableLayer.focusOutside",Ln,hn=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),gr=s.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:c,onDismiss:m,...f}=e,l=s.useContext(hn),[u,p]=s.useState(null),y=u?.ownerDocument??globalThis?.document,[,x]=s.useState({}),h=_e(t,p),E=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),T=b?E.indexOf(b):-1,g=u?E.indexOf(u):-1,v=l.layersWithOutsidePointerEventsDisabled.size>0,A=g>=T,L=s.useRef(!1),S=rs(w=>{o?.(w),c?.(w),w.defaultPrevented||m?.()},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:l.dismissableSurfaces,shouldHandlePointerDownOutside:s.useCallback(w=>{if(!(w instanceof Node))return!1;const _=[...l.branches].some(R=>R.contains(w));return A&&!_},[l.branches,A])}),O=as(w=>{if(r&&L.current)return;const _=w.target;[...l.branches].some(W=>W.contains(_))||(i?.(w),c?.(w),w.defaultPrevented||m?.())},y),k=u?g===E.length-1:!1,j=at(w=>{w.key==="Escape"&&(a?.(w),!w.defaultPrevented&&m&&(w.preventDefault(),m()))});return s.useEffect(()=>{if(k)return y.addEventListener("keydown",j,{capture:!0}),()=>y.removeEventListener("keydown",j,{capture:!0})},[y,k,j]),s.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Ln=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),_n(),()=>{n&&(l.layersWithOutsidePointerEventsDisabled.delete(u),l.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=Ln))}},[u,y,n,l]),s.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),_n())},[u,l]),s.useEffect(()=>{const w=()=>x({});return document.addEventListener(cn,w),()=>document.removeEventListener(cn,w)},[]),d.jsx(ye.div,{...f,ref:h,style:{pointerEvents:v?A?"auto":"none":void 0,...e.style},onFocusCapture:Ce(e.onFocusCapture,O.onFocusCapture),onBlurCapture:Ce(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Ce(e.onPointerDownCapture,S.onPointerDownCapture)})});gr.displayName=Xo;var Jo="DismissableLayerBranch",es=s.forwardRef((e,t)=>{const n=s.useContext(hn),r=s.useRef(null),a=_e(t,r);return s.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),d.jsx(ye.div,{...e,ref:a})});es.displayName=Jo;function ts(){const e=s.useContext(hn),[t,n]=s.useState(null);return s.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var ns=()=>!0;function rs(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o,shouldHandlePointerDownOutside:i=ns}=t,c=at(e),m=s.useRef(!1),f=s.useRef(!1),l=s.useRef(new Map),u=s.useRef(()=>{});return s.useEffect(()=>{function p(){f.current=!1,a.current=!1,l.current.clear()}function y(){return Array.from(l.current.values()).some(Boolean)}function x(g){if(!f.current)return;const v=g.target;v instanceof Node&&[...o].some(L=>L.contains(v))||l.current.set(g.type,!0),g.type==="click"&&window.setTimeout(()=>{f.current&&u.current()},0)}function h(g){f.current&&l.current.set(g.type,!1)}const E=g=>{if(g.target&&!m.current){let v=function(){n.removeEventListener("click",u.current);const L=y();p(),L||yr(Qo,c,A,{discrete:!0})};if(!i(g.target)){n.removeEventListener("click",u.current),p(),m.current=!1;return}const A={originalEvent:g};f.current=!0,a.current=r&&g.button===0,l.current.clear(),!r||g.button!==0?v():(n.removeEventListener("click",u.current),u.current=v,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),p();m.current=!1},b=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const g of b)n.addEventListener(g,x,!0),n.addEventListener(g,h);const T=window.setTimeout(()=>{n.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(T),n.removeEventListener("pointerdown",E),n.removeEventListener("click",u.current);for(const g of b)n.removeEventListener(g,x,!0),n.removeEventListener(g,h)}},[n,c,r,a,o,i]),{onPointerDownCapture:()=>m.current=!0}}function as(e,t=globalThis?.document){const n=at(e),r=s.useRef(!1);return s.useEffect(()=>{const a=o=>{o.target&&!r.current&&yr(Zo,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function _n(){const e=new CustomEvent(cn);document.dispatchEvent(e)}function yr(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Go(a,o):a.dispatchEvent(o)}var bt=0,$e=null;function os(){s.useEffect(()=>{$e||($e={start:Mn(),end:Mn()});const{start:e,end:t}=$e;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),bt++,()=>{bt===1&&($e?.start.remove(),$e?.end.remove(),$e=null),bt=Math.max(0,bt-1)}},[])}function Mn(){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 Wt="focusScope.autoFocusOnMount",zt="focusScope.autoFocusOnUnmount",jn={bubbles:!1,cancelable:!0},ss="FocusScope",wr=s.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...i}=e,[c,m]=s.useState(null),f=at(a),l=at(o),u=s.useRef(null),p=_e(t,m),y=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(r){let h=function(g){if(y.paused||!c)return;const v=g.target;c.contains(v)?u.current=v:Se(u.current,{select:!0})},E=function(g){if(y.paused||!c)return;const v=g.relatedTarget;v!==null&&(c.contains(v)||Se(u.current,{select:!0}))},b=function(g){if(document.activeElement===document.body)for(const A of g)A.removedNodes.length>0&&Se(c)};document.addEventListener("focusin",h),document.addEventListener("focusout",E);const T=new MutationObserver(b);return c&&T.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",E),T.disconnect()}}},[r,c,y.paused]),s.useEffect(()=>{if(c){$n.add(y);const h=document.activeElement;if(!c.contains(h)){const b=new CustomEvent(Wt,jn);c.addEventListener(Wt,f),c.dispatchEvent(b),b.defaultPrevented||(is(fs(br(c)),{select:!0}),document.activeElement===h&&Se(c))}return()=>{c.removeEventListener(Wt,f),setTimeout(()=>{const b=new CustomEvent(zt,jn);c.addEventListener(zt,l),c.dispatchEvent(b),b.defaultPrevented||Se(h??document.body,{select:!0}),c.removeEventListener(zt,l),$n.remove(y)},0)}}},[c,f,l,y]);const x=s.useCallback(h=>{if(!n&&!r||y.paused)return;const E=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(E&&b){const T=h.currentTarget,[g,v]=cs(T);g&&v?!h.shiftKey&&b===v?(h.preventDefault(),n&&Se(g,{select:!0})):h.shiftKey&&b===g&&(h.preventDefault(),n&&Se(v,{select:!0})):b===T&&h.preventDefault()}},[n,r,y.paused]);return d.jsx(ye.div,{tabIndex:-1,...i,ref:p,onKeyDown:x})});wr.displayName=ss;function is(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Se(r,{select:t}),document.activeElement!==n)return}function cs(e){const t=br(e),n=Fn(t,e),r=Fn(t.reverse(),e);return[n,r]}function br(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Fn(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):us(r,{upTo:t})))return r}function us(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 ls(e){return e instanceof HTMLInputElement&&"select"in e}function Se(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ls(e)&&t&&e.select()}}var $n=ds();function ds(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Bn(e,t),e.unshift(t)},remove(t){e=Bn(e,t),e[0]?.resume()}}}function Bn(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function fs(e){return e.filter(t=>t.tagName!=="A")}var ms=mn[" useId ".trim().toString()]||(()=>{}),hs=0;function Vt(e){const[t,n]=s.useState(ms());return rt(()=>{n(r=>r??String(hs++))},[e]),e||(t?`radix-${t}`:"")}var ps="Portal",Er=s.forwardRef((e,t)=>{const{container:n,...r}=e,[a,o]=s.useState(!1);rt(()=>o(!0),[]);const i=n||a&&globalThis?.document?.body;return i?cr.createPortal(d.jsx(ye.div,{...r,ref:t}),i):null});Er.displayName=ps;function vs(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}var It=e=>{const{present:t,children:n}=e,r=gs(t),a=typeof n=="function"?n({present:r.isPresent}):s.Children.only(n),o=ys(r.ref,ws(a));return typeof n=="function"||r.isPresent?s.cloneElement(a,{ref:o}):null};It.displayName="Presence";function gs(e){const[t,n]=s.useState(),r=s.useRef(null),a=s.useRef(e),o=s.useRef("none"),i=s.useRef(void 0),c=e?"mounted":"unmounted",[m,f]=vs(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{m==="mounted"?(o.current=i.current??et(r.current),i.current=void 0):o.current="none"},[m]),rt(()=>{const l=r.current,u=a.current;if(u!==e){const y=o.current,x=et(l);e?(i.current=x,f("MOUNT")):x==="none"||l?.display==="none"?f("UNMOUNT"):f(u&&y!==x?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,f]),rt(()=>{if(t){let l;const u=t.ownerDocument.defaultView??window,p=x=>{const E=et(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&E&&(f("ANIMATION_END"),!a.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",l=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},y=x=>{x.target===t&&(o.current=et(r.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(l),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:s.useCallback(l=>{if(l){const u=getComputedStyle(l);r.current=u,i.current=et(u)}else r.current=null;n(l)},[])}}function Hn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ys(...e){const t=s.useRef(e);return t.current=e,s.useCallback(n=>{const r=t.current;let a=!1;const o=r.map(i=>{const c=Hn(i,n);return!a&&typeof c=="function"&&(a=!0),c});if(a)return()=>{for(let i=0;i<o.length;i++){const c=o[i];typeof c=="function"?c():Hn(r[i],null)}}},[])}function et(e){return e?.animationName||"none"}function ws(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 bs=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Be=new WeakMap,Et=new WeakMap,xt={},qt=0,xr=function(e){return e&&(e.host||xr(e.parentNode))},Es=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=xr(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})},xs=function(e,t,n,r){var a=Es(t,Array.isArray(e)?e:[e]);xt[n]||(xt[n]=new WeakMap);var o=xt[n],i=[],c=new Set,m=new Set(a),f=function(u){!u||c.has(u)||(c.add(u),f(u.parentNode))};a.forEach(f);var l=function(u){!u||m.has(u)||Array.prototype.forEach.call(u.children,function(p){if(c.has(p))l(p);else try{var y=p.getAttribute(r),x=y!==null&&y!=="false",h=(Be.get(p)||0)+1,E=(o.get(p)||0)+1;Be.set(p,h),o.set(p,E),i.push(p),h===1&&x&&Et.set(p,!0),E===1&&p.setAttribute(n,"true"),x||p.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return l(t),c.clear(),qt++,function(){i.forEach(function(u){var p=Be.get(u)-1,y=o.get(u)-1;Be.set(u,p),o.set(u,y),p||(Et.has(u)||u.removeAttribute(r),Et.delete(u)),y||u.removeAttribute(n)}),qt--,qt||(Be=new WeakMap,Be=new WeakMap,Et=new WeakMap,xt={})}},Ss=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=bs(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),xs(r,a,n,"aria-hidden")):function(){return null}},At="right-scroll-bar-position",Dt="width-before-scroll-bar",Rs="with-scroll-bars-hidden",Cs="--removed-body-scroll-bar-size";function Kt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ts(e,t){var n=s.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var As=typeof window<"u"?s.useLayoutEffect:s.useEffect,Un=new WeakMap;function Ds(e,t){var n=Ts(null,function(r){return e.forEach(function(a){return Kt(a,r)})});return As(function(){var r=Un.get(n);if(r){var a=new Set(r),o=new Set(e),i=n.current;a.forEach(function(c){o.has(c)||Kt(c,null)}),o.forEach(function(c){a.has(c)||Kt(c,i)})}Un.set(n,e)},[e]),n}function Ns(e){return e}function Os(e,t){t===void 0&&(t=Ns);var n=[],r=!1,a={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(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(o),i=n}var m=function(){var l=i;i=[],l.forEach(o)},f=function(){return Promise.resolve().then(m)};f(),n={push:function(l){i.push(l),f()},filter:function(l){return i=i.filter(l),n}}}};return a}function ks(e){e===void 0&&(e={});var t=Os(null);return t.options=Re({async:!0,ssr:!1},e),t}var Sr=function(e){var t=e.sideCar,n=ur(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,Re({},n))};Sr.isSideCarExport=!0;function Is(e,t){return e.useMedium(t),Sr}var Rr=ks(),Yt=function(){},Pt=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:Yt,onWheelCapture:Yt,onTouchMoveCapture:Yt}),a=r[0],o=r[1],i=e.forwardProps,c=e.children,m=e.className,f=e.removeScrollBar,l=e.enabled,u=e.shards,p=e.sideCar,y=e.noRelative,x=e.noIsolation,h=e.inert,E=e.allowPinchZoom,b=e.as,T=b===void 0?"div":b,g=e.gapMode,v=ur(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=p,L=Ds([n,t]),S=Re(Re({},v),a);return s.createElement(s.Fragment,null,l&&s.createElement(A,{sideCar:Rr,removeScrollBar:f,shards:u,noRelative:y,noIsolation:x,inert:h,setCallbacks:o,allowPinchZoom:!!E,lockRef:n,gapMode:g}),i?s.cloneElement(s.Children.only(c),Re(Re({},S),{ref:L})):s.createElement(T,Re({},S,{className:m,ref:L}),c))});Pt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Pt.classNames={fullWidth:Dt,zeroRight:At};var Ps=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Ls(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ps();return t&&e.setAttribute("nonce",t),e}function _s(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ms(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var js=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ls())&&(_s(t,n),Ms(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Fs=function(){var e=js();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Cr=function(){var e=Fs(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},$s={left:0,top:0,right:0,gap:0},Gt=function(e){return parseInt(e||"",10)||0},Bs=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[Gt(n),Gt(r),Gt(a)]},Hs=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return $s;var t=Bs(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])}},Us=Cr(),We="data-scroll-locked",Ws=function(e,t,n,r){var a=e.left,o=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
4
+ .`.concat(Rs,` {
5
+ overflow: hidden `).concat(r,`;
6
+ padding-right: `).concat(c,"px ").concat(r,`;
7
+ }
8
+ body[`).concat(We,`] {
9
+ overflow: hidden `).concat(r,`;
10
+ overscroll-behavior: contain;
11
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
12
+ padding-left: `.concat(a,`px;
13
+ padding-top: `).concat(o,`px;
14
+ padding-right: `).concat(i,`px;
15
+ margin-left:0;
16
+ margin-top:0;
17
+ margin-right: `).concat(c,"px ").concat(r,`;
18
+ `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
19
+ }
20
+
21
+ .`).concat(At,` {
22
+ right: `).concat(c,"px ").concat(r,`;
23
+ }
24
+
25
+ .`).concat(Dt,` {
26
+ margin-right: `).concat(c,"px ").concat(r,`;
27
+ }
28
+
29
+ .`).concat(At," .").concat(At,` {
30
+ right: 0 `).concat(r,`;
31
+ }
32
+
33
+ .`).concat(Dt," .").concat(Dt,` {
34
+ margin-right: 0 `).concat(r,`;
35
+ }
36
+
37
+ body[`).concat(We,`] {
38
+ `).concat(Cs,": ").concat(c,`px;
39
+ }
40
+ `)},Wn=function(){var e=parseInt(document.body.getAttribute(We)||"0",10);return isFinite(e)?e:0},zs=function(){s.useEffect(function(){return document.body.setAttribute(We,(Wn()+1).toString()),function(){var e=Wn()-1;e<=0?document.body.removeAttribute(We):document.body.setAttribute(We,e.toString())}},[])},Vs=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;zs();var o=s.useMemo(function(){return Hs(a)},[a]);return s.createElement(Us,{styles:Ws(o,!t,a,n?"":"!important")})},un=!1;if(typeof window<"u")try{var St=Object.defineProperty({},"passive",{get:function(){return un=!0,!0}});window.addEventListener("test",St,St),window.removeEventListener("test",St,St)}catch{un=!1}var He=un?{passive:!1}:!1,qs=function(e){return e.tagName==="TEXTAREA"},Tr=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!qs(e)&&n[t]==="visible")},Ks=function(e){return Tr(e,"overflowY")},Ys=function(e){return Tr(e,"overflowX")},zn=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=Ar(e,r);if(a){var o=Dr(e,r),i=o[1],c=o[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Gs=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Xs=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Ar=function(e,t){return e==="v"?Ks(t):Ys(t)},Dr=function(e,t){return e==="v"?Gs(t):Xs(t)},Qs=function(e,t){return e==="h"&&t==="rtl"?-1:1},Zs=function(e,t,n,r,a){var o=Qs(e,window.getComputedStyle(t).direction),i=o*r,c=n.target,m=t.contains(c),f=!1,l=i>0,u=0,p=0;do{if(!c)break;var y=Dr(e,c),x=y[0],h=y[1],E=y[2],b=h-E-o*x;(x||b)&&Ar(e,c)&&(u+=b,p+=x);var T=c.parentNode;c=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!m&&c!==document.body||m&&(t.contains(c)||t===c));return(l&&Math.abs(u)<1||!l&&Math.abs(p)<1)&&(f=!0),f},Rt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Vn=function(e){return[e.deltaX,e.deltaY]},qn=function(e){return e&&"current"in e?e.current:e},Js=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ei=function(e){return`
41
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
42
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
43
+ `)},ti=0,Ue=[];function ni(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),a=s.useState(ti++)[0],o=s.useState(Cr)[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(a));var h=ba([e.lockRef.current],(e.shards||[]).map(qn),!0).filter(Boolean);return h.forEach(function(E){return E.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),h.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(h,E){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var b=Rt(h),T=n.current,g="deltaX"in h?h.deltaX:T[0]-b[0],v="deltaY"in h?h.deltaY:T[1]-b[1],A,L=h.target,S=Math.abs(g)>Math.abs(v)?"h":"v";if("touches"in h&&S==="h"&&L.type==="range")return!1;var O=window.getSelection(),k=O&&O.anchorNode,j=k?k===L||k.contains(L):!1;if(j)return!1;var w=zn(S,L);if(!w)return!0;if(w?A=S:(A=S==="v"?"h":"v",w=zn(S,L)),!w)return!1;if(!r.current&&"changedTouches"in h&&(g||v)&&(r.current=A),!A)return!0;var _=r.current||A;return Zs(_,E,h,_==="h"?g:v)},[]),m=s.useCallback(function(h){var E=h;if(!(!Ue.length||Ue[Ue.length-1]!==o)){var b="deltaY"in E?Vn(E):Rt(E),T=t.current.filter(function(A){return A.name===E.type&&(A.target===E.target||E.target===A.shadowParent)&&Js(A.delta,b)})[0];if(T&&T.should){E.cancelable&&E.preventDefault();return}if(!T){var g=(i.current.shards||[]).map(qn).filter(Boolean).filter(function(A){return A.contains(E.target)}),v=g.length>0?c(E,g[0]):!i.current.noIsolation;v&&E.cancelable&&E.preventDefault()}}},[]),f=s.useCallback(function(h,E,b,T){var g={name:h,delta:E,target:b,should:T,shadowParent:ri(b)};t.current.push(g),setTimeout(function(){t.current=t.current.filter(function(v){return v!==g})},1)},[]),l=s.useCallback(function(h){n.current=Rt(h),r.current=void 0},[]),u=s.useCallback(function(h){f(h.type,Vn(h),h.target,c(h,e.lockRef.current))},[]),p=s.useCallback(function(h){f(h.type,Rt(h),h.target,c(h,e.lockRef.current))},[]);s.useEffect(function(){return Ue.push(o),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:p}),document.addEventListener("wheel",m,He),document.addEventListener("touchmove",m,He),document.addEventListener("touchstart",l,He),function(){Ue=Ue.filter(function(h){return h!==o}),document.removeEventListener("wheel",m,He),document.removeEventListener("touchmove",m,He),document.removeEventListener("touchstart",l,He)}},[]);var y=e.removeScrollBar,x=e.inert;return s.createElement(s.Fragment,null,x?s.createElement(o,{styles:ei(a)}):null,y?s.createElement(Vs,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ri(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ai=Is(Rr,ni);var Nr=s.forwardRef(function(e,t){return s.createElement(Pt,Re({},e,{ref:t,sideCar:ai}))});Nr.classNames=Pt.classNames;const $c=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=s.useCallback(a=>{const o=a.target;if(!(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable))for(const i of t){if(!(a.key.toLowerCase()===i.key.toLowerCase())||i.action&&Ea(i.action)||i.requireShift!==void 0&&i.requireShift!==a.shiftKey)continue;const m=a.ctrlKey||a.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==m)continue}else{const f=i.noModifiers??!0,l=m||a.altKey||i.requireShift===void 0&&a.shiftKey;if(f&&l)continue}i.preventDefault&&a.preventDefault(),i.stopPropagation&&(a.stopPropagation(),a.stopImmediatePropagation()),i.handler(a);return}},[t]);s.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},oi=e=>typeof e=="object"&&e!==null&&"code"in e&&e.code==="attachment_rejected"&&"message"in e&&typeof e.message=="string",si=new Set(["EmptyFile","UnusableFilename","FileTooLarge","TooManyAttachments"]),Kn={status:"uploading"},Or={status:"attached"},Ie=(e,t)=>({status:"failed",reason:e,retryable:t}),Xt=(e,t)=>oi(t)?Ie(t.message,!si.has(t.reason)):Ie(`"${e}" could not be attached: ${ke(t)??"the request failed"}. Try again.`,!0),ii=e=>({key:e.outboxAttachmentId,serverId:e.outboxAttachmentId,file:null,filename:e.filename,sizeBytes:e.sizeBytes,state:e.state==="Stored"?Or:Ie(`"${e.filename}" did not finish uploading. Remove it and attach it again.`,!1)});class ci{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;subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));getSnapshot=()=>this.snapshot;blockingReason=()=>{const[t]=this.removing.values();if(t!==void 0)return`Removing "${t}"…`;const n=this.entries.find(a=>a.state.status==="uploading");if(n)return`"${n.filename}" is still uploading.`;const r=this.entries.find(a=>a.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:a,state:o})=>({key:n,filename:r,sizeBytes:a,state:o}));for(const n of this.listeners)n()}patch(t,n,r){t===this.generation&&this.entries.some(a=>a.key===n)&&this.set(this.entries.map(a=>a.key===n?{...a,...r}:a))}reserve(t,n){let r=()=>{};const a=new Promise(o=>{r=()=>{this.reservationsInFlight.delete(a),o()}});return this.reservationsInFlight.add(a),{minted:this.deps.transport().mint(t,n),settle:r}}upload=async(t,n,r,a,o)=>{if(o.aborted)return;const i=this.deps.transport(),{minted:c,settle:m}=this.reserve(a,r),f=await c.catch(p=>(this.patch(t,n,{state:Xt(r.name,p)}),null));if(f!==null&&o.aborted&&this.mintedAfterRemoval.set(n,f.outboxAttachmentId),f!==null&&!o.aborted&&this.patch(t,n,{serverId:f.outboxAttachmentId,filename:f.filename}),m(),f===null||o.aborted)return;const l=await i.put(f.uploadUrl,r,o).then(()=>null,p=>ke(p)??"the connection dropped");if(o.aborted)return;if(l!==null){this.patch(t,n,{state:Ie(`"${f.filename}" did not finish uploading: ${l}. Try again.`,!0)});return}!await i.complete(a,f.outboxAttachmentId).then(()=>!0,p=>(this.patch(t,n,{state:Xt(f.filename,p)}),!1))||o.aborted||this.patch(t,n,{state:Or})};run=async(t,n,r,a,o)=>{await this.upload(t,n,r,a,o),this.inFlight.get(n)?.signal===o&&this.inFlight.delete(n)};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=>{const n=this.generation,r=t.map(o=>{this.nextKey+=1;const i={key:`local-${this.nextKey}`,serverId:null,file:o,filename:o.name,sizeBytes:o.size,state:Kn},c=new AbortController;return this.inFlight.set(i.key,c),{entry:i,file:o,signal:c.signal}});this.set([...this.entries,...r.map(({entry:o})=>o)]);const a=await this.deps.ensureDraft();if(a.outcome==="refused"){for(const{entry:o}of r)this.inFlight.delete(o.key),this.patch(n,o.key,{state:Ie(a.reason,!0)});return}n===this.generation&&(this.draftId=a.outboxMessageId,await Promise.all(r.map(({entry:o,file:i,signal:c})=>this.run(n,o.key,i,a.outboxMessageId,c))))};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,a=this.generation,o=new AbortController;this.inFlight.set(t,o),this.patch(a,t,{state:Kn,serverId:null});const i=await this.deps.ensureDraft();if(i.outcome==="refused"){this.inFlight.delete(t),this.patch(a,t,{state:Ie(i.reason,!0)});return}if(this.draftId=i.outboxMessageId,n.serverId!==null){const c=await this.syncKept(a);if(c!==null){this.inFlight.delete(t),this.patch(a,t,{serverId:n.serverId,state:Xt(r.name,c)});return}}await this.run(a,t,r,i.outboxMessageId,o.signal)};remove=async t=>{const n=this.entries.find(c=>c.key===t);if(!n)return;const r=this.generation,a=this.inFlight.get(t);if(this.set(this.entries.filter(c=>c.key!==t)),a&&(this.inFlight.delete(t),a.abort()),n.serverId===null&&!a)return;this.removing.set(t,n.filename),this.set(this.entries);const o=await this.syncKept(r);this.removing.delete(t),this.set(this.entries);const i=n.serverId??this.mintedAfterRemoval.get(t)??null;this.mintedAfterRemoval.delete(t),!(o===null||r!==this.generation)&&i!==null&&this.set([...this.entries,{...n,serverId:i,file:null,state:Ie(`"${n.filename}" could not be removed: ${ke(o)??"the request failed"}. It is still on the draft — remove it again.`,!1)}])};load=(t,n)=>{this.draftId=t,this.set(n.map(ii))};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.set([])}}const ui=(e,t,n)=>fetch(e,{method:"PUT",body:t,signal:n}).then(r=>{if(!r.ok)throw new Error(`the server answered ${r.status}`)}),li=({ensureDraft:e})=>{const t=Pe({...xa(),meta:Le}),n=Pe({...Sa(),meta:Le}),r=Pe({...lr(),meta:Le}),a=s.useRef(null);a.current={mint:(m,f)=>t.mutateAsync({path:{outboxMessageId:m},body:{filename:f.name,contentType:f.type||"application/octet-stream",sizeBytes:f.size}}),put:ui,complete:(m,f)=>n.mutateAsync({path:{outboxMessageId:m,outboxAttachmentId:f}}).then(()=>{}),keep:(m,f)=>r.mutateAsync({path:{outboxMessageId:m},body:{attachmentIds:f}}).then(()=>{})};const o=s.useRef(e);o.current=e;const[i]=s.useState(()=>new ci({transport:()=>{const m=a.current;if(!m)throw new Error("attachment transport not ready");return m},ensureDraft:()=>o.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,blockingReason:i.blockingReason()}},di=(e,t)=>e===void 0&&t.toAddresses.length===0,fi={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},Yn={status:"idle"},mi={status:"saving"},Gn={status:"saved"},Xn={status:"error"},hi=e=>e.then(()=>{},()=>{}),pi=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(Yn),[a,o]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),m=Ra(),f=s.useRef(e),l=s.useRef(e);if(f.current!==e){const g=f.current!==void 0;f.current=e,l.current=e,g&&i.current&&clearTimeout(i.current)}const u=Pe({...Ca(),meta:Le}),p=Pe({...lr(),meta:Le}),y=s.useCallback(async g=>{r(mi),o(null);const v=l.current;if(v){const L=await p.mutateAsync({path:{outboxMessageId:v},body:{toAddresses:g.toAddresses,ccAddresses:g.ccAddresses,bccAddresses:g.bccAddresses,subject:g.subject,textBody:g.textBody,htmlBody:g.htmlBody,inReplyTo:g.inReplyTo,references:g.references}});return r(Gn),L}const A=await u.mutateAsync({body:{...g,sendImmediately:!1}});return l.current=A.outboxMessageId,t(A.outboxMessageId),r(Gn),m.invalidateQueries({queryKey:Ta().queryKey}),A},[u.mutateAsync,p.mutateAsync,t,m]),x=s.useRef(Promise.resolve()),h=s.useCallback(g=>{const v=x.current.then(()=>y(g));return x.current=hi(v),v},[y]),E=s.useCallback(g=>{if(i.current&&clearTimeout(i.current),di(l.current,g)){r(fi);return}r(v=>v.status==="unsaved"?Yn:v),i.current=setTimeout(()=>{const v=l.current;v&&c.current.has(v)||h(g).catch(A=>{o(A),r(Xn)})},2e3)},[h]),b=s.useCallback(g=>(i.current&&clearTimeout(i.current),h(g).then(v=>({outcome:"saved",outboxMessageId:v.outboxMessageId})).catch(v=>(r(Xn),{outcome:"failed",error:v}))),[h]),T=s.useCallback(g=>{i.current&&clearTimeout(i.current),g&&c.current.add(g)},[]);return{saveState:n,saveError:a,saveDraft:E,saveImmediately:b,stopAutoSave:T}},vi=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,gi=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:vi(e),Qt=({label:e,addresses:t,onChange:n,placeholder:r,onPendingChange:a,ref:o})=>{const[i,c]=s.useState(""),m=Va(i,200),{data:f}=Ot({...Aa({query:{q:m,limit:8}}),enabled:m.length>=2}),l=s.useMemo(()=>(f?.items??[]).filter(gi).map(u=>({email:u.normalizedEmail,displayName:u.displayName})),[f]);return d.jsx(co,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:l,onQueryChange:c,onPendingChange:a,ref:o})},yi=({accountId:e,configureRef:t})=>{const n=qa();return d.jsx(wo,{configureRef:t,onConfigure:()=>{n(e)}})},wi={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},bi=e=>{const t=`Spellcheck for ${e.language} is off: ${wi[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Da(Na({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},Ei=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await dr(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-9h-DIyCe.js");return{openSpellcheckWorker:r}},__vite__mapDeps([0,1,2,3]));return n(t)},onStatus:t=>{t.state==="failed"&&e(bi(t))}}),kr=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),ln=e=>e.split(`
44
+ `).map(t=>`<p>${kr(t)}</p>`).join(""),xi=new Set(["ADDRESS","ARTICLE","BLOCKQUOTE","BR","DIV","H1","H2","H3","H4","H5","H6","HR","LI","OL","P","PRE","SECTION","TABLE","TR","UL"]),Si=e=>{const t=new DOMParser().parseFromString(e,"text/html"),n=[];let r="";const a=()=>{n.push(r.trim()),r=""},o=i=>{if(i.nodeType===i.TEXT_NODE){r+=(i.textContent??"").replace(/\s+/g," ");return}if(i.nodeType!==i.ELEMENT_NODE)return;const c=xi.has(i.tagName);c&&r!==""&&a();for(const m of i.childNodes)o(m);c&&a()};return o(t.body),r!==""&&a(),n.join(`
45
+ `).replace(/\n{3,}/g,`
46
+
47
+ `).trim()},Ri=e=>e.displayName?`${e.displayName} <${e.normalizedEmail}>`:e.normalizedEmail,Nt=e=>e.map(Ri).join(", "),Ir=e=>ka(e,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}),Ci=e=>{const t=Nt(e.from)||"the sender",n=Ir(e.date);return n?`On ${n}, ${t} wrote:`:`${t} wrote:`},Ti="---------- Forwarded message ----------",Ai=e=>{const t=[Ti,`From: ${Nt(e.from)}`,`Date: ${Ir(e.date)}`,`Subject: ${e.subject??""}`,`To: ${Nt(e.to)}`];return e.cc.length>0&&t.push(`Cc: ${Nt(e.cc)}`),t},Di=e=>e.split(`
48
+ `).map(t=>t===""?">":`> ${t}`),Ni=(e,t,n)=>{const r=n.kind==="text"?n.content.trim():Si(n.content),a=n.kind==="html"?n.content:ln(n.content.trim());if(e==="forward"){const i=Ai(t);return{text:[...i,"",r].join(`
49
+ `),html:`${ln(i.join(`
50
+ `))}${a}`}}const o=Ci(t);return{text:[o,...Di(r)].join(`
51
+ `),html:`<p>${kr(o)}</p><blockquote type="cite">${a}</blockquote>`}},Oi=(e,t)=>e===""?t:`${e}
52
+
53
+ ${t}`,Zt=(e,t,n,r)=>{const a=r?Oi(t.text,r.text):t.text;if(e==="plain")return{textBody:a||void 0,htmlBody:""};const o=r?`${t.html}${r.html}`:t.html;return{textBody:a||void 0,htmlBody:o?Oa(o,n):void 0}},Qn=150,ki=()=>{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>Qn}});return s.useEffect(()=>{if(typeof window>"u"||!window.visualViewport)return;const n=window.visualViewport,r=()=>{const a=n.height;t({viewportHeight:a,isKeyboardOpen:window.innerHeight-a>Qn})};return r(),n.addEventListener("resize",r),()=>n.removeEventListener("resize",r)},[]),e},Ii=({selectedAccountId:e,onSelect:t})=>{const{data:n}=Ot({...fr(),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 o=r[0];return o?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:o.email})]}):null}const a=r.some(o=>o.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:a?e:"",onChange:o=>{const i=r.find(c=>c.accountId===o.target.value);i&&t(i)},className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",children:[!a&&d.jsx("option",{value:"",disabled:!0,children:"Choose an account"}),r.map(o=>d.jsx("option",{value:o.accountId,children:o.email},o.accountId))]})]})},Pi=s.lazy(()=>dr(()=>import("./rich-text-D3RBxInX.js"),__vite__mapDeps([4,1,2,5,6,7,8,9,3,10,11,12,13,14])).then(e=>({default:e.ComposeBody}))),Li=e=>e?`<p></p><p>-- </p>${ln(e)}`:"",Jt=e=>({html:Li(e),text:e}),_i=e=>e?/^re:\s/i.test(e)?e:`Re: ${e}`:"Re: ",Mi=e=>e?/^fwd?:\s/i.test(e)?e:`Fwd: ${e}`:"Fwd: ",ji=(e,t,n)=>{const{envelope:r}=e,o=(r.replyTo.length>0?r.replyTo:r.from).map(f=>({email:f.normalizedEmail,displayName:f.displayName}));if(t!=="reply-all")return{to:o,cc:[]};const i=n?.toLowerCase(),c=new Set(o.map(f=>f.email.toLowerCase())),m=[...r.to,...r.cc].filter(f=>f.normalizedEmail.toLowerCase()!==i&&!c.has(f.normalizedEmail.toLowerCase())).map(f=>({email:f.normalizedEmail,displayName:f.displayName}));return{to:o,cc:m}},Zn=e=>{const t=e.envelope.messageIdValue,r=[...e.references.filter(a=>a.referenceType==="references").sort((a,o)=>a.referenceOrder-o.referenceOrder).map(a=>a.messageIdValue)];return t&&!r.includes(t)&&r.push(t),{inReplyTo:t,references:r}},Fi="Add a To address before sending.",$i="Loading the message you're quoting.",Bi="The message you're quoting couldn't be loaded, so it won't be included.",Hi="Add a To address before attaching a file — the draft the file is kept with is saved against it.",Ui=({label:e,text:t})=>`${e} holds "${t}", which is not an address.`,Jn=e=>e.find(t=>t.text.trim()!==""),Wi={entries:[],unparsed:""},zi=(e,t,n,r,a)=>e.length===0&&t.length===0&&n.length===0&&r.trim()===""&&a.text.trim()==="",Vi=({documentGeneration:e,selectedAccountId:t,onAccountChange:n,toAddresses:r,setToAddresses:a,ccAddresses:o,setCcAddresses:i,bccAddresses:c,setBccAddresses:m,showCc:f,setShowCc:l,showBcc:u,setShowBcc:p,subject:y,setSubject:x,fieldHandles:h,onToPendingChange:E})=>{const b=Ba(),{isKeyboardOpen:T}=ki(),[g,v]=s.useState(void 0),A=g===e;return d.jsx(po,{collapsed:!b&&T&&!A,onExpand:()=>v(e),summary:ho({to:r,cc:o,bcc:c,subject:y}),from:d.jsx(Ii,{selectedAccountId:t,onSelect:n}),to:d.jsx(Qt,{label:"To",addresses:r,onChange:a,placeholder:"Recipients",onPendingChange:E,ref:h.to}),cc:f?d.jsx(Qt,{label:"Cc",addresses:o,onChange:i,ref:h.cc}):void 0,bcc:u?d.jsx(Qt,{label:"Bcc",addresses:c,onChange:m,ref:h.bcc}):void 0,subject:d.jsx(bo,{value:y,onChange:x}),onShowCc:()=>l(!0),onShowBcc:()=>p(!0)})},Bc=({mode:e,account:t,sourceMessage:n,outboxMessageId:r,onDraftCreated:a,onClose:o,onAccountChange:i,layout:c="fill"})=>{const{startSendPolling:m}=Ia(),{pushError:f}=Pa(),[l,u]=s.useState([]),[p,y]=s.useState([]),[x,h]=s.useState([]),[E,b]=s.useState(Wi),T=s.useRef(null),g=s.useRef(null),v=s.useRef(null),A=s.useMemo(()=>({to:T,cc:g,bcc:v}),[]),L=s.useCallback(()=>{T.current?.clearPending(),g.current?.clearPending(),v.current?.clearPending()},[]),[S,O]=s.useState(""),[k,j]=s.useState(!1),[w,_]=s.useState(!1),[R,W]=s.useState(t?.accountId),[z,Q]=s.useState(!1),[K,te]=s.useState(r),ne=s.useRef(void 0),ie=s.useRef(!1),st=s.useRef(null),Ve=s.useRef(r),ce=s.useRef(r!==void 0),[we,qe]=s.useState(r!==void 0),Te=s.useRef(r!==void 0?e:void 0),fe=s.useRef(void 0),be=s.useRef(e);be.current=e;const Me=s.useRef(t?.accountId);s.useEffect(()=>{const D=t?.accountId;!D||Me.current===D||(Me.current=D,!ce.current&&W(D))},[t?.accountId]),s.useEffect(()=>{const D=Ve.current;if(D===r||(Ve.current=r,D===void 0))return;ce.current=r!==void 0,qe(r!==void 0),Te.current=r!==void 0?be.current:void 0,fe.current=void 0;const $=r?{html:"",text:""}:Jt(he.current);u([]),y([]),h([]),L(),O(""),j(!1),_(!1),Ge($.html),je($.text),Xe("rich"),Ee(void 0),Fe({...$,formatting:[]}),Ye(Z=>Z+1),Q(!1),ne.current=void 0,ie.current=!1,te(r)},[r,L]);const{signature:me}=Wa(R),he=s.useRef(me.plainText);he.current=me.plainText;const[Ke,Ye]=s.useState(0),[I,Ge]=s.useState(()=>Jt(me.plainText).html),[it,je]=s.useState(me.plainText),[pe,Xe]=s.useState("rich"),[J,ct]=s.useState("en"),[_t,Ee]=s.useState(),[ve,Fe]=s.useState(()=>({...Jt(me.plainText),formatting:[]})),{data:B,error:ut}=Ot({...La({path:{outboxMessageId:r??""}}),enabled:!!r&&!z,meta:Ha,retry:(D,$)=>!Tn($)&&D<1});s.useEffect(()=>{Tn(ut)&&o()},[ut,o]),s.useEffect(()=>{if(!B||z)return;u(B.toAddresses.map(q=>({email:q,displayName:void 0}))),B.ccAddresses&&B.ccAddresses.length>0&&(y(B.ccAddresses.map(q=>({email:q,displayName:void 0}))),j(!0)),B.bccAddresses&&B.bccAddresses.length>0&&(h(B.bccAddresses.map(q=>({email:q,displayName:void 0}))),_(!0)),B.subject&&O(B.subject);const D=_a(B.htmlBody??""),$=D.html,Z=B.textBody??"";Xe(Oo(B.htmlBody)),Ee(D.language??void 0),Ge($),je(Z),Fe({html:$,text:Z,formatting:[]}),Ye(q=>q+1),W(B.accountId),Q(!0),ie.current=!0},[B,z]),s.useEffect(()=>{if(n){if(ce.current&&Te.current===e){const D=fe.current;if(!D||D.myEmail===t?.email)return}if(Te.current=e,fe.current={myEmail:t?.email},L(),e==="reply"||e==="reply-all"){const{to:D,cc:$}=ji(n,e,t?.email);u(D),y($),$.length>0&&j(!0),O(_i(n.envelope.subject))}e==="forward"&&(u([]),y([]),h([]),O(Mi(n.envelope.subject)))}},[e,n,t?.email,L]);const ue=e==="reply"||e==="reply-all"||e==="forward",{data:Ae,isLoading:Qe,isError:Mt,hasNoRenderablePart:De,refetch:lt}=Ua({messageId:n?.message.messageId,bodyParts:n?.bodyParts,enabled:ue&&!!n}),dt=e==="forward"?"forward":"reply",ft=ue&&!n,mt=ue&&!we&&De,ht=mt&&dt==="forward",oe=s.useMemo(()=>{if(!ue||!n||we||!Ae)return;const D=Ae.kind==="html"?{kind:"html",content:No(Ae.body)}:{kind:"text",content:Ae.body};return Ni(e==="forward"?"forward":"reply",n.envelope,D)},[ue,n,we,Ae,e]),N=n?.envelope.from[0]?.displayName??n?.envelope.from[0]?.normalizedEmail,M=s.useCallback(D=>{Q(!0),te(D),a(D)},[a]),{saveState:F,saveError:P,saveDraft:H,saveImmediately:G,stopAutoSave:V}=pi({outboxMessageId:r,onDraftCreated:M}),le=s.useCallback(async()=>{if(r)return{outcome:"ready",outboxMessageId:r};if(!R)return{outcome:"refused",reason:"Choose an account to send from before attaching a file."};if(l.length===0)return{outcome:"refused",reason:Hi};const{htmlBody:D,textBody:$}=Zt(pe,ve,J,oe),Z=await G({accountId:R,toAddresses:l.map(q=>q.email),ccAddresses:p.length>0?p.map(q=>q.email):void 0,bccAddresses:x.length>0?x.map(q=>q.email):void 0,subject:S||void 0,textBody:$,htmlBody:D,...n&&(e==="reply"||e==="reply-all")?Zn(n):{}});return Z.outcome==="failed"?{outcome:"refused",reason:`The draft could not be saved, so the file was not attached: ${ke(Z.error)??"the request failed"}.`}:{outcome:"ready",outboxMessageId:Z.outboxMessageId}},[r,R,l,p,x,S,ve,pe,J,oe,n,e,G]),{items:ee,attach:ge,retry:de,remove:re,load:Ne,reset:Ze,blockingReason:jt}=li({ensureDraft:le}),yn=s.useRef(r);s.useEffect(()=>{const D=yn.current;D!==r&&(yn.current=r,D!==void 0&&Ze(r))},[r,Ze]);const wn=s.useRef(void 0);s.useEffect(()=>{!B||B.outboxMessageId!==r||wn.current!==B.outboxMessageId&&(wn.current=B.outboxMessageId,Ne(B.outboxMessageId,B.attachments))},[B,r,Ne]),s.useEffect(()=>{P&&f({title:"Couldn't save draft",detail:ke(P)??"Saving the draft failed.",error:P})},[P,f]);const bn=Pe({...Ma(),meta:Le}),En=Pe({...Fa(),meta:Le,onError:D=>{f(ja("Couldn't discard draft","The draft wasn't discarded.",D))}}),{data:ra}=Ot({...fr(),staleTime:1/0}),Je=ra?.accounts.find(D=>D.accountId===R),Ft=Je?za(Je):!1,pt=Je?.composeLanguages,aa=s.useMemo(()=>pt&&pt.length>0?pt:$a(navigator.languages),[pt]),oa=s.useMemo(()=>Ei(f),[f]),vt=s.useRef(!1),[xn,Sn]=s.useState(!1),gt=s.useCallback((D,$)=>xn?{status:"sending"}:R?Ft?{status:"blocked",reason:sn}:Qe||ft?{status:"blocked",reason:$i}:jt?{status:"blocked",reason:jt}:$?{status:"blocked",reason:Ui($)}:D===0?{status:"blocked",reason:Fi}:ht?{status:"blocked",reason:hr}:{status:"ready",accountId:R}:{status:"blocked",reason:"Choose an account to send from."},[xn,R,Ft,Qe,ft,jt,ht]),$t=s.useMemo(()=>gt(l.length+E.entries.length,Jn([{label:"To",text:E.unparsed}])),[gt,l.length,E]),sa=$t;s.useEffect(()=>{if(!R||vt.current||K!==void 0&&K!==r||r&&!z||zi(l,p,x,S,ve))return;const{htmlBody:D,textBody:$}=Zt(pe,ve,J,oe),Z={accountId:R,toAddresses:l.map(ae=>ae.email),ccAddresses:p.length>0?p.map(ae=>ae.email):void 0,bccAddresses:x.length>0?x.map(ae=>ae.email):void 0,subject:S||void 0,textBody:$,htmlBody:D},q=JSON.stringify(Z);if(ie.current){ie.current=!1,ne.current=q;return}ne.current!==q&&H(Z)},[R,r,K,z,l,p,x,S,ve,pe,J,oe,H]);const Rn=s.useCallback(async(D,$)=>{if(!vt.current){vt.current=!0,Sn(!0);try{V();const Z=n&&(e==="reply"||e==="reply-all")?Zn(n):{},{htmlBody:q,textBody:ae}=Zt(pe,ve,J,oe),ua=!r,yt=await G({accountId:D,toAddresses:$.to.map(xe=>xe.email),ccAddresses:$.cc.length>0?$.cc.map(xe=>xe.email):void 0,bccAddresses:$.bcc.length>0?$.bcc.map(xe=>xe.email):void 0,subject:S||void 0,textBody:ae,htmlBody:q,...Z});if(yt.outcome==="failed"){f({title:"Couldn't send message",detail:ke(yt.error)??"Saving the message failed, so nothing was sent. Try again.",error:yt.error});return}const Ht=yt.outboxMessageId;if(await bn.mutateAsync({path:{outboxMessageId:Ht}}).catch(xe=>(f({title:"Couldn't send message",detail:ke(xe)??(ua?"The draft was saved but the send request failed. Try again from the Outbox.":"The send request failed. Try again."),error:xe}),null))===null)return;V(Ht),m(Ht),o()}finally{vt.current=!1,Sn(!1)}}},[S,ve,pe,J,oe,e,n,r,G,bn,V,m,f,o]),ia=s.useCallback(()=>{V(r),r&&En.mutate({path:{outboxMessageId:r}}),o()},[V,r,En,o]),Bt=s.useCallback(D=>{f({title:"Can't send yet",detail:D}),D===sn&&st.current?.focus()},[f]),Cn=s.useCallback(()=>{if($t.status==="sending")return;const D=A.to.current?.commitPending(),$=A.cc.current?.commitPending(),Z=A.bcc.current?.commitPending(),q={to:D?.addresses??l,cc:$?.addresses??p,bcc:Z?.addresses??x},ae=gt(q.to.length,Jn([{label:"To",text:D?.unparsed??""},{label:"Cc",text:$?.unparsed??""},{label:"Bcc",text:Z?.unparsed??""}]));if(ae.status!=="sending"){if(ae.status==="blocked"){Bt(ae.reason);return}Rn(ae.accountId,q)}},[$t.status,A,l,p,x,gt,Bt,Rn]),ca=s.useCallback(D=>{W(D.accountId),i?.(D)},[i]);return d.jsx(mo,{layout:c,banner:d.jsxs(d.Fragment,{children:[Je&&Ft?d.jsx(yi,{accountId:Je.accountId,configureRef:st}):null,mt?d.jsx(yo,{mode:dt}):null,Mt?d.jsxs(ir,{tone:"warning","data-testid":"compose-quote-failed",children:[d.jsx("span",{children:Bi})," ",d.jsx("button",{type:"button",className:"underline",onClick:()=>{lt()},children:"Try again"})]}):null]}),header:d.jsx(Vi,{documentGeneration:Ke,selectedAccountId:R,onAccountChange:ca,toAddresses:l,setToAddresses:u,ccAddresses:p,setCcAddresses:y,bccAddresses:x,setBccAddresses:h,showCc:k,setShowCc:j,showBcc:w,setShowBcc:_,subject:S,setSubject:O,fieldHandles:A,onToPendingChange:b}),quoted:oe?d.jsx(Eo,{text:oe.text,html:oe.html,senderName:N}):void 0,attachments:d.jsx(lo,{items:ee,onRemove:D=>{re(D)},onRetry:D=>{de(D)}}),actionBar:d.jsx(no,{send:sa,onSend:Cn,onBlocked:Bt,onDiscard:ia,save:F,onAttach:D=>{ge(D)}}),children:d.jsx(s.Suspense,{fallback:d.jsx(fo,{}),children:d.jsx(Pi,{mode:pe,onModeChange:Xe,initialHtml:I,initialText:it,onChange:Fe,onSubmit:Cn,initialCaret:e==="new"?"start":void 0,onConversionError:f,languages:aa,initialLanguage:_t,onLanguageChange:ct,spellcheck:oa},Ke)})})};var Lt="Dialog",[Pr]=Po(Lt),[qi,se]=Pr(Lt),Lr=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:i=!0}=e,c=s.useRef(null),m=s.useRef(null),[f,l]=Mo({prop:r,defaultProp:a??!1,onChange:o,caller:Lt});return d.jsx(qi,{scope:t,triggerRef:c,contentRef:m,contentId:Vt(),titleId:Vt(),descriptionId:Vt(),open:f,onOpenChange:l,onOpenToggle:s.useCallback(()=>l(u=>!u),[l]),modal:i,children:n})};Lr.displayName=Lt;var _r="DialogTrigger",Ki=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=se(_r,n),o=_e(t,a.triggerRef);return d.jsx(ye.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":vn(a.open),...r,ref:o,onClick:Ce(e.onClick,a.onOpenToggle)})});Ki.displayName=_r;var pn="DialogPortal",[Yi,Mr]=Pr(pn,{forceMount:void 0}),jr=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=se(pn,t);return d.jsx(Yi,{scope:t,forceMount:n,children:s.Children.map(r,i=>d.jsx(It,{present:n||o.open,children:d.jsx(Er,{asChild:!0,container:a,children:i})}))})};jr.displayName=pn;var kt="DialogOverlay",Fr=s.forwardRef((e,t)=>{const n=Mr(kt,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=se(kt,e.__scopeDialog);return o.modal?d.jsx(It,{present:r||o.open,children:d.jsx(Xi,{...a,ref:t})}):null});Fr.displayName=kt;var Gi=vr("DialogOverlay.RemoveScroll"),Xi=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=se(kt,n),o=ts(),i=_e(t,o);return d.jsx(Nr,{as:Gi,allowPinchZoom:!0,shards:[a.contentRef],children:d.jsx(ye.div,{"data-state":vn(a.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),ze="DialogContent",$r=s.forwardRef((e,t)=>{const n=Mr(ze,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=se(ze,e.__scopeDialog);return d.jsx(It,{present:r||o.open,children:o.modal?d.jsx(Qi,{...a,ref:t}):d.jsx(Zi,{...a,ref:t})})});$r.displayName=ze;var Qi=s.forwardRef((e,t)=>{const n=se(ze,e.__scopeDialog),r=s.useRef(null),a=_e(t,n.contentRef,r);return s.useEffect(()=>{const o=r.current;if(o)return Ss(o)},[]),d.jsx(Br,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ce(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&o.preventDefault()}),onFocusOutside:Ce(e.onFocusOutside,o=>o.preventDefault())})}),Zi=s.forwardRef((e,t)=>{const n=se(ze,e.__scopeDialog),r=s.useRef(!1),a=s.useRef(!1);return d.jsx(Br,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const i=o.target;n.triggerRef.current?.contains(i)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),Br=s.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...i}=e,c=se(ze,n);return os(),d.jsx(d.Fragment,{children:d.jsx(wr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:d.jsx(gr,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":vn(c.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),Hr="DialogTitle",Ur=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=se(Hr,n);return d.jsx(ye.h2,{id:a.titleId,...r,ref:t})});Ur.displayName=Hr;var Wr="DialogDescription",Ji=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=se(Wr,n);return d.jsx(ye.p,{id:a.descriptionId,...r,ref:t})});Ji.displayName=Wr;var zr="DialogClose",ec=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=se(zr,n);return d.jsx(ye.button,{type:"button",...r,ref:t,onClick:Ce(e.onClick,()=>a.onOpenChange(!1))})});ec.displayName=zr;function vn(e){return e?"open":"closed"}function tc(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 Vr=C.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=C.useContext(Vr);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};tc(`[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(
54
+ [data-state=closed]
55
+ ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function nc(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function rc(){return gn(/^Mac/)}function ac(){return gn(/^iPhone/)}function er(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function oc(){return gn(/^iPad/)||rc()&&navigator.maxTouchPoints>1}function qr(){return ac()||oc()}function gn(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const sc=24,ic=typeof window<"u"?s.useLayoutEffect:s.useEffect;function tr(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const en=typeof document<"u"&&window.visualViewport;function nr(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Kr(e){for(nr(e)&&(e=e.parentElement);e&&!nr(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const cc=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Ct=0,tn;function uc(e={}){let{isDisabled:t}=e;ic(()=>{if(!t)return Ct++,Ct===1&&qr()&&(tn=lc()),()=>{Ct--,Ct===0&&tn?.()}},[t])}function lc(){let e,t=0,n=u=>{e=Kr(u.target),!(e===document.documentElement&&e===document.body)&&(t=u.changedTouches[0].pageY)},r=u=>{if(!e||e===document.documentElement||e===document.body){u.preventDefault();return}let p=u.changedTouches[0].pageY,y=e.scrollTop,x=e.scrollHeight-e.clientHeight;x!==0&&((y<=0&&p>t||y>=x&&p<t)&&u.preventDefault(),t=p)},a=u=>{let p=u.target;dn(p)&&p!==document.activeElement&&(u.preventDefault(),p.style.transform="translateY(-2000px)",p.focus(),requestAnimationFrame(()=>{p.style.transform=""}))},o=u=>{let p=u.target;dn(p)&&(p.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{p.style.transform="",en&&(en.height<window.innerHeight?requestAnimationFrame(()=>{rr(p)}):en.addEventListener("resize",()=>rr(p),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},c=window.pageXOffset,m=window.pageYOffset,f=tr(dc(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let l=tr(tt(document,"touchstart",n,{passive:!1,capture:!0}),tt(document,"touchmove",r,{passive:!1,capture:!0}),tt(document,"touchend",a,{passive:!1,capture:!0}),tt(document,"focus",o,!0),tt(window,"scroll",i));return()=>{f(),l(),window.scrollTo(c,m)}}function dc(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function tt(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function rr(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=Kr(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,a=e.getBoundingClientRect().top,o=e.getBoundingClientRect().bottom;const i=n.getBoundingClientRect().bottom+sc;o>i&&(n.scrollTop+=a-r)}e=n.parentElement}}function dn(e){return e instanceof HTMLInputElement&&!cc.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function fc(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function mc(...e){return t=>e.forEach(n=>fc(n,t))}function Yr(...e){return s.useCallback(mc(...e),e)}const Gr=new WeakMap;function X(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([a,o])=>{if(a.startsWith("--")){e.style.setProperty(a,o);return}r[a]=e.style[a],e.style[a]=o}),!n&&Gr.set(e,r)}function hc(e,t){if(!e||!(e instanceof HTMLElement))return;let n=Gr.get(e);n&&(e.style[t]=n[t])}const Y=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Tt(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[Y(t)?13:12]):(a=r.match(/^matrix\((.+)\)$/),a?parseFloat(a[1].split(", ")[Y(t)?5:4]):null)}function pc(e){return 8*(Math.log(e+1)-2)}function nn(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function vc(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const U={DURATION:.5,EASE:[.32,.72,0,1]},Xr=.4,gc=.25,yc=100,Qr=8,Oe=16,fn=26,rn="vaul-dragging";function Zr(e){const t=C.useRef(e);return C.useEffect(()=>{t.current=e}),C.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function wc({defaultProp:e,onChange:t}){const n=C.useState(e),[r]=n,a=C.useRef(r),o=Zr(t);return C.useEffect(()=>{a.current!==r&&(o(r),a.current=r)},[r,a,o]),n}function Jr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,a]=wc({defaultProp:t,onChange:n}),o=e!==void 0,i=o?e:r,c=Zr(n),m=C.useCallback(f=>{if(o){const u=typeof f=="function"?f(e):f;u!==e&&c(u)}else a(f)},[o,e,a,c]);return[i,m]}function bc({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:a,fadeFromIndex:o,onSnapPointChange:i,direction:c="bottom",container:m,snapToSequentialPoint:f}){const[l,u]=Jr({prop:e,defaultProp:n?.[0],onChange:t}),[p,y]=C.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);C.useEffect(()=>{function S(){y({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=C.useMemo(()=>l===n?.[n.length-1]||null,[n,l]),h=C.useMemo(()=>{var S;return(S=n?.findIndex(O=>O===l))!=null?S:null},[n,l]),E=n&&n.length>0&&(o||o===0)&&!Number.isNaN(o)&&n[o]===l||!n,b=C.useMemo(()=>{const S=m?{width:m.getBoundingClientRect().width,height:m.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var O;return(O=n?.map(k=>{const j=typeof k=="string";let w=0;if(j&&(w=parseInt(k,10)),Y(c)){const R=j?w:p?k*S.height:0;return p?c==="bottom"?S.height-R:-S.height+R:R}const _=j?w:p?k*S.width:0;return p?c==="right"?S.width-_:-S.width+_:_}))!=null?O:[]},[n,p,m]),T=C.useMemo(()=>h!==null?b?.[h]:null,[b,h]),g=C.useCallback(S=>{var O;const k=(O=b?.findIndex(j=>j===S))!=null?O:null;i(k),X(r.current,{transition:`transform ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,transform:Y(c)?`translate3d(0, ${S}px, 0)`:`translate3d(${S}px, 0, 0)`}),b&&k!==b.length-1&&o!==void 0&&k!==o&&k<o?X(a.current,{transition:`opacity ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,opacity:"0"}):X(a.current,{transition:`opacity ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,opacity:"1"}),u(n?.[Math.max(k,0)])},[r.current,n,b,o,a,u]);C.useEffect(()=>{if(l||e){var S;const O=(S=n?.findIndex(k=>k===e||k===l))!=null?S:-1;b&&O!==-1&&typeof b[O]=="number"&&g(b[O])}},[l,e,n,b,g]);function v({draggedDistance:S,closeDrawer:O,velocity:k,dismissible:j}){if(o===void 0)return;const w=c==="bottom"||c==="right"?(T??0)-S:(T??0)+S,_=h===o-1,R=h===0,W=S>0;if(_&&X(a.current,{transition:`opacity ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`}),!f&&k>2&&!W){j?O():g(b[0]);return}if(!f&&k>2&&W&&b&&n){g(b[n.length-1]);return}const z=b?.reduce((K,te)=>typeof K!="number"||typeof te!="number"?K:Math.abs(te-w)<Math.abs(K-w)?te:K),Q=Y(c)?window.innerHeight:window.innerWidth;if(k>Xr&&Math.abs(S)<Q*.4){const K=W?1:-1;if(K>0&&x&&n){g(b[n.length-1]);return}if(R&&K<0&&j&&O(),h===null)return;g(b[h+K]);return}g(z)}function A({draggedDistance:S}){if(T===null)return;const O=c==="bottom"||c==="right"?T-S:T+S;(c==="bottom"||c==="right")&&O<b[b.length-1]||(c==="top"||c==="left")&&O>b[b.length-1]||X(r.current,{transform:Y(c)?`translate3d(0, ${O}px, 0)`:`translate3d(${O}px, 0, 0)`})}function L(S,O){if(!n||typeof h!="number"||!b||o===void 0)return null;const k=h===o-1;if(h>=o&&O)return 0;if(k&&!O)return 1;if(!E&&!k)return null;const w=k?h+1:h-1,_=k?b[w]-b[w-1]:b[w+1]-b[w],R=S/Math.abs(_);return k?1-R:R}return{isLastSnapPoint:x,activeSnapPoint:l,shouldFade:E,getPercentageDragged:L,setActiveSnapPoint:u,activeSnapPointIndex:h,onRelease:v,onDrag:A,snapPointsOffset:b}}const Ec=()=>()=>{};function xc(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=ot(),o=C.useRef(null),i=s.useMemo(()=>document.body.style.backgroundColor,[]);function c(){return(window.innerWidth-fn)/window.innerWidth}C.useEffect(()=>{if(t&&n){o.current&&clearTimeout(o.current);const m=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!m)return;vc(r&&!a?nn(document.body,{background:"black"}):Ec,nn(m,{transformOrigin:Y(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${U.DURATION}s`,transitionTimingFunction:`cubic-bezier(${U.EASE.join(",")})`}));const f=nn(m,{borderRadius:`${Qr}px`,overflow:"hidden",...Y(e)?{transform:`scale(${c()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${c()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{f(),o.current=window.setTimeout(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},U.DURATION*1e3)}}},[t,n,i])}let nt=null;function Sc({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:o}){const[i,c]=C.useState(()=>typeof window<"u"?window.location.href:""),m=C.useRef(0),f=C.useCallback(()=>{if(er()&&nt===null&&e&&!o){nt={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:u,innerHeight:p}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-m.current}px`,left:`${-u}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const y=p-window.innerHeight;y&&m.current>=p&&(document.body.style.top=`${-(m.current+y)}px`)}),300)}},[e]),l=C.useCallback(()=>{if(er()&&nt!==null&&!o){const u=-parseInt(document.body.style.top,10),p=-parseInt(document.body.style.left,10);Object.assign(document.body.style,nt),window.requestAnimationFrame(()=>{if(a&&i!==window.location.href){c(window.location.href);return}window.scrollTo(p,u)}),nt=null}},[i]);return C.useEffect(()=>{function u(){m.current=window.scrollY}return u(),window.addEventListener("scroll",u),()=>{window.removeEventListener("scroll",u)}},[]),C.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||l()}},[t,l]),C.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&f(),t||window.setTimeout(()=>{l()},500)):l())},[e,r,i,t,n,f,l]),{restorePositionSetting:l}}function Rc({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:a,snapPoints:o,shouldScaleBackground:i=!1,setBackgroundColorOnScale:c=!0,closeThreshold:m=gc,scrollLockTimeout:f=yc,dismissible:l=!0,handleOnly:u=!1,fadeFromIndex:p=o&&o.length-1,activeSnapPoint:y,setActiveSnapPoint:x,fixed:h,modal:E=!0,onClose:b,nested:T,noBodyStyles:g=!1,direction:v="bottom",defaultOpen:A=!1,disablePreventScroll:L=!0,snapToSequentialPoint:S=!1,preventScrollRestoration:O=!1,repositionInputs:k=!0,onAnimationEnd:j,container:w,autoFocus:_=!1}){var R,W;const[z=!1,Q]=Jr({defaultProp:A,prop:e,onChange:N=>{t?.(N),!N&&!T&&ut(),setTimeout(()=>{j?.(N)},U.DURATION*1e3),N&&!E&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),N||(document.body.style.pointerEvents="auto")}}),[K,te]=C.useState(!1),[ne,ie]=C.useState(!1),[st,Ve]=C.useState(!1),ce=C.useRef(null),we=C.useRef(null),qe=C.useRef(null),Te=C.useRef(null),fe=C.useRef(null),be=C.useRef(!1),Me=C.useRef(null),me=C.useRef(0),he=C.useRef(!1),Ke=C.useRef(!A),Ye=C.useRef(0),I=C.useRef(null),Ge=C.useRef(((R=I.current)==null?void 0:R.getBoundingClientRect().height)||0),it=C.useRef(((W=I.current)==null?void 0:W.getBoundingClientRect().width)||0),je=C.useRef(0),pe=C.useCallback(N=>{o&&N===Ee.length-1&&(we.current=new Date)},[]),{activeSnapPoint:Xe,activeSnapPointIndex:J,setActiveSnapPoint:ct,onRelease:_t,snapPointsOffset:Ee,onDrag:ve,shouldFade:Fe,getPercentageDragged:B}=bc({snapPoints:o,activeSnapPointProp:y,setActiveSnapPointProp:x,drawerRef:I,fadeFromIndex:p,overlayRef:ce,onSnapPointChange:pe,direction:v,container:w,snapToSequentialPoint:S});uc({isDisabled:!z||ne||!E||st||!K||!k||!L});const{restorePositionSetting:ut}=Sc({isOpen:z,modal:E,nested:T??!1,hasBeenOpened:K,preventScrollRestoration:O,noBodyStyles:g});function ue(){return(window.innerWidth-fn)/window.innerWidth}function Ae(N){var M,F;!l&&!o||I.current&&!I.current.contains(N.target)||(Ge.current=((M=I.current)==null?void 0:M.getBoundingClientRect().height)||0,it.current=((F=I.current)==null?void 0:F.getBoundingClientRect().width)||0,ie(!0),qe.current=new Date,qr()&&window.addEventListener("touchend",()=>be.current=!1,{once:!0}),N.target.setPointerCapture(N.pointerId),me.current=Y(v)?N.pageY:N.pageX)}function Qe(N,M){var F;let P=N;const H=(F=window.getSelection())==null?void 0:F.toString(),G=I.current?Tt(I.current,v):null,V=new Date;if(P.tagName==="SELECT"||P.hasAttribute("data-vaul-no-drag")||P.closest("[data-vaul-no-drag]"))return!1;if(v==="right"||v==="left")return!0;if(we.current&&V.getTime()-we.current.getTime()<500)return!1;if(G!==null&&(v==="bottom"?G>0:G<0))return!0;if(H&&H.length>0)return!1;if(fe.current&&V.getTime()-fe.current.getTime()<f&&G===0||M)return fe.current=V,!1;for(;P;){if(P.scrollHeight>P.clientHeight){if(P.scrollTop!==0)return fe.current=new Date,!1;if(P.getAttribute("role")==="dialog")return!0}P=P.parentNode}return!0}function Mt(N){if(I.current&&ne){const M=v==="bottom"||v==="right"?1:-1,F=(me.current-(Y(v)?N.pageY:N.pageX))*M,P=F>0,H=o&&!l&&!P;if(H&&J===0)return;const G=Math.abs(F),V=document.querySelector("[data-vaul-drawer-wrapper]"),le=v==="bottom"||v==="top"?Ge.current:it.current;let ee=G/le;const ge=B(G,P);if(ge!==null&&(ee=ge),H&&ee>=1||!be.current&&!Qe(N.target,P))return;if(I.current.classList.add(rn),be.current=!0,X(I.current,{transition:"none"}),X(ce.current,{transition:"none"}),o&&ve({draggedDistance:F}),P&&!o){const re=pc(F),Ne=Math.min(re*-1,0)*M;X(I.current,{transform:Y(v)?`translate3d(0, ${Ne}px, 0)`:`translate3d(${Ne}px, 0, 0)`});return}const de=1-ee;if((Fe||p&&J===p-1)&&(r?.(N,ee),X(ce.current,{opacity:`${de}`,transition:"none"},!0)),V&&ce.current&&i){const re=Math.min(ue()+ee*(1-ue()),1),Ne=8-ee*8,Ze=Math.max(0,14-ee*14);X(V,{borderRadius:`${Ne}px`,transform:Y(v)?`scale(${re}) translate3d(0, ${Ze}px, 0)`:`scale(${re}) translate3d(${Ze}px, 0, 0)`,transition:"none"},!0)}if(!o){const re=G*M;X(I.current,{transform:Y(v)?`translate3d(0, ${re}px, 0)`:`translate3d(${re}px, 0, 0)`})}}}C.useEffect(()=>{window.requestAnimationFrame(()=>{Ke.current=!0})},[]),C.useEffect(()=>{var N;function M(){if(!I.current||!k)return;const F=document.activeElement;if(dn(F)||he.current){var P;const H=((P=window.visualViewport)==null?void 0:P.height)||0,G=window.innerHeight;let V=G-H;const le=I.current.getBoundingClientRect().height||0,ee=le>G*.8;je.current||(je.current=le);const ge=I.current.getBoundingClientRect().top;if(Math.abs(Ye.current-V)>60&&(he.current=!he.current),o&&o.length>0&&Ee&&J){const de=Ee[J]||0;V+=de}if(Ye.current=V,le>H||he.current){const de=I.current.getBoundingClientRect().height;let re=de;de>H&&(re=H-(ee?ge:fn)),h?I.current.style.height=`${de-Math.max(V,0)}px`:I.current.style.height=`${Math.max(re,H-ge)}px`}else nc()||(I.current.style.height=`${je.current}px`);o&&o.length>0&&!he.current?I.current.style.bottom="0px":I.current.style.bottom=`${Math.max(V,0)}px`}}return(N=window.visualViewport)==null||N.addEventListener("resize",M),()=>{var F;return(F=window.visualViewport)==null?void 0:F.removeEventListener("resize",M)}},[J,o,Ee]);function De(N){dt(),b?.(),N||Q(!1),setTimeout(()=>{o&&ct(o[0])},U.DURATION*1e3)}function lt(){if(!I.current)return;const N=document.querySelector("[data-vaul-drawer-wrapper]"),M=Tt(I.current,v);X(I.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`}),X(ce.current,{transition:`opacity ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,opacity:"1"}),i&&M&&M>0&&z&&X(N,{borderRadius:`${Qr}px`,overflow:"hidden",...Y(v)?{transform:`scale(${ue()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${ue()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${U.DURATION}s`,transitionTimingFunction:`cubic-bezier(${U.EASE.join(",")})`},!0)}function dt(){!ne||!I.current||(I.current.classList.remove(rn),be.current=!1,ie(!1),Te.current=new Date)}function ft(N){if(!ne||!I.current)return;I.current.classList.remove(rn),be.current=!1,ie(!1),Te.current=new Date;const M=Tt(I.current,v);if(!N||!Qe(N.target,!1)||!M||Number.isNaN(M)||qe.current===null)return;const F=Te.current.getTime()-qe.current.getTime(),P=me.current-(Y(v)?N.pageY:N.pageX),H=Math.abs(P)/F;if(H>.05&&(Ve(!0),setTimeout(()=>{Ve(!1)},200)),o){_t({draggedDistance:P*(v==="bottom"||v==="right"?1:-1),closeDrawer:De,velocity:H,dismissible:l}),a?.(N,!0);return}if(v==="bottom"||v==="right"?P>0:P<0){lt(),a?.(N,!0);return}if(H>Xr){De(),a?.(N,!1);return}var G;const V=Math.min((G=I.current.getBoundingClientRect().height)!=null?G:0,window.innerHeight);var le;const ee=Math.min((le=I.current.getBoundingClientRect().width)!=null?le:0,window.innerWidth),ge=v==="left"||v==="right";if(Math.abs(M)>=(ge?ee:V)*m){De(),a?.(N,!1);return}a?.(N,!0),lt()}C.useEffect(()=>(z&&(X(document.documentElement,{scrollBehavior:"auto"}),we.current=new Date),()=>{hc(document.documentElement,"scrollBehavior")}),[z]);function mt(N){const M=N?(window.innerWidth-Oe)/window.innerWidth:1,F=N?-Oe:0;Me.current&&window.clearTimeout(Me.current),X(I.current,{transition:`transform ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,transform:Y(v)?`scale(${M}) translate3d(0, ${F}px, 0)`:`scale(${M}) translate3d(${F}px, 0, 0)`}),!N&&I.current&&(Me.current=setTimeout(()=>{const P=Tt(I.current,v);X(I.current,{transition:"none",transform:Y(v)?`translate3d(0, ${P}px, 0)`:`translate3d(${P}px, 0, 0)`})},500))}function ht(N,M){if(M<0)return;const F=(window.innerWidth-Oe)/window.innerWidth,P=F+M*(1-F),H=-Oe+M*Oe;X(I.current,{transform:Y(v)?`scale(${P}) translate3d(0, ${H}px, 0)`:`scale(${P}) translate3d(${H}px, 0, 0)`,transition:"none"})}function oe(N,M){const F=Y(v)?window.innerHeight:window.innerWidth,P=M?(F-Oe)/F:1,H=M?-Oe:0;M&&X(I.current,{transition:`transform ${U.DURATION}s cubic-bezier(${U.EASE.join(",")})`,transform:Y(v)?`scale(${P}) translate3d(0, ${H}px, 0)`:`scale(${P}) translate3d(${H}px, 0, 0)`})}return C.useEffect(()=>{E||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[E]),C.createElement(Lr,{defaultOpen:A,onOpenChange:N=>{!l&&!N||(N?te(!0):De(!0),Q(N))},open:z},C.createElement(Vr.Provider,{value:{activeSnapPoint:Xe,snapPoints:o,setActiveSnapPoint:ct,drawerRef:I,overlayRef:ce,onOpenChange:t,onPress:Ae,onRelease:ft,onDrag:Mt,dismissible:l,shouldAnimate:Ke,handleOnly:u,isOpen:z,isDragging:ne,shouldFade:Fe,closeDrawer:De,onNestedDrag:ht,onNestedOpenChange:mt,onNestedRelease:oe,keyboardIsOpen:he,modal:E,snapPointsOffset:Ee,activeSnapPointIndex:J,direction:v,shouldScaleBackground:i,setBackgroundColorOnScale:c,noBodyStyles:g,container:w,autoFocus:_}},n))}const ea=C.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:a,shouldFade:o,isOpen:i,modal:c,shouldAnimate:m}=ot(),f=Yr(t,n),l=r&&r.length>0;if(!c)return null;const u=C.useCallback(p=>a(p),[a]);return C.createElement(Fr,{onMouseUp:u,ref:f,"data-vaul-overlay":"","data-vaul-snap-points":i&&l?"true":"false","data-vaul-snap-points-overlay":i&&o?"true":"false","data-vaul-animate":m?.current?"true":"false",...e})});ea.displayName="Drawer.Overlay";const ta=C.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},a){const{drawerRef:o,onPress:i,onRelease:c,onDrag:m,keyboardIsOpen:f,snapPointsOffset:l,activeSnapPointIndex:u,modal:p,isOpen:y,direction:x,snapPoints:h,container:E,handleOnly:b,shouldAnimate:T,autoFocus:g}=ot(),[v,A]=C.useState(!1),L=Yr(a,o),S=C.useRef(null),O=C.useRef(null),k=C.useRef(!1),j=h&&h.length>0;xc();const w=(R,W,z=0)=>{if(k.current)return!0;const Q=Math.abs(R.y),K=Math.abs(R.x),te=K>Q,ne=["bottom","right"].includes(W)?1:-1;if(W==="left"||W==="right"){if(!(R.x*ne<0)&&K>=0&&K<=z)return te}else if(!(R.y*ne<0)&&Q>=0&&Q<=z)return!te;return k.current=!0,!0};C.useEffect(()=>{j&&window.requestAnimationFrame(()=>{A(!0)})},[]);function _(R){S.current=null,k.current=!1,c(R)}return C.createElement($r,{"data-vaul-drawer-direction":x,"data-vaul-drawer":"","data-vaul-delayed-snap-points":v?"true":"false","data-vaul-snap-points":y&&j?"true":"false","data-vaul-custom-container":E?"true":"false","data-vaul-animate":T?.current?"true":"false",...r,ref:L,style:l&&l.length>0?{"--snap-point-height":`${l[u??0]}px`,...t}:t,onPointerDown:R=>{b||(r.onPointerDown==null||r.onPointerDown.call(r,R),S.current={x:R.pageX,y:R.pageY},i(R))},onOpenAutoFocus:R=>{n?.(R),g||R.preventDefault()},onPointerDownOutside:R=>{if(e?.(R),!p||R.defaultPrevented){R.preventDefault();return}f.current&&(f.current=!1)},onFocusOutside:R=>{if(!p){R.preventDefault();return}},onPointerMove:R=>{if(O.current=R,b||(r.onPointerMove==null||r.onPointerMove.call(r,R),!S.current))return;const W=R.pageY-S.current.y,z=R.pageX-S.current.x,Q=R.pointerType==="touch"?10:2;w({x:z,y:W},x,Q)?m(R):(Math.abs(z)>Q||Math.abs(W)>Q)&&(S.current=null)},onPointerUp:R=>{r.onPointerUp==null||r.onPointerUp.call(r,R),S.current=null,k.current=!1,c(R)},onPointerOut:R=>{r.onPointerOut==null||r.onPointerOut.call(r,R),_(O.current)},onContextMenu:R=>{r.onContextMenu==null||r.onContextMenu.call(r,R),O.current&&_(O.current)}})});ta.displayName="Drawer.Content";const Cc=250,Tc=120,na=C.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:a,isDragging:o,snapPoints:i,activeSnapPoint:c,setActiveSnapPoint:m,dismissible:f,handleOnly:l,isOpen:u,onPress:p,onDrag:y}=ot(),x=C.useRef(null),h=C.useRef(!1);function E(){if(h.current){g();return}window.setTimeout(()=>{b()},Tc)}function b(){if(o||e||h.current){g();return}if(g(),!i||i.length===0){f||a();return}if(c===i[i.length-1]&&f){a();return}const A=i.findIndex(S=>S===c);if(A===-1)return;const L=i[A+1];m(L)}function T(){x.current=window.setTimeout(()=>{h.current=!0},Cc)}function g(){x.current&&window.clearTimeout(x.current),h.current=!1}return C.createElement("div",{onClick:E,onPointerCancel:g,onPointerDown:v=>{l&&p(v),T()},onPointerMove:v=>{l&&y(v)},ref:r,"data-vaul-drawer-visible":u?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},C.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});na.displayName="Drawer.Handle";function Ac(e){const t=ot(),{container:n=t.container,...r}=e;return C.createElement(jr,{container:n,...r})}const Hc={Root:Rc,Content:ta,Overlay:ea,Portal:Ac,Handle:na,Title:Ur};export{Bc as C,Hc as D,mr as P,Mc as a,jc as b,Fc as c,Ja as f,_c as s,$c as u};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-UydO8d8c.js";import{M as r}from"./MailboxPane-Czwm70WW.js";import"./useSearchTokenContext-CBDSw3gJ.js";import"./kbd-Dr4usi4j.js";import"./useMessageBodyContent-DiiU1g37.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-BUZDaiTn.js";import"./circle-check-big-DrhQmTbc.js";import"./refresh-cw-Qp6f0dRu.js";import"./useQueries-CJUjXxvq.js";import"./MailListHeader-DfOCZnRx.js";import"./roving-focus-BNBmBfAx.js";import"./search-token-index-AOAqpH15.js";import"./popover-menu--AoVAv-y.js";import"./mail-Db9OjHYL.js";import"./avatar-Dq9zVRVl.js";import"./index-D4ZeuNuq.js";import"./useSignature-DruMb0cI.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dt6rAAol.js";import"./sections-EqJpt3TQ.js";import"./EmptyState-DFn4LB7J.js";import"./ErrorState-wz9YaOol.js";import"./undo-2-CveuEJjH.js";import"./download-C79uP4C7.js";import"./calendar-suggestion-Dz1CYPKE.js";import"./calendar-format-M4S5xU7P.js";import"./useCalendars-DR1_eTjS.js";import"./map-pin-HJKJCWdt.js";import"./attendee-row-BhqXy1fZ.js";import"./clock-ByuYhL7c.js";import"./calendar-clash-strip-Bid2cYhz.js";import"./bell-off-zJIQc-fQ.js";import"./copy-baeOC0XH.js";import"./shield-check-D7EcTf9d.js";import"./useFilters-Bbcl4di_.js";import"./confirm-dialog-D0wfxRPd.js";import"./useLayoutTier-CF_kWPgV.js";import"./menu-CbYnJN5U.js";import"./MailViewChrome-XZUEJlo5.js";import"./NavMenuButton-DeFLPsFB.js";import"./useLabels-DQs2z0T7.js";import"./useSemanticSearch-B7rQKIm8.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-CqUVoKvb.js";import"./circle-help-Bh3n-6_h.js";import"./circle-check-B0R88gmM.js";function X(){return o.jsx(r.Reading,{})}export{X as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-UydO8d8c.js";import{F as r}from"./FlaggedPane-CGhj--Hm.js";import"./useSearchTokenContext-CBDSw3gJ.js";import"./kbd-Dr4usi4j.js";import"./useMessageBodyContent-DiiU1g37.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-DfOCZnRx.js";import"./roving-focus-BNBmBfAx.js";import"./search-token-index-AOAqpH15.js";import"./useQueries-CJUjXxvq.js";import"./popover-menu--AoVAv-y.js";import"./mail-Db9OjHYL.js";import"./avatar-Dq9zVRVl.js";import"./index-D4ZeuNuq.js";import"./useSignature-DruMb0cI.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dt6rAAol.js";import"./sections-EqJpt3TQ.js";import"./EmptyState-DFn4LB7J.js";import"./ErrorState-wz9YaOol.js";import"./undo-2-CveuEJjH.js";import"./download-C79uP4C7.js";import"./calendar-suggestion-Dz1CYPKE.js";import"./calendar-format-M4S5xU7P.js";import"./useCalendars-DR1_eTjS.js";import"./map-pin-HJKJCWdt.js";import"./attendee-row-BhqXy1fZ.js";import"./clock-ByuYhL7c.js";import"./calendar-clash-strip-Bid2cYhz.js";import"./bell-off-zJIQc-fQ.js";import"./copy-baeOC0XH.js";import"./shield-check-D7EcTf9d.js";import"./useFilters-Bbcl4di_.js";import"./confirm-dialog-D0wfxRPd.js";import"./useLayoutTier-CF_kWPgV.js";import"./menu-CbYnJN5U.js";import"./MailViewChrome-XZUEJlo5.js";import"./refresh-cw-Qp6f0dRu.js";import"./wizard-selection-DxUM65kM.js";function M(){return o.jsx(r.Reading,{})}export{M as component};