@remit/web-client-dist 0.0.613 → 0.0.615

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 (151) hide show
  1. package/assets/{BriefPane-BdAUOXdm.js → BriefPane-7_PLQbpU.js} +1 -1
  2. package/assets/{CalendarComposePane-HKI8GoEg.js → CalendarComposePane-TujlXbr3.js} +1 -1
  3. package/assets/{CalendarComposeSeed-BPP-FuMT.js → CalendarComposeSeed-cAOXLBD8.js} +1 -1
  4. package/assets/{CalendarShell-CMjtg7WD.js → CalendarShell-CP-MJf-h.js} +1 -1
  5. package/assets/{EmptyState-B1LI7Ct9.js → EmptyState-CgjgdoLx.js} +1 -1
  6. package/assets/{ErrorState-CwGAuFwH.js → ErrorState-BOSB6fJZ.js} +1 -1
  7. package/assets/{FlaggedPane-BuCnBvEm.js → FlaggedPane-mtn5LehT.js} +1 -1
  8. package/assets/{FullCompose-B13wCysg.js → FullCompose-dqzD7C5t.js} +1 -1
  9. package/assets/{MailListHeader-CJubkcXR.js → MailListHeader-DMICasQ-.js} +1 -1
  10. package/assets/{MailNav-D_YJTFH1.js → MailNav-D7dxmY5f.js} +1 -1
  11. package/assets/{MailShell-CuLD3X3s.js → MailShell-BCMElGSy.js} +1 -1
  12. package/assets/{MailViewChrome-CXZE2Dur.js → MailViewChrome-oXPfi48R.js} +1 -1
  13. package/assets/{MailboxPane-CQ9szBNT.js → MailboxPane-BNP0g3x3.js} +1 -1
  14. package/assets/{NavMenuButton-5uLn7BNK.js → NavMenuButton-CtF-cDww.js} +1 -1
  15. package/assets/{OnboardingWizard-BnJ-ejU9.js → OnboardingWizard-GCAX67uu.js} +1 -1
  16. package/assets/{OpenCalendarEvent-B7ClrzG4.js → OpenCalendarEvent-BEZ9_XDn.js} +1 -1
  17. package/assets/{OutboxPane-DIF_2MzU.js → OutboxPane-ZoCzSH32.js} +1 -1
  18. package/assets/_calendarObjectId-DUpRB9xm.js +1 -0
  19. package/assets/_mailboxId-yo9kyjhC.js +1 -0
  20. package/assets/_messageId-CUCLuTvC.js +1 -0
  21. package/assets/_messageId-DL7k-rkt.js +1 -0
  22. package/assets/_messageId-DzgtpCGD.js +1 -0
  23. package/assets/_outboxMessageId-Cc2Xx-ml.js +1 -0
  24. package/assets/_recurrenceId-IpFxv3JP.js +1 -0
  25. package/assets/_threadId-DH60TCvT.js +1 -0
  26. package/assets/_threadId-DjyvTcLD.js +1 -0
  27. package/assets/_threadId-oV63kezn.js +1 -0
  28. package/assets/{_view._date-fuIwjJ6d.js → _view._date-BDcvlW5w.js} +1 -1
  29. package/assets/{accounts-DNBcCQAX.js → accounts-CvTAzZaE.js} +1 -1
  30. package/assets/{advanced-DdHOH4I-.js → advanced-ChYsfiHI.js} +1 -1
  31. package/assets/{appearance-CqIQAAi6.js → appearance-B3mxyTWp.js} +1 -1
  32. package/assets/{attachment-file-CxzNjt2q.js → attachment-file-DPtpbmUM.js} +1 -1
  33. package/assets/{attendee-row-CdxInQRM.js → attendee-row-Cx6gSIJ1.js} +1 -1
  34. package/assets/{avatar-DBlMCWUW.js → avatar--8IosDG7.js} +1 -1
  35. package/assets/{bell-off-CbRcvybP.js → bell-off-CkZ47Tt3.js} +1 -1
  36. package/assets/{bottom-sheet-lgMSLJFm.js → bottom-sheet-CqZztFIf.js} +1 -1
  37. package/assets/{brief-D-LRJuvq.js → brief-BTQzpcid.js} +1 -1
  38. package/assets/brief-DcLBoxLI.js +1 -0
  39. package/assets/{browser-ponyfill-C1qDDcgZ.js → browser-ponyfill-B5utdbNx.js} +1 -1
  40. package/assets/{bug-ihs_XaTI.js → bug-N61wRAwn.js} +1 -1
  41. package/assets/{calendar-l_ukMpST.js → calendar-DTZfhHUH.js} +1 -1
  42. package/assets/{calendar-clash-strip--sv3hlnj.js → calendar-clash-strip-zBMpTyZa.js} +1 -1
  43. package/assets/{calendar-color-BNsiepMN.js → calendar-color-CjzWsjnf.js} +1 -1
  44. package/assets/{calendar-event-chip-6sB4-0_V.js → calendar-event-chip-ZLzAutzl.js} +1 -1
  45. package/assets/{calendars-25Dtjj2d.js → calendars-CzaWn6cx.js} +1 -1
  46. package/assets/{card-CVtdEAJG.js → card-C6YCFVPw.js} +1 -1
  47. package/assets/chevron-left-DKbZFCnX.js +1 -0
  48. package/assets/{circle-check-CkSd3o3x.js → circle-check-DN20di62.js} +1 -1
  49. package/assets/{circle-check-big-BWVAA1go.js → circle-check-big-Ddb_Dx0d.js} +1 -1
  50. package/assets/{circle-help-9Um_wTZ0.js → circle-help-jCN-XIFB.js} +1 -1
  51. package/assets/{clock-Cy9JYedf.js → clock-B5rVJQyV.js} +1 -1
  52. package/assets/compose._-_outboxMessageId_-C5N0oIUC.js +1 -0
  53. package/assets/compose._-_outboxMessageId_-CKgxgcvw.js +1 -0
  54. package/assets/compose._-_outboxMessageId_-CxqL5XWA.js +1 -0
  55. package/assets/compose._-_outboxMessageId_-Dzr__dWX.js +1 -0
  56. package/assets/{config-import-CDFw8RwQ.js → config-import-cO5n_e48.js} +1 -1
  57. package/assets/{confirm-dialog-Deiy3Ntg.js → confirm-dialog-D4VgQO-4.js} +1 -1
  58. package/assets/{copy-CJss3Bzp.js → copy-h3I7OBEL.js} +1 -1
  59. package/assets/{credential-steps-pghJ7Fn4.js → credential-steps-D0vLleYc.js} +1 -1
  60. package/assets/{download-CsGfgWQ9.js → download-B3vz4ril.js} +1 -1
  61. package/assets/{file-json-Dfjj0v4X.js → file-json-DTuuXF2r.js} +1 -1
  62. package/assets/{filters-Cxv-ARD8.js → filters-DAxF80M7.js} +1 -1
  63. package/assets/flagged-DJAdPMOX.js +1 -0
  64. package/assets/{flagged-3Qa-G3Dz.js → flagged-Dt-HQnhu.js} +1 -1
  65. package/assets/{folders-Dc-_sBlj.js → folders-Oz_4z2U7.js} +1 -1
  66. package/assets/{help-copy-DUpboH5V.js → help-copy-3nxkftYy.js} +1 -1
  67. package/assets/{import-BFKfrZUb.js → import-XZxvrSEQ.js} +1 -1
  68. package/assets/index-735-K6po.js +1 -0
  69. package/assets/index-B5CCnRfK.js +1 -0
  70. package/assets/index-B6fZ4vFG.js +1 -0
  71. package/assets/{index-CPrSlVG5.js → index-BKk4k9x8.js} +4 -4
  72. package/assets/{index-DX7aotPF.js → index-BhNZAvM2.js} +1 -1
  73. package/assets/index-CUCLuTvC.js +1 -0
  74. package/assets/index-DC_KMFqJ.js +1 -0
  75. package/assets/index-DL7k-rkt.js +1 -0
  76. package/assets/index-DWzbo6AY.js +1 -0
  77. package/assets/index-dYoSRB6e.js +1 -0
  78. package/assets/{index-AluQ2uio.js → index-kmRGKW5t.js} +4 -4
  79. package/assets/index-yprZdcr6.js +1 -0
  80. package/assets/{kbd-Cor2fg-7.js → kbd-DblB9pwC.js} +1 -1
  81. package/assets/{labels-DFjDHHrd.js → labels-BIc953cE.js} +1 -1
  82. package/assets/{mail-D_lRkr65.js → mail-But4pTpi.js} +1 -1
  83. package/assets/{mail-yQrYbvvU.js → mail-CQMH6w7m.js} +1 -1
  84. package/assets/{map-pin-peX9fCRU.js → map-pin-BAXNf8Lg.js} +1 -1
  85. package/assets/{menu-Dt9m0StI.js → menu-DdjlmovV.js} +1 -1
  86. package/assets/{new-DDIR4PjJ.js → new-D-0Gsbjv.js} +1 -1
  87. package/assets/onboarding-C20NZEVl.js +1 -0
  88. package/assets/{onboarding-completion-D4NTHXtS.js → onboarding-completion-AhVFUuQe.js} +1 -1
  89. package/assets/outbox-C2wvusK4.js +1 -0
  90. package/assets/{pencil-DppvAS3i.js → pencil-Ck8pTSIR.js} +1 -1
  91. package/assets/{popover-menu-DzwWLLQ4.js → popover-menu-oxXoKkbW.js} +1 -1
  92. package/assets/{refresh-cw-BcCUuJTk.js → refresh-cw-BD8XeKo4.js} +1 -1
  93. package/assets/{rich-text-C8Qdt7bA.js → rich-text-PoA-Kdsk.js} +1 -1
  94. package/assets/{rich-text-spellcheck-worker-provider-BpDVyXT1.js → rich-text-spellcheck-worker-provider-BAU-j_ma.js} +1 -1
  95. package/assets/{rotate-ccw-BBSteM3j.js → rotate-ccw-CTt6dBVT.js} +1 -1
  96. package/assets/{roving-focus-Bs_5thJV.js → roving-focus-DzkqN4Kq.js} +1 -1
  97. package/assets/{row-actions-BfLO5NEa.js → row-actions-Du-hLHno.js} +1 -1
  98. package/assets/{search-mirror-D_1V7CTv.js → search-mirror-N8EzqcTV.js} +1 -1
  99. package/assets/{search-token-index-C8iSg33h.js → search-token-index-By1Eq3rT.js} +1 -1
  100. package/assets/{sections-De0aZhN_.js → sections-dvIODVm1.js} +1 -1
  101. package/assets/{senders-6zUHdQ2y.js → senders-CszruKeY.js} +1 -1
  102. package/assets/settings-D8rlLEcJ.js +1 -0
  103. package/assets/{settings-screen-B1RcF1xn.js → settings-screen-BbhTq8Ge.js} +1 -1
  104. package/assets/{shield-check-cW3ciHmN.js → shield-check-Hl4WRwOA.js} +1 -1
  105. package/assets/{suggested-vips-BykOEX_y.js → suggested-vips-Nh2fmsoa.js} +1 -1
  106. package/assets/{useCalendarData-CkuaJmfJ.js → useCalendarData-B3cL9fFA.js} +1 -1
  107. package/assets/{useCalendarEvents-6S-6YzeO.js → useCalendarEvents-B4NUgtF7.js} +1 -1
  108. package/assets/{useCalendarWrites-BLVvsvZX.js → useCalendarWrites-CPqsLuJb.js} +1 -1
  109. package/assets/{useCalendars-CIXsmVJv.js → useCalendars-Cmgw3xFq.js} +1 -1
  110. package/assets/{useDebouncedValue-znvk1V0z.js → useDebouncedValue-BU0VIWEs.js} +1 -1
  111. package/assets/{useFilters-Cs_M1iQB.js → useFilters-BKQmZ7W9.js} +1 -1
  112. package/assets/{useLabels-vtsCjkIE.js → useLabels-DJxSVVUQ.js} +1 -1
  113. package/assets/{useLayoutTier-DYvBoPy3.js → useLayoutTier-CBPK7Olc.js} +1 -1
  114. package/assets/{useMessageBodyContent-BMgLWHlL.js → useMessageBodyContent-DFl-GIiU.js} +1 -1
  115. package/assets/{useQueries-D3OwaAlj.js → useQueries-D7JnFr6g.js} +1 -1
  116. package/assets/{useRefreshControl-B3pY9CCW.js → useRefreshControl-DwBEaogh.js} +1 -1
  117. package/assets/{useResultFolderIndex-BBuyzfkc.js → useResultFolderIndex-BkZfJ7Pw.js} +1 -1
  118. package/assets/{useSearchTokenContext-Bs8lmzQX.js → useSearchTokenContext-D3LFteLt.js} +1 -1
  119. package/assets/{useSemanticSearch-DWt2Zwxh.js → useSemanticSearch-hVWVHTmB.js} +1 -1
  120. package/assets/{useSignature-FbPFbZj2.js → useSignature-BCerrqTE.js} +1 -1
  121. package/index.html +1 -1
  122. package/package.json +1 -1
  123. package/assets/_calendarObjectId-B2zrZwUz.js +0 -1
  124. package/assets/_mailboxId-DmwJ2xtk.js +0 -1
  125. package/assets/_messageId-BC_jukFk.js +0 -1
  126. package/assets/_messageId-BIb0lhqy.js +0 -1
  127. package/assets/_messageId-DP9tV44b.js +0 -1
  128. package/assets/_outboxMessageId-CVLDuJap.js +0 -1
  129. package/assets/_recurrenceId-Dz6hXcPJ.js +0 -1
  130. package/assets/_threadId-BZrfG4Xw.js +0 -1
  131. package/assets/_threadId-DD4vR3Wz.js +0 -1
  132. package/assets/_threadId-ijLRstC6.js +0 -1
  133. package/assets/brief-taKhPfu-.js +0 -1
  134. package/assets/chevron-left-D0SYUMAV.js +0 -1
  135. package/assets/compose._-_outboxMessageId_-BtOIiKJd.js +0 -1
  136. package/assets/compose._-_outboxMessageId_-D_IYkQCg.js +0 -1
  137. package/assets/compose._-_outboxMessageId_-PUY8eEIE.js +0 -1
  138. package/assets/compose._-_outboxMessageId_-bTqFuc-A.js +0 -1
  139. package/assets/flagged-BAViUozi.js +0 -1
  140. package/assets/index-B5dvicQK.js +0 -1
  141. package/assets/index-BFANXMwm.js +0 -1
  142. package/assets/index-BIb0lhqy.js +0 -1
  143. package/assets/index-BoR6RFK9.js +0 -1
  144. package/assets/index-CM47cGlz.js +0 -1
  145. package/assets/index-DAGT31Ip.js +0 -1
  146. package/assets/index-DP9tV44b.js +0 -1
  147. package/assets/index-DeRx34yz.js +0 -1
  148. package/assets/index-c7YEAe2A.js +0 -1
  149. package/assets/onboarding-DzIFHoBt.js +0 -1
  150. package/assets/outbox-E-DzFD5o.js +0 -1
  151. package/assets/settings-BtFZbjh3.js +0 -1
