@remit/web-client-dist 0.0.347 → 0.0.349

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 (109) hide show
  1. package/assets/BriefPane-BfuwvROx.js +1 -0
  2. package/assets/{ErrorState-DUgckKDx.js → ErrorState-DlHdbl1h.js} +1 -1
  3. package/assets/FlaggedPane-DXXvbNMD.js +1 -0
  4. package/assets/MailListHeader-BFBjOnAW.js +52 -0
  5. package/assets/{MailViewChrome-CChh5YGY.js → MailViewChrome-XjLFqRLL.js} +1 -1
  6. package/assets/MailboxPane-BwHG9r2e.js +1 -0
  7. package/assets/{NavMenuButton-BhD3j6Q3.js → NavMenuButton-D_W6DXrb.js} +1 -1
  8. package/assets/{OnboardingWizard-I51NAOI2.js → OnboardingWizard-D8Zk-VXt.js} +1 -1
  9. package/assets/OutboxPane-D2d4W5AT.js +1 -0
  10. package/assets/_mailboxId-DstK-xUR.js +1 -0
  11. package/assets/_messageId-CLaETLs-.js +1 -0
  12. package/assets/_messageId-DRTBuwn5.js +1 -0
  13. package/assets/_messageId-DmZCgc4u.js +1 -0
  14. package/assets/_outboxMessageId-DSVc6DQy.js +1 -0
  15. package/assets/_threadId-DiPJwQ2o.js +1 -0
  16. package/assets/_threadId-Djs3CNia.js +1 -0
  17. package/assets/_threadId-DtfbogPc.js +1 -0
  18. package/assets/{account-form-helpers-C48ralIn.js → account-form-helpers-CwJTqJha.js} +1 -1
  19. package/assets/{accounts-B0CbtGL3.js → accounts-sOzFT-mC.js} +1 -1
  20. package/assets/{advanced-sLyRwcIz.js → advanced-MP09rSMr.js} +1 -1
  21. package/assets/{appearance-BR1x2-tj.js → appearance-DHJRN3ld.js} +1 -1
  22. package/assets/{avatar-DIgxxjJo.js → avatar-D3R75Qgk.js} +1 -1
  23. package/assets/{bottom-sheet-BChq8GeA.js → bottom-sheet-BKnsFMEf.js} +1 -1
  24. package/assets/brief-C5lHNp6b.js +1 -0
  25. package/assets/{brief-C209zbh0.js → brief-DqILJyQz.js} +1 -1
  26. package/assets/{browser-ponyfill-DFNFNEmG.js → browser-ponyfill-CTm-DR6u.js} +1 -1
  27. package/assets/{bug-CARa4BW2.js → bug-C2LRkTHS.js} +1 -1
  28. package/assets/{circle-check-KZs1xW98.js → circle-check-C1n1yijO.js} +1 -1
  29. package/assets/{circle-check-big-B_JaD3Sd.js → circle-check-big-BmnT3rLr.js} +1 -1
  30. package/assets/{circle-help-CYbymNEq.js → circle-help-BJLBqOAA.js} +1 -1
  31. package/assets/{clock-B4cFFCTA.js → clock-BNqM2h_T.js} +1 -1
  32. package/assets/{confirm-dialog-CJ9HhvTw.js → confirm-dialog-C1Q_9oNl.js} +1 -1
  33. package/assets/{download-BzZgIdQm.js → download-aqyrBjOU.js} +1 -1
  34. package/assets/{filters-ZLAyhjl9.js → filters-y-tc_bzr.js} +1 -1
  35. package/assets/{flagged-Dp5r6hZL.js → flagged-D6yLzY2X.js} +1 -1
  36. package/assets/flagged-DsEl2-dg.js +1 -0
  37. package/assets/{folders-CtmAeP3l.js → folders-KxXDRobS.js} +1 -1
  38. package/assets/index-Bmrb3uML.js +1 -0
  39. package/assets/index-C8bsgH_w.js +1 -0
  40. package/assets/index-CcuWjbLO.js +1 -0
  41. package/assets/index-Cf7AKvjm.js +1 -0
  42. package/assets/{index-Dz5Qyak4.js → index-DKG1l4OE.js} +4 -4
  43. package/assets/index-DRTBuwn5.js +1 -0
  44. package/assets/index-DhwJT0Xk.js +1 -0
  45. package/assets/index-DmZCgc4u.js +1 -0
  46. package/assets/index-WhbhbXhS.js +1 -0
  47. package/assets/{kbd-Bvbu8R4A.js → kbd-CnUDSPH5.js} +1 -1
  48. package/assets/{labels-CidmMOEG.js → labels-BmRFi78i.js} +1 -1
  49. package/assets/mail-CK2ZaY0m.js +1 -0
  50. package/assets/{menu-BtgYxp2K.js → menu-DdqPoHXZ.js} +1 -1
  51. package/assets/{move-options-vvEZxrXg.js → move-options-DXhjey10.js} +1 -1
  52. package/assets/nav-link-BTQmJNls.js +1 -0
  53. package/assets/{onboarding-DHZfVOmW.js → onboarding-AkJlSpsK.js} +1 -1
  54. package/assets/outbox-CYHiwpl8.js +1 -0
  55. package/assets/{pencil-Bx0MbZnz.js → pencil-DFHNbAYX.js} +1 -1
  56. package/assets/{rich-text-Dltfnun1.js → rich-text-CBLH_ljE.js} +2 -2
  57. package/assets/{rich-text-spellcheck-worker-provider-gpL_e8Lc.js → rich-text-spellcheck-worker-provider-8XL6BOiI.js} +1 -1
  58. package/assets/{rotate-ccw-h15XAO1t.js → rotate-ccw-CYszpTkF.js} +1 -1
  59. package/assets/{row-actions-CmfExpmx.js → row-actions-DjIKrPVk.js} +1 -1
  60. package/assets/search-token-index-D13ogntK.js +1 -0
  61. package/assets/{search-view-Ddk04xwo.js → search-view-B5prVpGW.js} +1 -1
  62. package/assets/{senders-BZcm5VQi.js → senders-BFXe7Id6.js} +1 -1
  63. package/assets/settings-DSF3NSGu.js +1 -0
  64. package/assets/{settings-screen-BtPxdO6Y.js → settings-screen-BgOpI_Lx.js} +1 -1
  65. package/assets/{shield-check-VtnsP_QR.js → shield-check-BBp9gzDX.js} +1 -1
  66. package/assets/{suggested-vips-5wKl0blM.js → suggested-vips-DFwiEmrP.js} +1 -1
  67. package/assets/{use-match-media-BSj_MlsI.js → use-match-media-C1DFe6n_.js} +1 -1
  68. package/assets/{useDebouncedValue-CW8js2xx.js → useDebouncedValue-BazHTAhQ.js} +1 -1
  69. package/assets/{useFilters-YnuG5yKw.js → useFilters-DBElfc_V.js} +1 -1
  70. package/assets/{useLabels-DR8CZ_pi.js → useLabels-CZdQ7rFS.js} +1 -1
  71. package/assets/{useRefreshControl-B4VEe-8O.js → useRefreshControl-DN40VgNE.js} +1 -1
  72. package/assets/useSearchMirror-CiaVi7jg.js +1 -0
  73. package/assets/{useSearchTokenContext-4dsgVPv9.js → useSearchTokenContext-BNRIlJev.js} +1 -1
  74. package/assets/useSemanticSearch-BHpjDfP4.js +1 -0
  75. package/assets/{useSignature-Cgb8x2A1.js → useSignature-BaYkV0lH.js} +1 -1
  76. package/index.html +1 -1
  77. package/package.json +1 -1
  78. package/assets/BriefPane-Cv6V98kK.js +0 -1
  79. package/assets/FlaggedPane-B1ZaTYX6.js +0 -1
  80. package/assets/MailListHeader-CjWw8PVT.js +0 -52
  81. package/assets/MailboxPane-CX39NKSW.js +0 -1
  82. package/assets/OutboxPane-D644CAzB.js +0 -1
  83. package/assets/_mailboxId-BgTWwASF.js +0 -1
  84. package/assets/_messageId-BzMiohkw.js +0 -1
  85. package/assets/_messageId-D3kom_w5.js +0 -1
  86. package/assets/_messageId-DikeY30y.js +0 -1
  87. package/assets/_outboxMessageId-CHoGc8o1.js +0 -1
  88. package/assets/_threadId-BxknsMEz.js +0 -1
  89. package/assets/_threadId-C4ggczjA.js +0 -1
  90. package/assets/_threadId-COZYPHyV.js +0 -1
  91. package/assets/brief-CRRHnwLW.js +0 -1
  92. package/assets/flagged-CL3DI6wM.js +0 -1
  93. package/assets/index--WOliKqi.js +0 -1
  94. package/assets/index-BzMiohkw.js +0 -1
  95. package/assets/index-ChN8WSHb.js +0 -1
  96. package/assets/index-D3kom_w5.js +0 -1
  97. package/assets/index-DM8qsDHp.js +0 -1
  98. package/assets/index-Dy2broY0.js +0 -1
  99. package/assets/index-FdIYPgjj.js +0 -1
  100. package/assets/index-QN16iBGo.js +0 -1
  101. package/assets/intelligence-pref-C6lFpj6U.js +0 -1
  102. package/assets/mail-CK0mlH09.js +0 -1
  103. package/assets/nav-link-DyM-GREt.js +0 -1
  104. package/assets/outbox-DAJ4ANF8.js +0 -1
  105. package/assets/search-scope-5OC8b_q5.js +0 -1
  106. package/assets/search-token-index-Cp2XNfYr.js +0 -1
  107. package/assets/settings-NrN2M0OL.js +0 -1
  108. package/assets/useSearchMirror-wZyUq8Ug.js +0 -1
  109. package/assets/useSemanticSearch-2KSWUDT_.js +0 -1
