@remit/web-client-dist 0.0.689 → 0.0.690

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 (186) hide show
  1. package/assets/{BriefPane-CIgScC6f.js → BriefPane-uF6csCem.js} +1 -1
  2. package/assets/{CalendarEventEditor-Bv8Zwepk.js → CalendarEventEditor-B0SWzPqQ.js} +1 -1
  3. package/assets/{CalendarEventPopup-DzSD-pN5.js → CalendarEventPopup-V9BZRnwN.js} +1 -1
  4. package/assets/{CalendarLoadFailed-DlvWlSvt.js → CalendarLoadFailed-CU4C4nFf.js} +1 -1
  5. package/assets/{CalendarQuickCreate-6gB_5E4G.js → CalendarQuickCreate-CaO2GHZr.js} +1 -1
  6. package/assets/{CalendarSession-DViVPv6J.js → CalendarSession-Ub9ZzsQN.js} +1 -1
  7. package/assets/{DesktopChrome-m6od8Ja9.js → DesktopChrome-H9yEQYFf.js} +1 -1
  8. package/assets/{DropdownMenu-C_eApX94.js → DropdownMenu-CGhv-K3k.js} +1 -1
  9. package/assets/{EmptyState-BL1JRo_I.js → EmptyState-B_Kthrla.js} +1 -1
  10. package/assets/{ErrorState-CKFCoido.js → ErrorState-BB0xpcCi.js} +1 -1
  11. package/assets/{FlaggedPane-B-I6yPP2.js → FlaggedPane-CyyX0x8y.js} +1 -1
  12. package/assets/{FullCompose-_sj778B4.js → FullCompose-sAZlqUaR.js} +1 -1
  13. package/assets/{LabelApplyTrigger-BhX06pIz.js → LabelApplyTrigger-ChzWyjHs.js} +1 -1
  14. package/assets/{MailShell-C_g9w1zh.js → MailShell-DY2Ot0ah.js} +1 -1
  15. package/assets/{MailViewChrome-CvBM49lf.js → MailViewChrome-U9YpZx_B.js} +1 -1
  16. package/assets/{MailboxPane-DI1t1Hak.js → MailboxPane-DszlAx2f.js} +1 -1
  17. package/assets/{MessageBody-Bk3iKnM5.js → MessageBody-zT-at0bi.js} +2 -2
  18. package/assets/MessageToolbar-mGmOl_Xf.js +1 -0
  19. package/assets/{NavMenuButton-BkOzMsgi.js → NavMenuButton-B_c3nIpV.js} +1 -1
  20. package/assets/{OnboardingWizard-Bcxk8WK5.js → OnboardingWizard-ezuAE6sx.js} +1 -1
  21. package/assets/OutboxPane-D47KP_dW.js +1 -0
  22. package/assets/{ReportLink-DlgYSSed.js → ReportLink-C4yyzfnn.js} +1 -1
  23. package/assets/_calendarObjectId-5z-o0pQB.js +1 -0
  24. package/assets/_mailboxId-CBxHNU1m.js +1 -0
  25. package/assets/_messageId-DHvQcDnk.js +1 -0
  26. package/assets/_messageId-Dk8Pv3WS.js +1 -0
  27. package/assets/_messageId-q5-pR6qn.js +1 -0
  28. package/assets/_outboxMessageId-Akv-3HPP.js +1 -0
  29. package/assets/_recurrenceId-DrNRvEqM.js +1 -0
  30. package/assets/{_slotId-DDM7bXIa.js → _slotId-BbhN8swS.js} +1 -1
  31. package/assets/_threadId-9uIkuh2L.js +1 -0
  32. package/assets/_threadId-DdQZmst0.js +1 -0
  33. package/assets/_threadId-mITrrqLR.js +1 -0
  34. package/assets/{_view._date-aunsrlO1.js → _view._date-DyseRkCh.js} +1 -1
  35. package/assets/{account-service-status-BzuS1vKt.js → account-service-status-HIGoykok.js} +1 -1
  36. package/assets/{accounts-LD3DHIQP.js → accounts-DwJx265B.js} +1 -1
  37. package/assets/{advanced-CwHXjE5M.js → advanced-4BQF-R7r.js} +1 -1
  38. package/assets/{agenda-time-wv3Yn4YC.js → agenda-time-hKUG2dhl.js} +1 -1
  39. package/assets/{app-chrome-Ct8iEAKc.js → app-chrome-BI9iJnw3.js} +1 -1
  40. package/assets/{appearance-DXhCiVla.js → appearance-BHnbKYJT.js} +1 -1
  41. package/assets/{avatar-UfQRtoX1.js → avatar-COXPYlBH.js} +1 -1
  42. package/assets/{badge-Ci5wC_7z.js → badge-DLlDkvBl.js} +1 -1
  43. package/assets/{bottom-sheet-BHLpXy8c.js → bottom-sheet-BUOc_BG6.js} +1 -1
  44. package/assets/brief-CJySko3D.js +1 -0
  45. package/assets/{brief-CbjthOAj.js → brief-iq8Ra5O_.js} +1 -1
  46. package/assets/{calendar-C7o1JZFZ.js → calendar-Cmzt0eKc.js} +1 -1
  47. package/assets/{calendar-Dm6uO2dA.js → calendar-DCTglXEB.js} +1 -1
  48. package/assets/{calendar-event-popup-C9kH8QF7.js → calendar-event-popup-BvI6Qwla.js} +1 -1
  49. package/assets/{calendar-event-sidebar-B3JdISzb.js → calendar-event-sidebar-Dx3WbbPv.js} +1 -1
  50. package/assets/{calendar-failure-note-CRMNo9aW.js → calendar-failure-note-BRyIsChq.js} +1 -1
  51. package/assets/{calendar-guests-CnGUT-A_.js → calendar-guests-7MqnVXzX.js} +1 -1
  52. package/assets/{calendar-suggestion-CtFQODJx.js → calendar-suggestion-CpOWds4W.js} +1 -1
  53. package/assets/{calendars-fNaRHaAx.js → calendars-CbchUImt.js} +1 -1
  54. package/assets/{card-anoxIkUJ.js → card-XAEgDd1b.js} +1 -1
  55. package/assets/{checkbox-CqsFCQg_.js → checkbox-CzFLh5Dk.js} +1 -1
  56. package/assets/chevron-down-Q4i_URUt.js +1 -0
  57. package/assets/chevron-left-gBxhdHb5.js +1 -0
  58. package/assets/{circle-check-d7R16tcy.js → circle-check-BucqMsie.js} +1 -1
  59. package/assets/{circle-check-big-DLjZoyk0.js → circle-check-big-CDjntmXC.js} +1 -1
  60. package/assets/{circle-help-C8FYparP.js → circle-help-B6Fn573l.js} +1 -1
  61. package/assets/{classification-CRDKgH1K.js → classification-DzmiHklC.js} +1 -1
  62. package/assets/{clock-Bbm6HW1W.js → clock-jwuPTxhb.js} +1 -1
  63. package/assets/compose._-_outboxMessageId_-B7D1W3Sx.js +1 -0
  64. package/assets/compose._-_outboxMessageId_-CO4UJXl9.js +1 -0
  65. package/assets/compose._-_outboxMessageId_-D0T64VP0.js +1 -0
  66. package/assets/compose._-_outboxMessageId_-pcn-0-gQ.js +1 -0
  67. package/assets/{config-import-DC-oD8sZ.js → config-import-DZkZ73sW.js} +1 -1
  68. package/assets/{confirm-dialog-IJNXJDPm.js → confirm-dialog-D33DXPkQ.js} +1 -1
  69. package/assets/{copy-hvuziBW_.js → copy-Be7MLulJ.js} +1 -1
  70. package/assets/{credential-steps-DlMC5KrE.js → credential-steps-MLDe683C.js} +1 -1
  71. package/assets/{download-CG1DfqLR.js → download-BSz8KKlH.js} +1 -1
  72. package/assets/{draft-DNqwi2Zh.js → draft--MHSP3BT.js} +1 -1
  73. package/assets/edit-DCtOcxf9.js +1 -0
  74. package/assets/edit-DbSsj2wh.js +1 -0
  75. package/assets/{external-link-PMyhSgaf.js → external-link-o4VBX-Sp.js} +1 -1
  76. package/assets/{file-json-WnVFOoAJ.js → file-json-B3Qb4sPC.js} +1 -1
  77. package/assets/{filters-DKLKnl_R.js → filters-Mgogmt5O.js} +1 -1
  78. package/assets/{flagged-Bjq-IpS_.js → flagged-C-DEfMAa.js} +1 -1
  79. package/assets/flagged-D0pl5Vka.js +1 -0
  80. package/assets/{folder-input-BOF5ZXG3.js → folder-input-C8-nffA0.js} +1 -1
  81. package/assets/{folders-CBDVbqCE.js → folders-DodnBZua.js} +1 -1
  82. package/assets/{help-copy-pLuI87o4.js → help-copy-DodnPf1K.js} +1 -1
  83. package/assets/{import-LYqvEMAJ.js → import-C-0_jeuq.js} +1 -1
  84. package/assets/{index-BoYUTbor.js → index-9JWzpiiR.js} +10 -10
  85. package/assets/index-BnElevbT.js +1 -0
  86. package/assets/index-DHvQcDnk.js +1 -0
  87. package/assets/index-DcMLhAhx.js +1 -0
  88. package/assets/index-DfAafcCq.js +1 -0
  89. package/assets/index-Dk8Pv3WS.js +1 -0
  90. package/assets/{index-DCmMcCPu.js → index-DqlUjB9k.js} +4 -4
  91. package/assets/index-Dvms4bLC.js +1 -0
  92. package/assets/index-DxDWr9QM.js +1 -0
  93. package/assets/index-JdYKPBmV.js +1 -0
  94. package/assets/index-Tl1Nlwxt.js +1 -0
  95. package/assets/index-q5-pR6qn.js +1 -0
  96. package/assets/{kbd-CdSSr8_e.js → kbd-D_0s6Sx_.js} +1 -1
  97. package/assets/{label-chip-5FAmbl-0.js → label-chip-zJi2r8mQ.js} +1 -1
  98. package/assets/{labels-CMfUV9F8.js → labels-BLy-VSyB.js} +1 -1
  99. package/assets/{mail-S3HHCKeG.js → mail-Bh469T8t.js} +1 -1
  100. package/assets/{mail-VDHZ9yHE.js → mail-CXavFmSm.js} +1 -1
  101. package/assets/{menu-BoWQGjnP.js → menu-Dro5vzLW.js} +1 -1
  102. package/assets/{nav-link-Bdfj8Qsa.js → nav-link-8l24_oWF.js} +1 -1
  103. package/assets/new-D7laO9Pg.js +1 -0
  104. package/assets/onboarding-D-4ZdWHj.js +1 -0
  105. package/assets/{onboarding-completion-DapNqjan.js → onboarding-completion-Z1EOTA33.js} +1 -1
  106. package/assets/outbox-DzVji2w9.js +1 -0
  107. package/assets/{pencil-CIMfGyWW.js → pencil-Dz-yZ9zw.js} +1 -1
  108. package/assets/{people-WnhpS7pI.js → people-DoJm1MLz.js} +1 -1
  109. package/assets/{plus-CPYNu12K.js → plus-Cp9K9QJ4.js} +1 -1
  110. package/assets/{popover-menu-BpInrjNp.js → popover-menu-BCEzStJs.js} +1 -1
  111. package/assets/{refresh-cw-DNktlgJw.js → refresh-cw-0FbK4O4v.js} +1 -1
  112. package/assets/{reply-uZv24OMi.js → reply-BUVhW3yq.js} +1 -1
  113. package/assets/{rich-text-Z2SPIW-n.js → rich-text-HpMiPjFH.js} +1 -1
  114. package/assets/{rich-text-spellcheck-worker-provider-C9P5xz-f.js → rich-text-spellcheck-worker-provider-BfhfcGZ2.js} +1 -1
  115. package/assets/{rotate-ccw-BJZUR8Nt.js → rotate-ccw-DCzt84SY.js} +1 -1
  116. package/assets/{roving-focus-yjJNzNce.js → roving-focus-C87O2raY.js} +1 -1
  117. package/assets/{row-actions-PBH1Gp1Q.js → row-actions-cUhOCilI.js} +1 -1
  118. package/assets/{search-mirror-CuvGXRcx.js → search-mirror-B0C9oCpr.js} +1 -1
  119. package/assets/{search-scope-t7_lhEwH.js → search-scope-aZ2AZX-k.js} +1 -1
  120. package/assets/{search-token-index-CocSlVpd.js → search-token-index--Pzg9wI2.js} +1 -1
  121. package/assets/{sections-BlI9KK6M.js → sections-BtFAPYYy.js} +1 -1
  122. package/assets/{segmented-control-a7ri58vM.js → segmented-control-tpWp-yev.js} +1 -1
  123. package/assets/{select-BzudQ-hj.js → select-Dv65Mqkl.js} +1 -1
  124. package/assets/{senders-CjrCpj3s.js → senders-BjvP6Oq9.js} +1 -1
  125. package/assets/settings-fP9o8EL9.js +1 -0
  126. package/assets/{settings-screen-DRlPhwXt.js → settings-screen-DPboZsK5.js} +1 -1
  127. package/assets/{shield-check-CLfzxgNh.js → shield-check-BbF5QmrH.js} +1 -1
  128. package/assets/{suggest-list-D2yVcukg.js → suggest-list-xX77W_hF.js} +1 -1
  129. package/assets/{suggested-vips-D5AG6FUm.js → suggested-vips-DRijwoFY.js} +1 -1
  130. package/assets/{suggestion._suggestionId-CDQ4j2h8.js → suggestion._suggestionId-Ca3k8ej7.js} +1 -1
  131. package/assets/{switch-BTBLx1IK.js → switch-CGmUk-Wh.js} +1 -1
  132. package/assets/{task._calendarTaskId-DQA8KsVJ.js → task._calendarTaskId-CvuxUcFe.js} +1 -1
  133. package/assets/{undo-2-B5wu3SLV.js → undo-2-CGWL2haZ.js} +1 -1
  134. package/assets/{useCalendarData-qfV6gCnL.js → useCalendarData-D07VZ1QE.js} +1 -1
  135. package/assets/{useCalendarScheduling-7KLsotZJ.js → useCalendarScheduling-CnlDrC-W.js} +1 -1
  136. package/assets/{useCalendarSuggestions-BQrUJL_8.js → useCalendarSuggestions-DW7WFMvd.js} +1 -1
  137. package/assets/{useCalendarTasks-97JGdBNu.js → useCalendarTasks-CV-ORktM.js} +1 -1
  138. package/assets/{useDebouncedValue-BMLVeivZ.js → useDebouncedValue-DRrHzwce.js} +1 -1
  139. package/assets/{useFilters-Gs-HP3Pc.js → useFilters-DdYKMP_s.js} +1 -1
  140. package/assets/{useLabels-s52ZXGjz.js → useLabels-ouqsQR1c.js} +1 -1
  141. package/assets/{useLayoutTier-Byf0e8X8.js → useLayoutTier-CeBSbbkD.js} +1 -1
  142. package/assets/{useMediaQuery-Bd0VbOGT.js → useMediaQuery-BzGo-bVp.js} +1 -1
  143. package/assets/{useMessageBodyContent-DECgYR7u.js → useMessageBodyContent-D9UpR1Dh.js} +1 -1
  144. package/assets/{useQueries-wqN_e7rn.js → useQueries-Des6lpmI.js} +1 -1
  145. package/assets/{useRefreshControl-B-sdQjVt.js → useRefreshControl-CWSpNwGo.js} +1 -1
  146. package/assets/{useResultFolderIndex-ETlz8Y4G.js → useResultFolderIndex-DRfqL3r_.js} +1 -1
  147. package/assets/{useSignature-C5PObLcq.js → useSignature-CQsNwcJm.js} +1 -1
  148. package/assets/{warnings-CxANki4C.js → warnings-CDdQ-K5m.js} +1 -1
  149. package/index.html +1 -1
  150. package/package.json +1 -1
  151. package/assets/MessageToolbar-CvppODup.js +0 -1
  152. package/assets/OutboxPane-DIpS2Rm4.js +0 -1
  153. package/assets/_calendarObjectId-CVhLhFXf.js +0 -1
  154. package/assets/_mailboxId-DlqMqGqM.js +0 -1
  155. package/assets/_messageId-DN1DLs0X.js +0 -1
  156. package/assets/_messageId-DVrkUlX2.js +0 -1
  157. package/assets/_messageId-KN8V6cN7.js +0 -1
  158. package/assets/_outboxMessageId-BIrIq3Vo.js +0 -1
  159. package/assets/_recurrenceId-0huvJmsM.js +0 -1
  160. package/assets/_threadId-BSH0itQ1.js +0 -1
  161. package/assets/_threadId-Bp-Ew-3E.js +0 -1
  162. package/assets/_threadId-CdQh_MJ8.js +0 -1
  163. package/assets/brief-BAVboLUI.js +0 -1
  164. package/assets/chevron-down-DGwUrOcf.js +0 -1
  165. package/assets/chevron-left-BW50jo-d.js +0 -1
  166. package/assets/compose._-_outboxMessageId_-B33uCNdX.js +0 -1
  167. package/assets/compose._-_outboxMessageId_-CHBzY_fa.js +0 -1
  168. package/assets/compose._-_outboxMessageId_-D7hd8Tdl.js +0 -1
  169. package/assets/compose._-_outboxMessageId_-DiYwMDkQ.js +0 -1
  170. package/assets/edit-BZa7tCBO.js +0 -1
  171. package/assets/edit-DNs-CH-e.js +0 -1
  172. package/assets/flagged-DF7M44oi.js +0 -1
  173. package/assets/index-6pj7tvZO.js +0 -1
  174. package/assets/index-BWIWbASS.js +0 -1
  175. package/assets/index-BhHZ2hYz.js +0 -1
  176. package/assets/index-CJFN6_qF.js +0 -1
  177. package/assets/index-CKwz4x5U.js +0 -1
  178. package/assets/index-CLJXg4M_.js +0 -1
  179. package/assets/index-DN1DLs0X.js +0 -1
  180. package/assets/index-DVrkUlX2.js +0 -1
  181. package/assets/index-KN8V6cN7.js +0 -1
  182. package/assets/index-icM3qGGf.js +0 -1
  183. package/assets/new-CKTDsGv_.js +0 -1
  184. package/assets/onboarding-DGPNq5IJ.js +0 -1
  185. package/assets/outbox-M7c0xAzB.js +0 -1
  186. package/assets/settings-4eabvjnS.js +0 -1
