@remit/web-client-dist 0.0.439 → 0.0.440

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/assets/{BriefPane-SfYhO-Gb.js → BriefPane-BMrKQ8ND.js} +1 -1
  2. package/assets/{ErrorState-BhwzcNoy.js → ErrorState-C6npTXjw.js} +1 -1
  3. package/assets/{FlaggedPane-BFyHzoXM.js → FlaggedPane-24EWFMPk.js} +1 -1
  4. package/assets/{FullCompose-D4K57d-g.js → FullCompose-CKOPv_qc.js} +1 -1
  5. package/assets/{MailListHeader-B7H7sbSy.js → MailListHeader-C3tApRDT.js} +1 -1
  6. package/assets/{MailShell-CxB5XVdv.js → MailShell-Bd1kL-Up.js} +1 -1
  7. package/assets/{MailViewChrome-CRnL8rAG.js → MailViewChrome-BSU2HWLP.js} +1 -1
  8. package/assets/{MailboxPane-BXdCpcsJ.js → MailboxPane-CN1sGDNp.js} +1 -1
  9. package/assets/{NavMenuButton-tGv_skVB.js → NavMenuButton-BBv_d9qJ.js} +1 -1
  10. package/assets/OnboardingWizard-XOalGtp8.js +1 -0
  11. package/assets/{OutboxPane-QWM3f8r8.js → OutboxPane-DtKFhs0V.js} +1 -1
  12. package/assets/_mailboxId-CA0c5KsJ.js +1 -0
  13. package/assets/_messageId-BvnxQpI7.js +1 -0
  14. package/assets/_messageId-Gs2O5Gtq.js +1 -0
  15. package/assets/_messageId-_ioa_r-S.js +1 -0
  16. package/assets/_outboxMessageId-Beax-yai.js +1 -0
  17. package/assets/_threadId-CHmlN1qB.js +1 -0
  18. package/assets/_threadId-NIfsEl-M.js +1 -0
  19. package/assets/_threadId-WNoEjiEi.js +1 -0
  20. package/assets/accounts-CHBvmLqZ.js +1 -0
  21. package/assets/{advanced-DcF47Tep.js → advanced-DdsZgbDn.js} +1 -1
  22. package/assets/{appearance-CiAhcwAC.js → appearance-C26HlkY8.js} +1 -1
  23. package/assets/{attachment-file-Dg-oILwD.js → attachment-file-DUjPCn-b.js} +1 -1
  24. package/assets/{avatar-B5_004W1.js → avatar-CG2aRAmH.js} +1 -1
  25. package/assets/{bottom-sheet-Dxkzq8Fq.js → bottom-sheet-DLFNdGop.js} +1 -1
  26. package/assets/{brief-BlhyX0Bw.js → brief-BS5B3XqZ.js} +1 -1
  27. package/assets/brief-Njezehox.js +1 -0
  28. package/assets/{browser-ponyfill-GcGIevGl.js → browser-ponyfill-Bb6GFKd9.js} +1 -1
  29. package/assets/{bug-Bqi2ib3I.js → bug-Ct11KdBV.js} +1 -1
  30. package/assets/{circle-check-D8DOlaN1.js → circle-check-7FfmmUK5.js} +1 -1
  31. package/assets/{circle-check-big-CTPrzCxI.js → circle-check-big-BA1xfQ4O.js} +1 -1
  32. package/assets/{circle-help-BaKDOnAa.js → circle-help-zW6vVnfY.js} +1 -1
  33. package/assets/{clock-CxxCvGqs.js → clock-Bg0F1_jO.js} +1 -1
  34. package/assets/compose._-_outboxMessageId_-B01DAxms.js +1 -0
  35. package/assets/compose._-_outboxMessageId_-BWKTae8s.js +1 -0
  36. package/assets/compose._-_outboxMessageId_-BaZJ8bcv.js +1 -0
  37. package/assets/compose._-_outboxMessageId_-CzCbTavE.js +1 -0
  38. package/assets/{confirm-dialog-oDtiUrui.js → confirm-dialog-BH7Kc4v5.js} +1 -1
  39. package/assets/{download-C8x6cJaZ.js → download-Cc9-gBGy.js} +1 -1
  40. package/assets/{filters-bjUOxdfI.js → filters-B0bQ2xWw.js} +1 -1
  41. package/assets/flagged-CsM-75i9.js +1 -0
  42. package/assets/{flagged-ja0ObKJO.js → flagged-DeD-nmCP.js} +1 -1
  43. package/assets/{folders-DCAiIZf3.js → folders-D_BunyuV.js} +1 -1
  44. package/assets/{help-copy-DPbzMGGg.js → help-copy-s8qWf3np.js} +1 -1
  45. package/assets/{index-CKl3LWp1.js → index-ARKuDM1Z.js} +15 -15
  46. package/assets/index-BvnxQpI7.js +1 -0
  47. package/assets/index-C-yhD427.js +1 -0
  48. package/assets/{index-BMB-ZCLn.js → index-CGKUKLu6.js} +3 -3
  49. package/assets/index-CI1X_J3H.js +1 -0
  50. package/assets/index-D6zm3sAP.js +1 -0
  51. package/assets/index-DUPbI4oM.js +1 -0
  52. package/assets/index-Gs2O5Gtq.js +1 -0
  53. package/assets/index-m-VZuJol.js +1 -0
  54. package/assets/index-nUJFTYpS.js +1 -0
  55. package/assets/{kbd-O3V-B_3F.js → kbd-CAJ-SREr.js} +1 -1
  56. package/assets/{labels-B9lc0Vho.js → labels-B5T2l9-A.js} +1 -1
  57. package/assets/{mail-D2L43a1R.js → mail-CISpSeKy.js} +1 -1
  58. package/assets/{mail-DGAASK-j.js → mail-wi6czXl8.js} +1 -1
  59. package/assets/{menu-DIOQLP64.js → menu-DMsGK9e8.js} +1 -1
  60. package/assets/{onboarding-DPtSjKLX.js → onboarding-DvcWbdM0.js} +1 -1
  61. package/assets/outbox-Bsg5S_bU.js +1 -0
  62. package/assets/{pencil-DYHpUKoM.js → pencil-nJp7AV15.js} +1 -1
  63. package/assets/{rich-text-BD4sX8zA.js → rich-text-BuVeHvbX.js} +1 -1
  64. package/assets/{rich-text-spellcheck-worker-provider-DZleI6WS.js → rich-text-spellcheck-worker-provider-DdkfW5uW.js} +1 -1
  65. package/assets/{rotate-ccw-BTx02-lq.js → rotate-ccw-BAbqhDs-.js} +1 -1
  66. package/assets/{row-actions-CN1bqfP7.js → row-actions-oMrNzr_M.js} +1 -1
  67. package/assets/{search-mirror-Dp9s5qVV.js → search-mirror-C2okHgQR.js} +1 -1
  68. package/assets/{search-token-index-H-rvjCDG.js → search-token-index-B8zgeaqe.js} +1 -1
  69. package/assets/{senders-C0EL_TGe.js → senders-eXpLThrk.js} +1 -1
  70. package/assets/settings-VoacqcaU.js +1 -0
  71. package/assets/{settings-screen-DXV1BkEv.js → settings-screen-DvJe3EZk.js} +1 -1
  72. package/assets/{shield-check-B2lqr10A.js → shield-check-BlvoNOLt.js} +1 -1
  73. package/assets/{suggested-vips-CxMaml9U.js → suggested-vips-CKMmSeY8.js} +1 -1
  74. package/assets/{useDebouncedValue-CTaUBQHS.js → useDebouncedValue-DRP8Ll3V.js} +1 -1
  75. package/assets/{useFilters-wK_ME6Hd.js → useFilters-BEch6wEY.js} +1 -1
  76. package/assets/{useLabels-lVDJ4sa7.js → useLabels-C2ilUjRI.js} +1 -1
  77. package/assets/{useMessageBodyContent-dJBG7Uxx.js → useMessageBodyContent-B6r0Xy1W.js} +1 -1
  78. package/assets/{useRefreshControl-Dogo-wLl.js → useRefreshControl-C4qz95RS.js} +1 -1
  79. package/assets/{useSearchTokenContext-BVuBHShb.js → useSearchTokenContext-DeUV80u1.js} +1 -1
  80. package/assets/{useSemanticSearch-DPnKe9aZ.js → useSemanticSearch-QykvYO5y.js} +1 -1
  81. package/assets/{useSignature-BIM1_tcj.js → useSignature-B2LbrkV9.js} +1 -1
  82. package/index.html +1 -1
  83. package/package.json +1 -1
  84. package/assets/OnboardingWizard-CK5CYAnq.js +0 -1
  85. package/assets/_mailboxId-iiVY_EFj.js +0 -1
  86. package/assets/_messageId-B22oJ5Ad.js +0 -1
  87. package/assets/_messageId-DTlm7bCj.js +0 -1
  88. package/assets/_messageId-WbQofgNx.js +0 -1
  89. package/assets/_outboxMessageId-CyZRcap4.js +0 -1
  90. package/assets/_threadId-Bac_YU39.js +0 -1
  91. package/assets/_threadId-Bbcg_x7F.js +0 -1
  92. package/assets/_threadId-LPxlQINd.js +0 -1
  93. package/assets/accounts-Cm-EFoju.js +0 -1
  94. package/assets/brief-C41uTRuH.js +0 -1
  95. package/assets/compose._-_outboxMessageId_-BhUDWhBB.js +0 -1
  96. package/assets/compose._-_outboxMessageId_-DpBFTxLX.js +0 -1
  97. package/assets/compose._-_outboxMessageId_-ONWFOEm8.js +0 -1
  98. package/assets/compose._-_outboxMessageId_-wGmWI5fd.js +0 -1
  99. package/assets/flagged-B1aDdb91.js +0 -1
  100. package/assets/index-7leVpMP5.js +0 -1
  101. package/assets/index-B22oJ5Ad.js +0 -1
  102. package/assets/index-BShdsPGH.js +0 -1
  103. package/assets/index-BjNZ9TUs.js +0 -1
  104. package/assets/index-CqAHEVDl.js +0 -1
  105. package/assets/index-DTlm7bCj.js +0 -1
  106. package/assets/index-DX6qyhCH.js +0 -1
  107. package/assets/index-Dc8GrwXM.js +0 -1
  108. package/assets/outbox-Xk3Rmhqy.js +0 -1
  109. package/assets/settings-tZIky-Jr.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-ARKuDM1Z.js";import{B as o}from"./BriefPane-BMrKQ8ND.js";import"./useSearchTokenContext-DeUV80u1.js";import"./kbd-CAJ-SREr.js";import"./useMessageBodyContent-B6r0Xy1W.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-C3tApRDT.js";import"./search-token-index-B8zgeaqe.js";import"./attachment-file-DUjPCn-b.js";import"./mail-wi6czXl8.js";import"./avatar-CG2aRAmH.js";import"./index-CGKUKLu6.js";import"./useSignature-B2LbrkV9.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DRP8Ll3V.js";import"./ErrorState-C6npTXjw.js";import"./format-23Av07Go.js";import"./download-Cc9-gBGy.js";import"./shield-check-BlvoNOLt.js";import"./useFilters-BEch6wEY.js";import"./confirm-dialog-BH7Kc4v5.js";import"./clock-Bg0F1_jO.js";import"./menu-DMsGK9e8.js";import"./useRefreshControl-C4qz95RS.js";import"./circle-check-big-BA1xfQ4O.js";import"./useLabels-C2ilUjRI.js";import"./useSemanticSearch-QykvYO5y.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function A(){return r.jsx(o.Reading,{})}export{A as component};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-ARKuDM1Z.js";import{B as o}from"./BriefPane-BMrKQ8ND.js";import"./useSearchTokenContext-DeUV80u1.js";import"./kbd-CAJ-SREr.js";import"./useMessageBodyContent-B6r0Xy1W.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-C3tApRDT.js";import"./search-token-index-B8zgeaqe.js";import"./attachment-file-DUjPCn-b.js";import"./mail-wi6czXl8.js";import"./avatar-CG2aRAmH.js";import"./index-CGKUKLu6.js";import"./useSignature-B2LbrkV9.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DRP8Ll3V.js";import"./ErrorState-C6npTXjw.js";import"./format-23Av07Go.js";import"./download-Cc9-gBGy.js";import"./shield-check-BlvoNOLt.js";import"./useFilters-BEch6wEY.js";import"./confirm-dialog-BH7Kc4v5.js";import"./clock-Bg0F1_jO.js";import"./menu-DMsGK9e8.js";import"./useRefreshControl-C4qz95RS.js";import"./circle-check-big-BA1xfQ4O.js";import"./useLabels-C2ilUjRI.js";import"./useSemanticSearch-QykvYO5y.js";import"./search-query-Cr_ZXBCp.js";import"./wizard-selection-B1bng5Jq.js";function C(){return r.jsx(o.Reading,{})}export{C 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-DZleI6WS.js","assets/index-CKl3LWp1.js","assets/index-OWhz0EKb.css","assets/rich-text-spellcheck-provider-J8m9wz6A.js","assets/rich-text-BD4sX8zA.js","assets/confirm-dialog-oDtiUrui.js","assets/bottom-sheet-Dxkzq8Fq.js","assets/attachment-file-Dg-oILwD.js","assets/useMessageBodyContent-dJBG7Uxx.js","assets/useSignature-BIM1_tcj.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-CTaUBQHS.js"])))=>i.map(i=>d[i]);
