@remit/web-client-dist 0.0.641 → 0.0.642
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-D1p8nleB.js → BriefPane-DTu07n2X.js} +1 -1
- package/assets/CalendarComposePane-CaFfehJ3.js +1 -0
- package/assets/{CalendarComposeSeed-Ddue6yGg.js → CalendarComposeSeed-Qwwu-xz8.js} +1 -1
- package/assets/{CalendarShell-ay8jVvby.js → CalendarShell-DdBSP0nU.js} +1 -1
- package/assets/{EmptyState-DxT13qcR.js → EmptyState-DffMrivH.js} +1 -1
- package/assets/{ErrorState-CHxEHbvf.js → ErrorState-zb46wwqB.js} +1 -1
- package/assets/{FlaggedPane-CJ__xJpf.js → FlaggedPane-StYE07Pk.js} +1 -1
- package/assets/{FullCompose-DkV5Z3KV.js → FullCompose-CtKaGlct.js} +1 -1
- package/assets/MailListHeader-DMMl8ZLg.js +7 -0
- package/assets/{MailNav-DBY9OW6Y.js → MailNav-CDMm535x.js} +1 -1
- package/assets/{MailShell-LEDBmXGr.js → MailShell-C6XAYw9R.js} +1 -1
- package/assets/{MailViewChrome-7gtXtr7X.js → MailViewChrome-BcPAwjzq.js} +1 -1
- package/assets/{MailboxPane-sccwyPwa.js → MailboxPane-Bo_304LU.js} +1 -1
- package/assets/{NavMenuButton-C3UDJB1v.js → NavMenuButton-C7p7FLnh.js} +1 -1
- package/assets/{OnboardingWizard-DWrpEauO.js → OnboardingWizard-D15SDpIN.js} +1 -1
- package/assets/OpenCalendarEvent-CVHpXp5y.js +2 -0
- package/assets/{OutboxPane-oxeCJEiZ.js → OutboxPane-k7EI73dP.js} +1 -1
- package/assets/_calendarObjectId-BmWKOwZU.js +1 -0
- package/assets/_mailboxId-C5oOoR9Y.js +1 -0
- package/assets/_messageId-BQu6o3gE.js +1 -0
- package/assets/_messageId-CUK6OwnE.js +1 -0
- package/assets/_messageId-DiKCBlFd.js +1 -0
- package/assets/_outboxMessageId-BLqK1FUW.js +1 -0
- package/assets/_recurrenceId-CTMy5M6x.js +1 -0
- package/assets/_threadId-BQ2ENDxN.js +1 -0
- package/assets/_threadId-B_-kfUCd.js +1 -0
- package/assets/_threadId-CRbs6xQJ.js +1 -0
- package/assets/_view._date-BjTcS5dY.js +1 -0
- package/assets/{accounts-D080vGx7.js → accounts-BKh6zOiZ.js} +1 -1
- package/assets/{advanced-CkUEORb7.js → advanced-AosgdV6N.js} +1 -1
- package/assets/{appearance-C7pPonlu.js → appearance-lDYvlXFT.js} +1 -1
- package/assets/{attendee-row-t7d1gEVn.js → attendee-row-CNSd4msf.js} +1 -1
- package/assets/{avatar-C2R7xqlA.js → avatar-BU2Acypp.js} +1 -1
- package/assets/{bell-off-CD1iuAQA.js → bell-off-BDdZq1id.js} +1 -1
- package/assets/{bottom-sheet-DZ2d0h_L.js → bottom-sheet-OT_uLnD0.js} +1 -1
- package/assets/{brief-BVo4rf_J.js → brief-B3LHy3XK.js} +1 -1
- package/assets/brief-DfHqHUx0.js +1 -0
- package/assets/{browser-ponyfill-BdQcytd0.js → browser-ponyfill-BoSoM_yw.js} +2 -2
- package/assets/{bug-DI9j6s_O.js → bug-Byoam9SI.js} +1 -1
- package/assets/{calendar-0_V8JbUq.js → calendar-BNN6Blwg.js} +1 -1
- package/assets/{calendar-clash-strip-AV6ir0kb.js → calendar-clash-strip-CuPoAcuA.js} +1 -1
- package/assets/calendar-format-t5pknBPH.js +1 -0
- package/assets/calendar-report-De_YSbMS.js +1 -0
- package/assets/calendar-suggestion-BrsagLDp.js +1 -0
- package/assets/{calendars-Dav4B8o3.js → calendars-EiEYrDmO.js} +1 -1
- package/assets/{card-hG_Il7pd.js → card-BU0ZWUHk.js} +1 -1
- package/assets/{checkbox-B_JY_6mN.js → checkbox-nuTXvB_z.js} +1 -1
- package/assets/chevron-left-BmceVyuQ.js +1 -0
- package/assets/{circle-check-Cmp8Rqlz.js → circle-check-BzcaYx-L.js} +1 -1
- package/assets/{circle-check-big-B9Ca4u10.js → circle-check-big-CdWGb9Cq.js} +1 -1
- package/assets/{circle-help-Cmc2Km1C.js → circle-help-CVsjKp3b.js} +1 -1
- package/assets/{clock-DC78l7yK.js → clock-qn7JbMhU.js} +1 -1
- package/assets/compose._-_outboxMessageId_-CTOa6VlX.js +1 -0
- package/assets/compose._-_outboxMessageId_-DX18bVb7.js +1 -0
- package/assets/compose._-_outboxMessageId_-Drm1AU0Y.js +1 -0
- package/assets/compose._-_outboxMessageId_-SBimViM1.js +1 -0
- package/assets/{config-import-hoC0Y2SG.js → config-import-DhjQZV7D.js} +1 -1
- package/assets/{confirm-dialog-CCDHX_6Q.js → confirm-dialog-C4B2Czhl.js} +1 -1
- package/assets/{copy-B0aWQGDa.js → copy-CJCBL3_e.js} +1 -1
- package/assets/{credential-steps-uXZK9Zmr.js → credential-steps-BMJ8NHk-.js} +1 -1
- package/assets/{download-D3fQ48lB.js → download-DG45yTbq.js} +1 -1
- package/assets/{file-json-CCQAXfEc.js → file-json-Dgau07u1.js} +1 -1
- package/assets/{filters-DjsJshjt.js → filters-BAGXXGHm.js} +1 -1
- package/assets/flagged-BG7vNsSo.js +1 -0
- package/assets/{flagged-DU9q4oil.js → flagged-H7_oalgM.js} +1 -1
- package/assets/{folders-EdBrFHzG.js → folders-BpqgnDKx.js} +1 -1
- package/assets/{help-copy-BFATWnBQ.js → help-copy-Cv-E-JTH.js} +1 -1
- package/assets/{import-wN7xkLN8.js → import-Br9u2yf5.js} +1 -1
- package/assets/index-BAIv4ARz.js +1 -0
- package/assets/index-BD8lc3NR.js +1 -0
- package/assets/index-BQu6o3gE.js +1 -0
- package/assets/index-BsPhXbkV.js +1 -0
- package/assets/{index-C5Dozv2m.css → index-BtYEmjxr.css} +1 -1
- package/assets/index-COeV6qmo.js +1 -0
- package/assets/index-CXwf_sz5.js +1 -0
- package/assets/index-D-2HKiNE.js +1 -0
- package/assets/{index-DKo99WG1.js → index-DDaQbjmr.js} +40 -40
- package/assets/{index-DY5mGxwG.js → index-DQOjICLF.js} +1 -1
- package/assets/index-DiKCBlFd.js +1 -0
- package/assets/index-DwXDHT3g.js +1 -0
- package/assets/{index-DE-NAKWZ.js → index-TtetXNmc.js} +4 -4
- package/assets/{kbd-xYIrsDlz.js → kbd-nBPX_mdB.js} +1 -1
- package/assets/{labels-CToNdujY.js → labels-DZRbAx-h.js} +1 -1
- package/assets/{mail-CFqLOB4w.js → mail-CWorRVye.js} +1 -1
- package/assets/{mail-DxfGucaQ.js → mail-xh-X6l34.js} +1 -1
- package/assets/map-pin-DXPKFmKy.js +1 -0
- package/assets/{menu-u9D-cJXQ.js → menu-DziguOgy.js} +1 -1
- package/assets/minus-RD6yC1uS.js +1 -0
- package/assets/{new-DarKu0Ji.js → new-BErOQscw.js} +1 -1
- package/assets/onboarding-DJEkQ9iZ.js +1 -0
- package/assets/{onboarding-completion-DK9cy93Q.js → onboarding-completion-Bvjs_wV7.js} +1 -1
- package/assets/outbox-CobBj7od.js +1 -0
- package/assets/{pane-header-DmEVnHem.js → pane-header-BKR2Qgp4.js} +1 -1
- package/assets/{pencil-hPJlTnvS.js → pencil-C_GgIxQ0.js} +1 -1
- package/assets/{popover-menu-BDeljNyh.js → popover-menu-eOwDgIAD.js} +1 -1
- package/assets/{refresh-cw-DNbEUXcm.js → refresh-cw-mlDi8LTp.js} +1 -1
- package/assets/{rich-text-CQJUj3SY.js → rich-text-BwY3htQf.js} +14 -14
- package/assets/{rich-text-spellcheck-worker-provider-YjewF802.js → rich-text-spellcheck-worker-provider-CxrExxo5.js} +1 -1
- package/assets/{rotate-ccw-DFe52ITT.js → rotate-ccw-B_znez6Z.js} +1 -1
- package/assets/{roving-focus-DWecg5C9.js → roving-focus-D45YIEXp.js} +1 -1
- package/assets/{row-actions-Cp8U_ugi.js → row-actions-Bz2BO_Of.js} +1 -1
- package/assets/{search-mirror-CjZ7cATA.js → search-mirror-IklPpsgd.js} +1 -1
- package/assets/{search-token-index-DL0AoAlj.js → search-token-index-DfEguIzE.js} +1 -1
- package/assets/{sections-DDBMQxXz.js → sections-BE-YkTuC.js} +1 -1
- package/assets/{senders-Di3Hbnh-.js → senders-Byg0IyG1.js} +1 -1
- package/assets/settings-EmCICmfl.js +1 -0
- package/assets/{settings-screen-v6xny9wU.js → settings-screen-Qy0Wa0pr.js} +1 -1
- package/assets/{shield-check-BgoZBruM.js → shield-check-CCP0KBaU.js} +1 -1
- package/assets/{suggested-vips-C6Pc81iu.js → suggested-vips-Cy_wCFhG.js} +1 -1
- package/assets/suggestion._suggestionId-BaL7q4AC.js +1 -0
- package/assets/{undo-2-nUyUEATC.js → undo-2-DBjV60-m.js} +1 -1
- package/assets/useCalendarData-TdBIWROH.js +1 -0
- package/assets/useCalendarFreeBusy-BCLJxOfD.js +1 -0
- package/assets/{useCalendarWrites-qcdW_JmG.js → useCalendarWrites-CcZJoofA.js} +1 -1
- package/assets/{useCalendars-sfh2BICi.js → useCalendars-NXobBPn1.js} +1 -1
- package/assets/{useDebouncedValue-Bq8RVLfv.js → useDebouncedValue-Dy_g2v71.js} +1 -1
- package/assets/{useFilters-zXsB3pIM.js → useFilters-Dsrj-I6z.js} +1 -1
- package/assets/{useLabels-xQerI8AK.js → useLabels--WOniDuk.js} +1 -1
- package/assets/{useLayoutTier-C1kzvb61.js → useLayoutTier-BnLysTvl.js} +1 -1
- package/assets/{useMessageBodyContent-BRyDdu_J.js → useMessageBodyContent-Azq1Bngf.js} +1 -1
- package/assets/{useQueries-CY9FUcC8.js → useQueries-D1STUKB_.js} +1 -1
- package/assets/{useRefreshControl-DKJ_Eyfn.js → useRefreshControl-CQDCO_Sz.js} +1 -1
- package/assets/{useResultFolderIndex-BFXa90Ay.js → useResultFolderIndex-TIwJLY0y.js} +1 -1
- package/assets/{useSearchTokenContext-C0_GGpQj.js → useSearchTokenContext-DjY64Paa.js} +1 -1
- package/assets/{useSemanticSearch-lVNhyaIe.js → useSemanticSearch-NH8DKMle.js} +1 -1
- package/assets/{useSignature-CR4J3Q1V.js → useSignature-DbI73u9N.js} +1 -1
- package/index.html +2 -2
- package/package.json +1 -1
- package/assets/CalendarComposePane-FU6MwnAy.js +0 -1
- package/assets/MailListHeader-BZRxmnIb.js +0 -7
- package/assets/OpenCalendarEvent-B1DYETG7.js +0 -2
- package/assets/_calendarObjectId-DpUi-YzJ.js +0 -1
- package/assets/_mailboxId-DW6pvCIw.js +0 -1
- package/assets/_messageId-BAQFECvK.js +0 -1
- package/assets/_messageId-BVnDwNl2.js +0 -1
- package/assets/_messageId-Bvuxe_8r.js +0 -1
- package/assets/_outboxMessageId-BjD8wilW.js +0 -1
- package/assets/_recurrenceId-DBx4vqgw.js +0 -1
- package/assets/_threadId-B5nqfV-L.js +0 -1
- package/assets/_threadId-CazI55hb.js +0 -1
- package/assets/_threadId-DUn5RY_Y.js +0 -1
- package/assets/_view._date-Bpb6TKNU.js +0 -1
- package/assets/brief-CH-e1O9N.js +0 -1
- package/assets/calendar-format-CyOmp12n.js +0 -1
- package/assets/calendar-report-rx459ZNk.js +0 -1
- package/assets/calendar-suggestion-OndzGSan.js +0 -1
- package/assets/chevron-left-D3r7M2xH.js +0 -1
- package/assets/compose._-_outboxMessageId_-Bt9J2-qp.js +0 -1
- package/assets/compose._-_outboxMessageId_-C1FaW9o1.js +0 -1
- package/assets/compose._-_outboxMessageId_-D5zB1ABW.js +0 -1
- package/assets/compose._-_outboxMessageId_-R5L6KgB1.js +0 -1
- package/assets/flagged-Q3VMHIjI.js +0 -1
- package/assets/index-B3qUW5A0.js +0 -1
- package/assets/index-BAQFECvK.js +0 -1
- package/assets/index-BUYR1pAl.js +0 -1
- package/assets/index-Bvuxe_8r.js +0 -1
- package/assets/index-CxIBpGfW.js +0 -1
- package/assets/index-D9CK5EEZ.js +0 -1
- package/assets/index-DFpWp13S.js +0 -1
- package/assets/index-EsGaYQlh.js +0 -1
- package/assets/index-p4X-Ys_z.js +0 -1
- package/assets/minus-Bnr4gKCE.js +0 -1
- package/assets/onboarding-DRQo7PkQ.js +0 -1
- package/assets/outbox-BJK9d-c1.js +0 -1
- package/assets/settings-CFMotOQ7.js +0 -1
- package/assets/useCalendarData-4YBnFK2x.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,Y as a}from"./index-
|
|
1
|
+
import{j as e,Y as a}from"./index-DDaQbjmr.js";import{E as s}from"./EmptyState-DffMrivH.js";function r(){return e.jsx("div",{className:"flex h-full items-center justify-center bg-surface",children:e.jsx(s,{message:"Pick an event to read it here.",icon:e.jsx(a,{className:"size-8"})})})}export{r as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-DDaQbjmr.js";import{M as r}from"./MailboxPane-Bo_304LU.js";import"./useSearchTokenContext-DjY64Paa.js";import"./kbd-nBPX_mdB.js";import"./useMessageBodyContent-Azq1Bngf.js";import"./search-scope-B5-OK3Cq.js";import"./useRefreshControl-CQDCO_Sz.js";import"./circle-check-big-CdWGb9Cq.js";import"./refresh-cw-mlDi8LTp.js";import"./useQueries-D1STUKB_.js";import"./MailListHeader-DMMl8ZLg.js";import"./roving-focus-D45YIEXp.js";import"./search-token-index-DfEguIzE.js";import"./popover-menu-eOwDgIAD.js";import"./mail-xh-X6l34.js";import"./avatar-BU2Acypp.js";import"./index-TtetXNmc.js";import"./useSignature-DbI73u9N.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dy_g2v71.js";import"./sections-BE-YkTuC.js";import"./EmptyState-DffMrivH.js";import"./ErrorState-zb46wwqB.js";import"./undo-2-DBjV60-m.js";import"./download-DG45yTbq.js";import"./useCalendarFreeBusy-BCLJxOfD.js";import"./calendar-format-t5pknBPH.js";import"./useCalendars-NXobBPn1.js";import"./map-pin-DXPKFmKy.js";import"./calendar-suggestion-BrsagLDp.js";import"./attendee-row-CNSd4msf.js";import"./minus-RD6yC1uS.js";import"./clock-qn7JbMhU.js";import"./calendar-clash-strip-CuPoAcuA.js";import"./bell-off-BDdZq1id.js";import"./shield-check-CCP0KBaU.js";import"./calendar-report-De_YSbMS.js";import"./useFilters-Dsrj-I6z.js";import"./checkbox-nuTXvB_z.js";import"./confirm-dialog-C4B2Czhl.js";import"./useLayoutTier-BnLysTvl.js";import"./menu-DziguOgy.js";import"./MailViewChrome-BcPAwjzq.js";import"./pane-header-BKR2Qgp4.js";import"./NavMenuButton-C7p7FLnh.js";import"./useLabels--WOniDuk.js";import"./useSemanticSearch-NH8DKMle.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-OT_uLnD0.js";import"./circle-help-CVsjKp3b.js";import"./circle-check-BzcaYx-L.js";function $(){return o.jsx(r.Reading,{})}export{$ as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{eW as o,j as r}from"./index-DDaQbjmr.js";import{O as m}from"./OpenCalendarEvent-CVHpXp5y.js";import"./CalendarComposePane-CaFfehJ3.js";import"./calendar-format-t5pknBPH.js";import"./useQueries-D1STUKB_.js";import"./useCalendars-NXobBPn1.js";import"./calendar-clash-strip-CuPoAcuA.js";import"./attendee-row-CNSd4msf.js";import"./avatar-BU2Acypp.js";import"./minus-RD6yC1uS.js";import"./clock-qn7JbMhU.js";import"./map-pin-DXPKFmKy.js";import"./mail-xh-X6l34.js";import"./pencil-C_GgIxQ0.js";import"./useCalendarWrites-CcZJoofA.js";import"./ErrorState-zb46wwqB.js";import"./useCalendarData-TdBIWROH.js";import"./calendar-report-De_YSbMS.js";import"./calendar-subscription-B-aAc2Gy.js";function I(){const{calendarObjectId:t}=o.useParams();return r.jsx(m,{calendarObjectId:t})}export{I as component};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rich-text-spellcheck-worker-provider-
|
|
2
|
-
import{e as jo,j as d,X as vr,t as ln,f as un,L as gr,a1 as Fo,a3 as $o,r as s,cq as Bo,cr as Ho,a0 as Uo,_ as yr,B as wr,ar as Wo,cs as zo,$ as Vo,ct as qo,cu as wn,bY as br,cv as xe,cw as Er,cx as Ko,ch as Yo,cy as Se,i as _e,aJ as Me,cz as Go,cA as Xo,cB as xr,cC as Qo,aH as Sr,aI as Rr,ab as Zo,h as Cr,cD as Jo,ad as ea,c as At,bR as ta,cE as Tr,cF as na,cG as ra,bT as oa,d as Ar,cH as aa,at as sa,cI as _n,bk as Mn,cJ as ia,cK as ca,av as la,cL as ua,au as da,bq as fa,cM as ma,as as R}from"./index-DKo99WG1.js";import{c as ha,b as pa}from"./useMessageBodyContent-BRyDdu_J.js";import{u as va}from"./useSignature-CR4J3Q1V.js";import{b as ga}from"./account-form-helpers-DhckT_PN.js";import{u as ya}from"./useDebouncedValue-Bq8RVLfv.js";import{a as wa}from"./sections-DDBMQxXz.js";const Dr=jo("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]),ba=({email:e,displayName:t,onRemove:n,className:r})=>d.jsxs("span",{className:ln("inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-accent-2-soft text-sm max-w-[200px]",r),children:[d.jsx("span",{className:"truncate",children:t||e}),d.jsx("button",{type:"button",onClick:n,className:"shrink-0 p-0.5 rounded-full hover:bg-fg-muted/20 transition-colors","aria-label":`Remove ${e}`,children:d.jsx(vr,{className:"size-3"})})]}),Ea=/[\u0000-\u001f\u007f-\u009f\u061c\u200b-\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069\ufeff]/g,xa=/[<>:"|?*]/g,Sa=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\.|$)/i,jn=120,Ra=12,Ca="attachment",Fn=e=>{const t=[...e];if(t.length<=jn)return e;const n=e.lastIndexOf("."),r=n>0&&[...e.slice(n)].length<=Ra?e.slice(n):"",o=jn-[...r].length;return t.slice(0,o).join("")+r},yl=(e,t=Ca)=>{const r=e.replace(Ea,"").split(/[/\\]/),a=(r[r.length-1]??"").replace(xa,"_").replace(/^[.\s]+/,"").replace(/[.\s]+$/,"");if(a.length===0)return Fn(t);const i=Sa.test(a)?`_${a}`:a;return Fn(i)},$n=["KB","MB","GB","TB"],Ta=e=>{if(!Number.isFinite(e)||e<0)return"unknown size";const t=Math.round(e);if(t<1024)return t===1?"1 byte":`${t} bytes`;const n=1023.95;let r=t/1024,o=0;for(;r>=n&&o<$n.length-1;)r/=1024,o+=1;return`${r.toFixed(1).replace(/\.0$/,"")} ${$n[o]}`},Aa=({disabled:e,onAttach:t})=>{const n=s.useRef(null);return d.jsxs(d.Fragment,{children:[d.jsx(un,{variant:"ghost",size:"md","aria-label":"Attach files",title:"Attach files","aria-busy":e,className:"min-h-11 min-w-11 px-2","data-testid":"compose-attach",icon:d.jsx(Dr,{className:"size-4"}),onClick:()=>{e||n.current?.click()}}),d.jsx("input",{ref:n,type:"file",multiple:!0,hidden:!0,"data-testid":"compose-attach-input",onChange:r=>{const o=Array.from(r.currentTarget.files??[]);r.currentTarget.value="",o.length>0&&t(o)}})]})},Da=({save:e})=>e.status==="saving"?d.jsx("output",{className:"animate-pulse text-xs text-fg-muted",children:"Saving..."}):e.status==="saved"?d.jsx("output",{className:"text-xs text-fg-muted",children:"Draft saved"}):e.status==="error"?d.jsx("output",{className:"text-xs text-danger",children:"Save failed"}):e.status==="unsaved"?d.jsx("output",{className:"truncate text-xs text-warning",children:e.reason}):null;function Na({send:e,onSend:t,onBlocked:n,onDiscard:r,save:o={status:"idle"},onAttach:a}){const i=e.status==="sending",c=e.status==="blocked"?e.reason:void 0;return d.jsxs("div",{className:"flex items-center justify-between border-t border-line px-3 py-2",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[d.jsx(un,{variant:"primary",size:"md","aria-busy":i,title:c,className:"min-h-11 shrink-0 rounded-full px-4","data-testid":"compose-send",icon:i?d.jsx(gr,{className:"size-4 animate-spin"}):d.jsx(Fo,{className:"size-4"}),onClick:()=>{if(!i){if(c!==void 0){n(c);return}t()}},children:"Send"}),a&&d.jsx(Aa,{disabled:i,onAttach:a}),d.jsx(Da,{save:o})]}),d.jsx(un,{variant:"ghost",size:"md","aria-busy":i,"aria-label":"Discard",className:"min-h-11 min-w-11 px-2 hover:text-danger",icon:d.jsx($o,{className:"size-4"}),onClick:()=>{i||r()}})]})}const Bn=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),Oa=e=>{const t=e.trim();if(!t)return;const n=t.match(/^(.+?)\s*<([^>]+)>$/);if(n){const r=n[1].trim().replace(/^"(.*)"$/,"$1"),o=n[2].trim();if(Bn(o))return{email:o,displayName:r}}if(Bn(t))return{email:t}},ka=e=>{const t=[];let n="",r=!1,o=!1;for(const a of e){if(a==='"'&&(r=!r),a==="<"&&(o=!0),a===">"&&(o=!1),(a===","||a===";")&&!r&&!o){t.push(n),n="";continue}n+=a}return t.push(n),t},Ia=e=>{const t=[],n=[];for(const r of ka(e)){const o=Oa(r);if(o){t.push(o);continue}r.trim()&&n.push(r.trim())}return{entries:t,unparsed:n.join(", ")}},La=["Tab",","],Pa=150,_a=({label:e,addresses:t,onChange:n,placeholder:r,suggestions:o=[],onQueryChange:a,onPendingChange:i,ref:c})=>{const[u,m]=s.useState(""),f=s.useRef(null),l=s.useMemo(()=>Ia(u),[u]);s.useEffect(()=>{i?.(l)},[l,i]);const h=s.useRef(void 0),g=s.useCallback(()=>{h.current!==void 0&&(clearTimeout(h.current),h.current=void 0)},[]);s.useEffect(()=>g,[g]);const x=new Set(t.map(b=>b.email.toLowerCase())),p=u.length>=2?o.filter(b=>!x.has(b.email.toLowerCase())):[],E=s.useCallback(b=>{m(b),a?.(b)},[a]),w=s.useCallback(b=>{g(),!x.has(b.email.toLowerCase())&&(n([...t,b]),E(""))},[t,x,n,E,g]),A=s.useCallback(b=>{n(t.filter((P,C)=>C!==b))},[t,n]),y=s.useCallback(b=>{w(b),f.current?.focus()},[w]),v=s.useCallback(()=>{if(g(),l.entries.length===0)return{addresses:t,unparsed:l.unparsed};const b=new Set(x),P=[...t];for(const C of l.entries){const q=C.email.toLowerCase();b.has(q)||(b.add(q),P.push(C))}return n(P),E(l.unparsed),{addresses:P,unparsed:l.unparsed}},[l,t,x,n,E,g]),D=s.useCallback(()=>{g(),E("")},[E,g]);s.useImperativeHandle(c,()=>({commitPending:v,clearPending:D}),[v,D]);const _=s.useRef(v);s.useEffect(()=>{_.current=v},[v]);const S=Bo({count:p.length,acceptKeys:La,onAccept:b=>y(p[b])}),k=s.useMemo(()=>p.map(b=>({value:b.email,label:b.displayName??b.email,...b.displayName?{hint:b.email}:{}})),[p]),N=s.useCallback(b=>{if(b.key==="Backspace"&&u===""&&t.length>0){A(t.length-1);return}S.handleKeyDown(b)||(b.key==="Enter"||b.key==="Tab"||b.key===",")&&u.trim()&&(b.preventDefault(),v())},[u,t.length,A,S.handleKeyDown,v]),F=s.useCallback(()=>{g(),h.current=setTimeout(()=>{h.current=void 0,_.current(),S.dismiss()},Pa)},[g,S.dismiss]);return d.jsxs("div",{className:"relative","data-address-field":e,children:[d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsxs("label",{htmlFor:`address-field-${e}`,className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:[e,":"]}),d.jsxs("div",{className:"flex-1 flex flex-wrap items-center gap-1 min-h-[36px] px-2 py-1 border rounded-md bg-canvas cursor-text",onClick:()=>f.current?.focus(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&f.current?.focus()},children:[t.map((b,P)=>d.jsx(ba,{email:b.email,displayName:b.displayName,onRemove:()=>A(P)},b.email)),d.jsx("input",{ref:f,id:`address-field-${e}`,type:"text",value:u,onChange:b=>{S.reopen(),E(b.target.value)},onKeyDown:N,onBlur:F,placeholder:t.length===0?r:"",className:"flex-1 min-w-[120px] bg-transparent outline-none text-sm py-0.5",autoComplete:"off",...S.comboboxProps})]})]}),S.open&&d.jsx(Ho,{id:S.listId,suggestions:k,activeIndex:S.activeIndex,optionId:S.optionId,onPick:b=>{const P=p.find(C=>C.email===b.value);P&&y(P)},onHighlight:S.setActiveIndex,label:`${e} suggestions`,className:"absolute left-12 right-0 z-50 mt-1 max-h-[200px] shadow-lg"})]})},Ma=({state:e})=>e.status==="uploading"?d.jsx(gr,{className:"size-4 shrink-0 animate-spin text-fg-subtle","aria-hidden":!0}):e.status==="failed"?d.jsx(Uo,{className:"size-4 shrink-0 text-danger","aria-hidden":!0}):d.jsx(Dr,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0});function ja({items:e,onRemove:t,onRetry:n,className:r}){return e.length===0?null:d.jsx("ul",{"aria-label":"Attached files","data-testid":"compose-attachments",className:ln("flex flex-col gap-1 px-3 py-2",r),children:e.map(o=>d.jsxs("li",{"data-testid":"compose-attachment","data-state":o.state.status,className:ln("rounded-sm border bg-surface",o.state.status==="failed"?"border-danger/40":"border-line"),children:[d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx(Ma,{state:o.state}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("bdi",{className:"block truncate text-sm text-fg",title:o.filename,children:o.filename}),d.jsxs("span",{className:"block text-2xs text-fg-subtle",children:[Ta(o.sizeBytes),o.state.status==="uploading"?" · Uploading…":""]})]}),o.state.status==="failed"&&o.state.retryable&&d.jsx("button",{type:"button",onClick:()=>n(o.key),className:"text-xs font-medium text-accent hover:underline",children:"Try again"}),d.jsx("button",{type:"button","aria-label":`Remove ${o.filename}`,onClick:()=>t(o.key),className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-sunken hover:text-fg",children:d.jsx(vr,{className:"size-4","aria-hidden":!0})})]}),o.state.status==="failed"&&d.jsx("p",{role:"alert","data-testid":"compose-attachment-error",className:"border-t border-danger/30 bg-danger-soft px-2 py-1.5 text-xs text-danger",children:o.state.reason})]},o.key))})}const Fa=()=>d.jsxs("div",{"aria-hidden":"true","data-testid":"compose-body-skeleton",className:"min-h-[120px] px-3 py-2",children:[d.jsx("div",{className:"mb-2 h-8 animate-pulse rounded bg-surface-sunken"}),d.jsx("div",{className:"min-h-[80px] animate-pulse rounded bg-surface-sunken/50"})]}),$a=e=>Array.from(e.dataTransfer?.types??[]).includes("Files");function Ba({banner:e,header:t,children:n,quoted:r,attachments:o,actionBar:a,layout:i="fill",onDropFiles:c}){const u=i==="fill",[m,f]=s.useState(!1),l=c?{onDragOver:h=>{$a(h)&&(h.preventDefault(),f(!0))},onDragLeave:h=>{h.relatedTarget instanceof Node&&h.currentTarget.contains(h.relatedTarget)||f(!1)},onDrop:h=>{f(!1);const g=Array.from(h.dataTransfer?.files??[]);g.length!==0&&(h.preventDefault(),c(g))}}:{};return d.jsxs("div",{className:[u?"flex h-full min-h-0 flex-col":"flex flex-col",m&&"outline-2 -outline-offset-2 outline-dashed outline-accent"].filter(Boolean).join(" "),"data-testid":"compose-drop-target","data-dropping":m||void 0,...l,children:[e,t,d.jsxs("div",{className:u?"flex min-h-0 flex-1 flex-col overflow-auto":"flex flex-col","data-testid":"compose-body-area",children:[n,r&&d.jsx("div",{className:"shrink-0 px-3 pb-2",children:r})]}),o&&d.jsx("div",{className:"shrink-0",children:o}),u?a:d.jsx("div",{className:"sticky bottom-0 z-10 bg-canvas",children:a})]})}const Kt=({label:e,onClick:t})=>d.jsx("button",{type:"button",onClick:t,className:"text-xs text-fg-muted hover:text-fg transition-colors",children:e}),Ha=({to:e,cc:t,bcc:n,subject:r})=>{const o=[];return e.length>0&&o.push(`To: ${e.map(a=>a.displayName??a.email).join(", ")}`),t.length>0&&o.push(`Cc: ${t.length}`),n.length>0&&o.push(`Bcc: ${n.length}`),r&&o.push(r),o.join(" · ")},Ua=({collapsed:e=!1,summary:t="",onExpand:n,from:r,to:o,cc:a,bcc:i,subject:c,onShowCc:u,onShowBcc:m})=>e?d.jsxs("button",{type:"button",onClick:n,"aria-label":"Show recipients and subject",className:"flex min-h-11 w-full items-center gap-2 overflow-hidden border-b border-line px-3 py-1.5 text-left transition-colors hover:bg-surface-sunken","data-testid":"compose-header-collapsed",children:[d.jsx("span",{className:"truncate text-xs text-fg-muted",children:t||"…"}),d.jsx(yr,{className:"ml-auto size-4 shrink-0 text-fg-muted","aria-hidden":"true"})]}):d.jsxs("div",{className:"space-y-1 px-3 py-2 border-b border-line",children:[r,o,a??d.jsxs("div",{className:"flex gap-2 pl-14",children:[d.jsx(Kt,{label:"Cc",onClick:u}),d.jsx(Kt,{label:"Bcc",onClick:m})]}),a&&!i&&d.jsx("div",{className:"pl-14",children:d.jsx(Kt,{label:"Bcc",onClick:m})}),i,c]}),Nr="This message is attachments only, and attachments aren't forwarded — a forward would arrive with nothing of the original in it.",Wa="This message is attachments only, so there's nothing to quote and your reply goes out without the original.",za=e=>e==="forward"?Nr:Wa,Va=({mode:e})=>d.jsx(wr,{tone:"warning","data-testid":"compose-quote-missing",children:d.jsx("span",{children:za(e)})}),dn="This account can't send mail until SMTP is configured.",qa=({onConfigure:e,configureRef:t})=>d.jsxs("div",{role:"alert","data-testid":"compose-smtp-missing-banner",className:"flex items-start gap-3 border-b border-warning/50 bg-warning/10 px-3 py-2",children:[d.jsx(Wo,{className:"size-5 shrink-0 mt-0.5 text-warning","aria-hidden":"true"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium text-warning",children:dn}),d.jsxs("button",{ref:t,type:"button",onClick:e,"data-testid":"compose-smtp-configure",className:"mt-1 inline-flex items-center gap-1 text-xs font-medium text-warning hover:underline",children:["Configure SMTP",d.jsx(zo,{className:"size-3","aria-hidden":"true"})]})]})]}),Ka=({value:e,onChange:t})=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"Subj:"}),d.jsx("input",{type:"text",value:e,onChange:n=>t(n.target.value),className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",placeholder:"Subject","data-subject-field":!0})]}),Ya=({text:e,html:t,senderName:n,date:r})=>{const[o,a]=s.useState(!1);if(!e&&!t)return null;const i=[n,r].filter(Boolean).join(" on ");return d.jsxs("div",{className:"mt-2 px-3 pb-2",children:[d.jsxs("button",{type:"button",onClick:()=>a(!o),"aria-expanded":o,className:"flex items-center gap-1 text-xs text-fg-muted hover:text-fg transition-colors",children:[o?d.jsx(yr,{className:"size-3"}):d.jsx(Vo,{className:"size-3"}),i?`${i} wrote:`:"Show quoted text"]}),o&&d.jsx("blockquote",{className:"mt-2 pl-3 border-l-2 border-fg-subtle/30 text-sm text-fg-muted [&_a]:text-accent [&_a]:underline [&_blockquote]:pl-3 [&_blockquote]:border-l-2 [&_blockquote]:border-fg-subtle/30",children:t?d.jsx("div",{dangerouslySetInnerHTML:{__html:t}}):e.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rich-text-spellcheck-worker-provider-CxrExxo5.js","assets/index-DDaQbjmr.js","assets/index-BtYEmjxr.css","assets/rich-text-spellcheck-provider-J8m9wz6A.js","assets/rich-text-BwY3htQf.js","assets/roving-focus-D45YIEXp.js","assets/confirm-dialog-C4B2Czhl.js","assets/bottom-sheet-OT_uLnD0.js","assets/popover-menu-eOwDgIAD.js","assets/undo-2-DBjV60-m.js","assets/useMessageBodyContent-Azq1Bngf.js","assets/useSignature-DbI73u9N.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-Dy_g2v71.js","assets/sections-BE-YkTuC.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{e as jo,j as d,X as vr,t as ln,f as un,L as gr,a1 as Fo,a3 as $o,r as s,cq as Bo,cr as Ho,a0 as Uo,_ as yr,B as wr,ar as Wo,cs as zo,$ as Vo,ct as qo,cu as wn,bY as br,cv as xe,cw as Er,cx as Ko,ch as Yo,cy as Se,i as _e,aJ as Me,cz as Go,cA as Xo,cB as xr,cC as Qo,aH as Sr,aI as Rr,ab as Zo,h as Cr,cD as Jo,ad as ea,c as At,bR as ta,cE as Tr,cF as na,cG as ra,bT as oa,d as Ar,cH as aa,at as sa,cI as _n,bk as Mn,cJ as ia,cK as ca,av as la,cL as ua,au as da,bq as fa,cM as ma,as as R}from"./index-DDaQbjmr.js";import{c as ha,b as pa}from"./useMessageBodyContent-Azq1Bngf.js";import{u as va}from"./useSignature-DbI73u9N.js";import{b as ga}from"./account-form-helpers-DhckT_PN.js";import{u as ya}from"./useDebouncedValue-Dy_g2v71.js";import{a as wa}from"./sections-BE-YkTuC.js";const Dr=jo("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]),ba=({email:e,displayName:t,onRemove:n,className:r})=>d.jsxs("span",{className:ln("inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-accent-2-soft text-sm max-w-[200px]",r),children:[d.jsx("span",{className:"truncate",children:t||e}),d.jsx("button",{type:"button",onClick:n,className:"shrink-0 p-0.5 rounded-full hover:bg-fg-muted/20 transition-colors","aria-label":`Remove ${e}`,children:d.jsx(vr,{className:"size-3"})})]}),Ea=/[\u0000-\u001f\u007f-\u009f\u061c\u200b-\u200f\u2028\u2029\u202a-\u202e\u2066-\u2069\ufeff]/g,xa=/[<>:"|?*]/g,Sa=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\.|$)/i,jn=120,Ra=12,Ca="attachment",Fn=e=>{const t=[...e];if(t.length<=jn)return e;const n=e.lastIndexOf("."),r=n>0&&[...e.slice(n)].length<=Ra?e.slice(n):"",o=jn-[...r].length;return t.slice(0,o).join("")+r},yl=(e,t=Ca)=>{const r=e.replace(Ea,"").split(/[/\\]/),a=(r[r.length-1]??"").replace(xa,"_").replace(/^[.\s]+/,"").replace(/[.\s]+$/,"");if(a.length===0)return Fn(t);const i=Sa.test(a)?`_${a}`:a;return Fn(i)},$n=["KB","MB","GB","TB"],Ta=e=>{if(!Number.isFinite(e)||e<0)return"unknown size";const t=Math.round(e);if(t<1024)return t===1?"1 byte":`${t} bytes`;const n=1023.95;let r=t/1024,o=0;for(;r>=n&&o<$n.length-1;)r/=1024,o+=1;return`${r.toFixed(1).replace(/\.0$/,"")} ${$n[o]}`},Aa=({disabled:e,onAttach:t})=>{const n=s.useRef(null);return d.jsxs(d.Fragment,{children:[d.jsx(un,{variant:"ghost",size:"md","aria-label":"Attach files",title:"Attach files","aria-busy":e,className:"min-h-11 min-w-11 px-2","data-testid":"compose-attach",icon:d.jsx(Dr,{className:"size-4"}),onClick:()=>{e||n.current?.click()}}),d.jsx("input",{ref:n,type:"file",multiple:!0,hidden:!0,"data-testid":"compose-attach-input",onChange:r=>{const o=Array.from(r.currentTarget.files??[]);r.currentTarget.value="",o.length>0&&t(o)}})]})},Da=({save:e})=>e.status==="saving"?d.jsx("output",{className:"animate-pulse text-xs text-fg-muted",children:"Saving..."}):e.status==="saved"?d.jsx("output",{className:"text-xs text-fg-muted",children:"Draft saved"}):e.status==="error"?d.jsx("output",{className:"text-xs text-danger",children:"Save failed"}):e.status==="unsaved"?d.jsx("output",{className:"truncate text-xs text-warning",children:e.reason}):null;function Na({send:e,onSend:t,onBlocked:n,onDiscard:r,save:o={status:"idle"},onAttach:a}){const i=e.status==="sending",c=e.status==="blocked"?e.reason:void 0;return d.jsxs("div",{className:"flex items-center justify-between border-t border-line px-3 py-2",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[d.jsx(un,{variant:"primary",size:"md","aria-busy":i,title:c,className:"min-h-11 shrink-0 rounded-full px-4","data-testid":"compose-send",icon:i?d.jsx(gr,{className:"size-4 animate-spin"}):d.jsx(Fo,{className:"size-4"}),onClick:()=>{if(!i){if(c!==void 0){n(c);return}t()}},children:"Send"}),a&&d.jsx(Aa,{disabled:i,onAttach:a}),d.jsx(Da,{save:o})]}),d.jsx(un,{variant:"ghost",size:"md","aria-busy":i,"aria-label":"Discard",className:"min-h-11 min-w-11 px-2 hover:text-danger",icon:d.jsx($o,{className:"size-4"}),onClick:()=>{i||r()}})]})}const Bn=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),Oa=e=>{const t=e.trim();if(!t)return;const n=t.match(/^(.+?)\s*<([^>]+)>$/);if(n){const r=n[1].trim().replace(/^"(.*)"$/,"$1"),o=n[2].trim();if(Bn(o))return{email:o,displayName:r}}if(Bn(t))return{email:t}},ka=e=>{const t=[];let n="",r=!1,o=!1;for(const a of e){if(a==='"'&&(r=!r),a==="<"&&(o=!0),a===">"&&(o=!1),(a===","||a===";")&&!r&&!o){t.push(n),n="";continue}n+=a}return t.push(n),t},Ia=e=>{const t=[],n=[];for(const r of ka(e)){const o=Oa(r);if(o){t.push(o);continue}r.trim()&&n.push(r.trim())}return{entries:t,unparsed:n.join(", ")}},La=["Tab",","],Pa=150,_a=({label:e,addresses:t,onChange:n,placeholder:r,suggestions:o=[],onQueryChange:a,onPendingChange:i,ref:c})=>{const[u,m]=s.useState(""),f=s.useRef(null),l=s.useMemo(()=>Ia(u),[u]);s.useEffect(()=>{i?.(l)},[l,i]);const h=s.useRef(void 0),g=s.useCallback(()=>{h.current!==void 0&&(clearTimeout(h.current),h.current=void 0)},[]);s.useEffect(()=>g,[g]);const x=new Set(t.map(b=>b.email.toLowerCase())),p=u.length>=2?o.filter(b=>!x.has(b.email.toLowerCase())):[],E=s.useCallback(b=>{m(b),a?.(b)},[a]),w=s.useCallback(b=>{g(),!x.has(b.email.toLowerCase())&&(n([...t,b]),E(""))},[t,x,n,E,g]),A=s.useCallback(b=>{n(t.filter((P,C)=>C!==b))},[t,n]),y=s.useCallback(b=>{w(b),f.current?.focus()},[w]),v=s.useCallback(()=>{if(g(),l.entries.length===0)return{addresses:t,unparsed:l.unparsed};const b=new Set(x),P=[...t];for(const C of l.entries){const q=C.email.toLowerCase();b.has(q)||(b.add(q),P.push(C))}return n(P),E(l.unparsed),{addresses:P,unparsed:l.unparsed}},[l,t,x,n,E,g]),D=s.useCallback(()=>{g(),E("")},[E,g]);s.useImperativeHandle(c,()=>({commitPending:v,clearPending:D}),[v,D]);const _=s.useRef(v);s.useEffect(()=>{_.current=v},[v]);const S=Bo({count:p.length,acceptKeys:La,onAccept:b=>y(p[b])}),k=s.useMemo(()=>p.map(b=>({value:b.email,label:b.displayName??b.email,...b.displayName?{hint:b.email}:{}})),[p]),N=s.useCallback(b=>{if(b.key==="Backspace"&&u===""&&t.length>0){A(t.length-1);return}S.handleKeyDown(b)||(b.key==="Enter"||b.key==="Tab"||b.key===",")&&u.trim()&&(b.preventDefault(),v())},[u,t.length,A,S.handleKeyDown,v]),F=s.useCallback(()=>{g(),h.current=setTimeout(()=>{h.current=void 0,_.current(),S.dismiss()},Pa)},[g,S.dismiss]);return d.jsxs("div",{className:"relative","data-address-field":e,children:[d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsxs("label",{htmlFor:`address-field-${e}`,className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:[e,":"]}),d.jsxs("div",{className:"flex-1 flex flex-wrap items-center gap-1 min-h-[36px] px-2 py-1 border rounded-md bg-canvas cursor-text",onClick:()=>f.current?.focus(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&f.current?.focus()},children:[t.map((b,P)=>d.jsx(ba,{email:b.email,displayName:b.displayName,onRemove:()=>A(P)},b.email)),d.jsx("input",{ref:f,id:`address-field-${e}`,type:"text",value:u,onChange:b=>{S.reopen(),E(b.target.value)},onKeyDown:N,onBlur:F,placeholder:t.length===0?r:"",className:"flex-1 min-w-[120px] bg-transparent outline-none text-sm py-0.5",autoComplete:"off",...S.comboboxProps})]})]}),S.open&&d.jsx(Ho,{id:S.listId,suggestions:k,activeIndex:S.activeIndex,optionId:S.optionId,onPick:b=>{const P=p.find(C=>C.email===b.value);P&&y(P)},onHighlight:S.setActiveIndex,label:`${e} suggestions`,className:"absolute left-12 right-0 z-50 mt-1 max-h-[200px] shadow-lg"})]})},Ma=({state:e})=>e.status==="uploading"?d.jsx(gr,{className:"size-4 shrink-0 animate-spin text-fg-subtle","aria-hidden":!0}):e.status==="failed"?d.jsx(Uo,{className:"size-4 shrink-0 text-danger","aria-hidden":!0}):d.jsx(Dr,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0});function ja({items:e,onRemove:t,onRetry:n,className:r}){return e.length===0?null:d.jsx("ul",{"aria-label":"Attached files","data-testid":"compose-attachments",className:ln("flex flex-col gap-1 px-3 py-2",r),children:e.map(o=>d.jsxs("li",{"data-testid":"compose-attachment","data-state":o.state.status,className:ln("rounded-sm border bg-surface",o.state.status==="failed"?"border-danger/40":"border-line"),children:[d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx(Ma,{state:o.state}),d.jsxs("span",{className:"min-w-0 flex-1",children:[d.jsx("bdi",{className:"block truncate text-sm text-fg",title:o.filename,children:o.filename}),d.jsxs("span",{className:"block text-2xs text-fg-subtle",children:[Ta(o.sizeBytes),o.state.status==="uploading"?" · Uploading…":""]})]}),o.state.status==="failed"&&o.state.retryable&&d.jsx("button",{type:"button",onClick:()=>n(o.key),className:"text-xs font-medium text-accent hover:underline",children:"Try again"}),d.jsx("button",{type:"button","aria-label":`Remove ${o.filename}`,onClick:()=>t(o.key),className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-sunken hover:text-fg",children:d.jsx(vr,{className:"size-4","aria-hidden":!0})})]}),o.state.status==="failed"&&d.jsx("p",{role:"alert","data-testid":"compose-attachment-error",className:"border-t border-danger/30 bg-danger-soft px-2 py-1.5 text-xs text-danger",children:o.state.reason})]},o.key))})}const Fa=()=>d.jsxs("div",{"aria-hidden":"true","data-testid":"compose-body-skeleton",className:"min-h-[120px] px-3 py-2",children:[d.jsx("div",{className:"mb-2 h-8 animate-pulse rounded bg-surface-sunken"}),d.jsx("div",{className:"min-h-[80px] animate-pulse rounded bg-surface-sunken/50"})]}),$a=e=>Array.from(e.dataTransfer?.types??[]).includes("Files");function Ba({banner:e,header:t,children:n,quoted:r,attachments:o,actionBar:a,layout:i="fill",onDropFiles:c}){const u=i==="fill",[m,f]=s.useState(!1),l=c?{onDragOver:h=>{$a(h)&&(h.preventDefault(),f(!0))},onDragLeave:h=>{h.relatedTarget instanceof Node&&h.currentTarget.contains(h.relatedTarget)||f(!1)},onDrop:h=>{f(!1);const g=Array.from(h.dataTransfer?.files??[]);g.length!==0&&(h.preventDefault(),c(g))}}:{};return d.jsxs("div",{className:[u?"flex h-full min-h-0 flex-col":"flex flex-col",m&&"outline-2 -outline-offset-2 outline-dashed outline-accent"].filter(Boolean).join(" "),"data-testid":"compose-drop-target","data-dropping":m||void 0,...l,children:[e,t,d.jsxs("div",{className:u?"flex min-h-0 flex-1 flex-col overflow-auto":"flex flex-col","data-testid":"compose-body-area",children:[n,r&&d.jsx("div",{className:"shrink-0 px-3 pb-2",children:r})]}),o&&d.jsx("div",{className:"shrink-0",children:o}),u?a:d.jsx("div",{className:"sticky bottom-0 z-10 bg-canvas",children:a})]})}const Kt=({label:e,onClick:t})=>d.jsx("button",{type:"button",onClick:t,className:"text-xs text-fg-muted hover:text-fg transition-colors",children:e}),Ha=({to:e,cc:t,bcc:n,subject:r})=>{const o=[];return e.length>0&&o.push(`To: ${e.map(a=>a.displayName??a.email).join(", ")}`),t.length>0&&o.push(`Cc: ${t.length}`),n.length>0&&o.push(`Bcc: ${n.length}`),r&&o.push(r),o.join(" · ")},Ua=({collapsed:e=!1,summary:t="",onExpand:n,from:r,to:o,cc:a,bcc:i,subject:c,onShowCc:u,onShowBcc:m})=>e?d.jsxs("button",{type:"button",onClick:n,"aria-label":"Show recipients and subject",className:"flex min-h-11 w-full items-center gap-2 overflow-hidden border-b border-line px-3 py-1.5 text-left transition-colors hover:bg-surface-sunken","data-testid":"compose-header-collapsed",children:[d.jsx("span",{className:"truncate text-xs text-fg-muted",children:t||"…"}),d.jsx(yr,{className:"ml-auto size-4 shrink-0 text-fg-muted","aria-hidden":"true"})]}):d.jsxs("div",{className:"space-y-1 px-3 py-2 border-b border-line",children:[r,o,a??d.jsxs("div",{className:"flex gap-2 pl-14",children:[d.jsx(Kt,{label:"Cc",onClick:u}),d.jsx(Kt,{label:"Bcc",onClick:m})]}),a&&!i&&d.jsx("div",{className:"pl-14",children:d.jsx(Kt,{label:"Bcc",onClick:m})}),i,c]}),Nr="This message is attachments only, and attachments aren't forwarded — a forward would arrive with nothing of the original in it.",Wa="This message is attachments only, so there's nothing to quote and your reply goes out without the original.",za=e=>e==="forward"?Nr:Wa,Va=({mode:e})=>d.jsx(wr,{tone:"warning","data-testid":"compose-quote-missing",children:d.jsx("span",{children:za(e)})}),dn="This account can't send mail until SMTP is configured.",qa=({onConfigure:e,configureRef:t})=>d.jsxs("div",{role:"alert","data-testid":"compose-smtp-missing-banner",className:"flex items-start gap-3 border-b border-warning/50 bg-warning/10 px-3 py-2",children:[d.jsx(Wo,{className:"size-5 shrink-0 mt-0.5 text-warning","aria-hidden":"true"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium text-warning",children:dn}),d.jsxs("button",{ref:t,type:"button",onClick:e,"data-testid":"compose-smtp-configure",className:"mt-1 inline-flex items-center gap-1 text-xs font-medium text-warning hover:underline",children:["Configure SMTP",d.jsx(zo,{className:"size-3","aria-hidden":"true"})]})]})]}),Ka=({value:e,onChange:t})=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"Subj:"}),d.jsx("input",{type:"text",value:e,onChange:n=>t(n.target.value),className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",placeholder:"Subject","data-subject-field":!0})]}),Ya=({text:e,html:t,senderName:n,date:r})=>{const[o,a]=s.useState(!1);if(!e&&!t)return null;const i=[n,r].filter(Boolean).join(" on ");return d.jsxs("div",{className:"mt-2 px-3 pb-2",children:[d.jsxs("button",{type:"button",onClick:()=>a(!o),"aria-expanded":o,className:"flex items-center gap-1 text-xs text-fg-muted hover:text-fg transition-colors",children:[o?d.jsx(yr,{className:"size-3"}):d.jsx(Vo,{className:"size-3"}),i?`${i} wrote:`:"Show quoted text"]}),o&&d.jsx("blockquote",{className:"mt-2 pl-3 border-l-2 border-fg-subtle/30 text-sm text-fg-muted [&_a]:text-accent [&_a]:underline [&_blockquote]:pl-3 [&_blockquote]:border-l-2 [&_blockquote]:border-fg-subtle/30",children:t?d.jsx("div",{dangerouslySetInnerHTML:{__html:t}}):e.split(`
|
|
3
3
|
`).map((c,u)=>d.jsx("p",{className:"min-h-[1.2em]",children:c},u))})]})},Ga=["p","br","div","h1","h2","h3","h4","h5","h6","strong","b","em","i","u","s","ul","ol","li","blockquote","pre","code","hr","table","thead","tbody","tr","th","td","a","img"],Xa=["href","src","alt","colspan","rowspan","lang","dir"],Qa=/^(?:https?:|mailto:)/i,Za=/^(?:https:|data:image\/)/i,Ja=/^cid:(.+)$/i,fn=()=>!1;let mn=fn;const es=e=>{const t=Ja.exec(e);return t?mn(t[1]):Za.test(e)},ts="max-width:100%;height:auto",ns=e=>{const t=qo();if(!t.isSupported)throw new Error("adopted HTML cannot be sanitized: no DOM is available");return t.addHook("afterSanitizeAttributes",n=>{if(n.tagName==="A"){Qa.test(n.getAttribute("href")??"")||n.removeAttribute("href"),e==="quoted"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer nofollow"));return}if(n.tagName==="IMG"){if(e==="quoted"){n.remove();return}if(!es(n.getAttribute("src")??"")){n.remove();return}n.setAttribute("style",ts)}}),t},Hn=new Map,rs=e=>{const t=Hn.get(e);if(t)return t;const n=ns(e);return Hn.set(e,n),n},Or=(e,t)=>rs(t).sanitize(e,{ALLOWED_TAGS:Ga,ALLOWED_ATTR:Xa,ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1}),wl=(e,t=fn)=>{mn=t;try{return Or(e,"outgoing")}finally{mn=fn}},os=e=>Or(e,"quoted"),as=e=>typeof e=="string"&&e.length>0?"rich":"plain",bl=(e,t)=>t.length>0,ss={plain:"Couldn't switch to plain text",rich:"Couldn't switch to rich text"},El=(e,t,n)=>t.trim()===""||n.trim()!==""?{outcome:"switch"}:{outcome:"blocked",title:ss[e],detail:"The conversion came back empty, so your message is unchanged."};function Re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)}}function Un(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function is(...e){return t=>{let n=!1;const r=e.map(o=>{const a=Un(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<r.length;o++){const a=r[o];typeof a=="function"?a():Un(e[o],null)}}}}function je(...e){return s.useCallback(is(...e),e)}function cs(e,t=[]){let n=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const u=n.length;n=[...n,i];const m=l=>{const{scope:h,children:g,...x}=l,p=h?.[e]?.[u]||c,E=s.useMemo(()=>x,Object.values(x));return d.jsx(p.Provider,{value:E,children:g})};m.displayName=a+"Provider";function f(l,h,g={}){const{optional:x=!1}=g,p=h?.[e]?.[u]||c,E=s.useContext(p);if(E)return E;if(i!==void 0)return i;if(!x)throw new Error(`\`${l}\` must be used within \`${a}\``)}return[m,f]}const o=()=>{const a=n.map(i=>s.createContext(i));return function(c){const u=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return o.scopeName=e,[r,ls(o,...t)]}function ls(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const i=r.reduce((c,{useScope:u,scopeName:m})=>{const l=u(a)[`__scope${m}`];return{...c,...l}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var nt=globalThis?.document?s.useLayoutEffect:()=>{},us=wn[" useInsertionEffect ".trim().toString()]||nt;function ds({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,i]=fs({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:o;{const f=s.useRef(e!==void 0);s.useEffect(()=>{const l=f.current;l!==c&&console.warn(`${r} is changing from ${l?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const m=s.useCallback(f=>{if(c){const l=ms(f)?f(e):f;l!==e&&i.current?.(l)}else a(f)},[c,e,a,i]);return[u,m]}function fs({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),o=s.useRef(n),a=s.useRef(t);return us(()=>{a.current=t},[t]),s.useEffect(()=>{o.current!==n&&(a.current?.(n),o.current=n)},[n,o]),[n,r,a]}function ms(e){return typeof e=="function"}function kr(e){const t=s.forwardRef((n,r)=>{let{children:o,...a}=n,i=null,c=!1;const u=[];Wn(o)&&typeof pt=="function"&&(o=pt(o._payload)),s.Children.forEach(o,h=>{if(ys(h)){c=!0;const g=h;let x="child"in g.props?g.props.child:g.props.children;Wn(x)&&typeof pt=="function"&&(x=pt(x._payload)),i=ps(g,x),u.push(i?.props?.children)}else u.push(h)}),i?i=s.cloneElement(i,void 0,u):!c&&s.Children.count(o)===1&&s.isValidElement(o)&&(i=o);const m=i?gs(i):void 0,f=je(r,m);if(!i){if(o||o===0)throw new Error(c?xs(e):Es(e));return o}const l=vs(a,i.props??{});return i.type!==s.Fragment&&(l.ref=r?f:m),s.cloneElement(i,l)});return t.displayName=`${e}.Slot`,t}var hs=Symbol.for("radix.slottable"),ps=(e,t)=>{if("child"in e.props){const n=e.props.child;return s.isValidElement(n)?s.cloneElement(n,void 0,e.props.children(n.props.children)):null}return s.isValidElement(t)?t:null};function vs(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...c)=>{const u=a(...c);return o(...c),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function gs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ys(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hs}var ws=Symbol.for("react.lazy");function Wn(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ws&&"_payload"in e&&bs(e._payload)}function bs(e){return typeof e=="object"&&e!==null&&"then"in e}var Es=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,xs=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,pt=wn[" use ".trim().toString()],Ss=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=Ss.reduce((e,t)=>{const n=kr(`Primitive.${t}`),r=s.forwardRef((o,a)=>{const{asChild:i,...c}=o,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Rs(e,t){e&&br.flushSync(()=>e.dispatchEvent(t))}function rt(e){const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>((...n)=>t.current?.(...n)),[])}var Cs="DismissableLayer",hn="dismissableLayer.update",Ts="dismissableLayer.pointerDownOutside",As="dismissableLayer.focusOutside",zn,bn=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ir=s.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:c,onDismiss:u,...m}=e,f=s.useContext(bn),[l,h]=s.useState(null),g=l?.ownerDocument??globalThis?.document,[,x]=s.useState({}),p=je(t,h),E=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),A=w?E.indexOf(w):-1,y=l?E.indexOf(l):-1,v=f.layersWithOutsidePointerEventsDisabled.size>0,D=y>=A,_=s.useRef(!1),S=Is(b=>{a?.(b),c?.(b),b.defaultPrevented||u?.()},{ownerDocument:g,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:_,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:s.useCallback(b=>{if(!(b instanceof Node))return!1;const P=[...f.branches].some(C=>C.contains(b));return D&&!P},[f.branches,D])}),k=Ls(b=>{if(r&&_.current)return;const P=b.target;[...f.branches].some(q=>q.contains(P))||(i?.(b),c?.(b),b.defaultPrevented||u?.())},g),N=l?y===E.length-1:!1,F=rt(b=>{b.key==="Escape"&&(o?.(b),!b.defaultPrevented&&u&&(b.preventDefault(),u()))});return s.useEffect(()=>{if(N)return g.addEventListener("keydown",F,{capture:!0}),()=>g.removeEventListener("keydown",F,{capture:!0})},[g,N,F]),s.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(zn=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),Vn(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(l),f.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=zn))}},[l,g,n,f]),s.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),Vn())},[l,f]),s.useEffect(()=>{const b=()=>x({});return document.addEventListener(hn,b),()=>document.removeEventListener(hn,b)},[]),d.jsx(ge.div,{...m,ref:p,style:{pointerEvents:v?D?"auto":"none":void 0,...e.style},onFocusCapture:Re(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Re(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Re(e.onPointerDownCapture,S.onPointerDownCapture)})});Ir.displayName=Cs;var Ds="DismissableLayerBranch",Ns=s.forwardRef((e,t)=>{const n=s.useContext(bn),r=s.useRef(null),o=je(t,r);return s.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),d.jsx(ge.div,{...e,ref:o})});Ns.displayName=Ds;function Os(){const e=s.useContext(bn),[t,n]=s.useState(null);return s.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var ks=()=>!0;function Is(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:a,shouldHandlePointerDownOutside:i=ks}=t,c=rt(e),u=s.useRef(!1),m=s.useRef(!1),f=s.useRef(new Map),l=s.useRef(()=>{});return s.useEffect(()=>{function h(){m.current=!1,o.current=!1,f.current.clear()}function g(){return Array.from(f.current.values()).some(Boolean)}function x(y){if(!m.current)return;const v=y.target;v instanceof Node&&[...a].some(_=>_.contains(v))||f.current.set(y.type,!0),y.type==="click"&&window.setTimeout(()=>{m.current&&l.current()},0)}function p(y){m.current&&f.current.set(y.type,!1)}const E=y=>{if(y.target&&!u.current){let v=function(){n.removeEventListener("click",l.current);const _=g();h(),_||Lr(Ts,c,D,{discrete:!0})};if(!i(y.target)){n.removeEventListener("click",l.current),h(),u.current=!1;return}const D={originalEvent:y};m.current=!0,o.current=r&&y.button===0,f.current.clear(),!r||y.button!==0?v():(n.removeEventListener("click",l.current),l.current=v,n.addEventListener("click",l.current,{once:!0}))}else n.removeEventListener("click",l.current),h();u.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const y of w)n.addEventListener(y,x,!0),n.addEventListener(y,p);const A=window.setTimeout(()=>{n.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(A),n.removeEventListener("pointerdown",E),n.removeEventListener("click",l.current);for(const y of w)n.removeEventListener(y,x,!0),n.removeEventListener(y,p)}},[n,c,r,o,a,i]),{onPointerDownCapture:()=>u.current=!0}}function Ls(e,t=globalThis?.document){const n=rt(e),r=s.useRef(!1);return s.useEffect(()=>{const o=a=>{a.target&&!r.current&&Lr(As,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Vn(){const e=new CustomEvent(hn);document.dispatchEvent(e)}function Lr(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Rs(o,a):o.dispatchEvent(a)}var vt=0,Be=null;function Ps(){s.useEffect(()=>{Be||(Be={start:qn(),end:qn()});const{start:e,end:t}=Be;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),vt++,()=>{vt===1&&(Be?.start.remove(),Be?.end.remove(),Be=null),vt=Math.max(0,vt-1)}},[])}function qn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Yt="focusScope.autoFocusOnMount",Gt="focusScope.autoFocusOnUnmount",Kn={bubbles:!1,cancelable:!0},_s="FocusScope",Pr=s.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[c,u]=s.useState(null),m=rt(o),f=rt(a),l=s.useRef(null),h=je(t,u),g=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(r){let p=function(y){if(g.paused||!c)return;const v=y.target;c.contains(v)?l.current=v:Ee(l.current,{select:!0})},E=function(y){if(g.paused||!c)return;const v=y.relatedTarget;v!==null&&(c.contains(v)||Ee(l.current,{select:!0}))},w=function(y){if(document.activeElement===document.body)for(const D of y)D.removedNodes.length>0&&Ee(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",E);const A=new MutationObserver(w);return c&&A.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",E),A.disconnect()}}},[r,c,g.paused]),s.useEffect(()=>{if(c){Gn.add(g);const p=document.activeElement;if(!c.contains(p)){const w=new CustomEvent(Yt,Kn);c.addEventListener(Yt,m),c.dispatchEvent(w),w.defaultPrevented||(Ms(Hs(_r(c)),{select:!0}),document.activeElement===p&&Ee(c))}return()=>{c.removeEventListener(Yt,m),setTimeout(()=>{const w=new CustomEvent(Gt,Kn);c.addEventListener(Gt,f),c.dispatchEvent(w),w.defaultPrevented||Ee(p??document.body,{select:!0}),c.removeEventListener(Gt,f),Gn.remove(g)},0)}}},[c,m,f,g]);const x=s.useCallback(p=>{if(!n&&!r||g.paused)return;const E=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,w=document.activeElement;if(E&&w){const A=p.currentTarget,[y,v]=js(A);y&&v?!p.shiftKey&&w===v?(p.preventDefault(),n&&Ee(y,{select:!0})):p.shiftKey&&w===y&&(p.preventDefault(),n&&Ee(v,{select:!0})):w===A&&p.preventDefault()}},[n,r,g.paused]);return d.jsx(ge.div,{tabIndex:-1,...i,ref:h,onKeyDown:x})});Pr.displayName=_s;function Ms(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ee(r,{select:t}),document.activeElement!==n)return}function js(e){const t=_r(e),n=Yn(t,e),r=Yn(t.reverse(),e);return[n,r]}function _r(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Yn(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Fs(r,{upTo:t})))return r}function Fs(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function $s(e){return e instanceof HTMLInputElement&&"select"in e}function Ee(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&$s(e)&&t&&e.select()}}var Gn=Bs();function Bs(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Xn(e,t),e.unshift(t)},remove(t){e=Xn(e,t),e[0]?.resume()}}}function Xn(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Hs(e){return e.filter(t=>t.tagName!=="A")}var Us=wn[" useId ".trim().toString()]||(()=>{}),Ws=0;function Xt(e){const[t,n]=s.useState(Us());return nt(()=>{n(r=>r??String(Ws++))},[e]),e||(t?`radix-${t}`:"")}var zs="Portal",Mr=s.forwardRef((e,t)=>{const{container:n,...r}=e,[o,a]=s.useState(!1);nt(()=>a(!0),[]);const i=n||o&&globalThis?.document?.body;return i?br.createPortal(d.jsx(ge.div,{...r,ref:t}),i):null});Mr.displayName=zs;function Vs(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}var Ot=e=>{const{present:t,children:n}=e,r=qs(t),o=typeof n=="function"?n({present:r.isPresent}):s.Children.only(n),a=Ks(r.ref,Ys(o));return typeof n=="function"||r.isPresent?s.cloneElement(o,{ref:a}):null};Ot.displayName="Presence";function qs(e){const[t,n]=s.useState(),r=s.useRef(null),o=s.useRef(e),a=s.useRef("none"),i=s.useRef(void 0),c=e?"mounted":"unmounted",[u,m]=Vs(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{u==="mounted"?(a.current=i.current??Je(r.current),i.current=void 0):a.current="none"},[u]),nt(()=>{const f=r.current,l=o.current;if(l!==e){const g=a.current,x=Je(f);e?(i.current=x,m("MOUNT")):x==="none"||f?.display==="none"?m("UNMOUNT"):m(l&&g!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,m]),nt(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,h=x=>{const E=Je(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&E&&(m("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},g=x=>{x.target===t&&(a.current=Je(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:s.useCallback(f=>{if(f){const l=getComputedStyle(f);r.current=l,i.current=Je(l)}else r.current=null;n(f)},[])}}function Qn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ks(...e){const t=s.useRef(e);return t.current=e,s.useCallback(n=>{const r=t.current;let o=!1;const a=r.map(i=>{const c=Qn(i,n);return!o&&typeof c=="function"&&(o=!0),c});if(o)return()=>{for(let i=0;i<a.length;i++){const c=a[i];typeof c=="function"?c():Qn(r[i],null)}}},[])}function Je(e){return e?.animationName||"none"}function Ys(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Gs=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},He=new WeakMap,gt=new WeakMap,yt={},Qt=0,jr=function(e){return e&&(e.host||jr(e.parentNode))},Xs=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=jr(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Qs=function(e,t,n,r){var o=Xs(t,Array.isArray(e)?e:[e]);yt[n]||(yt[n]=new WeakMap);var a=yt[n],i=[],c=new Set,u=new Set(o),m=function(l){!l||c.has(l)||(c.add(l),m(l.parentNode))};o.forEach(m);var f=function(l){!l||u.has(l)||Array.prototype.forEach.call(l.children,function(h){if(c.has(h))f(h);else try{var g=h.getAttribute(r),x=g!==null&&g!=="false",p=(He.get(h)||0)+1,E=(a.get(h)||0)+1;He.set(h,p),a.set(h,E),i.push(h),p===1&&x&>.set(h,!0),E===1&&h.setAttribute(n,"true"),x||h.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",h,w)}})};return f(t),c.clear(),Qt++,function(){i.forEach(function(l){var h=He.get(l)-1,g=a.get(l)-1;He.set(l,h),a.set(l,g),h||(gt.has(l)||l.removeAttribute(r),gt.delete(l)),g||l.removeAttribute(n)}),Qt--,Qt||(He=new WeakMap,He=new WeakMap,gt=new WeakMap,yt={})}},Zs=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Gs(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Qs(r,o,n,"aria-hidden")):function(){return null}},Rt="right-scroll-bar-position",Ct="width-before-scroll-bar",Js="with-scroll-bars-hidden",ei="--removed-body-scroll-bar-size";function Zt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ti(e,t){var n=s.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var ni=typeof window<"u"?s.useLayoutEffect:s.useEffect,Zn=new WeakMap;function ri(e,t){var n=ti(null,function(r){return e.forEach(function(o){return Zt(o,r)})});return ni(function(){var r=Zn.get(n);if(r){var o=new Set(r),a=new Set(e),i=n.current;o.forEach(function(c){a.has(c)||Zt(c,null)}),a.forEach(function(c){o.has(c)||Zt(c,i)})}Zn.set(n,e)},[e]),n}function oi(e){return e}function ai(e,t){t===void 0&&(t=oi);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var i=t(a,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(a){for(r=!0;n.length;){var i=n;n=[],i.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(a),i=n}var u=function(){var f=i;i=[],f.forEach(a)},m=function(){return Promise.resolve().then(u)};m(),n={push:function(f){i.push(f),m()},filter:function(f){return i=i.filter(f),n}}}};return o}function si(e){e===void 0&&(e={});var t=ai(null);return t.options=xe({async:!0,ssr:!1},e),t}var Fr=function(e){var t=e.sideCar,n=Er(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return s.createElement(r,xe({},n))};Fr.isSideCarExport=!0;function ii(e,t){return e.useMedium(t),Fr}var $r=si(),Jt=function(){},kt=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:Jt,onWheelCapture:Jt,onTouchMoveCapture:Jt}),o=r[0],a=r[1],i=e.forwardProps,c=e.children,u=e.className,m=e.removeScrollBar,f=e.enabled,l=e.shards,h=e.sideCar,g=e.noRelative,x=e.noIsolation,p=e.inert,E=e.allowPinchZoom,w=e.as,A=w===void 0?"div":w,y=e.gapMode,v=Er(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=h,_=ri([n,t]),S=xe(xe({},v),o);return s.createElement(s.Fragment,null,f&&s.createElement(D,{sideCar:$r,removeScrollBar:m,shards:l,noRelative:g,noIsolation:x,inert:p,setCallbacks:a,allowPinchZoom:!!E,lockRef:n,gapMode:y}),i?s.cloneElement(s.Children.only(c),xe(xe({},S),{ref:_})):s.createElement(A,xe({},S,{className:u,ref:_}),c))});kt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};kt.classNames={fullWidth:Ct,zeroRight:Rt};var ci=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function li(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ci();return t&&e.setAttribute("nonce",t),e}function ui(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function di(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var fi=function(){var e=0,t=null;return{add:function(n){e==0&&(t=li())&&(ui(t,n),di(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},mi=function(){var e=fi();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Br=function(){var e=mi(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},hi={left:0,top:0,right:0,gap:0},en=function(e){return parseInt(e||"",10)||0},pi=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[en(n),en(r),en(o)]},vi=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return hi;var t=pi(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},gi=Br(),ze="data-scroll-locked",yi=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
|
|
4
4
|
.`.concat(Js,` {
|
|
5
5
|
overflow: hidden `).concat(r,`;
|
|
@@ -40,7 +40,7 @@ import{e as jo,j as d,X as vr,t as ln,f as un,L as gr,a1 as Fo,a3 as $o,r as s,c
|
|
|
40
40
|
`)},Jn=function(){var e=parseInt(document.body.getAttribute(ze)||"0",10);return isFinite(e)?e:0},wi=function(){s.useEffect(function(){return document.body.setAttribute(ze,(Jn()+1).toString()),function(){var e=Jn()-1;e<=0?document.body.removeAttribute(ze):document.body.setAttribute(ze,e.toString())}},[])},bi=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;wi();var a=s.useMemo(function(){return vi(o)},[o]);return s.createElement(gi,{styles:yi(a,!t,o,n?"":"!important")})},pn=!1;if(typeof window<"u")try{var wt=Object.defineProperty({},"passive",{get:function(){return pn=!0,!0}});window.addEventListener("test",wt,wt),window.removeEventListener("test",wt,wt)}catch{pn=!1}var Ue=pn?{passive:!1}:!1,Ei=function(e){return e.tagName==="TEXTAREA"},Hr=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Ei(e)&&n[t]==="visible")},xi=function(e){return Hr(e,"overflowY")},Si=function(e){return Hr(e,"overflowX")},er=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Ur(e,r);if(o){var a=Wr(e,r),i=a[1],c=a[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ri=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Ci=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Ur=function(e,t){return e==="v"?xi(t):Si(t)},Wr=function(e,t){return e==="v"?Ri(t):Ci(t)},Ti=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ai=function(e,t,n,r,o){var a=Ti(e,window.getComputedStyle(t).direction),i=a*r,c=n.target,u=t.contains(c),m=!1,f=i>0,l=0,h=0;do{if(!c)break;var g=Wr(e,c),x=g[0],p=g[1],E=g[2],w=p-E-a*x;(x||w)&&Ur(e,c)&&(l+=w,h+=x);var A=c.parentNode;c=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(f&&Math.abs(l)<1||!f&&Math.abs(h)<1)&&(m=!0),m},bt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},tr=function(e){return[e.deltaX,e.deltaY]},nr=function(e){return e&&"current"in e?e.current:e},Di=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ni=function(e){return`
|
|
41
41
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
42
42
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
43
|
-
`)},Oi=0,We=[];function ki(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),o=s.useState(Oi++)[0],a=s.useState(Br)[0],i=s.useRef(e);s.useEffect(function(){i.current=e},[e]),s.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=Ko([e.lockRef.current],(e.shards||[]).map(nr),!0).filter(Boolean);return p.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(p,E){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var w=bt(p),A=n.current,y="deltaX"in p?p.deltaX:A[0]-w[0],v="deltaY"in p?p.deltaY:A[1]-w[1],D,_=p.target,S=Math.abs(y)>Math.abs(v)?"h":"v";if("touches"in p&&S==="h"&&_.type==="range")return!1;var k=window.getSelection(),N=k&&k.anchorNode,F=N?N===_||N.contains(_):!1;if(F)return!1;var b=er(S,_);if(!b)return!0;if(b?D=S:(D=S==="v"?"h":"v",b=er(S,_)),!b)return!1;if(!r.current&&"changedTouches"in p&&(y||v)&&(r.current=D),!D)return!0;var P=r.current||D;return Ai(P,E,p,P==="h"?y:v)},[]),u=s.useCallback(function(p){var E=p;if(!(!We.length||We[We.length-1]!==a)){var w="deltaY"in E?tr(E):bt(E),A=t.current.filter(function(D){return D.name===E.type&&(D.target===E.target||E.target===D.shadowParent)&&Di(D.delta,w)})[0];if(A&&A.should){E.cancelable&&E.preventDefault();return}if(!A){var y=(i.current.shards||[]).map(nr).filter(Boolean).filter(function(D){return D.contains(E.target)}),v=y.length>0?c(E,y[0]):!i.current.noIsolation;v&&E.cancelable&&E.preventDefault()}}},[]),m=s.useCallback(function(p,E,w,A){var y={name:p,delta:E,target:w,should:A,shadowParent:Ii(w)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(v){return v!==y})},1)},[]),f=s.useCallback(function(p){n.current=bt(p),r.current=void 0},[]),l=s.useCallback(function(p){m(p.type,tr(p),p.target,c(p,e.lockRef.current))},[]),h=s.useCallback(function(p){m(p.type,bt(p),p.target,c(p,e.lockRef.current))},[]);s.useEffect(function(){return We.push(a),e.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:h}),document.addEventListener("wheel",u,Ue),document.addEventListener("touchmove",u,Ue),document.addEventListener("touchstart",f,Ue),function(){We=We.filter(function(p){return p!==a}),document.removeEventListener("wheel",u,Ue),document.removeEventListener("touchmove",u,Ue),document.removeEventListener("touchstart",f,Ue)}},[]);var g=e.removeScrollBar,x=e.inert;return s.createElement(s.Fragment,null,x?s.createElement(a,{styles:Ni(o)}):null,g?s.createElement(bi,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ii(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Li=ii($r,ki);var zr=s.forwardRef(function(e,t){return s.createElement(kt,xe({},e,{ref:t,sideCar:Li}))});zr.classNames=kt.classNames;const xl=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=s.useCallback(o=>{const a=o.target;if(!(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable))for(const i of t){if(!(o.key.toLowerCase()===i.key.toLowerCase())||i.action&&Yo(i.action)||i.requireShift!==void 0&&i.requireShift!==o.shiftKey)continue;const u=o.ctrlKey||o.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==u)continue}else{const m=i.noModifiers??!0,f=u||o.altKey||i.requireShift===void 0&&o.shiftKey;if(m&&f)continue}i.preventDefault&&o.preventDefault(),i.stopPropagation&&(o.stopPropagation(),o.stopImmediatePropagation()),i.handler(o);return}},[t]);s.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},Pi=e=>typeof e=="object"&&e!==null&&"code"in e&&e.code==="attachment_rejected"&&"message"in e&&typeof e.message=="string",_i=new Set(["EmptyFile","UnusableFilename","FileTooLarge","TooManyAttachments"]),rr={status:"uploading"},Vr={status:"attached"},Pe=(e,t)=>({status:"failed",reason:e,retryable:t}),tn=(e,t)=>Pi(t)?Pe(t.message,!_i.has(t.reason)):Pe(`"${e}" could not be attached: ${Se(t)??"the request failed"}. Try again.`,!0),Mi=e=>({key:e.outboxAttachmentId,serverId:e.outboxAttachmentId,file:null,placement:null,contentId:e.contentId,contentType:e.contentType,contentUrl:e.contentUrl,filename:e.filename,sizeBytes:e.sizeBytes,state:e.state==="Stored"?Vr:Pe(`"${e.filename}" did not finish uploading. Remove it and attach it again.`,!1)});class ji{constructor(t){this.deps=t}deps;entries=[];snapshot=[];listeners=new Set;generation=0;draftId;nextKey=0;reservationsInFlight=new Set;inFlight=new Map;mintedAfterRemoval=new Map;removing=new Map;removedListeners=new Set;loaded=!1;subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));getSnapshot=()=>this.snapshot;owns=t=>this.entries.some(n=>n.contentId===t);storedContent=t=>{const n=this.entries.find(r=>r.contentId===t&&r.contentUrl!==null);return n?.contentUrl?{filename:n.filename,contentType:n.contentType,contentUrl:n.contentUrl}:null};isLoaded=()=>this.loaded;refreshLinks=t=>{const n=new Map(t.map(r=>[r.outboxAttachmentId,r.contentUrl]));this.set(this.entries.map(r=>{const o=r.serverId===null?void 0:n.get(r.serverId);return o===void 0?r:{...r,contentUrl:o}}))};onRemoved=t=>(this.removedListeners.add(t),()=>this.removedListeners.delete(t));blockingReason=()=>{const[t]=this.removing.values();if(t!==void 0)return`Removing "${t}"…`;const n=this.entries.find(o=>o.state.status==="uploading");if(n)return`"${n.filename}" is still uploading.`;const r=this.entries.find(o=>o.state.status==="failed");if(r)return`"${r.filename}" is not attached. Try it again or remove it before sending.`};set(t){this.entries=t,this.snapshot=t.map(({key:n,filename:r,sizeBytes:o,state:a})=>({key:n,filename:r,sizeBytes:o,state:a}));for(const n of this.listeners)n()}patch(t,n,r){t===this.generation&&this.entries.some(o=>o.key===n)&&this.set(this.entries.map(o=>o.key===n?{...o,...r}:o))}reserve(t,n){let r=()=>{};const o=new Promise(a=>{r=()=>{this.reservationsInFlight.delete(o),a()}});return this.reservationsInFlight.add(o),{minted:this.deps.transport().mint(t,n),settle:r}}upload=async(t,n,r,o,a)=>{if(a.aborted)return;const i=this.deps.transport(),{minted:c,settle:u}=this.reserve(o,r),m=await c.catch(h=>(this.patch(t,n,{state:tn(r.name,h)}),null));if(m!==null&&a.aborted&&this.mintedAfterRemoval.set(n,m.outboxAttachmentId),m!==null&&!a.aborted&&this.patch(t,n,{serverId:m.outboxAttachmentId,filename:m.filename,contentId:m.contentId,contentType:m.contentType}),u(),m===null||a.aborted)return;const f=await i.put(m.uploadUrl,r,a).then(()=>null,h=>Se(h)??"the connection dropped");if(a.aborted)return;if(f!==null){this.patch(t,n,{state:Pe(`"${m.filename}" did not finish uploading: ${f}. Try again.`,!0)});return}const l=await i.complete(o,m.outboxAttachmentId).catch(h=>(this.patch(t,n,{state:tn(m.filename,h)}),null));l===null||a.aborted||(this.patch(t,n,{state:Vr,contentUrl:l.contentUrl}),t===this.generation&&this.entries.find(h=>h.key===n)?.placement?.stored(r,m.contentId))};settleFailure(t,n,r){if(t!==this.generation)return;const o=this.entries.find(a=>a.key===n);o?.state.status==="failed"&&o.placement?.failed(r)}run=async(t,n,r,o,a)=>{await this.upload(t,n,r,o,a),this.inFlight.get(n)?.signal===a&&this.inFlight.delete(n),this.settleFailure(t,n,r)};syncKept=async t=>{for(;this.reservationsInFlight.size>0;)await Promise.all([...this.reservationsInFlight]);const n=this.draftId;return t!==this.generation||n===void 0?null:this.deps.transport().keep(n,this.entries.flatMap(r=>r.serverId===null?[]:[r.serverId])).then(()=>null,r=>r??new Error("the request failed"))};attach=async(t,n)=>{const r=this.generation,o=t.map(i=>{this.nextKey+=1;const c={key:`local-${this.nextKey}`,serverId:null,file:i,placement:n??null,contentId:null,contentType:i.type||"application/octet-stream",contentUrl:null,filename:i.name,sizeBytes:i.size,state:rr},u=new AbortController;return this.inFlight.set(c.key,u),{entry:c,file:i,signal:u.signal}});this.set([...this.entries,...o.map(({entry:i})=>i)]);const a=await this.deps.ensureDraft();if(a.outcome==="refused"){for(const{entry:i,file:c}of o)this.inFlight.delete(i.key),this.patch(r,i.key,{state:Pe(a.reason,!0)}),this.settleFailure(r,i.key,c);return}r===this.generation&&(this.draftId=a.outboxMessageId,await Promise.all(o.map(({entry:i,file:c,signal:u})=>this.run(r,i.key,c,a.outboxMessageId,u))))};retry=async t=>{const n=this.entries.find(c=>c.key===t);if(!n||n.file===null||this.inFlight.has(t))return;const r=n.file,o=this.generation,a=new AbortController;this.inFlight.set(t,a),this.patch(o,t,{state:rr,serverId:null});const i=await this.deps.ensureDraft();if(i.outcome==="refused"){this.inFlight.delete(t),this.patch(o,t,{state:Pe(i.reason,!0)});return}if(this.draftId=i.outboxMessageId,n.serverId!==null){const c=await this.syncKept(o);if(c!==null){this.inFlight.delete(t),this.patch(o,t,{serverId:n.serverId,state:tn(r.name,c)});return}}await this.run(o,t,r,i.outboxMessageId,a.signal)};remove=async t=>{const n=this.entries.find(c=>c.key===t);if(!n)return;const r=this.generation,o=this.inFlight.get(t);if(this.set(this.entries.filter(c=>c.key!==t)),o&&(this.inFlight.delete(t),o.abort()),n.serverId===null&&!o)return;this.removing.set(t,n.filename),this.set(this.entries);const a=await this.syncKept(r);this.removing.delete(t),this.set(this.entries);const i=n.serverId??this.mintedAfterRemoval.get(t)??null;if(this.mintedAfterRemoval.delete(t),r===this.generation){if(a===null){if(n.contentId===null)return;for(const c of this.removedListeners)c(n.contentId);return}i!==null&&this.set([...this.entries,{...n,serverId:i,file:null,state:Pe(`"${n.filename}" could not be removed: ${Se(a)??"the request failed"}. It is still on the draft — remove it again.`,!1)}])}};load=(t,n)=>{this.draftId=t,this.loaded=!0;const r=new Set(n.map(a=>a.outboxAttachmentId)),o=this.entries.filter(a=>a.file!==null&&(a.serverId===null||!r.has(a.serverId)));this.set([...n.map(Mi),...o])};reset=t=>{this.generation+=1;for(const n of this.inFlight.values())n.abort();this.inFlight.clear(),this.mintedAfterRemoval.clear(),this.removing.clear(),this.draftId=t,this.loaded=!1,this.set([])}}const Fi=(e,t,n)=>fetch(e,{method:"PUT",body:t,signal:n}).then(r=>{if(!r.ok)throw new Error(`the server answered ${r.status}`)}),$i=({ensureDraft:e})=>{const t=_e({...Go(),meta:Me}),n=_e({...Xo(),meta:Me}),r=_e({...xr(),meta:Me}),o=s.useRef(null);o.current={mint:(u,m)=>t.mutateAsync({path:{outboxMessageId:u},body:{filename:m.name,contentType:m.type||"application/octet-stream",sizeBytes:m.size}}),put:Fi,complete:(u,m)=>n.mutateAsync({path:{outboxMessageId:u,outboxAttachmentId:m}}).then(f=>({contentUrl:f.contentUrl})),keep:(u,m)=>r.mutateAsync({path:{outboxMessageId:u},body:{attachmentIds:m}}).then(()=>{})};const a=s.useRef(e);a.current=e;const[i]=s.useState(()=>new ji({transport:()=>{const u=o.current;if(!u)throw new Error("attachment transport not ready");return u},ensureDraft:()=>a.current()}));return{items:s.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot),attach:i.attach,retry:i.retry,remove:i.remove,load:i.load,reset:i.reset,owns:i.owns,isLoaded:i.isLoaded,refreshLinks:i.refreshLinks,storedContent:i.storedContent,onRemoved:i.onRemoved,blockingReason:i.blockingReason()}},Sl=e=>e==="link-expired"||e==="not-ready";class vn extends Error{reason;status;constructor(t,n,r){super(n),this.name="AttachmentFetchError",this.reason=t,this.status=r}}const Bi="x-remit-403-reason",Hi="expired",Ui=(e,t)=>{if(t?.trim()===Hi)return"link-expired";const n=ha(e,t);return n==="auth"?"auth":n==="body-missing"?"missing":"generic"},Wi=300*1e3,zi=async(e,t)=>{const n={},r=await t();r&&(n.Authorization=`Bearer ${r}`);const o=await Qo(e,{headers:n,signal:AbortSignal.timeout(Wi)});if(o.status===202)throw new vn("not-ready","Attachment is still being fetched from the mail server",202);if(!o.ok)throw new vn(Ui(o.status,o.headers.get(Bi)),`Failed to download attachment (${o.status} ${o.statusText})`,o.status);return o.blob()},Vi=(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}}},or=e=>e instanceof vn?e.reason:"generic",qi=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while downloading this attachment.",Rl=(e,t,n)=>{if(e!=="auth")return Sr(Rr({title:`Bug: attachment download failed (${e})`,errorMessage:`Downloading "${t}" failed: ${n}`}))},Cl=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.rel="noopener",document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)},Ki=e=>{const{getToken:t}=Zo(),n=s.useRef({...e,getToken:t});return n.current={...e,getToken:t},s.useMemo(()=>{const r=c=>{const u=n.current;return u.isLoaded()?null:u.draftAttachments.find(m=>m.contentId===c)??null},o=c=>n.current.storedContent(c)??r(c),a=c=>zi(c.contentUrl,n.current.getToken).then(u=>URL.createObjectURL(new Blob([u],{type:c.contentType}))),i=c=>n.current.refreshLinks().then(()=>{const u=o(c);if(!u)throw new Error("the file is no longer on this draft");return a(u)});return{attach:(c,u)=>{n.current.attach(c,u)},owns:c=>n.current.owns(c)||r(c)!==null,onRemoved:c=>n.current.onRemoved(c),resolve:c=>{const u=o(c);return u?a(u).catch(m=>{if(or(m)!=="link-expired")throw m;return i(c)}).catch(m=>{const f=or(m);return n.current.pushError({...Vi(f,u.filename,qi(m)),error:f==="generic"?m:void 0}),null}):Promise.resolve(null)}}},[])},Yi=(e,t)=>e===void 0&&t.toAddresses.length===0,Gi={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},ar={status:"idle"},Xi={status:"saving"},sr={status:"saved"},ir={status:"error"},Qi=e=>e.then(()=>{},()=>{}),Zi=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(ar),[o,a]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),u=Cr(),m=s.useRef(e),f=s.useRef(e);if(m.current!==e){const y=m.current!==void 0;m.current=e,f.current=e,y&&i.current&&clearTimeout(i.current)}const l=_e({...Jo(),meta:Me}),h=_e({...xr(),meta:Me}),g=s.useCallback(async y=>{r(Xi),a(null);const v=f.current;if(v){const _=await h.mutateAsync({path:{outboxMessageId:v},body:{toAddresses:y.toAddresses,ccAddresses:y.ccAddresses,bccAddresses:y.bccAddresses,subject:y.subject,textBody:y.textBody,htmlBody:y.htmlBody,inReplyTo:y.inReplyTo,references:y.references}});return r(sr),_}const D=await l.mutateAsync({body:{...y,sendImmediately:!1}});return f.current=D.outboxMessageId,t(D.outboxMessageId),r(sr),u.invalidateQueries({queryKey:ea().queryKey}),D},[l.mutateAsync,h.mutateAsync,t,u]),x=s.useRef(Promise.resolve()),p=s.useCallback(y=>{const v=x.current.then(()=>g(y));return x.current=Qi(v),v},[g]),E=s.useCallback(y=>{if(i.current&&clearTimeout(i.current),Yi(f.current,y)){r(Gi);return}r(v=>v.status==="unsaved"?ar:v),i.current=setTimeout(()=>{const v=f.current;v&&c.current.has(v)||p(y).catch(D=>{a(D),r(ir)})},2e3)},[p]),w=s.useCallback(y=>(i.current&&clearTimeout(i.current),p(y).then(v=>({outcome:"saved",outboxMessageId:v.outboxMessageId})).catch(v=>(r(ir),{outcome:"failed",error:v}))),[p]),A=s.useCallback(y=>{i.current&&clearTimeout(i.current),y&&c.current.add(y)},[]);return{saveState:n,saveError:o,saveDraft:E,saveImmediately:w,stopAutoSave:A}},Ji=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,ec=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:Ji(e),nn=({label:e,addresses:t,onChange:n,placeholder:r,onPendingChange:o,ref:a})=>{const[i,c]=s.useState(""),u=ya(i,200),{data:m}=At({...ta({query:{q:u,limit:8}}),enabled:u.length>=2}),f=s.useMemo(()=>(m?.items??[]).filter(ec).map(l=>({email:l.normalizedEmail,displayName:l.displayName})),[m]);return d.jsx(_a,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:f,onQueryChange:c,onPendingChange:o,ref:a})},tc=({accountId:e,configureRef:t})=>{const n=wa();return d.jsx(qa,{configureRef:t,onConfigure:()=>{n(e)}})},nc={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},rc=e=>{const t=`Spellcheck for ${e.language} is off: ${nc[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Sr(Rr({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},oc=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await Tr(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-YjewF802.js");return{openSpellcheckWorker:r}},__vite__mapDeps([0,1,2,3]));return n(t)},onStatus:t=>{t.state==="failed"&&e(rc(t))}}),ac=e=>{if(na(e)?.code==="mail_sync_off")return Se(e)},qr=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),Dt=e=>e.split(`
|
|
43
|
+
`)},Oi=0,We=[];function ki(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),o=s.useState(Oi++)[0],a=s.useState(Br)[0],i=s.useRef(e);s.useEffect(function(){i.current=e},[e]),s.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=Ko([e.lockRef.current],(e.shards||[]).map(nr),!0).filter(Boolean);return p.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(p,E){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var w=bt(p),A=n.current,y="deltaX"in p?p.deltaX:A[0]-w[0],v="deltaY"in p?p.deltaY:A[1]-w[1],D,_=p.target,S=Math.abs(y)>Math.abs(v)?"h":"v";if("touches"in p&&S==="h"&&_.type==="range")return!1;var k=window.getSelection(),N=k&&k.anchorNode,F=N?N===_||N.contains(_):!1;if(F)return!1;var b=er(S,_);if(!b)return!0;if(b?D=S:(D=S==="v"?"h":"v",b=er(S,_)),!b)return!1;if(!r.current&&"changedTouches"in p&&(y||v)&&(r.current=D),!D)return!0;var P=r.current||D;return Ai(P,E,p,P==="h"?y:v)},[]),u=s.useCallback(function(p){var E=p;if(!(!We.length||We[We.length-1]!==a)){var w="deltaY"in E?tr(E):bt(E),A=t.current.filter(function(D){return D.name===E.type&&(D.target===E.target||E.target===D.shadowParent)&&Di(D.delta,w)})[0];if(A&&A.should){E.cancelable&&E.preventDefault();return}if(!A){var y=(i.current.shards||[]).map(nr).filter(Boolean).filter(function(D){return D.contains(E.target)}),v=y.length>0?c(E,y[0]):!i.current.noIsolation;v&&E.cancelable&&E.preventDefault()}}},[]),m=s.useCallback(function(p,E,w,A){var y={name:p,delta:E,target:w,should:A,shadowParent:Ii(w)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(v){return v!==y})},1)},[]),f=s.useCallback(function(p){n.current=bt(p),r.current=void 0},[]),l=s.useCallback(function(p){m(p.type,tr(p),p.target,c(p,e.lockRef.current))},[]),h=s.useCallback(function(p){m(p.type,bt(p),p.target,c(p,e.lockRef.current))},[]);s.useEffect(function(){return We.push(a),e.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:h}),document.addEventListener("wheel",u,Ue),document.addEventListener("touchmove",u,Ue),document.addEventListener("touchstart",f,Ue),function(){We=We.filter(function(p){return p!==a}),document.removeEventListener("wheel",u,Ue),document.removeEventListener("touchmove",u,Ue),document.removeEventListener("touchstart",f,Ue)}},[]);var g=e.removeScrollBar,x=e.inert;return s.createElement(s.Fragment,null,x?s.createElement(a,{styles:Ni(o)}):null,g?s.createElement(bi,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ii(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Li=ii($r,ki);var zr=s.forwardRef(function(e,t){return s.createElement(kt,xe({},e,{ref:t,sideCar:Li}))});zr.classNames=kt.classNames;const xl=({enabled:e=!0,bindings:t,capture:n=!1})=>{const r=s.useCallback(o=>{const a=o.target;if(!(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable))for(const i of t){if(!(o.key.toLowerCase()===i.key.toLowerCase())||i.action&&Yo(i.action)||i.requireShift!==void 0&&i.requireShift!==o.shiftKey)continue;const u=o.ctrlKey||o.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==u)continue}else{const m=i.noModifiers??!0,f=u||o.altKey||i.requireShift===void 0&&o.shiftKey;if(m&&f)continue}i.preventDefault&&o.preventDefault(),i.stopPropagation&&(o.stopPropagation(),o.stopImmediatePropagation()),i.handler(o);return}},[t]);s.useEffect(()=>{if(e)return window.addEventListener("keydown",r,n),()=>window.removeEventListener("keydown",r,n)},[e,r,n])},Pi=e=>typeof e=="object"&&e!==null&&"code"in e&&e.code==="attachment_rejected"&&"message"in e&&typeof e.message=="string",_i=new Set(["EmptyFile","UnusableFilename","FileTooLarge","TooManyAttachments"]),rr={status:"uploading"},Vr={status:"attached"},Pe=(e,t)=>({status:"failed",reason:e,retryable:t}),tn=(e,t)=>Pi(t)?Pe(t.message,!_i.has(t.reason)):Pe(`"${e}" could not be attached: ${Se(t)??"the request failed"}. Try again.`,!0),Mi=e=>({key:e.outboxAttachmentId,serverId:e.outboxAttachmentId,file:null,placement:null,contentId:e.contentId,contentType:e.contentType,contentUrl:e.contentUrl,filename:e.filename,sizeBytes:e.sizeBytes,state:e.state==="Stored"?Vr:Pe(`"${e.filename}" did not finish uploading. Remove it and attach it again.`,!1)});class ji{constructor(t){this.deps=t}deps;entries=[];snapshot=[];listeners=new Set;generation=0;draftId;nextKey=0;reservationsInFlight=new Set;inFlight=new Map;mintedAfterRemoval=new Map;removing=new Map;removedListeners=new Set;loaded=!1;subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));getSnapshot=()=>this.snapshot;owns=t=>this.entries.some(n=>n.contentId===t);storedContent=t=>{const n=this.entries.find(r=>r.contentId===t&&r.contentUrl!==null);return n?.contentUrl?{filename:n.filename,contentType:n.contentType,contentUrl:n.contentUrl}:null};isLoaded=()=>this.loaded;refreshLinks=t=>{const n=new Map(t.map(r=>[r.outboxAttachmentId,r.contentUrl]));this.set(this.entries.map(r=>{const o=r.serverId===null?void 0:n.get(r.serverId);return o===void 0?r:{...r,contentUrl:o}}))};onRemoved=t=>(this.removedListeners.add(t),()=>this.removedListeners.delete(t));blockingReason=()=>{const[t]=this.removing.values();if(t!==void 0)return`Removing "${t}"…`;const n=this.entries.find(o=>o.state.status==="uploading");if(n)return`"${n.filename}" is still uploading.`;const r=this.entries.find(o=>o.state.status==="failed");if(r)return`"${r.filename}" is not attached. Try it again or remove it before sending.`};set(t){this.entries=t,this.snapshot=t.map(({key:n,filename:r,sizeBytes:o,state:a})=>({key:n,filename:r,sizeBytes:o,state:a}));for(const n of this.listeners)n()}patch(t,n,r){t===this.generation&&this.entries.some(o=>o.key===n)&&this.set(this.entries.map(o=>o.key===n?{...o,...r}:o))}reserve(t,n){let r=()=>{};const o=new Promise(a=>{r=()=>{this.reservationsInFlight.delete(o),a()}});return this.reservationsInFlight.add(o),{minted:this.deps.transport().mint(t,n),settle:r}}upload=async(t,n,r,o,a)=>{if(a.aborted)return;const i=this.deps.transport(),{minted:c,settle:u}=this.reserve(o,r),m=await c.catch(h=>(this.patch(t,n,{state:tn(r.name,h)}),null));if(m!==null&&a.aborted&&this.mintedAfterRemoval.set(n,m.outboxAttachmentId),m!==null&&!a.aborted&&this.patch(t,n,{serverId:m.outboxAttachmentId,filename:m.filename,contentId:m.contentId,contentType:m.contentType}),u(),m===null||a.aborted)return;const f=await i.put(m.uploadUrl,r,a).then(()=>null,h=>Se(h)??"the connection dropped");if(a.aborted)return;if(f!==null){this.patch(t,n,{state:Pe(`"${m.filename}" did not finish uploading: ${f}. Try again.`,!0)});return}const l=await i.complete(o,m.outboxAttachmentId).catch(h=>(this.patch(t,n,{state:tn(m.filename,h)}),null));l===null||a.aborted||(this.patch(t,n,{state:Vr,contentUrl:l.contentUrl}),t===this.generation&&this.entries.find(h=>h.key===n)?.placement?.stored(r,m.contentId))};settleFailure(t,n,r){if(t!==this.generation)return;const o=this.entries.find(a=>a.key===n);o?.state.status==="failed"&&o.placement?.failed(r)}run=async(t,n,r,o,a)=>{await this.upload(t,n,r,o,a),this.inFlight.get(n)?.signal===a&&this.inFlight.delete(n),this.settleFailure(t,n,r)};syncKept=async t=>{for(;this.reservationsInFlight.size>0;)await Promise.all([...this.reservationsInFlight]);const n=this.draftId;return t!==this.generation||n===void 0?null:this.deps.transport().keep(n,this.entries.flatMap(r=>r.serverId===null?[]:[r.serverId])).then(()=>null,r=>r??new Error("the request failed"))};attach=async(t,n)=>{const r=this.generation,o=t.map(i=>{this.nextKey+=1;const c={key:`local-${this.nextKey}`,serverId:null,file:i,placement:n??null,contentId:null,contentType:i.type||"application/octet-stream",contentUrl:null,filename:i.name,sizeBytes:i.size,state:rr},u=new AbortController;return this.inFlight.set(c.key,u),{entry:c,file:i,signal:u.signal}});this.set([...this.entries,...o.map(({entry:i})=>i)]);const a=await this.deps.ensureDraft();if(a.outcome==="refused"){for(const{entry:i,file:c}of o)this.inFlight.delete(i.key),this.patch(r,i.key,{state:Pe(a.reason,!0)}),this.settleFailure(r,i.key,c);return}r===this.generation&&(this.draftId=a.outboxMessageId,await Promise.all(o.map(({entry:i,file:c,signal:u})=>this.run(r,i.key,c,a.outboxMessageId,u))))};retry=async t=>{const n=this.entries.find(c=>c.key===t);if(!n||n.file===null||this.inFlight.has(t))return;const r=n.file,o=this.generation,a=new AbortController;this.inFlight.set(t,a),this.patch(o,t,{state:rr,serverId:null});const i=await this.deps.ensureDraft();if(i.outcome==="refused"){this.inFlight.delete(t),this.patch(o,t,{state:Pe(i.reason,!0)});return}if(this.draftId=i.outboxMessageId,n.serverId!==null){const c=await this.syncKept(o);if(c!==null){this.inFlight.delete(t),this.patch(o,t,{serverId:n.serverId,state:tn(r.name,c)});return}}await this.run(o,t,r,i.outboxMessageId,a.signal)};remove=async t=>{const n=this.entries.find(c=>c.key===t);if(!n)return;const r=this.generation,o=this.inFlight.get(t);if(this.set(this.entries.filter(c=>c.key!==t)),o&&(this.inFlight.delete(t),o.abort()),n.serverId===null&&!o)return;this.removing.set(t,n.filename),this.set(this.entries);const a=await this.syncKept(r);this.removing.delete(t),this.set(this.entries);const i=n.serverId??this.mintedAfterRemoval.get(t)??null;if(this.mintedAfterRemoval.delete(t),r===this.generation){if(a===null){if(n.contentId===null)return;for(const c of this.removedListeners)c(n.contentId);return}i!==null&&this.set([...this.entries,{...n,serverId:i,file:null,state:Pe(`"${n.filename}" could not be removed: ${Se(a)??"the request failed"}. It is still on the draft — remove it again.`,!1)}])}};load=(t,n)=>{this.draftId=t,this.loaded=!0;const r=new Set(n.map(a=>a.outboxAttachmentId)),o=this.entries.filter(a=>a.file!==null&&(a.serverId===null||!r.has(a.serverId)));this.set([...n.map(Mi),...o])};reset=t=>{this.generation+=1;for(const n of this.inFlight.values())n.abort();this.inFlight.clear(),this.mintedAfterRemoval.clear(),this.removing.clear(),this.draftId=t,this.loaded=!1,this.set([])}}const Fi=(e,t,n)=>fetch(e,{method:"PUT",body:t,signal:n}).then(r=>{if(!r.ok)throw new Error(`the server answered ${r.status}`)}),$i=({ensureDraft:e})=>{const t=_e({...Go(),meta:Me}),n=_e({...Xo(),meta:Me}),r=_e({...xr(),meta:Me}),o=s.useRef(null);o.current={mint:(u,m)=>t.mutateAsync({path:{outboxMessageId:u},body:{filename:m.name,contentType:m.type||"application/octet-stream",sizeBytes:m.size}}),put:Fi,complete:(u,m)=>n.mutateAsync({path:{outboxMessageId:u,outboxAttachmentId:m}}).then(f=>({contentUrl:f.contentUrl})),keep:(u,m)=>r.mutateAsync({path:{outboxMessageId:u},body:{attachmentIds:m}}).then(()=>{})};const a=s.useRef(e);a.current=e;const[i]=s.useState(()=>new ji({transport:()=>{const u=o.current;if(!u)throw new Error("attachment transport not ready");return u},ensureDraft:()=>a.current()}));return{items:s.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot),attach:i.attach,retry:i.retry,remove:i.remove,load:i.load,reset:i.reset,owns:i.owns,isLoaded:i.isLoaded,refreshLinks:i.refreshLinks,storedContent:i.storedContent,onRemoved:i.onRemoved,blockingReason:i.blockingReason()}},Sl=e=>e==="link-expired"||e==="not-ready";class vn extends Error{reason;status;constructor(t,n,r){super(n),this.name="AttachmentFetchError",this.reason=t,this.status=r}}const Bi="x-remit-403-reason",Hi="expired",Ui=(e,t)=>{if(t?.trim()===Hi)return"link-expired";const n=ha(e,t);return n==="auth"?"auth":n==="body-missing"?"missing":"generic"},Wi=300*1e3,zi=async(e,t)=>{const n={},r=await t();r&&(n.Authorization=`Bearer ${r}`);const o=await Qo(e,{headers:n,signal:AbortSignal.timeout(Wi)});if(o.status===202)throw new vn("not-ready","Attachment is still being fetched from the mail server",202);if(!o.ok)throw new vn(Ui(o.status,o.headers.get(Bi)),`Failed to download attachment (${o.status} ${o.statusText})`,o.status);return o.blob()},Vi=(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}}},or=e=>e instanceof vn?e.reason:"generic",qi=e=>e instanceof Error?e.message:typeof e=="string"?e:"An unexpected error occurred while downloading this attachment.",Rl=(e,t,n)=>{if(e!=="auth")return Sr(Rr({title:`Bug: attachment download failed (${e})`,errorMessage:`Downloading "${t}" failed: ${n}`}))},Cl=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.rel="noopener",document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)},Ki=e=>{const{getToken:t}=Zo(),n=s.useRef({...e,getToken:t});return n.current={...e,getToken:t},s.useMemo(()=>{const r=c=>{const u=n.current;return u.isLoaded()?null:u.draftAttachments.find(m=>m.contentId===c)??null},o=c=>n.current.storedContent(c)??r(c),a=c=>zi(c.contentUrl,n.current.getToken).then(u=>URL.createObjectURL(new Blob([u],{type:c.contentType}))),i=c=>n.current.refreshLinks().then(()=>{const u=o(c);if(!u)throw new Error("the file is no longer on this draft");return a(u)});return{attach:(c,u)=>{n.current.attach(c,u)},owns:c=>n.current.owns(c)||r(c)!==null,onRemoved:c=>n.current.onRemoved(c),resolve:c=>{const u=o(c);return u?a(u).catch(m=>{if(or(m)!=="link-expired")throw m;return i(c)}).catch(m=>{const f=or(m);return n.current.pushError({...Vi(f,u.filename,qi(m)),error:f==="generic"?m:void 0}),null}):Promise.resolve(null)}}},[])},Yi=(e,t)=>e===void 0&&t.toAddresses.length===0,Gi={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},ar={status:"idle"},Xi={status:"saving"},sr={status:"saved"},ir={status:"error"},Qi=e=>e.then(()=>{},()=>{}),Zi=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(ar),[o,a]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),u=Cr(),m=s.useRef(e),f=s.useRef(e);if(m.current!==e){const y=m.current!==void 0;m.current=e,f.current=e,y&&i.current&&clearTimeout(i.current)}const l=_e({...Jo(),meta:Me}),h=_e({...xr(),meta:Me}),g=s.useCallback(async y=>{r(Xi),a(null);const v=f.current;if(v){const _=await h.mutateAsync({path:{outboxMessageId:v},body:{toAddresses:y.toAddresses,ccAddresses:y.ccAddresses,bccAddresses:y.bccAddresses,subject:y.subject,textBody:y.textBody,htmlBody:y.htmlBody,inReplyTo:y.inReplyTo,references:y.references}});return r(sr),_}const D=await l.mutateAsync({body:{...y,sendImmediately:!1}});return f.current=D.outboxMessageId,t(D.outboxMessageId),r(sr),u.invalidateQueries({queryKey:ea().queryKey}),D},[l.mutateAsync,h.mutateAsync,t,u]),x=s.useRef(Promise.resolve()),p=s.useCallback(y=>{const v=x.current.then(()=>g(y));return x.current=Qi(v),v},[g]),E=s.useCallback(y=>{if(i.current&&clearTimeout(i.current),Yi(f.current,y)){r(Gi);return}r(v=>v.status==="unsaved"?ar:v),i.current=setTimeout(()=>{const v=f.current;v&&c.current.has(v)||p(y).catch(D=>{a(D),r(ir)})},2e3)},[p]),w=s.useCallback(y=>(i.current&&clearTimeout(i.current),p(y).then(v=>({outcome:"saved",outboxMessageId:v.outboxMessageId})).catch(v=>(r(ir),{outcome:"failed",error:v}))),[p]),A=s.useCallback(y=>{i.current&&clearTimeout(i.current),y&&c.current.add(y)},[]);return{saveState:n,saveError:o,saveDraft:E,saveImmediately:w,stopAutoSave:A}},Ji=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,ec=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:Ji(e),nn=({label:e,addresses:t,onChange:n,placeholder:r,onPendingChange:o,ref:a})=>{const[i,c]=s.useState(""),u=ya(i,200),{data:m}=At({...ta({query:{q:u,limit:8}}),enabled:u.length>=2}),f=s.useMemo(()=>(m?.items??[]).filter(ec).map(l=>({email:l.normalizedEmail,displayName:l.displayName})),[m]);return d.jsx(_a,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:f,onQueryChange:c,onPendingChange:o,ref:a})},tc=({accountId:e,configureRef:t})=>{const n=wa();return d.jsx(qa,{configureRef:t,onConfigure:()=>{n(e)}})},nc={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},rc=e=>{const t=`Spellcheck for ${e.language} is off: ${nc[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Sr(Rr({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},oc=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await Tr(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-CxrExxo5.js");return{openSpellcheckWorker:r}},__vite__mapDeps([0,1,2,3]));return n(t)},onStatus:t=>{t.state==="failed"&&e(rc(t))}}),ac=e=>{if(na(e)?.code==="mail_sync_off")return Se(e)},qr=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),Dt=e=>e.split(`
|
|
44
44
|
`).map(t=>`<p>${qr(t)}</p>`).join(""),sc=new Set(["ADDRESS","ARTICLE","BLOCKQUOTE","BR","DIV","H1","H2","H3","H4","H5","H6","HR","LI","OL","P","PRE","SECTION","TABLE","TR","UL"]),ic=e=>{const t=new DOMParser().parseFromString(e,"text/html"),n=[];let r="";const o=()=>{n.push(r.trim()),r=""},a=i=>{if(i.nodeType===i.TEXT_NODE){r+=(i.textContent??"").replace(/\s+/g," ");return}if(i.nodeType!==i.ELEMENT_NODE)return;const c=sc.has(i.tagName);c&&r!==""&&o();for(const u of i.childNodes)a(u);c&&o()};return a(t.body),r!==""&&o(),n.join(`
|
|
45
45
|
`).replace(/\n{3,}/g,`
|
|
46
46
|
|
|
@@ -50,7 +50,7 @@ import{e as jo,j as d,X as vr,t as ln,f as un,L as gr,a1 as Fo,a3 as $o,r as s,c
|
|
|
50
50
|
`))}${o}`}}const a=lc(t);return{text:[a,...fc(r)].join(`
|
|
51
51
|
`),html:`<p>${qr(a)}</p><blockquote type="cite">${o}</blockquote>`}},hc=(e,t)=>e===""?t:`${e}
|
|
52
52
|
|
|
53
|
-
${t}`,rn=(e,t,n,r)=>{const o=r?hc(t.text,r.text):t.text;if(e==="plain")return{textBody:o||void 0,htmlBody:""};const a=r?`${t.html}${r.html}`:t.html;return{textBody:o||void 0,htmlBody:a?ra(a,n):void 0}},cr=150,pc=()=>{const[e,t]=s.useState(()=>{if(typeof window>"u"||!window.visualViewport)return{viewportHeight:0,isKeyboardOpen:!1};const n=window.visualViewport.height;return{viewportHeight:n,isKeyboardOpen:window.innerHeight-n>cr}});return s.useEffect(()=>{if(typeof window>"u"||!window.visualViewport)return;const n=window.visualViewport,r=()=>{const o=n.height;t({viewportHeight:o,isKeyboardOpen:window.innerHeight-o>cr})};return r(),n.addEventListener("resize",r),()=>n.removeEventListener("resize",r)},[]),e},vc=({selectedAccountId:e,onSelect:t})=>{const{data:n}=At({...Ar(),staleTime:1/0}),r=n?.accounts??[];if(s.useEffect(()=>{!e&&r.length===1&&r[0]&&t(r[0])},[e,r,t]),r.length<=1){const a=r[0];return a?d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),d.jsx("div",{className:"text-sm py-1.5",children:a.email})]}):null}const o=r.some(a=>a.accountId===e);return d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{htmlFor:"from-account-selector",className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),d.jsxs("select",{id:"from-account-selector",value:o?e:"",onChange:a=>{const i=r.find(c=>c.accountId===a.target.value);i&&t(i)},className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",children:[!o&&d.jsx("option",{value:"",disabled:!0,children:"Choose an account"}),r.map(a=>d.jsx("option",{value:a.accountId,children:a.email},a.accountId))]})]})},gc=s.lazy(()=>Tr(()=>import("./rich-text-
|
|
53
|
+
${t}`,rn=(e,t,n,r)=>{const o=r?hc(t.text,r.text):t.text;if(e==="plain")return{textBody:o||void 0,htmlBody:""};const a=r?`${t.html}${r.html}`:t.html;return{textBody:o||void 0,htmlBody:a?ra(a,n):void 0}},cr=150,pc=()=>{const[e,t]=s.useState(()=>{if(typeof window>"u"||!window.visualViewport)return{viewportHeight:0,isKeyboardOpen:!1};const n=window.visualViewport.height;return{viewportHeight:n,isKeyboardOpen:window.innerHeight-n>cr}});return s.useEffect(()=>{if(typeof window>"u"||!window.visualViewport)return;const n=window.visualViewport,r=()=>{const o=n.height;t({viewportHeight:o,isKeyboardOpen:window.innerHeight-o>cr})};return r(),n.addEventListener("resize",r),()=>n.removeEventListener("resize",r)},[]),e},vc=({selectedAccountId:e,onSelect:t})=>{const{data:n}=At({...Ar(),staleTime:1/0}),r=n?.accounts??[];if(s.useEffect(()=>{!e&&r.length===1&&r[0]&&t(r[0])},[e,r,t]),r.length<=1){const a=r[0];return a?d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),d.jsx("div",{className:"text-sm py-1.5",children:a.email})]}):null}const o=r.some(a=>a.accountId===e);return d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("label",{htmlFor:"from-account-selector",className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),d.jsxs("select",{id:"from-account-selector",value:o?e:"",onChange:a=>{const i=r.find(c=>c.accountId===a.target.value);i&&t(i)},className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",children:[!o&&d.jsx("option",{value:"",disabled:!0,children:"Choose an account"}),r.map(a=>d.jsx("option",{value:a.accountId,children:a.email},a.accountId))]})]})},gc=s.lazy(()=>Tr(()=>import("./rich-text-BwY3htQf.js"),__vite__mapDeps([4,1,2,5,6,7,8,9,3,10,11,12,13,14])).then(e=>({default:e.ComposeBody}))),lr=e=>e?`<p></p><p>-- </p>${Dt(e)}`:"",Et=(e,t)=>t?{html:`${Dt(t.body)}${lr(e)}`,text:[t.body,e].filter(Boolean).join(`
|
|
54
54
|
|
|
55
55
|
`)}:{html:lr(e),text:e},yc=e=>e?/^re:\s/i.test(e)?e:`Re: ${e}`:"Re: ",wc=e=>e?/^fwd?:\s/i.test(e)?e:`Fwd: ${e}`:"Fwd: ",bc=(e,t,n)=>{const{envelope:r}=e,a=(r.replyTo.length>0?r.replyTo:r.from).map(m=>({email:m.normalizedEmail,displayName:m.displayName}));if(t!=="reply-all")return{to:a,cc:[]};const i=n?.toLowerCase(),c=new Set(a.map(m=>m.email.toLowerCase())),u=[...r.to,...r.cc].filter(m=>m.normalizedEmail.toLowerCase()!==i&&!c.has(m.normalizedEmail.toLowerCase())).map(m=>({email:m.normalizedEmail,displayName:m.displayName}));return{to:a,cc:u}},ur=e=>{const t=e.envelope.messageIdValue,r=[...e.references.filter(o=>o.referenceType==="references").sort((o,a)=>o.referenceOrder-a.referenceOrder).map(o=>o.messageIdValue)];return t&&!r.includes(t)&&r.push(t),{inReplyTo:t,references:r}},Ec="Add a To address before sending.",xc="Loading the message you're quoting.",Sc="The message you're quoting couldn't be loaded, so it won't be included.",Rc="Add a To address before attaching a file — the draft the file is kept with is saved against it.",Cc=({label:e,text:t})=>`${e} holds "${t}", which is not an address.`,dr=e=>e.find(t=>t.text.trim()!==""),Tc={entries:[],unparsed:""},Ac=(e,t,n,r,o)=>e.length===0&&t.length===0&&n.length===0&&r.trim()===""&&o.text.trim()==="",Dc=({documentGeneration:e,selectedAccountId:t,onAccountChange:n,toAddresses:r,setToAddresses:o,ccAddresses:a,setCcAddresses:i,bccAddresses:c,setBccAddresses:u,showCc:m,setShowCc:f,showBcc:l,setShowBcc:h,subject:g,setSubject:x,fieldHandles:p,onToPendingChange:E})=>{const w=fa(),{isKeyboardOpen:A}=pc(),[y,v]=s.useState(void 0),D=y===e,[_,S]=s.useState(!1);return d.jsx("div",{className:"contents",onFocusCapture:()=>S(!0),onBlurCapture:k=>{k.currentTarget.contains(k.relatedTarget)||S(!1)},children:d.jsx(Ua,{collapsed:!w&&A&&!D&&!_,onExpand:()=>v(e),summary:Ha({to:r,cc:a,bcc:c,subject:g}),from:d.jsx(vc,{selectedAccountId:t,onSelect:n}),to:d.jsx(nn,{label:"To",addresses:r,onChange:o,placeholder:"Recipients",onPendingChange:E,ref:p.to}),cc:m?d.jsx(nn,{label:"Cc",addresses:a,onChange:i,ref:p.cc}):void 0,bcc:l?d.jsx(nn,{label:"Bcc",addresses:c,onChange:u,ref:p.bcc}):void 0,subject:d.jsx(Ka,{value:g,onChange:x}),onShowCc:()=>f(!0),onShowBcc:()=>h(!0)})})},Tl=({mode:e,account:t,sourceMessage:n,outboxMessageId:r,seed:o,insertion:a,onDraftCreated:i,onClose:c,onAccountChange:u,layout:m="fill"})=>{const{startSendPolling:f}=aa(),{pushError:l}=sa(),[h,g]=s.useState([]),[x,p]=s.useState([]),[E,w]=s.useState([]),[A,y]=s.useState(Tc),v=s.useRef(null),D=s.useRef(null),_=s.useRef(null),S=s.useMemo(()=>({to:v,cc:D,bcc:_}),[]),k=s.useCallback(()=>{v.current?.clearPending(),D.current?.clearPending(),_.current?.clearPending()},[]),[N,F]=s.useState(""),[b,P]=s.useState(!1),[C,q]=s.useState(!1),[$,Q]=s.useState(t?.accountId),[z,ee]=s.useState(!1),[ne,ye]=s.useState(r),Fe=s.useRef(void 0),Ce=s.useRef(!1),de=s.useRef(null),Te=s.useRef(r),Ae=s.useRef(r!==void 0),[De,Ne]=s.useState(r!==void 0),fe=s.useRef(r!==void 0?e:void 0),Oe=s.useRef(void 0),$e=s.useRef(e);$e.current=e;const me=s.useRef(t?.accountId);s.useEffect(()=>{const T=t?.accountId;!T||me.current===T||(me.current=T,!Ae.current&&Q(T))},[t?.accountId]),s.useEffect(()=>{const T=Te.current;if(T===r||(Te.current=r,T===void 0))return;Ae.current=r!==void 0,Ne(r!==void 0),fe.current=r!==void 0?$e.current:void 0,Oe.current=void 0;const H=r?{html:"",text:""}:Et(qe.current,I.current);g([]),p([]),w([]),k(),F(""),P(!1),q(!1),at(H.html),he(H.text),Xe("rich"),it(void 0),be({...H,formatting:[]}),Ye(Z=>Z+1),ee(!1),Fe.current=void 0,Ce.current=!1,ye(r)},[r,k]);const{signature:we}=va($),qe=s.useRef(we.plainText);qe.current=we.plainText;const I=s.useRef(o);I.current=o;const[Ke,Ye]=s.useState(0),[Ge,at]=s.useState(()=>Et(we.plainText,o).html),[Lt,he]=s.useState(()=>Et(we.plainText,o).text),[ce,Xe]=s.useState("rich"),[re,Pt]=s.useState("en"),[st,it]=s.useState(),[pe,be]=s.useState(()=>({...Et(we.plainText,o),formatting:[]})),[_t,ct]=s.useState(()=>a?.version??0),Mt=a&&a.version>_t&&(r===void 0||z)?a:void 0,{data:j,error:Qe}=At({..._n({path:{outboxMessageId:r??""}}),enabled:!!r&&!z,meta:ma,retry:(T,H)=>!Mn(H)&&T<1});s.useEffect(()=>{Mn(Qe)&&c()},[Qe,c]),s.useEffect(()=>{if(!j||z)return;g(j.toAddresses.map(K=>({email:K,displayName:void 0}))),j.ccAddresses&&j.ccAddresses.length>0&&(p(j.ccAddresses.map(K=>({email:K,displayName:void 0}))),P(!0)),j.bccAddresses&&j.bccAddresses.length>0&&(w(j.bccAddresses.map(K=>({email:K,displayName:void 0}))),q(!0)),j.subject&&F(j.subject);const T=ia(j.htmlBody??""),H=T.html,Z=j.textBody??"";Xe(as(j.htmlBody)),it(T.language??void 0),at(H),he(Z),be({html:H,text:Z,formatting:[]}),Ye(K=>K+1),Q(j.accountId),ee(!0),Ce.current=!0},[j,z]),s.useEffect(()=>{if(n){if(Ae.current&&fe.current===e){const T=Oe.current;if(!T||T.myEmail===t?.email)return}if(fe.current=e,Oe.current={myEmail:t?.email},k(),e==="reply"||e==="reply-all"){const{to:T,cc:H}=bc(n,e,t?.email);g(T),p(H),H.length>0&&P(!0),F(yc(n.envelope.subject))}e==="forward"&&(g([]),p([]),w([]),F(wc(n.envelope.subject)))}},[e,n,t?.email,k]);const ke=e==="reply"||e==="reply-all"||e==="forward",{data:Ie,isLoading:lt,isError:jt,hasNoRenderablePart:Ft,refetch:O}=pa({messageId:n?.message.messageId,bodyParts:n?.bodyParts,enabled:ke&&!!n}),M=e==="forward"?"forward":"reply",B=ke&&!n,L=ke&&!De&&Ft,U=L&&M==="forward",W=s.useMemo(()=>{if(!ke||!n||De||!Ie)return;const T=Ie.kind==="html"?{kind:"html",content:os(Ie.body)}:{kind:"text",content:Ie.body};return mc(e==="forward"?"forward":"reply",n.envelope,T)},[ke,n,De,Ie,e]),X=n?.envelope.from[0]?.displayName??n?.envelope.from[0]?.normalizedEmail,le=s.useCallback(T=>{ee(!0),ye(T),i(T)},[i]),{saveState:te,saveError:oe,saveDraft:se,saveImmediately:J,stopAutoSave:ue}=Zi({outboxMessageId:r,onDraftCreated:le}),ut=s.useCallback(async()=>{if(r)return{outcome:"ready",outboxMessageId:r};if(!$)return{outcome:"refused",reason:"Choose an account to send from before attaching a file."};if(h.length===0)return{outcome:"refused",reason:Rc};const{htmlBody:T,textBody:H}=rn(ce,pe,re,W),Z=await J({accountId:$,toAddresses:h.map(K=>K.email),ccAddresses:x.length>0?x.map(K=>K.email):void 0,bccAddresses:E.length>0?E.map(K=>K.email):void 0,subject:N||void 0,textBody:H,htmlBody:T,...n&&(e==="reply"||e==="reply-all")?ur(n):{}});return Z.outcome==="failed"?{outcome:"refused",reason:`The draft could not be saved, so the file was not attached: ${Se(Z.error)??"the request failed"}.`}:{outcome:"ready",outboxMessageId:Z.outboxMessageId}},[r,$,h,x,E,N,pe,ce,re,W,n,e,J]),{items:wo,attach:$t,retry:bo,remove:Eo,load:Rn,reset:Cn,owns:xo,isLoaded:So,refreshLinks:Ro,storedContent:Co,onRemoved:To,blockingReason:Bt}=$i({ensureDraft:ut}),Ao=Cr(),Do=Ki({attach:$t,owns:xo,isLoaded:So,storedContent:Co,refreshLinks:()=>r?Ao.fetchQuery({..._n({path:{outboxMessageId:r}}),staleTime:0}).then(T=>Ro(T.attachments)):Promise.resolve(),onRemoved:To,draftAttachments:j&&j.outboxMessageId===r?j.attachments:[],pushError:l}),Tn=s.useRef(r);s.useEffect(()=>{const T=Tn.current;T!==r&&(Tn.current=r,T!==void 0&&Cn(r))},[r,Cn]);const An=s.useRef(void 0);s.useEffect(()=>{!j||j.outboxMessageId!==r||An.current!==j.outboxMessageId&&(An.current=j.outboxMessageId,Rn(j.outboxMessageId,j.attachments))},[j,r,Rn]),s.useEffect(()=>{oe&&l({title:"Couldn't save draft",detail:Se(oe)??"Saving the draft failed.",error:oe})},[oe,l]);const Dn=_e({...ca(),meta:Me}),Nn=_e({...ua(),meta:Me,onError:T=>{l(la("Couldn't discard draft","The draft wasn't discarded.",T))}}),{data:No}=At({...Ar(),staleTime:1/0}),Ze=No?.accounts.find(T=>T.accountId===$),Ht=Ze?ga(Ze):!1,[Ut,Oo]=s.useState(),Wt=Ut&&Ut.accountId===$?Ut.reason:void 0,dt=Ze?.composeLanguages,ko=s.useMemo(()=>dt&&dt.length>0?dt:da(navigator.languages),[dt]),Io=s.useMemo(()=>oc(l),[l]),ft=s.useRef(!1),[On,kn]=s.useState(!1),mt=s.useCallback((T,H)=>On?{status:"sending"}:$?Wt?{status:"blocked",reason:Wt}:Ht?{status:"blocked",reason:dn}:lt||B?{status:"blocked",reason:xc}:Bt?{status:"blocked",reason:Bt}:H?{status:"blocked",reason:Cc(H)}:T===0?{status:"blocked",reason:Ec}:U?{status:"blocked",reason:Nr}:{status:"ready",accountId:$}:{status:"blocked",reason:"Choose an account to send from."},[On,$,Wt,Ht,lt,B,Bt,U]),zt=s.useMemo(()=>mt(h.length+A.entries.length,dr([{label:"To",text:A.unparsed}])),[mt,h.length,A]),Lo=zt;s.useEffect(()=>{if(!$||ft.current||ne!==void 0&&ne!==r||r&&!z||Ac(h,x,E,N,pe))return;const{htmlBody:T,textBody:H}=rn(ce,pe,re,W),Z={accountId:$,toAddresses:h.map(ae=>ae.email),ccAddresses:x.length>0?x.map(ae=>ae.email):void 0,bccAddresses:E.length>0?E.map(ae=>ae.email):void 0,subject:N||void 0,textBody:H,htmlBody:T},K=JSON.stringify(Z);if(Ce.current){Ce.current=!1,Fe.current=K;return}Fe.current!==K&&(Fe.current=void 0,se(Z))},[$,r,ne,z,h,x,E,N,pe,ce,re,W,se]);const In=s.useCallback(async(T,H)=>{if(!ft.current){ft.current=!0,kn(!0);try{ue();const Z=n&&(e==="reply"||e==="reply-all")?ur(n):{},{htmlBody:K,textBody:ae}=rn(ce,pe,re,W),Mo=!r,ht=await J({accountId:T,toAddresses:H.to.map(ve=>ve.email),ccAddresses:H.cc.length>0?H.cc.map(ve=>ve.email):void 0,bccAddresses:H.bcc.length>0?H.bcc.map(ve=>ve.email):void 0,subject:N||void 0,textBody:ae,htmlBody:K,...Z});if(ht.outcome==="failed"){l({title:"Couldn't send message",detail:Se(ht.error)??"Saving the message failed, so nothing was sent. Try again.",error:ht.error});return}const qt=ht.outboxMessageId;if(await Dn.mutateAsync({path:{outboxMessageId:qt}}).catch(ve=>{const Pn=ac(ve);return Pn&&Oo({accountId:T,reason:Pn}),l({title:"Couldn't send message",detail:Se(ve)??(Mo?"The draft was saved but the send request failed. Try again from the Outbox.":"The send request failed. Try again."),error:ve}),null})===null)return;ue(qt),f(qt),c()}finally{ft.current=!1,kn(!1)}}},[N,pe,ce,re,W,e,n,r,J,Dn,ue,f,l,c]),Po=s.useCallback(()=>{ue(r),r&&Nn.mutate({path:{outboxMessageId:r}}),c()},[ue,r,Nn,c]),Vt=s.useCallback(T=>{l({title:"Can't send yet",detail:T}),T===dn&&de.current?.focus()},[l]),Ln=s.useCallback(()=>{if(zt.status==="sending")return;const T=S.to.current?.commitPending(),H=S.cc.current?.commitPending(),Z=S.bcc.current?.commitPending(),K={to:T?.addresses??h,cc:H?.addresses??x,bcc:Z?.addresses??E},ae=mt(K.to.length,dr([{label:"To",text:T?.unparsed??""},{label:"Cc",text:H?.unparsed??""},{label:"Bcc",text:Z?.unparsed??""}]));if(ae.status!=="sending"){if(ae.status==="blocked"){Vt(ae.reason);return}In(ae.accountId,K)}},[zt.status,S,h,x,E,mt,Vt,In]),_o=s.useCallback(T=>{Q(T.accountId),u?.(T)},[u]);return d.jsx(Ba,{layout:m,onDropFiles:T=>{$t(T)},banner:d.jsxs(d.Fragment,{children:[Ze&&Ht?d.jsx(tc,{accountId:Ze.accountId,configureRef:de}):null,L?d.jsx(Va,{mode:M}):null,jt?d.jsxs(wr,{tone:"warning","data-testid":"compose-quote-failed",children:[d.jsx("span",{children:Sc})," ",d.jsx("button",{type:"button",className:"underline",onClick:()=>{O()},children:"Try again"})]}):null]}),header:d.jsx(Dc,{documentGeneration:Ke,selectedAccountId:$,onAccountChange:_o,toAddresses:h,setToAddresses:g,ccAddresses:x,setCcAddresses:p,bccAddresses:E,setBccAddresses:w,showCc:b,setShowCc:P,showBcc:C,setShowBcc:q,subject:N,setSubject:F,fieldHandles:S,onToPendingChange:y}),quoted:W?d.jsx(Ya,{text:W.text,html:W.html,senderName:X}):void 0,attachments:d.jsx(ja,{items:wo,onRemove:T=>{Eo(T)},onRetry:T=>{bo(T)}}),actionBar:d.jsx(Na,{send:Lo,onSend:Ln,onBlocked:Vt,onDiscard:Po,save:te,onAttach:T=>{$t(T)}}),children:d.jsx(s.Suspense,{fallback:d.jsx(Fa,{}),children:d.jsx(gc,{mode:ce,onModeChange:Xe,initialHtml:Ge,initialText:Lt,onChange:be,onSubmit:Ln,initialCaret:e==="new"?"start":void 0,onConversionError:l,languages:ko,initialLanguage:st,onLanguageChange:Pt,spellcheck:Io,insertion:Mt,onInserted:ct,inlineImages:Do},Ke)})})};var It="Dialog",[Yr]=cs(It),[Nc,ie]=Yr(It),Gr=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,c=s.useRef(null),u=s.useRef(null),[m,f]=ds({prop:r,defaultProp:o??!1,onChange:a,caller:It});return d.jsx(Nc,{scope:t,triggerRef:c,contentRef:u,contentId:Xt(),titleId:Xt(),descriptionId:Xt(),open:m,onOpenChange:f,onOpenToggle:s.useCallback(()=>f(l=>!l),[f]),modal:i,children:n})};Gr.displayName=It;var Xr="DialogTrigger",Oc=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ie(Xr,n),a=je(t,o.triggerRef);return d.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":xn(o.open),...r,ref:a,onClick:Re(e.onClick,o.onOpenToggle)})});Oc.displayName=Xr;var En="DialogPortal",[kc,Qr]=Yr(En,{forceMount:void 0}),Zr=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=ie(En,t);return d.jsx(kc,{scope:t,forceMount:n,children:s.Children.map(r,i=>d.jsx(Ot,{present:n||a.open,children:d.jsx(Mr,{asChild:!0,container:o,children:i})}))})};Zr.displayName=En;var Nt="DialogOverlay",Jr=s.forwardRef((e,t)=>{const n=Qr(Nt,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=ie(Nt,e.__scopeDialog);return a.modal?d.jsx(Ot,{present:r||a.open,children:d.jsx(Lc,{...o,ref:t})}):null});Jr.displayName=Nt;var Ic=kr("DialogOverlay.RemoveScroll"),Lc=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ie(Nt,n),a=Os(),i=je(t,a);return d.jsx(zr,{as:Ic,allowPinchZoom:!0,shards:[o.contentRef],children:d.jsx(ge.div,{"data-state":xn(o.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),Ve="DialogContent",eo=s.forwardRef((e,t)=>{const n=Qr(Ve,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=ie(Ve,e.__scopeDialog);return d.jsx(Ot,{present:r||a.open,children:a.modal?d.jsx(Pc,{...o,ref:t}):d.jsx(_c,{...o,ref:t})})});eo.displayName=Ve;var Pc=s.forwardRef((e,t)=>{const n=ie(Ve,e.__scopeDialog),r=s.useRef(null),o=je(t,n.contentRef,r);return s.useEffect(()=>{const a=r.current;if(a)return Zs(a)},[]),d.jsx(to,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Re(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Re(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:Re(e.onFocusOutside,a=>a.preventDefault())})}),_c=s.forwardRef((e,t)=>{const n=ie(Ve,e.__scopeDialog),r=s.useRef(!1),o=s.useRef(!1);return d.jsx(to,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=a.target;n.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),to=s.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,c=ie(Ve,n);return Ps(),d.jsx(d.Fragment,{children:d.jsx(Pr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:d.jsx(Ir,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":xn(c.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),no="DialogTitle",ro=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ie(no,n);return d.jsx(ge.h2,{id:o.titleId,...r,ref:t})});ro.displayName=no;var oo="DialogDescription",Mc=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ie(oo,n);return d.jsx(ge.p,{id:o.descriptionId,...r,ref:t})});Mc.displayName=oo;var ao="DialogClose",jc=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ie(ao,n);return d.jsx(ge.button,{type:"button",...r,ref:t,onClick:Re(e.onClick,()=>o.onOpenChange(!1))})});jc.displayName=ao;function xn(e){return e?"open":"closed"}function Fc(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const so=R.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),ot=()=>{const e=R.useContext(so);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Fc(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
56
56
|
[data-state=closed]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n,t as s}from"./index-
|
|
1
|
+
import{j as n,t as s}from"./index-DDaQbjmr.js";function x({className:e,...t}){return n.jsx("kbd",{className:s("inline-flex h-4 min-w-4 items-center justify-center rounded-xs border border-line bg-surface-sunken px-1 font-sans text-2xs text-fg-muted",e),...t})}export{x as K};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as f,j as e,az as h,bs as y,ay as b,bQ as g,f as v,a3 as N,u as C,c as L,d as I,aP as D,aR as S,B as w}from"./index-
|
|
1
|
+
import{r as f,j as e,az as h,bs as y,ay as b,bQ as g,f as v,a3 as N,u as C,c as L,d as I,aP as D,aR as S,B as w}from"./index-DDaQbjmr.js";import{C as E}from"./confirm-dialog-C4B2Czhl.js";import{S as $}from"./settings-screen-Qy0Wa0pr.js";import{E as j}from"./ErrorState-zb46wwqB.js";import{a as T,b as k,c as R,u as O}from"./useLabels--WOniDuk.js";import"./avatar-BU2Acypp.js";import"./chevron-left-BmceVyuQ.js";import"./menu-DziguOgy.js";import"./circle-help-CVsjKp3b.js";function P({labels:l,onRename:i,onRecolor:n,onDelete:m,deletingLabelId:c}){const[u,r]=f.useState(),[o,d]=f.useState("");if(l.length===0)return e.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No labels yet. Create one below, then use it in a filter or apply it to mail directly."});const t=a=>{const s=o.trim();s!==""&&i(a,s),r(void 0)};return e.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:l.map(a=>e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[u===a.labelId?e.jsx(h,{autoFocus:!0,value:o,onChange:s=>d(s.target.value),onBlur:()=>t(a.labelId),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),t(a.labelId)),s.key==="Escape"&&(s.preventDefault(),r(void 0))},"aria-label":`Rename label ${a.name}`}):e.jsx("button",{type:"button",onClick:()=>{r(a.labelId),d(a.name)},"aria-label":`Rename label ${a.name}`,className:"flex items-center gap-2 rounded-sm text-left hover:opacity-80",children:e.jsx(y,{label:a})}),e.jsx("p",{className:"mt-0.5 text-xs text-fg-subtle",children:a.filterCount===0?"Not used in any filter":`Used in ${a.filterCount} ${a.filterCount===1?"filter":"filters"}`})]}),e.jsx(b,{"aria-label":`Color for ${a.name}`,value:a.color,onChange:s=>n(a.labelId,s.target.value),className:"w-28 shrink-0",children:g.map(s=>e.jsx("option",{value:s,children:s},s))}),e.jsx(v,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4 text-danger"}),onClick:()=>m(a),disabled:c===a.labelId,"aria-label":`Delete label ${a.name}`})]},a.labelId))})}const B=(l,i)=>{if(i===0)return{title:`Delete the "${l}" label?`};const n=i===1?"filter":"filters";return{title:`Delete the "${l}" label?`,description:`This also deletes ${i} ${n} that ${i===1?"applies":"apply"} it — they can't be recovered.`}},_=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Labels mark mail without moving it — a message can carry any number of them alongside whichever folder it lives in."}),e.jsx("p",{children:"Use a label in a filter's action to have new (and existing) mail label itself automatically, or apply one to a selection directly from the mailbox."}),e.jsx("p",{children:"Deleting a label removes it from every message, and deletes every filter that applies it — the confirmation names how many."})]});function H({accountId:l}){const{createLabel:i,isPending:n,isError:m}=O(l),[c,u]=f.useState(""),[r,o]=f.useState("Default"),d=()=>{const t=c.trim();t!==""&&i(t,r).then(()=>{u(""),o("Default")})};return e.jsxs("div",{className:"space-y-2 rounded-sm border border-line bg-surface p-3",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"New label"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Name"}),e.jsx(h,{value:c,onChange:t=>u(t.target.value),placeholder:"e.g. Receipts","aria-label":"Label name",onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),d())}})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Color"}),e.jsx(b,{value:r,onChange:t=>o(t.target.value),"aria-label":"Label color",className:"w-28",children:g.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx(v,{variant:"primary",onClick:d,disabled:n||c.trim()==="",children:n?"Creating…":"Create label"})]}),m&&e.jsx(w,{tone:"danger",variant:"soft",children:"Couldn't create that label. Please try again."})]})}function z({account:l}){const i=l.accountId,{labels:n,isPending:m,isError:c,error:u,refetch:r}=T(i),{updateLabel:o}=k(i),{deleteLabel:d,deletingLabelId:t}=R(i),[a,s]=f.useState();return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:l.email}),m?e.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading labels for ${l.email}`}):c?e.jsx(j,{variant:"inline",title:`Couldn't load labels for ${l.email}`,error:u,onRetry:()=>{r()}}):e.jsx(P,{labels:n,onRename:(p,x)=>o(p,{name:x}),onRecolor:(p,x)=>o(p,{color:x}),onDelete:s,deletingLabelId:t}),e.jsx(H,{accountId:i}),a&&(()=>{const p=B(a.name,a.filterCount);return e.jsx(E,{isOpen:!0,title:p.title,description:p.description,confirmLabel:"Delete label",destructive:!0,isBusy:t===a.labelId,onConfirm:()=>{d(a.labelId),s(void 0)},onCancel:()=>s(void 0)})})()]})}function J(){const l=C(),[i,n]=f.useState(!0),{data:m,isPending:c,isError:u,error:r,refetch:o}=L(I()),d=t=>{const a=S[t];a&&l({to:a})};return e.jsx($,{items:D,activeId:"labels",title:"Labels",description:"Mark mail without moving it, per account.",help:_,helpOpen:i,onToggleHelp:()=>n(t=>!t),onSelect:d,onBackToMail:()=>{l({to:"/mail"})},children:c?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):u?e.jsx(j,{title:"Couldn't load accounts",error:r,onRetry:()=>{o()}}):m.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:m.accounts.map(t=>e.jsx(z,{account:t},t.accountId))})})}export{J as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as ee,r as u,j as t,t as D,v as te,f as N,w as se,x as M,y as O,z as ne,A as oe,C as ae,h as Q,D as re,E as ie,F as ce,G as le,H as ue,J as de,X as me,K as pe,a as he,b as fe,M as xe,N as ge,P as be,Q as ve,R as ye,S as Se,T as je,u as Ce,c as Ne,d as Ie,U as we,O as Me,V as Pe}from"./index-DKo99WG1.js";import{S as Re,u as Ee,s as Oe,K as Te,b as ke,a as Le,c as Ae,d as Fe}from"./search-token-index-DL0AoAlj.js";import{P as De}from"./pencil-hPJlTnvS.js";import{u as R,a as Qe}from"./useMessageBodyContent-BRyDdu_J.js";import{c as Ke,s as _e,M as ze}from"./MailShell-LEDBmXGr.js";import{u as Be,a as He,R as Ve,s as qe,i as $e,H as Ge,M as Ue}from"./useRefreshControl-DKJ_Eyfn.js";import{M as We}from"./menu-u9D-cJXQ.js";import{B as Ye}from"./bug-DI9j6s_O.js";import{L as Je,S as Xe,A as Ze,M as et}from"./MailNav-DBY9OW6Y.js";import{A as tt}from"./avatar-C2R7xqlA.js";import{u as st,P as nt,a as ot,b as at}from"./popover-menu-BDeljNyh.js";import{u as rt}from"./sections-DDBMQxXz.js";import{E as it}from"./ErrorState-CHxEHbvf.js";import{K as T}from"./kbd-xYIrsDlz.js";import{u as ct}from"./index-DE-NAKWZ.js";import{u as K,i as lt}from"./useLayoutTier-C1kzvb61.js";import{u as ut}from"./useQueries-CY9FUcC8.js";import{u as dt}from"./useResultFolderIndex-BFXa90Ay.js";import{u as mt}from"./useDebouncedValue-Bq8RVLfv.js";import"./search-scope-B5-OK3Cq.js";import"./FullCompose-DkV5Z3KV.js";import"./confirm-dialog-CCDHX_6Q.js";import"./circle-check-big-B9Ca4u10.js";import"./refresh-cw-DNbEUXcm.js";import"./roving-focus-DWecg5C9.js";import"./bell-off-CD1iuAQA.js";import"./folder-failure-CqkVSsrb.js";import"./outbox-status-BlKn6P0x.js";import"./useSignature-CR4J3Q1V.js";import"./account-form-helpers-DhckT_PN.js";const pt=ee("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);function ht({email:e,onSignOut:s}){const n=u.useRef(null),{open:a,setOpen:o,containerRef:r,panelRef:i,getAnchor:d}=st("account-menu",()=>n.current?.focus());u.useEffect(()=>{if(!a)return;const c=requestAnimationFrame(()=>i.current?.querySelector('[role="menuitem"]')?.focus());return()=>cancelAnimationFrame(c)},[a,i]);const m=e??"Account";return t.jsxs("div",{ref:r,className:"relative",children:[t.jsx("button",{ref:n,type:"button","aria-label":"Account","aria-haspopup":"menu","aria-expanded":a,onClick:()=>o(c=>!c),className:"inline-flex min-h-11 min-w-11 items-center justify-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-raised hover:text-fg",children:t.jsx(tt,{name:m,email:e??void 0,size:"sm"})}),t.jsx(nt,{open:a,align:"end",panelRef:i,getAnchor:d,children:t.jsxs(ot,{ref:i,label:m,children:[e&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"truncate px-4 py-2 text-xs text-fg-muted",title:e,"data-testid":"account-menu-email",children:e}),t.jsx("hr",{className:"my-1 h-px border-0 bg-line"})]}),t.jsx(at,{label:"Sign out",icon:t.jsx(Je,{className:"size-4"}),onSelect:()=>{o(!1),n.current?.focus(),s()}})]})})]})}function ft({leading:e,search:s,actions:n,className:a}){return t.jsxs("header",{className:D("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",a),children:[e&&t.jsx("div",{className:"flex shrink-0 items-center gap-1",children:e}),t.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:t.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),n&&t.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n})]})}function xt({onCompose:e}){return t.jsx("button",{type:"button",onClick:e,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:t.jsx(De,{className:"size-6"})})}function gt(){const e=te();if(!e)return null;const s=e.showNavPane?!e.navCollapsed:!1;return t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(We,{className:"size-4"}),onClick:e.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const bt={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function vt({search:e,onCompose:s,onReportBug:n,onOpenSettings:a,composeShortcut:o,refreshControl:r,account:i}){return t.jsx(ft,{leading:t.jsx(gt,{}),search:t.jsx(Re,{value:e.value,onChange:e.onChange,onClear:e.onClear,onClearQuery:e.onClearQuery,chips:e.chips,onRemoveChip:e.onRemoveChip,placeholder:bt[e.scope]}),actions:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(pt,{className:"size-4"}),title:o?`Compose (${o})`:"Compose","aria-label":"Compose",onClick:s}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(Ye,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:n}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(Xe,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:a}),r,i]})})}function yt(){const e=se(),s=M({select:c=>O(c.location.pathname)}),n=M({select:c=>ne(c.location.search)}),[a,o]=u.useState(n),r=mt(a,200),[i,d]=u.useState(s);if(i!==s){const c=_e(i,s,n);d(s),c!==void 0&&o(c)}const m=u.useCallback(c=>{d(O(e.state.location.pathname)),o(c)},[e]);return{searchInput:a,committedQuery:Ke(a,r),viewKey:s,setSearchInput:m}}const St=()=>{const e=R();return oe()?null:t.jsx(xt,{onCompose:e})},jt=()=>t.jsx(Ze,{children:({email:e,signOut:s})=>t.jsx(ht,{email:e,onSignOut:s})});function Ct({accounts:e}){const{searchInput:s,onSearchChange:n,onSearchClear:a,onSearchClearQuery:o,resultFolderIndex:r}=ae(),i=Q(),d=rt(),m=R(),{scope:c,clearScope:x}=Ee(e),f=c.kind==="scoped"?[{id:c.chip.id,label:c.chip.label,tone:"scope"}]:void 0,p=u.useMemo(()=>e.map(b=>b.accountId),[e]),{hasNewMail:l}=Be(),{state:h,errorMessage:y,refresh:g}=He(p,{onSettled:()=>ie(i,ce(r.keys()))});return t.jsx(vt,{search:{value:s,scope:c.kind,chips:f,onChange:n,onClear:a,onClearQuery:o,onRemoveChip:x},onCompose:m,onReportBug:re,onOpenSettings:()=>d("accounts"),composeShortcut:Oe("compose"),refreshControl:t.jsx(Ve,{state:h,onRefresh:g,label:"Refresh all accounts",errorMessage:y,hasUpdate:l(p)}),account:t.jsx(jt,{})})}const Nt=({isOpen:e,onClose:s})=>{const n=u.useRef(null);return le({id:"shortcuts",open:e,answers:{back:s}}),ue(n,e),e?t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[t.jsx(de,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),t.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",tabIndex:-1,className:D("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[t.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[t.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),t.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:t.jsx(me,{className:"size-5"})})]}),t.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:Te.map(a=>t.jsxs("div",{children:[t.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:a.title}),t.jsx("div",{className:"space-y-2",children:a.hints.map(o=>t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsx("span",{className:"text-sm",children:o.description}),t.jsx("span",{className:"flex shrink-0 items-center gap-1",children:o.keys.map((r,i)=>t.jsxs(u.Fragment,{children:[i>0&&o.keys[0]==="g"&&t.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),t.jsx(T,{children:r})]},r))})]},`${o.action}-${o.keys.join("+")}`))})]},a.title))}),t.jsx("div",{className:"mt-6 border-t border-line pt-4",children:t.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",t.jsx(T,{children:"Esc"})," to close"]})})]})]}):null};function It(e){const s=ut({queries:e.map(n=>({...pe({path:{accountId:n.accountId}}),staleTime:1/0}))});return u.useMemo(()=>ke(s.map(n=>n.data?.items??[])),[s])}const _="remit:intelligence-open";function wt(){try{return localStorage.getItem(_)!=="closed"}catch{return!0}}function Mt(e){try{localStorage.setItem(_,e?"open":"closed")}catch{}}function k({panels:e,prefersOpen:s,isDesktop:n,hasThread:a,raisedFor:o,openMessage:r}){return o!==null&&o===r?!0:e.length>0?e.includes("intelligence"):n&&a&&s}const Pt=()=>{const e=K(),s=he(),n=fe(),a=s.find(xe),o=Le(),[r,i]=u.useState(wt),d=o?`${o.threadId}/${o.messageId??""}`:null,[m,c]=u.useState(null),x={panels:s,prefersOpen:r,isDesktop:e==="desktop",hasThread:o!==void 0,openMessage:d},f=k({...x,raisedFor:m}),p=k({...x,raisedFor:null}),l=u.useCallback((b,S)=>{n([...b?["intelligence"]:[],...S?[S]:[]])},[n]),h=u.useCallback(b=>{l(p,b)},[p,l]),y=u.useCallback(()=>{if(f&&!p){c(null);return}const b=!f;Mt(b),i(b),c(null),l(b,a)},[p,f,a,l]),g=u.useCallback(()=>{c(d)},[d]);return{openOverlay:a,intelligenceOpen:f,showOverlay:h,toggleIntelligence:y,raiseIntelligence:g}};var j={exports:{}},L;function Rt(){if(L)return j.exports;L=1;const e=(s,n,a)=>new Promise((o,r)=>{if(a=Object.assign({concurrency:1/0},a),typeof n!="function")throw new TypeError("Mapper function is required");const{concurrency:i}=a;if(!(typeof i=="number"&&i>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${i}\` (${typeof i})`);const d=[],m=s[Symbol.iterator]();let c=!1,x=!1,f=0,p=0;const l=()=>{if(c)return;const h=m.next(),y=p;if(p++,h.done){x=!0,f===0&&o(d);return}f++,Promise.resolve(h.value).then(g=>n(g,y)).then(g=>{d[y]=g,f--,l()},g=>{c=!0,r(g)})};for(let h=0;h<i&&(l(),!x);h++);});return j.exports=e,j.exports.default=e,j.exports}var Et=Rt();const Ot=ge(Et),Tt=900*1e3,kt=30,Lt=(e,s)=>{if(!e)return s;const n=Number.parseInt(e,10);return Number.isFinite(n)&&n>0?n:s},At=30*1e3,Ft=e=>Math.max(Lt(e,kt)*1e3,At),z=Ft(je().mailboxPollIntervalSeconds),C=(e=Date.now(),s=z)=>$e(e)?Math.min(Ge,s):s,Dt=5,P=new Set,Qt=(e,s,n=Tt)=>e.filter(a=>{const o=a.lastSyncAt;return o==null?!0:s-o>n}).map(a=>a.accountId),Kt=(e,s,n=z)=>e-s>=n,_t=(e,s)=>e.filter(n=>!s.has(n)),A=(e,s)=>{if(P.delete(e),ye(s,{softError:!0},"nobody")){Se(s);return}console.warn("[remit] background mailbox sync failed",{accountId:e,error:s})},F=(e,s)=>be({path:{accountId:e},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:ve({path:{accountId:e}})})}),zt=e=>{const s=Q(),n=u.useRef(e);n.current=e;const a=e.map(o=>o.accountId).join(",");u.useEffect(()=>{const o=Date.now(),i=Qt(n.current,o).filter(d=>!P.has(d));if(i.length!==0)for(const d of i)P.add(d),F(d,s).catch(m=>{A(d,m)})},[a,s]),u.useEffect(()=>{let o=Date.now(),r;const i=new Set,d=()=>{o=Date.now();const p=_t(n.current.map(l=>l.accountId),i);for(const l of p)i.add(l);Ot(p,l=>F(l,s).catch(h=>{A(l,h)}).finally(()=>{i.delete(l)}),{concurrency:Dt})},m=()=>{if(document.visibilityState==="visible"){d(),r=setTimeout(m,C());return}},c=()=>{if(document.visibilityState!=="visible")return;r!==void 0&&clearTimeout(r);const p=Date.now(),l=C(p);if(Kt(p,o,l)){d(),r=setTimeout(m,l);return}r=setTimeout(m,o+l-p)},x=()=>{document.visibilityState==="visible"&&(r!==void 0&&clearTimeout(r),o=Date.now(),r=setTimeout(m,C()))};r=setTimeout(m,C()),document.addEventListener("visibilitychange",c);const f=qe(x);return()=>{r!==void 0&&clearTimeout(r),document.removeEventListener("visibilitychange",c),f()}},[a,s])};function bs(){const e=Ce(),s=K(),n=lt(s),{openOverlay:a,intelligenceOpen:o,showOverlay:r,toggleIntelligence:i,raiseIntelligence:d}=Pt(),m=a==="shortcuts",c=a==="nav",{searchInput:x,committedQuery:f,viewKey:p,setSearchInput:l}=yt(),{data:h,isLoading:y,isError:g,error:b,refetch:S}=Ne({...Ie(),staleTime:1/0}),I=!!(h&&(h.accounts?.length??0)===0);u.useEffect(()=>{I&&e({to:"/onboarding",replace:!0})},[I,e]),ct({enabled:!m,bindings:[{key:"?",action:"help",handler:()=>r("shortcuts"),noModifiers:!1,preventDefault:!0}]});const E=R(),B=Qe(),H=M({select:w=>Pe(w.matches)?.list==="mailbox"}),V=u.useMemo(()=>({compose:E}),[E]);Ae({enabled:!H&&!B,handlers:V});const q=u.useCallback(()=>{l("")},[l]),$=u.useCallback(()=>{l("")},[l]),v=h?.accounts??[],G=u.useMemo(()=>v.map(w=>w.accountId),[v]),U=It(v),W=dt(v).index,Y=u.useMemo(()=>Fe(v),[v]);zt(v);const J=u.useCallback(()=>{a==="nav"&&r(void 0)},[a,r]),X={accounts:v,mailboxNameIndex:U,accountNameIndex:Y,resultFolderIndex:W,searchQuery:f,searchInput:x,searchViewKey:p,onSearchChange:l,onSearchClear:q,onSearchClearQuery:$,intelligenceOpen:o,onToggleIntelligence:i,onRaiseIntelligence:d},Z={isSinglePane:n,isLoading:y||I,intelligenceOpen:o,nav:t.jsx(et,{accounts:v,onMailboxSelect:J}),topBar:n?void 0:t.jsx(Ct,{accounts:v}),overlay:n?t.jsx(St,{}):void 0,navOpen:c,onOpenNav:()=>r("nav"),onCloseNav:()=>r(void 0)};return t.jsx(we.Provider,{value:X,children:t.jsxs(Ue,{accountIds:G,children:[g?t.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:t.jsx(it,{title:"Couldn't load your account",error:b,onRetry:()=>{S()}})}):t.jsx(ze,{chrome:Z,children:t.jsx(Me,{})}),t.jsx(Nt,{isOpen:m,onClose:()=>r(void 0)})]})})}export{bs as component,ae as useMailContext};
|
|
1
|
+
import{e as ee,r as u,j as t,t as D,v as te,f as N,w as se,x as M,y as O,z as ne,A as oe,C as ae,h as Q,D as re,E as ie,F as ce,G as le,H as ue,J as de,X as me,K as pe,a as he,b as fe,M as xe,N as ge,P as be,Q as ve,R as ye,S as Se,T as je,u as Ce,c as Ne,d as Ie,U as we,O as Me,V as Pe}from"./index-DDaQbjmr.js";import{S as Re,u as Ee,s as Oe,K as Te,b as ke,a as Le,c as Ae,d as Fe}from"./search-token-index-DfEguIzE.js";import{P as De}from"./pencil-C_GgIxQ0.js";import{u as R,a as Qe}from"./useMessageBodyContent-Azq1Bngf.js";import{c as Ke,s as _e,M as ze}from"./MailShell-C6XAYw9R.js";import{u as Be,a as He,R as Ve,s as qe,i as $e,H as Ge,M as Ue}from"./useRefreshControl-CQDCO_Sz.js";import{M as We}from"./menu-DziguOgy.js";import{B as Ye}from"./bug-Byoam9SI.js";import{L as Je,S as Xe,A as Ze,M as et}from"./MailNav-CDMm535x.js";import{A as tt}from"./avatar-BU2Acypp.js";import{u as st,P as nt,a as ot,b as at}from"./popover-menu-eOwDgIAD.js";import{u as rt}from"./sections-BE-YkTuC.js";import{E as it}from"./ErrorState-zb46wwqB.js";import{K as T}from"./kbd-nBPX_mdB.js";import{u as ct}from"./index-TtetXNmc.js";import{u as K,i as lt}from"./useLayoutTier-BnLysTvl.js";import{u as ut}from"./useQueries-D1STUKB_.js";import{u as dt}from"./useResultFolderIndex-TIwJLY0y.js";import{u as mt}from"./useDebouncedValue-Dy_g2v71.js";import"./search-scope-B5-OK3Cq.js";import"./FullCompose-CtKaGlct.js";import"./confirm-dialog-C4B2Czhl.js";import"./circle-check-big-CdWGb9Cq.js";import"./refresh-cw-mlDi8LTp.js";import"./roving-focus-D45YIEXp.js";import"./bell-off-BDdZq1id.js";import"./folder-failure-CqkVSsrb.js";import"./outbox-status-BlKn6P0x.js";import"./useSignature-DbI73u9N.js";import"./account-form-helpers-DhckT_PN.js";const pt=ee("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);function ht({email:e,onSignOut:s}){const n=u.useRef(null),{open:a,setOpen:o,containerRef:r,panelRef:i,getAnchor:d}=st("account-menu",()=>n.current?.focus());u.useEffect(()=>{if(!a)return;const c=requestAnimationFrame(()=>i.current?.querySelector('[role="menuitem"]')?.focus());return()=>cancelAnimationFrame(c)},[a,i]);const m=e??"Account";return t.jsxs("div",{ref:r,className:"relative",children:[t.jsx("button",{ref:n,type:"button","aria-label":"Account","aria-haspopup":"menu","aria-expanded":a,onClick:()=>o(c=>!c),className:"inline-flex min-h-11 min-w-11 items-center justify-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-raised hover:text-fg",children:t.jsx(tt,{name:m,email:e??void 0,size:"sm"})}),t.jsx(nt,{open:a,align:"end",panelRef:i,getAnchor:d,children:t.jsxs(ot,{ref:i,label:m,children:[e&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"truncate px-4 py-2 text-xs text-fg-muted",title:e,"data-testid":"account-menu-email",children:e}),t.jsx("hr",{className:"my-1 h-px border-0 bg-line"})]}),t.jsx(at,{label:"Sign out",icon:t.jsx(Je,{className:"size-4"}),onSelect:()=>{o(!1),n.current?.focus(),s()}})]})})]})}function ft({leading:e,search:s,actions:n,className:a}){return t.jsxs("header",{className:D("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",a),children:[e&&t.jsx("div",{className:"flex shrink-0 items-center gap-1",children:e}),t.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:t.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),n&&t.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n})]})}function xt({onCompose:e}){return t.jsx("button",{type:"button",onClick:e,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:t.jsx(De,{className:"size-6"})})}function gt(){const e=te();if(!e)return null;const s=e.showNavPane?!e.navCollapsed:!1;return t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(We,{className:"size-4"}),onClick:e.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const bt={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function vt({search:e,onCompose:s,onReportBug:n,onOpenSettings:a,composeShortcut:o,refreshControl:r,account:i}){return t.jsx(ft,{leading:t.jsx(gt,{}),search:t.jsx(Re,{value:e.value,onChange:e.onChange,onClear:e.onClear,onClearQuery:e.onClearQuery,chips:e.chips,onRemoveChip:e.onRemoveChip,placeholder:bt[e.scope]}),actions:t.jsxs(t.Fragment,{children:[t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(pt,{className:"size-4"}),title:o?`Compose (${o})`:"Compose","aria-label":"Compose",onClick:s}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(Ye,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:n}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(Xe,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:a}),r,i]})})}function yt(){const e=se(),s=M({select:c=>O(c.location.pathname)}),n=M({select:c=>ne(c.location.search)}),[a,o]=u.useState(n),r=mt(a,200),[i,d]=u.useState(s);if(i!==s){const c=_e(i,s,n);d(s),c!==void 0&&o(c)}const m=u.useCallback(c=>{d(O(e.state.location.pathname)),o(c)},[e]);return{searchInput:a,committedQuery:Ke(a,r),viewKey:s,setSearchInput:m}}const St=()=>{const e=R();return oe()?null:t.jsx(xt,{onCompose:e})},jt=()=>t.jsx(Ze,{children:({email:e,signOut:s})=>t.jsx(ht,{email:e,onSignOut:s})});function Ct({accounts:e}){const{searchInput:s,onSearchChange:n,onSearchClear:a,onSearchClearQuery:o,resultFolderIndex:r}=ae(),i=Q(),d=rt(),m=R(),{scope:c,clearScope:x}=Ee(e),f=c.kind==="scoped"?[{id:c.chip.id,label:c.chip.label,tone:"scope"}]:void 0,p=u.useMemo(()=>e.map(b=>b.accountId),[e]),{hasNewMail:l}=Be(),{state:h,errorMessage:y,refresh:g}=He(p,{onSettled:()=>ie(i,ce(r.keys()))});return t.jsx(vt,{search:{value:s,scope:c.kind,chips:f,onChange:n,onClear:a,onClearQuery:o,onRemoveChip:x},onCompose:m,onReportBug:re,onOpenSettings:()=>d("accounts"),composeShortcut:Oe("compose"),refreshControl:t.jsx(Ve,{state:h,onRefresh:g,label:"Refresh all accounts",errorMessage:y,hasUpdate:l(p)}),account:t.jsx(jt,{})})}const Nt=({isOpen:e,onClose:s})=>{const n=u.useRef(null);return le({id:"shortcuts",open:e,answers:{back:s}}),ue(n,e),e?t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[t.jsx(de,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),t.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",tabIndex:-1,className:D("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[t.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[t.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),t.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:t.jsx(me,{className:"size-5"})})]}),t.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:Te.map(a=>t.jsxs("div",{children:[t.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:a.title}),t.jsx("div",{className:"space-y-2",children:a.hints.map(o=>t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsx("span",{className:"text-sm",children:o.description}),t.jsx("span",{className:"flex shrink-0 items-center gap-1",children:o.keys.map((r,i)=>t.jsxs(u.Fragment,{children:[i>0&&o.keys[0]==="g"&&t.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),t.jsx(T,{children:r})]},r))})]},`${o.action}-${o.keys.join("+")}`))})]},a.title))}),t.jsx("div",{className:"mt-6 border-t border-line pt-4",children:t.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",t.jsx(T,{children:"Esc"})," to close"]})})]})]}):null};function It(e){const s=ut({queries:e.map(n=>({...pe({path:{accountId:n.accountId}}),staleTime:1/0}))});return u.useMemo(()=>ke(s.map(n=>n.data?.items??[])),[s])}const _="remit:intelligence-open";function wt(){try{return localStorage.getItem(_)!=="closed"}catch{return!0}}function Mt(e){try{localStorage.setItem(_,e?"open":"closed")}catch{}}function k({panels:e,prefersOpen:s,isDesktop:n,hasThread:a,raisedFor:o,openMessage:r}){return o!==null&&o===r?!0:e.length>0?e.includes("intelligence"):n&&a&&s}const Pt=()=>{const e=K(),s=he(),n=fe(),a=s.find(xe),o=Le(),[r,i]=u.useState(wt),d=o?`${o.threadId}/${o.messageId??""}`:null,[m,c]=u.useState(null),x={panels:s,prefersOpen:r,isDesktop:e==="desktop",hasThread:o!==void 0,openMessage:d},f=k({...x,raisedFor:m}),p=k({...x,raisedFor:null}),l=u.useCallback((b,S)=>{n([...b?["intelligence"]:[],...S?[S]:[]])},[n]),h=u.useCallback(b=>{l(p,b)},[p,l]),y=u.useCallback(()=>{if(f&&!p){c(null);return}const b=!f;Mt(b),i(b),c(null),l(b,a)},[p,f,a,l]),g=u.useCallback(()=>{c(d)},[d]);return{openOverlay:a,intelligenceOpen:f,showOverlay:h,toggleIntelligence:y,raiseIntelligence:g}};var j={exports:{}},L;function Rt(){if(L)return j.exports;L=1;const e=(s,n,a)=>new Promise((o,r)=>{if(a=Object.assign({concurrency:1/0},a),typeof n!="function")throw new TypeError("Mapper function is required");const{concurrency:i}=a;if(!(typeof i=="number"&&i>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${i}\` (${typeof i})`);const d=[],m=s[Symbol.iterator]();let c=!1,x=!1,f=0,p=0;const l=()=>{if(c)return;const h=m.next(),y=p;if(p++,h.done){x=!0,f===0&&o(d);return}f++,Promise.resolve(h.value).then(g=>n(g,y)).then(g=>{d[y]=g,f--,l()},g=>{c=!0,r(g)})};for(let h=0;h<i&&(l(),!x);h++);});return j.exports=e,j.exports.default=e,j.exports}var Et=Rt();const Ot=ge(Et),Tt=900*1e3,kt=30,Lt=(e,s)=>{if(!e)return s;const n=Number.parseInt(e,10);return Number.isFinite(n)&&n>0?n:s},At=30*1e3,Ft=e=>Math.max(Lt(e,kt)*1e3,At),z=Ft(je().mailboxPollIntervalSeconds),C=(e=Date.now(),s=z)=>$e(e)?Math.min(Ge,s):s,Dt=5,P=new Set,Qt=(e,s,n=Tt)=>e.filter(a=>{const o=a.lastSyncAt;return o==null?!0:s-o>n}).map(a=>a.accountId),Kt=(e,s,n=z)=>e-s>=n,_t=(e,s)=>e.filter(n=>!s.has(n)),A=(e,s)=>{if(P.delete(e),ye(s,{softError:!0},"nobody")){Se(s);return}console.warn("[remit] background mailbox sync failed",{accountId:e,error:s})},F=(e,s)=>be({path:{accountId:e},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:ve({path:{accountId:e}})})}),zt=e=>{const s=Q(),n=u.useRef(e);n.current=e;const a=e.map(o=>o.accountId).join(",");u.useEffect(()=>{const o=Date.now(),i=Qt(n.current,o).filter(d=>!P.has(d));if(i.length!==0)for(const d of i)P.add(d),F(d,s).catch(m=>{A(d,m)})},[a,s]),u.useEffect(()=>{let o=Date.now(),r;const i=new Set,d=()=>{o=Date.now();const p=_t(n.current.map(l=>l.accountId),i);for(const l of p)i.add(l);Ot(p,l=>F(l,s).catch(h=>{A(l,h)}).finally(()=>{i.delete(l)}),{concurrency:Dt})},m=()=>{if(document.visibilityState==="visible"){d(),r=setTimeout(m,C());return}},c=()=>{if(document.visibilityState!=="visible")return;r!==void 0&&clearTimeout(r);const p=Date.now(),l=C(p);if(Kt(p,o,l)){d(),r=setTimeout(m,l);return}r=setTimeout(m,o+l-p)},x=()=>{document.visibilityState==="visible"&&(r!==void 0&&clearTimeout(r),o=Date.now(),r=setTimeout(m,C()))};r=setTimeout(m,C()),document.addEventListener("visibilitychange",c);const f=qe(x);return()=>{r!==void 0&&clearTimeout(r),document.removeEventListener("visibilitychange",c),f()}},[a,s])};function bs(){const e=Ce(),s=K(),n=lt(s),{openOverlay:a,intelligenceOpen:o,showOverlay:r,toggleIntelligence:i,raiseIntelligence:d}=Pt(),m=a==="shortcuts",c=a==="nav",{searchInput:x,committedQuery:f,viewKey:p,setSearchInput:l}=yt(),{data:h,isLoading:y,isError:g,error:b,refetch:S}=Ne({...Ie(),staleTime:1/0}),I=!!(h&&(h.accounts?.length??0)===0);u.useEffect(()=>{I&&e({to:"/onboarding",replace:!0})},[I,e]),ct({enabled:!m,bindings:[{key:"?",action:"help",handler:()=>r("shortcuts"),noModifiers:!1,preventDefault:!0}]});const E=R(),B=Qe(),H=M({select:w=>Pe(w.matches)?.list==="mailbox"}),V=u.useMemo(()=>({compose:E}),[E]);Ae({enabled:!H&&!B,handlers:V});const q=u.useCallback(()=>{l("")},[l]),$=u.useCallback(()=>{l("")},[l]),v=h?.accounts??[],G=u.useMemo(()=>v.map(w=>w.accountId),[v]),U=It(v),W=dt(v).index,Y=u.useMemo(()=>Fe(v),[v]);zt(v);const J=u.useCallback(()=>{a==="nav"&&r(void 0)},[a,r]),X={accounts:v,mailboxNameIndex:U,accountNameIndex:Y,resultFolderIndex:W,searchQuery:f,searchInput:x,searchViewKey:p,onSearchChange:l,onSearchClear:q,onSearchClearQuery:$,intelligenceOpen:o,onToggleIntelligence:i,onRaiseIntelligence:d},Z={isSinglePane:n,isLoading:y||I,intelligenceOpen:o,nav:t.jsx(et,{accounts:v,onMailboxSelect:J}),topBar:n?void 0:t.jsx(Ct,{accounts:v}),overlay:n?t.jsx(St,{}):void 0,navOpen:c,onOpenNav:()=>r("nav"),onCloseNav:()=>r(void 0)};return t.jsx(we.Provider,{value:X,children:t.jsxs(Ue,{accountIds:G,children:[g?t.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:t.jsx(it,{title:"Couldn't load your account",error:b,onRetry:()=>{S()}})}):t.jsx(ze,{chrome:Z,children:t.jsx(Me,{})}),t.jsx(Nt,{isOpen:m,onClose:()=>r(void 0)})]})})}export{bs as component,ae as useMailContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./index-
|
|
1
|
+
import{e}from"./index-DDaQbjmr.js";const a=e("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);export{a as M};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as c}from"./index-DDaQbjmr.js";const a=c("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const r=c("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);export{a as G,r as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./index-
|
|
1
|
+
import{e}from"./index-DDaQbjmr.js";const n=e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);export{n as M};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e}from"./index-DDaQbjmr.js";const a=e("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);export{a as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as c}from"./index-
|
|
1
|
+
import{r as i,j as c}from"./index-DDaQbjmr.js";import{e as y,u as g,C as E,c as b}from"./CalendarComposePane-CaFfehJ3.js";import{u as x}from"./CalendarComposeSeed-Qwwu-xz8.js";import{u as I,f as T,U as k,d as w}from"./useCalendars-NXobBPn1.js";import{a as N}from"./useCalendarWrites-CcZJoofA.js";import{u as S,n as j}from"./calendar-format-t5pknBPH.js";import"./calendar-clash-strip-CuPoAcuA.js";import"./ErrorState-zb46wwqB.js";import"./useQueries-D1STUKB_.js";function A({onClose:n}){const{date:m}=S(),a=x(),{calendars:u,timeZoneByCalendarId:f}=I(),d=u.filter(e=>!e.readOnly),{createEvent:p,isWriting:C}=N(),[D,r]=i.useState(""),[t,l]=i.useState(()=>{const e=y(a?.date??m,"");return a?{...e,allDay:a.allDay,startTime:a.allDay?"":a.startTime,endDate:a.endDate,endTime:a.allDay?"":a.endTime}:e}),h=g(t),s=d[0]?.id??"";i.useEffect(()=>{s!==""&&l(e=>e.calendarId===""?{...e,calendarId:s}:e)},[s]);const v=()=>{const e=b(t,{clock:w(),anchor:T(f[t.calendarId]??k)});if(!e.ok){r(e.problem);return}p(e.input).then(o=>{if(o.kind==="written"){r(""),n();return}r(o.kind==="conflict"?"This calendar changed while you were writing. Close the form and try again.":o.message)})};return c.jsx(E,{title:"New event",subtitle:t.date,calendars:d,draft:t,onChange:l,problem:D,saveLabel:"Add",isSaving:C,clashes:h,onSave:v,onCancel:n})}function _(){const{closeEvent:n}=j();return c.jsx(A,{onClose:n})}export{_ as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{q as i,h as n,u as a,r as m,j as s}from"./index-DDaQbjmr.js";import{O as p}from"./OnboardingWizard-D15SDpIN.js";import{c}from"./onboarding-completion-Bvjs_wV7.js";import"./checkbox-nuTXvB_z.js";import"./minus-RD6yC1uS.js";import"./kbd-nBPX_mdB.js";import"./credential-steps-BMJ8NHk-.js";import"./card-BU0ZWUHk.js";import"./account-form-helpers-DhckT_PN.js";import"./mail-xh-X6l34.js";import"./file-json-Dgau07u1.js";function E(){const o=i(),t=n(),e=a(),r=m.useCallback(l=>{c({queryClient:t,recordCompleted:()=>o.recordEvent("onboarding.completed"),navigateToInbox:()=>{window.location.assign("/mail")}})},[o,t]);return s.jsx(p,{skipWelcome:!1,onComplete:r,onImportConfig:()=>{e({to:"/import"})}})}export{E as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o}from"./index-
|
|
1
|
+
import{o}from"./index-DDaQbjmr.js";async function n(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:o()}),e.navigateToInbox()}export{n as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o,O as i}from"./index-DDaQbjmr.js";import{a as m}from"./MailShell-C6XAYw9R.js";import{u as p,O as t}from"./OutboxPane-k7EI73dP.js";import{u as s}from"./search-mirror-IklPpsgd.js";import"./FullCompose-CtKaGlct.js";import"./ErrorState-zb46wwqB.js";import"./index-TtetXNmc.js";import"./useMessageBodyContent-Azq1Bngf.js";import"./useSignature-DbI73u9N.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-Dy_g2v71.js";import"./sections-BE-YkTuC.js";import"./confirm-dialog-C4B2Czhl.js";import"./roving-focus-D45YIEXp.js";import"./useSearchTokenContext-DjY64Paa.js";import"./kbd-nBPX_mdB.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-CdWGb9Cq.js";import"./clock-qn7JbMhU.js";import"./row-actions-Bz2BO_Of.js";import"./rotate-ccw-B_znez6Z.js";import"./pane-header-BKR2Qgp4.js";import"./NavMenuButton-C7p7FLnh.js";import"./menu-DziguOgy.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function w(){const r=p();return s({to:"/mail/outbox"}),o.jsx(t,{outboxMessageId:r,children:o.jsx(m,{phone:o.jsx(t.Phone,{}),list:o.jsx(t.List,{}),reading:o.jsx(i,{})})})}export{w as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,t as a}from"./index-
|
|
1
|
+
import{j as r,t as a}from"./index-DDaQbjmr.js";function o({title:e,leading:s,children:n,className:t}){return r.jsxs("header",{className:a("flex h-pane-header shrink-0 items-center gap-2 border-b border-line px-row-inset",t),children:[s,e!==void 0&&r.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-fg",children:e}),n]})}export{o as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a}from"./index-
|
|
1
|
+
import{e as a}from"./index-DDaQbjmr.js";const c=a("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);export{c as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as y,r as f,G as E,bY as P,j as a,t as b,f as R}from"./index-
|
|
1
|
+
import{e as y,r as f,G as E,bY as P,j as a,t as b,f as R}from"./index-DDaQbjmr.js";const j=y("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),g=4,v=8;function k(e,t,n){const o=Math.max(v,window.innerWidth-t.width-v),r=n==="end"?e.right-t.width:e.left,s=Math.min(Math.max(r,v),o),c=e.bottom+g,i=e.top-g-t.height,d=c+t.height<=window.innerHeight-v||i<v?c:i;return{left:s,top:d}}function L(e,t,n,o){const[r,s]=f.useState(null),c=f.useRef(o);return c.current=o,f.useLayoutEffect(()=>{if(!t){s(null);return}const i=()=>{const x=e.current,h=c.current();if(!x||!h)return;const m=x.getBoundingClientRect(),w={width:m.right-m.left,height:m.bottom-m.top},p=k(h,w,n);s(l=>l?.left===p.left&&l.top===p.top?l:{position:"fixed",left:p.left,top:p.top})};i(),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0);const u=e.current;let d=null;return u&&typeof ResizeObserver<"u"&&(d=new ResizeObserver(i),d.observe(u)),()=>{d?.disconnect(),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[t,n,e]),r}function z(e,t){const[n,o]=f.useState(!1),r=f.useRef(null),s=f.useRef(null);return E({id:e,open:n,answers:{back:()=>{o(!1),t?.()}}}),f.useEffect(()=>{if(!n)return;const c=i=>{const u=i.target;r.current?.contains(u)||s.current?.contains(u)||o(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]),{open:n,setOpen:o,containerRef:r,panelRef:s,getAnchor:()=>r.current?.getBoundingClientRect()??null}}function M({open:e,align:t="start",getAnchor:n,panelRef:o,children:r}){const s=L(o,e,t,n);return e?P.createPortal(a.jsx("div",{className:"z-50",style:s??{position:"fixed",visibility:"hidden"},children:r}),document.body):null}function N({label:e,children:t,className:n,ref:o,onKeyDown:r,"data-testid":s}){return a.jsx("div",{ref:o,role:"menu","aria-label":e,tabIndex:-1,onKeyDown:r,"data-testid":s,className:b("z-50 flex max-h-[60dvh] min-w-44 flex-col overflow-y-auto overscroll-contain rounded-md border border-line bg-surface py-1 shadow-lg outline-none",n),children:t})}function O({label:e,icon:t,onSelect:n,className:o,lang:r,"data-testid":s}){return a.jsxs("button",{type:"button",role:"menuitem",lang:r,onClick:n,"data-testid":s,className:b("flex min-h-11 items-center gap-3 px-4 py-2.5 text-left text-sm text-fg transition-colors hover:bg-surface-sunken",o),children:[t&&a.jsx("span",{className:"shrink-0 text-fg-subtle",children:t}),e]})}function A({triggerLabel:e,triggerIcon:t,triggerText:n,items:o,align:r="end",touch:s=!0,className:c,triggerClassName:i,nested:u=!1,children:d}){const{open:x,setOpen:h,containerRef:m,panelRef:w,getAnchor:p}=z("popover-menu");return o.length===0&&!d?null:a.jsxs("div",{ref:m,className:b("relative",c),...u?{role:"none"}:{},children:[a.jsx(R,{variant:"ghost",size:"sm",icon:t??a.jsx(j,{className:"size-5"}),onClick:()=>h(l=>!l),"aria-label":e,"aria-haspopup":"menu","aria-expanded":x,...u?{role:"menuitem"}:{},className:b(s&&"min-h-11 min-w-11 px-0",i),children:n}),a.jsx(M,{open:x,align:r,panelRef:w,getAnchor:p,children:a.jsxs(N,{ref:w,children:[o.map(l=>a.jsx(O,{label:l.label,icon:l.icon,onSelect:()=>{h(!1),l.onSelect()}},l.key)),d]})})]})}export{j as E,M as P,N as a,O as b,A as c,z as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./index-
|
|
1
|
+
import{e}from"./index-DDaQbjmr.js";const t=e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);export{t as R};
|