@remit/web-client-dist 0.0.636 → 0.0.637
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.
- package/assets/{BriefPane-D75cGk9R.js → BriefPane-i-1XzvAd.js} +1 -1
- package/assets/{CalendarComposePane-CQPTeieA.js → CalendarComposePane-C9LVQJgz.js} +1 -1
- package/assets/{CalendarComposeSeed-YcnTcc9q.js → CalendarComposeSeed-BcquqWwH.js} +1 -1
- package/assets/{CalendarShell-C5-6_oQz.js → CalendarShell-BrNxa6Nn.js} +1 -1
- package/assets/{EmptyState-CwwN8uxT.js → EmptyState-haDMp8Ar.js} +1 -1
- package/assets/{ErrorState-DWzQfscg.js → ErrorState-CmLGalXf.js} +1 -1
- package/assets/{FlaggedPane-Jts36qML.js → FlaggedPane-B5Ht6vwP.js} +1 -1
- package/assets/{FullCompose-CPT2R-pn.js → FullCompose-BDr9-FPu.js} +1 -1
- package/assets/{MailListHeader-BVdr1xz_.js → MailListHeader-D8dncvLk.js} +1 -1
- package/assets/{MailNav-CmvgCpY4.js → MailNav-BQXjAtKO.js} +1 -1
- package/assets/{MailShell-DpEV7moX.js → MailShell-CBX109fx.js} +1 -1
- package/assets/{MailViewChrome-DO8IvQ0g.js → MailViewChrome-K588o61G.js} +1 -1
- package/assets/{MailboxPane-BsR7VsfJ.js → MailboxPane-D9zqi3Rr.js} +1 -1
- package/assets/{NavMenuButton-6SG5syJx.js → NavMenuButton-BpGFPcon.js} +1 -1
- package/assets/{OnboardingWizard-CSUHbolo.js → OnboardingWizard-ThfV-x2z.js} +1 -1
- package/assets/{OpenCalendarEvent-CeB7apup.js → OpenCalendarEvent-BwmHUJaw.js} +1 -1
- package/assets/{OutboxPane-y8lpgoA7.js → OutboxPane-Bk9nNby0.js} +1 -1
- package/assets/_calendarObjectId-D9_7PYZI.js +1 -0
- package/assets/_mailboxId-BuhgZ4EU.js +1 -0
- package/assets/_messageId-BoJ0kGms.js +1 -0
- package/assets/_messageId-BtCpeBln.js +1 -0
- package/assets/_messageId-sDYnK_ny.js +1 -0
- package/assets/_outboxMessageId-DnZaclF5.js +1 -0
- package/assets/_recurrenceId-75JuQikX.js +1 -0
- package/assets/_threadId-DQ7XFMjK.js +1 -0
- package/assets/_threadId-Dj_Z5hNe.js +1 -0
- package/assets/_threadId-E1Ji1VBb.js +1 -0
- package/assets/{_view._date-DZANiEIP.js → _view._date-B1Vb2h-D.js} +1 -1
- package/assets/{accounts-BNbNVL6a.js → accounts-ChoqdfMH.js} +1 -1
- package/assets/{advanced-jKFdPJg9.js → advanced-BQgtDSX_.js} +1 -1
- package/assets/{appearance-szgjdrBE.js → appearance-CiLCRkQD.js} +1 -1
- package/assets/{attendee-row-BMb3eM14.js → attendee-row-DMe42k7H.js} +1 -1
- package/assets/{avatar-BI9-h2CG.js → avatar-OJww5F3k.js} +1 -1
- package/assets/{bell-off-CC53fBB2.js → bell-off-JyhxJiJh.js} +1 -1
- package/assets/{bottom-sheet-D8oEb9Zv.js → bottom-sheet-BXHtkHEQ.js} +1 -1
- package/assets/brief-3daIc_U_.js +1 -0
- package/assets/{brief-DE8_cylr.js → brief-Ct3P0mmd.js} +1 -1
- package/assets/{browser-ponyfill-CRcfJGCX.js → browser-ponyfill-BZhAFCLP.js} +1 -1
- package/assets/{bug-Dh0UIzTd.js → bug-BXAS92HM.js} +1 -1
- package/assets/{calendar-DI1uSMAF.js → calendar-CIrHuuJU.js} +1 -1
- package/assets/{calendar-clash-strip-BeF8DhB-.js → calendar-clash-strip-Do_J9SgJ.js} +1 -1
- package/assets/{calendar-format-nYSxDVLX.js → calendar-format-CwRw4RDu.js} +1 -1
- package/assets/{calendar-report-_QLAbdRS.js → calendar-report-DMvb9Sqg.js} +1 -1
- package/assets/{calendar-suggestion-E9w2nRWu.js → calendar-suggestion-f9IkXHda.js} +1 -1
- package/assets/{calendars-Boz0CIFB.js → calendars-FdgmByI_.js} +1 -1
- package/assets/{card-BmYyqZU8.js → card-Cj-QGmCF.js} +1 -1
- package/assets/{checkbox-CZD6i6IR.js → checkbox-SlSTA73y.js} +1 -1
- package/assets/chevron-left-CyT8rYCK.js +1 -0
- package/assets/{circle-check-Bpm-cdIg.js → circle-check-Bp2lyV0E.js} +1 -1
- package/assets/{circle-check-big-CA-bYUtr.js → circle-check-big-Vq2QoGgP.js} +1 -1
- package/assets/{circle-help-gF5YAjts.js → circle-help-gen-dtEL.js} +1 -1
- package/assets/{clock-CHCFgl4d.js → clock-BBpIdhnS.js} +1 -1
- package/assets/compose._-_outboxMessageId_-Bx07nXWx.js +1 -0
- package/assets/compose._-_outboxMessageId_-BxSDuFqr.js +1 -0
- package/assets/compose._-_outboxMessageId_-Dskdpi6-.js +1 -0
- package/assets/compose._-_outboxMessageId_-f_gWZERZ.js +1 -0
- package/assets/{config-import-D9ehhdRH.js → config-import-DwGVp5nY.js} +1 -1
- package/assets/{confirm-dialog-CocDko9U.js → confirm-dialog-DqUyGPYb.js} +1 -1
- package/assets/{copy-DgGekFwr.js → copy-BFnJYo3G.js} +1 -1
- package/assets/{credential-steps-C6B4LLDZ.js → credential-steps-BYrGAoU5.js} +1 -1
- package/assets/{download-CHu9yf-9.js → download-CExFNT5m.js} +1 -1
- package/assets/{file-json-lCoJ4MMG.js → file-json-ChcZbyWI.js} +1 -1
- package/assets/{filters-CgNi0_GK.js → filters-DSI3RcDp.js} +1 -1
- package/assets/{flagged-C06PvFbr.js → flagged-BTuHoVag.js} +1 -1
- package/assets/flagged-BZt2fsuR.js +1 -0
- package/assets/{folders-BC2O8pN-.js → folders-B3UvbiMG.js} +1 -1
- package/assets/{help-copy-0vW7Uvdo.js → help-copy-BpnCsJKm.js} +1 -1
- package/assets/{import-BJiWqnIA.js → import-BtjgDhbI.js} +1 -1
- package/assets/index-BS7Corg7.js +1 -0
- package/assets/index-BbW12rrk.js +1 -0
- package/assets/{index-CTrN7dU7.js → index-BgsHJXrW.js} +4 -4
- package/assets/index-BtCpeBln.js +1 -0
- package/assets/index-C1YxhEeX.js +1 -0
- package/assets/{index-DdmJVTyk.js → index-C44gqDSI.js} +1 -1
- package/assets/index-CB6Q9Qtt.js +1 -0
- package/assets/{index-DMA0YSsS.js → index-CEJMvVKP.js} +4 -4
- package/assets/index-CTeWdcpn.js +1 -0
- package/assets/index-CWfcTzfZ.js +1 -0
- package/assets/index-Dt3c3MCO.js +1 -0
- package/assets/index-sDYnK_ny.js +1 -0
- package/assets/{kbd-DNmTK9ke.js → kbd-o1nflZRu.js} +1 -1
- package/assets/{labels-1K3nCcmA.js → labels-DHP_zjK4.js} +1 -1
- package/assets/{mail-DverAFVu.js → mail-Szc-p5g3.js} +1 -1
- package/assets/{mail-2Lzca0sU.js → mail-xjJzF7Ec.js} +1 -1
- package/assets/{menu-AiRz5rLS.js → menu-B7ZT3hES.js} +1 -1
- package/assets/minus-BD2hQqDO.js +1 -0
- package/assets/{new-DHyHJz8l.js → new-DHxq4krb.js} +1 -1
- package/assets/onboarding-CdkmnzTh.js +1 -0
- package/assets/{onboarding-completion-Bgona01R.js → onboarding-completion-DIPuDK0D.js} +1 -1
- package/assets/outbox-BeQ7n9ml.js +1 -0
- package/assets/{pane-header-C6F97UxO.js → pane-header-BCtLNcGD.js} +1 -1
- package/assets/{pencil-DpZEcc9Q.js → pencil-BDdwSTNF.js} +1 -1
- package/assets/{popover-menu-I_p7C4RX.js → popover-menu-DH1B01dU.js} +1 -1
- package/assets/{refresh-cw-CrSEtN0j.js → refresh-cw-DmMLGyvw.js} +1 -1
- package/assets/{rich-text-BY2WyJzR.js → rich-text-DEvS7fTK.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-C53QtR8U.js → rich-text-spellcheck-worker-provider-BKBVX-2v.js} +1 -1
- package/assets/{rotate-ccw-BwoJPdTA.js → rotate-ccw-BzTXXy6H.js} +1 -1
- package/assets/{roving-focus-BYBMU9YM.js → roving-focus-D8ieiood.js} +1 -1
- package/assets/{row-actions-M9Ety9op.js → row-actions-d4_6b5VY.js} +1 -1
- package/assets/{search-mirror-C1R24HUl.js → search-mirror-wk9khC5m.js} +1 -1
- package/assets/{search-token-index-BinolOMC.js → search-token-index-CrVbBlms.js} +1 -1
- package/assets/{sections-CfTDsSEu.js → sections-CgVZgQC0.js} +1 -1
- package/assets/{senders-CxFpOLNR.js → senders-mxAKZ_FE.js} +1 -1
- package/assets/settings-Gkdms0mB.js +1 -0
- package/assets/{settings-screen-BVPfYXKu.js → settings-screen-Bsl0UC9v.js} +1 -1
- package/assets/{shield-check-B8NtyqSa.js → shield-check-CUjnaEJM.js} +1 -1
- package/assets/{suggested-vips-CvGUhfMR.js → suggested-vips-BENsVw__.js} +1 -1
- package/assets/{undo-2-DafMLJl8.js → undo-2-QAbYZsVP.js} +1 -1
- package/assets/{useCalendarData-CEqOF86-.js → useCalendarData-J9M1uPwl.js} +1 -1
- package/assets/{useCalendarWrites-B66T9V8C.js → useCalendarWrites-CMxbq1Ns.js} +1 -1
- package/assets/{useCalendars-DSVgnNGS.js → useCalendars-DEAe0d5P.js} +1 -1
- package/assets/{useDebouncedValue-DgoW2gtH.js → useDebouncedValue-CypIbLxd.js} +1 -1
- package/assets/{useFilters-CI6nPI8A.js → useFilters-Cv87jtMp.js} +1 -1
- package/assets/{useLabels-BLAR4UCi.js → useLabels-B74FIyrh.js} +1 -1
- package/assets/{useLayoutTier-Cs2hRSyr.js → useLayoutTier-BnLQZtW5.js} +1 -1
- package/assets/{useMessageBodyContent-C6WheWR5.js → useMessageBodyContent-QMy924K4.js} +1 -1
- package/assets/{useQueries-8ibIA6jj.js → useQueries-DBc1JIwH.js} +1 -1
- package/assets/{useRefreshControl-BHFXn1pg.js → useRefreshControl-DNtJwW7i.js} +1 -1
- package/assets/{useResultFolderIndex-BhA2C88T.js → useResultFolderIndex-BeXuylki.js} +1 -1
- package/assets/{useSearchTokenContext-BZ3hasAQ.js → useSearchTokenContext-_mPqHIqE.js} +1 -1
- package/assets/{useSemanticSearch-BPL9gQ__.js → useSemanticSearch-JUvleuzy.js} +1 -1
- package/assets/{useSignature-COUd5paq.js → useSignature-_lI__r_z.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_calendarObjectId-CIuW-Ie5.js +0 -1
- package/assets/_mailboxId-5RNGPJGS.js +0 -1
- package/assets/_messageId-BuD0qcm0.js +0 -1
- package/assets/_messageId-DUkglFhL.js +0 -1
- package/assets/_messageId-DfTFQr44.js +0 -1
- package/assets/_outboxMessageId-jTJb98_M.js +0 -1
- package/assets/_recurrenceId-CKRdebZ4.js +0 -1
- package/assets/_threadId-9TH68C7M.js +0 -1
- package/assets/_threadId-BzUUgT3O.js +0 -1
- package/assets/_threadId-CqA1Cn_c.js +0 -1
- package/assets/brief-Bd33YTD_.js +0 -1
- package/assets/chevron-left-B1U3lovQ.js +0 -1
- package/assets/compose._-_outboxMessageId_-BH8gcpDj.js +0 -1
- package/assets/compose._-_outboxMessageId_-D3WpZSA8.js +0 -1
- package/assets/compose._-_outboxMessageId_-DI8h85aO.js +0 -1
- package/assets/compose._-_outboxMessageId_-WBhljHnY.js +0 -1
- package/assets/flagged-BRQyqp_w.js +0 -1
- package/assets/index-6DAZlug3.js +0 -1
- package/assets/index-B4H0cbaA.js +0 -1
- package/assets/index-BuD0qcm0.js +0 -1
- package/assets/index-CEzeDIpM.js +0 -1
- package/assets/index-CdEqoUhn.js +0 -1
- package/assets/index-CxnKAlnw.js +0 -1
- package/assets/index-DfTFQr44.js +0 -1
- package/assets/index-XCWyX4Nu.js +0 -1
- package/assets/index-jeAFdPQ9.js +0 -1
- package/assets/minus-QLsR9rVM.js +0 -1
- package/assets/onboarding-CRGGfEXZ.js +0 -1
- package/assets/outbox-egss0WYm.js +0 -1
- package/assets/settings-I6fzE2gz.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n,L as kt,W as Et,eL as We,eM as ne,e0 as re,r,c as $e,C as ie,bq as Ot,cT as Ft,K as At,dS as Nt,eN as Bt,eO as Lt,a0 as Ye,ej as qt,eP as Pt,ak as _t,d3 as Dt,d4 as Qt}from"./index-CTrN7dU7.js";import{g as Ve,e as zt,f as Je,u as Ht,p as Kt,R as Ut}from"./useSearchTokenContext-BZ3hasAQ.js";import{a7 as Gt,z as Wt,B as $t,aj as Yt,ak as Vt,al as Jt,am as _e,an as Zt,ao as Xt,a6 as es,ap as ts,aq as ss,ar as os,ae as ns,M as rs,as,af as is,at as cs,au as ls,d as ds,o as us,ah as fs,l as ms,S as hs,I as gs,N as De,L as ps,J as xs,b as Is,X as ys,Y as vs,_ as Ze,$ as Xe,a0 as bs,a1 as Ss,a2 as Cs}from"./MailListHeader-BVdr1xz_.js";import{u as Ts,a as ws,R as Rs,b as Ms,c as js}from"./useRefreshControl-BHFXn1pg.js";import{u as ae}from"./useQueries-8ibIA6jj.js";import{t as et,s as ks,u as Es,r as Os,L as Fs}from"./useSemanticSearch-BPL9gQ__.js";import{a as As}from"./useLabels-BLAR4UCi.js";import{u as Ns}from"./useLayoutTier-Cs2hRSyr.js";import{d as Bs,w as Ls}from"./wizard-selection-DxUM65kM.js";import{m as qs,e as Ps,f as _s}from"./search-token-index-BinolOMC.js";import{u as tt}from"./sections-CfTDsSEu.js";import{R as Ds}from"./refresh-cw-CrSEtN0j.js";import{a as Qs}from"./useMessageBodyContent-C6WheWR5.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(!(!We(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},Ws=(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)])},$s=(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}=$e({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=Wt({category:e,attributes:t}),{params:c,residual:d}=$t(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=Os(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}=As(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]),A=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(Fs,{accountId:m.accountId,mailboxId:m.mailboxId,messageIds:b}):void 0,selectAll:S,notice:A});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=Ot(),p=Ns(),b=Ft(),L=qs(),x=r.useMemo(()=>io(e.filter(o=>!o.muted?.value)),[e]),[S,A]=r.useState("all"),[C,M]=r.useState("all"),[N,q]=r.useState(new Set),[le,j]=r.useState(!1),P=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:_}=Kt(d.trim().toLowerCase(),m),y=w.length>0,D=r.useMemo(()=>Qe({query:l,ownFilters:N}),[l,N]),Q=r.useMemo(()=>ze({query:l,ownCategory:C}),[l,C]),F=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)){P(o);return}const f=Ws(l,o);f!==void 0&&h(f)},[E,l,h,P]),k=r.useCallback(o=>{if(!E){M(o);return}h($s(l,o))},[E,l,h]),de=r.useMemo(()=>T==="all"&&!y?o=>{We(o)&&k(o)}:void 0,[T,y,k]),ue=r.useCallback(()=>{M("all"),A("all"),U(),E&&h(Ys(l))},[E,l,h,U]),G=ae({queries:x.map(o=>({...At({path:{accountId:o.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),W=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((O,jt)=>O+(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:$}=r.useMemo(()=>uo(T,F,_,S==="all"?void 0:S),[T,F,_,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:$,attributes:F}),{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(F),[F]),V=r.useCallback(o=>Bs(o).map(Vt).filter(f=>Bt(f,Me)&&Jt(f,$)),[Me,$]),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:$.length})}),{spamIds:he,briefSpamOffer:X}=r.useMemo(()=>{const o={spamIds:void 0,briefSpamOffer:void 0};if(!w)return o;const f=R.map(O=>_e(O,u)),{spam:g}=Zt(f),B=new Map;for(const O of g)O.mailboxId&&B.set(O.mailboxId,(B.get(O.mailboxId)??0)+1);const te=ho(je,{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,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:W.get(o.accountId),active:S===o.accountId}))],[x,W,S]),z=r.useMemo(()=>e.filter(o=>o.muted?.value).length,[e]),yt=r.useMemo(()=>Array.from(W.values()).reduce((o,f)=>o+f,0),[W]),pe=r.useMemo(()=>x.map(o=>o.accountId),[x]),{hasNewMail:Oe}=Ts(),{state:Fe,errorMessage:Ae,refresh:Ne}=ws(pe,{onSettled:()=>Re()}),vt=r.useMemo(()=>n.jsx(Rs,{state:Fe,onRefresh:Ne,label:"Refresh daily brief",errorMessage:Ae,hasUpdate:Oe(pe)}),[Fe,Ne,Ae,Oe,pe]),xe=r.useMemo(()=>R.map(o=>_e(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:D,expanded:le,onExpandedChange:j,onSelectCategory:f=>k(f),onSelectSource:A,onToggleFilter:f=>I(f),onClear:ue}},[ge,z,Q,D,le,I,k,ue]),Le=ke.length===0&&S==="all"&&w.length===0&&_.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,{})]}),Pe=!me&&!we&&!Le,Rt=ss({tier:p,hasLiveInput:E,hasCommittedQuery:d.trim().length>0,bodyRendersCommittedResults:!0}),Mt=Pe?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:A,activeFilters:D,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(Ds,{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:Pe&&!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=Ps(),a=_s(),i=tt(),{searchInput:c}=ie(),d=e?.threadId,l=e?.messageId,{data:u}=$e({...Pt(),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]),A=De({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,P=De({thread:j,isOpen:j?.messageId===b}),U=Qs(),E=_t(),w=Dt(),_=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:D,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")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{C.listCommandsRef.current?.requestVerb("markRead")||j&&N([j.messageId],!j.isRead)},goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),F=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:F(D),previousThread:F(Q),actions:A,onReply:_,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 _o=Object.assign(So,{List:lt,Reading:Co,Intelligence:To,Phone:wo});export{_o as B};
|
|
1
|
+
import{j as n,L as kt,W as Et,eL as We,eM as ne,e0 as re,r,c as $e,C as ie,bq as Ot,cT as Ft,K as At,dS as Nt,eN as Bt,eO as Lt,a0 as Ye,ej as qt,eP as Pt,ak as _t,d3 as Dt,d4 as Qt}from"./index-BgsHJXrW.js";import{g as Ve,e as zt,f as Je,u as Ht,p as Kt,R as Ut}from"./useSearchTokenContext-_mPqHIqE.js";import{a7 as Gt,z as Wt,B as $t,aj as Yt,ak as Vt,al as Jt,am as _e,an as Zt,ao as Xt,a6 as es,ap as ts,aq as ss,ar as os,ae as ns,M as rs,as,af as is,at as cs,au as ls,d as ds,o as us,ah as fs,l as ms,S as hs,I as gs,N as De,L as ps,J as xs,b as Is,X as ys,Y as vs,_ as Ze,$ as Xe,a0 as bs,a1 as Ss,a2 as Cs}from"./MailListHeader-D8dncvLk.js";import{u as Ts,a as ws,R as Rs,b as Ms,c as js}from"./useRefreshControl-DNtJwW7i.js";import{u as ae}from"./useQueries-DBc1JIwH.js";import{t as et,s as ks,u as Es,r as Os,L as Fs}from"./useSemanticSearch-JUvleuzy.js";import{a as As}from"./useLabels-B74FIyrh.js";import{u as Ns}from"./useLayoutTier-BnLQZtW5.js";import{d as Bs,w as Ls}from"./wizard-selection-DxUM65kM.js";import{m as qs,e as Ps,f as _s}from"./search-token-index-CrVbBlms.js";import{u as tt}from"./sections-CgVZgQC0.js";import{R as Ds}from"./refresh-cw-DmMLGyvw.js";import{a as Qs}from"./useMessageBodyContent-QMy924K4.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(!(!We(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},Ws=(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)])},$s=(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}=$e({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=Wt({category:e,attributes:t}),{params:c,residual:d}=$t(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=Os(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}=As(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]),A=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(Fs,{accountId:m.accountId,mailboxId:m.mailboxId,messageIds:b}):void 0,selectAll:S,notice:A});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=Ot(),p=Ns(),b=Ft(),L=qs(),x=r.useMemo(()=>io(e.filter(o=>!o.muted?.value)),[e]),[S,A]=r.useState("all"),[C,M]=r.useState("all"),[N,q]=r.useState(new Set),[le,j]=r.useState(!1),P=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:_}=Kt(d.trim().toLowerCase(),m),y=w.length>0,D=r.useMemo(()=>Qe({query:l,ownFilters:N}),[l,N]),Q=r.useMemo(()=>ze({query:l,ownCategory:C}),[l,C]),F=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)){P(o);return}const f=Ws(l,o);f!==void 0&&h(f)},[E,l,h,P]),k=r.useCallback(o=>{if(!E){M(o);return}h($s(l,o))},[E,l,h]),de=r.useMemo(()=>T==="all"&&!y?o=>{We(o)&&k(o)}:void 0,[T,y,k]),ue=r.useCallback(()=>{M("all"),A("all"),U(),E&&h(Ys(l))},[E,l,h,U]),G=ae({queries:x.map(o=>({...At({path:{accountId:o.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),W=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((O,jt)=>O+(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:$}=r.useMemo(()=>uo(T,F,_,S==="all"?void 0:S),[T,F,_,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:$,attributes:F}),{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(F),[F]),V=r.useCallback(o=>Bs(o).map(Vt).filter(f=>Bt(f,Me)&&Jt(f,$)),[Me,$]),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:$.length})}),{spamIds:he,briefSpamOffer:X}=r.useMemo(()=>{const o={spamIds:void 0,briefSpamOffer:void 0};if(!w)return o;const f=R.map(O=>_e(O,u)),{spam:g}=Zt(f),B=new Map;for(const O of g)O.mailboxId&&B.set(O.mailboxId,(B.get(O.mailboxId)??0)+1);const te=ho(je,{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,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:W.get(o.accountId),active:S===o.accountId}))],[x,W,S]),z=r.useMemo(()=>e.filter(o=>o.muted?.value).length,[e]),yt=r.useMemo(()=>Array.from(W.values()).reduce((o,f)=>o+f,0),[W]),pe=r.useMemo(()=>x.map(o=>o.accountId),[x]),{hasNewMail:Oe}=Ts(),{state:Fe,errorMessage:Ae,refresh:Ne}=ws(pe,{onSettled:()=>Re()}),vt=r.useMemo(()=>n.jsx(Rs,{state:Fe,onRefresh:Ne,label:"Refresh daily brief",errorMessage:Ae,hasUpdate:Oe(pe)}),[Fe,Ne,Ae,Oe,pe]),xe=r.useMemo(()=>R.map(o=>_e(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:D,expanded:le,onExpandedChange:j,onSelectCategory:f=>k(f),onSelectSource:A,onToggleFilter:f=>I(f),onClear:ue}},[ge,z,Q,D,le,I,k,ue]),Le=ke.length===0&&S==="all"&&w.length===0&&_.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,{})]}),Pe=!me&&!we&&!Le,Rt=ss({tier:p,hasLiveInput:E,hasCommittedQuery:d.trim().length>0,bodyRendersCommittedResults:!0}),Mt=Pe?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:A,activeFilters:D,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(Ds,{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:Pe&&!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=Ps(),a=_s(),i=tt(),{searchInput:c}=ie(),d=e?.threadId,l=e?.messageId,{data:u}=$e({...Pt(),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]),A=De({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,P=De({thread:j,isOpen:j?.messageId===b}),U=Qs(),E=_t(),w=Dt(),_=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:D,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")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{C.listCommandsRef.current?.requestVerb("markRead")||j&&N([j.messageId],!j.isRead)},goFlagged:()=>i("flagged"),goSettings:()=>i("settings")}}),F=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:F(D),previousThread:F(Q),actions:A,onReply:_,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 _o=Object.assign(So,{List:lt,Reading:Co,Intelligence:To,Phone:wo});export{_o as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n,f as C,t as h,_ as X,$ as ee,az as D,r as w,ay as te,X as ne,a0 as se}from"./index-CTrN7dU7.js";import{R as _,k as $,I as ae,c as ie,J as re,v as oe,K as le,F as ce}from"./calendar-format-nYSxDVLX.js";import{b as de,g as j,h as ue,u as me,e as U,d as he,i as xe,t as pe,U as ye}from"./useCalendars-DSVgnNGS.js";import{C as ve}from"./calendar-clash-strip-BeF8DhB-.js";const ge=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],De=["January","February","March","April","May","June","July","August","September","October","November","December"],Ne=["first","second","third","fourth","last"],k="";function Te(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=ge[i.getUTCDay()],c=Ne[Math.min(Math.floor((r-1)/7),4)],l=t===""?"":`, ${t}`,d=i.getUTCDay()>=1&&i.getUTCDay()<=5;return[`Every day${l}`,...d?[`Every weekday${l}`]:[],`Every week on ${o}${l}`,`Every month on the ${c} ${o}${l}`,`Every year on ${r} ${De[a-1]}${l}`]}const fe="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 g({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 be({draft:e,onChange:t,layout:s="compact",touch:a}){const r=s==="pane";return n.jsx(D,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:i=>p({draft:e,onChange:t},"title",i.target.value),className:h(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 je(e,t){return t===""?{...e,date:t}:e.endDate===""?{...e,date:t,endDate:t}:e.date===""?{...e,date:t}:{...e,date:t,endDate:$(t,ae(e.date,e.endDate))}}function Ee(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 Ce({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},c=h("w-40",a,r&&"border-danger/60"),l=h("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(D,{type:"date",value:e.date,"aria-label":"Date",...o,onChange:d=>t(je(e,d.target.value)),className:c}),!e.allDay&&n.jsx(D,{type:"time",value:e.startTime,"aria-label":"Start time",...o,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(D,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...o,onChange:d=>p({draft:e,onChange:t},"endDate",d.target.value),className:c}),!e.allDay&&n.jsx(D,{type:"time",value:e.endTime,"aria-label":"End time",...o,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(Ee(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 $e({draft:e,onChange:t,calendars:s,touch:a}){return n.jsx(Re,{calendars:s,value:e.calendarId,onChange:r=>p({draft:e,onChange:t},"calendarId",r),touch:a})}function ke({draft:e,onChange:t,touch:s,repeatEditable:a=!0,onCustom:r}){return a?n.jsx(Me,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:i=>p({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(_,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===k?"Does not repeat":e.repeat]})}function we({draft:e,onChange:t,touch:s}){return n.jsx(D,{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 Ye({draft:e,onChange:t,touch:s}){return n.jsx(D,{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 Ae({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:fe})}function Oe({draft:e,onChange:t,calendars:s,layout:a="compact",expanded:r=!1,onToggleExpanded:i,onSave:o,onCancel:c,onDelete:l,saveLabel:d="Add",header:m,repeatEditable:u=!0,guestsEditable:x=!1,calendarEditable:T=!0,onCustomRepeat:b,touch:y,className:A}){const f=a==="pane",v={draft:e,onChange:t,layout:a,touch:y},O=n.jsx(be,{...v}),M=n.jsx(Ce,{...v}),R=n.jsx($e,{...v,calendars:s}),F=n.jsx(ke,{...v,repeatEditable:u,onCustom:b}),I=n.jsx(we,{...v}),S=n.jsx(Ye,{...v}),L=n.jsx(Ae,{...v}),B=n.jsxs("div",{className:h("flex items-center gap-2",f?"pt-2":"pt-1"),children:[n.jsx(C,{variant:"primary",size:y||f?"md":"sm",onClick:o,disabled:P(e),className:y?"min-h-11 flex-1":"",children:d}),n.jsx(C,{variant:"ghost",size:y||f?"md":"sm",onClick:c,className:y?"min-h-11":"",children:"Cancel"}),l&&n.jsx(C,{variant:"ghost",size:y||f?"md":"sm",onClick:l,className:h("ml-auto text-danger",y&&"min-h-11"),children:"Delete"})]});if(f)return n.jsxs("div",{className:h("flex flex-col gap-5",A),children:[m,n.jsx(g,{label:"Title",children:O}),n.jsx(g,{label:"When",children:M}),T&&n.jsx(g,{label:"Calendar",children:R}),n.jsx(g,{label:"Repeat",children:F}),n.jsx(g,{label:"Location",children:I}),x&&n.jsx(g,{label:"Guests",children:S}),n.jsx(g,{label:"Notes",children:L}),B]});const q=i!==void 0&&!r;return n.jsxs("div",{className:h("flex flex-col gap-3",A),children:[m,O,M,T&&R,i&&n.jsxs("button",{type:"button",onClick:i,"aria-expanded":r,className:h("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",y&&"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:[I,x&&S,F,L]}),B]})}const W="__custom__";function Me({value:e,date:t,startTime:s,onChange:a,onCustom:r,className:i}){const o=Te(t,s),c=e===k||o.includes(e)?o:[e,...o];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:i,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 Re({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=ie(i.color),c=i.id===t;return n.jsxs("label",{className:h("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?h(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:c,onChange:()=>s(i.id),className:"sr-only"}),n.jsx("span",{className:h("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:h("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"],N=["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 i=E.indexOf(s[1]);return i===-1?void 0:`FREQ=WEEKLY;BYDAY=${N[i]}`}const a=t.match(/^Every month on the (\w+) (\w+)$/);if(a){const i=z.indexOf(a[1]),o=E.indexOf(a[2]);return i===-1||o===-1?void 0:`FREQ=MONTHLY;BYDAY=${Y[i]}${N[o]}`}const r=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(r){const i=Z.indexOf(r[2]);return i===-1?void 0:`FREQ=YEARLY;BYMONTH=${i+1};BYMONTHDAY=${Number(r[1])}`}}const Se=e=>e===""?"":`, ${e}`;function Ze(e,t){const s=new Map(e.split(";").map(o=>o.split("=")).filter(o=>o.length===2).map(([o,c])=>[o.toUpperCase(),c.toUpperCase()])),a=Se(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===J)return`Every weekday${a}`;const o=N.indexOf(i);return o===-1?void 0:`Every week on ${E[o]}${a}`}if(r==="MONTHLY"){const o=i?.match(/^(-?\d)([A-Z]{2})$/);if(!o)return;const c=Y.indexOf(Number(o[1])),l=N.indexOf(o[2]);return c===-1||l===-1?void 0:`Every month on the ${z[c]} ${E[l]}${a}`}if(r==="YEARLY"){const o=Number(s.get("BYMONTH")),c=Number(s.get("BYMONTHDAY"));return!o||!c||o>12?void 0:`Every year on ${c} ${Z[o-1]}${a}`}}}const H=e=>Date.parse(`${e}T00:00:00Z`)/864e5;function Le(e,t,s){const a=H(s)-H(t);if(e===""||a===0||Number.isNaN(a))return e;const[r,i,o]=s.split("-").map(Number),c=new Date(Date.UTC(r,i-1,o)).getUTCDay(),l=/FREQ=(\w+)/i.exec(e)?.[1]?.toUpperCase();return e.split(";").map(d=>{const[m,u=""]=d.split("="),x=m.toUpperCase();return x==="BYDAY"&&l==="MONTHLY"?`BYDAY=${Y[Math.min(Math.floor((o-1)/7),4)]}${N[c]}`:x==="BYDAY"?`BYDAY=${u.split(",").map(T=>{const b=N.indexOf(T.toUpperCase());return b===-1?T:N[(b+a+7)%7]}).join(",")}`:x==="BYMONTH"?`BYMONTH=${i}`:x==="BYMONTHDAY"?`BYMONTHDAY=${o}`:d}).join(";")}function ze(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function Je(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endDate:re(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:de(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:ue(t,s.anchor===""?"UTC":s.anchor).slice(0,10);return Le(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 Ke(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 Qe(e,t,s){const a=t.repeat!==e.repeat,i=t.allDay!==e.allDay||t.date!==e.date||t.startTime!==e.startTime,o=i||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:m}=Q(t,s.clock);return i&&(l.start=d),o&&(l.end=m,l.allDay=t.allDay,s.anchor!==""&&(l.timeZone=s.anchor)),a&&(l.recurrenceRule=G(t,d,s)),{ok:!0,patch:l}}const Be=[],Ue={from:"",to:""};function Ge(e,t=""){const{timeZoneByCalendarId:s}=me(),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}=oe({...a?{from:U("week",e.date).from,to:U("week",e.endDate).to}:Ue,calendarIds:Be,enabled:a}),c=he();return w.useMemo(()=>{if(!a||i||o)return;const l=j(e.date,e.startTime,c),d=j(e.endDate,e.endTime,c),m=r.filter(u=>xe(u)&&u.calendarObjectId!==t).map(u=>pe(u,s[u.calendarId]??ye,c));return le({start:l,end:d},m).map(u=>({id:u.id,label:`${u.title}, ${ce(u)}`}))},[a,i,o,e.date,e.endDate,e.startTime,e.endTime,c,r,t,s])}function Ve({title:e,subtitle:t,calendars:s,draft:a,onChange:r,problem:i,saveLabel:o,isSaving:c,repeatEditable:l=!0,calendarEditable:d=!0,clashes:m,onSave:u,onCancel:x}){return n.jsx(Fe,{title:e,subtitle:t,onClose:x,children:n.jsx(Oe,{draft:a,onChange:r,calendars:s,layout:"pane",repeatEditable:l,calendarEditable:d,saveLabel:c?"Saving…":o,onSave:u,onCancel:x,header:i===""&&m===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(se,{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})]}),m!==void 0&&n.jsx(ve,{clashes:m,clearText:"Nothing else is booked at this time."})]})})})}export{Ve as C,Ke as c,Je as d,ze as e,Le as m,Qe as p,Ze as t,Ge as u};
|
|
1
|
+
import{j as n,f as C,t as h,_ as X,$ as ee,az as D,r as w,ay as te,X as ne,a0 as se}from"./index-BgsHJXrW.js";import{R as _,k as $,I as ae,c as ie,J as re,v as oe,K as le,F as ce}from"./calendar-format-CwRw4RDu.js";import{b as de,g as j,h as ue,u as me,e as U,d as he,i as xe,t as pe,U as ye}from"./useCalendars-DEAe0d5P.js";import{C as ve}from"./calendar-clash-strip-Do_J9SgJ.js";const ge=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],De=["January","February","March","April","May","June","July","August","September","October","November","December"],Ne=["first","second","third","fourth","last"],k="";function Te(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=ge[i.getUTCDay()],c=Ne[Math.min(Math.floor((r-1)/7),4)],l=t===""?"":`, ${t}`,d=i.getUTCDay()>=1&&i.getUTCDay()<=5;return[`Every day${l}`,...d?[`Every weekday${l}`]:[],`Every week on ${o}${l}`,`Every month on the ${c} ${o}${l}`,`Every year on ${r} ${De[a-1]}${l}`]}const fe="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 g({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 be({draft:e,onChange:t,layout:s="compact",touch:a}){const r=s==="pane";return n.jsx(D,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:i=>p({draft:e,onChange:t},"title",i.target.value),className:h(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 je(e,t){return t===""?{...e,date:t}:e.endDate===""?{...e,date:t,endDate:t}:e.date===""?{...e,date:t}:{...e,date:t,endDate:$(t,ae(e.date,e.endDate))}}function Ee(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 Ce({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},c=h("w-40",a,r&&"border-danger/60"),l=h("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(D,{type:"date",value:e.date,"aria-label":"Date",...o,onChange:d=>t(je(e,d.target.value)),className:c}),!e.allDay&&n.jsx(D,{type:"time",value:e.startTime,"aria-label":"Start time",...o,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(D,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...o,onChange:d=>p({draft:e,onChange:t},"endDate",d.target.value),className:c}),!e.allDay&&n.jsx(D,{type:"time",value:e.endTime,"aria-label":"End time",...o,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(Ee(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 $e({draft:e,onChange:t,calendars:s,touch:a}){return n.jsx(Re,{calendars:s,value:e.calendarId,onChange:r=>p({draft:e,onChange:t},"calendarId",r),touch:a})}function ke({draft:e,onChange:t,touch:s,repeatEditable:a=!0,onCustom:r}){return a?n.jsx(Me,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:i=>p({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(_,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===k?"Does not repeat":e.repeat]})}function we({draft:e,onChange:t,touch:s}){return n.jsx(D,{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 Ye({draft:e,onChange:t,touch:s}){return n.jsx(D,{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 Ae({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:fe})}function Oe({draft:e,onChange:t,calendars:s,layout:a="compact",expanded:r=!1,onToggleExpanded:i,onSave:o,onCancel:c,onDelete:l,saveLabel:d="Add",header:m,repeatEditable:u=!0,guestsEditable:x=!1,calendarEditable:T=!0,onCustomRepeat:b,touch:y,className:A}){const f=a==="pane",v={draft:e,onChange:t,layout:a,touch:y},O=n.jsx(be,{...v}),M=n.jsx(Ce,{...v}),R=n.jsx($e,{...v,calendars:s}),F=n.jsx(ke,{...v,repeatEditable:u,onCustom:b}),I=n.jsx(we,{...v}),S=n.jsx(Ye,{...v}),L=n.jsx(Ae,{...v}),B=n.jsxs("div",{className:h("flex items-center gap-2",f?"pt-2":"pt-1"),children:[n.jsx(C,{variant:"primary",size:y||f?"md":"sm",onClick:o,disabled:P(e),className:y?"min-h-11 flex-1":"",children:d}),n.jsx(C,{variant:"ghost",size:y||f?"md":"sm",onClick:c,className:y?"min-h-11":"",children:"Cancel"}),l&&n.jsx(C,{variant:"ghost",size:y||f?"md":"sm",onClick:l,className:h("ml-auto text-danger",y&&"min-h-11"),children:"Delete"})]});if(f)return n.jsxs("div",{className:h("flex flex-col gap-5",A),children:[m,n.jsx(g,{label:"Title",children:O}),n.jsx(g,{label:"When",children:M}),T&&n.jsx(g,{label:"Calendar",children:R}),n.jsx(g,{label:"Repeat",children:F}),n.jsx(g,{label:"Location",children:I}),x&&n.jsx(g,{label:"Guests",children:S}),n.jsx(g,{label:"Notes",children:L}),B]});const q=i!==void 0&&!r;return n.jsxs("div",{className:h("flex flex-col gap-3",A),children:[m,O,M,T&&R,i&&n.jsxs("button",{type:"button",onClick:i,"aria-expanded":r,className:h("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",y&&"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:[I,x&&S,F,L]}),B]})}const W="__custom__";function Me({value:e,date:t,startTime:s,onChange:a,onCustom:r,className:i}){const o=Te(t,s),c=e===k||o.includes(e)?o:[e,...o];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:i,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 Re({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=ie(i.color),c=i.id===t;return n.jsxs("label",{className:h("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?h(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:c,onChange:()=>s(i.id),className:"sr-only"}),n.jsx("span",{className:h("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:h("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"],N=["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 i=E.indexOf(s[1]);return i===-1?void 0:`FREQ=WEEKLY;BYDAY=${N[i]}`}const a=t.match(/^Every month on the (\w+) (\w+)$/);if(a){const i=z.indexOf(a[1]),o=E.indexOf(a[2]);return i===-1||o===-1?void 0:`FREQ=MONTHLY;BYDAY=${Y[i]}${N[o]}`}const r=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(r){const i=Z.indexOf(r[2]);return i===-1?void 0:`FREQ=YEARLY;BYMONTH=${i+1};BYMONTHDAY=${Number(r[1])}`}}const Se=e=>e===""?"":`, ${e}`;function Ze(e,t){const s=new Map(e.split(";").map(o=>o.split("=")).filter(o=>o.length===2).map(([o,c])=>[o.toUpperCase(),c.toUpperCase()])),a=Se(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===J)return`Every weekday${a}`;const o=N.indexOf(i);return o===-1?void 0:`Every week on ${E[o]}${a}`}if(r==="MONTHLY"){const o=i?.match(/^(-?\d)([A-Z]{2})$/);if(!o)return;const c=Y.indexOf(Number(o[1])),l=N.indexOf(o[2]);return c===-1||l===-1?void 0:`Every month on the ${z[c]} ${E[l]}${a}`}if(r==="YEARLY"){const o=Number(s.get("BYMONTH")),c=Number(s.get("BYMONTHDAY"));return!o||!c||o>12?void 0:`Every year on ${c} ${Z[o-1]}${a}`}}}const H=e=>Date.parse(`${e}T00:00:00Z`)/864e5;function Le(e,t,s){const a=H(s)-H(t);if(e===""||a===0||Number.isNaN(a))return e;const[r,i,o]=s.split("-").map(Number),c=new Date(Date.UTC(r,i-1,o)).getUTCDay(),l=/FREQ=(\w+)/i.exec(e)?.[1]?.toUpperCase();return e.split(";").map(d=>{const[m,u=""]=d.split("="),x=m.toUpperCase();return x==="BYDAY"&&l==="MONTHLY"?`BYDAY=${Y[Math.min(Math.floor((o-1)/7),4)]}${N[c]}`:x==="BYDAY"?`BYDAY=${u.split(",").map(T=>{const b=N.indexOf(T.toUpperCase());return b===-1?T:N[(b+a+7)%7]}).join(",")}`:x==="BYMONTH"?`BYMONTH=${i}`:x==="BYMONTHDAY"?`BYMONTHDAY=${o}`:d}).join(";")}function ze(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function Je(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endDate:re(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:de(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:ue(t,s.anchor===""?"UTC":s.anchor).slice(0,10);return Le(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 Ke(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 Qe(e,t,s){const a=t.repeat!==e.repeat,i=t.allDay!==e.allDay||t.date!==e.date||t.startTime!==e.startTime,o=i||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:m}=Q(t,s.clock);return i&&(l.start=d),o&&(l.end=m,l.allDay=t.allDay,s.anchor!==""&&(l.timeZone=s.anchor)),a&&(l.recurrenceRule=G(t,d,s)),{ok:!0,patch:l}}const Be=[],Ue={from:"",to:""};function Ge(e,t=""){const{timeZoneByCalendarId:s}=me(),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}=oe({...a?{from:U("week",e.date).from,to:U("week",e.endDate).to}:Ue,calendarIds:Be,enabled:a}),c=he();return w.useMemo(()=>{if(!a||i||o)return;const l=j(e.date,e.startTime,c),d=j(e.endDate,e.endTime,c),m=r.filter(u=>xe(u)&&u.calendarObjectId!==t).map(u=>pe(u,s[u.calendarId]??ye,c));return le({start:l,end:d},m).map(u=>({id:u.id,label:`${u.title}, ${ce(u)}`}))},[a,i,o,e.date,e.endDate,e.startTime,e.endTime,c,r,t,s])}function Ve({title:e,subtitle:t,calendars:s,draft:a,onChange:r,problem:i,saveLabel:o,isSaving:c,repeatEditable:l=!0,calendarEditable:d=!0,clashes:m,onSave:u,onCancel:x}){return n.jsx(Fe,{title:e,subtitle:t,onClose:x,children:n.jsx(Oe,{draft:a,onChange:r,calendars:s,layout:"pane",repeatEditable:l,calendarEditable:d,saveLabel:c?"Saving…":o,onSave:u,onCancel:x,header:i===""&&m===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(se,{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})]}),m!==void 0&&n.jsx(ve,{clashes:m,clearText:"Nothing else is booked at this time."})]})})})}export{Ve as C,Ke as c,Je as d,ze as e,Le as m,Qe as p,Ze as t,Ge as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,r as e}from"./index-
|
|
1
|
+
import{j as t,r as e}from"./index-BgsHJXrW.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-
|
|
1
|
+
import{r,j as n,al as l,am as o}from"./index-BgsHJXrW.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-
|
|
1
|
+
import{j as e}from"./index-BgsHJXrW.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-
|
|
1
|
+
import{j as t,a0 as r}from"./index-BgsHJXrW.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{eM as U,r as o,e0 as J,c as de,C as H,bq as le,cT as ce,aH as ue,aI as ge,j as a,ak as he,d3 as me,d4 as fe}from"./index-
|
|
1
|
+
import{eM as U,r as o,e0 as J,c as de,C as H,bq as le,cT as ce,aH as ue,aI as ge,j as a,ak as he,d3 as me,d4 as fe}from"./index-BgsHJXrW.js";import{u as pe,p as _,R as Ie}from"./useSearchTokenContext-_mPqHIqE.js";import{z as xe,B as Te,ak as ye,al as be,av as ve,am as Ce,a as Se,M as Re,as as we,aw as je,au as Fe,l as Me,I as ke,N as W,L as Oe,J as Pe,b as Le,X as Ne,Y as Ae,_ as X,$ as Y,a0 as De,a1 as qe,a2 as Ee}from"./MailListHeader-D8dncvLk.js";import{u as Be,l as Qe,b as ze,a as He}from"./MailViewChrome-K588o61G.js";import{f as Ke}from"./ErrorState-CmLGalXf.js";import{d as Ve,w as Ge}from"./wizard-selection-DxUM65kM.js";import{a as _e}from"./useMessageBodyContent-QMy924K4.js";import{e as We,f as Ue}from"./search-token-index-CrVbBlms.js";import{u as Je}from"./sections-CgVZgQC0.js";const K=e=>({...e,starred:!0,order:"desc"}),Xe=(e={})=>J({query:K(e)});function $(e={}){const{data:t,isLoading:s,isError:r,error:c,refetch:u,fetchNextPage:n,hasNextPage:g,isFetchingNextPage:h}=Be({queryKey:Xe(e),queryFn:async({pageParam:I})=>{const{data:l}=await U({query:{...K(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 Ye(e={}){const t={...K(e),unread:!0,count:!0,results:!1},{data:s}=de({queryKey:J({query:t}),queryFn:async()=>{const{data:r}=await U({query:t,throwOnError:!0});return r},staleTime:6e4});return s?.count}const $e=["from","subject","category","unread","starred","attachments"],Ze=(e,t)=>{const s=xe(e),{params:r,residual:c}=Te(t,{...s,starred:!0},$e);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}=H(),h=pe(),O=le(),I=ce(),[l,m]=o.useState("all"),[b,P]=o.useState(new Set),R=o.useCallback(i=>{P(S=>{const x=new Set(S);return x.has(i)?x.delete(i):x.add(i),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:N,residual:f}=o.useMemo(()=>Ze({category:l,attributes:b},v),[l,b,v]),F=o.useMemo(()=>j?{...N,query:j}:N,[N,j]),{threads:A,isLoading:D,isError:y,error:E,refetch:M,fetchNextPage:B,hasNextPage:Q,isFetchingNextPage:k}=$(F),p=o.useMemo(()=>Ve(A).map(ye).filter(i=>be(i,f)),[A,f]),d=o.useCallback((i,S)=>{const x=p.find(ie=>ie.id===i)?.threadId;x&&t?.({threadId:x,messageId:i},S)},[p,t]),C=o.useCallback(i=>{const S=i.threadId??p.find(x=>x.id===i.id)?.threadId;S&&t?.({threadId:S,messageId:i.id})},[p,t]),z=o.useMemo(()=>ve(),[]),te=o.useMemo(()=>p.map(i=>Ce(i,n)),[p,n]),se=Ye(F)??null,ae=o.useMemo(()=>v.filter(i=>i.type!=="isStarred"),[v]),re=Qe({chips:{category:l,attributes:b},tokens:ae,reach:f.length>0?"loaded-pages":"whole-folder",onClear:T}),V=D?"loading":y?"error":p.length===0?"empty":"ready",oe=o.useCallback(()=>{const i=ue(ge());window.open(i,"_blank","noopener,noreferrer")},[]),G=Se(),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:p.map(i=>a.jsx(Re,{thread:i,active:i.id===e,onClick:()=>d(i.id)},i.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:k,children:k?"Loading…":"Load more"}):null]})});return a.jsx(ze,{title:"Starred",unreadCount:se,preset:z,selectedCategory:l,activeFilters:b,onSelectCategory:m,onToggleFilter:R,onClearFilters:w,searchResults:te,searchLoading:D,onSelectSearchResult:C,searchResultsInBody:!0,children:a.jsxs(we,{selectedMessageId:e,rows:p,onOpen:d,onDeleteMessages:c,onSelectionVerb:I.start,commandsRef:s,onTriageContextChange:r,children:[a.jsx(He,{listTitle:"Starred",sections:[{id:"flagged",threads:p}],flatList:!0,hideHeader:!0,listState:G.searchResults?"ready":V,listFilter:re,listScopeLabel:"Starred",searchQuery:L||void 0,errorMessage:y?Ke(E):void 0,onRetry:()=>M(),onReportError:oe,selectedThreadId:e,onSelectThread:d,isDesktop:O,selectionBar:a.jsx(je,{title:"Starred"}),listBody:G.searchResults??(V==="ready"?ne:void 0)}),a.jsx(et,{rows:p,verb:I.verb})]})})}const Z=o.createContext(null);function q(){const e=o.useContext(Z);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=Je(),{searchInput:u}=H(),n=e?.threadId,g=e?.messageId,{threads:h}=$(),O=o.useMemo(()=>{if(n)return h.find(d=>d.messageId===g)??h.find(d=>d.threadId===n)},[h,n,g]),I=ke(n,g),l=O??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((d,C)=>{s(d,{replace:C?.replace,query:u})},[s,u]),R=o.useCallback(d=>{m&&d.includes(m)&&r()},[m,r]),w=W({thread:l,isOpen:!0,onAfterOptimisticRemove:R}),T=Oe(),{deleteMessages:j}=Pe({mailboxId:l?.mailboxId??"",messages:h,onAfterOptimisticRemove:R}),{toggleReadFor:v}=Le({mailboxId:l?.mailboxId??"",messages:h}),L=T.focusedMessageId,f=o.useMemo(()=>h.find(d=>d.messageId===L),[h,L])??l,F=W({thread:f,isOpen:f?.messageId===m}),A=_e(),D=he(),y=me(),E=o.useMemo(()=>fe(y,n,m),[y,n,m]),M=o.useMemo(()=>{if(f)return d=>y({threadId:f.threadId,messageId:f.messageId,mode:d})},[y,f]),{nextMessageId:B,previousMessageId:Q}=Ne({context:T,orderedIds:T.orderedIds,selectedMessageId:m,enabled:!A&&!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")||f&&v([f.messageId],!f.isRead)},goBrief:()=>c("brief"),goSettings:()=>c("settings")}}),k=o.useCallback(d=>{if(!d)return;const C=h.find(z=>z.messageId===d);return C?{threadId:C.threadId,messageId:d}:void 0},[h]),p={selectedMessageId:m,selectedThread:l,conversation:b,onOpenThread:P,onCloseThread:r,nextThread:k(B),previousThread:k(Q),actions:w,onReply:E,triage:T,onDeleteMessages:j,handleDeselectIfRemoved:R};return a.jsx(Z.Provider,{value:p,children:t})}function ee(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:r}=q();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}=q(),u=!!e,n=qe(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(Ee,{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(X,{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(Y,{isOpen:n.drawerOpen,onClose:n.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function rt(){const{selectedThread:e,handleDeselectIfRemoved:t}=q(),{onToggleIntelligence:s}=H();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}=q(),g=Ae(t?.threadId??null);return t?a.jsxs(a.Fragment,{children:[a.jsx(X,{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(Y,{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 ft=Object.assign(st,{List:ee,Reading:at,Intelligence:rt,Phone:ot});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-
|
|
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-BgsHJXrW.js";import{E as u}from"./ErrorState-CmLGalXf.js";import{D as r,C as x,u as k}from"./index-CEJMvVKP.js";import{c as p,d as h,e as b}from"./useMessageBodyContent-QMy924K4.js";import{C as S}from"./confirm-dialog-DqUyGPYb.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,4 +1,4 @@
|
|
|
1
|
-
import{as as Ps,d7 as _r,r as c,e as ce,j as s,_ as Ke,$ as Fs,L as sa,t as F,a0 as Ur,g as we,d8 as Br,d9 as na,da as aa,db as Wt,a7 as Kr,f as H,X as Xe,a3 as vt,aB as Gt,Y as Hr,b9 as qr,d6 as Vt,dc as ra,Z as et,dd as Qr,de as Wr,df as Gr,W as Ze,dg as oa,bJ as Ds,dh as Vr,bs as Yr,di as Jr,dj as Xr,dk as ia,aM as Zr,dl as eo,B as la,dm as to,dn as so,dp as no,dq as ao,dr as ro,ds as oo,w as io,c as se,d as tt,K as yt,dt as lo,du as co,dv as Yt,h as me,at as ve,i as ge,E as Ee,F as Re,Q as kt,cy as Me,dw as Jt,dx as pt,aJ as uo,dy as jt,dz as Ae,dA as wt,dB as Ct,dC as Nt,dD as fo,dE as mo,dF as rn,cE as po,s as ca,dG as ho,dH as go,dI as xo,b6 as bo,cp as vo,G as Xt,cZ as da,c_ as yo,dJ as ko,bq as Os,bt as ua,bn as fa,bu as ma,bv as pa,bw as jo,aH as ha,aI as ga,cN as wo,dK as Co,ab as xa,cM as No,dL as ht,dM as So,dN as To,bf as ba,dO as Io,dP as va,dQ as Eo,d3 as Ro,H as ya,bR as zs,dR as Mo,cP as st,dS as on,dT as ka,bT as Ao,dU as ms,dV as $o,bS as Lo,S as Po,q as Fo,ah as ja,J as Do,dW as Oo,dX as zo,dY as _o,d2 as ln,bD as Uo,dZ as Bo,d_ as Ko,av as Ho,cR as qo,d0 as Qo,d$ as Wo,ai as Go,d1 as Vo,e0 as Yo,e1 as Jo,e2 as Xo,e3 as Zo,C as St,e4 as ei,e5 as ti,e6 as cn,e7 as si,e8 as ni,e9 as ai,ea as ri,v as wa,d5 as oi,eb as _s,ec as ii,ed as li,cq as ci,cn as di,ee as ui,bU as fi,ef as Ca,cr as mi}from"./index-CTrN7dU7.js";import{u as pi,L as hi,a as gi}from"./roving-focus-BYBMU9YM.js";import{j as xi,S as Na,f as bi,a as vi,t as dt,c as yi,k as ki,l as ji,m as wi,u as Ci}from"./search-token-index-BinolOMC.js";import{K as Ni}from"./kbd-DNmTK9ke.js";import{c as Sa,P as Si,E as Ti}from"./popover-menu-I_p7C4RX.js";import{M as Ii}from"./mail-2Lzca0sU.js";import{A as gt}from"./avatar-BI9-h2CG.js";import{M as Ei,a as Ri,b as Ta,c as Mi,s as Ia,d as Ea,e as Ai,f as $i,S as dn,g as Ra,u as Ma,p as Li,r as Pi}from"./useSearchTokenContext-BZ3hasAQ.js";import{P as Zt,f as Fi,C as Di,D as Ve,s as Oi,u as zi}from"./index-DMA0YSsS.js";import{E as Aa}from"./EmptyState-CwwN8uxT.js";import{E as Be}from"./ErrorState-DWzQfscg.js";import{U as _i}from"./undo-2-DafMLJl8.js";import{D as Ui}from"./download-CHu9yf-9.js";import{g as Bi}from"./useMessageBodyContent-C6WheWR5.js";import{m as ws,s as Ki,n as Hi,Z as qi,E as Qi,C as Wi,y as Gi,x as Vi,p as Yi,z as Ji,A as un,B as Xi,u as Zi,D as el,q as fn,F as tl,G as sl,t as nl,H as al,v as rl}from"./calendar-suggestion-E9w2nRWu.js";import{c as ol,t as il,v as ll,x as cl,y as mn}from"./calendar-format-nYSxDVLX.js";import{R as dl}from"./attendee-row-BMb3eM14.js";import{C as ul}from"./calendar-clash-strip-BeF8DhB-.js";import{C as $a}from"./clock-CHCFgl4d.js";import{M as fl,c as ml}from"./calendar-report-_QLAbdRS.js";import{B as La}from"./bell-off-CC53fBB2.js";import{C as pl}from"./copy-DgGekFwr.js";import{S as hl,C as Pa}from"./shield-check-B8NtyqSa.js";import{u as gl,a as xl,i as bl,t as vl,d as yl,r as kl}from"./useCalendars-DSVgnNGS.js";import{u as Fa}from"./useDebouncedValue-DgoW2gtH.js";import{j as pn,u as jl,a as wl,k as Cl,n as Nl,o as Sl,l as Tl,m as Il,S as El}from"./useFilters-CI6nPI8A.js";import{u as Us}from"./useQueries-8ibIA6jj.js";import{C as Rl}from"./checkbox-CZD6i6IR.js";import{C as Pt}from"./confirm-dialog-CocDko9U.js";import{u as Ml,i as Al}from"./useLayoutTier-Cs2hRSyr.js";import{r as $l,a as Ll}from"./search-scope-B5-OK3Cq.js";import{M as Pl}from"./menu-AiRz5rLS.js";function xt(e){if(Fl())e.focus({preventScroll:!0});else{let t=Dl(e);e.focus(),Ol(t)}}let Ft=null;function Fl(){if(Ft==null){Ft=!1;try{document.createElement("div").focus({get preventScroll(){return Ft=!0,!0}})}catch{}}return Ft}function Dl(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 Ol(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 zl(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function _l(e){return zl(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Ul=!1;function Da(){return Ul}function xe(e,t){if(!Da())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:_l(n)?n=n.host:n=n.parentNode}return!1}function ne(e){if(Da()&&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 Bl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Kl(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 Hl(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 Oa(e,t){return Bl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Kl(e)&&Hl(e,t)&&(!e.parentElement||Oa(e.parentElement,e))}const za=["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"],ql=za.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";za.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function Ql(e,t){return e.matches(ql)&&!Wl(e)&&(t?.skipVisibilityCheck||Oa(e))}function Wl(e){let t=e;for(;t!=null;){if(t instanceof Ie(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Bs=typeof document<"u"?Ps.useLayoutEffect:()=>{};function Gl(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Vl(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Yl(e){for(;e&&!Ql(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Ie(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=h=>{(ne(h)===n||a)&&h.stopImmediatePropagation()},o=h=>{(ne(h)===n||a)&&(h.stopImmediatePropagation(),!e&&!a&&(a=!0,xt(n),f()))},i=h=>{(ne(h)===e||a)&&h.stopImmediatePropagation()},l=h=>{(ne(h)===e||a)&&(h.stopImmediatePropagation(),a||(a=!0,xt(n),f()))};t.addEventListener("blur",r,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",l,!0),t.addEventListener("focus",i,!0);let f=()=>{cancelAnimationFrame(b),t.removeEventListener("blur",r,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",l,!0),t.removeEventListener("focus",i,!0),a=!1},b=requestAnimationFrame(f);return f}function es(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 Ks(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 Ks(/^Mac/i)}),Jl=$e(function(){return Ks(/^iPhone/i)}),_a=$e(function(){return Ks(/^iPad/i)||Kt()&&navigator.maxTouchPoints>1}),Ua=$e(function(){return Jl()||_a()}),Xl=$e(function(){return es(/AppleWebKit/i)&&!Zl()}),Zl=$e(function(){return es(/Chrome/i)}),Ba=$e(function(){return es(/Android/i)}),ec=$e(function(){return es(/Firefox/i)});function tc(e){return e.pointerType===""&&e.isTrusted?!0:Ba()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function sc(e){return!Ba()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function bt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;ec()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Kt()?a=!0:r=!0);let l=Xl()&&Kt()&&!_a()?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});bt.isOpening=n,xt(e),e.dispatchEvent(l),bt.isOpening=!1}bt.isOpening=!1;let Se=new Map,Cs=new Set;function hn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=ne(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=ne(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 Cs)i();Cs.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?hn():document.addEventListener("DOMContentLoaded",hn));function nc(){for(const[e]of Se)"isConnected"in e&&!e.isConnected&&Se.delete(e)}function ac(e){requestAnimationFrame(()=>{nc(),Se.size===0?e():Cs.add(e)})}function Ka(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let Ns=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{Ns.delete(e)});function rc(e,t){if(e===t)return e;let n=Ns.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=Ns.get(t);return a?(a.forEach(r=>r.current=e),e):t}function oc(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=gn(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():gn(e[o],null)})}}}function gn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Tt(...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]=Ka(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=_r(o,i):r==="id"&&o&&i?t.id=rc(o,i):r==="ref"&&o&&i?t.ref=oc(o,i):t[r]=i!==void 0?i:o}}return t}function ic(e,t){Bs(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const lc=Ps.useInsertionEffect??Bs;function ps(e){const t=c.useRef(null);return lc(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let Ye="default",Ss="",Bt=new WeakMap;function cc(e){if(Ua()){if(Ye==="default"){const t=Te(e);Ss=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Ye="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 xn(e){if(Ua()){if(Ye!=="disabled")return;Ye="restoring",setTimeout(()=>{ac(()=>{if(Ye==="restoring"){const t=Te(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=Ss||""),Ss="",Ye="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 bn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let hs=new WeakMap;function dc(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return bn(t);if(hs.has(t))return hs.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Ie(n).HTMLMetaElement&&(n.nonce||n.content)||bn(t)||void 0;return a!==void 0&&hs.set(t,a),a}const Ha=Ps.createContext({register:()=>{}});Ha.displayName="PressResponderContext";function qa(){let e=c.useRef(new Map),t=c.useCallback((r,o,i,l)=>{let f=l?.once?(...b)=>{e.current.delete(i),i(...b)}:i;e.current.set(i,{type:o,eventTarget:r,fn:f,options:l}),r.addEventListener(o,f,l)},[]),n=c.useCallback((r,o,i,l)=>{let f=e.current.get(i)?.fn||i;r.removeEventListener(o,f,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 uc(e){let t=c.useContext(Ha);if(t){let{register:n,ref:a,...r}=t;e=Tt(r,e),n()}return ic(t,e.ref),e}class Dt{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,f=0,b,h=null;a.clientX!=null&&a.clientY!=null&&(b=a.clientX,h=a.clientY),i&&(b!=null&&h!=null?(l=b-i.left,f=h-i.top):(l=i.width/2,f=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=f,this.key=a.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const vn=Symbol("linkClicked"),yn="react-aria-pressable-style",kn="data-react-aria-pressable";function fc(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:f,preventFocusOnPress:b,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:y,ref:p,...v}=uc(e),[m,u]=c.useState(!1),d=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:g,removeAllGlobalListeners:k}=qa(),x=c.useCallback((j,A)=>{let z=d.current;if(l||z.didFirePressStart)return!1;let N=!0;if(z.isTriggeringEvent=!0,a){let L=new Dt("pressstart",A,j);a(L),N=L.shouldStopPropagation}return n&&n(!0),z.isTriggeringEvent=!1,z.didFirePressStart=!0,u(!0),N},[l,a,n]),w=c.useCallback((j,A,z=!0)=>{let N=d.current;if(!N.didFirePressStart)return!1;N.didFirePressStart=!1,N.isTriggeringEvent=!0;let L=!0;if(r){let S=new Dt("pressend",A,j);r(S),L=S.shouldStopPropagation}if(n&&n(!1),u(!1),t&&z&&!l){let S=new Dt("press",A,j);t(S),L&&=S.shouldStopPropagation}return N.isTriggeringEvent=!1,L},[l,r,n,t]),C=ps(w),I=c.useCallback((j,A)=>{let z=d.current;if(l)return!1;if(o){z.isTriggeringEvent=!0;let N=new Dt("pressup",A,j);return o(N),z.isTriggeringEvent=!1,N.shouldStopPropagation}return!0},[l,o]),M=ps(I),E=c.useCallback(j=>{let A=d.current;if(A.isPressed&&A.target){A.didFirePressStart&&A.pointerType!=null&&w(Ue(A.target,j),A.pointerType,!1),A.isPressed=!1,A.isOverTarget=!1,A.activePointerId=null,A.pointerType=null,k(),y||xn(A.target);for(let z of A.disposables)z();A.disposables=[]}},[y,k,w]),T=ps(E);c.useEffect(()=>{l&&d.current.isPressed&&T({currentTarget:d.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let P=c.useCallback(j=>{h&&E(j)},[h,E]),$=c.useCallback(j=>{l||i?.(j)},[l,i]),K=c.useCallback((j,A)=>{if(!l&&i){let z=new MouseEvent("click",j);Vl(z,A),i(Gl(z))}},[l,i]),O=c.useMemo(()=>{let j=d.current,A={onKeyDown(N){if(gs(N.nativeEvent,N.currentTarget)&&xe(N.currentTarget,ne(N))){jn(ne(N),N.key)&&N.preventDefault();let L=!0;!j.isPressed&&!N.repeat&&(j.target=N.currentTarget,j.isPressed=!0,j.pointerType="keyboard",L=x(N,"keyboard"));let S=N.currentTarget,_=B=>{gs(B,S)&&!B.repeat&&xe(S,ne(B))&&j.target&&M(Ue(j.target,B),"keyboard")};g(Te(N.currentTarget),"keyup",Ka(_,z),!0),L&&N.stopPropagation(),N.metaKey&&Kt()&&j.metaKeyEvents?.set(N.key,N.nativeEvent)}else N.key==="Meta"&&(j.metaKeyEvents=new Map)},onClick(N){if(!(N&&!xe(N.currentTarget,ne(N)))&&N&&N.button===0&&!j.isTriggeringEvent&&!bt.isOpening){let L=!0;if(l&&N.preventDefault(),!j.ignoreEmulatedMouseEvents&&!j.isPressed&&(j.pointerType==="virtual"||tc(N.nativeEvent))){let S=x(N,"virtual"),_=M(N,"virtual"),B=C(N,"virtual");$(N),L=S&&_&&B}else if(j.isPressed&&j.pointerType!=="keyboard"){let S=j.pointerType||N.nativeEvent.pointerType||"virtual",_=M(Ue(N.currentTarget,N),S),B=C(Ue(N.currentTarget,N),S,!0);L=_&&B,j.isOverTarget=!1,$(N),T(N)}j.ignoreEmulatedMouseEvents=!1,L&&N.stopPropagation()}}},z=N=>{if(j.isPressed&&j.target&&gs(N,j.target)){jn(ne(N),N.key)&&N.preventDefault();let L=ne(N),S=xe(j.target,L);C(Ue(j.target,N),"keyboard",S),S&&K(N,j.target),k(),N.key!=="Enter"&&Hs(j.target)&&xe(j.target,L)&&!N[vn]&&(N[vn]=!0,bt(j.target,N,!1)),j.isPressed=!1,j.metaKeyEvents?.delete(N.key)}else if(N.key==="Meta"&&j.metaKeyEvents?.size){let L=j.metaKeyEvents;j.metaKeyEvents=void 0;for(let S of L.values())j.target?.dispatchEvent(new KeyboardEvent("keyup",S))}};if(typeof PointerEvent<"u"){A.onPointerDown=S=>{if(S.button!==0||!xe(S.currentTarget,ne(S)))return;if(sc(S.nativeEvent)){j.pointerType="virtual";return}j.pointerType=S.pointerType;let _=!0;if(!j.isPressed){j.isPressed=!0,j.isOverTarget=!0,j.activePointerId=S.pointerId,j.target=S.currentTarget,y||cc(j.target),_=x(S,j.pointerType);let B=ne(S);"releasePointerCapture"in B&&("hasPointerCapture"in B?B.hasPointerCapture(S.pointerId)&&B.releasePointerCapture(S.pointerId):B.releasePointerCapture(S.pointerId)),g(Te(S.currentTarget),"pointerup",N,!1),g(Te(S.currentTarget),"pointercancel",L,!1)}_&&S.stopPropagation()},A.onMouseDown=S=>{if(xe(S.currentTarget,ne(S))&&S.button===0){if(b){let _=Yl(S.target);_&&j.disposables.push(_)}S.stopPropagation()}},A.onPointerUp=S=>{!xe(S.currentTarget,ne(S))||j.pointerType==="virtual"||S.button===0&&!j.isPressed&&M(S,j.pointerType||S.pointerType)},A.onPointerEnter=S=>{S.pointerId===j.activePointerId&&j.target&&!j.isOverTarget&&j.pointerType!=null&&(j.isOverTarget=!0,x(Ue(j.target,S),j.pointerType))},A.onPointerLeave=S=>{S.pointerId===j.activePointerId&&j.target&&j.isOverTarget&&j.pointerType!=null&&(j.isOverTarget=!1,C(Ue(j.target,S),j.pointerType,!1),P(S))};let N=S=>{if(S.pointerId===j.activePointerId&&j.isPressed&&S.button===0&&j.target){if(xe(j.target,ne(S))&&j.pointerType!=null){let _=!1,B=setTimeout(()=>{j.isPressed&&j.target instanceof HTMLElement&&(_?T(S):(xt(j.target),j.target.click()))},80);g(S.currentTarget,"click",()=>_=!0,!0),j.disposables.push(()=>clearTimeout(B))}else T(S);j.isOverTarget=!1}},L=S=>{T(S)};A.onDragStart=S=>{xe(S.currentTarget,ne(S))&&T(S)}}return A},[g,l,b,k,y,P,x,$,K]);return c.useEffect(()=>{if(!p)return;const j=Te(p.current);if(!j||!j.head||j.getElementById(yn))return;const A=j.createElement("style");A.id=yn;let z=dc(j);z&&(A.nonce=z),A.textContent=`
|
|
1
|
+
import{as as Ps,d7 as _r,r as c,e as ce,j as s,_ as Ke,$ as Fs,L as sa,t as F,a0 as Ur,g as we,d8 as Br,d9 as na,da as aa,db as Wt,a7 as Kr,f as H,X as Xe,a3 as vt,aB as Gt,Y as Hr,b9 as qr,d6 as Vt,dc as ra,Z as et,dd as Qr,de as Wr,df as Gr,W as Ze,dg as oa,bJ as Ds,dh as Vr,bs as Yr,di as Jr,dj as Xr,dk as ia,aM as Zr,dl as eo,B as la,dm as to,dn as so,dp as no,dq as ao,dr as ro,ds as oo,w as io,c as se,d as tt,K as yt,dt as lo,du as co,dv as Yt,h as me,at as ve,i as ge,E as Ee,F as Re,Q as kt,cy as Me,dw as Jt,dx as pt,aJ as uo,dy as jt,dz as Ae,dA as wt,dB as Ct,dC as Nt,dD as fo,dE as mo,dF as rn,cE as po,s as ca,dG as ho,dH as go,dI as xo,b6 as bo,cp as vo,G as Xt,cZ as da,c_ as yo,dJ as ko,bq as Os,bt as ua,bn as fa,bu as ma,bv as pa,bw as jo,aH as ha,aI as ga,cN as wo,dK as Co,ab as xa,cM as No,dL as ht,dM as So,dN as To,bf as ba,dO as Io,dP as va,dQ as Eo,d3 as Ro,H as ya,bR as zs,dR as Mo,cP as st,dS as on,dT as ka,bT as Ao,dU as ms,dV as $o,bS as Lo,S as Po,q as Fo,ah as ja,J as Do,dW as Oo,dX as zo,dY as _o,d2 as ln,bD as Uo,dZ as Bo,d_ as Ko,av as Ho,cR as qo,d0 as Qo,d$ as Wo,ai as Go,d1 as Vo,e0 as Yo,e1 as Jo,e2 as Xo,e3 as Zo,C as St,e4 as ei,e5 as ti,e6 as cn,e7 as si,e8 as ni,e9 as ai,ea as ri,v as wa,d5 as oi,eb as _s,ec as ii,ed as li,cq as ci,cn as di,ee as ui,bU as fi,ef as Ca,cr as mi}from"./index-BgsHJXrW.js";import{u as pi,L as hi,a as gi}from"./roving-focus-D8ieiood.js";import{j as xi,S as Na,f as bi,a as vi,t as dt,c as yi,k as ki,l as ji,m as wi,u as Ci}from"./search-token-index-CrVbBlms.js";import{K as Ni}from"./kbd-o1nflZRu.js";import{c as Sa,P as Si,E as Ti}from"./popover-menu-DH1B01dU.js";import{M as Ii}from"./mail-xjJzF7Ec.js";import{A as gt}from"./avatar-OJww5F3k.js";import{M as Ei,a as Ri,b as Ta,c as Mi,s as Ia,d as Ea,e as Ai,f as $i,S as dn,g as Ra,u as Ma,p as Li,r as Pi}from"./useSearchTokenContext-_mPqHIqE.js";import{P as Zt,f as Fi,C as Di,D as Ve,s as Oi,u as zi}from"./index-CEJMvVKP.js";import{E as Aa}from"./EmptyState-haDMp8Ar.js";import{E as Be}from"./ErrorState-CmLGalXf.js";import{U as _i}from"./undo-2-QAbYZsVP.js";import{D as Ui}from"./download-CExFNT5m.js";import{g as Bi}from"./useMessageBodyContent-QMy924K4.js";import{m as ws,s as Ki,n as Hi,Z as qi,E as Qi,C as Wi,y as Gi,x as Vi,p as Yi,z as Ji,A as un,B as Xi,u as Zi,D as el,q as fn,F as tl,G as sl,t as nl,H as al,v as rl}from"./calendar-suggestion-f9IkXHda.js";import{c as ol,t as il,v as ll,x as cl,y as mn}from"./calendar-format-CwRw4RDu.js";import{R as dl}from"./attendee-row-DMe42k7H.js";import{C as ul}from"./calendar-clash-strip-Do_J9SgJ.js";import{C as $a}from"./clock-BBpIdhnS.js";import{M as fl,c as ml}from"./calendar-report-DMvb9Sqg.js";import{B as La}from"./bell-off-JyhxJiJh.js";import{C as pl}from"./copy-BFnJYo3G.js";import{S as hl,C as Pa}from"./shield-check-CUjnaEJM.js";import{u as gl,a as xl,i as bl,t as vl,d as yl,r as kl}from"./useCalendars-DEAe0d5P.js";import{u as Fa}from"./useDebouncedValue-CypIbLxd.js";import{j as pn,u as jl,a as wl,k as Cl,n as Nl,o as Sl,l as Tl,m as Il,S as El}from"./useFilters-Cv87jtMp.js";import{u as Us}from"./useQueries-DBc1JIwH.js";import{C as Rl}from"./checkbox-SlSTA73y.js";import{C as Pt}from"./confirm-dialog-DqUyGPYb.js";import{u as Ml,i as Al}from"./useLayoutTier-BnLQZtW5.js";import{r as $l,a as Ll}from"./search-scope-B5-OK3Cq.js";import{M as Pl}from"./menu-B7ZT3hES.js";function xt(e){if(Fl())e.focus({preventScroll:!0});else{let t=Dl(e);e.focus(),Ol(t)}}let Ft=null;function Fl(){if(Ft==null){Ft=!1;try{document.createElement("div").focus({get preventScroll(){return Ft=!0,!0}})}catch{}}return Ft}function Dl(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 Ol(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 zl(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function _l(e){return zl(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Ul=!1;function Da(){return Ul}function xe(e,t){if(!Da())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:_l(n)?n=n.host:n=n.parentNode}return!1}function ne(e){if(Da()&&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 Bl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Kl(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 Hl(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 Oa(e,t){return Bl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Kl(e)&&Hl(e,t)&&(!e.parentElement||Oa(e.parentElement,e))}const za=["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"],ql=za.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";za.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function Ql(e,t){return e.matches(ql)&&!Wl(e)&&(t?.skipVisibilityCheck||Oa(e))}function Wl(e){let t=e;for(;t!=null;){if(t instanceof Ie(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Bs=typeof document<"u"?Ps.useLayoutEffect:()=>{};function Gl(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Vl(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Yl(e){for(;e&&!Ql(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Ie(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=h=>{(ne(h)===n||a)&&h.stopImmediatePropagation()},o=h=>{(ne(h)===n||a)&&(h.stopImmediatePropagation(),!e&&!a&&(a=!0,xt(n),f()))},i=h=>{(ne(h)===e||a)&&h.stopImmediatePropagation()},l=h=>{(ne(h)===e||a)&&(h.stopImmediatePropagation(),a||(a=!0,xt(n),f()))};t.addEventListener("blur",r,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",l,!0),t.addEventListener("focus",i,!0);let f=()=>{cancelAnimationFrame(b),t.removeEventListener("blur",r,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",l,!0),t.removeEventListener("focus",i,!0),a=!1},b=requestAnimationFrame(f);return f}function es(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 Ks(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 Ks(/^Mac/i)}),Jl=$e(function(){return Ks(/^iPhone/i)}),_a=$e(function(){return Ks(/^iPad/i)||Kt()&&navigator.maxTouchPoints>1}),Ua=$e(function(){return Jl()||_a()}),Xl=$e(function(){return es(/AppleWebKit/i)&&!Zl()}),Zl=$e(function(){return es(/Chrome/i)}),Ba=$e(function(){return es(/Android/i)}),ec=$e(function(){return es(/Firefox/i)});function tc(e){return e.pointerType===""&&e.isTrusted?!0:Ba()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function sc(e){return!Ba()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function bt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;ec()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Kt()?a=!0:r=!0);let l=Xl()&&Kt()&&!_a()?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});bt.isOpening=n,xt(e),e.dispatchEvent(l),bt.isOpening=!1}bt.isOpening=!1;let Se=new Map,Cs=new Set;function hn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=ne(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=ne(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 Cs)i();Cs.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?hn():document.addEventListener("DOMContentLoaded",hn));function nc(){for(const[e]of Se)"isConnected"in e&&!e.isConnected&&Se.delete(e)}function ac(e){requestAnimationFrame(()=>{nc(),Se.size===0?e():Cs.add(e)})}function Ka(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let Ns=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{Ns.delete(e)});function rc(e,t){if(e===t)return e;let n=Ns.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=Ns.get(t);return a?(a.forEach(r=>r.current=e),e):t}function oc(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=gn(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():gn(e[o],null)})}}}function gn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Tt(...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]=Ka(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=_r(o,i):r==="id"&&o&&i?t.id=rc(o,i):r==="ref"&&o&&i?t.ref=oc(o,i):t[r]=i!==void 0?i:o}}return t}function ic(e,t){Bs(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const lc=Ps.useInsertionEffect??Bs;function ps(e){const t=c.useRef(null);return lc(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let Ye="default",Ss="",Bt=new WeakMap;function cc(e){if(Ua()){if(Ye==="default"){const t=Te(e);Ss=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Ye="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 xn(e){if(Ua()){if(Ye!=="disabled")return;Ye="restoring",setTimeout(()=>{ac(()=>{if(Ye==="restoring"){const t=Te(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=Ss||""),Ss="",Ye="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 bn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let hs=new WeakMap;function dc(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return bn(t);if(hs.has(t))return hs.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Ie(n).HTMLMetaElement&&(n.nonce||n.content)||bn(t)||void 0;return a!==void 0&&hs.set(t,a),a}const Ha=Ps.createContext({register:()=>{}});Ha.displayName="PressResponderContext";function qa(){let e=c.useRef(new Map),t=c.useCallback((r,o,i,l)=>{let f=l?.once?(...b)=>{e.current.delete(i),i(...b)}:i;e.current.set(i,{type:o,eventTarget:r,fn:f,options:l}),r.addEventListener(o,f,l)},[]),n=c.useCallback((r,o,i,l)=>{let f=e.current.get(i)?.fn||i;r.removeEventListener(o,f,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 uc(e){let t=c.useContext(Ha);if(t){let{register:n,ref:a,...r}=t;e=Tt(r,e),n()}return ic(t,e.ref),e}class Dt{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,f=0,b,h=null;a.clientX!=null&&a.clientY!=null&&(b=a.clientX,h=a.clientY),i&&(b!=null&&h!=null?(l=b-i.left,f=h-i.top):(l=i.width/2,f=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=f,this.key=a.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const vn=Symbol("linkClicked"),yn="react-aria-pressable-style",kn="data-react-aria-pressable";function fc(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:f,preventFocusOnPress:b,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:y,ref:p,...v}=uc(e),[m,u]=c.useState(!1),d=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:g,removeAllGlobalListeners:k}=qa(),x=c.useCallback((j,A)=>{let z=d.current;if(l||z.didFirePressStart)return!1;let N=!0;if(z.isTriggeringEvent=!0,a){let L=new Dt("pressstart",A,j);a(L),N=L.shouldStopPropagation}return n&&n(!0),z.isTriggeringEvent=!1,z.didFirePressStart=!0,u(!0),N},[l,a,n]),w=c.useCallback((j,A,z=!0)=>{let N=d.current;if(!N.didFirePressStart)return!1;N.didFirePressStart=!1,N.isTriggeringEvent=!0;let L=!0;if(r){let S=new Dt("pressend",A,j);r(S),L=S.shouldStopPropagation}if(n&&n(!1),u(!1),t&&z&&!l){let S=new Dt("press",A,j);t(S),L&&=S.shouldStopPropagation}return N.isTriggeringEvent=!1,L},[l,r,n,t]),C=ps(w),I=c.useCallback((j,A)=>{let z=d.current;if(l)return!1;if(o){z.isTriggeringEvent=!0;let N=new Dt("pressup",A,j);return o(N),z.isTriggeringEvent=!1,N.shouldStopPropagation}return!0},[l,o]),M=ps(I),E=c.useCallback(j=>{let A=d.current;if(A.isPressed&&A.target){A.didFirePressStart&&A.pointerType!=null&&w(Ue(A.target,j),A.pointerType,!1),A.isPressed=!1,A.isOverTarget=!1,A.activePointerId=null,A.pointerType=null,k(),y||xn(A.target);for(let z of A.disposables)z();A.disposables=[]}},[y,k,w]),T=ps(E);c.useEffect(()=>{l&&d.current.isPressed&&T({currentTarget:d.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let P=c.useCallback(j=>{h&&E(j)},[h,E]),$=c.useCallback(j=>{l||i?.(j)},[l,i]),K=c.useCallback((j,A)=>{if(!l&&i){let z=new MouseEvent("click",j);Vl(z,A),i(Gl(z))}},[l,i]),O=c.useMemo(()=>{let j=d.current,A={onKeyDown(N){if(gs(N.nativeEvent,N.currentTarget)&&xe(N.currentTarget,ne(N))){jn(ne(N),N.key)&&N.preventDefault();let L=!0;!j.isPressed&&!N.repeat&&(j.target=N.currentTarget,j.isPressed=!0,j.pointerType="keyboard",L=x(N,"keyboard"));let S=N.currentTarget,_=B=>{gs(B,S)&&!B.repeat&&xe(S,ne(B))&&j.target&&M(Ue(j.target,B),"keyboard")};g(Te(N.currentTarget),"keyup",Ka(_,z),!0),L&&N.stopPropagation(),N.metaKey&&Kt()&&j.metaKeyEvents?.set(N.key,N.nativeEvent)}else N.key==="Meta"&&(j.metaKeyEvents=new Map)},onClick(N){if(!(N&&!xe(N.currentTarget,ne(N)))&&N&&N.button===0&&!j.isTriggeringEvent&&!bt.isOpening){let L=!0;if(l&&N.preventDefault(),!j.ignoreEmulatedMouseEvents&&!j.isPressed&&(j.pointerType==="virtual"||tc(N.nativeEvent))){let S=x(N,"virtual"),_=M(N,"virtual"),B=C(N,"virtual");$(N),L=S&&_&&B}else if(j.isPressed&&j.pointerType!=="keyboard"){let S=j.pointerType||N.nativeEvent.pointerType||"virtual",_=M(Ue(N.currentTarget,N),S),B=C(Ue(N.currentTarget,N),S,!0);L=_&&B,j.isOverTarget=!1,$(N),T(N)}j.ignoreEmulatedMouseEvents=!1,L&&N.stopPropagation()}}},z=N=>{if(j.isPressed&&j.target&&gs(N,j.target)){jn(ne(N),N.key)&&N.preventDefault();let L=ne(N),S=xe(j.target,L);C(Ue(j.target,N),"keyboard",S),S&&K(N,j.target),k(),N.key!=="Enter"&&Hs(j.target)&&xe(j.target,L)&&!N[vn]&&(N[vn]=!0,bt(j.target,N,!1)),j.isPressed=!1,j.metaKeyEvents?.delete(N.key)}else if(N.key==="Meta"&&j.metaKeyEvents?.size){let L=j.metaKeyEvents;j.metaKeyEvents=void 0;for(let S of L.values())j.target?.dispatchEvent(new KeyboardEvent("keyup",S))}};if(typeof PointerEvent<"u"){A.onPointerDown=S=>{if(S.button!==0||!xe(S.currentTarget,ne(S)))return;if(sc(S.nativeEvent)){j.pointerType="virtual";return}j.pointerType=S.pointerType;let _=!0;if(!j.isPressed){j.isPressed=!0,j.isOverTarget=!0,j.activePointerId=S.pointerId,j.target=S.currentTarget,y||cc(j.target),_=x(S,j.pointerType);let B=ne(S);"releasePointerCapture"in B&&("hasPointerCapture"in B?B.hasPointerCapture(S.pointerId)&&B.releasePointerCapture(S.pointerId):B.releasePointerCapture(S.pointerId)),g(Te(S.currentTarget),"pointerup",N,!1),g(Te(S.currentTarget),"pointercancel",L,!1)}_&&S.stopPropagation()},A.onMouseDown=S=>{if(xe(S.currentTarget,ne(S))&&S.button===0){if(b){let _=Yl(S.target);_&&j.disposables.push(_)}S.stopPropagation()}},A.onPointerUp=S=>{!xe(S.currentTarget,ne(S))||j.pointerType==="virtual"||S.button===0&&!j.isPressed&&M(S,j.pointerType||S.pointerType)},A.onPointerEnter=S=>{S.pointerId===j.activePointerId&&j.target&&!j.isOverTarget&&j.pointerType!=null&&(j.isOverTarget=!0,x(Ue(j.target,S),j.pointerType))},A.onPointerLeave=S=>{S.pointerId===j.activePointerId&&j.target&&j.isOverTarget&&j.pointerType!=null&&(j.isOverTarget=!1,C(Ue(j.target,S),j.pointerType,!1),P(S))};let N=S=>{if(S.pointerId===j.activePointerId&&j.isPressed&&S.button===0&&j.target){if(xe(j.target,ne(S))&&j.pointerType!=null){let _=!1,B=setTimeout(()=>{j.isPressed&&j.target instanceof HTMLElement&&(_?T(S):(xt(j.target),j.target.click()))},80);g(S.currentTarget,"click",()=>_=!0,!0),j.disposables.push(()=>clearTimeout(B))}else T(S);j.isOverTarget=!1}},L=S=>{T(S)};A.onDragStart=S=>{xe(S.currentTarget,ne(S))&&T(S)}}return A},[g,l,b,k,y,P,x,$,K]);return c.useEffect(()=>{if(!p)return;const j=Te(p.current);if(!j||!j.head||j.getElementById(yn))return;const A=j.createElement("style");A.id=yn;let z=dc(j);z&&(A.nonce=z),A.textContent=`
|
|
2
2
|
@layer {
|
|
3
3
|
[${kn}] {
|
|
4
4
|
touch-action: pan-x pan-y pinch-zoom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as L,r as N,j as e,W,Y as H,Z as $,_ as A,$ as I,t as C,a0 as Q,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 S,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 v,ai as fe,D as me,v as he}from"./index-CTrN7dU7.js";import{u as ge}from"./roving-focus-BYBMU9YM.js";import{B as pe}from"./bell-off-CC53fBB2.js";import{u as be}from"./useQueries-8ibIA6jj.js";import{f as je}from"./folder-failure-CqkVSsrb.js";import{i as ye}from"./outbox-status-BlKn6P0x.js";import{B as ve}from"./bug-Dh0UIzTd.js";const Ne=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 ke=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 Ce=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"}]]),Oe={Mail:"mail sync off"},Se="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 we({active:s,dimmed:a,indent:n}){return C("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 ze({icon:s,label:a,count:n,active:r,failure:o}){return e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:C("shrink-0",r?"text-accent-2":"text-fg-subtle"),children:s}),e.jsx("span",{className:"flex-1 truncate",children:a}),o&&e.jsx(Q,{className:"size-3.5 shrink-0 text-danger","aria-hidden":"true"}),n!=null&&n>0&&e.jsx("span",{className:C("text-2xs tabular-nums",r?"text-accent-2":"text-fg-subtle"),children:n})]})}function O({icon:s,label:a,count:n,active:r,dimmed:o,indent:c,navId:f,linkComponent:g,ariaLabel:m,title:p,failure:d,onClick:k}){const j=we({active:r,dimmed:o,indent:c}),x=e.jsx(ze,{icon:s,label:a,count:n,active:r,failure:d}),y=m??a,i=d?`${y} — ${d}`:y,l=d?`${p??a} — ${d}`:p;return f&&g?g({navId:f,className:j,ariaLabel:i,title:l,onClick:k,children:x}):e.jsx("button",{type:"button",onClick:k,className:j,"aria-label":d?i:m,title:l,children:x})}const M={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Re(s){switch(s){case"inbox":return e.jsx(se,{className:"size-4"});case"flagged":return e.jsx($,{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 Le({account:s,selectedNavId:a,onSelectNav:n,linkComponent:r}){const[o,c]=N.useState(()=>D(_,s.id,!0)),[f,g]=N.useState(()=>D(P,s.id,!0)),[m,p]=N.useState(!1),d=()=>{c(t=>{const u=!t;return B(_,s.id,u),u})},k=()=>{g(t=>{const u=!t;return B(P,s.id,u),u})},j=s.mailboxes.filter(E).sort((t,u)=>M[t.role]-M[u.role]),x=s.mailboxes.filter(t=>!E(t)),y=m||x.length<=z?x:x.slice(0,z),i=x.length-y.length,l=s.status??"ready",h=s.syncedServices!==void 0&&!s.syncedServices.includes("Mail"),b=l==="ready"&&j.length===0&&x.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:d,"aria-expanded":o,className:C("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:[o?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"})]}),h&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:Oe.Mail})]})]}),o&&e.jsxs(e.Fragment,{children:[l==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),l==="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(Q,{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"}),l==="ready"&&e.jsxs(e.Fragment,{children:[j.map(t=>e.jsx(O,{navId:t.id,linkComponent:r,icon:Re(t.role),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,failure:t.failure,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),s.outboxPending!==void 0&&e.jsx(O,{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")}),x.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:k,"aria-expanded":f,className:C("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:[f?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:x.length})]}),f&&e.jsxs(e.Fragment,{children:[y.map(t=>e.jsx(O,{navId:t.id,linkComponent:r,icon:e.jsx(Y,{className:"size-4"}),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,failure:t.failure,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),(i>0||m)&&x.length>z&&e.jsx("button",{type:"button",onClick:()=>p(t=>!t),className:C("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",w),children:m?"Show less":`Show all (${x.length})`})]})]})]})]})]})}function Fe({accounts:s,selectedNavId:a,briefUnseen:n,onSelectNav:r,variant:o="desktop",linkComponent:c,calendarNav:f="hidden"}){const g=N.useRef(null);ge({containerRef:g,itemSelector:Se});const m=o==="drawer",p=e.jsxs("nav",{ref:m?g:void 0,className:m?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(O,{navId:"brief",linkComponent:c,icon:e.jsx(W,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:n,active:a==="brief",onClick:()=>r?.("brief")}),f==="shown"&&e.jsx(O,{navId:"calendar",linkComponent:c,icon:e.jsx(H,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:a==="calendar",onClick:()=>r?.("calendar")}),e.jsx(O,{navId:"flagged",linkComponent:c,icon:e.jsx($,{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(d=>e.jsx(Le,{account:d,selectedNavId:a,onSelectNav:r,linkComponent:c},d.id))]});return m?p:e.jsx("aside",{ref:g,className:"flex h-full w-full flex-col bg-surface-sunken",children:p})}function Ae(){const{pathname:s}=te(),a=ae({from:"/mail/$mailboxId",shouldThrow:!1});return S(s,"/settings")?"settings":S(s,"/calendar")?"calendar":S(s,"/mail/outbox")?"outbox":S(s,"/mail/flagged")?"flagged":S(s,"/mail/brief")?"brief":a?.mailboxId??""}const Ie=({children:s})=>{const{Account:a}=ne();return e.jsx(a,{children:s})},T=s=>/^\d/.test(s),Me=(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 Ee(s,a,n){const r=[],o=[];for(const c of s)a.has(c.mailboxId)?r.push(c):o.push(c);return o.sort((c,f)=>Me(R(c,void 0,n),R(f,void 0,n))),{system:r,labels:o}}function Pe(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,failure:je(s)}}function q({accounts:s,onMailboxSelect:a,variant:n="desktop"}){const r=re(),o=Ae(),{onSearchChange:c}=ie(),{t:f}=le("mail",{useSuspense:!1}),g=N.useCallback((i,l)=>f(i,{defaultValue:l}),[f]),m=be({queries:s.map(i=>({...oe({path:{accountId:i.accountId}}),staleTime:1/0}))}),{data:p}=ce(ue()),d=N.useMemo(()=>(p?.items??[]).filter(i=>ye(i.status)).length,[p?.items]),k=N.useMemo(()=>s.map((i,l)=>{const h=m[l],b=h?.data?.items??[],t=de(i.folderAppointments),{system:u,labels:K}=Ee(b,t,g),U=h?.isError?"error":h?.isLoading?"loading":"ready";return{id:i.accountId,label:i.email,email:i.email,muted:!!i.muted,outboxPending:d,status:U,onRetry:()=>h?.refetch(),mailboxes:[...u,...K].map(F=>Pe(F,t.get(F.mailboxId),g))}}),[s,m,d,g]),j=i=>{r.invalidateQueries({queryKey:fe({path:{mailboxId:i},query:{order:"desc"}})})},x=({navId:i,className:l,ariaLabel:h,title:b,children:t,onClick:u})=>i==="brief"?e.jsx(v,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="calendar"?e.jsx(v,{to:"/calendar",onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="outbox"?e.jsx(v,{to:"/mail/outbox",search:{q:void 0},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="flagged"?e.jsx(v,{to:"/mail/flagged",search:{q:void 0},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="settings"?e.jsx(v,{to:"/settings/accounts",onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):e.jsx(v,{to:"/mail/$mailboxId",params:{mailboxId:i},search:{q:void 0},onClick:()=>{j(i),u?.()},className:l,"aria-label":h,title:b,children:t}),y=()=>{c(""),a?.()};return e.jsx(Fe,{accounts:k,selectedNavId:o,onSelectNav:y,linkComponent:x,calendarNav:"shown",variant:n})}function _e(){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(ve,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function Ke({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(v,{to:"/settings/accounts",onClick:a,children:[e.jsx(Ce,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(_e,{}),e.jsx(Ie,{children:({signOut:o})=>e.jsxs("button",{type:"button",onClick:()=>{a?.(),o()},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(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}export{Ie as A,ke as L,Ke as M,Ce as S};
|
|
1
|
+
import{e as L,r as N,j as e,W,Y as H,Z as $,_ as A,$ as I,t as C,a0 as Q,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 S,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 v,ai as fe,D as me,v as he}from"./index-BgsHJXrW.js";import{u as ge}from"./roving-focus-D8ieiood.js";import{B as pe}from"./bell-off-JyhxJiJh.js";import{u as be}from"./useQueries-DBc1JIwH.js";import{f as je}from"./folder-failure-CqkVSsrb.js";import{i as ye}from"./outbox-status-BlKn6P0x.js";import{B as ve}from"./bug-BXAS92HM.js";const Ne=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 ke=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 Ce=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"}]]),Oe={Mail:"mail sync off"},Se="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 we({active:s,dimmed:a,indent:n}){return C("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 ze({icon:s,label:a,count:n,active:r,failure:o}){return e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:C("shrink-0",r?"text-accent-2":"text-fg-subtle"),children:s}),e.jsx("span",{className:"flex-1 truncate",children:a}),o&&e.jsx(Q,{className:"size-3.5 shrink-0 text-danger","aria-hidden":"true"}),n!=null&&n>0&&e.jsx("span",{className:C("text-2xs tabular-nums",r?"text-accent-2":"text-fg-subtle"),children:n})]})}function O({icon:s,label:a,count:n,active:r,dimmed:o,indent:c,navId:f,linkComponent:g,ariaLabel:m,title:p,failure:d,onClick:k}){const j=we({active:r,dimmed:o,indent:c}),x=e.jsx(ze,{icon:s,label:a,count:n,active:r,failure:d}),y=m??a,i=d?`${y} — ${d}`:y,l=d?`${p??a} — ${d}`:p;return f&&g?g({navId:f,className:j,ariaLabel:i,title:l,onClick:k,children:x}):e.jsx("button",{type:"button",onClick:k,className:j,"aria-label":d?i:m,title:l,children:x})}const M={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Re(s){switch(s){case"inbox":return e.jsx(se,{className:"size-4"});case"flagged":return e.jsx($,{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 Le({account:s,selectedNavId:a,onSelectNav:n,linkComponent:r}){const[o,c]=N.useState(()=>D(_,s.id,!0)),[f,g]=N.useState(()=>D(P,s.id,!0)),[m,p]=N.useState(!1),d=()=>{c(t=>{const u=!t;return B(_,s.id,u),u})},k=()=>{g(t=>{const u=!t;return B(P,s.id,u),u})},j=s.mailboxes.filter(E).sort((t,u)=>M[t.role]-M[u.role]),x=s.mailboxes.filter(t=>!E(t)),y=m||x.length<=z?x:x.slice(0,z),i=x.length-y.length,l=s.status??"ready",h=s.syncedServices!==void 0&&!s.syncedServices.includes("Mail"),b=l==="ready"&&j.length===0&&x.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:d,"aria-expanded":o,className:C("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:[o?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"})]}),h&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:Oe.Mail})]})]}),o&&e.jsxs(e.Fragment,{children:[l==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),l==="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(Q,{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"}),l==="ready"&&e.jsxs(e.Fragment,{children:[j.map(t=>e.jsx(O,{navId:t.id,linkComponent:r,icon:Re(t.role),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,failure:t.failure,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),s.outboxPending!==void 0&&e.jsx(O,{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")}),x.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:k,"aria-expanded":f,className:C("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:[f?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:x.length})]}),f&&e.jsxs(e.Fragment,{children:[y.map(t=>e.jsx(O,{navId:t.id,linkComponent:r,icon:e.jsx(Y,{className:"size-4"}),label:t.name,ariaLabel:t.name,title:t.fullPath??t.name,failure:t.failure,count:t.unseen,active:a===t.id,dimmed:s.muted,onClick:()=>n?.(t.id)},t.id)),(i>0||m)&&x.length>z&&e.jsx("button",{type:"button",onClick:()=>p(t=>!t),className:C("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",w),children:m?"Show less":`Show all (${x.length})`})]})]})]})]})]})}function Fe({accounts:s,selectedNavId:a,briefUnseen:n,onSelectNav:r,variant:o="desktop",linkComponent:c,calendarNav:f="hidden"}){const g=N.useRef(null);ge({containerRef:g,itemSelector:Se});const m=o==="drawer",p=e.jsxs("nav",{ref:m?g:void 0,className:m?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(O,{navId:"brief",linkComponent:c,icon:e.jsx(W,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:n,active:a==="brief",onClick:()=>r?.("brief")}),f==="shown"&&e.jsx(O,{navId:"calendar",linkComponent:c,icon:e.jsx(H,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:a==="calendar",onClick:()=>r?.("calendar")}),e.jsx(O,{navId:"flagged",linkComponent:c,icon:e.jsx($,{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(d=>e.jsx(Le,{account:d,selectedNavId:a,onSelectNav:r,linkComponent:c},d.id))]});return m?p:e.jsx("aside",{ref:g,className:"flex h-full w-full flex-col bg-surface-sunken",children:p})}function Ae(){const{pathname:s}=te(),a=ae({from:"/mail/$mailboxId",shouldThrow:!1});return S(s,"/settings")?"settings":S(s,"/calendar")?"calendar":S(s,"/mail/outbox")?"outbox":S(s,"/mail/flagged")?"flagged":S(s,"/mail/brief")?"brief":a?.mailboxId??""}const Ie=({children:s})=>{const{Account:a}=ne();return e.jsx(a,{children:s})},T=s=>/^\d/.test(s),Me=(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 Ee(s,a,n){const r=[],o=[];for(const c of s)a.has(c.mailboxId)?r.push(c):o.push(c);return o.sort((c,f)=>Me(R(c,void 0,n),R(f,void 0,n))),{system:r,labels:o}}function Pe(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,failure:je(s)}}function q({accounts:s,onMailboxSelect:a,variant:n="desktop"}){const r=re(),o=Ae(),{onSearchChange:c}=ie(),{t:f}=le("mail",{useSuspense:!1}),g=N.useCallback((i,l)=>f(i,{defaultValue:l}),[f]),m=be({queries:s.map(i=>({...oe({path:{accountId:i.accountId}}),staleTime:1/0}))}),{data:p}=ce(ue()),d=N.useMemo(()=>(p?.items??[]).filter(i=>ye(i.status)).length,[p?.items]),k=N.useMemo(()=>s.map((i,l)=>{const h=m[l],b=h?.data?.items??[],t=de(i.folderAppointments),{system:u,labels:K}=Ee(b,t,g),U=h?.isError?"error":h?.isLoading?"loading":"ready";return{id:i.accountId,label:i.email,email:i.email,muted:!!i.muted,outboxPending:d,status:U,onRetry:()=>h?.refetch(),mailboxes:[...u,...K].map(F=>Pe(F,t.get(F.mailboxId),g))}}),[s,m,d,g]),j=i=>{r.invalidateQueries({queryKey:fe({path:{mailboxId:i},query:{order:"desc"}})})},x=({navId:i,className:l,ariaLabel:h,title:b,children:t,onClick:u})=>i==="brief"?e.jsx(v,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="calendar"?e.jsx(v,{to:"/calendar",onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="outbox"?e.jsx(v,{to:"/mail/outbox",search:{q:void 0},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="flagged"?e.jsx(v,{to:"/mail/flagged",search:{q:void 0},onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):i==="settings"?e.jsx(v,{to:"/settings/accounts",onClick:()=>u?.(),className:l,"aria-label":h,title:b,children:t}):e.jsx(v,{to:"/mail/$mailboxId",params:{mailboxId:i},search:{q:void 0},onClick:()=>{j(i),u?.()},className:l,"aria-label":h,title:b,children:t}),y=()=>{c(""),a?.()};return e.jsx(Fe,{accounts:k,selectedNavId:o,onSelectNav:y,linkComponent:x,calendarNav:"shown",variant:n})}function _e(){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(ve,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function Ke({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(v,{to:"/settings/accounts",onClick:a,children:[e.jsx(Ce,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(_e,{}),e.jsx(Ie,{children:({signOut:o})=>e.jsxs("button",{type:"button",onClick:()=>{a?.(),o()},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(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}export{Ie as A,ke as L,Ke as M,Ce as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aa as v,j as s,r as u,al as l,am as p}from"./index-
|
|
1
|
+
import{aa as v,j as s,r as u,al as l,am as p}from"./index-BgsHJXrW.js";import{F as x}from"./FullCompose-BDr9-FPu.js";import{a as m}from"./useMessageBodyContent-QMy924K4.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,d8 as me,c6 as xe,eg as ge,eh as he,ei as pe,C as be,ej as ve,d9 as je}from"./index-CTrN7dU7.js";import{j as we,n as Ne}from"./search-token-index-BinolOMC.js";import{u as ye,L as Q}from"./roving-focus-BYBMU9YM.js";import{a8 as Pe,a9 as Re,c as Ce,C as G,aa as Se,m as Ee,ab as Me,ac as ke,ad as Ie,ae as Le,af as Te,ag as ee,ah as ze}from"./MailListHeader-BVdr1xz_.js";import{A as Ae}from"./avatar-BI9-h2CG.js";import{M as Oe}from"./mail-2Lzca0sU.js";import{R as De}from"./refresh-cw-CrSEtN0j.js";import{M as $e}from"./menu-AiRz5rLS.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,d8 as me,c6 as xe,eg as ge,eh as he,ei as pe,C as be,ej as ve,d9 as je}from"./index-BgsHJXrW.js";import{j as we,n as Ne}from"./search-token-index-CrVbBlms.js";import{u as ye,L as Q}from"./roving-focus-D8ieiood.js";import{a8 as Pe,a9 as Re,c as Ce,C as G,aa as Se,m as Ee,ab as Me,ac as ke,ad as Ie,ae as Le,af as Te,ag as ee,ah as ze}from"./MailListHeader-D8dncvLk.js";import{A as Ae}from"./avatar-OJww5F3k.js";import{M as Oe}from"./mail-xjJzF7Ec.js";import{R as De}from"./refresh-cw-DmMLGyvw.js";import{M as $e}from"./menu-B7ZT3hES.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};
|