2
- import{j as m,X as Rr,b as Dr,B as nn,ar as Tr,f as Ar,T as Or,r as s,cp as Nr,cq as kr,C as Pn,af as Pr,cr as Ir,d as Lr,cs as Mr,ct as Qt,bE as In,cu as be,cv as Ln,cw as _r,a0 as Mn,x as jr,aj as yt,cx as bt,cy as Fr,cz as $r,E as Br,D as Et,by as Hr,cA as _n,aR as Wr,aS as Ur,a1 as jn,cB as Vr,ah as zr,cC as qr,cD as rn,cE as Kr,bK as kt,cF as Yr,ak as Gr,bD as Xr,ai as Qr,cG as Zr,b3 as Jr,cH as eo,ag as C}from"./index-CKl3LWp1.js";import{d as to}from"./useMessageBodyContent-dJBG7Uxx.js";import{u as no}from"./useSignature-BIM1_tcj.js";import{b as ro}from"./account-form-helpers-DhckT_PN.js";import{u as oo}from"./useDebouncedValue-CTaUBQHS.js";const ao=({email:e,displayName:t,onRemove:n,className:r})=>m.jsxs("span",{className:Dr("inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-accent-2-soft text-sm max-w-[200px]",r),children:[m.jsx("span",{className:"truncate",children:t||e}),m.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:m.jsx(Rr,{className:"size-3"})})]}),so=({save:e})=>e.status==="saving"?m.jsx("output",{className:"animate-pulse text-xs text-fg-muted",children:"Saving..."}):e.status==="saved"?m.jsx("output",{className:"text-xs text-fg-muted",children:"Draft saved"}):e.status==="error"?m.jsx("output",{className:"text-xs text-danger",children:"Save failed"}):e.status==="unsaved"?m.jsx("output",{className:"truncate text-xs text-warning",children:e.reason}):null;function io({send:e,onSend:t,onBlocked:n,onDiscard:r,save:o={status:"idle"}}){const a=e.status==="sending",i=e.status==="blocked"?e.reason:void 0;return m.jsxs("div",{className:"flex items-center justify-between border-t border-line px-3 py-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[m.jsx(nn,{variant:"primary",size:"md","aria-busy":a,title:i,className:"min-h-11 shrink-0 rounded-full px-4","data-testid":"compose-send",icon:a?m.jsx(Tr,{className:"size-4 animate-spin"}):m.jsx(Ar,{className:"size-4"}),onClick:()=>{if(!a){if(i!==void 0){n(i);return}t()}},children:"Send"}),m.jsx(so,{save:o})]}),m.jsx(nn,{variant:"ghost",size:"md","aria-busy":a,"aria-label":"Discard",className:"min-h-11 min-w-11 px-2 hover:text-danger",icon:m.jsx(Or,{className:"size-4"}),onClick:()=>{a||r()}})]})}const on=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),co=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(on(o))return{email:o,displayName:r}}if(on(t))return{email:t}},uo=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},lo=e=>{const t=[],n=[];for(const r of uo(e)){const o=co(r);if(o){t.push(o);continue}r.trim()&&n.push(r.trim())}return{entries:t,unparsed:n.join(", ")}},fo=["Tab",","],mo=150,po=({label:e,addresses:t,onChange:n,placeholder:r,suggestions:o=[],onQueryChange:a,onPendingChange:i,ref:c})=>{const[p,f]=s.useState(""),l=s.useRef(null),u=s.useMemo(()=>lo(p),[p]);s.useEffect(()=>{i?.(u)},[u,i]);const h=s.useRef(void 0),w=s.useCallback(()=>{h.current!==void 0&&(clearTimeout(h.current),h.current=void 0)},[]);s.useEffect(()=>w,[w]);const x=new Set(t.map(y=>y.email.toLowerCase())),d=p.length>=2?o.filter(y=>!x.has(y.email.toLowerCase())):[],E=s.useCallback(y=>{f(y),a?.(y)},[a]),b=s.useCallback(y=>{w(),!x.has(y.email.toLowerCase())&&(n([...t,y]),E(""))},[t,x,n,E,w]),D=s.useCallback(y=>{n(t.filter((_,R)=>R!==y))},[t,n]),g=s.useCallback(y=>{b(y),l.current?.focus()},[b]),v=s.useCallback(()=>{if(w(),u.entries.length===0)return{addresses:t,unparsed:u.unparsed};const y=new Set(x),_=[...t];for(const R of u.entries){const W=R.email.toLowerCase();y.has(W)||(y.add(W),_.push(R))}return n(_),E(u.unparsed),{addresses:_,unparsed:u.unparsed}},[u,t,x,n,E,w]),T=s.useCallback(()=>{w(),E("")},[E,w]);s.useImperativeHandle(c,()=>({commitPending:v,clearPending:T}),[v,T]);const M=s.useRef(v);s.useEffect(()=>{M.current=v},[v]);const S=Nr({count:d.length,acceptKeys:fo,onAccept:y=>g(d[y])}),N=s.useMemo(()=>d.map(y=>({value:y.email,label:y.displayName??y.email,...y.displayName?{hint:y.email}:{}})),[d]),k=s.useCallback(y=>{if(y.key==="Backspace"&&p===""&&t.length>0){D(t.length-1);return}S.handleKeyDown(y)||(y.key==="Enter"||y.key==="Tab"||y.key===",")&&p.trim()&&(y.preventDefault(),v())},[p,t.length,D,S.handleKeyDown,v]),j=s.useCallback(()=>{w(),h.current=setTimeout(()=>{h.current=void 0,M.current(),S.dismiss()},mo)},[w,S.dismiss]);return m.jsxs("div",{className:"relative","data-address-field":e,children:[m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsxs("label",{htmlFor:`address-field-${e}`,className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:[e,":"]}),m.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:()=>l.current?.focus(),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&l.current?.focus()},children:[t.map((y,_)=>m.jsx(ao,{email:y.email,displayName:y.displayName,onRemove:()=>D(_)},y.email)),m.jsx("input",{ref:l,id:`address-field-${e}`,type:"text",value:p,onChange:y=>{S.reopen(),E(y.target.value)},onKeyDown:k,onBlur:j,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&&m.jsx(kr,{id:S.listId,suggestions:N,activeIndex:S.activeIndex,optionId:S.optionId,onPick:y=>{const _=d.find(R=>R.email===y.value);_&&g(_)},onHighlight:S.setActiveIndex,label:`${e} suggestions`,className:"absolute left-12 right-0 z-50 mt-1 max-h-[200px] shadow-lg"})]})},ho=()=>m.jsxs("div",{"aria-hidden":"true","data-testid":"compose-body-skeleton",className:"min-h-[120px] px-3 py-2",children:[m.jsx("div",{className:"mb-2 h-8 animate-pulse rounded bg-surface-sunken"}),m.jsx("div",{className:"min-h-[80px] animate-pulse rounded bg-surface-sunken/50"})]});function vo({banner:e,header:t,children:n,quoted:r,actionBar:o,layout:a="fill"}){const i=a==="fill";return m.jsxs("div",{className:i?"flex h-full min-h-0 flex-col":"flex flex-col",children:[e,t,m.jsxs("div",{className:i?"flex min-h-0 flex-1 flex-col overflow-auto":"flex flex-col","data-testid":"compose-body-area",children:[n,r&&m.jsx("div",{className:"shrink-0 px-3 pb-2",children:r})]}),i?o:m.jsx("div",{className:"sticky bottom-0 z-10 bg-canvas",children:o})]})}const Pt=({label:e,onClick:t})=>m.jsx("button",{type:"button",onClick:t,className:"text-xs text-fg-muted hover:text-fg transition-colors",children:e}),go=({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(" · ")},wo=({collapsed:e=!1,summary:t="",onExpand:n,from:r,to:o,cc:a,bcc:i,subject:c,onShowCc:p,onShowBcc:f})=>e?m.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:[m.jsx("span",{className:"truncate text-xs text-fg-muted",children:t||"…"}),m.jsx(Pn,{className:"ml-auto size-4 shrink-0 text-fg-muted","aria-hidden":"true"})]}):m.jsxs("div",{className:"space-y-1 px-3 py-2 border-b border-line",children:[r,o,a??m.jsxs("div",{className:"flex gap-2 pl-14",children:[m.jsx(Pt,{label:"Cc",onClick:p}),m.jsx(Pt,{label:"Bcc",onClick:f})]}),a&&!i&&m.jsx("div",{className:"pl-14",children:m.jsx(Pt,{label:"Bcc",onClick:f})}),i,c]}),qt="This account can't send mail until SMTP is configured.",yo=({onConfigure:e,configureRef:t})=>m.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:[m.jsx(Pr,{className:"size-5 shrink-0 mt-0.5 text-warning","aria-hidden":"true"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"text-sm font-medium text-warning",children:qt}),m.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",m.jsx(Ir,{className:"size-3","aria-hidden":"true"})]})]})]}),bo=({value:e,onChange:t})=>m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"Subj:"}),m.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})]}),Eo=({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 m.jsxs("div",{className:"mt-2 px-3 pb-2",children:[m.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?m.jsx(Pn,{className:"size-3"}):m.jsx(Lr,{className:"size-3"}),i?`${i} wrote:`:"Show quoted text"]}),o&&m.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?m.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-DdkfW5uW.js","assets/index-ARKuDM1Z.js","assets/index-OWhz0EKb.css","assets/rich-text-spellcheck-provider-J8m9wz6A.js","assets/rich-text-BuVeHvbX.js","assets/confirm-dialog-BH7Kc4v5.js","assets/bottom-sheet-DLFNdGop.js","assets/attachment-file-DUjPCn-b.js","assets/useMessageBodyContent-B6r0Xy1W.js","assets/useSignature-B2LbrkV9.js","assets/account-form-helpers-DhckT_PN.js","assets/useDebouncedValue-DRP8Ll3V.js"])))=>i.map(i=>d[i]);
2
+ import{j as m,X as Rr,b as Dr,B as nn,ar as Tr,f as Ar,T as Or,r as s,cp as Nr,cq as kr,C as Pn,af as Pr,cr as Ir,d as Lr,cs as Mr,ct as Qt,bE as In,cu as be,cv as Ln,cw as _r,a0 as Mn,x as jr,aj as yt,cx as bt,cy as Fr,cz as $r,E as Br,D as Et,by as Hr,cA as _n,aR as Wr,aS as Ur,a1 as jn,cB as Vr,ah as zr,cC as qr,cD as rn,cE as Kr,bK as kt,cF as Yr,ak as Gr,bD as Xr,ai as Qr,cG as Zr,b3 as Jr,cH as eo,ag as C}from"./index-ARKuDM1Z.js";import{d as to}from"./useMessageBodyContent-B6r0Xy1W.js";import{u as no}from"./useSignature-B2LbrkV9.js";import{b as ro}from"./account-form-helpers-DhckT_PN.js";import{u as oo}from"./useDebouncedValue-DRP8Ll3V.js";const ao=({email:e,displayName:t,onRemove:n,className:r})=>m.jsxs("span",{className:Dr("inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-accent-2-soft text-sm max-w-[200px]",r),children:[m.jsx("span",{className:"truncate",children:t||e}),m.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:m.jsx(Rr,{className:"size-3"})})]}),so=({save:e})=>e.status==="saving"?m.jsx("output",{className:"animate-pulse text-xs text-fg-muted",children:"Saving..."}):e.status==="saved"?m.jsx("output",{className:"text-xs text-fg-muted",children:"Draft saved"}):e.status==="error"?m.jsx("output",{className:"text-xs text-danger",children:"Save failed"}):e.status==="unsaved"?m.jsx("output",{className:"truncate text-xs text-warning",children:e.reason}):null;function io({send:e,onSend:t,onBlocked:n,onDiscard:r,save:o={status:"idle"}}){const a=e.status==="sending",i=e.status==="blocked"?e.reason:void 0;return m.jsxs("div",{className:"flex items-center justify-between border-t border-line px-3 py-2",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[m.jsx(nn,{variant:"primary",size:"md","aria-busy":a,title:i,className:"min-h-11 shrink-0 rounded-full px-4","data-testid":"compose-send",icon:a?m.jsx(Tr,{className:"size-4 animate-spin"}):m.jsx(Ar,{className:"size-4"}),onClick:()=>{if(!a){if(i!==void 0){n(i);return}t()}},children:"Send"}),m.jsx(so,{save:o})]}),m.jsx(nn,{variant:"ghost",size:"md","aria-busy":a,"aria-label":"Discard",className:"min-h-11 min-w-11 px-2 hover:text-danger",icon:m.jsx(Or,{className:"size-4"}),onClick:()=>{a||r()}})]})}const on=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim()),co=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(on(o))return{email:o,displayName:r}}if(on(t))return{email:t}},uo=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},lo=e=>{const t=[],n=[];for(const r of uo(e)){const o=co(r);if(o){t.push(o);continue}r.trim()&&n.push(r.trim())}return{entries:t,unparsed:n.join(", ")}},fo=["Tab",","],mo=150,po=({label:e,addresses:t,onChange:n,placeholder:r,suggestions:o=[],onQueryChange:a,onPendingChange:i,ref:c})=>{const[p,f]=s.useState(""),l=s.useRef(null),u=s.useMemo(()=>lo(p),[p]);s.useEffect(()=>{i?.(u)},[u,i]);const h=s.useRef(void 0),w=s.useCallback(()=>{h.current!==void 0&&(clearTimeout(h.current),h.current=void 0)},[]);s.useEffect(()=>w,[w]);const x=new Set(t.map(y=>y.email.toLowerCase())),d=p.length>=2?o.filter(y=>!x.has(y.email.toLowerCase())):[],E=s.useCallback(y=>{f(y),a?.(y)},[a]),b=s.useCallback(y=>{w(),!x.has(y.email.toLowerCase())&&(n([...t,y]),E(""))},[t,x,n,E,w]),D=s.useCallback(y=>{n(t.filter((_,R)=>R!==y))},[t,n]),g=s.useCallback(y=>{b(y),l.current?.focus()},[b]),v=s.useCallback(()=>{if(w(),u.entries.length===0)return{addresses:t,unparsed:u.unparsed};const y=new Set(x),_=[...t];for(const R of u.entries){const W=R.email.toLowerCase();y.has(W)||(y.add(W),_.push(R))}return n(_),E(u.unparsed),{addresses:_,unparsed:u.unparsed}},[u,t,x,n,E,w]),T=s.useCallback(()=>{w(),E("")},[E,w]);s.useImperativeHandle(c,()=>({commitPending:v,clearPending:T}),[v,T]);const M=s.useRef(v);s.useEffect(()=>{M.current=v},[v]);const S=Nr({count:d.length,acceptKeys:fo,onAccept:y=>g(d[y])}),N=s.useMemo(()=>d.map(y=>({value:y.email,label:y.displayName??y.email,...y.displayName?{hint:y.email}:{}})),[d]),k=s.useCallback(y=>{if(y.key==="Backspace"&&p===""&&t.length>0){D(t.length-1);return}S.handleKeyDown(y)||(y.key==="Enter"||y.key==="Tab"||y.key===",")&&p.trim()&&(y.preventDefault(),v())},[p,t.length,D,S.handleKeyDown,v]),j=s.useCallback(()=>{w(),h.current=setTimeout(()=>{h.current=void 0,M.current(),S.dismiss()},mo)},[w,S.dismiss]);return m.jsxs("div",{className:"relative","data-address-field":e,children:[m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsxs("label",{htmlFor:`address-field-${e}`,className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:[e,":"]}),m.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:()=>l.current?.focus(),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&l.current?.focus()},children:[t.map((y,_)=>m.jsx(ao,{email:y.email,displayName:y.displayName,onRemove:()=>D(_)},y.email)),m.jsx("input",{ref:l,id:`address-field-${e}`,type:"text",value:p,onChange:y=>{S.reopen(),E(y.target.value)},onKeyDown:k,onBlur:j,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&&m.jsx(kr,{id:S.listId,suggestions:N,activeIndex:S.activeIndex,optionId:S.optionId,onPick:y=>{const _=d.find(R=>R.email===y.value);_&&g(_)},onHighlight:S.setActiveIndex,label:`${e} suggestions`,className:"absolute left-12 right-0 z-50 mt-1 max-h-[200px] shadow-lg"})]})},ho=()=>m.jsxs("div",{"aria-hidden":"true","data-testid":"compose-body-skeleton",className:"min-h-[120px] px-3 py-2",children:[m.jsx("div",{className:"mb-2 h-8 animate-pulse rounded bg-surface-sunken"}),m.jsx("div",{className:"min-h-[80px] animate-pulse rounded bg-surface-sunken/50"})]});function vo({banner:e,header:t,children:n,quoted:r,actionBar:o,layout:a="fill"}){const i=a==="fill";return m.jsxs("div",{className:i?"flex h-full min-h-0 flex-col":"flex flex-col",children:[e,t,m.jsxs("div",{className:i?"flex min-h-0 flex-1 flex-col overflow-auto":"flex flex-col","data-testid":"compose-body-area",children:[n,r&&m.jsx("div",{className:"shrink-0 px-3 pb-2",children:r})]}),i?o:m.jsx("div",{className:"sticky bottom-0 z-10 bg-canvas",children:o})]})}const Pt=({label:e,onClick:t})=>m.jsx("button",{type:"button",onClick:t,className:"text-xs text-fg-muted hover:text-fg transition-colors",children:e}),go=({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(" · ")},wo=({collapsed:e=!1,summary:t="",onExpand:n,from:r,to:o,cc:a,bcc:i,subject:c,onShowCc:p,onShowBcc:f})=>e?m.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:[m.jsx("span",{className:"truncate text-xs text-fg-muted",children:t||"…"}),m.jsx(Pn,{className:"ml-auto size-4 shrink-0 text-fg-muted","aria-hidden":"true"})]}):m.jsxs("div",{className:"space-y-1 px-3 py-2 border-b border-line",children:[r,o,a??m.jsxs("div",{className:"flex gap-2 pl-14",children:[m.jsx(Pt,{label:"Cc",onClick:p}),m.jsx(Pt,{label:"Bcc",onClick:f})]}),a&&!i&&m.jsx("div",{className:"pl-14",children:m.jsx(Pt,{label:"Bcc",onClick:f})}),i,c]}),qt="This account can't send mail until SMTP is configured.",yo=({onConfigure:e,configureRef:t})=>m.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:[m.jsx(Pr,{className:"size-5 shrink-0 mt-0.5 text-warning","aria-hidden":"true"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("p",{className:"text-sm font-medium text-warning",children:qt}),m.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",m.jsx(Ir,{className:"size-3","aria-hidden":"true"})]})]})]}),bo=({value:e,onChange:t})=>m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"Subj:"}),m.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})]}),Eo=({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 m.jsxs("div",{className:"mt-2 px-3 pb-2",children:[m.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?m.jsx(Pn,{className:"size-3"}):m.jsx(Lr,{className:"size-3"}),i?`${i} wrote:`:"Show quoted text"]}),o&&m.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?m.jsx("div",{dangerouslySetInnerHTML:{__html:t}}):e.split(`
3
3
  `).map((c,p)=>m.jsx("p",{className:"min-h-[1.2em]",children:c},p))})]})},So=["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"],xo=["href","src","alt","colspan","rowspan","lang","dir"],Co=/^(?:https?:|mailto:)/i,Ro=/^(?:https:|data:image\/)/i,Do="max-width:100%;height:auto",To=e=>{const t=Mr();if(!t.isSupported)throw new Error("adopted HTML cannot be sanitized: no DOM is available");return t.addHook("afterSanitizeAttributes",n=>{if(n.tagName==="A"){Co.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(!Ro.test(n.getAttribute("src")??"")){n.remove();return}n.setAttribute("style",Do)}}),t},an=new Map,Ao=e=>{const t=an.get(e);if(t)return t;const n=To(e);return an.set(e,n),n},Fn=(e,t)=>Ao(t).sanitize(e,{ALLOWED_TAGS:So,ALLOWED_ATTR:xo,ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1}),Ei=e=>Fn(e,"outgoing"),Oo=e=>Fn(e,"quoted"),No=e=>typeof e=="string"&&e.length>0?"rich":"plain",Si=(e,t)=>t.length>0,ko={plain:"Couldn't switch to plain text",rich:"Couldn't switch to rich text"},xi=(e,t,n)=>t.trim()===""||n.trim()!==""?{outcome:"switch"}:{outcome:"blocked",title:ko[e],detail:"The conversion came back empty, so your message is unchanged."};function Ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)}}function sn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Po(...e){return t=>{let n=!1;const r=e.map(o=>{const a=sn(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():sn(e[o],null)}}}}function Ae(...e){return s.useCallback(Po(...e),e)}function Io(e,t=[]){let n=[];function r(a,i){const c=s.createContext(i);c.displayName=a+"Context";const p=n.length;n=[...n,i];const f=u=>{const{scope:h,children:w,...x}=u,d=h?.[e]?.[p]||c,E=s.useMemo(()=>x,Object.values(x));return m.jsx(d.Provider,{value:E,children:w})};f.displayName=a+"Provider";function l(u,h,w={}){const{optional:x=!1}=w,d=h?.[e]?.[p]||c,E=s.useContext(d);if(E)return E;if(i!==void 0)return i;if(!x)throw new Error(`\`${u}\` must be used within \`${a}\``)}return[f,l]}const o=()=>{const a=n.map(i=>s.createContext(i));return function(c){const p=c?.[e]||a;return s.useMemo(()=>({[`__scope${e}`]:{...c,[e]:p}}),[c,p])}};return o.scopeName=e,[r,Lo(o,...t)]}function Lo(...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:p,scopeName:f})=>{const u=p(a)[`__scope${f}`];return{...c,...u}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Ze=globalThis?.document?s.useLayoutEffect:()=>{},Mo=Qt[" useInsertionEffect ".trim().toString()]||Ze;function _o({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,i]=jo({defaultProp:t,onChange:n}),c=e!==void 0,p=c?e:o;{const l=s.useRef(e!==void 0);s.useEffect(()=>{const u=l.current;u!==c&&console.warn(`${r} is changing from ${u?"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.`),l.current=c},[c,r])}const f=s.useCallback(l=>{if(c){const u=Fo(l)?l(e):l;u!==e&&i.current?.(u)}else a(l)},[c,e,a,i]);return[p,f]}function jo({defaultProp:e,onChange:t}){const[n,r]=s.useState(e),o=s.useRef(n),a=s.useRef(t);return Mo(()=>{a.current=t},[t]),s.useEffect(()=>{o.current!==n&&(a.current?.(n),o.current=n)},[n,o]),[n,r,a]}function Fo(e){return typeof e=="function"}function $n(e){const t=s.forwardRef((n,r)=>{let{children:o,...a}=n,i=null,c=!1;const p=[];cn(o)&&typeof ut=="function"&&(o=ut(o._payload)),s.Children.forEach(o,h=>{if(Uo(h)){c=!0;const w=h;let x="child"in w.props?w.props.child:w.props.children;cn(x)&&typeof ut=="function"&&(x=ut(x._payload)),i=Bo(w,x),p.push(i?.props?.children)}else p.push(h)}),i?i=s.cloneElement(i,void 0,p):!c&&s.Children.count(o)===1&&s.isValidElement(o)&&(i=o);const f=i?Wo(i):void 0,l=Ae(r,f);if(!i){if(o||o===0)throw new Error(c?Ko(e):qo(e));return o}const u=Ho(a,i.props??{});return i.type!==s.Fragment&&(u.ref=r?l:f),s.cloneElement(i,u)});return t.displayName=`${e}.Slot`,t}var $o=Symbol.for("radix.slottable"),Bo=(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 Ho(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 p=a(...c);return o(...c),p}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function Wo(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 Uo(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$o}var Vo=Symbol.for("react.lazy");function cn(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Vo&&"_payload"in e&&zo(e._payload)}function zo(e){return typeof e=="object"&&e!==null&&"then"in e}var qo=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Ko=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,ut=Qt[" use ".trim().toString()],Yo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],de=Yo.reduce((e,t)=>{const n=$n(`Primitive.${t}`),r=s.forwardRef((o,a)=>{const{asChild:i,...c}=o,p=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(p,{...c,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Go(e,t){e&&In.flushSync(()=>e.dispatchEvent(t))}function Je(e){const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>((...n)=>t.current?.(...n)),[])}var Xo="DismissableLayer",Kt="dismissableLayer.update",Qo="dismissableLayer.pointerDownOutside",Zo="dismissableLayer.focusOutside",un,Zt=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Bn=s.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:c,onDismiss:p,...f}=e,l=s.useContext(Zt),[u,h]=s.useState(null),w=u?.ownerDocument??globalThis?.document,[,x]=s.useState({}),d=Ae(t,h),E=Array.from(l.layers),[b]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),D=b?E.indexOf(b):-1,g=u?E.indexOf(u):-1,v=l.layersWithOutsidePointerEventsDisabled.size>0,T=g>=D,M=s.useRef(!1),S=ra(y=>{a?.(y),c?.(y),y.defaultPrevented||p?.()},{ownerDocument:w,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:M,dismissableSurfaces:l.dismissableSurfaces,shouldHandlePointerDownOutside:s.useCallback(y=>{if(!(y instanceof Node))return!1;const _=[...l.branches].some(R=>R.contains(y));return T&&!_},[l.branches,T])}),N=oa(y=>{if(r&&M.current)return;const _=y.target;[...l.branches].some(W=>W.contains(_))||(i?.(y),c?.(y),y.defaultPrevented||p?.())},w),k=u?g===E.length-1:!1,j=Je(y=>{y.key==="Escape"&&(o?.(y),!y.defaultPrevented&&p&&(y.preventDefault(),p()))});return s.useEffect(()=>{if(k)return w.addEventListener("keydown",j,{capture:!0}),()=>w.removeEventListener("keydown",j,{capture:!0})},[w,k,j]),s.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(un=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),ln(),()=>{n&&(l.layersWithOutsidePointerEventsDisabled.delete(u),l.layersWithOutsidePointerEventsDisabled.size===0&&(w.body.style.pointerEvents=un))}},[u,w,n,l]),s.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),ln())},[u,l]),s.useEffect(()=>{const y=()=>x({});return document.addEventListener(Kt,y),()=>document.removeEventListener(Kt,y)},[]),m.jsx(de.div,{...f,ref:d,style:{pointerEvents:v?T?"auto":"none":void 0,...e.style},onFocusCapture:Ee(e.onFocusCapture,N.onFocusCapture),onBlurCapture:Ee(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Ee(e.onPointerDownCapture,S.onPointerDownCapture)})});Bn.displayName=Xo;var Jo="DismissableLayerBranch",ea=s.forwardRef((e,t)=>{const n=s.useContext(Zt),r=s.useRef(null),o=Ae(t,r);return s.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),m.jsx(de.div,{...e,ref:o})});ea.displayName=Jo;function ta(){const e=s.useContext(Zt),[t,n]=s.useState(null);return s.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var na=()=>!0;function ra(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:a,shouldHandlePointerDownOutside:i=na}=t,c=Je(e),p=s.useRef(!1),f=s.useRef(!1),l=s.useRef(new Map),u=s.useRef(()=>{});return s.useEffect(()=>{function h(){f.current=!1,o.current=!1,l.current.clear()}function w(){return Array.from(l.current.values()).some(Boolean)}function x(g){if(!f.current)return;const v=g.target;v instanceof Node&&[...a].some(M=>M.contains(v))||l.current.set(g.type,!0),g.type==="click"&&window.setTimeout(()=>{f.current&&u.current()},0)}function d(g){f.current&&l.current.set(g.type,!1)}const E=g=>{if(g.target&&!p.current){let v=function(){n.removeEventListener("click",u.current);const M=w();h(),M||Hn(Qo,c,T,{discrete:!0})};if(!i(g.target)){n.removeEventListener("click",u.current),h(),p.current=!1;return}const T={originalEvent:g};f.current=!0,o.current=r&&g.button===0,l.current.clear(),!r||g.button!==0?v():(n.removeEventListener("click",u.current),u.current=v,n.addEventListener("click",u.current,{once:!0}))}else n.removeEventListener("click",u.current),h();p.current=!1},b=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const g of b)n.addEventListener(g,x,!0),n.addEventListener(g,d);const D=window.setTimeout(()=>{n.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(D),n.removeEventListener("pointerdown",E),n.removeEventListener("click",u.current);for(const g of b)n.removeEventListener(g,x,!0),n.removeEventListener(g,d)}},[n,c,r,o,a,i]),{onPointerDownCapture:()=>p.current=!0}}function oa(e,t=globalThis?.document){const n=Je(e),r=s.useRef(!1);return s.useEffect(()=>{const o=a=>{a.target&&!r.current&&Hn(Zo,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 ln(){const e=new CustomEvent(Kt);document.dispatchEvent(e)}function Hn(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?Go(o,a):o.dispatchEvent(a)}var lt=0,je=null;function aa(){s.useEffect(()=>{je||(je={start:dn(),end:dn()});const{start:e,end:t}=je;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),lt++,()=>{lt===1&&(je?.start.remove(),je?.end.remove(),je=null),lt=Math.max(0,lt-1)}},[])}function dn(){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 It="focusScope.autoFocusOnMount",Lt="focusScope.autoFocusOnUnmount",fn={bubbles:!1,cancelable:!0},sa="FocusScope",Wn=s.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[c,p]=s.useState(null),f=Je(o),l=Je(a),u=s.useRef(null),h=Ae(t,p),w=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(r){let d=function(g){if(w.paused||!c)return;const v=g.target;c.contains(v)?u.current=v:ye(u.current,{select:!0})},E=function(g){if(w.paused||!c)return;const v=g.relatedTarget;v!==null&&(c.contains(v)||ye(u.current,{select:!0}))},b=function(g){if(document.activeElement===document.body)for(const T of g)T.removedNodes.length>0&&ye(c)};document.addEventListener("focusin",d),document.addEventListener("focusout",E);const D=new MutationObserver(b);return c&&D.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",E),D.disconnect()}}},[r,c,w.paused]),s.useEffect(()=>{if(c){pn.add(w);const d=document.activeElement;if(!c.contains(d)){const b=new CustomEvent(It,fn);c.addEventListener(It,f),c.dispatchEvent(b),b.defaultPrevented||(ia(fa(Un(c)),{select:!0}),document.activeElement===d&&ye(c))}return()=>{c.removeEventListener(It,f),setTimeout(()=>{const b=new CustomEvent(Lt,fn);c.addEventListener(Lt,l),c.dispatchEvent(b),b.defaultPrevented||ye(d??document.body,{select:!0}),c.removeEventListener(Lt,l),pn.remove(w)},0)}}},[c,f,l,w]);const x=s.useCallback(d=>{if(!n&&!r||w.paused)return;const E=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,b=document.activeElement;if(E&&b){const D=d.currentTarget,[g,v]=ca(D);g&&v?!d.shiftKey&&b===v?(d.preventDefault(),n&&ye(g,{select:!0})):d.shiftKey&&b===g&&(d.preventDefault(),n&&ye(v,{select:!0})):b===D&&d.preventDefault()}},[n,r,w.paused]);return m.jsx(de.div,{tabIndex:-1,...i,ref:h,onKeyDown:x})});Wn.displayName=sa;function ia(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ye(r,{select:t}),document.activeElement!==n)return}function ca(e){const t=Un(e),n=mn(t,e),r=mn(t.reverse(),e);return[n,r]}function Un(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 mn(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ua(r,{upTo:t})))return r}function ua(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 la(e){return e instanceof HTMLInputElement&&"select"in e}function ye(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&la(e)&&t&&e.select()}}var pn=da();function da(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=hn(e,t),e.unshift(t)},remove(t){e=hn(e,t),e[0]?.resume()}}}function hn(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function fa(e){return e.filter(t=>t.tagName!=="A")}var ma=Qt[" useId ".trim().toString()]||(()=>{}),pa=0;function Mt(e){const[t,n]=s.useState(ma());return Ze(()=>{n(r=>r??String(pa++))},[e]),e||(t?`radix-${t}`:"")}var ha="Portal",Vn=s.forwardRef((e,t)=>{const{container:n,...r}=e,[o,a]=s.useState(!1);Ze(()=>a(!0),[]);const i=n||o&&globalThis?.document?.body;return i?In.createPortal(m.jsx(de.div,{...r,ref:t}),i):null});Vn.displayName=ha;function va(e,t){return s.useReducer((n,r)=>t[n][r]??n,e)}var xt=e=>{const{present:t,children:n}=e,r=ga(t),o=typeof n=="function"?n({present:r.isPresent}):s.Children.only(n),a=wa(r.ref,ya(o));return typeof n=="function"||r.isPresent?s.cloneElement(o,{ref:a}):null};xt.displayName="Presence";function ga(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",[p,f]=va(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{p==="mounted"?(a.current=i.current??Ge(r.current),i.current=void 0):a.current="none"},[p]),Ze(()=>{const l=r.current,u=o.current;if(u!==e){const w=a.current,x=Ge(l);e?(i.current=x,f("MOUNT")):x==="none"||l?.display==="none"?f("UNMOUNT"):f(u&&w!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,f]),Ze(()=>{if(t){let l;const u=t.ownerDocument.defaultView??window,h=x=>{const E=Ge(r.current).includes(CSS.escape(x.animationName));if(x.target===t&&E&&(f("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",l=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},w=x=>{x.target===t&&(a.current=Ge(r.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{u.clearTimeout(l),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:s.useCallback(l=>{if(l){const u=getComputedStyle(l);r.current=u,i.current=Ge(u)}else r.current=null;n(l)},[])}}function vn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wa(...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=vn(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():vn(r[i],null)}}},[])}function Ge(e){return e?.animationName||"none"}function ya(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 ba=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fe=new WeakMap,dt=new WeakMap,ft={},_t=0,zn=function(e){return e&&(e.host||zn(e.parentNode))},Ea=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=zn(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})},Sa=function(e,t,n,r){var o=Ea(t,Array.isArray(e)?e:[e]);ft[n]||(ft[n]=new WeakMap);var a=ft[n],i=[],c=new Set,p=new Set(o),f=function(u){!u||c.has(u)||(c.add(u),f(u.parentNode))};o.forEach(f);var l=function(u){!u||p.has(u)||Array.prototype.forEach.call(u.children,function(h){if(c.has(h))l(h);else try{var w=h.getAttribute(r),x=w!==null&&w!=="false",d=(Fe.get(h)||0)+1,E=(a.get(h)||0)+1;Fe.set(h,d),a.set(h,E),i.push(h),d===1&&x&&dt.set(h,!0),E===1&&h.setAttribute(n,"true"),x||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return l(t),c.clear(),_t++,function(){i.forEach(function(u){var h=Fe.get(u)-1,w=a.get(u)-1;Fe.set(u,h),a.set(u,w),h||(dt.has(u)||u.removeAttribute(r),dt.delete(u)),w||u.removeAttribute(n)}),_t--,_t||(Fe=new WeakMap,Fe=new WeakMap,dt=new WeakMap,ft={})}},xa=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=ba(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Sa(r,o,n,"aria-hidden")):function(){return null}},gt="right-scroll-bar-position",wt="width-before-scroll-bar",Ca="with-scroll-bars-hidden",Ra="--removed-body-scroll-bar-size";function jt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Da(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 Ta=typeof window<"u"?s.useLayoutEffect:s.useEffect,gn=new WeakMap;function Aa(e,t){var n=Da(null,function(r){return e.forEach(function(o){return jt(o,r)})});return Ta(function(){var r=gn.get(n);if(r){var o=new Set(r),a=new Set(e),i=n.current;o.forEach(function(c){a.has(c)||jt(c,null)}),a.forEach(function(c){o.has(c)||jt(c,i)})}gn.set(n,e)},[e]),n}function Oa(e){return e}function Na(e,t){t===void 0&&(t=Oa);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 p=function(){var l=i;i=[],l.forEach(a)},f=function(){return Promise.resolve().then(p)};f(),n={push:function(l){i.push(l),f()},filter:function(l){return i=i.filter(l),n}}}};return o}function ka(e){e===void 0&&(e={});var t=Na(null);return t.options=be({async:!0,ssr:!1},e),t}var qn=function(e){var t=e.sideCar,n=Ln(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,be({},n))};qn.isSideCarExport=!0;function Pa(e,t){return e.useMedium(t),qn}var Kn=ka(),Ft=function(){},Ct=s.forwardRef(function(e,t){var n=s.useRef(null),r=s.useState({onScrollCapture:Ft,onWheelCapture:Ft,onTouchMoveCapture:Ft}),o=r[0],a=r[1],i=e.forwardProps,c=e.children,p=e.className,f=e.removeScrollBar,l=e.enabled,u=e.shards,h=e.sideCar,w=e.noRelative,x=e.noIsolation,d=e.inert,E=e.allowPinchZoom,b=e.as,D=b===void 0?"div":b,g=e.gapMode,v=Ln(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=h,M=Aa([n,t]),S=be(be({},v),o);return s.createElement(s.Fragment,null,l&&s.createElement(T,{sideCar:Kn,removeScrollBar:f,shards:u,noRelative:w,noIsolation:x,inert:d,setCallbacks:a,allowPinchZoom:!!E,lockRef:n,gapMode:g}),i?s.cloneElement(s.Children.only(c),be(be({},S),{ref:M})):s.createElement(D,be({},S,{className:p,ref:M}),c))});Ct.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ct.classNames={fullWidth:wt,zeroRight:gt};var Ia=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function La(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ia();return t&&e.setAttribute("nonce",t),e}function Ma(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function _a(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ja=function(){var e=0,t=null;return{add:function(n){e==0&&(t=La())&&(Ma(t,n),_a(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Fa=function(){var e=ja();return function(t,n){s.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Yn=function(){var e=Fa(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},$a={left:0,top:0,right:0,gap:0},$t=function(e){return parseInt(e||"",10)||0},Ba=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[$t(n),$t(r),$t(o)]},Ha=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return $a;var t=Ba(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])}},Wa=Yn(),He="data-scroll-locked",Ua=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(Ca,` {
5
5
  overflow: hidden `).concat(r,`;
@@ -40,7 +40,7 @@ import{j as m,X as Rr,b as Dr,B as nn,ar as Tr,f as Ar,T as Or,r as s,cp as Nr,c
40
40
  `)},wn=function(){var e=parseInt(document.body.getAttribute(He)||"0",10);return isFinite(e)?e:0},Va=function(){s.useEffect(function(){return document.body.setAttribute(He,(wn()+1).toString()),function(){var e=wn()-1;e<=0?document.body.removeAttribute(He):document.body.setAttribute(He,e.toString())}},[])},za=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Va();var a=s.useMemo(function(){return Ha(o)},[o]);return s.createElement(Wa,{styles:Ua(a,!t,o,n?"":"!important")})},Yt=!1;if(typeof window<"u")try{var mt=Object.defineProperty({},"passive",{get:function(){return Yt=!0,!0}});window.addEventListener("test",mt,mt),window.removeEventListener("test",mt,mt)}catch{Yt=!1}var $e=Yt?{passive:!1}:!1,qa=function(e){return e.tagName==="TEXTAREA"},Gn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!qa(e)&&n[t]==="visible")},Ka=function(e){return Gn(e,"overflowY")},Ya=function(e){return Gn(e,"overflowX")},yn=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Xn(e,r);if(o){var a=Qn(e,r),i=a[1],c=a[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ga=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Xa=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Xn=function(e,t){return e==="v"?Ka(t):Ya(t)},Qn=function(e,t){return e==="v"?Ga(t):Xa(t)},Qa=function(e,t){return e==="h"&&t==="rtl"?-1:1},Za=function(e,t,n,r,o){var a=Qa(e,window.getComputedStyle(t).direction),i=a*r,c=n.target,p=t.contains(c),f=!1,l=i>0,u=0,h=0;do{if(!c)break;var w=Qn(e,c),x=w[0],d=w[1],E=w[2],b=d-E-a*x;(x||b)&&Xn(e,c)&&(u+=b,h+=x);var D=c.parentNode;c=D&&D.nodeType===Node.DOCUMENT_FRAGMENT_NODE?D.host:D}while(!p&&c!==document.body||p&&(t.contains(c)||t===c));return(l&&Math.abs(u)<1||!l&&Math.abs(h)<1)&&(f=!0),f},pt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bn=function(e){return[e.deltaX,e.deltaY]},En=function(e){return e&&"current"in e?e.current:e},Ja=function(e,t){return e[0]===t[0]&&e[1]===t[1]},es=function(e){return`
41
41
  .block-interactivity-`.concat(e,` {pointer-events: none;}
42
42
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
43
- `)},ts=0,Be=[];function ns(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),o=s.useState(ts++)[0],a=s.useState(Yn)[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 d=_r([e.lockRef.current],(e.shards||[]).map(En),!0).filter(Boolean);return d.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),d.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(d,E){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!i.current.allowPinchZoom;var b=pt(d),D=n.current,g="deltaX"in d?d.deltaX:D[0]-b[0],v="deltaY"in d?d.deltaY:D[1]-b[1],T,M=d.target,S=Math.abs(g)>Math.abs(v)?"h":"v";if("touches"in d&&S==="h"&&M.type==="range")return!1;var N=window.getSelection(),k=N&&N.anchorNode,j=k?k===M||k.contains(M):!1;if(j)return!1;var y=yn(S,M);if(!y)return!0;if(y?T=S:(T=S==="v"?"h":"v",y=yn(S,M)),!y)return!1;if(!r.current&&"changedTouches"in d&&(g||v)&&(r.current=T),!T)return!0;var _=r.current||T;return Za(_,E,d,_==="h"?g:v)},[]),p=s.useCallback(function(d){var E=d;if(!(!Be.length||Be[Be.length-1]!==a)){var b="deltaY"in E?bn(E):pt(E),D=t.current.filter(function(T){return T.name===E.type&&(T.target===E.target||E.target===T.shadowParent)&&Ja(T.delta,b)})[0];if(D&&D.should){E.cancelable&&E.preventDefault();return}if(!D){var g=(i.current.shards||[]).map(En).filter(Boolean).filter(function(T){return T.contains(E.target)}),v=g.length>0?c(E,g[0]):!i.current.noIsolation;v&&E.cancelable&&E.preventDefault()}}},[]),f=s.useCallback(function(d,E,b,D){var g={name:d,delta:E,target:b,should:D,shadowParent:rs(b)};t.current.push(g),setTimeout(function(){t.current=t.current.filter(function(v){return v!==g})},1)},[]),l=s.useCallback(function(d){n.current=pt(d),r.current=void 0},[]),u=s.useCallback(function(d){f(d.type,bn(d),d.target,c(d,e.lockRef.current))},[]),h=s.useCallback(function(d){f(d.type,pt(d),d.target,c(d,e.lockRef.current))},[]);s.useEffect(function(){return Be.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",p,$e),document.addEventListener("touchmove",p,$e),document.addEventListener("touchstart",l,$e),function(){Be=Be.filter(function(d){return d!==a}),document.removeEventListener("wheel",p,$e),document.removeEventListener("touchmove",p,$e),document.removeEventListener("touchstart",l,$e)}},[]);var w=e.removeScrollBar,x=e.inert;return s.createElement(s.Fragment,null,x?s.createElement(a,{styles:es(o)}):null,w?s.createElement(za,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rs(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const os=Pa(Kn,ns);var Zn=s.forwardRef(function(e,t){return s.createElement(Ct,be({},e,{ref:t,sideCar:os}))});Zn.classNames=Ct.classNames;const as={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts"};function Ci(){const e=Mn();return s.useCallback(t=>{e({to:as[t]})},[e])}function ss(){const e=Mn();return s.useCallback(t=>{e({to:"/settings/accounts",search:{editAccountId:t,focusSmtp:!0}})},[e])}const Ri=({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.requireShift!==void 0&&i.requireShift!==o.shiftKey)continue;const p=o.ctrlKey||o.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==p)continue}else{const f=i.noModifiers??!0,l=p||o.altKey||i.requireShift===void 0&&o.shiftKey;if(f&&l)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])},is=(e,t)=>e===void 0&&t.toAddresses.length===0,cs={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},Sn={status:"idle"},us={status:"saving"},xn={status:"saved"},Cn={status:"error"},ls=e=>e.then(()=>{},()=>{}),ds=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(Sn),[o,a]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),p=jr(),f=s.useRef(e),l=s.useRef(e);if(f.current!==e){const g=f.current!==void 0;f.current=e,l.current=e,g&&i.current&&clearTimeout(i.current)}const u=yt({...Fr(),meta:bt}),h=yt({...$r(),meta:bt}),w=s.useCallback(async g=>{r(us),a(null);const v=l.current;if(v){const M=await h.mutateAsync({path:{outboxMessageId:v},body:{toAddresses:g.toAddresses,ccAddresses:g.ccAddresses,bccAddresses:g.bccAddresses,subject:g.subject,textBody:g.textBody,htmlBody:g.htmlBody,inReplyTo:g.inReplyTo,references:g.references}});return r(xn),M}const T=await u.mutateAsync({body:{...g,sendImmediately:!1}});return l.current=T.outboxMessageId,t(T.outboxMessageId),r(xn),p.invalidateQueries({queryKey:Br().queryKey}),T},[u.mutateAsync,h.mutateAsync,t,p]),x=s.useRef(Promise.resolve()),d=s.useCallback(g=>{const v=x.current.then(()=>w(g));return x.current=ls(v),v},[w]),E=s.useCallback(g=>{if(i.current&&clearTimeout(i.current),is(l.current,g)){r(cs);return}r(v=>v.status==="unsaved"?Sn:v),i.current=setTimeout(()=>{const v=l.current;v&&c.current.has(v)||d(g).catch(T=>{a(T),r(Cn)})},2e3)},[d]),b=s.useCallback(g=>(i.current&&clearTimeout(i.current),d(g).then(v=>({outcome:"saved",outboxMessageId:v.outboxMessageId})).catch(v=>(r(Cn),{outcome:"failed",error:v}))),[d]),D=s.useCallback(g=>{i.current&&clearTimeout(i.current),g&&c.current.add(g)},[]);return{saveState:n,saveError:o,saveDraft:E,saveImmediately:b,stopAutoSave:D}},fs=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,ms=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:fs(e),Bt=({label:e,addresses:t,onChange:n,placeholder:r,onPendingChange:o,ref:a})=>{const[i,c]=s.useState(""),p=oo(i,200),{data:f}=Et({...Hr({query:{q:p,limit:8}}),enabled:p.length>=2}),l=s.useMemo(()=>(f?.items??[]).filter(ms).map(u=>({email:u.normalizedEmail,displayName:u.displayName})),[f]);return m.jsx(po,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:l,onQueryChange:c,onPendingChange:o,ref:a})},ps=({accountId:e,configureRef:t})=>{const n=ss();return m.jsx(yo,{configureRef:t,onConfigure:()=>{n(e)}})},hs={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},vs=e=>{const t=`Spellcheck for ${e.language} is off: ${hs[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Wr(Ur({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},gs=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await _n(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-DZleI6WS.js");return{openSpellcheckWorker:r}},__vite__mapDeps([0,1,2,3]));return n(t)},onStatus:t=>{t.state==="failed"&&e(vs(t))}}),Rn=150,ws=()=>{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>Rn}});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>Rn})};return r(),n.addEventListener("resize",r),()=>n.removeEventListener("resize",r)},[]),e},ys=({selectedAccountId:e,onSelect:t})=>{const{data:n}=Et({...jn(),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 o=r[0];return o?m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),m.jsx("div",{className:"text-sm py-1.5",children:o.email})]}):null}return m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("label",{htmlFor:"from-account-selector",className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),m.jsx("select",{id:"from-account-selector",value:e??"",onChange:o=>{const a=r.find(i=>i.accountId===o.target.value);a&&t(a)},className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",children:r.map(o=>m.jsx("option",{value:o.accountId,children:o.email},o.accountId))})]})},bs=s.lazy(()=>_n(()=>import("./rich-text-BD4sX8zA.js"),__vite__mapDeps([4,1,2,5,6,7,3,8,9,10,11])).then(e=>({default:e.ComposeBody}))),Es=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Ss=e=>e.split(`
43
+ `)},ts=0,Be=[];function ns(e){var t=s.useRef([]),n=s.useRef([0,0]),r=s.useRef(),o=s.useState(ts++)[0],a=s.useState(Yn)[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 d=_r([e.lockRef.current],(e.shards||[]).map(En),!0).filter(Boolean);return d.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),d.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=s.useCallback(function(d,E){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!i.current.allowPinchZoom;var b=pt(d),D=n.current,g="deltaX"in d?d.deltaX:D[0]-b[0],v="deltaY"in d?d.deltaY:D[1]-b[1],T,M=d.target,S=Math.abs(g)>Math.abs(v)?"h":"v";if("touches"in d&&S==="h"&&M.type==="range")return!1;var N=window.getSelection(),k=N&&N.anchorNode,j=k?k===M||k.contains(M):!1;if(j)return!1;var y=yn(S,M);if(!y)return!0;if(y?T=S:(T=S==="v"?"h":"v",y=yn(S,M)),!y)return!1;if(!r.current&&"changedTouches"in d&&(g||v)&&(r.current=T),!T)return!0;var _=r.current||T;return Za(_,E,d,_==="h"?g:v)},[]),p=s.useCallback(function(d){var E=d;if(!(!Be.length||Be[Be.length-1]!==a)){var b="deltaY"in E?bn(E):pt(E),D=t.current.filter(function(T){return T.name===E.type&&(T.target===E.target||E.target===T.shadowParent)&&Ja(T.delta,b)})[0];if(D&&D.should){E.cancelable&&E.preventDefault();return}if(!D){var g=(i.current.shards||[]).map(En).filter(Boolean).filter(function(T){return T.contains(E.target)}),v=g.length>0?c(E,g[0]):!i.current.noIsolation;v&&E.cancelable&&E.preventDefault()}}},[]),f=s.useCallback(function(d,E,b,D){var g={name:d,delta:E,target:b,should:D,shadowParent:rs(b)};t.current.push(g),setTimeout(function(){t.current=t.current.filter(function(v){return v!==g})},1)},[]),l=s.useCallback(function(d){n.current=pt(d),r.current=void 0},[]),u=s.useCallback(function(d){f(d.type,bn(d),d.target,c(d,e.lockRef.current))},[]),h=s.useCallback(function(d){f(d.type,pt(d),d.target,c(d,e.lockRef.current))},[]);s.useEffect(function(){return Be.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",p,$e),document.addEventListener("touchmove",p,$e),document.addEventListener("touchstart",l,$e),function(){Be=Be.filter(function(d){return d!==a}),document.removeEventListener("wheel",p,$e),document.removeEventListener("touchmove",p,$e),document.removeEventListener("touchstart",l,$e)}},[]);var w=e.removeScrollBar,x=e.inert;return s.createElement(s.Fragment,null,x?s.createElement(a,{styles:es(o)}):null,w?s.createElement(za,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rs(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const os=Pa(Kn,ns);var Zn=s.forwardRef(function(e,t){return s.createElement(Ct,be({},e,{ref:t,sideCar:os}))});Zn.classNames=Ct.classNames;const as={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts"};function Ci(){const e=Mn();return s.useCallback(t=>{e({to:as[t]})},[e])}function ss(){const e=Mn();return s.useCallback(t=>{e({to:"/settings/accounts",search:{editAccountId:t,focusSmtp:!0}})},[e])}const Ri=({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.requireShift!==void 0&&i.requireShift!==o.shiftKey)continue;const p=o.ctrlKey||o.metaKey;if(i.requireMeta!==void 0){if(i.requireMeta!==p)continue}else{const f=i.noModifiers??!0,l=p||o.altKey||i.requireShift===void 0&&o.shiftKey;if(f&&l)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])},is=(e,t)=>e===void 0&&t.toAddresses.length===0,cs={status:"unsaved",reason:"Not saved — add a To address to keep this draft."},Sn={status:"idle"},us={status:"saving"},xn={status:"saved"},Cn={status:"error"},ls=e=>e.then(()=>{},()=>{}),ds=({outboxMessageId:e,onDraftCreated:t})=>{const[n,r]=s.useState(Sn),[o,a]=s.useState(null),i=s.useRef(void 0),c=s.useRef(new Set),p=jr(),f=s.useRef(e),l=s.useRef(e);if(f.current!==e){const g=f.current!==void 0;f.current=e,l.current=e,g&&i.current&&clearTimeout(i.current)}const u=yt({...Fr(),meta:bt}),h=yt({...$r(),meta:bt}),w=s.useCallback(async g=>{r(us),a(null);const v=l.current;if(v){const M=await h.mutateAsync({path:{outboxMessageId:v},body:{toAddresses:g.toAddresses,ccAddresses:g.ccAddresses,bccAddresses:g.bccAddresses,subject:g.subject,textBody:g.textBody,htmlBody:g.htmlBody,inReplyTo:g.inReplyTo,references:g.references}});return r(xn),M}const T=await u.mutateAsync({body:{...g,sendImmediately:!1}});return l.current=T.outboxMessageId,t(T.outboxMessageId),r(xn),p.invalidateQueries({queryKey:Br().queryKey}),T},[u.mutateAsync,h.mutateAsync,t,p]),x=s.useRef(Promise.resolve()),d=s.useCallback(g=>{const v=x.current.then(()=>w(g));return x.current=ls(v),v},[w]),E=s.useCallback(g=>{if(i.current&&clearTimeout(i.current),is(l.current,g)){r(cs);return}r(v=>v.status==="unsaved"?Sn:v),i.current=setTimeout(()=>{const v=l.current;v&&c.current.has(v)||d(g).catch(T=>{a(T),r(Cn)})},2e3)},[d]),b=s.useCallback(g=>(i.current&&clearTimeout(i.current),d(g).then(v=>({outcome:"saved",outboxMessageId:v.outboxMessageId})).catch(v=>(r(Cn),{outcome:"failed",error:v}))),[d]),D=s.useCallback(g=>{i.current&&clearTimeout(i.current),g&&c.current.add(g)},[]);return{saveState:n,saveError:o,saveDraft:E,saveImmediately:b,stopAutoSave:D}},fs=e=>e.outboundCount>0||e.replyCount>0||e.flags?.vip?.value===!0||e.flags?.trusted?.value===!0,ms=e=>e.flags?.blocked?.value===!0?!1:e.flags?.junkOnly?.value!==!0?!0:fs(e),Bt=({label:e,addresses:t,onChange:n,placeholder:r,onPendingChange:o,ref:a})=>{const[i,c]=s.useState(""),p=oo(i,200),{data:f}=Et({...Hr({query:{q:p,limit:8}}),enabled:p.length>=2}),l=s.useMemo(()=>(f?.items??[]).filter(ms).map(u=>({email:u.normalizedEmail,displayName:u.displayName})),[f]);return m.jsx(po,{label:e,addresses:t,onChange:n,placeholder:r,suggestions:l,onQueryChange:c,onPendingChange:o,ref:a})},ps=({accountId:e,configureRef:t})=>{const n=ss();return m.jsx(yo,{configureRef:t,onConfigure:()=>{n(e)}})},hs={download:"its dictionary could not be downloaded",engine:"the checker could not start",worker:"the checker stopped running"},vs=e=>{const t=`Spellcheck for ${e.language} is off: ${hs[e.reason]}.`;return{severity:"warning",title:"Spellcheck stopped",detail:`${t} Your browser is checking this message instead. ${e.detail}`,action:{label:"Report this",href:Wr(Ur({title:`Spellcheck stopped: ${e.reason} (${e.language})`,errorMessage:`${t} ${e.detail}`}))}}},gs=e=>({provider:async t=>{const{openSpellcheckWorker:n}=await _n(async()=>{const{openSpellcheckWorker:r}=await import("./rich-text-spellcheck-worker-provider-DdkfW5uW.js");return{openSpellcheckWorker:r}},__vite__mapDeps([0,1,2,3]));return n(t)},onStatus:t=>{t.state==="failed"&&e(vs(t))}}),Rn=150,ws=()=>{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>Rn}});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>Rn})};return r(),n.addEventListener("resize",r),()=>n.removeEventListener("resize",r)},[]),e},ys=({selectedAccountId:e,onSelect:t})=>{const{data:n}=Et({...jn(),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 o=r[0];return o?m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("label",{className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),m.jsx("div",{className:"text-sm py-1.5",children:o.email})]}):null}return m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx("label",{htmlFor:"from-account-selector",className:"text-sm text-fg-muted shrink-0 w-12 pt-1.5",children:"From:"}),m.jsx("select",{id:"from-account-selector",value:e??"",onChange:o=>{const a=r.find(i=>i.accountId===o.target.value);a&&t(a)},className:"flex-1 px-2 py-1.5 border rounded-md bg-canvas text-sm",children:r.map(o=>m.jsx("option",{value:o.accountId,children:o.email},o.accountId))})]})},bs=s.lazy(()=>_n(()=>import("./rich-text-BuVeHvbX.js"),__vite__mapDeps([4,1,2,5,6,7,3,8,9,10,11])).then(e=>({default:e.ComposeBody}))),Es=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),Ss=e=>e.split(`
44
44
  `).map(t=>`<p>${Es(t)}</p>`).join(""),xs=e=>e?`<p></p><p>-- </p>${Ss(e)}`:"",Ht=e=>({html:xs(e),text:e}),Cs=e=>e?/^re:\s/i.test(e)?e:`Re: ${e}`:"Re: ",Rs=e=>e?/^fwd?:\s/i.test(e)?e:`Fwd: ${e}`:"Fwd: ",Ds=(e,t,n)=>{const{envelope:r}=e,a=(r.replyTo.length>0?r.replyTo:r.from).map(f=>({email:f.normalizedEmail,displayName:f.displayName}));if(t!=="reply-all")return{to:a,cc:[]};const i=n?.toLowerCase(),c=new Set(a.map(f=>f.email.toLowerCase())),p=[...r.to,...r.cc].filter(f=>f.normalizedEmail.toLowerCase()!==i&&!c.has(f.normalizedEmail.toLowerCase())).map(f=>({email:f.normalizedEmail,displayName:f.displayName}));return{to:a,cc:p}},Ts=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}},Dn=(e,t,n)=>({textBody:t.text||void 0,htmlBody:e==="plain"?"":t.html?Zr(t.html,n):void 0}),As="Add a To address before sending.",Os=({label:e,text:t})=>`${e} holds "${t}", which is not an address.`,Tn=e=>e.find(t=>t.text.trim()!==""),Ns={entries:[],unparsed:""},ks=(e,t,n,r,o)=>e.length===0&&t.length===0&&n.length===0&&r.trim()===""&&o.text.trim()==="",Ps=({documentGeneration:e,selectedAccountId:t,onAccountChange:n,toAddresses:r,setToAddresses:o,ccAddresses:a,setCcAddresses:i,bccAddresses:c,setBccAddresses:p,showCc:f,setShowCc:l,showBcc:u,setShowBcc:h,subject:w,setSubject:x,fieldHandles:d,onToPendingChange:E})=>{const b=Jr(),{isKeyboardOpen:D}=ws(),[g,v]=s.useState(void 0),T=g===e;return m.jsx(wo,{collapsed:!b&&D&&!T,onExpand:()=>v(e),summary:go({to:r,cc:a,bcc:c,subject:w}),from:m.jsx(ys,{selectedAccountId:t,onSelect:n}),to:m.jsx(Bt,{label:"To",addresses:r,onChange:o,placeholder:"Recipients",onPendingChange:E,ref:d.to}),cc:f?m.jsx(Bt,{label:"Cc",addresses:a,onChange:i,ref:d.cc}):void 0,bcc:u?m.jsx(Bt,{label:"Bcc",addresses:c,onChange:p,ref:d.bcc}):void 0,subject:m.jsx(bo,{value:w,onChange:x}),onShowCc:()=>l(!0),onShowBcc:()=>h(!0)})},Di=({mode:e,account:t,sourceMessage:n,outboxMessageId:r,onDraftCreated:o,onClose:a,onAccountChange:i,layout:c="fill"})=>{const{startSendPolling:p}=Vr(),{pushError:f}=zr(),[l,u]=s.useState([]),[h,w]=s.useState([]),[x,d]=s.useState([]),[E,b]=s.useState(Ns),D=s.useRef(null),g=s.useRef(null),v=s.useRef(null),T=s.useMemo(()=>({to:D,cc:g,bcc:v}),[]),M=s.useCallback(()=>{D.current?.clearPending(),g.current?.clearPending(),v.current?.clearPending()},[]),[S,N]=s.useState(""),[k,j]=s.useState(!1),[y,_]=s.useState(!1),[R,W]=s.useState(t?.accountId),[U,X]=s.useState(!1),[V,ee]=s.useState(r),oe=s.useRef(null),fe=s.useRef(r),Ue=s.useRef(r!==void 0),Oe=s.useRef(r!==void 0?e:void 0),ie=s.useRef(void 0),Se=s.useRef(e);Se.current=e;const Ne=s.useRef(t?.accountId);s.useEffect(()=>{const P=t?.accountId;!P||Ne.current===P||(Ne.current=P,!Ue.current&&W(P))},[t?.accountId]),s.useEffect(()=>{const P=fe.current;if(P===r||(fe.current=r,P===void 0))return;Ue.current=r!==void 0,Oe.current=r!==void 0?Se.current:void 0,ie.current=void 0;const B=r?{html:"",text:""}:Ht(me.current);u([]),w([]),d([]),M(),N(""),j(!1),_(!1),ue(B.html),ze(B.text),Pe("rich"),nt(void 0),Ie({...B,formatting:[]}),ke(Z=>Z+1),X(!1),ee(r)},[r,M]);const{signature:ce}=no(R),me=s.useRef(ce.plainText);me.current=ce.plainText;const[pe,ke]=s.useState(0),[Ve,ue]=s.useState(()=>Ht(ce.plainText).html),[tt,ze]=s.useState(ce.plainText),[O,Pe]=s.useState("rich"),[xe,qe]=s.useState("en"),[Dt,nt]=s.useState(),[te,Ie]=s.useState(()=>({...Ht(ce.plainText),formatting:[]})),{data:Y,error:he}=Et({...qr({path:{outboxMessageId:r??""}}),enabled:!!r&&!U,meta:eo,retry:(P,B)=>!rn(B)&&P<1});s.useEffect(()=>{rn(he)&&a()},[he,a]),s.useEffect(()=>{if(!Y||U)return;u(Y.toAddresses.map(re=>({email:re,displayName:void 0}))),Y.ccAddresses&&Y.ccAddresses.length>0&&(w(Y.ccAddresses.map(re=>({email:re,displayName:void 0}))),j(!0)),Y.bccAddresses&&Y.bccAddresses.length>0&&(d(Y.bccAddresses.map(re=>({email:re,displayName:void 0}))),_(!0)),Y.subject&&N(Y.subject);const P=Kr(Y.htmlBody??""),B=P.html,Z=Y.textBody??"";Pe(No(Y.htmlBody)),nt(P.language??void 0),ue(B),ze(Z),Ie({html:B,text:Z,formatting:[]}),ke(re=>re+1),W(Y.accountId),X(!0)},[Y,U]),s.useEffect(()=>{if(n){if(Ue.current&&Oe.current===e){const P=ie.current;if(!P||P.myEmail===t?.email)return}if(Oe.current=e,ie.current={myEmail:t?.email},M(),e==="reply"||e==="reply-all"){const{to:P,cc:B}=Ds(n,e,t?.email);u(P),w(B),B.length>0&&j(!0),N(Cs(n.envelope.subject))}e==="forward"&&(u([]),w([]),d([]),N(Rs(n.envelope.subject)))}},[e,n,t?.email,M]);const Tt=e==="reply"||e==="reply-all"||e==="forward",{data:Ce}=to({messageId:n?.message.messageId,bodyParts:n?.bodyParts,enabled:Tt&&!!n}),rt=Ce?.kind==="text"?Ce.body:"",ot=Ce?.kind==="html"?Oo(Ce.body):void 0,Le=n?.envelope.from[0]?.displayName??n?.envelope.from[0]?.normalizedEmail,At=s.useCallback(P=>{X(!0),ee(P),o(P)},[o]),{saveState:at,saveError:Me,saveDraft:ve,saveImmediately:Ke,stopAutoSave:Re}=ds({outboxMessageId:r,onDraftCreated:At});s.useEffect(()=>{Me&&f({title:"Couldn't save draft",detail:kt(Me)??"Saving the draft failed.",error:Me})},[Me,f]);const st=yt({...Yr(),meta:bt}),it=yt({...Xr(),meta:bt,onError:P=>{f(Gr("Couldn't discard draft","The draft wasn't discarded.",P))}}),{data:Ot}=Et({...jn(),staleTime:1/0}),De=Ot?.accounts.find(P=>P.accountId===R),A=De?ro(De):!1,I=De?.composeLanguages,F=s.useMemo(()=>I&&I.length>0?I:Qr(navigator.languages),[I]),L=s.useMemo(()=>gs(f),[f]),$=s.useRef(!1),[G,K]=s.useState(!1),J=s.useCallback((P,B)=>G?{status:"sending"}:R?A?{status:"blocked",reason:qt}:B?{status:"blocked",reason:Os(B)}:P===0?{status:"blocked",reason:As}:{status:"ready",accountId:R}:{status:"blocked",reason:"Choose an account to send from."},[G,R,A]),Q=s.useMemo(()=>J(l.length+E.entries.length,Tn([{label:"To",text:E.unparsed}])),[J,l.length,E]),le=Q;s.useEffect(()=>{if(!R||$.current||V!==void 0&&V!==r||r&&!U||ks(l,h,x,S,te))return;const{htmlBody:P,textBody:B}=Dn(O,te,xe);ve({accountId:R,toAddresses:l.map(Z=>Z.email),ccAddresses:h.length>0?h.map(Z=>Z.email):void 0,bccAddresses:x.length>0?x.map(Z=>Z.email):void 0,subject:S||void 0,textBody:B,htmlBody:P})},[R,r,V,U,l,h,x,S,te,O,xe,ve]);const ae=s.useCallback(async(P,B)=>{if(!$.current){$.current=!0,K(!0);try{Re();const Z=n&&(e==="reply"||e==="reply-all")?Ts(n):{},{htmlBody:re,textBody:_e}=Dn(O,te,xe),Cr=!r,ct=await Ke({accountId:P,toAddresses:B.to.map(we=>we.email),ccAddresses:B.cc.length>0?B.cc.map(we=>we.email):void 0,bccAddresses:B.bcc.length>0?B.bcc.map(we=>we.email):void 0,subject:S||void 0,textBody:_e,htmlBody:re,...Z});if(ct.outcome==="failed"){f({title:"Couldn't send message",detail:kt(ct.error)??"Saving the message failed, so nothing was sent. Try again.",error:ct.error});return}const Nt=ct.outboxMessageId;if(await st.mutateAsync({path:{outboxMessageId:Nt}}).catch(we=>(f({title:"Couldn't send message",detail:kt(we)??(Cr?"The draft was saved but the send request failed. Try again from the Outbox.":"The send request failed. Try again."),error:we}),null))===null)return;Re(Nt),p(Nt),a()}finally{$.current=!1,K(!1)}}},[S,te,O,xe,e,n,r,Ke,st,Re,p,f,a]),ne=s.useCallback(()=>{Re(r),r&&it.mutate({path:{outboxMessageId:r}}),a()},[Re,r,it,a]),ge=s.useCallback(P=>{f({title:"Can't send yet",detail:P}),P===qt&&oe.current?.focus()},[f]),Ye=s.useCallback(()=>{if(Q.status==="sending")return;const P=T.to.current?.commitPending(),B=T.cc.current?.commitPending(),Z=T.bcc.current?.commitPending(),re={to:P?.addresses??l,cc:B?.addresses??h,bcc:Z?.addresses??x},_e=J(re.to.length,Tn([{label:"To",text:P?.unparsed??""},{label:"Cc",text:B?.unparsed??""},{label:"Bcc",text:Z?.unparsed??""}]));if(_e.status!=="sending"){if(_e.status==="blocked"){ge(_e.reason);return}ae(_e.accountId,re)}},[Q.status,T,l,h,x,J,ge,ae]),xr=s.useCallback(P=>{W(P.accountId),i?.(P)},[i]);return m.jsx(vo,{layout:c,banner:De&&A?m.jsx(ps,{accountId:De.accountId,configureRef:oe}):void 0,header:m.jsx(Ps,{documentGeneration:pe,selectedAccountId:R,onAccountChange:xr,toAddresses:l,setToAddresses:u,ccAddresses:h,setCcAddresses:w,bccAddresses:x,setBccAddresses:d,showCc:k,setShowCc:j,showBcc:y,setShowBcc:_,subject:S,setSubject:N,fieldHandles:T,onToPendingChange:b}),quoted:rt||ot?m.jsx(Eo,{text:rt,html:ot,senderName:Le}):void 0,actionBar:m.jsx(io,{send:le,onSend:Ye,onBlocked:ge,onDiscard:ne,save:at}),children:m.jsx(s.Suspense,{fallback:m.jsx(ho,{}),children:m.jsx(bs,{mode:O,onModeChange:Pe,initialHtml:Ve,initialText:tt,onChange:Ie,onSubmit:Ye,initialCaret:e==="new"?"start":void 0,onConversionError:f,languages:F,initialLanguage:Dt,onLanguageChange:qe,spellcheck:L},pe)})})};var Rt="Dialog",[Jn]=Io(Rt),[Is,se]=Jn(Rt),er=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,c=s.useRef(null),p=s.useRef(null),[f,l]=_o({prop:r,defaultProp:o??!1,onChange:a,caller:Rt});return m.jsx(Is,{scope:t,triggerRef:c,contentRef:p,contentId:Mt(),titleId:Mt(),descriptionId:Mt(),open:f,onOpenChange:l,onOpenToggle:s.useCallback(()=>l(u=>!u),[l]),modal:i,children:n})};er.displayName=Rt;var tr="DialogTrigger",Ls=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=se(tr,n),a=Ae(t,o.triggerRef);return m.jsx(de.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":en(o.open),...r,ref:a,onClick:Ee(e.onClick,o.onOpenToggle)})});Ls.displayName=tr;var Jt="DialogPortal",[Ms,nr]=Jn(Jt,{forceMount:void 0}),rr=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=se(Jt,t);return m.jsx(Ms,{scope:t,forceMount:n,children:s.Children.map(r,i=>m.jsx(xt,{present:n||a.open,children:m.jsx(Vn,{asChild:!0,container:o,children:i})}))})};rr.displayName=Jt;var St="DialogOverlay",or=s.forwardRef((e,t)=>{const n=nr(St,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=se(St,e.__scopeDialog);return a.modal?m.jsx(xt,{present:r||a.open,children:m.jsx(js,{...o,ref:t})}):null});or.displayName=St;var _s=$n("DialogOverlay.RemoveScroll"),js=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=se(St,n),a=ta(),i=Ae(t,a);return m.jsx(Zn,{as:_s,allowPinchZoom:!0,shards:[o.contentRef],children:m.jsx(de.div,{"data-state":en(o.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),We="DialogContent",ar=s.forwardRef((e,t)=>{const n=nr(We,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=se(We,e.__scopeDialog);return m.jsx(xt,{present:r||a.open,children:a.modal?m.jsx(Fs,{...o,ref:t}):m.jsx($s,{...o,ref:t})})});ar.displayName=We;var Fs=s.forwardRef((e,t)=>{const n=se(We,e.__scopeDialog),r=s.useRef(null),o=Ae(t,n.contentRef,r);return s.useEffect(()=>{const a=r.current;if(a)return xa(a)},[]),m.jsx(sr,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ee(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&a.preventDefault()}),onFocusOutside:Ee(e.onFocusOutside,a=>a.preventDefault())})}),$s=s.forwardRef((e,t)=>{const n=se(We,e.__scopeDialog),r=s.useRef(!1),o=s.useRef(!1);return m.jsx(sr,{...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()}})}),sr=s.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...i}=e,c=se(We,n);return aa(),m.jsx(m.Fragment,{children:m.jsx(Wn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:m.jsx(Bn,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":en(c.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),ir="DialogTitle",cr=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=se(ir,n);return m.jsx(de.h2,{id:o.titleId,...r,ref:t})});cr.displayName=ir;var ur="DialogDescription",Bs=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=se(ur,n);return m.jsx(de.p,{id:o.descriptionId,...r,ref:t})});Bs.displayName=ur;var lr="DialogClose",Hs=s.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=se(lr,n);return m.jsx(de.button,{type:"button",...r,ref:t,onClick:Ee(e.onClick,()=>o.onOpenChange(!1))})});Hs.displayName=lr;function en(e){return e?"open":"closed"}function Ws(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 dr=C.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}),et=()=>{const e=C.useContext(dr);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Ws(`[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(
45
45
  [data-state=closed]
46
46
  ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function Us(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Vs(){return tn(/^Mac/)}function zs(){return tn(/^iPhone/)}function An(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function qs(){return tn(/^iPad/)||Vs()&&navigator.maxTouchPoints>1}function fr(){return zs()||qs()}function tn(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Ks=24,Ys=typeof window<"u"?s.useLayoutEffect:s.useEffect;function On(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}const Wt=typeof document<"u"&&window.visualViewport;function Nn(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function mr(e){for(Nn(e)&&(e=e.parentElement);e&&!Nn(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Gs=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let ht=0,Ut;function Xs(e={}){let{isDisabled:t}=e;Ys(()=>{if(!t)return ht++,ht===1&&fr()&&(Ut=Qs()),()=>{ht--,ht===0&&Ut?.()}},[t])}function Qs(){let e,t=0,n=u=>{e=mr(u.target),!(e===document.documentElement&&e===document.body)&&(t=u.changedTouches[0].pageY)},r=u=>{if(!e||e===document.documentElement||e===document.body){u.preventDefault();return}let h=u.changedTouches[0].pageY,w=e.scrollTop,x=e.scrollHeight-e.clientHeight;x!==0&&((w<=0&&h>t||w>=x&&h<t)&&u.preventDefault(),t=h)},o=u=>{let h=u.target;Gt(h)&&h!==document.activeElement&&(u.preventDefault(),h.style.transform="translateY(-2000px)",h.focus(),requestAnimationFrame(()=>{h.style.transform=""}))},a=u=>{let h=u.target;Gt(h)&&(h.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{h.style.transform="",Wt&&(Wt.height<window.innerHeight?requestAnimationFrame(()=>{kn(h)}):Wt.addEventListener("resize",()=>kn(h),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},c=window.pageXOffset,p=window.pageYOffset,f=On(Zs(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let l=On(Xe(document,"touchstart",n,{passive:!1,capture:!0}),Xe(document,"touchmove",r,{passive:!1,capture:!0}),Xe(document,"touchend",o,{passive:!1,capture:!0}),Xe(document,"focus",a,!0),Xe(window,"scroll",i));return()=>{f(),l(),window.scrollTo(c,p)}}function Zs(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Xe(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function kn(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=mr(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,o=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom;const i=n.getBoundingClientRect().bottom+Ks;a>i&&(n.scrollTop+=o-r)}e=n.parentElement}}function Gt(e){return e instanceof HTMLInputElement&&!Gs.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function Js(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ei(...e){return t=>e.forEach(n=>Js(n,t))}function pr(...e){return s.useCallback(ei(...e),e)}const hr=new WeakMap;function q(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([o,a])=>{if(o.startsWith("--")){e.style.setProperty(o,a);return}r[o]=e.style[o],e.style[o]=a}),!n&&hr.set(e,r)}function ti(e,t){if(!e||!(e instanceof HTMLElement))return;let n=hr.get(e);n&&(e.style[t]=n[t])}const z=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function vt(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let o=r.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[z(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[z(t)?5:4]):null)}function ni(e){return 8*(Math.log(e+1)-2)}function Vt(e,t){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function ri(...e){return(...t)=>{for(const n of e)typeof n=="function"&&n(...t)}}const H={DURATION:.5,EASE:[.32,.72,0,1]},vr=.4,oi=.25,ai=100,gr=8,Te=16,Xt=26,zt="vaul-dragging";function wr(e){const t=C.useRef(e);return C.useEffect(()=>{t.current=e}),C.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function si({defaultProp:e,onChange:t}){const n=C.useState(e),[r]=n,o=C.useRef(r),a=wr(t);return C.useEffect(()=>{o.current!==r&&(a(r),o.current=r)},[r,o,a]),n}function yr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=si({defaultProp:t,onChange:n}),a=e!==void 0,i=a?e:r,c=wr(n),p=C.useCallback(f=>{if(a){const u=typeof f=="function"?f(e):f;u!==e&&c(u)}else o(f)},[a,e,o,c]);return[i,p]}function ii({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:o,fadeFromIndex:a,onSnapPointChange:i,direction:c="bottom",container:p,snapToSequentialPoint:f}){const[l,u]=yr({prop:e,defaultProp:n?.[0],onChange:t}),[h,w]=C.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);C.useEffect(()=>{function S(){w({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=C.useMemo(()=>l===n?.[n.length-1]||null,[n,l]),d=C.useMemo(()=>{var S;return(S=n?.findIndex(N=>N===l))!=null?S:null},[n,l]),E=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===l||!n,b=C.useMemo(()=>{const S=p?{width:p.getBoundingClientRect().width,height:p.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var N;return(N=n?.map(k=>{const j=typeof k=="string";let y=0;if(j&&(y=parseInt(k,10)),z(c)){const R=j?y:h?k*S.height:0;return h?c==="bottom"?S.height-R:-S.height+R:R}const _=j?y:h?k*S.width:0;return h?c==="right"?S.width-_:-S.width+_:_}))!=null?N:[]},[n,h,p]),D=C.useMemo(()=>d!==null?b?.[d]:null,[b,d]),g=C.useCallback(S=>{var N;const k=(N=b?.findIndex(j=>j===S))!=null?N:null;i(k),q(r.current,{transition:`transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,transform:z(c)?`translate3d(0, ${S}px, 0)`:`translate3d(${S}px, 0, 0)`}),b&&k!==b.length-1&&a!==void 0&&k!==a&&k<a?q(o.current,{transition:`opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,opacity:"0"}):q(o.current,{transition:`opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,opacity:"1"}),u(n?.[Math.max(k,0)])},[r.current,n,b,a,o,u]);C.useEffect(()=>{if(l||e){var S;const N=(S=n?.findIndex(k=>k===e||k===l))!=null?S:-1;b&&N!==-1&&typeof b[N]=="number"&&g(b[N])}},[l,e,n,b,g]);function v({draggedDistance:S,closeDrawer:N,velocity:k,dismissible:j}){if(a===void 0)return;const y=c==="bottom"||c==="right"?(D??0)-S:(D??0)+S,_=d===a-1,R=d===0,W=S>0;if(_&&q(o.current,{transition:`opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`}),!f&&k>2&&!W){j?N():g(b[0]);return}if(!f&&k>2&&W&&b&&n){g(b[n.length-1]);return}const U=b?.reduce((V,ee)=>typeof V!="number"||typeof ee!="number"?V:Math.abs(ee-y)<Math.abs(V-y)?ee:V),X=z(c)?window.innerHeight:window.innerWidth;if(k>vr&&Math.abs(S)<X*.4){const V=W?1:-1;if(V>0&&x&&n){g(b[n.length-1]);return}if(R&&V<0&&j&&N(),d===null)return;g(b[d+V]);return}g(U)}function T({draggedDistance:S}){if(D===null)return;const N=c==="bottom"||c==="right"?D-S:D+S;(c==="bottom"||c==="right")&&N<b[b.length-1]||(c==="top"||c==="left")&&N>b[b.length-1]||q(r.current,{transform:z(c)?`translate3d(0, ${N}px, 0)`:`translate3d(${N}px, 0, 0)`})}function M(S,N){if(!n||typeof d!="number"||!b||a===void 0)return null;const k=d===a-1;if(d>=a&&N)return 0;if(k&&!N)return 1;if(!E&&!k)return null;const y=k?d+1:d-1,_=k?b[y]-b[y-1]:b[y+1]-b[y],R=S/Math.abs(_);return k?1-R:R}return{isLastSnapPoint:x,activeSnapPoint:l,shouldFade:E,getPercentageDragged:M,setActiveSnapPoint:u,activeSnapPointIndex:d,onRelease:v,onDrag:T,snapPointsOffset:b}}const ci=()=>()=>{};function ui(){const{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:o}=et(),a=C.useRef(null),i=s.useMemo(()=>document.body.style.backgroundColor,[]);function c(){return(window.innerWidth-Xt)/window.innerWidth}C.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);const p=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!p)return;ri(r&&!o?Vt(document.body,{background:"black"}):ci,Vt(p,{transformOrigin:z(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${H.DURATION}s`,transitionTimingFunction:`cubic-bezier(${H.EASE.join(",")})`}));const f=Vt(p,{borderRadius:`${gr}px`,overflow:"hidden",...z(e)?{transform:`scale(${c()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${c()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{f(),a.current=window.setTimeout(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},H.DURATION*1e3)}}},[t,n,i])}let Qe=null;function li({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:o,noBodyStyles:a}){const[i,c]=C.useState(()=>typeof window<"u"?window.location.href:""),p=C.useRef(0),f=C.useCallback(()=>{if(An()&&Qe===null&&e&&!a){Qe={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:u,innerHeight:h}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-p.current}px`,left:`${-u}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const w=h-window.innerHeight;w&&p.current>=h&&(document.body.style.top=`${-(p.current+w)}px`)}),300)}},[e]),l=C.useCallback(()=>{if(An()&&Qe!==null&&!a){const u=-parseInt(document.body.style.top,10),h=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Qe),window.requestAnimationFrame(()=>{if(o&&i!==window.location.href){c(window.location.href);return}window.scrollTo(h,u)}),Qe=null}},[i]);return C.useEffect(()=>{function u(){p.current=window.scrollY}return u(),window.addEventListener("scroll",u),()=>{window.removeEventListener("scroll",u)}},[]),C.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||l()}},[t,l]),C.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&f(),t||window.setTimeout(()=>{l()},500)):l())},[e,r,i,t,n,f,l]),{restorePositionSetting:l}}function di({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:o,snapPoints:a,shouldScaleBackground:i=!1,setBackgroundColorOnScale:c=!0,closeThreshold:p=oi,scrollLockTimeout:f=ai,dismissible:l=!0,handleOnly:u=!1,fadeFromIndex:h=a&&a.length-1,activeSnapPoint:w,setActiveSnapPoint:x,fixed:d,modal:E=!0,onClose:b,nested:D,noBodyStyles:g=!1,direction:v="bottom",defaultOpen:T=!1,disablePreventScroll:M=!0,snapToSequentialPoint:S=!1,preventScrollRestoration:N=!1,repositionInputs:k=!0,onAnimationEnd:j,container:y,autoFocus:_=!1}){var R,W;const[U=!1,X]=yr({defaultProp:T,prop:e,onChange:A=>{t?.(A),!A&&!D&&ot(),setTimeout(()=>{j?.(A)},H.DURATION*1e3),A&&!E&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),A||(document.body.style.pointerEvents="auto")}}),[V,ee]=C.useState(!1),[oe,fe]=C.useState(!1),[Ue,Oe]=C.useState(!1),ie=C.useRef(null),Se=C.useRef(null),Ne=C.useRef(null),ce=C.useRef(null),me=C.useRef(null),pe=C.useRef(!1),ke=C.useRef(null),Ve=C.useRef(0),ue=C.useRef(!1),tt=C.useRef(!T),ze=C.useRef(0),O=C.useRef(null),Pe=C.useRef(((R=O.current)==null?void 0:R.getBoundingClientRect().height)||0),xe=C.useRef(((W=O.current)==null?void 0:W.getBoundingClientRect().width)||0),qe=C.useRef(0),Dt=C.useCallback(A=>{a&&A===he.length-1&&(Se.current=new Date)},[]),{activeSnapPoint:nt,activeSnapPointIndex:te,setActiveSnapPoint:Ie,onRelease:Y,snapPointsOffset:he,onDrag:Tt,shouldFade:Ce,getPercentageDragged:rt}=ii({snapPoints:a,activeSnapPointProp:w,setActiveSnapPointProp:x,drawerRef:O,fadeFromIndex:h,overlayRef:ie,onSnapPointChange:Dt,direction:v,container:y,snapToSequentialPoint:S});Xs({isDisabled:!U||oe||!E||Ue||!V||!k||!M});const{restorePositionSetting:ot}=li({isOpen:U,modal:E,nested:D??!1,hasBeenOpened:V,preventScrollRestoration:N,noBodyStyles:g});function Le(){return(window.innerWidth-Xt)/window.innerWidth}function At(A){var I,F;!l&&!a||O.current&&!O.current.contains(A.target)||(Pe.current=((I=O.current)==null?void 0:I.getBoundingClientRect().height)||0,xe.current=((F=O.current)==null?void 0:F.getBoundingClientRect().width)||0,fe(!0),Ne.current=new Date,fr()&&window.addEventListener("touchend",()=>pe.current=!1,{once:!0}),A.target.setPointerCapture(A.pointerId),Ve.current=z(v)?A.pageY:A.pageX)}function at(A,I){var F;let L=A;const $=(F=window.getSelection())==null?void 0:F.toString(),G=O.current?vt(O.current,v):null,K=new Date;if(L.tagName==="SELECT"||L.hasAttribute("data-vaul-no-drag")||L.closest("[data-vaul-no-drag]"))return!1;if(v==="right"||v==="left")return!0;if(Se.current&&K.getTime()-Se.current.getTime()<500)return!1;if(G!==null&&(v==="bottom"?G>0:G<0))return!0;if($&&$.length>0)return!1;if(me.current&&K.getTime()-me.current.getTime()<f&&G===0||I)return me.current=K,!1;for(;L;){if(L.scrollHeight>L.clientHeight){if(L.scrollTop!==0)return me.current=new Date,!1;if(L.getAttribute("role")==="dialog")return!0}L=L.parentNode}return!0}function Me(A){if(O.current&&oe){const I=v==="bottom"||v==="right"?1:-1,F=(Ve.current-(z(v)?A.pageY:A.pageX))*I,L=F>0,$=a&&!l&&!L;if($&&te===0)return;const G=Math.abs(F),K=document.querySelector("[data-vaul-drawer-wrapper]"),J=v==="bottom"||v==="top"?Pe.current:xe.current;let Q=G/J;const le=rt(G,L);if(le!==null&&(Q=le),$&&Q>=1||!pe.current&&!at(A.target,L))return;if(O.current.classList.add(zt),pe.current=!0,q(O.current,{transition:"none"}),q(ie.current,{transition:"none"}),a&&Tt({draggedDistance:F}),L&&!a){const ne=ni(F),ge=Math.min(ne*-1,0)*I;q(O.current,{transform:z(v)?`translate3d(0, ${ge}px, 0)`:`translate3d(${ge}px, 0, 0)`});return}const ae=1-Q;if((Ce||h&&te===h-1)&&(r?.(A,Q),q(ie.current,{opacity:`${ae}`,transition:"none"},!0)),K&&ie.current&&i){const ne=Math.min(Le()+Q*(1-Le()),1),ge=8-Q*8,Ye=Math.max(0,14-Q*14);q(K,{borderRadius:`${ge}px`,transform:z(v)?`scale(${ne}) translate3d(0, ${Ye}px, 0)`:`scale(${ne}) translate3d(${Ye}px, 0, 0)`,transition:"none"},!0)}if(!a){const ne=G*I;q(O.current,{transform:z(v)?`translate3d(0, ${ne}px, 0)`:`translate3d(${ne}px, 0, 0)`})}}}C.useEffect(()=>{window.requestAnimationFrame(()=>{tt.current=!0})},[]),C.useEffect(()=>{var A;function I(){if(!O.current||!k)return;const F=document.activeElement;if(Gt(F)||ue.current){var L;const $=((L=window.visualViewport)==null?void 0:L.height)||0,G=window.innerHeight;let K=G-$;const J=O.current.getBoundingClientRect().height||0,Q=J>G*.8;qe.current||(qe.current=J);const le=O.current.getBoundingClientRect().top;if(Math.abs(ze.current-K)>60&&(ue.current=!ue.current),a&&a.length>0&&he&&te){const ae=he[te]||0;K+=ae}if(ze.current=K,J>$||ue.current){const ae=O.current.getBoundingClientRect().height;let ne=ae;ae>$&&(ne=$-(Q?le:Xt)),d?O.current.style.height=`${ae-Math.max(K,0)}px`:O.current.style.height=`${Math.max(ne,$-le)}px`}else Us()||(O.current.style.height=`${qe.current}px`);a&&a.length>0&&!ue.current?O.current.style.bottom="0px":O.current.style.bottom=`${Math.max(K,0)}px`}}return(A=window.visualViewport)==null||A.addEventListener("resize",I),()=>{var F;return(F=window.visualViewport)==null?void 0:F.removeEventListener("resize",I)}},[te,a,he]);function ve(A){Re(),b?.(),A||X(!1),setTimeout(()=>{a&&Ie(a[0])},H.DURATION*1e3)}function Ke(){if(!O.current)return;const A=document.querySelector("[data-vaul-drawer-wrapper]"),I=vt(O.current,v);q(O.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`}),q(ie.current,{transition:`opacity ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,opacity:"1"}),i&&I&&I>0&&U&&q(A,{borderRadius:`${gr}px`,overflow:"hidden",...z(v)?{transform:`scale(${Le()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Le()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${H.DURATION}s`,transitionTimingFunction:`cubic-bezier(${H.EASE.join(",")})`},!0)}function Re(){!oe||!O.current||(O.current.classList.remove(zt),pe.current=!1,fe(!1),ce.current=new Date)}function st(A){if(!oe||!O.current)return;O.current.classList.remove(zt),pe.current=!1,fe(!1),ce.current=new Date;const I=vt(O.current,v);if(!A||!at(A.target,!1)||!I||Number.isNaN(I)||Ne.current===null)return;const F=ce.current.getTime()-Ne.current.getTime(),L=Ve.current-(z(v)?A.pageY:A.pageX),$=Math.abs(L)/F;if($>.05&&(Oe(!0),setTimeout(()=>{Oe(!1)},200)),a){Y({draggedDistance:L*(v==="bottom"||v==="right"?1:-1),closeDrawer:ve,velocity:$,dismissible:l}),o?.(A,!0);return}if(v==="bottom"||v==="right"?L>0:L<0){Ke(),o?.(A,!0);return}if($>vr){ve(),o?.(A,!1);return}var G;const K=Math.min((G=O.current.getBoundingClientRect().height)!=null?G:0,window.innerHeight);var J;const Q=Math.min((J=O.current.getBoundingClientRect().width)!=null?J:0,window.innerWidth),le=v==="left"||v==="right";if(Math.abs(I)>=(le?Q:K)*p){ve(),o?.(A,!1);return}o?.(A,!0),Ke()}C.useEffect(()=>(U&&(q(document.documentElement,{scrollBehavior:"auto"}),Se.current=new Date),()=>{ti(document.documentElement,"scrollBehavior")}),[U]);function it(A){const I=A?(window.innerWidth-Te)/window.innerWidth:1,F=A?-Te:0;ke.current&&window.clearTimeout(ke.current),q(O.current,{transition:`transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,transform:z(v)?`scale(${I}) translate3d(0, ${F}px, 0)`:`scale(${I}) translate3d(${F}px, 0, 0)`}),!A&&O.current&&(ke.current=setTimeout(()=>{const L=vt(O.current,v);q(O.current,{transition:"none",transform:z(v)?`translate3d(0, ${L}px, 0)`:`translate3d(${L}px, 0, 0)`})},500))}function Ot(A,I){if(I<0)return;const F=(window.innerWidth-Te)/window.innerWidth,L=F+I*(1-F),$=-Te+I*Te;q(O.current,{transform:z(v)?`scale(${L}) translate3d(0, ${$}px, 0)`:`scale(${L}) translate3d(${$}px, 0, 0)`,transition:"none"})}function De(A,I){const F=z(v)?window.innerHeight:window.innerWidth,L=I?(F-Te)/F:1,$=I?-Te:0;I&&q(O.current,{transition:`transform ${H.DURATION}s cubic-bezier(${H.EASE.join(",")})`,transform:z(v)?`scale(${L}) translate3d(0, ${$}px, 0)`:`scale(${L}) translate3d(${$}px, 0, 0)`})}return C.useEffect(()=>{E||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[E]),C.createElement(er,{defaultOpen:T,onOpenChange:A=>{!l&&!A||(A?ee(!0):ve(!0),X(A))},open:U},C.createElement(dr.Provider,{value:{activeSnapPoint:nt,snapPoints:a,setActiveSnapPoint:Ie,drawerRef:O,overlayRef:ie,onOpenChange:t,onPress:At,onRelease:st,onDrag:Me,dismissible:l,shouldAnimate:tt,handleOnly:u,isOpen:U,isDragging:oe,shouldFade:Ce,closeDrawer:ve,onNestedDrag:Ot,onNestedOpenChange:it,onNestedRelease:De,keyboardIsOpen:ue,modal:E,snapPointsOffset:he,activeSnapPointIndex:te,direction:v,shouldScaleBackground:i,setBackgroundColorOnScale:c,noBodyStyles:g,container:y,autoFocus:_}},n))}const br=C.forwardRef(function({...e},t){const{overlayRef:n,snapPoints:r,onRelease:o,shouldFade:a,isOpen:i,modal:c,shouldAnimate:p}=et(),f=pr(t,n),l=r&&r.length>0;if(!c)return null;const u=C.useCallback(h=>o(h),[o]);return C.createElement(or,{onMouseUp:u,ref:f,"data-vaul-overlay":"","data-vaul-snap-points":i&&l?"true":"false","data-vaul-snap-points-overlay":i&&a?"true":"false","data-vaul-animate":p?.current?"true":"false",...e})});br.displayName="Drawer.Overlay";const Er=C.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},o){const{drawerRef:a,onPress:i,onRelease:c,onDrag:p,keyboardIsOpen:f,snapPointsOffset:l,activeSnapPointIndex:u,modal:h,isOpen:w,direction:x,snapPoints:d,container:E,handleOnly:b,shouldAnimate:D,autoFocus:g}=et(),[v,T]=C.useState(!1),M=pr(o,a),S=C.useRef(null),N=C.useRef(null),k=C.useRef(!1),j=d&&d.length>0;ui();const y=(R,W,U=0)=>{if(k.current)return!0;const X=Math.abs(R.y),V=Math.abs(R.x),ee=V>X,oe=["bottom","right"].includes(W)?1:-1;if(W==="left"||W==="right"){if(!(R.x*oe<0)&&V>=0&&V<=U)return ee}else if(!(R.y*oe<0)&&X>=0&&X<=U)return!ee;return k.current=!0,!0};C.useEffect(()=>{j&&window.requestAnimationFrame(()=>{T(!0)})},[]);function _(R){S.current=null,k.current=!1,c(R)}return C.createElement(ar,{"data-vaul-drawer-direction":x,"data-vaul-drawer":"","data-vaul-delayed-snap-points":v?"true":"false","data-vaul-snap-points":w&&j?"true":"false","data-vaul-custom-container":E?"true":"false","data-vaul-animate":D?.current?"true":"false",...r,ref:M,style:l&&l.length>0?{"--snap-point-height":`${l[u??0]}px`,...t}:t,onPointerDown:R=>{b||(r.onPointerDown==null||r.onPointerDown.call(r,R),S.current={x:R.pageX,y:R.pageY},i(R))},onOpenAutoFocus:R=>{n?.(R),g||R.preventDefault()},onPointerDownOutside:R=>{if(e?.(R),!h||R.defaultPrevented){R.preventDefault();return}f.current&&(f.current=!1)},onFocusOutside:R=>{if(!h){R.preventDefault();return}},onPointerMove:R=>{if(N.current=R,b||(r.onPointerMove==null||r.onPointerMove.call(r,R),!S.current))return;const W=R.pageY-S.current.y,U=R.pageX-S.current.x,X=R.pointerType==="touch"?10:2;y({x:U,y:W},x,X)?p(R):(Math.abs(U)>X||Math.abs(W)>X)&&(S.current=null)},onPointerUp:R=>{r.onPointerUp==null||r.onPointerUp.call(r,R),S.current=null,k.current=!1,c(R)},onPointerOut:R=>{r.onPointerOut==null||r.onPointerOut.call(r,R),_(N.current)},onContextMenu:R=>{r.onContextMenu==null||r.onContextMenu.call(r,R),N.current&&_(N.current)}})});Er.displayName="Drawer.Content";const fi=250,mi=120,Sr=C.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{closeDrawer:o,isDragging:a,snapPoints:i,activeSnapPoint:c,setActiveSnapPoint:p,dismissible:f,handleOnly:l,isOpen:u,onPress:h,onDrag:w}=et(),x=C.useRef(null),d=C.useRef(!1);function E(){if(d.current){g();return}window.setTimeout(()=>{b()},mi)}function b(){if(a||e||d.current){g();return}if(g(),!i||i.length===0){f||o();return}if(c===i[i.length-1]&&f){o();return}const T=i.findIndex(S=>S===c);if(T===-1)return;const M=i[T+1];p(M)}function D(){x.current=window.setTimeout(()=>{d.current=!0},fi)}function g(){x.current&&window.clearTimeout(x.current),d.current=!1}return C.createElement("div",{onClick:E,onPointerCancel:g,onPointerDown:v=>{l&&h(v),D()},onPointerMove:v=>{l&&w(v)},ref:r,"data-vaul-drawer-visible":u?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},C.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});Sr.displayName="Drawer.Handle";function pi(e){const t=et(),{container:n=t.container,...r}=e;return C.createElement(rr,{container:n,...r})}const Ti={Root:di,Content:Er,Overlay:br,Portal:pi,Handle:Sr,Title:cr};export{Di as C,Ti as D,Ri as a,Si as b,xi as c,Ei as s,Ci as u};
@@ -0,0 +1 @@
1
+ import{j as t,ab as o}from"./index-ARKuDM1Z.js";const n=()=>t.jsx(o,{to:"/settings/accounts"});export{n as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-ARKuDM1Z.js";import{M as i}from"./MailboxPane-CN1sGDNp.js";import"./useSearchTokenContext-DeUV80u1.js";import"./kbd-CAJ-SREr.js";import"./useMessageBodyContent-B6r0Xy1W.js";import"./search-scope-DTcpOp3S.js";import"./useRefreshControl-C4qz95RS.js";import"./circle-check-big-BA1xfQ4O.js";import"./search-token-index-B8zgeaqe.js";import"./MailListHeader-C3tApRDT.js";import"./attachment-file-DUjPCn-b.js";import"./mail-wi6czXl8.js";import"./avatar-CG2aRAmH.js";import"./index-CGKUKLu6.js";import"./useSignature-B2LbrkV9.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DRP8Ll3V.js";import"./ErrorState-C6npTXjw.js";import"./format-23Av07Go.js";import"./download-Cc9-gBGy.js";import"./shield-check-BlvoNOLt.js";import"./useFilters-BEch6wEY.js";import"./confirm-dialog-BH7Kc4v5.js";import"./clock-Bg0F1_jO.js";import"./menu-DMsGK9e8.js";import"./MailViewChrome-BSU2HWLP.js";import"./NavMenuButton-BBv_d9qJ.js";import"./useLabels-C2ilUjRI.js";import"./useSemanticSearch-QykvYO5y.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DLFNdGop.js";import"./circle-help-zW6vVnfY.js";import"./circle-check-7FfmmUK5.js";function G(){return o.jsx(i.Reading,{})}export{G as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-ARKuDM1Z.js";import{F as r}from"./FlaggedPane-24EWFMPk.js";import"./useSearchTokenContext-DeUV80u1.js";import"./kbd-CAJ-SREr.js";import"./useMessageBodyContent-B6r0Xy1W.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-C3tApRDT.js";import"./search-token-index-B8zgeaqe.js";import"./attachment-file-DUjPCn-b.js";import"./mail-wi6czXl8.js";import"./avatar-CG2aRAmH.js";import"./index-CGKUKLu6.js";import"./useSignature-B2LbrkV9.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DRP8Ll3V.js";import"./ErrorState-C6npTXjw.js";import"./format-23Av07Go.js";import"./download-Cc9-gBGy.js";import"./shield-check-BlvoNOLt.js";import"./useFilters-BEch6wEY.js";import"./confirm-dialog-BH7Kc4v5.js";import"./clock-Bg0F1_jO.js";import"./menu-DMsGK9e8.js";import"./MailViewChrome-BSU2HWLP.js";import"./wizard-selection-B1bng5Jq.js";function w(){return o.jsx(r.Reading,{})}export{w as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-ARKuDM1Z.js";import{F as r}from"./FlaggedPane-24EWFMPk.js";import"./useSearchTokenContext-DeUV80u1.js";import"./kbd-CAJ-SREr.js";import"./useMessageBodyContent-B6r0Xy1W.js";import"./search-scope-DTcpOp3S.js";import"./MailListHeader-C3tApRDT.js";import"./search-token-index-B8zgeaqe.js";import"./attachment-file-DUjPCn-b.js";import"./mail-wi6czXl8.js";import"./avatar-CG2aRAmH.js";import"./index-CGKUKLu6.js";import"./useSignature-B2LbrkV9.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DRP8Ll3V.js";import"./ErrorState-C6npTXjw.js";import"./format-23Av07Go.js";import"./download-Cc9-gBGy.js";import"./shield-check-BlvoNOLt.js";import"./useFilters-BEch6wEY.js";import"./confirm-dialog-BH7Kc4v5.js";import"./clock-Bg0F1_jO.js";import"./menu-DMsGK9e8.js";import"./MailViewChrome-BSU2HWLP.js";import"./wizard-selection-B1bng5Jq.js";function v(){return o.jsx(r.Reading,{})}export{v as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-ARKuDM1Z.js";import{M as r}from"./MailboxPane-CN1sGDNp.js";import"./useSearchTokenContext-DeUV80u1.js";import"./kbd-CAJ-SREr.js";import"./useMessageBodyContent-B6r0Xy1W.js";import"./search-scope-DTcpOp3S.js";import"./useRefreshControl-C4qz95RS.js";import"./circle-check-big-BA1xfQ4O.js";import"./search-token-index-B8zgeaqe.js";import"./MailListHeader-C3tApRDT.js";import"./attachment-file-DUjPCn-b.js";import"./mail-wi6czXl8.js";import"./avatar-CG2aRAmH.js";import"./index-CGKUKLu6.js";import"./useSignature-B2LbrkV9.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DRP8Ll3V.js";import"./ErrorState-C6npTXjw.js";import"./format-23Av07Go.js";import"./download-Cc9-gBGy.js";import"./shield-check-BlvoNOLt.js";import"./useFilters-BEch6wEY.js";import"./confirm-dialog-BH7Kc4v5.js";import"./clock-Bg0F1_jO.js";import"./menu-DMsGK9e8.js";import"./MailViewChrome-BSU2HWLP.js";import"./NavMenuButton-BBv_d9qJ.js";import"./useLabels-C2ilUjRI.js";import"./useSemanticSearch-QykvYO5y.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-DLFNdGop.js";import"./circle-help-zW6vVnfY.js";import"./circle-check-7FfmmUK5.js";function F(){return o.jsx(r.Reading,{})}export{F as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-ARKuDM1Z.js";import{O as t}from"./OutboxPane-DtKFhs0V.js";import"./useSearchTokenContext-DeUV80u1.js";import"./kbd-CAJ-SREr.js";import"./useMessageBodyContent-B6r0Xy1W.js";import"./search-scope-DTcpOp3S.js";import"./circle-check-big-BA1xfQ4O.js";import"./clock-Bg0F1_jO.js";import"./row-actions-oMrNzr_M.js";import"./rotate-ccw-BAbqhDs-.js";import"./NavMenuButton-BBv_d9qJ.js";import"./menu-DMsGK9e8.js";import"./format-23Av07Go.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function c(){return o.jsx(t.Reading,{})}export{c as component};
@@ -1 +1 @@
1
- import{j as s,b as t}from"./index-CKl3LWp1.js";function x({className:e,...n}){return s.jsx("kbd",{className:t("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),...n})}export{x as K};
1
+ import{j as s,b as t}from"./index-ARKuDM1Z.js";function x({className:e,...n}){return s.jsx("kbd",{className:t("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),...n})}export{x as K};
@@ -1 +1 @@
1
- import{r as f,j as e,ap as h,b5 as y,ao as b,bu as g,B as v,T as N,a0 as C,D as L,a1 as D,aD as I,aH as S,aE as E}from"./index-CKl3LWp1.js";import{C as w}from"./confirm-dialog-oDtiUrui.js";import{S as $}from"./settings-screen-DXV1BkEv.js";import{E as j}from"./ErrorState-BhwzcNoy.js";import{a as T,b as k,c as R,u as O}from"./useLabels-lVDJ4sa7.js";import"./avatar-B5_004W1.js";import"./menu-DIOQLP64.js";import"./circle-help-BaKDOnAa.js";function B({labels:l,onRename:i,onRecolor:n,onDelete:m,deletingLabelId:c}){const[u,r]=f.useState(),[o,d]=f.useState("");if(l.length===0)return e.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No labels yet. Create one below, then use it in a filter or apply it to mail directly."});const t=a=>{const s=o.trim();s!==""&&i(a,s),r(void 0)};return e.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:l.map(a=>e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[u===a.labelId?e.jsx(h,{autoFocus:!0,value:o,onChange:s=>d(s.target.value),onBlur:()=>t(a.labelId),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),t(a.labelId)),s.key==="Escape"&&(s.preventDefault(),r(void 0))},"aria-label":`Rename label ${a.name}`}):e.jsx("button",{type:"button",onClick:()=>{r(a.labelId),d(a.name)},"aria-label":`Rename label ${a.name}`,className:"flex items-center gap-2 rounded-sm text-left hover:opacity-80",children:e.jsx(y,{label:a})}),e.jsx("p",{className:"mt-0.5 text-xs text-fg-subtle",children:a.filterCount===0?"Not used in any filter":`Used in ${a.filterCount} ${a.filterCount===1?"filter":"filters"}`})]}),e.jsx(b,{"aria-label":`Color for ${a.name}`,value:a.color,onChange:s=>n(a.labelId,s.target.value),className:"w-28 shrink-0",children:g.map(s=>e.jsx("option",{value:s,children:s},s))}),e.jsx(v,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4 text-danger"}),onClick:()=>m(a),disabled:c===a.labelId,"aria-label":`Delete label ${a.name}`})]},a.labelId))})}const P=(l,i)=>{if(i===0)return{title:`Delete the "${l}" label?`};const n=i===1?"filter":"filters";return{title:`Delete the "${l}" label?`,description:`This also deletes ${i} ${n} that ${i===1?"applies":"apply"} it — they can't be recovered.`}},H=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 _({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(E,{tone:"danger",variant:"soft",children:"Couldn't create that label. Please try again."})]})}function A({account:l}){const i=l.accountId,{labels:n,isPending:m,isError:c,error:u,refetch:r}=T(i),{updateLabel:o}=k(i),{deleteLabel:d,deletingLabelId:t}=R(i),[a,s]=f.useState();return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:l.email}),m?e.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading labels for ${l.email}`}):c?e.jsx(j,{variant:"inline",title:`Couldn't load labels for ${l.email}`,error:u,onRetry:()=>{r()}}):e.jsx(B,{labels:n,onRename:(p,x)=>o(p,{name:x}),onRecolor:(p,x)=>o(p,{color:x}),onDelete:s,deletingLabelId:t}),e.jsx(_,{accountId:i}),a&&(()=>{const p=P(a.name,a.filterCount);return e.jsx(w,{isOpen:!0,title:p.title,description:p.description,confirmLabel:"Delete label",destructive:!0,isBusy:t===a.labelId,onConfirm:()=>{d(a.labelId),s(void 0)},onCancel:()=>s(void 0)})})()]})}function q(){const l=C(),[i,n]=f.useState(!0),{data:m,isPending:c,isError:u,error:r,refetch:o}=L(D()),d=t=>{const a=S[t];a&&l({to:a})};return e.jsx($,{items:I,activeId:"labels",title:"Labels",description:"Mark mail without moving it, per account.",help:H,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(A,{account:t},t.accountId))})})}export{q as component};
1
+ import{r as f,j as e,ap as h,b5 as y,ao as b,bu as g,B as v,T as N,a0 as C,D as L,a1 as D,aD as I,aH as S,aE as E}from"./index-ARKuDM1Z.js";import{C as w}from"./confirm-dialog-BH7Kc4v5.js";import{S as $}from"./settings-screen-DvJe3EZk.js";import{E as j}from"./ErrorState-C6npTXjw.js";import{a as T,b as k,c as R,u as O}from"./useLabels-C2ilUjRI.js";import"./avatar-CG2aRAmH.js";import"./menu-DMsGK9e8.js";import"./circle-help-zW6vVnfY.js";function B({labels:l,onRename:i,onRecolor:n,onDelete:m,deletingLabelId:c}){const[u,r]=f.useState(),[o,d]=f.useState("");if(l.length===0)return e.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No labels yet. Create one below, then use it in a filter or apply it to mail directly."});const t=a=>{const s=o.trim();s!==""&&i(a,s),r(void 0)};return e.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:l.map(a=>e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[u===a.labelId?e.jsx(h,{autoFocus:!0,value:o,onChange:s=>d(s.target.value),onBlur:()=>t(a.labelId),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),t(a.labelId)),s.key==="Escape"&&(s.preventDefault(),r(void 0))},"aria-label":`Rename label ${a.name}`}):e.jsx("button",{type:"button",onClick:()=>{r(a.labelId),d(a.name)},"aria-label":`Rename label ${a.name}`,className:"flex items-center gap-2 rounded-sm text-left hover:opacity-80",children:e.jsx(y,{label:a})}),e.jsx("p",{className:"mt-0.5 text-xs text-fg-subtle",children:a.filterCount===0?"Not used in any filter":`Used in ${a.filterCount} ${a.filterCount===1?"filter":"filters"}`})]}),e.jsx(b,{"aria-label":`Color for ${a.name}`,value:a.color,onChange:s=>n(a.labelId,s.target.value),className:"w-28 shrink-0",children:g.map(s=>e.jsx("option",{value:s,children:s},s))}),e.jsx(v,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4 text-danger"}),onClick:()=>m(a),disabled:c===a.labelId,"aria-label":`Delete label ${a.name}`})]},a.labelId))})}const P=(l,i)=>{if(i===0)return{title:`Delete the "${l}" label?`};const n=i===1?"filter":"filters";return{title:`Delete the "${l}" label?`,description:`This also deletes ${i} ${n} that ${i===1?"applies":"apply"} it — they can't be recovered.`}},H=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 _({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(E,{tone:"danger",variant:"soft",children:"Couldn't create that label. Please try again."})]})}function A({account:l}){const i=l.accountId,{labels:n,isPending:m,isError:c,error:u,refetch:r}=T(i),{updateLabel:o}=k(i),{deleteLabel:d,deletingLabelId:t}=R(i),[a,s]=f.useState();return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:l.email}),m?e.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading labels for ${l.email}`}):c?e.jsx(j,{variant:"inline",title:`Couldn't load labels for ${l.email}`,error:u,onRetry:()=>{r()}}):e.jsx(B,{labels:n,onRename:(p,x)=>o(p,{name:x}),onRecolor:(p,x)=>o(p,{color:x}),onDelete:s,deletingLabelId:t}),e.jsx(_,{accountId:i}),a&&(()=>{const p=P(a.name,a.filterCount);return e.jsx(w,{isOpen:!0,title:p.title,description:p.description,confirmLabel:"Delete label",destructive:!0,isBusy:t===a.labelId,onConfirm:()=>{d(a.labelId),s(void 0)},onCancel:()=>s(void 0)})})()]})}function q(){const l=C(),[i,n]=f.useState(!0),{data:m,isPending:c,isError:u,error:r,refetch:o}=L(D()),d=t=>{const a=S[t];a&&l({to:a})};return e.jsx($,{items:I,activeId:"labels",title:"Labels",description:"Mark mail without moving it, per account.",help:H,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(A,{account:t},t.accountId))})})}export{q as component};
@@ -1 +1 @@
1
- import{c as L,r as u,u as Re,j as e,S as Pe,a as pe,b as k,C as ee,d as te,e as Le,f as ge,F as Ae,g as ze,X as be,T as Te,O as Fe,M as De,A as _e,h as Be,I as Ke,i as ve,B as F,k as Qe,l as Ve,m as z,n as qe,o as U,p as se,q as He,s as $e,t as Ue,v as ye,w as je,x as Se,y as Ge,z as J,D as Ne,E as Ye,G as Je,H as G,J as We,N as R,K as Xe,L as Ze,P as et,Q as tt,R as st,U as at,V as nt,W as rt,Y as ot,Z as it,_ as lt,$ as ct,a0 as ut,a1 as dt,a2 as mt,a3 as xt,a4 as ht}from"./index-CKl3LWp1.js";import{B as ft,S as pt,D as gt,a as bt,b as vt,u as yt,s as jt,c as St,d as W,K as Nt,e as Ct,f as Ce,g as kt,h as wt,i as It,j as Mt}from"./search-token-index-H-rvjCDG.js";import{u as X,a as Ot}from"./useMessageBodyContent-dJBG7Uxx.js";import{P as Et}from"./pencil-DYHpUKoM.js";import{c as Rt,s as Pt,M as Lt}from"./MailShell-CxB5XVdv.js";import{u as At,a as zt,R as Tt,M as Ft}from"./useRefreshControl-Dogo-wLl.js";import{M as Dt}from"./menu-DIOQLP64.js";import{B as ke}from"./bug-Bqi2ib3I.js";import{A as _t}from"./avatar-B5_004W1.js";import{u as Bt,a as Kt}from"./index-BMB-ZCLn.js";import{i as Qt}from"./outbox-status-BlKn6P0x.js";import{E as Vt}from"./ErrorState-BhwzcNoy.js";import{K as ae}from"./kbd-O3V-B_3F.js";import{u as qt}from"./useDebouncedValue-CTaUBQHS.js";import"./search-scope-DTcpOp3S.js";import"./FullCompose-D4K57d-g.js";import"./confirm-dialog-oDtiUrui.js";import"./circle-check-big-CTPrzCxI.js";import"./useSignature-BIM1_tcj.js";import"./account-form-helpers-DhckT_PN.js";const Ht=L("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const $t=L("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const we=L("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const Ie=L("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Ut=L("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),Gt="button:not([disabled]), a[href]",E="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function Yt({active:t,dimmed:s,indent:a}){return k("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",E,a&&"pl-7",t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",s&&"opacity-55")}function Jt({icon:t,label:s,count:a,active:n}){return e.jsxs(e.Fragment,{children:[t&&e.jsx("span",{className:k("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:t}),e.jsx("span",{className:"flex-1 truncate",children:s}),a!=null&&a>0&&e.jsx("span",{className:k("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function P({icon:t,label:s,count:a,active:n,dimmed:r,indent:o,navId:i,linkComponent:c,ariaLabel:h,title:d,onClick:g}){const x=Yt({active:n,dimmed:r,indent:o}),p=e.jsx(Jt,{icon:t,label:s,count:a,active:n});return i&&c?c({navId:i,className:x,ariaLabel:h??s,title:d,onClick:g,children:p}):e.jsx("button",{type:"button",onClick:g,className:x,"aria-label":h,title:d,children:p})}const ne={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Wt(t){switch(t){case"inbox":return e.jsx(Ke,{className:"size-4"});case"flagged":return e.jsx(pe,{className:"size-4"});case"drafts":return e.jsx(Be,{className:"size-4"});case"sent":return e.jsx(ge,{className:"size-4"});case"archive":return e.jsx(_e,{className:"size-4"});case"all":return e.jsx(De,{className:"size-4"});case"junk":return e.jsx(Fe,{className:"size-4"});case"trash":return e.jsx(Te,{className:"size-4"})}}const re=t=>t.role!=null,$=8,oe="remit.nav.folders.open.",ie="remit.nav.account.open.";function le(t,s,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(t+s);return n===null?a:n!=="0"}function ce(t,s,a){typeof localStorage>"u"||localStorage.setItem(t+s,a?"1":"0")}function Xt({query:t,onSelect:s,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:s,className:k("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",E),children:[e.jsx(ze,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${t}`,className:k("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",E),children:e.jsx(be,{className:"size-3.5"})})]})}function Zt({savedSearches:t,saveableQuery:s,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:r}){return t.length===0&&!s?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),s&&e.jsxs("button",{type:"button",onClick:r,className:k("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",E),children:[e.jsx(Ht,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",s,"”"]})]}),t.map(o=>e.jsx(Xt,{query:o,onSelect:()=>a?.(o),onRemove:n?()=>n(o):void 0},o))]})}function es({account:t,selectedNavId:s,onSelectNav:a,linkComponent:n}){const[r,o]=u.useState(()=>le(ie,t.id,!0)),[i,c]=u.useState(()=>le(oe,t.id,!0)),[h,d]=u.useState(!1),g=()=>{o(l=>{const S=!l;return ce(ie,t.id,S),S})},x=()=>{c(l=>{const S=!l;return ce(oe,t.id,S),S})},p=t.mailboxes.filter(re).sort((l,S)=>ne[l.role]-ne[S.role]),m=t.mailboxes.filter(l=>!re(l)),b=h||m.length<=$?m:m.slice(0,$),j=m.length-b.length,y=t.status??"ready",N=y==="ready"&&p.length===0&&m.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:g,"aria-expanded":r,className:k("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",E,t.muted&&"opacity-55"),children:[r?e.jsx(ee,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(te,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),t.muted&&e.jsxs(e.Fragment,{children:[e.jsx(ft,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),r&&e.jsxs(e.Fragment,{children:[y==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),y==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(Le,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),t.onRetry&&e.jsx("button",{type:"button",onClick:t.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),N&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),y==="ready"&&e.jsxs(e.Fragment,{children:[p.map(l=>e.jsx(P,{navId:l.id,linkComponent:n,icon:Wt(l.role),label:l.name,ariaLabel:l.name,title:l.fullPath??l.name,count:l.unseen,active:s===l.id,dimmed:t.muted,onClick:()=>a?.(l.id)},l.id)),t.outboxPending!==void 0&&e.jsx(P,{navId:"outbox",linkComponent:n,icon:e.jsx(ge,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:t.outboxPending>0?t.outboxPending:void 0,active:s==="outbox",dimmed:t.muted,onClick:()=>a?.("outbox")}),m.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:x,"aria-expanded":i,className:k("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",E),children:[i?e.jsx(ee,{className:"size-3 shrink-0"}):e.jsx(te,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:m.length})]}),i&&e.jsxs(e.Fragment,{children:[b.map(l=>e.jsx(P,{navId:l.id,linkComponent:n,icon:e.jsx(Ae,{className:"size-4"}),label:l.name,ariaLabel:l.name,title:l.fullPath??l.name,count:l.unseen,active:s===l.id,dimmed:t.muted,onClick:()=>a?.(l.id)},l.id)),(j>0||h)&&m.length>$&&e.jsx("button",{type:"button",onClick:()=>d(l=>!l),className:k("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",E),children:h?"Show less":`Show all (${m.length})`})]})]})]})]})]})}function ts({accounts:t,selectedNavId:s,briefUnseen:a,onSelectNav:n,variant:r="desktop",linkComponent:o,calendarNav:i="hidden",savedSearches:c=[],saveableQuery:h,onSelectSavedSearch:d,onRemoveSavedSearch:g,onSaveCurrentSearch:x}){const p=u.useRef(null);Re({containerRef:p,itemSelector:Gt});const m=r==="drawer",b=e.jsxs("nav",{ref:m?p:void 0,className:m?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(P,{navId:"brief",linkComponent:o,icon:e.jsx(Pe,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:s==="brief",onClick:()=>n?.("brief")}),i==="shown"&&e.jsx(P,{navId:"calendar",linkComponent:o,icon:e.jsx($t,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:s==="calendar",onClick:()=>n?.("calendar")}),e.jsx(P,{navId:"flagged",linkComponent:o,icon:e.jsx(pe,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:s==="flagged",onClick:()=>n?.("flagged")}),e.jsx(Zt,{savedSearches:c,saveableQuery:h,onSelectSavedSearch:d,onRemoveSavedSearch:g,onSaveCurrentSearch:x}),t.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):t.map(j=>e.jsx(es,{account:j,selectedNavId:s,onSelectNav:n,linkComponent:o},j.id))]});return m?b:e.jsx("aside",{ref:p,className:"flex h-full w-full flex-col bg-surface-sunken",children:b})}function ss({leading:t,search:s,actions:a,className:n}){return e.jsxs("header",{className:k("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",n),children:[t&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t}),e.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:e.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),a&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a})]})}function as(){const t=ve();if(!t)return null;const s=t.showNavPane?!t.navCollapsed:!1;return e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(Dt,{className:"size-4"}),onClick:t.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const ns={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function rs({search:t,onCompose:s,onReportBug:a,onOpenSettings:n,composeShortcut:r,refreshControl:o,account:i}){return e.jsx(ss,{leading:e.jsx(as,{}),search:e.jsx(pt,{value:t.value,onChange:t.onChange,onClear:t.onClear,onClearQuery:t.onClearQuery,chips:t.chips,onRemoveChip:t.onRemoveChip,placeholder:ns[t.scope]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(Ut,{className:"size-4"}),title:r?`Compose (${r})`:"Compose","aria-label":"Compose",onClick:s}),e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(ke,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:a}),e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:n}),o,i]})})}function os(){const{pathname:t}=Qe(),s=Ve({from:"/mail/$mailboxId",shouldThrow:!1});return z(t,"/settings")?"settings":z(t,"/mail/outbox")?"outbox":z(t,"/mail/flagged")?"flagged":z(t,"/mail/brief")?"brief":s?.mailboxId??""}function is(){const t=qe(),s=U({select:d=>se(d.location.pathname)}),a=U({select:d=>He(d.location.search)}),[n,r]=u.useState(a),o=qt(n,200),[i,c]=u.useState(s);if(i!==s){const d=Pt(i,s,a);c(s),d!==void 0&&r(d)}const h=u.useCallback(d=>{c(se(t.state.location.pathname)),r(d)},[t]);return{searchInput:n,committedQuery:Rt(n,o),viewKey:s,setSearchInput:h}}const ls=()=>{const t=X();return $e()?null:e.jsx("button",{type:"button",onClick:t,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:e.jsx(Et,{className:"size-6"})})},Me=({children:t})=>{const{Account:s}=Ue();return e.jsx(s,{children:t})},cs=({email:t,onSignOut:s})=>{const a=t??"Account";return e.jsxs(gt,{trigger:e.jsx(_t,{name:a,email:t??void 0,size:"sm"}),align:"right",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-2 text-xs text-fg-muted truncate",title:t,"data-testid":"account-menu-email",children:t}),e.jsx(bt,{})]}),e.jsxs(vt,{onClick:s,children:[e.jsx(we,{className:"size-4"}),"Sign out"]})]})},us=()=>e.jsx(Me,{children:({email:t,signOut:s})=>e.jsx(cs,{email:t,onSignOut:s})});function ds({accounts:t}){const{searchInput:s,onSearchChange:a,onSearchClear:n,onSearchClearQuery:r}=ye(),o=Bt(),i=X(),{scope:c,clearScope:h}=yt(t),d=c.kind==="scoped"?[{id:c.chip.id,label:c.chip.label,tone:"scope"}]:void 0,g=u.useMemo(()=>t.map(j=>j.accountId),[t]),{hasNewMail:x}=At(),{state:p,errorMessage:m,refresh:b}=zt(g);return e.jsx(rs,{search:{value:s,scope:c.kind,chips:d,onChange:a,onClear:n,onClearQuery:r,onRemoveChip:h},onCompose:i,onReportBug:je,onOpenSettings:()=>o("accounts"),composeShortcut:jt("compose"),refreshControl:e.jsx(Tt,{state:p,onRefresh:b,label:"Refresh all accounts",errorMessage:m,hasUpdate:x(g)}),account:e.jsx(us,{})})}const Z="remit.savedSearches",ms=25;function _(){try{const t=localStorage.getItem(Z);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(a=>typeof a=="string"):[]}catch{return[]}}function xs(t){const s=t.trim();if(!s)return _();const a=[s,..._().filter(n=>n!==s)].slice(0,ms);try{localStorage.setItem(Z,JSON.stringify(a))}catch{return a}return a}function hs(t){const s=_().filter(a=>a!==t);try{localStorage.setItem(Z,JSON.stringify(s))}catch{return s}return s}const ue=t=>/^\d/.test(t),fs=(t,s)=>{const a=ue(t),n=ue(s);return a&&!n?-1:!a&&n?1:t.localeCompare(s,void 0,{sensitivity:"base",numeric:!0})};function ps(t,s,a){const n=[],r=[];for(const o of t)s.has(o.mailboxId)?n.push(o):r.push(o);return r.sort((o,i)=>fs(G(o,void 0,a),G(i,void 0,a))),{system:n,labels:r}}function gs(t,s,a){const n=We(s)&&t.unseenCount>0;return{id:t.mailboxId,name:G(t,s,a),unseen:n?t.unseenCount:void 0,role:s,fullPath:t.fullPath}}function de({accounts:t,onMailboxSelect:s,variant:a="desktop"}){const n=Se(),r=St(),o=os(),{searchInput:i,onSearchChange:c}=ye(),[h,d]=u.useState(_),{t:g}=Ge("mail",{useSuspense:!1}),x=u.useCallback((f,C)=>g(f,{defaultValue:C}),[g]),p=W({queries:t.map(f=>({...J({path:{accountId:f.accountId}}),staleTime:1/0}))}),{data:m}=Ne(Ye()),b=u.useMemo(()=>(m?.items??[]).filter(f=>Qt(f.status)).length,[m?.items]),j=u.useMemo(()=>t.map((f,C)=>{const v=p[C],I=v?.data?.items??[],w=Je(f.folderAppointments),{system:M,labels:V}=ps(I,w,x),q=v?.isError?"error":v?.isLoading?"loading":"ready";return{id:f.accountId,label:f.email,email:f.email,muted:!!f.muted,outboxPending:b,status:q,onRetry:()=>v?.refetch(),mailboxes:[...M,...V].map(A=>gs(A,w.get(A.mailboxId),x))}}),[t,p,b,x]),y=f=>{n.invalidateQueries({queryKey:Xe({path:{mailboxId:f},query:{order:"desc"}})})},N=({navId:f,className:C,ariaLabel:v,title:I,children:w,onClick:M})=>f==="brief"?e.jsx(R,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="outbox"?e.jsx(R,{to:"/mail/outbox",search:{q:void 0},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="flagged"?e.jsx(R,{to:"/mail/flagged",search:{q:void 0},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="settings"?e.jsx(R,{to:"/settings/accounts",onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):e.jsx(R,{to:"/mail/$mailboxId",params:{mailboxId:f},search:{q:void 0},onClick:()=>{y(f),M?.()},className:C,"aria-label":v,title:I,children:w}),l=()=>{c(""),s?.()},S=i.trim(),O=S.length>0&&!h.includes(S)?S:void 0,B=u.useCallback(()=>{O&&d(xs(O))},[O]),K=u.useCallback(f=>{d(hs(f))},[]),Q=u.useCallback(f=>{c(f),r(f),s?.()},[c,r,s]);return e.jsx(ts,{accounts:j,selectedNavId:o,onSelectNav:l,linkComponent:N,variant:a,savedSearches:h,saveableQuery:O,onSaveCurrentSearch:B,onSelectSavedSearch:Q,onRemoveSavedSearch:K})}function bs(){return e.jsxs("button",{type:"button",onClick:je,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function vs({accounts:t,onMailboxSelect:s}){return ve()?.showNavPane??!0?e.jsx(de,{accounts:t}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(de,{accounts:t,onMailboxSelect:s,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(R,{to:"/settings/accounts",onClick:s,children:[e.jsx(Ie,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(bs,{}),e.jsx(Me,{children:({signOut:r})=>e.jsxs("button",{type:"button",onClick:()=>{s?.(),r()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(we,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}const ys=({isOpen:t,onClose:s})=>{const a=u.useCallback(n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),s())},[s]);return u.useEffect(()=>{if(t)return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[t,a]),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx(Ze,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:k("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),e.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:e.jsx(be,{className:"size-5"})})]}),e.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:Nt.map(n=>e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:n.title}),e.jsx("div",{className:"space-y-2",children:n.hints.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm",children:r.description}),e.jsx("span",{className:"flex shrink-0 items-center gap-1",children:r.keys.map((o,i)=>e.jsxs(u.Fragment,{children:[i>0&&r.keys[0]==="g"&&e.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),e.jsx(ae,{children:o})]},o))})]},`${r.action}-${r.keys.join("+")}`))})]},n.title))}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",e.jsx(ae,{children:"Esc"})," to close"]})})]})]}):null};function js(t){const s=W({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0}))});return u.useMemo(()=>Ct(s.map(a=>a.data?.items??[])),[s])}const Oe="remit:intelligence-open";function Ss(){try{return localStorage.getItem(Oe)!=="closed"}catch{return!0}}function Ns(t){try{localStorage.setItem(Oe,t?"open":"closed")}catch{}}function me({panels:t,prefersOpen:s,isDesktop:a,hasThread:n,raisedFor:r,openMessage:o}){return r!==null&&r===o?!0:t.length>0?t.includes("intelligence"):a&&n&&s}const Cs=()=>{const t=Ce(),s=et(),a=tt(),n=s.find(st),r=kt(),[o,i]=u.useState(Ss),c=r?`${r.threadId}/${r.messageId??""}`:null,[h,d]=u.useState(null),g={panels:s,prefersOpen:o,isDesktop:t==="desktop",hasThread:r!==void 0,openMessage:c},x=me({...g,raisedFor:h}),p=me({...g,raisedFor:null}),m=u.useCallback((N,l)=>{a([...N?["intelligence"]:[],...l?[l]:[]])},[a]),b=u.useCallback(N=>{m(p,N)},[p,m]),j=u.useCallback(()=>{if(x&&!p){d(null);return}const N=!x;Ns(N),i(N),d(null),m(N,n)},[p,x,n,m]),y=u.useCallback(()=>{d(c)},[c]);return{openOverlay:n,intelligenceOpen:x,showOverlay:b,toggleIntelligence:j,raiseIntelligence:y}},ks=t=>t.map(s=>s.data?.items??[]);function ws(t){const s=W({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0})),combine:ks});return u.useMemo(()=>at(t.map((a,n)=>({folderAppointments:a.folderAppointments,mailboxes:s[n]??[]}))),[t,s])}var T={exports:{}},xe;function Is(){if(xe)return T.exports;xe=1;const t=(s,a,n)=>new Promise((r,o)=>{if(n=Object.assign({concurrency:1/0},n),typeof a!="function")throw new TypeError("Mapper function is required");const{concurrency:i}=n;if(!(typeof i=="number"&&i>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${i}\` (${typeof i})`);const c=[],h=s[Symbol.iterator]();let d=!1,g=!1,x=0,p=0;const m=()=>{if(d)return;const b=h.next(),j=p;if(p++,b.done){g=!0,x===0&&r(c);return}x++,Promise.resolve(b.value).then(y=>a(y,j)).then(y=>{c[j]=y,x--,m()},y=>{d=!0,o(y)})};for(let b=0;b<i&&(m(),!g);b++);});return T.exports=t,T.exports.default=t,T.exports}var Ms=Is();const Os=nt(Ms),Es=900*1e3,Rs=300,Ps=(t,s)=>{if(!t)return s;const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:s},Ls=60*1e3,As=t=>Math.max(Ps(t,Rs)*1e3,Ls),D=As(ct().mailboxPollIntervalSeconds),zs=5,Y=new Set,Ts=(t,s,a=Es)=>t.filter(n=>{const r=n.lastSyncAt;return r==null?!0:s-r>a}).map(n=>n.accountId),Fs=(t,s,a=D)=>t-s>=a,Ds=(t,s)=>t.filter(a=>!s.has(a)),he=(t,s)=>{if(Y.delete(t),it(s,{softError:!0},"nobody")){lt(s);return}console.warn("[remit] background mailbox sync failed",{accountId:t,error:s})},fe=(t,s)=>rt({path:{accountId:t},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:ot({path:{accountId:t}})})}),_s=t=>{const s=Se(),a=u.useRef(t);a.current=t;const n=t.map(r=>r.accountId).join(",");u.useEffect(()=>{const r=Date.now(),i=Ts(a.current,r).filter(c=>!Y.has(c));if(i.length!==0)for(const c of i)Y.add(c),fe(c,s).catch(h=>{he(c,h)})},[n,s]),u.useEffect(()=>{let r=Date.now(),o;const i=new Set,c=()=>{r=Date.now();const g=Ds(a.current.map(x=>x.accountId),i);for(const x of g)i.add(x);Os(g,x=>fe(x,s).catch(p=>{he(x,p)}).finally(()=>{i.delete(x)}),{concurrency:zs})},h=()=>{if(document.visibilityState==="visible"){c(),o=setTimeout(h,D);return}},d=()=>{document.visibilityState==="visible"&&Fs(Date.now(),r)&&(o!==void 0&&clearTimeout(o),c(),o=setTimeout(h,D))};return o=setTimeout(h,D),document.addEventListener("visibilitychange",d),()=>{o!==void 0&&clearTimeout(o),document.removeEventListener("visibilitychange",d)}},[n,s])};function oa(){const t=ut(),s=Ce(),a=Mt(s),{openOverlay:n,intelligenceOpen:r,showOverlay:o,toggleIntelligence:i,raiseIntelligence:c}=Cs(),h=n==="shortcuts",d=n==="nav",{searchInput:g,committedQuery:x,viewKey:p,setSearchInput:m}=is(),{data:b,isLoading:j,isError:y,error:N,refetch:l}=Ne({...dt(),staleTime:1/0}),S=!!(b&&(b.accounts?.length??0)===0);u.useEffect(()=>{S&&t({to:"/onboarding",replace:!0})},[S,t]),Kt({enabled:!h,bindings:[{key:"?",handler:()=>o("shortcuts"),noModifiers:!1,preventDefault:!0}]});const O=X(),B=Ot(),K=U({select:H=>mt(H.matches)?.list==="mailbox"}),Q=u.useMemo(()=>({compose:O}),[O]);wt({enabled:!K&&!B,handlers:Q});const f=u.useCallback(()=>{m("")},[m]),C=u.useCallback(()=>{m("")},[m]),v=b?.accounts??[],I=u.useMemo(()=>v.map(H=>H.accountId),[v]),w=js(v),M=ws(v),V=u.useMemo(()=>It(v),[v]);_s(v);const q=u.useCallback(()=>{n==="nav"&&o(void 0)},[n,o]),A={accounts:v,mailboxNameIndex:w,accountNameIndex:V,resultFolderIndex:M,searchQuery:x,searchInput:g,searchViewKey:p,onSearchChange:m,onSearchClear:f,onSearchClearQuery:C,intelligenceOpen:r,onToggleIntelligence:i,onRaiseIntelligence:c},Ee={isSinglePane:a,isLoading:j||S,intelligenceOpen:r,nav:e.jsx(vs,{accounts:v,onMailboxSelect:q}),topBar:a?void 0:e.jsx(ds,{accounts:v}),overlay:a?e.jsx(ls,{}):void 0,navOpen:d,onOpenNav:()=>o("nav"),onCloseNav:()=>o(void 0)};return e.jsx(xt.Provider,{value:A,children:e.jsxs(Ft,{accountIds:I,children:[y?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(Vt,{title:"Couldn't load your account",error:N,onRetry:()=>{l()}})}):e.jsx(Lt,{chrome:Ee,children:e.jsx(ht,{})}),e.jsx(ys,{isOpen:h,onClose:()=>o(void 0)})]})})}export{oa as component,ye as useMailContext};
1
+ import{c as L,r as u,u as Re,j as e,S as Pe,a as pe,b as k,C as ee,d as te,e as Le,f as ge,F as Ae,g as ze,X as be,T as Te,O as Fe,M as De,A as _e,h as Be,I as Ke,i as ve,B as F,k as Qe,l as Ve,m as z,n as qe,o as U,p as se,q as He,s as $e,t as Ue,v as ye,w as je,x as Se,y as Ge,z as J,D as Ne,E as Ye,G as Je,H as G,J as We,N as R,K as Xe,L as Ze,P as et,Q as tt,R as st,U as at,V as nt,W as rt,Y as ot,Z as it,_ as lt,$ as ct,a0 as ut,a1 as dt,a2 as mt,a3 as xt,a4 as ht}from"./index-ARKuDM1Z.js";import{B as ft,S as pt,D as gt,a as bt,b as vt,u as yt,s as jt,c as St,d as W,K as Nt,e as Ct,f as Ce,g as kt,h as wt,i as It,j as Mt}from"./search-token-index-B8zgeaqe.js";import{u as X,a as Ot}from"./useMessageBodyContent-B6r0Xy1W.js";import{P as Et}from"./pencil-nJp7AV15.js";import{c as Rt,s as Pt,M as Lt}from"./MailShell-Bd1kL-Up.js";import{u as At,a as zt,R as Tt,M as Ft}from"./useRefreshControl-C4qz95RS.js";import{M as Dt}from"./menu-DMsGK9e8.js";import{B as ke}from"./bug-Ct11KdBV.js";import{A as _t}from"./avatar-CG2aRAmH.js";import{u as Bt,a as Kt}from"./index-CGKUKLu6.js";import{i as Qt}from"./outbox-status-BlKn6P0x.js";import{E as Vt}from"./ErrorState-C6npTXjw.js";import{K as ae}from"./kbd-CAJ-SREr.js";import{u as qt}from"./useDebouncedValue-DRP8Ll3V.js";import"./search-scope-DTcpOp3S.js";import"./FullCompose-CKOPv_qc.js";import"./confirm-dialog-BH7Kc4v5.js";import"./circle-check-big-BA1xfQ4O.js";import"./useSignature-B2LbrkV9.js";import"./account-form-helpers-DhckT_PN.js";const Ht=L("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);const $t=L("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const we=L("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const Ie=L("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Ut=L("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),Gt="button:not([disabled]), a[href]",E="outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-sunken";function Yt({active:t,dimmed:s,indent:a}){return k("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors",E,a&&"pl-7",t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg",s&&"opacity-55")}function Jt({icon:t,label:s,count:a,active:n}){return e.jsxs(e.Fragment,{children:[t&&e.jsx("span",{className:k("shrink-0",n?"text-accent-2":"text-fg-subtle"),children:t}),e.jsx("span",{className:"flex-1 truncate",children:s}),a!=null&&a>0&&e.jsx("span",{className:k("text-2xs tabular-nums",n?"text-accent-2":"text-fg-subtle"),children:a})]})}function P({icon:t,label:s,count:a,active:n,dimmed:r,indent:o,navId:i,linkComponent:c,ariaLabel:h,title:d,onClick:g}){const x=Yt({active:n,dimmed:r,indent:o}),p=e.jsx(Jt,{icon:t,label:s,count:a,active:n});return i&&c?c({navId:i,className:x,ariaLabel:h??s,title:d,onClick:g,children:p}):e.jsx("button",{type:"button",onClick:g,className:x,"aria-label":h,title:d,children:p})}const ne={inbox:0,flagged:1,drafts:2,sent:3,archive:4,all:5,junk:6,trash:7};function Wt(t){switch(t){case"inbox":return e.jsx(Ke,{className:"size-4"});case"flagged":return e.jsx(pe,{className:"size-4"});case"drafts":return e.jsx(Be,{className:"size-4"});case"sent":return e.jsx(ge,{className:"size-4"});case"archive":return e.jsx(_e,{className:"size-4"});case"all":return e.jsx(De,{className:"size-4"});case"junk":return e.jsx(Fe,{className:"size-4"});case"trash":return e.jsx(Te,{className:"size-4"})}}const re=t=>t.role!=null,$=8,oe="remit.nav.folders.open.",ie="remit.nav.account.open.";function le(t,s,a){if(typeof localStorage>"u")return a;const n=localStorage.getItem(t+s);return n===null?a:n!=="0"}function ce(t,s,a){typeof localStorage>"u"||localStorage.setItem(t+s,a?"1":"0")}function Xt({query:t,onSelect:s,onRemove:a}){return e.jsxs("div",{className:"group flex w-full items-center gap-1 rounded-md pr-1 hover:bg-surface",children:[e.jsxs("button",{type:"button",onClick:s,className:k("flex min-w-0 flex-1 items-center gap-2 px-2 py-1 text-left text-sm text-fg-muted transition-colors hover:text-fg",E),children:[e.jsx(ze,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t})]}),a&&e.jsx("button",{type:"button",onClick:a,"aria-label":`Remove saved search: ${t}`,className:k("shrink-0 rounded-full p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-sunken hover:text-fg group-hover:opacity-100 focus-visible:opacity-100",E),children:e.jsx(be,{className:"size-3.5"})})]})}function Zt({savedSearches:t,saveableQuery:s,onSelectSavedSearch:a,onRemoveSavedSearch:n,onSaveCurrentSearch:r}){return t.length===0&&!s?null:e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"px-2 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Saved searches"}),s&&e.jsxs("button",{type:"button",onClick:r,className:k("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-accent transition-colors hover:bg-surface",E),children:[e.jsx(Ht,{className:"size-4 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["Save “",s,"”"]})]}),t.map(o=>e.jsx(Xt,{query:o,onSelect:()=>a?.(o),onRemove:n?()=>n(o):void 0},o))]})}function es({account:t,selectedNavId:s,onSelectNav:a,linkComponent:n}){const[r,o]=u.useState(()=>le(ie,t.id,!0)),[i,c]=u.useState(()=>le(oe,t.id,!0)),[h,d]=u.useState(!1),g=()=>{o(l=>{const S=!l;return ce(ie,t.id,S),S})},x=()=>{c(l=>{const S=!l;return ce(oe,t.id,S),S})},p=t.mailboxes.filter(re).sort((l,S)=>ne[l.role]-ne[S.role]),m=t.mailboxes.filter(l=>!re(l)),b=h||m.length<=$?m:m.slice(0,$),j=m.length-b.length,y=t.status??"ready",N=y==="ready"&&p.length===0&&m.length===0;return e.jsxs("div",{className:"mt-3",children:[e.jsxs("button",{type:"button",onClick:g,"aria-expanded":r,className:k("flex w-full items-center gap-1.5 px-2 pb-1 text-left transition-colors hover:text-fg",E,t.muted&&"opacity-55"),children:[r?e.jsx(ee,{className:"size-3 shrink-0 text-fg-subtle"}):e.jsx(te,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:t.label}),t.muted&&e.jsxs(e.Fragment,{children:[e.jsx(ft,{className:"size-3 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"text-2xs text-fg-subtle",children:"muted"})]})]}),r&&e.jsxs(e.Fragment,{children:[y==="loading"&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"Loading…"}),y==="error"&&e.jsxs("div",{role:"alert",className:"mx-2 my-1 flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-2 py-1.5 text-sm",children:[e.jsx(Le,{className:"mt-0.5 size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("p",{className:"font-medium text-danger",children:"Couldn't load mailboxes"})}),t.onRetry&&e.jsx("button",{type:"button",onClick:t.onRetry,className:"shrink-0 text-sm font-medium text-accent hover:underline",children:"Retry"})]}),N&&e.jsx("div",{className:"px-2 py-1 text-sm text-fg-muted",children:"No mailboxes"}),y==="ready"&&e.jsxs(e.Fragment,{children:[p.map(l=>e.jsx(P,{navId:l.id,linkComponent:n,icon:Wt(l.role),label:l.name,ariaLabel:l.name,title:l.fullPath??l.name,count:l.unseen,active:s===l.id,dimmed:t.muted,onClick:()=>a?.(l.id)},l.id)),t.outboxPending!==void 0&&e.jsx(P,{navId:"outbox",linkComponent:n,icon:e.jsx(ge,{className:"size-4"}),label:"Outbox",ariaLabel:"Outbox",count:t.outboxPending>0?t.outboxPending:void 0,active:s==="outbox",dimmed:t.muted,onClick:()=>a?.("outbox")}),m.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:x,"aria-expanded":i,className:k("mt-1 flex w-full items-center gap-1 px-2 py-1 text-left text-2xs font-semibold uppercase tracking-wider text-fg-subtle transition-colors hover:text-fg",E),children:[i?e.jsx(ee,{className:"size-3 shrink-0"}):e.jsx(te,{className:"size-3 shrink-0"}),e.jsx("span",{className:"flex-1",children:"Folders"}),e.jsx("span",{className:"tabular-nums opacity-70",children:m.length})]}),i&&e.jsxs(e.Fragment,{children:[b.map(l=>e.jsx(P,{navId:l.id,linkComponent:n,icon:e.jsx(Ae,{className:"size-4"}),label:l.name,ariaLabel:l.name,title:l.fullPath??l.name,count:l.unseen,active:s===l.id,dimmed:t.muted,onClick:()=>a?.(l.id)},l.id)),(j>0||h)&&m.length>$&&e.jsx("button",{type:"button",onClick:()=>d(l=>!l),className:k("ml-7 flex items-center px-2 py-1 text-2xs font-medium text-accent transition-colors hover:underline",E),children:h?"Show less":`Show all (${m.length})`})]})]})]})]})]})}function ts({accounts:t,selectedNavId:s,briefUnseen:a,onSelectNav:n,variant:r="desktop",linkComponent:o,calendarNav:i="hidden",savedSearches:c=[],saveableQuery:h,onSelectSavedSearch:d,onRemoveSavedSearch:g,onSaveCurrentSearch:x}){const p=u.useRef(null);Re({containerRef:p,itemSelector:Gt});const m=r==="drawer",b=e.jsxs("nav",{ref:m?p:void 0,className:m?"px-2 py-2":"flex-1 overflow-y-auto px-2 py-2","aria-label":"Mailboxes",children:[e.jsx(P,{navId:"brief",linkComponent:o,icon:e.jsx(Pe,{className:"size-4"}),label:"Daily brief",ariaLabel:"Daily brief",count:a,active:s==="brief",onClick:()=>n?.("brief")}),i==="shown"&&e.jsx(P,{navId:"calendar",linkComponent:o,icon:e.jsx($t,{className:"size-4"}),label:"Calendar",ariaLabel:"Calendar",active:s==="calendar",onClick:()=>n?.("calendar")}),e.jsx(P,{navId:"flagged",linkComponent:o,icon:e.jsx(pe,{className:"size-4"}),label:"Starred",ariaLabel:"Starred",active:s==="flagged",onClick:()=>n?.("flagged")}),e.jsx(Zt,{savedSearches:c,saveableQuery:h,onSelectSavedSearch:d,onRemoveSavedSearch:g,onSaveCurrentSearch:x}),t.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-sm text-fg-muted",children:"No accounts configured"}):t.map(j=>e.jsx(es,{account:j,selectedNavId:s,onSelectNav:n,linkComponent:o},j.id))]});return m?b:e.jsx("aside",{ref:p,className:"flex h-full w-full flex-col bg-surface-sunken",children:b})}function ss({leading:t,search:s,actions:a,className:n}){return e.jsxs("header",{className:k("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",n),children:[t&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:t}),e.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:e.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),a&&e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a})]})}function as(){const t=ve();if(!t)return null;const s=t.showNavPane?!t.navCollapsed:!1;return e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(Dt,{className:"size-4"}),onClick:t.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const ns={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function rs({search:t,onCompose:s,onReportBug:a,onOpenSettings:n,composeShortcut:r,refreshControl:o,account:i}){return e.jsx(ss,{leading:e.jsx(as,{}),search:e.jsx(pt,{value:t.value,onChange:t.onChange,onClear:t.onClear,onClearQuery:t.onClearQuery,chips:t.chips,onRemoveChip:t.onRemoveChip,placeholder:ns[t.scope]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(Ut,{className:"size-4"}),title:r?`Compose (${r})`:"Compose","aria-label":"Compose",onClick:s}),e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(ke,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:a}),e.jsx(F,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:n}),o,i]})})}function os(){const{pathname:t}=Qe(),s=Ve({from:"/mail/$mailboxId",shouldThrow:!1});return z(t,"/settings")?"settings":z(t,"/mail/outbox")?"outbox":z(t,"/mail/flagged")?"flagged":z(t,"/mail/brief")?"brief":s?.mailboxId??""}function is(){const t=qe(),s=U({select:d=>se(d.location.pathname)}),a=U({select:d=>He(d.location.search)}),[n,r]=u.useState(a),o=qt(n,200),[i,c]=u.useState(s);if(i!==s){const d=Pt(i,s,a);c(s),d!==void 0&&r(d)}const h=u.useCallback(d=>{c(se(t.state.location.pathname)),r(d)},[t]);return{searchInput:n,committedQuery:Rt(n,o),viewKey:s,setSearchInput:h}}const ls=()=>{const t=X();return $e()?null:e.jsx("button",{type:"button",onClick:t,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:e.jsx(Et,{className:"size-6"})})},Me=({children:t})=>{const{Account:s}=Ue();return e.jsx(s,{children:t})},cs=({email:t,onSignOut:s})=>{const a=t??"Account";return e.jsxs(gt,{trigger:e.jsx(_t,{name:a,email:t??void 0,size:"sm"}),align:"right",children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-2 text-xs text-fg-muted truncate",title:t,"data-testid":"account-menu-email",children:t}),e.jsx(bt,{})]}),e.jsxs(vt,{onClick:s,children:[e.jsx(we,{className:"size-4"}),"Sign out"]})]})},us=()=>e.jsx(Me,{children:({email:t,signOut:s})=>e.jsx(cs,{email:t,onSignOut:s})});function ds({accounts:t}){const{searchInput:s,onSearchChange:a,onSearchClear:n,onSearchClearQuery:r}=ye(),o=Bt(),i=X(),{scope:c,clearScope:h}=yt(t),d=c.kind==="scoped"?[{id:c.chip.id,label:c.chip.label,tone:"scope"}]:void 0,g=u.useMemo(()=>t.map(j=>j.accountId),[t]),{hasNewMail:x}=At(),{state:p,errorMessage:m,refresh:b}=zt(g);return e.jsx(rs,{search:{value:s,scope:c.kind,chips:d,onChange:a,onClear:n,onClearQuery:r,onRemoveChip:h},onCompose:i,onReportBug:je,onOpenSettings:()=>o("accounts"),composeShortcut:jt("compose"),refreshControl:e.jsx(Tt,{state:p,onRefresh:b,label:"Refresh all accounts",errorMessage:m,hasUpdate:x(g)}),account:e.jsx(us,{})})}const Z="remit.savedSearches",ms=25;function _(){try{const t=localStorage.getItem(Z);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(a=>typeof a=="string"):[]}catch{return[]}}function xs(t){const s=t.trim();if(!s)return _();const a=[s,..._().filter(n=>n!==s)].slice(0,ms);try{localStorage.setItem(Z,JSON.stringify(a))}catch{return a}return a}function hs(t){const s=_().filter(a=>a!==t);try{localStorage.setItem(Z,JSON.stringify(s))}catch{return s}return s}const ue=t=>/^\d/.test(t),fs=(t,s)=>{const a=ue(t),n=ue(s);return a&&!n?-1:!a&&n?1:t.localeCompare(s,void 0,{sensitivity:"base",numeric:!0})};function ps(t,s,a){const n=[],r=[];for(const o of t)s.has(o.mailboxId)?n.push(o):r.push(o);return r.sort((o,i)=>fs(G(o,void 0,a),G(i,void 0,a))),{system:n,labels:r}}function gs(t,s,a){const n=We(s)&&t.unseenCount>0;return{id:t.mailboxId,name:G(t,s,a),unseen:n?t.unseenCount:void 0,role:s,fullPath:t.fullPath}}function de({accounts:t,onMailboxSelect:s,variant:a="desktop"}){const n=Se(),r=St(),o=os(),{searchInput:i,onSearchChange:c}=ye(),[h,d]=u.useState(_),{t:g}=Ge("mail",{useSuspense:!1}),x=u.useCallback((f,C)=>g(f,{defaultValue:C}),[g]),p=W({queries:t.map(f=>({...J({path:{accountId:f.accountId}}),staleTime:1/0}))}),{data:m}=Ne(Ye()),b=u.useMemo(()=>(m?.items??[]).filter(f=>Qt(f.status)).length,[m?.items]),j=u.useMemo(()=>t.map((f,C)=>{const v=p[C],I=v?.data?.items??[],w=Je(f.folderAppointments),{system:M,labels:V}=ps(I,w,x),q=v?.isError?"error":v?.isLoading?"loading":"ready";return{id:f.accountId,label:f.email,email:f.email,muted:!!f.muted,outboxPending:b,status:q,onRetry:()=>v?.refetch(),mailboxes:[...M,...V].map(A=>gs(A,w.get(A.mailboxId),x))}}),[t,p,b,x]),y=f=>{n.invalidateQueries({queryKey:Xe({path:{mailboxId:f},query:{order:"desc"}})})},N=({navId:f,className:C,ariaLabel:v,title:I,children:w,onClick:M})=>f==="brief"?e.jsx(R,{to:"/mail/brief",search:{q:void 0},activeOptions:{includeSearch:!1},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="outbox"?e.jsx(R,{to:"/mail/outbox",search:{q:void 0},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="flagged"?e.jsx(R,{to:"/mail/flagged",search:{q:void 0},onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):f==="settings"?e.jsx(R,{to:"/settings/accounts",onClick:()=>M?.(),className:C,"aria-label":v,title:I,children:w}):e.jsx(R,{to:"/mail/$mailboxId",params:{mailboxId:f},search:{q:void 0},onClick:()=>{y(f),M?.()},className:C,"aria-label":v,title:I,children:w}),l=()=>{c(""),s?.()},S=i.trim(),O=S.length>0&&!h.includes(S)?S:void 0,B=u.useCallback(()=>{O&&d(xs(O))},[O]),K=u.useCallback(f=>{d(hs(f))},[]),Q=u.useCallback(f=>{c(f),r(f),s?.()},[c,r,s]);return e.jsx(ts,{accounts:j,selectedNavId:o,onSelectNav:l,linkComponent:N,variant:a,savedSearches:h,saveableQuery:O,onSaveCurrentSearch:B,onSelectSavedSearch:Q,onRemoveSavedSearch:K})}function bs(){return e.jsxs("button",{type:"button",onClick:je,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg",children:[e.jsx(ke,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Report a bug"})]})}function vs({accounts:t,onMailboxSelect:s}){return ve()?.showNavPane??!0?e.jsx(de,{accounts:t}):e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(de,{accounts:t,onMailboxSelect:s,variant:"drawer"})}),e.jsxs("div",{className:"border-t border-line px-2 py-2",children:[e.jsxs(R,{to:"/settings/accounts",onClick:s,children:[e.jsx(Ie,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Settings"})]}),e.jsx(bs,{}),e.jsx(Me,{children:({signOut:r})=>e.jsxs("button",{type:"button",onClick:()=>{s?.(),r()},className:"flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-sm text-fg-muted transition-colors hover:bg-surface hover:text-fg","data-testid":"sign-out-button",children:[e.jsx(we,{className:"size-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-left",children:"Sign out"})]})})]})]})}const ys=({isOpen:t,onClose:s})=>{const a=u.useCallback(n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),s())},[s]);return u.useEffect(()=>{if(t)return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[t,a]),t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx(Ze,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:k("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),e.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:e.jsx(be,{className:"size-5"})})]}),e.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:Nt.map(n=>e.jsxs("div",{children:[e.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:n.title}),e.jsx("div",{className:"space-y-2",children:n.hints.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm",children:r.description}),e.jsx("span",{className:"flex shrink-0 items-center gap-1",children:r.keys.map((o,i)=>e.jsxs(u.Fragment,{children:[i>0&&r.keys[0]==="g"&&e.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),e.jsx(ae,{children:o})]},o))})]},`${r.action}-${r.keys.join("+")}`))})]},n.title))}),e.jsx("div",{className:"mt-6 border-t border-line pt-4",children:e.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",e.jsx(ae,{children:"Esc"})," to close"]})})]})]}):null};function js(t){const s=W({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0}))});return u.useMemo(()=>Ct(s.map(a=>a.data?.items??[])),[s])}const Oe="remit:intelligence-open";function Ss(){try{return localStorage.getItem(Oe)!=="closed"}catch{return!0}}function Ns(t){try{localStorage.setItem(Oe,t?"open":"closed")}catch{}}function me({panels:t,prefersOpen:s,isDesktop:a,hasThread:n,raisedFor:r,openMessage:o}){return r!==null&&r===o?!0:t.length>0?t.includes("intelligence"):a&&n&&s}const Cs=()=>{const t=Ce(),s=et(),a=tt(),n=s.find(st),r=kt(),[o,i]=u.useState(Ss),c=r?`${r.threadId}/${r.messageId??""}`:null,[h,d]=u.useState(null),g={panels:s,prefersOpen:o,isDesktop:t==="desktop",hasThread:r!==void 0,openMessage:c},x=me({...g,raisedFor:h}),p=me({...g,raisedFor:null}),m=u.useCallback((N,l)=>{a([...N?["intelligence"]:[],...l?[l]:[]])},[a]),b=u.useCallback(N=>{m(p,N)},[p,m]),j=u.useCallback(()=>{if(x&&!p){d(null);return}const N=!x;Ns(N),i(N),d(null),m(N,n)},[p,x,n,m]),y=u.useCallback(()=>{d(c)},[c]);return{openOverlay:n,intelligenceOpen:x,showOverlay:b,toggleIntelligence:j,raiseIntelligence:y}},ks=t=>t.map(s=>s.data?.items??[]);function ws(t){const s=W({queries:t.map(a=>({...J({path:{accountId:a.accountId}}),staleTime:1/0})),combine:ks});return u.useMemo(()=>at(t.map((a,n)=>({folderAppointments:a.folderAppointments,mailboxes:s[n]??[]}))),[t,s])}var T={exports:{}},xe;function Is(){if(xe)return T.exports;xe=1;const t=(s,a,n)=>new Promise((r,o)=>{if(n=Object.assign({concurrency:1/0},n),typeof a!="function")throw new TypeError("Mapper function is required");const{concurrency:i}=n;if(!(typeof i=="number"&&i>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${i}\` (${typeof i})`);const c=[],h=s[Symbol.iterator]();let d=!1,g=!1,x=0,p=0;const m=()=>{if(d)return;const b=h.next(),j=p;if(p++,b.done){g=!0,x===0&&r(c);return}x++,Promise.resolve(b.value).then(y=>a(y,j)).then(y=>{c[j]=y,x--,m()},y=>{d=!0,o(y)})};for(let b=0;b<i&&(m(),!g);b++);});return T.exports=t,T.exports.default=t,T.exports}var Ms=Is();const Os=nt(Ms),Es=900*1e3,Rs=300,Ps=(t,s)=>{if(!t)return s;const a=Number.parseInt(t,10);return Number.isFinite(a)&&a>0?a:s},Ls=60*1e3,As=t=>Math.max(Ps(t,Rs)*1e3,Ls),D=As(ct().mailboxPollIntervalSeconds),zs=5,Y=new Set,Ts=(t,s,a=Es)=>t.filter(n=>{const r=n.lastSyncAt;return r==null?!0:s-r>a}).map(n=>n.accountId),Fs=(t,s,a=D)=>t-s>=a,Ds=(t,s)=>t.filter(a=>!s.has(a)),he=(t,s)=>{if(Y.delete(t),it(s,{softError:!0},"nobody")){lt(s);return}console.warn("[remit] background mailbox sync failed",{accountId:t,error:s})},fe=(t,s)=>rt({path:{accountId:t},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:ot({path:{accountId:t}})})}),_s=t=>{const s=Se(),a=u.useRef(t);a.current=t;const n=t.map(r=>r.accountId).join(",");u.useEffect(()=>{const r=Date.now(),i=Ts(a.current,r).filter(c=>!Y.has(c));if(i.length!==0)for(const c of i)Y.add(c),fe(c,s).catch(h=>{he(c,h)})},[n,s]),u.useEffect(()=>{let r=Date.now(),o;const i=new Set,c=()=>{r=Date.now();const g=Ds(a.current.map(x=>x.accountId),i);for(const x of g)i.add(x);Os(g,x=>fe(x,s).catch(p=>{he(x,p)}).finally(()=>{i.delete(x)}),{concurrency:zs})},h=()=>{if(document.visibilityState==="visible"){c(),o=setTimeout(h,D);return}},d=()=>{document.visibilityState==="visible"&&Fs(Date.now(),r)&&(o!==void 0&&clearTimeout(o),c(),o=setTimeout(h,D))};return o=setTimeout(h,D),document.addEventListener("visibilitychange",d),()=>{o!==void 0&&clearTimeout(o),document.removeEventListener("visibilitychange",d)}},[n,s])};function oa(){const t=ut(),s=Ce(),a=Mt(s),{openOverlay:n,intelligenceOpen:r,showOverlay:o,toggleIntelligence:i,raiseIntelligence:c}=Cs(),h=n==="shortcuts",d=n==="nav",{searchInput:g,committedQuery:x,viewKey:p,setSearchInput:m}=is(),{data:b,isLoading:j,isError:y,error:N,refetch:l}=Ne({...dt(),staleTime:1/0}),S=!!(b&&(b.accounts?.length??0)===0);u.useEffect(()=>{S&&t({to:"/onboarding",replace:!0})},[S,t]),Kt({enabled:!h,bindings:[{key:"?",handler:()=>o("shortcuts"),noModifiers:!1,preventDefault:!0}]});const O=X(),B=Ot(),K=U({select:H=>mt(H.matches)?.list==="mailbox"}),Q=u.useMemo(()=>({compose:O}),[O]);wt({enabled:!K&&!B,handlers:Q});const f=u.useCallback(()=>{m("")},[m]),C=u.useCallback(()=>{m("")},[m]),v=b?.accounts??[],I=u.useMemo(()=>v.map(H=>H.accountId),[v]),w=js(v),M=ws(v),V=u.useMemo(()=>It(v),[v]);_s(v);const q=u.useCallback(()=>{n==="nav"&&o(void 0)},[n,o]),A={accounts:v,mailboxNameIndex:w,accountNameIndex:V,resultFolderIndex:M,searchQuery:x,searchInput:g,searchViewKey:p,onSearchChange:m,onSearchClear:f,onSearchClearQuery:C,intelligenceOpen:r,onToggleIntelligence:i,onRaiseIntelligence:c},Ee={isSinglePane:a,isLoading:j||S,intelligenceOpen:r,nav:e.jsx(vs,{accounts:v,onMailboxSelect:q}),topBar:a?void 0:e.jsx(ds,{accounts:v}),overlay:a?e.jsx(ls,{}):void 0,navOpen:d,onOpenNav:()=>o("nav"),onCloseNav:()=>o(void 0)};return e.jsx(xt.Provider,{value:A,children:e.jsxs(Ft,{accountIds:I,children:[y?e.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:e.jsx(Vt,{title:"Couldn't load your account",error:N,onRetry:()=>{l()}})}):e.jsx(Lt,{chrome:Ee,children:e.jsx(ht,{})}),e.jsx(ys,{isOpen:h,onClose:()=>o(void 0)})]})})}export{oa as component,ye as useMailContext};
@@ -1 +1 @@
1
- import{c as e}from"./index-CKl3LWp1.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};
1
+ import{c as e}from"./index-ARKuDM1Z.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};
@@ -1 +1 @@
1
- import{c as e}from"./index-CKl3LWp1.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};
1
+ import{c as e}from"./index-ARKuDM1Z.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};
@@ -1 +1 @@
1
- import{a5 as n,a6 as r,x as a,r as i,j as s}from"./index-CKl3LWp1.js";import{O as c}from"./OnboardingWizard-CK5CYAnq.js";import"./kbd-O3V-B_3F.js";import"./account-form-helpers-DhckT_PN.js";import"./mail-DGAASK-j.js";async function m(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:n()}),e.navigateToInbox()}function C(){const e=r(),o=a(),t=i.useCallback(l=>{m({queryClient:o,recordCompleted:()=>e.recordEvent("onboarding.completed"),navigateToInbox:()=>{window.location.assign("/mail")}})},[e,o]);return s.jsx(c,{skipWelcome:!1,onComplete:t})}export{C as component};
1
+ import{a5 as n,a6 as r,x as a,r as i,j as s}from"./index-ARKuDM1Z.js";import{O as c}from"./OnboardingWizard-XOalGtp8.js";import"./kbd-CAJ-SREr.js";import"./account-form-helpers-DhckT_PN.js";import"./mail-wi6czXl8.js";async function m(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:n()}),e.navigateToInbox()}function C(){const e=r(),o=a(),t=i.useCallback(l=>{m({queryClient:o,recordCompleted:()=>e.recordEvent("onboarding.completed"),navigateToInbox:()=>{window.location.assign("/mail")}})},[e,o]);return s.jsx(c,{skipWelcome:!1,onComplete:t})}export{C as component};
@@ -0,0 +1 @@
1
+ import{j as o,a4 as i}from"./index-ARKuDM1Z.js";import{a as m}from"./MailShell-Bd1kL-Up.js";import{u as p,O as t}from"./OutboxPane-DtKFhs0V.js";import{u as s}from"./search-mirror-C2okHgQR.js";import"./FullCompose-CKOPv_qc.js";import"./ErrorState-C6npTXjw.js";import"./index-CGKUKLu6.js";import"./useMessageBodyContent-B6r0Xy1W.js";import"./useSignature-B2LbrkV9.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-DRP8Ll3V.js";import"./confirm-dialog-BH7Kc4v5.js";import"./useSearchTokenContext-DeUV80u1.js";import"./kbd-CAJ-SREr.js";import"./search-scope-DTcpOp3S.js";import"./circle-check-big-BA1xfQ4O.js";import"./clock-Bg0F1_jO.js";import"./row-actions-oMrNzr_M.js";import"./rotate-ccw-BAbqhDs-.js";import"./NavMenuButton-BBv_d9qJ.js";import"./menu-DMsGK9e8.js";import"./format-23Av07Go.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function q(){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{q as component};
@@ -1 +1 @@
1
- import{c as a}from"./index-CKl3LWp1.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
+ import{c as a}from"./index-ARKuDM1Z.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};