@remit/web-client-dist 0.0.353 → 0.0.355

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-CYfwVL8Y.js +1 -0
  2. package/assets/{ErrorState-D3orNRU4.js → ErrorState-CJ2aoLG_.js} +1 -1
  3. package/assets/FlaggedPane-Sleye2NB.js +1 -0
  4. package/assets/MailListHeader-CiYx2Ro0.js +52 -0
  5. package/assets/{MailViewChrome-Or_Zfnrd.js → MailViewChrome-4eYgZdUD.js} +1 -1
  6. package/assets/MailboxPane-VSk6AMXL.js +1 -0
  7. package/assets/{NavMenuButton-B1nVcSa5.js → NavMenuButton-DCYDMDv1.js} +1 -1
  8. package/assets/{OnboardingWizard-CkM1UvY8.js → OnboardingWizard-DoBOq2ec.js} +1 -1
  9. package/assets/OutboxPane-D0ChJoAd.js +1 -0
  10. package/assets/_mailboxId-CK7QowXy.js +1 -0
  11. package/assets/_messageId-Bw730qzW.js +1 -0
  12. package/assets/_messageId-DRTnEPcv.js +1 -0
  13. package/assets/_messageId-DeYJ2FsF.js +1 -0
  14. package/assets/_outboxMessageId-CECizJ1R.js +1 -0
  15. package/assets/_threadId-DgtAhuV_.js +1 -0
  16. package/assets/_threadId-Dj8HOsy1.js +1 -0
  17. package/assets/_threadId-I8eJqG4z.js +1 -0
  18. package/assets/{account-form-helpers-BZTGbgn5.js → account-form-helpers-DAuyJa3o.js} +1 -1
  19. package/assets/{accounts-BUqCJgDQ.js → accounts-CeDKOmD9.js} +1 -1
  20. package/assets/{advanced-ChGO6lwb.js → advanced-hybSRTbS.js} +1 -1
  21. package/assets/{appearance-hzG3cLo6.js → appearance-BpvA9O2b.js} +1 -1
  22. package/assets/{avatar-902Ehcia.js → avatar-CmvuzecB.js} +1 -1
  23. package/assets/{bottom-sheet-DSZ-IeLs.js → bottom-sheet-BYOjIdVx.js} +1 -1
  24. package/assets/{brief-B_cGujUH.js → brief-BVPyzhNL.js} +1 -1
  25. package/assets/brief-DF7GfO-r.js +1 -0
  26. package/assets/{browser-ponyfill-D3Qjvj70.js → browser-ponyfill-C0xW0XXl.js} +1 -1
  27. package/assets/{bug-BPy3lhCs.js → bug-JM5TdK6J.js} +1 -1
  28. package/assets/{circle-check-Bd1R3tZl.js → circle-check-DlmySaui.js} +1 -1
  29. package/assets/{circle-check-big-DAvgIk1F.js → circle-check-big-Cj9roMB7.js} +1 -1
  30. package/assets/{circle-help-BG86c5CF.js → circle-help-C_AXwAaV.js} +1 -1
  31. package/assets/{clock-D7o61sW5.js → clock-C4V2tcYN.js} +1 -1
  32. package/assets/{confirm-dialog-CMKEZton.js → confirm-dialog-DPkij3bo.js} +1 -1
  33. package/assets/{download-CtV8eLNc.js → download-ChGh-J5t.js} +1 -1
  34. package/assets/filters-GacN8-tL.js +1 -0
  35. package/assets/{flagged-CvZY9GgJ.js → flagged-D5M0XeA-.js} +1 -1
  36. package/assets/flagged-DRo_foUo.js +1 -0
  37. package/assets/{folders-C68Orza8.js → folders-BrH0h_oC.js} +1 -1
  38. package/assets/index-0RAdsyez.js +1 -0
  39. package/assets/{index-DivxHcM7.css → index-Bn4mOVkF.css} +1 -1
  40. package/assets/{index-Bf6zeV_t.js → index-Bqn7f16e.js} +4 -4
  41. package/assets/index-Csk5-jLk.js +1 -0
  42. package/assets/index-D6wIsDjM.js +1 -0
  43. package/assets/index-DRTnEPcv.js +1 -0
  44. package/assets/index-DeYJ2FsF.js +1 -0
  45. package/assets/index-W1wD_fe0.js +1 -0
  46. package/assets/index-hR0QoOpl.js +1 -0
  47. package/assets/index-u91rwMUb.js +1 -0
  48. package/assets/{kbd-C4MYDwt7.js → kbd-BG1I0chs.js} +1 -1
  49. package/assets/{labels-CxqBtA9B.js → labels-BavFLXMP.js} +1 -1
  50. package/assets/mail-2xAGIPds.js +1 -0
  51. package/assets/{menu-DNUIh6FR.js → menu-vEH9STs_.js} +1 -1
  52. package/assets/{move-options-BPdblyET.js → move-options-k5syuO4O.js} +1 -1
  53. package/assets/nav-link-COOZsOLo.js +1 -0
  54. package/assets/{onboarding-D_iTSaYS.js → onboarding-B28Gihze.js} +1 -1
  55. package/assets/outbox-XuiN4du0.js +1 -0
  56. package/assets/{pencil-j8v7X9GK.js → pencil-CkIitMcy.js} +1 -1
  57. package/assets/{rich-text-D7ibJsSf.js → rich-text-CsEQAreR.js} +1 -1
  58. package/assets/{rich-text-spellcheck-worker-provider-BtCQ4Qwa.js → rich-text-spellcheck-worker-provider-x6rgxHWR.js} +1 -1
  59. package/assets/{rotate-ccw-9aRuc9Yf.js → rotate-ccw-xiByt5L1.js} +1 -1
  60. package/assets/{row-actions-Dq-6Ssz1.js → row-actions-t73y2fxd.js} +1 -1
  61. package/assets/search-token-index-D-3XiS1P.js +1 -0
  62. package/assets/{search-view-B25AYYYV.js → search-view-B6uoqRaE.js} +1 -1
  63. package/assets/{senders-KLHBevDQ.js → senders-cIRRNPpD.js} +1 -1
  64. package/assets/settings-DzfdNeyv.js +1 -0
  65. package/assets/{settings-screen-DSdtzTVA.js → settings-screen-CH2hBhXZ.js} +1 -1
  66. package/assets/{shield-check-CmXHx2Di.js → shield-check-drtxfxOL.js} +1 -1
  67. package/assets/{suggested-vips-3e-ngqqE.js → suggested-vips-CNjxCtfh.js} +1 -1
  68. package/assets/{useDebouncedValue-fVfFWYH1.js → useDebouncedValue-upT4qR9G.js} +1 -1
  69. package/assets/useFilters-SCAefE6U.js +1 -0
  70. package/assets/{useLabels-BMVLGb1c.js → useLabels-EfJaVdWJ.js} +1 -1
  71. package/assets/useMediaQuery-C47DmZA5.js +1 -0
  72. package/assets/{useRefreshControl-Ba6f6ijf.js → useRefreshControl-DMQBrv7r.js} +1 -1
  73. package/assets/{useSearchMirror-Co706q8t.js → useSearchMirror-BaenAzTH.js} +1 -1
  74. package/assets/{useSearchTokenContext-BRWpWSX8.js → useSearchTokenContext-ki2AZ7p9.js} +1 -1
  75. package/assets/{useSemanticSearch-CCTRY7p1.js → useSemanticSearch-DoxylHxn.js} +1 -1
  76. package/assets/{useSignature-BoeZFYk-.js → useSignature-6eMCtb3X.js} +1 -1
  77. package/index.html +2 -2
  78. package/package.json +1 -1
  79. package/assets/BriefPane-fii0IiRa.js +0 -1
  80. package/assets/FlaggedPane-BldHHUxk.js +0 -1
  81. package/assets/MailListHeader-GQfpCdPQ.js +0 -52
  82. package/assets/MailboxPane-CO67RCjZ.js +0 -1
  83. package/assets/OutboxPane-DuBwgi_W.js +0 -1
  84. package/assets/_mailboxId-wOAbngf_.js +0 -1
  85. package/assets/_messageId-B6IwOu5Q.js +0 -1
  86. package/assets/_messageId-BtUwYG-X.js +0 -1
  87. package/assets/_messageId-UZEsQ4vY.js +0 -1
  88. package/assets/_outboxMessageId-5j0cIWqh.js +0 -1
  89. package/assets/_threadId-BGjw3ct6.js +0 -1
  90. package/assets/_threadId-CGxoaeOt.js +0 -1
  91. package/assets/_threadId-HAVKpBa2.js +0 -1
  92. package/assets/brief-BvZofry6.js +0 -1
  93. package/assets/filters-B2v4KYwx.js +0 -1
  94. package/assets/flagged-CW_lAfX7.js +0 -1
  95. package/assets/index-Bf2SuMfv.js +0 -1
  96. package/assets/index-BtUwYG-X.js +0 -1
  97. package/assets/index-Bxl7Z2-H.js +0 -1
  98. package/assets/index-COgExB7k.js +0 -1
  99. package/assets/index-DHerCUmJ.js +0 -1
  100. package/assets/index-Dz9b3zRw.js +0 -1
  101. package/assets/index-UZEsQ4vY.js +0 -1
  102. package/assets/index-aSNWfHw0.js +0 -1
  103. package/assets/mail-CGkMgcnN.js +0 -1
  104. package/assets/nav-link-kGZZQ6tj.js +0 -1
  105. package/assets/outbox-CVWfytDc.js +0 -1
  106. package/assets/search-token-index-ufNaSd81.js +0 -1
  107. package/assets/settings-Cx_7vs48.js +0 -1
  108. package/assets/use-match-media-Cqq5eDbi.js +0 -1
  109. package/assets/useFilters-BfhDojrF.js +0 -1
