@remit/web-client-dist 0.0.695 → 0.0.697

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 (204) hide show
  1. package/assets/{BriefPane-BJLNB-w7.js → BriefPane-BQx5RRpb.js} +1 -1
  2. package/assets/{CalendarEventEditor-MMNLFvjJ.js → CalendarEventEditor-B3bVY-Oc.js} +1 -1
  3. package/assets/{CalendarEventPopup-DVJ9DC_Y.js → CalendarEventPopup-D6PNfUfu.js} +1 -1
  4. package/assets/{CalendarLoadFailed-uHGxFBGx.js → CalendarLoadFailed-Cm6trTQZ.js} +1 -1
  5. package/assets/{CalendarQuickCreate-CzJ4lehP.js → CalendarQuickCreate-B_n983kv.js} +1 -1
  6. package/assets/{CalendarSession-BVuy8A2H.js → CalendarSession-BosFoHg2.js} +1 -1
  7. package/assets/CollectionPane-BzktgIp0.js +1 -0
  8. package/assets/{DesktopChrome-Ct-IB4ks.js → DesktopChrome-GxTHTvqD.js} +1 -1
  9. package/assets/{DropdownMenu-CTCHgh4X.js → DropdownMenu-C2J8u8zN.js} +1 -1
  10. package/assets/{EmptyState-CN-AyHj-.js → EmptyState-BJU14tbt.js} +1 -1
  11. package/assets/{ErrorState-Bk3DwNvd.js → ErrorState-BTHOmsYP.js} +1 -1
  12. package/assets/{FullCompose-BWiLy3Vm.js → FullCompose-DiZNltCL.js} +1 -1
  13. package/assets/{LabelApplyTrigger-52QGuTLD.js → LabelApplyTrigger-P8IoLKME.js} +1 -1
  14. package/assets/{MailShell-DAqGpnce.js → MailShell-tKLYT5hn.js} +1 -1
  15. package/assets/MailViewChrome-CLgaFbe-.js +1 -0
  16. package/assets/{MailboxPane-DUI-sxQF.js → MailboxPane-BxNCkl6s.js} +2 -2
  17. package/assets/{MessageBody-BeciCqb_.js → MessageBody-jG4Dhul6.js} +2 -2
  18. package/assets/{MessageToolbar-BYhqv9RG.js → MessageToolbar-DeDUhCvg.js} +1 -1
  19. package/assets/{NavMenuButton-A6v6v8tE.js → NavMenuButton-CLp6InRG.js} +1 -1
  20. package/assets/{OnboardingWizard-CIneAccs.js → OnboardingWizard-BSlPpmI5.js} +1 -1
  21. package/assets/{OutboxPane-InUnHiNC.js → OutboxPane-B6UfixBP.js} +1 -1
  22. package/assets/{ReportLink-q8WFRQli.js → ReportLink-BELrQR40.js} +1 -1
  23. package/assets/_calendarObjectId-BiaBDCEt.js +1 -0
  24. package/assets/_labelId-DLeWLaow.js +1 -0
  25. package/assets/_mailboxId-DWvQ-9gi.js +1 -0
  26. package/assets/_messageId-BB9xOwfs.js +1 -0
  27. package/assets/_messageId-C2YSZxRF.js +1 -0
  28. package/assets/_messageId-CPvSvBZB.js +1 -0
  29. package/assets/_messageId-DbVH08AL.js +1 -0
  30. package/assets/_outboxMessageId-BFgW_k_u.js +1 -0
  31. package/assets/_recurrenceId-96pqeQMh.js +1 -0
  32. package/assets/{_slotId-Cf-NASLE.js → _slotId-DQqfctAf.js} +1 -1
  33. package/assets/_threadId-Bm7b75jN.js +1 -0
  34. package/assets/_threadId-CCwEReI2.js +1 -0
  35. package/assets/_threadId-Db39B53v.js +1 -0
  36. package/assets/_threadId-Dht02PUZ.js +1 -0
  37. package/assets/{_view._date-dARprXsM.js → _view._date-BQeaBjoE.js} +1 -1
  38. package/assets/{account-service-status-DexPoUiT.js → account-service-status-DsLvRU-X.js} +1 -1
  39. package/assets/{accounts-DPvTdrTr.js → accounts-D0rPQMGH.js} +1 -1
  40. package/assets/{advanced-CDr_JOXg.js → advanced-q_hG98BB.js} +1 -1
  41. package/assets/{agenda-time-BcOiQ5_R.js → agenda-time-D0yU-H44.js} +1 -1
  42. package/assets/{app-chrome-6ZXmy5H4.js → app-chrome-BfyGOiSA.js} +1 -1
  43. package/assets/{appearance-BQZnBlkc.js → appearance-DM1k2Ta7.js} +1 -1
  44. package/assets/{avatar-B_QEsxCw.js → avatar-Bq7beWCy.js} +1 -1
  45. package/assets/{badge-CeCxCmzS.js → badge-BB80tGxy.js} +1 -1
  46. package/assets/{bottom-sheet-DWqGf7I3.js → bottom-sheet-DKF_Dkid.js} +1 -1
  47. package/assets/{brief-B7EfkUB4.js → brief-8diVJSZ9.js} +1 -1
  48. package/assets/brief-CFBkxoDK.js +1 -0
  49. package/assets/{calendar-DxjT7IrR.js → calendar-BqFIadRy.js} +1 -1
  50. package/assets/{calendar-CJGXdypt.js → calendar-Ds9kgvU8.js} +1 -1
  51. package/assets/{calendar-event-popup-y4Z860B0.js → calendar-event-popup-Cr_LW8IP.js} +1 -1
  52. package/assets/{calendar-event-sidebar-BaAGgT2x.js → calendar-event-sidebar-B_eR1h5J.js} +1 -1
  53. package/assets/{calendar-failure-note-CJvPzX2o.js → calendar-failure-note-C4gNXDQV.js} +1 -1
  54. package/assets/{calendar-guests-DeRthr7k.js → calendar-guests-Cay9Ub8h.js} +1 -1
  55. package/assets/{calendar-suggestion-BulekNHV.js → calendar-suggestion-EosZrXZC.js} +1 -1
  56. package/assets/{calendars-D-Use38B.js → calendars-52NaEZbX.js} +1 -1
  57. package/assets/{card-0Dzt3Scs.js → card-CLJYKox8.js} +1 -1
  58. package/assets/{checkbox-DIKh2-eX.js → checkbox-CYOm-zGr.js} +1 -1
  59. package/assets/{chevron-down-BnC2m4J6.js → chevron-down-De4wQzka.js} +1 -1
  60. package/assets/{chevron-left-CNQ3caMn.js → chevron-left-CUHU8UT9.js} +1 -1
  61. package/assets/{circle-check-CTlM3FQo.js → circle-check-DlR8I4Hf.js} +1 -1
  62. package/assets/{circle-check-big-DCVJA_H0.js → circle-check-big-CMsxQSjY.js} +1 -1
  63. package/assets/{circle-question-mark-CpApZe3H.js → circle-question-mark-DhNa_A16.js} +1 -1
  64. package/assets/{classification-C7_2tIfb.js → classification-BgDJ1gwK.js} +1 -1
  65. package/assets/{clock-CTlZVcLb.js → clock-Dds4zv6u.js} +1 -1
  66. package/assets/{cloud-off-CtJJ9OTh.js → cloud-off-BYulqayx.js} +1 -1
  67. package/assets/compose._-_outboxMessageId_-BY1Sf-7o.js +1 -0
  68. package/assets/compose._-_outboxMessageId_-ByGI1c-o.js +1 -0
  69. package/assets/compose._-_outboxMessageId_-CvOAO1iL.js +1 -0
  70. package/assets/compose._-_outboxMessageId_-EZpX9L3H.js +1 -0
  71. package/assets/compose._-_outboxMessageId_-urlj3DLH.js +1 -0
  72. package/assets/{config-import-CHZ9oJuF.js → config-import-VTZQj3gU.js} +1 -1
  73. package/assets/{confirm-dialog-Cc446-7C.js → confirm-dialog-XvccFJdE.js} +1 -1
  74. package/assets/{copy-jXKvwaUz.js → copy-BokIobZ4.js} +1 -1
  75. package/assets/{credential-steps-yT5IXLY8.js → credential-steps-O1OzlOow.js} +1 -1
  76. package/assets/{download-CyhaY4zL.js → download-DEuAIIIQ.js} +1 -1
  77. package/assets/{draft-C1ufEqDz.js → draft-BEiHkDpm.js} +1 -1
  78. package/assets/edit-B9dhadKH.js +1 -0
  79. package/assets/edit-vn6fIBd6.js +1 -0
  80. package/assets/{external-link-1TiTglgB.js → external-link-L7NXOTeQ.js} +1 -1
  81. package/assets/{file-braces-CXZUVCry.js → file-braces-BN8-S---.js} +1 -1
  82. package/assets/{filters-CR0iG1ow.js → filters-VSaDpnX3.js} +1 -1
  83. package/assets/{flagged-DuEE_WUV.js → flagged-B-j-3yRr.js} +1 -1
  84. package/assets/flagged-BZJepVc-.js +1 -0
  85. package/assets/{folder-input-kcvJkrLj.js → folder-input-B0q8wLhf.js} +1 -1
  86. package/assets/{folders-6mmHeM8E.js → folders-CTNX9Hcm.js} +1 -1
  87. package/assets/{help-copy-CIhcXCo3.js → help-copy-DUjzIPXf.js} +1 -1
  88. package/assets/{import-76KXkdMq.js → import-DLM5VFnJ.js} +1 -1
  89. package/assets/index-B--m5QrT.js +1 -0
  90. package/assets/index-BuawSiTp.js +1 -0
  91. package/assets/index-C2YSZxRF.js +1 -0
  92. package/assets/index-CO1X8-aP.js +1 -0
  93. package/assets/index-CPvSvBZB.js +1 -0
  94. package/assets/{index-iXcp-mGT.js → index-Caon2n2j.js} +4 -4
  95. package/assets/index-ChWo5_90.js +1 -0
  96. package/assets/index-DGb7Ls8y.js +1 -0
  97. package/assets/index-DLRo9M2D.js +1 -0
  98. package/assets/index-DemsYVll.js +1 -0
  99. package/assets/index-Dylwxpr-.js +1 -0
  100. package/assets/index-YwusJB4d.js +1 -0
  101. package/assets/index-Zfii_-4V.js +1 -0
  102. package/assets/{index-yeSesYv-.js → index-fsuIswbe.js} +72 -72
  103. package/assets/{kbd-BVK8yKhS.js → kbd-jzPSd-a2.js} +1 -1
  104. package/assets/{label-chip-CrQMhpJe.js → label-chip-DtBVyALF.js} +1 -1
  105. package/assets/{labels-CaXUAL8B.js → labels-CUXsONgB.js} +1 -1
  106. package/assets/mail-BodKXw3C.js +1 -0
  107. package/assets/{mail-CLkdzm71.js → mail-BzFJWQZy.js} +1 -1
  108. package/assets/{menu-Cn2tY52U.js → menu-Bh94jr77.js} +1 -1
  109. package/assets/{nav-link-BvlYCbp-.js → nav-link-ed0mFCCx.js} +1 -1
  110. package/assets/new-DlRrHbU8.js +1 -0
  111. package/assets/onboarding-8O2rW7qq.js +1 -0
  112. package/assets/{onboarding-completion-CJl9zKMA.js → onboarding-completion-qKzJSmsI.js} +1 -1
  113. package/assets/outbox-nrXvnMTk.js +1 -0
  114. package/assets/{pencil-A679n1yJ.js → pencil-BDbmS56C.js} +1 -1
  115. package/assets/{people-C5ni4bV_.js → people-eWwwIt4_.js} +1 -1
  116. package/assets/{plus-D9A6i0pi.js → plus-D5-2sA5v.js} +1 -1
  117. package/assets/{popover-menu-wrc2e8Vk.js → popover-menu-DhcuKv1N.js} +1 -1
  118. package/assets/{refresh-cw-BRmmCn_2.js → refresh-cw-Cu9_I3cT.js} +1 -1
  119. package/assets/{reply-DL5kkaJs.js → reply-CXuSMyqp.js} +1 -1
  120. package/assets/{rich-text-EZFEOU8t.js → rich-text-Ds4rQc2o.js} +1 -1
  121. package/assets/{rich-text-spellcheck-worker-provider-NOmoFs4G.js → rich-text-spellcheck-worker-provider-ChKzrvjg.js} +1 -1
  122. package/assets/{rotate-ccw-C2NtRHS-.js → rotate-ccw-hQhPZwrx.js} +1 -1
  123. package/assets/{roving-focus-CSq3MPWi.js → roving-focus-DZX7IpN4.js} +1 -1
  124. package/assets/{row-actions-Cthc4RCY.js → row-actions-BDfQKXdD.js} +1 -1
  125. package/assets/{search-mirror-CCAs_ZWe.js → search-mirror-B2xnwy77.js} +1 -1
  126. package/assets/{search-scope-DaiXqXNv.js → search-scope-B-3MTDpD.js} +1 -1
  127. package/assets/{search-token-index-VBBiMTaA.js → search-token-index-BYKMNlJD.js} +1 -1
  128. package/assets/{sections-uFHlOXiA.js → sections-DpRVKuXF.js} +1 -1
  129. package/assets/{segmented-control-DNxc5Ghi.js → segmented-control-BwvsufVp.js} +1 -1
  130. package/assets/{select-B9t8348S.js → select-TYdrgtW5.js} +1 -1
  131. package/assets/senders-vh4OQfD0.js +1 -0
  132. package/assets/settings-MlHARJWl.js +1 -0
  133. package/assets/{settings-screen-CafoSGzb.js → settings-screen-DTYVWAkg.js} +1 -1
  134. package/assets/{shield-check-BdZGtm0z.js → shield-check-C-tOrPEx.js} +1 -1
  135. package/assets/{spam-DKjh33Xi.js → spam-CecFwFHS.js} +1 -1
  136. package/assets/{suggest-list-Do7i1-gb.js → suggest-list-BCqr1j26.js} +1 -1
  137. package/assets/{suggested-vips-C-je5foZ.js → suggested-vips--pG2iuOT.js} +1 -1
  138. package/assets/{suggestion._suggestionId-DF2BM_zX.js → suggestion._suggestionId-DiMWWP0r.js} +1 -1
  139. package/assets/{switch-1RDXcNo-.js → switch-CyAtRlCz.js} +1 -1
  140. package/assets/{task._calendarTaskId-B7k5whQt.js → task._calendarTaskId-D-wpEifQ.js} +1 -1
  141. package/assets/{undo-2-B-b8_FeJ.js → undo-2-D1IMLq7c.js} +1 -1
  142. package/assets/{useCalendarData-BcNSn1yP.js → useCalendarData-DFG3pzeG.js} +1 -1
  143. package/assets/{useCalendarScheduling-Dfk1b293.js → useCalendarScheduling-B_INtO-h.js} +1 -1
  144. package/assets/{useCalendarSuggestions-D_tk6nh4.js → useCalendarSuggestions-DXbA0boT.js} +1 -1
  145. package/assets/{useCalendarTasks-CX2Wh1Fn.js → useCalendarTasks-b_UNFPQH.js} +1 -1
  146. package/assets/{useClassificationSettings-Bi0m63-O.js → useClassificationSettings-DBRecrmp.js} +1 -1
  147. package/assets/useCollectionThreads-DgofDKen.js +1 -0
  148. package/assets/{useDebouncedValue-AWe2Zncy.js → useDebouncedValue-CFZ4EPXW.js} +1 -1
  149. package/assets/{useFilters-Bp1QgyWU.js → useFilters-DHWZEIQe.js} +1 -1
  150. package/assets/useInfiniteQuery-B-vOuANs.js +1 -0
  151. package/assets/{useJunkMailboxIds-CWScvBHw.js → useJunkMailboxIds-CW7aI25D.js} +1 -1
  152. package/assets/{useLabels-CGE9kc74.js → useLabels-k1VKuQrr.js} +1 -1
  153. package/assets/{useLayoutTier-D5MoTNho.js → useLayoutTier-BNUKvwJD.js} +1 -1
  154. package/assets/{useMediaQuery-Bf7zukl9.js → useMediaQuery-Hy81MQ2M.js} +1 -1
  155. package/assets/{useMessageBodyContent-BxjoKGiE.js → useMessageBodyContent-CpTD2HGg.js} +1 -1
  156. package/assets/{useQueries-Dj93detX.js → useQueries-DPH-PeHV.js} +1 -1
  157. package/assets/{useRefreshControl-DCFTdDZz.js → useRefreshControl-DdbTrGxq.js} +1 -1
  158. package/assets/{useResultFolderIndex-DAcbTt0T.js → useResultFolderIndex-BVyfzXH5.js} +1 -1
  159. package/assets/{useSignature-CA8ypw7f.js → useSignature-W9HBbZ_n.js} +1 -1
  160. package/assets/{warnings-C-blkf-m.js → warnings-B2sNE31D.js} +1 -1
  161. package/index.html +1 -1
  162. package/package.json +1 -1
  163. package/assets/CollectionPane-RUuB6sFo.js +0 -1
  164. package/assets/MailViewChrome-BDymWKX9.js +0 -1
  165. package/assets/_calendarObjectId-B3IHxxnZ.js +0 -1
  166. package/assets/_labelId-BX1_9FW3.js +0 -1
  167. package/assets/_mailboxId-BKCf6hRR.js +0 -1
  168. package/assets/_messageId-DGc5xyqH.js +0 -1
  169. package/assets/_messageId-ODP9L5rG.js +0 -1
  170. package/assets/_messageId-_9l1GYCG.js +0 -1
  171. package/assets/_messageId-t0gwqxwG.js +0 -1
  172. package/assets/_outboxMessageId-DGFiVWCU.js +0 -1
  173. package/assets/_recurrenceId-yqFEhvsn.js +0 -1
  174. package/assets/_threadId-Bvd5G-pJ.js +0 -1
  175. package/assets/_threadId-BwJQjORR.js +0 -1
  176. package/assets/_threadId-CFLbzDUi.js +0 -1
  177. package/assets/_threadId-Dj29QtLs.js +0 -1
  178. package/assets/brief-NsiukvBp.js +0 -1
  179. package/assets/compose._-_outboxMessageId_-BT2RKEAF.js +0 -1
  180. package/assets/compose._-_outboxMessageId_-B_NGqkpg.js +0 -1
  181. package/assets/compose._-_outboxMessageId_-CCPr3GjM.js +0 -1
  182. package/assets/compose._-_outboxMessageId_-CFBNHbeY.js +0 -1
  183. package/assets/compose._-_outboxMessageId_-Cw-Zq1kx.js +0 -1
  184. package/assets/edit-BGhTeEac.js +0 -1
  185. package/assets/edit-CeXJ3wiI.js +0 -1
  186. package/assets/flagged-B4N5fCui.js +0 -1
  187. package/assets/index-5PtybTMj.js +0 -1
  188. package/assets/index-B-gNDz7v.js +0 -1
  189. package/assets/index-B1AltYi_.js +0 -1
  190. package/assets/index-BX5kv92z.js +0 -1
  191. package/assets/index-CzMYehsR.js +0 -1
  192. package/assets/index-DT4iQTvg.js +0 -1
  193. package/assets/index-DZ4zN_a2.js +0 -1
  194. package/assets/index-Xq-TD3Lr.js +0 -1
  195. package/assets/index-eKzwYumy.js +0 -1
  196. package/assets/index-ehMMhnu5.js +0 -1
  197. package/assets/index-rui9BQ_f.js +0 -1
  198. package/assets/index-t0gwqxwG.js +0 -1
  199. package/assets/mail-CiuTTyMm.js +0 -1
  200. package/assets/new-ZEuIlDnl.js +0 -1
  201. package/assets/onboarding-bCsMaIPY.js +0 -1
  202. package/assets/outbox-BthyAXQ5.js +0 -1
  203. package/assets/senders-uBzIqu95.js +0 -1
  204. package/assets/settings-BLs90wKU.js +0 -1
