@remit/web-client-dist 0.0.637 → 0.0.639
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-i-1XzvAd.js → BriefPane-CdiCvSuF.js} +1 -1
- package/assets/{CalendarComposePane-C9LVQJgz.js → CalendarComposePane-C5loQEEz.js} +1 -1
- package/assets/{CalendarComposeSeed-BcquqWwH.js → CalendarComposeSeed-B602bh7Z.js} +1 -1
- package/assets/{CalendarShell-BrNxa6Nn.js → CalendarShell-BP7ONGRL.js} +1 -1
- package/assets/{EmptyState-haDMp8Ar.js → EmptyState-ClLPPGI1.js} +1 -1
- package/assets/{ErrorState-CmLGalXf.js → ErrorState-CX8jPS64.js} +1 -1
- package/assets/{FlaggedPane-B5Ht6vwP.js → FlaggedPane-CD2pUbFg.js} +1 -1
- package/assets/{FullCompose-BDr9-FPu.js → FullCompose-CgTCPbiG.js} +1 -1
- package/assets/MailListHeader-C8fUfLdY.js +7 -0
- package/assets/{MailNav-BQXjAtKO.js → MailNav-CFYn6k9r.js} +1 -1
- package/assets/{MailShell-CBX109fx.js → MailShell-BnAscFqh.js} +1 -1
- package/assets/{MailViewChrome-K588o61G.js → MailViewChrome-BgP0RFzV.js} +1 -1
- package/assets/{MailboxPane-D9zqi3Rr.js → MailboxPane-CG-dcZ55.js} +1 -1
- package/assets/{NavMenuButton-BpGFPcon.js → NavMenuButton-ggAVFYnQ.js} +1 -1
- package/assets/{OnboardingWizard-ThfV-x2z.js → OnboardingWizard-CrpfDnhV.js} +1 -1
- package/assets/{OpenCalendarEvent-BwmHUJaw.js → OpenCalendarEvent-C-aoRB9f.js} +1 -1
- package/assets/{OutboxPane-Bk9nNby0.js → OutboxPane-CM3kwG8i.js} +1 -1
- package/assets/_calendarObjectId-UmX8K95N.js +1 -0
- package/assets/_mailboxId-DRa01xOQ.js +1 -0
- package/assets/_messageId-BMOloRC2.js +1 -0
- package/assets/_messageId-UrdBJAzT.js +1 -0
- package/assets/_messageId-s6b1mjWq.js +1 -0
- package/assets/_outboxMessageId-C8DuFjhs.js +1 -0
- package/assets/_recurrenceId-qf3rXRrq.js +1 -0
- package/assets/_threadId-CkqELJtN.js +1 -0
- package/assets/_threadId-DdjdPPV9.js +1 -0
- package/assets/_threadId-Dehzj5sp.js +1 -0
- package/assets/{_view._date-B1Vb2h-D.js → _view._date-8_v9V7g9.js} +1 -1
- package/assets/{accounts-ChoqdfMH.js → accounts-ezV4xN2p.js} +1 -1
- package/assets/{advanced-BQgtDSX_.js → advanced-CHdzXVPf.js} +1 -1
- package/assets/{appearance-CiLCRkQD.js → appearance-Dzm_Xcwd.js} +1 -1
- package/assets/{attendee-row-DMe42k7H.js → attendee-row-DaC0cWu0.js} +1 -1
- package/assets/{avatar-OJww5F3k.js → avatar-CMrR_WCW.js} +1 -1
- package/assets/{bell-off-JyhxJiJh.js → bell-off-CjFQsmU0.js} +1 -1
- package/assets/{bottom-sheet-BXHtkHEQ.js → bottom-sheet-lVnXVWKS.js} +1 -1
- package/assets/{brief-Ct3P0mmd.js → brief-B2hZLxBG.js} +1 -1
- package/assets/brief-CbnxY4As.js +1 -0
- package/assets/{browser-ponyfill-BZhAFCLP.js → browser-ponyfill-_Ty7DcLK.js} +1 -1
- package/assets/{bug-BXAS92HM.js → bug-ysY2Lcys.js} +1 -1
- package/assets/{calendar-CIrHuuJU.js → calendar-CozJzlZZ.js} +1 -1
- package/assets/{calendar-clash-strip-Do_J9SgJ.js → calendar-clash-strip-DH-rkJMi.js} +1 -1
- package/assets/{calendar-format-CwRw4RDu.js → calendar-format-CHntutZg.js} +1 -1
- package/assets/{calendar-report-DMvb9Sqg.js → calendar-report-DAUzkHX3.js} +1 -1
- package/assets/calendar-suggestion-CaACTNVX.js +1 -0
- package/assets/{calendars-FdgmByI_.js → calendars-CYKvOlYj.js} +1 -1
- package/assets/{card-Cj-QGmCF.js → card-ChUQkNyW.js} +1 -1
- package/assets/{checkbox-SlSTA73y.js → checkbox-lv4ht1p0.js} +1 -1
- package/assets/chevron-left-BnXYRBLM.js +1 -0
- package/assets/{circle-check-Bp2lyV0E.js → circle-check-CmZH70G9.js} +1 -1
- package/assets/{circle-check-big-Vq2QoGgP.js → circle-check-big-DsPxeo1f.js} +1 -1
- package/assets/{circle-help-gen-dtEL.js → circle-help-CxlWBIxf.js} +1 -1
- package/assets/{clock-BBpIdhnS.js → clock-BQFlXobK.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BFJxAVoN.js +1 -0
- package/assets/compose._-_outboxMessageId_-Bth4jzBG.js +1 -0
- package/assets/compose._-_outboxMessageId_-C8FGmbP_.js +1 -0
- package/assets/compose._-_outboxMessageId_-Kpi3RLY9.js +1 -0
- package/assets/{config-import-DwGVp5nY.js → config-import-CO5AR73r.js} +1 -1
- package/assets/{confirm-dialog-DqUyGPYb.js → confirm-dialog-DM1V3tLO.js} +1 -1
- package/assets/{copy-BFnJYo3G.js → copy-D9w0yOJZ.js} +1 -1
- package/assets/{credential-steps-BYrGAoU5.js → credential-steps-8oD-bgsd.js} +1 -1
- package/assets/{download-CExFNT5m.js → download-D3c-jAvE.js} +1 -1
- package/assets/{file-json-ChcZbyWI.js → file-json-DgAW6fCg.js} +1 -1
- package/assets/{filters-DSI3RcDp.js → filters-COsyZM0t.js} +1 -1
- package/assets/flagged-DKGPYmqT.js +1 -0
- package/assets/{flagged-BTuHoVag.js → flagged-PvSBYoZf.js} +1 -1
- package/assets/{folders-B3UvbiMG.js → folders-9bvPOa--.js} +1 -1
- package/assets/{help-copy-BpnCsJKm.js → help-copy-Bfcrl0wG.js} +1 -1
- package/assets/{import-BtjgDhbI.js → import-CZn1xOPk.js} +1 -1
- package/assets/index-BMOloRC2.js +1 -0
- package/assets/{index-CEJMvVKP.js → index-BNf6kiaX.js} +7 -7
- package/assets/index-BT8lpC7o.js +1 -0
- package/assets/index-B_EiAJWG.js +1 -0
- package/assets/index-C3ge01DK.js +1 -0
- package/assets/{index-C44gqDSI.js → index-COLU2y0-.js} +1 -1
- package/assets/index-Ca6ZI10M.js +1 -0
- package/assets/index-CpzmW4H6.js +1 -0
- package/assets/index-DLln0xg-.js +1 -0
- package/assets/{index-BgsHJXrW.js → index-J89guRVU.js} +4 -4
- package/assets/index-Ncy8w6TK.js +1 -0
- package/assets/index-UrdBJAzT.js +1 -0
- package/assets/{kbd-o1nflZRu.js → kbd-CKw25IK5.js} +1 -1
- package/assets/{labels-DHP_zjK4.js → labels-CfHv29D2.js} +1 -1
- package/assets/{mail-Szc-p5g3.js → mail-5fD0jufv.js} +1 -1
- package/assets/{mail-xjJzF7Ec.js → mail-Daw23XZE.js} +1 -1
- package/assets/{menu-B7ZT3hES.js → menu-lOydIsUw.js} +1 -1
- package/assets/minus-oqpCotLr.js +1 -0
- package/assets/{new-DHxq4krb.js → new-Bx8aW3eQ.js} +1 -1
- package/assets/onboarding-CeRgXqq1.js +1 -0
- package/assets/{onboarding-completion-DIPuDK0D.js → onboarding-completion-Dyuup5X9.js} +1 -1
- package/assets/outbox-ughpF9_W.js +1 -0
- package/assets/{pane-header-BCtLNcGD.js → pane-header-CKSUzAfS.js} +1 -1
- package/assets/{pencil-BDdwSTNF.js → pencil-mpUWk0sq.js} +1 -1
- package/assets/{popover-menu-DH1B01dU.js → popover-menu-Cl-N1YPe.js} +1 -1
- package/assets/{refresh-cw-DmMLGyvw.js → refresh-cw-D2y2CKsF.js} +1 -1
- package/assets/{rich-text-DEvS7fTK.js → rich-text-D3O6tZw_.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-BKBVX-2v.js → rich-text-spellcheck-worker-provider-DrY6X3cn.js} +1 -1
- package/assets/{rotate-ccw-BzTXXy6H.js → rotate-ccw-86rVy6Oh.js} +1 -1
- package/assets/{roving-focus-D8ieiood.js → roving-focus-CzTCkI7v.js} +1 -1
- package/assets/{row-actions-d4_6b5VY.js → row-actions-C0iitOlE.js} +1 -1
- package/assets/{search-mirror-wk9khC5m.js → search-mirror-BlS_Ifso.js} +1 -1
- package/assets/{search-token-index-CrVbBlms.js → search-token-index-BXCXhECA.js} +1 -1
- package/assets/{sections-CgVZgQC0.js → sections-CmVNNIn5.js} +1 -1
- package/assets/{senders-mxAKZ_FE.js → senders-D9KOa6tO.js} +1 -1
- package/assets/settings-CGcDDxqi.js +1 -0
- package/assets/{settings-screen-Bsl0UC9v.js → settings-screen-CPKUaFTz.js} +1 -1
- package/assets/{shield-check-CUjnaEJM.js → shield-check-Bz65Alvp.js} +1 -1
- package/assets/{suggested-vips-BENsVw__.js → suggested-vips-jAg1lHBx.js} +1 -1
- package/assets/{undo-2-QAbYZsVP.js → undo-2-C5A6ikAQ.js} +1 -1
- package/assets/{useCalendarData-J9M1uPwl.js → useCalendarData-Di1HMX87.js} +1 -1
- package/assets/{useCalendarWrites-CMxbq1Ns.js → useCalendarWrites-B_iDGi_d.js} +1 -1
- package/assets/{useCalendars-DEAe0d5P.js → useCalendars-Du8oLBQy.js} +1 -1
- package/assets/{useDebouncedValue-CypIbLxd.js → useDebouncedValue-Cyjl5fcM.js} +1 -1
- package/assets/{useFilters-Cv87jtMp.js → useFilters-Dn74lJWT.js} +1 -1
- package/assets/{useLabels-B74FIyrh.js → useLabels-Bhad46sq.js} +1 -1
- package/assets/{useLayoutTier-BnLQZtW5.js → useLayoutTier-I-ZeE96x.js} +1 -1
- package/assets/{useMessageBodyContent-QMy924K4.js → useMessageBodyContent-Bl5Y6AAH.js} +1 -1
- package/assets/{useQueries-DBc1JIwH.js → useQueries-Ch9XYsKm.js} +1 -1
- package/assets/{useRefreshControl-DNtJwW7i.js → useRefreshControl-sKR2_udi.js} +1 -1
- package/assets/{useResultFolderIndex-BeXuylki.js → useResultFolderIndex-CizpN02R.js} +1 -1
- package/assets/{useSearchTokenContext-_mPqHIqE.js → useSearchTokenContext-Dl9jDzQw.js} +1 -1
- package/assets/{useSemanticSearch-JUvleuzy.js → useSemanticSearch-NkagUfNs.js} +1 -1
- package/assets/{useSignature-_lI__r_z.js → useSignature-z9_OAiTD.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/MailListHeader-D8dncvLk.js +0 -7
- package/assets/_calendarObjectId-D9_7PYZI.js +0 -1
- package/assets/_mailboxId-BuhgZ4EU.js +0 -1
- package/assets/_messageId-BoJ0kGms.js +0 -1
- package/assets/_messageId-BtCpeBln.js +0 -1
- package/assets/_messageId-sDYnK_ny.js +0 -1
- package/assets/_outboxMessageId-DnZaclF5.js +0 -1
- package/assets/_recurrenceId-75JuQikX.js +0 -1
- package/assets/_threadId-DQ7XFMjK.js +0 -1
- package/assets/_threadId-Dj_Z5hNe.js +0 -1
- package/assets/_threadId-E1Ji1VBb.js +0 -1
- package/assets/brief-3daIc_U_.js +0 -1
- package/assets/calendar-suggestion-f9IkXHda.js +0 -1
- package/assets/chevron-left-CyT8rYCK.js +0 -1
- package/assets/compose._-_outboxMessageId_-Bx07nXWx.js +0 -1
- package/assets/compose._-_outboxMessageId_-BxSDuFqr.js +0 -1
- package/assets/compose._-_outboxMessageId_-Dskdpi6-.js +0 -1
- package/assets/compose._-_outboxMessageId_-f_gWZERZ.js +0 -1
- package/assets/flagged-BZt2fsuR.js +0 -1
- package/assets/index-BS7Corg7.js +0 -1
- package/assets/index-BbW12rrk.js +0 -1
- package/assets/index-BtCpeBln.js +0 -1
- package/assets/index-C1YxhEeX.js +0 -1
- package/assets/index-CB6Q9Qtt.js +0 -1
- package/assets/index-CTeWdcpn.js +0 -1
- package/assets/index-CWfcTzfZ.js +0 -1
- package/assets/index-Dt3c3MCO.js +0 -1
- package/assets/index-sDYnK_ny.js +0 -1
- package/assets/minus-BD2hQqDO.js +0 -1
- package/assets/onboarding-CdkmnzTh.js +0 -1
- package/assets/outbox-BeQ7n9ml.js +0 -1
- package/assets/settings-Gkdms0mB.js +0 -1
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{as as Ps,d7 as _r,r as c,e as ce,j as s,_ as Ke,$ as Fs,L as sa,t as F,a0 as Ur,g as we,d8 as Br,d9 as na,da as aa,db as Wt,a7 as Kr,f as H,X as Xe,a3 as vt,aB as Gt,Y as Hr,b9 as qr,d6 as Vt,dc as ra,Z as et,dd as Qr,de as Wr,df as Gr,W as Ze,dg as oa,bJ as Ds,dh as Vr,bs as Yr,di as Jr,dj as Xr,dk as ia,aM as Zr,dl as eo,B as la,dm as to,dn as so,dp as no,dq as ao,dr as ro,ds as oo,w as io,c as se,d as tt,K as yt,dt as lo,du as co,dv as Yt,h as me,at as ve,i as ge,E as Ee,F as Re,Q as kt,cy as Me,dw as Jt,dx as pt,aJ as uo,dy as jt,dz as Ae,dA as wt,dB as Ct,dC as Nt,dD as fo,dE as mo,dF as rn,cE as po,s as ca,dG as ho,dH as go,dI as xo,b6 as bo,cp as vo,G as Xt,cZ as da,c_ as yo,dJ as ko,bq as Os,bt as ua,bn as fa,bu as ma,bv as pa,bw as jo,aH as ha,aI as ga,cN as wo,dK as Co,ab as xa,cM as No,dL as ht,dM as So,dN as To,bf as ba,dO as Io,dP as va,dQ as Eo,d3 as Ro,H as ya,bR as zs,dR as Mo,cP as st,dS as on,dT as ka,bT as Ao,dU as ms,dV as $o,bS as Lo,S as Po,q as Fo,ah as ja,J as Do,dW as Oo,dX as zo,dY as _o,d2 as ln,bD as Uo,dZ as Bo,d_ as Ko,av as Ho,cR as qo,d0 as Qo,d$ as Wo,ai as Go,d1 as Vo,e0 as Yo,e1 as Jo,e2 as Xo,e3 as Zo,C as St,e4 as ei,e5 as ti,e6 as cn,e7 as si,e8 as ni,e9 as ai,ea as ri,v as wa,d5 as oi,eb as _s,ec as ii,ed as li,cq as ci,cn as di,ee as ui,bU as fi,ef as Ca,cr as mi}from"./index-BgsHJXrW.js";import{u as pi,L as hi,a as gi}from"./roving-focus-D8ieiood.js";import{j as xi,S as Na,f as bi,a as vi,t as dt,c as yi,k as ki,l as ji,m as wi,u as Ci}from"./search-token-index-CrVbBlms.js";import{K as Ni}from"./kbd-o1nflZRu.js";import{c as Sa,P as Si,E as Ti}from"./popover-menu-DH1B01dU.js";import{M as Ii}from"./mail-xjJzF7Ec.js";import{A as gt}from"./avatar-OJww5F3k.js";import{M as Ei,a as Ri,b as Ta,c as Mi,s as Ia,d as Ea,e as Ai,f as $i,S as dn,g as Ra,u as Ma,p as Li,r as Pi}from"./useSearchTokenContext-_mPqHIqE.js";import{P as Zt,f as Fi,C as Di,D as Ve,s as Oi,u as zi}from"./index-CEJMvVKP.js";import{E as Aa}from"./EmptyState-haDMp8Ar.js";import{E as Be}from"./ErrorState-CmLGalXf.js";import{U as _i}from"./undo-2-QAbYZsVP.js";import{D as Ui}from"./download-CExFNT5m.js";import{g as Bi}from"./useMessageBodyContent-QMy924K4.js";import{m as ws,s as Ki,n as Hi,Z as qi,E as Qi,C as Wi,y as Gi,x as Vi,p as Yi,z as Ji,A as un,B as Xi,u as Zi,D as el,q as fn,F as tl,G as sl,t as nl,H as al,v as rl}from"./calendar-suggestion-f9IkXHda.js";import{c as ol,t as il,v as ll,x as cl,y as mn}from"./calendar-format-CwRw4RDu.js";import{R as dl}from"./attendee-row-DMe42k7H.js";import{C as ul}from"./calendar-clash-strip-Do_J9SgJ.js";import{C as $a}from"./clock-BBpIdhnS.js";import{M as fl,c as ml}from"./calendar-report-DMvb9Sqg.js";import{B as La}from"./bell-off-JyhxJiJh.js";import{C as pl}from"./copy-BFnJYo3G.js";import{S as hl,C as Pa}from"./shield-check-CUjnaEJM.js";import{u as gl,a as xl,i as bl,t as vl,d as yl,r as kl}from"./useCalendars-DEAe0d5P.js";import{u as Fa}from"./useDebouncedValue-CypIbLxd.js";import{j as pn,u as jl,a as wl,k as Cl,n as Nl,o as Sl,l as Tl,m as Il,S as El}from"./useFilters-Cv87jtMp.js";import{u as Us}from"./useQueries-DBc1JIwH.js";import{C as Rl}from"./checkbox-SlSTA73y.js";import{C as Pt}from"./confirm-dialog-DqUyGPYb.js";import{u as Ml,i as Al}from"./useLayoutTier-BnLQZtW5.js";import{r as $l,a as Ll}from"./search-scope-B5-OK3Cq.js";import{M as Pl}from"./menu-B7ZT3hES.js";function xt(e){if(Fl())e.focus({preventScroll:!0});else{let t=Dl(e);e.focus(),Ol(t)}}let Ft=null;function Fl(){if(Ft==null){Ft=!1;try{document.createElement("div").focus({get preventScroll(){return Ft=!0,!0}})}catch{}}return Ft}function Dl(e){let t=e.parentNode,n=[],a=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==a;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return a instanceof HTMLElement&&n.push({element:a,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft}),n}function Ol(e){for(let{element:t,scrollTop:n,scrollLeft:a}of e)t.scrollTop=n,t.scrollLeft=a}const Te=e=>e?.ownerDocument??document,Ie=e=>e&&"window"in e&&e.window===e?e:Te(e).defaultView||window;function zl(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function _l(e){return zl(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Ul=!1;function Da(){return Ul}function xe(e,t){if(!Da())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:_l(n)?n=n.host:n=n.parentNode}return!1}function ne(e){if(Da()&&e.target instanceof Element&&e.target.shadowRoot){if("composedPath"in e)return e.composedPath()[0]??null;if("composedPath"in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}const Bl=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Kl(e){const t=Ie(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:a}=e.style,r=n!=="none"&&a!=="hidden"&&a!=="collapse";if(r){const{getComputedStyle:o}=Ie(e);let{display:i,visibility:l}=o(e);r=i!=="none"&&l!=="hidden"&&l!=="collapse"}return r}function Hl(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function Oa(e,t){return Bl?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Kl(e)&&Hl(e,t)&&(!e.parentElement||Oa(e.parentElement,e))}const za=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],ql=za.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";za.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function Ql(e,t){return e.matches(ql)&&!Wl(e)&&(t?.skipVisibilityCheck||Oa(e))}function Wl(e){let t=e;for(;t!=null;){if(t instanceof Ie(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Bs=typeof document<"u"?Ps.useLayoutEffect:()=>{};function Gl(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Vl(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Yl(e){for(;e&&!Ql(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=Ie(e),n=t.document.activeElement;if(!n||n===e)return;let a=!1,r=h=>{(ne(h)===n||a)&&h.stopImmediatePropagation()},o=h=>{(ne(h)===n||a)&&(h.stopImmediatePropagation(),!e&&!a&&(a=!0,xt(n),f()))},i=h=>{(ne(h)===e||a)&&h.stopImmediatePropagation()},l=h=>{(ne(h)===e||a)&&(h.stopImmediatePropagation(),a||(a=!0,xt(n),f()))};t.addEventListener("blur",r,!0),t.addEventListener("focusout",o,!0),t.addEventListener("focusin",l,!0),t.addEventListener("focus",i,!0);let f=()=>{cancelAnimationFrame(b),t.removeEventListener("blur",r,!0),t.removeEventListener("focusout",o,!0),t.removeEventListener("focusin",l,!0),t.removeEventListener("focus",i,!0),a=!1},b=requestAnimationFrame(f);return f}function es(e){if(typeof window>"u"||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function Ks(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function $e(e){let t=null;return()=>(t==null&&(t=e()),t)}const Kt=$e(function(){return Ks(/^Mac/i)}),Jl=$e(function(){return Ks(/^iPhone/i)}),_a=$e(function(){return Ks(/^iPad/i)||Kt()&&navigator.maxTouchPoints>1}),Ua=$e(function(){return Jl()||_a()}),Xl=$e(function(){return es(/AppleWebKit/i)&&!Zl()}),Zl=$e(function(){return es(/Chrome/i)}),Ba=$e(function(){return es(/Android/i)}),ec=$e(function(){return es(/Firefox/i)});function tc(e){return e.pointerType===""&&e.isTrusted?!0:Ba()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function sc(e){return!Ba()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function bt(e,t,n=!0){let{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}=t;ec()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(Kt()?a=!0:r=!0);let l=Xl()&&Kt()&&!_a()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:a,ctrlKey:r,altKey:o,shiftKey:i}):new MouseEvent("click",{metaKey:a,ctrlKey:r,altKey:o,shiftKey:i,detail:1,bubbles:!0,cancelable:!0});bt.isOpening=n,xt(e),e.dispatchEvent(l),bt.isOpening=!1}bt.isOpening=!1;let Se=new Map,Cs=new Set;function hn(){if(typeof window>"u")return;function e(a){return"propertyName"in a}let t=a=>{let r=ne(a);if(!e(a)||!r)return;let o=Se.get(r);o||(o=new Set,Se.set(r,o),r.addEventListener("transitioncancel",n,{once:!0})),o.add(a.propertyName)},n=a=>{let r=ne(a);if(!e(a)||!r)return;let o=Se.get(r);if(o&&(o.delete(a.propertyName),o.size===0&&(r.removeEventListener("transitioncancel",n),Se.delete(r)),Se.size===0)){for(let i of Cs)i();Cs.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",n)}typeof document<"u"&&(document.readyState!=="loading"?hn():document.addEventListener("DOMContentLoaded",hn));function nc(){for(const[e]of Se)"isConnected"in e&&!e.isConnected&&Se.delete(e)}function ac(e){requestAnimationFrame(()=>{nc(),Se.size===0?e():Cs.add(e)})}function Ka(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}let Ns=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{Ns.delete(e)});function rc(e,t){if(e===t)return e;let n=Ns.get(e);if(n)return n.forEach(r=>r.current=t),t;let a=Ns.get(t);return a?(a.forEach(r=>r.current=e),e):t}function oc(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1;const a=e.map(r=>{const o=gn(r,t);return n||=typeof o=="function",o});if(n)return()=>{a.forEach((r,o)=>{typeof r=="function"?r():gn(e[o],null)})}}}function gn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Tt(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let a=e[n];for(let r in a){let o=t[r],i=a[r];typeof o=="function"&&typeof i=="function"&&r[0]==="o"&&r[1]==="n"&&r.charCodeAt(2)>=65&&r.charCodeAt(2)<=90?t[r]=Ka(o,i):(r==="className"||r==="UNSAFE_className")&&typeof o=="string"&&typeof i=="string"?t[r]=_r(o,i):r==="id"&&o&&i?t.id=rc(o,i):r==="ref"&&o&&i?t.ref=oc(o,i):t[r]=i!==void 0?i:o}}return t}function ic(e,t){Bs(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}const lc=Ps.useInsertionEffect??Bs;function ps(e){const t=c.useRef(null);return lc(()=>{t.current=e},[e]),c.useCallback((...n)=>{const a=t.current;return a?.(...n)},[])}let Ye="default",Ss="",Bt=new WeakMap;function cc(e){if(Ua()){if(Ye==="default"){const t=Te(e);Ss=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}Ye="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";Bt.set(e,e.style[t]),e.style[t]="none"}}function xn(e){if(Ua()){if(Ye!=="disabled")return;Ye="restoring",setTimeout(()=>{ac(()=>{if(Ye==="restoring"){const t=Te(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=Ss||""),Ss="",Ye="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Bt.has(e)){let t=Bt.get(e),n="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[n]==="none"&&(e.style[n]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),Bt.delete(e)}}function bn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let hs=new WeakMap;function dc(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return bn(t);if(hs.has(t))return hs.get(t);let n=t.querySelector('meta[property="csp-nonce"]'),a=n&&n instanceof Ie(n).HTMLMetaElement&&(n.nonce||n.content)||bn(t)||void 0;return a!==void 0&&hs.set(t,a),a}const Ha=Ps.createContext({register:()=>{}});Ha.displayName="PressResponderContext";function qa(){let e=c.useRef(new Map),t=c.useCallback((r,o,i,l)=>{let f=l?.once?(...b)=>{e.current.delete(i),i(...b)}:i;e.current.set(i,{type:o,eventTarget:r,fn:f,options:l}),r.addEventListener(o,f,l)},[]),n=c.useCallback((r,o,i,l)=>{let f=e.current.get(i)?.fn||i;r.removeEventListener(o,f,l),e.current.delete(i)},[]),a=c.useCallback(()=>{e.current.forEach((r,o)=>{n(r.eventTarget,r.type,o,r.options)})},[n]);return c.useEffect(()=>a,[a]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:a}}function uc(e){let t=c.useContext(Ha);if(t){let{register:n,ref:a,...r}=t;e=Tt(r,e),n()}return ic(t,e.ref),e}class Dt{#e;constructor(t,n,a,r){this.#e=!0;const i=(r?.target??a.currentTarget)?.getBoundingClientRect();let l,f=0,b,h=null;a.clientX!=null&&a.clientY!=null&&(b=a.clientX,h=a.clientY),i&&(b!=null&&h!=null?(l=b-i.left,f=h-i.top):(l=i.width/2,f=i.height/2)),this.type=t,this.pointerType=n,this.target=a.currentTarget,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.x=l,this.y=f,this.key=a.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const vn=Symbol("linkClicked"),yn="react-aria-pressable-style",kn="data-react-aria-pressable";function fc(e){let{onPress:t,onPressChange:n,onPressStart:a,onPressEnd:r,onPressUp:o,onClick:i,isDisabled:l,isPressed:f,preventFocusOnPress:b,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:y,ref:p,...v}=uc(e),[m,u]=c.useState(!1),d=c.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:g,removeAllGlobalListeners:k}=qa(),x=c.useCallback((j,A)=>{let z=d.current;if(l||z.didFirePressStart)return!1;let N=!0;if(z.isTriggeringEvent=!0,a){let L=new Dt("pressstart",A,j);a(L),N=L.shouldStopPropagation}return n&&n(!0),z.isTriggeringEvent=!1,z.didFirePressStart=!0,u(!0),N},[l,a,n]),w=c.useCallback((j,A,z=!0)=>{let N=d.current;if(!N.didFirePressStart)return!1;N.didFirePressStart=!1,N.isTriggeringEvent=!0;let L=!0;if(r){let S=new Dt("pressend",A,j);r(S),L=S.shouldStopPropagation}if(n&&n(!1),u(!1),t&&z&&!l){let S=new Dt("press",A,j);t(S),L&&=S.shouldStopPropagation}return N.isTriggeringEvent=!1,L},[l,r,n,t]),C=ps(w),I=c.useCallback((j,A)=>{let z=d.current;if(l)return!1;if(o){z.isTriggeringEvent=!0;let N=new Dt("pressup",A,j);return o(N),z.isTriggeringEvent=!1,N.shouldStopPropagation}return!0},[l,o]),M=ps(I),E=c.useCallback(j=>{let A=d.current;if(A.isPressed&&A.target){A.didFirePressStart&&A.pointerType!=null&&w(Ue(A.target,j),A.pointerType,!1),A.isPressed=!1,A.isOverTarget=!1,A.activePointerId=null,A.pointerType=null,k(),y||xn(A.target);for(let z of A.disposables)z();A.disposables=[]}},[y,k,w]),T=ps(E);c.useEffect(()=>{l&&d.current.isPressed&&T({currentTarget:d.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[l]);let P=c.useCallback(j=>{h&&E(j)},[h,E]),$=c.useCallback(j=>{l||i?.(j)},[l,i]),K=c.useCallback((j,A)=>{if(!l&&i){let z=new MouseEvent("click",j);Vl(z,A),i(Gl(z))}},[l,i]),O=c.useMemo(()=>{let j=d.current,A={onKeyDown(N){if(gs(N.nativeEvent,N.currentTarget)&&xe(N.currentTarget,ne(N))){jn(ne(N),N.key)&&N.preventDefault();let L=!0;!j.isPressed&&!N.repeat&&(j.target=N.currentTarget,j.isPressed=!0,j.pointerType="keyboard",L=x(N,"keyboard"));let S=N.currentTarget,_=B=>{gs(B,S)&&!B.repeat&&xe(S,ne(B))&&j.target&&M(Ue(j.target,B),"keyboard")};g(Te(N.currentTarget),"keyup",Ka(_,z),!0),L&&N.stopPropagation(),N.metaKey&&Kt()&&j.metaKeyEvents?.set(N.key,N.nativeEvent)}else N.key==="Meta"&&(j.metaKeyEvents=new Map)},onClick(N){if(!(N&&!xe(N.currentTarget,ne(N)))&&N&&N.button===0&&!j.isTriggeringEvent&&!bt.isOpening){let L=!0;if(l&&N.preventDefault(),!j.ignoreEmulatedMouseEvents&&!j.isPressed&&(j.pointerType==="virtual"||tc(N.nativeEvent))){let S=x(N,"virtual"),_=M(N,"virtual"),B=C(N,"virtual");$(N),L=S&&_&&B}else if(j.isPressed&&j.pointerType!=="keyboard"){let S=j.pointerType||N.nativeEvent.pointerType||"virtual",_=M(Ue(N.currentTarget,N),S),B=C(Ue(N.currentTarget,N),S,!0);L=_&&B,j.isOverTarget=!1,$(N),T(N)}j.ignoreEmulatedMouseEvents=!1,L&&N.stopPropagation()}}},z=N=>{if(j.isPressed&&j.target&&gs(N,j.target)){jn(ne(N),N.key)&&N.preventDefault();let L=ne(N),S=xe(j.target,L);C(Ue(j.target,N),"keyboard",S),S&&K(N,j.target),k(),N.key!=="Enter"&&Hs(j.target)&&xe(j.target,L)&&!N[vn]&&(N[vn]=!0,bt(j.target,N,!1)),j.isPressed=!1,j.metaKeyEvents?.delete(N.key)}else if(N.key==="Meta"&&j.metaKeyEvents?.size){let L=j.metaKeyEvents;j.metaKeyEvents=void 0;for(let S of L.values())j.target?.dispatchEvent(new KeyboardEvent("keyup",S))}};if(typeof PointerEvent<"u"){A.onPointerDown=S=>{if(S.button!==0||!xe(S.currentTarget,ne(S)))return;if(sc(S.nativeEvent)){j.pointerType="virtual";return}j.pointerType=S.pointerType;let _=!0;if(!j.isPressed){j.isPressed=!0,j.isOverTarget=!0,j.activePointerId=S.pointerId,j.target=S.currentTarget,y||cc(j.target),_=x(S,j.pointerType);let B=ne(S);"releasePointerCapture"in B&&("hasPointerCapture"in B?B.hasPointerCapture(S.pointerId)&&B.releasePointerCapture(S.pointerId):B.releasePointerCapture(S.pointerId)),g(Te(S.currentTarget),"pointerup",N,!1),g(Te(S.currentTarget),"pointercancel",L,!1)}_&&S.stopPropagation()},A.onMouseDown=S=>{if(xe(S.currentTarget,ne(S))&&S.button===0){if(b){let _=Yl(S.target);_&&j.disposables.push(_)}S.stopPropagation()}},A.onPointerUp=S=>{!xe(S.currentTarget,ne(S))||j.pointerType==="virtual"||S.button===0&&!j.isPressed&&M(S,j.pointerType||S.pointerType)},A.onPointerEnter=S=>{S.pointerId===j.activePointerId&&j.target&&!j.isOverTarget&&j.pointerType!=null&&(j.isOverTarget=!0,x(Ue(j.target,S),j.pointerType))},A.onPointerLeave=S=>{S.pointerId===j.activePointerId&&j.target&&j.isOverTarget&&j.pointerType!=null&&(j.isOverTarget=!1,C(Ue(j.target,S),j.pointerType,!1),P(S))};let N=S=>{if(S.pointerId===j.activePointerId&&j.isPressed&&S.button===0&&j.target){if(xe(j.target,ne(S))&&j.pointerType!=null){let _=!1,B=setTimeout(()=>{j.isPressed&&j.target instanceof HTMLElement&&(_?T(S):(xt(j.target),j.target.click()))},80);g(S.currentTarget,"click",()=>_=!0,!0),j.disposables.push(()=>clearTimeout(B))}else T(S);j.isOverTarget=!1}},L=S=>{T(S)};A.onDragStart=S=>{xe(S.currentTarget,ne(S))&&T(S)}}return A},[g,l,b,k,y,P,x,$,K]);return c.useEffect(()=>{if(!p)return;const j=Te(p.current);if(!j||!j.head||j.getElementById(yn))return;const A=j.createElement("style");A.id=yn;let z=dc(j);z&&(A.nonce=z),A.textContent=`
|
|
2
|
-
@layer {
|
|
3
|
-
[${kn}] {
|
|
4
|
-
touch-action: pan-x pan-y pinch-zoom;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
`.trim(),j.head.prepend(A)},[p]),c.useEffect(()=>{let j=d.current;return()=>{y||xn(j.target??void 0);for(let A of j.disposables)A();j.disposables=[]}},[y]),{isPressed:f||m,pressProps:Tt(v,O,{[kn]:!0})}}function Hs(e){return e.tagName==="A"&&e.hasAttribute("href")}function gs(e,t){const{key:n,code:a}=e,r=t,o=r.getAttribute("role");return(n==="Enter"||n===" "||n==="Spacebar"||a==="Space")&&!(r instanceof Ie(r).HTMLInputElement&&!Qa(r,n)||r instanceof Ie(r).HTMLTextAreaElement||r.isContentEditable)&&!((o==="link"||!o&&Hs(r))&&n!=="Enter")}function Ue(e,t){let n=t.clientX,a=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:a,key:t.key}}function mc(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!=="submit"&&e.type!=="reset":!Hs(e)}function jn(e,t){return e instanceof HTMLInputElement?!Qa(e,t):mc(e)}const pc=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Qa(e,t){return e.type==="checkbox"||e.type==="radio"?t===" ":pc.has(e.type)}let hc=0;const xs=new Map;function gc(e){let[t,n]=c.useState();return Bs(()=>{if(!e)return;let a=xs.get(e);if(a)n(a.element.id);else{let r=`react-aria-description-${hc++}`;n(r);let o=document.createElement("div");o.id=r,o.style.display="none",o.textContent=e,document.body.appendChild(o),a={refCount:0,element:o},xs.set(e,a)}return a.refCount++,()=>{a&&--a.refCount===0&&(a.element.remove(),xs.delete(e))}},[e]),{"aria-describedby":e?t:void 0}}const xc=500;function bc(e){let{isDisabled:t,onLongPressStart:n,onLongPressEnd:a,onLongPress:r,threshold:o=xc,accessibilityDescription:i}=e;const l=c.useRef(void 0);let{addGlobalListener:f,removeGlobalListener:b}=qa(),{pressProps:h}=fc({isDisabled:t,onPressStart(p){if(p.continuePropagation(),(p.pointerType==="mouse"||p.pointerType==="touch")&&(n&&n({...p,type:"longpressstart"}),l.current=setTimeout(()=>{p.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),Te(p.target).activeElement!==p.target&&xt(p.target),r&&r({...p,type:"longpress"}),l.current=void 0},o),p.pointerType==="touch")){let v=u=>{u.preventDefault()},m=Ie(p.target);f(p.target,"contextmenu",v,{once:!0}),f(m,"pointerup",()=>{setTimeout(()=>{b(p.target,"contextmenu",v)},30)},{once:!0})}},onPressEnd(p){l.current&&clearTimeout(l.current),a&&(p.pointerType==="mouse"||p.pointerType==="touch")&&a({...p,type:"longpressend"})}}),y=gc(r&&!t?i:void 0);return{longPressProps:Tt(h,y)}}const ts=ce("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const vc=ce("Calendar",[["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"}]]);const yc=ce("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);const Wa=ce("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const Ga=ce("Forward",[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]);const kc=ce("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const jc=ce("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);const qs=ce("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);const Va=ce("ReplyAll",[["polyline",{points:"7 17 2 12 7 7",key:"t83bqg"}],["polyline",{points:"12 17 7 12 12 7",key:"1g4ajm"}],["path",{d:"M22 18v-2a4 4 0 0 0-4-4H7",key:"1fcyog"}]]);const Ya=ce("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);const nt=ce("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);const wc=ce("ShieldQuestion",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Cc=ce("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);const Nc=ce("TextSearch",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]),Sc=({address:e,showTrustedBadge:t=!1})=>{const n=t?s.jsx(ts,{className:"inline-block size-4 ml-1 -mt-0.5 text-positive","aria-label":"Trusted sender","data-testid":"trusted-sender-badge"}):null;return e.displayName?s.jsxs("span",{children:[s.jsx("span",{className:"text-fg",children:e.displayName}),s.jsxs("span",{className:"text-fg-muted",children:[" ","<",e.normalizedEmail,">"]}),n]}):s.jsxs("span",{className:"text-fg",children:[e.normalizedEmail,n]})},Tc=({label:e,addresses:t,showTrustedBadge:n=!1})=>{const[a,r]=c.useState(!1);if(t.length===0)return null;const o=t.length>3,i=l=>{const f=n&&l.flags?.trusted?.value===!0;return s.jsx(Sc,{address:l,showTrustedBadge:f})};return s.jsxs("div",{className:"flex gap-2 text-sm",children:[s.jsxs("span",{className:"text-fg-muted shrink-0 w-12",children:[e,":"]}),s.jsx("div",{className:"flex-1 min-w-0",children:a?s.jsx("div",{className:"flex flex-wrap gap-1",children:t.map((l,f)=>s.jsxs("span",{children:[i(l),f<t.length-1&&", "]},f))}):s.jsx("div",{className:"truncate",children:t.map((l,f)=>s.jsxs("span",{children:[i(l),f<t.length-1&&", "]},f))})}),o&&s.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),r(!a)},className:"shrink-0 text-fg-muted hover:text-fg transition-colors","aria-label":a?"Collapse":"Expand",children:a?s.jsx(Ke,{className:"h-4 w-4"}):s.jsx(Fs,{className:"h-4 w-4"})})]})};function Ic({state:e,onRetry:t}){return s.jsxs("div",{role:"alert","data-testid":"attachment-error",className:"flex items-start gap-2 border-t border-danger/30 bg-danger-soft px-2 py-2 text-xs",children:[s.jsx(Ur,{className:"mt-0.5 size-3.5 shrink-0 text-danger","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium text-danger",children:e.title}),s.jsx("p",{className:"mt-0.5 text-fg-muted",children:e.detail})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s.jsx("button",{type:"button",onClick:t,className:"font-medium text-accent hover:underline",children:"Try again"}),e.reportUrl&&s.jsx("a",{href:e.reportUrl,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report this"})]})]})}function Ec({attachments:e,onDownload:t,hasUnlistedAttachment:n=!1,className:a}){return e.length===0&&!n?null:s.jsxs("section",{"aria-label":"Attachments","data-testid":"attachment-list",className:F("space-y-1.5",a),children:[s.jsxs("h3",{className:"flex items-center gap-1.5 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:[s.jsx(Zt,{className:"size-3","aria-hidden":!0}),e.length===0?"Attachment":e.length===1?"1 attachment":`${e.length} attachments`]}),e.length>0&&s.jsx("ul",{className:"overflow-hidden rounded-sm border border-line bg-surface",children:e.map(r=>{const o=r.download.status==="downloading";return s.jsxs("li",{className:"border-t border-line first:border-t-0",children:[s.jsxs("button",{type:"button",onClick:()=>t(r.attachmentId),disabled:o,"data-testid":"attachment-download","aria-label":`Download ${r.filename}`,className:"flex w-full items-center gap-2 px-2 py-2 text-left transition-colors hover:bg-surface-sunken disabled:cursor-progress disabled:opacity-60",children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("bdi",{className:"block truncate text-sm text-fg",title:r.filename,children:r.filename}),s.jsxs("span",{className:"block truncate text-2xs text-fg-subtle",children:[r.typeLabel," ·"," ",Fi(r.sizeOctets)]})]}),o?s.jsx(sa,{className:"size-4 shrink-0 animate-spin text-fg-subtle","aria-hidden":!0}):s.jsx(Ui,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0})]}),r.download.status==="failed"&&s.jsx(Ic,{state:r.download,onRetry:()=>t(r.attachmentId)})]},r.attachmentId)})}),n&&s.jsx("p",{role:"alert","data-testid":"attachment-unlisted",className:"rounded-sm border border-line bg-surface px-2 py-2 text-xs text-fg-muted",children:"The mail server says this message carries an attachment, but none of its parts describe one. Re-sync the account from Settings; if the attachment still does not appear, the message is worth reporting."})]})}function Rc({label:e,onUndo:t,undoLabel:n="Undo",filtersHref:a,className:r}){return s.jsxs(we,{tone:"accent",className:F("py-1 text-xs",r),children:[s.jsx(_i,{className:"size-3.5 shrink-0","aria-hidden":!0}),s.jsx("span",{children:e}),t&&s.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t()},className:"font-semibold underline decoration-dotted underline-offset-2 hover:decoration-solid",children:n}),a&&s.jsx("a",{href:a,onClick:o=>{o.stopPropagation()},className:"font-semibold underline decoration-dotted underline-offset-2 hover:decoration-solid",children:"Manage filter"})]})}const wn=10,Mc={kind:"unknown"},bs=e=>e.toLocaleString();function Ac({section:e,Row:t,selectedThreadId:n,initialExpanded:a=!1,initialCollapsed:r=!1,onShowAll:o,onRetry:i,onSelectThread:l}){const[f,b]=c.useState(a),[h,y]=c.useState(r),p=e.threads,v=e.loading===!0,m=e.error===!0,u=p.length>wn,g=!f&&u?p.slice(0,wn):p,k=e.total??Mc,x=k.kind==="exact"&&(p.length>0||v)&&!m?bs(k.value):void 0,w=k.kind==="exact"?k.value>g.length:e.atCap===!0,C=o!==void 0&&g.length>0&&w?k.kind==="exact"?`Show all ${bs(k.value)}`:"Show all":void 0,I=p.length-g.length;return s.jsxs("div",{children:[e.label&&s.jsxs("button",{type:"button","data-section-header":"","aria-expanded":!h,onClick:()=>y(M=>!M),className:"sticky top-0 z-10 flex h-section-row w-full items-center gap-1.5 border-b border-line bg-surface-sunken px-row-inset text-left outline-none transition-colors hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",children:[s.jsx("span",{className:"flex-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e.label}),x!==void 0&&s.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:x}),s.jsx(Ke,{className:F("size-3 shrink-0 text-fg-subtle transition-transform duration-200",h?"rotate-0":"rotate-180")})]}),!h&&s.jsxs(s.Fragment,{children:[p.length===0?m?s.jsxs("div",{className:"flex flex-col items-center gap-1 border-b border-line px-row-inset py-4 text-center text-2xs text-danger",children:[s.jsx("span",{children:`Couldn't load ${e.label??"these messages"}`}),i&&s.jsx("button",{type:"button",onClick:i,className:"font-medium text-accent underline outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Try again"})]}):v?s.jsx("div",{className:"animate-pulse divide-y divide-line",children:[0,1,2].map(M=>s.jsx("div",{className:"px-row-inset py-3",children:s.jsx("div",{className:"h-3 w-2/3 rounded bg-surface-sunken"})},M))}):s.jsx("p",{className:"border-b border-line px-row-inset py-4 text-center text-2xs text-fg-subtle",children:e.label?`No ${e.label} mail in this brief.`:"No mail in this brief."}):s.jsx("div",{className:"divide-y divide-line",children:g.map(M=>s.jsx(t,{thread:M,active:M.id===n,onClick:()=>l?.(M.id)},M.id))}),C!==void 0?s.jsxs("button",{type:"button",onClick:o,className:"flex w-full items-center justify-center border-b border-line px-row-inset py-1.5 text-2xs font-medium text-accent outline-none transition-colors hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",children:[C,s.jsx(Fs,{className:"ml-1 size-3"})]}):u&&s.jsxs("button",{type:"button",onClick:()=>b(M=>!M),className:"flex w-full items-center justify-center border-b border-line px-row-inset py-1.5 text-2xs font-medium text-accent outline-none transition-colors hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",children:[f?"Show less":`Show ${bs(I)} more`,!f&&s.jsx(Ke,{className:"ml-1 size-3"})]})]})]})}function _p({sections:e,briefCategory:t="all",selectedThreadId:n,Row:a,keyboard:r,onSelectThread:o,onShowAllSection:i,onRetrySection:l,flat:f=!1,onSelectBriefCategory:b,sources:h,sourcesNote:y,onSelectSource:p,activeFilters:v,onToggleFilter:m,onClearFilters:u,hideChrome:d,defaultExpanded:g=!1}){const[k,x]=c.useState(g),w=c.useRef(null);pi({containerRef:w,itemSelector:hi,enabled:!Br(r)});const C=!f&&(t==="all"||e.some($=>$.total!==void 0)),I=e.filter($=>$.threads.length>0||$.total!==void 0||$.loading===!0||$.error===!0),M=e.flatMap($=>$.threads),E=aa,T=C?I.length===0:M.length===0,P=s.jsxs("div",{ref:w,children:[C?I.map($=>s.jsx(Ac,{section:$,Row:a,selectedThreadId:n,onSelectThread:o,onShowAll:i?()=>i($.id):void 0,onRetry:l?()=>l($.id):void 0},$.id)):s.jsx("div",{className:"divide-y divide-line",children:M.map($=>s.jsx(a,{thread:$,active:$.id===n,onClick:()=>o?.($.id)},$.id))}),T&&s.jsx("div",{className:"px-row-inset py-6 text-center text-2xs text-fg-subtle",children:"No threads match these filters."})]});return s.jsx(na,{categories:[...Wt],filters:E,sources:h,sourcesNote:y,selectedCategory:t,activeFilters:v,expanded:k,onExpandedChange:x,onSelectCategory:$=>b?.($),onSelectSource:p,onToggleFilter:$=>m($),onClear:u,hideChrome:d,children:P})}const $c={ics:"Attached invitation",markup:"Structured markup",pattern:"Read from the words"},Lc={ics:Kr,markup:yc,pattern:Nc},Pc={ics:"border-positive/50 text-positive",markup:"border-accent-2/50 text-accent-2",pattern:"border-warning/50 text-warning"};function Fc({method:e,className:t}){const n=Lc[e];return s.jsxs("span",{className:F("inline-flex items-center gap-1 rounded-sm border px-1.5 py-0.5 text-2xs font-medium",Pc[e],t),children:[s.jsx(n,{className:"size-3","aria-hidden":!0}),$c[e]]})}const Dc=["accepted","tentative","declined","noReply"],Oc={accepted:"coming",tentative:"maybe",declined:"not coming",noReply:"no reply"};function zc({invite:e,whenText:t,calendarName:n,color:a,clashes:r,rsvp:o,onAdd:i,onTentative:l,onDecline:f,onReopen:b,onOfferOtherTimes:h,mute:y,onRemove:p,onOpenNewer:v,guests:m,busy:u=!1,failure:d="",reportHref:g,addBlocked:k,touch:x,className:w}){const C=ol(a),I=e.state==="superseded"||e.state==="cancelled",M=e.proposed.attendees,E=Dc.map(T=>({state:T,count:M.filter(P=>P.rsvp===T).length})).filter(T=>T.count>0).map(T=>`${T.count} ${Oc[T.state]}`).join(" · ");return s.jsxs("section",{className:F("flex flex-col gap-3 rounded-lg border border-line bg-surface-raised p-3",w),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:F("size-2.5 shrink-0 rounded-full",C.solid)}),s.jsxs("span",{className:"min-w-0 flex-1 truncate text-2xs uppercase tracking-wider text-fg-subtle",children:["Invitation from ",e.organizerName," · ",n]}),s.jsx(Fc,{method:e.method})]}),s.jsxs("div",{className:F(I&&"opacity-60"),children:[s.jsx("h3",{className:"text-md font-semibold text-fg",children:e.proposed.title}),s.jsxs("p",{className:"mt-1 flex items-center gap-2 text-sm text-fg",children:[s.jsx($a,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),t]}),e.proposed.location!==""&&s.jsxs("p",{className:"mt-1 flex items-center gap-2 text-sm text-fg-muted",children:[s.jsx(fl,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.proposed.location]})]}),e.state==="superseded"&&s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-warning/40 bg-warning-soft p-2",children:[s.jsx(kc,{className:"mt-0.5 size-4 shrink-0 text-warning","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"text-xs font-semibold text-warning",children:[e.organizerName," has sent a newer version of this."]}),s.jsxs("p",{className:"mt-1 text-xs text-fg",children:["This one is revision ",e.sequence," and is out of date. The newer message carries the one to answer."]}),v&&s.jsx(H,{variant:"secondary",size:x?"md":"sm",onClick:v,className:F("mt-2",x&&"min-h-11"),children:"Open the newer invitation"})]})]}),e.state==="cancelled"&&s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft p-2",children:[s.jsx(Xe,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"text-xs font-semibold text-danger",children:[e.organizerName," cancelled this."]}),s.jsx("p",{className:"mt-1 text-xs text-fg",children:"It is still on your calendar. Nothing comes off it until you say so."}),p&&s.jsxs("div",{className:F("mt-2 flex gap-2",x&&"flex-wrap"),children:[s.jsx(H,{variant:"primary",size:x?"md":"sm",icon:s.jsx(vt,{className:"size-3.5"}),onClick:p,disabled:u||k!==void 0,className:F(x&&"min-h-11 flex-1"),children:"Remove from calendar"}),b&&s.jsx(H,{variant:"secondary",size:x?"md":"sm",onClick:b,disabled:u,className:F(x&&"min-h-11 flex-1"),children:"Keep it"})]})]})]}),!I&&s.jsx(ul,{clashes:r}),m??(M.length>0&&s.jsxs("p",{className:"text-2xs uppercase tracking-wider text-fg-subtle",children:[M.length," guests",E===""?"":` · ${E}`]})),d!==""&&s.jsx(ws,{text:d,reportHref:g}),k!==void 0&&s.jsx("div",{className:"rounded-md border border-warning/40 bg-warning-soft p-2 text-xs text-fg",children:k}),!I&&(o==="noReply"?s.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[s.jsxs("div",{className:F("flex gap-2",x&&"flex-wrap"),children:[s.jsx(H,{variant:"primary",size:x?"md":"sm",icon:s.jsx(vc,{className:"size-3.5"}),onClick:i,disabled:u||k!==void 0,className:F(x&&"min-h-11 flex-1"),children:"Add to calendar"}),l&&s.jsx(H,{variant:"secondary",size:x?"md":"sm",onClick:l,disabled:u,className:F(x&&"min-h-11 flex-1"),children:"Maybe"}),s.jsx(H,{variant:"secondary",size:x?"md":"sm",icon:s.jsx(Xe,{className:"size-3.5"}),onClick:f,disabled:u,className:F(x&&"min-h-11 flex-1"),children:"Decline"})]}),s.jsx(H,{variant:"ghost",size:x?"md":"sm",onClick:h,className:F("self-start",x&&"min-h-11 w-full"),children:"Offer other times"}),y&&s.jsx(H,{variant:"ghost",size:x?"md":"sm",icon:s.jsx(La,{className:"size-3.5"}),onClick:y.onMute,disabled:u,className:F("self-start",x&&"min-h-11 w-full"),children:`Stop offering invitations from ${y.sender}`}),s.jsxs("p",{className:"text-2xs text-fg-subtle",children:[e.organizerName," is not notified. Reader writes this to your calendar and sends no reply — tell them in the thread."]})]}):s.jsxs("div",{className:"flex flex-col gap-2 border-t border-line pt-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-fg",children:[o==="declined"?"You declined":"On your calendar",s.jsx(dl,{rsvp:o})]}),b&&s.jsx(H,{variant:"ghost",size:x?"md":"sm",onClick:b,disabled:u,className:x?"min-h-11":"",children:"Change"}),o==="declined"&&s.jsx(H,{variant:"secondary",size:x?"md":"sm",onClick:h,className:x?"min-h-11":"",children:"Offer other times"})]}),s.jsxs("p",{className:"flex items-start gap-1.5 text-2xs text-fg-subtle",children:[s.jsx(Gt,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),e.organizerName," was not notified."]})]}))]})}function _c({slots:e,picked:t,onToggle:n,emptyText:a="Nothing free that day at this length.",touch:r,scroll:o,className:i}){return e.length===0?s.jsx("p",{className:F("text-xs text-fg-muted",i),children:a}):s.jsx("div",{className:F("flex gap-2",o?"overflow-x-auto pb-1":"flex-wrap",i),children:e.map(l=>{const f=t.has(l.startTime);return s.jsxs("button",{type:"button","aria-pressed":f,onClick:()=>n(l),className:F("shrink-0 rounded-md border px-2 text-xs tabular-nums outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",r?"min-h-11 px-3":"h-7",f?"border-accent bg-accent-soft font-semibold text-accent":"border-line bg-surface text-fg-muted hover:border-line-strong hover:text-fg"),children:[l.startTime," – ",l.endTime]},l.startTime)})})}function be({label:e,children:t,className:n}){return s.jsxs("section",{className:F("border-b border-line px-row-inset py-3",n),children:[s.jsx("h3",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),s.jsx("div",{className:"mt-2",children:t})]})}function Uc({data:e,actions:t,selectedEventId:n="",touch:a,className:r}){const{invite:o,prose:i,suggestions:l,day:f,dayLabel:b,suggestionsBusy:h=!1,failure:y="",suggestionsFailure:p="",reportHref:v,addBlocked:m}=e,{onReviewSuggestion:u,onOpenThread:d}=t,[g,k]=c.useState({}),x=l[0],w=x===void 0?"":g[x.suggestion.id]??"",C=x===void 0?void 0:Ki(x.suggestion,w),I=new Set(i?.picked??[]);return y===""&&o===void 0&&i===void 0&&l.length===0&&f.length===0?s.jsxs("div",{className:F("flex flex-1 flex-col items-center justify-center gap-2 px-row-inset py-10 text-center",r),children:[s.jsx(Hr,{className:"size-6 text-fg-subtle","aria-hidden":!0}),s.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing in this message is about a time."}),s.jsx("p",{className:"text-2xs text-fg-subtle",children:"An invitation, a booking or a thread proposing hours would show up here, with the day it lands on."})]}):s.jsxs("div",{className:F("flex flex-col",r),children:[y!==""&&s.jsx(ws,{text:y,reportHref:v,className:"mx-row-inset mt-3"}),o&&s.jsx(be,{label:"Invitation",children:s.jsx(zc,{invite:o.invite,whenText:o.whenText,calendarName:o.calendarName,color:o.color,clashes:o.clashes,rsvp:o.rsvp,busy:o.busy,failure:o.failure,reportHref:o.reportHref,addBlocked:o.addBlocked,mute:t.onMuteInvite&&o.sender?{sender:o.sender,onMute:t.onMuteInvite}:void 0,onAdd:t.onAddInvite,onTentative:t.onTentativeInvite,onDecline:t.onDeclineInvite,onReopen:t.onReopenInvite,onOfferOtherTimes:t.onOfferOtherTimes,onRemove:t.onRemoveInvite,onOpenNewer:t.onOpenNewerInvite,touch:a})}),i&&s.jsxs(be,{label:i.proposals.length>0?`Times named · ${i.dayLabel}`:`Other times · ${i.dayLabel}`,children:[s.jsx("ul",{className:F("flex flex-col gap-1",i.proposals.length===0&&"hidden"),children:i.proposals.map(E=>s.jsxs("li",{className:"flex items-baseline gap-2 text-xs",children:[s.jsx("span",{className:"w-24 shrink-0 truncate tabular-nums text-fg",children:E.phrase}),E.clashTitle===""?s.jsx("span",{className:"min-w-0 flex-1 truncate text-positive",children:"Nothing booked"}):s.jsxs("span",{className:"min-w-0 flex-1 truncate text-danger",children:[E.clashTitle," is already there"]})]},E.id))}),s.jsx("p",{className:"mt-3 pb-1.5 text-2xs uppercase tracking-wider text-fg-subtle",children:"Free, half an hour each"}),s.jsx(_c,{slots:i.slots,picked:I,onToggle:t.onToggleSlot,touch:a,scroll:!0}),t.onCopySlots?s.jsxs("div",{className:"mt-2 flex flex-col gap-1.5",children:[s.jsx(H,{variant:"secondary",size:a?"md":"sm",icon:s.jsx(pl,{className:"size-3.5"}),onClick:t.onCopySlots,disabled:I.size===0,className:F("self-start",a&&"min-h-11"),children:"Copy picked times"}),i.copy==="copied"&&s.jsx("p",{role:"status",className:"text-2xs text-positive",children:"Copied. Paste them into your reply."}),i.copy==="failed"&&s.jsxs("div",{role:"alert",className:"flex flex-col gap-1",children:[s.jsx("p",{className:"text-2xs text-danger",children:"This page can't copy for you. Select the times below and copy them yourself."}),s.jsx("textarea",{readOnly:!0,"aria-label":"Picked times",value:i.copyText??"",onFocus:E=>E.currentTarget.select(),rows:2,className:"w-full resize-none rounded-md border border-line bg-surface p-1.5 text-xs text-fg"})]}),s.jsx("p",{className:"text-2xs text-fg-subtle",children:"Picked slots are copied as plain text. Nothing is booked."})]}):s.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"Picked slots go into the reply as plain text. Nothing is booked."})]}),l.length>0&&s.jsxs(be,{label:"Read out of this thread",children:[s.jsx(Hi,{hasCard:x!==void 0,remaining:l.length,blocked:C!==void 0&&!C.settled,blockedReason:qi,onConfirm:()=>{x&&C?.settled&&m===void 0&&t.onAddSuggestion(x.suggestion.id,C.timeZone)},onReject:()=>{x&&t.onDismissSuggestion(x.suggestion.id)},children:x&&s.jsx(Qi,{suggestion:x.suggestion,whenText:x.whenText,addLabel:"Add to calendar",zoneChoice:w,onZoneChoice:E=>k(T=>({...T,[x.suggestion.id]:E})),onAdd:E=>t.onAddSuggestion(x.suggestion.id,E),onReview:u&&(E=>u(x.suggestion.id,E)),onDismiss:()=>t.onDismissSuggestion(x.suggestion.id),onOpenThread:d&&(()=>d(x.suggestion.threadId)),busy:h,addBlocked:m!==void 0,touch:a})}),m!==void 0&&s.jsx("div",{className:"mt-2 rounded-md border border-warning/40 bg-warning-soft p-2 text-xs text-fg",children:m}),p!==""&&s.jsx(ws,{text:p,reportHref:v,className:"mt-2"}),s.jsx("p",{className:"mt-2 text-2xs text-fg-subtle",children:"None of this is on your calendar, and none of it will be until you say so."})]}),f.length>0&&s.jsx(be,{label:b,className:"border-b-0",children:s.jsx("ul",{className:"flex flex-col gap-1",children:f.map(E=>s.jsx("li",{children:s.jsx(Wi,{title:E.event.title,timeText:E.timeText,color:E.color,layout:"row",density:"compact",rsvp:E.event.myRsvp,status:E.event.status,hasThread:E.event.threadId!=="",isRecurring:E.event.recurrenceRule!=="",zoneCertainty:E.event.zoneCertainty,selected:E.event.id===n,onClick:()=>t.onSelectEvent(E.event.id)})},E.event.id))})})]})}const Bc=[{value:"sender",label:"Sender"},{value:"calendar",label:"Calendar"}],Kc={unknown:{label:"Unknown sender",tone:"neutral"},wellknown:{label:"Known sender",tone:"positive"},vip:{label:"VIP",tone:"accent"}};function Hc({sender:e}){const t=Kc[e.trust],n=e.inboundCount==null?null:(e.replyCount??0)>0?`${e.inboundCount} received · you replied ${e.replyCount}×`:`${e.inboundCount} received · you've never replied`;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(gt,{name:e.name,email:e.email,size:"md"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate text-sm font-semibold text-fg",children:e.name}),s.jsx("div",{className:"truncate text-2xs text-fg-subtle",children:e.email})]})]}),s.jsx("div",{className:"mt-2 flex items-center gap-2",children:e.addressUnverified?s.jsx(we,{tone:"danger",dot:!0,children:"Address couldn't be verified"}):s.jsx(we,{tone:t.tone,dot:!0,children:t.label})}),s.jsxs("p",{className:"mt-2 text-xs text-fg-muted",children:["First seen ",e.firstSeenLabel,n?` · ${n}`:""]})]})}function qc({auth:e,onShowSimilar:t}){if(e.verdict==="aligned")return s.jsxs("div",{className:"flex items-start gap-2 text-xs text-fg-muted",children:[s.jsx(hl,{className:"mt-0.5 size-3.5 shrink-0 text-positive"}),s.jsx("span",{children:e.summary})]});if(e.verdict==="caution")return s.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-warning/10 p-3 text-warning",children:[s.jsx(wc,{className:"mt-0.5 size-4 shrink-0"}),s.jsx("p",{className:"text-xs leading-relaxed",children:e.summary})]});const n=e.addressUnreadable?"This sender can't be verified":"This message may be impersonating someone";return s.jsxs("div",{className:"rounded-md bg-danger-soft p-3",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(nt,{className:"mt-0.5 size-4 shrink-0 text-danger"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-semibold text-danger",children:n}),s.jsx("p",{className:"mt-1 text-xs leading-relaxed text-fg",children:e.summary}),!e.addressUnreadable&&e.dkimDomain&&s.jsxs("p",{className:"mt-1 text-2xs text-fg-muted",children:["Sent from"," ",s.jsx("code",{className:"rounded bg-surface px-1 py-0.5",children:e.dkimDomain}),", claims to be"," ",s.jsx("code",{className:"rounded bg-surface px-1 py-0.5",children:e.fromDomain})]})]})]}),e.similarCount!=null&&e.similarCount>0&&s.jsxs(H,{variant:"secondary",size:"sm",className:"mt-2 w-full border-danger/30 text-danger hover:bg-danger-soft",onClick:t,children:[e.similarCount," similar messages"]})]})}function Ot({icon:e,label:t,active:n,danger:a,onClick:r,pending:o}){const i=r===void 0||o===!0;return s.jsxs("button",{type:"button",onClick:r,disabled:i,className:F("flex items-center gap-2 rounded-md border px-2 py-1 text-xs transition-colors",n?"border-accent-2 bg-accent-2-soft text-accent-2":"border-line text-fg-muted hover:border-line-strong hover:text-fg",a&&!n&&"text-danger hover:bg-danger-soft",i&&"cursor-not-allowed opacity-50 hover:border-line"),children:[e,t]})}const Qc={sender:"matched: sender",recipient:"matched: recipient",subject:"matched: subject",attachment:"matched: attachment",body:"matched: body",entities:"matched: entities"};function Ja({data:e,onClose:t,onShowSimilar:n,actions:a,similarState:r="ready",similarLinkComponent:o,className:i,hideCloseButton:l=!1,reportSpamPending:f=!1,notSpamPending:b=!1,calendar:h,tab:y,onTabChange:p,defaultTab:v="sender",touch:m}){const{sender:u,authenticity:d,category:g,flags:k={},similar:x}=e,[w,C]=c.useState(v),I=c.useId(),M=y??w,E=h!==void 0&&M==="calendar"?h:void 0;return s.jsxs("aside",{className:F("flex w-76 shrink-0 flex-col overflow-y-auto border-l border-line bg-surface",i),children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Intelligence"}),!l&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Xe,{className:"size-3.5"}),onClick:t,"aria-label":"Collapse intelligence sidebar"})]}),h&&s.jsx("div",{className:"flex shrink-0 justify-center border-b border-line px-row-inset py-2",children:s.jsx(qr,{name:I,"aria-label":"What this panel is showing",size:"sm",options:Bc,value:M,onChange:T=>{y===void 0&&C(T),p?.(T)}})}),E&&s.jsx(Uc,{data:E.data,actions:E.actions,selectedEventId:E.selectedEventId,touch:m}),E===void 0&&s.jsxs(s.Fragment,{children:[s.jsx(be,{label:"Sender",children:s.jsx(Hc,{sender:u})}),s.jsx(be,{label:"Authenticity",children:s.jsx(qc,{auth:d,onShowSimilar:n})}),s.jsx(be,{label:"Category",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(we,{tone:ra[g.value],children:Vt[g.value]}),g.overridden&&s.jsx("span",{className:"text-2xs text-fg-subtle",children:"your override"}),s.jsx("button",{type:"button",className:F("ml-auto text-2xs text-accent hover:underline",!a?.onReclassify&&"cursor-not-allowed opacity-50 hover:no-underline"),disabled:!a?.onReclassify,onClick:a?.onReclassify,children:"reclassify"})]})}),s.jsxs(be,{label:"Quick actions",children:[s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[s.jsx(Ot,{icon:s.jsx(et,{className:"size-3.5"}),label:"VIP",active:k.vip,onClick:a?.onToggleVip}),s.jsx(Ot,{icon:s.jsx(La,{className:"size-3.5"}),label:"Mute",active:k.muted,onClick:a?.onToggleMute}),a?.onNotSpam&&s.jsx(Ot,{icon:s.jsx(jc,{className:"size-3.5"}),label:b?"Undoing…":"Not spam",active:!0,onClick:a.onNotSpam,pending:b}),a?.onReportSpam&&s.jsx(Ot,{icon:s.jsx(Cc,{className:"size-3.5"}),label:f?"Reporting…":"Report spam",danger:!0,onClick:a.onReportSpam,pending:f})]}),a?.onNotSpam&&s.jsx("p",{className:"mt-1.5 text-2xs text-fg-subtle",children:"You reported this message as spam"})]}),(r!=="ready"||x.length>0)&&s.jsx(be,{label:"Similar messages",children:r==="loading"?s.jsx("div",{className:"animate-pulse space-y-2",children:Array.from({length:3}).map((T,P)=>s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"h-3 w-3/4 rounded bg-surface-sunken"}),s.jsx("div",{className:"h-2.5 w-1/2 rounded bg-surface-sunken"})]},P))}):r==="error"?s.jsx("p",{className:"text-xs text-fg-subtle",children:"Similarity search unavailable"}):r==="off"?s.jsxs("div",{className:"space-y-1.5 text-xs text-fg-subtle",children:[s.jsx("p",{className:"text-fg-muted",children:Qr}),s.jsx("p",{children:Wr}),s.jsxs("p",{children:["Run"," ",s.jsx("code",{className:"rounded bg-surface-sunken px-1 py-px text-2xs text-fg-muted",children:Gr})," ","on the server."]})]}):s.jsx("ul",{className:"-mx-1 space-y-1",children:x.map(T=>{const P="block w-full rounded-md px-1 py-1 text-left hover:bg-surface-sunken",$=`Open message from ${T.fromName||"unknown sender"}: ${T.subject}`,K=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[s.jsx("span",{className:"truncate text-xs font-medium text-fg",children:T.fromName}),s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:T.timeLabel})]}),s.jsx("div",{className:"truncate text-xs text-fg-muted",children:T.subject}),s.jsx("span",{className:"mt-1 inline-block rounded-full bg-surface-sunken px-1.5 py-px text-2xs text-fg-subtle",children:Qc[T.matched]})]});return s.jsx("li",{children:o?o({mailboxId:T.mailboxId,threadId:T.threadId,messageId:T.id,className:P,ariaLabel:$,children:K}):s.jsx("div",{className:P,children:K})},T.id)})})}),s.jsx(be,{label:"Coming soon",className:"border-b-0 opacity-70",children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-dashed border-line p-2",children:[s.jsx(Ze,{className:"mt-0.5 size-3.5 shrink-0 text-fg-subtle"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-medium text-fg-muted",children:"Suggested actions"}),s.jsx("div",{className:"text-2xs text-fg-subtle",children:'"Create a filter for messages like this" — on-device model'})]})]}),s.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-dashed border-line p-2",children:[s.jsx(Ze,{className:"mt-0.5 size-3.5 shrink-0 text-fg-subtle"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-xs font-medium text-fg-muted",children:"Thread summary"}),s.jsx("div",{className:"text-2xs text-fg-subtle",children:"One-paragraph digest — Bedrock"})]})]})]})})]})]})}function Wc({open:e=!1,enabled:t=!0,onToggle:n,className:a}){return s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(oa,{className:"size-4"}),title:"Intelligence","aria-label":e?"Hide intelligence sidebar":"Show intelligence sidebar","aria-pressed":e,disabled:!t,onClick:n,className:F(e&&"bg-accent-2-soft text-accent-2",a)})}function Up({hints:e=xi,className:t}){return e.length===0?null:s.jsx("footer",{className:F("flex items-center gap-2 border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",t),children:e.map(n=>s.jsx(Gc,{hint:n},n.label))})}function Gc({hint:e}){return s.jsxs("span",{className:"flex items-center gap-1",children:[e.keys.map(t=>s.jsx(Ni,{children:t},t)),s.jsx("span",{children:e.label})]})}function Vc({hasThread:e,onUnavailable:t,unavailableHint:n,isStarred:a,showTriage:r=!0,onReply:o,onReplyAll:i,onForward:l,onDelete:f,onToggleStar:b,moveSlot:h,onMove:y,replyTitle:p="Reply (r)",replyAllTitle:v="Reply all (a)",forwardTitle:m="Forward (f)",deleteTitle:u="Move to Trash (#)",flagTitle:d="Star (s)",children:g,className:k}){const x=(w,C)=>()=>{if(!e||!C){t?.(w);return}C()};return s.jsxs("div",{className:"relative",children:[s.jsxs("header",{className:F("flex h-pane-header shrink-0 items-center gap-1 border-b border-line bg-surface px-3",k),children:[s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Ya,{className:"size-4"}),title:p,"aria-label":"Reply",onClick:x("reply",o)}),s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Va,{className:"size-4"}),title:v,"aria-label":"Reply all",onClick:x("replyAll",i)}),s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Ga,{className:"size-4"}),title:m,"aria-label":"Forward",onClick:x("forward",l)}),r&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mx-1 h-4 w-px bg-line","aria-hidden":!0}),s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(vt,{className:"size-4"}),title:u,"aria-label":"Move to Trash",onClick:x("delete",f)}),h??s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Ds,{className:"size-4"}),title:"Move to mailbox","aria-label":"Move to mailbox",onClick:x("move",y)}),s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(et,{className:F("size-4",a&&"fill-warning text-warning")}),title:d,"aria-label":"Star","aria-pressed":a,onClick:x("flag",b)})]}),s.jsx("div",{className:"flex-1"}),g]}),n&&s.jsx("p",{role:"status",className:"border-b border-line bg-surface-sunken px-3 py-1 text-2xs text-fg-subtle",children:n})]})}const Ts=e=>({shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}),Cn=e=>e.shiftKey||e.metaKey||e.ctrlKey,Yc=e=>e.shiftKey?"range":e.metaKey||e.ctrlKey?"toggle":"open",Jc=(e,t)=>!t&&e>0,Xc=(e,t,n)=>{const a=e.indexOf(n);if(a===-1)return[];const r=t===void 0?-1:e.indexOf(t);if(r===-1)return[n];const o=Math.min(r,a),i=Math.max(r,a);return e.slice(o,i+1)},Zc=(e,t,n,a)=>t!==void 0&&e.includes(t)?t:n!==void 0&&e.includes(n)?n:a,ed=(e,t)=>{const n=new Set(t),a=new Set;for(const r of e)n.has(r)&&a.add(r);return a},td=(e,t,n)=>{if(e.length===0)return;const a=t===void 0?-1:e.indexOf(t);if(a===-1)return n>0?e[0]:e[e.length-1];const r=Math.min(Math.max(a+n,0),e.length-1);return e[r]},sd=e=>{const[t,n]=c.useState(()=>new Set(e?.initialSelectedIds)),[a,r]=c.useState(void 0),o=c.useCallback(u=>t.has(u),[t]),i=c.useCallback(u=>{r(u),n(d=>{const g=new Set(d);return g.has(u)?g.delete(u):g.add(u),g})},[]),l=c.useCallback(u=>{r(u),n(d=>{if(d.has(u))return d;const g=new Set(d);return g.add(u),g})},[]),f=c.useCallback(u=>{n(d=>{if(!d.has(u))return d;const g=new Set(d);return g.delete(u),g})},[]),b=c.useCallback(u=>{n(new Set(u))},[]),h=c.useCallback(()=>{r(void 0),n(new Set)},[]),y=c.useCallback(u=>{n(d=>u.every(k=>d.has(k))?new Set:new Set(u))},[]),p=c.useCallback(u=>{r(u)},[]),v=c.useCallback(u=>{n(d=>{if(d.size===0)return d;const g=ed(d,u);return g.size===d.size?d:g})},[]),m=c.useCallback((u,d,g)=>{const k=Zc(u,a,g,d);n(x=>{const w=Xc(u,k,d);if(w.length===0)return x;const C=new Set(x);for(const I of w)C.add(I);return C}),r(k)},[a]);return{selectedIds:t,selectedCount:t.size,hasSelection:t.size>0,isSelected:o,toggle:i,select:l,deselect:f,selectAll:b,clearSelection:h,toggleAll:y,selectRange:m,setAnchor:p,anchorId:a,intersectWith:v}},Ht={delete_failed:{label:"Not deleted",title:"This message was not deleted",detail:"Remit removed it here first, then refused to finish the delete on the mail server — most often because the Trash folder it was headed for is not there any more. The message is back in this folder because that is where the server still has it.",retryLabel:"Delete again",retryPendingLabel:"Deleting…"},move_failed:{label:"Not moved",title:"This message was not moved",detail:"Remit filed it here first, then could not finish the move on the mail server and stopped trying. The message is back in this folder because that is where the server still has it. The folder you picked is not recorded, so moving it again means choosing one.",retryLabel:"Move again",retryPendingLabel:"Moving…"}};function Xa({settlement:e,className:t}){const n=Ht[e];return s.jsxs(we,{tone:"danger",className:F("shrink-0",t),title:n.title,"data-settlement":e,children:[s.jsx(Pa,{className:"size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{children:n.label})]})}function nd({settlement:e,onRetry:t,action:n,retryPending:a,reportHref:r,className:o}){const i=Ht[e];return s.jsxs("div",{role:"alert","data-testid":"message-settlement-notice","data-settlement":e,className:F("flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",o),children:[s.jsx(Pa,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium text-danger",children:i.title}),s.jsx("p",{className:"mt-1 break-words text-fg-muted",children:i.detail}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-3",children:[n,t&&s.jsx("button",{type:"button",onClick:t,disabled:a,className:"font-medium text-accent hover:underline disabled:opacity-50",children:a?i.retryPendingLabel:i.retryLabel}),r&&s.jsx("a",{href:r,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]})]})]})}const Za="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",er=({active:e,focused:t})=>F("relative flex h-8 w-full items-center gap-2 px-row-inset text-left",Za,e?"bg-accent-2-soft":t?"bg-surface-sunken":"hover:bg-surface-sunken",t&&!e&&"before:absolute before:inset-y-0 before:left-0 before:w-0.5 before:bg-accent-2"),Qs=({active:e,focused:t})=>F("relative flex w-full items-start gap-3 py-2 pl-5 pr-row-inset text-left transition-colors",Za,e?"bg-accent-2-soft":t?"bg-surface-sunken":"hover:bg-surface-sunken",t&&!e&&"before:absolute before:inset-y-0 before:left-0 before:w-0.5 before:bg-accent-2");function tr({thread:e}){const t=!e.isRead;return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center",children:e.suspicious?s.jsx(nt,{className:"size-3.5 text-danger"}):e.starred?s.jsx(et,{className:"size-3 fill-warning text-warning"}):t?s.jsx("span",{className:"size-1.5 rounded-full bg-accent"}):null}),s.jsx("span",{className:F("w-36 shrink-0 truncate text-xs",t?"font-semibold text-fg":"text-fg-muted"),children:e.fromName}),s.jsxs("span",{className:"min-w-0 flex-1 truncate text-xs",children:[s.jsx("span",{className:F(t?"font-medium text-fg":"text-fg-muted"),children:e.subject}),s.jsxs("span",{className:"text-fg-subtle",children:[" — ",e.snippet]})]}),e.hasAttachment&&s.jsx(Zt,{className:"size-3 shrink-0 text-fg-subtle",role:"img","aria-label":"Has an attachment"}),e.settlement&&s.jsx(Xa,{settlement:e.settlement}),s.jsx("span",{className:"w-11 shrink-0 text-right text-2xs text-fg-subtle tabular-nums",children:e.timeLabel})]})}function Nn(e,t){const n=t?.trim();if(!n)return e;const a=e.toLowerCase(),r=n.toLowerCase(),o=[];let i=0,l=a.indexOf(r,i),f=0;for(;l!==-1;)l>i&&o.push(e.slice(i,l)),o.push(s.jsx("mark",{className:"bg-transparent font-semibold text-fg",children:e.slice(l,l+r.length)},f++)),i=l+r.length,l=a.indexOf(r,i);return i<e.length&&o.push(e.slice(i)),o}function ad({thread:e,badge:t,highlightQuery:n}){const a=!e.isRead;return s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex items-baseline justify-between gap-2",children:[s.jsxs("span",{className:F("flex min-w-0 items-center gap-1.5 truncate text-sm",a?"font-semibold text-fg":"font-medium text-fg-muted"),children:[e.trust==="vip"&&s.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-accent-2"}),s.jsx("span",{className:"truncate",children:e.fromName}),e.messageCount!=null&&e.messageCount>1&&s.jsx("span",{className:"shrink-0 text-2xs font-normal text-fg-subtle",children:e.messageCount})]}),s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:e.timeLabel})]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:F("truncate text-sm",a?"text-fg":"text-fg-muted"),children:Nn(e.subject,n)}),e.suspicious&&s.jsx(nt,{className:"size-3.5 shrink-0 text-danger"}),e.starred&&s.jsx(et,{className:"size-3 shrink-0 fill-warning text-warning"}),e.hasAttachment&&s.jsx(Zt,{className:"size-3 shrink-0 text-fg-subtle",role:"img","aria-label":"Has an attachment"})]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"line-clamp-1 min-w-0 flex-1 text-xs text-fg-subtle",children:Nn(e.snippet,n)}),e.category&&e.category!=="personal"&&s.jsx(we,{tone:ra[e.category],className:"shrink-0",children:Vr(e.category)}),e.labels?.map(r=>s.jsx(Yr,{label:r,className:"max-w-20"},r.labelId)),e.settlement&&s.jsx(Xa,{settlement:e.settlement}),t]})]})}function rd({thread:e,selection:t}){if(!t)return s.jsx(gt,{name:e.fromName,email:e.fromEmail,size:"sm"});const{checked:n,alwaysVisible:a}=t;return s.jsxs("span",{className:"relative size-7 shrink-0",children:[s.jsx(gt,{name:e.fromName,email:e.fromEmail,size:"sm",className:F("absolute inset-0 transition-opacity sm:group-hover:opacity-0",(n||a)&&"opacity-0")}),s.jsx("span",{role:"button",tabIndex:-1,onClick:t.onToggle,onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||(r.preventDefault(),r.stopPropagation(),t.onToggle(r))},className:F("absolute inset-0 size-7 items-center justify-center rounded-full border transition-opacity",a?"flex":"hidden sm:flex",n?"bg-accent border-accent text-accent-fg opacity-100":a?"border-fg-subtle/40 bg-canvas opacity-100":"border-fg-subtle/40 bg-canvas opacity-0 group-hover:opacity-100"),"aria-label":n?"Deselect message":"Select message",children:n&&s.jsx(Gt,{className:"size-3"})})]})}function Ws({thread:e,selection:t,badge:n,highlightQuery:a}){const r=!e.isRead;return s.jsxs(s.Fragment,{children:[r&&s.jsx("span",{className:"absolute left-1.5 top-1/2 size-1.5 -translate-y-1/2 rounded-full bg-accent"}),s.jsx(rd,{thread:e,selection:t}),s.jsx(ad,{thread:e,badge:n,highlightQuery:a})]})}const sr=e=>({...gi,[Jr]:"","data-message-id":e.id});function Bp({thread:e,active:t,focused:n,tabIndex:a,onClick:r}){return s.jsx("button",{type:"button",...sr(e),tabIndex:a,onClick:r,className:er({active:t,focused:n}),children:s.jsx(tr,{thread:e})})}function Kp({thread:e,active:t,focused:n,tabIndex:a,selection:r,onClick:o}){return s.jsx("button",{type:"button",...sr(e),tabIndex:a,onClick:o,className:F("group",Qs({active:t,focused:n})),children:s.jsx(Ws,{thread:e,selection:r})})}let Je;const od=5e3;function nr(e){e.preventDefault(),qt()}function qt(){Je!==void 0&&(clearTimeout(Je),Je=void 0,document.removeEventListener("contextmenu",nr,!0),document.removeEventListener("pointerup",qt,!0))}function id(){Je===void 0?(document.addEventListener("contextmenu",nr,!0),document.addEventListener("pointerup",qt,!0)):clearTimeout(Je),Je=setTimeout(qt,od)}function ld({onLongPress:e,isDisabled:t,delayMs:n=500,accessibilityDescription:a}){const{longPressProps:r}=bc({isDisabled:t,threshold:n,accessibilityDescription:a,onLongPress:e}),o=c.useCallback(i=>{i.pointerType!=="touch"&&i.pointerType!=="pen"||id()},[]);return{longPressProps:Tt(r,{onPointerDown:o})}}const ut="min-h-11 min-w-11 px-0";function ar({hasThread:e,onReply:t,onReplyAll:n,onForward:a,isStarred:r,onToggleStar:o,onDelete:i,isRead:l,onToggleRead:f,moveSlot:b,overflowItems:h=[],onUnavailable:y,unavailableHint:p,className:v}){const m=(d,g)=>()=>{if(!e){y?.(d);return}g?.()},u=f?[{key:"toggle-read",label:l?"Mark as unread":"Mark as read",icon:l?s.jsx(Ii,{className:"size-4"}):s.jsx(qs,{className:"size-4"}),onSelect:m("toggleRead",f)}]:[];return s.jsxs("div",{className:F("relative",v),children:[s.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-0.5 bg-canvas px-1",children:[t&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Ya,{className:"size-5"}),onClick:m("reply",t),"aria-label":"Reply",title:"Reply",className:ut}),n&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Va,{className:"size-5"}),onClick:m("replyAll",n),"aria-label":"Reply all",title:"Reply all",className:ut}),a&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Ga,{className:"size-5"}),onClick:m("forward",a),"aria-label":"Forward",title:"Forward",className:ut}),s.jsx("div",{className:"flex-1"}),o&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(et,{className:F("size-5",r&&"fill-warning text-warning")}),onClick:m("star",o),"aria-label":r?"Unstar":"Star","aria-pressed":r,title:r?"Unstar":"Star",className:ut}),b,i&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(vt,{className:"size-5"}),onClick:m("delete",i),"aria-label":"Move to Trash",title:"Move to Trash",className:ut}),s.jsx(Sa,{triggerLabel:"More actions",items:[...u,...h]})]}),!e&&p&&s.jsx("p",{role:"status",className:"bg-surface-sunken px-3 py-1 text-2xs text-fg-subtle",children:p})]})}function rr({message:e,onClick:t,isFocused:n,isUnread:a,trailing:r}){const o=s.jsxs(s.Fragment,{children:[s.jsx(Fs,{className:"size-3.5 shrink-0 text-fg-subtle"}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx(gt,{name:e.fromName,email:e.fromEmail,size:"md"}),a&&s.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2 rounded-full border border-canvas bg-accent"})]}),s.jsx("span",{className:F("w-36 shrink-0 truncate text-sm",a?"font-semibold text-fg":"font-medium text-fg-muted"),children:e.fromName}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-xs text-fg-subtle",children:e.snippet}),r??s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:e.dateLabel})]}),i=F("group flex h-section-row w-full items-center gap-3 border-b border-line px-2 text-left transition-colors hover:bg-surface-sunken lg:px-4",n&&"bg-surface-sunken ring-1 ring-inset ring-accent/30");return t?s.jsx("div",{role:"button",tabIndex:0,"aria-expanded":!1,onClick:t,onKeyDown:l=>{Xr(l)&&(l.preventDefault(),t())},className:F(i,"cursor-pointer"),children:o}):s.jsx("div",{className:i,children:o})}function or({message:e,warning:t,onHeaderClick:n,isFocused:a,senderBadge:r,trailing:o,to:i,indicators:l,actionMenu:f,actionBar:b,body:h}){const y=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[s.jsxs("span",{className:"text-sm font-semibold text-fg",children:[e.fromName,r]}),o??s.jsx("span",{className:"text-2xs text-fg-subtle",children:e.dateLabel})]}),s.jsx("div",{className:"text-xs text-fg-subtle",children:e.fromEmail}),i!==null&&s.jsx("div",{className:"text-xs text-fg-subtle",children:i??s.jsxs(s.Fragment,{children:["to ",e.toLabel]})})]});return s.jsxs("div",{className:"px-2 py-3 lg:px-4",children:[s.jsxs("div",{className:F("-mx-2 -my-1 flex items-start gap-3 rounded-sm px-2 py-1",a&&"ring-1 ring-inset ring-accent/30"),children:[n?s.jsx("button",{type:"button",onClick:n,"aria-expanded":!0,"aria-label":"Collapse message",className:"mt-1 shrink-0 text-fg-subtle transition-colors hover:text-fg",children:s.jsx(Ke,{className:"size-3.5"})}):s.jsx(Ke,{className:"mt-1 size-3.5 shrink-0 text-fg-subtle"}),s.jsx(gt,{name:e.fromName,email:e.fromEmail,size:"md"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[n?s.jsx("button",{type:"button",onClick:n,className:"w-full text-left",children:y}):y,l]}),f&&s.jsx("div",{className:"shrink-0",children:f})]}),t&&s.jsxs("div",{className:"mt-3 flex items-start gap-3 rounded-md bg-danger-soft p-3",children:[s.jsx(nt,{className:"mt-0.5 size-4 shrink-0 text-danger"}),s.jsxs("div",{className:"text-sm text-fg",children:[s.jsx("span",{className:"font-semibold text-danger",children:"Caution: "}),t," ",s.jsx("button",{type:"button",className:"text-accent underline",children:"Why?"})]})]}),b&&s.jsx("div",{className:"mt-3 -mx-2 lg:-mx-4",children:b}),s.jsx(Ei,{children:h??s.jsx(Ri,{className:"mt-3",html:e.bodyHtml,category:e.framed?"newsletter":"personal",allowImages:!0})})]})}function cd({thread:e,onBack:t,intelligence:n,intelligenceOpen:a,onToggleIntelligence:r,actions:o,children:i,touchHandlers:l}){const[f,b]=c.useState(!1),h=r!==void 0,y=h?a??!1:f,p=!!n||h,v=()=>{if(h){r?.();return}b(u=>!u)},m=()=>{if(h){y&&r?.();return}b(!1)};return s.jsxs("article",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line bg-surface px-row-inset",children:[s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(ia,{className:"size-4"}),onClick:t,"aria-label":"Back to messages",className:"-ml-1 shrink-0"}),s.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:e.subject}),p&&s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(oa,{className:"size-4"}),onClick:v,"aria-label":y?"Hide intelligence panel":"Show intelligence panel","aria-pressed":y,title:"Intelligence",className:F("shrink-0",y&&"bg-accent-2-soft text-accent-2")})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",style:l?{touchAction:"pan-y"}:void 0,...l,children:i??[...e.messages].reverse().map(u=>{const d=g=>g?()=>g(u.id):void 0;return u.expanded?s.jsx(or,{message:u,warning:e.warning,onHeaderClick:d(o?.onToggleExpand),actionBar:s.jsx(ar,{hasThread:!0,onReply:d(o?.onReply),onReplyAll:d(o?.onReplyAll),onForward:d(o?.onForward),onToggleStar:d(o?.onToggleStar),onDelete:d(o?.onDelete),onToggleRead:d(o?.onToggleRead),moveSlot:o?.moveSlot?.(u.id)})},u.id):s.jsx(rr,{message:u,onClick:d(o?.onToggleExpand)},u.id)})}),n&&!h&&s.jsx(Zr,{open:y,onClose:m,title:"Intelligence",anchor:"right",className:"p-0",children:s.jsx(Ja,{data:n,onClose:m,className:"h-full w-full border-l-0"})})]})}function dd(e){return{id:e.id,fromName:e.sender,fromEmail:e.senderEmail??e.sender,subject:e.subject,snippet:e.snippet,timeLabel:e.date,isRead:!e.unread,starred:e.flagged,...e.mailboxId?{mailboxId:e.mailboxId}:{}}}function ud({result:e,onClick:t,query:n,showFolder:a=!0}){const r=a&&e.folder?eo(e.folder):void 0;return s.jsx("button",{type:"button",onClick:t,className:F("group",Qs({}),"border-b border-line"),children:s.jsx(Ws,{thread:dd(e),highlightQuery:n,badge:s.jsxs(s.Fragment,{children:[r&&s.jsx(we,{tone:"neutral",className:"shrink-0",children:r}),e.category&&s.jsx(we,{tone:e.category.tone??"neutral",className:"shrink-0",children:e.category.label}),e.matchedChunkLabel&&s.jsx(we,{tone:"neutral",className:"shrink-0",children:`matched: ${e.matchedChunkLabel}`}),e.score!=null&&s.jsx("span",{className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:e.score.toFixed(2)})]})})})}const fd=e=>e===1?"result":"results";function md({count:e,onScopeToSpam:t}){return s.jsx(la,{tone:"info",variant:"soft",className:"items-center justify-between gap-3 rounded-none border-b border-line",children:s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("p",{className:"min-w-0 text-xs text-fg-muted",children:e.kind==="exact"?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"font-semibold text-fg tabular-nums",children:e.value.toLocaleString()})," ",`${fd(e.value)} from Spam`]}):"Results from Spam"}),s.jsx(H,{variant:"ghost",size:"sm",onClick:t,className:"shrink-0 text-accent",children:"Go to Spam"})]})})}const Sn=6,pd={kind:"global"},Tn={kind:"unknown"},hd=e=>e.kind==="folder"&&e.role==="junk",gd=e=>e.folder?.role==="junk";function xd(e){const t=[],n=[];for(const a of e)gd(a)?n.push(a):t.push(a);return{kept:t,spam:n}}function ir({onClick:e,blockedReason:t}){const n=c.useId(),[a,r]=c.useState(!1);return s.jsxs("div",{className:"border-b border-line px-row-inset py-1.5",children:[s.jsxs("button",{type:"button",onClick:()=>{if(t){r(!0);return}e()},"aria-describedby":t?n:void 0,className:F("flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-xs font-medium transition-colors",t?"text-fg-subtle opacity-55":"text-accent hover:bg-surface-sunken"),children:[s.jsx(to,{className:"size-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:"Make this a filter"})]}),t&&s.jsx(so,{id:n,reason:t,nudged:a,className:"px-2 pt-1 text-2xs text-warning"})]})}function bd({section:e,query:t,onSelectResult:n,showFolder:a}){const[r,o]=c.useState(e.initialCollapsed??!1),[i,l]=c.useState(!1),f=e.results.length>Sn,h=!i&&f?e.results.slice(0,Sn):e.results,y=e.results.length-h.length;return s.jsxs("div",{children:[s.jsxs("button",{type:"button","aria-expanded":!r,onClick:()=>o(p=>!p),className:"sticky top-0 z-10 flex h-section-row w-full items-center gap-1.5 border-b border-line bg-surface-sunken px-row-inset text-left transition-colors hover:bg-surface",children:[s.jsx("span",{className:"flex-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e.label}),s.jsx("span",{className:"text-2xs text-fg-subtle tabular-nums",children:e.results.length}),s.jsx(Ke,{className:F("size-3 shrink-0 text-fg-subtle transition-transform duration-200",r?"rotate-0":"rotate-180")})]}),!r&&s.jsxs(s.Fragment,{children:[h.map(p=>s.jsx(ud,{result:p,query:t,showFolder:a,onClick:n?()=>n(p):void 0},p.id)),f&&s.jsxs("button",{type:"button",onClick:()=>l(p=>!p),className:"flex w-full items-center justify-center border-b border-line px-row-inset py-1.5 text-2xs font-medium text-accent transition-colors hover:bg-surface",children:[i?"Show less":`Show ${y} more`,!i&&s.jsx(Ke,{className:"ml-1 size-3"})]})]})]})}function lr({value:e,recentSearches:t,onPickRecent:n,sections:a,loading:r,onSelectResult:o,tokens:i,scope:l=pd,makeFilter:f}){if(!(e.trim().length>0))return t&&t.length>0?s.jsxs("div",{className:"flex flex-col",children:[s.jsx("h3",{className:"px-row-inset pb-1 pt-3 text-2xs font-semibold uppercase tracking-wide text-fg-subtle",children:"Recent searches"}),t.map(T=>s.jsxs("button",{type:"button",onClick:()=>n?.(T),className:"flex w-full items-center gap-2.5 border-b border-line px-row-inset py-2.5 text-left transition-colors hover:bg-surface-sunken",children:[s.jsx($a,{className:"size-4 shrink-0 text-fg-subtle"}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-fg-muted",children:T})]},T))]}):s.jsx("p",{className:"px-row-inset py-6 text-center text-sm text-fg-subtle",children:"Search across your mail by sender, subject or words in the message."});const h=i&&i.length>0&&s.jsx(no,{tokens:i}),y=f&&s.jsx(ir,{...f});if(r)return s.jsxs("div",{className:"flex flex-col",children:[y,h,s.jsx("div",{className:"flex flex-col gap-3 px-row-inset py-4",children:[0,1,2,3].map(T=>s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("div",{className:"h-3 w-1/3 animate-pulse rounded bg-surface-sunken"}),s.jsx("div",{className:"h-3 w-2/3 animate-pulse rounded bg-surface-sunken"}),s.jsx("div",{className:"h-2.5 w-1/2 animate-pulse rounded bg-surface-sunken"})]},T))})]});const p=l.kind==="global",v=hd(l)||l.kind==="collection",m=p||l.kind==="collection",u=(a??[]).map(T=>{if(v)return{section:T,spam:[]};const{kept:P,spam:$}=xd(T.results);return{section:{...T,results:P},spam:$}}),d=u.map(T=>T.section),g=u.reduce((T,P)=>T+P.spam.length,0),x=(l.kind==="global"?l.spamCount:void 0)??Tn,w=g>0||x.kind==="exact"&&x.value>0,I=x.kind==="exact"&&x.value===0&&g>0?Tn:x,M=l.kind==="global"&&w&&l.onScopeToSpam!==void 0?s.jsx(md,{count:I,onScopeToSpam:l.onScopeToSpam}):void 0;return d.some(T=>T.results.length>0)?s.jsxs("div",{className:"flex flex-col",children:[y,h,M,d.filter(T=>T.results.length>0).map(T=>s.jsx(bd,{section:T,query:e,showFolder:m,onSelectResult:o},T.id))]}):s.jsxs("div",{className:"flex flex-col",children:[y,h,M,s.jsxs("div",{className:"px-row-inset py-10 text-center",children:[s.jsxs("p",{className:"text-sm font-medium text-fg",children:["No matches for “",e,"”"]}),s.jsx("p",{className:"mt-1 text-xs text-fg-subtle",children:"Try a different word, or adjust the filters above."})]})]})}function vd({value:e,onChange:t,onClear:n,onCancel:a,filter:r,recentSearches:o,onPickRecent:i,sections:l,loading:f,onSelectResult:b,tokens:h,chips:y,onRemoveChip:p,scope:v,makeFilter:m,suggest:u,suggestList:d}){const g=s.jsx(lr,{value:e,recentSearches:o,onPickRecent:i,sections:l,loading:f,onSelectResult:b,tokens:h,scope:v,makeFilter:m});return s.jsxs("article",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-2 border-b border-line bg-surface px-row-inset",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(Na,{value:e,onChange:t,onClear:n,chips:y,onRemoveChip:p,globalFocusKey:!1,showClearButton:!1,suggest:u})}),s.jsx(H,{variant:"ghost",size:"sm",icon:s.jsx(Xe,{className:"size-4"}),onClick:a,"aria-label":"Clear and close search",className:"-mr-1 shrink-0"})]}),d,r&&e.trim().length===0?s.jsx(ao,{children:s.jsx(na,{...r,children:g})}):s.jsx("div",{className:"flex-1 overflow-y-auto",children:g})]})}const In=e=>e.toLocaleString();function En({selectAll:e,selecting:t,className:n}){return s.jsx(Rl,{className:n,checked:e.checked,indeterminate:e.indeterminate,onChange:e.onChange,label:s.jsx("span",{className:"font-medium text-accent",children:e.checked&&t?"Deselect all":"Select all"})})}function yd({title:e,count:t,onCancel:n,onDelete:a,onMove:r,onOrganize:o,onJunk:i,onMarkRead:l,navSlot:f,titleMeta:b,searchSlot:h,searchField:y,idleSlot:p,overflowSlot:v,isBusy:m=!1,isCounting:u=!1,selectAll:d,statusLabel:g,progress:k,notice:x}){const w=t>0||u,C=d?.checked?`All ${In(t)} loaded selected`:`${In(t)} ${t===1?"message":"messages"} selected`,I=[];return i&&!m&&!u&&I.push({key:"junk",label:"Junk",icon:s.jsx(nt,{className:"size-4"}),onSelect:i}),l&&!m&&!u&&I.push({key:"mark-read",label:"Mark read",icon:s.jsx(qs,{className:"size-4"}),onSelect:l}),s.jsxs("header",{"data-selection-bar":"",className:"flex shrink-0 flex-col border-b border-line bg-surface-sunken",children:[s.jsxs("div",{"data-selection-bar-row":"actions",className:"flex h-pane-header items-center gap-1 px-row-inset",children:[w?s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(ia,{className:"size-5"}),onClick:n,"aria-label":"Cancel selection",className:"-ml-2 shrink-0"}):f,d&&s.jsx(En,{selectAll:d,selecting:w,className:"hidden shrink-0 pr-2 md:flex"}),w?s.jsx("span",{"data-selection-count":"",className:"min-w-0 flex-1 truncate px-1 text-sm font-medium text-fg",role:"status","aria-live":"polite",children:g??C}):y?s.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:y}):s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"min-w-0 flex-1 truncate px-1 text-sm font-semibold text-fg",children:e}),b,h]}),w&&!u&&s.jsxs(s.Fragment,{children:[s.jsx(H,{variant:"ghost",size:"touch",icon:m?s.jsx(sa,{className:"size-5 animate-spin"}):s.jsx(vt,{className:"size-5 text-danger"}),onClick:m?void 0:a,"aria-label":"Move selected messages to Trash","aria-busy":m||void 0,className:"shrink-0"}),!m&&r&&s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(Ds,{className:"size-5"}),onClick:r,"aria-label":"Move selected messages",className:"shrink-0"}),!m&&o&&s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(Ze,{className:"size-5"}),onClick:o,"aria-label":"Organize selected messages",className:"shrink-0"})]}),w&&s.jsx(Sa,{triggerLabel:"More actions",items:I,className:"shrink-0",children:!m&&!u&&v})]}),!w&&p,w&&d&&s.jsx("div",{"data-selection-bar-row":"select-all",className:"px-row-inset pb-2 md:hidden",children:s.jsx(En,{selectAll:d,selecting:w,className:"w-full"})}),k&&s.jsx("div",{className:"px-row-inset pb-2",children:s.jsx(ro,{value:k.value,max:k.max,tone:k.tone})}),x&&s.jsx(la,{"data-selection-notice":"",tone:x.tone,variant:"soft",role:"status","aria-live":"polite",className:"mx-row-inset mb-2",children:s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[x.text&&s.jsx("span",{children:x.text}),x.action&&s.jsx(H,{variant:"ghost",size:"md",onClick:x.action.onClick,className:"-my-1 min-h-11 shrink-0",children:x.action.label})]})})]})}const cr={id:"unread",label:"Unread"},kd={id:"flagged",label:"Starred"},dr={id:"attachment",label:"Has attachment"};function jd(e){if(!(e.length<=1))return e.map(t=>({id:t.id,label:t.label,count:t.count,active:t.active}))}function Hp(e=[]){return{categories:[...Wt],filters:aa,sources:jd(e)}}function qp(){return{categories:[...Wt],filters:[cr,kd,dr]}}function Qp(){return{categories:[...Wt],filters:[cr,dr]}}function wd(e,t){return e.endsWith(t)?e.length===t.length||e[e.length-t.length-1]===".":!1}function Cd(e,t){const n=e.length-t.length-2,a=e.lastIndexOf(".",n);return a===-1?e:e.slice(a+1)}function Nd(e,t,n){if(n.validHosts!==null){const r=n.validHosts;for(const o of r)if(wd(t,o))return o}let a=0;if(t.startsWith("."))for(;a<t.length&&t[a]===".";)a+=1;return e.length===t.length-a?null:Cd(t,e)}const vs=/[\t\n\r]/g;let Is=!1;function Rn(e){return e>=97&&e<=122||e>=48&&e<=57||e>127||e>=65&&e<=90||e===45||e===95}function Mn(e,t,n){const a=n-t,r=e.charCodeAt(t)|32;if(a===2)return r===119&&(e.charCodeAt(t+1)|32)===115?1:0;if(a===3){const o=e.charCodeAt(t+1)|32,i=e.charCodeAt(t+2)|32;return r===119&&o===115&&i===115||r===102&&o===116&&i===112?1:0}else if(a===4){const o=e.charCodeAt(t+1)|32,i=e.charCodeAt(t+2)|32,l=e.charCodeAt(t+3)|32;return r===104&&o===116&&i===116&&l===112?1:r===102&&o===105&&i===108&&l===101?2:0}else if(a===5)return r===104&&(e.charCodeAt(t+1)|32)===116&&(e.charCodeAt(t+2)|32)===116&&(e.charCodeAt(t+3)|32)===112&&(e.charCodeAt(t+4)|32)===115?1:0;return 0}function mt(e,t,n=!1){let a=0,r=e.length,o=!1,i=!1;if(Is=!1,!t){if(e.startsWith("data:"))return null;for(;a<e.length&&e.charCodeAt(a)<=32;)a+=1;for(;r>a+1&&e.charCodeAt(r-1)<=32;)r-=1;if(e.charCodeAt(a)===47&&e.charCodeAt(a+1)===47)a+=2;else{const d=e.indexOf(":/",a);if(d!==-1){const g=Mn(e,a,d);if(g===1)for(i=!0,a=d+2;e.charCodeAt(a)===47||e.charCodeAt(a)===92;)a+=1;else if(g===2){i=!0,a=d+1;let k=0;for(;(e.charCodeAt(a)===47||e.charCodeAt(a)===92)&&k<2;)a+=1,k+=1;if(k<2)return null}else{for(let k=a;k<d;k+=1){const x=e.charCodeAt(k)|32;if(!(x>=97&&x<=122||x>=48&&x<=57||x===46||x===45||x===43)){const w=e.charCodeAt(k);return w===9||w===10||w===13?mt(e.replace(vs,""),t,n):null}}if(e.charCodeAt(d+2)===47)a=d+3;else return null}}else if(e.charCodeAt(a)!==91){let g=-1;for(let k=a;k<r;k+=1){const x=e.charCodeAt(k);if(x===9||x===10||x===13)return mt(e.replace(vs,""),t,n);if(x===58){g=k;break}if(x===47||x===92||x===63||x===35)break}if(g!==-1){let k=!1;for(let x=g+1;x<r;x+=1){const w=e.charCodeAt(x);if(w===47||w===92||w===63||w===35)break;if(w===64){k=!0;break}}if(!k){let x=!0,w=g+1;for(;w<r;w+=1){const C=e.charCodeAt(w);if(C===47||C===92||C===63||C===35)break;if(C<48||C>57){x=!1;break}}if(w===g+1&&(x=!1),!x){const C=Mn(e,a,g);if(C===0){let I=!1;for(let M=g+1;M<r;M+=1){const E=e.charCodeAt(M);if(E===47||E===92||E===63||E===35)break;if(E===58){I=!0;break}}if(!I)return null}else if(i=!0,a=g+1,C===2){let I=0;for(;(e.charCodeAt(a)===47||e.charCodeAt(a)===92)&&I<2;)a+=1,I+=1;if(I<2)return null}else for(;e.charCodeAt(a)===47||e.charCodeAt(a)===92;)a+=1}}}}}let f=-1,b=-1,h=-1,y=-1,p=!1,v=n,m=a-1,u=-1;if(n&&a<r){const d=e.charCodeAt(a);(!(Rn(d)||d===46||d===95)||d===45)&&(v=!1)}for(let d=a;d<r;d+=1){const g=e.charCodeAt(d);if(g<64)if(g===47||g===35||g===63){r=d;break}else g===58?(y===-1&&(y=d),h=d):g===9||g===10||g===13?p=!0:n&&(g===46?((d-m>64||u===46||u===45)&&(v=!1),m=d):(g<48||g>57)&&(g!==45||u===46)&&(v=!1));else if(i&&g===92){r=d;break}else g===64?(f=d,y=-1):g===93?b=d:g>=65&&g<=90?o=!0:n&&!Rn(g)&&(v=!1);n&&(u=g)}if(p)return mt(e.replace(vs,""),t,n);if(f!==-1&&f>=a&&f<r&&(a=f+1),e.charCodeAt(a)===91)return b!==-1?e.slice(a+1,b).toLowerCase():null;if(h!==-1&&h>a&&h<r&&y===h&&(r=h),a>=r)return null;n&&v&&f===-1&&h===-1&&b===-1&&e.charCodeAt(r-1)!==46&&r-a<=255&&r-m-1<=63&&u!==45&&(Is=!0)}for(;r>a+1&&e.charCodeAt(r-1)===46;)r-=1;const l=a!==0||r!==e.length?e.slice(a,r):e;return o?l.toLowerCase():l}function Sd(e){if(e.length<7||e.length>15)return!1;let t=0;for(let n=0;n<e.length;n+=1){const a=e.charCodeAt(n);if(a===46)t+=1;else if(a<48||a>57)return!1}return t===3&&e.charCodeAt(0)!==46&&e.charCodeAt(e.length-1)!==46}function Td(e){if(e.length<3)return!1;let t=e.startsWith("[")?1:0,n=e.length;if(e[n-1]==="]"&&(n-=1),n-t>39)return!1;let a=!1;for(;t<n;t+=1){const r=e.charCodeAt(t);if(r===58)a=!0;else if(!(r>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70))return!1}return a}function Id(e){return Td(e)||Sd(e)}function An(e){return e>=97&&e<=122||e>=48&&e<=57||e>127}function $n(e){if(e.length>255||e.length===0||!An(e.charCodeAt(0))&&e.charCodeAt(0)!==46&&e.charCodeAt(0)!==95)return!1;let t=-1,n=-1;const a=e.length;for(let r=0;r<a;r+=1){const o=e.charCodeAt(r);if(o===46){if(r-t>64||n===46||n===45)return!1;t=r}else if(!(An(o)||o===45||o===95)||o===45&&n===46)return!1;n=o}return a-t-1<=63&&n!==45}function Ed({allowIcannDomains:e=!0,allowPrivateDomains:t=!1,detectIp:n=!0,detectSpecialUse:a=!1,extractHostname:r=!0,mixedInputs:o=!0,validHosts:i=null,validateHostname:l=!0}){return{allowIcannDomains:e,allowPrivateDomains:t,detectIp:n,detectSpecialUse:a,extractHostname:r,mixedInputs:o,validHosts:i,validateHostname:l}}const Rd=Ed({});function Md(e){return Rd}function Ad(){return{domain:null,domainWithoutSuffix:null,hostname:null,isIcann:null,isIp:null,isPrivate:null,isSpecialUse:null,publicSuffix:null,subdomain:null}}function $d(e){e.domain=null,e.domainWithoutSuffix=null,e.hostname=null,e.isIcann=null,e.isIp=null,e.isPrivate=null,e.isSpecialUse=null,e.publicSuffix=null,e.subdomain=null}function Ld(e,t,n,a,r){const o=Md();if(typeof e!="string")return r;let i=!1;return o.extractHostname?o.mixedInputs?(i=$n(e),r.hostname=mt(e,i,o.validateHostname)):r.hostname=mt(e,!1,o.validateHostname):r.hostname=e,o.detectIp&&r.hostname!==null&&(r.isIp=Id(r.hostname),r.isIp)?r:o.validateHostname&&o.extractHostname&&r.hostname!==null&&!(i&&r.hostname===e)&&!Is&&!$n(r.hostname)?(r.hostname=null,r):(r.hostname===null||(n(r.hostname,o,r),r.publicSuffix===null)||(r.domain=Nd(r.publicSuffix,r.hostname,o)),r)}const Ln=Ad();function Pd(e,t){return $d(Ln),Ld(e,3,oo,t,Ln).domain}const ss=e=>{const t=new Set,n=[];for(const a of e){const r=a.trim();if(r==="")continue;const o=r.toLowerCase();t.has(o)||(t.add(o),n.push(r))}return n},Fd=e=>{const t=e.lastIndexOf("@");return t>=0?e.slice(t+1):e},ur=e=>Pd(Fd(e.trim())),Dd=e=>{const t=ss(e);if(t.length<2)return null;let n=null;for(const a of t){const r=ur(a);if(r===null)return null;if(n===null)n=r;else if(n!==r)return null}return n},Od=e=>{const t=Dd(e);return t!==null?[{field:"FromDomain",value:t}]:ss(e).map(n=>({field:"From",value:n}))},zd=e=>{const t=new Map;for(const r of e){const o=r.normalizedEmail.trim().toLowerCase();if(o==="")continue;const i=t.get(o);i?i.count+=1:t.set(o,{sender:r,count:1})}let n,a=0;for(const{sender:r,count:o}of t.values())o<=a||(n=r,a=o);return n},fr=e=>e.displayName?.trim()||e.normalizedEmail,_d=/^\s*(?:(?:re|aw|fwd?|vs|sv|antw|res|enc|tr)\s*(?:\[\d+\])?\s*:|\[[^\]]{1,32}\])\s*/i,Ud=e=>{let t=e.replace(/\s+/g," ").trim();for(;;){const n=t.replace(_d,"");if(n===t)return t.trim();t=n}},Bd=new Set(["a","an","and","are","as","at","be","by","for","from","has","have","in","is","it","me","my","new","of","on","or","our","the","this","to","was","we","with","you","your"]),Kd=3,ys=e=>e.split(" ").filter(t=>t!==""),Pn=e=>e.length===0||e.join(" ").length<Kd?!1:e.some(t=>!Bd.has(t.toLowerCase())),Hd=(e,t)=>e.findIndex((n,a)=>t.every((r,o)=>e[a+o]?.toLowerCase()===r.toLowerCase())),qd=e=>{const t=e.map(Ud).filter(o=>o!=="");if(t.length===0)return;const[n,...a]=t;if(a.length===0)return Pn(ys(n))?n:void 0;const r=ys(n);for(let o=r.length;o>0;o-=1)for(let i=0;i+o<=r.length;i+=1){const l=r.slice(i,i+o);if(Pn(l)&&a.every(f=>Hd(ys(f),l)>=0))return l.join(" ")}},Gs=(e,t)=>{const n=Od(e);if(ss(e).length===1||n.length===1&&n[0].field==="FromDomain")return n;const a=qd(t);return a!==void 0?[{field:"Subject",value:a}]:n},Qd=({match:e,sender:t,folder:n})=>{const a=e??t;return a?n?`${a} → ${n}`:e?`Mail matching ${e}`:`Mail from ${a}`:n?`Mail to ${n}`:""},Wd=e=>e.clauses.length>0,Gd=e=>({scopedOutFolder:e.scopedOut?.label,droppedFacets:e.droppedFacets.map(t=>t.label),droppedSemantic:e.droppedSemantic}),Vd=({orderedIds:e,isDesktop:t,initialFocusedId:n,initialSelectedIds:a,onExitSelection:r})=>{const[o,i]=c.useState(n),[l,f]=c.useState(),b=c.useCallback(N=>{f(L=>L===N?L:void 0),i(N)},[]),h=sd({initialSelectedIds:a}),{selectedCount:y,toggle:p,clearSelection:v,selectRange:m,setAnchor:u,selectAll:d}=h,g=Jc(y,t),k=c.useRef(null),x=c.useRef(!1),w=c.useCallback(()=>{r?.(),v()},[v,r]),C=c.useMemo(()=>o?e.indexOf(o):-1,[e,o]),I=c.useCallback(N=>{if(N<0||N>=e.length)return;const L=e[N];if(g){p(L);return}k.current=L,x.current=!1,f(L),i(L)},[e,g,p]),M=c.useCallback(()=>{e.length!==0&&I(C<0?0:Math.min(C+1,e.length-1))},[e.length,C,I]),E=c.useCallback(()=>{e.length!==0&&I(C<=0?0:C-1)},[e.length,C,I]),T=c.useCallback(()=>I(0),[I]),P=c.useCallback(()=>I(e.length-1),[I,e.length]),$=c.useCallback(()=>{o&&p(o)},[o,p]),K=c.useCallback((N,L)=>{const S=Yc(L);return S==="range"?(m(e,N,o),!0):S==="toggle"?(p(N),!0):(w(),u(N),!1)},[e,o,m,p,w,u]),O=c.useCallback(N=>{const L=td(e,o,N);L!==void 0&&(m(e,L),k.current=L,x.current=!1,f(void 0),i(L))},[e,o,m]),j=c.useCallback(()=>O(-1),[O]),A=c.useCallback(()=>O(1),[O]),z=c.useCallback(()=>{e.length>0&&d(e)},[e,d]);return{focusedMessageId:o,setFocusedMessageId:b,keyboardFocusedMessageId:l,focusIndex:C,pendingDomFocusRef:k,cursorMovedByPointerRef:x,selection:h,isMultiSelectMode:g,exitSelection:w,moveFocusToIndex:I,focusNext:M,focusPrevious:E,focusFirst:T,focusLast:P,toggleFocusedSelection:$,extendRangeUp:j,extendRangeDown:A,selectAllLoaded:z,handleRowSelect:K}};function Yd(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const n=!!(e.condition??!0),a=e.blockerFn;return{shouldBlockFn:async()=>n&&a!==void 0?await a():n,enableBeforeUnload:n,withResolver:a===void 0}}function Jd(e,t){const{shouldBlockFn:n,enableBeforeUnload:a=!0,disabled:r=!1,withResolver:o=!1}=Yd(e),i=io(),{history:l}=i,[f,b]=c.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return c.useEffect(()=>{const h=async y=>{function p(g){const k=i.parseLocation(g),x=i.getMatchedRoutes(k.pathname);return x.foundRoute===void 0?{routeId:"__notFound__",fullPath:k.pathname,pathname:k.pathname,params:x.routeParams,search:i.options.parseSearch(g.search)}:{routeId:x.foundRoute.id,fullPath:x.foundRoute.fullPath,pathname:k.pathname,params:x.routeParams,search:i.options.parseSearch(g.search)}}const v=p(y.currentLocation),m=p(y.nextLocation);if(v.routeId==="__notFound__"&&m.routeId!=="__notFound__")return!1;const u=await n({action:y.action,current:v,next:m});if(!o)return u;if(!u)return!1;const d=await new Promise(g=>{b({status:"blocked",current:v,next:m,action:y.action,proceed:()=>g(!1),reset:()=>g(!0)})});return b({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),d};return r?void 0:l.block({blockerFn:h,enableBeforeUnload:a})},[n,a,r,o,l,i]),f}const ns=e=>{const{data:t,isLoading:n}=se({...tt(),staleTime:1/0,enabled:!!e}),a=c.useMemo(()=>(t?.accounts??[]).map(l=>l.accountId),[t?.accounts]),r=Us({queries:a.map(l=>({...yt({path:{accountId:l}}),staleTime:1/0,enabled:!!e}))}),o=n||r.some(l=>l.isLoading);return{accountId:c.useMemo(()=>{if(e){for(let l=0;l<a.length;l++)if((r[l].data?.items??[]).some(h=>h.mailboxId===e))return a[l]}},[e,a,r]),isLoading:o}},Xd=({surface:e})=>{const t=lo(),n=co(),{data:a}=se({...Yt({path:{messageId:e.sourceMessageId}})}),{data:r}=se({...tt(),staleTime:1/0}),{accountId:o}=ns(a?.message.mailboxId),i=r?.accounts?.find(l=>l.accountId===o);return s.jsx("div",{className:"border-b border-line bg-canvas",children:s.jsx(Di,{layout:"flow",mode:e.mode,account:i,sourceMessage:a,outboxMessageId:e.outboxMessageId,onDraftCreated:t,onClose:n})})},Zd=3e3,eu=(e,t,n)=>{if(e.length===0)return()=>{};const a=setTimeout(()=>n(e),t);return()=>clearTimeout(a)},Vs=(e,t,n)=>{const a=new Map(t.map(o=>[o.messageId,o.mailboxId])),r=new Set;for(const o of e)r.add(a.get(o)??n);return[...r]},Qt=(e,t,n)=>e.map(a=>t.has(a.messageId)?{...a,isRead:n}:a),tu=(e,t,n,a)=>e.filter(r=>!r.isRead&&t.has(r.threadMessageId)&&!n.has(r.messageId)&&!a.has(r.messageId)).map(r=>r.messageId),su=({messages:e,expandedIds:t,threadId:n,mailboxId:a,accountId:r})=>{const o=me(),{pushError:i}=ve(),l=c.useRef(new Set),f=c.useRef(new Set),{mutate:b}=ge({...Jt(),meta:uo,onMutate:async p=>{const v=new Set(p.body.messageIds??[]),m=p.body.isRead??!0,u=Ae({path:{threadId:n}}),d=Re(Vs(v,e,a));await Promise.all([o.cancelQueries({queryKey:u}),wt(o,d)]);const g=o.getQueriesData({queryKey:u}).filter(x=>x[1]!==void 0).map(([x,w])=>({queryKey:x,data:w})),k=Ct(o,d);return o.setQueriesData({queryKey:u},x=>x&&{...x,items:Qt(x.items,v,m)}),Nt(o,d,x=>Qt(x,v,m)),{threadMessagesPrefix:u,listPrefixes:d,previousThreadMessages:g,previousThreadsList:k}},onSuccess:(p,v)=>{const m=v.body.messageIds??[];for(const u of m)l.current.add(u),f.current.delete(u)},onError:(p,v,m)=>{const u=v.body.messageIds??[];for(const g of u)f.current.delete(g);if(m){for(const g of m.previousThreadMessages)o.setQueryData(g.queryKey,g.data);jt(o,m.previousThreadsList)}const d=v.body.isRead??!0;i({title:d?"Couldn't mark as read":"Couldn't mark as unread",detail:Me(p),error:p})},onSettled:(p,v,m,u)=>{u&&(o.invalidateQueries({queryKey:u.threadMessagesPrefix}),Ee(o,u.listPrefixes),r&&o.invalidateQueries({queryKey:kt({path:{accountId:r}})}))}}),h=c.useCallback(p=>{const v=p.filter(m=>!l.current.has(m)&&!f.current.has(m));if(v.length!==0){for(const m of v)f.current.add(m);b({body:{messageIds:v,isRead:!0}})}},[b]),y=c.useMemo(()=>tu(e,t,l.current,f.current),[e,t]);c.useEffect(()=>eu(y,Zd,h),[y,h]),c.useEffect(()=>{l.current.clear(),f.current.clear()},[n])},Wp=e=>{const{mailboxId:t,accountId:n,messages:a}=e,r=me(),{pushError:o}=ve(),{mutateAsync:i,isPending:l}=ge({...Jt(),onError:(b,h)=>{const y=h.body.isRead??!0;o({title:y?"Couldn't mark as read":"Couldn't mark as unread",detail:Me(b),error:b})},onSettled:(b,h,y)=>{Ee(r,Re(Vs(y.body.messageIds??[],a??[],t))),n&&r.invalidateQueries({queryKey:kt({path:{accountId:n}})})}});return{toggleReadFor:c.useCallback((b,h)=>{b.length!==0&&pt(b,y=>i({body:{messageIds:y,isRead:h}}))},[i]),isPending:l}},nu=60,au=1.5,ru=(e,t,n)=>{const a=Math.abs(e),r=Math.abs(t);return a<n?{direction:null}:a<r*au?{direction:null}:{direction:e<0?"left":"right"}},ou=({onSwipeLeft:e,onSwipeRight:t,thresholdPx:n=nu})=>{const a=c.useRef(null),r=c.useCallback(f=>{if(f.pointerType==="mouse"){a.current=null;return}a.current={x:f.clientX,y:f.clientY}},[]),o=c.useCallback(()=>{},[]),i=c.useCallback(f=>{const b=a.current;if(a.current=null,!b)return;const{direction:h}=ru(f.clientX-b.x,f.clientY-b.y,n);h==="left"&&e?.(),h==="right"&&t?.()},[e,t,n]),l=c.useCallback(()=>{a.current=null},[]);return{handlers:{onPointerDown:r,onPointerMove:o,onPointerUp:i,onPointerCancel:l}}},iu=(e,t,n)=>t?.find(a=>a.messageId===e)?.mailboxId??n,Fn=(e,t,n)=>e.map(a=>a.messageId===t?{...a,hasStars:n}:a),mr=({threadId:e,mailboxId:t,messages:n})=>{const a=me(),{pushError:r}=ve(),{mutate:o,isPending:i,variables:l}=ge({...mo(),onMutate:async b=>{const h=b.path.messageId,y=b.body.isStarred??!1,p=Ae({path:{threadId:e}}),v=Re([iu(h,n,t)]);await Promise.all([a.cancelQueries({queryKey:p}),wt(a,v)]);const m=a.getQueriesData({queryKey:p}).filter(d=>d[1]!==void 0).map(([d,g])=>({queryKey:d,data:g})),u=Ct(a,v);return a.setQueriesData({queryKey:p},d=>fo(d,g=>Fn(g,h,y))),Nt(a,v,d=>Fn(d,h,y)),{threadMessagesPrefix:p,listPrefixes:v,previousThreadMessages:m,previousThreadsList:u}},onError:(b,h,y)=>{if(y){for(const v of y.previousThreadMessages)a.setQueryData(v.queryKey,v.data);jt(a,y.previousThreadsList)}const p=h.body.isStarred??!1;r({title:p?"Couldn't star message":"Couldn't unstar message",detail:Me(b),error:b})},onSettled:(b,h,y,p)=>{p&&(a.invalidateQueries({queryKey:p.threadMessagesPrefix}),Ee(a,p.listPrefixes))}});return{toggleStar:(b,h)=>{o({path:{messageId:b},body:{isStarred:!h}})},isPending:i,pendingMessageId:i?l?.path.messageId:void 0}};function Dn({authenticity:e,onOpenIntelligence:t}){return e.dkimMismatch?s.jsxs("div",{className:"flex items-start gap-2 rounded-none border-b border-danger/20 bg-danger-soft px-5 py-2.5 text-sm",children:[s.jsx(nt,{className:"mt-0.5 size-4 shrink-0 text-danger"}),s.jsxs("p",{className:"flex-1 leading-snug text-fg",children:["This message claims to be from"," ",s.jsx("span",{className:"font-semibold",children:e.fromDomain})," but was sent",e.dkimDomain?` via ${e.dkimDomain}`:" from a different domain","."," ",t&&s.jsx("button",{type:"button",onClick:t,className:"font-medium text-danger hover:underline",children:"Why?"})]})]}):null}function pr(e){return e===void 0?"uncategorized":e}const lu={inbox:"Inbox",junk:"Junk"},Ys=e=>e.destinationMailboxId!==void 0,cu=(e,t)=>{if(Ys(e))return`Moved from ${t??"another folder"} by Remit`;const n=e.fromPlacement??"";return`Moved from ${lu[n]??"another folder"} by Remit`},du=(e,t)=>{if(e===rn.MoveToInbox)return t.inboxMailboxId;if(e===rn.MoveToJunk)return t.junkMailboxId},uu=(e,t,n)=>{if(!e||!t)return!1;const a=Ys(e)?e.destinationMailboxId:du(e.action,n);return a!==void 0&&a===t},fu="Reported as spam",mu=(e,t)=>{if(e){if(Ys(e))return e.fromMailboxId;if(e.fromPlacement==="inbox")return t.inboxMailboxId;if(e.fromPlacement==="junk")return t.junkMailboxId}},It=(e,t)=>{const{data:n,isLoading:a}=se({...tt(),staleTime:1/0,enabled:!!e});return{mailboxId:c.useMemo(()=>e?n?.accounts.find(i=>i.accountId===e)?.folderAppointments.find(i=>i.role===t)?.mailboxId:void 0,[n,e,t]),isLoading:a}},Gp=e=>{const{mailboxId:t,isLoading:n}=It(e,"Archive");return{archiveMailboxId:t,isLoading:n}},Vp=e=>{const{mailboxId:t,isLoading:n}=It(e,"Drafts");return{draftsMailboxId:t,isLoading:n}},pu=e=>{const{mailboxId:t,isLoading:n}=It(e,"Inbox");return{inboxMailboxId:t,isLoading:n}},hr=e=>{const{mailboxId:t,isLoading:n}=It(e,"Junk");return{junkMailboxId:t,isLoading:n}},Yp=e=>{const{mailboxId:t,isLoading:n}=It(e,"Trash");return{trashMailboxId:t,isLoading:n}},hu=()=>{const{data:e,isError:t}=se({...tt(),staleTime:1/0});return{trashByAccount:c.useMemo(()=>{const a=new Map;for(const r of e?.accounts??[]){const o=r.folderAppointments.find(i=>i.role==="Trash");a.set(r.accountId,{mailboxId:o?.mailboxId,source:o?.source??"None",staleFolderPath:o?.staleAppointmentPath})}return a},[e]),hasAppointments:e!==void 0,isError:t}},gr=e=>{const{data:t}=se({...tt(),staleTime:1/0,enabled:!!e});return c.useMemo(()=>t?.accounts.find(n=>n.accountId===e)?.folderAppointments??[],[t,e])},gu=new Set(["in_flight"]),On=(e,t)=>{const n=e?.[t];return typeof n=="string"?n:void 0},xr=e=>{const t=po(e);if(t?.code!=="message_placement_unsettled")return;const{details:n}=t;if(!n)return;const a=On(n,"reason"),r=On(n,"messageId");if(!(!a||!gu.has(a)||!r))return{reason:a,messageId:r}},br=(e,t,n)=>({severity:"warning",title:t>1?`Couldn't ${n} ${t} messages yet`:`Couldn't ${n} this message yet`,detail:"It is still being moved on the mail server. Try again in a moment."}),zn=(e,t)=>e.filter(n=>!t.has(n.messageId)),Et=({mailboxId:e,threadId:t,accountId:n,onAfterOptimisticRemove:a})=>{const r=me(),{pushError:o}=ve(),{mutateAsync:i,isPending:l,isError:f}=ge({...ho(),meta:ca(409),onMutate:async h=>{const y=new Set(h.body.messageIds??[]),p=t?Ae({path:{threadId:t}}):[],v=Re([e,h.body.destinationMailboxId]);await Promise.all([...t?[r.cancelQueries({queryKey:p})]:[],wt(r,v)]);const m=t?r.getQueriesData({queryKey:p}).filter(d=>d[1]!==void 0).map(([d,g])=>({queryKey:d,data:g})):[],u=Ct(r,v);return t&&r.setQueriesData({queryKey:p},d=>d&&{...d,items:zn(d.items,y)}),Nt(r,v,d=>zn(d,y)),a?.(Array.from(y)),{threadMessagesPrefix:p,listPrefixes:v,previousThreadMessages:m,previousThreadsList:u}},onError:(h,y,p)=>{if(p){for(const u of p.previousThreadMessages)r.setQueryData(u.queryKey,u.data);jt(r,p.previousThreadsList)}const v=y.body.messageIds?.length??0,m=xr(h);if(m){o(br(m,v,"move"));return}o({title:v>1?`Couldn't move ${v} messages`:"Couldn't move this message",detail:Me(h),error:h})},onSettled:(h,y,p,v)=>{v&&(t&&r.invalidateQueries({queryKey:v.threadMessagesPrefix}),Ee(r,v.listPrefixes),n&&r.invalidateQueries({queryKey:kt({path:{accountId:n}})}))}});return{moveMessages:c.useCallback((h,y)=>{h.length!==0&&pt(h,p=>i({body:{messageIds:p,destinationMailboxId:y}}))},[i]),isPending:l,isError:f}},xu="This message could not be processed. Please try again. If it keeps failing, report it.",bu=(e,t)=>e.replace(`Message ${t}'s`,"This message's"),_n=e=>{if(e.failureCount===0)return;const t=e.failures?.[0],n=t?.reason??xu,a=t?bu(n,t.messageId):n;throw new bo(a,422)};function vr({mailboxId:e,threadId:t,accountId:n,onAfterOptimisticRemove:a}){const r=me(),{pushError:o}=ve(),i=Re([e]),l=t?Ae({path:{threadId:t}}):[],f=()=>{t&&r.invalidateQueries({queryKey:l}),Ee(r,i),n&&r.invalidateQueries({queryKey:kt({path:{accountId:n}})})},b=()=>(u,d)=>{f(),a?.(d.body.messageIds)},h=u=>(d,g)=>{o({title:u(g.body.messageIds.length),detail:Me(d),error:d})},y=ge({mutationFn:async u=>{const{data:d}=await go({...u,throwOnError:!0});return _n(d),d},meta:{softError:!0},onSuccess:b(),onError:h(u=>u>1?`Couldn't report ${u} messages as spam`:"Couldn't report this message as spam")}),p=ge({mutationFn:async u=>{const{data:d}=await xo({...u,throwOnError:!0});return _n(d),d},meta:{softError:!0},onSuccess:b(),onError:h(u=>u>1?`Couldn't undo the spam report for ${u} messages`:"Couldn't undo the spam report")}),v=c.useCallback(u=>{u.length!==0&&pt(u,d=>y.mutateAsync({body:{messageIds:d}}))},[y.mutateAsync]),m=c.useCallback(u=>{u.length!==0&&pt(u,d=>p.mutateAsync({body:{messageIds:d}}))},[p.mutateAsync]);return{reportSpam:v,notSpam:m,isReporting:y.isPending,isRestoring:p.isPending}}const vu=({accountId:e,messageId:t,threadId:n,mailboxId:a,autoMoved:r,spamReport:o})=>{const{inboxMailboxId:i}=pu(e),{junkMailboxId:l}=hr(e),{moveMessages:f,isPending:b}=Et({mailboxId:a,threadId:n,accountId:e}),{notSpam:h,isRestoring:y}=vr({mailboxId:a,threadId:n,accountId:e}),{data:p}=se({...yt({path:{accountId:e??""}}),staleTime:1/0,enabled:!!e&&r?.fromMailboxId!==void 0}),v={inboxMailboxId:i,junkMailboxId:l},m=mu(r,v),u=c.useCallback(()=>{m&&f([t],m)},[f,t,m]),d=c.useCallback(()=>{h([t])},[h,t]);if(o)return{show:!0,label:fu,onUndo:d,isUndoing:y};if(!uu(r,a,v)||!r)return{show:!1,label:"",isUndoing:!1};const k=r.fromMailboxId?p?.items.filter(x=>x.mailboxId===r.fromMailboxId).map(x=>vo(x))[0]:void 0;return{show:!0,label:cu(r,k),onUndo:m?u:void 0,isUndoing:b,...r.filterId?{filtersHref:"/settings/filters"}:{}}};function yu({accountId:e,messageId:t,threadId:n,mailboxId:a,autoMoved:r,spamReport:o}){const i=vu({accountId:e,messageId:t,threadId:n,mailboxId:a,autoMoved:r,spamReport:o});return i.show?s.jsx(Rc,{label:i.label,onUndo:i.onUndo,undoLabel:i.isUndoing?"Undoing…":"Undo",filtersHref:i.filtersHref}):null}const ku=({trigger:e,children:t,align:n="right"})=>{const[a,r]=c.useState(!1),o=c.useRef(null),i=c.useCallback(l=>{o.current&&!o.current.contains(l.target)&&r(!1)},[]);return Xt({id:"dropdown-menu",open:a,answers:{back:()=>r(!1)}}),c.useEffect(()=>(a&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)),[a,i]),s.jsxs("div",{ref:o,className:"relative",children:[s.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),r(!a)},className:F("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}),a&&s.jsx("div",{className:F("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})]})},zt=({onClick:e,disabled:t,destructive:n,children:a})=>s.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),t||e()},disabled:t,className:F("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:a}),ju=()=>s.jsx("div",{className:"my-1 h-px bg-line"}),Un=(e,t)=>e.filter(n=>!t.has(n.messageId)),Jp=e=>e.filter(t=>t.isDeleted!==!0),as=({mailboxId:e,threadId:t,accountId:n,messages:a,onAfterOptimisticRemove:r})=>{const o=me(),{pushError:i}=ve(),{requestAppointment:l}=da(),f=c.useRef([]),b=c.useRef(async()=>{}),{mutateAsync:h,isPending:y}=ge({...ko(),meta:ca(409),onMutate:async m=>{const u=new Set(m.body.messageIds??[]),d=t?Ae({path:{threadId:t}}):[],g=Re(Vs(u,a??[],e));await Promise.all([o.cancelQueries({queryKey:d}),wt(o,g)]);const k=t?o.getQueriesData({queryKey:d}).filter(w=>w[1]!==void 0).map(([w,C])=>({queryKey:w,data:C})):[],x=Ct(o,g);return t&&o.setQueriesData({queryKey:d},w=>w&&{...w,items:Un(w.items,u)}),Nt(o,g,w=>Un(w,u)),r?.(Array.from(u)),{threadMessagesPrefix:d,listPrefixes:g,previousThreadMessages:k,previousThreadsList:x}},onSuccess:(m,u)=>{const d=m?.failureCount??0;if(d===0)return;const g=u.body.messageIds?.length??0;i({severity:"warning",title:d>1?`Couldn't delete ${d} of ${g} messages yet`:"Couldn't delete this message yet",detail:"Something else moved it while the delete was being prepared. It is back where it now sits — try again."})},onError:(m,u,d)=>{if(d){for(const w of d.previousThreadMessages)o.setQueryData(w.queryKey,w.data);jt(o,d.previousThreadsList)}const g=yo(m);if(g){const w=f.current;l({accountId:g.accountId,role:g.role,reason:g.reason,action:{kind:"delete",count:w.length},onAppointed:()=>b.current(w)});return}const k=u.body.messageIds?.length??0,x=xr(m);if(x){i(br(x,k,"delete"));return}i({title:k>1?`Couldn't delete ${k} messages`:"Couldn't delete this message",detail:Me(m),error:m})},onSettled:(m,u,d,g)=>{g&&(t&&o.invalidateQueries({queryKey:g.threadMessagesPrefix}),Ee(o,g.listPrefixes),n&&o.invalidateQueries({queryKey:kt({path:{accountId:n}})}))}}),p=c.useCallback(m=>pt(m,u=>h({body:{messageIds:u}})),[h]);return c.useEffect(()=>{b.current=p},[p]),{deleteMessages:c.useCallback(m=>{m.length!==0&&(f.current=m,p(m))},[p]),isPending:y}},yr="inline-flex items-center justify-center transition-colors",wu=F(yr,"min-h-11 min-w-11 rounded hover:bg-surface-raised"),Cu=F(yr,"min-h-11 gap-1.5 px-3 rounded text-sm font-medium hover:bg-surface-raised"),rs=({accountId:e,currentMailboxId:t,onMove:n,disabled:a=!1,disabledHint:r,variant:o="icon-only",label:i,defaultOpen:l=!1})=>{const[f,b]=c.useState(l),[h,y]=c.useState(),p=Os(),v=c.useRef(null),m=c.useRef(null),u=c.useRef(null),d=i??"Move to folder",g=c.useId(),k=ua(),{data:x,isLoading:w,isError:C,error:I,refetch:M}=se({...yt({path:{accountId:e}}),staleTime:1/0,enabled:f}),E=gr(e),{createFolderIn:T}=fa(e),P=c.useMemo(()=>ma({mailboxes:x?.items??[],folderAppointments:E,currentMailboxId:t,translator:k}),[x?.items,E,t,k]),$=pa(x?.items??[]),K=P.find(_=>_.id===h),O=c.useCallback(()=>{b(!1),y(void 0);const _=document.activeElement;_&&m.current?.contains(_)&&u.current?.focus()},[]),j=c.useCallback(()=>{K&&(O(),n(K.id))},[K,O,n]);Xt({id:"move-to",open:f,answers:{back:O}}),c.useEffect(()=>{if(!f||!p)return;const _=B=>{const W=B.target;v.current?.contains(W)||m.current?.contains(W)||O()};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[f,p,O]);const A=()=>v.current?.getBoundingClientRect()??null,z=a||!!r,N=s.jsxs("button",{type:"button",ref:u,onClick:_=>{_.stopPropagation(),!z&&b(B=>!B)},"aria-label":d,"aria-haspopup":p?"tree":"dialog","aria-expanded":f,"aria-controls":f?g:void 0,title:r,className:o==="icon-only"?wu:Cu,children:[s.jsx(Ds,{className:o==="icon-only"?"size-5":"size-4"}),o==="compact"&&s.jsx("span",{className:"hidden sm:inline",children:"Move"})]}),L=w?s.jsx("div",{className:"px-3 py-5 text-sm text-fg-muted",children:"Loading folders…"}):C?s.jsx("div",{className:"p-3",children:s.jsx(Be,{variant:"inline",title:"Couldn't load folders",error:I,onRetry:()=>M()})}):s.jsx(jo,{folders:P,selectedId:h,delimiter:$,onSelect:y,onCreateFolder:T,onCancel:O,autoFocusFilter:p,labels:{filterPlaceholder:"Filter folders…",filterAriaLabel:"Filter folders"}}),S=K&&s.jsx("div",{className:"shrink-0 border-t border-line p-2",children:s.jsx(H,{variant:"primary",onClick:j,className:"h-11 w-full font-semibold",children:`Move to ${K.label}`})});return p?s.jsxs("div",{ref:v,className:"relative inline-block",children:[N,s.jsx(Si,{open:f,align:"end",panelRef:m,getAnchor:A,children:s.jsxs("div",{id:g,ref:m,className:F("w-72 max-h-96 flex flex-col","bg-surface border border-line rounded-md shadow-lg"),children:[L,S]})})]}):s.jsxs(s.Fragment,{children:[N,s.jsx(Ve.Root,{open:f,onOpenChange:_=>_?b(!0):O(),children:s.jsxs(Ve.Portal,{children:[s.jsx(Ve.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),s.jsxs(Ve.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{maxHeight:"85dvh"},id:g,children:[s.jsx(Ve.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-subtle/30"}),s.jsx(Ve.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:"Move to folder"}),s.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:L}),S]})]})})]})},Nu=({messageId:e,threadId:t,mailboxId:n,isRead:a,accountId:r,fromAddressId:o,isTrusted:i=!1,showRaw:l=!1,onToggleRaw:f})=>{const b=me(),h=bi(),{pushError:y}=ve(),p=vi()?.messageId,{mutate:v,isPending:m}=ge({...Jt(),onMutate:async A=>{const z=A.body.isRead??!0,N=new Set(A.body.messageIds??[]),L=Ae({path:{threadId:t}}),S=Re([n]);await Promise.all([b.cancelQueries({queryKey:L}),wt(b,S)]);const _=b.getQueriesData({queryKey:L}).filter(W=>W[1]!==void 0).map(([W,X])=>({queryKey:W,data:X})),B=Ct(b,S);return b.setQueriesData({queryKey:L},W=>W&&{...W,items:Qt(W.items,N,z)}),Nt(b,S,W=>Qt(W,N,z)),{threadMessagesPrefix:L,listPrefixes:S,previousThreadMessages:_,previousThreadsList:B}},onError:(A,z,N)=>{if(N){for(const S of N.previousThreadMessages)b.setQueryData(S.queryKey,S.data);jt(b,N.previousThreadsList)}const L=z.body.isRead??!0;y({title:L?"Couldn't mark as read":"Couldn't mark as unread",detail:Me(A),error:A})},onSettled:(A,z,N,L)=>{L&&(b.invalidateQueries({queryKey:L.threadMessagesPrefix}),Ee(b,L.listPrefixes))}}),u=c.useCallback(A=>{p&&A.includes(p)&&h()},[p,h]),{deleteMessages:d,isPending:g}=as({mailboxId:n,threadId:t,onAfterOptimisticRemove:u}),{moveMessages:k,isPending:x}=Et({mailboxId:n,threadId:t,accountId:r,onAfterOptimisticRemove:u}),{toggleTrusted:w,isPending:C,error:I,reset:M}=Ta({messageId:e}),E=()=>{v({body:{messageIds:[e],isRead:!1}})},T=()=>{d([e])},P=()=>{o&&w(o,i)},$=m||g||x||C,K=$||!o,O=c.useCallback(A=>{k([e],A)},[k,e]),j=o?void 0:"Sender has no parseable address";return s.jsxs("div",{className:"flex flex-col items-end gap-1",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[r&&s.jsx(rs,{accountId:r,currentMailboxId:n,onMove:O,disabled:$,label:"Move this message"}),s.jsxs(ku,{trigger:s.jsx(Ti,{className:"size-4"}),children:[s.jsxs(zt,{onClick:P,disabled:K,children:[i?s.jsx(ts,{className:"size-4 text-positive"}):s.jsx(Gt,{className:"size-4 opacity-0"}),s.jsx("span",{title:j,children:"Trusted sender"})]}),a&&s.jsxs(zt,{onClick:E,disabled:$,children:[s.jsx(qs,{className:"size-4"}),"Mark as unread"]}),f&&s.jsxs(zt,{onClick:f,children:[s.jsx(Wa,{className:"size-4"}),l?"Show formatted":"Show raw email"]}),s.jsx(ju,{}),s.jsxs(zt,{onClick:T,disabled:$,destructive:!0,children:[s.jsx(vt,{className:"size-4"}),"Delete"]})]})]}),I&&s.jsx("div",{className:"w-64",children:s.jsx(Be,{variant:"inline",title:"Couldn't update trust",error:I,onRetry:()=>{M(),P()}})})]})},Su=e=>e==="link-expired"||e==="not-ready";class Es extends Error{reason;status;constructor(t,n,a){super(n),this.name="AttachmentFetchError",this.reason=t,this.status=a}}const Tu="x-remit-403-reason",Iu="expired",Eu=(e,t)=>{if(t?.trim()===Iu)return"link-expired";const n=Bi(e,t);return n==="auth"?"auth":n==="body-missing"?"missing":"generic"},Ru=300*1e3,Bn=async(e,t)=>{const n={},a=await t();a&&(n.Authorization=`Bearer ${a}`);const r=await wo(e,{headers:n,signal:AbortSignal.timeout(Ru)});if(r.status===202)throw new Es("not-ready","Attachment is still being fetched from the mail server",202);if(!r.ok)throw new Es(Eu(r.status,r.headers.get(Tu)),`Failed to download attachment (${r.status} ${r.statusText})`,r.status);return r.blob()},Mu=(e,t,n)=>{switch(e){case"auth":return{title:"Your session expired",detail:`Sign in again, then download ${t} once more. Other parts of the app may also stop responding until you do.`};case"link-expired":return{title:"This download link expired and could not be renewed",detail:`Reload the page, then download ${t} again. If that keeps failing, this is worth reporting.`};case"missing":return{title:"This attachment is missing from storage",detail:"Remit has the message but not the file. Re-sync the account from Settings, then try again."};case"not-ready":return{title:"Still fetching this attachment",detail:"Remit is downloading it from the mail server now. Try again in a few seconds."};default:return{title:"Couldn't download this attachment",detail:n}}},Kn=e=>e instanceof Es?e.reason:"generic",Au=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while downloading this attachment.",$u=(e,t,n)=>{if(e!=="auth")return ha(ga({title:`Bug: attachment download failed (${e})`,errorMessage:`Downloading "${t}" failed: ${n}`}))},Lu=(e,t)=>{const n=URL.createObjectURL(e),a=document.createElement("a");a.href=n,a.download=t,a.rel="noopener",document.body.append(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)},Pu=e=>{const t=e.toUpperCase();return t==="OCTET-STREAM"?"FILE":t},Fu=e=>{const t=e.toLowerCase().replace(/[^a-z0-9]/g,"");return t.length>0?`attachment.${t}`:"attachment"},Hn=e=>e.filter(t=>!t.isMultipart&&t.disposition===Co.Attachment&&t.contentUrl.length>0).map(t=>({bodyPartId:t.bodyPartId,filename:Oi(t.dispositionFilename??"",Fu(t.mediaSubtype)),typeLabel:Pu(t.mediaSubtype),sizeOctets:t.sizeOctets,contentUrl:t.contentUrl})),qn={status:"idle"},Du=({messageId:e,bodyParts:t,hasAttachment:n=!1,className:a})=>{const{getToken:r}=xa(),o=me(),[i,l]=c.useState({}),f=c.useMemo(()=>Hn(t??[]),[t]),b=No({path:{messageId:e}}),h=m=>Bn(m.contentUrl,r).catch(u=>{if(!Su(Kn(u)))throw u;return o.refetchQueries({queryKey:b}).then(()=>{const d=o.getQueryData(b),g=d?Hn(d.bodyParts).find(k=>k.bodyPartId===m.bodyPartId):void 0;return Bn(g?.contentUrl??m.contentUrl,r)})}),y=(m,u)=>l(d=>({...d,[m]:u})),p=m=>{const u=f.find(d=>d.bodyPartId===m);if(!u)throw new Error(`No attachment part ${m} on message ${e}`);y(m,{status:"downloading"}),h(u).then(d=>{Lu(d,u.filename),y(m,qn)}).catch(d=>{const g=Kn(d),k=Au(d),{title:x,detail:w}=Mu(g,u.filename,k);y(m,{status:"failed",title:x,detail:w,reportUrl:$u(g,u.filename,k)})})},v=n&&t!==void 0&&f.length===0;return s.jsx(Ec,{className:a,attachments:f.map(m=>({attachmentId:m.bodyPartId,filename:m.filename,typeLabel:m.typeLabel,sizeOctets:m.sizeOctets,download:i[m.bodyPartId]??qn})),onDownload:p,hasUnlistedAttachment:v})},kr=e=>e.syncStatus===So.abandoned?e.abandonedMutation:ht.none;function Ou({threadMessage:e,accountId:t,className:n}){const a=kr(e),r=a===ht.delete?"delete_failed":a===ht.move?"move_failed":void 0,{accountId:o}=ns(r==="move_failed"&&!t?e.mailboxId:void 0),i=t??o,{deleteMessages:l,isPending:f}=as({mailboxId:e.mailboxId,threadId:e.threadId,accountId:i,messages:[e]}),{moveMessages:b,isPending:h}=Et({mailboxId:e.mailboxId,threadId:e.threadId,accountId:i}),y=c.useCallback(()=>{l([e.messageId])},[l,e.messageId]),p=c.useCallback(m=>{b([e.messageId],m)},[b,e.messageId]),v=c.useMemo(()=>r?ha(ga({title:Ht[r].title,errorMessage:`Message ${e.messageId}: status=${e.status} syncStatus=${e.syncStatus} abandonedMutation=${e.abandonedMutation}`})):void 0,[r,e.messageId,e.status,e.syncStatus,e.abandonedMutation]);return r?s.jsx(nd,{settlement:r,onRetry:r==="delete_failed"?y:void 0,action:r==="move_failed"&&i?s.jsx(rs,{accountId:i,currentMailboxId:e.mailboxId,onMove:p,disabled:h,variant:"compact",label:Ht.move_failed.retryLabel}):void 0,retryPending:r==="delete_failed"?f:h,reportHref:v,className:n}):null}const zu=({messageId:e,threadId:t,mailboxId:n,accountId:a,isRead:r,isStarred:o,onToggleStar:i,fromAddressId:l,isTrusted:f,showRaw:b,onToggleRaw:h,onReply:y,onReplyAll:p,onForward:v})=>{const m=me(),{deleteMessages:u}=as({mailboxId:n,threadId:t}),{moveMessages:d}=Et({mailboxId:n,threadId:t,accountId:a}),{toggleTrusted:g}=Ta({messageId:e}),{mutate:k}=ge({...Jt(),onSettled:()=>{m.invalidateQueries({queryKey:Ae({path:{threadId:t}})}),Ee(m,Re([n]))}}),x=c.useCallback(M=>{d([e],M)},[d,e]),w=c.useCallback(()=>{u([e])},[u,e]),C=c.useCallback(()=>{k({body:{messageIds:[e],isRead:!r}})},[k,e,r]),I=[];return l&&I.push({key:"trusted",label:f?"Trusted sender":"Mark sender trusted",icon:f?s.jsx(ts,{className:"size-4 text-positive"}):s.jsx(Gt,{className:"size-4"}),onSelect:()=>g(l,f)}),h&&I.push({key:"raw",label:b?"Show formatted":"Show raw email",icon:s.jsx(Wa,{className:"size-4"}),onSelect:h}),s.jsx(ar,{hasThread:!0,onReply:y,onReplyAll:p,onForward:v,isStarred:o,onToggleStar:i,onDelete:w,isRead:r,onToggleRead:C,overflowItems:I,moveSlot:a?s.jsx(rs,{accountId:a,currentMailboxId:n,onMove:x,label:"Move this message"}):void 0})},_u=()=>s.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading raw email",children:[s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"}),s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"})]}),Uu=({messageId:e,enabled:t=!0})=>{const{data:n,isLoading:a,isError:r,error:o,refetch:i}=se({...To({path:{messageId:e}}),enabled:t});if(a)return s.jsx("div",{className:"message-body",children:s.jsx(_u,{})});if(r)return s.jsx("div",{className:"message-body",children:s.jsx(Be,{variant:"inline",title:"Couldn't load the raw email",error:o,onRetry:()=>i()})});const l=n?.raw??"";return l===""?s.jsx("div",{className:"message-body",children:s.jsx("p",{className:"text-fg-muted text-sm italic",children:"No raw source available for this message."})}):s.jsx("div",{className:"message-body",children:s.jsx("pre",{className:"email-text whitespace-pre-wrap break-words text-sm leading-relaxed bg-surface-sunken rounded-md p-3 max-h-[32rem] overflow-auto",children:l})})},Bu=()=>s.jsx(ts,{className:"inline-block size-4 ml-1 -mt-0.5 text-positive align-middle","aria-label":"Trusted sender","data-testid":"trusted-sender-badge"}),jr=(e,t)=>({id:e.messageId,fromName:e.fromName??e.fromEmail??"?",fromEmail:e.fromEmail??"",toLabel:"",dateLabel:t,snippet:e.snippet||"",bodyHtml:""}),wr=({isStarred:e,onToggleStar:t,isStarPending:n,hoverReveal:a})=>s.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),t()},disabled:n,"aria-label":e?"Remove star":"Add star",className:F("shrink-0 p-0.5 rounded transition-colors",e?"text-warning":F("text-fg-subtle hover:text-warning",a&&"opacity-0 group-hover:opacity-100 focus:opacity-100"),n&&"opacity-50"),children:s.jsx(et,{className:F("size-3.5",e&&"fill-current")})}),Ku=({threadMessage:e,isFocused:t,onToggle:n,onToggleStar:a,isStarPending:r})=>{const o=ba(e.sentDate,"datetime"),i=jr(e,o);return s.jsx(rr,{message:i,onClick:n,isFocused:t,isUnread:!e.isRead,trailing:s.jsxs(s.Fragment,{children:[e.hasAttachment&&s.jsx(Zt,{className:"size-3 shrink-0 text-fg-subtle",role:"img","aria-label":"Has an attachment"}),s.jsx(wr,{isStarred:e.hasStars,onToggleStar:a,isStarPending:r,hoverReveal:!0}),s.jsx("span",{"data-testid":"message-date",className:"shrink-0 text-2xs text-fg-subtle tabular-nums",children:o})]})})},Hu=({threadMessage:e,messageData:t,isLoading:n,isError:a,error:r,onRetry:o,isFocused:i,onToggle:l,onToggleStar:f,isStarPending:b,accountId:h,showRaw:y,onToggleRaw:p,mobile:v,onReply:m,onReplyAll:u,onForward:d})=>{const g=ba(e.sentDate,"long"),k=!e.isRead,x=t?.envelope.from[0]?.flags?.trusted?.value===!0,w=t?.envelope.from[0]?.flags?.blocked?.value===!0,C=t?.envelope.from[0]?.addressId,I=jr(e,g),M=e.autoMoved||e.spamReport?s.jsx(yu,{accountId:h,messageId:e.messageId,threadId:e.threadId,mailboxId:e.mailboxId,autoMoved:e.autoMoved,spamReport:e.spamReport}):null;return s.jsx(or,{message:I,isFocused:v?!1:i,onHeaderClick:l,senderBadge:x&&!w?s.jsx(Bu,{}):void 0,trailing:s.jsx("span",{"data-testid":"message-date",className:"text-2xs text-fg-subtle",children:g}),to:t?s.jsx(Tc,{label:"To",addresses:t.envelope.to}):null,indicators:M||!v?s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-0.5",children:[M,!v&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex items-center justify-end gap-1",children:s.jsx(wr,{isStarred:e.hasStars,onToggleStar:f,isStarPending:b})}),k&&s.jsx("span",{className:"size-1.5 rounded-full bg-accent","aria-label":"Unread"})]})]}):void 0,actionMenu:v?void 0:s.jsx(Nu,{messageId:e.messageId,threadId:e.threadId,mailboxId:e.mailboxId,isRead:e.isRead,accountId:h,fromAddressId:C,isTrusted:x,showRaw:y,onToggleRaw:p}),actionBar:v?s.jsx(zu,{messageId:e.messageId,threadId:e.threadId,mailboxId:e.mailboxId,accountId:h,isRead:e.isRead,isStarred:e.hasStars,onToggleStar:f,fromAddressId:C,isTrusted:x,showRaw:y,onToggleRaw:p,onReply:m,onReplyAll:u,onForward:d}):void 0,body:s.jsxs(s.Fragment,{children:[s.jsx(Ou,{threadMessage:e,accountId:h,className:"mt-3"}),n?s.jsxs("div",{className:"mt-3 animate-pulse space-y-2",children:[s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-1/2"})]}):a&&Io(r)?s.jsx("div",{className:"mt-3",children:s.jsx(Aa,{message:"This message has been deleted"})}):a?s.jsx("div",{className:"mt-3",children:s.jsx(Be,{variant:"inline",title:"Couldn't load this message",error:r,onRetry:o})}):y?s.jsx("div",{className:"mt-3",children:s.jsx(Uu,{messageId:e.messageId})}):s.jsxs("div",{className:"mt-3",children:[s.jsx(Mi,{bodyParts:t?.bodyParts,messageId:e.messageId,fromAddressId:t?.envelope.from[0]?.addressId,isTrusted:x,isBlocked:w,category:pr(e.category)}),s.jsx(Du,{messageId:e.messageId,bodyParts:t?.bodyParts,hasAttachment:e.hasAttachment,className:"mt-4"})]})]})})},qu=({threadMessage:e,isExpanded:t,isFocused:n,onToggle:a,onToggleStar:r,isStarPending:o,accountId:i,mobile:l,onReply:f,onReplyAll:b,onForward:h})=>{const[y,p]=c.useState(!1),{data:v,isLoading:m,isError:u,error:d,refetch:g}=se({...Yt({path:{messageId:e.messageId}}),enabled:t,meta:{softError:!0}});return t?s.jsx(Hu,{threadMessage:e,messageData:v,isLoading:m,isError:u,error:d,onRetry:()=>g(),isFocused:n,onToggle:a,onToggleStar:r,isStarPending:o,accountId:i,showRaw:y,onToggleRaw:()=>p(k=>!k),mobile:l,onReply:f,onReplyAll:b,onForward:h}):s.jsx(Ku,{threadMessage:e,isFocused:n,onToggle:a,onToggleStar:r,isStarPending:o})},Qu=()=>s.jsxs("div",{className:"animate-pulse p-4",children:[s.jsx("div",{className:"h-6 bg-surface-sunken rounded w-3/4 mb-5"}),s.jsx("div",{className:"space-y-4",children:Array.from({length:2}).map((e,t)=>s.jsxs("div",{className:"flex gap-3 py-3",children:[s.jsx("div",{className:"size-10 bg-surface-sunken rounded-full shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-4 bg-surface-sunken rounded w-32 mb-2"}),s.jsx("div",{className:"h-3 bg-surface-sunken rounded w-48"})]})]},t))})]}),Xp=({threadId:e,mailboxId:t,subject:n,selectedMessageId:a,authenticity:r,onOpenIntelligence:o,onBack:i,onSwipeNext:l,onSwipePrevious:f,mobileIntelligenceOpen:b,listOnScreen:h=!1})=>{const y=Os(),{handlers:p}=ou({onSwipeLeft:l,onSwipeRight:f}),{accountId:v}=ns(t),{data:m,isLoading:u,isError:d,error:g,refetch:k}=se({...va({path:{threadId:e}})}),x=c.useMemo(()=>m?.items??[],[m?.items]),w=x[x.length-1],C=c.useMemo(()=>[...x].reverse(),[x]),I=c.useRef(new Map),[M,E]=c.useState(new Set),[T,P]=c.useState(null),[$,K]=c.useState(0);c.useEffect(()=>{if(x.length>0&&e!==T){P(e);const Q=new Set([x[x.length-1].threadMessageId]);if(a){const G=x.find(ae=>ae.messageId===a);G&&Q.add(G.threadMessageId)}E(Q),K(0)}},[e,x,T,a]);const O=c.useCallback(Q=>{E(G=>{const ae=new Set(G);return ae.has(Q)?ae.delete(Q):ae.add(Q),ae})},[]),j=c.useCallback(Q=>{const G=C[Q];if(!G)return;I.current.get(G.threadMessageId)?.scrollIntoView({behavior:"smooth",block:"nearest"})},[C]),A=c.useCallback(()=>{if(C.length===0)return;const Q=Math.min($+1,C.length-1);K(Q),j(Q)},[C.length,$,j]),z=c.useCallback(()=>{if(C.length===0)return;const Q=Math.max($-1,0);K(Q),j(Q)},[C.length,$,j]),N=c.useCallback(()=>{const Q=C[$];Q&&O(Q.threadMessageId)},[C,$,O]);su({messages:x,expandedIds:M,threadId:e,mailboxId:t,accountId:v});const{toggleStar:L,isPending:S,pendingMessageId:_}=mr({threadId:e,mailboxId:t,messages:x}),B=Eo(),W=Ro(),X=a??w?.messageId,Y=c.useCallback((Q,G)=>{G&&W({threadId:e,messageId:G,mode:Q})},[W,e]),re=c.useCallback(()=>Y("reply",X),[Y,X]),ee=c.useCallback(()=>Y("reply-all",X),[Y,X]),de=c.useCallback(()=>Y("forward",X),[Y,X]),D=c.useRef(null),Z=B?.kind==="reply"?`${B.mode}:${B.sourceMessageId}`:void 0;if(c.useEffect(()=>{Z&&D.current?.scrollIntoView({behavior:"smooth",block:"start"})},[Z]),zi({enabled:!u&&x.length>0&&B===void 0,bindings:[...h?[]:[{key:"j",action:"focusNext",handler:A,preventDefault:!0},{key:"ArrowDown",action:"focusNext",handler:A,preventDefault:!0},{key:"k",action:"focusPrevious",handler:z,preventDefault:!0},{key:"ArrowUp",action:"focusPrevious",handler:z,preventDefault:!0},{key:"Enter",action:"openFocused",handler:N,preventDefault:!0},{key:"o",action:"openFocused",handler:N,preventDefault:!0}],{key:"r",action:"reply",handler:re,preventDefault:!0},{key:"R",action:"replyAll",handler:ee,noModifiers:!1,preventDefault:!0},{key:"f",action:"forward",handler:de,preventDefault:!0}]}),u)return s.jsx(Qu,{});if(d)return s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx(Be,{title:B?"Couldn't load this conversation, so there is nothing to answer":"Couldn't load this conversation",error:g,onRetry:()=>k()})});if(x.length===0)return s.jsx("div",{className:"flex h-full items-center justify-center p-4",children:B?s.jsx(Be,{variant:"inline",title:"There is nothing here to answer",error:"This conversation has no messages left. Another mail client may have moved or deleted them."}):s.jsx(Aa,{message:"No messages in this thread"})});const ue=n||x[0]?.subject||"(No subject)",pe=x.length,he=Q=>s.jsx("div",{"data-testid":"conversation-messages",children:C.map((G,ae)=>s.jsx("div",{ref:ye=>{ye&&I.current.set(G.threadMessageId,ye)},children:s.jsx(qu,{threadMessage:G,isExpanded:M.has(G.threadMessageId),isFocused:ae===$,onToggle:()=>O(G.threadMessageId),onToggleStar:()=>L(G.messageId,G.hasStars),isStarPending:S&&_===G.messageId,accountId:v,mobile:Q,onReply:Q?()=>Y("reply",G.messageId):void 0,onReplyAll:Q?()=>Y("reply-all",G.messageId):void 0,onForward:Q?()=>Y("forward",G.messageId):void 0})},G.threadMessageId))}),q=B&&s.jsx("div",{ref:D,children:B.kind==="reply"?s.jsx(Xd,{surface:B}):s.jsx("div",{className:"border-b border-line bg-canvas p-4",children:s.jsx(Be,{variant:"inline",title:"That is not a way to answer a message",error:`"${B.segment}" is not reply, reply-all or forward.`})})}),oe=s.jsxs("header",{className:"border-b border-line px-5 pt-5 pb-3",children:[s.jsx("h1",{className:"max-w-2xl text-lg font-semibold leading-snug text-fg",children:ue}),s.jsxs("p",{className:"mt-1 text-2xs text-fg-subtle",children:[pe," ",pe===1?"message":"messages"]})]});return y?s.jsxs("article",{className:"h-full flex flex-col",children:[oe,r?.dkimMismatch&&s.jsx(Dn,{authenticity:r,onOpenIntelligence:o}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[q,he(!1)]})]}):s.jsxs(cd,{thread:{subject:ue,messages:[]},onBack:i??(()=>{}),intelligenceOpen:b,onToggleIntelligence:o,touchHandlers:p,children:[r?.dkimMismatch&&s.jsx(Dn,{authenticity:r,onOpenIntelligence:o}),q,he(!0)]})},Wu=e=>{switch(kr(e)){case ht.delete:return{settlement:"delete_failed"};case ht.move:return{settlement:"move_failed"};default:return{}}},Gu=({isOpen:e,onClose:t,children:n,ariaLabel:a="Navigation",side:r="left",widthClassName:o="w-[80vw] max-w-[320px]",answers:i})=>{const l=c.useRef(null);if(Xt({id:"drawer",open:e,answers:{back:t,...i}}),ya(l,e),c.useEffect(()=>{if(!e)return;const b=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=b}},[e]),!e)return null;const f=r==="left"?"left-0 border-r animate-in slide-in-from-left duration-150":"right-0 border-l animate-in slide-in-from-right duration-150";return s.jsxs("div",{className:"fixed inset-0 z-50",role:"dialog","aria-modal":"true","aria-label":a,children:[s.jsx("button",{type:"button","aria-label":"Close menu",onClick:t,className:"absolute inset-0 bg-black/40 animate-in fade-in duration-150 cursor-default"}),s.jsxs("div",{ref:l,tabIndex:-1,className:F("safe-area-frame absolute top-0 bottom-0 bg-canvas border-line shadow-xl flex flex-col",o,f),children:[s.jsx("div",{className:"flex items-center justify-end h-12 px-2 border-b border-line shrink-0",children:s.jsx("button",{type:"button",onClick:t,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close menu",children:s.jsx(Xe,{className:"size-5"})})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:n})]})]})},_t=e=>({messageId:e,tab:void 0,offering:!1,picked:[],copy:"idle",answering:"",failure:{suggestionId:"",text:""}}),Vu=(e,t)=>{const n=+(t.state==="Pending")-+(e.state==="Pending");return n!==0?n:t.sequence-e.sequence},Yu=(e,t)=>t.kind==="refused"?`Couldn't ${e}: ${t.message} Try again, or answer from your calendar app.`:"";function Ju(e){const t=e.messageId,{suggestions:n,isLoading:a,error:r}=Gi(t),o=gl(),{calendars:i,defaultCalendarId:l,colorByCalendarId:f,timeZoneByCalendarId:b}=o,h=Vi(o),y=Yi(),p=il(),[v,m]=c.useState(()=>_t(t)),u=v.messageId===t?v:_t(t),d=c.useRef(t);d.current=t;const g=D=>{d.current===t&&m(Z=>({...Z.messageId===t?Z:_t(t),...D}))},k=c.useMemo(()=>n.filter(Ji).filter(D=>un(D)!==void 0).sort(Vu)[0],[n]),x=n.filter(D=>D!==k&&D.state==="Pending"),w=k??x[0],C=w?Xi(w):"",I=xl(C===""?"1970-01-01":C,1),M=ll({...I,calendarIds:[],enabled:C!==""}),E=Zi(C===""?[]:[I]),T={threadId:e.threadId,threadSubject:e.subject??"",calendarId:l},P=e.fromName??e.fromEmail??"",$=ml(u.failure.text||"the invitations in a message could not be read"),K=rl(h,$),O=(D,Z,ue)=>{g({answering:D,failure:{suggestionId:D,text:""}}),ue().then(pe=>g({answering:"",failure:{suggestionId:D,text:Yu(Z,pe)}}))},j=k?.suggestionId??"",A=u.failure.suggestionId===j?u.failure.text:"",z=u.failure.suggestionId===j?"":u.failure.text,N=k?un(k):void 0,L=k&&N?{invite:tl(k,N.state,{...T,senderName:P}),whenText:fn(k),calendarName:i.find(D=>D.id===l)?.name??"Calendar",color:f[l]??"cal-1",clashes:N.state==="pending"?el({start:k.dtStart,end:k.dtEnd},E.spans):[],rsvp:N.rsvp,busy:u.answering===k.suggestionId,failure:A,reportHref:$,addBlocked:K,sender:P}:void 0,S=C===""?[]:sl(C,E.spans),_=M.instances.filter(bl).filter(D=>!D.allDay).sort((D,Z)=>D.start.localeCompare(Z.start)).map(D=>({event:vl(D,b[D.calendarId]??"",yl()),timeText:cl(D.start),color:f[D.calendarId]??"cal-1"})),B=x.map(D=>({suggestion:nl(D,{...T,sender:P}),whenText:fn(D)})),W=r===null?"":"Couldn't read the invitations in this message. Reopen it to try again.",X=k?.method==="Cancel",Y=C===""?"":al(C,S,u.picked),re={onAddInvite:()=>O(j,"add this to your calendar",()=>y.accept(j,l)),onDeclineInvite:()=>O(j,"decline this",()=>y.decline(j)),onMuteInvite:()=>O(j,"stop these invitations",()=>y.dismiss(j,!0)),onRemoveInvite:X?()=>O(j,"take this off your calendar",()=>y.accept(j,l)):void 0,onReopenInvite:X?()=>O(j,"keep this on your calendar",()=>y.dismiss(j,!1)):void 0,onOfferOtherTimes:()=>g({offering:!0}),onToggleSlot:D=>g({copy:"idle",picked:u.picked.includes(D.startTime)?u.picked.filter(Z=>Z!==D.startTime):[...u.picked,D.startTime]}),onCopySlots:()=>{const D=navigator.clipboard;if(!D){g({copy:"failed"});return}Promise.resolve().then(()=>D.writeText(Y)).then(()=>g({copy:"copied"})).catch(()=>g({copy:"failed"}))},onAddSuggestion:D=>O(D,"add this to your calendar",()=>y.accept(D,l)),onDismissSuggestion:D=>O(D,"dismiss this",()=>y.dismiss(D,!1)),onSelectEvent:D=>{const{calendarObjectId:Z,recurrenceId:ue}=kl(D);p(C,Z,ue)}},ee=L!==void 0||B.length>0||r!==null,de=u.tab!==void 0;return c.useEffect(()=>{a||de||m(D=>D.messageId===t&&D.tab!==void 0?D:{...D.messageId===t?D:_t(t),tab:ee?"calendar":"sender"})},[a,de,ee,t]),{surface:{data:{invite:L,prose:u.offering&&C!==""?{dayLabel:mn(C),proposals:[],slots:S,picked:u.picked,copy:u.copy,copyText:Y}:void 0,suggestions:B,day:_,dayLabel:C===""?"":mn(C),suggestionsBusy:u.answering!==""&&!L?.busy,failure:W,suggestionsFailure:z,reportHref:$,addBlocked:K},actions:re},tab:u.tab??"sender",onTabChange:D=>g({tab:D})}}const Cr=()=>{const{data:e}=se({...tt(),staleTime:1/0});return e?.semanticSearchEnabled},Xu=10,Nr=e=>({q:e?.toLowerCase()??"",limit:Xu}),Zu=(e,t)=>{if(!t)return;const n=t.toLowerCase();return e?.find(a=>a.normalizedEmail===n)};function ef(e){const t=new Date(e),n=new Date;return t.toDateString()===n.toDateString()?"today":Ao(t,{month:"short",year:"numeric"})}function Sr(e){if(!e)return!0;const[,t]=e.split("@");return t?!t.includes("."):!0}const tf="We can't verify the sender of this email, which could mean it's from an insecure source.",sf="We couldn't read this sender's address, so we can't confirm who really sent this message.";function nf(e,t){const n=e.category??"personal";return{value:ka(n)?n:"uncategorized",overridden:t?.flags?.category?.value!=null&&t.flags.category.value!==e.category}}function af(e,t){return{name:e.fromName??e.fromEmail??"Unknown",email:e.fromEmail??"",trust:e.senderTrust,firstSeenLabel:t?ef(t.createdAt):"unknown",inboundCount:t?.inboundCount,replyCount:t?.replyCount,addressUnverified:Sr(e.fromEmail)}}function rf(e){return e?.flags?{vip:e.flags.vip?.value===!0,muted:e.flags.muted?.value===!0,blocked:e.flags.blocked?.value===!0}:{}}function Qn(e){if(e.fromName&&e.fromName!==e.fromEmail)return e.fromName}function of(e){return e.length===1?e[0]:`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function lf(e,t){const n=[],a=e.displayNameCorrespondence;t&&(a===ms.Unrelated?n.push(`The name it shows, "${t}", has nothing to do with ${e.fromDomain}.`):a===ms.Lookalike?n.push(`The name it shows, "${t}", only looks like ${e.fromDomain}.`):a===ms.ForeignAddress&&n.push(`The name it shows, "${t}", is an address ${e.fromDomain} cannot send from.`));const r=cf(e.offDomainLinkDomains);return r.length>0&&n.push(`Its links go to ${of(r.slice(0,3))}.`),n}function cf(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function df(e,t){const n=t>0?t:void 0;if(Sr(e.fromEmail))return{verdict:"mismatch",fromDomain:"",addressUnreadable:!0,summary:sf,similarCount:n};const a=e.authenticity;if(!a)return{verdict:"caution",fromDomain:e.fromEmail?.split("@")[1]??"",summary:tf};if(!a.dkimMismatch){const b=Qn(e),h=lf(a,b);return h.length>0?{verdict:"caution",fromDomain:a.fromDomain,dkimDomain:a.dkimDomain,claimedBrand:b,summary:h.join(" ")}:{verdict:"aligned",fromDomain:a.fromDomain,dkimDomain:a.dkimDomain,summary:a.dkimDomain?`This message was signed by ${a.dkimDomain}.`:"Nothing looks unusual about this sender."}}const r=a.fromDomain,o=a.dkimDomain,i=Qn(e),l=o?`it was actually sent from ${o}`:"its signature failed to verify",f=i?`The display name claims "${i}", but ${l}${o?` — not ${r}`:""}. Real senders use their own address.`:`This message claims to be from ${r}, but ${l}.`;return{verdict:"mismatch",fromDomain:r,dkimDomain:o,claimedBrand:i,summary:f,similarCount:n}}function uf(e,t){const n=e?.fromEmail??null,a=e?.subject??"",{data:r,error:o}=se({...zs({query:Nr(n??void 0)}),enabled:!!n,staleTime:3e4}),i=Zu(r?.items,n??void 0),l=Cr(),f=[a,n].filter(Boolean).join(" "),{data:b,isLoading:h,error:y}=se({...Mo({query:{query:f,limit:5}}),enabled:!!(e&&f.length>3)&&l===!0,staleTime:6e4,retry:1});return{data:c.useMemo(()=>{if(!e)return null;const v=(b?.items??[]).filter(k=>k.messageId!==e.messageId).map(k=>({id:k.messageId,threadId:k.threadId,mailboxId:t!=null&&k.mailboxIds.includes(t)?t:k.mailboxIds[0]??"",fromName:k.fromName??"",subject:k.subject??"(No subject)",timeLabel:k.sentDate!=null?st(k.sentDate*1e3):"",matched:k.matchedChunkType})),m=af(e,i),u=df(e,v.length),d=nf(e,i),g=rf(i);return{sender:m,authenticity:u,category:d,flags:g,similar:v}},[e,i,b,t]),isSimilarLoading:h,similarError:y,similarErrorIsFatal:on(y),semanticEnabled:l,addressErrorIsFatal:on(o),addressId:i?.addressId,address:i}}function ff(e,t,n=[]){const a={...e??{}};for(const[r,o]of Object.entries(t))o==null?delete a[r]:a[r]={...o,setAt:o.setAt??Date.now()};for(const r of n)delete a[r];return a}function mf({addressId:e,senderEmail:t}){const n=me(),{pushError:a}=ve(),r=$o({query:Nr(t)}),{mutate:o,isPending:i}=ge({...Lo(),onMutate:async h=>{const y=h.body.flags??{},p=h.body.clearFlags??[];await n.cancelQueries({queryKey:r});const v=n.getQueryData(r);return n.setQueryData(r,m=>m&&{...m,items:m.items.map(u=>u.addressId===h.path.addressId?{...u,flags:ff(u.flags,y,p)}:u)}),{previous:v}},onError:(h,y,p)=>{p?.previous!==void 0&&n.setQueryData(r,p.previous),a({title:"Couldn't update sender preference",detail:Me(h),error:h})},onSettled:()=>{n.invalidateQueries({queryKey:r})}}),l=c.useCallback(h=>{if(!e){Po(new Error(`Quick action fired but the sender's address record did not resolve (sender: ${t??"unknown"}). This should never happen — the address row exists.`));return}o({path:{addressId:e},body:h})},[e,o,t]),f=c.useCallback(h=>l({flags:h}),[l]),b=c.useCallback(h=>l({clearFlags:h}),[l]);return{updateFlags:f,clearFlags:b,isPending:i}}const Zp=e=>e==="vip"?"A sender you know":e==="wellknown"?"You've emailed them before":"Passed authentication",pf=e=>e.senderTrust!=="vip"&&e.senderTrust!=="wellknown"?!1:e.authenticity?.dkimMismatch!==!0;function eh(e,t){e.recordEvent("rescue.candidates_surfaced",{count:String(t)})}function th(e,t){e.recordEvent("rescue.flow_opened",{count:String(t)})}function sh(e,t){e.recordEvent("rescue.committed",{selected:String(t.selected),total:String(t.total),destination:t.toInbox?"inbox":"other"})}function hf(e,t){e.recordEvent("rescue.sent_to_junk",{count:String(t.count),senderTrust:t.senderTrust,wasRescuable:String(t.wasRescuable)})}const gf=e=>e!=="uncategorized",xf=Oo.map(e=>e.category).filter(gf),bf=e=>e.spamReport?"notSpam":"reportSpam",vf=e=>{const{similarError:t,similarErrorIsFatal:n,isSimilarLoading:a,semanticEnabled:r}=e;return r===!1?"off":t&&!n?"error":a?"loading":"ready"};function yf(){return s.jsxs("aside",{className:"flex h-full w-full flex-col bg-surface-sunken",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-1.5 border-b border-line px-row-inset",children:[s.jsx(Ze,{className:"size-3.5 text-fg-subtle"}),s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Intelligence"})]}),s.jsxs("div",{className:"flex-1 animate-pulse space-y-4 p-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2.5 rounded bg-surface w-1/4"}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("div",{className:"size-10 rounded-full bg-surface shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx("div",{className:"h-3 rounded bg-surface w-3/4"}),s.jsx("div",{className:"h-2.5 rounded bg-surface w-1/2"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2.5 rounded bg-surface w-1/4"}),s.jsx("div",{className:"h-8 rounded bg-surface"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2.5 rounded bg-surface w-1/4"}),s.jsx("div",{className:"flex gap-1.5 flex-wrap",children:Array.from({length:5}).map((e,t)=>s.jsx("div",{className:"h-6 w-16 rounded bg-surface"},t))})]})]})]})}function kf({isOpen:e,current:t,hasOverride:n,onSelect:a,onClear:r,onCancel:o}){const i=c.useRef(null);return ya(i,e),e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[s.jsx(Do,{label:"Dismiss reclassify sender",onDismiss:o,className:"backdrop-blur-sm"}),s.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":"Reclassify sender",tabIndex:-1,className:"relative z-10 w-full max-w-sm rounded-sm border border-line bg-surface p-6 shadow-lg",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Reclassify this sender"}),s.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:"Set a category override for future messages from this sender."}),s.jsxs("div",{className:"mt-4 flex flex-col gap-1",children:[xf.map(l=>s.jsxs("button",{type:"button",onClick:()=>a(l),className:`flex min-h-11 items-center justify-between rounded px-3 text-left text-sm transition-colors hover:bg-surface-raised ${l===t?"font-semibold text-accent":"text-fg"}`,children:[Vt[l],l===t&&s.jsx("span",{className:"text-2xs text-fg-subtle",children:"current"})]},l)),n&&s.jsx("button",{type:"button",onClick:r,className:"mt-1 flex min-h-11 items-center rounded border-t border-line px-3 text-left text-sm text-fg transition-colors hover:bg-surface-raised",children:"Remove override — classify automatically again"})]}),s.jsx("div",{className:"mt-6 flex justify-end",children:s.jsx("button",{type:"button",onClick:o,className:"inline-flex min-h-11 items-center justify-center rounded border border-line px-4 text-sm font-medium transition-colors hover:bg-surface-raised",children:"Cancel"})})]})]}):null}function jf({thread:e,onClose:t,mailboxId:n,accountId:a,hideCloseButton:r,onAfterOptimisticRemove:o}){const{data:i,address:l,addressId:f,isSimilarLoading:b,similarError:h,similarErrorIsFatal:y,semanticEnabled:p}=uf(e,n),v=Ju(e),[m,u]=c.useState(!1),d=e.fromEmail??void 0,{updateFlags:g,clearFlags:k}=mf({addressId:f,senderEmail:d}),{reportSpam:x,notSpam:w,isReporting:C,isRestoring:I}=vr({mailboxId:e.mailboxId,threadId:e.threadId,accountId:a,onAfterOptimisticRemove:o}),M=Fo(),E=bf(e),T=c.useCallback(()=>{w([e.messageId])},[w,e.messageId]),P=c.useCallback(()=>{hf(M,{count:1,senderTrust:e.senderTrust,wasRescuable:pf(e)}),x([e.messageId])},[x,e,M]),$=c.useCallback(()=>{},[]),K=c.useCallback(()=>{const _=i?.flags?.vip!==!0;g({vip:{value:_}})},[i?.flags?.vip,g]),O=c.useCallback(()=>{const _=i?.flags?.muted!==!0;g({muted:{value:_}})},[i?.flags?.muted,g]),j=c.useCallback(_=>{u(!1),g({category:{value:_}})},[g]),A=c.useCallback(()=>{u(!1),k(["category"])},[k]),z=f!==void 0,N={onToggleVip:z?K:void 0,onToggleMute:z?O:void 0,onReclassify:z?()=>u(!0):void 0,onNotSpam:E==="notSpam"?T:void 0,onReportSpam:E==="reportSpam"?P:void 0},L=({mailboxId:_,threadId:B,messageId:W,className:X,ariaLabel:Y,children:re})=>s.jsx(ja,{to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:_,threadId:B,messageId:W},search:ee=>ee,variant:"row",className:X,"aria-label":Y,children:re});if(!i)return s.jsx(yf,{});const S=vf({similarError:h,similarErrorIsFatal:y,isSimilarLoading:b,semanticEnabled:p});return s.jsxs(s.Fragment,{children:[s.jsx(Ja,{data:i,calendar:v.surface,tab:v.tab,onTabChange:v.onTabChange,onClose:t,hideCloseButton:r,onShowSimilar:$,actions:N,similarState:S,similarLinkComponent:L,reportSpamPending:C,notSpamPending:I,className:"border-l-0 h-full w-full"}),s.jsx(kf,{isOpen:m,current:i.category.value,hasOverride:l?.flags?.category?.value!=null,onSelect:j,onClear:A,onCancel:()=>u(!1)})]})}const wf=({onClose:e,thread:t,mailboxId:n,accountId:a,hideCloseButton:r,onAfterOptimisticRemove:o})=>t?s.jsx(jf,{thread:t,onClose:e,mailboxId:n,accountId:a,hideCloseButton:r,onAfterOptimisticRemove:o}):s.jsxs("aside",{className:"flex h-full w-full flex-col bg-surface-sunken",children:[s.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-1.5 border-b border-line px-row-inset",children:[s.jsx(Ze,{className:"size-3.5 text-fg-subtle"}),s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Intelligence"})]}),s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center px-row-inset text-center",children:[s.jsx(Ze,{className:"size-8 text-fg-subtle"}),s.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:"Intelligence"}),s.jsx("p",{className:"mt-1 text-2xs text-fg-subtle",children:"Sender trust, authenticity and similar messages will appear here."})]})]});function nh({isOpen:e,onClose:t,thread:n,mailboxId:a,accountId:r,onAfterOptimisticRemove:o}){return s.jsx(Gu,{isOpen:e,onClose:t,ariaLabel:"Message details",side:"right",answers:{toggleIntelligence:t},children:s.jsx(wf,{onClose:t,thread:n,mailboxId:a,accountId:r,hideCloseButton:!0,onAfterOptimisticRemove:o})})}const Cf=e=>{const{trashByAccount:t,hasAppointments:n,isError:a}=hu();return c.useMemo(()=>{const r=zo({targets:e,trashByAccount:t,hasAppointments:n,isError:a}),o=i=>i.accountId?t.get(i.accountId):void 0;return{outcome:r,staleFolderLabel:e.map(o).find(i=>i?.source==="Stale")?.staleFolderPath,guessedMailboxId:r==="unconfirmed"?e.find(i=>o(i)?.mailboxId===i.mailboxId)?.mailboxId:void 0}},[e,t,n,a])},Nf=100,Sf=({mailboxId:e,mailboxLabel:t,accountId:n,enabled:a,predicateKey:r,searchQuery:o,reportEnding:i})=>{const[l,f]=c.useState({kind:"idle"}),b=c.useRef(void 0),{run:h,start:y,stop:p}=_o(),{pushError:v}=ve(),m=h?.mailboxId===e?h:void 0,u=m!==void 0,d=c.useRef(!1);d.current=u,c.useEffect(()=>{b.current?.abort(),f({kind:"idle"})},[a,r]);const g=c.useRef(o);g.current=o;const k=c.useCallback(T=>async(P,$)=>{const{data:K}=await ln({path:{mailboxId:e},query:{...T,continuationToken:P,limit:Nf},signal:$,throwOnError:!0});return{ids:(K.items??[]).map(O=>O.messageId),continuationToken:K.continuationToken}},[e]),x=c.useCallback(async T=>{const{data:P}=await ln({path:{mailboxId:e},query:{...g.current,count:!0,results:!1},signal:T,throwOnError:!0});if(P.count===void 0)throw new Error("the search returned no count for the selection");return P.count},[e]),w=c.useCallback(T=>async(P,$)=>{if(T.kind==="move"){const{data:O}=await Uo({body:{messageIds:P,destinationMailboxId:T.destinationMailboxId},signal:$,throwOnError:!0});return O}if(T.kind==="markRead"){const{data:O}=await Bo({body:{messageIds:P,isRead:!0},signal:$,throwOnError:!0});return O}const{data:K}=await Ko({body:{messageIds:P},signal:$,throwOnError:!0});return K},[]),C=c.useCallback(()=>{const T=new AbortController;b.current=T,f({kind:"counting"}),x(T.signal).then(P=>{if(T.signal.aborted){f({kind:"idle"});return}f({kind:"escalated",total:P})},P=>{if(T.signal.aborted){f({kind:"idle"});return}v(Ho("Couldn't count matching messages","The count didn't finish.",P)),f({kind:"idle"})})},[x,v]),I=c.useCallback(()=>{b.current?.abort(),d.current&&p(e)},[p,e]),M=c.useCallback(()=>{d.current||(b.current?.abort(),f({kind:"idle"}))},[]),E=c.useCallback(async(T,P,$)=>{const K=P?.length??(l.kind==="escalated"?l.total:0),O=P!==void 0?{kind:"targets",targets:P}:{kind:"predicate",fetchPage:k(g.current)},j=await y({action:T,mailboxId:e,mailboxLabel:t,accountId:n,matched:K,source:O,applyBatch:w(T),reportEnding:i,claimEnding:$});return j.kind==="ran"&&f({kind:"idle"}),j},[w,k,l,e,t,n,i,y]);return{phase:l,escalate:C,stop:I,clear:M,isRunning:u,runningAction:m?.action,progress:m?.progress,runAction:E}},Tf=120,If=({keyboardFocusedMessageId:e,openMessageId:t,enabled:n,open:a,delayMs:r=Tf})=>{const o=c.useRef(a);o.current=a;const i=c.useRef(void 0);c.useEffect(()=>{const l=e;if(!n){i.current=l;return}if(l===void 0||l===t)return;if(l===i.current){i.current=void 0;return}const f=setTimeout(()=>o.current(l),r);return()=>clearTimeout(f)},[n,e,t,r])},Tr="This account has no Junk folder appointed, so there is nowhere to file these. Appoint one under Settings › Folder roles.",Ef="These are already in Junk, so there is nowhere to file them.",Rf=(e,t)=>e!==void 0&&e!==t?e:void 0,ah=(e,t)=>{if(Rf(e,t)===void 0)return e===void 0?Tr:Ef};function Mf(e,t){if(e.length!==0)return t!==void 0&&e.includes(t)?t:e[0]}const Af={title:"",navSlot:null,titleMeta:null,searchSlot:null,searchField:null,searchResults:null,makeFilterSlot:null},Rs=c.createContext(Af),$f=()=>c.useContext(Rs),Lf=({isOpen:e,messageIds:t,outcome:n,accountId:a,trashFolderLabel:r,staleFolderLabel:o,guessedMailboxId:i,isDeleting:l=!1,onConfirm:f,onCancel:b})=>{const{Account:h}=xa(),{requestAppointment:y}=da(),p=t.length,v=()=>f([...t]),m=qo(p,n,{trashFolderLabel:r,staleFolderLabel:o});if(n==="noTrash"||n==="staleTrash"||n==="unconfirmed"){const u=n==="noTrash"?"none":n==="staleTrash"?"stale":"unconfirmed";return s.jsx(Pt,{isOpen:e,...m,onConfirm:()=>{if(!a)return v();const d=[...t];b(),y({accountId:a,role:"Trash",reason:u,action:{kind:"delete",count:p},staleFolderLabel:o,trashFolderLabel:r,guessedMailboxId:i,onAppointed:async()=>f(d)})},onCancel:b})}return n==="unavailable"?s.jsx(h,{fallback:s.jsx(Pt,{isOpen:e,...m,confirmLabel:"Reload reader",onConfirm:()=>window.location.reload(),onCancel:b}),children:({signOut:u})=>s.jsx(Pt,{isOpen:e,...m,onConfirm:()=>u(),onCancel:b})}):s.jsx(Pt,{isOpen:e,...m,destructive:!0,isBusy:l||n==="unknown",onConfirm:v,onCancel:b})},Ir=8,Er=e=>e==="From"||e==="FromDomain",Pf=e=>({value:e.email,label:e.displayName??e.email,...e.displayName?{hint:e.email}:{},...e.fromSelection?{source:"selected"}:{}}),Ff=e=>{const t=ur(e.email);if(t!==null)return{value:t,...e.fromSelection?{source:"selected"}:{}}},Df=(e,t)=>e.value.toLowerCase().includes(t)||(e.label??"").toLowerCase().includes(t),Of=(e,t,n)=>{if(!Er(e))return[];const a=t.trim().toLowerCase(),r=new Set,o=[];for(const i of n){if(i.email.trim()==="")continue;const l=e==="From"?Pf(i):Ff(i);if(!l)continue;const f=l.value.toLowerCase();if(!(f===""||r.has(f))&&(r.add(f),f!==a&&!(a!==""&&!Df(l,a))&&(o.push(l),o.length===Ir)))break}return o},zf=250,_f=2,Uf=(e,t,n)=>{const a=t.trim(),r=Fa(a,zf),o=e!==void 0&&Er(e),{data:i}=se({...zs({query:{q:r,limit:Ir}}),enabled:o&&r.length>=_f});if(!o||e===void 0)return[];const l=[...n.map(f=>({email:f,fromSelection:!0})),...(i?.items??[]).map(f=>({email:f.normalizedEmail,...f.displayName?{displayName:f.displayName}:{}}))];return Of(e,a,l)},Rr=12,Bf=e=>{const{envelope:t}=e,n=t.from[0];return{id:t.messageId,sender:n?fr({normalizedEmail:n.normalizedEmail,displayName:n.displayName}):"Unknown",subject:t.subject??"(No subject)",date:st(t.date)}},Kf=(e,t)=>{const n=e!==void 0&&t!==void 0,{data:a,isLoading:r}=se({...Qo({path:{mailboxId:e??""},query:{...t,limit:Rr}}),enabled:n,staleTime:3e4});return{messages:(a?.items??[]).map(Hf),isPending:n&&r}},Hf=e=>({id:e.messageId,sender:e.fromName||e.fromEmail||"Unknown",subject:e.subject??"(No subject)",date:st(e.sentDate)}),qf=e=>Us({queries:e.slice(0,Rr).map(t=>({...Yt({path:{messageId:t}}),staleTime:Number.POSITIVE_INFINITY})),combine:t=>({messages:t.map(n=>n.data).filter(n=>n!==void 0).map(Bf),isPending:t.some(n=>n.isPending)})}),Qf=(e,t)=>({matchOperator:"Or",literalClauses:Gs(e,t)}),Wf=(e,t,n,a)=>{const r=ge(Wo()),{mutate:o,reset:i}=r,[l,f]=c.useState(!1),b=c.useMemo(()=>ss(n),[n]),h=c.useMemo(()=>Gs(b,a),[b,a]),y=c.useCallback(()=>{!e||!t||(f(!1),o({path:{accountId:e},body:pn({anchorMessageId:t,matchOperator:"And",literalClauses:[]})}))},[e,t,o]),p=c.useCallback(()=>{f(!1),i()},[i]),v=r.data,m=v?.semanticUnavailable===!0&&!l&&h.length>0;c.useEffect(()=>{!m||!e||(f(!0),o({path:{accountId:e},body:pn(Qf(b,a))}))},[m,e,b,a,o]);const u=l||(v?.semanticUnavailable??!1),d=r.isPending||m,g=l?{matchOperator:"Or",literalClauses:h}:{...t?{anchorMessageId:t}:{},matchOperator:"And",literalClauses:[]};return{preview:y,reset:p,matchedCount:d?void 0:v?.matchedCount,messageIds:d?void 0:v?.messageIds,semanticUnavailable:u,senderFallback:l,senders:b,matchPredicate:g,isPending:d,isError:r.isError,error:r.error}},Gf=()=>[Go({path:{mailboxId:""}}),Vo({path:{mailboxId:""}}),Yo()].map(e=>[{_id:e[0]._id}]),Vf=e=>Jo(e)?e.pages:Xo(e)?[e]:[],Yf=e=>typeof e=="object"&&e!==null&&typeof e.messageId=="string",Jf=(e,t)=>{const n=new Set(t),a=new Map;for(const r of e)for(const o of Vf(r))for(const i of o.items){if(!Yf(i)||!n.has(i.messageId))continue;const l=i.subject?.trim();l&&a.set(i.messageId,l)}return t.map(r=>a.get(r)).filter(r=>r!==void 0)},Xf=e=>{const t=me(),n=e.join("\0");return c.useMemo(()=>{const a=Gf().flatMap(r=>t.getQueriesData({queryKey:r}).map(([,o])=>o));return Jf(a,e)},[t,n])},Zf=new Set(["hasAttachment","isUnread","isRead","isStarred","category","before","after"]),em=e=>Zf.has(e),tm=(e,{searchHadSemanticReach:t})=>{const n=[],a=[];let r,o;for(const f of e.tokens){if(f.type==="from"){n.push({field:"From",value:f.value});continue}if(f.type==="subject"){n.push({field:"Subject",value:f.value});continue}if(f.type==="in"){r={mailboxId:f.mailboxId,label:f.value};continue}if(f.type==="account"){o=f.accountId;continue}em(f.type)&&a.push({type:f.type,label:Ia(f)})}const i=e.freeText.trim(),l=i.length>0;return l&&n.push({field:"HasWords",value:i}),{clauses:n,matchOperator:"all",scopedOut:r,droppedFacets:a,targetAccountId:o,keptTerms:l,droppedSemantic:l&&t}},sm=(e,t,n)=>e.targetAccountId??t??n[0]?.accountId,Ms=c.createContext(void 0),nm=()=>c.useContext(Ms),Wn={matched:0,applied:0,failed:0,failedIds:[]},am=({matched:e,outcome:t,failureReason:n,progressDone:a})=>{if(n!==void 0)return{...Wn,state:"commitFailed",failureReason:n};if(!t)return{state:"backApplyRunning",matched:Math.max(e,a),applied:a,failed:0,failedIds:[]};if(!t.cancelled&&t.error===void 0)return{state:"backApplyComplete",matched:Math.max(e,t.done),applied:t.done,failed:0,failedIds:[]};if(!t.cancelled&&t.done===0)return{...Wn,state:"commitFailed"};const r=t.failedIds.length>0?t.failedIds.length:Math.max(e-t.done,1);return{state:"runStopped",matched:Math.max(e,t.done),applied:t.done,failed:r,failedIds:t.failedIds}},rm=({failure:e,isStarting:t,isRunning:n,isDone:a,failedCount:r,ruleSaved:o})=>e?.kind==="restartFailed"?"backApplyRestartFailed":e?.kind==="startFailed"?o?"backApplyStartFailed":"commitFailed":a?r>0?"backApplyFailed":"backApplyComplete":e?.kind==="statusUnreadable"?"statusUnknown":t||n?"backApplyRunning":"saving",om=e=>{if(e.runState==="statusUnknown")return{kind:"refreshStatus"};if(e.isEscalated)return{kind:"rerunEscalated"};if(e.committedScope==="standing"||e.committedScope==="temporary")return e.createFilterFailed?{kind:"resetAndResend"}:e.backApplyPending?{kind:"startBackApply"}:{kind:"waitOnJob"};if(e.committedScope==="all-like-these"&&e.widenRunsAsJob)return{kind:"resend"};const t=new Set(e.failedIds);return{kind:"rerunBulk",targets:t.size>0?e.sent.filter(n=>t.has(n.id)):e.sent}},im=e=>e!==void 0&&e.outcome===void 0&&e.failureReason===void 0,lm=(e,t)=>{if(e){e.stop();return}t()},cm=(e,t)=>e==="run"?t.dismiss:t.cancel,dm={clauses:[],matchOperator:"any"},um={clauses:[],matchOperator:"all",droppedFacets:[],keptTerms:!1,droppedSemantic:!1},fm=[],mm=(e,t,n)=>({verb:"organize",accountId:sm(e,t.accountId,n),selection:fm,selectionRestriction:void 0,escalated:void 0,searchConversion:e}),ft={state:"saving",matched:0,applied:0,failed:0,failures:[]},Gn=(e,t)=>e.map((n,a)=>({...n,id:`${t}-${a}`})),Vn=(e,t,n)=>{if(e==="delete")return{kind:"delete"};if(e==="markRead")return{kind:"markRead"};const a=e==="junk"?n:t;return a?{kind:"move",destinationMailboxId:a}:void 0},ks=e=>e==="move"||e==="junk"||e==="organize",Yn=e=>e==="junk"?Tr:"No destination was chosen, so there is nowhere to file these. Go back and pick a folder.";function pm({verb:e,accountId:t,mailboxId:n,mailboxLabel:a,selection:r,selectionRestriction:o,escalated:i,escalatedProgress:l,searchConversion:f,onFinished:b,onRunEnded:h,step:y,goToStep:p,goBack:v,closeWizard:m}){const[u]=c.useState(()=>f),[d]=c.useState(()=>i),g=u!==void 0,[k,x]=c.useState(g?"properties":"selected"),w=d?"escalated":k,[C,I]=c.useState(()=>u?{clauses:Gn(u.clauses,"search"),matchOperator:u.matchOperator}:dm),[M,E]=c.useState(void 0),[T,P]=c.useState(void 0),[$,K]=c.useState(!1),[O,j]=c.useState(void 0),[A,z]=c.useState(void 0),[N,L]=c.useState(),S=c.useRef(!1),_=c.useMemo(()=>r.map(R=>R.id),[r]),B=c.useMemo(()=>r.map(R=>({id:R.id,accountId:R.accountId})),[r]),W=c.useMemo(()=>r.map(R=>R.email).filter(Boolean),[r]),X=_[0],Y=Xf(_),{junkMailboxId:re}=hr(t),ee=Wf(d?void 0:t,X,W,Y),{preview:de}=ee;c.useEffect(()=>{de()},[de]);const D=w==="similar"||w==="properties",Z=c.useMemo(()=>({matchOperator:C.matchOperator==="all"?"And":"Or",literalClauses:C.clauses.map(R=>({field:R.field,value:R.value}))}),[C.clauses,C.matchOperator]),ue=w==="similar"?ee.matchPredicate:Z,{count:pe,matchedIds:he}=jl(D?t:void 0,ue),q=qf(D?he:[]),oe=Kf(d?n:void 0,d?.searchQuery),Q=d?{status:"ready",count:d.total}:D?pe:{status:"ready",count:r.length},{data:G}=se({...yt({path:{accountId:t??""}}),enabled:!!t,staleTime:Number.POSITIVE_INFINITY}),ae=gr(t),ye=ua(),Le=c.useMemo(()=>ma({mailboxes:G?.items??[],folderAppointments:ae,currentMailboxId:n,translator:ye}),[G?.items,ae,n,ye]),{createFolderIn:at}=fa(t),os=Le.find(R=>R.id===C.moveMailboxId)?.label,He=zd(r.map(R=>({normalizedEmail:R.email,displayName:R.sender}))),rt=Qd({match:w==="properties"&&C.clauses[0]?.value.trim()||void 0,sender:He?fr(He):void 0,folder:os}),V=c.useMemo(()=>({...C,name:C.name??rt}),[C,rt]),Rt=Uf(M?.draft.field,M?.draft.value??"",W),Pe=c.useRef(void 0),Ce=c.useCallback(R=>{Pe.current?.(),Pe.current=R},[]);c.useEffect(()=>()=>{Pe.current?.(),Pe.current=void 0},[]);const fe=wl(t),ke=Cl(t),qe=Sf({mailboxId:n??"",mailboxLabel:a,accountId:t,enabled:!1,predicateKey:"selection-wizard",searchQuery:{},reportEnding:h}),{runAction:Qe}=qe,ie=ti({verb:e,mode:w,scope:C.scope,fromSearch:g}),te=ie[cn(ie,y)],Fe=si(t,o),De=ni(w,Fe),Ne=(R=>{if(R==="folder")return Fe.destination;if(R==="rule")return V.scope==="standing"||V.scope==="until"?De:void 0})(te)??ai(te,V,Q),Oe=c.useCallback(()=>Gn(Gs(W,Y),"seed"),[W,Y]),Mt=c.useCallback(R=>{x(R),I(U=>({...U,widen:R==="similar"&&X?{anchorCount:Math.max(r.length,1)}:void 0,...R==="properties"&&U.clauses.length===0?{clauses:Oe()}:{}}))},[X,r.length,Oe]),We=c.useCallback(()=>{K(!0),x("properties"),I(R=>({...R,widen:void 0,clauses:Oe(),matchOperator:"any"})),p("properties")},[Oe,p]),ze=Cr()===!1,Ge=ze||ee.semanticUnavailable||ee.isError;c.useEffect(()=>{te==="match"&&(w!=="similar"||!Ge||$||We())},[te,w,Ge,$,We]);const At=c.useCallback(()=>{E({mode:"add",draft:{field:"From",value:""}})},[]),ot=c.useCallback(R=>{const U=C.clauses.find(J=>J.id===R);U&&E({mode:"edit",clauseId:R,draft:{field:U.field,value:U.value}})},[C.clauses]),it=c.useCallback(R=>{I(U=>({...U,clauses:U.clauses.filter(J=>J.id!==R)}))},[]),lt=c.useCallback(R=>{E(U=>U&&{...U,draft:R})},[]),le=c.useCallback(()=>{E(R=>{if(!R)return;const U=Nl(R.draft.field,R.draft.value),J={...R.draft,value:U};I(ct=>({...ct,clauses:R.clauseId?ct.clauses.map(fs=>fs.id===R.clauseId?{...fs,...J}:fs):[...ct.clauses,{id:crypto.randomUUID(),...J}]}))})},[]),je=c.useCallback(()=>{if(Ne){P(te);return}P(void 0);const R=ie[cn(ie,te)+1];R&&p(R)},[Ne,te,ie,p]),ls=c.useCallback(async R=>{const U=Vn(e,V.moveMailboxId,re);if(!U){z({matched:R.length,sent:R,failureReason:Yn(e)});return}z({matched:R.length,sent:R});const J=await Qe(U,R,Ce);z({matched:R.length,sent:R,outcome:J.kind==="ran"?J.outcome:void 0,failureReason:J.kind==="refused"?J.reason:void 0})},[e,V.moveMailboxId,re,Qe,Ce]),cs=c.useCallback(async()=>{if(!d)return;const R=Vn(e,V.moveMailboxId,re);if(!R){z({matched:d.total,sent:[],failureReason:Yn(e)});return}z({matched:d.total,sent:[]});const U=await d.run(R,Ce);z({matched:d.total,sent:[],outcome:U.kind==="ran"?U.outcome:void 0,failureReason:U.kind==="refused"?U.reason:void 0})},[d,e,V.moveMailboxId,re,Ce]),{start:$t}=fe,{createFilterAsync:Zs}=ke,Lt=c.useCallback(()=>{if(d){cs();return}const R=Sl({mode:k,ruleScope:V.scope}),U=Tl({mode:k,ruleScope:V.scope,anchorMessageId:X,clauses:V.clauses,matchOperator:V.matchOperator,moveMailboxId:V.moveMailboxId,until:V.until});if(j(R),R==="standing"||R==="temporary"){const J=Il(U)?U:void 0;L(J),Zs(U,R,(V.name??"").trim()).then(ct=>{ct&&J&&$t(J)});return}if(R==="all-like-these"&&ks(e)){$t(U);return}ls(R==="just-these"?B:he.map(J=>({id:J,accountId:t})))},[d,cs,k,V,X,e,t,B,he,Zs,$t,ls]),Fr=c.useCallback(()=>{if(Ne){P(te);return}S.current||(S.current=!0,p("run"),Lt())},[Ne,te,p,Lt]),en=c.useCallback(R=>{const U=fe.progress,J=rm({failure:fe.failure,isStarting:fe.isStarting,isRunning:fe.isRunning,isDone:fe.isDone,failedCount:U.failedCount,ruleSaved:R});return J==="saving"||J==="commitFailed"||J==="backApplyStartFailed"?{...ft,state:J}:{state:J,matched:U.matchedCount,applied:U.appliedCount,failed:J==="backApplyFailed"||J==="backApplyRestartFailed"?U.failedCount:0,failures:[]}},[fe]),tn=c.useMemo(()=>{const R=new Map;for(const U of[...r,...q.messages,...oe.messages])R.set(U.id,U);return R},[r,q.messages,oe.messages]),sn=d?l:qe.progress,nn=c.useCallback(()=>{if(!A)return ft;const R=am({matched:A.matched,outcome:A.outcome,failureReason:A.failureReason,progressDone:sn?.done??0});return{state:R.state,matched:R.matched,applied:R.applied,failed:R.failed,failures:R.failedIds.map(U=>tn.get(U)).filter(U=>U!==void 0),failureReason:R.failureReason}},[A,sn,tn]),_e=d?nn():O==="standing"||O==="temporary"?ke.isError?{...ft,state:"commitFailed"}:ke.isSuccess?N?en(!0):{...ft,state:"filterSaved"}:ft:O==="all-like-these"&&ks(e)?en(!1):nn(),Dr=()=>{const R=om({runState:_e.state,isEscalated:d!==void 0,committedScope:O,createFilterFailed:ke.isError,backApplyPending:N!==void 0,widenRunsAsJob:ks(e),failedIds:A?.outcome?.failedIds??[],sent:A?.sent??B});switch(R.kind){case"refreshStatus":fe.refreshStatus();return;case"rerunEscalated":cs();return;case"resetAndResend":ke.reset(),Lt();return;case"resend":Lt();return;case"startBackApply":N&&$t(N);return;case"waitOnJob":return;case"rerunBulk":ls(R.targets);return}},Or=c.useCallback(()=>{m(ie,te)},[m,ie,te]),ds=c.useCallback(()=>{m(ie,te),b()},[m,ie,te,b]),{stop:an}=qe,zr=c.useCallback(()=>{lm(d,an)},[d,an]);Jd({shouldBlockFn:({action:R})=>R!=="BACK"?!1:(ds(),!0),enableBeforeUnload:!1,disabled:te!=="run"});const us={messages:d?oe.messages:D?q.messages:r,count:Q,label:w==="selected"?"Your selection":"A sample of what matches",emptyReason:w==="similar"&&Ge?"notIndexed":"noMatch",loading:d?oe.isPending:D&&(Q.status==="loading"||q.isPending)};return s.jsx(ri,{verb:e,steps:ie,step:te,blockedReason:Ne,nudged:T===te,onBack:v,onExit:cm(te,{dismiss:ds,cancel:Or}),onContinue:je,onCommit:Fr,match:{selectedCount:r.length,mode:w,accountId:Fe.accountId,onModeChange:Mt,semanticUnavailable:Ge,semanticOff:ze,semanticErrorDetail:ee.error instanceof Error?ee.error.message:void 0,semanticFallbackTaken:$,onSemanticFallback:We,escalatedScope:d?.scope,sample:us},properties:{clauses:V.clauses,matchOperator:V.matchOperator,onMatchOperatorChange:R=>I(U=>({...U,matchOperator:R})),clauseEdit:M,onStartAddClause:At,onStartEditClause:ot,onRemoveClause:it,onChangeDraft:lt,onSubmitClause:le,onCancelClause:()=>E(void 0),clauseFields:El,clauseSuggestions:Rt,conversionNotice:u?Gd(u):void 0,semanticFallbackTaken:$,sample:{...us,label:"What this matches"}},folder:{folders:Le,mailboxId:V.moveMailboxId,delimiter:pa(G?.items??[]),onSelect:R=>I(U=>({...U,moveMailboxId:R})),onCreateFolder:t?at:void 0,restriction:Fe.destination},rule:{draft:V,onScopeChange:R=>I(U=>({...U,scope:R})),onUntilChange:R=>I(U=>({...U,until:R})),restriction:De},name:{name:V.name??"",onNameChange:R=>I(U=>({...U,name:R})),nudged:T===te},review:{verb:e,mode:w,selectedCount:r.length,clauses:V.clauses,matchOperator:V.matchOperator,folder:os,scope:V.scope,until:V.until,ruleName:ie.includes("name")?V.name:void 0,escalatedScope:d?.scope,sample:us},run:{state:_e.state,verb:e,scope:V.scope,matched:_e.matched,applied:_e.applied,failedCount:_e.failed,failures:_e.failures,failureReason:_e.failureReason,onRetry:Dr,onDismiss:ds,onCancelRun:im(A)?zr:void 0}})}function rh(e){const t=Zo()==="search",n=nm(),{accounts:a}=St(),{step:r,goToStep:o,goBack:i,closeWizard:l}=ei(t?"properties":"match");if(Xt({id:"selection-wizard",open:r!==void 0}),!r)return null;const f=t?n??um:void 0;return s.jsx(pm,{...e,...f?mm(f,e,a):{},step:r,goToStep:o,goBack:i,closeWizard:l})}const hm=[],Js=c.createContext(null),gm=e=>{const t=c.useContext(Js);return t?t.rowInteraction(e):null},xm=()=>{const e=c.useContext(Js);if(!e)throw new Error("useThreadListSelection must be used inside <ThreadListInteraction>");return e},bm="[data-message-id]",vm=e=>Array.from(e.querySelectorAll(bm)).map(t=>t.dataset.messageId).filter(t=>t!==void 0),ym=(e,t)=>e.length===t.length&&e.every((n,a)=>n===t[a]),km=e=>{const[t,n]=c.useState([]);return c.useEffect(()=>{const a=e.current;if(!a)return;const r=()=>{const i=vm(a);n(l=>ym(l,i)?l:i)};r();const o=new MutationObserver(r);return o.observe(a,{childList:!0,subtree:!0}),()=>o.disconnect()},[e]),t};function oh({selectedMessageId:e,rows:t,onOpen:n,onDeleteMessages:a,onSelectionVerb:r,isDeleting:o=!1,commandsRef:i,onTriageContextChange:l,children:f}){const b=Os(),{pushError:h}=ve(),y=c.useRef(null),p=km(y),v=Vd({orderedIds:p,isDesktop:b,initialFocusedId:e}),{focusedMessageId:m,setFocusedMessageId:u,pendingDomFocusRef:d,cursorMovedByPointerRef:g,selection:k,isMultiSelectMode:x,exitSelection:w,handleRowSelect:C}=v,{selectedIds:I,selectedCount:M,isSelected:E,toggle:T,select:P,toggleAll:$}=k,K=p.length>0&&p.every(q=>I.has(q)),O=c.useCallback(()=>{p.length>0&&$(p)},[p,$]),{intersectWith:j}=k;c.useEffect(()=>{j(p)},[j,p]),c.useEffect(()=>{const q=d.current;q!==null&&(d.current=null,y.current?.querySelector(`[data-message-id="${q}"]`)?.focus())});const A=c.useCallback(q=>{g.current=!0,u(q)},[g,u]),z=c.useCallback(q=>{b||P(q)},[b,P]),N=c.useCallback(()=>{m&&n(m)},[m,n]),L=c.useCallback(q=>n(q,{replace:!0}),[n]);If({keyboardFocusedMessageId:v.keyboardFocusedMessageId,openMessageId:e,enabled:b&&M===0,open:L});const[S,_]=c.useState(null),{outcome:B,staleFolderLabel:W,guessedMailboxId:X}=Cf(S?.targets??hm),Y=c.useCallback(q=>{if(S!==null)return!0;if(M>0)return r(q),!0;if(q!=="delete"||!m)return!1;const oe=t.find(Q=>Q.id===m);return!oe?.mailboxId||!oe.accountId?(h({title:"Couldn't delete this message",detail:"This list has lost track of which account and folder it is in, so reader can't tell whether deleting it would move it to Trash or erase it. Nothing was deleted.",action:{label:"Reload the list",href:window.location.href}}),!0):(_({ids:[m],targets:[{accountId:oe.accountId,mailboxId:oe.mailboxId}]}),!0)},[S,M,r,m,t,h]),re=c.useCallback(q=>{q.length!==0&&(a(q),_(null),w())},[a,w]),ee=c.useCallback(()=>_(null),[]),de=c.useCallback(()=>M===0?!1:(w(),!0),[M,w]),D=p.length>0;c.useEffect(()=>{if(i){if(!D){i.current=null;return}return i.current={focusNext:v.focusNext,focusPrevious:v.focusPrevious,focusFirst:v.focusFirst,focusLast:v.focusLast,openFocused:N,toggleSelect:v.toggleFocusedSelection,extendSelectDown:v.extendRangeDown,extendSelectUp:v.extendRangeUp,selectAll:v.selectAllLoaded,clearSelection:de,requestVerb:Y,toggleDensity:()=>{}},()=>{i.current=null}}},[i,D,v.focusNext,v.focusPrevious,v.focusFirst,v.focusLast,v.toggleFocusedSelection,v.extendRangeDown,v.extendRangeUp,v.selectAllLoaded,N,de,Y]);const Z=c.useMemo(()=>Array.from(I),[I]),ue=S!==null;c.useEffect(()=>{l?.({focusedMessageId:m,selectedIds:Z,orderedIds:p,hasList:D})},[l,m,Z,p,D]);const pe=Mf(p,m),he=c.useMemo(()=>({selectedIds:I,selectedCount:M,exitSelection:w,startSelectionVerb:r,orderedIds:p,allSelected:K,toggleAllLoaded:O,rowInteraction:q=>({focused:q===m,isTabStop:q===pe,isDesktop:b,onFocusRow:A,selection:{isChecked:E(q),onToggleCheck:T,onRowSelect:C,isMultiSelectMode:x,onLongPress:z}})}),[I,M,w,r,p,K,O,m,pe,b,A,E,T,C,x,z]);return s.jsxs(Js.Provider,{value:he,children:[s.jsx("div",{ref:y,className:"contents",children:f}),s.jsx(Lf,{isOpen:ue,messageIds:S?.ids??[],outcome:B,accountId:S?.targets[0]?.accountId,staleFolderLabel:W,guessedMailboxId:X,isDeleting:o,onConfirm:re,onCancel:ee})]})}function ih({title:e,isDeleting:t}){const n=$f(),{selectedCount:a,exitSelection:r,startSelectionVerb:o,orderedIds:i,allSelected:l,toggleAllLoaded:f}=xm();return s.jsx(yd,{title:n.title||e,navSlot:n.navSlot,titleMeta:n.titleMeta,searchSlot:n.searchSlot,searchField:n.searchField,idleSlot:n.makeFilterSlot,count:a,onCancel:r,onDelete:()=>o("delete"),onMarkRead:()=>o("markRead"),isBusy:t,selectAll:i.length>0?{checked:l,indeterminate:a>0&&!l,onChange:f}:void 0})}const js=e=>{e.preventDefault(),e.stopPropagation()},jm=(e,t)=>{const n=c.useRef(!1),a=c.useCallback(i=>{if(n.current=!1,i.button!==0)return;const l=Ts(i);Cn(l)&&t?.(e,l)&&(js(i),n.current=!0,i.currentTarget.focus(),l.shiftKey&&window.getSelection()?.removeAllRanges())},[t,e]),r=c.useCallback(i=>{!i.ctrlKey||!t||i.preventDefault()},[t]),o=c.useCallback(i=>{if(n.current)return n.current=!1,js(i),!0;const l=Ts(i);return!Cn(l)||!t?.(e,l)?!1:(js(i),l.shiftKey&&window.getSelection()?.removeAllRanges(),!0)},[t,e]);return{onMouseDown:a,onContextMenu:r,claimClick:o}},wm=({thread:e,active:t=!1,focused:n,isTabStop:a,density:r="comfortable",isDesktop:o,badge:i,selection:l,inListbox:f=!1,link:b,onClick:h,onFocusRow:y})=>{const p=me(),v=e.id,m=gm(v),u=n??m?.focused??!1,d=a??m?.isTabStop??!1,g=l??m?.selection,k=y??m?.onFocusRow,x=o??m?.isDesktop??!0,w=g?.isChecked??!1,C=g?.isMultiSelectMode??!1,I=g?.onToggleCheck,M=g?.onRowSelect,E=g?.onLongPress,T=c.useCallback(S=>{S.preventDefault(),S.stopPropagation(),I?.(v)},[I,v]),P=jm(v,M),$=c.useCallback(S=>{if(!P.claimClick(S)){if(!x){if(C){S.preventDefault(),S.stopPropagation(),I?.(v);return}h?.();return}M?.(v,Ts(S)),h?.()}},[P,x,C,I,M,h,v]),K=c.useCallback(()=>{E?.(v)},[E,v]),{longPressProps:O}=ld({onLongPress:K,accessibilityDescription:w?"Deselect message":"Select message"}),j=c.useCallback(()=>{p.prefetchQuery(Yt({path:{messageId:v}}))},[p,v]),A=c.useCallback(()=>{j(),k?.(v)},[j,k,v]),z=Tt({"data-list-row":"","data-message-row":!0,"data-message-id":v,...f?{role:"option","aria-selected":w}:{},tabIndex:d?0:-1,onClick:$,onMouseDown:P.onMouseDown,onContextMenu:P.onContextMenu,onMouseEnter:j,onFocus:A},x||!g?{}:O),N=F(r==="compact"?er({active:t,focused:u}):F("group",Qs({active:t,focused:u})),"outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset",w&&"bg-accent-soft",!x&&"min-h-11 select-none [-webkit-touch-callout:none]"),L=r==="compact"?s.jsx(tr,{thread:e}):s.jsx(Ws,{thread:e,badge:i,selection:g?{checked:w,alwaysVisible:C,onToggle:T}:void 0});return b===void 0?s.jsx("button",{type:"button",...z,className:N,children:L}):s.jsx(ja,{to:"/mail/$mailboxId/$threadId/$messageId",params:{...b,messageId:v},search:S=>S,variant:"row",...z,className:N,children:L})},lh=c.memo(wm),Cm="Open a message first",Nm="This conversation hasn't loaded yet",Sm="The mailbox list hasn't loaded yet",Tm="Couldn't find this mailbox's account — reload to try again",Im={reply:"Reply",replyAll:"Reply all",forward:"Forward",delete:"Move to Trash",move:"Move to mailbox",flag:"Star"},ch=({hasThread:e,messageId:t,intelligenceOpen:n,canToggleIntelligence:a,onToggleIntelligence:r,onReply:o,onReplyAll:i,onForward:l,onDelete:f,onToggleStar:b,isStarred:h,moveContext:y,moveContextLoading:p})=>{const[v,m]=c.useState(null),u=t??null,d=E=>e?E==="move"?y?null:p?Sm:Tm:{reply:o,replyAll:i,forward:l,delete:f,flag:b}[E]?null:Nm:Cm,g=v&&v.messageId===u?v:null,k=g?d(g.action):null,x=g?.action==="move"&&g.overThread&&!!y,w=k??(g&&!x?`${Im[g.action]} is ready — press it again`:null),C=E=>m({action:E,messageId:u,overThread:e}),I=E=>()=>C(E),M=(E,T)=>T?()=>{m(null),T()}:I(E);return s.jsx(Vc,{hasThread:e,isStarred:h,onUnavailable:C,unavailableHint:w,replyTitle:`Reply ${dt("reply")}`,replyAllTitle:`Reply all ${dt("replyAll")}`,forwardTitle:`Forward ${dt("forward")}`,deleteTitle:`Move to Trash ${dt("delete")}`,flagTitle:`Star ${dt("toggleStar")}`,onReply:M("reply",o),onReplyAll:M("replyAll",i),onForward:M("forward",l),onDelete:M("delete",f),onToggleStar:M("flag",b),onMove:I("move"),moveSlot:y?s.jsx(rs,{accountId:y.accountId,currentMailboxId:y.currentMailboxId,onMove:y.onMove,label:"Move to mailbox",defaultOpen:x}):void 0,children:s.jsx(Wc,{open:n,enabled:a,onToggle:r})})};function Em(e){const[t,n]=c.useState(null);t!==null&&t!==e&&n(null);const a=e!==null&&t===e,r=c.useCallback(()=>n(null),[]),o=c.useCallback(()=>n(e),[e]),i=c.useCallback(()=>n(a?null:e),[a,e]);return{isOpen:a,open:o,close:r,toggle:i}}const dh=e=>{const{intelligenceOpen:t,onToggleIntelligence:n,onRaiseIntelligence:a}=St(),r=wa()?.showIntelligencePane??!1,o=e??null,i=Em(o),l=!r&&i.isOpen,{open:f,toggle:b}=i,h=c.useCallback(()=>{if(r){n();return}b()},[r,n,b]),y=c.useCallback(()=>{!r||t||a()},[r,t,a]),p=c.useCallback(()=>{if(!r){f();return}y()},[r,f,y]);return{canToggle:o!==null,isShowing:o!==null&&(r?t:l),toggle:h,open:p,drawerOpen:l,closeDrawer:i.close,railFits:r,openRail:y}},uh=(e,{toggle:t,open:n})=>{c.useEffect(()=>(e.current={toggle:t,open:n},()=>{e.current=null}),[e,t,n])},Rm=()=>{const e=me();return c.useCallback(t=>{const n=Ae({path:{threadId:t.threadId}}),r=e.getQueriesData({queryKey:n}).flatMap(([,o])=>o?.items.map(i=>i.messageId)??[]);return r.length>0?r:[t.messageId]},[e])},Mm=[],Mr=e=>{const{data:t}=se({...va({path:{threadId:e??""}}),enabled:!!e});return t?.items??Mm},fh=(e,t)=>{const n=Mr(e),a=t?n.find(o=>o.messageId===t):void 0,r=n.length>0?n[n.length-1]:void 0;return a??r},mh=({thread:e,isOpen:t=!1,mailboxId:n,accountId:a,onAfterOptimisticRemove:r})=>{const o=n??e?.mailboxId,i=a??e?.accountId,{accountId:l}=ns(i?void 0:o),f=i??l,b=Rm(),{deleteMessages:h}=as({mailboxId:o??"",threadId:e?.threadId,accountId:f,onAfterOptimisticRemove:r}),{moveMessages:y}=Et({mailboxId:o??"",threadId:e?.threadId,accountId:f,onAfterOptimisticRemove:r}),p=Mr(t?e?.threadId:void 0),m=p.find(x=>x.messageId===e?.messageId)?.hasStars??e?.hasStars,{toggleStar:u}=mr({threadId:e?.threadId??"",mailboxId:o??"",messages:p}),d=c.useCallback(()=>{e&&h(b(e))},[e,b,h]),g=c.useCallback(x=>{e&&y(b(e),x)},[e,b,y]),k=c.useCallback(()=>{e&&u(e.messageId,m??!1)},[e,m,u]);return{mailboxId:o,accountId:f,isStarred:m,deleteThread:d,moveThread:g,toggleStar:k}},Jn=(e,t,n)=>{if(!t)return null;const a=e.indexOf(t);if(a===-1)return null;const r=n==="next"?a+1:a-1;return r<0||r>=e.length?null:e[r]},ph=()=>{const[e,t]=c.useState(void 0),[n,a]=c.useState([]),[r,o]=c.useState([]),i=c.useRef(null),[l,f]=c.useState(!1),b=c.useCallback(h=>{t(h.focusedMessageId),a(h.selectedIds),h.orderedIds&&o(h.orderedIds),f(h.hasList)},[]);return{listCommandsRef:i,onTriageContextChange:b,focusedMessageId:e,selectedIds:n,orderedIds:r,hasList:l}},hh=({context:e,orderedIds:t,selectedMessageId:n,enabled:a=!0,onClose:r,handlers:o,hasOpenThread:i=!1})=>{const{listCommandsRef:l,hasList:f}=e,b=c.useCallback(()=>{l.current?.clearSelection()||n&&r()},[l,n,r]),{reply:h,replyAll:y,forward:p,...v}=o;return yi({enabled:a,handlers:{...f?{focusNext:()=>l.current?.focusNext(),focusPrevious:()=>l.current?.focusPrevious(),focusFirst:()=>l.current?.focusFirst(),focusLast:()=>l.current?.focusLast(),openFocused:()=>l.current?.openFocused(),toggleSelect:()=>l.current?.toggleSelect(),extendSelectDown:()=>l.current?.extendSelectDown(),extendSelectUp:()=>l.current?.extendSelectUp(),selectAll:()=>l.current?.selectAll(),toggleDensity:()=>l.current?.toggleDensity()}:{},back:b,...v,...i?{}:{reply:h,replyAll:y,forward:p}}}),{goBack:b,nextMessageId:Jn(t,n,"next")??void 0,previousMessageId:Jn(t,n,"previous")??void 0}},Am={unread:"unread",flagged:"starred",attachment:"attachments"},$m=new Set(Object.values(oi)),Ar=e=>$m.has(e),gh=e=>Ar(e.category)||e.attributes.size>0,xh=e=>{const t={};Ar(e.category)&&(t.category=[e.category]);for(const n of e.attributes){const a=Am[n];a&&(t[a]=!0)}return t},bh=e=>(e.senderTrust?.length??0)>0||e.dkimMismatch!==void 0?"loaded-pages":"whole-folder",Lm=["category","unread","starred","attachments","accountId","muted"],Xn=e=>JSON.stringify(Lm.map(t=>e?.[t]??null)),Pm=e=>{if(!Array.isArray(e))return;const[t]=e;if(typeof t!="object"||t===null)return;const n=t.query;if(!(typeof n!="object"||n===null))return n},vh=(e,t)=>{const n=Pm(e);return n?Xn(n)===Xn(t):!1},yh=e=>ka(e)?Vt[e]:void 0,Fm={sender:"sender",recipient:"recipient",subject:"subject",attachment:"attachment",body:"body",entities:"entities"};function Dm(e){return Fm[e]??e}function kh(e,t){const{folder:n}=_s(t,[e.mailboxId]);return{id:e.messageId,sender:e.fromName??e.fromEmail??"Unknown",...e.fromEmail?{senderEmail:e.fromEmail}:{},subject:e.subject??"(No subject)",snippet:e.snippet??"",date:st(e.sentDate),unread:!e.isRead,flagged:e.hasStars===!0,threadId:e.threadId,mailboxId:e.mailboxId,...n?{folder:n}:{}}}function jh(e,t){const{folder:n}=_s(t,e.mailboxId?[e.mailboxId]:[]);return{id:e.id,sender:e.fromName,...e.fromEmail?{senderEmail:e.fromEmail}:{},subject:e.subject,snippet:e.snippet,date:e.timeLabel,unread:!e.isRead,flagged:e.starred===!0,...e.threadId?{threadId:e.threadId}:{},...e.mailboxId?{mailboxId:e.mailboxId}:{},...n?{folder:n}:{}}}function Om(e,t){const{mailboxId:n,folder:a}=_s(t,e.mailboxIds);return{id:e.messageId,sender:e.fromName??"Unknown",subject:e.subject??"(No subject)",snippet:"",date:e.sentDate!=null?st(e.sentDate*1e3):"",threadId:e.threadId,matchedChunkLabel:Dm(e.matchedChunkType),score:e.score,...n?{mailboxId:n}:{},...a?{folder:a}:{}}}function wh(e,t,n){const a=new Set(t),r=[];for(const o of[...e].sort((i,l)=>l.score-i.score))a.has(o.threadId)||(a.add(o.threadId),r.push(Om(o,n)));return r}function zm(e){const t=e.authenticity?.dkimMismatch===!0;return{id:e.messageId,accountId:e.accountId,mailboxId:e.mailboxId,threadId:e.threadId,fromName:e.fromName??e.fromEmail??"Unknown",fromEmail:e.fromEmail??"",subject:e.subject??"(No subject)",snippet:e.snippet??"",timeLabel:st(e.sentDate),sentDate:e.sentDate,isRead:e.isRead,hasAttachment:e.hasAttachment,starred:e.hasStars===!0,trust:e.senderTrust,category:pr(e.category),suspicious:t,...Wu(e)}}const _m=ii;function Ch(e){const t=new Map(e.map(a=>[a.category,a])),n=[];for(const a of _m){const r=t.get(a);!r||!(r.loading||r.failed||r.rows.length>0||r.total.kind==="exact"&&r.total.value>0)||n.push({id:a,label:Vt[a],threads:r.rows,total:r.total,atCap:r.atCap,loading:r.loading,error:r.failed})}return n}function Um(e,t){return t.every(n=>{switch(n.type){case"from":{const a=n.value.toLowerCase();return e.fromEmail.toLowerCase().includes(a)||e.fromName.toLowerCase().includes(a)}case"subject":return e.subject.toLowerCase().includes(n.value.toLowerCase());case"category":return(e.category??"uncategorized")===n.category;case"hasAttachment":return e.hasAttachment===!0;case"isUnread":return!e.isRead;case"isRead":return e.isRead===!0;case"isStarred":return e.starred===!0;case"after":return e.sentDate!=null&&e.sentDate>=n.epochSeconds*1e3;case"before":return e.sentDate!=null&&e.sentDate<n.epochSeconds*1e3;case"in":return e.mailboxId===n.mailboxId;case"account":return e.accountId===n.accountId;default:return!1}})}const Bm=["from","subject","category","unread","starred","attachments"],Ut=e=>e[0],Km=e=>{const t=Ut(e.filter(l=>l.type==="from").map(l=>l.value)),n=Ut(e.filter(l=>l.type==="subject").map(l=>l.value)),a=Ut(e.filter(l=>l.type==="category").map(l=>l.category)),r=Ut(e.filter(l=>l.type==="isUnread"||l.type==="isRead").map(l=>l.type==="isUnread")),o=e.some(l=>l.type==="isStarred")?!0:void 0,i=e.some(l=>l.type==="hasAttachment")?!0:void 0;return{...t!==void 0?{from:t}:{},...n!==void 0?{subject:n}:{},...a!==void 0?{category:[a]}:{},...r!==void 0?{unread:r}:{},...o!==void 0?{starred:o}:{},...i!==void 0?{attachments:i}:{}}},Hm=(e,t)=>{switch(t.type){case"from":return e.from?.toLowerCase()===t.value.toLowerCase();case"subject":return e.subject?.toLowerCase()===t.value.toLowerCase();case"category":return e.category?.length===1&&e.category[0]===t.category;case"isUnread":return e.unread===!0;case"isRead":return e.unread===!1;case"isStarred":return e.starred===!0;case"hasAttachment":return e.attachments===!0;case"before":case"after":case"in":case"account":return!1}},Zn=(e,t)=>Object.fromEntries(Object.entries(e).filter(([n])=>t.includes(n)));function Nh(e,t={},n=Bm){const a=Zn(Km(e),n),r={...a,...Zn(t,n)};return{params:a,residual:e.filter(o=>!Hm(r,o))}}function Sh(e,t,n){if(t.length===0)return e;const a=[...t];return e.filter(r=>{const o=zm(r);return Um({...o,accountId:o.accountId??n},a)})}const $r=8;function Xs(e,t){const n=Math.max(0,Math.min(t,e.length)),a=Ai(e).find(o=>n>=o.start&&n<=o.end);if(!a)return{start:n,end:n,raw:""};const r=$i(a.raw);return r?{start:a.start,end:a.end,raw:a.raw,name:r.name,value:r.value}:{start:a.start,end:a.end,raw:a.raw}}function qm(e,t){const n=Xs(e,t);if(n.name===void 0)return{kind:"token",query:n.raw};const a=Ea(n.name);if(a)return{kind:"value",token:a.name,source:a.values,query:n.value??""}}const Qm={mailbox:"mailboxes",account:"accounts",contact:"contacts"},Wm=(e,t)=>{if(e.values==="fixed")return e.options??[];const n=Qm[e.values];return n?t[n]??[]:[]},Gm=(e,t)=>{if(t==="")return 1;const n=e.toLowerCase();return n.startsWith(t)?0:n.includes(t)?1:-1},As=(e,...t)=>{let n=-1;for(const a of t){if(a===void 0)continue;const r=Gm(a,e);r<0||(n<0||r<n)&&(n=r)}return n},Lr=e=>{const t=new Set;return e.filter(n=>n.rank>=0).sort((n,a)=>n.rank-a.rank).filter(n=>{const a=n.suggestion.value.toLowerCase();return t.has(a)?!1:(t.add(a),!0)}).slice(0,$r).map(n=>n.suggestion)},ea=e=>({value:`${e.name}:`,label:`${e.name}:`,hint:e.label});function Vm(e){const t=e.trim().toLowerCase();if(t==="")return dn.map(ea);const n=[];for(const a of dn)if(n.push({rank:As(t,`${a.name}:`,a.label),suggestion:ea(a)}),a.values==="fixed")for(const r of a.options??[]){const o=Ra(a.name,r.value);n.push({rank:As(t,o,r.label),suggestion:{value:o,label:r.label??o,hint:o}})}return Lr(n)}function Ym(e,t,n){const a=t.trim().toLowerCase(),r=Wm(e,n).map(o=>({rank:As(a,o.value,o.label),suggestion:{value:Ra(e.name,o.value),label:o.label??o.value,...o.hint?{hint:o.hint}:{}}}));return Lr(r)}function Jm(e,t,n={}){const a=Xs(e,t);if(a.name===void 0)return Vm(a.raw);const r=Ea(a.name);return r?Ym(r,a.value??"",n):[]}function Xm(e,t,n){const a=Xs(e,t),r=!n.value.endsWith(":"),o=/\s/.test(e.slice(a.end,a.end+1)),i=r&&!o?`${n.value} `:n.value;return{query:e.slice(0,a.start)+i+e.slice(a.end),cursor:a.start+i.length+(r&&o?1:0)}}const Zm=e=>({value:e.normalizedEmail,...e.displayName?{label:e.displayName,hint:e.normalizedEmail}:{}}),ep=250,tp=2;function sp({query:e,cursor:t,enabled:n}){const{accounts:a}=St(),{mailboxesByName:r}=Ma(),o=r!==void 0,i=n?qm(e,t):void 0,l=i?.source==="contact"?i.query.trim():"",f=Fa(l,ep),{data:b}=se({...zs({query:{q:f,limit:$r}}),enabled:f.length>=tp}),h=Us({queries:a.map(m=>({...yt({path:{accountId:m.accountId}}),staleTime:1/0}))}),y=c.useMemo(()=>o?ki(h.map(m=>m.data?.items??[]),a):[],[o,h,a]),p=c.useMemo(()=>ji(a),[a]),v=c.useMemo(()=>(b?.items??[]).map(Zm),[b]);return c.useMemo(()=>{if(!n)return[];const m=Jm(e,t,{mailboxes:y,accounts:p,contacts:v});return o?m:m.filter(u=>u.value!=="in:")},[n,e,t,y,p,v,o])}const Pr="remit.recentSearches",np=5;function $s(){try{const e=localStorage.getItem(Pr);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function ta(e){const t=e.trim();if(!t)return $s();const n=[t,...$s().filter(a=>a!==t)].slice(0,np);try{localStorage.setItem(Pr,JSON.stringify(n))}catch{return n}return n}const ap=e=>e.tier!=="phone"&&e.hasLiveInput&&!(e.bodyRendersCommittedResults&&e.hasCommittedQuery),Ls=c.createContext(null);function rp(){const e=c.useContext(Ls),{searchInput:t,onSearchChange:n,onSearchClear:a}=St();if(!e)throw new Error("ListHeaderSearchField rendered outside MailListHeader's HeaderSearchContext provider");return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(Na,{value:t,onChange:n,onClear:a,globalFocusKey:!1,showClearButton:!1,suggest:e.suggest})}),s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(Xe,{className:"size-5"}),onClick:e.onClose,"aria-label":"Close search",className:"shrink-0"}),s.jsx(Ca,{})]})}function Th({title:e,unreadCount:t,children:n,selectionBar:a,paneOverlay:r,footer:o,searchFilter:i,searchResults:l,searchLoading:f,relatedResults:b,relatedLoading:h,onSelectSearchResult:y,searchResultsLabel:p="Top matches",relatedResultsLabel:v="Related",searchResultsInBody:m=!1,spamOffer:u,refreshControl:d}){const{accounts:g,resultFolderIndex:k,searchQuery:x,searchInput:w,onSearchChange:C,onSearchClear:I,searchViewKey:M}=St(),E=Ma(),T=wi(),P=wa(),$=Ml(),[K,O]=c.useState(!1),[j,A]=c.useState($s),z=li(),N=c.useRef(M);c.useEffect(()=>{N.current!==M&&(N.current=M,O(!1))},[M]);const[L,S]=c.useState(0),[_,B]=c.useState(!1),[W,X]=c.useState(void 0),Y=sp({query:w,cursor:L,enabled:_&&w.trim().length>0}),re=c.useCallback(le=>{const je=Xm(w,L,le);C(je.query),X({cursor:je.cursor})},[w,L,C]),ee=ci({count:Y.length,onAccept:le=>{const je=Y[le];je&&re(je)}}),{comboboxProps:de,handleKeyDown:D}=ee,Z=c.useMemo(()=>({comboboxProps:de,onKeyDown:D,onCaretChange:S,onFocusChange:B,...W?{caret:W}:{}}),[de,D,W]),ue=c.useCallback(()=>{I(),O(!1)},[I]),pe=c.useMemo(()=>({suggest:Z,onClose:ue}),[Z,ue]),he=ee.open?s.jsx(mi,{id:ee.listId,suggestions:Y,activeIndex:ee.activeIndex,optionId:ee.optionId,onPick:re,onHighlight:ee.setActiveIndex,label:"Search suggestions",className:"mx-row-inset mt-1 shrink-0"}):null,q=w.trim().length>0,{mailboxesByName:oe,accountsByName:Q}=E,G=c.useMemo(()=>Li(w,{mailboxesByName:oe,accountsByName:Q}),[w,oe,Q]),ae=c.useMemo(()=>G.tokens.map(le=>({label:Ia(le),onRemove:()=>C(Pi(w,le))})),[G,w,C]),ye=c.useMemo(()=>l??[],[l]),Le=c.useMemo(()=>b??[],[b]),at=c.useMemo(()=>q?[{id:"top",label:p,results:ye},{id:"related",label:v,results:Le}]:[],[q,p,v,ye,Le]),He=!(ye.length+Le.length>0)&&(f===!0||h===!0),{scope:rt}=Ci(g),V=di(),Rt=$l(V),Pe=Rt?k.get(Rt)?.role:void 0,Ce=c.useMemo(()=>Ll(V,rt,Pe),[V,rt,Pe]),fe=Ce.kind==="global"?u:void 0,ke=c.useMemo(()=>fe?{kind:"global",spamCount:fe.count,onScopeToSpam:()=>T(fe.mailboxId,x)}:Ce,[fe,Ce,T,x]),qe=Le.length>0,Qe=c.useMemo(()=>tm(G,{searchHadSemanticReach:qe}),[G,qe]),ie=q?Qe:void 0,te=c.useCallback(()=>{O(!1),z("properties","search")},[z]),Fe=Wd(Qe)?void 0:ui(Qe.droppedFacets.map(le=>le.label)),De=c.useMemo(()=>q?{onClick:te,blockedReason:Fe}:void 0,[q,Fe,te]),is=c.useMemo(()=>De?s.jsx(ir,{...De}):null,[De]),Ne=ap({tier:$,hasLiveInput:q,hasCommittedQuery:x.trim().length>0,bodyRendersCommittedResults:m}),Oe=c.useCallback(le=>{A(ta(w)),y?.(le)},[w,y]),Mt=c.useMemo(()=>s.jsx(lr,{value:w,sections:at,loading:He,onSelectResult:Oe,tokens:ae,scope:ke}),[w,at,He,Oe,ae,ke]),We=a===void 0,ze=c.useMemo(()=>Ne?s.jsx("div",{className:"h-full overflow-y-auto",children:Mt}):null,[Ne,Mt]),Ge=ze&&!We?ze:n,At=ze&&We?ze:null,ot=Al($),it=ot&&(K||q),lt=c.useMemo(()=>({title:e,searchResults:At,makeFilterSlot:is,navSlot:P&&!P.showNavPane&&s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(Pl,{className:"size-5"}),onClick:()=>P.openNav(),"aria-label":"Menu",className:"-ml-2 shrink-0"}),titleMeta:s.jsxs(s.Fragment,{children:[t===null?null:s.jsxs("span",{className:"shrink-0 text-2xs text-fg-subtle",children:[t.toLocaleString()," unread"]}),s.jsx(Ca,{}),d]}),searchSlot:ot&&!it&&s.jsx(H,{variant:"ghost",size:"touch",icon:s.jsx(fi,{className:"size-5"}),onClick:()=>O(!0),"aria-label":"Search",className:"shrink-0"}),searchField:it&&s.jsx(rp,{})}),[e,t,P,ot,it,At,is,d]);if($==="phone"&&K){const le=je=>{A(ta(w)),O(!1),y?.(je)};return s.jsx(Ls.Provider,{value:pe,children:s.jsx(Ms.Provider,{value:ie,children:s.jsxs(Rs.Provider,{value:lt,children:[s.jsx(vd,{value:w,onChange:C,onClear:I,onCancel:()=>{O(!1),I()},filter:i,recentSearches:j,onPickRecent:C,makeFilter:De,sections:at,loading:He,onSelectResult:le,tokens:ae,scope:ke,suggest:Z,suggestList:he}),r]})})})}return s.jsx(Ls.Provider,{value:pe,children:s.jsx(Ms.Provider,{value:ie,children:s.jsx(Rs.Provider,{value:lt,children:s.jsxs("section",{className:"relative flex h-full w-full flex-col bg-surface",children:[a?.(lt),he,s.jsx("div",{className:"min-h-0 flex-1",children:Ge}),o,r]})})})})}export{nh as $,gh as A,Nh as B,ad as C,Lf as D,ns as E,Sh as F,Jp as G,bh as H,fh as I,as as J,Et as K,ph as L,lh as M,mh as N,Vp as O,Gp as P,Rm as Q,mr as R,yd as S,uf as T,mf as U,hf as V,pf as W,hh as X,Em as Y,uh as Z,Xp as _,$f as a,wf as a0,dh as a1,ch as a2,qp as a3,Yp as a4,kh as a5,wh as a6,vh as a7,ld as a8,Tt as a9,qs as aa,Ts as ab,Bp as ac,Kp as ad,_p as ae,Up as af,yh as ag,Th as ah,Vs as ai,_m as aj,zm as ak,Um as al,jh as am,xd as an,Ch as ao,Hp as ap,ap as aq,md as ar,oh as as,wn as at,xm as au,Qp as av,ih as aw,Wp as b,Qs as c,hr as d,Cf as e,sd as f,Sf as g,If as h,Jd as i,ah as j,Mf as k,rh as l,Jc as m,td as n,Rf as o,pu as p,gr as q,Wu as r,eh as s,pr as t,jm as u,th as v,sh as w,hu as x,Zp as y,xh as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-BgsHJXrW.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aj as m,j as o,O as p}from"./index-BgsHJXrW.js";import{a}from"./MailShell-CBX109fx.js";import{M as r}from"./MailboxPane-D9zqi3Rr.js";import{a as e}from"./search-token-index-CrVbBlms.js";import{u as s}from"./search-mirror-wk9khC5m.js";import"./FullCompose-BDr9-FPu.js";import"./ErrorState-CmLGalXf.js";import"./index-CEJMvVKP.js";import"./useMessageBodyContent-QMy924K4.js";import"./useSignature-_lI__r_z.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CypIbLxd.js";import"./sections-CgVZgQC0.js";import"./confirm-dialog-DqUyGPYb.js";import"./useSearchTokenContext-_mPqHIqE.js";import"./kbd-o1nflZRu.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-DNtJwW7i.js";import"./circle-check-big-Vq2QoGgP.js";import"./refresh-cw-DmMLGyvw.js";import"./useQueries-DBc1JIwH.js";import"./MailListHeader-D8dncvLk.js";import"./roving-focus-D8ieiood.js";import"./popover-menu-DH1B01dU.js";import"./mail-xjJzF7Ec.js";import"./avatar-OJww5F3k.js";import"./EmptyState-haDMp8Ar.js";import"./undo-2-QAbYZsVP.js";import"./download-CExFNT5m.js";import"./calendar-suggestion-f9IkXHda.js";import"./calendar-format-CwRw4RDu.js";import"./useCalendars-DEAe0d5P.js";import"./calendar-report-DMvb9Sqg.js";import"./attendee-row-DMe42k7H.js";import"./minus-BD2hQqDO.js";import"./clock-BBpIdhnS.js";import"./calendar-clash-strip-Do_J9SgJ.js";import"./bell-off-JyhxJiJh.js";import"./copy-BFnJYo3G.js";import"./shield-check-CUjnaEJM.js";import"./useFilters-Cv87jtMp.js";import"./checkbox-SlSTA73y.js";import"./useLayoutTier-BnLQZtW5.js";import"./menu-B7ZT3hES.js";import"./MailViewChrome-K588o61G.js";import"./pane-header-BCtLNcGD.js";import"./NavMenuButton-BpGFPcon.js";import"./useLabels-B74FIyrh.js";import"./useSemanticSearch-JUvleuzy.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BXHtkHEQ.js";import"./circle-help-gen-dtEL.js";import"./circle-check-Bp2lyV0E.js";function so(){const{mailboxId:t}=m.useParams(),i=e();return s({to:"/mail/$mailboxId",params:{mailboxId:t}}),o.jsx(r,{mailboxId:t,thread:i,children:o.jsx(a,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(p,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!i})})}export{so as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-BgsHJXrW.js";import{F as r}from"./FlaggedPane-B5Ht6vwP.js";import"./useSearchTokenContext-_mPqHIqE.js";import"./kbd-o1nflZRu.js";import"./useMessageBodyContent-QMy924K4.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-D8dncvLk.js";import"./roving-focus-D8ieiood.js";import"./search-token-index-CrVbBlms.js";import"./useQueries-DBc1JIwH.js";import"./popover-menu-DH1B01dU.js";import"./mail-xjJzF7Ec.js";import"./avatar-OJww5F3k.js";import"./index-CEJMvVKP.js";import"./useSignature-_lI__r_z.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CypIbLxd.js";import"./sections-CgVZgQC0.js";import"./EmptyState-haDMp8Ar.js";import"./ErrorState-CmLGalXf.js";import"./undo-2-QAbYZsVP.js";import"./download-CExFNT5m.js";import"./calendar-suggestion-f9IkXHda.js";import"./calendar-format-CwRw4RDu.js";import"./useCalendars-DEAe0d5P.js";import"./calendar-report-DMvb9Sqg.js";import"./attendee-row-DMe42k7H.js";import"./minus-BD2hQqDO.js";import"./clock-BBpIdhnS.js";import"./calendar-clash-strip-Do_J9SgJ.js";import"./bell-off-JyhxJiJh.js";import"./copy-BFnJYo3G.js";import"./shield-check-CUjnaEJM.js";import"./useFilters-Cv87jtMp.js";import"./checkbox-SlSTA73y.js";import"./confirm-dialog-DqUyGPYb.js";import"./useLayoutTier-BnLQZtW5.js";import"./menu-B7ZT3hES.js";import"./MailViewChrome-K588o61G.js";import"./refresh-cw-DmMLGyvw.js";import"./wizard-selection-DxUM65kM.js";function Q(){return o.jsx(r.Reading,{})}export{Q as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-BgsHJXrW.js";import{B as o}from"./BriefPane-i-1XzvAd.js";import"./useSearchTokenContext-_mPqHIqE.js";import"./kbd-o1nflZRu.js";import"./useMessageBodyContent-QMy924K4.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-D8dncvLk.js";import"./roving-focus-D8ieiood.js";import"./search-token-index-CrVbBlms.js";import"./useQueries-DBc1JIwH.js";import"./popover-menu-DH1B01dU.js";import"./mail-xjJzF7Ec.js";import"./avatar-OJww5F3k.js";import"./index-CEJMvVKP.js";import"./useSignature-_lI__r_z.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CypIbLxd.js";import"./sections-CgVZgQC0.js";import"./EmptyState-haDMp8Ar.js";import"./ErrorState-CmLGalXf.js";import"./undo-2-QAbYZsVP.js";import"./download-CExFNT5m.js";import"./calendar-suggestion-f9IkXHda.js";import"./calendar-format-CwRw4RDu.js";import"./useCalendars-DEAe0d5P.js";import"./calendar-report-DMvb9Sqg.js";import"./attendee-row-DMe42k7H.js";import"./minus-BD2hQqDO.js";import"./clock-BBpIdhnS.js";import"./calendar-clash-strip-Do_J9SgJ.js";import"./bell-off-JyhxJiJh.js";import"./copy-BFnJYo3G.js";import"./shield-check-CUjnaEJM.js";import"./useFilters-Cv87jtMp.js";import"./checkbox-SlSTA73y.js";import"./confirm-dialog-DqUyGPYb.js";import"./useLayoutTier-BnLQZtW5.js";import"./menu-B7ZT3hES.js";import"./useRefreshControl-DNtJwW7i.js";import"./circle-check-big-Vq2QoGgP.js";import"./refresh-cw-DmMLGyvw.js";import"./useSemanticSearch-JUvleuzy.js";import"./useLabels-B74FIyrh.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-DxUM65kM.js";function V(){return r.jsx(o.Reading,{})}export{V as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-BgsHJXrW.js";import{M as r}from"./MailboxPane-D9zqi3Rr.js";import"./useSearchTokenContext-_mPqHIqE.js";import"./kbd-o1nflZRu.js";import"./useMessageBodyContent-QMy924K4.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-DNtJwW7i.js";import"./circle-check-big-Vq2QoGgP.js";import"./refresh-cw-DmMLGyvw.js";import"./useQueries-DBc1JIwH.js";import"./MailListHeader-D8dncvLk.js";import"./roving-focus-D8ieiood.js";import"./search-token-index-CrVbBlms.js";import"./popover-menu-DH1B01dU.js";import"./mail-xjJzF7Ec.js";import"./avatar-OJww5F3k.js";import"./index-CEJMvVKP.js";import"./useSignature-_lI__r_z.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CypIbLxd.js";import"./sections-CgVZgQC0.js";import"./EmptyState-haDMp8Ar.js";import"./ErrorState-CmLGalXf.js";import"./undo-2-QAbYZsVP.js";import"./download-CExFNT5m.js";import"./calendar-suggestion-f9IkXHda.js";import"./calendar-format-CwRw4RDu.js";import"./useCalendars-DEAe0d5P.js";import"./calendar-report-DMvb9Sqg.js";import"./attendee-row-DMe42k7H.js";import"./minus-BD2hQqDO.js";import"./clock-BBpIdhnS.js";import"./calendar-clash-strip-Do_J9SgJ.js";import"./bell-off-JyhxJiJh.js";import"./copy-BFnJYo3G.js";import"./shield-check-CUjnaEJM.js";import"./useFilters-Cv87jtMp.js";import"./checkbox-SlSTA73y.js";import"./confirm-dialog-DqUyGPYb.js";import"./useLayoutTier-BnLQZtW5.js";import"./menu-B7ZT3hES.js";import"./MailViewChrome-K588o61G.js";import"./pane-header-BCtLNcGD.js";import"./NavMenuButton-BpGFPcon.js";import"./useLabels-B74FIyrh.js";import"./useSemanticSearch-JUvleuzy.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-BXHtkHEQ.js";import"./circle-help-gen-dtEL.js";import"./circle-check-Bp2lyV0E.js";function _(){return o.jsx(r.Reading,{})}export{_ as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-BgsHJXrW.js";import{O as t}from"./OutboxPane-Bk9nNby0.js";import"./roving-focus-D8ieiood.js";import"./useSearchTokenContext-_mPqHIqE.js";import"./kbd-o1nflZRu.js";import"./useMessageBodyContent-QMy924K4.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-Vq2QoGgP.js";import"./clock-BBpIdhnS.js";import"./row-actions-d4_6b5VY.js";import"./rotate-ccw-BzTXXy6H.js";import"./pane-header-BCtLNcGD.js";import"./NavMenuButton-BpGFPcon.js";import"./menu-B7ZT3hES.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function R(){return o.jsx(t.Reading,{})}export{R as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{eW as o,j as m}from"./index-BgsHJXrW.js";import{O as p}from"./OpenCalendarEvent-BwmHUJaw.js";import"./CalendarComposePane-C9LVQJgz.js";import"./calendar-format-CwRw4RDu.js";import"./useQueries-DBc1JIwH.js";import"./useCalendars-DEAe0d5P.js";import"./calendar-clash-strip-Do_J9SgJ.js";import"./attendee-row-DMe42k7H.js";import"./avatar-OJww5F3k.js";import"./minus-BD2hQqDO.js";import"./clock-BBpIdhnS.js";import"./calendar-report-DMvb9Sqg.js";import"./mail-xjJzF7Ec.js";import"./pencil-BDdwSTNF.js";import"./useCalendarWrites-CMxbq1Ns.js";import"./ErrorState-CmLGalXf.js";import"./useCalendarData-J9M1uPwl.js";import"./calendar-subscription-B-aAc2Gy.js";function v(){const{calendarObjectId:r,recurrenceId:t}=o.useParams();return m.jsx(p,{calendarObjectId:r,recurrenceId:t})}export{v as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-BgsHJXrW.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-BgsHJXrW.js";const n=o;export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{O as o}from"./index-BgsHJXrW.js";const n=o;export{n as component};
|
package/assets/brief-3daIc_U_.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r,O as i}from"./index-BgsHJXrW.js";import{a as m}from"./MailShell-CBX109fx.js";import{B as o}from"./BriefPane-i-1XzvAd.js";import{a as p}from"./search-token-index-CrVbBlms.js";import{u as e}from"./search-mirror-wk9khC5m.js";import"./FullCompose-BDr9-FPu.js";import"./ErrorState-CmLGalXf.js";import"./index-CEJMvVKP.js";import"./useMessageBodyContent-QMy924K4.js";import"./useSignature-_lI__r_z.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CypIbLxd.js";import"./sections-CgVZgQC0.js";import"./confirm-dialog-DqUyGPYb.js";import"./useSearchTokenContext-_mPqHIqE.js";import"./kbd-o1nflZRu.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-D8dncvLk.js";import"./roving-focus-D8ieiood.js";import"./popover-menu-DH1B01dU.js";import"./mail-xjJzF7Ec.js";import"./avatar-OJww5F3k.js";import"./EmptyState-haDMp8Ar.js";import"./undo-2-QAbYZsVP.js";import"./download-CExFNT5m.js";import"./calendar-suggestion-f9IkXHda.js";import"./calendar-format-CwRw4RDu.js";import"./useQueries-DBc1JIwH.js";import"./useCalendars-DEAe0d5P.js";import"./calendar-report-DMvb9Sqg.js";import"./attendee-row-DMe42k7H.js";import"./minus-BD2hQqDO.js";import"./clock-BBpIdhnS.js";import"./calendar-clash-strip-Do_J9SgJ.js";import"./bell-off-JyhxJiJh.js";import"./copy-BFnJYo3G.js";import"./shield-check-CUjnaEJM.js";import"./useFilters-Cv87jtMp.js";import"./checkbox-SlSTA73y.js";import"./useLayoutTier-BnLQZtW5.js";import"./menu-B7ZT3hES.js";import"./useRefreshControl-DNtJwW7i.js";import"./circle-check-big-Vq2QoGgP.js";import"./refresh-cw-DmMLGyvw.js";import"./useSemanticSearch-JUvleuzy.js";import"./useLabels-B74FIyrh.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-DxUM65kM.js";function or(){const t=p();return e({to:"/mail/brief"}),r.jsx(o,{thread:t,children:r.jsx(m,{phone:r.jsx(o.Phone,{}),list:r.jsx(o.List,{}),reading:r.jsx(i,{}),intelligence:r.jsx(o.Intelligence,{}),hasThread:!!t})})}export{or as component};
|