@remit/web-client-dist 0.0.641 → 0.0.643

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 (168) hide show
  1. package/assets/BriefPane-CqQSh_ja.js +1 -0
  2. package/assets/CalendarComposePane-C9l0zjP2.js +1 -0
  3. package/assets/{CalendarComposeSeed-Ddue6yGg.js → CalendarComposeSeed-CJm8rCY9.js} +1 -1
  4. package/assets/{CalendarShell-ay8jVvby.js → CalendarShell-Dew68lMD.js} +1 -1
  5. package/assets/{EmptyState-DxT13qcR.js → EmptyState-VLl0Xg-2.js} +1 -1
  6. package/assets/{ErrorState-CHxEHbvf.js → ErrorState-DmeOZx31.js} +1 -1
  7. package/assets/FlaggedPane-h6xyDnuf.js +1 -0
  8. package/assets/{FullCompose-DkV5Z3KV.js → FullCompose-C4K-ff_q.js} +1 -1
  9. package/assets/MailListHeader-BrXXf1Yp.js +7 -0
  10. package/assets/{MailNav-DBY9OW6Y.js → MailNav-3iRwz5bx.js} +1 -1
  11. package/assets/{MailShell-LEDBmXGr.js → MailShell-C7XYJEOC.js} +1 -1
  12. package/assets/{MailViewChrome-7gtXtr7X.js → MailViewChrome-7Gh2Vw-t.js} +1 -1
  13. package/assets/{MailboxPane-sccwyPwa.js → MailboxPane-0KW8VAei.js} +1 -1
  14. package/assets/{NavMenuButton-C3UDJB1v.js → NavMenuButton-B4_xZcAo.js} +1 -1
  15. package/assets/{OnboardingWizard-DWrpEauO.js → OnboardingWizard-Dyv1Jm6j.js} +1 -1
  16. package/assets/OpenCalendarEvent-7dAQjmZ0.js +2 -0
  17. package/assets/{OutboxPane-oxeCJEiZ.js → OutboxPane--7u1PWnp.js} +1 -1
  18. package/assets/_calendarObjectId-DZ45RvvI.js +1 -0
  19. package/assets/_mailboxId-mXLMaQIT.js +1 -0
  20. package/assets/_messageId-2G79mDVH.js +1 -0
  21. package/assets/_messageId-BproZqyb.js +1 -0
  22. package/assets/_messageId-Yux53ec8.js +1 -0
  23. package/assets/_outboxMessageId-CUrOyyD-.js +1 -0
  24. package/assets/_recurrenceId-7sRPMrJQ.js +1 -0
  25. package/assets/_threadId-BVoqj3ta.js +1 -0
  26. package/assets/_threadId-DClBqCRh.js +1 -0
  27. package/assets/_threadId-wGJAHiFc.js +1 -0
  28. package/assets/_view._date-C-6t0plG.js +1 -0
  29. package/assets/{accounts-D080vGx7.js → accounts-BBm2Fri5.js} +1 -1
  30. package/assets/{advanced-CkUEORb7.js → advanced-C7IVSlq-.js} +1 -1
  31. package/assets/{appearance-C7pPonlu.js → appearance-DHQkzl84.js} +1 -1
  32. package/assets/{attendee-row-t7d1gEVn.js → attendee-row-BVnfl4Ln.js} +1 -1
  33. package/assets/{avatar-C2R7xqlA.js → avatar-DD62C_eL.js} +1 -1
  34. package/assets/{bell-off-CD1iuAQA.js → bell-off-CsR58N8X.js} +1 -1
  35. package/assets/{bottom-sheet-DZ2d0h_L.js → bottom-sheet-BG2Fi0Lb.js} +1 -1
  36. package/assets/{brief-BVo4rf_J.js → brief-BkicXAec.js} +1 -1
  37. package/assets/brief-BmBsP3Eb.js +1 -0
  38. package/assets/{browser-ponyfill-BdQcytd0.js → browser-ponyfill-vr6sMZpU.js} +2 -2
  39. package/assets/{bug-DI9j6s_O.js → bug-BXkTcnP3.js} +1 -1
  40. package/assets/{calendar-0_V8JbUq.js → calendar-Bif9hwZM.js} +1 -1
  41. package/assets/{calendar-clash-strip-AV6ir0kb.js → calendar-clash-strip-CkUcFznp.js} +1 -1
  42. package/assets/calendar-format-C1OfWDS9.js +1 -0
  43. package/assets/calendar-report-BY6VcRI-.js +1 -0
  44. package/assets/calendar-suggestion-DSoR-sUT.js +1 -0
  45. package/assets/{calendars-Dav4B8o3.js → calendars-DxQTaSZf.js} +1 -1
  46. package/assets/{card-hG_Il7pd.js → card-DggbFcQC.js} +1 -1
  47. package/assets/{checkbox-B_JY_6mN.js → checkbox-DNsJWnQ9.js} +1 -1
  48. package/assets/chevron-left-DVuaPYD9.js +1 -0
  49. package/assets/{circle-check-Cmp8Rqlz.js → circle-check-DPWZDhPO.js} +1 -1
  50. package/assets/{circle-check-big-B9Ca4u10.js → circle-check-big-CM7pZZbV.js} +1 -1
  51. package/assets/{circle-help-Cmc2Km1C.js → circle-help-BtRmVPpF.js} +1 -1
  52. package/assets/{clock-DC78l7yK.js → clock-B3HY3HEG.js} +1 -1
  53. package/assets/compose._-_outboxMessageId_-93yCdWlT.js +1 -0
  54. package/assets/compose._-_outboxMessageId_-BuD2Nqen.js +1 -0
  55. package/assets/compose._-_outboxMessageId_-CjOo7QgX.js +1 -0
  56. package/assets/compose._-_outboxMessageId_-m9wrDxnm.js +1 -0
  57. package/assets/{config-import-hoC0Y2SG.js → config-import-Fo3m7cZ7.js} +1 -1
  58. package/assets/{confirm-dialog-CCDHX_6Q.js → confirm-dialog-CgLhcr4g.js} +1 -1
  59. package/assets/{copy-B0aWQGDa.js → copy-7B_A7tMm.js} +1 -1
  60. package/assets/{credential-steps-uXZK9Zmr.js → credential-steps-CnFqc5oP.js} +1 -1
  61. package/assets/{download-D3fQ48lB.js → download-BG6KV76e.js} +1 -1
  62. package/assets/{file-json-CCQAXfEc.js → file-json-DKDhkzal.js} +1 -1
  63. package/assets/{filters-DjsJshjt.js → filters-BjhC4ukE.js} +1 -1
  64. package/assets/{flagged-DU9q4oil.js → flagged-BwEn5mqI.js} +1 -1
  65. package/assets/flagged-CtubMGA7.js +1 -0
  66. package/assets/{folders-EdBrFHzG.js → folders-QYetOmXD.js} +1 -1
  67. package/assets/{help-copy-BFATWnBQ.js → help-copy-XLWHUTq9.js} +1 -1
  68. package/assets/{import-wN7xkLN8.js → import-BLX36zo9.js} +1 -1
  69. package/assets/index-2G79mDVH.js +1 -0
  70. package/assets/index-B52QS6i2.js +1 -0
  71. package/assets/{index-DY5mGxwG.js → index-BUTEicLk.js} +1 -1
  72. package/assets/{index-C5Dozv2m.css → index-BtYEmjxr.css} +1 -1
  73. package/assets/index-CvXSZNRB.js +1 -0
  74. package/assets/index-Cw1nSElr.js +1 -0
  75. package/assets/{index-DE-NAKWZ.js → index-DOsp5wL9.js} +4 -4
  76. package/assets/index-DU7GET4S.js +1 -0
  77. package/assets/{index-DKo99WG1.js → index-DdgwCJ4v.js} +40 -40
  78. package/assets/index-RK66HQoS.js +1 -0
  79. package/assets/index-Yux53ec8.js +1 -0
  80. package/assets/index-dAmO05_k.js +1 -0
  81. package/assets/index-vr5V5mez.js +1 -0
  82. package/assets/{kbd-xYIrsDlz.js → kbd-DKvs5BdK.js} +1 -1
  83. package/assets/{labels-CToNdujY.js → labels-CW2ReWm4.js} +1 -1
  84. package/assets/{mail-CFqLOB4w.js → mail-BJPu5dwh.js} +1 -1
  85. package/assets/{mail-DxfGucaQ.js → mail-CRm24o3R.js} +1 -1
  86. package/assets/map-pin-CAgVIQRt.js +1 -0
  87. package/assets/{menu-u9D-cJXQ.js → menu-DeD_0Sd1.js} +1 -1
  88. package/assets/minus-0VqQt5wq.js +1 -0
  89. package/assets/{new-DarKu0Ji.js → new-CRtnsWv2.js} +1 -1
  90. package/assets/onboarding-50LVQxkR.js +1 -0
  91. package/assets/{onboarding-completion-DK9cy93Q.js → onboarding-completion-D4p2yV8X.js} +1 -1
  92. package/assets/outbox-jzPfnLIS.js +1 -0
  93. package/assets/{pane-header-DmEVnHem.js → pane-header-DCDDVSaQ.js} +1 -1
  94. package/assets/{pencil-hPJlTnvS.js → pencil-DxSaFuJ4.js} +1 -1
  95. package/assets/{popover-menu-BDeljNyh.js → popover-menu-4krm3dWT.js} +1 -1
  96. package/assets/{refresh-cw-DNbEUXcm.js → refresh-cw-C_o59REw.js} +1 -1
  97. package/assets/{rich-text-CQJUj3SY.js → rich-text-CdLRrg6I.js} +14 -14
  98. package/assets/{rich-text-spellcheck-worker-provider-YjewF802.js → rich-text-spellcheck-worker-provider-DAgr-VNc.js} +1 -1
  99. package/assets/{rotate-ccw-DFe52ITT.js → rotate-ccw-C7hQnwfM.js} +1 -1
  100. package/assets/{roving-focus-DWecg5C9.js → roving-focus-wLsuSVCZ.js} +1 -1
  101. package/assets/{row-actions-Cp8U_ugi.js → row-actions-CsDIFX2Z.js} +1 -1
  102. package/assets/{search-mirror-CjZ7cATA.js → search-mirror-7ZjhpyaP.js} +1 -1
  103. package/assets/{search-token-index-DL0AoAlj.js → search-token-index-Dbim5YtJ.js} +1 -1
  104. package/assets/{sections-DDBMQxXz.js → sections-BHPkRjh5.js} +1 -1
  105. package/assets/{senders-Di3Hbnh-.js → senders-CNBlWIiG.js} +1 -1
  106. package/assets/settings-Cb-LOzr3.js +1 -0
  107. package/assets/{settings-screen-v6xny9wU.js → settings-screen-CIUyvyDm.js} +1 -1
  108. package/assets/{shield-check-BgoZBruM.js → shield-check-D6xreYrB.js} +1 -1
  109. package/assets/{suggested-vips-C6Pc81iu.js → suggested-vips-Da8IuYnJ.js} +1 -1
  110. package/assets/suggestion._suggestionId-CjvTvFz8.js +1 -0
  111. package/assets/{undo-2-nUyUEATC.js → undo-2-BVpzm_lb.js} +1 -1
  112. package/assets/useCalendarData-D9NX1A9R.js +1 -0
  113. package/assets/useCalendarFreeBusy-B6fKe2s-.js +1 -0
  114. package/assets/{useCalendarWrites-qcdW_JmG.js → useCalendarWrites-DUx11oF3.js} +1 -1
  115. package/assets/{useCalendars-sfh2BICi.js → useCalendars-BLmllCqQ.js} +1 -1
  116. package/assets/{useDebouncedValue-Bq8RVLfv.js → useDebouncedValue-DvXNnDTh.js} +1 -1
  117. package/assets/{useFilters-zXsB3pIM.js → useFilters-C3B6gyy8.js} +1 -1
  118. package/assets/{useLabels-xQerI8AK.js → useLabels-BY5yOSXl.js} +1 -1
  119. package/assets/{useLayoutTier-C1kzvb61.js → useLayoutTier-CbC-hQRr.js} +1 -1
  120. package/assets/{useMessageBodyContent-BRyDdu_J.js → useMessageBodyContent-DRTP4wa0.js} +1 -1
  121. package/assets/{useQueries-CY9FUcC8.js → useQueries-B9KsAw6v.js} +1 -1
  122. package/assets/{useRefreshControl-DKJ_Eyfn.js → useRefreshControl-BQetpFZ3.js} +1 -1
  123. package/assets/{useResultFolderIndex-BFXa90Ay.js → useResultFolderIndex-IoXcSy-p.js} +1 -1
  124. package/assets/{useSearchTokenContext-C0_GGpQj.js → useSearchTokenContext-DMIJPqzA.js} +1 -1
  125. package/assets/{useSemanticSearch-lVNhyaIe.js → useSemanticSearch-BTlz1ruP.js} +1 -1
  126. package/assets/{useSignature-CR4J3Q1V.js → useSignature-Cbp58mOz.js} +1 -1
  127. package/index.html +2 -2
  128. package/package.json +1 -1
  129. package/assets/BriefPane-D1p8nleB.js +0 -1
  130. package/assets/CalendarComposePane-FU6MwnAy.js +0 -1
  131. package/assets/FlaggedPane-CJ__xJpf.js +0 -1
  132. package/assets/MailListHeader-BZRxmnIb.js +0 -7
  133. package/assets/OpenCalendarEvent-B1DYETG7.js +0 -2
  134. package/assets/_calendarObjectId-DpUi-YzJ.js +0 -1
  135. package/assets/_mailboxId-DW6pvCIw.js +0 -1
  136. package/assets/_messageId-BAQFECvK.js +0 -1
  137. package/assets/_messageId-BVnDwNl2.js +0 -1
  138. package/assets/_messageId-Bvuxe_8r.js +0 -1
  139. package/assets/_outboxMessageId-BjD8wilW.js +0 -1
  140. package/assets/_recurrenceId-DBx4vqgw.js +0 -1
  141. package/assets/_threadId-B5nqfV-L.js +0 -1
  142. package/assets/_threadId-CazI55hb.js +0 -1
  143. package/assets/_threadId-DUn5RY_Y.js +0 -1
  144. package/assets/_view._date-Bpb6TKNU.js +0 -1
  145. package/assets/brief-CH-e1O9N.js +0 -1
  146. package/assets/calendar-format-CyOmp12n.js +0 -1
  147. package/assets/calendar-report-rx459ZNk.js +0 -1
  148. package/assets/calendar-suggestion-OndzGSan.js +0 -1
  149. package/assets/chevron-left-D3r7M2xH.js +0 -1
  150. package/assets/compose._-_outboxMessageId_-Bt9J2-qp.js +0 -1
  151. package/assets/compose._-_outboxMessageId_-C1FaW9o1.js +0 -1
  152. package/assets/compose._-_outboxMessageId_-D5zB1ABW.js +0 -1
  153. package/assets/compose._-_outboxMessageId_-R5L6KgB1.js +0 -1
  154. package/assets/flagged-Q3VMHIjI.js +0 -1
  155. package/assets/index-B3qUW5A0.js +0 -1
  156. package/assets/index-BAQFECvK.js +0 -1
  157. package/assets/index-BUYR1pAl.js +0 -1
  158. package/assets/index-Bvuxe_8r.js +0 -1
  159. package/assets/index-CxIBpGfW.js +0 -1
  160. package/assets/index-D9CK5EEZ.js +0 -1
  161. package/assets/index-DFpWp13S.js +0 -1
  162. package/assets/index-EsGaYQlh.js +0 -1
  163. package/assets/index-p4X-Ys_z.js +0 -1
  164. package/assets/minus-Bnr4gKCE.js +0 -1
  165. package/assets/onboarding-DRQo7PkQ.js +0 -1
  166. package/assets/outbox-BJK9d-c1.js +0 -1
  167. package/assets/settings-CFMotOQ7.js +0 -1
  168. package/assets/useCalendarData-4YBnFK2x.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as r,L as Et,W as Ot,eN as $e,eO as ne,e1 as re,r as a,c as Ye,C as ie,bq as Ft,cU as At,K as Nt,dT as Bt,eP as Lt,eQ as qt,a0 as Ve,ek as Pt,eR as Dt,ak as _t,d4 as Qt,d5 as zt}from"./index-DdgwCJ4v.js";import{g as Je,e as Wt,f as Ze,u as Ht,p as Ut,R as Kt}from"./useSearchTokenContext-DMIJPqzA.js";import{a8 as Gt,z as $t,B as Yt,ak as Vt,al as Jt,am as Zt,an as _e,ao as Xt,ap as es,a7 as ts,aq as ss,ar as os,as as ns,af as rs,M as as,at as is,ag as cs,au as ls,av as ds,d as us,o as fs,ai as ms,l as hs,S as gs,I as ps,N as Qe,L as xs,J as Is,b as ys,X as vs,Y as Ie,Z as bs,$ as Xe,a0 as et,a1 as Ss,a2 as Ts,a3 as Cs}from"./MailListHeader-BrXXf1Yp.js";import{u as ws,a as Rs,R as Ms,b as js,c as ks}from"./useRefreshControl-BQetpFZ3.js";import{u as ae}from"./useQueries-B9KsAw6v.js";import{t as tt,s as Es,u as Os,r as Fs,L as As}from"./useSemanticSearch-BTlz1ruP.js";import{a as Ns}from"./useLabels-BY5yOSXl.js";import{u as Bs}from"./useLayoutTier-CbC-hQRr.js";import{d as Ls,w as qs}from"./wizard-selection-DxUM65kM.js";import{m as Ps,e as Ds,f as _s}from"./search-token-index-Dbim5YtJ.js";import{u as st}from"./sections-BHPkRjh5.js";import{R as Qs}from"./refresh-cw-C_o59REw.js";import{a as zs}from"./useMessageBodyContent-DRTP4wa0.js";function Ws({sync:e}){return e?r.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:[r.jsx(Et,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:Hs(e)})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[r.jsx(Ot,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),r.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 ot=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],nt="category",Us={unclassified:"uncategorized"},H=e=>Wt(e).map(t=>t.raw),W=e=>e.join(" "),ye=e=>{const t=Ze(e);if(t)return ot.find(s=>s.name===t.name&&s.value===t.value.toLowerCase())?.id},ve=e=>{const t=Ze(e);if(!t||t.name!==nt)return;const s=t.value.toLowerCase(),n=Us[s];if(n)return n;if(!(!$e(s)||s==="all"))return s},rt=e=>ot.find(t=>t.id===e),at=e=>rt(e)!==void 0,Ks=e=>{const t=new Set;for(const s of H(e)){const n=ye(s);n&&t.add(n)}return t},Gs=e=>{let t="all";for(const s of H(e)){const n=ve(s);n&&(t=n)}return t},$s=(e,t)=>{const s=rt(t);if(!s)return;const n=H(e),i=n.filter(d=>ye(d)!==t);return i.length<n.length?W(i):W([...n,Je(s.name,s.value)])},Ys=(e,t)=>{const s=H(e).filter(n=>!ve(n));return W(t==="all"?s:[...s,Je(nt,t)])},Vs=e=>W(H(e).filter(t=>!ye(t)&&!ve(t))),it=e=>e.trim().length>0,ze=e=>{if(!it(e.query))return e.ownFilters;const t=new Set(Ks(e.query));for(const s of e.ownFilters)at(s)||t.add(s);return t},We=e=>it(e.query)?Gs(e.query):e.ownCategory,He=6e4,Js=3e4,Zs={kind:"unknown"},Ue=e=>(t,s)=>Gt(s?.queryKey,e)?t:void 0,Xs=(e,t,s)=>({...e,category:[t],limit:s,order:"desc"}),eo=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Ke=(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 to({categories:e,criteria:t,limit:s,counted:n}){const i=ae({queries:e.map(c=>{const h=Xs(t,c,s),f=Ke(t,c);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},placeholderData:Ue(f),staleTime:He}})}),d=ae({queries:e.map(c=>{const h=eo(t,c),f=Ke(t,c);return{queryKey:re({query:h}),queryFn:async()=>{const{data:v}=await ne({query:h,throwOnError:!0});return v},enabled:n,placeholderData:Ue(f),staleTime:He}})}),m=a.useMemo(()=>e.map((c,h)=>{const f=i[h],v=d[h],p=f?.data?.items??[];return{category:c,rows:p,atCap:p.length>=s,total:n?tt(v?.data?.count):Zs,loading:f?.isPending??!0,failed:f?.isError??!1,retry:()=>{f?.refetch(),n&&v?.refetch()}}}),[e,i,d,n,s]),l=a.useCallback(()=>{for(const c of i)c.refetch();for(const c of d)c.refetch()},[i,d]);return{sections:m,isLoading:i.length>0&&i.every(c=>c.isPending),isError:i.length>0&&i.every(c=>c.isError),refetch:l}}function so(e,t,s){const n={...e,limit:t,order:"desc"},{data:i,isLoading:d,isError:m,refetch:l}=Ye({queryKey:re({query:n}),queryFn:async()=>{const{data:h}=await ne({query:n,throwOnError:!0});return h},enabled:s,staleTime:Js});return{rows:a.useMemo(()=>s?i?.items??[]:[],[i,s]),isLoading:s&&d,isError:s&&m,refetch:a.useCallback(()=>{l()},[l])}}const oo=3e4,no={kind:"unknown"},ro=(e,t)=>({...e,mailboxId:t,order:"desc",count:!0,results:!1});function ao({criteria:e,junkMailboxIds:t,enabled:s}){const n=ae({queries:t.map(i=>{const d=ro(e,i);return{queryKey:re({query:d}),queryFn:async()=>{const{data:m}=await ne({query:d,throwOnError:!0});return m},enabled:s,staleTime:oo}})});return a.useMemo(()=>t.map((i,d)=>({mailboxId:i,count:s?tt(n[d]?.data?.count):no,failed:s?n[d]?.isError??!1:!1})),[t,n,s])}const io=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),co=e=>[...e].sort(io),lo=["from","subject","category","unread","starred","attachments"],ct=["contacts","today"],uo=e=>new Set(ct.filter(t=>e.has(t))),fo=(e,t,s,n)=>{const i=$t({category:e,attributes:t}),{params:d,residual:m}=Yt(s,i,lo),l={...d,...i},c={muted:!1};return l.from!==void 0&&(c.from=l.from),l.subject!==void 0&&(c.subject=l.subject),l.unread!==void 0&&(c.unread=l.unread),l.starred!==void 0&&(c.starred=l.starred),l.attachments!==void 0&&(c.attachments=l.attachments),n!==void 0&&(c.accountId=n),{criteria:c,residual:m}},mo=({residual:e,attributes:t})=>e.length===0&&!ct.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,ho=(e,t)=>se(e)!==se(t)?se(e)>se(t):oe(e)!==oe(t)?oe(e)>oe(t):e.pageRows>t.pageRows;function go(e,{pageRowsByMailbox:t}){const s=e.map(f=>({...f,pageRows:t.get(f.mailboxId)??0}));for(const[f,v]of t)v<=0||s.some(p=>p.mailboxId===f)||s.push({mailboxId:f,count:{kind:"unknown"},failed:!1,pageRows:v});const n=s[0];if(!n)return;let i=0,d=!0,m=n;for(const f of s)f.count.kind==="unknown"?d=!1:i+=f.count.value,ho(f,m)&&(m=f);const l=s.some(f=>f.pageRows>0),c=s.some(f=>f.failed);if(i===0&&!l&&(d||!c))return;const h=d&&i===0&&l;return{mailboxId:m.mailboxId,count:d&&!h?{kind:"exact",value:i}:{kind:"unknown"}}}const po=50,xo=200,Io=[],Ge=()=>r.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>r.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[r.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsxs("div",{className:"flex justify-between gap-2",children:[r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),yo=({accountEmail:e})=>{const t=st();return r.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:[r.jsx(Ve,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),r.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},vo=(e,t)=>{if(t.size===0)return{};const s=e.filter(d=>t.has(d.id)),n=Fs(s.map(d=>d.accountId));if(n.restriction)return n;const i=new Set;for(const d of s)d.mailboxId&&i.add(d.mailboxId);return i.size>1?{accountId:n.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${i.size} folders`}:{accountId:n.accountId,mailboxId:i.size===1?[...i][0]:void 0}};function bo({header:e,rows:t,wizard:s,children:n}){const{selectedIds:i,selectedCount:d,exitSelection:m,orderedIds:l,allSelected:c,toggleAllLoaded:h}=ds(),f=a.useMemo(()=>vo(t,i),[t,i]),{junkMailboxId:v}=us(f.accountId),{labels:p}=Ns(f.accountId),b=a.useMemo(()=>Array.from(i),[i]),L=a.useMemo(()=>qs(t,i),[t,i]),x=fs(v,f.mailboxId),S=a.useMemo(()=>l.length>0?{checked:c,indeterminate:d>0&&!c,onChange:h}:void 0,[l.length,c,d,h]),A=f.moveDisabledHint?{tone:"warning",text:f.moveDisabledHint}:void 0,T=M=>r.jsx(gs,{title:M.title,navSlot:M.navSlot,titleMeta:M.titleMeta,searchSlot:M.searchSlot,searchField:M.searchField,idleSlot:M.makeFilterSlot,count:d,onCancel:m,onDelete:()=>s.start("delete"),onMove:()=>s.start("move"),onOrganize:()=>s.start("organize"),onJunk:x?()=>s.start("junk"):void 0,onMarkRead:()=>s.start("markRead"),overflowSlot:f.accountId&&f.mailboxId&&d>0&&p.length>0?r.jsx(As,{accountId:f.accountId,mailboxId:f.mailboxId,messageIds:b}):void 0,selectAll:S,notice:A});return r.jsx(ms,{...e,selectionBar:T,paneOverlay:r.jsx(hs,{verb:s.verb,accountId:f.accountId,mailboxId:f.mailboxId,selection:L,selectionRestriction:f.restriction,onFinished:m}),children:n})}function So({accounts:e,selectedMessageId:t,onOpenThread:s,commandsRef:n,onTriageContextChange:i,onDeleteMessages:d}){const{searchQuery:m,searchInput:l,resultFolderIndex:c,onSearchChange:h}=ie(),f=Ht(),v=Ft(),p=Bs(),b=At(),L=Ps(),x=a.useMemo(()=>co(e.filter(o=>!o.muted?.value)),[e]),[S,A]=a.useState("all"),[T,M]=a.useState("all"),[N,q]=a.useState(new Set),[le,j]=a.useState(!1),P=a.useCallback(o=>{q(u=>{const g=new Set(u);return g.has(o)?g.delete(o):g.add(o),g})},[]),U=a.useCallback(()=>q(new Set),[]),E=l.trim().length>0,{freeText:w,tokens:D}=Ut(m.trim().toLowerCase(),f),y=w.length>0,_=a.useMemo(()=>ze({query:l,ownFilters:N}),[l,N]),Q=a.useMemo(()=>We({query:l,ownCategory:T}),[l,T]),F=a.useMemo(()=>ze({query:m,ownFilters:N}),[m,N]),C=a.useMemo(()=>We({query:m,ownCategory:T}),[m,T]),I=a.useCallback(o=>{if(!E||!at(o)){P(o);return}const u=$s(l,o);u!==void 0&&h(u)},[E,l,h,P]),k=a.useCallback(o=>{if(!E){M(o);return}h(Ys(l,o))},[E,l,h]),de=a.useMemo(()=>C==="all"&&!y?o=>{$e(o)&&k(o)}:void 0,[C,y,k]),ue=a.useCallback(()=>{M("all"),A("all"),U(),E&&h(Vs(l))},[E,l,h,U]),K=ae({queries:x.map(o=>({...Nt({path:{accountId:o.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),G=a.useMemo(()=>{const o=new Map;for(let u=0;u<x.length;u++){const g=x[u].accountId,te=(K[u]?.data?.items??[]).reduce((O,kt)=>O+(kt.unseenCount??0),0);o.set(g,te)}return o},[x,K]),ut=a.useMemo(()=>x.filter((o,u)=>{const g=K[u];return g?.isError?!Bt(g.error):!1}),[x,K]),{criteria:fe,residual:$}=a.useMemo(()=>fo(C,F,D,S==="all"?void 0:S),[C,F,D,S]),ft=a.useMemo(()=>C==="all"?[...Vt]:[C],[C]),be=a.useMemo(()=>({...fe,query:w,...C==="all"?{}:{category:[C]}}),[fe,w,C]),Se=mo({residual:$,attributes:F}),{sections:Y,isLoading:mt,isError:ht,refetch:Te}=to({categories:y?Io:ft,criteria:fe,limit:C==="all"?ls:po,counted:Se}),{rows:Ce,isLoading:gt,isError:pt,refetch:we}=so(be,xo,y),me=y?gt:mt,Re=y?pt:ht,Me=a.useCallback(()=>{if(y){we();return}Te()},[y,we,Te]),je=a.useMemo(()=>uo(F),[F]),V=a.useCallback(o=>Ls(o).map(Jt).filter(u=>Lt(u,je)&&Zt(u,$)),[je,$]),J=a.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=a.useMemo(()=>V(Ce),[Ce,V]),xt=a.useCallback(o=>{Y.find(u=>u.category===o)?.retry()},[Y]),R=a.useMemo(()=>y?Z:J.flatMap(o=>o.rows),[y,Z,J]),It=a.useMemo(()=>qt(c),[c]),ke=ao({criteria:be,junkMailboxIds:It,enabled:Se&&Es({hasSearchQuery:y,freeText:w,residualTokenCount:$.length})}),{spamIds:he,briefSpamOffer:X}=a.useMemo(()=>{const o={spamIds:void 0,briefSpamOffer:void 0};if(!w)return o;const u=R.map(O=>_e(O,c)),{spam:g}=Xt(u),B=new Map;for(const O of g)O.mailboxId&&B.set(O.mailboxId,(B.get(O.mailboxId)??0)+1);const te=go(ke,{pageRowsByMailbox:B});return g.length===0&&!te?o:{spamIds:g.length>0?new Set(g.map(O=>O.id)):void 0,briefSpamOffer:te}},[R,w,c,ke]),Ee=a.useMemo(()=>{const o=u=>he===void 0?u:u.filter(g=>!he.has(g.id));return y?[{id:"matches",threads:o(Z)}]:es(J.map(u=>({...u,rows:o(u.rows)})))},[y,Z,J,he]),Oe=a.useCallback((o,u)=>{const g=R.find(B=>B.id===o)?.threadId;g&&s?.({threadId:g,messageId:o},u)},[R,s]),yt=a.useCallback(o=>{const u=o.threadId??R.find(g=>g.id===o.id)?.threadId;u&&s?.({threadId:u,messageId:o.id})},[R,s]),ge=a.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:G.get(o.accountId),active:S===o.accountId}))],[x,G,S]),z=a.useMemo(()=>e.filter(o=>o.muted?.value).length,[e]),vt=a.useMemo(()=>Array.from(G.values()).reduce((o,u)=>o+u,0),[G]),pe=a.useMemo(()=>x.map(o=>o.accountId),[x]),{hasNewMail:Fe}=ws(),{state:Ae,errorMessage:Ne,refresh:Be}=Rs(pe,{onSettled:()=>Me()}),bt=a.useMemo(()=>r.jsx(Ms,{state:Ae,onRefresh:Be,label:"Refresh daily brief",errorMessage:Ne,hasUpdate:Fe(pe)}),[Ae,Be,Ne,Fe,pe]),xe=a.useMemo(()=>R.map(o=>_e(o,c)),[R,c]),{hits:Le,isLoading:St}=Os(),Tt=a.useMemo(()=>{const o=new Map(R.map(g=>[g.id,g.threadId])),u=xe.map(g=>o.get(g.id)).filter(g=>g!=null);return ts(Le,u,c)},[Le,xe,R,c]),Ct=a.useMemo(()=>{const o=ss(ge.map(u=>({id:u.id,label:u.label,count:u.count,active:u.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:u=>k(u),onSelectSource:A,onToggleFilter:u=>I(u),onClear:ue}},[ge,z,Q,_,le,I,k,ue]),qe=Ee.length===0&&S==="all"&&w.length===0&&D.length===0,wt=a.useMemo(()=>x.map(o=>o.accountId),[x]),Rt=a.useMemo(()=>x.some(o=>js(o.syncPhase)),[x]),ee=ks(wt,qe||Rt),Pe=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(Ge,{}),r.jsx(Ge,{})]}),De=!me&&!Re&&!qe,Mt=os({tier:p,hasLiveInput:E,hasCommittedQuery:m.trim().length>0,bodyRendersCommittedResults:!0}),jt=De?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&r.jsx(ns,{count:X.count,onScopeToSpam:()=>L(X.mailboxId,m)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(rs,{sections:Ee,briefCategory:Q,Row:as,selectedThreadId:t,onSelectThread:Oe,onShowAllSection:de,onRetrySection:xt,flat:y,onSelectBriefCategory:k,sources:ge,sourcesNote:z>0?`+${z} muted`:void 0,onSelectSource:A,activeFilters:_,onToggleFilter:I,onClearFilters:ue})})]}):me?Pe:Re?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[r.jsx(Ve,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>Me(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Qs,{className:"size-3.5"}),"Try again"]})]}):ee.resolved?r.jsx(Ws,{sync:ee.syncing?{synced:ee.synced,total:ee.total}:void 0}):Pe;return r.jsx(Pt,{hasSheet:De&&!Mt,children:r.jsx(is,{selectedMessageId:t,rows:R,onOpen:Oe,onDeleteMessages:d,onSelectionVerb:b.start,commandsRef:n,onTriageContextChange:i,children:r.jsx(bo,{wizard:b,header:{title:"Daily brief",unreadCount:vt,footer:v?r.jsx(cs,{}):void 0,searchFilter:Ct,searchResults:xe,searchLoading:me,relatedResults:Tt,relatedLoading:St,onSelectSearchResult:yt,spamOffer:X,searchResultsInBody:!0,refreshControl:bt},rows:R,children:r.jsxs("div",{className:"flex h-full flex-col",children:[ut.map(o=>r.jsx(yo,{accountEmail:o.email,accountId:o.accountId},o.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:jt})]})})})})}const lt=a.createContext(null);function ce(){const e=a.useContext(lt);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function To({thread:e,children:t}){const s=Ds(),n=_s(),i=st(),{searchInput:d}=ie(),m=e?.threadId,l=e?.messageId,{data:c}=Ye({...Dt(),staleTime:6e4}),h=a.useMemo(()=>c?.items??[],[c]),f=a.useMemo(()=>{if(m)return h.find(I=>I.messageId===l)??h.find(I=>I.threadId===m)},[h,m,l]),v=ps(m,l),p=f??v,b=l??p?.messageId,L=a.useMemo(()=>{if(m)return{threadId:m,mailboxId:p?.mailboxId??"",subject:p?.subject,messageId:b,authenticity:p?.authenticity}},[m,p,b]),x=a.useCallback((I,k)=>{s(I,{replace:k?.replace,query:d})},[s,d]),S=a.useCallback(I=>{b&&I.includes(b)&&n()},[b,n]),A=Qe({thread:p,isOpen:!0,onAfterOptimisticRemove:S}),T=xs(),{deleteMessages:M}=Is({mailboxId:p?.mailboxId??"",messages:h,onAfterOptimisticRemove:S}),{toggleReadFor:N}=ys({mailboxId:p?.mailboxId??"",messages:h}),q=T.focusedMessageId,j=a.useMemo(()=>h.find(I=>I.messageId===q),[h,q])??p,P=Qe({thread:j,isOpen:j?.messageId===b}),U=zs(),E=_t(),w=Qt(),D=a.useMemo(()=>zt(w,m,b),[w,m,b]),y=a.useMemo(()=>{if(j)return I=>w({threadId:j.threadId,messageId:j.messageId,mode:I})},[w,j]),{nextMessageId:_,previousMessageId:Q}=vs({context:T,orderedIds:T.orderedIds,selectedMessageId:b,enabled:!U&&!E,hasOpenThread:m!==void 0,onClose:n,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||j&&N([j.messageId],!j.isRead)},goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),F=a.useCallback(I=>{if(!I)return;const k=h.find(de=>de.messageId===I);return k?{threadId:k.threadId,messageId:I}:void 0},[h]),C={selectedMessageId:b,selectedThread:p,conversation:L,onOpenThread:x,onCloseThread:n,nextThread:F(_),previousThread:F(Q),actions:A,onReply:D,triage:T,onDeleteMessages:M,handleDeselectIfRemoved:S};return r.jsx(lt.Provider,{value:C,children:t})}function dt(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:n}=ce(),{accounts:i}=ie();return r.jsx(So,{accounts:i,selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:n})}function Co(){const e=Ie(),{conversation:t,selectedThread:s,actions:n,onReply:i,handleDeselectIfRemoved:d,onOpenThread:m}=ce(),l=!!t,c=Ts(t?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(Cs,{hasThread:l,intelligenceOpen:c.isShowing,canToggleIntelligence:c.canToggle,onToggleIntelligence:c.toggle,onReply:i?()=>i("reply"):void 0,onReplyAll:i?()=>i("reply-all"):void 0,onForward:i?()=>i("forward"):void 0,onDelete:l?n.deleteThread:void 0,onToggleStar:l?n.toggleStar:void 0,isStarred:n.isStarred,moveContext:l&&n.accountId&&n.mailboxId?{accountId:n.accountId,currentMailboxId:n.mailboxId,onMove:n.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t?r.jsx(Xe,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onOpenIntelligence:c.open,listOnScreen:!0}):r.jsx(Kt,{})})]}),r.jsx(et,{isOpen:c.drawerOpen,onClose:c.closeDrawer,thread:s,mailboxId:s?.mailboxId,accountId:s?.accountId,onAfterOptimisticRemove:d,onReplyWithText:e,onOpenThread:m})]})}function wo(){const e=Ie(),{selectedThread:t,handleDeselectIfRemoved:s,onOpenThread:n}=ce(),{onToggleIntelligence:i}=ie();return r.jsx(Ss,{onClose:i,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:s,onReplyWithText:e,onOpenThread:n})}function Ro(){const e=Ie(),{selectedThread:t,conversation:s,onOpenThread:n,onCloseThread:i,nextThread:d,previousThread:m,handleDeselectIfRemoved:l}=ce(),c=bs(s?.threadId??null);return s?r.jsxs(r.Fragment,{children:[r.jsx(Xe,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:i,onOpenIntelligence:c.toggle,onSwipeNext:d?()=>n(d):void 0,onSwipePrevious:m?()=>n(m):void 0,mobileIntelligenceOpen:c.isOpen}),r.jsx(et,{isOpen:c.isOpen,onClose:c.close,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:l,onReplyWithText:e,onOpenThread:n})]}):r.jsx("div",{className:"h-full",children:r.jsx(dt,{})})}const _o=Object.assign(To,{List:dt,Reading:Co,Intelligence:wo,Phone:Ro});export{_o as B};
@@ -0,0 +1 @@
1
+ import{j as n,f as C,t as m,_ as X,$ as ee,az as N,r as w,ay as te,X as ne,ar as se,a0 as ae}from"./index-DdgwCJ4v.js";import{R as _,k as $,J as ie,c as re,K as oe,x as le,L as ce,G as de}from"./calendar-format-C1OfWDS9.js";import{e as ue,g as j,h as me,u as he,b as U,d as xe,i as pe,t as ye,U as ve}from"./useCalendars-BLmllCqQ.js";import{C as ge}from"./calendar-clash-strip-CkUcFznp.js";const De=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Ne=["January","February","March","April","May","June","July","August","September","October","November","December"],Te=["first","second","third","fourth","last"],k="";function fe(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[s,a,r]=e.split("-").map(Number),o=new Date(Date.UTC(s,a-1,r)),i=De[o.getUTCDay()],c=Te[Math.min(Math.floor((r-1)/7),4)],l=t===""?"":`, ${t}`,d=o.getUTCDay()>=1&&o.getUTCDay()<=5;return[`Every day${l}`,...d?[`Every weekday${l}`]:[],`Every week on ${i}${l}`,`Every month on the ${c} ${i}${l}`,`Every year on ${r} ${Ne[a-1]}${l}`]}const be="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",p=({draft:e,onChange:t},s,a)=>t({...e,[s]:a});function D({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 je({draft:e,onChange:t,layout:s="compact",touch:a}){const r=s==="pane";return n.jsx(N,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:o=>p({draft:e,onChange:t},"title",o.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 Ee(e,t){return t===""?{...e,date:t}:e.endDate===""?{...e,date:t,endDate:t}:e.date===""?{...e,date:t}:{...e,date:t,endDate:$(t,ie(e.date,e.endDate))}}function Ce(e,t){const s=e.date!==""&&e.endDate===$(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:$(e.date,1)}:{...e,allDay:t}}function $e({draft:e,onChange:t,touch:s}){const a=s?"min-h-11":"",r=P(e),o=w.useId(),i={"aria-invalid":r,"aria-describedby":r?o:void 0},c=m("w-40",a,r&&"border-danger/60"),l=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(N,{type:"date",value:e.date,"aria-label":"Date",...i,onChange:d=>t(Ee(e,d.target.value)),className:c}),!e.allDay&&n.jsx(N,{type:"time",value:e.startTime,"aria-label":"Start time",...i,onChange:d=>p({draft:e,onChange:t},"startTime",d.target.value),className:l}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(N,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...i,onChange:d=>p({draft:e,onChange:t},"endDate",d.target.value),className:c}),!e.allDay&&n.jsx(N,{type:"time",value:e.endTime,"aria-label":"End time",...i,onChange:d=>p({draft:e,onChange:t},"endTime",d.target.value),className:l}),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(Ce(e,d.target.checked)),className:"size-4 accent-current"}),"All day"]})]}),r&&n.jsx("p",{id:o,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 ke({draft:e,onChange:t,calendars:s,touch:a}){return n.jsx(Fe,{calendars:s,value:e.calendarId,onChange:r=>p({draft:e,onChange:t},"calendarId",r),touch:a})}function we({draft:e,onChange:t,touch:s,repeatEditable:a=!0,onCustom:r}){return a?n.jsx(Re,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:o=>p({draft:e,onChange:t},"repeat",o),onCustom:r,className:s?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(_,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===k?"Does not repeat":e.repeat]})}function Ye({draft:e,onChange:t,touch:s}){return n.jsx(N,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:a=>p({draft:e,onChange:t},"location",a.target.value),className:s?"min-h-11":""})}function Ae({draft:e,onChange:t,touch:s}){return n.jsx(N,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:a=>p({draft:e,onChange:t},"guests",a.target.value),className:s?"min-h-11":""})}function Oe({draft:e,onChange:t,layout:s="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:a=>p({draft:e,onChange:t},"notes",a.target.value),rows:s==="pane"?6:3,className:be})}function Me({draft:e,onChange:t,calendars:s,layout:a="compact",expanded:r=!1,onToggleExpanded:o,onSave:i,onCancel:c,onDelete:l,saveLabel:d="Add",header:h,repeatEditable:u=!0,guestsEditable:x=!1,calendarEditable:y=!0,onCustomRepeat:b,touch:v,className:A}){const f=a==="pane",g={draft:e,onChange:t,layout:a,touch:v},O=n.jsx(je,{...g}),M=n.jsx($e,{...g}),R=n.jsx(ke,{...g,calendars:s}),F=n.jsx(we,{...g,repeatEditable:u,onCustom:b}),S=n.jsx(Ye,{...g}),I=n.jsx(Ae,{...g}),L=n.jsx(Oe,{...g}),B=n.jsxs("div",{className:m("flex items-center gap-2",f?"pt-2":"pt-1"),children:[n.jsx(C,{variant:"primary",size:v||f?"md":"sm",onClick:i,disabled:P(e),className:v?"min-h-11 flex-1":"",children:d}),n.jsx(C,{variant:"ghost",size:v||f?"md":"sm",onClick:c,className:v?"min-h-11":"",children:"Cancel"}),l&&n.jsx(C,{variant:"ghost",size:v||f?"md":"sm",onClick:l,className:m("ml-auto text-danger",v&&"min-h-11"),children:"Delete"})]});if(f)return n.jsxs("div",{className:m("flex flex-col gap-5",A),children:[h,n.jsx(D,{label:"Title",children:O}),n.jsx(D,{label:"When",children:M}),y&&n.jsx(D,{label:"Calendar",children:R}),n.jsx(D,{label:"Repeat",children:F}),n.jsx(D,{label:"Location",children:S}),x&&n.jsx(D,{label:"Guests",children:I}),n.jsx(D,{label:"Notes",children:L}),B]});const q=o!==void 0&&!r;return n.jsxs("div",{className:m("flex flex-col gap-3",A),children:[h,O,M,y&&R,o&&n.jsxs("button",{type:"button",onClick:o,"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",v&&"min-h-11"),children:[r?n.jsx(X,{className:"size-3.5"}):n.jsx(ee,{className:"size-3.5"}),r?"Fewer details":"More details"]}),!q&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[S,x&&I,F,L]}),B]})}const W="__custom__";function Re({value:e,date:t,startTime:s,onChange:a,onCustom:r,className:o}){const i=fe(t,s),c=e===k||i.includes(e)?i:[e,...i];return n.jsxs(te,{icon:n.jsx(_,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:l=>{if(l.target.value===W){r?.();return}a(l.target.value)},className:o,children:[n.jsx("option",{value:k,children:"Does not repeat"}),c.map(l=>n.jsx("option",{value:l,children:l},l)),r&&n.jsx("option",{value:W,children:"Custom…"})]})}function Fe({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(o=>{const i=re(o.color),c=o.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",c?m(i.soft,i.text,i.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:r,value:o.id,checked:c,onChange:()=>s(o.id),className:"sr-only"}),n.jsx("span",{className:m("size-2 rounded-full",i.solid)}),o.name]},o.id)})]})}function Se({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(ne,{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 E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],T=["SU","MO","TU","WE","TH","FR","SA"],z=["January","February","March","April","May","June","July","August","September","October","November","December"],Z=["first","second","third","fourth","last"],Y=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",Ie=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function K(e){const t=Ie(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${J}`;const s=t.match(/^Every week on (\w+)$/);if(s){const o=E.indexOf(s[1]);return o===-1?void 0:`FREQ=WEEKLY;BYDAY=${T[o]}`}const a=t.match(/^Every month on the (\w+) (\w+)$/);if(a){const o=Z.indexOf(a[1]),i=E.indexOf(a[2]);return o===-1||i===-1?void 0:`FREQ=MONTHLY;BYDAY=${Y[o]}${T[i]}`}const r=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(r){const o=z.indexOf(r[2]);return o===-1?void 0:`FREQ=YEARLY;BYMONTH=${o+1};BYMONTHDAY=${Number(r[1])}`}}const Le=e=>e===""?"":`, ${e}`;function Ze(e,t){const s=new Map(e.split(";").map(i=>i.split("=")).filter(i=>i.length===2).map(([i,c])=>[i.toUpperCase(),c.toUpperCase()])),a=Le(t),r=s.get("FREQ"),o=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(o===void 0)return;if(o===J)return`Every weekday${a}`;const i=T.indexOf(o);return i===-1?void 0:`Every week on ${E[i]}${a}`}if(r==="MONTHLY"){const i=o?.match(/^(-?\d)([A-Z]{2})$/);if(!i)return;const c=Y.indexOf(Number(i[1])),l=T.indexOf(i[2]);return c===-1||l===-1?void 0:`Every month on the ${Z[c]} ${E[l]}${a}`}if(r==="YEARLY"){const i=Number(s.get("BYMONTH")),c=Number(s.get("BYMONTHDAY"));return!i||!c||i>12?void 0:`Every year on ${c} ${z[i-1]}${a}`}}}const H=e=>Date.parse(`${e}T00:00:00Z`)/864e5;function Be(e,t,s){const a=H(s)-H(t);if(e===""||a===0||Number.isNaN(a))return e;const[r,o,i]=s.split("-").map(Number),c=new Date(Date.UTC(r,o-1,i)).getUTCDay(),l=/FREQ=(\w+)/i.exec(e)?.[1]?.toUpperCase();return e.split(";").map(d=>{const[h,u=""]=d.split("="),x=h.toUpperCase();return x==="BYDAY"&&l==="MONTHLY"?`BYDAY=${Y[Math.min(Math.floor((i-1)/7),4)]}${T[c]}`:x==="BYDAY"?`BYDAY=${u.split(",").map(y=>{const b=T.indexOf(y.toUpperCase());return b===-1?y:T[(b+a+7)%7]}).join(",")}`:x==="BYMONTH"?`BYMONTH=${o}`:x==="BYMONTHDAY"?`BYMONTHDAY=${i}`:d}).join(";")}function Je(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function Ke(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 Q(e,t){return e.allDay?{start:e.date,end:ue(e.endDate,1)}:{start:j(e.date,e.startTime,t),end:j(e.endDate,e.endTime,t)}}function G(e,t,s){const a=K(e.repeat)??"",r=e.allDay?e.date:me(t,s.anchor===""?"UTC":s.anchor).slice(0,10);return Be(a,e.date,r)}function V(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&&K(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Qe(e,t){const s=V(e,!0);if(s!=="")return{ok:!1,problem:s};const{start:a,end:r}=Q(e,t.clock);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.anchor===""?{}:{timeZone:t.anchor},recurrenceRule:G(e,a,t)}}}function Ge(e,t,s){const a=t.repeat!==e.repeat,o=t.allDay!==e.allDay||t.date!==e.date||t.startTime!==e.startTime,i=o||t.endDate!==e.endDate||t.endTime!==e.endTime,c=V(t,a);if(c!=="")return{ok:!1,problem:c};const l={};t.title.trim()!==e.title.trim()&&(l.summary=t.title.trim()),t.location!==e.location&&(l.location=t.location),t.notes!==e.notes&&(l.description=t.notes);const{start:d,end:h}=Q(t,s.clock);return o&&(l.start=d),i&&(l.end=h,l.allDay=t.allDay,s.anchor!==""&&(l.timeZone=s.anchor)),a&&(l.recurrenceRule=G(t,d,s)),{ok:!0,patch:l}}const Ue=[],We={from:"",to:""};function Ve(e,t=""){const{timeZoneByCalendarId:s}=he(),a=e.date!==""&&!e.allDay&&e.endDate!==""&&e.startTime!==""&&e.endTime!==""&&`${e.endDate}T${e.endTime}`>`${e.date}T${e.startTime}`,{instances:r,isLoading:o,error:i}=le({...a?{from:U("week",e.date).from,to:U("week",e.endDate).to}:We,calendarIds:Ue,enabled:a}),c=xe();return w.useMemo(()=>{if(!a||o||i)return;const l=j(e.date,e.startTime,c),d=j(e.endDate,e.endTime,c),h=r.filter(u=>pe(u)&&u.calendarObjectId!==t).map(u=>ye(u,s[u.calendarId]??ve,c));return ce({start:l,end:d},h).map(u=>({id:u.id,label:`${u.title}, ${de(u)}`}))},[a,o,i,e.date,e.endDate,e.startTime,e.endTime,c,r,t,s])}function qe({title:e,subtitle:t,notice:s="",calendars:a,draft:r,onChange:o,problem:i,saveLabel:c,isSaving:l,repeatEditable:d=!0,calendarEditable:h=!0,clashes:u,onSave:x,onCancel:y}){return n.jsx(Se,{title:e,subtitle:t,onClose:y,children:n.jsx(Me,{draft:r,onChange:o,calendars:a,layout:"pane",repeatEditable:d,calendarEditable:h,saveLabel:l?"Saving…":c,onSave:x,onCancel:y,header:i===""&&s===""&&u===void 0?void 0:n.jsxs("div",{className:"space-y-2",children:[s!==""&&n.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-warning/40 bg-warning-soft px-3 py-2 text-sm text-fg",children:[n.jsx(se,{className:"mt-0.5 size-4 shrink-0 text-warning","aria-hidden":"true"}),n.jsx("span",{className:"min-w-0 flex-1 break-words",children:s})]}),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})]}),u!==void 0&&n.jsx(ge,{clashes:u,clearText:"Nothing else is booked at this time."})]})})})}export{qe as C,Se as E,Q as a,Qe as c,Ke as d,Je as e,Be as m,Ge as p,Ze as t,Ve as u};
@@ -1 +1 @@
1
- import{j as t,r as e}from"./index-DKo99WG1.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-DdgwCJ4v.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-DKo99WG1.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-DdgwCJ4v.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-DKo99WG1.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-DdgwCJ4v.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-DKo99WG1.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-DdgwCJ4v.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};
@@ -0,0 +1 @@
1
+ import{eO as J,r as n,e1 as X,c as le,C as z,bq as ce,cU as ue,aH as ge,aI as he,j as r,ak as me,d4 as pe,d5 as fe}from"./index-DdgwCJ4v.js";import{u as xe,p as U,R as Ie}from"./useSearchTokenContext-DMIJPqzA.js";import{z as Te,B as ye,al as be,am as ve,aw as Re,an as Ce,a as Se,M as we,at as je,ax as Fe,av as Me,l as Oe,I as ke,N as _,L as Pe,J as Le,b as Ne,X as Ae,Y as H,Z as De,$ as Y,a0 as Z,a1 as qe,a2 as Ee,a3 as Be}from"./MailListHeader-BrXXf1Yp.js";import{u as We,l as Qe,b as ze,a as He}from"./MailViewChrome-7Gh2Vw-t.js";import{f as Ke}from"./ErrorState-DmeOZx31.js";import{d as Ve,w as Ge}from"./wizard-selection-DxUM65kM.js";import{a as Ue}from"./useMessageBodyContent-DRTP4wa0.js";import{e as _e,f as Je}from"./search-token-index-Dbim5YtJ.js";import{u as Xe}from"./sections-BHPkRjh5.js";const K=t=>({...t,starred:!0,order:"desc"}),Ye=(t={})=>X({query:K(t)});function $(t={}){const{data:e,isLoading:s,isError:a,error:i,refetch:f,fetchNextPage:l,hasNextPage:g,isFetchingNextPage:o}=We({queryKey:Ye(t),queryFn:async({pageParam:x})=>{const{data:u}=await J({query:{...K(t),continuationToken:x},throwOnError:!0});return u},initialPageParam:void 0,getNextPageParam:x=>x.continuationToken,staleTime:6e4});return{threads:n.useMemo(()=>(e?.pages??[]).flatMap(x=>x.items??[]),[e]),isLoading:s,isError:a,error:i,refetch:f,fetchNextPage:l,hasNextPage:g,isFetchingNextPage:o}}function Ze(t={}){const e={...K(t),unread:!0,count:!0,results:!1},{data:s}=le({queryKey:X({query:e}),queryFn:async()=>{const{data:a}=await J({query:e,throwOnError:!0});return a},staleTime:6e4});return s?.count}const $e=["from","subject","category","unread","starred","attachments"],et=(t,e)=>{const s=Te(t),{params:a,residual:i}=ye(e,{...s,starred:!0},$e);return{criteria:{...a,...s},residual:i}};function tt({rows:t,verb:e}){const{selectedIds:s,exitSelection:a}=Me(),i=n.useMemo(()=>Ge(t,s),[t,s]);return r.jsx(Oe,{verb:e,selection:i,selectionRestriction:"spansAccounts",onFinished:a})}function st({selectedMessageId:t,onOpenThread:e,commandsRef:s,onTriageContextChange:a,onDeleteMessages:i}){const{searchQuery:f,resultFolderIndex:l,onSearchClearQuery:g}=z(),o=xe(),k=ce(),x=ue(),[u,h]=n.useState("all"),[b,P]=n.useState(new Set),S=n.useCallback(d=>{P(C=>{const I=new Set(C);return I.has(d)?I.delete(d):I.add(d),I})},[]),w=n.useCallback(()=>{h("all"),P(new Set)},[]),T=n.useCallback(()=>{w(),g()},[w,g]),{freeText:j,tokens:v}=U(f.trim().toLowerCase(),o),L=U(f.trim(),o).freeText,{criteria:N,residual:m}=n.useMemo(()=>et({category:u,attributes:b},v),[u,b,v]),F=n.useMemo(()=>j?{...N,query:j}:N,[N,j]),{threads:A,isLoading:D,isError:y,error:E,refetch:M,fetchNextPage:B,hasNextPage:W,isFetchingNextPage:O}=$(F),p=n.useMemo(()=>Ve(A).map(be).filter(d=>ve(d,m)),[A,m]),c=n.useCallback((d,C)=>{const I=p.find(de=>de.id===d)?.threadId;I&&e?.({threadId:I,messageId:d},C)},[p,e]),R=n.useCallback(d=>{const C=d.threadId??p.find(I=>I.id===d.id)?.threadId;C&&e?.({threadId:C,messageId:d.id})},[p,e]),Q=n.useMemo(()=>Re(),[]),se=n.useMemo(()=>p.map(d=>Ce(d,l)),[p,l]),ae=Ze(F)??null,re=n.useMemo(()=>v.filter(d=>d.type!=="isStarred"),[v]),oe=Qe({chips:{category:u,attributes:b},tokens:re,reach:m.length>0?"loaded-pages":"whole-folder",onClear:T}),V=D?"loading":y?"error":p.length===0?"empty":"ready",ne=n.useCallback(()=>{const d=ge(he());window.open(d,"_blank","noopener,noreferrer")},[]),G=Se(),ie=r.jsx("div",{className:"flex h-full min-h-0 flex-col",children:r.jsxs("div",{className:"flex-1 overflow-y-auto",children:[r.jsx("div",{className:"divide-y divide-line",children:p.map(d=>r.jsx(we,{thread:d,active:d.id===t,onClick:()=>c(d.id)},d.id))}),W?r.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 r.jsx(ze,{title:"Starred",unreadCount:ae,preset:Q,selectedCategory:u,activeFilters:b,onSelectCategory:h,onToggleFilter:S,onClearFilters:w,searchResults:se,searchLoading:D,onSelectSearchResult:R,searchResultsInBody:!0,children:r.jsxs(je,{selectedMessageId:t,rows:p,onOpen:c,onDeleteMessages:i,onSelectionVerb:x.start,commandsRef:s,onTriageContextChange:a,children:[r.jsx(He,{listTitle:"Starred",sections:[{id:"flagged",threads:p}],flatList:!0,hideHeader:!0,listState:G.searchResults?"ready":V,listFilter:oe,listScopeLabel:"Starred",searchQuery:L||void 0,errorMessage:y?Ke(E):void 0,onRetry:()=>M(),onReportError:ne,selectedThreadId:t,onSelectThread:c,isDesktop:k,selectionBar:r.jsx(Fe,{title:"Starred"}),listBody:G.searchResults??(V==="ready"?ie:void 0)}),r.jsx(tt,{rows:p,verb:x.verb})]})})}const ee=n.createContext(null);function q(){const t=n.useContext(ee);if(!t)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return t}function at({thread:t,children:e}){const s=_e(),a=Je(),i=Xe(),{searchInput:f}=z(),l=t?.threadId,g=t?.messageId,{threads:o}=$(),k=n.useMemo(()=>{if(l)return o.find(c=>c.messageId===g)??o.find(c=>c.threadId===l)},[o,l,g]),x=ke(l,g),u=k??x,h=g??u?.messageId,b=n.useMemo(()=>{if(l)return{threadId:l,mailboxId:u?.mailboxId??"",subject:u?.subject,messageId:h,authenticity:u?.authenticity}},[l,u,h]),P=n.useCallback((c,R)=>{s(c,{replace:R?.replace,query:f})},[s,f]),S=n.useCallback(c=>{h&&c.includes(h)&&a()},[h,a]),w=_({thread:u,isOpen:!0,onAfterOptimisticRemove:S}),T=Pe(),{deleteMessages:j}=Le({mailboxId:u?.mailboxId??"",messages:o,onAfterOptimisticRemove:S}),{toggleReadFor:v}=Ne({mailboxId:u?.mailboxId??"",messages:o}),L=T.focusedMessageId,m=n.useMemo(()=>o.find(c=>c.messageId===L),[o,L])??u,F=_({thread:m,isOpen:m?.messageId===h}),A=Ue(),D=me(),y=pe(),E=n.useMemo(()=>fe(y,l,h),[y,l,h]),M=n.useMemo(()=>{if(m)return c=>y({threadId:m.threadId,messageId:m.messageId,mode:c})},[y,m]),{nextMessageId:B,previousMessageId:W}=Ae({context:T,orderedIds:T.orderedIds,selectedMessageId:h,enabled:!A&&!D,hasOpenThread:l!==void 0,onClose:a,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")||m&&v([m.messageId],!m.isRead)},goBrief:()=>i("brief"),goSettings:()=>i("settings")}}),O=n.useCallback(c=>{if(!c)return;const R=o.find(Q=>Q.messageId===c);return R?{threadId:R.threadId,messageId:c}:void 0},[o]),p={selectedMessageId:h,selectedThread:u,conversation:b,onOpenThread:P,onCloseThread:a,nextThread:O(B),previousThread:O(W),actions:w,onReply:E,triage:T,onDeleteMessages:j,handleDeselectIfRemoved:S};return r.jsx(ee.Provider,{value:p,children:e})}function te(){const{selectedMessageId:t,onOpenThread:e,triage:s,onDeleteMessages:a}=q();return r.jsx(st,{selectedMessageId:t,onOpenThread:e,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:a})}function rt(){const t=H(),{conversation:e,selectedThread:s,actions:a,onReply:i,handleDeselectIfRemoved:f,onOpenThread:l}=q(),g=!!e,o=Ee(e?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(Be,{hasThread:g,intelligenceOpen:o.isShowing,canToggleIntelligence:o.canToggle,onToggleIntelligence:o.toggle,onReply:i?()=>i("reply"):void 0,onReplyAll:i?()=>i("reply-all"):void 0,onForward:i?()=>i("forward"):void 0,onDelete:g?a.deleteThread:void 0,onToggleStar:g?a.toggleStar:void 0,isStarred:a.isStarred,moveContext:g&&a.accountId&&a.mailboxId?{accountId:a.accountId,currentMailboxId:a.mailboxId,onMove:a.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx(Y,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:o.open,listOnScreen:!0}):r.jsx(Ie,{})})]}),r.jsx(Z,{isOpen:o.drawerOpen,onClose:o.closeDrawer,thread:s,mailboxId:s?.mailboxId,accountId:s?.accountId,onAfterOptimisticRemove:f,onReplyWithText:t,onOpenThread:l})]})}function ot(){const t=H(),{selectedThread:e,handleDeselectIfRemoved:s,onOpenThread:a}=q(),{onToggleIntelligence:i}=z();return r.jsx(qe,{onClose:i,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:s,onReplyWithText:t,onOpenThread:a})}function nt(){const t=H(),{selectedThread:e,conversation:s,onCloseThread:a,onOpenThread:i,nextThread:f,previousThread:l,handleDeselectIfRemoved:g}=q(),o=De(s?.threadId??null);return s?r.jsxs(r.Fragment,{children:[r.jsx(Y,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:a,onOpenIntelligence:o.toggle,onSwipeNext:f?()=>i(f):void 0,onSwipePrevious:l?()=>i(l):void 0,mobileIntelligenceOpen:o.isOpen}),r.jsx(Z,{isOpen:o.isOpen,onClose:o.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:g,onReplyWithText:t,onOpenThread:i})]}):r.jsx("div",{className:"h-full",children:r.jsx(te,{})})}const ft=Object.assign(at,{List:te,Reading:rt,Intelligence:ot,Phone:nt});export{ft as F};
@@ -1 +1 @@
1
- import{r as n,c as f,d as m,G as N,j as e,bq as w,X as E}from"./index-DKo99WG1.js";import{E as u}from"./ErrorState-CHxEHbvf.js";import{D as r,C as x,u as k}from"./index-DE-NAKWZ.js";import{d as p,e as h,f as b}from"./useMessageBodyContent-BRyDdu_J.js";import{C as S}from"./confirm-dialog-CCDHX_6Q.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})]})},F=()=>{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{F};
1
+ import{r as n,c as f,d as m,G as N,j as e,bq as w,X as E}from"./index-DdgwCJ4v.js";import{E as u}from"./ErrorState-DmeOZx31.js";import{D as r,C as x,u as k}from"./index-DOsp5wL9.js";import{d as p,e as h,f as b}from"./useMessageBodyContent-DRTP4wa0.js";import{C as S}from"./confirm-dialog-CgLhcr4g.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})]})},F=()=>{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{F};