@remit/web-client-dist 0.0.680 → 0.0.682

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 (193) hide show
  1. package/assets/AccountSession-BYJ1unhC.js +1 -0
  2. package/assets/{BriefPane-CcwdfBlh.js → BriefPane-mADSC2OK.js} +1 -1
  3. package/assets/{CalendarEventEditor-Cpu5cJxJ.js → CalendarEventEditor-C8_kOvZ3.js} +1 -1
  4. package/assets/{CalendarEventPopup-ecl1-NSt.js → CalendarEventPopup-7lWwS7jN.js} +1 -1
  5. package/assets/{CalendarLoadFailed-BbUr2ubu.js → CalendarLoadFailed-DNV1DlXi.js} +1 -1
  6. package/assets/CalendarQuickCreate-BG0qeW8s.js +1 -0
  7. package/assets/{CalendarSession-XIbMK3oT.js → CalendarSession-CTmh2tcD.js} +1 -1
  8. package/assets/DesktopChrome-Bj6-FRYu.js +1 -0
  9. package/assets/{DropdownMenu-fskbk1FW.js → DropdownMenu-D3gGWitE.js} +1 -1
  10. package/assets/{EmptyState-CzSAWxdK.js → EmptyState-5XJzmFAK.js} +1 -1
  11. package/assets/{ErrorState-KWmymUQR.js → ErrorState-Dzdw33-3.js} +1 -1
  12. package/assets/FlaggedPane-IgqQna9q.js +1 -0
  13. package/assets/{FullCompose-6pNo7wi4.js → FullCompose-CppNsB88.js} +1 -1
  14. package/assets/{LabelApplyTrigger-C0GQNIEk.js → LabelApplyTrigger-CSWiFHCu.js} +1 -1
  15. package/assets/{MailShell--jgEGKni.js → MailShell-DbZolZ7P.js} +1 -1
  16. package/assets/{MailViewChrome-33SQAjQn.js → MailViewChrome-C47Pffjf.js} +1 -1
  17. package/assets/{MailboxPane-CvW6x3uh.js → MailboxPane-CBl3PnOT.js} +2 -2
  18. package/assets/{MessageBody-Ba6dVlG6.js → MessageBody-C2-SQjAb.js} +3 -3
  19. package/assets/MessageToolbar-2VWnNBpw.js +1 -0
  20. package/assets/{NavMenuButton-DuV5qIvO.js → NavMenuButton-CN3ovZVQ.js} +1 -1
  21. package/assets/{OnboardingWizard-BHqhUNht.js → OnboardingWizard-CIAVrjJr.js} +1 -1
  22. package/assets/OutboxPane-C7vPOisX.js +1 -0
  23. package/assets/_calendarObjectId-BOWn0Wc1.js +1 -0
  24. package/assets/_mailboxId-CbT5t4kO.js +1 -0
  25. package/assets/_messageId-CUzI2YR7.js +1 -0
  26. package/assets/_messageId-DiJIuK0Z.js +1 -0
  27. package/assets/_messageId-aGpmi6EA.js +1 -0
  28. package/assets/_outboxMessageId-D9yNQ74_.js +1 -0
  29. package/assets/_recurrenceId-BUk6g_uR.js +1 -0
  30. package/assets/_threadId-BQKxqX_U.js +1 -0
  31. package/assets/_threadId-DNM46Cj0.js +1 -0
  32. package/assets/_threadId-DQ9Ns1qA.js +1 -0
  33. package/assets/{_view._date-BcsaqrBS.js → _view._date-Cb0nAaKf.js} +1 -1
  34. package/assets/{account-service-status-u9m2wO3G.js → account-service-status-C_MJ-o-p.js} +1 -1
  35. package/assets/{accounts-GeT0KphS.js → accounts-CahoQhl7.js} +1 -1
  36. package/assets/advanced-Cf1h5R7s.js +1 -0
  37. package/assets/{agenda-time-C_tFoNHA.js → agenda-time-ACtN6wfF.js} +1 -1
  38. package/assets/{app-chrome-CAqI0L8I.js → app-chrome-Dbvu4ieD.js} +1 -1
  39. package/assets/{appearance-C0uk70LK.js → appearance-BnPvwrqn.js} +1 -1
  40. package/assets/{avatar-BKCZjVnK.js → avatar-BV5vFJ_r.js} +1 -1
  41. package/assets/{badge-BmEPIQJj.js → badge-CbfjHXMg.js} +1 -1
  42. package/assets/{bottom-sheet-CYnEFnuG.js → bottom-sheet-4tvR-sri.js} +1 -1
  43. package/assets/{brief-CT4sagsk.js → brief-DbMpucTQ.js} +1 -1
  44. package/assets/brief-DhhQktQG.js +1 -0
  45. package/assets/calendar-C4YDxHb-.js +1 -0
  46. package/assets/{calendar-W0j7nrh5.js → calendar-CNIMaOb7.js} +1 -1
  47. package/assets/{calendar-event-popup-GQy2blc9.js → calendar-event-popup-CYCnsOds.js} +1 -1
  48. package/assets/{calendar-event-sidebar-BdPLf9Q-.js → calendar-event-sidebar-TTXLpS2C.js} +1 -1
  49. package/assets/{calendar-failure-note-Cc_-yh_l.js → calendar-failure-note-A4rOKZNb.js} +1 -1
  50. package/assets/{calendar-guests-DCkwUUaR.js → calendar-guests-BXmTl5jL.js} +1 -1
  51. package/assets/{calendar-suggestion-w5Buli06.js → calendar-suggestion-cOTOb7Lm.js} +1 -1
  52. package/assets/{calendars-CN_LOe7f.js → calendars-DNlrofPU.js} +1 -1
  53. package/assets/{card-BYFKESRL.js → card-f9A3um0u.js} +1 -1
  54. package/assets/{checkbox-CPr2JwkJ.js → checkbox-BlFhjoed.js} +1 -1
  55. package/assets/chevron-down-UUw56DjM.js +1 -0
  56. package/assets/chevron-left-D5-k3mB7.js +1 -0
  57. package/assets/{circle-check-DyyOWTYB.js → circle-check-BUMxM7Pv.js} +1 -1
  58. package/assets/{circle-check-big-CVlYwPvW.js → circle-check-big-BP7Pn5eb.js} +1 -1
  59. package/assets/{circle-help-BSxYNH4r.js → circle-help-B083hm65.js} +1 -1
  60. package/assets/{clock-DQO0Oi4O.js → clock-8nW9RI8K.js} +1 -1
  61. package/assets/{cloud-off-CUN7xSDU.js → cloud-off-BRk6zo1b.js} +1 -1
  62. package/assets/compose._-_outboxMessageId_-CN2ZUrAe.js +1 -0
  63. package/assets/compose._-_outboxMessageId_-DmK_lXQP.js +1 -0
  64. package/assets/compose._-_outboxMessageId_-Lkfk9hrZ.js +1 -0
  65. package/assets/compose._-_outboxMessageId_-uc2TFREe.js +1 -0
  66. package/assets/{config-import-3qED7KRP.js → config-import-Bk6uFuiN.js} +1 -1
  67. package/assets/{confirm-dialog-DCFAU3wg.js → confirm-dialog-BXhRj5Sm.js} +1 -1
  68. package/assets/{copy-CMEksM9b.js → copy-cdXYXbA6.js} +1 -1
  69. package/assets/{credential-steps-DjMS9JxY.js → credential-steps-B4j2Icsi.js} +1 -1
  70. package/assets/{download-DpUgrnYE.js → download-D9_dvZ6g.js} +1 -1
  71. package/assets/{draft-UntYYkEO.js → draft-BIQ0-Lk_.js} +1 -1
  72. package/assets/edit-DGHa68Jh.js +1 -0
  73. package/assets/edit-cyEdCEG-.js +1 -0
  74. package/assets/{external-link-Dp_vrT3U.js → external-link-Ct6hJ8mI.js} +1 -1
  75. package/assets/{file-json-BXCpWMKO.js → file-json-FJobBXk2.js} +1 -1
  76. package/assets/{filters-BPOqWe_z.js → filters-BAyEbBhi.js} +1 -1
  77. package/assets/{flagged-DOHBcWRm.js → flagged-C439b_WS.js} +1 -1
  78. package/assets/flagged-pJGEDQAe.js +1 -0
  79. package/assets/{folder-input-v9jv3QvB.js → folder-input-DjxVjldz.js} +1 -1
  80. package/assets/folders-CIyVw-EH.js +1 -0
  81. package/assets/{help-copy-BEXklmCF.js → help-copy-YhaxQEIY.js} +1 -1
  82. package/assets/{import-H021ROti.js → import-af_hbF-p.js} +1 -1
  83. package/assets/index-BZPylmnf.js +1 -0
  84. package/assets/{index-KSq98OCk.js → index-BlOq3dK1.js} +4 -4
  85. package/assets/index-BnrEzeaK.js +1 -0
  86. package/assets/index-CUzI2YR7.js +1 -0
  87. package/assets/index-CpjgMzVc.js +1 -0
  88. package/assets/{index-BVIV7uOn.js → index-D94MOpo0.js} +59 -59
  89. package/assets/index-D9j5MCr1.js +1 -0
  90. package/assets/index-DJh02QjC.js +1 -0
  91. package/assets/index-DiJIuK0Z.js +1 -0
  92. package/assets/index-aGpmi6EA.js +1 -0
  93. package/assets/index-g59ADgCj.js +1 -0
  94. package/assets/index-vFdlNYM0.js +1 -0
  95. package/assets/{kbd-CD9WJQDD.js → kbd-cd0_OQ1u.js} +1 -1
  96. package/assets/{label-chip-D6H7mAQZ.js → label-chip-BYIaT-tI.js} +1 -1
  97. package/assets/{labels-B1aYofac.js → labels-DnNxXAR1.js} +1 -1
  98. package/assets/{mail-BXDRGUJS.js → mail-4EQRG36P.js} +1 -1
  99. package/assets/mail-CE3n3sQ0.js +1 -0
  100. package/assets/{menu-Cul_tOCl.js → menu-C3buEsRL.js} +1 -1
  101. package/assets/new-CByizl3m.js +1 -0
  102. package/assets/onboarding-CA8Qn0P1.js +1 -0
  103. package/assets/{onboarding-completion-C5SxIJff.js → onboarding-completion-BxKBJWb5.js} +1 -1
  104. package/assets/outbox-wQ86O6i5.js +1 -0
  105. package/assets/{pencil-D4t_TOKs.js → pencil-Cr6xAk53.js} +1 -1
  106. package/assets/{people-CBau3oq-.js → people-H9fmtU8R.js} +1 -1
  107. package/assets/{plus-BSFg3ibr.js → plus-BEkGxsOV.js} +1 -1
  108. package/assets/{popover-menu-Drk7oRld.js → popover-menu-D1Ggz_nA.js} +1 -1
  109. package/assets/{refresh-cw-CuoE7FSQ.js → refresh-cw-BDamTi58.js} +1 -1
  110. package/assets/{reply-DtObeSB2.js → reply-DPVLqPcI.js} +1 -1
  111. package/assets/{rich-text-Fi0gjjkk.js → rich-text-D3EPlK78.js} +1 -1
  112. package/assets/{rich-text-spellcheck-worker-provider-uKovGi4E.js → rich-text-spellcheck-worker-provider-DPs4YZHA.js} +1 -1
  113. package/assets/{rotate-ccw-9KACcb0y.js → rotate-ccw-Dxx7BcD7.js} +1 -1
  114. package/assets/{roving-focus-WwAX8-VC.js → roving-focus-CJC-AjPO.js} +1 -1
  115. package/assets/{row-actions-C0oNI3Ia.js → row-actions-uPzTjymf.js} +1 -1
  116. package/assets/{search-mirror-CQaPpynv.js → search-mirror-C2_MRHKT.js} +1 -1
  117. package/assets/{search-scope-CuQFKckU.js → search-scope-CdH_SY3a.js} +1 -1
  118. package/assets/{search-token-index-BXdRQHFC.js → search-token-index-DXiN1835.js} +1 -1
  119. package/assets/sections-Dm0mEk9W.js +1 -0
  120. package/assets/security-C1G2I4K2.js +1 -0
  121. package/assets/{segmented-control-DH-yNZtm.js → segmented-control-D_XxaVb8.js} +1 -1
  122. package/assets/{select-CU_oR6rc.js → select-CB3Efp6I.js} +1 -1
  123. package/assets/{senders-OMax5Bsf.js → senders-BPIkrH6Y.js} +1 -1
  124. package/assets/settings-BjSixogd.js +1 -0
  125. package/assets/{settings-screen-FlCW-JB0.js → settings-screen-CF0fiL2l.js} +1 -1
  126. package/assets/{sparkles-D9JSeha5.js → sparkles-rKmhB5Fk.js} +1 -1
  127. package/assets/{suggest-list-MxpHM4zs.js → suggest-list-Dz1MsIYD.js} +1 -1
  128. package/assets/{suggested-vips-CUOrJsvn.js → suggested-vips-idJBB-lA.js} +1 -1
  129. package/assets/{suggestion._suggestionId-BDEu9XtG.js → suggestion._suggestionId-Cn195KCI.js} +1 -1
  130. package/assets/{task._calendarTaskId-glaP1HGu.js → task._calendarTaskId-CzVuyEtm.js} +1 -1
  131. package/assets/{undo-2-BLxVGig8.js → undo-2-BAub6h7R.js} +1 -1
  132. package/assets/{useCalendarData-BHwxEmxu.js → useCalendarData-DQ7oi-nJ.js} +1 -1
  133. package/assets/{useCalendarScheduling-BPs-bAlU.js → useCalendarScheduling-DAb_8yBj.js} +1 -1
  134. package/assets/{useCalendarSuggestions-C4O39URl.js → useCalendarSuggestions-BfA31NJY.js} +1 -1
  135. package/assets/{useCalendarTasks-BYrDBjzg.js → useCalendarTasks-BMPfFFau.js} +1 -1
  136. package/assets/{useDebouncedValue-CQk7uQJy.js → useDebouncedValue-BQRYh_4T.js} +1 -1
  137. package/assets/{useFilters-DXcDtC9M.js → useFilters-IsqJ-AEH.js} +1 -1
  138. package/assets/{useLabels-Ds4FhWUf.js → useLabels-CrZtVj3Y.js} +1 -1
  139. package/assets/{useLayoutTier-CDh6ugx0.js → useLayoutTier-CIlJuePx.js} +1 -1
  140. package/assets/{useMediaQuery-DHHct6HU.js → useMediaQuery-CGZfUxdm.js} +1 -1
  141. package/assets/{useMessageBodyContent-Bz4eLwYW.js → useMessageBodyContent-yhApp3IG.js} +1 -1
  142. package/assets/{useQueries-CFXMrDWB.js → useQueries-CIIHHroC.js} +1 -1
  143. package/assets/{useRefreshControl-CmSuQYeT.js → useRefreshControl-MOracVIf.js} +1 -1
  144. package/assets/{useResultFolderIndex-B-bcuKwK.js → useResultFolderIndex-BjaX8bsI.js} +1 -1
  145. package/assets/{useSignature-ChD8g6V6.js → useSignature-ClOAemBi.js} +1 -1
  146. package/assets/{warnings-DuiY0HQB.js → warnings-BRGgf3x_.js} +4 -4
  147. package/index.html +1 -1
  148. package/package.json +1 -1
  149. package/assets/CalendarQuickCreate-DF0Uxv4V.js +0 -1
  150. package/assets/DesktopChrome-Ciuao7Ro.js +0 -1
  151. package/assets/FlaggedPane-CMZMZWbM.js +0 -1
  152. package/assets/MessageToolbar-BB_mPS4p.js +0 -1
  153. package/assets/OutboxPane-vxvckaxe.js +0 -1
  154. package/assets/_calendarObjectId-CysTJCDO.js +0 -1
  155. package/assets/_mailboxId-sUyLlrph.js +0 -1
  156. package/assets/_messageId-BNOLD_NW.js +0 -1
  157. package/assets/_messageId-C11dYlL_.js +0 -1
  158. package/assets/_messageId-sL5uhmsZ.js +0 -1
  159. package/assets/_outboxMessageId-D8CVGqIw.js +0 -1
  160. package/assets/_recurrenceId-BZ43TEn7.js +0 -1
  161. package/assets/_threadId-CKva01mK.js +0 -1
  162. package/assets/_threadId-Dcu-hZiA.js +0 -1
  163. package/assets/_threadId-mSRKzdYV.js +0 -1
  164. package/assets/advanced-A-kGFwE6.js +0 -1
  165. package/assets/brief-DcVaSAff.js +0 -1
  166. package/assets/calendar-DEqazg7d.js +0 -1
  167. package/assets/chevron-down-BI1fWP0V.js +0 -1
  168. package/assets/chevron-left-BQBw-0xj.js +0 -1
  169. package/assets/compose._-_outboxMessageId_--bw-JQyQ.js +0 -1
  170. package/assets/compose._-_outboxMessageId_-9p2UwGZ2.js +0 -1
  171. package/assets/compose._-_outboxMessageId_-BKX6xXkK.js +0 -1
  172. package/assets/compose._-_outboxMessageId_-CoRtMIvt.js +0 -1
  173. package/assets/edit-C5xc8ZMZ.js +0 -1
  174. package/assets/edit-DY8bOvEH.js +0 -1
  175. package/assets/flagged-B0gfe6c8.js +0 -1
  176. package/assets/folders-WZv8o8Yl.js +0 -1
  177. package/assets/index-B0WA56eY.js +0 -1
  178. package/assets/index-BNOLD_NW.js +0 -1
  179. package/assets/index-BQRB4Hbr.js +0 -1
  180. package/assets/index-BSVI2qk3.js +0 -1
  181. package/assets/index-BTWqd0y1.js +0 -1
  182. package/assets/index-C11dYlL_.js +0 -1
  183. package/assets/index-C9L3Y4ln.js +0 -1
  184. package/assets/index-CMYDLexx.js +0 -1
  185. package/assets/index-Ct_bZm5J.js +0 -1
  186. package/assets/index-cUEB_Vmo.js +0 -1
  187. package/assets/mail-CzYW0cEP.js +0 -1
  188. package/assets/new-CdrTfyYm.js +0 -1
  189. package/assets/onboarding-Bt28IS6_.js +0 -1
  190. package/assets/outbox-C-QNKevV.js +0 -1
  191. package/assets/sections-DssOe_S4.js +0 -1
  192. package/assets/settings-qYifOymR.js +0 -1
  193. package/assets/shield-check-7IzpHero.js +0 -1
