@remit/web-client-dist 0.0.356 → 0.0.358
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-YxP0nBcU.js +1 -0
- package/assets/{ErrorState-iyZ1eEDd.js → ErrorState-BnG-HaD4.js} +1 -1
- package/assets/FlaggedPane-C9Tl8Sgb.js +1 -0
- package/assets/FullCompose-CPdM2XxU.js +1 -0
- package/assets/MailListHeader-Trtc8lfx.js +7 -0
- package/assets/MailViewChrome-BJ4q1GXR.js +1 -0
- package/assets/MailboxPane-DUPDvxrK.js +1 -0
- package/assets/{NavMenuButton-B8BvpOxY.js → NavMenuButton-O8AaZTpY.js} +1 -1
- package/assets/OnboardingWizard-CEm3zOtV.js +1 -0
- package/assets/OutboxPane-ZalnkqRY.js +1 -0
- package/assets/_mailboxId-DXY2DcuZ.js +1 -0
- package/assets/_messageId-ByR6_bo3.js +1 -0
- package/assets/_messageId-DJaF3SkN.js +1 -0
- package/assets/_messageId-YRdjdIfb.js +1 -0
- package/assets/_outboxMessageId-CkQCgzpt.js +1 -0
- package/assets/_threadId-Bd2uE3xH.js +1 -0
- package/assets/_threadId-BpRvUgZ7.js +1 -0
- package/assets/_threadId-CPMLmOLx.js +1 -0
- package/assets/account-form-helpers-DhckT_PN.js +1 -0
- package/assets/accounts-Bp1UvtHI.js +1 -0
- package/assets/{advanced-_W0aJq6k.js → advanced-JyuqGV4K.js} +2 -2
- package/assets/{appearance-BWPFtAqS.js → appearance-CJPxo4Dl.js} +1 -1
- package/assets/attachment-file-CMfx3CcW.js +1 -0
- package/assets/{avatar-DRzAUKDn.js → avatar-DqkGERXB.js} +1 -1
- package/assets/{bottom-sheet-CYAAzFs2.js → bottom-sheet-CNBsemxY.js} +1 -1
- package/assets/{brief-CdIy0xvq.js → brief-DMSyXbnZ.js} +1 -1
- package/assets/brief-citXjdnu.js +1 -0
- package/assets/{browser-ponyfill-CwHMNp32.js → browser-ponyfill-D4nvYSFj.js} +2 -2
- package/assets/{bug-aX2zoKsl.js → bug-BZM7jlIN.js} +1 -1
- package/assets/{circle-check-BpuRlCwV.js → circle-check-BsPPl8Vd.js} +1 -1
- package/assets/{circle-check-big-Ci4xk_eE.js → circle-check-big-Cn33pldS.js} +1 -1
- package/assets/{circle-help-l4FI_9La.js → circle-help-DWpn0l-r.js} +1 -1
- package/assets/{clock-x43VdT-G.js → clock-60QzMefl.js} +1 -1
- package/assets/compose-CqHqZWHD.js +1 -0
- package/assets/compose._-_outboxMessageId_-ByFahrZS.js +1 -0
- package/assets/compose._-_outboxMessageId_-C2HJn-2W.js +1 -0
- package/assets/compose._-_outboxMessageId_-CxA7rvH-.js +1 -0
- package/assets/compose._-_outboxMessageId_-oxU0Mfa7.js +1 -0
- package/assets/{confirm-dialog-DnhbOBfz.js → confirm-dialog-53Vs8qdX.js} +1 -1
- package/assets/{download-BDyamb4u.js → download-D1wer2rZ.js} +1 -1
- package/assets/{filters-Bi0ePbo2.js → filters-CMw41CNL.js} +1 -1
- package/assets/flagged-CY2Fx9HR.js +1 -0
- package/assets/{flagged-Djecuxf8.js → flagged-Cru9TjXl.js} +1 -1
- package/assets/folders-YVFNTyHN.js +1 -0
- package/assets/{index-CpL4QoWb.js → index-35SwEY68.js} +65 -65
- package/assets/index-B-qT49RY.js +1 -0
- package/assets/index-B3RVTIK6.js +1 -0
- package/assets/index-BdqDBo3X.js +46 -0
- package/assets/index-ByR6_bo3.js +1 -0
- package/assets/index-C7e45zc3.js +1 -0
- package/assets/index-DIOW99Bl.js +1 -0
- package/assets/index-DJaF3SkN.js +1 -0
- package/assets/index-Hzw2sya0.js +1 -0
- package/assets/index-VU4NiHyS.js +1 -0
- package/assets/{kbd-B-IGAdWZ.js → kbd-DRG84K0I.js} +1 -1
- package/assets/{labels-a3WH1yri.js → labels-9XIJbNPF.js} +1 -1
- package/assets/mail-C6L5FwL2.js +1 -0
- package/assets/mail-Dt38b6by.js +1 -0
- package/assets/{menu-C-178_d_.js → menu-DhWodGKO.js} +1 -1
- package/assets/move-options-DQMo_1sS.js +1 -0
- package/assets/onboarding-DELVHzq-.js +1 -0
- package/assets/outbox-DH9yQHIF.js +1 -0
- package/assets/{pencil-CzkYibYm.js → pencil-D_5c_wk2.js} +1 -1
- package/assets/{rich-text-CJKa3GnU.js → rich-text-DP-h8BHT.js} +3 -3
- package/assets/{rich-text-spellcheck-worker-provider-j4LLOI60.js → rich-text-spellcheck-worker-provider-GExspSVN.js} +1 -1
- package/assets/{rotate-ccw-Cvd6l1Qc.js → rotate-ccw-DZMpRbI3.js} +1 -1
- package/assets/{row-actions-B7ZYbUlo.js → row-actions-D0SH67tM.js} +1 -1
- package/assets/search-scope-D8eDCx--.js +1 -0
- package/assets/search-token-index-BUcol5TC.js +1 -0
- package/assets/search-view-gS47hGhs.js +1 -0
- package/assets/{senders-CWxy9PJx.js → senders-TcrlfWI1.js} +1 -1
- package/assets/settings-Esp4eIvp.js +1 -0
- package/assets/{settings-screen-3PVPPcG9.js → settings-screen-DhSJUsiq.js} +1 -1
- package/assets/{shield-check-DmRA-CPl.js → shield-check-CCXTGJKT.js} +1 -1
- package/assets/suggested-vips-t25EFcuR.js +1 -0
- package/assets/{useDebouncedValue-CwStTMs3.js → useDebouncedValue-BWx5HMb8.js} +1 -1
- package/assets/{useFilters-CZ4EVtAQ.js → useFilters-CWfk6Iq3.js} +1 -1
- package/assets/useLabels-BngSwTS5.js +1 -0
- package/assets/{useMediaQuery-DsLp21rD.js → useMediaQuery-DXxjKaoU.js} +1 -1
- package/assets/useMessageBodyContent-BZp02vgj.js +1 -0
- package/assets/useRefreshControl-Rijlvzuj.js +1 -0
- package/assets/useSearchMirror-DcLrKu1Z.js +1 -0
- package/assets/useSearchTokenContext-Cbnmmy2v.js +84 -0
- package/assets/useSemanticSearch-_Eo5DA7X.js +1 -0
- package/assets/useSignature-Bm--1yAp.js +1 -0
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/BriefPane-BS5Lq2MZ.js +0 -1
- package/assets/FlaggedPane-ktX1AK6k.js +0 -1
- package/assets/MailListHeader-DnFZsLU5.js +0 -52
- package/assets/MailViewChrome-B1N4z7Pm.js +0 -1
- package/assets/MailboxPane-Dhw8QEvL.js +0 -1
- package/assets/OnboardingWizard-D9QaA8wx.js +0 -1
- package/assets/OutboxPane-DTooYDng.js +0 -1
- package/assets/_mailboxId-0F2OLVkY.js +0 -1
- package/assets/_messageId-797n8gDL.js +0 -1
- package/assets/_messageId-BCsdFUs5.js +0 -1
- package/assets/_messageId-DqgcwsEx.js +0 -1
- package/assets/_outboxMessageId-M08TVdJj.js +0 -1
- package/assets/_threadId-B8Yjkmi1.js +0 -1
- package/assets/_threadId-DpOQd5cl.js +0 -1
- package/assets/_threadId-PwoZ7s3D.js +0 -1
- package/assets/account-form-helpers-n79hZWCu.js +0 -1
- package/assets/accounts-q2ynk-9Z.js +0 -1
- package/assets/brief-BvwMo2hW.js +0 -1
- package/assets/flagged-wK3gOzjd.js +0 -1
- package/assets/folders-DBvC38NY.js +0 -1
- package/assets/index-B9KGalbh.js +0 -1
- package/assets/index-BCsdFUs5.js +0 -1
- package/assets/index-C5ZngjHG.js +0 -1
- package/assets/index-CBqbCion.js +0 -1
- package/assets/index-CwyVlvub.js +0 -1
- package/assets/index-DqgcwsEx.js +0 -1
- package/assets/index-N4dCVq0Z.js +0 -1
- package/assets/index-vrrpqe4P.js +0 -1
- package/assets/mail-DT3RwCYm.js +0 -1
- package/assets/move-options-B-_O6Age.js +0 -1
- package/assets/nav-link-CI-9pBff.js +0 -1
- package/assets/onboarding-QXH9AO9A.js +0 -1
- package/assets/outbox-CUzX3SOD.js +0 -1
- package/assets/search-token-index-Bq5W3wIz.js +0 -1
- package/assets/search-view-BY8cFYny.js +0 -1
- package/assets/settings-AZpV762F.js +0 -1
- package/assets/suggested-vips-CFyVrNim.js +0 -1
- package/assets/useLabels-DsFfQJKo.js +0 -1
- package/assets/useRefreshControl-D0tR6FR3.js +0 -1
- package/assets/useSearchMirror-CadW6Xgb.js +0 -1
- package/assets/useSearchTokenContext-C5JJYphj.js +0 -84
- package/assets/useSemanticSearch-BM68RrQf.js +0 -1
- package/assets/useSignature-Db5YhvC8.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{db as r,dc as o,dd as a}from"./index-35SwEY68.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const c=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(),c(s),a(e))};export{i as openSpellcheckWorker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as t}from"./index-
|
|
1
|
+
import{c as t}from"./index-35SwEY68.js";const e=t("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{e as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,j as l,B as b,b as
|
|
1
|
+
import{r as e,j as l,B as b,b as y,af as x}from"./index-35SwEY68.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as t}from"./useMessageBodyContent-BZp02vgj.js";const n="search-scope";function r(o){const i=o.trim().replace(/\s+/g," ").toLowerCase();return/\s/.test(i)?`in:"${i}"`:`in:${i}`}function l(o){const i=t(o);return i!==void 0&&i.list!=="brief"}function s(o){const i=t(o);return i?.list==="mailbox"?i.mailboxId:void 0}function a(o){const i=s(o.matches);return i||(l(o.matches)?o.callerMailboxId:o.callerMailboxId??o.inTokenMailboxId)}function u(o,i){const e=t(o);return e?.list==="flagged"?{kind:"scoped",chip:{id:n,label:"is:starred"}}:e?.list==="outbox"?{kind:"scoped",chip:{id:n,label:"in:outbox"}}:e?.list==="mailbox"?i?{kind:"scoped",chip:{id:n,label:r(i)}}:{kind:"pending"}:{kind:"global"}}function d(o,i,e){return i.kind==="global"?{kind:"global"}:t(o)?.list==="flagged"?{kind:"collection"}:{kind:"folder",...e?{role:e}:{}}}export{n as S,u as a,d as b,l as i,s as r,a as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as Q,r as l,j as g,g as V,b as v,by as W,X as J,bz as X,bA as N,bB as Y,bC as Z,bD as q,n as ee,bE as te,bF as ne,bG as se,bH as re,bI as oe,bJ as ie,bK as K,bL as ae,bM as ce,w as C,p as le,q as B,v as ue,x as fe,m as de,l as he,bN as A}from"./index-35SwEY68.js";import{u as pe,c as me}from"./useMessageBodyContent-BZp02vgj.js";import{a as ge,S as ye}from"./search-scope-D8eDCx--.js";import{a as j,D as be}from"./useMediaQuery-DXxjKaoU.js";const _e=Q("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);const $e=Q("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),xe=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ue(e){return xe.filter(t=>e[t.action]!==void 0)}const we=[{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 ke(e){for(const t of we){const n=t.hints.find(s=>s.action===e);if(n)return n.keys}}function Ce(e){const t=ke(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function ze(e){const t=Ce(e);return t===""?"":`(${t})`}const E={action:null,nextPrefix:null,preventDefault:!1},ve={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},Se={j:{action:"focusNext"},k:{action:"focusPrevious"},arrowdown:{action:"focusNext"},arrowup:{action:"focusPrevious"},home:{action:"focusFirst"},end:{action:"focusLast"},enter:{action:"openFocused"}," ":{action:"toggleSelect"},delete:{action:"delete"},backspace:{action:"delete"},u:{action:"toggleRead"},x:{action:"toggleSelect"},r:{action:"reply"},a:{action:"replyAll"},f:{action:"forward"},"#":{action:"delete"},s:{action:"toggleStar"},m:{action:"muteSender"},b:{action:"blockSender"},v:{action:"vipSender"},"!":{action:"markJunk"},i:{action:"toggleIntelligence"},d:{action:"toggleDensity"},"/":{action:"focusSearch"},c:{action:"compose"},"?":{action:"help"}};function Ee(e,t){const n=e.key.toLowerCase(),s=e.metaKey||e.ctrlKey;if(e.inEditable)return{...E,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...E,nextPrefix:t==="g"?null:t};if(s&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(s&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(s)return{...E,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const i=ve[n===","?",":n]??null;return{action:i,nextPrefix:null,preventDefault:i!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const r=n==="j"||n==="arrowdown";if(r||(n==="k"||n==="arrowup"))return{action:r?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=Se[n];if(o){const r=o.requireShift===!0,i=n.length===1&&!/[a-z0-9]/.test(n);return!r&&e.shiftKey&&!i?E:{action:o.action,nextPrefix:null,preventDefault:!0}}return E}function Ie(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const Re="data-message-row",Te='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function Oe(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(Te);return t?!t.hasAttribute(Re):!1}function Pe({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:s,hasValue:o,chipCount:r}){const i=r-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:i}:e==="Backspace"||e==="ArrowLeft"?!s||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:i}:{type:"none"}}function Me({key:e,repeat:t=!1,index:n,chipCount:s}){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>=s-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function De(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const Ne=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,Le=({chips:e=[],onRemoveChip:t,value:n,onChange:s,onClear:o,onClearQuery:r,placeholder:i="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:m="sm",inputId:u,suggest:h,className:x})=>{const I=l.useId(),S=u??I,p=l.useRef(null),y=l.useRef([]),b=r??o,[R,T]=l.useState(null),P=l.useRef(void 0),[_,$]=l.useState(""),M=e.length>0;l.useEffect(()=>{T(a=>a!==null&&a>=e.length?null:a)},[e.length]),l.useEffect(()=>{const a=P.current;if(a!==void 0){if(P.current=void 0,a===null){p.current?.focus();return}y.current[a]?.focus()}});const L=l.useRef(void 0);l.useEffect(()=>{const a=h?.caret;if(!a||a===L.current)return;L.current=a;const d=p.current;!d||d.ownerDocument.activeElement!==d||(d.setSelectionRange(a.cursor,a.cursor),h?.onCaretChange(a.cursor))});const O=a=>{h?.onCaretChange(a.selectionStart??a.value.length)},w=l.useCallback(a=>{T(a),P.current=a},[]),D=l.useCallback(a=>{const d=e[a];d&&t&&(w(De(a,e.length)),$(`${d.label} removed`),t(d.id))},[e,t,w]),U=l.useCallback(()=>{w(null),o()},[o,w]),z=l.useCallback(a=>{const d=a.currentTarget;if(h?.onKeyDown(a))return;const k=Pe({key:a.key,shiftKey:a.shiftKey,repeat:a.repeat,caretAtStart:d.selectionStart===0&&d.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(k.type){case"focusChip":a.preventDefault(),w(k.index);return;case"clearQuery":b();return;case"blur":d.blur();return;case"none":return}},[e.length,n,b,w,h]),G=l.useCallback(a=>d=>{const k=Me({key:d.key,repeat:d.repeat,index:a,chipCount:e.length});switch(k.type!=="none"&&d.preventDefault(),k.type){case"removeChip":D(k.index);return;case"focusChip":w(k.index);return;case"focusInput":w(null);return;case"activateChip":return;case"none":return}},[e,D,w]);return l.useEffect(()=>{if(!c)return;const a=d=>{d.key!=="/"||d.metaKey||d.ctrlKey||d.altKey||Ne(d.target)||(d.preventDefault(),p.current?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[c]),g.jsxs("label",{htmlFor:S,className:v("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",x),children:[g.jsx(V,{className:v("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),g.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[M&&g.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((a,d)=>g.jsx(W,{ref:k=>{y.current[d]=k},label:a.label,tone:a.tone,focused:R===d,onFocusLabel:()=>T(d),onKeyDown:G(d),onRemove:()=>D(d)},a.id))}),g.jsx("input",{ref:p,id:S,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:R===null?0:-1,onChange:a=>{s(a.target.value),O(a.target)},onKeyDown:z,onKeyUp:a=>O(a.currentTarget),onClick:a=>O(a.currentTarget),onFocus:a=>{T(null),h?.onFocusChange?.(!0),O(a.currentTarget)},onBlur:()=>h?.onFocusChange?.(!1),...h?.comboboxProps,placeholder:M?void 0:i,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||M)&&f&&g.jsx("button",{type:"button",onClick:U,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:g.jsx(J,{className:v("text-fg-muted",m==="lg"?"size-5":"size-4")})}),g.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:_})]})},Ge=({value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:m,inputId:u,suggest:h,className:x})=>g.jsx(Le,{value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i,globalFocusKey:c,showClearButton:f,size:m,inputId:u,suggest:h,className:x});function Ve({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:s=1e3}){const o=l.useRef(e);o.current=e;const r=l.useRef(null),i=l.useRef(null);l.useEffect(()=>{if(!t)return;const c=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},f=u=>{const h=Ee({key:u.key,shiftKey:u.shiftKey,metaKey:u.metaKey,ctrlKey:u.ctrlKey,altKey:u.altKey,inEditable:Ie(u.target),onControl:Oe(u.target)},r.current);if(c(),r.current=h.nextPrefix,h.nextPrefix!==null&&(i.current=setTimeout(()=>{r.current=null,i.current=null},s)),h.action===null)return;const x=o.current[h.action];x&&(h.preventDefault&&u.preventDefault(),x())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",f),()=>{m.removeEventListener("keydown",f),c(),r.current=null}},[t,s,n])}function F(e,t){const n=new Set(t);return e.filter(s=>!n.has(s))}function Ke(e,t,n){const s=e.slice(0);return s[t]=n,s}var Ae=class extends X{#r;#e;#o;#s;#t;#n;#i;#a;#c;#l=[];constructor(e,t,n){super(),this.#r=e,this.#s=n,this.#o=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#h(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#o=e,this.#s=t,N.batch(()=>{const n=this.#t,s=this.#d(this.#o);s.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const o=s.map(u=>u.observer),r=o.map(u=>u.getCurrentResult()),i=n.length!==o.length,c=o.some((u,h)=>u!==n[h]),f=i||c,m=f?!0:r.some((u,h)=>{const x=this.#e[h];return!x||!Y(u,x)});!f&&!m||(f&&(this.#l=s,this.#t=o),this.#e=r,this.hasListeners()&&(f&&(F(n,o).forEach(u=>{u.destroy()}),F(o,n).forEach(u=>{u.subscribe(h=>{this.#h(u,h)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const n=this.#d(e),s=n.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions)),o=n.map(r=>r.defaultedQueryOptions.queryHash);return[s,r=>this.#f(r??s,t,o),()=>this.#u(s,n)]}#u(e,t){return t.map((n,s)=>{const o=e[s];return n.defaultedQueryOptions.notifyOnChangeProps?o:n.observer.trackResult(o,r=>{t.forEach(i=>{i.observer.trackProp(r)})})})}#f(e,t,n){if(t){const s=this.#c,o=n!==void 0&&s!==void 0&&(s.length!==n.length||n.some((r,i)=>r!==s[i]));return(!this.#n||this.#e!==this.#a||o||t!==this.#i)&&(this.#i=t,this.#a=this.#e,n!==void 0&&(this.#c=n),this.#n=Z(this.#n,t(e))),this.#n}return e}#m(){return this.#s?.combine!==void 0&&this.#t.some((e,t)=>e.options.suspense&&this.#e[t]?.data===void 0)}#d(e){const t=new Map;this.#t.forEach(s=>{const o=s.options.queryHash;if(!o)return;const r=t.get(o);r?r.push(s):t.set(o,[s])});const n=[];return e.forEach(s=>{const o=this.#r.defaultQueryOptions(s),i=t.get(o.queryHash)?.shift()??new q(this.#r,o);n.push({defaultedQueryOptions:o,observer:i})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Ke(this.#e,n,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#u(this.#e,this.#l),t=this.#m(),n=this.#n,s=t?n:this.#f(e,this.#s?.combine);(t||n!==s)&&N.batch(()=>{this.listeners.forEach(o=>{o(this.#e)})})}}};function H({queries:e,...t},n){const s=ee(),o=te(),r=ne(),i=l.useMemo(()=>e.map(p=>{const y=s.defaultQueryOptions(p);return y._optimisticResults=o?"isRestoring":"optimistic",y}),[e,s,o]);i.forEach(p=>{se(p);const y=s.getQueryCache().get(p.queryHash);re(p,r,y)}),oe(r);const[c]=l.useState(()=>new Ae(s,i,t)),[f,m,u]=c.getOptimisticResult(i,t.combine),h=!o&&t.subscribed!==!1;l.useSyncExternalStore(l.useCallback(p=>h?c.subscribe(N.batchCalls(p)):ie,[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),l.useEffect(()=>{c.setQueries(i,t)},[i,t,c]);const I=f.some((p,y)=>K(i[y],p))?f.flatMap((p,y)=>{const b=i[y];if(b&&K(b,p)){const R=new q(s,b);return ae(b,R,r)}return[]}):[];if(I.length>0)throw Promise.all(I);const S=f.find((p,y)=>{const b=i[y];return b&&ce({result:p,errorResetBoundary:r,throwOnError:b.throwOnError,query:s.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(S?.error)throw S.error;return m(u())}function We(){const e=C({from:"/mail/brief/$threadId",shouldThrow:!1}),t=C({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=C({from:"/mail/flagged/$threadId",shouldThrow:!1}),s=C({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),o=C({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=C({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),i=e?.threadId??n?.threadId??o?.threadId,c=t?.messageId??s?.messageId??r?.messageId;return l.useMemo(()=>i?{threadId:i,messageId:c}:void 0,[i,c])}const Je=({trigger:e,children:t,align:n="right"})=>{const[s,o]=l.useState(!1),r=l.useRef(null),i=l.useCallback(f=>{r.current&&!r.current.contains(f.target)&&o(!1)},[]),c=l.useCallback(f=>{f.key==="Escape"&&o(!1)},[]);return l.useEffect(()=>(s&&(document.addEventListener("mousedown",i),document.addEventListener("keydown",c)),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",c)}),[s,i,c]),g.jsxs("div",{ref:r,className:"relative",children:[g.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),o(!s)},className:v("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:e}),s&&g.jsx("div",{className:v("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",n==="right"?"right-0":"left-0"),children:t})]})},Xe=({onClick:e,disabled:t,destructive:n,children:s})=>g.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:v("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",n&&"text-danger hover:text-danger"),children:s}),Ye=()=>g.jsx("div",{className:"my-1 h-px bg-line"}),je=({accounts:e})=>{const t=C({strict:!1}),n=pe(),s=t.mailboxId,{t:o}=le("mail",{useSuspense:!1}),r=l.useCallback((c,f)=>o(c,{defaultValue:f}),[o]),i=H({queries:e.map(c=>({...B({path:{accountId:c.accountId}}),staleTime:1/0}))});if(n.pathname.startsWith("/mail/outbox"))return"Outbox";if(!s)return null;for(let c=0;c<e.length;c++){const f=i[c]?.data?.items;if(!f)continue;const m=f.find(h=>h.mailboxId===s);if(!m)continue;const u=ue(e[c].folderAppointments);return fe(m,u.get(s),r)}return null},Ze=({accounts:e})=>{const n=C({strict:!1}).mailboxId,s=H({queries:e.map(o=>({...B({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!n)return null;for(const o of s){const r=o.data?.items;if(!r)continue;const i=r.find(c=>c.mailboxId===n);if(i)return i.unseenCount}return null};function et(e){const t=de(),{searchInput:n}=he(),s=je({accounts:e}),o=me({select:c=>c.matches}),r=ge(o,s),i=l.useCallback(c=>{c===ye&&t({to:"/mail/brief",search:{q:n||void 0}})},[t,n]);return{scope:r,clearScope:i}}const Fe=768,tt=e=>e!=="desktop",nt=()=>{const e=j(`(min-width: ${Fe}px)`);return j(be)?"desktop":e?"tablet":"phone"};function st(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase(),o=s.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(s)||t.set(s,n.accountId)}return t}function rt(e){const t=new Map;for(const n of e)for(const s of n){const o=s.fullPath?.toLowerCase();if(!o)continue;const r=o.split("/").pop();t.has(o)||t.set(o,s.mailboxId),r&&!t.has(r)&&t.set(r,s.mailboxId)}return t}function ot(e,t=[]){const n=e.flat().filter(r=>r.fullPath),s=new Map;for(const r of n){const i=A(r.fullPath).toLowerCase();s.set(i,(s.get(i)??0)+1)}const o=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const i=A(r.fullPath),c=s.get(i.toLowerCase())===1,f=t.length>1?o.get(r.accountId):void 0;return{value:c?i:r.fullPath,label:r.displayNameOverride?.trim()||i,...f?{hint:f}:{}}})}function it(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase().split("@")[0]??"";t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=n.email.split("@")[0]??n.email,o=t.get(s.toLowerCase())===1,r=n.displayName?.trim();return{value:o?s:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{_e as B,Je as D,we as K,$e as R,Ge as S,Ye as a,Xe as b,H as c,rt as d,nt as e,We as f,Ve as g,st as h,tt as i,je as j,Ze as k,xe as l,Re as m,ot as n,it as o,Ue as p,Ce as s,ze as t,et as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as u,j as r,Z as l,_ as p}from"./index-35SwEY68.js";import{F as v}from"./FullCompose-CPdM2XxU.js";import{a as m}from"./compose-CqHqZWHD.js";import{e as x}from"./useMessageBodyContent-BZp02vgj.js";const c=u.createContext(null),d=({chrome:o,children:n})=>r.jsx(c.Provider,{value:o,children:n});function j({phone:o,list:n,reading:s,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=m();if(!e)return r.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:r.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?r.jsx(p,{...i,list:f?r.jsx(v,{}):o,intelligenceOpen:e.intelligenceOpen}):r.jsx(p,{...i,topBar:e.topBar,list:n,reading:s,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}function C(o,n,s){if(o!==n)return s}function M(o,n){return o===""?"":n}function N({searchInput:o,committedQuery:n,urlQuery:s,pathname:t,listPath:a}){return!x(t,a)||n!==o?!1:n!==s}export{d as M,j as a,N as b,M as c,C as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,b as N,
|
|
1
|
+
import{j as e,b as N,m as z,r as c,ar as L,ad as O,g as $,av as q,s as I,b3 as A,n as k,a7 as C,b4 as M,b5 as P,B as S,a as R,b6 as B,X as G}from"./index-35SwEY68.js";import{K as m}from"./kbd-DRG84K0I.js";import{S as Q,a as E}from"./settings-screen-DhSJUsiq.js";import{E as V}from"./ErrorState-BnG-HaD4.js";import{u as K}from"./useDebouncedValue-BWx5HMb8.js";import{a as _}from"./format-De9HZKjg.js";import"./avatar-DqkGERXB.js";import"./menu-DhWodGKO.js";import"./circle-help-DWpn0l-r.js";function D({options:t,active:r,onSelect:x}){return e.jsx("div",{role:"tablist",className:N("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(a=>{const d=a.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>x(a.id),className:N("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:a.label}),e.jsx("span",{className:N("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:a.count??"—"})]},a.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"},F=e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"VIP"})," senders get priority surface in the daily brief and notification escalation, even when an account is quiet."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Muted"})," senders never notify and stay out of the brief. Their mail still syncs and stays searchable."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Blocked"})," senders never load images and go straight to junk."]}),e.jsxs("p",{children:["Tip: flag from the keyboard on any message — ",e.jsx(m,{children:"v"})," VIP,"," ",e.jsx(m,{children:"m"})," mute, ",e.jsx(m,{children:"b"})," block. Every rule an automation creates shows up here and can be removed."]})]});function H({query:t,onCount:r}){const{data:x,isPending:a,isError:d,error:b}=I(A()),h=k(),i=C({...P(),onSettled:()=>{h.invalidateQueries({queryKey:M()})}}),l=x?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(n=>(n.displayName??"").toLowerCase().includes(p)||n.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),a?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(m,{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(n=>e.jsx(E,{name:n.displayName??n.normalizedEmail,email:n.normalizedEmail,meta:n.replyCount>0?`${n.inboundCount} received · you replied ${n.replyCount}×`:`${n.inboundCount} received · you've never replied`,trailing:e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:n.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},n.addressId))]})}function U({group:t,query:r,onCount:x}){const a=K(r.trim(),300),d=k(),[b,h]=c.useState(null),i=a.length>=2,l=B({query:{q:a,limit:50}}),{data:p,isPending:u,isError:n,error:j}=I({...l,enabled:i}),g=C({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),f=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{x?.(i?f.length:0,null)},[x,i,f.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):n?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):f.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",a,"”."]}):e.jsx(e.Fragment,{children:f.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&_(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=g.isPending&&g.variables?.path.addressId===s.addressId,T=g.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:T?e.jsx(S,{variant:"secondary",size:"sm",onClick:()=>{h(s.addressId),g.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}})},children:"Retry"}):e.jsx(S,{variant:"ghost",size:"sm",icon:e.jsx(G,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(h(s.addressId),g.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}}))}})},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(m,{children:"m"})," on any message to mute its sender; ",e.jsx(m,{children:"b"})," to block."]})]})}function ae(){const t=z(),[r,x]=c.useState("vip"),[a,d]=c.useState(""),[b,h]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),n=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),g=p[r],f=s=>{const o=q[s];o&&t({to:o})};return e.jsx(Q,{items:L,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:F,helpOpen:b,onToggleHelp:()=>h(s=>!s),onSelect:f,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(D,{active:r,onSelect:s=>{x(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(O,{icon:e.jsx($,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:a,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:a,onCount:n}):e.jsx(U,{group:r,query:a,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:g!=null?`${i} of ${g} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(m,{children:"j"})," ",e.jsx(m,{children:"k"})," navigate · ",e.jsx(m,{children:"⌫"})," remove flag"]})]})]})]})})}export{ae as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,U as o}from"./index-35SwEY68.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as z,r as j,j as e,b as f,B as i,X as N,
|
|
1
|
+
import{c as z,r as j,j as e,b as f,B as i,X as N,at as S}from"./index-35SwEY68.js";import{A as w}from"./avatar-DqkGERXB.js";import{M as B}from"./menu-DhWodGKO.js";import{C as v}from"./circle-help-DWpn0l-r.js";const h=z("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);function F({items:l,activeId:t,title:c,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:u,onBackToMail:m}){const[y,x]=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),x(!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:()=>x(!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?.(),x(!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:()=>x(!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(B,{className:"size-4"}),className:"lg:hidden",onClick:()=>x(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:c}),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 R({name:l,email:t,meta:c,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:[c,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:c,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(S,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",c," · ",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,F as S,R as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./index-
|
|
1
|
+
import{c as e}from"./index-35SwEY68.js";const c=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{c as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,$ as e}from"./index-35SwEY68.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o}from"./index-
|
|
1
|
+
import{r as o}from"./index-35SwEY68.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 m,
|
|
1
|
+
import{r as m,a7 as b,cZ as E,s as C,c_ as x,cG as F,c$ as D,n as M,d0 as N,d1 as P,d2 as L,d3 as z}from"./index-35SwEY68.js";const B=(e,t)=>{if(e.state==="Expired")return"Expired";if(e.scope!=="Temporary"||!e.expiresAt)return"Active";const r=Date.parse(e.expiresAt);return Number.isNaN(r)?"Active":r<=t?"Expired":"Active"},K=e=>{if(!e)return;const t=Date.parse(e);if(!Number.isNaN(t))return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})},O=(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=p=>String(p).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"),y=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"?O(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,_=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]=m.useState(),a=b({...E(),onSuccess:g=>r(g.organizeJobId)}),{mutate:i}=a,n=C({...x({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return v(I)?!1:$(g.state.dataUpdateCount)}}),s=m.useCallback(g=>{e&&i({path:{accountId:e},body:y(g)})},[e,i]),{refetch:o}=n,d=m.useCallback(()=>{o()},[o]),l=n.data,c=a.isPending?void 0:l,f=c?.state??a.data?.state,u=v(c?.state),p={state:f,matchedCount:c?.matchedCount??0,appliedCount:c?.appliedCount??0,failedCount:c?.failedCount??0,errorMessage:c?.errorMessage??""};return{start:s,refreshStatus:d,progress:p,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:J(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}},Q=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),j=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"?O(e.until??""):void 0}},q=(e,t)=>e.error!==void 0&&e.errorSignature===t?{status:"error",reason:e.error}:e.count===void 0?{status:"loading"}:e.previewedSignature===t?{status:"ready",count:e.count}:{status:"ready",count:e.count,stale:!0},H=350,re=(e,t,r)=>{const a=b(F()),{mutateAsync:i}=a,n=j(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const l=m.useRef(n),c=Q(t);return m.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:y({...d.current})}).then(p=>{l.current===u&&o({count:p.matchedCount,matchedIds:p.messageIds,previewedSignature:u})}).catch(p=>{l.current===u&&o(g=>({...g,error:p instanceof Error?p.message:"Couldn't count matches.",errorSignature:u}))})},H);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:q(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=M(),r=b({...N(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a,mutateAsync:i}=r,n=m.useCallback((o,d,l)=>{e&&a({path:{accountId:e},body:S(o,d,l)})},[e,a]),s=m.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=M(),r=b({...z(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a}=r;return{deleteFilter:m.useCallback(n=>{e&&a({path:{accountId:e,filterId:n}})},[e,a]),isPending:r.isPending,deletingFilterId:r.isPending?r.variables?.path.filterId:void 0}};export{h as N,Z as S,Y as a,A as b,te as c,K as d,se as e,B as f,ne as g,y as h,ae as i,X as j,G as k,ee as n,V as o,O as p,U as r,re as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as L,bt as p,n,a7 as l,bu as d,r as u,bv as y,bw as c,bx as g}from"./index-35SwEY68.js";const o=e=>y({path:{accountId:e}}),f=e=>{const s=L({...p({path:{accountId:e??""}}),enabled:!!e});return{labels:s.data?.items??[],isPending:s.isPending,isError:s.isError,error:s.error,refetch:s.refetch}},m=e=>{const s=n(),t=l({...d(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:o(e)})}}),{mutateAsync:r}=t;return{createLabel:u.useCallback((a,i="Default")=>e?r({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,r]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},h=e=>{const s=n(),t=l({...c(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:o(e)})}}),{mutate:r}=t;return{updateLabel:u.useCallback((a,i)=>{e&&r({path:{accountId:e,labelId:a},body:i})},[e,r]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const s=n(),t=l({...g(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:o(e)})}}),{mutate:r}=t;return{deleteLabel:u.useCallback(a=>{e&&r({path:{accountId:e,labelId:a}})},[e,r]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{f as a,h as b,C as c,m as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s}from"./index-
|
|
1
|
+
import{r as s}from"./index-35SwEY68.js";const r=1024,c=`(min-width: ${r}px) and (not ((orientation: portrait) and (pointer: coarse)))`,d=e=>{const[o,n]=s.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return s.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=i=>n(i.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o},m=()=>d(c);export{c as D,d as a,m as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bO as x,bP as k,bQ as E,r as u,bR as _,m as M,j as U,bS as D,bT as v,W as C,k as N,n as P,s as F,bU as B,bV as $}from"./index-35SwEY68.js";import{u as K}from"./useMediaQuery-DXxjKaoU.js";function ue(e){const t=x({warn:e?.router===void 0}),n=e?.router||t;return k(n.stores.__store,E(e,n))}function Q(e){const t=x();return k(t.stores.location,E(e,t))}const S="/mail/brief",A="/mail/$mailboxId",T="/mail/outbox",I="/mail/flagged";function q(e){for(const t of e){if(t.routeId===S)return{list:"brief"};if(t.routeId===I)return{list:"flagged"};if(t.routeId===T)return{list:"outbox"};if(t.routeId===A)return{list:"mailbox",mailboxId:t.params?.mailboxId}}}function le(e){const t=q(e);if(!t)return"";switch(t.list){case"mailbox":return t.mailboxId?j(t.mailboxId):"";case"flagged":return I;case"outbox":return T;case"brief":return S}}function j(e){return`${A}:${e}`}function fe(e,t){return e===t?!0:e.startsWith(`${t}/`)}function de(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);return t[0]==="mail"&&t.length>2}const g=["intelligence","nav","shortcuts"],V=["nav","shortcuts"],W=e=>V.includes(e),X=_(g);function b(e){const t=new Set(e.split(",").map(n=>X.safeParse(n)).filter(n=>n.success).map(n=>n.data));return g.filter(n=>t.has(n))}function R(e){return g.filter(t=>e.includes(t)).join(",")}function ye(){const e=Q({select:t=>R(b(t.hash))});return u.useMemo(()=>b(e),[e])}const G=(e,t)=>!W(e)&&t;function H(e){return(t="")=>R(b(t).filter(n=>G(n,e)))}function z(){const e=K();return u.useMemo(()=>H(e),[e])}function he(){const e=M();return u.useCallback(t=>{e({search:!0,hash:R(t),replace:!0,hashScrollIntoView:!1})},[e])}const Y=D(v);function me({fragment:e,...t}){const n=z();return U.jsx(Y,{...t,hash:e??n})}const J=e=>{const t=e.filter(s=>!s.isMultipart&&s.disposition!=="attachment"&&s.mediaType==="TEXT"&&s.contentUrl.length>0),n=t.find(s=>s.mediaSubtype.toUpperCase()==="HTML");if(n)return{kind:"html",contentUrl:n.contentUrl};const r=t.find(s=>s.mediaSubtype.toUpperCase()==="PLAIN");return r?{kind:"text",contentUrl:r.contentUrl}:null},p={all:["messages"],detail:e=>[...p.all,"detail",e],body:e=>[...p.detail(e),"body"]};class f extends Error{reason;status;retryAfterSeconds;constructor(t,n,r,s){super(n),this.name="BodyFetchError",this.reason=t,this.status=r,this.retryAfterSeconds=s}}const Z=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},ee=8,te="x-remit-403-reason",ne=(e,t)=>{const n=t?.trim()??"";return e===401?"auth":e===403?n.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},re=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,se=(e,t)=>{const n=(t??"").toLowerCase();return!!(e==="text"&&n.startsWith("text/html"))},oe=async(e,t,n=async()=>null)=>{const r={},s=await n();s&&(r.Authorization=`Bearer ${s}`);const o=await $(e,{headers:r});if(o.status===202)throw new f("not-ready","Message body is still syncing",202,Z(o.headers.get("Retry-After")));if(!o.ok){const l=o.headers.get(te),h=ne(o.status,l);throw new f(h,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(se(t,a))throw new f("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const y=await o.text();if(re(y,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 y},ae=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),be=({messageId:e,bodyParts:t,enabled:n=!0})=>{const r=t?J(t):null,s=C(),{getToken:o}=N(),a=u.useRef(null),y=P(),l=u.useRef(!1),h=u.useRef(null),w=e&&r?`${e}:${r.contentUrl}`:null;h.current!==w&&(h.current=w,l.current=!1);const i=F({queryKey:e?[...p.body(e),r?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!r)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const d=l.current;return l.current=!1,ae({fetchContent:(c,L)=>oe(c,L,o),refetchDescribeMessage:()=>y.refetchQueries({queryKey:B({path:{messageId:e}})})},{contentUrl:r.contentUrl,kind:r.kind,isRetryAfterNotReady:d})},enabled:n&&!!e&&!!r,staleTime:300*1e3,gcTime:1800*1e3,retry:(d,c)=>c instanceof f&&c.reason==="not-ready"?d<ee:d<1,retryDelay:(d,c)=>c instanceof f&&c.reason==="not-ready"?(l.current=!0,(c.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),m=i.isLoading&&!!r;u.useEffect(()=>{m&&(a.current=performance.now())},[m]),u.useEffect(()=>{i.isSuccess&&a.current!==null&&(s.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[i.isSuccess,s]);const O=i.data&&r?{kind:r.kind,body:i.data}:void 0;return{picked:r,data:O,isLoading:m,isError:i.isError,error:i.error,refetch:i.refetch}};export{f as B,me as N,ye as a,he as b,ue as c,q as d,fe as e,z as f,be as g,ne as h,W as i,de as l,le as m,Q as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as E,e as q,b as j,B as D,r as i,ax as R,n as C,l as K,W as A,J as Q,H,K as $,L as z}from"./index-35SwEY68.js";import{C as B}from"./circle-check-big-Cn33pldS.js";import{R as G,c as P}from"./search-token-index-BUcol5TC.js";function oe({state:e,onRefresh:t,label:s,errorMessage:a,hasUpdate:n,size:u="sm",className:c}){const o=e==="refreshing",f=e==="error",h=e==="success",g=f?E.jsx(q,{className:"size-4 text-danger"}):h?E.jsx(B,{className:"size-4 text-positive"}):E.jsx(G,{className:j("size-4",o&&"animate-spin")}),y=f?`${s} — failed: ${a??"try again"}`:o?`${s} — refreshing`:h?`${s} — up to date`:n?`${s} — new mail`:s;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx(D,{variant:"ghost",size:u,icon:g,onClick:t,disabled:o,"aria-label":y,"aria-busy":o||void 0,title:f?a:s,className:c}),e==="idle"&&n&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const W=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function L(e){return!!e&&W.has(e)}const N=3e3,U=N*2,M={syncing:!1,resolved:!1,synced:0,total:0};function ie(e,t){const s=e.join(","),[a,n]=i.useState(!1),[u,c]=i.useState(!1);i.useEffect(()=>{n(!1),c(!1)},[s,t]),i.useEffect(()=>{if(!t)return;const r=setTimeout(()=>c(!0),U);return()=>clearTimeout(r)},[s,t]);const o=P({queries:e.map(r=>({...R({path:{accountId:r}}),enabled:t&&!a,refetchInterval:N,meta:{softError:!0}}))}),f=o.every(r=>r.isSuccess||r.isError),h=o.length===0||f||u;let g=!1,y=0,w=0;for(const r of o)if(L(r.data?.syncPhase)){g=!0;for(const l of r.data?.mailboxes??[])y+=l.messagesSynced,w+=l.messagesTotal}const S=t&&h&&!g;return i.useEffect(()=>{S&&n(!0)},[S]),!t||!h?M:{syncing:g,resolved:!0,synced:y,total:w}}const k=6e4,I=new Set(["sent","drafts","trash","archive"]),v=(e,t)=>{const s=new Map;for(const a of e){const n=t.get(a.mailboxId)?.role;n&&I.has(n)||s.set(a.mailboxId,a.messagesTotal)}return s},J=(e,t)=>{for(const[s,a]of t)if(a>(e.get(s)??0))return!0;return!1},_=i.createContext(null),X=()=>{const e=i.useContext(_);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function ce({accountIds:e,children:t}){const s=C(),{resultFolderIndex:a}=K(),n=i.useRef(new Map),u=i.useRef(new Set),[c,o]=i.useState(new Set),f=P({queries:e.map(r=>({...R({path:{accountId:r}}),refetchInterval:k,staleTime:k,meta:{softError:!0}}))}),h=f.map(r=>r.dataUpdatedAt).join(","),g=e.join(",");i.useEffect(()=>{let r=!1;const l=new Set(c);e.forEach((d,x)=>{const p=f[x]?.data;if(!p)return;const m=v(p.mailboxes??[],a);if(!u.current.has(d)){u.current.add(d),n.current.set(d,m);return}if(l.has(d))return;const T=n.current.get(d)??new Map;J(T,m)&&(l.add(d),r=!0)}),r&&o(l)},[g,h]);const y=i.useCallback(r=>r.some(l=>c.has(l)),[c]),w=i.useCallback(r=>{o(l=>{if(r.every(x=>!l.has(x)))return l;const d=new Set(l);for(const x of r)d.delete(x);return d});for(const l of r){const d=s.getQueryData(R({path:{accountId:l}}).queryKey);n.current.set(l,v(d?.mailboxes??[],a)),u.current.add(l)}},[s,a]),S=i.useMemo(()=>({hasNewMail:y,acknowledge:w}),[y,w]);return E.jsx(_.Provider,{value:S,children:t})}const V=2e3,Y=45e3,Z=e=>new Promise(t=>setTimeout(t,e)),b=e=>e instanceof Error&&e.message?e.message:"Something went wrong",ee=e=>{$(e,{softError:!0})&&z(e)},F=e=>e.reduce((t,s)=>Math.max(t,s.lastSyncedAt??0),0),O=(e,t)=>e.fetchQuery({...R({path:{accountId:t}}),staleTime:0}),se=async(e,t,s,a)=>{let n=!1;for(;;){const u=await O(e,t).then(f=>({ok:!0,data:f})).catch(f=>({ok:!1,error:f}));if(!u.ok)return{accountId:t,message:b(u.error)};const{syncPhase:c,mailboxes:o}=u.data;if(L(c))n=!0;else if(n||F(o??[])>s)return c==="error"?{accountId:t,message:"Sync failed for this account"}:void 0;if(Date.now()>=a)return{accountId:t,message:"Refresh is taking longer than usual"};await Z(V)}},te=async(e,t,s,a)=>{const n=await O(e,s).then(o=>({ok:!0,maxLastSynced:F(o.mailboxes??[])})).catch(o=>({ok:!1,error:o}));if(!n.ok)return{accountId:s,enqueued:!1,ok:!1,message:b(n.error)};const u=await H({path:{accountId:s},throwOnError:!0}).then(()=>({ok:!0})).catch(o=>({ok:!1,error:o}));if(!u.ok)return ee(u.error),{accountId:s,enqueued:!1,ok:!1,message:b(u.error)};t.recordEvent("sync.triggered");const c=await se(e,s,n.maxLastSynced,a);return c?{accountId:s,enqueued:!0,ok:!1,message:c.message}:{accountId:s,enqueued:!0,ok:!0}},ue=(e,t={})=>{const s=C(),a=A(),{acknowledge:n}=X(),[u,c]=i.useState("idle"),[o,f]=i.useState(),h=i.useRef(0),g=i.useRef(e);g.current=e;const y=i.useRef(t);y.current=t,i.useEffect(()=>{if(u!=="success")return;const S=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(S)},[u]);const w=i.useCallback(()=>{const S=g.current;if(S.length===0){c("error"),f("Nothing to refresh yet");return}const r=++h.current;c("refreshing"),f(void 0),(async()=>{const l=Date.now()+Y,d=await Promise.all(S.map(m=>te(s,a,m,l)));if(h.current!==r)return;const x=d.filter(m=>m.enqueued).map(m=>m.accountId);for(const m of x)s.invalidateQueries({queryKey:Q({path:{accountId:m}})});x.length>0&&(y.current.onSettled?.(),n(x));const p=d.filter(m=>!m.ok);p.length===0?c("success"):(c("error"),f(p[0]?.message))})()},[n,s,a]);return{state:u,errorMessage:o,refresh:w}};export{ce as M,oe as R,ue as a,ie as b,L as i,X as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as d,l as v,P as x,r as h}from"./index-35SwEY68.js";import{c as Q}from"./useMessageBodyContent-BZp02vgj.js";import{b as I}from"./search-view-gS47hGhs.js";import{a as b}from"./compose-CqHqZWHD.js";function g(o){const s=d(),{searchInput:c,searchQuery:e}=v(),{q:i=""}=x({from:"/mail"}),n=Q({select:p=>p.location.pathname}),m=b(),a=h.useRef(i);a.current=i;const{to:r}=o,t="params"in o?o.params.mailboxId:void 0,l=t?`/mail/${t}`:r;h.useEffect(()=>{if(!I({searchInput:c,committedQuery:e,urlQuery:a.current,pathname:n,listPath:l}))return;const f=!!e&&a.current!==e&&!m,u=y=>({...y,q:e||void 0});if(!f){s({to:".",search:u,hash:!0,replace:!0});return}if(r==="/mail/$mailboxId"){if(!t)return;s({to:r,params:{mailboxId:t},search:u,hash:!0,replace:!0});return}s({to:r,search:u,hash:!0,replace:!0})},[c,e,s,r,t,l,n,m])}export{g as u};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import{bZ as V,r as g,j as a,b,I as Q,n as Y,a5 as q,a7 as X,a8 as Z,bU as J,b5 as ee,k as te,e as se,X as re,l as ne}from"./index-35SwEY68.js";import{K as k}from"./kbd-DRG84K0I.js";import{B as ae,g as oe,c as ie}from"./useMessageBodyContent-BZp02vgj.js";import{M as L}from"./enums-CCxx0t2v.js";import{i as ce}from"./search-scope-D8eDCx--.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
|
|
2
|
+
/* Zero the UA default body margin and clamp the document to the iframe width so
|
|
3
|
+
wide author markup can't push the body (and the page) past the viewport. */
|
|
4
|
+
html, body {
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
}
|
|
9
|
+
body {
|
|
10
|
+
overflow-wrap: anywhere;
|
|
11
|
+
word-break: break-word;
|
|
12
|
+
}
|
|
13
|
+
/* Media never wider than the frame; keep aspect ratio when width is capped. */
|
|
14
|
+
img, video, iframe, svg, canvas {
|
|
15
|
+
max-width: 100% !important;
|
|
16
|
+
height: auto;
|
|
17
|
+
}
|
|
18
|
+
/* Fixed-width author tables (\`<table width="600">\`) collapse to fit. */
|
|
19
|
+
table {
|
|
20
|
+
max-width: 100% !important;
|
|
21
|
+
table-layout: auto;
|
|
22
|
+
}
|
|
23
|
+
/* Cells carry the fixed widths in real newsletters (\`<td width="600">\`);
|
|
24
|
+
cap them too or the table can't actually shrink. */
|
|
25
|
+
td, th {
|
|
26
|
+
max-width: 100% !important;
|
|
27
|
+
}
|
|
28
|
+
/* \`max-width\` alone can't beat an inline \`min-width\`; zeroing the min lets
|
|
29
|
+
flex / grid / table children actually collapse to the clamped width. */
|
|
30
|
+
* {
|
|
31
|
+
min-width: 0;
|
|
32
|
+
}
|
|
33
|
+
/* An author \`nowrap\` assumes a viewport as wide as the line. The frame is the
|
|
34
|
+
pane's width whatever the mail is, so a pinned paragraph turns reading one
|
|
35
|
+
sentence into a sideways drag — and inside an author \`overflow:hidden\` it is
|
|
36
|
+
cut mid-character with nothing left to scroll at all. Flowing text wraps. The
|
|
37
|
+
\`i\` flag is load-bearing: Outlook and older generators emit \`WHITE-SPACE:
|
|
38
|
+
NOWRAP\`, and an attribute value match is case-sensitive without it. */
|
|
39
|
+
[nowrap]:not(pre, code, pre *, code *),
|
|
40
|
+
[style*="nowrap" i]:not(pre, code, pre *, code *) {
|
|
41
|
+
white-space: normal !important;
|
|
42
|
+
}
|
|
43
|
+
/* Long unbroken strings (URLs, tokens) wrap instead of forcing a wide line. */
|
|
44
|
+
pre, code {
|
|
45
|
+
white-space: pre-wrap;
|
|
46
|
+
overflow-wrap: anywhere;
|
|
47
|
+
word-break: break-word;
|
|
48
|
+
}
|
|
49
|
+
/* Preformatted text keeps its spacing even where a nowrap is declared — on the
|
|
50
|
+
block or on a span inside it. \`normal\` would collapse the runs of spaces that
|
|
51
|
+
are the entire content of a \`pre\`, and the un-important rule above cannot
|
|
52
|
+
defend an inline style, so this wraps to \`pre-wrap\` instead of unwrapping. */
|
|
53
|
+
:is(pre, code, pre *, code *):is([nowrap], [style*="nowrap" i]) {
|
|
54
|
+
white-space: pre-wrap !important;
|
|
55
|
+
}
|
|
56
|
+
`,ue=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,""))},me=/^(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},fe=e=>{const t=/background(?:-color)?\s*:\s*([^;}\n]+)/gi;let s;for(s=t.exec(e);s!==null;){const r=s[1].trim();if(!me.test(r))return!0;s=t.exec(e)}return!1},he=e=>{if(/\bstyle\s*=\s*["'][^"']*background/i.test(e)||/\bbgcolor\s*=/i.test(e))return!0;for(const t of _(e))if(fe(t))return!0;return!1},ge=new Set(["auto","none","initial","inherit","unset","revert","revert-layer"]),pe=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,""),E=e=>{const t=e.toLowerCase();if(!t||ge.has(t)||t.startsWith("-"))return!1;const s=/^\+?(\d*\.?\d+)[a-z%]*$/.exec(t);return s?Number.parseFloat(s[1])!==0:!0},ye=e=>{const t=e.split(/\s+/).filter(Boolean);return t.length<2?t:t.length<4?[t[1]]:[t[1],t[3]]},xe=(e,t)=>{if(e&&be.has(e))return!1;const s=t.replace(/!\s*important/gi,"").trim();return s?e?s.split(/\s+/).some(E):ye(s).some(E):!1},T=e=>{for(const t of B(e).matchAll(pe))if(xe(t[1],t[2]))return!0;return!1},I=new Set(["blockquote"]),we=e=>e.replace(/<!--[\s\S]*?-->/g,""),ve=e=>{const t=[],s=/<([a-zA-Z][\w:-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,r=/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;for(const[,n,o]of e.matchAll(s))for(const l of o.matchAll(r))t.push({tag:n.toLowerCase(),style:l[1]??l[2]??""});return t},ke=e=>[...B(e).matchAll(/([^{}]*)\{([^{}]*)\}/g)].map(t=>({selector:t[1].trim(),body:t[2]})),Se=e=>{const t=e.trim().split(/[\s>+~]+/).pop()??"";return(/^[a-zA-Z][\w-]*/.exec(t)?.[0]??"").toLowerCase()},Ae=e=>e.split(",").every(t=>I.has(Se(t))),Ee=e=>{const t=_(e),s=we(e);if(/\bcellpadding\s*=\s*["']?(?!0["'\s>])\d/i.test(s))return!0;for(const{tag:r,style:n}of ve(s))if(!I.has(r)&&T(n))return!0;for(const r of t)for(const n of ke(r))if(!Ae(n.selector)&&T(n.body))return!0;return!1},Te=["script","iframe","object","embed","form","input","button","textarea","select","meta","link","base"],Ne=["onerror","onload","onclick","onmouseover","onmouseout","onfocus","onblur","onsubmit","onkeydown","onkeyup","formaction","xlink:href","data-bind"],Ce="data:image/svg+xml,"+encodeURIComponent(`
|
|
57
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">
|
|
58
|
+
<rect fill="#f0f0f0" width="100" height="100"/>
|
|
59
|
+
<text x="50" y="50" text-anchor="middle" dy=".3em" fill="#999" font-size="12">
|
|
60
|
+
Image blocked
|
|
61
|
+
</text>
|
|
62
|
+
</svg>
|
|
63
|
+
`),je=e=>e.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Re=e=>e.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Le=(e={})=>{const t=V(),s={FORBID_TAGS:Te,FORBID_ATTR:Ne,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return t.addHook("afterSanitizeAttributes",r=>{if(r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const l=n.slice(4).replace(/^<|>$/g,""),m=e.resolveCid?.(l);m&&(r.setAttribute("src",m),r.classList.add("inline-content"));return}e.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",Ce),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",je(n))}}),t.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=Re(o)}}),r=>{const n=he(r),o=Ee(r),l=t.sanitize(r,s);return{html:`<style>${de()}</style>${l}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},_e='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',v={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)"}},Be={background:!1,spacing:!1},Ie="16px",Me=()=>`html{padding:0}body{padding:${Ie};box-sizing:border-box}`,Oe=()=>"html{overflow:hidden}body{overflow-x:auto}",$e=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,De='<meta name="viewport" content="width=device-width, initial-scale=1">',ze=e=>{const t=e?v.dark:v.light;return`
|
|
64
|
+
/* Plain-email base: UI font-stack + theme-aware colors (#424) */
|
|
65
|
+
html, body {
|
|
66
|
+
font-family: ${_e};
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
line-height: 1.6;
|
|
69
|
+
color: ${t.fg};
|
|
70
|
+
background-color: ${t.canvas};
|
|
71
|
+
margin: 0;
|
|
72
|
+
padding: 0;
|
|
73
|
+
}
|
|
74
|
+
/* Strip author unreadable text colors and element backgrounds, scoped to body
|
|
75
|
+
descendants so the themed html/body surface above survives this reset. */
|
|
76
|
+
body * {
|
|
77
|
+
color: inherit !important;
|
|
78
|
+
background-color: transparent !important;
|
|
79
|
+
}
|
|
80
|
+
a, a:visited {
|
|
81
|
+
color: ${t.accent} !important;
|
|
82
|
+
text-decoration: underline;
|
|
83
|
+
}
|
|
84
|
+
`},A="invert(0.92) hue-rotate(180deg)",N=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${A}}`,Pe=(e,t,s)=>{const r=e?v.dark.canvas:v.light.canvas;return s?e?t?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${A}}body{margin:0}${N}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":e?t?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${A}}${N}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},Ke=(e,t,s,r=Be)=>{const n=t==="plain"?ze(s):Pe(s,$e.test(e),r.background),o=r.spacing?"":Me();return`${De}<style>${n}</style>${e}<style>${Oe()}${o}</style>`},Fe=5e4,He="allow-same-origin allow-popups allow-popups-to-escape-sandbox",Ue=(e,t,s)=>Math.min(Math.ceil(Math.max(e,t)),s),Ge=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),We=e=>e===" "?!1:e.length===1?!0:Ge.has(e),S=e=>{if(e.metaKey||e.ctrlKey||e.altKey||!We(e.key))return;const t=e.currentTarget??e.target,s=t?.defaultView?.parent;!s||s===t?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:e.key,code:e.code,shiftKey:e.shiftKey,bubbles:!0,cancelable:!0}))},C=({html:e,variant:t="framed",isDark:s=!1,declares:r,className:n})=>{const o=g.useRef(null),[l,m]=g.useState(0),d=g.useMemo(()=>Ke(e,t,s,r),[e,t,s,r]);return g.useEffect(()=>{const c=o.current;if(!c)return;const f=()=>{const i=c.contentDocument;if(!i?.body)return;const x=i.documentElement,y=Ue(i.body.scrollHeight,x?.scrollHeight??0,Fe);m(w=>w===y?w:y)};let u,h;const p=()=>{f(),u?.disconnect(),u=void 0,h?.removeEventListener("keydown",S),h?.removeEventListener("load",f,!0),h=void 0;const i=c.contentDocument;i?.body&&(u=new ResizeObserver(f),u.observe(i.body),i.documentElement&&u.observe(i.documentElement),i.addEventListener("load",f,!0),i.fonts?.ready.then(f),i.addEventListener("keydown",S),h=i)};return c.addEventListener("load",p),()=>{c.removeEventListener("load",p),h?.removeEventListener("keydown",S),h?.removeEventListener("load",f,!0),u?.disconnect()}},[]),a.jsx("iframe",{ref:o,title:"Email content",sandbox:He,srcDoc:d,className:n,style:{width:"100%",border:"none",display:"block",height:l===0?"1px":`${l}px`,colorScheme:"normal"}})},j=()=>a.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),kt=({className:e,children:t})=>a.jsx("div",{className:b("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",e),children:t}),Ve=({html:e,text:t,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:l,renderBlockedNotice:m})=>{const d=g.useMemo(()=>!e||typeof document>"u"?null:Le({allowExternalImages:n,resolveCid:o})(e),[e,n,o]),c=d?.html??null,{framed:f,isPlain:u}=le(r,d?.hasAuthorBackground??!1),h=g.useMemo(()=>({background:d?.hasAuthorBackground??!1,spacing:d?.hasAuthorSpacing??!1}),[d?.hasAuthorBackground,d?.hasAuthorSpacing]),p=g.useMemo(()=>!c||n?0:(c.match(/data-blocked-src/g)||[]).length,[c,n]);return!c&&!t?a.jsx("div",{className:b("message-body",l),children:a.jsx(j,{})}):a.jsxs("div",{className:b("message-body",l),children:[p>0&&a.jsx("div",{children:m?.(p)}),c?a.jsx("div",{className:"message-body-frame",children:f?a.jsx("div",{className:"w-full max-w-full",children:a.jsx(C,{html:c,variant:"framed",isDark:s,declares:h})}):a.jsx("div",{className:"max-w-full lg:max-w-2xl",children:a.jsx(C,{html:c,variant:u?"plain":"framed",isDark:s,declares:h})})}):t?a.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:t}):a.jsx(j,{})]})};function St({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(Q,{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(k,{children:"j"})," / ",a.jsx(k,{children:"k"})," to move, ",a.jsx(k,{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 Qe=e=>{if(!e.startsWith('"'))return e;const t=e.slice(1);return t.endsWith('"')?t.slice(0,-1):t};function Ye(e){const t=e.indexOf(":");if(t<=0)return;const s=e.slice(t+1);return{name:e.slice(0,t).toLowerCase(),value:Qe(s),rawValue:s}}const qe=e=>/[\s"]/.test(e),Xe=e=>qe(e)?`"${e.replace(/"/g,"")}"`:e,At=(e,t)=>`${e}:${Xe(t)}`,O=(e,t=Date.now())=>({value:e,setAt:t}),Ze=(e,t,s,r)=>{if(e.addressId!==t)return e;const n={...e.flags??{}};return s?n.trusted=O(!0,r):delete n.trusted,{...e,flags:n}},Je=(e,t,s,r)=>{const n=o=>o.map(l=>Ze(l,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)}}},et=({messageId:e})=>{const t=Y(),{pushError:s}=q(),{mutate:r,isPending:n,error:o,reset:l}=X({...ee(),onMutate:async d=>{const c=d.path.addressId,u=d.body.flags?.trusted?.value===!0,h=J({path:{messageId:e}});await t.cancelQueries({queryKey:h});const p=t.getQueriesData({queryKey:h}).filter(i=>i[1]!==void 0).map(([i,x])=>({queryKey:i,data:x}));return t.setQueriesData({queryKey:h},i=>i&&Je(i,c,u)),{describePrefix:h,previous:p}},onError:(d,c,f)=>{if(f)for(const u of f.previous)t.setQueryData(u.queryKey,u.data);s(Z("Couldn't trust sender","The change wasn't saved.",d))},onSettled:(d,c,f,u)=>{u&&t.invalidateQueries({queryKey:u.describePrefix})}});return{toggleTrusted:(d,c)=>{r({path:{addressId:d},body:{flags:{trusted:O(!c)}}})},isPending:n,error:o,reset:l}},tt=()=>{const[e,t]=g.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return g.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{t(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),e},st=({blockedImageCount:e,canAlwaysTrust:t,isTrustPending:s,onLoadOnce:r,onAlwaysTrust:n})=>a.jsxs("div",{className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[a.jsxs("span",{className:"text-fg-muted",children:[e," image",e>1?"s":""," blocked for privacy"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:r,className:"text-accent hover:underline",children:"Load once"}),t&&a.jsx("button",{type:"button",onClick:n,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),rt=(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}}},nt=e=>e instanceof ae?e.reason:"generic",at=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while loading the message body.",ot=({error:e,onRetry:t})=>{const s=nt(e),r=at(e),{title:n,detail:o}=rt(s,r),[l,m]=g.useState(!1),{Account:d}=te();return l?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(se,{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(d,{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:()=>m(!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(re,{className:"size-4","aria-hidden":"true"})})]})]})},it=()=>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."}),Et=({bodyParts:e,html:t,text:s,isTrusted:r=!1,messageId:n,fromAddressId:o,category:l,className:m})=>{const[d,c]=g.useState(!1),f=r||d,u=tt(),{toggleTrusted:h,isPending:p}=et({messageId:n??""}),i=!!e&&e.length>0,{picked:x,data:y,isLoading:w,isError:D,error:z,refetch:P}=oe({messageId:n,bodyParts:e,enabled:i}),K=g.useMemo(()=>ue(e??[]),[e]),F=i&&y?.kind==="html"?y.body:t,H=i&&y?.kind==="text"?y.body:s;if(i){if(w)return a.jsx("div",{className:b("message-body",m),children:a.jsx(it,{})});if(D)return a.jsx("div",{className:b("message-body",m),children:a.jsx(ot,{error:z,onRetry:()=>P()})});if(!x)return a.jsx("div",{className:b("message-body",m),children:a.jsx(R,{})})}else if(!t&&!s)return a.jsx("div",{className:b("message-body",m),children:a.jsx(R,{})});const U=!!(o&&n),G=()=>{!o||p||(c(!0),h(o,!1))};return a.jsx(Ve,{className:m,html:F,text:H,isDark:u,category:l,allowImages:f,resolveCid:K,renderBlockedNotice:W=>a.jsx(st,{blockedImageCount:W,canAlwaysTrust:U,isTrustPending:p,onLoadOnce:()=>c(!0),onAlwaysTrust:G})})},$={personal:"Personal",uncategorized:"Unclassified",transactional:"Transactional",newsletter:"Newsletter",marketing:"Marketing",social:"Social",automated:"Automated"},ct=Object.values(L).map(e=>({value:e,label:$[e]})),lt={unclassified:"uncategorized"},dt=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:ct},{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"}],ut=new Map(dt.map(e=>[e.name,e])),Tt=e=>ut.get(e.toLowerCase()),mt=/^\d{4}-\d{2}-\d{2}$/;function ft(e,t,s){if(!mt.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 ht(e){const t=e.toLowerCase(),s=lt[t];return s||Object.values(L).find(n=>n===t)}function gt(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 pt(e,t){const s=Ye(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=ht(n);return o?{type:"category",raw:e,value:n,category:o}:void 0}case"is":return gt(e,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:e}:void 0;case"before":case"after":return ft(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 Nt(e,t={}){const s=[],r=[];for(const n of M(e)){const o=pt(n.raw,t);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Ct(e,t){return M(e).filter(s=>s.raw!==t.raw).map(s=>s.raw).join(" ")}function jt(e){switch(e.type){case"from":return`From: ${e.value}`;case"subject":return`Subject: ${e.value}`;case"category":return`Category: ${$[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 Rt(){const{mailboxNameIndex:e,accountNameIndex:t}=ne();return{...ie({select:r=>ce(r.matches)})?{}:{mailboxesByName:e},accountsByName:t}}export{kt as M,St as R,dt as S,M as a,Ye as b,Ve as c,et as d,Et as e,jt as f,Tt as g,Nt as p,Ct as r,At as s,Rt as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as L,a5 as C,a7 as I,bn as k,bo as E,r as x,j as d,bp as h,bq as A,br as j,l as R,s as Q,bs as D}from"./index-35SwEY68.js";import{P as O}from"./attachment-file-CMfx3CcW.js";import{ag as P,ah as _,ai as q,aj as z}from"./MailListHeader-Trtc8lfx.js";import{a as N}from"./useLabels-BngSwTS5.js";import{M as U}from"./enums-CCxx0t2v.js";import{c as w}from"./useMessageBodyContent-BZp02vgj.js";import{n as B}from"./search-query-Cr_ZXBCp.js";import{s as F}from"./search-scope-D8eDCx--.js";import{u as G,p as K}from"./useSearchTokenContext-Cbnmmy2v.js";const V=t=>{const{mailboxId:a,messages:i}=t,l=L(),{pushError:c}=C(),{mutateAsync:n,isPending:s}=I({...E(),onError:(o,u)=>{c({title:u.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:k(o),error:o})},onSettled:(o,u,m)=>{P(l,_(q(m.body.messageIds??[],i??[],a)))}});return{applyLabel:x.useCallback((o,u,m)=>{o.length!==0&&z(o,p=>n({body:{messageIds:p,labelId:u,action:m}}))},[n]),isPending:s}};function ne({accountId:t,mailboxId:a,messageIds:i}){const{labels:l}=N(t),{applyLabel:c}=V({mailboxId:a}),n=x.useMemo(()=>l.map(s=>({key:s.labelId,label:s.name,icon:d.jsx("span",{className:`size-2.5 rounded-full ${A(s.color)?h[s.color]:h.Default}`}),onSelect:()=>c(i,s.labelId,"Apply")})),[l,i,c]);return n.length===0?null:d.jsx(O,{triggerLabel:"Apply label to selected messages",triggerIcon:d.jsx(j,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:n,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 $=20,H=new Set(Object.values(U)),J=t=>t!==void 0&&H.has(t)?t:void 0,W=t=>{if(t.some(a=>a.type==="isUnread"))return!1;if(t.some(a=>a.type==="isRead"))return!0};function ie({mailboxId:t,filterCategory:a}={}){const{searchQuery:i}=R(),l=G(),c=w({select:e=>e.matches}),n=B(i),{freeText:s,tokens:r}=K(n,l),o=s.length>0,u=r.find(e=>e.type==="category"),m=J(a)??u?.category,p=r.some(e=>e.type==="hasAttachment")?!0:void 0,b=r.some(e=>e.type==="isStarred")?!0:void 0,y=W(r),f=r.find(e=>e.type==="after"),g=r.find(e=>e.type==="before"),S=r.find(e=>e.type==="in"),M=F({matches:c,callerMailboxId:t,inTokenMailboxId:S?.mailboxId}),{data:T,isLoading:v}=Q({...D({query:{query:s,mailboxId:M,limit:$,...m!==void 0?{category:m}:{},...p!==void 0?{hasAttachment:p}:{},...b!==void 0?{hasStars:b}:{},...y!==void 0?{isRead:y}:{},...f?{sentDateFrom:f.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:o,staleTime:6e4});return{hits:T?.items??[],isLoading:o&&v}}export{ne as L,ie as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as g,a5 as p,s as f,Q as m,r,a7 as y,a8 as T,V as E,a9 as x}from"./index-35SwEY68.js";const i={html:"",plainText:""},d=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({...x(),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{d 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-35SwEY68.js"></script>
|
|
42
42
|
<link rel="stylesheet" crossorigin href="/assets/index-Bn4mOVkF.css">
|
|
43
43
|
</head>
|
|
44
44
|
<body>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as a,am as Ze,S as Xe,bo as es,o as O,bi as ss,p as ae,r as n,x as se,bp as te,v as ts,w as as,bq as os,br as ns,bs as rs,e as Re,bt as is,i as ls}from"./index-CpL4QoWb.js";import{s as Te,a as cs,b as we,u as ds,p as us,R as ms}from"./useSearchTokenContext-C5JJYphj.js";import{a4 as ve,F as ye,a5 as fs,a6 as hs,G as gs,a7 as Se,a8 as xs,a9 as ps,aa as Is,a3 as bs,ab as vs,ac as ys,ad as Ss,M as Cs,ae as js,af as Rs,ag as Ts,f as ws,w as Ms,ah as ks,s as Ns,S as As,J as Fs,O as Ce,N as Bs,K as Os,e as Ls,Y as Es,Z as Me,_ as qs,$ as ke,a0 as Ds}from"./MailListHeader-DnFZsLU5.js";import{u as Ps,a as zs,R as _s,i as Qs,b as Hs}from"./useRefreshControl-D0tR6FR3.js";import{a as $s}from"./useLabels-DsFfQJKo.js";import{d as Ws,R as Gs}from"./search-token-index-Bq5W3wIz.js";import{u as Us}from"./useMediaQuery-DsLp21rD.js";import{u as Vs,L as Ys}from"./useSemanticSearch-BM68RrQf.js";import{c as Js}from"./nav-link-CI-9pBff.js";function Ks({sync:e}){return e?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[a.jsx(Ze,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),a.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),a.jsx("p",{className:"text-xs text-fg-subtle",children:Zs(e)})]}):a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[a.jsx(Xe,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),a.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),a.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function Zs({synced:e,total:s}){return s>0?`${e.toLocaleString()} of ${s.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const Ne=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Ae="category",Xs={unclassified:"uncategorized"},z=e=>cs(e).map(s=>s.raw),P=e=>e.join(" "),oe=e=>{const s=we(e);if(s)return Ne.find(o=>o.name===s.name&&o.value===s.value.toLowerCase())?.id},ne=e=>{const s=we(e);if(!s||s.name!==Ae)return;const o=s.value.toLowerCase(),r=Xs[o];if(r)return r;if(!(!es(o)||o==="all"))return o},Fe=e=>Ne.find(s=>s.id===e),Be=e=>Fe(e)!==void 0,et=e=>{const s=new Set;for(const o of z(e)){const r=oe(o);r&&s.add(r)}return s},st=e=>{let s="all";for(const o of z(e)){const r=ne(o);r&&(s=r)}return s},tt=(e,s)=>{const o=Fe(s);if(!o)return;const r=z(e),d=r.filter(i=>oe(i)!==s);return d.length<r.length?P(d):P([...r,Te(o.name,o.value)])},at=(e,s)=>{const o=z(e).filter(r=>!ne(r));return P(s==="all"?o:[...o,Te(Ae,s)])},ot=e=>P(z(e).filter(s=>!oe(s)&&!ne(s))),Oe=e=>e.trim().length>0,nt=e=>{if(!Oe(e.query))return e.ownFilters;const s=new Set(et(e.query));for(const o of e.ownFilters)Be(o)||s.add(o);return s},rt=e=>Oe(e.query)?st(e.query):e.ownCategory,it=(e,s)=>e.createdAt!==s.createdAt?e.createdAt-s.createdAt:e.accountId.localeCompare(s.accountId),lt=e=>[...e].sort(it),ct=200,je=()=>a.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,s)=>a.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[a.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),a.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),a.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),a.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},s))}),dt=({accountEmail:e})=>{const s=ae();return a.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[a.jsx(Re,{className:"size-3.5 shrink-0"}),a.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),a.jsx("button",{type:"button",onClick:()=>s({to:"/settings/accounts"}),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},ut=(e,s)=>{if(s.size===0)return{};const o=new Set,r=new Set;for(const i of e)s.has(i.id)&&(i.accountId&&o.add(i.accountId),i.mailboxId&&r.add(i.mailboxId));if(o.size>1)return{restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"};const d=o.size===1?[...o][0]:void 0;return r.size>1?{accountId:d,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${r.size} folders`}:{accountId:d,mailboxId:r.size===1?[...r][0]:void 0}};function mt({header:e,rows:s,wizard:o,children:r}){const{selectedIds:d,selectedCount:i,exitSelection:x,orderedIds:f,allSelected:u,toggleAllLoaded:y}=Ts(),p=n.useMemo(()=>ut(s,d),[s,d]),{junkMailboxId:I}=ws(p.accountId),{labels:S}=$s(p.accountId),A=n.useMemo(()=>Array.from(d),[d]),L=n.useMemo(()=>s.filter(h=>d.has(h.id)).map(h=>({id:h.id,sender:h.fromName,email:h.fromEmail,subject:h.subject,date:h.timeLabel})),[s,d]),m=Ms(I,p.mailboxId),b=n.useMemo(()=>f.length>0?{checked:u,indeterminate:i>0&&!u,onChange:y}:void 0,[f.length,u,i,y]),j=p.moveDisabledHint?{tone:"warning",text:p.moveDisabledHint}:void 0,C=h=>a.jsx(As,{title:h.title,navSlot:h.navSlot,titleMeta:h.titleMeta,searchSlot:h.searchSlot,searchField:h.searchField,idleSlot:h.makeFilterSlot,count:i,onCancel:x,onDelete:()=>o.start("delete"),onMove:()=>o.start("move"),onOrganize:()=>o.start("organize"),onJunk:m?()=>o.start("junk"):void 0,onMarkRead:()=>o.start("markRead"),overflowSlot:p.accountId&&p.mailboxId&&i>0&&S.length>0?a.jsx(Ys,{accountId:p.accountId,mailboxId:p.mailboxId,messageIds:A}):void 0,selectAll:b,notice:j});return a.jsx(ks,{...e,selectionBar:C,paneOverlay:a.jsx(Ns,{verb:o.verb,accountId:p.accountId,mailboxId:p.mailboxId,selection:L,selectionRestriction:p.restriction,onFinished:x}),children:r})}function ft({accounts:e,selectedMessageId:s,onOpenThread:o,commandsRef:r,onTriageContextChange:d,onDeleteMessages:i}){const{searchQuery:x,searchInput:f,resultFolderIndex:u,onSearchChange:y}=O(),p=ds(),I=Us(),S=Ws(),A=ss(),L=ae(),m=n.useMemo(()=>lt(e.filter(t=>!t.muted?.value)),[e]),[b,j]=n.useState("all"),[C,h]=n.useState("all"),[_,E]=n.useState(new Set),[V,B]=n.useState(!1),q=n.useCallback(t=>{E(l=>{const c=new Set(l);return c.has(t)?c.delete(t):c.add(t),c})},[]),Q=n.useCallback(()=>E(new Set),[]),R=f.trim().length>0,T=n.useMemo(()=>nt({query:f,ownFilters:_}),[f,_]),w=n.useMemo(()=>rt({query:f,ownCategory:C}),[f,C]),g=n.useCallback(t=>{if(!R||!Be(t)){q(t);return}const l=tt(f,t);l!==void 0&&y(l)},[R,f,y,q]),M=n.useCallback(t=>{if(!R){h(t);return}y(at(f,t))},[R,f,y]),F=n.useCallback(()=>{h("all"),j("all"),Q(),R&&y(ot(f))},[R,f,y,Q]),{data:H,isLoading:Y,isError:re,refetch:ie}=se({...te(),staleTime:6e4}),$=ts({queries:m.map(t=>({...as({path:{accountId:t.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),W=n.useMemo(()=>{const t=new Map;for(let l=0;l<m.length;l++){const c=m[l].accountId,Ye=($[l]?.data?.items??[]).reduce((Je,Ke)=>Je+(Ke.unseenCount??0),0);t.set(c,Ye)}return t},[m,$]),qe=n.useMemo(()=>m.filter((t,l)=>{const c=$[l];return c?.isError?!os(c.error):!1}),[m,$]),{freeText:k,tokens:J}=us(x.trim().toLowerCase(),p),{data:le,isFetching:De}=se({...te({query:{query:k,limit:ct}}),enabled:k.length>0,staleTime:3e4}),v=n.useMemo(()=>{const t=ve(H?.items??[]).map(ye);return(k?fs(t.filter(c=>hs(c,k)),ve(le?.items??[]).map(ye)):t).filter(c=>(b==="all"||c.accountId===b)&&gs(c,J))},[H,le,b,k,J]),{bodyRows:ce,briefSpamOffer:K}=n.useMemo(()=>{if(!k)return{bodyRows:v,briefSpamOffer:void 0};const t=v.map(N=>Se(N,u)),{spam:l}=xs(t);if(l.length===0)return{bodyRows:v,briefSpamOffer:void 0};const c=new Set(l.map(N=>N.id));return{bodyRows:v.filter(N=>!c.has(N.id)),briefSpamOffer:ps(t)}},[v,k,u]),de=n.useMemo(()=>Is(ce),[ce]),ue=n.useCallback((t,l)=>{const c=v.find(N=>N.id===t)?.threadId;c&&o?.({threadId:c,messageId:t},l)},[v,o]),Pe=n.useCallback(t=>{const l=t.threadId??v.find(c=>c.id===t.id)?.threadId;l&&o?.({threadId:l,messageId:t.id})},[v,o]),Z=n.useMemo(()=>m.length<=1?[]:[{id:"all",label:"All",active:b==="all"},...m.map(t=>({id:t.accountId,label:t.email.split("@")[0]??t.email,count:W.get(t.accountId),active:b===t.accountId}))],[m,W,b]),D=n.useMemo(()=>e.filter(t=>t.muted?.value).length,[e]),ze=n.useMemo(()=>Array.from(W.values()).reduce((t,l)=>t+l,0),[W]),X=n.useMemo(()=>m.map(t=>t.accountId),[m]),{hasNewMail:me}=Ps(),{state:fe,errorMessage:he,refresh:ge}=zs(X,{onSettled:()=>ie()}),_e=n.useMemo(()=>a.jsx(_s,{state:fe,onRefresh:ge,label:"Refresh daily brief",errorMessage:he,hasUpdate:me(X)}),[fe,ge,he,me,X]),ee=n.useMemo(()=>v.filter(t=>(w==="all"||t.category===w)&&ns(t,T)).map(t=>Se(t,u)),[v,w,T,u]),{hits:xe,isLoading:Qe}=Vs(),He=n.useMemo(()=>{const t=new Map;for(const c of H?.items??[])t.set(c.messageId,c.threadId);const l=ee.map(c=>t.get(c.id)).filter(c=>c!=null);return bs(xe,l,u)},[xe,ee,H,u]),$e=n.useMemo(()=>{const t=vs(Z.map(l=>({id:l.id,label:l.label,count:l.count,active:l.active})));return{categories:t.categories,filters:t.filters,sources:t.sources,sourcesNote:D>0?`+${D} muted`:void 0,selectedCategory:w,activeFilters:T,expanded:V,onExpandedChange:B,onSelectCategory:l=>M(l),onSelectSource:j,onToggleFilter:l=>g(l),onClear:F}},[Z,D,w,T,V,g,M,F]),pe=de.length===0&&b==="all"&&k.length===0&&J.length===0,We=n.useMemo(()=>m.map(t=>t.accountId),[m]),Ge=n.useMemo(()=>m.some(t=>Qs(t.syncPhase)),[m]),G=Hs(We,pe||Ge),Ie=a.jsxs("div",{className:"h-full overflow-y-auto",children:[a.jsx(je,{}),a.jsx(je,{})]}),be=!Y&&!re&&!pe,Ue=ys({tier:S,hasLiveInput:R,hasCommittedQuery:x.trim().length>0,bodyRendersCommittedResults:!0}),Ve=be?a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[K&&a.jsx(Ss,{count:K.count,onScopeToSpam:()=>L({to:"/mail/$mailboxId",params:{mailboxId:K.mailboxId},search:{q:x||void 0}})}),a.jsx("div",{className:"min-h-0 flex-1",children:a.jsx(rs,{sections:de,briefCategory:w,Row:Cs,selectedThreadId:s,onSelectThread:ue,onSelectBriefCategory:M,sources:Z,sourcesNote:D>0?`+${D} muted`:void 0,onSelectSource:j,activeFilters:T,onToggleFilter:g,onClearFilters:F})})]}):Y?Ie:re?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[a.jsx(Re,{className:"size-8 text-danger"}),a.jsx("p",{children:"Couldn't load your messages"}),a.jsxs("button",{type:"button",onClick:()=>ie(),className:"flex items-center gap-1 text-accent underline text-xs",children:[a.jsx(Gs,{className:"size-3.5"}),"Try again"]})]}):G.resolved?a.jsx(Ks,{sync:G.syncing?{synced:G.synced,total:G.total}:void 0}):Ie;return a.jsx(is,{hasSheet:be&&!Ue,children:a.jsx(js,{selectedMessageId:s,onOpen:ue,onDeleteMessages:i,onSelectionVerb:A.start,wizardOpen:A.isOpen,commandsRef:r,onTriageContextChange:d,children:a.jsx(mt,{wizard:A,header:{title:"Daily brief",unreadCount:ze,footer:I?a.jsx(Rs,{}):void 0,searchFilter:$e,searchResults:ee,searchLoading:Y||De,relatedResults:He,relatedLoading:Qe,onSelectSearchResult:Pe,searchResultsInBody:!0,refreshControl:_e},rows:v,children:a.jsxs("div",{className:"flex h-full flex-col",children:[qe.map(t=>a.jsx(dt,{accountEmail:t.email,accountId:t.accountId},t.accountId)),a.jsx("div",{className:"min-h-0 flex-1",children:Ve})]})})})})}const Le=n.createContext(null);function U(){const e=n.useContext(Le);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function ht({thread:e,children:s}){const o=ae(),r=Js(),{searchInput:d}=O(),i=e?.threadId,x=e?.messageId,{data:f}=se({...te(),staleTime:6e4}),u=n.useMemo(()=>f?.items??[],[f]),y=n.useMemo(()=>{if(i)return u.find(g=>g.messageId===x)??u.find(g=>g.threadId===i)},[u,i,x]),p=Fs(i,x),I=y??p,S=x??I?.messageId,A=n.useMemo(()=>{if(i)return{threadId:i,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:S,authenticity:I?.authenticity}},[i,I,S]),L=n.useCallback((g,M)=>{o({to:"/mail/brief/$threadId/$messageId",params:g,replace:M?.replace,search:F=>({...F,q:d||void 0}),hash:r})},[o,r,d]),m=n.useCallback(()=>{o({to:"/mail/brief",search:g=>g,hash:r})},[o,r]),b=n.useCallback(g=>{S&&g.includes(S)&&m()},[S,m]),j=Ce({thread:I,onAfterOptimisticRemove:b}),C=Bs(),{deleteMessages:h}=Os({mailboxId:I?.mailboxId??"",messages:u,onAfterOptimisticRemove:b}),{toggleReadFor:_}=Ls({mailboxId:I?.mailboxId??"",messages:u}),E=C.focusedMessageId,B=n.useMemo(()=>u.find(g=>g.messageId===E),[u,E])??I,q=Ce({thread:B}),{nextMessageId:Q,previousMessageId:R}=Es({context:C,orderedIds:C.orderedIds,selectedMessageId:S,onClose:m,handlers:{reply:()=>j.requestCompose("reply"),replyAll:()=>j.requestCompose("reply_all"),forward:()=>j.requestCompose("forward"),delete:()=>{C.listCommandsRef.current?.requestVerb("delete")||q.deleteThread()},toggleStar:q.toggleStar,toggleRead:()=>{C.listCommandsRef.current?.requestVerb("markRead")||B&&_([B.messageId],!B.isRead)},goFlagged:()=>o({to:"/mail/flagged"}),goSettings:()=>o({to:"/settings"})}}),T=n.useCallback(g=>{if(!g)return;const M=u.find(F=>F.messageId===g);return M?{threadId:M.threadId,messageId:g}:void 0},[u]),w={selectedMessageId:S,selectedThread:I,conversation:A,onOpenThread:L,onCloseThread:m,nextThread:T(Q),previousThread:T(R),actions:j,triage:C,onDeleteMessages:h,handleDeselectIfRemoved:b};return a.jsx(Le.Provider,{value:w,children:s})}function Ee(){const{selectedMessageId:e,onOpenThread:s,triage:o,onDeleteMessages:r}=U(),{accounts:d}=O();return a.jsx(ft,{accounts:d,selectedMessageId:e,onOpenThread:s,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:r})}function gt(){const{conversation:e,actions:s}=U(),{intelligenceOpen:o,onToggleIntelligence:r}=O(),d=ls()?.showIntelligencePane??!1,i=!!e,x=d&&i;return a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(Ds,{hasThread:i,intelligenceOpen:x&&o,canToggleIntelligence:x,onToggleIntelligence:r,onReply:i?()=>s.requestCompose("reply"):void 0,onReplyAll:i?()=>s.requestCompose("reply_all"):void 0,onForward:i?()=>s.requestCompose("forward"):void 0,onDelete:i?s.deleteThread:void 0,onToggleStar:i?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:i&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(Me,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,composeRequest:s.composeRequest,onComposeClose:s.clearComposeRequest}):a.jsx(ms,{})})]})}function xt(){const{selectedThread:e,handleDeselectIfRemoved:s}=U(),{onToggleIntelligence:o}=O();return a.jsx(ke,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:s})}function pt(){const{selectedThread:e,conversation:s,onOpenThread:o,onCloseThread:r,nextThread:d,previousThread:i,handleDeselectIfRemoved:x}=U(),{intelligenceOpen:f,onToggleIntelligence:u}=O();return s?a.jsxs(a.Fragment,{children:[a.jsx(Me,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:r,onOpenIntelligence:u,onSwipeNext:d?()=>o(d):void 0,onSwipePrevious:i?()=>o(i):void 0,mobileIntelligenceOpen:f}),a.jsx(qs,{isOpen:f,onClose:u,ariaLabel:"Message details",side:"right",children:a.jsx(ke,{onClose:u,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,hideCloseButton:!0,onAfterOptimisticRemove:x})})]}):a.jsx("div",{className:"h-full",children:a.jsx(Ee,{})})}const wt=Object.assign(ht,{List:Ee,Reading:gt,Intelligence:xt,Phone:pt});export{wt as B};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bF as U,r as n,bG as Y,o as P,bi as Z,aM as X,aN as ee,j as a,p as te,i as se}from"./index-CpL4QoWb.js";import{u as ae,p as oe,R as re}from"./useSearchTokenContext-C5JJYphj.js";import{F as ne,a6 as ie,G as de,an as le,a7 as ce,d as ue,M as ge,ae as he,ao as me,ag as fe,s as pe,J as xe,O as z,N as Ie,K as Te,e as be,Y as ve,Z as H,_ as Ce,$ as Q,a0 as ye}from"./MailListHeader-DnFZsLU5.js";import{u as Re,b as Se,a as je}from"./MailViewChrome-B1N4z7Pm.js";import{f as we}from"./ErrorState-iyZ1eEDd.js";import{u as Fe}from"./useMediaQuery-DsLp21rD.js";import{c as Me}from"./nav-link-CI-9pBff.js";const Pe=()=>Y({query:{starred:!0,order:"desc"}});function V(){const{data:e,isLoading:t,isError:o,error:i,refetch:m,fetchNextPage:s,hasNextPage:h,isFetchingNextPage:c}=Re({queryKey:Pe(),queryFn:async({pageParam:f})=>{const{data:d}=await U({query:{starred:!0,order:"desc",continuationToken:f},throwOnError:!0});return d},initialPageParam:void 0,getNextPageParam:f=>f.continuationToken,staleTime:6e4});return{threads:n.useMemo(()=>(e?.pages??[]).flatMap(f=>f.items??[]),[e]),isLoading:t,isError:o,error:i,refetch:m,fetchNextPage:s,hasNextPage:h,isFetchingNextPage:c}}const ke=e=>{const t=new Set;return e.filter(o=>t.has(o.threadId)?!1:(t.add(o.threadId),!0))},Le={unread:e=>!e.isRead,attachment:e=>e.hasAttachment===!0};function Oe({rows:e,verb:t}){const{selectedIds:o,exitSelection:i}=fe(),m=n.useMemo(()=>e.filter(s=>o.has(s.id)).map(s=>({id:s.id,sender:s.fromName,email:s.fromEmail,subject:s.subject,date:s.timeLabel})),[e,o]);return a.jsx(pe,{verb:t,selection:m,selectionRestriction:"spansAccounts",onFinished:i})}function Ne({selectedMessageId:e,onOpenThread:t,commandsRef:o,onTriageContextChange:i,onDeleteMessages:m}){const{searchQuery:s,resultFolderIndex:h}=P(),c=ae(),T=Fe(),f=Z(),[d,x]=n.useState("all"),[S,k]=n.useState(new Set),v=n.useCallback(r=>{k(g=>{const p=new Set(g);return p.has(r)?p.delete(r):p.add(r),p})},[]),j=n.useCallback(()=>{x("all"),k(new Set)},[]),{threads:b,isLoading:I,isError:L,error:A,refetch:O,fetchNextPage:E,hasNextPage:C,isFetchingNextPage:w}=V(),{freeText:y,tokens:N}=oe(s.trim().toLowerCase(),c),u=n.useMemo(()=>{const r=Array.from(S).map(g=>Le[g]).filter(g=>g!=null);return ke(b).map(ne).filter(g=>(d==="all"||g.category===d)&&r.every(p=>p(g))&&(!y||ie(g,y))&&de(g,N))},[b,d,S,y,N]),F=n.useCallback((r,g)=>{const p=u.find(J=>J.id===r)?.threadId;p&&t?.({threadId:p,messageId:r},g)},[u,t]),l=n.useCallback(r=>{const g=r.threadId??u.find(p=>p.id===r.id)?.threadId;g&&t?.({threadId:g,messageId:r.id})},[u,t]),R=n.useMemo(()=>le(),[]),M=n.useMemo(()=>u.map(r=>ce(r,h)),[u,h]),G=n.useMemo(()=>u.filter(r=>!r.isRead).length,[u]),B=I?"loading":L?"error":u.length===0?"empty":"ready",W=n.useCallback(()=>{const r=X(ee());window.open(r,"_blank","noopener,noreferrer")},[]),D=ue(),$=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:u.map(r=>a.jsx(ge,{thread:r,active:r.id===e,onClick:()=>F(r.id)},r.id))}),C?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>E(),disabled:w,children:w?"Loading…":"Load more"}):null]})});return a.jsx(Se,{title:"Starred",unreadCount:G,preset:R,selectedCategory:d,activeFilters:S,onSelectCategory:x,onToggleFilter:v,onClearFilters:j,searchResults:M,searchLoading:I,onSelectSearchResult:l,searchResultsInBody:!0,children:a.jsxs(he,{selectedMessageId:e,onOpen:F,onDeleteMessages:m,onSelectionVerb:f.start,wizardOpen:f.isOpen,commandsRef:o,onTriageContextChange:i,children:[a.jsx(je,{listTitle:"Starred",sections:[{id:"flagged",threads:u}],flatList:!0,hideHeader:!0,listState:D.searchResults?"ready":B,searchQuery:y?s:void 0,errorMessage:L?we(A):void 0,onRetry:()=>O(),onReportError:W,selectedThreadId:e,onSelectThread:F,isDesktop:T,selectionBar:a.jsx(me,{title:"Starred"}),listBody:D.searchResults??(B==="ready"?$:void 0)}),a.jsx(Oe,{rows:u,verb:f.verb})]})})}const _=n.createContext(null);function q(){const e=n.useContext(_);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function qe({thread:e,children:t}){const o=te(),i=Me(),{searchInput:m}=P(),s=e?.threadId,h=e?.messageId,{threads:c}=V(),T=n.useMemo(()=>{if(s)return c.find(l=>l.messageId===h)??c.find(l=>l.threadId===s)},[c,s,h]),f=xe(s,h),d=T??f,x=h??d?.messageId,S=n.useMemo(()=>{if(s)return{threadId:s,mailboxId:d?.mailboxId??"",subject:d?.subject,messageId:x,authenticity:d?.authenticity}},[s,d,x]),k=n.useCallback((l,R)=>{o({to:"/mail/flagged/$threadId/$messageId",params:l,replace:R?.replace,search:M=>({...M,q:m||void 0}),hash:i})},[o,i,m]),v=n.useCallback(()=>{o({to:"/mail/flagged",search:l=>l,hash:i})},[o,i]),j=n.useCallback(l=>{x&&l.includes(x)&&v()},[x,v]),b=z({thread:d,onAfterOptimisticRemove:j}),I=Ie(),{deleteMessages:L}=Te({mailboxId:d?.mailboxId??"",messages:c,onAfterOptimisticRemove:j}),{toggleReadFor:A}=be({mailboxId:d?.mailboxId??"",messages:c}),O=I.focusedMessageId,C=n.useMemo(()=>c.find(l=>l.messageId===O),[c,O])??d,w=z({thread:C}),{nextMessageId:y,previousMessageId:N}=ve({context:I,orderedIds:I.orderedIds,selectedMessageId:x,onClose:v,handlers:{reply:()=>b.requestCompose("reply"),replyAll:()=>b.requestCompose("reply_all"),forward:()=>b.requestCompose("forward"),delete:()=>{I.listCommandsRef.current?.requestVerb("delete")||w.deleteThread()},toggleStar:w.toggleStar,toggleRead:()=>{I.listCommandsRef.current?.requestVerb("markRead")||C&&A([C.messageId],!C.isRead)},goBrief:()=>o({to:"/mail/brief"}),goSettings:()=>o({to:"/settings"})}}),u=n.useCallback(l=>{if(!l)return;const R=c.find(M=>M.messageId===l);return R?{threadId:R.threadId,messageId:l}:void 0},[c]),F={selectedMessageId:x,selectedThread:d,conversation:S,onOpenThread:k,onCloseThread:v,nextThread:u(y),previousThread:u(N),actions:b,triage:I,onDeleteMessages:L,handleDeselectIfRemoved:j};return a.jsx(_.Provider,{value:F,children:t})}function K(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:i}=q();return a.jsx(Ne,{selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:i})}function Ae(){const{conversation:e,actions:t}=q(),{intelligenceOpen:o,onToggleIntelligence:i}=P(),m=se()?.showIntelligencePane??!1,s=!!e,h=m&&s;return a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(ye,{hasThread:s,intelligenceOpen:h&&o,canToggleIntelligence:h,onToggleIntelligence:i,onReply:s?()=>t.requestCompose("reply"):void 0,onReplyAll:s?()=>t.requestCompose("reply_all"):void 0,onForward:s?()=>t.requestCompose("forward"):void 0,onDelete:s?t.deleteThread:void 0,onToggleStar:s?t.toggleStar:void 0,isStarred:t.isStarred,moveContext:s&&t.accountId&&t.mailboxId?{accountId:t.accountId,currentMailboxId:t.mailboxId,onMove:t.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(H,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,composeRequest:t.composeRequest,onComposeClose:t.clearComposeRequest}):a.jsx(re,{})})]})}function Ee(){const{selectedThread:e,handleDeselectIfRemoved:t}=q(),{onToggleIntelligence:o}=P();return a.jsx(Q,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function Be(){const{selectedThread:e,conversation:t,onCloseThread:o,onOpenThread:i,nextThread:m,previousThread:s,handleDeselectIfRemoved:h}=q(),{intelligenceOpen:c,onToggleIntelligence:T}=P();return t?a.jsxs(a.Fragment,{children:[a.jsx(H,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:o,onOpenIntelligence:T,onSwipeNext:m?()=>i(m):void 0,onSwipePrevious:s?()=>i(s):void 0,mobileIntelligenceOpen:c}),a.jsx(Ce,{isOpen:c,onClose:T,ariaLabel:"Message details",side:"right",children:a.jsx(Q,{onClose:T,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,hideCloseButton:!0,onAfterOptimisticRemove:h})})]}):a.jsx("div",{className:"h-full",children:a.jsx(K,{})})}const Ge=Object.assign(qe,{List:K,Reading:Ae,Intelligence:Ee,Phone:Be});export{Ge as F};
|