@openclaw/matrix 2026.7.1-beta.2 → 2026.7.1-beta.5

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 (1070) hide show
  1. package/dist/{account-selection-Bv_ZuOu4.js → account-selection-5e4mHR1m.js} +1 -1
  2. package/dist/api.js +5 -5
  3. package/dist/{approval-handler.runtime-DzpLXVdc.js → approval-handler.runtime-DI5x9r8I.js} +5 -5
  4. package/dist/{approval-ids-R834n6m3.js → approval-ids-ZgqbspmS.js} +1 -1
  5. package/dist/{approval-reaction-auth-eAqCXUFG.js → approval-reaction-auth-D9LijQhr.js} +2 -2
  6. package/dist/{approval-reactions-BRGQgOu2.js → approval-reactions-BdUaUXVw.js} +24 -73
  7. package/dist/auth-presence.js +1 -1
  8. package/dist/{channel-KcNo9qtl.js → channel-jUTBsjHU.js} +20 -18
  9. package/dist/channel-plugin-api.js +1 -1
  10. package/dist/{channel.runtime-DtsGVgZj.js → channel.runtime-DO1Nv9ed.js} +25 -13
  11. package/dist/{cli-Clvpw_8I.js → cli-CEfWwCKx.js} +9 -9
  12. package/dist/{cli-metadata-D3N0Avnt.js → cli-metadata-CfiEO-CE.js} +1 -1
  13. package/dist/cli-metadata.js +1 -1
  14. package/dist/{client-BQz5GcYr.js → client-FRuyCNju.js} +2 -2
  15. package/dist/{client-bootstrap-CBJciU5u.js → client-bootstrap-DjFJ7e0N.js} +1 -2
  16. package/dist/{client-D-5GVz_D.js → client-tgnlQJk4.js} +2 -2
  17. package/dist/{config-schema-Dn-fHID8.js → config-schema-DtnhNYd-.js} +1 -1
  18. package/dist/contract-api.js +2 -2
  19. package/dist/{create-client-DhGid8FE.js → create-client-CNakT7zF.js} +3 -3
  20. package/dist/{credentials-G8lNmiME.js → credentials-Ds9V1mn2.js} +1 -1
  21. package/dist/{credentials-read-TzTOQPOM.js → credentials-read-BlkvsNFg.js} +1 -1
  22. package/dist/{credentials-write.runtime-5PDPPG9f.js → credentials-write.runtime-CTqqxcut.js} +1 -1
  23. package/dist/{crypto-runtime-B7kyrTL0.js → crypto-runtime-B74cTS6A.js} +4 -4
  24. package/dist/{crypto-state-store-DK2tcEyP.js → crypto-state-store-Jy3qwhdy.js} +1 -1
  25. package/dist/{deps-D3bkh48_.js → deps-CdjHvnmh.js} +20 -2
  26. package/dist/{directory-live-Ctu4whZK.js → directory-live-Ufd4qSpX.js} +2 -2
  27. package/dist/{doctor-BRSDNU5C.js → doctor-DfaOqFtr.js} +3 -3
  28. package/dist/{doctor-contract-Dq8OZWHF.js → doctor-contract-BAja_fmb.js} +1 -1
  29. package/dist/doctor-contract-api.js +8 -14
  30. package/dist/{draft-stream-j71tSUu-.js → draft-stream-D4EH25gv.js} +1 -1
  31. package/dist/{encryption-guidance-Bg3IRYoX.js → encryption-guidance-D8walY04.js} +1 -1
  32. package/dist/{file-sync-store-BWLVB01Y.js → file-sync-store-DVm0ACml.js} +3 -3
  33. package/dist/helper-api.js +1 -1
  34. package/dist/{idb-persistence-BGY1CJ7J.js → idb-persistence-BHm97th-.js} +1 -1
  35. package/dist/index.js +1 -1
  36. package/dist/{legacy-crypto-inspector-D_8iylBq.js → legacy-crypto-inspector-vzXSkm18.js} +1 -1
  37. package/dist/{legacy-crypto-restore-B0gcIEkE.js → legacy-crypto-restore-CIBfOmLn.js} +2 -2
  38. package/dist/{matrix-migration.runtime-Ctlb_rZl.js → matrix-migration.runtime-BMCyrANT.js} +3 -3
  39. package/dist/{media-text-XO4VaezT.js → media-text-p-LP21qs.js} +1 -1
  40. package/dist/{messages-nQLGGa1r.js → messages-DRKkiEY-.js} +6 -5
  41. package/dist/{monitor-k3Sko8qt.js → monitor-CsGOGdwu.js} +71 -71
  42. package/dist/plugin-entry.handlers.runtime.js +1 -1
  43. package/dist/probe.runtime-2MZLc6ng.js +3 -0
  44. package/dist/{profile-update-DIOAhezh.js → profile-update-Ucc8RrJL.js} +2 -2
  45. package/dist/{reaction-events-BDsbR82F.js → reaction-events-DentrVii.js} +3 -3
  46. package/dist/{recovery-key-store-BGk8c_gf.js → recovery-key-store-DSeLFvNx.js} +1 -1
  47. package/dist/{resolve-targets-BbrinjHd.js → resolve-targets-DcV_KfgX.js} +1 -1
  48. package/dist/{resolver.runtime-B3N7k_6-.js → resolver.runtime-Hr6bO5zl.js} +1 -1
  49. package/dist/runtime-api.js +2 -2
  50. package/dist/runtime-heavy-api.js +1 -1
  51. package/dist/{sdk-eyqOqjmn.js → sdk-AZYVl34z.js} +8 -6
  52. package/dist/{send-D0hpevF-.js → send-D92v6Yy0.js} +21 -8
  53. package/dist/session-binding-contract-api.js +1 -1
  54. package/dist/{setup-bootstrap-Ihb_DM2a.js → setup-bootstrap-Da564w5f.js} +2 -2
  55. package/dist/{setup-core-D2BQs8w1.js → setup-core-BGgbrdaJ.js} +5 -8
  56. package/dist/setup-plugin-api.js +3 -3
  57. package/dist/{setup-surface-1qf1LZIP.js → setup-surface-iJ6pd-t5.js} +6 -6
  58. package/dist/{shared-BGcaBMK3.js → shared-DkFfq7mH.js} +6 -6
  59. package/dist/{startup-verification-Bd31KqLv.js → startup-verification-BKMAXvcV.js} +2 -2
  60. package/dist/{storage-t5S-5c_5.js → storage-CQdyKcGg.js} +5 -5
  61. package/dist/{thread-bindings-BnuBS0VH.js → thread-bindings-BX5nmWpw.js} +3 -3
  62. package/dist/{tool-actions.runtime-BeUveYxV.js → tool-actions.runtime-C1d5fxE_.js} +12 -12
  63. package/dist/{verification-CNw2K4uT.js → verification-BGCMiO1p.js} +2 -2
  64. package/node_modules/@babel/runtime/package.json +468 -1089
  65. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/.cargo/config.toml +2 -0
  66. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/CHANGELOG.md +12 -3
  67. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/README.md +17 -0
  68. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js +10 -2
  69. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/package.json +1 -1
  70. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/xtask/.idea/modules.xml +8 -0
  71. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/xtask/.idea/vcs.xml +6 -0
  72. package/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/xtask/.idea/xtask.iml +11 -0
  73. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
  74. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +28 -28
  75. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +24 -24
  76. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
  77. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +58 -58
  78. package/node_modules/content-type/README.md +32 -57
  79. package/node_modules/content-type/dist/index.d.ts +26 -0
  80. package/node_modules/content-type/dist/index.js +170 -0
  81. package/node_modules/content-type/dist/index.js.map +1 -0
  82. package/node_modules/content-type/package.json +35 -25
  83. package/node_modules/linkify-it/README.md +3 -4
  84. package/node_modules/linkify-it/build/index.cjs.js +44 -41
  85. package/node_modules/linkify-it/index.mjs +10 -11
  86. package/node_modules/linkify-it/lib/re.mjs +34 -30
  87. package/node_modules/linkify-it/package.json +10 -15
  88. package/node_modules/markdown-it/dist/index.cjs.js +3652 -5378
  89. package/node_modules/markdown-it/dist/index.cjs.js.map +1 -0
  90. package/node_modules/markdown-it/dist/markdown-it.js +1399 -4479
  91. package/node_modules/markdown-it/dist/markdown-it.js.map +1 -0
  92. package/node_modules/markdown-it/dist/markdown-it.min.js +3 -2
  93. package/node_modules/markdown-it/dist/markdown-it.min.js.map +1 -0
  94. package/node_modules/markdown-it/lib/common/html_re.mjs +9 -9
  95. package/node_modules/markdown-it/lib/common/utils.mjs +2 -11
  96. package/node_modules/markdown-it/lib/parser_block.mjs +9 -9
  97. package/node_modules/markdown-it/lib/parser_core.mjs +7 -7
  98. package/node_modules/markdown-it/lib/parser_inline.mjs +16 -16
  99. package/node_modules/markdown-it/lib/renderer.mjs +2 -2
  100. package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +6 -6
  101. package/node_modules/markdown-it/lib/rules_block/code.mjs +2 -2
  102. package/node_modules/markdown-it/lib/rules_block/fence.mjs +4 -4
  103. package/node_modules/markdown-it/lib/rules_block/heading.mjs +7 -7
  104. package/node_modules/markdown-it/lib/rules_block/hr.mjs +2 -2
  105. package/node_modules/markdown-it/lib/rules_block/html_block.mjs +6 -6
  106. package/node_modules/markdown-it/lib/rules_block/lheading.mjs +8 -8
  107. package/node_modules/markdown-it/lib/rules_block/list.mjs +6 -6
  108. package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +5 -5
  109. package/node_modules/markdown-it/lib/rules_block/reference.mjs +1 -1
  110. package/node_modules/markdown-it/lib/rules_block/state_block.mjs +6 -6
  111. package/node_modules/markdown-it/lib/rules_block/table.mjs +4 -4
  112. package/node_modules/markdown-it/lib/rules_core/block.mjs +3 -3
  113. package/node_modules/markdown-it/lib/rules_core/linkify.mjs +15 -15
  114. package/node_modules/markdown-it/lib/rules_core/normalize.mjs +2 -2
  115. package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +17 -17
  116. package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +2 -2
  117. package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +8 -8
  118. package/node_modules/markdown-it/lib/rules_inline/entity.mjs +7 -7
  119. package/node_modules/markdown-it/lib/rules_inline/escape.mjs +15 -1
  120. package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +1 -1
  121. package/node_modules/markdown-it/lib/rules_inline/link.mjs +1 -1
  122. package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +2 -2
  123. package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +10 -10
  124. package/node_modules/markdown-it/lib/token.mjs +12 -12
  125. package/node_modules/markdown-it/package.json +25 -34
  126. package/node_modules/matrix-js-sdk/CHANGELOG.md +24 -0
  127. package/node_modules/matrix-js-sdk/README.md +1 -1
  128. package/node_modules/matrix-js-sdk/lib/@types/AESEncryptedSecretStoragePayload.js +3 -1
  129. package/node_modules/matrix-js-sdk/lib/@types/IIdentityServerProvider.js +3 -1
  130. package/node_modules/matrix-js-sdk/lib/@types/PushRules.js +7 -7
  131. package/node_modules/matrix-js-sdk/lib/@types/PushRules.js.map +1 -1
  132. package/node_modules/matrix-js-sdk/lib/@types/auth.js +4 -4
  133. package/node_modules/matrix-js-sdk/lib/@types/auth.js.map +1 -1
  134. package/node_modules/matrix-js-sdk/lib/@types/beacon.js +2 -2
  135. package/node_modules/matrix-js-sdk/lib/@types/beacon.js.map +1 -1
  136. package/node_modules/matrix-js-sdk/lib/@types/common.js +3 -1
  137. package/node_modules/matrix-js-sdk/lib/@types/crypto.js +3 -1
  138. package/node_modules/matrix-js-sdk/lib/@types/event.d.ts +6 -1
  139. package/node_modules/matrix-js-sdk/lib/@types/event.d.ts.map +1 -1
  140. package/node_modules/matrix-js-sdk/lib/@types/event.js +23 -20
  141. package/node_modules/matrix-js-sdk/lib/@types/event.js.map +1 -1
  142. package/node_modules/matrix-js-sdk/lib/@types/events.js +3 -1
  143. package/node_modules/matrix-js-sdk/lib/@types/extensible_events.js +6 -6
  144. package/node_modules/matrix-js-sdk/lib/@types/extensible_events.js.map +1 -1
  145. package/node_modules/matrix-js-sdk/lib/@types/global.d.js.map +1 -1
  146. package/node_modules/matrix-js-sdk/lib/@types/json.js +3 -1
  147. package/node_modules/matrix-js-sdk/lib/@types/local_notifications.js +3 -1
  148. package/node_modules/matrix-js-sdk/lib/@types/location.js +4 -4
  149. package/node_modules/matrix-js-sdk/lib/@types/location.js.map +1 -1
  150. package/node_modules/matrix-js-sdk/lib/@types/matrix-sdk-crypto-wasm.d.js +3 -1
  151. package/node_modules/matrix-js-sdk/lib/@types/media.js +3 -1
  152. package/node_modules/matrix-js-sdk/lib/@types/membership.js +1 -1
  153. package/node_modules/matrix-js-sdk/lib/@types/membership.js.map +1 -1
  154. package/node_modules/matrix-js-sdk/lib/@types/partials.js +6 -6
  155. package/node_modules/matrix-js-sdk/lib/@types/partials.js.map +1 -1
  156. package/node_modules/matrix-js-sdk/lib/@types/polls.js +5 -5
  157. package/node_modules/matrix-js-sdk/lib/@types/polls.js.map +1 -1
  158. package/node_modules/matrix-js-sdk/lib/@types/read_receipts.js +2 -2
  159. package/node_modules/matrix-js-sdk/lib/@types/read_receipts.js.map +1 -1
  160. package/node_modules/matrix-js-sdk/lib/@types/registration.js +3 -1
  161. package/node_modules/matrix-js-sdk/lib/@types/requests.js +1 -1
  162. package/node_modules/matrix-js-sdk/lib/@types/requests.js.map +1 -1
  163. package/node_modules/matrix-js-sdk/lib/@types/retention.d.ts +15 -0
  164. package/node_modules/matrix-js-sdk/lib/@types/retention.d.ts.map +1 -0
  165. package/node_modules/matrix-js-sdk/lib/@types/retention.js +13 -0
  166. package/node_modules/matrix-js-sdk/lib/@types/retention.js.map +1 -0
  167. package/node_modules/matrix-js-sdk/lib/@types/search.js +1 -1
  168. package/node_modules/matrix-js-sdk/lib/@types/search.js.map +1 -1
  169. package/node_modules/matrix-js-sdk/lib/@types/signed.js +3 -1
  170. package/node_modules/matrix-js-sdk/lib/@types/spaces.js +3 -1
  171. package/node_modules/matrix-js-sdk/lib/@types/state_events.js +3 -1
  172. package/node_modules/matrix-js-sdk/lib/@types/synapse.js +3 -1
  173. package/node_modules/matrix-js-sdk/lib/@types/sync.js +1 -1
  174. package/node_modules/matrix-js-sdk/lib/@types/sync.js.map +1 -1
  175. package/node_modules/matrix-js-sdk/lib/@types/threepids.js +1 -1
  176. package/node_modules/matrix-js-sdk/lib/@types/threepids.js.map +1 -1
  177. package/node_modules/matrix-js-sdk/lib/@types/topic.js +1 -1
  178. package/node_modules/matrix-js-sdk/lib/@types/topic.js.map +1 -1
  179. package/node_modules/matrix-js-sdk/lib/@types/uia.js +3 -1
  180. package/node_modules/matrix-js-sdk/lib/NamespacedValue.js +8 -8
  181. package/node_modules/matrix-js-sdk/lib/NamespacedValue.js.map +1 -1
  182. package/node_modules/matrix-js-sdk/lib/ReEmitter.js +8 -15
  183. package/node_modules/matrix-js-sdk/lib/ReEmitter.js.map +1 -1
  184. package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js +47 -55
  185. package/node_modules/matrix-js-sdk/lib/ToDeviceMessageQueue.js.map +1 -1
  186. package/node_modules/matrix-js-sdk/lib/autodiscovery.js +233 -247
  187. package/node_modules/matrix-js-sdk/lib/autodiscovery.js.map +1 -1
  188. package/node_modules/matrix-js-sdk/lib/base64.js +1 -1
  189. package/node_modules/matrix-js-sdk/lib/base64.js.map +1 -1
  190. package/node_modules/matrix-js-sdk/lib/browser-index.d.ts +2 -2
  191. package/node_modules/matrix-js-sdk/lib/browser-index.d.ts.map +1 -1
  192. package/node_modules/matrix-js-sdk/lib/browser-index.js +5 -5
  193. package/node_modules/matrix-js-sdk/lib/browser-index.js.map +1 -1
  194. package/node_modules/matrix-js-sdk/lib/capabilityPoller.d.ts +38 -0
  195. package/node_modules/matrix-js-sdk/lib/capabilityPoller.d.ts.map +1 -0
  196. package/node_modules/matrix-js-sdk/lib/capabilityPoller.js +93 -0
  197. package/node_modules/matrix-js-sdk/lib/capabilityPoller.js.map +1 -0
  198. package/node_modules/matrix-js-sdk/lib/client.d.ts +9 -8
  199. package/node_modules/matrix-js-sdk/lib/client.d.ts.map +1 -1
  200. package/node_modules/matrix-js-sdk/lib/client.js +2123 -2483
  201. package/node_modules/matrix-js-sdk/lib/client.js.map +1 -1
  202. package/node_modules/matrix-js-sdk/lib/common-crypto/CryptoBackend.js +3 -1
  203. package/node_modules/matrix-js-sdk/lib/common-crypto/CryptoBackend.js.map +1 -1
  204. package/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js.map +1 -1
  205. package/node_modules/matrix-js-sdk/lib/content-helpers.js +43 -48
  206. package/node_modules/matrix-js-sdk/lib/content-helpers.js.map +1 -1
  207. package/node_modules/matrix-js-sdk/lib/content-repo.js +14 -24
  208. package/node_modules/matrix-js-sdk/lib/content-repo.js.map +1 -1
  209. package/node_modules/matrix-js-sdk/lib/crypto/store/base.js +6 -6
  210. package/node_modules/matrix-js-sdk/lib/crypto/store/base.js.map +1 -1
  211. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js +189 -237
  212. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
  213. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js +25 -28
  214. package/node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
  215. package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js +113 -145
  216. package/node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
  217. package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.js +74 -105
  218. package/node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.js.map +1 -1
  219. package/node_modules/matrix-js-sdk/lib/crypto-api/CryptoEvent.js +1 -1
  220. package/node_modules/matrix-js-sdk/lib/crypto-api/CryptoEvent.js.map +1 -1
  221. package/node_modules/matrix-js-sdk/lib/crypto-api/CryptoEventHandlerMap.js +3 -1
  222. package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts +15 -6
  223. package/node_modules/matrix-js-sdk/lib/crypto-api/index.d.ts.map +1 -1
  224. package/node_modules/matrix-js-sdk/lib/crypto-api/index.js +76 -76
  225. package/node_modules/matrix-js-sdk/lib/crypto-api/index.js.map +1 -1
  226. package/node_modules/matrix-js-sdk/lib/crypto-api/key-passphrase.js +15 -23
  227. package/node_modules/matrix-js-sdk/lib/crypto-api/key-passphrase.js.map +1 -1
  228. package/node_modules/matrix-js-sdk/lib/crypto-api/keybackup.js +3 -1
  229. package/node_modules/matrix-js-sdk/lib/crypto-api/recovery-key.js +11 -12
  230. package/node_modules/matrix-js-sdk/lib/crypto-api/recovery-key.js.map +1 -1
  231. package/node_modules/matrix-js-sdk/lib/crypto-api/verification.js +3 -3
  232. package/node_modules/matrix-js-sdk/lib/crypto-api/verification.js.map +1 -1
  233. package/node_modules/matrix-js-sdk/lib/digest.js +7 -14
  234. package/node_modules/matrix-js-sdk/lib/digest.js.map +1 -1
  235. package/node_modules/matrix-js-sdk/lib/embedded.d.ts.map +1 -1
  236. package/node_modules/matrix-js-sdk/lib/embedded.js +379 -500
  237. package/node_modules/matrix-js-sdk/lib/embedded.js.map +1 -1
  238. package/node_modules/matrix-js-sdk/lib/errors.js +2 -2
  239. package/node_modules/matrix-js-sdk/lib/errors.js.map +1 -1
  240. package/node_modules/matrix-js-sdk/lib/event-mapper.js +10 -12
  241. package/node_modules/matrix-js-sdk/lib/event-mapper.js.map +1 -1
  242. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/ExtensibleEvent.js.map +1 -1
  243. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/InvalidEventError.js.map +1 -1
  244. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/MessageEvent.js +26 -28
  245. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/MessageEvent.js.map +1 -1
  246. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollEndEvent.js +11 -12
  247. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollEndEvent.js.map +1 -1
  248. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollResponseEvent.js +6 -6
  249. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollResponseEvent.js.map +1 -1
  250. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollStartEvent.js +36 -38
  251. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/PollStartEvent.js.map +1 -1
  252. package/node_modules/matrix-js-sdk/lib/extensible_events_v1/utilities.js.map +1 -1
  253. package/node_modules/matrix-js-sdk/lib/feature.js +18 -31
  254. package/node_modules/matrix-js-sdk/lib/feature.js.map +1 -1
  255. package/node_modules/matrix-js-sdk/lib/filter-component.d.ts.map +1 -1
  256. package/node_modules/matrix-js-sdk/lib/filter-component.js +20 -26
  257. package/node_modules/matrix-js-sdk/lib/filter-component.js.map +1 -1
  258. package/node_modules/matrix-js-sdk/lib/filter.js +14 -15
  259. package/node_modules/matrix-js-sdk/lib/filter.js.map +1 -1
  260. package/node_modules/matrix-js-sdk/lib/http-api/errors.js +41 -56
  261. package/node_modules/matrix-js-sdk/lib/http-api/errors.js.map +1 -1
  262. package/node_modules/matrix-js-sdk/lib/http-api/fetch.js +140 -157
  263. package/node_modules/matrix-js-sdk/lib/http-api/fetch.js.map +1 -1
  264. package/node_modules/matrix-js-sdk/lib/http-api/index.js +17 -20
  265. package/node_modules/matrix-js-sdk/lib/http-api/index.js.map +1 -1
  266. package/node_modules/matrix-js-sdk/lib/http-api/interface.js +1 -1
  267. package/node_modules/matrix-js-sdk/lib/http-api/interface.js.map +1 -1
  268. package/node_modules/matrix-js-sdk/lib/http-api/method.js +1 -1
  269. package/node_modules/matrix-js-sdk/lib/http-api/method.js.map +1 -1
  270. package/node_modules/matrix-js-sdk/lib/http-api/prefix.js +3 -3
  271. package/node_modules/matrix-js-sdk/lib/http-api/prefix.js.map +1 -1
  272. package/node_modules/matrix-js-sdk/lib/http-api/refresh.js +80 -99
  273. package/node_modules/matrix-js-sdk/lib/http-api/refresh.js.map +1 -1
  274. package/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts +1 -1
  275. package/node_modules/matrix-js-sdk/lib/http-api/utils.d.ts.map +1 -1
  276. package/node_modules/matrix-js-sdk/lib/http-api/utils.js +35 -47
  277. package/node_modules/matrix-js-sdk/lib/http-api/utils.js.map +1 -1
  278. package/node_modules/matrix-js-sdk/lib/index.js.map +1 -1
  279. package/node_modules/matrix-js-sdk/lib/indexeddb-helpers.js +3 -3
  280. package/node_modules/matrix-js-sdk/lib/indexeddb-helpers.js.map +1 -1
  281. package/node_modules/matrix-js-sdk/lib/indexeddb-worker.js.map +1 -1
  282. package/node_modules/matrix-js-sdk/lib/interactive-auth.d.ts +5 -5
  283. package/node_modules/matrix-js-sdk/lib/interactive-auth.d.ts.map +1 -1
  284. package/node_modules/matrix-js-sdk/lib/interactive-auth.js +181 -203
  285. package/node_modules/matrix-js-sdk/lib/interactive-auth.js.map +1 -1
  286. package/node_modules/matrix-js-sdk/lib/logger.js +22 -56
  287. package/node_modules/matrix-js-sdk/lib/logger.js.map +1 -1
  288. package/node_modules/matrix-js-sdk/lib/matrix.d.ts +1 -0
  289. package/node_modules/matrix-js-sdk/lib/matrix.d.ts.map +1 -1
  290. package/node_modules/matrix-js-sdk/lib/matrix.js +8 -11
  291. package/node_modules/matrix-js-sdk/lib/matrix.js.map +1 -1
  292. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js +83 -76
  293. package/node_modules/matrix-js-sdk/lib/matrixrtc/CallMembership.js.map +1 -1
  294. package/node_modules/matrix-js-sdk/lib/matrixrtc/EncryptionManager.js +1 -1
  295. package/node_modules/matrix-js-sdk/lib/matrixrtc/EncryptionManager.js.map +1 -1
  296. package/node_modules/matrix-js-sdk/lib/matrixrtc/IKeyTransport.js +1 -1
  297. package/node_modules/matrix-js-sdk/lib/matrixrtc/IKeyTransport.js.map +1 -1
  298. package/node_modules/matrix-js-sdk/lib/matrixrtc/IMembershipManager.js +1 -1
  299. package/node_modules/matrix-js-sdk/lib/matrixrtc/IMembershipManager.js.map +1 -1
  300. package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.d.ts +1 -1
  301. package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.js +4 -4
  302. package/node_modules/matrix-js-sdk/lib/matrixrtc/LivekitTransport.js.map +1 -1
  303. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
  304. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js +144 -184
  305. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
  306. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js +35 -39
  307. package/node_modules/matrix-js-sdk/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -1
  308. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts +2 -0
  309. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.d.ts.map +1 -1
  310. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js +346 -383
  311. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManager.js.map +1 -1
  312. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.d.ts.map +1 -1
  313. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.js +54 -59
  314. package/node_modules/matrix-js-sdk/lib/matrixrtc/MembershipManagerActionScheduler.js.map +1 -1
  315. package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js +117 -139
  316. package/node_modules/matrix-js-sdk/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
  317. package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js +49 -54
  318. package/node_modules/matrix-js-sdk/lib/matrixrtc/ToDeviceKeyTransport.js.map +1 -1
  319. package/node_modules/matrix-js-sdk/lib/matrixrtc/index.js.map +1 -1
  320. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/common.js +1 -1
  321. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/common.js.map +1 -1
  322. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/index.js.map +1 -1
  323. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js +15 -23
  324. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/rtc.js.map +1 -1
  325. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.js +4 -5
  326. package/node_modules/matrix-js-sdk/lib/matrixrtc/membershipData/session.js.map +1 -1
  327. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js +4 -6
  328. package/node_modules/matrix-js-sdk/lib/matrixrtc/types.js.map +1 -1
  329. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js +4 -11
  330. package/node_modules/matrix-js-sdk/lib/matrixrtc/utils.js.map +1 -1
  331. package/node_modules/matrix-js-sdk/lib/models/MSC3089Branch.js +91 -116
  332. package/node_modules/matrix-js-sdk/lib/models/MSC3089Branch.js.map +1 -1
  333. package/node_modules/matrix-js-sdk/lib/models/MSC3089TreeSpace.js +209 -244
  334. package/node_modules/matrix-js-sdk/lib/models/MSC3089TreeSpace.js.map +1 -1
  335. package/node_modules/matrix-js-sdk/lib/models/ToDeviceMessage.js +3 -1
  336. package/node_modules/matrix-js-sdk/lib/models/beacon.js +20 -15
  337. package/node_modules/matrix-js-sdk/lib/models/beacon.js.map +1 -1
  338. package/node_modules/matrix-js-sdk/lib/models/compare-event-ordering.js +13 -13
  339. package/node_modules/matrix-js-sdk/lib/models/compare-event-ordering.js.map +1 -1
  340. package/node_modules/matrix-js-sdk/lib/models/device.js +10 -3
  341. package/node_modules/matrix-js-sdk/lib/models/device.js.map +1 -1
  342. package/node_modules/matrix-js-sdk/lib/models/event-context.js +5 -7
  343. package/node_modules/matrix-js-sdk/lib/models/event-context.js.map +1 -1
  344. package/node_modules/matrix-js-sdk/lib/models/event-status.js +1 -1
  345. package/node_modules/matrix-js-sdk/lib/models/event-status.js.map +1 -1
  346. package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js +91 -91
  347. package/node_modules/matrix-js-sdk/lib/models/event-timeline-set.js.map +1 -1
  348. package/node_modules/matrix-js-sdk/lib/models/event-timeline.js +31 -29
  349. package/node_modules/matrix-js-sdk/lib/models/event-timeline.js.map +1 -1
  350. package/node_modules/matrix-js-sdk/lib/models/event.js +215 -235
  351. package/node_modules/matrix-js-sdk/lib/models/event.js.map +1 -1
  352. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer-types.js +4 -4
  353. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer-types.js.map +1 -1
  354. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.js +159 -179
  355. package/node_modules/matrix-js-sdk/lib/models/invites-ignorer.js.map +1 -1
  356. package/node_modules/matrix-js-sdk/lib/models/poll.js +72 -78
  357. package/node_modules/matrix-js-sdk/lib/models/poll.js.map +1 -1
  358. package/node_modules/matrix-js-sdk/lib/models/profile-keys.js +2 -2
  359. package/node_modules/matrix-js-sdk/lib/models/profile-keys.js.map +1 -1
  360. package/node_modules/matrix-js-sdk/lib/models/read-receipt.js +40 -56
  361. package/node_modules/matrix-js-sdk/lib/models/read-receipt.js.map +1 -1
  362. package/node_modules/matrix-js-sdk/lib/models/related-relations.js +2 -0
  363. package/node_modules/matrix-js-sdk/lib/models/related-relations.js.map +1 -1
  364. package/node_modules/matrix-js-sdk/lib/models/relations-container.js +20 -21
  365. package/node_modules/matrix-js-sdk/lib/models/relations-container.js.map +1 -1
  366. package/node_modules/matrix-js-sdk/lib/models/relations.js +131 -156
  367. package/node_modules/matrix-js-sdk/lib/models/relations.js.map +1 -1
  368. package/node_modules/matrix-js-sdk/lib/models/room-member.js +44 -27
  369. package/node_modules/matrix-js-sdk/lib/models/room-member.js.map +1 -1
  370. package/node_modules/matrix-js-sdk/lib/models/room-receipts.js +48 -55
  371. package/node_modules/matrix-js-sdk/lib/models/room-receipts.js.map +1 -1
  372. package/node_modules/matrix-js-sdk/lib/models/room-retention.d.ts +28 -0
  373. package/node_modules/matrix-js-sdk/lib/models/room-retention.d.ts.map +1 -0
  374. package/node_modules/matrix-js-sdk/lib/models/room-retention.js +192 -0
  375. package/node_modules/matrix-js-sdk/lib/models/room-retention.js.map +1 -0
  376. package/node_modules/matrix-js-sdk/lib/models/room-state.js +141 -170
  377. package/node_modules/matrix-js-sdk/lib/models/room-state.js.map +1 -1
  378. package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.d.ts +1 -0
  379. package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.d.ts.map +1 -1
  380. package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.js +46 -65
  381. package/node_modules/matrix-js-sdk/lib/models/room-sticky-events.js.map +1 -1
  382. package/node_modules/matrix-js-sdk/lib/models/room-summary.js.map +1 -1
  383. package/node_modules/matrix-js-sdk/lib/models/room.d.ts +2 -1
  384. package/node_modules/matrix-js-sdk/lib/models/room.d.ts.map +1 -1
  385. package/node_modules/matrix-js-sdk/lib/models/room.js +800 -887
  386. package/node_modules/matrix-js-sdk/lib/models/room.js.map +1 -1
  387. package/node_modules/matrix-js-sdk/lib/models/search-result.js +5 -5
  388. package/node_modules/matrix-js-sdk/lib/models/search-result.js.map +1 -1
  389. package/node_modules/matrix-js-sdk/lib/models/thread.js +267 -283
  390. package/node_modules/matrix-js-sdk/lib/models/thread.js.map +1 -1
  391. package/node_modules/matrix-js-sdk/lib/models/typed-event-emitter.js +7 -18
  392. package/node_modules/matrix-js-sdk/lib/models/typed-event-emitter.js.map +1 -1
  393. package/node_modules/matrix-js-sdk/lib/models/user.js +26 -7
  394. package/node_modules/matrix-js-sdk/lib/models/user.js.map +1 -1
  395. package/node_modules/matrix-js-sdk/lib/oidc/authorize.js +208 -241
  396. package/node_modules/matrix-js-sdk/lib/oidc/authorize.js.map +1 -1
  397. package/node_modules/matrix-js-sdk/lib/oidc/discovery.js +23 -36
  398. package/node_modules/matrix-js-sdk/lib/oidc/discovery.js.map +1 -1
  399. package/node_modules/matrix-js-sdk/lib/oidc/error.js +1 -1
  400. package/node_modules/matrix-js-sdk/lib/oidc/error.js.map +1 -1
  401. package/node_modules/matrix-js-sdk/lib/oidc/index.js +1 -0
  402. package/node_modules/matrix-js-sdk/lib/oidc/index.js.map +1 -1
  403. package/node_modules/matrix-js-sdk/lib/oidc/register.js +60 -66
  404. package/node_modules/matrix-js-sdk/lib/oidc/register.js.map +1 -1
  405. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js +83 -94
  406. package/node_modules/matrix-js-sdk/lib/oidc/tokenRefresher.js.map +1 -1
  407. package/node_modules/matrix-js-sdk/lib/oidc/validate.js +18 -18
  408. package/node_modules/matrix-js-sdk/lib/oidc/validate.js.map +1 -1
  409. package/node_modules/matrix-js-sdk/lib/pushprocessor.js +70 -81
  410. package/node_modules/matrix-js-sdk/lib/pushprocessor.js.map +1 -1
  411. package/node_modules/matrix-js-sdk/lib/randomstring.js +9 -9
  412. package/node_modules/matrix-js-sdk/lib/randomstring.js.map +1 -1
  413. package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js +25 -28
  414. package/node_modules/matrix-js-sdk/lib/realtime-callbacks.js.map +1 -1
  415. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.d.ts +2 -0
  416. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.d.ts.map +1 -1
  417. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.js +14 -22
  418. package/node_modules/matrix-js-sdk/lib/receipt-accumulator.js.map +1 -1
  419. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js +272 -298
  420. package/node_modules/matrix-js-sdk/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
  421. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousChannel.js +3 -1
  422. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousCode.js +3 -1
  423. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousError.js.map +1 -1
  424. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousFailureReason.js +2 -2
  425. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousFailureReason.js.map +1 -1
  426. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousIntent.js +1 -1
  427. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousIntent.js.map +1 -1
  428. package/node_modules/matrix-js-sdk/lib/rendezvous/RendezvousTransport.js +3 -1
  429. package/node_modules/matrix-js-sdk/lib/rendezvous/channels/MSC4108SecureChannel.js +122 -144
  430. package/node_modules/matrix-js-sdk/lib/rendezvous/channels/MSC4108SecureChannel.js.map +1 -1
  431. package/node_modules/matrix-js-sdk/lib/rendezvous/index.js +44 -69
  432. package/node_modules/matrix-js-sdk/lib/rendezvous/index.js.map +1 -1
  433. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +1 -1
  434. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js +142 -152
  435. package/node_modules/matrix-js-sdk/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -1
  436. package/node_modules/matrix-js-sdk/lib/retentionPolicy.d.ts +33 -0
  437. package/node_modules/matrix-js-sdk/lib/retentionPolicy.d.ts.map +1 -0
  438. package/node_modules/matrix-js-sdk/lib/retentionPolicy.js +39 -0
  439. package/node_modules/matrix-js-sdk/lib/retentionPolicy.js.map +1 -0
  440. package/node_modules/matrix-js-sdk/lib/room-hierarchy.js +52 -56
  441. package/node_modules/matrix-js-sdk/lib/room-hierarchy.js.map +1 -1
  442. package/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.js +94 -104
  443. package/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.js.map +1 -1
  444. package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js +158 -190
  445. package/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -1
  446. package/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.js +17 -20
  447. package/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.js.map +1 -1
  448. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js +109 -139
  449. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
  450. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.js +72 -86
  451. package/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.js.map +1 -1
  452. package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +1 -1
  453. package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js +195 -221
  454. package/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -1
  455. package/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js +121 -137
  456. package/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js.map +1 -1
  457. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts +7 -2
  458. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.d.ts.map +1 -1
  459. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js +459 -544
  460. package/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js.map +1 -1
  461. package/node_modules/matrix-js-sdk/lib/rust-crypto/constants.js +1 -1
  462. package/node_modules/matrix-js-sdk/lib/rust-crypto/constants.js.map +1 -1
  463. package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js +15 -28
  464. package/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js.map +1 -1
  465. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js +103 -116
  466. package/node_modules/matrix-js-sdk/lib/rust-crypto/index.js.map +1 -1
  467. package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js +303 -365
  468. package/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js.map +1 -1
  469. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts +5 -1
  470. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
  471. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js +1065 -1322
  472. package/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js.map +1 -1
  473. package/node_modules/matrix-js-sdk/lib/rust-crypto/secret-storage.js +12 -25
  474. package/node_modules/matrix-js-sdk/lib/rust-crypto/secret-storage.js.map +1 -1
  475. package/node_modules/matrix-js-sdk/lib/rust-crypto/verification.js +134 -184
  476. package/node_modules/matrix-js-sdk/lib/rust-crypto/verification.js.map +1 -1
  477. package/node_modules/matrix-js-sdk/lib/scheduler.js +42 -17
  478. package/node_modules/matrix-js-sdk/lib/scheduler.js.map +1 -1
  479. package/node_modules/matrix-js-sdk/lib/secret-storage.js +179 -213
  480. package/node_modules/matrix-js-sdk/lib/secret-storage.js.map +1 -1
  481. package/node_modules/matrix-js-sdk/lib/serverCapabilities.d.ts +4 -23
  482. package/node_modules/matrix-js-sdk/lib/serverCapabilities.d.ts.map +1 -1
  483. package/node_modules/matrix-js-sdk/lib/serverCapabilities.js +9 -62
  484. package/node_modules/matrix-js-sdk/lib/serverCapabilities.js.map +1 -1
  485. package/node_modules/matrix-js-sdk/lib/service-types.js +1 -1
  486. package/node_modules/matrix-js-sdk/lib/service-types.js.map +1 -1
  487. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.d.ts.map +1 -1
  488. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js +368 -421
  489. package/node_modules/matrix-js-sdk/lib/sliding-sync-sdk.js.map +1 -1
  490. package/node_modules/matrix-js-sdk/lib/sliding-sync.js +136 -167
  491. package/node_modules/matrix-js-sdk/lib/sliding-sync.js.map +1 -1
  492. package/node_modules/matrix-js-sdk/lib/store/index.d.ts +7 -0
  493. package/node_modules/matrix-js-sdk/lib/store/index.d.ts.map +1 -1
  494. package/node_modules/matrix-js-sdk/lib/store/index.js +3 -1
  495. package/node_modules/matrix-js-sdk/lib/store/index.js.map +1 -1
  496. package/node_modules/matrix-js-sdk/lib/store/indexeddb-backend.js +3 -1
  497. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.d.ts +1 -0
  498. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.d.ts.map +1 -1
  499. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js +197 -240
  500. package/node_modules/matrix-js-sdk/lib/store/indexeddb-local-backend.js.map +1 -1
  501. package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.d.ts +3 -1
  502. package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.d.ts.map +1 -1
  503. package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.js +51 -59
  504. package/node_modules/matrix-js-sdk/lib/store/indexeddb-remote-backend.js.map +1 -1
  505. package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js +22 -22
  506. package/node_modules/matrix-js-sdk/lib/store/indexeddb-store-worker.js.map +1 -1
  507. package/node_modules/matrix-js-sdk/lib/store/indexeddb.d.ts +7 -5
  508. package/node_modules/matrix-js-sdk/lib/store/indexeddb.d.ts.map +1 -1
  509. package/node_modules/matrix-js-sdk/lib/store/indexeddb.js +63 -79
  510. package/node_modules/matrix-js-sdk/lib/store/indexeddb.js.map +1 -1
  511. package/node_modules/matrix-js-sdk/lib/store/local-storage-events-emitter.js +2 -2
  512. package/node_modules/matrix-js-sdk/lib/store/local-storage-events-emitter.js.map +1 -1
  513. package/node_modules/matrix-js-sdk/lib/store/memory.d.ts +1 -0
  514. package/node_modules/matrix-js-sdk/lib/store/memory.d.ts.map +1 -1
  515. package/node_modules/matrix-js-sdk/lib/store/memory.js +38 -54
  516. package/node_modules/matrix-js-sdk/lib/store/memory.js.map +1 -1
  517. package/node_modules/matrix-js-sdk/lib/store/stub.d.ts +1 -0
  518. package/node_modules/matrix-js-sdk/lib/store/stub.d.ts.map +1 -1
  519. package/node_modules/matrix-js-sdk/lib/store/stub.js +22 -32
  520. package/node_modules/matrix-js-sdk/lib/store/stub.js.map +1 -1
  521. package/node_modules/matrix-js-sdk/lib/sync-accumulator.d.ts +1 -0
  522. package/node_modules/matrix-js-sdk/lib/sync-accumulator.d.ts.map +1 -1
  523. package/node_modules/matrix-js-sdk/lib/sync-accumulator.js +57 -65
  524. package/node_modules/matrix-js-sdk/lib/sync-accumulator.js.map +1 -1
  525. package/node_modules/matrix-js-sdk/lib/sync.d.ts.map +1 -1
  526. package/node_modules/matrix-js-sdk/lib/sync.js +914 -991
  527. package/node_modules/matrix-js-sdk/lib/sync.js.map +1 -1
  528. package/node_modules/matrix-js-sdk/lib/testing.js +63 -105
  529. package/node_modules/matrix-js-sdk/lib/testing.js.map +1 -1
  530. package/node_modules/matrix-js-sdk/lib/thread-utils.js +1 -4
  531. package/node_modules/matrix-js-sdk/lib/thread-utils.js.map +1 -1
  532. package/node_modules/matrix-js-sdk/lib/timeline-window.js +90 -99
  533. package/node_modules/matrix-js-sdk/lib/timeline-window.js.map +1 -1
  534. package/node_modules/matrix-js-sdk/lib/types.js +1 -1
  535. package/node_modules/matrix-js-sdk/lib/types.js.map +1 -1
  536. package/node_modules/matrix-js-sdk/lib/utils/decryptAESSecretStorageItem.js +14 -25
  537. package/node_modules/matrix-js-sdk/lib/utils/decryptAESSecretStorageItem.js.map +1 -1
  538. package/node_modules/matrix-js-sdk/lib/utils/encryptAESSecretStorageItem.js +27 -38
  539. package/node_modules/matrix-js-sdk/lib/utils/encryptAESSecretStorageItem.js.map +1 -1
  540. package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js +25 -32
  541. package/node_modules/matrix-js-sdk/lib/utils/internal/deriveKeys.js.map +1 -1
  542. package/node_modules/matrix-js-sdk/lib/utils/roomVersion.js +1 -1
  543. package/node_modules/matrix-js-sdk/lib/utils/roomVersion.js.map +1 -1
  544. package/node_modules/matrix-js-sdk/lib/utils.js +83 -135
  545. package/node_modules/matrix-js-sdk/lib/utils.js.map +1 -1
  546. package/node_modules/matrix-js-sdk/lib/version-support.js +3 -3
  547. package/node_modules/matrix-js-sdk/lib/version-support.js.map +1 -1
  548. package/node_modules/matrix-js-sdk/lib/webrtc/audioContext.js +5 -6
  549. package/node_modules/matrix-js-sdk/lib/webrtc/audioContext.js.map +1 -1
  550. package/node_modules/matrix-js-sdk/lib/webrtc/call.js +1123 -1256
  551. package/node_modules/matrix-js-sdk/lib/webrtc/call.js.map +1 -1
  552. package/node_modules/matrix-js-sdk/lib/webrtc/callEventHandler.js +207 -214
  553. package/node_modules/matrix-js-sdk/lib/webrtc/callEventHandler.js.map +1 -1
  554. package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js +2 -2
  555. package/node_modules/matrix-js-sdk/lib/webrtc/callEventTypes.js.map +1 -1
  556. package/node_modules/matrix-js-sdk/lib/webrtc/callFeed.js +33 -20
  557. package/node_modules/matrix-js-sdk/lib/webrtc/callFeed.js.map +1 -1
  558. package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.js +521 -594
  559. package/node_modules/matrix-js-sdk/lib/webrtc/groupCall.js.map +1 -1
  560. package/node_modules/matrix-js-sdk/lib/webrtc/groupCallEventHandler.js +58 -61
  561. package/node_modules/matrix-js-sdk/lib/webrtc/groupCallEventHandler.js.map +1 -1
  562. package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.js +203 -233
  563. package/node_modules/matrix-js-sdk/lib/webrtc/mediaHandler.js.map +1 -1
  564. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callFeedStatsReporter.js +16 -20
  565. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callFeedStatsReporter.js.map +1 -1
  566. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.js +65 -70
  567. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
  568. package/node_modules/matrix-js-sdk/lib/webrtc/stats/callStatsReportSummary.js +3 -1
  569. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStats.js.map +1 -1
  570. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsBuilder.js +2 -2
  571. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsBuilder.js.map +1 -1
  572. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsReportBuilder.js +20 -24
  573. package/node_modules/matrix-js-sdk/lib/webrtc/stats/connectionStatsReportBuilder.js.map +1 -1
  574. package/node_modules/matrix-js-sdk/lib/webrtc/stats/groupCallStats.js +4 -5
  575. package/node_modules/matrix-js-sdk/lib/webrtc/stats/groupCallStats.js.map +1 -1
  576. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaSsrcHandler.js +7 -8
  577. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaSsrcHandler.js.map +1 -1
  578. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackHandler.js +7 -9
  579. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackHandler.js.map +1 -1
  580. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStats.js.map +1 -1
  581. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStatsHandler.js +6 -6
  582. package/node_modules/matrix-js-sdk/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +1 -1
  583. package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReport.js +1 -1
  584. package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReport.js.map +1 -1
  585. package/node_modules/matrix-js-sdk/lib/webrtc/stats/statsReportEmitter.js.map +1 -1
  586. package/node_modules/matrix-js-sdk/lib/webrtc/stats/summaryStatsReportGatherer.js +14 -14
  587. package/node_modules/matrix-js-sdk/lib/webrtc/stats/summaryStatsReportGatherer.js.map +1 -1
  588. package/node_modules/matrix-js-sdk/lib/webrtc/stats/trackStatsBuilder.js +32 -34
  589. package/node_modules/matrix-js-sdk/lib/webrtc/stats/trackStatsBuilder.js.map +1 -1
  590. package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStats.js +3 -1
  591. package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.js +9 -9
  592. package/node_modules/matrix-js-sdk/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
  593. package/node_modules/matrix-js-sdk/lib/webrtc/stats/valueFormatter.js +1 -1
  594. package/node_modules/matrix-js-sdk/lib/webrtc/stats/valueFormatter.js.map +1 -1
  595. package/node_modules/matrix-js-sdk/package.json +110 -138
  596. package/node_modules/matrix-js-sdk/src/@types/event.ts +9 -0
  597. package/node_modules/matrix-js-sdk/src/@types/global.d.ts +2 -2
  598. package/node_modules/matrix-js-sdk/src/@types/retention.ts +16 -0
  599. package/node_modules/matrix-js-sdk/src/ToDeviceMessageQueue.ts +2 -2
  600. package/node_modules/matrix-js-sdk/src/browser-index.ts +4 -4
  601. package/node_modules/matrix-js-sdk/src/capabilityPoller.ts +102 -0
  602. package/node_modules/matrix-js-sdk/src/client.ts +37 -25
  603. package/node_modules/matrix-js-sdk/src/crypto-api/index.ts +17 -6
  604. package/node_modules/matrix-js-sdk/src/embedded.ts +4 -6
  605. package/node_modules/matrix-js-sdk/src/filter-component.ts +1 -0
  606. package/node_modules/matrix-js-sdk/src/http-api/utils.ts +5 -10
  607. package/node_modules/matrix-js-sdk/src/interactive-auth.ts +11 -5
  608. package/node_modules/matrix-js-sdk/src/matrix.ts +1 -0
  609. package/node_modules/matrix-js-sdk/src/matrixrtc/LivekitTransport.ts +1 -1
  610. package/node_modules/matrix-js-sdk/src/matrixrtc/MatrixRTCSession.ts +5 -4
  611. package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManager.ts +2 -0
  612. package/node_modules/matrix-js-sdk/src/matrixrtc/MembershipManagerActionScheduler.ts +4 -1
  613. package/node_modules/matrix-js-sdk/src/models/MSC3089Branch.ts +1 -1
  614. package/node_modules/matrix-js-sdk/src/models/room-retention.ts +230 -0
  615. package/node_modules/matrix-js-sdk/src/models/room-sticky-events.ts +1 -0
  616. package/node_modules/matrix-js-sdk/src/models/room.ts +26 -12
  617. package/node_modules/matrix-js-sdk/src/receipt-accumulator.ts +2 -0
  618. package/node_modules/matrix-js-sdk/src/rendezvous/index.ts +1 -1
  619. package/node_modules/matrix-js-sdk/src/rendezvous/transports/MSC4108RendezvousSession.ts +2 -2
  620. package/node_modules/matrix-js-sdk/src/retentionPolicy.ts +65 -0
  621. package/node_modules/matrix-js-sdk/src/rust-crypto/PerSessionKeyBackupDownloader.ts +1 -1
  622. package/node_modules/matrix-js-sdk/src/rust-crypto/backup.ts +15 -4
  623. package/node_modules/matrix-js-sdk/src/rust-crypto/index.ts +6 -6
  624. package/node_modules/matrix-js-sdk/src/rust-crypto/rust-crypto.ts +31 -7
  625. package/node_modules/matrix-js-sdk/src/rust-crypto/verification.ts +1 -1
  626. package/node_modules/matrix-js-sdk/src/serverCapabilities.ts +8 -67
  627. package/node_modules/matrix-js-sdk/src/sliding-sync-sdk.ts +5 -7
  628. package/node_modules/matrix-js-sdk/src/store/index.ts +8 -0
  629. package/node_modules/matrix-js-sdk/src/store/indexeddb-local-backend.ts +12 -2
  630. package/node_modules/matrix-js-sdk/src/store/indexeddb-remote-backend.ts +24 -5
  631. package/node_modules/matrix-js-sdk/src/store/indexeddb.ts +20 -8
  632. package/node_modules/matrix-js-sdk/src/store/memory.ts +4 -0
  633. package/node_modules/matrix-js-sdk/src/store/stub.ts +3 -0
  634. package/node_modules/matrix-js-sdk/src/sync-accumulator.ts +9 -0
  635. package/node_modules/matrix-js-sdk/src/sync.ts +11 -9
  636. package/node_modules/media-typer/README.md +19 -33
  637. package/node_modules/media-typer/dist/index.d.ts +29 -0
  638. package/node_modules/media-typer/dist/index.js +64 -0
  639. package/node_modules/media-typer/dist/index.js.map +1 -0
  640. package/node_modules/media-typer/package.json +37 -22
  641. package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +2 -2
  642. package/node_modules/music-metadata/lib/mp4/AtomToken.js +65 -13
  643. package/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +10 -0
  644. package/node_modules/music-metadata/lib/wav/WaveChunk.js +13 -3
  645. package/node_modules/music-metadata/lib/wav/WaveParser.d.ts +1 -0
  646. package/node_modules/music-metadata/lib/wav/WaveParser.js +6 -5
  647. package/node_modules/music-metadata/package.json +5 -5
  648. package/node_modules/typebox/build/compile/validator.d.mts +2 -7
  649. package/node_modules/typebox/build/compile/validator.mjs +6 -36
  650. package/node_modules/typebox/build/error/errors.d.mts +1 -7
  651. package/node_modules/typebox/build/format/_idna.mjs +36 -6
  652. package/node_modules/typebox/build/format/_puny.mjs +4 -1
  653. package/node_modules/typebox/build/format/uuid.d.mts +2 -2
  654. package/node_modules/typebox/build/format/uuid.mjs +3 -3
  655. package/node_modules/typebox/build/guard/emit.d.mts +0 -4
  656. package/node_modules/typebox/build/guard/emit.mjs +0 -8
  657. package/node_modules/typebox/build/guard/guard.d.mts +4 -8
  658. package/node_modules/typebox/build/guard/guard.mjs +5 -13
  659. package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  660. package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  661. package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  662. package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  663. package/node_modules/typebox/build/schema/engine/schema.mjs +5 -10
  664. package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  665. package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  666. package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  667. package/node_modules/typebox/build/schema/types/index.mjs +0 -1
  668. package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  669. package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  670. package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  671. package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  672. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  673. package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  674. package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  675. package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  676. package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  677. package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  678. package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  679. package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  680. package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  681. package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  682. package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  683. package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  684. package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  685. package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  686. package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  687. package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  688. package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  689. package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  690. package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  691. package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  692. package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  693. package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  694. package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  695. package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  696. package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  697. package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  698. package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  699. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  700. package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  701. package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  702. package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  703. package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  704. package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  705. package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  706. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  707. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  708. package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  709. package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  710. package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  711. package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  712. package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  713. package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  714. package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  715. package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  716. package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  717. package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  718. package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  719. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  720. package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  721. package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  722. package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  723. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  724. package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  725. package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  726. package/node_modules/typebox/build/type/action/index.d.mts +7 -4
  727. package/node_modules/typebox/build/type/action/index.mjs +7 -4
  728. package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  729. package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  730. package/node_modules/typebox/build/type/action/module.d.mts +8 -7
  731. package/node_modules/typebox/build/type/action/module.mjs +7 -6
  732. package/node_modules/typebox/build/type/action/readonly_object.d.mts +0 -5
  733. package/node_modules/typebox/build/type/action/readonly_object.mjs +0 -5
  734. package/node_modules/typebox/build/type/action/with.d.mts +11 -0
  735. package/node_modules/typebox/build/type/action/with.mjs +11 -0
  736. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  737. package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  738. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  739. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  740. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  741. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  742. package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  743. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  744. package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  745. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  746. package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  747. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  748. package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  749. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  750. package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  751. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  752. package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  753. package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  754. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  755. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  756. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  757. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  758. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  759. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  760. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  761. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  762. package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  763. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  764. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  765. package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  766. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  767. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  768. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  769. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  770. package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  771. package/node_modules/typebox/build/type/engine/index.mjs +2 -2
  772. package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  773. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  774. package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  775. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  776. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  777. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  778. package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  779. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  780. package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  781. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  782. package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  783. package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  784. package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  785. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  786. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  787. package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  788. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  789. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  790. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  791. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  792. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  793. package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  794. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  795. package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  796. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  797. package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  798. package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  799. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  800. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  801. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  802. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  803. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  804. package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  805. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  806. package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  807. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  808. package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  809. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  810. package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  811. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  812. package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  813. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  814. package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  815. package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  816. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  817. package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  818. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  819. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  820. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  821. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  822. package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  823. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  824. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  825. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  826. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  827. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  828. package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  829. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  830. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  831. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  832. package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  833. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  834. package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  835. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  836. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  837. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  838. package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  839. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  840. package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  841. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  842. package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  843. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  844. package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  845. package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  846. package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  847. package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  848. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  849. package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  850. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  851. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  852. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  853. package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  854. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  855. package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  856. package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
  857. package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  858. package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  859. package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  860. package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  861. package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  862. package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  863. package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  864. package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  865. package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  866. package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  867. package/node_modules/typebox/build/type/extends/object.mjs +25 -3
  868. package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  869. package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  870. package/node_modules/typebox/build/type/extends/record.mjs +23 -0
  871. package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  872. package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  873. package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  874. package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  875. package/node_modules/typebox/build/type/extends/union.mjs +2 -2
  876. package/node_modules/typebox/build/type/script/mapping.d.mts +84 -99
  877. package/node_modules/typebox/build/type/script/mapping.mjs +81 -85
  878. package/node_modules/typebox/build/type/script/parser.d.mts +40 -40
  879. package/node_modules/typebox/build/type/script/parser.mjs +22 -22
  880. package/node_modules/typebox/build/type/script/script.d.mts +3 -4
  881. package/node_modules/typebox/build/type/script/script.mjs +3 -2
  882. package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  883. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  884. package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  885. package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  886. package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  887. package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  888. package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  889. package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  890. package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  891. package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  892. package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  893. package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  894. package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  895. package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  896. package/node_modules/typebox/build/type/types/call.d.mts +3 -3
  897. package/node_modules/typebox/build/type/types/call.mjs +3 -2
  898. package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  899. package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  900. package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  901. package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  902. package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  903. package/node_modules/typebox/build/type/types/enum.mjs +5 -0
  904. package/node_modules/typebox/build/type/types/index.d.mts +1 -4
  905. package/node_modules/typebox/build/type/types/index.mjs +1 -4
  906. package/node_modules/typebox/build/type/types/number.d.mts +1 -1
  907. package/node_modules/typebox/build/type/types/number.mjs +1 -1
  908. package/node_modules/typebox/build/type/types/record.d.mts +13 -7
  909. package/node_modules/typebox/build/type/types/record.mjs +15 -9
  910. package/node_modules/typebox/build/type/types/static.d.mts +2 -5
  911. package/node_modules/typebox/build/typebox.d.mts +4 -8
  912. package/node_modules/typebox/build/typebox.mjs +4 -8
  913. package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  914. package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  915. package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  916. package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  917. package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  918. package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  919. package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  920. package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  921. package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  922. package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  923. package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  924. package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  925. package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  926. package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  927. package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  928. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  929. package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  930. package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  931. package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  932. package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  933. package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  934. package/node_modules/typebox/build/value/index.d.mts +0 -1
  935. package/node_modules/typebox/build/value/index.mjs +0 -1
  936. package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  937. package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  938. package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  939. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  940. package/node_modules/typebox/build/value/value.d.mts +0 -1
  941. package/node_modules/typebox/build/value/value.mjs +0 -1
  942. package/node_modules/typebox/package.json +25 -25
  943. package/node_modules/typebox/readme.md +97 -80
  944. package/npm-shrinkwrap.json +59 -54
  945. package/package.json +10 -10
  946. package/dist/probe.runtime-BED7DXis.js +0 -3
  947. package/node_modules/@babel/runtime/helpers/AwaitValue.js +0 -4
  948. package/node_modules/@babel/runtime/helpers/applyDecs.js +0 -236
  949. package/node_modules/@babel/runtime/helpers/applyDecs2203.js +0 -184
  950. package/node_modules/@babel/runtime/helpers/applyDecs2203R.js +0 -191
  951. package/node_modules/@babel/runtime/helpers/applyDecs2301.js +0 -222
  952. package/node_modules/@babel/runtime/helpers/applyDecs2305.js +0 -133
  953. package/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +0 -10
  954. package/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +0 -4
  955. package/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +0 -7
  956. package/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +0 -5
  957. package/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +0 -4
  958. package/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +0 -5
  959. package/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +0 -7
  960. package/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +0 -7
  961. package/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +0 -7
  962. package/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +0 -5
  963. package/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +0 -4
  964. package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +0 -7
  965. package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +0 -7
  966. package/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +0 -7
  967. package/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +0 -4
  968. package/node_modules/@babel/runtime/helpers/decorate.js +0 -250
  969. package/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +0 -12
  970. package/node_modules/@babel/runtime/helpers/dispose.js +0 -28
  971. package/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +0 -4
  972. package/node_modules/@babel/runtime/helpers/esm/applyDecs.js +0 -236
  973. package/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js +0 -184
  974. package/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js +0 -191
  975. package/node_modules/@babel/runtime/helpers/esm/applyDecs2301.js +0 -222
  976. package/node_modules/@babel/runtime/helpers/esm/applyDecs2305.js +0 -133
  977. package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +0 -10
  978. package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +0 -4
  979. package/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +0 -7
  980. package/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +0 -5
  981. package/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +0 -4
  982. package/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +0 -5
  983. package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +0 -7
  984. package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +0 -7
  985. package/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +0 -7
  986. package/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +0 -5
  987. package/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +0 -4
  988. package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +0 -7
  989. package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +0 -7
  990. package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +0 -7
  991. package/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +0 -4
  992. package/node_modules/@babel/runtime/helpers/esm/decorate.js +0 -250
  993. package/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +0 -12
  994. package/node_modules/@babel/runtime/helpers/esm/dispose.js +0 -28
  995. package/node_modules/@babel/runtime/helpers/esm/objectSpread.js +0 -14
  996. package/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js +0 -77
  997. package/node_modules/@babel/runtime/helpers/esm/using.js +0 -12
  998. package/node_modules/@babel/runtime/helpers/objectSpread.js +0 -14
  999. package/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +0 -77
  1000. package/node_modules/@babel/runtime/helpers/using.js +0 -12
  1001. package/node_modules/@babel/runtime/regenerator/index.js +0 -15
  1002. package/node_modules/content-type/HISTORY.md +0 -29
  1003. package/node_modules/content-type/index.js +0 -225
  1004. package/node_modules/media-typer/HISTORY.md +0 -50
  1005. package/node_modules/media-typer/index.js +0 -143
  1006. package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  1007. package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  1008. package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  1009. package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  1010. package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  1011. package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  1012. package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  1013. package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  1014. package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  1015. package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  1016. package/node_modules/typebox/build/type/action/options.d.mts +0 -11
  1017. package/node_modules/typebox/build/type/action/options.mjs +0 -11
  1018. package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  1019. package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  1020. package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  1021. package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  1022. package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  1023. package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  1024. package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  1025. package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  1026. package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  1027. package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  1028. package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  1029. package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  1030. package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  1031. package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  1032. package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  1033. package/node_modules/typebox/build/type/types/base.d.mts +0 -50
  1034. package/node_modules/typebox/build/type/types/base.mjs +0 -84
  1035. package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  1036. package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  1037. package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  1038. package/node_modules/typebox/build/type/types/promise.mjs +0 -29
  1039. package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  1040. package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  1041. package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  1042. package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  1043. package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  1044. package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  1045. package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  1046. package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  1047. package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  1048. package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  1049. package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  1050. package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  1051. package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  1052. package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  1053. package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  1054. package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  1055. package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  1056. package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  1057. package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  1058. package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  1059. package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  1060. package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  1061. package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  1062. package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  1063. package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  1064. package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  1065. package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  1066. package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  1067. package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  1068. package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  1069. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
  1070. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
