@remit/web-client-dist 0.0.591 → 0.0.593

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 (147) hide show
  1. package/assets/{BriefPane-DxvRw5LY.js → BriefPane-BSIJ7wnx.js} +1 -1
  2. package/assets/{CalendarComposePane-D5kbc0Wr.js → CalendarComposePane-BsCRW_Ip.js} +1 -1
  3. package/assets/{CalendarComposeSeed-CDildxpd.js → CalendarComposeSeed-45musvze.js} +1 -1
  4. package/assets/{CalendarShell-CO9Ch0R0.js → CalendarShell-DAQuCdKG.js} +1 -1
  5. package/assets/{EmptyState-DnHO6-Og.js → EmptyState-SiNhuwMY.js} +1 -1
  6. package/assets/{ErrorState-BmY5gQwC.js → ErrorState-CJTd3Tdb.js} +1 -1
  7. package/assets/{FlaggedPane-94igzYoy.js → FlaggedPane-uDAIYY0G.js} +1 -1
  8. package/assets/{FullCompose-CXp4t4n-.js → FullCompose-R0T9BGXI.js} +1 -1
  9. package/assets/{MailListHeader-1AbN6wgL.js → MailListHeader-BDTDDZso.js} +2 -2
  10. package/assets/{MailNav-BO_R-StG.js → MailNav-12iGpAhv.js} +1 -1
  11. package/assets/{MailShell-Cm3I05Ms.js → MailShell-BAufa90z.js} +1 -1
  12. package/assets/{MailViewChrome-DHrRAvlD.js → MailViewChrome-xVnsbwWk.js} +1 -1
  13. package/assets/{MailboxPane-XUKQ7ZIp.js → MailboxPane-DEHvuR-_.js} +1 -1
  14. package/assets/{NavMenuButton-CooA4fiY.js → NavMenuButton-Zq_pjyhs.js} +1 -1
  15. package/assets/{OnboardingWizard-sMPguGXt.js → OnboardingWizard-_QJASQrD.js} +1 -1
  16. package/assets/{OpenCalendarEvent-Bt7-A5Dk.js → OpenCalendarEvent-CX58crKI.js} +1 -1
  17. package/assets/{OutboxPane-DGjsBZc8.js → OutboxPane-DuiRNXVZ.js} +1 -1
  18. package/assets/_calendarObjectId-CunWyMyD.js +1 -0
  19. package/assets/_mailboxId-DcmWOCHg.js +1 -0
  20. package/assets/_messageId-Bv4uU9e6.js +1 -0
  21. package/assets/_messageId-CQA-7JY0.js +1 -0
  22. package/assets/_messageId-CTUxwxJj.js +1 -0
  23. package/assets/_outboxMessageId-DWcv9FGr.js +1 -0
  24. package/assets/_recurrenceId-CaekiMv0.js +1 -0
  25. package/assets/_threadId-BKH9xXbT.js +1 -0
  26. package/assets/_threadId-Ba0rpzMN.js +1 -0
  27. package/assets/_threadId-D5-XKCS0.js +1 -0
  28. package/assets/{_view._date-CR2Z9arD.js → _view._date-DLJ2iU3p.js} +1 -1
  29. package/assets/{accounts-OEE8ww8y.js → accounts-BcJ3jZbQ.js} +1 -1
  30. package/assets/{advanced-Bg_Dj-DA.js → advanced-rpXnRxa7.js} +1 -1
  31. package/assets/{appearance-DF3wzzCl.js → appearance-3ZQUhW5v.js} +1 -1
  32. package/assets/{attachment-file-C0wPuWvi.js → attachment-file-BKnJE5i7.js} +1 -1
  33. package/assets/{attendee-row-C3uA5noz.js → attendee-row-Q5g6VNRt.js} +1 -1
  34. package/assets/{avatar-C8WVAvtz.js → avatar-CpvvuFKb.js} +1 -1
  35. package/assets/{bottom-sheet-DYAyDX0-.js → bottom-sheet-ziTMHWKM.js} +1 -1
  36. package/assets/brief-AL3KqJnA.js +1 -0
  37. package/assets/{brief-CBvhnyZJ.js → brief-CBlFE7XW.js} +1 -1
  38. package/assets/{browser-ponyfill-CMeTBL1f.js → browser-ponyfill-DmAQi8W1.js} +1 -1
  39. package/assets/{bug-DudfhKBy.js → bug-CnxiZR3U.js} +1 -1
  40. package/assets/{calendar-xvyiwrvK.js → calendar-C7nbjMHb.js} +1 -1
  41. package/assets/{calendar-color-BOlDnJax.js → calendar-color-DiGD9E9z.js} +1 -1
  42. package/assets/{calendar-event-chip-eABfm92S.js → calendar-event-chip-C01FZqo9.js} +1 -1
  43. package/assets/{calendars-C7wGOMiT.js → calendars-DIWHZKeT.js} +1 -1
  44. package/assets/{card-yags3915.js → card-KuXjZz2J.js} +1 -1
  45. package/assets/chevron-left-BSuzyJ1v.js +1 -0
  46. package/assets/{circle-check-CI-B-c84.js → circle-check-DpSrf3Bf.js} +1 -1
  47. package/assets/{circle-check-big-CAabu53t.js → circle-check-big-EJFD8UIQ.js} +1 -1
  48. package/assets/{circle-help-DbhMULgL.js → circle-help-DJPZs0YB.js} +1 -1
  49. package/assets/{clock-Cfx4Qruv.js → clock-CztOmyyZ.js} +1 -1
  50. package/assets/compose._-_outboxMessageId_-4y48omY4.js +1 -0
  51. package/assets/compose._-_outboxMessageId_-D9Y26D-s.js +1 -0
  52. package/assets/compose._-_outboxMessageId_-YhNCocdk.js +1 -0
  53. package/assets/compose._-_outboxMessageId_-ypawlKVr.js +1 -0
  54. package/assets/{config-import-C72ak90P.js → config-import-1UE8PHaC.js} +1 -1
  55. package/assets/{confirm-dialog-BDImOz8O.js → confirm-dialog-Db8A2eMO.js} +1 -1
  56. package/assets/{copy-DOVS_GJU.js → copy-Jo_1Ac7_.js} +1 -1
  57. package/assets/{credential-steps-CIva27if.js → credential-steps-DIyJdTn_.js} +1 -1
  58. package/assets/{download-e1wnwjDt.js → download-B4DThtpy.js} +1 -1
  59. package/assets/{file-json-iDFMbnrc.js → file-json-B1d4L4an.js} +1 -1
  60. package/assets/{filters-PqwjraZa.js → filters-DbSC_To8.js} +1 -1
  61. package/assets/flagged-BzgdKlX5.js +1 -0
  62. package/assets/{flagged-vXzNwhBg.js → flagged-ddcCg6uI.js} +1 -1
  63. package/assets/{folders-Dv71el05.js → folders-9Q1xk579.js} +1 -1
  64. package/assets/{help-copy-Bk-JnPNc.js → help-copy-BYMTLPPD.js} +1 -1
  65. package/assets/{import-NB7vK6VN.js → import-Dg1-_7Sn.js} +1 -1
  66. package/assets/{index-D5NnwKqI.js → index-B3YV5vmq.js} +1 -1
  67. package/assets/{index-nplGQyIX.js → index-C3nvkB1j.js} +9 -9
  68. package/assets/index-C4RAKRgG.js +1 -0
  69. package/assets/{index-De5_NaC2.js → index-C5Kbx4oU.js} +4 -4
  70. package/assets/index-CDW5oYZ5.js +1 -0
  71. package/assets/index-CMnE1py7.js +1 -0
  72. package/assets/index-CQA-7JY0.js +1 -0
  73. package/assets/index-CTUxwxJj.js +1 -0
  74. package/assets/index-CtnFoVzw.js +1 -0
  75. package/assets/index-DZYkzfQb.js +1 -0
  76. package/assets/index-TxvNVMW_.js +1 -0
  77. package/assets/index-hkT8KHDf.js +1 -0
  78. package/assets/{kbd-BPztyriS.js → kbd-BsZ5TwSB.js} +1 -1
  79. package/assets/{labels-CHFJCz_W.js → labels-BPCJOCH8.js} +1 -1
  80. package/assets/{mail-DrMxpydq.js → mail-BmQATzkJ.js} +1 -1
  81. package/assets/{mail-3cLGF5yv.js → mail-CbMHE5qp.js} +1 -1
  82. package/assets/{map-pin-CQRXt7-v.js → map-pin-BCdwL5Kr.js} +1 -1
  83. package/assets/{menu-DxPvoc39.js → menu-lRFfNolt.js} +1 -1
  84. package/assets/{new-Bo29R1Sb.js → new-BNgocKsN.js} +1 -1
  85. package/assets/onboarding-DJ4yligo.js +1 -0
  86. package/assets/{onboarding-completion-Hz3VUw2C.js → onboarding-completion-BJ-YunAO.js} +1 -1
  87. package/assets/outbox-p5tzV3Tf.js +1 -0
  88. package/assets/{pencil-FWYSSPRP.js → pencil-Cuw3Cj3L.js} +1 -1
  89. package/assets/{refresh-cw-BZnr1gbH.js → refresh-cw-BaKyxffZ.js} +1 -1
  90. package/assets/{rich-text-spellcheck-worker-provider-Dq6BFCD_.js → rich-text-spellcheck-worker-provider-cmfCfz65.js} +1 -1
  91. package/assets/{rich-text-BugnwrFy.js → rich-text-w5xOgZmh.js} +1 -1
  92. package/assets/{rotate-ccw-DelBW9mG.js → rotate-ccw-BR8jjqUY.js} +1 -1
  93. package/assets/{roving-focus-CB9g2g6l.js → roving-focus-geTPv6vY.js} +1 -1
  94. package/assets/{row-actions-vD6hiM3N.js → row-actions-BVgTod6v.js} +1 -1
  95. package/assets/{search-mirror-C2hbIA1l.js → search-mirror-CktyWTNZ.js} +1 -1
  96. package/assets/{search-token-index-D8AXRSvA.js → search-token-index-Gua3DAMw.js} +1 -1
  97. package/assets/{sections-DsT-oWzn.js → sections-DWDKrIb_.js} +1 -1
  98. package/assets/{senders-CJmT3D9V.js → senders-CRpuYnKW.js} +1 -1
  99. package/assets/settings-CWZbmNHi.js +1 -0
  100. package/assets/{settings-screen-CJhRXNg-.js → settings-screen-CMisw0L4.js} +1 -1
  101. package/assets/{shield-check-YWLsW5Ac.js → shield-check-BuzECgn-.js} +1 -1
  102. package/assets/{suggested-vips-DP4uQuqB.js → suggested-vips-Bbm_r8cx.js} +1 -1
  103. package/assets/{useCalendarData-jhAxBfDR.js → useCalendarData-BjcRVZAJ.js} +1 -1
  104. package/assets/{useCalendars-K-xkU16i.js → useCalendars-BbUHkfIU.js} +1 -1
  105. package/assets/{useDebouncedValue-DLkEQY2Y.js → useDebouncedValue-B7V9qfV6.js} +1 -1
  106. package/assets/{useFilters-D3NB3BJC.js → useFilters-CpgltZXL.js} +1 -1
  107. package/assets/{useLabels-Di4UDFS5.js → useLabels-BuKWOv6s.js} +1 -1
  108. package/assets/{useLayoutTier-CyXo9cFe.js → useLayoutTier-EgUCgdx3.js} +1 -1
  109. package/assets/{useMessageBodyContent-Bnpk0TFc.js → useMessageBodyContent-DIrkHtbX.js} +1 -1
  110. package/assets/{useQueries-C4ALXO6p.js → useQueries-B0RzAdbY.js} +1 -1
  111. package/assets/{useRefreshControl-DWxmrSxK.js → useRefreshControl-DIuMf3Yl.js} +1 -1
  112. package/assets/{useResultFolderIndex-BpMfrs9q.js → useResultFolderIndex-BLp_aYwJ.js} +1 -1
  113. package/assets/{useSearchTokenContext-MxM1d1hd.js → useSearchTokenContext-BSpmqddM.js} +1 -1
  114. package/assets/{useSemanticSearch-D_WiUPqF.js → useSemanticSearch-Dps5HKPc.js} +1 -1
  115. package/assets/{useSignature-Cda5hEoh.js → useSignature-d8ShaxGe.js} +1 -1
  116. package/assets/{window-Dq8s2Y-7.js → window-Cc-1L1Rq.js} +1 -1
  117. package/index.html +1 -1
  118. package/package.json +1 -1
  119. package/assets/_calendarObjectId-Cmt0djO3.js +0 -1
  120. package/assets/_mailboxId-C9QRBw6Y.js +0 -1
  121. package/assets/_messageId-B2iggov8.js +0 -1
  122. package/assets/_messageId-BV0nwHfy.js +0 -1
  123. package/assets/_messageId-XLwNGqWT.js +0 -1
  124. package/assets/_outboxMessageId-CshR6gm0.js +0 -1
  125. package/assets/_recurrenceId-BKIvPti7.js +0 -1
  126. package/assets/_threadId-CpHhH6UO.js +0 -1
  127. package/assets/_threadId-DR9V5miT.js +0 -1
  128. package/assets/_threadId-blH6E-o9.js +0 -1
  129. package/assets/brief-3svEl8De.js +0 -1
  130. package/assets/chevron-left-BJSv4KI3.js +0 -1
  131. package/assets/compose._-_outboxMessageId_-CB8AdVPl.js +0 -1
  132. package/assets/compose._-_outboxMessageId_-DH72aYGA.js +0 -1
  133. package/assets/compose._-_outboxMessageId_-DgSwTKL3.js +0 -1
  134. package/assets/compose._-_outboxMessageId_-QQ9QispY.js +0 -1
  135. package/assets/flagged-B7ldic88.js +0 -1
  136. package/assets/index-B2iggov8.js +0 -1
  137. package/assets/index-B5PJWhrt.js +0 -1
  138. package/assets/index-BCavit8r.js +0 -1
  139. package/assets/index-BEO9f0mW.js +0 -1
  140. package/assets/index-CMMAIEG7.js +0 -1
  141. package/assets/index-Dla5GMiu.js +0 -1
  142. package/assets/index-DyB0FaGz.js +0 -1
  143. package/assets/index-XLwNGqWT.js +0 -1
  144. package/assets/index-koDRcPrb.js +0 -1
  145. package/assets/onboarding-InbCe1kf.js +0 -1
  146. package/assets/outbox-6JFrFZTs.js +0 -1
  147. package/assets/settings-4tpstZGo.js +0 -1
