@remit/web-client-dist 0.0.429 → 0.0.430
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-CytP3J7O.js +1 -0
- package/assets/{ErrorState-CNHmvGYF.js → ErrorState-B_pp6XjY.js} +1 -1
- package/assets/FlaggedPane-BTGAqs21.js +1 -0
- package/assets/FullCompose-D8BBZrtI.js +1 -0
- package/assets/MailListHeader-BjsRsJYI.js +7 -0
- package/assets/MailShell-CvPQWjl1.js +1 -0
- package/assets/{MailViewChrome-CZb8kPr_.js → MailViewChrome-ZN5UsScT.js} +1 -1
- package/assets/MailboxPane-Bca57rKs.js +1 -0
- package/assets/{NavMenuButton-BIPTnOry.js → NavMenuButton-_aiK1QXb.js} +1 -1
- package/assets/OnboardingWizard-BdBknD3m.js +1 -0
- package/assets/OutboxPane-3nlNVjx6.js +1 -0
- package/assets/_mailboxId-ByYUZV2Y.js +1 -0
- package/assets/_messageId-DLU18Mnl.js +1 -0
- package/assets/_messageId-DzC6VHu2.js +1 -0
- package/assets/_messageId-yJtPeY_Z.js +1 -0
- package/assets/_outboxMessageId-AEnONMiY.js +1 -0
- package/assets/_threadId-BdblixoD.js +1 -0
- package/assets/_threadId-CC5eBVBw.js +1 -0
- package/assets/_threadId-Cb8ALPnU.js +1 -0
- package/assets/accounts-Cji9zFqV.js +1 -0
- package/assets/{advanced-DKEc5X7D.js → advanced-BXCAioJN.js} +2 -2
- package/assets/appearance-Dg7qROVT.js +1 -0
- package/assets/{attachment-file-BrXH3M3V.js → attachment-file-CLrI3kMw.js} +1 -1
- package/assets/{avatar-DtND0ruk.js → avatar-C8lpjlQO.js} +1 -1
- package/assets/{bottom-sheet-Cpg512Z8.js → bottom-sheet-BuEgZWXh.js} +1 -1
- package/assets/brief-06HoE0GS.js +1 -0
- package/assets/{brief-CP_gyoWx.js → brief-Dt7lMB8R.js} +1 -1
- package/assets/{browser-ponyfill-BQQucyWN.js → browser-ponyfill-g58jgFl_.js} +2 -2
- package/assets/{bug-D-5qIgn1.js → bug-CDU4oK_3.js} +1 -1
- package/assets/{circle-check-CyTXHuU4.js → circle-check-BhMyR8BA.js} +1 -1
- package/assets/{circle-check-big-BCgBHZQm.js → circle-check-big-5NMrNFUI.js} +1 -1
- package/assets/{circle-help-lK4oidSt.js → circle-help-BAup3nOG.js} +1 -1
- package/assets/{clock-CpWsGek7.js → clock-DCdX5E4T.js} +1 -1
- package/assets/compose._-_outboxMessageId_-CyN4sUxa.js +1 -0
- package/assets/compose._-_outboxMessageId_-D5_JMiLJ.js +1 -0
- package/assets/compose._-_outboxMessageId_-Db3_5Bzx.js +1 -0
- package/assets/compose._-_outboxMessageId_-YqQysly2.js +1 -0
- package/assets/{confirm-dialog-CSNgGV-I.js → confirm-dialog-BxXd7BDT.js} +1 -1
- package/assets/{download-Yg8MAJuV.js → download-Br1uSntK.js} +1 -1
- package/assets/filters-snY8U8V2.js +1 -0
- package/assets/{flagged-CPZoSWDR.js → flagged-DBt5871J.js} +1 -1
- package/assets/flagged-DErOl3l4.js +1 -0
- package/assets/folders-BzRKidwZ.js +1 -0
- package/assets/{help-copy-o2bu5jXr.js → help-copy-D1mikTkH.js} +1 -1
- package/assets/index--TsBKY5T.js +1 -0
- package/assets/index-BG1B897N.js +1 -0
- package/assets/index-BIcRfpbR.js +1 -0
- package/assets/index-DLU18Mnl.js +1 -0
- package/assets/{index-DwTAdS0U.js → index-DX5RhVmh.js} +7 -7
- package/assets/index-DqLBbxu3.js +1 -0
- package/assets/index-DwKeNLeB.js +1 -0
- package/assets/{index-D_YBuI3z.js → index-idulIG65.js} +69 -69
- package/assets/index-yJtPeY_Z.js +1 -0
- package/assets/index-zNCEv1vY.js +1 -0
- package/assets/{kbd-BUm8HPo9.js → kbd-eZWvlfcb.js} +1 -1
- package/assets/labels-DFa210V0.js +1 -0
- package/assets/{mail-yZgIYq66.js → mail-Ba7j-n-X.js} +1 -1
- package/assets/mail-lLnBwPN-.js +1 -0
- package/assets/{menu-B4mmeG34.js → menu-MXmFQ7m-.js} +1 -1
- package/assets/onboarding-BQv4jg_d.js +1 -0
- package/assets/outbox-Dye6uwnb.js +1 -0
- package/assets/{pencil-rdzjE11g.js → pencil-CFys2EU7.js} +1 -1
- package/assets/{rich-text-BKM0xPkp.js → rich-text-DUWqcHC5.js} +3 -3
- package/assets/{rich-text-spellcheck-worker-provider-Dg635-7T.js → rich-text-spellcheck-worker-provider-DTxcyJ9W.js} +1 -1
- package/assets/{rotate-ccw-5k3dg52M.js → rotate-ccw-DfGOnKhE.js} +1 -1
- package/assets/{row-actions-BGPkkIDv.js → row-actions-zVghhE3a.js} +1 -1
- package/assets/search-mirror-_pK4jqc8.js +1 -0
- package/assets/search-scope-DTcpOp3S.js +1 -0
- package/assets/search-token-index-C-cpQFN3.js +1 -0
- package/assets/senders-Gj8Yentl.js +1 -0
- package/assets/settings-D96it8Kf.js +1 -0
- package/assets/{settings-screen-D53GKsd_.js → settings-screen-B17eDLDl.js} +1 -1
- package/assets/{shield-check-BZ36Y5z_.js → shield-check-DG9twqa-.js} +1 -1
- package/assets/suggested-vips--KmGV5np.js +1 -0
- package/assets/{useDebouncedValue-4E-721vu.js → useDebouncedValue-CntZIoMR.js} +1 -1
- package/assets/{useFilters-BdPFYyLi.js → useFilters-DaiBln2b.js} +1 -1
- package/assets/useLabels-amyS-Wph.js +1 -0
- package/assets/useMessageBodyContent-5kw10g9a.js +1 -0
- package/assets/useRefreshControl-CUTMAyIA.js +1 -0
- package/assets/{useSearchTokenContext-DROeO7xw.js → useSearchTokenContext-BxDapNdu.js} +4 -4
- package/assets/useSemanticSearch-BDxoAQSc.js +1 -0
- package/assets/useSignature-osTmnWZe.js +1 -0
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/BriefPane-D4GKn4Vw.js +0 -1
- package/assets/FlaggedPane-CIICNSCS.js +0 -1
- package/assets/FullCompose-B0bbns1M.js +0 -1
- package/assets/MailListHeader-BcdPneAy.js +0 -7
- package/assets/MailboxPane-MXdO0Vz2.js +0 -1
- package/assets/OnboardingWizard-yfi2kykm.js +0 -1
- package/assets/OutboxPane-mFkq2dEJ.js +0 -1
- package/assets/_mailboxId--xq6K8vG.js +0 -1
- package/assets/_messageId-CTALYmhq.js +0 -1
- package/assets/_messageId-CmMd3Ukp.js +0 -1
- package/assets/_messageId-CtxjpTtR.js +0 -1
- package/assets/_outboxMessageId-VPhQOPhK.js +0 -1
- package/assets/_threadId-1kFdcas1.js +0 -1
- package/assets/_threadId-7ZWe-9US.js +0 -1
- package/assets/_threadId-DNmSvZSP.js +0 -1
- package/assets/accounts--GnFjtNP.js +0 -1
- package/assets/appearance-Bn-KJ5jL.js +0 -1
- package/assets/brief-DWBpwjTi.js +0 -1
- package/assets/compose._-_outboxMessageId_-Bh6SV1dn.js +0 -1
- package/assets/compose._-_outboxMessageId_-CYWE1jEd.js +0 -1
- package/assets/compose._-_outboxMessageId_-Cn0WCeO7.js +0 -1
- package/assets/compose._-_outboxMessageId_-SUbFIkQY.js +0 -1
- package/assets/filters-BYXepTJ3.js +0 -1
- package/assets/flagged-CtM4krn0.js +0 -1
- package/assets/folders-BMWrmSe-.js +0 -1
- package/assets/index-BaVdEvyR.js +0 -1
- package/assets/index-BgNbixl6.js +0 -1
- package/assets/index-C015CYKF.js +0 -1
- package/assets/index-Cf-KjbzP.js +0 -1
- package/assets/index-CmMd3Ukp.js +0 -1
- package/assets/index-CtxjpTtR.js +0 -1
- package/assets/index-TQGaXC_d.js +0 -1
- package/assets/index-zMBRTYBv.js +0 -1
- package/assets/labels-DriP01Rs.js +0 -1
- package/assets/mail-Byqd_siN.js +0 -1
- package/assets/onboarding-BbbW2CcQ.js +0 -1
- package/assets/outbox-B7YGZwez.js +0 -1
- package/assets/search-scope-MtY0zpRq.js +0 -1
- package/assets/search-token-index-nAK4hI7B.js +0 -1
- package/assets/search-view-CtInfT0I.js +0 -1
- package/assets/senders-CRCPlNSI.js +0 -1
- package/assets/settings-zuLLX00L.js +0 -1
- package/assets/suggested-vips-BZprt8nM.js +0 -1
- package/assets/useLabels-CwcqSC09.js +0 -1
- package/assets/useMediaQuery-CDMcFeIb.js +0 -1
- package/assets/useMessageBodyContent-DEOYO0s3.js +0 -1
- package/assets/useRefreshControl-h1VyXjLX.js +0 -1
- package/assets/useSearchMirror-rswuH5l3.js +0 -1
- package/assets/useSemanticSearch-RnkqtV8e.js +0 -1
- package/assets/useSignature-C3CmLf8D.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as Y,a7 as Z,aO as ee,aP as te,r as x,aQ as ae,j as t,aR as se,aS as ie,af as R,B as N,an as ne,at as re,aT as oe,aU as le,T as ce,s as P,q as de,aV as me,v as ue,x as pe,aW as xe,aX as fe,m as he,Q as ge,ar as ve,av as be}from"./index-D_YBuI3z.js";import{S as ye}from"./settings-screen-D53GKsd_.js";import{B as je}from"./bottom-sheet-Cpg512Z8.js";import{u as Ne}from"./useMediaQuery-CDMcFeIb.js";import{u as Ce,a as Se}from"./useLabels-CwcqSC09.js";import{b as Fe,N as S,p as Me,u as Ie,r as Oe,a as we,S as L,c as Ee,n as De,f as Ae,d as Le,e as Te,g as ke}from"./useFilters-BdPFYyLi.js";import{C as A}from"./circle-check-CyTXHuU4.js";import{E as $}from"./ErrorState-CNHmvGYF.js";import"./avatar-DtND0ruk.js";import"./menu-B4mmeG34.js";import"./circle-help-lK4oidSt.js";const Re=(e,a)=>{const r=Y(),i=Z({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:Fe(e)}),a&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:a}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!a||c({path:{accountId:e,filterId:a},body:d})},[e,a,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},Pe=(e,a=!1)=>({clauses:e.literalClauses.map((i,c)=>({id:`clause-${c}`,field:i.field,value:i.value})),matchOperator:e.matchOperator==="And"?"all":"any",widen:e.hasAnchor?{anchorCount:1,...a?{inactive:!0}:{}}:void 0,moveMailboxId:e.actionMailboxId!==S?e.actionMailboxId:void 0,labelId:e.actionLabelId!==S?e.actionLabelId:void 0,scope:e.scope==="Temporary"?"until":"standing",until:e.scope==="Temporary"?$e(e.expiresAt):void 0,name:e.name}),$e=e=>{if(!e)return"";const a=Date.parse(e);if(Number.isNaN(a))return"";const r=new Date(a),i=c=>String(c).padStart(2,"0");return`${r.getFullYear()}-${i(r.getMonth()+1)}-${i(r.getDate())}`},T=e=>JSON.stringify({clauses:e.clauses.map(a=>[a.field,a.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),z=(e,a)=>T(e)!==T(a),k=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),U=(e,a)=>k(e)!==k(a),ze=(e,a)=>{const r={},i=(e.name??"").trim();return i!==(a.name??"").trim()&&(r.name=i),z(e,a)&&(r.matchOperator=e.matchOperator==="all"?"And":"Or",r.literalClauses=e.clauses.map(c=>({field:c.field,value:c.value})),r.actionMailboxId=e.moveMailboxId??S,r.actionLabelId=e.labelId??S),U(e,a)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=Me(e.until??""))),r};function Ue({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>Pe(a,g),[a,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,b]=x.useState(!1),M=x.useRef(0),{count:C}=Ie(e,Oe(n)),j=Re(e,a.filterId),v=we(e),{createFolderIn:F}=ae(e),{createLabel:w}=Ce(e),I=async o=>{const s=await w(o);return{id:s.labelId,name:s.name,color:s.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),O=o=>{const s=n.clauses.find(y=>y.id===o);s&&u({mode:"edit",clauseId:o,draft:{field:s.field,value:s.value}})},E=o=>u(s=>s&&{...s,draft:{...s.draft,field:o}}),_=o=>u(s=>s&&{...s,draft:{...s.draft,value:o}}),B=()=>{if(!m)return;const o=m.draft.field,s=De(o,m.draft.value);s!==""&&(l(y=>m.mode==="edit"&&m.clauseId?{...y,clauses:y.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:s}:D)}:(M.current+=1,{...y,clauses:[...y.clauses,{id:`new-${M.current}`,field:o,value:s}]})),u(void 0))},Q=o=>l(s=>({...s,clauses:s.clauses.filter(y=>y.id!==o)})),K=o=>l(s=>({...s,matchOperator:o})),V=o=>l(s=>({...s,moveMailboxId:o||void 0})),q=o=>l(s=>({...s,labelId:o||void 0})),G=o=>l(s=>({...s,name:o})),H=o=>l(s=>({...s,scope:o,until:o==="until"?s.until:void 0})),J=o=>l(s=>({...s,until:o})),W=()=>{const o=z(n,f)||U(n,f),s=ze(n,f);if(Object.keys(s).length===0){d();return}b(o),j.updateFilter(s)},X=()=>v.start(Ee(n));return v.isStarting||v.isRunning||v.isDone?t.jsx(Ke,{progress:v.progress,isDone:v.isDone,onClose:d}):j.isPending?t.jsx(_e,{}):j.isError?t.jsx(Ve,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Qe,{preview:se(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:X,onClose:d}):t.jsx(Be,{onClose:d}):t.jsx(ie,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:O,onRemoveClause:Q,onChangeDraftField:E,onChangeDraftValue:_,onSubmitClause:B,onCancelClause:()=>u(void 0),onChangeMatchOperator:K,onChangeMove:V,onCreateFolder:F,onChangeLabel:q,onCreateLabel:I,onChangeName:G,onChangeScope:H,onChangeUntil:J,onCommit:W,onCancel:d})}function _e(){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function Be({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),t.jsx(N,{variant:"primary",onClick:e,className:"mt-2",children:"Done"})]})}function Qe({preview:e,blocked:a,onReapply:r,onClose:i}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),t.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",e," — move the mail already in your mailbox too?"]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:r,disabled:a,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Ke({progress:e,isDone:a,onClose:r}){const i=e.state==="Failed";return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[a?i?t.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):t.jsx(A,{className:"size-8 text-positive"}):t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),!a&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),a&&!i&&t.jsxs("div",{className:"text-sm text-fg",children:[t.jsx("p",{className:"font-medium",children:"Done"}),t.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[e.appliedCount," of ",e.matchedCount," moved",e.failedCount>0?` · ${e.failedCount} failed`:"","."]})]}),a&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),a&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function Ve({onRetry:e,onClose:a}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:e,children:"Try again"}),t.jsx(N,{variant:"ghost",onClick:a,children:"Not now"})]})]})}function qe({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=Ne(),n=t.jsx(Ue,{accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(ne,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(je,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Ge({filters:e,mailboxName:a,labelById:r,onEdit:i,onDelete:c,deletingFilterId:g,semanticUnavailable:d=!1,now:f=Date.now()}){return e.length===0?t.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):t.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:e.map(n=>{const l=Ae(n,f),m=l==="Expired",u=n.actionMailboxId!==S?a(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,b=Le(n.expiresAt);return t.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:()=>i(n.filterId),"aria-label":`Edit filter ${n.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`truncate text-sm font-medium ${m?"text-fg-muted":"text-fg"}`,children:n.name}),t.jsx(re,{tone:m?"neutral":"positive",dot:!0,children:l})]}),t.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[u?`Moves matches to ${u}`:"No move action",n.scope==="Temporary"&&b?m?` · expired ${b}`:` · until ${b}`:n.scope==="Standing"?" · always":""]}),(n.hasAnchor||h)&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[n.hasAnchor&&t.jsx(oe,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(le,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(ce,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const He=t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",t.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",t.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),t.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."})]});function Je({account:e}){const a=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=Te(a),{deleteFilter:f,deletingFilterId:n}=ke(a),[l,m]=x.useState(),{data:u}=P({...de({path:{accountId:a}}),staleTime:1/0}),h=me(),b=x.useMemo(()=>ue(e.folderAppointments),[e.folderAppointments]),M=x.useCallback(p=>{const O=u?.items.find(E=>E.mailboxId===p);if(O)return pe(O,b.get(p),h)},[u?.items,b,h]),C=x.useMemo(()=>xe({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=fe(u?.items??[]),{labels:v}=Se(a),F=x.useMemo(()=>v.map(p=>({id:p.labelId,name:p.name,color:p.color})),[v]),w=x.useMemo(()=>new Map(F.map(p=>[p.id,p])),[F]),I=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),I&&t.jsx(qe,{accountId:a,filter:I,folders:C,delimiter:j,labels:F,onClose:()=>m(void 0)}),i?t.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${e.email}`}):c?t.jsx($,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Ge,{filters:r,mailboxName:M,labelById:w,onEdit:m,onDelete:f,deletingFilterId:n})]})}function ot(){const e=he(),[a,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=P(ge()),n=l=>{const m=be[l];m&&e({to:m})};return t.jsx(ye,{items:ve,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:He,helpOpen:a,onToggleHelp:()=>r(l=>!l),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:c?t.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):g?t.jsx($,{title:"Couldn't load accounts",error:d,onRetry:()=>{f()}}):i.accounts.length===0?t.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):t.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>t.jsx(Je,{account:l},l.accountId))})})}export{Je as AccountFilters,ot as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o,U as i}from"./index-D_YBuI3z.js";import{a as m}from"./search-view-CtInfT0I.js";import{F as r}from"./FlaggedPane-CIICNSCS.js";import{u as p}from"./useSearchMirror-rswuH5l3.js";import"./useMessageBodyContent-DEOYO0s3.js";import{f as e}from"./search-token-index-nAK4hI7B.js";import"./FullCompose-B0bbns1M.js";import"./ErrorState-CNHmvGYF.js";import"./index-DwTAdS0U.js";import"./useSignature-C3CmLf8D.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-4E-721vu.js";import"./useMediaQuery-CDMcFeIb.js";import"./confirm-dialog-CSNgGV-I.js";import"./useSearchTokenContext-DROeO7xw.js";import"./kbd-BUm8HPo9.js";import"./search-scope-MtY0zpRq.js";import"./MailListHeader-BcdPneAy.js";import"./attachment-file-BrXH3M3V.js";import"./mail-yZgIYq66.js";import"./avatar-DtND0ruk.js";import"./format-23Av07Go.js";import"./download-Yg8MAJuV.js";import"./shield-check-BZ36Y5z_.js";import"./useFilters-BdPFYyLi.js";import"./clock-CpWsGek7.js";import"./menu-B4mmeG34.js";import"./MailViewChrome-CZb8kPr_.js";import"./wizard-selection-B1bng5Jq.js";function w(){const t=e();return p({to:"/mail/flagged"}),o.jsx(r,{thread:t,children:o.jsx(m,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!t})})}export{w as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,B as N,T as Q,aY as Y,r as c,an as W,X,aw as he,ad as Z,F as xe,aZ as G,a_ as fe,ac as pe,ag as ge,as as L,az as be,a$ as ve,n as J,K as ee,V as se,b0 as ye,b1 as je,ax as Ne,J as ke,b2 as Ce,b3 as _,b4 as we,b5 as Se,b6 as te,b7 as Me,b8 as H,aQ as ae,aV as re,aW as Ie,x as B,v as ne,af as K,b9 as V,ba as Ee,a3 as De,bb as Ae,m as Oe,s as ie,Q as Te,ar as Re,av as Fe,q as Pe,a7 as U,bc as $e,bd as ze,be as Le,aD as _e,bf as Qe,bg as Be}from"./index-D_YBuI3z.js";import{P as Ke}from"./pencil-rdzjE11g.js";import{S as qe}from"./settings-screen-D53GKsd_.js";import{E as oe}from"./ErrorState-CNHmvGYF.js";import"./avatar-DtND0ruk.js";import"./menu-B4mmeG34.js";import"./circle-help-lK4oidSt.js";const Ge=({label:s,onRename:t,onDelete:a,deleteBlockedReason:o,renameLabel:m=u=>`Rename ${u}`,deleteLabel:r=u=>`Delete ${u}`})=>{const u=o?`${r(s)} — ${o}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Ke,{className:"size-3.5"}),"aria-label":m(s),onClick:t}),e.jsx("span",{title:o,children:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Q,{className:"size-3.5"}),"aria-label":u,disabled:o!==void 0,onClick:a})})]})},He=({folders:s,onRename:t,onDelete:a,onCreateFolder:o,delimiter:m,labels:r})=>{const u=new Map(s.map(l=>[l.id,l]));return e.jsx(Y,{folders:s,onCreateFolder:o,delimiter:m,labels:{treeAriaLabel:"Your folders",optionLabel:l=>l.label,...r},rowActions:l=>{const i=u.get(l.id);return i?e.jsx(Ge,{label:i.label,deleteBlockedReason:i.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>t(i),onDelete:()=>a(i)}):null}})},Ve=({open:s,folderLabel:t,defaultLabel:a,name:o,onNameChange:m,onSubmit:r,onClose:u,pending:l=!1,error:i})=>{const d=c.useId(),g=`Rename ${t}`;return s?e.jsxs(W,{open:s,onClose:u,title:g,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:g}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:u,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(he,{htmlFor:d,children:"Folder name"}),e.jsx(Z,{id:d,value:o,placeholder:a,onChange:p=>m(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.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:a}),"."]}),i&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:i})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:u,children:"Cancel"}),e.jsx(N,{variant:"primary",size:"sm",onClick:r,disabled:l,children:l?"Saving…":"Save name"})]})]}):null},Ue=["inbox","drafts","sent","archive","junk","trash"],q="",Ye={mailboxId:null,source:"None"};function We(s){const t=s.messageCount===1?"msg":"msgs";return`${G(s.providerPath,s.hierarchyDelimiter)} · ${s.messageCount} ${t}`}const le=s=>`${s} ${s===1?"message":"messages"}`,Xe=(s,t)=>s==="Appointed"?"Chosen by you":s==="Flagged"?`The mail server marks it as ${t}`:s==="Reserved"?"The account's own INBOX":"Matched by name, not confirmed";function Ze({role:s,folders:t,appointment:a,displayName:o,onAppoint:m,onRename:r}){const[u,l]=c.useState(o),i=c.useRef(null),d=c.useRef(!1),g=c.useId(),{mailboxId:p,source:v,staleFolderPath:y}=a,h=t.find(j=>j.mailboxId===p)??null,f=be(s),O=h!=null&&u.trim()!==o.trim();c.useEffect(()=>{!d.current||v==="Proposed"||(d.current=!1,i.current?.focus())},[v]);const I=(()=>{if(v==="None"){const j=s==="trash"?" Deleting mail needs one.":"";return e.jsx("span",{id:g,className:"pl-[7.5rem] text-xs text-fg-muted",children:`Not set — pick the folder this account uses for ${f}.${j}`})}return v==="Stale"||!h?null:e.jsx("span",{id:g,className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:h.providerPath,children:`${Xe(v,f)} · ${h.providerPath} · ${le(h.messageCount)}`})})(),w=s==="trash"?" Deleting mail is stopped until you pick another one.":h?` reader is using ${G(h.providerPath,h.hierarchyDelimiter)} instead.`:"",A=`The folder you chose for ${f}${y?` — ${y} —`:""} is gone from the mail server.${w}`;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:[fe(s),f]}),e.jsxs(pe,{ref:i,className:"w-56 shrink-0",value:p??q,"aria-label":`Folder for ${f}`,"aria-describedby":I||v==="Stale"?g:void 0,onChange:j=>m(s,j.target.value===q?null:j.target.value),children:[e.jsx("option",{value:q,children:"None"}),t.map(j=>e.jsx("option",{value:j.mailboxId,children:We(j)},j.mailboxId))]}),v==="Proposed"&&h&&e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{d.current=!0,m(s,h.mailboxId)},children:`Set as ${f}`}),h&&e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"flex-1",value:u,placeholder:f,"aria-label":`Display name for ${f}`,onChange:j=>l(j.target.value)}),O&&e.jsx(N,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(ge,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(h.mailboxId,u)})]})]}),I,v==="Stale"&&e.jsx(L,{tone:"warning",variant:"soft",className:"ml-[7.5rem]",children:e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{id:g,className:"flex-1",children:A}),e.jsx(N,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>i.current?.focus(),children:"Pick a folder"})]})})]})}function Je({accountEmail:s,folders:t,appointments:a,displayNames:o={},onAppoint:m,onRename:r}){const u=new Set(Object.values(a).map(i=>i.mailboxId).filter(i=>i!=null)),l=t.filter(i=>!u.has(i.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. Each row says where its answer came from — your choice, the mail server's own flag, or a name reader matched."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Ue.map(i=>{const d=a[i]??Ye;return e.jsx(Ze,{role:i,folders:t,appointment:d,displayName:d.mailboxId?o[d.mailboxId]??"":"",onAppoint:m,onRename:r},i)})}),l.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:l.map(i=>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(xe,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:G(i.providerPath,i.hierarchyDelimiter)}),e.jsx("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:le(i.messageCount)})]},i.mailboxId))})]})]})}const es=12e4,ss=2e3,ts="This folder is no longer in the account's folder list, so nothing was deleted.",ce=(s,t)=>{const a=s.find(o=>o.mailboxId===t);if(!a)throw new Error(ts);return a},as=(s,t)=>ce(s,t).lastSyncedAt??0;async function rs({readMailboxes:s,mailboxId:t,since:a,signal:o,segmentMs:m=es,pollIntervalMs:r=ss,delay:u=ve,now:l=Date.now}){const i=l()+m;for(;;){o?.throwIfAborted();const d=ce(await s(),t);if((d.lastSyncedAt??0)>a)return{status:"fresh",messageCount:d.messagesTotal};if(l()>=i)return{status:"pending"};await u(r,o)}}const de=50,ns=s=>s instanceof Error?s.message:"Something went wrong.",$=s=>s.then(t=>({ok:!0,value:t}),t=>({ok:!1,error:ns(t)})),is=async(s,t,a,o)=>{const m=[];let r;for(let u=0;u<de;u+=1){if(o.aborted)return m;const{data:l}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const i of l.items)if(!i.isDeleted&&!t.has(i.messageId)&&!m.includes(i.messageId)&&(m.push(i.messageId),m.length>=a))return m;if(!l.continuationToken)break;r=l.continuationToken}return m},os=async(s,t)=>{let a=0,o;for(let m=0;m<de;m+=1){if(t.aborted)return a;const{data:r}=await te({path:{mailboxId:s},query:{order:"desc",continuationToken:o},throwOnError:!0});for(const u of r.items)u.isDeleted||(a+=1);if(!r.continuationToken)break;o=r.continuationToken}return a};function ls({accountId:s,mailboxId:t,onDeleted:a}){const o=J(),[m,r]=c.useState("idle"),[u,l]=c.useState(null),[i,d]=c.useState(),[g,p]=c.useState(),v=c.useRef(null),y=c.useRef(void 0),h=c.useCallback(()=>{o.invalidateQueries({queryKey:ee({path:{accountId:s}})}),o.invalidateQueries({queryKey:se()})},[o,s]),f=c.useCallback(async()=>{r("deleting");const k=await $(ye({path:{accountId:s,mailboxId:t},throwOnError:!0}));if(!k.ok){d(k.error),r("error");return}h(),r("done"),a()},[s,t,h,a]),O=c.useCallback(()=>je({path:{accountId:s},throwOnError:!0}).then(({data:k})=>k.items.find(S=>S.mailboxId===t)?.messageCount??0),[s,t]),I=c.useCallback(()=>o.fetchQuery({...Ne({path:{accountId:s}}),staleTime:0}).then(k=>k.mailboxes??[]),[o,s]),w=c.useCallback(async()=>{const k=new AbortController;v.current=k;const{signal:S}=k;r("checking"),d(void 0);const M=y.current!==void 0,C=await $((async()=>(M||(S.throwIfAborted(),y.current=as(await I(),t),S.throwIfAborted(),p(Date.now()),await ke({path:{accountId:s},throwOnError:!0})),rs({readMailboxes:I,mailboxId:t,since:y.current??0,signal:S})))());return S.aborted?(r("idle"),y.current=void 0,{status:"failed"}):C.ok?C.value.status==="pending"?(r("check-stalled"),{status:"pending"}):(y.current=void 0,C.value.messageCount>0?(r("idle"),h(),{status:"blocked",messageCount:C.value.messageCount}):(await f(),{status:"deleted"})):(y.current=void 0,d(C.error),r("error"),{status:"failed"})},[s,t,I,f,h]),A=c.useCallback(()=>{v.current?.abort()},[]),j=c.useCallback(async k=>{const S=new AbortController;v.current=S;const{signal:M}=S;r("moving"),d(void 0);const C=await $(O());if(M.aborted)return;if(!C.ok){d(C.error),r("error");return}let x=Ce(C.value);l(x);const E=new Set;for(;;){if(M.aborted)return;const n=await $(is(t,E,Me,M));if(M.aborted)return;if(!n.ok){x=_(x,n.error),l(x),d(n.error),r("error");return}const b=n.value;if(b.length===0)break;const T=await $(we({body:{messageIds:b,destinationMailboxId:k},throwOnError:!0}));if(M.aborted)return;if(!T.ok){x=_(x,T.error),l(x),d(T.error),r("error");return}for(const P of b)E.add(P);x=Se(x,b.length),l(x)}const D=await $(os(t,M));if(!M.aborted){if(!D.ok){x=_(x,D.error),l(x),d(D.error),r("error");return}if(D.value>0){const n=`${D.value} ${D.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;x=_(x,n),l(x),d(n),r("error"),h();return}await f()}},[t,O,f,h]),R=c.useCallback(()=>{v.current?.abort(),v.current=null,y.current=void 0,r("idle"),l(null),d(void 0),p(void 0)},[]);return{phase:m,progress:u,errorMessage:i,checkStartedAt:g,deleteMailbox:f,deleteIfEmpty:w,moveThenDelete:j,cancel:A,reset:R}}const z=s=>`${s} ${s===1?"email":"emails"}`;function cs({open:s,accountId:t,folder:a,mailboxes:o,appointments:m,onClose:r}){const[u,l]=c.useState(()=>H(a.messageCount)),[i,d]=c.useState(),[g,p]=c.useState(),{createFolderIn:v}=ae(t),y=re(),{phase:h,progress:f,errorMessage:O,checkStartedAt:I,deleteMailbox:w,deleteIfEmpty:A,moveThenDelete:j,cancel:R,reset:k}=ls({accountId:t,mailboxId:a.mailboxId,onDeleted:r}),[S,M]=c.useState("0:00"),C=h==="checking"||h==="check-stalled";c.useEffect(()=>{if(!C||I===void 0)return;const F=()=>M(Ae(Date.now()-I));F();const ue=setInterval(F,1e3);return()=>clearInterval(ue)},[C,I]),c.useEffect(()=>{s&&(l(H(a.messageCount)),d(void 0),k())},[s,k]),c.useEffect(()=>{s&&p(void 0)},[s]),c.useEffect(()=>R,[R]);const x=c.useCallback(()=>{R(),r()},[R,r]),E=c.useCallback(async()=>{const F=await A();F.status==="blocked"&&(d(F.messageCount),l("choose-fate"))},[A]),D=c.useMemo(()=>Ie({mailboxes:o,folderAppointments:m,excludeMailboxId:a.mailboxId,translator:y}),[o,m,a.mailboxId,y]),n=D.find(F=>F.id===g),b=c.useMemo(()=>B(a,ne(m).get(a.mailboxId),y),[a,m,y]);if(!s)return null;const T=`Delete ${b}`,P=i??a.messageCount,me=h==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(K,{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:f?V(f):"Moved 0 of 0"})]}):h==="checking"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(K,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Checking the folder on the mail server…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:`Waiting ${S}. Nothing is deleted until the server answers.`})]}):h==="check-stalled"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"warning",variant:"soft",children:`The mail server hasn't reported back on this folder yet — ${S} so far. Nothing has been deleted.`}),e.jsx("p",{className:"text-xs text-fg-muted",children:"A sync covers the whole account, so a busy mailbox can take a while to come round to this folder."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{size:"sm",onClick:()=>E(),children:"Keep waiting"})]})]}):h==="deleting"||h==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(K,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):h==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(L,{tone:"danger",variant:"soft",children:O??"Something went wrong. Please try again."}),f&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[V(f),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(N,{variant:"secondary",size:"sm",onClick:x,children:"Close"})})]}):u==="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:b}),"? 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(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(Q,{className:"size-3.5"}),onClick:()=>E(),children:"Delete folder"})]})]}):u==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[i!==void 0&&e.jsx(L,{tone:"warning",variant:"soft",children:`This folder is not empty: the mail server reports ${z(i)} in it. Nothing was deleted.`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:b})," holds"," ",z(P),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>l("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(Q,{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:()=>l("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(Ee,{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(N,{variant:"secondary",size:"sm",onClick:x,children:"Cancel"})})]}):u==="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:b})," and its"," ",z(P),"? 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(N,{variant:"secondary",size:"sm",onClick:()=>l("choose-fate"),children:"Back"}),e.jsx(N,{variant:"danger",size:"sm",icon:e.jsx(Q,{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 ",z(P)," in"," ",e.jsx("strong",{className:"text-fg",children:b})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(Y,{folders:D,selectedId:g,delimiter:o[0]?.hierarchyDelimiter??"/",onSelect:p,onCreateFolder:v,onCancel:()=>{p(void 0),l("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),n&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(N,{variant:"danger",onClick:()=>j(n.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${z(P)} to ${n.label}`})})})]});return e.jsxs(W,{open:s,onClose:x,title:T,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(De,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:T}),e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(X,{className:"size-3.5"}),onClick:x,"aria-label":"Cancel"})]}),me]})}const ds=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 ms({account:s}){const t=J(),a=s.accountId,o=re(),{data:m,isPending:r,isError:u,error:l,refetch:i}=ie(Pe({path:{accountId:a}})),{createFolderIn:d}=ae(a),g=U({...$e(),onSuccess:()=>{t.invalidateQueries({queryKey:se()})}}),p=U({...ze(),onSuccess:()=>{t.invalidateQueries({queryKey:ee({path:{accountId:a}})})}}),[v,y]=c.useState(),[h,f]=c.useState(),[O,I]=c.useState(""),w=c.useMemo(()=>m?.items??[],[m]),A=c.useMemo(()=>ne(s.folderAppointments),[s.folderAppointments]),j=c.useMemo(()=>w.map(n=>({id:n.mailboxId,label:B(n,A.get(n.mailboxId),o),path:n.fullPath,deleteBlockedReason:Le(n,w,s.folderAppointments).message})),[w,A,o,s.folderAppointments]),R=(n,b)=>{g.mutate({path:{accountId:a,role:Be[n]},body:{mailboxId:b}})},k=(n,b)=>{const T=b.trim();p.mutate({path:{accountId:a,mailboxId:n},body:{displayNameOverride:T===""?null:T}})};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(u)return e.jsx(oe,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:l,onRetry:()=>{i()}});const S=w.map(n=>({mailboxId:n.mailboxId,providerPath:n.fullPath,hierarchyDelimiter:n.hierarchyDelimiter,messageCount:n.messageCount})),M={};for(const n of s.folderAppointments){const b=_e[n.role];b&&(M[b]={mailboxId:n.mailboxId??null,source:n.source,staleFolderPath:n.staleAppointmentPath})}const C={};for(const n of w)n.displayNameOverride&&(C[n.mailboxId]=n.displayNameOverride);const x=n=>w.find(b=>b.mailboxId===n),E=x(h),D=x(v);return e.jsxs("div",{className:"space-y-4",children:[(g.isError||p.isError)&&e.jsx(L,{tone:"danger",variant:"soft",children:Qe(g.error)?"That folder is still being created on the mail server — wait for it to finish, then try again.":"Couldn't save that change. Please try again."}),e.jsx(Je,{accountEmail:s.email,folders:S,appointments:M,displayNames:C,onAppoint:R,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(He,{folders:j,delimiter:w[0]?.hierarchyDelimiter??"/",onCreateFolder:d,onRename:n=>{f(n.id),I(x(n.id)?.displayNameOverride?.trim()??"")},onDelete:n=>y(n.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),E&&e.jsx(Ve,{open:!0,folderLabel:B(E,A.get(E.mailboxId),o),defaultLabel:B({fullPath:E.fullPath,hierarchyDelimiter:E.hierarchyDelimiter},A.get(E.mailboxId),o),name:O,onNameChange:I,pending:p.isPending,error:p.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const n=O.trim();p.mutate({path:{accountId:a,mailboxId:E.mailboxId},body:{displayNameOverride:n===""?null:n}},{onSuccess:()=>f(void 0)})},onClose:()=>f(void 0)}),D&&e.jsx(cs,{open:!0,accountId:a,folder:D,mailboxes:w,appointments:s.folderAppointments,onClose:()=>y(void 0)})]})}function vs(){const s=Oe(),[t,a]=c.useState(!0),{data:o,isPending:m,isError:r,error:u,refetch:l}=ie(Te()),i=d=>{const g=Fe[d];g&&s({to:g})};return e.jsx(qe,{items:Re,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:ds,helpOpen:t,onToggleHelp:()=>a(d=>!d),onSelect:i,onBackToMail:()=>{s({to:"/mail"})},children:m?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(oe,{title:"Couldn't load accounts",error:u,onRetry:()=>{l()}}):o.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:o.accounts.map(d=>e.jsx(ms,{account:d},d.accountId))})})}export{vs as component};
|
package/assets/index-BaVdEvyR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-D_YBuI3z.js";import{M as i}from"./MailboxPane-MXdO0Vz2.js";import"./useSearchTokenContext-DROeO7xw.js";import"./kbd-BUm8HPo9.js";import"./useMessageBodyContent-DEOYO0s3.js";import"./useMediaQuery-CDMcFeIb.js";import"./search-scope-MtY0zpRq.js";import"./useRefreshControl-h1VyXjLX.js";import"./circle-check-big-BCgBHZQm.js";import"./search-token-index-nAK4hI7B.js";import"./MailListHeader-BcdPneAy.js";import"./attachment-file-BrXH3M3V.js";import"./mail-yZgIYq66.js";import"./avatar-DtND0ruk.js";import"./index-DwTAdS0U.js";import"./useSignature-C3CmLf8D.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-4E-721vu.js";import"./ErrorState-CNHmvGYF.js";import"./format-23Av07Go.js";import"./download-Yg8MAJuV.js";import"./shield-check-BZ36Y5z_.js";import"./useFilters-BdPFYyLi.js";import"./confirm-dialog-CSNgGV-I.js";import"./clock-CpWsGek7.js";import"./menu-B4mmeG34.js";import"./MailViewChrome-CZb8kPr_.js";import"./NavMenuButton-BIPTnOry.js";import"./useLabels-CwcqSC09.js";import"./useSemanticSearch-RnkqtV8e.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-Cpg512Z8.js";import"./circle-help-lK4oidSt.js";import"./circle-check-CyTXHuU4.js";function H(){return o.jsx(i.Reading,{})}export{H as component};
|
package/assets/index-BgNbixl6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-D_YBuI3z.js";import{O as t}from"./OutboxPane-mFkq2dEJ.js";import"./useSearchTokenContext-DROeO7xw.js";import"./kbd-BUm8HPo9.js";import"./useMessageBodyContent-DEOYO0s3.js";import"./useMediaQuery-CDMcFeIb.js";import"./search-scope-MtY0zpRq.js";import"./circle-check-big-BCgBHZQm.js";import"./clock-CpWsGek7.js";import"./row-actions-BGPkkIDv.js";import"./rotate-ccw-5k3dg52M.js";import"./NavMenuButton-BIPTnOry.js";import"./menu-B4mmeG34.js";import"./format-23Av07Go.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function d(){return o.jsx(t.Reading,{})}export{d as component};
|
package/assets/index-C015CYKF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,$ as o}from"./index-D_YBuI3z.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
|
package/assets/index-Cf-KjbzP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-D_YBuI3z.js";import{M as r}from"./MailboxPane-MXdO0Vz2.js";import"./useSearchTokenContext-DROeO7xw.js";import"./kbd-BUm8HPo9.js";import"./useMessageBodyContent-DEOYO0s3.js";import"./useMediaQuery-CDMcFeIb.js";import"./search-scope-MtY0zpRq.js";import"./useRefreshControl-h1VyXjLX.js";import"./circle-check-big-BCgBHZQm.js";import"./search-token-index-nAK4hI7B.js";import"./MailListHeader-BcdPneAy.js";import"./attachment-file-BrXH3M3V.js";import"./mail-yZgIYq66.js";import"./avatar-DtND0ruk.js";import"./index-DwTAdS0U.js";import"./useSignature-C3CmLf8D.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-4E-721vu.js";import"./ErrorState-CNHmvGYF.js";import"./format-23Av07Go.js";import"./download-Yg8MAJuV.js";import"./shield-check-BZ36Y5z_.js";import"./useFilters-BdPFYyLi.js";import"./confirm-dialog-CSNgGV-I.js";import"./clock-CpWsGek7.js";import"./menu-B4mmeG34.js";import"./MailViewChrome-CZb8kPr_.js";import"./NavMenuButton-BIPTnOry.js";import"./useLabels-CwcqSC09.js";import"./useSemanticSearch-RnkqtV8e.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-Cpg512Z8.js";import"./circle-help-lK4oidSt.js";import"./circle-check-CyTXHuU4.js";function G(){return o.jsx(r.Reading,{})}export{G as component};
|
package/assets/index-CmMd3Ukp.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-D_YBuI3z.js";import{B as o}from"./BriefPane-D4GKn4Vw.js";import"./useSearchTokenContext-DROeO7xw.js";import"./kbd-BUm8HPo9.js";import"./useMessageBodyContent-DEOYO0s3.js";import"./useMediaQuery-CDMcFeIb.js";import"./search-scope-MtY0zpRq.js";import"./MailListHeader-BcdPneAy.js";import"./search-token-index-nAK4hI7B.js";import"./attachment-file-BrXH3M3V.js";import"./mail-yZgIYq66.js";import"./avatar-DtND0ruk.js";import"./index-DwTAdS0U.js";import"./useSignature-C3CmLf8D.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-4E-721vu.js";import"./ErrorState-CNHmvGYF.js";import"./format-23Av07Go.js";import"./download-Yg8MAJuV.js";import"./shield-check-BZ36Y5z_.js";import"./useFilters-BdPFYyLi.js";import"./confirm-dialog-CSNgGV-I.js";import"./clock-CpWsGek7.js";import"./menu-B4mmeG34.js";import"./useRefreshControl-h1VyXjLX.js";import"./circle-check-big-BCgBHZQm.js";import"./useLabels-CwcqSC09.js";import"./useSemanticSearch-RnkqtV8e.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function C(){return r.jsx(o.Reading,{})}export{C as component};
|
package/assets/index-CtxjpTtR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-D_YBuI3z.js";import{F as r}from"./FlaggedPane-CIICNSCS.js";import"./useSearchTokenContext-DROeO7xw.js";import"./kbd-BUm8HPo9.js";import"./useMessageBodyContent-DEOYO0s3.js";import"./useMediaQuery-CDMcFeIb.js";import"./search-scope-MtY0zpRq.js";import"./MailListHeader-BcdPneAy.js";import"./search-token-index-nAK4hI7B.js";import"./attachment-file-BrXH3M3V.js";import"./mail-yZgIYq66.js";import"./avatar-DtND0ruk.js";import"./index-DwTAdS0U.js";import"./useSignature-C3CmLf8D.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-4E-721vu.js";import"./ErrorState-CNHmvGYF.js";import"./format-23Av07Go.js";import"./download-Yg8MAJuV.js";import"./shield-check-BZ36Y5z_.js";import"./useFilters-BdPFYyLi.js";import"./confirm-dialog-CSNgGV-I.js";import"./clock-CpWsGek7.js";import"./menu-B4mmeG34.js";import"./MailViewChrome-CZb8kPr_.js";import"./wizard-selection-B1bng5Jq.js";function w(){return o.jsx(r.Reading,{})}export{w as component};
|
package/assets/index-TQGaXC_d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-D_YBuI3z.js";import{F as r}from"./FlaggedPane-CIICNSCS.js";import"./useSearchTokenContext-DROeO7xw.js";import"./kbd-BUm8HPo9.js";import"./useMessageBodyContent-DEOYO0s3.js";import"./useMediaQuery-CDMcFeIb.js";import"./search-scope-MtY0zpRq.js";import"./MailListHeader-BcdPneAy.js";import"./search-token-index-nAK4hI7B.js";import"./attachment-file-BrXH3M3V.js";import"./mail-yZgIYq66.js";import"./avatar-DtND0ruk.js";import"./index-DwTAdS0U.js";import"./useSignature-C3CmLf8D.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-4E-721vu.js";import"./ErrorState-CNHmvGYF.js";import"./format-23Av07Go.js";import"./download-Yg8MAJuV.js";import"./shield-check-BZ36Y5z_.js";import"./useFilters-BdPFYyLi.js";import"./confirm-dialog-CSNgGV-I.js";import"./clock-CpWsGek7.js";import"./menu-B4mmeG34.js";import"./MailViewChrome-CZb8kPr_.js";import"./wizard-selection-B1bng5Jq.js";function y(){return o.jsx(r.Reading,{})}export{y as component};
|
package/assets/index-zMBRTYBv.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-D_YBuI3z.js";import{B as o}from"./BriefPane-D4GKn4Vw.js";import"./useSearchTokenContext-DROeO7xw.js";import"./kbd-BUm8HPo9.js";import"./useMessageBodyContent-DEOYO0s3.js";import"./useMediaQuery-CDMcFeIb.js";import"./search-scope-MtY0zpRq.js";import"./MailListHeader-BcdPneAy.js";import"./search-token-index-nAK4hI7B.js";import"./attachment-file-BrXH3M3V.js";import"./mail-yZgIYq66.js";import"./avatar-DtND0ruk.js";import"./index-DwTAdS0U.js";import"./useSignature-C3CmLf8D.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-4E-721vu.js";import"./ErrorState-CNHmvGYF.js";import"./format-23Av07Go.js";import"./download-Yg8MAJuV.js";import"./shield-check-BZ36Y5z_.js";import"./useFilters-BdPFYyLi.js";import"./confirm-dialog-CSNgGV-I.js";import"./clock-CpWsGek7.js";import"./menu-B4mmeG34.js";import"./useRefreshControl-h1VyXjLX.js";import"./circle-check-big-BCgBHZQm.js";import"./useLabels-CwcqSC09.js";import"./useSemanticSearch-RnkqtV8e.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function D(){return r.jsx(o.Reading,{})}export{D as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as f,j as e,ad as h,aU as y,ac as b,bh as g,B as v,T as N,m as C,s as L,Q as I,ar as D,av as S,as as w}from"./index-D_YBuI3z.js";import{C as E}from"./confirm-dialog-CSNgGV-I.js";import{S as $}from"./settings-screen-D53GKsd_.js";import{E as j}from"./ErrorState-CNHmvGYF.js";import{a as T,b as k,c as R,u as O}from"./useLabels-CwcqSC09.js";import"./avatar-DtND0ruk.js";import"./menu-B4mmeG34.js";import"./circle-help-lK4oidSt.js";function B({labels:l,onRename:i,onRecolor:n,onDelete:m,deletingLabelId:c}){const[u,r]=f.useState(),[o,d]=f.useState("");if(l.length===0)return e.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No labels yet. Create one below, then use it in a filter or apply it to mail directly."});const t=a=>{const s=o.trim();s!==""&&i(a,s),r(void 0)};return e.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:l.map(a=>e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[u===a.labelId?e.jsx(h,{autoFocus:!0,value:o,onChange:s=>d(s.target.value),onBlur:()=>t(a.labelId),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),t(a.labelId)),s.key==="Escape"&&(s.preventDefault(),r(void 0))},"aria-label":`Rename label ${a.name}`}):e.jsx("button",{type:"button",onClick:()=>{r(a.labelId),d(a.name)},"aria-label":`Rename label ${a.name}`,className:"flex items-center gap-2 rounded-sm text-left hover:opacity-80",children:e.jsx(y,{label:a})}),e.jsx("p",{className:"mt-0.5 text-xs text-fg-subtle",children:a.filterCount===0?"Not used in any filter":`Used in ${a.filterCount} ${a.filterCount===1?"filter":"filters"}`})]}),e.jsx(b,{"aria-label":`Color for ${a.name}`,value:a.color,onChange:s=>n(a.labelId,s.target.value),className:"w-28 shrink-0",children:g.map(s=>e.jsx("option",{value:s,children:s},s))}),e.jsx(v,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4 text-danger"}),onClick:()=>m(a),disabled:c===a.labelId,"aria-label":`Delete label ${a.name}`})]},a.labelId))})}const P=(l,i)=>{if(i===0)return{title:`Delete the "${l}" label?`};const n=i===1?"filter":"filters";return{title:`Delete the "${l}" label?`,description:`This also deletes ${i} ${n} that ${i===1?"applies":"apply"} it — they can't be recovered.`}},_=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Labels mark mail without moving it — a message can carry any number of them alongside whichever folder it lives in."}),e.jsx("p",{children:"Use a label in a filter's action to have new (and existing) mail label itself automatically, or apply one to a selection directly from the mailbox."}),e.jsx("p",{children:"Deleting a label removes it from every message, and deletes every filter that applies it — the confirmation names how many."})]});function H({accountId:l}){const{createLabel:i,isPending:n,isError:m}=O(l),[c,u]=f.useState(""),[r,o]=f.useState("Default"),d=()=>{const t=c.trim();t!==""&&i(t,r).then(()=>{u(""),o("Default")})};return e.jsxs("div",{className:"space-y-2 rounded-sm border border-line bg-surface p-3",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"New label"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Name"}),e.jsx(h,{value:c,onChange:t=>u(t.target.value),placeholder:"e.g. Receipts","aria-label":"Label name",onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),d())}})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Color"}),e.jsx(b,{value:r,onChange:t=>o(t.target.value),"aria-label":"Label color",className:"w-28",children:g.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx(v,{variant:"primary",onClick:d,disabled:n||c.trim()==="",children:n?"Creating…":"Create label"})]}),m&&e.jsx(w,{tone:"danger",variant:"soft",children:"Couldn't create that label. Please try again."})]})}function U({account:l}){const i=l.accountId,{labels:n,isPending:m,isError:c,error:u,refetch:r}=T(i),{updateLabel:o}=k(i),{deleteLabel:d,deletingLabelId:t}=R(i),[a,s]=f.useState();return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:l.email}),m?e.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading labels for ${l.email}`}):c?e.jsx(j,{variant:"inline",title:`Couldn't load labels for ${l.email}`,error:u,onRetry:()=>{r()}}):e.jsx(B,{labels:n,onRename:(p,x)=>o(p,{name:x}),onRecolor:(p,x)=>o(p,{color:x}),onDelete:s,deletingLabelId:t}),e.jsx(H,{accountId:i}),a&&(()=>{const p=P(a.name,a.filterCount);return e.jsx(E,{isOpen:!0,title:p.title,description:p.description,confirmLabel:"Delete label",destructive:!0,isBusy:t===a.labelId,onConfirm:()=>{d(a.labelId),s(void 0)},onCancel:()=>s(void 0)})})()]})}function q(){const l=C(),[i,n]=f.useState(!0),{data:m,isPending:c,isError:u,error:r,refetch:o}=L(I()),d=t=>{const a=S[t];a&&l({to:a})};return e.jsx($,{items:D,activeId:"labels",title:"Labels",description:"Mark mail without moving it, per account.",help:_,helpOpen:i,onToggleHelp:()=>n(t=>!t),onSelect:d,onBackToMail:()=>{l({to:"/mail"})},children:c?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):u?e.jsx(j,{title:"Couldn't load accounts",error:r,onRetry:()=>{o()}}):m.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:m.accounts.map(t=>e.jsx(U,{account:t},t.accountId))})})}export{q as component};
|
package/assets/mail-Byqd_siN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as L,r as u,u as Pe,j as e,S as Le,a as pe,b as k,C as ee,d as te,e as Ae,f as ge,F as ze,g as Fe,X as be,T as Te,O as De,M as _e,A as Be,h as Ke,I as Qe,i as ve,B as F,k as Ve,l as ye,m as G,o as je,n as Se,p as qe,q as Y,s as Ne,t as He,v as $e,w as Ue,x as $,y as We,z as Ge,D as Ye,E as Je,G as Xe,H as Ze,J as et,K as tt,L as st,N as at,P as nt,Q as rt,R as ot,U as it}from"./index-D_YBuI3z.js";import{B as lt,S as ct,D as ut,a as dt,b as mt,u as xt,s as ht,c as J,K as ft,d as pt,e as Ce,f as gt,g as bt,h as vt,i as yt}from"./search-token-index-nAK4hI7B.js";import{u as X,a as ke,l as jt,N as E,b as St,c as Nt,i as Ct,d as U,m as se,e as kt,f as wt,g as It}from"./useMessageBodyContent-DEOYO0s3.js";import{P as Mt}from"./pencil-rdzjE11g.js";import{c as Ot,s as Rt,M as Et}from"./search-view-CtInfT0I.js";import{u as Pt,a as Lt,R as At,M as zt}from"./useRefreshControl-h1VyXjLX.js";import{M as Ft}from"./menu-B4mmeG34.js";import{B as we}from"./bug-D-5qIgn1.js";import{A as Tt}from"./avatar-DtND0ruk.js";import{i as Dt}from"./outbox-status-BlKn6P0x.js";import{E as _t}from"./ErrorState-CNHmvGYF.js";import{K as ae}from"./kbd-BUm8HPo9.js";import{u as Bt}from"./index-DwTAdS0U.js";import{u as Kt}from"./useDebouncedValue-4E-721vu.js";import"./search-scope-MtY0zpRq.js";import"./useMediaQuery-CDMcFeIb.js";import"./FullCompose-B0bbns1M.js";import"./confirm-dialog-CSNgGV-I.js";import"./circle-check-big-BCgBHZQm.js";import"./useSignature-C3CmLf8D.js";import"./account-form-helpers-DhckT_PN.js";const Qt=L("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const Vt=L("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const Ie=L("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const Me=L("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const qt=L("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),Ht="button:not([disabled]), a[href]",R="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function $t({active:t,dimmed:s,indent:a}){return k("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",R,a&&"pl-7",t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",s&&"opacity-55")}function Ut({icon:t,label:s,count:a,active:n}){return e.jsxs(e.Fragment,{children:[t&&e.jsx("span",{className:k("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:t}),e.jsx("span",{className:"flex-1 truncate",children:s}),a!=null&&a>0&&e.jsx("span",{className:k("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function P({icon:t,label:s,count:a,active:n,dimmed:r,indent:o,navId:i,linkComponent:c,ariaLabel:h,title:d,onClick:g}){const x=$t({active:n,dimmed:r,indent:o}),p=e.jsx(Ut,{icon:t,label:s,count:a,active:n});return i&&c?c({navId:i,className:x,ariaLabel:h??s,title:d,onClick:g,children:p}):e.jsx("button",{type:"button",onClick:g,className:x,"aria-label":h,title:d,children:p})}const ne={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Wt(t){switch(t){case"inbox":return e.jsx(Qe,{className:"size-4"});case"flagged":return e.jsx(pe,{className:"size-4"});case"drafts":return e.jsx(Ke,{className:"size-4"});case"sent":return e.jsx(ge,{className:"size-4"});case"archive":return e.jsx(Be,{className:"size-4"});case"all":return e.jsx(_e,{className:"size-4"});case"junk":return e.jsx(De,{className:"size-4"});case"trash":return e.jsx(Te,{className:"size-4"})}}const re=t=>t.role!=null,H=8,oe="remit.nav.folders.open.",ie="remit.nav.account.open.";function le(t,s,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(t+s);return n===null?a:n!=="0"}function ce(t,s,a){typeof localStorage>"u"||localStorage.setItem(t+s,a?"1":"0")}function Gt({query:t,onSelect:s,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:s,className:k("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",R),children:[e.jsx(Fe,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${t}`,className:k("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",R),children:e.jsx(be,{className:"size-3.5"})})]})}function Yt({savedSearches:t,saveableQuery:s,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:r}){return t.length===0&&!s?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),s&&e.jsxs("button",{type:"button",onClick:r,className:k("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",R),children:[e.jsx(Qt,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",s,"”"]})]}),t.map(o=>e.jsx(Gt,{query:o,onSelect:()=>a?.(o),onRemove:n?()=>n(o):void 0},o))]})}function Jt({account:t,selectedNavId:s,onSelectNav:a,linkComponent:n}){const[r,o]=u.useState(()=>le(ie,t.id,!0)),[i,c]=u.useState(()=>le(oe,t.id,!0)),[h,d]=u.useState(!1),g=()=>{o(l=>{const S=!l;return ce(ie,t.id,S),S})},x=()=>{c(l=>{const S=!l;return ce(oe,t.id,S),S})},p=t.mailboxes.filter(re).sort((l,S)=>ne[l.role]-ne[S.role]),m=t.mailboxes.filter(l=>!re(l)),b=h||m.length<=H?m:m.slice(0,H),j=m.length-b.length,y=t.status??"ready",N=y==="ready"&&p.length===0&&m.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:g,"aria-expanded":r,className:k("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",R,t.muted&&"opacity-55"),children:[r?e.jsx(ee,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(te,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),t.muted&&e.jsxs(e.Fragment,{children:[e.jsx(lt,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),r&&e.jsxs(e.Fragment,{children:[y==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),y==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(Ae,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),t.onRetry&&e.jsx("button",{type:"button",onClick:t.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),N&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),y==="ready"&&e.jsxs(e.Fragment,{children:[p.map(l=>e.jsx(P,{navId:l.id,linkComponent:n,icon:Wt(l.role),label:l.name,ariaLabel:l.name,title:l.fullPath??l.name,count:l.unseen,active:s===l.id,dimmed:t.muted,onClick:()=>a?.(l.id)},l.id)),t.outboxPending!==void 0&&e.jsx(P,{navId:"outbox",linkComponent:n,icon:e.jsx(ge,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:t.outboxPending>0?t.outboxPending:void 0,active:s==="outbox",dimmed:t.muted,onClick:()=>a?.("outbox")}),m.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:x,"aria-expanded":i,className:k("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",R),children:[i?e.jsx(ee,{className:"size-3 shrink-0"}):e.jsx(te,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:m.length})]}),i&&e.jsxs(e.Fragment,{children:[b.map(l=>e.jsx(P,{navId:l.id,linkComponent:n,icon:e.jsx(ze,{className:"size-4"}),label:l.name,ariaLabel:l.name,title:l.fullPath??l.name,count:l.unseen,active:s===l.id,dimmed:t.muted,onClick:()=>a?.(l.id)},l.id)),(j>0||h)&&m.length>H&&e.jsx("button",{type:"button",onClick:()=>d(l=>!l),className:k("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",R),children:h?"Show less":`Show all (${m.length})`})]})]})]})]})]})}function Xt({accounts:t,selectedNavId:s,briefUnseen:a,onSelectNav:n,variant:r="desktop",linkComponent:o,calendarNav:i="hidden",savedSearches:c=[],saveableQuery:h,onSelectSavedSearch:d,onRemoveSavedSearch:g,onSaveCurrentSearch:x}){const p=u.useRef(null);Pe({containerRef:p,itemSelector:Ht});const m=r==="drawer",b=e.jsxs("nav",{ref:m?p:void 0,className:m?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(P,{navId:"brief",linkComponent:o,icon:e.jsx(Le,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:s==="brief",onClick:()=>n?.("brief")}),i==="shown"&&e.jsx(P,{navId:"calendar",linkComponent:o,icon:e.jsx(Vt,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:s==="calendar",onClick:()=>n?.("calendar")}),e.jsx(P,{navId:"flagged",linkComponent:o,icon:e.jsx(pe,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:s==="flagged",onClick:()=>n?.("flagged")}),e.jsx(Yt,{savedSearches:c,saveableQuery:h,onSelectSavedSearch:d,onRemoveSavedSearch:g,onSaveCurrentSearch:x}),t.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):t.map(j=>e.jsx(Jt,{account:j,selectedNavId:s,onSelectNav:n,linkComponent:o},j.id))]});return m?b:e.jsx("aside",{ref:p,className:"flex h-full w-full flex-col bg-surface-sunken",children:b})}function Zt({leading:t,search:s,actions:a,className:n}){return e.jsxs("header",{className:k("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",n),children:[t&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t}),e.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:e.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),a&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a})]})}function es(){const t=ve();if(!t)return null;const s=t.showNavPane?!t.navCollapsed:!1;return e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(Ft,{className:"size-4"}),onClick:t.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const ts={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function ss({search:t,onCompose:s,onReportBug:a,onOpenSettings:n,composeShortcut:r,refreshControl:o,account:i}){return e.jsx(Zt,{leading:e.jsx(es,{}),search:e.jsx(ct,{value:t.value,onChange:t.onChange,onClear:t.onClear,onClearQuery:t.onClearQuery,chips:t.chips,onRemoveChip:t.onRemoveChip,placeholder:ts[t.scope]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(qt,{className:"size-4"}),title:r?`Compose (${r})`:"Compose","aria-label":"Compose",onClick:s}),e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(we,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:a}),e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(Me,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:n}),o,i]})})}const as=()=>{const t=X(),s=ke();return jt(s.pathname)?null:e.jsx("button",{type:"button",onClick:t,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:e.jsx(Mt,{className:"size-6"})})},Oe=({children:t})=>{const{Account:s}=Ve();return e.jsx(s,{children:t})},ns=({email:t,onSignOut:s})=>{const a=t??"Account";return e.jsxs(ut,{trigger:e.jsx(Tt,{name:a,email:t??void 0,size:"sm"}),align:"right",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-2 text-xs text-fg-muted truncate",title:t,"data-testid":"account-menu-email",children:t}),e.jsx(dt,{})]}),e.jsxs(mt,{onClick:s,children:[e.jsx(Ie,{className:"size-4"}),"Sign out"]})]})},rs=()=>e.jsx(Oe,{children:({email:t,signOut:s})=>e.jsx(ns,{email:t,onSignOut:s})});function os({accounts:t}){const{searchInput:s,onSearchChange:a,onSearchClear:n,onSearchClearQuery:r}=ye(),o=G(),i=X(),{scope:c,clearScope:h}=xt(t),d=c.kind==="scoped"?[{id:c.chip.id,label:c.chip.label,tone:"scope"}]:void 0,g=u.useMemo(()=>t.map(j=>j.accountId),[t]),{hasNewMail:x}=Pt(),{state:p,errorMessage:m,refresh:b}=Lt(g);return e.jsx(ss,{search:{value:s,scope:c.kind,chips:d,onChange:a,onClear:n,onClearQuery:r,onRemoveChip:h},onCompose:i,onReportBug:je,onOpenSettings:()=>o({to:"/settings/accounts"}),composeShortcut:ht("compose"),refreshControl:e.jsx(At,{state:p,onRefresh:b,label:"Refresh all accounts",errorMessage:m,hasUpdate:x(g)}),account:e.jsx(rs,{})})}const Z="remit.savedSearches",is=25;function D(){try{const t=localStorage.getItem(Z);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(a=>typeof a=="string"):[]}catch{return[]}}function ls(t){const s=t.trim();if(!s)return D();const a=[s,...D().filter(n=>n!==s)].slice(0,is);try{localStorage.setItem(Z,JSON.stringify(a))}catch{return a}return a}function cs(t){const s=D().filter(a=>a!==t);try{localStorage.setItem(Z,JSON.stringify(s))}catch{return s}return s}const ue=t=>/^\d/.test(t),us=(t,s)=>{const a=ue(t),n=ue(s);return a&&!n?-1:!a&&n?1:t.localeCompare(s,void 0,{sensitivity:"base",numeric:!0})};function ds(t,s,a){const n=[],r=[];for(const o of t)s.has(o.mailboxId)?n.push(o):r.push(o);return r.sort((o,i)=>us($(o,void 0,a),$(i,void 0,a))),{system:n,labels:r}}function ms(t,s,a){const n=We(s)&&t.unseenCount>0;return{id:t.mailboxId,name:$(t,s,a),unseen:n?t.unseenCount:void 0,role:s,fullPath:t.fullPath}}function xs(){const t=ke(),s=Ue({strict:!1});return t.pathname.startsWith("/settings")?"settings":t.pathname.startsWith("/mail/outbox")?"outbox":t.pathname.startsWith("/mail/flagged")?"flagged":t.pathname.startsWith("/mail/brief")?"brief":s.mailboxId?s.mailboxId:""}function de({accounts:t,onMailboxSelect:s,variant:a="desktop"}){const n=Se(),r=G(),o=xs(),{searchInput:i,onSearchChange:c}=ye(),[h,d]=u.useState(D),{t:g}=qe("mail",{useSuspense:!1}),x=u.useCallback((f,C)=>g(f,{defaultValue:C}),[g]),p=J({queries:t.map(f=>({...Y({path:{accountId:f.accountId}}),staleTime:1/0}))}),{data:m}=Ne(He()),b=u.useMemo(()=>(m?.items??[]).filter(f=>Dt(f.status)).length,[m?.items]),j=u.useMemo(()=>t.map((f,C)=>{const v=p[C],I=v?.data?.items??[],w=$e(f.folderAppointments),{system:M,labels:Q}=ds(I,w,x),V=v?.isError?"error":v?.isLoading?"loading":"ready";return{id:f.accountId,label:f.email,email:f.email,muted:!!f.muted,outboxPending:b,status:V,onRetry:()=>v?.refetch(),mailboxes:[...M,...Q].map(A=>ms(A,w.get(A.mailboxId),x))}}),[t,p,b,x]),y=f=>{n.invalidateQueries({queryKey:Ge({path:{mailboxId:f},query:{order:"desc"}})})},N=({navId:f,className:C,ariaLabel:v,title:I,children:w,onClick:M})=>f==="brief"?e.jsx(E,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="outbox"?e.jsx(E,{to:"/mail/outbox",search:{q:void 0},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="flagged"?e.jsx(E,{to:"/mail/flagged",search:{q:void 0},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="settings"?e.jsx(E,{to:"/settings/accounts",onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):e.jsx(E,{to:"/mail/$mailboxId",params:{mailboxId:f},search:{q:void 0},onClick:()=>{y(f),M?.()},className:C,"aria-label":v,title:I,children:w}),l=()=>{c(""),s?.()},S=i.trim(),O=S.length>0&&!h.includes(S)?S:void 0,_=u.useCallback(()=>{O&&d(ls(O))},[O]),B=u.useCallback(f=>{d(cs(f))},[]),K=u.useCallback(f=>{c(f),r({to:"/mail/brief",search:{q:f}}),s?.()},[c,r,s]);return e.jsx(Xt,{accounts:j,selectedNavId:o,onSelectNav:l,linkComponent:N,variant:a,savedSearches:h,saveableQuery:O,onSaveCurrentSearch:_,onSelectSavedSearch:K,onRemoveSavedSearch:B})}function hs(){return e.jsxs("button",{type:"button",onClick:je,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(we,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function fs({accounts:t,onMailboxSelect:s}){return ve()?.showNavPane??!0?e.jsx(de,{accounts:t}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(de,{accounts:t,onMailboxSelect:s,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(E,{to:"/settings/accounts",onClick:s,children:[e.jsx(Me,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(hs,{}),e.jsx(Oe,{children:({signOut:r})=>e.jsxs("button",{type:"button",onClick:()=>{s?.(),r()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(Ie,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}const ps=({isOpen:t,onClose:s})=>{const a=u.useCallback(n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),s())},[s]);return u.useEffect(()=>{if(t)return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[t,a]),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx(Ye,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:k("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),e.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:e.jsx(be,{className:"size-5"})})]}),e.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:ft.map(n=>e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:n.title}),e.jsx("div",{className:"space-y-2",children:n.hints.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm",children:r.description}),e.jsx("span",{className:"flex shrink-0 items-center gap-1",children:r.keys.map((o,i)=>e.jsxs(u.Fragment,{children:[i>0&&r.keys[0]==="g"&&e.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),e.jsx(ae,{children:o})]},o))})]},`${r.action}-${r.keys.join("+")}`))})]},n.title))}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",e.jsx(ae,{children:"Esc"})," to close"]})})]})]}):null};function gs(t){const s=J({queries:t.map(a=>({...Y({path:{accountId:a.accountId}}),staleTime:1/0}))});return u.useMemo(()=>pt(s.map(a=>a.data?.items??[])),[s])}const Re="remit:intelligence-open";function bs(){try{return localStorage.getItem(Re)!=="closed"}catch{return!0}}function vs(t){try{localStorage.setItem(Re,t?"open":"closed")}catch{}}function me({panels:t,prefersOpen:s,isDesktop:a,hasThread:n,raisedFor:r,openMessage:o}){return r!==null&&r===o?!0:t.length>0?t.includes("intelligence"):a&&n&&s}const ys=()=>{const t=Ce(),s=St(),a=Nt(),n=s.find(Ct),r=gt(),[o,i]=u.useState(bs),c=r?`${r.threadId}/${r.messageId??""}`:null,[h,d]=u.useState(null),g={panels:s,prefersOpen:o,isDesktop:t==="desktop",hasThread:r!==void 0,openMessage:c},x=me({...g,raisedFor:h}),p=me({...g,raisedFor:null}),m=u.useCallback((N,l)=>{a([...N?["intelligence"]:[],...l?[l]:[]])},[a]),b=u.useCallback(N=>{m(p,N)},[p,m]),j=u.useCallback(()=>{if(x&&!p){d(null);return}const N=!x;vs(N),i(N),d(null),m(N,n)},[p,x,n,m]),y=u.useCallback(()=>{d(c)},[c]);return{openOverlay:n,intelligenceOpen:x,showOverlay:b,toggleIntelligence:j,raiseIntelligence:y}},js=t=>t.map(s=>s.data?.items??[]);function Ss(t){const s=J({queries:t.map(a=>({...Y({path:{accountId:a.accountId}}),staleTime:1/0})),combine:js});return u.useMemo(()=>Je(t.map((a,n)=>({folderAppointments:a.folderAppointments,mailboxes:s[n]??[]}))),[t,s])}function Ns(){const t=Xe(),s=U({select:d=>se(d.location.pathname)}),a=U({select:d=>kt(d.location.search)}),[n,r]=u.useState(a),o=Kt(n,200),[i,c]=u.useState(s);if(i!==s){const d=Rt(i,s,a);c(s),d!==void 0&&r(d)}const h=u.useCallback(d=>{c(se(t.state.location.pathname)),r(d)},[t]);return{searchInput:n,committedQuery:Ot(n,o),viewKey:s,setSearchInput:h}}var z={exports:{}},xe;function Cs(){if(xe)return z.exports;xe=1;const t=(s,a,n)=>new Promise((r,o)=>{if(n=Object.assign({concurrency:1/0},n),typeof a!="function")throw new TypeError("Mapper function is required");const{concurrency:i}=n;if(!(typeof i=="number"&&i>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${i}\` (${typeof i})`);const c=[],h=s[Symbol.iterator]();let d=!1,g=!1,x=0,p=0;const m=()=>{if(d)return;const b=h.next(),j=p;if(p++,b.done){g=!0,x===0&&r(c);return}x++,Promise.resolve(b.value).then(y=>a(y,j)).then(y=>{c[j]=y,x--,m()},y=>{d=!0,o(y)})};for(let b=0;b<i&&(m(),!g);b++);});return z.exports=t,z.exports.default=t,z.exports}var ks=Cs();const ws=Ze(ks),Is=900*1e3,Ms=300,Os=(t,s)=>{if(!t)return s;const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:s},Rs=60*1e3,Es=t=>Math.max(Os(t,Ms)*1e3,Rs),T=Es(nt().mailboxPollIntervalSeconds),Ps=5,W=new Set,Ls=(t,s,a=Is)=>t.filter(n=>{const r=n.lastSyncAt;return r==null?!0:s-r>a}).map(n=>n.accountId),As=(t,s,a=T)=>t-s>=a,zs=(t,s)=>t.filter(a=>!s.has(a)),he=(t,s)=>{if(W.delete(t),st(s,{softError:!0},"nobody")){at(s);return}console.warn("[remit] background mailbox sync failed",{accountId:t,error:s})},fe=(t,s)=>et({path:{accountId:t},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:tt({path:{accountId:t}})})}),Fs=t=>{const s=Se(),a=u.useRef(t);a.current=t;const n=t.map(r=>r.accountId).join(",");u.useEffect(()=>{const r=Date.now(),i=Ls(a.current,r).filter(c=>!W.has(c));if(i.length!==0)for(const c of i)W.add(c),fe(c,s).catch(h=>{he(c,h)})},[n,s]),u.useEffect(()=>{let r=Date.now(),o;const i=new Set,c=()=>{r=Date.now();const g=zs(a.current.map(x=>x.accountId),i);for(const x of g)i.add(x);ws(g,x=>fe(x,s).catch(p=>{he(x,p)}).finally(()=>{i.delete(x)}),{concurrency:Ps})},h=()=>{if(document.visibilityState==="visible"){c(),o=setTimeout(h,T);return}},d=()=>{document.visibilityState==="visible"&&As(Date.now(),r)&&(o!==void 0&&clearTimeout(o),c(),o=setTimeout(h,T))};return o=setTimeout(h,T),document.addEventListener("visibilitychange",d),()=>{o!==void 0&&clearTimeout(o),document.removeEventListener("visibilitychange",d)}},[n,s])};function na(){const t=G(),s=Ce(),a=yt(s),{openOverlay:n,intelligenceOpen:r,showOverlay:o,toggleIntelligence:i,raiseIntelligence:c}=ys(),h=n==="shortcuts",d=n==="nav",{searchInput:g,committedQuery:x,viewKey:p,setSearchInput:m}=Ns(),{data:b,isLoading:j,isError:y,error:N,refetch:l}=Ne({...rt(),staleTime:1/0}),S=!!(b&&(b.accounts?.length??0)===0);u.useEffect(()=>{S&&t({to:"/onboarding",replace:!0})},[S,t]),Bt({enabled:!h,bindings:[{key:"?",handler:()=>o("shortcuts"),noModifiers:!1,preventDefault:!0}]});const O=X(),_=wt(),B=U({select:q=>It(q.matches)?.list==="mailbox"}),K=u.useMemo(()=>({compose:O}),[O]);bt({enabled:!B&&!_,handlers:K});const f=u.useCallback(()=>{m("")},[m]),C=u.useCallback(()=>{m("")},[m]),v=b?.accounts??[],I=u.useMemo(()=>v.map(q=>q.accountId),[v]),w=gs(v),M=Ss(v),Q=u.useMemo(()=>vt(v),[v]);Fs(v);const V=u.useCallback(()=>{n==="nav"&&o(void 0)},[n,o]),A={accounts:v,mailboxNameIndex:w,accountNameIndex:Q,resultFolderIndex:M,searchQuery:x,searchInput:g,searchViewKey:p,onSearchChange:m,onSearchClear:f,onSearchClearQuery:C,intelligenceOpen:r,onToggleIntelligence:i,onRaiseIntelligence:c},Ee={isSinglePane:a,isLoading:j||S,intelligenceOpen:r,nav:e.jsx(fs,{accounts:v,onMailboxSelect:V}),topBar:a?void 0:e.jsx(os,{accounts:v}),overlay:a?e.jsx(as,{}):void 0,navOpen:d,onOpenNav:()=>o("nav"),onCloseNav:()=>o(void 0)};return e.jsx(ot.Provider,{value:A,children:e.jsxs(zt,{accountIds:I,children:[y?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(_t,{title:"Couldn't load your account",error:N,onRetry:()=>{l()}})}):e.jsx(Et,{chrome:Ee,children:e.jsx(it,{})}),e.jsx(ps,{isOpen:h,onClose:()=>o(void 0)})]})})}export{na as component,ye as useMailContext};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{V as t,W as r,n as a,r as i,j as s}from"./index-D_YBuI3z.js";import{O as c}from"./OnboardingWizard-yfi2kykm.js";import"./kbd-BUm8HPo9.js";import"./account-form-helpers-DhckT_PN.js";import"./mail-yZgIYq66.js";async function m(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:t()}),e.navigateToInbox()}function C(){const e=r(),o=a(),n=i.useCallback(l=>{m({queryClient:o,recordCompleted:()=>e.recordEvent("onboarding.completed"),navigateToInbox:()=>{window.location.assign("/mail")}})},[e,o]);return s.jsx(c,{skipWelcome:!1,onComplete:n})}export{C as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as i,j as o,U as m}from"./index-D_YBuI3z.js";import{a as s}from"./search-view-CtInfT0I.js";import{O as t}from"./OutboxPane-mFkq2dEJ.js";import{u as p}from"./useSearchMirror-rswuH5l3.js";import"./useMessageBodyContent-DEOYO0s3.js";import"./FullCompose-B0bbns1M.js";import"./ErrorState-CNHmvGYF.js";import"./index-DwTAdS0U.js";import"./useSignature-C3CmLf8D.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-4E-721vu.js";import"./useMediaQuery-CDMcFeIb.js";import"./confirm-dialog-CSNgGV-I.js";import"./useSearchTokenContext-DROeO7xw.js";import"./kbd-BUm8HPo9.js";import"./search-scope-MtY0zpRq.js";import"./circle-check-big-BCgBHZQm.js";import"./clock-CpWsGek7.js";import"./row-actions-BGPkkIDv.js";import"./rotate-ccw-5k3dg52M.js";import"./NavMenuButton-BIPTnOry.js";import"./menu-B4mmeG34.js";import"./format-23Av07Go.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function a(){return i({from:"/mail/outbox/draft/$outboxMessageId",shouldThrow:!1})?.outboxMessageId}function $(){const r=a();return p({to:"/mail/outbox"}),o.jsx(t,{outboxMessageId:r,children:o.jsx(s,{phone:o.jsx(t.Phone,{}),list:o.jsx(t.List,{}),reading:o.jsx(m,{})})})}export{$ as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as t}from"./useMessageBodyContent-DEOYO0s3.js";const n="search-scope";function r(o){const i=o.trim().replace(/\s+/g," ").toLowerCase();return/\s/.test(i)?`in:"${i}"`:`in:${i}`}function l(o){const i=t(o);return i!==void 0&&i.list!=="brief"}function s(o){const i=t(o);return i?.list==="mailbox"?i.mailboxId:void 0}function a(o){const i=s(o.matches);return i||(l(o.matches)?o.callerMailboxId:o.callerMailboxId??o.inTokenMailboxId)}function u(o,i){const e=t(o);return e?.list==="flagged"?{kind:"scoped",chip:{id:n,label:"is:starred"}}:e?.list==="outbox"?{kind:"scoped",chip:{id:n,label:"in:outbox"}}:e?.list==="mailbox"?i?{kind:"scoped",chip:{id:n,label:r(i)}}:{kind:"pending"}:{kind:"global"}}function d(o,i,e){return i.kind==="global"?{kind:"global"}:t(o)?.list==="flagged"?{kind:"collection"}:{kind:"folder",...e?{role:e}:{}}}export{n as S,u as a,d as b,l as i,s as r,a as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as B,r as u,j as g,g as G,b as v,bR as W,X,bS as Y,bT as D,bU as J,bV as Z,bW as H,n as ee,bX as te,bY as ne,bZ as se,b_ as re,b$ as oe,c0 as ie,c1 as q,c2 as ae,c3 as ce,w as C,p as ue,q as K,v as le,x as fe,m as de,l as he,c4 as L}from"./index-D_YBuI3z.js";import{a as pe,d as me}from"./useMessageBodyContent-DEOYO0s3.js";import{a as ge,S as ye}from"./search-scope-MtY0zpRq.js";import{a as F,D as be}from"./useMediaQuery-CDMcFeIb.js";const _e=B("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);const $e=B("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),xe=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ue(e){return xe.filter(t=>e[t.action]!==void 0)}const we=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function ke(e){for(const t of we){const n=t.hints.find(s=>s.action===e);if(n)return n.keys}}function Ce(e){const t=ke(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Ve(e){const t=Ce(e);return t===""?"":`(${t})`}const I={action:null,nextPrefix:null,preventDefault:!1},ve={b:"goBrief",i:"goInbox",s:"goSent",f:"goFlagged",",":"goSettings"},Se={j:{action:"focusNext"},k:{action:"focusPrevious"},arrowdown:{action:"focusNext"},arrowup:{action:"focusPrevious"},home:{action:"focusFirst"},end:{action:"focusLast"},enter:{action:"openFocused"}," ":{action:"toggleSelect"},delete:{action:"delete"},backspace:{action:"delete"},u:{action:"toggleRead"},x:{action:"toggleSelect"},r:{action:"reply"},a:{action:"replyAll"},f:{action:"forward"},"#":{action:"delete"},s:{action:"toggleStar"},m:{action:"muteSender"},b:{action:"blockSender"},v:{action:"vipSender"},"!":{action:"markJunk"},i:{action:"toggleIntelligence"},d:{action:"toggleDensity"},"/":{action:"focusSearch"},c:{action:"compose"},"?":{action:"help"}};function Ie(e,t){const n=e.key.toLowerCase(),s=e.metaKey||e.ctrlKey;if(e.inEditable)return{...I,nextPrefix:t==="g"?null:t};if(e.onControl&&(n==="enter"||n===" "))return{...I,nextPrefix:t==="g"?null:t};if(s&&n==="n")return{action:"compose",nextPrefix:null,preventDefault:!0};if(s&&n==="a")return{action:"selectAll",nextPrefix:null,preventDefault:!0};if(s)return{...I,nextPrefix:t==="g"?null:t};if(n==="escape")return{action:"back",nextPrefix:null,preventDefault:!1};if(t==="g"){const i=ve[n===","?",":n]??null;return{action:i,nextPrefix:null,preventDefault:i!==null}}if(n==="g"&&!e.shiftKey)return{action:null,nextPrefix:"g",preventDefault:!0};if(e.shiftKey){const o=n==="j"||n==="arrowdown";if(o||(n==="k"||n==="arrowup"))return{action:o?"extendSelectDown":"extendSelectUp",nextPrefix:null,preventDefault:!0}}const r=Se[n];if(r){const o=r.requireShift===!0,i=n.length===1&&!/[a-z0-9]/.test(n);return!o&&e.shiftKey&&!i?I:{action:r.action,nextPrefix:null,preventDefault:!0}}return I}function Ee(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable}const Re="data-message-row",Te='button, a[href], summary, [role="button"], [role="menuitem"], [role="tab"], [role="switch"], [role="checkbox"]';function Oe(e){if(!(e instanceof HTMLElement))return!1;const t=e.closest(Te);return t?!t.hasAttribute(Re):!1}function Me({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:s,hasValue:r,chipCount:o}){const i=o-1;return e==="Escape"?r?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?o===0?{type:"none"}:{type:"focusChip",index:i}:e==="Backspace"||e==="ArrowLeft"?!s||o===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:i}:{type:"none"}}function Pe({key:e,repeat:t=!1,index:n,chipCount:s}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=s-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function Ne(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const De=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,Le=({chips:e=[],onRemoveChip:t,value:n,onChange:s,onClear:r,onClearQuery:o,placeholder:i="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:m="sm",inputId:l,suggest:h,className:x})=>{const E=u.useId(),S=l??E,p=u.useRef(null),y=u.useRef([]),b=o??r,[R,T]=u.useState(null),M=u.useRef(void 0),[_,$]=u.useState(""),P=e.length>0;u.useEffect(()=>{T(a=>a!==null&&a>=e.length?null:a)},[e.length]),u.useEffect(()=>{const a=M.current;if(a!==void 0){if(M.current=void 0,a===null){p.current?.focus();return}y.current[a]?.focus()}});const j=u.useRef(void 0);u.useEffect(()=>{const a=h?.caret;if(!a||a===j.current)return;j.current=a;const d=p.current;!d||d.ownerDocument.activeElement!==d||(d.setSelectionRange(a.cursor,a.cursor),h?.onCaretChange(a.cursor))});const O=a=>{h?.onCaretChange(a.selectionStart??a.value.length)},w=u.useCallback(a=>{T(a),M.current=a},[]),N=u.useCallback(a=>{const d=e[a];d&&t&&(w(Ne(a,e.length)),$(`${d.label} removed`),t(d.id))},[e,t,w]),U=u.useCallback(()=>{w(null),r()},[r,w]),V=u.useCallback(a=>{const d=a.currentTarget;if(h?.onKeyDown(a))return;const k=Me({key:a.key,shiftKey:a.shiftKey,repeat:a.repeat,caretAtStart:d.selectionStart===0&&d.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(k.type){case"focusChip":a.preventDefault(),w(k.index);return;case"clearQuery":b();return;case"blur":d.blur();return;case"none":return}},[e.length,n,b,w,h]),z=u.useCallback(a=>d=>{const k=Pe({key:d.key,repeat:d.repeat,index:a,chipCount:e.length});switch(k.type!=="none"&&d.preventDefault(),k.type){case"removeChip":N(k.index);return;case"focusChip":w(k.index);return;case"focusInput":w(null);return;case"activateChip":return;case"none":return}},[e,N,w]);return u.useEffect(()=>{if(!c)return;const a=d=>{d.key!=="/"||d.metaKey||d.ctrlKey||d.altKey||De(d.target)||(d.preventDefault(),p.current?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[c]),g.jsxs("label",{htmlFor:S,className:v("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",m==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",x),children:[g.jsx(G,{className:v("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),g.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[P&&g.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((a,d)=>g.jsx(W,{ref:k=>{y.current[d]=k},label:a.label,tone:a.tone,focused:R===d,onFocusLabel:()=>T(d),onKeyDown:z(d),onRemove:()=>N(d)},a.id))}),g.jsx("input",{ref:p,id:S,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:R===null?0:-1,onChange:a=>{s(a.target.value),O(a.target)},onKeyDown:V,onKeyUp:a=>O(a.currentTarget),onClick:a=>O(a.currentTarget),onFocus:a=>{T(null),h?.onFocusChange?.(!0),O(a.currentTarget)},onBlur:()=>h?.onFocusChange?.(!1),...h?.comboboxProps,placeholder:P?void 0:i,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||P)&&f&&g.jsx("button",{type:"button",onClick:U,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:g.jsx(X,{className:v("text-fg-muted",m==="lg"?"size-5":"size-4")})}),g.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:_})]})},ze=({value:e,onChange:t,onClear:n,onClearQuery:s,chips:r,onRemoveChip:o,placeholder:i="Search mail...",globalFocusKey:c=!0,showClearButton:f=!0,size:m,inputId:l,suggest:h,className:x})=>g.jsx(Le,{value:e,onChange:t,onClear:n,onClearQuery:s,chips:r,onRemoveChip:o,placeholder:i,globalFocusKey:c,showClearButton:f,size:m,inputId:l,suggest:h,className:x});function Ge({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:s=1e3}){const r=u.useRef(e);r.current=e;const o=u.useRef(null),i=u.useRef(null);u.useEffect(()=>{if(!t)return;const c=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},f=l=>{const h=Ie({key:l.key,shiftKey:l.shiftKey,metaKey:l.metaKey,ctrlKey:l.ctrlKey,altKey:l.altKey,inEditable:Ee(l.target),onControl:Oe(l.target)},o.current);if(c(),o.current=h.nextPrefix,h.nextPrefix!==null&&(i.current=setTimeout(()=>{o.current=null,i.current=null},s)),h.action===null)return;const x=r.current[h.action];x&&(h.preventDefault&&l.preventDefault(),x())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",f),()=>{m.removeEventListener("keydown",f),c(),o.current=null}},[t,s,n])}function Q(e,t){const n=new Set(t);return e.filter(s=>!n.has(s))}function Ke(e,t,n){const s=e.slice(0);return s[t]=n,s}var Ae=class extends Y{#r;#e;#o;#s;#t;#n;#i;#a;#c;#u=[];constructor(e,t,n){super(),this.#r=e,this.#s=n,this.#o=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#h(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#o=e,this.#s=t,D.batch(()=>{const n=this.#t,s=this.#d(this.#o);s.forEach(l=>l.observer.setOptions(l.defaultedQueryOptions));const r=s.map(l=>l.observer),o=r.map(l=>l.getCurrentResult()),i=n.length!==r.length,c=r.some((l,h)=>l!==n[h]),f=i||c,m=f?!0:o.some((l,h)=>{const x=this.#e[h];return!x||!J(l,x)});!f&&!m||(f&&(this.#u=s,this.#t=r),this.#e=o,this.hasListeners()&&(f&&(Q(n,r).forEach(l=>{l.destroy()}),Q(r,n).forEach(l=>{l.subscribe(h=>{this.#h(l,h)})})),this.#p()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const n=this.#d(e),s=n.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),r=n.map(o=>o.defaultedQueryOptions.queryHash);return[s,o=>this.#f(o??s,t,r),()=>this.#l(s,n)]}#l(e,t){return t.map((n,s)=>{const r=e[s];return n.defaultedQueryOptions.notifyOnChangeProps?r:n.observer.trackResult(r,o=>{t.forEach(i=>{i.observer.trackProp(o)})})})}#f(e,t,n){if(t){const s=this.#c,r=n!==void 0&&s!==void 0&&(s.length!==n.length||n.some((o,i)=>o!==s[i]));return(!this.#n||this.#e!==this.#a||r||t!==this.#i)&&(this.#i=t,this.#a=this.#e,n!==void 0&&(this.#c=n),this.#n=Z(this.#n,t(e))),this.#n}return e}#m(){return this.#s?.combine!==void 0&&this.#t.some((e,t)=>e.options.suspense&&this.#e[t]?.data===void 0)}#d(e){const t=new Map;this.#t.forEach(s=>{const r=s.options.queryHash;if(!r)return;const o=t.get(r);o?o.push(s):t.set(r,[s])});const n=[];return e.forEach(s=>{const r=this.#r.defaultQueryOptions(s),i=t.get(r.queryHash)?.shift()??new H(this.#r,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Ke(this.#e,n,t),this.#p())}#p(){if(this.hasListeners()){const e=this.#l(this.#e,this.#u),t=this.#m(),n=this.#n,s=t?n:this.#f(e,this.#s?.combine);(t||n!==s)&&D.batch(()=>{this.listeners.forEach(r=>{r(this.#e)})})}}};function A({queries:e,...t},n){const s=ee(),r=te(),o=ne(),i=u.useMemo(()=>e.map(p=>{const y=s.defaultQueryOptions(p);return y._optimisticResults=r?"isRestoring":"optimistic",y}),[e,s,r]);i.forEach(p=>{se(p);const y=s.getQueryCache().get(p.queryHash);re(p,o,y)}),oe(o);const[c]=u.useState(()=>new Ae(s,i,t)),[f,m,l]=c.getOptimisticResult(i,t.combine),h=!r&&t.subscribed!==!1;u.useSyncExternalStore(u.useCallback(p=>h?c.subscribe(D.batchCalls(p)):ie,[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),u.useEffect(()=>{c.setQueries(i,t)},[i,t,c]);const E=f.some((p,y)=>q(i[y],p))?f.flatMap((p,y)=>{const b=i[y];if(b&&q(b,p)){const R=new H(s,b);return ae(b,R,o)}return[]}):[];if(E.length>0)throw Promise.all(E);const S=f.find((p,y)=>{const b=i[y];return b&&ce({result:p,errorResetBoundary:o,throwOnError:b.throwOnError,query:s.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(S?.error)throw S.error;return m(l())}function We(){const e=C({from:"/mail/brief/$threadId",shouldThrow:!1}),t=C({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=C({from:"/mail/flagged/$threadId",shouldThrow:!1}),s=C({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),r=C({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),o=C({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),i=e?.threadId??n?.threadId??r?.threadId,c=t?.messageId??s?.messageId??o?.messageId;return u.useMemo(()=>i?{threadId:i,messageId:c}:void 0,[i,c])}const Xe=({trigger:e,children:t,align:n="right"})=>{const[s,r]=u.useState(!1),o=u.useRef(null),i=u.useCallback(f=>{o.current&&!o.current.contains(f.target)&&r(!1)},[]),c=u.useCallback(f=>{f.key==="Escape"&&r(!1)},[]);return u.useEffect(()=>(s&&(document.addEventListener("mousedown",i),document.addEventListener("keydown",c)),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",c)}),[s,i,c]),g.jsxs("div",{ref:o,className:"relative",children:[g.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),r(!s)},className:v("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:e}),s&&g.jsx("div",{className:v("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",n==="right"?"right-0":"left-0"),children:t})]})},Ye=({onClick:e,disabled:t,destructive:n,children:s})=>g.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),t||e()},disabled:t,className:v("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",n&&"text-danger hover:text-danger"),children:s}),Je=()=>g.jsx("div",{className:"my-1 h-px bg-line"}),je=({accounts:e})=>{const t=C({strict:!1}),n=pe(),s=t.mailboxId,{t:r}=ue("mail",{useSuspense:!1}),o=u.useCallback((c,f)=>r(c,{defaultValue:f}),[r]),i=A({queries:e.map(c=>({...K({path:{accountId:c.accountId}}),staleTime:1/0}))});if(n.pathname.startsWith("/mail/outbox"))return"Outbox";if(!s)return null;for(let c=0;c<e.length;c++){const f=i[c]?.data?.items;if(!f)continue;const m=f.find(h=>h.mailboxId===s);if(!m)continue;const l=le(e[c].folderAppointments);return fe(m,l.get(s),o)}return null},Ze=({accounts:e})=>{const n=C({strict:!1}).mailboxId,s=A({queries:e.map(r=>({...K({path:{accountId:r.accountId}}),staleTime:1/0}))});if(!n)return null;for(const r of s){const o=r.data?.items;if(!o)continue;const i=o.find(c=>c.mailboxId===n);if(i)return i.unseenCount}return null},et=({accounts:e})=>{const n=C({strict:!1}).mailboxId,s=A({queries:e.map(r=>({...K({path:{accountId:r.accountId}}),staleTime:1/0}))});if(!n)return 0;for(const r of s){const o=r.data?.items;if(!o)continue;const i=o.find(c=>c.mailboxId===n);if(i)return i.messageCount}return 0};function tt(e){const t=de(),{searchInput:n}=he(),s=je({accounts:e}),r=me({select:c=>c.matches}),o=ge(r,s),i=u.useCallback(c=>{c===ye&&t({to:"/mail/brief",search:{q:n||void 0}})},[t,n]);return{scope:o,clearScope:i}}const qe=768,nt=e=>e!=="desktop",st=()=>{const e=F(`(min-width: ${qe}px)`);return F(be)?"desktop":e?"tablet":"phone"};function rt(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase(),r=s.split("@")[0];r&&!t.has(r)&&t.set(r,n.accountId),t.has(s)||t.set(s,n.accountId)}return t}function ot(e){const t=new Map;for(const n of e)for(const s of n){const r=s.fullPath?.toLowerCase();if(!r)continue;const o=L(s).toLowerCase();t.has(r)||t.set(r,s.mailboxId),t.has(o)||t.set(o,s.mailboxId)}return t}function it(e,t=[]){const n=e.flat().filter(o=>o.fullPath),s=new Map;for(const o of n){const i=L(o).toLowerCase();s.set(i,(s.get(i)??0)+1)}const r=new Map(t.map(o=>[o.accountId,o.email]));return n.map(o=>{const i=L(o),c=s.get(i.toLowerCase())===1,f=t.length>1?r.get(o.accountId):void 0;return{value:c?i:o.fullPath,label:o.displayNameOverride?.trim()||i,...f?{hint:f}:{}}})}function at(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase().split("@")[0]??"";t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=n.email.split("@")[0]??n.email,r=t.get(s.toLowerCase())===1,o=n.displayName?.trim();return{value:r?s:n.email,label:o||n.email,...o?{hint:n.email}:{}}})}export{_e as B,Xe as D,we as K,$e as R,ze as S,Je as a,Ye as b,A as c,ot as d,st as e,We as f,Ge as g,rt as h,nt as i,je as j,Ze as k,et as l,xe as m,Re as n,it as o,at as p,Ue as q,Ce as s,Ve as t,tt as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as u,j as s,Z as l,_ as p}from"./index-D_YBuI3z.js";import{F as v}from"./FullCompose-B0bbns1M.js";import{f as x,j as m}from"./useMessageBodyContent-DEOYO0s3.js";const c=u.createContext(null),O=({chrome:o,children:n})=>s.jsx(c.Provider,{value:o,children:n});function S({phone:o,list:n,reading:r,intelligence:t,hasThread:a=!1}){const e=u.useContext(c),f=x();if(!e)return s.jsx(l,{});const i={nav:e.nav,overlay:e.overlay,skeleton:s.jsx(l,{}),isLoading:e.isLoading,navOpen:e.navOpen,onOpenNav:e.onOpenNav,onCloseNav:e.onCloseNav};return e.isSinglePane?s.jsx(p,{...i,list:f?s.jsx(v,{}):o,intelligenceOpen:e.intelligenceOpen}):s.jsx(p,{...i,topBar:e.topBar,list:n,reading:r,intelligence:t,intelligenceOpen:e.intelligenceOpen,hasThread:a})}function d(o,n,r){if(o!==n)return r}function C(o,n){return o===""?"":n}function M({searchInput:o,committedQuery:n,urlQuery:r,pathname:t,listPath:a}){return!m(t,a)||n!==o?!1:n!==r}export{O as M,S as a,M as b,C as c,d as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,b as S,m as L,r as c,ar as O,ad as T,g as $,av as A,s as I,bi as q,n as C,a7 as k,bj as M,bk as P,B as N,a as R,bl as G,X as Q}from"./index-D_YBuI3z.js";import{K as f}from"./kbd-BUm8HPo9.js";import{S as B,a as E}from"./settings-screen-D53GKsd_.js";import{E as V}from"./ErrorState-CNHmvGYF.js";import{u as K}from"./useDebouncedValue-4E-721vu.js";import{a as _}from"./format-23Av07Go.js";import{s as D}from"./help-copy-o2bu5jXr.js";import"./avatar-DtND0ruk.js";import"./menu-B4mmeG34.js";import"./circle-help-lK4oidSt.js";function F({options:t,active:r,onSelect:m}){return e.jsx("div",{role:"tablist",className:S("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(a=>{const d=a.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(a.id),className:S("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:a.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:a.count??"—"})]},a.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function H({query:t,onCount:r}){const{data:m,isPending:a,isError:d,error:b}=I(q()),g=C(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:M()})}}),l=m?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(n=>(n.displayName??"").toLowerCase().includes(p)||n.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),a?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:b})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(f,{children:"v"})," on any message to promote a sender to VIP."]}):u.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),u.map(n=>e.jsx(E,{name:n.displayName??n.normalizedEmail,email:n.normalizedEmail,meta:n.replyCount>0?`${n.inboundCount} received · you replied ${n.replyCount}×`:`${n.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:n.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},n.addressId))]})}function U({group:t,query:r,onCount:m}){const a=K(r.trim(),300),d=C(),[b,g]=c.useState(null),i=a.length>=2,l=G({query:{q:a,limit:50}}),{data:p,isPending:u,isError:n,error:j}=I({...l,enabled:i}),x=k({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),h=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{m?.(i?h.length:0,null)},[m,i,h.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):n?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):h.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",a,"”."]}):e.jsx(e.Fragment,{children:h.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&_(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=x.isPending&&x.variables?.path.addressId===s.addressId,z=x.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(Q,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}}))}})},s.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",v[t].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(f,{children:"m"})," on any message to mute its sender; ",e.jsx(f,{children:"b"})," to block."]})]})}function re(){const t=L(),[r,m]=c.useState("vip"),[a,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),n=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),x=p[r],h=s=>{const o=A[s];o&&t({to:o})};return e.jsx(B,{items:O,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:D,helpOpen:b,onToggleHelp:()=>g(s=>!s),onSelect:h,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(F,{active:r,onSelect:s=>{m(s),d("")},options:["vip","muted","blocked"].map(s=>({id:s,label:v[s],count:p[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(T,{icon:e.jsx($,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:a,onChange:s=>d(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:r==="vip"?e.jsx(H,{query:a,onCount:n}):e.jsx(U,{group:r,query:a,onCount:j})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:x!=null?`${i} of ${x} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(f,{children:"j"})," ",e.jsx(f,{children:"k"})," navigate · ",e.jsx(f,{children:"⌫"})," remove flag"]})]})]})]})})}export{re as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,U as o}from"./index-D_YBuI3z.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,$ as e}from"./index-D_YBuI3z.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as L,bM as p,n,a7 as l,bN as d,r as o,bO as y,bP as c,bQ as g}from"./index-D_YBuI3z.js";const u=e=>y({path:{accountId:e}}),f=e=>{const s=L({...p({path:{accountId:e??""}}),enabled:!!e});return{labels:s.data?.items??[],isPending:s.isPending,isError:s.isError,error:s.error,refetch:s.refetch}},m=e=>{const s=n(),t=l({...d(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutateAsync:r}=t;return{createLabel:o.useCallback((a,i="Default")=>e?r({path:{accountId:e},body:{name:a,color:i}}):Promise.reject(new Error("No account")),[e,r]),isPending:t.isPending,isError:t.isError,error:t.error,reset:t.reset}},h=e=>{const s=n(),t=l({...c(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{updateLabel:o.useCallback((a,i)=>{e&&r({path:{accountId:e,labelId:a},body:i})},[e,r]),isPending:t.isPending,updatingLabelId:t.isPending?t.variables?.path.labelId:void 0}},C=e=>{const s=n(),t=l({...g(),onSuccess:()=>{e&&s.invalidateQueries({queryKey:u(e)})}}),{mutate:r}=t;return{deleteLabel:o.useCallback(a=>{e&&r({path:{accountId:e,labelId:a}})},[e,r]),isPending:t.isPending,deletingLabelId:t.isPending?t.variables?.path.labelId:void 0}};export{f as a,h as b,C as c,m as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s}from"./index-D_YBuI3z.js";const r=1024,c=`(min-width: ${r}px) and (not ((orientation: portrait) and (pointer: coarse)))`,d=e=>{const[o,n]=s.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(e).matches);return s.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const t=window.matchMedia(e);n(t.matches);const a=i=>n(i.matches);return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),o},m=()=>d(c);export{c as D,d as a,m as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{G as M,c5 as T,c6 as O,w as f,r as i,c7 as P,m as h,j as W,c8 as Y,c9 as V,W as H,k as z,n as J,s as Z,ca as ee,cb as te}from"./index-D_YBuI3z.js";import{u as se}from"./useMediaQuery-CDMcFeIb.js";function re(e){const t=M({warn:e?.router===void 0}),s=e?.router||t;return T(s.stores.__store,O(e,s))}function ne(e){const t=M();return T(t.stores.location,O(e,t))}const A="/mail/brief",S="/mail/$mailboxId",v="/mail/outbox",L="/mail/flagged";function oe(e){for(const t of e){if(t.routeId===A)return{list:"brief"};if(t.routeId===L)return{list:"flagged"};if(t.routeId===v)return{list:"outbox"};if(t.routeId===S)return{list:"mailbox",mailboxId:t.params?.mailboxId}}}function Te(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);if(t[0]!=="mail")return"";const s=t[1];return s?s==="brief"?A:s==="flagged"?L:s==="outbox"?v:ae(s):""}function Oe(e){if(typeof e!="object"||e===null)return"";const{q:t}=e;return typeof t=="string"?t:""}function ae(e){return`${S}:${e}`}function Pe(e,t){return e===t?!0:e.startsWith(`${t}/`)}function Ae(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);return t[0]==="mail"&&t.length>2}function g(){const e=re({select:s=>oe(s.matches)?.list}),t=f({from:"/mail/$mailboxId",shouldThrow:!1});return{list:e,mailboxId:t?.mailboxId}}const k=["intelligence","nav","shortcuts"],ie=["nav","shortcuts"],ue=e=>ie.includes(e),ce=P(k);function x(e){const t=new Set(e.split(",").map(s=>ce.safeParse(s)).filter(s=>s.success).map(s=>s.data));return k.filter(s=>t.has(s))}function w(e){return k.filter(t=>e.includes(t)).join(",")}function Se(){const e=ne({select:t=>w(x(t.hash))});return i.useMemo(()=>x(e),[e])}const le=(e,t)=>!ue(e)&&t;function de(e){return(t="")=>w(x(t).filter(s=>le(s,e)))}function y(){const e=se();return i.useMemo(()=>de(e),[e])}function ve(){const e=h();return i.useCallback(t=>{e({search:!0,hash:w(t),replace:!0,hashScrollIntoView:!1})},[e])}const _="/mail/brief/compose/{-$outboxMessageId}",D="/mail/flagged/compose/{-$outboxMessageId}",B="/mail/outbox/compose/{-$outboxMessageId}",U="/mail/$mailboxId/compose/{-$outboxMessageId}";function F(){const e=f({from:_,shouldThrow:!1}),t=f({from:D,shouldThrow:!1}),s=f({from:B,shouldThrow:!1}),r=f({from:U,shouldThrow:!1});return e??t??s??r}function Le(){return F()!==void 0}function _e(){return F()?.outboxMessageId}function fe(e,t,s){return e==="flagged"?{to:D,params:{outboxMessageId:s}}:e==="outbox"?{to:B,params:{outboxMessageId:s}}:e==="mailbox"&&t?{to:U,params:{mailboxId:t,outboxMessageId:s}}:{to:_,params:{outboxMessageId:s}}}function C(){const e=h(),t=y(),{list:s,mailboxId:r}=g();return i.useCallback((n,o)=>{e({...fe(s,r,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,s,r])}function De(){const e=C();return i.useCallback(()=>e(void 0),[e])}function Be(){const e=C();return i.useCallback(t=>e(t),[e])}function Ue(){const e=C();return i.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function Fe(){const e=h(),t=y(),{list:s,mailboxId:r}=g();return i.useCallback(()=>{const n=a=>a,o=t;if(s==="flagged"){e({to:"/mail/flagged",search:n,hash:o});return}if(s==="outbox"){e({to:"/mail/outbox",search:n,hash:o});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId",params:{mailboxId:r},search:n,hash:o});return}e({to:"/mail/brief",search:n,hash:o})},[e,t,s,r])}const me=Y(V);function Ne({fragment:e,...t}){const s=y();return W.jsx(me,{...t,hash:e??s})}const he=["reply","reply-all","forward"],pe=P(he),N="/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}",K="/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}",q="/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}";function G(){const e=f({from:N,shouldThrow:!1}),t=f({from:K,shouldThrow:!1}),s=f({from:q,shouldThrow:!1});return e??t??s}function $(){const e=G();return i.useMemo(()=>{if(!e)return;const t=pe.safeParse(e.mode);return t.success?{kind:"reply",mode:t.data,threadId:e.threadId,sourceMessageId:e.messageId,outboxMessageId:e.outboxMessageId}:{kind:"unknown",segment:e.mode}},[e])}function Ke(){return $()?.kind==="reply"}function Q(e,t,s,r){return e==="flagged"?{to:K,params:{...s,outboxMessageId:r}}:e==="mailbox"&&t?{to:q,params:{...s,mailboxId:t,outboxMessageId:r}}:{to:N,params:{...s,outboxMessageId:r}}}function ge(e,t){if(e?.kind==="reply"&&e.threadId===t.threadId&&e.sourceMessageId===t.messageId)return e.outboxMessageId}function qe(){const e=h(),t=y(),{list:s,mailboxId:r}=g(),n=$();return i.useCallback(o=>{e({...Q(s,r,o,ge(n,o)),search:a=>a,hash:t})},[e,t,s,r,n])}function Ge(e,t,s){if(!(!t||!s))return r=>e({threadId:t,messageId:s,mode:r})}function Qe(){const e=h(),{list:t,mailboxId:s}=g(),r=$();return i.useCallback(n=>{r?.kind==="reply"&&e({...Q(t,s,{threadId:r.threadId,messageId:r.sourceMessageId,mode:r.mode},n),search:o=>o,hash:!0,replace:!0})},[e,t,s,r])}function Xe(){const e=h(),t=y(),{list:s,mailboxId:r}=g(),n=G();return i.useCallback(()=>{if(!n)return;const o=c=>c,a=t,u={threadId:n.threadId,messageId:n.messageId};if(s==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:u,search:o,hash:a});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{...u,mailboxId:r},search:o,hash:a});return}e({to:"/mail/brief/$threadId/$messageId",params:u,search:o,hash:a})},[e,t,s,r,n])}const ye=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),s=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(s)return{kind:"html",contentUrl:s.contentUrl};const r=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return r?{kind:"text",contentUrl:r.contentUrl}:null},R={all:["messages"],detail:e=>[...R.all,"detail",e],body:e=>[...R.detail(e),"body"]};class m extends Error{reason;status;retryAfterSeconds;constructor(t,s,r,n){super(s),this.name="BodyFetchError",this.reason=t,this.status=r,this.retryAfterSeconds=n}}const be=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},Ie=8,xe="x-remit-403-reason",Re=(e,t)=>{const s=t?.trim()??"";return e===401?"auth":e===403?s.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},ke=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,we=(e,t)=>{const s=(t??"").toLowerCase();return!!(e==="text"&&s.startsWith("text/html"))},Ce=async(e,t,s=async()=>null)=>{const r={},n=await s();n&&(r.Authorization=`Bearer ${n}`);const o=await te(e,{headers:r});if(o.status===202)throw new m("not-ready","Message body is still syncing",202,be(o.headers.get("Retry-After")));if(!o.ok){const c=o.headers.get(xe),b=Re(o.status,c);throw new m(b,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(we(t,a))throw new m("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const u=await o.text();if(ke(u,a))throw new m("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return u},$e=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),je=({messageId:e,bodyParts:t,enabled:s=!0})=>{const r=t?ye(t):null,n=H(),{getToken:o}=z(),a=i.useRef(null),u=J(),c=i.useRef(!1),b=i.useRef(null),E=e&&r?`${e}:${r.contentUrl}`:null;b.current!==E&&(b.current=E,c.current=!1);const l=Z({queryKey:e?[...R.body(e),r?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!r)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const p=c.current;return c.current=!1,$e({fetchContent:(d,j)=>Ce(d,j,o),refetchDescribeMessage:()=>u.refetchQueries({queryKey:ee({path:{messageId:e}})})},{contentUrl:r.contentUrl,kind:r.kind,isRetryAfterNotReady:p})},enabled:s&&!!e&&!!r,staleTime:300*1e3,gcTime:1800*1e3,retry:(p,d)=>d instanceof m&&d.reason==="not-ready"?p<Ie:p<1,retryDelay:(p,d)=>d instanceof m&&d.reason==="not-ready"?(c.current=!0,(d.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),I=l.isLoading&&!!r;i.useEffect(()=>{I&&(a.current=performance.now())},[I]),i.useEffect(()=>{l.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[l.isSuccess,n]);const X=l.data&&r?{kind:r.kind,body:l.data}:void 0;return{picked:r,data:X,isLoading:I,isError:l.isError,error:l.error,refetch:l.refetch}};export{m as B,Ne as N,ne as a,Se as b,ve as c,re as d,Oe as e,Le as f,oe as g,Ke as h,ue as i,Pe as j,_e as k,Ae as l,Te as m,Be as n,y as o,qe as p,je as q,Ge as r,Ue as s,Fe as t,De as u,Qe as v,Xe as w,Re as x,$ as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as E,e as q,b as j,B as D,r as i,ax as R,n as C,l as K,W as A,K as Q,J as $,L as z,N as B}from"./index-D_YBuI3z.js";import{C as G}from"./circle-check-big-BCgBHZQm.js";import{R as H,c as N}from"./search-token-index-nAK4hI7B.js";function oe({state:e,onRefresh:t,label:s,errorMessage:a,hasUpdate:n,size:u="sm",className:c}){const o=e==="refreshing",f=e==="error",h=e==="success",g=f?E.jsx(q,{className:"size-4 text-danger"}):h?E.jsx(G,{className:"size-4 text-positive"}):E.jsx(H,{className:j("size-4",o&&"animate-spin")}),y=f?`${s} — failed: ${a??"try again"}`:o?`${s} — refreshing`:h?`${s} — up to date`:n?`${s} — new mail`:s;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx(D,{variant:"ghost",size:u,icon:g,onClick:t,disabled:o,"aria-label":y,"aria-busy":o||void 0,title:f?a:s,className:c}),e==="idle"&&n&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const W=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function P(e){return!!e&&W.has(e)}const L=3e3,U=L*2,M={syncing:!1,resolved:!1,synced:0,total:0};function ie(e,t){const s=e.join(","),[a,n]=i.useState(!1),[u,c]=i.useState(!1);i.useEffect(()=>{n(!1),c(!1)},[s,t]),i.useEffect(()=>{if(!t)return;const r=setTimeout(()=>c(!0),U);return()=>clearTimeout(r)},[s,t]);const o=N({queries:e.map(r=>({...R({path:{accountId:r}}),enabled:t&&!a,refetchInterval:L,meta:{softError:!0}}))}),f=o.every(r=>r.isSuccess||r.isError),h=o.length===0||f||u;let g=!1,y=0,w=0;for(const r of o)if(P(r.data?.syncPhase)){g=!0;for(const l of r.data?.mailboxes??[])y+=l.messagesSynced,w+=l.messagesTotal}const S=t&&h&&!g;return i.useEffect(()=>{S&&n(!0)},[S]),!t||!h?M:{syncing:g,resolved:!0,synced:y,total:w}}const k=6e4,I=new Set(["sent","drafts","trash","archive"]),v=(e,t)=>{const s=new Map;for(const a of e){const n=t.get(a.mailboxId)?.role;n&&I.has(n)||s.set(a.mailboxId,a.messagesTotal)}return s},J=(e,t)=>{for(const[s,a]of t)if(a>(e.get(s)??0))return!0;return!1},_=i.createContext(null),X=()=>{const e=i.useContext(_);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function ce({accountIds:e,children:t}){const s=C(),{resultFolderIndex:a}=K(),n=i.useRef(new Map),u=i.useRef(new Set),[c,o]=i.useState(new Set),f=N({queries:e.map(r=>({...R({path:{accountId:r}}),refetchInterval:k,staleTime:k,meta:{softError:!0}}))}),h=f.map(r=>r.dataUpdatedAt).join(","),g=e.join(",");i.useEffect(()=>{let r=!1;const l=new Set(c);e.forEach((d,x)=>{const p=f[x]?.data;if(!p)return;const m=v(p.mailboxes??[],a);if(!u.current.has(d)){u.current.add(d),n.current.set(d,m);return}if(l.has(d))return;const T=n.current.get(d)??new Map;J(T,m)&&(l.add(d),r=!0)}),r&&o(l)},[g,h]);const y=i.useCallback(r=>r.some(l=>c.has(l)),[c]),w=i.useCallback(r=>{o(l=>{if(r.every(x=>!l.has(x)))return l;const d=new Set(l);for(const x of r)d.delete(x);return d});for(const l of r){const d=s.getQueryData(R({path:{accountId:l}}).queryKey);n.current.set(l,v(d?.mailboxes??[],a)),u.current.add(l)}},[s,a]),S=i.useMemo(()=>({hasNewMail:y,acknowledge:w}),[y,w]);return E.jsx(_.Provider,{value:S,children:t})}const V=2e3,Y=45e3,Z=e=>new Promise(t=>setTimeout(t,e)),b=e=>e instanceof Error&&e.message?e.message:"Something went wrong",ee=e=>{z(e,{softError:!0},"user")&&B(e)},F=e=>e.reduce((t,s)=>Math.max(t,s.lastSyncedAt??0),0),O=(e,t)=>e.fetchQuery({...R({path:{accountId:t}}),staleTime:0}),se=async(e,t,s,a)=>{let n=!1;for(;;){const u=await O(e,t).then(f=>({ok:!0,data:f})).catch(f=>({ok:!1,error:f}));if(!u.ok)return{accountId:t,message:b(u.error)};const{syncPhase:c,mailboxes:o}=u.data;if(P(c))n=!0;else if(n||F(o??[])>s)return c==="error"?{accountId:t,message:"Sync failed for this account"}:void 0;if(Date.now()>=a)return{accountId:t,message:"Refresh is taking longer than usual"};await Z(V)}},te=async(e,t,s,a)=>{const n=await O(e,s).then(o=>({ok:!0,maxLastSynced:F(o.mailboxes??[])})).catch(o=>({ok:!1,error:o}));if(!n.ok)return{accountId:s,enqueued:!1,ok:!1,message:b(n.error)};const u=await $({path:{accountId:s},throwOnError:!0}).then(()=>({ok:!0})).catch(o=>({ok:!1,error:o}));if(!u.ok)return ee(u.error),{accountId:s,enqueued:!1,ok:!1,message:b(u.error)};t.recordEvent("sync.triggered");const c=await se(e,s,n.maxLastSynced,a);return c?{accountId:s,enqueued:!0,ok:!1,message:c.message}:{accountId:s,enqueued:!0,ok:!0}},ue=(e,t={})=>{const s=C(),a=A(),{acknowledge:n}=X(),[u,c]=i.useState("idle"),[o,f]=i.useState(),h=i.useRef(0),g=i.useRef(e);g.current=e;const y=i.useRef(t);y.current=t,i.useEffect(()=>{if(u!=="success")return;const S=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(S)},[u]);const w=i.useCallback(()=>{const S=g.current;if(S.length===0){c("error"),f("Nothing to refresh yet");return}const r=++h.current;c("refreshing"),f(void 0),(async()=>{const l=Date.now()+Y,d=await Promise.all(S.map(m=>te(s,a,m,l)));if(h.current!==r)return;const x=d.filter(m=>m.enqueued).map(m=>m.accountId);for(const m of x)s.invalidateQueries({queryKey:Q({path:{accountId:m}})});x.length>0&&(y.current.onSettled?.(),n(x));const p=d.filter(m=>!m.ok);p.length===0?c("success"):(c("error"),f(p[0]?.message))})()},[n,s,a]);return{state:u,errorMessage:o,refresh:w}};export{ce as M,oe as R,ue as a,ie as b,P as i,X as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as v,l as x,r as I}from"./index-D_YBuI3z.js";import{d as p,f as g,h as Q,e as b}from"./useMessageBodyContent-DEOYO0s3.js";import{b as q}from"./search-view-CtInfT0I.js";function W(a){const t=v(),{searchInput:c,searchQuery:e}=x(),i=p({select:o=>b(o.location.search)}),u=p({select:o=>o.location.pathname}),h=g(),f=Q(),m=h||f,{to:s}=a,r="params"in a?a.params.mailboxId:void 0,l=r?`/mail/${r}`:s;I.useEffect(()=>{if(!q({searchInput:c,committedQuery:e,urlQuery:i,pathname:u,listPath:l}))return;const y=!!e&&i!==e&&!m,n=d=>({...d,q:e||void 0});if(!y){t({to:".",search:n,hash:!0,replace:!0});return}if(s==="/mail/$mailboxId"){if(!r)return;t({to:s,params:{mailboxId:r},search:n,hash:!0,replace:!0});return}t({to:s,search:n,hash:!0,replace:!0})},[c,e,i,t,s,r,l,u,m])}export{W as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as T,a5 as I,a7 as C,bv as k,bH as A,r as v,j as p,bI as h,bJ as E,bK as j,l as D,s as R,bL as z,by as Q}from"./index-D_YBuI3z.js";import{P as w}from"./attachment-file-BrXH3M3V.js";import{E as O,F as P,ao as _,ap as N}from"./MailListHeader-BcdPneAy.js";import{a as q}from"./useLabels-CwcqSC09.js";import{d as F}from"./useMessageBodyContent-DEOYO0s3.js";import{n as H}from"./search-query-Cr_ZXBCp.js";import{s as U}from"./search-scope-MtY0zpRq.js";import{u as B,p as G}from"./useSearchTokenContext-DROeO7xw.js";const ne=e=>{const t=new Set;for(const a of e)a&&t.add(a);return t.size>1?{accountId:void 0,restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"}:{accountId:t.size===1?[...t][0]:void 0,restriction:void 0,moveDisabledHint:void 0}},K=e=>{const{mailboxId:t,messages:a}=e,c=T(),{pushError:l}=I(),{mutateAsync:i,isPending:o}=C({...A(),onError:(n,u)=>{l({title:u.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:k(n),error:n})},onSettled:(n,u,d)=>{O(c,P(_(d.body.messageIds??[],a??[],t)))}});return{applyLabel:v.useCallback((n,u,d)=>{n.length!==0&&N(n,m=>i({body:{messageIds:m,labelId:u,action:d}}))},[i]),isPending:o}};function re({accountId:e,mailboxId:t,messageIds:a}){const{labels:c}=q(e),{applyLabel:l}=K({mailboxId:t}),i=v.useMemo(()=>c.map(o=>({key:o.labelId,label:o.name,icon:p.jsx("span",{className:`size-2.5 rounded-full ${E(o.color)?h[o.color]:h.Default}`}),onSelect:()=>l(a,o.labelId,"Apply")})),[c,a,l]);return i.length===0?null:p.jsx(w,{triggerLabel:"Apply label to selected messages",triggerIcon:p.jsx(j,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:i,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}const J=20,V=new Set(Object.values(Q)),$=e=>e!==void 0&&V.has(e)?e:void 0,W=e=>{if(e.some(t=>t.type==="isUnread"))return!1;if(e.some(t=>t.type==="isRead"))return!0};function ie({mailboxId:e,filterCategory:t}={}){const{searchQuery:a}=D(),c=B(),l=F({select:s=>s.matches}),i=H(a),{freeText:o,tokens:r}=G(i,c),n=o.length>0,u=r.find(s=>s.type==="category"),d=$(t)??u?.category,m=r.some(s=>s.type==="hasAttachment")?!0:void 0,b=r.some(s=>s.type==="isStarred")?!0:void 0,y=W(r),f=r.find(s=>s.type==="after"),g=r.find(s=>s.type==="before"),S=r.find(s=>s.type==="in"),x=U({matches:l,callerMailboxId:e,inTokenMailboxId:S?.mailboxId}),{data:L,isLoading:M}=R({...z({query:{query:o,mailboxId:x,limit:J,...d!==void 0?{category:d}:{},...m!==void 0?{hasAttachment:m}:{},...b!==void 0?{hasStars:b}:{},...y!==void 0?{isRead:y}:{},...f?{sentDateFrom:f.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:n,staleTime:6e4});return{hits:L?.items??[],isLoading:n&&M}}export{re as L,ne as r,ie as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as g,a5 as p,s as f,Q as m,r,a7 as y,a8 as T,V as E,a9 as x}from"./index-D_YBuI3z.js";const i={html:"",plainText:""},d=e=>{const u=g(),{pushError:o}=p(),{data:n}=f({...m(),staleTime:1/0}),l=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(a=>a.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),s=y({...x(),onSuccess:()=>{u.invalidateQueries({queryKey:E()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),c=r.useCallback((t,a)=>{e&&s.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:a}})},[e,s]);return{signature:l,setSignature:c,isSaving:s.isPending}};export{d as u};
|