@@ -1,4 +1,4 @@
1
- import{b as Fe,ag as z,r as b,j as l,p as C,I as Ve,J as He,dR as ye,e as We,ak as Ge,f as Ye,al as Xe,cE as qe,bW as Qe,a7 as Ze,v as Je,X as et}from"./index-BoYUTbor.js";import{K as U}from"./kbd-CdSSr8_e.js";import{i as tt}from"./search-scope-t7_lhEwH.js";import"./nav-link-Bdfj8Qsa.js";import{e as st}from"./reply-uZv24OMi.js";import{p as rt,B as nt,b as ot}from"./useMessageBodyContent-DECgYR7u.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}],wr=[...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),_r=t=>!t||t==="personal"?null:Q[t];function at(t){return Object.hasOwn(it,t)}function xr(t){return t==="all"||at(t)}const Er=[{id:"all",label:"All",tone:"neutral"},...q.map(t=>({id:t.category,label:t.label,tone:t.tone}))];const kr=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 kt=32;class St{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[k,_]=s.offset,[[w,A],[T,D]]=s._bounds;s.overflow=[k<w?-1:k>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>kt)){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 St{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,k=r.swipe.duration;if(s.elapsedTime<k){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 ke(){return P&&"ontouchstart"in window}function jt(){return ke()||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 S={isBrowser:P,gesture:Nt(),touch:ke(),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&&S.pointerLock,S.touch&&s?"touch":this.pointerLock?"mouse":S.pointer&&!n?"pointer":S.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Mt:void 0,!(!S.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&&!S.touch&&S.gesture)return"gesture";if(S.touch&&r)return"touch";if(S.touchscreen){if(S.pointer)return"pointer";if(S.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 Se=new Map,W=new Map;function Ae(t){Se.set(t.key,t.engine),W.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=S.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},Wt=["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 Gt(t,e,s={}){const r=t,{target:n,eventOptions:o,window:i,enabled:c,transform:u}=r,d=Vt(r,Wt);if(s.shared=R({target:n,eventOptions:o,window:i,enabled:c,transform:u},Ht),e){const a=W.get(e);s[e]=R(m({shared:s.shared},d),a)}else for(const a in d){const f=W.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=Gt(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=Se.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 G="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(G,u),()=>c.removeEventListener(G,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,ag as z,r as b,j as l,p as C,I as Ve,J as He,dQ as ye,e as We,ak as Ge,f as Ye,al as Xe,cE as Qe,bW as qe,a7 as Ze,v as Je,X as et}from"./index-9JWzpiiR.js";import{K as U}from"./kbd-D_0s6Sx_.js";import{i as tt}from"./search-scope-aZ2AZX-k.js";import"./nav-link-8l24_oWF.js";import{e as st}from"./reply-BUVhW3yq.js";import{p as rt,B as nt,b as ot}from"./useMessageBodyContent-D9UpR1Dh.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}],wr=[...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),_r=t=>!t||t==="personal"?null:q[t];function at(t){return Object.hasOwn(it,t)}function xr(t){return t==="all"||at(t)}const Er=[{id:"all",label:"All",tone:"neutral"},...Q.map(t=>({id:t.category,label:t.label,tone:t.tone}))];const kr=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 kt=32;class St{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[k,_]=s.offset,[[w,A],[T,D]]=s._bounds;s.overflow=[k<w?-1:k>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>kt)){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 St{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,k=r.swipe.duration;if(s.elapsedTime<k){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 ke(){return P&&"ontouchstart"in window}function jt(){return ke()||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 S={isBrowser:P,gesture:Nt(),touch:ke(),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&&S.pointerLock,S.touch&&s?"touch":this.pointerLock?"mouse":S.pointer&&!n?"pointer":S.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:s}){if(this.preventScrollDelay=typeof s=="number"?s:s||s===void 0&&t?Mt:void 0,!(!S.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&&!S.touch&&S.gesture)return"gesture";if(S.touch&&r)return"touch";if(S.touchscreen){if(S.pointer)return"pointer";if(S.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 Se=new Map,W=new Map;function Ae(t){Se.set(t.key,t.engine),W.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=S.isBrowser?window:void 0){return t},eventOptions({passive:t=!0,capture:e=!1}={}){return{passive:t,capture:e}},transform(t){return t}},Wt=["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 Gt(t,e,s={}){const r=t,{target:n,eventOptions:o,window:i,enabled:c,transform:u}=r,d=Vt(r,Wt);if(s.shared=R({target:n,eventOptions:o,window:i,enabled:c,transform:u},Ht),e){const a=W.get(e);s[e]=R(m({shared:s.shared},d),a)}else for(const a in d){const f=W.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=Gt(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=Se.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 G="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(G,u),()=>c.removeEventListener(G,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};
@@ -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=Ss(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."}),Ar=({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 Tr({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 Ws=t=>/[\s"]/.test(t),Gs=t=>Ws(t)?`"${t.replace(/"/g,"")}"`:t,Cr=(t,e)=>`${t}:${Gs(e)}`;function Or(){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])),Dr=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 Ir(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 jr(t,e){return Re(t).filter(s=>s.raw!==e.raw).map(s=>s.raw).join(" ")}function Pr(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=We(),{pushError:s}=Ge(),{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,k])=>({queryKey:y,data:k}));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."}),Lr=({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:k,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),k(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{kr as A,wr as C,Ar as M,Tr as R,De as S,ss as a,V as b,Er as c,Q as d,it as e,Fs as f,_r as g,Sr as h,rs as i,at as j,or as k,Lr as l,q as m,Re as n,Hs as o,Ir as p,qs as q,Cr as r,Dr as s,Pr as t,Or as u,jr as v,xr 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=Ss(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."}),Ar=({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 Tr({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 Ws=t=>/[\s"]/.test(t),Gs=t=>Ws(t)?`"${t.replace(/"/g,"")}"`:t,Cr=(t,e)=>`${t}:${Gs(e)}`;function Or(){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])),Dr=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 Ir(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 jr(t,e){return Re(t).filter(s=>s.raw!==e.raw).map(s=>s.raw).join(" ")}function Pr(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=We(),{pushError:s}=Ge(),{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,k])=>({queryKey:y,data:k}));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."}),Lr=({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:k,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),k(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{kr as A,wr as C,Ar as M,Tr as R,De as S,ss as a,V as b,Er as c,q as d,it as e,Fs as f,_r as g,Sr as h,rs as i,at as j,or as k,Lr as l,Q as m,Re as n,Hs as o,Ir as p,Qs as q,Cr as r,Dr as s,Pr as t,Or as u,jr as v,xr as w};