@@ -1 +1 @@
1
- import{e as ie,r as t,j as e,h as ce,i as Z,o as le,ax as de,c as q,aP as K,d as ee,f as k,L as _,B as H,aQ as z,ay as ue,az as Q,n as me,I as pe}from"./index-nplGQyIX.js";import{K as he}from"./kbd-BPztyriS.js";import{c as fe,d as xe,s as U,W as L,C as D,g as ye,e as X,f as ge,h as ve,b as Se,R as be,a as W,S as je}from"./credential-steps-CIva27if.js";import{c as we}from"./account-form-helpers-DhckT_PN.js";import{M as Ce}from"./mail-DrMxpydq.js";import{F as ke}from"./file-json-iDFMbnrc.js";const $=ie("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]),te=[{id:"icloud",label:"iCloud",username:"full-email",imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},passwordHelp:{text:"iCloud requires an app-specific password, not your Apple ID password. Generate one under Sign-In & Security → App-Specific Passwords.",url:"https://support.apple.com/en-us/102654"}},{id:"yahoo",label:"Yahoo",username:"full-email",imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},passwordHelp:{text:"Yahoo requires an app password, not your login password. Generate one under Account Security.",url:"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html"}},{id:"aol",label:"AOL",username:"full-email",imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},passwordHelp:{text:"AOL requires an app password, not your login password. Generate one under Account Security.",url:"https://login.aol.com/account/security"}},{id:"fastmail",label:"Fastmail",username:"full-email",imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},passwordHelp:{text:"Fastmail requires an app password, not your login password. Create one under Settings → Privacy & Security → App passwords.",url:"https://www.fastmail.help/hc/en-us/articles/360058752854"}}];function Y(a){return te.find(d=>d.id===a)}const Ee={"icloud.com":"icloud","me.com":"icloud","mac.com":"icloud","yahoo.com":"yahoo","yahoo.co.uk":"yahoo","ymail.com":"yahoo","aol.com":"aol","fastmail.com":"fastmail","fastmail.fm":"fastmail"};function Ne(a){const d=a.indexOf("@");if(d===-1)return"";const c=a.slice(d+1).toLowerCase();return Ee[c]??""}const T=["Connector","Address","Servers","Credentials","Test","Sync"],A={connector:0,address:1,servers:2,credentials:3,test:4,sync:5},V={host:"",port:993,security:"tls"},J={host:"",port:587,security:"starttls"};function Pe({onStart:a,onImportConfig:d}){return t.useEffect(()=>{const c=p=>{p.key==="Enter"&&a()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),e.jsx(L,{steps:T,activeStep:0,hideSteps:!0,title:"Welcome to Remit",subtitle:d?"Set up your first account, or bring the settings from another Reader.":"One inbox for all your mail, with context about every message.",footer:e.jsxs(e.Fragment,{children:[d?e.jsx(k,{variant:"secondary",icon:e.jsx(ke,{className:"size-4"}),onClick:d,children:"Import a config file"}):e.jsxs("span",{className:"text-2xs text-fg-subtle",children:[e.jsx(he,{children:"Enter"})," to continue"]}),e.jsx(k,{variant:"primary",onClick:a,children:"Add your first account"})]}),children:e.jsxs("div",{className:"flex flex-col items-start py-5",children:[e.jsx("span",{className:"flex size-14 items-center justify-center rounded-md bg-accent-soft",children:e.jsx(Ce,{className:"size-7 text-accent"})}),e.jsx("p",{className:"mt-5 max-w-sm text-sm leading-relaxed text-fg-muted",children:"Remit syncs your existing mailboxes and tells you who is really writing to you — sender history, authenticity checks, and similar messages, right next to every email."}),d&&e.jsx("p",{className:"mt-3 max-w-sm text-sm leading-relaxed text-fg-muted",children:"A config file carries your accounts, folder roles, rules, flagged senders and appearance from another Reader. It never carries passwords, so you sign in again here."})]})})}function Te({onContinue:a,onMicrosoft:d,onBack:c,showBack:p}){const[h,o]=t.useState("imap");t.useEffect(()=>{const y=i=>{i.key==="Enter"&&(h==="microsoft"?d():a()),i.key==="Escape"&&c()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[a,d,c,h]);const n=()=>{h==="microsoft"?d():a()};return e.jsx(L,{steps:T,activeStep:A.connector,title:"How does this account connect?",subtitle:"Choose a sign-in method. IMAP works with any provider.",footer:e.jsxs(e.Fragment,{children:[p?e.jsx(k,{variant:"ghost",onClick:c,children:"Back"}):e.jsx("span",{}),e.jsx(k,{variant:"primary",onClick:n,children:h==="microsoft"?"Continue with Microsoft":"Continue with IMAP"})]}),children:e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[e.jsx(W,{name:"IMAP / SMTP",description:"Any mail provider — Fastmail, iCloud, your own server.",icon:e.jsx(je,{className:"size-5"}),selected:h==="imap",onSelect:()=>o("imap")}),e.jsx(W,{name:"Gmail",description:"Sign in with Google. No app passwords.",icon:e.jsx($,{className:"size-5"}),comingSoon:!0}),e.jsx(W,{name:"Outlook / Microsoft 365",description:"Sign in with Microsoft. Works with Outlook.com and work accounts.",icon:e.jsx(pe,{className:"size-5"}),selected:h==="microsoft",onSelect:()=>o("microsoft")})]})})}function Ae({onBack:a,onConnected:d}){const[c,p]=t.useState(""),[h,o]=t.useState(null),[n,y]=t.useState(!1),[i,g]=t.useState(!1),v=t.useRef(!0);t.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]);const E=t.useRef(new Set),{refetch:w}=q(ee()),j=Se(r=>{if(g(!1),r==="stalled"){y(!1),o(be);return}w().then(({data:u,isError:N})=>{if(!v.current)return;if(N||!u){o("Couldn't check whether the sign-in finished. Open Settings › Accounts to see whether the account is connected.");return}o(null);const C=u.accounts.find(P=>!E.current.has(P.accountId));C&&d(C.accountId)})}),S=Z({...me(),onSuccess:r=>{v.current&&(j(),y(!0),window.location.assign(r.authorizationUrl))},onError:r=>{g(!1),o(r instanceof Error?r.message:"Failed to start sign-in")}}),l=i||S.isPending,f=()=>{l||(o(null),g(!0),w().then(({data:r,isError:u})=>{if(v.current){if(u||!r){g(!1),o("Couldn't read this instance's accounts, so sign-in can't be tracked. Check your connection and try again.");return}E.current=new Set(r.accounts.map(N=>N.accountId)),S.mutate({body:{email:c.trim()||void 0}})}}))},x=t.useRef(f);return x.current=f,t.useEffect(()=>{const r=u=>{u.key==="Enter"&&x.current(),u.key==="Escape"&&a()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[a]),e.jsx(L,{steps:T,activeStep:A.connector,title:"Sign in with Microsoft",subtitle:"You'll be redirected to Microsoft to sign in securely.",footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:a,children:"Back"}),e.jsx(k,{variant:"primary",onClick:f,disabled:l,icon:l?e.jsx(_,{className:"size-4 animate-spin"}):void 0,children:l?"Redirecting…":n?"Start over":"Sign in with Microsoft"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(z,{htmlFor:"microsoft-email",children:"Email address (optional)"}),e.jsx(Q,{id:"microsoft-email",icon:e.jsx($,{className:"size-4"}),placeholder:"you@outlook.com",value:c,onChange:r=>p(r.target.value),type:"email",autoComplete:"email"}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"Pre-fills the Microsoft sign-in form. Leave blank to choose on the Microsoft page."})]}),n&&e.jsx(H,{tone:"info",children:"Waiting for Microsoft. Finish signing in — this window carries on the moment the account is connected, wherever you finished."}),h&&e.jsx(H,{tone:"danger",children:h})]})})}function Ie({initialEmail:a,initialDisplayName:d,onContinue:c,onBack:p}){const[h,o]=t.useState(a),[n,y]=t.useState(d),[i,g]=t.useState(!1),[v,E]=t.useState(""),[w,j]=t.useState(null),S=t.useCallback(async()=>{const l=h.trim();if(!l.includes("@")||!l.includes(".")){j("Enter a valid email address.");return}j(null),g(!0),E(ge(l));try{const f=await ve(l);c(l,n.trim(),f)}finally{g(!1)}},[h,n,c]);return t.useEffect(()=>{const l=f=>{f.key==="Enter"&&!i&&S(),f.key==="Escape"&&p()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[S,i,p]),e.jsx(L,{steps:T,activeStep:A.address,title:"What's the email address?",subtitle:"We'll detect the server settings for you.",footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:p,children:"Back"}),e.jsx(k,{variant:"primary",disabled:i,onClick:()=>{S()},children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(z,{htmlFor:"onboarding-email",children:"Email address"}),e.jsx(Q,{id:"onboarding-email",icon:e.jsx($,{className:"size-4"}),placeholder:"you@example.com",value:h,onChange:l=>{o(l.target.value),j(null)},type:"email",autoComplete:"email"})]}),e.jsxs("div",{children:[e.jsx(z,{htmlFor:"onboarding-display-name",children:"Display name (optional)"}),e.jsx(Q,{id:"onboarding-display-name",placeholder:"Alice",value:n,onChange:l=>y(l.target.value)}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"What to call this account in Remit. Leave blank to use a name derived from the address."})]}),i&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(_,{className:"size-3.5 animate-spin text-accent"}),v]}),w&&!i&&e.jsx("div",{className:"mt-3",children:e.jsx(H,{tone:"danger",children:w})})]})})}function Me({email:a,imapConfig:d,smtpConfig:c,discovered:p,onContinue:h,onBack:o,onChange:n}){const[y,i]=t.useState(d),[g,v]=t.useState(c),[E,w]=t.useState(()=>Ne(a)),[j,S]=t.useState(!1),[l,f]=t.useState(null),x=Y(E),r=x!==void 0&&!j,u=t.useCallback(m=>{w(m),S(!1),f(null);const s=Y(m);s&&(i({host:s.imap.host,port:s.imap.port,security:s.imap.security}),v({host:s.smtp.host,port:s.smtp.port,security:s.smtp.security}))},[]);t.useEffect(()=>{n(y,g)},[y,g,n]);const N=y.host.trim()!=="",C=t.useCallback(()=>{if(!N){f("Enter the IMAP host.");return}f(null),h()},[N,h]);t.useEffect(()=>{const m=s=>{s.key==="Enter"&&C(),s.key==="Escape"&&o()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[C,o]);const P=a.split("@")[1]??"your domain",F=x?"Pick your provider to fill in the right settings — or choose Custom to enter them by hand.":p?"Found via autodiscovery — adjust anything that looks off.":`We couldn't detect settings for ${P} — enter them manually.`,I=r?{label:"preset",tone:"neutral"}:!x&&p?{label:"detected",tone:"positive"}:void 0,M=x?.passwordHelp.url??ye(a);return e.jsx(L,{steps:T,activeStep:A.servers,title:"Confirm server settings",subtitle:F,footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:o,children:"Back"}),e.jsx(k,{variant:"primary",onClick:C,children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-5",children:[l&&e.jsx(H,{tone:"danger",children:l}),e.jsxs("div",{children:[e.jsx(z,{htmlFor:"provider-select",children:"Provider"}),e.jsxs(ue,{id:"provider-select",value:E,onChange:m=>u(m.target.value),children:[e.jsx("option",{value:"",children:"Custom / other"}),te.map(m=>e.jsx("option",{value:m.id,children:m.label},m.id))]}),x&&e.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:r?e.jsxs(e.Fragment,{children:["Server settings are pre-filled for ",x.label," and locked."," ",e.jsx("button",{type:"button",className:"text-accent underline",onClick:()=>S(!0),children:"Advanced"})," ","lets you edit them by hand."]}):e.jsxs(e.Fragment,{children:["Editing ",x.label,"'s settings by hand."]})})]}),e.jsx(X,{legend:"IMAP — incoming",badge:I,readOnly:r,host:y.host,port:String(y.port),security:y.security,hostPlaceholder:"imap.example.com",portPlaceholder:"993",onHostChange:m=>{i(s=>({...s,host:m})),f(null)},onPortChange:m=>i(s=>({...s,port:Number(m)})),onSecurityChange:m=>i(s=>({...s,security:m}))}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Sending (SMTP) is optional — leave it blank to set up a receive-only account and add sending later in Settings."}),e.jsx(X,{legend:"SMTP — outgoing (optional)",badge:I,readOnly:r,host:g.host,port:String(g.port),security:g.security,hostPlaceholder:"smtp.example.com",portPlaceholder:"587",onHostChange:m=>{v(s=>({...s,host:m})),f(null)},onPortChange:m=>v(s=>({...s,port:Number(m)})),onSecurityChange:m=>v(s=>({...s,security:m}))}),x&&e.jsxs("p",{className:"text-2xs text-fg-subtle",children:[x.passwordHelp.text," ",M&&e.jsx("a",{href:M,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"Get an app password"})]})]})})}const Le=2e4;function Fe({email:a,displayName:d,imapConfig:c,smtpConfig:p,username:h,password:o,onGoToInbox:n}){const y=ce(),[i,g]=t.useState(null),[v,E]=t.useState(null),w=t.useRef(!1),j=U(c.security),S=U(p.security),l=Z({...de(),onSuccess:b=>{g(b.accountId),y.invalidateQueries({queryKey:le()})},onError:b=>{E(b instanceof Error?b.message:"Failed to create account")}});t.useEffect(()=>{if(w.current)return;w.current=!0;const b=p.host.trim()!=="",R=we({imapHost:c.host,smtpHost:p.host,smtpPort:p.port}),O=b?R??{smtpHost:p.host,smtpPort:p.port,smtpTls:S.tls,smtpStartTls:S.startTls}:null;l.mutate({body:{email:a,displayName:d||void 0,username:h!==a?h:void 0,password:o,imapHost:c.host,imapPort:c.port,imapTls:j.tls,imapStartTls:j.startTls,smtpHost:O?.smtpHost||void 0,smtpPort:O?.smtpPort||void 0,smtpTls:O?.smtpTls??!1,smtpStartTls:O?.smtpStartTls??!1}})},[]);const{data:f,isError:x}=q({...K({path:{accountId:i??""}}),enabled:!!i,refetchInterval:b=>{const R=b.state.data?.syncPhase;return R==="complete"||R==="error"?!1:2e3}}),r=f?.syncPhase==="error",{data:u}=q({...ee(),enabled:!!i&&r}),N=u?.accounts.find(b=>b.accountId===i)?.lastError,C=f?.mailboxes.find(b=>b.fullPath==="INBOX"||b.fullPath==="Inbox"),P=f?.mailboxCountTotal??0,F=f?.mailboxCountSynced??0,I=C?.messagesTotal??0,M=C?.messagesSynced??0,m=I>0?M/I:0,s=f?.syncPhase,se=r?"failed":s==="idle"||s===void 0||s==="discovering_mailboxes"?"running":P>0?"ok":"running",G=r?"failed":!s||s==="idle"||s==="discovering_mailboxes"?"pending":s==="syncing_inbox"||s==="syncing_others"?"running":"ok",B=r?"failed":!s||s==="idle"||s==="discovering_mailboxes"||s==="syncing_inbox"?"pending":s==="syncing_others"?"running":"ok",ne=M>0||C?.phase==="complete"||s==="complete"||r,[ae,oe]=t.useState(!1);t.useEffect(()=>{if(!i)return;const b=setTimeout(()=>oe(!0),Le);return()=>clearTimeout(b)},[i]);const re=!!i&&(ne||x||ae);return v?e.jsx(L,{steps:T,activeStep:A.sync,title:"Couldn't create account",subtitle:"Something went wrong saving your account.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{}),e.jsx(k,{variant:"primary",onClick:()=>{w.current=!1,E(null),l.mutate({body:{email:a,displayName:d||void 0,username:h!==a?h:void 0,password:o,imapHost:c.host,imapPort:c.port,imapTls:j.tls,imapStartTls:j.startTls,smtpHost:p.host||void 0,smtpPort:p.port||void 0,smtpTls:S.tls,smtpStartTls:S.startTls}})},children:"Retry"})]}),children:e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:v})}):e.jsx(L,{steps:T,activeStep:A.sync,title:`Syncing ${a}`,subtitle:"Newest mail first — you can start reading right away.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Sync continues in the background"}),re?e.jsx(k,{variant:"primary",onClick:()=>i&&n(i),children:"Go to inbox"}):e.jsx(k,{variant:"primary",disabled:!0,icon:e.jsx(_,{className:"size-3.5 animate-spin"}),children:"Getting your mail…"})]}),children:l.isPending?e.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-fg-muted",children:[e.jsx(_,{className:"size-4 animate-spin text-accent"}),"Creating your account…"]}):e.jsxs("div",{className:"space-y-3",children:[I>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between text-xs",children:[e.jsx("span",{className:"font-medium text-fg",children:"INBOX"}),e.jsxs("span",{className:"text-fg-subtle tabular-nums",children:[M.toLocaleString()," / ",I.toLocaleString()," ","messages"]})]}),e.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-surface-sunken",children:e.jsx("div",{className:"h-full rounded-full bg-accent transition-all duration-500",style:{width:`${Math.max(2,m*100)}%`}})})]}),e.jsxs("div",{className:"divide-y divide-line",children:[e.jsx(D,{label:"Mailboxes discovered",detail:P>0?`${P} mailbox${P===1?"":"es"} found`:"Discovering…",state:se}),e.jsx(D,{label:"INBOX",detail:G==="ok"?`${M.toLocaleString()} messages synced`:G==="running"?"Syncing newest first…":"Queued",state:G}),F>1||s==="syncing_others"||s==="complete"?e.jsx(D,{label:"Other mailboxes",detail:B==="ok"?`${F-1} mailboxes synced`:B==="running"?"Syncing…":"Queued",state:B}):null]}),r&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("p",{className:"text-xs text-danger",children:["Sync stalled. The account is still active —"," ",e.jsx("button",{type:"button",className:"underline",onClick:()=>{y.invalidateQueries({queryKey:K({path:{accountId:i??""}}).queryKey})},children:"retry"})]}),N&&e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:N})]})]})})}function Be({skipWelcome:a=!1,onComplete:d,onCancel:c,onImportConfig:p}){const[h,o]=t.useState(a?"connector":"welcome"),[n,y]=t.useState({email:"",displayName:"",imapConfig:V,smtpConfig:J,username:"",password:"",discoveryResult:null,discovered:!1,createdAccountId:null}),i=t.useCallback(()=>o("connector"),[]),g=t.useCallback(()=>o("address"),[]),v=t.useCallback(()=>o("microsoft-email"),[]),E=t.useCallback(()=>{a?c?.():o("welcome")},[a,c]),w=t.useCallback((x,r,u)=>{let N=V,C=J,P=!1;u&&(P=u.source!=="heuristic",N={host:u.imap.host,port:u.imap.port,security:u.imap.security},C={host:u.smtp.host,port:u.smtp.port,security:u.smtp.security}),y(F=>({...F,email:x,displayName:r,imapConfig:N,smtpConfig:C,discoveryResult:u,discovered:P,username:x})),o("servers")},[]),j=t.useCallback((x,r)=>{y(u=>({...u,imapConfig:x,smtpConfig:r}))},[]),S=t.useCallback((x,r)=>{y(u=>({...u,username:x,password:r}))},[]),l=t.useCallback(()=>o("sync"),[]),f=t.useCallback(x=>{d(x)},[d]);switch(h){case"welcome":return e.jsx(Pe,{onStart:i,onImportConfig:p});case"connector":return e.jsx(Te,{onContinue:g,onMicrosoft:v,onBack:E,showBack:!a});case"microsoft-email":return e.jsx(Ae,{onBack:()=>o("connector"),onConnected:f});case"address":return e.jsx(Ie,{initialEmail:n.email,initialDisplayName:n.displayName,onContinue:w,onBack:()=>o("connector")});case"servers":return e.jsx(Me,{email:n.email,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,discovered:n.discovered,onContinue:()=>o("credentials"),onBack:()=>o("address"),onChange:j});case"credentials":return e.jsx(xe,{steps:T,activeStep:A.credentials,title:`Sign in to ${n.email.split("@")[1]||"your mail server"}`,subtitle:"Many providers require an app password instead of your normal one.",email:n.email,username:n.username,password:n.password,onContinue:()=>o("test"),onBack:()=>o("servers"),onChange:S});case"test":return e.jsx(fe,{steps:T,activeStep:A.test,email:n.email,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,username:n.username,password:n.password,onSuccess:l,onBackToCredentials:()=>o("credentials"),onBackToServers:()=>o("servers")});case"sync":return e.jsx(Fe,{email:n.email,displayName:n.displayName,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,username:n.username,password:n.password,onGoToInbox:f})}}export{Be as O,te as P,Y as g};
1
+ import{e as ie,r as t,j as e,h as ce,i as Z,o as le,ax as de,c as q,aP as K,d as ee,f as k,L as _,B as H,aQ as z,ay as ue,az as Q,n as me,I as pe}from"./index-C3nvkB1j.js";import{K as he}from"./kbd-BsZ5TwSB.js";import{c as fe,d as xe,s as U,W as L,C as D,g as ye,e as X,f as ge,h as ve,b as Se,R as be,a as W,S as je}from"./credential-steps-DIyJdTn_.js";import{c as we}from"./account-form-helpers-DhckT_PN.js";import{M as Ce}from"./mail-BmQATzkJ.js";import{F as ke}from"./file-json-B1d4L4an.js";const $=ie("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]),te=[{id:"icloud",label:"iCloud",username:"full-email",imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},passwordHelp:{text:"iCloud requires an app-specific password, not your Apple ID password. Generate one under Sign-In & Security → App-Specific Passwords.",url:"https://support.apple.com/en-us/102654"}},{id:"yahoo",label:"Yahoo",username:"full-email",imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},passwordHelp:{text:"Yahoo requires an app password, not your login password. Generate one under Account Security.",url:"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html"}},{id:"aol",label:"AOL",username:"full-email",imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},passwordHelp:{text:"AOL requires an app password, not your login password. Generate one under Account Security.",url:"https://login.aol.com/account/security"}},{id:"fastmail",label:"Fastmail",username:"full-email",imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},passwordHelp:{text:"Fastmail requires an app password, not your login password. Create one under Settings → Privacy & Security → App passwords.",url:"https://www.fastmail.help/hc/en-us/articles/360058752854"}}];function Y(a){return te.find(d=>d.id===a)}const Ee={"icloud.com":"icloud","me.com":"icloud","mac.com":"icloud","yahoo.com":"yahoo","yahoo.co.uk":"yahoo","ymail.com":"yahoo","aol.com":"aol","fastmail.com":"fastmail","fastmail.fm":"fastmail"};function Ne(a){const d=a.indexOf("@");if(d===-1)return"";const c=a.slice(d+1).toLowerCase();return Ee[c]??""}const T=["Connector","Address","Servers","Credentials","Test","Sync"],A={connector:0,address:1,servers:2,credentials:3,test:4,sync:5},V={host:"",port:993,security:"tls"},J={host:"",port:587,security:"starttls"};function Pe({onStart:a,onImportConfig:d}){return t.useEffect(()=>{const c=p=>{p.key==="Enter"&&a()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),e.jsx(L,{steps:T,activeStep:0,hideSteps:!0,title:"Welcome to Remit",subtitle:d?"Set up your first account, or bring the settings from another Reader.":"One inbox for all your mail, with context about every message.",footer:e.jsxs(e.Fragment,{children:[d?e.jsx(k,{variant:"secondary",icon:e.jsx(ke,{className:"size-4"}),onClick:d,children:"Import a config file"}):e.jsxs("span",{className:"text-2xs text-fg-subtle",children:[e.jsx(he,{children:"Enter"})," to continue"]}),e.jsx(k,{variant:"primary",onClick:a,children:"Add your first account"})]}),children:e.jsxs("div",{className:"flex flex-col items-start py-5",children:[e.jsx("span",{className:"flex size-14 items-center justify-center rounded-md bg-accent-soft",children:e.jsx(Ce,{className:"size-7 text-accent"})}),e.jsx("p",{className:"mt-5 max-w-sm text-sm leading-relaxed text-fg-muted",children:"Remit syncs your existing mailboxes and tells you who is really writing to you — sender history, authenticity checks, and similar messages, right next to every email."}),d&&e.jsx("p",{className:"mt-3 max-w-sm text-sm leading-relaxed text-fg-muted",children:"A config file carries your accounts, folder roles, rules, flagged senders and appearance from another Reader. It never carries passwords, so you sign in again here."})]})})}function Te({onContinue:a,onMicrosoft:d,onBack:c,showBack:p}){const[h,o]=t.useState("imap");t.useEffect(()=>{const y=i=>{i.key==="Enter"&&(h==="microsoft"?d():a()),i.key==="Escape"&&c()};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[a,d,c,h]);const n=()=>{h==="microsoft"?d():a()};return e.jsx(L,{steps:T,activeStep:A.connector,title:"How does this account connect?",subtitle:"Choose a sign-in method. IMAP works with any provider.",footer:e.jsxs(e.Fragment,{children:[p?e.jsx(k,{variant:"ghost",onClick:c,children:"Back"}):e.jsx("span",{}),e.jsx(k,{variant:"primary",onClick:n,children:h==="microsoft"?"Continue with Microsoft":"Continue with IMAP"})]}),children:e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[e.jsx(W,{name:"IMAP / SMTP",description:"Any mail provider — Fastmail, iCloud, your own server.",icon:e.jsx(je,{className:"size-5"}),selected:h==="imap",onSelect:()=>o("imap")}),e.jsx(W,{name:"Gmail",description:"Sign in with Google. No app passwords.",icon:e.jsx($,{className:"size-5"}),comingSoon:!0}),e.jsx(W,{name:"Outlook / Microsoft 365",description:"Sign in with Microsoft. Works with Outlook.com and work accounts.",icon:e.jsx(pe,{className:"size-5"}),selected:h==="microsoft",onSelect:()=>o("microsoft")})]})})}function Ae({onBack:a,onConnected:d}){const[c,p]=t.useState(""),[h,o]=t.useState(null),[n,y]=t.useState(!1),[i,g]=t.useState(!1),v=t.useRef(!0);t.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]);const E=t.useRef(new Set),{refetch:w}=q(ee()),j=Se(r=>{if(g(!1),r==="stalled"){y(!1),o(be);return}w().then(({data:u,isError:N})=>{if(!v.current)return;if(N||!u){o("Couldn't check whether the sign-in finished. Open Settings › Accounts to see whether the account is connected.");return}o(null);const C=u.accounts.find(P=>!E.current.has(P.accountId));C&&d(C.accountId)})}),S=Z({...me(),onSuccess:r=>{v.current&&(j(),y(!0),window.location.assign(r.authorizationUrl))},onError:r=>{g(!1),o(r instanceof Error?r.message:"Failed to start sign-in")}}),l=i||S.isPending,f=()=>{l||(o(null),g(!0),w().then(({data:r,isError:u})=>{if(v.current){if(u||!r){g(!1),o("Couldn't read this instance's accounts, so sign-in can't be tracked. Check your connection and try again.");return}E.current=new Set(r.accounts.map(N=>N.accountId)),S.mutate({body:{email:c.trim()||void 0}})}}))},x=t.useRef(f);return x.current=f,t.useEffect(()=>{const r=u=>{u.key==="Enter"&&x.current(),u.key==="Escape"&&a()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[a]),e.jsx(L,{steps:T,activeStep:A.connector,title:"Sign in with Microsoft",subtitle:"You'll be redirected to Microsoft to sign in securely.",footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:a,children:"Back"}),e.jsx(k,{variant:"primary",onClick:f,disabled:l,icon:l?e.jsx(_,{className:"size-4 animate-spin"}):void 0,children:l?"Redirecting…":n?"Start over":"Sign in with Microsoft"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(z,{htmlFor:"microsoft-email",children:"Email address (optional)"}),e.jsx(Q,{id:"microsoft-email",icon:e.jsx($,{className:"size-4"}),placeholder:"you@outlook.com",value:c,onChange:r=>p(r.target.value),type:"email",autoComplete:"email"}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"Pre-fills the Microsoft sign-in form. Leave blank to choose on the Microsoft page."})]}),n&&e.jsx(H,{tone:"info",children:"Waiting for Microsoft. Finish signing in — this window carries on the moment the account is connected, wherever you finished."}),h&&e.jsx(H,{tone:"danger",children:h})]})})}function Ie({initialEmail:a,initialDisplayName:d,onContinue:c,onBack:p}){const[h,o]=t.useState(a),[n,y]=t.useState(d),[i,g]=t.useState(!1),[v,E]=t.useState(""),[w,j]=t.useState(null),S=t.useCallback(async()=>{const l=h.trim();if(!l.includes("@")||!l.includes(".")){j("Enter a valid email address.");return}j(null),g(!0),E(ge(l));try{const f=await ve(l);c(l,n.trim(),f)}finally{g(!1)}},[h,n,c]);return t.useEffect(()=>{const l=f=>{f.key==="Enter"&&!i&&S(),f.key==="Escape"&&p()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[S,i,p]),e.jsx(L,{steps:T,activeStep:A.address,title:"What's the email address?",subtitle:"We'll detect the server settings for you.",footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:p,children:"Back"}),e.jsx(k,{variant:"primary",disabled:i,onClick:()=>{S()},children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(z,{htmlFor:"onboarding-email",children:"Email address"}),e.jsx(Q,{id:"onboarding-email",icon:e.jsx($,{className:"size-4"}),placeholder:"you@example.com",value:h,onChange:l=>{o(l.target.value),j(null)},type:"email",autoComplete:"email"})]}),e.jsxs("div",{children:[e.jsx(z,{htmlFor:"onboarding-display-name",children:"Display name (optional)"}),e.jsx(Q,{id:"onboarding-display-name",placeholder:"Alice",value:n,onChange:l=>y(l.target.value)}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"What to call this account in Remit. Leave blank to use a name derived from the address."})]}),i&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(_,{className:"size-3.5 animate-spin text-accent"}),v]}),w&&!i&&e.jsx("div",{className:"mt-3",children:e.jsx(H,{tone:"danger",children:w})})]})})}function Me({email:a,imapConfig:d,smtpConfig:c,discovered:p,onContinue:h,onBack:o,onChange:n}){const[y,i]=t.useState(d),[g,v]=t.useState(c),[E,w]=t.useState(()=>Ne(a)),[j,S]=t.useState(!1),[l,f]=t.useState(null),x=Y(E),r=x!==void 0&&!j,u=t.useCallback(m=>{w(m),S(!1),f(null);const s=Y(m);s&&(i({host:s.imap.host,port:s.imap.port,security:s.imap.security}),v({host:s.smtp.host,port:s.smtp.port,security:s.smtp.security}))},[]);t.useEffect(()=>{n(y,g)},[y,g,n]);const N=y.host.trim()!=="",C=t.useCallback(()=>{if(!N){f("Enter the IMAP host.");return}f(null),h()},[N,h]);t.useEffect(()=>{const m=s=>{s.key==="Enter"&&C(),s.key==="Escape"&&o()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[C,o]);const P=a.split("@")[1]??"your domain",F=x?"Pick your provider to fill in the right settings — or choose Custom to enter them by hand.":p?"Found via autodiscovery — adjust anything that looks off.":`We couldn't detect settings for ${P} — enter them manually.`,I=r?{label:"preset",tone:"neutral"}:!x&&p?{label:"detected",tone:"positive"}:void 0,M=x?.passwordHelp.url??ye(a);return e.jsx(L,{steps:T,activeStep:A.servers,title:"Confirm server settings",subtitle:F,footer:e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"ghost",onClick:o,children:"Back"}),e.jsx(k,{variant:"primary",onClick:C,children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-5",children:[l&&e.jsx(H,{tone:"danger",children:l}),e.jsxs("div",{children:[e.jsx(z,{htmlFor:"provider-select",children:"Provider"}),e.jsxs(ue,{id:"provider-select",value:E,onChange:m=>u(m.target.value),children:[e.jsx("option",{value:"",children:"Custom / other"}),te.map(m=>e.jsx("option",{value:m.id,children:m.label},m.id))]}),x&&e.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:r?e.jsxs(e.Fragment,{children:["Server settings are pre-filled for ",x.label," and locked."," ",e.jsx("button",{type:"button",className:"text-accent underline",onClick:()=>S(!0),children:"Advanced"})," ","lets you edit them by hand."]}):e.jsxs(e.Fragment,{children:["Editing ",x.label,"'s settings by hand."]})})]}),e.jsx(X,{legend:"IMAP — incoming",badge:I,readOnly:r,host:y.host,port:String(y.port),security:y.security,hostPlaceholder:"imap.example.com",portPlaceholder:"993",onHostChange:m=>{i(s=>({...s,host:m})),f(null)},onPortChange:m=>i(s=>({...s,port:Number(m)})),onSecurityChange:m=>i(s=>({...s,security:m}))}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Sending (SMTP) is optional — leave it blank to set up a receive-only account and add sending later in Settings."}),e.jsx(X,{legend:"SMTP — outgoing (optional)",badge:I,readOnly:r,host:g.host,port:String(g.port),security:g.security,hostPlaceholder:"smtp.example.com",portPlaceholder:"587",onHostChange:m=>{v(s=>({...s,host:m})),f(null)},onPortChange:m=>v(s=>({...s,port:Number(m)})),onSecurityChange:m=>v(s=>({...s,security:m}))}),x&&e.jsxs("p",{className:"text-2xs text-fg-subtle",children:[x.passwordHelp.text," ",M&&e.jsx("a",{href:M,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"Get an app password"})]})]})})}const Le=2e4;function Fe({email:a,displayName:d,imapConfig:c,smtpConfig:p,username:h,password:o,onGoToInbox:n}){const y=ce(),[i,g]=t.useState(null),[v,E]=t.useState(null),w=t.useRef(!1),j=U(c.security),S=U(p.security),l=Z({...de(),onSuccess:b=>{g(b.accountId),y.invalidateQueries({queryKey:le()})},onError:b=>{E(b instanceof Error?b.message:"Failed to create account")}});t.useEffect(()=>{if(w.current)return;w.current=!0;const b=p.host.trim()!=="",R=we({imapHost:c.host,smtpHost:p.host,smtpPort:p.port}),O=b?R??{smtpHost:p.host,smtpPort:p.port,smtpTls:S.tls,smtpStartTls:S.startTls}:null;l.mutate({body:{email:a,displayName:d||void 0,username:h!==a?h:void 0,password:o,imapHost:c.host,imapPort:c.port,imapTls:j.tls,imapStartTls:j.startTls,smtpHost:O?.smtpHost||void 0,smtpPort:O?.smtpPort||void 0,smtpTls:O?.smtpTls??!1,smtpStartTls:O?.smtpStartTls??!1}})},[]);const{data:f,isError:x}=q({...K({path:{accountId:i??""}}),enabled:!!i,refetchInterval:b=>{const R=b.state.data?.syncPhase;return R==="complete"||R==="error"?!1:2e3}}),r=f?.syncPhase==="error",{data:u}=q({...ee(),enabled:!!i&&r}),N=u?.accounts.find(b=>b.accountId===i)?.lastError,C=f?.mailboxes.find(b=>b.fullPath==="INBOX"||b.fullPath==="Inbox"),P=f?.mailboxCountTotal??0,F=f?.mailboxCountSynced??0,I=C?.messagesTotal??0,M=C?.messagesSynced??0,m=I>0?M/I:0,s=f?.syncPhase,se=r?"failed":s==="idle"||s===void 0||s==="discovering_mailboxes"?"running":P>0?"ok":"running",G=r?"failed":!s||s==="idle"||s==="discovering_mailboxes"?"pending":s==="syncing_inbox"||s==="syncing_others"?"running":"ok",B=r?"failed":!s||s==="idle"||s==="discovering_mailboxes"||s==="syncing_inbox"?"pending":s==="syncing_others"?"running":"ok",ne=M>0||C?.phase==="complete"||s==="complete"||r,[ae,oe]=t.useState(!1);t.useEffect(()=>{if(!i)return;const b=setTimeout(()=>oe(!0),Le);return()=>clearTimeout(b)},[i]);const re=!!i&&(ne||x||ae);return v?e.jsx(L,{steps:T,activeStep:A.sync,title:"Couldn't create account",subtitle:"Something went wrong saving your account.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{}),e.jsx(k,{variant:"primary",onClick:()=>{w.current=!1,E(null),l.mutate({body:{email:a,displayName:d||void 0,username:h!==a?h:void 0,password:o,imapHost:c.host,imapPort:c.port,imapTls:j.tls,imapStartTls:j.startTls,smtpHost:p.host||void 0,smtpPort:p.port||void 0,smtpTls:S.tls,smtpStartTls:S.startTls}})},children:"Retry"})]}),children:e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:v})}):e.jsx(L,{steps:T,activeStep:A.sync,title:`Syncing ${a}`,subtitle:"Newest mail first — you can start reading right away.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Sync continues in the background"}),re?e.jsx(k,{variant:"primary",onClick:()=>i&&n(i),children:"Go to inbox"}):e.jsx(k,{variant:"primary",disabled:!0,icon:e.jsx(_,{className:"size-3.5 animate-spin"}),children:"Getting your mail…"})]}),children:l.isPending?e.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-fg-muted",children:[e.jsx(_,{className:"size-4 animate-spin text-accent"}),"Creating your account…"]}):e.jsxs("div",{className:"space-y-3",children:[I>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between text-xs",children:[e.jsx("span",{className:"font-medium text-fg",children:"INBOX"}),e.jsxs("span",{className:"text-fg-subtle tabular-nums",children:[M.toLocaleString()," / ",I.toLocaleString()," ","messages"]})]}),e.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-surface-sunken",children:e.jsx("div",{className:"h-full rounded-full bg-accent transition-all duration-500",style:{width:`${Math.max(2,m*100)}%`}})})]}),e.jsxs("div",{className:"divide-y divide-line",children:[e.jsx(D,{label:"Mailboxes discovered",detail:P>0?`${P} mailbox${P===1?"":"es"} found`:"Discovering…",state:se}),e.jsx(D,{label:"INBOX",detail:G==="ok"?`${M.toLocaleString()} messages synced`:G==="running"?"Syncing newest first…":"Queued",state:G}),F>1||s==="syncing_others"||s==="complete"?e.jsx(D,{label:"Other mailboxes",detail:B==="ok"?`${F-1} mailboxes synced`:B==="running"?"Syncing…":"Queued",state:B}):null]}),r&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("p",{className:"text-xs text-danger",children:["Sync stalled. The account is still active —"," ",e.jsx("button",{type:"button",className:"underline",onClick:()=>{y.invalidateQueries({queryKey:K({path:{accountId:i??""}}).queryKey})},children:"retry"})]}),N&&e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:N})]})]})})}function Be({skipWelcome:a=!1,onComplete:d,onCancel:c,onImportConfig:p}){const[h,o]=t.useState(a?"connector":"welcome"),[n,y]=t.useState({email:"",displayName:"",imapConfig:V,smtpConfig:J,username:"",password:"",discoveryResult:null,discovered:!1,createdAccountId:null}),i=t.useCallback(()=>o("connector"),[]),g=t.useCallback(()=>o("address"),[]),v=t.useCallback(()=>o("microsoft-email"),[]),E=t.useCallback(()=>{a?c?.():o("welcome")},[a,c]),w=t.useCallback((x,r,u)=>{let N=V,C=J,P=!1;u&&(P=u.source!=="heuristic",N={host:u.imap.host,port:u.imap.port,security:u.imap.security},C={host:u.smtp.host,port:u.smtp.port,security:u.smtp.security}),y(F=>({...F,email:x,displayName:r,imapConfig:N,smtpConfig:C,discoveryResult:u,discovered:P,username:x})),o("servers")},[]),j=t.useCallback((x,r)=>{y(u=>({...u,imapConfig:x,smtpConfig:r}))},[]),S=t.useCallback((x,r)=>{y(u=>({...u,username:x,password:r}))},[]),l=t.useCallback(()=>o("sync"),[]),f=t.useCallback(x=>{d(x)},[d]);switch(h){case"welcome":return e.jsx(Pe,{onStart:i,onImportConfig:p});case"connector":return e.jsx(Te,{onContinue:g,onMicrosoft:v,onBack:E,showBack:!a});case"microsoft-email":return e.jsx(Ae,{onBack:()=>o("connector"),onConnected:f});case"address":return e.jsx(Ie,{initialEmail:n.email,initialDisplayName:n.displayName,onContinue:w,onBack:()=>o("connector")});case"servers":return e.jsx(Me,{email:n.email,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,discovered:n.discovered,onContinue:()=>o("credentials"),onBack:()=>o("address"),onChange:j});case"credentials":return e.jsx(xe,{steps:T,activeStep:A.credentials,title:`Sign in to ${n.email.split("@")[1]||"your mail server"}`,subtitle:"Many providers require an app password instead of your normal one.",email:n.email,username:n.username,password:n.password,onContinue:()=>o("test"),onBack:()=>o("servers"),onChange:S});case"test":return e.jsx(fe,{steps:T,activeStep:A.test,email:n.email,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,username:n.username,password:n.password,onSuccess:l,onBackToCredentials:()=>o("credentials"),onBackToServers:()=>o("servers")});case"sync":return e.jsx(Fe,{email:n.email,displayName:n.displayName,imapConfig:n.imapConfig,smtpConfig:n.smtpConfig,username:n.username,password:n.password,onGoToInbox:f})}}export{Be as O,te as P,Y as g};
@@ -1,2 +1,2 @@
1
- import{j as e,t as h,f as S,a3 as K,X as _,c as Q,eK as V,s as X,Y as H,a0 as J,r as C}from"./index-nplGQyIX.js";import{u as ee,t as se,C as te,d as ae,p as ne}from"./CalendarComposePane-D5kbc0Wr.js";import{c as re,R as ie}from"./calendar-color-BOlDnJax.js";import{R as oe,A as le}from"./attendee-row-C3uA5noz.js";import{C as ce}from"./clock-Cfx4Qruv.js";import{G as U,M as de}from"./map-pin-CQRXt7-v.js";import{M as xe}from"./mail-DrMxpydq.js";import{P as me}from"./pencil-FWYSSPRP.js";import{u as fe,c as ue,U as he}from"./useCalendars-K-xkU16i.js";import{c as pe}from"./useCalendarData-jhAxBfDR.js";import{u as ge,b as ve}from"./window-Dq8s2Y-7.js";function v({icon:s,children:t}){return e.jsxs("div",{className:"flex items-start gap-2.5 py-1",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-fg-subtle",children:s}),e.jsx("div",{className:"min-w-0 flex-1 text-sm text-fg",children:t})]})}function be({event:s,calendar:t,whenText:n,onEdit:a,onDelete:o,onOpenThread:l,onClose:c,activeAttendee:x="",onActivateAttendee:b,renderAttendeeContext:k,touch:E=!1,chrome:D="header",className:r}){const R=re(t.color),d=e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-fg",children:s.title}),e.jsxs("div",{className:"mt-3 flex flex-col border-b border-line pb-3",children:[e.jsx(v,{icon:e.jsx(ce,{className:"size-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[n,s.attendees.length>0&&e.jsx(oe,{rsvp:s.myRsvp})]})}),s.zoneCertainty==="ambiguous"?e.jsx(v,{icon:e.jsx(U,{className:"size-4 text-warning"}),children:e.jsx("span",{className:"text-warning",children:"The mail said a time but never a zone. Shown in your own; confirm before you travel for it."})}):s.timeZone!==""&&e.jsx(v,{icon:e.jsx(U,{className:"size-4"}),children:s.timeZone}),s.recurrenceRule!==""&&e.jsx(v,{icon:e.jsx(ie,{className:"size-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.recurrenceRule,s.seriesException&&e.jsx("span",{className:"rounded-xs bg-warning-soft px-1.5 py-0.5 text-2xs text-warning",children:"Moved out of the series"})]})}),s.location!==""&&e.jsx(v,{icon:e.jsx(de,{className:"size-4"}),children:s.location})]}),s.threadId!==""&&l&&e.jsxs("button",{type:"button",onClick:l,className:"mt-3 flex w-full items-center gap-2.5 rounded-md border border-line bg-surface-sunken px-3 py-2 text-left outline-none hover:border-line-strong focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(xe,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:"From this thread"}),e.jsx("span",{className:"block truncate text-sm text-fg",children:s.threadSubject})]})]}),s.attendees.length>0&&e.jsx(le,{attendees:s.attendees,activeEmail:x,onActivate:b,renderContext:k,touch:E,className:"mt-3"}),s.notes!==""&&e.jsx("p",{className:"mt-3 whitespace-pre-wrap text-sm text-fg-muted",children:s.notes})]});return D==="bare"?e.jsx("div",{className:h("flex flex-col",r),children:d}):e.jsxs("article",{className:h("flex h-full w-full flex-col bg-surface",r),children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[e.jsx("span",{className:h("size-2.5 shrink-0 rounded-full",R.solid)}),e.jsxs("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:[t.name," · ",t.accountLabel]}),a&&e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(me,{className:"size-3.5"}),onClick:a,children:"Edit"}),o&&e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(K,{className:"size-3.5"}),onClick:o,className:"text-danger",children:"Delete"}),c&&e.jsx("button",{type:"button","aria-label":"Close event",onClick:c,className:"flex size-7 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(_,{className:"size-4"})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-3",children:d})]})}const je=[{scope:"this",label:"This event",note:"Leaves the rest of the series alone"},{scope:"following",label:"This and everything after",note:"Splits the series here"},{scope:"all",label:"The whole series",note:"Rewrites the rule itself"}];function Ne({title:s,ruleText:t,instanceText:n,onChoose:a,onCancel:o,touch:l,className:c}){return e.jsxs("div",{className:h("flex flex-col gap-3",c),children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-md font-semibold text-fg",children:[s," repeats"]}),e.jsx("p",{className:"text-xs text-fg-muted",children:t}),e.jsxs("p",{className:"text-xs text-fg-subtle",children:["You clicked ",n,"."]})]}),e.jsx("p",{className:"text-sm text-fg",children:"What should the change apply to?"}),e.jsx("div",{className:"flex flex-col gap-1.5",children:je.map(x=>e.jsxs("button",{type:"button",onClick:()=>a(x.scope),className:h("flex flex-col rounded-md border border-line bg-surface px-3 py-2 text-left outline-none transition-colors hover:border-line-strong hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",l&&"min-h-11 justify-center"),children:[e.jsx("span",{className:"text-sm font-medium text-fg",children:x.label}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:x.note})]},x.scope))}),e.jsx(S,{variant:"ghost",size:l?"md":"sm",onClick:o,className:h("self-start",l&&"min-h-11"),children:"Cancel"})]})}const we=s=>s.replace(/\r?\n[ \t]/g,""),Z=s=>s.replace(/\\n/gi,`
1
+ import{j as e,t as h,f as S,a3 as K,X as _,c as Q,eK as V,s as X,Y as H,a0 as J,r as C}from"./index-C3nvkB1j.js";import{u as ee,t as se,C as te,d as ae,p as ne}from"./CalendarComposePane-BsCRW_Ip.js";import{c as re,R as ie}from"./calendar-color-DiGD9E9z.js";import{R as oe,A as le}from"./attendee-row-Q5g6VNRt.js";import{C as ce}from"./clock-CztOmyyZ.js";import{G as U,M as de}from"./map-pin-BCdwL5Kr.js";import{M as xe}from"./mail-BmQATzkJ.js";import{P as me}from"./pencil-Cuw3Cj3L.js";import{u as fe,c as ue,U as he}from"./useCalendars-BbUHkfIU.js";import{c as pe}from"./useCalendarData-BjcRVZAJ.js";import{u as ge,b as ve}from"./window-Cc-1L1Rq.js";function v({icon:s,children:t}){return e.jsxs("div",{className:"flex items-start gap-2.5 py-1",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-fg-subtle",children:s}),e.jsx("div",{className:"min-w-0 flex-1 text-sm text-fg",children:t})]})}function be({event:s,calendar:t,whenText:n,onEdit:a,onDelete:o,onOpenThread:l,onClose:c,activeAttendee:x="",onActivateAttendee:b,renderAttendeeContext:k,touch:E=!1,chrome:D="header",className:r}){const R=re(t.color),d=e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-fg",children:s.title}),e.jsxs("div",{className:"mt-3 flex flex-col border-b border-line pb-3",children:[e.jsx(v,{icon:e.jsx(ce,{className:"size-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[n,s.attendees.length>0&&e.jsx(oe,{rsvp:s.myRsvp})]})}),s.zoneCertainty==="ambiguous"?e.jsx(v,{icon:e.jsx(U,{className:"size-4 text-warning"}),children:e.jsx("span",{className:"text-warning",children:"The mail said a time but never a zone. Shown in your own; confirm before you travel for it."})}):s.timeZone!==""&&e.jsx(v,{icon:e.jsx(U,{className:"size-4"}),children:s.timeZone}),s.recurrenceRule!==""&&e.jsx(v,{icon:e.jsx(ie,{className:"size-4"}),children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.recurrenceRule,s.seriesException&&e.jsx("span",{className:"rounded-xs bg-warning-soft px-1.5 py-0.5 text-2xs text-warning",children:"Moved out of the series"})]})}),s.location!==""&&e.jsx(v,{icon:e.jsx(de,{className:"size-4"}),children:s.location})]}),s.threadId!==""&&l&&e.jsxs("button",{type:"button",onClick:l,className:"mt-3 flex w-full items-center gap-2.5 rounded-md border border-line bg-surface-sunken px-3 py-2 text-left outline-none hover:border-line-strong focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(xe,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:"From this thread"}),e.jsx("span",{className:"block truncate text-sm text-fg",children:s.threadSubject})]})]}),s.attendees.length>0&&e.jsx(le,{attendees:s.attendees,activeEmail:x,onActivate:b,renderContext:k,touch:E,className:"mt-3"}),s.notes!==""&&e.jsx("p",{className:"mt-3 whitespace-pre-wrap text-sm text-fg-muted",children:s.notes})]});return D==="bare"?e.jsx("div",{className:h("flex flex-col",r),children:d}):e.jsxs("article",{className:h("flex h-full w-full flex-col bg-surface",r),children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[e.jsx("span",{className:h("size-2.5 shrink-0 rounded-full",R.solid)}),e.jsxs("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:[t.name," · ",t.accountLabel]}),a&&e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(me,{className:"size-3.5"}),onClick:a,children:"Edit"}),o&&e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(K,{className:"size-3.5"}),onClick:o,className:"text-danger",children:"Delete"}),c&&e.jsx("button",{type:"button","aria-label":"Close event",onClick:c,className:"flex size-7 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(_,{className:"size-4"})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-3",children:d})]})}const je=[{scope:"this",label:"This event",note:"Leaves the rest of the series alone"},{scope:"following",label:"This and everything after",note:"Splits the series here"},{scope:"all",label:"The whole series",note:"Rewrites the rule itself"}];function Ne({title:s,ruleText:t,instanceText:n,onChoose:a,onCancel:o,touch:l,className:c}){return e.jsxs("div",{className:h("flex flex-col gap-3",c),children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-md font-semibold text-fg",children:[s," repeats"]}),e.jsx("p",{className:"text-xs text-fg-muted",children:t}),e.jsxs("p",{className:"text-xs text-fg-subtle",children:["You clicked ",n,"."]})]}),e.jsx("p",{className:"text-sm text-fg",children:"What should the change apply to?"}),e.jsx("div",{className:"flex flex-col gap-1.5",children:je.map(x=>e.jsxs("button",{type:"button",onClick:()=>a(x.scope),className:h("flex flex-col rounded-md border border-line bg-surface px-3 py-2 text-left outline-none transition-colors hover:border-line-strong hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",l&&"min-h-11 justify-center"),children:[e.jsx("span",{className:"text-sm font-medium text-fg",children:x.label}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:x.note})]},x.scope))}),e.jsx(S,{variant:"ghost",size:l?"md":"sm",onClick:o,className:h("self-start",l&&"min-h-11"),children:"Cancel"})]})}const we=s=>s.replace(/\r?\n[ \t]/g,""),Z=s=>s.replace(/\\n/gi,`
2
2
  `).replace(/\\,/g,",").replace(/\\;/g,";").replace(/\\\\/g,"\\");function Ce(s,t){let n=!1;for(let a=t.length;a<s.length;a+=1){const o=s[a];if(a===t.length&&o!==";"&&o!==":")return;if(o==='"'){n=!n;continue}if(!n&&o===":")return s.slice(a+1).trim()}}function A(s,t){for(const n of we(s).split(/\r?\n/)){if(!n.startsWith(t))continue;const a=Ce(n,t);if(a!==void 0)return a}return""}const ye=s=>A(s,"RRULE"),ke=s=>({location:Z(A(s,"LOCATION")),description:Z(A(s,"DESCRIPTION"))}),Ee=X(404);function De(s,t){const{data:n,isLoading:a,error:o,refetch:l}=Q({...V({path:{calendarObjectId:s},query:{calendarId:t}}),meta:Ee,enabled:s!==""&&t!==""});return{resource:n,isLoading:a,error:o,refetch:()=>{l()}}}const z=new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"long"}),y=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});function G(s){const t=new Date(s.start),n=new Date(s.end),a=z.format(t);return s.allDay?`${a}, all day`:z.format(n)===a?`${a}, ${y.format(t)} – ${y.format(n)}`:`${a}, ${y.format(t)} – ${z.format(n)}, ${y.format(n)}`}function Re({event:s,calendar:t,isOccurrence:n,problem:a="",onEdit:o,onDelete:l,onClose:c}){return!s||!t?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-surface p-8 text-center",children:[e.jsx(H,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"That event isn't on this week"}),e.jsx("p",{className:"max-w-xs text-sm text-fg-muted",children:"The address names an event the calendar doesn't have here."}),e.jsx("button",{type:"button",onClick:c,className:"rounded-md border border-line px-2.5 py-1 text-sm font-medium text-fg outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Back to the calendar"})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-surface",children:[n&&e.jsx("p",{className:"shrink-0 border-b border-line bg-surface-sunken px-row-inset py-1.5 text-2xs uppercase tracking-wider text-fg-subtle",children:"One occurrence of a repeating event"}),a!==""&&e.jsxs("div",{role:"alert",className:"flex shrink-0 items-start gap-2 border-b border-danger/40 bg-danger-soft px-row-inset py-2 text-sm",children:[e.jsx(J,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("p",{className:"min-w-0 flex-1 break-words text-fg",children:a})]}),e.jsx(be,{event:s,calendar:t,whenText:G(s),onEdit:o,onDelete:l,onClose:c,className:"min-h-0 flex-1"})]})}const Te="This event changed somewhere else — over CalDAV, or in another tab. Nothing was saved. Close it and open it again to see the version that's stored now.";function Be({calendarObjectId:s,recurrenceId:t}){const{view:n,date:a,calendarIds:o}=ge(),{events:l}=pe({view:n,date:a,calendarIds:o}),{calendars:c,timeZoneByCalendarId:x}=fe(),{closeEvent:b}=ve(),{updateEvent:k,deleteEvent:E,isWriting:D}=ee(),r=l.find(i=>i.id===ue(s,t??"")),R=c.find(i=>i.id===r?.calendarId),{resource:d}=De(s,r?.calendarId??""),[I,p]=C.useState(void 0),[f,T]=C.useState(void 0),[u,j]=C.useState(void 0),[L,g]=C.useState(""),N=d?ke(d.icalData):void 0,F=d?ye(d.icalData):"",Y=r&&!r.allDay?r.start.slice(11,16):"",w=F===""?"":se(F,Y)??"Repeats",O=r!==void 0&&r.seriesId!==""&&t!==void 0&&t!=="",P=r!==void 0&&d!==void 0,$=(i,m)=>{if(i.kind==="written"){g(""),m();return}g(i.kind==="conflict"?Te:i.message)},M=i=>({calendarObjectId:s,calendarId:r?.calendarId??"",recurrenceId:t??"",scope:i,etag:d?.etag??""}),W=i=>{if(!r)return;const m=ae(r,{repeat:w,location:N?.location??"",notes:N?.description??""});p(void 0),T({before:m,scope:i}),j(m),g("")},B=i=>{p(void 0),E(M(i)).then(m=>$(m,b))},q=()=>{if(!f||!u)return;const i=ne(f.before,u,x[u.calendarId]??he);if(!i.ok){g(i.problem);return}k(M(f.scope),i.patch).then(m=>$(m,()=>{T(void 0),j(void 0)}))};return I!==void 0&&r?e.jsx("div",{className:"flex h-full flex-col justify-center bg-surface px-row-inset",children:e.jsx(Ne,{className:"mx-auto w-full max-w-md",title:r.title,ruleText:w===""?"It repeats":w,instanceText:G(r),onChoose:I==="edit"?W:B,onCancel:()=>p(void 0)})}):f&&u?e.jsx(te,{title:"Edit event",subtitle:f.scope==="this"?"This occurrence only":u.date,calendars:c,draft:u,onChange:j,problem:L,saveLabel:"Save",isSaving:D,repeatEditable:f.scope===void 0||f.scope==="all",calendarEditable:!1,onSave:q,onCancel:()=>{T(void 0),j(void 0),g("")}}):e.jsx(Re,{event:r&&{...r,location:N?.location??"",notes:N?.description??"",recurrenceRule:w},calendar:R,isOccurrence:t!==void 0,problem:L,onEdit:P?()=>O?p("edit"):W(void 0):void 0,onDelete:P?()=>O?p("delete"):B(void 0):void 0,onClose:b})}export{Be as O};
