@remit/web-client-dist 0.0.497 → 0.0.498

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 (141) hide show
  1. package/assets/{BriefPane-C1YHZUAd.js → BriefPane-DNjYoZ5W.js} +1 -1
  2. package/assets/{CalendarComposePane-VeLWQkta.js → CalendarComposePane-DSTGkUg1.js} +1 -1
  3. package/assets/{CalendarComposeSeed-675yfCbg.js → CalendarComposeSeed-D2-h5yfx.js} +1 -1
  4. package/assets/{CalendarShell-xNMmpbgB.js → CalendarShell-hxAj3RCw.js} +1 -1
  5. package/assets/{EmptyState-CegqC3j2.js → EmptyState-BNZ4rODe.js} +1 -1
  6. package/assets/{ErrorState-BGolGYcc.js → ErrorState-BtilFfMz.js} +1 -1
  7. package/assets/{FlaggedPane-DaORUctH.js → FlaggedPane-vVIomL6t.js} +1 -1
  8. package/assets/{FullCompose-DqLTXvyP.js → FullCompose-BYAe64Df.js} +1 -1
  9. package/assets/{MailListHeader-Dhgkq9td.js → MailListHeader-D3XzKKg6.js} +1 -1
  10. package/assets/{MailNav-BPZ--2Zq.js → MailNav-CddPjjRg.js} +1 -1
  11. package/assets/{MailShell-Cd-aCKBf.js → MailShell-PzyuiJnk.js} +1 -1
  12. package/assets/{MailViewChrome-J4bT_B41.js → MailViewChrome-BCGNFEJ0.js} +1 -1
  13. package/assets/{MailboxPane-dSxHZfJq.js → MailboxPane-Cei3VENC.js} +1 -1
  14. package/assets/{NavMenuButton-CqSZuMpN.js → NavMenuButton-Dbn2UxrU.js} +1 -1
  15. package/assets/{OnboardingWizard-bzjJS9rU.js → OnboardingWizard-j_6mMm1N.js} +1 -1
  16. package/assets/{OpenCalendarEvent-DHCCZvs1.js → OpenCalendarEvent-B3jr425h.js} +1 -1
  17. package/assets/{OutboxPane-BFHcQFSQ.js → OutboxPane-C5btZSEO.js} +1 -1
  18. package/assets/_calendarObjectId-Flm4StBb.js +1 -0
  19. package/assets/_mailboxId-u-CcdMke.js +1 -0
  20. package/assets/_messageId-BCaXGBWT.js +1 -0
  21. package/assets/_messageId-BOvqtCYe.js +1 -0
  22. package/assets/_messageId-fMj5eWC0.js +1 -0
  23. package/assets/_outboxMessageId-CoX2Gzjj.js +1 -0
  24. package/assets/_recurrenceId-BRpcgOng.js +1 -0
  25. package/assets/_threadId-7T2GLnpU.js +1 -0
  26. package/assets/_threadId-CBYj8trN.js +1 -0
  27. package/assets/_threadId-CEF_Qhob.js +1 -0
  28. package/assets/{_view._date-CNtQuag8.js → _view._date-Cf-AYmIb.js} +1 -1
  29. package/assets/{accounts-BFZIBw9t.js → accounts-DngJbEU8.js} +1 -1
  30. package/assets/{advanced-DHRgNnGq.js → advanced-B0OaWYz_.js} +1 -1
  31. package/assets/{appearance--2gV-DqW.js → appearance-DGCy4Ols.js} +1 -1
  32. package/assets/{attachment-file-QQZovKAl.js → attachment-file-BJFaXvRO.js} +1 -1
  33. package/assets/{avatar-klLMB_Me.js → avatar-C10lunoa.js} +1 -1
  34. package/assets/{bottom-sheet-CRsV78aJ.js → bottom-sheet-8IzLQias.js} +1 -1
  35. package/assets/brief-BesAXTmU.js +1 -0
  36. package/assets/{brief-pxbBSjyV.js → brief-DaHBrlcF.js} +1 -1
  37. package/assets/{browser-ponyfill-rQg15kf2.js → browser-ponyfill-BM7kTsvb.js} +1 -1
  38. package/assets/{bug-ECDjr3jW.js → bug-CixXpMeP.js} +1 -1
  39. package/assets/{calendar-YiaPuzno.js → calendar-S6kyPLhs.js} +1 -1
  40. package/assets/{calendar-days-oK-1rKbM.js → calendar-days-DUJNDPSw.js} +1 -1
  41. package/assets/{card-GNRohr9F.js → card-BXw0pcK1.js} +1 -1
  42. package/assets/chevron-left-D_5sOBUq.js +1 -0
  43. package/assets/{circle-check-D_bOnWVf.js → circle-check-CozsCqWq.js} +1 -1
  44. package/assets/{circle-check-big-CvyTX3eu.js → circle-check-big-BSzMiP3i.js} +1 -1
  45. package/assets/{circle-help-rRKfilDF.js → circle-help-MoXjqXC8.js} +1 -1
  46. package/assets/{clock-CV2mIEQ0.js → clock-Bvb6Om5r.js} +1 -1
  47. package/assets/compose._-_outboxMessageId_-BX_0wEq1.js +1 -0
  48. package/assets/compose._-_outboxMessageId_-Baq34Jvz.js +1 -0
  49. package/assets/compose._-_outboxMessageId_-CEw8Zb9K.js +1 -0
  50. package/assets/compose._-_outboxMessageId_-CxDpFeHx.js +1 -0
  51. package/assets/{config-import-s1ErxyaK.js → config-import-DfOMslTV.js} +1 -1
  52. package/assets/{confirm-dialog-PyqpaetG.js → confirm-dialog-DzL02Vjs.js} +1 -1
  53. package/assets/{credential-steps-BiPyTE8I.js → credential-steps-Rb1Gb-Ws.js} +1 -1
  54. package/assets/{download-DdbznPAS.js → download-CKBt5eu3.js} +1 -1
  55. package/assets/{filters-SuJREA5G.js → filters-D1iPdv1S.js} +1 -1
  56. package/assets/flagged-epo_-OxW.js +1 -0
  57. package/assets/{flagged-DPX_qlUe.js → flagged-l4VdJzPS.js} +1 -1
  58. package/assets/{folders-qoxhQhfr.js → folders-B9-YqZNQ.js} +1 -1
  59. package/assets/{format-RgJz8yFq.js → format-DFEg2Asu.js} +1 -1
  60. package/assets/{help-copy-DdhDXdzQ.js → help-copy-BsWUoxcn.js} +1 -1
  61. package/assets/{import-B0ywsXJp.js → import-Cc_e1rgM.js} +1 -1
  62. package/assets/index-B9n_MbKU.js +1 -0
  63. package/assets/index-BOvqtCYe.js +1 -0
  64. package/assets/{index-RbY7Dn0X.js → index-BWh7aDGG.js} +4 -4
  65. package/assets/index-BgAbxvA6.js +1 -0
  66. package/assets/index-CFwCdjRG.js +1 -0
  67. package/assets/index-Ch288Whh.js +1 -0
  68. package/assets/index-CyBiXjjG.js +1 -0
  69. package/assets/{index-8Di8quRN.js → index-DDoWXOJ7.js} +1 -1
  70. package/assets/{index-DMZ8-zZM.js → index-DFvn5y4c.js} +61 -61
  71. package/assets/index-DHqDBfkh.js +1 -0
  72. package/assets/{index-BvZRCv6K.css → index-DpaL-MoP.css} +1 -1
  73. package/assets/index-OD5aeYXB.js +1 -0
  74. package/assets/index-fMj5eWC0.js +1 -0
  75. package/assets/{kbd-BV5q0Za-.js → kbd-Mu7aD0zn.js} +1 -1
  76. package/assets/{labels-Dgk62TQB.js → labels-L3wr6N4n.js} +1 -1
  77. package/assets/{mail-C2pH_nIp.js → mail-CDXuVNl4.js} +1 -1
  78. package/assets/{mail-Bff0HSL7.js → mail-Ct-zdzf2.js} +1 -1
  79. package/assets/{menu-DqCvhoo6.js → menu-DFNsLG9c.js} +1 -1
  80. package/assets/minus-Cs6nlfdI.js +1 -0
  81. package/assets/{new-zGcaCoRf.js → new-D7QYk2TX.js} +1 -1
  82. package/assets/{onboarding-completion-0kUxmKoQ.js → onboarding-completion-CzzOWbYc.js} +1 -1
  83. package/assets/onboarding-xSAXm8e1.js +1 -0
  84. package/assets/outbox-Ce2laBsJ.js +1 -0
  85. package/assets/{pencil-D2wigVut.js → pencil-YivqEktR.js} +1 -1
  86. package/assets/{rich-text-spellcheck-worker-provider-CJdp1lGc.js → rich-text-spellcheck-worker-provider-CsFzO-Ew.js} +1 -1
  87. package/assets/{rich-text-DJZuCFUV.js → rich-text-vk4lTQ_B.js} +1 -1
  88. package/assets/{rotate-ccw-BRLfH-fd.js → rotate-ccw-fMBtK9xi.js} +1 -1
  89. package/assets/{row-actions-DO7n5J0t.js → row-actions-BPRaCwIJ.js} +1 -1
  90. package/assets/{search-mirror-NOSJLcGR.js → search-mirror-Bz6Il7CV.js} +1 -1
  91. package/assets/{search-token-index-BQBAjCB1.js → search-token-index-BRDoS9VF.js} +1 -1
  92. package/assets/{sections-DVKafU2-.js → sections-DrfTHCE6.js} +1 -1
  93. package/assets/{senders-BAu3RfQ0.js → senders-FYL7OE3R.js} +1 -1
  94. package/assets/settings-DERpxXeE.js +1 -0
  95. package/assets/{settings-screen-BZEszQ1s.js → settings-screen-BymHQPcS.js} +1 -1
  96. package/assets/{shield-check-BM5CxZVS.js → shield-check-Dbo34YEZ.js} +1 -1
  97. package/assets/{suggested-vips-9wJhynOD.js → suggested-vips-DX_mBgNr.js} +1 -1
  98. package/assets/{useCalendarData-C2e-a6YP.js → useCalendarData-CfICbH_6.js} +1 -1
  99. package/assets/{useCalendars-BruqGaWc.js → useCalendars-DaisNzpy.js} +1 -1
  100. package/assets/{useDebouncedValue-BBOZojyy.js → useDebouncedValue-BABSGNK2.js} +1 -1
  101. package/assets/{useFilters-D8luT8sB.js → useFilters-rv_7K9Kl.js} +1 -1
  102. package/assets/{useLabels-DbWrQIbS.js → useLabels-kCEP9iG0.js} +1 -1
  103. package/assets/{useLayoutTier-DKpSXts5.js → useLayoutTier-BJPTvUFH.js} +1 -1
  104. package/assets/{useMessageBodyContent-DxQjkGza.js → useMessageBodyContent-DlWOVC8_.js} +1 -1
  105. package/assets/{useQueries-Baii11SK.js → useQueries-C-FWQch-.js} +1 -1
  106. package/assets/{useRefreshControl-DKnu6drF.js → useRefreshControl-oC54L2Ym.js} +1 -1
  107. package/assets/{useSearchTokenContext-DohJINg2.js → useSearchTokenContext-UVHviDZf.js} +1 -1
  108. package/assets/{useSemanticSearch-DfxdKsNk.js → useSemanticSearch-BDhxqv3J.js} +1 -1
  109. package/assets/{useSignature-At1N2nkq.js → useSignature-DNDSJmLZ.js} +1 -1
  110. package/index.html +2 -2
  111. package/package.json +1 -1
  112. package/assets/_calendarObjectId-DB4s52e7.js +0 -1
  113. package/assets/_mailboxId-_UuyonBt.js +0 -1
  114. package/assets/_messageId-C2mL362O.js +0 -1
  115. package/assets/_messageId-DoUX-Wpm.js +0 -1
  116. package/assets/_messageId-QtN4lnMz.js +0 -1
  117. package/assets/_outboxMessageId-u04H30d0.js +0 -1
  118. package/assets/_recurrenceId-p4xgYlsW.js +0 -1
  119. package/assets/_threadId-B52u4ZGm.js +0 -1
  120. package/assets/_threadId-DyxmoTSp.js +0 -1
  121. package/assets/_threadId-NYak8BAJ.js +0 -1
  122. package/assets/brief-CK2Ag4aM.js +0 -1
  123. package/assets/chevron-left-CK510N2A.js +0 -1
  124. package/assets/compose._-_outboxMessageId_-BhZ6kS29.js +0 -1
  125. package/assets/compose._-_outboxMessageId_-CF-uuezv.js +0 -1
  126. package/assets/compose._-_outboxMessageId_-CmYl260X.js +0 -1
  127. package/assets/compose._-_outboxMessageId_-D-vZ8Vfz.js +0 -1
  128. package/assets/flagged-BnnTqpKk.js +0 -1
  129. package/assets/index-3Cm_Sair.js +0 -1
  130. package/assets/index-BU1mrVnk.js +0 -1
  131. package/assets/index-BdhP6zUj.js +0 -1
  132. package/assets/index-C61kVhwz.js +0 -1
  133. package/assets/index-DFBSDyEq.js +0 -1
  134. package/assets/index-DZxBsRSE.js +0 -1
  135. package/assets/index-DoUX-Wpm.js +0 -1
  136. package/assets/index-QtN4lnMz.js +0 -1
  137. package/assets/index-RlCFATZr.js +0 -1
  138. package/assets/minus-DTWvP8bv.js +0 -1
  139. package/assets/onboarding-DN1fXIpr.js +0 -1
  140. package/assets/outbox-CuXqTLiE.js +0 -1
  141. package/assets/settings-BbKjeZZu.js +0 -1