@@ -1,8 +1,5 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
3
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
3
  /*
7
4
  Copyright 2015 - 2023 The Matrix.org Foundation C.I.C.
8
5
 
@@ -46,6 +43,7 @@ import { compareEventOrdering } from "./compare-event-ordering.js";
46
43
  import { KnownMembership } from "../@types/membership.js";
47
44
  import { RoomVersionStability } from "../serverCapabilities.js";
48
45
  import { RoomStickyEventsStore, RoomStickyEventsEvent } from "./room-sticky-events.js";
46
+ import { RoomRetentionPolicy } from "./room-retention.js";
49
47
 
50
48
  // These constants are used as sane defaults when the homeserver doesn't support
51
49
  // the m.room_versions capability. In practice, KNOWN_SAFE_ROOM_VERSION should be
@@ -53,8 +51,8 @@ import { RoomStickyEventsStore, RoomStickyEventsEvent } from "./room-sticky-even
53
51
  // room versions which are considered okay for people to run without being asked
54
52
  // to upgrade (ie: "stable"). Eventually, we should remove these when all homeservers
55
53
  // return an m.room_versions capability.
56
- export var KNOWN_SAFE_ROOM_VERSION = "10";
57
- var SAFE_ROOM_VERSIONS = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
54
+ export const KNOWN_SAFE_ROOM_VERSION = "10";
55
+ const SAFE_ROOM_VERSIONS = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
58
56
  // When inserting a visibility event affecting event `eventId`, we
59
57
  // need to scan through existing visibility events for `eventId`.
60
58
  // In theory, this could take an unlimited amount of time if:
@@ -69,13 +67,13 @@ var SAFE_ROOM_VERSIONS = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
69
67
  // expecting that a broken visibility change for a single event in
70
68
  // an extremely uncommon case (possibly a DoS) is a small
71
69
  // price to pay to keep matrix-js-sdk responsive.
72
- var MAX_NUMBER_OF_VISIBILITY_EVENTS_TO_SCAN_THROUGH = 30;
73
- export var NotificationCountType = /*#__PURE__*/function (NotificationCountType) {
70
+ const MAX_NUMBER_OF_VISIBILITY_EVENTS_TO_SCAN_THROUGH = 30;
71
+ export let NotificationCountType = /*#__PURE__*/function (NotificationCountType) {
74
72
  NotificationCountType["Highlight"] = "highlight";
75
73
  NotificationCountType["Total"] = "total";
76
74
  return NotificationCountType;
77
75
  }({});
78
- export var RoomEvent = /*#__PURE__*/function (RoomEvent) {
76
+ export let RoomEvent = /*#__PURE__*/function (RoomEvent) {
79
77
  RoomEvent["MyMembership"] = "Room.myMembership";
80
78
  RoomEvent["Tags"] = "Room.tags";
81
79
  RoomEvent["AccountData"] = "Room.accountData";
@@ -118,13 +116,12 @@ export class Room extends ReadReceipt {
118
116
  * @param myUserId - Required. The ID of the syncing user.
119
117
  * @param opts - Configuration options
120
118
  */
121
- constructor(roomId, client, myUserId) {
122
- var _this;
123
- var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
119
+ constructor(roomId, client, myUserId, opts = {}) {
120
+ super();
121
+
124
122
  // In some cases, we add listeners for every displayed Matrix event, so it's
125
123
  // common to have quite a few more than the default limit.
126
- super();
127
- _this = this;
124
+ _defineProperty(this, "reEmitter", void 0);
128
125
  _defineProperty(this, "txnToEvent", new Map());
129
126
  // Pending in-flight requests { string: MatrixEvent }
130
127
  _defineProperty(this, "notificationCounts", {});
@@ -138,6 +135,7 @@ export class Room extends ReadReceipt {
138
135
  * This is useful in determining whether a user has read a thread or not
139
136
  */
140
137
  _defineProperty(this, "unthreadedReceipts", new Map());
138
+ _defineProperty(this, "timelineSets", void 0);
141
139
  _defineProperty(this, "polls", new Map());
142
140
  /**
143
141
  * Empty array if the timeline sets have not been initialised. After initialisation:
@@ -149,6 +147,10 @@ export class Room extends ReadReceipt {
149
147
  _defineProperty(this, "filteredTimelineSets", {});
150
148
  // filter_id: timelineSet
151
149
  _defineProperty(this, "timelineNeedsRefresh", false);
150
+ _defineProperty(this, "pendingEventList", void 0);
151
+ // read by megolm via getter; boolean value - null indicates "use global value"
152
+ _defineProperty(this, "blacklistUnverifiedDevices", void 0);
153
+ _defineProperty(this, "selfMembership", void 0);
152
154
  /**
153
155
  * A `Hero` is a stripped `m.room.member` event which contains the important renderable fields from the event.
154
156
  *
@@ -161,6 +163,16 @@ export class Room extends ReadReceipt {
161
163
  _defineProperty(this, "heroes", null);
162
164
  // flags to stop logspam about missing m.room.create events
163
165
  _defineProperty(this, "getTypeWarning", false);
166
+ _defineProperty(this, "membersPromise", void 0);
167
+ // XXX: These should be read-only
168
+ /**
169
+ * The human-readable display name for this room.
170
+ */
171
+ _defineProperty(this, "name", void 0);
172
+ /**
173
+ * The un-homoglyphed name for this room.
174
+ */
175
+ _defineProperty(this, "normalizedName", void 0);
164
176
  /**
165
177
  * Dict of room tags; the keys are the tag name and the values
166
178
  * are any metadata associated with the tag - e.g. `{ "fav" : { order: 1 } }`
@@ -177,6 +189,21 @@ export class Room extends ReadReceipt {
177
189
  * The room summary.
178
190
  */
179
191
  _defineProperty(this, "summary", null);
192
+ /**
193
+ * oldState The state of the room at the time of the oldest event in the live timeline.
194
+ *
195
+ * @deprecated Present for backwards compatibility.
196
+ * Use getLiveTimeline().getState(EventTimeline.BACKWARDS) instead
197
+ */
198
+ _defineProperty(this, "oldState", void 0);
199
+ /**
200
+ * currentState The state of the room at the time of the newest event in the timeline.
201
+ *
202
+ * @deprecated Present for backwards compatibility.
203
+ * Use getLiveTimeline().getState(EventTimeline.FORWARDS) instead.
204
+ */
205
+ _defineProperty(this, "currentState", void 0);
206
+ _defineProperty(this, "relations", void 0);
180
207
  /**
181
208
  * A collection of events known by the client
182
209
  * This is not a comprehensive list of the threads that exist in this room
@@ -208,15 +235,38 @@ export class Room extends ReadReceipt {
208
235
  * Stores and tracks sticky events
209
236
  */
210
237
  _defineProperty(this, "stickyEvents", new RoomStickyEventsStore());
238
+ _defineProperty(this, "retention", void 0);
211
239
  _defineProperty(this, "threadTimelineSetsPromise", null);
240
+ _defineProperty(this, "onReceipt", event => {
241
+ if (this.hasEncryptionStateEvent()) {
242
+ this.clearNotificationsOnReceipt(event);
243
+ }
244
+ });
212
245
  _defineProperty(this, "threadsReady", false);
246
+ _defineProperty(this, "onThreadUpdate", thread => {
247
+ this.updateThreadRootEvents(thread, false, false);
248
+ });
249
+ _defineProperty(this, "onThreadReply", thread => {
250
+ this.updateThreadRootEvents(thread, false, true);
251
+ });
252
+ _defineProperty(this, "onThreadDelete", thread => {
253
+ this.threads.delete(thread.id);
254
+ const timeline = this.getTimelineForEvent(thread.id);
255
+ const roomEvent = timeline?.getEvents()?.find(it => it.getId() === thread.id);
256
+ if (roomEvent) {
257
+ thread.clearEventMetadata(roomEvent);
258
+ } else {
259
+ logger.debug("onThreadDelete: Could not find root event in room timeline");
260
+ }
261
+ for (const timelineSet of this.threadsTimelineSets) {
262
+ timelineSet.removeEvent(thread.id);
263
+ }
264
+ });
213
265
  _defineProperty(this, "updateThreadRootEvents", (thread, toStartOfTimeline, recreateEvent) => {
214
266
  if (thread.length) {
215
- var _this$threadsTimeline;
216
- this.updateThreadRootEvent((_this$threadsTimeline = this.threadsTimelineSets) === null || _this$threadsTimeline === void 0 ? void 0 : _this$threadsTimeline[0], thread, toStartOfTimeline, recreateEvent);
267
+ this.updateThreadRootEvent(this.threadsTimelineSets?.[0], thread, toStartOfTimeline, recreateEvent);
217
268
  if (thread.hasCurrentUserParticipated) {
218
- var _this$threadsTimeline2;
219
- this.updateThreadRootEvent((_this$threadsTimeline2 = this.threadsTimelineSets) === null || _this$threadsTimeline2 === void 0 ? void 0 : _this$threadsTimeline2[1], thread, toStartOfTimeline, recreateEvent);
269
+ this.updateThreadRootEvent(this.threadsTimelineSets?.[1], thread, toStartOfTimeline, recreateEvent);
220
270
  }
221
271
  }
222
272
  });
@@ -248,10 +298,10 @@ export class Room extends ReadReceipt {
248
298
  // if they wish to. Also this may be needed to trigger an update.
249
299
 
250
300
  if (event.isRedaction()) {
251
- var redactId = event.event.redacts;
301
+ const redactId = event.event.redacts;
252
302
 
253
303
  // if we know about this event, redact its contents now.
254
- var redactedEvent = redactId ? this.findEventById(redactId) : undefined;
304
+ const redactedEvent = redactId ? this.findEventById(redactId) : undefined;
255
305
  if (redactId) {
256
306
  try {
257
307
  this.stickyEvents.handleRedaction(redactedEvent || redactId);
@@ -264,17 +314,17 @@ export class Room extends ReadReceipt {
264
314
  this.applyEventAsRedaction(event, redactedEvent);
265
315
  }
266
316
  } else if (event.getType() === EventType.RoomMember) {
267
- var membership = event.getContent()["membership"];
317
+ const membership = event.getContent()["membership"];
268
318
  if (membership !== KnownMembership.Ban && !(membership === KnownMembership.Leave && event.getStateKey() !== event.getSender())) {
269
319
  // Not a ban or kick, therefore not a membership event we care about here.
270
320
  return;
271
321
  }
272
- var redactEvents = event.getContent()["org.matrix.msc4293.redact_events"];
322
+ const redactEvents = event.getContent()["org.matrix.msc4293.redact_events"];
273
323
  if (redactEvents !== true) {
274
324
  // Invalid or not set - nothing to redact.
275
325
  return;
276
326
  }
277
- var state = this.getLiveTimeline().getState(Direction.Forward);
327
+ const state = this.getLiveTimeline().getState(Direction.Forward);
278
328
  if (!state.maySendRedactionForEvent(event, event.getSender())) {
279
329
  // If the sender can't redact the membership event, then they won't be able to
280
330
  // redact any of the target's events either, so skip.
@@ -282,14 +332,14 @@ export class Room extends ReadReceipt {
282
332
  }
283
333
 
284
334
  // The redaction is possible, so let's find all the events and apply it.
285
- var events = this.getTimelineSets().map(s => s.getTimelines()).reduce((p, c) => {
335
+ const events = this.getTimelineSets().map(s => s.getTimelines()).reduce((p, c) => {
286
336
  p.push(...c);
287
337
  return p;
288
338
  }, []).map(t => t.getEvents().filter(e => e.getSender() === event.getStateKey())).reduce((p, c) => {
289
339
  p.push(...c);
290
340
  return c;
291
341
  }, []);
292
- for (var toRedact of events) {
342
+ for (const toRedact of events) {
293
343
  this.applyEventAsRedaction(event, toRedact);
294
344
  }
295
345
  }
@@ -318,20 +368,15 @@ export class Room extends ReadReceipt {
318
368
  if (this.opts.pendingEventOrdering === PendingEventOrdering.Detached) {
319
369
  this.pendingEventList = [];
320
370
  this.client.store.getPendingEvents(this.roomId).then(events => {
321
- var mapper = this.client.getEventMapper({
371
+ const mapper = this.client.getEventMapper({
322
372
  decrypt: false
323
373
  });
324
- events.forEach(/*#__PURE__*/function () {
325
- var _ref = _asyncToGenerator(function* (serializedEvent) {
326
- var event = mapper(serializedEvent);
327
- yield client.decryptEventIfNeeded(event);
328
- event.setStatus(EventStatus.NOT_SENT);
329
- _this.addPendingEvent(event, event.getTxnId());
330
- });
331
- return function (_x) {
332
- return _ref.apply(this, arguments);
333
- };
334
- }());
374
+ events.forEach(async serializedEvent => {
375
+ const event = mapper(serializedEvent);
376
+ await client.decryptEventIfNeeded(event);
377
+ event.setStatus(EventStatus.NOT_SENT);
378
+ this.addPendingEvent(event, event.getTxnId());
379
+ });
335
380
  });
336
381
  }
337
382
 
@@ -341,28 +386,27 @@ export class Room extends ReadReceipt {
341
386
  } else {
342
387
  this.membersPromise = undefined;
343
388
  }
389
+ if (this.client?._unstable_shouldApplyMessageRetention) {
390
+ this.retention = new RoomRetentionPolicy(this, client.retentionPolicyService, client.store);
391
+ }
344
392
  }
345
- createThreadsTimelineSets() {
346
- var _this2 = this;
347
- return _asyncToGenerator(function* () {
348
- var _this2$client;
349
- if (_this2.threadTimelineSetsPromise) {
350
- return _this2.threadTimelineSetsPromise;
351
- }
352
- if ((_this2$client = _this2.client) !== null && _this2$client !== void 0 && _this2$client.supportsThreads()) {
353
- try {
354
- _this2.threadTimelineSetsPromise = Promise.all([_this2.createThreadTimelineSet(), _this2.createThreadTimelineSet(ThreadFilterType.My)]);
355
- var timelineSets = yield _this2.threadTimelineSetsPromise;
356
- _this2.threadsTimelineSets[0] = timelineSets[0];
357
- _this2.threadsTimelineSets[1] = timelineSets[1];
358
- return timelineSets;
359
- } catch (_unused) {
360
- _this2.threadTimelineSetsPromise = null;
361
- return null;
362
- }
393
+ async createThreadsTimelineSets() {
394
+ if (this.threadTimelineSetsPromise) {
395
+ return this.threadTimelineSetsPromise;
396
+ }
397
+ if (this.client?.supportsThreads()) {
398
+ try {
399
+ this.threadTimelineSetsPromise = Promise.all([this.createThreadTimelineSet(), this.createThreadTimelineSet(ThreadFilterType.My)]);
400
+ const timelineSets = await this.threadTimelineSetsPromise;
401
+ this.threadsTimelineSets[0] = timelineSets[0];
402
+ this.threadsTimelineSets[1] = timelineSets[1];
403
+ return timelineSets;
404
+ } catch {
405
+ this.threadTimelineSetsPromise = null;
406
+ return null;
363
407
  }
364
- return null;
365
- })();
408
+ }
409
+ return null;
366
410
  }
367
411
 
368
412
  /**
@@ -376,18 +420,15 @@ export class Room extends ReadReceipt {
376
420
  *
377
421
  * @returns Signals when all events have been decrypted
378
422
  */
379
- decryptCriticalEvents() {
380
- var _this3 = this;
381
- return _asyncToGenerator(function* () {
382
- if (!_this3.client.getCrypto()) return;
383
- var readReceiptEventId = _this3.getEventReadUpTo(_this3.client.getUserId(), true);
384
- var events = _this3.getLiveTimeline().getEvents();
385
- var readReceiptTimelineIndex = events.findIndex(matrixEvent => {
386
- return matrixEvent.event.event_id === readReceiptEventId;
387
- });
388
- var decryptionPromises = events.slice(readReceiptTimelineIndex).reverse().map(event => _this3.client.decryptEventIfNeeded(event));
389
- yield Promise.allSettled(decryptionPromises);
390
- })();
423
+ async decryptCriticalEvents() {
424
+ if (!this.client.getCrypto()) return;
425
+ const readReceiptEventId = this.getEventReadUpTo(this.client.getUserId(), true);
426
+ const events = this.getLiveTimeline().getEvents();
427
+ const readReceiptTimelineIndex = events.findIndex(matrixEvent => {
428
+ return matrixEvent.event.event_id === readReceiptEventId;
429
+ });
430
+ const decryptionPromises = events.slice(readReceiptTimelineIndex).reverse().map(event => this.client.decryptEventIfNeeded(event));
431
+ await Promise.allSettled(decryptionPromises);
391
432
  }
392
433
 
393
434
  /**
@@ -395,14 +436,11 @@ export class Room extends ReadReceipt {
395
436
  *
396
437
  * @returns Signals when all events have been decrypted
397
438
  */
398
- decryptAllEvents() {
399
- var _this4 = this;
400
- return _asyncToGenerator(function* () {
401
- if (!_this4.client.getCrypto()) return;
402
- var decryptionPromises = _this4.getUnfilteredTimelineSet().getLiveTimeline().getEvents().slice(0) // copy before reversing
403
- .reverse().map(event => _this4.client.decryptEventIfNeeded(event));
404
- yield Promise.allSettled(decryptionPromises);
405
- })();
439
+ async decryptAllEvents() {
440
+ if (!this.client.getCrypto()) return;
441
+ const decryptionPromises = this.getUnfilteredTimelineSet().getLiveTimeline().getEvents().slice(0) // copy before reversing
442
+ .reverse().map(event => this.client.decryptEventIfNeeded(event));
443
+ await Promise.allSettled(decryptionPromises);
406
444
  }
407
445
 
408
446
  /**
@@ -410,9 +448,8 @@ export class Room extends ReadReceipt {
410
448
  * @returns The creator of the room, or null if it could not be determined
411
449
  */
412
450
  getCreator() {
413
- var _createEvent$getSende;
414
- var createEvent = this.currentState.getStateEvents(EventType.RoomCreate, "");
415
- return (_createEvent$getSende = createEvent === null || createEvent === void 0 ? void 0 : createEvent.getSender()) !== null && _createEvent$getSende !== void 0 ? _createEvent$getSende : null;
451
+ const createEvent = this.currentState.getStateEvents(EventType.RoomCreate, "");
452
+ return createEvent?.getSender() ?? null;
416
453
  }
417
454
 
418
455
  /**
@@ -434,53 +471,50 @@ export class Room extends ReadReceipt {
434
471
  * @returns
435
472
  * Resolves to the version the room should be upgraded to.
436
473
  */
437
- getRecommendedVersion() {
438
- var _this5 = this;
439
- return _asyncToGenerator(function* () {
440
- var capabilities = {};
474
+ async getRecommendedVersion() {
475
+ let capabilities = {};
476
+ try {
477
+ capabilities = await this.client.getCapabilities();
478
+ } catch {}
479
+ let versionCap = capabilities["m.room_versions"];
480
+ if (!versionCap) {
481
+ versionCap = {
482
+ default: KNOWN_SAFE_ROOM_VERSION,
483
+ available: {}
484
+ };
485
+ for (const safeVer of SAFE_ROOM_VERSIONS) {
486
+ versionCap.available[safeVer] = RoomVersionStability.Stable;
487
+ }
488
+ }
489
+ let result = this.checkVersionAgainstCapability(versionCap);
490
+ if (result.urgent && result.needsUpgrade) {
491
+ // Something doesn't feel right: we shouldn't need to update
492
+ // because the version we're on should be in the protocol's
493
+ // namespace. This usually means that the server was updated
494
+ // before the client was, making us think the newest possible
495
+ // room version is not stable. As a solution, we'll refresh
496
+ // the capability we're using to determine this.
497
+ logger.warn("Refreshing room version capability because the server looks " + "to be supporting a newer room version we don't know about.");
441
498
  try {
442
- capabilities = yield _this5.client.getCapabilities();
443
- } catch (_unused2) {}
444
- var versionCap = capabilities["m.room_versions"];
445
- if (!versionCap) {
446
- versionCap = {
447
- default: KNOWN_SAFE_ROOM_VERSION,
448
- available: {}
449
- };
450
- for (var safeVer of SAFE_ROOM_VERSIONS) {
451
- versionCap.available[safeVer] = RoomVersionStability.Stable;
452
- }
499
+ capabilities = await this.client.fetchCapabilities();
500
+ } catch (e) {
501
+ logger.warn("Failed to refresh room version capabilities", e);
453
502
  }
454
- var result = _this5.checkVersionAgainstCapability(versionCap);
455
- if (result.urgent && result.needsUpgrade) {
456
- // Something doesn't feel right: we shouldn't need to update
457
- // because the version we're on should be in the protocol's
458
- // namespace. This usually means that the server was updated
459
- // before the client was, making us think the newest possible
460
- // room version is not stable. As a solution, we'll refresh
461
- // the capability we're using to determine this.
462
- logger.warn("Refreshing room version capability because the server looks " + "to be supporting a newer room version we don't know about.");
463
- try {
464
- capabilities = yield _this5.client.fetchCapabilities();
465
- } catch (e) {
466
- logger.warn("Failed to refresh room version capabilities", e);
467
- }
468
- versionCap = capabilities["m.room_versions"];
469
- if (!versionCap) {
470
- logger.warn("No room version capability - assuming upgrade required.");
471
- return result;
472
- } else {
473
- result = _this5.checkVersionAgainstCapability(versionCap);
474
- }
503
+ versionCap = capabilities["m.room_versions"];
504
+ if (!versionCap) {
505
+ logger.warn("No room version capability - assuming upgrade required.");
506
+ return result;
507
+ } else {
508
+ result = this.checkVersionAgainstCapability(versionCap);
475
509
  }
476
- return result;
477
- })();
510
+ }
511
+ return result;
478
512
  }
479
513
  checkVersionAgainstCapability(versionCap) {
480
- var currentVersion = this.getVersion();
481
- logger.log("[".concat(this.roomId, "] Current version: ").concat(currentVersion));
482
- logger.log("[".concat(this.roomId, "] Version capability: "), versionCap);
483
- var result = {
514
+ const currentVersion = this.getVersion();
515
+ logger.log(`[${this.roomId}] Current version: ${currentVersion}`);
516
+ logger.log(`[${this.roomId}] Version capability: `, versionCap);
517
+ const result = {
484
518
  version: currentVersion,
485
519
  needsUpgrade: false,
486
520
  urgent: false
@@ -488,7 +522,7 @@ export class Room extends ReadReceipt {
488
522
 
489
523
  // If the room is on the default version then nothing needs to change
490
524
  if (currentVersion === versionCap.default) return result;
491
- var stableVersions = Object.keys(versionCap.available).filter(v => versionCap.available[v] === "stable");
525
+ const stableVersions = Object.keys(versionCap.available).filter(v => versionCap.available[v] === "stable");
492
526
 
493
527
  // Check if the room is on an unstable version. We determine urgency based
494
528
  // off the version being in the Matrix spec namespace or not (if the version
@@ -498,9 +532,9 @@ export class Room extends ReadReceipt {
498
532
  result.needsUpgrade = true;
499
533
  result.urgent = !!this.getVersion().match(/^[0-9]+[0-9.]*$/g);
500
534
  if (result.urgent) {
501
- logger.warn("URGENT upgrade required on ".concat(this.roomId));
535
+ logger.warn(`URGENT upgrade required on ${this.roomId}`);
502
536
  } else {
503
- logger.warn("Non-urgent upgrade required on ".concat(this.roomId));
537
+ logger.warn(`Non-urgent upgrade required on ${this.roomId}`);
504
538
  }
505
539
  return result;
506
540
  }
@@ -543,7 +577,7 @@ export class Room extends ReadReceipt {
543
577
  if (!this.pendingEventList) {
544
578
  throw new Error("Cannot call removePendingEvent with pendingEventOrdering == " + this.opts.pendingEventOrdering);
545
579
  }
546
- var removed = removeElement(this.pendingEventList, function (ev) {
580
+ const removed = removeElement(this.pendingEventList, function (ev) {
547
581
  return ev.getId() == eventId;
548
582
  }, false);
549
583
  this.savePendingEvents();
@@ -557,8 +591,7 @@ export class Room extends ReadReceipt {
557
591
  * @param eventId - The event ID to check for.
558
592
  */
559
593
  hasPendingEvent(eventId) {
560
- var _this$pendingEventLis, _this$pendingEventLis2;
561
- return (_this$pendingEventLis = (_this$pendingEventLis2 = this.pendingEventList) === null || _this$pendingEventLis2 === void 0 ? void 0 : _this$pendingEventLis2.some(event => event.getId() === eventId)) !== null && _this$pendingEventLis !== void 0 ? _this$pendingEventLis : false;
594
+ return this.pendingEventList?.some(event => event.getId() === eventId) ?? false;
562
595
  }
563
596
 
564
597
  /**
@@ -567,8 +600,7 @@ export class Room extends ReadReceipt {
567
600
  * @param eventId - The event ID to check for.
568
601
  */
569
602
  getPendingEvent(eventId) {
570
- var _this$pendingEventLis3, _this$pendingEventLis4;
571
- return (_this$pendingEventLis3 = (_this$pendingEventLis4 = this.pendingEventList) === null || _this$pendingEventLis4 === void 0 ? void 0 : _this$pendingEventLis4.find(event => event.getId() === eventId)) !== null && _this$pendingEventLis3 !== void 0 ? _this$pendingEventLis3 : null;
603
+ return this.pendingEventList?.find(event => event.getId() === eventId) ?? null;
572
604
  }
573
605
 
574
606
  /**
@@ -596,10 +628,10 @@ export class Room extends ReadReceipt {
596
628
  * @returns the timestamp of the last message in the room
597
629
  */
598
630
  getLastActiveTimestamp() {
599
- var timeline = this.getLiveTimeline();
600
- var events = timeline.getEvents();
631
+ const timeline = this.getLiveTimeline();
632
+ const events = timeline.getEvents();
601
633
  if (events.length) {
602
- var lastEvent = events[events.length - 1];
634
+ const lastEvent = events[events.length - 1];
603
635
  return lastEvent.getTs();
604
636
  } else {
605
637
  return Number.MIN_SAFE_INTEGER;
@@ -617,13 +649,12 @@ export class Room extends ReadReceipt {
617
649
  * @returns MatrixEvent if there is a last event; else undefined.
618
650
  */
619
651
  getLastLiveEvent() {
620
- var _lastRoomEvent$getTs, _lastThreadEvent$getT;
621
- var roomEvents = this.getLiveTimeline().getEvents();
622
- var lastRoomEvent = roomEvents[roomEvents.length - 1];
623
- var lastThread = this.getLastThread();
652
+ const roomEvents = this.getLiveTimeline().getEvents();
653
+ const lastRoomEvent = roomEvents[roomEvents.length - 1];
654
+ const lastThread = this.getLastThread();
624
655
  if (!lastThread) return lastRoomEvent;
625
- var lastThreadEvent = lastThread.events[lastThread.events.length - 1];
626
- return ((_lastRoomEvent$getTs = lastRoomEvent === null || lastRoomEvent === void 0 ? void 0 : lastRoomEvent.getTs()) !== null && _lastRoomEvent$getTs !== void 0 ? _lastRoomEvent$getTs : 0) > ((_lastThreadEvent$getT = lastThreadEvent === null || lastThreadEvent === void 0 ? void 0 : lastThreadEvent.getTs()) !== null && _lastThreadEvent$getT !== void 0 ? _lastThreadEvent$getT : 0) ? lastRoomEvent : lastThreadEvent;
656
+ const lastThreadEvent = lastThread.events[lastThread.events.length - 1];
657
+ return (lastRoomEvent?.getTs() ?? 0) > (lastThreadEvent?.getTs() ?? 0) ? lastRoomEvent : lastThreadEvent;
627
658
  }
628
659
 
629
660
  /**
@@ -637,11 +668,10 @@ export class Room extends ReadReceipt {
637
668
  */
638
669
  getLastThread() {
639
670
  return this.getThreads().reduce((lastThread, thread) => {
640
- var _threadEvent$getTs, _lastThreadEvent$getT2;
641
671
  if (!lastThread) return thread;
642
- var threadEvent = thread.events[thread.events.length - 1];
643
- var lastThreadEvent = lastThread.events[lastThread.events.length - 1];
644
- if (((_threadEvent$getTs = threadEvent === null || threadEvent === void 0 ? void 0 : threadEvent.getTs()) !== null && _threadEvent$getTs !== void 0 ? _threadEvent$getTs : 0) >= ((_lastThreadEvent$getT2 = lastThreadEvent === null || lastThreadEvent === void 0 ? void 0 : lastThreadEvent.getTs()) !== null && _lastThreadEvent$getT2 !== void 0 ? _lastThreadEvent$getT2 : 0)) {
672
+ const threadEvent = thread.events[thread.events.length - 1];
673
+ const lastThreadEvent = lastThread.events[lastThread.events.length - 1];
674
+ if ((threadEvent?.getTs() ?? 0) >= (lastThreadEvent?.getTs() ?? 0)) {
645
675
  // Last message of current thread is newer → new last thread.
646
676
  // Equal also means newer, because it was added to the thread map later.
647
677
  return thread;
@@ -654,8 +684,7 @@ export class Room extends ReadReceipt {
654
684
  * @returns the membership type (join | leave | invite | knock) for the logged in user
655
685
  */
656
686
  getMyMembership() {
657
- var _this$selfMembership;
658
- return (_this$selfMembership = this.selfMembership) !== null && _this$selfMembership !== void 0 ? _this$selfMembership : KnownMembership.Leave;
687
+ return this.selfMembership ?? KnownMembership.Leave;
659
688
  }
660
689
 
661
690
  /**
@@ -664,16 +693,15 @@ export class Room extends ReadReceipt {
664
693
  * @returns user id of the inviter
665
694
  */
666
695
  getDMInviter() {
667
- var me = this.getMember(this.myUserId);
696
+ const me = this.getMember(this.myUserId);
668
697
  if (me) {
669
698
  return me.getDMInviter();
670
699
  }
671
700
  if (this.selfMembership === KnownMembership.Invite) {
672
701
  // fall back to summary information
673
- var memberCount = this.getInvitedAndJoinedMemberCount();
702
+ const memberCount = this.getInvitedAndJoinedMemberCount();
674
703
  if (memberCount === 2) {
675
- var _this$heroes;
676
- return (_this$heroes = this.heroes) === null || _this$heroes === void 0 || (_this$heroes = _this$heroes[0]) === null || _this$heroes === void 0 ? void 0 : _this$heroes.userId;
704
+ return this.heroes?.[0]?.userId;
677
705
  }
678
706
  }
679
707
  }
@@ -683,9 +711,9 @@ export class Room extends ReadReceipt {
683
711
  * @returns user id of the other member (could be syncing user)
684
712
  */
685
713
  guessDMUserId() {
686
- var me = this.getMember(this.myUserId);
714
+ const me = this.getMember(this.myUserId);
687
715
  if (me) {
688
- var inviterId = me.getDMInviter();
716
+ const inviterId = me.getDMInviter();
689
717
  if (inviterId) {
690
718
  return inviterId;
691
719
  }
@@ -694,8 +722,8 @@ export class Room extends ReadReceipt {
694
722
  if (Array.isArray(this.heroes) && this.heroes.length) {
695
723
  return this.heroes[0].userId;
696
724
  }
697
- var members = this.currentState.getMembers();
698
- var anyMember = members.find(m => m.userId !== this.myUserId);
725
+ const members = this.currentState.getMembers();
726
+ const anyMember = members.find(m => m.userId !== this.myUserId);
699
727
  if (anyMember) {
700
728
  return anyMember.userId;
701
729
  }
@@ -714,18 +742,17 @@ export class Room extends ReadReceipt {
714
742
  * @see https://github.com/element-hq/element-meta/blob/develop/spec/functional_members.md.
715
743
  */
716
744
  getFunctionalMembers() {
717
- var mFunctionalMembers = this.currentState.getStateEvents(UNSTABLE_ELEMENT_FUNCTIONAL_USERS.name, "");
718
- if (Array.isArray(mFunctionalMembers === null || mFunctionalMembers === void 0 ? void 0 : mFunctionalMembers.getContent().service_members)) {
745
+ const mFunctionalMembers = this.currentState.getStateEvents(UNSTABLE_ELEMENT_FUNCTIONAL_USERS.name, "");
746
+ if (Array.isArray(mFunctionalMembers?.getContent().service_members)) {
719
747
  return mFunctionalMembers.getContent().service_members;
720
748
  }
721
749
  return [];
722
750
  }
723
751
  getAvatarFallbackMember() {
724
- var _this$heroes2;
725
- var functionalMembers = this.getFunctionalMembers();
752
+ const functionalMembers = this.getFunctionalMembers();
726
753
 
727
754
  // Only generate a fallback avatar if the conversation is with a single specific other user (a "DM").
728
- var nonFunctionalMemberCount = 0;
755
+ let nonFunctionalMemberCount = 0;
729
756
  this.getMembers().forEach(m => {
730
757
  if (m.membership !== "join" && m.membership !== "invite") return;
731
758
  if (functionalMembers.includes(m.userId)) return;
@@ -734,17 +761,17 @@ export class Room extends ReadReceipt {
734
761
  if (nonFunctionalMemberCount > 2) return;
735
762
 
736
763
  // Prefer the list of heroes, if present. It should only include the single other user in the DM.
737
- var nonFunctionalHeroes = (_this$heroes2 = this.heroes) === null || _this$heroes2 === void 0 ? void 0 : _this$heroes2.filter(h => !functionalMembers.includes(h.userId));
738
- var hasHeroes = Array.isArray(nonFunctionalHeroes) && nonFunctionalHeroes.length;
764
+ const nonFunctionalHeroes = this.heroes?.filter(h => !functionalMembers.includes(h.userId));
765
+ const hasHeroes = Array.isArray(nonFunctionalHeroes) && nonFunctionalHeroes.length;
739
766
  if (hasHeroes) {
740
767
  // use first hero that has a display name or avatar url, or whose user ID
741
768
  // can be looked up as a member of the room
742
- for (var hero of nonFunctionalHeroes) {
769
+ for (const hero of nonFunctionalHeroes) {
743
770
  // If the hero was from a legacy sync (`/v3/sync`), we will need to look the user ID up in the room
744
771
  // the display name and avatar URL will not be set.
745
772
  if (!hero.fromMSC4186) {
746
773
  // attempt to look up renderable fields from the m.room.member event if it exists
747
- var member = this.getMember(hero.userId);
774
+ const member = this.getMember(hero.userId);
748
775
  if (member) {
749
776
  return member;
750
777
  }
@@ -753,7 +780,7 @@ export class Room extends ReadReceipt {
753
780
  // TODO: It's unfortunate that this function, which clearly only cares about the
754
781
  // avatar url, returns the entire RoomMember event. We need to fake an event
755
782
  // to meet this API shape.
756
- var heroMember = new RoomMember(this.roomId, hero.userId);
783
+ const heroMember = new RoomMember(this.roomId, hero.userId);
757
784
  // set the display name and avatar url
758
785
  heroMember.setMembershipEvent(new MatrixEvent({
759
786
  // ensure it's unique even if we hit the same millisecond
@@ -768,7 +795,7 @@ export class Room extends ReadReceipt {
768
795
  return heroMember;
769
796
  }
770
797
  }
771
- var availableMember = nonFunctionalHeroes.map(hero => {
798
+ const availableMember = nonFunctionalHeroes.map(hero => {
772
799
  return this.getMember(hero.userId);
773
800
  }).find(member => !!member);
774
801
  if (availableMember) {
@@ -778,27 +805,27 @@ export class Room extends ReadReceipt {
778
805
 
779
806
  // Consider *all*, including previous, members, to generate the avatar for DMs where the other user left.
780
807
  // Needed to generate a matching avatar for rooms named "Empty Room (was Alice)".
781
- var members = this.getMembers();
782
- var nonFunctionalMembers = members === null || members === void 0 ? void 0 : members.filter(m => !functionalMembers.includes(m.userId));
808
+ const members = this.getMembers();
809
+ const nonFunctionalMembers = members?.filter(m => !functionalMembers.includes(m.userId));
783
810
  if (nonFunctionalMembers.length <= 2) {
784
- var _availableMember = nonFunctionalMembers.find(m => {
811
+ const availableMember = nonFunctionalMembers.find(m => {
785
812
  return m.userId !== this.myUserId;
786
813
  });
787
- if (_availableMember) {
788
- return _availableMember;
814
+ if (availableMember) {
815
+ return availableMember;
789
816
  }
790
817
  }
791
818
 
792
819
  // If all else failed, but the homeserver gave us heroes that previously could not be found in the room members,
793
820
  // trust and try falling back to a hero, creating a one-off member for it
794
821
  if (hasHeroes) {
795
- var availableUser = nonFunctionalHeroes.map(hero => {
822
+ const availableUser = nonFunctionalHeroes.map(hero => {
796
823
  return this.client.getUser(hero.userId);
797
824
  }).find(user => !!user);
798
825
  if (availableUser) {
799
- var _member = new RoomMember(this.roomId, availableUser.userId);
800
- _member.user = availableUser;
801
- return _member;
826
+ const member = new RoomMember(this.roomId, availableUser.userId);
827
+ member.user = availableUser;
828
+ return member;
802
829
  }
803
830
  }
804
831
  }
@@ -808,7 +835,7 @@ export class Room extends ReadReceipt {
808
835
  * @param membership - join | leave | invite
809
836
  */
810
837
  updateMyMembership(membership) {
811
- var prevMembership = this.selfMembership;
838
+ const prevMembership = this.selfMembership;
812
839
  this.selfMembership = membership;
813
840
  if (prevMembership !== membership) {
814
841
  if (membership === KnownMembership.Leave) {
@@ -817,36 +844,30 @@ export class Room extends ReadReceipt {
817
844
  this.emit(RoomEvent.MyMembership, this, membership, prevMembership);
818
845
  }
819
846
  }
820
- loadMembersFromServer() {
821
- var _this6 = this;
822
- return _asyncToGenerator(function* () {
823
- var lastSyncToken = _this6.client.store.getSyncToken();
824
- var response = yield _this6.client.members(_this6.roomId, undefined, KnownMembership.Leave, lastSyncToken !== null && lastSyncToken !== void 0 ? lastSyncToken : undefined);
825
- return response.chunk;
826
- })();
827
- }
828
- loadMembers() {
829
- var _this7 = this;
830
- return _asyncToGenerator(function* () {
831
- // were the members loaded from the server?
832
- var fromServer = false;
833
- var rawMembersEvents = yield _this7.client.store.getOutOfBandMembers(_this7.roomId);
834
- // If the room is encrypted, we always fetch members from the server at
835
- // least once, in case the latest state wasn't persisted properly. Note
836
- // that this function is only called once (unless loading the members
837
- // fails), since loadMembersIfNeeded always returns this.membersPromise
838
- // if set, which will be the result of the first (successful) call.
839
- if (rawMembersEvents === null || _this7.hasEncryptionStateEvent()) {
840
- fromServer = true;
841
- rawMembersEvents = yield _this7.loadMembersFromServer();
842
- logger.log("LL: got ".concat(rawMembersEvents.length, " ") + "members from server for room ".concat(_this7.roomId));
843
- }
844
- var memberEvents = rawMembersEvents.filter(noUnsafeEventProps).map(_this7.client.getEventMapper());
845
- return {
846
- memberEvents,
847
- fromServer
848
- };
849
- })();
847
+ async loadMembersFromServer() {
848
+ const lastSyncToken = this.client.store.getSyncToken();
849
+ const response = await this.client.members(this.roomId, undefined, KnownMembership.Leave, lastSyncToken ?? undefined);
850
+ return response.chunk;
851
+ }
852
+ async loadMembers() {
853
+ // were the members loaded from the server?
854
+ let fromServer = false;
855
+ let rawMembersEvents = await this.client.store.getOutOfBandMembers(this.roomId);
856
+ // If the room is encrypted, we always fetch members from the server at
857
+ // least once, in case the latest state wasn't persisted properly. Note
858
+ // that this function is only called once (unless loading the members
859
+ // fails), since loadMembersIfNeeded always returns this.membersPromise
860
+ // if set, which will be the result of the first (successful) call.
861
+ if (rawMembersEvents === null || this.hasEncryptionStateEvent()) {
862
+ fromServer = true;
863
+ rawMembersEvents = await this.loadMembersFromServer();
864
+ logger.log(`LL: got ${rawMembersEvents.length} ` + `members from server for room ${this.roomId}`);
865
+ }
866
+ const memberEvents = rawMembersEvents.filter(noUnsafeEventProps).map(this.client.getEventMapper());
867
+ return {
868
+ memberEvents,
869
+ fromServer
870
+ };
850
871
  }
851
872
 
852
873
  /**
@@ -879,7 +900,7 @@ export class Room extends ReadReceipt {
879
900
  // the request is in flight get marked as superseding
880
901
  // the OOB members
881
902
  this.currentState.markOutOfBandMembersStarted();
882
- var inMemoryUpdate = this.loadMembers().then(result => {
903
+ const inMemoryUpdate = this.loadMembers().then(result => {
883
904
  this.currentState.setOutOfBandMembers(result.memberEvents);
884
905
  // recalculate the room name: it may have been based on members, so may have changed
885
906
  this.recalculate();
@@ -893,12 +914,9 @@ export class Room extends ReadReceipt {
893
914
  // update members in storage, but don't wait for it
894
915
  inMemoryUpdate.then(fromServer => {
895
916
  if (fromServer) {
896
- var oobMembers = this.currentState.getMembers().filter(m => m.isOutOfBand()).map(m => {
897
- var _m$events$member;
898
- return (_m$events$member = m.events.member) === null || _m$events$member === void 0 ? void 0 : _m$events$member.event;
899
- });
900
- logger.log("LL: telling store to write ".concat(oobMembers.length) + " members for room ".concat(this.roomId));
901
- var store = this.client.store;
917
+ const oobMembers = this.currentState.getMembers().filter(m => m.isOutOfBand()).map(m => m.events.member?.event);
918
+ logger.log(`LL: telling store to write ${oobMembers.length}` + ` members for room ${this.roomId}`);
919
+ const store = this.client.store;
902
920
  return store.setOutOfBandMembers(this.roomId, oobMembers)
903
921
  // swallow any IDB error as we don't want to fail
904
922
  // because of this
@@ -918,16 +936,13 @@ export class Room extends ReadReceipt {
918
936
  /**
919
937
  * Removes the lazily loaded members from storage if needed
920
938
  */
921
- clearLoadedMembersIfNeeded() {
922
- var _this8 = this;
923
- return _asyncToGenerator(function* () {
924
- if (_this8.opts.lazyLoadMembers && _this8.membersPromise) {
925
- yield _this8.loadMembersIfNeeded();
926
- yield _this8.client.store.clearOutOfBandMembers(_this8.roomId);
927
- _this8.currentState.clearOutOfBandMembers();
928
- _this8.membersPromise = undefined;
929
- }
930
- })();
939
+ async clearLoadedMembersIfNeeded() {
940
+ if (this.opts.lazyLoadMembers && this.membersPromise) {
941
+ await this.loadMembersIfNeeded();
942
+ await this.client.store.clearOutOfBandMembers(this.roomId);
943
+ this.currentState.clearOutOfBandMembers();
944
+ this.membersPromise = undefined;
945
+ }
931
946
  }
932
947
 
933
948
  /**
@@ -936,7 +951,7 @@ export class Room extends ReadReceipt {
936
951
  */
937
952
  cleanupAfterLeaving() {
938
953
  this.clearLoadedMembersIfNeeded().catch(err => {
939
- logger.error("error after clearing loaded members from " + "room ".concat(this.roomId, " after leaving"));
954
+ logger.error(`error after clearing loaded members from ` + `room ${this.roomId} after leaving`);
940
955
  logger.log(err);
941
956
  });
942
957
  }
@@ -954,81 +969,78 @@ export class Room extends ReadReceipt {
954
969
  * valid marker and can check the needs refresh status via
955
970
  * `room.getTimelineNeedsRefresh()`.
956
971
  */
957
- refreshLiveTimeline() {
958
- var _this9 = this;
959
- return _asyncToGenerator(function* () {
960
- var liveTimelineBefore = _this9.getLiveTimeline();
961
- var forwardPaginationToken = liveTimelineBefore.getPaginationToken(EventTimeline.FORWARDS);
962
- var backwardPaginationToken = liveTimelineBefore.getPaginationToken(EventTimeline.BACKWARDS);
963
- var eventsBefore = liveTimelineBefore.getEvents();
964
- var mostRecentEventInTimeline = eventsBefore[eventsBefore.length - 1];
965
- logger.log("[refreshLiveTimeline for ".concat(_this9.roomId, "] at ") + "mostRecentEventInTimeline=".concat(mostRecentEventInTimeline && mostRecentEventInTimeline.getId(), " ") + "liveTimelineBefore=".concat(liveTimelineBefore.toString(), " ") + "forwardPaginationToken=".concat(forwardPaginationToken, " ") + "backwardPaginationToken=".concat(backwardPaginationToken));
966
-
967
- // Get the main TimelineSet
968
- var timelineSet = _this9.getUnfilteredTimelineSet();
969
- var newTimeline = null;
970
- // If there isn't any event in the timeline, let's go fetch the latest
971
- // event and construct a timeline from it.
972
- //
973
- // This should only really happen if the user ran into an error
974
- // with refreshing the timeline before which left them in a blank
975
- // timeline from `resetLiveTimeline`.
976
- if (!mostRecentEventInTimeline) {
977
- newTimeline = yield _this9.client.getLatestTimeline(timelineSet);
978
- } else {
979
- // Empty out all of `this.timelineSets`. But we also need to keep the
980
- // same `timelineSet` references around so the React code updates
981
- // properly and doesn't ignore the room events we emit because it checks
982
- // that the `timelineSet` references are the same. We need the
983
- // `timelineSet` empty so that the `client.getEventTimeline(...)` call
984
- // later, will call `/context` and create a new timeline instead of
985
- // returning the same one.
986
- _this9.resetLiveTimeline(null, null);
987
-
988
- // Make the UI timeline show the new blank live timeline we just
989
- // reset so that if the network fails below it's showing the
990
- // accurate state of what we're working with instead of the
991
- // disconnected one in the TimelineWindow which is just hanging
992
- // around by reference.
993
- _this9.emit(RoomEvent.TimelineRefresh, _this9, timelineSet);
994
-
995
- // Use `client.getEventTimeline(...)` to construct a new timeline from a
996
- // `/context` response state and events for the most recent event before
997
- // we reset everything. The `timelineSet` we pass in needs to be empty
998
- // in order for this function to call `/context` and generate a new
999
- // timeline.
1000
- newTimeline = yield _this9.client.getEventTimeline(timelineSet, mostRecentEventInTimeline.getId());
1001
- }
1002
-
1003
- // If a racing `/sync` beat us to creating a new timeline, use that
1004
- // instead because it's the latest in the room and any new messages in
1005
- // the scrollback will include the history.
1006
- var liveTimeline = timelineSet.getLiveTimeline();
1007
- if (!liveTimeline || liveTimeline.getPaginationToken(Direction.Forward) === null && liveTimeline.getPaginationToken(Direction.Backward) === null && liveTimeline.getEvents().length === 0) {
1008
- logger.log("[refreshLiveTimeline for ".concat(_this9.roomId, "] using our new live timeline"));
1009
- // Set the pagination token back to the live sync token (`null`) instead
1010
- // of using the `/context` historical token (ex. `t12-13_0_0_0_0_0_0_0_0`)
1011
- // so that it matches the next response from `/sync` and we can properly
1012
- // continue the timeline.
1013
- newTimeline.setPaginationToken(forwardPaginationToken, EventTimeline.FORWARDS);
1014
-
1015
- // Set our new fresh timeline as the live timeline to continue syncing
1016
- // forwards and back paginating from.
1017
- timelineSet.setLiveTimeline(newTimeline);
1018
- // Fixup `this.oldstate` so that `scrollback` has the pagination tokens
1019
- // available
1020
- _this9.fixUpLegacyTimelineFields();
1021
- } else {
1022
- logger.log("[refreshLiveTimeline for ".concat(_this9.roomId, "] `/sync` or some other request beat us to creating a new ") + "live timeline after we reset it. We'll use that instead since any events in the scrollback from " + "this timeline will include the history.");
1023
- }
972
+ async refreshLiveTimeline() {
973
+ const liveTimelineBefore = this.getLiveTimeline();
974
+ const forwardPaginationToken = liveTimelineBefore.getPaginationToken(EventTimeline.FORWARDS);
975
+ const backwardPaginationToken = liveTimelineBefore.getPaginationToken(EventTimeline.BACKWARDS);
976
+ const eventsBefore = liveTimelineBefore.getEvents();
977
+ const mostRecentEventInTimeline = eventsBefore[eventsBefore.length - 1];
978
+ logger.log(`[refreshLiveTimeline for ${this.roomId}] at ` + `mostRecentEventInTimeline=${mostRecentEventInTimeline && mostRecentEventInTimeline.getId()} ` + `liveTimelineBefore=${liveTimelineBefore.toString()} ` + `forwardPaginationToken=${forwardPaginationToken} ` + `backwardPaginationToken=${backwardPaginationToken}`);
979
+
980
+ // Get the main TimelineSet
981
+ const timelineSet = this.getUnfilteredTimelineSet();
982
+ let newTimeline = null;
983
+ // If there isn't any event in the timeline, let's go fetch the latest
984
+ // event and construct a timeline from it.
985
+ //
986
+ // This should only really happen if the user ran into an error
987
+ // with refreshing the timeline before which left them in a blank
988
+ // timeline from `resetLiveTimeline`.
989
+ if (!mostRecentEventInTimeline) {
990
+ newTimeline = await this.client.getLatestTimeline(timelineSet);
991
+ } else {
992
+ // Empty out all of `this.timelineSets`. But we also need to keep the
993
+ // same `timelineSet` references around so the React code updates
994
+ // properly and doesn't ignore the room events we emit because it checks
995
+ // that the `timelineSet` references are the same. We need the
996
+ // `timelineSet` empty so that the `client.getEventTimeline(...)` call
997
+ // later, will call `/context` and create a new timeline instead of
998
+ // returning the same one.
999
+ this.resetLiveTimeline(null, null);
1000
+
1001
+ // Make the UI timeline show the new blank live timeline we just
1002
+ // reset so that if the network fails below it's showing the
1003
+ // accurate state of what we're working with instead of the
1004
+ // disconnected one in the TimelineWindow which is just hanging
1005
+ // around by reference.
1006
+ this.emit(RoomEvent.TimelineRefresh, this, timelineSet);
1007
+
1008
+ // Use `client.getEventTimeline(...)` to construct a new timeline from a
1009
+ // `/context` response state and events for the most recent event before
1010
+ // we reset everything. The `timelineSet` we pass in needs to be empty
1011
+ // in order for this function to call `/context` and generate a new
1012
+ // timeline.
1013
+ newTimeline = await this.client.getEventTimeline(timelineSet, mostRecentEventInTimeline.getId());
1014
+ }
1015
+
1016
+ // If a racing `/sync` beat us to creating a new timeline, use that
1017
+ // instead because it's the latest in the room and any new messages in
1018
+ // the scrollback will include the history.
1019
+ const liveTimeline = timelineSet.getLiveTimeline();
1020
+ if (!liveTimeline || liveTimeline.getPaginationToken(Direction.Forward) === null && liveTimeline.getPaginationToken(Direction.Backward) === null && liveTimeline.getEvents().length === 0) {
1021
+ logger.log(`[refreshLiveTimeline for ${this.roomId}] using our new live timeline`);
1022
+ // Set the pagination token back to the live sync token (`null`) instead
1023
+ // of using the `/context` historical token (ex. `t12-13_0_0_0_0_0_0_0_0`)
1024
+ // so that it matches the next response from `/sync` and we can properly
1025
+ // continue the timeline.
1026
+ newTimeline.setPaginationToken(forwardPaginationToken, EventTimeline.FORWARDS);
1027
+
1028
+ // Set our new fresh timeline as the live timeline to continue syncing
1029
+ // forwards and back paginating from.
1030
+ timelineSet.setLiveTimeline(newTimeline);
1031
+ // Fixup `this.oldstate` so that `scrollback` has the pagination tokens
1032
+ // available
1033
+ this.fixUpLegacyTimelineFields();
1034
+ } else {
1035
+ logger.log(`[refreshLiveTimeline for ${this.roomId}] \`/sync\` or some other request beat us to creating a new ` + `live timeline after we reset it. We'll use that instead since any events in the scrollback from ` + `this timeline will include the history.`);
1036
+ }
1024
1037
 
1025
- // The timeline has now been refreshed ✅
1026
- _this9.setTimelineNeedsRefresh(false);
1038
+ // The timeline has now been refreshed ✅
1039
+ this.setTimelineNeedsRefresh(false);
1027
1040
 
1028
- // Emit an event which clients can react to and re-load the timeline
1029
- // from the SDK
1030
- _this9.emit(RoomEvent.TimelineRefresh, _this9, timelineSet);
1031
- })();
1041
+ // Emit an event which clients can react to and re-load the timeline
1042
+ // from the SDK
1043
+ this.emit(RoomEvent.TimelineRefresh, this, timelineSet);
1032
1044
  }
1033
1045
 
1034
1046
  /**
@@ -1043,10 +1055,10 @@ export class Room extends ReadReceipt {
1043
1055
  * Removing just the old live timeline whilst preserving previous ones is not supported.
1044
1056
  */
1045
1057
  resetLiveTimeline(backPaginationToken, forwardPaginationToken) {
1046
- for (var timelineSet of this.timelineSets) {
1047
- timelineSet.resetLiveTimeline(backPaginationToken !== null && backPaginationToken !== void 0 ? backPaginationToken : undefined, forwardPaginationToken !== null && forwardPaginationToken !== void 0 ? forwardPaginationToken : undefined);
1058
+ for (const timelineSet of this.timelineSets) {
1059
+ timelineSet.resetLiveTimeline(backPaginationToken ?? undefined, forwardPaginationToken ?? undefined);
1048
1060
  }
1049
- for (var thread of this.threads.values()) {
1061
+ for (const thread of this.threads.values()) {
1050
1062
  thread.resetLiveTimeline(backPaginationToken, forwardPaginationToken);
1051
1063
  }
1052
1064
  this.fixUpLegacyTimelineFields();
@@ -1058,8 +1070,8 @@ export class Room extends ReadReceipt {
1058
1070
  * @internal
1059
1071
  */
1060
1072
  fixUpLegacyTimelineFields() {
1061
- var previousOldState = this.oldState;
1062
- var previousCurrentState = this.currentState;
1073
+ const previousOldState = this.oldState;
1074
+ const previousCurrentState = this.currentState;
1063
1075
 
1064
1076
  // maintain this.oldState and this.currentState as references to the
1065
1077
  // state at the start and end of that timeline. These are more
@@ -1083,11 +1095,6 @@ export class Room extends ReadReceipt {
1083
1095
  this.reEmitter.reEmit(this.currentState, [RoomStateEvent.Events, RoomStateEvent.Members, RoomStateEvent.NewMember, RoomStateEvent.Update, RoomStateEvent.Marker, BeaconEvent.New, BeaconEvent.Update, BeaconEvent.Destroy, BeaconEvent.LivenessChange]);
1084
1096
  }
1085
1097
  }
1086
- onReceipt(event) {
1087
- if (this.hasEncryptionStateEvent()) {
1088
- this.clearNotificationsOnReceipt(event);
1089
- }
1090
- }
1091
1098
  clearNotificationsOnReceipt(event) {
1092
1099
  // Like above, we have to listen for read receipts from ourselves in order to
1093
1100
  // correctly handle notification counts on encrypted rooms.
@@ -1097,22 +1104,16 @@ export class Room extends ReadReceipt {
1097
1104
  // We need to work out what threads we've just recieved receipts for, so we
1098
1105
  // know which ones to update. If we've received an unthreaded receipt, we'll
1099
1106
  // need to update all threads.
1100
- var threadIds = [];
1101
- var hasUnthreadedReceipt = false;
1102
- var content = event.getContent();
1103
- for (var receiptGroup of Object.values(content)) {
1104
- for (var _ref4 of Object.entries(receiptGroup)) {
1105
- var _ref3 = _slicedToArray(_ref4, 2);
1106
- var receiptType = _ref3[0];
1107
- var userReceipt = _ref3[1];
1107
+ let threadIds = [];
1108
+ let hasUnthreadedReceipt = false;
1109
+ const content = event.getContent();
1110
+ for (const receiptGroup of Object.values(content)) {
1111
+ for (const [receiptType, userReceipt] of Object.entries(receiptGroup)) {
1108
1112
  if (!utils.isSupportedReceiptType(receiptType)) continue;
1109
1113
  if (!userReceipt) continue;
1110
- for (var _ref7 of Object.entries(userReceipt)) {
1111
- var _ref6 = _slicedToArray(_ref7, 2);
1112
- var userId = _ref6[0];
1113
- var singleReceipt = _ref6[1];
1114
+ for (const [userId, singleReceipt] of Object.entries(userReceipt)) {
1114
1115
  if (!singleReceipt || typeof singleReceipt !== "object") continue;
1115
- var typedSingleReceipt = singleReceipt;
1116
+ const typedSingleReceipt = singleReceipt;
1116
1117
  if (userId !== this.client.getUserId()) continue;
1117
1118
  if (typedSingleReceipt.thread_id === undefined) {
1118
1119
  hasUnthreadedReceipt = true;
@@ -1129,30 +1130,28 @@ export class Room extends ReadReceipt {
1129
1130
  threadIds = this.getThreads().filter(thread => this.getThreadUnreadNotificationCount(thread.id, NotificationCountType.Total) > 0 || this.getThreadUnreadNotificationCount(thread.id, NotificationCountType.Highlight) > 0).map(thread => thread.id);
1130
1131
  threadIds.push("main");
1131
1132
  }
1132
- for (var threadId of threadIds) {
1133
- var _this$getThread;
1133
+ for (const threadId of threadIds) {
1134
1134
  // Work backwards to determine how many events are unread. We also set
1135
1135
  // a limit for how back we'll look to avoid spinning CPU for too long.
1136
1136
  // If we hit the limit, we assume the count is unchanged.
1137
- var maxHistory = 20;
1138
- var timeline = threadId === "main" ? this.getLiveTimeline() : (_this$getThread = this.getThread(threadId)) === null || _this$getThread === void 0 ? void 0 : _this$getThread.liveTimeline;
1137
+ const maxHistory = 20;
1138
+ const timeline = threadId === "main" ? this.getLiveTimeline() : this.getThread(threadId)?.liveTimeline;
1139
1139
  if (!timeline) {
1140
- logger.warn("Couldn't find timeline for thread ID ".concat(threadId, " in room ").concat(this.roomId));
1140
+ logger.warn(`Couldn't find timeline for thread ID ${threadId} in room ${this.roomId}`);
1141
1141
  continue;
1142
1142
  }
1143
- var events = timeline.getEvents();
1144
- var highlightCount = 0;
1145
- for (var i = events.length - 1; i >= 0; i--) {
1146
- var _pushActions$tweaks;
1143
+ const events = timeline.getEvents();
1144
+ let highlightCount = 0;
1145
+ for (let i = events.length - 1; i >= 0; i--) {
1147
1146
  if (i === events.length - maxHistory) return; // limit reached
1148
1147
 
1149
- var _event = events[i];
1150
- if (this.hasUserReadEvent(this.client.getUserId(), _event.getId())) {
1148
+ const event = events[i];
1149
+ if (this.hasUserReadEvent(this.client.getUserId(), event.getId())) {
1151
1150
  // If the user has read the event, then the counting is done.
1152
1151
  break;
1153
1152
  }
1154
- var pushActions = this.client.getPushActionsForEvent(_event);
1155
- highlightCount += pushActions !== null && pushActions !== void 0 && (_pushActions$tweaks = pushActions.tweaks) !== null && _pushActions$tweaks !== void 0 && _pushActions$tweaks.highlight ? 1 : 0;
1153
+ const pushActions = this.client.getPushActionsForEvent(event);
1154
+ highlightCount += pushActions?.tweaks?.highlight ? 1 : 0;
1156
1155
  }
1157
1156
 
1158
1157
  // Note: we don't need to handle 'total' notifications because the counts
@@ -1189,8 +1188,8 @@ export class Room extends ReadReceipt {
1189
1188
  * the given event, or null if unknown
1190
1189
  */
1191
1190
  getTimelineForEvent(eventId) {
1192
- var event = this.findEventById(eventId);
1193
- var thread = this.findThreadForEvent(event);
1191
+ const event = this.findEventById(eventId);
1192
+ const thread = this.findThreadForEvent(event);
1194
1193
  if (thread) {
1195
1194
  return thread.timelineSet.getTimelineForEvent(eventId);
1196
1195
  } else {
@@ -1232,11 +1231,11 @@ export class Room extends ReadReceipt {
1232
1231
  * @returns the given event, or undefined if unknown
1233
1232
  */
1234
1233
  findEventById(eventId) {
1235
- var event = this.getUnfilteredTimelineSet().findEventById(eventId);
1234
+ let event = this.getUnfilteredTimelineSet().findEventById(eventId);
1236
1235
  if (!event) {
1237
- var threads = this.getThreads();
1238
- for (var i = 0; i < threads.length; i++) {
1239
- var thread = threads[i];
1236
+ const threads = this.getThreads();
1237
+ for (let i = 0; i < threads.length; i++) {
1238
+ const thread = threads[i];
1240
1239
  event = thread.findEventById(eventId);
1241
1240
  if (event) {
1242
1241
  return event;
@@ -1252,12 +1251,10 @@ export class Room extends ReadReceipt {
1252
1251
  * @returns The notification count, or undefined if there is no count
1253
1252
  * for this type.
1254
1253
  */
1255
- getUnreadNotificationCount() {
1256
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NotificationCountType.Total;
1257
- var count = this.getRoomUnreadNotificationCount(type);
1258
- for (var threadNotification of this.threadNotifications.values()) {
1259
- var _threadNotification$t;
1260
- count += (_threadNotification$t = threadNotification[type]) !== null && _threadNotification$t !== void 0 ? _threadNotification$t : 0;
1254
+ getUnreadNotificationCount(type = NotificationCountType.Total) {
1255
+ let count = this.getRoomUnreadNotificationCount(type);
1256
+ for (const threadNotification of this.threadNotifications.values()) {
1257
+ count += threadNotification[type] ?? 0;
1261
1258
  }
1262
1259
  return count;
1263
1260
  }
@@ -1265,12 +1262,9 @@ export class Room extends ReadReceipt {
1265
1262
  /**
1266
1263
  * Get the notification for the event context (room or thread timeline)
1267
1264
  */
1268
- getUnreadCountForEventContext() {
1269
- var _ref8;
1270
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NotificationCountType.Total;
1271
- var event = arguments.length > 1 ? arguments[1] : undefined;
1272
- var isThreadEvent = !!event.threadRootId && !event.isThreadRoot;
1273
- return (_ref8 = isThreadEvent ? this.getThreadUnreadNotificationCount(event.threadRootId, type) : this.getRoomUnreadNotificationCount(type)) !== null && _ref8 !== void 0 ? _ref8 : 0;
1265
+ getUnreadCountForEventContext(type = NotificationCountType.Total, event) {
1266
+ const isThreadEvent = !!event.threadRootId && !event.isThreadRoot;
1267
+ return (isThreadEvent ? this.getThreadUnreadNotificationCount(event.threadRootId, type) : this.getRoomUnreadNotificationCount(type)) ?? 0;
1274
1268
  }
1275
1269
 
1276
1270
  /**
@@ -1279,10 +1273,8 @@ export class Room extends ReadReceipt {
1279
1273
  * @returns The notification count, or undefined if there is no count
1280
1274
  * for this type.
1281
1275
  */
1282
- getRoomUnreadNotificationCount() {
1283
- var _this$notificationCou;
1284
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NotificationCountType.Total;
1285
- return (_this$notificationCou = this.notificationCounts[type]) !== null && _this$notificationCou !== void 0 ? _this$notificationCou : 0;
1276
+ getRoomUnreadNotificationCount(type = NotificationCountType.Total) {
1277
+ return this.notificationCounts[type] ?? 0;
1286
1278
  }
1287
1279
 
1288
1280
  /**
@@ -1292,10 +1284,8 @@ export class Room extends ReadReceipt {
1292
1284
  * @returns The notification count, or undefined if there is no count
1293
1285
  * for this type.
1294
1286
  */
1295
- getThreadUnreadNotificationCount(threadId) {
1296
- var _this$threadNotificat, _this$threadNotificat2;
1297
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NotificationCountType.Total;
1298
- return (_this$threadNotificat = (_this$threadNotificat2 = this.threadNotifications.get(threadId)) === null || _this$threadNotificat2 === void 0 ? void 0 : _this$threadNotificat2[type]) !== null && _this$threadNotificat !== void 0 ? _this$threadNotificat : 0;
1287
+ getThreadUnreadNotificationCount(threadId, type = NotificationCountType.Total) {
1288
+ return this.threadNotifications.get(threadId)?.[type] ?? 0;
1299
1289
  }
1300
1290
 
1301
1291
  /**
@@ -1303,9 +1293,8 @@ export class Room extends ReadReceipt {
1303
1293
  * @returns
1304
1294
  */
1305
1295
  hasThreadUnreadNotification() {
1306
- for (var notification of this.threadNotifications.values()) {
1307
- var _notification$highlig, _notification$total;
1308
- if (((_notification$highlig = notification.highlight) !== null && _notification$highlig !== void 0 ? _notification$highlig : 0) > 0 || ((_notification$total = notification.total) !== null && _notification$total !== void 0 ? _notification$total : 0) > 0) {
1296
+ for (const notification of this.threadNotifications.values()) {
1297
+ if ((notification.highlight ?? 0) > 0 || (notification.total ?? 0) > 0) {
1309
1298
  return true;
1310
1299
  }
1311
1300
  }
@@ -1319,13 +1308,11 @@ export class Room extends ReadReceipt {
1319
1308
  * @returns
1320
1309
  */
1321
1310
  setThreadUnreadNotificationCount(threadId, type, count) {
1322
- var _this$threadNotificat3, _this$threadNotificat4;
1323
- var notification = _objectSpread({
1324
- highlight: (_this$threadNotificat3 = this.threadNotifications.get(threadId)) === null || _this$threadNotificat3 === void 0 ? void 0 : _this$threadNotificat3.highlight,
1325
- total: (_this$threadNotificat4 = this.threadNotifications.get(threadId)) === null || _this$threadNotificat4 === void 0 ? void 0 : _this$threadNotificat4.total
1326
- }, {
1311
+ const notification = {
1312
+ highlight: this.threadNotifications.get(threadId)?.highlight,
1313
+ total: this.threadNotifications.get(threadId)?.total,
1327
1314
  [type]: count
1328
- });
1315
+ };
1329
1316
  this.threadNotifications.set(threadId, notification);
1330
1317
  this.emit(RoomEvent.UnreadNotifications, notification, threadId);
1331
1318
  }
@@ -1334,12 +1321,11 @@ export class Room extends ReadReceipt {
1334
1321
  * @returns the notification count type for all the threads in the room
1335
1322
  */
1336
1323
  get threadsAggregateNotificationType() {
1337
- var type = null;
1338
- for (var threadNotification of this.threadNotifications.values()) {
1339
- var _threadNotification$h, _threadNotification$t2;
1340
- if (((_threadNotification$h = threadNotification.highlight) !== null && _threadNotification$h !== void 0 ? _threadNotification$h : 0) > 0) {
1324
+ let type = null;
1325
+ for (const threadNotification of this.threadNotifications.values()) {
1326
+ if ((threadNotification.highlight ?? 0) > 0) {
1341
1327
  return NotificationCountType.Highlight;
1342
- } else if (((_threadNotification$t2 = threadNotification.total) !== null && _threadNotification$t2 !== void 0 ? _threadNotification$t2 : 0) > 0 && !type) {
1328
+ } else if ((threadNotification.total ?? 0) > 0 && !type) {
1343
1329
  type = NotificationCountType.Total;
1344
1330
  }
1345
1331
  }
@@ -1360,13 +1346,9 @@ export class Room extends ReadReceipt {
1360
1346
  *
1361
1347
  * @param exceptThreadIds - The thread IDs to exclude from the reset.
1362
1348
  */
1363
- resetThreadUnreadNotificationCountFromSync() {
1364
- var exceptThreadIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1365
- var isEncrypted = this.hasEncryptionStateEvent();
1366
- for (var _ref1 of this.threadNotifications) {
1367
- var _ref0 = _slicedToArray(_ref1, 2);
1368
- var threadId = _ref0[0];
1369
- var notifs = _ref0[1];
1349
+ resetThreadUnreadNotificationCountFromSync(exceptThreadIds = []) {
1350
+ const isEncrypted = this.hasEncryptionStateEvent();
1351
+ for (const [threadId, notifs] of this.threadNotifications) {
1370
1352
  if (!exceptThreadIds.includes(threadId)) {
1371
1353
  notifs.total = 0;
1372
1354
  if (!isEncrypted) {
@@ -1414,13 +1396,12 @@ export class Room extends ReadReceipt {
1414
1396
  * @param summary - The room summary to update the room with
1415
1397
  */
1416
1398
  setSummary(summary) {
1417
- var _summary$mHeroes;
1418
- var heroes = (_summary$mHeroes = summary["m.heroes"]) === null || _summary$mHeroes === void 0 ? void 0 : _summary$mHeroes.map(h => ({
1399
+ const heroes = summary["m.heroes"]?.map(h => ({
1419
1400
  userId: h,
1420
1401
  fromMSC4186: false
1421
1402
  }));
1422
- var joinedCount = summary["m.joined_member_count"];
1423
- var invitedCount = summary["m.invited_member_count"];
1403
+ const joinedCount = summary["m.joined_member_count"];
1404
+ const invitedCount = summary["m.invited_member_count"];
1424
1405
  if (Number.isInteger(joinedCount)) {
1425
1406
  this.currentState.setJoinedMemberCount(joinedCount);
1426
1407
  }
@@ -1504,10 +1485,8 @@ export class Room extends ReadReceipt {
1504
1485
  * implies allowRedirects. Defaults to false (unauthenticated endpoints).
1505
1486
  * @returns the avatar URL or null.
1506
1487
  */
1507
- getAvatarUrl(baseUrl, width, height, resizeMethod) {
1508
- var allowDefault = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1509
- var useAuthentication = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
1510
- var mainUrl = this.getMxcAvatarUrl();
1488
+ getAvatarUrl(baseUrl, width, height, resizeMethod, allowDefault = true, useAuthentication = false) {
1489
+ const mainUrl = this.getMxcAvatarUrl();
1511
1490
  if (!mainUrl && !allowDefault) {
1512
1491
  return null;
1513
1492
  }
@@ -1522,8 +1501,7 @@ export class Room extends ReadReceipt {
1522
1501
  * @returns the mxc avatar url or falsy
1523
1502
  */
1524
1503
  getMxcAvatarUrl() {
1525
- var _this$currentState$ge;
1526
- var url = (_this$currentState$ge = this.currentState.getStateEvents(EventType.RoomAvatar, "")) === null || _this$currentState$ge === void 0 ? void 0 : _this$currentState$ge.getContent().url;
1504
+ const url = this.currentState.getStateEvents(EventType.RoomAvatar, "")?.getContent().url;
1527
1505
  return url && typeof url === "string" ? url : null;
1528
1506
  }
1529
1507
 
@@ -1534,8 +1512,7 @@ export class Room extends ReadReceipt {
1534
1512
  * @returns The room's canonical alias, or null if there is none
1535
1513
  */
1536
1514
  getCanonicalAlias() {
1537
- var _this$currentState$ge2;
1538
- var canonicalAlias = (_this$currentState$ge2 = this.currentState.getStateEvents(EventType.RoomCanonicalAlias, "")) === null || _this$currentState$ge2 === void 0 ? void 0 : _this$currentState$ge2.getContent().alias;
1515
+ const canonicalAlias = this.currentState.getStateEvents(EventType.RoomCanonicalAlias, "")?.getContent().alias;
1539
1516
  return canonicalAlias && typeof canonicalAlias === "string" ? canonicalAlias : null;
1540
1517
  }
1541
1518
 
@@ -1544,8 +1521,7 @@ export class Room extends ReadReceipt {
1544
1521
  * @returns The room's alternative aliases, or an empty array
1545
1522
  */
1546
1523
  getAltAliases() {
1547
- var _this$currentState$ge3;
1548
- var altAliases = (_this$currentState$ge3 = this.currentState.getStateEvents(EventType.RoomCanonicalAlias, "")) === null || _this$currentState$ge3 === void 0 ? void 0 : _this$currentState$ge3.getContent().alt_aliases;
1524
+ const altAliases = this.currentState.getStateEvents(EventType.RoomCanonicalAlias, "")?.getContent().alt_aliases;
1549
1525
  if (Array.isArray(altAliases)) {
1550
1526
  return altAliases.filter(alias => typeof alias === "string");
1551
1527
  }
@@ -1572,6 +1548,8 @@ export class Room extends ReadReceipt {
1572
1548
  * Fires {@link RoomEvent.Timeline}
1573
1549
  */
1574
1550
  addEventsToTimeline(events, toStartOfTimeline, addToState, timeline, paginationToken) {
1551
+ // ALWAYS filter out any events that are past retention
1552
+ events = events.filter(e => this.retention?.shouldEventBeRetained(e) ?? true);
1575
1553
  timeline.getTimelineSet().addEventsToTimeline(events, toStartOfTimeline, addToState, timeline, paginationToken);
1576
1554
  }
1577
1555
 
@@ -1581,8 +1559,7 @@ export class Room extends ReadReceipt {
1581
1559
  * @returns a thread instance if known
1582
1560
  */
1583
1561
  getThread(eventId) {
1584
- var _this$threads$get;
1585
- return (_this$threads$get = this.threads.get(eventId)) !== null && _this$threads$get !== void 0 ? _this$threads$get : null;
1562
+ return this.threads.get(eventId) ?? null;
1586
1563
  }
1587
1564
 
1588
1565
  /**
@@ -1661,16 +1638,13 @@ export class Room extends ReadReceipt {
1661
1638
  * @returns A list of members who
1662
1639
  * we should encrypt messages for in this room.
1663
1640
  */
1664
- getEncryptionTargetMembers() {
1665
- var _this0 = this;
1666
- return _asyncToGenerator(function* () {
1667
- yield _this0.loadMembersIfNeeded();
1668
- var members = _this0.getMembersWithMembership(KnownMembership.Join);
1669
- if (_this0.shouldEncryptForInvitedMembers()) {
1670
- members = members.concat(_this0.getMembersWithMembership(KnownMembership.Invite));
1671
- }
1672
- return members;
1673
- })();
1641
+ async getEncryptionTargetMembers() {
1642
+ await this.loadMembersIfNeeded();
1643
+ let members = this.getMembersWithMembership(KnownMembership.Join);
1644
+ if (this.shouldEncryptForInvitedMembers()) {
1645
+ members = members.concat(this.getMembersWithMembership(KnownMembership.Invite));
1646
+ }
1647
+ return members;
1674
1648
  }
1675
1649
 
1676
1650
  /**
@@ -1678,9 +1652,8 @@ export class Room extends ReadReceipt {
1678
1652
  * @returns if we should encrypt messages for invited users
1679
1653
  */
1680
1654
  shouldEncryptForInvitedMembers() {
1681
- var _ev$getContent;
1682
- var ev = this.currentState.getStateEvents(EventType.RoomHistoryVisibility, "");
1683
- return (ev === null || ev === void 0 || (_ev$getContent = ev.getContent()) === null || _ev$getContent === void 0 ? void 0 : _ev$getContent.history_visibility) !== "joined";
1655
+ const ev = this.currentState.getStateEvents(EventType.RoomHistoryVisibility, "");
1656
+ return ev?.getContent()?.history_visibility !== "joined";
1684
1657
  }
1685
1658
 
1686
1659
  /**
@@ -1701,7 +1674,7 @@ export class Room extends ReadReceipt {
1701
1674
  * @returns True if this user_id has the given membership state.
1702
1675
  */
1703
1676
  hasMembershipState(userId, membership) {
1704
- var member = this.getMember(userId);
1677
+ const member = this.getMember(userId);
1705
1678
  if (!member) {
1706
1679
  return false;
1707
1680
  }
@@ -1714,28 +1687,25 @@ export class Room extends ReadReceipt {
1714
1687
  * @param opts - Configuration options
1715
1688
  * @returns The timelineSet
1716
1689
  */
1717
- getOrCreateFilteredTimelineSet(filter) {
1718
- var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1719
- _ref10$prepopulateTim = _ref10.prepopulateTimeline,
1720
- prepopulateTimeline = _ref10$prepopulateTim === void 0 ? true : _ref10$prepopulateTim,
1721
- _ref10$useSyncEvents = _ref10.useSyncEvents,
1722
- useSyncEvents = _ref10$useSyncEvents === void 0 ? true : _ref10$useSyncEvents,
1723
- _ref10$pendingEvents = _ref10.pendingEvents,
1724
- pendingEvents = _ref10$pendingEvents === void 0 ? true : _ref10$pendingEvents;
1690
+ getOrCreateFilteredTimelineSet(filter, {
1691
+ prepopulateTimeline = true,
1692
+ useSyncEvents = true,
1693
+ pendingEvents = true
1694
+ } = {}) {
1725
1695
  if (this.filteredTimelineSets[filter.filterId]) {
1726
1696
  return this.filteredTimelineSets[filter.filterId];
1727
1697
  }
1728
- var opts = Object.assign({
1698
+ const opts = Object.assign({
1729
1699
  filter,
1730
1700
  pendingEvents
1731
1701
  }, this.opts);
1732
- var timelineSet = new EventTimelineSet(this, opts);
1702
+ const timelineSet = new EventTimelineSet(this, opts);
1733
1703
  this.reEmitter.reEmit(timelineSet, [RoomEvent.Timeline, RoomEvent.TimelineReset]);
1734
1704
  if (useSyncEvents) {
1735
1705
  this.filteredTimelineSets[filter.filterId] = timelineSet;
1736
1706
  this.timelineSets.push(timelineSet);
1737
1707
  }
1738
- var unfilteredLiveTimeline = this.getLiveTimeline();
1708
+ const unfilteredLiveTimeline = this.getLiveTimeline();
1739
1709
  // Not all filter are possible to replicate client-side only
1740
1710
  // When that's the case we do not want to prepopulate from the live timeline
1741
1711
  // as we would get incorrect results compared to what the server would send back
@@ -1754,13 +1724,13 @@ export class Room extends ReadReceipt {
1754
1724
  });
1755
1725
 
1756
1726
  // find the earliest unfiltered timeline
1757
- var timeline = unfilteredLiveTimeline;
1727
+ let timeline = unfilteredLiveTimeline;
1758
1728
  while (timeline.getNeighbouringTimeline(EventTimeline.BACKWARDS)) {
1759
1729
  timeline = timeline.getNeighbouringTimeline(EventTimeline.BACKWARDS);
1760
1730
  }
1761
1731
  timelineSet.getLiveTimeline().setPaginationToken(timeline.getPaginationToken(EventTimeline.BACKWARDS), EventTimeline.BACKWARDS);
1762
1732
  } else if (useSyncEvents) {
1763
- var livePaginationToken = unfilteredLiveTimeline.getPaginationToken(Direction.Forward);
1733
+ const livePaginationToken = unfilteredLiveTimeline.getPaginationToken(Direction.Forward);
1764
1734
  timelineSet.getLiveTimeline().setPaginationToken(livePaginationToken, Direction.Backward);
1765
1735
  }
1766
1736
 
@@ -1774,73 +1744,63 @@ export class Room extends ReadReceipt {
1774
1744
 
1775
1745
  return timelineSet;
1776
1746
  }
1777
- getThreadListFilter() {
1778
- var _arguments = arguments,
1779
- _this1 = this;
1780
- return _asyncToGenerator(function* () {
1781
- var filterType = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : ThreadFilterType.All;
1782
- var myUserId = _this1.client.getUserId();
1783
- var filter = new Filter(myUserId);
1784
- var definition = {
1785
- room: {
1786
- timeline: {
1787
- [FILTER_RELATED_BY_REL_TYPES.name]: [THREAD_RELATION_TYPE.name]
1788
- }
1747
+ async getThreadListFilter(filterType = ThreadFilterType.All) {
1748
+ const myUserId = this.client.getUserId();
1749
+ const filter = new Filter(myUserId);
1750
+ const definition = {
1751
+ room: {
1752
+ timeline: {
1753
+ [FILTER_RELATED_BY_REL_TYPES.name]: [THREAD_RELATION_TYPE.name]
1789
1754
  }
1790
- };
1791
- if (filterType === ThreadFilterType.My) {
1792
- definition.room.timeline[FILTER_RELATED_BY_SENDERS.name] = [myUserId];
1793
- }
1794
- filter.setDefinition(definition);
1795
- var filterId = yield _this1.client.getOrCreateFilter("THREAD_PANEL_".concat(_this1.roomId, "_").concat(filterType), filter);
1796
- filter.filterId = filterId;
1797
- return filter;
1798
- })();
1799
- }
1800
- createThreadTimelineSet(filterType) {
1801
- var _this10 = this;
1802
- return _asyncToGenerator(function* () {
1803
- var timelineSet;
1804
- if (Thread.hasServerSideListSupport) {
1805
- timelineSet = new EventTimelineSet(_this10, _objectSpread(_objectSpread({}, _this10.opts), {}, {
1806
- pendingEvents: false
1807
- }), undefined, undefined, filterType !== null && filterType !== void 0 ? filterType : ThreadFilterType.All);
1808
- _this10.reEmitter.reEmit(timelineSet, [RoomEvent.Timeline, RoomEvent.TimelineReset]);
1809
- } else if (Thread.hasServerSideSupport) {
1810
- var filter = yield _this10.getThreadListFilter(filterType);
1811
- timelineSet = _this10.getOrCreateFilteredTimelineSet(filter, {
1812
- prepopulateTimeline: false,
1813
- useSyncEvents: false,
1814
- pendingEvents: false
1815
- });
1816
- } else {
1817
- timelineSet = new EventTimelineSet(_this10, {
1818
- pendingEvents: false
1755
+ }
1756
+ };
1757
+ if (filterType === ThreadFilterType.My) {
1758
+ definition.room.timeline[FILTER_RELATED_BY_SENDERS.name] = [myUserId];
1759
+ }
1760
+ filter.setDefinition(definition);
1761
+ const filterId = await this.client.getOrCreateFilter(`THREAD_PANEL_${this.roomId}_${filterType}`, filter);
1762
+ filter.filterId = filterId;
1763
+ return filter;
1764
+ }
1765
+ async createThreadTimelineSet(filterType) {
1766
+ let timelineSet;
1767
+ if (Thread.hasServerSideListSupport) {
1768
+ timelineSet = new EventTimelineSet(this, _objectSpread(_objectSpread({}, this.opts), {}, {
1769
+ pendingEvents: false
1770
+ }), undefined, undefined, filterType ?? ThreadFilterType.All);
1771
+ this.reEmitter.reEmit(timelineSet, [RoomEvent.Timeline, RoomEvent.TimelineReset]);
1772
+ } else if (Thread.hasServerSideSupport) {
1773
+ const filter = await this.getThreadListFilter(filterType);
1774
+ timelineSet = this.getOrCreateFilteredTimelineSet(filter, {
1775
+ prepopulateTimeline: false,
1776
+ useSyncEvents: false,
1777
+ pendingEvents: false
1778
+ });
1779
+ } else {
1780
+ timelineSet = new EventTimelineSet(this, {
1781
+ pendingEvents: false
1782
+ });
1783
+ Array.from(this.threads).forEach(([, thread]) => {
1784
+ if (thread.length === 0) return;
1785
+ const currentUserParticipated = thread.timeline.some(event => {
1786
+ return event.getSender() === this.client.getUserId();
1819
1787
  });
1820
- Array.from(_this10.threads).forEach(_ref11 => {
1821
- var _ref12 = _slicedToArray(_ref11, 2),
1822
- thread = _ref12[1];
1823
- if (thread.length === 0) return;
1824
- var currentUserParticipated = thread.timeline.some(event => {
1825
- return event.getSender() === _this10.client.getUserId();
1788
+ if (filterType !== ThreadFilterType.My || currentUserParticipated) {
1789
+ timelineSet.getLiveTimeline().addEvent(thread.rootEvent, {
1790
+ toStartOfTimeline: false,
1791
+ addToState: false
1826
1792
  });
1827
- if (filterType !== ThreadFilterType.My || currentUserParticipated) {
1828
- timelineSet.getLiveTimeline().addEvent(thread.rootEvent, {
1829
- toStartOfTimeline: false,
1830
- addToState: false
1831
- });
1832
- }
1833
- });
1834
- }
1835
- return timelineSet;
1836
- })();
1793
+ }
1794
+ });
1795
+ }
1796
+ return timelineSet;
1837
1797
  }
1838
1798
  /**
1839
1799
  * Takes the given thread root events and creates threads for them.
1840
1800
  */
1841
1801
  processThreadRoots(events, toStartOfTimeline) {
1842
1802
  if (!this.client.supportsThreads()) return;
1843
- for (var rootEvent of events) {
1803
+ for (const rootEvent of events) {
1844
1804
  EventTimeline.setEventMetadata(rootEvent, this.currentState, toStartOfTimeline);
1845
1805
  if (!this.getThread(rootEvent.getId())) {
1846
1806
  this.createThread(rootEvent.getId(), rootEvent, [], toStartOfTimeline);
@@ -1853,61 +1813,57 @@ export class Room extends ReadReceipt {
1853
1813
  * With server support that means fetching one page.
1854
1814
  * Without server support that means fetching as much at once as the server allows us to.
1855
1815
  */
1856
- fetchRoomThreads() {
1857
- var _this11 = this;
1858
- return _asyncToGenerator(function* () {
1859
- if (_this11.threadsReady || !_this11.client.supportsThreads()) {
1860
- return;
1861
- }
1862
- if (Thread.hasServerSideListSupport) {
1863
- yield Promise.all([_this11.fetchRoomThreadList(ThreadFilterType.All), _this11.fetchRoomThreadList(ThreadFilterType.My)]);
1864
- } else {
1865
- var allThreadsFilter = yield _this11.getThreadListFilter();
1866
- var _yield$_this11$client = yield _this11.client.createMessagesRequest(_this11.roomId, "", Number.MAX_SAFE_INTEGER, Direction.Backward, allThreadsFilter),
1867
- events = _yield$_this11$client.chunk;
1868
- if (!events.length) return;
1869
-
1870
- // Sorted by last_reply origin_server_ts
1871
- var threadRoots = events.map(_this11.client.getEventMapper()).sort((eventA, eventB) => {
1872
- /**
1873
- * `origin_server_ts` in a decentralised world is far from ideal
1874
- * but for lack of any better, we will have to use this
1875
- * Long term the sorting should be handled by homeservers and this
1876
- * is only meant as a short term patch
1877
- */
1878
- var threadAMetadata = eventA.getServerAggregatedRelation(THREAD_RELATION_TYPE.name);
1879
- var threadBMetadata = eventB.getServerAggregatedRelation(THREAD_RELATION_TYPE.name);
1880
- return threadAMetadata.latest_event.origin_server_ts - threadBMetadata.latest_event.origin_server_ts;
1881
- });
1882
- var latestMyThreadsRootEvent;
1883
- var roomState = _this11.getLiveTimeline().getState(EventTimeline.FORWARDS);
1884
- for (var rootEvent of threadRoots) {
1885
- var _this11$threadsTimeli;
1886
- var _opts = {
1887
- duplicateStrategy: DuplicateStrategy.Ignore,
1888
- fromCache: false,
1889
- addToState: false,
1890
- roomState
1891
- };
1892
- (_this11$threadsTimeli = _this11.threadsTimelineSets[0]) === null || _this11$threadsTimeli === void 0 || _this11$threadsTimeli.addLiveEvent(rootEvent, _opts);
1893
- var threadRelationship = rootEvent.getServerAggregatedRelation(THREAD_RELATION_TYPE.name);
1894
- if (threadRelationship !== null && threadRelationship !== void 0 && threadRelationship.current_user_participated) {
1895
- var _this11$threadsTimeli2;
1896
- (_this11$threadsTimeli2 = _this11.threadsTimelineSets[1]) === null || _this11$threadsTimeli2 === void 0 || _this11$threadsTimeli2.addLiveEvent(rootEvent, _opts);
1897
- latestMyThreadsRootEvent = rootEvent;
1898
- }
1899
- }
1900
- _this11.processThreadRoots(threadRoots, true);
1901
- _this11.client.decryptEventIfNeeded(threadRoots[threadRoots.length - 1]);
1902
- if (latestMyThreadsRootEvent) {
1903
- _this11.client.decryptEventIfNeeded(latestMyThreadsRootEvent);
1816
+ async fetchRoomThreads() {
1817
+ if (this.threadsReady || !this.client.supportsThreads()) {
1818
+ return;
1819
+ }
1820
+ if (Thread.hasServerSideListSupport) {
1821
+ await Promise.all([this.fetchRoomThreadList(ThreadFilterType.All), this.fetchRoomThreadList(ThreadFilterType.My)]);
1822
+ } else {
1823
+ const allThreadsFilter = await this.getThreadListFilter();
1824
+ const {
1825
+ chunk: events
1826
+ } = await this.client.createMessagesRequest(this.roomId, "", Number.MAX_SAFE_INTEGER, Direction.Backward, allThreadsFilter);
1827
+ if (!events.length) return;
1828
+
1829
+ // Sorted by last_reply origin_server_ts
1830
+ const threadRoots = events.map(this.client.getEventMapper()).sort((eventA, eventB) => {
1831
+ /**
1832
+ * `origin_server_ts` in a decentralised world is far from ideal
1833
+ * but for lack of any better, we will have to use this
1834
+ * Long term the sorting should be handled by homeservers and this
1835
+ * is only meant as a short term patch
1836
+ */
1837
+ const threadAMetadata = eventA.getServerAggregatedRelation(THREAD_RELATION_TYPE.name);
1838
+ const threadBMetadata = eventB.getServerAggregatedRelation(THREAD_RELATION_TYPE.name);
1839
+ return threadAMetadata.latest_event.origin_server_ts - threadBMetadata.latest_event.origin_server_ts;
1840
+ });
1841
+ let latestMyThreadsRootEvent;
1842
+ const roomState = this.getLiveTimeline().getState(EventTimeline.FORWARDS);
1843
+ for (const rootEvent of threadRoots) {
1844
+ const opts = {
1845
+ duplicateStrategy: DuplicateStrategy.Ignore,
1846
+ fromCache: false,
1847
+ addToState: false,
1848
+ roomState
1849
+ };
1850
+ this.threadsTimelineSets[0]?.addLiveEvent(rootEvent, opts);
1851
+ const threadRelationship = rootEvent.getServerAggregatedRelation(THREAD_RELATION_TYPE.name);
1852
+ if (threadRelationship?.current_user_participated) {
1853
+ this.threadsTimelineSets[1]?.addLiveEvent(rootEvent, opts);
1854
+ latestMyThreadsRootEvent = rootEvent;
1904
1855
  }
1905
1856
  }
1906
- _this11.on(ThreadEvent.NewReply, _this11.onThreadReply);
1907
- _this11.on(ThreadEvent.Update, _this11.onThreadUpdate);
1908
- _this11.on(ThreadEvent.Delete, _this11.onThreadDelete);
1909
- _this11.threadsReady = true;
1910
- })();
1857
+ this.processThreadRoots(threadRoots, true);
1858
+ this.client.decryptEventIfNeeded(threadRoots[threadRoots.length - 1]);
1859
+ if (latestMyThreadsRootEvent) {
1860
+ this.client.decryptEventIfNeeded(latestMyThreadsRootEvent);
1861
+ }
1862
+ }
1863
+ this.on(ThreadEvent.NewReply, this.onThreadReply);
1864
+ this.on(ThreadEvent.Update, this.onThreadUpdate);
1865
+ this.on(ThreadEvent.Delete, this.onThreadDelete);
1866
+ this.threadsReady = true;
1911
1867
  }
1912
1868
 
1913
1869
  /**
@@ -1915,25 +1871,22 @@ export class Room extends ReadReceipt {
1915
1871
  *
1916
1872
  * @param events - List of events
1917
1873
  */
1918
- processPollEvents(events) {
1919
- var _this12 = this;
1920
- return _asyncToGenerator(function* () {
1921
- for (var event of events) {
1922
- try {
1923
- // Continue if the event is a clear text, non-poll event.
1924
- if (!event.isEncrypted() && !isPollEvent(event)) continue;
1925
-
1926
- /**
1927
- * Try to decrypt the event. Promise resolution does not guarantee a successful decryption.
1928
- * Retry is handled in {@link processPollEvent}.
1929
- */
1930
- yield _this12.client.decryptEventIfNeeded(event);
1931
- _this12.processPollEvent(event);
1932
- } catch (err) {
1933
- logger.warn("Error processing poll event", event.getId(), err);
1934
- }
1874
+ async processPollEvents(events) {
1875
+ for (const event of events) {
1876
+ try {
1877
+ // Continue if the event is a clear text, non-poll event.
1878
+ if (!event.isEncrypted() && !isPollEvent(event)) continue;
1879
+
1880
+ /**
1881
+ * Try to decrypt the event. Promise resolution does not guarantee a successful decryption.
1882
+ * Retry is handled in {@link processPollEvent}.
1883
+ */
1884
+ await this.client.decryptEventIfNeeded(event);
1885
+ this.processPollEvent(event);
1886
+ } catch (err) {
1887
+ logger.warn("Error processing poll event", event.getId(), err);
1935
1888
  }
1936
- })();
1889
+ }
1937
1890
  }
1938
1891
 
1939
1892
  /**
@@ -1946,95 +1899,69 @@ export class Room extends ReadReceipt {
1946
1899
  *
1947
1900
  * @param event - Event that could be a poll event
1948
1901
  */
1949
- processPollEvent(event) {
1950
- var _this13 = this;
1951
- return _asyncToGenerator(function* () {
1952
- if (event.isDecryptionFailure()) {
1953
- event.once(MatrixEventEvent.Decrypted, maybeDecryptedEvent => {
1954
- _this13.processPollEvent(maybeDecryptedEvent);
1955
- });
1956
- return;
1957
- }
1958
- if (M_POLL_START.matches(event.getType())) {
1959
- try {
1960
- var poll = new Poll(event, _this13.client, _this13);
1961
- _this13.polls.set(event.getId(), poll);
1962
- _this13.emit(PollEvent.New, poll);
1902
+ async processPollEvent(event) {
1903
+ if (event.isDecryptionFailure()) {
1904
+ event.once(MatrixEventEvent.Decrypted, maybeDecryptedEvent => {
1905
+ this.processPollEvent(maybeDecryptedEvent);
1906
+ });
1907
+ return;
1908
+ }
1909
+ if (M_POLL_START.matches(event.getType())) {
1910
+ try {
1911
+ const poll = new Poll(event, this.client, this);
1912
+ this.polls.set(event.getId(), poll);
1913
+ this.emit(PollEvent.New, poll);
1963
1914
 
1964
- // remove the poll when redacted
1965
- event.once(MatrixEventEvent.BeforeRedaction, redactedEvent => {
1966
- _this13.polls.delete(redactedEvent.getId());
1967
- });
1968
- } catch (_unused3) {}
1969
- // poll creation can fail for malformed poll start events
1970
- return;
1971
- }
1972
- var relationEventId = event.relationEventId;
1973
- if (relationEventId && _this13.polls.has(relationEventId)) {
1974
- var _poll = _this13.polls.get(relationEventId);
1975
- _poll === null || _poll === void 0 || _poll.onNewRelation(event);
1976
- }
1977
- })();
1915
+ // remove the poll when redacted
1916
+ event.once(MatrixEventEvent.BeforeRedaction, redactedEvent => {
1917
+ this.polls.delete(redactedEvent.getId());
1918
+ });
1919
+ } catch {}
1920
+ // poll creation can fail for malformed poll start events
1921
+ return;
1922
+ }
1923
+ const relationEventId = event.relationEventId;
1924
+ if (relationEventId && this.polls.has(relationEventId)) {
1925
+ const poll = this.polls.get(relationEventId);
1926
+ poll?.onNewRelation(event);
1927
+ }
1978
1928
  }
1979
1929
 
1980
1930
  /**
1981
1931
  * Fetch a single page of threadlist messages for the specific thread filter
1982
1932
  * @internal
1983
1933
  */
1984
- fetchRoomThreadList(filter) {
1985
- var _this14 = this;
1986
- return _asyncToGenerator(function* () {
1987
- if (!_this14.client.supportsThreads()) return;
1988
- if (_this14.threadsTimelineSets.length === 0) return;
1989
- var timelineSet = filter === ThreadFilterType.My ? _this14.threadsTimelineSets[1] : _this14.threadsTimelineSets[0];
1990
- var _yield$_this14$client = yield _this14.client.createThreadListMessagesRequest(_this14.roomId, null, undefined, Direction.Backward, timelineSet.threadListType, timelineSet.getFilter()),
1991
- events = _yield$_this14$client.chunk,
1992
- end = _yield$_this14$client.end;
1993
- timelineSet.getLiveTimeline().setPaginationToken(end !== null && end !== void 0 ? end : null, Direction.Backward);
1994
- if (!events.length) return;
1995
- var matrixEvents = events.map(_this14.client.getEventMapper());
1996
- _this14.processThreadRoots(matrixEvents, true);
1997
- var roomState = _this14.getLiveTimeline().getState(EventTimeline.FORWARDS);
1998
- for (var rootEvent of matrixEvents) {
1999
- timelineSet.addLiveEvent(rootEvent, {
2000
- duplicateStrategy: DuplicateStrategy.Replace,
2001
- fromCache: false,
2002
- roomState,
2003
- addToState: false
2004
- });
2005
- }
2006
- })();
2007
- }
2008
- onThreadUpdate(thread) {
2009
- this.updateThreadRootEvents(thread, false, false);
2010
- }
2011
- onThreadReply(thread) {
2012
- this.updateThreadRootEvents(thread, false, true);
2013
- }
2014
- onThreadDelete(thread) {
2015
- var _timeline$getEvents;
2016
- this.threads.delete(thread.id);
2017
- var timeline = this.getTimelineForEvent(thread.id);
2018
- var roomEvent = timeline === null || timeline === void 0 || (_timeline$getEvents = timeline.getEvents()) === null || _timeline$getEvents === void 0 ? void 0 : _timeline$getEvents.find(it => it.getId() === thread.id);
2019
- if (roomEvent) {
2020
- thread.clearEventMetadata(roomEvent);
2021
- } else {
2022
- logger.debug("onThreadDelete: Could not find root event in room timeline");
2023
- }
2024
- for (var timelineSet of this.threadsTimelineSets) {
2025
- timelineSet.removeEvent(thread.id);
1934
+ async fetchRoomThreadList(filter) {
1935
+ if (!this.client.supportsThreads()) return;
1936
+ if (this.threadsTimelineSets.length === 0) return;
1937
+ const timelineSet = filter === ThreadFilterType.My ? this.threadsTimelineSets[1] : this.threadsTimelineSets[0];
1938
+ const {
1939
+ chunk: events,
1940
+ end
1941
+ } = await this.client.createThreadListMessagesRequest(this.roomId, null, undefined, Direction.Backward, timelineSet.threadListType, timelineSet.getFilter());
1942
+ timelineSet.getLiveTimeline().setPaginationToken(end ?? null, Direction.Backward);
1943
+ if (!events.length) return;
1944
+ const matrixEvents = events.map(this.client.getEventMapper());
1945
+ this.processThreadRoots(matrixEvents, true);
1946
+ const roomState = this.getLiveTimeline().getState(EventTimeline.FORWARDS);
1947
+ for (const rootEvent of matrixEvents) {
1948
+ timelineSet.addLiveEvent(rootEvent, {
1949
+ duplicateStrategy: DuplicateStrategy.Replace,
1950
+ fromCache: false,
1951
+ roomState,
1952
+ addToState: false
1953
+ });
2026
1954
  }
2027
1955
  }
2028
-
2029
1956
  /**
2030
1957
  * Forget the timelineSet for this room with the given filter
2031
1958
  *
2032
1959
  * @param filter - the filter whose timelineSet is to be forgotten
2033
1960
  */
2034
1961
  removeFilteredTimelineSet(filter) {
2035
- var timelineSet = this.filteredTimelineSets[filter.filterId];
1962
+ const timelineSet = this.filteredTimelineSets[filter.filterId];
2036
1963
  delete this.filteredTimelineSets[filter.filterId];
2037
- var i = this.timelineSets.indexOf(timelineSet);
1964
+ const i = this.timelineSets.indexOf(timelineSet);
2038
1965
  if (i > -1) {
2039
1966
  this.timelineSets.splice(i, 1);
2040
1967
  }
@@ -2055,8 +1982,7 @@ export class Room extends ReadReceipt {
2055
1982
  * This will change if MSC3389 is merged.
2056
1983
  */
2057
1984
  eventShouldLiveIn(event, events, roots) {
2058
- var _this$client;
2059
- if (!((_this$client = this.client) !== null && _this$client !== void 0 && _this$client.supportsThreads())) {
1985
+ if (!this.client?.supportsThreads()) {
2060
1986
  return {
2061
1987
  shouldLiveInRoom: true,
2062
1988
  shouldLiveInThread: false
@@ -2064,28 +1990,27 @@ export class Room extends ReadReceipt {
2064
1990
  }
2065
1991
 
2066
1992
  // A thread root is the only event shown in both timelines
2067
- if (event.isThreadRoot || roots !== null && roots !== void 0 && roots.has(event.getId())) {
1993
+ if (event.isThreadRoot || roots?.has(event.getId())) {
2068
1994
  return {
2069
1995
  shouldLiveInRoom: true,
2070
1996
  shouldLiveInThread: true,
2071
1997
  threadId: event.getId()
2072
1998
  };
2073
1999
  }
2074
- var isThreadRelation = event.isRelation(THREAD_RELATION_TYPE.name);
2075
- var parentEventId = event.getAssociatedId();
2076
- var threadRootId = event.threadRootId;
2000
+ const isThreadRelation = event.isRelation(THREAD_RELATION_TYPE.name);
2001
+ const parentEventId = event.getAssociatedId();
2002
+ const threadRootId = event.threadRootId;
2077
2003
 
2078
2004
  // Where the parent is the thread root and this is a non-thread relation this should live only in the main timeline
2079
- if (!!parentEventId && !isThreadRelation && (threadRootId === parentEventId || roots !== null && roots !== void 0 && roots.has(parentEventId))) {
2005
+ if (!!parentEventId && !isThreadRelation && (threadRootId === parentEventId || roots?.has(parentEventId))) {
2080
2006
  return {
2081
2007
  shouldLiveInRoom: true,
2082
2008
  shouldLiveInThread: false
2083
2009
  };
2084
2010
  }
2085
- var parentEvent;
2011
+ let parentEvent;
2086
2012
  if (parentEventId) {
2087
- var _this$findEventById;
2088
- parentEvent = (_this$findEventById = this.findEventById(parentEventId)) !== null && _this$findEventById !== void 0 ? _this$findEventById : events === null || events === void 0 ? void 0 : events.find(e => e.getId() === parentEventId);
2013
+ parentEvent = this.findEventById(parentEventId) ?? events?.find(e => e.getId() === parentEventId);
2089
2014
  }
2090
2015
 
2091
2016
  // Treat non-thread-relations, redactions, and replies as extensions of their parents so evaluate parentEvent instead
@@ -2122,18 +2047,17 @@ export class Room extends ReadReceipt {
2122
2047
  }
2123
2048
  findThreadForEvent(event) {
2124
2049
  if (!event) return null;
2125
- var _this$eventShouldLive = this.eventShouldLiveIn(event),
2126
- threadId = _this$eventShouldLive.threadId;
2050
+ const {
2051
+ threadId
2052
+ } = this.eventShouldLiveIn(event);
2127
2053
  return threadId ? this.getThread(threadId) : null;
2128
2054
  }
2129
- addThreadedEvents(threadId, events) {
2130
- var toStartOfTimeline = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2131
- var thread = this.getThread(threadId);
2055
+ addThreadedEvents(threadId, events, toStartOfTimeline = false) {
2056
+ const thread = this.getThread(threadId);
2132
2057
  if (thread) {
2133
2058
  thread.addEvents(events, toStartOfTimeline);
2134
2059
  } else {
2135
- var _this$findEventById2;
2136
- var rootEvent = (_this$findEventById2 = this.findEventById(threadId)) !== null && _this$findEventById2 !== void 0 ? _this$findEventById2 : events.find(e => e.getId() === threadId);
2060
+ const rootEvent = this.findEventById(threadId) ?? events.find(e => e.getId() === threadId);
2137
2061
  this.createThread(threadId, rootEvent, events, toStartOfTimeline);
2138
2062
  }
2139
2063
  }
@@ -2142,45 +2066,39 @@ export class Room extends ReadReceipt {
2142
2066
  * Adds events to a thread's timeline. Will fire "Thread.update"
2143
2067
  */
2144
2068
  processThreadedEvents(events, toStartOfTimeline) {
2069
+ // ALWAYS filter out any events that are past retention
2070
+ events = events.filter(e => this.retention?.shouldEventBeRetained(e) ?? true);
2145
2071
  events.forEach(this.tryApplyRedaction);
2146
- var eventsByThread = {};
2147
- for (var event of events) {
2148
- var _eventsByThread;
2149
- var _this$eventShouldLive2 = this.eventShouldLiveIn(event),
2150
- threadId = _this$eventShouldLive2.threadId,
2151
- shouldLiveInThread = _this$eventShouldLive2.shouldLiveInThread;
2072
+ const eventsByThread = {};
2073
+ for (const event of events) {
2074
+ const {
2075
+ threadId,
2076
+ shouldLiveInThread
2077
+ } = this.eventShouldLiveIn(event);
2152
2078
  if (shouldLiveInThread && !eventsByThread[threadId]) {
2153
2079
  eventsByThread[threadId] = [];
2154
2080
  }
2155
- (_eventsByThread = eventsByThread[threadId]) === null || _eventsByThread === void 0 || _eventsByThread.push(event);
2081
+ eventsByThread[threadId]?.push(event);
2156
2082
  }
2157
- Object.entries(eventsByThread).map(_ref13 => {
2158
- var _ref14 = _slicedToArray(_ref13, 2),
2159
- threadId = _ref14[0],
2160
- threadEvents = _ref14[1];
2161
- return this.addThreadedEvents(threadId, threadEvents, toStartOfTimeline);
2162
- });
2083
+ Object.entries(eventsByThread).map(([threadId, threadEvents]) => this.addThreadedEvents(threadId, threadEvents, toStartOfTimeline));
2163
2084
  }
2164
- createThread(threadId, rootEvent) {
2165
- var _this$cachedThreadRea;
2166
- var events = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
2167
- var toStartOfTimeline = arguments.length > 3 ? arguments[3] : undefined;
2085
+ createThread(threadId, rootEvent, events = [], toStartOfTimeline) {
2168
2086
  if (this.threads.has(threadId)) {
2169
2087
  return this.threads.get(threadId);
2170
2088
  }
2171
2089
  if (rootEvent) {
2172
- var relatedEvents = this.relations.getAllChildEventsForEvent(rootEvent.getId());
2173
- if (relatedEvents !== null && relatedEvents !== void 0 && relatedEvents.length) {
2090
+ const relatedEvents = this.relations.getAllChildEventsForEvent(rootEvent.getId());
2091
+ if (relatedEvents?.length) {
2174
2092
  // Include all relations of the root event, given it'll be visible in both timelines,
2175
2093
  // except `m.replace` as that will already be applied atop the event using `MatrixEvent::makeReplaced`
2176
2094
  events = events.concat(relatedEvents.filter(e => !e.isRelation(RelationType.Replace)));
2177
2095
  }
2178
2096
  }
2179
- var thread = new Thread(threadId, rootEvent, {
2097
+ const thread = new Thread(threadId, rootEvent, {
2180
2098
  room: this,
2181
2099
  client: this.client,
2182
2100
  pendingEventOrdering: this.opts.pendingEventOrdering,
2183
- receipts: (_this$cachedThreadRea = this.cachedThreadReadReceipts.get(threadId)) !== null && _this$cachedThreadRea !== void 0 ? _this$cachedThreadRea : []
2101
+ receipts: this.cachedThreadReadReceipts.get(threadId) ?? []
2184
2102
  });
2185
2103
 
2186
2104
  // Add the re-emitter before we start adding events to the thread so we don't miss events
@@ -2221,13 +2139,13 @@ export class Room extends ReadReceipt {
2221
2139
  * @private
2222
2140
  */
2223
2141
  applyEventAsRedaction(redactionEvent, redactedEvent) {
2224
- var threadRootId = redactedEvent.threadRootId;
2142
+ const threadRootId = redactedEvent.threadRootId;
2225
2143
  redactedEvent.makeRedacted(redactionEvent, this);
2226
2144
 
2227
2145
  // If this is in the current state, replace it with the redacted version
2228
2146
  if (redactedEvent.isState()) {
2229
- var currentStateEvent = this.currentState.getStateEvents(redactedEvent.getType(), redactedEvent.getStateKey());
2230
- if ((currentStateEvent === null || currentStateEvent === void 0 ? void 0 : currentStateEvent.getId()) === redactedEvent.getId()) {
2147
+ const currentStateEvent = this.currentState.getStateEvents(redactedEvent.getType(), redactedEvent.getStateKey());
2148
+ if (currentStateEvent?.getId() === redactedEvent.getId()) {
2231
2149
  this.currentState.setStateEvents([redactedEvent]);
2232
2150
  }
2233
2151
  }
@@ -2265,17 +2183,14 @@ export class Room extends ReadReceipt {
2265
2183
  // to check the event ID against the list of pending events if there is no transaction ID
2266
2184
  // field. Only do this for events sent by us though as it's potentially expensive to loop
2267
2185
  // the pending events map.
2268
- var txnId = event.getUnsigned().transaction_id;
2186
+ const txnId = event.getUnsigned().transaction_id;
2269
2187
  if (!txnId && event.getSender() === this.myUserId) {
2270
2188
  // check the txn map for a matching event ID
2271
- for (var _ref17 of this.txnToEvent) {
2272
- var _ref16 = _slicedToArray(_ref17, 2);
2273
- var tid = _ref16[0];
2274
- var localEvent = _ref16[1];
2189
+ for (const [tid, localEvent] of this.txnToEvent) {
2275
2190
  if (localEvent.getId() === event.getId()) {
2276
2191
  logger.debug("processLiveEvent: found sent event without txn ID: ", tid, event.getId());
2277
2192
  // update the unsigned field so we can re-use the same codepaths
2278
- var unsigned = event.getUnsigned();
2193
+ const unsigned = event.getUnsigned();
2279
2194
  unsigned.transaction_id = tid;
2280
2195
  event.setUnsigned(unsigned);
2281
2196
  break;
@@ -2296,13 +2211,15 @@ export class Room extends ReadReceipt {
2296
2211
  * Fires {@link RoomEvent.Timeline}
2297
2212
  */
2298
2213
  addLiveEvent(event, addLiveEventOptions) {
2299
- var duplicateStrategy = addLiveEventOptions.duplicateStrategy,
2300
- timelineWasEmpty = addLiveEventOptions.timelineWasEmpty,
2301
- fromCache = addLiveEventOptions.fromCache,
2302
- addToState = addLiveEventOptions.addToState;
2214
+ const {
2215
+ duplicateStrategy,
2216
+ timelineWasEmpty,
2217
+ fromCache,
2218
+ addToState
2219
+ } = addLiveEventOptions;
2303
2220
 
2304
2221
  // add to our timeline sets
2305
- for (var timelineSet of this.timelineSets) {
2222
+ for (const timelineSet of this.timelineSets) {
2306
2223
  timelineSet.addLiveEvent(event, {
2307
2224
  duplicateStrategy,
2308
2225
  fromCache,
@@ -2372,8 +2289,8 @@ export class Room extends ReadReceipt {
2372
2289
  this.aggregateNonLiveRelation(event);
2373
2290
  }
2374
2291
  if (event.isRedaction()) {
2375
- var redactId = event.event.redacts;
2376
- var redactedEvent = this.pendingEventList.find(e => e.getId() === redactId);
2292
+ const redactId = event.event.redacts;
2293
+ let redactedEvent = this.pendingEventList.find(e => e.getId() === redactId);
2377
2294
  if (!redactedEvent && redactId) {
2378
2295
  redactedEvent = this.findEventById(redactId);
2379
2296
  }
@@ -2383,7 +2300,7 @@ export class Room extends ReadReceipt {
2383
2300
  }
2384
2301
  }
2385
2302
  } else {
2386
- for (var timelineSet of this.timelineSets) {
2303
+ for (const timelineSet of this.timelineSets) {
2387
2304
  if (timelineSet.getFilter()) {
2388
2305
  if (timelineSet.getFilter().filterRoomTimeline([event]).length) {
2389
2306
  timelineSet.addEventToTimeline(event, timelineSet.getLiveTimeline(), {
@@ -2417,14 +2334,14 @@ export class Room extends ReadReceipt {
2417
2334
  */
2418
2335
  savePendingEvents() {
2419
2336
  if (this.pendingEventList) {
2420
- var pendingEvents = this.pendingEventList.map(event => {
2337
+ const pendingEvents = this.pendingEventList.map(event => {
2421
2338
  return _objectSpread(_objectSpread({}, event.event), {}, {
2422
2339
  txn_id: event.getTxnId()
2423
2340
  });
2424
2341
  }).filter(event => {
2425
2342
  // Filter out the unencrypted messages if the room is encrypted
2426
- var isEventEncrypted = event.type === EventType.RoomMessageEncrypted;
2427
- var isRoomEncrypted = this.hasEncryptionStateEvent();
2343
+ const isEventEncrypted = event.type === EventType.RoomMessageEncrypted;
2344
+ const isRoomEncrypted = this.hasEncryptionStateEvent();
2428
2345
  return isEventEncrypted || !isRoomEncrypted;
2429
2346
  });
2430
2347
  this.client.store.setPendingEvents(this.roomId, pendingEvents);
@@ -2465,10 +2382,10 @@ export class Room extends ReadReceipt {
2465
2382
  * Fires {@link RoomEvent.LocalEchoUpdated}
2466
2383
  */
2467
2384
  handleRemoteEcho(remoteEvent, localEvent) {
2468
- var oldEventId = localEvent.getId();
2469
- var newEventId = remoteEvent.getId();
2470
- var oldStatus = localEvent.status;
2471
- logger.debug("Got remote echo for event ".concat(oldEventId, " -> ").concat(newEventId, " old status ").concat(oldStatus));
2385
+ const oldEventId = localEvent.getId();
2386
+ const newEventId = remoteEvent.getId();
2387
+ const oldStatus = localEvent.status;
2388
+ logger.debug(`Got remote echo for event ${oldEventId} -> ${newEventId} old status ${oldStatus}`);
2472
2389
 
2473
2390
  // no longer pending
2474
2391
  this.txnToEvent.delete(remoteEvent.getUnsigned().transaction_id);
@@ -2481,14 +2398,15 @@ export class Room extends ReadReceipt {
2481
2398
  // replace the event source (this will preserve the plaintext payload if
2482
2399
  // any, which is good, because we don't want to try decoding it again).
2483
2400
  localEvent.handleRemoteEcho(remoteEvent.event);
2484
- var _this$eventShouldLive3 = this.eventShouldLiveIn(remoteEvent),
2485
- shouldLiveInRoom = _this$eventShouldLive3.shouldLiveInRoom,
2486
- threadId = _this$eventShouldLive3.threadId;
2487
- var thread = threadId ? this.getThread(threadId) : null;
2488
- thread === null || thread === void 0 || thread.setEventMetadata(localEvent);
2489
- thread === null || thread === void 0 || thread.timelineSet.handleRemoteEcho(localEvent, oldEventId, newEventId);
2401
+ const {
2402
+ shouldLiveInRoom,
2403
+ threadId
2404
+ } = this.eventShouldLiveIn(remoteEvent);
2405
+ const thread = threadId ? this.getThread(threadId) : null;
2406
+ thread?.setEventMetadata(localEvent);
2407
+ thread?.timelineSet.handleRemoteEcho(localEvent, oldEventId, newEventId);
2490
2408
  if (shouldLiveInRoom) {
2491
- for (var timelineSet of this.timelineSets) {
2409
+ for (const timelineSet of this.timelineSets) {
2492
2410
  // if it's already in the timeline, update the timeline map. If it's not, add it.
2493
2411
  timelineSet.handleRemoteEcho(localEvent, oldEventId, newEventId);
2494
2412
  }
@@ -2510,7 +2428,7 @@ export class Room extends ReadReceipt {
2510
2428
  * Fires {@link RoomEvent.LocalEchoUpdated}
2511
2429
  */
2512
2430
  updatePendingEvent(event, newStatus, newEventId) {
2513
- logger.log("setting pendingEvent status to ".concat(newStatus, " in ").concat(event.getRoomId(), " ") + "event ID ".concat(event.getId(), " -> ").concat(newEventId));
2431
+ logger.log(`setting pendingEvent status to ${newStatus} in ${event.getRoomId()} ` + `event ID ${event.getId()} -> ${newEventId}`);
2514
2432
 
2515
2433
  // if the message was sent, we expect an event id
2516
2434
  if (newStatus == EventStatus.SENT && !newEventId) {
@@ -2519,18 +2437,18 @@ export class Room extends ReadReceipt {
2519
2437
 
2520
2438
  // SENT races against /sync, so we have to special-case it.
2521
2439
  if (newStatus == EventStatus.SENT) {
2522
- var timeline = this.getTimelineForEvent(newEventId);
2440
+ const timeline = this.getTimelineForEvent(newEventId);
2523
2441
  if (timeline) {
2524
2442
  // we've already received the event via the event stream.
2525
2443
  // nothing more to do here, assuming the transaction ID was correctly matched.
2526
2444
  // Let's check that.
2527
- var remoteEvent = this.findEventById(newEventId);
2528
- var remoteTxnId = remoteEvent === null || remoteEvent === void 0 ? void 0 : remoteEvent.getUnsigned().transaction_id;
2445
+ const remoteEvent = this.findEventById(newEventId);
2446
+ const remoteTxnId = remoteEvent?.getUnsigned().transaction_id;
2529
2447
  if (!remoteTxnId && remoteEvent) {
2530
2448
  // This code path is mostly relevant for the Sliding Sync proxy.
2531
2449
  // The remote event did not contain a transaction ID, so we did not handle
2532
2450
  // the remote echo yet. Handle it now.
2533
- var unsigned = remoteEvent.getUnsigned();
2451
+ const unsigned = remoteEvent.getUnsigned();
2534
2452
  unsigned.transaction_id = event.getTxnId();
2535
2453
  remoteEvent.setUnsigned(unsigned);
2536
2454
  // the remote event is _already_ in the timeline, so we need to remove it so
@@ -2541,39 +2459,40 @@ export class Room extends ReadReceipt {
2541
2459
  return;
2542
2460
  }
2543
2461
  }
2544
- var oldStatus = event.status;
2545
- var oldEventId = event.getId();
2462
+ const oldStatus = event.status;
2463
+ const oldEventId = event.getId();
2546
2464
  if (!oldStatus) {
2547
2465
  throw new Error("updatePendingEventStatus called on an event which is not a local echo.");
2548
2466
  }
2549
- var allowed = ALLOWED_TRANSITIONS[oldStatus];
2550
- if (!(allowed !== null && allowed !== void 0 && allowed.includes(newStatus))) {
2551
- throw new Error("Invalid EventStatus transition ".concat(oldStatus, "->").concat(newStatus));
2467
+ const allowed = ALLOWED_TRANSITIONS[oldStatus];
2468
+ if (!allowed?.includes(newStatus)) {
2469
+ throw new Error(`Invalid EventStatus transition ${oldStatus}->${newStatus}`);
2552
2470
  }
2553
2471
  event.setStatus(newStatus);
2554
2472
  if (newStatus == EventStatus.SENT) {
2555
2473
  // update the event id
2556
2474
  event.replaceLocalEventId(newEventId);
2557
- var _this$eventShouldLive4 = this.eventShouldLiveIn(event),
2558
- shouldLiveInRoom = _this$eventShouldLive4.shouldLiveInRoom,
2559
- threadId = _this$eventShouldLive4.threadId;
2560
- var thread = threadId ? this.getThread(threadId) : undefined;
2561
- thread === null || thread === void 0 || thread.setEventMetadata(event);
2562
- thread === null || thread === void 0 || thread.timelineSet.replaceEventId(oldEventId, newEventId);
2475
+ const {
2476
+ shouldLiveInRoom,
2477
+ threadId
2478
+ } = this.eventShouldLiveIn(event);
2479
+ const thread = threadId ? this.getThread(threadId) : undefined;
2480
+ thread?.setEventMetadata(event);
2481
+ thread?.timelineSet.replaceEventId(oldEventId, newEventId);
2563
2482
  if (shouldLiveInRoom) {
2564
2483
  // if the event was already in the timeline (which will be the case if
2565
2484
  // opts.pendingEventOrdering==chronological), we need to update the
2566
2485
  // timeline map.
2567
- for (var timelineSet of this.timelineSets) {
2486
+ for (const timelineSet of this.timelineSets) {
2568
2487
  timelineSet.replaceEventId(oldEventId, newEventId);
2569
2488
  }
2570
2489
  }
2571
2490
  } else if (newStatus == EventStatus.CANCELLED) {
2572
2491
  // remove it from the pending event list, or the timeline.
2573
2492
  if (this.pendingEventList) {
2574
- var removedEvent = this.getPendingEvent(oldEventId);
2493
+ const removedEvent = this.getPendingEvent(oldEventId);
2575
2494
  this.removePendingEvent(oldEventId);
2576
- if (removedEvent !== null && removedEvent !== void 0 && removedEvent.isRedaction()) {
2495
+ if (removedEvent?.isRedaction()) {
2577
2496
  this.revertRedactionLocalEcho(removedEvent);
2578
2497
  }
2579
2498
  }
@@ -2583,11 +2502,11 @@ export class Room extends ReadReceipt {
2583
2502
  this.emit(RoomEvent.LocalEchoUpdated, event, this, oldEventId, oldStatus);
2584
2503
  }
2585
2504
  revertRedactionLocalEcho(redactionEvent) {
2586
- var redactId = redactionEvent.event.redacts;
2505
+ const redactId = redactionEvent.event.redacts;
2587
2506
  if (!redactId) {
2588
2507
  return;
2589
2508
  }
2590
- var redactedEvent = this.getUnfilteredTimelineSet().findEventById(redactId);
2509
+ const redactedEvent = this.getUnfilteredTimelineSet().findEventById(redactId);
2591
2510
  if (redactedEvent) {
2592
2511
  redactedEvent.unmarkLocallyRedacted();
2593
2512
  // re-render after undoing redaction
@@ -2599,13 +2518,13 @@ export class Room extends ReadReceipt {
2599
2518
  }
2600
2519
  }
2601
2520
  assertTimelineSetsAreLive() {
2602
- for (var i = 0; i < this.timelineSets.length; i++) {
2603
- var liveTimeline = this.timelineSets[i].getLiveTimeline();
2521
+ for (let i = 0; i < this.timelineSets.length; i++) {
2522
+ const liveTimeline = this.timelineSets[i].getLiveTimeline();
2604
2523
  if (liveTimeline.getPaginationToken(EventTimeline.FORWARDS)) {
2605
2524
  throw new Error("live timeline " + i + " is no longer live - it has a pagination token " + "(" + liveTimeline.getPaginationToken(EventTimeline.FORWARDS) + ")");
2606
2525
  }
2607
2526
  if (liveTimeline.getNeighbouringTimeline(EventTimeline.FORWARDS)) {
2608
- throw new Error("live timeline ".concat(i, " is no longer live - it has a neighbouring timeline"));
2527
+ throw new Error(`live timeline ${i} is no longer live - it has a neighbouring timeline`);
2609
2528
  }
2610
2529
  }
2611
2530
  }
@@ -2619,102 +2538,100 @@ export class Room extends ReadReceipt {
2619
2538
  * @param addLiveEventOptions - addLiveEvent options
2620
2539
  * @throws If `duplicateStrategy` is not falsey, 'replace' or 'ignore'.
2621
2540
  */
2622
- addLiveEvents(events, addLiveEventOptions) {
2623
- var _this15 = this;
2624
- return _asyncToGenerator(function* () {
2625
- var duplicateStrategy = addLiveEventOptions.duplicateStrategy,
2626
- fromCache = addLiveEventOptions.fromCache,
2627
- _addLiveEventOptions$ = addLiveEventOptions.timelineWasEmpty,
2628
- timelineWasEmpty = _addLiveEventOptions$ === void 0 ? false : _addLiveEventOptions$,
2629
- addToState = addLiveEventOptions.addToState;
2630
- if (duplicateStrategy && ["replace", "ignore"].indexOf(duplicateStrategy) === -1) {
2631
- throw new Error("duplicateStrategy MUST be either 'replace' or 'ignore'");
2632
- }
2633
-
2634
- // sanity check that the live timeline is still live
2635
- _this15.assertTimelineSetsAreLive();
2636
- var threadRoots = _this15.findThreadRoots(events);
2637
- var eventsByThread = {};
2638
- var options = {
2639
- duplicateStrategy,
2640
- fromCache,
2641
- timelineWasEmpty,
2642
- addToState
2643
- };
2541
+ async addLiveEvents(events, addLiveEventOptions) {
2542
+ const {
2543
+ duplicateStrategy,
2544
+ fromCache,
2545
+ timelineWasEmpty = false,
2546
+ addToState
2547
+ } = addLiveEventOptions;
2548
+ if (duplicateStrategy && ["replace", "ignore"].indexOf(duplicateStrategy) === -1) {
2549
+ throw new Error("duplicateStrategy MUST be either 'replace' or 'ignore'");
2550
+ }
2551
+
2552
+ // ALWAYS filter out any events that are past retention
2553
+ events = events.filter(e => this.retention?.shouldEventBeRetained(e) ?? true);
2554
+
2555
+ // sanity check that the live timeline is still live
2556
+ this.assertTimelineSetsAreLive();
2557
+ const threadRoots = this.findThreadRoots(events);
2558
+ const eventsByThread = {};
2559
+ const options = {
2560
+ duplicateStrategy,
2561
+ fromCache,
2562
+ timelineWasEmpty,
2563
+ addToState
2564
+ };
2644
2565
 
2645
- // List of extra events to check for being parents of any relations encountered
2646
- var neighbouringEvents = [...events];
2647
- for (var event of events) {
2648
- var _eventsByThread$threa;
2649
- // TODO: We should have a filter to say "only add state event types X Y Z to the timeline".
2650
- _this15.processLiveEvent(event);
2651
- if (event.getUnsigned().transaction_id) {
2652
- var existingEvent = _this15.txnToEvent.get(event.getUnsigned().transaction_id);
2653
- if (existingEvent) {
2654
- // remote echo of an event we sent earlier
2655
- _this15.handleRemoteEcho(event, existingEvent);
2656
- continue; // we can skip adding the event to the timeline sets, it is already there
2657
- }
2566
+ // List of extra events to check for being parents of any relations encountered
2567
+ const neighbouringEvents = [...events];
2568
+ for (const event of events) {
2569
+ // TODO: We should have a filter to say "only add state event types X Y Z to the timeline".
2570
+ this.processLiveEvent(event);
2571
+ if (event.getUnsigned().transaction_id) {
2572
+ const existingEvent = this.txnToEvent.get(event.getUnsigned().transaction_id);
2573
+ if (existingEvent) {
2574
+ // remote echo of an event we sent earlier
2575
+ this.handleRemoteEcho(event, existingEvent);
2576
+ continue; // we can skip adding the event to the timeline sets, it is already there
2658
2577
  }
2659
- var _this15$eventShouldLi = _this15.eventShouldLiveIn(event, neighbouringEvents, threadRoots),
2660
- shouldLiveInRoom = _this15$eventShouldLi.shouldLiveInRoom,
2661
- shouldLiveInThread = _this15$eventShouldLi.shouldLiveInThread,
2662
- _this15$eventShouldLi2 = _this15$eventShouldLi.threadId,
2663
- threadId = _this15$eventShouldLi2 === void 0 ? "" : _this15$eventShouldLi2;
2664
- if (!shouldLiveInThread && !shouldLiveInRoom && event.isRelation()) {
2665
- try {
2666
- var parentEvent = new MatrixEvent(yield _this15.client.fetchRoomEvent(_this15.roomId, event.relationEventId));
2667
- neighbouringEvents.push(parentEvent);
2668
- if (parentEvent.threadRootId) {
2669
- threadRoots.add(parentEvent.threadRootId);
2670
- var unsigned = event.getUnsigned();
2671
- unsigned[UNSIGNED_THREAD_ID_FIELD.name] = parentEvent.threadRootId;
2672
- event.setUnsigned(unsigned);
2673
- }
2674
- var _this15$eventShouldLi3 = _this15.eventShouldLiveIn(event, neighbouringEvents, threadRoots);
2675
- shouldLiveInRoom = _this15$eventShouldLi3.shouldLiveInRoom;
2676
- shouldLiveInThread = _this15$eventShouldLi3.shouldLiveInThread;
2677
- var _this15$eventShouldLi4 = _this15$eventShouldLi3.threadId;
2678
- threadId = _this15$eventShouldLi4 === void 0 ? "" : _this15$eventShouldLi4;
2679
- } catch (e) {
2680
- logger.error("Failed to load parent event of unhandled relation", e);
2578
+ }
2579
+ let {
2580
+ shouldLiveInRoom,
2581
+ shouldLiveInThread,
2582
+ threadId = ""
2583
+ } = this.eventShouldLiveIn(event, neighbouringEvents, threadRoots);
2584
+ if (!shouldLiveInThread && !shouldLiveInRoom && event.isRelation()) {
2585
+ try {
2586
+ const parentEvent = new MatrixEvent(await this.client.fetchRoomEvent(this.roomId, event.relationEventId));
2587
+ neighbouringEvents.push(parentEvent);
2588
+ if (parentEvent.threadRootId) {
2589
+ threadRoots.add(parentEvent.threadRootId);
2590
+ const unsigned = event.getUnsigned();
2591
+ unsigned[UNSIGNED_THREAD_ID_FIELD.name] = parentEvent.threadRootId;
2592
+ event.setUnsigned(unsigned);
2681
2593
  }
2682
- }
2683
- if (shouldLiveInThread && !eventsByThread[threadId]) {
2684
- eventsByThread[threadId] = [];
2685
- }
2686
- (_eventsByThread$threa = eventsByThread[threadId]) === null || _eventsByThread$threa === void 0 || _eventsByThread$threa.push(event);
2687
- if (shouldLiveInRoom) {
2688
- _this15.addLiveEvent(event, options);
2689
- } else if (!shouldLiveInThread && event.isRelation()) {
2690
- _this15.relations.aggregateChildEvent(event);
2594
+ ({
2595
+ shouldLiveInRoom,
2596
+ shouldLiveInThread,
2597
+ threadId = ""
2598
+ } = this.eventShouldLiveIn(event, neighbouringEvents, threadRoots));
2599
+ } catch (e) {
2600
+ logger.error("Failed to load parent event of unhandled relation", e);
2691
2601
  }
2692
2602
  }
2693
- Object.entries(eventsByThread).forEach(_ref18 => {
2694
- var _ref19 = _slicedToArray(_ref18, 2),
2695
- threadId = _ref19[0],
2696
- threadEvents = _ref19[1];
2697
- _this15.addThreadedEvents(threadId, threadEvents, false);
2698
- });
2699
- })();
2603
+ if (shouldLiveInThread && !eventsByThread[threadId]) {
2604
+ eventsByThread[threadId] = [];
2605
+ }
2606
+ eventsByThread[threadId]?.push(event);
2607
+ if (shouldLiveInRoom) {
2608
+ this.addLiveEvent(event, options);
2609
+ } else if (!shouldLiveInThread && event.isRelation()) {
2610
+ this.relations.aggregateChildEvent(event);
2611
+ }
2612
+ }
2613
+ Object.entries(eventsByThread).forEach(([threadId, threadEvents]) => {
2614
+ this.addThreadedEvents(threadId, threadEvents, false);
2615
+ });
2700
2616
  }
2701
2617
  partitionThreadedEvents(events) {
2702
2618
  // Indices to the events array, for readability
2703
- var ROOM = 0;
2704
- var THREAD = 1;
2705
- var UNKNOWN_RELATION = 2;
2619
+ const ROOM = 0;
2620
+ const THREAD = 1;
2621
+ const UNKNOWN_RELATION = 2;
2706
2622
  if (this.client.supportsThreads()) {
2707
- var threadRoots = this.findThreadRoots(events);
2623
+ const threadRoots = this.findThreadRoots(events);
2708
2624
  return events.reduce((memo, event) => {
2709
- var _this$eventShouldLive5 = this.eventShouldLiveIn(event, events, threadRoots),
2710
- shouldLiveInRoom = _this$eventShouldLive5.shouldLiveInRoom,
2711
- shouldLiveInThread = _this$eventShouldLive5.shouldLiveInThread,
2712
- threadId = _this$eventShouldLive5.threadId;
2625
+ const {
2626
+ shouldLiveInRoom,
2627
+ shouldLiveInThread,
2628
+ threadId
2629
+ } = this.eventShouldLiveIn(event, events, threadRoots);
2713
2630
  if (shouldLiveInRoom) {
2714
2631
  memo[ROOM].push(event);
2715
2632
  }
2716
2633
  if (shouldLiveInThread) {
2717
- event.setThreadId(threadId !== null && threadId !== void 0 ? threadId : "");
2634
+ event.setThreadId(threadId ?? "");
2718
2635
  memo[THREAD].push(event);
2719
2636
  }
2720
2637
  if (!shouldLiveInThread && !shouldLiveInRoom) {
@@ -2732,9 +2649,9 @@ export class Room extends ReadReceipt {
2732
2649
  * Given some events, find the IDs of all the thread roots that are referred to by them.
2733
2650
  */
2734
2651
  findThreadRoots(events) {
2735
- var threadRoots = new Set();
2736
- for (var event of events) {
2737
- var threadRootId = event.threadRootId;
2652
+ const threadRoots = new Set();
2653
+ for (const event of events) {
2654
+ const threadRootId = event.threadRootId;
2738
2655
  if (threadRootId != undefined) {
2739
2656
  threadRoots.add(threadRootId);
2740
2657
  }
@@ -2747,19 +2664,17 @@ export class Room extends ReadReceipt {
2747
2664
  * @param event - The m.receipt event.
2748
2665
  * @param synthetic - True if this event is implicit.
2749
2666
  */
2750
- addReceipt(event) {
2751
- var synthetic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2752
- var content = event.getContent();
2667
+ addReceipt(event, synthetic = false) {
2668
+ const content = event.getContent();
2753
2669
  this.roomReceipts.add(content, synthetic);
2754
2670
 
2755
2671
  // TODO: delete the following code when it has been replaced by RoomReceipts
2756
2672
  Object.keys(content).forEach(eventId => {
2757
2673
  Object.keys(content[eventId]).forEach(receiptType => {
2758
2674
  Object.keys(content[eventId][receiptType]).forEach(userId => {
2759
- var _receipt$thread_id, _this$unthreadedRecei, _this$unthreadedRecei2;
2760
- var receipt = content[eventId][receiptType][userId];
2761
- var receiptForMainTimeline = !receipt.thread_id || receipt.thread_id === MAIN_ROOM_TIMELINE;
2762
- var receiptDestination = receiptForMainTimeline ? this : this.threads.get((_receipt$thread_id = receipt.thread_id) !== null && _receipt$thread_id !== void 0 ? _receipt$thread_id : "");
2675
+ const receipt = content[eventId][receiptType][userId];
2676
+ const receiptForMainTimeline = !receipt.thread_id || receipt.thread_id === MAIN_ROOM_TIMELINE;
2677
+ const receiptDestination = receiptForMainTimeline ? this : this.threads.get(receipt.thread_id ?? "");
2763
2678
  if (receiptDestination) {
2764
2679
  receiptDestination.addReceiptToStructure(eventId, receiptType, userId, receipt, synthetic);
2765
2680
 
@@ -2777,18 +2692,17 @@ export class Room extends ReadReceipt {
2777
2692
  // an event during the sync. More explanation at:
2778
2693
  // https://github.com/matrix-org/matrix-js-sdk/issues/3684
2779
2694
  if (!synthetic && this.client.isInitialSyncComplete() && userId === this.client.getUserId()) {
2780
- var lastEvent = receiptDestination.timeline[receiptDestination.timeline.length - 1];
2695
+ const lastEvent = receiptDestination.timeline[receiptDestination.timeline.length - 1];
2781
2696
  if (lastEvent && eventId === lastEvent.getId() && userId === lastEvent.getSender()) {
2782
2697
  receiptDestination.setUnread(NotificationCountType.Total, 0);
2783
2698
  receiptDestination.setUnread(NotificationCountType.Highlight, 0);
2784
2699
  }
2785
2700
  }
2786
2701
  } else {
2787
- var _this$cachedThreadRea2;
2788
2702
  // The thread does not exist locally, keep the read receipt
2789
2703
  // in a cache locally, and re-apply the `addReceipt` logic
2790
2704
  // when the thread is created
2791
- this.cachedThreadReadReceipts.set(receipt.thread_id, [...((_this$cachedThreadRea2 = this.cachedThreadReadReceipts.get(receipt.thread_id)) !== null && _this$cachedThreadRea2 !== void 0 ? _this$cachedThreadRea2 : []), {
2705
+ this.cachedThreadReadReceipts.set(receipt.thread_id, [...(this.cachedThreadReadReceipts.get(receipt.thread_id) ?? []), {
2792
2706
  eventId,
2793
2707
  receiptType,
2794
2708
  userId,
@@ -2796,14 +2710,14 @@ export class Room extends ReadReceipt {
2796
2710
  synthetic
2797
2711
  }]);
2798
2712
  }
2799
- var me = this.client.getUserId();
2713
+ const me = this.client.getUserId();
2800
2714
  // Track the time of the current user's oldest threaded receipt in the room.
2801
2715
  if (userId === me && !receiptForMainTimeline && receipt.ts < this.oldestThreadedReceiptTs) {
2802
2716
  this.oldestThreadedReceiptTs = receipt.ts;
2803
2717
  }
2804
2718
 
2805
2719
  // Track each user's unthreaded read receipt.
2806
- if (!receipt.thread_id && receipt.ts > ((_this$unthreadedRecei = (_this$unthreadedRecei2 = this.unthreadedReceipts.get(userId)) === null || _this$unthreadedRecei2 === void 0 ? void 0 : _this$unthreadedRecei2.ts) !== null && _this$unthreadedRecei !== void 0 ? _this$unthreadedRecei : 0)) {
2720
+ if (!receipt.thread_id && receipt.ts > (this.unthreadedReceipts.get(userId)?.ts ?? 0)) {
2807
2721
  this.unthreadedReceipts.set(userId, receipt);
2808
2722
  }
2809
2723
  });
@@ -2821,7 +2735,7 @@ export class Room extends ReadReceipt {
2821
2735
  * @param events - A list of events to process
2822
2736
  */
2823
2737
  addEphemeralEvents(events) {
2824
- for (var event of events) {
2738
+ for (const event of events) {
2825
2739
  if (event.getType() === EventType.Typing) {
2826
2740
  this.currentState.setTypingEvent(event);
2827
2741
  } else if (event.getType() === EventType.Receipt) {
@@ -2835,7 +2749,7 @@ export class Room extends ReadReceipt {
2835
2749
  * @param eventIds - A list of eventIds to remove.
2836
2750
  */
2837
2751
  removeEvents(eventIds) {
2838
- for (var eventId of eventIds) {
2752
+ for (const eventId of eventIds) {
2839
2753
  this.removeEvent(eventId);
2840
2754
  }
2841
2755
  }
@@ -2848,9 +2762,9 @@ export class Room extends ReadReceipt {
2848
2762
  * @returns true if the event was removed from any of the room's timeline sets
2849
2763
  */
2850
2764
  removeEvent(eventId) {
2851
- var removedAny = false;
2852
- for (var timelineSet of this.timelineSets) {
2853
- var removed = timelineSet.removeEvent(eventId);
2765
+ let removedAny = false;
2766
+ for (const timelineSet of this.timelineSets) {
2767
+ const removed = timelineSet.removeEvent(eventId);
2854
2768
  if (removed) {
2855
2769
  if (removed.isRedaction()) {
2856
2770
  this.revertRedactionLocalEcho(removed);
@@ -2872,14 +2786,14 @@ export class Room extends ReadReceipt {
2872
2786
  recalculate() {
2873
2787
  // set fake stripped state events if this is an invite room so logic remains
2874
2788
  // consistent elsewhere.
2875
- var membershipEvent = this.currentState.getStateEvents(EventType.RoomMember, this.myUserId);
2789
+ const membershipEvent = this.currentState.getStateEvents(EventType.RoomMember, this.myUserId);
2876
2790
  if (membershipEvent) {
2877
- var membership = membershipEvent.getContent().membership;
2791
+ const membership = membershipEvent.getContent().membership;
2878
2792
  this.updateMyMembership(membership);
2879
2793
  if (membership === KnownMembership.Invite) {
2880
- var strippedStateEvents = membershipEvent.getUnsigned().invite_room_state || [];
2794
+ const strippedStateEvents = membershipEvent.getUnsigned().invite_room_state || [];
2881
2795
  strippedStateEvents.forEach(strippedEvent => {
2882
- var existingEvent = this.currentState.getStateEvents(strippedEvent.type, strippedEvent.state_key);
2796
+ const existingEvent = this.currentState.getStateEvents(strippedEvent.type, strippedEvent.state_key);
2883
2797
  if (!existingEvent) {
2884
2798
  // set the fake stripped event instead
2885
2799
  this.currentState.setStateEvents([new MatrixEvent({
@@ -2894,7 +2808,7 @@ export class Room extends ReadReceipt {
2894
2808
  });
2895
2809
  }
2896
2810
  }
2897
- var oldName = this.name;
2811
+ const oldName = this.name;
2898
2812
  this.name = this.calculateRoomName(this.myUserId);
2899
2813
  this.normalizedName = normalize(this.name);
2900
2814
  this.summary = new RoomSummary(this.roomId, {
@@ -2931,12 +2845,12 @@ export class Room extends ReadReceipt {
2931
2845
  * @param events - an array of account_data events to add
2932
2846
  */
2933
2847
  addAccountData(events) {
2934
- for (var event of events) {
2848
+ for (const event of events) {
2935
2849
  if (event.getType() === "m.tag") {
2936
2850
  this.addTags(event);
2937
2851
  }
2938
- var eventType = event.getType();
2939
- var lastEvent = this.accountData.get(eventType);
2852
+ const eventType = event.getType();
2853
+ const lastEvent = this.accountData.get(eventType);
2940
2854
  this.accountData.set(eventType, event);
2941
2855
  this.emit(RoomEvent.AccountData, event, this, lastEvent);
2942
2856
  }
@@ -2990,6 +2904,8 @@ export class Room extends ReadReceipt {
2990
2904
  */
2991
2905
  // eslint-disable-next-line
2992
2906
  _unstable_addStickyEvents(events) {
2907
+ // ALWAYS filter out any events that are past retention
2908
+ events = events.filter(e => this.retention?.shouldEventBeRetained(e) ?? true);
2993
2909
  return this.stickyEvents.addStickyEvents(events);
2994
2910
  }
2995
2911
 
@@ -3008,10 +2924,10 @@ export class Room extends ReadReceipt {
3008
2924
  * @returns true if the user should be permitted to issue invites for this room.
3009
2925
  */
3010
2926
  canInvite(userId) {
3011
- var canInvite = this.getMyMembership() === KnownMembership.Join;
3012
- var powerLevelsEvent = this.currentState.getStateEvents(EventType.RoomPowerLevels, "");
3013
- var powerLevels = powerLevelsEvent && powerLevelsEvent.getContent();
3014
- var me = this.getMember(userId);
2927
+ let canInvite = this.getMyMembership() === KnownMembership.Join;
2928
+ const powerLevelsEvent = this.currentState.getStateEvents(EventType.RoomPowerLevels, "");
2929
+ const powerLevels = powerLevelsEvent && powerLevelsEvent.getContent();
2930
+ const me = this.getMember(userId);
3015
2931
  if (powerLevels && me && powerLevels.invite > me.powerLevel) {
3016
2932
  canInvite = false;
3017
2933
  }
@@ -3047,7 +2963,7 @@ export class Room extends ReadReceipt {
3047
2963
  * @returns the type of the room.
3048
2964
  */
3049
2965
  getType() {
3050
- var createEvent = this.currentState.getStateEvents(EventType.RoomCreate, "");
2966
+ const createEvent = this.currentState.getStateEvents(EventType.RoomCreate, "");
3051
2967
  if (!createEvent) {
3052
2968
  if (!this.getTypeWarning) {
3053
2969
  logger.warn("[getType] Room " + this.roomId + " does not have an m.room.create event");
@@ -3100,9 +3016,8 @@ export class Room extends ReadReceipt {
3100
3016
  * this predecessor comes from a RoomCreate event (rather than a
3101
3017
  * RoomPredecessor, which has the optional via_servers property).
3102
3018
  */
3103
- findPredecessor() {
3104
- var msc3946ProcessDynamicPredecessor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3105
- var currentState = this.getLiveTimeline().getState(EventTimeline.FORWARDS);
3019
+ findPredecessor(msc3946ProcessDynamicPredecessor = false) {
3020
+ const currentState = this.getLiveTimeline().getState(EventTimeline.FORWARDS);
3106
3021
  if (!currentState) {
3107
3022
  return null;
3108
3023
  }
@@ -3110,7 +3025,7 @@ export class Room extends ReadReceipt {
3110
3025
  }
3111
3026
  roomNameGenerator(state) {
3112
3027
  if (this.client.roomNameGenerator) {
3113
- var name = this.client.roomNameGenerator(this.roomId, state);
3028
+ const name = this.client.roomNameGenerator(this.roomId, state);
3114
3029
  if (name !== null) {
3115
3030
  return name;
3116
3031
  }
@@ -3121,13 +3036,13 @@ export class Room extends ReadReceipt {
3121
3036
  case RoomNameType.Generated:
3122
3037
  switch (state.subtype) {
3123
3038
  case "Inviting":
3124
- return "Inviting ".concat(memberNamesToRoomName(state.names, state.count));
3039
+ return `Inviting ${memberNamesToRoomName(state.names, state.count)}`;
3125
3040
  default:
3126
3041
  return memberNamesToRoomName(state.names, state.count);
3127
3042
  }
3128
3043
  case RoomNameType.EmptyRoom:
3129
3044
  if (state.oldName) {
3130
- return "Empty room (was ".concat(state.oldName, ")");
3045
+ return `Empty room (was ${state.oldName})`;
3131
3046
  } else {
3132
3047
  return "Empty room";
3133
3048
  }
@@ -3143,11 +3058,9 @@ export class Room extends ReadReceipt {
3143
3058
  * was no m.room.name event.
3144
3059
  * @returns The calculated room name.
3145
3060
  */
3146
- calculateRoomName(userId) {
3147
- var ignoreRoomNameEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3061
+ calculateRoomName(userId, ignoreRoomNameEvent = false) {
3148
3062
  if (!ignoreRoomNameEvent) {
3149
- var _this$currentState$ge4;
3150
- var name = (_this$currentState$ge4 = this.currentState.getStateEvents(EventType.RoomName, "")) === null || _this$currentState$ge4 === void 0 ? void 0 : _this$currentState$ge4.getContent().name;
3063
+ const name = this.currentState.getStateEvents(EventType.RoomName, "")?.getContent().name;
3151
3064
  if (name && typeof name === "string") {
3152
3065
  return this.roomNameGenerator({
3153
3066
  type: RoomNameType.Actual,
@@ -3155,23 +3068,23 @@ export class Room extends ReadReceipt {
3155
3068
  });
3156
3069
  }
3157
3070
  }
3158
- var alias = this.getCanonicalAlias();
3071
+ const alias = this.getCanonicalAlias();
3159
3072
  if (alias) {
3160
3073
  return this.roomNameGenerator({
3161
3074
  type: RoomNameType.Actual,
3162
3075
  name: alias
3163
3076
  });
3164
3077
  }
3165
- var joinedMemberCount = this.currentState.getJoinedMemberCount();
3166
- var invitedMemberCount = this.currentState.getInvitedMemberCount();
3078
+ const joinedMemberCount = this.currentState.getJoinedMemberCount();
3079
+ const invitedMemberCount = this.currentState.getInvitedMemberCount();
3167
3080
  // -1 because these numbers include the syncing user
3168
- var inviteJoinCount = joinedMemberCount + invitedMemberCount - 1;
3081
+ let inviteJoinCount = joinedMemberCount + invitedMemberCount - 1;
3169
3082
 
3170
3083
  // get service members (e.g. helper bots) for exclusion
3171
- var excludedUserIds = this.getFunctionalMembers();
3084
+ const excludedUserIds = this.getFunctionalMembers();
3172
3085
 
3173
3086
  // get members from heroes that are NOT ourselves
3174
- var otherNames = [];
3087
+ let otherNames = [];
3175
3088
  if (this.heroes) {
3176
3089
  // if we have heroes, use those as the names
3177
3090
  this.heroes.forEach(hero => {
@@ -3186,16 +3099,17 @@ export class Room extends ReadReceipt {
3186
3099
  if (hero.displayName) {
3187
3100
  otherNames.push(hero.displayName);
3188
3101
  } else {
3189
- var member = this.getMember(hero.userId);
3102
+ const member = this.getMember(hero.userId);
3190
3103
  otherNames.push(member ? member.name : hero.userId);
3191
3104
  }
3192
3105
  });
3193
3106
  } else {
3194
- var otherMembers = this.currentState.getMembers().filter(m => {
3107
+ let otherMembers = this.currentState.getMembers().filter(m => {
3195
3108
  return m.userId !== userId && (m.membership === KnownMembership.Invite || m.membership === KnownMembership.Join);
3196
3109
  });
3197
- otherMembers = otherMembers.filter(_ref20 => {
3198
- var userId = _ref20.userId;
3110
+ otherMembers = otherMembers.filter(({
3111
+ userId
3112
+ }) => {
3199
3113
  // filter service members
3200
3114
  if (excludedUserIds.includes(userId)) {
3201
3115
  inviteJoinCount--;
@@ -3204,7 +3118,7 @@ export class Room extends ReadReceipt {
3204
3118
  return true;
3205
3119
  });
3206
3120
  // make sure members have stable order
3207
- var collator = new Intl.Collator();
3121
+ const collator = new Intl.Collator();
3208
3122
  otherMembers.sort((a, b) => collator.compare(a.userId, b.userId));
3209
3123
  // only 5 first members, immitate summaryHeroes
3210
3124
  otherMembers = otherMembers.slice(0, 5);
@@ -3217,13 +3131,13 @@ export class Room extends ReadReceipt {
3217
3131
  count: inviteJoinCount
3218
3132
  });
3219
3133
  }
3220
- var myMembership = this.getMyMembership();
3134
+ const myMembership = this.getMyMembership();
3221
3135
  // if I have created a room and invited people through
3222
3136
  // 3rd party invites
3223
3137
  if (myMembership == KnownMembership.Join) {
3224
- var thirdPartyInvites = this.currentState.getStateEvents(EventType.RoomThirdPartyInvite);
3225
- if (thirdPartyInvites !== null && thirdPartyInvites !== void 0 && thirdPartyInvites.length) {
3226
- var thirdPartyNames = thirdPartyInvites.map(i => {
3138
+ const thirdPartyInvites = this.currentState.getStateEvents(EventType.RoomThirdPartyInvite);
3139
+ if (thirdPartyInvites?.length) {
3140
+ const thirdPartyNames = thirdPartyInvites.map(i => {
3227
3141
  return i.getContent().display_name;
3228
3142
  });
3229
3143
  return this.roomNameGenerator({
@@ -3236,14 +3150,14 @@ export class Room extends ReadReceipt {
3236
3150
  }
3237
3151
 
3238
3152
  // let's try to figure out who was here before
3239
- var leftNames = otherNames;
3153
+ let leftNames = otherNames;
3240
3154
  // if we didn't have heroes, try finding them in the room state
3241
3155
  if (!leftNames.length) {
3242
3156
  leftNames = this.currentState.getMembers().filter(m => {
3243
3157
  return m.userId !== userId && m.membership !== KnownMembership.Invite && m.membership !== KnownMembership.Join;
3244
3158
  }).map(m => m.name);
3245
3159
  }
3246
- var oldName;
3160
+ let oldName;
3247
3161
  if (leftNames.length) {
3248
3162
  oldName = this.roomNameGenerator({
3249
3163
  type: RoomNameType.Generated,
@@ -3266,18 +3180,18 @@ export class Room extends ReadReceipt {
3266
3180
  * patch it to reflect the visibility change and inform listeners.
3267
3181
  */
3268
3182
  applyNewVisibilityEvent(event) {
3269
- var visibilityChange = event.asVisibilityChange();
3183
+ const visibilityChange = event.asVisibilityChange();
3270
3184
  if (!visibilityChange) {
3271
3185
  // The event is ill-formed.
3272
3186
  return;
3273
3187
  }
3274
3188
 
3275
3189
  // Ignore visibility change events that are not emitted by moderators.
3276
- var userId = event.getSender();
3190
+ const userId = event.getSender();
3277
3191
  if (!userId) {
3278
3192
  return;
3279
3193
  }
3280
- var isPowerSufficient = EVENT_VISIBILITY_CHANGE_TYPE.name && this.currentState.maySendStateEvent(EVENT_VISIBILITY_CHANGE_TYPE.name, userId) || EVENT_VISIBILITY_CHANGE_TYPE.altName && this.currentState.maySendStateEvent(EVENT_VISIBILITY_CHANGE_TYPE.altName, userId);
3194
+ const isPowerSufficient = EVENT_VISIBILITY_CHANGE_TYPE.name && this.currentState.maySendStateEvent(EVENT_VISIBILITY_CHANGE_TYPE.name, userId) || EVENT_VISIBILITY_CHANGE_TYPE.altName && this.currentState.maySendStateEvent(EVENT_VISIBILITY_CHANGE_TYPE.altName, userId);
3281
3195
  if (!isPowerSufficient) {
3282
3196
  // Powerlevel is insufficient.
3283
3197
  return;
@@ -3287,7 +3201,7 @@ export class Room extends ReadReceipt {
3287
3201
  // If the event is not in our timeline and we only receive it later,
3288
3202
  // we may need to apply the visibility change at a later date.
3289
3203
 
3290
- var visibilityEventsOnOriginalEvent = this.visibilityEvents.get(visibilityChange.eventId);
3204
+ const visibilityEventsOnOriginalEvent = this.visibilityEvents.get(visibilityChange.eventId);
3291
3205
  if (visibilityEventsOnOriginalEvent) {
3292
3206
  // It would be tempting to simply erase the latest visibility change
3293
3207
  // but we need to record all of the changes in case the latest change
@@ -3296,10 +3210,10 @@ export class Room extends ReadReceipt {
3296
3210
  // In practice, linear scans through `visibilityEvents` should be fast.
3297
3211
  // However, to protect against a potential DoS attack, we limit the
3298
3212
  // number of iterations in this loop.
3299
- var index = visibilityEventsOnOriginalEvent.length - 1;
3300
- var min = Math.max(0, visibilityEventsOnOriginalEvent.length - MAX_NUMBER_OF_VISIBILITY_EVENTS_TO_SCAN_THROUGH);
3213
+ let index = visibilityEventsOnOriginalEvent.length - 1;
3214
+ const min = Math.max(0, visibilityEventsOnOriginalEvent.length - MAX_NUMBER_OF_VISIBILITY_EVENTS_TO_SCAN_THROUGH);
3301
3215
  for (; index >= min; --index) {
3302
- var target = visibilityEventsOnOriginalEvent[index];
3216
+ const target = visibilityEventsOnOriginalEvent[index];
3303
3217
  if (target.getTs() < event.getTs()) {
3304
3218
  break;
3305
3219
  }
@@ -3316,7 +3230,7 @@ export class Room extends ReadReceipt {
3316
3230
  // Finally, let's check if the event is already in our timeline.
3317
3231
  // If so, we need to patch it and inform listeners.
3318
3232
 
3319
- var originalEvent = this.findEventById(visibilityChange.eventId);
3233
+ const originalEvent = this.findEventById(visibilityChange.eventId);
3320
3234
  if (!originalEvent) {
3321
3235
  return;
3322
3236
  }
@@ -3327,16 +3241,16 @@ export class Room extends ReadReceipt {
3327
3241
  if (!event.isVisibilityEvent) {
3328
3242
  throw new Error("expected a visibility change event");
3329
3243
  }
3330
- var relation = event.getRelation();
3331
- var originalEventId = relation === null || relation === void 0 ? void 0 : relation.event_id;
3332
- var visibilityEventsOnOriginalEvent = this.visibilityEvents.get(originalEventId);
3244
+ const relation = event.getRelation();
3245
+ const originalEventId = relation?.event_id;
3246
+ const visibilityEventsOnOriginalEvent = this.visibilityEvents.get(originalEventId);
3333
3247
  if (!visibilityEventsOnOriginalEvent) {
3334
3248
  // No visibility changes on the original event.
3335
3249
  // In particular, this change event was not recorded,
3336
3250
  // most likely because it was ill-formed.
3337
3251
  return;
3338
3252
  }
3339
- var index = visibilityEventsOnOriginalEvent.findIndex(change => change.getId() === event.getId());
3253
+ const index = visibilityEventsOnOriginalEvent.findIndex(change => change.getId() === event.getId());
3340
3254
  if (index === -1) {
3341
3255
  // This change event was not recorded, most likely because
3342
3256
  // it was ill-formed.
@@ -3347,7 +3261,7 @@ export class Room extends ReadReceipt {
3347
3261
 
3348
3262
  // If we removed the latest visibility change event, propagate changes.
3349
3263
  if (index === visibilityEventsOnOriginalEvent.length) {
3350
- var originalEvent = this.findEventById(originalEventId);
3264
+ const originalEvent = this.findEventById(originalEventId);
3351
3265
  if (!originalEvent) {
3352
3266
  return;
3353
3267
  }
@@ -3356,8 +3270,8 @@ export class Room extends ReadReceipt {
3356
3270
  this.visibilityEvents.delete(originalEventId);
3357
3271
  originalEvent.applyVisibilityEvent();
3358
3272
  } else {
3359
- var newEvent = visibilityEventsOnOriginalEvent[visibilityEventsOnOriginalEvent.length - 1];
3360
- var newVisibility = newEvent.asVisibilityChange();
3273
+ const newEvent = visibilityEventsOnOriginalEvent[visibilityEventsOnOriginalEvent.length - 1];
3274
+ const newVisibility = newEvent.asVisibilityChange();
3361
3275
  if (!newVisibility) {
3362
3276
  // Event is ill-formed.
3363
3277
  // This breaks our invariant.
@@ -3378,13 +3292,13 @@ export class Room extends ReadReceipt {
3378
3292
  * change event.
3379
3293
  */
3380
3294
  applyPendingVisibilityEvents(event) {
3381
- var visibilityEvents = this.visibilityEvents.get(event.getId());
3295
+ const visibilityEvents = this.visibilityEvents.get(event.getId());
3382
3296
  if (!visibilityEvents || visibilityEvents.length == 0) {
3383
3297
  // No pending visibility change in store.
3384
3298
  return;
3385
3299
  }
3386
- var visibilityEvent = visibilityEvents[visibilityEvents.length - 1];
3387
- var visibilityChange = visibilityEvent.asVisibilityChange();
3300
+ const visibilityEvent = visibilityEvents[visibilityEvents.length - 1];
3301
+ const visibilityChange = visibilityEvent.asVisibilityChange();
3388
3302
  if (!visibilityChange) {
3389
3303
  return;
3390
3304
  }
@@ -3448,8 +3362,8 @@ export class Room extends ReadReceipt {
3448
3362
  */
3449
3363
  fixupNotifications(userId) {
3450
3364
  super.fixupNotifications(userId);
3451
- var unreadThreads = this.getThreads().filter(thread => this.getThreadUnreadNotificationCount(thread.id, NotificationCountType.Total) > 0);
3452
- for (var thread of unreadThreads) {
3365
+ const unreadThreads = this.getThreads().filter(thread => this.getThreadUnreadNotificationCount(thread.id, NotificationCountType.Total) > 0);
3366
+ for (const thread of unreadThreads) {
3453
3367
  thread.fixupNotifications(userId);
3454
3368
  }
3455
3369
  }
@@ -3484,13 +3398,12 @@ export class Room extends ReadReceipt {
3484
3398
  * will encrypt outgoing events).
3485
3399
  */
3486
3400
  hasEncryptionStateEvent() {
3487
- var _this$getLiveTimeline;
3488
- return Boolean((_this$getLiveTimeline = this.getLiveTimeline().getState(EventTimeline.FORWARDS)) === null || _this$getLiveTimeline === void 0 ? void 0 : _this$getLiveTimeline.getStateEvents(EventType.RoomEncryption, ""));
3401
+ return Boolean(this.getLiveTimeline().getState(EventTimeline.FORWARDS)?.getStateEvents(EventType.RoomEncryption, ""));
3489
3402
  }
3490
3403
  }
3491
3404
 
3492
3405
  // a map from current event status to a list of allowed next statuses
3493
- var ALLOWED_TRANSITIONS = {
3406
+ const ALLOWED_TRANSITIONS = {
3494
3407
  [EventStatus.ENCRYPTING]: [EventStatus.SENDING, EventStatus.NOT_SENT, EventStatus.CANCELLED],
3495
3408
  [EventStatus.SENDING]: [EventStatus.ENCRYPTING, EventStatus.QUEUED, EventStatus.NOT_SENT, EventStatus.SENT],
3496
3409
  [EventStatus.QUEUED]: [EventStatus.SENDING, EventStatus.NOT_SENT, EventStatus.CANCELLED],
@@ -3498,7 +3411,7 @@ var ALLOWED_TRANSITIONS = {
3498
3411
  [EventStatus.NOT_SENT]: [EventStatus.SENDING, EventStatus.QUEUED, EventStatus.CANCELLED],
3499
3412
  [EventStatus.CANCELLED]: []
3500
3413
  };
3501
- export var RoomNameType = /*#__PURE__*/function (RoomNameType) {
3414
+ export let RoomNameType = /*#__PURE__*/function (RoomNameType) {
3502
3415
  RoomNameType[RoomNameType["EmptyRoom"] = 0] = "EmptyRoom";
3503
3416
  RoomNameType[RoomNameType["Generated"] = 1] = "Generated";
3504
3417
  RoomNameType[RoomNameType["Actual"] = 2] = "Actual";
@@ -3506,19 +3419,19 @@ export var RoomNameType = /*#__PURE__*/function (RoomNameType) {
3506
3419
  }({});
3507
3420
  // Can be overriden by IMatrixClientCreateOpts::memberNamesToRoomNameFn
3508
3421
  function memberNamesToRoomName(names, count) {
3509
- var countWithoutMe = count - 1;
3422
+ const countWithoutMe = count - 1;
3510
3423
  if (!names.length) {
3511
3424
  return "Empty room";
3512
3425
  } else if (names.length === 1 && countWithoutMe <= 1) {
3513
3426
  return names[0];
3514
3427
  } else if (names.length === 2 && countWithoutMe <= 2) {
3515
- return "".concat(names[0], " and ").concat(names[1]);
3428
+ return `${names[0]} and ${names[1]}`;
3516
3429
  } else {
3517
- var plural = countWithoutMe > 1;
3430
+ const plural = countWithoutMe > 1;
3518
3431
  if (plural) {
3519
- return "".concat(names[0], " and ").concat(countWithoutMe, " others");
3432
+ return `${names[0]} and ${countWithoutMe} others`;
3520
3433
  } else {
3521
- return "".concat(names[0], " and 1 other");
3434
+ return `${names[0]} and 1 other`;
3522
3435
  }
3523
3436
  }
3524
3437
  }