@@ -1 +1 @@
1
- import{ar as g,a0 as w,L as C,j as s,t as b,a3 as $,a1 as S,a9 as _,u as q,cj as H,r as x,cl as K,c as U,ad as W,C as G,df as J,h as V,at as X,cK as Y,i as v,av as y,cD as Z,cE as ee,bO as p,eA as se}from"./index-nplGQyIX.js";import{a as te,u as k,L as R}from"./roving-focus-CB9g2g6l.js";import{u as ne,p as ae,R as j,c as oe}from"./useSearchTokenContext-MxM1d1hd.js";import{C as D}from"./circle-check-big-CAabu53t.js";import{C as I}from"./clock-Cfx4Qruv.js";import{R as re}from"./row-actions-vD6hiM3N.js";import{R as ie}from"./rotate-ccw-DelBW9mG.js";import{N as A}from"./NavMenuButton-CooA4fiY.js";import{i as le,s as L}from"./outbox-status-BlKn6P0x.js";import{n as ce}from"./search-query-Cr_ZXBCp.js";import{f as de}from"./useMessageBodyContent-Bnpk0TFc.js";const ue={queued:{icon:I,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2",spin:!0},sent:{icon:D,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}};function O({status:e,iconOnly:n,className:a}){const t=ue[e],o=t.icon;return s.jsxs("span",{className:b("inline-flex items-center gap-1.5 text-xs font-medium",t.className,a),children:[s.jsx(o,{className:b("size-4",t.spin&&"animate-spin")}),!n&&t.label]})}const xe=(e,n)=>n?"bg-accent-2-soft":e==="failed"?"bg-danger-soft":e==="blocked"||e==="unfiled"?"bg-warning/10":"";function fe({recipients:e,subject:n,time:a,status:t,error:o,selected:l,onSelect:c,onRetry:r,retrying:d,onEdit:i,onDelete:f,deleting:u}){const m=t==="failed"||t==="blocked"||t==="unfiled";return s.jsxs("div",{className:b("flex items-start gap-3 border-b border-line px-4 py-3 transition-colors hover:bg-surface-raised",xe(t,l)),children:[s.jsxs("button",{type:"button",...te,onClick:c,className:"flex flex-1 min-w-0 items-start gap-3 text-left",children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(O,{status:t,iconOnly:!0})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:e}),s.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:a})]}),s.jsx("div",{className:"truncate text-sm",children:n||"No subject"}),s.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[s.jsx(O,{status:t}),o&&s.jsxs("span",{className:"truncate text-xs text-fg-muted",children:["— ",o]})]})]})]}),m&&s.jsx("div",{className:"shrink-0",children:s.jsx(re,{actions:[...t==="failed"&&r?[{label:"Retry sending",iconOnly:!0,icon:s.jsx(ie,{className:"size-3.5"}),busy:d,onClick:r}]:[],...t==="unfiled"?[]:[{label:"Edit as draft",iconOnly:!0,icon:s.jsx(S,{className:"size-3.5"}),onClick:i}]],destructive:{label:"Delete message",iconOnly:!0,icon:s.jsx($,{className:"size-3.5"}),busy:u,confirm:{prompt:"Delete this message?",confirmLabel:"Delete"},onClick:f}})})]})}function Ee(){return _({from:"/mail/outbox/draft/$outboxMessageId",shouldThrow:!1})?.outboxMessageId}function me(){const e=q(),n=H();return x.useCallback(a=>{e({to:"/mail/outbox/draft/$outboxMessageId",params:{outboxMessageId:a},search:t=>t,hash:n})},[e,n])}function he(){return K()}function be(e,n){const a=n.trim().toLowerCase();if(a.length===0)return!0;const t=[e.subject,e.fromAddress,e.fromName,...e.toAddresses??[],...e.ccAddresses??[]].filter(o=>typeof o=="string").join(" ").toLowerCase();return a.split(/\s+/).every(o=>o.length===0||t.includes(o))}function ge(e){return e.tokens.length>0&&e.freeText.trim().length===0}const T={queued:{icon:I,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2"},sent:{icon:D,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}},pe=e=>se(e).toDateString()===new Date().toDateString()?p(e,{hour:"numeric",minute:"2-digit"}):p(e,{month:"short",day:"numeric"}),M=e=>p(e,{dateStyle:"medium",timeStyle:"short"}),je=e=>{const n=e.toAddresses??[];return n.length===0?"No recipients":n.length===1?n[0]:`${n[0]} +${n.length-1}`},E=(e,n)=>n?"The outbox cannot filter on those terms":e?"No matching outbox messages":"No outbox messages",Q=x.createContext(null);function N(){const e=x.useContext(Q);if(!e)throw new Error("OutboxPane.* must be used inside <OutboxPane>");return e}function Ne({outboxMessageId:e,children:n}){const a=me(),t=he(),{data:o,isLoading:l}=U(W()),{searchQuery:c}=G(),r=ne(),d=ce(c),i=ae(d,r),f=d.length>0,u=ge(i),m=x.useMemo(()=>u?[]:(o?.items??[]).filter(h=>le(h.status)).filter(h=>be(h,i.freeText)),[o,i.freeText,u]),z=x.useMemo(()=>m.find(h=>h.outboxMessageId===e),[m,e]),F={messages:m,hasQuery:f,unsupportedQuery:u,isLoading:l,selectedMessageId:e,selectedMessage:z,onOpenMessage:a,onCloseMessage:t};return s.jsx(Q.Provider,{value:F,children:n})}function P({message:e,isSelected:n,onSelect:a}){const t=V(),o=de(),{pushError:l}=X(),c=x.useCallback(()=>{t.invalidateQueries({queryKey:Y()})},[t]),r=v({...Z(),onSuccess:c,onError:u=>{l(y("Couldn't resend message","The message wasn't sent.",u))}}),d=v({...ee(),onSuccess:c,onError:u=>{l(y("Couldn't delete message","The message wasn't deleted.",u))}}),i=e.status;if(!T[i])return null;const f=L(e.status);return s.jsx(fe,{recipients:je(e),subject:e.subject||"",time:pe(e.sentAt??e.updatedAt),status:i,error:f?e.lastError??void 0:void 0,selected:n,onSelect:a,onRetry:i==="failed"?()=>r.mutate({path:{outboxMessageId:e.outboxMessageId}}):void 0,retrying:r.isPending,onEdit:()=>o(e.outboxMessageId),onDelete:()=>d.mutate({path:{outboxMessageId:e.outboxMessageId}}),deleting:d.isPending})}function B({message:e,onBack:n}){const a=e.status,t=T[a],o=t?.icon??S,l=e.sentAt?M(e.sentAt):M(e.updatedAt);return s.jsxs("div",{className:"h-full overflow-y-auto bg-canvas",children:[s.jsxs("div",{className:"border-b border-line p-4",children:[n&&s.jsxs("button",{type:"button",onClick:n,className:"mb-3 inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg",children:[s.jsx(J,{className:"size-4"}),s.jsx("span",{children:"Back"})]}),s.jsx("h1",{className:"text-xl font-semibold mb-3",children:e.subject||"(No subject)"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"From:"}),s.jsx("span",{className:"text-fg",children:e.fromName?`${e.fromName} <${e.fromAddress}>`:e.fromAddress})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"To:"}),s.jsx("span",{className:"text-fg",children:(e.toAddresses??[]).join(", ")})]}),e.ccAddresses&&e.ccAddresses.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Cc:"}),s.jsx("span",{className:"text-fg",children:e.ccAddresses.join(", ")})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Date:"}),s.jsx("span",{className:"text-fg",children:l})]}),t&&s.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.jsx(o,{className:b("size-4",t.className,a==="sending"&&"animate-spin")}),s.jsx("span",{className:b("text-xs font-medium",t.className),children:t.label}),L(e.status)&&e.lastError&&s.jsxs("span",{className:"text-xs text-fg-muted",children:["— ",e.lastError]})]})]})]}),s.jsx("div",{className:"p-4",children:s.jsx(oe,{html:e.htmlBody,text:e.textBody})})]})}function ve(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,onOpenMessage:l}=N(),c=x.useRef(null);return k({containerRef:c,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:E(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(A,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:c,className:"flex-1 overflow-y-auto",children:e.map(r=>s.jsx(P,{message:r,isSelected:o===r.outboxMessageId,onSelect:()=>l(r.outboxMessageId)},r.outboxMessageId))})]})}function ye(){const{selectedMessage:e}=N();return s.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsx("header",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-3"}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?s.jsx(B,{message:e}):s.jsx(j,{message:"Select a message to read",showHints:!1})})]})}function Oe(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,selectedMessage:l,onOpenMessage:c,onCloseMessage:r}=N(),d=x.useRef(null);return k({containerRef:d,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):l?s.jsx(B,{message:l,onBack:r}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:E(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(A,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:d,className:"flex-1 overflow-y-auto",children:e.map(i=>s.jsx(P,{message:i,isSelected:o===i.outboxMessageId,onSelect:()=>c(i.outboxMessageId)},i.outboxMessageId))})]})}const Qe=Object.assign(Ne,{List:ve,Reading:ye,Phone:Oe});export{Qe as O,Ee as u};
1
+ import{ar as g,a0 as w,L as C,j as s,t as b,a3 as $,a1 as S,a9 as _,u as q,cj as H,r as x,cl as K,c as U,ad as W,C as G,df as J,h as V,at as X,cK as Y,i as v,av as y,cD as Z,cE as ee,bO as p,eA as se}from"./index-C3nvkB1j.js";import{a as te,u as k,L as R}from"./roving-focus-geTPv6vY.js";import{u as ne,p as ae,R as j,c as oe}from"./useSearchTokenContext-BSpmqddM.js";import{C as D}from"./circle-check-big-EJFD8UIQ.js";import{C as I}from"./clock-CztOmyyZ.js";import{R as re}from"./row-actions-BVgTod6v.js";import{R as ie}from"./rotate-ccw-BR8jjqUY.js";import{N as A}from"./NavMenuButton-Zq_pjyhs.js";import{i as le,s as L}from"./outbox-status-BlKn6P0x.js";import{n as ce}from"./search-query-Cr_ZXBCp.js";import{f as de}from"./useMessageBodyContent-DIrkHtbX.js";const ue={queued:{icon:I,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2",spin:!0},sent:{icon:D,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}};function O({status:e,iconOnly:n,className:a}){const t=ue[e],o=t.icon;return s.jsxs("span",{className:b("inline-flex items-center gap-1.5 text-xs font-medium",t.className,a),children:[s.jsx(o,{className:b("size-4",t.spin&&"animate-spin")}),!n&&t.label]})}const xe=(e,n)=>n?"bg-accent-2-soft":e==="failed"?"bg-danger-soft":e==="blocked"||e==="unfiled"?"bg-warning/10":"";function fe({recipients:e,subject:n,time:a,status:t,error:o,selected:l,onSelect:c,onRetry:r,retrying:d,onEdit:i,onDelete:f,deleting:u}){const m=t==="failed"||t==="blocked"||t==="unfiled";return s.jsxs("div",{className:b("flex items-start gap-3 border-b border-line px-4 py-3 transition-colors hover:bg-surface-raised",xe(t,l)),children:[s.jsxs("button",{type:"button",...te,onClick:c,className:"flex flex-1 min-w-0 items-start gap-3 text-left",children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(O,{status:t,iconOnly:!0})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:e}),s.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:a})]}),s.jsx("div",{className:"truncate text-sm",children:n||"No subject"}),s.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[s.jsx(O,{status:t}),o&&s.jsxs("span",{className:"truncate text-xs text-fg-muted",children:["— ",o]})]})]})]}),m&&s.jsx("div",{className:"shrink-0",children:s.jsx(re,{actions:[...t==="failed"&&r?[{label:"Retry sending",iconOnly:!0,icon:s.jsx(ie,{className:"size-3.5"}),busy:d,onClick:r}]:[],...t==="unfiled"?[]:[{label:"Edit as draft",iconOnly:!0,icon:s.jsx(S,{className:"size-3.5"}),onClick:i}]],destructive:{label:"Delete message",iconOnly:!0,icon:s.jsx($,{className:"size-3.5"}),busy:u,confirm:{prompt:"Delete this message?",confirmLabel:"Delete"},onClick:f}})})]})}function Ee(){return _({from:"/mail/outbox/draft/$outboxMessageId",shouldThrow:!1})?.outboxMessageId}function me(){const e=q(),n=H();return x.useCallback(a=>{e({to:"/mail/outbox/draft/$outboxMessageId",params:{outboxMessageId:a},search:t=>t,hash:n})},[e,n])}function he(){return K()}function be(e,n){const a=n.trim().toLowerCase();if(a.length===0)return!0;const t=[e.subject,e.fromAddress,e.fromName,...e.toAddresses??[],...e.ccAddresses??[]].filter(o=>typeof o=="string").join(" ").toLowerCase();return a.split(/\s+/).every(o=>o.length===0||t.includes(o))}function ge(e){return e.tokens.length>0&&e.freeText.trim().length===0}const T={queued:{icon:I,label:"Queued",className:"text-warning"},sending:{icon:C,label:"Sending…",className:"text-accent-2"},sent:{icon:D,label:"Sent",className:"text-positive"},unfiled:{icon:g,label:"Sent, not filed",className:"text-warning"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:g,label:"Blocked",className:"text-warning"}},pe=e=>se(e).toDateString()===new Date().toDateString()?p(e,{hour:"numeric",minute:"2-digit"}):p(e,{month:"short",day:"numeric"}),M=e=>p(e,{dateStyle:"medium",timeStyle:"short"}),je=e=>{const n=e.toAddresses??[];return n.length===0?"No recipients":n.length===1?n[0]:`${n[0]} +${n.length-1}`},E=(e,n)=>n?"The outbox cannot filter on those terms":e?"No matching outbox messages":"No outbox messages",Q=x.createContext(null);function N(){const e=x.useContext(Q);if(!e)throw new Error("OutboxPane.* must be used inside <OutboxPane>");return e}function Ne({outboxMessageId:e,children:n}){const a=me(),t=he(),{data:o,isLoading:l}=U(W()),{searchQuery:c}=G(),r=ne(),d=ce(c),i=ae(d,r),f=d.length>0,u=ge(i),m=x.useMemo(()=>u?[]:(o?.items??[]).filter(h=>le(h.status)).filter(h=>be(h,i.freeText)),[o,i.freeText,u]),z=x.useMemo(()=>m.find(h=>h.outboxMessageId===e),[m,e]),F={messages:m,hasQuery:f,unsupportedQuery:u,isLoading:l,selectedMessageId:e,selectedMessage:z,onOpenMessage:a,onCloseMessage:t};return s.jsx(Q.Provider,{value:F,children:n})}function P({message:e,isSelected:n,onSelect:a}){const t=V(),o=de(),{pushError:l}=X(),c=x.useCallback(()=>{t.invalidateQueries({queryKey:Y()})},[t]),r=v({...Z(),onSuccess:c,onError:u=>{l(y("Couldn't resend message","The message wasn't sent.",u))}}),d=v({...ee(),onSuccess:c,onError:u=>{l(y("Couldn't delete message","The message wasn't deleted.",u))}}),i=e.status;if(!T[i])return null;const f=L(e.status);return s.jsx(fe,{recipients:je(e),subject:e.subject||"",time:pe(e.sentAt??e.updatedAt),status:i,error:f?e.lastError??void 0:void 0,selected:n,onSelect:a,onRetry:i==="failed"?()=>r.mutate({path:{outboxMessageId:e.outboxMessageId}}):void 0,retrying:r.isPending,onEdit:()=>o(e.outboxMessageId),onDelete:()=>d.mutate({path:{outboxMessageId:e.outboxMessageId}}),deleting:d.isPending})}function B({message:e,onBack:n}){const a=e.status,t=T[a],o=t?.icon??S,l=e.sentAt?M(e.sentAt):M(e.updatedAt);return s.jsxs("div",{className:"h-full overflow-y-auto bg-canvas",children:[s.jsxs("div",{className:"border-b border-line p-4",children:[n&&s.jsxs("button",{type:"button",onClick:n,className:"mb-3 inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg",children:[s.jsx(J,{className:"size-4"}),s.jsx("span",{children:"Back"})]}),s.jsx("h1",{className:"text-xl font-semibold mb-3",children:e.subject||"(No subject)"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"From:"}),s.jsx("span",{className:"text-fg",children:e.fromName?`${e.fromName} <${e.fromAddress}>`:e.fromAddress})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"To:"}),s.jsx("span",{className:"text-fg",children:(e.toAddresses??[]).join(", ")})]}),e.ccAddresses&&e.ccAddresses.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Cc:"}),s.jsx("span",{className:"text-fg",children:e.ccAddresses.join(", ")})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Date:"}),s.jsx("span",{className:"text-fg",children:l})]}),t&&s.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.jsx(o,{className:b("size-4",t.className,a==="sending"&&"animate-spin")}),s.jsx("span",{className:b("text-xs font-medium",t.className),children:t.label}),L(e.status)&&e.lastError&&s.jsxs("span",{className:"text-xs text-fg-muted",children:["— ",e.lastError]})]})]})]}),s.jsx("div",{className:"p-4",children:s.jsx(oe,{html:e.htmlBody,text:e.textBody})})]})}function ve(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,onOpenMessage:l}=N(),c=x.useRef(null);return k({containerRef:c,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:E(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(A,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:c,className:"flex-1 overflow-y-auto",children:e.map(r=>s.jsx(P,{message:r,isSelected:o===r.outboxMessageId,onSelect:()=>l(r.outboxMessageId)},r.outboxMessageId))})]})}function ye(){const{selectedMessage:e}=N();return s.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsx("header",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-3"}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?s.jsx(B,{message:e}):s.jsx(j,{message:"Select a message to read",showHints:!1})})]})}function Oe(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,selectedMessage:l,onOpenMessage:c,onCloseMessage:r}=N(),d=x.useRef(null);return k({containerRef:d,itemSelector:R}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):l?s.jsx(B,{message:l,onBack:r}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(j,{message:E(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(A,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:d,className:"flex-1 overflow-y-auto",children:e.map(i=>s.jsx(P,{message:i,isSelected:o===i.outboxMessageId,onSelect:()=>c(i.outboxMessageId)},i.outboxMessageId))})]})}const Qe=Object.assign(Ne,{List:ve,Reading:ye,Phone:Oe});export{Qe as O,Ee as u};
@@ -0,0 +1 @@
1
+ import{O as o}from"./index-C3nvkB1j.js";const n=o;export{n as component};
@@ -0,0 +1 @@
1
+ import{aj as m,j as o,O as p}from"./index-C3nvkB1j.js";import{a}from"./MailShell-BAufa90z.js";import{M as r}from"./MailboxPane-DEHvuR-_.js";import{d as e}from"./search-token-index-Gua3DAMw.js";import{u as s}from"./search-mirror-CktyWTNZ.js";import"./FullCompose-R0T9BGXI.js";import"./ErrorState-CJTd3Tdb.js";import"./index-C5Kbx4oU.js";import"./useMessageBodyContent-DIrkHtbX.js";import"./useSignature-d8ShaxGe.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-B7V9qfV6.js";import"./sections-DWDKrIb_.js";import"./confirm-dialog-Db8A2eMO.js";import"./useSearchTokenContext-BSpmqddM.js";import"./kbd-BsZ5TwSB.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-DIuMf3Yl.js";import"./circle-check-big-EJFD8UIQ.js";import"./refresh-cw-BaKyxffZ.js";import"./useQueries-B0RzAdbY.js";import"./MailListHeader-BDTDDZso.js";import"./roving-focus-geTPv6vY.js";import"./attachment-file-BKnJE5i7.js";import"./mail-BmQATzkJ.js";import"./avatar-CpvvuFKb.js";import"./EmptyState-SiNhuwMY.js";import"./download-B4DThtpy.js";import"./calendar-event-chip-C01FZqo9.js";import"./calendar-color-DiGD9E9z.js";import"./map-pin-BCdwL5Kr.js";import"./attendee-row-Q5g6VNRt.js";import"./clock-CztOmyyZ.js";import"./useLayoutTier-EgUCgdx3.js";import"./shield-check-BuzECgn-.js";import"./useFilters-CpgltZXL.js";import"./menu-lRFfNolt.js";import"./MailViewChrome-xVnsbwWk.js";import"./NavMenuButton-Zq_pjyhs.js";import"./useLabels-BuKWOv6s.js";import"./useSemanticSearch-Dps5HKPc.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-ziTMHWKM.js";import"./circle-help-DJPZs0YB.js";import"./circle-check-DpSrf3Bf.js";function oo(){const{mailboxId:t}=m.useParams(),i=e();return s({to:"/mail/$mailboxId",params:{mailboxId:t}}),o.jsx(r,{mailboxId:t,thread:i,children:o.jsx(a,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(p,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!i})})}export{oo as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-C3nvkB1j.js";import{M as r}from"./MailboxPane-DEHvuR-_.js";import"./useSearchTokenContext-BSpmqddM.js";import"./kbd-BsZ5TwSB.js";import"./useMessageBodyContent-DIrkHtbX.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-DIuMf3Yl.js";import"./circle-check-big-EJFD8UIQ.js";import"./refresh-cw-BaKyxffZ.js";import"./useQueries-B0RzAdbY.js";import"./MailListHeader-BDTDDZso.js";import"./roving-focus-geTPv6vY.js";import"./search-token-index-Gua3DAMw.js";import"./attachment-file-BKnJE5i7.js";import"./mail-BmQATzkJ.js";import"./avatar-CpvvuFKb.js";import"./index-C5Kbx4oU.js";import"./useSignature-d8ShaxGe.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-B7V9qfV6.js";import"./sections-DWDKrIb_.js";import"./EmptyState-SiNhuwMY.js";import"./ErrorState-CJTd3Tdb.js";import"./download-B4DThtpy.js";import"./calendar-event-chip-C01FZqo9.js";import"./calendar-color-DiGD9E9z.js";import"./map-pin-BCdwL5Kr.js";import"./attendee-row-Q5g6VNRt.js";import"./clock-CztOmyyZ.js";import"./useLayoutTier-EgUCgdx3.js";import"./shield-check-BuzECgn-.js";import"./useFilters-CpgltZXL.js";import"./confirm-dialog-Db8A2eMO.js";import"./menu-lRFfNolt.js";import"./MailViewChrome-xVnsbwWk.js";import"./NavMenuButton-Zq_pjyhs.js";import"./useLabels-BuKWOv6s.js";import"./useSemanticSearch-Dps5HKPc.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-ziTMHWKM.js";import"./circle-help-DJPZs0YB.js";import"./circle-check-DpSrf3Bf.js";function S(){return o.jsx(r.Reading,{})}export{S as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-C3nvkB1j.js";import{F as r}from"./FlaggedPane-uDAIYY0G.js";import"./useSearchTokenContext-BSpmqddM.js";import"./kbd-BsZ5TwSB.js";import"./useMessageBodyContent-DIrkHtbX.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-BDTDDZso.js";import"./roving-focus-geTPv6vY.js";import"./search-token-index-Gua3DAMw.js";import"./useQueries-B0RzAdbY.js";import"./attachment-file-BKnJE5i7.js";import"./mail-BmQATzkJ.js";import"./avatar-CpvvuFKb.js";import"./index-C5Kbx4oU.js";import"./useSignature-d8ShaxGe.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-B7V9qfV6.js";import"./sections-DWDKrIb_.js";import"./EmptyState-SiNhuwMY.js";import"./ErrorState-CJTd3Tdb.js";import"./download-B4DThtpy.js";import"./calendar-event-chip-C01FZqo9.js";import"./calendar-color-DiGD9E9z.js";import"./map-pin-BCdwL5Kr.js";import"./attendee-row-Q5g6VNRt.js";import"./clock-CztOmyyZ.js";import"./useLayoutTier-EgUCgdx3.js";import"./shield-check-BuzECgn-.js";import"./useFilters-CpgltZXL.js";import"./confirm-dialog-Db8A2eMO.js";import"./menu-lRFfNolt.js";import"./MailViewChrome-xVnsbwWk.js";import"./refresh-cw-BaKyxffZ.js";import"./wizard-selection-DxUM65kM.js";function H(){return o.jsx(r.Reading,{})}export{H as component};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-C3nvkB1j.js";import{B as o}from"./BriefPane-BSIJ7wnx.js";import"./useSearchTokenContext-BSpmqddM.js";import"./kbd-BsZ5TwSB.js";import"./useMessageBodyContent-DIrkHtbX.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-BDTDDZso.js";import"./roving-focus-geTPv6vY.js";import"./search-token-index-Gua3DAMw.js";import"./useQueries-B0RzAdbY.js";import"./attachment-file-BKnJE5i7.js";import"./mail-BmQATzkJ.js";import"./avatar-CpvvuFKb.js";import"./index-C5Kbx4oU.js";import"./useSignature-d8ShaxGe.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-B7V9qfV6.js";import"./sections-DWDKrIb_.js";import"./EmptyState-SiNhuwMY.js";import"./ErrorState-CJTd3Tdb.js";import"./download-B4DThtpy.js";import"./calendar-event-chip-C01FZqo9.js";import"./calendar-color-DiGD9E9z.js";import"./map-pin-BCdwL5Kr.js";import"./attendee-row-Q5g6VNRt.js";import"./clock-CztOmyyZ.js";import"./useLayoutTier-EgUCgdx3.js";import"./shield-check-BuzECgn-.js";import"./useFilters-CpgltZXL.js";import"./confirm-dialog-Db8A2eMO.js";import"./menu-lRFfNolt.js";import"./useRefreshControl-DIuMf3Yl.js";import"./circle-check-big-EJFD8UIQ.js";import"./refresh-cw-BaKyxffZ.js";import"./useSemanticSearch-Dps5HKPc.js";import"./useLabels-BuKWOv6s.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-DxUM65kM.js";function L(){return r.jsx(o.Reading,{})}export{L as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-C3nvkB1j.js";import{O as t}from"./OutboxPane-DuiRNXVZ.js";import"./roving-focus-geTPv6vY.js";import"./useSearchTokenContext-BSpmqddM.js";import"./kbd-BsZ5TwSB.js";import"./useMessageBodyContent-DIrkHtbX.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-EJFD8UIQ.js";import"./clock-CztOmyyZ.js";import"./row-actions-BVgTod6v.js";import"./rotate-ccw-BR8jjqUY.js";import"./NavMenuButton-Zq_pjyhs.js";import"./menu-lRFfNolt.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function P(){return o.jsx(t.Reading,{})}export{P as component};
@@ -0,0 +1 @@
1
+ import{eL as o,j as m}from"./index-C3nvkB1j.js";import{O as e}from"./OpenCalendarEvent-CX58crKI.js";import"./CalendarComposePane-BsCRW_Ip.js";import"./window-Cc-1L1Rq.js";import"./ErrorState-CJTd3Tdb.js";import"./calendar-color-DiGD9E9z.js";import"./attendee-row-Q5g6VNRt.js";import"./avatar-CpvvuFKb.js";import"./clock-CztOmyyZ.js";import"./map-pin-BCdwL5Kr.js";import"./mail-BmQATzkJ.js";import"./pencil-Cuw3Cj3L.js";import"./useCalendars-BbUHkfIU.js";import"./useCalendarData-BjcRVZAJ.js";import"./useQueries-B0RzAdbY.js";function E(){const{calendarObjectId:r,recurrenceId:t}=o.useParams();return m.jsx(e,{calendarObjectId:r,recurrenceId:t})}export{E as component};
@@ -0,0 +1 @@
1
+ import{O as o}from"./index-C3nvkB1j.js";const n=o;export{n as component};
@@ -0,0 +1 @@
1
+ import{O as o}from"./index-C3nvkB1j.js";const n=o;export{n as component};
@@ -0,0 +1 @@
1
+ import{O as o}from"./index-C3nvkB1j.js";const n=o;export{n as component};