@remit/web-client-dist 0.0.562 → 0.0.564
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-DMKdofkO.js → BriefPane-DojIZDdy.js} +1 -1
- package/assets/{CalendarComposePane-WsykuAmt.js → CalendarComposePane-B3fOrTrG.js} +1 -1
- package/assets/{CalendarComposeSeed-D8kouLXw.js → CalendarComposeSeed-DNwuCKpr.js} +1 -1
- package/assets/{CalendarShell-w5_QbsLl.js → CalendarShell-CGVvcfrA.js} +1 -1
- package/assets/{EmptyState-ChYpZfic.js → EmptyState-BTKm9F6Q.js} +1 -1
- package/assets/{ErrorState-CrWgETYJ.js → ErrorState-jZhKH-Aj.js} +1 -1
- package/assets/{FlaggedPane-CZM51Mf7.js → FlaggedPane-Gh0sDSpK.js} +1 -1
- package/assets/{FullCompose-DzpqOJ_x.js → FullCompose-AEoBq77L.js} +1 -1
- package/assets/MailListHeader-CP5Mrq7I.js +7 -0
- package/assets/{MailNav-n_p6NKNa.js → MailNav-_b1NBnYa.js} +1 -1
- package/assets/{MailShell-ROtH8fUw.js → MailShell-DX1zBcaU.js} +1 -1
- package/assets/{MailViewChrome-EFqaNJZ2.js → MailViewChrome-WyEJa7LW.js} +1 -1
- package/assets/{MailboxPane-Bb9sWlTR.js → MailboxPane-B0QAN8MQ.js} +1 -1
- package/assets/{NavMenuButton-C_IPYoJS.js → NavMenuButton-CgziJeDD.js} +1 -1
- package/assets/{OnboardingWizard-BLYEGZUn.js → OnboardingWizard-Cq8ycceQ.js} +1 -1
- package/assets/{OpenCalendarEvent-OSuBniIY.js → OpenCalendarEvent-CWAwJawV.js} +1 -1
- package/assets/{OutboxPane-CwkktreV.js → OutboxPane-CQ3uaHpb.js} +1 -1
- package/assets/_calendarObjectId-CCinxQsA.js +1 -0
- package/assets/_mailboxId-BLTbspU-.js +1 -0
- package/assets/_messageId-BdFNsbyK.js +1 -0
- package/assets/_messageId-DGh1GohX.js +1 -0
- package/assets/_messageId-Rx6VPRb8.js +1 -0
- package/assets/_outboxMessageId-Ds-AxAdc.js +1 -0
- package/assets/_recurrenceId-CnuWP_v3.js +1 -0
- package/assets/_threadId-14e9BvEq.js +1 -0
- package/assets/_threadId-CaHK3QT7.js +1 -0
- package/assets/_threadId-zRV3tTyF.js +1 -0
- package/assets/{_view._date-U7jsNNm-.js → _view._date-CzvdNpZJ.js} +1 -1
- package/assets/{accounts-gmn-KxZI.js → accounts-BZE9IR6B.js} +1 -1
- package/assets/{advanced-Drt0T4DI.js → advanced-D2ikJQGg.js} +1 -1
- package/assets/{appearance-DMt30BX3.js → appearance-DsXwlVTk.js} +1 -1
- package/assets/{attachment-file-3u5t9yVj.js → attachment-file-BRLoj6sG.js} +1 -1
- package/assets/{attendee-row-B4qLx12D.js → attendee-row-OHoLTo23.js} +1 -1
- package/assets/{avatar-D3734Z4U.js → avatar-BuUa_-Ae.js} +1 -1
- package/assets/{bottom-sheet-DZfLdBcR.js → bottom-sheet-BUcSDGQJ.js} +1 -1
- package/assets/{brief-Dc20fghZ.js → brief--NWfZGeB.js} +1 -1
- package/assets/brief-BzLBKBJb.js +1 -0
- package/assets/{browser-ponyfill-0ibAxklW.js → browser-ponyfill-C1Yxcmyx.js} +1 -1
- package/assets/{bug-GxLshxbL.js → bug-C0Ms2LYI.js} +1 -1
- package/assets/{calendar-C1abh4wQ.js → calendar-Bx2owKH5.js} +1 -1
- package/assets/{calendar-color-CQ0fCP2x.js → calendar-color-PMGOIawE.js} +1 -1
- package/assets/{calendar-event-chip-BZ67p_lj.js → calendar-event-chip-CX0GIGM0.js} +1 -1
- package/assets/{calendars-B3U2oGRe.js → calendars-CJ1pdgeL.js} +1 -1
- package/assets/{card-iy-V5KCJ.js → card-Drp0FnU2.js} +1 -1
- package/assets/chevron-left-BW6j5W1b.js +1 -0
- package/assets/{circle-check-cmVG5dqu.js → circle-check-8G_6IWKh.js} +1 -1
- package/assets/{circle-check-big-CwWpLAeN.js → circle-check-big-CVRDL2A5.js} +1 -1
- package/assets/{circle-help-Bi23wQ34.js → circle-help-Ck_g9Pip.js} +1 -1
- package/assets/{clock-QYvJyj9V.js → clock-KUoHWkrr.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BT5t9O9p.js +1 -0
- package/assets/compose._-_outboxMessageId_-DVisJU-4.js +1 -0
- package/assets/compose._-_outboxMessageId_-PDyjMj_y.js +1 -0
- package/assets/compose._-_outboxMessageId_-kk1Oxbpv.js +1 -0
- package/assets/{config-import-lwMtvts3.js → config-import-DJqfxqLZ.js} +1 -1
- package/assets/{confirm-dialog-ClUWcFj3.js → confirm-dialog-BVXTDPyQ.js} +1 -1
- package/assets/{copy-aqCl6Pcw.js → copy-D_J7-xdX.js} +1 -1
- package/assets/{credential-steps-DLridSra.js → credential-steps-CuyQQqOh.js} +1 -1
- package/assets/{download-B3fvLTOG.js → download-cdI2QZPl.js} +1 -1
- package/assets/{file-json-B5LMBOsB.js → file-json-CxdRqoDn.js} +1 -1
- package/assets/{filters-CZPBgsmP.js → filters-CVrzif88.js} +1 -1
- package/assets/{flagged-CTUvspbc.js → flagged-CaNZehgH.js} +1 -1
- package/assets/flagged-DgBi4zNy.js +1 -0
- package/assets/{folders-Ce5XqFvM.js → folders-D6pNCcVN.js} +1 -1
- package/assets/{format-m09e2buG.js → format-bkonYesy.js} +1 -1
- package/assets/{help-copy-8TaH5CZp.js → help-copy-CbN-pFZa.js} +1 -1
- package/assets/{import-NgyhhufE.js → import-CmBHI3PY.js} +1 -1
- package/assets/index-B5pFel5d.js +1 -0
- package/assets/{index-ChbCI5oi.js → index-BSMLcnNv.js} +79 -79
- package/assets/index-BeGGBd6V.js +1 -0
- package/assets/{index-B2vKvFLD.js → index-BsL3dqbS.js} +4 -4
- package/assets/index-CRC7JV7N.js +1 -0
- package/assets/index-CdtVuvhW.js +1 -0
- package/assets/index-CwgKXaQc.js +1 -0
- package/assets/index-CyAwBGa1.js +1 -0
- package/assets/index-DGh1GohX.js +1 -0
- package/assets/index-DIINe8ie.js +1 -0
- package/assets/index-aVEEHAqm.js +1 -0
- package/assets/{index-DJs8tV_8.js → index-qHz-C81K.js} +1 -1
- package/assets/{kbd-BVeaRTOr.js → kbd-MeQzj_AS.js} +1 -1
- package/assets/{labels-BfAQ3enI.js → labels-DIjqFgrM.js} +1 -1
- package/assets/{mail-DhNvBUsO.js → mail-DNGMGkWt.js} +1 -1
- package/assets/{mail-zWE0hpq_.js → mail-zfMejK7g.js} +1 -1
- package/assets/{map-pin-C--Epy6g.js → map-pin-DHhEILKJ.js} +1 -1
- package/assets/{menu-CN4L5Iex.js → menu-D4SB6ohG.js} +1 -1
- package/assets/{new-Ht_SxLj_.js → new-CEVTgWfF.js} +1 -1
- package/assets/onboarding-CHzcHHo-.js +1 -0
- package/assets/{onboarding-completion-CoeSHB4P.js → onboarding-completion-Dr1hm10w.js} +1 -1
- package/assets/outbox-BQPbQr6w.js +1 -0
- package/assets/{pencil-DT7gIDcm.js → pencil-BSemJDIl.js} +1 -1
- package/assets/{refresh-cw-DqjzjNes.js → refresh-cw-Bdx0EEOe.js} +1 -1
- package/assets/{rich-text-Bwxpm1hQ.js → rich-text-C_I7yglD.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-VCFLAdwF.js → rich-text-spellcheck-worker-provider-fakJuGkh.js} +1 -1
- package/assets/{rotate-ccw-BtjJxGJJ.js → rotate-ccw-rjesddf9.js} +1 -1
- package/assets/{roving-focus-SMT1DuNV.js → roving-focus-JRZm8Nsl.js} +1 -1
- package/assets/{row-actions-BzPpa8Vf.js → row-actions-BAj0uoQs.js} +1 -1
- package/assets/{search-mirror-DB6xbYl9.js → search-mirror-CD8ms6aC.js} +1 -1
- package/assets/{search-token-index-BI06Pry-.js → search-token-index-srRTXc29.js} +1 -1
- package/assets/{sections-CBzH7fW_.js → sections-B3k1IUqe.js} +1 -1
- package/assets/{senders-CingkEiR.js → senders-BorZpOXg.js} +1 -1
- package/assets/settings-BV8meyD4.js +1 -0
- package/assets/{settings-screen-CXUE853h.js → settings-screen-CX00GQZz.js} +1 -1
- package/assets/{shield-check-Bb9ylQ2Z.js → shield-check-B34-2hLP.js} +1 -1
- package/assets/{suggested-vips-Bagq42ML.js → suggested-vips-C60kF2rS.js} +1 -1
- package/assets/{useCalendarData-BAn34dWd.js → useCalendarData-BtwJetQk.js} +1 -1
- package/assets/{useCalendars-ClO50Imr.js → useCalendars-D7gapaJ1.js} +1 -1
- package/assets/{useDebouncedValue-CA2KmipC.js → useDebouncedValue--1NwWG_J.js} +1 -1
- package/assets/{useFilters-BDllSrtd.js → useFilters-BYL5dTX8.js} +1 -1
- package/assets/{useLabels-BkI5-xn8.js → useLabels-BTBI_l7Q.js} +1 -1
- package/assets/{useLayoutTier-DFWu-GnD.js → useLayoutTier-C5sdkyR7.js} +1 -1
- package/assets/{useMessageBodyContent-Cq5A7svd.js → useMessageBodyContent-BuyQJK-3.js} +1 -1
- package/assets/{useQueries-CIpOdQUZ.js → useQueries-hzIIiVUF.js} +1 -1
- package/assets/{useRefreshControl-B1r95Z7v.js → useRefreshControl-D15eEjeE.js} +1 -1
- package/assets/{useResultFolderIndex-Dgg7gTLb.js → useResultFolderIndex-DfM23jXb.js} +1 -1
- package/assets/{useSearchTokenContext-BtO-aj3f.js → useSearchTokenContext-BOZY3WZQ.js} +1 -1
- package/assets/{useSemanticSearch-DPQk9p1j.js → useSemanticSearch-DT9Nt957.js} +1 -1
- package/assets/{useSignature-meT7Ef51.js → useSignature-B3bSZUlR.js} +1 -1
- package/assets/{window-DF8WTXnA.js → window-ZjseaC3I.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/MailListHeader-CB5RbIat.js +0 -7
- package/assets/_calendarObjectId-BrBh1bkC.js +0 -1
- package/assets/_mailboxId-DRH6tfPG.js +0 -1
- package/assets/_messageId-BQ1zNMuM.js +0 -1
- package/assets/_messageId-CS97kuwi.js +0 -1
- package/assets/_messageId-fjFtbh4L.js +0 -1
- package/assets/_outboxMessageId-CT238gOa.js +0 -1
- package/assets/_recurrenceId-C-Nki6Y1.js +0 -1
- package/assets/_threadId-BGoxt0wH.js +0 -1
- package/assets/_threadId-BhU8wTIu.js +0 -1
- package/assets/_threadId-GJsTzMy9.js +0 -1
- package/assets/brief-DQjtFnJ7.js +0 -1
- package/assets/chevron-left-BieTWhMX.js +0 -1
- package/assets/compose._-_outboxMessageId_-CEz_e6Sc.js +0 -1
- package/assets/compose._-_outboxMessageId_-DapqxlBz.js +0 -1
- package/assets/compose._-_outboxMessageId_-DsaJwSSQ.js +0 -1
- package/assets/compose._-_outboxMessageId_-Du3aZG0G.js +0 -1
- package/assets/flagged-DHhPMC-b.js +0 -1
- package/assets/index-B0YmOyfO.js +0 -1
- package/assets/index-B4830EUG.js +0 -1
- package/assets/index-B9iytUZp.js +0 -1
- package/assets/index-BBPm7mGb.js +0 -1
- package/assets/index-Ba4EP9Sq.js +0 -1
- package/assets/index-CWeiKEGV.js +0 -1
- package/assets/index-DzKlNs5r.js +0 -1
- package/assets/index-Xkc0xSCq.js +0 -1
- package/assets/index-fjFtbh4L.js +0 -1
- package/assets/onboarding-fvD9rhqC.js +0 -1
- package/assets/outbox-AQdkfzGB.js +0 -1
- package/assets/settings-CfwLU4Vt.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,L as Tt,U as wt,ee as _e,ef as ue,ci as me,r as n,c as Qe,C as J,bi as Rt,cM as Mt,H as jt,dB as kt,eg as Et,_ as ze,dZ as At,eh as Ft,aj as Ot,cT as Nt,cU as Bt}from"./index-ChbCI5oi.js";import{g as He,e as Lt,f as Ge,u as qt,p as Pt,R as Dt}from"./useSearchTokenContext-BtO-aj3f.js";import{ac as _t,G as Qt,I as zt,ap as Ht,aq as Gt,ar as Ut,as as Kt,at as Wt,au as Fe,av as Yt,aw as $t,ax as Vt,ab as Zt,ay as Jt,az as Xt,aA as es,aj as ts,M as ss,aB as os,ak as rs,aC as ns,aD as as,e as is,w as cs,am as ls,s as ds,S as us,O as ms,T as Oe,R as fs,P as hs,d as gs,a0 as ps,a1 as xs,a3 as Ue,a4 as Ke,a5 as Is,a6 as ys,a7 as vs}from"./MailListHeader-CB5RbIat.js";import{u as bs,a as Ss,R as Cs,b as Ts,c as ws}from"./useRefreshControl-B1r95Z7v.js";import{u as fe}from"./useQueries-CIpOdQUZ.js";import{t as Rs,u as Ms,r as js,L as ks}from"./useSemanticSearch-DPQk9p1j.js";import{a as Es}from"./useLabels-BkI5-xn8.js";import{u as As,b as Fs}from"./useLayoutTier-DFWu-GnD.js";import{d as Os,w as Ns}from"./wizard-selection-DxUM65kM.js";import{u as We}from"./sections-CBzH7fW_.js";import{R as Bs}from"./refresh-cw-DqjzjNes.js";import{a as Ls}from"./useMessageBodyContent-Cq5A7svd.js";import{g as qs,h as Ps}from"./search-token-index-BI06Pry-.js";function Ds({sync:e}){return e?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[r.jsx(Tt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:_s(e)})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[r.jsx(wt,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function _s({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 Ye=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],$e="category",Qs={unclassified:"uncategorized"},H=e=>Lt(e).map(t=>t.raw),z=e=>e.join(" "),he=e=>{const t=Ge(e);if(t)return Ye.find(o=>o.name===t.name&&o.value===t.value.toLowerCase())?.id},ge=e=>{const t=Ge(e);if(!t||t.name!==$e)return;const o=t.value.toLowerCase(),a=Qs[o];if(a)return a;if(!(!_e(o)||o==="all"))return o},Ve=e=>Ye.find(t=>t.id===e),Ze=e=>Ve(e)!==void 0,zs=e=>{const t=new Set;for(const o of H(e)){const a=he(o);a&&t.add(a)}return t},Hs=e=>{let t="all";for(const o of H(e)){const a=ge(o);a&&(t=a)}return t},Gs=(e,t)=>{const o=Ve(t);if(!o)return;const a=H(e),c=a.filter(d=>he(d)!==t);return c.length<a.length?z(c):z([...a,He(o.name,o.value)])},Us=(e,t)=>{const o=H(e).filter(a=>!ge(a));return z(t==="all"?o:[...o,He($e,t)])},Ks=e=>z(H(e).filter(t=>!he(t)&&!ge(t))),Je=e=>e.trim().length>0,Ne=e=>{if(!Je(e.query))return e.ownFilters;const t=new Set(zs(e.query));for(const o of e.ownFilters)Ze(o)||t.add(o);return t},Be=e=>Je(e.query)?Hs(e.query):e.ownCategory,Le=6e4,Ws=3e4,Ys={kind:"unknown"},qe=e=>(t,o)=>_t(o?.queryKey,e)?t:void 0,$s=(e,t,o)=>({...e,category:[t],limit:o,order:"desc"}),Vs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Pe=(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}:{}});function Zs({categories:e,criteria:t,limit:o,counted:a}){const c=fe({queries:e.map(m=>{const f=$s(t,m,o),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},placeholderData:qe(g),staleTime:Le}})}),d=fe({queries:e.map(m=>{const f=Vs(t,m),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},enabled:a,placeholderData:qe(g),staleTime:Le}})}),l=n.useMemo(()=>e.map((m,f)=>{const g=c[f],T=d[f],I=g?.data?.items??[];return{category:m,rows:I,atCap:I.length>=o,total:a?Rs(T?.data?.count):Ys,loading:g?.isPending??!0,failed:g?.isError??!1,retry:()=>{g?.refetch(),a&&T?.refetch()}}}),[e,c,d,a,o]),u=n.useCallback(()=>{for(const m of c)m.refetch();for(const m of d)m.refetch()},[c,d]);return{sections:l,isLoading:c.length>0&&c.every(m=>m.isPending),isError:c.length>0&&c.every(m=>m.isError),refetch:u}}function Js(e,t,o){const a={...e,limit:t,order:"desc"},{data:c,isLoading:d,isError:l,refetch:u}=Qe({queryKey:me({query:a}),queryFn:async()=>{const{data:f}=await ue({query:a,throwOnError:!0});return f},enabled:o,staleTime:Ws});return{rows:n.useMemo(()=>o?c?.items??[]:[],[c,o]),isLoading:o&&d,isError:o&&l,refetch:n.useCallback(()=>{u()},[u])}}const Xs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),eo=e=>[...e].sort(Xs),to=["category","unread","starred","attachments"],Xe=["contacts","today"],so=e=>new Set(Xe.filter(t=>e.has(t))),oo=(e,t,o)=>{const a=Qt({category:e,attributes:t}),{params:c,residual:d}=zt(o,a,to),l={...c,...a},u={};return l.unread!==void 0&&(u.unread=l.unread),l.starred!==void 0&&(u.starred=l.starred),l.attachments!==void 0&&(u.attachments=l.attachments),{criteria:u,residual:d}},ro=({residual:e,attributes:t,accountScoped:o})=>e.length===0&&!o&&!Xe.some(a=>t.has(a)),no=50,ao=200,io=[],De=()=>r.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>r.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[r.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsxs("div",{className:"flex justify-between gap-2",children:[r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),co=({accountEmail:e})=>{const t=We();return r.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[r.jsx(ze,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),r.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},lo=(e,t)=>{if(t.size===0)return{};const o=e.filter(d=>t.has(d.id)),a=js(o.map(d=>d.accountId));if(a.restriction)return a;const c=new Set;for(const d of o)d.mailboxId&&c.add(d.mailboxId);return c.size>1?{accountId:a.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${c.size} folders`}:{accountId:a.accountId,mailboxId:c.size===1?[...c][0]:void 0}};function uo({header:e,rows:t,wizard:o,children:a}){const{selectedIds:c,selectedCount:d,exitSelection:l,orderedIds:u,allSelected:m,toggleAllLoaded:f}=as(),g=n.useMemo(()=>lo(t,c),[t,c]),{junkMailboxId:T}=is(g.accountId),{labels:I}=Es(g.accountId),v=n.useMemo(()=>Array.from(c),[c]),B=n.useMemo(()=>Ns(t,c),[t,c]),p=cs(T,g.mailboxId),b=n.useMemo(()=>u.length>0?{checked:m,indeterminate:d>0&&!m,onChange:f}:void 0,[u.length,m,d,f]),F=g.moveDisabledHint?{tone:"warning",text:g.moveDisabledHint}:void 0,S=R=>r.jsx(us,{title:R.title,navSlot:R.navSlot,titleMeta:R.titleMeta,searchSlot:R.searchSlot,searchField:R.searchField,idleSlot:R.makeFilterSlot,count:d,onCancel:l,onDelete:()=>o.start("delete"),onMove:()=>o.start("move"),onOrganize:()=>o.start("organize"),onJunk:p?()=>o.start("junk"):void 0,onMarkRead:()=>o.start("markRead"),overflowSlot:g.accountId&&g.mailboxId&&d>0&&I.length>0?r.jsx(ks,{accountId:g.accountId,mailboxId:g.mailboxId,messageIds:v}):void 0,selectAll:b,notice:F});return r.jsx(ls,{...e,selectionBar:S,paneOverlay:r.jsx(ds,{verb:o.verb,accountId:g.accountId,mailboxId:g.mailboxId,selection:B,selectionRestriction:g.restriction,onFinished:l}),children:a})}function mo({accounts:e,selectedMessageId:t,onOpenThread:o,commandsRef:a,onTriageContextChange:c,onDeleteMessages:d}){const{searchQuery:l,searchInput:u,resultFolderIndex:m,onSearchChange:f}=J(),g=qt(),T=Rt(),I=As(),v=Mt(),B=Fs(),p=n.useMemo(()=>eo(e.filter(s=>!s.muted?.value)),[e]),[b,F]=n.useState("all"),[S,R]=n.useState("all"),[O,L]=n.useState(new Set),[ee,M]=n.useState(!1),q=n.useCallback(s=>{L(i=>{const h=new Set(i);return h.has(s)?h.delete(s):h.add(s),h})},[]),G=n.useCallback(()=>L(new Set),[]),E=u.trim().length>0,{freeText:j,tokens:P}=Pt(l.trim().toLowerCase(),g),y=j.length>0,D=n.useMemo(()=>Ne({query:u,ownFilters:O}),[u,O]),_=n.useMemo(()=>Be({query:u,ownCategory:S}),[u,S]),A=n.useMemo(()=>Ne({query:l,ownFilters:O}),[l,O]),C=n.useMemo(()=>Be({query:l,ownCategory:S}),[l,S]),x=n.useCallback(s=>{if(!E||!Ze(s)){q(s);return}const i=Gs(u,s);i!==void 0&&f(i)},[E,u,f,q]),k=n.useCallback(s=>{if(!E){R(s);return}f(Us(u,s))},[E,u,f]),te=n.useMemo(()=>C==="all"&&!y?s=>{_e(s)&&k(s)}:void 0,[C,y,k]),se=n.useCallback(()=>{R("all"),F("all"),G(),E&&f(Ks(u))},[E,u,f,G]),U=fe({queries:p.map(s=>({...jt({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),K=n.useMemo(()=>{const s=new Map;for(let i=0;i<p.length;i++){const h=p[i].accountId,bt=(U[i]?.data?.items??[]).reduce((St,Ct)=>St+(Ct.unseenCount??0),0);s.set(h,bt)}return s},[p,U]),st=n.useMemo(()=>p.filter((s,i)=>{const h=U[i];return h?.isError?!kt(h.error):!1}),[p,U]),{criteria:oe,residual:re}=n.useMemo(()=>oo(C,A,P),[C,A,P]),ot=n.useMemo(()=>C==="all"?[...Ht]:[C],[C]),rt=n.useMemo(()=>({...oe,query:j,...C==="all"?{}:{category:[C]}}),[oe,j,C]),nt=ro({residual:re,attributes:A,accountScoped:b!=="all"}),{sections:W,isLoading:at,isError:it,refetch:pe}=Zs({categories:y?io:ot,criteria:oe,limit:C==="all"?ns:no,counted:nt}),{rows:xe,isLoading:ct,isError:lt,refetch:Ie}=Js(rt,ao,y),ne=y?ct:at,ye=y?lt:it,ve=n.useCallback(()=>{if(y){Ie();return}pe()},[y,Ie,pe]),be=n.useMemo(()=>so(A),[A]),Y=n.useCallback(s=>Os(Gt(s)).map(Ut).filter(i=>(b==="all"||i.accountId===b)&&Et(i,be)&&Kt(i,re)),[b,be,re]),$=n.useMemo(()=>W.map(s=>({category:s.category,total:Wt(s.total,s.rows),atCap:s.atCap,loading:s.loading,failed:s.failed,rows:Y(s.rows)})),[W,Y]),V=n.useMemo(()=>Y(xe),[xe,Y]),dt=n.useCallback(s=>{W.find(i=>i.category===s)?.retry()},[W]),w=n.useMemo(()=>y?V:$.flatMap(s=>s.rows),[y,V,$]),{spamIds:ae,briefSpamOffer:ie}=n.useMemo(()=>{const s={spamIds:void 0,briefSpamOffer:void 0};if(!j)return s;const i=w.map(N=>Fe(N,m)),{spam:h}=Yt(i);return h.length===0?s:{spamIds:new Set(h.map(N=>N.id)),briefSpamOffer:$t(i)}},[w,j,m]),Se=n.useMemo(()=>{const s=i=>ae===void 0?i:i.filter(h=>!ae.has(h.id));return y?[{id:"matches",threads:s(V)}]:Vt($.map(i=>({...i,rows:s(i.rows)})))},[y,V,$,ae]),Ce=n.useCallback((s,i)=>{const h=w.find(N=>N.id===s)?.threadId;h&&o?.({threadId:h,messageId:s},i)},[w,o]),ut=n.useCallback(s=>{const i=s.threadId??w.find(h=>h.id===s.id)?.threadId;i&&o?.({threadId:i,messageId:s.id})},[w,o]),ce=n.useMemo(()=>p.length<=1?[]:[{id:"all",label:"All",active:b==="all"},...p.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:K.get(s.accountId),active:b===s.accountId}))],[p,K,b]),Q=n.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),mt=n.useMemo(()=>Array.from(K.values()).reduce((s,i)=>s+i,0),[K]),le=n.useMemo(()=>p.map(s=>s.accountId),[p]),{hasNewMail:Te}=bs(),{state:we,errorMessage:Re,refresh:Me}=Ss(le,{onSettled:()=>ve()}),ft=n.useMemo(()=>r.jsx(Cs,{state:we,onRefresh:Me,label:"Refresh daily brief",errorMessage:Re,hasUpdate:Te(le)}),[we,Me,Re,Te,le]),de=n.useMemo(()=>w.map(s=>Fe(s,m)),[w,m]),{hits:je,isLoading:ht}=Ms(),gt=n.useMemo(()=>{const s=new Map(w.map(h=>[h.id,h.threadId])),i=de.map(h=>s.get(h.id)).filter(h=>h!=null);return Zt(je,i,m)},[je,de,w,m]),pt=n.useMemo(()=>{const s=Jt(ce.map(i=>({id:i.id,label:i.label,count:i.count,active:i.active})));return{categories:s.categories,filters:s.filters,sources:s.sources,sourcesNote:Q>0?`+${Q} muted`:void 0,selectedCategory:_,activeFilters:D,expanded:ee,onExpandedChange:M,onSelectCategory:i=>k(i),onSelectSource:F,onToggleFilter:i=>x(i),onClear:se}},[ce,Q,_,D,ee,x,k,se]),ke=Se.length===0&&b==="all"&&j.length===0&&P.length===0,xt=n.useMemo(()=>p.map(s=>s.accountId),[p]),It=n.useMemo(()=>p.some(s=>Ts(s.syncPhase)),[p]),Z=ws(xt,ke||It),Ee=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(De,{}),r.jsx(De,{})]}),Ae=!ne&&!ye&&!ke,yt=Xt({tier:I,hasLiveInput:E,hasCommittedQuery:l.trim().length>0,bodyRendersCommittedResults:!0}),vt=Ae?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ie&&r.jsx(es,{count:ie.count,onScopeToSpam:()=>B(ie.mailboxId,l)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(ts,{sections:Se,briefCategory:_,Row:ss,selectedThreadId:t,onSelectThread:Ce,onShowAllSection:te,onRetrySection:dt,flat:y,onSelectBriefCategory:k,sources:ce,sourcesNote:Q>0?`+${Q} muted`:void 0,onSelectSource:F,activeFilters:D,onToggleFilter:x,onClearFilters:se})})]}):ne?Ee:ye?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[r.jsx(ze,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>ve(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Bs,{className:"size-3.5"}),"Try again"]})]}):Z.resolved?r.jsx(Ds,{sync:Z.syncing?{synced:Z.synced,total:Z.total}:void 0}):Ee;return r.jsx(At,{hasSheet:Ae&&!yt,children:r.jsx(os,{selectedMessageId:t,rows:w,onOpen:Ce,onDeleteMessages:d,onSelectionVerb:v.start,commandsRef:a,onTriageContextChange:c,children:r.jsx(uo,{wizard:v,header:{title:"Daily brief",unreadCount:mt,footer:T?r.jsx(rs,{}):void 0,searchFilter:pt,searchResults:de,searchLoading:ne,relatedResults:gt,relatedLoading:ht,onSelectSearchResult:ut,searchResultsInBody:!0,refreshControl:ft},rows:w,children:r.jsxs("div",{className:"flex h-full flex-col",children:[st.map(s=>r.jsx(co,{accountEmail:s.email,accountId:s.accountId},s.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:vt})]})})})})}const et=n.createContext(null);function X(){const e=n.useContext(et);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function fo({thread:e,children:t}){const o=qs(),a=Ps(),c=We(),{searchInput:d}=J(),l=e?.threadId,u=e?.messageId,{data:m}=Qe({...Ft(),staleTime:6e4}),f=n.useMemo(()=>m?.items??[],[m]),g=n.useMemo(()=>{if(l)return f.find(x=>x.messageId===u)??f.find(x=>x.threadId===l)},[f,l,u]),T=ms(l,u),I=g??T,v=u??I?.messageId,B=n.useMemo(()=>{if(l)return{threadId:l,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:v,authenticity:I?.authenticity}},[l,I,v]),p=n.useCallback((x,k)=>{o(x,{replace:k?.replace,query:d})},[o,d]),b=n.useCallback(x=>{v&&x.includes(v)&&a()},[v,a]),F=Oe({thread:I,isOpen:!0,onAfterOptimisticRemove:b}),S=fs(),{deleteMessages:R}=hs({mailboxId:I?.mailboxId??"",messages:f,onAfterOptimisticRemove:b}),{toggleReadFor:O}=gs({mailboxId:I?.mailboxId??"",messages:f}),L=S.focusedMessageId,M=n.useMemo(()=>f.find(x=>x.messageId===L),[f,L])??I,q=Oe({thread:M,isOpen:M?.messageId===v}),G=Ls(),E=Ot(),j=Nt(),P=n.useMemo(()=>Bt(j,l,v),[j,l,v]),y=n.useMemo(()=>{if(M)return x=>j({threadId:M.threadId,messageId:M.messageId,mode:x})},[j,M]),{nextMessageId:D,previousMessageId:_}=ps({context:S,orderedIds:S.orderedIds,selectedMessageId:v,enabled:!G&&!E,hasOpenThread:l!==void 0,onClose:a,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||q.deleteThread()},toggleStar:q.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||M&&O([M.messageId],!M.isRead)},goFlagged:()=>c("flagged"),goSettings:()=>c("settings")}}),A=n.useCallback(x=>{if(!x)return;const k=f.find(te=>te.messageId===x);return k?{threadId:k.threadId,messageId:x}:void 0},[f]),C={selectedMessageId:v,selectedThread:I,conversation:B,onOpenThread:p,onCloseThread:a,nextThread:A(D),previousThread:A(_),actions:F,onReply:P,triage:S,onDeleteMessages:R,handleDeselectIfRemoved:b};return r.jsx(et.Provider,{value:C,children:t})}function tt(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:a}=X(),{accounts:c}=J();return r.jsx(mo,{accounts:c,selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:a})}function ho(){const{conversation:e,selectedThread:t,actions:o,onReply:a,handleDeselectIfRemoved:c}=X(),d=!!e,l=ys(e?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(vs,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:d?o.deleteThread:void 0,onToggleStar:d?o.toggleStar:void 0,isStarred:o.isStarred,moveContext:d&&o.accountId&&o.mailboxId?{accountId:o.accountId,currentMailboxId:o.mailboxId,onMove:o.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx(Ue,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:l.open,listOnScreen:!0}):r.jsx(Dt,{})})]}),r.jsx(Ke,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function go(){const{selectedThread:e,handleDeselectIfRemoved:t}=X(),{onToggleIntelligence:o}=J();return r.jsx(Is,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function po(){const{selectedThread:e,conversation:t,onOpenThread:o,onCloseThread:a,nextThread:c,previousThread:d,handleDeselectIfRemoved:l}=X(),u=xs(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx(Ue,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:a,onOpenIntelligence:u.toggle,onSwipeNext:c?()=>o(c):void 0,onSwipePrevious:d?()=>o(d):void 0,mobileIntelligenceOpen:u.isOpen}),r.jsx(Ke,{isOpen:u.isOpen,onClose:u.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:l})]}):r.jsx("div",{className:"h-full",children:r.jsx(tt,{})})}const Eo=Object.assign(fo,{List:tt,Reading:ho,Intelligence:go,Phone:po});export{Eo as B};
|
|
1
|
+
import{j as r,L as Tt,U as wt,ee as _e,ef as ue,ci as me,r as n,c as Qe,C as J,bi as Rt,cM as Mt,H as jt,dB as kt,eg as Et,_ as ze,dZ as At,eh as Ft,aj as Ot,cT as Nt,cU as Bt}from"./index-BSMLcnNv.js";import{g as He,e as Lt,f as Ge,u as qt,p as Pt,R as Dt}from"./useSearchTokenContext-BOZY3WZQ.js";import{ac as _t,G as Qt,I as zt,ap as Ht,aq as Gt,ar as Ut,as as Kt,at as Wt,au as Fe,av as Yt,aw as $t,ax as Vt,ab as Zt,ay as Jt,az as Xt,aA as es,aj as ts,M as ss,aB as os,ak as rs,aC as ns,aD as as,e as is,w as cs,am as ls,s as ds,S as us,O as ms,T as Oe,R as fs,P as hs,d as gs,a0 as ps,a1 as xs,a3 as Ue,a4 as Ke,a5 as Is,a6 as ys,a7 as vs}from"./MailListHeader-CP5Mrq7I.js";import{u as bs,a as Ss,R as Cs,b as Ts,c as ws}from"./useRefreshControl-D15eEjeE.js";import{u as fe}from"./useQueries-hzIIiVUF.js";import{t as Rs,u as Ms,r as js,L as ks}from"./useSemanticSearch-DT9Nt957.js";import{a as Es}from"./useLabels-BTBI_l7Q.js";import{u as As,b as Fs}from"./useLayoutTier-C5sdkyR7.js";import{d as Os,w as Ns}from"./wizard-selection-DxUM65kM.js";import{u as We}from"./sections-B3k1IUqe.js";import{R as Bs}from"./refresh-cw-Bdx0EEOe.js";import{a as Ls}from"./useMessageBodyContent-BuyQJK-3.js";import{g as qs,h as Ps}from"./search-token-index-srRTXc29.js";function Ds({sync:e}){return e?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[r.jsx(Tt,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:_s(e)})]}):r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[r.jsx(wt,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function _s({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 Ye=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],$e="category",Qs={unclassified:"uncategorized"},H=e=>Lt(e).map(t=>t.raw),z=e=>e.join(" "),he=e=>{const t=Ge(e);if(t)return Ye.find(o=>o.name===t.name&&o.value===t.value.toLowerCase())?.id},ge=e=>{const t=Ge(e);if(!t||t.name!==$e)return;const o=t.value.toLowerCase(),a=Qs[o];if(a)return a;if(!(!_e(o)||o==="all"))return o},Ve=e=>Ye.find(t=>t.id===e),Ze=e=>Ve(e)!==void 0,zs=e=>{const t=new Set;for(const o of H(e)){const a=he(o);a&&t.add(a)}return t},Hs=e=>{let t="all";for(const o of H(e)){const a=ge(o);a&&(t=a)}return t},Gs=(e,t)=>{const o=Ve(t);if(!o)return;const a=H(e),c=a.filter(d=>he(d)!==t);return c.length<a.length?z(c):z([...a,He(o.name,o.value)])},Us=(e,t)=>{const o=H(e).filter(a=>!ge(a));return z(t==="all"?o:[...o,He($e,t)])},Ks=e=>z(H(e).filter(t=>!he(t)&&!ge(t))),Je=e=>e.trim().length>0,Ne=e=>{if(!Je(e.query))return e.ownFilters;const t=new Set(zs(e.query));for(const o of e.ownFilters)Ze(o)||t.add(o);return t},Be=e=>Je(e.query)?Hs(e.query):e.ownCategory,Le=6e4,Ws=3e4,Ys={kind:"unknown"},qe=e=>(t,o)=>_t(o?.queryKey,e)?t:void 0,$s=(e,t,o)=>({...e,category:[t],limit:o,order:"desc"}),Vs=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),Pe=(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}:{}});function Zs({categories:e,criteria:t,limit:o,counted:a}){const c=fe({queries:e.map(m=>{const f=$s(t,m,o),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},placeholderData:qe(g),staleTime:Le}})}),d=fe({queries:e.map(m=>{const f=Vs(t,m),g=Pe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},enabled:a,placeholderData:qe(g),staleTime:Le}})}),l=n.useMemo(()=>e.map((m,f)=>{const g=c[f],T=d[f],I=g?.data?.items??[];return{category:m,rows:I,atCap:I.length>=o,total:a?Rs(T?.data?.count):Ys,loading:g?.isPending??!0,failed:g?.isError??!1,retry:()=>{g?.refetch(),a&&T?.refetch()}}}),[e,c,d,a,o]),u=n.useCallback(()=>{for(const m of c)m.refetch();for(const m of d)m.refetch()},[c,d]);return{sections:l,isLoading:c.length>0&&c.every(m=>m.isPending),isError:c.length>0&&c.every(m=>m.isError),refetch:u}}function Js(e,t,o){const a={...e,limit:t,order:"desc"},{data:c,isLoading:d,isError:l,refetch:u}=Qe({queryKey:me({query:a}),queryFn:async()=>{const{data:f}=await ue({query:a,throwOnError:!0});return f},enabled:o,staleTime:Ws});return{rows:n.useMemo(()=>o?c?.items??[]:[],[c,o]),isLoading:o&&d,isError:o&&l,refetch:n.useCallback(()=>{u()},[u])}}const Xs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),eo=e=>[...e].sort(Xs),to=["category","unread","starred","attachments"],Xe=["contacts","today"],so=e=>new Set(Xe.filter(t=>e.has(t))),oo=(e,t,o)=>{const a=Qt({category:e,attributes:t}),{params:c,residual:d}=zt(o,a,to),l={...c,...a},u={};return l.unread!==void 0&&(u.unread=l.unread),l.starred!==void 0&&(u.starred=l.starred),l.attachments!==void 0&&(u.attachments=l.attachments),{criteria:u,residual:d}},ro=({residual:e,attributes:t,accountScoped:o})=>e.length===0&&!o&&!Xe.some(a=>t.has(a)),no=50,ao=200,io=[],De=()=>r.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>r.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[r.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsxs("div",{className:"flex justify-between gap-2",children:[r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),r.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},t))}),co=({accountEmail:e})=>{const t=We();return r.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[r.jsx(ze,{className:"size-3.5 shrink-0"}),r.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),r.jsx("button",{type:"button",onClick:()=>t("accounts"),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},lo=(e,t)=>{if(t.size===0)return{};const o=e.filter(d=>t.has(d.id)),a=js(o.map(d=>d.accountId));if(a.restriction)return a;const c=new Set;for(const d of o)d.mailboxId&&c.add(d.mailboxId);return c.size>1?{accountId:a.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${c.size} folders`}:{accountId:a.accountId,mailboxId:c.size===1?[...c][0]:void 0}};function uo({header:e,rows:t,wizard:o,children:a}){const{selectedIds:c,selectedCount:d,exitSelection:l,orderedIds:u,allSelected:m,toggleAllLoaded:f}=as(),g=n.useMemo(()=>lo(t,c),[t,c]),{junkMailboxId:T}=is(g.accountId),{labels:I}=Es(g.accountId),v=n.useMemo(()=>Array.from(c),[c]),B=n.useMemo(()=>Ns(t,c),[t,c]),p=cs(T,g.mailboxId),b=n.useMemo(()=>u.length>0?{checked:m,indeterminate:d>0&&!m,onChange:f}:void 0,[u.length,m,d,f]),F=g.moveDisabledHint?{tone:"warning",text:g.moveDisabledHint}:void 0,S=R=>r.jsx(us,{title:R.title,navSlot:R.navSlot,titleMeta:R.titleMeta,searchSlot:R.searchSlot,searchField:R.searchField,idleSlot:R.makeFilterSlot,count:d,onCancel:l,onDelete:()=>o.start("delete"),onMove:()=>o.start("move"),onOrganize:()=>o.start("organize"),onJunk:p?()=>o.start("junk"):void 0,onMarkRead:()=>o.start("markRead"),overflowSlot:g.accountId&&g.mailboxId&&d>0&&I.length>0?r.jsx(ks,{accountId:g.accountId,mailboxId:g.mailboxId,messageIds:v}):void 0,selectAll:b,notice:F});return r.jsx(ls,{...e,selectionBar:S,paneOverlay:r.jsx(ds,{verb:o.verb,accountId:g.accountId,mailboxId:g.mailboxId,selection:B,selectionRestriction:g.restriction,onFinished:l}),children:a})}function mo({accounts:e,selectedMessageId:t,onOpenThread:o,commandsRef:a,onTriageContextChange:c,onDeleteMessages:d}){const{searchQuery:l,searchInput:u,resultFolderIndex:m,onSearchChange:f}=J(),g=qt(),T=Rt(),I=As(),v=Mt(),B=Fs(),p=n.useMemo(()=>eo(e.filter(s=>!s.muted?.value)),[e]),[b,F]=n.useState("all"),[S,R]=n.useState("all"),[O,L]=n.useState(new Set),[ee,M]=n.useState(!1),q=n.useCallback(s=>{L(i=>{const h=new Set(i);return h.has(s)?h.delete(s):h.add(s),h})},[]),G=n.useCallback(()=>L(new Set),[]),E=u.trim().length>0,{freeText:j,tokens:P}=Pt(l.trim().toLowerCase(),g),y=j.length>0,D=n.useMemo(()=>Ne({query:u,ownFilters:O}),[u,O]),_=n.useMemo(()=>Be({query:u,ownCategory:S}),[u,S]),A=n.useMemo(()=>Ne({query:l,ownFilters:O}),[l,O]),C=n.useMemo(()=>Be({query:l,ownCategory:S}),[l,S]),x=n.useCallback(s=>{if(!E||!Ze(s)){q(s);return}const i=Gs(u,s);i!==void 0&&f(i)},[E,u,f,q]),k=n.useCallback(s=>{if(!E){R(s);return}f(Us(u,s))},[E,u,f]),te=n.useMemo(()=>C==="all"&&!y?s=>{_e(s)&&k(s)}:void 0,[C,y,k]),se=n.useCallback(()=>{R("all"),F("all"),G(),E&&f(Ks(u))},[E,u,f,G]),U=fe({queries:p.map(s=>({...jt({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),K=n.useMemo(()=>{const s=new Map;for(let i=0;i<p.length;i++){const h=p[i].accountId,bt=(U[i]?.data?.items??[]).reduce((St,Ct)=>St+(Ct.unseenCount??0),0);s.set(h,bt)}return s},[p,U]),st=n.useMemo(()=>p.filter((s,i)=>{const h=U[i];return h?.isError?!kt(h.error):!1}),[p,U]),{criteria:oe,residual:re}=n.useMemo(()=>oo(C,A,P),[C,A,P]),ot=n.useMemo(()=>C==="all"?[...Ht]:[C],[C]),rt=n.useMemo(()=>({...oe,query:j,...C==="all"?{}:{category:[C]}}),[oe,j,C]),nt=ro({residual:re,attributes:A,accountScoped:b!=="all"}),{sections:W,isLoading:at,isError:it,refetch:pe}=Zs({categories:y?io:ot,criteria:oe,limit:C==="all"?ns:no,counted:nt}),{rows:xe,isLoading:ct,isError:lt,refetch:Ie}=Js(rt,ao,y),ne=y?ct:at,ye=y?lt:it,ve=n.useCallback(()=>{if(y){Ie();return}pe()},[y,Ie,pe]),be=n.useMemo(()=>so(A),[A]),Y=n.useCallback(s=>Os(Gt(s)).map(Ut).filter(i=>(b==="all"||i.accountId===b)&&Et(i,be)&&Kt(i,re)),[b,be,re]),$=n.useMemo(()=>W.map(s=>({category:s.category,total:Wt(s.total,s.rows),atCap:s.atCap,loading:s.loading,failed:s.failed,rows:Y(s.rows)})),[W,Y]),V=n.useMemo(()=>Y(xe),[xe,Y]),dt=n.useCallback(s=>{W.find(i=>i.category===s)?.retry()},[W]),w=n.useMemo(()=>y?V:$.flatMap(s=>s.rows),[y,V,$]),{spamIds:ae,briefSpamOffer:ie}=n.useMemo(()=>{const s={spamIds:void 0,briefSpamOffer:void 0};if(!j)return s;const i=w.map(N=>Fe(N,m)),{spam:h}=Yt(i);return h.length===0?s:{spamIds:new Set(h.map(N=>N.id)),briefSpamOffer:$t(i)}},[w,j,m]),Se=n.useMemo(()=>{const s=i=>ae===void 0?i:i.filter(h=>!ae.has(h.id));return y?[{id:"matches",threads:s(V)}]:Vt($.map(i=>({...i,rows:s(i.rows)})))},[y,V,$,ae]),Ce=n.useCallback((s,i)=>{const h=w.find(N=>N.id===s)?.threadId;h&&o?.({threadId:h,messageId:s},i)},[w,o]),ut=n.useCallback(s=>{const i=s.threadId??w.find(h=>h.id===s.id)?.threadId;i&&o?.({threadId:i,messageId:s.id})},[w,o]),ce=n.useMemo(()=>p.length<=1?[]:[{id:"all",label:"All",active:b==="all"},...p.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:K.get(s.accountId),active:b===s.accountId}))],[p,K,b]),Q=n.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),mt=n.useMemo(()=>Array.from(K.values()).reduce((s,i)=>s+i,0),[K]),le=n.useMemo(()=>p.map(s=>s.accountId),[p]),{hasNewMail:Te}=bs(),{state:we,errorMessage:Re,refresh:Me}=Ss(le,{onSettled:()=>ve()}),ft=n.useMemo(()=>r.jsx(Cs,{state:we,onRefresh:Me,label:"Refresh daily brief",errorMessage:Re,hasUpdate:Te(le)}),[we,Me,Re,Te,le]),de=n.useMemo(()=>w.map(s=>Fe(s,m)),[w,m]),{hits:je,isLoading:ht}=Ms(),gt=n.useMemo(()=>{const s=new Map(w.map(h=>[h.id,h.threadId])),i=de.map(h=>s.get(h.id)).filter(h=>h!=null);return Zt(je,i,m)},[je,de,w,m]),pt=n.useMemo(()=>{const s=Jt(ce.map(i=>({id:i.id,label:i.label,count:i.count,active:i.active})));return{categories:s.categories,filters:s.filters,sources:s.sources,sourcesNote:Q>0?`+${Q} muted`:void 0,selectedCategory:_,activeFilters:D,expanded:ee,onExpandedChange:M,onSelectCategory:i=>k(i),onSelectSource:F,onToggleFilter:i=>x(i),onClear:se}},[ce,Q,_,D,ee,x,k,se]),ke=Se.length===0&&b==="all"&&j.length===0&&P.length===0,xt=n.useMemo(()=>p.map(s=>s.accountId),[p]),It=n.useMemo(()=>p.some(s=>Ts(s.syncPhase)),[p]),Z=ws(xt,ke||It),Ee=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(De,{}),r.jsx(De,{})]}),Ae=!ne&&!ye&&!ke,yt=Xt({tier:I,hasLiveInput:E,hasCommittedQuery:l.trim().length>0,bodyRendersCommittedResults:!0}),vt=Ae?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ie&&r.jsx(es,{count:ie.count,onScopeToSpam:()=>B(ie.mailboxId,l)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(ts,{sections:Se,briefCategory:_,Row:ss,selectedThreadId:t,onSelectThread:Ce,onShowAllSection:te,onRetrySection:dt,flat:y,onSelectBriefCategory:k,sources:ce,sourcesNote:Q>0?`+${Q} muted`:void 0,onSelectSource:F,activeFilters:D,onToggleFilter:x,onClearFilters:se})})]}):ne?Ee:ye?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[r.jsx(ze,{className:"size-8 text-danger"}),r.jsx("p",{children:"Couldn't load your messages"}),r.jsxs("button",{type:"button",onClick:()=>ve(),className:"flex items-center gap-1 text-accent underline text-xs",children:[r.jsx(Bs,{className:"size-3.5"}),"Try again"]})]}):Z.resolved?r.jsx(Ds,{sync:Z.syncing?{synced:Z.synced,total:Z.total}:void 0}):Ee;return r.jsx(At,{hasSheet:Ae&&!yt,children:r.jsx(os,{selectedMessageId:t,rows:w,onOpen:Ce,onDeleteMessages:d,onSelectionVerb:v.start,commandsRef:a,onTriageContextChange:c,children:r.jsx(uo,{wizard:v,header:{title:"Daily brief",unreadCount:mt,footer:T?r.jsx(rs,{}):void 0,searchFilter:pt,searchResults:de,searchLoading:ne,relatedResults:gt,relatedLoading:ht,onSelectSearchResult:ut,searchResultsInBody:!0,refreshControl:ft},rows:w,children:r.jsxs("div",{className:"flex h-full flex-col",children:[st.map(s=>r.jsx(co,{accountEmail:s.email,accountId:s.accountId},s.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:vt})]})})})})}const et=n.createContext(null);function X(){const e=n.useContext(et);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function fo({thread:e,children:t}){const o=qs(),a=Ps(),c=We(),{searchInput:d}=J(),l=e?.threadId,u=e?.messageId,{data:m}=Qe({...Ft(),staleTime:6e4}),f=n.useMemo(()=>m?.items??[],[m]),g=n.useMemo(()=>{if(l)return f.find(x=>x.messageId===u)??f.find(x=>x.threadId===l)},[f,l,u]),T=ms(l,u),I=g??T,v=u??I?.messageId,B=n.useMemo(()=>{if(l)return{threadId:l,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:v,authenticity:I?.authenticity}},[l,I,v]),p=n.useCallback((x,k)=>{o(x,{replace:k?.replace,query:d})},[o,d]),b=n.useCallback(x=>{v&&x.includes(v)&&a()},[v,a]),F=Oe({thread:I,isOpen:!0,onAfterOptimisticRemove:b}),S=fs(),{deleteMessages:R}=hs({mailboxId:I?.mailboxId??"",messages:f,onAfterOptimisticRemove:b}),{toggleReadFor:O}=gs({mailboxId:I?.mailboxId??"",messages:f}),L=S.focusedMessageId,M=n.useMemo(()=>f.find(x=>x.messageId===L),[f,L])??I,q=Oe({thread:M,isOpen:M?.messageId===v}),G=Ls(),E=Ot(),j=Nt(),P=n.useMemo(()=>Bt(j,l,v),[j,l,v]),y=n.useMemo(()=>{if(M)return x=>j({threadId:M.threadId,messageId:M.messageId,mode:x})},[j,M]),{nextMessageId:D,previousMessageId:_}=ps({context:S,orderedIds:S.orderedIds,selectedMessageId:v,enabled:!G&&!E,hasOpenThread:l!==void 0,onClose:a,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||q.deleteThread()},toggleStar:q.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||M&&O([M.messageId],!M.isRead)},goFlagged:()=>c("flagged"),goSettings:()=>c("settings")}}),A=n.useCallback(x=>{if(!x)return;const k=f.find(te=>te.messageId===x);return k?{threadId:k.threadId,messageId:x}:void 0},[f]),C={selectedMessageId:v,selectedThread:I,conversation:B,onOpenThread:p,onCloseThread:a,nextThread:A(D),previousThread:A(_),actions:F,onReply:P,triage:S,onDeleteMessages:R,handleDeselectIfRemoved:b};return r.jsx(et.Provider,{value:C,children:t})}function tt(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:a}=X(),{accounts:c}=J();return r.jsx(mo,{accounts:c,selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:a})}function ho(){const{conversation:e,selectedThread:t,actions:o,onReply:a,handleDeselectIfRemoved:c}=X(),d=!!e,l=ys(e?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(vs,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:d?o.deleteThread:void 0,onToggleStar:d?o.toggleStar:void 0,isStarred:o.isStarred,moveContext:d&&o.accountId&&o.mailboxId?{accountId:o.accountId,currentMailboxId:o.mailboxId,onMove:o.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx(Ue,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:l.open,listOnScreen:!0}):r.jsx(Dt,{})})]}),r.jsx(Ke,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function go(){const{selectedThread:e,handleDeselectIfRemoved:t}=X(),{onToggleIntelligence:o}=J();return r.jsx(Is,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function po(){const{selectedThread:e,conversation:t,onOpenThread:o,onCloseThread:a,nextThread:c,previousThread:d,handleDeselectIfRemoved:l}=X(),u=xs(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx(Ue,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:a,onOpenIntelligence:u.toggle,onSwipeNext:c?()=>o(c):void 0,onSwipePrevious:d?()=>o(d):void 0,mobileIntelligenceOpen:u.isOpen}),r.jsx(Ke,{isOpen:u.isOpen,onClose:u.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:l})]}):r.jsx("div",{className:"h-full",children:r.jsx(tt,{})})}const Eo=Object.assign(fo,{List:tt,Reading:ho,Intelligence:go,Phone:po});export{Eo as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee,i as _}from"./window-DF8WTXnA.js";import{j as n,f as j,t as d,Y as te,Z as ne,ay as f,r as p,ax as ae,X as se,i as T,en as re,eo as ie,ep as le,h as oe,s as ce,b1 as de,_ as ue}from"./index-ChbCI5oi.js";import{f as me}from"./ErrorState-CrWgETYJ.js";import{R as z,c as he}from"./calendar-color-CQ0fCP2x.js";const xe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],pe=["January","February","March","April","May","June","July","August","September","October","November","December"],fe=["first","second","third","fourth","last"],A="";function ye(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[a,s,i]=e.split("-").map(Number),r=new Date(Date.UTC(a,s-1,i)),l=xe[r.getUTCDay()],o=fe[Math.min(Math.floor((i-1)/7),4)],c=t===""?"":`, ${t}`,y=r.getUTCDay()>=1&&r.getUTCDay()<=5;return[`Every day${c}`,...y?[`Every weekday${c}`]:[],`Every week on ${l}${c}`,`Every month on the ${o} ${l}${c}`,`Every year on ${i} ${pe[s-1]}${c}`]}const ve="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",u=({draft:e,onChange:t},a,s)=>t({...e,[a]:s});function x({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 ge({draft:e,onChange:t,layout:a="compact",touch:s}){const i=a==="pane";return n.jsx(f,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:r=>u({draft:e,onChange:t},"title",r.target.value),className:d(i?"text-lg font-medium":"text-md font-medium",i?"h-11":s?"min-h-11":"")})}function H(e){return e.allDay||e.startTime===""||e.endTime===""?!1:e.endTime<e.startTime}function be({draft:e,onChange:t,touch:a}){const s=a?"min-h-11":"",i=H(e),r=p.useId();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(f,{type:"date",value:e.date,"aria-label":"Date",onChange:l=>u({draft:e,onChange:t},"date",l.target.value),className:d("w-40",s)}),e.allDay?n.jsx("span",{className:"text-sm text-fg-muted",children:"All day"}):n.jsxs(n.Fragment,{children:[n.jsx(f,{type:"time",value:e.startTime,"aria-label":"Start time",max:e.endTime===""?void 0:e.endTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"startTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(f,{type:"time",value:e.endTime,"aria-label":"End time",min:e.startTime===""?void 0:e.startTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"endTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")})]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:l=>u({draft:e,onChange:t},"allDay",l.target.checked),className:"size-4 accent-current"}),"All day"]})]}),i&&n.jsxs("p",{id:r,className:"text-xs text-danger",role:"alert",children:["Ends before it starts. Move the end past ",e.startTime,", or start earlier."]})]})}function Ee({draft:e,onChange:t,calendars:a,touch:s}){return n.jsx(Ae,{calendars:a,value:e.calendarId,onChange:i=>u({draft:e,onChange:t},"calendarId",i),touch:s})}function Ne({draft:e,onChange:t,touch:a,repeatEditable:s=!0,onCustom:i}){return s?n.jsx(ke,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:r=>u({draft:e,onChange:t},"repeat",r),onCustom:i,className:a?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(z,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===A?"Does not repeat":e.repeat]})}function je({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:s=>u({draft:e,onChange:t},"location",s.target.value),className:a?"min-h-11":""})}function Te({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:s=>u({draft:e,onChange:t},"guests",s.target.value),className:a?"min-h-11":""})}function Ce({draft:e,onChange:t,layout:a="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:s=>u({draft:e,onChange:t},"notes",s.target.value),rows:a==="pane"?6:3,className:ve})}function De({draft:e,onChange:t,calendars:a,layout:s="compact",expanded:i=!1,onToggleExpanded:r,onSave:l,onCancel:o,onDelete:c,saveLabel:y="Add",header:g,repeatEditable:b=!0,guestsEditable:I=!1,calendarEditable:M=!0,onCustomRepeat:X,touch:m,className:w}){const v=s==="pane",h={draft:e,onChange:t,layout:s,touch:m},S=n.jsx(ge,{...h}),$=n.jsx(be,{...h}),R=n.jsx(Ee,{...h,calendars:a}),F=n.jsx(Ne,{...h,repeatEditable:b,onCustom:X}),Y=n.jsx(je,{...h}),L=n.jsx(Te,{...h}),P=n.jsx(Ce,{...h}),W=n.jsxs("div",{className:d("flex items-center gap-2",v?"pt-2":"pt-1"),children:[n.jsx(j,{variant:"primary",size:m||v?"md":"sm",onClick:l,disabled:H(e),className:m?"min-h-11 flex-1":"",children:y}),n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:o,className:m?"min-h-11":"",children:"Cancel"}),c&&n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:c,className:d("ml-auto text-danger",m&&"min-h-11"),children:"Delete"})]});if(v)return n.jsxs("div",{className:d("flex flex-col gap-5",w),children:[g,n.jsx(x,{label:"Title",children:S}),n.jsx(x,{label:"When",children:$}),M&&n.jsx(x,{label:"Calendar",children:R}),n.jsx(x,{label:"Repeat",children:F}),n.jsx(x,{label:"Location",children:Y}),I&&n.jsx(x,{label:"Guests",children:L}),n.jsx(x,{label:"Notes",children:P}),W]});const Z=r!==void 0&&!i;return n.jsxs("div",{className:d("flex flex-col gap-3",w),children:[g,S,$,M&&R,r&&n.jsxs("button",{type:"button",onClick:r,"aria-expanded":i,className:d("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",m&&"min-h-11"),children:[i?n.jsx(te,{className:"size-3.5"}):n.jsx(ne,{className:"size-3.5"}),i?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[Y,I&&L,F,P]}),W]})}const U="__custom__";function ke({value:e,date:t,startTime:a,onChange:s,onCustom:i,className:r}){const l=ye(t,a),o=e===A||l.includes(e)?l:[e,...l];return n.jsxs(ae,{icon:n.jsx(z,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:c=>{if(c.target.value===U){i?.();return}s(c.target.value)},className:r,children:[n.jsx("option",{value:A,children:"Does not repeat"}),o.map(c=>n.jsx("option",{value:c,children:c},c)),i&&n.jsx("option",{value:U,children:"Custom…"})]})}function Ae({calendars:e,value:t,onChange:a,touch:s}){const i=p.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(r=>{const l=he(r.color),o=r.id===t;return n.jsxs("label",{className:d("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",s?"min-h-11":"h-7",o?d(l.soft,l.text,l.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:i,value:r.id,checked:o,onChange:()=>a(r.id),className:"sr-only"}),n.jsx("span",{className:d("size-2 rounded-full",l.solid)}),r.name]},r.id)})]})}function Oe({title:e,subtitle:t,onClose:a,children:s,className:i}){return n.jsxs("section",{className:d("flex h-full w-full flex-col bg-surface",i),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:a,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(se,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}const E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],N=["SU","MO","TU","WE","TH","FR","SA"],Q=["January","February","March","April","May","June","July","August","September","October","November","December"],K=["first","second","third","fourth","last"],G=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",Ie=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(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 a=t.match(/^Every week on (\w+)$/);if(a){const r=E.indexOf(a[1]);return r===-1?void 0:`FREQ=WEEKLY;BYDAY=${N[r]}`}const s=t.match(/^Every month on the (\w+) (\w+)$/);if(s){const r=K.indexOf(s[1]),l=E.indexOf(s[2]);return r===-1||l===-1?void 0:`FREQ=MONTHLY;BYDAY=${G[r]}${N[l]}`}const i=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(i){const r=Q.indexOf(i[2]);return r===-1?void 0:`FREQ=YEARLY;BYMONTH=${r+1};BYMONTHDAY=${Number(i[1])}`}}const Me=e=>e===""?"":`, ${e}`;function Pe(e,t){const a=new Map(e.split(";").map(l=>l.split("=")).filter(l=>l.length===2).map(([l,o])=>[l.toUpperCase(),o.toUpperCase()])),s=Me(t),i=a.get("FREQ"),r=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(i==="DAILY")return`Every day${s}`;if(i==="WEEKLY"){if(r===void 0)return;if(r===J)return`Every weekday${s}`;const l=N.indexOf(r);return l===-1?void 0:`Every week on ${E[l]}${s}`}if(i==="MONTHLY"){const l=r?.match(/^(-?\d)([A-Z]{2})$/);if(!l)return;const o=G.indexOf(Number(l[1])),c=N.indexOf(l[2]);return o===-1||c===-1?void 0:`Every month on the ${K[o]} ${E[c]}${s}`}if(i==="YEARLY"){const l=Number(a.get("BYMONTH")),o=Number(a.get("BYMONTHDAY"));return!l||!o||l>12?void 0:`Every year on ${o} ${Q[l-1]}${s}`}}}function We(e,t){return{title:"",date:e,startTime:"09:00",endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function _e(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),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:ee(e.date,1)}:{start:_(e.date,e.startTime,t),end:_(e.date,e.endTime,t)}}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.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.endTime<=e.startTime?"The end time is not after the start time. Move one of them.":t&&O(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Ue(e,t){const a=V(e,!0);if(a!=="")return{ok:!1,problem:a};const{start:s,end:i}=q(e,t);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:s,end:i,allDay:e.allDay,...t===""?{}:{timeZone:t},recurrenceRule:O(e.repeat)??""}}}function Be(e,t,a){const s=t.repeat!==e.repeat,i=V(t,s);if(i!=="")return{ok:!1,problem:i};const r={};if(t.title.trim()!==e.title.trim()&&(r.summary=t.title.trim()),t.location!==e.location&&(r.location=t.location),t.notes!==e.notes&&(r.description=t.notes),t.date!==e.date||t.startTime!==e.startTime||t.endTime!==e.endTime||t.allDay!==e.allDay){const{start:o,end:c}=q(t,a);r.start=o,r.end=c,r.allDay=t.allDay,a!==""&&(r.timeZone=a)}return s&&(r.recurrenceRule=O(t.repeat)??""),{ok:!0,patch:r}}const C=ce(400,404,412),we=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),D={kind:"written"},k=e=>de(e)===412?{kind:"conflict"}:{kind:"refused",message:me(e)},Se={this:"This",following:"Following",all:"All"};function $e(){const e=oe();return p.useCallback(()=>{e.invalidateQueries({predicate:t=>{const a=t.queryKey[0];if(typeof a!="object"||a===null)return!1;const s=a._id;return typeof s=="string"&&we.has(s)}})},[e])}const B=({scope:e,recurrenceId:t})=>e===void 0||e==="all"?{}:{scope:Se[e],recurrenceId:t};function ze(){const e=$e(),t=T({...re(),meta:C,onSuccess:e}),a=T({...ie(),meta:C,onSuccess:e}),s=T({...le(),meta:C,onSuccess:e}),i=p.useCallback(o=>t.mutateAsync({body:o}).then(()=>D).catch(k),[t]),r=p.useCallback((o,c)=>a.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag},body:c}).then(()=>D).catch(k),[a]),l=p.useCallback(o=>s.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag}}).then(()=>D).catch(k),[s]);return p.useMemo(()=>({createEvent:i,updateEvent:r,deleteEvent:l,isWriting:t.isPending||a.isPending||s.isPending}),[i,r,l,t.isPending,a.isPending,s.isPending])}function He({title:e,subtitle:t,calendars:a,draft:s,onChange:i,problem:r,saveLabel:l,isSaving:o,repeatEditable:c=!0,calendarEditable:y=!0,onSave:g,onCancel:b}){return n.jsx(Oe,{title:e,subtitle:t,onClose:b,children:n.jsx(De,{draft:s,onChange:i,calendars:a,layout:"pane",repeatEditable:c,calendarEditable:y,saveLabel:o?"Saving…":l,onSave:g,onCancel:b,header:r===""?void 0: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(ue,{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:r})]})})})}export{He as C,Ue as c,_e as d,We as e,Be as p,Pe as t,ze as u};
|
|
1
|
+
import{a as ee,i as _}from"./window-ZjseaC3I.js";import{j as n,f as j,t as d,Y as te,Z as ne,ay as f,r as p,ax as ae,X as se,i as T,en as re,eo as ie,ep as le,h as oe,s as ce,b1 as de,_ as ue}from"./index-BSMLcnNv.js";import{f as me}from"./ErrorState-jZhKH-Aj.js";import{R as z,c as he}from"./calendar-color-PMGOIawE.js";const xe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],pe=["January","February","March","April","May","June","July","August","September","October","November","December"],fe=["first","second","third","fourth","last"],A="";function ye(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[a,s,i]=e.split("-").map(Number),r=new Date(Date.UTC(a,s-1,i)),l=xe[r.getUTCDay()],o=fe[Math.min(Math.floor((i-1)/7),4)],c=t===""?"":`, ${t}`,y=r.getUTCDay()>=1&&r.getUTCDay()<=5;return[`Every day${c}`,...y?[`Every weekday${c}`]:[],`Every week on ${l}${c}`,`Every month on the ${o} ${l}${c}`,`Every year on ${i} ${pe[s-1]}${c}`]}const ve="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",u=({draft:e,onChange:t},a,s)=>t({...e,[a]:s});function x({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 ge({draft:e,onChange:t,layout:a="compact",touch:s}){const i=a==="pane";return n.jsx(f,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:r=>u({draft:e,onChange:t},"title",r.target.value),className:d(i?"text-lg font-medium":"text-md font-medium",i?"h-11":s?"min-h-11":"")})}function H(e){return e.allDay||e.startTime===""||e.endTime===""?!1:e.endTime<e.startTime}function be({draft:e,onChange:t,touch:a}){const s=a?"min-h-11":"",i=H(e),r=p.useId();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(f,{type:"date",value:e.date,"aria-label":"Date",onChange:l=>u({draft:e,onChange:t},"date",l.target.value),className:d("w-40",s)}),e.allDay?n.jsx("span",{className:"text-sm text-fg-muted",children:"All day"}):n.jsxs(n.Fragment,{children:[n.jsx(f,{type:"time",value:e.startTime,"aria-label":"Start time",max:e.endTime===""?void 0:e.endTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"startTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(f,{type:"time",value:e.endTime,"aria-label":"End time",min:e.startTime===""?void 0:e.startTime,"aria-invalid":i,"aria-describedby":i?r:void 0,onChange:l=>u({draft:e,onChange:t},"endTime",l.target.value),className:d("w-28",s,i&&"border-danger/60")})]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:l=>u({draft:e,onChange:t},"allDay",l.target.checked),className:"size-4 accent-current"}),"All day"]})]}),i&&n.jsxs("p",{id:r,className:"text-xs text-danger",role:"alert",children:["Ends before it starts. Move the end past ",e.startTime,", or start earlier."]})]})}function Ee({draft:e,onChange:t,calendars:a,touch:s}){return n.jsx(Ae,{calendars:a,value:e.calendarId,onChange:i=>u({draft:e,onChange:t},"calendarId",i),touch:s})}function Ne({draft:e,onChange:t,touch:a,repeatEditable:s=!0,onCustom:i}){return s?n.jsx(ke,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:r=>u({draft:e,onChange:t},"repeat",r),onCustom:i,className:a?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(z,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===A?"Does not repeat":e.repeat]})}function je({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:s=>u({draft:e,onChange:t},"location",s.target.value),className:a?"min-h-11":""})}function Te({draft:e,onChange:t,touch:a}){return n.jsx(f,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:s=>u({draft:e,onChange:t},"guests",s.target.value),className:a?"min-h-11":""})}function Ce({draft:e,onChange:t,layout:a="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:s=>u({draft:e,onChange:t},"notes",s.target.value),rows:a==="pane"?6:3,className:ve})}function De({draft:e,onChange:t,calendars:a,layout:s="compact",expanded:i=!1,onToggleExpanded:r,onSave:l,onCancel:o,onDelete:c,saveLabel:y="Add",header:g,repeatEditable:b=!0,guestsEditable:I=!1,calendarEditable:M=!0,onCustomRepeat:X,touch:m,className:w}){const v=s==="pane",h={draft:e,onChange:t,layout:s,touch:m},S=n.jsx(ge,{...h}),$=n.jsx(be,{...h}),R=n.jsx(Ee,{...h,calendars:a}),F=n.jsx(Ne,{...h,repeatEditable:b,onCustom:X}),Y=n.jsx(je,{...h}),L=n.jsx(Te,{...h}),P=n.jsx(Ce,{...h}),W=n.jsxs("div",{className:d("flex items-center gap-2",v?"pt-2":"pt-1"),children:[n.jsx(j,{variant:"primary",size:m||v?"md":"sm",onClick:l,disabled:H(e),className:m?"min-h-11 flex-1":"",children:y}),n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:o,className:m?"min-h-11":"",children:"Cancel"}),c&&n.jsx(j,{variant:"ghost",size:m||v?"md":"sm",onClick:c,className:d("ml-auto text-danger",m&&"min-h-11"),children:"Delete"})]});if(v)return n.jsxs("div",{className:d("flex flex-col gap-5",w),children:[g,n.jsx(x,{label:"Title",children:S}),n.jsx(x,{label:"When",children:$}),M&&n.jsx(x,{label:"Calendar",children:R}),n.jsx(x,{label:"Repeat",children:F}),n.jsx(x,{label:"Location",children:Y}),I&&n.jsx(x,{label:"Guests",children:L}),n.jsx(x,{label:"Notes",children:P}),W]});const Z=r!==void 0&&!i;return n.jsxs("div",{className:d("flex flex-col gap-3",w),children:[g,S,$,M&&R,r&&n.jsxs("button",{type:"button",onClick:r,"aria-expanded":i,className:d("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",m&&"min-h-11"),children:[i?n.jsx(te,{className:"size-3.5"}):n.jsx(ne,{className:"size-3.5"}),i?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[Y,I&&L,F,P]}),W]})}const U="__custom__";function ke({value:e,date:t,startTime:a,onChange:s,onCustom:i,className:r}){const l=ye(t,a),o=e===A||l.includes(e)?l:[e,...l];return n.jsxs(ae,{icon:n.jsx(z,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:c=>{if(c.target.value===U){i?.();return}s(c.target.value)},className:r,children:[n.jsx("option",{value:A,children:"Does not repeat"}),o.map(c=>n.jsx("option",{value:c,children:c},c)),i&&n.jsx("option",{value:U,children:"Custom…"})]})}function Ae({calendars:e,value:t,onChange:a,touch:s}){const i=p.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(r=>{const l=he(r.color),o=r.id===t;return n.jsxs("label",{className:d("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",s?"min-h-11":"h-7",o?d(l.soft,l.text,l.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:i,value:r.id,checked:o,onChange:()=>a(r.id),className:"sr-only"}),n.jsx("span",{className:d("size-2 rounded-full",l.solid)}),r.name]},r.id)})]})}function Oe({title:e,subtitle:t,onClose:a,children:s,className:i}){return n.jsxs("section",{className:d("flex h-full w-full flex-col bg-surface",i),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:a,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(se,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s})})]})}const E=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],N=["SU","MO","TU","WE","TH","FR","SA"],Q=["January","February","March","April","May","June","July","August","September","October","November","December"],K=["first","second","third","fourth","last"],G=[1,2,3,4,-1],J="MO,TU,WE,TH,FR",Ie=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function O(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 a=t.match(/^Every week on (\w+)$/);if(a){const r=E.indexOf(a[1]);return r===-1?void 0:`FREQ=WEEKLY;BYDAY=${N[r]}`}const s=t.match(/^Every month on the (\w+) (\w+)$/);if(s){const r=K.indexOf(s[1]),l=E.indexOf(s[2]);return r===-1||l===-1?void 0:`FREQ=MONTHLY;BYDAY=${G[r]}${N[l]}`}const i=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(i){const r=Q.indexOf(i[2]);return r===-1?void 0:`FREQ=YEARLY;BYMONTH=${r+1};BYMONTHDAY=${Number(i[1])}`}}const Me=e=>e===""?"":`, ${e}`;function Pe(e,t){const a=new Map(e.split(";").map(l=>l.split("=")).filter(l=>l.length===2).map(([l,o])=>[l.toUpperCase(),o.toUpperCase()])),s=Me(t),i=a.get("FREQ"),r=a.get("BYDAY");if(!(a.has("INTERVAL")&&a.get("INTERVAL")!=="1")&&!(a.has("UNTIL")||a.has("COUNT"))){if(i==="DAILY")return`Every day${s}`;if(i==="WEEKLY"){if(r===void 0)return;if(r===J)return`Every weekday${s}`;const l=N.indexOf(r);return l===-1?void 0:`Every week on ${E[l]}${s}`}if(i==="MONTHLY"){const l=r?.match(/^(-?\d)([A-Z]{2})$/);if(!l)return;const o=G.indexOf(Number(l[1])),c=N.indexOf(l[2]);return o===-1||c===-1?void 0:`Every month on the ${K[o]} ${E[c]}${s}`}if(i==="YEARLY"){const l=Number(a.get("BYMONTH")),o=Number(a.get("BYMONTHDAY"));return!l||!o||l>12?void 0:`Every year on ${o} ${Q[l-1]}${s}`}}}function We(e,t){return{title:"",date:e,startTime:"09:00",endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function _e(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),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:ee(e.date,1)}:{start:_(e.date,e.startTime,t),end:_(e.date,e.endTime,t)}}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.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.endTime<=e.startTime?"The end time is not after the start time. Move one of them.":t&&O(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Ue(e,t){const a=V(e,!0);if(a!=="")return{ok:!1,problem:a};const{start:s,end:i}=q(e,t);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:s,end:i,allDay:e.allDay,...t===""?{}:{timeZone:t},recurrenceRule:O(e.repeat)??""}}}function Be(e,t,a){const s=t.repeat!==e.repeat,i=V(t,s);if(i!=="")return{ok:!1,problem:i};const r={};if(t.title.trim()!==e.title.trim()&&(r.summary=t.title.trim()),t.location!==e.location&&(r.location=t.location),t.notes!==e.notes&&(r.description=t.notes),t.date!==e.date||t.startTime!==e.startTime||t.endTime!==e.endTime||t.allDay!==e.allDay){const{start:o,end:c}=q(t,a);r.start=o,r.end=c,r.allDay=t.allDay,a!==""&&(r.timeZone=a)}return s&&(r.recurrenceRule=O(t.repeat)??""),{ok:!0,patch:r}}const C=ce(400,404,412),we=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),D={kind:"written"},k=e=>de(e)===412?{kind:"conflict"}:{kind:"refused",message:me(e)},Se={this:"This",following:"Following",all:"All"};function $e(){const e=oe();return p.useCallback(()=>{e.invalidateQueries({predicate:t=>{const a=t.queryKey[0];if(typeof a!="object"||a===null)return!1;const s=a._id;return typeof s=="string"&&we.has(s)}})},[e])}const B=({scope:e,recurrenceId:t})=>e===void 0||e==="all"?{}:{scope:Se[e],recurrenceId:t};function ze(){const e=$e(),t=T({...re(),meta:C,onSuccess:e}),a=T({...ie(),meta:C,onSuccess:e}),s=T({...le(),meta:C,onSuccess:e}),i=p.useCallback(o=>t.mutateAsync({body:o}).then(()=>D).catch(k),[t]),r=p.useCallback((o,c)=>a.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag},body:c}).then(()=>D).catch(k),[a]),l=p.useCallback(o=>s.mutateAsync({path:{calendarObjectId:o.calendarObjectId},query:{calendarId:o.calendarId,...B(o)},headers:{"If-Match":o.etag}}).then(()=>D).catch(k),[s]);return p.useMemo(()=>({createEvent:i,updateEvent:r,deleteEvent:l,isWriting:t.isPending||a.isPending||s.isPending}),[i,r,l,t.isPending,a.isPending,s.isPending])}function He({title:e,subtitle:t,calendars:a,draft:s,onChange:i,problem:r,saveLabel:l,isSaving:o,repeatEditable:c=!0,calendarEditable:y=!0,onSave:g,onCancel:b}){return n.jsx(Oe,{title:e,subtitle:t,onClose:b,children:n.jsx(De,{draft:s,onChange:i,calendars:a,layout:"pane",repeatEditable:c,calendarEditable:y,saveLabel:o?"Saving…":l,onSave:g,onCancel:b,header:r===""?void 0: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(ue,{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:r})]})})})}export{He as C,Ue as c,_e as d,We as e,Be as p,Pe as t,ze as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,r as e}from"./index-
|
|
1
|
+
import{j as t,r as e}from"./index-BSMLcnNv.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,ak as l,al as o}from"./index-
|
|
1
|
+
import{r,j as n,ak as l,al as o}from"./index-BSMLcnNv.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-BSMLcnNv.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,_ as r}from"./index-
|
|
1
|
+
import{j as t,_ as r}from"./index-BSMLcnNv.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{ef as _,r as n,ci as z,c as J,C as V,bi as ge,cM as he,aX as me,aY as fe,j as r,aj as pe,cT as Ie,cU as xe}from"./index-
|
|
1
|
+
import{ef as _,r as n,ci as z,c as J,C as V,bi as ge,cM as he,aX as me,aY as fe,j as r,aj as pe,cT as Ie,cU as xe}from"./index-BSMLcnNv.js";import{u as Te,p as X,R as ye}from"./useSearchTokenContext-BOZY3WZQ.js";import{G as be,I as ve,ar as Y,aE as Se,aF as Ce,as as Re,aG as we,au as Fe,b as Me,M as je,aB as Oe,aH as Pe,aD as ke,s as Le,O as Ae,T as Z,R as Ee,P as Ne,d as qe,a0 as De,a1 as Be,a3 as $,a4 as ee,a5 as Qe,a6 as Ge,a7 as He}from"./MailListHeader-CP5Mrq7I.js";import{u as Ke,l as _e,b as ze,a as Ve}from"./MailViewChrome-WyEJa7LW.js";import{f as Ue}from"./ErrorState-jZhKH-Aj.js";import{d as K,w as We}from"./wizard-selection-DxUM65kM.js";import{a as Xe}from"./useMessageBodyContent-BuyQJK-3.js";import{g as Ye,h as Ze}from"./search-token-index-srRTXc29.js";import{u as Je}from"./sections-B3k1IUqe.js";const q=e=>({...e,starred:!0,order:"desc"}),$e=(e={})=>z({query:q(e)});function te(e={}){const{data:t,isLoading:s,isError:a,error:c,refetch:l,fetchNextPage:i,hasNextPage:g,isFetchingNextPage:h}=Ke({queryKey:$e(e),queryFn:async({pageParam:I})=>{const{data:u}=await _({query:{...q(e),continuationToken:I},throwOnError:!0});return u},initialPageParam:void 0,getNextPageParam:I=>I.continuationToken,staleTime:6e4});return{threads:n.useMemo(()=>(t?.pages??[]).flatMap(I=>I.items??[]),[t]),isLoading:s,isError:a,error:c,refetch:l,fetchNextPage:i,hasNextPage:g,isFetchingNextPage:h}}function et(e,t){const s=e.query??"",a={...q(e),limit:t},{data:c}=J({queryKey:z({query:a}),queryFn:async()=>{const{data:l}=await _({query:a,throwOnError:!0});return l},enabled:s.length>0,staleTime:3e4});return n.useMemo(()=>c?.items??[],[c])}function tt(e={}){const t={...q(e),unread:!0,count:!0,results:!1},{data:s}=J({queryKey:z({query:t}),queryFn:async()=>{const{data:a}=await _({query:t,throwOnError:!0});return a},staleTime:6e4});return s?.count}const st=["category","unread","starred","attachments"],at=(e,t)=>{const s=be(e),{params:a,residual:c}=ve(t,{...s,starred:!0},st);return{criteria:{...a,...s},residual:c}},rt=200;function ot({rows:e,verb:t}){const{selectedIds:s,exitSelection:a}=ke(),c=n.useMemo(()=>We(e,s),[e,s]);return r.jsx(Le,{verb:t,selection:c,selectionRestriction:"spansAccounts",onFinished:a})}function nt({selectedMessageId:e,onOpenThread:t,commandsRef:s,onTriageContextChange:a,onDeleteMessages:c}){const{searchQuery:l,resultFolderIndex:i,onSearchClearQuery:g}=V(),h=Te(),P=ge(),I=he(),[u,m]=n.useState("all"),[S,k]=n.useState(new Set),R=n.useCallback(d=>{k(b=>{const p=new Set(b);return p.has(d)?p.delete(d):p.add(d),p})},[]),w=n.useCallback(()=>{m("all"),k(new Set)},[]),T=n.useCallback(()=>{w(),g()},[w,g]),{freeText:x,tokens:C}=X(l.trim().toLowerCase(),h),L=X(l.trim(),h).freeText,{criteria:F,residual:f}=n.useMemo(()=>at({category:u,attributes:S},C),[u,S,C]),M=n.useMemo(()=>x?{...F,query:x}:F,[F,x]),{threads:A,isLoading:E,isError:v,error:B,refetch:j,fetchNextPage:Q,hasNextPage:G,isFetchingNextPage:O}=te(F),N=et(M,rt),o=n.useMemo(()=>{const d=K(A).map(Y),b=x?Se(d.filter(p=>Ce(p,x)),K(N).map(Y)):d;return K(b).filter(p=>Re(p,f))},[A,N,x,f]),y=n.useCallback((d,b)=>{const p=o.find(ue=>ue.id===d)?.threadId;p&&t?.({threadId:p,messageId:d},b)},[o,t]),H=n.useCallback(d=>{const b=d.threadId??o.find(p=>p.id===d.id)?.threadId;b&&t?.({threadId:b,messageId:d.id})},[o,t]),re=n.useMemo(()=>we(),[]),oe=n.useMemo(()=>o.map(d=>Fe(d,i)),[o,i]),ne=tt(M)??null,ie=n.useMemo(()=>C.filter(d=>d.type!=="isStarred"),[C]),de=_e({chips:{category:u,attributes:S},tokens:ie,reach:f.length>0||x?"loaded-pages":"whole-folder",onClear:T}),U=E?"loading":v?"error":o.length===0?"empty":"ready",ce=n.useCallback(()=>{const d=me(fe());window.open(d,"_blank","noopener,noreferrer")},[]),W=Me(),le=r.jsx("div",{className:"flex h-full min-h-0 flex-col",children:r.jsxs("div",{className:"flex-1 overflow-y-auto",children:[r.jsx("div",{className:"divide-y divide-line",children:o.map(d=>r.jsx(je,{thread:d,active:d.id===e,onClick:()=>y(d.id)},d.id))}),G?r.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>Q(),disabled:O,children:O?"Loading…":"Load more"}):null]})});return r.jsx(ze,{title:"Starred",unreadCount:ne,preset:re,selectedCategory:u,activeFilters:S,onSelectCategory:m,onToggleFilter:R,onClearFilters:w,searchResults:oe,searchLoading:E,onSelectSearchResult:H,searchResultsInBody:!0,children:r.jsxs(Oe,{selectedMessageId:e,rows:o,onOpen:y,onDeleteMessages:c,onSelectionVerb:I.start,commandsRef:s,onTriageContextChange:a,children:[r.jsx(Ve,{listTitle:"Starred",sections:[{id:"flagged",threads:o}],flatList:!0,hideHeader:!0,listState:W.searchResults?"ready":U,listFilter:de,listScopeLabel:"Starred",searchQuery:L||void 0,errorMessage:v?Ue(B):void 0,onRetry:()=>j(),onReportError:ce,selectedThreadId:e,onSelectThread:y,isDesktop:P,selectionBar:r.jsx(Pe,{title:"Starred"}),listBody:W.searchResults??(U==="ready"?le:void 0)}),r.jsx(ot,{rows:o,verb:I.verb})]})})}const se=n.createContext(null);function D(){const e=n.useContext(se);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function it({thread:e,children:t}){const s=Ye(),a=Ze(),c=Je(),{searchInput:l}=V(),i=e?.threadId,g=e?.messageId,{threads:h}=te(),P=n.useMemo(()=>{if(i)return h.find(o=>o.messageId===g)??h.find(o=>o.threadId===i)},[h,i,g]),I=Ae(i,g),u=P??I,m=g??u?.messageId,S=n.useMemo(()=>{if(i)return{threadId:i,mailboxId:u?.mailboxId??"",subject:u?.subject,messageId:m,authenticity:u?.authenticity}},[i,u,m]),k=n.useCallback((o,y)=>{s(o,{replace:y?.replace,query:l})},[s,l]),R=n.useCallback(o=>{m&&o.includes(m)&&a()},[m,a]),w=Z({thread:u,isOpen:!0,onAfterOptimisticRemove:R}),T=Ee(),{deleteMessages:x}=Ne({mailboxId:u?.mailboxId??"",messages:h,onAfterOptimisticRemove:R}),{toggleReadFor:C}=qe({mailboxId:u?.mailboxId??"",messages:h}),L=T.focusedMessageId,f=n.useMemo(()=>h.find(o=>o.messageId===L),[h,L])??u,M=Z({thread:f,isOpen:f?.messageId===m}),A=Xe(),E=pe(),v=Ie(),B=n.useMemo(()=>xe(v,i,m),[v,i,m]),j=n.useMemo(()=>{if(f)return o=>v({threadId:f.threadId,messageId:f.messageId,mode:o})},[v,f]),{nextMessageId:Q,previousMessageId:G}=De({context:T,orderedIds:T.orderedIds,selectedMessageId:m,enabled:!A&&!E,hasOpenThread:i!==void 0,onClose:a,handlers:{reply:()=>j?.("reply"),replyAll:()=>j?.("reply-all"),forward:()=>j?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||M.deleteThread()},toggleStar:M.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||f&&C([f.messageId],!f.isRead)},goBrief:()=>c("brief"),goSettings:()=>c("settings")}}),O=n.useCallback(o=>{if(!o)return;const y=h.find(H=>H.messageId===o);return y?{threadId:y.threadId,messageId:o}:void 0},[h]),N={selectedMessageId:m,selectedThread:u,conversation:S,onOpenThread:k,onCloseThread:a,nextThread:O(Q),previousThread:O(G),actions:w,onReply:B,triage:T,onDeleteMessages:x,handleDeselectIfRemoved:R};return r.jsx(se.Provider,{value:N,children:t})}function ae(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:a}=D();return r.jsx(nt,{selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:a})}function dt(){const{conversation:e,selectedThread:t,actions:s,onReply:a,handleDeselectIfRemoved:c}=D(),l=!!e,i=Ge(e?.threadId);return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(He,{hasThread:l,intelligenceOpen:i.isShowing,canToggleIntelligence:i.canToggle,onToggleIntelligence:i.toggle,onReply:a?()=>a("reply"):void 0,onReplyAll:a?()=>a("reply-all"):void 0,onForward:a?()=>a("forward"):void 0,onDelete:l?s.deleteThread:void 0,onToggleStar:l?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:l&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?r.jsx($,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:i.open,listOnScreen:!0}):r.jsx(ye,{})})]}),r.jsx(ee,{isOpen:i.drawerOpen,onClose:i.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function ct(){const{selectedThread:e,handleDeselectIfRemoved:t}=D(),{onToggleIntelligence:s}=V();return r.jsx(Qe,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function lt(){const{selectedThread:e,conversation:t,onCloseThread:s,onOpenThread:a,nextThread:c,previousThread:l,handleDeselectIfRemoved:i}=D(),g=Be(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx($,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:s,onOpenIntelligence:g.toggle,onSwipeNext:c?()=>a(c):void 0,onSwipePrevious:l?()=>a(l):void 0,mobileIntelligenceOpen:g.isOpen}),r.jsx(ee,{isOpen:g.isOpen,onClose:g.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:i})]}):r.jsx("div",{className:"h-full",children:r.jsx(ae,{})})}const yt=Object.assign(it,{List:ae,Reading:dt,Intelligence:ct,Phone:lt});export{yt as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,c as f,d as m,E as N,j as e,bi as E,X as w}from"./index-
|
|
1
|
+
import{r as n,c as f,d as m,E as N,j as e,bi as E,X as w}from"./index-BSMLcnNv.js";import{E as u}from"./ErrorState-jZhKH-Aj.js";import{D as r,C as x,u as k}from"./index-BsL3dqbS.js";import{c as p,d as h,e as b}from"./useMessageBodyContent-BuyQJK-3.js";import{C as S}from"./confirm-dialog-BVXTDPyQ.js";const C=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},O=()=>{const t=p(),i=h(),s=b(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return N({id:"mobile-compose",open:!0}),e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:C(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(S,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},q=()=>{const t=p(),i=h(),s=b(),a=E(),{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(w,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{q as F};
|