@@ -1 +0,0 @@
1
- import{j as r,be as Ts,az as zt,B as de,S as Rs,b as Re,aA as Jt,r as c,C as Es,d as Os,a$ as As,k as pt,x as tt,Y as Gt,X as Ns,p as st,s as Dt,y as zs,ae as Ft,bf as Yt,bg as Xt,I as Ds,h as Fs,T as _s,bh as Ls,bi as Ps,bj as $s,ac as Zt,aM as Bs,aN as Ws,g as Ks,a1 as _t,bk as Vs,P as qs,w as Hs,bl as Us,o as es,bm as Qs,H as Js,af as Gs,i as Ys,bn as Xs,b4 as Zs}from"./index-Bf6zeV_t.js";import{u as en,p as tn,R as sn}from"./useSearchTokenContext-BRWpWSX8.js";import{u as nn,a as on,R as rn}from"./useRefreshControl-Ba6f6ijf.js";import{C as ts,D as _e,a as ss,b as ns,c as os,j as an,M as ln,t as is,u as cn,d as dn,e as rs,f as as,g as un,h as hn,i as fn,k as mn,l as Wt,n as gn,m as pn,o as xn,p as bn,q as vn,S as Sn,r as yn,s as Cn,v as In,w as ls,x as wn,y as jn,z as kn,A as Mn,B as Tn,E as Rn,F as En,G as On,H as An,I as Nn,J as zn,K as Kt,L as Vt,N as Dn,O as Fn,P as _n,Q as Ln,R as Pn,T as $n,U as Bn,V as Wn,W as Kn,X as Vn,Y as qn,Z as cs,_ as ds,$ as Lt,a0 as Hn,a1 as us,a2 as Un,a3 as Qn}from"./MailListHeader-GQfpCdPQ.js";import{S as Jn,M as Gn,a as Yn,u as Xn,b as Zn}from"./MailViewChrome-Or_Zfnrd.js";import{E as hs,f as eo}from"./ErrorState-D3orNRU4.js";import{d as fs}from"./useFilters-BfhDojrF.js";import{C as ms}from"./confirm-dialog-CMKEZton.js";import{A as Pt}from"./avatar-902Ehcia.js";import{b as nt,c as to,d as so}from"./format-De9HZKjg.js";import{r as Pe}from"./nav-link-kGZZQ6tj.js";import{N as no}from"./NavMenuButton-B1nVcSa5.js";import{a as oo}from"./useLabels-BMVLGb1c.js";import{L as io,u as ro}from"./useSemanticSearch-CCTRY7p1.js";import{u as ao,D as lo}from"./use-match-media-Cqq5eDbi.js";import{S as xt}from"./shield-check-CmXHx2Di.js";import{B as co}from"./bottom-sheet-DSZ-IeLs.js";import{C as uo}from"./circle-help-BG86c5CF.js";import{C as ho}from"./circle-check-Bd1R3tZl.js";import{a as fo,b as mo,f as go}from"./move-options-BPdblyET.js";import{j as po,k as xo,f as bo,d as vo}from"./search-token-index-ufNaSd81.js";import{M as So}from"./enums-CCxx0t2v.js";import{n as yo}from"./search-query-Cr_ZXBCp.js";const Co=({children:e,onRefresh:n,isRefreshing:t})=>ao(lo)?e:r.jsx(Ts,{onRefresh:n,isPullable:!t,children:e}),Io=e=>e===1?"message":"messages";function wo({count:e,onReview:n,onDismiss:t,actionLabel:s="Review & rescue"}){return r.jsx(zt,{tone:"info",variant:"soft",onDismiss:t,children:r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("p",{className:"flex items-start gap-2 text-sm text-fg",children:[r.jsx(xt,{className:"mt-0.5 size-4 shrink-0 text-positive","aria-hidden":!0}),r.jsxs("span",{children:[r.jsx("span",{className:"font-semibold text-fg",children:`${e} ${Io(e)} here`})," ","may not be spam — they're from senders we can verify."]})]}),r.jsx(de,{variant:"primary",size:"sm",onClick:n,className:"self-start",children:s})]})})}const jo=(e,n)=>e==="vip"?"vip":e==="unknown"&&n==="md"?"unknown-pill":"hidden",gs=({senderTrust:e,size:n="sm",className:t})=>{const s=jo(e,n);return s==="vip"?r.jsx(Rs,{className:Re("text-warning shrink-0",n==="sm"&&"size-3.5",n==="md"&&"size-4",t),"aria-label":"VIP sender","data-testid":"sender-trust-vip"}):s==="unknown-pill"?r.jsx("span",{className:Re("inline-flex items-center rounded border border-dashed border-fg-subtle/40 font-medium uppercase tracking-wide text-fg-muted/80 shrink-0","px-2 py-0.5 text-xs",t),title:"First message from this sender","aria-label":"First message from this sender","data-testid":"sender-trust-unknown",children:"new"}):null};function ko({candidate:e,selected:n,onToggle:t,hideSender:s=!1}){const{senderName:o,senderAddress:i,subject:l,snippet:a,trustReason:u,trustSubReason:d,senderTrust:f}=e;return r.jsxs("label",{className:Re("flex w-full cursor-pointer items-start gap-3 px-3 py-2.5 text-left transition-colors",s&&"pl-11",n?"bg-positive/10":"bg-surface hover:bg-surface-sunken"),children:[r.jsx(ts,{className:"mt-0.5",checked:n,onChange:t,"aria-label":`${n?"Deselect":"Select"} ${s?l:`message from ${o}`}`}),!s&&r.jsx(Pt,{name:o,email:i,size:"sm"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[!s&&r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate text-sm font-medium text-fg",children:o}),f&&r.jsx(gs,{senderTrust:f,size:"sm"}),r.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:i})]}),r.jsx("span",{className:"block truncate text-sm text-fg-muted",children:l}),r.jsx("span",{className:"block line-clamp-1 text-xs text-fg-subtle",children:a}),!s&&r.jsxs("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[r.jsxs(Jt,{tone:"positive",children:[r.jsx(xt,{className:"size-3","aria-hidden":!0}),u]}),r.jsx("span",{className:"text-2xs text-fg-subtle",children:d})]})]})]})}const Mo=e=>{const n=new Map,t=[];for(const s of e){const o=(s.senderAddress||s.senderName).toLowerCase(),i=n.get(o);if(i){i.messages.push(s);continue}n.set(o,{key:o,senderName:s.senderName,senderAddress:s.senderAddress,trustReason:s.trustReason,trustSubReason:s.trustSubReason,senderTrust:s.senderTrust,messages:[s]}),t.push(o)}return t.map(s=>n.get(s)).sort((s,o)=>o.messages.length-s.messages.length)},To=(e,n)=>{const t=e.messages.filter(s=>n.has(s.id)).length;return t===0?"none":t===e.messages.length?"all":"some"},qt=e=>e===1?"message":"messages";function Ro({group:e,selected:n,onToggleGroup:t,onToggleMessage:s}){const[o,i]=c.useState(!1),l=To(e,n),a=e.messages.length,u=o?Es:Os;return r.jsxs("div",{className:Re(l!=="none"?"bg-positive/10":"bg-surface"),children:[r.jsxs("div",{className:"flex w-full items-start gap-3 px-3 py-2.5",children:[r.jsx(ts,{className:"mt-0.5",checked:l==="all",indeterminate:l==="some",onChange:()=>t(e,l!=="all"),"aria-label":`${l==="all"?"Deselect":"Select"} all ${a} ${qt(a)} from ${e.senderName}`}),r.jsx(Pt,{name:e.senderName,email:e.senderAddress,size:"sm"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"truncate text-sm font-medium text-fg",children:e.senderName}),e.senderTrust&&r.jsx(gs,{senderTrust:e.senderTrust,size:"sm"}),r.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:e.senderAddress})]}),r.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[r.jsxs(Jt,{tone:"positive",children:[r.jsx(xt,{className:"size-3","aria-hidden":!0}),e.trustReason]}),r.jsx("span",{className:"text-2xs text-fg-subtle",children:e.trustSubReason})]})]}),r.jsxs("button",{type:"button",onClick:()=>i(d=>!d),"aria-expanded":o,className:"flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-2xs text-fg-muted transition-colors hover:bg-surface-sunken hover:text-fg",children:[`${a} ${qt(a)}`,r.jsx(u,{className:"size-3.5","aria-hidden":!0})]})]}),o&&r.jsx("div",{className:"divide-y divide-line border-t border-line",children:e.messages.map(d=>r.jsx(ko,{candidate:d,selected:n.has(d.id),onToggle:()=>s(d.id),hideSender:!0},d.id))})]})}const $t=e=>e===1?"message":"messages",Eo=(e,n)=>`Moves ${e===1?"this message":`these ${e} ${$t(e)}`} out of Spam to ${n} now. Nothing later.`,Nt=(e,n)=>e.find(t=>t.id===n)?.label??"Inbox";function Oo(){return r.jsx(zt,{tone:"info",variant:"soft",children:r.jsx("p",{className:"text-2xs text-fg-muted",children:"We list a message here only when we can confirm the sender is who they say — usually someone you've emailed before, write to often, or a service that consistently checks out. We never guess from words in the subject. Anything we can't confirm stays in Spam."})})}function Ao({candidates:e,selected:n,onToggle:t,onToggleGroup:s,onSelectAll:o,onSelectNone:i,onContinue:l,onCancel:a}){const[u,d]=c.useState(!1),f=n.size,p=c.useMemo(()=>Mo(e),[e]);return r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"px-row-inset pb-2 pt-1",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[r.jsx(xt,{className:"size-4 text-positive","aria-hidden":!0}),"Rescue from Spam"]}),r.jsx(de,{variant:"ghost",size:"sm",icon:r.jsx(uo,{className:"size-3.5"}),onClick:()=>d(m=>!m),className:"-mr-1.5 -mt-0.5",children:"Why these?"})]}),r.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"These look safe — from senders we can verify. Uncheck any sender that belongs in Spam, or open a sender to pick individual messages."}),u&&r.jsx("div",{className:"mt-2",children:r.jsx(Oo,{})})]}),r.jsxs("div",{className:"flex items-center justify-between px-row-inset pb-1.5",children:[r.jsx("span",{className:"text-2xs font-medium text-fg-muted",children:`${f} of ${e.length} selected · ${p.length} ${p.length===1?"sender":"senders"}`}),r.jsxs("span",{className:"flex gap-1",children:[r.jsx(de,{variant:"ghost",size:"sm",onClick:o,children:"Select all"}),r.jsx(de,{variant:"ghost",size:"sm",onClick:i,children:"Select none"})]})]}),r.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto border-y border-line",children:p.map(m=>r.jsx(Ro,{group:m,selected:n,onToggleGroup:s,onToggleMessage:t},m.key))}),r.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[r.jsx(de,{variant:"primary",onClick:l,className:"h-11 w-full font-semibold",children:`Continue with ${f} ${$t(f)}`}),r.jsx(de,{variant:"ghost",onClick:a,className:"h-11 w-full",children:"Cancel"})]})]})}function No({count:e,folders:n,delimiter:t,destination:s,onPick:o,onMove:i,onBack:l}){const[a,u]=c.useState(!1);return r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"px-row-inset pb-2 pt-1",children:[r.jsx("h2",{className:"text-sm font-semibold text-fg",children:"Where should they go?"}),r.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"Pick a folder, then we move them out of Spam."})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-row-inset py-2",children:a?r.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden rounded-xl border border-line bg-surface",children:r.jsx(As,{folders:n,selectedId:s,delimiter:t,onSelect:o,onCancel:()=>u(!1)})}):r.jsxs("div",{className:"rounded-xl border border-line bg-surface-sunken p-3",children:[r.jsx("p",{className:"text-2xs text-fg-subtle",children:"Destination"}),r.jsx("p",{className:"mt-0.5 text-sm font-medium text-fg",children:Nt(n,s)}),r.jsx(de,{variant:"ghost",size:"sm",onClick:()=>u(!0),className:"mt-2 px-0",children:"Move to a different folder"})]})}),r.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[r.jsx("p",{className:"text-2xs text-fg-subtle",children:Eo(e,Nt(n,s))}),r.jsx(de,{variant:"primary",onClick:i,className:"h-11 w-full font-semibold",children:`Move ${e} out of Spam`}),r.jsx(de,{variant:"ghost",onClick:l,className:"h-11 w-full",children:"Back"})]})]})}function zo({count:e,destinationLabel:n,onClose:t}){return r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-row-inset py-10 text-center",children:[r.jsx(ho,{className:"size-10 text-positive","aria-hidden":!0}),r.jsx("p",{className:"text-base font-semibold text-fg",children:`Moved ${e} ${$t(e)} out of Spam.`}),r.jsx("p",{className:"text-2xs text-fg-subtle",children:`You'll find them in ${n}.`})]}),r.jsx("div",{className:"border-t border-line bg-surface px-row-inset py-3",children:r.jsx(de,{variant:"primary",onClick:t,className:"h-11 w-full font-semibold",children:"Done"})})]})}function Do({open:e,candidates:n,defaultDestinationId:t,availableFolders:s,delimiter:o,onConfirmMove:i,onCancel:l}){const[a,u]=c.useState("review"),[d,f]=c.useState(()=>e?new Set(n.map(I=>I.id)):new Set),[p,m]=c.useState(t),[S,y]=c.useState(0),k=c.useRef(!1);c.useEffect(()=>{e&&!k.current&&(u("review"),f(new Set(n.map(I=>I.id))),m(t),y(0)),k.current=e},[e,n,t]);const M=d.size,x=I=>{f(j=>{const E=new Set(j);return E.has(I)?E.delete(I):E.add(I),E})},b=(I,j)=>{f(E=>{const A=new Set(E);for(const D of I.messages)j?A.add(D.id):A.delete(D.id);return A})},C=()=>{const I=Array.from(d);y(I.length),i(I,p),u("done")};return r.jsxs(co,{open:e,onClose:l,dismissLabel:"Close rescue",children:[a==="review"&&r.jsx(Ao,{candidates:n,selected:d,onToggle:x,onToggleGroup:b,onSelectAll:()=>f(new Set(n.map(I=>I.id))),onSelectNone:()=>f(new Set),onContinue:()=>u("destination"),onCancel:l}),a==="destination"&&r.jsx(No,{count:M,folders:s,delimiter:o,destination:p,onPick:m,onMove:C,onBack:()=>u("review")}),a==="done"&&r.jsx(zo,{count:S,destinationLabel:Nt(s,p),onClose:l})]})}const Fo={reply:"Reply",reply_all:"Reply All",forward:"Forward",new:"New Message"},_o=()=>{const e=c.useRef(!1);return c.useCallback(()=>{const t=document.querySelector("[data-subject-field]")?.value??"",i=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return e.current=t.trim().length>0||i.length>0,e.current},[])},Lo=()=>{const{state:e,closeCompose:n}=pt(),t=_o(),[s,o]=c.useState(!1),{isError:i,error:l,refetch:a}=tt({...Gt(),staleTime:1/0}),u=c.useCallback(m=>{m||(t()?o(!0):n())},[n,t]),d=c.useCallback(()=>{o(!1),n()},[n]),f=c.useCallback(()=>{o(!1)},[]);if(!e.isOpen)return null;const p=Fo[e.mode]??"New Message";return r.jsxs(_e.Root,{open:e.isOpen,onOpenChange:u,children:[r.jsxs(_e.Portal,{children:[r.jsx(_e.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),r.jsxs(_e.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[r.jsx(_e.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),r.jsx(_e.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:p}),i?r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsx(hs,{title:"Couldn't load compose",error:l,onRetry:()=>{a()}})}):r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(ss,{mode:e.mode,account:e.account,sourceMessage:e.sourceMessage,onClose:n})})]})]}),r.jsx(ms,{isOpen:s,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:d,onCancel:f})]})},Po={reply:"Reply",reply_all:"Reply All",forward:"Forward",new:"New Message"},ps=()=>{const{state:e,closeCompose:n}=pt(),t=fs(),{isError:s,error:o,refetch:i}=tt({...Gt(),staleTime:1/0});if(!t)return r.jsx(Lo,{});if(!e.isOpen)return null;const l=Po[e.mode]??"New Message",a=r.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[r.jsx("div",{className:"flex items-center gap-2 min-w-0",children:r.jsx("h2",{className:"text-lg font-semibold truncate",children:l})}),r.jsx("button",{type:"button",onClick:n,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:r.jsx(Ns,{className:"size-5"})})]});return s?r.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[a,r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsx(hs,{title:"Couldn't load compose",error:o,onRetry:()=>{i()}})})]}):r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[a,r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(ss,{mode:e.mode,account:e.account,sourceMessage:e.sourceMessage,onClose:n},e.outboxMessageId??"new")})]})};function $o(e){const n=e.toAddresses.join(", ");return{id:e.outboxMessageId,accountId:e.accountId,fromName:e.fromName??e.fromAddress??"Me",fromEmail:e.fromAddress??"",subject:e.subject??"(No subject)",snippet:n?`To: ${n}`:"(No recipients)",timeLabel:nt(e.updatedAt),isRead:!0}}function Bo(e){return{id:e.messageId,accountId:e.accountId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:nt(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0}}function Wo({outboxMessages:e,accountId:n,imapThreads:t}){const s=e.filter(l=>l.status==="draft"&&l.accountId===n).map($o),o=t.map(Bo),i=[];return s.length>0&&i.push({id:"remit-drafts",label:"Not yet sent (Remit)",threads:s}),o.length>0&&i.push({id:"imap-drafts",label:"On the server",threads:o}),i}const Ko=({label:e,count:n})=>r.jsxs("div",{className:"sticky top-0 z-10 flex items-baseline justify-between border-b border-line bg-surface-sunken px-row-inset py-1",children:[r.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),r.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:n})]}),Vo=({row:e,isSelected:n,onOpen:t,onDelete:s,isDeleting:o})=>r.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Re("group",os({active:n})),children:[r.jsx(Fs,{className:"size-7 shrink-0 text-fg-muted mt-0.5"}),r.jsx(ns,{thread:e}),r.jsx("div",{className:"flex items-center gap-1 shrink-0",children:r.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),s(e.id)},disabled:o,className:"p-1.5 rounded-md text-fg-muted hover:text-danger hover:bg-surface-raised transition-colors opacity-0 group-hover:opacity-100 focus:opacity-100",title:"Delete draft",children:r.jsx(_s,{className:"size-3.5"})})})]}),qo=({row:e,isSelected:n,onOpen:t})=>{const s=!e.isRead;return r.jsxs("button",{type:"button",onClick:()=>t(e.id),className:Re("group",os({active:n})),children:[s&&r.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),r.jsx(Pt,{name:e.fromName,email:e.fromEmail,size:"sm"}),r.jsx(ns,{thread:e})]})};function Ho({mailboxId:e,accountId:n,selectedMessageId:t,imapThreads:s,title:o,unreadCount:i}){const{openCompose:l,state:a}=pt(),u=st(),d=Dt(),{data:f}=tt(zs()),p=c.useMemo(()=>Wo({outboxMessages:f?.items??[],accountId:n,imapThreads:s}),[f?.items,n,s]),m=Ft({...Xt(),onSuccess:()=>{d.invalidateQueries({queryKey:Yt()})}}),S=x=>{m.mutate({path:{outboxMessageId:x}})},y=x=>{l({mode:"new",outboxMessageId:x})},k=x=>{const b=s.find(C=>C.messageId===x)?.threadId;b&&u({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:e,threadId:b,messageId:x},search:C=>C,hash:Pe})},M=p.length===0;return r.jsxs("section",{className:"flex h-full w-full flex-col bg-surface",children:[r.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[r.jsx(no,{}),r.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:o}),(i??0)>0&&r.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:[i," unread"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:M?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-center px-4",children:[r.jsx(Ds,{className:"size-8 text-fg-subtle"}),r.jsx("p",{className:"text-sm font-medium text-fg",children:"No drafts"}),r.jsx("p",{className:"text-xs text-fg-subtle",children:"Messages you start composing will appear here."})]}):p.map(x=>r.jsxs("div",{children:[x.label&&r.jsx(Ko,{label:x.label,count:x.threads.length}),r.jsx("div",{className:"divide-y divide-line",children:x.threads.map(b=>x.id==="remit-drafts"?r.jsx(Vo,{row:b,isSelected:a.isOpen&&b.id===a.outboxMessageId,onOpen:y,onDelete:S,isDeleting:m.isPending},b.id):r.jsx(qo,{row:b,isSelected:b.id===t,onOpen:k},b.id))})]},x.id))})]})}function Uo(e,n,t){const s=new Array(e);return new Proxy(s,{get(o,i,l){if(typeof i=="string"){const a=i.charCodeAt(0);if(a>=48&&a<=57){const u=+i;if(Number.isInteger(u)&&u>=0&&u<e){let d=o[u];if(!d){const f=n[u*2];d=o[u]={index:u,key:t(u),start:f,size:n[u*2+1],end:f+n[u*2+1],lane:0}}return d}}if(i==="length")return e}return Reflect.get(o,i,l)}})}function Le(e,n,t){let s=t.initialDeps??[],o,i=!0;function l(){const a=e();return(a.length!==s.length||a.some((d,f)=>s[f]!==d))&&(s=a,o=n(...a),t?.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(o),i=!1),o}return l.updateDeps=a=>{s=a},l}function Ht(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const Qo=(e,n)=>Math.abs(e-n)<1.01,Jo=(e,n,t)=>{let s;return function(...o){e.clearTimeout(s),s=e.setTimeout(()=>n.apply(this,o),t)}};let et;const Ot=()=>{if(et!==void 0)return et;if(typeof navigator>"u")return et=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return et=!0;const e=navigator.maxTouchPoints;return et=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Ut=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},Go=e=>e,Yo=e=>{const n=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-n+1,o=new Array(s);for(let i=0;i<s;i++)o[i]=n+i;return o},Xo=(e,n)=>{const t=e.scrollElement;if(!t)return;const s=e.targetWindow;if(!s)return;const o=l=>{const{width:a,height:u}=l;n({width:Math.round(a),height:Math.round(u)})};if(o(Ut(t)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(l=>{const a=()=>{const u=l[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(Ut(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},gt={passive:!0},Zo=typeof window>"u"?!0:"onscrollend"in window,ei=(e,n,t)=>{const s=e.scrollElement;if(!s)return;const o=e.targetWindow;if(!o)return;const i=e.options.useScrollendEvent&&Zo;let l=0;const a=i?null:Jo(o,()=>n(l,!1),e.options.isScrollingResetDelay),u=p=>()=>{l=t(s),a?.(),n(l,p)},d=u(!0),f=u(!1);return s.addEventListener("scroll",d,gt),i&&s.addEventListener("scrollend",f,gt),()=>{s.removeEventListener("scroll",d),i&&s.removeEventListener("scrollend",f)}},ti=(e,n)=>ei(e,n,t=>{const{horizontal:s,isRtl:o}=e.options;return s?t.scrollLeft*(o&&-1||1):t.scrollTop}),si=(e,n,t)=>{if(t.options.useCachedMeasurements){const s=t.indexFromElement(e),o=t.options.getItemKey(s);return t.itemSizeCache.get(o)??t.options.estimateSize(s)}if(n?.borderBoxSize){const s=n.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}if(!n){const s=t.indexFromElement(e),o=t.options.getItemKey(s),i=t.itemSizeCache.get(o);if(i!==void 0)return i}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},ni=(e,{adjustments:n=0,behavior:t},s)=>{var o,i;(i=(o=s.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[s.options.horizontal?"left":"top"]:e+n,behavior:t})},oi=ni;class ii{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var t,s,o;return((o=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:o.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const l=()=>{const a=i.target,u=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[d,f]of this.elementsCache)if(f===a){this.elementsCache.delete(d);break}return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var o;(o=s())==null||o.disconnect(),t=null},observe:o=>{var i;return(i=s())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=s())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=t=>{var s,o;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Go,rangeExtractor:Yo,onChange:()=>{},measureElement:si,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const m in t){const S=t[m];S!==void 0&&(i[m]=S)}const l=this.options;let a=null,u=null,d=!1;if(l!==void 0&&l.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const m=l.count,S=i.count,y=this.getMeasurements(),k=m>0?((s=y[0])==null?void 0:s.key)??l.getItemKey(0):null,M=m>0?((o=y[m-1])==null?void 0:o.key)??l.getItemKey(m-1):null;if(S!==m||m>0&&S>0&&(i.getItemKey(0)!==k||i.getItemKey(S-1)!==M)){d=!0;const C=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??y[0]:null;C&&(a=[C.key,this.getScrollOffset()-C.start]);const I=i.followOnAppend===!0?"auto":i.followOnAppend||null;I&&S>m&&this.isAtEnd(l.scrollEndThreshold)&&(m===0||i.getItemKey(S-1)!==M)&&(u=I)}}this.options=i,d&&(this.pendingMin=0,this.itemSizeCacheVersion++);let f=!1,p=0;if(a&&this.scrollOffset!==null){const[m,S]=a,y=this.getMeasurements(),{count:k,getItemKey:M}=this.options;let x=0;for(;x<k&&M(x)!==m;)x++;if(x<k){const b=y[x];if(b){const C=b.start+S;C!==this.scrollOffset&&(p=C-this.scrollOffset,this.scrollOffset=C,f=!0)}}}(f||u)&&(this.pendingScrollAnchor=[f?a[0]:null,f?a[1]:0,u,p])},this.notify=t=>{var s,o;(o=(s=this.options).onChange)==null||o.call(s,this,t)},this.maybeNotify=Le(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,l)=>{if(l&&this._intendedScrollOffset===null&&i===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const a=this.getScrollOffset();this.scrollDirection=l?a===i?this.scrollDirection:a<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=l,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,l=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!Ot()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",l,gt),i.addEventListener("touchend",a,gt),this.unsubs.push(()=>{i.removeEventListener("touchstart",l),i.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[i,l,a,u]=o;i!==null&&!a&&(Ot()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?u!==0&&(this._iosDeferredAdjustment+=u):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),s=this.getMaxScrollOffset();if(t<0||t>s)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Le(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,s,o,i,l,a,u,d)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:t,paddingStart:s,scrollMargin:o,getItemKey:i,enabled:l,lanes:a,laneAssignmentMode:u,gap:d}),{key:!1}),this.getMeasurements=Le(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:o,getItemKey:i,enabled:l,lanes:a,laneAssignmentMode:u,gap:d},f)=>{const p=this.itemSizeCache;if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const x of this.laneAssignments.keys())x>=t&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const m=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),a===1){const x=t*2;let b=this._flatMeasurements;if(!b||b.length<x){const j=new Float64Array(x);b&&m>0&&j.set(b.subarray(0,m*2)),b=j,this._flatMeasurements=b}let C;if(m===0)C=s+o;else{const j=m-1;C=b[j*2]+b[j*2+1]+d}for(let j=m;j<t;j++){const E=i(j),A=p.get(E),D=typeof A=="number"?A:this.options.estimateSize(j);b[j*2]=C,b[j*2+1]=D,C+=D+d}const I=Uo(t,b,i);return this.measurementsCache=I,I}const S=this.measurementsCache.slice(0,m),y=new Array(a).fill(void 0),k=new Float64Array(a);let M=0;for(let x=0;x<m;x++){const b=S[x];b&&(y[b.lane]===void 0&&M++,y[b.lane]=x,k[b.lane]=b.end)}for(let x=m;x<t;x++){const b=i(x),C=this.laneAssignments.get(x);let I,j;const E=u==="estimate"||p.has(b);if(C!==void 0&&this.options.lanes>1){I=C;const W=y[I],K=W!==void 0?S[W]:void 0;j=K?K.end+d:s+o}else if(M===a){let W=0,K=k[0],L=y[0];for(let V=1;V<a;V++){const oe=k[V];(oe<K||oe===K&&y[V]<L)&&(W=V,K=oe,L=y[V])}I=W,j=K+d,E&&this.laneAssignments.set(x,I)}else I=x%this.options.lanes,j=s+o,E&&this.laneAssignments.set(x,I);const A=p.get(b),D=typeof A=="number"?A:this.options.estimateSize(x),O=j+D;S[x]={index:x,start:j,size:D,end:O,key:b,lane:I},y[I]===void 0&&M++,y[I]=x,k[I]=O}return this.measurementsCache=S,S},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Le(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,o,i)=>t.length===0||s===0?(this.range=null,null):(this.range=ai(t,s,o,i,i===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Le(()=>{let t=null,s=null;const o=this.calculateRange();return o&&(t=o.startIndex,s=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,o,i,l)=>i===null||l===null?[]:t({startIndex:i,endIndex:l,overscan:s,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,o=t.getAttribute(s);return o?parseInt(o,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(o!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,o-i),a=Math.min(this.options.count-1,o+i);return t>=l&&t<=a}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((l,a)=>{l.isConnected||(this.observer.unobserve(l),this.elementsCache.delete(a))});return}const s=this.indexFromElement(t),o=this.options.getItemKey(s),i=this.elementsCache.get(o);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(o,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var o,i;if(t<0||t>=this.options.count)return;let l,a,u;const d=this._flatMeasurements;if(this.options.lanes===1&&d!==null)u=this.options.getItemKey(t),a=d[t*2],l=d[t*2+1];else{const m=this.measurementsCache[t];if(!m)return;u=m.key,a=m.start,l=m.size}const f=this.itemSizeCache.get(u)??l,p=s-f;if(p!==0){const m=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,S=m?this.getTotalSize():0,y=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:u,start:a,size:l,end:a+l,lane:0},p,this):a<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(u)||this.scrollDirection!=="backward"));(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(u,s),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-S):y&&this.applyScrollAdjustment(p),this.notify(!1)}},this.getVirtualItems=Le(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const o=[];for(let i=0,l=t.length;i<l;i++){const a=t[i],u=s[a];o.push(u)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const s=this.getMeasurements();if(s.length===0)return;const o=this._flatMeasurements,i=this.options.lanes===1&&o!=null,l=xs(0,s.length-1,i?a=>o[a*2]:a=>Ht(s[a]).start,t);return Ht(s[l])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,s,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),l=this.getScrollOffset();s==="auto"&&(s=t>=l+i?"end":"start"),s==="center"?t+=(o-i)/2:s==="end"&&(t-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getSize(),i=this.getScrollOffset(),l=this.measurementsCache[t];if(!l)return;if(s==="auto")if(l.end>=i+o-this.options.scrollPaddingEnd)s="end";else if(l.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const a=s==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,l.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(t,s),l=this.now();this.scrollState={index:null,align:s,behavior:o,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:o="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,s);if(!i)return;const[l,a]=i,u=this.now();this.scrollState={index:t,align:a,behavior:o,startedAt:u,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const o=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t;const s=this.getMeasurements();let o;if(s.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const i=s.length-1,l=this._flatMeasurements;l!=null?o=l[i*2]+l[i*2+1]:o=((t=s[i])==null?void 0:t.end)??0}else{const i=Array(this.options.lanes).fill(null);let l=s.length-1;for(;l>=0&&i.some(a=>a===null);){const a=s[l];i[a.lane]===null&&(i[a.lane]=a.end),l--}o=Math.max(...i.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const s=this.getMeasurements();for(const o of s)o&&this.itemSizeCache.has(o.key)&&t.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return t},this._scrollToOffset=(t,{adjustments:s,behavior:o})=>{this._intendedScrollOffset=t+(s??0),this.options.scrollToFn(t,{behavior:o,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(n)}applyScrollAdjustment(n,t){n!==0&&(Ot()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=n:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=n,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=s?s[0]:this.scrollState.lastTargetOffset,i=1,l=o!==this.scrollState.lastTargetOffset;if(!l&&Qo(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,l){const a=this.getSize()||600,u=Math.abs(o-this.getScrollOffset()),d=this.scrollState.behavior==="smooth"&&u>a;this.scrollState.lastTargetOffset=o,d||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:d?"smooth":"auto"})}this.scheduleScrollReconcile()}}const xs=(e,n,t,s)=>{for(;e<=n;){const o=(e+n)/2|0,i=t(o);if(i<s)e=o+1;else if(i>s)n=o-1;else return o}return e>0?e-1:0};function ri(e,n,t){let s=0;for(;s<=n;){const o=(s+n)/2|0,i=e[o*2];if(i<t)s=o+1;else if(i>t)n=o-1;else return o}return s>0?s-1:0}function ai(e,n,t,s,o){const i=e.length-1;if(e.length<=s)return{startIndex:0,endIndex:i};if(s===1&&o!==null){const d=ri(o,i,t);let f=d;const p=t+n;for(;f<i&&o[f*2]+o[f*2+1]<p;)f++;return{startIndex:d,endIndex:f}}let a=xs(0,i,d=>e[d].start,t),u=a;if(s===1)for(;u<i&&e[u].end<t+n;)u++;else if(s>1){const d=Array(s).fill(0);for(;u<i&&d.some(p=>p<t+n);){const p=e[u];d[p.lane]=p.end,u++}const f=Array(s).fill(t+n);for(;a>=0&&f.some(p=>p>=t);){const p=e[a];f[p.lane]=p.start,a--}a=Math.max(0,a-a%s),u=Math.min(i,u+(s-1-u%s))}return{startIndex:a,endIndex:u}}const At=typeof document<"u"?c.useLayoutEffect:c.useEffect;function li({useFlushSync:e=!0,directDomUpdates:n=!1,directDomUpdatesMode:t="transform",...s}){const o=c.useReducer(d=>d+1,0)[1],i=c.useRef({enabled:n,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=n,i.current.mode=t;const l=d=>{const f=i.current;if(!f.enabled||!f.container)return;const p=d.getTotalSize();if(p!==f.lastSize){f.lastSize=p;const x=d.options.horizontal?"width":"height";f.container.style[x]=`${p}px`}const m=!!d.options.horizontal,S=f.mode==="transform",y=m?"left":"top",k=d.options.scrollMargin,M=d.getVirtualItems();for(const x of M){const b=x.start-k,C=d.elementsCache.get(x.key);C&&f.lastPositions.get(C)!==b&&(f.lastPositions.set(C,b),S?C.style.transform=m?`translate3d(${b}px, 0, 0)`:`translate3d(0, ${b}px, 0)`:C.style[y]=`${b}px`)}},a={...s,onChange:(d,f)=>{var p;const m=i.current;let S=!0;if(m.enabled){l(d);const y=d.range,k=m.prevRange;S=!k||k.isScrolling!==d.isScrolling||k.startIndex!==y?.startIndex||k.endIndex!==y?.endIndex,S&&(m.prevRange=y?{startIndex:y.startIndex,endIndex:y.endIndex,isScrolling:d.isScrolling}:null)}S&&(e&&f?Ls.flushSync(o):o()),(p=s.onChange)==null||p.call(s,d,f)}},[u]=c.useState(()=>{const d=new ii(a);return Object.assign(d,{containerRef:f=>{const p=i.current;if(p.container=f,p.lastSize=null,f&&p.enabled){const m=d.getTotalSize();p.lastSize=m;const S=d.options.horizontal?"width":"height";f.style[S]=`${m}px`}}})});return u.setOptions(a),At(()=>u._didMount(),[]),At(()=>u._willUpdate()),At(()=>{l(u)}),u}function ci(e){return li({observeElementRect:Xo,observeElementOffset:ti,scrollToFn:oi,...e})}const Bt=e=>e.query?`matching "${e.query}"`:e.from?`from "${e.from}"`:"matching your search",di=e=>`Select all ${Bt(e)}`,ui=(e,n)=>`All ${to(n)} ${Bt(e)} selected`,hi=({verb:e,confirmingDelete:n,hasSelection:t,junkMailboxId:s,currentMailboxId:o,deletableMessageId:i})=>{if(n)return{kind:"withheld"};if(e==="junk"){const l=an(s,o);if(l!==void 0)return{kind:"unavailable",reason:l}}return t?{kind:"openWizard"}:e!=="delete"||i===void 0?{kind:"declined"}:{kind:"confirmDelete",messageId:i}},fi=(e,n,t)=>e==="BACK"&&n&&t===void 0,mi=(e,n)=>({id:e.messageId,accountId:e.accountId,mailboxId:e.mailboxId,threadId:e.threadId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:nt(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:is(e.category),messageCount:n,suspicious:e.authenticity?.dkimMismatch===!0,labels:e.labels}),gi=({thread:e,mailboxId:n,isSelected:t,isFocused:s,isTabStop:o,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:u,messageCount:d,isMultiSelectMode:f,onLongPress:p,isDesktop:m,density:S})=>r.jsx(ln,{thread:mi(e,d),link:{mailboxId:n,threadId:e.threadId},inListbox:!0,active:t,focused:s,isTabStop:o,density:S,isDesktop:m,onFocusRow:i,selection:{isChecked:l,onToggleCheck:a,onRowSelect:u,isMultiSelectMode:f,onLongPress:p}}),pi=c.memo(gi),xi=e=>{const n=e.authenticity?.dkimMismatch===!0;return{id:e.messageId,accountId:e.accountId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:nt(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:is(e.category),suspicious:n}},bi=({thread:e,mailboxId:n,isSelected:t,isFocused:s,isTabStop:o,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:u,isMultiSelectMode:d,onLongPress:f,isDesktop:p,onDelete:m,onToggleRead:S,density:y})=>{const[k,M]=c.useState("none"),x=st(),b=c.useCallback(A=>{navigator.vibrate?.(10),A==="trailing"?m(e.messageId):S(e.messageId,e.isRead),M("none")},[m,S,e.messageId,e.isRead]),C=c.useCallback(()=>{f(e.messageId)},[f,e.messageId]),I=c.useCallback(()=>{a(e.messageId)},[a,e.messageId]),j=c.useCallback(()=>{x({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:n,threadId:e.threadId,messageId:e.messageId},search:A=>A,hash:Pe})},[x,n,e.threadId,e.messageId]),E=cn(e.messageId,u);return p||d?r.jsx(pi,{thread:e,mailboxId:n,isSelected:t,isFocused:s,isTabStop:o,onFocusRow:i,isChecked:l,onToggleCheck:a,onRowSelect:u,isMultiSelectMode:d,onLongPress:f,isDesktop:p,density:y}):r.jsx("div",{role:"presentation",onPointerDownCapture:E.onMouseDown,onClickCapture:E.claimClick,onContextMenu:E.onContextMenu,children:r.jsx(Jn,{thread:xi(e),selectionMode:!1,checked:!1,active:t,peek:k,onPeek:M,onToggleCheck:I,onLongPress:C,onOpen:j,onAct:b})})},vi=72,Si=32,yi=5,bs="remit:list-density",Ci=()=>{try{const e=localStorage.getItem(bs);if(e==="compact"||e==="comfortable")return e}catch{}return"comfortable"},Ii=({query:e})=>r.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface-sunken/30",children:[r.jsx(Ks,{className:"size-4 text-fg-muted"}),r.jsxs("span",{className:"text-sm text-fg-muted",children:["Results for “",e,"”"]})]}),wi=({mailboxId:e,threads:n,selectedMessageId:t,isLoading:s,isError:o=!1,error:i,onRetry:l,searchQuery:a,searchPredicate:u,onDeleteMessages:d,isDeleting:f=!1,isMoving:p=!1,onLoadMore:m,hasMore:S=!1,isLoadingMore:y=!1,accountId:k,listTitle:M,listMeta:x,listFilter:b,listScopeLabel:C,onTriageContextChange:I,commandsRef:j,hideHeader:E=!1})=>{const A=c.useRef(null),D=st(),O=fs(),W=Ps(),{verb:K,start:L,startFromSearch:V}=W,oe=$s(),Ie=!!a?.trim(),q=dn(),{labels:$e}=oo(k),{pushError:ae}=Zt(),[T,H]=c.useState(t),[we,P]=c.useState(),U=c.useCallback(h=>{P(v=>v===h?v:void 0),H(h)},[]),[ge,je]=c.useState(Ci),ke=c.useCallback(()=>{je(h=>{const v=h==="comfortable"?"compact":"comfortable";try{localStorage.setItem(bs,v)}catch{}return v})},[]),{toggleReadFor:Ee}=rs({mailboxId:e}),{junkMailboxId:pe}=as(k),Be=ls(pe,e),{selectedIds:R,selectedCount:N,hasSelection:ie,isSelected:xe,toggle:G,select:re,clearSelection:X,selectRange:ue,setAnchor:be,selectAll:ot,toggleAll:it,intersectWith:le}=un(),We=In(N,O),[Y,ve]=c.useState(null),z=Ie&&!!u,rt=`${e}|${JSON.stringify(u??{})}`,w=hn({mailboxId:e,accountId:k,enabled:z,predicateKey:rt,searchQuery:u??{}}),at=c.useCallback((h,v,ee)=>{if(ee.error===void 0){if(ee.cancelled){ae({severity:"warning",title:mn(ee.done),detail:fn(h,ee.done,v)});return}ae({severity:"info",title:Wt(h,ee.done)})}},[ae]),lt=w.phase.kind,he=w.clear,Q=c.useCallback(()=>{lt==="escalated"&&he(),X()},[X,he,lt]),[Oe,ct]=c.useState(null),fe=c.useRef(null),F=c.useRef(!1),Ae=c.useRef(null),Ne=!s&&n.length>0,dt=Y!==null,Z=ci({count:n.length,getScrollElement:()=>A.current,estimateSize:()=>ge==="compact"?Si:vi,overscan:yi}),Ke=t?n.findIndex(h=>h.messageId===t):-1,$=T?n.findIndex(h=>h.messageId===T):-1,ce=c.useCallback(h=>{if(h<0||h>=n.length)return;const v=n[h];if(We){G(v.messageId);return}fe.current=v.messageId,F.current=!1,P(v.messageId),H(v.messageId)},[n,We,G]),Ve=c.useCallback(()=>{if(n.length===0)return;const h=$<0?0:Math.min($+1,n.length-1);ce(h)},[n.length,$,ce]),qe=c.useCallback(()=>{if(n.length===0)return;const h=$<=0?0:$-1;ce(h)},[n.length,$,ce]),ut=c.useCallback(()=>ce(0),[ce]),He=c.useCallback(()=>ce(n.length-1),[ce,n.length]),ze=c.useCallback(()=>{T&&G(T)},[T,G]),B=c.useMemo(()=>n.map(h=>h.messageId),[n]),Me=c.useMemo(()=>{const h=[];for(const v of n)R.has(v.messageId)&&h.push({id:v.messageId,sender:v.fromName??v.fromEmail??"Unknown",email:v.fromEmail??"",subject:v.subject??"(No subject)",date:nt(v.sentDate)});return h},[n,R]),ht=c.useCallback((h,v)=>v.shiftKey?(ue(B,h,T),!0):v.metaKey||v.ctrlKey?(G(h),!0):(Q(),be(h),!1),[B,T,ue,G,Q,be]),De=c.useCallback(h=>{!d||h.length===0||(Ae.current=T??null,ve(h))},[d,T]),Fe=c.useCallback(h=>{const v=gn(B,T,h);v!==void 0&&(ue(B,v),fe.current=v,F.current=!1,P(void 0),H(v))},[B,T,ue]),Ue=c.useCallback(()=>Fe(-1),[Fe]),Qe=c.useCallback(()=>Fe(1),[Fe]),Se=c.useCallback(()=>{B.length>0&&ot(B)},[B,ot]),Te=c.useCallback(h=>{const v=hi({verb:h,confirmingDelete:Y!==null,hasSelection:ie,junkMailboxId:pe,currentMailboxId:e,deletableMessageId:d?T:void 0});return v.kind==="openWizard"?(L(h),!0):v.kind==="confirmDelete"?(De([v.messageId]),!0):v.kind==="unavailable"?(ae({severity:"warning",title:v.reason}),!0):v.kind==="withheld"},[Y,d,ie,pe,e,L,T,De,ae]),ne=c.useCallback((h,v)=>{const ee=n.find(te=>te.messageId===h)?.threadId;ee&&D({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:e,threadId:ee,messageId:h},search:te=>te,hash:Pe,replace:v?.replace})},[D,e,n]),me=c.useCallback(()=>{T&&ne(T)},[T,ne]),vt=c.useCallback(h=>ne(h,{replace:!0}),[ne]);pn({keyboardFocusedMessageId:we,openMessageId:t,enabled:O&&N===0,open:vt});const Je=w.phase.kind==="escalated"?{scope:Bt(u??{}),total:w.phase.total,searchQuery:u??{},run:h=>w.runAction(h),stop:w.stop}:void 0,St=c.useCallback(()=>{if(!Y)return;const h=Y;if(h.length===0){ve(null);return}const v=new Set(h),ee=n.findIndex(se=>v.has(se.messageId));let te;for(let se=ee+1;se<n.length;se++)if(!v.has(n[se].messageId)){te=n[se].messageId;break}if(te===void 0){for(let se=ee-1;se>=0;se--)if(!v.has(n[se].messageId)){te=n[se].messageId;break}}d?.(h),Q(),Ae.current=null,ve(null),te!==void 0&&(fe.current=te,F.current=!1,U(te),O&&ne(te,{replace:!0})),O||ct(Wt("delete",h.length))},[Y,n,d,Q,ne,O,U]),ye=c.useCallback(()=>{const h=Ae.current;Ae.current=null,ve(null),h!==null&&(fe.current=h,F.current=!1,U(h))},[U]),Ge=c.useMemo(()=>{if(N===0)return;const h=new Set;for(const v of n)R.has(v.messageId)&&h.add(v.accountConfigId);if(h.size>1)return"Move only works within one account — clear selection or pick messages from a single account"},[N,R,n]),yt=c.useCallback(()=>{if(Je){V();return}L("organize")},[Je,V,L]),Ct=c.useCallback(h=>{d?.([h])},[d]),It=c.useCallback((h,v)=>{Ee([h],!v)},[Ee]),wt=c.useCallback(h=>{O||re(h)},[O,re]),jt=c.useCallback(()=>{if(w.isRunning||w.phase.kind==="counting"){w.stop();return}Q()},[w,Q]),kt=c.useCallback(()=>{w.clear()},[w]);c.useEffect(()=>{if(F.current||!O&&t)return;const h=$>=0?$:Ke;h>=0&&Z.scrollToIndex(h,{align:"auto"})},[$,Ke,Z,O,t]),c.useEffect(()=>{t&&(F.current=!1,U(t))},[t,U]),c.useEffect(()=>{T&&(n.some(h=>h.messageId===T)||U(n[0]?.messageId))},[n,T,U]),c.useEffect(()=>{I?.({focusedMessageId:T,selectedIds:Array.from(R),hasList:Ne,blocksKeyboard:dt||W.isOpen})},[T,R,Ne,dt,W.isOpen,I]);const Ce=c.useRef(I);Ce.current=I,c.useEffect(()=>()=>Ce.current?.({focusedMessageId:void 0,selectedIds:[],hasList:!1,blocksKeyboard:!1}),[]),c.useEffect(()=>{w.phase.kind!=="idle"||w.isRunning||le(n.map(h=>h.messageId))},[n,le,w.phase,w.isRunning]);const Ye=c.useRef(e);c.useEffect(()=>{Ye.current!==e&&(Ye.current=e,Q())},[e,Q]),xn({shouldBlockFn:({action:h})=>fi(h,ie,oe)?(Q(),!0):!1,enableBeforeUnload:!1,disabled:!ie||oe!==void 0}),c.useEffect(()=>{const h=A.current;if(!h||!S||!m)return;const v=()=>{if(y)return;const{scrollTop:ee,scrollHeight:te,clientHeight:se}=h;ee+se>=te-200&&m()};return h.addEventListener("scroll",v,{passive:!0}),v(),()=>h.removeEventListener("scroll",v)},[S,y,m]),c.useEffect(()=>{const h=fe.current;if(!h)return;const v=A.current?.querySelector(`[data-message-id="${h}"]`);v&&(fe.current=null,v.focus({preventScroll:!0}))}),c.useEffect(()=>{if(j){if(!Ne){j.current=null;return}return j.current={focusNext:Ve,focusPrevious:qe,focusFirst:ut,focusLast:He,openFocused:me,toggleSelect:ze,extendSelectDown:Qe,extendSelectUp:Ue,selectAll:Se,clearSelection:()=>ie?(Q(),!0):!1,requestVerb:Te,toggleDensity:ke},()=>{j.current=null}}},[j,Ne,Ve,qe,ut,He,me,ze,Qe,Ue,Se,ie,Q,Te,ke]);const Xe=s?"loading":o?"error":n.length===0?"empty":"ready",Mt=o?eo(i):void 0,Tt=c.useCallback(()=>{const h=Bs(Ws());window.open(h,"_blank","noopener,noreferrer")},[]),Rt=[{id:"inbox",threads:[]}],Ze=B.length>0&&B.every(h=>R.has(h)),ft=z&&S&&Ze&&!f&&!p&&w.phase.kind==="idle"&&!w.isRunning,Et=f||p||w.isRunning,g=w.phase.kind==="escalated"?w.phase.total:N,_=w.runningAction?bn(w.runningAction.kind,w.progress?.done??0,w.progress?.total??g):w.phase.kind==="counting"?"Counting matches…":w.phase.kind==="escalated"?ui(u??{},w.phase.total):void 0,J=w.phase.kind!=="escalated"&&B.length>0?{checked:Ze,indeterminate:N>0&&!Ze,onChange:()=>it(B)}:void 0,Cs=w.runningAction?{value:w.progress?.done??0,max:w.progress?.total??g,tone:vn(w.runningAction.kind)}:void 0,Is=(w.phase.kind==="counting"?{tone:"info",text:"",action:{label:"Stop",onClick:w.stop}}:w.phase.kind==="escalated"&&!w.isRunning?{tone:"info",text:"",action:{label:"Clear selection",onClick:kt}}:ft?{tone:"info",text:"",action:{label:di(u??{}),onClick:w.escalate}}:void 0)??(Ge?{tone:"warning",text:Ge}:void 0),ws=r.jsx(Sn,{title:q.title||M,navSlot:q.navSlot,titleMeta:q.titleMeta,searchSlot:q.searchSlot,searchField:q.searchField,idleSlot:q.makeFilterSlot,count:g,onCancel:jt,onDelete:()=>L("delete"),onMove:()=>L("move"),onOrganize:yt,onJunk:Be?()=>L("junk"):void 0,onMarkRead:()=>L("markRead"),overflowSlot:k&&e&&N>0&&$e.length>0?r.jsx(io,{accountId:k,mailboxId:e,messageIds:Array.from(R)}):void 0,isBusy:Et,isCounting:w.phase.kind==="counting",selectAll:J,statusLabel:_,progress:Cs,notice:Is}),js=yn(B,T),ks=c.useCallback(h=>{F.current=!0,U(h)},[U]),Ms=r.jsxs(r.Fragment,{children:[Ie&&a&&r.jsx(Ii,{query:a}),r.jsxs("div",{ref:A,role:"listbox","aria-multiselectable":!0,"aria-label":M,className:"flex-1 overflow-y-auto",children:[r.jsx("div",{role:"presentation",className:"relative w-full",style:{height:`${Z.getTotalSize()}px`},children:Z.getVirtualItems().map(h=>{const v=n[h.index];return r.jsx("div",{role:"presentation","data-index":h.index,ref:Z.measureElement,className:Re("absolute left-0 top-0 w-full border-b border-line",w.isRunning&&"pointer-events-none opacity-50"),style:{transform:`translateY(${h.start}px)`},children:r.jsx(bi,{thread:v,mailboxId:e,isSelected:t===v.messageId,isFocused:T===v.messageId,isTabStop:js===v.messageId,onFocusRow:ks,isChecked:xe(v.messageId),onToggleCheck:G,onRowSelect:ht,isMultiSelectMode:We,onLongPress:wt,isDesktop:O,onDelete:Ct,onToggleRead:It,density:ge})},h.key)})}),y&&r.jsx(Gn,{})]})]});return r.jsxs(r.Fragment,{children:[Oe&&!O&&r.jsx(zt,{tone:"success",variant:"soft",className:"m-2 rounded-md",onDismiss:()=>ct(null),children:Oe}),r.jsx(Yn,{listTitle:M,listMeta:x,sections:Rt,flatList:!0,listState:q.searchResults?"ready":Xe,searchQuery:Ie?a:void 0,listFilter:b,listScopeLabel:C,errorMessage:Mt,onRetry:l,onReportError:Tt,density:ge,selectedThreadId:t,onSelectThread:h=>ne(h),isDesktop:O,hideHeader:E,selectionBar:ws,listBody:q.searchResults??(Xe==="ready"?Ms:void 0)}),r.jsx(ms,{isOpen:Y!==null,title:so(Y?.length??0),description:"You can restore them from Trash later.",confirmLabel:"Move to Trash",destructive:!0,isBusy:f,onConfirm:St,onCancel:ye}),r.jsx(Cn,{verb:K,accountId:k,mailboxId:e,selection:Me,selectionRestriction:Ge?"spansAccounts":void 0,escalated:Je,escalatedProgress:w.progress,onFinished:Q,onRunEnded:at})]})},ji=e=>qs({path:{accountId:e}}),ki=e=>{const n=Dt(),t=_t(),s=Ft({...Vs(),onSuccess:()=>{t.recordEvent("sync.triggered"),n.invalidateQueries({queryKey:ji(e)})}});return{trigger:()=>{s.mutate({path:{accountId:e}})},triggerAsync:()=>s.mutateAsync({path:{accountId:e}}),isPending:s.isPending,error:s.error,reset:s.reset}},Mi=({accountId:e,children:n})=>{const{triggerAsync:t,isPending:s}=ki(e);return r.jsx(Co,{onRefresh:t,isRefreshing:s,children:n})};function Ti({accountId:e,currentMailboxId:n,candidates:t,onMove:s,children:o}){const[i,l]=c.useState(!1),a=_t(),u=fo(),{inboxMailboxId:d}=wn(e),f=jn(e),{data:p}=tt({...Hs({path:{accountId:e}}),staleTime:1/0}),m=c.useMemo(()=>mo({mailboxes:p?.items??[],folderAppointments:f,currentMailboxId:n,translator:u}),[p?.items,f,n,u]),S=c.useMemo(()=>d||(m.find(b=>b.label.toLowerCase()==="inbox")?.id??m.find(b=>!b.isCurrent)?.id??""),[d,m]),y=c.useRef(!1);c.useEffect(()=>{y.current||(y.current=!0,kn(a,t.length))},[a,t.length]);const k=c.useCallback(()=>{Mn(a,t.length),l(!0)},[a,t.length]),M=c.useCallback((x,b)=>{Tn(a,{selected:x.length,total:t.length,toInbox:b===d}),s(x,b)},[a,t.length,d,s]);return r.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[r.jsx("div",{className:"shrink-0 px-row-inset pt-2",children:r.jsx(wo,{count:t.length,onReview:k})}),r.jsx("div",{className:"min-h-0 flex-1",children:o}),r.jsx(Do,{open:i,candidates:t,defaultDestinationId:S,availableFolders:m,delimiter:go(p?.items??[]),onConfirmMove:M,onCancel:()=>l(!1)})]})}const Ri="We can verify this sender";function Ei(e){const{data:n}=tt({...Us({path:{mailboxId:e??""},query:{senderTrust:["vip","wellknown"],dkimMismatch:!1,results:!0,limit:500}}),enabled:!!e,staleTime:6e4});return{candidates:(n?.items??[]).map(s=>({id:s.messageId,senderName:s.fromName||s.fromEmail||"Unknown sender",senderAddress:s.fromEmail??"",subject:s.subject||"(no subject)",snippet:s.snippet??"",trustReason:Ri,trustSubReason:Rn(s.senderTrust),senderTrust:s.senderTrust}))}}const Oi=e=>{const n=new Set,t=[];for(const s of e)n.has(s.threadMessageId)||(n.add(s.threadMessageId),t.push(s));return t},Ai={unread:"unread",flagged:"starred",attachment:"attachments"},Ni=new Set(Object.values(So)),vs=e=>Ni.has(e),zi=e=>vs(e.category)||e.attributes.size>0,Di=e=>{const n={};vs(e.category)&&(n.category=[e.category]);for(const t of e.attributes){const s=Ai[t];s&&(n[s]=!0)}return n},Fi=e=>(e.senderTrust?.length??0)>0||e.dkimMismatch!==void 0?"loaded-pages":"whole-folder",_i=["category","unread","starred","attachments"],Qt=e=>JSON.stringify(_i.map(n=>e?.[n]??null)),Li=e=>{if(!Array.isArray(e))return;const[n]=e;if(typeof n!="object"||n===null)return;const t=n.query;if(!(typeof t!="object"||t===null))return t},Pi=(e,n)=>{const t=Li(e);return t?Qt(t)===Qt(n):!1},mt=e=>e[0],$i=e=>{const n=mt(e.filter(a=>a.type==="from").map(a=>a.value)),t=mt(e.filter(a=>a.type==="subject").map(a=>a.value)),s=mt(e.filter(a=>a.type==="category").map(a=>a.category)),o=mt(e.filter(a=>a.type==="isUnread"||a.type==="isRead").map(a=>a.type==="isUnread")),i=e.some(a=>a.type==="isStarred")?!0:void 0,l=e.some(a=>a.type==="hasAttachment")?!0:void 0;return{...n!==void 0?{from:n}:{},...t!==void 0?{subject:t}:{},...s!==void 0?{category:[s]}:{},...o!==void 0?{unread:o}:{},...i!==void 0?{starred:i}:{},...l!==void 0?{attachments:l}:{}}},Bi=(e,n)=>{switch(n.type){case"from":return e.from?.toLowerCase()===n.value.toLowerCase();case"subject":return e.subject?.toLowerCase()===n.value.toLowerCase();case"category":return e.category?.length===1&&e.category[0]===n.category;case"isUnread":return e.unread===!0;case"isRead":return e.unread===!1;case"isStarred":return e.starred===!0;case"hasAttachment":return e.attachments===!0;case"before":case"after":case"in":case"account":return!1}};function Wi(e,n={}){const t=$i(e),s={...t,...n};return{params:t,residual:e.filter(o=>!Bi(s,o))}}function Ki(e,n,t){if(n.length===0)return e;const s=[...n];return e.filter(o=>{const i=En(o);return On({...i,accountId:i.accountId??t},s)})}const Vi=50,qi=new Map(us().categories.filter(e=>e.id!=="all").map(e=>[e.id,e.label])),Ss=c.createContext(null);function bt(){const e=c.useContext(Ss);if(!e)throw new Error("MailboxPane.* must be used inside <MailboxPane>");return e}function Hi({mailboxId:e,thread:n,children:t}){const s=st(),o=n?.threadId,i=n?.messageId,l=_t(),{accounts:a,searchQuery:u,intelligenceOpen:d,onToggleIntelligence:f}=es(),p=en(),m=yo(u),S=m.length>0,{freeText:y,tokens:k}=tn(m,p),[M,x]=c.useState("all"),[b,C]=c.useState(new Set),I=c.useMemo(()=>({category:M,attributes:b}),[M,b]),j=c.useMemo(()=>Di(I),[I]),E=S||zi(I),{params:A,residual:D}=Wi(k,j),O={order:"desc",limit:Vi,...y?{query:y}:{},...A,...j},W={category:O.category,unread:O.unread,starred:O.starred,attachments:O.attachments},K=E?Qs({path:{mailboxId:e},query:O}):Js({path:{mailboxId:e},query:{order:"desc"}}),{data:L,isLoading:V,isError:oe,error:Ie,refetch:q,fetchNextPage:$e,hasNextPage:ae,isFetchingNextPage:T}=Xn({queryKey:K,queryFn:async({pageParam:g})=>{if(E){const{data:J}=await Xs({path:{mailboxId:e},query:{...O,continuationToken:g},throwOnError:!0});return J}const{data:_}=await Zs({path:{mailboxId:e},query:{order:"desc",continuationToken:g},throwOnError:!0});return _},initialPageParam:void 0,getNextPageParam:g=>g.continuationToken,placeholderData:(g,_)=>Pi(_?.queryKey,W)?g:void 0}),{accountId:H}=An(e),we=po({accounts:a}),P=Ki(Nn(Oi(L?.pages.flatMap(g=>g.items??[])??[])),D,H),U=c.useCallback(g=>{x(g)},[]),ge=c.useCallback(g=>{C(_=>{const J=new Set(_);return J.has(g)?J.delete(g):J.add(g),J})},[]),je=c.useCallback(()=>{x("all"),C(new Set)},[]),ke=qi.get(M),Ee=ke?{label:ke,reach:D.length>0?"loaded-pages":Fi(O),onClear:je}:void 0,pe=o?P.find(g=>g.messageId===i)??P.find(g=>g.threadId===o):void 0,Be=zn(o,i),R=pe??Be,N=i??R?.messageId,ie=c.useMemo(()=>{if(o)return{threadId:o,mailboxId:R?.mailboxId??e,subject:R?.subject,messageId:N,authenticity:R?.authenticity}},[o,R,N,e]),xe=c.useCallback(()=>{s({to:"/mail/$mailboxId",params:{mailboxId:e},search:g=>g,hash:Pe})},[e,s]),G=c.useCallback(g=>{s({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:e,...g},search:_=>_,hash:Pe})},[e,s]),re=c.useCallback(g=>{N&&g.includes(N)&&xe()},[N,xe]),{deleteMessages:X,isPending:ue}=Kt({mailboxId:e,onAfterOptimisticRemove:re}),{moveMessages:be,isPending:ot}=Vt({mailboxId:e,accountId:H,onAfterOptimisticRemove:re}),it=Dn(),{listCommandsRef:le,onTriageContextChange:We,focusedMessageId:Y,selectedIds:ve}=it,z=P.find(g=>g.messageId===Y)??R,rt=c.useRef(null);c.useEffect(()=>{const g=R?.messageId??null;g&&rt.current!==g&&R?.authenticity?.dkimMismatch&&(rt.current=g,d||f())},[R?.messageId,R?.authenticity?.dkimMismatch,d,f]);const w=xo({accounts:a})??0,at=Dt(),{pushError:lt}=Zt(),he=Fn({thread:R,mailboxId:e,accountId:H,onAfterOptimisticRemove:re}),{draftsMailboxId:Q}=_n(H),Oe=Q!==void 0&&Q===e,{archiveMailboxId:ct}=Ln(H),fe=Pn(),{requestCompose:F}=he,Ae=c.useCallback(()=>{F("reply")},[F]),Ne=c.useCallback(()=>{F("reply_all")},[F]),dt=c.useCallback(()=>{F("forward")},[F]),{state:Z,openCompose:Ke,closeCompose:$}=pt(),ce=c.useCallback(()=>{Ke({mode:"new"})},[Ke]),Ve=c.useRef(N);c.useEffect(()=>{const g=Ve.current;Ve.current=N,!(!N||N===g)&&$()},[N,$]);const qe=Ft({...Xt(),onError:g=>{lt(Gs("Couldn't discard draft","The draft wasn't deleted.",g))}}),ut=c.useCallback(()=>{const g=Z.outboxMessageId;g&&(qe.mutate({path:{outboxMessageId:g}}),at.invalidateQueries({queryKey:Yt()}),$())},[Z.outboxMessageId,qe,at,$]),He=c.useCallback(g=>g?fe(g):[],[fe]),{toggleStar:ze}=$n({threadId:z?.threadId??"",mailboxId:e}),{toggleReadFor:B}=rs({mailboxId:e,accountId:H}),{junkMailboxId:Me}=as(H),ht=Me!=null&&Me===e,De=ls(Me,e),{candidates:Fe}=Ei(ht?Me:void 0),{moveMessages:Ue}=Vt({mailboxId:e,threadId:z?.threadId,accountId:H,onAfterOptimisticRemove:re}),{deleteMessages:Qe}=Kt({mailboxId:e,threadId:z?.threadId,onAfterOptimisticRemove:re}),{addressId:Se,address:Te}=Bn(z),{updateFlags:ne}=Wn({addressId:Se,senderEmail:z?.fromEmail??void 0}),me=c.useCallback(()=>{if(N||!Y)return!1;const g=P.find(_=>_.messageId===Y);return g?(G({threadId:g.threadId,messageId:Y}),!0):!1},[N,Y,P,G]),vt=c.useCallback(()=>{me()||R&&F("reply")},[me,R,F]),Je=c.useCallback(()=>{me()||R&&F("reply_all")},[me,R,F]),St=c.useCallback(()=>{me()||R&&F("forward")},[me,R,F]),ye=c.useCallback(()=>He(z),[He,z]),Ge=c.useCallback(()=>{if(le.current?.requestVerb("delete"))return;const g=ye();g.length>0&&Qe(g)},[le,ye,Qe]),yt=c.useCallback(()=>{if(le.current?.requestVerb("junk")||!De)return;const g=ye();g.length!==0&&(Kn(l,{count:g.length,senderTrust:z?.senderTrust??"unknown",wasRescuable:z?Vn(z):!1}),Ue(g,De))},[le,De,ye,Ue,l,z]),Ct=c.useCallback(()=>{if(ve.length>0){const g=!(z?.hasStars??!1),_=new Set(ve);for(const J of P)_.has(J.messageId)&&J.hasStars!==g&&ze(J.messageId,J.hasStars);return}z&&ze(z.messageId,z.hasStars)},[ve,P,z,ze]),It=c.useCallback(()=>{if(le.current?.requestVerb("markRead"))return;const g=ye();if(g.length===0)return;const _=!(z?.isRead??!1);B(g,_)},[le,ye,z,B]),wt=c.useCallback(()=>{if(!Se)return;const g=Te?.flags?.muted?.value!==!0;ne({muted:{value:g}})},[Se,Te,ne]),jt=c.useCallback(()=>{if(!Se)return;const g=Te?.flags?.vip?.value!==!0;ne({vip:{value:g}})},[Se,Te,ne]),kt=c.useCallback(()=>{d||f()},[d,f]),Ce=c.useCallback(g=>{s({to:g})},[s]),Ye=Oe?"drafts":ct===e?"archive":Me===e?"junk":"inbox",Xe=c.useRef("");c.useEffect(()=>{const g=Xe.current;Xe.current=m,m.length>0&&g.length===0&&l.recordEvent("search.submitted",{mailboxType:Ye})},[m,Ye,l]);const Mt=Oe&&Z.isOpen&&!!Z.outboxMessageId&&!R,{goBack:Tt,nextMessageId:Rt,previousMessageId:Ze}=qn({context:it,orderedIds:P.map(g=>g.messageId),selectedMessageId:N,enabled:!Z.isOpen,onClose:xe,handlers:{reply:vt,replyAll:Je,forward:St,delete:Ge,toggleStar:Ct,toggleRead:It,muteSender:wt,blockSender:kt,vipSender:jt,markJunk:yt,toggleIntelligence:R?f:void 0,compose:ce,goBrief:()=>Ce("/mail/brief"),goInbox:()=>Ce("/mail/brief"),goSent:()=>Ce("/mail/brief"),goFlagged:()=>Ce("/mail/flagged"),goSettings:()=>Ce("/settings")}});bo({enabled:Z.isOpen,bindings:[{key:"Escape",handler:$,preventDefault:!0}]});const ft=g=>{if(!g)return;const _=P.find(J=>J.messageId===g);return _?{threadId:_.threadId,messageId:g}:void 0},Et={mailboxId:e,selectedMessageId:N,selectedThread:R,conversation:ie,onOpenThread:G,threads:P,isLoading:V,isError:oe,error:Ie,mailboxAccountId:H,mailboxName:we,unreadCount:w,isDraftsMailbox:Oe,isSpamFolder:ht,rescueCandidates:Fe,filterCategory:M,filterAttributes:b,onSelectFilterCategory:U,onToggleFilterAttribute:ge,onClearFilters:je,listFilter:Ee,intelligenceOpen:d,onToggleIntelligence:f,handleDeselectIfRemoved:re,searchPredicate:S&&D.length===0?O:void 0,onDeleteMessages:X,onMoveMessages:be,isDeleting:ue,isMoving:ot,onLoadMore:$e,hasMore:ae,isLoadingMore:T,onTriageContextChange:We,listCommandsRef:le,onRetry:()=>q(),toolbarComposeRequest:he.composeRequest,onToolbarReply:Ae,onToolbarReplyAll:Ne,onToolbarForward:dt,onClearComposeRequest:he.clearComposeRequest,onToolbarDelete:he.deleteThread,onToolbarStar:he.toggleStar,onToolbarDiscardDraft:ut,onToolbarMove:he.moveThread,composeState:Z,closeCompose:$,hasRemitDraftOpen:Mt,onBack:Tt,nextThread:ft(Rt),previousThread:ft(Ze)};return r.jsx(Ss.Provider,{value:Et,children:t})}function ys(){const{mailboxId:e,selectedMessageId:n,threads:t,isLoading:s,isError:o,error:i,onDeleteMessages:l,onMoveMessages:a,isDeleting:u,isMoving:d,onLoadMore:f,hasMore:p,isLoadingMore:m,mailboxAccountId:S,mailboxName:y,unreadCount:k,isDraftsMailbox:M,isSpamFolder:x,rescueCandidates:b,onTriageContextChange:C,listCommandsRef:I,onRetry:j,filterCategory:E,filterAttributes:A,onSelectFilterCategory:D,onToggleFilterAttribute:O,onClearFilters:W,listFilter:K,searchPredicate:L}=bt(),{searchQuery:V,searchInput:oe,accounts:Ie,resultFolderIndex:q}=es(),$e=vo(),ae=st(),T=y??"Inbox",H=c.useMemo(()=>us(),[]),we=c.useMemo(()=>S?[S]:[],[S]),{hasNewMail:P}=nn(),{state:U,errorMessage:ge,refresh:je}=on(we,{onSettled:j}),ke=c.useMemo(()=>r.jsx(rn,{state:U,onRefresh:je,label:`Refresh ${T}`,errorMessage:ge,hasUpdate:P(we)}),[U,je,T,ge,P,we]),Ee=c.useMemo(()=>t.map(X=>Un(X,q)),[t,q]),{hits:pe,isLoading:Be}=ro({mailboxId:e,filterCategory:E}),R=c.useMemo(()=>Qn(pe,t.map(X=>X.threadId),q),[pe,t,q]),N=c.useCallback(X=>{const ue=X.threadId??t.find(be=>be.messageId===X.id)?.threadId;ue&&ae({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:X.mailboxId??e,threadId:ue,messageId:X.id},search:be=>({...be,q:oe||void 0}),hash:Pe})},[e,ae,oe,t]);if(M&&S)return r.jsx(Ho,{mailboxId:e,accountId:S,selectedMessageId:n,imapThreads:t,title:y??"Drafts",unreadCount:k??void 0});const ie=r.jsx(wi,{mailboxId:e,threads:t,selectedMessageId:n,isLoading:s,isError:o,error:i,onRetry:j,searchQuery:V,searchPredicate:L,onDeleteMessages:l,isDeleting:u,isMoving:d,onLoadMore:f,hasMore:p,isLoadingMore:m,accountId:S,listTitle:T,listFilter:K,listScopeLabel:T,hideHeader:!0,onTriageContextChange:C,commandsRef:I}),xe=Ie[0]?.accountId,G=$e==="phone"&&xe?r.jsx(Mi,{accountId:xe,children:ie}):ie,re=x&&b.length>0&&S?r.jsx(Ti,{accountId:S,currentMailboxId:e,candidates:b,onMove:a,children:G}):G;return r.jsx(Zn,{title:T,unreadCount:k,preset:H,selectedCategory:E,activeFilters:A,onSelectCategory:D,onToggleFilter:O,onClearFilters:W,searchResults:Ee,searchLoading:s,relatedResults:R,relatedLoading:Be,onSelectSearchResult:N,searchResultsInBody:!0,refreshControl:ke,children:re})}function Ui(){const{mailboxId:e,mailboxAccountId:n,selectedThread:t,conversation:s,hasRemitDraftOpen:o,intelligenceOpen:i,onToggleIntelligence:l,toolbarComposeRequest:a,onToolbarReply:u,onToolbarReplyAll:d,onToolbarForward:f,onClearComposeRequest:p,onToolbarDelete:m,onToolbarStar:S,onToolbarDiscardDraft:y,onToolbarMove:k,composeState:M,handleDeselectIfRemoved:x}=bt(),b=Ys()?.showIntelligencePane??!1,C=!!s,[I,j]=c.useState(null),E=s?.threadId??null,A=!b&&E!==null&&I===E,D=c.useCallback(()=>j(null),[]),O=c.useCallback(()=>j(E),[E]),W=b?l:O,K=c.useCallback(()=>{if(b){l();return}j(A?null:E)},[b,l,A,E]),L=C&&(b?i:A),V=M.isOpen&&!s?r.jsx(ps,{}):s?r.jsx(cs,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onOpenIntelligence:s.authenticity?.dkimMismatch?W:void 0,composeRequest:a,onComposeClose:p}):r.jsx(sn,{});return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(Hn,{hasThread:C,intelligenceOpen:L,canToggleIntelligence:C,onToggleIntelligence:K,onReply:C?u:void 0,onReplyAll:C?d:void 0,onForward:C?f:void 0,canDelete:C||o,onDelete:C?m:o?y:void 0,onToggleStar:C?S:void 0,isStarred:t?.hasStars,moveContext:C&&n?{accountId:n,currentMailboxId:e,onMove:k}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:V})]}),r.jsx(ds,{isOpen:A,onClose:D,ariaLabel:"Message details",side:"right",children:r.jsx(Lt,{onClose:D,thread:t,mailboxId:e,accountId:n,hideCloseButton:!0,onAfterOptimisticRemove:x})})]})}function Qi(){const{mailboxId:e,mailboxAccountId:n,selectedThread:t,onToggleIntelligence:s,handleDeselectIfRemoved:o}=bt();return r.jsx(Lt,{onClose:s,thread:t,mailboxId:e,accountId:n,onAfterOptimisticRemove:o})}function Ji(){const{mailboxId:e,mailboxAccountId:n,selectedThread:t,conversation:s,onOpenThread:o,intelligenceOpen:i,onToggleIntelligence:l,onBack:a,nextThread:u,previousThread:d,composeState:f,handleDeselectIfRemoved:p}=bt();return s?r.jsxs(r.Fragment,{children:[r.jsx(cs,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:a,onOpenIntelligence:l,onSwipeNext:u?()=>o(u):void 0,onSwipePrevious:d?()=>o(d):void 0,mobileIntelligenceOpen:i}),r.jsx(ds,{isOpen:i,onClose:l,ariaLabel:"Message details",side:"right",children:r.jsx(Lt,{onClose:l,thread:t,mailboxId:e,accountId:n,hideCloseButton:!0,onAfterOptimisticRemove:p})})]}):f.isOpen?r.jsx("div",{className:"h-full",children:r.jsx(ps,{})}):r.jsx(ys,{})}const yr=Object.assign(Hi,{List:ys,Reading:Ui,Intelligence:Qi,Phone:Ji});export{yr as M};
@@ -1 +0,0 @@
1
- import{aa as C,e as w,am as k,j as s,b as h,bQ as U,T as H,f as S,p as K,x as W,y as G,o as J,r as m,u as R,bI as I,bT as V,s as X,k as Y,ac as Z,bf as ee,ae as N,af as v,ce as se,bg as te}from"./index-Bf6zeV_t.js";import{u as ne,p as ae,R as p,g as oe}from"./useSearchTokenContext-BRWpWSX8.js";import{C as T}from"./circle-check-big-DAvgIk1F.js";import{C as A}from"./clock-D7o61sW5.js";import{R as re}from"./row-actions-Dq-6Ssz1.js";import{R as ie}from"./rotate-ccw-9aRuc9Yf.js";import{N as E}from"./NavMenuButton-B1nVcSa5.js";import{a as g,t as le}from"./format-De9HZKjg.js";import{i as ce,a as L}from"./outbox-status-CPfNHfUQ.js";import{n as de}from"./search-query-Cr_ZXBCp.js";import{r as y}from"./nav-link-kGZZQ6tj.js";const ue={queued:{icon:A,label:"Queued",className:"text-warning"},sending:{icon:k,label:"Sending…",className:"text-accent-2",spin:!0},sent:{icon:T,label:"Sent",className:"text-positive"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:C,label:"Blocked",className:"text-warning"}};function M({status:e,iconOnly:n,className:a}){const t=ue[e],o=t.icon;return s.jsxs("span",{className:h("inline-flex items-center gap-1.5 text-xs font-medium",t.className,a),children:[s.jsx(o,{className:h("size-4",t.spin&&"animate-spin")}),!n&&t.label]})}const xe=(e,n)=>n?"bg-accent-2-soft":e==="failed"?"bg-danger-soft":e==="blocked"?"bg-warning/10":"";function me({recipients:e,subject:n,time:a,status:t,error:o,selected:i,onSelect:c,onRetry:r,retrying:d,onEdit:l,onDelete:f,deleting:u}){const b=t==="failed"||t==="blocked";return s.jsxs("div",{className:h("flex items-start gap-3 border-b border-line px-4 py-3 transition-colors hover:bg-surface-raised",xe(t,i)),children:[s.jsxs("button",{type:"button",...U,onClick:c,className:"flex flex-1 min-w-0 items-start gap-3 text-left",children:[s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(M,{status:t,iconOnly:!0})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:e}),s.jsx("span",{className:"shrink-0 text-xs text-fg-muted",children:a})]}),s.jsx("div",{className:"truncate text-sm",children:n||"No subject"}),s.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[s.jsx(M,{status:t}),o&&s.jsxs("span",{className:"truncate text-xs text-fg-muted",children:["— ",o]})]})]})]}),b&&s.jsx("div",{className:"shrink-0",children:s.jsx(re,{actions:[...t==="failed"&&r?[{label:"Retry sending",iconOnly:!0,icon:s.jsx(ie,{className:"size-3.5"}),busy:d,onClick:r}]:[],{label:"Edit as draft",iconOnly:!0,icon:s.jsx(S,{className:"size-3.5"}),onClick:l}],destructive:{label:"Delete message",iconOnly:!0,icon:s.jsx(H,{className:"size-3.5"}),busy:u,confirm:{prompt:"Delete this message?",confirmLabel:"Delete"},onClick:f}})})]})}function fe(e,n){const a=n.trim().toLowerCase();if(a.length===0)return!0;const t=[e.subject,e.fromAddress,e.fromName,...e.toAddresses??[],...e.ccAddresses??[]].filter(o=>typeof o=="string").join(" ").toLowerCase();return a.split(/\s+/).every(o=>o.length===0||t.includes(o))}function he(e){return e.tokens.length>0&&e.freeText.trim().length===0}const Q={queued:{icon:A,label:"Queued",className:"text-warning"},sending:{icon:k,label:"Sending…",className:"text-accent-2"},sent:{icon:T,label:"Sent",className:"text-positive"},failed:{icon:w,label:"Failed",className:"text-danger"},blocked:{icon:C,label:"Blocked",className:"text-warning"}},be=e=>le(e).toDateString()===new Date().toDateString()?g(e,{hour:"numeric",minute:"2-digit"}):g(e,{month:"short",day:"numeric"}),O=e=>g(e,{dateStyle:"medium",timeStyle:"short"}),ge=e=>{const n=e.toAddresses??[];return n.length===0?"No recipients":n.length===1?n[0]:`${n[0]} +${n.length-1}`},D=(e,n)=>n?"The outbox cannot filter on those terms":e?"No matching outbox messages":"No outbox messages",P=m.createContext(null);function j(){const e=m.useContext(P);if(!e)throw new Error("OutboxPane.* must be used inside <OutboxPane>");return e}function pe({outboxMessageId:e,children:n}){const a=K(),{data:t,isLoading:o}=W(G()),{searchQuery:i}=J(),c=ne(),r=de(i),d=ae(r,c),l=r.length>0,f=he(d),u=m.useMemo(()=>f?[]:(t?.items??[]).filter(x=>ce(x.status)).filter(x=>fe(x,d.freeText)),[t,d.freeText,f]),b=m.useMemo(()=>u.find(x=>x.outboxMessageId===e),[u,e]),F=m.useCallback(x=>{a({to:"/mail/outbox/draft/$outboxMessageId",params:{outboxMessageId:x},search:q=>q,hash:y})},[a]),$=m.useCallback(()=>{a({to:"/mail/outbox",search:x=>x,hash:y})},[a]),_={messages:u,hasQuery:l,unsupportedQuery:f,isLoading:o,selectedMessageId:e,selectedMessage:b,onOpenMessage:F,onCloseMessage:$};return s.jsx(P.Provider,{value:_,children:n})}function B({message:e,isSelected:n,onSelect:a}){const t=X(),{openCompose:o}=Y(),{pushError:i}=Z(),c=m.useCallback(()=>{t.invalidateQueries({queryKey:ee()})},[t]),r=N({...se(),onSuccess:c,onError:u=>{i(v("Couldn't resend message","The message wasn't sent.",u))}}),d=N({...te(),onSuccess:c,onError:u=>{i(v("Couldn't delete message","The message wasn't deleted.",u))}}),l=e.status;if(!Q[l])return null;const f=L(e.status);return s.jsx(me,{recipients:ge(e),subject:e.subject||"",time:be(e.sentAt??e.updatedAt),status:l,error:f?e.lastError??void 0:void 0,selected:n,onSelect:a,onRetry:l==="failed"?()=>r.mutate({path:{outboxMessageId:e.outboxMessageId}}):void 0,retrying:r.isPending,onEdit:()=>o({mode:"new",outboxMessageId:e.outboxMessageId}),onDelete:()=>d.mutate({path:{outboxMessageId:e.outboxMessageId}}),deleting:d.isPending})}function z({message:e,onBack:n}){const a=e.status,t=Q[a],o=t?.icon??S,i=e.sentAt?O(e.sentAt):O(e.updatedAt);return s.jsxs("div",{className:"h-full overflow-y-auto bg-canvas",children:[s.jsxs("div",{className:"border-b border-line p-4",children:[n&&s.jsxs("button",{type:"button",onClick:n,className:"mb-3 inline-flex items-center gap-1 text-sm text-fg-muted hover:text-fg",children:[s.jsx(V,{className:"size-4"}),s.jsx("span",{children:"Back"})]}),s.jsx("h1",{className:"text-xl font-semibold mb-3",children:e.subject||"(No subject)"}),s.jsxs("div",{className:"space-y-1 text-sm",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"From:"}),s.jsx("span",{className:"text-fg",children:e.fromName?`${e.fromName} <${e.fromAddress}>`:e.fromAddress})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"To:"}),s.jsx("span",{className:"text-fg",children:(e.toAddresses??[]).join(", ")})]}),e.ccAddresses&&e.ccAddresses.length>0&&s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Cc:"}),s.jsx("span",{className:"text-fg",children:e.ccAddresses.join(", ")})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-fg-muted shrink-0 w-12",children:"Date:"}),s.jsx("span",{className:"text-fg",children:i})]}),t&&s.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[s.jsx(o,{className:h("size-4",t.className,a==="sending"&&"animate-spin")}),s.jsx("span",{className:h("text-xs font-medium",t.className),children:t.label}),L(e.status)&&e.lastError&&s.jsxs("span",{className:"text-xs text-fg-muted",children:["— ",e.lastError]})]})]})]}),s.jsx("div",{className:"p-4",children:s.jsx(oe,{html:e.htmlBody,text:e.textBody})})]})}function je(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,onOpenMessage:i}=j(),c=m.useRef(null);return R({containerRef:c,itemSelector:I}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(p,{message:D(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(E,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:c,className:"flex-1 overflow-y-auto",children:e.map(r=>s.jsx(B,{message:r,isSelected:o===r.outboxMessageId,onSelect:()=>i(r.outboxMessageId)},r.outboxMessageId))})]})}function Ne(){const{selectedMessage:e}=j();return s.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsx("header",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-3"}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?s.jsx(z,{message:e}):s.jsx(p,{message:"Select a message to read",showHints:!1})})]})}function ve(){const{messages:e,hasQuery:n,unsupportedQuery:a,isLoading:t,selectedMessageId:o,selectedMessage:i,onOpenMessage:c,onCloseMessage:r}=j(),d=m.useRef(null);return R({containerRef:d,itemSelector:I}),t?s.jsx("div",{className:"flex h-full items-center justify-center bg-canvas",children:s.jsx("span",{className:"text-fg-muted",children:"Loading..."})}):i?s.jsx(z,{message:i,onBack:r}):e.length===0?s.jsx("div",{className:"flex h-full bg-surface",children:s.jsx(p,{message:D(n,a),showHints:!1})}):s.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",children:[s.jsx(E,{}),s.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:"Outbox"}),s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[e.length," ",e.length===1?"message":"messages"]})]}),s.jsx("div",{ref:d,className:"flex-1 overflow-y-auto",children:e.map(l=>s.jsx(B,{message:l,isSelected:o===l.outboxMessageId,onSelect:()=>c(l.outboxMessageId)},l.outboxMessageId))})]})}const Ee=Object.assign(pe,{List:je,Reading:Ne,Phone:ve});export{Ee as O};
@@ -1 +0,0 @@
1
- import{a2 as m,j as o,$ as p}from"./index-Bf6zeV_t.js";import{a}from"./search-view-B25AYYYV.js";import{M as r}from"./MailboxPane-CO67RCjZ.js";import{u as e}from"./useSearchMirror-Co706q8t.js";import"./nav-link-kGZZQ6tj.js";import{e as s}from"./search-token-index-ufNaSd81.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./useRefreshControl-Ba6f6ijf.js";import"./circle-check-big-DAvgIk1F.js";import"./MailListHeader-GQfpCdPQ.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./use-match-media-Cqq5eDbi.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./MailViewChrome-Or_Zfnrd.js";import"./NavMenuButton-B1nVcSa5.js";import"./useLabels-BMVLGb1c.js";import"./useSemanticSearch-CCTRY7p1.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DSZ-IeLs.js";import"./circle-help-BG86c5CF.js";import"./circle-check-Bd1R3tZl.js";function J(){const{mailboxId:t}=m.useParams(),i=s();return e({to:"/mail/$mailboxId",params:{mailboxId:t}}),o.jsx(r,{mailboxId:t,thread:i,children:o.jsx(a,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(p,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!i})})}export{J as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-Bf6zeV_t.js";import{M as r}from"./MailboxPane-CO67RCjZ.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./useRefreshControl-Ba6f6ijf.js";import"./circle-check-big-DAvgIk1F.js";import"./search-token-index-ufNaSd81.js";import"./use-match-media-Cqq5eDbi.js";import"./MailListHeader-GQfpCdPQ.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./MailViewChrome-Or_Zfnrd.js";import"./NavMenuButton-B1nVcSa5.js";import"./useLabels-BMVLGb1c.js";import"./useSemanticSearch-CCTRY7p1.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DSZ-IeLs.js";import"./circle-help-BG86c5CF.js";import"./circle-check-Bd1R3tZl.js";function F(){return o.jsx(r.Reading,{})}export{F as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-Bf6zeV_t.js";import{F as r}from"./FlaggedPane-BldHHUxk.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./MailListHeader-GQfpCdPQ.js";import"./search-token-index-ufNaSd81.js";import"./use-match-media-Cqq5eDbi.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./MailViewChrome-Or_Zfnrd.js";function k(){return o.jsx(r.Reading,{})}export{k as component};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-Bf6zeV_t.js";import{B as o}from"./BriefPane-fii0IiRa.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./MailListHeader-GQfpCdPQ.js";import"./search-token-index-ufNaSd81.js";import"./use-match-media-Cqq5eDbi.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./useRefreshControl-Ba6f6ijf.js";import"./circle-check-big-DAvgIk1F.js";import"./useLabels-BMVLGb1c.js";import"./useSemanticSearch-CCTRY7p1.js";import"./search-query-Cr_ZXBCp.js";function y(){return r.jsx(o.Reading,{})}export{y as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-Bf6zeV_t.js";import{O as t}from"./OutboxPane-DuBwgi_W.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./circle-check-big-DAvgIk1F.js";import"./clock-D7o61sW5.js";import"./row-actions-Dq-6Ssz1.js";import"./rotate-ccw-9aRuc9Yf.js";import"./NavMenuButton-B1nVcSa5.js";import"./menu-DNUIh6FR.js";import"./format-De9HZKjg.js";import"./outbox-status-CPfNHfUQ.js";import"./search-query-Cr_ZXBCp.js";function P(){return o.jsx(t.Reading,{})}export{P as component};
@@ -1 +0,0 @@
1
- import{$ as o}from"./index-Bf6zeV_t.js";const n=o;export{n as component};
@@ -1 +0,0 @@
1
- import{$ as o}from"./index-Bf6zeV_t.js";const n=o;export{n as component};
@@ -1 +0,0 @@
1
- import{$ as o}from"./index-Bf6zeV_t.js";const n=o;export{n as component};
@@ -1 +0,0 @@
1
- import{j as r,$ as i}from"./index-Bf6zeV_t.js";import{a as m}from"./search-view-B25AYYYV.js";import{B as o}from"./BriefPane-fii0IiRa.js";import{u as p}from"./useSearchMirror-Co706q8t.js";import"./nav-link-kGZZQ6tj.js";import{e}from"./search-token-index-ufNaSd81.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./MailListHeader-GQfpCdPQ.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./use-match-media-Cqq5eDbi.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./useRefreshControl-Ba6f6ijf.js";import"./circle-check-big-DAvgIk1F.js";import"./useLabels-BMVLGb1c.js";import"./useSemanticSearch-CCTRY7p1.js";import"./search-query-Cr_ZXBCp.js";function z(){const t=e();return p({to:"/mail/brief"}),r.jsx(o,{thread:t,children:r.jsx(m,{phone:r.jsx(o.Phone,{}),list:r.jsx(o.List,{}),reading:r.jsx(i,{}),intelligence:r.jsx(o.Intelligence,{}),hasThread:!!t})})}export{z as component};
@@ -1 +0,0 @@
1
- import{s as X,ae as Z,aV as ee,aW as te,r as x,j as t,aX as ae,aY as se,am as R,B as N,au as ie,aA as ne,aZ as re,a_ as oe,T as le,x as P,w as ce,z as de,E as me,p as ue,Y as pe,ay as xe,aC as fe}from"./index-Bf6zeV_t.js";import{S as he}from"./settings-screen-DSdtzTVA.js";import{B as ge}from"./bottom-sheet-DSZ-IeLs.js";import{b as ve,N as S,p as be,u as ye,r as je,a as Ne,S as L,c as Ce,n as Se,d as Fe,f as Me,e as Ie,g as we,h as Ee}from"./useFilters-BfhDojrF.js";import{u as Oe,a as Ae,b as De,f as Le}from"./move-options-BPdblyET.js";import{u as Te,a as ke}from"./useLabels-BMVLGb1c.js";import{C as D}from"./circle-check-Bd1R3tZl.js";import{E as z}from"./ErrorState-D3orNRU4.js";import"./avatar-902Ehcia.js";import"./menu-DNUIh6FR.js";import"./circle-help-BG86c5CF.js";import"./use-match-media-Cqq5eDbi.js";import"./enums-CCxx0t2v.js";const Re=(e,a)=>{const r=X(),i=Z({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:ve(e)}),a&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:a}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!a||c({path:{accountId:e,filterId:a},body:d})},[e,a,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},Pe=(e,a=!1)=>({clauses:e.literalClauses.map((i,c)=>({id:`clause-${c}`,field:i.field,value:i.value})),matchOperator:e.matchOperator==="And"?"all":"any",widen:e.hasAnchor?{anchorCount:1,...a?{inactive:!0}:{}}:void 0,moveMailboxId:e.actionMailboxId!==S?e.actionMailboxId:void 0,labelId:e.actionLabelId!==S?e.actionLabelId:void 0,scope:e.scope==="Temporary"?"until":"standing",until:e.scope==="Temporary"?ze(e.expiresAt):void 0,name:e.name}),ze=e=>{if(!e)return"";const a=Date.parse(e);if(Number.isNaN(a))return"";const r=new Date(a),i=c=>String(c).padStart(2,"0");return`${r.getFullYear()}-${i(r.getMonth()+1)}-${i(r.getDate())}`},T=e=>JSON.stringify({clauses:e.clauses.map(a=>[a.field,a.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),$=(e,a)=>T(e)!==T(a),k=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),_=(e,a)=>k(e)!==k(a),$e=(e,a)=>{const r={},i=(e.name??"").trim();return i!==(a.name??"").trim()&&(r.name=i),$(e,a)&&(r.matchOperator=e.matchOperator==="all"?"And":"Or",r.literalClauses=e.clauses.map(c=>({field:c.field,value:c.value})),r.actionMailboxId=e.moveMailboxId??S,r.actionLabelId=e.labelId??S),_(e,a)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=be(e.until??""))),r};function _e({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>Pe(a,g),[a,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,b]=x.useState(!1),M=x.useRef(0),{count:C}=ye(e,je(n)),j=Re(e,a.filterId),v=Ne(e),{createFolderIn:F}=Oe(e),{createLabel:E}=Te(e),I=async o=>{const s=await E(o);return{id:s.labelId,name:s.name,color:s.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),w=o=>{const s=n.clauses.find(y=>y.id===o);s&&u({mode:"edit",clauseId:o,draft:{field:s.field,value:s.value}})},O=o=>u(s=>s&&{...s,draft:{...s.draft,field:o}}),B=o=>u(s=>s&&{...s,draft:{...s.draft,value:o}}),U=()=>{if(!m)return;const o=m.draft.field,s=Se(o,m.draft.value);s!==""&&(l(y=>m.mode==="edit"&&m.clauseId?{...y,clauses:y.clauses.map(A=>A.id===m.clauseId?{id:A.id,field:o,value:s}:A)}:(M.current+=1,{...y,clauses:[...y.clauses,{id:`new-${M.current}`,field:o,value:s}]})),u(void 0))},K=o=>l(s=>({...s,clauses:s.clauses.filter(y=>y.id!==o)})),Q=o=>l(s=>({...s,matchOperator:o})),V=o=>l(s=>({...s,moveMailboxId:o||void 0})),G=o=>l(s=>({...s,labelId:o||void 0})),H=o=>l(s=>({...s,name:o})),J=o=>l(s=>({...s,scope:o,until:o==="until"?s.until:void 0})),q=o=>l(s=>({...s,until:o})),Y=()=>{const o=$(n,f)||_(n,f),s=$e(n,f);if(Object.keys(s).length===0){d();return}b(o),j.updateFilter(s)},W=()=>v.start(Ce(n));return v.isStarting||v.isRunning||v.isDone?t.jsx(Qe,{progress:v.progress,isDone:v.isDone,onClose:d}):j.isPending?t.jsx(Be,{}):j.isError?t.jsx(Ve,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Ke,{preview:ae(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:W,onClose:d}):t.jsx(Ue,{onClose:d}):t.jsx(se,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:w,onRemoveClause:K,onChangeDraftField:O,onChangeDraftValue:B,onSubmitClause:U,onCancelClause:()=>u(void 0),onChangeMatchOperator:Q,onChangeMove:V,onCreateFolder:F,onChangeLabel:G,onCreateLabel:I,onChangeName:H,onChangeScope:J,onChangeUntil:q,onCommit:Y,onCancel:d})}function Be(){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function Ue({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(D,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),t.jsx(N,{variant:"primary",onClick:e,className:"mt-2",children:"Done"})]})}function Ke({preview:e,blocked:a,onReapply:r,onClose:i}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(D,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),t.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",e," — move the mail already in your mailbox too?"]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:r,disabled:a,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Qe({progress:e,isDone:a,onClose:r}){const i=e.state==="Failed";return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[a?i?t.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):t.jsx(D,{className:"size-8 text-positive"}):t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),!a&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),a&&!i&&t.jsxs("div",{className:"text-sm text-fg",children:[t.jsx("p",{className:"font-medium",children:"Done"}),t.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[e.appliedCount," of ",e.matchedCount," moved",e.failedCount>0?` · ${e.failedCount} failed`:"","."]})]}),a&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),a&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function Ve({onRetry:e,onClose:a}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:e,children:"Try again"}),t.jsx(N,{variant:"ghost",onClick:a,children:"Not now"})]})]})}function Ge({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=Fe(),n=t.jsx(_e,{accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(ie,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(ge,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function He({filters:e,mailboxName:a,labelById:r,onEdit:i,onDelete:c,deletingFilterId:g,semanticUnavailable:d=!1,now:f=Date.now()}){return e.length===0?t.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):t.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:e.map(n=>{const l=Me(n,f),m=l==="Expired",u=n.actionMailboxId!==S?a(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,b=Ie(n.expiresAt);return t.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:()=>i(n.filterId),"aria-label":`Edit filter ${n.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`truncate text-sm font-medium ${m?"text-fg-muted":"text-fg"}`,children:n.name}),t.jsx(ne,{tone:m?"neutral":"positive",dot:!0,children:l})]}),t.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[u?`Moves matches to ${u}`:"No move action",n.scope==="Temporary"&&b?m?` · expired ${b}`:` · until ${b}`:n.scope==="Standing"?" · always":""]}),(n.hasAnchor||h)&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[n.hasAnchor&&t.jsx(re,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(oe,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(le,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Je=t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",t.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",t.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),t.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."})]});function qe({account:e}){const a=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=we(a),{deleteFilter:f,deletingFilterId:n}=Ee(a),[l,m]=x.useState(),{data:u}=P({...ce({path:{accountId:a}}),staleTime:1/0}),h=Ae(),b=x.useMemo(()=>de(e.folderAppointments),[e.folderAppointments]),M=x.useCallback(p=>{const w=u?.items.find(O=>O.mailboxId===p);if(w)return me(w,b.get(p),h)},[u?.items,b,h]),C=x.useMemo(()=>De({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=Le(u?.items??[]),{labels:v}=ke(a),F=x.useMemo(()=>v.map(p=>({id:p.labelId,name:p.name,color:p.color})),[v]),E=x.useMemo(()=>new Map(F.map(p=>[p.id,p])),[F]),I=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),I&&t.jsx(Ge,{accountId:a,filter:I,folders:C,delimiter:j,labels:F,onClose:()=>m(void 0)}),i?t.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${e.email}`}):c?t.jsx(z,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(He,{filters:r,mailboxName:M,labelById:E,onEdit:m,onDelete:f,deletingFilterId:n})]})}function ct(){const e=ue(),[a,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=P(pe()),n=l=>{const m=fe[l];m&&e({to:m})};return t.jsx(he,{items:xe,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Je,helpOpen:a,onToggleHelp:()=>r(l=>!l),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:c?t.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):g?t.jsx(z,{title:"Couldn't load accounts",error:d,onRetry:()=>{f()}}):i.accounts.length===0?t.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):t.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>t.jsx(qe,{account:l},l.accountId))})})}export{qe as AccountFilters,ct as component};
@@ -1 +0,0 @@
1
- import{j as o,$ as i}from"./index-Bf6zeV_t.js";import{a as m}from"./search-view-B25AYYYV.js";import{F as r}from"./FlaggedPane-BldHHUxk.js";import{u as p}from"./useSearchMirror-Co706q8t.js";import"./nav-link-kGZZQ6tj.js";import{e}from"./search-token-index-ufNaSd81.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./MailListHeader-GQfpCdPQ.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./use-match-media-Cqq5eDbi.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./MailViewChrome-Or_Zfnrd.js";function b(){const t=e();return p({to:"/mail/flagged"}),o.jsx(r,{thread:t,children:o.jsx(m,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!t})})}export{b as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-Bf6zeV_t.js";import{O as t}from"./OutboxPane-DuBwgi_W.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./circle-check-big-DAvgIk1F.js";import"./clock-D7o61sW5.js";import"./row-actions-Dq-6Ssz1.js";import"./rotate-ccw-9aRuc9Yf.js";import"./NavMenuButton-B1nVcSa5.js";import"./menu-DNUIh6FR.js";import"./format-De9HZKjg.js";import"./outbox-status-CPfNHfUQ.js";import"./search-query-Cr_ZXBCp.js";function c(){return o.jsx(t.Reading,{})}export{c as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-Bf6zeV_t.js";import{F as r}from"./FlaggedPane-BldHHUxk.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./MailListHeader-GQfpCdPQ.js";import"./search-token-index-ufNaSd81.js";import"./use-match-media-Cqq5eDbi.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./MailViewChrome-Or_Zfnrd.js";function k(){return o.jsx(r.Reading,{})}export{k as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-Bf6zeV_t.js";import{M as i}from"./MailboxPane-CO67RCjZ.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./useRefreshControl-Ba6f6ijf.js";import"./circle-check-big-DAvgIk1F.js";import"./search-token-index-ufNaSd81.js";import"./use-match-media-Cqq5eDbi.js";import"./MailListHeader-GQfpCdPQ.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./MailViewChrome-Or_Zfnrd.js";import"./NavMenuButton-B1nVcSa5.js";import"./useLabels-BMVLGb1c.js";import"./useSemanticSearch-CCTRY7p1.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DSZ-IeLs.js";import"./circle-help-BG86c5CF.js";import"./circle-check-Bd1R3tZl.js";function F(){return o.jsx(i.Reading,{})}export{F as component};
@@ -1 +0,0 @@
1
- import{j as t,a6 as o}from"./index-Bf6zeV_t.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-Bf6zeV_t.js";import{B as o}from"./BriefPane-fii0IiRa.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./MailListHeader-GQfpCdPQ.js";import"./search-token-index-ufNaSd81.js";import"./use-match-media-Cqq5eDbi.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./useRefreshControl-Ba6f6ijf.js";import"./circle-check-big-DAvgIk1F.js";import"./useLabels-BMVLGb1c.js";import"./useSemanticSearch-CCTRY7p1.js";import"./search-query-Cr_ZXBCp.js";function z(){return r.jsx(o.Reading,{})}export{z as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-Bf6zeV_t.js";import{F as r}from"./FlaggedPane-BldHHUxk.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./MailListHeader-GQfpCdPQ.js";import"./search-token-index-ufNaSd81.js";import"./use-match-media-Cqq5eDbi.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./MailViewChrome-Or_Zfnrd.js";function q(){return o.jsx(r.Reading,{})}export{q as component};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-Bf6zeV_t.js";import{B as o}from"./BriefPane-fii0IiRa.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./MailListHeader-GQfpCdPQ.js";import"./search-token-index-ufNaSd81.js";import"./use-match-media-Cqq5eDbi.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./useRefreshControl-Ba6f6ijf.js";import"./circle-check-big-DAvgIk1F.js";import"./useLabels-BMVLGb1c.js";import"./useSemanticSearch-CCTRY7p1.js";import"./search-query-Cr_ZXBCp.js";function y(){return r.jsx(o.Reading,{})}export{y as component};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-Bf6zeV_t.js";import{M as r}from"./MailboxPane-CO67RCjZ.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./nav-link-kGZZQ6tj.js";import"./useRefreshControl-Ba6f6ijf.js";import"./circle-check-big-DAvgIk1F.js";import"./search-token-index-ufNaSd81.js";import"./use-match-media-Cqq5eDbi.js";import"./MailListHeader-GQfpCdPQ.js";import"./account-form-helpers-BZTGbgn5.js";import"./avatar-902Ehcia.js";import"./useSignature-BoeZFYk-.js";import"./useDebouncedValue-fVfFWYH1.js";import"./useFilters-BfhDojrF.js";import"./ErrorState-D3orNRU4.js";import"./format-De9HZKjg.js";import"./download-CtV8eLNc.js";import"./shield-check-CmXHx2Di.js";import"./move-options-BPdblyET.js";import"./confirm-dialog-CMKEZton.js";import"./clock-D7o61sW5.js";import"./menu-DNUIh6FR.js";import"./MailViewChrome-Or_Zfnrd.js";import"./NavMenuButton-B1nVcSa5.js";import"./useLabels-BMVLGb1c.js";import"./useSemanticSearch-CCTRY7p1.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DSZ-IeLs.js";import"./circle-help-BG86c5CF.js";import"./circle-check-Bd1R3tZl.js";function D(){return o.jsx(r.Reading,{})}export{D as component};
@@ -1 +0,0 @@
1
- import{c as T,r as l,u as Be,j as e,S as Ke,a as pe,b as w,C as te,d as se,e as Ve,f as ge,F as Qe,g as qe,X as be,T as He,O as $e,M as We,A as Ue,h as Ye,I as Ge,i as ve,B as K,k as Y,l as ye,m as Je,n as Xe,o as je,p as G,q as Se,s as Ne,t as Ze,v as J,w as X,x as Ce,y as et,z as tt,D as st,E as W,G as at,H as nt,J as rt,K as ot,L as it,N as lt,P as ct,Q as ut,R as dt,U as mt,V as xt,W as ht,Y as ft,Z as pt,_ as gt,$ as bt}from"./index-Bf6zeV_t.js";import{B as vt,S as yt,D as jt,a as St,b as Nt,u as Ct,s as kt,K as wt,c as It,d as Mt,e as Ot,f as Et,g as Rt,h as Pt,i as At}from"./search-token-index-ufNaSd81.js";import{N as L,u as Lt,a as zt,i as Tt,b as ae}from"./nav-link-kGZZQ6tj.js";import{P as Ft}from"./pencil-j8v7X9GK.js";import{M as Dt,s as _t,c as Bt}from"./search-view-B25AYYYV.js";import{u as Kt,a as Vt,R as Qt,M as qt}from"./useRefreshControl-Ba6f6ijf.js";import{M as Ht}from"./menu-DNUIh6FR.js";import{B as ke}from"./bug-BPy3lhCs.js";import{A as $t}from"./avatar-902Ehcia.js";import{i as Wt}from"./outbox-status-CPfNHfUQ.js";import{E as Ut}from"./ErrorState-D3orNRU4.js";import{K as ne}from"./kbd-C4MYDwt7.js";import{u as Yt}from"./useDebouncedValue-fVfFWYH1.js";import"./use-match-media-Cqq5eDbi.js";import"./circle-check-big-DAvgIk1F.js";const Gt=T("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const Jt=T("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const we=T("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const Ie=T("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Xt=T("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),Zt="button:not([disabled]), a[href]",P="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function es({active:t,dimmed:s,indent:a}){return w("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",P,a&&"pl-7",t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",s&&"opacity-55")}function ts({icon:t,label:s,count:a,active:n}){return e.jsxs(e.Fragment,{children:[t&&e.jsx("span",{className:w("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:t}),e.jsx("span",{className:"flex-1 truncate",children:s}),a!=null&&a>0&&e.jsx("span",{className:w("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function z({icon:t,label:s,count:a,active:n,dimmed:r,indent:o,navId:i,linkComponent:d,ariaLabel:x,title:p,onClick:g}){const m=es({active:n,dimmed:r,indent:o}),h=e.jsx(ts,{icon:t,label:s,count:a,active:n});return i&&d?d({navId:i,className:m,ariaLabel:x??s,title:p,onClick:g,children:h}):e.jsx("button",{type:"button",onClick:g,className:m,"aria-label":x,title:p,children:h})}const re={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function ss(t){switch(t){case"inbox":return e.jsx(Ge,{className:"size-4"});case"flagged":return e.jsx(pe,{className:"size-4"});case"drafts":return e.jsx(Ye,{className:"size-4"});case"sent":return e.jsx(ge,{className:"size-4"});case"archive":return e.jsx(Ue,{className:"size-4"});case"all":return e.jsx(We,{className:"size-4"});case"junk":return e.jsx($e,{className:"size-4"});case"trash":return e.jsx(He,{className:"size-4"})}}const oe=t=>t.role!=null,$=8,ie="remit.nav.folders.open.",le="remit.nav.account.open.";function ce(t,s,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(t+s);return n===null?a:n!=="0"}function ue(t,s,a){typeof localStorage>"u"||localStorage.setItem(t+s,a?"1":"0")}function as({query:t,onSelect:s,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:s,className:w("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",P),children:[e.jsx(qe,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${t}`,className:w("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",P),children:e.jsx(be,{className:"size-3.5"})})]})}function ns({savedSearches:t,saveableQuery:s,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:r}){return t.length===0&&!s?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),s&&e.jsxs("button",{type:"button",onClick:r,className:w("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",P),children:[e.jsx(Gt,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",s,"”"]})]}),t.map(o=>e.jsx(as,{query:o,onSelect:()=>a?.(o),onRemove:n?()=>n(o):void 0},o))]})}function rs({account:t,selectedNavId:s,onSelectNav:a,linkComponent:n}){const[r,o]=l.useState(()=>ce(le,t.id,!0)),[i,d]=l.useState(()=>ce(ie,t.id,!0)),[x,p]=l.useState(!1),g=()=>{o(c=>{const S=!c;return ue(le,t.id,S),S})},m=()=>{d(c=>{const S=!c;return ue(ie,t.id,S),S})},h=t.mailboxes.filter(oe).sort((c,S)=>re[c.role]-re[S.role]),f=t.mailboxes.filter(c=>!oe(c)),b=x||f.length<=$?f:f.slice(0,$),v=f.length-b.length,y=t.status??"ready",E=y==="ready"&&h.length===0&&f.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:g,"aria-expanded":r,className:w("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",P,t.muted&&"opacity-55"),children:[r?e.jsx(te,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(se,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),t.muted&&e.jsxs(e.Fragment,{children:[e.jsx(vt,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),r&&e.jsxs(e.Fragment,{children:[y==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),y==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(Ve,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),t.onRetry&&e.jsx("button",{type:"button",onClick:t.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),E&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),y==="ready"&&e.jsxs(e.Fragment,{children:[h.map(c=>e.jsx(z,{navId:c.id,linkComponent:n,icon:ss(c.role),label:c.name,ariaLabel:c.name,title:c.fullPath??c.name,count:c.unseen,active:s===c.id,dimmed:t.muted,onClick:()=>a?.(c.id)},c.id)),t.outboxPending!==void 0&&e.jsx(z,{navId:"outbox",linkComponent:n,icon:e.jsx(ge,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:t.outboxPending>0?t.outboxPending:void 0,active:s==="outbox",dimmed:t.muted,onClick:()=>a?.("outbox")}),f.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:m,"aria-expanded":i,className:w("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",P),children:[i?e.jsx(te,{className:"size-3 shrink-0"}):e.jsx(se,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:f.length})]}),i&&e.jsxs(e.Fragment,{children:[b.map(c=>e.jsx(z,{navId:c.id,linkComponent:n,icon:e.jsx(Qe,{className:"size-4"}),label:c.name,ariaLabel:c.name,title:c.fullPath??c.name,count:c.unseen,active:s===c.id,dimmed:t.muted,onClick:()=>a?.(c.id)},c.id)),(v>0||x)&&f.length>$&&e.jsx("button",{type:"button",onClick:()=>p(c=>!c),className:w("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",P),children:x?"Show less":`Show all (${f.length})`})]})]})]})]})]})}function os({accounts:t,selectedNavId:s,briefUnseen:a,onSelectNav:n,variant:r="desktop",linkComponent:o,calendarNav:i="hidden",savedSearches:d=[],saveableQuery:x,onSelectSavedSearch:p,onRemoveSavedSearch:g,onSaveCurrentSearch:m}){const h=l.useRef(null);Be({containerRef:h,itemSelector:Zt});const f=r==="drawer",b=e.jsxs("nav",{ref:f?h:void 0,className:f?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(z,{navId:"brief",linkComponent:o,icon:e.jsx(Ke,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:s==="brief",onClick:()=>n?.("brief")}),i==="shown"&&e.jsx(z,{navId:"calendar",linkComponent:o,icon:e.jsx(Jt,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:s==="calendar",onClick:()=>n?.("calendar")}),e.jsx(z,{navId:"flagged",linkComponent:o,icon:e.jsx(pe,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:s==="flagged",onClick:()=>n?.("flagged")}),e.jsx(ns,{savedSearches:d,saveableQuery:x,onSelectSavedSearch:p,onRemoveSavedSearch:g,onSaveCurrentSearch:m}),t.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):t.map(v=>e.jsx(rs,{account:v,selectedNavId:s,onSelectNav:n,linkComponent:o},v.id))]});return f?b:e.jsx("aside",{ref:h,className:"flex h-full w-full flex-col bg-surface-sunken",children:b})}function is({leading:t,search:s,actions:a,className:n}){return e.jsxs("header",{className:w("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",n),children:[t&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t}),e.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:e.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),a&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a})]})}function ls(){const t=ve();if(!t)return null;const s=t.showNavPane?!t.navCollapsed:!1;return e.jsx(K,{variant:"ghost",size:"sm",icon:e.jsx(Ht,{className:"size-4"}),onClick:t.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const cs={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function us({search:t,onCompose:s,onReportBug:a,onOpenSettings:n,composeShortcut:r,refreshControl:o,account:i}){return e.jsx(is,{leading:e.jsx(ls,{}),search:e.jsx(yt,{value:t.value,onChange:t.onChange,onClear:t.onClear,onClearQuery:t.onClearQuery,chips:t.chips,onRemoveChip:t.onRemoveChip,placeholder:cs[t.scope]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(K,{variant:"ghost",size:"sm",icon:e.jsx(Xt,{className:"size-4"}),title:r?`Compose (${r})`:"Compose","aria-label":"Compose",onClick:s}),e.jsx(K,{variant:"ghost",size:"sm",icon:e.jsx(ke,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:a}),e.jsx(K,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:n}),o,i]})})}const ds=()=>{const{state:t,openCompose:s}=Y(),a=ye(),n=l.useCallback(()=>{s({mode:"new"})},[s]),r=Je(a.pathname);return!a.pathname.startsWith("/mail")||t.isOpen||r?null:e.jsx("button",{type:"button",onClick:n,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:e.jsx(Ft,{className:"size-6"})})},Me=({children:t})=>{const{Account:s}=Xe();return e.jsx(s,{children:t})},ms=({email:t,onSignOut:s})=>{const a=t??"Account";return e.jsxs(jt,{trigger:e.jsx($t,{name:a,email:t??void 0,size:"sm"}),align:"right",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-2 text-xs text-fg-muted truncate",title:t,"data-testid":"account-menu-email",children:t}),e.jsx(St,{})]}),e.jsxs(Nt,{onClick:s,children:[e.jsx(we,{className:"size-4"}),"Sign out"]})]})},xs=()=>e.jsx(Me,{children:({email:t,signOut:s})=>e.jsx(ms,{email:t,onSignOut:s})});function hs({accounts:t}){const{searchInput:s,onSearchChange:a,onSearchClear:n,onSearchClearQuery:r}=je(),o=G(),{openCompose:i}=Y(),d=l.useCallback(()=>{i({mode:"new"})},[i]),{scope:x,clearScope:p}=Ct(t),g=x.kind==="scoped"?[{id:x.chip.id,label:x.chip.label,tone:"scope"}]:void 0,m=l.useMemo(()=>t.map(y=>y.accountId),[t]),{hasNewMail:h}=Kt(),{state:f,errorMessage:b,refresh:v}=Vt(m);return e.jsx(us,{search:{value:s,scope:x.kind,chips:g,onChange:a,onClear:n,onClearQuery:r,onRemoveChip:p},onCompose:d,onReportBug:Se,onOpenSettings:()=>o({to:"/settings/accounts"}),composeShortcut:kt("compose"),refreshControl:e.jsx(Qt,{state:f,onRefresh:v,label:"Refresh all accounts",errorMessage:b,hasUpdate:h(m)}),account:e.jsx(xs,{})})}const Z="remit.savedSearches",fs=25;function Q(){try{const t=localStorage.getItem(Z);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(a=>typeof a=="string"):[]}catch{return[]}}function ps(t){const s=t.trim();if(!s)return Q();const a=[s,...Q().filter(n=>n!==s)].slice(0,fs);try{localStorage.setItem(Z,JSON.stringify(a))}catch{return a}return a}function gs(t){const s=Q().filter(a=>a!==t);try{localStorage.setItem(Z,JSON.stringify(s))}catch{return s}return s}const de=t=>/^\d/.test(t),bs=(t,s)=>{const a=de(t),n=de(s);return a&&!n?-1:!a&&n?1:t.localeCompare(s,void 0,{sensitivity:"base",numeric:!0})};function vs(t,s,a){const n=[],r=[];for(const o of t)s.has(o.mailboxId)?n.push(o):r.push(o);return r.sort((o,i)=>bs(W(o,void 0,a),W(i,void 0,a))),{system:n,labels:r}}function ys(t,s,a){const n=at(s)&&t.unseenCount>0;return{id:t.mailboxId,name:W(t,s,a),unseen:n?t.unseenCount:void 0,role:s,fullPath:t.fullPath}}function js(){const t=ye(),s=st({strict:!1});return t.pathname.startsWith("/settings")?"settings":t.pathname.startsWith("/mail/outbox")?"outbox":t.pathname.startsWith("/mail/flagged")?"flagged":t.pathname.startsWith("/mail/brief")?"brief":s.mailboxId?s.mailboxId:""}function me({accounts:t,onMailboxSelect:s,variant:a="desktop"}){const n=Ne(),r=G(),o=js(),{searchInput:i,onSearchChange:d}=je(),[x,p]=l.useState(Q),{t:g}=Ze("mail",{useSuspense:!1}),m=l.useCallback((u,C)=>g(u,{defaultValue:C}),[g]),h=J({queries:t.map(u=>({...X({path:{accountId:u.accountId}}),staleTime:1/0}))}),{data:f}=Ce(et()),b=l.useMemo(()=>(f?.items??[]).filter(u=>Wt(u.status)).length,[f?.items]),v=l.useMemo(()=>t.map((u,C)=>{const N=h[C],O=N?.data?.items??[],I=tt(u.folderAppointments),{system:k,labels:D}=vs(O,I,m),H=N?.isError?"error":N?.isLoading?"loading":"ready";return{id:u.accountId,label:u.email,email:u.email,muted:!!u.muted,outboxPending:b,status:H,onRetry:()=>N?.refetch(),mailboxes:[...k,...D].map(_=>ys(_,I.get(_.mailboxId),m))}}),[t,h,b,m]),y=u=>{n.invalidateQueries({queryKey:nt({path:{mailboxId:u},query:{order:"desc"}})})},E=({navId:u,className:C,ariaLabel:N,title:O,children:I,onClick:k})=>u==="brief"?e.jsx(L,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>k?.(),className:C,"aria-label":N,title:O,children:I}):u==="outbox"?e.jsx(L,{to:"/mail/outbox",search:{q:void 0},onClick:()=>k?.(),className:C,"aria-label":N,title:O,children:I}):u==="flagged"?e.jsx(L,{to:"/mail/flagged",search:{q:void 0},onClick:()=>k?.(),className:C,"aria-label":N,title:O,children:I}):u==="settings"?e.jsx(L,{to:"/settings/accounts",onClick:()=>k?.(),className:C,"aria-label":N,title:O,children:I}):e.jsx(L,{to:"/mail/$mailboxId",params:{mailboxId:u},search:{q:void 0},onClick:()=>{y(u),k?.()},className:C,"aria-label":N,title:O,children:I}),c=()=>{d(""),s?.()},S=i.trim(),A=S.length>0&&!x.includes(S)?S:void 0,R=l.useCallback(()=>{A&&p(ps(A))},[A]),F=l.useCallback(u=>{p(gs(u))},[]),q=l.useCallback(u=>{d(u),r({to:"/mail/brief",search:{q:u}}),s?.()},[d,r,s]);return e.jsx(os,{accounts:v,selectedNavId:o,onSelectNav:c,linkComponent:E,variant:a,savedSearches:x,saveableQuery:A,onSaveCurrentSearch:R,onSelectSavedSearch:q,onRemoveSavedSearch:F})}function Ss(){return e.jsxs("button",{type:"button",onClick:Se,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function Ns({accounts:t,onMailboxSelect:s}){return ve()?.showNavPane??!0?e.jsx(me,{accounts:t}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(me,{accounts:t,onMailboxSelect:s,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(L,{to:"/settings/accounts",onClick:s,children:[e.jsx(Ie,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(Ss,{}),e.jsx(Me,{children:({signOut:r})=>e.jsxs("button",{type:"button",onClick:()=>{s?.(),r()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(we,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}const Cs=({isOpen:t,onClose:s})=>{const a=l.useCallback(n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),s())},[s]);return l.useEffect(()=>{if(t)return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[t,a]),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx(rt,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:w("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),e.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:e.jsx(be,{className:"size-5"})})]}),e.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:wt.map(n=>e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:n.title}),e.jsx("div",{className:"space-y-2",children:n.hints.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm",children:r.description}),e.jsx("span",{className:"flex shrink-0 items-center gap-1",children:r.keys.map((o,i)=>e.jsxs(l.Fragment,{children:[i>0&&r.keys[0]==="g"&&e.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),e.jsx(ne,{children:o})]},o))})]},`${r.action}-${r.keys.join("+")}`))})]},n.title))}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",e.jsx(ne,{children:"Esc"})," to close"]})})]})]}):null};function ks(t){const s=J({queries:t.map(a=>({...X({path:{accountId:a.accountId}}),staleTime:1/0}))});return l.useMemo(()=>It(s.map(a=>a.data?.items??[])),[s])}const ws=t=>t.map(s=>s.data?.items??[]);function Is(t){const s=J({queries:t.map(a=>({...X({path:{accountId:a.accountId}}),staleTime:1/0})),combine:ws});return l.useMemo(()=>ot(t.map((a,n)=>({folderAppointments:a.folderAppointments,mailboxes:s[n]??[]}))),[t,s])}var B={exports:{}},xe;function Ms(){if(xe)return B.exports;xe=1;const t=(s,a,n)=>new Promise((r,o)=>{if(n=Object.assign({concurrency:1/0},n),typeof a!="function")throw new TypeError("Mapper function is required");const{concurrency:i}=n;if(!(typeof i=="number"&&i>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${i}\` (${typeof i})`);const d=[],x=s[Symbol.iterator]();let p=!1,g=!1,m=0,h=0;const f=()=>{if(p)return;const b=x.next(),v=h;if(h++,b.done){g=!0,m===0&&r(d);return}m++,Promise.resolve(b.value).then(y=>a(y,v)).then(y=>{d[v]=y,m--,f()},y=>{p=!0,o(y)})};for(let b=0;b<i&&(f(),!g);b++);});return B.exports=t,B.exports.default=t,B.exports}var Os=Ms();const Es=it(Os),Rs=900*1e3,Ps=300,As=(t,s)=>{if(!t)return s;const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:s},Ls=60*1e3,zs=t=>Math.max(As(t,Ps)*1e3,Ls),V=zs(mt().mailboxPollIntervalSeconds),Ts=5,U=new Set,Fs=(t,s,a=Rs)=>t.filter(n=>{const r=n.lastSyncAt;return r==null?!0:s-r>a}).map(n=>n.accountId),Ds=(t,s,a=V)=>t-s>=a,_s=(t,s)=>t.filter(a=>!s.has(a)),he=(t,s)=>{if(U.delete(t),ut(s,{softError:!0})){dt(s);return}console.warn("[remit] background mailbox sync failed",{accountId:t,error:s})},fe=(t,s)=>lt({path:{accountId:t},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:ct({path:{accountId:t}})})}),Bs=t=>{const s=Ne(),a=l.useRef(t);a.current=t;const n=t.map(r=>r.accountId).join(",");l.useEffect(()=>{const r=Date.now(),i=Fs(a.current,r).filter(d=>!U.has(d));if(i.length!==0)for(const d of i)U.add(d),fe(d,s).catch(x=>{he(d,x)})},[n,s]),l.useEffect(()=>{let r=Date.now(),o;const i=new Set,d=()=>{r=Date.now();const g=_s(a.current.map(m=>m.accountId),i);for(const m of g)i.add(m);Es(g,m=>fe(m,s).catch(h=>{he(m,h)}).finally(()=>{i.delete(m)}),{concurrency:Ts})},x=()=>{if(document.visibilityState==="visible"){d(),o=setTimeout(x,V);return}},p=()=>{document.visibilityState==="visible"&&Ds(Date.now(),r)&&(o!==void 0&&clearTimeout(o),d(),o=setTimeout(x,V))};return o=setTimeout(x,V),document.addEventListener("visibilitychange",p),()=>{o!==void 0&&clearTimeout(o),document.removeEventListener("visibilitychange",p)}},[n,s])},Oe="remit:intelligence-open";function Ks(){try{return localStorage.getItem(Oe)!=="closed"}catch{return!0}}function Vs(t){try{localStorage.setItem(Oe,t?"open":"closed")}catch{}}function Qs({panels:t,prefersOpen:s,isDesktop:a,hasThread:n}){return t.length>0?t.includes("intelligence"):a&&n&&s}function ra(){const{q:t=""}=xt({from:"/mail"}),s=G(),a=Mt(),n=At(a),r=Lt(),o=zt(),i=r.find(Tt),d=i==="shortcuts",x=i==="nav",p=Ot(),[g,m]=l.useState(Ks),h=Qs({panels:r,prefersOpen:g,isDesktop:a==="desktop",hasThread:p!==void 0}),f=l.useCallback((j,ee)=>{o([...j?["intelligence"]:[],...ee?[ee]:[]])},[o]),b=l.useCallback(j=>{Vs(j),m(j),f(j,i)},[i,f]),v=l.useCallback(j=>{f(h,j)},[h,f]),[y,E]=l.useState(t),c=Yt(y,200),S=Bt(y,c),A=ae({select:j=>j.location.pathname}),R=ae({select:j=>ht(j.matches)}),[F,q]=l.useState(R);if(F!==R){const j=_t(F,R,t);q(R),j!==void 0&&E(j)}const{data:u,isLoading:C,isError:N,error:O,refetch:I}=Ce({...ft(),staleTime:1/0}),k=!!(u&&(u.accounts?.length??0)===0);l.useEffect(()=>{k&&s({to:"/onboarding",replace:!0})},[k,s]),Et({enabled:!d,bindings:[{key:"?",handler:()=>v("shortcuts"),noModifiers:!1,preventDefault:!0}]});const{openCompose:D}=Y(),H=l.useMemo(()=>({compose:()=>D({mode:"new"})}),[D]);Rt({enabled:!pt(A),handlers:H});const _=l.useCallback(j=>{E(j)},[]),Ee=l.useCallback(()=>{E("")},[]),Re=l.useCallback(()=>{E("")},[]),Pe=l.useCallback(()=>{b(!h)},[b,h]),M=u?.accounts??[],Ae=l.useMemo(()=>M.map(j=>j.accountId),[M]),Le=ks(M),ze=Is(M),Te=l.useMemo(()=>Pt(M),[M]);Bs(M);const Fe=l.useCallback(()=>{i==="nav"&&v(void 0)},[i,v]),De={accounts:M,mailboxNameIndex:Le,accountNameIndex:Te,resultFolderIndex:ze,searchQuery:S,searchInput:y,searchViewKey:R,onSearchChange:_,onSearchClear:Ee,onSearchClearQuery:Re,intelligenceOpen:h,onToggleIntelligence:Pe},_e={isSinglePane:n,isLoading:C||k,intelligenceOpen:h,nav:e.jsx(Ns,{accounts:M,onMailboxSelect:Fe}),topBar:n?void 0:e.jsx(hs,{accounts:M}),overlay:n?e.jsx(ds,{}):void 0,navOpen:x,onOpenNav:()=>v("nav"),onCloseNav:()=>v(void 0)};return e.jsx(gt.Provider,{value:De,children:e.jsxs(qt,{accountIds:Ae,children:[N?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(Ut,{title:"Couldn't load your account",error:O,onRetry:()=>{I()}})}):e.jsx(Dt,{chrome:_e,children:e.jsx(bt,{})}),e.jsx(Cs,{isOpen:d,onClose:()=>v(void 0)})]})})}export{ra as component,je as useMailContext};
@@ -1 +0,0 @@
1
- import{c8 as u,cV as l,cW as f,cX as s,cY as d,l as p,r as c,p as h,j as b,cZ as m,c_ as x}from"./index-Bf6zeV_t.js";function O(e){const t=u({warn:e?.router===void 0}),n=e?.router||t;return l(n.stores.__store,f(e,n))}const r="search-scope";function S(e){const t=e.trim().replace(/\s+/g," ").toLowerCase();return/\s/.test(t)?`in:"${t}"`:`in:${t}`}function k(e){const t=s(e);return t!==void 0&&t.list!=="brief"}function v(e){const t=s(e);return t?.list==="mailbox"?t.mailboxId:void 0}function _(e){const t=v(e.matches);return t||(k(e.matches)?e.callerMailboxId:e.callerMailboxId??e.inTokenMailboxId)}function C(e,t){const n=s(e);return n?.list==="flagged"?{kind:"scoped",chip:{id:r,label:"is:starred"}}:n?.list==="outbox"?{kind:"scoped",chip:{id:r,label:"in:outbox"}}:n?.list==="mailbox"?t?{kind:"scoped",chip:{id:r,label:S(t)}}:{kind:"pending"}:{kind:"global"}}function F(e,t,n){return t.kind==="global"?{kind:"global"}:s(e)?.list==="flagged"?{kind:"collection"}:{kind:"folder",...n?{role:n}:{}}}const o=["intelligence","nav","shortcuts"],g=["nav","shortcuts"],R=e=>g.includes(e),P=d(o);function a(e){const t=new Set(e.split(",").map(n=>P.safeParse(n)).filter(n=>n.success).map(n=>n.data));return o.filter(n=>t.has(n))}function i(e){return o.filter(t=>e.includes(t)).join(",")}function N(){const e=p({select:t=>i(a(t.hash))});return c.useMemo(()=>a(e),[e])}function I(e=""){return i(a(e).filter(t=>!R(t)))}function j(){const e=h();return c.useCallback(t=>{e({search:!0,hash:i(t),replace:!0,hashScrollIntoView:!1})},[e])}const L=m(x);function w({fragment:e,...t}){return b.jsx(L,{...t,hash:e??I})}export{w as N,r as S,j as a,O as b,v as c,F as d,C as e,k as f,R as i,I as r,_ as s,N as u};
@@ -1 +0,0 @@
1
- import{D as s,j as o,$ as i}from"./index-Bf6zeV_t.js";import{a as m}from"./search-view-B25AYYYV.js";import{O as t}from"./OutboxPane-DuBwgi_W.js";import{u as a}from"./useSearchMirror-Co706q8t.js";import"./nav-link-kGZZQ6tj.js";import"./useSearchTokenContext-BRWpWSX8.js";import"./kbd-C4MYDwt7.js";import"./enums-CCxx0t2v.js";import"./circle-check-big-DAvgIk1F.js";import"./clock-D7o61sW5.js";import"./row-actions-Dq-6Ssz1.js";import"./rotate-ccw-9aRuc9Yf.js";import"./NavMenuButton-B1nVcSa5.js";import"./menu-DNUIh6FR.js";import"./format-De9HZKjg.js";import"./outbox-status-CPfNHfUQ.js";import"./search-query-Cr_ZXBCp.js";function e(){return s({from:"/mail/outbox/draft/$outboxMessageId",shouldThrow:!1})?.outboxMessageId}function L(){const r=e();return a({to:"/mail/outbox"}),o.jsx(t,{outboxMessageId:r,children:o.jsx(m,{phone:o.jsx(t.Phone,{}),list:o.jsx(t.List,{}),reading:o.jsx(i,{})})})}export{L as component};
@@ -1 +0,0 @@
1
- import{c as A,r as l,j as m,g as U,b as k,cL as Q,X as V,D as b,l as z,t as G,v as j,w as F,z as X,E as W,p as J,o as Y,cn as L}from"./index-Bf6zeV_t.js";import{b as Z,e as ee,S as te}from"./nav-link-kGZZQ6tj.js";import{u as R,D as ne}from"./use-match-media-Cqq5eDbi.js";const Ie=A("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 ve=A("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"}]]),oe=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ee(e){return oe.filter(t=>e[t.action]!==void 0)}const re=[{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 se(e){for(const t of re){const n=t.hints.find(r=>r.action===e);if(n)return n.keys}}function ae(e){const t=se(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Te(e){const t=ae(e);return t===""?"":`(${t})`}const w={action:null,nextPrefix:null,preventDefault:!1},ie={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},ce={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 le(e,t){const n=e.key.toLowerCase(),r=e.metaKey||e.ctrlKey;if(e.inEditable)return{...w,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...w,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{...w,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const a=ie[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=ce[n];if(o){const s=o.requireShift===!0,a=n.length===1&&!/[a-z0-9]/.test(n);return!s&&e.shiftKey&&!a?w:{action:o.action,nextPrefix:null,preventDefault:!0}}return w}function ue(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const fe="data-message-row",de='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function pe(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(de);return t?!t.hasAttribute(fe):!1}function me({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 he({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 ge(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const ye=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,be=({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 O=l.useId(),N=p??O,S=l.useRef(null),P=l.useRef([]),D=s??o,[M,C]=l.useState(null),v=l.useRef(void 0),[q,B]=l.useState(""),E=e.length>0;l.useEffect(()=>{C(i=>i!==null&&i>=e.length?null:i)},[e.length]),l.useEffect(()=>{const i=v.current;if(i!==void 0){if(v.current=void 0,i===null){S.current?.focus();return}P.current[i]?.focus()}});const K=l.useRef(void 0);l.useEffect(()=>{const i=d?.caret;if(!i||i===K.current)return;K.current=i;const u=S.current;!u||u.ownerDocument.activeElement!==u||(u.setSelectionRange(i.cursor,i.cursor),d?.onCaretChange(i.cursor))});const I=i=>{d?.onCaretChange(i.selectionStart??i.value.length)},g=l.useCallback(i=>{C(i),v.current=i},[]),T=l.useCallback(i=>{const u=e[i];u&&t&&(g(ge(i,e.length)),B(`${u.label} removed`),t(u.id))},[e,t,g]),$=l.useCallback(()=>{g(null),o()},[o,g]),H=l.useCallback(i=>{const u=i.currentTarget;if(d?.onKeyDown(i))return;const y=me({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":D();return;case"blur":u.blur();return;case"none":return}},[e.length,n,D,g,d]),_=l.useCallback(i=>u=>{const y=he({key:u.key,repeat:u.repeat,index:i,chipCount:e.length});switch(y.type!=="none"&&u.preventDefault(),y.type){case"removeChip":T(y.index);return;case"focusChip":g(y.index);return;case"focusInput":g(null);return;case"activateChip":return;case"none":return}},[e,T,g]);return l.useEffect(()=>{if(!c)return;const i=u=>{u.key!=="/"||u.metaKey||u.ctrlKey||u.altKey||ye(u.target)||(u.preventDefault(),S.current?.focus())};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[c]),m.jsxs("label",{htmlFor:N,className:k("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(U,{className:k("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:[E&&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(Q,{ref:y=>{P.current[u]=y},label:i.label,tone:i.tone,focused:M===u,onFocusLabel:()=>C(u),onKeyDown:_(u),onRemove:()=>T(u)},i.id))}),m.jsx("input",{ref:S,id:N,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:M===null?0:-1,onChange:i=>{r(i.target.value),I(i.target)},onKeyDown:H,onKeyUp:i=>I(i.currentTarget),onClick:i=>I(i.currentTarget),onFocus:i=>{C(null),d?.onFocusChange?.(!0),I(i.currentTarget)},onBlur:()=>d?.onFocusChange?.(!1),...d?.comboboxProps,placeholder:E?void 0:a,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||E)&&f&&m.jsx("button",{type:"button",onClick:$,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:m.jsx(V,{className:k("text-fg-muted",h==="lg"?"size-5":"size-4")})}),m.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:q})]})},Ne=({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(be,{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 Pe({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=le({key:p.key,shiftKey:p.shiftKey,metaKey:p.metaKey,ctrlKey:p.ctrlKey,altKey:p.altKey,inEditable:ue(p.target),onControl:pe(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 De=({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:k("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:k("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})]})},Me=({onClick:e,disabled:t,destructive:n,children:r})=>m.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:k("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}),Ke=()=>m.jsx("div",{className:"my-1 h-px bg-line"}),xe=({accounts:e})=>{const t=b({strict:!1}),n=z(),r=t.mailboxId,{t:o}=G("mail",{useSuspense:!1}),s=l.useCallback((c,f)=>o(c,{defaultValue:f}),[o]),a=j({queries:e.map(c=>({...F({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=X(e[c].folderAppointments);return W(h,p.get(r),s)}return null},Le=({accounts:e})=>{const n=b({strict:!1}).mailboxId,r=j({queries:e.map(o=>({...F({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 Re(e){const t=J(),{searchInput:n}=Y(),r=xe({accounts:e}),o=Z({select:c=>c.matches}),s=ee(o,r),a=l.useCallback(c=>{c===te&&t({to:"/mail/brief",search:{q:n||void 0}})},[t,n]);return{scope:s,clearScope:a}}function Ae(){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 je=({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])},ke=768,Fe=e=>e!=="desktop",Oe=()=>{const e=R(`(min-width: ${ke}px)`);return R(ne)?"desktop":e?"tablet":"phone"};function qe(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 $e(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 He(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{Ie as B,De as D,re as K,ve as R,Ne as S,Ke as a,Me as b,Be as c,Oe as d,Ae as e,je as f,Pe as g,qe as h,Fe as i,xe as j,Le as k,oe as l,Ee as m,fe as n,$e as o,He as p,ae as s,Te as t,Re as u};
@@ -1 +0,0 @@
1
- import{j as t,$ as o}from"./index-Bf6zeV_t.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -1 +0,0 @@
1
- import{r as i}from"./index-Bf6zeV_t.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 +0,0 @@
1
- import{r as m,ae as b,cM as E,x as M,cN as D,cz as x,cO as P,s as C,cP as F,cQ as N,cR as z,cS as L}from"./index-Bf6zeV_t.js";import{u as T,D as w}from"./use-match-media-Cqq5eDbi.js";const Y=()=>T(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=M({...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"],Q=e=>{const t=e.trim(),r=t.match(/<([^>]+)>/);return(r?r[1]:t).trim().toLowerCase()},ae=(e,t)=>e==="ListId"?Q(t):t.trim(),U=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:U(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=M({...z({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=C(),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=C(),r=b({...L(),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};