@@ -1 +1 @@
1
- import{n as N,r as n,o as k,j as a,p as g}from"./index-yeSesYv-.js";const R=320,C="cubic-bezier(0.32, 0.9, 0.3, 1)",E=.5,P=.4,T=360;function A(s){return Math.sign(s)*Math.sqrt(Math.abs(s))*4}function L({open:s,onClose:l,children:S,label:Y,dismissLabel:y="Dismiss"}){N({id:"bottom-sheet",open:s,answers:{back:l}});const b=n.useRef(null),f=n.useRef(null),[i,M]=n.useState(T),[m,u]=n.useState(null);k(f,s),n.useLayoutEffect(()=>{const t=b.current;if(!t)return;const e=()=>M(t.offsetHeight);e();const r=new ResizeObserver(e);return r.observe(t),()=>r.disconnect()},[]);const c=n.useRef(null),j=n.useCallback(t=>{t.currentTarget.setPointerCapture(t.pointerId),c.current={startY:t.clientY,lastY:t.clientY,lastT:t.timeStamp,velocity:0,moved:!1},u(0)},[]),w=n.useCallback(t=>{const e=c.current;if(!e)return;const r=t.timeStamp-e.lastT;r>0&&(e.velocity=(t.clientY-e.lastY)/r),e.lastY=t.clientY,e.lastT=t.timeStamp;const o=t.clientY-e.startY;Math.abs(o)>4&&(e.moved=!0);const I=o<0?A(o):o;u(I)},[]),h=n.useCallback(()=>{const t=c.current;if(c.current=null,!t)return;const e=t.lastY-t.startY,o=t.velocity>E||e>i*P;u(null),o&&l()},[i,l]),x=m!==null,p=s?m??0:i,d=Math.min(Math.max(1-p/i,0),1),v=x?"none":`transform ${R}ms ${C}`;return a.jsxs("div",{className:g("absolute inset-0 z-40 select-none overflow-hidden",s||x?"":"pointer-events-none"),children:[a.jsx("button",{type:"button","aria-label":y,tabIndex:-1,onClick:l,className:g("absolute inset-0 bg-black/40",d>0?"pointer-events-auto":"pointer-events-none"),style:{opacity:d*.6,transition:v.replace("transform","opacity")}}),a.jsxs("div",{ref:b,role:"dialog","aria-modal":"true","aria-labelledby":"bottom-sheet-title","aria-hidden":!s,inert:!s,className:"absolute inset-x-0 bottom-0 flex max-h-[92%] flex-col rounded-t-3xl border-t border-line bg-surface pb-[env(safe-area-inset-bottom,0px)] shadow-2xl shadow-black/30",style:{transform:`translateY(${p}px)`,transition:v},children:[a.jsx("h2",{id:"bottom-sheet-title",className:"sr-only",children:Y}),a.jsx("div",{role:"slider","aria-label":"Drag down to dismiss","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(d*100),tabIndex:-1,onPointerDown:j,onPointerMove:w,onPointerUp:h,onPointerCancel:h,className:"flex cursor-grab touch-none justify-center pb-1 pt-2.5 active:cursor-grabbing",children:a.jsx("div",{className:"h-1 w-10 rounded-full bg-fg-subtle/40"})}),a.jsx("div",{ref:f,tabIndex:-1,className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:S})]})]})}export{L as B};
1
+ import{n as N,r as n,o as k,j as a,p as g}from"./index-fsuIswbe.js";const R=320,C="cubic-bezier(0.32, 0.9, 0.3, 1)",E=.5,P=.4,T=360;function A(s){return Math.sign(s)*Math.sqrt(Math.abs(s))*4}function L({open:s,onClose:l,children:S,label:Y,dismissLabel:y="Dismiss"}){N({id:"bottom-sheet",open:s,answers:{back:l}});const b=n.useRef(null),f=n.useRef(null),[i,M]=n.useState(T),[m,u]=n.useState(null);k(f,s),n.useLayoutEffect(()=>{const t=b.current;if(!t)return;const e=()=>M(t.offsetHeight);e();const r=new ResizeObserver(e);return r.observe(t),()=>r.disconnect()},[]);const c=n.useRef(null),j=n.useCallback(t=>{t.currentTarget.setPointerCapture(t.pointerId),c.current={startY:t.clientY,lastY:t.clientY,lastT:t.timeStamp,velocity:0,moved:!1},u(0)},[]),w=n.useCallback(t=>{const e=c.current;if(!e)return;const r=t.timeStamp-e.lastT;r>0&&(e.velocity=(t.clientY-e.lastY)/r),e.lastY=t.clientY,e.lastT=t.timeStamp;const o=t.clientY-e.startY;Math.abs(o)>4&&(e.moved=!0);const I=o<0?A(o):o;u(I)},[]),h=n.useCallback(()=>{const t=c.current;if(c.current=null,!t)return;const e=t.lastY-t.startY,o=t.velocity>E||e>i*P;u(null),o&&l()},[i,l]),x=m!==null,p=s?m??0:i,d=Math.min(Math.max(1-p/i,0),1),v=x?"none":`transform ${R}ms ${C}`;return a.jsxs("div",{className:g("absolute inset-0 z-40 select-none overflow-hidden",s||x?"":"pointer-events-none"),children:[a.jsx("button",{type:"button","aria-label":y,tabIndex:-1,onClick:l,className:g("absolute inset-0 bg-black/40",d>0?"pointer-events-auto":"pointer-events-none"),style:{opacity:d*.6,transition:v.replace("transform","opacity")}}),a.jsxs("div",{ref:b,role:"dialog","aria-modal":"true","aria-labelledby":"bottom-sheet-title","aria-hidden":!s,inert:!s,className:"absolute inset-x-0 bottom-0 flex max-h-[92%] flex-col rounded-t-3xl border-t border-line bg-surface pb-[env(safe-area-inset-bottom,0px)] shadow-2xl shadow-black/30",style:{transform:`translateY(${p}px)`,transition:v},children:[a.jsx("h2",{id:"bottom-sheet-title",className:"sr-only",children:Y}),a.jsx("div",{role:"slider","aria-label":"Drag down to dismiss","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(d*100),tabIndex:-1,onPointerDown:j,onPointerMove:w,onPointerUp:h,onPointerCancel:h,className:"flex cursor-grab touch-none justify-center pb-1 pt-2.5 active:cursor-grabbing",children:a.jsx("div",{className:"h-1 w-10 rounded-full bg-fg-subtle/40"})}),a.jsx("div",{ref:f,tabIndex:-1,className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:S})]})]})}export{L as B};
@@ -1 +1 @@
1
- import{j as r}from"./index-yeSesYv-.js";import{E as t}from"./ErrorState-Bk3DwNvd.js";const i=({error:e,reset:o})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(t,{title:"Couldn't load your mailboxes",error:e,onRetry:o})});export{i as errorComponent};
1
+ import{j as r}from"./index-fsuIswbe.js";import{E as t}from"./ErrorState-BTHOmsYP.js";const i=({error:e,reset:o})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(t,{title:"Couldn't load your mailboxes",error:e,onRetry:o})});export{i as errorComponent};
@@ -0,0 +1 @@
1
+ import{j as r,O as i}from"./index-fsuIswbe.js";import{a as m}from"./MailShell-tKLYT5hn.js";import{B as o}from"./BriefPane-BQx5RRpb.js";import"./nav-link-ed0mFCCx.js";import{a as p}from"./search-token-index-BYKMNlJD.js";import"./reply-CXuSMyqp.js";import{u as e}from"./search-mirror-B2xnwy77.js";import"./useMessageBodyContent-CpTD2HGg.js";import"./FullCompose-DiZNltCL.js";import"./index-Caon2n2j.js";import"./useSignature-W9HBbZ_n.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CFZ4EPXW.js";import"./suggest-list-BCqr1j26.js";import"./sections-DpRVKuXF.js";import"./useMediaQuery-Hy81MQ2M.js";import"./chevron-down-De4wQzka.js";import"./ErrorState-BTHOmsYP.js";import"./confirm-dialog-XvccFJdE.js";import"./search-scope-B-3MTDpD.js";import"./app-chrome-BfyGOiSA.js";import"./MessageToolbar-DeDUhCvg.js";import"./MessageBody-jG4Dhul6.js";import"./kbd-jzPSd-a2.js";import"./roving-focus-DZX7IpN4.js";import"./useQueries-DPH-PeHV.js";import"./useJunkMailboxIds-CW7aI25D.js";import"./badge-BB80tGxy.js";import"./undo-2-D1IMLq7c.js";import"./DropdownMenu-C2J8u8zN.js";import"./refresh-cw-Cu9_I3cT.js";import"./popover-menu-DhcuKv1N.js";import"./mail-BzFJWQZy.js";import"./download-DEuAIIIQ.js";import"./avatar-Bq7beWCy.js";import"./EmptyState-BJU14tbt.js";import"./circle-question-mark-DhNa_A16.js";import"./useFilters-DHWZEIQe.js";import"./select-TYdrgtW5.js";import"./plus-D5-2sA5v.js";import"./calendar-suggestion-EosZrXZC.js";import"./useCalendarSuggestions-DXbA0boT.js";import"./agenda-time-D0yU-H44.js";import"./calendar-format-BwCpz-JZ.js";import"./calendar-Ds9kgvU8.js";import"./calendar-failure-note-C4gNXDQV.js";import"./checkbox-CYOm-zGr.js";import"./clock-Dds4zv6u.js";import"./segmented-control-BwvsufVp.js";import"./useLayoutTier-BNUKvwJD.js";import"./menu-Bh94jr77.js";import"./folder-input-B0q8wLhf.js";import"./label-chip-DtBVyALF.js";import"./useLabels-k1VKuQrr.js";import"./cloud-off-BYulqayx.js";import"./LabelApplyTrigger-P8IoLKME.js";import"./useRefreshControl-DdbTrGxq.js";import"./circle-check-big-CMsxQSjY.js";import"./wizard-selection-zWa1qc6-.js";function fr(){const t=p();return e({to:"/mail/brief"}),r.jsx(o,{thread:t,children:r.jsx(m,{phone:r.jsx(o.Phone,{}),list:r.jsx(o.List,{}),reading:r.jsx(i,{}),intelligence:r.jsx(o.Intelligence,{}),hasThread:!!t})})}export{fr as component};
@@ -1 +1 @@
1
- import{j as t,B as l,u as m,a as f,c as x,r as g,A as j,O as d}from"./index-yeSesYv-.js";import{A as h,S,a as B,D as e,b as A}from"./DesktopChrome-Ct-IB4ks.js";import"./nav-link-BvlYCbp-.js";import"./reply-DL5kkaJs.js";import{u as E}from"./sections-uFHlOXiA.js";import{u as v}from"./calendar-CJGXdypt.js";import{E as y}from"./ErrorState-Bk3DwNvd.js";import"./useLayoutTier-D5MoTNho.js";import"./useMediaQuery-Bf7zukl9.js";import"./avatar-B_QEsxCw.js";import"./popover-menu-wrc2e8Vk.js";import"./roving-focus-CSq3MPWi.js";import"./mail-CLkdzm71.js";import"./app-chrome-6ZXmy5H4.js";function a(){const o=E();return t.jsx(h,{search:null,actions:t.jsxs(t.Fragment,{children:[t.jsx(l,{variant:"ghost",size:"sm",icon:t.jsx(S,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:()=>o("accounts")}),t.jsx(B,{})]})})}function M(){const o=m(),n=v(),{data:r,isLoading:i,isError:c,error:p,refetch:u}=f({...x(),staleTime:1/0}),s=!!(r&&(r.accounts?.length??0)===0);return g.useEffect(()=>{s&&o({to:"/onboarding",replace:!0})},[s,o]),c?t.jsx(e,{topBar:t.jsx(a,{}),children:t.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:t.jsx(y,{title:"Couldn't load your account",error:p,onRetry:()=>{u()}})})}):t.jsx(A,{hideTabBar:n,children:t.jsx(e,{topBar:t.jsx(a,{}),children:i||s?t.jsx(j,{}):t.jsx(d,{})})})}export{M as component};
1
+ import{j as t,B as l,u as m,a as f,c as x,r as g,A as j,O as d}from"./index-fsuIswbe.js";import{A as h,S,a as B,D as e,b as A}from"./DesktopChrome-GxTHTvqD.js";import"./nav-link-ed0mFCCx.js";import"./reply-CXuSMyqp.js";import{u as E}from"./sections-DpRVKuXF.js";import{u as v}from"./calendar-Ds9kgvU8.js";import{E as y}from"./ErrorState-BTHOmsYP.js";import"./useLayoutTier-BNUKvwJD.js";import"./useMediaQuery-Hy81MQ2M.js";import"./avatar-Bq7beWCy.js";import"./popover-menu-DhcuKv1N.js";import"./roving-focus-DZX7IpN4.js";import"./mail-BzFJWQZy.js";import"./app-chrome-BfyGOiSA.js";function a(){const o=E();return t.jsx(h,{search:null,actions:t.jsxs(t.Fragment,{children:[t.jsx(l,{variant:"ghost",size:"sm",icon:t.jsx(S,{className:"size-4"}),title:"Settings","aria-label":"Settings",onClick:()=>o("accounts")}),t.jsx(B,{})]})})}function M(){const o=m(),n=v(),{data:r,isLoading:i,isError:c,error:p,refetch:u}=f({...x(),staleTime:1/0}),s=!!(r&&(r.accounts?.length??0)===0);return g.useEffect(()=>{s&&o({to:"/onboarding",replace:!0})},[s,o]),c?t.jsx(e,{topBar:t.jsx(a,{}),children:t.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:t.jsx(y,{title:"Couldn't load your account",error:p,onRetry:()=>{u()}})})}):t.jsx(A,{hideTabBar:n,children:t.jsx(e,{topBar:t.jsx(a,{}),children:i||s?t.jsx(j,{}):t.jsx(d,{})})})}export{M as component};
@@ -1 +1 @@
1
- import{N as B,r as c,u as k,K as i,cu as O,cv as C,ck as F}from"./index-yeSesYv-.js";import{c as R}from"./nav-link-BvlYCbp-.js";function y(e,n){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const a=!!(e.condition??!0),t=e.blockerFn;return{shouldBlockFn:async()=>a&&t!==void 0?await t():a,enableBeforeUnload:a,withResolver:t===void 0}}function j(e,n){const{shouldBlockFn:a,enableBeforeUnload:t=!0,disabled:s=!1,withResolver:h=!1}=y(e),u=B(),{history:d}=u,[f,v]=c.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return c.useEffect(()=>{const o=async r=>{function T(p){const w=u.parseLocation(p),m=u.getMatchedRoutes(w.pathname);return m.foundRoute===void 0?{routeId:"__notFound__",fullPath:w.pathname,pathname:w.pathname,params:m.routeParams,search:u.options.parseSearch(p.search)}:{routeId:m.foundRoute.id,fullPath:m.foundRoute.fullPath,pathname:w.pathname,params:m.routeParams,search:u.options.parseSearch(p.search)}}const I=T(r.currentLocation),g=T(r.nextLocation);if(I.routeId==="__notFound__"&&g.routeId!=="__notFound__")return!1;const b=await a({action:r.action,current:I,next:g});if(!h)return b;if(!b)return!1;const E=await new Promise(p=>{v({status:"blocked",current:I,next:g,action:r.action,proceed:()=>p(!1),reset:()=>p(!0)})});return v({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),E};return s?void 0:d.block({blockerFn:o,enableBeforeUnload:t})},[a,t,s,h,d,u]),f}const l="/calendar/$view/$date",$="/calendar/$view/$date/suggestion/$suggestionId",_="/calendar/$view/$date/task/$calendarTaskId";function P(){const e=i({from:l,shouldThrow:!1}),n=O({from:l,shouldThrow:!1}),a=e?.view??"",t=e?.date??"",s=n?.calendarId;return c.useMemo(()=>({...C({view:a,date:t},F(new Date)),calendarIds:s??[]}),[a,t,s])}function S(){const e=i({from:"/calendar/$view/$date/$calendarObjectId",shouldThrow:!1}),n=i({from:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",shouldThrow:!1}),a=e?.calendarObjectId,t=n?.recurrenceId;return c.useMemo(()=>a?{calendarObjectId:a,recurrenceId:t}:void 0,[a,t])}function V(){return i({from:_,shouldThrow:!1})?.calendarTaskId}function D(){return i({from:$,shouldThrow:!1})?.suggestionId}function N(){const e=i({from:"/calendar/$view/$date/$calendarObjectId/edit",shouldThrow:!1}),n=i({from:"/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit",shouldThrow:!1}),a=e?.calendarObjectId??n?.calendarObjectId,t=n?.recurrenceId;return c.useMemo(()=>a?{calendarObjectId:a,recurrenceId:t}:void 0,[a,t])}function L(){const e=O({from:"/calendar/$view/$date/new",shouldThrow:!1}),n=e?.start,a=e?.end,t=e!==void 0;return c.useMemo(()=>t?{start:n,end:a}:void 0,[t,n,a])}function M(){const e=N(),n=i({from:"/calendar/$view/$date/new",shouldThrow:!1}),a=i({from:$,shouldThrow:!1});return n!==void 0||a!==void 0||e!==void 0}function K(){const e=k(),n=B(),a=R(),{view:t,date:s}=P(),h=S(),u=V(),d=h!==void 0||u!==void 0,f=c.useCallback(o=>{e({to:l,params:o,search:!0,hash:a})},[e,a]),v=c.useCallback(o=>n.buildLocation({to:l,params:{view:"day",date:o},search:!0,hash:a}).href,[n,a]);return c.useMemo(()=>({goToView:o=>f({view:o,date:s}),goToToday:()=>f({view:t,date:F(new Date)}),goToDate:o=>f({view:t,date:o}),setCalendarIds:o=>e({to:l,params:{view:t,date:s},search:r=>({...r,calendarId:o.length===0?void 0:[...o]}),hash:!0,replace:!0}),setAnchorDate:o=>{d||e({to:l,params:{view:t,date:o},search:!0,hash:a,replace:!0})},zoomToDay:o=>e({href:v(o)}),dayHref:v,openEvent:(o,r)=>e(r===void 0||r===""?{to:"/calendar/$view/$date/$calendarObjectId",params:{view:t,date:s,calendarObjectId:o},search:!0,hash:a,replace:d,state:{openedFromView:!0}}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:t,date:s,calendarObjectId:o,recurrenceId:r},search:!0,hash:a,replace:d,state:{openedFromView:!0}}),openTask:o=>e({to:_,params:{view:t,date:s,calendarTaskId:o},search:!0,hash:a,replace:d,state:{openedFromView:!0}}),closeToView:()=>{if(n.state.location.state.openedFromView===!0){n.history.back();return}e({to:l,params:{view:t,date:s},search:o=>({calendarId:o.calendarId}),hash:a,replace:!0})},openNewEvent:o=>e({to:"/calendar/$view/$date/new",params:{view:t,date:s},search:r=>({...r,...o}),hash:a,replace:d,state:{openedFromView:!0}}),setNewEventBounds:o=>e({to:"/calendar/$view/$date/new",params:{view:t,date:s},search:r=>({...r,...o}),hash:!0,replace:!0,state:r=>r}),openEditor:(o,r)=>e(r===void 0||r===""?{to:"/calendar/$view/$date/$calendarObjectId/edit",params:{view:t,date:s,calendarObjectId:o},search:!0,hash:a,replace:d,state:{openedFromView:!0}}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit",params:{view:t,date:s,calendarObjectId:o,recurrenceId:r},search:!0,hash:a,replace:d,state:{openedFromView:!0}}),changeSuggestionFirst:(o,r)=>e({to:$,params:{view:t,date:r,suggestionId:o},search:!0,hash:a})}),[f,e,v,a,t,s,n,d])}function A(){const e=k();return c.useCallback((n,a,t)=>{if(t===""){e({to:"/calendar/$view/$date/$calendarObjectId",params:{view:"day",date:n,calendarObjectId:a}});return}e({to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:"day",date:n,calendarObjectId:a,recurrenceId:t}})},[e])}function G(){const e=k();return c.useCallback((n,a)=>{e({to:$,params:{view:"day",date:n,suggestionId:a}})},[e])}function W(e,n){const a=c.useRef(n);a.current=n,j({shouldBlockFn:({action:t})=>t!=="BACK"?!1:a.current(),enableBeforeUnload:!1,disabled:!e})}export{P as a,K as b,S as c,N as d,V as e,j as f,A as g,G as h,W as i,L as j,D as k,M as u};
1
+ import{N as B,r as c,u as k,K as i,cu as O,cv as C,ck as F}from"./index-fsuIswbe.js";import{c as R}from"./nav-link-ed0mFCCx.js";function y(e,n){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const a=!!(e.condition??!0),t=e.blockerFn;return{shouldBlockFn:async()=>a&&t!==void 0?await t():a,enableBeforeUnload:a,withResolver:t===void 0}}function j(e,n){const{shouldBlockFn:a,enableBeforeUnload:t=!0,disabled:s=!1,withResolver:h=!1}=y(e),u=B(),{history:d}=u,[f,v]=c.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return c.useEffect(()=>{const o=async r=>{function T(p){const w=u.parseLocation(p),m=u.getMatchedRoutes(w.pathname);return m.foundRoute===void 0?{routeId:"__notFound__",fullPath:w.pathname,pathname:w.pathname,params:m.routeParams,search:u.options.parseSearch(p.search)}:{routeId:m.foundRoute.id,fullPath:m.foundRoute.fullPath,pathname:w.pathname,params:m.routeParams,search:u.options.parseSearch(p.search)}}const I=T(r.currentLocation),g=T(r.nextLocation);if(I.routeId==="__notFound__"&&g.routeId!=="__notFound__")return!1;const b=await a({action:r.action,current:I,next:g});if(!h)return b;if(!b)return!1;const E=await new Promise(p=>{v({status:"blocked",current:I,next:g,action:r.action,proceed:()=>p(!1),reset:()=>p(!0)})});return v({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),E};return s?void 0:d.block({blockerFn:o,enableBeforeUnload:t})},[a,t,s,h,d,u]),f}const l="/calendar/$view/$date",$="/calendar/$view/$date/suggestion/$suggestionId",_="/calendar/$view/$date/task/$calendarTaskId";function P(){const e=i({from:l,shouldThrow:!1}),n=O({from:l,shouldThrow:!1}),a=e?.view??"",t=e?.date??"",s=n?.calendarId;return c.useMemo(()=>({...C({view:a,date:t},F(new Date)),calendarIds:s??[]}),[a,t,s])}function S(){const e=i({from:"/calendar/$view/$date/$calendarObjectId",shouldThrow:!1}),n=i({from:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",shouldThrow:!1}),a=e?.calendarObjectId,t=n?.recurrenceId;return c.useMemo(()=>a?{calendarObjectId:a,recurrenceId:t}:void 0,[a,t])}function V(){return i({from:_,shouldThrow:!1})?.calendarTaskId}function D(){return i({from:$,shouldThrow:!1})?.suggestionId}function N(){const e=i({from:"/calendar/$view/$date/$calendarObjectId/edit",shouldThrow:!1}),n=i({from:"/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit",shouldThrow:!1}),a=e?.calendarObjectId??n?.calendarObjectId,t=n?.recurrenceId;return c.useMemo(()=>a?{calendarObjectId:a,recurrenceId:t}:void 0,[a,t])}function L(){const e=O({from:"/calendar/$view/$date/new",shouldThrow:!1}),n=e?.start,a=e?.end,t=e!==void 0;return c.useMemo(()=>t?{start:n,end:a}:void 0,[t,n,a])}function M(){const e=N(),n=i({from:"/calendar/$view/$date/new",shouldThrow:!1}),a=i({from:$,shouldThrow:!1});return n!==void 0||a!==void 0||e!==void 0}function K(){const e=k(),n=B(),a=R(),{view:t,date:s}=P(),h=S(),u=V(),d=h!==void 0||u!==void 0,f=c.useCallback(o=>{e({to:l,params:o,search:!0,hash:a})},[e,a]),v=c.useCallback(o=>n.buildLocation({to:l,params:{view:"day",date:o},search:!0,hash:a}).href,[n,a]);return c.useMemo(()=>({goToView:o=>f({view:o,date:s}),goToToday:()=>f({view:t,date:F(new Date)}),goToDate:o=>f({view:t,date:o}),setCalendarIds:o=>e({to:l,params:{view:t,date:s},search:r=>({...r,calendarId:o.length===0?void 0:[...o]}),hash:!0,replace:!0}),setAnchorDate:o=>{d||e({to:l,params:{view:t,date:o},search:!0,hash:a,replace:!0})},zoomToDay:o=>e({href:v(o)}),dayHref:v,openEvent:(o,r)=>e(r===void 0||r===""?{to:"/calendar/$view/$date/$calendarObjectId",params:{view:t,date:s,calendarObjectId:o},search:!0,hash:a,replace:d,state:{openedFromView:!0}}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:t,date:s,calendarObjectId:o,recurrenceId:r},search:!0,hash:a,replace:d,state:{openedFromView:!0}}),openTask:o=>e({to:_,params:{view:t,date:s,calendarTaskId:o},search:!0,hash:a,replace:d,state:{openedFromView:!0}}),closeToView:()=>{if(n.state.location.state.openedFromView===!0){n.history.back();return}e({to:l,params:{view:t,date:s},search:o=>({calendarId:o.calendarId}),hash:a,replace:!0})},openNewEvent:o=>e({to:"/calendar/$view/$date/new",params:{view:t,date:s},search:r=>({...r,...o}),hash:a,replace:d,state:{openedFromView:!0}}),setNewEventBounds:o=>e({to:"/calendar/$view/$date/new",params:{view:t,date:s},search:r=>({...r,...o}),hash:!0,replace:!0,state:r=>r}),openEditor:(o,r)=>e(r===void 0||r===""?{to:"/calendar/$view/$date/$calendarObjectId/edit",params:{view:t,date:s,calendarObjectId:o},search:!0,hash:a,replace:d,state:{openedFromView:!0}}:{to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit",params:{view:t,date:s,calendarObjectId:o,recurrenceId:r},search:!0,hash:a,replace:d,state:{openedFromView:!0}}),changeSuggestionFirst:(o,r)=>e({to:$,params:{view:t,date:r,suggestionId:o},search:!0,hash:a})}),[f,e,v,a,t,s,n,d])}function A(){const e=k();return c.useCallback((n,a,t)=>{if(t===""){e({to:"/calendar/$view/$date/$calendarObjectId",params:{view:"day",date:n,calendarObjectId:a}});return}e({to:"/calendar/$view/$date/$calendarObjectId/$recurrenceId",params:{view:"day",date:n,calendarObjectId:a,recurrenceId:t}})},[e])}function G(){const e=k();return c.useCallback((n,a)=>{e({to:$,params:{view:"day",date:n,suggestionId:a}})},[e])}function W(e,n){const a=c.useRef(n);a.current=n,j({shouldBlockFn:({action:t})=>t!=="BACK"?!1:a.current(),enableBeforeUnload:!1,disabled:!e})}export{P as a,K as b,S as c,N as d,V as e,j as f,A as g,G as h,W as i,L as j,D as k,M as u};
@@ -1 +1 @@
1
- import{j as e,T as g,X as j,p as N,C as v}from"./index-yeSesYv-.js";import{M as C,d as y}from"./useCalendarSuggestions-D_tk6nh4.js";import{P as k}from"./pencil-A679n1yJ.js";function z({failure:s,focusRef:a}){return e.jsxs("div",{ref:a,role:"alert",tabIndex:-1,className:"flex flex-col gap-2 rounded-md border border-danger/40 bg-danger-soft p-3 text-sm outline-none",children:[e.jsx("p",{className:"text-danger",children:s.text}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:s.onRetry,className:"rounded-md border border-line bg-surface px-3 py-1 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:s.retryLabel??"Try again"}),e.jsx("a",{href:s.reportHref,target:"_blank",rel:"noreferrer",className:"text-sm font-medium text-accent hover:underline",children:"Report an issue"})]})]})}const l="flex size-9 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40";function T({headingId:s,headingRef:a,title:n,color:c,when:o,location:r,calendarName:x,availability:m,onEdit:t,onDelete:i,deleting:u=!1,onClose:f,failure:d,failureRef:b,children:p}){const h=y(c);return e.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[e.jsxs("div",{className:"flex justify-end gap-1",children:[t&&e.jsx("button",{type:"button","aria-label":"Edit",onClick:t,className:l,children:e.jsx(k,{className:"size-4"})}),i&&e.jsx("button",{type:"button","aria-label":"Delete",onClick:i,disabled:u,className:l,children:e.jsx(g,{className:"size-4"})}),e.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:l,children:e.jsx(j,{className:"size-4"})})]}),e.jsxs("div",{className:"flex gap-3 px-2",children:[e.jsx("span",{className:N("mt-1.5 size-3.5 shrink-0 rounded-sm",h.solid),"aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{id:s,ref:a,tabIndex:-1,className:"text-xl font-normal break-words text-fg outline-none",children:n===""?"(No title)":n}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:o})]})]}),e.jsxs("dl",{className:"flex flex-col gap-2 px-2 text-sm",children:[r!==""&&e.jsxs("div",{className:"flex gap-3",children:[e.jsx("dt",{children:e.jsx(C,{className:"size-4 text-fg-subtle","aria-label":"Location"})}),e.jsx("dd",{className:"min-w-0 break-words",children:r})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("dt",{children:e.jsx(v,{className:"size-4 text-fg-subtle","aria-label":"Calendar"})}),e.jsxs("dd",{children:[x," · ",m]})]})]}),p,d&&e.jsx(z,{failure:d,focusRef:b})]})}function E({headingId:s,onClose:a,closeRef:n}){return e.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[e.jsx("h2",{id:s,className:"text-base font-medium text-fg",children:"This event was deleted or moved"}),e.jsx("button",{ref:n,type:"button",onClick:a,className:"self-end rounded-md border border-line px-3 py-1.5 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Close"})]})}export{z as C,E as a,T as b};
1
+ import{j as e,T as g,X as j,p as N,C as v}from"./index-fsuIswbe.js";import{M as C,d as y}from"./useCalendarSuggestions-DXbA0boT.js";import{P as k}from"./pencil-BDbmS56C.js";function z({failure:s,focusRef:a}){return e.jsxs("div",{ref:a,role:"alert",tabIndex:-1,className:"flex flex-col gap-2 rounded-md border border-danger/40 bg-danger-soft p-3 text-sm outline-none",children:[e.jsx("p",{className:"text-danger",children:s.text}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:s.onRetry,className:"rounded-md border border-line bg-surface px-3 py-1 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:s.retryLabel??"Try again"}),e.jsx("a",{href:s.reportHref,target:"_blank",rel:"noreferrer",className:"text-sm font-medium text-accent hover:underline",children:"Report an issue"})]})]})}const l="flex size-9 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40";function T({headingId:s,headingRef:a,title:n,color:c,when:o,location:r,calendarName:x,availability:m,onEdit:t,onDelete:i,deleting:u=!1,onClose:f,failure:d,failureRef:b,children:p}){const h=y(c);return e.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[e.jsxs("div",{className:"flex justify-end gap-1",children:[t&&e.jsx("button",{type:"button","aria-label":"Edit",onClick:t,className:l,children:e.jsx(k,{className:"size-4"})}),i&&e.jsx("button",{type:"button","aria-label":"Delete",onClick:i,disabled:u,className:l,children:e.jsx(g,{className:"size-4"})}),e.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:l,children:e.jsx(j,{className:"size-4"})})]}),e.jsxs("div",{className:"flex gap-3 px-2",children:[e.jsx("span",{className:N("mt-1.5 size-3.5 shrink-0 rounded-sm",h.solid),"aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{id:s,ref:a,tabIndex:-1,className:"text-xl font-normal break-words text-fg outline-none",children:n===""?"(No title)":n}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:o})]})]}),e.jsxs("dl",{className:"flex flex-col gap-2 px-2 text-sm",children:[r!==""&&e.jsxs("div",{className:"flex gap-3",children:[e.jsx("dt",{children:e.jsx(C,{className:"size-4 text-fg-subtle","aria-label":"Location"})}),e.jsx("dd",{className:"min-w-0 break-words",children:r})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("dt",{children:e.jsx(v,{className:"size-4 text-fg-subtle","aria-label":"Calendar"})}),e.jsxs("dd",{children:[x," · ",m]})]})]}),p,d&&e.jsx(z,{failure:d,focusRef:b})]})}function E({headingId:s,onClose:a,closeRef:n}){return e.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[e.jsx("h2",{id:s,className:"text-base font-medium text-fg",children:"This event was deleted or moved"}),e.jsx("button",{ref:n,type:"button",onClick:a,className:"self-end rounded-md border border-line px-3 py-1.5 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Close"})]})}export{z as C,E as a,T as b};
@@ -1 +1 @@
1
- import{r as _,p,j as s,ar as v,X as I}from"./index-yeSesYv-.js";import{i as z,c as U,C as W}from"./calendar-guests-DeRthr7k.js";import{C as B}from"./calendar-event-popup-y4Z860B0.js";import{R as E,j as y,s as G}from"./agenda-time-BcOiQ5_R.js";import{S as J}from"./select-B9t8348S.js";const L=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],P=["January","February","March","April","May","June","July","August","September","October","November","December"],H=["first","second","third","fourth","last"],N="";function Q(e,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[a,r,i]=e.split("-").map(Number),d=new Date(Date.UTC(a,r-1,i)),o=L[d.getUTCDay()],m=H[Math.min(Math.floor((i-1)/7),4)],l=n===""?"":`, ${n}`,c=d.getUTCDay()>=1&&d.getUTCDay()<=5;return[`Every day${l}`,...c?[`Every weekday${l}`]:[],`Every week on ${o}${l}`,`Every month on the ${m} ${o}${l}`,`Every year on ${i} ${P[r-1]}${l}`]}const g=({draft:e,onChange:n},a,r)=>n({...e,[a]:r});function b({label:e,children:n}){return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),n]})}function w(e){return e.date===""||e.endDate===""?!1:e.allDay?e.endDate<e.date:e.startTime===""||e.endTime===""?!1:`${e.endDate}T${e.endTime}`<`${e.date}T${e.startTime}`}function K(e,n){return n===""?{...e,date:n}:e.endDate===""?{...e,date:n,endDate:n}:e.date===""?{...e,date:n}:{...e,date:n,endDate:y(n,G(e.date,e.endDate))}}function X(e,n){const a=e.date!==""&&e.endDate===y(e.date,1)&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime;return n&&a?{...e,allDay:n,endDate:e.date}:!n&&e.date!==""&&e.endDate===e.date&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime?{...e,allDay:n,endDate:y(e.date,1)}:{...e,allDay:n}}function Y({draft:e,onChange:n,touch:a}){const r=a?"min-h-11":"",i=w(e),d=_.useId(),o={"aria-invalid":i,"aria-describedby":i?d:void 0},m=p("w-40",r,i&&"border-danger/60"),l=p("w-28",r,i&&"border-danger/60");return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(v,{type:"date",value:e.date,"aria-label":"Date",...o,onChange:c=>n(K(e,c.target.value)),className:m}),!e.allDay&&s.jsx(v,{type:"time",value:e.startTime,"aria-label":"Start time",...o,onChange:c=>g({draft:e,onChange:n},"startTime",c.target.value),className:l}),s.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),s.jsx(v,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...o,onChange:c=>g({draft:e,onChange:n},"endDate",c.target.value),className:m}),!e.allDay&&s.jsx(v,{type:"time",value:e.endTime,"aria-label":"End time",...o,onChange:c=>g({draft:e,onChange:n},"endTime",c.target.value),className:l}),s.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[s.jsx("input",{type:"checkbox",checked:e.allDay,onChange:c=>n(X(e,c.target.checked)),className:"size-4 accent-current"}),"All day"]})]}),i&&s.jsx("p",{id:d,className:"text-xs text-danger",role:"alert",children:e.allDay?`Ends before it starts. Move the end to ${e.date} or later.`:`Ends before it starts. Move the end past ${e.date} ${e.startTime}, or start earlier.`})]})}function q({draft:e,onChange:n,touch:a,repeatEditable:r=!0,onCustom:i}){return r?s.jsx(V,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:d=>g({draft:e,onChange:n},"repeat",d),onCustom:i,className:a?"min-h-11":""}):s.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[s.jsx(E,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===N?"Does not repeat":e.repeat]})}const S="__custom__";function V({value:e,date:n,startTime:a,onChange:r,onCustom:i,className:d}){const o=Q(n,a),m=e===N||o.includes(e)?o:[e,...o];return s.jsxs(J,{icon:s.jsx(E,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:l=>{if(l.target.value===S){i?.();return}r(l.target.value)},className:d,children:[s.jsx("option",{value:N,children:"Does not repeat"}),m.map(l=>s.jsx("option",{value:l,children:l},l)),i&&s.jsx("option",{value:S,children:"Custom…"})]})}const Z="h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30 disabled:opacity-60";function le({heading:e,draft:n,onChange:a,calendars:r,calendarEditable:i,repeatEditable:d,timeZone:o,timeZones:m,onTimeZone:l,busy:c,onBusy:$,onSave:A,onCancel:f,saving:j=!1,saveLabel:M="Save",problem:T="",failure:D,failureRef:F,titleRef:O,touch:x=!1,children:R,guests:u}){const h=p(Z,x&&"h-11"),C=w(n),k=u!==void 0&&z(n.guests)!==void 0;return s.jsxs("form",{"aria-label":e,"data-event-sidebar":"",className:"flex h-full min-h-0 flex-col bg-surface",onSubmit:t=>{t.preventDefault(),!j&&!C&&!k&&A()},children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-line px-4 py-2",children:[s.jsx("h2",{className:"text-base font-medium text-fg",children:e}),s.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:p("flex items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",x?"size-11":"size-8"),children:s.jsx(I,{className:"size-4"})})]}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4",children:[s.jsx("input",{ref:O,"aria-label":"Title",placeholder:"Add title",value:n.title,onChange:t=>a({...n,title:t.target.value}),className:"border-b-2 border-line bg-transparent pb-1 text-xl text-fg outline-none placeholder:text-fg-subtle focus:border-accent"}),s.jsx(Y,{draft:n,onChange:a,touch:x}),s.jsx(b,{label:"Time zone",children:s.jsx("select",{"aria-label":"Time zone",value:o,onChange:t=>l(t.target.value),className:h,children:m.map(t=>s.jsx("option",{value:t,children:t},t))})}),s.jsx(b,{label:"Repeat",children:s.jsx(q,{draft:n,onChange:a,touch:x,repeatEditable:d})}),s.jsx(b,{label:"Calendar",children:s.jsx("select",{"aria-label":"Calendar",value:n.calendarId,disabled:!i,onChange:t=>a({...n,calendarId:t.target.value}),className:h,children:r.map(t=>s.jsx("option",{value:t.id,children:t.name},t.id))})}),s.jsx(b,{label:"Location",children:s.jsx("input",{"aria-label":"Location",placeholder:"Add location",value:n.location,onChange:t=>a({...n,location:t.target.value}),className:h})}),s.jsx(b,{label:"Show as",children:s.jsxs("select",{"aria-label":"Show as",value:c?"busy":"free",onChange:t=>$(t.target.value==="busy"),className:h,children:[s.jsx("option",{value:"busy",children:"Busy"}),s.jsx("option",{value:"free",children:"Free"})]})}),s.jsx(b,{label:"Description",children:s.jsx("textarea",{"aria-label":"Description",placeholder:"Add description",rows:5,value:n.notes,onChange:t=>a({...n,notes:t.target.value}),className:"w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30"})}),u&&s.jsx(b,{label:"Guests",children:s.jsx(U,{value:n.guests,onChange:t=>a({...n,guests:t}),suggestions:u.suggestions,onQuery:u.onQuery,touch:x})}),u&&n.guests.length>0&&u.senders.length>0&&s.jsxs(b,{label:"Send invitations from",children:[s.jsx(W,{label:"Send invitations from",senders:u.senders,value:u.sender,onChange:u.onSender,disabled:!u.senderEditable,touch:x}),s.jsx("p",{className:"mt-1 text-xs text-fg-muted",children:"Default set in Settings, Calendars"})]}),R]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-t border-line px-4 py-3",children:[T!==""&&s.jsx("p",{role:"alert",className:"text-sm text-danger",children:T}),D&&s.jsx(B,{failure:D,focusRef:F}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{type:"button",onClick:f,className:p("rounded-md border border-line px-4 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",x?"min-h-11":"h-9"),children:"Cancel"}),s.jsx("button",{type:"submit",disabled:j||C||k,className:p("rounded-md bg-accent px-5 text-sm font-medium text-accent-fg hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",x?"min-h-11":"h-9"),children:j?"Saving…":M})]})]})]})}export{le as C};
1
+ import{r as _,p,j as s,ar as v,X as I}from"./index-fsuIswbe.js";import{i as z,c as U,C as W}from"./calendar-guests-Cay9Ub8h.js";import{C as B}from"./calendar-event-popup-Cr_LW8IP.js";import{R as E,j as y,s as G}from"./agenda-time-D0yU-H44.js";import{S as J}from"./select-TYdrgtW5.js";const L=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],P=["January","February","March","April","May","June","July","August","September","October","November","December"],H=["first","second","third","fourth","last"],N="";function Q(e,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return[];const[a,r,i]=e.split("-").map(Number),d=new Date(Date.UTC(a,r-1,i)),o=L[d.getUTCDay()],m=H[Math.min(Math.floor((i-1)/7),4)],l=n===""?"":`, ${n}`,c=d.getUTCDay()>=1&&d.getUTCDay()<=5;return[`Every day${l}`,...c?[`Every weekday${l}`]:[],`Every week on ${o}${l}`,`Every month on the ${m} ${o}${l}`,`Every year on ${i} ${P[r-1]}${l}`]}const g=({draft:e,onChange:n},a,r)=>n({...e,[a]:r});function b({label:e,children:n}){return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-fg-subtle",children:e}),n]})}function w(e){return e.date===""||e.endDate===""?!1:e.allDay?e.endDate<e.date:e.startTime===""||e.endTime===""?!1:`${e.endDate}T${e.endTime}`<`${e.date}T${e.startTime}`}function K(e,n){return n===""?{...e,date:n}:e.endDate===""?{...e,date:n,endDate:n}:e.date===""?{...e,date:n}:{...e,date:n,endDate:y(n,G(e.date,e.endDate))}}function X(e,n){const a=e.date!==""&&e.endDate===y(e.date,1)&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime;return n&&a?{...e,allDay:n,endDate:e.date}:!n&&e.date!==""&&e.endDate===e.date&&e.startTime!==""&&e.endTime!==""&&e.endTime<e.startTime?{...e,allDay:n,endDate:y(e.date,1)}:{...e,allDay:n}}function Y({draft:e,onChange:n,touch:a}){const r=a?"min-h-11":"",i=w(e),d=_.useId(),o={"aria-invalid":i,"aria-describedby":i?d:void 0},m=p("w-40",r,i&&"border-danger/60"),l=p("w-28",r,i&&"border-danger/60");return s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(v,{type:"date",value:e.date,"aria-label":"Date",...o,onChange:c=>n(K(e,c.target.value)),className:m}),!e.allDay&&s.jsx(v,{type:"time",value:e.startTime,"aria-label":"Start time",...o,onChange:c=>g({draft:e,onChange:n},"startTime",c.target.value),className:l}),s.jsx("span",{className:"text-sm text-fg-subtle",children:"to"}),s.jsx(v,{type:"date",value:e.endDate,"aria-label":"End date",min:e.date===""?void 0:e.date,...o,onChange:c=>g({draft:e,onChange:n},"endDate",c.target.value),className:m}),!e.allDay&&s.jsx(v,{type:"time",value:e.endTime,"aria-label":"End time",...o,onChange:c=>g({draft:e,onChange:n},"endTime",c.target.value),className:l}),s.jsxs("label",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[s.jsx("input",{type:"checkbox",checked:e.allDay,onChange:c=>n(X(e,c.target.checked)),className:"size-4 accent-current"}),"All day"]})]}),i&&s.jsx("p",{id:d,className:"text-xs text-danger",role:"alert",children:e.allDay?`Ends before it starts. Move the end to ${e.date} or later.`:`Ends before it starts. Move the end past ${e.date} ${e.startTime}, or start earlier.`})]})}function q({draft:e,onChange:n,touch:a,repeatEditable:r=!0,onCustom:i}){return r?s.jsx(V,{value:e.repeat,date:e.date,startTime:e.startTime,onChange:d=>g({draft:e,onChange:n},"repeat",d),onCustom:i,className:a?"min-h-11":""}):s.jsxs("p",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[s.jsx(E,{className:"size-4 shrink-0 text-fg-subtle","aria-hidden":!0}),e.repeat===N?"Does not repeat":e.repeat]})}const S="__custom__";function V({value:e,date:n,startTime:a,onChange:r,onCustom:i,className:d}){const o=Q(n,a),m=e===N||o.includes(e)?o:[e,...o];return s.jsxs(J,{icon:s.jsx(E,{className:"size-4"}),"aria-label":"Repeat",value:e,onChange:l=>{if(l.target.value===S){i?.();return}r(l.target.value)},className:d,children:[s.jsx("option",{value:N,children:"Does not repeat"}),m.map(l=>s.jsx("option",{value:l,children:l},l)),i&&s.jsx("option",{value:S,children:"Custom…"})]})}const Z="h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30 disabled:opacity-60";function le({heading:e,draft:n,onChange:a,calendars:r,calendarEditable:i,repeatEditable:d,timeZone:o,timeZones:m,onTimeZone:l,busy:c,onBusy:$,onSave:A,onCancel:f,saving:j=!1,saveLabel:M="Save",problem:T="",failure:D,failureRef:F,titleRef:O,touch:x=!1,children:R,guests:u}){const h=p(Z,x&&"h-11"),C=w(n),k=u!==void 0&&z(n.guests)!==void 0;return s.jsxs("form",{"aria-label":e,"data-event-sidebar":"",className:"flex h-full min-h-0 flex-col bg-surface",onSubmit:t=>{t.preventDefault(),!j&&!C&&!k&&A()},children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-line px-4 py-2",children:[s.jsx("h2",{className:"text-base font-medium text-fg",children:e}),s.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:p("flex items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",x?"size-11":"size-8"),children:s.jsx(I,{className:"size-4"})})]}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4",children:[s.jsx("input",{ref:O,"aria-label":"Title",placeholder:"Add title",value:n.title,onChange:t=>a({...n,title:t.target.value}),className:"border-b-2 border-line bg-transparent pb-1 text-xl text-fg outline-none placeholder:text-fg-subtle focus:border-accent"}),s.jsx(Y,{draft:n,onChange:a,touch:x}),s.jsx(b,{label:"Time zone",children:s.jsx("select",{"aria-label":"Time zone",value:o,onChange:t=>l(t.target.value),className:h,children:m.map(t=>s.jsx("option",{value:t,children:t},t))})}),s.jsx(b,{label:"Repeat",children:s.jsx(q,{draft:n,onChange:a,touch:x,repeatEditable:d})}),s.jsx(b,{label:"Calendar",children:s.jsx("select",{"aria-label":"Calendar",value:n.calendarId,disabled:!i,onChange:t=>a({...n,calendarId:t.target.value}),className:h,children:r.map(t=>s.jsx("option",{value:t.id,children:t.name},t.id))})}),s.jsx(b,{label:"Location",children:s.jsx("input",{"aria-label":"Location",placeholder:"Add location",value:n.location,onChange:t=>a({...n,location:t.target.value}),className:h})}),s.jsx(b,{label:"Show as",children:s.jsxs("select",{"aria-label":"Show as",value:c?"busy":"free",onChange:t=>$(t.target.value==="busy"),className:h,children:[s.jsx("option",{value:"busy",children:"Busy"}),s.jsx("option",{value:"free",children:"Free"})]})}),s.jsx(b,{label:"Description",children:s.jsx("textarea",{"aria-label":"Description",placeholder:"Add description",rows:5,value:n.notes,onChange:t=>a({...n,notes:t.target.value}),className:"w-full rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30"})}),u&&s.jsx(b,{label:"Guests",children:s.jsx(U,{value:n.guests,onChange:t=>a({...n,guests:t}),suggestions:u.suggestions,onQuery:u.onQuery,touch:x})}),u&&n.guests.length>0&&u.senders.length>0&&s.jsxs(b,{label:"Send invitations from",children:[s.jsx(W,{label:"Send invitations from",senders:u.senders,value:u.sender,onChange:u.onSender,disabled:!u.senderEditable,touch:x}),s.jsx("p",{className:"mt-1 text-xs text-fg-muted",children:"Default set in Settings, Calendars"})]}),R]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-t border-line px-4 py-3",children:[T!==""&&s.jsx("p",{role:"alert",className:"text-sm text-danger",children:T}),D&&s.jsx(B,{failure:D,focusRef:F}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{type:"button",onClick:f,className:p("rounded-md border border-line px-4 text-sm font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",x?"min-h-11":"h-9"),children:"Cancel"}),s.jsx("button",{type:"submit",disabled:j||C||k,className:p("rounded-md bg-accent px-5 text-sm font-medium text-accent-fg hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",x?"min-h-11":"h-9"),children:j?"Saving…":M})]})]})]})}export{le as C};
@@ -1 +1 @@
1
- import{j as e,ag as n,p as t}from"./index-yeSesYv-.js";function l({text:a,reportHref:r,className:s}){return e.jsxs("div",{role:"alert",className:t("flex items-start gap-1.5 rounded-md border border-danger/40 bg-danger-soft p-2 text-xs text-danger",s),children:[e.jsx(n,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":!0}),e.jsxs("p",{className:"min-w-0 flex-1",children:[a,r&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:r,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]})]})]})}export{l as C};
1
+ import{j as e,ag as n,p as t}from"./index-fsuIswbe.js";function l({text:a,reportHref:r,className:s}){return e.jsxs("div",{role:"alert",className:t("flex items-start gap-1.5 rounded-md border border-danger/40 bg-danger-soft p-2 text-xs text-danger",s),children:[e.jsx(n,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":!0}),e.jsxs("p",{className:"min-w-0 flex-1",children:[a,r&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:r,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]})]})]})}export{l as C};
@@ -1 +1 @@
1
- import{b as v,j as e,p as x,X as f,r as p,at as w}from"./index-yeSesYv-.js";import{C as z}from"./calendar-event-popup-y4Z860B0.js";import{C as G}from"./circle-question-mark-CpApZe3H.js";const j={name:"clock-3",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]]};j.node;const D=v(j);const N={name:"crown",size:24,node:[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]};N.node;const M=v(N),I=/^[^\s@<>",;]+@[^\s@<>",;]+\.[^\s@<>",;]+$/,L=/^\s*"?([^"<]*?)"?\s*<([^>]+)>\s*$/;function h(a){const s=a.trim(),t=L.exec(s),i=(t?.[2]??s).trim().toLowerCase(),l=t?.[1]?.trim()??"";return{text:s,email:i,displayName:l===""?i:l,valid:I.test(i)}}function B(a,s){return{text:a,email:a,displayName:s===""?a:s,valid:!0}}function $(a,s){return s.valid&&a.some(t=>t.email===s.email)?[...a]:[...a,s]}function T(a){return a.find(s=>!s.valid)}const A="inline-flex max-w-full items-center gap-1 rounded-full border px-2 py-0.5 text-sm";function W({value:a,onChange:s,suggestions:t,onQuery:i,touch:l=!1}){const o=p.useId(),c=p.useId(),[u,g]=p.useState(""),d=a,m=d.find(n=>!n.valid),b=n=>{if(n.trim()==="")return;const r=t.find(C=>C.email===n.trim().toLowerCase()),k=h(r?r.name===""?r.email:`${r.name} <${r.email}>`:n);s($(d,k)),g(""),i("")},y=n=>s(d.filter(r=>r!==n));return e.jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&e.jsx("ul",{"aria-label":"Guests",className:"flex flex-wrap gap-1.5",children:d.map(n=>e.jsxs("li",{className:x(A,n.valid?"border-line bg-surface-sunken text-fg":"border-danger bg-danger-soft text-danger"),children:[e.jsx("span",{className:"truncate",children:n.valid?n.displayName:n.text}),e.jsx("button",{type:"button","aria-label":`Remove ${n.valid?n.email:n.text}`,onClick:()=>y(n),className:"rounded-full p-0.5 hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(f,{className:"size-3"})})]},n.text))}),e.jsx("input",{"aria-label":"Guests","aria-describedby":m?c:void 0,"aria-invalid":m?!0:void 0,placeholder:"Add guests",list:o,value:u,onChange:n=>{const r=n.target.value;if(/[,;]$/.test(r)){b(r.slice(0,-1));return}g(r),i(r)},onKeyDown:n=>{n.key!=="Enter"||u.trim()===""||(n.preventDefault(),b(u))},onBlur:()=>b(u),className:x("h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",l&&"h-11")}),e.jsx("datalist",{id:o,children:t.map(n=>e.jsx("option",{value:n.email,children:n.name},n.email))}),m&&e.jsxs("p",{id:c,role:"status",className:"text-sm text-danger",children:[m.text," is not an email address. Fix or remove it to save."]})]})}function H({label:a,senders:s,value:t,onChange:i,disabled:l=!1,touch:o=!1}){return e.jsx("select",{"aria-label":a,value:t,disabled:l,onChange:c=>i(c.target.value),className:x("h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30 disabled:opacity-60",o&&"h-11"),children:s.map(c=>e.jsx("option",{value:c.accountId,children:c.email},c.accountId))})}const S=[["accepted","yes"],["declined","no"],["tentative","maybe"],["needsAction","awaiting"]],E=a=>S.flatMap(([s,t])=>a[s]===0?[]:[`${a[s]} ${t}`]).join(", "),R=a=>a==="accepted"?e.jsx(w,{className:"size-3.5 text-positive","aria-label":"Yes"}):a==="declined"?e.jsx(f,{className:"size-3.5 text-danger","aria-label":"No"}):a==="tentative"?e.jsx(G,{className:"size-3.5 text-fg-muted","aria-label":"Maybe"}):e.jsx(D,{className:"size-3.5 text-fg-subtle","aria-label":"Awaiting"});function K({attendees:a,counts:s}){return a.length===0?null:e.jsxs("section",{"aria-label":"Guests",className:"flex flex-col gap-1.5 px-2 text-sm",children:[e.jsxs("p",{className:"font-medium text-fg",children:[a.length," ",a.length===1?"guest":"guests"]}),e.jsx("p",{className:"text-fg-muted",children:E(s)}),e.jsx("ul",{className:"flex flex-col gap-1",children:a.map(t=>e.jsxs("li",{className:"flex items-center gap-2",children:[R(t.rsvp),e.jsx("span",{className:"min-w-0 truncate",children:t.name===""?t.email:t.name}),t.role==="organizer"&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-xs text-fg-muted",children:[e.jsx(M,{className:"size-3","aria-hidden":"true"}),"Organizer"]})]},t.email))})]})}const _=[["accepted","Yes"],["declined","No"],["tentative","Maybe"]];function X({current:a,onAnswer:s,sending:t=!1,failure:i}){return e.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-2 pt-3",children:[e.jsxs("fieldset",{className:"flex items-center gap-2",children:[e.jsx("legend",{className:"sr-only",children:"Going?"}),e.jsx("span",{"aria-hidden":"true",className:"mr-1 text-sm text-fg",children:"Going?"}),_.map(([l,o])=>e.jsx("button",{type:"button","aria-pressed":a===l,disabled:t,onClick:()=>s(l),className:x("h-8 rounded-full border px-3 text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60",a===l?"border-accent bg-accent text-accent-fg":"border-line hover:bg-surface-sunken"),children:o},l))]}),i&&e.jsx(z,{failure:i})]})}function q({missed:a,onRetry:s,reportHref:t,onDismiss:i}){if(a.length===0)return null;const l=a.join(", ");return e.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[e.jsxs("p",{className:"text-danger",children:["Saved, but the ",a.length===1?"invitation":"invitations"," to"," ",l," didn't go out."]}),e.jsx("button",{type:"button",onClick:s,className:"rounded-md border border-line bg-surface px-3 py-1 font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Try again"}),e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"}),e.jsx("button",{type:"button","aria-label":"Dismiss",onClick:i,className:"ml-auto rounded-full p-1 text-fg-muted hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(f,{className:"size-4"})})]})}function J({guests:a,onDismiss:s}){return a.length===0?null:e.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-3 rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm",children:[e.jsxs("p",{className:"text-fg",children:["Deleted. A cancellation is going to ",a.join(", "),"."]}),e.jsx("button",{type:"button","aria-label":"Dismiss",onClick:s,className:"ml-auto rounded-full p-1 text-fg-muted hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(f,{className:"size-4"})})]})}export{H as C,J as a,q as b,W as c,K as d,X as e,T as i,B as s};
1
+ import{b as v,j as e,p as x,X as f,r as p,at as w}from"./index-fsuIswbe.js";import{C as z}from"./calendar-event-popup-Cr_LW8IP.js";import{C as G}from"./circle-question-mark-DhNa_A16.js";const j={name:"clock-3",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]]};j.node;const D=v(j);const N={name:"crown",size:24,node:[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]};N.node;const M=v(N),I=/^[^\s@<>",;]+@[^\s@<>",;]+\.[^\s@<>",;]+$/,L=/^\s*"?([^"<]*?)"?\s*<([^>]+)>\s*$/;function h(a){const s=a.trim(),t=L.exec(s),i=(t?.[2]??s).trim().toLowerCase(),l=t?.[1]?.trim()??"";return{text:s,email:i,displayName:l===""?i:l,valid:I.test(i)}}function B(a,s){return{text:a,email:a,displayName:s===""?a:s,valid:!0}}function $(a,s){return s.valid&&a.some(t=>t.email===s.email)?[...a]:[...a,s]}function T(a){return a.find(s=>!s.valid)}const A="inline-flex max-w-full items-center gap-1 rounded-full border px-2 py-0.5 text-sm";function W({value:a,onChange:s,suggestions:t,onQuery:i,touch:l=!1}){const o=p.useId(),c=p.useId(),[u,g]=p.useState(""),d=a,m=d.find(n=>!n.valid),b=n=>{if(n.trim()==="")return;const r=t.find(C=>C.email===n.trim().toLowerCase()),k=h(r?r.name===""?r.email:`${r.name} <${r.email}>`:n);s($(d,k)),g(""),i("")},y=n=>s(d.filter(r=>r!==n));return e.jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&e.jsx("ul",{"aria-label":"Guests",className:"flex flex-wrap gap-1.5",children:d.map(n=>e.jsxs("li",{className:x(A,n.valid?"border-line bg-surface-sunken text-fg":"border-danger bg-danger-soft text-danger"),children:[e.jsx("span",{className:"truncate",children:n.valid?n.displayName:n.text}),e.jsx("button",{type:"button","aria-label":`Remove ${n.valid?n.email:n.text}`,onClick:()=>y(n),className:"rounded-full p-0.5 hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(f,{className:"size-3"})})]},n.text))}),e.jsx("input",{"aria-label":"Guests","aria-describedby":m?c:void 0,"aria-invalid":m?!0:void 0,placeholder:"Add guests",list:o,value:u,onChange:n=>{const r=n.target.value;if(/[,;]$/.test(r)){b(r.slice(0,-1));return}g(r),i(r)},onKeyDown:n=>{n.key!=="Enter"||u.trim()===""||(n.preventDefault(),b(u))},onBlur:()=>b(u),className:x("h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:border-line-strong focus-visible:ring-2 focus-visible:ring-ring/30",l&&"h-11")}),e.jsx("datalist",{id:o,children:t.map(n=>e.jsx("option",{value:n.email,children:n.name},n.email))}),m&&e.jsxs("p",{id:c,role:"status",className:"text-sm text-danger",children:[m.text," is not an email address. Fix or remove it to save."]})]})}function H({label:a,senders:s,value:t,onChange:i,disabled:l=!1,touch:o=!1}){return e.jsx("select",{"aria-label":a,value:t,disabled:l,onChange:c=>i(c.target.value),className:x("h-9 w-full rounded-md border border-line bg-surface-sunken px-2 text-sm text-fg outline-none focus-visible:ring-2 focus-visible:ring-ring/30 disabled:opacity-60",o&&"h-11"),children:s.map(c=>e.jsx("option",{value:c.accountId,children:c.email},c.accountId))})}const S=[["accepted","yes"],["declined","no"],["tentative","maybe"],["needsAction","awaiting"]],E=a=>S.flatMap(([s,t])=>a[s]===0?[]:[`${a[s]} ${t}`]).join(", "),R=a=>a==="accepted"?e.jsx(w,{className:"size-3.5 text-positive","aria-label":"Yes"}):a==="declined"?e.jsx(f,{className:"size-3.5 text-danger","aria-label":"No"}):a==="tentative"?e.jsx(G,{className:"size-3.5 text-fg-muted","aria-label":"Maybe"}):e.jsx(D,{className:"size-3.5 text-fg-subtle","aria-label":"Awaiting"});function K({attendees:a,counts:s}){return a.length===0?null:e.jsxs("section",{"aria-label":"Guests",className:"flex flex-col gap-1.5 px-2 text-sm",children:[e.jsxs("p",{className:"font-medium text-fg",children:[a.length," ",a.length===1?"guest":"guests"]}),e.jsx("p",{className:"text-fg-muted",children:E(s)}),e.jsx("ul",{className:"flex flex-col gap-1",children:a.map(t=>e.jsxs("li",{className:"flex items-center gap-2",children:[R(t.rsvp),e.jsx("span",{className:"min-w-0 truncate",children:t.name===""?t.email:t.name}),t.role==="organizer"&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-xs text-fg-muted",children:[e.jsx(M,{className:"size-3","aria-hidden":"true"}),"Organizer"]})]},t.email))})]})}const _=[["accepted","Yes"],["declined","No"],["tentative","Maybe"]];function X({current:a,onAnswer:s,sending:t=!1,failure:i}){return e.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-2 pt-3",children:[e.jsxs("fieldset",{className:"flex items-center gap-2",children:[e.jsx("legend",{className:"sr-only",children:"Going?"}),e.jsx("span",{"aria-hidden":"true",className:"mr-1 text-sm text-fg",children:"Going?"}),_.map(([l,o])=>e.jsx("button",{type:"button","aria-pressed":a===l,disabled:t,onClick:()=>s(l),className:x("h-8 rounded-full border px-3 text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60",a===l?"border-accent bg-accent text-accent-fg":"border-line hover:bg-surface-sunken"),children:o},l))]}),i&&e.jsx(z,{failure:i})]})}function q({missed:a,onRetry:s,reportHref:t,onDismiss:i}){if(a.length===0)return null;const l=a.join(", ");return e.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-3 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[e.jsxs("p",{className:"text-danger",children:["Saved, but the ",a.length===1?"invitation":"invitations"," to"," ",l," didn't go out."]}),e.jsx("button",{type:"button",onClick:s,className:"rounded-md border border-line bg-surface px-3 py-1 font-medium hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring",children:"Try again"}),e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"}),e.jsx("button",{type:"button","aria-label":"Dismiss",onClick:i,className:"ml-auto rounded-full p-1 text-fg-muted hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(f,{className:"size-4"})})]})}function J({guests:a,onDismiss:s}){return a.length===0?null:e.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-3 rounded-md border border-line bg-surface-sunken px-3 py-2 text-sm",children:[e.jsxs("p",{className:"text-fg",children:["Deleted. A cancellation is going to ",a.join(", "),"."]}),e.jsx("button",{type:"button","aria-label":"Dismiss",onClick:s,className:"ml-auto rounded-full p-1 text-fg-muted hover:bg-surface focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(f,{className:"size-4"})})]})}export{H as C,J as a,q as b,W as c,K as d,X as e,T as i,B as s};
@@ -1 +1 @@
1
- import{b as F,p as c,j as s,S as Y,r as S,X as K,ag as X,B as M,ck as k,f3 as x,f4 as Z}from"./index-yeSesYv-.js";import{d as J}from"./useCalendarSuggestions-D_tk6nh4.js";import{R as Q,n as V,o as ee,p as $,d as T}from"./agenda-time-BcOiQ5_R.js";import{M as D}from"./mail-CLkdzm71.js";import{P as te}from"./plus-D9A6i0pi.js";import{N as se}from"./nav-link-BvlYCbp-.js";import"./reply-DL5kkaJs.js";import{a as A,c as g,f as ae,d as R,b as ne}from"./calendar-format-BwCpz-JZ.js";const B={name:"globe",size:24,node:[["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"}]]};B.node;const L=F(B);const U={name:"sliders-horizontal",size:24,node:[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]};U.node;const re=F(U);function ie(e){const t=J(e.color),a=e.rsvp==="tentative"||e.status==="tentative";return c("flex min-w-0 overflow-hidden rounded-sm border-l-2 px-1.5 py-0.5",t.soft,t.text,t.rail,e.layout==="column"||e.stacked?"flex-col":"items-center gap-1.5",a&&"border-y border-r border-dashed",a&&t.border,e.rsvp==="declined"&&"opacity-60",e.selected&&"ring-2 ring-ring",e.density==="compact"?"text-2xs":"text-xs")}function oe({title:e,timeText:t,layout:a,rsvp:n,hasThread:i,isRecurring:r,zoneCertainty:d,trailing:u,detail:h}){const o=a==="column",m=d==="ambiguous",l=!o&&h!==void 0,p=s.jsxs("span",{className:c("flex min-w-0 items-center gap-1",o&&"w-full",n==="declined"&&"line-through"),children:[t!==""&&s.jsx("span",{className:"shrink-0 tabular-nums opacity-80",children:t}),s.jsx("span",{className:"truncate font-medium",children:e})]}),v=(r||i||m)&&s.jsxs("span",{className:c("flex shrink-0 items-center gap-1",o&&"mt-0.5",!o&&u===void 0&&"ml-auto"),children:[r&&s.jsx(Q,{className:"size-2.5","aria-label":"Repeats"}),i&&s.jsx(D,{className:"size-2.5","aria-label":"From mail"}),m&&s.jsx(L,{className:"size-2.5 text-warning","aria-label":"Unclear zone"})]}),y=u!==void 0&&s.jsx("span",{className:c("shrink-0 opacity-80",!o&&"ml-auto"),children:u});return s.jsxs(s.Fragment,{children:[l?s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[p,v,y]}):s.jsxs(s.Fragment,{children:[p,v,y]}),h]})}function Fe({title:e,timeText:t,color:a,layout:n,density:i,rsvp:r,status:d,hasThread:u,isRecurring:h,zoneCertainty:o,selected:m,onClick:l,leading:p,trailing:v,detail:y}){const N=n==="column";return s.jsxs("button",{type:"button",onClick:l,"aria-pressed":m,className:c("group flex w-full min-w-0 text-left outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",N?"h-full":"items-start",p!==void 0&&"gap-2"),children:[p,s.jsx("span",{className:c(ie({color:a,layout:n,density:i,rsvp:r,status:d,selected:m,stacked:y!==void 0}),"flex-1",N&&"h-full"),children:s.jsx(oe,{title:e,timeText:t,layout:n,rsvp:r,hasThread:u,isRecurring:h,zoneCertainty:o,trailing:v,detail:y})})]})}function le({id:e,reason:t,nudged:a,className:n}){return s.jsxs(s.Fragment,{children:[s.jsx("p",{id:e,className:c(n,!a&&"sr-only"),children:t}),s.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:a?t:""})]})}function Ze({items:e,className:t}){return e.length===0?s.jsxs("div",{className:c("flex flex-col items-center gap-2 p-6 text-center",t),children:[s.jsx(Y,{className:"size-6 text-fg-subtle","aria-hidden":!0}),s.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing in your mail is waiting on a decision about time."})]}):s.jsx("ul",{"aria-label":"Suggested events",className:c("flex min-h-0 flex-col gap-3 overflow-y-auto",t),children:e.map(a=>s.jsx("li",{children:a.card},a.id))})}const ce="Pick a clock first. The mail never said, and the reader will not choose for you.";function de(e,t){const a=e.zoneOptions;return a===void 0?{settled:!0,timeZone:""}:a.some(n=>n.timeZone===t)?{settled:!0,timeZone:t}:{settled:!1,reason:ce}}function O(e){return e.threadSubject===""?e.sender:`${e.sender} — ${e.threadSubject}`}function me(e){return e>=.85?"Read cleanly":e>=.6?"Read with gaps":"Barely read"}function $e({suggestion:e,whenText:t,onAdd:a,onReview:n,onDismiss:i,onOpenThread:r,busy:d=!1,addBlocked:u=!1,zoneChoice:h,onZoneChoice:o,addLabel:m="Add",touch:l,className:p}){const[v,y]=S.useState(""),[N,E]=S.useState(!1),z=S.useId(),C=h??v,G=f=>{E(!1),o?o(f):y(f)},b=de(e,C),I=f=>()=>{if(!b.settled){E(!0);return}f(b.timeZone)};return s.jsxs("article",{"aria-label":e.title,className:c("flex flex-col gap-2 rounded-lg border border-dashed border-line-strong bg-surface-sunken p-3",p),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:["Suggested from mail · ",me(e.confidence)]}),s.jsx("span",{className:"block truncate text-sm font-medium text-fg",children:e.title}),s.jsx("span",{className:"block text-xs text-fg-muted",children:t}),e.location!==""&&s.jsx("span",{className:"block truncate text-xs text-fg-muted",children:e.location})]}),s.jsx("button",{type:"button","aria-label":"Dismiss suggestion",onClick:i,disabled:d,className:c("flex shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",l?"size-11":"size-7"),children:s.jsx(K,{className:"size-4"})})]}),e.ambiguity!==""&&s.jsxs("p",{className:"flex items-start gap-1.5 text-2xs text-warning",children:[s.jsx(X,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),e.ambiguity]}),r?s.jsxs("button",{type:"button",onClick:r,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm text-left text-2xs text-accent-2 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx(D,{className:"size-3 shrink-0"}),s.jsx("span",{className:"truncate",children:O(e)})]}):s.jsxs("p",{className:"flex w-full min-w-0 items-center gap-1.5 text-2xs text-fg-subtle",children:[s.jsx(D,{className:"size-3 shrink-0"}),s.jsx("span",{className:"truncate",children:O(e)})]}),e.zoneOptions&&s.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-warning/40 p-2",children:[s.jsxs("p",{className:"flex items-center gap-1.5 text-2xs font-semibold text-warning",children:[s.jsx(L,{className:"size-3 shrink-0","aria-hidden":!0}),"Which clock is this on?"]}),e.zoneOptions.map(f=>s.jsxs("button",{type:"button","aria-pressed":C===f.timeZone,onClick:()=>G(f.timeZone),className:c("rounded-md border px-2 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",l&&"min-h-11",C===f.timeZone?"border-accent bg-accent-soft":"border-line bg-surface hover:border-line-strong"),children:[s.jsx("span",{className:"block text-xs font-medium text-fg",children:f.label}),s.jsx("span",{className:"block text-2xs text-fg-subtle",children:f.note})]},f.timeZone))]}),!b.settled&&s.jsx(le,{id:z,reason:b.reason,nudged:N,className:"text-2xs text-warning"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(M,{variant:"primary",size:l?"md":"sm",icon:s.jsx(te,{className:"size-3.5"}),onClick:I(a),disabled:d||u,"aria-describedby":b.settled?void 0:z,className:c(l&&"min-h-11 flex-1",!b.settled&&"opacity-55"),children:m}),n&&s.jsx(M,{variant:"secondary",size:l?"md":"sm",icon:s.jsx(re,{className:"size-3.5"}),onClick:I(n),disabled:d,"aria-describedby":b.settled?void 0:z,className:c(l&&"min-h-11",!b.settled&&"opacity-55"),children:"Change first"})]})]})}function Be(e){return e.defaultCalendarId!==""?"ready":e.error!==null?"failed":e.isLoading?"loading":"none"}function Le(e,t){if(e!=="ready")return e==="loading"?"Reading your calendars…":e==="failed"?s.jsxs(s.Fragment,{children:["Couldn't read your calendars, so there is nowhere to add this yet. Reload to try again."," ",s.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]}):s.jsxs(s.Fragment,{children:["You have no calendar yet, so there is nowhere to add this."," ",s.jsx(se,{to:"/settings/calendars",className:"font-medium text-accent hover:underline",children:"Create a calendar"})]})}const fe=24,q=7,ue=52,w=ue*7,pe=e=>({from:x(e,-10),to:x(e,fe),floor:x(e,-w),ceiling:x(e,w)}),xe=e=>e.from<=e.floor,he=e=>e.to>=e.ceiling,be=(e,t)=>e>t?e:t,ye=(e,t)=>e<t?e:t,ve=e=>xe(e)?e:{...e,from:be(x(e.from,-q),e.floor)},Ne=e=>he(e)?e:{...e,to:ye(x(e.to,q),e.ceiling)},Ue=e=>ve({...e,floor:x(e.from,-w)}),qe=e=>Ne({...e,ceiling:x(e.to,w)});function Pe(e,t){return t>=e.from&&t<=e.to?e:pe(t)}function We(e){const t=new Map;for(const a of e){const n=Z("week",a);t.has(n.from)||t.set(n.from,n)}return[...t.values()]}const He=e=>Z("week",e).from,je=1440,_=e=>e.getHours()*60+e.getMinutes();function P(e,t){const a=new Set(e),n=new Map;for(const i of t){const r=new Date(i.start),d=new Date(i.end);if(Number.isNaN(r.getTime())||Number.isNaN(d.getTime())||d.getTime()<=r.getTime())continue;const u=k(r),h=k(new Date(d.getTime()-1));for(let o=u;o<=h;o=x(o,1)){if(!a.has(o))continue;const m=o===u?_(r):0,l=k(d)===o?_(d):je;if(l<=m)continue;const p=n.get(o);p?p.push({from:m,to:l}):n.set(o,[{from:m,to:l}])}}for(const[i,r]of n)n.set(i,V(r));return n}function Ge(e,t){const a=P(e,t);return new Map(e.map(n=>[n,$(n,a.get(n)??[])]))}const Ye=e=>ee(e.from,e.to),j=30,ke=6,W={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},we="The invitation's time zone could not be resolved. Add opens the editor so you can set the time.",ze="The invitation's time zone could not be resolved.";function Ke(e){return e.method==="Cancel"?e.state==="Pending"?{state:"cancelled",rsvp:"noReply"}:void 0:e.state==="Dismissed"?{state:"dismissed",rsvp:"noReply"}:e.state==="Superseded"?{state:"superseded",rsvp:"noReply"}:e.state==="Accepted"?{state:"answered",rsvp:"accepted"}:e.state==="Declined"?{state:"answered",rsvp:"declined"}:e.state==="Tentative"?{state:"answered",rsvp:"tentative"}:{state:"pending",rsvp:"noReply"}}const Ce=e=>e.source!=="TextHeuristic";function Xe(e){return e.allDay?e.dtStart.slice(0,10):k(new Date(e.dtStart))}const H=e=>e.summary===""?"Untitled event":e.summary;function Je(e){if(e.allDay){const t=e.dtStart.slice(0,10),a=e.dtEnd.slice(0,10),n=a>t?x(a,-1):t;return n===t?`${g(t)}, all day`:`${g(t)} – ${g(n)}, all day`}return ae({start:e.dtStart,end:e.dtEnd,allDay:e.allDay})}function Se(e,t){return{id:e.suggestionId,calendarId:t.calendarId,title:H(e),start:e.dtStart,end:e.dtEnd,allDay:e.allDay,location:e.location,notes:"",attendees:[],myRsvp:"noReply",threadId:t.threadId,threadSubject:t.threadSubject,timeZone:"",zoneCertainty:W[e.zoneCertainty],recurrenceRule:"",seriesId:"",seriesException:!1,status:"confirmed"}}function Qe(e,t,a){const n=e.organizer===""?a.senderName:e.organizer;return{id:e.suggestionId,threadId:a.threadId,proposed:Se(e,a),organizerName:n===""?"The sender":n,organizerEmail:e.organizer,method:"ics",evidence:"",state:t,sequence:e.sequence}}function ge(e){return e.zoneCertainty!=="Ambiguous"?"":e.method==="Cancel"?ze:we}function Ve(e,t){return{id:e.suggestionId,title:H(e),start:e.dtStart,end:e.dtEnd,allDay:e.allDay,location:e.location,threadId:t.threadId,threadSubject:t.threadSubject,sender:t.sender,senderAddress:e.organizer,confidence:Ce(e)?1:.6,ambiguity:ge(e),suggestedCalendarId:t.calendarId,timeZone:"",zoneCertainty:W[e.zoneCertainty]}}const De=(e,t)=>Date.parse(t.start)<Date.parse(e.end)&&Date.parse(t.end)>Date.parse(e.start);function et(e,t){return t.filter(a=>De(e,a)).map(a=>({id:`${a.start}/${a.end}`,label:`Busy ${A(a.start)} – ${A(a.end)}`}))}function tt(e,t){const a=P([e],t).get(e)??[],n=[];for(const i of $(e,a,j))for(let r=i.startMinute;r+j<=i.endMinute&&n.length<ke;r+=j)n.push({date:e,endDate:e,startTime:T(r),endTime:T(r+j),allDay:!1});return n}function st(e,t,a){const n=t.filter(i=>a.includes(i.startTime)).map(i=>`${R(i.startTime)} – ${R(i.endTime)}`);return`${ne(e)}: ${n.join(", ")}`}export{le as B,Fe as C,$e as E,oe as a,Pe as b,ie as c,Ye as d,He as e,Ge as f,ve as g,Ne as h,qe as i,he as j,xe as k,Ue as l,Ze as m,Le as n,Be as o,Xe as p,Ce as q,pe as r,Je as s,Ve as t,Ke as u,et as v,We as w,Qe as x,tt as y,st as z};
1
+ import{b as F,p as c,j as s,S as Y,r as S,X as K,ag as X,B as M,ck as k,f3 as x,f4 as Z}from"./index-fsuIswbe.js";import{d as J}from"./useCalendarSuggestions-DXbA0boT.js";import{R as Q,n as V,o as ee,p as $,d as T}from"./agenda-time-D0yU-H44.js";import{M as D}from"./mail-BzFJWQZy.js";import{P as te}from"./plus-D5-2sA5v.js";import{N as se}from"./nav-link-ed0mFCCx.js";import"./reply-CXuSMyqp.js";import{a as A,c as g,f as ae,d as R,b as ne}from"./calendar-format-BwCpz-JZ.js";const B={name:"globe",size:24,node:[["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"}]]};B.node;const L=F(B);const U={name:"sliders-horizontal",size:24,node:[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]};U.node;const re=F(U);function ie(e){const t=J(e.color),a=e.rsvp==="tentative"||e.status==="tentative";return c("flex min-w-0 overflow-hidden rounded-sm border-l-2 px-1.5 py-0.5",t.soft,t.text,t.rail,e.layout==="column"||e.stacked?"flex-col":"items-center gap-1.5",a&&"border-y border-r border-dashed",a&&t.border,e.rsvp==="declined"&&"opacity-60",e.selected&&"ring-2 ring-ring",e.density==="compact"?"text-2xs":"text-xs")}function oe({title:e,timeText:t,layout:a,rsvp:n,hasThread:i,isRecurring:r,zoneCertainty:d,trailing:u,detail:h}){const o=a==="column",m=d==="ambiguous",l=!o&&h!==void 0,p=s.jsxs("span",{className:c("flex min-w-0 items-center gap-1",o&&"w-full",n==="declined"&&"line-through"),children:[t!==""&&s.jsx("span",{className:"shrink-0 tabular-nums opacity-80",children:t}),s.jsx("span",{className:"truncate font-medium",children:e})]}),v=(r||i||m)&&s.jsxs("span",{className:c("flex shrink-0 items-center gap-1",o&&"mt-0.5",!o&&u===void 0&&"ml-auto"),children:[r&&s.jsx(Q,{className:"size-2.5","aria-label":"Repeats"}),i&&s.jsx(D,{className:"size-2.5","aria-label":"From mail"}),m&&s.jsx(L,{className:"size-2.5 text-warning","aria-label":"Unclear zone"})]}),y=u!==void 0&&s.jsx("span",{className:c("shrink-0 opacity-80",!o&&"ml-auto"),children:u});return s.jsxs(s.Fragment,{children:[l?s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[p,v,y]}):s.jsxs(s.Fragment,{children:[p,v,y]}),h]})}function Fe({title:e,timeText:t,color:a,layout:n,density:i,rsvp:r,status:d,hasThread:u,isRecurring:h,zoneCertainty:o,selected:m,onClick:l,leading:p,trailing:v,detail:y}){const N=n==="column";return s.jsxs("button",{type:"button",onClick:l,"aria-pressed":m,className:c("group flex w-full min-w-0 text-left outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",N?"h-full":"items-start",p!==void 0&&"gap-2"),children:[p,s.jsx("span",{className:c(ie({color:a,layout:n,density:i,rsvp:r,status:d,selected:m,stacked:y!==void 0}),"flex-1",N&&"h-full"),children:s.jsx(oe,{title:e,timeText:t,layout:n,rsvp:r,hasThread:u,isRecurring:h,zoneCertainty:o,trailing:v,detail:y})})]})}function le({id:e,reason:t,nudged:a,className:n}){return s.jsxs(s.Fragment,{children:[s.jsx("p",{id:e,className:c(n,!a&&"sr-only"),children:t}),s.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:a?t:""})]})}function Ze({items:e,className:t}){return e.length===0?s.jsxs("div",{className:c("flex flex-col items-center gap-2 p-6 text-center",t),children:[s.jsx(Y,{className:"size-6 text-fg-subtle","aria-hidden":!0}),s.jsx("p",{className:"text-sm text-fg-muted",children:"Nothing in your mail is waiting on a decision about time."})]}):s.jsx("ul",{"aria-label":"Suggested events",className:c("flex min-h-0 flex-col gap-3 overflow-y-auto",t),children:e.map(a=>s.jsx("li",{children:a.card},a.id))})}const ce="Pick a clock first. The mail never said, and the reader will not choose for you.";function de(e,t){const a=e.zoneOptions;return a===void 0?{settled:!0,timeZone:""}:a.some(n=>n.timeZone===t)?{settled:!0,timeZone:t}:{settled:!1,reason:ce}}function O(e){return e.threadSubject===""?e.sender:`${e.sender} — ${e.threadSubject}`}function me(e){return e>=.85?"Read cleanly":e>=.6?"Read with gaps":"Barely read"}function $e({suggestion:e,whenText:t,onAdd:a,onReview:n,onDismiss:i,onOpenThread:r,busy:d=!1,addBlocked:u=!1,zoneChoice:h,onZoneChoice:o,addLabel:m="Add",touch:l,className:p}){const[v,y]=S.useState(""),[N,E]=S.useState(!1),z=S.useId(),C=h??v,G=f=>{E(!1),o?o(f):y(f)},b=de(e,C),I=f=>()=>{if(!b.settled){E(!0);return}f(b.timeZone)};return s.jsxs("article",{"aria-label":e.title,className:c("flex flex-col gap-2 rounded-lg border border-dashed border-line-strong bg-surface-sunken p-3",p),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"block text-2xs uppercase tracking-wider text-fg-subtle",children:["Suggested from mail · ",me(e.confidence)]}),s.jsx("span",{className:"block truncate text-sm font-medium text-fg",children:e.title}),s.jsx("span",{className:"block text-xs text-fg-muted",children:t}),e.location!==""&&s.jsx("span",{className:"block truncate text-xs text-fg-muted",children:e.location})]}),s.jsx("button",{type:"button","aria-label":"Dismiss suggestion",onClick:i,disabled:d,className:c("flex shrink-0 items-center justify-center rounded-md text-fg-subtle outline-none hover:bg-surface hover:text-fg focus-visible:ring-2 focus-visible:ring-ring",l?"size-11":"size-7"),children:s.jsx(K,{className:"size-4"})})]}),e.ambiguity!==""&&s.jsxs("p",{className:"flex items-start gap-1.5 text-2xs text-warning",children:[s.jsx(X,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),e.ambiguity]}),r?s.jsxs("button",{type:"button",onClick:r,className:"flex w-full min-w-0 items-center gap-1.5 rounded-sm text-left text-2xs text-accent-2 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx(D,{className:"size-3 shrink-0"}),s.jsx("span",{className:"truncate",children:O(e)})]}):s.jsxs("p",{className:"flex w-full min-w-0 items-center gap-1.5 text-2xs text-fg-subtle",children:[s.jsx(D,{className:"size-3 shrink-0"}),s.jsx("span",{className:"truncate",children:O(e)})]}),e.zoneOptions&&s.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md border border-warning/40 p-2",children:[s.jsxs("p",{className:"flex items-center gap-1.5 text-2xs font-semibold text-warning",children:[s.jsx(L,{className:"size-3 shrink-0","aria-hidden":!0}),"Which clock is this on?"]}),e.zoneOptions.map(f=>s.jsxs("button",{type:"button","aria-pressed":C===f.timeZone,onClick:()=>G(f.timeZone),className:c("rounded-md border px-2 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",l&&"min-h-11",C===f.timeZone?"border-accent bg-accent-soft":"border-line bg-surface hover:border-line-strong"),children:[s.jsx("span",{className:"block text-xs font-medium text-fg",children:f.label}),s.jsx("span",{className:"block text-2xs text-fg-subtle",children:f.note})]},f.timeZone))]}),!b.settled&&s.jsx(le,{id:z,reason:b.reason,nudged:N,className:"text-2xs text-warning"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(M,{variant:"primary",size:l?"md":"sm",icon:s.jsx(te,{className:"size-3.5"}),onClick:I(a),disabled:d||u,"aria-describedby":b.settled?void 0:z,className:c(l&&"min-h-11 flex-1",!b.settled&&"opacity-55"),children:m}),n&&s.jsx(M,{variant:"secondary",size:l?"md":"sm",icon:s.jsx(re,{className:"size-3.5"}),onClick:I(n),disabled:d,"aria-describedby":b.settled?void 0:z,className:c(l&&"min-h-11",!b.settled&&"opacity-55"),children:"Change first"})]})]})}function Be(e){return e.defaultCalendarId!==""?"ready":e.error!==null?"failed":e.isLoading?"loading":"none"}function Le(e,t){if(e!=="ready")return e==="loading"?"Reading your calendars…":e==="failed"?s.jsxs(s.Fragment,{children:["Couldn't read your calendars, so there is nowhere to add this yet. Reload to try again."," ",s.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]}):s.jsxs(s.Fragment,{children:["You have no calendar yet, so there is nowhere to add this."," ",s.jsx(se,{to:"/settings/calendars",className:"font-medium text-accent hover:underline",children:"Create a calendar"})]})}const fe=24,q=7,ue=52,w=ue*7,pe=e=>({from:x(e,-10),to:x(e,fe),floor:x(e,-w),ceiling:x(e,w)}),xe=e=>e.from<=e.floor,he=e=>e.to>=e.ceiling,be=(e,t)=>e>t?e:t,ye=(e,t)=>e<t?e:t,ve=e=>xe(e)?e:{...e,from:be(x(e.from,-q),e.floor)},Ne=e=>he(e)?e:{...e,to:ye(x(e.to,q),e.ceiling)},Ue=e=>ve({...e,floor:x(e.from,-w)}),qe=e=>Ne({...e,ceiling:x(e.to,w)});function Pe(e,t){return t>=e.from&&t<=e.to?e:pe(t)}function We(e){const t=new Map;for(const a of e){const n=Z("week",a);t.has(n.from)||t.set(n.from,n)}return[...t.values()]}const He=e=>Z("week",e).from,je=1440,_=e=>e.getHours()*60+e.getMinutes();function P(e,t){const a=new Set(e),n=new Map;for(const i of t){const r=new Date(i.start),d=new Date(i.end);if(Number.isNaN(r.getTime())||Number.isNaN(d.getTime())||d.getTime()<=r.getTime())continue;const u=k(r),h=k(new Date(d.getTime()-1));for(let o=u;o<=h;o=x(o,1)){if(!a.has(o))continue;const m=o===u?_(r):0,l=k(d)===o?_(d):je;if(l<=m)continue;const p=n.get(o);p?p.push({from:m,to:l}):n.set(o,[{from:m,to:l}])}}for(const[i,r]of n)n.set(i,V(r));return n}function Ge(e,t){const a=P(e,t);return new Map(e.map(n=>[n,$(n,a.get(n)??[])]))}const Ye=e=>ee(e.from,e.to),j=30,ke=6,W={Local:"local",Explicit:"explicit",Ambiguous:"ambiguous"},we="The invitation's time zone could not be resolved. Add opens the editor so you can set the time.",ze="The invitation's time zone could not be resolved.";function Ke(e){return e.method==="Cancel"?e.state==="Pending"?{state:"cancelled",rsvp:"noReply"}:void 0:e.state==="Dismissed"?{state:"dismissed",rsvp:"noReply"}:e.state==="Superseded"?{state:"superseded",rsvp:"noReply"}:e.state==="Accepted"?{state:"answered",rsvp:"accepted"}:e.state==="Declined"?{state:"answered",rsvp:"declined"}:e.state==="Tentative"?{state:"answered",rsvp:"tentative"}:{state:"pending",rsvp:"noReply"}}const Ce=e=>e.source!=="TextHeuristic";function Xe(e){return e.allDay?e.dtStart.slice(0,10):k(new Date(e.dtStart))}const H=e=>e.summary===""?"Untitled event":e.summary;function Je(e){if(e.allDay){const t=e.dtStart.slice(0,10),a=e.dtEnd.slice(0,10),n=a>t?x(a,-1):t;return n===t?`${g(t)}, all day`:`${g(t)} – ${g(n)}, all day`}return ae({start:e.dtStart,end:e.dtEnd,allDay:e.allDay})}function Se(e,t){return{id:e.suggestionId,calendarId:t.calendarId,title:H(e),start:e.dtStart,end:e.dtEnd,allDay:e.allDay,location:e.location,notes:"",attendees:[],myRsvp:"noReply",threadId:t.threadId,threadSubject:t.threadSubject,timeZone:"",zoneCertainty:W[e.zoneCertainty],recurrenceRule:"",seriesId:"",seriesException:!1,status:"confirmed"}}function Qe(e,t,a){const n=e.organizer===""?a.senderName:e.organizer;return{id:e.suggestionId,threadId:a.threadId,proposed:Se(e,a),organizerName:n===""?"The sender":n,organizerEmail:e.organizer,method:"ics",evidence:"",state:t,sequence:e.sequence}}function ge(e){return e.zoneCertainty!=="Ambiguous"?"":e.method==="Cancel"?ze:we}function Ve(e,t){return{id:e.suggestionId,title:H(e),start:e.dtStart,end:e.dtEnd,allDay:e.allDay,location:e.location,threadId:t.threadId,threadSubject:t.threadSubject,sender:t.sender,senderAddress:e.organizer,confidence:Ce(e)?1:.6,ambiguity:ge(e),suggestedCalendarId:t.calendarId,timeZone:"",zoneCertainty:W[e.zoneCertainty]}}const De=(e,t)=>Date.parse(t.start)<Date.parse(e.end)&&Date.parse(t.end)>Date.parse(e.start);function et(e,t){return t.filter(a=>De(e,a)).map(a=>({id:`${a.start}/${a.end}`,label:`Busy ${A(a.start)} – ${A(a.end)}`}))}function tt(e,t){const a=P([e],t).get(e)??[],n=[];for(const i of $(e,a,j))for(let r=i.startMinute;r+j<=i.endMinute&&n.length<ke;r+=j)n.push({date:e,endDate:e,startTime:T(r),endTime:T(r+j),allDay:!1});return n}function st(e,t,a){const n=t.filter(i=>a.includes(i.startTime)).map(i=>`${R(i.startTime)} – ${R(i.endTime)}`);return`${ne(e)}: ${n.join(", ")}`}export{le as B,Fe as C,$e as E,oe as a,Pe as b,ie as c,Ye as d,He as e,Ge as f,ve as g,Ne as h,qe as i,he as j,xe as k,Ue as l,Ze as m,Le as n,Be as o,Xe as p,Ce as q,pe as r,Je as s,Ve as t,Ke as u,et as v,We as w,Qe as x,tt as y,st as z};
@@ -1 +1 @@
1
- import{b as N,j as e,r as i,ar as C,d as j,B as v,T as A,e as P,aW as K,a as W,aX as X,f as S,aB as E,aY as Y,aZ as J,a_ as q,s as O,a$ as F,at as ee,b0 as se,b1 as ae,b2 as te,u as ne,af as re}from"./index-yeSesYv-.js";import{U as k,c as ie,u as $,a as de,b as oe}from"./useCalendarSuggestions-D_tk6nh4.js";import{S as le}from"./select-B9t8348S.js";import{C as T,a as z,b as D,c as M}from"./card-0Dzt3Scs.js";import{P as ce}from"./plus-D9A6i0pi.js";import{u as me}from"./useCalendarScheduling-Dfk1b293.js";import{C as ue}from"./calendar-guests-DeRthr7k.js";import{f as w,E as he}from"./ErrorState-Bk3DwNvd.js";import{C as _}from"./confirm-dialog-Cc446-7C.js";import{B as U}from"./badge-CeCxCmzS.js";import{R as pe}from"./refresh-cw-BRmmCn_2.js";import{C as xe}from"./copy-jXKvwaUz.js";import{a as fe}from"./sections-uFHlOXiA.js";import{S as be}from"./settings-screen-CafoSGzb.js";import"./useQueries-Dj93detX.js";import"./chevron-down-BnC2m4J6.js";import"./useDebouncedValue-AWe2Zncy.js";import"./calendar-event-popup-y4Z860B0.js";import"./pencil-A679n1yJ.js";import"./circle-question-mark-CpApZe3H.js";import"./avatar-B_QEsxCw.js";import"./chevron-left-CNQ3caMn.js";import"./menu-Cn2tY52U.js";const L={name:"calendar-plus",size:24,node:[["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M19 15v6",key:"10aioa"}],["path",{d:"M21 11.5V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h8.3",key:"jgwkxf"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 2v3",key:"1ioesn"}]]};L.node;const ge=N(L);const H={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]};H.node;const ve=N(H);const B={name:"pause",size:24,node:[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]};B.node;const je=N(B);const G={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};G.node;const ye=N(G);const Z={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};Z.node;const Ce=N(Z),Ne=s=>({title:`Delete ${s}?`,description:`This removes ${s} and every event in it, and any subscription address stops working. It cannot be undone.`}),Se=s=>s.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64),I=Intl.supportedValuesOf("timeZone");function Q({id:s,value:n,disabled:t,onChange:a}){const r=n===k||I.includes(n)?I:[n,...I];return e.jsxs(le,{id:s,value:n,disabled:t,onChange:d=>a(d.target.value),children:[e.jsx("option",{value:k,children:"None (read as UTC)"}),r.map(d=>e.jsx("option",{value:d,children:d},d))]})}function ke({isBusy:s,problem:n,onCreate:t}){const[a,r]=i.useState(""),[d,l]=i.useState(void 0),[h,c]=i.useState(k),o=i.useId(),m=i.useId(),f=i.useId(),x=i.useId(),b=d??Se(a),u=a.trim()!==""&&b.trim()!=="";return e.jsxs(T,{className:"max-w-xl",role:"region","aria-labelledby":o,children:[e.jsx(z,{children:e.jsx(D,{id:o,children:"New calendar"})}),e.jsx(M,{children:e.jsxs("form",{className:"space-y-3",onSubmit:p=>{p.preventDefault(),u&&t({displayName:a.trim(),urlSegment:b.trim(),timezone:h}).then(g=>{g&&(r(""),l(void 0),c(k))})},children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:m,className:"text-xs font-medium text-fg-muted",children:"Name"}),e.jsx(C,{id:m,value:a,maxLength:140,disabled:s,onChange:p=>r(p.target.value)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:f,className:"text-xs font-medium text-fg-muted",children:"Address"}),e.jsx(C,{id:f,value:b,maxLength:64,disabled:s,onChange:p=>l(p.target.value)})]}),e.jsxs("div",{className:"space-y-1 sm:col-span-2",children:[e.jsx("label",{htmlFor:x,className:"text-xs font-medium text-fg-muted",children:"Time zone"}),e.jsx(Q,{id:x,value:h,disabled:s,onChange:c})]})]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"The address names the calendar for CalDAV clients and cannot be changed later. The name and zone can."}),n!==""&&e.jsxs(j,{tone:"danger",variant:"soft",children:[e.jsx("p",{className:"font-medium",children:"The calendar was not added."}),e.jsx("p",{className:"mt-0.5 break-words",children:n})]}),e.jsx(v,{type:"submit",variant:"primary",size:"sm",disabled:s||!u,icon:e.jsx(ce,{className:"size-3.5"}),children:s?"Adding…":"Add calendar"})]})})]})}function we(){const{senders:s,defaultSenderId:n,setDefaultSender:t}=me(),[a,r]=i.useState("");return s.length===0?null:e.jsxs("section",{"aria-labelledby":"calendar-default-sender",className:"space-y-2 rounded-sm border border-line bg-surface p-4",children:[e.jsx("h2",{id:"calendar-default-sender",className:"text-sm font-semibold",children:"Invitations: default sender"}),e.jsx("p",{className:"text-sm text-fg-muted",children:"Invitations, updates and cancellations go out from this account unless you pick another on the event."}),e.jsx(ue,{label:"Default sender",senders:s,value:n??"",onChange:d=>{r(""),t(d).catch(l=>r(w(l)))}}),a!==""&&e.jsxs("p",{role:"alert",className:"text-sm text-danger",children:["Couldn't save the default sender: ",a," ",e.jsx("a",{href:ie(a),target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]})]})}function Ie({calendarName:s,timezone:n,isBusy:t,problem:a,onSave:r,onDelete:d}){const[l,h]=i.useState(s),[c,o]=i.useState(n),[m,f]=i.useState(!1),x=i.useId(),b=i.useId(),u=l.trim(),p=u!==s||c!==n,g=Ne(s);return e.jsxs(e.Fragment,{children:[e.jsxs("form",{className:"space-y-3",onSubmit:y=>{y.preventDefault(),!(!p||u==="")&&r({displayName:u,timezone:c})},children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:x,className:"text-xs font-medium text-fg-muted",children:"Name"}),e.jsx(C,{id:x,value:l,maxLength:140,disabled:t,onChange:y=>h(y.target.value)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:b,className:"text-xs font-medium text-fg-muted",children:"Time zone"}),e.jsx(Q,{id:b,value:c,disabled:t,onChange:o})]})]}),a!==""&&e.jsxs(j,{tone:"danger",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:[s," was not changed."]}),e.jsx("p",{className:"mt-0.5 break-words",children:a})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(v,{type:"submit",variant:"secondary",size:"sm",disabled:t||!p||u==="",icon:e.jsx(Ce,{className:"size-3.5"}),children:"Save changes"}),e.jsx(v,{type:"button",variant:"danger",size:"sm",disabled:t,icon:e.jsx(A,{className:"size-3.5"}),onClick:()=>f(!0),children:"Delete calendar"})]})]}),e.jsx(_,{isOpen:m,title:g.title,description:g.description,confirmLabel:"Delete calendar",destructive:!0,onConfirm:()=>{f(!1),d()},onCancel:()=>f(!1)})]})}const Fe="/feeds/calendar/",Te=".ics",ze=(s,n)=>`webcal://${s}${Fe}${n}${Te}`;function De(s){const n=P(),[t,a]=i.useState(""),r=K({path:{calendarId:s}}),d=W({...X({path:{calendarId:s}}),meta:O(404,403),retry:!1}),l=()=>{n.invalidateQueries({queryKey:r})},h=i.useRef(()=>{}),c=S({...Y(),meta:E,onMutate:()=>{h.current()},onSuccess:()=>{a(""),l()}}),o=S({...J(),meta:E,gcTime:0,onMutate:()=>{c.reset()},onSuccess:V=>{a(ze(window.location.host,V.feedToken)),l()}});h.current=o.reset;const{mutate:m,reset:f}=o,{mutate:x}=c,b=i.useCallback(()=>{m({path:{calendarId:s}})},[s,m]),u=i.useCallback(()=>{x({path:{calendarId:s}})},[s,x]),p=i.useCallback(()=>{a(""),f()},[f]),{refetch:g}=d,y=i.useCallback(()=>{g()},[g]);return{state:Me(d),mintedUrl:t,isBusy:o.isPending||c.isPending,actionError:o.error??c.error,mint:b,revoke:u,dismissMinted:p,retry:y}}function Me(s){return s.error?q(s.error)?{status:"absent"}:{status:"unreadable",error:s.error}:s.isPending?{status:"loading"}:s.data?{status:"active",createdAt:s.data.createdAt,rotatedAt:s.data.rotatedAt}:{status:"absent"}}const Ee=s=>({title:`Replace the address for ${s}?`,description:"Every client already subscribed to the current address stops updating and has to be pointed at the new one. The new address is shown once."}),Re=s=>({title:`Stop sharing ${s}?`,description:"The address stops working immediately and every client subscribed to it stops updating. Sharing again mints a different address."});function Ae({calendarName:s,url:n,onDismiss:t}){const[a,r]=i.useState(!1),[d,l]=i.useState(!1),h=i.useRef(0);i.useEffect(()=>()=>window.clearTimeout(h.current),[]);const c=()=>{navigator.clipboard.writeText(n).then(()=>{l(!1),r(!0),h.current=window.setTimeout(()=>r(!1),2e3)}).catch(()=>l(!0))};return e.jsxs("div",{className:"mt-3 space-y-2 rounded-sm border border-accent-2/40 bg-accent-2/10 px-3 py-2.5",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"Subscribe with this address. It is shown once and cannot be read back."}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx("input",{readOnly:!0,value:n,"aria-label":`Subscription address for ${s}`,onFocus:o=>o.currentTarget.select(),className:"min-w-0 flex-1 rounded-sm border border-line bg-surface px-2 py-1.5 font-mono text-xs text-fg"}),e.jsx(v,{variant:"primary",size:"sm",icon:a?e.jsx(ee,{className:"size-3.5"}):e.jsx(xe,{className:"size-3.5"}),onClick:c,children:a?"Copied":"Copy address"})]}),d&&e.jsx(j,{tone:"warning",variant:"soft",children:"The address could not be copied to the clipboard. Select it above and copy it by hand before leaving this page."}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Anyone holding this address can read every event in this calendar, without signing in. Rotate it if it reaches the wrong person."}),e.jsx(v,{variant:"ghost",size:"sm",onClick:t,children:"I've saved it"})]})}function Pe({createdAt:s,rotatedAt:n,isBusy:t,onRotate:a,onRevoke:r}){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(U,{tone:"positive",children:"shared"}),e.jsxs("span",{className:"text-xs text-fg-muted",children:["Address created ",F(s,"medium"),n>0?`, last replaced ${F(n,"medium")}`:""]})]}),e.jsx("p",{className:"text-sm text-fg-muted",children:"The address itself is not stored in readable form, so it cannot be shown again. Replace it if you no longer know where it went."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(v,{variant:"secondary",size:"sm",disabled:t,icon:e.jsx(pe,{className:"size-3.5"}),onClick:a,children:"Replace address"}),e.jsx(v,{variant:"danger",size:"sm",disabled:t,icon:e.jsx(A,{className:"size-3.5"}),onClick:r,children:"Stop sharing"})]})]})}function Oe({calendarName:s,details:n,state:t,mintedUrl:a,isBusy:r,actionError:d,onMint:l,onRevoke:h,onDismissMinted:c,onRetry:o}){const[m,f]=i.useState("none"),x=i.useId(),b=()=>{const p=m;f("none"),p==="rotate"&&l(),p==="revoke"&&h()},u=m==="revoke"?Re(s):Ee(s);return e.jsxs(T,{className:"max-w-xl",role:"region","aria-labelledby":x,children:[e.jsx(z,{children:e.jsx(D,{id:x,children:s})}),e.jsxs(M,{children:[n&&e.jsx("div",{className:"mb-4 border-b border-line pb-4",children:n}),t.status==="loading"&&a===""&&e.jsx("div",{className:"h-12 animate-pulse rounded-sm bg-surface-sunken","aria-busy":"true","aria-label":`Loading the subscription address for ${s}`}),t.status==="unreadable"&&a===""&&e.jsx(he,{variant:"inline",title:`Couldn't read whether ${s} is shared`,error:t.error,onRetry:o}),t.status==="absent"&&a===""&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:"Give this calendar a secret address and Apple Calendar, Google Calendar, Outlook and Thunderbird can subscribe to it read-only. Nobody signs in — the address is the credential, so treat it like a password."}),e.jsx(v,{variant:"primary",size:"sm",disabled:r,icon:e.jsx(ve,{className:"size-3.5"}),onClick:l,children:r?"Creating…":"Create subscription address"})]}),t.status==="active"&&e.jsx(Pe,{createdAt:t.createdAt,rotatedAt:t.rotatedAt,isBusy:r,onRotate:()=>f("rotate"),onRevoke:()=>f("revoke")}),d!=null&&e.jsxs(j,{tone:"danger",variant:"soft",className:"mt-3",children:[e.jsxs("p",{className:"font-medium",children:["The subscription address for ",s," was not changed."]}),e.jsx("p",{className:"mt-0.5 break-words",children:w(d)})]}),a!==""&&e.jsx(Ae,{calendarName:s,url:a,onDismiss:c})]}),e.jsx(_,{isOpen:m!=="none",title:u.title,description:u.description,confirmLabel:m==="revoke"?"Stop sharing":"Replace address",destructive:!0,onConfirm:b,onCancel:()=>f("none")})]})}function $e({calendarId:s,calendarName:n,details:t}){const a=De(s);return e.jsx(Oe,{calendarName:n,details:t,state:a.state,mintedUrl:a.mintedUrl,isBusy:a.isBusy,actionError:a.actionError,onMint:a.mint,onRevoke:a.revoke,onDismissMinted:a.dismissMinted,onRetry:a.retry})}function _e({calendarId:s,calendarName:n,timezone:t,subscription:a}){const{updateCalendar:r,deleteCalendar:d,isWriting:l}=$(),[h,c]=i.useState(""),o=m=>c(m.kind==="refused"?m.message:"");return e.jsx($e,{calendarId:s,calendarName:n,details:e.jsxs(e.Fragment,{children:[a,e.jsx(Ie,{calendarName:n,timezone:t,isBusy:l,problem:h,onSave:m=>{c(""),r(s,m).then(o)},onDelete:()=>{c(""),d(s).then(o)}},`${n}\0${t}`)]})})}const Ue="Subscribe to a calendar";function Le({isBusy:s,error:n,onSubscribe:t}){const a=i.useId(),r=i.useId(),d=i.useId(),[l,h]=i.useState(""),[c,o]=i.useState(""),m=l.trim()!==""&&c.trim()!=="",f=x=>{x.preventDefault(),m&&t({displayName:l,url:c},()=>{h(""),o("")})};return e.jsxs(T,{className:"max-w-xl",role:"region","aria-labelledby":a,children:[e.jsx(z,{children:e.jsx(D,{id:a,children:Ue})}),e.jsx(M,{children:e.jsxs("form",{className:"space-y-3",onSubmit:f,children:[e.jsx("p",{className:"text-sm text-fg-muted",children:"Paste the secret iCal address from Google Calendar, a published Outlook calendar or any other feed. It shows here read-only and refreshes on its own."}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:r,className:"text-sm font-medium text-fg",children:"Calendar name"}),e.jsx(C,{id:r,value:l,onChange:x=>h(x.target.value),placeholder:"Team rota",autoComplete:"off"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:d,className:"text-sm font-medium text-fg",children:"Calendar address"}),e.jsx(C,{id:d,value:c,onChange:x=>o(x.target.value),placeholder:"https://calendar.google.com/calendar/ical/…/basic.ics",autoComplete:"off",spellCheck:!1,inputMode:"url"}),e.jsx("p",{className:"text-xs text-fg-muted",children:"For Google Calendar the address is the password to the calendar. Reader never shows it in full again."})]}),e.jsx(v,{type:"submit",variant:"primary",size:"sm",disabled:!m||s,icon:e.jsx(ge,{className:"size-3.5"}),children:s?"Subscribing…":"Subscribe"}),n!=null&&e.jsxs(j,{tone:"danger",variant:"soft",children:[e.jsx("p",{className:"font-medium",children:"The calendar was not added."}),e.jsx("p",{className:"mt-0.5 break-words",children:w(n)})]})]})})]})}const He=s=>URL.canParse(s)?new URL(s).host:"an iCalendar feed";function Be({calendarName:s,subscriptionUrl:n,enabled:t,fetchedAt:a,error:r,isBusy:d,actionError:l,onSetEnabled:h}){return e.jsxs("div",{className:"mb-4 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(U,{tone:t?"positive":"neutral",children:t?"subscribed":"paused"}),e.jsxs("span",{className:"text-xs text-fg-muted",children:["Read-only, from ",He(n),a>0?`. Last updated ${F(a,"medium")}`:""]})]}),r!==""&&e.jsxs(j,{tone:"warning",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:[s," was not refreshed."]}),e.jsx("p",{className:"mt-0.5 break-words",children:r})]}),e.jsx("p",{className:"text-sm text-fg-muted",children:t?"Events are read from the feed on a schedule and cannot be edited here.":"Updates are paused. The events already here stay until you resume or remove the calendar."}),e.jsx(v,{variant:"secondary",size:"sm",disabled:d,icon:t?e.jsx(je,{className:"size-3.5"}):e.jsx(ye,{className:"size-3.5"}),onClick:()=>h(!t),children:t?"Pause updates":"Resume updates"}),l!=null&&e.jsxs(j,{tone:"danger",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:["Updates for ",s," were not changed."]}),e.jsx("p",{className:"mt-0.5 break-words",children:w(l)})]})]})}const R=O(400,404),Ge=()=>`subscribed-${crypto.randomUUID().slice(0,8)}`;function Ze(){const s=P(),n=de(),t=()=>{s.invalidateQueries({queryKey:te()}),n()},a=S({...se(),meta:R,onSuccess:t}),r=S({...ae(),meta:R,onSuccess:t}),{mutate:d}=a,l=i.useCallback((o,m)=>{d({body:{urlSegment:Ge(),displayName:o.displayName.trim(),subscriptionUrl:o.url.trim()}},{onSuccess:m})},[d]),{mutate:h}=r,c=i.useCallback((o,m)=>{h({path:{calendarId:o},body:{subscriptionEnabled:m}})},[h]);return{subscribe:l,isSubscribing:a.isPending,subscribeError:a.error,setEnabled:c,togglingCalendarId:r.isPending?r.variables?.path.calendarId??"":"",toggleFailure:{calendarId:r.variables?.path.calendarId??"",error:r.error}}}const Qe=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each calendar has a name, a time zone its floating times are read in, and an address CalDAV clients reach it by. The address is fixed when the calendar is added; the name and zone can change. Deleting a calendar deletes every event in it. The default calendar is where accepted invitations land, so it cannot be deleted."}),e.jsx("p",{children:"A subscription address lets Apple Calendar, Google Calendar, Outlook and Thunderbird show a calendar from here, read-only and kept up to date."}),e.jsx("p",{children:"Those clients never sign in, so the address itself is the credential. Anyone who has it can read the calendar; nobody who has it can change anything."}),e.jsx("p",{children:"Only a hash of the address is stored, so it is shown once and cannot be looked up later. Replacing it breaks every subscription built on the old one, which is how a shared address is taken back."}),e.jsx("p",{children:"Subscribing works the other way round: paste another calendar's iCal address and its events show here, read-only, refreshed on a schedule."})]});function fs(){const s=ne(),n=re(),t=fe(),[a,r]=i.useState(!0),{calendars:d,collections:l,timeZoneByCalendarId:h,isLoading:c}=oe(),o=Ze(),{createCalendar:m,isWriting:f}=$(),[x,b]=i.useState("");return e.jsx(be,{items:n,activeId:"calendars",title:"Calendars",description:"Add, rename and delete calendars, subscribe to a calendar feed, and share one with any client that can subscribe to a URL.",help:Qe,helpOpen:a,onToggleHelp:()=>r(u=>!u),onSelect:t,onBackToMail:()=>{s({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 calendars"}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(we,{}),d.map(u=>{const p=l.find(g=>g.calendarId===u.id);return e.jsx(_e,{calendarId:u.id,calendarName:u.name,timezone:h[u.id]??"",subscription:p?.source==="Subscribed"&&e.jsx(Be,{calendarName:p.displayName,subscriptionUrl:p.subscriptionUrl,enabled:p.subscriptionEnabled,fetchedAt:p.subscriptionFetchedAt,error:p.subscriptionError,isBusy:o.togglingCalendarId===u.id,actionError:o.toggleFailure.calendarId===u.id?o.toggleFailure.error:void 0,onSetEnabled:g=>o.setEnabled(u.id,g)})},u.id)}),e.jsx(Le,{isBusy:o.isSubscribing,error:o.subscribeError,onSubscribe:o.subscribe}),e.jsx(ke,{isBusy:f,problem:x,onCreate:u=>(b(""),m(u).then(p=>p.kind==="written"?!0:(b(p.message),!1)))})]})})}export{fs as component};
1
+ import{b as N,j as e,r as i,ar as C,d as j,B as v,T as A,e as P,aW as K,a as W,aX as X,f as S,aB as E,aY as Y,aZ as J,a_ as q,s as O,a$ as F,at as ee,b0 as se,b1 as ae,b2 as te,u as ne,af as re}from"./index-fsuIswbe.js";import{U as k,c as ie,u as $,a as de,b as oe}from"./useCalendarSuggestions-DXbA0boT.js";import{S as le}from"./select-TYdrgtW5.js";import{C as T,a as z,b as D,c as M}from"./card-CLJYKox8.js";import{P as ce}from"./plus-D5-2sA5v.js";import{u as me}from"./useCalendarScheduling-B_INtO-h.js";import{C as ue}from"./calendar-guests-Cay9Ub8h.js";import{f as w,E as he}from"./ErrorState-BTHOmsYP.js";import{C as _}from"./confirm-dialog-XvccFJdE.js";import{B as U}from"./badge-BB80tGxy.js";import{R as pe}from"./refresh-cw-Cu9_I3cT.js";import{C as xe}from"./copy-BokIobZ4.js";import{a as fe}from"./sections-DpRVKuXF.js";import{S as be}from"./settings-screen-DTYVWAkg.js";import"./useQueries-DPH-PeHV.js";import"./chevron-down-De4wQzka.js";import"./useDebouncedValue-CFZ4EPXW.js";import"./calendar-event-popup-Cr_LW8IP.js";import"./pencil-BDbmS56C.js";import"./circle-question-mark-DhNa_A16.js";import"./avatar-Bq7beWCy.js";import"./chevron-left-CUHU8UT9.js";import"./menu-Bh94jr77.js";const L={name:"calendar-plus",size:24,node:[["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M19 15v6",key:"10aioa"}],["path",{d:"M21 11.5V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h8.3",key:"jgwkxf"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 2v3",key:"1ioesn"}]]};L.node;const ge=N(L);const H={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]};H.node;const ve=N(H);const B={name:"pause",size:24,node:[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]};B.node;const je=N(B);const G={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};G.node;const ye=N(G);const Z={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};Z.node;const Ce=N(Z),Ne=s=>({title:`Delete ${s}?`,description:`This removes ${s} and every event in it, and any subscription address stops working. It cannot be undone.`}),Se=s=>s.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64),I=Intl.supportedValuesOf("timeZone");function Q({id:s,value:n,disabled:t,onChange:a}){const r=n===k||I.includes(n)?I:[n,...I];return e.jsxs(le,{id:s,value:n,disabled:t,onChange:d=>a(d.target.value),children:[e.jsx("option",{value:k,children:"None (read as UTC)"}),r.map(d=>e.jsx("option",{value:d,children:d},d))]})}function ke({isBusy:s,problem:n,onCreate:t}){const[a,r]=i.useState(""),[d,l]=i.useState(void 0),[h,c]=i.useState(k),o=i.useId(),m=i.useId(),f=i.useId(),x=i.useId(),b=d??Se(a),u=a.trim()!==""&&b.trim()!=="";return e.jsxs(T,{className:"max-w-xl",role:"region","aria-labelledby":o,children:[e.jsx(z,{children:e.jsx(D,{id:o,children:"New calendar"})}),e.jsx(M,{children:e.jsxs("form",{className:"space-y-3",onSubmit:p=>{p.preventDefault(),u&&t({displayName:a.trim(),urlSegment:b.trim(),timezone:h}).then(g=>{g&&(r(""),l(void 0),c(k))})},children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:m,className:"text-xs font-medium text-fg-muted",children:"Name"}),e.jsx(C,{id:m,value:a,maxLength:140,disabled:s,onChange:p=>r(p.target.value)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:f,className:"text-xs font-medium text-fg-muted",children:"Address"}),e.jsx(C,{id:f,value:b,maxLength:64,disabled:s,onChange:p=>l(p.target.value)})]}),e.jsxs("div",{className:"space-y-1 sm:col-span-2",children:[e.jsx("label",{htmlFor:x,className:"text-xs font-medium text-fg-muted",children:"Time zone"}),e.jsx(Q,{id:x,value:h,disabled:s,onChange:c})]})]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"The address names the calendar for CalDAV clients and cannot be changed later. The name and zone can."}),n!==""&&e.jsxs(j,{tone:"danger",variant:"soft",children:[e.jsx("p",{className:"font-medium",children:"The calendar was not added."}),e.jsx("p",{className:"mt-0.5 break-words",children:n})]}),e.jsx(v,{type:"submit",variant:"primary",size:"sm",disabled:s||!u,icon:e.jsx(ce,{className:"size-3.5"}),children:s?"Adding…":"Add calendar"})]})})]})}function we(){const{senders:s,defaultSenderId:n,setDefaultSender:t}=me(),[a,r]=i.useState("");return s.length===0?null:e.jsxs("section",{"aria-labelledby":"calendar-default-sender",className:"space-y-2 rounded-sm border border-line bg-surface p-4",children:[e.jsx("h2",{id:"calendar-default-sender",className:"text-sm font-semibold",children:"Invitations: default sender"}),e.jsx("p",{className:"text-sm text-fg-muted",children:"Invitations, updates and cancellations go out from this account unless you pick another on the event."}),e.jsx(ue,{label:"Default sender",senders:s,value:n??"",onChange:d=>{r(""),t(d).catch(l=>r(w(l)))}}),a!==""&&e.jsxs("p",{role:"alert",className:"text-sm text-danger",children:["Couldn't save the default sender: ",a," ",e.jsx("a",{href:ie(a),target:"_blank",rel:"noreferrer",className:"font-medium text-accent hover:underline",children:"Report an issue"})]})]})}function Ie({calendarName:s,timezone:n,isBusy:t,problem:a,onSave:r,onDelete:d}){const[l,h]=i.useState(s),[c,o]=i.useState(n),[m,f]=i.useState(!1),x=i.useId(),b=i.useId(),u=l.trim(),p=u!==s||c!==n,g=Ne(s);return e.jsxs(e.Fragment,{children:[e.jsxs("form",{className:"space-y-3",onSubmit:y=>{y.preventDefault(),!(!p||u==="")&&r({displayName:u,timezone:c})},children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:x,className:"text-xs font-medium text-fg-muted",children:"Name"}),e.jsx(C,{id:x,value:l,maxLength:140,disabled:t,onChange:y=>h(y.target.value)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:b,className:"text-xs font-medium text-fg-muted",children:"Time zone"}),e.jsx(Q,{id:b,value:c,disabled:t,onChange:o})]})]}),a!==""&&e.jsxs(j,{tone:"danger",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:[s," was not changed."]}),e.jsx("p",{className:"mt-0.5 break-words",children:a})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(v,{type:"submit",variant:"secondary",size:"sm",disabled:t||!p||u==="",icon:e.jsx(Ce,{className:"size-3.5"}),children:"Save changes"}),e.jsx(v,{type:"button",variant:"danger",size:"sm",disabled:t,icon:e.jsx(A,{className:"size-3.5"}),onClick:()=>f(!0),children:"Delete calendar"})]})]}),e.jsx(_,{isOpen:m,title:g.title,description:g.description,confirmLabel:"Delete calendar",destructive:!0,onConfirm:()=>{f(!1),d()},onCancel:()=>f(!1)})]})}const Fe="/feeds/calendar/",Te=".ics",ze=(s,n)=>`webcal://${s}${Fe}${n}${Te}`;function De(s){const n=P(),[t,a]=i.useState(""),r=K({path:{calendarId:s}}),d=W({...X({path:{calendarId:s}}),meta:O(404,403),retry:!1}),l=()=>{n.invalidateQueries({queryKey:r})},h=i.useRef(()=>{}),c=S({...Y(),meta:E,onMutate:()=>{h.current()},onSuccess:()=>{a(""),l()}}),o=S({...J(),meta:E,gcTime:0,onMutate:()=>{c.reset()},onSuccess:V=>{a(ze(window.location.host,V.feedToken)),l()}});h.current=o.reset;const{mutate:m,reset:f}=o,{mutate:x}=c,b=i.useCallback(()=>{m({path:{calendarId:s}})},[s,m]),u=i.useCallback(()=>{x({path:{calendarId:s}})},[s,x]),p=i.useCallback(()=>{a(""),f()},[f]),{refetch:g}=d,y=i.useCallback(()=>{g()},[g]);return{state:Me(d),mintedUrl:t,isBusy:o.isPending||c.isPending,actionError:o.error??c.error,mint:b,revoke:u,dismissMinted:p,retry:y}}function Me(s){return s.error?q(s.error)?{status:"absent"}:{status:"unreadable",error:s.error}:s.isPending?{status:"loading"}:s.data?{status:"active",createdAt:s.data.createdAt,rotatedAt:s.data.rotatedAt}:{status:"absent"}}const Ee=s=>({title:`Replace the address for ${s}?`,description:"Every client already subscribed to the current address stops updating and has to be pointed at the new one. The new address is shown once."}),Re=s=>({title:`Stop sharing ${s}?`,description:"The address stops working immediately and every client subscribed to it stops updating. Sharing again mints a different address."});function Ae({calendarName:s,url:n,onDismiss:t}){const[a,r]=i.useState(!1),[d,l]=i.useState(!1),h=i.useRef(0);i.useEffect(()=>()=>window.clearTimeout(h.current),[]);const c=()=>{navigator.clipboard.writeText(n).then(()=>{l(!1),r(!0),h.current=window.setTimeout(()=>r(!1),2e3)}).catch(()=>l(!0))};return e.jsxs("div",{className:"mt-3 space-y-2 rounded-sm border border-accent-2/40 bg-accent-2/10 px-3 py-2.5",children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:"Subscribe with this address. It is shown once and cannot be read back."}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx("input",{readOnly:!0,value:n,"aria-label":`Subscription address for ${s}`,onFocus:o=>o.currentTarget.select(),className:"min-w-0 flex-1 rounded-sm border border-line bg-surface px-2 py-1.5 font-mono text-xs text-fg"}),e.jsx(v,{variant:"primary",size:"sm",icon:a?e.jsx(ee,{className:"size-3.5"}):e.jsx(xe,{className:"size-3.5"}),onClick:c,children:a?"Copied":"Copy address"})]}),d&&e.jsx(j,{tone:"warning",variant:"soft",children:"The address could not be copied to the clipboard. Select it above and copy it by hand before leaving this page."}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Anyone holding this address can read every event in this calendar, without signing in. Rotate it if it reaches the wrong person."}),e.jsx(v,{variant:"ghost",size:"sm",onClick:t,children:"I've saved it"})]})}function Pe({createdAt:s,rotatedAt:n,isBusy:t,onRotate:a,onRevoke:r}){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(U,{tone:"positive",children:"shared"}),e.jsxs("span",{className:"text-xs text-fg-muted",children:["Address created ",F(s,"medium"),n>0?`, last replaced ${F(n,"medium")}`:""]})]}),e.jsx("p",{className:"text-sm text-fg-muted",children:"The address itself is not stored in readable form, so it cannot be shown again. Replace it if you no longer know where it went."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(v,{variant:"secondary",size:"sm",disabled:t,icon:e.jsx(pe,{className:"size-3.5"}),onClick:a,children:"Replace address"}),e.jsx(v,{variant:"danger",size:"sm",disabled:t,icon:e.jsx(A,{className:"size-3.5"}),onClick:r,children:"Stop sharing"})]})]})}function Oe({calendarName:s,details:n,state:t,mintedUrl:a,isBusy:r,actionError:d,onMint:l,onRevoke:h,onDismissMinted:c,onRetry:o}){const[m,f]=i.useState("none"),x=i.useId(),b=()=>{const p=m;f("none"),p==="rotate"&&l(),p==="revoke"&&h()},u=m==="revoke"?Re(s):Ee(s);return e.jsxs(T,{className:"max-w-xl",role:"region","aria-labelledby":x,children:[e.jsx(z,{children:e.jsx(D,{id:x,children:s})}),e.jsxs(M,{children:[n&&e.jsx("div",{className:"mb-4 border-b border-line pb-4",children:n}),t.status==="loading"&&a===""&&e.jsx("div",{className:"h-12 animate-pulse rounded-sm bg-surface-sunken","aria-busy":"true","aria-label":`Loading the subscription address for ${s}`}),t.status==="unreadable"&&a===""&&e.jsx(he,{variant:"inline",title:`Couldn't read whether ${s} is shared`,error:t.error,onRetry:o}),t.status==="absent"&&a===""&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-fg-muted",children:"Give this calendar a secret address and Apple Calendar, Google Calendar, Outlook and Thunderbird can subscribe to it read-only. Nobody signs in — the address is the credential, so treat it like a password."}),e.jsx(v,{variant:"primary",size:"sm",disabled:r,icon:e.jsx(ve,{className:"size-3.5"}),onClick:l,children:r?"Creating…":"Create subscription address"})]}),t.status==="active"&&e.jsx(Pe,{createdAt:t.createdAt,rotatedAt:t.rotatedAt,isBusy:r,onRotate:()=>f("rotate"),onRevoke:()=>f("revoke")}),d!=null&&e.jsxs(j,{tone:"danger",variant:"soft",className:"mt-3",children:[e.jsxs("p",{className:"font-medium",children:["The subscription address for ",s," was not changed."]}),e.jsx("p",{className:"mt-0.5 break-words",children:w(d)})]}),a!==""&&e.jsx(Ae,{calendarName:s,url:a,onDismiss:c})]}),e.jsx(_,{isOpen:m!=="none",title:u.title,description:u.description,confirmLabel:m==="revoke"?"Stop sharing":"Replace address",destructive:!0,onConfirm:b,onCancel:()=>f("none")})]})}function $e({calendarId:s,calendarName:n,details:t}){const a=De(s);return e.jsx(Oe,{calendarName:n,details:t,state:a.state,mintedUrl:a.mintedUrl,isBusy:a.isBusy,actionError:a.actionError,onMint:a.mint,onRevoke:a.revoke,onDismissMinted:a.dismissMinted,onRetry:a.retry})}function _e({calendarId:s,calendarName:n,timezone:t,subscription:a}){const{updateCalendar:r,deleteCalendar:d,isWriting:l}=$(),[h,c]=i.useState(""),o=m=>c(m.kind==="refused"?m.message:"");return e.jsx($e,{calendarId:s,calendarName:n,details:e.jsxs(e.Fragment,{children:[a,e.jsx(Ie,{calendarName:n,timezone:t,isBusy:l,problem:h,onSave:m=>{c(""),r(s,m).then(o)},onDelete:()=>{c(""),d(s).then(o)}},`${n}\0${t}`)]})})}const Ue="Subscribe to a calendar";function Le({isBusy:s,error:n,onSubscribe:t}){const a=i.useId(),r=i.useId(),d=i.useId(),[l,h]=i.useState(""),[c,o]=i.useState(""),m=l.trim()!==""&&c.trim()!=="",f=x=>{x.preventDefault(),m&&t({displayName:l,url:c},()=>{h(""),o("")})};return e.jsxs(T,{className:"max-w-xl",role:"region","aria-labelledby":a,children:[e.jsx(z,{children:e.jsx(D,{id:a,children:Ue})}),e.jsx(M,{children:e.jsxs("form",{className:"space-y-3",onSubmit:f,children:[e.jsx("p",{className:"text-sm text-fg-muted",children:"Paste the secret iCal address from Google Calendar, a published Outlook calendar or any other feed. It shows here read-only and refreshes on its own."}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:r,className:"text-sm font-medium text-fg",children:"Calendar name"}),e.jsx(C,{id:r,value:l,onChange:x=>h(x.target.value),placeholder:"Team rota",autoComplete:"off"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{htmlFor:d,className:"text-sm font-medium text-fg",children:"Calendar address"}),e.jsx(C,{id:d,value:c,onChange:x=>o(x.target.value),placeholder:"https://calendar.google.com/calendar/ical/…/basic.ics",autoComplete:"off",spellCheck:!1,inputMode:"url"}),e.jsx("p",{className:"text-xs text-fg-muted",children:"For Google Calendar the address is the password to the calendar. Reader never shows it in full again."})]}),e.jsx(v,{type:"submit",variant:"primary",size:"sm",disabled:!m||s,icon:e.jsx(ge,{className:"size-3.5"}),children:s?"Subscribing…":"Subscribe"}),n!=null&&e.jsxs(j,{tone:"danger",variant:"soft",children:[e.jsx("p",{className:"font-medium",children:"The calendar was not added."}),e.jsx("p",{className:"mt-0.5 break-words",children:w(n)})]})]})})]})}const He=s=>URL.canParse(s)?new URL(s).host:"an iCalendar feed";function Be({calendarName:s,subscriptionUrl:n,enabled:t,fetchedAt:a,error:r,isBusy:d,actionError:l,onSetEnabled:h}){return e.jsxs("div",{className:"mb-4 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(U,{tone:t?"positive":"neutral",children:t?"subscribed":"paused"}),e.jsxs("span",{className:"text-xs text-fg-muted",children:["Read-only, from ",He(n),a>0?`. Last updated ${F(a,"medium")}`:""]})]}),r!==""&&e.jsxs(j,{tone:"warning",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:[s," was not refreshed."]}),e.jsx("p",{className:"mt-0.5 break-words",children:r})]}),e.jsx("p",{className:"text-sm text-fg-muted",children:t?"Events are read from the feed on a schedule and cannot be edited here.":"Updates are paused. The events already here stay until you resume or remove the calendar."}),e.jsx(v,{variant:"secondary",size:"sm",disabled:d,icon:t?e.jsx(je,{className:"size-3.5"}):e.jsx(ye,{className:"size-3.5"}),onClick:()=>h(!t),children:t?"Pause updates":"Resume updates"}),l!=null&&e.jsxs(j,{tone:"danger",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:["Updates for ",s," were not changed."]}),e.jsx("p",{className:"mt-0.5 break-words",children:w(l)})]})]})}const R=O(400,404),Ge=()=>`subscribed-${crypto.randomUUID().slice(0,8)}`;function Ze(){const s=P(),n=de(),t=()=>{s.invalidateQueries({queryKey:te()}),n()},a=S({...se(),meta:R,onSuccess:t}),r=S({...ae(),meta:R,onSuccess:t}),{mutate:d}=a,l=i.useCallback((o,m)=>{d({body:{urlSegment:Ge(),displayName:o.displayName.trim(),subscriptionUrl:o.url.trim()}},{onSuccess:m})},[d]),{mutate:h}=r,c=i.useCallback((o,m)=>{h({path:{calendarId:o},body:{subscriptionEnabled:m}})},[h]);return{subscribe:l,isSubscribing:a.isPending,subscribeError:a.error,setEnabled:c,togglingCalendarId:r.isPending?r.variables?.path.calendarId??"":"",toggleFailure:{calendarId:r.variables?.path.calendarId??"",error:r.error}}}const Qe=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each calendar has a name, a time zone its floating times are read in, and an address CalDAV clients reach it by. The address is fixed when the calendar is added; the name and zone can change. Deleting a calendar deletes every event in it. The default calendar is where accepted invitations land, so it cannot be deleted."}),e.jsx("p",{children:"A subscription address lets Apple Calendar, Google Calendar, Outlook and Thunderbird show a calendar from here, read-only and kept up to date."}),e.jsx("p",{children:"Those clients never sign in, so the address itself is the credential. Anyone who has it can read the calendar; nobody who has it can change anything."}),e.jsx("p",{children:"Only a hash of the address is stored, so it is shown once and cannot be looked up later. Replacing it breaks every subscription built on the old one, which is how a shared address is taken back."}),e.jsx("p",{children:"Subscribing works the other way round: paste another calendar's iCal address and its events show here, read-only, refreshed on a schedule."})]});function fs(){const s=ne(),n=re(),t=fe(),[a,r]=i.useState(!0),{calendars:d,collections:l,timeZoneByCalendarId:h,isLoading:c}=oe(),o=Ze(),{createCalendar:m,isWriting:f}=$(),[x,b]=i.useState("");return e.jsx(be,{items:n,activeId:"calendars",title:"Calendars",description:"Add, rename and delete calendars, subscribe to a calendar feed, and share one with any client that can subscribe to a URL.",help:Qe,helpOpen:a,onToggleHelp:()=>r(u=>!u),onSelect:t,onBackToMail:()=>{s({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 calendars"}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(we,{}),d.map(u=>{const p=l.find(g=>g.calendarId===u.id);return e.jsx(_e,{calendarId:u.id,calendarName:u.name,timezone:h[u.id]??"",subscription:p?.source==="Subscribed"&&e.jsx(Be,{calendarName:p.displayName,subscriptionUrl:p.subscriptionUrl,enabled:p.subscriptionEnabled,fetchedAt:p.subscriptionFetchedAt,error:p.subscriptionError,isBusy:o.togglingCalendarId===u.id,actionError:o.toggleFailure.calendarId===u.id?o.toggleFailure.error:void 0,onSetEnabled:g=>o.setEnabled(u.id,g)})},u.id)}),e.jsx(Le,{isBusy:o.isSubscribing,error:o.subscribeError,onSubscribe:o.subscribe}),e.jsx(ke,{isBusy:f,problem:x,onCreate:u=>(b(""),m(u).then(p=>p.kind==="written"?!0:(b(p.message),!1)))})]})})}export{fs as component};
@@ -1 +1 @@
1
- import{j as r,p as a}from"./index-yeSesYv-.js";function n({raised:s,className:e,...t}){return r.jsx("div",{className:a("rounded-sm border border-line bg-surface",s?"bg-surface-raised shadow-sm":"",e),...t})}function o({className:s,...e}){return r.jsx("div",{className:a("px-4 pt-3 pb-2",s),...e})}function i({className:s,...e}){return r.jsx("h3",{className:a("text-md font-semibold text-fg",s),...e})}function m({className:s,...e}){return r.jsx("div",{className:a("px-4 pb-3 text-sm text-fg-muted",s),...e})}export{n as C,o as a,i as b,m as c};
1
+ import{j as r,p as a}from"./index-fsuIswbe.js";function n({raised:s,className:e,...t}){return r.jsx("div",{className:a("rounded-sm border border-line bg-surface",s?"bg-surface-raised shadow-sm":"",e),...t})}function o({className:s,...e}){return r.jsx("div",{className:a("px-4 pt-3 pb-2",s),...e})}function i({className:s,...e}){return r.jsx("h3",{className:a("text-md font-semibold text-fg",s),...e})}function m({className:s,...e}){return r.jsx("div",{className:a("px-4 pb-3 text-sm text-fg-muted",s),...e})}export{n as C,o as a,i as b,m as c};
@@ -1 +1 @@
1
- import{b as p,r as c,j as e,at as m,p as t}from"./index-yeSesYv-.js";const d={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};d.node;const h=p(d),b="peer relative size-5 shrink-0 cursor-pointer appearance-none rounded-md border border-line-strong bg-surface outline-none transition-colors checked:border-positive checked:bg-positive indeterminate:border-positive indeterminate:bg-positive focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",l="pointer-events-none absolute inset-0 m-auto size-3.5 text-accent-fg";function g({label:s,description:n,indeterminate:r=!1,checked:u,onChange:f,className:o,...x}){const i=c.useRef(null);c.useEffect(()=>{i.current&&(i.current.indeterminate=r)},[r]);const a=e.jsxs("span",{className:"relative inline-flex",children:[e.jsx("input",{ref:i,type:"checkbox",checked:u,onChange:f,className:b,...x}),e.jsx(m,{className:t(l,"hidden peer-checked:block"),"aria-hidden":!0}),e.jsx(h,{className:t(l,"hidden peer-indeterminate:block"),"aria-hidden":!0})]});return s===void 0&&n===void 0?e.jsx("span",{className:o,children:a}):e.jsxs("label",{className:t("flex min-h-11 cursor-pointer items-center gap-3 text-left",o),children:[a,e.jsxs("span",{className:"flex min-w-0 flex-col",children:[s!==void 0&&e.jsx("span",{className:"text-sm text-fg",children:s}),n!==void 0&&e.jsx("span",{className:"text-xs text-fg-subtle",children:n})]})]})}export{g as C,h as M};
1
+ import{b as p,r as c,j as e,at as m,p as t}from"./index-fsuIswbe.js";const d={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};d.node;const h=p(d),b="peer relative size-5 shrink-0 cursor-pointer appearance-none rounded-md border border-line-strong bg-surface outline-none transition-colors checked:border-positive checked:bg-positive indeterminate:border-positive indeterminate:bg-positive focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface",l="pointer-events-none absolute inset-0 m-auto size-3.5 text-accent-fg";function g({label:s,description:n,indeterminate:r=!1,checked:u,onChange:f,className:o,...x}){const i=c.useRef(null);c.useEffect(()=>{i.current&&(i.current.indeterminate=r)},[r]);const a=e.jsxs("span",{className:"relative inline-flex",children:[e.jsx("input",{ref:i,type:"checkbox",checked:u,onChange:f,className:b,...x}),e.jsx(m,{className:t(l,"hidden peer-checked:block"),"aria-hidden":!0}),e.jsx(h,{className:t(l,"hidden peer-indeterminate:block"),"aria-hidden":!0})]});return s===void 0&&n===void 0?e.jsx("span",{className:o,children:a}):e.jsxs("label",{className:t("flex min-h-11 cursor-pointer items-center gap-3 text-left",o),children:[a,e.jsxs("span",{className:"flex min-w-0 flex-col",children:[s!==void 0&&e.jsx("span",{className:"text-sm text-fg",children:s}),n!==void 0&&e.jsx("span",{className:"text-xs text-fg-subtle",children:n})]})]})}export{g as C,h as M};
@@ -1 +1 @@
1
- import{b as n}from"./index-yeSesYv-.js";const o={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};o.node;const a=n(o);export{a as C};
1
+ import{b as n}from"./index-fsuIswbe.js";const o={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};o.node;const a=n(o);export{a as C};
@@ -1 +1 @@
1
- import{b as o}from"./index-yeSesYv-.js";const e={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};e.node;const t=o(e);export{t as C};
1
+ import{b as o}from"./index-fsuIswbe.js";const e={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};e.node;const t=o(e);export{t as C};
@@ -1 +1 @@
1
- import{b as e}from"./index-yeSesYv-.js";const c={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};c.node;const o=e(c);export{o as C};
1
+ import{b as e}from"./index-fsuIswbe.js";const c={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};c.node;const o=e(c);export{o as C};
@@ -1 +1 @@
1
- import{b as e}from"./index-yeSesYv-.js";const c={name:"circle-check-big",size:24,node:[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-circle"]};c.node;const i=e(c);export{i as C};
1
+ import{b as e}from"./index-fsuIswbe.js";const c={name:"circle-check-big",size:24,node:[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],aliases:["check-circle"]};c.node;const i=e(c);export{i as C};
@@ -1 +1 @@
1
- import{b as c}from"./index-yeSesYv-.js";const e={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};e.node;const i=c(e);export{i as C};
1
+ import{b as c}from"./index-fsuIswbe.js";const e={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};e.node;const i=c(e);export{i as C};
@@ -1 +1 @@
1
- import{j as e,aJ as fe,r as o,ar as _,B as N,b3 as U,as as pe,d as K,a as he,c as xe,b4 as Z,u as ye,af as be}from"./index-yeSesYv-.js";import{F as ge,c as ne,u as q,r as le,w as A,p as ve,d as ee,a as je,s as Ne,h as Ce,g as Se,b as we,e as Ie,f as ke,i as Pe,j as Re,k as se,n as Ue,l as Ke,m as Ae,P as Fe,t as $e,o as Be,q as re,v as Ee}from"./useClassificationSettings-Bi0m63-O.js";import{f as Le}from"./ErrorState-Bk3DwNvd.js";import{R as Te}from"./ReportLink-q8WFRQli.js";import{S as Me}from"./select-B9t8348S.js";import{C as De}from"./confirm-dialog-Cc446-7C.js";import{S as Oe}from"./switch-1RDXcNo-.js";import{B as H}from"./badge-CeCxCmzS.js";import{a as He}from"./sections-uFHlOXiA.js";import{S as _e}from"./settings-screen-CafoSGzb.js";import"./chevron-down-BnC2m4J6.js";import"./avatar-B_QEsxCw.js";import"./chevron-left-CNQ3caMn.js";import"./menu-Cn2tY52U.js";import"./circle-question-mark-CpApZe3H.js";function w({failure:s,onRetry:t}){const n=Le(s.error);return e.jsx(ge,{title:s.title,message:n,reportHref:ne(s.title,n),onRetry:t})}function k({id:s,label:t,hint:n,error:a,children:l}){return e.jsxs("div",{children:[e.jsx(fe,{htmlFor:s,children:t}),l,a&&e.jsx("p",{id:`${s}-error`,className:"mt-1 text-xs text-danger",children:a}),n&&e.jsx("p",{id:`${s}-hint`,className:"mt-1 text-xs text-fg-subtle",children:n})]})}const P=(s,t,n)=>[n?`${s}-error`:"",t?`${s}-hint`:""].filter(Boolean).join(" ")||void 0;function qe({settings:s,inputRef:t,onAnnounce:n}){const a=q(),[l,r]=o.useState(()=>`${s.dailyLimit}`),[m,c]=o.useState(void 0),[u,f]=o.useState(null),h=o.useId(),d=`${h}-limit`,[b]=s.usage,x=b?`Counts reset at ${le(b.resetsAt)}. `:"",v=()=>{if(a.isPending)return;const y=ve(l);if(!y.ok){c(y.message);return}f(null),a.mutate({body:{classificationDailyLimit:y.limit}},{onSuccess:()=>n("Saved"),onError:I=>f({title:"The daily limit was not saved",error:I})})};return e.jsxs("section",{"aria-labelledby":`${h}-title`,className:"space-y-4",children:[e.jsx("h2",{id:`${h}-title`,className:"text-xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Daily limit"}),e.jsx(k,{id:d,label:"Calls per account per day",hint:A(`${x}Past the limit, that account's new mail uses built-in rules.`,s.sources.dailyLimit),error:m,children:e.jsx(_,{id:d,ref:t,className:"h-11",inputMode:"numeric",value:l,autoComplete:"off","aria-invalid":m!==void 0,"aria-describedby":P(d,!0,m!==void 0),onChange:y=>{r(y.target.value),c(void 0),n("")},onKeyDown:y=>{y.key==="Enter"&&v()}})}),e.jsx(N,{variant:"primary",className:"min-h-11","aria-disabled":a.isPending,"aria-busy":a.isPending,onClick:v,children:a.isPending?"Saving…":"Save limit"}),u&&e.jsx(w,{failure:u})]})}const Ve={ApiKey:"Replace key",Model:"Fix the model",BaseUrl:"Fix the base URL"};function Ge({result:s,presetLabel:t,onFix:n,shown:a}){if(s.state==="Passed")return e.jsxs(K,{tone:"success",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:["Test passed in ",s.latencyMs," ms"]}),e.jsxs("p",{className:"mt-0.5 text-fg-muted",children:["Sample message labelled ",s.label,","," ",Math.round(s.confidence*100),"% confident."]})]});const l=$e(s),r=s.field;return e.jsxs(K,{tone:"danger",variant:"soft",children:[e.jsx("p",{className:"font-medium",children:l}),e.jsxs("p",{className:"mt-0.5 break-words text-fg-muted",children:[s.fix," Nothing changed: classification stays as it was."]}),e.jsxs("p",{className:"flex flex-wrap items-center gap-x-4",children:[r!==void 0&&a[r]&&e.jsx("button",{type:"button",onClick:()=>n(r),className:"inline-flex min-h-11 items-center font-medium text-accent hover:underline",children:Ve[r]}),e.jsx(Te,{href:ne(`Test of ${t} failed`,`${l}. ${s.kind}. ${s.fix}`)})]})]})}function Je({preset:s,settings:t,onAnnounce:n}){const a=q(),l=ke(),[r,m]=o.useState(()=>Pe(s,t)),[c,u]=o.useState(null),[f,h]=o.useState(null),[d,b]=o.useState(!1),[x,v]=o.useState(null),[y,I]=o.useState(null),p=o.useRef(null),j=o.useRef(null),V=o.useRef(null),G=o.useRef(null),F=o.useId(),$=`${F}-model`,B=`${F}-base-url`,E=`${F}-key`;o.useEffect(()=>{if(!y)return;({Model:p,BaseUrl:j,ApiKey:V,Replace:G})[y.target].current?.focus()},[y]);const L=Re(t,s.presetId),J=L?.apiKey??U.Default,T=s.needsKey&&J!==U.Default,Q=J===U.Deployment,oe=s.needsKey&&(!T||d),ce={ApiKey:s.needsKey,Model:!0,BaseUrl:!0},C=i=>c?.field===i?c.message:void 0,S=i=>C(i)!==void 0||f?.state==="Failed"&&f.field===i,R=i=>I({target:i}),M=(i,O)=>{m(g=>({...g,...O})),h(g=>g?.state==="Passed"?null:g),u(g=>g?.field===i?null:g),n("")},W=()=>{b(!0),R("ApiKey")},X=()=>{b(!1),m(i=>({...i,apiKey:""})),u(i=>i?.field==="ApiKey"?null:i),R("Replace")},D=i=>{if(i==="ApiKey"&&T){W();return}R(i)},de=()=>{const i=Ke(r,s,t);if(!i.ok){u({field:i.field,message:i.message}),D(i.field);return}v(null);const O=d;a.mutate({body:i.body},{onSuccess:()=>{m(g=>({...g,apiKey:""})),b(!1),u(null),n("Saved"),O&&R("Replace")},onError:g=>{if(Ae(g)){u({field:"ApiKey",message:Fe}),D("ApiKey");return}v({title:`${s.label} was not saved`,error:g})}})},ue=()=>{l.isPending||(h(null),v(null),n(""),l.mutate({body:{presetId:s.presetId,model:r.model.trim(),baseUrl:r.baseUrl.trim(),apiKey:r.apiKey.trim()}},{onSuccess:h,onError:i=>v({title:`The test of ${s.label} did not run`,error:i})}))},Y=se(t,s.presetId,"model")??s.defaultModel,me=se(t,s.presetId,"baseUrl")??s.defaultBaseUrl??"http://localhost:11434/v1",z=C("ApiKey");return e.jsxs(e.Fragment,{children:[e.jsx(k,{id:$,label:"Model",hint:A(`Empty uses ${Y}.`,L?.model),error:C("Model"),children:e.jsx(_,{id:$,ref:p,className:"h-11",value:r.model,placeholder:Y,autoComplete:"off",spellCheck:!1,"aria-invalid":S("Model"),"aria-describedby":P($,!0,C("Model")!==void 0),onChange:i=>M("Model",{model:i.target.value})})}),e.jsx(k,{id:B,label:"Base URL",hint:A("Remit's server calls this URL.",L?.baseUrl),error:C("BaseUrl"),children:e.jsx(_,{id:B,ref:j,className:"h-11",type:"url",inputMode:"url",value:r.baseUrl,placeholder:me,autoComplete:"off",spellCheck:!1,required:Ue(s),"aria-invalid":S("BaseUrl"),"aria-describedby":P(B,!0,C("BaseUrl")!==void 0),onChange:i=>M("BaseUrl",{baseUrl:i.target.value})})}),T&&!d&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-fg-muted",children:"API key"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[Q?e.jsx("span",{className:S("ApiKey")?"text-sm text-danger":"text-sm text-fg-muted",children:"provided by the deployment"}):e.jsx("span",{className:S("ApiKey")?"text-sm text-danger":"text-sm text-fg",children:"set"}),e.jsx("span",{className:"flex-1"}),e.jsx(N,{ref:G,variant:"secondary",className:"min-h-11","aria-invalid":S("ApiKey"),onClick:W,children:Q?"Use your own key":"Replace"})]})]}),oe&&e.jsx(k,{id:E,label:d?"New API key":"API key",hint:d?"The key in use stays until you press Save.":void 0,error:z,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{id:E,ref:V,className:"h-11 flex-1",value:r.apiKey,placeholder:d?"Paste the new key":"Paste the key",autoComplete:"off",spellCheck:!1,"aria-invalid":S("ApiKey"),"aria-describedby":P(E,d,z!==void 0),onChange:i=>M("ApiKey",{apiKey:i.target.value}),onKeyDown:i=>{i.key==="Escape"&&d&&(i.preventDefault(),i.stopPropagation(),X())}}),d&&e.jsx(N,{variant:"ghost",className:"min-h-11",onClick:X,children:"Cancel"})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(N,{variant:"primary",className:"min-h-11","aria-disabled":a.isPending,onClick:()=>{a.isPending||de()},children:a.isPending?"Saving…":"Save"}),e.jsx(N,{variant:"secondary",className:"min-h-11","aria-disabled":l.isPending,"aria-busy":l.isPending,onClick:ue,children:l.isPending?"Testing…":"Test connection"})]}),e.jsx("p",{"aria-live":"polite",className:"text-sm text-fg-muted empty:hidden",children:l.isPending?`Sending one sample message to ${s.label}`:""}),f&&e.jsx(Ge,{result:f,presetLabel:s.label,onFix:D,shown:ce}),x&&e.jsx(w,{failure:x})]})}function Qe({presets:s,settings:t,onAnnounce:n}){const[a,l]=o.useState(()=>ee(t).presetId),r=je(),[m,c]=o.useState(!1),[u,f]=o.useState(0),[h,d]=o.useState(null),b=o.useId(),x=s.find(p=>p.presetId===a),v=Ne(t,a,s),y=t.state==="Configured"&&t.enabled,I=()=>{d(null),r.mutate({},{onSuccess:p=>{c(!1),l(ee(p.classification).presetId),f(j=>j+1)},onError:p=>{c(!1),d({title:"The provider settings were not cleared",error:p})}})};return e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex min-h-11 items-center gap-3",children:[e.jsx("h2",{className:"flex-1 text-xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Provider"}),Ce(t)&&e.jsx(N,{variant:"secondary",className:"min-h-11",onClick:()=>c(!0),children:"Clear"})]}),h&&e.jsx(w,{failure:h}),e.jsx(k,{id:b,label:"Provider",hint:x?we(x):void 0,children:e.jsxs(Me,{id:b,className:"h-11",value:a??"",onChange:p=>l(s.find(j=>j.presetId===p.target.value)?.presetId),"aria-describedby":P(b,x!==void 0,!1),children:[e.jsx("option",{value:"",disabled:!0,children:"Choose a provider"}),Se(s).map(p=>e.jsx("optgroup",{label:p.label,children:p.presets.map(j=>e.jsx("option",{value:j.presetId,children:j.label},j.presetId))},p.group))]})}),v&&e.jsxs("p",{className:"text-sm text-warning",children:["Saving switches from ",v.label,Ie(t).sources?.apiKey===U.Saved?" and deletes its saved key.":"."]}),x&&e.jsx(Je,{preset:x,settings:t,onAnnounce:n},`${x.presetId}-${u}`),e.jsx(De,{isOpen:m,title:"Clear the provider settings?",description:y?"Classification is on. Clearing the provider switches it off, and new mail goes back to built-in rules. Every field returns to the deployment default.":"Clearing the provider returns every field to the deployment default.",confirmLabel:"Clear",destructive:!0,isBusy:r.isPending,onConfirm:I,onCancel:()=>c(!1)})]})}const te="Mail classification settings did not load",ae={[Z.NoBaseUrl]:"a base URL",[Z.NoApiKey]:"an API key"},We=s=>{if(s.state==="NotConfigured")return"Save a provider below first. Until then, built-in rules label your mail.";if(s.state==="Unrunnable")return"The provider cannot run yet. Built-in rules label your mail.";const t=s.enabled?"New mail goes to the model. A failed call falls back to built-in rules.":"Provider saved. Built-in rules label your mail until you switch this on.";return A(t,s.sources.enabled)};function Xe({settings:s}){return e.jsxs(K,{tone:"warning",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:["Classification cannot run without ",ae[s.reason]]}),e.jsxs("p",{className:"mt-0.5 text-fg-muted",children:["Add ",ae[s.reason]," below and save. Until then, built-in rules label your mail."]})]})}const Ye=s=>t=>{const n=s.find(a=>a.accountId===t);return n?.displayName?.trim()||n?.email||t};function ze({on:s,capped:t}){return s?t?e.jsx(H,{tone:"warning",dot:!0,children:"cap reached"}):e.jsx(H,{tone:"positive",dot:!0,children:"on"}):e.jsx(H,{dot:!0,children:"off"})}function Ze({usage:s,preset:t,nameOf:n}){return e.jsx("dl",{className:"space-y-2",children:s.map(a=>e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-3",children:[e.jsx("dt",{className:"min-w-0 truncate text-sm text-fg",children:n(a.accountId)}),e.jsxs("dd",{className:"text-right text-sm text-fg-muted",children:[e.jsxs("span",{className:"text-fg",children:[a.calls," / ",a.dailyLimit," calls"]})," ",e.jsxs("span",{className:"text-xs",children:[Ee(a,t),re(a)&&e.jsx("span",{className:"text-warning",children:" · limit reached"})]})]})]},a.accountId))})}function es({first:s,capped:t,nameOf:n,onRaiseLimit:a}){const l=new Intl.ListFormat("en",{type:"conjunction"}).format(t.map(r=>n(r.accountId)));return e.jsxs(K,{tone:"warning",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:[l," reached the daily limit of ",s.dailyLimit," calls"]}),e.jsxs("p",{className:"mt-0.5 text-fg-muted",children:[t.length===1?"Its":"Their"," new mail uses built-in rules until ",le(s.resetsAt),"."]}),e.jsx(N,{variant:"secondary",className:"mt-2 min-h-11",onClick:a,children:"Raise the limit"})]})}function ss({settings:s,presets:t,nameOf:n,onRaiseLimit:a}){const l=q(),[r,m]=o.useState(null),c=o.useId(),u=s.state==="Configured",f=u&&s.enabled,h=f?s.usage.filter(re):[],[d]=h,b=()=>{m(null),l.mutate({body:{classificationEnabled:!f}},{onError:m})};return e.jsxs("section",{"aria-labelledby":`${c}-title`,className:"space-y-3",children:[e.jsx("h2",{id:`${c}-title`,className:"text-xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Status"}),e.jsxs("div",{className:"flex min-h-11 items-center gap-3",children:[e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("span",{id:`${c}-label`,className:"text-sm text-fg",children:"Use the model"}),e.jsx("span",{id:`${c}-note`,className:"text-xs text-fg-subtle",children:We(s)})]}),e.jsx(ze,{on:f,capped:d!==void 0}),e.jsx(Oe,{checked:f,"aria-labelledby":`${c}-label`,"aria-describedby":`${c}-note`,"aria-disabled":!u||l.isPending,"aria-busy":l.isPending,onToggle:b})]}),s.state==="Unrunnable"&&e.jsx(Xe,{settings:s}),d&&e.jsx(es,{first:d,capped:h,nameOf:n,onRaiseLimit:a}),u&&e.jsx(Ze,{usage:s.usage,preset:t.find(x=>x.presetId===s.presetId),nameOf:n}),r!==null&&e.jsx(w,{failure:{title:f?"Classification was not switched off":"Classification was not switched on",error:r}})]})}function ie(){return e.jsx("div",{className:"h-48 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading mail classification settings"})}function ts(){const s=Be(),t=he({...xe(),staleTime:1/0}),[n,a]=o.useState(""),l=o.useRef(null),r=()=>{const u=l.current;u&&(u.focus(),u.select(),u.scrollIntoView({block:"center"}))};if(s.isPending)return e.jsx(ie,{});if(s.signedOut)return null;if(s.isError)return e.jsx(w,{failure:{title:te,error:s.error},onRetry:()=>{s.refetch()}});if(t.isPending)return e.jsx(ie,{});if(t.isError)return e.jsx(w,{failure:{title:te,error:t.error},onRetry:()=>{t.refetch()}});const{classification:m,classificationPresets:c}=s.data;return e.jsxs("div",{className:"max-w-xl space-y-8",children:[e.jsx(ss,{settings:m,presets:c,nameOf:Ye(t.data.accounts),onRaiseLimit:r}),e.jsx(Qe,{presets:c,settings:m,onAnnounce:a},m.state),m.state==="Configured"&&e.jsx(qe,{settings:m,inputRef:l,onAnnounce:a}),e.jsx("p",{"aria-live":"polite",className:"text-sm text-fg-muted",children:n})]})}const as=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"A model labels new mail: spam and phishing, priority, personal, and a category. With classification off, or when a call fails, the built-in rules label it."}),e.jsx("p",{children:"The API key is stored encrypted on the server and never sent back to the browser. Test connection sends one built-in sample message, with the form as it stands, and changes nothing."})]});function gs(){const s=ye(),t=be(),n=He(),[a,l]=o.useState(!0);return e.jsx(_e,{items:t,activeId:"classification",title:"Mail classification",description:"Label new mail with a model. Mail already in your folders keeps its labels.",help:as,helpOpen:a,onToggleHelp:()=>l(r=>!r),onSelect:n,onBackToMail:()=>{s({to:"/mail"})},children:e.jsx(ts,{})})}export{gs as component};
1
+ import{j as e,aJ as fe,r as o,ar as _,B as N,b3 as U,as as pe,d as K,a as he,c as xe,b4 as Z,u as ye,af as be}from"./index-fsuIswbe.js";import{F as ge,c as ne,u as q,r as le,w as A,p as ve,d as ee,a as je,s as Ne,h as Ce,g as Se,b as we,e as Ie,f as ke,i as Pe,j as Re,k as se,n as Ue,l as Ke,m as Ae,P as Fe,t as $e,o as Be,q as re,v as Ee}from"./useClassificationSettings-DBRecrmp.js";import{f as Le}from"./ErrorState-BTHOmsYP.js";import{R as Te}from"./ReportLink-BELrQR40.js";import{S as Me}from"./select-TYdrgtW5.js";import{C as De}from"./confirm-dialog-XvccFJdE.js";import{S as Oe}from"./switch-CyAtRlCz.js";import{B as H}from"./badge-BB80tGxy.js";import{a as He}from"./sections-DpRVKuXF.js";import{S as _e}from"./settings-screen-DTYVWAkg.js";import"./chevron-down-De4wQzka.js";import"./avatar-Bq7beWCy.js";import"./chevron-left-CUHU8UT9.js";import"./menu-Bh94jr77.js";import"./circle-question-mark-DhNa_A16.js";function w({failure:s,onRetry:t}){const n=Le(s.error);return e.jsx(ge,{title:s.title,message:n,reportHref:ne(s.title,n),onRetry:t})}function k({id:s,label:t,hint:n,error:a,children:l}){return e.jsxs("div",{children:[e.jsx(fe,{htmlFor:s,children:t}),l,a&&e.jsx("p",{id:`${s}-error`,className:"mt-1 text-xs text-danger",children:a}),n&&e.jsx("p",{id:`${s}-hint`,className:"mt-1 text-xs text-fg-subtle",children:n})]})}const P=(s,t,n)=>[n?`${s}-error`:"",t?`${s}-hint`:""].filter(Boolean).join(" ")||void 0;function qe({settings:s,inputRef:t,onAnnounce:n}){const a=q(),[l,r]=o.useState(()=>`${s.dailyLimit}`),[m,c]=o.useState(void 0),[u,f]=o.useState(null),h=o.useId(),d=`${h}-limit`,[b]=s.usage,x=b?`Counts reset at ${le(b.resetsAt)}. `:"",v=()=>{if(a.isPending)return;const y=ve(l);if(!y.ok){c(y.message);return}f(null),a.mutate({body:{classificationDailyLimit:y.limit}},{onSuccess:()=>n("Saved"),onError:I=>f({title:"The daily limit was not saved",error:I})})};return e.jsxs("section",{"aria-labelledby":`${h}-title`,className:"space-y-4",children:[e.jsx("h2",{id:`${h}-title`,className:"text-xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Daily limit"}),e.jsx(k,{id:d,label:"Calls per account per day",hint:A(`${x}Past the limit, that account's new mail uses built-in rules.`,s.sources.dailyLimit),error:m,children:e.jsx(_,{id:d,ref:t,className:"h-11",inputMode:"numeric",value:l,autoComplete:"off","aria-invalid":m!==void 0,"aria-describedby":P(d,!0,m!==void 0),onChange:y=>{r(y.target.value),c(void 0),n("")},onKeyDown:y=>{y.key==="Enter"&&v()}})}),e.jsx(N,{variant:"primary",className:"min-h-11","aria-disabled":a.isPending,"aria-busy":a.isPending,onClick:v,children:a.isPending?"Saving…":"Save limit"}),u&&e.jsx(w,{failure:u})]})}const Ve={ApiKey:"Replace key",Model:"Fix the model",BaseUrl:"Fix the base URL"};function Ge({result:s,presetLabel:t,onFix:n,shown:a}){if(s.state==="Passed")return e.jsxs(K,{tone:"success",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:["Test passed in ",s.latencyMs," ms"]}),e.jsxs("p",{className:"mt-0.5 text-fg-muted",children:["Sample message labelled ",s.label,","," ",Math.round(s.confidence*100),"% confident."]})]});const l=$e(s),r=s.field;return e.jsxs(K,{tone:"danger",variant:"soft",children:[e.jsx("p",{className:"font-medium",children:l}),e.jsxs("p",{className:"mt-0.5 break-words text-fg-muted",children:[s.fix," Nothing changed: classification stays as it was."]}),e.jsxs("p",{className:"flex flex-wrap items-center gap-x-4",children:[r!==void 0&&a[r]&&e.jsx("button",{type:"button",onClick:()=>n(r),className:"inline-flex min-h-11 items-center font-medium text-accent hover:underline",children:Ve[r]}),e.jsx(Te,{href:ne(`Test of ${t} failed`,`${l}. ${s.kind}. ${s.fix}`)})]})]})}function Je({preset:s,settings:t,onAnnounce:n}){const a=q(),l=ke(),[r,m]=o.useState(()=>Pe(s,t)),[c,u]=o.useState(null),[f,h]=o.useState(null),[d,b]=o.useState(!1),[x,v]=o.useState(null),[y,I]=o.useState(null),p=o.useRef(null),j=o.useRef(null),V=o.useRef(null),G=o.useRef(null),F=o.useId(),$=`${F}-model`,B=`${F}-base-url`,E=`${F}-key`;o.useEffect(()=>{if(!y)return;({Model:p,BaseUrl:j,ApiKey:V,Replace:G})[y.target].current?.focus()},[y]);const L=Re(t,s.presetId),J=L?.apiKey??U.Default,T=s.needsKey&&J!==U.Default,Q=J===U.Deployment,oe=s.needsKey&&(!T||d),ce={ApiKey:s.needsKey,Model:!0,BaseUrl:!0},C=i=>c?.field===i?c.message:void 0,S=i=>C(i)!==void 0||f?.state==="Failed"&&f.field===i,R=i=>I({target:i}),M=(i,O)=>{m(g=>({...g,...O})),h(g=>g?.state==="Passed"?null:g),u(g=>g?.field===i?null:g),n("")},W=()=>{b(!0),R("ApiKey")},X=()=>{b(!1),m(i=>({...i,apiKey:""})),u(i=>i?.field==="ApiKey"?null:i),R("Replace")},D=i=>{if(i==="ApiKey"&&T){W();return}R(i)},de=()=>{const i=Ke(r,s,t);if(!i.ok){u({field:i.field,message:i.message}),D(i.field);return}v(null);const O=d;a.mutate({body:i.body},{onSuccess:()=>{m(g=>({...g,apiKey:""})),b(!1),u(null),n("Saved"),O&&R("Replace")},onError:g=>{if(Ae(g)){u({field:"ApiKey",message:Fe}),D("ApiKey");return}v({title:`${s.label} was not saved`,error:g})}})},ue=()=>{l.isPending||(h(null),v(null),n(""),l.mutate({body:{presetId:s.presetId,model:r.model.trim(),baseUrl:r.baseUrl.trim(),apiKey:r.apiKey.trim()}},{onSuccess:h,onError:i=>v({title:`The test of ${s.label} did not run`,error:i})}))},Y=se(t,s.presetId,"model")??s.defaultModel,me=se(t,s.presetId,"baseUrl")??s.defaultBaseUrl??"http://localhost:11434/v1",z=C("ApiKey");return e.jsxs(e.Fragment,{children:[e.jsx(k,{id:$,label:"Model",hint:A(`Empty uses ${Y}.`,L?.model),error:C("Model"),children:e.jsx(_,{id:$,ref:p,className:"h-11",value:r.model,placeholder:Y,autoComplete:"off",spellCheck:!1,"aria-invalid":S("Model"),"aria-describedby":P($,!0,C("Model")!==void 0),onChange:i=>M("Model",{model:i.target.value})})}),e.jsx(k,{id:B,label:"Base URL",hint:A("Remit's server calls this URL.",L?.baseUrl),error:C("BaseUrl"),children:e.jsx(_,{id:B,ref:j,className:"h-11",type:"url",inputMode:"url",value:r.baseUrl,placeholder:me,autoComplete:"off",spellCheck:!1,required:Ue(s),"aria-invalid":S("BaseUrl"),"aria-describedby":P(B,!0,C("BaseUrl")!==void 0),onChange:i=>M("BaseUrl",{baseUrl:i.target.value})})}),T&&!d&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-fg-muted",children:"API key"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[Q?e.jsx("span",{className:S("ApiKey")?"text-sm text-danger":"text-sm text-fg-muted",children:"provided by the deployment"}):e.jsx("span",{className:S("ApiKey")?"text-sm text-danger":"text-sm text-fg",children:"set"}),e.jsx("span",{className:"flex-1"}),e.jsx(N,{ref:G,variant:"secondary",className:"min-h-11","aria-invalid":S("ApiKey"),onClick:W,children:Q?"Use your own key":"Replace"})]})]}),oe&&e.jsx(k,{id:E,label:d?"New API key":"API key",hint:d?"The key in use stays until you press Save.":void 0,error:z,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{id:E,ref:V,className:"h-11 flex-1",value:r.apiKey,placeholder:d?"Paste the new key":"Paste the key",autoComplete:"off",spellCheck:!1,"aria-invalid":S("ApiKey"),"aria-describedby":P(E,d,z!==void 0),onChange:i=>M("ApiKey",{apiKey:i.target.value}),onKeyDown:i=>{i.key==="Escape"&&d&&(i.preventDefault(),i.stopPropagation(),X())}}),d&&e.jsx(N,{variant:"ghost",className:"min-h-11",onClick:X,children:"Cancel"})]})}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(N,{variant:"primary",className:"min-h-11","aria-disabled":a.isPending,onClick:()=>{a.isPending||de()},children:a.isPending?"Saving…":"Save"}),e.jsx(N,{variant:"secondary",className:"min-h-11","aria-disabled":l.isPending,"aria-busy":l.isPending,onClick:ue,children:l.isPending?"Testing…":"Test connection"})]}),e.jsx("p",{"aria-live":"polite",className:"text-sm text-fg-muted empty:hidden",children:l.isPending?`Sending one sample message to ${s.label}`:""}),f&&e.jsx(Ge,{result:f,presetLabel:s.label,onFix:D,shown:ce}),x&&e.jsx(w,{failure:x})]})}function Qe({presets:s,settings:t,onAnnounce:n}){const[a,l]=o.useState(()=>ee(t).presetId),r=je(),[m,c]=o.useState(!1),[u,f]=o.useState(0),[h,d]=o.useState(null),b=o.useId(),x=s.find(p=>p.presetId===a),v=Ne(t,a,s),y=t.state==="Configured"&&t.enabled,I=()=>{d(null),r.mutate({},{onSuccess:p=>{c(!1),l(ee(p.classification).presetId),f(j=>j+1)},onError:p=>{c(!1),d({title:"The provider settings were not cleared",error:p})}})};return e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex min-h-11 items-center gap-3",children:[e.jsx("h2",{className:"flex-1 text-xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Provider"}),Ce(t)&&e.jsx(N,{variant:"secondary",className:"min-h-11",onClick:()=>c(!0),children:"Clear"})]}),h&&e.jsx(w,{failure:h}),e.jsx(k,{id:b,label:"Provider",hint:x?we(x):void 0,children:e.jsxs(Me,{id:b,className:"h-11",value:a??"",onChange:p=>l(s.find(j=>j.presetId===p.target.value)?.presetId),"aria-describedby":P(b,x!==void 0,!1),children:[e.jsx("option",{value:"",disabled:!0,children:"Choose a provider"}),Se(s).map(p=>e.jsx("optgroup",{label:p.label,children:p.presets.map(j=>e.jsx("option",{value:j.presetId,children:j.label},j.presetId))},p.group))]})}),v&&e.jsxs("p",{className:"text-sm text-warning",children:["Saving switches from ",v.label,Ie(t).sources?.apiKey===U.Saved?" and deletes its saved key.":"."]}),x&&e.jsx(Je,{preset:x,settings:t,onAnnounce:n},`${x.presetId}-${u}`),e.jsx(De,{isOpen:m,title:"Clear the provider settings?",description:y?"Classification is on. Clearing the provider switches it off, and new mail goes back to built-in rules. Every field returns to the deployment default.":"Clearing the provider returns every field to the deployment default.",confirmLabel:"Clear",destructive:!0,isBusy:r.isPending,onConfirm:I,onCancel:()=>c(!1)})]})}const te="Mail classification settings did not load",ae={[Z.NoBaseUrl]:"a base URL",[Z.NoApiKey]:"an API key"},We=s=>{if(s.state==="NotConfigured")return"Save a provider below first. Until then, built-in rules label your mail.";if(s.state==="Unrunnable")return"The provider cannot run yet. Built-in rules label your mail.";const t=s.enabled?"New mail goes to the model. A failed call falls back to built-in rules.":"Provider saved. Built-in rules label your mail until you switch this on.";return A(t,s.sources.enabled)};function Xe({settings:s}){return e.jsxs(K,{tone:"warning",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:["Classification cannot run without ",ae[s.reason]]}),e.jsxs("p",{className:"mt-0.5 text-fg-muted",children:["Add ",ae[s.reason]," below and save. Until then, built-in rules label your mail."]})]})}const Ye=s=>t=>{const n=s.find(a=>a.accountId===t);return n?.displayName?.trim()||n?.email||t};function ze({on:s,capped:t}){return s?t?e.jsx(H,{tone:"warning",dot:!0,children:"cap reached"}):e.jsx(H,{tone:"positive",dot:!0,children:"on"}):e.jsx(H,{dot:!0,children:"off"})}function Ze({usage:s,preset:t,nameOf:n}){return e.jsx("dl",{className:"space-y-2",children:s.map(a=>e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-3",children:[e.jsx("dt",{className:"min-w-0 truncate text-sm text-fg",children:n(a.accountId)}),e.jsxs("dd",{className:"text-right text-sm text-fg-muted",children:[e.jsxs("span",{className:"text-fg",children:[a.calls," / ",a.dailyLimit," calls"]})," ",e.jsxs("span",{className:"text-xs",children:[Ee(a,t),re(a)&&e.jsx("span",{className:"text-warning",children:" · limit reached"})]})]})]},a.accountId))})}function es({first:s,capped:t,nameOf:n,onRaiseLimit:a}){const l=new Intl.ListFormat("en",{type:"conjunction"}).format(t.map(r=>n(r.accountId)));return e.jsxs(K,{tone:"warning",variant:"soft",children:[e.jsxs("p",{className:"font-medium",children:[l," reached the daily limit of ",s.dailyLimit," calls"]}),e.jsxs("p",{className:"mt-0.5 text-fg-muted",children:[t.length===1?"Its":"Their"," new mail uses built-in rules until ",le(s.resetsAt),"."]}),e.jsx(N,{variant:"secondary",className:"mt-2 min-h-11",onClick:a,children:"Raise the limit"})]})}function ss({settings:s,presets:t,nameOf:n,onRaiseLimit:a}){const l=q(),[r,m]=o.useState(null),c=o.useId(),u=s.state==="Configured",f=u&&s.enabled,h=f?s.usage.filter(re):[],[d]=h,b=()=>{m(null),l.mutate({body:{classificationEnabled:!f}},{onError:m})};return e.jsxs("section",{"aria-labelledby":`${c}-title`,className:"space-y-3",children:[e.jsx("h2",{id:`${c}-title`,className:"text-xs font-semibold uppercase tracking-wider text-fg-subtle",children:"Status"}),e.jsxs("div",{className:"flex min-h-11 items-center gap-3",children:[e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("span",{id:`${c}-label`,className:"text-sm text-fg",children:"Use the model"}),e.jsx("span",{id:`${c}-note`,className:"text-xs text-fg-subtle",children:We(s)})]}),e.jsx(ze,{on:f,capped:d!==void 0}),e.jsx(Oe,{checked:f,"aria-labelledby":`${c}-label`,"aria-describedby":`${c}-note`,"aria-disabled":!u||l.isPending,"aria-busy":l.isPending,onToggle:b})]}),s.state==="Unrunnable"&&e.jsx(Xe,{settings:s}),d&&e.jsx(es,{first:d,capped:h,nameOf:n,onRaiseLimit:a}),u&&e.jsx(Ze,{usage:s.usage,preset:t.find(x=>x.presetId===s.presetId),nameOf:n}),r!==null&&e.jsx(w,{failure:{title:f?"Classification was not switched off":"Classification was not switched on",error:r}})]})}function ie(){return e.jsx("div",{className:"h-48 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading mail classification settings"})}function ts(){const s=Be(),t=he({...xe(),staleTime:1/0}),[n,a]=o.useState(""),l=o.useRef(null),r=()=>{const u=l.current;u&&(u.focus(),u.select(),u.scrollIntoView({block:"center"}))};if(s.isPending)return e.jsx(ie,{});if(s.signedOut)return null;if(s.isError)return e.jsx(w,{failure:{title:te,error:s.error},onRetry:()=>{s.refetch()}});if(t.isPending)return e.jsx(ie,{});if(t.isError)return e.jsx(w,{failure:{title:te,error:t.error},onRetry:()=>{t.refetch()}});const{classification:m,classificationPresets:c}=s.data;return e.jsxs("div",{className:"max-w-xl space-y-8",children:[e.jsx(ss,{settings:m,presets:c,nameOf:Ye(t.data.accounts),onRaiseLimit:r}),e.jsx(Qe,{presets:c,settings:m,onAnnounce:a},m.state),m.state==="Configured"&&e.jsx(qe,{settings:m,inputRef:l,onAnnounce:a}),e.jsx("p",{"aria-live":"polite",className:"text-sm text-fg-muted",children:n})]})}const as=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"A model labels new mail: spam and phishing, priority, personal, and a category. With classification off, or when a call fails, the built-in rules label it."}),e.jsx("p",{children:"The API key is stored encrypted on the server and never sent back to the browser. Test connection sends one built-in sample message, with the form as it stands, and changes nothing."})]});function gs(){const s=ye(),t=be(),n=He(),[a,l]=o.useState(!0);return e.jsx(_e,{items:t,activeId:"classification",title:"Mail classification",description:"Label new mail with a model. Mail already in your folders keeps its labels.",help:as,helpOpen:a,onToggleHelp:()=>l(r=>!r),onSelect:n,onBackToMail:()=>{s({to:"/mail"})},children:e.jsx(ts,{})})}export{gs as component};
@@ -1 +1 @@
1
- import{b as e}from"./index-yeSesYv-.js";const c={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};c.node;const a=e(c);export{a as C};
1
+ import{b as e}from"./index-fsuIswbe.js";const c={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};c.node;const a=e(c);export{a as C};
@@ -1 +1 @@
1
- import{b as e}from"./index-yeSesYv-.js";const o={name:"cloud-off",size:24,node:[["path",{d:"M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057",key:"1uxyv8"}],["path",{d:"M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78",key:"99tcn7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};o.node;const t=e(o);export{t as C};
1
+ import{b as e}from"./index-fsuIswbe.js";const o={name:"cloud-off",size:24,node:[["path",{d:"M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057",key:"1uxyv8"}],["path",{d:"M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78",key:"99tcn7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};o.node;const t=e(o);export{t as C};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-DiZNltCL.js";import"./index-fsuIswbe.js";import"./index-Caon2n2j.js";import"./useMessageBodyContent-CpTD2HGg.js";import"./reply-CXuSMyqp.js";import"./nav-link-ed0mFCCx.js";import"./useMediaQuery-Hy81MQ2M.js";import"./useSignature-W9HBbZ_n.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CFZ4EPXW.js";import"./suggest-list-BCqr1j26.js";import"./sections-DpRVKuXF.js";import"./chevron-down-De4wQzka.js";import"./ErrorState-BTHOmsYP.js";import"./confirm-dialog-XvccFJdE.js";const x=o;export{x as component};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-DiZNltCL.js";import"./index-fsuIswbe.js";import"./index-Caon2n2j.js";import"./useMessageBodyContent-CpTD2HGg.js";import"./reply-CXuSMyqp.js";import"./nav-link-ed0mFCCx.js";import"./useMediaQuery-Hy81MQ2M.js";import"./useSignature-W9HBbZ_n.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CFZ4EPXW.js";import"./suggest-list-BCqr1j26.js";import"./sections-DpRVKuXF.js";import"./chevron-down-De4wQzka.js";import"./ErrorState-BTHOmsYP.js";import"./confirm-dialog-XvccFJdE.js";const x=o;export{x as component};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-DiZNltCL.js";import"./index-fsuIswbe.js";import"./index-Caon2n2j.js";import"./useMessageBodyContent-CpTD2HGg.js";import"./reply-CXuSMyqp.js";import"./nav-link-ed0mFCCx.js";import"./useMediaQuery-Hy81MQ2M.js";import"./useSignature-W9HBbZ_n.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CFZ4EPXW.js";import"./suggest-list-BCqr1j26.js";import"./sections-DpRVKuXF.js";import"./chevron-down-De4wQzka.js";import"./ErrorState-BTHOmsYP.js";import"./confirm-dialog-XvccFJdE.js";const x=o;export{x as component};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-DiZNltCL.js";import"./index-fsuIswbe.js";import"./index-Caon2n2j.js";import"./useMessageBodyContent-CpTD2HGg.js";import"./reply-CXuSMyqp.js";import"./nav-link-ed0mFCCx.js";import"./useMediaQuery-Hy81MQ2M.js";import"./useSignature-W9HBbZ_n.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CFZ4EPXW.js";import"./suggest-list-BCqr1j26.js";import"./sections-DpRVKuXF.js";import"./chevron-down-De4wQzka.js";import"./ErrorState-BTHOmsYP.js";import"./confirm-dialog-XvccFJdE.js";const x=o;export{x as component};
@@ -0,0 +1 @@
1
+ import{F as o}from"./FullCompose-DiZNltCL.js";import"./index-fsuIswbe.js";import"./index-Caon2n2j.js";import"./useMessageBodyContent-CpTD2HGg.js";import"./reply-CXuSMyqp.js";import"./nav-link-ed0mFCCx.js";import"./useMediaQuery-Hy81MQ2M.js";import"./useSignature-W9HBbZ_n.js";import"./account-form-helpers-DhckT_PN.js";import"./useDebouncedValue-CFZ4EPXW.js";import"./suggest-list-BCqr1j26.js";import"./sections-DpRVKuXF.js";import"./chevron-down-De4wQzka.js";import"./ErrorState-BTHOmsYP.js";import"./confirm-dialog-XvccFJdE.js";const x=o;export{x as component};