@remit/web-client-dist 0.0.323 → 0.0.325
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/BriefPane-BX0Ts8eK.js +1 -0
- package/assets/{ErrorState-DZM_kyxb.js → ErrorState-BczXHsEF.js} +1 -1
- package/assets/FlaggedPane-Dt_iIYmt.js +1 -0
- package/assets/MailListHeader-BdAHPksi.js +52 -0
- package/assets/{MailViewChrome-ClVgpPFO.js → MailViewChrome-fy62FAjL.js} +1 -1
- package/assets/MailboxPane-U7vV6ftH.js +1 -0
- package/assets/{NavMenuButton-D-esVAha.js → NavMenuButton-BPba0-Bs.js} +1 -1
- package/assets/OnboardingWizard-B8Q-LYx6.js +1 -0
- package/assets/{OutboxPane-HUY9JhOn.js → OutboxPane-7b3N6IIo.js} +1 -1
- package/assets/_mailboxId-Be32_Fkl.js +1 -0
- package/assets/_messageId-CMKPHNSP.js +1 -0
- package/assets/_messageId-Co6i3yAO.js +1 -0
- package/assets/_outboxMessageId-DJdiizxk.js +1 -0
- package/assets/_threadId-DDJseBJS.js +1 -0
- package/assets/_threadId-qAapyx6s.js +1 -0
- package/assets/{account-form-helpers-Bsx48lx1.js → account-form-helpers-Dy_qYZBf.js} +1 -1
- package/assets/accounts-CHlRsNpU.js +1 -0
- package/assets/{advanced-BuaLHou0.js → advanced-BAXLq_6J.js} +1 -1
- package/assets/{appearance-BQ0Dg1ei.js → appearance-BVBH78Qj.js} +1 -1
- package/assets/{avatar-DdSaEl5o.js → avatar-Cmct93tu.js} +1 -1
- package/assets/{bottom-sheet-DmAG_FCk.js → bottom-sheet-Div7q8za.js} +1 -1
- package/assets/brief-NFFuYb2Y.js +1 -0
- package/assets/{brief-D_aKiQy5.js → brief-ztU-V5Jr.js} +1 -1
- package/assets/{browser-ponyfill-DZK7BleO.js → browser-ponyfill-CltT4veR.js} +2 -2
- package/assets/{circle-check-DZneB6gk.js → circle-check-CqOKm1jQ.js} +1 -1
- package/assets/{circle-check-big-DT6yugdt.js → circle-check-big-C1QO6sWU.js} +1 -1
- package/assets/{circle-help-BJ-e95sd.js → circle-help-DtLG-dD-.js} +1 -1
- package/assets/{clock-CQOmlok1.js → clock-C_nmZOAr.js} +1 -1
- package/assets/{confirm-dialog-DKl9zp18.js → confirm-dialog-D_L2OQTt.js} +1 -1
- package/assets/{download-LYnnm2y0.js → download-CUYIOGeY.js} +1 -1
- package/assets/{filters-Df3eZiR5.js → filters-CihDvHy0.js} +1 -1
- package/assets/flagged-D2-nECko.js +1 -0
- package/assets/{flagged-Czys2fpG.js → flagged-DJtQwJRJ.js} +1 -1
- package/assets/folders-CuQtFJNd.js +1 -0
- package/assets/index-BZNymLz7.js +1 -0
- package/assets/index-CB14yMy_.js +1 -0
- package/assets/index-Co6i3yAO.js +1 -0
- package/assets/{index-CNoNYU4b.js → index-ComwGxPk.js} +65 -65
- package/assets/index-DHWRCxPH.js +1 -0
- package/assets/index-Dd9u_oFv.js +1 -0
- package/assets/index-EJnMy0RH.js +1 -0
- package/assets/index-UDuEAHny.js +1 -0
- package/assets/{index-B9v7X7iy.css → index-rGtSoq8U.css} +1 -1
- package/assets/{kbd-BrhLdlau.js → kbd-BRJLjcIX.js} +1 -1
- package/assets/{labels-CaG9l1EM.js → labels-D8TMS0RV.js} +1 -1
- package/assets/mail-1ta1TRDs.js +1 -0
- package/assets/{menu-Bo_ZQ3dZ.js → menu-C8-I96Zt.js} +1 -1
- package/assets/move-options-WgyTD7l9.js +1 -0
- package/assets/{nav-link-BCGmsThK.js → nav-link-DRXYLG2N.js} +1 -1
- package/assets/onboarding-mDqYUvKo.js +1 -0
- package/assets/outbox-BkghU3zE.js +1 -0
- package/assets/{pencil-CPDJ8KvT.js → pencil-Dbryb2G4.js} +1 -1
- package/assets/{rich-text-DMA7APe6.js → rich-text-BtOJxUml.js} +1 -1
- package/assets/{rotate-ccw-Dc0Ronfg.js → rotate-ccw-CqFFuTll.js} +1 -1
- package/assets/{row-actions-ExiBwpBF.js → row-actions-BMjwPo6d.js} +1 -1
- package/assets/search-scope-CtUcfBl6.js +1 -0
- package/assets/{search-token-index-BTQUgi2G.js → search-token-index-D0pBouL9.js} +1 -1
- package/assets/search-view-BjfUA02J.js +1 -0
- package/assets/{senders-MC2FrOMF.js → senders-CSIdLfBV.js} +1 -1
- package/assets/settings-B885opIA.js +1 -0
- package/assets/{settings-screen-x0E-yYQb.js → settings-screen-CKYaXpTP.js} +1 -1
- package/assets/{shield-check-CA34sFyn.js → shield-check-zfqCjw0j.js} +1 -1
- package/assets/{suggested-vips-DWT9IWLZ.js → suggested-vips-B0qK0um_.js} +1 -1
- package/assets/{useDebouncedValue-CQf4QpzS.js → useDebouncedValue-DtSfQRAl.js} +1 -1
- package/assets/{useFilters-CaSSUNWE.js → useFilters-CgqWzSsw.js} +1 -1
- package/assets/useLabels-w33B4HcN.js +1 -0
- package/assets/{useMediaQuery-CAv9qAps.js → useMediaQuery-DB_QCXpp.js} +1 -1
- package/assets/{useRefreshControl-B41i_Tqe.js → useRefreshControl-DQcQYMVi.js} +1 -1
- package/assets/{useSearchMirror--YnVEyRo.js → useSearchMirror-DcdqXC7B.js} +1 -1
- package/assets/{useSearchTokenContext-DIryp5er.js → useSearchTokenContext-DxeXQ6z3.js} +1 -1
- package/assets/useSignature-iMCmNOo-.js +1 -0
- package/assets/useThreadRow-DvG5ipyv.js +1 -0
- package/index.html +2 -2
- package/package.json +1 -1
- package/assets/BriefPane-BJxOwp8m.js +0 -1
- package/assets/FlaggedPane-CT_N453X.js +0 -1
- package/assets/MailListHeader-CaZUuANM.js +0 -52
- package/assets/MailboxPane-Cpo0ICDX.js +0 -1
- package/assets/OnboardingWizard-Dv0CNLJu.js +0 -1
- package/assets/_mailboxId-BHSTiA2e.js +0 -1
- package/assets/_messageId-BNu6TlV_.js +0 -1
- package/assets/_outboxMessageId-D2tWCsPG.js +0 -1
- package/assets/_threadId-JHkXbYFV.js +0 -1
- package/assets/accounts-CBdVBnhy.js +0 -1
- package/assets/brief-IOLPzmXc.js +0 -1
- package/assets/flagged-Nt9qilw4.js +0 -1
- package/assets/folders-CPk7FXDY.js +0 -1
- package/assets/index-BNu6TlV_.js +0 -1
- package/assets/index-BXK1iByh.js +0 -1
- package/assets/index-Bd4SvJ27.js +0 -1
- package/assets/index-ByG6CDPW.js +0 -1
- package/assets/index-D4cNcmeL.js +0 -1
- package/assets/index-DtQuG32K.js +0 -1
- package/assets/mail-CUfL3Goi.js +0 -1
- package/assets/move-options-Cg4YrriV.js +0 -1
- package/assets/onboarding-BPGOK63U.js +0 -1
- package/assets/outbox-pF0wQVQO.js +0 -1
- package/assets/search-scope-Ds_ghZOi.js +0 -1
- package/assets/search-view-CXPbecDB.js +0 -1
- package/assets/settings-B8a8GsFB.js +0 -1
- package/assets/useLabels-DKpzozgD.js +0 -1
- package/assets/useSemanticSearch-DDwHlaH_.js +0 -1
- package/assets/useSignature-C0EjJ_Wk.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r,ba as Ms,r as l,ay as Ft,B as le,S as Ts,b as Be,az as Gt,C as Rs,d as Es,aU as Os,k as bt,w as Ze,W as Yt,X as As,o as We,q as _t,x as Ns,ad as Lt,bb as Xt,bc as Zt,I as zs,h as Ds,T as Fs,bd as _s,be as Ls,bf as Ps,ab as es,bg as $s,bh as Bs,J as Ws,g as Ks,a0 as Pt,bi as Vs,P as qs,v as Hs,bj as Us,n as ts,bk as Qs,G as Js,V as Gs,ae as Ys,i as Xs,bl as Zs,a$ as en}from"./index-CNoNYU4b.js";import{u as tn,p as sn,R as nn}from"./useSearchTokenContext-DIryp5er.js";import{u as on,a as rn,R as an}from"./useRefreshControl-B41i_Tqe.js";import{C as ss,D as Pe,a as ns,b as os,c as is,j as ln,M as cn,t as rs,u as un,d as dn,e as as,f as ls,g as hn,h as fn,i as mn,k as gn,l as Kt,n as pn,m as xn,o as bn,p as vn,q as Sn,S as yn,r as Cn,s as In,v as wn,w as cs,x as jn,y as kn,z as Mn,A as Tn,B as Rn,E as En,F as On,G as An,H as Vt,I as Nn,J as qt,K as zn,L as Dn,N as Fn,O as _n,P as Ln,Q as Pn,R as $n,T as Bn,U as Wn,V as Kn,W as Vn,X as qn,Y as us,Z as Hn,_ as ds,$ as Un,a0 as hs,a1 as Qn,a2 as Jn}from"./MailListHeader-CaZUuANM.js";import{S as Gn,M as Yn,a as Xn,u as Zn,b as eo}from"./MailViewChrome-ClVgpPFO.js";import{E as fs,f as to}from"./ErrorState-DZM_kyxb.js";import{D as so,u as ms}from"./useMediaQuery-CAv9qAps.js";import{C as gs}from"./confirm-dialog-DKl9zp18.js";import{A as $t}from"./avatar-DdSaEl5o.js";import{b as et,c as no,d as oo}from"./format-De9HZKjg.js";import{N as io}from"./NavMenuButton-D-esVAha.js";import{a as ro}from"./useLabels-DKpzozgD.js";import{L as ao,u as lo}from"./useSemanticSearch-DDwHlaH_.js";import{S as vt}from"./shield-check-CA34sFyn.js";import{B as co}from"./bottom-sheet-DmAG_FCk.js";import{C as uo}from"./circle-help-BJ-e95sd.js";import{C as ho}from"./circle-check-DZneB6gk.js";import{a as fo,b as mo,f as go}from"./move-options-Cg4YrriV.js";import{d as ps,h as po,j as xo,e as bo}from"./search-token-index-BTQUgi2G.js";import{M as vo}from"./enums-CCxx0t2v.js";import{r as So}from"./intelligence-pref-C6lFpj6U.js";import{n as yo}from"./search-query-Cr_ZXBCp.js";const Co=e=>{const[n,s]=l.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return l.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);s(t.matches);const o=i=>s(i.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[e]),n},Io=({children:e,onRefresh:n,isRefreshing:s})=>Co(so)?e:r.jsx(Ms,{onRefresh:n,isPullable:!s,children:e}),wo=e=>e===1?"message":"messages";function jo({count:e,onReview:n,onDismiss:s,actionLabel:t="Review & rescue"}){return r.jsx(Ft,{tone:"info",variant:"soft",onDismiss:s,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(vt,{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} ${wo(e)} here`})," ","may not be spam — they're from senders we can verify."]})]}),r.jsx(le,{variant:"primary",size:"sm",onClick:n,className:"self-start",children:t})]})})}const ko=(e,n)=>e==="vip"?"vip":e==="unknown"&&n==="md"?"unknown-pill":"hidden",xs=({senderTrust:e,size:n="sm",className:s})=>{const t=ko(e,n);return t==="vip"?r.jsx(Ts,{className:Be("text-warning shrink-0",n==="sm"&&"size-3.5",n==="md"&&"size-4",s),"aria-label":"VIP sender","data-testid":"sender-trust-vip"}):t==="unknown-pill"?r.jsx("span",{className:Be("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",s),title:"First message from this sender","aria-label":"First message from this sender","data-testid":"sender-trust-unknown",children:"new"}):null};function Mo({candidate:e,selected:n,onToggle:s,hideSender:t=!1}){const{senderName:o,senderAddress:i,subject:c,snippet:a,trustReason:u,trustSubReason:d,senderTrust:f}=e;return r.jsxs("label",{className:Be("flex w-full cursor-pointer items-start gap-3 px-3 py-2.5 text-left transition-colors",t&&"pl-11",n?"bg-positive/10":"bg-surface hover:bg-surface-sunken"),children:[r.jsx(ss,{className:"mt-0.5",checked:n,onChange:s,"aria-label":`${n?"Deselect":"Select"} ${t?c:`message from ${o}`}`}),!t&&r.jsx($t,{name:o,email:i,size:"sm"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[!t&&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(xs,{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:c}),r.jsx("span",{className:"block line-clamp-1 text-xs text-fg-subtle",children:a}),!t&&r.jsxs("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[r.jsxs(Gt,{tone:"positive",children:[r.jsx(vt,{className:"size-3","aria-hidden":!0}),u]}),r.jsx("span",{className:"text-2xs text-fg-subtle",children:d})]})]})]})}const To=e=>{const n=new Map,s=[];for(const t of e){const o=(t.senderAddress||t.senderName).toLowerCase(),i=n.get(o);if(i){i.messages.push(t);continue}n.set(o,{key:o,senderName:t.senderName,senderAddress:t.senderAddress,trustReason:t.trustReason,trustSubReason:t.trustSubReason,senderTrust:t.senderTrust,messages:[t]}),s.push(o)}return s.map(t=>n.get(t)).sort((t,o)=>o.messages.length-t.messages.length)},Ro=(e,n)=>{const s=e.messages.filter(t=>n.has(t.id)).length;return s===0?"none":s===e.messages.length?"all":"some"},Ht=e=>e===1?"message":"messages";function Eo({group:e,selected:n,onToggleGroup:s,onToggleMessage:t}){const[o,i]=l.useState(!1),c=Ro(e,n),a=e.messages.length,u=o?Rs:Es;return r.jsxs("div",{className:Be(c!=="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(ss,{className:"mt-0.5",checked:c==="all",indeterminate:c==="some",onChange:()=>s(e,c!=="all"),"aria-label":`${c==="all"?"Deselect":"Select"} all ${a} ${Ht(a)} from ${e.senderName}`}),r.jsx($t,{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(xs,{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(Gt,{tone:"positive",children:[r.jsx(vt,{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} ${Ht(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(Mo,{candidate:d,selected:n.has(d.id),onToggle:()=>t(d.id),hideSender:!0},d.id))})]})}const Bt=e=>e===1?"message":"messages",Oo=(e,n)=>`Moves ${e===1?"this message":`these ${e} ${Bt(e)}`} out of Spam to ${n} now. Nothing later.`,Dt=(e,n)=>e.find(s=>s.id===n)?.label??"Inbox";function Ao(){return r.jsx(Ft,{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 No({candidates:e,selected:n,onToggle:s,onToggleGroup:t,onSelectAll:o,onSelectNone:i,onContinue:c,onCancel:a}){const[u,d]=l.useState(!1),f=n.size,g=l.useMemo(()=>To(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(vt,{className:"size-4 text-positive","aria-hidden":!0}),"Rescue from Spam"]}),r.jsx(le,{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(Ao,{})})]}),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 · ${g.length} ${g.length===1?"sender":"senders"}`}),r.jsxs("span",{className:"flex gap-1",children:[r.jsx(le,{variant:"ghost",size:"sm",onClick:o,children:"Select all"}),r.jsx(le,{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:g.map(m=>r.jsx(Eo,{group:m,selected:n,onToggleGroup:t,onToggleMessage:s},m.key))}),r.jsxs("div",{className:"space-y-2 border-t border-line bg-surface px-row-inset py-3",children:[r.jsx(le,{variant:"primary",onClick:c,className:"h-11 w-full font-semibold",children:`Continue with ${f} ${Bt(f)}`}),r.jsx(le,{variant:"ghost",onClick:a,className:"h-11 w-full",children:"Cancel"})]})]})}function zo({count:e,folders:n,delimiter:s,destination:t,onPick:o,onMove:i,onBack:c}){const[a,u]=l.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(Os,{folders:n,selectedId:t,delimiter:s,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:Dt(n,t)}),r.jsx(le,{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:Oo(e,Dt(n,t))}),r.jsx(le,{variant:"primary",onClick:i,className:"h-11 w-full font-semibold",children:`Move ${e} out of Spam`}),r.jsx(le,{variant:"ghost",onClick:c,className:"h-11 w-full",children:"Back"})]})]})}function Do({count:e,destinationLabel:n,onClose:s}){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} ${Bt(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(le,{variant:"primary",onClick:s,className:"h-11 w-full font-semibold",children:"Done"})})]})}function Fo({open:e,candidates:n,defaultDestinationId:s,availableFolders:t,delimiter:o,onConfirmMove:i,onCancel:c}){const[a,u]=l.useState("review"),[d,f]=l.useState(()=>e?new Set(n.map(I=>I.id)):new Set),[g,m]=l.useState(s),[y,C]=l.useState(0),w=l.useRef(!1);l.useEffect(()=>{e&&!w.current&&(u("review"),f(new Set(n.map(I=>I.id))),m(s),C(0)),w.current=e},[e,n,s]);const T=d.size,x=I=>{f(j=>{const R=new Set(j);return R.has(I)?R.delete(I):R.add(I),R})},p=(I,j)=>{f(R=>{const E=new Set(R);for(const A of I.messages)j?E.add(A.id):E.delete(A.id);return E})},k=()=>{const I=Array.from(d);C(I.length),i(I,g),u("done")};return r.jsxs(co,{open:e,onClose:c,dismissLabel:"Close rescue",children:[a==="review"&&r.jsx(No,{candidates:n,selected:d,onToggle:x,onToggleGroup:p,onSelectAll:()=>f(new Set(n.map(I=>I.id))),onSelectNone:()=>f(new Set),onContinue:()=>u("destination"),onCancel:c}),a==="destination"&&r.jsx(zo,{count:T,folders:t,delimiter:o,destination:g,onPick:m,onMove:k,onBack:()=>u("review")}),a==="done"&&r.jsx(Do,{count:y,destinationLabel:Dt(t,g),onClose:c})]})}const _o={reply:"Reply",reply_all:"Reply All",forward:"Forward",new:"New Message"},Lo=()=>{const e=l.useRef(!1);return l.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",i=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return e.current=s.trim().length>0||i.length>0,e.current},[])},Po=()=>{const{state:e,closeCompose:n}=bt(),s=Lo(),[t,o]=l.useState(!1),{isError:i,error:c,refetch:a}=Ze({...Yt(),staleTime:1/0}),u=l.useCallback(m=>{m||(s()?o(!0):n())},[n,s]),d=l.useCallback(()=>{o(!1),n()},[n]),f=l.useCallback(()=>{o(!1)},[]);if(!e.isOpen)return null;const g=_o[e.mode]??"New Message";return r.jsxs(Pe.Root,{open:e.isOpen,onOpenChange:u,children:[r.jsxs(Pe.Portal,{children:[r.jsx(Pe.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),r.jsxs(Pe.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(Pe.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),r.jsx(Pe.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:g}),i?r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsx(fs,{title:"Couldn't load compose",error:c,onRetry:()=>{a()}})}):r.jsx("div",{className:"flex-1 overflow-hidden",children:r.jsx(ns,{mode:e.mode,account:e.account,sourceMessage:e.sourceMessage,onClose:n})})]})]}),r.jsx(gs,{isOpen:t,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})]})},$o={reply:"Reply",reply_all:"Reply All",forward:"Forward",new:"New Message"},bs=()=>{const{state:e,closeCompose:n}=bt(),s=ms(),{isError:t,error:o,refetch:i}=Ze({...Yt(),staleTime:1/0});if(!s)return r.jsx(Po,{});if(!e.isOpen)return null;const c=$o[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:c})}),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(As,{className:"size-5"})})]});return t?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(fs,{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(ns,{mode:e.mode,account:e.account,sourceMessage:e.sourceMessage,onClose:n},e.outboxMessageId??"new")})]})};function Bo(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:et(e.updatedAt),isRead:!0}}function Wo(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:et(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0}}function Ko({outboxMessages:e,accountId:n,imapThreads:s}){const t=e.filter(c=>c.status==="draft"&&c.accountId===n).map(Bo),o=s.map(Wo),i=[];return t.length>0&&i.push({id:"remit-drafts",label:"Not yet sent (Remit)",threads:t}),o.length>0&&i.push({id:"imap-drafts",label:"On the server",threads:o}),i}const Vo=({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})]}),qo=({row:e,isSelected:n,onOpen:s,onDelete:t,isDeleting:o})=>r.jsxs("button",{type:"button",onClick:()=>s(e.id),className:Be("group",is({active:n})),children:[r.jsx(Ds,{className:"size-7 shrink-0 text-fg-muted mt-0.5"}),r.jsx(os,{thread:e}),r.jsx("div",{className:"flex items-center gap-1 shrink-0",children:r.jsx("button",{type:"button",onClick:i=>{i.stopPropagation(),t(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(Fs,{className:"size-3.5"})})})]}),Ho=({row:e,isSelected:n,onOpen:s})=>{const t=!e.isRead;return r.jsxs("button",{type:"button",onClick:()=>s(e.id),className:Be("group",is({active:n})),children:[t&&r.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),r.jsx($t,{name:e.fromName,email:e.fromEmail,size:"sm"}),r.jsx(os,{thread:e})]})};function Uo({mailboxId:e,accountId:n,selectedMessageId:s,imapThreads:t,title:o,unreadCount:i}){const{openCompose:c,state:a}=bt(),u=We(),d=_t(),{data:f}=Ze(Ns()),g=l.useMemo(()=>Ko({outboxMessages:f?.items??[],accountId:n,imapThreads:t}),[f?.items,n,t]),m=Lt({...Zt(),onSuccess:()=>{d.invalidateQueries({queryKey:Xt()})}}),y=x=>{m.mutate({path:{outboxMessageId:x}})},C=x=>{c({mode:"new",outboxMessageId:x})},w=x=>{u({to:"/mail/$mailboxId",params:{mailboxId:e},search:{selectedMessageId:x}})},T=g.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(io,{}),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:T?r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-center px-4",children:[r.jsx(zs,{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."})]}):g.map(x=>r.jsxs("div",{children:[x.label&&r.jsx(Vo,{label:x.label,count:x.threads.length}),r.jsx("div",{className:"divide-y divide-line",children:x.threads.map(p=>x.id==="remit-drafts"?r.jsx(qo,{row:p,isSelected:a.isOpen&&p.id===a.outboxMessageId,onOpen:C,onDelete:y,isDeleting:m.isPending},p.id):r.jsx(Ho,{row:p,isSelected:p.id===s,onOpen:w},p.id))})]},x.id))})]})}function Qo(e,n,s){const t=new Array(e);return new Proxy(t,{get(o,i,c){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:s(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,c)}})}function $e(e,n,s){let t=s.initialDeps??[],o,i=!0;function c(){const a=e();return(a.length!==t.length||a.some((d,f)=>t[f]!==d))&&(t=a,o=n(...a),s?.onChange&&!(i&&s.skipInitialOnChange)&&s.onChange(o),i=!1),o}return c.updateDeps=a=>{t=a},c}function Ut(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const Jo=(e,n)=>Math.abs(e-n)<1.01,Go=(e,n,s)=>{let t;return function(...o){e.clearTimeout(t),t=e.setTimeout(()=>n.apply(this,o),s)}};let Xe;const Nt=()=>{if(Xe!==void 0)return Xe;if(typeof navigator>"u")return Xe=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Xe=!0;const e=navigator.maxTouchPoints;return Xe=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Qt=e=>{const{offsetWidth:n,offsetHeight:s}=e;return{width:n,height:s}},Yo=e=>e,Xo=e=>{const n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1)-n+1,o=new Array(t);for(let i=0;i<t;i++)o[i]=n+i;return o},Zo=(e,n)=>{const s=e.scrollElement;if(!s)return;const t=e.targetWindow;if(!t)return;const o=c=>{const{width:a,height:u}=c;n({width:Math.round(a),height:Math.round(u)})};if(o(Qt(s)),!t.ResizeObserver)return()=>{};const i=new t.ResizeObserver(c=>{const a=()=>{const u=c[0];if(u?.borderBoxSize){const d=u.borderBoxSize[0];if(d){o({width:d.inlineSize,height:d.blockSize});return}}o(Qt(s))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(s,{box:"border-box"}),()=>{i.unobserve(s)}},xt={passive:!0},ei=typeof window>"u"?!0:"onscrollend"in window,ti=(e,n,s)=>{const t=e.scrollElement;if(!t)return;const o=e.targetWindow;if(!o)return;const i=e.options.useScrollendEvent&&ei;let c=0;const a=i?null:Go(o,()=>n(c,!1),e.options.isScrollingResetDelay),u=g=>()=>{c=s(t),a?.(),n(c,g)},d=u(!0),f=u(!1);return t.addEventListener("scroll",d,xt),i&&t.addEventListener("scrollend",f,xt),()=>{t.removeEventListener("scroll",d),i&&t.removeEventListener("scrollend",f)}},si=(e,n)=>ti(e,n,s=>{const{horizontal:t,isRtl:o}=e.options;return t?s.scrollLeft*(o&&-1||1):s.scrollTop}),ni=(e,n,s)=>{if(s.options.useCachedMeasurements){const t=s.indexFromElement(e),o=s.options.getItemKey(t);return s.itemSizeCache.get(o)??s.options.estimateSize(t)}if(n?.borderBoxSize){const t=n.borderBoxSize[0];if(t)return Math.round(t[s.options.horizontal?"inlineSize":"blockSize"])}if(!n){const t=s.indexFromElement(e),o=s.options.getItemKey(t),i=s.itemSizeCache.get(o);if(i!==void 0)return i}return e[s.options.horizontal?"offsetWidth":"offsetHeight"]},oi=(e,{adjustments:n=0,behavior:s},t)=>{var o,i;(i=(o=t.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[t.options.horizontal?"left":"top"]:e+n,behavior:s})},ii=oi;class ri{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 s,t,o;return((o=(t=(s=this.targetWindow)==null?void 0:s.performance)==null?void 0:t.now)==null?void 0:o.call(t))??Date.now()},this.observer=(()=>{let s=null;const t=()=>s||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:s=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const c=()=>{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(c):c()})}));return{disconnect:()=>{var o;(o=t())==null||o.disconnect(),s=null},observe:o=>{var i;return(i=t())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=t())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=s=>{var t,o;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Yo,rangeExtractor:Xo,onChange:()=>{},measureElement:ni,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 s){const y=s[m];y!==void 0&&(i[m]=y)}const c=this.options;let a=null,u=null,d=!1;if(c!==void 0&&c.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const m=c.count,y=i.count,C=this.getMeasurements(),w=m>0?((t=C[0])==null?void 0:t.key)??c.getItemKey(0):null,T=m>0?((o=C[m-1])==null?void 0:o.key)??c.getItemKey(m-1):null;if(y!==m||m>0&&y>0&&(i.getItemKey(0)!==w||i.getItemKey(y-1)!==T)){d=!0;const k=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??C[0]:null;k&&(a=[k.key,this.getScrollOffset()-k.start]);const I=i.followOnAppend===!0?"auto":i.followOnAppend||null;I&&y>m&&this.isAtEnd(c.scrollEndThreshold)&&(m===0||i.getItemKey(y-1)!==T)&&(u=I)}}this.options=i,d&&(this.pendingMin=0,this.itemSizeCacheVersion++);let f=!1,g=0;if(a&&this.scrollOffset!==null){const[m,y]=a,C=this.getMeasurements(),{count:w,getItemKey:T}=this.options;let x=0;for(;x<w&&T(x)!==m;)x++;if(x<w){const p=C[x];if(p){const k=p.start+y;k!==this.scrollOffset&&(g=k-this.scrollOffset,this.scrollOffset=k,f=!0)}}}(f||u)&&(this.pendingScrollAnchor=[f?a[0]:null,f?a[1]:0,u,g])},this.notify=s=>{var t,o;(o=(t=this.options).onChange)==null||o.call(t,this,s)},this.maybeNotify=$e(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),s=>{this.notify(s)},{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(s=>s()),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 s;const t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t){this.maybeNotify();return}if(this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((s=this.scrollElement)==null?void 0:s.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,c)=>{if(c&&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=c?a===i?this.scrollDirection:a<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=c,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,c=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!Nt()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",c,xt),i.addEventListener("touchend",a,xt),this.unsubs.push(()=>{i.removeEventListener("touchstart",c),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,c,a,u]=o;i!==null&&!a&&(Nt()&&(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 s=this.getScrollOffset(),t=this.getMaxScrollOffset();if(s<0||s>t)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(s,{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=$e(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(s,t,o,i,c,a,u,d)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:s,paddingStart:t,scrollMargin:o,getItemKey:i,enabled:c,lanes:a,laneAssignmentMode:u,gap:d}),{key:!1}),this.getMeasurements=$e(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:s,paddingStart:t,scrollMargin:o,getItemKey:i,enabled:c,lanes:a,laneAssignmentMode:u,gap:d},f)=>{const g=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>s)for(const x of this.laneAssignments.keys())x>=s&&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===s&&(this.lanesSettling=!1),a===1){const x=s*2;let p=this._flatMeasurements;if(!p||p.length<x){const j=new Float64Array(x);p&&m>0&&j.set(p.subarray(0,m*2)),p=j,this._flatMeasurements=p}let k;if(m===0)k=t+o;else{const j=m-1;k=p[j*2]+p[j*2+1]+d}for(let j=m;j<s;j++){const R=i(j),E=g.get(R),A=typeof E=="number"?E:this.options.estimateSize(j);p[j*2]=k,p[j*2+1]=A,k+=A+d}const I=Qo(s,p,i);return this.measurementsCache=I,I}const y=this.measurementsCache.slice(0,m),C=new Array(a).fill(void 0),w=new Float64Array(a);let T=0;for(let x=0;x<m;x++){const p=y[x];p&&(C[p.lane]===void 0&&T++,C[p.lane]=x,w[p.lane]=p.end)}for(let x=m;x<s;x++){const p=i(x),k=this.laneAssignments.get(x);let I,j;const R=u==="estimate"||g.has(p);if(k!==void 0&&this.options.lanes>1){I=k;const _=C[I],N=_!==void 0?y[_]:void 0;j=N?N.end+d:t+o}else if(T===a){let _=0,N=w[0],L=C[0];for(let U=1;U<a;U++){const ee=w[U];(ee<N||ee===N&&C[U]<L)&&(_=U,N=ee,L=C[U])}I=_,j=N+d,R&&this.laneAssignments.set(x,I)}else I=x%this.options.lanes,j=t+o,R&&this.laneAssignments.set(x,I);const E=g.get(p),A=typeof E=="number"?E:this.options.estimateSize(x),z=j+A;y[x]={index:x,start:j,size:A,end:z,key:p,lane:I},C[I]===void 0&&T++,C[I]=x,w[I]=z}return this.measurementsCache=y,y},{key:!1,debug:()=>this.options.debug}),this.calculateRange=$e(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,t,o,i)=>s.length===0||t===0?(this.range=null,null):(this.range=li(s,t,o,i,i===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=$e(()=>{let s=null,t=null;const o=this.calculateRange();return o&&(s=o.startIndex,t=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,s,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,s,t]},(s,t,o,i,c)=>i===null||c===null?[]:s({startIndex:i,endIndex:c,overscan:t,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=s=>{const t=this.options.indexAttribute,o=s.getAttribute(t);return o?parseInt(o,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=s=>{var t;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:t.index);if(o!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,o-i),a=Math.min(this.options.count-1,o+i);return s>=c&&s<=a}return!0},this.measureElement=s=>{if(!s){this.elementsCache.forEach((c,a)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(a))});return}const t=this.indexFromElement(s),o=this.options.getItemKey(t),i=this.elementsCache.get(o);i!==s&&(i&&this.observer.unobserve(i),this.observer.observe(s),this.elementsCache.set(o,s)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(s,void 0,this))},this.resizeItem=(s,t)=>{var o,i;if(s<0||s>=this.options.count)return;let c,a,u;const d=this._flatMeasurements;if(this.options.lanes===1&&d!==null)u=this.options.getItemKey(s),a=d[s*2],c=d[s*2+1];else{const m=this.measurementsCache[s];if(!m)return;u=m.key,a=m.start,c=m.size}const f=this.itemSizeCache.get(u)??c,g=t-f;if(g!==0){const m=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,y=m?this.getTotalSize():0,C=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[s]??{index:s,key:u,start:a,size:c,end:a+c,lane:0},g,this):a<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(u)||this.scrollDirection!=="backward"));(this.pendingMin===null||s<this.pendingMin)&&(this.pendingMin=s),this.itemSizeCache.set(u,t),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-y):C&&this.applyScrollAdjustment(g),this.notify(!1)}},this.getVirtualItems=$e(()=>[this.getVirtualIndexes(),this.getMeasurements()],(s,t)=>{const o=[];for(let i=0,c=s.length;i<c;i++){const a=s[i],u=t[a];o.push(u)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=s=>{const t=this.getMeasurements();if(t.length===0)return;const o=this._flatMeasurements,i=this.options.lanes===1&&o!=null,c=vs(0,t.length-1,i?a=>o[a*2]:a=>Ut(t[a]).start,s);return Ut(t[c])},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 s=this.scrollElement.document.documentElement;return this.options.horizontal?s.scrollWidth-this.scrollElement.innerWidth:s.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=(s=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=s,this.getOffsetForAlignment=(s,t,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),c=this.getScrollOffset();t==="auto"&&(t=s>=c+i?"end":"start"),t==="center"?s+=(o-i)/2:t==="end"&&(s-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,s),0)},this.getOffsetForIndex=(s,t="auto")=>{s=Math.max(0,Math.min(s,this.options.count-1));const o=this.getSize(),i=this.getScrollOffset(),c=this.measurementsCache[s];if(!c)return;if(t==="auto")if(c.end>=i+o-this.options.scrollPaddingEnd)t="end";else if(c.start<=i+this.options.scrollPaddingStart)t="start";else return[i,t];if(t==="end"&&s===this.options.count-1)return[this.getMaxScrollOffset(),t];const a=t==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,c.size),t]},this.scrollToOffset=(s,{align:t="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(s,t),c=this.now();this.scrollState={index:null,align:t,behavior:o,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(s,{align:t="auto",behavior:o="auto"}={})=>{s=Math.max(0,Math.min(s,this.options.count-1));const i=this.getOffsetForIndex(s,t);if(!i)return;const[c,a]=i,u=this.now();this.scrollState={index:s,align:a,behavior:o,startedAt:u,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(s,{behavior:t="auto"}={})=>{const o=this.getScrollOffset()+s,i=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:s="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:s});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:s})},this.getTotalSize=()=>{var s;const t=this.getMeasurements();let o;if(t.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const i=t.length-1,c=this._flatMeasurements;c!=null?o=c[i*2]+c[i*2+1]:o=((s=t[i])==null?void 0:s.end)??0}else{const i=Array(this.options.lanes).fill(null);let c=t.length-1;for(;c>=0&&i.some(a=>a===null);){const a=t[c];i[a.lane]===null&&(i[a.lane]=a.end),c--}o=Math.max(...i.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const s=[];if(this.itemSizeCache.size===0)return s;const t=this.getMeasurements();for(const o of t)o&&this.itemSizeCache.has(o.key)&&s.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return s},this._scrollToOffset=(s,{adjustments:t,behavior:o})=>{this._intendedScrollOffset=s+(t??0),this.options.scrollToFn(s,{behavior:o,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(n)}applyScrollAdjustment(n,s){n!==0&&(Nt()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=n:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=n,behavior:s}),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 t=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=t?t[0]:this.scrollState.lastTargetOffset,i=1,c=o!==this.scrollState.lastTargetOffset;if(!c&&Jo(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,c){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 vs=(e,n,s,t)=>{for(;e<=n;){const o=(e+n)/2|0,i=s(o);if(i<t)e=o+1;else if(i>t)n=o-1;else return o}return e>0?e-1:0};function ai(e,n,s){let t=0;for(;t<=n;){const o=(t+n)/2|0,i=e[o*2];if(i<s)t=o+1;else if(i>s)n=o-1;else return o}return t>0?t-1:0}function li(e,n,s,t,o){const i=e.length-1;if(e.length<=t)return{startIndex:0,endIndex:i};if(t===1&&o!==null){const d=ai(o,i,s);let f=d;const g=s+n;for(;f<i&&o[f*2]+o[f*2+1]<g;)f++;return{startIndex:d,endIndex:f}}let a=vs(0,i,d=>e[d].start,s),u=a;if(t===1)for(;u<i&&e[u].end<s+n;)u++;else if(t>1){const d=Array(t).fill(0);for(;u<i&&d.some(g=>g<s+n);){const g=e[u];d[g.lane]=g.end,u++}const f=Array(t).fill(s+n);for(;a>=0&&f.some(g=>g>=s);){const g=e[a];f[g.lane]=g.start,a--}a=Math.max(0,a-a%t),u=Math.min(i,u+(t-1-u%t))}return{startIndex:a,endIndex:u}}const zt=typeof document<"u"?l.useLayoutEffect:l.useEffect;function ci({useFlushSync:e=!0,directDomUpdates:n=!1,directDomUpdatesMode:s="transform",...t}){const o=l.useReducer(d=>d+1,0)[1],i=l.useRef({enabled:n,mode:s,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=n,i.current.mode=s;const c=d=>{const f=i.current;if(!f.enabled||!f.container)return;const g=d.getTotalSize();if(g!==f.lastSize){f.lastSize=g;const x=d.options.horizontal?"width":"height";f.container.style[x]=`${g}px`}const m=!!d.options.horizontal,y=f.mode==="transform",C=m?"left":"top",w=d.options.scrollMargin,T=d.getVirtualItems();for(const x of T){const p=x.start-w,k=d.elementsCache.get(x.key);k&&f.lastPositions.get(k)!==p&&(f.lastPositions.set(k,p),y?k.style.transform=m?`translate3d(${p}px, 0, 0)`:`translate3d(0, ${p}px, 0)`:k.style[C]=`${p}px`)}},a={...t,onChange:(d,f)=>{var g;const m=i.current;let y=!0;if(m.enabled){c(d);const C=d.range,w=m.prevRange;y=!w||w.isScrolling!==d.isScrolling||w.startIndex!==C?.startIndex||w.endIndex!==C?.endIndex,y&&(m.prevRange=C?{startIndex:C.startIndex,endIndex:C.endIndex,isScrolling:d.isScrolling}:null)}y&&(e&&f?_s.flushSync(o):o()),(g=t.onChange)==null||g.call(t,d,f)}},[u]=l.useState(()=>{const d=new ri(a);return Object.assign(d,{containerRef:f=>{const g=i.current;if(g.container=f,g.lastSize=null,f&&g.enabled){const m=d.getTotalSize();g.lastSize=m;const y=d.options.horizontal?"width":"height";f.style[y]=`${m}px`}}})});return u.setOptions(a),zt(()=>u._didMount(),[]),zt(()=>u._willUpdate()),zt(()=>{c(u)}),u}function ui(e){return ci({observeElementRect:Zo,observeElementOffset:si,scrollToFn:ii,...e})}const Wt=e=>e.query?`matching "${e.query}"`:e.from?`from "${e.from}"`:"matching your search",di=e=>`Select all ${Wt(e)}`,hi=(e,n)=>`All ${no(n)} ${Wt(e)} selected`,fi=({verb:e,confirmingDelete:n,hasSelection:s,junkMailboxId:t,currentMailboxId:o,deletableMessageId:i})=>{if(n)return{kind:"withheld"};if(e==="junk"){const c=ln(t,o);if(c!==void 0)return{kind:"unavailable",reason:c}}return s?{kind:"openWizard"}:e!=="delete"||i===void 0?{kind:"declined"}:{kind:"confirmDelete",messageId:i}},mi=(e,n,s)=>e==="BACK"&&n&&s===void 0,gi=(e,n)=>({id:e.messageId,accountId:e.accountId,mailboxId:e.mailboxId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:et(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:rs(e.category),messageCount:n,suspicious:e.authenticity?.dkimMismatch===!0,labels:e.labels}),pi=({thread:e,mailboxId:n,isSelected:s,isFocused:t,isTabStop:o,onFocusRow:i,isChecked:c,onToggleCheck:a,onRowSelect:u,messageCount:d,isMultiSelectMode:f,onLongPress:g,isDesktop:m,density:y})=>r.jsx(cn,{thread:gi(e,d),linkMailboxId:n,inListbox:!0,active:s,focused:t,isTabStop:o,density:y,isDesktop:m,onFocusRow:i,selection:{isChecked:c,onToggleCheck:a,onRowSelect:u,isMultiSelectMode:f,onLongPress:g}}),xi=l.memo(pi),bi=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:et(e.sentDate),isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:rs(e.category),suspicious:n}},vi=({thread:e,mailboxId:n,isSelected:s,isFocused:t,isTabStop:o,onFocusRow:i,isChecked:c,onToggleCheck:a,onRowSelect:u,isMultiSelectMode:d,onLongPress:f,isDesktop:g,onDelete:m,onToggleRead:y,density:C})=>{const[w,T]=l.useState("none"),x=We(),p=l.useCallback(E=>{navigator.vibrate?.(10),E==="trailing"?m(e.messageId):y(e.messageId,e.isRead),T("none")},[m,y,e.messageId,e.isRead]),k=l.useCallback(()=>{f(e.messageId)},[f,e.messageId]),I=l.useCallback(()=>{a(e.messageId)},[a,e.messageId]),j=l.useCallback(()=>{x({to:"/mail/$mailboxId",params:{mailboxId:n},search:E=>({...E,selectedMessageId:e.messageId})})},[x,n,e.messageId]),R=un(e.messageId,u);return g||d?r.jsx(xi,{thread:e,mailboxId:n,isSelected:s,isFocused:t,isTabStop:o,onFocusRow:i,isChecked:c,onToggleCheck:a,onRowSelect:u,isMultiSelectMode:d,onLongPress:f,isDesktop:g,density:C}):r.jsx("div",{role:"presentation",onPointerDownCapture:R.onMouseDown,onClickCapture:R.claimClick,onContextMenu:R.onContextMenu,children:r.jsx(Gn,{thread:bi(e),selectionMode:!1,checked:!1,active:s,peek:w,onPeek:T,onToggleCheck:I,onLongPress:k,onOpen:j,onAct:p})})},Si=72,yi=32,Ci=5,Ss="remit:list-density",Ii=()=>{try{const e=localStorage.getItem(Ss);if(e==="compact"||e==="comfortable")return e}catch{}return"comfortable"},wi=({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,"”"]})]}),ji=({mailboxId:e,threads:n,selectedMessageId:s,isLoading:t,isError:o=!1,error:i,onRetry:c,searchQuery:a,searchPredicate:u,onDeleteMessages:d,isDeleting:f=!1,isMoving:g=!1,onLoadMore:m,hasMore:y=!1,isLoadingMore:C=!1,accountId:w,listTitle:T,listMeta:x,listFilter:p,listScopeLabel:k,onTriageContextChange:I,commandsRef:j,hideHeader:R=!1})=>{const E=l.useRef(null),A=We(),z=ms(),_=Ls(),{verb:N,start:L,startFromSearch:U}=_,ee=Ps(),Se=!!a?.trim(),P=dn(),{labels:Ke}=ro(w),{pushError:oe}=es(),[M,ye]=l.useState(s),[Ce,Q]=l.useState(),$=l.useCallback(h=>{Q(b=>b===h?b:void 0),ye(h)},[]),[ge,H]=l.useState(Ii),Re=l.useCallback(()=>{H(h=>{const b=h==="comfortable"?"compact":"comfortable";try{localStorage.setItem(Ss,b)}catch{}return b})},[]),{toggleReadFor:Ee}=as({mailboxId:e}),{junkMailboxId:pe}=ls(w),ie=cs(pe,e),{selectedIds:Y,selectedCount:te,hasSelection:X,isSelected:Ie,toggle:Z,select:ce,clearSelection:B,selectRange:xe,setAnchor:tt,selectAll:O,toggleAll:st,intersectWith:nt}=hn(),Oe=wn(te,z),[D,Ae]=l.useState(null),we=Se&&!!u,Ve=`${e}|${JSON.stringify(u??{})}`,v=fn({mailboxId:e,accountId:w,enabled:we,predicateKey:Ve,searchQuery:u??{}}),ot=l.useCallback((h,b,ae)=>{if(ae.error===void 0){if(ae.cancelled){oe({severity:"warning",title:gn(ae.done),detail:mn(h,ae.done,b)});return}oe({severity:"info",title:Kt(h,ae.done)})}},[oe]),qe=v.phase.kind,it=v.clear,W=l.useCallback(()=>{qe==="escalated"&&it(),B()},[B,it,qe]),[rt,ue]=l.useState(null),de=l.useRef(null),se=l.useRef(!1),Ne=l.useRef(null),je=!t&&n.length>0,K=D!==null,ke=ui({count:n.length,getScrollElement:()=>E.current,estimateSize:()=>ge==="compact"?yi:Si,overscan:Ci}),at=s?n.findIndex(h=>h.messageId===s):-1,ne=M?n.findIndex(h=>h.messageId===M):-1,F=l.useCallback(h=>{if(h<0||h>=n.length)return;const b=n[h];if(Oe){Z(b.messageId);return}de.current=b.messageId,se.current=!1,Q(b.messageId),ye(b.messageId)},[n,Oe,Z]),He=l.useCallback(()=>{if(n.length===0)return;const h=ne<0?0:Math.min(ne+1,n.length-1);F(h)},[n.length,ne,F]),he=l.useCallback(()=>{if(n.length===0)return;const h=ne<=0?0:ne-1;F(h)},[n.length,ne,F]),lt=l.useCallback(()=>F(0),[F]),Ue=l.useCallback(()=>F(n.length-1),[F,n.length]),Qe=l.useCallback(()=>{M&&Z(M)},[M,Z]),V=l.useMemo(()=>n.map(h=>h.messageId),[n]),yt=l.useMemo(()=>{const h=[];for(const b of n)Y.has(b.messageId)&&h.push({id:b.messageId,sender:b.fromName??b.fromEmail??"Unknown",email:b.fromEmail??"",subject:b.subject??"(No subject)",date:et(b.sentDate)});return h},[n,Y]),ct=l.useCallback((h,b)=>b.shiftKey?(xe(V,h,M),!0):b.metaKey||b.ctrlKey?(Z(h),!0):(W(),tt(h),!1),[V,M,xe,Z,W,tt]),ze=l.useCallback(h=>{!d||h.length===0||(Ne.current=M??null,Ae(h))},[d,M]),Me=l.useCallback(h=>{const b=pn(V,M,h);b!==void 0&&(xe(V,b),de.current=b,se.current=!1,Q(void 0),ye(b))},[V,M,xe]),be=l.useCallback(()=>Me(-1),[Me]),Je=l.useCallback(()=>Me(1),[Me]),De=l.useCallback(()=>{V.length>0&&O(V)},[V,O]),ut=l.useCallback(h=>{const b=fi({verb:h,confirmingDelete:D!==null,hasSelection:X,junkMailboxId:pe,currentMailboxId:e,deletableMessageId:d?M:void 0});return b.kind==="openWizard"?(L(h),!0):b.kind==="confirmDelete"?(ze([b.messageId]),!0):b.kind==="unavailable"?(oe({severity:"warning",title:b.reason}),!0):b.kind==="withheld"},[D,d,X,pe,e,L,M,ze,oe]),Ge=l.useCallback(()=>{M&&A({to:"/mail/$mailboxId",params:{mailboxId:e},search:h=>({...h,selectedMessageId:M})})},[M,A,e]),dt=l.useCallback(h=>{A({to:"/mail/$mailboxId",params:{mailboxId:e},search:b=>({...b,selectedMessageId:h}),replace:!0})},[A,e]);xn({keyboardFocusedMessageId:Ce,openMessageId:s,enabled:z&&te===0,open:dt});const fe=v.phase.kind==="escalated"?{scope:Wt(u??{}),total:v.phase.total,searchQuery:u??{},run:h=>v.runAction(h),stop:v.stop}:void 0,Fe=l.useCallback(()=>{if(!D)return;const h=D;if(h.length===0){Ae(null);return}const b=new Set(h),ae=n.findIndex(q=>b.has(q.messageId));let me;for(let q=ae+1;q<n.length;q++)if(!b.has(n[q].messageId)){me=n[q].messageId;break}if(me===void 0){for(let q=ae-1;q>=0;q--)if(!b.has(n[q].messageId)){me=n[q].messageId;break}}d?.(h),W(),Ne.current=null,Ae(null),me!==void 0&&(de.current=me,se.current=!1,$(me),z&&A({to:"/mail/$mailboxId",params:{mailboxId:e},search:q=>({...q,selectedMessageId:me}),replace:!0})),z||ue(Kt("delete",h.length))},[D,n,d,W,A,e,z,$]),_e=l.useCallback(()=>{const h=Ne.current;Ne.current=null,Ae(null),h!==null&&(de.current=h,se.current=!1,$(h))},[$]),re=l.useMemo(()=>{if(te===0)return;const h=new Set;for(const b of n)Y.has(b.messageId)&&h.add(b.accountConfigId);if(h.size>1)return"Move only works within one account — clear selection or pick messages from a single account"},[te,Y,n]),Ct=l.useCallback(()=>{if(fe){U();return}L("organize")},[fe,U,L]),It=l.useCallback(h=>{d?.([h])},[d]),wt=l.useCallback((h,b)=>{Ee([h],!b)},[Ee]),ve=l.useCallback(h=>{z||ce(h)},[z,ce]),jt=l.useCallback(()=>{if(v.isRunning||v.phase.kind==="counting"){v.stop();return}W()},[v,W]),kt=l.useCallback(()=>{v.clear()},[v]);l.useEffect(()=>{if(se.current||!z&&s)return;const h=ne>=0?ne:at;h>=0&&ke.scrollToIndex(h,{align:"auto"})},[ne,at,ke,z,s]),l.useEffect(()=>{s&&(se.current=!1,$(s))},[s,$]),l.useEffect(()=>{M&&(n.some(h=>h.messageId===M)||$(n[0]?.messageId))},[n,M,$]),l.useEffect(()=>{I?.({focusedMessageId:M,selectedIds:Array.from(Y),hasList:je,blocksKeyboard:K||_.isOpen})},[M,Y,je,K,_.isOpen,I]);const ht=l.useRef(I);ht.current=I,l.useEffect(()=>()=>ht.current?.({focusedMessageId:void 0,selectedIds:[],hasList:!1,blocksKeyboard:!1}),[]),l.useEffect(()=>{v.phase.kind!=="idle"||v.isRunning||nt(n.map(h=>h.messageId))},[n,nt,v.phase,v.isRunning]);const ft=l.useRef(e);l.useEffect(()=>{ft.current!==e&&(ft.current=e,W())},[e,W]),bn({shouldBlockFn:({action:h})=>mi(h,X,ee)?(W(),!0):!1,enableBeforeUnload:!1,disabled:!X||ee!==void 0}),l.useEffect(()=>{const h=E.current;if(!h||!y||!m)return;const b=()=>{if(C)return;const{scrollTop:ae,scrollHeight:me,clientHeight:q}=h;ae+q>=me-200&&m()};return h.addEventListener("scroll",b,{passive:!0}),b(),()=>h.removeEventListener("scroll",b)},[y,C,m]),l.useEffect(()=>{const h=de.current;if(!h)return;const b=E.current?.querySelector(`[data-message-id="${h}"]`);b&&(de.current=null,b.focus({preventScroll:!0}))}),l.useEffect(()=>{if(j){if(!je){j.current=null;return}return j.current={focusNext:He,focusPrevious:he,focusFirst:lt,focusLast:Ue,openFocused:Ge,toggleSelect:Qe,extendSelectDown:Je,extendSelectUp:be,selectAll:De,clearSelection:()=>X?(W(),!0):!1,requestVerb:ut,toggleDensity:Re},()=>{j.current=null}}},[j,je,He,he,lt,Ue,Ge,Qe,Je,be,De,X,W,ut,Re]);const mt=t?"loading":o?"error":n.length===0?"empty":"ready",Mt=o?to(i):void 0,Tt=l.useCallback(()=>{const h=$s(Bs());window.open(h,"_blank","noopener,noreferrer")},[]),Te=[{id:"inbox",threads:[]}],Le=V.length>0&&V.every(h=>Y.has(h)),gt=we&&y&&Le&&!f&&!g&&v.phase.kind==="idle"&&!v.isRunning,Rt=f||g||v.isRunning,Ye=v.phase.kind==="escalated"?v.phase.total:te,Et=v.runningAction?vn(v.runningAction.kind,v.progress?.done??0,v.progress?.total??Ye):v.phase.kind==="counting"?"Counting matches…":v.phase.kind==="escalated"?hi(u??{},v.phase.total):void 0,Ot=v.phase.kind!=="escalated"&&V.length>0?{checked:Le,indeterminate:te>0&&!Le,onChange:()=>st(V)}:void 0,At=v.runningAction?{value:v.progress?.done??0,max:v.progress?.total??Ye,tone:Sn(v.runningAction.kind)}:void 0,J=(v.phase.kind==="counting"?{tone:"info",text:"",action:{label:"Stop",onClick:v.stop}}:v.phase.kind==="escalated"&&!v.isRunning?{tone:"info",text:"",action:{label:"Clear selection",onClick:kt}}:gt?{tone:"info",text:"",action:{label:di(u??{}),onClick:v.escalate}}:void 0)??(re?{tone:"warning",text:re}:void 0),G=r.jsx(yn,{title:P.title||T,navSlot:P.navSlot,titleMeta:P.titleMeta,searchSlot:P.searchSlot,searchField:P.searchField,idleSlot:P.makeFilterSlot,count:Ye,onCancel:jt,onDelete:()=>L("delete"),onMove:()=>L("move"),onOrganize:Ct,onJunk:ie?()=>L("junk"):void 0,onMarkRead:()=>L("markRead"),overflowSlot:w&&e&&te>0&&Ke.length>0?r.jsx(ao,{accountId:w,mailboxId:e,messageIds:Array.from(Y)}):void 0,isBusy:Rt,isCounting:v.phase.kind==="counting",selectAll:Ot,statusLabel:Et,progress:At,notice:J}),ws=Cn(V,M),js=l.useCallback(h=>{se.current=!0,$(h)},[$]),ks=r.jsxs(r.Fragment,{children:[Se&&a&&r.jsx(wi,{query:a}),r.jsxs("div",{ref:E,role:"listbox","aria-multiselectable":!0,"aria-label":T,className:"flex-1 overflow-y-auto",children:[r.jsx("div",{role:"presentation",className:"relative w-full",style:{height:`${ke.getTotalSize()}px`},children:ke.getVirtualItems().map(h=>{const b=n[h.index];return r.jsx("div",{role:"presentation","data-index":h.index,ref:ke.measureElement,className:Ws("absolute left-0 top-0 w-full border-b border-line",v.isRunning&&"pointer-events-none opacity-50"),style:{transform:`translateY(${h.start}px)`},children:r.jsx(vi,{thread:b,mailboxId:e,isSelected:s===b.messageId,isFocused:M===b.messageId,isTabStop:ws===b.messageId,onFocusRow:js,isChecked:Ie(b.messageId),onToggleCheck:Z,onRowSelect:ct,isMultiSelectMode:Oe,onLongPress:ve,isDesktop:z,onDelete:It,onToggleRead:wt,density:ge})},h.key)})}),C&&r.jsx(Yn,{})]})]});return r.jsxs(r.Fragment,{children:[rt&&!z&&r.jsx(Ft,{tone:"success",variant:"soft",className:"m-2 rounded-md",onDismiss:()=>ue(null),children:rt}),r.jsx(Xn,{listTitle:T,listMeta:x,sections:Te,flatList:!0,listState:P.searchResults?"ready":mt,searchQuery:Se?a:void 0,listFilter:p,listScopeLabel:k,errorMessage:Mt,onRetry:c,onReportError:Tt,density:ge,selectedThreadId:s,onSelectThread:h=>A({to:"/mail/$mailboxId",params:{mailboxId:e},search:b=>({...b,selectedMessageId:h})}),isDesktop:z,hideHeader:R,selectionBar:G,listBody:P.searchResults??(mt==="ready"?ks:void 0)}),r.jsx(gs,{isOpen:D!==null,title:oo(D?.length??0),description:"You can restore them from Trash later.",confirmLabel:"Move to Trash",destructive:!0,isBusy:f,onConfirm:Fe,onCancel:_e}),r.jsx(In,{verb:N,accountId:w,mailboxId:e,selection:yt,crossAccount:re!==void 0,escalated:fe,escalatedProgress:v.progress,onFinished:W,onRunEnded:ot})]})},ki=e=>qs({path:{accountId:e}}),Mi=e=>{const n=_t(),s=Pt(),t=Lt({...Vs(),onSuccess:()=>{s.recordEvent("sync.triggered"),n.invalidateQueries({queryKey:ki(e)})}});return{trigger:()=>{t.mutate({path:{accountId:e}})},triggerAsync:()=>t.mutateAsync({path:{accountId:e}}),isPending:t.isPending,error:t.error,reset:t.reset}},Ti=({accountId:e,children:n})=>{const{triggerAsync:s,isPending:t}=Mi(e);return r.jsx(Io,{onRefresh:s,isRefreshing:t,children:n})};function Ri({accountId:e,currentMailboxId:n,candidates:s,onMove:t,children:o}){const[i,c]=l.useState(!1),a=Pt(),u=fo(),{inboxMailboxId:d}=jn(e),f=kn(e),{data:g}=Ze({...Hs({path:{accountId:e}}),staleTime:1/0}),m=l.useMemo(()=>mo({mailboxes:g?.items??[],folderAppointments:f,currentMailboxId:n,translator:u}),[g?.items,f,n,u]),y=l.useMemo(()=>d||(m.find(p=>p.label.toLowerCase()==="inbox")?.id??m.find(p=>!p.isCurrent)?.id??""),[d,m]),C=l.useRef(!1);l.useEffect(()=>{C.current||(C.current=!0,Mn(a,s.length))},[a,s.length]);const w=l.useCallback(()=>{Tn(a,s.length),c(!0)},[a,s.length]),T=l.useCallback((x,p)=>{Rn(a,{selected:x.length,total:s.length,toInbox:p===d}),t(x,p)},[a,s.length,d,t]);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(jo,{count:s.length,onReview:w})}),r.jsx("div",{className:"min-h-0 flex-1",children:o}),r.jsx(Fo,{open:i,candidates:s,defaultDestinationId:y,availableFolders:m,delimiter:go(g?.items??[]),onConfirmMove:T,onCancel:()=>c(!1)})]})}const Ei="We can verify this sender";function Oi(e){const{data:n}=Ze({...Us({path:{mailboxId:e??""},query:{senderTrust:["vip","wellknown"],dkimMismatch:!1,results:!0,limit:500}}),enabled:!!e,staleTime:6e4});return{candidates:(n?.items??[]).map(t=>({id:t.messageId,senderName:t.fromName||t.fromEmail||"Unknown sender",senderAddress:t.fromEmail??"",subject:t.subject||"(no subject)",snippet:t.snippet??"",trustReason:Ei,trustSubReason:En(t.senderTrust),senderTrust:t.senderTrust}))}}function Ai(e){return{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,messageId:e.messageId,authenticity:e.authenticity}}function Ni(e,n){if(e)return Ai(e);if(n.messageId&&n.threadId&&n.mailboxId)return{threadId:n.threadId,mailboxId:n.mailboxId,messageId:n.messageId}}const zi=e=>{const n=new Set,s=[];for(const t of e)n.has(t.threadMessageId)||(n.add(t.threadMessageId),s.push(t));return s},Di={unread:"unread",flagged:"starred",attachment:"attachments"},Fi=new Set(Object.values(vo)),ys=e=>Fi.has(e),_i=e=>ys(e.category)||e.attributes.size>0,Li=e=>{const n={};ys(e.category)&&(n.category=[e.category]);for(const s of e.attributes){const t=Di[s];t&&(n[t]=!0)}return n},Pi=e=>(e.senderTrust?.length??0)>0||e.dkimMismatch!==void 0?"loaded-pages":"whole-folder",$i=["category","unread","starred","attachments"],Jt=e=>JSON.stringify($i.map(n=>e?.[n]??null)),Bi=e=>{if(!Array.isArray(e))return;const[n]=e;if(typeof n!="object"||n===null)return;const s=n.query;if(!(typeof s!="object"||s===null))return s},Wi=(e,n)=>{const s=Bi(e);return s?Jt(s)===Jt(n):!1},Ki=(e,n)=>e!==n,Vi=(e,n,s)=>{if(!(s||!n))return e.find(t=>t.messageId===n)},qi=(e,n,s,t)=>{if(e)return e;if(!(t||!s))return n?.messageId===s?n:void 0},pt=e=>e[0],Hi=e=>{const n=pt(e.filter(a=>a.type==="from").map(a=>a.value)),s=pt(e.filter(a=>a.type==="subject").map(a=>a.value)),t=pt(e.filter(a=>a.type==="category").map(a=>a.category)),o=pt(e.filter(a=>a.type==="isUnread"||a.type==="isRead").map(a=>a.type==="isUnread")),i=e.some(a=>a.type==="isStarred")?!0:void 0,c=e.some(a=>a.type==="hasAttachment")?!0:void 0;return{...n!==void 0?{from:n}:{},...s!==void 0?{subject:s}:{},...t!==void 0?{category:[t]}:{},...o!==void 0?{unread:o}:{},...i!==void 0?{starred:i}:{},...c!==void 0?{attachments:c}:{}}},Ui=(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 Qi(e,n={}){const s=Hi(e),t={...s,...n};return{params:s,residual:e.filter(o=>!Ui(t,o))}}function Ji(e,n,s){if(n.length===0)return e;const t=[...n];return e.filter(o=>{const i=On(o);return An({...i,accountId:i.accountId??s},t)})}const Gi=50,Yi=new Map(hs().categories.filter(e=>e.id!=="all").map(e=>[e.id,e.label])),Cs=l.createContext(null);function St(){const e=l.useContext(Cs);if(!e)throw new Error("MailboxPane.* must be used inside <MailboxPane>");return e}function Xi({mailboxId:e,selectedMessageId:n,children:s}){const t=We(),i=ps()==="desktop",c=Pt(),{accounts:a,searchQuery:u,searchInput:d,intelligenceOpen:f,onToggleIntelligence:g,onSetIntelligenceOpen:m}=ts(),y=tn(),C=yo(u),w=C.length>0,{freeText:T,tokens:x}=sn(C,y),[p,k]=l.useState("all"),[I,j]=l.useState(new Set),R=l.useMemo(()=>({category:p,attributes:I}),[p,I]),E=l.useMemo(()=>Li(R),[R]),A=w||_i(R),{params:z,residual:_}=Qi(x,E),N={order:"desc",limit:Gi,...T?{query:T}:{},...z,...E},L={category:N.category,unread:N.unread,starred:N.starred,attachments:N.attachments},U=A?Qs({path:{mailboxId:e},query:N}):Js({path:{mailboxId:e},query:{order:"desc"}}),{data:ee,isLoading:Se,isError:P,error:Ke,refetch:oe,fetchNextPage:M,hasNextPage:ye,isFetchingNextPage:Ce}=Zn({queryKey:U,queryFn:async({pageParam:S})=>{if(A){const{data:G}=await Zs({path:{mailboxId:e},query:{...N,continuationToken:S},throwOnError:!0});return G}const{data:J}=await en({path:{mailboxId:e},query:{order:"desc",continuationToken:S},throwOnError:!0});return J},initialPageParam:void 0,getNextPageParam:S=>S.continuationToken,placeholderData:(S,J)=>Wi(J?.queryKey,L)?S:void 0}),Q=l.useCallback(S=>{n&&S.includes(n)&&t({to:"/mail/$mailboxId",params:{mailboxId:e},search:J=>({...J,selectedMessageId:void 0,selectedThreadId:void 0})})},[n,e,t]),{deleteMessages:$,isPending:ge}=Vt({mailboxId:e,onAfterOptimisticRemove:Q}),{accountId:H}=Nn(e),Re=po({accounts:a}),{moveMessages:Ee,isPending:pe}=qt({mailboxId:e,accountId:H,onAfterOptimisticRemove:Q}),ie=Ji(zn(zi(ee?.pages.flatMap(S=>S.items??[])??[])),_,H),Y=l.useCallback(S=>{k(S)},[]),te=l.useCallback(S=>{j(J=>{const G=new Set(J);return G.has(S)?G.delete(S):G.add(S),G})},[]),X=l.useCallback(()=>{k("all"),j(new Set)},[]),Ie=Yi.get(p),Z=Ie?{label:Ie,reach:_.length>0?"loaded-pages":Pi(N),onClear:X}:void 0,ce=Ki(d,u),B=Vi(ie,n,ce),[xe,tt]=l.useState(void 0);l.useEffect(()=>{B&&tt(B)},[B]);const O=qi(B,xe,n,ce),{selectedThreadId:st}=Gs({strict:!1}),nt=l.useMemo(()=>Ni(O,{messageId:n,threadId:ce?void 0:st,mailboxId:e}),[O,n,st,ce,e]),Oe=Dn(),{listCommandsRef:D,onTriageContextChange:Ae,focusedMessageId:we,selectedIds:Ve}=Oe,v=ie.find(S=>S.messageId===we)??O,ot=l.useRef(null);l.useEffect(()=>{const S=O?.messageId??null;S&&ot.current!==S&&O?.authenticity?.dkimMismatch&&(ot.current=S,f||g())},[O?.messageId,O?.authenticity?.dkimMismatch,f,g]);const qe=l.useRef(!1);l.useEffect(()=>{qe.current||i&&O?.messageId&&(qe.current=!0,So()&&!f&&m(!0))},[i,O?.messageId,f,m]);const it=xo({accounts:a})??0,W=_t(),{pushError:rt}=es(),ue=Fn({thread:O,mailboxId:e,accountId:H,onAfterOptimisticRemove:Q}),{draftsMailboxId:de}=_n(H),se=de!==void 0&&de===e,{archiveMailboxId:Ne}=Ln(H),je=Pn(),{requestCompose:K}=ue,ke=l.useCallback(()=>{K("reply")},[K]),at=l.useCallback(()=>{K("reply_all")},[K]),ne=l.useCallback(()=>{K("forward")},[K]),{state:F,openCompose:He,closeCompose:he}=bt(),lt=l.useCallback(()=>{He({mode:"new"})},[He]),Ue=l.useRef(n);l.useEffect(()=>{const S=Ue.current;Ue.current=n,!(!n||n===S)&&he()},[n,he]);const Qe=Lt({...Zt(),onError:S=>{rt(Ys("Couldn't discard draft","The draft wasn't deleted.",S))}}),V=l.useCallback(()=>{const S=F.outboxMessageId;S&&(Qe.mutate({path:{outboxMessageId:S}}),W.invalidateQueries({queryKey:Xt()}),he())},[F.outboxMessageId,Qe,W,he]),yt=l.useCallback(()=>{t({to:"/mail/$mailboxId",params:{mailboxId:e},search:S=>({...S,selectedMessageId:void 0,selectedThreadId:void 0})})},[e,t]),ct=l.useCallback(S=>S?je(S):[],[je]),{toggleStar:ze}=$n({threadId:v?.threadId??"",mailboxId:e}),{toggleReadFor:Me}=as({mailboxId:e,accountId:H}),{junkMailboxId:be}=ls(H),Je=be!=null&&be===e,De=cs(be,e),{candidates:ut}=Oi(Je?be:void 0),{moveMessages:Ge}=qt({mailboxId:e,threadId:v?.threadId,accountId:H,onAfterOptimisticRemove:Q}),{deleteMessages:dt}=Vt({mailboxId:e,threadId:v?.threadId,onAfterOptimisticRemove:Q}),{addressId:fe,address:Fe}=Bn(v),{updateFlags:_e}=Wn({addressId:fe,senderEmail:v?.fromEmail??void 0}),re=l.useCallback(()=>n||!we?!1:(t({to:"/mail/$mailboxId",params:{mailboxId:e},search:S=>({...S,selectedMessageId:we})}),!0),[n,we,e,t]),Ct=l.useCallback(()=>{re()||O&&K("reply")},[re,O,K]),It=l.useCallback(()=>{re()||O&&K("reply_all")},[re,O,K]),wt=l.useCallback(()=>{re()||O&&K("forward")},[re,O,K]),ve=l.useCallback(()=>ct(v),[ct,v]),jt=l.useCallback(()=>{if(D.current?.requestVerb("delete"))return;const S=ve();S.length>0&&dt(S)},[D,ve,dt]),kt=l.useCallback(()=>{if(D.current?.requestVerb("junk")||!De)return;const S=ve();S.length!==0&&(Kn(c,{count:S.length,senderTrust:v?.senderTrust??"unknown",wasRescuable:v?Vn(v):!1}),Ge(S,De))},[D,De,ve,Ge,c,v]),ht=l.useCallback(()=>{if(Ve.length>0){const S=!(v?.hasStars??!1),J=new Set(Ve);for(const G of ie)J.has(G.messageId)&&G.hasStars!==S&&ze(G.messageId,G.hasStars);return}v&&ze(v.messageId,v.hasStars)},[Ve,ie,v,ze]),ft=l.useCallback(()=>{if(D.current?.requestVerb("markRead"))return;const S=ve();if(S.length===0)return;const J=!(v?.isRead??!1);Me(S,J)},[D,ve,v,Me]),mt=l.useCallback(()=>{if(!fe)return;const S=Fe?.flags?.muted?.value!==!0;_e({muted:{value:S}})},[fe,Fe,_e]),Mt=l.useCallback(()=>{if(!fe)return;const S=Fe?.flags?.vip?.value!==!0;_e({vip:{value:S}})},[fe,Fe,_e]),Tt=l.useCallback(()=>{f||g()},[f,g]),Te=l.useCallback(S=>{t({to:S})},[t]),Le=se?"drafts":Ne===e?"archive":be===e?"junk":"inbox",gt=l.useRef("");l.useEffect(()=>{const S=gt.current;gt.current=C,C.length>0&&S.length===0&&c.recordEvent("search.submitted",{mailboxType:Le})},[C,Le,c]);const Rt=se&&F.isOpen&&!!F.outboxMessageId&&!O,{goBack:Ye,nextMessageId:Et,previousMessageId:Ot}=qn({context:Oe,orderedIds:ie.map(S=>S.messageId),selectedMessageId:n,enabled:!F.isOpen,onClose:yt,handlers:{reply:Ct,replyAll:It,forward:wt,delete:jt,toggleStar:ht,toggleRead:ft,muteSender:mt,blockSender:Tt,vipSender:Mt,markJunk:kt,toggleIntelligence:O?g:void 0,compose:lt,goBrief:()=>Te("/mail/brief"),goInbox:()=>Te("/mail/brief"),goSent:()=>Te("/mail/brief"),goFlagged:()=>Te("/mail/flagged"),goSettings:()=>Te("/settings")}});bo({enabled:F.isOpen,bindings:[{key:"Escape",handler:he,preventDefault:!0}]});const At={mailboxId:e,selectedMessageId:n,selectedThread:O,conversation:nt,threads:ie,isLoading:Se,isError:P,error:Ke,mailboxAccountId:H,mailboxName:Re,unreadCount:it,isDraftsMailbox:se,isSpamFolder:Je,rescueCandidates:ut,filterCategory:p,filterAttributes:I,onSelectFilterCategory:Y,onToggleFilterAttribute:te,onClearFilters:X,listFilter:Z,intelligenceOpen:f,onToggleIntelligence:g,handleDeselectIfRemoved:Q,searchPredicate:w&&_.length===0?N:void 0,onDeleteMessages:$,onMoveMessages:Ee,isDeleting:ge,isMoving:pe,onLoadMore:M,hasMore:ye,isLoadingMore:Ce,onTriageContextChange:Ae,listCommandsRef:D,onRetry:()=>oe(),toolbarComposeRequest:ue.composeRequest,onToolbarReply:ke,onToolbarReplyAll:at,onToolbarForward:ne,onClearComposeRequest:ue.clearComposeRequest,onToolbarDelete:ue.deleteThread,onToolbarStar:ue.toggleStar,onToolbarDiscardDraft:V,onToolbarMove:ue.moveThread,composeState:F,closeCompose:he,hasRemitDraftOpen:Rt,onBack:Ye,nextMessageId:Et,previousMessageId:Ot};return r.jsx(Cs.Provider,{value:At,children:s})}function Is(){const{mailboxId:e,selectedMessageId:n,threads:s,isLoading:t,isError:o,error:i,onDeleteMessages:c,onMoveMessages:a,isDeleting:u,isMoving:d,onLoadMore:f,hasMore:g,isLoadingMore:m,mailboxAccountId:y,mailboxName:C,unreadCount:w,isDraftsMailbox:T,isSpamFolder:x,rescueCandidates:p,onTriageContextChange:k,listCommandsRef:I,onRetry:j,filterCategory:R,filterAttributes:E,onSelectFilterCategory:A,onToggleFilterAttribute:z,onClearFilters:_,listFilter:N,searchPredicate:L}=St(),{searchQuery:U,searchInput:ee,accounts:Se,resultFolderIndex:P}=ts(),Ke=ps(),oe=We(),M=C??"Inbox",ye=l.useMemo(()=>hs(),[]),Ce=l.useMemo(()=>y?[y]:[],[y]),{hasNewMail:Q}=on(),{state:$,errorMessage:ge,refresh:H}=rn(Ce,{onSettled:j}),Re=l.useMemo(()=>r.jsx(an,{state:$,onRefresh:H,label:`Refresh ${M}`,errorMessage:ge,hasUpdate:Q(Ce)}),[$,H,M,ge,Q,Ce]),Ee=l.useMemo(()=>s.map(B=>Qn(B,P)),[s,P]),{hits:pe,isLoading:ie}=lo({mailboxId:e,filterCategory:R}),Y=l.useMemo(()=>Jn(pe,s.map(B=>B.threadId),P),[pe,s,P]),te=l.useCallback(B=>oe({to:"/mail/$mailboxId",params:{mailboxId:B.mailboxId??e},search:xe=>({...xe,q:ee||void 0,selectedMessageId:B.id,selectedThreadId:B.threadId})}),[e,oe,ee]);if(T&&y)return r.jsx(Uo,{mailboxId:e,accountId:y,selectedMessageId:n,imapThreads:s,title:C??"Drafts",unreadCount:w??void 0});const X=r.jsx(ji,{mailboxId:e,threads:s,selectedMessageId:n,isLoading:t,isError:o,error:i,onRetry:j,searchQuery:U,searchPredicate:L,onDeleteMessages:c,isDeleting:u,isMoving:d,onLoadMore:f,hasMore:g,isLoadingMore:m,accountId:y,listTitle:M,listFilter:N,listScopeLabel:M,hideHeader:!0,onTriageContextChange:k,commandsRef:I}),Ie=Se[0]?.accountId,Z=Ke==="phone"&&Ie?r.jsx(Ti,{accountId:Ie,children:X}):X,ce=x&&p.length>0&&y?r.jsx(Ri,{accountId:y,currentMailboxId:e,candidates:p,onMove:a,children:Z}):Z;return r.jsx(eo,{title:M,unreadCount:w,preset:ye,selectedCategory:R,activeFilters:E,onSelectCategory:A,onToggleFilter:z,onClearFilters:_,searchResults:Ee,searchLoading:t,relatedResults:Y,relatedLoading:ie,onSelectSearchResult:te,searchResultsInBody:!0,refreshControl:Re,children:ce})}function Zi(){const{mailboxId:e,mailboxAccountId:n,selectedThread:s,conversation:t,hasRemitDraftOpen:o,intelligenceOpen:i,onToggleIntelligence:c,toolbarComposeRequest:a,onToolbarReply:u,onToolbarReplyAll:d,onToolbarForward:f,onClearComposeRequest:g,onToolbarDelete:m,onToolbarStar:y,onToolbarDiscardDraft:C,onToolbarMove:w,composeState:T}=St(),x=Xs()?.showIntelligencePane??!1,p=!!t,k=x&&p,I=T.isOpen&&!t?r.jsx(bs,{}):t?r.jsx(us,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onOpenIntelligence:t.authenticity?.dkimMismatch?c:void 0,composeRequest:a,onComposeClose:g}):r.jsx(nn,{});return r.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[r.jsx(Un,{hasThread:p,intelligenceOpen:k&&i,canToggleIntelligence:k,onToggleIntelligence:c,onReply:p?u:void 0,onReplyAll:p?d:void 0,onForward:p?f:void 0,canDelete:p||o,onDelete:p?m:o?C:void 0,onToggleStar:p?y:void 0,isStarred:s?.hasStars,moveContext:p&&n?{accountId:n,currentMailboxId:e,onMove:w}:void 0}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:I})]})}function er(){const{mailboxId:e,mailboxAccountId:n,selectedThread:s,onToggleIntelligence:t,handleDeselectIfRemoved:o}=St();return r.jsx(ds,{onClose:t,thread:s,mailboxId:e,accountId:n,onAfterOptimisticRemove:o})}function tr(){const{mailboxId:e,mailboxAccountId:n,selectedThread:s,conversation:t,intelligenceOpen:o,onToggleIntelligence:i,onBack:c,nextMessageId:a,previousMessageId:u,composeState:d,handleDeselectIfRemoved:f}=St(),g=We();if(t){const m=y=>g({to:"/mail/$mailboxId",params:{mailboxId:e},search:C=>({...C,selectedMessageId:y,selectedThreadId:void 0})});return r.jsxs(r.Fragment,{children:[r.jsx(us,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:c,onOpenIntelligence:i,onSwipeNext:a?()=>m(a):void 0,onSwipePrevious:u?()=>m(u):void 0,mobileIntelligenceOpen:o}),r.jsx(Hn,{isOpen:o,onClose:i,ariaLabel:"Message details",side:"right",children:r.jsx(ds,{onClose:i,thread:s,mailboxId:e,accountId:n,hideCloseButton:!0,onAfterOptimisticRemove:f})})]})}return d.isOpen?r.jsx("div",{className:"h-full",children:r.jsx(bs,{})}):r.jsx(Is,{})}const jr=Object.assign(Xi,{List:Is,Reading:Zi,Intelligence:er,Phone:tr});export{jr as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as re,j as e,b as z,ai as V,am as oe,r as i,az as he,aC as A,aj as F,q as xe,ad as X,$ as fe,ah as ye,w as Q,aD as Y,W as ne,B as C,al as D,ag as ge,ak as ve,ay as q,av as be,I as je}from"./index-CNoNYU4b.js";import{K as Se}from"./kbd-BrhLdlau.js";import{c as we,M as ke}from"./account-form-helpers-Bsx48lx1.js";const K=re("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);const Ce=re("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function Ne({url:t}){return e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Stored encrypted, used only to connect to your mail server."," ",t?e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"How to create an app password"}):e.jsx("span",{children:"Check your provider's help for app password instructions."})]})}function Ee({raised:t,className:o,...s}){return e.jsx("div",{className:z("rounded-sm border border-line bg-surface",t?"bg-surface-raised shadow-sm":"",o),...s})}function J({value:t,defaultValue:o,onValueChange:s,...a}){return s?e.jsxs(V,{value:t,onChange:n=>s(n.target.value),...a,children:[e.jsx("option",{value:"tls",children:"TLS/SSL"}),e.jsx("option",{value:"starttls",children:"STARTTLS"}),e.jsx("option",{value:"none",children:"None (insecure)"})]}):e.jsxs(V,{defaultValue:o??t,...a,children:[e.jsx("option",{value:"tls",children:"TLS/SSL"}),e.jsx("option",{value:"starttls",children:"STARTTLS"}),e.jsx("option",{value:"none",children:"None (insecure)"})]})}function G(t){return{tls:t==="tls",startTls:t==="starttls"}}function Te({steps:t,activeStep:o}){return e.jsx("ol",{className:"flex items-center gap-1",children:t.map((s,a)=>{const n=a<o,r=a===o;return e.jsxs("li",{className:"flex items-center gap-1",children:[a>0&&e.jsx("span",{className:"h-px w-5 bg-line","aria-hidden":!0}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:z("flex size-5 items-center justify-center rounded-full text-2xs font-semibold tabular-nums",n&&"bg-accent text-accent-fg",r&&"bg-accent-soft text-accent ring-1 ring-accent",!n&&!r&&"bg-surface-sunken text-fg-subtle"),children:n?e.jsx(oe,{className:"size-3"}):a+1}),e.jsx("span",{className:z("hidden text-2xs sm:inline",r?"font-medium text-fg":"text-fg-subtle"),children:s})]})]},s)})})}function L({steps:t,activeStep:o,title:s,subtitle:a,children:n,footer:r,hideSteps:u}){return e.jsxs("div",{className:"flex min-h-dvh w-full flex-col items-center overflow-y-auto bg-canvas pb-[max(2rem,env(safe-area-inset-bottom,0px))] pl-[max(2rem,env(safe-area-inset-left,0px))] pr-[max(2rem,env(safe-area-inset-right,0px))] pt-[max(2rem,env(safe-area-inset-top,0px))] font-sans text-fg sm:pt-[30vh]",children:[!u&&e.jsx("div",{className:"mb-5 w-full max-w-xl",children:e.jsx(Te,{steps:t,activeStep:o})}),e.jsxs(Ee,{raised:!0,className:"w-full max-w-xl",children:[e.jsxs("div",{className:"px-5 pt-5",children:[e.jsx("h1",{className:"text-xl font-semibold text-fg",children:s}),a&&e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:a})]}),e.jsx("div",{className:"px-5 py-5",children:n}),r&&e.jsx("div",{className:"flex items-center justify-between gap-3 border-t border-line px-5 py-3",children:r})]})]})}const Pe="Coming soon — use IMAP for now.";function W({name:t,description:o,icon:s,comingSoon:a,selected:n,onSelect:r}){const[u,h]=i.useState(!1),c=()=>{if(r){r();return}a&&h(!0)};return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("button",{type:"button",onClick:c,"aria-disabled":a||void 0,className:z("flex flex-col items-start gap-2 rounded-sm border p-3 text-left transition-colors",n?"border-accent-2 bg-accent-2-soft":"border-line bg-surface hover:border-line-strong",a&&"opacity-55"),children:[e.jsx("span",{className:z("text-fg-muted",n&&"text-accent-2"),children:s}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-fg",children:t}),a&&e.jsx("span",{className:"rounded-full bg-surface-sunken px-1.5 py-0.5 text-2xs text-fg-subtle",children:"soon"})]}),e.jsx("span",{className:"text-xs text-fg-subtle",children:o})]}),u&&e.jsx("p",{className:"text-2xs text-fg-subtle",children:Pe})]})}function Z({legend:t,badge:o,host:s,port:a,security:n,readOnly:r,onHostChange:u,onPortChange:h,onSecurityChange:c,hostPlaceholder:v,portPlaceholder:j}){const S=i.useId(),y=i.useId(),w=i.useId();return e.jsxs("fieldset",{children:[e.jsxs("legend",{className:"flex items-center gap-2 text-sm font-semibold text-fg",children:[t,o&&e.jsx(he,{tone:o.tone,children:o.label})]}),e.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-3 sm:grid-cols-[1fr_6rem_8rem] sm:gap-2",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:S,children:"Host"}),u?e.jsx(F,{id:S,readOnly:r,value:s,onChange:x=>u(x.target.value),placeholder:v}):e.jsx(F,{id:S,readOnly:r,defaultValue:s,placeholder:v})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:y,children:"Port"}),h?e.jsx(F,{id:y,readOnly:r,value:a,onChange:x=>h(x.target.value),placeholder:j}):e.jsx(F,{id:y,readOnly:r,defaultValue:a,placeholder:j})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:w,children:"Security"}),c?e.jsx(J,{id:w,value:n,onValueChange:c}):e.jsx(J,{id:w,defaultValue:n})]})]})]})}function _({label:t,detail:o,state:s}){return e.jsxs("div",{className:"flex items-start gap-3 py-2",children:[e.jsxs("span",{className:z("mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full text-2xs",s==="ok"&&"bg-positive text-accent-fg",s==="failed"&&"bg-danger text-accent-fg",s==="running"&&"border border-accent text-accent",s==="pending"&&"border border-line text-fg-subtle"),children:[s==="ok"&&e.jsx(oe,{className:"size-3"}),s==="failed"&&"!",s==="running"&&e.jsx("span",{className:"size-2 animate-pulse rounded-full bg-accent"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:z("text-sm",s==="failed"?"font-medium text-danger":"text-fg"),children:t}),o&&e.jsx("div",{className:"mt-0.5 text-xs text-fg-subtle",children:o})]})]})}const Ie=(t,o)=>{const s=i.useRef(o);s.current=o,i.useEffect(()=>{if(!t)return;const a=()=>{document.visibilityState==="visible"&&s.current()};return document.addEventListener("visibilitychange",a),window.addEventListener("pageshow",a),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pageshow",a)}},[t])},Ae={"gmail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"googlemail.com":{imap:{host:"imap.gmail.com",port:993,security:"tls"},smtp:{host:"smtp.gmail.com",port:587,security:"starttls"},source:"provider-table"},"outlook.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"hotmail.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"live.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"msn.com":{imap:{host:"outlook.office365.com",port:993,security:"tls"},smtp:{host:"smtp.office365.com",port:587,security:"starttls"},source:"provider-table"},"icloud.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"me.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"mac.com":{imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},source:"provider-table"},"fastmail.com":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"fastmail.fm":{imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},source:"provider-table"},"yahoo.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"yahoo.co.uk":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"ymail.com":{imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},source:"provider-table"},"aol.com":{imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},source:"provider-table"},"zoho.com":{imap:{host:"imap.zoho.com",port:993,security:"tls"},smtp:{host:"smtp.zoho.com",port:465,security:"tls"},source:"provider-table"},"gmx.com":{imap:{host:"imap.gmx.com",port:993,security:"tls"},smtp:{host:"smtp.gmx.com",port:587,security:"starttls"},source:"provider-table"},"gmx.net":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"gmx.de":{imap:{host:"imap.gmx.net",port:993,security:"tls"},smtp:{host:"mail.gmx.net",port:587,security:"starttls"},source:"provider-table"},"web.de":{imap:{host:"imap.web.de",port:993,security:"tls"},smtp:{host:"smtp.web.de",port:587,security:"starttls"},source:"provider-table"},"mail.com":{imap:{host:"imap.mail.com",port:993,security:"tls"},smtp:{host:"smtp.mail.com",port:465,security:"tls"},source:"provider-table"},"hey.com":{imap:{host:"imap.hey.com",port:993,security:"tls"},smtp:{host:"smtp.hey.com",port:465,security:"tls"},source:"provider-table"},"tutanota.com":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"tuta.io":{imap:{host:"mail.tutanota.com",port:993,security:"tls"},smtp:{host:"mail.tutanota.com",port:465,security:"tls"},source:"provider-table"},"posteo.de":{imap:{host:"posteo.de",port:993,security:"tls"},smtp:{host:"posteo.de",port:465,security:"tls"},source:"provider-table"},"runbox.com":{imap:{host:"imap.runbox.com",port:993,security:"tls"},smtp:{host:"smtp.runbox.com",port:587,security:"starttls"},source:"provider-table"},"mailbox.org":{imap:{host:"imap.mailbox.org",port:993,security:"tls"},smtp:{host:"smtp.mailbox.org",port:465,security:"tls"},source:"provider-table"},"hushmail.com":{imap:{host:"imap.hushmail.com",port:993,security:"tls"},smtp:{host:"smtp.hushmail.com",port:465,security:"tls"},source:"provider-table"}},Le={"gmail.com":"https://support.google.com/accounts/answer/185833","googlemail.com":"https://support.google.com/accounts/answer/185833","yahoo.com":"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html","icloud.com":"https://support.apple.com/en-us/102654","me.com":"https://support.apple.com/en-us/102654","mac.com":"https://support.apple.com/en-us/102654","fastmail.com":"https://www.fastmail.help/hc/en-us/articles/360058752854","fastmail.fm":"https://www.fastmail.help/hc/en-us/articles/360058752854","outlook.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","hotmail.com":"https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9","zoho.com":"https://help.zoho.com/portal/en/kb/zoho-mail/client-configuration/imap-access/articles/zoho-mail-app-passwords"};function ae(t){try{const s=new DOMParser().parseFromString(t,"application/xml");if(s.querySelector("parsererror"))return null;const a=s.querySelectorAll("incomingServer[type='imap']"),n=s.querySelectorAll("outgoingServer[type='smtp']");if(!a.length||!n.length)return null;const r=a[0],u=n[0],h=r.querySelector("hostname")?.textContent?.trim(),c=r.querySelector("port")?.textContent?.trim(),v=r.querySelector("socketType")?.textContent?.trim().toUpperCase(),j=u.querySelector("hostname")?.textContent?.trim(),S=u.querySelector("port")?.textContent?.trim(),y=u.querySelector("socketType")?.textContent?.trim().toUpperCase();if(!h||!c||!j||!S)return null;const w=x=>x==="SSL"||x==="TLS"||x==="SSL/TLS"?"tls":x==="STARTTLS"?"starttls":"none";return{imap:{host:h,port:Number.parseInt(c,10),security:w(v)},smtp:{host:j,port:Number.parseInt(S,10),security:w(y)},source:"mozilla-autoconfig"}}catch{return null}}async function Me(t,o){try{const s=`https://autoconfig.thunderbird.net/v1.1/${t}`,a=await fetch(s,{signal:o});if(!a.ok)return null;const n=await a.text(),r=ae(n);return r||null}catch{return null}}async function Fe(t,o){try{const s=`https://autoconfig.${t}/mail/config-v1.1.xml`,a=await fetch(s,{signal:o});if(!a.ok)return null;const n=await a.text(),r=ae(n);return r?{...r,source:"domain-autoconfig"}:null}catch{return null}}function Re(t){return{imap:{host:`imap.${t}`,port:993,security:"tls"},smtp:{host:`smtp.${t}`,port:587,security:"starttls"},source:"heuristic"}}async function Oe(t,o=1500){const s=t.indexOf("@");if(s===-1)return null;const a=t.slice(s+1).toLowerCase();if(!a)return null;const n=Ae[a];if(n)return n;const r=new AbortController,u=setTimeout(()=>r.abort(),o);try{const h=await Me(a,r.signal);if(h)return h;const c=await Fe(a,r.signal);if(c)return c}finally{clearTimeout(u)}return Re(a)}function ze(t){const o=t.indexOf("@");return o===-1?"Looking up server settings…":`Looking up settings for ${t.slice(o+1)}…`}function ie(t){const o=t.indexOf("@");if(o===-1)return;const s=t.slice(o+1).toLowerCase();return Le[s]}const ce=[{id:"icloud",label:"iCloud",username:"full-email",imap:{host:"imap.mail.me.com",port:993,security:"tls"},smtp:{host:"smtp.mail.me.com",port:587,security:"starttls"},passwordHelp:{text:"iCloud requires an app-specific password, not your Apple ID password. Generate one under Sign-In & Security → App-Specific Passwords.",url:"https://support.apple.com/en-us/102654"}},{id:"yahoo",label:"Yahoo",username:"full-email",imap:{host:"imap.mail.yahoo.com",port:993,security:"tls"},smtp:{host:"smtp.mail.yahoo.com",port:465,security:"tls"},passwordHelp:{text:"Yahoo requires an app password, not your login password. Generate one under Account Security.",url:"https://help.yahoo.com/kb/generate-manage-third-party-passwords-sln15241.html"}},{id:"aol",label:"AOL",username:"full-email",imap:{host:"imap.aol.com",port:993,security:"tls"},smtp:{host:"smtp.aol.com",port:465,security:"tls"},passwordHelp:{text:"AOL requires an app password, not your login password. Generate one under Account Security.",url:"https://login.aol.com/account/security"}},{id:"fastmail",label:"Fastmail",username:"full-email",imap:{host:"imap.fastmail.com",port:993,security:"tls"},smtp:{host:"smtp.fastmail.com",port:465,security:"tls"},passwordHelp:{text:"Fastmail requires an app password, not your login password. Create one under Settings → Privacy & Security → App passwords.",url:"https://www.fastmail.help/hc/en-us/articles/360058752854"}}];function ee(t){return ce.find(o=>o.id===t)}const _e={"icloud.com":"icloud","me.com":"icloud","mac.com":"icloud","yahoo.com":"yahoo","yahoo.co.uk":"yahoo","ymail.com":"yahoo","aol.com":"aol","fastmail.com":"fastmail","fastmail.fm":"fastmail"};function He(t){const o=t.indexOf("@");if(o===-1)return"";const s=t.slice(o+1).toLowerCase();return _e[s]??""}const M=["Connector","Address","Servers","Credentials","Test","Sync"],R={connector:0,address:1,servers:2,credentials:3,test:4,sync:5},te={host:"",port:993,security:"tls"},se={host:"",port:587,security:"starttls"};function $e({onStart:t}){return i.useEffect(()=>{const o=s=>{s.key==="Enter"&&t()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t]),e.jsx(L,{steps:M,activeStep:0,hideSteps:!0,title:"Welcome to Remit",subtitle:"One inbox for all your mail, with context about every message.",footer:e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-2xs text-fg-subtle",children:[e.jsx(Se,{children:"Enter"})," to continue"]}),e.jsx(C,{variant:"primary",onClick:t,children:"Add your first account"})]}),children:e.jsxs("div",{className:"flex flex-col items-start py-5",children:[e.jsx("span",{className:"flex size-14 items-center justify-center rounded-md bg-accent-soft",children:e.jsx(ke,{className:"size-7 text-accent"})}),e.jsx("p",{className:"mt-5 max-w-sm text-sm leading-relaxed text-fg-muted",children:"Remit syncs your existing mailboxes and tells you who is really writing to you — sender history, authenticity checks, and similar messages, right next to every email."})]})})}function De({onContinue:t,onMicrosoft:o,onBack:s,showBack:a}){const[n,r]=i.useState("imap");i.useEffect(()=>{const h=c=>{c.key==="Enter"&&(n==="microsoft"?o():t()),c.key==="Escape"&&s()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[t,o,s,n]);const u=()=>{n==="microsoft"?o():t()};return e.jsx(L,{steps:M,activeStep:R.connector,title:"How does this account connect?",subtitle:"Choose a sign-in method. IMAP works with any provider.",footer:e.jsxs(e.Fragment,{children:[a?e.jsx(C,{variant:"ghost",onClick:s,children:"Back"}):e.jsx("span",{}),e.jsx(C,{variant:"primary",onClick:u,children:n==="microsoft"?"Continue with Microsoft":"Continue with IMAP"})]}),children:e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[e.jsx(W,{name:"IMAP / SMTP",description:"Any mail provider — Fastmail, iCloud, your own server.",icon:e.jsx(Ce,{className:"size-5"}),selected:n==="imap",onSelect:()=>r("imap")}),e.jsx(W,{name:"Gmail",description:"Sign in with Google. No app passwords.",icon:e.jsx(K,{className:"size-5"}),comingSoon:!0}),e.jsx(W,{name:"Outlook / Microsoft 365",description:"Sign in with Microsoft. Works with Outlook.com and work accounts.",icon:e.jsx(je,{className:"size-5"}),selected:n==="microsoft",onSelect:()=>r("microsoft")})]})})}function qe({onBack:t,onConnected:o}){const[s,a]=i.useState(""),[n,r]=i.useState(null),[u,h]=i.useState(!1),[c,v]=i.useState(!1),j=i.useRef(!0);i.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]);const S=i.useRef(new Set),{refetch:y}=Q(ne()),w=X({...be(),onSuccess:p=>{j.current&&(h(!0),window.location.assign(p.authorizationUrl))},onError:p=>{v(!1),r(p instanceof Error?p.message:"Failed to start sign-in")}});Ie(u,i.useCallback(()=>{v(!1),y().then(({data:p,isError:m})=>{if(!j.current)return;if(m||!p){r("Couldn't check whether the sign-in finished. Open Settings › Accounts to see whether the account is connected.");return}r(null);const N=p.accounts.find(b=>!S.current.has(b.accountId));N&&o(N.accountId)})},[y,o]));const x=c||w.isPending,f=()=>{x||(r(null),v(!0),y().then(({data:p,isError:m})=>{if(j.current){if(m||!p){v(!1),r("Couldn't read this instance's accounts, so sign-in can't be tracked. Check your connection and try again.");return}S.current=new Set(p.accounts.map(N=>N.accountId)),w.mutate({body:{email:s.trim()||void 0}})}}))},l=i.useRef(f);return l.current=f,i.useEffect(()=>{const p=m=>{m.key==="Enter"&&l.current(),m.key==="Escape"&&t()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[t]),e.jsx(L,{steps:M,activeStep:R.connector,title:"Sign in with Microsoft",subtitle:"You'll be redirected to Microsoft to sign in securely.",footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:t,children:"Back"}),e.jsx(C,{variant:"primary",onClick:f,disabled:x,icon:x?e.jsx(D,{className:"size-4 animate-spin"}):void 0,children:x?"Redirecting…":u?"Start over":"Sign in with Microsoft"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"microsoft-email",children:"Email address (optional)"}),e.jsx(F,{id:"microsoft-email",icon:e.jsx(K,{className:"size-4"}),placeholder:"you@outlook.com",value:s,onChange:p=>a(p.target.value),type:"email",autoComplete:"email"}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"Pre-fills the Microsoft sign-in form. Leave blank to choose on the Microsoft page."})]}),u&&e.jsx(q,{tone:"info",children:"Waiting for Microsoft. Finish signing in — this window carries on the moment the account is connected, wherever you finished."}),n&&e.jsx(q,{tone:"danger",children:n})]})})}function Ge({initialEmail:t,initialDisplayName:o,onContinue:s,onBack:a}){const[n,r]=i.useState(t),[u,h]=i.useState(o),[c,v]=i.useState(!1),[j,S]=i.useState(""),[y,w]=i.useState(null),x=i.useCallback(async()=>{const f=n.trim();if(!f.includes("@")||!f.includes(".")){w("Enter a valid email address.");return}w(null),v(!0),S(ze(f));try{const l=await Oe(f);s(f,u.trim(),l)}finally{v(!1)}},[n,u,s]);return i.useEffect(()=>{const f=l=>{l.key==="Enter"&&!c&&x(),l.key==="Escape"&&a()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[x,c,a]),e.jsx(L,{steps:M,activeStep:R.address,title:"What's the email address?",subtitle:"We'll detect the server settings for you.",footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:a,children:"Back"}),e.jsx(C,{variant:"primary",disabled:c,onClick:()=>{x()},children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"onboarding-email",children:"Email address"}),e.jsx(F,{id:"onboarding-email",icon:e.jsx(K,{className:"size-4"}),placeholder:"you@example.com",value:n,onChange:f=>{r(f.target.value),w(null)},type:"email",autoComplete:"email"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"onboarding-display-name",children:"Display name (optional)"}),e.jsx(F,{id:"onboarding-display-name",placeholder:"Alice",value:u,onChange:f=>h(f.target.value)}),e.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"What to call this account in Remit. Leave blank to use a name derived from the address."})]}),c&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(D,{className:"size-3.5 animate-spin text-accent"}),j]}),y&&!c&&e.jsx("div",{className:"mt-3",children:e.jsx(q,{tone:"danger",children:y})})]})})}function Be({email:t,imapConfig:o,smtpConfig:s,discovered:a,onContinue:n,onBack:r,onChange:u}){const[h,c]=i.useState(o),[v,j]=i.useState(s),[S,y]=i.useState(()=>He(t)),[w,x]=i.useState(!1),[f,l]=i.useState(null),p=ee(S),m=p!==void 0&&!w,N=i.useCallback(g=>{y(g),x(!1),l(null);const d=ee(g);d&&(c({host:d.imap.host,port:d.imap.port,security:d.imap.security}),j({host:d.smtp.host,port:d.smtp.port,security:d.smtp.security}))},[]);i.useEffect(()=>{u(h,v)},[h,v,u]);const b=h.host.trim()!=="",k=i.useCallback(()=>{if(!b){l("Enter the IMAP host.");return}l(null),n()},[b,n]);i.useEffect(()=>{const g=d=>{d.key==="Enter"&&k(),d.key==="Escape"&&r()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[k,r]);const T=t.split("@")[1]??"your domain",O=p?"Pick your provider to fill in the right settings — or choose Custom to enter them by hand.":a?"Found via autodiscovery — adjust anything that looks off.":`We couldn't detect settings for ${T} — enter them manually.`,P=m?{label:"preset",tone:"neutral"}:!p&&a?{label:"detected",tone:"positive"}:void 0,I=p?.passwordHelp.url??ie(t);return e.jsx(L,{steps:M,activeStep:R.servers,title:"Confirm server settings",subtitle:O,footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:r,children:"Back"}),e.jsx(C,{variant:"primary",onClick:k,children:"Continue"})]}),children:e.jsxs("div",{className:"space-y-5",children:[f&&e.jsx(q,{tone:"danger",children:f}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"provider-select",children:"Provider"}),e.jsxs(V,{id:"provider-select",value:S,onChange:g=>N(g.target.value),children:[e.jsx("option",{value:"",children:"Custom / other"}),ce.map(g=>e.jsx("option",{value:g.id,children:g.label},g.id))]}),p&&e.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:m?e.jsxs(e.Fragment,{children:["Server settings are pre-filled for ",p.label," and locked."," ",e.jsx("button",{type:"button",className:"text-accent underline",onClick:()=>x(!0),children:"Advanced"})," ","lets you edit them by hand."]}):e.jsxs(e.Fragment,{children:["Editing ",p.label,"'s settings by hand."]})})]}),e.jsx(Z,{legend:"IMAP — incoming",badge:P,readOnly:m,host:h.host,port:String(h.port),security:h.security,hostPlaceholder:"imap.example.com",portPlaceholder:"993",onHostChange:g=>{c(d=>({...d,host:g})),l(null)},onPortChange:g=>c(d=>({...d,port:Number(g)})),onSecurityChange:g=>c(d=>({...d,security:g}))}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"Sending (SMTP) is optional — leave it blank to set up a receive-only account and add sending later in Settings."}),e.jsx(Z,{legend:"SMTP — outgoing (optional)",badge:P,readOnly:m,host:v.host,port:String(v.port),security:v.security,hostPlaceholder:"smtp.example.com",portPlaceholder:"587",onHostChange:g=>{j(d=>({...d,host:g})),l(null)},onPortChange:g=>j(d=>({...d,port:Number(g)})),onSecurityChange:g=>j(d=>({...d,security:g}))}),p&&e.jsxs("p",{className:"text-2xs text-fg-subtle",children:[p.passwordHelp.text," ",I&&e.jsx("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"text-accent underline",children:"Get an app password"})]})]})})}function Ue({email:t,username:o,password:s,onContinue:a,onBack:n,onChange:r}){const[u,h]=i.useState(o||t),[c,v]=i.useState(s),[j,S]=i.useState(null),y=t.split("@")[1]??"",w=ie(t),x=u.trim()!==""&&c.trim()!=="";i.useEffect(()=>{r(u,c)},[u,c,r]);const f=i.useCallback(()=>{if(!x){S("Enter your username and password.");return}S(null),a()},[x,a]);return i.useEffect(()=>{const l=p=>{p.key==="Enter"&&f(),p.key==="Escape"&&n()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[f,n]),e.jsx(L,{steps:M,activeStep:R.credentials,title:`Sign in to ${y||"your mail server"}`,subtitle:"Many providers require an app password instead of your normal one.",footer:e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:n,children:"Back"}),e.jsx(C,{variant:"primary",onClick:f,children:"Test connection"})]}),children:e.jsxs("div",{className:"space-y-3",children:[j&&e.jsx("div",{className:"rounded-md bg-danger-soft px-3 py-2 text-sm text-danger",children:j}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"credentials-username",children:"Username"}),e.jsx(F,{id:"credentials-username",value:u,onChange:l=>{h(l.target.value),S(null)},autoComplete:"username"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"credentials-password",children:"Password or app password"}),e.jsx(ve,{id:"credentials-password",value:c,onChange:l=>{v(l.target.value),S(null)},autoComplete:"current-password"})]}),e.jsx(Ne,{url:w})]})})}function We({email:t,imapConfig:o,smtpConfig:s,username:a,password:n,onSuccess:r,onBackToCredentials:u,onBackToServers:h}){const[c,v]=i.useState({imapState:"running",smtpState:"pending",phase:"running"}),[j,S]=i.useState(0),y=s.host.trim()!=="",w=G(o.security),x=G(s.security),f=X({...ge()});i.useEffect(()=>{let m=!1;const N=[];return v({imapState:"running",smtpState:"pending",phase:"running"}),f.mutate({body:{username:a,password:n,imapHost:o.host,imapPort:o.port,imapTls:w.tls,imapStartTls:w.startTls,smtpHost:s.host,smtpPort:s.port,smtpTls:x.tls,smtpStartTls:x.startTls}},{onSuccess:b=>{if(m)return;const k=b.imapSuccess,T=y?b.smtpSuccess:!0;v({imapState:k?"ok":"failed",smtpState:y?"running":"ok",imapDetail:k?`Connected — ${o.host}:${o.port}`:b.imapError,phase:"running"}),N.push(window.setTimeout(()=>{if(m)return;const O=I=>{const g=I?.toLowerCase()??"";return g.includes("auth")||g.includes("login")||g.includes("535")||g.includes("credential")},P=!k&&O(b.imapError)||k&&y&&!b.smtpSuccess&&O(b.smtpError);v({imapState:k?"ok":"failed",smtpState:y?b.smtpSuccess?"ok":"failed":"ok",imapDetail:k?`Connected — ${o.host}:${o.port}`:b.imapError,smtpDetail:y?b.smtpSuccess?`Connected — ${s.host}:${s.port}`:b.smtpError:"Not set up — receive-only",rawError:k?y&&!b.smtpSuccess?b.smtpError:void 0:b.imapError,phase:k&&T?"success":P?"auth-failure":"network-failure"}),k&&T&&N.push(window.setTimeout(()=>{m||r()},800))},400))},onError:b=>{if(m)return;const k=b instanceof Error?b.message:"Connection failed";v({imapState:"failed",smtpState:"failed",imapDetail:k,smtpDetail:k,rawError:k,phase:"network-failure"})}}),()=>{m=!0;for(const b of N)window.clearTimeout(b)}},[j]);const{phase:l}=c;i.useEffect(()=>{const m=N=>{N.key==="Escape"&&(l==="auth-failure"?u():l==="network-failure"&&h())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[l,u,h]);const p=l==="auth-failure"?e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:u,children:"Back to credentials"}),e.jsx(C,{variant:"primary",onClick:()=>S(m=>m+1),children:"Retry"})]}):l==="network-failure"?e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"ghost",onClick:h,children:"Back to servers"}),e.jsx(C,{variant:"primary",onClick:()=>S(m=>m+1),children:"Retry"})]}):l==="success"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Connection verified"}),e.jsx(C,{variant:"primary",onClick:r,children:"Start syncing"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Testing…"}),e.jsx("span",{})]});return e.jsx(L,{steps:M,activeStep:R.test,title:"Testing the connection",subtitle:`Checking ${t}`,footer:p,children:e.jsxs("div",{className:"divide-y divide-line",children:[e.jsx(_,{label:`IMAP — ${o.host}:${o.port}`,detail:c.imapDetail,state:c.imapState}),e.jsx(_,{label:y?`SMTP — ${s.host}:${s.port}`:"SMTP — sending",detail:y?c.smtpDetail:"Not set up — you can add sending later in Settings",state:c.smtpState}),(l==="auth-failure"||l==="network-failure")&&c.rawError&&e.jsxs("div",{className:"py-3",children:[l==="auth-failure"&&e.jsx("p",{className:"mb-2 text-xs text-fg-muted",children:"Check your password — many providers require an app password."}),e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:c.rawError})]})]})})}const Ve=2e4;function Qe({email:t,displayName:o,imapConfig:s,smtpConfig:a,username:n,password:r,onGoToInbox:u}){const h=xe(),[c,v]=i.useState(null),[j,S]=i.useState(null),y=i.useRef(!1),w=G(s.security),x=G(a.security),f=X({...ye(),onSuccess:E=>{v(E.accountId),h.invalidateQueries({queryKey:fe()})},onError:E=>{S(E instanceof Error?E.message:"Failed to create account")}});i.useEffect(()=>{if(y.current)return;y.current=!0;const E=a.host.trim()!=="",H=we({imapHost:s.host,smtpHost:a.host,smtpPort:a.port}),$=E?H??{smtpHost:a.host,smtpPort:a.port,smtpTls:x.tls,smtpStartTls:x.startTls}:null;f.mutate({body:{email:t,displayName:o||void 0,username:n!==t?n:void 0,password:r,imapHost:s.host,imapPort:s.port,imapTls:w.tls,imapStartTls:w.startTls,smtpHost:$?.smtpHost||void 0,smtpPort:$?.smtpPort||void 0,smtpTls:$?.smtpTls??!1,smtpStartTls:$?.smtpStartTls??!1}})},[]);const{data:l,isError:p}=Q({...Y({path:{accountId:c??""}}),enabled:!!c,refetchInterval:E=>{const H=E.state.data?.syncPhase;return H==="complete"||H==="error"?!1:2e3}}),m=l?.syncPhase==="error",{data:N}=Q({...ne(),enabled:!!c&&m}),b=N?.accounts.find(E=>E.accountId===c)?.lastError,k=l?.mailboxes.find(E=>E.fullPath==="INBOX"||E.fullPath==="Inbox"),T=l?.mailboxCountTotal??0,O=l?.mailboxCountSynced??0,P=k?.messagesTotal??0,I=k?.messagesSynced??0,g=P>0?I/P:0,d=l?.syncPhase,le=m?"failed":d==="idle"||d===void 0||d==="discovering_mailboxes"?"running":T>0?"ok":"running",B=m?"failed":!d||d==="idle"||d==="discovering_mailboxes"?"pending":d==="syncing_inbox"||d==="syncing_others"?"running":"ok",U=m?"failed":!d||d==="idle"||d==="discovering_mailboxes"||d==="syncing_inbox"?"pending":d==="syncing_others"?"running":"ok",me=I>0||k?.phase==="complete"||d==="complete"||m,[ue,de]=i.useState(!1);i.useEffect(()=>{if(!c)return;const E=setTimeout(()=>de(!0),Ve);return()=>clearTimeout(E)},[c]);const pe=!!c&&(me||p||ue);return j?e.jsx(L,{steps:M,activeStep:R.sync,title:"Couldn't create account",subtitle:"Something went wrong saving your account.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{}),e.jsx(C,{variant:"primary",onClick:()=>{y.current=!1,S(null),f.mutate({body:{email:t,displayName:o||void 0,username:n!==t?n:void 0,password:r,imapHost:s.host,imapPort:s.port,imapTls:w.tls,imapStartTls:w.startTls,smtpHost:a.host||void 0,smtpPort:a.port||void 0,smtpTls:x.tls,smtpStartTls:x.startTls}})},children:"Retry"})]}),children:e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:j})}):e.jsx(L,{steps:M,activeStep:R.sync,title:`Syncing ${t}`,subtitle:"Newest mail first — you can start reading right away.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Sync continues in the background"}),pe?e.jsx(C,{variant:"primary",onClick:()=>c&&u(c),children:"Go to inbox"}):e.jsx(C,{variant:"primary",disabled:!0,icon:e.jsx(D,{className:"size-3.5 animate-spin"}),children:"Getting your mail…"})]}),children:f.isPending?e.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-fg-muted",children:[e.jsx(D,{className:"size-4 animate-spin text-accent"}),"Creating your account…"]}):e.jsxs("div",{className:"space-y-3",children:[P>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between text-xs",children:[e.jsx("span",{className:"font-medium text-fg",children:"INBOX"}),e.jsxs("span",{className:"text-fg-subtle tabular-nums",children:[I.toLocaleString()," / ",P.toLocaleString()," ","messages"]})]}),e.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-surface-sunken",children:e.jsx("div",{className:"h-full rounded-full bg-accent transition-all duration-500",style:{width:`${Math.max(2,g*100)}%`}})})]}),e.jsxs("div",{className:"divide-y divide-line",children:[e.jsx(_,{label:"Mailboxes discovered",detail:T>0?`${T} mailbox${T===1?"":"es"} found`:"Discovering…",state:le}),e.jsx(_,{label:"INBOX",detail:B==="ok"?`${I.toLocaleString()} messages synced`:B==="running"?"Syncing newest first…":"Queued",state:B}),O>1||d==="syncing_others"||d==="complete"?e.jsx(_,{label:"Other mailboxes",detail:U==="ok"?`${O-1} mailboxes synced`:U==="running"?"Syncing…":"Queued",state:U}):null]}),m&&e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("p",{className:"text-xs text-danger",children:["Sync stalled. The account is still active —"," ",e.jsx("button",{type:"button",className:"underline",onClick:()=>{h.invalidateQueries({queryKey:Y({path:{accountId:c??""}}).queryKey})},children:"retry"})]}),b&&e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:b})]})]})})}function Je({skipWelcome:t=!1,onComplete:o,onCancel:s}){const[a,n]=i.useState(t?"connector":"welcome"),[r,u]=i.useState({email:"",displayName:"",imapConfig:te,smtpConfig:se,username:"",password:"",discoveryResult:null,discovered:!1,createdAccountId:null}),h=i.useCallback(()=>n("connector"),[]),c=i.useCallback(()=>n("address"),[]),v=i.useCallback(()=>n("microsoft-email"),[]),j=i.useCallback(()=>{t?s?.():n("welcome")},[t,s]),S=i.useCallback((l,p,m)=>{let N=te,b=se,k=!1;m&&(k=m.source!=="heuristic",N={host:m.imap.host,port:m.imap.port,security:m.imap.security},b={host:m.smtp.host,port:m.smtp.port,security:m.smtp.security}),u(T=>({...T,email:l,displayName:p,imapConfig:N,smtpConfig:b,discoveryResult:m,discovered:k,username:l})),n("servers")},[]),y=i.useCallback((l,p)=>{u(m=>({...m,imapConfig:l,smtpConfig:p}))},[]),w=i.useCallback((l,p)=>{u(m=>({...m,username:l,password:p}))},[]),x=i.useCallback(()=>n("sync"),[]),f=i.useCallback(l=>{o(l)},[o]);switch(a){case"welcome":return e.jsx($e,{onStart:h});case"connector":return e.jsx(De,{onContinue:c,onMicrosoft:v,onBack:j,showBack:!t});case"microsoft-email":return e.jsx(qe,{onBack:()=>n("connector"),onConnected:f});case"address":return e.jsx(Ge,{initialEmail:r.email,initialDisplayName:r.displayName,onContinue:S,onBack:()=>n("connector")});case"servers":return e.jsx(Be,{email:r.email,imapConfig:r.imapConfig,smtpConfig:r.smtpConfig,discovered:r.discovered,onContinue:()=>n("credentials"),onBack:()=>n("address"),onChange:y});case"credentials":return e.jsx(Ue,{email:r.email,username:r.username,password:r.password,onContinue:()=>n("test"),onBack:()=>n("servers"),onChange:w});case"test":return e.jsx(We,{email:r.email,imapConfig:r.imapConfig,smtpConfig:r.smtpConfig,username:r.username,password:r.password,onSuccess:x,onBackToCredentials:()=>n("credentials"),onBackToServers:()=>n("servers")});case"sync":return e.jsx(Qe,{email:r.email,displayName:r.displayName,imapConfig:r.imapConfig,smtpConfig:r.smtpConfig,username:r.username,password:r.password,onGoToInbox:f})}}export{Je as O,ce as P,ee as g,G as s,Ie as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a1 as m,j as o,_ as p}from"./index-CNoNYU4b.js";import{a as e}from"./search-view-CXPbecDB.js";import{M as r}from"./MailboxPane-Cpo0ICDX.js";import{u as a}from"./useSearchMirror--YnVEyRo.js";import"./search-scope-Ds_ghZOi.js";import"./useSearchTokenContext-DIryp5er.js";import"./kbd-BrhLdlau.js";import"./enums-CCxx0t2v.js";import"./useRefreshControl-B41i_Tqe.js";import"./circle-check-big-DT6yugdt.js";import"./search-token-index-BTQUgi2G.js";import"./useMediaQuery-CAv9qAps.js";import"./MailListHeader-CaZUuANM.js";import"./account-form-helpers-Bsx48lx1.js";import"./avatar-DdSaEl5o.js";import"./useSignature-C0EjJ_Wk.js";import"./useDebouncedValue-CQf4QpzS.js";import"./ErrorState-DZM_kyxb.js";import"./format-De9HZKjg.js";import"./download-LYnnm2y0.js";import"./shield-check-CA34sFyn.js";import"./nav-link-BCGmsThK.js";import"./move-options-Cg4YrriV.js";import"./useFilters-CaSSUNWE.js";import"./confirm-dialog-DKl9zp18.js";import"./clock-CQOmlok1.js";import"./menu-Bo_ZQ3dZ.js";import"./MailViewChrome-ClVgpPFO.js";import"./NavMenuButton-D-esVAha.js";import"./useLabels-DKpzozgD.js";import"./useSemanticSearch-DDwHlaH_.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DmAG_FCk.js";import"./circle-help-BJ-e95sd.js";import"./circle-check-DZneB6gk.js";import"./intelligence-pref-C6lFpj6U.js";function J(){const{mailboxId:t}=m.useParams(),{selectedMessageId:i}=m.useSearch();return a({to:"/mail/$mailboxId",params:{mailboxId:t}}),o.jsx(r,{mailboxId:t,selectedMessageId:i,children:o.jsx(e,{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 r}from"./index-CNoNYU4b.js";import{B as o}from"./BriefPane-BJxOwp8m.js";import"./useSearchTokenContext-DIryp5er.js";import"./kbd-BrhLdlau.js";import"./enums-CCxx0t2v.js";import"./search-scope-Ds_ghZOi.js";import"./MailListHeader-CaZUuANM.js";import"./search-token-index-BTQUgi2G.js";import"./useMediaQuery-CAv9qAps.js";import"./account-form-helpers-Bsx48lx1.js";import"./avatar-DdSaEl5o.js";import"./useSignature-C0EjJ_Wk.js";import"./useDebouncedValue-CQf4QpzS.js";import"./ErrorState-DZM_kyxb.js";import"./format-De9HZKjg.js";import"./download-LYnnm2y0.js";import"./shield-check-CA34sFyn.js";import"./nav-link-BCGmsThK.js";import"./move-options-Cg4YrriV.js";import"./useFilters-CaSSUNWE.js";import"./confirm-dialog-DKl9zp18.js";import"./clock-CQOmlok1.js";import"./menu-Bo_ZQ3dZ.js";import"./useRefreshControl-B41i_Tqe.js";import"./circle-check-big-DT6yugdt.js";import"./useLabels-DKpzozgD.js";import"./useSemanticSearch-DDwHlaH_.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-CNoNYU4b.js";import{O as t}from"./OutboxPane-HUY9JhOn.js";import"./useSearchTokenContext-DIryp5er.js";import"./kbd-BrhLdlau.js";import"./enums-CCxx0t2v.js";import"./search-scope-Ds_ghZOi.js";import"./circle-check-big-DT6yugdt.js";import"./clock-CQOmlok1.js";import"./row-actions-ExiBwpBF.js";import"./rotate-ccw-Dc0Ronfg.js";import"./NavMenuButton-D-esVAha.js";import"./menu-Bo_ZQ3dZ.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-CNoNYU4b.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r,a6 as ke,B as ee,a as ks,X as Ve,a7 as Vs,a8 as Ds,a9 as dt,r as C,b as Nt,aa as X,q as ut,ab as Cs,w as Xt,W as es,ac as Fs,ad as Se,ae as Os,$ as Ae,af as ts,ag as Is,ah as Ms,ai as Rs,aj as ve,ak as At,al as at,am as Tt,J as Et,an as Ls,ao as Ie,ap as be,aq as _t,m as Us,ar as zs,as as Hs,at as ss,au as Pt,o as Bs,av as qs,aw as $s,ax as Ws,ay as kt,az as Ks,aA as Vt,aB as Gs,T as Ys}from"./index-CNoNYU4b.js";import{R as Qs}from"./row-actions-ExiBwpBF.js";import{S as Zs,A as Js}from"./settings-screen-x0E-yYQb.js";import{g as Dt,P as Xs,s as Be,u as er,O as tr}from"./OnboardingWizard-Dv0CNLJu.js";import{u as sr}from"./useSignature-C0EjJ_Wk.js";import{c as rr,a as Ct,d as ar}from"./account-form-helpers-Bsx48lx1.js";import{D as ir}from"./download-LYnnm2y0.js";import{E as nr}from"./ErrorState-DZM_kyxb.js";import{f as or}from"./format-De9HZKjg.js";import"./avatar-DdSaEl5o.js";import"./menu-Bo_ZQ3dZ.js";import"./circle-help-BJ-e95sd.js";import"./kbd-BrhLdlau.js";const lr=e=>{const s=new Set(e.map(Vs));return Ds.map(t=>t.tag).filter(t=>!s.has(t)).sort((t,i)=>ke(t).localeCompare(ke(i)))},cr=({value:e,onChange:s,busy:t=!1})=>{const i=lr(e);return r.jsxs("div",{className:"space-y-2","data-testid":"compose-language-setting",children:[r.jsx("ul",{className:"space-y-1",children:e.map((o,d)=>r.jsxs("li",{"data-testid":`compose-language-row-${o}`,className:"flex items-center gap-2 rounded-md border border-line bg-surface-sunken px-3 py-1.5",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-fg",lang:o,children:ke(o)}),d===0?r.jsx("span",{className:"shrink-0 text-2xs uppercase tracking-wider text-fg-subtle",children:"Default"}):r.jsx(ee,{variant:"ghost",size:"sm",icon:r.jsx(ks,{className:"size-3.5"}),disabled:t,"aria-label":`Write new messages in ${ke(o)} by default`,onClick:()=>s([o,...e.filter(n=>n!==o)]),children:"Default"}),r.jsx(ee,{variant:"ghost",size:"sm",icon:r.jsx(Ve,{className:"size-3.5"}),disabled:t||e.length===1,"aria-label":`Remove ${ke(o)}`,onClick:()=>s(e.filter(n=>n!==o))})]},o))}),r.jsxs("select",{"aria-label":"Add a language",value:"",disabled:t||i.length===0,onChange:o=>{o.target.value!==""&&s([...e,o.target.value])},className:"w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none transition-colors focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30",children:[r.jsx("option",{value:"",children:"Add a language…"}),i.map(o=>r.jsx("option",{value:o,children:ke(o)},o))]}),r.jsx("p",{className:"text-xs text-fg-muted",children:"A message is tagged with the language you write it in, picked from this list. Your browser, not this app, decides which dictionaries it spellchecks against — add the language there too to get its underlines."})]})};function dr({title:e,description:s,action:t}){return r.jsxs("div",{className:"rounded-sm border border-danger/50",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-danger/30 bg-danger-soft px-row-inset py-2",children:[r.jsx(dt,{className:"size-4 text-danger"}),r.jsx("h2",{className:"text-sm font-semibold text-danger",children:"Danger zone"})]}),r.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium text-fg",children:e}),r.jsx("p",{className:"text-xs text-fg-muted",children:s})]}),r.jsx("div",{className:"shrink-0",children:t})]})]})}function Ft({isOpen:e,onClose:s,title:t,children:i,footer:o}){return C.useEffect(()=>{if(!e)return;const d=n=>{n.key==="Escape"&&s()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,s]),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:Nt("fixed inset-0 z-40 bg-black/30 transition-opacity",e?"opacity-100":"pointer-events-none opacity-0"),onClick:s,"aria-hidden":"true"}),r.jsxs("div",{className:Nt("safe-area-frame fixed top-0 right-0 z-50 h-full w-full border-l border-line bg-canvas shadow-xl sm:w-[400px] sm:max-w-[90vw]","transform transition-transform duration-200 ease-out",e?"translate-x-0":"pointer-events-none translate-x-full"),role:"dialog","aria-modal":"true","aria-hidden":!e,inert:!e,"aria-labelledby":"slide-panel-title",children:[r.jsxs("div",{className:"flex h-14 items-center justify-between border-b border-line px-4",children:[r.jsx("h2",{id:"slide-panel-title",className:"font-semibold",children:t}),r.jsx("button",{type:"button",onClick:s,className:"rounded-md p-1.5 transition-colors hover:bg-surface-raised","aria-label":"Close",children:r.jsx(Ve,{className:"size-5"})})]}),r.jsxs("div",{className:"flex h-[calc(100%-3.5rem)] flex-col",children:[r.jsx("div",{className:"flex-1 overflow-auto p-4",children:i}),o&&r.jsx("div",{className:"flex justify-end gap-3 border-t border-line bg-canvas p-4",children:o})]})]})]})}var Le=e=>e.type==="checkbox",je=e=>e instanceof Date,Y=e=>e==null;const ft=e=>typeof e=="object";var H=e=>!Y(e)&&!Array.isArray(e)&&ft(e)&&!je(e),ur=e=>H(e)&&e.target?Le(e.target)?e.target.checked:e.target.value:e,fr=(e,s)=>s.split(".").some((t,i,o)=>!isNaN(Number(t))&&e.has(o.slice(0,i).join("."))),rs=e=>{const s=e.constructor&&e.constructor.prototype;return H(s)&&s.hasOwnProperty("isPrototypeOf")},Ye=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function B(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(Ye&&(e instanceof Blob||s))return e;const t=Array.isArray(e);if(!t&&!(H(e)&&rs(e)))return e;const i=t?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=B(e[o]));return i}const _e={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},ue={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},de={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},as="root",mt=["__proto__","constructor","prototype"],mr=/^\w*$/;var Ue=e=>mr.test(e),L=e=>e===void 0;const hr=/[.[\]'"]/;var Qe=e=>e.split(hr).filter(Boolean),y=(e,s,t)=>{if(!s||!H(e))return t;const i=Ue(s)?[s]:Qe(s);if(i.some(d=>mt.includes(d)))return t;const o=i.reduce((d,n)=>Y(d)?void 0:d[n],e);return L(o)||o===e?L(e[s])?t:e[s]:o},me=e=>typeof e=="boolean",ie=e=>typeof e=="function",F=(e,s,t)=>{let i=-1;const o=Ue(s)?[s]:Qe(s),d=o.length,n=d-1;for(;++i<d;){const u=o[i];let j=t;if(i!==n){const E=e[u];j=H(E)||Array.isArray(E)?E:isNaN(+o[i+1])?{}:[]}if(mt.includes(u))return;e[u]=j,e=e[u]}};const pr=X.createContext(null);pr.displayName="HookFormControlContext";var gr=(e,s,t,i=!0)=>{const o={};for(const d in e)Object.defineProperty(o,d,{get:()=>{const n=d;return s._proxyFormState[n]!==ue.all&&(s._proxyFormState[n]=!i||ue.all),e[n]}});return o};const xr=Ye?X.useLayoutEffect:X.useEffect;var Q=e=>typeof e=="string",yr=(e,s,t,i,o)=>Q(e)?(i&&s.watch.add(e),y(t,e,o)):Array.isArray(e)?e.map(d=>(i&&s.watch.add(d),y(t,d))):(i&&(s.watchAll=!0),t),it=e=>Y(e)||!ft(e);const Ot=(e,s)=>s.length===0&&!Array.isArray(e)&&!rs(e);function he(e,s,t=new WeakMap){if(e===s)return!0;if(it(e)||it(s))return Object.is(e,s);if(je(e)&&je(s))return Object.is(e.getTime(),s.getTime());const i=Object.keys(e),o=Object.keys(s);if(i.length!==o.length)return!1;if(Ot(e,i)||Ot(s,o))return Object.is(e,s);if(!i.length&&Array.isArray(e)!==Array.isArray(s))return!1;const d=t.get(e);if(d&&d.has(s))return!0;if(d)d.add(s);else{const n=new WeakSet;n.add(s),t.set(e,n)}for(const n of i){const u=e[n];if(!(n in s))return!1;if(n!=="ref"){const j=s[n];if(je(u)&&je(j)||(H(u)||Array.isArray(u))&&(H(j)||Array.isArray(j))?!he(u,j,t):!Object.is(u,j))return!1}}return!0}var qe=e=>({isOnSubmit:!e||e===ue.onSubmit,isOnBlur:e===ue.onBlur,isOnChange:e===ue.onChange,isOnAll:e===ue.all,isOnTouch:e===ue.onTouched}),tt=(e,s,t)=>{if(t)return!1;if(s.watchAll||s.watch.has(e))return!0;for(const i of s.watch)if(e.startsWith(i)&&e.charAt(i.length)===".")return!0;return!1};const Re=(e,s,t,i)=>{for(const o of t||Object.keys(e)){const d=y(e,o);if(d){const{_f:n,...u}=d;if(n){if(n.refs&&n.refs[0]&&s(n.refs[0],o)&&!i)return!0;if(n.ref&&s(n.ref,n.name)&&!i)return!0;if(Re(u,s))break}else if(H(u)&&Re(u,s))break}}};var It=(e,s,t)=>{const i=y(e,t),o=Array.isArray(i)?i:[];return F(o,as,s[t]),F(e,t,o),e},G=e=>H(e)&&!Object.keys(e).length,ht=e=>e.type==="file",Ke=e=>{if(!Ye)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},pt=e=>e.type==="radio",Ge=e=>e instanceof RegExp,gt=(e,s,t,i,o)=>s?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[i]:o||!0}}:{};const Mt={value:!1,isValid:!1},Rt={value:!0,isValid:!0};var is=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!L(e[0].attributes.value)?L(e[0].value)||e[0].value===""?Rt:{value:e[0].value,isValid:!0}:Rt:Mt}return Mt};const Lt={isValid:!1,value:null};var ns=e=>Array.isArray(e)?e.reduce((s,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:s,Lt):Lt;function Ut(e,s,t="validate"){if(Q(e)||Array.isArray(e)&&e.every(Q)||me(e)&&!e)return{type:t,message:Q(e)?e:"",ref:s}}var Pe=e=>H(e)&&!Ge(e)?e:{value:e,message:""},zt=async(e,s,t,i,o,d)=>{const{ref:n,refs:u,required:j,maxLength:E,minLength:_,min:z,max:R,pattern:O,validate:T,name:f,valueAsNumber:b,mount:ae}=e._f,N=y(t,f);if(!ae||s.has(f))return{};const W=u?u[0]:n,I=P=>{if(o&&W.reportValidity){const k=me(P)?"":P||"";u?u.forEach(D=>D.setCustomValidity(k)):W.setCustomValidity(k),W.reportValidity()}},A={},ne=pt(n),re=Le(n),pe=ne||re,oe=(b||ht(n))&&L(n.value)&&L(N)||Ke(n)&&n.value===""||N===""||Array.isArray(N)&&!N.length,K=gt.bind(null,f,i,A),te=(P,k,D,$=de.maxLength,w=de.minLength)=>{const M=P?k:D;A[f]={type:P?$:w,message:M,ref:n,...K(P?$:w,M)}};if(d?!Array.isArray(N)||!N.length:j&&(!pe&&(oe||Y(N))||me(N)&&!N||re&&!is(u).isValid||ne&&!ns(u).isValid)){const{value:P,message:k}=Q(j)?{value:!!j,message:j}:Pe(j);if(P&&(A[f]={type:de.required,message:k,ref:W,...K(de.required,k)},!i))return I(k),A}if(!oe&&(!Y(z)||!Y(R))){let P,k;const D=Pe(R),$=Pe(z);if(!Y(N)&&!isNaN(N)){const w=n.valueAsNumber||N&&+N;Y(D.value)||(P=w>D.value),Y($.value)||(k=w<$.value)}else{const w=n.valueAsDate||new Date(N),M=ge=>new Date(new Date().toDateString()+" "+ge),le=n.type=="time",Z=n.type=="week";Q(D.value)&&N&&(P=le?M(N)>M(D.value):Z?N>D.value:w>new Date(D.value)),Q($.value)&&N&&(k=le?M(N)<M($.value):Z?N<$.value:w<new Date($.value))}if((P||k)&&(te(!!P,D.message,$.message,de.max,de.min),!i))return I(A[f].message),A}if((E||_)&&!oe&&(Q(N)||d&&Array.isArray(N))){const P=Pe(E),k=Pe(_),D=!Y(P.value)&&N.length>+P.value,$=!Y(k.value)&&N.length<+k.value;if((D||$)&&(te(D,P.message,k.message),!i))return I(A[f].message),A}if(O&&!oe&&Q(N)){const{value:P,message:k}=Pe(O);if(Ge(P)&&!N.match(P)&&(A[f]={type:de.pattern,message:k,ref:n,...K(de.pattern,k)},!i))return I(k),A}if(T){if(ie(T)){const P=await T(N,t),k=Ut(P,W);if(k&&(A[f]={...k,...K(de.validate,k.message)},!i))return I(k.message),A}else if(H(T)){let P={};for(const k in T){if(!G(P)&&!i)break;const D=Ut(await T[k](N,t),W,k);D&&(P={...D,...K(k,D.message)},I(D.message),i&&(A[f]=P))}if(!G(P)&&(A[f]={ref:W,...P},!i))return A}}return I(!0),A},We=e=>Array.isArray(e)?e:[e],os=e=>Array.isArray(e)?e.filter(Boolean):[];function vr(e,s){const t=s.slice(0,-1).length;let i=0;for(;i<t;){if(Y(e)){e=void 0;break}e=e[s[i]],i++}return e}function br(e){for(const s in e)if(e.hasOwnProperty(s)&&!L(e[s]))return!1;return!0}function q(e,s){if(Q(s)&&Object.prototype.hasOwnProperty.call(e,s))return delete e[s],e;const t=Array.isArray(s)?s:Ue(s)?[s]:Qe(s);if(t.some(n=>mt.includes(String(n))))return e;const i=t.length===1?e:vr(e,t),o=t.length-1,d=t[o];return i&&delete i[d],o!==0&&(H(i)&&G(i)||Array.isArray(i)&&br(i))&&q(e,t.slice(0,-1)),e}const ls=e=>{const s={};for(const t of Object.keys(e))if(ft(e[t])&&e[t]!==null&&!je(e[t])){const i=ls(e[t]);for(const o of Object.keys(i))s[`${t}.${o}`]=i[o]}else s[t]=e[t];return s},jr=X.createContext(null);jr.displayName="HookFormContext";var Ht=()=>{let e=[];return{get observers(){return e},next:o=>{for(const d of e)d.next&&d.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(d=>d!==o)}}),unsubscribe:()=>{e=[]}}};function cs(e,s){const t={};for(const i in e)if(e.hasOwnProperty(i)){const o=e[i],d=s[i];if(o&&H(o)&&d){const n=cs(o,d);H(n)&&(t[i]=n)}else e[i]&&(t[i]=d)}return t}var ds=e=>e.type==="select-multiple",Sr=e=>pt(e)||Le(e),st=e=>Ke(e)&&e.isConnected,wr=e=>{for(const s in e)if(ie(e[s]))return!0;return!1};function us(e){return Array.isArray(e)||H(e)&&!wr(e)}function fs(e){return!!(e&&"_f"in e)}function ms(e){return Array.isArray(e)?!e.some(s=>!L(s)):!Object.keys(e).length}function nt(e,s){Array.isArray(e)?e[s]=void 0:delete e[s]}function ot(e,s={},t){for(const i in e){const o=e[i],d=t&&t[i];us(o)&&(!Array.isArray(o)||!fs(d))?(s[i]=Array.isArray(o)?[]:{},ot(o,s[i],d),ms(s[i])&&nt(s,i)):L(o)||(s[i]=!0)}return s}function Ne(e,s,t,i){t||(t=ot(s,{},i));for(const o in e){const d=e[o],n=i&&i[o];us(d)&&(!Array.isArray(d)||!fs(n))?(L(s)||it(t[o])?t[o]=ot(d,Array.isArray(d)?[]:{},n):Ne(d,Y(s)?{}:s[o],t[o],n),ms(t[o])&&nt(t,o)):he(d,s[o])?nt(t,o):t[o]=!0}return t}var hs=(e,{valueAsNumber:s,valueAsDate:t,setValueAs:i})=>L(e)?e:s?e===""?NaN:e&&+e:t&&Q(e)?new Date(e):i?i(e):e;function Bt(e){const s=e.ref;return ht(s)?s.files:pt(s)?ns(e.refs).value:ds(s)?[...s.selectedOptions].map(({value:t})=>t):Le(s)?is(e.refs).value:hs(L(s.value)?e.ref.value:s.value,e)}var Nr=(e,s,t,i)=>{const o={};for(const d of e){const n=y(s,d);n&&F(o,d,n._f)}return{criteriaMode:t,names:[...e],fields:o,shouldUseNativeValidation:i}},Me=e=>L(e)?e:Ge(e)?e.source:H(e)?Ge(e.value)?e.value.source:e.value:e;const qt="AsyncFunction";var Ar=e=>{if(!e||!e.validate)return!1;if(ie(e.validate))return e.validate.constructor.name===qt;if(H(e.validate)){for(const s in e.validate)if(e.validate[s].constructor.name===qt)return!0}return!1},Tr=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function $t(e,s,t){const i=y(e,t);if(i||Ue(t))return{error:i,name:t};const o=t.split(".");for(;o.length;){const d=o.join("."),n=y(s,d),u=y(e,d);if(n&&!Array.isArray(n)&&t!==d)return{name:t};if(u&&u.type)return{name:d,error:u};if(u&&u.root&&u.root.type)return{name:`${d}.root`,error:u.root};o.pop()}return{name:t}}var Er=(e,s,t,i)=>{t(e);const{name:o,...d}=e,n=Object.keys(d);return!n.length||i&&n.length>=Object.keys(s).length||n.find(u=>s[u]===(!i||ue.all))},_r=(e,s,t)=>!e||!s||e===s||We(e).some(i=>i&&(t?i===s||i.startsWith(s+"."):i.startsWith(s)||s.startsWith(i))),Pr=(e,s,t,i,o)=>o.isOnAll?!1:!t&&o.isOnTouch?!(s||e):(t?i.isOnBlur:o.isOnBlur)?!e:(t?i.isOnChange:o.isOnChange)?e:!0,kr=(e,s)=>!os(y(e,s)).length&&q(e,s);const Vr={mode:ue.onSubmit,reValidateMode:ue.onChange,shouldFocusError:!0},rt="form",ps={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function Dr(e={}){let s={...Vr,...e},t={...B(ps),isLoading:ie(s.defaultValues),errors:s.errors||{},disabled:s.disabled||!1},i={},o=H(s.defaultValues)||H(s.values)?B(s.defaultValues||s.values)||{}:{},d=s.shouldUnregister?{}:B(o),n={action:!1,mount:!1,watch:!1,keepIsValid:!1},u={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const j={},E={};let _=0,z=qe(s.mode),R=qe(s.reValidateMode);const O={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},T={...O};let f={...T};const b={array:Ht(),state:Ht()};let ae=0;const N=s.criteriaMode===ue.all,W=(a,l)=>c=>{clearTimeout(E[a]),E[a]=setTimeout(l,c)},I=async a=>{if(!n.keepIsValid&&!s.disabled&&(T.isValid||f.isValid||a)){const l=++ae;let c;s.resolver?(c=G((await D()).errors),l===ae&&A()):c=await M({fields:i,onlyCheckValid:!0,eventType:_e.VALID}),l===ae&&c!==t.isValid&&b.state.next({isValid:c})}},A=(a,l)=>{!s.disabled&&(T.isValidating||T.validatingFields||f.isValidating||f.validatingFields)&&((a||Array.from(u.mount)).forEach(c=>{c&&(l?F(t.validatingFields,c,l):q(t.validatingFields,c))}),b.state.next({validatingFields:t.validatingFields,isValidating:!G(t.validatingFields)}))},ne=()=>{t.dirtyFields=Ne(o,d,void 0,i)},re=(a,l=[],c,m,h=!0,x=!0)=>{if(m&&c&&!s.disabled){if(n.action=!0,x&&Array.isArray(y(i,a))){const g=c(y(i,a),m.argA,m.argB);h&&F(i,a,g)}if(x&&Array.isArray(y(t.errors,a))){const g=c(y(t.errors,a),m.argA,m.argB);h&&F(t.errors,a,g),kr(t.errors,a)}if((T.touchedFields||f.touchedFields)&&x&&Array.isArray(y(t.touchedFields,a))){const g=c(y(t.touchedFields,a),m.argA,m.argB);h&&F(t.touchedFields,a,g)}(T.dirtyFields||f.dirtyFields)&&ne(),b.state.next({name:a,isDirty:Z(a,l),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else F(d,a,l)},pe=(a,l)=>{F(t.errors,a,l),t.errors={...t.errors},b.state.next({errors:t.errors})},oe=a=>{t.errors=a,b.state.next({errors:t.errors,isValid:!1})},K=a=>{const l=Ue(a)?[a]:Qe(a);let c=d,m=o;for(let h=0;h<l.length-1;h++){const x=l[h];if(c=Y(c)?c:c[x],m=Y(m)?m:m[x],c===null&&m!==null)return!0}return!1},te=(a,l,c,m)=>{const h=y(i,a);if(h){if(K(a))return;const x=L(y(d,a)),g=y(d,a,L(c)?y(o,a):c);L(g)||m&&m.defaultChecked||l?F(d,a,l?g:Bt(h._f)):De(a,g),n.mount&&!n.action&&(I(),x&&t.isDirty&&(T.isDirty||f.isDirty)&&(Z()||(t.isDirty=!1,b.state.next({...t}))),e.shouldUnregister&&x&&!L(y(d,a))&&tt(a,u)&&(n.watch=!0))}},P=(a,l,c,m,h)=>{let x=!1,g=!1;const v={name:a};if(!s.disabled||m===!0){if(!c||m){const S=he(y(o,a),l);(T.isDirty||f.isDirty)&&(g=t.isDirty,t.isDirty=v.isDirty=!S||Z(),x=g!==v.isDirty),g=!!y(t.dirtyFields,a),S!==t.isDirty?t.dirtyFields=Ne(o,d,void 0,i):S?q(t.dirtyFields,a):F(t.dirtyFields,a,!0),v.dirtyFields=t.dirtyFields,x=x||(T.dirtyFields||f.dirtyFields)&&g!==!S}if(c){const S=y(t.touchedFields,a);S||(F(t.touchedFields,a,c),v.touchedFields=t.touchedFields,x=x||(T.touchedFields||f.touchedFields)&&S!==c)}x&&h&&b.state.next(v)}return x?v:{}},k=(a,l,c,m)=>{const h=y(t.errors,a),x=(T.isValid||f.isValid)&&me(l)&&t.isValid!==l;if(s.delayError&&c?(j[a]=W(a,()=>pe(a,c)),j[a](s.delayError)):(clearTimeout(E[a]),delete j[a],c?F(t.errors,a,c):q(t.errors,a),t.errors={...t.errors}),(c?!he(h,c):h)||!G(m)||x){const g={...m,...x&&me(l)?{isValid:l}:{},errors:t.errors,name:a};t={...t,...g},b.state.next(g)}},D=async a=>(A(a,!0),await s.resolver(d,s.context,Nr(a||u.mount,i,s.criteriaMode,s.shouldUseNativeValidation))),$=async a=>{const{errors:l}=await D(a);if(A(a),a){for(const c of a){const m=y(l,c);m?u.array.has(c)&&H(m)&&!Object.keys(m).some(h=>!Number.isNaN(Number(h)))?It(t.errors,{[c]:m},c):F(t.errors,c,m):q(t.errors,c)}t.errors={...t.errors}}else t.errors=l;return l},w=async({name:a,eventType:l})=>{if(e.validate){const c=await e.validate({formValues:d,formState:t,name:a,eventType:l});if(H(c))for(const m in c){const h=c[m];h&&He(`${rt}.${m}`,{message:Q(h.message)?h.message:"",type:h.type||de.validate})}else Q(c)||!c?He(rt,{message:c||"",type:de.validate}):Ee(rt);return c}return!0},M=async({fields:a,onlyCheckValid:l,name:c,eventType:m,context:h={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(h.runRootValidation=!0,!await w({name:c,eventType:m})&&(h.valid=!1,l)))return h.valid;for(const x in a){const g=a[x];if(g){const{_f:v,...S}=g;if(v){const U=u.array.has(v.name),J=g._f&&Ar(g._f),xe=T.validatingFields||T.isValidating||f.validatingFields||f.isValidating;J&&xe&&A([v.name],!0);const ye=await zt(g,u.disabled,d,N,s.shouldUseNativeValidation&&!l,U);if(J&&xe&&A([v.name]),ye[v.name]&&(h.valid=!1,l)||(!l&&(y(ye,v.name)?U?It(t.errors,ye,v.name):F(t.errors,v.name,ye[v.name]):q(t.errors,v.name)),e.shouldUseNativeValidation&&ye[v.name]))break}!G(S)&&await M({context:h,onlyCheckValid:l,fields:S,name:x,eventType:m})}}return h.valid},le=()=>{for(const a of u.unMount){const l=y(i,a);l&&(l._f.refs?l._f.refs.every(c=>!st(c)):!st(l._f.ref))&&Je(a)}u.unMount=new Set},Z=(a,l)=>(a&&l&&F(d,a,l),!he(n.mount?d:o,o)),ge=(a,l,c)=>yr(a,u,{...n.mount?d:L(l)?o:Q(a)?{[a]:l}:l},c,l),Te=a=>os(y(n.mount?d:o,a,s.shouldUnregister?y(o,a,[]):[])),De=(a,l,c={},m=!1,h=!1)=>{const x=y(i,a);let g=l;if(x){const v=x._f;v&&(!v.disabled&&F(d,a,hs(l,v)),g=Ke(v.ref)&&Y(l)?"":l,ds(v.ref)?[...v.ref.options].forEach(S=>S.selected=g.includes(S.value)):v.refs?Le(v.ref)?v.refs.forEach(S=>{(!S.defaultChecked||!S.disabled)&&(Array.isArray(g)?S.checked=!!g.find(U=>U===S.value):S.checked=g===S.value||!!g)}):v.refs.forEach(S=>S.checked=S.value===g):ht(v.ref)?v.ref.value="":(v.ref.value=g,!v.ref.type&&!h&&b.state.next({name:a,values:m?d:B(d)})))}(c.shouldDirty||c.shouldTouch)&&P(a,g,c.shouldTouch,c.shouldDirty,!h),c.shouldValidate&&fe(a,{delayError:c.delayError})},ze=(a,l,c,m=!1,h=!1)=>{for(const x in l){if(!l.hasOwnProperty(x))return;const g=l[x],v=a+"."+x,S=y(i,v);(u.array.has(a)||H(g)||S&&!S._f)&&!je(g)?ze(v,g,c,m,h):De(v,g,c,m,h)}},Ze=(a,l,c,m,h=!1)=>{const x=y(i,a),g=u.array.has(a),v=m?l:B(l),S=y(d,a),U=he(S,v);if(U||F(d,a,v),g)b.array.next({name:a,values:m?d:B(d)}),(T.isDirty||T.dirtyFields||f.isDirty||f.dirtyFields)&&c.shouldDirty&&(ne(),h||b.state.next({name:a,dirtyFields:t.dirtyFields,isDirty:Z(a,v)}));else{const J=Array.isArray(v)&&!v.length||G(v);!x||x._f||Y(v)||J?De(a,v,c,m,h):ze(a,v,c,m,h)}if(!U&&!h){const J=tt(a,u),xe=m?d:B(d);b.state.next({...J&&t,name:n.mount||J?a:void 0,values:xe})}},p=(a,l,c={})=>Ze(a,l,c,!1),V=(a,l={})=>{const c=ie(a)?a(d):a;if(!he(d,c)){d={...d,...c};const m=ls(c);for(const h of u.mount)h in m&&Ze(h,m[h],l,!0,!0);b.state.next({...t,name:void 0,type:void 0,..._?{values:d}:{}}),l.shouldValidate&&I()}},ce=async a=>{n.mount=!0;const l=a.target;let c=l.name,m=!0;const h=y(i,c),x=g=>{m=Number.isNaN(g)||je(g)&&isNaN(g.getTime())||he(g,y(d,c,g))};if(h){let g,v;const S=l.type?Bt(h._f):ur(a),U=a.type===_e.BLUR||a.type===_e.FOCUS_OUT,J=!Tr(h._f)&&!e.validate&&!s.resolver&&!y(t.errors,c)&&!h._f.deps,xe=J||Pr(U,y(t.touchedFields,c),t.isSubmitted,R,z),ye=tt(c,u,U);if(F(d,c,S),U){if(!l||!l.readOnly){h._f.onBlur&&h._f.onBlur(a);const Oe=j[c];Oe&&Oe(0)}}else h._f.onChange&&h._f.onChange(a);const Fe=P(c,S,U),_s=!G(Fe)||ye;if(!U&&b.state.next({name:c,type:a.type,..._?{values:B(d)}:{}}),xe)return(!J||!t.isValid)&&(T.isValid||f.isValid)&&(s.mode==="onBlur"?U&&I():U||I()),_s&&b.state.next({name:c,...ye?{}:Fe});if(!s.resolver&&e.validate&&await w({name:c,eventType:a.type}),!U&&ye&&b.state.next({...t}),s.resolver){const{errors:Oe}=await D([c]);if(A([c]),x(S),!m){!G(Fe)&&b.state.next(Fe);return}const Ps=$t(t.errors,i,c),wt=$t(Oe,i,Ps.name||c);g=wt.error,c=wt.name,v=G(Oe)}else A([c],!0),g=(await zt(h,u.disabled,d,N,s.shouldUseNativeValidation))[c],A([c]),x(S),m&&(g?v=!1:(T.isValid||f.isValid)&&(v=await M({fields:i,onlyCheckValid:!0,name:c,eventType:a.type})));m&&(h._f.deps&&(!Array.isArray(h._f.deps)||h._f.deps.length>0)&&fe(h._f.deps),k(c,v,g,Fe))}},se=(a,l)=>{if(y(t.errors,l)&&a.focus)return a.focus(),1},fe=async(a,l={})=>{let c,m;const h=We(a);if(s.resolver){const x=await $(L(a)?a:h);c=G(x),m=a?!h.some(g=>y(x,g)):c}else a?(m=(await Promise.all(h.map(async x=>{const g=y(i,x);return await M({fields:g&&g._f?{[x]:g}:g,eventType:_e.TRIGGER})}))).every(Boolean),!(!m&&!t.isValid)&&I()):m=c=await M({fields:i,name:a,eventType:_e.TRIGGER});if(l.delayError&&s.delayError&&Q(a)){const x=y(t.errors,a);x?(q(t.errors,a),j[a]=W(a,()=>pe(a,x)),j[a](s.delayError)):(clearTimeout(E[a]),delete j[a])}return b.state.next({...!Q(a)||(T.isValid||f.isValid)&&c!==t.isValid?{}:{name:a},...s.resolver||!a?{isValid:c}:{},errors:t.errors}),l.shouldFocus&&!m&&Re(i,se,a?h:u.mount),m},we=(a,l)=>{let c={...n.mount?d:o};return l&&(c=cs(l.dirtyFields?t.dirtyFields:t.touchedFields,c)),L(a)?c:Q(a)?y(c,a):a.map(m=>y(c,m))},Ce=(a,l)=>({invalid:!!y((l||t).errors,a),isDirty:!!y((l||t).dirtyFields,a),error:y((l||t).errors,a),isValidating:!!y(t.validatingFields,a),isTouched:!!y((l||t).touchedFields,a)}),Ee=a=>{const l=a?We(a):void 0;l?.forEach(c=>q(t.errors,c)),l?l.forEach(c=>{b.state.next({name:c,errors:t.errors})}):b.state.next({errors:{}})},He=(a,l,c)=>{const m=(y(i,a,{_f:{}})._f||{}).ref,h=y(t.errors,a)||{},{ref:x,message:g,type:v,...S}=h;F(t.errors,a,{...S,...l,ref:m}),b.state.next({name:a,errors:t.errors,isValid:!1}),c&&c.shouldFocus&&m&&m.focus&&m.focus()},Ss=(a,l)=>{if(ie(a)){_++;const{unsubscribe:c}=b.state.subscribe({next:h=>"values"in h&&a(h.values||ge(void 0,l),h)});let m=!1;return{unsubscribe:()=>{m||(m=!0,_--,c())}}}return ge(a,l,!0)},xt=a=>{var l;const c=!!(!((l=a.formState)===null||l===void 0)&&l.values);c&&_++;const{unsubscribe:m}=b.state.subscribe({next:x=>{if(_r(a.name,x.name,a.exact)&&Er(x,a.formState||T,Es,a.reRenderRoot)){const g={...d};a.callback({values:g,...t,...x,defaultValues:o})}}});if(!c)return m;let h=!1;return()=>{h||(h=!0,_--,m())}},ws=a=>(n.mount=!0,f={...f,...a.formState},xt({...a,formState:{...O,...a.formState}})),Je=(a,l={})=>{for(const c of a?We(a):u.mount)u.mount.delete(c),u.array.delete(c),l.keepValue||(q(i,c),q(d,c)),!l.keepError&&q(t.errors,c),!l.keepDirty&&q(t.dirtyFields,c),!l.keepTouched&&q(t.touchedFields,c),!l.keepIsValidating&&q(t.validatingFields,c),!s.shouldUnregister&&!l.keepDefaultValue&&q(o,c);b.state.next({values:B(d)}),b.state.next({...t,...l.keepDirty?{isDirty:Z()}:{}}),!l.keepIsValid&&I()},yt=({disabled:a,name:l})=>{if(me(a)&&n.mount||a||u.disabled.has(l)){const h=u.disabled.has(l)!==!!a;a?u.disabled.add(l):u.disabled.delete(l),h&&n.mount&&!n.action&&I()}},Xe=(a,l={})=>{let c=y(i,a);const m=me(l.disabled)||me(s.disabled),h=!u.registerName.has(a)&&c&&c._f&&!c._f.mount;return F(i,a,{...c||{},_f:{...c&&c._f?c._f:{ref:{name:a}},name:a,mount:!0,...l}}),u.mount.add(a),c&&!h?yt({disabled:me(l.disabled)?l.disabled:s.disabled,name:a}):te(a,!0,l.value),{...m?{disabled:l.disabled||s.disabled}:{},...s.progressive?{required:!!l.required,min:Me(l.min),max:Me(l.max),minLength:Me(l.minLength),maxLength:Me(l.maxLength),pattern:Me(l.pattern)}:{},name:a,onChange:ce,onBlur:ce,ref:x=>{if(x){u.registerName.add(a),Xe(a,l),u.registerName.delete(a),c=y(i,a);const g=L(x.value)&&x.querySelectorAll&&x.querySelectorAll("input,select,textarea")[0]||x,v=Sr(g),S=c._f.refs||[];if(v?S.find(U=>U===g):g===c._f.ref)return;F(i,a,{_f:{...c._f,...v?{refs:[...S.filter(st),g,...Array.isArray(y(o,a))?[{}]:[]],ref:{type:g.type,name:a}}:{ref:g}}}),te(a,!1,void 0,g)}else c=y(i,a,{}),c._f&&(c._f.mount=!1),(s.shouldUnregister||l.shouldUnregister)&&!(fr(u.array,a)&&n.action)&&u.unMount.add(a)}}},et=()=>s.shouldFocusError&&!s.shouldUseNativeValidation&&Re(i,se,u.mount),Ns=a=>{me(a)&&(b.state.next({disabled:a}),Re(i,(l,c)=>{const m=y(i,c);m&&(l.disabled=m._f.disabled||a,Array.isArray(m._f.refs)&&m._f.refs.forEach(h=>{h.disabled=m._f.disabled||a}))},0,!1))},vt=(a,l)=>async c=>{let m;c&&(c.preventDefault&&c.preventDefault(),c.persist&&c.persist());let h=B(d);if(b.state.next({isSubmitting:!0}),s.resolver){const{errors:x,values:g}=await D();A(),t.errors=x,h=B(g)}else await M({fields:i,eventType:_e.SUBMIT});if(u.disabled.size)for(const x of u.disabled)q(h,x);if(q(t.errors,as),G(t.errors)){b.state.next({errors:{}});try{await a(h,c)}catch(x){m=x}}else l&&await l({...t.errors},c),et(),setTimeout(et);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:G(t.errors)&&!m,submitCount:t.submitCount+1,errors:t.errors}),m)throw m},As=(a,l={})=>{y(i,a)&&(L(l.defaultValue)?p(a,B(y(o,a))):(p(a,l.defaultValue),F(o,a,B(l.defaultValue))),l.keepTouched||q(t.touchedFields,a),l.keepDirty||(q(t.dirtyFields,a),t.isDirty=l.defaultValue?Z(a,B(y(o,a))):Z()),l.keepError||(q(t.errors,a),T.isValid&&I()),b.state.next({...t}))},bt=(a,l={})=>{const c=a?B(a):o,m=B(c),h=G(a),x=m,g=i;if(l.keepDefaultValues||(o=c),!l.keepValues){if(l.keepDirtyValues){const v=new Set([...u.mount,...Object.keys(Ne(o,d,void 0,g))]);for(const S of Array.from(v)){const U=y(t.dirtyFields,S),J=y(d,S),xe=y(x,S);U&&!L(J)?F(x,S,J):!U&&!L(xe)&&p(S,xe)}}else{if(Ye&&L(a))for(const v of u.mount){const S=y(i,v);if(S&&S._f){const U=Array.isArray(S._f.refs)?S._f.refs[0]:S._f.ref;if(Ke(U)){const J=U.closest("form");if(J){J.reset();break}}}}if(l.keepFieldsRef)for(const v of u.mount)p(v,y(x,v));else i={}}if(s.shouldUnregister){if(d=l.keepDefaultValues?B(o):{},l.keepFieldsRef)for(const v of u.mount)F(d,v,y(x,v))}else d=B(x);b.array.next({values:{...x}}),b.state.next({name:void 0,type:void 0,values:{...x}})}u={mount:l.keepDirtyValues?u.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},n.mount=!T.isValid||!!l.keepIsValid||!!l.keepDirtyValues||!s.shouldUnregister&&!G(x),n.watch=!!s.shouldUnregister,n.keepIsValid=!!l.keepIsValid,n.action=!1,l.keepErrors||(t.errors={}),b.state.next({submitCount:l.keepSubmitCount?t.submitCount:0,isDirty:h?!1:l.keepDirty?t.isDirty:l.keepValues?Z():!!(l.keepDefaultValues&&!he(a,o)),isSubmitted:l.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:h?{}:l.keepDirtyValues?l.keepDefaultValues&&d?Ne(o,d,void 0,g):t.dirtyFields:l.keepDefaultValues&&a?Ne(o,a,void 0,g):l.keepDirty?t.dirtyFields:{},touchedFields:l.keepTouched?t.touchedFields:{},errors:l.keepErrors?t.errors:{},isSubmitSuccessful:l.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},jt=(a,l)=>bt(ie(a)?a(d):a,{...s.resetOptions,...l}),Ts=(a,l={})=>{const c=y(i,a),m=c&&c._f;if(m){const h=m.refs?m.refs[0]:m.ref;h.focus&&setTimeout(()=>{h.focus(),l.shouldSelect&&ie(h.select)&&h.select()})}},Es=a=>{const{name:l,type:c,values:m,...h}=a;t={...t,...h}},St={control:{register:Xe,unregister:Je,getFieldState:Ce,handleSubmit:vt,setError:He,_subscribe:xt,_runSchema:D,_updateIsValidating:A,_focusError:et,_getWatch:ge,_getDirty:Z,_setValid:I,_setFieldArray:re,_setDisabledField:yt,_setErrors:oe,_getFieldArray:Te,_reset:bt,_resetDefaultValues:()=>ie(s.defaultValues)&&s.defaultValues().then(a=>{jt(a,s.resetOptions),b.state.next({isLoading:!1})}),_removeUnmounted:le,_disableForm:Ns,_subjects:b,_proxyFormState:T,get _fields(){return i},get _formValues(){return d},get _state(){return n},set _state(a){n=a},get _defaultValues(){return o},get _names(){return u},set _names(a){u=a},get _formState(){return t},get _options(){return s},set _options(a){s={...s,...a},z=qe(s.mode),R=qe(s.reValidateMode)}},subscribe:ws,trigger:fe,register:Xe,handleSubmit:vt,watch:Ss,setValue:p,setValues:V,getValues:we,reset:jt,resetField:As,resetDefaultValues:(a,l={})=>{if(o=B(a),!l.keepDirty){const c=Ne(o,d,void 0,i);t.dirtyFields=c,t.isDirty=!G(c)}l.keepIsValid||I(),b.state.next({...t,defaultValues:o})},clearErrors:Ee,unregister:Je,setError:He,setFocus:Ts,getFieldState:Ce};return{...St,formControl:St}}function Cr(e={}){const s=X.useRef(void 0),t=X.useRef(void 0),i=X.useRef(e.formControl),[o,d]=X.useState(()=>({...B(ps),isLoading:ie(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ie(e.defaultValues)?void 0:e.defaultValues}));if(!s.current||e.formControl&&i.current!==e.formControl)if(i.current=e.formControl,e.formControl)s.current={...e.formControl,formState:o},e.defaultValues&&!ie(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:u,...j}=Dr(e);s.current={...j,formState:o}}const n=s.current.control;return n._options=e,xr(()=>{const u=n._subscribe({formState:n._proxyFormState,callback:()=>d({...n._formState,defaultValues:n._defaultValues}),reRenderRoot:!0});return d(j=>({...j,isReady:!0})),n._formState.isReady=!0,u},[n]),X.useEffect(()=>n._disableForm(e.disabled),[n,e.disabled]),X.useEffect(()=>{e.mode&&(n._options.mode=e.mode),e.reValidateMode&&(n._options.reValidateMode=e.reValidateMode)},[n,e.mode,e.reValidateMode]),X.useEffect(()=>{e.errors&&(n._setErrors(e.errors),n._focusError())},[n,e.errors]),X.useEffect(()=>{e.shouldUnregister&&n._subjects.state.next({values:n._getWatch()})},[n,e.shouldUnregister]),X.useEffect(()=>{if(n._proxyFormState.isDirty){const u=n._getDirty();u!==o.isDirty&&n._subjects.state.next({isDirty:u})}},[n,o.isDirty]),X.useEffect(()=>{var u;e.values&&!he(e.values,t.current)?(n._reset(e.values,{keepFieldsRef:!0,...n._options.resetOptions}),!((u=n._options.resetOptions)===null||u===void 0)&&u.keepIsValid||n._setValid(),t.current=e.values,d(j=>({...j}))):n._resetDefaultValues()},[n,e.values]),X.useEffect(()=>{n._state.mount||(n._setValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()}),s.current.formState=X.useMemo(()=>gr(o,n),[n,o]),s.current}const Wt=(e,s,t)=>{if(e&&"reportValidity"in e){const i=y(t,s);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},lt=(e,s)=>{for(const t in s.fields){const i=s.fields[t];i&&i.ref&&"reportValidity"in i.ref?Wt(i.ref,t,e):i&&i.refs&&i.refs.forEach(o=>Wt(o,t,e))}},Kt=(e,s)=>{s.shouldUseNativeValidation&<(e,s);const t={};for(const i in e){const o=y(s.fields,i),d=Object.assign(e[i]||{},{ref:o&&o.ref});if(Fr(s.names||Object.keys(e),i)){const n=Object.assign({},y(t,i));F(n,"root",d),F(t,i,n)}else F(t,i,d)}return t},Fr=(e,s)=>{const t=Gt(s).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(i=>Gt(i).match(`^${t}\\.\\d+`))};function Gt(e){return e.replace(/[\[\]]/g,"")}function gs(e,s,t){function i(u,j){var E;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(E=u._zod).traits??(E.traits=new Set),u._zod.traits.add(e),s(u,j);for(const _ in n.prototype)_ in u||Object.defineProperty(u,_,{value:n.prototype[_].bind(u)});u._zod.constr=n,u._zod.def=j}const o=t?.Parent??Object;class d extends o{}Object.defineProperty(d,"name",{value:e});function n(u){var j;const E=t?.Parent?new d:this;i(E,u),(j=E._zod).deferred??(j.deferred=[]);for(const _ of E._zod.deferred)_();return E}return Object.defineProperty(n,"init",{value:i}),Object.defineProperty(n,Symbol.hasInstance,{value:u=>t?.Parent&&u instanceof t.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}class Or extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Ir={};function xs(e){return Ir}function Mr(e,s){return typeof s=="bigint"?s.toString():s}const ys=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function $e(e){return typeof e=="string"?e:e?.message}function vs(e,s,t){const i={...e,path:e.path??[]};if(!e.message){const o=$e(e.inst?._zod.def?.error?.(e))??$e(s?.error?.(e))??$e(t.customError?.(e))??$e(t.localeError?.(e))??"Invalid input";i.message=o}return delete i.inst,delete i.continue,s?.reportInput||delete i.input,i}const bs=(e,s)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:s,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(s,Mr,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Rr=gs("$ZodError",bs),js=gs("$ZodError",bs,{Parent:Error}),Lr=e=>(s,t,i,o)=>{const d=i?Object.assign(i,{async:!1}):{async:!1},n=s._zod.run({value:t,issues:[]},d);if(n instanceof Promise)throw new Or;if(n.issues.length){const u=new(o?.Err??e)(n.issues.map(j=>vs(j,d,xs())));throw ys(u,o?.callee),u}return n.value},Ur=Lr(js),zr=e=>async(s,t,i,o)=>{const d=i?Object.assign(i,{async:!0}):{async:!0};let n=s._zod.run({value:t,issues:[]},d);if(n instanceof Promise&&(n=await n),n.issues.length){const u=new(o?.Err??e)(n.issues.map(j=>vs(j,d,xs())));throw ys(u,o?.callee),u}return n.value},Hr=zr(js);function ct(){return ct=Object.assign?Object.assign.bind():function(e){for(var s=1;s<arguments.length;s++){var t=arguments[s];for(var i in t)({}).hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},ct.apply(null,arguments)}function Yt(e,s){try{var t=e()}catch(i){return s(i)}return t&&t.then?t.then(void 0,s):t}function Br(e,s){for(var t={};e.length;){var i=e[0],o=i.code,d=i.message,n=i.path.join(".");if(!t[n])if("unionErrors"in i){var u=i.unionErrors[0].errors[0];t[n]={message:u.message,type:u.code}}else t[n]={message:d,type:o};if("unionErrors"in i&&i.unionErrors.forEach(function(_){return _.errors.forEach(function(z){return e.push(z)})}),s){var j=t[n].types,E=j&&j[i.code];t[n]=gt(n,s,t,o,E?[].concat(E,i.message):i.message)}e.shift()}return t}function qr(e,s){for(var t={},i=function(){var o=e[0],d=o.code,n=o.message,u=o.path.join(".");if(!t[u])if(o.code==="invalid_union"&&o.errors.length>0){var j=o.errors[0][0];t[u]={message:j.message,type:j.code}}else t[u]={message:n,type:d};if(o.code==="invalid_union"&&o.errors.forEach(function(z){return z.forEach(function(R){return e.push(ct({},R,{path:[].concat(o.path,R.path)}))})}),s){var E=t[u].types,_=E&&E[o.code];t[u]=gt(u,s,t,d,_?[].concat(_,o.message):o.message)}e.shift()};e.length;)i();return t}function $r(e,s,t){if(t===void 0&&(t={}),(function(i){return"_def"in i&&typeof i._def=="object"&&"typeName"in i._def})(e))return function(i,o,d){try{return Promise.resolve(Yt(function(){return Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](i,s)).then(function(n){return d.shouldUseNativeValidation&<({},d),{errors:{},values:t.raw?Object.assign({},i):n}})},function(n){if((function(u){return Array.isArray(u?.issues)})(n))return{values:{},errors:Kt(Br(n.errors,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw n}))}catch(n){return Promise.reject(n)}};if((function(i){return"_zod"in i&&typeof i._zod=="object"})(e))return function(i,o,d){try{return Promise.resolve(Yt(function(){return Promise.resolve((t.mode==="sync"?Ur:Hr)(e,i,s)).then(function(n){return d.shouldUseNativeValidation&<({},d),{errors:{},values:t.raw?Object.assign({},i):n}})},function(n){if((function(u){return u instanceof Rr})(n))return{values:{},errors:Kt(qr(n.issues,!d.shouldUseNativeValidation&&d.criteriaMode==="all"),d)};throw n}))}catch(n){return Promise.reject(n)}};throw new Error("Invalid input: not a Zod schema")}const Wr=e=>{const s=ut(),{pushError:t}=Cs(),{data:i}=Xt({...es(),staleTime:1/0}),o=i?.accounts.find(j=>j.accountId===e)?.composeLanguages,d=C.useMemo(()=>o&&o.length>0?[...o]:Fs(navigator.languages),[o]),n=Se({...ts(),onSuccess:()=>{s.invalidateQueries({queryKey:Ae()})},onError:j=>{t(Os("Couldn't save languages","The writing languages weren't saved.",j))}}),u=C.useCallback(j=>{e&&n.mutate({path:{accountId:e},body:{composeLanguages:j}})},[e,n]);return{languages:d,setLanguages:u,isSaving:n.isPending}},Kr=e=>e.authType==="oauthMicrosoft",Gr="••••••••••",Yr=e=>{const s=e.smtpUsername?.trim();return s?s!==e.username:!1},Qr=Ls({email:be().email().min(1,"Email is required"),displayName:be().optional(),username:be().optional(),password:be().optional(),imapHost:be().min(1,"IMAP host is required"),imapPort:_t.number().int().min(1).max(65535),imapTls:Ie(),imapStartTls:Ie(),smtpHost:be().optional(),smtpPort:_t.number().int().min(1).max(65535).optional(),smtpTls:Ie().optional(),smtpStartTls:Ie().optional(),smtpUsername:be().optional(),smtpPassword:be().optional(),useDifferentSmtpCreds:Ie().optional()}),Zr=({isOpen:e,onClose:s,account:t,focusSmtp:i})=>{const o=ut(),d=!!t,[n,u]=C.useState(!1),[j,E]=C.useState(""),[_,z]=C.useState(!1),R=Dt(j),O=!!R&&!_,T=C.useRef(null),f=Cr({resolver:$r(Qr),defaultValues:{email:"",displayName:"",username:"",password:"",imapHost:"",imapPort:993,imapTls:!0,imapStartTls:!1,smtpHost:"",smtpPort:587,smtpTls:!1,smtpStartTls:!0,useDifferentSmtpCreds:!1}});C.useEffect(()=>{if(t){const p=Yr(t);f.reset({email:t.email,displayName:t.displayName||"",username:t.username||"",password:Gr,imapHost:t.imapHost,imapPort:t.imapPort,imapTls:t.imapTls,imapStartTls:t.imapStartTls,smtpHost:t.smtpHost||"",smtpPort:t.smtpPort||587,smtpTls:t.smtpTls||!1,smtpStartTls:t.smtpStartTls||!0,smtpUsername:p&&t.smtpUsername||"",smtpPassword:"",useDifferentSmtpCreds:p}),u(!1)}else f.reset({email:"",displayName:"",username:"",password:"",imapHost:"",imapPort:993,imapTls:!0,imapStartTls:!1,smtpHost:"",smtpPort:587,smtpTls:!1,smtpStartTls:!0,useDifferentSmtpCreds:!1}),u(!1)},[t,f]);const b=Se({...Is()}),ae=Se({...Ms(),onSuccess:()=>{o.invalidateQueries({queryKey:Ae()}),s()}}),N=Se({...ts(),onSuccess:()=>{o.invalidateQueries({queryKey:Ae()}),s()}}),W=()=>{const p=f.getValues(),V=d&&!n;b.mutate({body:{accountId:V?t?.accountId:void 0,username:p.username||p.email,password:V?void 0:p.password||void 0,imapHost:p.imapHost,imapPort:Number(p.imapPort),imapTls:p.imapTls,imapStartTls:p.imapStartTls}})},I=()=>{const p=f.getValues(),V=d&&!n;b.mutate({body:{accountId:V?t?.accountId:void 0,username:p.username||p.email,password:V?void 0:p.password||void 0,imapHost:p.imapHost,imapPort:Number(p.imapPort),imapTls:p.imapTls,imapStartTls:p.imapStartTls,smtpHost:p.smtpHost||void 0,smtpPort:p.smtpPort?Number(p.smtpPort):void 0,smtpTls:p.smtpTls,smtpStartTls:p.smtpStartTls,smtpUsername:p.useDifferentSmtpCreds?p.smtpUsername:void 0,smtpPassword:p.useDifferentSmtpCreds?p.smtpPassword:void 0}})},A=f.handleSubmit(p=>{if(!d&&!p.password){f.setError("password",{message:"Password is required"});return}const V=rr({imapHost:p.imapHost,smtpHost:p.smtpHost,smtpPort:p.smtpPort,smtpTls:p.smtpTls,smtpStartTls:p.smtpStartTls});V&&(f.setValue("smtpHost",V.smtpHost),f.setValue("smtpPort",V.smtpPort),f.setValue("smtpTls",V.smtpTls),f.setValue("smtpStartTls",V.smtpStartTls));const ce=V?.smtpHost??p.smtpHost,se=V?.smtpPort??p.smtpPort,fe=V?.smtpTls??p.smtpTls,we=V?.smtpStartTls??p.smtpStartTls,Ce={email:p.email,displayName:p.displayName?.trim()||void 0,username:p.username||void 0,imapHost:p.imapHost,imapPort:Number(p.imapPort),imapTls:p.imapTls,imapStartTls:p.imapStartTls,smtpHost:ce||void 0,smtpPort:se?Number(se):void 0,smtpTls:fe,smtpStartTls:we,smtpUsername:p.useDifferentSmtpCreds&&p.smtpUsername||void 0,smtpPassword:p.useDifferentSmtpCreds&&p.smtpPassword||void 0};if(d&&t){const Ee={...Ce,password:n?p.password:void 0};N.mutate({path:{accountId:t.accountId},body:Ee})}else{const Ee={...Ce,password:p.password};ae.mutate({body:Ee})}}),ne=ae.isPending||N.isPending,{signature:re,setSignature:pe,isSaving:oe}=sr(t?.accountId),[K,te]=C.useState(re.plainText),{languages:P,setLanguages:k,isSaving:D}=Wr(t?.accountId),$=r.jsxs("section",{children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Writing languages"}),r.jsx(cr,{value:P,onChange:k,busy:D})]});C.useEffect(()=>{te(re.plainText)},[re.plainText]),C.useEffect(()=>{if(!e||!i)return;const p=T.current;if(!p)return;const V=window.setTimeout(()=>{p.scrollIntoView({behavior:"smooth",block:"start"})},250);return()=>window.clearTimeout(V)},[e,i]);const w=C.useCallback(()=>{K!==re.plainText&&pe(K,K)},[K,re.plainText,pe]),M=p=>{const{tls:V,startTls:ce}=Be(p);f.setValue("imapTls",V),f.setValue("imapStartTls",ce);const se=f.getValues("imapPort");(se===993||se===143)&&f.setValue("imapPort",p==="tls"?993:143)},le=p=>{const{tls:V,startTls:ce}=Be(p);f.setValue("smtpTls",V),f.setValue("smtpStartTls",ce);const se=f.getValues("smtpPort");if(se===465||se===587||se===25){const we=p==="tls"?465:p==="starttls"?587:25;f.setValue("smtpPort",we)}},Z=()=>{const p=f.getValues("imapHost");f.setValue("smtpHost",ar(p)),f.setValue("smtpTls",!1),f.setValue("smtpStartTls",!0),f.setValue("smtpPort",587)},ge=p=>{E(p),z(!1);const V=Dt(p);if(!V)return;const ce=Be(V.imap.security);f.setValue("imapHost",V.imap.host),f.setValue("imapPort",V.imap.port),f.setValue("imapTls",ce.tls),f.setValue("imapStartTls",ce.startTls);const se=Be(V.smtp.security);f.setValue("smtpHost",V.smtp.host),f.setValue("smtpPort",V.smtp.port),f.setValue("smtpTls",se.tls),f.setValue("smtpStartTls",se.startTls);const fe=f.getValues("email").trim(),we=f.getValues("username")?.trim();fe&&!we&&f.setValue("username",fe)},Te=R?.passwordHelp.text,De=Ct(b.data?.imapError,Te),ze=Ct(b.data?.smtpError,Te);return(t?Kr(t):!1)&&d?r.jsx(Ft,{isOpen:e,onClose:s,title:"Edit Account",footer:r.jsx(ee,{type:"button",variant:"secondary",onClick:s,children:"Close"}),children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("section",{children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Microsoft 365 Account"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-md border border-line bg-surface-sunken px-3 py-2.5 text-sm text-fg-muted",children:[r.jsx("span",{className:"block text-2xs font-medium uppercase tracking-wider text-fg-subtle mb-1",children:"Email"}),r.jsx("span",{className:"text-fg",children:t?.email})]}),r.jsxs("div",{className:"rounded-md border border-line bg-surface-sunken px-3 py-2.5 text-sm text-fg-muted",children:[r.jsx("span",{className:"block text-2xs font-medium uppercase tracking-wider text-fg-subtle mb-1",children:"Authentication"}),r.jsx("span",{className:"text-fg",children:"Microsoft OAuth (XOAUTH2)"})]}),r.jsx("p",{className:"text-xs text-fg-muted",children:"Server settings are managed automatically for Microsoft 365 accounts. To update credentials, use the Reconnect button."})]})]}),d&&r.jsxs("section",{children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Signature"}),r.jsx("div",{className:"space-y-3",children:r.jsxs("div",{children:[r.jsx("label",{htmlFor:"email-sig-view",className:"text-sm font-medium mb-1.5 block",children:"Email Signature"}),r.jsx("textarea",{id:"email-sig-view",value:K,onChange:p=>te(p.target.value),onBlur:w,rows:5,className:"w-full px-3 py-2 border border-line rounded-md bg-surface-sunken text-sm text-fg placeholder:text-fg-subtle focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors resize-y outline-none",placeholder:"Enter your email signature..."}),r.jsx("p",{className:"text-xs text-fg-muted mt-1",children:oe?"Saving signature...":"This signature will be appended to new emails."})]})})]}),d&&$]})}):r.jsx(Ft,{isOpen:e,onClose:s,title:d?"Edit Account":"Add Account",footer:r.jsxs(r.Fragment,{children:[r.jsx(ee,{type:"button",variant:"secondary",onClick:s,children:"Cancel"}),r.jsx(ee,{type:"submit",form:"account-form",variant:"primary",disabled:ne,children:ne?"Saving...":"Save Account"})]}),children:r.jsxs("form",{id:"account-form",onSubmit:A,className:"space-y-6",children:[r.jsxs("section",{children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Account Information"}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"account-provider",className:"text-sm font-medium mb-1.5 block",children:"Provider"}),r.jsxs(Rs,{id:"account-provider",value:j,onChange:p=>ge(p.target.value),children:[r.jsx("option",{value:"",children:"Custom / other"}),Xs.map(p=>r.jsx("option",{value:p.id,children:p.label},p.id))]}),r.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Pick your email provider to fill in server settings automatically, or choose Custom to enter them by hand."})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"account-email",className:"text-sm font-medium mb-1.5 block",children:"Email Address"}),r.jsx(ve,{id:"account-email",...f.register("email"),placeholder:"alice@example.com"}),f.formState.errors.email&&r.jsx("p",{className:"text-sm text-danger mt-1",children:f.formState.errors.email.message})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"account-displayName",className:"text-sm font-medium mb-1.5 block",children:"Display name (optional)"}),r.jsx(ve,{id:"account-displayName",...f.register("displayName"),placeholder:"Alice"}),r.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"What to call this account in Remit. Leave blank to use a name derived from the address."})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"account-username",className:"text-sm font-medium mb-1.5 block",children:"Username"}),r.jsx(ve,{id:"account-username",...f.register("username"),placeholder:"Same as email if empty"})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"account-password",className:"text-sm font-medium mb-1.5 block",children:"Password"}),r.jsx(At,{id:"account-password",...f.register("password",{onChange:()=>u(!0)}),onFocus:()=>{d&&!n&&(f.setValue("password",""),u(!0))},placeholder:d?"Leave empty to keep current":""}),f.formState.errors.password&&r.jsx("p",{className:"text-sm text-danger mt-1",children:f.formState.errors.password.message}),R&&r.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[R.passwordHelp.text," ",r.jsx("a",{href:R.passwordHelp.url,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline",children:"Get an app password"})]})]})]})]}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider",children:"Incoming Mail (IMAP)"}),R&&r.jsx("button",{type:"button",onClick:()=>z(p=>!p),className:"text-xs text-fg-muted hover:text-fg transition-colors",children:_?"Use preset settings":"Advanced"})]}),O&&r.jsxs("p",{className:"text-xs text-fg-muted mb-3",children:["Server settings are pre-filled for ",R?.label," and locked. Choose Advanced to edit them by hand."]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"imap-host",className:"text-sm font-medium mb-1.5 block",children:"Server"}),r.jsx(ve,{id:"imap-host",...f.register("imapHost"),readOnly:O,placeholder:"imap.example.com"}),f.formState.errors.imapHost&&r.jsx("p",{className:"text-sm text-danger mt-1",children:f.formState.errors.imapHost.message})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"imap-port",className:"text-sm font-medium mb-1.5 block",children:"Port"}),r.jsx(ve,{id:"imap-port",...f.register("imapPort"),readOnly:O,type:"number"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium mb-1.5 block",children:"Security"}),r.jsxs("div",{className:"space-y-1.5 mt-2",children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:O,checked:f.watch("imapTls"),onChange:()=>M("tls")}),"TLS (Port 993)"]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:O,checked:!f.watch("imapTls")&&f.watch("imapStartTls"),onChange:()=>M("starttls")}),"STARTTLS (Port 143)"]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:O,checked:!f.watch("imapTls")&&!f.watch("imapStartTls"),onChange:()=>M("none")}),"None (Unencrypted)"]})]})]})]}),r.jsx(ee,{type:"button",variant:"secondary",onClick:W,disabled:b.isPending,className:"w-full",icon:b.isPending?r.jsx(at,{className:"size-4 animate-spin"}):void 0,children:b.isPending?"Testing...":"Test IMAP Connection"}),b.data&&r.jsxs("div",{className:Et("p-2 rounded-md text-sm",b.data.imapSuccess?"bg-positive/10 text-positive":"bg-danger-soft text-danger"),children:[b.data.imapSuccess?r.jsx(Tt,{className:"inline size-4 mr-1"}):r.jsx(Ve,{className:"inline size-4 mr-1"}),b.data.imapSuccess?"IMAP Connected":De]})]})]}),r.jsxs("section",{ref:T,"data-testid":"smtp-section",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider",children:"Outgoing Mail (SMTP)"}),!O&&r.jsx("button",{type:"button",onClick:Z,disabled:!f.watch("imapHost"),className:"text-xs text-fg-muted hover:text-fg transition-colors disabled:opacity-50",children:"Pre-fill from IMAP"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"smtp-host",className:"text-sm font-medium mb-1.5 block",children:"Server"}),r.jsx(ve,{id:"smtp-host",...f.register("smtpHost"),readOnly:O,placeholder:"smtp.example.com"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"smtp-port",className:"text-sm font-medium mb-1.5 block",children:"Port"}),r.jsx(ve,{id:"smtp-port",...f.register("smtpPort"),readOnly:O,type:"number"})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-sm font-medium mb-1.5 block",children:"Security"}),r.jsxs("div",{className:"space-y-1.5 mt-2",children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:O,checked:f.watch("smtpTls")===!0,onChange:()=>le("tls")}),"TLS (Port 465)"]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:O,checked:!f.watch("smtpTls")&&f.watch("smtpStartTls")===!0,onChange:()=>le("starttls")}),"STARTTLS (Port 587)"]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"radio",disabled:O,checked:!f.watch("smtpTls")&&!f.watch("smtpStartTls"),onChange:()=>le("none")}),"None (Unencrypted)"]})]})]})]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"checkbox",...f.register("useDifferentSmtpCreds")}),"Use different credentials for SMTP"]}),f.watch("useDifferentSmtpCreds")&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"smtp-username",className:"text-sm font-medium mb-1.5 block",children:"SMTP Username"}),r.jsx(ve,{id:"smtp-username",...f.register("smtpUsername")})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"smtp-password",className:"text-sm font-medium mb-1.5 block",children:"SMTP Password"}),r.jsx(At,{id:"smtp-password",...f.register("smtpPassword")})]})]}),r.jsx(ee,{type:"button",variant:"secondary",onClick:I,disabled:b.isPending||!f.watch("smtpHost"),className:"w-full",icon:b.isPending?r.jsx(at,{className:"size-4 animate-spin"}):void 0,children:b.isPending?"Testing...":"Test SMTP Connection"}),b.data?.smtpSuccess!==void 0&&r.jsxs("div",{className:Et("p-2 rounded-md text-sm",b.data.smtpSuccess?"bg-positive/10 text-positive":"bg-danger-soft text-danger"),children:[b.data.smtpSuccess?r.jsx(Tt,{className:"inline size-4 mr-1"}):r.jsx(Ve,{className:"inline size-4 mr-1"}),b.data.smtpSuccess?"SMTP Connected":ze]})]})]}),d&&r.jsxs("section",{children:[r.jsx("h3",{className:"text-2xs font-semibold text-fg-subtle uppercase tracking-wider mb-3",children:"Signature"}),r.jsx("div",{className:"space-y-3",children:r.jsxs("div",{children:[r.jsx("label",{htmlFor:"email-sig-edit",className:"text-sm font-medium mb-1.5 block",children:"Email Signature"}),r.jsx("textarea",{id:"email-sig-edit",value:K,onChange:p=>te(p.target.value),onBlur:w,rows:5,className:"w-full px-3 py-2 border border-line rounded-md bg-surface-sunken text-sm text-fg placeholder:text-fg-subtle focus-within:border-line-strong focus-within:ring-2 focus-within:ring-ring/30 transition-colors resize-y outline-none",placeholder:"Enter your email signature..."}),r.jsx("p",{className:"text-xs text-fg-muted mt-1",children:oe?"Saving signature...":"This signature will be appended to new emails."})]})})]}),d&&$]})})};function Qt({open:e,onClose:s,accountEmail:t,signOut:i}){const[o,d]=C.useState(""),[n,u]=C.useState(!1),[j,E]=C.useState(!1),_=Se({...zs(),onSuccess:()=>{E(!0),setTimeout(()=>i(),2e3)}}),z=Se(Hs()),R=()=>{_.isPending||(d(""),u(!1),E(!1),_.reset(),z.reset(),s())},O=()=>{if(o.trim().toLowerCase()!==t.toLowerCase()){u(!0);return}u(!1),_.mutate({body:{confirmEmail:o.trim()}})};return r.jsxs(ss,{open:e,onClose:R,title:"Delete your Remit account",children:[r.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[r.jsx(dt,{className:"size-4 shrink-0 text-danger"}),r.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:"Delete your Remit account"}),r.jsx(ee,{variant:"ghost",size:"sm",icon:r.jsx(Ve,{className:"size-3.5"}),onClick:R,"aria-label":"Cancel"})]}),j?r.jsxs("div",{className:"px-5 py-6 text-sm text-fg-muted",children:[r.jsx("p",{className:"font-medium text-fg",children:"Account deletion scheduled."}),r.jsx("p",{className:"mt-1",children:"Your data will be erased shortly. Signing you out…"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-4 px-5 py-4 text-sm text-fg-muted",children:[r.jsx("p",{children:"This permanently erases everything Remit holds for you:"}),r.jsxs("ul",{className:"space-y-1.5 text-xs",children:[r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"text-danger",children:"•"}),"All connected accounts disconnected and access tokens revoked."]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"text-danger",children:"•"}),"Synced mail cache and search index."]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"text-danger",children:"•"}),"AI history and insights."]}),r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{className:"text-danger",children:"•"}),"Preferences and rules."]})]}),r.jsxs("div",{className:"rounded-sm border border-line bg-surface-sunken px-3 py-2 text-xs",children:[r.jsx("strong",{className:"text-fg",children:"Your mail at Gmail / IMAP is not deleted."})," ","This only removes Remit's copy and its access — the mail stays in your provider mailboxes."]}),r.jsxs("div",{className:"text-xs",children:[r.jsxs("button",{type:"button",onClick:()=>z.mutate({}),"aria-busy":z.isPending,className:"inline-flex items-center gap-1.5 font-medium text-accent hover:underline",children:[r.jsx(ir,{className:"size-3.5"}),z.isPending?"Requesting export…":"Export my data first"]}),z.isSuccess&&r.jsx("p",{className:"mt-1.5 text-fg-muted",role:"status",children:"Export requested. We'll prepare a ZIP of your mail — find it under your data exports when it's ready."}),z.isError&&r.jsx("p",{className:"mt-1.5 text-danger",role:"alert",children:"Couldn't start the export. Please try again."})]}),r.jsxs("div",{children:[r.jsxs("label",{htmlFor:"confirm-remit-email",className:"mb-1 block text-xs font-medium text-fg",children:["Type"," ",r.jsx("span",{className:"font-mono text-fg-muted",children:t})," ","to confirm"]}),r.jsx(ve,{id:"confirm-remit-email",type:"email",placeholder:t,value:o,onChange:T=>{d(T.target.value),n&&u(!1),_.isError&&_.reset()},autoComplete:"off"}),n&&r.jsx("p",{className:"mt-1.5 text-xs text-danger",role:"alert",children:"That doesn't match your account email. Type it exactly to confirm."}),_.isError&&r.jsx("p",{className:"mt-1.5 text-xs text-danger",role:"alert",children:_.error instanceof Error?_.error.message:"Something went wrong. Please try again."})]})]}),r.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[r.jsx(ee,{variant:"secondary",size:"sm",onClick:R,children:"Cancel"}),r.jsx(ee,{variant:"danger",size:"sm",onClick:O,"aria-busy":_.isPending,children:_.isPending?"Deleting…":"Delete everything"})]})]})]})}function Jr(e){const{Account:s}=Us();return r.jsx(s,{fallback:r.jsx(Qt,{...e,accountEmail:"",signOut:()=>{}}),children:({email:t,signOut:i})=>r.jsx(Qt,{...e,accountEmail:t??"",signOut:i})})}function Xr(){const[e,s]=C.useState(!1);return r.jsxs("section",{className:"mt-8 border-t border-line pt-6",children:[r.jsx(dr,{title:"Delete your Remit account",description:"Disconnects every account and erases Remit's copy of your mail, insights and preferences. Your mail at the providers is untouched.",action:r.jsx(ee,{variant:"danger",size:"sm",onClick:()=>s(!0),children:"Delete your Remit account"})}),r.jsx(Jr,{open:e,onClose:()=>s(!1)})]})}function ea(e){const s=e.toLowerCase();return s==="access_denied"?"You cancelled the sign-in.":s==="consent_required"||s.includes("admin_consent")||s.includes("interaction_required")?"Your organisation's admin needs to approve Remit. Ask your IT admin to grant the required permissions.":s.includes("imap_disabled")||s.includes("imap disabled")?"IMAP is disabled for this account. Ask your admin to enable IMAP access in the Microsoft 365 admin centre.":`Sign-in failed: ${e}. Please try again.`}function ta(e){const s=e.split("@")[0]??"";return s?s.split(/[._-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "):e}function sa(e){const s=e.displayName?.trim();return s||ta(e.email)}function ra(e){if(!e.lastSyncAt)return"never synced";const s=or(e.lastSyncAt);return s?`synced ${s}`:"never synced"}function Zt(e){return e.muted?.value?"muted":e.lastError?"error":e.connectionState==="authenticated"?"healthy":"error"}function Jt(e){return e.connectionState==="reauth_required"}const aa=r.jsxs("div",{className:"space-y-3",children:[r.jsxs("p",{children:[r.jsx("strong",{className:"text-fg",children:"Sync health"})," shows the IMAP connection state and the last successful sync per account."]}),r.jsxs("p",{children:[r.jsx("strong",{className:"text-fg",children:"Error"})," means the last connection attempt failed — the raw server response is shown on the card. Reconnect re-runs the connection test from the add-account wizard."]}),r.jsxs("p",{children:[r.jsx("strong",{className:"text-fg",children:"Muted"})," accounts keep syncing but stay out of the daily brief and unified counts."]})]}),ia=()=>r.jsx("div",{className:"space-y-3",role:"status","aria-busy":"true","aria-label":"Loading accounts",children:["skeleton-0","skeleton-1"].map(e=>r.jsx("div",{className:"rounded-sm border border-line bg-surface animate-pulse p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"size-10 rounded-full bg-surface-sunken"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-surface-sunken rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-surface-sunken rounded w-2/3"})]})]})},e))});function ja(){const e=Pt.useSearch(),s=Bs({from:Pt.fullPath}),[t,i]=C.useState(!0),[o,d]=C.useState(!1),[n,u]=C.useState(!1),[j,E]=C.useState(null),[_,z]=C.useState(!1),[R,O]=C.useState(null),[T,f]=C.useState(null),[b,ae]=C.useState(null),[N,W]=C.useState(null),I=ut(),{data:A,isPending:ne,isError:re,error:pe,refetch:oe}=Xt(es());C.useEffect(()=>{e.editAccountId&&(E(e.editAccountId),z(!!e.focusSmtp),s({search:{editAccountId:void 0,focusSmtp:void 0,connected:e.connected,oauthError:e.oauthError},replace:!0}))},[e.editAccountId,e.focusSmtp,s,e.connected,e.oauthError]),C.useEffect(()=>{e.connected&&(f("Account connected successfully."),E(e.connected),I.invalidateQueries({queryKey:Ae()}),s({search:{connected:void 0,oauthError:void 0,editAccountId:void 0,focusSmtp:void 0},replace:!0}))},[e.connected,s,I]),C.useEffect(()=>{e.oauthError&&(ae(ea(e.oauthError)),W(null),s({search:{oauthError:void 0,connected:void 0,editAccountId:void 0,focusSmtp:void 0},replace:!0}))},[e.oauthError,s]),er(N!==null,()=>{I.invalidateQueries({queryKey:Ae()})}),C.useEffect(()=>{if(!N||!A)return;const w=A.accounts.find(M=>M.accountId===N);(!w||!Jt(w))&&W(null)},[A,N]);const K=Se({...qs(),onSuccess:w=>{window.location.assign(w.authorizationUrl)},onError:w=>{ae(w instanceof Error?w.message:"Failed to start reconnect"),W(null)}}),te=Se({...$s(),onSuccess:()=>{I.invalidateQueries({queryKey:Ae()}),O(null)}}),P=A?.accounts.find(w=>w.accountId===R),k=A?.accounts.find(w=>w.accountId===j),D=()=>{d(!1),u(!1),E(null),z(!1)},$=w=>{const M=Gs[w];M&&s({to:M})};return r.jsxs(Zs,{items:Ws,activeId:"accounts",title:"Accounts",description:"Every account keeps syncing — muted ones just stay out of unified views.",help:aa,helpOpen:t,onToggleHelp:()=>i(w=>!w),onSelect:$,onBackToMail:()=>{s({to:"/mail"})},children:[T&&r.jsx(kt,{tone:"success",variant:"soft","data-testid":"oauth-success-banner",onDismiss:()=>f(null),children:T}),b&&r.jsx(kt,{tone:"danger",variant:"soft","data-testid":"oauth-error-banner",onDismiss:()=>ae(null),children:b}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ks,{tone:"neutral",children:ne||re?"accounts":`${A.accounts.length} ${A.accounts.length===1?"account":"accounts"}`}),r.jsx(ee,{variant:"primary",size:"sm",icon:r.jsx(Vt,{className:"size-3.5"}),onClick:()=>u(!0),children:"Add account"})]}),ne?r.jsx(ia,{}):re?r.jsx(nr,{title:"Couldn't load accounts",error:pe,onRetry:()=>{oe()}}):A.accounts.length===0?r.jsxs("div",{className:"py-12 text-sm text-fg-muted","data-testid":"accounts-empty",children:[r.jsx("p",{className:"mb-3",children:"No accounts configured."}),r.jsx(ee,{variant:"primary",size:"sm",icon:r.jsx(Vt,{className:"size-3.5"}),onClick:()=>u(!0),children:"Add your first account"})]}):r.jsx("div",{className:"space-y-3",children:A.accounts.map(w=>{const M=Jt(w),le=w.authType==="oauthMicrosoft",Z=N===w.accountId&&K.isPending,ge=M&&le?{label:"Reconnect",variant:"secondary",busy:Z,busyLabel:"Redirecting…",onClick:()=>{W(w.accountId),K.mutate({body:{email:w.email}})}}:Zt(w)==="error"?{label:"Reconnect",variant:"secondary",onClick:()=>E(w.accountId)}:{label:"Manage",variant:"ghost",onClick:()=>E(w.accountId)},Te=r.jsx(Qs,{actions:[ge],destructive:{label:"Delete account",iconOnly:!0,icon:r.jsx(Ys,{className:"size-3.5"}),onClick:()=>O(w.accountId)}});return r.jsx(Js,{label:sa(w),email:w.email,connector:le?"Microsoft 365":"IMAP",syncLabel:ra(w),state:Zt(w),errorDetail:M?"Re-authentication required":w.lastError,trailing:Te},w.accountId)})}),n&&r.jsx("div",{className:"fixed inset-0 z-40 overflow-auto bg-canvas",children:r.jsx(tr,{skipWelcome:!0,onComplete:()=>{u(!1),I.invalidateQueries({queryKey:Ae()})},onCancel:()=>u(!1)})}),r.jsx(Zr,{isOpen:o||!!j,account:k,focusSmtp:_,onClose:D}),r.jsxs(ss,{open:!!R,onClose:()=>O(null),title:"Delete account",children:[r.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[r.jsx(dt,{className:"size-4 shrink-0 text-danger"}),r.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:"Delete account"}),r.jsx(ee,{variant:"ghost",size:"sm",icon:r.jsx(Ve,{className:"size-3.5"}),onClick:()=>O(null),"aria-label":"Cancel"})]}),r.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[r.jsx("p",{className:"text-center text-lg font-medium text-fg",children:"Are you sure?"}),P&&r.jsx("p",{className:"text-center",children:P.email}),r.jsxs("ul",{className:"list-inside list-disc space-y-1",children:[r.jsx("li",{children:"Remove the account from your settings"}),r.jsx("li",{children:"Stop syncing mail for this account"}),r.jsx("li",{children:"Delete all associated data (within 24 hours)"})]})]}),r.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[r.jsx(ee,{variant:"secondary",size:"sm",onClick:()=>O(null),children:"Cancel"}),r.jsx(ee,{variant:"danger",size:"sm","aria-busy":te.isPending,icon:te.isPending?r.jsx(at,{className:"size-3.5 animate-spin"}):void 0,onClick:()=>{te.isPending||R&&te.mutate({path:{accountId:R}})},children:te.isPending?"Deleting…":"Delete account"})]})]}),r.jsx(Xr,{})]})}export{ja as component,ea as mapOauthError};
|
package/assets/brief-IOLPzmXc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as m,r as a,j as r,_ as p}from"./index-CNoNYU4b.js";import{a as n}from"./search-view-CXPbecDB.js";import{B as t}from"./BriefPane-BJxOwp8m.js";import{u as d}from"./useSearchMirror--YnVEyRo.js";import"./nav-link-BCGmsThK.js";import"./search-scope-Ds_ghZOi.js";import"./useSearchTokenContext-DIryp5er.js";import"./kbd-BrhLdlau.js";import"./enums-CCxx0t2v.js";import"./MailListHeader-CaZUuANM.js";import"./search-token-index-BTQUgi2G.js";import"./useMediaQuery-CAv9qAps.js";import"./account-form-helpers-Bsx48lx1.js";import"./avatar-DdSaEl5o.js";import"./useSignature-C0EjJ_Wk.js";import"./useDebouncedValue-CQf4QpzS.js";import"./ErrorState-DZM_kyxb.js";import"./format-De9HZKjg.js";import"./download-LYnnm2y0.js";import"./shield-check-CA34sFyn.js";import"./move-options-Cg4YrriV.js";import"./useFilters-CaSSUNWE.js";import"./confirm-dialog-DKl9zp18.js";import"./clock-CQOmlok1.js";import"./menu-Bo_ZQ3dZ.js";import"./useRefreshControl-B41i_Tqe.js";import"./circle-check-big-DT6yugdt.js";import"./useLabels-DKpzozgD.js";import"./useSemanticSearch-DDwHlaH_.js";import"./search-query-Cr_ZXBCp.js";function h(){const o=m({from:"/mail/brief/$threadId",shouldThrow:!1}),s=m({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),i=o?.threadId,e=s?.messageId;return a.useMemo(()=>i?{threadId:i,messageId:e}:void 0,[i,e])}function G(){const o=h();return d({to:"/mail/brief"}),r.jsx(t,{thread:o,children:r.jsx(n,{phone:r.jsx(t.Phone,{}),list:r.jsx(t.List,{}),reading:r.jsx(p,{}),intelligence:r.jsx(t.Intelligence,{}),hasThread:!!o})})}export{G as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a2 as i,j as o,_ as m}from"./index-CNoNYU4b.js";import{a as e}from"./search-view-CXPbecDB.js";import{F as t}from"./FlaggedPane-CT_N453X.js";import{u as p}from"./useSearchMirror--YnVEyRo.js";import"./search-scope-Ds_ghZOi.js";import"./useSearchTokenContext-DIryp5er.js";import"./kbd-BrhLdlau.js";import"./enums-CCxx0t2v.js";import"./MailListHeader-CaZUuANM.js";import"./search-token-index-BTQUgi2G.js";import"./useMediaQuery-CAv9qAps.js";import"./account-form-helpers-Bsx48lx1.js";import"./avatar-DdSaEl5o.js";import"./useSignature-C0EjJ_Wk.js";import"./useDebouncedValue-CQf4QpzS.js";import"./ErrorState-DZM_kyxb.js";import"./format-De9HZKjg.js";import"./download-LYnnm2y0.js";import"./shield-check-CA34sFyn.js";import"./nav-link-BCGmsThK.js";import"./move-options-Cg4YrriV.js";import"./useFilters-CaSSUNWE.js";import"./confirm-dialog-DKl9zp18.js";import"./clock-CQOmlok1.js";import"./menu-Bo_ZQ3dZ.js";import"./MailViewChrome-ClVgpPFO.js";function k(){const{selectedMessageId:r}=i.useSearch();return p({to:"/mail/flagged"}),o.jsx(t,{selectedMessageId:r,children:o.jsx(e,{phone:o.jsx(t.Phone,{}),list:o.jsx(t.List,{}),reading:o.jsx(m,{}),intelligence:o.jsx(t.Intelligence,{}),hasThread:!!r})})}export{k as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,B as j,T as R,aU as G,r as u,at as H,X as V,aC as ie,aj as Y,F as le,aV as W,aW as ce,ai as de,am as me,aX as xe,q as X,P as Z,$ as U,aY as ue,aZ as he,a_ as fe,a$ as J,D as z,y as ee,al as B,ay as se,b0 as pe,a9 as ge,o as be,w as te,W as je,ax as ve,aB as ye,v as Ne,ad as q,b1 as Ce,b2 as ke,b3 as Me,b4 as we}from"./index-CNoNYU4b.js";import{P as Ie}from"./pencil-CPDJ8KvT.js";import{S as Se}from"./settings-screen-x0E-yYQb.js";import{c as Oe,d as P,e as Ae,M as De,i as K,u as ae,a as re,b as Ee,m as Q,g as Te}from"./move-options-Cg4YrriV.js";import{E as ne}from"./ErrorState-DZM_kyxb.js";import"./avatar-DdSaEl5o.js";import"./menu-Bo_ZQ3dZ.js";import"./circle-help-BJ-e95sd.js";import"./enums-CCxx0t2v.js";const Pe=({label:s,onRename:n,onDelete:t,deleteBlockedReason:i,renameLabel:d=c=>`Rename ${c}`,deleteLabel:r=c=>`Delete ${c}`})=>{const c=i?`${r(s)} — ${i}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-3.5"}),"aria-label":d(s),onClick:n}),e.jsx("span",{title:i,children:e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-label":c,disabled:i!==void 0,onClick:t})})]})},Fe=({folders:s,onRename:n,onDelete:t,onCreateFolder:i,delimiter:d,labels:r})=>{const c=new Map(s.map(o=>[o.id,o]));return e.jsx(G,{folders:s,onCreateFolder:i,delimiter:d,labels:{treeAriaLabel:"Your folders",optionLabel:o=>o,...r},rowActions:o=>{const a=c.get(o.id);return a?e.jsx(Pe,{label:a.label,deleteBlockedReason:a.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>n(a),onDelete:()=>t(a)}):null}})},Re=({open:s,folderLabel:n,defaultLabel:t,name:i,onNameChange:d,onSubmit:r,onClose:c,pending:o=!1,error:a})=>{const l=u.useId(),p=`Rename ${n}`;return s?e.jsxs(H,{open:s,onClose:c,title:p,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:p}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(V,{className:"size-3.5"}),onClick:c,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(ie,{htmlFor:l,children:"Folder name"}),e.jsx(Y,{id:l,value:i,placeholder:t,onChange:m=>d(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),r())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:t}),"."]}),a&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:a})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:c,children:"Cancel"}),e.jsx(j,{variant:"primary",size:"sm",onClick:r,disabled:o,children:o?"Saving…":"Save name"})]})]}):null},ze=["inbox","drafts","sent","archive","junk","trash"],L="";function Le(s){const n=s.messageCount===1?"msg":"msgs";return`${W(s.providerPath)} · ${s.messageCount} ${n}`}function $e({role:s,folders:n,appointedId:t,displayName:i,onAppoint:d,onRename:r}){const[c,o]=u.useState(i),a=n.find(m=>m.mailboxId===t)??null,l=xe(s),p=a!=null&&c.trim()!==i.trim();return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[ce(s),l]}),e.jsxs(de,{className:"w-56 shrink-0",value:t??L,"aria-label":`Folder for ${l}`,onChange:m=>d(s,m.target.value===L?null:m.target.value),children:[e.jsx("option",{value:L,children:"None"}),n.map(m=>e.jsx("option",{value:m.mailboxId,children:Le(m)},m.mailboxId))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"flex-1",value:c,placeholder:l,"aria-label":`Display name for ${l}`,onChange:m=>o(m.target.value)}),p&&e.jsx(j,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(me,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(a.mailboxId,c)})]})]}),a&&e.jsxs("span",{className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:a.providerPath,children:[a.providerPath," · ",a.messageCount," ",a.messageCount===1?"message":"messages"]})]})}function _e({accountEmail:s,folders:n,appointments:t,displayNames:i={},onAppoint:d,onRename:r}){const c=new Set(Object.values(t).filter(a=>a!=null)),o=n.filter(a=>!c.has(a.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each role points to one folder. Pick the folder that holds the mail — the counts help you tell real folders from empty look-alikes. Appointing a folder here removes it from any other role."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:ze.map(a=>{const l=t[a]??null;return e.jsx($e,{role:a,folders:n,appointedId:l,displayName:l?i[l]??"":"",onAppoint:d,onRename:r},a)})}),o.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:o.map(a=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(le,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:W(a.providerPath)}),e.jsxs("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:[a.messageCount," ",a.messageCount===1?"message":"messages"]})]},a.mailboxId))})]})]})}const oe=50,Be=s=>s instanceof Error?s.message:"Something went wrong.",T=s=>s.then(n=>({ok:!0,value:n}),n=>({ok:!1,error:Be(n)})),qe=async(s,n,t,i)=>{const d=[];let r;for(let c=0;c<oe;c+=1){if(i.aborted)return d;const{data:o}=await J({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const a of o.items)if(!a.isDeleted&&!n.has(a.messageId)&&!d.includes(a.messageId)&&(d.push(a.messageId),d.length>=t))return d;if(!o.continuationToken)break;r=o.continuationToken}return d},Ke=async(s,n)=>{let t=0,i;for(let d=0;d<oe;d+=1){if(n.aborted)return t;const{data:r}=await J({path:{mailboxId:s},query:{order:"desc",continuationToken:i},throwOnError:!0});for(const c of r.items)c.isDeleted||(t+=1);if(!r.continuationToken)break;i=r.continuationToken}return t};function Qe({accountId:s,mailboxId:n,onDeleted:t}){const i=X(),[d,r]=u.useState("idle"),[c,o]=u.useState(null),[a,l]=u.useState(),p=u.useRef(null),m=u.useCallback(()=>{i.invalidateQueries({queryKey:Z({path:{accountId:s}})}),i.invalidateQueries({queryKey:U()})},[i,s]),N=u.useCallback(async()=>{r("deleting");const b=await T(ue({path:{accountId:s,mailboxId:n},throwOnError:!0}));if(!b.ok){l(b.error),r("error");return}m(),r("done"),t()},[s,n,m,t]),C=u.useCallback(()=>he({path:{accountId:s},throwOnError:!0}).then(({data:b})=>b.items.find(g=>g.mailboxId===n)?.messageCount??0),[s,n]),E=u.useCallback(()=>{p.current?.abort()},[]),w=u.useCallback(async b=>{const g=new AbortController;p.current=g;const{signal:f}=g;r("moving"),l(void 0);const I=await T(C());if(f.aborted)return;if(!I.ok){l(I.error),r("error");return}let h=Oe(I.value);o(h);const k=new Set;for(;;){if(f.aborted)return;const v=await T(qe(n,k,De,f));if(f.aborted)return;if(!v.ok){h=P(h,v.error),o(h),l(v.error),r("error");return}const M=v.value;if(M.length===0)break;const A=await T(fe({body:{messageIds:M,destinationMailboxId:b},throwOnError:!0}));if(f.aborted)return;if(!A.ok){h=P(h,A.error),o(h),l(A.error),r("error");return}for(const S of M)k.add(S);h=Ae(h,M.length),o(h)}const y=await T(Ke(n,f));if(!f.aborted){if(!y.ok){h=P(h,y.error),o(h),l(y.error),r("error");return}if(y.value>0){const v=`${y.value} ${y.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;h=P(h,v),o(h),l(v),r("error"),m();return}await N()}},[n,C,N,m]),D=u.useCallback(()=>{p.current?.abort(),p.current=null,r("idle"),o(null),l(void 0)},[]);return{phase:d,progress:c,errorMessage:a,deleteMailbox:N,moveThenDelete:w,cancel:E,reset:D}}const F=s=>`${s} ${s===1?"email":"emails"}`;function Ge({open:s,accountId:n,folder:t,mailboxes:i,appointments:d,onClose:r}){const[c,o]=u.useState(()=>K(t.messageCount)),[a,l]=u.useState(),{createFolderIn:p}=ae(n),m=re(),{phase:N,progress:C,errorMessage:E,deleteMailbox:w,moveThenDelete:D,cancel:b,reset:g}=Qe({accountId:n,mailboxId:t.mailboxId,onDeleted:r});u.useEffect(()=>{s&&(o(K(t.messageCount)),g())},[s,t.messageCount,g]),u.useEffect(()=>{s&&l(void 0)},[s]),u.useEffect(()=>b,[b]);const f=u.useCallback(()=>{b(),r()},[b,r]),I=u.useMemo(()=>Ee({mailboxes:i,folderAppointments:d,excludeMailboxId:t.mailboxId,translator:m}),[i,d,t.mailboxId,m]),h=I.find(M=>M.id===a),k=u.useMemo(()=>z(t,ee(d).get(t.mailboxId),m),[t,d,m]);if(!s)return null;const y=`Delete ${k}`,v=N==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:C?Q(C):"Moved 0 of 0"})]}):N==="deleting"||N==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):N==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(se,{tone:"danger",variant:"soft",children:E??"Something went wrong. Please try again."}),C&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[Q(C),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Close"})})]}):c==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:k}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder"})]})]}):c==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:k})," holds"," ",F(t.messageCount),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>o("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(R,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>o("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(pe,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"})})]}):c==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:k})," and its"," ",F(t.messageCount),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:()=>o("choose-fate"),children:"Back"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",F(t.messageCount)," in"," ",e.jsx("strong",{className:"text-fg",children:k})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(G,{folders:I,selectedId:a,delimiter:i[0]?.hierarchyDelimiter??"/",onSelect:l,onCreateFolder:p,onCancel:()=>{l(void 0),o("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),h&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(j,{variant:"danger",onClick:()=>D(h.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${F(t.messageCount)} to ${h.label}`})})})]});return e.jsxs(H,{open:s,onClose:f,title:y,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(ge,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:y}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(V,{className:"size-3.5"}),onClick:f,"aria-label":"Cancel"})]}),v]})}const He=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]});function Ve({account:s}){const n=X(),t=s.accountId,i=re(),{data:d,isPending:r,isError:c,error:o,refetch:a}=te(Ne({path:{accountId:t}})),{createFolderIn:l}=ae(t),p=q({...Ce(),onSuccess:()=>{n.invalidateQueries({queryKey:U()})}}),m=q({...ke(),onSuccess:()=>{n.invalidateQueries({queryKey:Z({path:{accountId:t}})})}}),[N,C]=u.useState(),[E,w]=u.useState(),[D,b]=u.useState(""),g=u.useMemo(()=>d?.items??[],[d]),f=u.useMemo(()=>ee(s.folderAppointments),[s.folderAppointments]),I=u.useMemo(()=>g.map(x=>({id:x.mailboxId,label:z(x,f.get(x.mailboxId),i),path:x.fullPath,deleteBlockedReason:Te(x,g,s.folderAppointments).message})),[g,f,i,s.folderAppointments]),h=(x,O)=>{p.mutate({path:{accountId:t,role:we[x]},body:{mailboxId:O}})},k=(x,O)=>{const _=O.trim();m.mutate({path:{accountId:t,mailboxId:x},body:{displayNameOverride:_===""?null:_}})};if(r)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(c)return e.jsx(ne,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:o,onRetry:()=>{a()}});const y=g.map(x=>({mailboxId:x.mailboxId,providerPath:x.fullPath,messageCount:x.messageCount})),v={};for(const x of s.folderAppointments){const O=Me[x.role];O&&(v[O]=x.mailboxId??null)}const M={};for(const x of g)x.displayNameOverride&&(M[x.mailboxId]=x.displayNameOverride);const A=x=>g.find(O=>O.mailboxId===x),S=A(E),$=A(N);return e.jsxs("div",{className:"space-y-4",children:[(p.isError||m.isError)&&e.jsx(se,{tone:"danger",variant:"soft",children:"Couldn't save that change. Please try again."}),e.jsx(_e,{accountEmail:s.email,folders:y,appointments:v,displayNames:M,onAppoint:h,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(Fe,{folders:I,delimiter:g[0]?.hierarchyDelimiter??"/",onCreateFolder:l,onRename:x=>{w(x.id),b(A(x.id)?.displayNameOverride?.trim()??"")},onDelete:x=>C(x.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),S&&e.jsx(Re,{open:!0,folderLabel:z(S,f.get(S.mailboxId),i),defaultLabel:z({fullPath:S.fullPath},f.get(S.mailboxId),i),name:D,onNameChange:b,pending:m.isPending,error:m.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const x=D.trim();m.mutate({path:{accountId:t,mailboxId:S.mailboxId},body:{displayNameOverride:x===""?null:x}},{onSuccess:()=>w(void 0)})},onClose:()=>w(void 0)}),$&&e.jsx(Ge,{open:!0,accountId:t,folder:$,mailboxes:g,appointments:s.folderAppointments,onClose:()=>C(void 0)})]})}function as(){const s=be(),[n,t]=u.useState(!0),{data:i,isPending:d,isError:r,error:c,refetch:o}=te(je()),a=l=>{const p=ye[l];p&&s({to:p})};return e.jsx(Se,{items:ve,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:He,helpOpen:n,onToggleHelp:()=>t(l=>!l),onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:d?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):r?e.jsx(ne,{title:"Couldn't load accounts",error:c,onRetry:()=>{o()}}):i.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>e.jsx(Ve,{account:l},l.accountId))})})}export{as as component};
|
package/assets/index-BNu6TlV_.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-CNoNYU4b.js";import{B as o}from"./BriefPane-BJxOwp8m.js";import"./useSearchTokenContext-DIryp5er.js";import"./kbd-BrhLdlau.js";import"./enums-CCxx0t2v.js";import"./search-scope-Ds_ghZOi.js";import"./MailListHeader-CaZUuANM.js";import"./search-token-index-BTQUgi2G.js";import"./useMediaQuery-CAv9qAps.js";import"./account-form-helpers-Bsx48lx1.js";import"./avatar-DdSaEl5o.js";import"./useSignature-C0EjJ_Wk.js";import"./useDebouncedValue-CQf4QpzS.js";import"./ErrorState-DZM_kyxb.js";import"./format-De9HZKjg.js";import"./download-LYnnm2y0.js";import"./shield-check-CA34sFyn.js";import"./nav-link-BCGmsThK.js";import"./move-options-Cg4YrriV.js";import"./useFilters-CaSSUNWE.js";import"./confirm-dialog-DKl9zp18.js";import"./clock-CQOmlok1.js";import"./menu-Bo_ZQ3dZ.js";import"./useRefreshControl-B41i_Tqe.js";import"./circle-check-big-DT6yugdt.js";import"./useLabels-DKpzozgD.js";import"./useSemanticSearch-DDwHlaH_.js";import"./search-query-Cr_ZXBCp.js";function z(){return r.jsx(o.Reading,{})}export{z as component};
|
package/assets/index-BXK1iByh.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-CNoNYU4b.js";import{M as i}from"./MailboxPane-Cpo0ICDX.js";import"./useSearchTokenContext-DIryp5er.js";import"./kbd-BrhLdlau.js";import"./enums-CCxx0t2v.js";import"./search-scope-Ds_ghZOi.js";import"./useRefreshControl-B41i_Tqe.js";import"./circle-check-big-DT6yugdt.js";import"./search-token-index-BTQUgi2G.js";import"./useMediaQuery-CAv9qAps.js";import"./MailListHeader-CaZUuANM.js";import"./account-form-helpers-Bsx48lx1.js";import"./avatar-DdSaEl5o.js";import"./useSignature-C0EjJ_Wk.js";import"./useDebouncedValue-CQf4QpzS.js";import"./ErrorState-DZM_kyxb.js";import"./format-De9HZKjg.js";import"./download-LYnnm2y0.js";import"./shield-check-CA34sFyn.js";import"./nav-link-BCGmsThK.js";import"./move-options-Cg4YrriV.js";import"./useFilters-CaSSUNWE.js";import"./confirm-dialog-DKl9zp18.js";import"./clock-CQOmlok1.js";import"./menu-Bo_ZQ3dZ.js";import"./MailViewChrome-ClVgpPFO.js";import"./NavMenuButton-D-esVAha.js";import"./useLabels-DKpzozgD.js";import"./useSemanticSearch-DDwHlaH_.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DmAG_FCk.js";import"./circle-help-BJ-e95sd.js";import"./circle-check-DZneB6gk.js";import"./intelligence-pref-C6lFpj6U.js";function H(){return o.jsx(i.Reading,{})}export{H as component};
|