@@ -1,4 +1,4 @@
1
- import{b as Fe,ac as z,r as b,j as l,p as C,I as Ve,H as He,dG as ye,e as Ge,ag as We,f as Ye,ah as Xe,cv as qe,bL as Qe,a6 as Ze,t as Je,X as et}from"./index-BVIV7uOn.js";import{K as U}from"./kbd-CD9WJQDD.js";import{i as tt}from"./search-scope-CuQFKckU.js";import{j as st}from"./reply-DtObeSB2.js";import{p as rt,B as nt,b as ot}from"./useMessageBodyContent-Bz4eLwYW.js";const q=[{category:"personal",label:"Personal",tone:"accent",section:1},{category:"uncategorized",label:"Unclassified",tone:"neutral",section:7},{category:"transactional",label:"Transactional",tone:"positive",section:2},{category:"newsletter",label:"Newsletter",tone:"neutral",section:3},{category:"marketing",label:"Marketing",tone:"neutral",section:4},{category:"social",label:"Social",tone:"warning",section:5},{category:"automated",label:"Automated",tone:"neutral",section:6}],vr=[...q].sort((t,e)=>t.section-e.section).map(t=>t.category),ve=t=>Object.fromEntries(q.map(e=>[e.category,t(e)])),Q=ve(t=>t.label),it=ve(t=>t.tone),wr=t=>!t||t==="personal"?null:Q[t];function at(t){return Object.hasOwn(it,t)}function _r(t){return t==="all"||at(t)}const xr=[{id:"all",label:"All",tone:"neutral"},...q.map(t=>({id:t.category,label:t.label,tone:t.tone}))];const Er=Fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);function ct(t,e,s){return Math.max(e,Math.min(t,s))}const v={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Z(t,e,s){return e===0||Math.abs(e)===1/0?Math.pow(t,s*5):t*e*s/(e+s*t)}function J(t,e,s,r=.15){return r===0?ct(t,e,s):t<e?-Z(e-t,s-e,r)+e:t>s?+Z(t-s,s-e,r)+s:t}function lt(t,[e,s],[r,n]){const[[o,i],[c,u]]=t;return[J(e,o,i,r),J(s,c,u,n)]}function ut(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dt(t){var e=ut(t,"string");return typeof e=="symbol"?e:String(e)}function x(t,e,s){return e=dt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ee(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function m(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(s),!0).forEach(function(r){x(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ee(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const we={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function te(t){return t?t[0].toUpperCase()+t.slice(1):""}const ft=["enter","leave"];function ht(t=!1,e){return t&&!ft.includes(e)}function pt(t,e="",s=!1){const r=we[t],n=r&&r[e]||e;return"on"+te(t)+te(n)+(ht(s,n)?"Capture":"")}const mt=["gotpointercapture","lostpointercapture"];function gt(t){let e=t.substring(2).toLowerCase();const s=!!~e.indexOf("passive");s&&(e=e.replace("passive",""));const r=mt.includes(e)?"capturecapture":"capture",n=!!~e.indexOf(r);return n&&(e=e.replace("capture","")),{device:e,capture:n,passive:s}}function bt(t,e=""){const s=we[t],r=s&&s[e]||e;return t+r}function K(t){return"touches"in t}function _e(t){return K(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function yt(t){return Array.from(t.touches).filter(e=>{var s,r;return e.target===t.currentTarget||((s=t.currentTarget)===null||s===void 0||(r=s.contains)===null||r===void 0?void 0:r.call(s,e.target))})}function vt(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function xe(t){return K(t)?vt(t)[0]:t}function wt(t){return yt(t).map(e=>e.identifier)}function F(t){const e=xe(t);return K(t)?e.identifier:e.pointerId}function se(t){const e=xe(t);return[e.clientX,e.clientY]}function _t(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o}=t;Object.assign(e,{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o})}return e}function B(t,...e){return typeof t=="function"?t(...e):t}function xt(){}function Et(...t){return t.length===0?xt:t.length===1?t[0]:function(){let e;for(const s of t)e=s.apply(this,arguments)||e;return e}}function re(t,e){return Object.assign({},e,t||{})}const St=32;class kt{constructor(e,s,r){this.ctrl=e,this.args=s,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:s,ingKey:r,args:n}=this;s[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=n,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const s=this.state,r=this.config;s._active||(this.reset(),this.computeInitial(),s._active=!0,s.target=e.target,s.currentTarget=e.currentTarget,s.lastOffset=r.from?B(r.from,s):s.offset,s.offset=s.lastOffset,s.startTime=s.timeStamp=e.timeStamp)}computeValues(e){const s=this.state;s._values=e,s.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:s,config:r,shared:n}=this;s.args=this.args;let o=0;if(e&&(s.event=e,r.preventDefault&&e.cancelable&&s.event.preventDefault(),s.type=e.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,_t(e)),n.down=n.pressed=n.buttons%2===1||n.touches>0,o=e.timeStamp-s.timeStamp,s.timeStamp=e.timeStamp,s.elapsedTime=s.timeStamp-s.startTime),s._active){const g=s._delta.map(Math.abs);v.addTo(s._distance,g)}this.axisIntent&&this.axisIntent(e);const[i,c]=s._movement,[u,d]=r.threshold,{_step:a,values:f}=s;if(r.hasCustomTransform?(a[0]===!1&&(a[0]=Math.abs(i)>=u&&f[0]),a[1]===!1&&(a[1]=Math.abs(c)>=d&&f[1])):(a[0]===!1&&(a[0]=Math.abs(i)>=u&&Math.sign(i)*u),a[1]===!1&&(a[1]=Math.abs(c)>=d&&Math.sign(c)*d)),s.intentional=a[0]!==!1||a[1]!==!1,!s.intentional)return;const h=[0,0];if(r.hasCustomTransform){const[g,O]=f;h[0]=a[0]!==!1?g-a[0]:0,h[1]=a[1]!==!1?O-a[1]:0}else h[0]=a[0]!==!1?i-a[0]:0,h[1]=a[1]!==!1?c-a[1]:0;this.restrictToAxis&&!s._blocked&&this.restrictToAxis(h);const E=s.offset,y=s._active&&!s._blocked||s.active;y&&(s.first=s._active&&!s.active,s.last=!s._active&&s.active,s.active=n[this.ingKey]=s._active,e&&(s.first&&("bounds"in r&&(s._bounds=B(r.bounds,s)),this.setup&&this.setup()),s.movement=h,this.computeOffset()));const[S,_]=s.offset,[[w,A],[T,D]]=s._bounds;s.overflow=[S<w?-1:S>A?1:0,_<T?-1:_>D?1:0],s._movementBound[0]=s.overflow[0]?s._movementBound[0]===!1?s._movement[0]:s._movementBound[0]:!1,s._movementBound[1]=s.overflow[1]?s._movementBound[1]===!1?s._movement[1]:s._movementBound[1]:!1;const p=s._active?r.rubberband||[0,0]:[0,0];if(s.offset=lt(s._bounds,s.offset,p),s.delta=v.sub(s.offset,E),this.computeMovement(),y&&(!s.last||o>St)){s.delta=v.sub(s.offset,E);const g=s.delta.map(Math.abs);v.addTo(s.distance,g),s.direction=s.delta.map(Math.sign),s._direction=s._delta.map(Math.sign),!s.first&&o>0&&(s.velocity=[g[0]/o,g[1]/o],s.timeDelta=o)}}emit(){const e=this.state,s=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const n=this.handler(m(m(m({},s),e),{},{[this.aliasKey]:e.values}));n!==void 0&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function At([t,e],s){const r=Math.abs(t),n=Math.abs(e);if(r>n&&r>s)return"x";if(n>r&&n>s)return"y"}class Tt extends kt{constructor(...e){super(...e),x(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=v.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=v.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const s=this.state,r=this.config;if(!s.axis&&e){const n=typeof r.axisThreshold=="object"?r.axisThreshold[_e(e)]:r.axisThreshold;s.axis=At(s._movement,n)}s._blocked=(r.lockDirection||!!r.axis)&&!s.axis||!!r.axis&&r.axis!==s.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Ct=t=>t,ne=.15,Ee={enabled(t=!0){return t},eventOptions(t,e,s){return m(m({},s.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[ne,ne];case!1:return[0,0];default:return v.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return v.toVector(t)},transform(t,e,s){const r=t||s.shared.transform;return this.hasCustomTransform=!!r,r||Ct},threshold(t){return v.toVector(t,0)}},Ot=0,j=m(m({},Ee),{},{axis(t,e,{axis:s}){if(this.lockDirection=s==="lock",!this.lockDirection)return s},axisThreshold(t=Ot){return t},bounds(t={}){if(typeof t=="function")return o=>j.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:s=1/0,top:r=-1/0,bottom:n=1/0}=t;return[[e,s],[r,n]]}}),oe={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class Dt extends Tt{constructor(...e){super(...e),x(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const s=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),n={left:s.left-r.left+e.offset[0],right:s.right-r.right+e.offset[0],top:s.top-r.top+e.offset[1],bottom:s.bottom-r.bottom+e.offset[1]};e._bounds=j.bounds(n)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const s=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(s.pointerButtons)?!s.pointerButtons.includes(e.buttons):s.pointerButtons!==-1&&s.pointerButtons!==e.buttons))return;const n=this.ctrl.setEventIds(e);s.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(n&&n.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=F(e),r._pointerActive=!0,this.computeValues(se(e)),this.computeInitial(),s.preventScrollAxis&&_e(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):s.delay>0?(this.setupDelayTrigger(e),s.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const s=this.state;s._active=!0,s._preventScroll=!0,s._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const s=this.state,r=this.config;if(!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;const o=se(e);if(document.pointerLockElement===e.target?s._delta=[e.movementX,e.movementY]:(s._delta=v.sub(o,s._values),this.computeValues(o)),v.addTo(s._movement,s._delta),this.compute(e),s._delayed&&s.intentional){this.timeoutStore.remove("dragDelay"),s.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!s._preventScroll)if(s.axis)if(s.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){s._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const s=this.state,r=this.config;if(!s._active||!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=s._distance;if(s.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,s.tap&&r.filterTaps)s._force=!0;else{const[c,u]=s._delta,[d,a]=s._movement,[f,h]=r.swipe.velocity,[E,y]=r.swipe.distance,S=r.swipe.duration;if(s.elapsedTime<S){const _=Math.abs(c/s.timeDelta),w=Math.abs(u/s.timeDelta);_>f&&Math.abs(d)>E&&(s.swipe[0]=Math.sign(c)),w>h&&Math.abs(a)>y&&(s.swipe[1]=Math.sign(u))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const s=this.config,r=s.device;s.pointerLock&&e.currentTarget.requestPointerLock(),s.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,It(e);const s=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",s),this.eventStore.add(this.sharedConfig.window,"touch","cancel",s),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const s=oe[e.key];if(s){const r=this.state,n=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=s(this.config.keyboardDisplacement,n),r._keyboardActive=!0,v.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in oe&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const s=this.config.device;e(s,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(s,"change",this.pointerMove.bind(this)),e(s,"end",this.pointerUp.bind(this)),e(s,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function It(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const P=typeof window<"u"&&window.document&&window.document.createElement;function Se(){return P&&"ontouchstart"in window}function jt(){return Se()||P&&window.navigator.maxTouchPoints>1}function Pt(){return P&&"onpointerdown"in window}function Lt(){return P&&"exitPointerLock"in window.document}function Nt(){try{return"constructor"in GestureEvent}catch{return!1}}const k={isBrowser:P,gesture:Nt(),touch:Se(),touchscreen:jt(),pointer:Pt(),pointerLock:Lt()},Mt=250,Rt=180,Bt=.5,$t=50,Kt=250,zt=10,ie={mouse:0,touch:0,pen:8},Ut=m(m({},j),{},{device(t,e,{pointer:{touch:s=!1,lock:r=!1,mouse:n=!1}={}}){return this.pointerLock=r&&k.pointerLock,k.touch&&s?"touch":this.pointerLock?"mouse":k.pointer&&!n?"pointer":k.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Mt:void 0,!(!k.touchscreen||s===!1))return t||(s!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:s=!0,buttons:r=1,keys:n=!0}={}}){return this.pointerButtons=r,this.keys=n,!this.pointerLock&&this.device==="pointer"&&s},threshold(t,e,{filterTaps:s=!1,tapsThreshold:r=3,axis:n=void 0}){const o=v.toVector(t,s?r:n?1:0);return this.filterTaps=s,this.tapsThreshold=r,o},swipe({velocity:t=Bt,distance:e=$t,duration:s=Kt}={}){return{velocity:this.transform(v.toVector(t)),distance:this.transform(v.toVector(e)),duration:s}},delay(t=0){switch(t){case!0:return Rt;case!1:return 0;default:return t}},axisThreshold(t){return t?m(m({},ie),t):ie},keyboardDisplacement(t=zt){return t}});m(m({},Ee),{},{device(t,e,{shared:s,pointer:{touch:r=!1}={}}){if(s.target&&!k.touch&&k.gesture)return"gesture";if(k.touch&&r)return"touch";if(k.touchscreen){if(k.pointer)return"pointer";if(k.touch)return"touch"}},bounds(t,e,{scaleBounds:s={},angleBounds:r={}}){const n=i=>{const c=re(B(s,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=re(B(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof s!="function"&&typeof r!="function"?[n(),o()]:i=>[n(i),o(i)]},threshold(t,e,s){return this.lockDirection=s.axis==="lock",v.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});m(m({},j),{},{mouseOnly:(t=!0)=>t});m(m({},j),{},{mouseOnly:(t=!0)=>t});const ke=new Map,G=new Map;function Ae(t){ke.set(t.key,t.engine),G.set(t.key,t.resolver)}const Te={key:"drag",engine:Dt,resolver:Ut};function Ft(t,e){if(t==null)return{};var s={},r=Object.keys(t),n,o;for(o=0;o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&(s[n]=t[n]);return s}function Vt(t,e){if(t==null)return{};var s=Ft(t,e),r,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(s[r]=t[r])}return s}const Ht={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=k.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},Gt=["target","eventOptions","window","enabled","transform"];function R(t={},e){const s={};for(const[r,n]of Object.entries(e))switch(typeof n){case"function":s[r]=n.call(s,t[r],r,t);break;case"object":s[r]=R(t[r],n);break;case"boolean":n&&(s[r]=t[r]);break}return s}function Wt(t,e,s={}){const r=t,{target:n,eventOptions:o,window:i,enabled:c,transform:u}=r,d=Vt(r,Gt);if(s.shared=R({target:n,eventOptions:o,window:i,enabled:c,transform:u},Ht),e){const a=G.get(e);s[e]=R(m({shared:s.shared},d),a)}else for(const a in d){const f=G.get(a);f&&(s[a]=R(m({shared:s.shared},d[a]),f))}return s}class Ce{constructor(e,s){x(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=s}add(e,s,r,n,o){const i=this._listeners,c=bt(s,r),u=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},d=m(m({},u),o);e.addEventListener(c,n,d);const a=()=>{e.removeEventListener(c,n,d),i.delete(a)};return i.add(a),a}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Yt{constructor(){x(this,"_timeouts",new Map)}add(e,s,r=140,...n){this.remove(e),this._timeouts.set(e,window.setTimeout(s,r,...n))}remove(e){const s=this._timeouts.get(e);s&&window.clearTimeout(s)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class Oe{constructor(e){x(this,"gestures",new Set),x(this,"_targetEventStore",new Ce(this)),x(this,"gestureEventStores",{}),x(this,"gestureTimeoutStores",{}),x(this,"handlers",{}),x(this,"config",{}),x(this,"pointerIds",new Set),x(this,"touchIds",new Set),x(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Xt(this,e)}setEventIds(e){if(K(e))return this.touchIds=new Set(wt(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,s){this.handlers=e,this.nativeHandlers=s}applyConfig(e,s){this.config=Wt(e,s,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const s=this.config.shared,r={};let n;if(!(s.target&&(n=s.target(),!n))){if(s.enabled){for(const i of this.gestures){const c=this.config[i],u=ae(r,c.eventOptions,!!n);if(c.enabled){const d=ke.get(i);new d(this,e,i).bind(u)}}const o=ae(r,s.eventOptions,!!n);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](m(m({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=Et(...r[o]);if(!n)return r;for(const o in r){const{device:i,capture:c,passive:u}=gt(o);this._targetEventStore.add(n,i,"",r[o],{capture:c,passive:u})}}}}function I(t,e){t.gestures.add(e),t.gestureEventStores[e]=new Ce(t,e),t.gestureTimeoutStores[e]=new Yt}function Xt(t,e){e.drag&&I(t,"drag"),e.wheel&&I(t,"wheel"),e.scroll&&I(t,"scroll"),e.move&&I(t,"move"),e.pinch&&I(t,"pinch"),e.hover&&I(t,"hover")}const ae=(t,e,s)=>(r,n,o,i={},c=!1)=>{var u,d;const a=(u=i.capture)!==null&&u!==void 0?u:e.capture,f=(d=i.passive)!==null&&d!==void 0?d:e.passive;let h=c?r:pt(r,n,a);s&&f&&(h+="Passive"),t[h]=t[h]||[],t[h].push(o)};function qt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qt(t){var e=qt(t,"string");return typeof e=="symbol"?e:String(e)}function Zt(t,e,s){return e=Qt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ce(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function M(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ce(Object(s),!0).forEach(function(r){Zt(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ce(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}class Jt{constructor(e,s,r,n,o){this._target=e,this._gestureKey=n,this._ctrl=new Oe(s),this._ctrl.applyHandlers(s,o),this._ctrl.applyConfig(M(M({},r),{},{target:e}),n),this._ctrl.effect()}destroy(){this._ctrl.clean()}setConfig(e){this._ctrl.clean(),this._ctrl.applyConfig(M(M({},e),{},{target:this._target}),this._gestureKey),this._ctrl.effect()}}const es=function(e,s,r){return Ae(Te),new Jt(e,{drag:s},r||{},"drag")},V=10,De={axisThreshold:{mouse:V,touch:V,pen:V},swipe:{distance:60,velocity:.3,duration:600},pointer:{keys:!1,capture:!1}};function ts(t,e={},s,r){const n=z.useMemo(()=>new Oe(t),[]);if(n.applyHandlers(t,r),n.applyConfig(e,s),z.useEffect(n.effect.bind(n)),z.useEffect(()=>n.clean.bind(n),[]),e.target===void 0)return n.bind.bind(n)}function ss(t,e){return Ae(Te),ts({drag:t},e||{},"drag")}const W="remit:swipe",rs=b.createContext(!1),ns=1.01,Ie=t=>{const{event:e}=t;if("pointerType"in e&&e.pointerType!=="touch"||e.type!=="pointerup")return null;const s=t.swipe[0];return s<0?"left":s>0?"right":null},je=t=>{const e=window.visualViewport;return e?.addEventListener("resize",t),()=>e?.removeEventListener("resize",t)},Pe=()=>(window.visualViewport?.scale??1)>ns,Sr=({onSwipeLeft:t,onSwipeRight:e})=>{const s=b.useRef(null),r=t!==void 0||e!==void 0,n=b.useSyncExternalStore(je,Pe,()=>!1),o=c=>{c==="left"&&t?.(),c==="right"&&e?.()},i=ss(c=>o(Ie(c)),{...De,axis:"x",enabled:r&&!n});return b.useEffect(()=>{const c=s.current;if(!c||!r||n)return;const u=d=>{if(!(d instanceof CustomEvent))return;const{detail:a}=d;(a==="left"||a==="right")&&o(a)};return c.addEventListener(W,u),()=>c.removeEventListener(W,u)}),{ref:s,bind:i,touchAction:r&&!n?"pan-y pinch-zoom":"auto",enabled:r}},os='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',$={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},is={background:!1,spacing:!1},as="16px",cs=()=>`html{padding:0}body{padding:${as};box-sizing:border-box}`,ls=()=>"html{overflow:hidden}body{overflow-x:auto}",us=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,ds='<meta name="viewport" content="width=device-width, initial-scale=1">',fs=t=>{const e=t?$.dark:$.light;return`
1
+ import{b as Fe,ad as z,r as b,j as l,p as C,I as He,H as Ve,dH as ye,e as Ge,ah as We,f as Ye,ai as Xe,cw as qe,bM as Qe,a7 as Ze,t as Je,X as et}from"./index-D94MOpo0.js";import{K as U}from"./kbd-cd0_OQ1u.js";import{i as tt}from"./search-scope-CdH_SY3a.js";import{j as st}from"./reply-DPVLqPcI.js";import{p as rt,B as nt,b as ot}from"./useMessageBodyContent-yhApp3IG.js";const q=[{category:"personal",label:"Personal",tone:"accent",section:1},{category:"uncategorized",label:"Unclassified",tone:"neutral",section:7},{category:"transactional",label:"Transactional",tone:"positive",section:2},{category:"newsletter",label:"Newsletter",tone:"neutral",section:3},{category:"marketing",label:"Marketing",tone:"neutral",section:4},{category:"social",label:"Social",tone:"warning",section:5},{category:"automated",label:"Automated",tone:"neutral",section:6}],vr=[...q].sort((t,e)=>t.section-e.section).map(t=>t.category),ve=t=>Object.fromEntries(q.map(e=>[e.category,t(e)])),Q=ve(t=>t.label),it=ve(t=>t.tone),wr=t=>!t||t==="personal"?null:Q[t];function at(t){return Object.hasOwn(it,t)}function _r(t){return t==="all"||at(t)}const xr=[{id:"all",label:"All",tone:"neutral"},...q.map(t=>({id:t.category,label:t.label,tone:t.tone}))];const Er=Fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);function ct(t,e,s){return Math.max(e,Math.min(t,s))}const v={toVector(t,e){return t===void 0&&(t=e),Array.isArray(t)?t:[t,t]},add(t,e){return[t[0]+e[0],t[1]+e[1]]},sub(t,e){return[t[0]-e[0],t[1]-e[1]]},addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function Z(t,e,s){return e===0||Math.abs(e)===1/0?Math.pow(t,s*5):t*e*s/(e+s*t)}function J(t,e,s,r=.15){return r===0?ct(t,e,s):t<e?-Z(e-t,s-e,r)+e:t>s?+Z(t-s,s-e,r)+s:t}function lt(t,[e,s],[r,n]){const[[o,i],[c,u]]=t;return[J(e,o,i,r),J(s,c,u,n)]}function ut(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dt(t){var e=ut(t,"string");return typeof e=="symbol"?e:String(e)}function x(t,e,s){return e=dt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ee(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function m(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ee(Object(s),!0).forEach(function(r){x(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ee(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const we={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function te(t){return t?t[0].toUpperCase()+t.slice(1):""}const ft=["enter","leave"];function ht(t=!1,e){return t&&!ft.includes(e)}function pt(t,e="",s=!1){const r=we[t],n=r&&r[e]||e;return"on"+te(t)+te(n)+(ht(s,n)?"Capture":"")}const mt=["gotpointercapture","lostpointercapture"];function gt(t){let e=t.substring(2).toLowerCase();const s=!!~e.indexOf("passive");s&&(e=e.replace("passive",""));const r=mt.includes(e)?"capturecapture":"capture",n=!!~e.indexOf(r);return n&&(e=e.replace("capture","")),{device:e,capture:n,passive:s}}function bt(t,e=""){const s=we[t],r=s&&s[e]||e;return t+r}function K(t){return"touches"in t}function _e(t){return K(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function yt(t){return Array.from(t.touches).filter(e=>{var s,r;return e.target===t.currentTarget||((s=t.currentTarget)===null||s===void 0||(r=s.contains)===null||r===void 0?void 0:r.call(s,e.target))})}function vt(t){return t.type==="touchend"||t.type==="touchcancel"?t.changedTouches:t.targetTouches}function xe(t){return K(t)?vt(t)[0]:t}function wt(t){return yt(t).map(e=>e.identifier)}function F(t){const e=xe(t);return K(t)?e.identifier:e.pointerId}function se(t){const e=xe(t);return[e.clientX,e.clientY]}function _t(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o}=t;Object.assign(e,{shiftKey:s,altKey:r,metaKey:n,ctrlKey:o})}return e}function B(t,...e){return typeof t=="function"?t(...e):t}function xt(){}function Et(...t){return t.length===0?xt:t.length===1?t[0]:function(){let e;for(const s of t)e=s.apply(this,arguments)||e;return e}}function re(t,e){return Object.assign({},e,t||{})}const St=32;class kt{constructor(e,s,r){this.ctrl=e,this.args=s,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:s,ingKey:r,args:n}=this;s[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=n,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const s=this.state,r=this.config;s._active||(this.reset(),this.computeInitial(),s._active=!0,s.target=e.target,s.currentTarget=e.currentTarget,s.lastOffset=r.from?B(r.from,s):s.offset,s.offset=s.lastOffset,s.startTime=s.timeStamp=e.timeStamp)}computeValues(e){const s=this.state;s._values=e,s.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:s,config:r,shared:n}=this;s.args=this.args;let o=0;if(e&&(s.event=e,r.preventDefault&&e.cancelable&&s.event.preventDefault(),s.type=e.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,_t(e)),n.down=n.pressed=n.buttons%2===1||n.touches>0,o=e.timeStamp-s.timeStamp,s.timeStamp=e.timeStamp,s.elapsedTime=s.timeStamp-s.startTime),s._active){const g=s._delta.map(Math.abs);v.addTo(s._distance,g)}this.axisIntent&&this.axisIntent(e);const[i,c]=s._movement,[u,d]=r.threshold,{_step:a,values:f}=s;if(r.hasCustomTransform?(a[0]===!1&&(a[0]=Math.abs(i)>=u&&f[0]),a[1]===!1&&(a[1]=Math.abs(c)>=d&&f[1])):(a[0]===!1&&(a[0]=Math.abs(i)>=u&&Math.sign(i)*u),a[1]===!1&&(a[1]=Math.abs(c)>=d&&Math.sign(c)*d)),s.intentional=a[0]!==!1||a[1]!==!1,!s.intentional)return;const h=[0,0];if(r.hasCustomTransform){const[g,O]=f;h[0]=a[0]!==!1?g-a[0]:0,h[1]=a[1]!==!1?O-a[1]:0}else h[0]=a[0]!==!1?i-a[0]:0,h[1]=a[1]!==!1?c-a[1]:0;this.restrictToAxis&&!s._blocked&&this.restrictToAxis(h);const E=s.offset,y=s._active&&!s._blocked||s.active;y&&(s.first=s._active&&!s.active,s.last=!s._active&&s.active,s.active=n[this.ingKey]=s._active,e&&(s.first&&("bounds"in r&&(s._bounds=B(r.bounds,s)),this.setup&&this.setup()),s.movement=h,this.computeOffset()));const[S,_]=s.offset,[[w,A],[T,D]]=s._bounds;s.overflow=[S<w?-1:S>A?1:0,_<T?-1:_>D?1:0],s._movementBound[0]=s.overflow[0]?s._movementBound[0]===!1?s._movement[0]:s._movementBound[0]:!1,s._movementBound[1]=s.overflow[1]?s._movementBound[1]===!1?s._movement[1]:s._movementBound[1]:!1;const p=s._active?r.rubberband||[0,0]:[0,0];if(s.offset=lt(s._bounds,s.offset,p),s.delta=v.sub(s.offset,E),this.computeMovement(),y&&(!s.last||o>St)){s.delta=v.sub(s.offset,E);const g=s.delta.map(Math.abs);v.addTo(s.distance,g),s.direction=s.delta.map(Math.sign),s._direction=s._delta.map(Math.sign),!s.first&&o>0&&(s.velocity=[g[0]/o,g[1]/o],s.timeDelta=o)}}emit(){const e=this.state,s=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const n=this.handler(m(m(m({},s),e),{},{[this.aliasKey]:e.values}));n!==void 0&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function At([t,e],s){const r=Math.abs(t),n=Math.abs(e);if(r>n&&r>s)return"x";if(n>r&&n>s)return"y"}class Tt extends kt{constructor(...e){super(...e),x(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=v.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=v.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const s=this.state,r=this.config;if(!s.axis&&e){const n=typeof r.axisThreshold=="object"?r.axisThreshold[_e(e)]:r.axisThreshold;s.axis=At(s._movement,n)}s._blocked=(r.lockDirection||!!r.axis)&&!s.axis||!!r.axis&&r.axis!==s.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Ct=t=>t,ne=.15,Ee={enabled(t=!0){return t},eventOptions(t,e,s){return m(m({},s.shared.eventOptions),t)},preventDefault(t=!1){return t},triggerAllEvents(t=!1){return t},rubberband(t=0){switch(t){case!0:return[ne,ne];case!1:return[0,0];default:return v.toVector(t)}},from(t){if(typeof t=="function")return t;if(t!=null)return v.toVector(t)},transform(t,e,s){const r=t||s.shared.transform;return this.hasCustomTransform=!!r,r||Ct},threshold(t){return v.toVector(t,0)}},Ot=0,j=m(m({},Ee),{},{axis(t,e,{axis:s}){if(this.lockDirection=s==="lock",!this.lockDirection)return s},axisThreshold(t=Ot){return t},bounds(t={}){if(typeof t=="function")return o=>j.bounds(t(o));if("current"in t)return()=>t.current;if(typeof HTMLElement=="function"&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:s=1/0,top:r=-1/0,bottom:n=1/0}=t;return[[e,s],[r,n]]}}),oe={ArrowRight:(t,e=1)=>[t*e,0],ArrowLeft:(t,e=1)=>[-1*t*e,0],ArrowUp:(t,e=1)=>[0,-1*t*e],ArrowDown:(t,e=1)=>[0,t*e]};class Dt extends Tt{constructor(...e){super(...e),x(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const s=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),n={left:s.left-r.left+e.offset[0],right:s.right-r.right+e.offset[0],top:s.top-r.top+e.offset[1],bottom:s.bottom-r.bottom+e.offset[1]};e._bounds=j.bounds(n)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const s=this.config,r=this.state;if(e.buttons!=null&&(Array.isArray(s.pointerButtons)?!s.pointerButtons.includes(e.buttons):s.pointerButtons!==-1&&s.pointerButtons!==e.buttons))return;const n=this.ctrl.setEventIds(e);s.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(n&&n.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=F(e),r._pointerActive=!0,this.computeValues(se(e)),this.computeInitial(),s.preventScrollAxis&&_e(e)!=="mouse"?(r._active=!1,this.setupScrollPrevention(e)):s.delay>0?(this.setupDelayTrigger(e),s.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const s=this.state;s._active=!0,s._preventScroll=!0,s._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const s=this.state,r=this.config;if(!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;const o=se(e);if(document.pointerLockElement===e.target?s._delta=[e.movementX,e.movementY]:(s._delta=v.sub(o,s._values),this.computeValues(o)),v.addTo(s._movement,s._delta),this.compute(e),s._delayed&&s.intentional){this.timeoutStore.remove("dragDelay"),s.active=!1,this.startPointerDrag(e);return}if(r.preventScrollAxis&&!s._preventScroll)if(s.axis)if(s.axis===r.preventScrollAxis||r.preventScrollAxis==="xy"){s._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const s=this.state,r=this.config;if(!s._active||!s._pointerActive)return;const n=F(e);if(s._pointerId!==void 0&&n!==s._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=s._distance;if(s.tap=o<=r.tapsThreshold&&i<=r.tapsThreshold,s.tap&&r.filterTaps)s._force=!0;else{const[c,u]=s._delta,[d,a]=s._movement,[f,h]=r.swipe.velocity,[E,y]=r.swipe.distance,S=r.swipe.duration;if(s.elapsedTime<S){const _=Math.abs(c/s.timeDelta),w=Math.abs(u/s.timeDelta);_>f&&Math.abs(d)>E&&(s.swipe[0]=Math.sign(c)),w>h&&Math.abs(a)>y&&(s.swipe[1]=Math.sign(u))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const s=this.config,r=s.device;s.pointerLock&&e.currentTarget.requestPointerLock(),s.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,It(e);const s=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",s),this.eventStore.add(this.sharedConfig.window,"touch","cancel",s),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const s=oe[e.key];if(s){const r=this.state,n=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=s(this.config.keyboardDisplacement,n),r._keyboardActive=!0,v.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in oe&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const s=this.config.device;e(s,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(s,"change",this.pointerMove.bind(this)),e(s,"end",this.pointerUp.bind(this)),e(s,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function It(t){"persist"in t&&typeof t.persist=="function"&&t.persist()}const P=typeof window<"u"&&window.document&&window.document.createElement;function Se(){return P&&"ontouchstart"in window}function jt(){return Se()||P&&window.navigator.maxTouchPoints>1}function Pt(){return P&&"onpointerdown"in window}function Lt(){return P&&"exitPointerLock"in window.document}function Nt(){try{return"constructor"in GestureEvent}catch{return!1}}const k={isBrowser:P,gesture:Nt(),touch:Se(),touchscreen:jt(),pointer:Pt(),pointerLock:Lt()},Mt=250,Rt=180,Bt=.5,$t=50,Kt=250,zt=10,ie={mouse:0,touch:0,pen:8},Ut=m(m({},j),{},{device(t,e,{pointer:{touch:s=!1,lock:r=!1,mouse:n=!1}={}}){return this.pointerLock=r&&k.pointerLock,k.touch&&s?"touch":this.pointerLock?"mouse":k.pointer&&!n?"pointer":k.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Mt:void 0,!(!k.touchscreen||s===!1))return t||(s!==void 0?"y":void 0)},pointerCapture(t,e,{pointer:{capture:s=!0,buttons:r=1,keys:n=!0}={}}){return this.pointerButtons=r,this.keys=n,!this.pointerLock&&this.device==="pointer"&&s},threshold(t,e,{filterTaps:s=!1,tapsThreshold:r=3,axis:n=void 0}){const o=v.toVector(t,s?r:n?1:0);return this.filterTaps=s,this.tapsThreshold=r,o},swipe({velocity:t=Bt,distance:e=$t,duration:s=Kt}={}){return{velocity:this.transform(v.toVector(t)),distance:this.transform(v.toVector(e)),duration:s}},delay(t=0){switch(t){case!0:return Rt;case!1:return 0;default:return t}},axisThreshold(t){return t?m(m({},ie),t):ie},keyboardDisplacement(t=zt){return t}});m(m({},Ee),{},{device(t,e,{shared:s,pointer:{touch:r=!1}={}}){if(s.target&&!k.touch&&k.gesture)return"gesture";if(k.touch&&r)return"touch";if(k.touchscreen){if(k.pointer)return"pointer";if(k.touch)return"touch"}},bounds(t,e,{scaleBounds:s={},angleBounds:r={}}){const n=i=>{const c=re(B(s,i),{min:-1/0,max:1/0});return[c.min,c.max]},o=i=>{const c=re(B(r,i),{min:-1/0,max:1/0});return[c.min,c.max]};return typeof s!="function"&&typeof r!="function"?[n(),o()]:i=>[n(i),o(i)]},threshold(t,e,s){return this.lockDirection=s.axis==="lock",v.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey(t){return t===void 0?"ctrlKey":t},pinchOnWheel(t=!0){return t}});m(m({},j),{},{mouseOnly:(t=!0)=>t});m(m({},j),{},{mouseOnly:(t=!0)=>t});const ke=new Map,G=new Map;function Ae(t){ke.set(t.key,t.engine),G.set(t.key,t.resolver)}const Te={key:"drag",engine:Dt,resolver:Ut};function Ft(t,e){if(t==null)return{};var s={},r=Object.keys(t),n,o;for(o=0;o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&(s[n]=t[n]);return s}function Ht(t,e){if(t==null)return{};var s=Ft(t,e),r,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(s[r]=t[r])}return s}const Vt={target(t){if(t)return()=>"current"in t?t.current:t},enabled(t=!0){return t},window(t=k.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},Gt=["target","eventOptions","window","enabled","transform"];function R(t={},e){const s={};for(const[r,n]of Object.entries(e))switch(typeof n){case"function":s[r]=n.call(s,t[r],r,t);break;case"object":s[r]=R(t[r],n);break;case"boolean":n&&(s[r]=t[r]);break}return s}function Wt(t,e,s={}){const r=t,{target:n,eventOptions:o,window:i,enabled:c,transform:u}=r,d=Ht(r,Gt);if(s.shared=R({target:n,eventOptions:o,window:i,enabled:c,transform:u},Vt),e){const a=G.get(e);s[e]=R(m({shared:s.shared},d),a)}else for(const a in d){const f=G.get(a);f&&(s[a]=R(m({shared:s.shared},d[a]),f))}return s}class Ce{constructor(e,s){x(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=s}add(e,s,r,n,o){const i=this._listeners,c=bt(s,r),u=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},d=m(m({},u),o);e.addEventListener(c,n,d);const a=()=>{e.removeEventListener(c,n,d),i.delete(a)};return i.add(a),a}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Yt{constructor(){x(this,"_timeouts",new Map)}add(e,s,r=140,...n){this.remove(e),this._timeouts.set(e,window.setTimeout(s,r,...n))}remove(e){const s=this._timeouts.get(e);s&&window.clearTimeout(s)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class Oe{constructor(e){x(this,"gestures",new Set),x(this,"_targetEventStore",new Ce(this)),x(this,"gestureEventStores",{}),x(this,"gestureTimeoutStores",{}),x(this,"handlers",{}),x(this,"config",{}),x(this,"pointerIds",new Set),x(this,"touchIds",new Set),x(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),Xt(this,e)}setEventIds(e){if(K(e))return this.touchIds=new Set(wt(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,s){this.handlers=e,this.nativeHandlers=s}applyConfig(e,s){this.config=Wt(e,s,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const s=this.config.shared,r={};let n;if(!(s.target&&(n=s.target(),!n))){if(s.enabled){for(const i of this.gestures){const c=this.config[i],u=ae(r,c.eventOptions,!!n);if(c.enabled){const d=ke.get(i);new d(this,e,i).bind(u)}}const o=ae(r,s.eventOptions,!!n);for(const i in this.nativeHandlers)o(i,"",c=>this.nativeHandlers[i](m(m({},this.state.shared),{},{event:c,args:e})),void 0,!0)}for(const o in r)r[o]=Et(...r[o]);if(!n)return r;for(const o in r){const{device:i,capture:c,passive:u}=gt(o);this._targetEventStore.add(n,i,"",r[o],{capture:c,passive:u})}}}}function I(t,e){t.gestures.add(e),t.gestureEventStores[e]=new Ce(t,e),t.gestureTimeoutStores[e]=new Yt}function Xt(t,e){e.drag&&I(t,"drag"),e.wheel&&I(t,"wheel"),e.scroll&&I(t,"scroll"),e.move&&I(t,"move"),e.pinch&&I(t,"pinch"),e.hover&&I(t,"hover")}const ae=(t,e,s)=>(r,n,o,i={},c=!1)=>{var u,d;const a=(u=i.capture)!==null&&u!==void 0?u:e.capture,f=(d=i.passive)!==null&&d!==void 0?d:e.passive;let h=c?r:pt(r,n,a);s&&f&&(h+="Passive"),t[h]=t[h]||[],t[h].push(o)};function qt(t,e){if(typeof t!="object"||t===null)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qt(t){var e=qt(t,"string");return typeof e=="symbol"?e:String(e)}function Zt(t,e,s){return e=Qt(e),e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ce(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function M(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ce(Object(s),!0).forEach(function(r){Zt(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ce(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}class Jt{constructor(e,s,r,n,o){this._target=e,this._gestureKey=n,this._ctrl=new Oe(s),this._ctrl.applyHandlers(s,o),this._ctrl.applyConfig(M(M({},r),{},{target:e}),n),this._ctrl.effect()}destroy(){this._ctrl.clean()}setConfig(e){this._ctrl.clean(),this._ctrl.applyConfig(M(M({},e),{},{target:this._target}),this._gestureKey),this._ctrl.effect()}}const es=function(e,s,r){return Ae(Te),new Jt(e,{drag:s},r||{},"drag")},H=10,De={axisThreshold:{mouse:H,touch:H,pen:H},swipe:{distance:60,velocity:.3,duration:600},pointer:{keys:!1,capture:!1}};function ts(t,e={},s,r){const n=z.useMemo(()=>new Oe(t),[]);if(n.applyHandlers(t,r),n.applyConfig(e,s),z.useEffect(n.effect.bind(n)),z.useEffect(()=>n.clean.bind(n),[]),e.target===void 0)return n.bind.bind(n)}function ss(t,e){return Ae(Te),ts({drag:t},e||{},"drag")}const W="remit:swipe",rs=b.createContext(!1),ns=1.01,Ie=t=>{const{event:e}=t;if("pointerType"in e&&e.pointerType!=="touch"||e.type!=="pointerup")return null;const s=t.swipe[0];return s<0?"left":s>0?"right":null},je=t=>{const e=window.visualViewport;return e?.addEventListener("resize",t),()=>e?.removeEventListener("resize",t)},Pe=()=>(window.visualViewport?.scale??1)>ns,Sr=({onSwipeLeft:t,onSwipeRight:e})=>{const s=b.useRef(null),r=t!==void 0||e!==void 0,n=b.useSyncExternalStore(je,Pe,()=>!1),o=c=>{c==="left"&&t?.(),c==="right"&&e?.()},i=ss(c=>o(Ie(c)),{...De,axis:"x",enabled:r&&!n});return b.useEffect(()=>{const c=s.current;if(!c||!r||n)return;const u=d=>{if(!(d instanceof CustomEvent))return;const{detail:a}=d;(a==="left"||a==="right")&&o(a)};return c.addEventListener(W,u),()=>c.removeEventListener(W,u)}),{ref:s,bind:i,touchAction:r&&!n?"pan-y pinch-zoom":"auto",enabled:r}},os='"Geist Variable", "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',$={light:{fg:"oklch(0.3 0.025 235)",canvas:"oklch(0.96 0.015 90)",accent:"oklch(0.55 0.14 150)"},dark:{fg:"oklch(0.88 0.02 90)",canvas:"oklch(0.22 0.025 220)",accent:"oklch(0.78 0.16 150)"}},is={background:!1,spacing:!1},as="16px",cs=()=>`html{padding:0}body{padding:${as};box-sizing:border-box}`,ls=()=>"html{overflow:hidden}body{overflow-x:auto}",us=/prefers-color-scheme\s*:\s*dark|color-scheme\s*:\s*[^;}"']*\bdark\b/i,ds='<meta name="viewport" content="width=device-width, initial-scale=1">',fs=t=>{const e=t?$.dark:$.light;return`
2
2
  /* Plain-email base: UI font-stack + theme-aware colors (#424) */
3
3
  html, body {
4
4
  font-family: ${os};
@@ -19,7 +19,7 @@ a, a:visited {
19
19
  color: ${e.accent} !important;
20
20
  text-decoration: underline;
21
21
  }
22
- `},Y="invert(0.92) hue-rotate(180deg)",le=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${Y}}`,hs=(t,e,s)=>{const r=t?$.dark.canvas:$.light.canvas;return s?t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${Y}}body{margin:0}${le}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${Y}}${le}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},ps=(t,e,s,r=is)=>{const n=e==="plain"?fs(s):hs(s,us.test(t),r.background),o=r.spacing?"":cs();return`${ds}<style>${n}</style>${t}<style>${ls()}${o}</style>`},ue=5e4,ms="allow-same-origin allow-popups allow-popups-to-escape-sandbox",de=(t,e,s)=>Math.min(Math.ceil(Math.max(t,e)),s),X=.5,fe=(t,e)=>e>0&&t>e+1?Math.max(e/t,X):1,gs=["box-sizing","width","max-width","transform","transform-origin","margin-bottom","overflow-x"],bs=t=>{for(const i of gs)t.style.removeProperty(i);const e=t.clientWidth,s=t.scrollWidth;if(fe(s,e)===1)return 1;const r=(i,c)=>t.style.setProperty(i,c,"important");r("box-sizing","border-box"),r("max-width","none"),r("width",`${s}px`);const n=Math.max(s,t.scrollWidth),o=fe(n,e);return o>X?r("overflow-x","visible"):r("width",`${e/X}px`),r("transform-origin","0 0"),r("transform",`scale(${o})`),r("margin-bottom",`${-t.offsetHeight*(1-o)}px`),o},ys=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),vs=t=>t===" "?!1:t.length===1?!0:ys.has(t),H=t=>{if(t.metaKey||t.ctrlKey||t.altKey||!vs(t.key))return;const e=t.currentTarget??t.target,s=e?.defaultView?.parent;!s||s===e?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:t.key,code:t.code,shiftKey:t.shiftKey,bubbles:!0,cancelable:!0}))},he=({html:t,variant:e="framed",isDark:s=!1,declares:r,className:n})=>{const o=b.useRef(null),[i,c]=b.useState(0),u=b.useContext(rs),d=b.useMemo(()=>ps(t,e,s,r),[t,e,s,r]);return b.useEffect(()=>{const a=o.current;if(!a)return;const f=()=>{const p=a.contentDocument;if(!p?.body)return;S();const g=p.documentElement,L=bs(p.body)<1?de(p.body.getBoundingClientRect().height,0,ue):de(p.body.scrollHeight,g?.scrollHeight??0,ue);c(N=>N===L?N:L)};let h=0;const E=()=>{cancelAnimationFrame(h),h=requestAnimationFrame(f)},y=p=>{const g=p.documentElement;return Pe()||g.scrollWidth>g.clientWidth+1},S=()=>{const p=a.contentDocument;if(!u||!p?.body)return;const g=y(p)?"auto":"pan-y pinch-zoom";p.documentElement.style.touchAction=g,p.body.style.touchAction=g};let _,w,A;const T=u?je(S):void 0,D=()=>{f(),_?.disconnect(),_=void 0,w?.removeEventListener("keydown",H),w?.removeEventListener("load",f,!0),w=void 0,A?.destroy(),A=void 0;const p=a.contentDocument;p?.body&&(S(),u&&(A=new es(p.documentElement,g=>{const O=Ie(g);O&&a.dispatchEvent(new CustomEvent(W,{bubbles:!0,detail:O}))},{...De,axis:"x",window:p.defaultView??void 0})),_=new ResizeObserver(E),_.observe(p.body),p.documentElement&&_.observe(p.documentElement),p.addEventListener("load",f,!0),p.fonts?.ready.then(f),p.addEventListener("keydown",H),w=p)};return a.addEventListener("load",D),()=>{a.removeEventListener("load",D),w?.removeEventListener("keydown",H),w?.removeEventListener("load",f,!0),_?.disconnect(),A?.destroy(),T?.(),cancelAnimationFrame(h)}},[u]),l.jsx("iframe",{ref:o,title:"Email content",sandbox:ms,srcDoc:d,className:n,style:{width:"100%",border:"none",display:"block",height:i===0?"1px":`${i}px`,colorScheme:"normal"}})},ws=(t,e)=>{const r=t==="newsletter"||t==="marketing"||e;return{framed:r,isPlain:!r}},_s=()=>`
22
+ `},Y="invert(0.92) hue-rotate(180deg)",le=`img,picture,video,svg,canvas,[style*='background-image'],[background]{filter:${Y}}`,hs=(t,e,s)=>{const r=t?$.dark.canvas:$.light.canvas;return s?t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:#ffffff;filter:${Y}}body{margin:0}${le}`:"html,body{margin:0;background-color:#ffffff;color-scheme:light}":t?e?`html,body{margin:0;background-color:${r};color-scheme:dark light}`:`html{margin:0;background-color:${r}}body{margin:0;filter:${Y}}${le}`:`html,body{margin:0;background-color:${r};color-scheme:light}`},ps=(t,e,s,r=is)=>{const n=e==="plain"?fs(s):hs(s,us.test(t),r.background),o=r.spacing?"":cs();return`${ds}<style>${n}</style>${t}<style>${ls()}${o}</style>`},ue=5e4,ms="allow-same-origin allow-popups allow-popups-to-escape-sandbox",de=(t,e,s)=>Math.min(Math.ceil(Math.max(t,e)),s),X=.5,fe=(t,e)=>e>0&&t>e+1?Math.max(e/t,X):1,gs=["box-sizing","width","max-width","transform","transform-origin","margin-bottom","overflow-x"],bs=t=>{for(const i of gs)t.style.removeProperty(i);const e=t.clientWidth,s=t.scrollWidth;if(fe(s,e)===1)return 1;const r=(i,c)=>t.style.setProperty(i,c,"important");r("box-sizing","border-box"),r("max-width","none"),r("width",`${s}px`);const n=Math.max(s,t.scrollWidth),o=fe(n,e);return o>X?r("overflow-x","visible"):r("width",`${e/X}px`),r("transform-origin","0 0"),r("transform",`scale(${o})`),r("margin-bottom",`${-t.offsetHeight*(1-o)}px`),o},ys=new Set(["Enter","Escape","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"]),vs=t=>t===" "?!1:t.length===1?!0:ys.has(t),V=t=>{if(t.metaKey||t.ctrlKey||t.altKey||!vs(t.key))return;const e=t.currentTarget??t.target,s=e?.defaultView?.parent;!s||s===e?.defaultView||s.dispatchEvent(new KeyboardEvent("keydown",{key:t.key,code:t.code,shiftKey:t.shiftKey,bubbles:!0,cancelable:!0}))},he=({html:t,variant:e="framed",isDark:s=!1,declares:r,className:n})=>{const o=b.useRef(null),[i,c]=b.useState(0),u=b.useContext(rs),d=b.useMemo(()=>ps(t,e,s,r),[t,e,s,r]);return b.useEffect(()=>{const a=o.current;if(!a)return;const f=()=>{const p=a.contentDocument;if(!p?.body)return;S();const g=p.documentElement,L=bs(p.body)<1?de(p.body.getBoundingClientRect().height,0,ue):de(p.body.scrollHeight,g?.scrollHeight??0,ue);c(N=>N===L?N:L)};let h=0;const E=()=>{cancelAnimationFrame(h),h=requestAnimationFrame(f)},y=p=>{const g=p.documentElement;return Pe()||g.scrollWidth>g.clientWidth+1},S=()=>{const p=a.contentDocument;if(!u||!p?.body)return;const g=y(p)?"auto":"pan-y pinch-zoom";p.documentElement.style.touchAction=g,p.body.style.touchAction=g};let _,w,A;const T=u?je(S):void 0,D=()=>{f(),_?.disconnect(),_=void 0,w?.removeEventListener("keydown",V),w?.removeEventListener("load",f,!0),w=void 0,A?.destroy(),A=void 0;const p=a.contentDocument;p?.body&&(S(),u&&(A=new es(p.documentElement,g=>{const O=Ie(g);O&&a.dispatchEvent(new CustomEvent(W,{bubbles:!0,detail:O}))},{...De,axis:"x",window:p.defaultView??void 0})),_=new ResizeObserver(E),_.observe(p.body),p.documentElement&&_.observe(p.documentElement),p.addEventListener("load",f,!0),p.fonts?.ready.then(f),p.addEventListener("keydown",V),w=p)};return a.addEventListener("load",D),()=>{a.removeEventListener("load",D),w?.removeEventListener("keydown",V),w?.removeEventListener("load",f,!0),_?.disconnect(),A?.destroy(),T?.(),cancelAnimationFrame(h)}},[u]),l.jsx("iframe",{ref:o,title:"Email content",sandbox:ms,srcDoc:d,className:n,style:{width:"100%",border:"none",display:"block",height:i===0?"1px":`${i}px`,colorScheme:"normal"}})},ws=(t,e)=>{const r=t==="newsletter"||t==="marketing"||e;return{framed:r,isPlain:!r}},_s=()=>`
23
23
  /* Zero the UA default body margin and clamp the document to the iframe width so
24
24
  wide author markup can't push the body (and the page) past the viewport. */
25
25
  html, body {
@@ -81,4 +81,4 @@ pre, code {
81
81
  Image blocked
82
82
  </text>
83
83
  </svg>
84
- `),Ks=t=>t.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),zs=t=>t.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Us=(t={})=>{const e=rt(),s={FORBID_TAGS:Rs,FORBID_ATTR:Bs,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return e.addHook("afterSanitizeAttributes",r=>{if(t.allowExternalImages||(r.tagName==="IMG"&&r.removeAttribute("srcset"),r.tagName==="SOURCE"&&(r.removeAttribute("srcset"),r.removeAttribute("src")),r.tagName==="VIDEO"&&r.removeAttribute("poster")),r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const i=n.slice(4).replace(/^<|>$/g,""),c=t.resolveCid?.(i);c&&(r.setAttribute("src",c),r.classList.add("inline-content"));return}t.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",$s),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",Ks(n))}}),e.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=zs(o)}}),r=>{const n=ks(r),o=Ms(r),i=e.sanitize(r,s);return{html:`<style>${_s()}</style>${i}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},ge=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),kr=({className:t,children:e})=>l.jsx("div",{className:C("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",t),children:e}),Fs=({html:t,text:e,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:i,renderBlockedNotice:c})=>{const u=b.useMemo(()=>!t||typeof document>"u"?null:Us({allowExternalImages:n,resolveCid:o})(t),[t,n,o]),d=u?.html??null,{framed:a,isPlain:f}=ws(r,u?.hasAuthorBackground??!1),h=b.useMemo(()=>({background:u?.hasAuthorBackground??!1,spacing:u?.hasAuthorSpacing??!1}),[u?.hasAuthorBackground,u?.hasAuthorSpacing]),E=b.useMemo(()=>!d||n?0:(d.match(/data-blocked-src/g)||[]).length,[d,n]);return!d&&!e?l.jsx("div",{className:C("message-body",i),children:l.jsx(ge,{})}):l.jsxs("div",{className:C("message-body",i),children:[E>0&&l.jsx("div",{children:c?.(E)}),d?l.jsx("div",{className:"message-body-frame",children:a?l.jsx("div",{className:"w-full max-w-full",children:l.jsx(he,{html:d,variant:"framed",isDark:s,declares:h})}):l.jsx("div",{className:"max-w-full lg:max-w-2xl",children:l.jsx(he,{html:d,variant:f?"plain":"framed",isDark:s,declares:h})})}):e?l.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:e}):l.jsx(ge,{})]})};function Ar({message:t="Select a thread to read",icon:e,showHints:s=!0,className:r}){return l.jsxs("div",{className:C("flex flex-1 flex-col items-center justify-center text-center",r),children:[e??l.jsx(Ve,{className:"size-10 text-fg-subtle"}),l.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:t}),s&&l.jsxs("p",{className:"text-2xs text-fg-subtle",children:[l.jsx(U,{children:"j"})," / ",l.jsx(U,{children:"k"})," to move, ",l.jsx(U,{children:"Enter"})," to open"]})]})}function Re(t){const e=[];let s=-1,r=!1;for(let n=0;n<t.length;n++){const o=t[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&e.push({raw:t.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&e.push({raw:t.slice(s),start:s,end:t.length}),e}const Vs=t=>{if(!t.startsWith('"'))return t;const e=t.slice(1);return e.endsWith('"')?e.slice(0,-1):e};function Hs(t){const e=t.indexOf(":");if(e<=0)return;const s=t.slice(e+1);return{name:t.slice(0,e).toLowerCase(),value:Vs(s),rawValue:s}}const Gs=t=>/[\s"]/.test(t),Ws=t=>Gs(t)?`"${t.replace(/"/g,"")}"`:t,Tr=(t,e)=>`${t}:${Ws(e)}`;function Cr(){const{mailboxNameIndex:t,accountNameIndex:e}=He(),s=st();return{...tt(s)?{}:{mailboxesByName:t},accountsByName:e}}const Ys=Object.values(ye).map(t=>({value:t,label:Q[t]})),Xs={unclassified:"uncategorized"},qs=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:Ys},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],Qs=new Map(qs.map(t=>[t.name,t])),Or=t=>Qs.get(t.toLowerCase()),Zs=/^\d{4}-\d{2}-\d{2}$/;function Js(t,e,s){if(!Zs.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:t,raw:e,value:s,epochSeconds:Math.floor(r/1e3)}}function er(t){const e=t.toLowerCase(),s=Xs[e];return s||Object.values(ye).find(n=>n===e)}function tr(t,e){switch(e.toLowerCase()){case"unread":return{type:"isUnread",raw:t};case"read":return{type:"isRead",raw:t};case"starred":case"flagged":return{type:"isStarred",raw:t};default:return}}function sr(t,e){const s=Hs(t);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:t,value:n};case"subject":return{type:"subject",raw:t,value:n};case"category":{const o=er(n);return o?{type:"category",raw:t,value:n,category:o}:void 0}case"is":return tr(t,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:t}:void 0;case"before":case"after":return Js(r,t,n);case"in":{const o=e.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:t,value:n,mailboxId:o}:void 0}case"account":{const o=e.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:t,value:n,accountId:o}:void 0}default:return}}function Dr(t,e={}){const s=[],r=[];for(const n of Re(t)){const o=sr(n.raw,e);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Ir(t,e){return Re(t).filter(s=>s.raw!==e.raw).map(s=>s.raw).join(" ")}function jr(t){switch(t.type){case"from":return`From: ${t.value}`;case"subject":return`Subject: ${t.value}`;case"category":return`Category: ${Q[t.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${t.value}`;case"after":return`After ${t.value}`;case"in":return`In: ${t.value}`;case"account":return`Account: ${t.value}`}}const Be=(t,e=Date.now())=>({value:t,setAt:e}),rr=(t,e,s,r)=>{if(t.addressId!==e)return t;const n={...t.flags??{}};return s?n.trusted=Be(!0,r):delete n.trusted,{...t,flags:n}},nr=(t,e,s,r)=>{const n=o=>o.map(i=>rr(i,e,s,r));return{...t,envelope:{...t.envelope,from:n(t.envelope.from),to:n(t.envelope.to),cc:n(t.envelope.cc),bcc:n(t.envelope.bcc),replyTo:n(t.envelope.replyTo)}}},or=({messageId:t})=>{const e=Ge(),{pushError:s}=We(),{mutate:r,isPending:n,error:o,reset:i}=Ye({...Qe(),onMutate:async u=>{const d=u.path.addressId,f=u.body.flags?.trusted?.value===!0,h=qe({path:{messageId:t}});await e.cancelQueries({queryKey:h});const E=e.getQueriesData({queryKey:h}).filter(y=>y[1]!==void 0).map(([y,S])=>({queryKey:y,data:S}));return e.setQueriesData({queryKey:h},y=>y&&nr(y,d,f)),{describePrefix:h,previous:E}},onError:(u,d,a)=>{if(a)for(const f of a.previous)e.setQueryData(f.queryKey,f.data);s(Xe("Couldn't trust sender","The change wasn't saved.",u))},onSettled:(u,d,a,f)=>{f&&e.invalidateQueries({queryKey:f.describePrefix})}});return{toggleTrusted:(u,d)=>{r({path:{addressId:u},body:{flags:{trusted:Be(!d)}}})},isPending:n,error:o,reset:i}},ir=()=>{const[t,e]=b.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return b.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{e(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t},ar=(t,e)=>{const s=`${t} image${t>1?"s":""}`;return e?`${s} hidden — you blocked this sender`:`${s} blocked for privacy`},cr=({blockedImageCount:t,canAlwaysTrust:e,isTrustPending:s,isSenderBlocked:r,onLoadOnce:n,onAlwaysTrust:o})=>l.jsxs("div",{"data-testid":"blocked-images-notice",className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[l.jsx("span",{className:"text-fg-muted",children:ar(t,r)}),!r&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:n,className:"text-accent hover:underline",children:"Load once"}),e&&l.jsx("button",{type:"button",onClick:o,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),lr=(t,e)=>{switch(t){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:e}}},ur=t=>t instanceof nt?t.reason:"generic",dr=t=>t instanceof Error?t.message:typeof t=="string"?t:"An unexpected error occurred while loading the message body.",fr=({error:t,onRetry:e})=>{const s=ur(t),r=dr(t),{title:n,detail:o}=lr(s,r),[i,c]=b.useState(!1),{Account:u}=Ze();return i?null:l.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[l.jsx(Je,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-danger",children:n}),l.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&l.jsx(u,{children:({signOut:d})=>l.jsx("button",{type:"button",onClick:()=>d(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),e&&l.jsx("button",{type:"button",onClick:e,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),l.jsx("button",{type:"button",onClick:()=>c(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:l.jsx(et,{className:"size-4","aria-hidden":"true"})})]})]})},hr=()=>l.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),be=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Pr=({bodyParts:t,html:e,text:s,isTrusted:r=!1,isBlocked:n=!1,messageId:o,fromAddressId:i,category:c,className:u})=>{const[d,a]=b.useState(!1),[f,h]=b.useState(o);f!==o&&(h(o),a(!1));const E=!n&&(r||d),y=ir(),{toggleTrusted:S,isPending:_}=or({messageId:o??""}),w=!!t&&t.length>0,{picked:A,data:T,isLoading:D,isError:p,error:g,refetch:O}=ot({messageId:o,bodyParts:t,enabled:w}),L=b.useMemo(()=>xs(t??[]),[t]),N=w&&T?.kind==="html"?T.body:e,$e=w&&T?.kind==="text"?T.body:s;if(w){if(D)return l.jsx("div",{className:C("message-body",u),children:l.jsx(hr,{})});if(p)return l.jsx("div",{className:C("message-body",u),children:l.jsx(fr,{error:g,onRetry:()=>O()})});if(!A)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})})}else if(!e&&!s)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})});const Ke=!!(i&&o),ze=()=>{!i||_||(a(!0),S(i,!1))};return l.jsx(Fs,{className:u,html:N,text:$e,isDark:y,category:c,allowImages:E,resolveCid:L,renderBlockedNotice:Ue=>l.jsx(cr,{blockedImageCount:Ue,canAlwaysTrust:Ke,isTrustPending:_,isSenderBlocked:n,onLoadOnce:()=>a(!0),onAlwaysTrust:ze})})};export{Er as A,vr as C,kr as M,Ar as R,De as S,ss as a,V as b,xr as c,Q as d,it as e,Fs as f,wr as g,Sr as h,rs as i,at as j,or as k,Pr as l,q as m,Re as n,Hs as o,Dr as p,qs as q,Tr as r,Or as s,jr as t,Cr as u,Ir as v,_r as w};
84
+ `),Ks=t=>t.replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),zs=t=>t.replace(/@import[^;]*;/gi,"/* @import blocked */").replace(/url\s*\([^)]*\)/gi,"none").replace(/expression\s*\([^)]*\)/gi,"").replace(/-moz-binding\s*:[^;]*/gi,""),Us=(t={})=>{const e=rt(),s={FORBID_TAGS:Rs,FORBID_ATTR:Bs,ALLOW_DATA_ATTR:!1,ALLOW_UNKNOWN_PROTOCOLS:!1};return e.addHook("afterSanitizeAttributes",r=>{if(t.allowExternalImages||(r.tagName==="IMG"&&r.removeAttribute("srcset"),r.tagName==="SOURCE"&&(r.removeAttribute("srcset"),r.removeAttribute("src")),r.tagName==="VIDEO"&&r.removeAttribute("poster")),r.tagName==="IMG"){const n=r.getAttribute("src")||"";if(n.startsWith("data:"))return;if(n.startsWith("cid:")){const i=n.slice(4).replace(/^<|>$/g,""),c=t.resolveCid?.(i);c&&(r.setAttribute("src",c),r.classList.add("inline-content"));return}t.allowExternalImages||(r.setAttribute("data-blocked-src",n),r.setAttribute("src",$s),r.setAttribute("alt","[Blocked image]"),r.classList.add("blocked-image"))}if(r.tagName==="A"){const n=r.getAttribute("href")||"";if(/^(javascript|data):/i.test(n)){r.removeAttribute("href");return}r.setAttribute("target","_blank"),r.setAttribute("rel","noopener noreferrer nofollow"),r.classList.add("external-link")}if(r.hasAttribute("style")){const n=r.getAttribute("style")||"";r.setAttribute("style",Ks(n))}}),e.addHook("uponSanitizeElement",(r,n)=>{if(n.tagName==="style"){const o=r.textContent||"";r.textContent=zs(o)}}),r=>{const n=ks(r),o=Ms(r),i=e.sanitize(r,s);return{html:`<style>${_s()}</style>${i}`,hasAuthorBackground:n,hasAuthorSpacing:o}}},ge=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),kr=({className:t,children:e})=>l.jsx("div",{className:C("[&_.message-body-frame]:-mx-2 lg:[&_.message-body-frame]:-mx-4",t),children:e}),Fs=({html:t,text:e,isDark:s=!1,category:r,allowImages:n=!1,resolveCid:o,className:i,renderBlockedNotice:c})=>{const u=b.useMemo(()=>!t||typeof document>"u"?null:Us({allowExternalImages:n,resolveCid:o})(t),[t,n,o]),d=u?.html??null,{framed:a,isPlain:f}=ws(r,u?.hasAuthorBackground??!1),h=b.useMemo(()=>({background:u?.hasAuthorBackground??!1,spacing:u?.hasAuthorSpacing??!1}),[u?.hasAuthorBackground,u?.hasAuthorSpacing]),E=b.useMemo(()=>!d||n?0:(d.match(/data-blocked-src/g)||[]).length,[d,n]);return!d&&!e?l.jsx("div",{className:C("message-body",i),children:l.jsx(ge,{})}):l.jsxs("div",{className:C("message-body",i),children:[E>0&&l.jsx("div",{children:c?.(E)}),d?l.jsx("div",{className:"message-body-frame",children:a?l.jsx("div",{className:"w-full max-w-full",children:l.jsx(he,{html:d,variant:"framed",isDark:s,declares:h})}):l.jsx("div",{className:"max-w-full lg:max-w-2xl",children:l.jsx(he,{html:d,variant:f?"plain":"framed",isDark:s,declares:h})})}):e?l.jsx("pre",{className:"email-text whitespace-pre-wrap text-sm leading-relaxed",children:e}):l.jsx(ge,{})]})};function Ar({message:t="Select a thread to read",icon:e,showHints:s=!0,className:r}){return l.jsxs("div",{className:C("flex flex-1 flex-col items-center justify-center text-center",r),children:[e??l.jsx(He,{className:"size-10 text-fg-subtle"}),l.jsx("p",{className:"mt-3 text-sm text-fg-muted",children:t}),s&&l.jsxs("p",{className:"text-2xs text-fg-subtle",children:[l.jsx(U,{children:"j"})," / ",l.jsx(U,{children:"k"})," to move, ",l.jsx(U,{children:"Enter"})," to open"]})]})}function Re(t){const e=[];let s=-1,r=!1;for(let n=0;n<t.length;n++){const o=t[n];if(o==='"'){r=!r,s<0&&(s=n);continue}if(!r&&/\s/.test(o)){s>=0&&e.push({raw:t.slice(s,n),start:s,end:n}),s=-1;continue}s<0&&(s=n)}return s>=0&&e.push({raw:t.slice(s),start:s,end:t.length}),e}const Hs=t=>{if(!t.startsWith('"'))return t;const e=t.slice(1);return e.endsWith('"')?e.slice(0,-1):e};function Vs(t){const e=t.indexOf(":");if(e<=0)return;const s=t.slice(e+1);return{name:t.slice(0,e).toLowerCase(),value:Hs(s),rawValue:s}}const Gs=t=>/[\s"]/.test(t),Ws=t=>Gs(t)?`"${t.replace(/"/g,"")}"`:t,Tr=(t,e)=>`${t}:${Ws(e)}`;function Cr(){const{mailboxNameIndex:t,accountNameIndex:e}=Ve(),s=st();return{...tt(s)?{}:{mailboxesByName:t},accountsByName:e}}const Ys=Object.values(ye).map(t=>({value:t,label:Q[t]})),Xs={unclassified:"uncategorized"},qs=[{name:"from",label:"Sender",values:"contact"},{name:"subject",label:"Subject",values:"text"},{name:"category",label:"Category",values:"fixed",options:Ys},{name:"is",label:"State",values:"fixed",options:[{value:"unread",label:"Unread"},{value:"read",label:"Read"},{value:"starred",label:"Starred"}]},{name:"has",label:"Contents",values:"fixed",options:[{value:"attachment",label:"Has attachment"}]},{name:"in",label:"Folder",values:"mailbox"},{name:"account",label:"Account",values:"account"},{name:"after",label:"Sent on or after",values:"date"},{name:"before",label:"Sent before",values:"date"}],Qs=new Map(qs.map(t=>[t.name,t])),Or=t=>Qs.get(t.toLowerCase()),Zs=/^\d{4}-\d{2}-\d{2}$/;function Js(t,e,s){if(!Zs.test(s))return;const r=Date.parse(`${s}T00:00:00Z`);if(!Number.isNaN(r))return{type:t,raw:e,value:s,epochSeconds:Math.floor(r/1e3)}}function er(t){const e=t.toLowerCase(),s=Xs[e];return s||Object.values(ye).find(n=>n===e)}function tr(t,e){switch(e.toLowerCase()){case"unread":return{type:"isUnread",raw:t};case"read":return{type:"isRead",raw:t};case"starred":case"flagged":return{type:"isStarred",raw:t};default:return}}function sr(t,e){const s=Vs(t);if(!s||s.value.length===0)return;const{name:r,value:n}=s;switch(r){case"from":return{type:"from",raw:t,value:n};case"subject":return{type:"subject",raw:t,value:n};case"category":{const o=er(n);return o?{type:"category",raw:t,value:n,category:o}:void 0}case"is":return tr(t,n);case"has":return n.toLowerCase()==="attachment"?{type:"hasAttachment",raw:t}:void 0;case"before":case"after":return Js(r,t,n);case"in":{const o=e.mailboxesByName?.get(n.toLowerCase());return o?{type:"in",raw:t,value:n,mailboxId:o}:void 0}case"account":{const o=e.accountsByName?.get(n.toLowerCase());return o?{type:"account",raw:t,value:n,accountId:o}:void 0}default:return}}function Dr(t,e={}){const s=[],r=[];for(const n of Re(t)){const o=sr(n.raw,e);o?s.push(o):r.push(n.raw)}return{freeText:r.join(" "),tokens:s}}function Ir(t,e){return Re(t).filter(s=>s.raw!==e.raw).map(s=>s.raw).join(" ")}function jr(t){switch(t.type){case"from":return`From: ${t.value}`;case"subject":return`Subject: ${t.value}`;case"category":return`Category: ${Q[t.category]}`;case"hasAttachment":return"Has attachment";case"isUnread":return"Unread";case"isRead":return"Read";case"isStarred":return"Starred";case"before":return`Before ${t.value}`;case"after":return`After ${t.value}`;case"in":return`In: ${t.value}`;case"account":return`Account: ${t.value}`}}const Be=(t,e=Date.now())=>({value:t,setAt:e}),rr=(t,e,s,r)=>{if(t.addressId!==e)return t;const n={...t.flags??{}};return s?n.trusted=Be(!0,r):delete n.trusted,{...t,flags:n}},nr=(t,e,s,r)=>{const n=o=>o.map(i=>rr(i,e,s,r));return{...t,envelope:{...t.envelope,from:n(t.envelope.from),to:n(t.envelope.to),cc:n(t.envelope.cc),bcc:n(t.envelope.bcc),replyTo:n(t.envelope.replyTo)}}},or=({messageId:t})=>{const e=Ge(),{pushError:s}=We(),{mutate:r,isPending:n,error:o,reset:i}=Ye({...Qe(),onMutate:async u=>{const d=u.path.addressId,f=u.body.flags?.trusted?.value===!0,h=qe({path:{messageId:t}});await e.cancelQueries({queryKey:h});const E=e.getQueriesData({queryKey:h}).filter(y=>y[1]!==void 0).map(([y,S])=>({queryKey:y,data:S}));return e.setQueriesData({queryKey:h},y=>y&&nr(y,d,f)),{describePrefix:h,previous:E}},onError:(u,d,a)=>{if(a)for(const f of a.previous)e.setQueryData(f.queryKey,f.data);s(Xe("Couldn't trust sender","The change wasn't saved.",u))},onSettled:(u,d,a,f)=>{f&&e.invalidateQueries({queryKey:f.describePrefix})}});return{toggleTrusted:(u,d)=>{r({path:{addressId:u},body:{flags:{trusted:Be(!d)}}})},isPending:n,error:o,reset:i}},ir=()=>{const[t,e]=b.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return b.useEffect(()=>{const s=document.documentElement,r=new MutationObserver(()=>{e(s.classList.contains("dark"))});return r.observe(s,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),t},ar=(t,e)=>{const s=`${t} image${t>1?"s":""}`;return e?`${s} hidden — you blocked this sender`:`${s} blocked for privacy`},cr=({blockedImageCount:t,canAlwaysTrust:e,isTrustPending:s,isSenderBlocked:r,onLoadOnce:n,onAlwaysTrust:o})=>l.jsxs("div",{"data-testid":"blocked-images-notice",className:"mb-3 flex items-center justify-between rounded-md bg-surface-sunken/50 px-3 py-2 text-sm",children:[l.jsx("span",{className:"text-fg-muted",children:ar(t,r)}),!r&&l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:n,className:"text-accent hover:underline",children:"Load once"}),e&&l.jsx("button",{type:"button",onClick:o,"aria-busy":s,className:"text-accent hover:underline aria-busy:opacity-50",children:s?"Trusting…":"Always trust"})]})]}),lr=(t,e)=>{switch(t){case"auth":return{title:"Your session expired",detail:"Sign in again to reload the message body. Other parts of the app may also stop responding until you do."};case"body-missing":return{title:"Message body is missing in storage",detail:"A sync failure may have left this message without its body bytes. Contact support, or run the reconcile script to refetch from the upstream IMAP server."};case"content-type-mismatch":return{title:"Couldn't load message body",detail:"The server returned an unexpected content type for this part. The message body has not been rendered to keep you safe."};case"spa-shell-leak":return{title:"Couldn't load message body",detail:"The server returned the app shell instead of the message body. This is an infrastructure bug — please report it."};case"not-ready":return{title:"Message body is still syncing",detail:"This message's body hasn't finished downloading from the mail server yet. It should appear shortly — reopen the message to try again."};default:return{title:"Couldn't load message body",detail:e}}},ur=t=>t instanceof nt?t.reason:"generic",dr=t=>t instanceof Error?t.message:typeof t=="string"?t:"An unexpected error occurred while loading the message body.",fr=({error:t,onRetry:e})=>{const s=ur(t),r=dr(t),{title:n,detail:o}=lr(s,r),[i,c]=b.useState(!1),{Account:u}=Ze();return i?null:l.jsxs("div",{role:"alert","data-testid":"message-body-error-banner","data-reason":s,className:"flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm",children:[l.jsx(Je,{className:"size-4 shrink-0 text-danger mt-0.5","aria-hidden":"true"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-danger",children:n}),l.jsx("p",{className:"text-fg-muted mt-1 break-words",children:o})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s==="auth"&&l.jsx(u,{children:({signOut:d})=>l.jsx("button",{type:"button",onClick:()=>d(),className:"text-sm font-medium text-accent hover:underline",children:"Sign in again"})}),e&&l.jsx("button",{type:"button",onClick:e,className:"text-sm font-medium text-accent hover:underline",children:"Retry"}),l.jsx("button",{type:"button",onClick:()=>c(!0),"aria-label":"Dismiss message body error",className:"rounded-md p-1 text-fg-muted hover:bg-surface-raised hover:text-fg transition-colors",children:l.jsx(et,{className:"size-4","aria-hidden":"true"})})]})]})},hr=()=>l.jsxs("div",{className:"animate-pulse space-y-2",role:"status","aria-label":"Loading message body",children:[l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-full"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-11/12"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-surface-sunken rounded w-5/6"})]}),be=()=>l.jsx("p",{className:"text-fg-muted text-sm italic",children:"This message has no body content."}),Pr=({bodyParts:t,html:e,text:s,isTrusted:r=!1,isBlocked:n=!1,messageId:o,fromAddressId:i,category:c,className:u})=>{const[d,a]=b.useState(!1),[f,h]=b.useState(o);f!==o&&(h(o),a(!1));const E=!n&&(r||d),y=ir(),{toggleTrusted:S,isPending:_}=or({messageId:o??""}),w=!!t&&t.length>0,{picked:A,data:T,isLoading:D,isError:p,error:g,refetch:O}=ot({messageId:o,bodyParts:t,enabled:w}),L=b.useMemo(()=>xs(t??[]),[t]),N=w&&T?.kind==="html"?T.body:e,$e=w&&T?.kind==="text"?T.body:s;if(w){if(D)return l.jsx("div",{className:C("message-body",u),children:l.jsx(hr,{})});if(p)return l.jsx("div",{className:C("message-body",u),children:l.jsx(fr,{error:g,onRetry:()=>O()})});if(!A)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})})}else if(!e&&!s)return l.jsx("div",{className:C("message-body",u),children:l.jsx(be,{})});const Ke=!!(i&&o),ze=()=>{!i||_||(a(!0),S(i,!1))};return l.jsx(Fs,{className:u,html:N,text:$e,isDark:y,category:c,allowImages:E,resolveCid:L,renderBlockedNotice:Ue=>l.jsx(cr,{blockedImageCount:Ue,canAlwaysTrust:Ke,isTrustPending:_,isSenderBlocked:n,onLoadOnce:()=>a(!0),onAlwaysTrust:ze})})};export{Er as A,vr as C,kr as M,Ar as R,De as S,ss as a,H as b,xr as c,Q as d,it as e,Fs as f,wr as g,Sr as h,rs as i,at as j,or as k,Pr as l,q as m,Re as n,Vs as o,Dr as p,qs as q,Tr as r,Or as s,jr as t,Cr as u,Ir as v,_r as w};