@remit/web-client-dist 0.0.537 → 0.0.538
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-CTZNKVPL.js → BriefPane-C0AzVEMn.js} +1 -1
- package/assets/{CalendarComposePane-B1uvjcSB.js → CalendarComposePane-B671B-gA.js} +1 -1
- package/assets/{CalendarComposeSeed-CKhqv14O.js → CalendarComposeSeed-DlR9pYnw.js} +1 -1
- package/assets/{CalendarShell-DCHgNPyu.js → CalendarShell-QWy58POl.js} +1 -1
- package/assets/{EmptyState-v7cXl5VX.js → EmptyState-D9YJ7rg8.js} +1 -1
- package/assets/{ErrorState-DlbF94gh.js → ErrorState-B8_VgSJK.js} +1 -1
- package/assets/{FlaggedPane-BINZM8vq.js → FlaggedPane-Bwm6EzSH.js} +1 -1
- package/assets/{FullCompose-_c5pYzZI.js → FullCompose-BTssQUhm.js} +1 -1
- package/assets/MailListHeader-B42tcvIg.js +7 -0
- package/assets/{MailNav-C5fN_WYN.js → MailNav-ZMkBF1iM.js} +1 -1
- package/assets/{MailShell-CejAwvaO.js → MailShell-DT4uL9F4.js} +1 -1
- package/assets/{MailViewChrome-IrTvVXqN.js → MailViewChrome-8HwI1SE8.js} +1 -1
- package/assets/{MailboxPane-CV3w_tRJ.js → MailboxPane-DZWJHhwG.js} +1 -1
- package/assets/{NavMenuButton-H7nFdEj1.js → NavMenuButton-rslI-b5f.js} +1 -1
- package/assets/{OnboardingWizard-BAHu1SMh.js → OnboardingWizard-B4LxgUcq.js} +1 -1
- package/assets/{OpenCalendarEvent-Bol6hDfM.js → OpenCalendarEvent-GNnMueAi.js} +1 -1
- package/assets/{OutboxPane-BLFpSBWX.js → OutboxPane-C1BZG5k9.js} +1 -1
- package/assets/_calendarObjectId-BmC4CUdr.js +1 -0
- package/assets/_mailboxId-CDJGYnOl.js +1 -0
- package/assets/_messageId-DRAq8q0K.js +1 -0
- package/assets/_messageId-DUY1lhju.js +1 -0
- package/assets/_messageId-JdteBEh3.js +1 -0
- package/assets/_outboxMessageId-NDYOd-NQ.js +1 -0
- package/assets/_recurrenceId-_yDVO_tI.js +1 -0
- package/assets/_threadId-Bp4d3Qmz.js +1 -0
- package/assets/_threadId-D88oqGd0.js +1 -0
- package/assets/_threadId-DEAOUrom.js +1 -0
- package/assets/{_view._date-DqbqjoJ6.js → _view._date-nMrC3Txv.js} +1 -1
- package/assets/{accounts-g1XEBjoc.js → accounts-CAfY6r8Y.js} +1 -1
- package/assets/{advanced-aP98yeU1.js → advanced-DTs3jwN9.js} +1 -1
- package/assets/{appearance-HwoJvZfG.js → appearance-GbOHKn-I.js} +1 -1
- package/assets/{attachment-file-BLEgqixh.js → attachment-file-BghroLTV.js} +1 -1
- package/assets/{attendee-row-q4hcbCDE.js → attendee-row-Dqz1VXuB.js} +1 -1
- package/assets/{avatar-DEnpn1px.js → avatar-CtdSmMWH.js} +1 -1
- package/assets/{bottom-sheet-DyvbZpdg.js → bottom-sheet-C5s5QTyI.js} +1 -1
- package/assets/brief-De3ByCtw.js +1 -0
- package/assets/{brief-CVjHaFNw.js → brief-dJKim8jg.js} +1 -1
- package/assets/{browser-ponyfill-B-qUC6YS.js → browser-ponyfill-DSXWl_gu.js} +1 -1
- package/assets/{bug-BgEaSSso.js → bug-B3baPwCn.js} +1 -1
- package/assets/{calendar-BbD7GvPg.js → calendar-DNr9u8T1.js} +1 -1
- package/assets/{calendar-color-CiT91Pq7.js → calendar-color-DotdRhn7.js} +1 -1
- package/assets/{calendar-event-chip-DigyiNsS.js → calendar-event-chip-BC9rJJxu.js} +1 -1
- package/assets/{calendars-ChNTt5Ns.js → calendars-KwTuurvv.js} +1 -1
- package/assets/{card-D3fICRoL.js → card-DkwKVV_5.js} +1 -1
- package/assets/chevron-left-Di7Ghxyv.js +1 -0
- package/assets/{circle-check-YjH7mwJY.js → circle-check-BCjfDnOX.js} +1 -1
- package/assets/{circle-check-big-Ch4BTnHs.js → circle-check-big-d8VA3SC1.js} +1 -1
- package/assets/{circle-help-CJDf4AIJ.js → circle-help-DbayznAv.js} +1 -1
- package/assets/{clock-BQUtUPTw.js → clock-wSiHtR7y.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BJ4imQHp.js +1 -0
- package/assets/compose._-_outboxMessageId_-Ccb0wZg5.js +1 -0
- package/assets/compose._-_outboxMessageId_-cWIFxelq.js +1 -0
- package/assets/compose._-_outboxMessageId_-ssBDgc0T.js +1 -0
- package/assets/{config-import-uplce986.js → config-import-m_RbUyY7.js} +1 -1
- package/assets/{confirm-dialog-Bit8iTz1.js → confirm-dialog-iduDtLpK.js} +1 -1
- package/assets/{copy-rEt1PU4_.js → copy-jTtWW2dB.js} +1 -1
- package/assets/{credential-steps-XlffZ0Et.js → credential-steps-Mtm68Fbk.js} +1 -1
- package/assets/{download-0YkxbiTJ.js → download-BYrmcRA1.js} +1 -1
- package/assets/{file-json-C6UnGYQy.js → file-json-BEyUPTeC.js} +1 -1
- package/assets/{filters-hb8qtGEb.js → filters-C3Zws_1F.js} +1 -1
- package/assets/{flagged-C1L72YI_.js → flagged-BmgQ_SvE.js} +1 -1
- package/assets/flagged-DDS-XawB.js +1 -0
- package/assets/{folders-C0ICUwZd.js → folders-Del3d3pi.js} +1 -1
- package/assets/{format-BFembxpl.js → format-TByJXntg.js} +1 -1
- package/assets/{help-copy-CCxmXoCl.js → help-copy-B-sN26nU.js} +1 -1
- package/assets/{import-DaZ032Fu.js → import-MiWzA1G8.js} +1 -1
- package/assets/index-4A9Xn6II.js +1 -0
- package/assets/{index-DdhEPJtW.js → index-C1q5K9ip.js} +1 -1
- package/assets/index-C6LaWwdH.js +1 -0
- package/assets/index-CoyzKuX7.js +1 -0
- package/assets/index-CxjbdxbS.js +1 -0
- package/assets/index-DRAq8q0K.js +1 -0
- package/assets/index-DUY1lhju.js +1 -0
- package/assets/index-DpeAX6ty.js +1 -0
- package/assets/{index-D2oM-aLC.js → index-TSFcerUm.js} +4 -4
- package/assets/{index-DGYTG1lD.js → index-aHhijiWM.js} +4 -4
- package/assets/index-pDJ4IcjK.js +1 -0
- package/assets/index-pjU35AEc.js +1 -0
- package/assets/{kbd-BKoZZJv1.js → kbd-DkhqG6kw.js} +1 -1
- package/assets/{labels-BRLmcYmd.js → labels-DNdDCmNo.js} +1 -1
- package/assets/{mail-QDs7FREz.js → mail-B1t8laSa.js} +1 -1
- package/assets/{mail-CEO2sTxs.js → mail-D_IxX6vR.js} +1 -1
- package/assets/{map-pin-PJbLKgyJ.js → map-pin-NGA0UKoM.js} +1 -1
- package/assets/{menu-M4t4emTB.js → menu-B_Y6uopG.js} +1 -1
- package/assets/{new-CSZxbefD.js → new-C2b8tPsQ.js} +1 -1
- package/assets/onboarding-C6nvBwPs.js +1 -0
- package/assets/{onboarding-completion-DeyoyvHP.js → onboarding-completion-Bb2XUyr_.js} +1 -1
- package/assets/outbox-Ct0z8upp.js +1 -0
- package/assets/{pencil-BJsCYquJ.js → pencil-Clb09zRi.js} +1 -1
- package/assets/{refresh-cw-D69ub_Ps.js → refresh-cw-By6IgPOL.js} +1 -1
- package/assets/{rich-text-BsyxJP3h.js → rich-text-CFAfl-79.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-e1q-PkGF.js → rich-text-spellcheck-worker-provider-DbkIfTHI.js} +1 -1
- package/assets/{rotate-ccw-Di20X57E.js → rotate-ccw-C81yj_PV.js} +1 -1
- package/assets/{row-actions-NUsGq23X.js → row-actions-Cozq6Yha.js} +1 -1
- package/assets/{search-mirror-YCsgiUST.js → search-mirror-Dah6tr8A.js} +1 -1
- package/assets/{search-token-index-PnovKSih.js → search-token-index-Y_dGTOxL.js} +1 -1
- package/assets/{sections-CyAvXy2N.js → sections-DOVZjlqN.js} +1 -1
- package/assets/{senders-Dhk7b3u8.js → senders-BfocXyMR.js} +1 -1
- package/assets/settings-Bux0ghz1.js +1 -0
- package/assets/{settings-screen-YGAfrY3Y.js → settings-screen-BEUO_u7W.js} +1 -1
- package/assets/{shield-check-B7BIIMMl.js → shield-check-DnD3rulC.js} +1 -1
- package/assets/{suggested-vips-Dcnb0xtD.js → suggested-vips-DpCEzGjz.js} +1 -1
- package/assets/{useCalendarData-CTssb-T_.js → useCalendarData-UeKvcKah.js} +1 -1
- package/assets/{useCalendars-CDnRXc9k.js → useCalendars-B9VcAxJc.js} +1 -1
- package/assets/{useDebouncedValue-C1M7sZRY.js → useDebouncedValue-Bk9xEtkT.js} +1 -1
- package/assets/{useFilters-DO83N07r.js → useFilters-Y2oiHmjX.js} +1 -1
- package/assets/{useLabels-D-_s_Jm5.js → useLabels-DNXJu_BT.js} +1 -1
- package/assets/{useLayoutTier-D-dXDFU7.js → useLayoutTier-DOuXnl_R.js} +1 -1
- package/assets/{useMessageBodyContent-CKI6h5BF.js → useMessageBodyContent-DFyG4FWc.js} +1 -1
- package/assets/{useQueries-y_pHfcL0.js → useQueries-Cb9Npayo.js} +1 -1
- package/assets/{useRefreshControl-CAJigyOC.js → useRefreshControl-rW-6EUB_.js} +1 -1
- package/assets/{useResultFolderIndex-B8vH8YCO.js → useResultFolderIndex-CCdXbCEt.js} +1 -1
- package/assets/{useSearchTokenContext-BY4AA_1D.js → useSearchTokenContext-B9q2oA9M.js} +1 -1
- package/assets/{useSemanticSearch-Bs37PuHZ.js → useSemanticSearch-DvIRvW57.js} +1 -1
- package/assets/{useSignature-BryWpVA0.js → useSignature-CK32eZWh.js} +1 -1
- package/assets/{window-kTlLLfmP.js → window-CVIqAaUk.js} +1 -1
- package/index.html +1 -1
- package/locales/de/mail.json +0 -1
- package/locales/en/common.json +1 -22
- package/locales/en/mail.json +1 -58
- package/locales/fr/mail.json +0 -1
- package/locales/nl/mail.json +0 -1
- package/package.json +1 -1
- package/assets/MailListHeader-NI_QfjZo.js +0 -7
- package/assets/_calendarObjectId-CBwH5Gwp.js +0 -1
- package/assets/_mailboxId-CxKuAmrO.js +0 -1
- package/assets/_messageId-CCrdyN8n.js +0 -1
- package/assets/_messageId-CoAVWkxi.js +0 -1
- package/assets/_messageId-uaB3bC-V.js +0 -1
- package/assets/_outboxMessageId-hC2hZ4KE.js +0 -1
- package/assets/_recurrenceId-Cql9uGFo.js +0 -1
- package/assets/_threadId-BesIRL9v.js +0 -1
- package/assets/_threadId-D0aHZk5y.js +0 -1
- package/assets/_threadId-hRbN3D2V.js +0 -1
- package/assets/brief-X897FPJA.js +0 -1
- package/assets/chevron-left-DB-vmcxG.js +0 -1
- package/assets/compose._-_outboxMessageId_-BqBhpi5H.js +0 -1
- package/assets/compose._-_outboxMessageId_-ChS2eI9Y.js +0 -1
- package/assets/compose._-_outboxMessageId_-DBXqxe1E.js +0 -1
- package/assets/compose._-_outboxMessageId_-pujFGGh1.js +0 -1
- package/assets/flagged-CDG5zLrw.js +0 -1
- package/assets/index-BJ6JHen0.js +0 -1
- package/assets/index-C3WccIx1.js +0 -1
- package/assets/index-CCrdyN8n.js +0 -1
- package/assets/index-CSww3DJz.js +0 -1
- package/assets/index-DpE_vvtx.js +0 -1
- package/assets/index-WyL0lYdv.js +0 -1
- package/assets/index-dsTy3gwI.js +0 -1
- package/assets/index-uaB3bC-V.js +0 -1
- package/assets/index-zjUoR2la.js +0 -1
- package/assets/onboarding-BYGpmzCY.js +0 -1
- package/assets/outbox-D5hGZCuc.js +0 -1
- package/assets/settings-C593dzYC.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,L as St,U as Ct,eb as De,ec as ue,ci as me,r as a,c as _e,C as Z,bi as Tt,cM as wt,G as Rt,dy as Mt,ed as jt,dS as kt,_ as Qe,dW as Et,ee as At,ef as Ft,aj as Ot,cT as Nt,cU as Bt}from"./index-D2oM-aLC.js";import{g as ze,e as Lt,f as Ge,u as qt,p as Pt,R as Dt}from"./useSearchTokenContext-BY4AA_1D.js";import{ac as _t,G as Qt,I as zt,ao as Gt,ap as Ht,aq as Ut,ar as Kt,as as Wt,at as Ae,au as Yt,av as $t,aw as Vt,ab as Jt,ax as Zt,ay as Xt,az as es,M as ts,aA as ss,aj as os,aB as rs,e as as,w as ns,al as is,s as cs,S as ls,O as ds,T as Fe,R as us,P as ms,d as fs,a0 as hs,a1 as gs,a3 as He,a4 as Ue,a5 as ps,a6 as xs,a7 as Is}from"./MailListHeader-NI_QfjZo.js";import{u as ys,a as vs,R as bs,b as Ss,c as Cs}from"./useRefreshControl-CAJigyOC.js";import{u as fe}from"./useQueries-y_pHfcL0.js";import{t as Ts,u as ws,r as Rs,L as Ms}from"./useSemanticSearch-Bs37PuHZ.js";import{a as js}from"./useLabels-D-_s_Jm5.js";import{u as ks,b as Es}from"./useLayoutTier-D-dXDFU7.js";import{d as As,w as Fs}from"./wizard-selection-DxUM65kM.js";import{u as Ke}from"./sections-CyAvXy2N.js";import{R as Os}from"./refresh-cw-D69ub_Ps.js";import{a as Ns}from"./useMessageBodyContent-CKI6h5BF.js";import{g as Bs,h as Ls}from"./search-token-index-PnovKSih.js";function qs({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(St,{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:Ps(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(Ct,{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 Ps({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 We=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Ye="category",Ds={unclassified:"uncategorized"},G=e=>Lt(e).map(t=>t.raw),z=e=>e.join(" "),he=e=>{const t=Ge(e);if(t)return We.find(o=>o.name===t.name&&o.value===t.value.toLowerCase())?.id},ge=e=>{const t=Ge(e);if(!t||t.name!==Ye)return;const o=t.value.toLowerCase(),n=Ds[o];if(n)return n;if(!(!De(o)||o==="all"))return o},$e=e=>We.find(t=>t.id===e),Ve=e=>$e(e)!==void 0,_s=e=>{const t=new Set;for(const o of G(e)){const n=he(o);n&&t.add(n)}return t},Qs=e=>{let t="all";for(const o of G(e)){const n=ge(o);n&&(t=n)}return t},zs=(e,t)=>{const o=$e(t);if(!o)return;const n=G(e),c=n.filter(d=>he(d)!==t);return c.length<n.length?z(c):z([...n,ze(o.name,o.value)])},Gs=(e,t)=>{const o=G(e).filter(n=>!ge(n));return z(t==="all"?o:[...o,ze(Ye,t)])},Hs=e=>z(G(e).filter(t=>!he(t)&&!ge(t))),Je=e=>e.trim().length>0,Oe=e=>{if(!Je(e.query))return e.ownFilters;const t=new Set(_s(e.query));for(const o of e.ownFilters)Ve(o)||t.add(o);return t},Ne=e=>Je(e.query)?Qs(e.query):e.ownCategory,Be=6e4,Us=3e4,Ks={kind:"unknown"},Le=e=>(t,o)=>_t(o?.queryKey,e)?t:void 0,Ws=(e,t,o)=>({...e,category:[t],limit:o,order:"desc"}),Ys=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),qe=(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 $s({categories:e,criteria:t,limit:o,counted:n}){const c=fe({queries:e.map(m=>{const f=Ws(t,m,o),g=qe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},placeholderData:Le(g),staleTime:Be}})}),d=fe({queries:e.map(m=>{const f=Ys(t,m),g=qe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},enabled:n,placeholderData:Le(g),staleTime:Be}})}),l=a.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:n?Ts(T?.data?.count):Ks,loading:g?.isPending??!0,failed:g?.isError??!1,retry:()=>{g?.refetch(),n&&T?.refetch()}}}),[e,c,d,n,o]),u=a.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 Vs(e,t,o){const n={...e,limit:t,order:"desc"},{data:c,isLoading:d,isError:l,refetch:u}=_e({queryKey:me({query:n}),queryFn:async()=>{const{data:f}=await ue({query:n,throwOnError:!0});return f},enabled:o,staleTime:Us});return{rows:a.useMemo(()=>o?c?.items??[]:[],[c,o]),isLoading:o&&d,isError:o&&l,refetch:a.useCallback(()=>{u()},[u])}}const Js=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),Zs=e=>[...e].sort(Js),Xs=["category","unread","starred","attachments"],eo=["contacts","today"],to=(e,t,o)=>{const n=Qt({category:e,attributes:t}),{params:c,residual:d}=zt(o,n,Xs),l={...c,...n},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}},so=({residual:e,attributes:t,accountScoped:o})=>e.length===0&&!o&&!eo.some(n=>t.has(n)),oo=50,ro=200,ao=[],Pe=()=>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))}),no=({accountEmail:e})=>{const t=Ke();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(Qe,{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"})]})},io=(e,t)=>{if(t.size===0)return{};const o=e.filter(d=>t.has(d.id)),n=Rs(o.map(d=>d.accountId));if(n.restriction)return n;const c=new Set;for(const d of o)d.mailboxId&&c.add(d.mailboxId);return c.size>1?{accountId:n.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${c.size} folders`}:{accountId:n.accountId,mailboxId:c.size===1?[...c][0]:void 0}};function co({header:e,rows:t,wizard:o,children:n}){const{selectedIds:c,selectedCount:d,exitSelection:l,orderedIds:u,allSelected:m,toggleAllLoaded:f}=rs(),g=a.useMemo(()=>io(t,c),[t,c]),{junkMailboxId:T}=as(g.accountId),{labels:I}=js(g.accountId),v=a.useMemo(()=>Array.from(c),[c]),q=a.useMemo(()=>Fs(t,c),[t,c]),p=ns(T,g.mailboxId),b=a.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(ls,{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(Ms,{accountId:g.accountId,mailboxId:g.mailboxId,messageIds:v}):void 0,selectAll:b,notice:F});return r.jsx(is,{...e,selectionBar:S,paneOverlay:r.jsx(cs,{verb:o.verb,accountId:g.accountId,mailboxId:g.mailboxId,selection:q,selectionRestriction:g.restriction,onFinished:l}),children:n})}function lo({accounts:e,selectedMessageId:t,onOpenThread:o,commandsRef:n,onTriageContextChange:c,onDeleteMessages:d}){const{searchQuery:l,searchInput:u,resultFolderIndex:m,onSearchChange:f}=Z(),g=qt(),T=Tt(),I=ks(),v=wt(),q=Es(),p=a.useMemo(()=>Zs(e.filter(s=>!s.muted?.value)),[e]),[b,F]=a.useState("all"),[S,R]=a.useState("all"),[N,P]=a.useState(new Set),[ee,M]=a.useState(!1),D=a.useCallback(s=>{P(i=>{const h=new Set(i);return h.has(s)?h.delete(s):h.add(s),h})},[]),H=a.useCallback(()=>P(new Set),[]),E=u.trim().length>0,{freeText:j,tokens:_}=Pt(l.trim().toLowerCase(),g),y=j.length>0,O=a.useMemo(()=>Oe({query:u,ownFilters:N}),[u,N]),A=a.useMemo(()=>Ne({query:u,ownCategory:S}),[u,S]),B=a.useMemo(()=>Oe({query:l,ownFilters:N}),[l,N]),C=a.useMemo(()=>Ne({query:l,ownCategory:S}),[l,S]),x=a.useCallback(s=>{if(!E||!Ve(s)){D(s);return}const i=zs(u,s);i!==void 0&&f(i)},[E,u,f,D]),k=a.useCallback(s=>{if(!E){R(s);return}f(Gs(u,s))},[E,u,f]),te=a.useMemo(()=>C==="all"&&!y?s=>{De(s)&&k(s)}:void 0,[C,y,k]),se=a.useCallback(()=>{R("all"),F("all"),H(),E&&f(Hs(u))},[E,u,f,H]),U=fe({queries:p.map(s=>({...Rt({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),K=a.useMemo(()=>{const s=new Map;for(let i=0;i<p.length;i++){const h=p[i].accountId,yt=(U[i]?.data?.items??[]).reduce((vt,bt)=>vt+(bt.unseenCount??0),0);s.set(h,yt)}return s},[p,U]),et=a.useMemo(()=>p.filter((s,i)=>{const h=U[i];return h?.isError?!Mt(h.error):!1}),[p,U]),{criteria:oe,residual:re}=a.useMemo(()=>to(C,B,_),[C,B,_]),tt=a.useMemo(()=>C==="all"?[...Gt]:[C],[C]),st=a.useMemo(()=>({...oe,query:j,...C==="all"?{}:{category:[C]}}),[oe,j,C]),ot=so({residual:re,attributes:B,accountScoped:b!=="all"}),{sections:W,isLoading:rt,isError:at,refetch:pe}=$s({categories:y?ao:tt,criteria:oe,limit:C==="all"?At:oo,counted:ot}),{rows:xe,isLoading:nt,isError:it,refetch:Ie}=Vs(st,ro,y),ae=y?nt:rt,ye=y?it:at,ve=a.useCallback(()=>{if(y){Ie();return}pe()},[y,Ie,pe]),Y=a.useCallback(s=>As(Ht(s)).map(Ut).filter(i=>(b==="all"||i.accountId===b)&&Kt(i,re)),[b,re]),$=a.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=a.useMemo(()=>Y(xe),[xe,Y]),ct=a.useCallback(s=>{W.find(i=>i.category===s)?.retry()},[W]),w=a.useMemo(()=>y?V:$.flatMap(s=>s.rows),[y,V,$]),{spamIds:ne,briefSpamOffer:ie}=a.useMemo(()=>{const s={spamIds:void 0,briefSpamOffer:void 0};if(!j)return s;const i=w.map(L=>Ae(L,m)),{spam:h}=Yt(i);return h.length===0?s:{spamIds:new Set(h.map(L=>L.id)),briefSpamOffer:$t(i)}},[w,j,m]),be=a.useMemo(()=>{const s=i=>ne===void 0?i:i.filter(h=>!ne.has(h.id));return y?[{id:"matches",threads:s(V)}]:Vt($.map(i=>({...i,rows:s(i.rows)})))},[y,V,$,ne]),Se=a.useCallback((s,i)=>{const h=w.find(L=>L.id===s)?.threadId;h&&o?.({threadId:h,messageId:s},i)},[w,o]),lt=a.useCallback(s=>{const i=s.threadId??w.find(h=>h.id===s.id)?.threadId;i&&o?.({threadId:i,messageId:s.id})},[w,o]),ce=a.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=a.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),dt=a.useMemo(()=>Array.from(K.values()).reduce((s,i)=>s+i,0),[K]),le=a.useMemo(()=>p.map(s=>s.accountId),[p]),{hasNewMail:Ce}=ys(),{state:Te,errorMessage:we,refresh:Re}=vs(le,{onSettled:()=>ve()}),ut=a.useMemo(()=>r.jsx(bs,{state:Te,onRefresh:Re,label:"Refresh daily brief",errorMessage:we,hasUpdate:Ce(le)}),[Te,Re,we,Ce,le]),de=a.useMemo(()=>w.filter(s=>(A==="all"||s.category===A)&&jt(s,O)).map(s=>Ae(s,m)),[w,A,O,m]),{hits:Me,isLoading:mt}=ws(),ft=a.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 Jt(Me,i,m)},[Me,de,w,m]),ht=a.useMemo(()=>{const s=Zt(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:A,activeFilters:O,expanded:ee,onExpandedChange:M,onSelectCategory:i=>k(i),onSelectSource:F,onToggleFilter:i=>x(i),onClear:se}},[ce,Q,A,O,ee,x,k,se]),je=be.length===0&&b==="all"&&j.length===0&&_.length===0,gt=a.useMemo(()=>p.map(s=>s.accountId),[p]),pt=a.useMemo(()=>p.some(s=>Ss(s.syncPhase)),[p]),J=Cs(gt,je||pt),ke=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(Pe,{}),r.jsx(Pe,{})]}),Ee=!ae&&!ye&&!je,xt=Xt({tier:I,hasLiveInput:E,hasCommittedQuery:l.trim().length>0,bodyRendersCommittedResults:!0}),It=Ee?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ie&&r.jsx(es,{count:ie.count,onScopeToSpam:()=>q(ie.mailboxId,l)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(kt,{sections:be,briefCategory:A,Row:ts,selectedThreadId:t,onSelectThread:Se,onShowAllSection:te,onRetrySection:ct,flat:y,onSelectBriefCategory:k,sources:ce,sourcesNote:Q>0?`+${Q} muted`:void 0,onSelectSource:F,activeFilters:O,onToggleFilter:x,onClearFilters:se})})]}):ae?ke: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(Qe,{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(Os,{className:"size-3.5"}),"Try again"]})]}):J.resolved?r.jsx(qs,{sync:J.syncing?{synced:J.synced,total:J.total}:void 0}):ke;return r.jsx(Et,{hasSheet:Ee&&!xt,children:r.jsx(ss,{selectedMessageId:t,rows:w,onOpen:Se,onDeleteMessages:d,onSelectionVerb:v.start,commandsRef:n,onTriageContextChange:c,children:r.jsx(co,{wizard:v,header:{title:"Daily brief",unreadCount:dt,footer:T?r.jsx(os,{}):void 0,searchFilter:ht,searchResults:de,searchLoading:ae,relatedResults:ft,relatedLoading:mt,onSelectSearchResult:lt,searchResultsInBody:!0,refreshControl:ut},rows:w,children:r.jsxs("div",{className:"flex h-full flex-col",children:[et.map(s=>r.jsx(no,{accountEmail:s.email,accountId:s.accountId},s.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:It})]})})})})}const Ze=a.createContext(null);function X(){const e=a.useContext(Ze);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function uo({thread:e,children:t}){const o=Bs(),n=Ls(),c=Ke(),{searchInput:d}=Z(),l=e?.threadId,u=e?.messageId,{data:m}=_e({...Ft(),staleTime:6e4}),f=a.useMemo(()=>m?.items??[],[m]),g=a.useMemo(()=>{if(l)return f.find(x=>x.messageId===u)??f.find(x=>x.threadId===l)},[f,l,u]),T=ds(l,u),I=g??T,v=u??I?.messageId,q=a.useMemo(()=>{if(l)return{threadId:l,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:v,authenticity:I?.authenticity}},[l,I,v]),p=a.useCallback((x,k)=>{o(x,{replace:k?.replace,query:d})},[o,d]),b=a.useCallback(x=>{v&&x.includes(v)&&n()},[v,n]),F=Fe({thread:I,isOpen:!0,onAfterOptimisticRemove:b}),S=us(),{deleteMessages:R}=ms({mailboxId:I?.mailboxId??"",messages:f,onAfterOptimisticRemove:b}),{toggleReadFor:N}=fs({mailboxId:I?.mailboxId??"",messages:f}),P=S.focusedMessageId,M=a.useMemo(()=>f.find(x=>x.messageId===P),[f,P])??I,D=Fe({thread:M,isOpen:M?.messageId===v}),H=Ns(),E=Ot(),j=Nt(),_=a.useMemo(()=>Bt(j,l,v),[j,l,v]),y=a.useMemo(()=>{if(M)return x=>j({threadId:M.threadId,messageId:M.messageId,mode:x})},[j,M]),{nextMessageId:O,previousMessageId:A}=hs({context:S,orderedIds:S.orderedIds,selectedMessageId:v,enabled:!H&&!E,hasOpenThread:l!==void 0,onClose:n,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||D.deleteThread()},toggleStar:D.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||M&&N([M.messageId],!M.isRead)},goFlagged:()=>c("flagged"),goSettings:()=>c("settings")}}),B=a.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:q,onOpenThread:p,onCloseThread:n,nextThread:B(O),previousThread:B(A),actions:F,onReply:_,triage:S,onDeleteMessages:R,handleDeselectIfRemoved:b};return r.jsx(Ze.Provider,{value:C,children:t})}function Xe(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:n}=X(),{accounts:c}=Z();return r.jsx(lo,{accounts:c,selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:n})}function mo(){const{conversation:e,selectedThread:t,actions:o,onReply:n,handleDeselectIfRemoved:c}=X(),d=!!e,l=xs(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(Is,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:n?()=>n("reply"):void 0,onReplyAll:n?()=>n("reply-all"):void 0,onForward:n?()=>n("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(He,{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(Ue,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function fo(){const{selectedThread:e,handleDeselectIfRemoved:t}=X(),{onToggleIntelligence:o}=Z();return r.jsx(ps,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function ho(){const{selectedThread:e,conversation:t,onOpenThread:o,onCloseThread:n,nextThread:c,previousThread:d,handleDeselectIfRemoved:l}=X(),u=gs(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx(He,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:n,onOpenIntelligence:u.toggle,onSwipeNext:c?()=>o(c):void 0,onSwipePrevious:d?()=>o(d):void 0,mobileIntelligenceOpen:u.isOpen}),r.jsx(Ue,{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(Xe,{})})}const jo=Object.assign(uo,{List:Xe,Reading:mo,Intelligence:fo,Phone:ho});export{jo as B};
|
|
1
|
+
import{j as r,L as St,U as Ct,eb as De,ec as ue,ci as me,r as a,c as _e,C as Z,bi as Tt,cM as wt,G as Rt,dy as Mt,ed as jt,dS as kt,_ as Qe,dW as Et,ee as At,ef as Ft,aj as Ot,cT as Nt,cU as Bt}from"./index-TSFcerUm.js";import{g as ze,e as Lt,f as Ge,u as qt,p as Pt,R as Dt}from"./useSearchTokenContext-B9q2oA9M.js";import{ac as _t,G as Qt,I as zt,ao as Gt,ap as Ht,aq as Ut,ar as Kt,as as Wt,at as Ae,au as Yt,av as $t,aw as Vt,ab as Jt,ax as Zt,ay as Xt,az as es,M as ts,aA as ss,aj as os,aB as rs,e as as,w as ns,al as is,s as cs,S as ls,O as ds,T as Fe,R as us,P as ms,d as fs,a0 as hs,a1 as gs,a3 as He,a4 as Ue,a5 as ps,a6 as xs,a7 as Is}from"./MailListHeader-B42tcvIg.js";import{u as ys,a as vs,R as bs,b as Ss,c as Cs}from"./useRefreshControl-rW-6EUB_.js";import{u as fe}from"./useQueries-Cb9Npayo.js";import{t as Ts,u as ws,r as Rs,L as Ms}from"./useSemanticSearch-DvIRvW57.js";import{a as js}from"./useLabels-DNXJu_BT.js";import{u as ks,b as Es}from"./useLayoutTier-DOuXnl_R.js";import{d as As,w as Fs}from"./wizard-selection-DxUM65kM.js";import{u as Ke}from"./sections-DOVZjlqN.js";import{R as Os}from"./refresh-cw-By6IgPOL.js";import{a as Ns}from"./useMessageBodyContent-DFyG4FWc.js";import{g as Bs,h as Ls}from"./search-token-index-Y_dGTOxL.js";function qs({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(St,{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:Ps(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(Ct,{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 Ps({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 We=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Ye="category",Ds={unclassified:"uncategorized"},G=e=>Lt(e).map(t=>t.raw),z=e=>e.join(" "),he=e=>{const t=Ge(e);if(t)return We.find(o=>o.name===t.name&&o.value===t.value.toLowerCase())?.id},ge=e=>{const t=Ge(e);if(!t||t.name!==Ye)return;const o=t.value.toLowerCase(),n=Ds[o];if(n)return n;if(!(!De(o)||o==="all"))return o},$e=e=>We.find(t=>t.id===e),Ve=e=>$e(e)!==void 0,_s=e=>{const t=new Set;for(const o of G(e)){const n=he(o);n&&t.add(n)}return t},Qs=e=>{let t="all";for(const o of G(e)){const n=ge(o);n&&(t=n)}return t},zs=(e,t)=>{const o=$e(t);if(!o)return;const n=G(e),c=n.filter(d=>he(d)!==t);return c.length<n.length?z(c):z([...n,ze(o.name,o.value)])},Gs=(e,t)=>{const o=G(e).filter(n=>!ge(n));return z(t==="all"?o:[...o,ze(Ye,t)])},Hs=e=>z(G(e).filter(t=>!he(t)&&!ge(t))),Je=e=>e.trim().length>0,Oe=e=>{if(!Je(e.query))return e.ownFilters;const t=new Set(_s(e.query));for(const o of e.ownFilters)Ve(o)||t.add(o);return t},Ne=e=>Je(e.query)?Qs(e.query):e.ownCategory,Be=6e4,Us=3e4,Ks={kind:"unknown"},Le=e=>(t,o)=>_t(o?.queryKey,e)?t:void 0,Ws=(e,t,o)=>({...e,category:[t],limit:o,order:"desc"}),Ys=(e,t)=>({...e,category:[t],order:"desc",count:!0,results:!1}),qe=(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 $s({categories:e,criteria:t,limit:o,counted:n}){const c=fe({queries:e.map(m=>{const f=Ws(t,m,o),g=qe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},placeholderData:Le(g),staleTime:Be}})}),d=fe({queries:e.map(m=>{const f=Ys(t,m),g=qe(t,m);return{queryKey:me({query:f}),queryFn:async()=>{const{data:T}=await ue({query:f,throwOnError:!0});return T},enabled:n,placeholderData:Le(g),staleTime:Be}})}),l=a.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:n?Ts(T?.data?.count):Ks,loading:g?.isPending??!0,failed:g?.isError??!1,retry:()=>{g?.refetch(),n&&T?.refetch()}}}),[e,c,d,n,o]),u=a.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 Vs(e,t,o){const n={...e,limit:t,order:"desc"},{data:c,isLoading:d,isError:l,refetch:u}=_e({queryKey:me({query:n}),queryFn:async()=>{const{data:f}=await ue({query:n,throwOnError:!0});return f},enabled:o,staleTime:Us});return{rows:a.useMemo(()=>o?c?.items??[]:[],[c,o]),isLoading:o&&d,isError:o&&l,refetch:a.useCallback(()=>{u()},[u])}}const Js=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),Zs=e=>[...e].sort(Js),Xs=["category","unread","starred","attachments"],eo=["contacts","today"],to=(e,t,o)=>{const n=Qt({category:e,attributes:t}),{params:c,residual:d}=zt(o,n,Xs),l={...c,...n},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}},so=({residual:e,attributes:t,accountScoped:o})=>e.length===0&&!o&&!eo.some(n=>t.has(n)),oo=50,ro=200,ao=[],Pe=()=>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))}),no=({accountEmail:e})=>{const t=Ke();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(Qe,{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"})]})},io=(e,t)=>{if(t.size===0)return{};const o=e.filter(d=>t.has(d.id)),n=Rs(o.map(d=>d.accountId));if(n.restriction)return n;const c=new Set;for(const d of o)d.mailboxId&&c.add(d.mailboxId);return c.size>1?{accountId:n.accountId,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${c.size} folders`}:{accountId:n.accountId,mailboxId:c.size===1?[...c][0]:void 0}};function co({header:e,rows:t,wizard:o,children:n}){const{selectedIds:c,selectedCount:d,exitSelection:l,orderedIds:u,allSelected:m,toggleAllLoaded:f}=rs(),g=a.useMemo(()=>io(t,c),[t,c]),{junkMailboxId:T}=as(g.accountId),{labels:I}=js(g.accountId),v=a.useMemo(()=>Array.from(c),[c]),q=a.useMemo(()=>Fs(t,c),[t,c]),p=ns(T,g.mailboxId),b=a.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(ls,{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(Ms,{accountId:g.accountId,mailboxId:g.mailboxId,messageIds:v}):void 0,selectAll:b,notice:F});return r.jsx(is,{...e,selectionBar:S,paneOverlay:r.jsx(cs,{verb:o.verb,accountId:g.accountId,mailboxId:g.mailboxId,selection:q,selectionRestriction:g.restriction,onFinished:l}),children:n})}function lo({accounts:e,selectedMessageId:t,onOpenThread:o,commandsRef:n,onTriageContextChange:c,onDeleteMessages:d}){const{searchQuery:l,searchInput:u,resultFolderIndex:m,onSearchChange:f}=Z(),g=qt(),T=Tt(),I=ks(),v=wt(),q=Es(),p=a.useMemo(()=>Zs(e.filter(s=>!s.muted?.value)),[e]),[b,F]=a.useState("all"),[S,R]=a.useState("all"),[N,P]=a.useState(new Set),[ee,M]=a.useState(!1),D=a.useCallback(s=>{P(i=>{const h=new Set(i);return h.has(s)?h.delete(s):h.add(s),h})},[]),H=a.useCallback(()=>P(new Set),[]),E=u.trim().length>0,{freeText:j,tokens:_}=Pt(l.trim().toLowerCase(),g),y=j.length>0,O=a.useMemo(()=>Oe({query:u,ownFilters:N}),[u,N]),A=a.useMemo(()=>Ne({query:u,ownCategory:S}),[u,S]),B=a.useMemo(()=>Oe({query:l,ownFilters:N}),[l,N]),C=a.useMemo(()=>Ne({query:l,ownCategory:S}),[l,S]),x=a.useCallback(s=>{if(!E||!Ve(s)){D(s);return}const i=zs(u,s);i!==void 0&&f(i)},[E,u,f,D]),k=a.useCallback(s=>{if(!E){R(s);return}f(Gs(u,s))},[E,u,f]),te=a.useMemo(()=>C==="all"&&!y?s=>{De(s)&&k(s)}:void 0,[C,y,k]),se=a.useCallback(()=>{R("all"),F("all"),H(),E&&f(Hs(u))},[E,u,f,H]),U=fe({queries:p.map(s=>({...Rt({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),K=a.useMemo(()=>{const s=new Map;for(let i=0;i<p.length;i++){const h=p[i].accountId,yt=(U[i]?.data?.items??[]).reduce((vt,bt)=>vt+(bt.unseenCount??0),0);s.set(h,yt)}return s},[p,U]),et=a.useMemo(()=>p.filter((s,i)=>{const h=U[i];return h?.isError?!Mt(h.error):!1}),[p,U]),{criteria:oe,residual:re}=a.useMemo(()=>to(C,B,_),[C,B,_]),tt=a.useMemo(()=>C==="all"?[...Gt]:[C],[C]),st=a.useMemo(()=>({...oe,query:j,...C==="all"?{}:{category:[C]}}),[oe,j,C]),ot=so({residual:re,attributes:B,accountScoped:b!=="all"}),{sections:W,isLoading:rt,isError:at,refetch:pe}=$s({categories:y?ao:tt,criteria:oe,limit:C==="all"?At:oo,counted:ot}),{rows:xe,isLoading:nt,isError:it,refetch:Ie}=Vs(st,ro,y),ae=y?nt:rt,ye=y?it:at,ve=a.useCallback(()=>{if(y){Ie();return}pe()},[y,Ie,pe]),Y=a.useCallback(s=>As(Ht(s)).map(Ut).filter(i=>(b==="all"||i.accountId===b)&&Kt(i,re)),[b,re]),$=a.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=a.useMemo(()=>Y(xe),[xe,Y]),ct=a.useCallback(s=>{W.find(i=>i.category===s)?.retry()},[W]),w=a.useMemo(()=>y?V:$.flatMap(s=>s.rows),[y,V,$]),{spamIds:ne,briefSpamOffer:ie}=a.useMemo(()=>{const s={spamIds:void 0,briefSpamOffer:void 0};if(!j)return s;const i=w.map(L=>Ae(L,m)),{spam:h}=Yt(i);return h.length===0?s:{spamIds:new Set(h.map(L=>L.id)),briefSpamOffer:$t(i)}},[w,j,m]),be=a.useMemo(()=>{const s=i=>ne===void 0?i:i.filter(h=>!ne.has(h.id));return y?[{id:"matches",threads:s(V)}]:Vt($.map(i=>({...i,rows:s(i.rows)})))},[y,V,$,ne]),Se=a.useCallback((s,i)=>{const h=w.find(L=>L.id===s)?.threadId;h&&o?.({threadId:h,messageId:s},i)},[w,o]),lt=a.useCallback(s=>{const i=s.threadId??w.find(h=>h.id===s.id)?.threadId;i&&o?.({threadId:i,messageId:s.id})},[w,o]),ce=a.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=a.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),dt=a.useMemo(()=>Array.from(K.values()).reduce((s,i)=>s+i,0),[K]),le=a.useMemo(()=>p.map(s=>s.accountId),[p]),{hasNewMail:Ce}=ys(),{state:Te,errorMessage:we,refresh:Re}=vs(le,{onSettled:()=>ve()}),ut=a.useMemo(()=>r.jsx(bs,{state:Te,onRefresh:Re,label:"Refresh daily brief",errorMessage:we,hasUpdate:Ce(le)}),[Te,Re,we,Ce,le]),de=a.useMemo(()=>w.filter(s=>(A==="all"||s.category===A)&&jt(s,O)).map(s=>Ae(s,m)),[w,A,O,m]),{hits:Me,isLoading:mt}=ws(),ft=a.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 Jt(Me,i,m)},[Me,de,w,m]),ht=a.useMemo(()=>{const s=Zt(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:A,activeFilters:O,expanded:ee,onExpandedChange:M,onSelectCategory:i=>k(i),onSelectSource:F,onToggleFilter:i=>x(i),onClear:se}},[ce,Q,A,O,ee,x,k,se]),je=be.length===0&&b==="all"&&j.length===0&&_.length===0,gt=a.useMemo(()=>p.map(s=>s.accountId),[p]),pt=a.useMemo(()=>p.some(s=>Ss(s.syncPhase)),[p]),J=Cs(gt,je||pt),ke=r.jsxs("div",{className:"h-full overflow-y-auto",children:[r.jsx(Pe,{}),r.jsx(Pe,{})]}),Ee=!ae&&!ye&&!je,xt=Xt({tier:I,hasLiveInput:E,hasCommittedQuery:l.trim().length>0,bodyRendersCommittedResults:!0}),It=Ee?r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ie&&r.jsx(es,{count:ie.count,onScopeToSpam:()=>q(ie.mailboxId,l)}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(kt,{sections:be,briefCategory:A,Row:ts,selectedThreadId:t,onSelectThread:Se,onShowAllSection:te,onRetrySection:ct,flat:y,onSelectBriefCategory:k,sources:ce,sourcesNote:Q>0?`+${Q} muted`:void 0,onSelectSource:F,activeFilters:O,onToggleFilter:x,onClearFilters:se})})]}):ae?ke: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(Qe,{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(Os,{className:"size-3.5"}),"Try again"]})]}):J.resolved?r.jsx(qs,{sync:J.syncing?{synced:J.synced,total:J.total}:void 0}):ke;return r.jsx(Et,{hasSheet:Ee&&!xt,children:r.jsx(ss,{selectedMessageId:t,rows:w,onOpen:Se,onDeleteMessages:d,onSelectionVerb:v.start,commandsRef:n,onTriageContextChange:c,children:r.jsx(co,{wizard:v,header:{title:"Daily brief",unreadCount:dt,footer:T?r.jsx(os,{}):void 0,searchFilter:ht,searchResults:de,searchLoading:ae,relatedResults:ft,relatedLoading:mt,onSelectSearchResult:lt,searchResultsInBody:!0,refreshControl:ut},rows:w,children:r.jsxs("div",{className:"flex h-full flex-col",children:[et.map(s=>r.jsx(no,{accountEmail:s.email,accountId:s.accountId},s.accountId)),r.jsx("div",{className:"min-h-0 flex-1",children:It})]})})})})}const Ze=a.createContext(null);function X(){const e=a.useContext(Ze);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function uo({thread:e,children:t}){const o=Bs(),n=Ls(),c=Ke(),{searchInput:d}=Z(),l=e?.threadId,u=e?.messageId,{data:m}=_e({...Ft(),staleTime:6e4}),f=a.useMemo(()=>m?.items??[],[m]),g=a.useMemo(()=>{if(l)return f.find(x=>x.messageId===u)??f.find(x=>x.threadId===l)},[f,l,u]),T=ds(l,u),I=g??T,v=u??I?.messageId,q=a.useMemo(()=>{if(l)return{threadId:l,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:v,authenticity:I?.authenticity}},[l,I,v]),p=a.useCallback((x,k)=>{o(x,{replace:k?.replace,query:d})},[o,d]),b=a.useCallback(x=>{v&&x.includes(v)&&n()},[v,n]),F=Fe({thread:I,isOpen:!0,onAfterOptimisticRemove:b}),S=us(),{deleteMessages:R}=ms({mailboxId:I?.mailboxId??"",messages:f,onAfterOptimisticRemove:b}),{toggleReadFor:N}=fs({mailboxId:I?.mailboxId??"",messages:f}),P=S.focusedMessageId,M=a.useMemo(()=>f.find(x=>x.messageId===P),[f,P])??I,D=Fe({thread:M,isOpen:M?.messageId===v}),H=Ns(),E=Ot(),j=Nt(),_=a.useMemo(()=>Bt(j,l,v),[j,l,v]),y=a.useMemo(()=>{if(M)return x=>j({threadId:M.threadId,messageId:M.messageId,mode:x})},[j,M]),{nextMessageId:O,previousMessageId:A}=hs({context:S,orderedIds:S.orderedIds,selectedMessageId:v,enabled:!H&&!E,hasOpenThread:l!==void 0,onClose:n,handlers:{reply:()=>y?.("reply"),replyAll:()=>y?.("reply-all"),forward:()=>y?.("forward"),delete:()=>{S.listCommandsRef.current?.requestVerb("delete")||D.deleteThread()},toggleStar:D.toggleStar,toggleRead:()=>{S.listCommandsRef.current?.requestVerb("markRead")||M&&N([M.messageId],!M.isRead)},goFlagged:()=>c("flagged"),goSettings:()=>c("settings")}}),B=a.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:q,onOpenThread:p,onCloseThread:n,nextThread:B(O),previousThread:B(A),actions:F,onReply:_,triage:S,onDeleteMessages:R,handleDeselectIfRemoved:b};return r.jsx(Ze.Provider,{value:C,children:t})}function Xe(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:n}=X(),{accounts:c}=Z();return r.jsx(lo,{accounts:c,selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:n})}function mo(){const{conversation:e,selectedThread:t,actions:o,onReply:n,handleDeselectIfRemoved:c}=X(),d=!!e,l=xs(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(Is,{hasThread:d,intelligenceOpen:l.isShowing,canToggleIntelligence:l.canToggle,onToggleIntelligence:l.toggle,onReply:n?()=>n("reply"):void 0,onReplyAll:n?()=>n("reply-all"):void 0,onForward:n?()=>n("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(He,{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(Ue,{isOpen:l.drawerOpen,onClose:l.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function fo(){const{selectedThread:e,handleDeselectIfRemoved:t}=X(),{onToggleIntelligence:o}=Z();return r.jsx(ps,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function ho(){const{selectedThread:e,conversation:t,onOpenThread:o,onCloseThread:n,nextThread:c,previousThread:d,handleDeselectIfRemoved:l}=X(),u=gs(t?.threadId??null);return t?r.jsxs(r.Fragment,{children:[r.jsx(He,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:n,onOpenIntelligence:u.toggle,onSwipeNext:c?()=>o(c):void 0,onSwipePrevious:d?()=>o(d):void 0,mobileIntelligenceOpen:u.isOpen}),r.jsx(Ue,{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(Xe,{})})}const jo=Object.assign(uo,{List:Xe,Reading:mo,Intelligence:fo,Phone:ho});export{jo as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee,i as _}from"./window-kTlLLfmP.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,el as re,em as ie,en as le,h as oe,s as ce,b1 as de,_ as ue}from"./index-D2oM-aLC.js";import{f as me}from"./ErrorState-DlbF94gh.js";import{R as z,c as he}from"./calendar-color-CiT91Pq7.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-CVIqAaUk.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,el as re,em as ie,en as le,h as oe,s as ce,b1 as de,_ as ue}from"./index-TSFcerUm.js";import{f as me}from"./ErrorState-B8_VgSJK.js";import{R as z,c as he}from"./calendar-color-DotdRhn7.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-TSFcerUm.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-TSFcerUm.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-TSFcerUm.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-TSFcerUm.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{ec as _,r as n,ci as z,c as J,C as V,bi as ge,cM as he,aX as me,aY as pe,j as r,aj as fe,cT as Ie,cU as xe}from"./index-
|
|
1
|
+
import{ec as _,r as n,ci as z,c as J,C as V,bi as ge,cM as he,aX as me,aY as pe,j as r,aj as fe,cT as Ie,cU as xe}from"./index-TSFcerUm.js";import{u as Te,p as X,R as ye}from"./useSearchTokenContext-B9q2oA9M.js";import{G as be,I as ve,aq as Y,aC as Se,aD as Ce,ar as Re,aE as we,at as Fe,b as Me,M as je,aA as Oe,aF as Pe,aB as ke,s as Ae,O as Le,T as Z,R as Ee,P as qe,d as Ne,a0 as De,a1 as Be,a3 as $,a4 as ee,a5 as Qe,a6 as Ge,a7 as He}from"./MailListHeader-B42tcvIg.js";import{u as Ke,l as _e,b as ze,a as Ve}from"./MailViewChrome-8HwI1SE8.js";import{f as Ue}from"./ErrorState-B8_VgSJK.js";import{d as K,w as We}from"./wizard-selection-DxUM65kM.js";import{a as Xe}from"./useMessageBodyContent-DFyG4FWc.js";import{g as Ye,h as Ze}from"./search-token-index-Y_dGTOxL.js";import{u as Je}from"./sections-DOVZjlqN.js";const N=e=>({...e,starred:!0,order:"desc"}),$e=(e={})=>z({query:N(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:{...N(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={...N(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={...N(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(Ae,{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 f=new Set(b);return f.has(d)?f.delete(d):f.add(d),f})},[]),w=n.useCallback(()=>{m("all"),k(new Set)},[]),T=n.useCallback(()=>{w(),g()},[w,g]),{freeText:x,tokens:C}=X(l.trim().toLowerCase(),h),A=X(l.trim(),h).freeText,{criteria:F,residual:p}=n.useMemo(()=>at({category:u,attributes:S},C),[u,S,C]),M=n.useMemo(()=>x?{...F,query:x}:F,[F,x]),{threads:L,isLoading:E,isError:v,error:B,refetch:j,fetchNextPage:Q,hasNextPage:G,isFetchingNextPage:O}=te(F),q=et(M,rt),o=n.useMemo(()=>{const d=K(L).map(Y),b=x?Se(d.filter(f=>Ce(f,x)),K(q).map(Y)):d;return K(b).filter(f=>Re(f,p))},[L,q,x,p]),y=n.useCallback((d,b)=>{const f=o.find(ue=>ue.id===d)?.threadId;f&&t?.({threadId:f,messageId:d},b)},[o,t]),H=n.useCallback(d=>{const b=d.threadId??o.find(f=>f.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:p.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(pe());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:A||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=Le(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}=qe({mailboxId:u?.mailboxId??"",messages:h,onAfterOptimisticRemove:R}),{toggleReadFor:C}=Ne({mailboxId:u?.mailboxId??"",messages:h}),A=T.focusedMessageId,p=n.useMemo(()=>h.find(o=>o.messageId===A),[h,A])??u,M=Z({thread:p,isOpen:p?.messageId===m}),L=Xe(),E=fe(),v=Ie(),B=n.useMemo(()=>xe(v,i,m),[v,i,m]),j=n.useMemo(()=>{if(p)return o=>v({threadId:p.threadId,messageId:p.messageId,mode:o})},[v,p]),{nextMessageId:Q,previousMessageId:G}=De({context:T,orderedIds:T.orderedIds,selectedMessageId:m,enabled:!L&&!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")||p&&C([p.messageId],!p.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]),q={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:q,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-TSFcerUm.js";import{E as u}from"./ErrorState-B8_VgSJK.js";import{D as r,C as x,u as k}from"./index-aHhijiWM.js";import{c as p,d as h,e as b}from"./useMessageBodyContent-DFyG4FWc.js";import{C as S}from"./confirm-dialog-iduDtLpK.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};
|