@@ -0,0 +1 @@
1
+ import{ec as o,j as r}from"./index-DFvn5y4c.js";import{O as m}from"./OpenCalendarEvent-B3jr425h.js";import"./CalendarComposePane-DSTGkUg1.js";import"./useCalendars-DaisNzpy.js";import"./ErrorState-BtilFfMz.js";import"./avatar-C10lunoa.js";import"./minus-Cs6nlfdI.js";import"./clock-Bvb6Om5r.js";import"./useCalendarData-CfICbH_6.js";import"./useQueries-C-FWQch-.js";import"./mail-Ct-zdzf2.js";import"./pencil-YivqEktR.js";import"./calendar-days-DUJNDPSw.js";function E(){const{calendarObjectId:t}=o.useParams();return r.jsx(m,{calendarObjectId:t})}export{E as component};
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-DFvn5y4c.js";import{F as r}from"./FlaggedPane-vVIomL6t.js";import"./useSearchTokenContext-UVHviDZf.js";import"./kbd-Mu7aD0zn.js";import"./useMessageBodyContent-DlWOVC8_.js";import"./search-scope-B5-OK3Cq.js";import"./MailListHeader-D3XzKKg6.js";import"./search-token-index-BRDoS9VF.js";import"./useLayoutTier-BJPTvUFH.js";import"./useQueries-C-FWQch-.js";import"./attachment-file-BJFaXvRO.js";import"./mail-Ct-zdzf2.js";import"./avatar-C10lunoa.js";import"./index-BWh7aDGG.js";import"./useSignature-DNDSJmLZ.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-BABSGNK2.js";import"./sections-DrfTHCE6.js";import"./format-DFEg2Asu.js";import"./EmptyState-BNZ4rODe.js";import"./ErrorState-BtilFfMz.js";import"./download-CKBt5eu3.js";import"./shield-check-Dbo34YEZ.js";import"./useFilters-rv_7K9Kl.js";import"./minus-Cs6nlfdI.js";import"./confirm-dialog-DzL02Vjs.js";import"./clock-Bvb6Om5r.js";import"./menu-DFNsLG9c.js";import"./MailViewChrome-BCGNFEJ0.js";import"./wizard-selection-B1bng5Jq.js";function B(){return o.jsx(r.Reading,{})}export{B as component};
@@ -1 +1 @@
1
- import{j as n,t as s}from"./index-DMZ8-zZM.js";function x({className:e,...t}){return n.jsx("kbd",{className:s("inline-flex h-4 min-w-4 items-center justify-center rounded-xs border border-line bg-surface-sunken px-1 font-sans text-2xs text-fg-muted",e),...t})}export{x as K};
1
+ import{j as n,t as s}from"./index-DFvn5y4c.js";function x({className:e,...t}){return n.jsx("kbd",{className:s("inline-flex h-4 min-w-4 items-center justify-center rounded-xs border border-line bg-surface-sunken px-1 font-sans text-2xs text-fg-muted",e),...t})}export{x as K};
@@ -1 +1 @@
1
- import{r as f,j as e,ay as h,be as y,ax as b,bB as g,f as v,a2 as N,u as C,c as L,d as I,aK as D,aM as S,B as w}from"./index-DMZ8-zZM.js";import{C as E}from"./confirm-dialog-PyqpaetG.js";import{S as $}from"./settings-screen-BZEszQ1s.js";import{E as j}from"./ErrorState-BGolGYcc.js";import{a as T,b as k,c as R,u as B}from"./useLabels-DbWrQIbS.js";import"./avatar-klLMB_Me.js";import"./chevron-left-CK510N2A.js";import"./menu-DqCvhoo6.js";import"./circle-help-rRKfilDF.js";function O({labels:l,onRename:i,onRecolor:n,onDelete:m,deletingLabelId:c}){const[u,r]=f.useState(),[o,d]=f.useState("");if(l.length===0)return e.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No labels yet. Create one below, then use it in a filter or apply it to mail directly."});const t=a=>{const s=o.trim();s!==""&&i(a,s),r(void 0)};return e.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:l.map(a=>e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[u===a.labelId?e.jsx(h,{autoFocus:!0,value:o,onChange:s=>d(s.target.value),onBlur:()=>t(a.labelId),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),t(a.labelId)),s.key==="Escape"&&(s.preventDefault(),r(void 0))},"aria-label":`Rename label ${a.name}`}):e.jsx("button",{type:"button",onClick:()=>{r(a.labelId),d(a.name)},"aria-label":`Rename label ${a.name}`,className:"flex items-center gap-2 rounded-sm text-left hover:opacity-80",children:e.jsx(y,{label:a})}),e.jsx("p",{className:"mt-0.5 text-xs text-fg-subtle",children:a.filterCount===0?"Not used in any filter":`Used in ${a.filterCount} ${a.filterCount===1?"filter":"filters"}`})]}),e.jsx(b,{"aria-label":`Color for ${a.name}`,value:a.color,onChange:s=>n(a.labelId,s.target.value),className:"w-28 shrink-0",children:g.map(s=>e.jsx("option",{value:s,children:s},s))}),e.jsx(v,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4 text-danger"}),onClick:()=>m(a),disabled:c===a.labelId,"aria-label":`Delete label ${a.name}`})]},a.labelId))})}const P=(l,i)=>{if(i===0)return{title:`Delete the "${l}" label?`};const n=i===1?"filter":"filters";return{title:`Delete the "${l}" label?`,description:`This also deletes ${i} ${n} that ${i===1?"applies":"apply"} it — they can't be recovered.`}},_=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Labels mark mail without moving it — a message can carry any number of them alongside whichever folder it lives in."}),e.jsx("p",{children:"Use a label in a filter's action to have new (and existing) mail label itself automatically, or apply one to a selection directly from the mailbox."}),e.jsx("p",{children:"Deleting a label removes it from every message, and deletes every filter that applies it — the confirmation names how many."})]});function H({accountId:l}){const{createLabel:i,isPending:n,isError:m}=B(l),[c,u]=f.useState(""),[r,o]=f.useState("Default"),d=()=>{const t=c.trim();t!==""&&i(t,r).then(()=>{u(""),o("Default")})};return e.jsxs("div",{className:"space-y-2 rounded-sm border border-line bg-surface p-3",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"New label"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Name"}),e.jsx(h,{value:c,onChange:t=>u(t.target.value),placeholder:"e.g. Receipts","aria-label":"Label name",onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),d())}})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Color"}),e.jsx(b,{value:r,onChange:t=>o(t.target.value),"aria-label":"Label color",className:"w-28",children:g.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx(v,{variant:"primary",onClick:d,disabled:n||c.trim()==="",children:n?"Creating…":"Create label"})]}),m&&e.jsx(w,{tone:"danger",variant:"soft",children:"Couldn't create that label. Please try again."})]})}function M({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(O,{labels:n,onRename:(p,x)=>o(p,{name:x}),onRecolor:(p,x)=>o(p,{color:x}),onDelete:s,deletingLabelId:t}),e.jsx(H,{accountId:i}),a&&(()=>{const p=P(a.name,a.filterCount);return e.jsx(E,{isOpen:!0,title:p.title,description:p.description,confirmLabel:"Delete label",destructive:!0,isBusy:t===a.labelId,onConfirm:()=>{d(a.labelId),s(void 0)},onCancel:()=>s(void 0)})})()]})}function J(){const l=C(),[i,n]=f.useState(!0),{data:m,isPending:c,isError:u,error:r,refetch:o}=L(I()),d=t=>{const a=S[t];a&&l({to:a})};return e.jsx($,{items:D,activeId:"labels",title:"Labels",description:"Mark mail without moving it, per account.",help:_,helpOpen:i,onToggleHelp:()=>n(t=>!t),onSelect:d,onBackToMail:()=>{l({to:"/mail"})},children:c?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):u?e.jsx(j,{title:"Couldn't load accounts",error:r,onRetry:()=>{o()}}):m.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:m.accounts.map(t=>e.jsx(M,{account:t},t.accountId))})})}export{J as component};
1
+ import{r as f,j as e,ay as h,be as y,ax as b,bB as g,f as v,a2 as N,u as C,c as L,d as I,aK as D,aM as S,B as w}from"./index-DFvn5y4c.js";import{C as E}from"./confirm-dialog-DzL02Vjs.js";import{S as $}from"./settings-screen-BymHQPcS.js";import{E as j}from"./ErrorState-BtilFfMz.js";import{a as T,b as k,c as R,u as B}from"./useLabels-kCEP9iG0.js";import"./avatar-C10lunoa.js";import"./chevron-left-D_5sOBUq.js";import"./menu-DFNsLG9c.js";import"./circle-help-MoXjqXC8.js";function O({labels:l,onRename:i,onRecolor:n,onDelete:m,deletingLabelId:c}){const[u,r]=f.useState(),[o,d]=f.useState("");if(l.length===0)return e.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No labels yet. Create one below, then use it in a filter or apply it to mail directly."});const t=a=>{const s=o.trim();s!==""&&i(a,s),r(void 0)};return e.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:l.map(a=>e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[u===a.labelId?e.jsx(h,{autoFocus:!0,value:o,onChange:s=>d(s.target.value),onBlur:()=>t(a.labelId),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),t(a.labelId)),s.key==="Escape"&&(s.preventDefault(),r(void 0))},"aria-label":`Rename label ${a.name}`}):e.jsx("button",{type:"button",onClick:()=>{r(a.labelId),d(a.name)},"aria-label":`Rename label ${a.name}`,className:"flex items-center gap-2 rounded-sm text-left hover:opacity-80",children:e.jsx(y,{label:a})}),e.jsx("p",{className:"mt-0.5 text-xs text-fg-subtle",children:a.filterCount===0?"Not used in any filter":`Used in ${a.filterCount} ${a.filterCount===1?"filter":"filters"}`})]}),e.jsx(b,{"aria-label":`Color for ${a.name}`,value:a.color,onChange:s=>n(a.labelId,s.target.value),className:"w-28 shrink-0",children:g.map(s=>e.jsx("option",{value:s,children:s},s))}),e.jsx(v,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4 text-danger"}),onClick:()=>m(a),disabled:c===a.labelId,"aria-label":`Delete label ${a.name}`})]},a.labelId))})}const P=(l,i)=>{if(i===0)return{title:`Delete the "${l}" label?`};const n=i===1?"filter":"filters";return{title:`Delete the "${l}" label?`,description:`This also deletes ${i} ${n} that ${i===1?"applies":"apply"} it — they can't be recovered.`}},_=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Labels mark mail without moving it — a message can carry any number of them alongside whichever folder it lives in."}),e.jsx("p",{children:"Use a label in a filter's action to have new (and existing) mail label itself automatically, or apply one to a selection directly from the mailbox."}),e.jsx("p",{children:"Deleting a label removes it from every message, and deletes every filter that applies it — the confirmation names how many."})]});function H({accountId:l}){const{createLabel:i,isPending:n,isError:m}=B(l),[c,u]=f.useState(""),[r,o]=f.useState("Default"),d=()=>{const t=c.trim();t!==""&&i(t,r).then(()=>{u(""),o("Default")})};return e.jsxs("div",{className:"space-y-2 rounded-sm border border-line bg-surface p-3",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"New label"}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Name"}),e.jsx(h,{value:c,onChange:t=>u(t.target.value),placeholder:"e.g. Receipts","aria-label":"Label name",onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),d())}})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Color"}),e.jsx(b,{value:r,onChange:t=>o(t.target.value),"aria-label":"Label color",className:"w-28",children:g.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx(v,{variant:"primary",onClick:d,disabled:n||c.trim()==="",children:n?"Creating…":"Create label"})]}),m&&e.jsx(w,{tone:"danger",variant:"soft",children:"Couldn't create that label. Please try again."})]})}function M({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(O,{labels:n,onRename:(p,x)=>o(p,{name:x}),onRecolor:(p,x)=>o(p,{color:x}),onDelete:s,deletingLabelId:t}),e.jsx(H,{accountId:i}),a&&(()=>{const p=P(a.name,a.filterCount);return e.jsx(E,{isOpen:!0,title:p.title,description:p.description,confirmLabel:"Delete label",destructive:!0,isBusy:t===a.labelId,onConfirm:()=>{d(a.labelId),s(void 0)},onCancel:()=>s(void 0)})})()]})}function J(){const l=C(),[i,n]=f.useState(!0),{data:m,isPending:c,isError:u,error:r,refetch:o}=L(I()),d=t=>{const a=S[t];a&&l({to:a})};return e.jsx($,{items:D,activeId:"labels",title:"Labels",description:"Mark mail without moving it, per account.",help:_,helpOpen:i,onToggleHelp:()=>n(t=>!t),onSelect:d,onBackToMail:()=>{l({to:"/mail"})},children:c?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):u?e.jsx(j,{title:"Couldn't load accounts",error:r,onRetry:()=>{o()}}):m.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:m.accounts.map(t=>e.jsx(M,{account:t},t.accountId))})})}export{J as component};
@@ -1 +1 @@
1
- import{e as te,j as t,t as F,v as ne,f as I,w as oe,x as M,r as u,y as R,z as ae,A as re,C as ie,h as Q,D as ce,E as le,F as ue,X as de,G as K,a as me,b as pe,H as he,J as fe,K as xe,M as ge,N as be,P as ve,Q as ye,R as Se,u as je,c as Ce,d as Ie,S as Ne,O as we,T as Me}from"./index-DMZ8-zZM.js";import{S as Ee,D as Oe,a as Pe,b as Re,u as Te,s as ke,i as Le,t as Ae,K as De,c as Fe,d as Qe,e as Ke,f as _e}from"./search-token-index-BQBAjCB1.js";import{u as O,a as ze}from"./useMessageBodyContent-DxQjkGza.js";import{P as Be}from"./pencil-D2wigVut.js";import{c as He,s as Ve,M as qe}from"./MailShell-Cd-aCKBf.js";import{u as $e,a as Ge,R as Ue,s as We,i as Ye,H as Je,M as Xe}from"./useRefreshControl-DKnu6drF.js";import{M as Ze}from"./menu-DqCvhoo6.js";import{B as es}from"./bug-ECDjr3jW.js";import{S as ss,A as ts,L as ns,M as os}from"./MailNav-BPZ--2Zq.js";import{A as as}from"./avatar-klLMB_Me.js";import{u as rs}from"./sections-DVKafU2-.js";import{E as is}from"./ErrorState-BGolGYcc.js";import{K as T}from"./kbd-BV5q0Za-.js";import{u as cs}from"./index-RbY7Dn0X.js";import{u as _,i as ls}from"./useLayoutTier-DKpSXts5.js";import{u as z}from"./useQueries-Baii11SK.js";import{u as us}from"./useDebouncedValue-BBOZojyy.js";import"./search-scope-B5-OK3Cq.js";import"./FullCompose-DqLTXvyP.js";import"./confirm-dialog-PyqpaetG.js";import"./circle-check-big-CvyTX3eu.js";import"./calendar-days-oK-1rKbM.js";import"./outbox-status-BlKn6P0x.js";import"./useSignature-At1N2nkq.js";import"./account-form-helpers-DhckT_PN.js";import"./format-RgJz8yFq.js";const ds=te("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);function ms({leading:e,search:s,actions:n,className:o}){return t.jsxs("header",{className:F("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",o),children:[e&&t.jsx("div",{className:"flex shrink-0 items-center gap-1",children:e}),t.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:t.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),n&&t.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n})]})}function ps(){const e=ne();if(!e)return null;const s=e.showNavPane?!e.navCollapsed:!1;return t.jsx(I,{variant:"ghost",size:"sm",icon:t.jsx(Ze,{className:"size-4"}),onClick:e.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const hs={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function fs({search:e,onCompose:s,onReportBug:n,onOpenSettings:o,composeShortcut:a,refreshControl:r,account:c}){return t.jsx(ms,{leading:t.jsx(ps,{}),search:t.jsx(Ee,{value:e.value,onChange:e.onChange,onClear:e.onClear,onClearQuery:e.onClearQuery,chips:e.chips,onRemoveChip:e.onRemoveChip,placeholder:hs[e.scope]}),actions:t.jsxs(t.Fragment,{children:[t.jsx(I,{variant:"ghost",size:"sm",icon:t.jsx(ds,{className:"size-4"}),title:a?`Compose (${a})`:"Compose","aria-label":"Compose",onClick:s}),t.jsx(I,{variant:"ghost",size:"sm",icon:t.jsx(es,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:n}),t.jsx(I,{variant:"ghost",size:"sm",icon:t.jsx(ss,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:o}),r,c]})})}function xs(){const e=oe(),s=M({select:i=>R(i.location.pathname)}),n=M({select:i=>ae(i.location.search)}),[o,a]=u.useState(n),r=us(o,200),[c,d]=u.useState(s);if(c!==s){const i=Ve(c,s,n);d(s),i!==void 0&&a(i)}const m=u.useCallback(i=>{d(R(e.state.location.pathname)),a(i)},[e]);return{searchInput:o,committedQuery:He(o,r),viewKey:s,setSearchInput:m}}const gs=()=>{const e=O();return re()?null:t.jsx("button",{type:"button",onClick:e,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:t.jsx(Be,{className:"size-6"})})},bs=({email:e,onSignOut:s})=>{const n=e??"Account";return t.jsxs(Oe,{trigger:t.jsx(as,{name:n,email:e??void 0,size:"sm"}),align:"right",children:[e&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2 text-xs text-fg-muted truncate",title:e,"data-testid":"account-menu-email",children:e}),t.jsx(Pe,{})]}),t.jsxs(Re,{onClick:s,children:[t.jsx(ns,{className:"size-4"}),"Sign out"]})]})},vs=()=>t.jsx(ts,{children:({email:e,signOut:s})=>t.jsx(bs,{email:e,onSignOut:s})});function ys({accounts:e}){const{searchInput:s,onSearchChange:n,onSearchClear:o,onSearchClearQuery:a,resultFolderIndex:r}=ie(),c=Q(),d=rs(),m=O(),{scope:i,clearScope:x}=Te(e),f=i.kind==="scoped"?[{id:i.chip.id,label:i.chip.label,tone:"scope"}]:void 0,p=u.useMemo(()=>e.map(b=>b.accountId),[e]),{hasNewMail:l}=$e(),{state:h,errorMessage:y,refresh:g}=Ge(p,{onSettled:()=>Le(c,Ae(r.keys()))});return t.jsx(fs,{search:{value:s,scope:i.kind,chips:f,onChange:n,onClear:o,onClearQuery:a,onRemoveChip:x},onCompose:m,onReportBug:ce,onOpenSettings:()=>d("accounts"),composeShortcut:ke("compose"),refreshControl:t.jsx(Ue,{state:h,onRefresh:g,label:"Refresh all accounts",errorMessage:y,hasUpdate:l(p)}),account:t.jsx(vs,{})})}const Ss=({isOpen:e,onClose:s})=>(le({id:"shortcuts",open:e,answers:{back:s}}),e?t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[t.jsx(ue,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:F("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[t.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[t.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),t.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:t.jsx(de,{className:"size-5"})})]}),t.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:De.map(n=>t.jsxs("div",{children:[t.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:n.title}),t.jsx("div",{className:"space-y-2",children:n.hints.map(o=>t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsx("span",{className:"text-sm",children:o.description}),t.jsx("span",{className:"flex shrink-0 items-center gap-1",children:o.keys.map((a,r)=>t.jsxs(u.Fragment,{children:[r>0&&o.keys[0]==="g"&&t.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),t.jsx(T,{children:a})]},a))})]},`${o.action}-${o.keys.join("+")}`))})]},n.title))}),t.jsx("div",{className:"mt-6 border-t border-line pt-4",children:t.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",t.jsx(T,{children:"Esc"})," to close"]})})]})]}):null);function js(e){const s=z({queries:e.map(n=>({...K({path:{accountId:n.accountId}}),staleTime:1/0}))});return u.useMemo(()=>Fe(s.map(n=>n.data?.items??[])),[s])}const B="remit:intelligence-open";function Cs(){try{return localStorage.getItem(B)!=="closed"}catch{return!0}}function Is(e){try{localStorage.setItem(B,e?"open":"closed")}catch{}}function k({panels:e,prefersOpen:s,isDesktop:n,hasThread:o,raisedFor:a,openMessage:r}){return a!==null&&a===r?!0:e.length>0?e.includes("intelligence"):n&&o&&s}const Ns=()=>{const e=_(),s=me(),n=pe(),o=s.find(he),a=Qe(),[r,c]=u.useState(Cs),d=a?`${a.threadId}/${a.messageId??""}`:null,[m,i]=u.useState(null),x={panels:s,prefersOpen:r,isDesktop:e==="desktop",hasThread:a!==void 0,openMessage:d},f=k({...x,raisedFor:m}),p=k({...x,raisedFor:null}),l=u.useCallback((b,j)=>{n([...b?["intelligence"]:[],...j?[j]:[]])},[n]),h=u.useCallback(b=>{l(p,b)},[p,l]),y=u.useCallback(()=>{if(f&&!p){i(null);return}const b=!f;Is(b),c(b),i(null),l(b,o)},[p,f,o,l]),g=u.useCallback(()=>{i(d)},[d]);return{openOverlay:o,intelligenceOpen:f,showOverlay:h,toggleIntelligence:y,raiseIntelligence:g}},ws=e=>e.map(s=>s.data?.items??[]);function Ms(e){const s=z({queries:e.map(n=>({...K({path:{accountId:n.accountId}}),staleTime:1/0})),combine:ws});return u.useMemo(()=>fe(e.map((n,o)=>({folderAppointments:n.folderAppointments,mailboxes:s[o]??[]}))),[e,s])}var C={exports:{}},L;function Es(){if(L)return C.exports;L=1;const e=(s,n,o)=>new Promise((a,r)=>{if(o=Object.assign({concurrency:1/0},o),typeof n!="function")throw new TypeError("Mapper function is required");const{concurrency:c}=o;if(!(typeof c=="number"&&c>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${c}\` (${typeof c})`);const d=[],m=s[Symbol.iterator]();let i=!1,x=!1,f=0,p=0;const l=()=>{if(i)return;const h=m.next(),y=p;if(p++,h.done){x=!0,f===0&&a(d);return}f++,Promise.resolve(h.value).then(g=>n(g,y)).then(g=>{d[y]=g,f--,l()},g=>{i=!0,r(g)})};for(let h=0;h<c&&(l(),!x);h++);});return C.exports=e,C.exports.default=e,C.exports}var Os=Es();const Ps=xe(Os),Rs=900*1e3,Ts=30,ks=(e,s)=>{if(!e)return s;const n=Number.parseInt(e,10);return Number.isFinite(n)&&n>0?n:s},Ls=30*1e3,As=e=>Math.max(ks(e,Ts)*1e3,Ls),H=As(Se().mailboxPollIntervalSeconds),S=(e=Date.now(),s=H)=>Ye(e)?Math.min(Je,s):s,Ds=5,E=new Set,Fs=(e,s,n=Rs)=>e.filter(o=>{const a=o.lastSyncAt;return a==null?!0:s-a>n}).map(o=>o.accountId),Qs=(e,s,n=H)=>e-s>=n,Ks=(e,s)=>e.filter(n=>!s.has(n)),A=(e,s)=>{if(E.delete(e),ve(s,{softError:!0},"nobody")){ye(s);return}console.warn("[remit] background mailbox sync failed",{accountId:e,error:s})},D=(e,s)=>ge({path:{accountId:e},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:be({path:{accountId:e}})})}),_s=e=>{const s=Q(),n=u.useRef(e);n.current=e;const o=e.map(a=>a.accountId).join(",");u.useEffect(()=>{const a=Date.now(),c=Fs(n.current,a).filter(d=>!E.has(d));if(c.length!==0)for(const d of c)E.add(d),D(d,s).catch(m=>{A(d,m)})},[o,s]),u.useEffect(()=>{let a=Date.now(),r;const c=new Set,d=()=>{a=Date.now();const p=Ks(n.current.map(l=>l.accountId),c);for(const l of p)c.add(l);Ps(p,l=>D(l,s).catch(h=>{A(l,h)}).finally(()=>{c.delete(l)}),{concurrency:Ds})},m=()=>{if(document.visibilityState==="visible"){d(),r=setTimeout(m,S());return}},i=()=>{document.visibilityState==="visible"&&Qs(Date.now(),a,S())&&(r!==void 0&&clearTimeout(r),d(),r=setTimeout(m,S()))},x=()=>{document.visibilityState==="visible"&&(r!==void 0&&clearTimeout(r),a=Date.now(),r=setTimeout(m,S()))};r=setTimeout(m,S()),document.addEventListener("visibilitychange",i);const f=We(x);return()=>{r!==void 0&&clearTimeout(r),document.removeEventListener("visibilitychange",i),f()}},[o,s])};function pt(){const e=je(),s=_(),n=ls(s),{openOverlay:o,intelligenceOpen:a,showOverlay:r,toggleIntelligence:c,raiseIntelligence:d}=Ns(),m=o==="shortcuts",i=o==="nav",{searchInput:x,committedQuery:f,viewKey:p,setSearchInput:l}=xs(),{data:h,isLoading:y,isError:g,error:b,refetch:j}=Ce({...Ie(),staleTime:1/0}),N=!!(h&&(h.accounts?.length??0)===0);u.useEffect(()=>{N&&e({to:"/onboarding",replace:!0})},[N,e]),cs({enabled:!m,bindings:[{key:"?",action:"help",handler:()=>r("shortcuts"),noModifiers:!1,preventDefault:!0}]});const P=O(),V=ze(),q=M({select:w=>Me(w.matches)?.list==="mailbox"}),$=u.useMemo(()=>({compose:P}),[P]);Ke({enabled:!q&&!V,handlers:$});const G=u.useCallback(()=>{l("")},[l]),U=u.useCallback(()=>{l("")},[l]),v=h?.accounts??[],W=u.useMemo(()=>v.map(w=>w.accountId),[v]),Y=js(v),J=Ms(v),X=u.useMemo(()=>_e(v),[v]);_s(v);const Z=u.useCallback(()=>{o==="nav"&&r(void 0)},[o,r]),ee={accounts:v,mailboxNameIndex:Y,accountNameIndex:X,resultFolderIndex:J,searchQuery:f,searchInput:x,searchViewKey:p,onSearchChange:l,onSearchClear:G,onSearchClearQuery:U,intelligenceOpen:a,onToggleIntelligence:c,onRaiseIntelligence:d},se={isSinglePane:n,isLoading:y||N,intelligenceOpen:a,nav:t.jsx(os,{accounts:v,onMailboxSelect:Z}),topBar:n?void 0:t.jsx(ys,{accounts:v}),overlay:n?t.jsx(gs,{}):void 0,navOpen:i,onOpenNav:()=>r("nav"),onCloseNav:()=>r(void 0)};return t.jsx(Ne.Provider,{value:ee,children:t.jsxs(Xe,{accountIds:W,children:[g?t.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:t.jsx(is,{title:"Couldn't load your account",error:b,onRetry:()=>{j()}})}):t.jsx(qe,{chrome:se,children:t.jsx(we,{})}),t.jsx(Ss,{isOpen:m,onClose:()=>r(void 0)})]})})}export{pt as component,ie as useMailContext};
1
+ import{e as te,j as t,t as F,v as ne,f as I,w as oe,x as M,r as u,y as R,z as ae,A as re,C as ie,h as Q,D as ce,E as le,F as ue,X as de,G as K,a as me,b as pe,H as he,J as fe,K as xe,M as ge,N as be,P as ve,Q as ye,R as Se,u as je,c as Ce,d as Ie,S as Ne,O as we,T as Me}from"./index-DFvn5y4c.js";import{S as Ee,D as Oe,a as Pe,b as Re,u as Te,s as ke,i as Le,t as Ae,K as De,c as Fe,d as Qe,e as Ke,f as _e}from"./search-token-index-BRDoS9VF.js";import{u as O,a as ze}from"./useMessageBodyContent-DlWOVC8_.js";import{P as Be}from"./pencil-YivqEktR.js";import{c as He,s as Ve,M as qe}from"./MailShell-PzyuiJnk.js";import{u as $e,a as Ge,R as Ue,s as We,i as Ye,H as Je,M as Xe}from"./useRefreshControl-oC54L2Ym.js";import{M as Ze}from"./menu-DFNsLG9c.js";import{B as es}from"./bug-CixXpMeP.js";import{S as ss,A as ts,L as ns,M as os}from"./MailNav-CddPjjRg.js";import{A as as}from"./avatar-C10lunoa.js";import{u as rs}from"./sections-DrfTHCE6.js";import{E as is}from"./ErrorState-BtilFfMz.js";import{K as T}from"./kbd-Mu7aD0zn.js";import{u as cs}from"./index-BWh7aDGG.js";import{u as _,i as ls}from"./useLayoutTier-BJPTvUFH.js";import{u as z}from"./useQueries-C-FWQch-.js";import{u as us}from"./useDebouncedValue-BABSGNK2.js";import"./search-scope-B5-OK3Cq.js";import"./FullCompose-BYAe64Df.js";import"./confirm-dialog-DzL02Vjs.js";import"./circle-check-big-BSzMiP3i.js";import"./calendar-days-DUJNDPSw.js";import"./outbox-status-BlKn6P0x.js";import"./useSignature-DNDSJmLZ.js";import"./account-form-helpers-DhckT_PN.js";import"./format-DFEg2Asu.js";const ds=te("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);function ms({leading:e,search:s,actions:n,className:o}){return t.jsxs("header",{className:F("flex min-h-pane-header w-full shrink-0 items-center gap-2 border-b border-line bg-canvas px-row-inset py-1",o),children:[e&&t.jsx("div",{className:"flex shrink-0 items-center gap-1",children:e}),t.jsx("div",{className:"flex min-w-0 flex-1 justify-start",children:t.jsx("div",{className:"w-full max-w-xs transition-[max-width] duration-150 ease-out focus-within:max-w-lg",children:s})}),n&&t.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n})]})}function ps(){const e=ne();if(!e)return null;const s=e.showNavPane?!e.navCollapsed:!1;return t.jsx(I,{variant:"ghost",size:"sm",icon:t.jsx(Ze,{className:"size-4"}),onClick:e.toggleNav,"aria-label":s?"Hide folders":"Show folders","aria-expanded":s,title:"Folders",className:"shrink-0"})}const hs={global:"Search all mail",pending:"Search mail",scoped:"Search this folder"};function fs({search:e,onCompose:s,onReportBug:n,onOpenSettings:o,composeShortcut:a,refreshControl:r,account:c}){return t.jsx(ms,{leading:t.jsx(ps,{}),search:t.jsx(Ee,{value:e.value,onChange:e.onChange,onClear:e.onClear,onClearQuery:e.onClearQuery,chips:e.chips,onRemoveChip:e.onRemoveChip,placeholder:hs[e.scope]}),actions:t.jsxs(t.Fragment,{children:[t.jsx(I,{variant:"ghost",size:"sm",icon:t.jsx(ds,{className:"size-4"}),title:a?`Compose (${a})`:"Compose","aria-label":"Compose",onClick:s}),t.jsx(I,{variant:"ghost",size:"sm",icon:t.jsx(es,{className:"size-4"}),title:"Report a bug","aria-label":"Report a bug",onClick:n}),t.jsx(I,{variant:"ghost",size:"sm",icon:t.jsx(ss,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:o}),r,c]})})}function xs(){const e=oe(),s=M({select:i=>R(i.location.pathname)}),n=M({select:i=>ae(i.location.search)}),[o,a]=u.useState(n),r=us(o,200),[c,d]=u.useState(s);if(c!==s){const i=Ve(c,s,n);d(s),i!==void 0&&a(i)}const m=u.useCallback(i=>{d(R(e.state.location.pathname)),a(i)},[e]);return{searchInput:o,committedQuery:He(o,r),viewKey:s,setSearchInput:m}}const gs=()=>{const e=O();return re()?null:t.jsx("button",{type:"button",onClick:e,"aria-label":"Compose new message",className:"lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all",style:{bottom:"calc(env(safe-area-inset-bottom, 0) + 1rem)"},children:t.jsx(Be,{className:"size-6"})})},bs=({email:e,onSignOut:s})=>{const n=e??"Account";return t.jsxs(Oe,{trigger:t.jsx(as,{name:n,email:e??void 0,size:"sm"}),align:"right",children:[e&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-3 py-2 text-xs text-fg-muted truncate",title:e,"data-testid":"account-menu-email",children:e}),t.jsx(Pe,{})]}),t.jsxs(Re,{onClick:s,children:[t.jsx(ns,{className:"size-4"}),"Sign out"]})]})},vs=()=>t.jsx(ts,{children:({email:e,signOut:s})=>t.jsx(bs,{email:e,onSignOut:s})});function ys({accounts:e}){const{searchInput:s,onSearchChange:n,onSearchClear:o,onSearchClearQuery:a,resultFolderIndex:r}=ie(),c=Q(),d=rs(),m=O(),{scope:i,clearScope:x}=Te(e),f=i.kind==="scoped"?[{id:i.chip.id,label:i.chip.label,tone:"scope"}]:void 0,p=u.useMemo(()=>e.map(b=>b.accountId),[e]),{hasNewMail:l}=$e(),{state:h,errorMessage:y,refresh:g}=Ge(p,{onSettled:()=>Le(c,Ae(r.keys()))});return t.jsx(fs,{search:{value:s,scope:i.kind,chips:f,onChange:n,onClear:o,onClearQuery:a,onRemoveChip:x},onCompose:m,onReportBug:ce,onOpenSettings:()=>d("accounts"),composeShortcut:ke("compose"),refreshControl:t.jsx(Ue,{state:h,onRefresh:g,label:"Refresh all accounts",errorMessage:y,hasUpdate:l(p)}),account:t.jsx(vs,{})})}const Ss=({isOpen:e,onClose:s})=>(le({id:"shortcuts",open:e,answers:{back:s}}),e?t.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[t.jsx(ue,{label:"Dismiss keyboard shortcuts",onDismiss:s,className:"backdrop-blur-sm"}),t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",className:F("relative z-10 max-h-[85vh] w-full max-w-2xl overflow-y-auto","rounded-lg border border-line bg-surface shadow-lg","p-6"),children:[t.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[t.jsx("h2",{className:"text-lg font-semibold",children:"Keyboard shortcuts"}),t.jsx("button",{type:"button",onClick:s,className:"p-1 text-fg-muted transition-colors hover:text-fg","aria-label":"Close",children:t.jsx(de,{className:"size-5"})})]}),t.jsx("div",{className:"grid gap-x-8 gap-y-6 sm:grid-cols-2",children:De.map(n=>t.jsxs("div",{children:[t.jsx("h3",{className:"mb-3 text-sm font-medium text-fg-muted",children:n.title}),t.jsx("div",{className:"space-y-2",children:n.hints.map(o=>t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsx("span",{className:"text-sm",children:o.description}),t.jsx("span",{className:"flex shrink-0 items-center gap-1",children:o.keys.map((a,r)=>t.jsxs(u.Fragment,{children:[r>0&&o.keys[0]==="g"&&t.jsx("span",{className:"text-2xs text-fg-subtle",children:"then"}),t.jsx(T,{children:a})]},a))})]},`${o.action}-${o.keys.join("+")}`))})]},n.title))}),t.jsx("div",{className:"mt-6 border-t border-line pt-4",children:t.jsxs("p",{className:"text-center text-xs text-fg-muted",children:["Press ",t.jsx(T,{children:"Esc"})," to close"]})})]})]}):null);function js(e){const s=z({queries:e.map(n=>({...K({path:{accountId:n.accountId}}),staleTime:1/0}))});return u.useMemo(()=>Fe(s.map(n=>n.data?.items??[])),[s])}const B="remit:intelligence-open";function Cs(){try{return localStorage.getItem(B)!=="closed"}catch{return!0}}function Is(e){try{localStorage.setItem(B,e?"open":"closed")}catch{}}function k({panels:e,prefersOpen:s,isDesktop:n,hasThread:o,raisedFor:a,openMessage:r}){return a!==null&&a===r?!0:e.length>0?e.includes("intelligence"):n&&o&&s}const Ns=()=>{const e=_(),s=me(),n=pe(),o=s.find(he),a=Qe(),[r,c]=u.useState(Cs),d=a?`${a.threadId}/${a.messageId??""}`:null,[m,i]=u.useState(null),x={panels:s,prefersOpen:r,isDesktop:e==="desktop",hasThread:a!==void 0,openMessage:d},f=k({...x,raisedFor:m}),p=k({...x,raisedFor:null}),l=u.useCallback((b,j)=>{n([...b?["intelligence"]:[],...j?[j]:[]])},[n]),h=u.useCallback(b=>{l(p,b)},[p,l]),y=u.useCallback(()=>{if(f&&!p){i(null);return}const b=!f;Is(b),c(b),i(null),l(b,o)},[p,f,o,l]),g=u.useCallback(()=>{i(d)},[d]);return{openOverlay:o,intelligenceOpen:f,showOverlay:h,toggleIntelligence:y,raiseIntelligence:g}},ws=e=>e.map(s=>s.data?.items??[]);function Ms(e){const s=z({queries:e.map(n=>({...K({path:{accountId:n.accountId}}),staleTime:1/0})),combine:ws});return u.useMemo(()=>fe(e.map((n,o)=>({folderAppointments:n.folderAppointments,mailboxes:s[o]??[]}))),[e,s])}var C={exports:{}},L;function Es(){if(L)return C.exports;L=1;const e=(s,n,o)=>new Promise((a,r)=>{if(o=Object.assign({concurrency:1/0},o),typeof n!="function")throw new TypeError("Mapper function is required");const{concurrency:c}=o;if(!(typeof c=="number"&&c>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${c}\` (${typeof c})`);const d=[],m=s[Symbol.iterator]();let i=!1,x=!1,f=0,p=0;const l=()=>{if(i)return;const h=m.next(),y=p;if(p++,h.done){x=!0,f===0&&a(d);return}f++,Promise.resolve(h.value).then(g=>n(g,y)).then(g=>{d[y]=g,f--,l()},g=>{i=!0,r(g)})};for(let h=0;h<c&&(l(),!x);h++);});return C.exports=e,C.exports.default=e,C.exports}var Os=Es();const Ps=xe(Os),Rs=900*1e3,Ts=30,ks=(e,s)=>{if(!e)return s;const n=Number.parseInt(e,10);return Number.isFinite(n)&&n>0?n:s},Ls=30*1e3,As=e=>Math.max(ks(e,Ts)*1e3,Ls),H=As(Se().mailboxPollIntervalSeconds),S=(e=Date.now(),s=H)=>Ye(e)?Math.min(Je,s):s,Ds=5,E=new Set,Fs=(e,s,n=Rs)=>e.filter(o=>{const a=o.lastSyncAt;return a==null?!0:s-a>n}).map(o=>o.accountId),Qs=(e,s,n=H)=>e-s>=n,Ks=(e,s)=>e.filter(n=>!s.has(n)),A=(e,s)=>{if(E.delete(e),ve(s,{softError:!0},"nobody")){ye(s);return}console.warn("[remit] background mailbox sync failed",{accountId:e,error:s})},D=(e,s)=>ge({path:{accountId:e},throwOnError:!0}).then(()=>{s.invalidateQueries({queryKey:be({path:{accountId:e}})})}),_s=e=>{const s=Q(),n=u.useRef(e);n.current=e;const o=e.map(a=>a.accountId).join(",");u.useEffect(()=>{const a=Date.now(),c=Fs(n.current,a).filter(d=>!E.has(d));if(c.length!==0)for(const d of c)E.add(d),D(d,s).catch(m=>{A(d,m)})},[o,s]),u.useEffect(()=>{let a=Date.now(),r;const c=new Set,d=()=>{a=Date.now();const p=Ks(n.current.map(l=>l.accountId),c);for(const l of p)c.add(l);Ps(p,l=>D(l,s).catch(h=>{A(l,h)}).finally(()=>{c.delete(l)}),{concurrency:Ds})},m=()=>{if(document.visibilityState==="visible"){d(),r=setTimeout(m,S());return}},i=()=>{document.visibilityState==="visible"&&Qs(Date.now(),a,S())&&(r!==void 0&&clearTimeout(r),d(),r=setTimeout(m,S()))},x=()=>{document.visibilityState==="visible"&&(r!==void 0&&clearTimeout(r),a=Date.now(),r=setTimeout(m,S()))};r=setTimeout(m,S()),document.addEventListener("visibilitychange",i);const f=We(x);return()=>{r!==void 0&&clearTimeout(r),document.removeEventListener("visibilitychange",i),f()}},[o,s])};function pt(){const e=je(),s=_(),n=ls(s),{openOverlay:o,intelligenceOpen:a,showOverlay:r,toggleIntelligence:c,raiseIntelligence:d}=Ns(),m=o==="shortcuts",i=o==="nav",{searchInput:x,committedQuery:f,viewKey:p,setSearchInput:l}=xs(),{data:h,isLoading:y,isError:g,error:b,refetch:j}=Ce({...Ie(),staleTime:1/0}),N=!!(h&&(h.accounts?.length??0)===0);u.useEffect(()=>{N&&e({to:"/onboarding",replace:!0})},[N,e]),cs({enabled:!m,bindings:[{key:"?",action:"help",handler:()=>r("shortcuts"),noModifiers:!1,preventDefault:!0}]});const P=O(),V=ze(),q=M({select:w=>Me(w.matches)?.list==="mailbox"}),$=u.useMemo(()=>({compose:P}),[P]);Ke({enabled:!q&&!V,handlers:$});const G=u.useCallback(()=>{l("")},[l]),U=u.useCallback(()=>{l("")},[l]),v=h?.accounts??[],W=u.useMemo(()=>v.map(w=>w.accountId),[v]),Y=js(v),J=Ms(v),X=u.useMemo(()=>_e(v),[v]);_s(v);const Z=u.useCallback(()=>{o==="nav"&&r(void 0)},[o,r]),ee={accounts:v,mailboxNameIndex:Y,accountNameIndex:X,resultFolderIndex:J,searchQuery:f,searchInput:x,searchViewKey:p,onSearchChange:l,onSearchClear:G,onSearchClearQuery:U,intelligenceOpen:a,onToggleIntelligence:c,onRaiseIntelligence:d},se={isSinglePane:n,isLoading:y||N,intelligenceOpen:a,nav:t.jsx(os,{accounts:v,onMailboxSelect:Z}),topBar:n?void 0:t.jsx(ys,{accounts:v}),overlay:n?t.jsx(gs,{}):void 0,navOpen:i,onOpenNav:()=>r("nav"),onCloseNav:()=>r(void 0)};return t.jsx(Ne.Provider,{value:ee,children:t.jsxs(Xe,{accountIds:W,children:[g?t.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:t.jsx(is,{title:"Couldn't load your account",error:b,onRetry:()=>{j()}})}):t.jsx(qe,{chrome:se,children:t.jsx(we,{})}),t.jsx(Ss,{isOpen:m,onClose:()=>r(void 0)})]})})}export{pt as component,ie as useMailContext};
@@ -1 +1 @@
1
- import{e}from"./index-DMZ8-zZM.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{e}from"./index-DFvn5y4c.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{e}from"./index-DMZ8-zZM.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{e}from"./index-DFvn5y4c.js";const n=e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);export{n as M};
@@ -0,0 +1 @@
1
+ import{e}from"./index-DFvn5y4c.js";const a=e("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);export{a as M};
@@ -1 +1 @@
1
- import{r as i,j as c}from"./index-DMZ8-zZM.js";import{u as D,e as g,C as y,c as E}from"./CalendarComposePane-VeLWQkta.js";import{u as b}from"./CalendarComposeSeed-675yfCbg.js";import{u as h,i as x,U as I,d as w}from"./useCalendars-BruqGaWc.js";import"./ErrorState-BGolGYcc.js";function N({onClose:t}){const{date:m}=h(),a=b(),{calendars:d,timeZoneByCalendarId:u}=x(),{createEvent:f,isWriting:C}=D(),[p,r]=i.useState(""),[n,l]=i.useState(()=>{const e=g(a?.date??m,"");return a?{...e,allDay:a.allDay,startTime:a.allDay?"":a.startTime,endTime:a.allDay?"":a.endTime}:e}),s=d[0]?.id??"";i.useEffect(()=>{s!==""&&l(e=>e.calendarId===""?{...e,calendarId:s}:e)},[s]);const v=()=>{const e=E(n,u[n.calendarId]??I);if(!e.ok){r(e.problem);return}f(e.input).then(o=>{if(o.kind==="written"){r(""),t();return}r(o.kind==="conflict"?"This calendar changed while you were writing. Close the form and try again.":o.message)})};return c.jsx(y,{title:"New event",subtitle:n.date,calendars:d,draft:n,onChange:l,problem:p,saveLabel:"Add",isSaving:C,onSave:v,onCancel:t})}function R(){const{closeEvent:t}=w();return c.jsx(N,{onClose:t})}export{R as component};
1
+ import{r as i,j as c}from"./index-DFvn5y4c.js";import{u as D,e as g,C as y,c as E}from"./CalendarComposePane-DSTGkUg1.js";import{u as b}from"./CalendarComposeSeed-D2-h5yfx.js";import{u as h,i as x,U as I,d as w}from"./useCalendars-DaisNzpy.js";import"./ErrorState-BtilFfMz.js";function N({onClose:t}){const{date:m}=h(),a=b(),{calendars:d,timeZoneByCalendarId:u}=x(),{createEvent:f,isWriting:C}=D(),[p,r]=i.useState(""),[n,l]=i.useState(()=>{const e=g(a?.date??m,"");return a?{...e,allDay:a.allDay,startTime:a.allDay?"":a.startTime,endTime:a.allDay?"":a.endTime}:e}),s=d[0]?.id??"";i.useEffect(()=>{s!==""&&l(e=>e.calendarId===""?{...e,calendarId:s}:e)},[s]);const v=()=>{const e=E(n,u[n.calendarId]??I);if(!e.ok){r(e.problem);return}f(e.input).then(o=>{if(o.kind==="written"){r(""),t();return}r(o.kind==="conflict"?"This calendar changed while you were writing. Close the form and try again.":o.message)})};return c.jsx(y,{title:"New event",subtitle:n.date,calendars:d,draft:n,onChange:l,problem:p,saveLabel:"Add",isSaving:C,onSave:v,onCancel:t})}function R(){const{closeEvent:t}=w();return c.jsx(N,{onClose:t})}export{R as component};
@@ -1 +1 @@
1
- import{o}from"./index-DMZ8-zZM.js";async function n(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:o()}),e.navigateToInbox()}export{n as c};
1
+ import{o}from"./index-DFvn5y4c.js";async function n(e){e.recordCompleted(),await e.queryClient.refetchQueries({queryKey:o()}),e.navigateToInbox()}export{n as c};
@@ -0,0 +1 @@
1
+ import{q as n,h as a,u as i,r as m,j as s}from"./index-DFvn5y4c.js";import{O as p}from"./OnboardingWizard-j_6mMm1N.js";import{c}from"./onboarding-completion-CzzOWbYc.js";import"./kbd-Mu7aD0zn.js";import"./credential-steps-Rb1Gb-Ws.js";import"./card-BXw0pcK1.js";import"./account-form-helpers-DhckT_PN.js";import"./mail-Ct-zdzf2.js";function y(){const o=n(),e=a(),t=i(),r=m.useCallback(l=>{c({queryClient:e,recordCompleted:()=>o.recordEvent("onboarding.completed"),navigateToInbox:()=>{window.location.assign("/mail")}})},[o,e]);return s.jsx(p,{skipWelcome:!1,onComplete:r,onImportConfig:()=>{t({to:"/import"})}})}export{y as component};
@@ -0,0 +1 @@
1
+ import{j as o,O as i}from"./index-DFvn5y4c.js";import{a as m}from"./MailShell-PzyuiJnk.js";import{u as p,O as t}from"./OutboxPane-C5btZSEO.js";import{u as s}from"./search-mirror-Bz6Il7CV.js";import"./FullCompose-BYAe64Df.js";import"./ErrorState-BtilFfMz.js";import"./index-BWh7aDGG.js";import"./useMessageBodyContent-DlWOVC8_.js";import"./useSignature-DNDSJmLZ.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-BABSGNK2.js";import"./sections-DrfTHCE6.js";import"./format-DFEg2Asu.js";import"./confirm-dialog-DzL02Vjs.js";import"./useSearchTokenContext-UVHviDZf.js";import"./kbd-Mu7aD0zn.js";import"./search-scope-B5-OK3Cq.js";import"./circle-check-big-BSzMiP3i.js";import"./clock-Bvb6Om5r.js";import"./row-actions-BPRaCwIJ.js";import"./rotate-ccw-fMBtK9xi.js";import"./NavMenuButton-Dbn2UxrU.js";import"./menu-DFNsLG9c.js";import"./outbox-status-BlKn6P0x.js";import"./search-query-Cr_ZXBCp.js";function v(){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{v as component};
@@ -1 +1 @@
1
- import{e as a}from"./index-DMZ8-zZM.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{e as a}from"./index-DFvn5y4c.js";const c=a("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);export{c as P};
@@ -1 +1 @@
1
- import{el as r,em as o,en as a}from"./index-DMZ8-zZM.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const l=t=>({post:e=>t.postMessage(e),listen:e=>t.addEventListener("message",s=>e(s.data)),fail:e=>t.addEventListener("error",s=>e(s.message)),terminate:()=>t.terminate()}),i=async t=>{const e=r(t);if(!e)return null;const s=new Worker(new URL("/assets/rich-text-spellcheck-worker-pWkhC-WR.js",import.meta.url),{type:"module"});return n(e,o(),l(s),a(e))};export{i as openSpellcheckWorker};
1
+ import{el as r,em as o,en as a}from"./index-DFvn5y4c.js";import{o as n}from"./rich-text-spellcheck-provider-J8m9wz6A.js";const l=t=>({post:e=>t.postMessage(e),listen:e=>t.addEventListener("message",s=>e(s.data)),fail:e=>t.addEventListener("error",s=>e(s.message)),terminate:()=>t.terminate()}),i=async t=>{const e=r(t);if(!e)return null;const s=new Worker(new URL("/assets/rich-text-spellcheck-worker-pWkhC-WR.js",import.meta.url),{type:"module"});return n(e,o(),l(s),a(e))};export{i as openSpellcheckWorker};
@@ -1,4 +1,4 @@
1
- import{e as Jr,r as O,j as F,f as nf,eg as ku,t as da,an as ho,eh as Ap,ei as Fp,B as zp,bH as xu,bN as Op,bO as Mp,U as jp,E as Rp,ej as Pp,_ as Lp,L as Ip,ek as Bp}from"./index-DMZ8-zZM.js";import{s as ml,c as Cu,a as Kp}from"./index-RbY7Dn0X.js";import{C as Wp}from"./confirm-dialog-PyqpaetG.js";import{B as qp}from"./bottom-sheet-CRsV78aJ.js";import{a as Up,b as Hp,c as js,f as vu,U as Jp}from"./attachment-file-QQZovKAl.js";import{o as JC}from"./rich-text-spellcheck-provider-J8m9wz6A.js";import"./useMessageBodyContent-DxQjkGza.js";import"./useSignature-At1N2nkq.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-BBOZojyy.js";import"./sections-DVKafU2-.js";import"./format-RgJz8yFq.js";const Vp=Jr("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const Yp=Jr("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);const Xp=Jr("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const Gp=Jr("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const Qp=Jr("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const Zp=Jr("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),$C={html:"",text:"",formatting:[]},em={account:"the account default",detected:"detected from what you wrote",manual:"chosen for this message"},tm=({language:n,languages:e,source:t,onSelect:r,helpText:o})=>{const[i,s]=O.useState(!1),a=O.useRef(null),l=O.useRef(null),u=O.useRef(null),c=O.useId(),d=O.useCallback(g=>{s(!1),g&&l.current?.focus()},[]);O.useEffect(()=>{if(!i)return;const g=m=>{a.current?.contains(m.target)||s(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[i]),O.useEffect(()=>{if(!i)return;const g=u.current?.querySelector('[aria-checked="true"]'),m=u.current?.querySelector('[role="menuitemradio"]');(g??m)?.focus()},[i]);const f=g=>{if(g.key==="Escape"){g.preventDefault(),d(!0);return}const m=[...u.current?.querySelectorAll('[role="menuitemradio"]')??[]],p=m.indexOf(document.activeElement),y=Fp(g.key,p,m.length);y!==null&&(g.preventDefault(),m[y]?.focus())},h=g=>{r(g),d(!0)};return F.jsxs("div",{ref:a,className:"relative",children:[F.jsx(nf,{ref:l,variant:"ghost",size:"md","aria-label":`Message language: ${ho(n)}, ${em[t]}`,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>s(g=>!g),"data-testid":"compose-language-chip","data-language":n,"data-language-source":t,className:da("min-h-11 min-w-11 shrink-0 px-2 font-medium",n!==e[0]&&"bg-accent-2-soft text-accent-2"),children:ku(n)}),i&&F.jsxs("div",{ref:u,id:c,role:"menu","aria-label":"Message language",onKeyDown:f,"data-testid":"compose-language-menu",className:"absolute right-0 top-full z-50 mt-1 flex max-h-[60dvh] min-w-56 flex-col overflow-y-auto overscroll-contain rounded-md border border-line bg-surface py-1 shadow-lg",children:[e.map(g=>F.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":g===n,lang:g,onClick:()=>h(g),className:da("flex min-h-11 items-center justify-between gap-3 px-4 py-2.5 text-left text-sm text-fg transition-colors hover:bg-surface-sunken",g===n&&"bg-accent-2-soft"),children:[ho(g),F.jsx("span",{className:"shrink-0 text-xs text-fg-subtle",children:ku(g)})]},g)),F.jsx("p",{"data-testid":"compose-language-help",className:"border-t border-line px-4 pb-1 pt-2 text-xs text-fg-muted",children:o??Ap(navigator.userAgent)})]})]})},nm=({mode:n,onToggle:e})=>F.jsx(nf,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:da("min-h-11 shrink-0",n==="plain"&&"bg-accent-2-soft text-accent-2"),children:"Plain text"}),rm=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rf=n=>{const e=n.activeElement;return e?.shadowRoot?rf(e.shadowRoot)??e:e},om=n=>{const e=n.tagName.toUpperCase();if(e==="IFRAME"||e==="FRAME"||e==="TEXTAREA"||e==="SELECT")return!0;if(e==="INPUT"){const r=(n.getAttribute("type")??"text").toLowerCase();return!rm.has(r)}const t=n.getAttribute("contenteditable");return t!==null&&t.toLowerCase()!=="false"?!0:n.isContentEditable===!0},of=n=>{const e=n?.ownerDocument??globalThis.document;if(!e)return!1;const t=rf(e);return!t||t===n||n?.contains(t)?!1:om(t)};function $(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function sf(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const et=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,im=et&&"documentMode"in document?document.documentMode:null,Ft=et&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pt=et&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=!(!et||!("InputEvent"in window)||im)&&"getTargetRanges"in new window.InputEvent("input"),En=et&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,af=et&&/Android/.test(navigator.userAgent),jo=et&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!af,lf=et&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ei=et&&af&&lf,Ro=et&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ft&&!lf,sm=0,am=1,lm=2,fa=1,ha=2,ga=4,pa=8,um=16,Rs=32,Ps=64,yl=128,cm=1,dm=2,fm=3,hm=4,gm=5,pm=6,ko=jo||En||Ro?" ":"​",In=`
1
+ import{e as Jr,r as O,j as F,f as nf,eg as ku,t as da,an as ho,eh as Ap,ei as Fp,B as zp,bH as xu,bN as Op,bO as Mp,U as jp,E as Rp,ej as Pp,_ as Lp,L as Ip,ek as Bp}from"./index-DFvn5y4c.js";import{s as ml,c as Cu,a as Kp}from"./index-BWh7aDGG.js";import{C as Wp}from"./confirm-dialog-DzL02Vjs.js";import{B as qp}from"./bottom-sheet-8IzLQias.js";import{a as Up,b as Hp,c as js,f as vu,U as Jp}from"./attachment-file-BJFaXvRO.js";import{o as JC}from"./rich-text-spellcheck-provider-J8m9wz6A.js";import"./useMessageBodyContent-DlWOVC8_.js";import"./useSignature-DNDSJmLZ.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-BABSGNK2.js";import"./sections-DrfTHCE6.js";import"./format-DFEg2Asu.js";const Vp=Jr("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const Yp=Jr("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);const Xp=Jr("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const Gp=Jr("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const Qp=Jr("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const Zp=Jr("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),$C={html:"",text:"",formatting:[]},em={account:"the account default",detected:"detected from what you wrote",manual:"chosen for this message"},tm=({language:n,languages:e,source:t,onSelect:r,helpText:o})=>{const[i,s]=O.useState(!1),a=O.useRef(null),l=O.useRef(null),u=O.useRef(null),c=O.useId(),d=O.useCallback(g=>{s(!1),g&&l.current?.focus()},[]);O.useEffect(()=>{if(!i)return;const g=m=>{a.current?.contains(m.target)||s(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[i]),O.useEffect(()=>{if(!i)return;const g=u.current?.querySelector('[aria-checked="true"]'),m=u.current?.querySelector('[role="menuitemradio"]');(g??m)?.focus()},[i]);const f=g=>{if(g.key==="Escape"){g.preventDefault(),d(!0);return}const m=[...u.current?.querySelectorAll('[role="menuitemradio"]')??[]],p=m.indexOf(document.activeElement),y=Fp(g.key,p,m.length);y!==null&&(g.preventDefault(),m[y]?.focus())},h=g=>{r(g),d(!0)};return F.jsxs("div",{ref:a,className:"relative",children:[F.jsx(nf,{ref:l,variant:"ghost",size:"md","aria-label":`Message language: ${ho(n)}, ${em[t]}`,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?c:void 0,onClick:()=>s(g=>!g),"data-testid":"compose-language-chip","data-language":n,"data-language-source":t,className:da("min-h-11 min-w-11 shrink-0 px-2 font-medium",n!==e[0]&&"bg-accent-2-soft text-accent-2"),children:ku(n)}),i&&F.jsxs("div",{ref:u,id:c,role:"menu","aria-label":"Message language",onKeyDown:f,"data-testid":"compose-language-menu",className:"absolute right-0 top-full z-50 mt-1 flex max-h-[60dvh] min-w-56 flex-col overflow-y-auto overscroll-contain rounded-md border border-line bg-surface py-1 shadow-lg",children:[e.map(g=>F.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":g===n,lang:g,onClick:()=>h(g),className:da("flex min-h-11 items-center justify-between gap-3 px-4 py-2.5 text-left text-sm text-fg transition-colors hover:bg-surface-sunken",g===n&&"bg-accent-2-soft"),children:[ho(g),F.jsx("span",{className:"shrink-0 text-xs text-fg-subtle",children:ku(g)})]},g)),F.jsx("p",{"data-testid":"compose-language-help",className:"border-t border-line px-4 pb-1 pt-2 text-xs text-fg-muted",children:o??Ap(navigator.userAgent)})]})]})},nm=({mode:n,onToggle:e})=>F.jsx(nf,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:da("min-h-11 shrink-0",n==="plain"&&"bg-accent-2-soft text-accent-2"),children:"Plain text"}),rm=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rf=n=>{const e=n.activeElement;return e?.shadowRoot?rf(e.shadowRoot)??e:e},om=n=>{const e=n.tagName.toUpperCase();if(e==="IFRAME"||e==="FRAME"||e==="TEXTAREA"||e==="SELECT")return!0;if(e==="INPUT"){const r=(n.getAttribute("type")??"text").toLowerCase();return!rm.has(r)}const t=n.getAttribute("contenteditable");return t!==null&&t.toLowerCase()!=="false"?!0:n.isContentEditable===!0},of=n=>{const e=n?.ownerDocument??globalThis.document;if(!e)return!1;const t=rf(e);return!t||t===n||n?.contains(t)?!1:om(t)};function $(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function sf(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const et=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,im=et&&"documentMode"in document?document.documentMode:null,Ft=et&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pt=et&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Fr=!(!et||!("InputEvent"in window)||im)&&"getTargetRanges"in new window.InputEvent("input"),En=et&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,af=et&&/Android/.test(navigator.userAgent),jo=et&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!af,lf=et&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ei=et&&af&&lf,Ro=et&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ft&&!lf,sm=0,am=1,lm=2,fa=1,ha=2,ga=4,pa=8,um=16,Rs=32,Ps=64,yl=128,cm=1,dm=2,fm=3,hm=4,gm=5,pm=6,ko=jo||En||Ro?" ":"​",In=`
2
2
 
3
3
  `,_l=Pt?" ":ko,hn={bold:1,capitalize:1024,code:16,highlight:yl,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},mm={directionless:1,unmergeable:2},Ti={center:2,end:6,justify:4,left:1,right:3,start:5},ym={[dm]:"center",[pm]:"end",[hm]:"justify",[cm]:"left",[fm]:"right",[gm]:"start"},_m={normal:0,segmented:2,token:1},bm={[sm]:"normal",[lm]:"segmented",[am]:"token"},Su="$config";function wu(){return we()._blockCursorElement}function km(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}let uf=class gi{element;before;after;constructor(e,t,r){this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new gi(this.element,e,this.after)}withAfter(e){return new gi(this.element,this.before,e)}withElement(e){return this.element===e?this:new gi(e,this.before,this.after)}insertChild(e){const t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&$(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&$(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&$(359),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,r){if(this.element===e)return t===e&&r===0?"before":"after";const o=Eu(e,this.element);if(o===null)return"after";const i=Array.prototype.indexOf.call(e.childNodes,o);if(i<0)return"after";if(t===e)return r<=i?"before":"after";const s=Eu(e,t);if(s===null)return"after";const a=Array.prototype.indexOf.call(e.childNodes,s);return a>=0&&a<=i?"before":"after"}getInsertionAnchor(){return this.before}};function Eu(n,e){let t=e;for(;t!==null&&t.parentNode!==n;)t=t.parentNode;return t}let cf=class pi extends uf{withBefore(e){return new pi(this.element,e,this.after)}withAfter(e){return new pi(this.element,this.before,e)}withElement(e){return this.element===e?this:new pi(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;km(t);)e=t,t=t.nextSibling;const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===wu()?r:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(Ro||En||jo);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&t.removeChild(r),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before,i=ae().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),e){const s=ae().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){const e=this.getFirstChild(),t=this.getInsertionAnchor();let r=0;for(let o=this.element.firstChild;o!==null&&o!==e&&o!==t;o=o.nextSibling)r++;return r}resolveChildIndex(e,t,r,o){if(r===this.element){const l=this.getFirstChildOffset(),u=wu(),c=this.element.childNodes,d=Math.min(o,c.length);let f=0;for(let h=l;h<d;h++)c[h]!==u&&f++;return[e,Math.min(f,e.getChildrenSize())]}const i=Tu(t,r);i.push(o);const s=Tu(t,this.element);let a=e.getIndexWithinParent();for(let l=0;l<s.length;l++){const u=i[l],c=s[l];if(u===void 0||u<c)break;if(u>c){a+=1;break}}return[e.getParentOrThrow(),a]}};function Tu(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;t.push(o)}return r!==n&&$(225),t.reverse()}let df;try{df="0.49.0+prod.esm"}catch{}const ff=df??'"<unknown>+source"';let eo=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const Mn=null;function hf(n,e=1e3){return n instanceof ma?n.clone():n.size<e?new Map(n):new ma().init(new Map(n),void 0,n.size)}let ma=class gf{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new gf().init(this._old,this._nursery,this._size)}init(e,t,r){return this._old=e,this._nursery=t,this._size=r,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){const t=this._nursery&&this._nursery.get(e);return t!==void 0?t:this._old&&this._old.get(e)}get(e){const t=this.getWithTombstone(e);return t===Mn?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){const t=new Map(this._old);for(const[r,o]of this._nursery)o!==Mn?t.set(r,o):t.delete(r);this._old=t,this._nursery=void 0}return this._mutable=!1,this}set(e,t){const r=this.getWithTombstone(e);if(r===t)return this;const o=this.getNursery();return r!==Mn&&r!==void 0||(this._size++,r===Mn&&o.delete(e)),o.set(e,t),this}delete(e){const t=this.has(e);return t&&(this.getNursery().set(e,Mn),this._size--),t}getOrInsert(e,t){const r=this.get(e);return r!==void 0?r:(this.set(e,t),t)}getOrInsertComputed(e,t){const r=this.get(e);if(r!==void 0)return r;const o=t(e);return this.set(e,o),o}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const e of this.entries())yield e[0]}*values(){for(const e of this.entries())yield e[1]}*entries(){const e=this._nursery,t=this._old;if(t)for(const r of t){const o=r[0],i=e?e.get(o):void 0;i!==Mn&&(i!==void 0&&(r[1]=i),yield r)}if(e)for(const r of e)r[1]===Mn||t&&t.has(r[0])||(yield r)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(const[r,o]of this.entries())e(o,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}};function Ni(n,e,t,r,o,i){if(C(n)){let s=n.getFirstChild();for(;s!==null;){const a=s.__key;s.__parent===e&&((C(s)||dn(s)&&s.__slots!==null)&&Ni(s,a,t,r,o,i),t.has(a)||i.delete(a),o.push(a)),s=s.getNextSibling()}}for(const s of dn(n)&&n.__slots!==null?n.__slots.values():[]){const a=r.get(s);a!==void 0&&Yn(a)&&a.__slotHost===e&&((C(a)||dn(a)&&a.__slots!==null)&&Ni(a,s,t,r,o,i),t.has(s)||i.delete(s),o.push(s))}}let ya=!1,bl=0;function xm(n){bl=n.timeStamp}function Ls(n,e,t){const r=n.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&Xr(n,t)!==void 0}function Cm(n,e,t){const r=Pe(gt(t)),o=r&&ft(r,t._rootElement);let i=null,s=null;o!==null&&o.anchorNode===n&&(i=o.anchorOffset,s=o.focusOffset);const a=n.nodeValue;a!==null&&Ll(e,a,i,s,!1)}function vm(n,e,t){if(N(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return ht(e)&&t.isAttached()}function Sm(n,e,t){for(let r=n;r&&!Bh(r);r=or(r)){const o=Xr(r,e);if(o!==void 0){const i=te(o,t);if(i)return ne(i)||!q(r)?void 0:[r,i]}}}function pf(n,e,t){ya=!0;const r=performance.now()-bl>100;try{wt(n,()=>{const o=z()||(function(d){return d.read("latest",()=>{const f=z();return f!==null?f.clone():null})})(n),i=new Map,s=n._editorState,a=n._blockCursorElement;let l=!1,u="";for(let d=0;d<e.length;d++){const f=e[d],h=f.type,g=f.target,m=Sm(g,n,s);if(!m)continue;const[p,y]=m;if(h==="characterData")r&&D(y)&&ht(g)&&vm(o,g,y)&&Cm(g,y,n);else if(h==="childList"){l=!0;const _=f.addedNodes;for(let S=0;S<_.length;S++){const x=_[S],w=Eh(x),v=x.parentNode;if(!(v==null||x===a||w!==null||Ls(x,v,n)||n._slotsUsed&&q(x)&&x.hasAttribute("data-lexical-slot")||Bh(x))){if(Pt){const E=(q(x)?x.innerText:null)||x.nodeValue;E&&(u+=E)}v.removeChild(x)}}const b=f.removedNodes,k=b.length;if(k>0){let S=0;for(let x=0;x<k;x++){const w=b[x];(Ls(w,g,n)||a===w)&&(g.appendChild(w),S++)}k!==S&&i.set(p,y)}}}if(i.size>0)for(const[d,f]of i)f.reconcileObservedMutation(d,n);const c=t.takeRecords();if(c.length>0){for(let d=0;d<c.length;d++){const f=c[d],h=f.addedNodes,g=f.target;for(let m=0;m<h.length;m++){const p=h[m],y=p.parentNode;y==null||p.nodeName!=="BR"||Ls(p,g,n)||y.removeChild(p)}}t.takeRecords()}o!==null&&(l&&_e(o),Pt&&Fh(n)&&o.insertRawText(u))})}finally{ya=!1}}function mf(n){const e=n._observer;e!==null&&pf(n,e.takeRecords(),e)}function yf(n){(function(e){bl===0&&gt(e).addEventListener("textInput",xm,!0)})(n),n._observer=new MutationObserver((e,t)=>{pf(n,e,t)})}const Nu="latest";let wm=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||Nm).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Po(n,e){return new wm(n,e)}function Lo(n,e,t=Nu){const r=(t===Nu?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function Cr(n,e,t){let r;if(Ie(),typeof t=="function"){const i=n.getLatest(),s=Lo(i,e);if(r=t(s),e.isEqual(s,r))return i}else r=t;const o=n.getWritable();return bf(o).updateFromKnown(e,r),o}function Em(n){const e=new Map,t=new Set;for(const{ownNodeConfig:r}of Ul(typeof n=="function"?n:n.replace))if(r&&r.stateConfigs)for(const o of r.stateConfigs){let i;"stateConfig"in o?(i=o.stateConfig,o.flat&&t.add(i.key)):i=o,e.set(i.key,i)}return{flatKeys:t,sharedConfigMap:e}}const Du=new Set(["__proto__","constructor","prototype"]);let Tm=class _f{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,r=void 0,o=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,a=i!==void 0?i:(function(l,u,c){let d=c.size;if(u)for(const f in u){const h=l.get(f);h&&c.has(h)||d++}return d})(s,r,o);this.size=a}getValue(e){const t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const o=this.unknownState[e.key];o!==void 0&&(r=e.parse(o)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return $u(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,o=new Map(this.knownState);return new _f(e,t,(function(i,s,a){let l;if(a)for(const[u,c]of Object.entries(a)){if(Du.has(u))continue;const d=i.get(u);d?s.has(d)||s.set(d,d.parse(c)):(l=l||{},l[u]=c)}return l})(t.sharedConfigMap,o,r),o,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:o,unknownState:i}=this;o.has(e)||i&&r in i||(i&&(delete i[r],this.unknownState=$u(i)),this.size++),o.set(e,t)}updateFromUnknown(e,t){if(Du.has(e))return;const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const r of t.keys())t.set(r,r.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[r,o]of Object.entries(e))this.updateFromUnknown(r,o)}};function bf(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new Tm(e,kf(e));return e.__state=t,t}function kf(n){return n.__state?n.__state.sharedNodeState:vh(we(),n.getType()).sharedNodeState}function $u(n){if(n)for(const e in n)return n}function Nm(n){return n}function Au(n,e,t){for(const[r,o]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const i=t?t.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function Fu(n,e,t){const{unknownState:r}=e,o=t?t.unknownState:void 0;if(r){for(const[i,s]of Object.entries(r))if(!n.has(i)&&(n.add(i),s!==(o?o[i]:void 0)))return!0}return!1}function zu(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function Ou(n,e){const t=n.__mode,r=n.__format,o=n.__style,i=e.__mode,s=e.__format,a=e.__style,l=n.__state,u=e.__state;return(t===null||t===i)&&(r===null||r===s)&&(o===null||o===a)&&(n.__state===null||l===u||(function(c,d){if(c===d)return!0;const f=new Set;return!(c&&Au(f,c,d)||d&&Au(f,d,c)||c&&Fu(f,c,d)||d&&Fu(f,d,c))})(l,u))}function Mu(n,e){const t=n.mergeWithSibling(e),r=he()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function ju(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&D(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ou(e,r)){r=Mu(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&D(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ou(r,t)){r=Mu(r,t);break}break}t.remove()}}else r.remove()}function Kt(n){return Ru(n.anchor),Ru(n.focus),n}function Ru(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,o;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),o=!0):(r=e.getChildAtIndex(t),o=!1),D(r)){n.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!C(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const xo=Symbol.for("@lexical/CachedTextSize");function Pu(n,e){return ba.read(()=>{let t=0,r=n;for(let o=0;o<e&&r!==null;o++){const i=zt.get(r);if(i===void 0&&$(345,r),C(i)){const s=De.get(r);if(s!==void 0&&C(s)&&s.__parent!==i.__parent)t+=i.getTextContentSize();else{const a=qn.get(r),l=a&&a.__lexicalTextContent;typeof l!="string"&&$(346,i.getType()),t+=l.length}o<e-1&&!i.isInline()&&(t+=2)}else{const s=i[xo];s===void 0&&$(347,i.getType(),r),t+=s}r=i.__next}return t},{editor:de})}function xf(n){C(n)||n[xo]===void 0&&(n[xo]=D(n)?n.__text.length:n.getTextContentSize())}const Dm=4;let Co,de,vo,oe="",ze=null,Ye=null,qe=null;function Wt(){return{firstTextKey:qe,format:ze,style:Ye}}function Ct(n){n.firstTextKey!==null&&(ze=n.format,Ye=n.style,qe=n.firstTextKey)}function _a(n){if(qe!==null)return;const e=n.__lexicalFirstTextKey;if(e===void 0&&$(348),e===null)return;const t=De.get(e);D(t)&&(ze=t.getFormat(),Ye=t.getStyle(),qe=e)}let ls,go,po,zt,ba,De,qn,ka,So,Un,ln=!1,Di=!1;function xn(n,e){const t=zt.get(n),r=De.has(n);if(e!==null){const o=wa(n);o.parentNode===e&&e.removeChild(o)}if(!r){if(de._keyToDOMMap.delete(n),C(t)){const o=Vi(t,zt);xa(o,0,o.length-1,null)}if(t!==void 0){for(const o of pt(t).values()){const i=va(o);xn(o,null),i!==null&&i.remove()}Il(So,vo,ls,t,"destroyed")}}}function xa(n,e,t,r){for(let o=e;o<=t;++o){const i=n[o];i!==void 0&&xn(i,r)}}function jn(n,e){n.setProperty("text-align",e)}const $m="40px";function Cf(n,e){const t=Co.theme.indent;if(typeof t=="string"){const r=n.classList.contains(t);e>0&&!r?n.classList.add(t):e<1&&r&&n.classList.remove(t)}n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * var(--lexical-indent-base-value, ${$m}))`)}function vf(n,e){const t=n.style;e===0?jn(t,""):e===1?jn(t,"left"):e===2?jn(t,"center"):e===3?jn(t,"right"):e===4?jn(t,"justify"):e===5?jn(t,"start"):e===6&&jn(t,"end")}function Ca(n,e){const t=(function(r){const o=r.__dir;if(o!==null)return o;if(Oe(r))return null;const i=r.getParent();return i===null||Se(i)&&i.__dir===null?"auto":null})(e);t!==null?n.dir=t:n.removeAttribute("dir")}function Sf(n){const e=ae().createElement("div");return e.setAttribute("data-lexical-slot",n),e.style.display="none",e}function wf(n,e,t){e||n.contentEditable==="false"?Ly(t,de):t.removeAttribute("contenteditable")}function Lu(n,e,t){const r=oe,o=Wt();oe="";let i="";const s=ne(n);for(const[a,l]of t){const u=Sf(a);wf(e,s,u),e.appendChild(u),oe="";const c=Wt();Cn(l,Dt(n,u,de)),Ct(c),Ef(n,a,e,u),i+=oe}return Ct(o),oe=r,i}function pt(n){return dn(n)&&n.__slots!==null?n.__slots:qh}function Ef(n,e,t,r){const o=Un.$getSlotTargetElement(n,e,t,de);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function va(n){const e=qn.get(n);return e!==void 0?e.parentElement:null}function Iu(n,e,t){const r=pt(n),o=pt(e);for(const[c,d]of r)if(!o.has(c)){const f=va(d);xn(d,null),f!==null&&f.remove()}const i=oe,s=Wt();let a="",l=null;const u=ne(e);for(const[c,d]of o){const f=r.get(c);let h=f!==void 0?va(f):null;oe="";const g=Wt();if(h===null){h=Sf(c);let m=null;for(const p of t.children)if(!p.hasAttribute("data-lexical-slot")){m=p;break}t.insertBefore(h,m),Cn(d,Dt(e,h,de))}else f===d?an(d,h):(f!==void 0&&xn(f,h),Cn(d,Dt(e,h,de)));if(Ct(g),wf(t,u,h),Ef(e,c,t,h),a+=oe,h.parentElement===t){const m=l===null?t.firstChild:l.nextSibling;m!==h&&t.insertBefore(h,m),l=h}}return Ct(s),oe=i,a}function Cn(n,e){const t=De.get(n);if(t===void 0&&$(60),e!==null){const o=zt.get(n);if(o!==void 0){const i=qn.get(n);if(i!==void 0){const s=Yn(o)?o.__slotHost:null,a=Yn(t)?t.__slotHost:null,l=o.__parent!==t.__parent||s!==a,u=a!==null&&i.parentElement!==e.element;if(l||u)return e.insertChild(i),an(n,e.element)}}}const r=Un.$createDOM(t,de);if((function(o,i,s){const a=s._keyToDOMMap;Th(i,s,o),a.set(o,i)})(n,r,de),D(t)?r.setAttribute("data-lexical-text","true"):ne(t)&&(r.setAttribute("data-lexical-decorator","true"),Hi(r,{captureSelection:!0})),C(t)){const o=t.__indent,i=t.__size;Ca(r,t),o!==0&&Cf(r,o);const s=pt(t),a=s.size>0?Lu(t,r,s):"";if(i===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,oe+=a,s.size>0&&(r.__lexicalSlotTextLength=a.length);else{const u=oe,c=i-1;if(Sa(Vi(t,De),t,0,c,Dt(t,r,de)),a!==""){const d=r.__lexicalTextContent||"";r.__lexicalTextContent=a+d,oe=u+a+d}s.size>0&&(r.__lexicalSlotTextLength=a.length)}const l=t.__format;l!==0&&vf(r,l),t.isInline()||Tf(null,t,r)}else{const o=t.getTextContent();if(ne(t)){const i=t.decorate(de,Co);i!==null&&Nf(n,i),r.contentEditable="false";const s=pt(t);s.size>0&&Lu(t,r,s)}oe+=o}return e!==null&&e.insertChild(r),Un.$decorateDOM(t,null,r,de),xf(t),Il(So,vo,ls,t,"created"),r}function Sa(n,e,t,r,o){const i=oe,s=Wt();oe="",ze=null,Ye=null,qe=null;let a=t;for(;a<=r;++a){const u=Wt();Cn(n[a],o);const c=De.get(n[a]);c!==null&&D(c)?ze===null&&(ze=c.getFormat(),Ye=c.getStyle(),qe=c.__key):C(c)&&a<r&&!c.isInline()&&(oe+=In),Ct(u)}const l=de._keyToDOMMap.get(e.__key);l===void 0&&$(349,e.__key),l.__lexicalTextContent=oe,l.__lexicalFirstTextKey=qe,oe=i+oe,Ct(s)}function Tf(n,e,t){const r=Dt(e,t,de),o=r.element.__lexicalLastChildKind??null,i=(function(s,a){if(s){const l=s.__last;if(l){const u=a.get(l);if(u)return We(u)?"line-break":ne(u)&&u.isInline()?"decorator":null}return pt(s).size>0?null:"empty"}return null})(e,De);o!==i&&r.setManagedLineBreak(i)}function Am(n,e,t){var r;ze=null,Ye=null,qe=null,(function(o,i,s){const a=oe,l=o.__size,u=i.__size;oe="";const c=s.element,d=de._keyToDOMMap.get(i.__key);d===void 0&&$(351,i.__key);const f=u-l;if(!ln&&Math.abs(f)<=1&&l>=Dm&&o.__first===i.__first&&(f!==0||!de._cloneNotNeeded.has(o.__key))){const h=d.__lexicalTextContent,g=ka.get(o.__key);if(!ln&&typeof h=="string"&&g!==void 0){const m=(function(p,y){const _=y.size;if(_===0||_>=p.__size)return null;let b=p.__last,k=null,S=0;for(;b!==null&&S<_;){if(!y.has(b))return null;k=b;const x=De.get(b);if(x===void 0)return null;b=x.__prev,S++}return S!==_||b!==null&&y.has(b)?null:k})(i,g);if(m!==null){const p=g.size;if(f===0){const y=Pu(m,p);let _=m,b=0;for(;_!==null&&b<p;){const v=De.get(_);if(v===void 0)break;const E=Wt();an(_,c),D(v)&&ze===null&&(ze=v.getFormat(),Ye=v.getStyle(),qe=v.__key),Ct(E),_=v.__next,b++}let k="";for(_=m,b=0;_!==null&&b<p;){const v=De.get(_);if(v===void 0)break;let E;if(C(v)){const A=de._keyToDOMMap.get(_),T=A&&A.__lexicalTextContent;typeof T!="string"&&$(352,v.getType()),E=T}else E=v.getTextContent();k+=E,b<p-1&&C(v)&&!v.isInline()&&(k+=In),_=v.__next,b++}const S=d.__lexicalSlotTextLength||0,x=S>0?h.slice(S):h,w=x.slice(0,x.length-y)+k;return d.__lexicalTextContent=w,oe=a+w,void Bu(i,d,g)}if((function(y,_,b,k,S,x,w,v){if(v!==1&&v!==-1||w!==(v===1?2:1))return!1;const A=w-v;let T=y.__last;for(let re=0;re<A-1;re++){if(T===null)return!1;const $e=zt.get(T);if($e===void 0)return!1;T=$e.__prev}if(T===null)return!1;const M=De.get(x),j=zt.get(T);if(M===void 0||j===void 0||M.__prev!==j.__prev)return!1;const R=[];let B=x;for(let re=0;re<w;re++){if(B===null)return!1;R.push(B);const $e=De.get(B);B=$e?$e.__next:null}const Q=[];B=T;for(let re=0;re<A;re++){if(B===null)return!1;Q.push(B);const $e=zt.get(B);B=$e?$e.__next:null}const ie=new Set(Q),Z=new Set(R),L=[];let P=0,K=0;for(;P<A&&K<w;)if(R[K]===Q[P])L.push({key:R[K],kind:"reconcile"}),P++,K++;else if(Z.has(Q[P])){if(ie.has(R[K]))return!1;L.push({key:R[K],kind:"create",nextIndex:K}),K++}else L.push({key:Q[P],kind:"destroy"}),P++;for(;P<A;)L.push({key:Q[P++],kind:"destroy"});for(;K<w;)L.push({key:R[K],kind:"create",nextIndex:K}),K++;const se=Pu(T,A);for(const re of L){const $e=Wt();if(re.kind==="reconcile")an(re.key,b.element);else if(re.kind==="destroy")xn(re.key,b.element);else{let it=null;for(let nn=re.nextIndex+1;nn<w;nn++){const _n=de._keyToDOMMap.get(R[nn]);if(_n!==void 0){it=_n;break}}Cn(re.key,b.withBefore(it??b.before))}if(re.kind!=="destroy"){const it=De.get(re.key);it&&D(it)&&ze===null&&(ze=it.getFormat(),Ye=it.getStyle(),qe=it.__key)}Ct($e)}let ee="";for(let re=0;re<w;re++){const $e=De.get(R[re]);if($e===void 0)return!1;let it;if(C($e)){const nn=de._keyToDOMMap.get(R[re]),_n=nn&&nn.__lexicalTextContent;typeof _n!="string"&&$(350,$e.getType()),it=_n}else it=$e.getTextContent();ee+=it,re<w-1&&C($e)&&!$e.isInline()&&(ee+=In)}const xe=k.__lexicalSlotTextLength||0,ot=xe>0?S.slice(xe):S;return k.__lexicalTextContent=ot.slice(0,ot.length-se)+ee,!0})(o,0,s,d,h,m,p,f)){const y=d.__lexicalTextContent;return typeof y!="string"&&$(353),oe=a+y,void Bu(i,d,g)}}}if(f===0){let m=o.__first,p=0;for(;m!==null;){const y=De.get(m);if(y===void 0)break;const _=ln||po.has(m)||go.has(m),b=Wt();if(_)an(m,c);else{let k,S;if(C(y)){S=qn.get(m);const x=S&&S.__lexicalTextContent;typeof x!="string"&&$(354,y.getType()),k=x}else k=y.getTextContent();oe+=k,S!==void 0&&_a(S)}D(y)?ze===null&&(ze=y.getFormat(),Ye=y.getStyle(),qe=y.__key):C(y)&&p<u-1&&!y.isInline()&&(oe+=In),Ct(b),m=y.__next,p++}return d.__lexicalTextContent=oe,d.__lexicalFirstTextKey=qe,void(oe=a+oe)}}if(l===1&&u===1){const h=o.__first,g=i.__first;if(h===g)an(h,c);else{const p=wa(h),y=Cn(g,null);try{p.parentNode===c?c.replaceChild(y,p):s.insertChild(y)}catch(_){if(typeof _=="object"&&_!=null){const b=`${_.toString()} Parent: ${c.tagName}, new child: {tag: ${y.tagName} key: ${g}}, old child: {tag: ${p.tagName}, key: ${h}}.`;throw new Error(b)}throw _}xn(h,null)}const m=De.get(g);D(m)&&ze===null&&(ze=m.getFormat(),Ye=m.getStyle(),qe=m.__key)}else{const h=Vi(o,zt),g=Vi(i,De);if(h.length!==l&&$(227),g.length!==u&&$(228),l===0)u!==0&&Sa(g,i,0,u-1,s);else if(u===0){if(l!==0){const m=s.after==null&&s.before==null&&pt(i).size===0&&s.element.__lexicalLineBreak==null;xa(h,0,l-1,m?null:c),m&&(c.textContent="")}}else(function(m,p,y,_,b,k){const S=_-1,x=b-1;let w,v,E=k.getFirstChild(),A=0,T=0;for(;A<=S&&T<=x;){const R=p[A],B=y[T],Q=Wt();if(R===B)E=Is(an(B,k.element)),A++,T++;else{if(v===void 0&&(v=Ku(y,T)),w===void 0)w=Ku(p,A);else if(!w.has(R)){A++,Ct(Q);continue}if(!v.has(R)){E=Is(wa(R)),xn(R,k.element),A++,w.delete(R),Ct(Q);continue}if(w.has(B)){const Z=Pr(de,B);Z!==E&&k.withBefore(E??k.before).insertChild(Z),E=Is(an(B,k.element)),A++,T++}else Cn(B,k.withBefore(E??k.before)),T++}const ie=De.get(B);ie!==null&&D(ie)?ze===null&&(ze=ie.getFormat(),Ye=ie.getStyle(),qe=ie.__key):C(ie)&&T<=x&&!ie.isInline()&&(oe+=In),Ct(Q)}const M=A>S,j=T>x;if(M&&!j){const R=y[x+1],B=R===void 0?null:de.getElementByKey(R);Sa(y,m,T,x,k.withBefore(B??k.before))}else j&&!M&&xa(p,A,S,k.element)})(i,h,g,l,u,s)}d.__lexicalTextContent=oe,d.__lexicalFirstTextKey=qe,oe=a+oe})(n,e,Dt(e,t,de)),Se(e)||(r=e,ze==null||ze===r.__textFormat||Di||r.setTextFormat(ze),(function(o){Ye==null||Ye===o.__textStyle||Di||o.setTextStyle(Ye)})(e))}function Bu(n,e,t){const r=e.__lexicalFirstTextKey;if(r!=null){const o=n.__key;let i=r;for(;i!==null;){const s=De.get(i);if(s===void 0){i=null;break}if(s.__parent===o)break;i=s.__parent}if(i!==null&&!t.has(i)){const s=De.get(r);if(D(s))return ze=s.getFormat(),void(Ye=s.getStyle())}}e.__lexicalFirstTextKey=qe}function an(n,e){const t=zt.get(n);let r=De.get(n);t!==void 0&&r!==void 0||$(61);const o=ln||po.has(n)||go.has(n),i=Pr(de,n);if(t===r&&!o){let s;if(C(t)){const a=i.__lexicalTextContent;typeof a!="string"&&$(355,t.getType()),s=a,_a(i)}else s=t.getTextContent();return oe+=s,i}if(t!==r&&o&&Il(So,vo,ls,r,"updated"),Un.$updateDOM(r,t,i,de)){const s=Cn(n,null);return e===null&&$(62),e.replaceChild(s,i),xn(n,null),s}if(C(t)){C(r)||$(334,n);const s=r.__indent;(ln||s!==t.__indent)&&Cf(i,s);const a=r.__format;(ln||a!==t.__format)&&vf(i,a);const l=o&&(pt(r).size>0||pt(t).size>0)?Iu(t,r,i):"";if(o){const u=oe;if(Am(t,r,i),Oe(r)||r.isInline()||Tf(0,r,i),l!==""){const c=i.__lexicalTextContent||"";i.__lexicalTextContent=l+c,oe=u+l+c,i.__lexicalSlotTextLength=l.length}else(pt(r).size>0||pt(t).size>0)&&(i.__lexicalSlotTextLength=0)}else{const u=i.__lexicalTextContent;typeof u!="string"&&$(356,t.getType()),oe+=u,_a(i)}if((ln||r.__dir!==t.__dir||r.__parent!==t.__parent)&&(Ca(i,r),Oe(r)&&!ln))for(const u of r.getChildren())C(u)&&Ca(Pr(de,u.getKey()),u)}else{const s=r.getTextContent();if(ne(r)){const a=r.decorate(de,Co);a!==null&&Nf(n,a),o&&(pt(r).size>0||pt(t).size>0)&&Iu(t,r,i)}oe+=s}if(!Di&&Oe(r)){const s=r.getLatest();if(s.__cachedText!==oe){const a=s.getWritable();a.__cachedText=oe,r=a}}return Un.$decorateDOM(r,t,i,de),xf(r),i}function Nf(n,e){let t=de._pendingDecorators;const r=de._decorators;if(t===null){if(r[n]===e)return;t=Nh(de)}t[n]=e}function Is(n){let e=n.nextSibling;return e!==null&&e===de._blockCursorElement&&(e=e.nextSibling),e}function Ku(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function Fm(n,e,t,r,o,i){oe="",ze=null,Ye=null,qe=null,ln=r===2,de=t,Co=t._config,Un=t._config.dom||Bi,vo=t._nodes,ls=de._listeners.mutation,go=o,po=i,zt=n._nodeMap,ba=n,De=e._nodeMap,Di=e._readOnly,qn=hf(t._keyToDOMMap),ka=(function(){const a=new Map,l=u=>{for(const c of u){const d=De.get(c);if(d===void 0)continue;const f=d.__parent;if(f===null)continue;let h=a.get(f);h===void 0&&(h=new Set,a.set(f,h)),h.add(c)}};return l(go.keys()),l(po),a})();const s=new Map;return So=s,an("root",null),de=void 0,vo=void 0,go=void 0,po=void 0,zt=void 0,ba=void 0,De=void 0,Co=void 0,qn=void 0,ka=void 0,So=void 0,Un=Bi,s}function wa(n){const e=qn.get(n);return e===void 0&&$(75,n),e}function W(n){return{type:n}}const qt=W("SELECTION_CHANGE_COMMAND"),Df=W("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),us=W("CLICK_COMMAND"),$f=W("BEFORE_INPUT_COMMAND"),Af=W("INPUT_COMMAND"),Ff=W("COMPOSITION_START_COMMAND"),zf=W("COMPOSITION_END_COMMAND"),vn=W("DELETE_CHARACTER_COMMAND"),vr=W("INSERT_LINE_BREAK_COMMAND"),Hn=W("INSERT_PARAGRAPH_COMMAND"),Kn=W("CONTROLLED_TEXT_INSERTION_COMMAND"),Vr=W("PASTE_COMMAND"),mi=W("REMOVE_TEXT_COMMAND"),zr=W("DELETE_WORD_COMMAND"),Or=W("DELETE_LINE_COMMAND"),Ot=W("FORMAT_TEXT_COMMAND"),zm=W("SET_TEXT_FORMAT_COMMAND"),cs=W("UNDO_COMMAND"),ds=W("REDO_COMMAND"),fs=W("KEYDOWN_COMMAND"),kl=W("KEY_ARROW_RIGHT_COMMAND"),Of=W("MOVE_TO_END"),xl=W("KEY_ARROW_LEFT_COMMAND"),Mf=W("MOVE_TO_START"),Cl=W("KEY_ARROW_UP_COMMAND"),vl=W("KEY_ARROW_DOWN_COMMAND"),$i=W("KEY_ENTER_COMMAND"),jf=W("KEY_SPACE_COMMAND"),hs=W("KEY_BACKSPACE_COMMAND"),Sl=W("KEY_ESCAPE_COMMAND"),wl=W("KEY_DELETE_COMMAND"),El=W("KEY_TAB_COMMAND"),Om=W("INSERT_TAB_COMMAND"),Mm=W("INDENT_CONTENT_COMMAND"),Wu=W("OUTDENT_CONTENT_COMMAND"),Rf=W("DROP_COMMAND"),Pf=W("FORMAT_ELEMENT_COMMAND"),Lf=W("DRAGSTART_COMMAND"),If=W("DRAGOVER_COMMAND"),jm=W("DRAGEND_COMMAND"),Io=W("COPY_COMMAND"),gs=W("CUT_COMMAND"),Tl=W("SELECT_ALL_COMMAND"),Rm=W("CLEAR_EDITOR_COMMAND"),Pm=W("CLEAR_HISTORY_COMMAND"),ao=W("CAN_REDO_COMMAND"),lo=W("CAN_UNDO_COMMAND"),Bf=W("FOCUS_COMMAND"),Lm=W("BLUR_COMMAND"),Im=W("KEY_MODIFIER_COMMAND");function Bm(n){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(t,r){let o=e.get(t);o===void 0&&(o={dispose:n(t,r),holders:new Set},e.set(t,o));const i=()=>{const s=e.get(t);s&&s.holders.delete(i)&&s.holders.size===0&&(e.delete(t),s.dispose())};return o.holders.add(i),i}}}function mo(n,e,t,r){return n.addEventListener(e,t,r),n.removeEventListener.bind(n,e,t,r)}const rn=Object.freeze({}),Ea=[["keydown",function(n,e){const t=e._inputState;t.lastKeyDownTimeStamp=n.timeStamp,t.lastKeyCode=n.key,n.key!=="Backspace"&&wo(t),!e.isComposing()&&I(e,fs,n)}],["pointerdown",function(n,e){const t=Vn(n),r=n.pointerType;Lt(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&wt(e,()=>{Ji(t,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(n,e){I(e,Ff,n)}],["compositionend",function(n,e){const t=e._inputState;Pt?t.compositionPhase="ending-firefox":En||!jo&&!Ro?I(e,zf,n):(t.compositionPhase="ending-safari",t.compositionEndData=n.data)}],["input",function(n,e){n.stopPropagation();const t=e._inputState;wo(t),wt(e,()=>{Uf(n,e)||e.dispatchCommand(Af,n)},{event:n}),t.unprocessedBeforeInputData=null}],["click",function(n,e){wt(e,()=>{const t=z(),r=Pe(gt(e)),o=yt();if(r){if(N(t)){const i=t.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!Oe(s)&&ge().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&t.is(o)&&(r.removeAllRanges(),t.dirty=!0)}else if(n.pointerType==="touch"||n.pointerType==="pen"){const i=ft(r,e._rootElement).anchorNode;(q(i)||ht(i))&&_e(To(o,r,e,n))}}if(Pt&&r!==null&&r.rangeCount===0){const i=e._rootElement;if(i!==null&&n.target===i){const s=n.clientY;let a=i.childNodes.length;for(let u=0;u<i.childNodes.length;u++){const c=i.childNodes[u];if(q(c)){const d=c.getBoundingClientRect();if(s<=(d.top+d.bottom)/2){a=u;break}}}r.setBaseAndExtent(i,a,i,a);const l=To(o,r,e,n);l!==null?_e(l):r.removeAllRanges()}}I(e,us,n)})}],["cut",rn],["copy",rn],["dragstart",rn],["dragover",rn],["dragend",rn],["paste",rn],["focus",rn],["blur",rn],["drop",rn]];Fr&&Ea.push(["beforeinput",(n,e)=>(function(t,r){const o=t.inputType;o==="deleteCompositionText"||Pt&&Fh(r)||o!=="insertCompositionText"&&wt(r,()=>{Uf(t,r)||I(r,$f,t)},{event:t})})(n,e)]);const Ta=new WeakMap,Ai=new WeakMap,Km=Bm(n=>(n.addEventListener("selectionchange",Vu),()=>n.removeEventListener("selectionchange",Vu)));function Kf(n,e,t,r,o,i){const s=n.anchor,a=n.focus,l=s.getNode(),u=he();let c;if(i!==void 0)c=i;else{const m=Pe(gt(u));c=m!==null?ft(m,u._rootElement):null}const d=c!==null?c.anchorNode:null,f=s.key,h=u.getElementByKey(f),g=t.length;return f!==a.key||!D(l)||(!o&&(!Fr||u._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||l.isDirty()&&g<2||Dh(t))&&s.offset!==a.offset&&!l.isComposing()||Et(l)||l.isDirty()&&g>1||(o||!Fr)&&h!==null&&!l.isComposing()&&d!==wn(l,h,u)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||!l.isComposing()&&(l.getFormat()!==n.format||l.getStyle()!==n.style)||(function(m,p){if(p.isSegmented())return!0;if(!m.isCollapsed())return!1;const y=m.anchor.offset,_=p.getParentOrThrow(),b=Ki(p);return y===0?!p.canInsertTextBefore()||!_.canInsertTextBefore()&&!p.isComposing()||b||(function(k){const S=k.getPreviousSibling();return(D(S)||C(S)&&S.isInline())&&!S.canInsertTextAfter()})(p):y===p.getTextContentSize()&&(!p.canInsertTextAfter()||!_.canInsertTextAfter()&&!p.isComposing()||b)})(n,l)}function qu(n,e){return ht(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function Uu(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=ft(n,e._rootElement),a=e._inputState;a.isSelectionChangeFromDOMUpdate&&(a.isSelectionChangeFromDOMUpdate=!1,qu(r,o)&&qu(i,s)&&!a.postDeleteSelectionToRestore)||wt(e,()=>{if(!t)return void _e(null);if(!Wo(e,r,i))return;let l=z();if(a.postDeleteSelectionToRestore&&N(l)&&l.isCollapsed()){const u=l.anchor,c=a.postDeleteSelectionToRestore.anchor;(u.key===c.key&&u.offset===c.offset+1||u.offset===1&&c.getNode().is(u.getNode().getPreviousSibling()))&&(l=a.postDeleteSelectionToRestore.clone(),_e(l))}if(a.postDeleteSelectionToRestore=null,N(l)){const u=l.anchor,c=u.getNode();if(l.isCollapsed()){n.type==="Range"&&r===i&&(l.dirty=!0);const d=gt(e).event,f=d?d.timeStamp:performance.now(),{format:h,style:g,offset:m,key:p,timeStamp:y}=a.collapsedSelectionFormat,_=ge(),b=e.isComposing()===!1&&_.getTextContent()==="";if(f<y+200&&u.offset===m&&u.key===p)yi(l,h,g);else if(u.type==="text")D(c)||$(141),Wf(l,c);else if(u.type==="element"&&!b){C(c)||$(259);const k=u.getNode();k.isEmpty()?(function(S,x){const w=x.getTextFormat(),v=x.getTextStyle();yi(S,w,v)})(l,k):yi(l,l.format,"")}}else{const d=u.key,f=l.focus.key,h=l.getNodes(),g=h.length,m=l.isBackward(),p=m?s:o,y=m?o:s,_=m?f:d,b=m?d:f;let k=2047,S=!1;for(let x=0;x<g;x++){const w=h[x],v=w.getTextContentSize();if(D(w)&&v!==0&&!(x===0&&w.__key===_&&p===v||x===g-1&&w.__key===b&&y===0)&&(S=!0,k&=w.getFormat(),k===0))break}l.format=S?k:0}}I(e,qt)})}function yi(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function Wf(n,e){yi(n,e.getFormat(),e.getStyle())}function qf(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Hu(n){const{lastKeyCode:e}=he()._inputState;if(n==null||n.length<=1||e==null)return;const t=e.length===1?e:e==="Enter"?`
4
4
  `:e==="Tab"?" ":null;if(!t)return;const r=z();if(!N(r)||!r.isCollapsed())return;const o=r.anchor.getNode();if(!D(o))return;const{offset:i}=r.anchor;if(o.getTextContentSize()===i){const s=o.getNextSibling();if(t===`
@@ -1 +1 @@
1
- import{e}from"./index-DMZ8-zZM.js";const a=e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);export{a as R};
1
+ import{e}from"./index-DFvn5y4c.js";const a=e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);export{a as R};
@@ -1 +1 @@
1
- import{r as e,j as l,f as b,t as y,L as x}from"./index-DMZ8-zZM.js";const i=()=>l.jsx(x,{className:"size-3.5 animate-spin"}),m=(s,n)=>n?l.jsx("span",{className:"sr-only",children:s}):s;function p({actions:s=[],destructive:n,className:o}){const[f,r]=e.useState(!1);return f&&n?.confirm?l.jsxs("div",{className:y("flex items-center gap-2",o),children:[l.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),l.jsx(b,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:n.confirm.cancelLabel??"Cancel"}),l.jsx(b,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?i():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):l.jsxs("div",{className:y("flex items-center gap-2",o),children:[s.map(a=>l.jsx(b,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?i():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:m(a.label,a.iconOnly)},a.label)),n&&l.jsx(b,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?i():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){r(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:m(n.label,n.iconOnly)})]})}export{p as R};
1
+ import{r as e,j as l,f as b,t as y,L as x}from"./index-DFvn5y4c.js";const i=()=>l.jsx(x,{className:"size-3.5 animate-spin"}),m=(s,n)=>n?l.jsx("span",{className:"sr-only",children:s}):s;function p({actions:s=[],destructive:n,className:o}){const[f,r]=e.useState(!1);return f&&n?.confirm?l.jsxs("div",{className:y("flex items-center gap-2",o),children:[l.jsx("span",{className:"text-xs text-fg-muted",children:n.confirm.prompt}),l.jsx(b,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:n.confirm.cancelLabel??"Cancel"}),l.jsx(b,{variant:"danger",size:"sm","aria-busy":n.busy,icon:n.busy?i():void 0,onClick:()=>{n.busy||n.onClick()},children:n.busy?n.busyLabel??"Working…":n.confirm.confirmLabel??n.label})]}):l.jsxs("div",{className:y("flex items-center gap-2",o),children:[s.map(a=>l.jsx(b,{variant:a.variant??"ghost",size:"sm","aria-busy":a.busy,"aria-label":a.iconOnly?a.label:void 0,icon:a.busy?i():a.icon,onClick:()=>{a.busy||a.onClick()},children:a.busy&&a.busyLabel?a.busyLabel:m(a.label,a.iconOnly)},a.label)),n&&l.jsx(b,{variant:"ghost",size:"sm","aria-busy":n.busy,"aria-label":n.iconOnly?n.label:void 0,icon:n.busy?i():n.icon,onClick:()=>{if(!n.busy){if(n.confirm){r(!0);return}n.onClick()}},children:n.busy&&n.busyLabel?n.busyLabel:m(n.label,n.iconOnly)})]})}export{p as R};
@@ -1 +1 @@
1
- import{u as x,C as v,x as p,z as I,aj as g,r as Q}from"./index-DMZ8-zZM.js";import{b}from"./MailShell-Cd-aCKBf.js";import{a as C}from"./useMessageBodyContent-DxQjkGza.js";function W(o){const t=x(),{searchInput:c,searchQuery:e}=v(),i=p({select:a=>I(a.location.search)}),u=p({select:a=>a.location.pathname}),h=C(),f=g(),m=h||f,{to:s}=o,r="params"in o?o.params.mailboxId:void 0,l=r?`/mail/${r}`:s;Q.useEffect(()=>{if(!b({searchInput:c,committedQuery:e,urlQuery:i,pathname:u,listPath:l}))return;const y=!!e&&i!==e&&!m,n=d=>({...d,q:e||void 0});if(!y){t({to:".",search:n,hash:!0,replace:!0});return}if(s==="/mail/$mailboxId"){if(!r)return;t({to:s,params:{mailboxId:r},search:n,hash:!0,replace:!0});return}t({to:s,search:n,hash:!0,replace:!0})},[c,e,i,t,s,r,l,u,m])}export{W as u};
1
+ import{u as x,C as v,x as p,z as I,aj as g,r as Q}from"./index-DFvn5y4c.js";import{b}from"./MailShell-PzyuiJnk.js";import{a as C}from"./useMessageBodyContent-DlWOVC8_.js";function W(o){const t=x(),{searchInput:c,searchQuery:e}=v(),i=p({select:a=>I(a.location.search)}),u=p({select:a=>a.location.pathname}),h=C(),f=g(),m=h||f,{to:s}=o,r="params"in o?o.params.mailboxId:void 0,l=r?`/mail/${r}`:s;Q.useEffect(()=>{if(!b({searchInput:c,committedQuery:e,urlQuery:i,pathname:u,listPath:l}))return;const y=!!e&&i!==e&&!m,n=d=>({...d,q:e||void 0});if(!y){t({to:".",search:n,hash:!0,replace:!0});return}if(s==="/mail/$mailboxId"){if(!r)return;t({to:s,params:{mailboxId:r},search:n,hash:!0,replace:!0});return}t({to:s,search:n,hash:!0,replace:!0})},[c,e,i,t,s,r,l,u,m])}export{W as u};
@@ -1 +1 @@
1
- import{e as H,r as l,j as h,a1 as U,t as k,c1 as V,X as _,c2 as P,c3 as z,c4 as G,c5 as X,c6 as J,a8 as x,u as Y,c7 as W,c8 as w,c9 as Z,E as ee,ah as te,ca as ne,cb as se,ab as re,G as K,ad as oe,ae,C as ie,cc as L}from"./index-DMZ8-zZM.js";import{s as ce,S as le}from"./search-scope-B5-OK3Cq.js";import{a as ue}from"./useLayoutTier-DKpSXts5.js";import{u as M}from"./useQueries-Baii11SK.js";const Le=H("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),de=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ke(e){return de.filter(t=>e[t.action]!==void 0)}const fe=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function pe(e){for(const t of fe){const n=t.hints.find(s=>s.action===e);if(n)return n.keys}}function he(e){const t=pe(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Me(e){const t=he(e);return t===""?"":`(${t})`}function me({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:s,hasValue:o,chipCount:r}){const i=r-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:i}:e==="Backspace"||e==="ArrowLeft"?!s||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:i}:{type:"none"}}function ye({key:e,repeat:t=!1,index:n,chipCount:s}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=s-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function ge(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const be=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,xe=({chips:e=[],onRemoveChip:t,value:n,onChange:s,onClear:o,onClearQuery:r,placeholder:i="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m="sm",inputId:d,suggest:f,className:b})=>{const F=l.useId(),N=d??F,I=l.useRef(null),R=l.useRef([]),A=r??o,[j,C]=l.useState(null),v=l.useRef(void 0),[$,q]=l.useState(""),T=e.length>0;l.useEffect(()=>{C(a=>a!==null&&a>=e.length?null:a)},[e.length]),l.useEffect(()=>{const a=v.current;if(a!==void 0){if(v.current=void 0,a===null){I.current?.focus();return}R.current[a]?.focus()}});const D=l.useRef(void 0);l.useEffect(()=>{const a=f?.caret;if(!a||a===D.current)return;D.current=a;const c=I.current;!c||c.ownerDocument.activeElement!==c||(c.setSelectionRange(a.cursor,a.cursor),f?.onCaretChange(a.cursor))});const S=a=>{f?.onCaretChange(a.selectionStart??a.value.length)},y=l.useCallback(a=>{C(a),v.current=a},[]),E=l.useCallback(a=>{const c=e[a];c&&t&&(y(ge(a,e.length)),q(`${c.label} removed`),t(c.id))},[e,t,y]),O=l.useCallback(()=>{y(null),o()},[o,y]),Q=l.useCallback(a=>{const c=a.currentTarget;if(f?.onKeyDown(a))return;const g=me({key:a.key,shiftKey:a.shiftKey,repeat:a.repeat,caretAtStart:c.selectionStart===0&&c.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(g.type){case"focusChip":a.preventDefault(),y(g.index);return;case"clearQuery":A();return;case"blur":c.blur();return;case"none":return}},[e.length,n,A,y,f]),B=l.useCallback(a=>c=>{const g=ye({key:c.key,repeat:c.repeat,index:a,chipCount:e.length});switch(g.type!=="none"&&c.preventDefault(),g.type){case"removeChip":E(g.index);return;case"focusChip":y(g.index);return;case"focusInput":y(null);return;case"activateChip":return;case"none":return}},[e,E,y]);return l.useEffect(()=>{if(!u)return;const a=c=>{c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey||be(c.target)||P("focusSearch")||(c.preventDefault(),I.current?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[u]),h.jsxs("label",{htmlFor:N,className:k("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",m==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",b),children:[h.jsx(U,{className:k("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[T&&h.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((a,c)=>h.jsx(V,{ref:g=>{R.current[c]=g},label:a.label,tone:a.tone,focused:j===c,onFocusLabel:()=>C(c),onKeyDown:B(c),onRemove:()=>E(c)},a.id))}),h.jsx("input",{ref:I,id:N,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:j===null?0:-1,onChange:a=>{s(a.target.value),S(a.target)},onKeyDown:Q,onKeyUp:a=>S(a.currentTarget),onClick:a=>S(a.currentTarget),onFocus:a=>{C(null),f?.onFocusChange?.(!0),S(a.currentTarget)},onBlur:()=>f?.onFocusChange?.(!1),...f?.comboboxProps,placeholder:T?void 0:i,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||T)&&p&&h.jsx("button",{type:"button",onClick:O,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:h.jsx(_,{className:k("text-fg-muted",m==="lg"?"size-5":"size-4")})}),h.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:$})]})},Ne=({value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m,inputId:d,suggest:f,className:b})=>h.jsx(xe,{value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i,globalFocusKey:u,showClearButton:p,size:m,inputId:d,suggest:f,className:b});function Re({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:s=1e3}){const o=l.useRef(e);o.current=e;const r=l.useRef(null),i=l.useRef(null);l.useEffect(()=>{if(!t)return;const u=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},p=d=>{const f=z({key:d.key,shiftKey:d.shiftKey,metaKey:d.metaKey,ctrlKey:d.ctrlKey,altKey:d.altKey,inEditable:X(d.target),onControl:G(d.target)},r.current);if(J().length>0){u(),r.current=null;return}if(u(),r.current=f.nextPrefix,f.nextPrefix!==null&&(i.current=setTimeout(()=>{r.current=null,i.current=null},s)),f.action===null||P(f.action)!==null)return;const b=o.current[f.action];b&&(f.preventDefault&&d.preventDefault(),b())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",p),()=>{m.removeEventListener("keydown",p),u(),r.current=null}},[t,s,n])}function Ae(){const e=x({from:"/mail/brief/$threadId",shouldThrow:!1}),t=x({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=x({from:"/mail/flagged/$threadId",shouldThrow:!1}),s=x({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),o=x({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=x({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),i=e?.threadId??n?.threadId??o?.threadId,u=t?.messageId??s?.messageId??r?.messageId;return l.useMemo(()=>i?{threadId:i,messageId:u}:void 0,[i,u])}function je(){const e=Y(),t=W(),{list:n,mailboxId:s}=w();return l.useCallback((o,r)=>{const i=r?.query,p={search:d=>i===void 0?d:{...d,q:i||void 0},hash:t,replace:r?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:o,...p});return}const m=r?.mailboxId??s;if(n==="mailbox"&&m){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:m,...o},...p});return}e({to:"/mail/brief/$threadId/$messageId",params:o,...p})},[e,t,n,s])}function De(){return Z()}const Pe=({trigger:e,children:t,align:n="right"})=>{const[s,o]=l.useState(!1),r=l.useRef(null),i=l.useCallback(u=>{r.current&&!r.current.contains(u.target)&&o(!1)},[]);return ee({id:"dropdown-menu",open:s,answers:{back:()=>o(!1)}}),l.useEffect(()=>(s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)),[s,i]),h.jsxs("div",{ref:r,className:"relative",children:[h.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),o(!s)},className:k("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:e}),s&&h.jsx("div",{className:k("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",n==="right"?"right-0":"left-0"),children:t})]})},Fe=({onClick:e,disabled:t,destructive:n,children:s})=>h.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:k("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",n&&"text-danger hover:text-danger"),children:s}),$e=()=>h.jsx("div",{className:"my-1 h-px bg-line"}),ke=e=>typeof e=="object"&&e!==null&&Array.isArray(e.pages),we=e=>typeof e=="object"&&e!==null&&Array.isArray(e.items),Ie=(e,t)=>e===void 0?e:ke(e)?{...e,pages:e.pages.map(n=>({...n,items:t(n.items)}))}:we(e)?{...e,items:t(e.items)}:e,qe=e=>{const t=[];for(const n of new Set(e))t.push(te({path:{mailboxId:n}})),t.push(ne({path:{mailboxId:n}}));return t.push(se()),t},Oe=(e,t)=>Promise.all(t.map(n=>e.cancelQueries({queryKey:n}))),Qe=(e,t)=>t.flatMap(n=>e.getQueriesData({queryKey:n})).filter(n=>n[1]!==void 0).map(([n,s])=>({queryKey:n,data:s})),Be=(e,t,n)=>{const s=o=>Ie(o,n);for(const o of t)e.setQueriesData({queryKey:o},s)},He=(e,t)=>{for(const n of t)e.setQueryData(n.queryKey,n.data)},Ue=(e,t)=>{for(const n of t)e.invalidateQueries({queryKey:n})},Ce=({accounts:e})=>{const{list:t,mailboxId:n}=w(),{t:s}=re("mail",{useSuspense:!1}),o=l.useCallback((i,u)=>s(i,{defaultValue:u}),[s]),r=M({queries:e.map(i=>({...K({path:{accountId:i.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let i=0;i<e.length;i++){const u=r[i]?.data?.items;if(!u)continue;const p=u.find(d=>d.mailboxId===n);if(!p)continue;const m=oe(e[i].folderAppointments);return ae(p,m.get(n),o)}return null},Ve=({accounts:e})=>{const{mailboxId:t}=w(),n=M({queries:e.map(s=>({...K({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return null;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.unseenCount}return null},_e=({accounts:e})=>{const{mailboxId:t}=w(),n=M({queries:e.map(s=>({...K({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.messageCount}return 0};function ze(e){const t=ue(),{searchInput:n}=ie(),s=Ce({accounts:e}),o=w(),r=ce(o,s),i=l.useCallback(u=>{u===le&&t(n)},[t,n]);return{scope:r,clearScope:i}}function Ge(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase(),o=s.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(s)||t.set(s,n.accountId)}return t}function Xe(e){const t=new Map;for(const n of e)for(const s of n){const o=s.fullPath?.toLowerCase();if(!o)continue;const r=L(s).toLowerCase();t.has(o)||t.set(o,s.mailboxId),t.has(r)||t.set(r,s.mailboxId)}return t}function Je(e,t=[]){const n=e.flat().filter(r=>r.fullPath),s=new Map;for(const r of n){const i=L(r).toLowerCase();s.set(i,(s.get(i)??0)+1)}const o=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const i=L(r),u=s.get(i.toLowerCase())===1,p=t.length>1?o.get(r.accountId):void 0;return{value:u?i:r.fullPath,label:r.displayNameOverride?.trim()||i,...p?{hint:p}:{}}})}function Ye(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase().split("@")[0]??"";t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=n.email.split("@")[0]??n.email,o=t.get(s.toLowerCase())===1,r=n.displayName?.trim();return{value:o?s:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{Ke as A,Pe as D,fe as K,Le as R,Ne as S,$e as a,Fe as b,Xe as c,Ae as d,Re as e,Ge as f,je as g,De as h,Ue as i,Ce as j,Ve as k,_e as l,de as m,Oe as n,Qe as o,Be as p,Ie as q,He as r,he as s,qe as t,ze as u,ke as v,we as w,Me as x,Je as y,Ye as z};
1
+ import{e as H,r as l,j as h,a1 as U,t as k,c1 as V,X as _,c2 as P,c3 as z,c4 as G,c5 as X,c6 as J,a8 as x,u as Y,c7 as W,c8 as w,c9 as Z,E as ee,ah as te,ca as ne,cb as se,ab as re,G as K,ad as oe,ae,C as ie,cc as L}from"./index-DFvn5y4c.js";import{s as ce,S as le}from"./search-scope-B5-OK3Cq.js";import{a as ue}from"./useLayoutTier-BJPTvUFH.js";import{u as M}from"./useQueries-C-FWQch-.js";const Le=H("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),de=[{action:"focusNext",keys:["j","k"],label:"navigate"},{action:"muteSender",keys:["m"],label:"mute"},{action:"help",keys:["?"],label:"all shortcuts"}];function Ke(e){return de.filter(t=>e[t.action]!==void 0)}const fe=[{title:"Navigation",hints:[{action:"focusNext",keys:["j"],description:"Focus the message below"},{action:"focusPrevious",keys:["k"],description:"Focus the message above"},{action:"focusNext",keys:["↓"],description:"Focus the message below"},{action:"focusPrevious",keys:["↑"],description:"Focus the message above"},{action:"focusFirst",keys:["Home"],description:"Focus first"},{action:"focusLast",keys:["End"],description:"Focus last"},{action:"openFocused",keys:["Enter"],description:"Open focused thread"},{action:"back",keys:["Esc"],description:"Back / close overlay"}]},{title:"Selection",hints:[{action:"toggleSelect",keys:["x"],description:"Toggle select"},{action:"toggleSelect",keys:["Space"],description:"Toggle select"},{action:"extendSelectDown",keys:["Shift","j"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","k"],description:"Extend selection up"},{action:"extendSelectDown",keys:["Shift","↓"],description:"Extend selection down"},{action:"extendSelectUp",keys:["Shift","↑"],description:"Extend selection up"},{action:"selectAll",keys:["⌘","A"],description:"Select all"}]},{title:"Actions",hints:[{action:"reply",keys:["r"],description:"Reply"},{action:"replyAll",keys:["a"],description:"Reply all"},{action:"forward",keys:["f"],description:"Forward"},{action:"delete",keys:["#"],description:"Delete"},{action:"toggleStar",keys:["s"],description:"Star / unstar"},{action:"toggleRead",keys:["u"],description:"Toggle read / unread"}]},{title:"Sender",hints:[{action:"muteSender",keys:["m"],description:"Mute sender"},{action:"blockSender",keys:["b"],description:"Block sender"},{action:"vipSender",keys:["v"],description:"VIP sender"},{action:"markJunk",keys:["!"],description:"Mark junk"}]},{title:"Go to",hints:[{action:"goBrief",keys:["g","b"],description:"Daily brief"},{action:"goInbox",keys:["g","i"],description:"Inbox"},{action:"goSent",keys:["g","s"],description:"Sent"},{action:"goFlagged",keys:["g","f"],description:"Starred"},{action:"goSettings",keys:["g",","],description:"Settings"}]},{title:"View & global",hints:[{action:"toggleIntelligence",keys:["i"],description:"Toggle intelligence"},{action:"toggleDensity",keys:["d"],description:"Toggle density"},{action:"focusSearch",keys:["/"],description:"Focus search"},{action:"compose",keys:["c"],description:"Compose"},{action:"compose",keys:["⌘","N"],description:"Compose"},{action:"help",keys:["?"],description:"Shortcut help"}]}];function pe(e){for(const t of fe){const n=t.hints.find(s=>s.action===e);if(n)return n.keys}}function he(e){const t=pe(e);return!t||t.length===0?"":t.length===1?t[0]??"":t[0]==="g"?t.join(" then "):t.join("")}function Me(e){const t=he(e);return t===""?"":`(${t})`}function me({key:e,shiftKey:t=!1,repeat:n=!1,caretAtStart:s,hasValue:o,chipCount:r}){const i=r-1;return e==="Escape"?o?{type:"clearQuery"}:{type:"blur"}:e==="Tab"&&t?r===0?{type:"none"}:{type:"focusChip",index:i}:e==="Backspace"||e==="ArrowLeft"?!s||r===0?{type:"none"}:n?{type:"none"}:{type:"focusChip",index:i}:{type:"none"}}function ye({key:e,repeat:t=!1,index:n,chipCount:s}){return e==="Backspace"||e==="Delete"?t?{type:"none"}:{type:"removeChip",index:n}:e==="ArrowLeft"?n===0?{type:"none"}:{type:"focusChip",index:n-1}:e==="ArrowRight"?n>=s-1?{type:"focusInput"}:{type:"focusChip",index:n+1}:e==="Enter"||e===" "?{type:"activateChip",index:n}:e==="Escape"?{type:"focusInput"}:{type:"none"}}function ge(e,t){const n=t-1;return n<=0?null:e<n?e:n-1}const be=e=>e instanceof HTMLElement?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable:!1,xe=({chips:e=[],onRemoveChip:t,value:n,onChange:s,onClear:o,onClearQuery:r,placeholder:i="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m="sm",inputId:d,suggest:f,className:b})=>{const F=l.useId(),N=d??F,I=l.useRef(null),R=l.useRef([]),A=r??o,[j,C]=l.useState(null),v=l.useRef(void 0),[$,q]=l.useState(""),T=e.length>0;l.useEffect(()=>{C(a=>a!==null&&a>=e.length?null:a)},[e.length]),l.useEffect(()=>{const a=v.current;if(a!==void 0){if(v.current=void 0,a===null){I.current?.focus();return}R.current[a]?.focus()}});const D=l.useRef(void 0);l.useEffect(()=>{const a=f?.caret;if(!a||a===D.current)return;D.current=a;const c=I.current;!c||c.ownerDocument.activeElement!==c||(c.setSelectionRange(a.cursor,a.cursor),f?.onCaretChange(a.cursor))});const S=a=>{f?.onCaretChange(a.selectionStart??a.value.length)},y=l.useCallback(a=>{C(a),v.current=a},[]),E=l.useCallback(a=>{const c=e[a];c&&t&&(y(ge(a,e.length)),q(`${c.label} removed`),t(c.id))},[e,t,y]),O=l.useCallback(()=>{y(null),o()},[o,y]),Q=l.useCallback(a=>{const c=a.currentTarget;if(f?.onKeyDown(a))return;const g=me({key:a.key,shiftKey:a.shiftKey,repeat:a.repeat,caretAtStart:c.selectionStart===0&&c.selectionEnd===0,hasValue:n.length>0,chipCount:e.length});switch(g.type){case"focusChip":a.preventDefault(),y(g.index);return;case"clearQuery":A();return;case"blur":c.blur();return;case"none":return}},[e.length,n,A,y,f]),B=l.useCallback(a=>c=>{const g=ye({key:c.key,repeat:c.repeat,index:a,chipCount:e.length});switch(g.type!=="none"&&c.preventDefault(),g.type){case"removeChip":E(g.index);return;case"focusChip":y(g.index);return;case"focusInput":y(null);return;case"activateChip":return;case"none":return}},[e,E,y]);return l.useEffect(()=>{if(!u)return;const a=c=>{c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey||be(c.target)||P("focusSearch")||(c.preventDefault(),I.current?.focus())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[u]),h.jsxs("label",{htmlFor:N,className:k("flex w-full items-center gap-1.5 text-sm","bg-surface-sunken/50 border border-transparent","focus-within:bg-canvas focus-within:border-line focus-within:ring-2 focus-within:ring-ring","transition-colors",m==="lg"?"rounded-xl px-4 py-2":"rounded-md px-2.5 py-1",b),children:[h.jsx(U,{className:k("shrink-0 text-fg-muted pointer-events-none",m==="lg"?"size-5":"size-4")}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:[T&&h.jsx("div",{role:"grid","aria-label":"Search filters",className:"flex min-w-0 flex-wrap items-center gap-1",children:e.map((a,c)=>h.jsx(V,{ref:g=>{R.current[c]=g},label:a.label,tone:a.tone,focused:j===c,onFocusLabel:()=>C(c),onKeyDown:B(c),onRemove:()=>E(c)},a.id))}),h.jsx("input",{ref:I,id:N,name:"q",type:"text","aria-label":"Search mail",autoComplete:"off",value:n,tabIndex:j===null?0:-1,onChange:a=>{s(a.target.value),S(a.target)},onKeyDown:Q,onKeyUp:a=>S(a.currentTarget),onClick:a=>S(a.currentTarget),onFocus:a=>{C(null),f?.onFocusChange?.(!0),S(a.currentTarget)},onBlur:()=>f?.onFocusChange?.(!1),...f?.comboboxProps,placeholder:T?void 0:i,className:"min-w-24 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-muted"})]}),(n||T)&&p&&h.jsx("button",{type:"button",onClick:O,className:"shrink-0 rounded p-0.5 hover:bg-surface-raised transition-colors","aria-label":"Clear search",children:h.jsx(_,{className:k("text-fg-muted",m==="lg"?"size-5":"size-4")})}),h.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:$})]})},Ne=({value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i="Search mail...",globalFocusKey:u=!0,showClearButton:p=!0,size:m,inputId:d,suggest:f,className:b})=>h.jsx(xe,{value:e,onChange:t,onClear:n,onClearQuery:s,chips:o,onRemoveChip:r,placeholder:i,globalFocusKey:u,showClearButton:p,size:m,inputId:d,suggest:f,className:b});function Re({handlers:e,enabled:t=!0,target:n,sequenceTimeoutMs:s=1e3}){const o=l.useRef(e);o.current=e;const r=l.useRef(null),i=l.useRef(null);l.useEffect(()=>{if(!t)return;const u=()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)},p=d=>{const f=z({key:d.key,shiftKey:d.shiftKey,metaKey:d.metaKey,ctrlKey:d.ctrlKey,altKey:d.altKey,inEditable:X(d.target),onControl:G(d.target)},r.current);if(J().length>0){u(),r.current=null;return}if(u(),r.current=f.nextPrefix,f.nextPrefix!==null&&(i.current=setTimeout(()=>{r.current=null,i.current=null},s)),f.action===null||P(f.action)!==null)return;const b=o.current[f.action];b&&(f.preventDefault&&d.preventDefault(),b())},m=n===void 0?window:n;if(m!==null)return m.addEventListener("keydown",p),()=>{m.removeEventListener("keydown",p),u(),r.current=null}},[t,s,n])}function Ae(){const e=x({from:"/mail/brief/$threadId",shouldThrow:!1}),t=x({from:"/mail/brief/$threadId/$messageId",shouldThrow:!1}),n=x({from:"/mail/flagged/$threadId",shouldThrow:!1}),s=x({from:"/mail/flagged/$threadId/$messageId",shouldThrow:!1}),o=x({from:"/mail/$mailboxId/$threadId",shouldThrow:!1}),r=x({from:"/mail/$mailboxId/$threadId/$messageId",shouldThrow:!1}),i=e?.threadId??n?.threadId??o?.threadId,u=t?.messageId??s?.messageId??r?.messageId;return l.useMemo(()=>i?{threadId:i,messageId:u}:void 0,[i,u])}function je(){const e=Y(),t=W(),{list:n,mailboxId:s}=w();return l.useCallback((o,r)=>{const i=r?.query,p={search:d=>i===void 0?d:{...d,q:i||void 0},hash:t,replace:r?.replace??!1};if(n==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:o,...p});return}const m=r?.mailboxId??s;if(n==="mailbox"&&m){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{mailboxId:m,...o},...p});return}e({to:"/mail/brief/$threadId/$messageId",params:o,...p})},[e,t,n,s])}function De(){return Z()}const Pe=({trigger:e,children:t,align:n="right"})=>{const[s,o]=l.useState(!1),r=l.useRef(null),i=l.useCallback(u=>{r.current&&!r.current.contains(u.target)&&o(!1)},[]);return ee({id:"dropdown-menu",open:s,answers:{back:()=>o(!1)}}),l.useEffect(()=>(s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)),[s,i]),h.jsxs("div",{ref:r,className:"relative",children:[h.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),o(!s)},className:k("p-1.5 min-h-11 min-w-11 inline-flex items-center justify-center rounded-md transition-colors","hover:bg-surface-raised text-fg-muted hover:text-fg"),children:e}),s&&h.jsx("div",{className:k("absolute z-50 mt-1 min-w-[180px] py-1","bg-surface border border-line rounded-md shadow-lg",n==="right"?"right-0":"left-0"),children:t})]})},Fe=({onClick:e,disabled:t,destructive:n,children:s})=>h.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t||e()},disabled:t,className:k("w-full px-3 py-2 text-left text-sm transition-colors","flex items-center gap-2",t&&"opacity-50 cursor-not-allowed",!t&&"hover:bg-surface-raised",n&&"text-danger hover:text-danger"),children:s}),$e=()=>h.jsx("div",{className:"my-1 h-px bg-line"}),ke=e=>typeof e=="object"&&e!==null&&Array.isArray(e.pages),we=e=>typeof e=="object"&&e!==null&&Array.isArray(e.items),Ie=(e,t)=>e===void 0?e:ke(e)?{...e,pages:e.pages.map(n=>({...n,items:t(n.items)}))}:we(e)?{...e,items:t(e.items)}:e,qe=e=>{const t=[];for(const n of new Set(e))t.push(te({path:{mailboxId:n}})),t.push(ne({path:{mailboxId:n}}));return t.push(se()),t},Oe=(e,t)=>Promise.all(t.map(n=>e.cancelQueries({queryKey:n}))),Qe=(e,t)=>t.flatMap(n=>e.getQueriesData({queryKey:n})).filter(n=>n[1]!==void 0).map(([n,s])=>({queryKey:n,data:s})),Be=(e,t,n)=>{const s=o=>Ie(o,n);for(const o of t)e.setQueriesData({queryKey:o},s)},He=(e,t)=>{for(const n of t)e.setQueryData(n.queryKey,n.data)},Ue=(e,t)=>{for(const n of t)e.invalidateQueries({queryKey:n})},Ce=({accounts:e})=>{const{list:t,mailboxId:n}=w(),{t:s}=re("mail",{useSuspense:!1}),o=l.useCallback((i,u)=>s(i,{defaultValue:u}),[s]),r=M({queries:e.map(i=>({...K({path:{accountId:i.accountId}}),staleTime:1/0}))});if(t==="outbox")return"Outbox";if(!n)return null;for(let i=0;i<e.length;i++){const u=r[i]?.data?.items;if(!u)continue;const p=u.find(d=>d.mailboxId===n);if(!p)continue;const m=oe(e[i].folderAppointments);return ae(p,m.get(n),o)}return null},Ve=({accounts:e})=>{const{mailboxId:t}=w(),n=M({queries:e.map(s=>({...K({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return null;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.unseenCount}return null},_e=({accounts:e})=>{const{mailboxId:t}=w(),n=M({queries:e.map(s=>({...K({path:{accountId:s.accountId}}),staleTime:1/0}))});if(!t)return 0;for(const s of n){const o=s.data?.items;if(!o)continue;const r=o.find(i=>i.mailboxId===t);if(r)return r.messageCount}return 0};function ze(e){const t=ue(),{searchInput:n}=ie(),s=Ce({accounts:e}),o=w(),r=ce(o,s),i=l.useCallback(u=>{u===le&&t(n)},[t,n]);return{scope:r,clearScope:i}}function Ge(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase(),o=s.split("@")[0];o&&!t.has(o)&&t.set(o,n.accountId),t.has(s)||t.set(s,n.accountId)}return t}function Xe(e){const t=new Map;for(const n of e)for(const s of n){const o=s.fullPath?.toLowerCase();if(!o)continue;const r=L(s).toLowerCase();t.has(o)||t.set(o,s.mailboxId),t.has(r)||t.set(r,s.mailboxId)}return t}function Je(e,t=[]){const n=e.flat().filter(r=>r.fullPath),s=new Map;for(const r of n){const i=L(r).toLowerCase();s.set(i,(s.get(i)??0)+1)}const o=new Map(t.map(r=>[r.accountId,r.email]));return n.map(r=>{const i=L(r),u=s.get(i.toLowerCase())===1,p=t.length>1?o.get(r.accountId):void 0;return{value:u?i:r.fullPath,label:r.displayNameOverride?.trim()||i,...p?{hint:p}:{}}})}function Ye(e){const t=new Map;for(const n of e){const s=n.email.toLowerCase().split("@")[0]??"";t.set(s,(t.get(s)??0)+1)}return e.map(n=>{const s=n.email.split("@")[0]??n.email,o=t.get(s.toLowerCase())===1,r=n.displayName?.trim();return{value:o?s:n.email,label:r||n.email,...r?{hint:n.email}:{}}})}export{Ke as A,Pe as D,fe as K,Le as R,Ne as S,$e as a,Fe as b,Xe as c,Ae as d,Re as e,Ge as f,je as g,De as h,Ue as i,Ce as j,Ve as k,_e as l,de as m,Oe as n,Qe as o,Be as p,Ie as q,He as r,he as s,qe as t,ze as u,ke as v,we as w,Me as x,Je as y,Ye as z};
@@ -1 +1 @@
1
- import{u as e,r as s}from"./index-DMZ8-zZM.js";const a={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts",importConfig:"/import"};function c(){const t=e();return s.useCallback(o=>{t({to:a[o]})},[t])}function i(){const t=e();return s.useCallback(o=>{t({to:"/settings/accounts",search:{editAccountId:o,focusSmtp:!0}})},[t])}export{i as a,c as u};
1
+ import{u as e,r as s}from"./index-DFvn5y4c.js";const a={brief:"/mail/brief",flagged:"/mail/flagged",outbox:"/mail/outbox",settings:"/settings",accounts:"/settings/accounts",importConfig:"/import"};function c(){const t=e();return s.useCallback(o=>{t({to:a[o]})},[t])}function i(){const t=e();return s.useCallback(o=>{t({to:"/settings/accounts",search:{editAccountId:o,focusSmtp:!0}})},[t])}export{i as a,c as u};
@@ -1 +1 @@
1
- import{j as e,t as S,u as L,r as c,aK as O,ay as T,a1 as $,aM as A,c as I,bC as M,h as C,i as k,bD as q,bE as P,f as N,W as R,bF as G,X as K}from"./index-DMZ8-zZM.js";import{K as f}from"./kbd-BV5q0Za-.js";import{S as Q,a as E}from"./settings-screen-BZEszQ1s.js";import{E as V}from"./ErrorState-BGolGYcc.js";import{u as D}from"./useDebouncedValue-BBOZojyy.js";import{a as F}from"./format-RgJz8yFq.js";import{s as _}from"./help-copy-DdhDXdzQ.js";import"./avatar-klLMB_Me.js";import"./chevron-left-CK510N2A.js";import"./menu-DqCvhoo6.js";import"./circle-help-rRKfilDF.js";function B({options:t,active:r,onSelect:m}){return e.jsx("div",{role:"tablist",className:S("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(a=>{const d=a.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(a.id),className:S("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:a.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:a.count??"—"})]},a.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function H({query:t,onCount:r}){const{data:m,isPending:a,isError:d,error:b}=I(M()),g=C(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:q()})}}),l=m?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(n=>(n.displayName??"").toLowerCase().includes(p)||n.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),a?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:b})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(f,{children:"v"})," on any message to promote a sender to VIP."]}):u.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),u.map(n=>e.jsx(E,{name:n.displayName??n.normalizedEmail,email:n.normalizedEmail,meta:n.replyCount>0?`${n.inboundCount} received · you replied ${n.replyCount}×`:`${n.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:n.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},n.addressId))]})}function U({group:t,query:r,onCount:m}){const a=D(r.trim(),300),d=C(),[b,g]=c.useState(null),i=a.length>=2,l=G({query:{q:a,limit:50}}),{data:p,isPending:u,isError:n,error:j}=I({...l,enabled:i}),x=k({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),h=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{m?.(i?h.length:0,null)},[m,i,h.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):n?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):h.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",a,"”."]}):e.jsx(e.Fragment,{children:h.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&F(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=x.isPending&&x.variables?.path.addressId===s.addressId,z=x.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(K,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}}))}})},s.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",v[t].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(f,{children:"m"})," on any message to mute its sender; ",e.jsx(f,{children:"b"})," to block."]})]})}function ie(){const t=L(),[r,m]=c.useState("vip"),[a,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),n=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),x=p[r],h=s=>{const o=A[s];o&&t({to:o})};return e.jsx(Q,{items:O,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:_,helpOpen:b,onToggleHelp:()=>g(s=>!s),onSelect:h,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(B,{active:r,onSelect:s=>{m(s),d("")},options:["vip","muted","blocked"].map(s=>({id:s,label:v[s],count:p[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(T,{icon:e.jsx($,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:a,onChange:s=>d(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:r==="vip"?e.jsx(H,{query:a,onCount:n}):e.jsx(U,{group:r,query:a,onCount:j})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:x!=null?`${i} of ${x} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(f,{children:"j"})," ",e.jsx(f,{children:"k"})," navigate · ",e.jsx(f,{children:"⌫"})," remove flag"]})]})]})]})})}export{ie as component};
1
+ import{j as e,t as S,u as L,r as c,aK as O,ay as T,a1 as $,aM as A,c as I,bC as M,h as C,i as k,bD as q,bE as P,f as N,W as R,bF as G,X as K}from"./index-DFvn5y4c.js";import{K as f}from"./kbd-Mu7aD0zn.js";import{S as Q,a as E}from"./settings-screen-BymHQPcS.js";import{E as V}from"./ErrorState-BtilFfMz.js";import{u as D}from"./useDebouncedValue-BABSGNK2.js";import{a as F}from"./format-DFEg2Asu.js";import{s as _}from"./help-copy-BsWUoxcn.js";import"./avatar-C10lunoa.js";import"./chevron-left-D_5sOBUq.js";import"./menu-DFNsLG9c.js";import"./circle-help-MoXjqXC8.js";function B({options:t,active:r,onSelect:m}){return e.jsx("div",{role:"tablist",className:S("flex shrink-0 gap-1 overflow-x-auto border-b border-line p-2","lg:w-44 lg:flex-col lg:gap-0 lg:overflow-visible lg:border-r lg:border-b-0 lg:py-2 lg:pr-2 lg:pl-3"),children:t.map(a=>{const d=a.id===r;return e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>m(a.id),className:S("flex min-h-11 shrink-0 items-center gap-2 rounded-md px-3 text-left text-sm transition-colors lg:min-h-0 lg:px-2 lg:py-1",d?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface-sunken hover:text-fg"),children:[e.jsx("span",{className:"flex-1 truncate",children:a.label}),e.jsx("span",{className:S("text-2xs tabular-nums",d?"text-accent-2":"text-fg-subtle"),children:a.count??"—"})]},a.id)})})}const v={vip:"VIPs",muted:"Muted",blocked:"Blocked"};function H({query:t,onCount:r}){const{data:m,isPending:a,isError:d,error:b}=I(M()),g=C(),i=k({...P(),onSettled:()=>{g.invalidateQueries({queryKey:q()})}}),l=m?.suggestions??[],p=t.trim().toLowerCase(),u=p?l.filter(n=>(n.displayName??"").toLowerCase().includes(p)||n.normalizedEmail.toLowerCase().includes(p)):l;return c.useEffect(()=>{r?.(u.length,l.length)},[r,u.length,l.length]),a?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Loading VIP suggestions…"}):d?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Couldn't load VIP suggestions",error:b})}):l.length===0?e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIP suggestions yet. As you reply to senders, they'll appear here. Press ",e.jsx(f,{children:"v"})," on any message to promote a sender to VIP."]}):u.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No VIPs match “",t,"”."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-row-inset py-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Suggested — promote to VIP"}),u.map(n=>e.jsx(E,{name:n.displayName??n.normalizedEmail,email:n.normalizedEmail,meta:n.replyCount>0?`${n.inboundCount} received · you replied ${n.replyCount}×`:`${n.inboundCount} received · you've never replied`,trailing:e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(R,{className:"size-3.5"}),"aria-busy":i.isPending,onClick:()=>{i.isPending||i.mutate({path:{addressId:n.addressId},body:{flags:{vip:{value:!0,setAt:Date.now(),setBy:"user"}}}})},children:"Add VIP"})},n.addressId))]})}function U({group:t,query:r,onCount:m}){const a=D(r.trim(),300),d=C(),[b,g]=c.useState(null),i=a.length>=2,l=G({query:{q:a,limit:50}}),{data:p,isPending:u,isError:n,error:j}=I({...l,enabled:i}),x=k({...P(),onSuccess:()=>{d.invalidateQueries({queryKey:l.queryKey})}}),h=(p?.items??[]).filter(s=>t==="muted"?s.flags?.muted?.value??!1:s.flags?.blocked?.value??!1);return c.useEffect(()=>{m?.(i?h.length:0,null)},[m,i,h.length]),i?u?e.jsx("div",{className:"px-row-inset py-3 text-sm text-fg-subtle animate-pulse",children:"Searching…"}):n?e.jsx("div",{className:"px-row-inset py-3",children:e.jsx(V,{variant:"inline",title:"Search failed",error:j})}):h.length===0?e.jsxs("p",{className:"px-row-inset py-5 text-sm text-fg-subtle",children:["No ",v[t].toLowerCase()," senders matching “",a,"”."]}):e.jsx(e.Fragment,{children:h.map(s=>{const o=t==="muted"?s.flags?.muted:s.flags?.blocked,y=o?[`${t}`,o.setAt&&F(o.setAt,{month:"short",year:"numeric"})||null,o.reason?`— ${o.reason}`:null].filter(Boolean).join(" "):t,w=x.isPending&&x.variables?.path.addressId===s.addressId,z=x.isError&&b===s.addressId;return e.jsx(E,{name:s.displayName??s.normalizedEmail,email:s.normalizedEmail,danger:t==="blocked",meta:y,trailing:z?e.jsx(N,{variant:"secondary",size:"sm",onClick:()=>{g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}})},children:"Retry"}):e.jsx(N,{variant:"ghost",size:"sm",icon:e.jsx(K,{className:"size-3.5"}),"aria-busy":w,"aria-label":`Remove ${t} flag`,onClick:()=>{w||(g(s.addressId),x.mutate({path:{addressId:s.addressId},body:{flags:{[t]:null}}}))}})},s.addressId)})}):e.jsxs("div",{className:"px-row-inset py-5 text-sm text-fg-subtle space-y-2",children:[e.jsxs("p",{children:["Type 2+ characters to search ",v[t].toLowerCase()," ","senders by name or address."]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Note: a dedicated flagged-address list endpoint is in the backlog. Press ",e.jsx(f,{children:"m"})," on any message to mute its sender; ",e.jsx(f,{children:"b"})," to block."]})]})}function ie(){const t=L(),[r,m]=c.useState("vip"),[a,d]=c.useState(""),[b,g]=c.useState(!0),[i,l]=c.useState(0),[p,u]=c.useState({vip:0,muted:null,blocked:null}),n=c.useCallback((s,o)=>{l(s),u(y=>({...y,vip:o}))},[]),j=c.useCallback((s,o)=>{l(s),u(y=>({...y,[r]:s}))},[r]),x=p[r],h=s=>{const o=A[s];o&&t({to:o})};return e.jsx(Q,{items:O,activeId:"senders",title:"Senders & Rules",description:"Per-sender preferences — set with one key from any message, managed here.",flush:!0,help:_,helpOpen:b,onToggleHelp:()=>g(s=>!s),onSelect:h,onBackToMail:()=>{t({to:"/mail"})},children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[e.jsx(B,{active:r,onSelect:s=>{m(s),d("")},options:["vip","muted","blocked"].map(s=>({id:s,label:v[s],count:p[s]}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("div",{className:"border-b border-line px-row-inset py-2",children:e.jsx(T,{icon:e.jsx($,{className:"size-4"}),placeholder:`Filter ${v[r].toLowerCase()} by name or address`,className:"h-8 max-w-sm",value:a,onChange:s=>d(s.target.value)})}),e.jsx("div",{className:"min-h-0 flex-1 divide-y divide-line overflow-y-auto",children:r==="vip"?e.jsx(H,{query:a,onCount:n}):e.jsx(U,{group:r,query:a,onCount:j})}),e.jsxs("footer",{className:"flex items-center justify-between border-t border-line px-row-inset py-1 text-2xs text-fg-subtle",children:[e.jsx("span",{children:x!=null?`${i} of ${x} flagged senders`:`${i} flagged senders`}),e.jsxs("span",{children:[e.jsx(f,{children:"j"})," ",e.jsx(f,{children:"k"})," navigate · ",e.jsx(f,{children:"⌫"})," remove flag"]})]})]})]})})}export{ie as component};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-DFvn5y4c.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -1 +1 @@
1
- import{r as j,j as e,t as f,f as i,X as N,g as z}from"./index-DMZ8-zZM.js";import{A as w}from"./avatar-klLMB_Me.js";import{C as h}from"./chevron-left-CK510N2A.js";import{M as S}from"./menu-DqCvhoo6.js";import{C as v}from"./circle-help-rRKfilDF.js";function R({items:l,activeId:t,title:x,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:u,onBackToMail:m}){const[y,c]=j.useState(!1),[b,C]=j.useState(!1),p=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),c(!1)},className:f("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:f("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"safe-area-frame flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:m,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),g]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>c(!1)}),e.jsxs("aside",{className:"safe-area-frame relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{m?.(),c(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),onClick:()=>c(!1),"aria-label":"Close menu"})]}),g]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[m&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(h,{className:"size-4"}),className:"-ml-1 lg:hidden",onClick:m,"aria-label":"Back to mail"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(S,{className:"size-4"}),className:"lg:hidden",onClick:()=>c(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:x}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":b}),s&&!p&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&b&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),p&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function L({name:l,email:t,meta:x,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:f(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[x,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const O={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function X({label:l,email:t,connector:x,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=O[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(z,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",x," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{X as A,R as S,L as a};
1
+ import{r as j,j as e,t as f,f as i,X as N,g as z}from"./index-DFvn5y4c.js";import{A as w}from"./avatar-C10lunoa.js";import{C as h}from"./chevron-left-D_5sOBUq.js";import{M as S}from"./menu-DFNsLG9c.js";import{C as v}from"./circle-help-MoXjqXC8.js";function R({items:l,activeId:t,title:x,description:n,children:r,help:s,helpOpen:d=!0,flush:o,onSelect:k,onToggleHelp:u,onBackToMail:m}){const[y,c]=j.useState(!1),[b,C]=j.useState(!1),p=!!s&&d,g=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-3 pb-1 text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Settings"}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-1",children:l.map(a=>e.jsxs("button",{type:"button",onClick:()=>{k?.(a.id),c(!1)},className:f("flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors lg:min-h-0",a.id===t?"bg-accent-2-soft font-medium text-accent-2":"text-fg-muted hover:bg-surface hover:text-fg"),children:[a.icon&&e.jsx("span",{className:f("shrink-0",a.id===t?"text-accent-2":"text-fg-subtle"),children:a.icon}),a.label]},a.id))})]});return e.jsxs("div",{className:"safe-area-frame flex h-dvh w-full overflow-hidden bg-canvas font-sans text-fg",children:[e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r border-line bg-surface-sunken lg:flex",children:[e.jsx("div",{className:"flex h-pane-header shrink-0 items-center border-b border-line px-2",children:e.jsxs("button",{type:"button",onClick:m,className:"flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]})}),g]}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 flex lg:hidden",children:[e.jsx("button",{type:"button","aria-label":"Close menu",className:"absolute inset-0 bg-canvas/60",onClick:()=>c(!1)}),e.jsxs("aside",{className:"safe-area-frame relative flex w-72 max-w-[85%] flex-col border-r border-line bg-surface-sunken",children:[e.jsxs("div",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-2",children:[e.jsxs("button",{type:"button",onClick:()=>{m?.(),c(!1)},className:"flex items-center gap-2 rounded-md px-2 py-1 text-left text-sm text-fg-muted hover:bg-surface hover:text-fg",children:[e.jsx(h,{className:"size-4 text-fg-subtle"}),"Back to mail"]}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-4"}),onClick:()=>c(!1),"aria-label":"Close menu"})]}),g]})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center gap-3 border-b border-line px-3 lg:px-5",children:[m&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(h,{className:"size-4"}),className:"-ml-1 lg:hidden",onClick:m,"aria-label":"Back to mail"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(S,{className:"size-4"}),className:"lg:hidden",onClick:()=>c(!0),"aria-label":"Open settings menu"}),e.jsx("h1",{className:"text-md font-semibold text-fg",children:x}),n&&e.jsx("p",{className:"hidden min-w-0 truncate text-xs text-fg-subtle lg:block",children:n}),s&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"ml-auto lg:hidden",onClick:()=>C(a=>!a),"aria-label":"Tips","aria-expanded":b}),s&&!p&&e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(v,{className:"size-4"}),className:"hidden ml-auto lg:inline-flex",onClick:u,"aria-label":"Show tips"})]}),s&&b&&e.jsx("div",{className:"border-b border-line bg-surface-sunken px-row-inset py-3 text-xs leading-relaxed text-fg-muted lg:hidden",children:s}),o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:r}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"max-w-2xl px-3 py-5 lg:px-5",children:e.jsx("div",{className:"space-y-5",children:r})})})]}),p&&e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-l border-line bg-surface-sunken lg:flex",children:[e.jsxs("header",{className:"flex h-pane-header shrink-0 items-center justify-between border-b border-line px-row-inset",children:[e.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Tips & tricks"}),e.jsx(i,{variant:"ghost",size:"sm",icon:e.jsx(N,{className:"size-3.5"}),onClick:u,"aria-label":"Collapse tips"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-row-inset py-3 text-xs leading-relaxed text-fg-muted",children:s})]})]})}function L({name:l,email:t,meta:x,caption:n,danger:r,trailing:s}){return e.jsxs("div",{className:"flex items-center gap-3 px-row-inset py-2 hover:bg-surface-sunken",children:[e.jsx("span",{className:f(r&&"rounded-full ring-2 ring-danger/40"),children:e.jsx(w,{name:l,email:t,size:"sm"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-0 sm:flex-row sm:items-baseline sm:gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-fg",children:l}),e.jsx("span",{className:"truncate text-2xs text-fg-subtle",children:t})]}),e.jsxs("div",{className:"text-xs text-fg-subtle",children:[x,n&&e.jsxs("span",{className:"text-fg-muted",children:[" · ",n]})]})]}),s&&e.jsx("div",{className:"shrink-0",children:s})]})}const O={healthy:{tone:"positive",label:"healthy"},error:{tone:"danger",label:"error"},muted:{tone:"neutral",label:"muted"}};function X({label:l,email:t,connector:x,syncLabel:n,state:r,errorDetail:s,trailing:d}){const o=O[r];return e.jsxs("div",{className:f("rounded-sm border border-line bg-surface",r==="muted"&&"opacity-65"),children:[e.jsxs("div",{className:"flex flex-col gap-3 px-row-inset py-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx(w,{name:l,email:t,size:"md"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-fg",children:l}),e.jsx(z,{tone:o.tone,dot:!0,children:o.label})]}),e.jsxs("div",{className:"truncate text-xs text-fg-subtle",children:[t," · ",x," · ",n]})]})]}),d&&e.jsx("div",{className:"shrink-0",children:d})]}),s&&e.jsx("div",{className:"border-t border-line px-row-inset py-2",children:e.jsx("code",{className:"block rounded-xs bg-danger-soft px-2 py-1 text-2xs text-danger",children:s})})]})}export{X as A,R as S,L as a};
@@ -1 +1 @@
1
- import{e}from"./index-DMZ8-zZM.js";const c=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{c as S};
1
+ import{e}from"./index-DFvn5y4c.js";const c=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{c as S};
@@ -1 +1 @@
1
- import{j as t,am as e}from"./index-DMZ8-zZM.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
1
+ import{j as t,am as e}from"./index-DFvn5y4c.js";const o=()=>t.jsx(e,{to:"/settings/senders",replace:!0});export{o as component};
@@ -1 +1 @@
1
- import{e as g,r as f,c as D,e8 as m,h as M,e6 as L,s as v}from"./index-DMZ8-zZM.js";import{i as A,j as b,t as k,U as W,b as E,r as j}from"./useCalendars-BruqGaWc.js";import{u as N}from"./useQueries-Baii11SK.js";const R=g("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const B=g("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);function O(e,n){const a=e.map(t=>t.id);if(n.length===0)return a;const r=new Set(n),o=a.filter(t=>r.has(t));return o.length===0?a:o}function S(e){const{calendars:n,colorByCalendarId:a,timeZoneByCalendarId:r,isLoading:o}=A(),t=O(n,e),c=t.length===n.length?[]:t,i=e.length===0||n.length>0;return{calendars:n,colorByCalendarId:a,timeZoneByCalendarId:r,shown:t,narrowed:c,resolved:i,isLoading:o}}function T(e,n,a){const r=a.join(",");return f.useMemo(()=>{const o=new Set(r===""?[]:r.split(","));return e.filter(t=>b(t)&&o.has(t.calendarId)).map(t=>k(t,n[t.calendarId]??W))},[e,n,r])}const w=v(400,404),y=5*6e4,C=({from:e,to:n,calendarIds:a})=>({query:a.length===0?{from:e,to:n}:{from:e,to:n,calendarId:[...a]}});function _(e){const{data:n,isLoading:a,error:r,refetch:o}=D({...m(C(e)),meta:w,staleTime:y,enabled:e.enabled??!0});return{instances:n?.items??[],isLoading:a,error:r,refetch:()=>{o()}}}function G(e,n,a){const r=N({queries:e.map(s=>({...m(C({...s,calendarIds:n})),meta:w,staleTime:y,enabled:a}))}),o=e.map(s=>s.from).join("|"),t=r.map(s=>s.data),c=r.map(s=>s.isPending).join("|"),i=r.find(s=>s.error)?.error??null,d=f.useMemo(()=>t.flatMap(s=>s?.items??[]),[o,c]),h=f.useMemo(()=>{const s=new Set;return e.forEach((p,l)=>{r[l]?.isPending&&s.add(p.from)}),s},[o,c]);return{instances:d,pendingWindows:h,error:i,refetch:()=>{for(const s of r)s.error&&s.refetch()}}}function P(e,n,a,r){const o=M(),t=[...a].join(",");f.useEffect(()=>{if(!r)return;const c=t===""?[]:t.split(",");for(const i of[-1,1]){const d=E(e,L(n,e,i));o.prefetchQuery({...m(C({...d,calendarIds:c})),staleTime:y})}},[o,e,n,t,r])}function z({view:e,date:n,calendarIds:a,enabled:r=!0}){const{calendars:o,colorByCalendarId:t,timeZoneByCalendarId:c,shown:i,narrowed:d,resolved:h,isLoading:s}=S(a),p=E(e,n),l=r&&h,u=_({...p,calendarIds:d,enabled:l});P(e,n,d,l);const I=T(u.instances,c,i);return{calendars:o,events:I,colorByCalendarId:t,timeZoneByCalendarId:c,isLoading:s||u.isLoading,error:u.error,retry:u.refetch,instanceOf:j}}export{y as C,R as G,B as M,G as a,T as b,z as c,S as u};
1
+ import{e as g,r as f,c as D,e8 as m,h as M,e6 as L,s as v}from"./index-DFvn5y4c.js";import{i as A,j as b,t as k,U as W,b as E,r as j}from"./useCalendars-DaisNzpy.js";import{u as N}from"./useQueries-C-FWQch-.js";const R=g("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const B=g("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);function O(e,n){const a=e.map(t=>t.id);if(n.length===0)return a;const r=new Set(n),o=a.filter(t=>r.has(t));return o.length===0?a:o}function S(e){const{calendars:n,colorByCalendarId:a,timeZoneByCalendarId:r,isLoading:o}=A(),t=O(n,e),c=t.length===n.length?[]:t,i=e.length===0||n.length>0;return{calendars:n,colorByCalendarId:a,timeZoneByCalendarId:r,shown:t,narrowed:c,resolved:i,isLoading:o}}function T(e,n,a){const r=a.join(",");return f.useMemo(()=>{const o=new Set(r===""?[]:r.split(","));return e.filter(t=>b(t)&&o.has(t.calendarId)).map(t=>k(t,n[t.calendarId]??W))},[e,n,r])}const w=v(400,404),y=5*6e4,C=({from:e,to:n,calendarIds:a})=>({query:a.length===0?{from:e,to:n}:{from:e,to:n,calendarId:[...a]}});function _(e){const{data:n,isLoading:a,error:r,refetch:o}=D({...m(C(e)),meta:w,staleTime:y,enabled:e.enabled??!0});return{instances:n?.items??[],isLoading:a,error:r,refetch:()=>{o()}}}function G(e,n,a){const r=N({queries:e.map(s=>({...m(C({...s,calendarIds:n})),meta:w,staleTime:y,enabled:a}))}),o=e.map(s=>s.from).join("|"),t=r.map(s=>s.data),c=r.map(s=>s.isPending).join("|"),i=r.find(s=>s.error)?.error??null,d=f.useMemo(()=>t.flatMap(s=>s?.items??[]),[o,c]),h=f.useMemo(()=>{const s=new Set;return e.forEach((p,l)=>{r[l]?.isPending&&s.add(p.from)}),s},[o,c]);return{instances:d,pendingWindows:h,error:i,refetch:()=>{for(const s of r)s.error&&s.refetch()}}}function P(e,n,a,r){const o=M(),t=[...a].join(",");f.useEffect(()=>{if(!r)return;const c=t===""?[]:t.split(",");for(const i of[-1,1]){const d=E(e,L(n,e,i));o.prefetchQuery({...m(C({...d,calendarIds:c})),staleTime:y})}},[o,e,n,t,r])}function z({view:e,date:n,calendarIds:a,enabled:r=!0}){const{calendars:o,colorByCalendarId:t,timeZoneByCalendarId:c,shown:i,narrowed:d,resolved:h,isLoading:s}=S(a),p=E(e,n),l=r&&h,u=_({...p,calendarIds:d,enabled:l});P(e,n,d,l);const I=T(u.instances,c,i);return{calendars:o,events:I,colorByCalendarId:t,timeZoneByCalendarId:c,isLoading:s||u.isLoading,error:u.error,retry:u.refetch,instanceOf:j}}export{y as C,R as G,B as M,G as a,T as b,z as c,S as u};
@@ -1 +1 @@
1
- import{e as y,a8 as d,e4 as v,r as l,e5 as w,bJ as h,u as T,c7 as D,e6 as O,c as x,e7 as N}from"./index-DMZ8-zZM.js";const F=y("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]),E={"cal-1":{solid:"bg-cal-1",soft:"bg-cal-1-soft",text:"text-cal-1",border:"border-cal-1",rail:"border-l-cal-1"},"cal-2":{solid:"bg-cal-2",soft:"bg-cal-2-soft",text:"text-cal-2",border:"border-cal-2",rail:"border-l-cal-2"},"cal-3":{solid:"bg-cal-3",soft:"bg-cal-3-soft",text:"text-cal-3",border:"border-cal-3",rail:"border-l-cal-3"},"cal-4":{solid:"bg-cal-4",soft:"bg-cal-4-soft",text:"text-cal-4",border:"border-cal-4",rail:"border-l-cal-4"},"cal-5":{solid:"bg-cal-5",soft:"bg-cal-5-soft",text:"text-cal-5",border:"border-cal-5",rail:"border-l-cal-5"},"cal-6":{solid:"bg-cal-6",soft:"bg-cal-6-soft",text:"text-cal-6",border:"border-cal-6",rail:"border-l-cal-6"}};function W(e){return E[e]}const i="/calendar/$view/$date";function R(){const e=d({from:i,shouldThrow:!1}),a=v({from:i,shouldThrow:!1}),t=e?.view??"",o=e?.date??"",r=a?.calendarId;return l.useMemo(()=>({...w({view:t,date:o},h(new Date)),calendarIds:r??[]}),[t,o,r])}function _(){const e=d({from:"/calendar/$view/$date/$calendarObjectId",shouldThrow:!1}),a=d({from:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",shouldThrow:!1}),t=e?.calendarObjectId,o=a?.recurrenceId;return l.useMemo(()=>t?{calendarObjectId:t,recurrenceId:o}:void 0,[t,o])}function B(){return d({from:"/calendar/$view/$date/new",shouldThrow:!1})!==void 0}function V(){const e=T(),a=D(),{view:t,date:o}=R(),r=l.useCallback(n=>{e({to:i,params:n,search:!0,hash:a})},[e,a]);return l.useMemo(()=>({goToView:n=>r({view:n,date:o}),step:n=>r({view:t,date:O(o,t,n)}),goToToday:()=>r({view:t,date:h(new Date)}),setAnchorDate:n=>e({to:i,params:{view:t,date:n},search:!0,hash:a,replace:!0}),zoomToDay:n=>r({view:"day",date:n}),openEvent:(n,s)=>e(s===void 0||s===""?{to:"/calendar/$view/$date/$calendarObjectId",params:{view:t,date:o,calendarObjectId:n},search:!0,hash:a}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:t,date:o,calendarObjectId:n,recurrenceId:s},search:!0,hash:a}),closeEvent:()=>r({view:t,date:o}),openComposer:()=>e({to:"/calendar/$view/$date/new",params:{view:t,date:o},search:!0,hash:a})}),[r,e,a,t,o])}const c=e=>String(e).padStart(2,"0"),U=e=>`${e.getUTCFullYear()}-${c(e.getUTCMonth()+1)}-${c(e.getUTCDate())}`,p=e=>{const a=e<0?"-":"+",t=Math.abs(e);return`${a}${c(Math.floor(t/60))}:${c(t%60)}`};function $(e,a){const t=new Date(`${e}T${a}:00`);return`${e}T${a}:00${p(-t.getTimezoneOffset())}`}const u=new Map;function j(e){if(u.has(e))return u.get(e);let a;try{a=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{a=void 0}return u.set(e,a),a}function m(e,a){const t=j(e);if(!t)return Number.NaN;const o=t.formatToParts(new Date(a)),r=C=>Number(o.find(I=>I.type===C)?.value),n=r("hour")%24;return(Date.UTC(r("year"),r("month")-1,r("day"),n,r("minute"),r("second"))-a)/6e4}function Z(e,a,t){if(t==="")return`${e}T${a}:00+00:00`;const o=Date.parse(`${e}T${a}:00Z`),r=m(t,o);if(Number.isNaN(r))return $(e,a);const n=m(t,o-r*6e4);return`${e}T${a}:00${p(Number.isNaN(n)?r:n)}`}const b=e=>$(e,"00:00");function f(e,a){const[t,o,r]=e.split("-").map(Number);return U(new Date(Date.UTC(t,o-1,r+a)))}function A(e){const[a,t,o]=e.split("-").map(Number),r=new Date(Date.UTC(a,t-1,o));return f(e,-((r.getUTCDay()+6)%7))}function M(e,a){const[t,o]=a.split("-").map(Number);if(e==="year")return[`${t}-01-01`,`${t+1}-01-01`];if(e==="month"){const n=`${t}-${c(o)}-01`,s=o===12?`${t+1}-01-01`:`${t}-${c(o+1)}-01`;return[n,s]}if(e==="day")return[a,f(a,1)];const r=A(a);return[r,f(r,7)]}function q(e,a){const[t,o]=M(e,a);return{from:b(t),to:b(o)}}const H=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,J="",z={Cal1:"cal-1",Cal2:"cal-2",Cal3:"cal-3",Cal4:"cal-4",Cal5:"cal-5",Cal6:"cal-6"},S={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},g="#";function k(e,a){return a===""?e:`${e}${g}${a}`}function Q(e){const a=e.indexOf(g);return a===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,a),recurrenceId:e.slice(a+1)}}function L(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:z[e.color]??"cal-1"}}function Y(e,a){return{id:k(e.calendarObjectId,e.recurrenceId),calendarId:e.calendarId,title:e.summary,start:e.start,end:e.end,allDay:e.allDay,location:"",notes:"",attendees:[],myRsvp:"accepted",threadId:"",threadSubject:"",timeZone:a,zoneCertainty:S[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const G=e=>e.status!=="Cancelled";function K(){const{data:e,isLoading:a}=x(N());return l.useMemo(()=>{const t=e?.items??[],o=t.map(L);return{calendars:o,colorByCalendarId:Object.fromEntries(o.map(r=>[r.id,r.color])),timeZoneByCalendarId:Object.fromEntries(t.map(r=>[r.calendarId,r.timezone])),isLoading:a}},[e,a])}export{F as R,J as U,f as a,q as b,W as c,V as d,_ as e,k as f,B as g,H as h,K as i,G as j,Z as k,Q as r,Y as t,R as u};
1
+ import{e as y,a8 as d,e4 as v,r as l,e5 as w,bJ as h,u as T,c7 as D,e6 as O,c as x,e7 as N}from"./index-DFvn5y4c.js";const F=y("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]),E={"cal-1":{solid:"bg-cal-1",soft:"bg-cal-1-soft",text:"text-cal-1",border:"border-cal-1",rail:"border-l-cal-1"},"cal-2":{solid:"bg-cal-2",soft:"bg-cal-2-soft",text:"text-cal-2",border:"border-cal-2",rail:"border-l-cal-2"},"cal-3":{solid:"bg-cal-3",soft:"bg-cal-3-soft",text:"text-cal-3",border:"border-cal-3",rail:"border-l-cal-3"},"cal-4":{solid:"bg-cal-4",soft:"bg-cal-4-soft",text:"text-cal-4",border:"border-cal-4",rail:"border-l-cal-4"},"cal-5":{solid:"bg-cal-5",soft:"bg-cal-5-soft",text:"text-cal-5",border:"border-cal-5",rail:"border-l-cal-5"},"cal-6":{solid:"bg-cal-6",soft:"bg-cal-6-soft",text:"text-cal-6",border:"border-cal-6",rail:"border-l-cal-6"}};function W(e){return E[e]}const i="/calendar/$view/$date";function R(){const e=d({from:i,shouldThrow:!1}),a=v({from:i,shouldThrow:!1}),t=e?.view??"",o=e?.date??"",r=a?.calendarId;return l.useMemo(()=>({...w({view:t,date:o},h(new Date)),calendarIds:r??[]}),[t,o,r])}function _(){const e=d({from:"/calendar/$view/$date/$calendarObjectId",shouldThrow:!1}),a=d({from:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",shouldThrow:!1}),t=e?.calendarObjectId,o=a?.recurrenceId;return l.useMemo(()=>t?{calendarObjectId:t,recurrenceId:o}:void 0,[t,o])}function B(){return d({from:"/calendar/$view/$date/new",shouldThrow:!1})!==void 0}function V(){const e=T(),a=D(),{view:t,date:o}=R(),r=l.useCallback(n=>{e({to:i,params:n,search:!0,hash:a})},[e,a]);return l.useMemo(()=>({goToView:n=>r({view:n,date:o}),step:n=>r({view:t,date:O(o,t,n)}),goToToday:()=>r({view:t,date:h(new Date)}),setAnchorDate:n=>e({to:i,params:{view:t,date:n},search:!0,hash:a,replace:!0}),zoomToDay:n=>r({view:"day",date:n}),openEvent:(n,s)=>e(s===void 0||s===""?{to:"/calendar/$view/$date/$calendarObjectId",params:{view:t,date:o,calendarObjectId:n},search:!0,hash:a}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:t,date:o,calendarObjectId:n,recurrenceId:s},search:!0,hash:a}),closeEvent:()=>r({view:t,date:o}),openComposer:()=>e({to:"/calendar/$view/$date/new",params:{view:t,date:o},search:!0,hash:a})}),[r,e,a,t,o])}const c=e=>String(e).padStart(2,"0"),U=e=>`${e.getUTCFullYear()}-${c(e.getUTCMonth()+1)}-${c(e.getUTCDate())}`,p=e=>{const a=e<0?"-":"+",t=Math.abs(e);return`${a}${c(Math.floor(t/60))}:${c(t%60)}`};function $(e,a){const t=new Date(`${e}T${a}:00`);return`${e}T${a}:00${p(-t.getTimezoneOffset())}`}const u=new Map;function j(e){if(u.has(e))return u.get(e);let a;try{a=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{a=void 0}return u.set(e,a),a}function m(e,a){const t=j(e);if(!t)return Number.NaN;const o=t.formatToParts(new Date(a)),r=C=>Number(o.find(I=>I.type===C)?.value),n=r("hour")%24;return(Date.UTC(r("year"),r("month")-1,r("day"),n,r("minute"),r("second"))-a)/6e4}function Z(e,a,t){if(t==="")return`${e}T${a}:00+00:00`;const o=Date.parse(`${e}T${a}:00Z`),r=m(t,o);if(Number.isNaN(r))return $(e,a);const n=m(t,o-r*6e4);return`${e}T${a}:00${p(Number.isNaN(n)?r:n)}`}const b=e=>$(e,"00:00");function f(e,a){const[t,o,r]=e.split("-").map(Number);return U(new Date(Date.UTC(t,o-1,r+a)))}function A(e){const[a,t,o]=e.split("-").map(Number),r=new Date(Date.UTC(a,t-1,o));return f(e,-((r.getUTCDay()+6)%7))}function M(e,a){const[t,o]=a.split("-").map(Number);if(e==="year")return[`${t}-01-01`,`${t+1}-01-01`];if(e==="month"){const n=`${t}-${c(o)}-01`,s=o===12?`${t+1}-01-01`:`${t}-${c(o+1)}-01`;return[n,s]}if(e==="day")return[a,f(a,1)];const r=A(a);return[r,f(r,7)]}function q(e,a){const[t,o]=M(e,a);return{from:b(t),to:b(o)}}const H=()=>Intl.DateTimeFormat().resolvedOptions().timeZone,J="",z={Cal1:"cal-1",Cal2:"cal-2",Cal3:"cal-3",Cal4:"cal-4",Cal5:"cal-5",Cal6:"cal-6"},S={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},g="#";function k(e,a){return a===""?e:`${e}${g}${a}`}function Q(e){const a=e.indexOf(g);return a===-1?{calendarObjectId:e,recurrenceId:""}:{calendarObjectId:e.slice(0,a),recurrenceId:e.slice(a+1)}}function L(e){return{id:e.calendarId,accountId:e.accountConfigId,accountLabel:"",name:e.displayName,color:z[e.color]??"cal-1"}}function Y(e,a){return{id:k(e.calendarObjectId,e.recurrenceId),calendarId:e.calendarId,title:e.summary,start:e.start,end:e.end,allDay:e.allDay,location:"",notes:"",attendees:[],myRsvp:"accepted",threadId:"",threadSubject:"",timeZone:a,zoneCertainty:S[e.zoneCertainty]??"explicit",recurrenceRule:e.hasRecurrence?"Repeats":"",seriesId:e.hasRecurrence?e.icalUid:"",seriesException:!1,status:e.status==="Tentative"?"tentative":"confirmed"}}const G=e=>e.status!=="Cancelled";function K(){const{data:e,isLoading:a}=x(N());return l.useMemo(()=>{const t=e?.items??[],o=t.map(L);return{calendars:o,colorByCalendarId:Object.fromEntries(o.map(r=>[r.id,r.color])),timeZoneByCalendarId:Object.fromEntries(t.map(r=>[r.calendarId,r.timezone])),isLoading:a}},[e,a])}export{F as R,J as U,f as a,q as b,W as c,V as d,_ as e,k as f,B as g,H as h,K as i,G as j,Z as k,Q as r,Y as t,R as u};
@@ -1 +1 @@
1
- import{r as o}from"./index-DMZ8-zZM.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};
1
+ import{r as o}from"./index-DFvn5y4c.js";const n=(e,t)=>{const[r,u]=o.useState(e);return o.useEffect(()=>{const s=setTimeout(()=>u(e),t);return()=>clearTimeout(s)},[e,t]),r};export{n as u};