@remit/web-client-dist 0.0.372 → 0.0.374

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.
Files changed (114) hide show
  1. package/assets/BriefPane-Dm426fSk.js +1 -0
  2. package/assets/{ErrorState-CNRyRb6l.js → ErrorState-h13VQICf.js} +1 -1
  3. package/assets/FlaggedPane-Cc09MSSU.js +1 -0
  4. package/assets/{FullCompose-sO0aEoyo.js → FullCompose-DA4Ebcu0.js} +1 -1
  5. package/assets/MailListHeader-C1OfZ3C8.js +7 -0
  6. package/assets/{MailViewChrome-CUDvmwTn.js → MailViewChrome-DFPtjcHL.js} +1 -1
  7. package/assets/MailboxPane-ehn17Rmi.js +1 -0
  8. package/assets/{NavMenuButton-BmjnuYnv.js → NavMenuButton-BoAc2SbZ.js} +1 -1
  9. package/assets/{OnboardingWizard-NmbXX13A.js → OnboardingWizard-DVnR0lU-.js} +1 -1
  10. package/assets/{OutboxPane-CuFD7jTd.js → OutboxPane-Cjo8wRfb.js} +1 -1
  11. package/assets/_mailboxId-B9nmn5VV.js +1 -0
  12. package/assets/_messageId-BQaf3fyQ.js +1 -0
  13. package/assets/_messageId-BvsyJaze.js +1 -0
  14. package/assets/_messageId-DexUcC4-.js +1 -0
  15. package/assets/_outboxMessageId-CFt6SKn6.js +1 -0
  16. package/assets/_threadId-B-DTCClJ.js +1 -0
  17. package/assets/_threadId-Bu79EqPG.js +1 -0
  18. package/assets/_threadId-CIgEnrUA.js +1 -0
  19. package/assets/{accounts-idwnTro-.js → accounts-Cpg6e4Ox.js} +1 -1
  20. package/assets/{advanced-BtUfq8Sd.js → advanced-BHYWJ0vq.js} +1 -1
  21. package/assets/{appearance-D_C_f5Pv.js → appearance-CfOVY3p8.js} +1 -1
  22. package/assets/{attachment-file-CmBlR4Nw.js → attachment-file-Cg9oKgdz.js} +1 -1
  23. package/assets/{avatar-DADuvAhc.js → avatar-BGau-_1D.js} +1 -1
  24. package/assets/{bottom-sheet-DkNRMhO-.js → bottom-sheet-BAHKqSsQ.js} +1 -1
  25. package/assets/{brief-RCH5MtG1.js → brief-CP6kpNpr.js} +1 -1
  26. package/assets/brief-e5scWIft.js +1 -0
  27. package/assets/{browser-ponyfill-BHPGYQtP.js → browser-ponyfill-BN9ZRjmb.js} +1 -1
  28. package/assets/{bug-B1DCV8k2.js → bug-BXFH2wL6.js} +1 -1
  29. package/assets/{circle-check-big-CcGlW81M.js → circle-check-big-Cx6DiXm_.js} +1 -1
  30. package/assets/{circle-check-CZ6Y-mRM.js → circle-check-w4xMKkFU.js} +1 -1
  31. package/assets/{circle-help-BgtRhroK.js → circle-help-CzkmJoS7.js} +1 -1
  32. package/assets/{clock-BAfOPOro.js → clock-CiJL_gka.js} +1 -1
  33. package/assets/compose._-_outboxMessageId_-B8pScgTk.js +1 -0
  34. package/assets/compose._-_outboxMessageId_-ByoQM5cq.js +1 -0
  35. package/assets/compose._-_outboxMessageId_-C9OgWxZR.js +1 -0
  36. package/assets/compose._-_outboxMessageId_-CAvJgrcL.js +1 -0
  37. package/assets/{confirm-dialog-D9gyhlPW.js → confirm-dialog-Cbg54IcF.js} +1 -1
  38. package/assets/{download-CiIP3hvx.js → download-DpSGw_DC.js} +1 -1
  39. package/assets/{filters-C3OBPVW-.js → filters-B9gtvq68.js} +1 -1
  40. package/assets/{flagged-BTDPgxgF.js → flagged-BOvK0naz.js} +1 -1
  41. package/assets/flagged-BsTXuNv6.js +1 -0
  42. package/assets/{folders-DKVIZCXc.js → folders-ClnOwEqZ.js} +1 -1
  43. package/assets/index-BQaf3fyQ.js +1 -0
  44. package/assets/index-BoHm7Yry.js +1 -0
  45. package/assets/index-C1PUQcWq.js +1 -0
  46. package/assets/index-Cj27vvgq.js +1 -0
  47. package/assets/index-DLyKPs9n.js +1 -0
  48. package/assets/index-DT-LACuh.js +1 -0
  49. package/assets/{index-CruZwy_j.js → index-DZbb2VEN.js} +54 -54
  50. package/assets/index-DexUcC4-.js +1 -0
  51. package/assets/index-Dqh5AiJT.js +1 -0
  52. package/assets/index-SkyrAO8G.js +46 -0
  53. package/assets/{kbd-CPpFVi9O.js → kbd-B8xYac2O.js} +1 -1
  54. package/assets/{labels-Caie2UeA.js → labels-CUd-Svmj.js} +1 -1
  55. package/assets/{mail-CvhP0j2e.js → mail-BvR-cYjG.js} +1 -1
  56. package/assets/{mail-C1G9szr-.js → mail-CGOi4hsp.js} +1 -1
  57. package/assets/{menu-Csa6gu1E.js → menu-BapVwyAW.js} +1 -1
  58. package/assets/{move-options-XwMlkuRe.js → move-options-Zp9EvroA.js} +1 -1
  59. package/assets/{onboarding-DXQhAMkk.js → onboarding-c1RxnP4q.js} +1 -1
  60. package/assets/outbox-CAfjqbAG.js +1 -0
  61. package/assets/{pencil-DHiKxe2W.js → pencil-CB4FsBen.js} +1 -1
  62. package/assets/{rich-text-C9mGofSm.js → rich-text-Br7HG_T_.js} +23 -23
  63. package/assets/{rich-text-spellcheck-worker-provider-ofHr_Ndk.js → rich-text-spellcheck-worker-provider-CdIh-Ijh.js} +1 -1
  64. package/assets/{rotate-ccw-BSKwjQcA.js → rotate-ccw-BaeQ_tE5.js} +1 -1
  65. package/assets/{row-actions-BxDbSihO.js → row-actions-g_IwNDE0.js} +1 -1
  66. package/assets/{search-scope-BhgcAbIG.js → search-scope-DmftgZn_.js} +1 -1
  67. package/assets/{search-token-index-Bduf_pxP.js → search-token-index-mqaKvTQn.js} +1 -1
  68. package/assets/{search-view-D0WpJ5LA.js → search-view-CeB9CiFQ.js} +1 -1
  69. package/assets/{senders-DQj-mz1j.js → senders-Dq48BGSM.js} +1 -1
  70. package/assets/settings-CHO59YeM.js +1 -0
  71. package/assets/{settings-screen-Dr5expLP.js → settings-screen-dZ46x-JN.js} +1 -1
  72. package/assets/{shield-check-DiUF5wWn.js → shield-check-BNHlujOD.js} +1 -1
  73. package/assets/{suggested-vips-C2YZDZ28.js → suggested-vips-HQ11yWi2.js} +1 -1
  74. package/assets/{useDebouncedValue-DOo7UPcD.js → useDebouncedValue-Dz2Ke561.js} +1 -1
  75. package/assets/{useFilters-DloCKDYh.js → useFilters-D1OY_Szr.js} +1 -1
  76. package/assets/{useLabels-zav64w0S.js → useLabels-B4qFuaRo.js} +1 -1
  77. package/assets/{useMediaQuery-C5e0Az56.js → useMediaQuery-DsVuv50k.js} +1 -1
  78. package/assets/{useMessageBodyContent-DPqly9Qg.js → useMessageBodyContent-DURLaUOg.js} +1 -1
  79. package/assets/{useRefreshControl-BliVFItV.js → useRefreshControl-mrUqtC5l.js} +1 -1
  80. package/assets/{useSearchMirror-DsCLU4Os.js → useSearchMirror-BLKAhzo8.js} +1 -1
  81. package/assets/{useSearchTokenContext-D18dJFny.js → useSearchTokenContext-C-7FZRgv.js} +1 -1
  82. package/assets/{useSemanticSearch-BnRS-ivx.js → useSemanticSearch-BsHTp-3p.js} +1 -1
  83. package/assets/{useSignature-B2YdvIEW.js → useSignature-Dict5HXH.js} +1 -1
  84. package/index.html +1 -1
  85. package/package.json +1 -1
  86. package/assets/BriefPane-BDUlX1dd.js +0 -1
  87. package/assets/FlaggedPane-Y2qJ-pRo.js +0 -1
  88. package/assets/MailListHeader-D31JcI05.js +0 -7
  89. package/assets/MailboxPane-DbcxmYLE.js +0 -1
  90. package/assets/_mailboxId-BMoBs8x5.js +0 -1
  91. package/assets/_messageId-DZ-036Eg.js +0 -1
  92. package/assets/_messageId-DwLC2u56.js +0 -1
  93. package/assets/_messageId-DxTnKS-9.js +0 -1
  94. package/assets/_outboxMessageId-BGSaMsgb.js +0 -1
  95. package/assets/_threadId-D1gZ7Nwd.js +0 -1
  96. package/assets/_threadId-Dboy5fMG.js +0 -1
  97. package/assets/_threadId-I8cwucoX.js +0 -1
  98. package/assets/brief-DICffxfb.js +0 -1
  99. package/assets/compose._-_outboxMessageId_-BDqy5AQx.js +0 -1
  100. package/assets/compose._-_outboxMessageId_-BLvXHEbf.js +0 -1
  101. package/assets/compose._-_outboxMessageId_-DLTwyDE0.js +0 -1
  102. package/assets/compose._-_outboxMessageId_-yO7wXDO3.js +0 -1
  103. package/assets/flagged-DqZib9uq.js +0 -1
  104. package/assets/index-B7lXGXvZ.js +0 -1
  105. package/assets/index-BOTjtS9M.js +0 -46
  106. package/assets/index-CevfsXBN.js +0 -1
  107. package/assets/index-D0jtKZ0E.js +0 -1
  108. package/assets/index-DZ-036Eg.js +0 -1
  109. package/assets/index-Din4hbj5.js +0 -1
  110. package/assets/index-DxTnKS-9.js +0 -1
  111. package/assets/index-tumrcnwg.js +0 -1
  112. package/assets/index-wvh1_3xJ.js +0 -1
  113. package/assets/outbox-BLDXNwHc.js +0 -1
  114. package/assets/settings-vtqgdivN.js +0 -1