@@ -1 +1 @@
1
- import{j as n,L as kt,W as Et,ez as $e,eA as ne,d$ as re,r,c as We,C as ie,bp as At,cR as Ot,K as Ft,dR as Nt,eB as Bt,eC as Lt,a0 as Ye,ei as qt,eD as Dt,ak as Pt,d1 as _t,d2 as Qt}from"./index-AluQ2uio.js";import{g as Ve,e as zt,f as Je,u as Ht,p as Kt,R as Ut}from"./useSearchTokenContext-Bs8lmzQX.js";import{a8 as Gt,A as $t,E as Wt,ak as Yt,al as Vt,am as Jt,an as Pe,ao as Zt,ap as Xt,a7 as es,aq as ts,ar as ss,as as os,af as ns,M as rs,at as as,ag as is,au as cs,av as ls,e as ds,p as us,ai as fs,m as ms,S as hs,J as gs,O as _e,N as ps,K as xs,d as Is,Y as ys,Z as vs,$ as Ze,a0 as Xe,a1 as bs,a2 as Ss,a3 as Cs}from"./MailListHeader-CJubkcXR.js";import{u as Ts,a as ws,R as Rs,b as Ms,c as js}from"./useRefreshControl-B3pY9CCW.js";import{u as ae}from"./useQueries-D3OwaAlj.js";import{t as et,s as ks,u as Es,r as As,L as Os}from"./useSemanticSearch-DWt2Zwxh.js";import{a as Fs}from"./useLabels-vtsCjkIE.js";import{u as Ns}from"./useLayoutTier-DYvBoPy3.js";import{d as Bs,w as Ls}from"./wizard-selection-DxUM65kM.js";import{m as qs,e as Ds,f as Ps}from"./search-token-index-C8iSg33h.js";import{u as tt}from"./sections-De0aZhN_.js";import{R as _s}from"./refresh-cw-BcCUuJTk.js";import{a as Qs}from"./useMessageBodyContent-BMgLWHlL.js";function zs({sync:e}){return e?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[n.jsx(kt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),n.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),n.jsx("p",{className:"text-xs text-fg-subtle",children:Hs(e)})]}):n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[n.jsx(Et,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),n.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),n.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function Hs({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const st=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],ot="category",Ks={unclassified:"uncategorized"},K=e=>zt(e).map(t=>t.raw),H=e=>e.join(" "),Ie=e=>{const t=Je(e);if(t)return st.find(s=>s.name===t.name&&s.value===t.value.toLowerCase())?.id},ye=e=>{const t=Je(e);if(!t||t.name!==ot)return;const s=t.value.toLowerCase(),a=Ks[s];if(a)return a;if(!(!$e(s)||s==="all"))return s},nt=e=>st.find(t=>t.id===e),rt=e=>nt(e)!==void 0,Us=e=>{const t=new Set;for(const s of K(e)){const a=Ie(s);a&&t.add(a)}return t},Gs=e=>{let t="all";for(const s of K(e)){const a=ye(s);a&&(t=a)}return t},$s=(e,t)=>{const s=nt(t);if(!s)return;const a=K(e),i=a.filter(c=>Ie(c)!==t);return i.length<a.length?H(i):H([...a,Ve(s.name,s.value)])},Ws=(e,t)=>{const s=K(e).filter(a=>!ye(a));return H(t==="all"?s:[...s,Ve(ot,t)])},Ys=e=>H(K(e).filter(t=>!Ie(t)&&!ye(t))),at=e=>e.trim().length>0,Qe=e=>{if(!at(e.query))return e.ownFilters;const t=new Set(Us(e.query));for(const s of e.ownFilters)rt(s)||t.add(s);return t},ze=e=>at(e.query)?Gs(e.query):e.ownCategory,He=6e4,Vs=3e4,Js={kind:"unknown"},Ke=e=>(t,s)=>Gt(s?.queryKey,e)?t:void 0,Zs=(e,t,s)=>({...e,category:[t],limit:s,order:"desc"}),Xs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Ue=(e,t)=>({category:[t],...e.unread!==void 0?{unread:e.unread}:{},...e.starred!==void 0?{starred:e.starred}:{},...e.attachments!==void 0?{attachments:e.attachments}:{},...e.accountId!==void 0?{accountId:e.accountId}:{},...e.muted!==void 0?{muted:e.muted}:{}});function eo({categories:e,criteria:t,limit:s,counted:a}){const i=ae({queries:e.map(u=>{const h=Zs(t,u,s),m=Ue(t,u);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},placeholderData:Ke(m),staleTime:He}})}),c=ae({queries:e.map(u=>{const h=Xs(t,u),m=Ue(t,u);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},enabled:a,placeholderData:Ke(m),staleTime:He}})}),d=r.useMemo(()=>e.map((u,h)=>{const m=i[h],v=c[h],p=m?.data?.items??[];return{category:u,rows:p,atCap:p.length>=s,total:a?et(v?.data?.count):Js,loading:m?.isPending??!0,failed:m?.isError??!1,retry:()=>{m?.refetch(),a&&v?.refetch()}}}),[e,i,c,a,s]),l=r.useCallback(()=>{for(const u of i)u.refetch();for(const u of c)u.refetch()},[i,c]);return{sections:d,isLoading:i.length>0&&i.every(u=>u.isPending),isError:i.length>0&&i.every(u=>u.isError),refetch:l}}function to(e,t,s){const a={...e,limit:t,order:"desc"},{data:i,isLoading:c,isError:d,refetch:l}=We({queryKey:re({query:a}),queryFn:async()=>{const{data:h}=await ne({query:a,throwOnError:!0});return h},enabled:s,staleTime:Vs});return{rows:r.useMemo(()=>s?i?.items??[]:[],[i,s]),isLoading:s&&c,isError:s&&d,refetch:r.useCallback(()=>{l()},[l])}}const so=3e4,oo={kind:"unknown"},no=(e,t)=>({...e,mailboxId:t,order:"desc",count:!0,results:!1});function ro({criteria:e,junkMailboxIds:t,enabled:s}){const a=ae({queries:t.map(i=>{const c=no(e,i);return{queryKey:re({query:c}),queryFn:async()=>{const{data:d}=await ne({query:c,throwOnError:!0});return d},enabled:s,staleTime:so}})});return r.useMemo(()=>t.map((i,c)=>({mailboxId:i,count:s?et(a[c]?.data?.count):oo,failed:s?a[c]?.isError??!1:!1})),[t,a,s])}const ao=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),io=e=>[...e].sort(ao),co=["from","subject","category","unread","starred","attachments"],it=["contacts","today"],lo=e=>new Set(it.filter(t=>e.has(t))),uo=(e,t,s,a)=>{const i=$t({category:e,attributes:t}),{params:c,residual:d}=Wt(s,i,co),l={...c,...i},u={muted:!1};return l.from!==void 0&&(u.from=l.from),l.subject!==void 0&&(u.subject=l.subject),l.unread!==void 0&&(u.unread=l.unread),l.starred!==void 0&&(u.starred=l.starred),l.attachments!==void 0&&(u.attachments=l.attachments),a!==void 0&&(u.accountId=a),{criteria:u,residual:d}},fo=({residual:e,attributes:t})=>e.length===0&&!it.some(s=>t.has(s)),se=e=>e.count.kind==="exact"&&e.count.value>0?3:e.pageRows>0?2:e.count.kind==="unknown"?1:0,oe=e=>e.count.kind==="exact"?e.count.value:0,mo=(e,t)=>se(e)!==se(t)?se(e)>se(t):oe(e)!==oe(t)?oe(e)>oe(t):e.pageRows>t.pageRows;function ho(e,{pageRowsByMailbox:t}){const s=e.map(m=>({...m,pageRows:t.get(m.mailboxId)??0}));for(const[m,v]of t)v<=0||s.some(p=>p.mailboxId===m)||s.push({mailboxId:m,count:{kind:"unknown"},failed:!1,pageRows:v});const a=s[0];if(!a)return;let i=0,c=!0,d=a;for(const m of s)m.count.kind==="unknown"?c=!1:i+=m.count.value,mo(m,d)&&(d=m);const l=s.some(m=>m.pageRows>0),u=s.some(m=>m.failed);if(i===0&&!l&&(c||!u))return;const h=c&&i===0&&l;return{mailboxId:d.mailboxId,count:c&&!h?{kind:"exact",value:i}:{kind:"unknown"}}}const go=50,po=200,xo=[],Ge=()=>n.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>n.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[n.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsxs("div",{className:"flex justify-between gap-2",children:[n.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),n.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),n.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),n.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),Io=({accountEmail:e})=>{const t=tt();return n.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[n.jsx(Ye,{className:"size-3.5 shrink-0"}),n.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),n.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},yo=(e,t)=>{if(t.size===0)return{};const s=e.filter(c=>t.has(c.id)),a=As(s.map(c=>c.accountId));if(a.restriction)return a;const i=new Set;for(const c of s)c.mailboxId&&i.add(c.mailboxId);return i.size>1?{accountId:a.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${i.size} folders`}:{accountId:a.accountId,mailboxId:i.size===1?[...i][0]:void 0}};function vo({header:e,rows:t,wizard:s,children:a}){const{selectedIds:i,selectedCount:c,exitSelection:d,orderedIds:l,allSelected:u,toggleAllLoaded:h}=ls(),m=r.useMemo(()=>yo(t,i),[t,i]),{junkMailboxId:v}=ds(m.accountId),{labels:p}=Fs(m.accountId),b=r.useMemo(()=>Array.from(i),[i]),L=r.useMemo(()=>Ls(t,i),[t,i]),x=us(v,m.mailboxId),S=r.useMemo(()=>l.length>0?{checked:u,indeterminate:c>0&&!u,onChange:h}:void 0,[l.length,u,c,h]),F=m.moveDisabledHint?{tone:"warning",text:m.moveDisabledHint}:void 0,C=M=>n.jsx(hs,{title:M.title,navSlot:M.navSlot,titleMeta:M.titleMeta,searchSlot:M.searchSlot,searchField:M.searchField,idleSlot:M.makeFilterSlot,count:c,onCancel:d,onDelete:()=>s.start("delete"),onMove:()=>s.start("move"),onOrganize:()=>s.start("organize"),onJunk:x?()=>s.start("junk"):void 0,onMarkRead:()=>s.start("markRead"),overflowSlot:m.accountId&&m.mailboxId&&c>0&&p.length>0?n.jsx(Os,{accountId:m.accountId,mailboxId:m.mailboxId,messageIds:b}):void 0,selectAll:S,notice:F});return n.jsx(fs,{...e,selectionBar:C,paneOverlay:n.jsx(ms,{verb:s.verb,accountId:m.accountId,mailboxId:m.mailboxId,selection:L,selectionRestriction:m.restriction,onFinished:d}),children:a})}function bo({accounts:e,selectedMessageId:t,onOpenThread:s,commandsRef:a,onTriageContextChange:i,onDeleteMessages:c}){const{searchQuery:d,searchInput:l,resultFolderIndex:u,onSearchChange:h}=ie(),m=Ht(),v=At(),p=Ns(),b=Ot(),L=qs(),x=r.useMemo(()=>io(e.filter(o=>!o.muted?.value)),[e]),[S,F]=r.useState("all"),[C,M]=r.useState("all"),[N,q]=r.useState(new Set),[le,j]=r.useState(!1),D=r.useCallback(o=>{q(f=>{const g=new Set(f);return g.has(o)?g.delete(o):g.add(o),g})},[]),U=r.useCallback(()=>q(new Set),[]),E=l.trim().length>0,{freeText:w,tokens:P}=Kt(d.trim().toLowerCase(),m),y=w.length>0,_=r.useMemo(()=>Qe({query:l,ownFilters:N}),[l,N]),Q=r.useMemo(()=>ze({query:l,ownCategory:C}),[l,C]),O=r.useMemo(()=>Qe({query:d,ownFilters:N}),[d,N]),T=r.useMemo(()=>ze({query:d,ownCategory:C}),[d,C]),I=r.useCallback(o=>{if(!E||!rt(o)){D(o);return}const f=$s(l,o);f!==void 0&&h(f)},[E,l,h,D]),k=r.useCallback(o=>{if(!E){M(o);return}h(Ws(l,o))},[E,l,h]),de=r.useMemo(()=>T==="all"&&!y?o=>{$e(o)&&k(o)}:void 0,[T,y,k]),ue=r.useCallback(()=>{M("all"),F("all"),U(),E&&h(Ys(l))},[E,l,h,U]),G=ae({queries:x.map(o=>({...Ft({path:{accountId:o.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),$=r.useMemo(()=>{const o=new Map;for(let f=0;f<x.length;f++){const g=x[f].accountId,te=(G[f]?.data?.items??[]).reduce((A,jt)=>A+(jt.unseenCount??0),0);o.set(g,te)}return o},[x,G]),dt=r.useMemo(()=>x.filter((o,f)=>{const g=G[f];return g?.isError?!Nt(g.error):!1}),[x,G]),{criteria:fe,residual:W}=r.useMemo(()=>uo(T,O,P,S==="all"?void 0:S),[T,O,P,S]),ut=r.useMemo(()=>T==="all"?[...Yt]:[T],[T]),ve=r.useMemo(()=>({...fe,query:w,...T==="all"?{}:{category:[T]}}),[fe,w,T]),be=fo({residual:W,attributes:O}),{sections:Y,isLoading:ft,isError:mt,refetch:Se}=eo({categories:y?xo:ut,criteria:fe,limit:T==="all"?cs:go,counted:be}),{rows:Ce,isLoading:ht,isError:gt,refetch:Te}=to(ve,po,y),me=y?ht:ft,we=y?gt:mt,Re=r.useCallback(()=>{if(y){Te();return}Se()},[y,Te,Se]),Me=r.useMemo(()=>lo(O),[O]),V=r.useCallback(o=>Bs(o).map(Vt).filter(f=>Bt(f,Me)&&Jt(f,W)),[Me,W]),J=r.useMemo(()=>Y.map(o=>({category:o.category,total:o.total,atCap:o.atCap,loading:o.loading,failed:o.failed,rows:V(o.rows)})),[Y,V]),Z=r.useMemo(()=>V(Ce),[Ce,V]),pt=r.useCallback(o=>{Y.find(f=>f.category===o)?.retry()},[Y]),R=r.useMemo(()=>y?Z:J.flatMap(o=>o.rows),[y,Z,J]),xt=r.useMemo(()=>Lt(u),[u]),je=ro({criteria:ve,junkMailboxIds:xt,enabled:be&&ks({hasSearchQuery:y,freeText:w,residualTokenCount:W.length})}),{spamIds:he,briefSpamOffer:X}=r.useMemo(()=>{const o={spamIds:void 0,briefSpamOffer:void 0};if(!w)return o;const f=R.map(A=>Pe(A,u)),{spam:g}=Zt(f),B=new Map;for(const A of g)A.mailboxId&&B.set(A.mailboxId,(B.get(A.mailboxId)??0)+1);const te=ho(je,{pageRowsByMailbox:B});return g.length===0&&!te?o:{spamIds:g.length>0?new Set(g.map(A=>A.id)):void 0,briefSpamOffer:te}},[R,w,u,je]),ke=r.useMemo(()=>{const o=f=>he===void 0?f:f.filter(g=>!he.has(g.id));return y?[{id:"matches",threads:o(Z)}]:Xt(J.map(f=>({...f,rows:o(f.rows)})))},[y,Z,J,he]),Ee=r.useCallback((o,f)=>{const g=R.find(B=>B.id===o)?.threadId;g&&s?.({threadId:g,messageId:o},f)},[R,s]),It=r.useCallback(o=>{const f=o.threadId??R.find(g=>g.id===o.id)?.threadId;f&&s?.({threadId:f,messageId:o.id})},[R,s]),ge=r.useMemo(()=>x.length<=1?[]:[{id:"all",label:"All",active:S==="all"},...x.map(o=>({id:o.accountId,label:o.email.split("@")[0]??o.email,count:$.get(o.accountId),active:S===o.accountId}))],[x,$,S]),z=r.useMemo(()=>e.filter(o=>o.muted?.value).length,[e]),yt=r.useMemo(()=>Array.from($.values()).reduce((o,f)=>o+f,0),[$]),pe=r.useMemo(()=>x.map(o=>o.accountId),[x]),{hasNewMail:Ae}=Ts(),{state:Oe,errorMessage:Fe,refresh:Ne}=ws(pe,{onSettled:()=>Re()}),vt=r.useMemo(()=>n.jsx(Rs,{state:Oe,onRefresh:Ne,label:"Refresh daily brief",errorMessage:Fe,hasUpdate:Ae(pe)}),[Oe,Ne,Fe,Ae,pe]),xe=r.useMemo(()=>R.map(o=>Pe(o,u)),[R,u]),{hits:Be,isLoading:bt}=Es(),St=r.useMemo(()=>{const o=new Map(R.map(g=>[g.id,g.threadId])),f=xe.map(g=>o.get(g.id)).filter(g=>g!=null);return es(Be,f,u)},[Be,xe,R,u]),Ct=r.useMemo(()=>{const o=ts(ge.map(f=>({id:f.id,label:f.label,count:f.count,active:f.active})));return{categories:o.categories,filters:o.filters,sources:o.sources,sourcesNote:z>0?`+${z} muted`:void 0,selectedCategory:Q,activeFilters:_,expanded:le,onExpandedChange:j,onSelectCategory:f=>k(f),onSelectSource:F,onToggleFilter:f=>I(f),onClear:ue}},[ge,z,Q,_,le,I,k,ue]),Le=ke.length===0&&S==="all"&&w.length===0&&P.length===0,Tt=r.useMemo(()=>x.map(o=>o.accountId),[x]),wt=r.useMemo(()=>x.some(o=>Ms(o.syncPhase)),[x]),ee=js(Tt,Le||wt),qe=n.jsxs("div",{className:"h-full overflow-y-auto",children:[n.jsx(Ge,{}),n.jsx(Ge,{})]}),De=!me&&!we&&!Le,Rt=ss({tier:p,hasLiveInput:E,hasCommittedQuery:d.trim().length>0,bodyRendersCommittedResults:!0}),Mt=De?n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&n.jsx(os,{count:X.count,onScopeToSpam:()=>L(X.mailboxId,d)}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(ns,{sections:ke,briefCategory:Q,Row:rs,selectedThreadId:t,onSelectThread:Ee,onShowAllSection:de,onRetrySection:pt,flat:y,onSelectBriefCategory:k,sources:ge,sourcesNote:z>0?`+${z} muted`:void 0,onSelectSource:F,activeFilters:_,onToggleFilter:I,onClearFilters:ue})})]}):me?qe:we?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[n.jsx(Ye,{className:"size-8 text-danger"}),n.jsx("p",{children:"Couldn't load your messages"}),n.jsxs("button",{type:"button",onClick:()=>Re(),className:"flex items-center gap-1 text-accent underline text-xs",children:[n.jsx(_s,{className:"size-3.5"}),"Try again"]})]}):ee.resolved?n.jsx(zs,{sync:ee.syncing?{synced:ee.synced,total:ee.total}:void 0}):qe;return n.jsx(qt,{hasSheet:De&&!Rt,children:n.jsx(as,{selectedMessageId:t,rows:R,onOpen:Ee,onDeleteMessages:c,onSelectionVerb:b.start,commandsRef:a,onTriageContextChange:i,children:n.jsx(vo,{wizard:b,header:{title:"Daily brief",unreadCount:yt,footer:v?n.jsx(is,{}):void 0,searchFilter:Ct,searchResults:xe,searchLoading:me,relatedResults:St,relatedLoading:bt,onSelectSearchResult:It,spamOffer:X,searchResultsInBody:!0,refreshControl:vt},rows:R,children:n.jsxs("div",{className:"flex h-full flex-col",children:[dt.map(o=>n.jsx(Io,{accountEmail:o.email,accountId:o.accountId},o.accountId)),n.jsx("div",{className:"min-h-0 flex-1",children:Mt})]})})})})}const ct=r.createContext(null);function ce(){const e=r.useContext(ct);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function So({thread:e,children:t}){const s=Ds(),a=Ps(),i=tt(),{searchInput:c}=ie(),d=e?.threadId,l=e?.messageId,{data:u}=We({...Dt(),staleTime:6e4}),h=r.useMemo(()=>u?.items??[],[u]),m=r.useMemo(()=>{if(d)return h.find(I=>I.messageId===l)??h.find(I=>I.threadId===d)},[h,d,l]),v=gs(d,l),p=m??v,b=l??p?.messageId,L=r.useMemo(()=>{if(d)return{threadId:d,mailboxId:p?.mailboxId??"",subject:p?.subject,messageId:b,authenticity:p?.authenticity}},[d,p,b]),x=r.useCallback((I,k)=>{s(I,{replace:k?.replace,query:c})},[s,c]),S=r.useCallback(I=>{b&&I.includes(b)&&a()},[b,a]),F=_e({thread:p,isOpen:!0,onAfterOptimisticRemove:S}),C=ps(),{deleteMessages:M}=xs({mailboxId:p?.mailboxId??"",messages:h,onAfterOptimisticRemove:S}),{toggleReadFor:N}=Is({mailboxId:p?.mailboxId??"",messages:h}),q=C.focusedMessageId,j=r.useMemo(()=>h.find(I=>I.messageId===q),[h,q])??p,D=_e({thread:j,isOpen:j?.messageId===b}),U=Qs(),E=Pt(),w=_t(),P=r.useMemo(()=>Qt(w,d,b),[w,d,b]),y=r.useMemo(()=>{if(j)return I=>w({threadId:j.threadId,messageId:j.messageId,mode:I})},[w,j]),{nextMessageId:_,previousMessageId:Q}=ys({context:C,orderedIds:C.orderedIds,selectedMessageId:b,enabled:!U&&!E,hasOpenThread:d!==void 0,onClose:a,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{C.listCommandsRef.current?.requestVerb("delete")||D.deleteThread()},toggleStar:D.toggleStar,toggleRead:()=>{C.listCommandsRef.current?.requestVerb("markRead")||j&&N([j.messageId],!j.isRead)},goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),O=r.useCallback(I=>{if(!I)return;const k=h.find(de=>de.messageId===I);return k?{threadId:k.threadId,messageId:I}:void 0},[h]),T={selectedMessageId:b,selectedThread:p,conversation:L,onOpenThread:x,onCloseThread:a,nextThread:O(_),previousThread:O(Q),actions:F,onReply:P,triage:C,onDeleteMessages:M,handleDeselectIfRemoved:S};return n.jsx(ct.Provider,{value:T,children:t})}function lt(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:a}=ce(),{accounts:i}=ie();return n.jsx(bo,{accounts:i,selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:a})}function Co(){const{conversation:e,selectedThread:t,actions:s,onReply:a,handleDeselectIfRemoved:i}=ce(),c=!!e,d=Ss(e?.threadId);return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[n.jsx(Cs,{hasThread:c,intelligenceOpen:d.isShowing,canToggleIntelligence:d.canToggle,onToggleIntelligence:d.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:c?s.deleteThread:void 0,onToggleStar:c?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:c&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?n.jsx(Ze,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:d.open,listOnScreen:!0}):n.jsx(Ut,{})})]}),n.jsx(Xe,{isOpen:d.drawerOpen,onClose:d.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:i})]})}function To(){const{selectedThread:e,handleDeselectIfRemoved:t}=ce(),{onToggleIntelligence:s}=ie();return n.jsx(bs,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function wo(){const{selectedThread:e,conversation:t,onOpenThread:s,onCloseThread:a,nextThread:i,previousThread:c,handleDeselectIfRemoved:d}=ce(),l=vs(t?.threadId??null);return t?n.jsxs(n.Fragment,{children:[n.jsx(Ze,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:a,onOpenIntelligence:l.toggle,onSwipeNext:i?()=>s(i):void 0,onSwipePrevious:c?()=>s(c):void 0,mobileIntelligenceOpen:l.isOpen}),n.jsx(Xe,{isOpen:l.isOpen,onClose:l.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:d})]}):n.jsx("div",{className:"h-full",children:n.jsx(lt,{})})}const Po=Object.assign(So,{List:lt,Reading:Co,Intelligence:To,Phone:wo});export{Po as B};
1
+ import{j as n,L as kt,W as Et,ez as $e,eA as ne,d$ as re,r,c as We,C as ie,bp as At,cR as Ot,K as Ft,dR as Nt,eB as Bt,eC as Lt,a0 as Ye,ei as qt,eD as Dt,ak as Pt,d1 as _t,d2 as Qt}from"./index-kmRGKW5t.js";import{g as Ve,e as zt,f as Je,u as Ht,p as Kt,R as Ut}from"./useSearchTokenContext-D3LFteLt.js";import{a8 as Gt,A as $t,E as Wt,ak as Yt,al as Vt,am as Jt,an as Pe,ao as Zt,ap as Xt,a7 as es,aq as ts,ar as ss,as as os,af as ns,M as rs,at as as,ag as is,au as cs,av as ls,e as ds,p as us,ai as fs,m as ms,S as hs,J as gs,O as _e,N as ps,K as xs,d as Is,Y as ys,Z as vs,$ as Ze,a0 as Xe,a1 as bs,a2 as Ss,a3 as Cs}from"./MailListHeader-DMICasQ-.js";import{u as Ts,a as ws,R as Rs,b as Ms,c as js}from"./useRefreshControl-DwBEaogh.js";import{u as ae}from"./useQueries-D7JnFr6g.js";import{t as et,s as ks,u as Es,r as As,L as Os}from"./useSemanticSearch-hVWVHTmB.js";import{a as Fs}from"./useLabels-DJxSVVUQ.js";import{u as Ns}from"./useLayoutTier-CBPK7Olc.js";import{d as Bs,w as Ls}from"./wizard-selection-DxUM65kM.js";import{m as qs,e as Ds,f as Ps}from"./search-token-index-By1Eq3rT.js";import{u as tt}from"./sections-dvIODVm1.js";import{R as _s}from"./refresh-cw-BD8XeKo4.js";import{a as Qs}from"./useMessageBodyContent-DFl-GIiU.js";function zs({sync:e}){return e?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[n.jsx(kt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),n.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),n.jsx("p",{className:"text-xs text-fg-subtle",children:Hs(e)})]}):n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[n.jsx(Et,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),n.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),n.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function Hs({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const st=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],ot="category",Ks={unclassified:"uncategorized"},K=e=>zt(e).map(t=>t.raw),H=e=>e.join(" "),Ie=e=>{const t=Je(e);if(t)return st.find(s=>s.name===t.name&&s.value===t.value.toLowerCase())?.id},ye=e=>{const t=Je(e);if(!t||t.name!==ot)return;const s=t.value.toLowerCase(),a=Ks[s];if(a)return a;if(!(!$e(s)||s==="all"))return s},nt=e=>st.find(t=>t.id===e),rt=e=>nt(e)!==void 0,Us=e=>{const t=new Set;for(const s of K(e)){const a=Ie(s);a&&t.add(a)}return t},Gs=e=>{let t="all";for(const s of K(e)){const a=ye(s);a&&(t=a)}return t},$s=(e,t)=>{const s=nt(t);if(!s)return;const a=K(e),i=a.filter(c=>Ie(c)!==t);return i.length<a.length?H(i):H([...a,Ve(s.name,s.value)])},Ws=(e,t)=>{const s=K(e).filter(a=>!ye(a));return H(t==="all"?s:[...s,Ve(ot,t)])},Ys=e=>H(K(e).filter(t=>!Ie(t)&&!ye(t))),at=e=>e.trim().length>0,Qe=e=>{if(!at(e.query))return e.ownFilters;const t=new Set(Us(e.query));for(const s of e.ownFilters)rt(s)||t.add(s);return t},ze=e=>at(e.query)?Gs(e.query):e.ownCategory,He=6e4,Vs=3e4,Js={kind:"unknown"},Ke=e=>(t,s)=>Gt(s?.queryKey,e)?t:void 0,Zs=(e,t,s)=>({...e,category:[t],limit:s,order:"desc"}),Xs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Ue=(e,t)=>({category:[t],...e.unread!==void 0?{unread:e.unread}:{},...e.starred!==void 0?{starred:e.starred}:{},...e.attachments!==void 0?{attachments:e.attachments}:{},...e.accountId!==void 0?{accountId:e.accountId}:{},...e.muted!==void 0?{muted:e.muted}:{}});function eo({categories:e,criteria:t,limit:s,counted:a}){const i=ae({queries:e.map(u=>{const h=Zs(t,u,s),m=Ue(t,u);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},placeholderData:Ke(m),staleTime:He}})}),c=ae({queries:e.map(u=>{const h=Xs(t,u),m=Ue(t,u);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},enabled:a,placeholderData:Ke(m),staleTime:He}})}),d=r.useMemo(()=>e.map((u,h)=>{const m=i[h],v=c[h],p=m?.data?.items??[];return{category:u,rows:p,atCap:p.length>=s,total:a?et(v?.data?.count):Js,loading:m?.isPending??!0,failed:m?.isError??!1,retry:()=>{m?.refetch(),a&&v?.refetch()}}}),[e,i,c,a,s]),l=r.useCallback(()=>{for(const u of i)u.refetch();for(const u of c)u.refetch()},[i,c]);return{sections:d,isLoading:i.length>0&&i.every(u=>u.isPending),isError:i.length>0&&i.every(u=>u.isError),refetch:l}}function to(e,t,s){const a={...e,limit:t,order:"desc"},{data:i,isLoading:c,isError:d,refetch:l}=We({queryKey:re({query:a}),queryFn:async()=>{const{data:h}=await ne({query:a,throwOnError:!0});return h},enabled:s,staleTime:Vs});return{rows:r.useMemo(()=>s?i?.items??[]:[],[i,s]),isLoading:s&&c,isError:s&&d,refetch:r.useCallback(()=>{l()},[l])}}const so=3e4,oo={kind:"unknown"},no=(e,t)=>({...e,mailboxId:t,order:"desc",count:!0,results:!1});function ro({criteria:e,junkMailboxIds:t,enabled:s}){const a=ae({queries:t.map(i=>{const c=no(e,i);return{queryKey:re({query:c}),queryFn:async()=>{const{data:d}=await ne({query:c,throwOnError:!0});return d},enabled:s,staleTime:so}})});return r.useMemo(()=>t.map((i,c)=>({mailboxId:i,count:s?et(a[c]?.data?.count):oo,failed:s?a[c]?.isError??!1:!1})),[t,a,s])}const ao=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),io=e=>[...e].sort(ao),co=["from","subject","category","unread","starred","attachments"],it=["contacts","today"],lo=e=>new Set(it.filter(t=>e.has(t))),uo=(e,t,s,a)=>{const i=$t({category:e,attributes:t}),{params:c,residual:d}=Wt(s,i,co),l={...c,...i},u={muted:!1};return l.from!==void 0&&(u.from=l.from),l.subject!==void 0&&(u.subject=l.subject),l.unread!==void 0&&(u.unread=l.unread),l.starred!==void 0&&(u.starred=l.starred),l.attachments!==void 0&&(u.attachments=l.attachments),a!==void 0&&(u.accountId=a),{criteria:u,residual:d}},fo=({residual:e,attributes:t})=>e.length===0&&!it.some(s=>t.has(s)),se=e=>e.count.kind==="exact"&&e.count.value>0?3:e.pageRows>0?2:e.count.kind==="unknown"?1:0,oe=e=>e.count.kind==="exact"?e.count.value:0,mo=(e,t)=>se(e)!==se(t)?se(e)>se(t):oe(e)!==oe(t)?oe(e)>oe(t):e.pageRows>t.pageRows;function ho(e,{pageRowsByMailbox:t}){const s=e.map(m=>({...m,pageRows:t.get(m.mailboxId)??0}));for(const[m,v]of t)v<=0||s.some(p=>p.mailboxId===m)||s.push({mailboxId:m,count:{kind:"unknown"},failed:!1,pageRows:v});const a=s[0];if(!a)return;let i=0,c=!0,d=a;for(const m of s)m.count.kind==="unknown"?c=!1:i+=m.count.value,mo(m,d)&&(d=m);const l=s.some(m=>m.pageRows>0),u=s.some(m=>m.failed);if(i===0&&!l&&(c||!u))return;const h=c&&i===0&&l;return{mailboxId:d.mailboxId,count:c&&!h?{kind:"exact",value:i}:{kind:"unknown"}}}const go=50,po=200,xo=[],Ge=()=>n.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>n.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[n.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsxs("div",{className:"flex justify-between gap-2",children:[n.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),n.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),n.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),n.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),Io=({accountEmail:e})=>{const t=tt();return n.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[n.jsx(Ye,{className:"size-3.5 shrink-0"}),n.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),n.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},yo=(e,t)=>{if(t.size===0)return{};const s=e.filter(c=>t.has(c.id)),a=As(s.map(c=>c.accountId));if(a.restriction)return a;const i=new Set;for(const c of s)c.mailboxId&&i.add(c.mailboxId);return i.size>1?{accountId:a.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${i.size} folders`}:{accountId:a.accountId,mailboxId:i.size===1?[...i][0]:void 0}};function vo({header:e,rows:t,wizard:s,children:a}){const{selectedIds:i,selectedCount:c,exitSelection:d,orderedIds:l,allSelected:u,toggleAllLoaded:h}=ls(),m=r.useMemo(()=>yo(t,i),[t,i]),{junkMailboxId:v}=ds(m.accountId),{labels:p}=Fs(m.accountId),b=r.useMemo(()=>Array.from(i),[i]),L=r.useMemo(()=>Ls(t,i),[t,i]),x=us(v,m.mailboxId),S=r.useMemo(()=>l.length>0?{checked:u,indeterminate:c>0&&!u,onChange:h}:void 0,[l.length,u,c,h]),F=m.moveDisabledHint?{tone:"warning",text:m.moveDisabledHint}:void 0,C=M=>n.jsx(hs,{title:M.title,navSlot:M.navSlot,titleMeta:M.titleMeta,searchSlot:M.searchSlot,searchField:M.searchField,idleSlot:M.makeFilterSlot,count:c,onCancel:d,onDelete:()=>s.start("delete"),onMove:()=>s.start("move"),onOrganize:()=>s.start("organize"),onJunk:x?()=>s.start("junk"):void 0,onMarkRead:()=>s.start("markRead"),overflowSlot:m.accountId&&m.mailboxId&&c>0&&p.length>0?n.jsx(Os,{accountId:m.accountId,mailboxId:m.mailboxId,messageIds:b}):void 0,selectAll:S,notice:F});return n.jsx(fs,{...e,selectionBar:C,paneOverlay:n.jsx(ms,{verb:s.verb,accountId:m.accountId,mailboxId:m.mailboxId,selection:L,selectionRestriction:m.restriction,onFinished:d}),children:a})}function bo({accounts:e,selectedMessageId:t,onOpenThread:s,commandsRef:a,onTriageContextChange:i,onDeleteMessages:c}){const{searchQuery:d,searchInput:l,resultFolderIndex:u,onSearchChange:h}=ie(),m=Ht(),v=At(),p=Ns(),b=Ot(),L=qs(),x=r.useMemo(()=>io(e.filter(o=>!o.muted?.value)),[e]),[S,F]=r.useState("all"),[C,M]=r.useState("all"),[N,q]=r.useState(new Set),[le,j]=r.useState(!1),D=r.useCallback(o=>{q(f=>{const g=new Set(f);return g.has(o)?g.delete(o):g.add(o),g})},[]),U=r.useCallback(()=>q(new Set),[]),E=l.trim().length>0,{freeText:w,tokens:P}=Kt(d.trim().toLowerCase(),m),y=w.length>0,_=r.useMemo(()=>Qe({query:l,ownFilters:N}),[l,N]),Q=r.useMemo(()=>ze({query:l,ownCategory:C}),[l,C]),O=r.useMemo(()=>Qe({query:d,ownFilters:N}),[d,N]),T=r.useMemo(()=>ze({query:d,ownCategory:C}),[d,C]),I=r.useCallback(o=>{if(!E||!rt(o)){D(o);return}const f=$s(l,o);f!==void 0&&h(f)},[E,l,h,D]),k=r.useCallback(o=>{if(!E){M(o);return}h(Ws(l,o))},[E,l,h]),de=r.useMemo(()=>T==="all"&&!y?o=>{$e(o)&&k(o)}:void 0,[T,y,k]),ue=r.useCallback(()=>{M("all"),F("all"),U(),E&&h(Ys(l))},[E,l,h,U]),G=ae({queries:x.map(o=>({...Ft({path:{accountId:o.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),$=r.useMemo(()=>{const o=new Map;for(let f=0;f<x.length;f++){const g=x[f].accountId,te=(G[f]?.data?.items??[]).reduce((A,jt)=>A+(jt.unseenCount??0),0);o.set(g,te)}return o},[x,G]),dt=r.useMemo(()=>x.filter((o,f)=>{const g=G[f];return g?.isError?!Nt(g.error):!1}),[x,G]),{criteria:fe,residual:W}=r.useMemo(()=>uo(T,O,P,S==="all"?void 0:S),[T,O,P,S]),ut=r.useMemo(()=>T==="all"?[...Yt]:[T],[T]),ve=r.useMemo(()=>({...fe,query:w,...T==="all"?{}:{category:[T]}}),[fe,w,T]),be=fo({residual:W,attributes:O}),{sections:Y,isLoading:ft,isError:mt,refetch:Se}=eo({categories:y?xo:ut,criteria:fe,limit:T==="all"?cs:go,counted:be}),{rows:Ce,isLoading:ht,isError:gt,refetch:Te}=to(ve,po,y),me=y?ht:ft,we=y?gt:mt,Re=r.useCallback(()=>{if(y){Te();return}Se()},[y,Te,Se]),Me=r.useMemo(()=>lo(O),[O]),V=r.useCallback(o=>Bs(o).map(Vt).filter(f=>Bt(f,Me)&&Jt(f,W)),[Me,W]),J=r.useMemo(()=>Y.map(o=>({category:o.category,total:o.total,atCap:o.atCap,loading:o.loading,failed:o.failed,rows:V(o.rows)})),[Y,V]),Z=r.useMemo(()=>V(Ce),[Ce,V]),pt=r.useCallback(o=>{Y.find(f=>f.category===o)?.retry()},[Y]),R=r.useMemo(()=>y?Z:J.flatMap(o=>o.rows),[y,Z,J]),xt=r.useMemo(()=>Lt(u),[u]),je=ro({criteria:ve,junkMailboxIds:xt,enabled:be&&ks({hasSearchQuery:y,freeText:w,residualTokenCount:W.length})}),{spamIds:he,briefSpamOffer:X}=r.useMemo(()=>{const o={spamIds:void 0,briefSpamOffer:void 0};if(!w)return o;const f=R.map(A=>Pe(A,u)),{spam:g}=Zt(f),B=new Map;for(const A of g)A.mailboxId&&B.set(A.mailboxId,(B.get(A.mailboxId)??0)+1);const te=ho(je,{pageRowsByMailbox:B});return g.length===0&&!te?o:{spamIds:g.length>0?new Set(g.map(A=>A.id)):void 0,briefSpamOffer:te}},[R,w,u,je]),ke=r.useMemo(()=>{const o=f=>he===void 0?f:f.filter(g=>!he.has(g.id));return y?[{id:"matches",threads:o(Z)}]:Xt(J.map(f=>({...f,rows:o(f.rows)})))},[y,Z,J,he]),Ee=r.useCallback((o,f)=>{const g=R.find(B=>B.id===o)?.threadId;g&&s?.({threadId:g,messageId:o},f)},[R,s]),It=r.useCallback(o=>{const f=o.threadId??R.find(g=>g.id===o.id)?.threadId;f&&s?.({threadId:f,messageId:o.id})},[R,s]),ge=r.useMemo(()=>x.length<=1?[]:[{id:"all",label:"All",active:S==="all"},...x.map(o=>({id:o.accountId,label:o.email.split("@")[0]??o.email,count:$.get(o.accountId),active:S===o.accountId}))],[x,$,S]),z=r.useMemo(()=>e.filter(o=>o.muted?.value).length,[e]),yt=r.useMemo(()=>Array.from($.values()).reduce((o,f)=>o+f,0),[$]),pe=r.useMemo(()=>x.map(o=>o.accountId),[x]),{hasNewMail:Ae}=Ts(),{state:Oe,errorMessage:Fe,refresh:Ne}=ws(pe,{onSettled:()=>Re()}),vt=r.useMemo(()=>n.jsx(Rs,{state:Oe,onRefresh:Ne,label:"Refresh daily brief",errorMessage:Fe,hasUpdate:Ae(pe)}),[Oe,Ne,Fe,Ae,pe]),xe=r.useMemo(()=>R.map(o=>Pe(o,u)),[R,u]),{hits:Be,isLoading:bt}=Es(),St=r.useMemo(()=>{const o=new Map(R.map(g=>[g.id,g.threadId])),f=xe.map(g=>o.get(g.id)).filter(g=>g!=null);return es(Be,f,u)},[Be,xe,R,u]),Ct=r.useMemo(()=>{const o=ts(ge.map(f=>({id:f.id,label:f.label,count:f.count,active:f.active})));return{categories:o.categories,filters:o.filters,sources:o.sources,sourcesNote:z>0?`+${z} muted`:void 0,selectedCategory:Q,activeFilters:_,expanded:le,onExpandedChange:j,onSelectCategory:f=>k(f),onSelectSource:F,onToggleFilter:f=>I(f),onClear:ue}},[ge,z,Q,_,le,I,k,ue]),Le=ke.length===0&&S==="all"&&w.length===0&&P.length===0,Tt=r.useMemo(()=>x.map(o=>o.accountId),[x]),wt=r.useMemo(()=>x.some(o=>Ms(o.syncPhase)),[x]),ee=js(Tt,Le||wt),qe=n.jsxs("div",{className:"h-full overflow-y-auto",children:[n.jsx(Ge,{}),n.jsx(Ge,{})]}),De=!me&&!we&&!Le,Rt=ss({tier:p,hasLiveInput:E,hasCommittedQuery:d.trim().length>0,bodyRendersCommittedResults:!0}),Mt=De?n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&n.jsx(os,{count:X.count,onScopeToSpam:()=>L(X.mailboxId,d)}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(ns,{sections:ke,briefCategory:Q,Row:rs,selectedThreadId:t,onSelectThread:Ee,onShowAllSection:de,onRetrySection:pt,flat:y,onSelectBriefCategory:k,sources:ge,sourcesNote:z>0?`+${z} muted`:void 0,onSelectSource:F,activeFilters:_,onToggleFilter:I,onClearFilters:ue})})]}):me?qe:we?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[n.jsx(Ye,{className:"size-8 text-danger"}),n.jsx("p",{children:"Couldn't load your messages"}),n.jsxs("button",{type:"button",onClick:()=>Re(),className:"flex items-center gap-1 text-accent underline text-xs",children:[n.jsx(_s,{className:"size-3.5"}),"Try again"]})]}):ee.resolved?n.jsx(zs,{sync:ee.syncing?{synced:ee.synced,total:ee.total}:void 0}):qe;return n.jsx(qt,{hasSheet:De&&!Rt,children:n.jsx(as,{selectedMessageId:t,rows:R,onOpen:Ee,onDeleteMessages:c,onSelectionVerb:b.start,commandsRef:a,onTriageContextChange:i,children:n.jsx(vo,{wizard:b,header:{title:"Daily brief",unreadCount:yt,footer:v?n.jsx(is,{}):void 0,searchFilter:Ct,searchResults:xe,searchLoading:me,relatedResults:St,relatedLoading:bt,onSelectSearchResult:It,spamOffer:X,searchResultsInBody:!0,refreshControl:vt},rows:R,children:n.jsxs("div",{className:"flex h-full flex-col",children:[dt.map(o=>n.jsx(Io,{accountEmail:o.email,accountId:o.accountId},o.accountId)),n.jsx("div",{className:"min-h-0 flex-1",children:Mt})]})})})})}const ct=r.createContext(null);function ce(){const e=r.useContext(ct);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function So({thread:e,children:t}){const s=Ds(),a=Ps(),i=tt(),{searchInput:c}=ie(),d=e?.threadId,l=e?.messageId,{data:u}=We({...Dt(),staleTime:6e4}),h=r.useMemo(()=>u?.items??[],[u]),m=r.useMemo(()=>{if(d)return h.find(I=>I.messageId===l)??h.find(I=>I.threadId===d)},[h,d,l]),v=gs(d,l),p=m??v,b=l??p?.messageId,L=r.useMemo(()=>{if(d)return{threadId:d,mailboxId:p?.mailboxId??"",subject:p?.subject,messageId:b,authenticity:p?.authenticity}},[d,p,b]),x=r.useCallback((I,k)=>{s(I,{replace:k?.replace,query:c})},[s,c]),S=r.useCallback(I=>{b&&I.includes(b)&&a()},[b,a]),F=_e({thread:p,isOpen:!0,onAfterOptimisticRemove:S}),C=ps(),{deleteMessages:M}=xs({mailboxId:p?.mailboxId??"",messages:h,onAfterOptimisticRemove:S}),{toggleReadFor:N}=Is({mailboxId:p?.mailboxId??"",messages:h}),q=C.focusedMessageId,j=r.useMemo(()=>h.find(I=>I.messageId===q),[h,q])??p,D=_e({thread:j,isOpen:j?.messageId===b}),U=Qs(),E=Pt(),w=_t(),P=r.useMemo(()=>Qt(w,d,b),[w,d,b]),y=r.useMemo(()=>{if(j)return I=>w({threadId:j.threadId,messageId:j.messageId,mode:I})},[w,j]),{nextMessageId:_,previousMessageId:Q}=ys({context:C,orderedIds:C.orderedIds,selectedMessageId:b,enabled:!U&&!E,hasOpenThread:d!==void 0,onClose:a,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{C.listCommandsRef.current?.requestVerb("delete")||D.deleteThread()},toggleStar:D.toggleStar,toggleRead:()=>{C.listCommandsRef.current?.requestVerb("markRead")||j&&N([j.messageId],!j.isRead)},goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),O=r.useCallback(I=>{if(!I)return;const k=h.find(de=>de.messageId===I);return k?{threadId:k.threadId,messageId:I}:void 0},[h]),T={selectedMessageId:b,selectedThread:p,conversation:L,onOpenThread:x,onCloseThread:a,nextThread:O(_),previousThread:O(Q),actions:F,onReply:P,triage:C,onDeleteMessages:M,handleDeselectIfRemoved:S};return n.jsx(ct.Provider,{value:T,children:t})}function lt(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:a}=ce(),{accounts:i}=ie();return n.jsx(bo,{accounts:i,selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:a})}function Co(){const{conversation:e,selectedThread:t,actions:s,onReply:a,handleDeselectIfRemoved:i}=ce(),c=!!e,d=Ss(e?.threadId);return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[n.jsx(Cs,{hasThread:c,intelligenceOpen:d.isShowing,canToggleIntelligence:d.canToggle,onToggleIntelligence:d.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:c?s.deleteThread:void 0,onToggleStar:c?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:c&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?n.jsx(Ze,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:d.open,listOnScreen:!0}):n.jsx(Ut,{})})]}),n.jsx(Xe,{isOpen:d.drawerOpen,onClose:d.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:i})]})}function To(){const{selectedThread:e,handleDeselectIfRemoved:t}=ce(),{onToggleIntelligence:s}=ie();return n.jsx(bs,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function wo(){const{selectedThread:e,conversation:t,onOpenThread:s,onCloseThread:a,nextThread:i,previousThread:c,handleDeselectIfRemoved:d}=ce(),l=vs(t?.threadId??null);return t?n.jsxs(n.Fragment,{children:[n.jsx(Ze,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:a,onOpenIntelligence:l.toggle,onSwipeNext:i?()=>s(i):void 0,onSwipePrevious:c?()=>s(c):void 0,mobileIntelligenceOpen:l.isOpen}),n.jsx(Xe,{isOpen:l.isOpen,onClose:l.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:d})]}):n.jsx("div",{className:"h-full",children:n.jsx(lt,{})})}const Po=Object.assign(So,{List:lt,Reading:Co,Intelligence:To,Phone:wo});export{Po as B};
@@ -1 +1 @@
1
- import{j as n,f as E,t as m,_ as ee,$ as te,az as g,r as w,ay as ne,X as se,a0 as ae}from"./index-AluQ2uio.js";import{j as C,B as ie,l as re,E as T,F as oe,z as le,o as U,G as ce}from"./useCalendarEvents-6S-6YzeO.js";import{u as de,U as _,i as ue,t as me}from"./useCalendars-CIXsmVJv.js";import{R as H,c as he}from"./calendar-color-BNsiepMN.js";import{C as xe}from"./calendar-clash-strip--sv3hlnj.js";const pe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ye=["January","February","March","April","May","June","July","August","September","October","November","December"],ve=["first","second","third","fourth","last"],k="";function ge(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[s,a,r]=e.split("-").map(Number),i=new Date(Date.UTC(s,a-1,r)),o=pe[i.getUTCDay()],l=ve[Math.min(Math.floor((r-1)/7),4)],c=t===""?"":`, ${t}`,d=i.getUTCDay()>=1&&i.getUTCDay()<=5;return[`Every day${c}`,...d?[`Every weekday${c}`]:[],`Every week on ${o}${c}`,`Every month on the ${l} ${o}${c}`,`Every year on ${r} ${ye[a-1]}${c}`]}const De="w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",h=({draft:e,onChange:t},s,a)=>t({...e,[s]:a});function v({label:e,children:t}){return n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),t]})}function fe({draft:e,onChange:t,layout:s="compact",touch:a}){const r=s==="pane";return n.jsx(g,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:i=>h({draft:e,onChange:t},"title",i.target.value),className:m(r?"text-lg font-medium":"text-md font-medium",r?"h-11":a?"min-h-11":"")})}function P(e){return e.date===""||e.endDate===""?!1:e.allDay?e.endDate<e.date:e.startTime===""||e.endTime===""?!1:`${e.endDate}T${e.endTime}`<`${e.date}T${e.startTime}`}function Ne(e,t){return t===""?{...e,date:t}:e.endDate===""?{...e,date:t,endDate:t}:e.date===""?{...e,date:t}:{...e,date:t,endDate:C(t,ie(e.date,e.endDate))}}function Te(e,t){const s=e.date!==""&&e.endDate===C(e.date,1)&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime;return t&&s?{...e,allDay:t,endDate:e.date}:!t&&e.date!==""&&e.endDate===e.date&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime?{...e,allDay:t,endDate:C(e.date,1)}:{...e,allDay:t}}function be({draft:e,onChange:t,touch:s}){const a=s?"min-h-11":"",r=P(e),i=w.useId(),o={"aria-invalid":r,"aria-describedby":r?i:void 0},l=m("w-40",a,r&&"border-danger/60"),c=m("w-28",a,r&&"border-danger/60");return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(g,{type:"date",value:e.date,"aria-label":"Date",...o,onChange:d=>t(Ne(e,d.target.value)),className:l}),!e.allDay&&n.jsx(g,{type:"time",value:e.startTime,"aria-label":"Start time",...o,onChange:d=>h({draft:e,onChange:t},"startTime",d.target.value),className:c}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(g,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...o,onChange:d=>h({draft:e,onChange:t},"endDate",d.target.value),className:l}),!e.allDay&&n.jsx(g,{type:"time",value:e.endTime,"aria-label":"End time",...o,onChange:d=>h({draft:e,onChange:t},"endTime",d.target.value),className:c}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:d=>t(Te(e,d.target.checked)),className:"size-4 accent-current"}),"All day"]})]}),r&&n.jsx("p",{id:i,className:"text-xs text-danger",role:"alert",children:e.allDay?`Ends before it starts. Move the end to ${e.date} or later.`:`Ends before it starts. Move the end past ${e.date} ${e.startTime}, or start earlier.`})]})}function je({draft:e,onChange:t,calendars:s,touch:a}){return n.jsx(Oe,{calendars:s,value:e.calendarId,onChange:r=>h({draft:e,onChange:t},"calendarId",r),touch:a})}function Ee({draft:e,onChange:t,touch:s,repeatEditable:a=!0,onCustom:r}){return a?n.jsx(Ae,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:i=>h({draft:e,onChange:t},"repeat",i),onCustom:r,className:s?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(H,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===k?"Does not repeat":e.repeat]})}function $e({draft:e,onChange:t,touch:s}){return n.jsx(g,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:a=>h({draft:e,onChange:t},"location",a.target.value),className:s?"min-h-11":""})}function Ce({draft:e,onChange:t,touch:s}){return n.jsx(g,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:a=>h({draft:e,onChange:t},"guests",a.target.value),className:s?"min-h-11":""})}function ke({draft:e,onChange:t,layout:s="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:a=>h({draft:e,onChange:t},"notes",a.target.value),rows:s==="pane"?6:3,className:De})}function we({draft:e,onChange:t,calendars:s,layout:a="compact",expanded:r=!1,onToggleExpanded:i,onSave:o,onCancel:l,onDelete:c,saveLabel:d="Add",header:x,repeatEditable:u=!0,guestsEditable:D=!1,calendarEditable:O=!0,onCustomRepeat:X,touch:p,className:F}){const f=a==="pane",y={draft:e,onChange:t,layout:a,touch:p},Y=n.jsx(fe,{...y}),R=n.jsx(be,{...y}),I=n.jsx(je,{...y,calendars:s}),M=n.jsx(Ee,{...y,repeatEditable:u,onCustom:X}),S=n.jsx($e,{...y}),L=n.jsx(Ce,{...y}),W=n.jsx(ke,{...y}),z=n.jsxs("div",{className:m("flex items-center gap-2",f?"pt-2":"pt-1"),children:[n.jsx(E,{variant:"primary",size:p||f?"md":"sm",onClick:o,disabled:P(e),className:p?"min-h-11 flex-1":"",children:d}),n.jsx(E,{variant:"ghost",size:p||f?"md":"sm",onClick:l,className:p?"min-h-11":"",children:"Cancel"}),c&&n.jsx(E,{variant:"ghost",size:p||f?"md":"sm",onClick:c,className:m("ml-auto text-danger",p&&"min-h-11"),children:"Delete"})]});if(f)return n.jsxs("div",{className:m("flex flex-col gap-5",F),children:[x,n.jsx(v,{label:"Title",children:Y}),n.jsx(v,{label:"When",children:R}),O&&n.jsx(v,{label:"Calendar",children:I}),n.jsx(v,{label:"Repeat",children:M}),n.jsx(v,{label:"Location",children:S}),D&&n.jsx(v,{label:"Guests",children:L}),n.jsx(v,{label:"Notes",children:W}),z]});const Z=i!==void 0&&!r;return n.jsxs("div",{className:m("flex flex-col gap-3",F),children:[x,Y,R,O&&I,i&&n.jsxs("button",{type:"button",onClick:i,"aria-expanded":r,className:m("flex items-center gap-1 self-start rounded-sm text-xs font-medium text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",p&&"min-h-11"),children:[r?n.jsx(ee,{className:"size-3.5"}):n.jsx(te,{className:"size-3.5"}),r?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[S,D&&L,M,W]}),z]})}const B="__custom__";function Ae({value:e,date:t,startTime:s,onChange:a,onCustom:r,className:i}){const o=ge(t,s),l=e===k||o.includes(e)?o:[e,...o];return n.jsxs(ne,{icon:n.jsx(H,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:c=>{if(c.target.value===B){r?.();return}a(c.target.value)},className:i,children:[n.jsx("option",{value:k,children:"Does not repeat"}),l.map(c=>n.jsx("option",{value:c,children:c},c)),r&&n.jsx("option",{value:B,children:"Custom…"})]})}function Oe({calendars:e,value:t,onChange:s,touch:a}){const r=w.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(i=>{const o=he(i.color),l=i.id===t;return n.jsxs("label",{className:m("inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-2.5 text-xs transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",a?"min-h-11":"h-7",l?m(o.soft,o.text,o.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:r,value:i.id,checked:l,onChange:()=>s(i.id),className:"sr-only"}),n.jsx("span",{className:m("size-2 rounded-full",o.solid)}),i.name]},i.id)})]})}function Fe({title:e,subtitle:t,onClose:s,children:a,className:r}){return n.jsxs("section",{className:m("flex h-full w-full flex-col bg-surface",r),children:[n.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[n.jsx("h2",{className:"shrink-0 text-xs font-medium text-fg",children:e}),t!==void 0&&t!==""&&n.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:t}),n.jsx("button",{type:"button","aria-label":"Close editor",onClick:s,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(se,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:a})})]})}const b=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],j=["SU","MO","TU","WE","TH","FR","SA"],K=["January","February","March","April","May","June","July","August","September","October","November","December"],G=["first","second","third","fourth","last"],J=[1,2,3,4,-1],Q="MO,TU,WE,TH,FR",Ye=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function A(e){const t=Ye(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${Q}`;const s=t.match(/^Every week on (\w+)$/);if(s){const i=b.indexOf(s[1]);return i===-1?void 0:`FREQ=WEEKLY;BYDAY=${j[i]}`}const a=t.match(/^Every month on the (\w+) (\w+)$/);if(a){const i=G.indexOf(a[1]),o=b.indexOf(a[2]);return i===-1||o===-1?void 0:`FREQ=MONTHLY;BYDAY=${J[i]}${j[o]}`}const r=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(r){const i=K.indexOf(r[2]);return i===-1?void 0:`FREQ=YEARLY;BYMONTH=${i+1};BYMONTHDAY=${Number(r[1])}`}}const Re=e=>e===""?"":`, ${e}`;function Be(e,t){const s=new Map(e.split(";").map(o=>o.split("=")).filter(o=>o.length===2).map(([o,l])=>[o.toUpperCase(),l.toUpperCase()])),a=Re(t),r=s.get("FREQ"),i=s.get("BYDAY");if(!(s.has("INTERVAL")&&s.get("INTERVAL")!=="1")&&!(s.has("UNTIL")||s.has("COUNT"))){if(r==="DAILY")return`Every day${a}`;if(r==="WEEKLY"){if(i===void 0)return;if(i===Q)return`Every weekday${a}`;const o=j.indexOf(i);return o===-1?void 0:`Every week on ${b[o]}${a}`}if(r==="MONTHLY"){const o=i?.match(/^(-?\d)([A-Z]{2})$/);if(!o)return;const l=J.indexOf(Number(o[1])),c=j.indexOf(o[2]);return l===-1||c===-1?void 0:`Every month on the ${G[l]} ${b[c]}${a}`}if(r==="YEARLY"){const o=Number(s.get("BYMONTH")),l=Number(s.get("BYMONTHDAY"));return!o||!l||o>12?void 0:`Every year on ${l} ${K[o-1]}${a}`}}}function He(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function Pe(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endDate:oe(e),endTime:e.allDay?"":e.end.slice(11,16),allDay:e.allDay,calendarId:e.calendarId,location:t.location,guests:"",notes:t.notes,repeat:t.repeat}}function V(e,t){return e.allDay?{start:e.date,end:re(e.endDate,1)}:{start:T(e.date,e.startTime,t),end:T(e.endDate,e.endTime,t)}}function q(e,t){return e.title.trim()===""?"Give the event a title before saving it.":e.date===""?"Pick the day the event is on.":e.endDate===""?"Pick the day the event ends on.":e.calendarId===""?"Pick the calendar to save the event in.":!e.allDay&&(e.startTime===""||e.endTime==="")?"Set a start and an end time, or mark the event all day.":e.allDay&&e.endDate<e.date?"The last day is before the first. Move one of them.":!e.allDay&&`${e.endDate}T${e.endTime}`<=`${e.date}T${e.startTime}`?"The end is not after the start. Move one of them.":t&&A(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Ke(e,t){const s=q(e,!0);if(s!=="")return{ok:!1,problem:s};const{start:a,end:r}=V(e,t);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:a,end:r,allDay:e.allDay,...t===""?{}:{timeZone:t},recurrenceRule:A(e.repeat)??""}}}function Ge(e,t,s){const a=t.repeat!==e.repeat,r=q(t,a);if(r!=="")return{ok:!1,problem:r};const i={};if(t.title.trim()!==e.title.trim()&&(i.summary=t.title.trim()),t.location!==e.location&&(i.location=t.location),t.notes!==e.notes&&(i.description=t.notes),t.date!==e.date||t.startTime!==e.startTime||t.endDate!==e.endDate||t.endTime!==e.endTime||t.allDay!==e.allDay){const{start:l,end:c}=V(t,s);i.start=l,i.end=c,i.allDay=t.allDay,s!==""&&(i.timeZone=s)}return a&&(i.recurrenceRule=A(t.repeat)??""),{ok:!0,patch:i}}const $=new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"long"}),N=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});function Ie(e){const t=new Date(e.start),s=new Date(e.end),a=$.format(t);return e.allDay?`${a}, all day`:$.format(s)===a?`${a}, ${N.format(t)} – ${N.format(s)}`:`${a}, ${N.format(t)} – ${$.format(s)}, ${N.format(s)}`}const Me=[],Se={from:"",to:""};function Je(e,t=""){const{timeZoneByCalendarId:s}=de(),a=e.date!==""&&!e.allDay&&e.endDate!==""&&e.startTime!==""&&e.endTime!==""&&`${e.endDate}T${e.endTime}`>`${e.date}T${e.startTime}`,{instances:r,isLoading:i,error:o}=le({...a?{from:U("week",e.date).from,to:U("week",e.endDate).to}:Se,calendarIds:Me,enabled:a}),l=s[e.calendarId]??_;return w.useMemo(()=>{if(!a||i||o)return;const c=T(e.date,e.startTime,l),d=T(e.endDate,e.endTime,l),x=r.filter(u=>ue(u)&&u.calendarObjectId!==t).map(u=>me(u,s[u.calendarId]??_));return ce({start:c,end:d},x).map(u=>({id:u.id,label:`${u.title}, ${Ie(u)}`}))},[a,i,o,e.date,e.endDate,e.startTime,e.endTime,l,r,t,s])}function Qe({title:e,subtitle:t,calendars:s,draft:a,onChange:r,problem:i,saveLabel:o,isSaving:l,repeatEditable:c=!0,calendarEditable:d=!0,clashes:x,onSave:u,onCancel:D}){return n.jsx(Fe,{title:e,subtitle:t,onClose:D,children:n.jsx(we,{draft:a,onChange:r,calendars:s,layout:"pane",repeatEditable:c,calendarEditable:d,saveLabel:l?"Saving…":o,onSave:u,onCancel:D,header:i===""&&x===void 0?void 0:n.jsxs("div",{className:"space-y-2",children:[i!==""&&n.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[n.jsx(ae,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),n.jsx("p",{className:"min-w-0 flex-1 break-words text-fg",children:i})]}),x!==void 0&&n.jsx(xe,{clashes:x,clearText:"Nothing else is booked at this time."})]})})})}export{Qe as C,Ke as c,Pe as d,He as e,Ie as f,Ge as p,Be as t,Je as u};
1
+ import{j as n,f as E,t as m,_ as ee,$ as te,az as g,r as w,ay as ne,X as se,a0 as ae}from"./index-kmRGKW5t.js";import{j as C,B as ie,l as re,E as T,F as oe,z as le,o as U,G as ce}from"./useCalendarEvents-B4NUgtF7.js";import{u as de,U as _,i as ue,t as me}from"./useCalendars-Cmgw3xFq.js";import{R as H,c as he}from"./calendar-color-CjzWsjnf.js";import{C as xe}from"./calendar-clash-strip-zBMpTyZa.js";const pe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ye=["January","February","March","April","May","June","July","August","September","October","November","December"],ve=["first","second","third","fourth","last"],k="";function ge(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[s,a,r]=e.split("-").map(Number),i=new Date(Date.UTC(s,a-1,r)),o=pe[i.getUTCDay()],l=ve[Math.min(Math.floor((r-1)/7),4)],c=t===""?"":`, ${t}`,d=i.getUTCDay()>=1&&i.getUTCDay()<=5;return[`Every day${c}`,...d?[`Every weekday${c}`]:[],`Every week on ${o}${c}`,`Every month on the ${l} ${o}${c}`,`Every year on ${r} ${ye[a-1]}${c}`]}const De="w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",h=({draft:e,onChange:t},s,a)=>t({...e,[s]:a});function v({label:e,children:t}){return n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),t]})}function fe({draft:e,onChange:t,layout:s="compact",touch:a}){const r=s==="pane";return n.jsx(g,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:i=>h({draft:e,onChange:t},"title",i.target.value),className:m(r?"text-lg font-medium":"text-md font-medium",r?"h-11":a?"min-h-11":"")})}function P(e){return e.date===""||e.endDate===""?!1:e.allDay?e.endDate<e.date:e.startTime===""||e.endTime===""?!1:`${e.endDate}T${e.endTime}`<`${e.date}T${e.startTime}`}function Ne(e,t){return t===""?{...e,date:t}:e.endDate===""?{...e,date:t,endDate:t}:e.date===""?{...e,date:t}:{...e,date:t,endDate:C(t,ie(e.date,e.endDate))}}function Te(e,t){const s=e.date!==""&&e.endDate===C(e.date,1)&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime;return t&&s?{...e,allDay:t,endDate:e.date}:!t&&e.date!==""&&e.endDate===e.date&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime?{...e,allDay:t,endDate:C(e.date,1)}:{...e,allDay:t}}function be({draft:e,onChange:t,touch:s}){const a=s?"min-h-11":"",r=P(e),i=w.useId(),o={"aria-invalid":r,"aria-describedby":r?i:void 0},l=m("w-40",a,r&&"border-danger/60"),c=m("w-28",a,r&&"border-danger/60");return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(g,{type:"date",value:e.date,"aria-label":"Date",...o,onChange:d=>t(Ne(e,d.target.value)),className:l}),!e.allDay&&n.jsx(g,{type:"time",value:e.startTime,"aria-label":"Start time",...o,onChange:d=>h({draft:e,onChange:t},"startTime",d.target.value),className:c}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(g,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...o,onChange:d=>h({draft:e,onChange:t},"endDate",d.target.value),className:l}),!e.allDay&&n.jsx(g,{type:"time",value:e.endTime,"aria-label":"End time",...o,onChange:d=>h({draft:e,onChange:t},"endTime",d.target.value),className:c}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:d=>t(Te(e,d.target.checked)),className:"size-4 accent-current"}),"All day"]})]}),r&&n.jsx("p",{id:i,className:"text-xs text-danger",role:"alert",children:e.allDay?`Ends before it starts. Move the end to ${e.date} or later.`:`Ends before it starts. Move the end past ${e.date} ${e.startTime}, or start earlier.`})]})}function je({draft:e,onChange:t,calendars:s,touch:a}){return n.jsx(Oe,{calendars:s,value:e.calendarId,onChange:r=>h({draft:e,onChange:t},"calendarId",r),touch:a})}function Ee({draft:e,onChange:t,touch:s,repeatEditable:a=!0,onCustom:r}){return a?n.jsx(Ae,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:i=>h({draft:e,onChange:t},"repeat",i),onCustom:r,className:s?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(H,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===k?"Does not repeat":e.repeat]})}function $e({draft:e,onChange:t,touch:s}){return n.jsx(g,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:a=>h({draft:e,onChange:t},"location",a.target.value),className:s?"min-h-11":""})}function Ce({draft:e,onChange:t,touch:s}){return n.jsx(g,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:a=>h({draft:e,onChange:t},"guests",a.target.value),className:s?"min-h-11":""})}function ke({draft:e,onChange:t,layout:s="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:a=>h({draft:e,onChange:t},"notes",a.target.value),rows:s==="pane"?6:3,className:De})}function we({draft:e,onChange:t,calendars:s,layout:a="compact",expanded:r=!1,onToggleExpanded:i,onSave:o,onCancel:l,onDelete:c,saveLabel:d="Add",header:x,repeatEditable:u=!0,guestsEditable:D=!1,calendarEditable:O=!0,onCustomRepeat:X,touch:p,className:F}){const f=a==="pane",y={draft:e,onChange:t,layout:a,touch:p},Y=n.jsx(fe,{...y}),R=n.jsx(be,{...y}),I=n.jsx(je,{...y,calendars:s}),M=n.jsx(Ee,{...y,repeatEditable:u,onCustom:X}),S=n.jsx($e,{...y}),L=n.jsx(Ce,{...y}),W=n.jsx(ke,{...y}),z=n.jsxs("div",{className:m("flex items-center gap-2",f?"pt-2":"pt-1"),children:[n.jsx(E,{variant:"primary",size:p||f?"md":"sm",onClick:o,disabled:P(e),className:p?"min-h-11 flex-1":"",children:d}),n.jsx(E,{variant:"ghost",size:p||f?"md":"sm",onClick:l,className:p?"min-h-11":"",children:"Cancel"}),c&&n.jsx(E,{variant:"ghost",size:p||f?"md":"sm",onClick:c,className:m("ml-auto text-danger",p&&"min-h-11"),children:"Delete"})]});if(f)return n.jsxs("div",{className:m("flex flex-col gap-5",F),children:[x,n.jsx(v,{label:"Title",children:Y}),n.jsx(v,{label:"When",children:R}),O&&n.jsx(v,{label:"Calendar",children:I}),n.jsx(v,{label:"Repeat",children:M}),n.jsx(v,{label:"Location",children:S}),D&&n.jsx(v,{label:"Guests",children:L}),n.jsx(v,{label:"Notes",children:W}),z]});const Z=i!==void 0&&!r;return n.jsxs("div",{className:m("flex flex-col gap-3",F),children:[x,Y,R,O&&I,i&&n.jsxs("button",{type:"button",onClick:i,"aria-expanded":r,className:m("flex items-center gap-1 self-start rounded-sm text-xs font-medium text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",p&&"min-h-11"),children:[r?n.jsx(ee,{className:"size-3.5"}):n.jsx(te,{className:"size-3.5"}),r?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[S,D&&L,M,W]}),z]})}const B="__custom__";function Ae({value:e,date:t,startTime:s,onChange:a,onCustom:r,className:i}){const o=ge(t,s),l=e===k||o.includes(e)?o:[e,...o];return n.jsxs(ne,{icon:n.jsx(H,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:c=>{if(c.target.value===B){r?.();return}a(c.target.value)},className:i,children:[n.jsx("option",{value:k,children:"Does not repeat"}),l.map(c=>n.jsx("option",{value:c,children:c},c)),r&&n.jsx("option",{value:B,children:"Custom…"})]})}function Oe({calendars:e,value:t,onChange:s,touch:a}){const r=w.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(i=>{const o=he(i.color),l=i.id===t;return n.jsxs("label",{className:m("inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-2.5 text-xs transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",a?"min-h-11":"h-7",l?m(o.soft,o.text,o.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:r,value:i.id,checked:l,onChange:()=>s(i.id),className:"sr-only"}),n.jsx("span",{className:m("size-2 rounded-full",o.solid)}),i.name]},i.id)})]})}function Fe({title:e,subtitle:t,onClose:s,children:a,className:r}){return n.jsxs("section",{className:m("flex h-full w-full flex-col bg-surface",r),children:[n.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[n.jsx("h2",{className:"shrink-0 text-xs font-medium text-fg",children:e}),t!==void 0&&t!==""&&n.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:t}),n.jsx("button",{type:"button","aria-label":"Close editor",onClick:s,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(se,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:a})})]})}const b=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],j=["SU","MO","TU","WE","TH","FR","SA"],K=["January","February","March","April","May","June","July","August","September","October","November","December"],G=["first","second","third","fourth","last"],J=[1,2,3,4,-1],Q="MO,TU,WE,TH,FR",Ye=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function A(e){const t=Ye(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${Q}`;const s=t.match(/^Every week on (\w+)$/);if(s){const i=b.indexOf(s[1]);return i===-1?void 0:`FREQ=WEEKLY;BYDAY=${j[i]}`}const a=t.match(/^Every month on the (\w+) (\w+)$/);if(a){const i=G.indexOf(a[1]),o=b.indexOf(a[2]);return i===-1||o===-1?void 0:`FREQ=MONTHLY;BYDAY=${J[i]}${j[o]}`}const r=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(r){const i=K.indexOf(r[2]);return i===-1?void 0:`FREQ=YEARLY;BYMONTH=${i+1};BYMONTHDAY=${Number(r[1])}`}}const Re=e=>e===""?"":`, ${e}`;function Be(e,t){const s=new Map(e.split(";").map(o=>o.split("=")).filter(o=>o.length===2).map(([o,l])=>[o.toUpperCase(),l.toUpperCase()])),a=Re(t),r=s.get("FREQ"),i=s.get("BYDAY");if(!(s.has("INTERVAL")&&s.get("INTERVAL")!=="1")&&!(s.has("UNTIL")||s.has("COUNT"))){if(r==="DAILY")return`Every day${a}`;if(r==="WEEKLY"){if(i===void 0)return;if(i===Q)return`Every weekday${a}`;const o=j.indexOf(i);return o===-1?void 0:`Every week on ${b[o]}${a}`}if(r==="MONTHLY"){const o=i?.match(/^(-?\d)([A-Z]{2})$/);if(!o)return;const l=J.indexOf(Number(o[1])),c=j.indexOf(o[2]);return l===-1||c===-1?void 0:`Every month on the ${G[l]} ${b[c]}${a}`}if(r==="YEARLY"){const o=Number(s.get("BYMONTH")),l=Number(s.get("BYMONTHDAY"));return!o||!l||o>12?void 0:`Every year on ${l} ${K[o-1]}${a}`}}}function He(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function Pe(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endDate:oe(e),endTime:e.allDay?"":e.end.slice(11,16),allDay:e.allDay,calendarId:e.calendarId,location:t.location,guests:"",notes:t.notes,repeat:t.repeat}}function V(e,t){return e.allDay?{start:e.date,end:re(e.endDate,1)}:{start:T(e.date,e.startTime,t),end:T(e.endDate,e.endTime,t)}}function q(e,t){return e.title.trim()===""?"Give the event a title before saving it.":e.date===""?"Pick the day the event is on.":e.endDate===""?"Pick the day the event ends on.":e.calendarId===""?"Pick the calendar to save the event in.":!e.allDay&&(e.startTime===""||e.endTime==="")?"Set a start and an end time, or mark the event all day.":e.allDay&&e.endDate<e.date?"The last day is before the first. Move one of them.":!e.allDay&&`${e.endDate}T${e.endTime}`<=`${e.date}T${e.startTime}`?"The end is not after the start. Move one of them.":t&&A(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Ke(e,t){const s=q(e,!0);if(s!=="")return{ok:!1,problem:s};const{start:a,end:r}=V(e,t);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:a,end:r,allDay:e.allDay,...t===""?{}:{timeZone:t},recurrenceRule:A(e.repeat)??""}}}function Ge(e,t,s){const a=t.repeat!==e.repeat,r=q(t,a);if(r!=="")return{ok:!1,problem:r};const i={};if(t.title.trim()!==e.title.trim()&&(i.summary=t.title.trim()),t.location!==e.location&&(i.location=t.location),t.notes!==e.notes&&(i.description=t.notes),t.date!==e.date||t.startTime!==e.startTime||t.endDate!==e.endDate||t.endTime!==e.endTime||t.allDay!==e.allDay){const{start:l,end:c}=V(t,s);i.start=l,i.end=c,i.allDay=t.allDay,s!==""&&(i.timeZone=s)}return a&&(i.recurrenceRule=A(t.repeat)??""),{ok:!0,patch:i}}const $=new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"long"}),N=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});function Ie(e){const t=new Date(e.start),s=new Date(e.end),a=$.format(t);return e.allDay?`${a}, all day`:$.format(s)===a?`${a}, ${N.format(t)} – ${N.format(s)}`:`${a}, ${N.format(t)} – ${$.format(s)}, ${N.format(s)}`}const Me=[],Se={from:"",to:""};function Je(e,t=""){const{timeZoneByCalendarId:s}=de(),a=e.date!==""&&!e.allDay&&e.endDate!==""&&e.startTime!==""&&e.endTime!==""&&`${e.endDate}T${e.endTime}`>`${e.date}T${e.startTime}`,{instances:r,isLoading:i,error:o}=le({...a?{from:U("week",e.date).from,to:U("week",e.endDate).to}:Se,calendarIds:Me,enabled:a}),l=s[e.calendarId]??_;return w.useMemo(()=>{if(!a||i||o)return;const c=T(e.date,e.startTime,l),d=T(e.endDate,e.endTime,l),x=r.filter(u=>ue(u)&&u.calendarObjectId!==t).map(u=>me(u,s[u.calendarId]??_));return ce({start:c,end:d},x).map(u=>({id:u.id,label:`${u.title}, ${Ie(u)}`}))},[a,i,o,e.date,e.endDate,e.startTime,e.endTime,l,r,t,s])}function Qe({title:e,subtitle:t,calendars:s,draft:a,onChange:r,problem:i,saveLabel:o,isSaving:l,repeatEditable:c=!0,calendarEditable:d=!0,clashes:x,onSave:u,onCancel:D}){return n.jsx(Fe,{title:e,subtitle:t,onClose:D,children:n.jsx(we,{draft:a,onChange:r,calendars:s,layout:"pane",repeatEditable:c,calendarEditable:d,saveLabel:l?"Saving…":o,onSave:u,onCancel:D,header:i===""&&x===void 0?void 0:n.jsxs("div",{className:"space-y-2",children:[i!==""&&n.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[n.jsx(ae,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),n.jsx("p",{className:"min-w-0 flex-1 break-words text-fg",children:i})]}),x!==void 0&&n.jsx(xe,{clashes:x,clearText:"Nothing else is booked at this time."})]})})})}export{Qe as C,Ke as c,Pe as d,He as e,Ie as f,Ge as p,Be as t,Je as u};
@@ -1 +1 @@
1
- import{j as t,r as e}from"./index-AluQ2uio.js";const o=e.createContext(void 0),C=({pick:s,children:r})=>t.jsx(o.Provider,{value:s,children:r}),d=()=>e.useContext(o);export{C,d as u};
1
+ import{j as t,r as e}from"./index-kmRGKW5t.js";const o=e.createContext(void 0),C=({pick:s,children:r})=>t.jsx(o.Provider,{value:s,children:r}),d=()=>e.useContext(o);export{C,d as u};
@@ -1 +1 @@
1
- import{r,j as n,al as l,am as o}from"./index-AluQ2uio.js";const i=r.createContext(null),v=({chrome:s,children:a})=>n.jsx(i.Provider,{value:s,children:a});function C({workspace:s,reading:a,hasOpenEvent:x}){const e=r.useContext(i);if(!e)return n.jsx(l,{});const t={nav:e.nav,skeleton:n.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav,listBias:"list"};return e.isSinglePane?n.jsx(o,{...t,list:x?a:s}):n.jsx(o,{...t,list:s,reading:a})}export{v as C,C as a};
1
+ import{r,j as n,al as l,am as o}from"./index-kmRGKW5t.js";const i=r.createContext(null),v=({chrome:s,children:a})=>n.jsx(i.Provider,{value:s,children:a});function C({workspace:s,reading:a,hasOpenEvent:x}){const e=r.useContext(i);if(!e)return n.jsx(l,{});const t={nav:e.nav,skeleton:n.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav,listBias:"list"};return e.isSinglePane?n.jsx(o,{...t,list:x?a:s}):n.jsx(o,{...t,list:s,reading:a})}export{v as C,C as a};
@@ -1 +1 @@
1
- import{j as e}from"./index-AluQ2uio.js";const x=({message:s,icon:t})=>e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[t&&e.jsx("div",{className:"mb-4 text-fg-muted",children:t}),e.jsx("p",{className:"text-fg-muted",children:s})]});export{x as E};
1
+ import{j as e}from"./index-kmRGKW5t.js";const x=({message:s,icon:t})=>e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[t&&e.jsx("div",{className:"mb-4 text-fg-muted",children:t}),e.jsx("p",{className:"text-fg-muted",children:s})]});export{x as E};
@@ -1 +1 @@
1
- import{j as t,a0 as r}from"./index-AluQ2uio.js";const d=e=>e instanceof Error?e.message:typeof e=="string"?e:typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:"An unexpected error occurred",l=({title:e="Couldn't load content",error:a,onRetry:s,variant:i="block"})=>{const n=d(a);return i==="inline"?t.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[t.jsx(r,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-fg-muted mt-0.5 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}):t.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[t.jsx(r,{className:"size-8 text-danger","aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-sm text-fg-muted mt-1 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center rounded-md border border-line bg-canvas px-4 py-2 text-sm font-medium hover:bg-surface-raised transition-colors",children:"Retry"})]})};export{l as E,d as f};
1
+ import{j as t,a0 as r}from"./index-kmRGKW5t.js";const d=e=>e instanceof Error?e.message:typeof e=="string"?e:typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:"An unexpected error occurred",l=({title:e="Couldn't load content",error:a,onRetry:s,variant:i="block"})=>{const n=d(a);return i==="inline"?t.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[t.jsx(r,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-fg-muted mt-0.5 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}):t.jsxs("div",{role:"alert",className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[t.jsx(r,{className:"size-8 text-danger","aria-hidden":"true"}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-danger",children:e}),t.jsx("p",{className:"text-sm text-fg-muted mt-1 break-words",children:n})]}),s&&t.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center rounded-md border border-line bg-canvas px-4 py-2 text-sm font-medium hover:bg-surface-raised transition-colors",children:"Retry"})]})};export{l as E,d as f};
@@ -1 +1 @@
1
- import{eA as U,r as o,d$ as Z,c as ie,C as z,bp as le,cR as ce,aZ as ue,a_ as ge,j as a,ak as he,d1 as me,d2 as pe}from"./index-AluQ2uio.js";import{u as fe,p as _,R as Ie}from"./useSearchTokenContext-Bs8lmzQX.js";import{A as xe,E as Te,al as ye,am as be,aw as ve,an as Ce,b as Re,M as Se,at as we,ax as je,av as Fe,m as Me,J as Oe,O as W,N as ke,K as Pe,d as Le,Y as Ae,Z as Ne,$,a0 as J,a1 as De,a2 as Ee,a3 as qe}from"./MailListHeader-CJubkcXR.js";import{u as Be,l as Qe,b as Ke,a as ze}from"./MailViewChrome-CXZE2Dur.js";import{f as He}from"./ErrorState-CwGAuFwH.js";import{d as Ve,w as Ge}from"./wizard-selection-DxUM65kM.js";import{a as _e}from"./useMessageBodyContent-BMgLWHlL.js";import{e as We,f as Ue}from"./search-token-index-C8iSg33h.js";import{u as Ze}from"./sections-De0aZhN_.js";const H=e=>({...e,starred:!0,order:"desc"}),$e=(e={})=>Z({query:H(e)});function Y(e={}){const{data:t,isLoading:s,isError:r,error:c,refetch:u,fetchNextPage:n,hasNextPage:g,isFetchingNextPage:h}=Be({queryKey:$e(e),queryFn:async({pageParam:I})=>{const{data:l}=await U({query:{...H(e),continuationToken:I},throwOnError:!0});return l},initialPageParam:void 0,getNextPageParam:I=>I.continuationToken,staleTime:6e4});return{threads:o.useMemo(()=>(t?.pages??[]).flatMap(I=>I.items??[]),[t]),isLoading:s,isError:r,error:c,refetch:u,fetchNextPage:n,hasNextPage:g,isFetchingNextPage:h}}function Je(e={}){const t={...H(e),unread:!0,count:!0,results:!1},{data:s}=ie({queryKey:Z({query:t}),queryFn:async()=>{const{data:r}=await U({query:t,throwOnError:!0});return r},staleTime:6e4});return s?.count}const Ye=["from","subject","category","unread","starred","attachments"],Xe=(e,t)=>{const s=xe(e),{params:r,residual:c}=Te(t,{...s,starred:!0},Ye);return{criteria:{...r,...s},residual:c}};function et({rows:e,verb:t}){const{selectedIds:s,exitSelection:r}=Fe(),c=o.useMemo(()=>Ge(e,s),[e,s]);return a.jsx(Me,{verb:t,selection:c,selectionRestriction:"spansAccounts",onFinished:r})}function tt({selectedMessageId:e,onOpenThread:t,commandsRef:s,onTriageContextChange:r,onDeleteMessages:c}){const{searchQuery:u,resultFolderIndex:n,onSearchClearQuery:g}=z(),h=fe(),k=le(),I=ce(),[l,m]=o.useState("all"),[b,P]=o.useState(new Set),S=o.useCallback(d=>{P(R=>{const x=new Set(R);return x.has(d)?x.delete(d):x.add(d),x})},[]),w=o.useCallback(()=>{m("all"),P(new Set)},[]),T=o.useCallback(()=>{w(),g()},[w,g]),{freeText:j,tokens:v}=_(u.trim().toLowerCase(),h),L=_(u.trim(),h).freeText,{criteria:A,residual:p}=o.useMemo(()=>Xe({category:l,attributes:b},v),[l,b,v]),F=o.useMemo(()=>j?{...A,query:j}:A,[A,j]),{threads:N,isLoading:D,isError:y,error:q,refetch:M,fetchNextPage:B,hasNextPage:Q,isFetchingNextPage:O}=Y(F),f=o.useMemo(()=>Ve(N).map(ye).filter(d=>be(d,p)),[N,p]),i=o.useCallback((d,R)=>{const x=f.find(de=>de.id===d)?.threadId;x&&t?.({threadId:x,messageId:d},R)},[f,t]),C=o.useCallback(d=>{const R=d.threadId??f.find(x=>x.id===d.id)?.threadId;R&&t?.({threadId:R,messageId:d.id})},[f,t]),K=o.useMemo(()=>ve(),[]),te=o.useMemo(()=>f.map(d=>Ce(d,n)),[f,n]),se=Je(F)??null,ae=o.useMemo(()=>v.filter(d=>d.type!=="isStarred"),[v]),re=Qe({chips:{category:l,attributes:b},tokens:ae,reach:p.length>0?"loaded-pages":"whole-folder",onClear:T}),V=D?"loading":y?"error":f.length===0?"empty":"ready",oe=o.useCallback(()=>{const d=ue(ge());window.open(d,"_blank","noopener,noreferrer")},[]),G=Re(),ne=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:f.map(d=>a.jsx(Se,{thread:d,active:d.id===e,onClick:()=>i(d.id)},d.id))}),Q?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>B(),disabled:O,children:O?"Loading…":"Load more"}):null]})});return a.jsx(Ke,{title:"Starred",unreadCount:se,preset:K,selectedCategory:l,activeFilters:b,onSelectCategory:m,onToggleFilter:S,onClearFilters:w,searchResults:te,searchLoading:D,onSelectSearchResult:C,searchResultsInBody:!0,children:a.jsxs(we,{selectedMessageId:e,rows:f,onOpen:i,onDeleteMessages:c,onSelectionVerb:I.start,commandsRef:s,onTriageContextChange:r,children:[a.jsx(ze,{listTitle:"Starred",sections:[{id:"flagged",threads:f}],flatList:!0,hideHeader:!0,listState:G.searchResults?"ready":V,listFilter:re,listScopeLabel:"Starred",searchQuery:L||void 0,errorMessage:y?He(q):void 0,onRetry:()=>M(),onReportError:oe,selectedThreadId:e,onSelectThread:i,isDesktop:k,selectionBar:a.jsx(je,{title:"Starred"}),listBody:G.searchResults??(V==="ready"?ne:void 0)}),a.jsx(et,{rows:f,verb:I.verb})]})})}const X=o.createContext(null);function E(){const e=o.useContext(X);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function st({thread:e,children:t}){const s=We(),r=Ue(),c=Ze(),{searchInput:u}=z(),n=e?.threadId,g=e?.messageId,{threads:h}=Y(),k=o.useMemo(()=>{if(n)return h.find(i=>i.messageId===g)??h.find(i=>i.threadId===n)},[h,n,g]),I=Oe(n,g),l=k??I,m=g??l?.messageId,b=o.useMemo(()=>{if(n)return{threadId:n,mailboxId:l?.mailboxId??"",subject:l?.subject,messageId:m,authenticity:l?.authenticity}},[n,l,m]),P=o.useCallback((i,C)=>{s(i,{replace:C?.replace,query:u})},[s,u]),S=o.useCallback(i=>{m&&i.includes(m)&&r()},[m,r]),w=W({thread:l,isOpen:!0,onAfterOptimisticRemove:S}),T=ke(),{deleteMessages:j}=Pe({mailboxId:l?.mailboxId??"",messages:h,onAfterOptimisticRemove:S}),{toggleReadFor:v}=Le({mailboxId:l?.mailboxId??"",messages:h}),L=T.focusedMessageId,p=o.useMemo(()=>h.find(i=>i.messageId===L),[h,L])??l,F=W({thread:p,isOpen:p?.messageId===m}),N=_e(),D=he(),y=me(),q=o.useMemo(()=>pe(y,n,m),[y,n,m]),M=o.useMemo(()=>{if(p)return i=>y({threadId:p.threadId,messageId:p.messageId,mode:i})},[y,p]),{nextMessageId:B,previousMessageId:Q}=Ae({context:T,orderedIds:T.orderedIds,selectedMessageId:m,enabled:!N&&!D,hasOpenThread:n!==void 0,onClose:r,handlers:{reply:()=>M?.("reply"),replyAll:()=>M?.("reply-all"),forward:()=>M?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||F.deleteThread()},toggleStar:F.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||p&&v([p.messageId],!p.isRead)},goBrief:()=>c("brief"),goSettings:()=>c("settings")}}),O=o.useCallback(i=>{if(!i)return;const C=h.find(K=>K.messageId===i);return C?{threadId:C.threadId,messageId:i}:void 0},[h]),f={selectedMessageId:m,selectedThread:l,conversation:b,onOpenThread:P,onCloseThread:r,nextThread:O(B),previousThread:O(Q),actions:w,onReply:q,triage:T,onDeleteMessages:j,handleDeselectIfRemoved:S};return a.jsx(X.Provider,{value:f,children:t})}function ee(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:r}=E();return a.jsx(tt,{selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:r})}function at(){const{conversation:e,selectedThread:t,actions:s,onReply:r,handleDeselectIfRemoved:c}=E(),u=!!e,n=Ee(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(qe,{hasThread:u,intelligenceOpen:n.isShowing,canToggleIntelligence:n.canToggle,onToggleIntelligence:n.toggle,onReply:r?()=>r("reply"):void 0,onReplyAll:r?()=>r("reply-all"):void 0,onForward:r?()=>r("forward"):void 0,onDelete:u?s.deleteThread:void 0,onToggleStar:u?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:u&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx($,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:n.open,listOnScreen:!0}):a.jsx(Ie,{})})]}),a.jsx(J,{isOpen:n.drawerOpen,onClose:n.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function rt(){const{selectedThread:e,handleDeselectIfRemoved:t}=E(),{onToggleIntelligence:s}=z();return a.jsx(De,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function ot(){const{selectedThread:e,conversation:t,onCloseThread:s,onOpenThread:r,nextThread:c,previousThread:u,handleDeselectIfRemoved:n}=E(),g=Ne(t?.threadId??null);return t?a.jsxs(a.Fragment,{children:[a.jsx($,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:s,onOpenIntelligence:g.toggle,onSwipeNext:c?()=>r(c):void 0,onSwipePrevious:u?()=>r(u):void 0,mobileIntelligenceOpen:g.isOpen}),a.jsx(J,{isOpen:g.isOpen,onClose:g.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:n})]}):a.jsx("div",{className:"h-full",children:a.jsx(ee,{})})}const pt=Object.assign(st,{List:ee,Reading:at,Intelligence:rt,Phone:ot});export{pt as F};
1
+ import{eA as U,r as o,d$ as Z,c as ie,C as z,bp as le,cR as ce,aZ as ue,a_ as ge,j as a,ak as he,d1 as me,d2 as pe}from"./index-kmRGKW5t.js";import{u as fe,p as _,R as Ie}from"./useSearchTokenContext-D3LFteLt.js";import{A as xe,E as Te,al as ye,am as be,aw as ve,an as Ce,b as Re,M as Se,at as we,ax as je,av as Fe,m as Me,J as Oe,O as W,N as ke,K as Pe,d as Le,Y as Ae,Z as Ne,$,a0 as J,a1 as De,a2 as Ee,a3 as qe}from"./MailListHeader-DMICasQ-.js";import{u as Be,l as Qe,b as Ke,a as ze}from"./MailViewChrome-oXPfi48R.js";import{f as He}from"./ErrorState-BOSB6fJZ.js";import{d as Ve,w as Ge}from"./wizard-selection-DxUM65kM.js";import{a as _e}from"./useMessageBodyContent-DFl-GIiU.js";import{e as We,f as Ue}from"./search-token-index-By1Eq3rT.js";import{u as Ze}from"./sections-dvIODVm1.js";const H=e=>({...e,starred:!0,order:"desc"}),$e=(e={})=>Z({query:H(e)});function Y(e={}){const{data:t,isLoading:s,isError:r,error:c,refetch:u,fetchNextPage:n,hasNextPage:g,isFetchingNextPage:h}=Be({queryKey:$e(e),queryFn:async({pageParam:I})=>{const{data:l}=await U({query:{...H(e),continuationToken:I},throwOnError:!0});return l},initialPageParam:void 0,getNextPageParam:I=>I.continuationToken,staleTime:6e4});return{threads:o.useMemo(()=>(t?.pages??[]).flatMap(I=>I.items??[]),[t]),isLoading:s,isError:r,error:c,refetch:u,fetchNextPage:n,hasNextPage:g,isFetchingNextPage:h}}function Je(e={}){const t={...H(e),unread:!0,count:!0,results:!1},{data:s}=ie({queryKey:Z({query:t}),queryFn:async()=>{const{data:r}=await U({query:t,throwOnError:!0});return r},staleTime:6e4});return s?.count}const Ye=["from","subject","category","unread","starred","attachments"],Xe=(e,t)=>{const s=xe(e),{params:r,residual:c}=Te(t,{...s,starred:!0},Ye);return{criteria:{...r,...s},residual:c}};function et({rows:e,verb:t}){const{selectedIds:s,exitSelection:r}=Fe(),c=o.useMemo(()=>Ge(e,s),[e,s]);return a.jsx(Me,{verb:t,selection:c,selectionRestriction:"spansAccounts",onFinished:r})}function tt({selectedMessageId:e,onOpenThread:t,commandsRef:s,onTriageContextChange:r,onDeleteMessages:c}){const{searchQuery:u,resultFolderIndex:n,onSearchClearQuery:g}=z(),h=fe(),k=le(),I=ce(),[l,m]=o.useState("all"),[b,P]=o.useState(new Set),S=o.useCallback(d=>{P(R=>{const x=new Set(R);return x.has(d)?x.delete(d):x.add(d),x})},[]),w=o.useCallback(()=>{m("all"),P(new Set)},[]),T=o.useCallback(()=>{w(),g()},[w,g]),{freeText:j,tokens:v}=_(u.trim().toLowerCase(),h),L=_(u.trim(),h).freeText,{criteria:A,residual:p}=o.useMemo(()=>Xe({category:l,attributes:b},v),[l,b,v]),F=o.useMemo(()=>j?{...A,query:j}:A,[A,j]),{threads:N,isLoading:D,isError:y,error:q,refetch:M,fetchNextPage:B,hasNextPage:Q,isFetchingNextPage:O}=Y(F),f=o.useMemo(()=>Ve(N).map(ye).filter(d=>be(d,p)),[N,p]),i=o.useCallback((d,R)=>{const x=f.find(de=>de.id===d)?.threadId;x&&t?.({threadId:x,messageId:d},R)},[f,t]),C=o.useCallback(d=>{const R=d.threadId??f.find(x=>x.id===d.id)?.threadId;R&&t?.({threadId:R,messageId:d.id})},[f,t]),K=o.useMemo(()=>ve(),[]),te=o.useMemo(()=>f.map(d=>Ce(d,n)),[f,n]),se=Je(F)??null,ae=o.useMemo(()=>v.filter(d=>d.type!=="isStarred"),[v]),re=Qe({chips:{category:l,attributes:b},tokens:ae,reach:p.length>0?"loaded-pages":"whole-folder",onClear:T}),V=D?"loading":y?"error":f.length===0?"empty":"ready",oe=o.useCallback(()=>{const d=ue(ge());window.open(d,"_blank","noopener,noreferrer")},[]),G=Re(),ne=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:f.map(d=>a.jsx(Se,{thread:d,active:d.id===e,onClick:()=>i(d.id)},d.id))}),Q?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>B(),disabled:O,children:O?"Loading…":"Load more"}):null]})});return a.jsx(Ke,{title:"Starred",unreadCount:se,preset:K,selectedCategory:l,activeFilters:b,onSelectCategory:m,onToggleFilter:S,onClearFilters:w,searchResults:te,searchLoading:D,onSelectSearchResult:C,searchResultsInBody:!0,children:a.jsxs(we,{selectedMessageId:e,rows:f,onOpen:i,onDeleteMessages:c,onSelectionVerb:I.start,commandsRef:s,onTriageContextChange:r,children:[a.jsx(ze,{listTitle:"Starred",sections:[{id:"flagged",threads:f}],flatList:!0,hideHeader:!0,listState:G.searchResults?"ready":V,listFilter:re,listScopeLabel:"Starred",searchQuery:L||void 0,errorMessage:y?He(q):void 0,onRetry:()=>M(),onReportError:oe,selectedThreadId:e,onSelectThread:i,isDesktop:k,selectionBar:a.jsx(je,{title:"Starred"}),listBody:G.searchResults??(V==="ready"?ne:void 0)}),a.jsx(et,{rows:f,verb:I.verb})]})})}const X=o.createContext(null);function E(){const e=o.useContext(X);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function st({thread:e,children:t}){const s=We(),r=Ue(),c=Ze(),{searchInput:u}=z(),n=e?.threadId,g=e?.messageId,{threads:h}=Y(),k=o.useMemo(()=>{if(n)return h.find(i=>i.messageId===g)??h.find(i=>i.threadId===n)},[h,n,g]),I=Oe(n,g),l=k??I,m=g??l?.messageId,b=o.useMemo(()=>{if(n)return{threadId:n,mailboxId:l?.mailboxId??"",subject:l?.subject,messageId:m,authenticity:l?.authenticity}},[n,l,m]),P=o.useCallback((i,C)=>{s(i,{replace:C?.replace,query:u})},[s,u]),S=o.useCallback(i=>{m&&i.includes(m)&&r()},[m,r]),w=W({thread:l,isOpen:!0,onAfterOptimisticRemove:S}),T=ke(),{deleteMessages:j}=Pe({mailboxId:l?.mailboxId??"",messages:h,onAfterOptimisticRemove:S}),{toggleReadFor:v}=Le({mailboxId:l?.mailboxId??"",messages:h}),L=T.focusedMessageId,p=o.useMemo(()=>h.find(i=>i.messageId===L),[h,L])??l,F=W({thread:p,isOpen:p?.messageId===m}),N=_e(),D=he(),y=me(),q=o.useMemo(()=>pe(y,n,m),[y,n,m]),M=o.useMemo(()=>{if(p)return i=>y({threadId:p.threadId,messageId:p.messageId,mode:i})},[y,p]),{nextMessageId:B,previousMessageId:Q}=Ae({context:T,orderedIds:T.orderedIds,selectedMessageId:m,enabled:!N&&!D,hasOpenThread:n!==void 0,onClose:r,handlers:{reply:()=>M?.("reply"),replyAll:()=>M?.("reply-all"),forward:()=>M?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||F.deleteThread()},toggleStar:F.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||p&&v([p.messageId],!p.isRead)},goBrief:()=>c("brief"),goSettings:()=>c("settings")}}),O=o.useCallback(i=>{if(!i)return;const C=h.find(K=>K.messageId===i);return C?{threadId:C.threadId,messageId:i}:void 0},[h]),f={selectedMessageId:m,selectedThread:l,conversation:b,onOpenThread:P,onCloseThread:r,nextThread:O(B),previousThread:O(Q),actions:w,onReply:q,triage:T,onDeleteMessages:j,handleDeselectIfRemoved:S};return a.jsx(X.Provider,{value:f,children:t})}function ee(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:r}=E();return a.jsx(tt,{selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:r})}function at(){const{conversation:e,selectedThread:t,actions:s,onReply:r,handleDeselectIfRemoved:c}=E(),u=!!e,n=Ee(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(qe,{hasThread:u,intelligenceOpen:n.isShowing,canToggleIntelligence:n.canToggle,onToggleIntelligence:n.toggle,onReply:r?()=>r("reply"):void 0,onReplyAll:r?()=>r("reply-all"):void 0,onForward:r?()=>r("forward"):void 0,onDelete:u?s.deleteThread:void 0,onToggleStar:u?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:u&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx($,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:n.open,listOnScreen:!0}):a.jsx(Ie,{})})]}),a.jsx(J,{isOpen:n.drawerOpen,onClose:n.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function rt(){const{selectedThread:e,handleDeselectIfRemoved:t}=E(),{onToggleIntelligence:s}=z();return a.jsx(De,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function ot(){const{selectedThread:e,conversation:t,onCloseThread:s,onOpenThread:r,nextThread:c,previousThread:u,handleDeselectIfRemoved:n}=E(),g=Ne(t?.threadId??null);return t?a.jsxs(a.Fragment,{children:[a.jsx($,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:s,onOpenIntelligence:g.toggle,onSwipeNext:c?()=>r(c):void 0,onSwipePrevious:u?()=>r(u):void 0,mobileIntelligenceOpen:g.isOpen}),a.jsx(J,{isOpen:g.isOpen,onClose:g.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:n})]}):a.jsx("div",{className:"h-full",children:a.jsx(ee,{})})}const pt=Object.assign(st,{List:ee,Reading:at,Intelligence:rt,Phone:ot});export{pt as F};
@@ -1 +1 @@
1
- import{r as n,c as f,d as m,G as N,j as e,bp as w,X as E}from"./index-AluQ2uio.js";import{E as u}from"./ErrorState-CwGAuFwH.js";import{D as r,C as x,u as k}from"./index-CPrSlVG5.js";import{c as p,d as h,e as b}from"./useMessageBodyContent-BMgLWHlL.js";import{C as S}from"./confirm-dialog-Deiy3Ntg.js";const C=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},O=()=>{const t=p(),i=h(),s=b(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return N({id:"mobile-compose",open:!0}),e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:C(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(S,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},q=()=>{const t=p(),i=h(),s=b(),a=w(),{isError:l,error:o,refetch:d}=f({...m(),staleTime:1/0});if(k({bindings:[{key:"Escape",handler:s,preventDefault:!0}]}),!a)return e.jsx(O,{});const c=e.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h2",{className:"text-lg font-semibold truncate",children:C(t)})}),e.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:e.jsx(E,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{q as F};
1
+ import{r as n,c as f,d as m,G as N,j as e,bp as w,X as E}from"./index-kmRGKW5t.js";import{E as u}from"./ErrorState-BOSB6fJZ.js";import{D as r,C as x,u as k}from"./index-BKk4k9x8.js";import{c as p,d as h,e as b}from"./useMessageBodyContent-DFl-GIiU.js";import{C as S}from"./confirm-dialog-D4VgQO-4.js";const C=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},O=()=>{const t=p(),i=h(),s=b(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return N({id:"mobile-compose",open:!0}),e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:C(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(S,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},q=()=>{const t=p(),i=h(),s=b(),a=w(),{isError:l,error:o,refetch:d}=f({...m(),staleTime:1/0});if(k({bindings:[{key:"Escape",handler:s,preventDefault:!0}]}),!a)return e.jsx(O,{});const c=e.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h2",{className:"text-lg font-semibold truncate",children:C(t)})}),e.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:e.jsx(E,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{q as F};
@@ -1,4 +1,4 @@
1
- import{as as $s,d5 as _r,r as c,e as se,j as s,aB as yt,t as A,_ as Ke,$ as Ls,L as Zn,a0 as Ur,g as we,d6 as Br,d7 as ea,d8 as ta,d9 as Gt,a7 as Kr,f as K,X as He,a3 as kt,W as qe,ar as Hr,da as sa,aM as qr,Y as Qr,b7 as Gr,d4 as Wt,db as na,Z as et,dc as Wr,dd as Vr,de as Yr,df as aa,bI as Ps,dg as Xr,br as Jr,dh as Zr,di as eo,dj as ra,aI as to,dk as so,B as oa,dl as no,dm as ao,dn as ro,dp as oo,dq as io,w as lo,c as ee,d as tt,K as jt,dr as co,ds as uo,dt as Vt,h as de,at as be,i as me,E as Re,F as Ee,Q as wt,cG as Me,du as Yt,dv as ht,bg as fo,dw as Ct,dx as Ae,dy as Nt,dz as St,dA as Tt,dB as mo,dC as po,dD as nn,dE as ho,s as ia,dF as go,dG as xo,dH as bo,b4 as vo,cq as yo,G as Xt,cX as la,cY as ko,dI as jo,bp as Ds,bs as ca,bm as da,bt as ua,bu as fa,bv as wo,aZ as ma,a_ as pa,cL as Co,dJ as No,ab as ha,cK as So,dK as gt,dL as To,dM as Io,bd as ga,dN as Ro,dO as xa,dP as Eo,d1 as Mo,H as ba,bQ as Fs,dQ as Ao,cN as st,dR as an,dS as va,bS as $o,dT as fs,dU as Lo,bR as Po,S as Do,q as Fo,ah as ya,J as Oo,dV as zo,dW as _o,dX as Uo,d0 as rn,bC as Bo,dY as Ko,dZ as Ho,av as qo,cP as Qo,c_ as Go,d_ as Wo,ai as Vo,c$ as Yo,d$ as Xo,e0 as Jo,e1 as Zo,e2 as ei,C as It,e3 as ti,e4 as si,e5 as on,e6 as ni,e7 as ai,e8 as ri,e9 as oi,v as ka,d3 as ii,ea as Os,eb as li,ec as ci,cr as di,co as ui,ed as fi,bT as mi,ee as ja,cs as pi}from"./index-AluQ2uio.js";import{u as hi,L as gi,a as xi}from"./roving-focus-Bs_5thJV.js";import{j as bi,S as wa,f as vi,a as yi,t as dt,c as ki,k as ji,l as wi,m as Ci,u as Ni}from"./search-token-index-C8iSg33h.js";import{K as Si}from"./kbd-Cor2fg-7.js";import{c as Ca,P as Ti,E as Ii}from"./popover-menu-DzwWLLQ4.js";import{M as Na}from"./mail-D_lRkr65.js";import{A as xt}from"./avatar-DBlMCWUW.js";import{M as Ri,a as Ei,b as Sa,c as Mi,s as Ta,d as Ia,e as Ai,f as $i,S as ln,g as Ra,u as Ea,p as Li,r as Pi}from"./useSearchTokenContext-Bs8lmzQX.js";import{C as Di,D as Xe,u as Fi}from"./index-CPrSlVG5.js";import{E as Ma}from"./EmptyState-B1LI7Ct9.js";import{E as Be}from"./ErrorState-CwGAuFwH.js";import{f as Oi,U as zi,s as _i}from"./attachment-file-CxzNjt2q.js";import{D as Ui}from"./download-CsGfgWQ9.js";import{g as Bi}from"./useMessageBodyContent-BMgLWHlL.js";import{C as Ki}from"./calendar-event-chip-6sB4-0_V.js";import{c as Hi}from"./calendar-color-BNsiepMN.js";import{M as qi,R as Qi}from"./attendee-row-CdxInQRM.js";import{C as Gi}from"./calendar-clash-strip--sv3hlnj.js";import{C as Aa}from"./clock-Cy9JYedf.js";import{M as Wi,G as Vi}from"./map-pin-peX9fCRU.js";import{B as Yi}from"./bell-off-CbRcvybP.js";import{S as Xi,C as $a}from"./shield-check-cW3ciHmN.js";import{u as La}from"./useDebouncedValue-znvk1V0z.js";import{h as cn,u as Ji,a as Zi,i as el,n as tl,o as sl,j as nl,k as al,S as rl}from"./useFilters-Cs_M1iQB.js";import{u as zs}from"./useQueries-D3OwaAlj.js";import{C as Ft}from"./confirm-dialog-Deiy3Ntg.js";import{u as ol,i as il}from"./useLayoutTier-DYvBoPy3.js";import{r as ll,a as cl}from"./search-scope-B5-OK3Cq.js";import{M as dl}from"./menu-Dt9m0StI.js";function bt(e){if(ul())e.focus({preventScroll:!0});else{let t=fl(e);e.focus(),ml(t)}}let Ot=null;function ul(){if(Ot==null){Ot=!1;try{document.createElement("div").focus({get preventScroll(){return Ot=!0,!0}})}catch{}}return Ot}function fl(e){let t=e.parentNode,n=[],a=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==a;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return a instanceof HTMLElement&&n.push({element:a,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft}),n}function ml(e){for(let{element:t,scrollTop:n,scrollLeft:a}of e)t.scrollTop=n,t.scrollLeft=a}const Te=e=>e?.ownerDocument??document,Ie=e=>e&&"window"in e&&e.window===e?e:Te(e).defaultView||window;function pl(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function hl(e){return pl(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let gl=!1;function Pa(){return gl}function ge(e,t){if(!Pa())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:hl(n)?n=n.host:n=n.parentNode}return!1}function te(e){if(Pa()&&e.target instanceof Element&&e.target.shadowRoot){if("composedPath"in e)return e.composedPath()[0]??null;if("composedPath"in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}const xl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function bl(e){const t=Ie(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:a}=e.style,r=n!=="none"&&a!=="hidden"&&a!=="collapse";if(r){const{getComputedStyle:o}=Ie(e);let{display:i,visibility:l}=o(e);r=i!=="none"&&l!=="hidden"&&l!=="collapse"}return r}function vl(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function Da(e,t){return xl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&bl(e)&&vl(e,t)&&(!e.parentElement||Da(e.parentElement,e))}const Fa=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],yl=Fa.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Fa.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function kl(e,t){return e.matches(yl)&&!jl(e)&&(t?.skipVisibilityCheck||Da(e))}function jl(e){let t=e;for(;t!=null;){if(t instanceof Ie(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const _s=typeof document<"u"?$s.useLayoutEffect:()=>{};function wl(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Cl(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Nl(e){for(;e&&!kl(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Ie(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=g=>{(te(g)===n||a)&&g.stopImmediatePropagation()},o=g=>{(te(g)===n||a)&&(g.stopImmediatePropagation(),!e&&!a&&(a=!0,bt(n),u()))},i=g=>{(te(g)===e||a)&&g.stopImmediatePropagation()},l=g=>{(te(g)===e||a)&&(g.stopImmediatePropagation(),a||(a=!0,bt(n),u()))};t.addEventListener("blur",r,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",l,!0),t.addEventListener("focus",i,!0);let u=()=>{cancelAnimationFrame(x),t.removeEventListener("blur",r,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",l,!0),t.removeEventListener("focus",i,!0),a=!1},x=requestAnimationFrame(u);return u}function Jt(e){if(typeof window>"u"||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function Us(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function $e(e){let t=null;return()=>(t==null&&(t=e()),t)}const Kt=$e(function(){return Us(/^Mac/i)}),Sl=$e(function(){return Us(/^iPhone/i)}),Oa=$e(function(){return Us(/^iPad/i)||Kt()&&navigator.maxTouchPoints>1}),za=$e(function(){return Sl()||Oa()}),Tl=$e(function(){return Jt(/AppleWebKit/i)&&!Il()}),Il=$e(function(){return Jt(/Chrome/i)}),_a=$e(function(){return Jt(/Android/i)}),Rl=$e(function(){return Jt(/Firefox/i)});function El(e){return e.pointerType===""&&e.isTrusted?!0:_a()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ml(e){return!_a()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function vt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;Rl()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Kt()?a=!0:r=!0);let l=Tl()&&Kt()&&!Oa()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}):new MouseEvent("click",{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});vt.isOpening=n,bt(e),e.dispatchEvent(l),vt.isOpening=!1}vt.isOpening=!1;let Se=new Map,js=new Set;function dn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=te(a);if(!e(a)||!r)return;let o=Se.get(r);o||(o=new Set,Se.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(a.propertyName)},n=a=>{let r=te(a);if(!e(a)||!r)return;let o=Se.get(r);if(o&&(o.delete(a.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",n),Se.delete(r)),Se.size===0)){for(let i of js)i();js.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?dn():document.addEventListener("DOMContentLoaded",dn));function Al(){for(const[e]of Se)"isConnected"in e&&!e.isConnected&&Se.delete(e)}function $l(e){requestAnimationFrame(()=>{Al(),Se.size===0?e():js.add(e)})}function Ua(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let ws=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{ws.delete(e)});function Ll(e,t){if(e===t)return e;let n=ws.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=ws.get(t);return a?(a.forEach(r=>r.current=e),e):t}function Pl(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=un(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():un(e[o],null)})}}}function un(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rt(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let a=e[n];for(let r in a){let o=t[r],i=a[r];typeof o=="function"&&typeof i=="function"&&r[0]==="o"&&r[1]==="n"&&r.charCodeAt(2)>=65&&r.charCodeAt(2)<=90?t[r]=Ua(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=_r(o,i):r==="id"&&o&&i?t.id=Ll(o,i):r==="ref"&&o&&i?t.ref=Pl(o,i):t[r]=i!==void 0?i:o}}return t}function Dl(e,t){_s(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const Fl=$s.useInsertionEffect??_s;function ms(e){const t=c.useRef(null);return Fl(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let Je="default",Cs="",Bt=new WeakMap;function Ol(e){if(za()){if(Je==="default"){const t=Te(e);Cs=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Je="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";Bt.set(e,e.style[t]),e.style[t]="none"}}function fn(e){if(za()){if(Je!=="disabled")return;Je="restoring",setTimeout(()=>{$l(()=>{if(Je==="restoring"){const t=Te(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=Cs||""),Cs="",Je="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Bt.has(e)){let t=Bt.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[n]==="none"&&(e.style[n]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),Bt.delete(e)}}function mn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let ps=new WeakMap;function zl(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return mn(t);if(ps.has(t))return ps.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Ie(n).HTMLMetaElement&&(n.nonce||n.content)||mn(t)||void 0;return a!==void 0&&ps.set(t,a),a}const Ba=$s.createContext({register:()=>{}});Ba.displayName="PressResponderContext";function Ka(){let e=c.useRef(new Map),t=c.useCallback((r,o,i,l)=>{let u=l?.once?(...x)=>{e.current.delete(i),i(...x)}:i;e.current.set(i,{type:o,eventTarget:r,fn:u,options:l}),r.addEventListener(o,u,l)},[]),n=c.useCallback((r,o,i,l)=>{let u=e.current.get(i)?.fn||i;r.removeEventListener(o,u,l),e.current.delete(i)},[]),a=c.useCallback(()=>{e.current.forEach((r,o)=>{n(r.eventTarget,r.type,o,r.options)})},[n]);return c.useEffect(()=>a,[a]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:a}}function _l(e){let t=c.useContext(Ba);if(t){let{register:n,ref:a,...r}=t;e=Rt(r,e),n()}return Dl(t,e.ref),e}class zt{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,u=0,x,g=null;a.clientX!=null&&a.clientY!=null&&(x=a.clientX,g=a.clientY),i&&(x!=null&&g!=null?(l=x-i.left,u=g-i.top):(l=i.width/2,u=i.height/2)),this.type=t,this.pointerType=n,this.target=a.currentTarget,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.x=l,this.y=u,this.key=a.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const pn=Symbol("linkClicked"),hn="react-aria-pressable-style",gn="data-react-aria-pressable";function Ul(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:u,preventFocusOnPress:x,shouldCancelOnPointerExit:g,allowTextSelectionOnPress:v,ref:m,...b}=_l(e),[f,h]=c.useState(!1),d=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:p,removeAllGlobalListeners:j}=Ka(),y=c.useCallback((w,M)=>{let F=d.current;if(l||F.didFirePressStart)return!1;let C=!0;if(F.isTriggeringEvent=!0,a){let L=new zt("pressstart",M,w);a(L),C=L.shouldStopPropagation}return n&&n(!0),F.isTriggeringEvent=!1,F.didFirePressStart=!0,h(!0),C},[l,a,n]),k=c.useCallback((w,M,F=!0)=>{let C=d.current;if(!C.didFirePressStart)return!1;C.didFirePressStart=!1,C.isTriggeringEvent=!0;let L=!0;if(r){let N=new zt("pressend",M,w);r(N),L=N.shouldStopPropagation}if(n&&n(!1),h(!1),t&&F&&!l){let N=new zt("press",M,w);t(N),L&&=N.shouldStopPropagation}return C.isTriggeringEvent=!1,L},[l,r,n,t]),S=ms(k),R=c.useCallback((w,M)=>{let F=d.current;if(l)return!1;if(o){F.isTriggeringEvent=!0;let C=new zt("pressup",M,w);return o(C),F.isTriggeringEvent=!1,C.shouldStopPropagation}return!0},[l,o]),E=ms(R),D=c.useCallback(w=>{let M=d.current;if(M.isPressed&&M.target){M.didFirePressStart&&M.pointerType!=null&&k(Ue(M.target,w),M.pointerType,!1),M.isPressed=!1,M.isOverTarget=!1,M.activePointerId=null,M.pointerType=null,j(),v||fn(M.target);for(let F of M.disposables)F();M.disposables=[]}},[v,j,k]),I=ms(D);c.useEffect(()=>{l&&d.current.isPressed&&I({currentTarget:d.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let P=c.useCallback(w=>{g&&D(w)},[g,D]),$=c.useCallback(w=>{l||i?.(w)},[l,i]),B=c.useCallback((w,M)=>{if(!l&&i){let F=new MouseEvent("click",w);Cl(F,M),i(wl(F))}},[l,i]),_=c.useMemo(()=>{let w=d.current,M={onKeyDown(C){if(hs(C.nativeEvent,C.currentTarget)&&ge(C.currentTarget,te(C))){xn(te(C),C.key)&&C.preventDefault();let L=!0;!w.isPressed&&!C.repeat&&(w.target=C.currentTarget,w.isPressed=!0,w.pointerType="keyboard",L=y(C,"keyboard"));let N=C.currentTarget,O=U=>{hs(U,N)&&!U.repeat&&ge(N,te(U))&&w.target&&E(Ue(w.target,U),"keyboard")};p(Te(C.currentTarget),"keyup",Ua(O,F),!0),L&&C.stopPropagation(),C.metaKey&&Kt()&&w.metaKeyEvents?.set(C.key,C.nativeEvent)}else C.key==="Meta"&&(w.metaKeyEvents=new Map)},onClick(C){if(!(C&&!ge(C.currentTarget,te(C)))&&C&&C.button===0&&!w.isTriggeringEvent&&!vt.isOpening){let L=!0;if(l&&C.preventDefault(),!w.ignoreEmulatedMouseEvents&&!w.isPressed&&(w.pointerType==="virtual"||El(C.nativeEvent))){let N=y(C,"virtual"),O=E(C,"virtual"),U=S(C,"virtual");$(C),L=N&&O&&U}else if(w.isPressed&&w.pointerType!=="keyboard"){let N=w.pointerType||C.nativeEvent.pointerType||"virtual",O=E(Ue(C.currentTarget,C),N),U=S(Ue(C.currentTarget,C),N,!0);L=O&&U,w.isOverTarget=!1,$(C),I(C)}w.ignoreEmulatedMouseEvents=!1,L&&C.stopPropagation()}}},F=C=>{if(w.isPressed&&w.target&&hs(C,w.target)){xn(te(C),C.key)&&C.preventDefault();let L=te(C),N=ge(w.target,L);S(Ue(w.target,C),"keyboard",N),N&&B(C,w.target),j(),C.key!=="Enter"&&Bs(w.target)&&ge(w.target,L)&&!C[pn]&&(C[pn]=!0,vt(w.target,C,!1)),w.isPressed=!1,w.metaKeyEvents?.delete(C.key)}else if(C.key==="Meta"&&w.metaKeyEvents?.size){let L=w.metaKeyEvents;w.metaKeyEvents=void 0;for(let N of L.values())w.target?.dispatchEvent(new KeyboardEvent("keyup",N))}};if(typeof PointerEvent<"u"){M.onPointerDown=N=>{if(N.button!==0||!ge(N.currentTarget,te(N)))return;if(Ml(N.nativeEvent)){w.pointerType="virtual";return}w.pointerType=N.pointerType;let O=!0;if(!w.isPressed){w.isPressed=!0,w.isOverTarget=!0,w.activePointerId=N.pointerId,w.target=N.currentTarget,v||Ol(w.target),O=y(N,w.pointerType);let U=te(N);"releasePointerCapture"in U&&("hasPointerCapture"in U?U.hasPointerCapture(N.pointerId)&&U.releasePointerCapture(N.pointerId):U.releasePointerCapture(N.pointerId)),p(Te(N.currentTarget),"pointerup",C,!1),p(Te(N.currentTarget),"pointercancel",L,!1)}O&&N.stopPropagation()},M.onMouseDown=N=>{if(ge(N.currentTarget,te(N))&&N.button===0){if(x){let O=Nl(N.target);O&&w.disposables.push(O)}N.stopPropagation()}},M.onPointerUp=N=>{!ge(N.currentTarget,te(N))||w.pointerType==="virtual"||N.button===0&&!w.isPressed&&E(N,w.pointerType||N.pointerType)},M.onPointerEnter=N=>{N.pointerId===w.activePointerId&&w.target&&!w.isOverTarget&&w.pointerType!=null&&(w.isOverTarget=!0,y(Ue(w.target,N),w.pointerType))},M.onPointerLeave=N=>{N.pointerId===w.activePointerId&&w.target&&w.isOverTarget&&w.pointerType!=null&&(w.isOverTarget=!1,S(Ue(w.target,N),w.pointerType,!1),P(N))};let C=N=>{if(N.pointerId===w.activePointerId&&w.isPressed&&N.button===0&&w.target){if(ge(w.target,te(N))&&w.pointerType!=null){let O=!1,U=setTimeout(()=>{w.isPressed&&w.target instanceof HTMLElement&&(O?I(N):(bt(w.target),w.target.click()))},80);p(N.currentTarget,"click",()=>O=!0,!0),w.disposables.push(()=>clearTimeout(U))}else I(N);w.isOverTarget=!1}},L=N=>{I(N)};M.onDragStart=N=>{ge(N.currentTarget,te(N))&&I(N)}}return M},[p,l,x,j,v,P,y,$,B]);return c.useEffect(()=>{if(!m)return;const w=Te(m.current);if(!w||!w.head||w.getElementById(hn))return;const M=w.createElement("style");M.id=hn;let F=zl(w);F&&(M.nonce=F),M.textContent=`
1
+ import{as as $s,d5 as _r,r as c,e as se,j as s,aB as yt,t as A,_ as Ke,$ as Ls,L as Zn,a0 as Ur,g as we,d6 as Br,d7 as ea,d8 as ta,d9 as Gt,a7 as Kr,f as K,X as He,a3 as kt,W as qe,ar as Hr,da as sa,aM as qr,Y as Qr,b7 as Gr,d4 as Wt,db as na,Z as et,dc as Wr,dd as Vr,de as Yr,df as aa,bI as Ps,dg as Xr,br as Jr,dh as Zr,di as eo,dj as ra,aI as to,dk as so,B as oa,dl as no,dm as ao,dn as ro,dp as oo,dq as io,w as lo,c as ee,d as tt,K as jt,dr as co,ds as uo,dt as Vt,h as de,at as be,i as me,E as Re,F as Ee,Q as wt,cG as Me,du as Yt,dv as ht,bg as fo,dw as Ct,dx as Ae,dy as Nt,dz as St,dA as Tt,dB as mo,dC as po,dD as nn,dE as ho,s as ia,dF as go,dG as xo,dH as bo,b4 as vo,cq as yo,G as Xt,cX as la,cY as ko,dI as jo,bp as Ds,bs as ca,bm as da,bt as ua,bu as fa,bv as wo,aZ as ma,a_ as pa,cL as Co,dJ as No,ab as ha,cK as So,dK as gt,dL as To,dM as Io,bd as ga,dN as Ro,dO as xa,dP as Eo,d1 as Mo,H as ba,bQ as Fs,dQ as Ao,cN as st,dR as an,dS as va,bS as $o,dT as fs,dU as Lo,bR as Po,S as Do,q as Fo,ah as ya,J as Oo,dV as zo,dW as _o,dX as Uo,d0 as rn,bC as Bo,dY as Ko,dZ as Ho,av as qo,cP as Qo,c_ as Go,d_ as Wo,ai as Vo,c$ as Yo,d$ as Xo,e0 as Jo,e1 as Zo,e2 as ei,C as It,e3 as ti,e4 as si,e5 as on,e6 as ni,e7 as ai,e8 as ri,e9 as oi,v as ka,d3 as ii,ea as Os,eb as li,ec as ci,cr as di,co as ui,ed as fi,bT as mi,ee as ja,cs as pi}from"./index-kmRGKW5t.js";import{u as hi,L as gi,a as xi}from"./roving-focus-DzkqN4Kq.js";import{j as bi,S as wa,f as vi,a as yi,t as dt,c as ki,k as ji,l as wi,m as Ci,u as Ni}from"./search-token-index-By1Eq3rT.js";import{K as Si}from"./kbd-DblB9pwC.js";import{c as Ca,P as Ti,E as Ii}from"./popover-menu-oxXoKkbW.js";import{M as Na}from"./mail-But4pTpi.js";import{A as xt}from"./avatar--8IosDG7.js";import{M as Ri,a as Ei,b as Sa,c as Mi,s as Ta,d as Ia,e as Ai,f as $i,S as ln,g as Ra,u as Ea,p as Li,r as Pi}from"./useSearchTokenContext-D3LFteLt.js";import{C as Di,D as Xe,u as Fi}from"./index-BKk4k9x8.js";import{E as Ma}from"./EmptyState-CgjgdoLx.js";import{E as Be}from"./ErrorState-BOSB6fJZ.js";import{f as Oi,U as zi,s as _i}from"./attachment-file-DPtpbmUM.js";import{D as Ui}from"./download-B3vz4ril.js";import{g as Bi}from"./useMessageBodyContent-DFl-GIiU.js";import{C as Ki}from"./calendar-event-chip-ZLzAutzl.js";import{c as Hi}from"./calendar-color-CjzWsjnf.js";import{M as qi,R as Qi}from"./attendee-row-Cx6gSIJ1.js";import{C as Gi}from"./calendar-clash-strip-zBMpTyZa.js";import{C as Aa}from"./clock-B5rVJQyV.js";import{M as Wi,G as Vi}from"./map-pin-BAXNf8Lg.js";import{B as Yi}from"./bell-off-CkZ47Tt3.js";import{S as Xi,C as $a}from"./shield-check-Hl4WRwOA.js";import{u as La}from"./useDebouncedValue-BU0VIWEs.js";import{h as cn,u as Ji,a as Zi,i as el,n as tl,o as sl,j as nl,k as al,S as rl}from"./useFilters-BKQmZ7W9.js";import{u as zs}from"./useQueries-D7JnFr6g.js";import{C as Ft}from"./confirm-dialog-D4VgQO-4.js";import{u as ol,i as il}from"./useLayoutTier-CBPK7Olc.js";import{r as ll,a as cl}from"./search-scope-B5-OK3Cq.js";import{M as dl}from"./menu-DdjlmovV.js";function bt(e){if(ul())e.focus({preventScroll:!0});else{let t=fl(e);e.focus(),ml(t)}}let Ot=null;function ul(){if(Ot==null){Ot=!1;try{document.createElement("div").focus({get preventScroll(){return Ot=!0,!0}})}catch{}}return Ot}function fl(e){let t=e.parentNode,n=[],a=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==a;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return a instanceof HTMLElement&&n.push({element:a,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft}),n}function ml(e){for(let{element:t,scrollTop:n,scrollLeft:a}of e)t.scrollTop=n,t.scrollLeft=a}const Te=e=>e?.ownerDocument??document,Ie=e=>e&&"window"in e&&e.window===e?e:Te(e).defaultView||window;function pl(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function hl(e){return pl(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let gl=!1;function Pa(){return gl}function ge(e,t){if(!Pa())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:hl(n)?n=n.host:n=n.parentNode}return!1}function te(e){if(Pa()&&e.target instanceof Element&&e.target.shadowRoot){if("composedPath"in e)return e.composedPath()[0]??null;if("composedPath"in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}const xl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function bl(e){const t=Ie(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:a}=e.style,r=n!=="none"&&a!=="hidden"&&a!=="collapse";if(r){const{getComputedStyle:o}=Ie(e);let{display:i,visibility:l}=o(e);r=i!=="none"&&l!=="hidden"&&l!=="collapse"}return r}function vl(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function Da(e,t){return xl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&bl(e)&&vl(e,t)&&(!e.parentElement||Da(e.parentElement,e))}const Fa=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],yl=Fa.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Fa.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function kl(e,t){return e.matches(yl)&&!jl(e)&&(t?.skipVisibilityCheck||Da(e))}function jl(e){let t=e;for(;t!=null;){if(t instanceof Ie(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const _s=typeof document<"u"?$s.useLayoutEffect:()=>{};function wl(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Cl(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Nl(e){for(;e&&!kl(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Ie(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=g=>{(te(g)===n||a)&&g.stopImmediatePropagation()},o=g=>{(te(g)===n||a)&&(g.stopImmediatePropagation(),!e&&!a&&(a=!0,bt(n),u()))},i=g=>{(te(g)===e||a)&&g.stopImmediatePropagation()},l=g=>{(te(g)===e||a)&&(g.stopImmediatePropagation(),a||(a=!0,bt(n),u()))};t.addEventListener("blur",r,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",l,!0),t.addEventListener("focus",i,!0);let u=()=>{cancelAnimationFrame(x),t.removeEventListener("blur",r,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",l,!0),t.removeEventListener("focus",i,!0),a=!1},x=requestAnimationFrame(u);return u}function Jt(e){if(typeof window>"u"||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function Us(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function $e(e){let t=null;return()=>(t==null&&(t=e()),t)}const Kt=$e(function(){return Us(/^Mac/i)}),Sl=$e(function(){return Us(/^iPhone/i)}),Oa=$e(function(){return Us(/^iPad/i)||Kt()&&navigator.maxTouchPoints>1}),za=$e(function(){return Sl()||Oa()}),Tl=$e(function(){return Jt(/AppleWebKit/i)&&!Il()}),Il=$e(function(){return Jt(/Chrome/i)}),_a=$e(function(){return Jt(/Android/i)}),Rl=$e(function(){return Jt(/Firefox/i)});function El(e){return e.pointerType===""&&e.isTrusted?!0:_a()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ml(e){return!_a()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function vt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;Rl()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Kt()?a=!0:r=!0);let l=Tl()&&Kt()&&!Oa()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}):new MouseEvent("click",{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});vt.isOpening=n,bt(e),e.dispatchEvent(l),vt.isOpening=!1}vt.isOpening=!1;let Se=new Map,js=new Set;function dn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=te(a);if(!e(a)||!r)return;let o=Se.get(r);o||(o=new Set,Se.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(a.propertyName)},n=a=>{let r=te(a);if(!e(a)||!r)return;let o=Se.get(r);if(o&&(o.delete(a.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",n),Se.delete(r)),Se.size===0)){for(let i of js)i();js.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?dn():document.addEventListener("DOMContentLoaded",dn));function Al(){for(const[e]of Se)"isConnected"in e&&!e.isConnected&&Se.delete(e)}function $l(e){requestAnimationFrame(()=>{Al(),Se.size===0?e():js.add(e)})}function Ua(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let ws=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{ws.delete(e)});function Ll(e,t){if(e===t)return e;let n=ws.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=ws.get(t);return a?(a.forEach(r=>r.current=e),e):t}function Pl(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=un(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():un(e[o],null)})}}}function un(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rt(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let a=e[n];for(let r in a){let o=t[r],i=a[r];typeof o=="function"&&typeof i=="function"&&r[0]==="o"&&r[1]==="n"&&r.charCodeAt(2)>=65&&r.charCodeAt(2)<=90?t[r]=Ua(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=_r(o,i):r==="id"&&o&&i?t.id=Ll(o,i):r==="ref"&&o&&i?t.ref=Pl(o,i):t[r]=i!==void 0?i:o}}return t}function Dl(e,t){_s(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const Fl=$s.useInsertionEffect??_s;function ms(e){const t=c.useRef(null);return Fl(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let Je="default",Cs="",Bt=new WeakMap;function Ol(e){if(za()){if(Je==="default"){const t=Te(e);Cs=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Je="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";Bt.set(e,e.style[t]),e.style[t]="none"}}function fn(e){if(za()){if(Je!=="disabled")return;Je="restoring",setTimeout(()=>{$l(()=>{if(Je==="restoring"){const t=Te(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=Cs||""),Cs="",Je="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Bt.has(e)){let t=Bt.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[n]==="none"&&(e.style[n]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),Bt.delete(e)}}function mn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let ps=new WeakMap;function zl(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return mn(t);if(ps.has(t))return ps.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Ie(n).HTMLMetaElement&&(n.nonce||n.content)||mn(t)||void 0;return a!==void 0&&ps.set(t,a),a}const Ba=$s.createContext({register:()=>{}});Ba.displayName="PressResponderContext";function Ka(){let e=c.useRef(new Map),t=c.useCallback((r,o,i,l)=>{let u=l?.once?(...x)=>{e.current.delete(i),i(...x)}:i;e.current.set(i,{type:o,eventTarget:r,fn:u,options:l}),r.addEventListener(o,u,l)},[]),n=c.useCallback((r,o,i,l)=>{let u=e.current.get(i)?.fn||i;r.removeEventListener(o,u,l),e.current.delete(i)},[]),a=c.useCallback(()=>{e.current.forEach((r,o)=>{n(r.eventTarget,r.type,o,r.options)})},[n]);return c.useEffect(()=>a,[a]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:a}}function _l(e){let t=c.useContext(Ba);if(t){let{register:n,ref:a,...r}=t;e=Rt(r,e),n()}return Dl(t,e.ref),e}class zt{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,u=0,x,g=null;a.clientX!=null&&a.clientY!=null&&(x=a.clientX,g=a.clientY),i&&(x!=null&&g!=null?(l=x-i.left,u=g-i.top):(l=i.width/2,u=i.height/2)),this.type=t,this.pointerType=n,this.target=a.currentTarget,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.x=l,this.y=u,this.key=a.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const pn=Symbol("linkClicked"),hn="react-aria-pressable-style",gn="data-react-aria-pressable";function Ul(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:u,preventFocusOnPress:x,shouldCancelOnPointerExit:g,allowTextSelectionOnPress:v,ref:m,...b}=_l(e),[f,h]=c.useState(!1),d=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:p,removeAllGlobalListeners:j}=Ka(),y=c.useCallback((w,M)=>{let F=d.current;if(l||F.didFirePressStart)return!1;let C=!0;if(F.isTriggeringEvent=!0,a){let L=new zt("pressstart",M,w);a(L),C=L.shouldStopPropagation}return n&&n(!0),F.isTriggeringEvent=!1,F.didFirePressStart=!0,h(!0),C},[l,a,n]),k=c.useCallback((w,M,F=!0)=>{let C=d.current;if(!C.didFirePressStart)return!1;C.didFirePressStart=!1,C.isTriggeringEvent=!0;let L=!0;if(r){let N=new zt("pressend",M,w);r(N),L=N.shouldStopPropagation}if(n&&n(!1),h(!1),t&&F&&!l){let N=new zt("press",M,w);t(N),L&&=N.shouldStopPropagation}return C.isTriggeringEvent=!1,L},[l,r,n,t]),S=ms(k),R=c.useCallback((w,M)=>{let F=d.current;if(l)return!1;if(o){F.isTriggeringEvent=!0;let C=new zt("pressup",M,w);return o(C),F.isTriggeringEvent=!1,C.shouldStopPropagation}return!0},[l,o]),E=ms(R),D=c.useCallback(w=>{let M=d.current;if(M.isPressed&&M.target){M.didFirePressStart&&M.pointerType!=null&&k(Ue(M.target,w),M.pointerType,!1),M.isPressed=!1,M.isOverTarget=!1,M.activePointerId=null,M.pointerType=null,j(),v||fn(M.target);for(let F of M.disposables)F();M.disposables=[]}},[v,j,k]),I=ms(D);c.useEffect(()=>{l&&d.current.isPressed&&I({currentTarget:d.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let P=c.useCallback(w=>{g&&D(w)},[g,D]),$=c.useCallback(w=>{l||i?.(w)},[l,i]),B=c.useCallback((w,M)=>{if(!l&&i){let F=new MouseEvent("click",w);Cl(F,M),i(wl(F))}},[l,i]),_=c.useMemo(()=>{let w=d.current,M={onKeyDown(C){if(hs(C.nativeEvent,C.currentTarget)&&ge(C.currentTarget,te(C))){xn(te(C),C.key)&&C.preventDefault();let L=!0;!w.isPressed&&!C.repeat&&(w.target=C.currentTarget,w.isPressed=!0,w.pointerType="keyboard",L=y(C,"keyboard"));let N=C.currentTarget,O=U=>{hs(U,N)&&!U.repeat&&ge(N,te(U))&&w.target&&E(Ue(w.target,U),"keyboard")};p(Te(C.currentTarget),"keyup",Ua(O,F),!0),L&&C.stopPropagation(),C.metaKey&&Kt()&&w.metaKeyEvents?.set(C.key,C.nativeEvent)}else C.key==="Meta"&&(w.metaKeyEvents=new Map)},onClick(C){if(!(C&&!ge(C.currentTarget,te(C)))&&C&&C.button===0&&!w.isTriggeringEvent&&!vt.isOpening){let L=!0;if(l&&C.preventDefault(),!w.ignoreEmulatedMouseEvents&&!w.isPressed&&(w.pointerType==="virtual"||El(C.nativeEvent))){let N=y(C,"virtual"),O=E(C,"virtual"),U=S(C,"virtual");$(C),L=N&&O&&U}else if(w.isPressed&&w.pointerType!=="keyboard"){let N=w.pointerType||C.nativeEvent.pointerType||"virtual",O=E(Ue(C.currentTarget,C),N),U=S(Ue(C.currentTarget,C),N,!0);L=O&&U,w.isOverTarget=!1,$(C),I(C)}w.ignoreEmulatedMouseEvents=!1,L&&C.stopPropagation()}}},F=C=>{if(w.isPressed&&w.target&&hs(C,w.target)){xn(te(C),C.key)&&C.preventDefault();let L=te(C),N=ge(w.target,L);S(Ue(w.target,C),"keyboard",N),N&&B(C,w.target),j(),C.key!=="Enter"&&Bs(w.target)&&ge(w.target,L)&&!C[pn]&&(C[pn]=!0,vt(w.target,C,!1)),w.isPressed=!1,w.metaKeyEvents?.delete(C.key)}else if(C.key==="Meta"&&w.metaKeyEvents?.size){let L=w.metaKeyEvents;w.metaKeyEvents=void 0;for(let N of L.values())w.target?.dispatchEvent(new KeyboardEvent("keyup",N))}};if(typeof PointerEvent<"u"){M.onPointerDown=N=>{if(N.button!==0||!ge(N.currentTarget,te(N)))return;if(Ml(N.nativeEvent)){w.pointerType="virtual";return}w.pointerType=N.pointerType;let O=!0;if(!w.isPressed){w.isPressed=!0,w.isOverTarget=!0,w.activePointerId=N.pointerId,w.target=N.currentTarget,v||Ol(w.target),O=y(N,w.pointerType);let U=te(N);"releasePointerCapture"in U&&("hasPointerCapture"in U?U.hasPointerCapture(N.pointerId)&&U.releasePointerCapture(N.pointerId):U.releasePointerCapture(N.pointerId)),p(Te(N.currentTarget),"pointerup",C,!1),p(Te(N.currentTarget),"pointercancel",L,!1)}O&&N.stopPropagation()},M.onMouseDown=N=>{if(ge(N.currentTarget,te(N))&&N.button===0){if(x){let O=Nl(N.target);O&&w.disposables.push(O)}N.stopPropagation()}},M.onPointerUp=N=>{!ge(N.currentTarget,te(N))||w.pointerType==="virtual"||N.button===0&&!w.isPressed&&E(N,w.pointerType||N.pointerType)},M.onPointerEnter=N=>{N.pointerId===w.activePointerId&&w.target&&!w.isOverTarget&&w.pointerType!=null&&(w.isOverTarget=!0,y(Ue(w.target,N),w.pointerType))},M.onPointerLeave=N=>{N.pointerId===w.activePointerId&&w.target&&w.isOverTarget&&w.pointerType!=null&&(w.isOverTarget=!1,S(Ue(w.target,N),w.pointerType,!1),P(N))};let C=N=>{if(N.pointerId===w.activePointerId&&w.isPressed&&N.button===0&&w.target){if(ge(w.target,te(N))&&w.pointerType!=null){let O=!1,U=setTimeout(()=>{w.isPressed&&w.target instanceof HTMLElement&&(O?I(N):(bt(w.target),w.target.click()))},80);p(N.currentTarget,"click",()=>O=!0,!0),w.disposables.push(()=>clearTimeout(U))}else I(N);w.isOverTarget=!1}},L=N=>{I(N)};M.onDragStart=N=>{ge(N.currentTarget,te(N))&&I(N)}}return M},[p,l,x,j,v,P,y,$,B]);return c.useEffect(()=>{if(!m)return;const w=Te(m.current);if(!w||!w.head||w.getElementById(hn))return;const M=w.createElement("style");M.id=hn;let F=zl(w);F&&(M.nonce=F),M.textContent=`
2
2
  @layer {
3
3
  [${gn}] {
4
4
  touch-action: pan-x pan-y pinch-zoom;
@@ -1 +1 @@
1
- import{e as L,r as v,j as e,W,Y as $,Z as Q,_ as A,$ as I,t as k,a0 as H,a1 as V,a2 as Y,a3 as G,a4 as Z,a5 as J,a6 as X,a7 as ee,I as se,a8 as te,a9 as ae,aa as O,ab as ne,h as re,C as ie,ac as le,K as oe,c as ce,ad as ue,ae as de,af as R,ag as xe,ah as y,ai as fe,D as me,v as he}from"./index-AluQ2uio.js";import{u as ge}from"./roving-focus-Bs_5thJV.js";import{B as pe}from"./bell-off-CbRcvybP.js";import{u as be}from"./useQueries-D3OwaAlj.js";import{i as je}from"./outbox-status-BlKn6P0x.js";import{B as ye}from"./bug-ihs_XaTI.js";const ve=L("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);const Ne=L("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const ke=L("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),Ce={Mail:"mail sync off"},Oe="button:not([disabled]), a[href]",w="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function Se({active:s,dimmed:a,indent:n}){return k("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",w,n&&"pl-7",s?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",a&&"opacity-55")}function we({icon:s,label:a,count:n,active:r}){return e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:k("shrink-0",r?"text-accent-2":"text-fg-subtle"),children:s}),e.jsx("span",{className:"flex-1 truncate",children:a}),n!=null&&n>0&&e.jsx("span",{className:k("text-2xs tabular-nums",r?"text-accent-2":"text-fg-subtle"),children:n})]})}function C({icon:s,label:a,count:n,active:r,dimmed:c,indent:l,navId:d,linkComponent:m,ariaLabel:x,title:g,onClick:p}){const N=Se({active:r,dimmed:c,indent:l}),j=e.jsx(we,{icon:s,label:a,count:n,active:r});return d&&m?m({navId:d,className:N,ariaLabel:x??a,title:g,onClick:p,children:j}):e.jsx("button",{type:"button",onClick:p,className:N,"aria-label":x,title:g,children:j})}const M={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function ze(s){switch(s){case"inbox":return e.jsx(se,{className:"size-4"});case"flagged":return e.jsx(Q,{className:"size-4"});case"drafts":return e.jsx(ee,{className:"size-4"});case"sent":return e.jsx(V,{className:"size-4"});case"archive":return e.jsx(X,{className:"size-4"});case"all":return e.jsx(J,{className:"size-4"});case"junk":return e.jsx(Z,{className:"size-4"});case"trash":return e.jsx(G,{className:"size-4"})}}const E=s=>s.role!=null,z=8,P="remit.nav.folders.open.",_="remit.nav.account.open.";function D(s,a,n){if(typeof localStorage>"u")return n;const r=localStorage.getItem(s+a);return r===null?n:r!=="0"}function B(s,a,n){typeof localStorage>"u"||localStorage.setItem(s+a,n?"1":"0")}function Re({account:s,selectedNavId:a,onSelectNav:n,linkComponent:r}){const[c,l]=v.useState(()=>D(_,s.id,!0)),[d,m]=v.useState(()=>D(P,s.id,!0)),[x,g]=v.useState(!1),p=()=>{l(t=>{const o=!t;return B(_,s.id,o),o})},N=()=>{m(t=>{const o=!t;return B(P,s.id,o),o})},j=s.mailboxes.filter(E).sort((t,o)=>M[t.role]-M[o.role]),h=s.mailboxes.filter(t=>!E(t)),S=x||h.length<=z?h:h.slice(0,z),i=h.length-S.length,u=s.status??"ready",f=s.syncedServices!==void 0&&!s.syncedServices.includes("Mail"),b=u==="ready"&&j.length===0&&h.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:p,"aria-expanded":c,className:k("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",w,s.muted&&"opacity-55"),children:[c?e.jsx(A,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(I,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:s.label}),s.muted&&e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]}),f&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:Ce.Mail})]})]}),c&&e.jsxs(e.Fragment,{children:[u==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),u==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(H,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),s.onRetry&&e.jsx("button",{type:"button",onClick:s.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),b&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),u==="ready"&&e.jsxs(e.Fragment,{children:[j.map(t=>e.jsx(C,{navId:t.id,linkComponent:r,icon:ze(t.role),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),s.outboxPending!==void 0&&e.jsx(C,{navId:"outbox",linkComponent:r,icon:e.jsx(V,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:s.outboxPending>0?s.outboxPending:void 0,active:a==="outbox",dimmed:s.muted,onClick:()=>n?.("outbox")}),h.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:N,"aria-expanded":d,className:k("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",w),children:[d?e.jsx(A,{className:"size-3 shrink-0"}):e.jsx(I,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:h.length})]}),d&&e.jsxs(e.Fragment,{children:[S.map(t=>e.jsx(C,{navId:t.id,linkComponent:r,icon:e.jsx(Y,{className:"size-4"}),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),(i>0||x)&&h.length>z&&e.jsx("button",{type:"button",onClick:()=>g(t=>!t),className:k("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",w),children:x?"Show less":`Show all (${h.length})`})]})]})]})]})]})}function Le({accounts:s,selectedNavId:a,briefUnseen:n,onSelectNav:r,variant:c="desktop",linkComponent:l,calendarNav:d="hidden"}){const m=v.useRef(null);ge({containerRef:m,itemSelector:Oe});const x=c==="drawer",g=e.jsxs("nav",{ref:x?m:void 0,className:x?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(C,{navId:"brief",linkComponent:l,icon:e.jsx(W,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:n,active:a==="brief",onClick:()=>r?.("brief")}),d==="shown"&&e.jsx(C,{navId:"calendar",linkComponent:l,icon:e.jsx($,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:a==="calendar",onClick:()=>r?.("calendar")}),e.jsx(C,{navId:"flagged",linkComponent:l,icon:e.jsx(Q,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:a==="flagged",onClick:()=>r?.("flagged")}),s.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):s.map(p=>e.jsx(Re,{account:p,selectedNavId:a,onSelectNav:r,linkComponent:l},p.id))]});return x?g:e.jsx("aside",{ref:m,className:"flex h-full w-full flex-col bg-surface-sunken",children:g})}function Fe(){const{pathname:s}=te(),a=ae({from:"/mail/$mailboxId",shouldThrow:!1});return O(s,"/settings")?"settings":O(s,"/calendar")?"calendar":O(s,"/mail/outbox")?"outbox":O(s,"/mail/flagged")?"flagged":O(s,"/mail/brief")?"brief":a?.mailboxId??""}const Ae=({children:s})=>{const{Account:a}=ne();return e.jsx(a,{children:s})},T=s=>/^\d/.test(s),Ie=(s,a)=>{const n=T(s),r=T(a);return n&&!r?-1:!n&&r?1:s.localeCompare(a,void 0,{sensitivity:"base",numeric:!0})};function Me(s,a,n){const r=[],c=[];for(const l of s)a.has(l.mailboxId)?r.push(l):c.push(l);return c.sort((l,d)=>Ie(R(l,void 0,n),R(d,void 0,n))),{system:r,labels:c}}function Ee(s,a,n){const r=xe(a)&&s.unseenCount>0;return{id:s.mailboxId,name:R(s,a,n),unseen:r?s.unseenCount:void 0,role:a,fullPath:s.fullPath}}function q({accounts:s,onMailboxSelect:a,variant:n="desktop"}){const r=re(),c=Fe(),{onSearchChange:l}=ie(),{t:d}=le("mail",{useSuspense:!1}),m=v.useCallback((i,u)=>d(i,{defaultValue:u}),[d]),x=be({queries:s.map(i=>({...oe({path:{accountId:i.accountId}}),staleTime:1/0}))}),{data:g}=ce(ue()),p=v.useMemo(()=>(g?.items??[]).filter(i=>je(i.status)).length,[g?.items]),N=v.useMemo(()=>s.map((i,u)=>{const f=x[u],b=f?.data?.items??[],t=de(i.folderAppointments),{system:o,labels:K}=Me(b,t,m),U=f?.isError?"error":f?.isLoading?"loading":"ready";return{id:i.accountId,label:i.email,email:i.email,muted:!!i.muted,outboxPending:p,status:U,onRetry:()=>f?.refetch(),mailboxes:[...o,...K].map(F=>Ee(F,t.get(F.mailboxId),m))}}),[s,x,p,m]),j=i=>{r.invalidateQueries({queryKey:fe({path:{mailboxId:i},query:{order:"desc"}})})},h=({navId:i,className:u,ariaLabel:f,title:b,children:t,onClick:o})=>i==="brief"?e.jsx(y,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>o?.(),className:u,"aria-label":f,title:b,children:t}):i==="calendar"?e.jsx(y,{to:"/calendar",onClick:()=>o?.(),className:u,"aria-label":f,title:b,children:t}):i==="outbox"?e.jsx(y,{to:"/mail/outbox",search:{q:void 0},onClick:()=>o?.(),className:u,"aria-label":f,title:b,children:t}):i==="flagged"?e.jsx(y,{to:"/mail/flagged",search:{q:void 0},onClick:()=>o?.(),className:u,"aria-label":f,title:b,children:t}):i==="settings"?e.jsx(y,{to:"/settings/accounts",onClick:()=>o?.(),className:u,"aria-label":f,title:b,children:t}):e.jsx(y,{to:"/mail/$mailboxId",params:{mailboxId:i},search:{q:void 0},onClick:()=>{j(i),o?.()},className:u,"aria-label":f,title:b,children:t}),S=()=>{l(""),a?.()};return e.jsx(Le,{accounts:N,selectedNavId:c,onSelectNav:S,linkComponent:h,calendarNav:"shown",variant:n})}function Pe(){return e.jsxs("button",{type:"button",onClick:me,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(ye,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function Ve({accounts:s,onMailboxSelect:a}){return he()?.showNavPane??!0?e.jsx(q,{accounts:s}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(q,{accounts:s,onMailboxSelect:a,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(y,{to:"/settings/accounts",onClick:a,children:[e.jsx(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(Pe,{}),e.jsx(Ae,{children:({signOut:c})=>e.jsxs("button",{type:"button",onClick:()=>{a?.(),c()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(Ne,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}export{Ae as A,Ne as L,Ve as M,ke as S};
1
+ import{e as L,r as v,j as e,W,Y as $,Z as Q,_ as A,$ as I,t as k,a0 as H,a1 as V,a2 as Y,a3 as G,a4 as Z,a5 as J,a6 as X,a7 as ee,I as se,a8 as te,a9 as ae,aa as O,ab as ne,h as re,C as ie,ac as le,K as oe,c as ce,ad as ue,ae as de,af as R,ag as xe,ah as y,ai as fe,D as me,v as he}from"./index-kmRGKW5t.js";import{u as ge}from"./roving-focus-DzkqN4Kq.js";import{B as pe}from"./bell-off-CkZ47Tt3.js";import{u as be}from"./useQueries-D7JnFr6g.js";import{i as je}from"./outbox-status-BlKn6P0x.js";import{B as ye}from"./bug-N61wRAwn.js";const ve=L("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);const Ne=L("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const ke=L("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),Ce={Mail:"mail sync off"},Oe="button:not([disabled]), a[href]",w="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function Se({active:s,dimmed:a,indent:n}){return k("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",w,n&&"pl-7",s?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",a&&"opacity-55")}function we({icon:s,label:a,count:n,active:r}){return e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:k("shrink-0",r?"text-accent-2":"text-fg-subtle"),children:s}),e.jsx("span",{className:"flex-1 truncate",children:a}),n!=null&&n>0&&e.jsx("span",{className:k("text-2xs tabular-nums",r?"text-accent-2":"text-fg-subtle"),children:n})]})}function C({icon:s,label:a,count:n,active:r,dimmed:c,indent:l,navId:d,linkComponent:m,ariaLabel:x,title:g,onClick:p}){const N=Se({active:r,dimmed:c,indent:l}),j=e.jsx(we,{icon:s,label:a,count:n,active:r});return d&&m?m({navId:d,className:N,ariaLabel:x??a,title:g,onClick:p,children:j}):e.jsx("button",{type:"button",onClick:p,className:N,"aria-label":x,title:g,children:j})}const M={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function ze(s){switch(s){case"inbox":return e.jsx(se,{className:"size-4"});case"flagged":return e.jsx(Q,{className:"size-4"});case"drafts":return e.jsx(ee,{className:"size-4"});case"sent":return e.jsx(V,{className:"size-4"});case"archive":return e.jsx(X,{className:"size-4"});case"all":return e.jsx(J,{className:"size-4"});case"junk":return e.jsx(Z,{className:"size-4"});case"trash":return e.jsx(G,{className:"size-4"})}}const E=s=>s.role!=null,z=8,P="remit.nav.folders.open.",_="remit.nav.account.open.";function D(s,a,n){if(typeof localStorage>"u")return n;const r=localStorage.getItem(s+a);return r===null?n:r!=="0"}function B(s,a,n){typeof localStorage>"u"||localStorage.setItem(s+a,n?"1":"0")}function Re({account:s,selectedNavId:a,onSelectNav:n,linkComponent:r}){const[c,l]=v.useState(()=>D(_,s.id,!0)),[d,m]=v.useState(()=>D(P,s.id,!0)),[x,g]=v.useState(!1),p=()=>{l(t=>{const o=!t;return B(_,s.id,o),o})},N=()=>{m(t=>{const o=!t;return B(P,s.id,o),o})},j=s.mailboxes.filter(E).sort((t,o)=>M[t.role]-M[o.role]),h=s.mailboxes.filter(t=>!E(t)),S=x||h.length<=z?h:h.slice(0,z),i=h.length-S.length,u=s.status??"ready",f=s.syncedServices!==void 0&&!s.syncedServices.includes("Mail"),b=u==="ready"&&j.length===0&&h.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:p,"aria-expanded":c,className:k("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",w,s.muted&&"opacity-55"),children:[c?e.jsx(A,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(I,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:s.label}),s.muted&&e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]}),f&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:Ce.Mail})]})]}),c&&e.jsxs(e.Fragment,{children:[u==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),u==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(H,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),s.onRetry&&e.jsx("button",{type:"button",onClick:s.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),b&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),u==="ready"&&e.jsxs(e.Fragment,{children:[j.map(t=>e.jsx(C,{navId:t.id,linkComponent:r,icon:ze(t.role),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),s.outboxPending!==void 0&&e.jsx(C,{navId:"outbox",linkComponent:r,icon:e.jsx(V,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:s.outboxPending>0?s.outboxPending:void 0,active:a==="outbox",dimmed:s.muted,onClick:()=>n?.("outbox")}),h.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:N,"aria-expanded":d,className:k("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",w),children:[d?e.jsx(A,{className:"size-3 shrink-0"}):e.jsx(I,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:h.length})]}),d&&e.jsxs(e.Fragment,{children:[S.map(t=>e.jsx(C,{navId:t.id,linkComponent:r,icon:e.jsx(Y,{className:"size-4"}),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),(i>0||x)&&h.length>z&&e.jsx("button",{type:"button",onClick:()=>g(t=>!t),className:k("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",w),children:x?"Show less":`Show all (${h.length})`})]})]})]})]})]})}function Le({accounts:s,selectedNavId:a,briefUnseen:n,onSelectNav:r,variant:c="desktop",linkComponent:l,calendarNav:d="hidden"}){const m=v.useRef(null);ge({containerRef:m,itemSelector:Oe});const x=c==="drawer",g=e.jsxs("nav",{ref:x?m:void 0,className:x?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(C,{navId:"brief",linkComponent:l,icon:e.jsx(W,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:n,active:a==="brief",onClick:()=>r?.("brief")}),d==="shown"&&e.jsx(C,{navId:"calendar",linkComponent:l,icon:e.jsx($,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:a==="calendar",onClick:()=>r?.("calendar")}),e.jsx(C,{navId:"flagged",linkComponent:l,icon:e.jsx(Q,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:a==="flagged",onClick:()=>r?.("flagged")}),s.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):s.map(p=>e.jsx(Re,{account:p,selectedNavId:a,onSelectNav:r,linkComponent:l},p.id))]});return x?g:e.jsx("aside",{ref:m,className:"flex h-full w-full flex-col bg-surface-sunken",children:g})}function Fe(){const{pathname:s}=te(),a=ae({from:"/mail/$mailboxId",shouldThrow:!1});return O(s,"/settings")?"settings":O(s,"/calendar")?"calendar":O(s,"/mail/outbox")?"outbox":O(s,"/mail/flagged")?"flagged":O(s,"/mail/brief")?"brief":a?.mailboxId??""}const Ae=({children:s})=>{const{Account:a}=ne();return e.jsx(a,{children:s})},T=s=>/^\d/.test(s),Ie=(s,a)=>{const n=T(s),r=T(a);return n&&!r?-1:!n&&r?1:s.localeCompare(a,void 0,{sensitivity:"base",numeric:!0})};function Me(s,a,n){const r=[],c=[];for(const l of s)a.has(l.mailboxId)?r.push(l):c.push(l);return c.sort((l,d)=>Ie(R(l,void 0,n),R(d,void 0,n))),{system:r,labels:c}}function Ee(s,a,n){const r=xe(a)&&s.unseenCount>0;return{id:s.mailboxId,name:R(s,a,n),unseen:r?s.unseenCount:void 0,role:a,fullPath:s.fullPath}}function q({accounts:s,onMailboxSelect:a,variant:n="desktop"}){const r=re(),c=Fe(),{onSearchChange:l}=ie(),{t:d}=le("mail",{useSuspense:!1}),m=v.useCallback((i,u)=>d(i,{defaultValue:u}),[d]),x=be({queries:s.map(i=>({...oe({path:{accountId:i.accountId}}),staleTime:1/0}))}),{data:g}=ce(ue()),p=v.useMemo(()=>(g?.items??[]).filter(i=>je(i.status)).length,[g?.items]),N=v.useMemo(()=>s.map((i,u)=>{const f=x[u],b=f?.data?.items??[],t=de(i.folderAppointments),{system:o,labels:K}=Me(b,t,m),U=f?.isError?"error":f?.isLoading?"loading":"ready";return{id:i.accountId,label:i.email,email:i.email,muted:!!i.muted,outboxPending:p,status:U,onRetry:()=>f?.refetch(),mailboxes:[...o,...K].map(F=>Ee(F,t.get(F.mailboxId),m))}}),[s,x,p,m]),j=i=>{r.invalidateQueries({queryKey:fe({path:{mailboxId:i},query:{order:"desc"}})})},h=({navId:i,className:u,ariaLabel:f,title:b,children:t,onClick:o})=>i==="brief"?e.jsx(y,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>o?.(),className:u,"aria-label":f,title:b,children:t}):i==="calendar"?e.jsx(y,{to:"/calendar",onClick:()=>o?.(),className:u,"aria-label":f,title:b,children:t}):i==="outbox"?e.jsx(y,{to:"/mail/outbox",search:{q:void 0},onClick:()=>o?.(),className:u,"aria-label":f,title:b,children:t}):i==="flagged"?e.jsx(y,{to:"/mail/flagged",search:{q:void 0},onClick:()=>o?.(),className:u,"aria-label":f,title:b,children:t}):i==="settings"?e.jsx(y,{to:"/settings/accounts",onClick:()=>o?.(),className:u,"aria-label":f,title:b,children:t}):e.jsx(y,{to:"/mail/$mailboxId",params:{mailboxId:i},search:{q:void 0},onClick:()=>{j(i),o?.()},className:u,"aria-label":f,title:b,children:t}),S=()=>{l(""),a?.()};return e.jsx(Le,{accounts:N,selectedNavId:c,onSelectNav:S,linkComponent:h,calendarNav:"shown",variant:n})}function Pe(){return e.jsxs("button",{type:"button",onClick:me,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(ye,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function Ve({accounts:s,onMailboxSelect:a}){return he()?.showNavPane??!0?e.jsx(q,{accounts:s}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(q,{accounts:s,onMailboxSelect:a,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(y,{to:"/settings/accounts",onClick:a,children:[e.jsx(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(Pe,{}),e.jsx(Ae,{children:({signOut:c})=>e.jsxs("button",{type:"button",onClick:()=>{a?.(),c()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(Ne,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}export{Ae as A,Ne as L,Ve as M,ke as S};
@@ -1 +1 @@
1
- import{aa as v,j as s,r as u,al as l,am as p}from"./index-AluQ2uio.js";import{F as x}from"./FullCompose-B13wCysg.js";import{a as m}from"./useMessageBodyContent-BMgLWHlL.js";function S(o,n,r){if(o!==n)return r}function d(o,n){return o===""?"":n}function j({searchInput:o,committedQuery:n,urlQuery:r,pathname:a,listPath:t}){return!v(a,t)||n!==o?!1:n!==r}const c=u.createContext(null),C=({chrome:o,children:n})=>s.jsx(c.Provider,{value:o,children:n});function M({phone:o,list:n,reading:r,intelligence:a,hasThread:t=!1}){const e=u.useContext(c),f=m();if(!e)return s.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:s.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?s.jsx(p,{...i,list:f?s.jsx(x,{}):o,intelligenceOpen:e.intelligenceOpen}):s.jsx(p,{...i,topBar:e.topBar,list:n,reading:r,intelligence:a,intelligenceOpen:e.intelligenceOpen,hasThread:t})}export{C as M,M as a,j as b,d as c,S as s};
1
+ import{aa as v,j as s,r as u,al as l,am as p}from"./index-kmRGKW5t.js";import{F as x}from"./FullCompose-dqzD7C5t.js";import{a as m}from"./useMessageBodyContent-DFl-GIiU.js";function S(o,n,r){if(o!==n)return r}function d(o,n){return o===""?"":n}function j({searchInput:o,committedQuery:n,urlQuery:r,pathname:a,listPath:t}){return!v(a,t)||n!==o?!1:n!==r}const c=u.createContext(null),C=({chrome:o,children:n})=>s.jsx(c.Provider,{value:o,children:n});function M({phone:o,list:n,reading:r,intelligence:a,hasThread:t=!1}){const e=u.useContext(c),f=m();if(!e)return s.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:s.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?s.jsx(p,{...i,list:f?s.jsx(x,{}):o,intelligenceOpen:e.intelligenceOpen}):s.jsx(p,{...i,topBar:e.topBar,list:n,reading:r,intelligence:a,intelligenceOpen:e.intelligenceOpen,hasThread:t})}export{C as M,M as a,j as b,d as c,S as s};
@@ -1 +1 @@
1
- import{j as s,L as le,f as $,a0 as ue,r as g,t as K,aB as de,a3 as fe,d6 as me,c7 as xe,ef as ge,eg as he,eh as pe,C as be,ei as ve,d7 as je}from"./index-AluQ2uio.js";import{j as we,n as Ne}from"./search-token-index-C8iSg33h.js";import{u as ye,L as Q}from"./roving-focus-Bs_5thJV.js";import{a9 as Pe,aa as Re,c as Ce,a as G,ab as Se,o as Ee,ac as Me,ad as ke,ae as Ie,af as Le,ag as Te,ah as ee,ai as ze}from"./MailListHeader-CJubkcXR.js";import{A as Ae}from"./avatar-DBlMCWUW.js";import{M as Oe}from"./mail-D_lRkr65.js";import{R as De}from"./refresh-cw-BcCUuJTk.js";import{M as $e}from"./menu-Dt9m0StI.js";function _e(){return s.jsx("div",{className:"space-y-0",role:"status","aria-busy":"true","aria-label":"Loading messages",children:Array.from({length:8}).map((e,t)=>s.jsxs("div",{className:"animate-pulse border-b border-line px-3 py-2",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("div",{className:"h-4 w-32 rounded bg-surface-sunken"}),s.jsx("div",{className:"h-3 w-16 rounded bg-surface-sunken"})]}),s.jsx("div",{className:"mb-2 h-4 w-48 rounded bg-surface-sunken"}),s.jsx("div",{className:"h-3 w-full rounded bg-surface-sunken"})]},t))})}function Fe({filter:e,scopeLabel:t,searchQuery:n}){const u=n?.trim();return e?s.jsxs(q,{children:[s.jsx("p",{className:"font-medium text-fg",children:Be(e.label,t,u)}),s.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:He[e.reach]}),s.jsx($,{variant:"secondary",size:"sm",className:"mt-4",onClick:e.onClear,children:"Clear filter"})]}):s.jsx(q,{children:s.jsx("p",{className:"text-fg-muted",children:Xe(u,t)})})}const He={"whole-folder":"Every message in this folder was checked.","loaded-pages":"Only the messages loaded so far were checked."};function Xe(e,t){return e?"No messages match your search":t?`No messages in ${t}`:"No messages in this mailbox"}function Be(e,t,n){return n?`No results for “${n}” in ${e}`:t?`No ${e} in ${t}`:`No ${e}`}function q({children:e}){return s.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:s.jsx("div",{className:"flex max-w-sm flex-col items-center justify-center p-8 text-center",children:e})})}function us(){return s.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-fg-muted",role:"status","aria-live":"polite",children:[s.jsx(le,{className:"size-4 animate-spin","aria-hidden":"true"}),s.jsx("span",{children:"Loading more…"})]})}function Ue({message:e="Something went wrong loading this mailbox.",onRetry:t,onReport:n}){return s.jsx("div",{className:"flex h-full flex-1 items-center justify-center p-4",children:s.jsxs("div",{role:"alert",className:"flex max-w-sm flex-col items-center justify-center gap-3 text-center",children:[s.jsx(ue,{className:"size-8 text-danger","aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-danger",children:"Couldn't load messages"}),s.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:e})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[t&&s.jsx($,{variant:"secondary",size:"sm",onClick:t,children:"Retry"}),n&&s.jsx($,{variant:"ghost",size:"sm",onClick:n,children:"Report a problem"})]})]})})}const L=72,V=10,We=L/2,J="__swipeableRowAxisCancel";function Z(e){return e==="leading"?L:e==="trailing"?-L:0}function Ye(e){return e>=L/2?"leading":e<=-L/2?"trailing":"none"}function Ke({thread:e,selectionMode:t,checked:n,active:u,peek:f,onPeek:c,onToggleCheck:p,onLongPress:w,onOpen:b,onAct:v}){const x=g.useRef(null),[j,h]=g.useState(null),{longPressProps:P}=Pe({onLongPress:w,isDisabled:t,accessibilityDescription:"Select message"}),S=i=>{const o=new PointerEvent("pointercancel",{bubbles:!0});o[J]=!0,i.currentTarget.dispatchEvent(o)},r=Re(P,{onPointerDown:i=>{x.current={startX:i.clientX,startY:i.clientY,axis:"none",escaped:!1}},onPointerMove:i=>{if(t)return;const o=x.current;if(!o)return;const m=i.clientX-o.startX,M=i.clientY-o.startY;if(o.axis==="none"&&(Math.abs(M)>V&&Math.abs(M)>Math.abs(m)?o.axis="vertical":Math.abs(m)>V&&Math.abs(m)>Math.abs(M)&&(o.axis="horizontal",i.currentTarget.setPointerCapture(i.pointerId))),o.axis==="none")return;const T=o.axis==="horizontal"?Math.abs(m):Math.abs(M);if(!o.escaped&&T>We&&(o.escaped=!0,S(i)),o.axis!=="horizontal")return;const F=Z(f),H=Math.max(-L,Math.min(L,F+m));h(H)},onPointerUp:i=>{const o=x.current;x.current=null;const m=j;if(h(null),!!o){if(o.axis!=="none"&&!o.escaped&&S(i),o.axis==="horizontal"){m!==null&&c(Ye(m));return}if(o.axis!=="vertical"){if(t){p();return}if(f!=="none"){c("none");return}b()}}},onPointerCancel:i=>{i.nativeEvent[J]||(x.current=null,h(null))}}),d=j??Z(f),y=d>0?"leading":d<0?"trailing":"none",R=K("relative touch-pan-y bg-surface","select-none",Ce({active:n||u})),A={transform:d!==0?`translateX(${d}px)`:void 0,transition:j===null?"transform 150ms ease":"none",minHeight:44},_=!e.isRead,I=i=>i.stopPropagation(),O=t?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:K("inline-flex size-7 shrink-0 items-center justify-center rounded-full border",n?"border-accent bg-accent text-accent-fg":"border-line-strong bg-canvas"),children:n&&s.jsx(de,{className:"size-3.5"})}),s.jsx(G,{thread:e})]}):s.jsxs(s.Fragment,{children:[_&&s.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),s.jsx("span",{role:"checkbox",tabIndex:0,"aria-checked":n,"aria-label":`Select message from ${e.fromName}`,onPointerDown:I,onPointerMove:I,onPointerUp:I,onClick:i=>{i.preventDefault(),i.stopPropagation(),w()},onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),i.stopPropagation(),w())},className:"-m-2 inline-flex size-11 shrink-0 items-center justify-center rounded-full",children:s.jsx(Ae,{name:e.fromName,email:e.fromEmail,size:"sm"})}),s.jsx(G,{thread:e})]});return s.jsxs("div",{className:"relative overflow-hidden",children:[y==="leading"&&s.jsx("button",{type:"button",onClick:()=>v("leading"),"aria-label":e.isRead?"Mark as unread":"Mark as read",className:"absolute inset-y-0 left-0 flex items-center justify-start bg-accent-2 px-6 text-accent-fg",children:e.isRead?s.jsx(Oe,{className:"size-6"}):s.jsx(Se,{className:"size-6"})}),y==="trailing"&&s.jsx("button",{type:"button",onClick:()=>v("trailing"),"aria-label":"Delete message",className:"absolute inset-y-0 right-0 flex items-center justify-end bg-danger px-6 text-canvas",children:s.jsx(fe,{className:"size-6"})}),s.jsx("button",{type:"button",role:t?"checkbox":void 0,"aria-checked":t?n:void 0,"data-message-row":!0,"data-message-id":e.id,...r,className:R,style:A,children:O})]})}function Qe({sections:e,selectedThreadId:t,selectionMode:n,checkedIds:u,initialPeek:f,onToggleCheck:c,onEnterSelection:p,onOpenThread:w,onRefresh:b,refreshing:v,busy:x=!1}){const[j,h]=g.useState(new Set),[P,S]=g.useState(new Map),N=e.flatMap(r=>r.threads).filter(r=>!j.has(r.id)).map(r=>{const d=P.get(r.id);return d===void 0?r:{...r,isRead:d}}),[E,C]=g.useState(f&&f!=="none"&&N[1]?{id:N[1].id,side:f}:null),k=(r,d)=>{if(d==="trailing")h(y=>new Set(y).add(r));else{const y=N.find(R=>R.id===r);S(R=>new Map(R).set(r,!y?.isRead))}C(null)};return s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[v&&s.jsxs("div",{className:"flex items-center justify-center gap-2 border-b border-line py-3 text-fg-muted",children:[s.jsx(De,{className:"size-4 animate-spin"}),s.jsx("span",{className:"text-xs",children:"Checking for new mail…"})]}),s.jsx("div",{className:"divide-y divide-line",children:N.map(r=>s.jsx("div",{className:x?"pointer-events-none opacity-50":void 0,children:s.jsx(Ke,{thread:r,selectionMode:n,checked:u.has(r.id),active:r.id===t,peek:E?.id===r.id?E.side:"none",onPeek:d=>C(d==="none"?null:{id:r.id,side:d}),onToggleCheck:()=>c(r.id),onLongPress:()=>p(r.id),onOpen:()=>w(r.id),onAct:d=>k(r.id,d)})},r.id))}),!n&&!v&&!x&&s.jsx("button",{type:"button",onClick:b,className:"w-full border-t border-line py-2 text-center text-2xs text-fg-subtle transition-colors hover:bg-surface-sunken",children:"Pull to refresh"})]})}const Ge=new Set;function ds({listTitle:e,listMeta:t,sections:n,briefFilters:u,flatList:f,listState:c="ready",searchQuery:p,listFilter:w,listScopeLabel:b,errorMessage:v,onRetry:x,onReportError:j,briefFilter:h,selectedThreadId:P,density:S="comfortable",onSelectThread:N,onOpenNav:E,isDesktop:C,initialTouchState:k,selection:r,keyboard:d,selectionBar:y,paneOverlay:R,listBody:A,hideHeader:_=!1}){const I=S==="compact"?ke:Ie,O=g.useRef(null),i=g.useRef(null),o=me(d);ye({containerRef:O,itemSelector:Q,enabled:!o});const m=o?d.focusedId:void 0,M=o?m??n[0]?.threads[0]?.id:void 0,T=g.useCallback(a=>M===void 0?void 0:a===M?0:-1,[M]);g.useEffect(()=>{if(m===void 0)return;const a=i.current;if(!a)return;const l=a.querySelector(`${Q}[data-message-id="${m}"]`);!l||l===a.ownerDocument.activeElement||l.focus({preventScroll:!1})},[m]),g.useEffect(()=>{if(!o)return;const a=i.current;if(!a)return;const l=a.ownerDocument.activeElement;l!==null&&l!==a.ownerDocument.body||a.focus({preventScroll:!0})},[o]);const F=!C&&!u&&c==="ready",[H,W]=g.useState(!1),ae=k==="peek-trailing"?"trailing":k==="peek-leading"?"leading":void 0,re=()=>{W(!0),setTimeout(()=>W(!1),1400)},D=r?.selectedIds??Ge,z=r?.onToggle,Y=r?.onRowSelect,ie=Ee(D.size,C),X=g.useCallback(a=>{if(z)return{checked:D.has(a),onToggle:l=>{l.preventDefault(),l.stopPropagation(),z(a)}}},[D,z]),B=g.useCallback((a,l)=>Y?.(a,Me(l))?(l.preventDefault(),l.shiftKey&&window.getSelection()?.removeAllRanges(),!0):!1,[Y]),oe=g.useCallback(({thread:a,active:l,onClick:U})=>s.jsx(I,{thread:a,active:l,focused:a.id===m,tabIndex:T(a.id),selection:X(a.id),onClick:ce=>{B(a.id,ce)||U?.()}}),[I,X,B,m,T]);return s.jsxs("section",{ref:a=>{i.current=a,d?.ref(a)},tabIndex:o?-1:void 0,className:"relative flex h-full w-full flex-col bg-surface outline-none",children:[y??(_?null:s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[E&&s.jsx($,{variant:"ghost",size:"sm",icon:s.jsx($e,{className:"size-4"}),onClick:E,"aria-label":"Open folders",className:"-ml-1 shrink-0"}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:e}),t&&s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:t})]})),c==="loading"?s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsx(_e,{})}):c==="empty"?s.jsx(Fe,{filter:w,scopeLabel:b,searchQuery:p}):c==="error"?s.jsx(Ue,{message:v,onRetry:x,onReport:j}):u&&h?s.jsx(Le,{...h,sections:n,selectedThreadId:P,Row:oe,keyboard:d,onSelectThread:N}):A??(F?s.jsx(Qe,{sections:n,selectedThreadId:P,selectionMode:ie,checkedIds:D,initialPeek:ae,onToggleCheck:a=>z?.(a),onEnterSelection:a=>z?.(a),onOpenThread:a=>N?.(a),onRefresh:re,refreshing:H}):s.jsx("div",{ref:O,className:"flex-1 overflow-y-auto",children:n.map(a=>s.jsxs("div",{children:[!f&&a.label&&s.jsxs("div",{className:"sticky top-0 flex h-section-row items-center justify-between border-b border-line bg-surface-sunken px-row-inset",children:[s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:a.label}),s.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:a.threads.length})]}),s.jsx("div",{className:"divide-y divide-line",children:a.threads.map(l=>s.jsx(I,{thread:l,active:l.id===P,focused:l.id===m,tabIndex:T(l.id),selection:X(l.id),onClick:U=>{B(l.id,U)||N?.(l.id)}},l.id))})]},a.id))})),C&&s.jsx(Te,{hints:d?Ne(d.handlers):we}),R]})}var qe=class extends xe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,u=super.createResult(e,t),{isFetching:f,isRefetching:c,isError:p,isRefetchError:w}=u,b=n.fetchMeta?.fetchMore?.direction,v=p&&b==="forward",x=f&&b==="forward",j=p&&b==="backward",h=f&&b==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(t,n.data),hasPreviousPage:ge(t,n.data),isFetchNextPageError:v,isFetchingNextPage:x,isFetchPreviousPageError:j,isFetchingPreviousPage:h,isRefetchError:w&&!v&&!j,isRefetching:c&&!x&&!h}}};function fs(e,t){return pe(e,qe)}const se={dimension:"read",position:"pre",text:"unread"},Ve={dimension:"read",position:"pre",text:"read"},te={dimension:"starred",position:"pre",text:"starred"},ne={dimension:"attachment",position:"post",text:"with an attachment"},Je=[["unread",se],["flagged",te],["attachment",ne]],Ze=e=>{switch(e.type){case"category":return{dimension:"category",position:"pre",text:ee(e.category)??e.value};case"isUnread":return se;case"isRead":return Ve;case"isStarred":return te;case"hasAttachment":return ne;case"from":return{dimension:e.raw,position:"post",text:`from ${e.value}`};case"subject":return{dimension:e.raw,position:"post",text:`about “${e.value}”`};case"before":return{dimension:e.raw,position:"post",text:`sent before ${e.value}`};case"after":return{dimension:e.raw,position:"post",text:`sent on or after ${e.value}`};case"in":return{dimension:e.raw,position:"post",text:`in ${e.value}`};case"account":return{dimension:e.raw,position:"post",text:`in the ${e.value} account`}}},es=(e,t)=>{const n=new Map,u=c=>{n.has(c.dimension)||n.set(c.dimension,c)},f=ee(e.category);f&&u({dimension:"category",position:"pre",text:f});for(const[c,p]of Je)e.attributes.has(c)&&u(p);for(const c of t)u(Ze(c));return[...n.values()]},ss=(e,t)=>{const n=es(e,t);if(n.length===0)return;const u=f=>n.filter(c=>c.position===f).map(c=>c.text);return[...u("pre"),"mail",...u("post")].join(" ")},ms=({chips:e,tokens:t,reach:n,onClear:u})=>{const f=ss(e,t);if(f)return{label:f,reach:n,onClear:u}};function xs({title:e,unreadCount:t,preset:n,selectedCategory:u,activeFilters:f,onSelectCategory:c,onToggleFilter:p,onSelectSource:w,onClearFilters:b,children:v,footer:x,searchResults:j,searchLoading:h,relatedResults:P,relatedLoading:S,onSelectSearchResult:N,searchResultsLabel:E,relatedResultsLabel:C,searchResultsInBody:k,refreshControl:r}){const{searchInput:d}=be(),y=d.trim().length>0,R={categories:n.categories,filters:n.filters,sources:n.sources,selectedCategory:u,activeFilters:f,onSelectCategory:c,onSelectSource:w,onToggleFilter:p,onClear:b};return s.jsx(ve,{hasSheet:!y,children:s.jsx(ze,{title:e,unreadCount:t,footer:x,searchFilter:R,searchResults:j,searchLoading:h,relatedResults:P,relatedLoading:S,onSelectSearchResult:N,searchResultsLabel:E,relatedResultsLabel:C,searchResultsInBody:k,refreshControl:r,children:s.jsx(je,{...R,hideChrome:y,children:v})})})}export{us as M,Ke as S,ds as a,xs as b,ms as l,fs as u};
1
+ import{j as s,L as le,f as $,a0 as ue,r as g,t as K,aB as de,a3 as fe,d6 as me,c7 as xe,ef as ge,eg as he,eh as pe,C as be,ei as ve,d7 as je}from"./index-kmRGKW5t.js";import{j as we,n as Ne}from"./search-token-index-By1Eq3rT.js";import{u as ye,L as Q}from"./roving-focus-DzkqN4Kq.js";import{a9 as Pe,aa as Re,c as Ce,a as G,ab as Se,o as Ee,ac as Me,ad as ke,ae as Ie,af as Le,ag as Te,ah as ee,ai as ze}from"./MailListHeader-DMICasQ-.js";import{A as Ae}from"./avatar--8IosDG7.js";import{M as Oe}from"./mail-But4pTpi.js";import{R as De}from"./refresh-cw-BD8XeKo4.js";import{M as $e}from"./menu-DdjlmovV.js";function _e(){return s.jsx("div",{className:"space-y-0",role:"status","aria-busy":"true","aria-label":"Loading messages",children:Array.from({length:8}).map((e,t)=>s.jsxs("div",{className:"animate-pulse border-b border-line px-3 py-2",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("div",{className:"h-4 w-32 rounded bg-surface-sunken"}),s.jsx("div",{className:"h-3 w-16 rounded bg-surface-sunken"})]}),s.jsx("div",{className:"mb-2 h-4 w-48 rounded bg-surface-sunken"}),s.jsx("div",{className:"h-3 w-full rounded bg-surface-sunken"})]},t))})}function Fe({filter:e,scopeLabel:t,searchQuery:n}){const u=n?.trim();return e?s.jsxs(q,{children:[s.jsx("p",{className:"font-medium text-fg",children:Be(e.label,t,u)}),s.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:He[e.reach]}),s.jsx($,{variant:"secondary",size:"sm",className:"mt-4",onClick:e.onClear,children:"Clear filter"})]}):s.jsx(q,{children:s.jsx("p",{className:"text-fg-muted",children:Xe(u,t)})})}const He={"whole-folder":"Every message in this folder was checked.","loaded-pages":"Only the messages loaded so far were checked."};function Xe(e,t){return e?"No messages match your search":t?`No messages in ${t}`:"No messages in this mailbox"}function Be(e,t,n){return n?`No results for “${n}” in ${e}`:t?`No ${e} in ${t}`:`No ${e}`}function q({children:e}){return s.jsx("div",{className:"flex h-full flex-1 items-center justify-center",children:s.jsx("div",{className:"flex max-w-sm flex-col items-center justify-center p-8 text-center",children:e})})}function us(){return s.jsxs("div",{className:"flex items-center justify-center gap-2 py-4 text-sm text-fg-muted",role:"status","aria-live":"polite",children:[s.jsx(le,{className:"size-4 animate-spin","aria-hidden":"true"}),s.jsx("span",{children:"Loading more…"})]})}function Ue({message:e="Something went wrong loading this mailbox.",onRetry:t,onReport:n}){return s.jsx("div",{className:"flex h-full flex-1 items-center justify-center p-4",children:s.jsxs("div",{role:"alert",className:"flex max-w-sm flex-col items-center justify-center gap-3 text-center",children:[s.jsx(ue,{className:"size-8 text-danger","aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-danger",children:"Couldn't load messages"}),s.jsx("p",{className:"mt-1 break-words text-sm text-fg-muted",children:e})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[t&&s.jsx($,{variant:"secondary",size:"sm",onClick:t,children:"Retry"}),n&&s.jsx($,{variant:"ghost",size:"sm",onClick:n,children:"Report a problem"})]})]})})}const L=72,V=10,We=L/2,J="__swipeableRowAxisCancel";function Z(e){return e==="leading"?L:e==="trailing"?-L:0}function Ye(e){return e>=L/2?"leading":e<=-L/2?"trailing":"none"}function Ke({thread:e,selectionMode:t,checked:n,active:u,peek:f,onPeek:c,onToggleCheck:p,onLongPress:w,onOpen:b,onAct:v}){const x=g.useRef(null),[j,h]=g.useState(null),{longPressProps:P}=Pe({onLongPress:w,isDisabled:t,accessibilityDescription:"Select message"}),S=i=>{const o=new PointerEvent("pointercancel",{bubbles:!0});o[J]=!0,i.currentTarget.dispatchEvent(o)},r=Re(P,{onPointerDown:i=>{x.current={startX:i.clientX,startY:i.clientY,axis:"none",escaped:!1}},onPointerMove:i=>{if(t)return;const o=x.current;if(!o)return;const m=i.clientX-o.startX,M=i.clientY-o.startY;if(o.axis==="none"&&(Math.abs(M)>V&&Math.abs(M)>Math.abs(m)?o.axis="vertical":Math.abs(m)>V&&Math.abs(m)>Math.abs(M)&&(o.axis="horizontal",i.currentTarget.setPointerCapture(i.pointerId))),o.axis==="none")return;const T=o.axis==="horizontal"?Math.abs(m):Math.abs(M);if(!o.escaped&&T>We&&(o.escaped=!0,S(i)),o.axis!=="horizontal")return;const F=Z(f),H=Math.max(-L,Math.min(L,F+m));h(H)},onPointerUp:i=>{const o=x.current;x.current=null;const m=j;if(h(null),!!o){if(o.axis!=="none"&&!o.escaped&&S(i),o.axis==="horizontal"){m!==null&&c(Ye(m));return}if(o.axis!=="vertical"){if(t){p();return}if(f!=="none"){c("none");return}b()}}},onPointerCancel:i=>{i.nativeEvent[J]||(x.current=null,h(null))}}),d=j??Z(f),y=d>0?"leading":d<0?"trailing":"none",R=K("relative touch-pan-y bg-surface","select-none",Ce({active:n||u})),A={transform:d!==0?`translateX(${d}px)`:void 0,transition:j===null?"transform 150ms ease":"none",minHeight:44},_=!e.isRead,I=i=>i.stopPropagation(),O=t?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:K("inline-flex size-7 shrink-0 items-center justify-center rounded-full border",n?"border-accent bg-accent text-accent-fg":"border-line-strong bg-canvas"),children:n&&s.jsx(de,{className:"size-3.5"})}),s.jsx(G,{thread:e})]}):s.jsxs(s.Fragment,{children:[_&&s.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),s.jsx("span",{role:"checkbox",tabIndex:0,"aria-checked":n,"aria-label":`Select message from ${e.fromName}`,onPointerDown:I,onPointerMove:I,onPointerUp:I,onClick:i=>{i.preventDefault(),i.stopPropagation(),w()},onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),i.stopPropagation(),w())},className:"-m-2 inline-flex size-11 shrink-0 items-center justify-center rounded-full",children:s.jsx(Ae,{name:e.fromName,email:e.fromEmail,size:"sm"})}),s.jsx(G,{thread:e})]});return s.jsxs("div",{className:"relative overflow-hidden",children:[y==="leading"&&s.jsx("button",{type:"button",onClick:()=>v("leading"),"aria-label":e.isRead?"Mark as unread":"Mark as read",className:"absolute inset-y-0 left-0 flex items-center justify-start bg-accent-2 px-6 text-accent-fg",children:e.isRead?s.jsx(Oe,{className:"size-6"}):s.jsx(Se,{className:"size-6"})}),y==="trailing"&&s.jsx("button",{type:"button",onClick:()=>v("trailing"),"aria-label":"Delete message",className:"absolute inset-y-0 right-0 flex items-center justify-end bg-danger px-6 text-canvas",children:s.jsx(fe,{className:"size-6"})}),s.jsx("button",{type:"button",role:t?"checkbox":void 0,"aria-checked":t?n:void 0,"data-message-row":!0,"data-message-id":e.id,...r,className:R,style:A,children:O})]})}function Qe({sections:e,selectedThreadId:t,selectionMode:n,checkedIds:u,initialPeek:f,onToggleCheck:c,onEnterSelection:p,onOpenThread:w,onRefresh:b,refreshing:v,busy:x=!1}){const[j,h]=g.useState(new Set),[P,S]=g.useState(new Map),N=e.flatMap(r=>r.threads).filter(r=>!j.has(r.id)).map(r=>{const d=P.get(r.id);return d===void 0?r:{...r,isRead:d}}),[E,C]=g.useState(f&&f!=="none"&&N[1]?{id:N[1].id,side:f}:null),k=(r,d)=>{if(d==="trailing")h(y=>new Set(y).add(r));else{const y=N.find(R=>R.id===r);S(R=>new Map(R).set(r,!y?.isRead))}C(null)};return s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[v&&s.jsxs("div",{className:"flex items-center justify-center gap-2 border-b border-line py-3 text-fg-muted",children:[s.jsx(De,{className:"size-4 animate-spin"}),s.jsx("span",{className:"text-xs",children:"Checking for new mail…"})]}),s.jsx("div",{className:"divide-y divide-line",children:N.map(r=>s.jsx("div",{className:x?"pointer-events-none opacity-50":void 0,children:s.jsx(Ke,{thread:r,selectionMode:n,checked:u.has(r.id),active:r.id===t,peek:E?.id===r.id?E.side:"none",onPeek:d=>C(d==="none"?null:{id:r.id,side:d}),onToggleCheck:()=>c(r.id),onLongPress:()=>p(r.id),onOpen:()=>w(r.id),onAct:d=>k(r.id,d)})},r.id))}),!n&&!v&&!x&&s.jsx("button",{type:"button",onClick:b,className:"w-full border-t border-line py-2 text-center text-2xs text-fg-subtle transition-colors hover:bg-surface-sunken",children:"Pull to refresh"})]})}const Ge=new Set;function ds({listTitle:e,listMeta:t,sections:n,briefFilters:u,flatList:f,listState:c="ready",searchQuery:p,listFilter:w,listScopeLabel:b,errorMessage:v,onRetry:x,onReportError:j,briefFilter:h,selectedThreadId:P,density:S="comfortable",onSelectThread:N,onOpenNav:E,isDesktop:C,initialTouchState:k,selection:r,keyboard:d,selectionBar:y,paneOverlay:R,listBody:A,hideHeader:_=!1}){const I=S==="compact"?ke:Ie,O=g.useRef(null),i=g.useRef(null),o=me(d);ye({containerRef:O,itemSelector:Q,enabled:!o});const m=o?d.focusedId:void 0,M=o?m??n[0]?.threads[0]?.id:void 0,T=g.useCallback(a=>M===void 0?void 0:a===M?0:-1,[M]);g.useEffect(()=>{if(m===void 0)return;const a=i.current;if(!a)return;const l=a.querySelector(`${Q}[data-message-id="${m}"]`);!l||l===a.ownerDocument.activeElement||l.focus({preventScroll:!1})},[m]),g.useEffect(()=>{if(!o)return;const a=i.current;if(!a)return;const l=a.ownerDocument.activeElement;l!==null&&l!==a.ownerDocument.body||a.focus({preventScroll:!0})},[o]);const F=!C&&!u&&c==="ready",[H,W]=g.useState(!1),ae=k==="peek-trailing"?"trailing":k==="peek-leading"?"leading":void 0,re=()=>{W(!0),setTimeout(()=>W(!1),1400)},D=r?.selectedIds??Ge,z=r?.onToggle,Y=r?.onRowSelect,ie=Ee(D.size,C),X=g.useCallback(a=>{if(z)return{checked:D.has(a),onToggle:l=>{l.preventDefault(),l.stopPropagation(),z(a)}}},[D,z]),B=g.useCallback((a,l)=>Y?.(a,Me(l))?(l.preventDefault(),l.shiftKey&&window.getSelection()?.removeAllRanges(),!0):!1,[Y]),oe=g.useCallback(({thread:a,active:l,onClick:U})=>s.jsx(I,{thread:a,active:l,focused:a.id===m,tabIndex:T(a.id),selection:X(a.id),onClick:ce=>{B(a.id,ce)||U?.()}}),[I,X,B,m,T]);return s.jsxs("section",{ref:a=>{i.current=a,d?.ref(a)},tabIndex:o?-1:void 0,className:"relative flex h-full w-full flex-col bg-surface outline-none",children:[y??(_?null:s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[E&&s.jsx($,{variant:"ghost",size:"sm",icon:s.jsx($e,{className:"size-4"}),onClick:E,"aria-label":"Open folders",className:"-ml-1 shrink-0"}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:e}),t&&s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle",children:t})]})),c==="loading"?s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsx(_e,{})}):c==="empty"?s.jsx(Fe,{filter:w,scopeLabel:b,searchQuery:p}):c==="error"?s.jsx(Ue,{message:v,onRetry:x,onReport:j}):u&&h?s.jsx(Le,{...h,sections:n,selectedThreadId:P,Row:oe,keyboard:d,onSelectThread:N}):A??(F?s.jsx(Qe,{sections:n,selectedThreadId:P,selectionMode:ie,checkedIds:D,initialPeek:ae,onToggleCheck:a=>z?.(a),onEnterSelection:a=>z?.(a),onOpenThread:a=>N?.(a),onRefresh:re,refreshing:H}):s.jsx("div",{ref:O,className:"flex-1 overflow-y-auto",children:n.map(a=>s.jsxs("div",{children:[!f&&a.label&&s.jsxs("div",{className:"sticky top-0 flex h-section-row items-center justify-between border-b border-line bg-surface-sunken px-row-inset",children:[s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:a.label}),s.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:a.threads.length})]}),s.jsx("div",{className:"divide-y divide-line",children:a.threads.map(l=>s.jsx(I,{thread:l,active:l.id===P,focused:l.id===m,tabIndex:T(l.id),selection:X(l.id),onClick:U=>{B(l.id,U)||N?.(l.id)}},l.id))})]},a.id))})),C&&s.jsx(Te,{hints:d?Ne(d.handlers):we}),R]})}var qe=class extends xe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,u=super.createResult(e,t),{isFetching:f,isRefetching:c,isError:p,isRefetchError:w}=u,b=n.fetchMeta?.fetchMore?.direction,v=p&&b==="forward",x=f&&b==="forward",j=p&&b==="backward",h=f&&b==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:he(t,n.data),hasPreviousPage:ge(t,n.data),isFetchNextPageError:v,isFetchingNextPage:x,isFetchPreviousPageError:j,isFetchingPreviousPage:h,isRefetchError:w&&!v&&!j,isRefetching:c&&!x&&!h}}};function fs(e,t){return pe(e,qe)}const se={dimension:"read",position:"pre",text:"unread"},Ve={dimension:"read",position:"pre",text:"read"},te={dimension:"starred",position:"pre",text:"starred"},ne={dimension:"attachment",position:"post",text:"with an attachment"},Je=[["unread",se],["flagged",te],["attachment",ne]],Ze=e=>{switch(e.type){case"category":return{dimension:"category",position:"pre",text:ee(e.category)??e.value};case"isUnread":return se;case"isRead":return Ve;case"isStarred":return te;case"hasAttachment":return ne;case"from":return{dimension:e.raw,position:"post",text:`from ${e.value}`};case"subject":return{dimension:e.raw,position:"post",text:`about “${e.value}”`};case"before":return{dimension:e.raw,position:"post",text:`sent before ${e.value}`};case"after":return{dimension:e.raw,position:"post",text:`sent on or after ${e.value}`};case"in":return{dimension:e.raw,position:"post",text:`in ${e.value}`};case"account":return{dimension:e.raw,position:"post",text:`in the ${e.value} account`}}},es=(e,t)=>{const n=new Map,u=c=>{n.has(c.dimension)||n.set(c.dimension,c)},f=ee(e.category);f&&u({dimension:"category",position:"pre",text:f});for(const[c,p]of Je)e.attributes.has(c)&&u(p);for(const c of t)u(Ze(c));return[...n.values()]},ss=(e,t)=>{const n=es(e,t);if(n.length===0)return;const u=f=>n.filter(c=>c.position===f).map(c=>c.text);return[...u("pre"),"mail",...u("post")].join(" ")},ms=({chips:e,tokens:t,reach:n,onClear:u})=>{const f=ss(e,t);if(f)return{label:f,reach:n,onClear:u}};function xs({title:e,unreadCount:t,preset:n,selectedCategory:u,activeFilters:f,onSelectCategory:c,onToggleFilter:p,onSelectSource:w,onClearFilters:b,children:v,footer:x,searchResults:j,searchLoading:h,relatedResults:P,relatedLoading:S,onSelectSearchResult:N,searchResultsLabel:E,relatedResultsLabel:C,searchResultsInBody:k,refreshControl:r}){const{searchInput:d}=be(),y=d.trim().length>0,R={categories:n.categories,filters:n.filters,sources:n.sources,selectedCategory:u,activeFilters:f,onSelectCategory:c,onSelectSource:w,onToggleFilter:p,onClear:b};return s.jsx(ve,{hasSheet:!y,children:s.jsx(ze,{title:e,unreadCount:t,footer:x,searchFilter:R,searchResults:j,searchLoading:h,relatedResults:P,relatedLoading:S,onSelectSearchResult:N,searchResultsLabel:E,relatedResultsLabel:C,searchResultsInBody:k,refreshControl:r,children:s.jsx(je,{...R,hideChrome:y,children:v})})})}export{us as M,Ke as S,ds as a,xs as b,ms as l,fs as u};