@remit/web-client-dist 0.0.616 → 0.0.618
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-CzoFPZQe.js → BriefPane-D6Rb1w0-.js} +1 -1
- package/assets/CalendarComposePane-Cag4oTJ7.js +1 -0
- package/assets/{CalendarComposeSeed-DjYFKD2B.js → CalendarComposeSeed-BLVy4EAK.js} +1 -1
- package/assets/{CalendarShell-BoMJGRR0.js → CalendarShell-D9bCIXDq.js} +1 -1
- package/assets/{EmptyState-CAiUd3IM.js → EmptyState-DIU2PJNu.js} +1 -1
- package/assets/{ErrorState-DL8IICDI.js → ErrorState-BCYXDXXn.js} +1 -1
- package/assets/FlaggedPane-Dgxfxz7a.js +1 -0
- package/assets/{FullCompose-BxbmJNhS.js → FullCompose-C1Gg0PTl.js} +1 -1
- package/assets/MailListHeader-fjGj1Z2F.js +7 -0
- package/assets/{MailNav-CrrYVP3B.js → MailNav-4wMDVkxF.js} +1 -1
- package/assets/{MailShell-Da0Etm3P.js → MailShell-CgYYyjEm.js} +1 -1
- package/assets/{MailViewChrome-DmH48Cl1.js → MailViewChrome-BBOrPtAJ.js} +1 -1
- package/assets/{MailboxPane-BwpdLi9g.js → MailboxPane-B2haNF-5.js} +1 -1
- package/assets/{NavMenuButton-D90jND-i.js → NavMenuButton-DJm5WKRg.js} +1 -1
- package/assets/{OnboardingWizard-DzFLU_Ri.js → OnboardingWizard-TTxleJVJ.js} +1 -1
- package/assets/OpenCalendarEvent-BU82xNg_.js +2 -0
- package/assets/{OutboxPane-CNojaEJu.js → OutboxPane-Be-9gv3_.js} +1 -1
- package/assets/_calendarObjectId-DzJAQ_AC.js +1 -0
- package/assets/_mailboxId-DIqrLr3P.js +1 -0
- package/assets/_messageId-BC16XNmU.js +1 -0
- package/assets/_messageId-BTeeS3o6.js +1 -0
- package/assets/_messageId-Ct6qK_Gm.js +1 -0
- package/assets/_outboxMessageId-CY0wikuK.js +1 -0
- package/assets/_recurrenceId-DbYIFn7-.js +1 -0
- package/assets/_threadId-BL0Jtba9.js +1 -0
- package/assets/_threadId-DLNZmItz.js +1 -0
- package/assets/_threadId-P4k8Qibr.js +1 -0
- package/assets/_view._date-B3szMnat.js +1 -0
- package/assets/{accounts-CeR4-INH.js → accounts-BjPCzL7r.js} +1 -1
- package/assets/{advanced-DQGBQKcO.js → advanced-CPmUiMh2.js} +1 -1
- package/assets/{appearance-D4NHIuvi.js → appearance-D1cbuFMR.js} +1 -1
- package/assets/{attachment-file-BQp21gzB.js → attachment-file-C8jgW1JX.js} +1 -1
- package/assets/{attendee-row-CnMtAytL.js → attendee-row-B93ctYqz.js} +1 -1
- package/assets/{avatar-D4VDrspO.js → avatar-UUVjuy7o.js} +1 -1
- package/assets/{bell-off-CL9147py.js → bell-off-WRFG6V23.js} +1 -1
- package/assets/{bottom-sheet-Bh4ET6LC.js → bottom-sheet-BLxhvsST.js} +1 -1
- package/assets/{brief-B9d-VmIP.js → brief-CbDq6XI_.js} +1 -1
- package/assets/brief-DKTo_D3Q.js +1 -0
- package/assets/{browser-ponyfill-Dd0i1SY2.js → browser-ponyfill-DhVS7MBW.js} +2 -2
- package/assets/{bug-BJJgZ5zd.js → bug-BqaxRSOD.js} +1 -1
- package/assets/{calendar-BHRN23oX.js → calendar-CeiOp-Lt.js} +1 -1
- package/assets/{calendar-clash-strip-C-R84ym8.js → calendar-clash-strip-C7-4o9Kh.js} +1 -1
- package/assets/calendar-format-Da1fNx_F.js +1 -0
- package/assets/calendar-suggestion-DFTXWxI-.js +1 -0
- package/assets/{calendars-BqWgGasa.js → calendars-DRtTpY_y.js} +1 -1
- package/assets/{card-BCy1RA9l.js → card-BwsI--WL.js} +1 -1
- package/assets/chevron-left-BFzz3Ieb.js +1 -0
- package/assets/{circle-check-BZ6AXaiT.js → circle-check-Clb2s9oX.js} +1 -1
- package/assets/{circle-check-big-CdHJP596.js → circle-check-big-C9itbVkv.js} +1 -1
- package/assets/{circle-help-CkUomUBh.js → circle-help-B6swOKgu.js} +1 -1
- package/assets/{clock-AguiN9j6.js → clock-CvkcV4bM.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BqSvmP9l.js +1 -0
- package/assets/compose._-_outboxMessageId_-CgP4fEvb.js +1 -0
- package/assets/compose._-_outboxMessageId_-DOPIPdYf.js +1 -0
- package/assets/compose._-_outboxMessageId_-DliyDKiu.js +1 -0
- package/assets/{config-import-BXzFTsn_.js → config-import-CwVoOpJE.js} +1 -1
- package/assets/{confirm-dialog-BZZQOI7k.js → confirm-dialog-BV17Lty3.js} +1 -1
- package/assets/{copy-CQ5KOAOb.js → copy-VAaOyIDU.js} +1 -1
- package/assets/{credential-steps-zQjNuso_.js → credential-steps-CZcnrw5S.js} +1 -1
- package/assets/{download-BExZY0FM.js → download-CWiATtxe.js} +1 -1
- package/assets/{file-json-BRkN7g8-.js → file-json-DNnAu7W3.js} +1 -1
- package/assets/{filters-BgjkZm7-.js → filters-DX-qVJxQ.js} +1 -1
- package/assets/{flagged-DHcrSSmI.js → flagged-D895Wydy.js} +1 -1
- package/assets/flagged-ahLq0yiF.js +1 -0
- package/assets/{folders-C-HrHuxZ.js → folders-DHXTMyve.js} +1 -1
- package/assets/{help-copy-D2a2il0v.js → help-copy-DbMRDCV3.js} +1 -1
- package/assets/{import-bnwF9pCh.js → import-BctilBci.js} +1 -1
- package/assets/index-0JBsVkvN.js +1 -0
- package/assets/index-BGzW3eSp.js +1 -0
- package/assets/index-BRLOYVTk.js +1 -0
- package/assets/index-BTeeS3o6.js +1 -0
- package/assets/{index-DL_EZDwo.js → index-BVWL5J6a.js} +4 -4
- package/assets/index-CrgF6PYF.js +1 -0
- package/assets/{index-DHixLwXV.js → index-D8rRRGKU.js} +1 -1
- package/assets/index-DFh9yLFo.js +1 -0
- package/assets/{index-BNRL-uMz.js → index-DJ_qkfvM.js} +15 -15
- package/assets/index-Ddqs55d_.js +1 -0
- package/assets/index-mYwQybmz.js +1 -0
- package/assets/index-qGlV5xrJ.js +1 -0
- package/assets/{kbd-CDysyfRZ.js → kbd-DeTBGQqu.js} +1 -1
- package/assets/{labels-ClHeJzne.js → labels-DcXPPiee.js} +1 -1
- package/assets/{mail-CyPhtVze.js → mail-BDH1BUwj.js} +1 -1
- package/assets/{mail-BcvBDSY9.js → mail-BdNWQSkT.js} +1 -1
- package/assets/{map-pin-BrVSO8jV.js → map-pin-Cp14Jt9W.js} +1 -1
- package/assets/{menu-CYARun27.js → menu-B2D2SRp4.js} +1 -1
- package/assets/new-DYPN3cS1.js +1 -0
- package/assets/onboarding-D0mRyQ_7.js +1 -0
- package/assets/{onboarding-completion-BgqDa51u.js → onboarding-completion-BCqVEUxr.js} +1 -1
- package/assets/outbox-CUISRsfl.js +1 -0
- package/assets/{pencil-BgwmWbKx.js → pencil-BYeYAcEk.js} +1 -1
- package/assets/{popover-menu-CaWXxqI-.js → popover-menu-OJfdS-G4.js} +1 -1
- package/assets/{refresh-cw-CeX4HCu8.js → refresh-cw-B6fDl1YI.js} +1 -1
- package/assets/{rich-text-CVrd0i43.js → rich-text-CYmMUdTg.js} +15 -15
- package/assets/{rich-text-spellcheck-worker-provider-DBHFJbz8.js → rich-text-spellcheck-worker-provider-CPl7Kkud.js} +1 -1
- package/assets/{rotate-ccw-C2quNGbr.js → rotate-ccw-OMi-IsT0.js} +1 -1
- package/assets/{roving-focus-Dh7DXEPK.js → roving-focus-C9bG9Szt.js} +1 -1
- package/assets/{row-actions-CkerNORk.js → row-actions-B4KYs_S5.js} +1 -1
- package/assets/{search-mirror-C7ObSa-m.js → search-mirror-CCQ9MuZF.js} +1 -1
- package/assets/{search-token-index-C0l1uvSx.js → search-token-index-Hf4tURnk.js} +1 -1
- package/assets/{sections-DMxbWj0z.js → sections-BzX0ht1F.js} +1 -1
- package/assets/{senders-CCHvyHxR.js → senders-B_i_Z8DO.js} +1 -1
- package/assets/settings-CJVx-VMd.js +1 -0
- package/assets/{settings-screen-CVouGmL2.js → settings-screen-DNRg9rAy.js} +1 -1
- package/assets/{shield-check-DbxfVQfY.js → shield-check-B2BId7--.js} +1 -1
- package/assets/{suggested-vips-D8nDLRxf.js → suggested-vips-4jeZS4Er.js} +1 -1
- package/assets/useCalendarData-vdQ5fo0i.js +1 -0
- package/assets/{useCalendarWrites-BzQ7iDMq.js → useCalendarWrites-CD5qi78W.js} +1 -1
- package/assets/useCalendars-os-DtAnP.js +1 -0
- package/assets/{useDebouncedValue-DTWAtSog.js → useDebouncedValue-CJbuyk4u.js} +1 -1
- package/assets/{useFilters-DEaPNwcL.js → useFilters-BxVe8jHP.js} +1 -1
- package/assets/{useLabels-C9yVLFxX.js → useLabels-CTWalEw2.js} +1 -1
- package/assets/{useLayoutTier-BcCtlayn.js → useLayoutTier-DnllYarf.js} +1 -1
- package/assets/{useMessageBodyContent-BgYyi6MR.js → useMessageBodyContent-BeTI85Tr.js} +1 -1
- package/assets/{useQueries-Br_JNeLu.js → useQueries-QS_Quksh.js} +1 -1
- package/assets/{useRefreshControl-DVb8lxb_.js → useRefreshControl-D7v2StJI.js} +1 -1
- package/assets/{useResultFolderIndex-ClE616_m.js → useResultFolderIndex-CfE4E9Yy.js} +1 -1
- package/assets/{useSearchTokenContext-B79W3Jko.js → useSearchTokenContext-DdNZMB4E.js} +1 -1
- package/assets/{useSemanticSearch-DLy3K9TL.js → useSemanticSearch-DsbOO_bh.js} +1 -1
- package/assets/{useSignature-lhStRQfS.js → useSignature-CHwj6SiQ.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/CalendarComposePane-CQZe-WLW.js +0 -1
- package/assets/FlaggedPane-CWrrUQNF.js +0 -1
- package/assets/MailListHeader-7hjO4QAJ.js +0 -7
- package/assets/OpenCalendarEvent-DbRkvQVO.js +0 -2
- package/assets/_calendarObjectId-CXAD3VNq.js +0 -1
- package/assets/_mailboxId-l7NozB3O.js +0 -1
- package/assets/_messageId-5M7Qw-CJ.js +0 -1
- package/assets/_messageId-BrMYCKFI.js +0 -1
- package/assets/_messageId-f0z0D5bU.js +0 -1
- package/assets/_outboxMessageId-BlBsQyC6.js +0 -1
- package/assets/_recurrenceId-RcOhUTgR.js +0 -1
- package/assets/_threadId-B2Zol5XG.js +0 -1
- package/assets/_threadId-BeSsHU4l.js +0 -1
- package/assets/_threadId-CFMeYyr6.js +0 -1
- package/assets/_view._date-CYCMsNZ-.js +0 -1
- package/assets/brief-XKDFd1i7.js +0 -1
- package/assets/calendar-color-ly22L46M.js +0 -1
- package/assets/calendar-event-chip-ITdEcNNH.js +0 -1
- package/assets/chevron-left-CC9dZl33.js +0 -1
- package/assets/compose._-_outboxMessageId_-BjzSzVSQ.js +0 -1
- package/assets/compose._-_outboxMessageId_-CJ41xvkt.js +0 -1
- package/assets/compose._-_outboxMessageId_-Cx3F57_V.js +0 -1
- package/assets/compose._-_outboxMessageId_-DMtAj3Be.js +0 -1
- package/assets/flagged-C_OKmnpa.js +0 -1
- package/assets/index-5M7Qw-CJ.js +0 -1
- package/assets/index-B2n_7aVM.js +0 -1
- package/assets/index-BSufmYBm.js +0 -1
- package/assets/index-C4iI4aYA.js +0 -1
- package/assets/index-ChLelX4F.js +0 -1
- package/assets/index-D4YmfuBT.js +0 -1
- package/assets/index-DJRfo9IU.js +0 -1
- package/assets/index-DdDkYBGe.js +0 -1
- package/assets/index-f0z0D5bU.js +0 -1
- package/assets/new-CILsiEz0.js +0 -1
- package/assets/onboarding-DPEomE6O.js +0 -1
- package/assets/outbox-321szP7k.js +0 -1
- package/assets/settings-CZXTyYSn.js +0 -1
- package/assets/useCalendarData-CuegXoQ4.js +0 -1
- package/assets/useCalendarEvents-C15rKxvv.js +0 -1
- package/assets/useCalendars-DMp85Z7y.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e_ as r,e$ as o,f0 as a}from"./index-DJ_qkfvM.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const l=t=>({post:e=>t.postMessage(e),listen:e=>t.addEventListener("message",s=>e(s.data)),fail:e=>t.addEventListener("error",s=>e(s.message)),terminate:()=>t.terminate()}),i=async t=>{const e=r(t);if(!e)return null;const s=new Worker(new URL("/assets/rich-text-spellcheck-worker-pWkhC-WR.js",import.meta.url),{type:"module"});return n(e,o(),l(s),a(e))};export{i as openSpellcheckWorker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./index-
|
|
1
|
+
import{e}from"./index-DJ_qkfvM.js";const a=e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);export{a as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d}from"./index-
|
|
1
|
+
import{r as d}from"./index-DJ_qkfvM.js";const E={"data-list-row":""},v="[data-list-row]";function m(e,r,s,i="vertical"){if(s===0)return null;const n=i==="vertical"?"ArrowDown":"ArrowRight",c=i==="vertical"?"ArrowUp":"ArrowLeft";return e===n?r<0?0:Math.min(r+1,s-1):e===c?r<=0?0:r-1:e==="Home"?0:e==="End"?s-1:null}function l(e,r){return Array.from(e.querySelectorAll(r))}function y({containerRef:e,itemSelector:r,orientation:s="vertical",enabled:i=!0}){d.useEffect(()=>{if(!i)return;const n=e.current;if(!n)return;const c=()=>{const t=l(n,r);if(t.length===0)return;const f=t.find(o=>o===document.activeElement)??t[0];for(const o of t)o.tabIndex=o===f?0:-1},u=t=>{if(t.shiftKey||t.metaKey||t.ctrlKey||t.altKey)return;const a=l(n,r),f=a.indexOf(document.activeElement),o=m(t.key,f,a.length,s);o===null||o===f||(t.preventDefault(),t.stopPropagation(),a[o]?.focus())};return c(),n.addEventListener("focusin",c),n.addEventListener("keydown",u),()=>{n.removeEventListener("focusin",c),n.removeEventListener("keydown",u)}})}export{v as L,E as a,m as r,y as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,j as l,f as b,t as y,L as x}from"./index-
|
|
1
|
+
import{r as e,j as l,f as b,t as y,L as x}from"./index-DJ_qkfvM.js";const i=()=>l.jsx(x,{className:"size-3.5 animate-spin"}),m=(s,n)=>n?l.jsx("span",{className:"sr-only",children:s}):s;function p({actions:s=[],destructive:n,className:o}){const[f,r]=e.useState(!1);return f&&n?.confirm?l.jsxs("div",{className:y("flex items-center gap-2",o),children:[l.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),l.jsx(b,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:n.confirm.cancelLabel??"Cancel"}),l.jsx(b,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?i():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):l.jsxs("div",{className:y("flex items-center gap-2",o),children:[s.map(a=>l.jsx(b,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?i():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:m(a.label,a.iconOnly)},a.label)),n&&l.jsx(b,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?i():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){r(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:m(n.label,n.iconOnly)})]})}export{p as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as x,C as v,x as p,z as I,ak as g,r as Q}from"./index-
|
|
1
|
+
import{u as x,C as v,x as p,z as I,ak as g,r as Q}from"./index-DJ_qkfvM.js";import{b}from"./MailShell-CgYYyjEm.js";import{a as C}from"./useMessageBodyContent-BeTI85Tr.js";function W(o){const t=x(),{searchInput:c,searchQuery:e}=v(),i=p({select:a=>I(a.location.search)}),u=p({select:a=>a.location.pathname}),h=C(),f=g(),m=h||f,{to:s}=o,r="params"in o?o.params.mailboxId:void 0,l=r?`/mail/${r}`:s;Q.useEffect(()=>{if(!b({searchInput:c,committedQuery:e,urlQuery:i,pathname:u,listPath:l}))return;const y=!!e&&i!==e&&!m,n=d=>({...d,q:e||void 0});if(!y){t({to:".",search:n,hash:!0,replace:!0});return}if(s==="/mail/$mailboxId"){if(!r)return;t({to:s,params:{mailboxId:r},search:n,hash:!0,replace:!0});return}t({to:s,search:n,hash:!0,replace:!0})},[c,e,i,t,s,r,l,u,m])}export{W as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as h,bT as V,t as E,ch as _,X as Q,ci as L,cj as G,ck as z,cl as X,cm as J,a9 as x,u as N,cn as Y,co as k,cp as W,ac as Z,K as M,ae as ee,af as te,C as ne,cq as K}from"./index-BNRL-uMz.js";import{s as oe,S as se}from"./search-scope-B5-OK3Cq.js";import{u as R}from"./useQueries-Br_JNeLu.js";const re=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function xe(e){return re.filter(t=>e[t.action]!==void 0)}const ae=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function ie(e){for(const t of ae){const n=t.hints.find(o=>o.action===e);if(n)return n.keys}}function ce(e){const t=ie(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function ke(e){const t=ce(e);return t===""?"":`(${t})`}function le({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:o,hasValue:i,chipCount:r}){const a=r-1;return e==="Escape"?i?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:a}:e==="Backspace"||e==="ArrowLeft"?!o||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:a}:{type:"none"}}function ue({key:e,repeat:t=!1,index:n,chipCount:o}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=o-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function fe(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const de=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,pe=({chips:e=[],onRemoveChip:t,value:n,onChange:o,onClear:i,onClearQuery:r,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m="sm",inputId:f,suggest:d,className:b})=>{const D=l.useId(),F=f??D,I=l.useRef(null),P=l.useRef([]),A=r??i,[$,C]=l.useState(null),S=l.useRef(void 0),[q,O]=l.useState(""),v=e.length>0;l.useEffect(()=>{C(s=>s!==null&&s>=e.length?null:s)},[e.length]),l.useEffect(()=>{const s=S.current;if(s!==void 0){if(S.current=void 0,s===null){I.current?.focus();return}P.current[s]?.focus()}});const j=l.useRef(void 0);l.useEffect(()=>{const s=d?.caret;if(!s||s===j.current)return;j.current=s;const c=I.current;!c||c.ownerDocument.activeElement!==c||(c.setSelectionRange(s.cursor,s.cursor),d?.onCaretChange(s.cursor))});const w=s=>{d?.onCaretChange(s.selectionStart??s.value.length)},g=l.useCallback(s=>{C(s),S.current=s},[]),T=l.useCallback(s=>{const c=e[s];c&&t&&(g(fe(s,e.length)),O(`${c.label} removed`),t(c.id))},[e,t,g]),B=l.useCallback(()=>{g(null),i()},[i,g]),H=l.useCallback(s=>{const c=s.currentTarget;if(d?.onKeyDown(s))return;const y=le({key:s.key,shiftKey:s.shiftKey,repeat:s.repeat,caretAtStart:c.selectionStart===0&&c.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(y.type){case"focusChip":s.preventDefault(),g(y.index);return;case"clearQuery":A();return;case"blur":c.blur();return;case"none":return}},[e.length,n,A,g,d]),U=l.useCallback(s=>c=>{const y=ue({key:c.key,repeat:c.repeat,index:s,chipCount:e.length});switch(y.type!=="none"&&c.preventDefault(),y.type){case"removeChip":T(y.index);return;case"focusChip":g(y.index);return;case"focusInput":g(null);return;case"activateChip":return;case"none":return}},[e,T,g]);return l.useEffect(()=>{if(!u)return;const s=c=>{c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey||de(c.target)||L("focusSearch")||(c.preventDefault(),I.current?.focus())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[u]),h.jsxs("label",{htmlFor:F,className:E("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",m==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",b),children:[h.jsx(V,{className:E("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[v&&h.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((s,c)=>h.jsx(_,{ref:y=>{P.current[c]=y},label:s.label,tone:s.tone,focused:$===c,onFocusLabel:()=>C(c),onKeyDown:U(c),onRemove:()=>T(c)},s.id))}),h.jsx("input",{ref:I,id:F,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:$===null?0:-1,onChange:s=>{o(s.target.value),w(s.target)},onKeyDown:H,onKeyUp:s=>w(s.currentTarget),onClick:s=>w(s.currentTarget),onFocus:s=>{C(null),d?.onFocusChange?.(!0),w(s.currentTarget)},onBlur:()=>d?.onFocusChange?.(!1),...d?.comboboxProps,placeholder:v?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||v)&&p&&h.jsx("button",{type:"button",onClick:B,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:h.jsx(Q,{className:E("text-fg-muted",m==="lg"?"size-5":"size-4")})}),h.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:q})]})},Ie=({value:e,onChange:t,onClear:n,onClearQuery:o,chips:i,onRemoveChip:r,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m,inputId:f,suggest:d,className:b})=>h.jsx(pe,{value:e,onChange:t,onClear:n,onClearQuery:o,chips:i,onRemoveChip:r,placeholder:a,globalFocusKey:u,showClearButton:p,size:m,inputId:f,suggest:d,className:b});function Ce({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:o=1e3}){const i=l.useRef(e);i.current=e;const r=l.useRef(null),a=l.useRef(null);l.useEffect(()=>{if(!t)return;const u=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},p=f=>{const d=G({key:f.key,shiftKey:f.shiftKey,metaKey:f.metaKey,ctrlKey:f.ctrlKey,altKey:f.altKey,inEditable:X(f.target),onControl:z(f.target)},r.current);if(J().length>0){u(),r.current=null;return}if(u(),r.current=d.nextPrefix,d.nextPrefix!==null&&(a.current=setTimeout(()=>{r.current=null,a.current=null},o)),d.action===null||L(d.action)!==null)return;const b=i.current[d.action];b&&(d.preventDefault&&f.preventDefault(),b())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",p),()=>{m.removeEventListener("keydown",p),u(),r.current=null}},[t,o,n])}function we(){const e=x({from:"/mail/brief/$threadId",shouldThrow:!1}),t=x({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=x({from:"/mail/flagged/$threadId",shouldThrow:!1}),o=x({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),i=x({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=x({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),a=e?.threadId??n?.threadId??i?.threadId,u=t?.messageId??o?.messageId??r?.messageId;return l.useMemo(()=>a?{threadId:a,messageId:u}:void 0,[a,u])}function Se(){const e=N(),t=Y(),{list:n,mailboxId:o}=k();return l.useCallback((i,r)=>{const a=r?.query,p={search:f=>a===void 0?f:{...f,q:a||void 0},hash:t,replace:r?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:i,...p});return}const m=r?.mailboxId??o;if(n==="mailbox"&&m){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:m,...i},...p});return}e({to:"/mail/brief/$threadId/$messageId",params:i,...p})},[e,t,n,o])}function ve(){return W()}function me(){const e=N();return l.useCallback(t=>{e({to:"/mail/brief",search:{q:t||void 0}})},[e])}function Te(){const e=N();return l.useCallback((t,n)=>{e({to:"/mail/$mailboxId",params:{mailboxId:t},search:{q:n||void 0}})},[e])}const he=({accounts:e})=>{const{list:t,mailboxId:n}=k(),{t:o}=Z("mail",{useSuspense:!1}),i=l.useCallback((a,u)=>o(a,{defaultValue:u}),[o]),r=R({queries:e.map(a=>({...M({path:{accountId:a.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let a=0;a<e.length;a++){const u=r[a]?.data?.items;if(!u)continue;const p=u.find(f=>f.mailboxId===n);if(!p)continue;const m=ee(e[a].folderAppointments);return te(p,m.get(n),i)}return null},Ee=({accounts:e})=>{const{mailboxId:t}=k(),n=R({queries:e.map(o=>({...M({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!t)return null;for(const o of n){const i=o.data?.items;if(!i)continue;const r=i.find(a=>a.mailboxId===t);if(r)return r.unseenCount}return null},Ke=({accounts:e})=>{const{mailboxId:t}=k(),n=R({queries:e.map(o=>({...M({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const o of n){const i=o.data?.items;if(!i)continue;const r=i.find(a=>a.mailboxId===t);if(r)return r.messageCount}return 0};function Ne(e){const t=me(),{searchInput:n}=ne(),o=he({accounts:e}),i=k(),r=l.useMemo(()=>oe(i,o),[i,o]),a=l.useCallback(u=>{u===se&&t(n)},[t,n]);return{scope:r,clearScope:a}}function Me(e){const t=new Map;for(const n of e){const o=n.email.toLowerCase(),i=o.split("@")[0];i&&!t.has(i)&&t.set(i,n.accountId),t.has(o)||t.set(o,n.accountId)}return t}function Re(e){const t=new Map;for(const n of e)for(const o of n){const i=o.fullPath?.toLowerCase();if(!i)continue;const r=K(o).toLowerCase();t.has(i)||t.set(i,o.mailboxId),t.has(r)||t.set(r,o.mailboxId)}return t}function Fe(e,t=[]){const n=e.flat().filter(r=>r.fullPath),o=new Map;for(const r of n){const a=K(r).toLowerCase();o.set(a,(o.get(a)??0)+1)}const i=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const a=K(r),u=o.get(a.toLowerCase())===1,p=t.length>1?i.get(r.accountId):void 0;return{value:u?a:r.fullPath,label:r.displayNameOverride?.trim()||a,...p?{hint:p}:{}}})}function Pe(e){const t=new Map;for(const n of e){const o=n.email.toLowerCase().split("@")[0]??"";t.set(o,(t.get(o)??0)+1)}return e.map(n=>{const o=n.email.split("@")[0]??n.email,i=t.get(o.toLowerCase())===1,r=n.displayName?.trim();return{value:i?o:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{ae as K,Ie as S,we as a,Re as b,Ce as c,Me as d,Se as e,ve as f,he as g,Ee as h,Ke as i,re as j,Fe as k,Pe as l,Te as m,xe as n,ce as s,ke as t,Ne as u};
|
|
1
|
+
import{r as l,j as h,bT as V,t as E,cg as _,X as Q,ch as L,ci as G,cj as z,ck as X,cl as J,a9 as x,u as N,cm as Y,cn as k,co as W,ac as Z,K as M,ae as ee,af as te,C as ne,cp as K}from"./index-DJ_qkfvM.js";import{s as oe,S as se}from"./search-scope-B5-OK3Cq.js";import{u as R}from"./useQueries-QS_Quksh.js";const re=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function xe(e){return re.filter(t=>e[t.action]!==void 0)}const ae=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function ie(e){for(const t of ae){const n=t.hints.find(o=>o.action===e);if(n)return n.keys}}function ce(e){const t=ie(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function ke(e){const t=ce(e);return t===""?"":`(${t})`}function le({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:o,hasValue:i,chipCount:r}){const a=r-1;return e==="Escape"?i?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:a}:e==="Backspace"||e==="ArrowLeft"?!o||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:a}:{type:"none"}}function ue({key:e,repeat:t=!1,index:n,chipCount:o}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=o-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function fe(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const de=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,pe=({chips:e=[],onRemoveChip:t,value:n,onChange:o,onClear:i,onClearQuery:r,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m="sm",inputId:f,suggest:d,className:b})=>{const D=l.useId(),F=f??D,I=l.useRef(null),P=l.useRef([]),A=r??i,[$,C]=l.useState(null),S=l.useRef(void 0),[q,O]=l.useState(""),v=e.length>0;l.useEffect(()=>{C(s=>s!==null&&s>=e.length?null:s)},[e.length]),l.useEffect(()=>{const s=S.current;if(s!==void 0){if(S.current=void 0,s===null){I.current?.focus();return}P.current[s]?.focus()}});const j=l.useRef(void 0);l.useEffect(()=>{const s=d?.caret;if(!s||s===j.current)return;j.current=s;const c=I.current;!c||c.ownerDocument.activeElement!==c||(c.setSelectionRange(s.cursor,s.cursor),d?.onCaretChange(s.cursor))});const w=s=>{d?.onCaretChange(s.selectionStart??s.value.length)},g=l.useCallback(s=>{C(s),S.current=s},[]),T=l.useCallback(s=>{const c=e[s];c&&t&&(g(fe(s,e.length)),O(`${c.label} removed`),t(c.id))},[e,t,g]),B=l.useCallback(()=>{g(null),i()},[i,g]),H=l.useCallback(s=>{const c=s.currentTarget;if(d?.onKeyDown(s))return;const y=le({key:s.key,shiftKey:s.shiftKey,repeat:s.repeat,caretAtStart:c.selectionStart===0&&c.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(y.type){case"focusChip":s.preventDefault(),g(y.index);return;case"clearQuery":A();return;case"blur":c.blur();return;case"none":return}},[e.length,n,A,g,d]),U=l.useCallback(s=>c=>{const y=ue({key:c.key,repeat:c.repeat,index:s,chipCount:e.length});switch(y.type!=="none"&&c.preventDefault(),y.type){case"removeChip":T(y.index);return;case"focusChip":g(y.index);return;case"focusInput":g(null);return;case"activateChip":return;case"none":return}},[e,T,g]);return l.useEffect(()=>{if(!u)return;const s=c=>{c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey||de(c.target)||L("focusSearch")||(c.preventDefault(),I.current?.focus())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[u]),h.jsxs("label",{htmlFor:F,className:E("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",m==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",b),children:[h.jsx(V,{className:E("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[v&&h.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((s,c)=>h.jsx(_,{ref:y=>{P.current[c]=y},label:s.label,tone:s.tone,focused:$===c,onFocusLabel:()=>C(c),onKeyDown:U(c),onRemove:()=>T(c)},s.id))}),h.jsx("input",{ref:I,id:F,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:$===null?0:-1,onChange:s=>{o(s.target.value),w(s.target)},onKeyDown:H,onKeyUp:s=>w(s.currentTarget),onClick:s=>w(s.currentTarget),onFocus:s=>{C(null),d?.onFocusChange?.(!0),w(s.currentTarget)},onBlur:()=>d?.onFocusChange?.(!1),...d?.comboboxProps,placeholder:v?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||v)&&p&&h.jsx("button",{type:"button",onClick:B,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:h.jsx(Q,{className:E("text-fg-muted",m==="lg"?"size-5":"size-4")})}),h.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:q})]})},Ie=({value:e,onChange:t,onClear:n,onClearQuery:o,chips:i,onRemoveChip:r,placeholder:a="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m,inputId:f,suggest:d,className:b})=>h.jsx(pe,{value:e,onChange:t,onClear:n,onClearQuery:o,chips:i,onRemoveChip:r,placeholder:a,globalFocusKey:u,showClearButton:p,size:m,inputId:f,suggest:d,className:b});function Ce({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:o=1e3}){const i=l.useRef(e);i.current=e;const r=l.useRef(null),a=l.useRef(null);l.useEffect(()=>{if(!t)return;const u=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},p=f=>{const d=G({key:f.key,shiftKey:f.shiftKey,metaKey:f.metaKey,ctrlKey:f.ctrlKey,altKey:f.altKey,inEditable:X(f.target),onControl:z(f.target)},r.current);if(J().length>0){u(),r.current=null;return}if(u(),r.current=d.nextPrefix,d.nextPrefix!==null&&(a.current=setTimeout(()=>{r.current=null,a.current=null},o)),d.action===null||L(d.action)!==null)return;const b=i.current[d.action];b&&(d.preventDefault&&f.preventDefault(),b())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",p),()=>{m.removeEventListener("keydown",p),u(),r.current=null}},[t,o,n])}function we(){const e=x({from:"/mail/brief/$threadId",shouldThrow:!1}),t=x({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=x({from:"/mail/flagged/$threadId",shouldThrow:!1}),o=x({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),i=x({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=x({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),a=e?.threadId??n?.threadId??i?.threadId,u=t?.messageId??o?.messageId??r?.messageId;return l.useMemo(()=>a?{threadId:a,messageId:u}:void 0,[a,u])}function Se(){const e=N(),t=Y(),{list:n,mailboxId:o}=k();return l.useCallback((i,r)=>{const a=r?.query,p={search:f=>a===void 0?f:{...f,q:a||void 0},hash:t,replace:r?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:i,...p});return}const m=r?.mailboxId??o;if(n==="mailbox"&&m){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:m,...i},...p});return}e({to:"/mail/brief/$threadId/$messageId",params:i,...p})},[e,t,n,o])}function ve(){return W()}function me(){const e=N();return l.useCallback(t=>{e({to:"/mail/brief",search:{q:t||void 0}})},[e])}function Te(){const e=N();return l.useCallback((t,n)=>{e({to:"/mail/$mailboxId",params:{mailboxId:t},search:{q:n||void 0}})},[e])}const he=({accounts:e})=>{const{list:t,mailboxId:n}=k(),{t:o}=Z("mail",{useSuspense:!1}),i=l.useCallback((a,u)=>o(a,{defaultValue:u}),[o]),r=R({queries:e.map(a=>({...M({path:{accountId:a.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let a=0;a<e.length;a++){const u=r[a]?.data?.items;if(!u)continue;const p=u.find(f=>f.mailboxId===n);if(!p)continue;const m=ee(e[a].folderAppointments);return te(p,m.get(n),i)}return null},Ee=({accounts:e})=>{const{mailboxId:t}=k(),n=R({queries:e.map(o=>({...M({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!t)return null;for(const o of n){const i=o.data?.items;if(!i)continue;const r=i.find(a=>a.mailboxId===t);if(r)return r.unseenCount}return null},Ke=({accounts:e})=>{const{mailboxId:t}=k(),n=R({queries:e.map(o=>({...M({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const o of n){const i=o.data?.items;if(!i)continue;const r=i.find(a=>a.mailboxId===t);if(r)return r.messageCount}return 0};function Ne(e){const t=me(),{searchInput:n}=ne(),o=he({accounts:e}),i=k(),r=l.useMemo(()=>oe(i,o),[i,o]),a=l.useCallback(u=>{u===se&&t(n)},[t,n]);return{scope:r,clearScope:a}}function Me(e){const t=new Map;for(const n of e){const o=n.email.toLowerCase(),i=o.split("@")[0];i&&!t.has(i)&&t.set(i,n.accountId),t.has(o)||t.set(o,n.accountId)}return t}function Re(e){const t=new Map;for(const n of e)for(const o of n){const i=o.fullPath?.toLowerCase();if(!i)continue;const r=K(o).toLowerCase();t.has(i)||t.set(i,o.mailboxId),t.has(r)||t.set(r,o.mailboxId)}return t}function Fe(e,t=[]){const n=e.flat().filter(r=>r.fullPath),o=new Map;for(const r of n){const a=K(r).toLowerCase();o.set(a,(o.get(a)??0)+1)}const i=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const a=K(r),u=o.get(a.toLowerCase())===1,p=t.length>1?i.get(r.accountId):void 0;return{value:u?a:r.fullPath,label:r.displayNameOverride?.trim()||a,...p?{hint:p}:{}}})}function Pe(e){const t=new Map;for(const n of e){const o=n.email.toLowerCase().split("@")[0]??"";t.set(o,(t.get(o)??0)+1)}return e.map(n=>{const o=n.email.split("@")[0]??n.email,i=t.get(o.toLowerCase())===1,r=n.displayName?.trim();return{value:i?o:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{ae as K,Ie as S,we as a,Re as b,Ce as c,Me as d,Se as e,ve as f,he as g,Ee as h,Ke as i,re as j,Fe as k,Pe as l,Te as m,xe as n,ce as s,ke as t,Ne as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,r as s}from"./index-
|
|
1
|
+
import{u as e,r as s}from"./index-DJ_qkfvM.js";const a={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts",importConfig:"/import"};function c(){const t=e();return s.useCallback(o=>{t({to:a[o]})},[t])}function i(){const t=e();return s.useCallback(o=>{t({to:"/settings/accounts",search:{editAccountId:o,focusSmtp:!0}})},[t])}export{i as a,c as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,t as S,h as I,r as c,bQ as A,c as C,i as k,bR as P,bS as L,f as N,X as T,u as O,aL as $,az as R,bT as q,aN as M,bU as Q,bV as D,Z as G}from"./index-
|
|
1
|
+
import{j as e,t as S,h as I,r as c,bQ as A,c as C,i as k,bR as P,bS as L,f as N,X as T,u as O,aL as $,az as R,bT as q,aN as M,bU as Q,bV as D,Z as G}from"./index-DJ_qkfvM.js";import{K as f}from"./kbd-DeTBGQqu.js";import{a as E,S as K}from"./settings-screen-DNRg9rAy.js";import{E as V}from"./ErrorState-BCYXDXXn.js";import{u as _}from"./useDebouncedValue-CJbuyk4u.js";import{s as B}from"./help-copy-DbMRDCV3.js";import"./avatar-UUVjuy7o.js";import"./chevron-left-BFzz3Ieb.js";import"./menu-B2D2SRp4.js";import"./circle-help-B6swOKgu.js";function F({options:t,active:r,onSelect:m}){return e.jsx("div",{role:"tablist",className:S("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(n=>{const d=n.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(n.id),className:S("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:n.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:n.count??"—"})]},n.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function H({query:t,onCount:r}){const{data:m,isPending:n,isError:d,error:b}=C(Q()),g=I(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:D()})}}),l=m?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(a=>(a.displayName??"").toLowerCase().includes(p)||a.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),n?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:b})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(f,{children:"v"})," on any message to promote a sender to VIP."]}):u.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),u.map(a=>e.jsx(E,{name:a.displayName??a.normalizedEmail,email:a.normalizedEmail,meta:a.replyCount>0?`${a.inboundCount} received · you replied ${a.replyCount}×`:`${a.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(G,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:a.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},a.addressId))]})}function U({group:t,query:r,onCount:m}){const n=_(r.trim(),300),d=I(),[b,g]=c.useState(null),i=n.length>=2,l=A({query:{q:n,limit:50}}),{data:p,isPending:u,isError:a,error:j}=C({...l,enabled:i}),x=k({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),h=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{m?.(i?h.length:0,null)},[m,i,h.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):a?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):h.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",n,"”."]}):e.jsx(e.Fragment,{children:h.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&L(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=x.isPending&&x.variables?.path.addressId===s.addressId,z=x.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:{value:!1,setAt:Date.now()}}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(T,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:{value:!1,setAt:Date.now()}}}}))}})},s.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",v[t].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(f,{children:"m"})," on any message to mute its sender; ",e.jsx(f,{children:"b"})," to block."]})]})}function re(){const t=O(),[r,m]=c.useState("vip"),[n,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),a=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),x=p[r],h=s=>{const o=M[s];o&&t({to:o})};return e.jsx(K,{items:$,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:B,helpOpen:b,onToggleHelp:()=>g(s=>!s),onSelect:h,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(F,{active:r,onSelect:s=>{m(s),d("")},options:["vip","muted","blocked"].map(s=>({id:s,label:v[s],count:p[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(R,{icon:e.jsx(q,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:n,onChange:s=>d(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:r==="vip"?e.jsx(H,{query:n,onCount:a}):e.jsx(U,{group:r,query:n,onCount:j})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:x!=null?`${i} of ${x} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(f,{children:"j"})," ",e.jsx(f,{children:"k"})," navigate · ",e.jsx(f,{children:"⌫"})," remove flag"]})]})]})]})})}export{U as SearchGroupPane,re as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,O as o}from"./index-DJ_qkfvM.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as j,j as e,t as f,f as i,X as N,g as z}from"./index-
|
|
1
|
+
import{r as j,j as e,t as f,f as i,X as N,g as z}from"./index-DJ_qkfvM.js";import{A as w}from"./avatar-UUVjuy7o.js";import{C as h}from"./chevron-left-BFzz3Ieb.js";import{M as S}from"./menu-B2D2SRp4.js";import{C as v}from"./circle-help-B6swOKgu.js";function R({items:l,activeId:t,title:x,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:u,onBackToMail:m}){const[y,c]=j.useState(!1),[b,C]=j.useState(!1),p=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),c(!1)},className:f("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:f("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"safe-area-frame flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:m,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),g]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>c(!1)}),e.jsxs("aside",{className:"safe-area-frame relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{m?.(),c(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),onClick:()=>c(!1),"aria-label":"Close menu"})]}),g]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[m&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(h,{className:"size-4"}),className:"-ml-1 lg:hidden",onClick:m,"aria-label":"Back to mail"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(S,{className:"size-4"}),className:"lg:hidden",onClick:()=>c(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:x}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":b}),s&&!p&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&b&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),p&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function L({name:l,email:t,meta:x,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:f(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[x,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const O={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function X({label:l,email:t,connector:x,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=O[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(z,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",x," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{X as A,R as S,L as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./index-
|
|
1
|
+
import{e}from"./index-DJ_qkfvM.js";const d=e("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);const h=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{d as C,h as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,an as e}from"./index-
|
|
1
|
+
import{j as t,an as e}from"./index-DJ_qkfvM.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as C}from"./index-DJ_qkfvM.js";import{E as g,x as m,K as I}from"./calendar-format-Da1fNx_F.js";import{u as p,i as v,t as D,U as E,r as y}from"./useCalendars-os-DtAnP.js";function L(a,e){const r=a.map(n=>n.id);if(e.length===0)return r;const t=new Set(e),s=r.filter(n=>t.has(n));return s.length===0?r:s}function x(a){const{calendars:e,colorByCalendarId:r,timeZoneByCalendarId:t,isLoading:s}=p(),n=L(e,a),o=n.length===e.length?[]:n,c=a.length===0||e.length>0;return{calendars:e,colorByCalendarId:r,timeZoneByCalendarId:t,shown:n,narrowed:o,resolved:c,isLoading:s}}function A(a,e,r){const t=r.join(",");return C.useMemo(()=>{const s=new Set(t===""?[]:t.split(","));return a.filter(n=>v(n)&&s.has(n.calendarId)).map(n=>D(n,e[n.calendarId]??E))},[a,e,t])}function W({view:a,date:e,calendarIds:r,enabled:t=!0}){const{calendars:s,colorByCalendarId:n,timeZoneByCalendarId:o,shown:c,narrowed:l,resolved:u,isLoading:w}=x(r),h=g(a,e),i=t&&u,d=m({...h,calendarIds:l,enabled:i});I(a,e,l,i);const f=A(d.instances,o,c);return{calendars:s,events:f,colorByCalendarId:n,timeZoneByCalendarId:o,isLoading:w||d.isLoading,error:d.error,retry:d.refetch,instanceOf:y}}export{A as a,W as b,x as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as C,r,i as c,
|
|
1
|
+
import{h as C,r,i as c,eP as h,eQ as f,eR as y,s as g,b3 as m}from"./index-DJ_qkfvM.js";import{f as I}from"./ErrorState-BCYXDXXn.js";const o=g(400,404,412),b=new Set(["calendarEventOperationsListCalendarEvents","calendarEventDetailOperationsGetCalendarEvent","calendarFreeBusyOperationsListCalendarFreeBusy"]),d={kind:"written"},i=e=>m(e)===412?{kind:"conflict"}:{kind:"refused",message:I(e)},O={this:"This",following:"Following",all:"All"};function A(){const e=C();return r.useCallback(()=>{e.invalidateQueries({predicate:t=>{const n=t.queryKey[0];if(typeof n!="object"||n===null)return!1;const s=n._id;return typeof s=="string"&&b.has(s)}})},[e])}const p=({scope:e,recurrenceId:t})=>e===void 0?{}:{scope:O[e],recurrenceId:t};function P(){const e=A(),t=c({...h(),meta:o,onSuccess:e}),n=c({...f(),meta:o,onSuccess:e}),s=c({...y(),meta:o,onSuccess:e}),l=r.useCallback(a=>t.mutateAsync({body:a}).then(()=>d).catch(i),[t]),u=r.useCallback((a,v)=>n.mutateAsync({path:{calendarObjectId:a.calendarObjectId},query:{calendarId:a.calendarId,...p(a)},headers:{"If-Match":a.etag},body:v}).then(()=>d).catch(i),[n]),E=r.useCallback(a=>s.mutateAsync({path:{calendarObjectId:a.calendarObjectId},query:{calendarId:a.calendarId,...p(a)},headers:{"If-Match":a.etag}}).then(()=>d).catch(i),[s]);return r.useMemo(()=>({createEvent:l,updateEvent:u,deleteEvent:E,isWriting:t.isPending||n.isPending||s.isPending}),[l,u,E,t.isPending,n.isPending,s.isPending])}export{P as a,A as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as l,eB as s,r as d}from"./index-DJ_qkfvM.js";const p=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,f="",i={Cal1:"cal-1",Cal2:"cal-2",Cal3:"cal-3",Cal4:"cal-4",Cal5:"cal-5",Cal6:"cal-6"},u={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},o="#";function m(e,a){return a===""?e:`${e}${o}${a}`}function O(e){const a=e.indexOf(o);return a===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,a),recurrenceId:e.slice(a+1)}}function C(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:i[e.color]??"cal-1"}}function E(e,a){return{id:m(e.calendarObjectId,e.recurrenceId),calendarId:e.calendarId,title:e.summary,start:e.start,end:e.end,allDay:e.allDay,location:"",notes:"",attendees:[],myRsvp:"accepted",threadId:"",threadSubject:"",timeZone:a,zoneCertainty:u[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const R=e=>e.status!=="Cancelled";function y(){const{data:e,isLoading:a,error:c}=l(s());return d.useMemo(()=>{const r=e?.items??[],n=r.map(C);return{calendars:n,colorByCalendarId:Object.fromEntries(n.map(t=>[t.id,t.color])),timeZoneByCalendarId:Object.fromEntries(r.map(t=>[t.calendarId,t.timezone])),defaultCalendarId:(r.find(t=>t.source==="Default")??r[0])?.calendarId??"",isLoading:a,error:c??null}},[e,a,c])}export{f as U,m as c,p as d,R as i,O as r,E as t,y as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o}from"./index-
|
|
1
|
+
import{r as o}from"./index-DJ_qkfvM.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,i as b,
|
|
1
|
+
import{r as p,i as b,eC as I,c as C,eD as x,dZ as F,eE as D,h as y,eF as N,eG as P,eH as L,eI as z}from"./index-DJ_qkfvM.js";const B=(e,t)=>{if(e.state==="Expired")return"Expired";if(e.scope!=="Temporary"||!e.expiresAt)return"Active";const r=Date.parse(e.expiresAt);return Number.isNaN(r)?"Active":r<=t?"Expired":"Active"},K=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},M=(e,t=new Date)=>{if(!e)return;const r=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!r)return;const[,a,i,n]=r,s=new Date(Number(a),Number(i)-1,Number(n),23,59,59,0);if(Number.isNaN(s.getTime()))return;const o=-t.getTimezoneOffset(),d=o>=0?"+":"-",l=Math.abs(o),c=String(Math.floor(l/60)).padStart(2,"0"),f=String(l%60).padStart(2,"0"),u=m=>String(m).padStart(2,"0");return`${s.getFullYear()}-${u(s.getMonth()+1)}-${u(s.getDate())}T${u(s.getHours())}:${u(s.getMinutes())}:${u(s.getSeconds())}${d}${c}:${f}`},h="None",G=e=>!e.literalClauses.some(t=>t.field==="HasWords"),O=e=>({...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h}),V=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",X=({mode:e,ruleScope:t,anchorMessageId:r,clauses:a,matchOperator:i,moveMailboxId:n,until:s})=>({...e==="similar"&&r?{anchorMessageId:r}:{},matchOperator:i==="all"?"And":"Or",literalClauses:a.map(o=>({field:o.field,value:o.value})),moveMailboxId:n,expiresAt:t==="until"?M(s??""):void 0}),S=(e,t,r)=>({name:r,scope:t==="standing"?"Standing":"Temporary",...t==="temporary"&&e.expiresAt?{expiresAt:e.expiresAt}:{},matchOperator:e.matchOperator,literalClauses:e.literalClauses,actionLabelId:e.labelId??h,actionMailboxId:e.moveMailboxId??h,...e.anchorMessageId?{anchorMessageId:e.anchorMessageId}:{}}),T=new Set(["Complete","Failed"]),v=e=>e!==void 0&&T.has(e),w=1e3,J=15e3,_=e=>{const t=Math.max(0,e),r=w*2**t;return Math.min(r,J)},$=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},Y=e=>{const[t,r]=p.useState(),a=b({...I(),onSuccess:g=>r(g.organizeJobId)}),{mutate:i}=a,n=C({...x({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const E=g.state.data?.state;return v(E)?!1:_(g.state.dataUpdateCount)}}),s=p.useCallback(g=>{e&&i({path:{accountId:e},body:O(g)})},[e,i]),{refetch:o}=n,d=p.useCallback(()=>{o()},[o]),l=n.data,c=a.isPending?void 0:l,f=c?.state??a.data?.state,u=v(c?.state),m={state:f,matchedCount:c?.matchedCount??0,appliedCount:c?.appliedCount??0,failedCount:c?.failedCount??0,errorMessage:c?.errorMessage??""};return{start:s,refreshStatus:d,progress:m,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:$(a.error,n.error,!!l)}},Z=["From","Subject","HasWords","ListId","FromDomain"],k=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ee=(e,t)=>e==="ListId"?k(t):t.trim(),R=e=>e==="all"?"And":"Or",U=(e,t)=>{const r=e.widen!==void 0&&!e.widen.inactive,a=e.clauses.map(i=>({field:i.field,value:i.value}));return{...r&&t?{anchorMessageId:t}:{},matchOperator:R(e.matchOperator),literalClauses:a}},H=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),Q=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),te=(e,t)=>{const r=U(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?M(e.until??""):void 0}},j=(e,t)=>{if(e.error!==void 0&&e.errorSignature===t)return{status:"error",reason:e.error};if(e.count===void 0)return{status:"loading"};const r=e.indexEmpty===!0?{indexEmpty:!0}:{};return e.previewedSignature===t?{status:"ready",count:e.count,...r}:{status:"ready",count:e.count,stale:!0,...r}},q=350,re=(e,t,r)=>{const a=b(F()),{mutateAsync:i}=a,n=Q(t),[s,o]=p.useState(()=>({})),d=p.useRef(t);d.current=t;const l=p.useRef(n),c=H(t);return p.useEffect(()=>{if(!e||!c||n===s.previewedSignature||n===s.errorSignature)return;const f=setTimeout(()=>{const u=n;l.current=u,i({path:{accountId:e},body:O({...d.current})}).then(m=>{l.current===u&&o({count:m.matchedCount,matchedIds:m.messageIds,indexEmpty:m.semanticIndexEmpty===!0,previewedSignature:u})}).catch(m=>{l.current===u&&o(g=>({...g,error:m instanceof Error?m.message:"Couldn't count matches.",errorSignature:u}))})},q);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:j(s,n),matchedIds:s.previewedSignature===n?s.matchedIds??[]:[]}:{count:{status:"error",reason:D},matchedIds:[]}},A=e=>P({path:{accountId:e}}),se=e=>{const t=C({...L({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},ae=e=>{const t=y(),r=b({...N(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a,mutateAsync:i}=r,n=p.useCallback((o,d,l)=>{e&&a({path:{accountId:e},body:S(o,d,l)})},[e,a]),s=p.useCallback(async(o,d,l)=>e?i({path:{accountId:e},body:S(o,d,l)}).then(()=>!0,()=>!1):!1,[e,i]);return{createFilter:n,createFilterAsync:s,isPending:r.isPending,isSuccess:r.isSuccess,isError:r.isError,error:r.error,reset:r.reset}},ne=e=>{const t=y(),r=b({...z(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a}=r;return{deleteFilter:p.useCallback(n=>{e&&a({path:{accountId:e,filterId:n}})},[e,a]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}};export{h as N,Z as S,Y as a,A as b,te as c,K as d,se as e,B as f,ne as g,O as h,ae as i,X as j,G as k,ee as n,V as o,M as p,U as r,re as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as p,
|
|
1
|
+
import{c as p,em as L,h as n,i as l,en as d,r as o,eo as y,ep as c,eq as g}from"./index-DJ_qkfvM.js";const u=e=>y({path:{accountId:e}}),P=e=>{const r=p({...L({path:{accountId:e??""}}),enabled:!!e});return{labels:r.data?.items??[],isPending:r.isPending,isError:r.isError,error:r.error,refetch:r.refetch}},f=e=>{const r=n(),t=l({...d(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:s}=t;return{createLabel:o.useCallback((a,i="Default")=>e?s({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,s]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},h=e=>{const r=n(),t=l({...c(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{updateLabel:o.useCallback((a,i)=>{e&&s({path:{accountId:e,labelId:a},body:i})},[e,s]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const r=n(),t=l({...g(),onSuccess:()=>{e&&r.invalidateQueries({queryKey:u(e)})}}),{mutate:s}=t;return{deleteLabel:o.useCallback(a=>{e&&s({path:{accountId:e,labelId:a}})},[e,s]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{P as a,h as b,C as c,f as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c0 as s,c1 as e}from"./index-DJ_qkfvM.js";const i=768,r=t=>t!=="desktop",a=()=>{const t=s(`(min-width: ${i}px)`);return s(e)?"desktop":t?"tablet":"phone"};export{r as i,a as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,u as S,
|
|
1
|
+
import{r as c,u as S,cm as O,cn as B,a9 as h,co as N,q as P,ab as U,h as $,c as D,cJ as F,cK as v}from"./index-DJ_qkfvM.js";const R="/mail/brief/compose/{-$outboxMessageId}",w="/mail/flagged/compose/{-$outboxMessageId}",E="/mail/outbox/compose/{-$outboxMessageId}",k="/mail/$mailboxId/compose/{-$outboxMessageId}";function T(){const e=h({from:R,shouldThrow:!1}),t=h({from:w,shouldThrow:!1}),r=h({from:E,shouldThrow:!1}),s=h({from:k,shouldThrow:!1});return e??t??r??s}function J(){return T()!==void 0}function Y(){return T()?.outboxMessageId}function L(e,t,r){return e==="flagged"?{to:w,params:{outboxMessageId:r}}:e==="outbox"?{to:E,params:{outboxMessageId:r}}:e==="mailbox"&&t?{to:k,params:{mailboxId:t,outboxMessageId:r}}:{to:R,params:{outboxMessageId:r}}}function g(){const e=S(),t=O(),{list:r,mailboxId:s}=B();return c.useCallback((n,o)=>{e({...L(r,s,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,r,s])}function j(){const e=g();return c.useCallback(()=>e(void 0),[e])}function V(){const e=g();return c.useCallback(t=>e(t),[e])}function Z(){const e=g();return c.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function ee(){return N()}const _=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),r=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(r)return{kind:"html",contentUrl:r.contentUrl};const s=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return s?{kind:"text",contentUrl:s.contentUrl}:null},b={all:["messages"],detail:e=>[...b.all,"detail",e],body:e=>[...b.detail(e),"body"]};class f extends Error{reason;status;retryAfterSeconds;constructor(t,r,s,n){super(r),this.name="BodyFetchError",this.reason=t,this.status=s,this.retryAfterSeconds=n}}const K=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},q=8,Q="x-remit-403-reason",I=(e,t)=>{const r=t?.trim()??"";return e===401?"auth":e===403?r.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},X=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,G=(e,t)=>{const r=(t??"").toLowerCase();return!!(e==="text"&&r.startsWith("text/html"))},H=async(e,t,r=async()=>null)=>{const s={},n=await r();n&&(s.Authorization=`Bearer ${n}`);const o=await v(e,{headers:s});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,K(o.headers.get("Retry-After")));if(!o.ok){const l=o.headers.get(Q),y=I(o.status,l);throw new f(y,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(G(t,a))throw new f("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const m=await o.text();if(X(m,a))throw new f("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return m},W=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),te=({messageId:e,bodyParts:t,enabled:r=!0})=>{const s=t?_(t):null,n=P(),{getToken:o}=U(),a=c.useRef(null),m=$(),l=c.useRef(!1),y=c.useRef(null),C=e&&s?`${e}:${s.contentUrl}`:null;y.current!==C&&(y.current=C,l.current=!1);const i=D({queryKey:e?[...b.body(e),s?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!s)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const d=l.current;return l.current=!1,W({fetchContent:(u,M)=>H(u,M,o),refetchDescribeMessage:()=>m.refetchQueries({queryKey:F({path:{messageId:e}})})},{contentUrl:s.contentUrl,kind:s.kind,isRetryAfterNotReady:d})},enabled:r&&!!e&&!!s,staleTime:300*1e3,gcTime:1800*1e3,retry:(d,u)=>u instanceof f&&u.reason==="not-ready"?d<q:d<1,retryDelay:(d,u)=>u instanceof f&&u.reason==="not-ready"?(l.current=!0,(u.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),p=i.isLoading&&!!s,x=t!==void 0&&s===null;c.useEffect(()=>{p&&(a.current=performance.now())},[p]),c.useEffect(()=>{i.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[i.isSuccess,n]);const A=i.data&&s?{kind:s.kind,body:i.data}:void 0;return{picked:s,data:A,isLoading:p,hasNoRenderablePart:x,isError:i.isError,error:i.error,refetch:i.refetch}};export{f as B,J as a,te as b,Y as c,Z as d,ee as e,V as f,I as g,j as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c2 as Q,c3 as y,c4 as S,c5 as w,c6 as C,h as k,c7 as q,c8 as x,r as p,c9 as M,ca as H,cb as L,cc as P,cd as O,ce as B,cf as A}from"./index-DJ_qkfvM.js";function R(r,e){const s=new Set(e);return r.filter(t=>!s.has(t))}function T(r,e,s){const t=r.slice(0);return t[e]=s,t}var z=class extends Q{#i;#e;#n;#r;#s;#t;#o;#u;#h;#c=[];constructor(r,e,s){super(),this.#i=r,this.#r=s,this.#n=[],this.#s=[],this.#e=[],this.setQueries(e)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(r=>{r.subscribe(e=>{this.#d(r,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(r=>{r.destroy()})}setQueries(r,e){this.#n=r,this.#r=e,y.batch(()=>{const s=this.#s,t=this.#f(this.#n);t.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const i=t.map(o=>o.observer),n=i.map(o=>o.getCurrentResult()),u=s.length!==i.length,a=i.some((o,d)=>o!==s[d]),f=u||a,b=f?!0:n.some((o,d)=>{const g=this.#e[d];return!g||!S(o,g)});!f&&!b||(f&&(this.#c=t,this.#s=i),this.#e=n,this.hasListeners()&&(f&&(R(s,i).forEach(o=>{o.destroy()}),R(i,s).forEach(o=>{o.subscribe(d=>{this.#d(o,d)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(r=>r.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(r,e){const s=this.#f(r),t=s.map(n=>n.observer.getOptimisticResult(n.defaultedQueryOptions)),i=s.map(n=>n.defaultedQueryOptions.queryHash);return[t,n=>this.#l(n??t,e,i),()=>this.#a(t,s)]}#a(r,e){return e.map((s,t)=>{const i=r[t];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,n=>{e.forEach(u=>{u.observer.trackProp(n)})})})}#l(r,e,s){if(e){const t=this.#h,i=s!==void 0&&t!==void 0&&(t.length!==s.length||s.some((n,u)=>n!==t[u]));return(!this.#t||this.#e!==this.#u||i||e!==this.#o)&&(this.#o=e,this.#u=this.#e,s!==void 0&&(this.#h=s),this.#t=w(this.#t,e(r))),this.#t}return r}#b(){return this.#r?.combine!==void 0&&this.#s.some((r,e)=>r.options.suspense&&this.#e[e]?.data===void 0)}#f(r){const e=new Map;this.#s.forEach(t=>{const i=t.options.queryHash;if(!i)return;const n=e.get(i);n?n.push(t):e.set(i,[t])});const s=[];return r.forEach(t=>{const i=this.#i.defaultQueryOptions(t),u=e.get(i.queryHash)?.shift()??new C(this.#i,i);s.push({defaultedQueryOptions:i,observer:u})}),s}#d(r,e){const s=this.#s.indexOf(r);s!==-1&&(this.#e=T(this.#e,s,e),this.#p())}#p(){if(this.hasListeners()){const r=this.#a(this.#e,this.#c),e=this.#b(),s=this.#t,t=e?s:this.#l(r,this.#r?.combine);(e||s!==t)&&y.batch(()=>{this.listeners.forEach(i=>{i(this.#e)})})}}};function U({queries:r,...e},s){const t=k(),i=q(),n=x(),u=p.useMemo(()=>r.map(h=>{const c=t.defaultQueryOptions(h);return c._optimisticResults=i?"isRestoring":"optimistic",c}),[r,t,i]);u.forEach(h=>{M(h);const c=t.getQueryCache().get(h.queryHash);H(h,n,c)}),L(n);const[a]=p.useState(()=>new z(t,u,e)),[f,b,o]=a.getOptimisticResult(u,e.combine),d=!i&&e.subscribed!==!1;p.useSyncExternalStore(p.useCallback(h=>d?a.subscribe(y.batchCalls(h)):P,[a,d]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),p.useEffect(()=>{a.setQueries(u,e)},[u,e,a]);const m=f.some((h,c)=>O(u[c],h))?f.flatMap((h,c)=>{const l=u[c];if(l&&O(l,h)){const E=new C(t,l);return B(l,E,n)}return[]}):[];if(m.length>0)throw Promise.all(m);const v=f.find((h,c)=>{const l=u[c];return l&&A({result:h,errorResetBoundary:n,throwOnError:l.throwOnError,query:t.getQueryCache().get(l.queryHash),suspense:l.suspense})});if(v?.error)throw v.error;return b(o())}export{U as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as E,a0 as K,t as Q,f as U,r as o,aP as R,h as T,C as $,E as z,F as B,q as G,P as I,Q as X,R as V,S as J}from"./index-
|
|
1
|
+
import{j as E,a0 as K,t as Q,f as U,r as o,aP as R,h as T,C as $,E as z,F as B,q as G,P as I,Q as X,R as V,S as J}from"./index-DJ_qkfvM.js";import{C as Y}from"./circle-check-big-C9itbVkv.js";import{R as Z}from"./refresh-cw-B6fDl1YI.js";import{u as N}from"./useQueries-QS_Quksh.js";function ye({state:e,onRefresh:s,label:t,errorMessage:n,hasUpdate:a,size:u="sm",className:c}){const i=e==="refreshing",r=e==="error",h=e==="success",S=r?E.jsx(K,{className:"size-4 text-danger"}):h?E.jsx(Y,{className:"size-4 text-positive"}):E.jsx(Z,{className:Q("size-4",i&&"animate-spin")}),w=r?`${t} — failed: ${n??"try again"}`:i?`${t} — refreshing`:h?`${t} — up to date`:a?`${t} — new mail`:t;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx(U,{variant:"ghost",size:u,icon:S,onClick:s,disabled:i,"aria-label":w,"aria-busy":i||void 0,title:r?n:t,className:c}),e==="idle"&&a&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const ee=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function L(e){return!!e&&ee.has(e)}const F=3e3,te=F*2,C={syncing:!1,resolved:!1,synced:0,total:0};function we(e,s){const t=e.join(","),[n,a]=o.useState(!1),[u,c]=o.useState(!1);o.useEffect(()=>{a(!1),c(!1)},[t,s]),o.useEffect(()=>{if(!s)return;const m=setTimeout(()=>c(!0),te);return()=>clearTimeout(m)},[t,s]);const i=N({queries:e.map(m=>({...R({path:{accountId:m}}),enabled:s&&!n,refetchInterval:F,meta:{softError:!0}}))}),r=i.every(m=>m.isSuccess||m.isError),h=i.length===0||r||u;let S=!1,w=0,y=0;for(const m of i)if(L(m.data?.syncPhase)){S=!0;for(const l of m.data?.mailboxes??[])w+=l.messagesSynced,y+=l.messagesTotal}const x=s&&h&&!S;return o.useEffect(()=>{x&&a(!0)},[x]),!s||!h?C:{syncing:S,resolved:!0,synced:w,total:y}}const se=180*1e3,xe=30*1e3;let q=0;const M=new Set,re=(e=Date.now())=>{q=e+se;for(const s of M)s()},pe=(e=Date.now())=>e<q,Ee=e=>(M.add(e),()=>{M.delete(e)}),_=6e4,ne=new Set(["sent","drafts","trash","archive"]),O=(e,s)=>{const t=new Map;for(const n of e){const a=s.get(n.mailboxId)?.role;a&&ne.has(a)||t.set(n.mailboxId,n.highWaterMarkUid)}return t},j=(e,s)=>{const t=[];for(const[n,a]of s)a>(e.get(n)??0)&&t.push(n);return t},oe=(e,s)=>j(e,s).length>0,D=o.createContext(null),ae=()=>{const e=o.useContext(D);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function be({accountIds:e,children:s}){const t=T(),{resultFolderIndex:n}=$(),a=o.useRef(new Map),u=o.useRef(new Set),c=o.useRef(new Map),[i,r]=o.useState(new Set),h=N({queries:e.map(l=>({...R({path:{accountId:l}}),refetchInterval:_,staleTime:_,meta:{softError:!0}}))}),S=h.map(l=>l.dataUpdatedAt).join(","),w=e.join(",");o.useEffect(()=>{let l=!1;const f=new Set(i);e.forEach((d,p)=>{const b=h[p]?.data;if(!b)return;const g=O(b.mailboxes??[],n),v=c.current.get(d);if(c.current.set(d,g),v){const A=j(v,g);A.length>0&&z(t,B(A))}if(!u.current.has(d)){u.current.add(d),a.current.set(d,g);return}if(f.has(d))return;const W=a.current.get(d)??new Map;oe(W,g)&&(f.add(d),l=!0)}),l&&r(f)},[w,S]);const y=o.useCallback(l=>l.some(f=>i.has(f)),[i]),x=o.useCallback(l=>{r(f=>{if(l.every(p=>!f.has(p)))return f;const d=new Set(f);for(const p of l)d.delete(p);return d});for(const f of l){const d=t.getQueryData(R({path:{accountId:f}}).queryKey);a.current.set(f,O(d?.mailboxes??[],n)),u.current.add(f)}},[t,n]),m=o.useMemo(()=>({hasNewMail:y,acknowledge:x}),[y,x]);return E.jsx(D.Provider,{value:m,children:s})}const ie=2e3,ce=45e3,ue=e=>new Promise(s=>setTimeout(s,e)),k=e=>e instanceof Error&&e.message?e.message:"Something went wrong",le=e=>{V(e,{softError:!0},"user")&&J(e)},P=(e,s)=>e.fetchQuery({...R({path:{accountId:s}}),staleTime:0}),H=e=>e.mailboxes?.find(s=>s.fullPath?.toUpperCase()==="INBOX")?.lastSyncedAt??0,fe=async({accountId:e,readStatus:s,baselineLastSyncAt:t,baselineInboxSyncedAt:n=0,onInboxSynced:a,deadline:u,pollMs:c=ie})=>{let i=!1;for(;;){const r=await s().then(y=>({ok:!0,data:y})).catch(y=>({ok:!1,error:y}));if(!r.ok)return{accountId:e,message:k(r.error)};const{syncPhase:h,lastSyncAt:S}=r.data;if((S??0)>t&&!L(h))return h==="error"?{accountId:e,message:"Sync failed for this account"}:void 0;if(!i&&H(r.data)>n&&(i=!0,a?.()),Date.now()>=u)return{accountId:e,message:"Refresh is taking longer than usual"};await ue(c)}},de=async(e,s,t,n,a)=>{const u=await P(e,t).then(r=>({ok:!0,lastSyncAt:r.lastSyncAt??0,inboxSyncedAt:H(r)})).catch(r=>({ok:!1,error:r}));if(!u.ok)return{accountId:t,enqueued:!1,ok:!1,message:k(u.error)};const c=await I({path:{accountId:t},throwOnError:!0}).then(()=>({ok:!0})).catch(r=>({ok:!1,error:r}));if(!c.ok)return le(c.error),{accountId:t,enqueued:!1,ok:!1,message:k(c.error)};s.recordEvent("sync.triggered");const i=await fe({accountId:t,readStatus:()=>P(e,t),baselineLastSyncAt:u.lastSyncAt,baselineInboxSyncedAt:u.inboxSyncedAt,onInboxSynced:()=>a(t),deadline:n});return i?{accountId:t,enqueued:!0,ok:!1,message:i.message}:{accountId:t,enqueued:!0,ok:!0}},Re=(e,s={})=>{const t=T(),n=G(),{acknowledge:a}=ae(),[u,c]=o.useState("idle"),[i,r]=o.useState(),h=o.useRef(0),S=o.useRef(e);S.current=e;const w=o.useRef(s);w.current=s,o.useEffect(()=>{if(u!=="success")return;const x=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(x)},[u]);const y=o.useCallback(()=>{const x=S.current;if(x.length===0){c("error"),r("Nothing to refresh yet");return}const m=++h.current;c("refreshing"),r(void 0),re();const l=f=>{h.current===m&&(t.invalidateQueries({queryKey:X({path:{accountId:f}})}),w.current.onSettled?.())};(async()=>{const f=Date.now()+ce,d=await Promise.all(x.map(g=>de(t,n,g,f,l)));if(h.current!==m)return;const p=d.filter(g=>g.enqueued).map(g=>g.accountId);for(const g of p)l(g);p.length>0&&a(p);const b=d.filter(g=>!g.ok);b.length===0?c("success"):(c("error"),r(b[0]?.message))})()},[a,t,n]);return{state:u,errorMessage:i,refresh:y}};export{xe as H,be as M,ye as R,Re as a,L as b,we as c,pe as i,Ee as s,ae as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as r,r as s,b5 as t}from"./index-
|
|
1
|
+
import{K as r,r as s,b5 as t}from"./index-DJ_qkfvM.js";import{u as m}from"./useQueries-QS_Quksh.js";const a=i=>({items:i.map(e=>e.data?.items??[]),isPending:i.some(e=>e.isPending),error:i.find(e=>e.error)?.error??null});function u(i){const e=m({queries:i.map(o=>({...r({path:{accountId:o.accountId}}),staleTime:1/0})),combine:a});return{index:s.useMemo(()=>t(i.map((o,n)=>({folderAppointments:o.folderAppointments,mailboxes:e.items[n]??[]}))),[i,e]),isPending:e.isPending,error:e.error}}export{u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as h,j as a,
|
|
1
|
+
import{r as h,j as a,ct as Y,t as b,I as X,h as Z,at as J,i as ee,av as te,cJ as se,bR as re,ab as ne,a0 as ae,X as oe,d2 as _,d3 as I,C as ie,cn as ce}from"./index-DJ_qkfvM.js";import{K as A}from"./kbd-DeTBGQqu.js";import{B as le,b as de}from"./useMessageBodyContent-BeTI85Tr.js";import{i as ue}from"./search-scope-B5-OK3Cq.js";const me='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',k={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},fe={background:!1,spacing:!1},he="16px",ge=()=>`html{padding:0}body{padding:${he};box-sizing:border-box}`,pe=()=>"html{overflow:hidden}body{overflow-x:auto}",be=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,ye='<meta name="viewport" content="width=device-width, initial-scale=1">',xe=e=>{const t=e?k.dark:k.light;return`
|
|
2
2
|
/* Plain-email base: UI font-stack + theme-aware colors (#424) */
|
|
3
3
|
html, body {
|
|
4
4
|
font-family: ${me};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as L,at as M,i as k,E as I,F as E,
|
|
1
|
+
import{h as L,at as M,i as k,E as I,F as E,cF as A,ei as R,r as v,du as j,j as p,ej as h,ek as w,el as D,C as _,cn as N,c as Q,dP as z,d2 as O}from"./index-DJ_qkfvM.js";import{c as P}from"./popover-menu-OJfdS-G4.js";import{aj as U}from"./MailListHeader-fjGj1Z2F.js";import{a as q}from"./useLabels-CTWalEw2.js";import{n as F}from"./search-query-Cr_ZXBCp.js";import{b as B}from"./search-scope-B5-OK3Cq.js";import{u as G,p as H}from"./useSearchTokenContext-DdNZMB4E.js";const ne=e=>{const t=new Set;for(const s of e)s&&t.add(s);return t.size>1?{accountId:void 0,restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"}:{accountId:t.size===1?[...t][0]:void 0,restriction:void 0,moveDisabledHint:void 0}},K=e=>{const{mailboxId:t,messages:s}=e,n=L(),{pushError:l}=M(),{mutateAsync:c,isPending:a}=k({...R(),onError:(r,u)=>{l({title:u.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:A(r),error:r})},onSettled:(r,u,d)=>{I(n,E(U(d.body.messageIds??[],s??[],t)))}});return{applyLabel:v.useCallback((r,u,d)=>{r.length!==0&&j(r,m=>c({body:{messageIds:m,labelId:u,action:d}}))},[c]),isPending:a}};function re({accountId:e,mailboxId:t,messageIds:s}){const{labels:n}=q(e),{applyLabel:l}=K({mailboxId:t}),c=v.useMemo(()=>n.map(a=>({key:a.labelId,label:a.name,icon:p.jsx("span",{className:`size-2.5 rounded-full ${w(a.color)?h[a.color]:h.Default}`}),onSelect:()=>l(s,a.labelId,"Apply")})),[n,s,l]);return c.length===0?null:p.jsx(P,{triggerLabel:"Apply label to selected messages",triggerIcon:p.jsx(D,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:c,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}const V=3,ie=({hasSearchQuery:e,freeText:t,residualTokenCount:s})=>{if(!e||s>0)return!1;const n=t.trim();return n.length===0||n.length>=V},ce=e=>e===void 0?{kind:"unknown"}:{kind:"exact",value:e},Y=20,$=new Set(Object.values(O)),J=e=>e!==void 0&&$.has(e)?e:void 0,W=e=>{if(e.some(t=>t.type==="isUnread"))return!1;if(e.some(t=>t.type==="isRead"))return!0};function le({mailboxId:e,filterCategory:t}={}){const{searchQuery:s}=_(),n=G(),l=N(),c=F(s),{freeText:a,tokens:i}=H(c,n),r=a.length>0,u=i.find(o=>o.type==="category"),d=J(t)??u?.category,m=i.some(o=>o.type==="hasAttachment")?!0:void 0,f=i.some(o=>o.type==="isStarred")?!0:void 0,y=W(i),b=i.find(o=>o.type==="after"),g=i.find(o=>o.type==="before"),x=i.find(o=>o.type==="in"),S=B({browsed:l,callerMailboxId:e,inTokenMailboxId:x?.mailboxId}),{data:T,isLoading:C}=Q({...z({query:{query:a,mailboxId:S,limit:Y,...d!==void 0?{category:d}:{},...m!==void 0?{hasAttachment:m}:{},...f!==void 0?{hasStars:f}:{},...y!==void 0?{isRead:y}:{},...b?{sentDateFrom:b.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:r,staleTime:6e4});return{hits:T?.items??[],isLoading:r&&C}}export{re as L,ne as r,ie as s,ce as t,le as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as g,at as p,c as f,d as m,r,i as y,av as T,o as E,l as d}from"./index-
|
|
1
|
+
import{h as g,at as p,c as f,d as m,r,i as y,av as T,o as E,l as d}from"./index-DJ_qkfvM.js";const i={html:"",plainText:""},x=e=>{const u=g(),{pushError:o}=p(),{data:n}=f({...m(),staleTime:1/0}),l=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(a=>a.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),s=y({...d(),onSuccess:()=>{u.invalidateQueries({queryKey:E()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),c=r.useCallback((t,a)=>{e&&s.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:a}})},[e,s]);return{signature:l,setSignature:c,isSaving:s.isPending}};export{x as u};
|
package/index.html
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
} catch (_) {}
|
|
39
39
|
})();
|
|
40
40
|
</script>
|
|
41
|
-
<script type="module" crossorigin src="/assets/index-
|
|
41
|
+
<script type="module" crossorigin src="/assets/index-DJ_qkfvM.js"></script>
|
|
42
42
|
<link rel="stylesheet" crossorigin href="/assets/index-CzAIxx9Z.css">
|
|
43
43
|
</head>
|
|
44
44
|
<body>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as n,f as E,t as m,_ as ee,$ as te,az as g,r as w,ay as ne,X as se,a0 as ae}from"./index-BNRL-uMz.js";import{j as C,B as ie,l as re,E as T,F as oe,z as le,o as U,G as ce}from"./useCalendarEvents-C15rKxvv.js";import{u as de,U as _,i as ue,t as me}from"./useCalendars-DMp85Z7y.js";import{R as H,c as he}from"./calendar-color-ly22L46M.js";import{C as xe}from"./calendar-clash-strip-C-R84ym8.js";const pe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ye=["January","February","March","April","May","June","July","August","September","October","November","December"],ve=["first","second","third","fourth","last"],k="";function ge(e,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[s,a,r]=e.split("-").map(Number),i=new Date(Date.UTC(s,a-1,r)),o=pe[i.getUTCDay()],l=ve[Math.min(Math.floor((r-1)/7),4)],c=t===""?"":`, ${t}`,d=i.getUTCDay()>=1&&i.getUTCDay()<=5;return[`Every day${c}`,...d?[`Every weekday${c}`]:[],`Every week on ${o}${c}`,`Every month on the ${l} ${o}${c}`,`Every year on ${r} ${ye[a-1]}${c}`]}const De="w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",h=({draft:e,onChange:t},s,a)=>t({...e,[s]:a});function v({label:e,children:t}){return n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),t]})}function fe({draft:e,onChange:t,layout:s="compact",touch:a}){const r=s==="pane";return n.jsx(g,{value:e.title,placeholder:"Title","aria-label":"Title",onChange:i=>h({draft:e,onChange:t},"title",i.target.value),className:m(r?"text-lg font-medium":"text-md font-medium",r?"h-11":a?"min-h-11":"")})}function P(e){return e.date===""||e.endDate===""?!1:e.allDay?e.endDate<e.date:e.startTime===""||e.endTime===""?!1:`${e.endDate}T${e.endTime}`<`${e.date}T${e.startTime}`}function Ne(e,t){return t===""?{...e,date:t}:e.endDate===""?{...e,date:t,endDate:t}:e.date===""?{...e,date:t}:{...e,date:t,endDate:C(t,ie(e.date,e.endDate))}}function Te(e,t){const s=e.date!==""&&e.endDate===C(e.date,1)&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime;return t&&s?{...e,allDay:t,endDate:e.date}:!t&&e.date!==""&&e.endDate===e.date&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime?{...e,allDay:t,endDate:C(e.date,1)}:{...e,allDay:t}}function be({draft:e,onChange:t,touch:s}){const a=s?"min-h-11":"",r=P(e),i=w.useId(),o={"aria-invalid":r,"aria-describedby":r?i:void 0},l=m("w-40",a,r&&"border-danger/60"),c=m("w-28",a,r&&"border-danger/60");return n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(g,{type:"date",value:e.date,"aria-label":"Date",...o,onChange:d=>t(Ne(e,d.target.value)),className:l}),!e.allDay&&n.jsx(g,{type:"time",value:e.startTime,"aria-label":"Start time",...o,onChange:d=>h({draft:e,onChange:t},"startTime",d.target.value),className:c}),n.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),n.jsx(g,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...o,onChange:d=>h({draft:e,onChange:t},"endDate",d.target.value),className:l}),!e.allDay&&n.jsx(g,{type:"time",value:e.endTime,"aria-label":"End time",...o,onChange:d=>h({draft:e,onChange:t},"endTime",d.target.value),className:c}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx("input",{type:"checkbox",checked:e.allDay,onChange:d=>t(Te(e,d.target.checked)),className:"size-4 accent-current"}),"All day"]})]}),r&&n.jsx("p",{id:i,className:"text-xs text-danger",role:"alert",children:e.allDay?`Ends before it starts. Move the end to ${e.date} or later.`:`Ends before it starts. Move the end past ${e.date} ${e.startTime}, or start earlier.`})]})}function je({draft:e,onChange:t,calendars:s,touch:a}){return n.jsx(Oe,{calendars:s,value:e.calendarId,onChange:r=>h({draft:e,onChange:t},"calendarId",r),touch:a})}function Ee({draft:e,onChange:t,touch:s,repeatEditable:a=!0,onCustom:r}){return a?n.jsx(Ae,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:i=>h({draft:e,onChange:t},"repeat",i),onCustom:r,className:s?"min-h-11":""}):n.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[n.jsx(H,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===k?"Does not repeat":e.repeat]})}function $e({draft:e,onChange:t,touch:s}){return n.jsx(g,{value:e.location,placeholder:"Location","aria-label":"Location",onChange:a=>h({draft:e,onChange:t},"location",a.target.value),className:s?"min-h-11":""})}function Ce({draft:e,onChange:t,touch:s}){return n.jsx(g,{value:e.guests,placeholder:"Guests, comma separated","aria-label":"Guests",onChange:a=>h({draft:e,onChange:t},"guests",a.target.value),className:s?"min-h-11":""})}function ke({draft:e,onChange:t,layout:s="compact"}){return n.jsx("textarea",{value:e.notes,placeholder:"Notes","aria-label":"Notes",onChange:a=>h({draft:e,onChange:t},"notes",a.target.value),rows:s==="pane"?6:3,className:De})}function we({draft:e,onChange:t,calendars:s,layout:a="compact",expanded:r=!1,onToggleExpanded:i,onSave:o,onCancel:l,onDelete:c,saveLabel:d="Add",header:x,repeatEditable:u=!0,guestsEditable:D=!1,calendarEditable:O=!0,onCustomRepeat:X,touch:p,className:F}){const f=a==="pane",y={draft:e,onChange:t,layout:a,touch:p},Y=n.jsx(fe,{...y}),R=n.jsx(be,{...y}),I=n.jsx(je,{...y,calendars:s}),M=n.jsx(Ee,{...y,repeatEditable:u,onCustom:X}),S=n.jsx($e,{...y}),L=n.jsx(Ce,{...y}),W=n.jsx(ke,{...y}),z=n.jsxs("div",{className:m("flex items-center gap-2",f?"pt-2":"pt-1"),children:[n.jsx(E,{variant:"primary",size:p||f?"md":"sm",onClick:o,disabled:P(e),className:p?"min-h-11 flex-1":"",children:d}),n.jsx(E,{variant:"ghost",size:p||f?"md":"sm",onClick:l,className:p?"min-h-11":"",children:"Cancel"}),c&&n.jsx(E,{variant:"ghost",size:p||f?"md":"sm",onClick:c,className:m("ml-auto text-danger",p&&"min-h-11"),children:"Delete"})]});if(f)return n.jsxs("div",{className:m("flex flex-col gap-5",F),children:[x,n.jsx(v,{label:"Title",children:Y}),n.jsx(v,{label:"When",children:R}),O&&n.jsx(v,{label:"Calendar",children:I}),n.jsx(v,{label:"Repeat",children:M}),n.jsx(v,{label:"Location",children:S}),D&&n.jsx(v,{label:"Guests",children:L}),n.jsx(v,{label:"Notes",children:W}),z]});const Z=i!==void 0&&!r;return n.jsxs("div",{className:m("flex flex-col gap-3",F),children:[x,Y,R,O&&I,i&&n.jsxs("button",{type:"button",onClick:i,"aria-expanded":r,className:m("flex items-center gap-1 self-start rounded-sm text-xs font-medium text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",p&&"min-h-11"),children:[r?n.jsx(ee,{className:"size-3.5"}):n.jsx(te,{className:"size-3.5"}),r?"Fewer details":"More details"]}),!Z&&n.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[S,D&&L,M,W]}),z]})}const B="__custom__";function Ae({value:e,date:t,startTime:s,onChange:a,onCustom:r,className:i}){const o=ge(t,s),l=e===k||o.includes(e)?o:[e,...o];return n.jsxs(ne,{icon:n.jsx(H,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:c=>{if(c.target.value===B){r?.();return}a(c.target.value)},className:i,children:[n.jsx("option",{value:k,children:"Does not repeat"}),l.map(c=>n.jsx("option",{value:c,children:c},c)),r&&n.jsx("option",{value:B,children:"Custom…"})]})}function Oe({calendars:e,value:t,onChange:s,touch:a}){const r=w.useId();return n.jsxs("fieldset",{className:"flex flex-wrap gap-1.5",children:[n.jsx("legend",{className:"sr-only",children:"Calendar"}),e.map(i=>{const o=he(i.color),l=i.id===t;return n.jsxs("label",{className:m("inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-2.5 text-xs transition-colors","has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",a?"min-h-11":"h-7",l?m(o.soft,o.text,o.border):"border-line text-fg-muted hover:bg-surface-sunken"),children:[n.jsx("input",{type:"radio",name:r,value:i.id,checked:l,onChange:()=>s(i.id),className:"sr-only"}),n.jsx("span",{className:m("size-2 rounded-full",o.solid)}),i.name]},i.id)})]})}function Fe({title:e,subtitle:t,onClose:s,children:a,className:r}){return n.jsxs("section",{className:m("flex h-full w-full flex-col bg-surface",r),children:[n.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[n.jsx("h2",{className:"shrink-0 text-xs font-medium text-fg",children:e}),t!==void 0&&t!==""&&n.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-muted",children:t}),n.jsx("button",{type:"button","aria-label":"Close editor",onClick:s,className:"ml-auto flex size-7 shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",children:n.jsx(se,{className:"size-4"})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-row-inset py-5",children:n.jsx("div",{className:"mx-auto w-full max-w-2xl",children:a})})]})}const b=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],j=["SU","MO","TU","WE","TH","FR","SA"],K=["January","February","March","April","May","June","July","August","September","October","November","December"],G=["first","second","third","fourth","last"],J=[1,2,3,4,-1],Q="MO,TU,WE,TH,FR",Ye=e=>e.replace(/,\s*\d{2}:\d{2}$/,"").trim();function A(e){const t=Ye(e);if(t==="")return"";if(t==="Every day")return"FREQ=DAILY";if(t==="Every weekday")return`FREQ=WEEKLY;BYDAY=${Q}`;const s=t.match(/^Every week on (\w+)$/);if(s){const i=b.indexOf(s[1]);return i===-1?void 0:`FREQ=WEEKLY;BYDAY=${j[i]}`}const a=t.match(/^Every month on the (\w+) (\w+)$/);if(a){const i=G.indexOf(a[1]),o=b.indexOf(a[2]);return i===-1||o===-1?void 0:`FREQ=MONTHLY;BYDAY=${J[i]}${j[o]}`}const r=t.match(/^Every year on (\d{1,2}) (\w+)$/);if(r){const i=K.indexOf(r[2]);return i===-1?void 0:`FREQ=YEARLY;BYMONTH=${i+1};BYMONTHDAY=${Number(r[1])}`}}const Re=e=>e===""?"":`, ${e}`;function Be(e,t){const s=new Map(e.split(";").map(o=>o.split("=")).filter(o=>o.length===2).map(([o,l])=>[o.toUpperCase(),l.toUpperCase()])),a=Re(t),r=s.get("FREQ"),i=s.get("BYDAY");if(!(s.has("INTERVAL")&&s.get("INTERVAL")!=="1")&&!(s.has("UNTIL")||s.has("COUNT"))){if(r==="DAILY")return`Every day${a}`;if(r==="WEEKLY"){if(i===void 0)return;if(i===Q)return`Every weekday${a}`;const o=j.indexOf(i);return o===-1?void 0:`Every week on ${b[o]}${a}`}if(r==="MONTHLY"){const o=i?.match(/^(-?\d)([A-Z]{2})$/);if(!o)return;const l=J.indexOf(Number(o[1])),c=j.indexOf(o[2]);return l===-1||c===-1?void 0:`Every month on the ${G[l]} ${b[c]}${a}`}if(r==="YEARLY"){const o=Number(s.get("BYMONTH")),l=Number(s.get("BYMONTHDAY"));return!o||!l||o>12?void 0:`Every year on ${l} ${K[o-1]}${a}`}}}function He(e,t){return{title:"",date:e,startTime:"09:00",endDate:e,endTime:"10:00",allDay:!1,calendarId:t,location:"",guests:"",notes:"",repeat:""}}function Pe(e,t){return{title:e.title,date:e.start.slice(0,10),startTime:e.allDay?"":e.start.slice(11,16),endDate:oe(e),endTime:e.allDay?"":e.end.slice(11,16),allDay:e.allDay,calendarId:e.calendarId,location:t.location,guests:"",notes:t.notes,repeat:t.repeat}}function V(e,t){return e.allDay?{start:e.date,end:re(e.endDate,1)}:{start:T(e.date,e.startTime,t),end:T(e.endDate,e.endTime,t)}}function q(e,t){return e.title.trim()===""?"Give the event a title before saving it.":e.date===""?"Pick the day the event is on.":e.endDate===""?"Pick the day the event ends on.":e.calendarId===""?"Pick the calendar to save the event in.":!e.allDay&&(e.startTime===""||e.endTime==="")?"Set a start and an end time, or mark the event all day.":e.allDay&&e.endDate<e.date?"The last day is before the first. Move one of them.":!e.allDay&&`${e.endDate}T${e.endTime}`<=`${e.date}T${e.startTime}`?"The end is not after the start. Move one of them.":t&&A(e.repeat)===void 0?"This calendar can't store that repeat rule. Pick one of the offered rules, or turn the repeat off.":""}function Ke(e,t){const s=q(e,!0);if(s!=="")return{ok:!1,problem:s};const{start:a,end:r}=V(e,t);return{ok:!0,input:{calendarId:e.calendarId,summary:e.title.trim(),description:e.notes,location:e.location,start:a,end:r,allDay:e.allDay,...t===""?{}:{timeZone:t},recurrenceRule:A(e.repeat)??""}}}function Ge(e,t,s){const a=t.repeat!==e.repeat,r=q(t,a);if(r!=="")return{ok:!1,problem:r};const i={};if(t.title.trim()!==e.title.trim()&&(i.summary=t.title.trim()),t.location!==e.location&&(i.location=t.location),t.notes!==e.notes&&(i.description=t.notes),t.date!==e.date||t.startTime!==e.startTime||t.endDate!==e.endDate||t.endTime!==e.endTime||t.allDay!==e.allDay){const{start:l,end:c}=V(t,s);i.start=l,i.end=c,i.allDay=t.allDay,s!==""&&(i.timeZone=s)}return a&&(i.recurrenceRule=A(t.repeat)??""),{ok:!0,patch:i}}const $=new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"long"}),N=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1});function Ie(e){const t=new Date(e.start),s=new Date(e.end),a=$.format(t);return e.allDay?`${a}, all day`:$.format(s)===a?`${a}, ${N.format(t)} – ${N.format(s)}`:`${a}, ${N.format(t)} – ${$.format(s)}, ${N.format(s)}`}const Me=[],Se={from:"",to:""};function Je(e,t=""){const{timeZoneByCalendarId:s}=de(),a=e.date!==""&&!e.allDay&&e.endDate!==""&&e.startTime!==""&&e.endTime!==""&&`${e.endDate}T${e.endTime}`>`${e.date}T${e.startTime}`,{instances:r,isLoading:i,error:o}=le({...a?{from:U("week",e.date).from,to:U("week",e.endDate).to}:Se,calendarIds:Me,enabled:a}),l=s[e.calendarId]??_;return w.useMemo(()=>{if(!a||i||o)return;const c=T(e.date,e.startTime,l),d=T(e.endDate,e.endTime,l),x=r.filter(u=>ue(u)&&u.calendarObjectId!==t).map(u=>me(u,s[u.calendarId]??_));return ce({start:c,end:d},x).map(u=>({id:u.id,label:`${u.title}, ${Ie(u)}`}))},[a,i,o,e.date,e.endDate,e.startTime,e.endTime,l,r,t,s])}function Qe({title:e,subtitle:t,calendars:s,draft:a,onChange:r,problem:i,saveLabel:o,isSaving:l,repeatEditable:c=!0,calendarEditable:d=!0,clashes:x,onSave:u,onCancel:D}){return n.jsx(Fe,{title:e,subtitle:t,onClose:D,children:n.jsx(we,{draft:a,onChange:r,calendars:s,layout:"pane",repeatEditable:c,calendarEditable:d,saveLabel:l?"Saving…":o,onSave:u,onCancel:D,header:i===""&&x===void 0?void 0:n.jsxs("div",{className:"space-y-2",children:[i!==""&&n.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[n.jsx(ae,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),n.jsx("p",{className:"min-w-0 flex-1 break-words text-fg",children:i})]}),x!==void 0&&n.jsx(xe,{clashes:x,clearText:"Nothing else is booked at this time."})]})})})}export{Qe as C,Ke as c,Pe as d,He as e,Ie as f,Ge as p,Be as t,Je as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{eA as U,r as o,d$ as Z,c as ie,C as z,bp as le,cR as ce,aZ as ue,a_ as ge,j as a,ak as he,d1 as me,d2 as pe}from"./index-BNRL-uMz.js";import{u as fe,p as _,R as Ie}from"./useSearchTokenContext-B79W3Jko.js";import{A as xe,E as Te,al as ye,am as be,aw as ve,an as Ce,b as Re,M as Se,at as we,ax as je,av as Fe,m as Me,J as Oe,O as W,N as ke,K as Pe,d as Le,Y as Ae,Z as Ne,$,a0 as J,a1 as De,a2 as Ee,a3 as qe}from"./MailListHeader-7hjO4QAJ.js";import{u as Be,l as Qe,b as Ke,a as ze}from"./MailViewChrome-DmH48Cl1.js";import{f as He}from"./ErrorState-DL8IICDI.js";import{d as Ve,w as Ge}from"./wizard-selection-DxUM65kM.js";import{a as _e}from"./useMessageBodyContent-BgYyi6MR.js";import{e as We,f as Ue}from"./search-token-index-C0l1uvSx.js";import{u as Ze}from"./sections-DMxbWj0z.js";const H=e=>({...e,starred:!0,order:"desc"}),$e=(e={})=>Z({query:H(e)});function Y(e={}){const{data:t,isLoading:s,isError:r,error:c,refetch:u,fetchNextPage:n,hasNextPage:g,isFetchingNextPage:h}=Be({queryKey:$e(e),queryFn:async({pageParam:I})=>{const{data:l}=await U({query:{...H(e),continuationToken:I},throwOnError:!0});return l},initialPageParam:void 0,getNextPageParam:I=>I.continuationToken,staleTime:6e4});return{threads:o.useMemo(()=>(t?.pages??[]).flatMap(I=>I.items??[]),[t]),isLoading:s,isError:r,error:c,refetch:u,fetchNextPage:n,hasNextPage:g,isFetchingNextPage:h}}function Je(e={}){const t={...H(e),unread:!0,count:!0,results:!1},{data:s}=ie({queryKey:Z({query:t}),queryFn:async()=>{const{data:r}=await U({query:t,throwOnError:!0});return r},staleTime:6e4});return s?.count}const Ye=["from","subject","category","unread","starred","attachments"],Xe=(e,t)=>{const s=xe(e),{params:r,residual:c}=Te(t,{...s,starred:!0},Ye);return{criteria:{...r,...s},residual:c}};function et({rows:e,verb:t}){const{selectedIds:s,exitSelection:r}=Fe(),c=o.useMemo(()=>Ge(e,s),[e,s]);return a.jsx(Me,{verb:t,selection:c,selectionRestriction:"spansAccounts",onFinished:r})}function tt({selectedMessageId:e,onOpenThread:t,commandsRef:s,onTriageContextChange:r,onDeleteMessages:c}){const{searchQuery:u,resultFolderIndex:n,onSearchClearQuery:g}=z(),h=fe(),k=le(),I=ce(),[l,m]=o.useState("all"),[b,P]=o.useState(new Set),S=o.useCallback(d=>{P(R=>{const x=new Set(R);return x.has(d)?x.delete(d):x.add(d),x})},[]),w=o.useCallback(()=>{m("all"),P(new Set)},[]),T=o.useCallback(()=>{w(),g()},[w,g]),{freeText:j,tokens:v}=_(u.trim().toLowerCase(),h),L=_(u.trim(),h).freeText,{criteria:A,residual:p}=o.useMemo(()=>Xe({category:l,attributes:b},v),[l,b,v]),F=o.useMemo(()=>j?{...A,query:j}:A,[A,j]),{threads:N,isLoading:D,isError:y,error:q,refetch:M,fetchNextPage:B,hasNextPage:Q,isFetchingNextPage:O}=Y(F),f=o.useMemo(()=>Ve(N).map(ye).filter(d=>be(d,p)),[N,p]),i=o.useCallback((d,R)=>{const x=f.find(de=>de.id===d)?.threadId;x&&t?.({threadId:x,messageId:d},R)},[f,t]),C=o.useCallback(d=>{const R=d.threadId??f.find(x=>x.id===d.id)?.threadId;R&&t?.({threadId:R,messageId:d.id})},[f,t]),K=o.useMemo(()=>ve(),[]),te=o.useMemo(()=>f.map(d=>Ce(d,n)),[f,n]),se=Je(F)??null,ae=o.useMemo(()=>v.filter(d=>d.type!=="isStarred"),[v]),re=Qe({chips:{category:l,attributes:b},tokens:ae,reach:p.length>0?"loaded-pages":"whole-folder",onClear:T}),V=D?"loading":y?"error":f.length===0?"empty":"ready",oe=o.useCallback(()=>{const d=ue(ge());window.open(d,"_blank","noopener,noreferrer")},[]),G=Re(),ne=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:f.map(d=>a.jsx(Se,{thread:d,active:d.id===e,onClick:()=>i(d.id)},d.id))}),Q?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>B(),disabled:O,children:O?"Loading…":"Load more"}):null]})});return a.jsx(Ke,{title:"Starred",unreadCount:se,preset:K,selectedCategory:l,activeFilters:b,onSelectCategory:m,onToggleFilter:S,onClearFilters:w,searchResults:te,searchLoading:D,onSelectSearchResult:C,searchResultsInBody:!0,children:a.jsxs(we,{selectedMessageId:e,rows:f,onOpen:i,onDeleteMessages:c,onSelectionVerb:I.start,commandsRef:s,onTriageContextChange:r,children:[a.jsx(ze,{listTitle:"Starred",sections:[{id:"flagged",threads:f}],flatList:!0,hideHeader:!0,listState:G.searchResults?"ready":V,listFilter:re,listScopeLabel:"Starred",searchQuery:L||void 0,errorMessage:y?He(q):void 0,onRetry:()=>M(),onReportError:oe,selectedThreadId:e,onSelectThread:i,isDesktop:k,selectionBar:a.jsx(je,{title:"Starred"}),listBody:G.searchResults??(V==="ready"?ne:void 0)}),a.jsx(et,{rows:f,verb:I.verb})]})})}const X=o.createContext(null);function E(){const e=o.useContext(X);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function st({thread:e,children:t}){const s=We(),r=Ue(),c=Ze(),{searchInput:u}=z(),n=e?.threadId,g=e?.messageId,{threads:h}=Y(),k=o.useMemo(()=>{if(n)return h.find(i=>i.messageId===g)??h.find(i=>i.threadId===n)},[h,n,g]),I=Oe(n,g),l=k??I,m=g??l?.messageId,b=o.useMemo(()=>{if(n)return{threadId:n,mailboxId:l?.mailboxId??"",subject:l?.subject,messageId:m,authenticity:l?.authenticity}},[n,l,m]),P=o.useCallback((i,C)=>{s(i,{replace:C?.replace,query:u})},[s,u]),S=o.useCallback(i=>{m&&i.includes(m)&&r()},[m,r]),w=W({thread:l,isOpen:!0,onAfterOptimisticRemove:S}),T=ke(),{deleteMessages:j}=Pe({mailboxId:l?.mailboxId??"",messages:h,onAfterOptimisticRemove:S}),{toggleReadFor:v}=Le({mailboxId:l?.mailboxId??"",messages:h}),L=T.focusedMessageId,p=o.useMemo(()=>h.find(i=>i.messageId===L),[h,L])??l,F=W({thread:p,isOpen:p?.messageId===m}),N=_e(),D=he(),y=me(),q=o.useMemo(()=>pe(y,n,m),[y,n,m]),M=o.useMemo(()=>{if(p)return i=>y({threadId:p.threadId,messageId:p.messageId,mode:i})},[y,p]),{nextMessageId:B,previousMessageId:Q}=Ae({context:T,orderedIds:T.orderedIds,selectedMessageId:m,enabled:!N&&!D,hasOpenThread:n!==void 0,onClose:r,handlers:{reply:()=>M?.("reply"),replyAll:()=>M?.("reply-all"),forward:()=>M?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||F.deleteThread()},toggleStar:F.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||p&&v([p.messageId],!p.isRead)},goBrief:()=>c("brief"),goSettings:()=>c("settings")}}),O=o.useCallback(i=>{if(!i)return;const C=h.find(K=>K.messageId===i);return C?{threadId:C.threadId,messageId:i}:void 0},[h]),f={selectedMessageId:m,selectedThread:l,conversation:b,onOpenThread:P,onCloseThread:r,nextThread:O(B),previousThread:O(Q),actions:w,onReply:q,triage:T,onDeleteMessages:j,handleDeselectIfRemoved:S};return a.jsx(X.Provider,{value:f,children:t})}function ee(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:r}=E();return a.jsx(tt,{selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:r})}function at(){const{conversation:e,selectedThread:t,actions:s,onReply:r,handleDeselectIfRemoved:c}=E(),u=!!e,n=Ee(e?.threadId);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(qe,{hasThread:u,intelligenceOpen:n.isShowing,canToggleIntelligence:n.canToggle,onToggleIntelligence:n.toggle,onReply:r?()=>r("reply"):void 0,onReplyAll:r?()=>r("reply-all"):void 0,onForward:r?()=>r("forward"):void 0,onDelete:u?s.deleteThread:void 0,onToggleStar:u?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:u&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx($,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,onOpenIntelligence:n.open,listOnScreen:!0}):a.jsx(Ie,{})})]}),a.jsx(J,{isOpen:n.drawerOpen,onClose:n.closeDrawer,thread:t,mailboxId:t?.mailboxId,accountId:t?.accountId,onAfterOptimisticRemove:c})]})}function rt(){const{selectedThread:e,handleDeselectIfRemoved:t}=E(),{onToggleIntelligence:s}=z();return a.jsx(De,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function ot(){const{selectedThread:e,conversation:t,onCloseThread:s,onOpenThread:r,nextThread:c,previousThread:u,handleDeselectIfRemoved:n}=E(),g=Ne(t?.threadId??null);return t?a.jsxs(a.Fragment,{children:[a.jsx($,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:s,onOpenIntelligence:g.toggle,onSwipeNext:c?()=>r(c):void 0,onSwipePrevious:u?()=>r(u):void 0,mobileIntelligenceOpen:g.isOpen}),a.jsx(J,{isOpen:g.isOpen,onClose:g.close,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:n})]}):a.jsx("div",{className:"h-full",children:a.jsx(ee,{})})}const pt=Object.assign(st,{List:ee,Reading:at,Intelligence:rt,Phone:ot});export{pt as F};
|