@remit/web-client-dist 0.0.623 → 0.0.625
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-B3SzFOBj.js → BriefPane-BcLRbXt0.js} +1 -1
- package/assets/CalendarComposePane-BX_sGf_E.js +1 -0
- package/assets/{CalendarComposeSeed-C2PZ3Lxx.js → CalendarComposeSeed-ueNtbA6-.js} +1 -1
- package/assets/{CalendarShell-LGX4J1Xv.js → CalendarShell-Cf0mR1zl.js} +1 -1
- package/assets/{EmptyState-Eahp2lXz.js → EmptyState-CN1sTl54.js} +1 -1
- package/assets/{ErrorState-2gehxV3K.js → ErrorState-ujr_GVkW.js} +1 -1
- package/assets/{FlaggedPane-Bx9K7MUz.js → FlaggedPane-CRQiEP8s.js} +1 -1
- package/assets/{FullCompose-SnaRTmcR.js → FullCompose-BAl3d_w0.js} +1 -1
- package/assets/MailListHeader-B8KqCoIm.js +7 -0
- package/assets/MailNav-eOhT4K5M.js +1 -0
- package/assets/{MailShell-CTIUWM4c.js → MailShell-CijmWfSp.js} +1 -1
- package/assets/{MailViewChrome-S7gykdhg.js → MailViewChrome-ylQHccJD.js} +1 -1
- package/assets/{MailboxPane-D3skzxVF.js → MailboxPane-BSy756o9.js} +1 -1
- package/assets/{NavMenuButton-DOb5_wpV.js → NavMenuButton-DXqQI4Z5.js} +1 -1
- package/assets/{OnboardingWizard-Z5_gDRyf.js → OnboardingWizard-JlsmKOxT.js} +1 -1
- package/assets/OpenCalendarEvent-AMoWfhdc.js +2 -0
- package/assets/{OutboxPane-Bb-QNA6M.js → OutboxPane-CA4PZFqu.js} +1 -1
- package/assets/_calendarObjectId-tOtImfXw.js +1 -0
- package/assets/_mailboxId-_P3tq8gl.js +1 -0
- package/assets/_messageId-COMQcfvI.js +1 -0
- package/assets/_messageId-DmH3Li5m.js +1 -0
- package/assets/_messageId-cFsRfOSD.js +1 -0
- package/assets/_outboxMessageId--susUoju.js +1 -0
- package/assets/_recurrenceId-CGhp2ffr.js +1 -0
- package/assets/_threadId--notVzkL.js +1 -0
- package/assets/_threadId-AEzpp5uR.js +1 -0
- package/assets/_threadId-BwJD_tv3.js +1 -0
- package/assets/{_view._date-O8v8-zT0.js → _view._date-CG9W40_l.js} +1 -1
- package/assets/{accounts-BeiXOSoK.js → accounts-8HbXfxyY.js} +1 -1
- package/assets/{advanced-rk9h_qCN.js → advanced-CDxG3KHI.js} +1 -1
- package/assets/{appearance-BtQmWlsL.js → appearance-CU8jNmrW.js} +1 -1
- package/assets/{attendee-row-CMQBOVFi.js → attendee-row-YXbrbIq8.js} +1 -1
- package/assets/{avatar-2y1jg_Dt.js → avatar-C5pPOUjS.js} +1 -1
- package/assets/{bell-off-rbrEdWqT.js → bell-off-CQoLYol5.js} +1 -1
- package/assets/{bottom-sheet-C0Ep3DuK.js → bottom-sheet-C91fm1wU.js} +1 -1
- package/assets/{brief-Bhskzr7i.js → brief-C32PSIeP.js} +1 -1
- package/assets/brief-DpNC_lz8.js +1 -0
- package/assets/{browser-ponyfill-COjzqnrm.js → browser-ponyfill-DzvjeLzv.js} +2 -2
- package/assets/{bug-DzYDi78F.js → bug-Bvjwypvc.js} +1 -1
- package/assets/calendar-DrGm8UfQ.js +1 -0
- package/assets/{calendar-clash-strip-666qoX0F.js → calendar-clash-strip-BLhPkquh.js} +1 -1
- package/assets/calendar-format-D-35Eq-A.js +1 -0
- package/assets/calendar-suggestion-Coshl0tU.js +1 -0
- package/assets/{calendars-BwhAQ2-I.js → calendars-5GLviUT4.js} +1 -1
- package/assets/{card-DViO8Qjw.js → card-DIRsRHeY.js} +1 -1
- package/assets/chevron-left-BzC14Odw.js +1 -0
- package/assets/{circle-check-big-DnvcvlZb.js → circle-check-big-BxS7u06D.js} +1 -1
- package/assets/{circle-check-CLK5B9u5.js → circle-check-uO4_WbZm.js} +1 -1
- package/assets/{circle-help-CHw61JSX.js → circle-help-BlZ4xP9R.js} +1 -1
- package/assets/{clock-Bw9kA5-J.js → clock-zn4wNsRc.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BQfSgO1d.js +1 -0
- package/assets/compose._-_outboxMessageId_-BTwbuYpu.js +1 -0
- package/assets/compose._-_outboxMessageId_-C4C_6Pc5.js +1 -0
- package/assets/compose._-_outboxMessageId_-rrLNuGNc.js +1 -0
- package/assets/{config-import-BT3KLBVG.js → config-import-CiK_cjWq.js} +1 -1
- package/assets/{confirm-dialog-Y2-tLYTm.js → confirm-dialog-DStVP_YB.js} +1 -1
- package/assets/{copy-Bz4vyOnq.js → copy-CBi3fm5e.js} +1 -1
- package/assets/{credential-steps-B6625Tan.js → credential-steps-C0bopKBL.js} +1 -1
- package/assets/{download-BqYGlW3y.js → download--4zu6YFD.js} +1 -1
- package/assets/{file-json-cD8IK5MT.js → file-json-CIHsLTs2.js} +1 -1
- package/assets/{filters-BVQM49Iz.js → filters-Bs369HA4.js} +1 -1
- package/assets/{flagged-2U-k_HD6.js → flagged-79ZpssaF.js} +1 -1
- package/assets/flagged-CXUG7hEi.js +1 -0
- package/assets/folder-failure-CqkVSsrb.js +1 -0
- package/assets/folders-KCTLIIjZ.js +1 -0
- package/assets/{help-copy-dH7--kjV.js → help-copy-uBF8fXGG.js} +1 -1
- package/assets/{import-BXXzJvRc.js → import-CsL0jkis.js} +1 -1
- package/assets/index-B-gorWZO.js +1 -0
- package/assets/{index-AhmXjWPe.js → index-BP2ZVS4q.js} +1 -1
- package/assets/index-BsZVtS6J.js +1 -0
- package/assets/index-CgYMdj4b.js +1 -0
- package/assets/index-Cm_p5S9S.js +1 -0
- package/assets/index-D5i-rZKH.js +55 -0
- package/assets/index-DXbMloJs.js +1 -0
- package/assets/index-DoeEkWBm.js +1 -0
- package/assets/index-Dpnd1WTE.js +1 -0
- package/assets/{index-7IhVHlJ2.js → index-Q4feV5hs.js} +54 -54
- package/assets/index-QHGSPpNt.js +1 -0
- package/assets/index-cFsRfOSD.js +1 -0
- package/assets/{kbd-BwmHuAX8.js → kbd-shPcQMK0.js} +1 -1
- package/assets/{labels-D4q70G_F.js → labels-DSgUeEAp.js} +1 -1
- package/assets/mail-C9hQ4FN3.js +1 -0
- package/assets/{mail-DvIjEsSb.js → mail-C_twG7GL.js} +1 -1
- package/assets/{map-pin-DbU9SG0U.js → map-pin-BBn-x2Kl.js} +1 -1
- package/assets/{menu-BC4aNS1d.js → menu-DTN4EvxK.js} +1 -1
- package/assets/new-htfLYhI7.js +1 -0
- package/assets/onboarding-CCQtdms3.js +1 -0
- package/assets/{onboarding-completion-CBpYKYqi.js → onboarding-completion-qZwYb_Ut.js} +1 -1
- package/assets/outbox-Gz6-I5eX.js +1 -0
- package/assets/{pencil-BrCM9GpE.js → pencil-DeYHBqGJ.js} +1 -1
- package/assets/{popover-menu-Lxas-eO6.js → popover-menu-TKxn0teJ.js} +1 -1
- package/assets/{refresh-cw-LG4APxaz.js → refresh-cw-5HtDVbgJ.js} +1 -1
- package/assets/{rich-text-CzURxp9_.js → rich-text-19XjDhm5.js} +2 -2
- package/assets/{rich-text-spellcheck-worker-provider-C_BPUxxs.js → rich-text-spellcheck-worker-provider-D_eo5-8u.js} +1 -1
- package/assets/{rotate-ccw-CrSv0jxT.js → rotate-ccw-CQK-NIHI.js} +1 -1
- package/assets/{roving-focus-FTWtadRc.js → roving-focus-lu4GUcG_.js} +1 -1
- package/assets/{row-actions-vuTPs--E.js → row-actions-Dj7EnCiv.js} +1 -1
- package/assets/{search-mirror-QEbe3NeU.js → search-mirror-yAtFv0xR.js} +1 -1
- package/assets/{search-token-index-L6Mkt6X5.js → search-token-index-DMotPy3S.js} +1 -1
- package/assets/{sections-CFEXxR3C.js → sections-BEjFgOOu.js} +1 -1
- package/assets/{senders-BFbXS-bi.js → senders-XmPQgpCc.js} +1 -1
- package/assets/settings-CW90bjLX.js +1 -0
- package/assets/{settings-screen-BpdZ1aOF.js → settings-screen-BRDJz8vo.js} +1 -1
- package/assets/{shield-check-DBAZd1ed.js → shield-check-HOK5b_5p.js} +1 -1
- package/assets/{suggested-vips-BZUJs6WO.js → suggested-vips-C57jHxrP.js} +1 -1
- package/assets/undo-2-SqKWoGew.js +1 -0
- package/assets/useCalendarData-ScZEg4Bc.js +1 -0
- package/assets/{useCalendarWrites-Bv--maCq.js → useCalendarWrites-DdDEKJWs.js} +1 -1
- package/assets/useCalendars-DB62jljf.js +1 -0
- package/assets/{useDebouncedValue-zUwFPFcb.js → useDebouncedValue-m9hfoeeT.js} +1 -1
- package/assets/{useFilters-CvpDOWxu.js → useFilters-MhGWNTRw.js} +1 -1
- package/assets/{useLabels-C_uFyrHE.js → useLabels-BCVlkzT_.js} +1 -1
- package/assets/{useLayoutTier-DwNvRwwG.js → useLayoutTier-B7U5my6x.js} +1 -1
- package/assets/{useMessageBodyContent-DqnHLGXQ.js → useMessageBodyContent-Bh1dkGuL.js} +1 -1
- package/assets/{useQueries-DuonHqWj.js → useQueries-Dt_ZoQnW.js} +1 -1
- package/assets/{useRefreshControl-CSyHT70d.js → useRefreshControl-C5OCmhS8.js} +1 -1
- package/assets/{useResultFolderIndex-B44sxzBK.js → useResultFolderIndex-D_wb9MYs.js} +1 -1
- package/assets/{useSearchTokenContext-DFeI23Ju.js → useSearchTokenContext-BtJhq-_Q.js} +3 -3
- package/assets/{useSemanticSearch-DNlAaucG.js → useSemanticSearch-DfSsCW6c.js} +1 -1
- package/assets/{useSignature-Bc7ArarA.js → useSignature-CRBwOs1d.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/CalendarComposePane-CvtgeFNJ.js +0 -1
- package/assets/MailListHeader-Cu4wemwM.js +0 -7
- package/assets/MailNav-AfGtRdvl.js +0 -1
- package/assets/OpenCalendarEvent-Cn1QGwAT.js +0 -2
- package/assets/_calendarObjectId-BrXtR9Pm.js +0 -1
- package/assets/_mailboxId-Ba2Vj1bR.js +0 -1
- package/assets/_messageId-BPLFc0Y7.js +0 -1
- package/assets/_messageId-BTG0BSTg.js +0 -1
- package/assets/_messageId-D4nVz1ZQ.js +0 -1
- package/assets/_outboxMessageId-vOHD6i7Z.js +0 -1
- package/assets/_recurrenceId-CChN75Ak.js +0 -1
- package/assets/_threadId-CU8N1dRJ.js +0 -1
- package/assets/_threadId-RbCgO-qJ.js +0 -1
- package/assets/_threadId-W07ctUoa.js +0 -1
- package/assets/attachment-file-Nf9Lupmr.js +0 -1
- package/assets/brief-BiKWMsCg.js +0 -1
- package/assets/calendar-DjytNVJb.js +0 -1
- package/assets/calendar-format-BUwluD4d.js +0 -1
- package/assets/calendar-suggestion-DlPmCFBX.js +0 -1
- package/assets/chevron-left-BEa4nJIj.js +0 -1
- package/assets/compose._-_outboxMessageId_-B-ACo-ZH.js +0 -1
- package/assets/compose._-_outboxMessageId_-BnI9sCbx.js +0 -1
- package/assets/compose._-_outboxMessageId_-C0uqvNHl.js +0 -1
- package/assets/compose._-_outboxMessageId_-VRT46OAJ.js +0 -1
- package/assets/flagged-BtHBwEoC.js +0 -1
- package/assets/folders-D3YbAWUS.js +0 -1
- package/assets/index-BPLFc0Y7.js +0 -1
- package/assets/index-BUxE0WiC.js +0 -1
- package/assets/index-B_lrAEhN.js +0 -1
- package/assets/index-DNcEaLfU.js +0 -1
- package/assets/index-DTKIh7zB.js +0 -1
- package/assets/index-DY3OMk4O.js +0 -1
- package/assets/index-DfcyrpGJ.js +0 -1
- package/assets/index-Dg54mvj6.js +0 -1
- package/assets/index-FCYPZ1Ur.js +0 -55
- package/assets/index-_gcH2khZ.js +0 -1
- package/assets/mail-CgKgg0DT.js +0 -1
- package/assets/new-CkVKW68N.js +0 -1
- package/assets/onboarding-BEcD8aP7.js +0 -1
- package/assets/outbox-Btk4kq9E.js +0 -1
- package/assets/settings-BurH9xy-.js +0 -1
- package/assets/useCalendarData-BoJA2U_M.js +0 -1
- package/assets/useCalendars-chDLMrib.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f0 as r,f1 as o,f2 as a}from"./index-Q4feV5hs.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-Q4feV5hs.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-Q4feV5hs.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-Q4feV5hs.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-Q4feV5hs.js";import{b}from"./MailShell-CijmWfSp.js";import{a as C}from"./useMessageBodyContent-Bh1dkGuL.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,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-7IhVHlJ2.js";import{s as oe,S as se}from"./search-scope-B5-OK3Cq.js";import{u as R}from"./useQueries-DuonHqWj.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-Q4feV5hs.js";import{s as oe,S as se}from"./search-scope-B5-OK3Cq.js";import{u as R}from"./useQueries-Dt_ZoQnW.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-Q4feV5hs.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-Q4feV5hs.js";import{K as f}from"./kbd-shPcQMK0.js";import{a as E,S as K}from"./settings-screen-BRDJz8vo.js";import{E as V}from"./ErrorState-ujr_GVkW.js";import{u as _}from"./useDebouncedValue-m9hfoeeT.js";import{s as B}from"./help-copy-uBF8fXGG.js";import"./avatar-C5pPOUjS.js";import"./chevron-left-BzC14Odw.js";import"./menu-DTN4EvxK.js";import"./circle-help-BlZ4xP9R.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-Q4feV5hs.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-Q4feV5hs.js";import{A as w}from"./avatar-C5pPOUjS.js";import{C as h}from"./chevron-left-BzC14Odw.js";import{M as S}from"./menu-DTN4EvxK.js";import{C as v}from"./circle-help-BlZ4xP9R.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-Q4feV5hs.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-Q4feV5hs.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as a}from"./index-Q4feV5hs.js";const o=a("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);export{o as U};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as m}from"./index-Q4feV5hs.js";import{u as C,d as g,i as v,t as I,U as p,e as D,r as E}from"./useCalendars-DB62jljf.js";import{v as y,H as L}from"./calendar-format-D-35Eq-A.js";function Z(a,n){const t=a.map(e=>e.id);if(n.length===0)return t;const s=new Set(n),o=t.filter(e=>s.has(e));return o.length===0?t:o}function A(a){const{calendars:n,colorByCalendarId:t,timeZoneByCalendarId:s,isLoading:o}=C(),e=Z(n,a),r=e.length===n.length?[]:e,c=a.length===0||n.length>0;return{calendars:n,colorByCalendarId:t,timeZoneByCalendarId:s,shown:e,narrowed:r,resolved:c,isLoading:o}}function B(a,n,t){const s=t.join(",");return m.useMemo(()=>{const o=g(),e=new Set(s===""?[]:s.split(","));return a.filter(r=>v(r)&&e.has(r.calendarId)).map(r=>I(r,n[r.calendarId]??p,o))},[a,n,s])}function b({view:a,date:n,calendarIds:t,enabled:s=!0}){const{calendars:o,colorByCalendarId:e,timeZoneByCalendarId:r,shown:c,narrowed:l,resolved:u,isLoading:w}=A(t),h=D(a,n),i=s&&u,d=y({...h,calendarIds:l,enabled:i});L(a,n,l,i);const f=B(d.instances,r,c);return{calendars:o,events:f,colorByCalendarId:e,timeZoneByCalendarId:r,isLoading:w||d.isLoading,error:d.error,retry:d.refetch,instanceOf:E}}export{B as a,b,A as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as C,r,i as c,
|
|
1
|
+
import{h as C,r,i as c,eR as h,eS as f,eT as y,s as g,b3 as m}from"./index-Q4feV5hs.js";import{f as I}from"./ErrorState-ujr_GVkW.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 S(){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 k(){const e=S(),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{k as a,S as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as g,ez as T,r as h}from"./index-Q4feV5hs.js";const s=e=>String(e).padStart(2,"0"),p=e=>`${e.getUTCFullYear()}-${s(e.getUTCMonth()+1)}-${s(e.getUTCDate())}`,d=e=>{const t=e<0?"-":"+",r=Math.abs(e);return`${t}${s(Math.floor(r/60))}:${s(r%60)}`};function $(e,t){const r=new Date(`${e}T${t}:00`);return`${e}T${t}:00${d(-r.getTimezoneOffset())}`}const i=new Map;function N(e){if(i.has(e))return i.get(e);let t;try{t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{t=void 0}return i.set(e,t),t}function l(e,t){const r=N(e);if(!r)return Number.NaN;const a=r.formatToParts(new Date(t)),n=D=>Number(a.find(I=>I.type===D)?.value),o=n("hour")%24;return(Date.UTC(n("year"),n("month")-1,n("day"),o,n("minute"),n("second"))-t)/6e4}function v(e,t,r){if(r==="")return`${e}T${t}:00+00:00`;const a=Date.parse(`${e}T${t}:00Z`),n=l(r,a);if(Number.isNaN(n))return $(e,t);const o=l(r,a-n*6e4);return`${e}T${t}:00${d(Number.isNaN(o)?n:o)}`}function m(e,t){const r=Date.parse(e),a=l(t,r),n=Number.isNaN(a)?-new Date(r).getTimezoneOffset():a,o=new Date(r+n*6e4);return`${p(o)}T${s(o.getUTCHours())}:${s(o.getUTCMinutes())}:${s(o.getUTCSeconds())}${d(n)}`}const c=e=>$(e,"00:00");function u(e,t){const[r,a,n]=e.split("-").map(Number);return p(new Date(Date.UTC(r,a-1,n+t)))}function O(e){const[t,r,a]=e.split("-").map(Number),n=new Date(Date.UTC(t,r-1,a));return u(e,-((n.getUTCDay()+6)%7))}function b(e,t){const[r,a]=t.split("-").map(Number);if(e==="year")return[`${r}-01-01`,`${r+1}-01-01`];if(e==="month"){const o=`${r}-${s(a)}-01`,f=a===12?`${r+1}-01-01`:`${r}-${s(a+1)}-01`;return[o,f]}if(e==="day")return[t,u(t,1)];const n=O(t);return[n,u(n,7)]}function x(e,t){const[r,a]=b(e,t);return{from:c(r),to:c(a)}}function A(e,t){return{from:c(e),to:c(u(e,t))}}const U=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,C="";function L(e){if(e!==C)return e;const t=U();return Intl.supportedValuesOf("timeZone").includes(t)?t:C}const R={Cal1:"cal-1",Cal2:"cal-2",Cal3:"cal-3",Cal4:"cal-4",Cal5:"cal-5",Cal6:"cal-6"},E={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},y="#";function w(e,t){return t===""?e:`${e}${y}${t}`}function M(e){const t=e.indexOf(y);return t===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,t),recurrenceId:e.slice(t+1)}}function z(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:R[e.color]??"cal-1"}}function j(e,t,r){return{id:w(e.calendarObjectId,e.recurrenceId),calendarId:e.calendarId,title:e.summary,start:e.allDay?e.start.slice(0,10):m(e.start,r),end:e.allDay?e.end.slice(0,10):m(e.end,r),allDay:e.allDay,location:"",notes:"",attendees:[],myRsvp:"accepted",threadId:"",threadSubject:"",timeZone:t,zoneCertainty:E[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const F=e=>e.status!=="Cancelled";function B(){const{data:e,isLoading:t,error:r}=g(T());return h.useMemo(()=>{const a=e?.items??[],n=a.map(z);return{calendars:n,colorByCalendarId:Object.fromEntries(n.map(o=>[o.id,o.color])),timeZoneByCalendarId:Object.fromEntries(a.map(o=>[o.calendarId,o.timezone])),defaultCalendarId:(a.find(o=>o.source==="Default")??a[0])?.calendarId??"",isLoading:t,error:r??null}},[e,t,r])}export{C as U,A as a,u as b,w as c,U as d,x as e,L as f,v as g,m as h,F as i,M as r,j as t,B as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o}from"./index-
|
|
1
|
+
import{r as o}from"./index-Q4feV5hs.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,eE as I,c as C,eF as x,d$ as F,eG as D,h as y,eH as N,eI as P,eJ as L,eK as z}from"./index-Q4feV5hs.js";const W=(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"},B=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,B as d,se as e,W 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,eo as L,h as n,i as l,ep as d,r as o,eq as y,er as c,es as g}from"./index-Q4feV5hs.js";const u=e=>y({path:{accountId:e}}),f=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}},h=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}},m=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{f as a,m as b,C as c,h as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c0 as s,c1 as e}from"./index-
|
|
1
|
+
import{c0 as s,c1 as e}from"./index-Q4feV5hs.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,cm as O,cn as B,a9 as h,co as N,q as P,ab as U,h as $,c as D,
|
|
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,cL as F,cM as L}from"./index-Q4feV5hs.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 Y(){return T()!==void 0}function j(){return T()?.outboxMessageId}function v(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({...v(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 q=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},K=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 L(e,{headers:s});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,q(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<K: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,Y as a,te as b,j as c,Z as d,ee as e,V as f,I as g,J as u};
|
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-Q4feV5hs.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-Q4feV5hs.js";import{C as Y}from"./circle-check-big-BxS7u06D.js";import{R as Z}from"./refresh-cw-5HtDVbgJ.js";import{u as N}from"./useQueries-Dt_ZoQnW.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-Q4feV5hs.js";import{u as m}from"./useQueries-Dt_ZoQnW.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,ct as Y,t as b,I as X,h as Z,at as J,i as ee,av as te,
|
|
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,cL as se,bR as re,ab as ne,a0 as ae,X as oe,d4 as _,d5 as I,C as ie,cn as ce}from"./index-Q4feV5hs.js";import{K as A}from"./kbd-shPcQMK0.js";import{B as le,b as de}from"./useMessageBodyContent-Bh1dkGuL.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};
|
|
@@ -74,11 +74,11 @@ pre, code {
|
|
|
74
74
|
:is(pre, code, pre *, code *):is([nowrap], [style*="nowrap" i]) {
|
|
75
75
|
white-space: pre-wrap !important;
|
|
76
76
|
}
|
|
77
|
-
`,je=e=>{const t=new Map;for(const s of e){if(!s.contentId||s.contentUrl.length===0)continue;const r=s.contentId.replace(/^<|>$/g,"");t.set(r,s.contentUrl)}return s=>t.get(s.replace(/^<|>$/g,""))},
|
|
77
|
+
`,je=e=>{const t=new Map;for(const s of e){if(!s.contentId||s.contentUrl.length===0)continue;const r=s.contentId.replace(/^<|>$/g,"");t.set(r,s.contentUrl)}return s=>t.get(s.replace(/^<|>$/g,""))},Le=/^(none|transparent|inherit|initial|unset)\s*$/i,$=e=>{const t=[],s=/<style[^>]*>([\s\S]*?)<\/style>/gi;let r;for(r=s.exec(e);r!==null;)t.push(r[1]),r=s.exec(e);return t},Re=e=>{const t=/background(?:-color)?\s*:\s*([^;}\n]+)/gi;let s;for(s=t.exec(e);s!==null;){const r=s[1].trim();if(!Le.test(r))return!0;s=t.exec(e)}return!1},_e=e=>{if(/\bstyle\s*=\s*["'][^"']*background/i.test(e)||/\bbgcolor\s*=/i.test(e))return!0;for(const t of $(e))if(Re(t))return!0;return!1},Ie=new Set(["auto","none","initial","inherit","unset","revert","revert-layer"]),$e=new RegExp(`(?<![-\\w])(?:padding|margin)(?:-(top|right|bottom|left|block|inline)(?:-(?:start|end))?)?\\s*:\\s*([^;}"']+)`,"gi"),Be=new Set(["top","bottom","block"]),B=e=>e.replace(/\/\*[\s\S]*?\*\//g,""),T=e=>{const t=e.toLowerCase();if(!t||Ie.has(t)||t.startsWith("-"))return!1;const s=/^\+?(\d*\.?\d+)[a-z%]*$/.exec(t);return s?Number.parseFloat(s[1])!==0:!0},Oe=e=>{const t=e.split(/\s+/).filter(Boolean);return t.length<2?t:t.length<4?[t[1]]:[t[1],t[3]]},Me=(e,t)=>{if(e&&Be.has(e))return!1;const s=t.replace(/!\s*important/gi,"").trim();return s?e?s.split(/\s+/).some(T):Oe(s).some(T):!1},j=e=>{for(const t of B(e).matchAll($e))if(Me(t[1],t[2]))return!0;return!1},O=new Set(["blockquote"]),De=e=>e.replace(/<!--[\s\S]*?-->/g,""),ze=e=>{const t=[],s=/<([a-zA-Z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,r=/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;for(const[,n,o]of e.matchAll(s))for(const d of o.matchAll(r))t.push({tag:n.toLowerCase(),style:d[1]??d[2]??""});return t},Pe=e=>[...B(e).matchAll(/([^{}]*)\{([^{}]*)\}/g)].map(t=>({selector:t[1].trim(),body:t[2]})),Ke=e=>{const t=e.trim().split(/[\s>+~]+/).pop()??"";return(/^[a-zA-Z][\w-]*/.exec(t)?.[0]??"").toLowerCase()},Fe=e=>e.split(",").every(t=>O.has(Ke(t))),He=e=>{const t=$(e),s=De(e);if(/\bcellpadding\s*=\s*["']?(?!0["'\s>])\d/i.test(s))return!0;for(const{tag:r,style:n}of ze(s))if(!O.has(r)&&j(n))return!0;for(const r of t)for(const n of Pe(r))if(!Fe(n.selector)&&j(n.body))return!0;return!1},Ge=["script","iframe","object","embed","form","input","button","textarea","select","meta","link","base"],Ue=["onerror","onload","onclick","onmouseover","onmouseout","onfocus","onblur","onsubmit","onkeydown","onkeyup","formaction","xlink:href","data-bind"],We="data:image/svg+xml,"+encodeURIComponent(`
|
|
78
78
|
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
|
|
79
79
|
<rect fill="#f0f0f0" width="100" height="100"/>
|
|
80
80
|
<text x="50" y="50" text-anchor="middle" dy=".3em" fill="#999" font-size="12">
|
|
81
81
|
Image blocked
|
|
82
82
|
</text>
|
|
83
83
|
</svg>
|
|
84
|
-
`),Ve=e=>e.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Qe=e=>e.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),qe=(e={})=>{const t=Y(),s={FORBID_TAGS:Ge,FORBID_ATTR:Ue,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return t.addHook("afterSanitizeAttributes",r=>{if(e.allowExternalImages||(r.tagName==="IMG"&&r.removeAttribute("srcset"),r.tagName==="SOURCE"&&(r.removeAttribute("srcset"),r.removeAttribute("src")),r.tagName==="VIDEO"&&r.removeAttribute("poster")),r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const d=n.slice(4).replace(/^<|>$/g,""),g=e.resolveCid?.(d);g&&(r.setAttribute("src",g),r.classList.add("inline-content"));return}e.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",We),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",Ve(n))}}),t.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=Qe(o)}}),r=>{const n=_e(r),o=He(r),d=t.sanitize(r,s);return{html:`<style>${Te()}</style>${d}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},R=()=>a.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Et=({className:e,children:t})=>a.jsx("div",{className:b("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",e),children:t}),Ye=({html:e,text:t,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:d,renderBlockedNotice:g})=>{const i=h.useMemo(()=>!e||typeof document>"u"?null:qe({allowExternalImages:n,resolveCid:o})(e),[e,n,o]),c=i?.html??null,{framed:u,isPlain:m}=Ce(r,i?.hasAuthorBackground??!1),f=h.useMemo(()=>({background:i?.hasAuthorBackground??!1,spacing:i?.hasAuthorSpacing??!1}),[i?.hasAuthorBackground,i?.hasAuthorSpacing]),p=h.useMemo(()=>!c||n?0:(c.match(/data-blocked-src/g)||[]).length,[c,n]);return!c&&!t?a.jsx("div",{className:b("message-body",d),children:a.jsx(R,{})}):a.jsxs("div",{className:b("message-body",d),children:[p>0&&a.jsx("div",{children:g?.(p)}),c?a.jsx("div",{className:"message-body-frame",children:u?a.jsx("div",{className:"w-full max-w-full",children:a.jsx(C,{html:c,variant:"framed",isDark:s,declares:f})}):a.jsx("div",{className:"max-w-full lg:max-w-2xl",children:a.jsx(C,{html:c,variant:m?"plain":"framed",isDark:s,declares:f})})}):t?a.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:t}):a.jsx(R,{})]})};function Nt({message:e="Select a thread to read",icon:t,showHints:s=!0,className:r}){return a.jsxs("div",{className:b("flex flex-1 flex-col items-center justify-center text-center",r),children:[t??a.jsx(X,{className:"size-10 text-fg-subtle"}),a.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:e}),s&&a.jsxs("p",{className:"text-2xs text-fg-subtle",children:[a.jsx(A,{children:"j"})," / ",a.jsx(A,{children:"k"})," to move, ",a.jsx(A,{children:"Enter"})," to open"]})]})}function M(e){const t=[];let s=-1,r=!1;for(let n=0;n<e.length;n++){const o=e[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&t.push({raw:e.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&t.push({raw:e.slice(s),start:s,end:e.length}),t}const Xe=e=>{if(!e.startsWith('"'))return e;const t=e.slice(1);return t.endsWith('"')?t.slice(0,-1):t};function Ze(e){const t=e.indexOf(":");if(t<=0)return;const s=e.slice(t+1);return{name:e.slice(0,t).toLowerCase(),value:Xe(s),rawValue:s}}const Je=e=>/[\s"]/.test(e),et=e=>Je(e)?`"${e.replace(/"/g,"")}"`:e,Ct=(e,t)=>`${e}:${et(t)}`,D=(e,t=Date.now())=>({value:e,setAt:t}),tt=(e,t,s,r)=>{if(e.addressId!==t)return e;const n={...e.flags??{}};return s?n.trusted=D(!0,r):delete n.trusted,{...e,flags:n}},st=(e,t,s,r)=>{const n=o=>o.map(d=>tt(d,t,s,r));return{...e,envelope:{...e.envelope,from:n(e.envelope.from),to:n(e.envelope.to),cc:n(e.envelope.cc),bcc:n(e.envelope.bcc),replyTo:n(e.envelope.replyTo)}}},rt=({messageId:e})=>{const t=Z(),{pushError:s}=J(),{mutate:r,isPending:n,error:o,reset:d}=ee({...re(),onMutate:async i=>{const c=i.path.addressId,m=i.body.flags?.trusted?.value===!0,f=se({path:{messageId:e}});await t.cancelQueries({queryKey:f});const p=t.getQueriesData({queryKey:f}).filter(l=>l[1]!==void 0).map(([l,x])=>({queryKey:l,data:x}));return t.setQueriesData({queryKey:f},l=>l&&st(l,c,m)),{describePrefix:f,previous:p}},onError:(i,c,u)=>{if(u)for(const m of u.previous)t.setQueryData(m.queryKey,m.data);s(te("Couldn't trust sender","The change wasn't saved.",i))},onSettled:(i,c,u,m)=>{m&&t.invalidateQueries({queryKey:m.describePrefix})}});return{toggleTrusted:(i,c)=>{r({path:{addressId:i},body:{flags:{trusted:D(!c)}}})},isPending:n,error:o,reset:d}},nt=()=>{const[e,t]=h.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return h.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{t(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),e},at=(e,t)=>{const s=`${e} image${e>1?"s":""}`;return t?`${s} hidden — you blocked this sender`:`${s} blocked for privacy`},ot=({blockedImageCount:e,canAlwaysTrust:t,isTrustPending:s,isSenderBlocked:r,onLoadOnce:n,onAlwaysTrust:o})=>a.jsxs("div",{"data-testid":"blocked-images-notice",className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[a.jsx("span",{className:"text-fg-muted",children:at(e,r)}),!r&&a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:n,className:"text-accent hover:underline",children:"Load once"}),t&&a.jsx("button",{type:"button",onClick:o,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),it=(e,t)=>{switch(e){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:t}}},ct=e=>e instanceof le?e.reason:"generic",lt=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while loading the message body.",dt=({error:e,onRetry:t})=>{const s=ct(e),r=lt(e),{title:n,detail:o}=it(s,r),[d,g]=h.useState(!1),{Account:i}=ne();return d?null:a.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[a.jsx(ae,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-danger",children:n}),a.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&a.jsx(i,{children:({signOut:c})=>a.jsx("button",{type:"button",onClick:()=>c(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),t&&a.jsx("button",{type:"button",onClick:t,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),a.jsx("button",{type:"button",onClick:()=>g(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:a.jsx(oe,{className:"size-4","aria-hidden":"true"})})]})]})},ut=()=>a.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),L=()=>a.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Tt=({bodyParts:e,html:t,text:s,isTrusted:r=!1,isBlocked:n=!1,messageId:o,fromAddressId:d,category:g,className:i})=>{const[c,u]=h.useState(!1),[m,f]=h.useState(o);m!==o&&(f(o),u(!1));const p=!n&&(r||c),l=nt(),{toggleTrusted:x,isPending:w}=rt({messageId:o??""}),y=!!e&&e.length>0,{picked:z,data:v,isLoading:P,isError:K,error:F,refetch:H}=de({messageId:o,bodyParts:e,enabled:y}),G=h.useMemo(()=>je(e??[]),[e]),U=y&&v?.kind==="html"?v.body:t,W=y&&v?.kind==="text"?v.body:s;if(y){if(P)return a.jsx("div",{className:b("message-body",i),children:a.jsx(ut,{})});if(K)return a.jsx("div",{className:b("message-body",i),children:a.jsx(dt,{error:F,onRetry:()=>H()})});if(!z)return a.jsx("div",{className:b("message-body",i),children:a.jsx(L,{})})}else if(!t&&!s)return a.jsx("div",{className:b("message-body",i),children:a.jsx(L,{})});const V=!!(d&&o),Q=()=>{!d||w||(u(!0),x(d,!1))};return a.jsx(Ye,{className:i,html:U,text:W,isDark:l,category:g,allowImages:p,resolveCid:G,renderBlockedNotice:q=>a.jsx(ot,{blockedImageCount:q,canAlwaysTrust:V,isTrustPending:w,isSenderBlocked:n,onLoadOnce:()=>u(!0),onAlwaysTrust:Q})})},mt=Object.values(_).map(e=>({value:e,label:I[e]})),ft={unclassified:"uncategorized"},ht=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:mt},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],gt=new Map(ht.map(e=>[e.name,e])),jt=e=>gt.get(e.toLowerCase()),pt=/^\d{4}-\d{2}-\d{2}$/;function bt(e,t,s){if(!pt.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:e,raw:t,value:s,epochSeconds:Math.floor(r/1e3)}}function yt(e){const t=e.toLowerCase(),s=ft[t];return s||Object.values(_).find(n=>n===t)}function xt(e,t){switch(t.toLowerCase()){case"unread":return{type:"isUnread",raw:e};case"read":return{type:"isRead",raw:e};case"starred":case"flagged":return{type:"isStarred",raw:e};default:return}}function wt(e,t){const s=Ze(e);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:e,value:n};case"subject":return{type:"subject",raw:e,value:n};case"category":{const o=yt(n);return o?{type:"category",raw:e,value:n,category:o}:void 0}case"is":return xt(e,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:e}:void 0;case"before":case"after":return bt(r,e,n);case"in":{const o=t.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:e,value:n,mailboxId:o}:void 0}case"account":{const o=t.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:e,value:n,accountId:o}:void 0}default:return}}function Rt(e,t={}){const s=[],r=[];for(const n of M(e)){const o=wt(n.raw,t);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Lt(e,t){return M(e).filter(s=>s.raw!==t.raw).map(s=>s.raw).join(" ")}function _t(e){switch(e.type){case"from":return`From: ${e.value}`;case"subject":return`Subject: ${e.value}`;case"category":return`Category: ${I[e.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${e.value}`;case"after":return`After ${e.value}`;case"in":return`In: ${e.value}`;case"account":return`Account: ${e.value}`}}function It(){const{mailboxNameIndex:e,accountNameIndex:t}=ie(),s=ce();return{...ue(s)?{}:{mailboxesByName:e},accountsByName:t}}export{Et as M,Nt as R,ht as S,Ye as a,rt as b,Tt as c,jt as d,M as e,Ze as f,Ct as g,Rt as p,Lt as r,_t as s,It as u};
|
|
84
|
+
`),Ve=e=>e.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Qe=e=>e.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),qe=(e={})=>{const t=Y(),s={FORBID_TAGS:Ge,FORBID_ATTR:Ue,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return t.addHook("afterSanitizeAttributes",r=>{if(e.allowExternalImages||(r.tagName==="IMG"&&r.removeAttribute("srcset"),r.tagName==="SOURCE"&&(r.removeAttribute("srcset"),r.removeAttribute("src")),r.tagName==="VIDEO"&&r.removeAttribute("poster")),r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const d=n.slice(4).replace(/^<|>$/g,""),g=e.resolveCid?.(d);g&&(r.setAttribute("src",g),r.classList.add("inline-content"));return}e.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",We),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",Ve(n))}}),t.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=Qe(o)}}),r=>{const n=_e(r),o=He(r),d=t.sanitize(r,s);return{html:`<style>${Te()}</style>${d}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},L=()=>a.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Et=({className:e,children:t})=>a.jsx("div",{className:b("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",e),children:t}),Ye=({html:e,text:t,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:d,renderBlockedNotice:g})=>{const i=h.useMemo(()=>!e||typeof document>"u"?null:qe({allowExternalImages:n,resolveCid:o})(e),[e,n,o]),c=i?.html??null,{framed:u,isPlain:m}=Ce(r,i?.hasAuthorBackground??!1),f=h.useMemo(()=>({background:i?.hasAuthorBackground??!1,spacing:i?.hasAuthorSpacing??!1}),[i?.hasAuthorBackground,i?.hasAuthorSpacing]),p=h.useMemo(()=>!c||n?0:(c.match(/data-blocked-src/g)||[]).length,[c,n]);return!c&&!t?a.jsx("div",{className:b("message-body",d),children:a.jsx(L,{})}):a.jsxs("div",{className:b("message-body",d),children:[p>0&&a.jsx("div",{children:g?.(p)}),c?a.jsx("div",{className:"message-body-frame",children:u?a.jsx("div",{className:"w-full max-w-full",children:a.jsx(C,{html:c,variant:"framed",isDark:s,declares:f})}):a.jsx("div",{className:"max-w-full lg:max-w-2xl",children:a.jsx(C,{html:c,variant:m?"plain":"framed",isDark:s,declares:f})})}):t?a.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:t}):a.jsx(L,{})]})};function Nt({message:e="Select a thread to read",icon:t,showHints:s=!0,className:r}){return a.jsxs("div",{className:b("flex flex-1 flex-col items-center justify-center text-center",r),children:[t??a.jsx(X,{className:"size-10 text-fg-subtle"}),a.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:e}),s&&a.jsxs("p",{className:"text-2xs text-fg-subtle",children:[a.jsx(A,{children:"j"})," / ",a.jsx(A,{children:"k"})," to move, ",a.jsx(A,{children:"Enter"})," to open"]})]})}function M(e){const t=[];let s=-1,r=!1;for(let n=0;n<e.length;n++){const o=e[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&t.push({raw:e.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&t.push({raw:e.slice(s),start:s,end:e.length}),t}const Xe=e=>{if(!e.startsWith('"'))return e;const t=e.slice(1);return t.endsWith('"')?t.slice(0,-1):t};function Ze(e){const t=e.indexOf(":");if(t<=0)return;const s=e.slice(t+1);return{name:e.slice(0,t).toLowerCase(),value:Xe(s),rawValue:s}}const Je=e=>/[\s"]/.test(e),et=e=>Je(e)?`"${e.replace(/"/g,"")}"`:e,Ct=(e,t)=>`${e}:${et(t)}`,D=(e,t=Date.now())=>({value:e,setAt:t}),tt=(e,t,s,r)=>{if(e.addressId!==t)return e;const n={...e.flags??{}};return s?n.trusted=D(!0,r):delete n.trusted,{...e,flags:n}},st=(e,t,s,r)=>{const n=o=>o.map(d=>tt(d,t,s,r));return{...e,envelope:{...e.envelope,from:n(e.envelope.from),to:n(e.envelope.to),cc:n(e.envelope.cc),bcc:n(e.envelope.bcc),replyTo:n(e.envelope.replyTo)}}},rt=({messageId:e})=>{const t=Z(),{pushError:s}=J(),{mutate:r,isPending:n,error:o,reset:d}=ee({...re(),onMutate:async i=>{const c=i.path.addressId,m=i.body.flags?.trusted?.value===!0,f=se({path:{messageId:e}});await t.cancelQueries({queryKey:f});const p=t.getQueriesData({queryKey:f}).filter(l=>l[1]!==void 0).map(([l,x])=>({queryKey:l,data:x}));return t.setQueriesData({queryKey:f},l=>l&&st(l,c,m)),{describePrefix:f,previous:p}},onError:(i,c,u)=>{if(u)for(const m of u.previous)t.setQueryData(m.queryKey,m.data);s(te("Couldn't trust sender","The change wasn't saved.",i))},onSettled:(i,c,u,m)=>{m&&t.invalidateQueries({queryKey:m.describePrefix})}});return{toggleTrusted:(i,c)=>{r({path:{addressId:i},body:{flags:{trusted:D(!c)}}})},isPending:n,error:o,reset:d}},nt=()=>{const[e,t]=h.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return h.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{t(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),e},at=(e,t)=>{const s=`${e} image${e>1?"s":""}`;return t?`${s} hidden — you blocked this sender`:`${s} blocked for privacy`},ot=({blockedImageCount:e,canAlwaysTrust:t,isTrustPending:s,isSenderBlocked:r,onLoadOnce:n,onAlwaysTrust:o})=>a.jsxs("div",{"data-testid":"blocked-images-notice",className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[a.jsx("span",{className:"text-fg-muted",children:at(e,r)}),!r&&a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:n,className:"text-accent hover:underline",children:"Load once"}),t&&a.jsx("button",{type:"button",onClick:o,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),it=(e,t)=>{switch(e){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:t}}},ct=e=>e instanceof le?e.reason:"generic",lt=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while loading the message body.",dt=({error:e,onRetry:t})=>{const s=ct(e),r=lt(e),{title:n,detail:o}=it(s,r),[d,g]=h.useState(!1),{Account:i}=ne();return d?null:a.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[a.jsx(ae,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-medium text-danger",children:n}),a.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&a.jsx(i,{children:({signOut:c})=>a.jsx("button",{type:"button",onClick:()=>c(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),t&&a.jsx("button",{type:"button",onClick:t,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),a.jsx("button",{type:"button",onClick:()=>g(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:a.jsx(oe,{className:"size-4","aria-hidden":"true"})})]})]})},ut=()=>a.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),a.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),R=()=>a.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Tt=({bodyParts:e,html:t,text:s,isTrusted:r=!1,isBlocked:n=!1,messageId:o,fromAddressId:d,category:g,className:i})=>{const[c,u]=h.useState(!1),[m,f]=h.useState(o);m!==o&&(f(o),u(!1));const p=!n&&(r||c),l=nt(),{toggleTrusted:x,isPending:w}=rt({messageId:o??""}),y=!!e&&e.length>0,{picked:z,data:v,isLoading:P,isError:K,error:F,refetch:H}=de({messageId:o,bodyParts:e,enabled:y}),G=h.useMemo(()=>je(e??[]),[e]),U=y&&v?.kind==="html"?v.body:t,W=y&&v?.kind==="text"?v.body:s;if(y){if(P)return a.jsx("div",{className:b("message-body",i),children:a.jsx(ut,{})});if(K)return a.jsx("div",{className:b("message-body",i),children:a.jsx(dt,{error:F,onRetry:()=>H()})});if(!z)return a.jsx("div",{className:b("message-body",i),children:a.jsx(R,{})})}else if(!t&&!s)return a.jsx("div",{className:b("message-body",i),children:a.jsx(R,{})});const V=!!(d&&o),Q=()=>{!d||w||(u(!0),x(d,!1))};return a.jsx(Ye,{className:i,html:U,text:W,isDark:l,category:g,allowImages:p,resolveCid:G,renderBlockedNotice:q=>a.jsx(ot,{blockedImageCount:q,canAlwaysTrust:V,isTrustPending:w,isSenderBlocked:n,onLoadOnce:()=>u(!0),onAlwaysTrust:Q})})},mt=Object.values(_).map(e=>({value:e,label:I[e]})),ft={unclassified:"uncategorized"},ht=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:mt},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],gt=new Map(ht.map(e=>[e.name,e])),jt=e=>gt.get(e.toLowerCase()),pt=/^\d{4}-\d{2}-\d{2}$/;function bt(e,t,s){if(!pt.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:e,raw:t,value:s,epochSeconds:Math.floor(r/1e3)}}function yt(e){const t=e.toLowerCase(),s=ft[t];return s||Object.values(_).find(n=>n===t)}function xt(e,t){switch(t.toLowerCase()){case"unread":return{type:"isUnread",raw:e};case"read":return{type:"isRead",raw:e};case"starred":case"flagged":return{type:"isStarred",raw:e};default:return}}function wt(e,t){const s=Ze(e);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:e,value:n};case"subject":return{type:"subject",raw:e,value:n};case"category":{const o=yt(n);return o?{type:"category",raw:e,value:n,category:o}:void 0}case"is":return xt(e,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:e}:void 0;case"before":case"after":return bt(r,e,n);case"in":{const o=t.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:e,value:n,mailboxId:o}:void 0}case"account":{const o=t.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:e,value:n,accountId:o}:void 0}default:return}}function Lt(e,t={}){const s=[],r=[];for(const n of M(e)){const o=wt(n.raw,t);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Rt(e,t){return M(e).filter(s=>s.raw!==t.raw).map(s=>s.raw).join(" ")}function _t(e){switch(e.type){case"from":return`From: ${e.value}`;case"subject":return`Subject: ${e.value}`;case"category":return`Category: ${I[e.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${e.value}`;case"after":return`After ${e.value}`;case"in":return`In: ${e.value}`;case"account":return`Account: ${e.value}`}}function It(){const{mailboxNameIndex:e,accountNameIndex:t}=ie(),s=ce();return{...ue(s)?{}:{mailboxesByName:e},accountsByName:t}}export{Et as M,Nt as R,ht as S,Ye as a,rt as b,Tt as c,jt as d,M as e,Ze as f,Ct as g,Lt as p,Rt as r,_t as s,It as u};
|
|
@@ -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,cy as A,ek as R,r as v,dw as w,j as p,el as h,em as j,en as D,C as _,cn as N,c as Q,dR as z,d4 as O}from"./index-Q4feV5hs.js";import{c as U}from"./popover-menu-TKxn0teJ.js";import{aj as q}from"./MailListHeader-B8KqCoIm.js";import{a as P}from"./useLabels-BCVlkzT_.js";import{n as B}from"./search-query-Cr_ZXBCp.js";import{b as F}from"./search-scope-B5-OK3Cq.js";import{u as G,p as H}from"./useSearchTokenContext-BtJhq-_Q.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(q(d.body.messageIds??[],s??[],t)))}});return{applyLabel:v.useCallback((r,u,d)=>{r.length!==0&&w(r,m=>c({body:{messageIds:m,labelId:u,action:d}}))},[c]),isPending:a}};function re({accountId:e,mailboxId:t,messageIds:s}){const{labels:n}=P(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 ${j(a.color)?h[a.color]:h.Default}`}),onSelect:()=>l(s,a.labelId,"Apply")})),[n,s,l]);return c.length===0?null:p.jsx(U,{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=B(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=F({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-Q4feV5hs.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-Q4feV5hs.js"></script>
|
|
42
42
|
<link rel="stylesheet" crossorigin href="/assets/index-CzAIxx9Z.css">
|
|
43
43
|
</head>
|
|
44
44
|
<body>
|