@@ -1 +1 @@
1
- import{d7 as r,d8 as o,d9 as a}from"./index-Dz5Qyak4.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const l=t=>({post:e=>t.postMessage(e),listen:e=>t.addEventListener("message",s=>e(s.data)),fail:e=>t.addEventListener("error",s=>e(s.message)),terminate:()=>t.terminate()}),i=async t=>{const e=r(t);if(!e)return null;const s=new Worker(new URL("/assets/rich-text-spellcheck-worker-pWkhC-WR.js",import.meta.url),{type:"module"});return n(e,o(),l(s),a(e))};export{i as openSpellcheckWorker};
1
+ import{d7 as r,d8 as o,d9 as a}from"./index-DKG1l4OE.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const l=t=>({post:e=>t.postMessage(e),listen:e=>t.addEventListener("message",s=>e(s.data)),fail:e=>t.addEventListener("error",s=>e(s.message)),terminate:()=>t.terminate()}),i=async t=>{const e=r(t);if(!e)return null;const s=new Worker(new URL("/assets/rich-text-spellcheck-worker-pWkhC-WR.js",import.meta.url),{type:"module"});return n(e,o(),l(s),a(e))};export{i as openSpellcheckWorker};
@@ -1 +1 @@
1
- import{c as t}from"./index-Dz5Qyak4.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-DKG1l4OE.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,an as x}from"./index-Dz5Qyak4.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,an as x}from"./index-DKG1l4OE.js";const i=()=>l.jsx(x,{className:"size-3.5 animate-spin"}),m=(s,n)=>n?l.jsx("span",{className:"sr-only",children:s}):s;function p({actions:s=[],destructive:n,className:o}){const[f,r]=e.useState(!1);return f&&n?.confirm?l.jsxs("div",{className:y("flex items-center gap-2",o),children:[l.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),l.jsx(b,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:n.confirm.cancelLabel??"Cancel"}),l.jsx(b,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?i():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):l.jsxs("div",{className:y("flex items-center gap-2",o),children:[s.map(a=>l.jsx(b,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?i():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:m(a.label,a.iconOnly)},a.label)),n&&l.jsx(b,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?i():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){r(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:m(n.label,n.iconOnly)})]})}export{p as R};
@@ -0,0 +1 @@
1
+ import{c as j,r as l,j as m,g as Q,b as T,cN as V,X as z,K as N,D as b,l as G,t as X,v as F,w as O,z as W,E as J,p as Y,o as Z,co as L}from"./index-DKG1l4OE.js";import{b as ee,e as te,S as ne}from"./nav-link-BTQmJNls.js";import{u as A,D as oe}from"./use-match-media-C1DFe6n_.js";const ve=j("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 Ee=j("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"}]]),re=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Te(e){return re.filter(t=>e[t.action]!==void 0)}const se=[{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 ae(e){for(const t of se){const n=t.hints.find(r=>r.action===e);if(n)return n.keys}}function ie(e){const t=ae(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Ne(e){const t=ie(e);return t===""?"":`(${t})`}const k={action:null,nextPrefix:null,preventDefault:!1},ce={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},le={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 ue(e,t){const n=e.key.toLowerCase(),r=e.metaKey||e.ctrlKey;if(e.inEditable)return{...k,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...k,nextPrefix:t==="g"?null:t};if(r&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(r&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(r)return{...k,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const a=ce[n===","?",":n]??null;return{action:a,nextPrefix:null,preventDefault:a!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const s=n==="j"||n==="arrowdown";if(s||(n==="k"||n==="arrowup"))return{action:s?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const o=le[n];if(o){const s=o.requireShift===!0,a=n.length===1&&!/[a-z0-9]/.test(n);return!s&&e.shiftKey&&!a?k:{action:o.action,nextPrefix:null,preventDefault:!0}}return k}function fe(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const de="data-message-row",pe='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function me(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(pe);return t?!t.hasAttribute(de):!1}function he({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:r,hasValue:o,chipCount:s}){const a=s-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?s===0?{type:"none"}:{type:"focusChip",index:a}:e==="Backspace"||e==="ArrowLeft"?!r||s===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:a}:{type:"none"}}function ge({key:e,repeat:t=!1,index:n,chipCount:r}){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>=r-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function ye(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const be=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,xe=({chips:e=[],onRemoveChip:t,value:n,onChange:r,onClear:o,onClearQuery:s,placeholder:a="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:h="sm",inputId:p,suggest:d,className:x})=>{const q=l.useId(),P=p??q,w=l.useRef(null),D=l.useRef([]),M=s??o,[K,S]=l.useState(null),I=l.useRef(void 0),[$,B]=l.useState(""),v=e.length>0;l.useEffect(()=>{S(i=>i!==null&&i>=e.length?null:i)},[e.length]),l.useEffect(()=>{const i=I.current;if(i!==void 0){if(I.current=void 0,i===null){w.current?.focus();return}D.current[i]?.focus()}});const R=l.useRef(void 0);l.useEffect(()=>{const i=d?.caret;if(!i||i===R.current)return;R.current=i;const u=w.current;!u||u.ownerDocument.activeElement!==u||(u.setSelectionRange(i.cursor,i.cursor),d?.onCaretChange(i.cursor))});const C=i=>{d?.onCaretChange(i.selectionStart??i.value.length)},g=l.useCallback(i=>{S(i),I.current=i},[]),E=l.useCallback(i=>{const u=e[i];u&&t&&(g(ye(i,e.length)),B(`${u.label} removed`),t(u.id))},[e,t,g]),H=l.useCallback(()=>{g(null),o()},[o,g]),_=l.useCallback(i=>{const u=i.currentTarget;if(d?.onKeyDown(i))return;const y=he({key:i.key,shiftKey:i.shiftKey,repeat:i.repeat,caretAtStart:u.selectionStart===0&&u.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(y.type){case"focusChip":i.preventDefault(),g(y.index);return;case"clearQuery":M();return;case"blur":u.blur();return;case"none":return}},[e.length,n,M,g,d]),U=l.useCallback(i=>u=>{const y=ge({key:u.key,repeat:u.repeat,index:i,chipCount:e.length});switch(y.type!=="none"&&u.preventDefault(),y.type){case"removeChip":E(y.index);return;case"focusChip":g(y.index);return;case"focusInput":g(null);return;case"activateChip":return;case"none":return}},[e,E,g]);return l.useEffect(()=>{if(!c)return;const i=u=>{u.key!=="/"||u.metaKey||u.ctrlKey||u.altKey||be(u.target)||(u.preventDefault(),w.current?.focus())};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[c]),m.jsxs("label",{htmlFor:P,className:T("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",h==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[m.jsx(Q,{className:T("shrink-0 text-fg-muted pointer-events-none",h==="lg"?"size-5":"size-4")}),m.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[v&&m.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((i,u)=>m.jsx(V,{ref:y=>{D.current[u]=y},label:i.label,tone:i.tone,focused:K===u,onFocusLabel:()=>S(u),onKeyDown:U(u),onRemove:()=>E(u)},i.id))}),m.jsx("input",{ref:w,id:P,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:K===null?0:-1,onChange:i=>{r(i.target.value),C(i.target)},onKeyDown:_,onKeyUp:i=>C(i.currentTarget),onClick:i=>C(i.currentTarget),onFocus:i=>{S(null),d?.onFocusChange?.(!0),C(i.currentTarget)},onBlur:()=>d?.onFocusChange?.(!1),...d?.comboboxProps,placeholder:v?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||v)&&f&&m.jsx("button",{type:"button",onClick:H,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:m.jsx(z,{className:T("text-fg-muted",h==="lg"?"size-5":"size-4")})}),m.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:$})]})},Pe=({value:e,onChange:t,onClear:n,onClearQuery:r,chips:o,onRemoveChip:s,placeholder:a="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:h,inputId:p,suggest:d,className:x})=>m.jsx(xe,{value:e,onChange:t,onClear:n,onClearQuery:r,chips:o,onRemoveChip:s,placeholder:a,globalFocusKey:c,showClearButton:f,size:h,inputId:p,suggest:d,className:x});function De({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:r=1e3}){const o=l.useRef(e);o.current=e;const s=l.useRef(null),a=l.useRef(null);l.useEffect(()=>{if(!t)return;const c=()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},f=p=>{const d=ue({key:p.key,shiftKey:p.shiftKey,metaKey:p.metaKey,ctrlKey:p.ctrlKey,altKey:p.altKey,inEditable:fe(p.target),onControl:me(p.target)},s.current);if(c(),s.current=d.nextPrefix,d.nextPrefix!==null&&(a.current=setTimeout(()=>{s.current=null,a.current=null},r)),d.action===null)return;const x=o.current[d.action];x&&(d.preventDefault&&p.preventDefault(),x())},h=n===void 0?window:n;if(h!==null)return h.addEventListener("keydown",f),()=>{h.removeEventListener("keydown",f),c(),s.current=null}},[t,r,n])}const Me=({trigger:e,children:t,align:n="right"})=>{const[r,o]=l.useState(!1),s=l.useRef(null),a=l.useCallback(f=>{s.current&&!s.current.contains(f.target)&&o(!1)},[]),c=l.useCallback(f=>{f.key==="Escape"&&o(!1)},[]);return l.useEffect(()=>(r&&(document.addEventListener("mousedown",a),document.addEventListener("keydown",c)),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",c)}),[r,a,c]),m.jsxs("div",{ref:s,className:"relative",children:[m.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),o(!r)},className:N("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}),r&&m.jsx("div",{className:N("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})]})},Ke=({onClick:e,disabled:t,destructive:n,children:r})=>m.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:N("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:r}),Re=()=>m.jsx("div",{className:"my-1 h-px bg-line"}),ke=({accounts:e})=>{const t=b({strict:!1}),n=G(),r=t.mailboxId,{t:o}=X("mail",{useSuspense:!1}),s=l.useCallback((c,f)=>o(c,{defaultValue:f}),[o]),a=F({queries:e.map(c=>({...O({path:{accountId:c.accountId}}),staleTime:1/0}))});if(n.pathname.startsWith("/mail/outbox"))return"Outbox";if(!r)return null;for(let c=0;c<e.length;c++){const f=a[c]?.data?.items;if(!f)continue;const h=f.find(d=>d.mailboxId===r);if(!h)continue;const p=W(e[c].folderAppointments);return J(h,p.get(r),s)}return null},Le=({accounts:e})=>{const n=b({strict:!1}).mailboxId,r=F({queries:e.map(o=>({...O({path:{accountId:o.accountId}}),staleTime:1/0}))});if(!n)return null;for(const o of r){const s=o.data?.items;if(!s)continue;const a=s.find(c=>c.mailboxId===n);if(a)return a.unseenCount}return null};function Ae(e){const t=Y(),{searchInput:n}=Z(),r=ke({accounts:e}),o=ee({select:c=>c.matches}),s=te(o,r),a=l.useCallback(c=>{c===ne&&t({to:"/mail/brief",search:{q:n||void 0}})},[t,n]);return{scope:s,clearScope:a}}function je(){const e=b({from:"/mail/brief/$threadId",shouldThrow:!1}),t=b({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=b({from:"/mail/flagged/$threadId",shouldThrow:!1}),r=b({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),o=b({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),s=b({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),a=e?.threadId??n?.threadId??o?.threadId,c=t?.messageId??r?.messageId??s?.messageId;return l.useMemo(()=>a?{threadId:a,messageId:c}:void 0,[a,c])}const Fe=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=l.useCallback(o=>{const s=o.target;if(!(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable))for(const a of t){if(!(o.key.toLowerCase()===a.key.toLowerCase())||a.requireShift!==void 0&&a.requireShift!==o.shiftKey)continue;const f=o.ctrlKey||o.metaKey;if(a.requireMeta!==void 0){if(a.requireMeta!==f)continue}else{const h=a.noModifiers??!0,p=f||o.altKey||a.requireShift===void 0&&o.shiftKey;if(h&&p)continue}a.preventDefault&&o.preventDefault(),a.stopPropagation&&(o.stopPropagation(),o.stopImmediatePropagation()),a.handler(o);return}},[t]);l.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},we=768,Oe=e=>e!=="desktop",qe=()=>{const e=A(`(min-width: ${we}px)`);return A(oe)?"desktop":e?"tablet":"phone"};function $e(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase(),o=r.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(r)||t.set(r,n.accountId)}return t}function Be(e){const t=new Map;for(const n of e)for(const r of n){const o=r.fullPath?.toLowerCase();if(!o)continue;const s=o.split("/").pop();t.has(o)||t.set(o,r.mailboxId),s&&!t.has(s)&&t.set(s,r.mailboxId)}return t}function He(e,t=[]){const n=e.flat().filter(s=>s.fullPath),r=new Map;for(const s of n){const a=L(s.fullPath).toLowerCase();r.set(a,(r.get(a)??0)+1)}const o=new Map(t.map(s=>[s.accountId,s.email]));return n.map(s=>{const a=L(s.fullPath),c=r.get(a.toLowerCase())===1,f=t.length>1?o.get(s.accountId):void 0;return{value:c?a:s.fullPath,label:s.displayNameOverride?.trim()||a,...f?{hint:f}:{}}})}function _e(e){const t=new Map;for(const n of e){const r=n.email.toLowerCase().split("@")[0]??"";t.set(r,(t.get(r)??0)+1)}return e.map(n=>{const r=n.email.split("@")[0]??n.email,o=t.get(r.toLowerCase())===1,s=n.displayName?.trim();return{value:o?r:n.email,label:s||n.email,...s?{hint:n.email}:{}}})}export{ve as B,Me as D,se as K,Ee as R,Pe as S,Re as a,Ke as b,Be as c,qe as d,je as e,Fe as f,De as g,$e as h,Oe as i,ke as j,Le as k,re as l,Te as m,de as n,He as o,_e as p,ie as s,Ne as t,Ae as u};
@@ -1 +1 @@
1
- import{r as c,j as a,a4 as i,a5 as u,a6 as v}from"./index-Dz5Qyak4.js";const p=c.createContext(null),x=({chrome:r,children:n})=>a.jsx(p.Provider,{value:r,children:n});function h({phone:r,list:n,reading:t,intelligence:o,hasThread:s=!1}){const e=c.useContext(p);if(!e)return a.jsx(i,{});const l={nav:e.nav,overlay:e.overlay,skeleton:a.jsx(i,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?a.jsx(u,{...l,list:r,intelligenceOpen:e.intelligenceOpen}):a.jsx(u,{...l,topBar:e.topBar,list:n,reading:t,intelligence:o,intelligenceOpen:e.intelligenceOpen,hasThread:s})}function O(r,n,t){if(r!==n)return t}function S(r,n){return r===""?"":n}function d({searchInput:r,committedQuery:n,urlQuery:t,pathname:o,listPath:s}){return!v(o,s)||n!==r?!1:n!==t}export{x as M,h as a,d as b,S as c,O as s};
1
+ import{r as c,j as a,a4 as i,a5 as u,a6 as v}from"./index-DKG1l4OE.js";const p=c.createContext(null),x=({chrome:r,children:n})=>a.jsx(p.Provider,{value:r,children:n});function h({phone:r,list:n,reading:t,intelligence:o,hasThread:s=!1}){const e=c.useContext(p);if(!e)return a.jsx(i,{});const l={nav:e.nav,overlay:e.overlay,skeleton:a.jsx(i,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?a.jsx(u,{...l,list:r,intelligenceOpen:e.intelligenceOpen}):a.jsx(u,{...l,topBar:e.topBar,list:n,reading:t,intelligence:o,intelligenceOpen:e.intelligenceOpen,hasThread:s})}function O(r,n,t){if(r!==n)return t}function S(r,n){return r===""?"":n}function d({searchInput:r,committedQuery:n,urlQuery:t,pathname:o,listPath:s}){return!v(o,s)||n!==r?!1:n!==t}export{x as M,h as a,d as b,S as c,O as s};
@@ -1 +1 @@
1
- import{j as e,b as N,p as T,r as c,az as L,al as O,g as $,aD as q,x as I,bb as A,s as k,af as C,bc as M,bd as P,B as S,a as R,be as B,X as G}from"./index-Dz5Qyak4.js";import{K as m}from"./kbd-Bvbu8R4A.js";import{S as Q,a as E}from"./settings-screen-BtPxdO6Y.js";import{E as V}from"./ErrorState-DUgckKDx.js";import{u as D}from"./useDebouncedValue-CW8js2xx.js";import{a as K}from"./format-De9HZKjg.js";import"./avatar-DIgxxjJo.js";import"./menu-BtgYxp2K.js";import"./circle-help-CYbymNEq.js";function _({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=D(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&&K(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,z=g.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:z?e.jsx(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=T(),[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(_,{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,p as T,r as c,az as L,al as O,g as $,aD as q,x as I,bb as A,s as k,af as C,bc as M,bd as P,B as S,a as R,be as B,X as G}from"./index-DKG1l4OE.js";import{K as m}from"./kbd-CnUDSPH5.js";import{S as Q,a as E}from"./settings-screen-BgOpI_Lx.js";import{E as V}from"./ErrorState-DlHdbl1h.js";import{u as D}from"./useDebouncedValue-BazHTAhQ.js";import{a as K}from"./format-De9HZKjg.js";import"./avatar-D3R75Qgk.js";import"./menu-DdqPoHXZ.js";import"./circle-help-BJLBqOAA.js";function _({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=D(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&&K(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,z=g.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:z?e.jsx(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=T(),[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(_,{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,a0 as o}from"./index-DKG1l4OE.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,aB as S}from"./index-Dz5Qyak4.js";import{A as w}from"./avatar-DIgxxjJo.js";import{M as B}from"./menu-BtgYxp2K.js";import{C as v}from"./circle-help-CYbymNEq.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,aB as S}from"./index-DKG1l4OE.js";import{A as w}from"./avatar-D3R75Qgk.js";import{M as B}from"./menu-DdqPoHXZ.js";import{C as v}from"./circle-help-BJLBqOAA.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-Dz5Qyak4.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-DKG1l4OE.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,a7 as e}from"./index-Dz5Qyak4.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
1
+ import{j as t,a7 as e}from"./index-DKG1l4OE.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
@@ -1 +1 @@
1
- import{r as i}from"./index-Dz5Qyak4.js";const s=1024,c=`(min-width: ${s}px) and (not ((orientation: portrait) and (pointer: coarse)))`,h=e=>{const[o,n]=i.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return i.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=r=>n(r.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o};export{c as D,h as u};
1
+ import{r as i}from"./index-DKG1l4OE.js";const s=1024,c=`(min-width: ${s}px) and (not ((orientation: portrait) and (pointer: coarse)))`,h=e=>{const[o,n]=i.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return i.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=r=>n(r.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o};export{c as D,h as u};
@@ -1 +1 @@
1
- import{r as o}from"./index-Dz5Qyak4.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-DKG1l4OE.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,af as b,cR as E,x as C,cS as D,cA as x,cT as F,s as M,cU as P,cV as N,cW as L,cX as T}from"./index-Dz5Qyak4.js";import{u as z,D as w}from"./use-match-media-BSj_MlsI.js";const X=()=>z(w),Y=(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"},G=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?"+":"-",c=Math.abs(o),l=String(Math.floor(c/60)).padStart(2,"0"),f=String(c%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}${l}:${f}`},h="None",Z=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}),ee=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",te=({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}:{}}),_=new Set(["Complete","Failed"]),v=e=>e!==void 0&&_.has(e),R=1e3,k=15e3,J=e=>{const t=Math.max(0,e),r=R*2**t;return Math.min(r,k)},$=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},re=e=>{const[t,r]=m.useState(),a=b({...E(),onSuccess:g=>r(g.organizeJobId)}),{mutate:i}=a,n=C({...D({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return v(I)?!1:J(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]),c=n.data,l=a.isPending?void 0:c,f=l?.state??a.data?.state,u=v(l?.state),p={state:f,matchedCount:l?.matchedCount??0,appliedCount:l?.appliedCount??0,failedCount:l?.failedCount??0,errorMessage:l?.errorMessage??""};return{start:s,refreshStatus:d,progress:p,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:$(a.error,n.error,!!c)}},se=["From","Subject","HasWords","ListId","FromDomain"],U=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ae=(e,t)=>e==="ListId"?U(t):t.trim(),Q=e=>e==="all"?"And":"Or",W=(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:Q(e.matchOperator),literalClauses:a}},j=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}`)}),ne=(e,t)=>{const r=W(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}},H=(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},K=350,ie=(e,t,r)=>{const a=b(x()),{mutateAsync:i}=a,n=q(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const c=m.useRef(n),l=j(t);return m.useEffect(()=>{if(!e||!l||n===s.previewedSignature||n===s.errorSignature)return;const f=setTimeout(()=>{const u=n;c.current=u,i({path:{accountId:e},body:y({...d.current})}).then(p=>{c.current===u&&o({count:p.matchedCount,matchedIds:p.messageIds,previewedSignature:u})}).catch(p=>{c.current===u&&o(g=>({...g,error:p instanceof Error?p.message:"Couldn't count matches.",errorSignature:u}))})},K);return()=>clearTimeout(f)},[e,l,n,s.previewedSignature,s.errorSignature,i]),l?{count:H(s,n),matchedIds:s.previewedSignature===n?s.matchedIds??[]:[]}:{count:{status:"error",reason:F},matchedIds:[]}},A=e=>N({path:{accountId:e}}),oe=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}},ue=e=>{const t=M(),r=b({...P(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a,mutateAsync:i}=r,n=m.useCallback((o,d,c)=>{e&&a({path:{accountId:e},body:S(o,d,c)})},[e,a]),s=m.useCallback(async(o,d,c)=>e?i({path:{accountId:e},body:S(o,d,c)}).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}},ce=e=>{const t=M(),r=b({...T(),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,se as S,re as a,A as b,ne as c,X as d,G as e,Y as f,oe as g,ce as h,y as i,ue as j,te as k,Z as l,ae as n,ee as o,O as p,W as r,ie as u};
1
+ import{r as m,af as b,cO as E,x as C,cP as D,cA as x,cQ as P,s as M,cR as F,cS as N,cT as L,cU as T}from"./index-DKG1l4OE.js";import{u as z,D as w}from"./use-match-media-C1DFe6n_.js";const Y=()=>z(w),G=(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"},X=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?"+":"-",c=Math.abs(o),l=String(Math.floor(c/60)).padStart(2,"0"),f=String(c%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}${l}:${f}`},h="None",Z=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}),ee=({mode:e,ruleScope:t})=>t==="standing"?"standing":t==="until"?"temporary":e==="selected"?"just-these":"all-like-these",te=({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}:{}}),_=new Set(["Complete","Failed"]),v=e=>e!==void 0&&_.has(e),R=1e3,k=15e3,J=e=>{const t=Math.max(0,e),r=R*2**t;return Math.min(r,k)},$=(e,t,r)=>{if(e)return{kind:r?"restartFailed":"startFailed",error:e};if(t)return{kind:"statusUnreadable",error:t}},re=e=>{const[t,r]=m.useState(),a=b({...E(),onSuccess:g=>r(g.organizeJobId)}),{mutate:i}=a,n=C({...D({path:{accountId:e??"",organizeJobId:t??""}}),enabled:!!e&&!!t,refetchInterval:g=>{const I=g.state.data?.state;return v(I)?!1:J(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]),c=n.data,l=a.isPending?void 0:c,f=l?.state??a.data?.state,u=v(l?.state),p={state:f,matchedCount:l?.matchedCount??0,appliedCount:l?.appliedCount??0,failedCount:l?.failedCount??0,errorMessage:l?.errorMessage??""};return{start:s,refreshStatus:d,progress:p,isStarting:a.isPending,isRunning:!!t&&!u,isDone:u,failure:$(a.error,n.error,!!c)}},se=["From","Subject","HasWords","ListId","FromDomain"],U=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ae=(e,t)=>e==="ListId"?U(t):t.trim(),Q=e=>e==="all"?"And":"Or",j=(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:Q(e.matchOperator),literalClauses:a}},q=e=>e.anchorMessageId!==void 0||!e.literalClauses.some(t=>t.field==="HasWords"),H=e=>JSON.stringify({anchor:e.anchorMessageId??null,operator:e.matchOperator,clauses:e.literalClauses.map(t=>`${t.field} ${t.value}`)}),ne=(e,t)=>{const r=j(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}},K=(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},W=350,ie=(e,t,r)=>{const a=b(x()),{mutateAsync:i}=a,n=H(t),[s,o]=m.useState(()=>({})),d=m.useRef(t);d.current=t;const c=m.useRef(n),l=q(t);return m.useEffect(()=>{if(!e||!l||n===s.previewedSignature||n===s.errorSignature)return;const f=setTimeout(()=>{const u=n;c.current=u,i({path:{accountId:e},body:y({...d.current})}).then(p=>{c.current===u&&o({count:p.matchedCount,matchedIds:p.messageIds,previewedSignature:u})}).catch(p=>{c.current===u&&o(g=>({...g,error:p instanceof Error?p.message:"Couldn't count matches.",errorSignature:u}))})},W);return()=>clearTimeout(f)},[e,l,n,s.previewedSignature,s.errorSignature,i]),l?{count:K(s,n),matchedIds:s.previewedSignature===n?s.matchedIds??[]:[]}:{count:{status:"error",reason:P},matchedIds:[]}},A=e=>N({path:{accountId:e}}),oe=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}},ue=e=>{const t=M(),r=b({...F(),onSuccess:()=>{e&&t.invalidateQueries({queryKey:A(e)})}}),{mutate:a,mutateAsync:i}=r,n=m.useCallback((o,d,c)=>{e&&a({path:{accountId:e},body:S(o,d,c)})},[e,a]),s=m.useCallback(async(o,d,c)=>e?i({path:{accountId:e},body:S(o,d,c)}).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}},ce=e=>{const t=M(),r=b({...T(),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,se as S,re as a,A as b,ne as c,Y as d,X as e,G as f,oe as g,ce as h,y as i,ue as j,te as k,Z as l,ae as n,ee as o,O as p,j as r,ie as u};
@@ -1 +1 @@
1
- import{x as L,bB as p,s as n,af as l,bC as d,r as o,bD as y,bE as c,bF as g}from"./index-Dz5Qyak4.js";const u=e=>y({path:{accountId:e}}),P=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:u(e)})}}),{mutateAsync:r}=t;return{createLabel:o.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}},C=e=>{const s=n(),t=l({...c(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{updateLabel:o.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}},h=e=>{const s=n(),t=l({...g(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{deleteLabel:o.useCallback(a=>{e&&r({path:{accountId:e,labelId:a}})},[e,r]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{P as a,C as b,h as c,m as u};
1
+ import{x as L,bB as p,s as n,af as l,bC as d,r as o,bD as y,bE as c,bF as g}from"./index-DKG1l4OE.js";const u=e=>y({path:{accountId:e}}),P=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:u(e)})}}),{mutateAsync:r}=t;return{createLabel:o.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}},C=e=>{const s=n(),t=l({...c(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{updateLabel:o.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}},h=e=>{const s=n(),t=l({...g(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{deleteLabel:o.useCallback(a=>{e&&r({path:{accountId:e,labelId:a}})},[e,r]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{P as a,C as b,h as c,m as u};
@@ -1 +1 @@
1
- import{j as E,e as q,b as j,B as D,r as i,v as C,aF as R,s as P,o as K,a2 as Q,Q as A,P as $,R as z,U as B}from"./index-Dz5Qyak4.js";import{C as G}from"./circle-check-big-B_JaD3Sd.js";import{R as H}from"./search-token-index-Cp2XNfYr.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(G,{className:"size-4 text-positive"}):E.jsx(H,{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 U=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function F(e){return!!e&&U.has(e)}const N=3e3,W=N*2,v={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),W);return()=>clearTimeout(r)},[s,t]);const o=C({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(F(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?v:{syncing:g,resolved:!0,synced:y,total:w}}const M=6e4,I=new Set(["sent","drafts","trash","archive"]),k=(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},X=(e,t)=>{for(const[s,a]of t)if(a>(e.get(s)??0))return!0;return!1},_=i.createContext(null),J=()=>{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=P(),{resultFolderIndex:a}=K(),n=i.useRef(new Map),u=i.useRef(new Set),[c,o]=i.useState(new Set),f=C({queries:e.map(r=>({...R({path:{accountId:r}}),refetchInterval:M,staleTime:M,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=k(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;X(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,k(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=>{z(e,{softError:!0})&&B(e)},L=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(F(c))n=!0;else if(n||L(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:L(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 $({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=P(),a=Q(),{acknowledge:n}=J(),[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:A({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,F as i,J as u};
1
+ import{j as E,e as q,b as j,B as D,r as i,v as C,aF as R,s as P,o as K,a2 as Q,Q as A,P as $,R as z,U as B}from"./index-DKG1l4OE.js";import{C as G}from"./circle-check-big-BmnT3rLr.js";import{R as H}from"./search-token-index-D13ogntK.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(G,{className:"size-4 text-positive"}):E.jsx(H,{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 U=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function F(e){return!!e&&U.has(e)}const N=3e3,W=N*2,v={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),W);return()=>clearTimeout(r)},[s,t]);const o=C({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(F(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?v:{syncing:g,resolved:!0,synced:y,total:w}}const M=6e4,I=new Set(["sent","drafts","trash","archive"]),k=(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},X=(e,t)=>{for(const[s,a]of t)if(a>(e.get(s)??0))return!0;return!1},_=i.createContext(null),J=()=>{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=P(),{resultFolderIndex:a}=K(),n=i.useRef(new Map),u=i.useRef(new Set),[c,o]=i.useState(new Set),f=C({queries:e.map(r=>({...R({path:{accountId:r}}),refetchInterval:M,staleTime:M,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=k(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;X(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,k(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=>{z(e,{softError:!0})&&B(e)},L=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(F(c))n=!0;else if(n||L(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:L(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 $({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=P(),a=Q(),{acknowledge:n}=J(),[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:A({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,F as i,J as u};
@@ -0,0 +1 @@
1
+ import{p as y,o as d,W as x,r as h}from"./index-DKG1l4OE.js";import{b as Q}from"./nav-link-BTQmJNls.js";import{b}from"./search-view-B5prVpGW.js";function M(o){const a=y(),{searchInput:c,searchQuery:r}=d(),{q:i=""}=x({from:"/mail"}),n=Q({select:l=>l.location.pathname}),s=h.useRef(i);s.current=i;const{to:e}=o,t="params"in o?o.params.mailboxId:void 0,m=t?`/mail/${t}`:e;h.useEffect(()=>{if(!b({searchInput:c,committedQuery:r,urlQuery:s.current,pathname:n,listPath:m}))return;const p=!!r&&s.current!==r,u=f=>({...f,q:r||void 0});if(!p){a({to:".",search:u,hash:!0,replace:!0});return}if(e==="/mail/$mailboxId"){if(!t)return;a({to:e,params:{mailboxId:t},search:u,hash:!0,replace:!0});return}a({to:e,search:u,hash:!0,replace:!0})},[c,r,a,e,t,m,n])}export{M as u};
@@ -1,4 +1,4 @@
1
- import{c3 as J,r as g,j as a,b as k,I as ee,a2 as te,n as B,s as $,x as se,cr as D,cq as re,ad as ne,af as ae,ag as oe,bd as ie,e as ce,X as le,K as v,o as de}from"./index-Dz5Qyak4.js";import{K as S}from"./kbd-Bvbu8R4A.js";import{M as O}from"./enums-CCxx0t2v.js";import{u as ue,i as me}from"./search-scope-5OC8b_q5.js";const fe=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},he=()=>`
1
+ import{c3 as J,r as g,j as a,b as k,I as ee,a2 as te,n as B,s as $,x as se,cr as D,cq as re,ad as ne,af as ae,ag as oe,bd as ie,e as ce,X as le,K as v,o as de}from"./index-DKG1l4OE.js";import{K as S}from"./kbd-CnUDSPH5.js";import{M as O}from"./enums-CCxx0t2v.js";import{b as ue,f as me}from"./nav-link-BTQmJNls.js";const fe=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},he=()=>`
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 {
@@ -0,0 +1 @@
1
+ import{s as L,ad as C,af as k,bv as I,bw as A,r as x,j as p,bx as h,by as E,bz as j,o as R,x as Q,bA as z}from"./index-DKG1l4OE.js";import{ai as D,aj as O,ak as _,al as N,am as P}from"./MailListHeader-BFBjOnAW.js";import{a as q}from"./useLabels-CZdQ7rFS.js";import{M as w}from"./enums-CCxx0t2v.js";import{b as U,s as B}from"./nav-link-BTQmJNls.js";import{n as F}from"./search-query-Cr_ZXBCp.js";import{u as G,p as K}from"./useSearchTokenContext-BNRIlJev.js";const V=t=>{const{mailboxId:s,messages:i}=t,l=L(),{pushError:c}=C(),{mutateAsync:r,isPending:a}=k({...A(),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)=>{D(l,O(_(m.body.messageIds??[],i??[],s)))}});return{applyLabel:x.useCallback((o,u,m)=>{o.length!==0&&N(o,d=>r({body:{messageIds:d,labelId:u,action:m}}))},[r]),isPending:a}};function oe({accountId:t,mailboxId:s,messageIds:i}){const{labels:l}=q(t),{applyLabel:c}=V({mailboxId:s}),r=x.useMemo(()=>l.map(a=>({key:a.labelId,label:a.name,icon:p.jsx("span",{className:`size-2.5 rounded-full ${E(a.color)?h[a.color]:h.Default}`}),onSelect:()=>c(i,a.labelId,"Apply")})),[l,i,c]);return r.length===0?null:p.jsx(P,{triggerLabel:"Apply label to selected messages",triggerIcon:p.jsx(j,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:r,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(w)),J=t=>t!==void 0&&H.has(t)?t:void 0,W=t=>{if(t.some(s=>s.type==="isUnread"))return!1;if(t.some(s=>s.type==="isRead"))return!0};function ne({mailboxId:t,filterCategory:s}={}){const{searchQuery:i}=R(),l=G(),c=U({select:e=>e.matches}),r=F(i),{freeText:a,tokens:n}=K(r,l),o=a.length>0,u=n.find(e=>e.type==="category"),m=J(s)??u?.category,d=n.some(e=>e.type==="hasAttachment")?!0:void 0,b=n.some(e=>e.type==="isStarred")?!0:void 0,y=W(n),f=n.find(e=>e.type==="after"),g=n.find(e=>e.type==="before"),S=n.find(e=>e.type==="in"),v=B({matches:c,callerMailboxId:t,inTokenMailboxId:S?.mailboxId}),{data:M,isLoading:T}=Q({...z({query:{query:a,mailboxId:v,limit:$,...m!==void 0?{category:m}:{},...d!==void 0?{hasAttachment:d}:{},...b!==void 0?{hasStars:b}:{},...y!==void 0?{isRead:y}:{},...f?{sentDateFrom:f.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:o,staleTime:6e4});return{hits:M?.items??[],isLoading:o&&T}}export{oe as L,ne as u};
@@ -1 +1 @@
1
- import{s as c,ad as f,x as p,Z as m,r,af as y,ag as T,a1 as x,ah as E}from"./index-Dz5Qyak4.js";const i={html:"",plainText:""},h=e=>{const u=c(),{pushError:o}=f(),{data:n}=p({...m(),staleTime:1/0}),g=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(s=>s.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),a=y({...E(),onSuccess:()=>{u.invalidateQueries({queryKey:x()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),l=r.useCallback((t,s)=>{e&&a.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:s}})},[e,a]);return{signature:g,setSignature:l,isSaving:a.isPending}};export{h as u};
1
+ import{s as c,ad as f,x as p,Z as m,r,af as y,ag as T,a1 as x,ah as E}from"./index-DKG1l4OE.js";const i={html:"",plainText:""},h=e=>{const u=c(),{pushError:o}=f(),{data:n}=p({...m(),staleTime:1/0}),g=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(s=>s.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),a=y({...E(),onSuccess:()=>{u.invalidateQueries({queryKey:x()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),l=r.useCallback((t,s)=>{e&&a.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:s}})},[e,a]);return{signature:g,setSignature:l,isSaving:a.isPending}};export{h 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-Dz5Qyak4.js"></script>
41
+ <script type="module" crossorigin src="/assets/index-DKG1l4OE.js"></script>
42
42
  <link rel="stylesheet" crossorigin href="/assets/index-DivxHcM7.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.347",
3
+ "version": "0.0.349",
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,an as Ze,S as Xe,bp as et,o as B,bj as tt,p as ae,r as n,x as te,bq as se,v as st,w as at,br as ot,bs as nt,bt as rt,e as Re,bu as it,i as lt}from"./index-Dz5Qyak4.js";import{s as Te,a as ct,b as we,u as dt,p as ut,R as mt}from"./useSearchTokenContext-4dsgVPv9.js";import{a5 as ve,G as ye,a6 as ft,a7 as ht,H as gt,a8 as Se,a9 as xt,aa as pt,ab as It,a4 as bt,ac as vt,ad as yt,ae as St,M as Ct,af as jt,ag as Rt,ah as Tt,g as wt,x as Mt,ai as kt,v as At,S as Nt,K as Ft,P as Ce,O as Bt,L as Ot,f as Lt,Z as Et,_ as Me,$ as qt,a0 as ke,a1 as Dt}from"./MailListHeader-CjWw8PVT.js";import{u as Pt,a as zt,R as Ht,i as _t,b as Qt}from"./useRefreshControl-B4VEe-8O.js";import{a as $t}from"./useLabels-DR8CZ_pi.js";import{d as Wt,R as Gt}from"./search-token-index-Cp2XNfYr.js";import{d as Ut}from"./useFilters-YnuG5yKw.js";import{u as Vt,L as Yt}from"./useSemanticSearch-2KSWUDT_.js";function Jt({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:Kt(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 Kt({synced:e,total:t}){return t>0?`${e.toLocaleString()} of ${t.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const Ae=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Ne="category",Zt={unclassified:"uncategorized"},D=e=>ct(e).map(t=>t.raw),q=e=>e.join(" "),oe=e=>{const t=we(e);if(t)return Ae.find(o=>o.name===t.name&&o.value===t.value.toLowerCase())?.id},ne=e=>{const t=we(e);if(!t||t.name!==Ne)return;const o=t.value.toLowerCase(),r=Zt[o];if(r)return r;if(!(!et(o)||o==="all"))return o},Fe=e=>Ae.find(t=>t.id===e),Be=e=>Fe(e)!==void 0,Xt=e=>{const t=new Set;for(const o of D(e)){const r=oe(o);r&&t.add(r)}return t},es=e=>{let t="all";for(const o of D(e)){const r=ne(o);r&&(t=r)}return t},ts=(e,t)=>{const o=Fe(t);if(!o)return;const r=D(e),c=r.filter(l=>oe(l)!==t);return c.length<r.length?q(c):q([...r,Te(o.name,o.value)])},ss=(e,t)=>{const o=D(e).filter(r=>!ne(r));return q(t==="all"?o:[...o,Te(Ne,t)])},as=e=>q(D(e).filter(t=>!oe(t)&&!ne(t))),Oe=e=>e.trim().length>0,os=e=>{if(!Oe(e.query))return e.ownFilters;const t=new Set(Xt(e.query));for(const o of e.ownFilters)Be(o)||t.add(o);return t},ns=e=>Oe(e.query)?es(e.query):e.ownCategory,rs=(e,t)=>e.createdAt!==t.createdAt?e.createdAt-t.createdAt:e.accountId.localeCompare(t.accountId),is=e=>[...e].sort(rs),ls=200,je=()=>a.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,t)=>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"})]})]},t))}),cs=({accountEmail:e})=>{const t=ae();return a.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[a.jsx(Re,{className:"size-3.5 shrink-0"}),a.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),a.jsx("button",{type:"button",onClick:()=>t({to:"/settings/accounts"}),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},ds=(e,t)=>{if(t.size===0)return{};const o=new Set,r=new Set;for(const l of e)t.has(l.id)&&(l.accountId&&o.add(l.accountId),l.mailboxId&&r.add(l.mailboxId));if(o.size>1)return{moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"};const c=o.size===1?[...o][0]:void 0;return r.size>1?{accountId:c,moveDisabledHint:`Move only works within one folder — this selection spans ${r.size} folders`}:{accountId:c,mailboxId:r.size===1?[...r][0]:void 0}};function us({header:e,rows:t,wizard:o,children:r}){const{selectedIds:c,selectedCount:l,exitSelection:p,orderedIds:u,allSelected:x,toggleAllLoaded:y}=Tt(),m=n.useMemo(()=>ds(t,c),[t,c]),{junkMailboxId:S}=wt(m.accountId),{labels:O}=$t(m.accountId),M=n.useMemo(()=>Array.from(c),[c]),j=n.useMemo(()=>t.filter(g=>c.has(g.id)).map(g=>({id:g.id,sender:g.fromName,email:g.fromEmail,subject:g.subject,date:g.timeLabel})),[t,c]),h=Mt(S,m.mailboxId),I=n.useMemo(()=>u.length>0?{checked:x,indeterminate:l>0&&!x,onChange:y}:void 0,[u.length,x,l,y]),b=m.moveDisabledHint?{tone:"warning",text:m.moveDisabledHint}:void 0,F=g=>a.jsx(Nt,{title:g.title,navSlot:g.navSlot,titleMeta:g.titleMeta,searchSlot:g.searchSlot,searchField:g.searchField,idleSlot:g.makeFilterSlot,count:l,onCancel:p,onDelete:()=>o.start("delete"),onMove:()=>o.start("move"),onOrganize:()=>o.start("organize"),onJunk:h?()=>o.start("junk"):void 0,onMarkRead:()=>o.start("markRead"),overflowSlot:m.accountId&&m.mailboxId&&l>0&&O.length>0?a.jsx(Yt,{accountId:m.accountId,mailboxId:m.mailboxId,messageIds:M}):void 0,selectAll:I,notice:b});return a.jsx(kt,{...e,selectionBar:F,paneOverlay:a.jsx(At,{verb:o.verb,accountId:m.accountId,mailboxId:m.mailboxId,selection:j,crossAccount:m.moveDisabledHint!==void 0,onFinished:p}),children:r})}function ms({accounts:e,selectedMessageId:t,onOpenThread:o,commandsRef:r,onTriageContextChange:c,onDeleteMessages:l}){const{searchQuery:p,searchInput:u,resultFolderIndex:x,onSearchChange:y}=B(),m=dt(),S=Ut(),O=Wt(),M=tt(),j=ae(),h=n.useMemo(()=>is(e.filter(s=>!s.muted?.value)),[e]),[I,b]=n.useState("all"),[F,g]=n.useState("all"),[L,U]=n.useState(new Set),[k,P]=n.useState(!1),z=n.useCallback(s=>{U(i=>{const d=new Set(i);return d.has(s)?d.delete(s):d.add(s),d})},[]),H=n.useCallback(()=>U(new Set),[]),C=u.trim().length>0,A=n.useMemo(()=>os({query:u,ownFilters:L}),[u,L]),f=n.useMemo(()=>ns({query:u,ownCategory:F}),[u,F]),R=n.useCallback(s=>{if(!C||!Be(s)){z(s);return}const i=ts(u,s);i!==void 0&&y(i)},[C,u,y,z]),N=n.useCallback(s=>{if(!C){g(s);return}y(ss(u,s))},[C,u,y]),V=n.useCallback(()=>{g("all"),b("all"),H(),C&&y(as(u))},[C,u,y,H]),{data:_,isLoading:Y,isError:re,refetch:ie}=te({...se(),staleTime:6e4}),Q=st({queries:h.map(s=>({...at({path:{accountId:s.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),$=n.useMemo(()=>{const s=new Map;for(let i=0;i<h.length;i++){const d=h[i].accountId,Ye=(Q[i]?.data?.items??[]).reduce((Je,Ke)=>Je+(Ke.unseenCount??0),0);s.set(d,Ye)}return s},[h,Q]),qe=n.useMemo(()=>h.filter((s,i)=>{const d=Q[i];return d?.isError?!ot(d.error):!1}),[h,Q]),{freeText:T,tokens:J}=ut(p.trim().toLowerCase(),m),{data:le,isFetching:De}=te({...se({query:{query:T,limit:ls}}),enabled:T.length>0,staleTime:3e4}),v=n.useMemo(()=>{const s=ve(_?.items??[]).map(ye);return(T?ft(s.filter(d=>ht(d,T)),ve(le?.items??[]).map(ye)):s).filter(d=>(I==="all"||d.accountId===I)&&gt(d,J))},[_,le,I,T,J]),{bodyRows:ce,briefSpamOffer:K}=n.useMemo(()=>{if(!T)return{bodyRows:v,briefSpamOffer:void 0};const s=v.map(w=>Se(w,x)),{spam:i}=xt(s);if(i.length===0)return{bodyRows:v,briefSpamOffer:void 0};const d=new Set(i.map(w=>w.id));return{bodyRows:v.filter(w=>!d.has(w.id)),briefSpamOffer:pt(s)}},[v,T,x]),de=n.useMemo(()=>It(ce),[ce]),ue=n.useCallback((s,i)=>{const d=v.find(w=>w.id===s)?.threadId;d&&o?.({threadId:d,messageId:s},i)},[v,o]),Pe=n.useCallback(s=>{const i=s.threadId??v.find(d=>d.id===s.id)?.threadId;i&&o?.({threadId:i,messageId:s.id})},[v,o]),Z=n.useMemo(()=>h.length<=1?[]:[{id:"all",label:"All",active:I==="all"},...h.map(s=>({id:s.accountId,label:s.email.split("@")[0]??s.email,count:$.get(s.accountId),active:I===s.accountId}))],[h,$,I]),E=n.useMemo(()=>e.filter(s=>s.muted?.value).length,[e]),ze=n.useMemo(()=>Array.from($.values()).reduce((s,i)=>s+i,0),[$]),X=n.useMemo(()=>h.map(s=>s.accountId),[h]),{hasNewMail:me}=Pt(),{state:fe,errorMessage:he,refresh:ge}=zt(X,{onSettled:()=>ie()}),He=n.useMemo(()=>a.jsx(Ht,{state:fe,onRefresh:ge,label:"Refresh daily brief",errorMessage:he,hasUpdate:me(X)}),[fe,ge,he,me,X]),ee=n.useMemo(()=>v.filter(s=>(f==="all"||s.category===f)&&nt(s,A)).map(s=>Se(s,x)),[v,f,A,x]),{hits:xe,isLoading:_e}=Vt(),Qe=n.useMemo(()=>{const s=new Map;for(const d of _?.items??[])s.set(d.messageId,d.threadId);const i=ee.map(d=>s.get(d.id)).filter(d=>d!=null);return bt(xe,i,x)},[xe,ee,_,x]),$e=n.useMemo(()=>{const s=vt(Z.map(i=>({id:i.id,label:i.label,count:i.count,active:i.active})));return{categories:s.categories,filters:s.filters,sources:s.sources,sourcesNote:E>0?`+${E} muted`:void 0,selectedCategory:f,activeFilters:A,expanded:k,onExpandedChange:P,onSelectCategory:i=>N(i),onSelectSource:b,onToggleFilter:i=>R(i),onClear:V}},[Z,E,f,A,k,R,N,V]),pe=de.length===0&&I==="all"&&T.length===0&&J.length===0,We=n.useMemo(()=>h.map(s=>s.accountId),[h]),Ge=n.useMemo(()=>h.some(s=>_t(s.syncPhase)),[h]),W=Qt(We,pe||Ge),Ie=a.jsxs("div",{className:"h-full overflow-y-auto",children:[a.jsx(je,{}),a.jsx(je,{})]}),be=!Y&&!re&&!pe,Ue=yt({tier:O,hasLiveInput:C,hasCommittedQuery:p.trim().length>0,bodyRendersCommittedResults:!0}),Ve=be?a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[K&&a.jsx(St,{count:K.count,onScopeToSpam:()=>j({to:"/mail/$mailboxId",params:{mailboxId:K.mailboxId},search:{q:p||void 0}})}),a.jsx("div",{className:"min-h-0 flex-1",children:a.jsx(rt,{sections:de,briefCategory:f,Row:Ct,selectedThreadId:t,onSelectThread:ue,onSelectBriefCategory:N,sources:Z,sourcesNote:E>0?`+${E} muted`:void 0,onSelectSource:b,activeFilters:A,onToggleFilter:R,onClearFilters:V})})]}):Y?Ie:re?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[a.jsx(Re,{className:"size-8 text-danger"}),a.jsx("p",{children:"Couldn't load your messages"}),a.jsxs("button",{type:"button",onClick:()=>ie(),className:"flex items-center gap-1 text-accent underline text-xs",children:[a.jsx(Gt,{className:"size-3.5"}),"Try again"]})]}):W.resolved?a.jsx(Jt,{sync:W.syncing?{synced:W.synced,total:W.total}:void 0}):Ie;return a.jsx(it,{hasSheet:be&&!Ue,children:a.jsx(jt,{selectedMessageId:t,onOpen:ue,onDeleteMessages:l,onSelectionVerb:M.start,wizardOpen:M.isOpen,commandsRef:r,onTriageContextChange:c,children:a.jsx(us,{wizard:M,header:{title:"Daily brief",unreadCount:ze,footer:S?a.jsx(Rt,{}):void 0,searchFilter:$e,searchResults:ee,searchLoading:Y||De,relatedResults:Qe,relatedLoading:_e,onSelectSearchResult:Pe,searchResultsInBody:!0,refreshControl:He},rows:v,children:a.jsxs("div",{className:"flex h-full flex-col",children:[qe.map(s=>a.jsx(cs,{accountEmail:s.email,accountId:s.accountId},s.accountId)),a.jsx("div",{className:"min-h-0 flex-1",children:Ve})]})})})})}const Le=n.createContext(null);function G(){const e=n.useContext(Le);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function fs({thread:e,children:t}){const o=ae(),{searchInput:r}=B(),c=e?.threadId,l=e?.messageId,{data:p}=te({...se(),staleTime:6e4}),u=n.useMemo(()=>p?.items??[],[p]),x=n.useMemo(()=>{if(c)return u.find(f=>f.messageId===l)??u.find(f=>f.threadId===c)},[u,c,l]),y=Ft(c,l),m=x??y,S=l??m?.messageId,O=n.useMemo(()=>{if(c)return{threadId:c,mailboxId:m?.mailboxId??"",subject:m?.subject,messageId:S,authenticity:m?.authenticity}},[c,m,S]),M=n.useCallback((f,R)=>{o({to:"/mail/brief/$threadId/$messageId",params:f,replace:R?.replace,search:N=>({...N,q:r||void 0})})},[o,r]),j=n.useCallback(()=>{o({to:"/mail/brief",search:f=>f})},[o]),h=n.useCallback(f=>{S&&f.includes(S)&&j()},[S,j]),I=Ce({thread:m,onAfterOptimisticRemove:h}),b=Bt(),{deleteMessages:F}=Ot({mailboxId:m?.mailboxId??"",messages:u,onAfterOptimisticRemove:h}),{toggleReadFor:g}=Lt({mailboxId:m?.mailboxId??"",messages:u}),L=b.focusedMessageId,k=n.useMemo(()=>u.find(f=>f.messageId===L),[u,L])??m,P=Ce({thread:k}),{nextMessageId:z,previousMessageId:H}=Et({context:b,orderedIds:b.orderedIds,selectedMessageId:S,onClose:j,handlers:{reply:()=>I.requestCompose("reply"),replyAll:()=>I.requestCompose("reply_all"),forward:()=>I.requestCompose("forward"),delete:()=>{b.listCommandsRef.current?.requestVerb("delete")||P.deleteThread()},toggleStar:P.toggleStar,toggleRead:()=>{b.listCommandsRef.current?.requestVerb("markRead")||k&&g([k.messageId],!k.isRead)},goFlagged:()=>o({to:"/mail/flagged"}),goSettings:()=>o({to:"/settings"})}}),C=n.useCallback(f=>{if(!f)return;const R=u.find(N=>N.messageId===f);return R?{threadId:R.threadId,messageId:f}:void 0},[u]),A={selectedMessageId:S,selectedThread:m,conversation:O,onOpenThread:M,onCloseThread:j,nextThread:C(z),previousThread:C(H),actions:I,triage:b,onDeleteMessages:F,handleDeselectIfRemoved:h};return a.jsx(Le.Provider,{value:A,children:t})}function Ee(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:r}=G(),{accounts:c}=B();return a.jsx(ms,{accounts:c,selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:r})}function hs(){const{conversation:e,actions:t}=G(),{intelligenceOpen:o,onToggleIntelligence:r}=B(),c=lt()?.showIntelligencePane??!1,l=!!e,p=c&&l;return a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(Dt,{hasThread:l,intelligenceOpen:p&&o,canToggleIntelligence:p,onToggleIntelligence:r,onReply:l?()=>t.requestCompose("reply"):void 0,onReplyAll:l?()=>t.requestCompose("reply_all"):void 0,onForward:l?()=>t.requestCompose("forward"):void 0,onDelete:l?t.deleteThread:void 0,onToggleStar:l?t.toggleStar:void 0,isStarred:t.isStarred,moveContext:l&&t.accountId&&t.mailboxId?{accountId:t.accountId,currentMailboxId:t.mailboxId,onMove:t.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(Me,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,composeRequest:t.composeRequest,onComposeClose:t.clearComposeRequest}):a.jsx(mt,{})})]})}function gs(){const{selectedThread:e,handleDeselectIfRemoved:t}=G(),{onToggleIntelligence:o}=B();return a.jsx(ke,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function xs(){const{selectedThread:e,conversation:t,onOpenThread:o,onCloseThread:r,nextThread:c,previousThread:l,handleDeselectIfRemoved:p}=G(),{intelligenceOpen:u,onToggleIntelligence:x}=B();return t?a.jsxs(a.Fragment,{children:[a.jsx(Me,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:r,onOpenIntelligence:x,onSwipeNext:c?()=>o(c):void 0,onSwipePrevious:l?()=>o(l):void 0,mobileIntelligenceOpen:u}),a.jsx(qt,{isOpen:u,onClose:x,ariaLabel:"Message details",side:"right",children:a.jsx(ke,{onClose:x,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,hideCloseButton:!0,onAfterOptimisticRemove:p})})]}):a.jsx("div",{className:"h-full",children:a.jsx(Ee,{})})}const Rs=Object.assign(fs,{List:Ee,Reading:hs,Intelligence:gs,Phone:xs});export{Rs as B};
@@ -1 +0,0 @@
1
- import{bG as Z,r as n,bH as J,o as M,bj as X,aN as Y,aO as ee,j as a,p as te,i as se}from"./index-Dz5Qyak4.js";import{u as ae,p as oe,R as re}from"./useSearchTokenContext-4dsgVPv9.js";import{G as ne,a7 as de,H as ie,ao as le,a8 as ce,e as ue,M as ge,af as he,ap as me,ah as fe,v as pe,K as xe,P as D,O as Ie,L as Te,f as be,Z as ve,_ as H,$ as Ce,a0 as z,a1 as ye}from"./MailListHeader-CjWw8PVT.js";import{u as Re,b as Se,a as je}from"./MailViewChrome-CChh5YGY.js";import{f as we}from"./ErrorState-DUgckKDx.js";import{d as Me}from"./useFilters-YnuG5yKw.js";const Fe=()=>J({query:{starred:!0,order:"desc"}});function Q(){const{data:e,isLoading:t,isError:o,error:u,refetch:c,fetchNextPage:s,hasNextPage:i,isFetchingNextPage:x}=Re({queryKey:Fe(),queryFn:async({pageParam:d})=>{const{data:h}=await Z({query:{starred:!0,order:"desc",continuationToken:d},throwOnError:!0});return h},initialPageParam:void 0,getNextPageParam:d=>d.continuationToken,staleTime:6e4});return{threads:n.useMemo(()=>(e?.pages??[]).flatMap(d=>d.items??[]),[e]),isLoading:t,isError:o,error:u,refetch:c,fetchNextPage:s,hasNextPage:i,isFetchingNextPage:x}}const Pe=e=>{const t=new Set;return e.filter(o=>t.has(o.threadId)?!1:(t.add(o.threadId),!0))},ke={unread:e=>!e.isRead,attachment:e=>e.hasAttachment===!0};function Le({rows:e,verb:t}){const{selectedIds:o,exitSelection:u}=fe(),c=n.useMemo(()=>e.filter(s=>o.has(s.id)).map(s=>({id:s.id,sender:s.fromName,email:s.fromEmail,subject:s.subject,date:s.timeLabel})),[e,o]);return a.jsx(pe,{verb:t,selection:c,crossAccount:!0,onFinished:u})}function Oe({selectedMessageId:e,onOpenThread:t,commandsRef:o,onTriageContextChange:u,onDeleteMessages:c}){const{searchQuery:s,resultFolderIndex:i}=M(),x=ae(),I=Me(),d=X(),[h,F]=n.useState("all"),[R,T]=n.useState(new Set),S=n.useCallback(r=>{T(g=>{const f=new Set(g);return f.has(r)?f.delete(r):f.add(r),f})},[]),b=n.useCallback(()=>{F("all"),T(new Set)},[]),{threads:p,isLoading:P,isError:k,error:L,refetch:A,fetchNextPage:v,hasNextPage:O,isFetchingNextPage:q}=Q(),{freeText:C,tokens:j}=oe(s.trim().toLowerCase(),x),m=n.useMemo(()=>{const r=Array.from(R).map(g=>ke[g]).filter(g=>g!=null);return Pe(p).map(ne).filter(g=>(h==="all"||g.category===h)&&r.every(f=>f(g))&&(!C||de(g,C))&&ie(g,j))},[p,h,R,C,j]),l=n.useCallback((r,g)=>{const f=m.find(U=>U.id===r)?.threadId;f&&t?.({threadId:f,messageId:r},g)},[m,t]),y=n.useCallback(r=>{const g=r.threadId??m.find(f=>f.id===r.id)?.threadId;g&&t?.({threadId:g,messageId:r.id})},[m,t]),w=n.useMemo(()=>le(),[]),K=n.useMemo(()=>m.map(r=>ce(r,i)),[m,i]),G=n.useMemo(()=>m.filter(r=>!r.isRead).length,[m]),E=P?"loading":k?"error":m.length===0?"empty":"ready",W=n.useCallback(()=>{const r=Y(ee());window.open(r,"_blank","noopener,noreferrer")},[]),B=ue(),$=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:m.map(r=>a.jsx(ge,{thread:r,active:r.id===e,onClick:()=>l(r.id)},r.id))}),O?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>v(),disabled:q,children:q?"Loading…":"Load more"}):null]})});return a.jsx(Se,{title:"Starred",unreadCount:G,preset:w,selectedCategory:h,activeFilters:R,onSelectCategory:F,onToggleFilter:S,onClearFilters:b,searchResults:K,searchLoading:P,onSelectSearchResult:y,searchResultsInBody:!0,children:a.jsxs(he,{selectedMessageId:e,onOpen:l,onDeleteMessages:c,onSelectionVerb:d.start,wizardOpen:d.isOpen,commandsRef:o,onTriageContextChange:u,children:[a.jsx(je,{listTitle:"Starred",sections:[{id:"flagged",threads:m}],flatList:!0,hideHeader:!0,listState:B.searchResults?"ready":E,searchQuery:C?s:void 0,errorMessage:k?we(L):void 0,onRetry:()=>A(),onReportError:W,selectedThreadId:e,onSelectThread:l,isDesktop:I,selectionBar:a.jsx(me,{title:"Starred"}),listBody:B.searchResults??(E==="ready"?$:void 0)}),a.jsx(Le,{rows:m,verb:d.verb})]})})}const V=n.createContext(null);function N(){const e=n.useContext(V);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function qe({thread:e,children:t}){const o=te(),{searchInput:u}=M(),c=e?.threadId,s=e?.messageId,{threads:i}=Q(),x=n.useMemo(()=>{if(c)return i.find(l=>l.messageId===s)??i.find(l=>l.threadId===c)},[i,c,s]),I=xe(c,s),d=x??I,h=s??d?.messageId,F=n.useMemo(()=>{if(c)return{threadId:c,mailboxId:d?.mailboxId??"",subject:d?.subject,messageId:h,authenticity:d?.authenticity}},[c,d,h]),R=n.useCallback((l,y)=>{o({to:"/mail/flagged/$threadId/$messageId",params:l,replace:y?.replace,search:w=>({...w,q:u||void 0})})},[o,u]),T=n.useCallback(()=>{o({to:"/mail/flagged",search:l=>l})},[o]),S=n.useCallback(l=>{h&&l.includes(h)&&T()},[h,T]),b=D({thread:d,onAfterOptimisticRemove:S}),p=Ie(),{deleteMessages:P}=Te({mailboxId:d?.mailboxId??"",messages:i,onAfterOptimisticRemove:S}),{toggleReadFor:k}=be({mailboxId:d?.mailboxId??"",messages:i}),L=p.focusedMessageId,v=n.useMemo(()=>i.find(l=>l.messageId===L),[i,L])??d,O=D({thread:v}),{nextMessageId:q,previousMessageId:C}=ve({context:p,orderedIds:p.orderedIds,selectedMessageId:h,onClose:T,handlers:{reply:()=>b.requestCompose("reply"),replyAll:()=>b.requestCompose("reply_all"),forward:()=>b.requestCompose("forward"),delete:()=>{p.listCommandsRef.current?.requestVerb("delete")||O.deleteThread()},toggleStar:O.toggleStar,toggleRead:()=>{p.listCommandsRef.current?.requestVerb("markRead")||v&&k([v.messageId],!v.isRead)},goBrief:()=>o({to:"/mail/brief"}),goSettings:()=>o({to:"/settings"})}}),j=n.useCallback(l=>{if(!l)return;const y=i.find(w=>w.messageId===l);return y?{threadId:y.threadId,messageId:l}:void 0},[i]),m={selectedMessageId:h,selectedThread:d,conversation:F,onOpenThread:R,onCloseThread:T,nextThread:j(q),previousThread:j(C),actions:b,triage:p,onDeleteMessages:P,handleDeselectIfRemoved:S};return a.jsx(V.Provider,{value:m,children:t})}function _(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:u}=N();return a.jsx(Oe,{selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:u})}function Ne(){const{conversation:e,actions:t}=N(),{intelligenceOpen:o,onToggleIntelligence:u}=M(),c=se()?.showIntelligencePane??!1,s=!!e,i=c&&s;return a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(ye,{hasThread:s,intelligenceOpen:i&&o,canToggleIntelligence:i,onToggleIntelligence:u,onReply:s?()=>t.requestCompose("reply"):void 0,onReplyAll:s?()=>t.requestCompose("reply_all"):void 0,onForward:s?()=>t.requestCompose("forward"):void 0,onDelete:s?t.deleteThread:void 0,onToggleStar:s?t.toggleStar:void 0,isStarred:t.isStarred,moveContext:s&&t.accountId&&t.mailboxId?{accountId:t.accountId,currentMailboxId:t.mailboxId,onMove:t.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(H,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,composeRequest:t.composeRequest,onComposeClose:t.clearComposeRequest}):a.jsx(re,{})})]})}function Ae(){const{selectedThread:e,handleDeselectIfRemoved:t}=N(),{onToggleIntelligence:o}=M();return a.jsx(z,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function Ee(){const{selectedThread:e,conversation:t,onCloseThread:o,onOpenThread:u,nextThread:c,previousThread:s,handleDeselectIfRemoved:i}=N(),{intelligenceOpen:x,onToggleIntelligence:I}=M();return t?a.jsxs(a.Fragment,{children:[a.jsx(H,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:o,onOpenIntelligence:I,onSwipeNext:c?()=>u(c):void 0,onSwipePrevious:s?()=>u(s):void 0,mobileIntelligenceOpen:x}),a.jsx(Ce,{isOpen:x,onClose:I,ariaLabel:"Message details",side:"right",children:a.jsx(z,{onClose:I,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,hideCloseButton:!0,onAfterOptimisticRemove:i})})]}):a.jsx("div",{className:"h-full",children:a.jsx(_,{})})}const _e=Object.assign(qe,{List:_,Reading:Ne,Intelligence:Ae,Phone:Ee});export{_e as F};