@@ -1 +1 @@
1
- import{db as r,dc as o,dd as a}from"./index-CruZwy_j.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
+ import{dc as r,dd as o,de as a}from"./index-DZbb2VEN.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-CruZwy_j.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
+ import{c as t}from"./index-DZbb2VEN.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 y,af as x}from"./index-CruZwy_j.js";const i=()=>l.jsx(x,{className:"size-3.5 animate-spin"}),m=(s,n)=>n?l.jsx("span",{className:"sr-only",children:s}):s;function p({actions:s=[],destructive:n,className:o}){const[f,r]=e.useState(!1);return f&&n?.confirm?l.jsxs("div",{className:y("flex items-center gap-2",o),children:[l.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),l.jsx(b,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:n.confirm.cancelLabel??"Cancel"}),l.jsx(b,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?i():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):l.jsxs("div",{className:y("flex items-center gap-2",o),children:[s.map(a=>l.jsx(b,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?i():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:m(a.label,a.iconOnly)},a.label)),n&&l.jsx(b,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?i():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){r(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:m(n.label,n.iconOnly)})]})}export{p as R};
1
+ import{r as e,j as l,B as b,b as y,af as x}from"./index-DZbb2VEN.js";const i=()=>l.jsx(x,{className:"size-3.5 animate-spin"}),m=(s,n)=>n?l.jsx("span",{className:"sr-only",children:s}):s;function p({actions:s=[],destructive:n,className:o}){const[f,r]=e.useState(!1);return f&&n?.confirm?l.jsxs("div",{className:y("flex items-center gap-2",o),children:[l.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),l.jsx(b,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:n.confirm.cancelLabel??"Cancel"}),l.jsx(b,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?i():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):l.jsxs("div",{className:y("flex items-center gap-2",o),children:[s.map(a=>l.jsx(b,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?i():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:m(a.label,a.iconOnly)},a.label)),n&&l.jsx(b,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?i():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){r(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:m(n.label,n.iconOnly)})]})}export{p as R};
@@ -1 +1 @@
1
- import{f as t}from"./useMessageBodyContent-DPqly9Qg.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};
1
+ import{f as t}from"./useMessageBodyContent-DURLaUOg.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};
@@ -1 +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-CruZwy_j.js";import{a as pe,d as me}from"./useMessageBodyContent-DPqly9Qg.js";import{a as ge,S as ye}from"./search-scope-BhgcAbIG.js";import{a as j,D as be}from"./useMediaQuery-C5e0Az56.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};
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-DZbb2VEN.js";import{a as pe,d as me}from"./useMessageBodyContent-DURLaUOg.js";import{a as ge,S as ye}from"./search-scope-DmftgZn_.js";import{a as j,D as be}from"./useMediaQuery-DsVuv50k.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};
@@ -1 +1 @@
1
- import{r as u,j as s,Z as l,_ as p}from"./index-CruZwy_j.js";import{F as v}from"./FullCompose-sO0aEoyo.js";import{e as x,h}from"./useMessageBodyContent-DPqly9Qg.js";const c=u.createContext(null),S=({chrome:o,children:n})=>s.jsx(c.Provider,{value:o,children:n});function d({phone:o,list:n,reading:r,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=x();if(!e)return s.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:s.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?s.jsx(p,{...i,list:f?s.jsx(v,{}):o,intelligenceOpen:e.intelligenceOpen}):s.jsx(p,{...i,topBar:e.topBar,list:n,reading:r,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}function j(o,n,r){if(o!==n)return r}function C(o,n){return o===""?"":n}function M({searchInput:o,committedQuery:n,urlQuery:r,pathname:t,listPath:a}){return!h(t,a)||n!==o?!1:n!==r}export{S as M,d as a,M as b,C as c,j as s};
1
+ import{r as u,j as s,Z as l,_ as p}from"./index-DZbb2VEN.js";import{F as v}from"./FullCompose-DA4Ebcu0.js";import{e as x,h}from"./useMessageBodyContent-DURLaUOg.js";const c=u.createContext(null),S=({chrome:o,children:n})=>s.jsx(c.Provider,{value:o,children:n});function d({phone:o,list:n,reading:r,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=x();if(!e)return s.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:s.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?s.jsx(p,{...i,list:f?s.jsx(v,{}):o,intelligenceOpen:e.intelligenceOpen}):s.jsx(p,{...i,topBar:e.topBar,list:n,reading:r,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}function j(o,n,r){if(o!==n)return r}function C(o,n){return o===""?"":n}function M({searchInput:o,committedQuery:n,urlQuery:r,pathname:t,listPath:a}){return!h(t,a)||n!==o?!1:n!==r}export{S as M,d as a,M as b,C as c,j as s};
@@ -1 +1 @@
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-CruZwy_j.js";import{K as m}from"./kbd-CPpFVi9O.js";import{S as Q,a as E}from"./settings-screen-Dr5expLP.js";import{E as V}from"./ErrorState-CNRyRb6l.js";import{u as K}from"./useDebouncedValue-DOo7UPcD.js";import{a as _}from"./format-De9HZKjg.js";import"./avatar-DADuvAhc.js";import"./menu-Csa6gu1E.js";import"./circle-help-BgtRhroK.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};
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-DZbb2VEN.js";import{K as m}from"./kbd-B8xYac2O.js";import{S as Q,a as E}from"./settings-screen-dZ46x-JN.js";import{E as V}from"./ErrorState-h13VQICf.js";import{u as K}from"./useDebouncedValue-Dz2Ke561.js";import{a as _}from"./format-De9HZKjg.js";import"./avatar-BGau-_1D.js";import"./menu-BapVwyAW.js";import"./circle-help-CzkmJoS7.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-DZbb2VEN.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,at as S}from"./index-CruZwy_j.js";import{A as w}from"./avatar-DADuvAhc.js";import{M as B}from"./menu-Csa6gu1E.js";import{C as v}from"./circle-help-BgtRhroK.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
+ import{c as z,r as j,j as e,b as f,B as i,X as N,at as S}from"./index-DZbb2VEN.js";import{A as w}from"./avatar-BGau-_1D.js";import{M as B}from"./menu-BapVwyAW.js";import{C as v}from"./circle-help-CzkmJoS7.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-CruZwy_j.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};
1
+ import{c as e}from"./index-DZbb2VEN.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};
@@ -1 +1 @@
1
- import{j as t,$ as e}from"./index-CruZwy_j.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
1
+ import{j as t,$ as e}from"./index-DZbb2VEN.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
@@ -1 +1 @@
1
- import{r as o}from"./index-CruZwy_j.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
+ import{r as o}from"./index-DZbb2VEN.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,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-CruZwy_j.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};
1
+ import{r as m,a7 as b,c_ as E,s as C,c$ as x,cH as F,d0 as D,n as M,d1 as N,d2 as P,d3 as L,d4 as z}from"./index-DZbb2VEN.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",V=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}),G=({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}},H=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),Q=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),te=(e,t)=>{const r=U(e,t);return{...r.anchorMessageId?{anchorMessageId:r.anchorMessageId}:{},matchOperator:r.matchOperator,literalClauses:r.literalClauses,moveMailboxId:e.moveMailboxId,labelId:e.labelId,expiresAt:e.scope==="until"?O(e.until??""):void 0}},j=(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},q=350,re=(e,t,r)=>{const a=b(F()),{mutateAsync:i}=a,n=Q(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const l=m.useRef(n),c=H(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}))})},q);return()=>clearTimeout(f)},[e,c,n,s.previewedSignature,s.errorSignature,i]),c?{count:j(s,n),matchedIds:s.previewedSignature===n?s.matchedIds??[]:[]}:{count:{status:"error",reason:D},matchedIds:[]}},A=e=>P({path:{accountId:e}}),se=e=>{const t=C({...L({path:{accountId:e??""}}),enabled:!!e});return{filters:t.data?.items??[],isPending:t.isPending,isError:t.isError,error:t.error,refetch:t.refetch}},ae=e=>{const t=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,V as k,ee as n,G as o,O as p,U as r,re as u};
@@ -1 +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-CruZwy_j.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
+ 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-DZbb2VEN.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-CruZwy_j.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};
1
+ import{r as s}from"./index-DZbb2VEN.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};
@@ -1 +1 @@
1
- import{bO as M,bP as T,bQ as O,w as f,r as i,bR as P,m as h,j as W,bS as Y,bT as H,W as z,k as J,n as Z,s as ee,bU as te,bV as se}from"./index-CruZwy_j.js";import{u as re}from"./useMediaQuery-C5e0Az56.js";function ne(e){const t=M({warn:e?.router===void 0}),s=e?.router||t;return T(s.stores.__store,O(e,s))}function oe(e){const t=M();return T(t.stores.location,O(e,t))}const S="/mail/brief",A="/mail/$mailboxId",v="/mail/outbox",L="/mail/flagged";function _(e){for(const t of e){if(t.routeId===S)return{list:"brief"};if(t.routeId===L)return{list:"flagged"};if(t.routeId===v)return{list:"outbox"};if(t.routeId===A)return{list:"mailbox",mailboxId:t.params?.mailboxId}}}function Te(e){const t=_(e);if(!t)return"";switch(t.list){case"mailbox":return t.mailboxId?ae(t.mailboxId):"";case"flagged":return L;case"outbox":return v;case"brief":return S}}function ae(e){return`${A}:${e}`}function Oe(e,t){return e===t?!0:e.startsWith(`${t}/`)}function Pe(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);return t[0]==="mail"&&t.length>2}function b(){const e=ne({select:s=>_(s.matches)?.list}),t=f({from:"/mail/$mailboxId",shouldThrow:!1});return{list:e,mailboxId:t?.mailboxId}}const k=["intelligence","nav","shortcuts"],ie=["nav","shortcuts"],ue=e=>ie.includes(e),ce=P(k);function x(e){const t=new Set(e.split(",").map(s=>ce.safeParse(s)).filter(s=>s.success).map(s=>s.data));return k.filter(s=>t.has(s))}function w(e){return k.filter(t=>e.includes(t)).join(",")}function Se(){const e=oe({select:t=>w(x(t.hash))});return i.useMemo(()=>x(e),[e])}const le=(e,t)=>!ue(e)&&t;function de(e){return(t="")=>w(x(t).filter(s=>le(s,e)))}function g(){const e=re();return i.useMemo(()=>de(e),[e])}function Ae(){const e=h();return i.useCallback(t=>{e({search:!0,hash:w(t),replace:!0,hashScrollIntoView:!1})},[e])}const D="/mail/brief/compose/{-$outboxMessageId}",U="/mail/flagged/compose/{-$outboxMessageId}",B="/mail/outbox/compose/{-$outboxMessageId}",F="/mail/$mailboxId/compose/{-$outboxMessageId}";function N(){const e=f({from:D,shouldThrow:!1}),t=f({from:U,shouldThrow:!1}),s=f({from:B,shouldThrow:!1}),r=f({from:F,shouldThrow:!1});return e??t??s??r}function ve(){return N()!==void 0}function Le(){return N()?.outboxMessageId}function fe(e,t,s){return e==="flagged"?{to:U,params:{outboxMessageId:s}}:e==="outbox"?{to:B,params:{outboxMessageId:s}}:e==="mailbox"&&t?{to:F,params:{mailboxId:t,outboxMessageId:s}}:{to:D,params:{outboxMessageId:s}}}function C(){const e=h(),t=g(),{list:s,mailboxId:r}=b();return i.useCallback((n,o)=>{e({...fe(s,r,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,s,r])}function _e(){const e=C();return i.useCallback(()=>e(void 0),[e])}function De(){const e=C();return i.useCallback(t=>e(t),[e])}function Ue(){const e=C();return i.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function Be(){const e=h(),t=g(),{list:s,mailboxId:r}=b();return i.useCallback(()=>{const n=a=>a,o=t;if(s==="flagged"){e({to:"/mail/flagged",search:n,hash:o});return}if(s==="outbox"){e({to:"/mail/outbox",search:n,hash:o});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId",params:{mailboxId:r},search:n,hash:o});return}e({to:"/mail/brief",search:n,hash:o})},[e,t,s,r])}const me=Y(H);function Fe({fragment:e,...t}){const s=g();return W.jsx(me,{...t,hash:e??s})}const he=["reply","reply-all","forward"],pe=P(he),K="/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}",Q="/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}",X="/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}";function q(){const e=f({from:K,shouldThrow:!1}),t=f({from:Q,shouldThrow:!1}),s=f({from:X,shouldThrow:!1});return e??t??s}function $(){const e=q();return i.useMemo(()=>{if(!e)return;const t=pe.safeParse(e.mode);return t.success?{kind:"reply",mode:t.data,threadId:e.threadId,sourceMessageId:e.messageId,outboxMessageId:e.outboxMessageId}:{kind:"unknown",segment:e.mode}},[e])}function Ne(){return $()?.kind==="reply"}function G(e,t,s,r){return e==="flagged"?{to:Q,params:{...s,outboxMessageId:r}}:e==="mailbox"&&t?{to:X,params:{...s,mailboxId:t,outboxMessageId:r}}:{to:K,params:{...s,outboxMessageId:r}}}function be(e,t){if(e?.kind==="reply"&&e.threadId===t.threadId&&e.sourceMessageId===t.messageId)return e.outboxMessageId}function Ke(){const e=h(),t=g(),{list:s,mailboxId:r}=b(),n=$();return i.useCallback(o=>{e({...G(s,r,o,be(n,o)),search:a=>a,hash:t})},[e,t,s,r,n])}function Qe(e,t,s){if(!(!t||!s))return r=>e({threadId:t,messageId:s,mode:r})}function Xe(){const e=h(),{list:t,mailboxId:s}=b(),r=$();return i.useCallback(n=>{r?.kind==="reply"&&e({...G(t,s,{threadId:r.threadId,messageId:r.sourceMessageId,mode:r.mode},n),search:o=>o,hash:!0,replace:!0})},[e,t,s,r])}function qe(){const e=h(),t=g(),{list:s,mailboxId:r}=b(),n=q();return i.useCallback(()=>{if(!n)return;const o=c=>c,a=t,u={threadId:n.threadId,messageId:n.messageId};if(s==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:u,search:o,hash:a});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{...u,mailboxId:r},search:o,hash:a});return}e({to:"/mail/brief/$threadId/$messageId",params:u,search:o,hash:a})},[e,t,s,r,n])}const ge=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),s=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(s)return{kind:"html",contentUrl:s.contentUrl};const r=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return r?{kind:"text",contentUrl:r.contentUrl}:null},R={all:["messages"],detail:e=>[...R.all,"detail",e],body:e=>[...R.detail(e),"body"]};class m extends Error{reason;status;retryAfterSeconds;constructor(t,s,r,n){super(s),this.name="BodyFetchError",this.reason=t,this.status=r,this.retryAfterSeconds=n}}const ye=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},Ie=8,xe="x-remit-403-reason",Re=(e,t)=>{const s=t?.trim()??"";return e===401?"auth":e===403?s.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},ke=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,we=(e,t)=>{const s=(t??"").toLowerCase();return!!(e==="text"&&s.startsWith("text/html"))},Ce=async(e,t,s=async()=>null)=>{const r={},n=await s();n&&(r.Authorization=`Bearer ${n}`);const o=await se(e,{headers:r});if(o.status===202)throw new m("not-ready","Message body is still syncing",202,ye(o.headers.get("Retry-After")));if(!o.ok){const c=o.headers.get(xe),y=Re(o.status,c);throw new m(y,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(we(t,a))throw new m("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const u=await o.text();if(ke(u,a))throw new m("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return u},$e=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),Ge=({messageId:e,bodyParts:t,enabled:s=!0})=>{const r=t?ge(t):null,n=z(),{getToken:o}=J(),a=i.useRef(null),u=Z(),c=i.useRef(!1),y=i.useRef(null),E=e&&r?`${e}:${r.contentUrl}`:null;y.current!==E&&(y.current=E,c.current=!1);const l=ee({queryKey:e?[...R.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 p=c.current;return c.current=!1,$e({fetchContent:(d,V)=>Ce(d,V,o),refetchDescribeMessage:()=>u.refetchQueries({queryKey:te({path:{messageId:e}})})},{contentUrl:r.contentUrl,kind:r.kind,isRetryAfterNotReady:p})},enabled:s&&!!e&&!!r,staleTime:300*1e3,gcTime:1800*1e3,retry:(p,d)=>d instanceof m&&d.reason==="not-ready"?p<Ie:p<1,retryDelay:(p,d)=>d instanceof m&&d.reason==="not-ready"?(c.current=!0,(d.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),I=l.isLoading&&!!r;i.useEffect(()=>{I&&(a.current=performance.now())},[I]),i.useEffect(()=>{l.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[l.isSuccess,n]);const j=l.data&&r?{kind:r.kind,body:l.data}:void 0;return{picked:r,data:j,isLoading:I,isError:l.isError,error:l.error,refetch:l.refetch}};export{m as B,Fe as N,oe as a,Se as b,Ae as c,ne as d,ve as e,_ as f,Ne as g,Oe as h,ue as i,Le as j,De as k,Pe as l,Te as m,g as n,Ke as o,Ge as p,Ue as q,Qe as r,Be as s,Xe as t,_e as u,qe as v,Re as w,$ as x};
1
+ import{bO as M,bP as T,bQ as O,w as f,r as i,bR as P,m as h,j as W,bS as Y,bT as H,W as z,k as J,n as Z,s as ee,bU as te,bV as se}from"./index-DZbb2VEN.js";import{u as re}from"./useMediaQuery-DsVuv50k.js";function ne(e){const t=M({warn:e?.router===void 0}),s=e?.router||t;return T(s.stores.__store,O(e,s))}function oe(e){const t=M();return T(t.stores.location,O(e,t))}const S="/mail/brief",A="/mail/$mailboxId",v="/mail/outbox",L="/mail/flagged";function _(e){for(const t of e){if(t.routeId===S)return{list:"brief"};if(t.routeId===L)return{list:"flagged"};if(t.routeId===v)return{list:"outbox"};if(t.routeId===A)return{list:"mailbox",mailboxId:t.params?.mailboxId}}}function Te(e){const t=_(e);if(!t)return"";switch(t.list){case"mailbox":return t.mailboxId?ae(t.mailboxId):"";case"flagged":return L;case"outbox":return v;case"brief":return S}}function ae(e){return`${A}:${e}`}function Oe(e,t){return e===t?!0:e.startsWith(`${t}/`)}function Pe(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);return t[0]==="mail"&&t.length>2}function b(){const e=ne({select:s=>_(s.matches)?.list}),t=f({from:"/mail/$mailboxId",shouldThrow:!1});return{list:e,mailboxId:t?.mailboxId}}const k=["intelligence","nav","shortcuts"],ie=["nav","shortcuts"],ue=e=>ie.includes(e),ce=P(k);function x(e){const t=new Set(e.split(",").map(s=>ce.safeParse(s)).filter(s=>s.success).map(s=>s.data));return k.filter(s=>t.has(s))}function w(e){return k.filter(t=>e.includes(t)).join(",")}function Se(){const e=oe({select:t=>w(x(t.hash))});return i.useMemo(()=>x(e),[e])}const le=(e,t)=>!ue(e)&&t;function de(e){return(t="")=>w(x(t).filter(s=>le(s,e)))}function g(){const e=re();return i.useMemo(()=>de(e),[e])}function Ae(){const e=h();return i.useCallback(t=>{e({search:!0,hash:w(t),replace:!0,hashScrollIntoView:!1})},[e])}const D="/mail/brief/compose/{-$outboxMessageId}",U="/mail/flagged/compose/{-$outboxMessageId}",B="/mail/outbox/compose/{-$outboxMessageId}",F="/mail/$mailboxId/compose/{-$outboxMessageId}";function N(){const e=f({from:D,shouldThrow:!1}),t=f({from:U,shouldThrow:!1}),s=f({from:B,shouldThrow:!1}),r=f({from:F,shouldThrow:!1});return e??t??s??r}function ve(){return N()!==void 0}function Le(){return N()?.outboxMessageId}function fe(e,t,s){return e==="flagged"?{to:U,params:{outboxMessageId:s}}:e==="outbox"?{to:B,params:{outboxMessageId:s}}:e==="mailbox"&&t?{to:F,params:{mailboxId:t,outboxMessageId:s}}:{to:D,params:{outboxMessageId:s}}}function C(){const e=h(),t=g(),{list:s,mailboxId:r}=b();return i.useCallback((n,o)=>{e({...fe(s,r,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,s,r])}function _e(){const e=C();return i.useCallback(()=>e(void 0),[e])}function De(){const e=C();return i.useCallback(t=>e(t),[e])}function Ue(){const e=C();return i.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function Be(){const e=h(),t=g(),{list:s,mailboxId:r}=b();return i.useCallback(()=>{const n=a=>a,o=t;if(s==="flagged"){e({to:"/mail/flagged",search:n,hash:o});return}if(s==="outbox"){e({to:"/mail/outbox",search:n,hash:o});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId",params:{mailboxId:r},search:n,hash:o});return}e({to:"/mail/brief",search:n,hash:o})},[e,t,s,r])}const me=Y(H);function Fe({fragment:e,...t}){const s=g();return W.jsx(me,{...t,hash:e??s})}const he=["reply","reply-all","forward"],pe=P(he),K="/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}",Q="/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}",X="/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}";function q(){const e=f({from:K,shouldThrow:!1}),t=f({from:Q,shouldThrow:!1}),s=f({from:X,shouldThrow:!1});return e??t??s}function $(){const e=q();return i.useMemo(()=>{if(!e)return;const t=pe.safeParse(e.mode);return t.success?{kind:"reply",mode:t.data,threadId:e.threadId,sourceMessageId:e.messageId,outboxMessageId:e.outboxMessageId}:{kind:"unknown",segment:e.mode}},[e])}function Ne(){return $()?.kind==="reply"}function G(e,t,s,r){return e==="flagged"?{to:Q,params:{...s,outboxMessageId:r}}:e==="mailbox"&&t?{to:X,params:{...s,mailboxId:t,outboxMessageId:r}}:{to:K,params:{...s,outboxMessageId:r}}}function be(e,t){if(e?.kind==="reply"&&e.threadId===t.threadId&&e.sourceMessageId===t.messageId)return e.outboxMessageId}function Ke(){const e=h(),t=g(),{list:s,mailboxId:r}=b(),n=$();return i.useCallback(o=>{e({...G(s,r,o,be(n,o)),search:a=>a,hash:t})},[e,t,s,r,n])}function Qe(e,t,s){if(!(!t||!s))return r=>e({threadId:t,messageId:s,mode:r})}function Xe(){const e=h(),{list:t,mailboxId:s}=b(),r=$();return i.useCallback(n=>{r?.kind==="reply"&&e({...G(t,s,{threadId:r.threadId,messageId:r.sourceMessageId,mode:r.mode},n),search:o=>o,hash:!0,replace:!0})},[e,t,s,r])}function qe(){const e=h(),t=g(),{list:s,mailboxId:r}=b(),n=q();return i.useCallback(()=>{if(!n)return;const o=c=>c,a=t,u={threadId:n.threadId,messageId:n.messageId};if(s==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:u,search:o,hash:a});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{...u,mailboxId:r},search:o,hash:a});return}e({to:"/mail/brief/$threadId/$messageId",params:u,search:o,hash:a})},[e,t,s,r,n])}const ge=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),s=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(s)return{kind:"html",contentUrl:s.contentUrl};const r=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return r?{kind:"text",contentUrl:r.contentUrl}:null},R={all:["messages"],detail:e=>[...R.all,"detail",e],body:e=>[...R.detail(e),"body"]};class m extends Error{reason;status;retryAfterSeconds;constructor(t,s,r,n){super(s),this.name="BodyFetchError",this.reason=t,this.status=r,this.retryAfterSeconds=n}}const ye=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},Ie=8,xe="x-remit-403-reason",Re=(e,t)=>{const s=t?.trim()??"";return e===401?"auth":e===403?s.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},ke=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,we=(e,t)=>{const s=(t??"").toLowerCase();return!!(e==="text"&&s.startsWith("text/html"))},Ce=async(e,t,s=async()=>null)=>{const r={},n=await s();n&&(r.Authorization=`Bearer ${n}`);const o=await se(e,{headers:r});if(o.status===202)throw new m("not-ready","Message body is still syncing",202,ye(o.headers.get("Retry-After")));if(!o.ok){const c=o.headers.get(xe),y=Re(o.status,c);throw new m(y,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(we(t,a))throw new m("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const u=await o.text();if(ke(u,a))throw new m("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return u},$e=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),Ge=({messageId:e,bodyParts:t,enabled:s=!0})=>{const r=t?ge(t):null,n=z(),{getToken:o}=J(),a=i.useRef(null),u=Z(),c=i.useRef(!1),y=i.useRef(null),E=e&&r?`${e}:${r.contentUrl}`:null;y.current!==E&&(y.current=E,c.current=!1);const l=ee({queryKey:e?[...R.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 p=c.current;return c.current=!1,$e({fetchContent:(d,V)=>Ce(d,V,o),refetchDescribeMessage:()=>u.refetchQueries({queryKey:te({path:{messageId:e}})})},{contentUrl:r.contentUrl,kind:r.kind,isRetryAfterNotReady:p})},enabled:s&&!!e&&!!r,staleTime:300*1e3,gcTime:1800*1e3,retry:(p,d)=>d instanceof m&&d.reason==="not-ready"?p<Ie:p<1,retryDelay:(p,d)=>d instanceof m&&d.reason==="not-ready"?(c.current=!0,(d.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),I=l.isLoading&&!!r;i.useEffect(()=>{I&&(a.current=performance.now())},[I]),i.useEffect(()=>{l.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[l.isSuccess,n]);const j=l.data&&r?{kind:r.kind,body:l.data}:void 0;return{picked:r,data:j,isLoading:I,isError:l.isError,error:l.error,refetch:l.refetch}};export{m as B,Fe as N,oe as a,Se as b,Ae as c,ne as d,ve as e,_ as f,Ne as g,Oe as h,ue as i,Le as j,De as k,Pe as l,Te as m,g as n,Ke as o,Ge as p,Ue as q,Qe as r,Be as s,Xe as t,_e as u,qe as v,Re as w,$ as x};
@@ -1 +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-CruZwy_j.js";import{C as B}from"./circle-check-big-CcGlW81M.js";import{R as G,c as P}from"./search-token-index-Bduf_pxP.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};
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-DZbb2VEN.js";import{C as B}from"./circle-check-big-Cx6DiXm_.js";import{R as G,c as P}from"./search-token-index-mqaKvTQn.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},"user")&&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};
@@ -1 +1 @@
1
- import{m as v,l as x,P as I,r as h}from"./index-CruZwy_j.js";import{d as Q,e as R,g as b}from"./useMessageBodyContent-DPqly9Qg.js";import{b as q}from"./search-view-D0WpJ5LA.js";function A(o){const t=v(),{searchInput:i,searchQuery:e}=x(),{q:n=""}=I({from:"/mail"}),c=Q({select:p=>p.location.pathname}),f=R(),y=b(),m=f||y,a=h.useRef(n);a.current=n;const{to:r}=o,s="params"in o?o.params.mailboxId:void 0,l=s?`/mail/${s}`:r;h.useEffect(()=>{if(!q({searchInput:i,committedQuery:e,urlQuery:a.current,pathname:c,listPath:l}))return;const d=!!e&&a.current!==e&&!m,u=g=>({...g,q:e||void 0});if(!d){t({to:".",search:u,hash:!0,replace:!0});return}if(r==="/mail/$mailboxId"){if(!s)return;t({to:r,params:{mailboxId:s},search:u,hash:!0,replace:!0});return}t({to:r,search:u,hash:!0,replace:!0})},[i,e,t,r,s,l,c,m])}export{A as u};
1
+ import{m as v,l as x,P as I,r as h}from"./index-DZbb2VEN.js";import{d as Q,e as R,g as b}from"./useMessageBodyContent-DURLaUOg.js";import{b as q}from"./search-view-CeB9CiFQ.js";function A(o){const t=v(),{searchInput:i,searchQuery:e}=x(),{q:n=""}=I({from:"/mail"}),c=Q({select:p=>p.location.pathname}),f=R(),y=b(),m=f||y,a=h.useRef(n);a.current=n;const{to:r}=o,s="params"in o?o.params.mailboxId:void 0,l=s?`/mail/${s}`:r;h.useEffect(()=>{if(!q({searchInput:i,committedQuery:e,urlQuery:a.current,pathname:c,listPath:l}))return;const d=!!e&&a.current!==e&&!m,u=g=>({...g,q:e||void 0});if(!d){t({to:".",search:u,hash:!0,replace:!0});return}if(r==="/mail/$mailboxId"){if(!s)return;t({to:r,params:{mailboxId:s},search:u,hash:!0,replace:!0});return}t({to:r,search:u,hash:!0,replace:!0})},[i,e,t,r,s,l,c,m])}export{A as u};
@@ -1,4 +1,4 @@
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-CruZwy_j.js";import{K as k}from"./kbd-CPpFVi9O.js";import{B as ae,p as oe,d as ie}from"./useMessageBodyContent-DPqly9Qg.js";import{M as L}from"./enums-CCxx0t2v.js";import{i as ce}from"./search-scope-BhgcAbIG.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
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-DZbb2VEN.js";import{K as k}from"./kbd-B8xYac2O.js";import{B as ae,p as oe,d as ie}from"./useMessageBodyContent-DURLaUOg.js";import{M as L}from"./enums-CCxx0t2v.js";import{i as ce}from"./search-scope-DmftgZn_.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
2
2
  /* Zero the UA default body margin and clamp the document to the iframe width so
3
3
  wide author markup can't push the body (and the page) past the viewport. */
4
4
  html, body {
@@ -1 +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-CruZwy_j.js";import{P as O}from"./attachment-file-CmBlR4Nw.js";import{ag as P,ah as _,ai as q,aj as z}from"./MailListHeader-D31JcI05.js";import{a as N}from"./useLabels-zav64w0S.js";import{M as U}from"./enums-CCxx0t2v.js";import{d as w}from"./useMessageBodyContent-DPqly9Qg.js";import{n as B}from"./search-query-Cr_ZXBCp.js";import{s as F}from"./search-scope-BhgcAbIG.js";import{u as G,p as K}from"./useSearchTokenContext-D18dJFny.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};
1
+ import{n as L,a5 as C,a7 as k,bn as I,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-DZbb2VEN.js";import{P as O}from"./attachment-file-Cg9oKgdz.js";import{ah as P,ai as _,aj as q,ak as z}from"./MailListHeader-C1OfZ3C8.js";import{a as N}from"./useLabels-B4qFuaRo.js";import{M as U}from"./enums-CCxx0t2v.js";import{d as w}from"./useMessageBodyContent-DURLaUOg.js";import{n as B}from"./search-query-Cr_ZXBCp.js";import{s as F}from"./search-scope-DmftgZn_.js";import{u as G,p as K}from"./useSearchTokenContext-C-7FZRgv.js";const V=t=>{const{mailboxId:a,messages:i}=t,l=L(),{pushError:c}=C(),{mutateAsync:n,isPending:s}=k({...E(),onError:(o,u)=>{c({title:u.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:I(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};
@@ -1 +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-CruZwy_j.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};
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-DZbb2VEN.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-CruZwy_j.js"></script>
41
+ <script type="module" crossorigin src="/assets/index-DZbb2VEN.js"></script>
42
42
  <link rel="stylesheet" crossorigin href="/assets/index-Bn4mOVkF.css">
43
43
  </head>
44
44
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client-dist",
3
- "version": "0.0.372",
3
+ "version": "0.0.374",
4
4
  "description": "Built Remit web client — static assets and the default runtime config.",
5
5
  "files": [
6
6
  "**/*"
@@ -1 +0,0 @@
1
- import{j as a,af as Ze,S as Xe,bh as es,l as E,bb as ss,m as oe,r as o,s as ae,bi as ne,q as ts,bj as as,bk as ns,bl as os,e as Te,bm as rs,i as is}from"./index-CruZwy_j.js";import{s as Re,a as ls,b as Me,u as cs,p as ds,R as us}from"./useSearchTokenContext-D18dJFny.js";import{a2 as ve,D as ye,a3 as ms,a4 as fs,E as hs,a5 as Se,a6 as gs,a7 as xs,a8 as ps,a1 as Is,a9 as bs,aa as vs,ab as ys,M as Ss,ac as Cs,ad as js,ae as Ts,e as Rs,v as Ms,af as ws,r as ks,S as As,H as Fs,L as Ce,K as Ns,I as Bs,d as Os,W as Ls,X as we,Y as Es,Z as ke,_ as Ds}from"./MailListHeader-D31JcI05.js";import{u as Ps,a as qs,R as zs,i as Hs,b as Qs}from"./useRefreshControl-BliVFItV.js";import{e as _s,c as $s,R as Ws}from"./search-token-index-Bduf_pxP.js";import{a as Us}from"./useLabels-zav64w0S.js";import{u as Vs}from"./useMediaQuery-C5e0Az56.js";import{u as Ys,L as Gs}from"./useSemanticSearch-BnRS-ivx.js";import{n as Js,e as Ks,g as Zs,o as Xs,r as et}from"./useMessageBodyContent-DPqly9Qg.js";function st({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:tt(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 tt({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 Ae=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Fe="category",at={unclassified:"uncategorized"},W=e=>ls(e).map(s=>s.raw),$=e=>e.join(" "),re=e=>{const s=Me(e);if(s)return Ae.find(n=>n.name===s.name&&n.value===s.value.toLowerCase())?.id},ie=e=>{const s=Me(e);if(!s||s.name!==Fe)return;const n=s.value.toLowerCase(),r=at[n];if(r)return r;if(!(!es(n)||n==="all"))return n},Ne=e=>Ae.find(s=>s.id===e),Be=e=>Ne(e)!==void 0,nt=e=>{const s=new Set;for(const n of W(e)){const r=re(n);r&&s.add(r)}return s},ot=e=>{let s="all";for(const n of W(e)){const r=ie(n);r&&(s=r)}return s},rt=(e,s)=>{const n=Ne(s);if(!n)return;const r=W(e),d=r.filter(l=>re(l)!==s);return d.length<r.length?$(d):$([...r,Re(n.name,n.value)])},it=(e,s)=>{const n=W(e).filter(r=>!ie(r));return $(s==="all"?n:[...n,Re(Fe,s)])},lt=e=>$(W(e).filter(s=>!re(s)&&!ie(s))),Oe=e=>e.trim().length>0,ct=e=>{if(!Oe(e.query))return e.ownFilters;const s=new Set(nt(e.query));for(const n of e.ownFilters)Be(n)||s.add(n);return s},dt=e=>Oe(e.query)?ot(e.query):e.ownCategory,ut=(e,s)=>e.createdAt!==s.createdAt?e.createdAt-s.createdAt:e.accountId.localeCompare(s.accountId),mt=e=>[...e].sort(ut),ft=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))}),ht=({accountEmail:e})=>{const s=oe();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(Te,{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"})]})},gt=(e,s)=>{if(s.size===0)return{};const n=new Set,r=new Set;for(const l of e)s.has(l.id)&&(l.accountId&&n.add(l.accountId),l.mailboxId&&r.add(l.mailboxId));if(n.size>1)return{restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"};const d=n.size===1?[...n][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 xt({header:e,rows:s,wizard:n,children:r}){const{selectedIds:d,selectedCount:l,exitSelection:g,orderedIds:m,allSelected:u,toggleAllLoaded:S}=Ts(),p=o.useMemo(()=>gt(s,d),[s,d]),{junkMailboxId:I}=Rs(p.accountId),{labels:b}=Us(p.accountId),F=o.useMemo(()=>Array.from(d),[d]),D=o.useMemo(()=>s.filter(x=>d.has(x.id)).map(x=>({id:x.id,sender:x.fromName,email:x.fromEmail,subject:x.subject,date:x.timeLabel})),[s,d]),f=Ms(I,p.mailboxId),v=o.useMemo(()=>m.length>0?{checked:u,indeterminate:l>0&&!u,onChange:S}:void 0,[m.length,u,l,S]),N=p.moveDisabledHint?{tone:"warning",text:p.moveDisabledHint}:void 0,C=x=>a.jsx(As,{title:x.title,navSlot:x.navSlot,titleMeta:x.titleMeta,searchSlot:x.searchSlot,searchField:x.searchField,idleSlot:x.makeFilterSlot,count:l,onCancel:g,onDelete:()=>n.start("delete"),onMove:()=>n.start("move"),onOrganize:()=>n.start("organize"),onJunk:f?()=>n.start("junk"):void 0,onMarkRead:()=>n.start("markRead"),overflowSlot:p.accountId&&p.mailboxId&&l>0&&b.length>0?a.jsx(Gs,{accountId:p.accountId,mailboxId:p.mailboxId,messageIds:F}):void 0,selectAll:v,notice:N});return a.jsx(ws,{...e,selectionBar:C,paneOverlay:a.jsx(ks,{verb:n.verb,accountId:p.accountId,mailboxId:p.mailboxId,selection:D,selectionRestriction:p.restriction,onFinished:g}),children:r})}function pt({accounts:e,selectedMessageId:s,onOpenThread:n,commandsRef:r,onTriageContextChange:d,onDeleteMessages:l}){const{searchQuery:g,searchInput:m,resultFolderIndex:u,onSearchChange:S}=E(),p=cs(),I=Vs(),b=_s(),F=ss(),D=oe(),f=o.useMemo(()=>mt(e.filter(t=>!t.muted?.value)),[e]),[v,N]=o.useState("all"),[C,x]=o.useState("all"),[U,P]=o.useState(new Set),[K,j]=o.useState(!1),q=o.useCallback(t=>{P(i=>{const c=new Set(i);return c.has(t)?c.delete(t):c.add(t),c})},[]),V=o.useCallback(()=>P(new Set),[]),R=m.trim().length>0,T=o.useMemo(()=>ct({query:m,ownFilters:U}),[m,U]),M=o.useMemo(()=>dt({query:m,ownCategory:C}),[m,C]),B=o.useCallback(t=>{if(!R||!Be(t)){q(t);return}const i=rt(m,t);i!==void 0&&S(i)},[R,m,S,q]),z=o.useCallback(t=>{if(!R){x(t);return}S(it(m,t))},[R,m,S]),H=o.useCallback(()=>{x("all"),N("all"),V(),R&&S(lt(m))},[R,m,S,V]),{data:O,isLoading:Q,isError:h,refetch:L}=ae({...ne(),staleTime:6e4}),w=$s({queries:f.map(t=>({...ts({path:{accountId:t.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),Y=o.useMemo(()=>{const t=new Map;for(let i=0;i<f.length;i++){const c=f[i].accountId,Ge=(w[i]?.data?.items??[]).reduce((Je,Ke)=>Je+(Ke.unseenCount??0),0);t.set(c,Ge)}return t},[f,w]),De=o.useMemo(()=>f.filter((t,i)=>{const c=w[i];return c?.isError?!as(c.error):!1}),[f,w]),{freeText:k,tokens:Z}=ds(g.trim().toLowerCase(),p),{data:le,isFetching:Pe}=ae({...ne({query:{query:k,limit:ft}}),enabled:k.length>0,staleTime:3e4}),y=o.useMemo(()=>{const t=ve(O?.items??[]).map(ye);return(k?ms(t.filter(c=>fs(c,k)),ve(le?.items??[]).map(ye)):t).filter(c=>(v==="all"||c.accountId===v)&&hs(c,Z))},[O,le,v,k,Z]),{bodyRows:ce,briefSpamOffer:X}=o.useMemo(()=>{if(!k)return{bodyRows:y,briefSpamOffer:void 0};const t=y.map(A=>Se(A,u)),{spam:i}=gs(t);if(i.length===0)return{bodyRows:y,briefSpamOffer:void 0};const c=new Set(i.map(A=>A.id));return{bodyRows:y.filter(A=>!c.has(A.id)),briefSpamOffer:xs(t)}},[y,k,u]),de=o.useMemo(()=>ps(ce),[ce]),ue=o.useCallback((t,i)=>{const c=y.find(A=>A.id===t)?.threadId;c&&n?.({threadId:c,messageId:t},i)},[y,n]),qe=o.useCallback(t=>{const i=t.threadId??y.find(c=>c.id===t.id)?.threadId;i&&n?.({threadId:i,messageId:t.id})},[y,n]),ee=o.useMemo(()=>f.length<=1?[]:[{id:"all",label:"All",active:v==="all"},...f.map(t=>({id:t.accountId,label:t.email.split("@")[0]??t.email,count:Y.get(t.accountId),active:v===t.accountId}))],[f,Y,v]),_=o.useMemo(()=>e.filter(t=>t.muted?.value).length,[e]),ze=o.useMemo(()=>Array.from(Y.values()).reduce((t,i)=>t+i,0),[Y]),se=o.useMemo(()=>f.map(t=>t.accountId),[f]),{hasNewMail:me}=Ps(),{state:fe,errorMessage:he,refresh:ge}=qs(se,{onSettled:()=>L()}),He=o.useMemo(()=>a.jsx(zs,{state:fe,onRefresh:ge,label:"Refresh daily brief",errorMessage:he,hasUpdate:me(se)}),[fe,ge,he,me,se]),te=o.useMemo(()=>y.filter(t=>(M==="all"||t.category===M)&&ns(t,T)).map(t=>Se(t,u)),[y,M,T,u]),{hits:xe,isLoading:Qe}=Ys(),_e=o.useMemo(()=>{const t=new Map;for(const c of O?.items??[])t.set(c.messageId,c.threadId);const i=te.map(c=>t.get(c.id)).filter(c=>c!=null);return Is(xe,i,u)},[xe,te,O,u]),$e=o.useMemo(()=>{const t=bs(ee.map(i=>({id:i.id,label:i.label,count:i.count,active:i.active})));return{categories:t.categories,filters:t.filters,sources:t.sources,sourcesNote:_>0?`+${_} muted`:void 0,selectedCategory:M,activeFilters:T,expanded:K,onExpandedChange:j,onSelectCategory:i=>z(i),onSelectSource:N,onToggleFilter:i=>B(i),onClear:H}},[ee,_,M,T,K,B,z,H]),pe=de.length===0&&v==="all"&&k.length===0&&Z.length===0,We=o.useMemo(()=>f.map(t=>t.accountId),[f]),Ue=o.useMemo(()=>f.some(t=>Hs(t.syncPhase)),[f]),G=Qs(We,pe||Ue),Ie=a.jsxs("div",{className:"h-full overflow-y-auto",children:[a.jsx(je,{}),a.jsx(je,{})]}),be=!Q&&!h&&!pe,Ve=vs({tier:b,hasLiveInput:R,hasCommittedQuery:g.trim().length>0,bodyRendersCommittedResults:!0}),Ye=be?a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[X&&a.jsx(ys,{count:X.count,onScopeToSpam:()=>D({to:"/mail/$mailboxId",params:{mailboxId:X.mailboxId},search:{q:g||void 0}})}),a.jsx("div",{className:"min-h-0 flex-1",children:a.jsx(os,{sections:de,briefCategory:M,Row:Ss,selectedThreadId:s,onSelectThread:ue,onSelectBriefCategory:z,sources:ee,sourcesNote:_>0?`+${_} muted`:void 0,onSelectSource:N,activeFilters:T,onToggleFilter:B,onClearFilters:H})})]}):Q?Ie:h?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(Te,{className:"size-8 text-danger"}),a.jsx("p",{children:"Couldn't load your messages"}),a.jsxs("button",{type:"button",onClick:()=>L(),className:"flex items-center gap-1 text-accent underline text-xs",children:[a.jsx(Ws,{className:"size-3.5"}),"Try again"]})]}):G.resolved?a.jsx(st,{sync:G.syncing?{synced:G.synced,total:G.total}:void 0}):Ie;return a.jsx(rs,{hasSheet:be&&!Ve,children:a.jsx(Cs,{selectedMessageId:s,onOpen:ue,onDeleteMessages:l,onSelectionVerb:F.start,wizardOpen:F.isOpen,commandsRef:r,onTriageContextChange:d,children:a.jsx(xt,{wizard:F,header:{title:"Daily brief",unreadCount:ze,footer:I?a.jsx(js,{}):void 0,searchFilter:$e,searchResults:te,searchLoading:Q||Pe,relatedResults:_e,relatedLoading:Qe,onSelectSearchResult:qe,searchResultsInBody:!0,refreshControl:He},rows:y,children:a.jsxs("div",{className:"flex h-full flex-col",children:[De.map(t=>a.jsx(ht,{accountEmail:t.email,accountId:t.accountId},t.accountId)),a.jsx("div",{className:"min-h-0 flex-1",children:Ye})]})})})})}const Le=o.createContext(null);function J(){const e=o.useContext(Le);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function It({thread:e,children:s}){const n=oe(),r=Js(),{searchInput:d}=E(),l=e?.threadId,g=e?.messageId,{data:m}=ae({...ne(),staleTime:6e4}),u=o.useMemo(()=>m?.items??[],[m]),S=o.useMemo(()=>{if(l)return u.find(h=>h.messageId===g)??u.find(h=>h.threadId===l)},[u,l,g]),p=Fs(l,g),I=S??p,b=g??I?.messageId,F=o.useMemo(()=>{if(l)return{threadId:l,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:b,authenticity:I?.authenticity}},[l,I,b]),D=o.useCallback((h,L)=>{n({to:"/mail/brief/$threadId/$messageId",params:h,replace:L?.replace,search:w=>({...w,q:d||void 0}),hash:r})},[n,r,d]),f=o.useCallback(()=>{n({to:"/mail/brief",search:h=>h,hash:r})},[n,r]),v=o.useCallback(h=>{b&&h.includes(b)&&f()},[b,f]),N=Ce({thread:I,onAfterOptimisticRemove:v}),C=Ns(),{deleteMessages:x}=Bs({mailboxId:I?.mailboxId??"",messages:u,onAfterOptimisticRemove:v}),{toggleReadFor:U}=Os({mailboxId:I?.mailboxId??"",messages:u}),P=C.focusedMessageId,j=o.useMemo(()=>u.find(h=>h.messageId===P),[u,P])??I,q=Ce({thread:j}),V=Ks(),R=Zs(),T=Xs(),M=o.useMemo(()=>et(T,l,b),[T,l,b]),B=o.useMemo(()=>{if(j)return h=>T({threadId:j.threadId,messageId:j.messageId,mode:h})},[T,j]),{nextMessageId:z,previousMessageId:H}=Ls({context:C,orderedIds:C.orderedIds,selectedMessageId:b,enabled:!V&&!R,onClose:f,handlers:{reply:()=>B?.("reply"),replyAll:()=>B?.("reply-all"),forward:()=>B?.("forward"),delete:()=>{C.listCommandsRef.current?.requestVerb("delete")||q.deleteThread()},toggleStar:q.toggleStar,toggleRead:()=>{C.listCommandsRef.current?.requestVerb("markRead")||j&&U([j.messageId],!j.isRead)},goFlagged:()=>n({to:"/mail/flagged"}),goSettings:()=>n({to:"/settings"})}}),O=o.useCallback(h=>{if(!h)return;const L=u.find(w=>w.messageId===h);return L?{threadId:L.threadId,messageId:h}:void 0},[u]),Q={selectedMessageId:b,selectedThread:I,conversation:F,onOpenThread:D,onCloseThread:f,nextThread:O(z),previousThread:O(H),actions:N,onReply:M,triage:C,onDeleteMessages:x,handleDeselectIfRemoved:v};return a.jsx(Le.Provider,{value:Q,children:s})}function Ee(){const{selectedMessageId:e,onOpenThread:s,triage:n,onDeleteMessages:r}=J(),{accounts:d}=E();return a.jsx(pt,{accounts:d,selectedMessageId:e,onOpenThread:s,commandsRef:n.listCommandsRef,onTriageContextChange:n.onTriageContextChange,onDeleteMessages:r})}function bt(){const{conversation:e,actions:s,onReply:n}=J(),{intelligenceOpen:r,onToggleIntelligence:d}=E(),l=is()?.showIntelligencePane??!1,g=!!e,m=l&&g;return a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(Ds,{hasThread:g,intelligenceOpen:m&&r,canToggleIntelligence:m,onToggleIntelligence:d,onReply:n?()=>n("reply"):void 0,onReplyAll:n?()=>n("reply-all"):void 0,onForward:n?()=>n("forward"):void 0,onDelete:g?s.deleteThread:void 0,onToggleStar:g?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:g&&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(we,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity}):a.jsx(us,{})})]})}function vt(){const{selectedThread:e,handleDeselectIfRemoved:s}=J(),{onToggleIntelligence:n}=E();return a.jsx(ke,{onClose:n,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:s})}function yt(){const{selectedThread:e,conversation:s,onOpenThread:n,onCloseThread:r,nextThread:d,previousThread:l,handleDeselectIfRemoved:g}=J(),{intelligenceOpen:m,onToggleIntelligence:u}=E();return s?a.jsxs(a.Fragment,{children:[a.jsx(we,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:r,onOpenIntelligence:u,onSwipeNext:d?()=>n(d):void 0,onSwipePrevious:l?()=>n(l):void 0,mobileIntelligenceOpen:m}),a.jsx(Es,{isOpen:m,onClose:u,ariaLabel:"Message details",side:"right",children:a.jsx(ke,{onClose:u,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,hideCloseButton:!0,onAfterOptimisticRemove:g})})]}):a.jsx("div",{className:"h-full",children:a.jsx(Ee,{})})}const Ft=Object.assign(It,{List:Ee,Reading:bt,Intelligence:vt,Phone:yt});export{Ft as B};
@@ -1 +0,0 @@
1
- import{d4 as X,r,cq as Y,l as P,bb as Z,aF as J,aG as ee,j as n,m as te,i as se}from"./index-CruZwy_j.js";import{u as ae,p as ne,R as re}from"./useSearchTokenContext-D18dJFny.js";import{D as oe,a4 as de,E as ie,aq as le,a5 as ce,b as ue,M as ge,ac as he,ar as me,ae as fe,r as Ie,H as pe,L as V,K as xe,I as Te,d as be,W as ye,X as K,Y as ve,Z as W,_ as Re}from"./MailListHeader-D31JcI05.js";import{u as Ce,b as Se,a as je}from"./MailViewChrome-CUDvmwTn.js";import{f as Me}from"./ErrorState-CNRyRb6l.js";import{u as we}from"./useMediaQuery-C5e0Az56.js";import{n as Fe,e as Pe,g as ke,o as Le,r as Oe}from"./useMessageBodyContent-DPqly9Qg.js";const Ae=()=>Y({query:{starred:!0,order:"desc"}});function _(){const{data:e,isLoading:t,isError:s,error:l,refetch:m,fetchNextPage:a,hasNextPage:c,isFetchingNextPage:d}=Ce({queryKey:Ae(),queryFn:async({pageParam:I})=>{const{data:u}=await X({query:{starred:!0,order:"desc",continuationToken:I},throwOnError:!0});return u},initialPageParam:void 0,getNextPageParam:I=>I.continuationToken,staleTime:6e4});return{threads:r.useMemo(()=>(e?.pages??[]).flatMap(I=>I.items??[]),[e]),isLoading:t,isError:s,error:l,refetch:m,fetchNextPage:a,hasNextPage:c,isFetchingNextPage:d}}const Ne=e=>{const t=new Set;return e.filter(s=>t.has(s.threadId)?!1:(t.add(s.threadId),!0))},Ee={unread:e=>!e.isRead,attachment:e=>e.hasAttachment===!0};function De({rows:e,verb:t}){const{selectedIds:s,exitSelection:l}=fe(),m=r.useMemo(()=>e.filter(a=>s.has(a.id)).map(a=>({id:a.id,sender:a.fromName,email:a.fromEmail,subject:a.subject,date:a.timeLabel})),[e,s]);return n.jsx(Ie,{verb:t,selection:m,selectionRestriction:"spansAccounts",onFinished:l})}function Be({selectedMessageId:e,onOpenThread:t,commandsRef:s,onTriageContextChange:l,onDeleteMessages:m}){const{searchQuery:a,resultFolderIndex:c}=P(),d=ae(),b=we(),I=Z(),[u,f]=r.useState("all"),[C,k]=r.useState(new Set),v=r.useCallback(o=>{k(h=>{const p=new Set(h);return p.has(o)?p.delete(o):p.add(o),p})},[]),S=r.useCallback(()=>{f("all"),k(new Set)},[]),{threads:L,isLoading:T,isError:O,error:q,refetch:A,fetchNextPage:Q,hasNextPage:x,isFetchingNextPage:j}=_(),{freeText:R,tokens:N}=ne(a.trim().toLowerCase(),d),g=r.useMemo(()=>{const o=Array.from(C).map(h=>Ee[h]).filter(h=>h!=null);return Ne(L).map(oe).filter(h=>(u==="all"||h.category===u)&&o.every(p=>p(h))&&(!R||de(h,R))&&ie(h,N))},[L,u,C,R,N]),M=r.useCallback((o,h)=>{const p=g.find(U=>U.id===o)?.threadId;p&&t?.({threadId:p,messageId:o},h)},[g,t]),w=r.useCallback(o=>{const h=o.threadId??g.find(p=>p.id===o.id)?.threadId;h&&t?.({threadId:h,messageId:o.id})},[g,t]),H=r.useMemo(()=>le(),[]),z=r.useMemo(()=>g.map(o=>ce(o,c)),[g,c]),E=r.useMemo(()=>g.filter(o=>!o.isRead).length,[g]),D=T?"loading":O?"error":g.length===0?"empty":"ready",i=r.useCallback(()=>{const o=J(ee());window.open(o,"_blank","noopener,noreferrer")},[]),y=ue(),F=n.jsx("div",{className:"flex h-full min-h-0 flex-col",children:n.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n.jsx("div",{className:"divide-y divide-line",children:g.map(o=>n.jsx(ge,{thread:o,active:o.id===e,onClick:()=>M(o.id)},o.id))}),x?n.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>Q(),disabled:j,children:j?"Loading…":"Load more"}):null]})});return n.jsx(Se,{title:"Starred",unreadCount:E,preset:H,selectedCategory:u,activeFilters:C,onSelectCategory:f,onToggleFilter:v,onClearFilters:S,searchResults:z,searchLoading:T,onSelectSearchResult:w,searchResultsInBody:!0,children:n.jsxs(he,{selectedMessageId:e,onOpen:M,onDeleteMessages:m,onSelectionVerb:I.start,wizardOpen:I.isOpen,commandsRef:s,onTriageContextChange:l,children:[n.jsx(je,{listTitle:"Starred",sections:[{id:"flagged",threads:g}],flatList:!0,hideHeader:!0,listState:y.searchResults?"ready":D,searchQuery:R?a:void 0,errorMessage:O?Me(q):void 0,onRetry:()=>A(),onReportError:i,selectedThreadId:e,onSelectThread:M,isDesktop:b,selectionBar:n.jsx(me,{title:"Starred"}),listBody:y.searchResults??(D==="ready"?F:void 0)}),n.jsx(De,{rows:g,verb:I.verb})]})})}const G=r.createContext(null);function B(){const e=r.useContext(G);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function qe({thread:e,children:t}){const s=te(),l=Fe(),{searchInput:m}=P(),a=e?.threadId,c=e?.messageId,{threads:d}=_(),b=r.useMemo(()=>{if(a)return d.find(i=>i.messageId===c)??d.find(i=>i.threadId===a)},[d,a,c]),I=pe(a,c),u=b??I,f=c??u?.messageId,C=r.useMemo(()=>{if(a)return{threadId:a,mailboxId:u?.mailboxId??"",subject:u?.subject,messageId:f,authenticity:u?.authenticity}},[a,u,f]),k=r.useCallback((i,y)=>{s({to:"/mail/flagged/$threadId/$messageId",params:i,replace:y?.replace,search:F=>({...F,q:m||void 0}),hash:l})},[s,l,m]),v=r.useCallback(()=>{s({to:"/mail/flagged",search:i=>i,hash:l})},[s,l]),S=r.useCallback(i=>{f&&i.includes(f)&&v()},[f,v]),L=V({thread:u,onAfterOptimisticRemove:S}),T=xe(),{deleteMessages:O}=Te({mailboxId:u?.mailboxId??"",messages:d,onAfterOptimisticRemove:S}),{toggleReadFor:q}=be({mailboxId:u?.mailboxId??"",messages:d}),A=T.focusedMessageId,x=r.useMemo(()=>d.find(i=>i.messageId===A),[d,A])??u,j=V({thread:x}),R=Pe(),N=ke(),g=Le(),M=r.useMemo(()=>Oe(g,a,f),[g,a,f]),w=r.useMemo(()=>{if(x)return i=>g({threadId:x.threadId,messageId:x.messageId,mode:i})},[g,x]),{nextMessageId:H,previousMessageId:z}=ye({context:T,orderedIds:T.orderedIds,selectedMessageId:f,enabled:!R&&!N,onClose:v,handlers:{reply:()=>w?.("reply"),replyAll:()=>w?.("reply-all"),forward:()=>w?.("forward"),delete:()=>{T.listCommandsRef.current?.requestVerb("delete")||j.deleteThread()},toggleStar:j.toggleStar,toggleRead:()=>{T.listCommandsRef.current?.requestVerb("markRead")||x&&q([x.messageId],!x.isRead)},goBrief:()=>s({to:"/mail/brief"}),goSettings:()=>s({to:"/settings"})}}),E=r.useCallback(i=>{if(!i)return;const y=d.find(F=>F.messageId===i);return y?{threadId:y.threadId,messageId:i}:void 0},[d]),D={selectedMessageId:f,selectedThread:u,conversation:C,onOpenThread:k,onCloseThread:v,nextThread:E(H),previousThread:E(z),actions:L,onReply:M,triage:T,onDeleteMessages:O,handleDeselectIfRemoved:S};return n.jsx(G.Provider,{value:D,children:t})}function $(){const{selectedMessageId:e,onOpenThread:t,triage:s,onDeleteMessages:l}=B();return n.jsx(Be,{selectedMessageId:e,onOpenThread:t,commandsRef:s.listCommandsRef,onTriageContextChange:s.onTriageContextChange,onDeleteMessages:l})}function He(){const{conversation:e,actions:t,onReply:s}=B(),{intelligenceOpen:l,onToggleIntelligence:m}=P(),a=se()?.showIntelligencePane??!1,c=!!e,d=a&&c;return n.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[n.jsx(Re,{hasThread:c,intelligenceOpen:d&&l,canToggleIntelligence:d,onToggleIntelligence:m,onReply:s?()=>s("reply"):void 0,onReplyAll:s?()=>s("reply-all"):void 0,onForward:s?()=>s("forward"):void 0,onDelete:c?t.deleteThread:void 0,onToggleStar:c?t.toggleStar:void 0,isStarred:t.isStarred,moveContext:c&&t.accountId&&t.mailboxId?{accountId:t.accountId,currentMailboxId:t.mailboxId,onMove:t.moveThread}:void 0}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?n.jsx(K,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity}):n.jsx(re,{})})]})}function ze(){const{selectedThread:e,handleDeselectIfRemoved:t}=B(),{onToggleIntelligence:s}=P();return n.jsx(W,{onClose:s,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function Qe(){const{selectedThread:e,conversation:t,onCloseThread:s,onOpenThread:l,nextThread:m,previousThread:a,handleDeselectIfRemoved:c}=B(),{intelligenceOpen:d,onToggleIntelligence:b}=P();return t?n.jsxs(n.Fragment,{children:[n.jsx(K,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:s,onOpenIntelligence:b,onSwipeNext:m?()=>l(m):void 0,onSwipePrevious:a?()=>l(a):void 0,mobileIntelligenceOpen:d}),n.jsx(ve,{isOpen:d,onClose:b,ariaLabel:"Message details",side:"right",children:n.jsx(W,{onClose:b,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,hideCloseButton:!0,onAfterOptimisticRemove:c})})]}):n.jsx("div",{className:"h-full",children:n.jsx($,{})})}const Xe=Object.assign(qe,{List:$,Reading:He,Intelligence:ze,Phone:Qe});export{Xe as F};