@ethora/chat-component-rn 26.8.1 → 26.8.2

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 (604) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +43 -10
  3. package/lib/commonjs/assets/icons.js +7 -2
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/AuthForms/Login.js +4 -4
  6. package/lib/commonjs/components/AuthForms/Login.js.map +1 -1
  7. package/lib/commonjs/components/Header/HeaderRoomList.js +29 -8
  8. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/ChatHeader.js +9 -3
  10. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/ChatRoom.js +150 -14
  12. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/ChatWrapper.js +34 -13
  14. package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
  15. package/lib/commonjs/components/MainComponents/LoginWrapper.js +2 -1
  16. package/lib/commonjs/components/MainComponents/LoginWrapper.js.map +1 -1
  17. package/lib/commonjs/components/MainComponents/MediaMessage.js +29 -9
  18. package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
  19. package/lib/commonjs/components/MainComponents/MessageContainer.js +5 -1
  20. package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
  21. package/lib/commonjs/components/MainComponents/MessageList.js +13 -5
  22. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  23. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +14 -13
  24. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  25. package/lib/commonjs/components/MainComponents/RoomList.js +208 -35
  26. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  27. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +317 -98
  28. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  29. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +322 -110
  30. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  31. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +546 -203
  32. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  33. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +226 -0
  34. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
  35. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +69 -27
  36. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  37. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +2 -1
  38. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  39. package/lib/commonjs/components/Modals/Modal/Modal.js +8 -0
  40. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  41. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +2 -1
  42. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  43. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +202 -106
  44. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  45. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
  46. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  47. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +563 -0
  48. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
  49. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +210 -0
  50. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
  51. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
  52. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  53. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +7 -21
  54. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  55. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +507 -244
  56. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  57. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +74 -46
  58. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  59. package/lib/commonjs/components/Modals/styledModalComponents.js +9 -2
  60. package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
  61. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +21 -7
  62. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  63. package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +22 -3
  64. package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
  65. package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +17 -3
  66. package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
  67. package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +17 -3
  68. package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
  69. package/lib/commonjs/components/VideoCalls/VideoCallSession.js +6 -3
  70. package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
  71. package/lib/commonjs/components/styled/AudioMessage.js +2 -1
  72. package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
  73. package/lib/commonjs/components/styled/MessageImage.js +37 -9
  74. package/lib/commonjs/components/styled/MessageImage.js.map +1 -1
  75. package/lib/commonjs/components/styled/SendInput.js +80 -11
  76. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  77. package/lib/commonjs/components/styled/StyledComponents.js +9 -3
  78. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  79. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
  80. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  81. package/lib/commonjs/components/styled/UnsupportedType.js +14 -4
  82. package/lib/commonjs/components/styled/UnsupportedType.js.map +1 -1
  83. package/lib/commonjs/components/styled/VideoMessage.js +119 -61
  84. package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
  85. package/lib/commonjs/context/xmppProvider.js +184 -59
  86. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  87. package/lib/commonjs/helpers/createMessageFromXml.js +19 -1
  88. package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
  89. package/lib/commonjs/helpers/ensureScopedChatCache.js +2 -2
  90. package/lib/commonjs/helpers/ensureScopedChatCache.js.map +1 -1
  91. package/lib/commonjs/helpers/getChatBackground.js +23 -0
  92. package/lib/commonjs/helpers/getChatBackground.js.map +1 -0
  93. package/lib/commonjs/helpers/getDisplayFileName.js +79 -0
  94. package/lib/commonjs/helpers/getDisplayFileName.js.map +1 -0
  95. package/lib/commonjs/helpers/getServerReadTimestamp.js +188 -0
  96. package/lib/commonjs/helpers/getServerReadTimestamp.js.map +1 -0
  97. package/lib/commonjs/helpers/historyPreloadScheduler.js +65 -2
  98. package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
  99. package/lib/commonjs/helpers/initXmppRooms.js +14 -8
  100. package/lib/commonjs/helpers/initXmppRooms.js.map +1 -1
  101. package/lib/commonjs/helpers/insertMessageWithDelimiter.js +51 -9
  102. package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
  103. package/lib/commonjs/helpers/isOwnMessage.js +75 -0
  104. package/lib/commonjs/helpers/isOwnMessage.js.map +1 -0
  105. package/lib/commonjs/helpers/keyboardLayout.js +12 -2
  106. package/lib/commonjs/helpers/keyboardLayout.js.map +1 -1
  107. package/lib/commonjs/helpers/mediaLibraryRuntime.js +31 -0
  108. package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +1 -0
  109. package/lib/commonjs/helpers/mimeToExtension.js +6 -14
  110. package/lib/commonjs/helpers/mimeToExtension.js.map +1 -1
  111. package/lib/commonjs/helpers/msgSortableMs.js +37 -0
  112. package/lib/commonjs/helpers/msgSortableMs.js.map +1 -0
  113. package/lib/commonjs/helpers/persistCrypto.js +122 -0
  114. package/lib/commonjs/helpers/persistCrypto.js.map +1 -0
  115. package/lib/commonjs/helpers/pickImageAsset.js +68 -0
  116. package/lib/commonjs/helpers/pickImageAsset.js.map +1 -0
  117. package/lib/commonjs/helpers/pushPayload.js +71 -0
  118. package/lib/commonjs/helpers/pushPayload.js.map +1 -0
  119. package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js +130 -17
  120. package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js.map +1 -1
  121. package/lib/commonjs/helpers/secureFileUrl.js +101 -0
  122. package/lib/commonjs/helpers/secureFileUrl.js.map +1 -0
  123. package/lib/commonjs/helpers/secureKeyValue.js +83 -0
  124. package/lib/commonjs/helpers/secureKeyValue.js.map +1 -0
  125. package/lib/commonjs/helpers/secureStoreRuntime.js +59 -0
  126. package/lib/commonjs/helpers/secureStoreRuntime.js.map +1 -0
  127. package/lib/commonjs/helpers/secureUserStorage.js +75 -0
  128. package/lib/commonjs/helpers/secureUserStorage.js.map +1 -0
  129. package/lib/commonjs/helpers/shallowEqual.js +36 -0
  130. package/lib/commonjs/helpers/shallowEqual.js.map +1 -0
  131. package/lib/commonjs/helpers/sheetGestures.js +32 -0
  132. package/lib/commonjs/helpers/sheetGestures.js.map +1 -0
  133. package/lib/commonjs/hooks/useChatRoomFocus.js +45 -12
  134. package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
  135. package/lib/commonjs/hooks/useChatWrapperInit.js +30 -10
  136. package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
  137. package/lib/commonjs/hooks/useComposing.js +27 -0
  138. package/lib/commonjs/hooks/useComposing.js.map +1 -1
  139. package/lib/commonjs/hooks/useFileToken.js +10 -0
  140. package/lib/commonjs/hooks/useFileToken.js.map +1 -0
  141. package/lib/commonjs/hooks/useLogout.js +23 -7
  142. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  143. package/lib/commonjs/hooks/usePendingNotification.js +8 -11
  144. package/lib/commonjs/hooks/usePendingNotification.js.map +1 -1
  145. package/lib/commonjs/hooks/useSendMessage.js +50 -14
  146. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  147. package/lib/commonjs/hooks/useUnreadMessagesCounter.js +6 -1
  148. package/lib/commonjs/hooks/useUnreadMessagesCounter.js.map +1 -1
  149. package/lib/commonjs/i18n/strings.js +145 -37
  150. package/lib/commonjs/i18n/strings.js.map +1 -1
  151. package/lib/commonjs/main.js +44 -0
  152. package/lib/commonjs/main.js.map +1 -1
  153. package/lib/commonjs/networking/api-requests/auth.api.js +134 -60
  154. package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
  155. package/lib/commonjs/networking/api-requests/roomMembers.api.js +1 -1
  156. package/lib/commonjs/networking/api-requests/roomMembers.api.js.map +1 -1
  157. package/lib/commonjs/networking/api-requests/rooms.api.js +9 -9
  158. package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
  159. package/lib/commonjs/networking/api-requests/user.api.js +68 -9
  160. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  161. package/lib/commonjs/networking/apiClient.js +62 -112
  162. package/lib/commonjs/networking/apiClient.js.map +1 -1
  163. package/lib/commonjs/networking/authRefresh.js +332 -0
  164. package/lib/commonjs/networking/authRefresh.js.map +1 -0
  165. package/lib/commonjs/networking/stanzaHandlers.js +41 -28
  166. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  167. package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js +46 -8
  168. package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
  169. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +8 -1
  170. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  171. package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
  172. package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
  173. package/lib/commonjs/networking/xmppClient.js +124 -8
  174. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  175. package/lib/commonjs/roomStore/chatSettingsSlice.js +26 -7
  176. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  177. package/lib/commonjs/roomStore/index.js +35 -2
  178. package/lib/commonjs/roomStore/index.js.map +1 -1
  179. package/lib/commonjs/roomStore/persistence.js +226 -23
  180. package/lib/commonjs/roomStore/persistence.js.map +1 -1
  181. package/lib/commonjs/roomStore/roomsSlice.js +151 -38
  182. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  183. package/lib/commonjs/services/pushSubscriptionService.js +15 -13
  184. package/lib/commonjs/services/pushSubscriptionService.js.map +1 -1
  185. package/lib/commonjs/version.js +1 -1
  186. package/lib/module/assets/icons.js +6 -1
  187. package/lib/module/assets/icons.js.map +1 -1
  188. package/lib/module/components/AuthForms/Login.js +4 -4
  189. package/lib/module/components/AuthForms/Login.js.map +1 -1
  190. package/lib/module/components/Header/HeaderRoomList.js +29 -8
  191. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  192. package/lib/module/components/MainComponents/ChatHeader.js +9 -3
  193. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  194. package/lib/module/components/MainComponents/ChatRoom.js +152 -16
  195. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  196. package/lib/module/components/MainComponents/ChatWrapper.js +35 -14
  197. package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
  198. package/lib/module/components/MainComponents/LoginWrapper.js +2 -1
  199. package/lib/module/components/MainComponents/LoginWrapper.js.map +1 -1
  200. package/lib/module/components/MainComponents/MediaMessage.js +30 -10
  201. package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
  202. package/lib/module/components/MainComponents/MessageContainer.js +5 -1
  203. package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
  204. package/lib/module/components/MainComponents/MessageList.js +13 -5
  205. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  206. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +14 -13
  207. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  208. package/lib/module/components/MainComponents/RoomList.js +207 -35
  209. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  210. package/lib/module/components/Menu/HeaderRoomListMenu.js +319 -101
  211. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  212. package/lib/module/components/Modals/AttachSheet/AttachSheet.js +313 -113
  213. package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  214. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +549 -207
  215. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  216. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +223 -0
  217. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
  218. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +70 -28
  219. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  220. package/lib/module/components/Modals/FilePreviewModal/PdfView.js +2 -1
  221. package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  222. package/lib/module/components/Modals/Modal/Modal.js +9 -1
  223. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  224. package/lib/module/components/Modals/NewChatModal/ModalContent.js +2 -1
  225. package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  226. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +205 -108
  227. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  228. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
  229. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  230. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +555 -0
  231. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
  232. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +205 -0
  233. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
  234. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
  235. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  236. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +9 -23
  237. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  238. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +509 -248
  239. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  240. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +76 -48
  241. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  242. package/lib/module/components/Modals/styledModalComponents.js +9 -2
  243. package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
  244. package/lib/module/components/RoomComponents/ChatRoomItem.js +21 -7
  245. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  246. package/lib/module/components/RoomComponents/styled/LastMessageFile.js +22 -3
  247. package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
  248. package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +17 -3
  249. package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
  250. package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +17 -3
  251. package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
  252. package/lib/module/components/VideoCalls/VideoCallSession.js +6 -3
  253. package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
  254. package/lib/module/components/styled/AudioMessage.js +2 -1
  255. package/lib/module/components/styled/AudioMessage.js.map +1 -1
  256. package/lib/module/components/styled/MessageImage.js +37 -9
  257. package/lib/module/components/styled/MessageImage.js.map +1 -1
  258. package/lib/module/components/styled/SendInput.js +81 -12
  259. package/lib/module/components/styled/SendInput.js.map +1 -1
  260. package/lib/module/components/styled/StyledComponents.js +9 -3
  261. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  262. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
  263. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  264. package/lib/module/components/styled/UnsupportedType.js +14 -4
  265. package/lib/module/components/styled/UnsupportedType.js.map +1 -1
  266. package/lib/module/components/styled/VideoMessage.js +120 -62
  267. package/lib/module/components/styled/VideoMessage.js.map +1 -1
  268. package/lib/module/context/xmppProvider.js +184 -60
  269. package/lib/module/context/xmppProvider.js.map +1 -1
  270. package/lib/module/helpers/createMessageFromXml.js +19 -1
  271. package/lib/module/helpers/createMessageFromXml.js.map +1 -1
  272. package/lib/module/helpers/ensureScopedChatCache.js +2 -2
  273. package/lib/module/helpers/ensureScopedChatCache.js.map +1 -1
  274. package/lib/module/helpers/getChatBackground.js +18 -0
  275. package/lib/module/helpers/getChatBackground.js.map +1 -0
  276. package/lib/module/helpers/getDisplayFileName.js +73 -0
  277. package/lib/module/helpers/getDisplayFileName.js.map +1 -0
  278. package/lib/module/helpers/getServerReadTimestamp.js +181 -0
  279. package/lib/module/helpers/getServerReadTimestamp.js.map +1 -0
  280. package/lib/module/helpers/historyPreloadScheduler.js +66 -3
  281. package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
  282. package/lib/module/helpers/initXmppRooms.js +14 -8
  283. package/lib/module/helpers/initXmppRooms.js.map +1 -1
  284. package/lib/module/helpers/insertMessageWithDelimiter.js +52 -9
  285. package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
  286. package/lib/module/helpers/isOwnMessage.js +70 -0
  287. package/lib/module/helpers/isOwnMessage.js.map +1 -0
  288. package/lib/module/helpers/keyboardLayout.js +12 -2
  289. package/lib/module/helpers/keyboardLayout.js.map +1 -1
  290. package/lib/module/helpers/mediaLibraryRuntime.js +25 -0
  291. package/lib/module/helpers/mediaLibraryRuntime.js.map +1 -0
  292. package/lib/module/helpers/mimeToExtension.js +6 -13
  293. package/lib/module/helpers/mimeToExtension.js.map +1 -1
  294. package/lib/module/helpers/msgSortableMs.js +32 -0
  295. package/lib/module/helpers/msgSortableMs.js.map +1 -0
  296. package/lib/module/helpers/persistCrypto.js +115 -0
  297. package/lib/module/helpers/persistCrypto.js.map +1 -0
  298. package/lib/module/helpers/pickImageAsset.js +63 -0
  299. package/lib/module/helpers/pickImageAsset.js.map +1 -0
  300. package/lib/module/helpers/pushPayload.js +63 -0
  301. package/lib/module/helpers/pushPayload.js.map +1 -0
  302. package/lib/module/helpers/resolveInitBeforeLoadUser.js +130 -16
  303. package/lib/module/helpers/resolveInitBeforeLoadUser.js.map +1 -1
  304. package/lib/module/helpers/secureFileUrl.js +91 -0
  305. package/lib/module/helpers/secureFileUrl.js.map +1 -0
  306. package/lib/module/helpers/secureKeyValue.js +75 -0
  307. package/lib/module/helpers/secureKeyValue.js.map +1 -0
  308. package/lib/module/helpers/secureStoreRuntime.js +52 -0
  309. package/lib/module/helpers/secureStoreRuntime.js.map +1 -0
  310. package/lib/module/helpers/secureUserStorage.js +72 -0
  311. package/lib/module/helpers/secureUserStorage.js.map +1 -0
  312. package/lib/module/helpers/shallowEqual.js +31 -0
  313. package/lib/module/helpers/shallowEqual.js.map +1 -0
  314. package/lib/module/helpers/sheetGestures.js +26 -0
  315. package/lib/module/helpers/sheetGestures.js.map +1 -0
  316. package/lib/module/hooks/useChatRoomFocus.js +46 -13
  317. package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
  318. package/lib/module/hooks/useChatWrapperInit.js +30 -10
  319. package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
  320. package/lib/module/hooks/useComposing.js +28 -1
  321. package/lib/module/hooks/useComposing.js.map +1 -1
  322. package/lib/module/hooks/useFileToken.js +5 -0
  323. package/lib/module/hooks/useFileToken.js.map +1 -0
  324. package/lib/module/hooks/useLogout.js +23 -7
  325. package/lib/module/hooks/useLogout.js.map +1 -1
  326. package/lib/module/hooks/usePendingNotification.js +8 -11
  327. package/lib/module/hooks/usePendingNotification.js.map +1 -1
  328. package/lib/module/hooks/useSendMessage.js +52 -16
  329. package/lib/module/hooks/useSendMessage.js.map +1 -1
  330. package/lib/module/hooks/useUnreadMessagesCounter.js +6 -1
  331. package/lib/module/hooks/useUnreadMessagesCounter.js.map +1 -1
  332. package/lib/module/i18n/strings.js +145 -37
  333. package/lib/module/i18n/strings.js.map +1 -1
  334. package/lib/module/main.js +14 -2
  335. package/lib/module/main.js.map +1 -1
  336. package/lib/module/networking/api-requests/auth.api.js +131 -59
  337. package/lib/module/networking/api-requests/auth.api.js.map +1 -1
  338. package/lib/module/networking/api-requests/roomMembers.api.js +1 -1
  339. package/lib/module/networking/api-requests/roomMembers.api.js.map +1 -1
  340. package/lib/module/networking/api-requests/rooms.api.js +9 -9
  341. package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
  342. package/lib/module/networking/api-requests/user.api.js +64 -7
  343. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  344. package/lib/module/networking/apiClient.js +61 -113
  345. package/lib/module/networking/apiClient.js.map +1 -1
  346. package/lib/module/networking/authRefresh.js +321 -0
  347. package/lib/module/networking/authRefresh.js.map +1 -0
  348. package/lib/module/networking/stanzaHandlers.js +41 -28
  349. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  350. package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js +46 -8
  351. package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
  352. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +8 -1
  353. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  354. package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
  355. package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
  356. package/lib/module/networking/xmppClient.js +124 -8
  357. package/lib/module/networking/xmppClient.js.map +1 -1
  358. package/lib/module/roomStore/chatSettingsSlice.js +26 -7
  359. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  360. package/lib/module/roomStore/index.js +37 -4
  361. package/lib/module/roomStore/index.js.map +1 -1
  362. package/lib/module/roomStore/persistence.js +223 -22
  363. package/lib/module/roomStore/persistence.js.map +1 -1
  364. package/lib/module/roomStore/roomsSlice.js +139 -34
  365. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  366. package/lib/module/services/pushSubscriptionService.js +15 -13
  367. package/lib/module/services/pushSubscriptionService.js.map +1 -1
  368. package/lib/module/version.js +1 -1
  369. package/lib/typescript/assets/icons.d.ts +16 -0
  370. package/lib/typescript/assets/icons.d.ts.map +1 -1
  371. package/lib/typescript/components/AuthForms/Login.d.ts.map +1 -1
  372. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  373. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  374. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  375. package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
  376. package/lib/typescript/components/MainComponents/LoginWrapper.d.ts.map +1 -1
  377. package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
  378. package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
  379. package/lib/typescript/components/MainComponents/MessageList.d.ts +10 -1
  380. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  381. package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
  382. package/lib/typescript/components/MainComponents/RoomList.d.ts +7 -0
  383. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  384. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +3 -0
  385. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  386. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +9 -0
  387. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
  388. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +10 -0
  389. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  390. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +9 -0
  391. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -0
  392. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  393. package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
  394. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  395. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +4 -2
  396. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
  397. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
  398. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
  399. package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
  400. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +75 -0
  401. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +1 -0
  402. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +25 -0
  403. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +1 -0
  404. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +6 -1
  405. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  406. package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
  407. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +16 -0
  408. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  409. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +1 -0
  410. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  411. package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
  412. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  413. package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts +1 -1
  414. package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts.map +1 -1
  415. package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts +1 -1
  416. package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts.map +1 -1
  417. package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts +1 -1
  418. package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts.map +1 -1
  419. package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
  420. package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
  421. package/lib/typescript/components/styled/MessageImage.d.ts +14 -0
  422. package/lib/typescript/components/styled/MessageImage.d.ts.map +1 -1
  423. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  424. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  425. package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
  426. package/lib/typescript/components/styled/UnsupportedType.d.ts.map +1 -1
  427. package/lib/typescript/components/styled/VideoMessage.d.ts +8 -0
  428. package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
  429. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  430. package/lib/typescript/helpers/createMessageFromXml.d.ts.map +1 -1
  431. package/lib/typescript/helpers/getChatBackground.d.ts +15 -0
  432. package/lib/typescript/helpers/getChatBackground.d.ts.map +1 -0
  433. package/lib/typescript/helpers/getDisplayFileName.d.ts +49 -0
  434. package/lib/typescript/helpers/getDisplayFileName.d.ts.map +1 -0
  435. package/lib/typescript/helpers/getServerReadTimestamp.d.ts +108 -0
  436. package/lib/typescript/helpers/getServerReadTimestamp.d.ts.map +1 -0
  437. package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
  438. package/lib/typescript/helpers/initXmppRooms.d.ts.map +1 -1
  439. package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts +1 -1
  440. package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
  441. package/lib/typescript/helpers/isOwnMessage.d.ts +36 -0
  442. package/lib/typescript/helpers/isOwnMessage.d.ts.map +1 -0
  443. package/lib/typescript/helpers/keyboardLayout.d.ts +5 -1
  444. package/lib/typescript/helpers/keyboardLayout.d.ts.map +1 -1
  445. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +3 -0
  446. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +1 -0
  447. package/lib/typescript/helpers/mimeToExtension.d.ts +0 -15
  448. package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -1
  449. package/lib/typescript/helpers/msgSortableMs.d.ts +2 -0
  450. package/lib/typescript/helpers/msgSortableMs.d.ts.map +1 -0
  451. package/lib/typescript/helpers/persistCrypto.d.ts +13 -0
  452. package/lib/typescript/helpers/persistCrypto.d.ts.map +1 -0
  453. package/lib/typescript/helpers/pickImageAsset.d.ts +27 -0
  454. package/lib/typescript/helpers/pickImageAsset.d.ts.map +1 -0
  455. package/lib/typescript/helpers/pushPayload.d.ts +7 -0
  456. package/lib/typescript/helpers/pushPayload.d.ts.map +1 -0
  457. package/lib/typescript/helpers/resolveInitBeforeLoadUser.d.ts.map +1 -1
  458. package/lib/typescript/helpers/secureFileUrl.d.ts +7 -0
  459. package/lib/typescript/helpers/secureFileUrl.d.ts.map +1 -0
  460. package/lib/typescript/helpers/secureKeyValue.d.ts +13 -0
  461. package/lib/typescript/helpers/secureKeyValue.d.ts.map +1 -0
  462. package/lib/typescript/helpers/secureStoreRuntime.d.ts +29 -0
  463. package/lib/typescript/helpers/secureStoreRuntime.d.ts.map +1 -0
  464. package/lib/typescript/helpers/secureUserStorage.d.ts +23 -0
  465. package/lib/typescript/helpers/secureUserStorage.d.ts.map +1 -0
  466. package/lib/typescript/helpers/shallowEqual.d.ts +11 -0
  467. package/lib/typescript/helpers/shallowEqual.d.ts.map +1 -0
  468. package/lib/typescript/helpers/sheetGestures.d.ts +20 -0
  469. package/lib/typescript/helpers/sheetGestures.d.ts.map +1 -0
  470. package/lib/typescript/hooks/useChatRoomFocus.d.ts +4 -1
  471. package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
  472. package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
  473. package/lib/typescript/hooks/useComposing.d.ts.map +1 -1
  474. package/lib/typescript/hooks/useFileToken.d.ts +2 -0
  475. package/lib/typescript/hooks/useFileToken.d.ts.map +1 -0
  476. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  477. package/lib/typescript/hooks/usePendingNotification.d.ts.map +1 -1
  478. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  479. package/lib/typescript/hooks/useUnreadMessagesCounter.d.ts +1 -0
  480. package/lib/typescript/hooks/useUnreadMessagesCounter.d.ts.map +1 -1
  481. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  482. package/lib/typescript/main.d.ts +9 -2
  483. package/lib/typescript/main.d.ts.map +1 -1
  484. package/lib/typescript/networking/api-requests/auth.api.d.ts +3 -1
  485. package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
  486. package/lib/typescript/networking/api-requests/user.api.d.ts +27 -0
  487. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  488. package/lib/typescript/networking/apiClient.d.ts +12 -6
  489. package/lib/typescript/networking/apiClient.d.ts.map +1 -1
  490. package/lib/typescript/networking/authRefresh.d.ts +95 -0
  491. package/lib/typescript/networking/authRefresh.d.ts.map +1 -0
  492. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  493. package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts +10 -2
  494. package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts.map +1 -1
  495. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
  496. package/lib/typescript/networking/xmpp/subscribeToRoomMessages.xmpp.d.ts.map +1 -1
  497. package/lib/typescript/networking/xmppClient.d.ts +14 -0
  498. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  499. package/lib/typescript/roomStore/chatSettingsSlice.d.ts +16 -0
  500. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  501. package/lib/typescript/roomStore/index.d.ts.map +1 -1
  502. package/lib/typescript/roomStore/persistence.d.ts +18 -1
  503. package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
  504. package/lib/typescript/roomStore/roomsSlice.d.ts +43 -3
  505. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  506. package/lib/typescript/services/pushSubscriptionService.d.ts +1 -1
  507. package/lib/typescript/services/pushSubscriptionService.d.ts.map +1 -1
  508. package/lib/typescript/types/types.d.ts +50 -5
  509. package/lib/typescript/types/types.d.ts.map +1 -1
  510. package/lib/typescript/version.d.ts +1 -1
  511. package/package.json +41 -28
  512. package/src/assets/icons.tsx +48 -9
  513. package/src/components/AuthForms/Login.tsx +3 -3
  514. package/src/components/Header/HeaderRoomList.tsx +29 -7
  515. package/src/components/MainComponents/ChatHeader.tsx +9 -3
  516. package/src/components/MainComponents/ChatRoom.tsx +161 -15
  517. package/src/components/MainComponents/ChatWrapper.tsx +36 -20
  518. package/src/components/MainComponents/LoginWrapper.tsx +1 -0
  519. package/src/components/MainComponents/MediaMessage.tsx +26 -8
  520. package/src/components/MainComponents/MessageContainer.tsx +5 -1
  521. package/src/components/MainComponents/MessageList.tsx +23 -4
  522. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +21 -14
  523. package/src/components/MainComponents/RoomList.tsx +236 -39
  524. package/src/components/Menu/HeaderRoomListMenu.tsx +328 -75
  525. package/src/components/Modals/AttachSheet/AttachSheet.tsx +333 -97
  526. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +600 -282
  527. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +244 -0
  528. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +79 -38
  529. package/src/components/Modals/FilePreviewModal/PdfView.tsx +2 -1
  530. package/src/components/Modals/Modal/Modal.tsx +7 -0
  531. package/src/components/Modals/NewChatModal/ModalContent.tsx +6 -3
  532. package/src/components/Modals/NewChatModal/NewChatModal.tsx +219 -119
  533. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +12 -1
  534. package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +624 -0
  535. package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +217 -0
  536. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +14 -4
  537. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +9 -25
  538. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +617 -307
  539. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +75 -58
  540. package/src/components/Modals/styledModalComponents.tsx +9 -2
  541. package/src/components/RoomComponents/ChatRoomItem.tsx +18 -3
  542. package/src/components/RoomComponents/styled/LastMessageFile.tsx +28 -4
  543. package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +18 -3
  544. package/src/components/RoomComponents/styled/LastMessageVideo.tsx +18 -3
  545. package/src/components/VideoCalls/VideoCallSession.tsx +8 -3
  546. package/src/components/styled/AudioMessage.tsx +2 -1
  547. package/src/components/styled/MessageImage.tsx +53 -7
  548. package/src/components/styled/SendInput.tsx +83 -12
  549. package/src/components/styled/StyledComponents.ts +9 -3
  550. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +11 -4
  551. package/src/components/styled/UnsupportedType.tsx +14 -4
  552. package/src/components/styled/VideoMessage.tsx +131 -54
  553. package/src/context/xmppProvider.tsx +216 -57
  554. package/src/helpers/createMessageFromXml.ts +20 -1
  555. package/src/helpers/ensureScopedChatCache.ts +2 -2
  556. package/src/helpers/getChatBackground.ts +18 -0
  557. package/src/helpers/getDisplayFileName.ts +87 -0
  558. package/src/helpers/getServerReadTimestamp.ts +197 -0
  559. package/src/helpers/historyPreloadScheduler.ts +80 -3
  560. package/src/helpers/initXmppRooms.tsx +14 -10
  561. package/src/helpers/insertMessageWithDelimiter.ts +55 -19
  562. package/src/helpers/isOwnMessage.ts +90 -0
  563. package/src/helpers/keyboardLayout.ts +23 -2
  564. package/src/helpers/mediaLibraryRuntime.ts +25 -0
  565. package/src/helpers/mimeToExtension.ts +6 -22
  566. package/src/helpers/msgSortableMs.ts +25 -0
  567. package/src/helpers/persistCrypto.ts +127 -0
  568. package/src/helpers/pickImageAsset.ts +68 -0
  569. package/src/helpers/pushPayload.ts +62 -0
  570. package/src/helpers/resolveInitBeforeLoadUser.ts +125 -18
  571. package/src/helpers/secureFileUrl.ts +103 -0
  572. package/src/helpers/secureKeyValue.ts +80 -0
  573. package/src/helpers/secureStoreRuntime.ts +62 -0
  574. package/src/helpers/secureUserStorage.ts +80 -0
  575. package/src/helpers/shallowEqual.ts +33 -0
  576. package/src/helpers/sheetGestures.ts +25 -0
  577. package/src/hooks/useChatRoomFocus.ts +49 -9
  578. package/src/hooks/useChatWrapperInit.ts +30 -10
  579. package/src/hooks/useComposing.tsx +37 -1
  580. package/src/hooks/useFileToken.ts +7 -0
  581. package/src/hooks/useLogout.tsx +29 -9
  582. package/src/hooks/usePendingNotification.ts +5 -11
  583. package/src/hooks/useSendMessage.tsx +60 -15
  584. package/src/hooks/useUnreadMessagesCounter.ts +11 -0
  585. package/src/i18n/strings.ts +145 -37
  586. package/src/main.ts +26 -2
  587. package/src/networking/api-requests/auth.api.ts +156 -48
  588. package/src/networking/api-requests/roomMembers.api.ts +1 -1
  589. package/src/networking/api-requests/rooms.api.ts +9 -9
  590. package/src/networking/api-requests/user.api.ts +79 -7
  591. package/src/networking/apiClient.ts +68 -123
  592. package/src/networking/authRefresh.ts +451 -0
  593. package/src/networking/stanzaHandlers.ts +44 -28
  594. package/src/networking/xmpp/flushLastViewedToPrivateStore.ts +71 -10
  595. package/src/networking/xmpp/presenceInRoom.xmpp.ts +6 -1
  596. package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +12 -1
  597. package/src/networking/xmppClient.ts +141 -9
  598. package/src/roomStore/chatSettingsSlice.ts +34 -10
  599. package/src/roomStore/index.ts +40 -4
  600. package/src/roomStore/persistence.ts +234 -24
  601. package/src/roomStore/roomsSlice.ts +161 -29
  602. package/src/services/pushSubscriptionService.ts +18 -13
  603. package/src/types/types.ts +72 -5
  604. package/src/version.ts +1 -1
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.resolveInitBeforeLoadUser = exports.refreshUserCredentialsForXmpp = exports.default = exports.applyResolvedUserToStore = void 0;
7
- var _apiClient = _interopRequireWildcard(require("../networking/apiClient"));
7
+ var _apiClient = require("../networking/apiClient");
8
+ var _authRefresh = require("../networking/authRefresh");
8
9
  var _auth = require("../networking/api-requests/auth.api");
9
10
  var _user = require("../networking/api-requests/user.api");
10
11
  var _roomStore = require("../roomStore");
11
12
  var _chatSettingsSlice = require("../roomStore/chatSettingsSlice");
12
13
  var _walletUsername = require("./walletUsername");
13
- var _useLocalStorage = require("../hooks/useLocalStorage");
14
- var _LOCAL_STORAGE = require("./constants/LOCAL_STORAGE");
15
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
+ var _secureUserStorage = require("./secureUserStorage");
16
15
  const getStatusCode = error => {
17
16
  const status = error?.response?.status;
18
17
  return typeof status === 'number' ? status : null;
@@ -36,15 +35,112 @@ const normalizeUserForXmpp = user => {
36
35
  xmppUsername: normalizedXmppUsername
37
36
  };
38
37
  };
39
- const refreshWithToken = async refreshToken => {
40
- const response = await _apiClient.default.post('/users/login/refresh', {}, {
41
- headers: {
42
- Authorization: refreshToken
38
+
39
+ // Hermes has no atob/Buffer; hand-decode just enough base64url to read a
40
+ // JWT's `iat`. Claims are ASCII so the byte-per-char string is fine.
41
+ const B64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
42
+ const readJwtIat = token => {
43
+ if (!token || typeof token !== 'string') {
44
+ return 0;
45
+ }
46
+ const part = token.split('.')[1];
47
+ if (!part) {
48
+ return 0;
49
+ }
50
+ try {
51
+ const clean = part.replace(/-/g, '+').replace(/_/g, '/');
52
+ let out = '';
53
+ let buffer = 0;
54
+ let bits = 0;
55
+ for (let i = 0; i < clean.length; i++) {
56
+ const idx = B64_ALPHABET.indexOf(clean[i]);
57
+ if (idx === -1) {
58
+ continue;
59
+ }
60
+ buffer = buffer << 6 | idx;
61
+ bits += 6;
62
+ if (bits >= 8) {
63
+ bits -= 8;
64
+ out += String.fromCharCode(buffer >> bits & 0xff);
65
+ }
66
+ }
67
+ const iat = JSON.parse(out)?.iat;
68
+ return typeof iat === 'number' ? iat : 0;
69
+ } catch {
70
+ return 0;
71
+ }
72
+ };
73
+
74
+ /**
75
+ * A `userLogin.user` is typically a snapshot the host captured at ITS
76
+ * login time and re-presents verbatim on every mount, while this SDK
77
+ * keeps rotating the session and persisting the newest pair to
78
+ * `ETHORA_USER`. Taking the snapshot as-is therefore discards the live
79
+ * session in favour of an ever-aging copy: media goes blank the moment
80
+ * the snapshot has no `fileToken` (secure-files URLs 401 without it),
81
+ * and once the snapshot's refresh token ages out entirely the account
82
+ * looks dead even though the SDK held a working session all along.
83
+ *
84
+ * So, for the SAME account only, prefer whichever refresh pair was
85
+ * minted later (JWT `iat` decides — a host that genuinely re-logged-in
86
+ * hands us newer tokens and wins), and fill in a missing `fileToken`
87
+ * from the persisted copy either way.
88
+ */
89
+ const adoptFresherPersistedSession = async candidate => {
90
+ try {
91
+ const stored = await (0, _secureUserStorage.secureUserStorage)().get();
92
+ if (!stored) {
93
+ return candidate;
43
94
  }
95
+ const sameUser = candidate._id && stored._id && candidate._id === stored._id || candidate.xmppUsername && stored.xmppUsername && candidate.xmppUsername === stored.xmppUsername;
96
+ if (!sameUser) {
97
+ return candidate;
98
+ }
99
+ const merged = {
100
+ ...candidate
101
+ };
102
+ if (stored.refreshToken && readJwtIat(stored.refreshToken) > readJwtIat(candidate.refreshToken)) {
103
+ merged.refreshToken = stored.refreshToken;
104
+ if (stored.token) {
105
+ merged.token = stored.token;
106
+ }
107
+ if (stored.fileToken) {
108
+ merged.fileToken = stored.fileToken;
109
+ }
110
+ }
111
+ if (!merged.fileToken && stored.fileToken) {
112
+ merged.fileToken = stored.fileToken;
113
+ }
114
+ return merged;
115
+ } catch {
116
+ return candidate;
117
+ }
118
+ };
119
+
120
+ /**
121
+ * Bootstrap rotation.
122
+ *
123
+ * Was a second, independent `/users/login/refresh` caller that bypassed
124
+ * every lock in the SDK — and, worse, only wrote the rotated token to
125
+ * the store on the happy path, so several of the early-return branches
126
+ * below used to drop it. Under the backend's reuse detection a dropped
127
+ * rotation means the next launch presents a burned token and the
128
+ * session is killed.
129
+ *
130
+ * `refreshAuthTokens` persists the new pair before it resolves, so by
131
+ * the time this returns the rotation is safe no matter which branch the
132
+ * caller takes afterwards. The explicit token is required here: during
133
+ * bootstrap the candidate session isn't in the store yet.
134
+ */
135
+ const refreshWithToken = async refreshToken => {
136
+ const result = await (0, _authRefresh.refreshAuthTokens)({
137
+ refreshToken
44
138
  });
45
139
  return {
46
- token: response?.data?.token || '',
47
- refreshToken: response?.data?.refreshToken || refreshToken
140
+ token: result.token,
141
+ refreshToken: result.refreshToken || refreshToken,
142
+ xmppPassword: result.xmppPassword || '',
143
+ fileToken: result.fileToken || ''
48
144
  };
49
145
  };
50
146
  const mergeUsers = (base, patch) => {
@@ -69,10 +165,14 @@ const tryHydrateViaMy = async (candidate, myEndpoint, signal) => {
69
165
  }
70
166
  let workingToken = candidate?.token || '';
71
167
  let workingRefresh = candidate?.refreshToken || '';
168
+ let rotatedXmppPassword = '';
169
+ let workingFileToken = candidate?.fileToken || '';
72
170
  const candidateWithCurrentTokens = () => ({
73
171
  ...candidate,
74
172
  token: workingToken || candidate.token,
75
- refreshToken: workingRefresh || candidate.refreshToken
173
+ refreshToken: workingRefresh || candidate.refreshToken,
174
+ xmppPassword: rotatedXmppPassword || candidate.xmppPassword,
175
+ fileToken: workingFileToken || candidate.fileToken
76
176
  });
77
177
  const fallbackWithCreds = () => {
78
178
  const normalized = normalizeUserForXmpp(candidateWithCurrentTokens());
@@ -91,6 +191,8 @@ const tryHydrateViaMy = async (candidate, myEndpoint, signal) => {
91
191
  if (merged) {
92
192
  merged.token = workingToken || merged.token;
93
193
  merged.refreshToken = workingRefresh || merged.refreshToken;
194
+ merged.xmppPassword = rotatedXmppPassword || merged.xmppPassword;
195
+ merged.fileToken = workingFileToken || merged.fileToken;
94
196
  }
95
197
  return merged;
96
198
  } catch (error) {
@@ -115,6 +217,8 @@ const tryHydrateViaMy = async (candidate, myEndpoint, signal) => {
115
217
  const refreshed = await refreshWithToken(workingRefresh);
116
218
  workingToken = refreshed.token;
117
219
  workingRefresh = refreshed.refreshToken;
220
+ rotatedXmppPassword = refreshed.xmppPassword || rotatedXmppPassword;
221
+ workingFileToken = refreshed.fileToken || workingFileToken;
118
222
  try {
119
223
  const myUser = await (0, _user.getMyUser)({
120
224
  token: workingToken,
@@ -124,6 +228,8 @@ const tryHydrateViaMy = async (candidate, myEndpoint, signal) => {
124
228
  if (merged) {
125
229
  merged.token = workingToken || merged.token;
126
230
  merged.refreshToken = workingRefresh || merged.refreshToken;
231
+ merged.xmppPassword = rotatedXmppPassword || merged.xmppPassword;
232
+ merged.fileToken = workingFileToken || merged.fileToken;
127
233
  }
128
234
  return merged;
129
235
  } catch (myError) {
@@ -143,6 +249,13 @@ const tryHydrateViaMy = async (candidate, myEndpoint, signal) => {
143
249
  if (signal?.aborted || isAbortError(error)) {
144
250
  return null;
145
251
  }
252
+ // A fatal refresh verdict (reuse detected / token not found / stale
253
+ // with nothing newer around) carries no HTTP response, so it would
254
+ // otherwise fall through to `throw` — the session is simply dead,
255
+ // which for bootstrap means "nothing to restore".
256
+ if ((0, _authRefresh.isRefreshFatalError)(error)) {
257
+ return null;
258
+ }
146
259
  if (isAuthError(error)) {
147
260
  return null;
148
261
  }
@@ -160,14 +273,14 @@ const resolveInitBeforeLoadUser = async options => {
160
273
  if (config?.baseUrl) {
161
274
  (0, _apiClient.setBaseURL)(config.baseUrl, config.customAppToken);
162
275
  }
163
- const myEndpoint = config?.initBeforeLoadAuth?.myEndpoint || '/users/my';
276
+ const myEndpoint = config?.initBeforeLoadAuth?.myEndpoint || '/v1/users/my';
164
277
 
165
278
  // Priority 1: explicit userLogin
166
279
  const explicitUser = config?.userLogin?.enabled ? config?.userLogin?.user : null;
167
280
  if (explicitUser) {
168
281
  const candidate = normalizeUserForXmpp(explicitUser);
169
282
  if (candidate && hasXmppCredentials(candidate)) {
170
- return candidate;
283
+ return await adoptFresherPersistedSession(candidate);
171
284
  }
172
285
  const hydrated = await tryHydrateViaMy(explicitUser, myEndpoint, signal).catch(() => null);
173
286
  if (hydrated && hasXmppCredentials(hydrated)) {
@@ -224,13 +337,13 @@ const resolveInitBeforeLoadUser = async options => {
224
337
 
225
338
  // Priority 5: persisted user in AsyncStorage
226
339
  try {
227
- const storedUser = await (0, _useLocalStorage.asyncLocalStorage)(_LOCAL_STORAGE.localStorageConstants.ETHORA_USER).get();
340
+ const storedUser = await (0, _secureUserStorage.secureUserStorage)().get();
228
341
  if (storedUser && (storedUser.token || storedUser.refreshToken || storedUser.xmppPassword)) {
229
342
  const hydrated = await tryHydrateViaMy(storedUser, myEndpoint, signal).catch(() => null);
230
343
  if (hydrated && hasXmppCredentials(hydrated)) {
231
344
  return hydrated;
232
345
  }
233
- await (0, _useLocalStorage.asyncLocalStorage)(_LOCAL_STORAGE.localStorageConstants.ETHORA_USER).remove();
346
+ await (0, _secureUserStorage.secureUserStorage)().remove();
234
347
  }
235
348
  } catch {
236
349
  // ignore storage errors
@@ -286,7 +399,7 @@ const refreshUserCredentialsForXmpp = async (config, signal) => {
286
399
  // fall through to /users/my path
287
400
  }
288
401
  }
289
- const myEndpoint = config?.initBeforeLoadAuth?.myEndpoint || '/users/my';
402
+ const myEndpoint = config?.initBeforeLoadAuth?.myEndpoint || '/v1/users/my';
290
403
 
291
404
  // Priority 2: redux store user (covers userLogin + customLogin +
292
405
  // anything previously persisted into chatSettingStore.user). The
@@ -304,7 +417,7 @@ const refreshUserCredentialsForXmpp = async (config, signal) => {
304
417
  // should already mirror this, but if the redux state got cleared
305
418
  // mid-session (logout race) this gives us one last shot.
306
419
  try {
307
- const storedUser = await (0, _useLocalStorage.asyncLocalStorage)(_LOCAL_STORAGE.localStorageConstants.ETHORA_USER).get();
420
+ const storedUser = await (0, _secureUserStorage.secureUserStorage)().get();
308
421
  if (storedUser && (storedUser.token || storedUser.refreshToken || storedUser.xmppPassword)) {
309
422
  const hydrated = await tryHydrateViaMy(storedUser, myEndpoint, signal).catch(() => null);
310
423
  if (hydrated && hasXmppCredentials(hydrated)) {
@@ -1 +1 @@
1
- {"version":3,"names":["_apiClient","_interopRequireWildcard","require","_auth","_user","_roomStore","_chatSettingsSlice","_walletUsername","_useLocalStorage","_LOCAL_STORAGE","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getStatusCode","error","status","response","isAuthError","code","isAbortError","message","toLowerCase","includes","hasXmppCredentials","user","Boolean","xmppPassword","xmppUsername","defaultWallet","walletAddress","normalizeUserForXmpp","normalizedXmppUsername","walletToUsername","refreshWithToken","refreshToken","http","post","headers","Authorization","token","data","mergeUsers","base","patch","tryHydrateViaMy","candidate","myEndpoint","signal","aborted","mergedCandidate","workingToken","workingRefresh","candidateWithCurrentTokens","fallbackWithCreds","normalized","myUser","getMyUser","endpoint","merged","fallback","refreshed","myError","resolveInitBeforeLoadUser","options","config","baseUrl","setBaseURL","customAppToken","initBeforeLoadAuth","explicitUser","userLogin","enabled","hydrated","catch","customLogin","loginFunction","customUser","jwtLogin","jwtUser","loginViaJwt","currentUser","store","getState","chatSettingStore","storedUser","asyncLocalStorage","localStorageConstants","ETHORA_USER","remove","exports","applyResolvedUserToStore","dispatch","setUser","refreshUserCredentialsForXmpp","fresh","_default"],"sourceRoot":"../../../src","sources":["helpers/resolveInitBeforeLoadUser.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AAAkE,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CA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M,IAAAC,kCAAiB,EACxCC,oCAAqB,CAACC,WACxB,CAAC,CAACjF,GAAG,CAAC,CAAC;IACP,IACE8E,UAAU,KACTA,UAAU,CAAC7C,KAAK,IAAI6C,UAAU,CAAClD,YAAY,IAAIkD,UAAU,CAAC1D,YAAY,CAAC,EACxE;MACA,MAAM8C,QAAQ,GAAG,MAAM5B,eAAe,CACpCwC,UAAU,EACVtC,UAAU,EACVC,MACF,CAAC,CAAC0B,KAAK,CAAC,MAAM,IAAI,CAAC;MACnB,IAAID,QAAQ,IAAIjD,kBAAkB,CAACiD,QAAQ,CAAC,EAAE;QAAC,OAAOA,QAAQ;MAAC;IACjE;EACF,CAAC,CAAC,MAAM;IACN;EAAA;EAGF,OAAO,IAAI;AACb,CAAC;AAACiB,OAAA,CAAAI,6BAAA,GAAAA,6BAAA;AAAA,IAAAE,QAAA,GAAAN,OAAA,CAAArF,OAAA,GAEa0D,yBAAyB","ignoreList":[]}
1
+ {"version":3,"names":["_apiClient","require","_authRefresh","_auth","_user","_roomStore","_chatSettingsSlice","_walletUsername","_secureUserStorage","getStatusCode","error","status","response","isAuthError","code","isAbortError","message","toLowerCase","includes","hasXmppCredentials","user","Boolean","xmppPassword","xmppUsername","defaultWallet","walletAddress","normalizeUserForXmpp","normalizedXmppUsername","walletToUsername","B64_ALPHABET","readJwtIat","token","part","split","clean","replace","out","buffer","bits","i","length","idx","indexOf","String","fromCharCode","iat","JSON","parse","adoptFresherPersistedSession","candidate","stored","secureUserStorage","get","sameUser","_id","merged","refreshToken","fileToken","refreshWithToken","result","refreshAuthTokens","mergeUsers","base","patch","tryHydrateViaMy","myEndpoint","signal","aborted","mergedCandidate","workingToken","workingRefresh","rotatedXmppPassword","workingFileToken","candidateWithCurrentTokens","fallbackWithCreds","normalized","myUser","getMyUser","endpoint","fallback","refreshed","myError","isRefreshFatalError","resolveInitBeforeLoadUser","options","config","baseUrl","setBaseURL","customAppToken","initBeforeLoadAuth","explicitUser","userLogin","enabled","hydrated","catch","customLogin","loginFunction","customUser","jwtLogin","jwtUser","loginViaJwt","currentUser","store","getState","chatSettingStore","storedUser","remove","exports","applyResolvedUserToStore","dispatch","setUser","refreshUserCredentialsForXmpp","fresh","_default","default"],"sourceRoot":"../../../src","sources":["helpers/resolveInitBeforeLoadUser.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AAYA,MAAMQ,aAAa,GAAIC,KAAc,IAAoB;EACvD,MAAMC,MAAM,GAAID,KAAK,EAAoBE,QAAQ,EAAED,MAAM;EACzD,OAAO,OAAOA,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAG,IAAI;AACnD,CAAC;AAED,MAAME,WAAW,GAAIH,KAAc,IAAc;EAC/C,MAAMI,IAAI,GAAGL,aAAa,CAACC,KAAK,CAAC;EACjC,OAAOI,IAAI,KAAK,GAAG,IAAIA,IAAI,KAAK,GAAG;AACrC,CAAC;AAED,MAAMC,YAAY,GAAIL,KAAc,IAAc;EAChD,MAAMM,OAAO,GAAIN,KAAK,EAAoBM,OAAO,IAAI,EAAE;EACvD,OAAO,OAAOA,OAAO,KAAK,QAAQ,IAAIA,OAAO,CAACC,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,OAAO,CAAC;AAC/E,CAAC;AAED,MAAMC,kBAAkB,GAAIC,IAA2B,IACrDC,OAAO,CACLD,IAAI,EAAEE,YAAY,KACfF,IAAI,EAAEG,YAAY,IAAIH,IAAI,EAAEI,aAAa,EAAEC,aAAa,CAC7D,CAAC;AAEH,MAAMC,oBAAoB,GAAIN,IAAkB,IAAkB;EAChE,IAAI,CAACA,IAAI,EAAE;IAAC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Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withFileToken = exports.resolveFileUrl = exports.requestFileTokenRecovery = exports.isSecureFileUrl = exports.appendFileToken = exports.__resetFileTokenRecoveryForTests = void 0;
7
+ var _roomStore = require("../roomStore");
8
+ var _apiClient = require("../networking/apiClient");
9
+ var _authRefresh = require("../networking/authRefresh");
10
+ const SECURE_FILES_HOST_PREFIX = 'secure-files.';
11
+ const SECURE_MEDIA_PATH_PREFIX = '/secure-media/';
12
+ const FILE_TOKEN_PARAM = 'ft';
13
+ const resolveFileUrl = url => {
14
+ if (!url) {
15
+ return '';
16
+ }
17
+ // Any scheme at all — http(s), data, file, content, blob.
18
+ if (/^[a-z][a-z0-9+.-]*:/i.test(url)) {
19
+ return url;
20
+ }
21
+ if (!url.startsWith('/')) {
22
+ return url;
23
+ }
24
+ const base = (0, _apiClient.getCurrentBaseURL)().replace(/\/+$/, '');
25
+ return base ? `${base}${url}` : url;
26
+ };
27
+ exports.resolveFileUrl = resolveFileUrl;
28
+ const isSecureFileUrl = url => {
29
+ if (!url) {
30
+ return false;
31
+ }
32
+ const path = url.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i, '');
33
+ if (path.startsWith(SECURE_MEDIA_PATH_PREFIX)) {
34
+ return true;
35
+ }
36
+ const match = /^https?:\/\/(?:[^@/]+@)?([^:/?#]+)/i.exec(url);
37
+ if (!match) {
38
+ return false;
39
+ }
40
+ return match[1].toLowerCase().startsWith(SECURE_FILES_HOST_PREFIX);
41
+ };
42
+ exports.isSecureFileUrl = isSecureFileUrl;
43
+ const appendFileToken = (url, fileToken) => {
44
+ if (!url) {
45
+ return '';
46
+ }
47
+ const resolved = resolveFileUrl(url);
48
+ if (!fileToken || !isSecureFileUrl(resolved)) {
49
+ return resolved;
50
+ }
51
+ url = resolved;
52
+ const hashIndex = url.indexOf('#');
53
+ const hash = hashIndex === -1 ? '' : url.slice(hashIndex);
54
+ const withoutHash = hashIndex === -1 ? url : url.slice(0, hashIndex);
55
+ const queryIndex = withoutHash.indexOf('?');
56
+ const base = queryIndex === -1 ? withoutHash : withoutHash.slice(0, queryIndex);
57
+ const query = queryIndex === -1 ? '' : withoutHash.slice(queryIndex + 1);
58
+ const params = query.split('&').filter(Boolean).filter(pair => pair.split('=')[0] !== FILE_TOKEN_PARAM);
59
+ params.push(`${FILE_TOKEN_PARAM}=${encodeURIComponent(fileToken)}`);
60
+ return `${base}?${params.join('&')}${hash}`;
61
+ };
62
+ exports.appendFileToken = appendFileToken;
63
+ const withFileToken = url => appendFileToken(url, _roomStore.store.getState().chatSettingStore?.user?.fileToken || '');
64
+ exports.withFileToken = withFileToken;
65
+ const RECOVERY_COOLDOWN_MS = 30_000;
66
+ let recoveryInFlight = null;
67
+ let lastRecoveryAt = 0;
68
+ const requestFileTokenRecovery = () => {
69
+ if (recoveryInFlight) {
70
+ return recoveryInFlight;
71
+ }
72
+ const now = Date.now();
73
+ if (now - lastRecoveryAt < RECOVERY_COOLDOWN_MS) {
74
+ return Promise.resolve(false);
75
+ }
76
+ lastRecoveryAt = now;
77
+ const state = _roomStore.store.getState();
78
+ const refreshConfig = state.chatSettingStore?.config?.refreshTokens;
79
+ const user = state.chatSettingStore?.user;
80
+ if (!refreshConfig?.enabled) {
81
+ return Promise.resolve(false);
82
+ }
83
+ const run = async () => {
84
+ if (!refreshConfig.refreshFunction && !user?.refreshToken) {
85
+ return false;
86
+ }
87
+ const tokens = await (0, _authRefresh.refreshAuthTokens)();
88
+ return Boolean(tokens.fileToken);
89
+ };
90
+ recoveryInFlight = run().catch(() => false).finally(() => {
91
+ recoveryInFlight = null;
92
+ });
93
+ return recoveryInFlight;
94
+ };
95
+ exports.requestFileTokenRecovery = requestFileTokenRecovery;
96
+ const __resetFileTokenRecoveryForTests = () => {
97
+ recoveryInFlight = null;
98
+ lastRecoveryAt = 0;
99
+ };
100
+ exports.__resetFileTokenRecoveryForTests = __resetFileTokenRecoveryForTests;
101
+ //# sourceMappingURL=secureFileUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_roomStore","require","_apiClient","_authRefresh","SECURE_FILES_HOST_PREFIX","SECURE_MEDIA_PATH_PREFIX","FILE_TOKEN_PARAM","resolveFileUrl","url","test","startsWith","base","getCurrentBaseURL","replace","exports","isSecureFileUrl","path","match","exec","toLowerCase","appendFileToken","fileToken","resolved","hashIndex","indexOf","hash","slice","withoutHash","queryIndex","query","params","split","filter","Boolean","pair","push","encodeURIComponent","join","withFileToken","store","getState","chatSettingStore","user","RECOVERY_COOLDOWN_MS","recoveryInFlight","lastRecoveryAt","requestFileTokenRecovery","now","Date","Promise","resolve","state","refreshConfig","config","refreshTokens","enabled","run","refreshFunction","refreshToken","tokens","refreshAuthTokens","catch","finally","__resetFileTokenRecoveryForTests"],"sourceRoot":"../../../src","sources":["helpers/secureFileUrl.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,MAAMG,wBAAwB,GAAG,eAAe;AAChD,MAAMC,wBAAwB,GAAG,gBAAgB;AAEjD,MAAMC,gBAAgB,GAAG,IAAI;AAEtB,MAAMC,cAAc,GAAIC,GAAmB,IAAa;EAC7D,IAAI,CAACA,GAAG,EAAE;IAAC,OAAO,EAAE;EAAC;EACrB;EACA,IAAI,sBAAsB,CAACC,IAAI,CAACD,GAAG,CAAC,EAAE;IAAC,OAAOA,GAAG;EAAC;EAClD,IAAI,CAACA,GAAG,CAACE,UAAU,CAAC,GAAG,CAAC,EAAE;IAAC,OAAOF,GAAG;EAAC;EAEtC,MAAMG,IAAI,GAAG,IAAAC,4BAAiB,EAAC,CAAC,CAACC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;EACpD,OAAOF,IAAI,GAAG,GAAGA,IAAI,GAAGH,GAAG,EAAE,GAAGA,GAAG;AACrC,CAAC;AAACM,OAAA,CAAAP,cAAA,GAAAA,cAAA;AAEK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KAAK,GAAGZ,gBAAK,CAACC,QAAQ,CAAC,CAAC;EAC9B,MAAMY,aAAa,GAAGD,KAAK,CAACV,gBAAgB,EAAEY,MAAM,EAAEC,aAAa;EACnE,MAAMZ,IAAI,GAAGS,KAAK,CAACV,gBAAgB,EAAEC,IAAI;EAEzC,IAAI,CAACU,aAAa,EAAEG,OAAO,EAAE;IAAC,OAAON,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC;EAAC;EAE5D,MAAMM,GAAG,GAAG,MAAAA,CAAA,KAA8B;IACxC,IAAI,CAACJ,aAAa,CAACK,eAAe,IAAI,CAACf,IAAI,EAAEgB,YAAY,EAAE;MAAC,OAAO,KAAK;IAAC;IAEzE,MAAMC,MAAM,GAAG,MAAM,IAAAC,8BAAiB,EAAC,CAAC;IACxC,OAAO3B,OAAO,CAAC0B,MAAM,CAACtC,SAAS,CAAC;EAClC,CAAC;EAEDuB,gBAAgB,GAAGY,GAAG,CAAC,CAAC,CACrBK,KAAK,CAAC,MAAM,KAAK,CAAC,CAClBC,OAAO,CAAC,MAAM;IACblB,gBAAgB,GAAG,IAAI;EACzB,CAAC,CAAC;EAEJ,OAAOA,gBAAgB;AACzB,CAAC;AAAC9B,OAAA,CAAAgC,wBAAA,GAAAA,wBAAA;AAEK,MAAMiB,gCAAgC,GAAGA,CAAA,KAAY;EAC1DnB,gBAAgB,GAAG,IAAI;EACvBC,cAAc,GAAG,CAAC;AACpB,CAAC;AAAC/B,OAAA,CAAAiD,gCAAA,GAAAA,gCAAA","ignoreList":[]}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.__resetSecureKeyValueWarningForTests = void 0;
7
+ exports.secureGet = secureGet;
8
+ exports.secureRemove = secureRemove;
9
+ exports.secureSet = secureSet;
10
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
11
+ var _secureStoreRuntime = require("./secureStoreRuntime");
12
+ var _devLogger = require("../utils/devLogger");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ // Fallback keys are prefixed and namespaced away from every other
15
+ // AsyncStorage key this SDK writes, so a host that never installs
16
+ // expo-secure-store can still be told apart from one that used to lack
17
+ // it and has since added it (see `secureSet`'s stale-fallback cleanup).
18
+ const FALLBACK_PREFIX = '@ethora/secure-fallback:';
19
+ let warnedFallback = false;
20
+ const warnFallbackOnce = () => {
21
+ if (warnedFallback) {
22
+ return;
23
+ }
24
+ warnedFallback = true;
25
+ (0, _devLogger.pushLog)('warn', 'expo-secure-store is not installed — auth tokens, the XMPP ' + 'password, and the message-history cipher key are falling back ' + 'to plain AsyncStorage instead of the platform Keychain/Keystore. ' + 'Add the optional peer dependency `expo-secure-store` to your app ' + 'to store them securely.');
26
+ };
27
+
28
+ /**
29
+ * Small-value secure KV store: platform Keychain/Keystore via
30
+ * expo-secure-store when the host has it installed, plain (but still
31
+ * namespaced) AsyncStorage otherwise. NOT for bulk data — see
32
+ * `persistCrypto.ts`'s size note on why message history goes through
33
+ * AES instead of straight into this store.
34
+ */
35
+ async function secureGet(key) {
36
+ const store = (0, _secureStoreRuntime.loadSecureStore)();
37
+ if (store) {
38
+ try {
39
+ return await store.getItemAsync(key);
40
+ } catch (e) {
41
+ (0, _devLogger.pushLog)('warn', `secureStore: getItemAsync(${key}) failed`, e);
42
+ return null;
43
+ }
44
+ }
45
+ warnFallbackOnce();
46
+ return _asyncStorage.default.getItem(FALLBACK_PREFIX + key);
47
+ }
48
+ async function secureSet(key, value) {
49
+ const store = (0, _secureStoreRuntime.loadSecureStore)();
50
+ if (store) {
51
+ try {
52
+ await store.setItemAsync(key, value);
53
+ // Clean up a stale plaintext fallback copy from before this host
54
+ // added expo-secure-store — otherwise it sits on disk forever.
55
+ _asyncStorage.default.removeItem(FALLBACK_PREFIX + key).catch(() => undefined);
56
+ return;
57
+ } catch (e) {
58
+ (0, _devLogger.pushLog)('warn', `secureStore: setItemAsync(${key}) failed`, e);
59
+ return;
60
+ }
61
+ }
62
+ warnFallbackOnce();
63
+ await _asyncStorage.default.setItem(FALLBACK_PREFIX + key, value);
64
+ }
65
+ async function secureRemove(key) {
66
+ const store = (0, _secureStoreRuntime.loadSecureStore)();
67
+ if (store) {
68
+ try {
69
+ await store.deleteItemAsync(key);
70
+ } catch {
71
+ // Key may simply not exist — deleteItemAsync throwing here isn't
72
+ // actionable either way.
73
+ }
74
+ }
75
+ await _asyncStorage.default.removeItem(FALLBACK_PREFIX + key).catch(() => undefined);
76
+ }
77
+
78
+ /** Test seam only. */
79
+ const __resetSecureKeyValueWarningForTests = () => {
80
+ warnedFallback = false;
81
+ };
82
+ exports.__resetSecureKeyValueWarningForTests = __resetSecureKeyValueWarningForTests;
83
+ //# sourceMappingURL=secureKeyValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_asyncStorage","_interopRequireDefault","require","_secureStoreRuntime","_devLogger","e","__esModule","default","FALLBACK_PREFIX","warnedFallback","warnFallbackOnce","pushLog","secureGet","key","store","loadSecureStore","getItemAsync","AsyncStorage","getItem","secureSet","value","setItemAsync","removeItem","catch","undefined","setItem","secureRemove","deleteItemAsync","__resetSecureKeyValueWarningForTests","exports"],"sourceRoot":"../../../src","sources":["helpers/secureKeyValue.ts"],"mappings":";;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA6C,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE7C;AACA;AACA;AACA;AACA,MAAMG,eAAe,GAAG,0BAA0B;AAElD,IAAIC,cAAc,GAAG,KAAK;AAC1B,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EAC7B,IAAID,cAAc,EAAE;IAAC;EAAO;EAC5BA,cAAc,GAAG,IAAI;EACrB,IA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EAAE;IACT,IAAI;MACF,MAAMA,KAAK,CAACa,eAAe,CAACd,GAAG,CAAC;IAClC,CAAC,CAAC,MAAM;MACN;MACA;IAAA;EAEJ;EACA,MAAMI,qBAAY,CAACK,UAAU,CAACd,eAAe,GAAGK,GAAG,CAAC,CAACU,KAAK,CAAC,MAAMC,SAAS,CAAC;AAC7E;;AAEA;AACO,MAAMI,oCAAoC,GAAGA,CAAA,KAAY;EAC9DnB,cAAc,GAAG,KAAK;AACxB,CAAC;AAACoB,OAAA,CAAAD,oCAAA,GAAAA,oCAAA","ignoreList":[]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loadSecureStore = exports.isSecureStoreAvailable = exports.__resetSecureStoreRuntimeForTests = void 0;
7
+ /**
8
+ * Optional-dependency bridge for `expo-secure-store` — the Keychain
9
+ * (iOS) / Keystore-backed EncryptedSharedPreferences (Android) API.
10
+ *
11
+ * Mirrors `components/VideoCalls/livekitRuntime.ts`: a plain top-level
12
+ * `import ... from 'expo-secure-store'` is not allowed anywhere in the
13
+ * SDK, since Metro resolves imports at bundle time and a host that
14
+ * hasn't added this optional peer dependency would fail to build over
15
+ * a feature it never opted into. Everything goes through
16
+ * `loadSecureStore()`, which requires the module lazily and returns
17
+ * null when it isn't installed — callers fall back to plain
18
+ * AsyncStorage rather than crash (see `secureKeyValue.ts`).
19
+ */
20
+
21
+ let cached;
22
+
23
+ /**
24
+ * Resolve the SecureStore runtime, or null when the optional native
25
+ * package isn't installed in the host app. Result is memoised
26
+ * (including the failure) so a missing dependency doesn't re-throw on
27
+ * every read/write.
28
+ */
29
+ const loadSecureStore = () => {
30
+ if (cached !== undefined) {
31
+ return cached;
32
+ }
33
+ try {
34
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
35
+ const mod = require('expo-secure-store');
36
+ if (typeof mod?.getItemAsync !== 'function' || typeof mod?.setItemAsync !== 'function' || typeof mod?.deleteItemAsync !== 'function') {
37
+ cached = null;
38
+ } else {
39
+ cached = {
40
+ getItemAsync: mod.getItemAsync,
41
+ setItemAsync: mod.setItemAsync,
42
+ deleteItemAsync: mod.deleteItemAsync
43
+ };
44
+ }
45
+ } catch {
46
+ cached = null;
47
+ }
48
+ return cached;
49
+ };
50
+ exports.loadSecureStore = loadSecureStore;
51
+ const isSecureStoreAvailable = () => loadSecureStore() !== null;
52
+
53
+ /** Test seam only. */
54
+ exports.isSecureStoreAvailable = isSecureStoreAvailable;
55
+ const __resetSecureStoreRuntimeForTests = () => {
56
+ cached = undefined;
57
+ };
58
+ exports.__resetSecureStoreRuntimeForTests = __resetSecureStoreRuntimeForTests;
59
+ //# sourceMappingURL=secureStoreRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cached","loadSecureStore","undefined","mod","require","getItemAsync","setItemAsync","deleteItemAsync","exports","isSecureStoreAvailable","__resetSecureStoreRuntimeForTests"],"sourceRoot":"../../../src","sources":["helpers/secureStoreRuntime.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,IAAIA,MAA6C;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,eAAe,GAAGA,CAAA,KAAiC;EAC9D,IAAID,MAAM,KAAKE,SAAS,EAAE;IACxB,OAAOF,MAAM;EACf;EAEA,IAAI;IACF;IACA,MAAMG,GAAG,GAAGC,OAAO,CAAC,mBAAmB,CAAC;IACxC,IACE,OAAOD,GAAG,EAAEE,YAAY,KAAK,UAAU,IACvC,OAAOF,GAAG,EAAEG,YAAY,KAAK,UAAU,IACvC,OAAOH,GAAG,EAAEI,eAAe,KAAK,UAAU,EAC1C;MACAP,MAAM,GAAG,IAAI;IACf,CAAC,MAAM;MACLA,MAAM,GAAG;QACPK,YAAY,EAAEF,GAAG,CAACE,YAAY;QAC9BC,YAAY,EAAEH,GAAG,CAACG,YAAY;QAC9BC,eAAe,EAAEJ,GAAG,CAACI;MACvB,CAAC;IACH;EACF,CAAC,CAAC,MAAM;IACNP,MAAM,GAAG,IAAI;EACf;EAEA,OAAOA,MAAM;AACf,CAAC;AAACQ,OAAA,CAAAP,eAAA,GAAAA,eAAA;AAEK,MAAMQ,sBAAsB,GAAGA,CAAA,KAAeR,eAAe,CAAC,CAAC,KAAK,IAAI;;AAE/E;AAAAO,OAAA,CAAAC,sBAAA,GAAAA,sBAAA;AACO,MAAMC,iCAAiC,GAAGA,CAAA,KAAY;EAC3DV,MAAM,GAAGE,SAAS;AACpB,CAAC;AAACM,OAAA,CAAAE,iCAAA,GAAAA,iCAAA","ignoreList":[]}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.secureUserStorage = secureUserStorage;
7
+ var _useLocalStorage = require("../hooks/useLocalStorage");
8
+ var _LOCAL_STORAGE = require("./constants/LOCAL_STORAGE");
9
+ var _secureKeyValue = require("./secureKeyValue");
10
+ // Keychain (iOS) / Keystore-backed EncryptedSharedPreferences (Android)
11
+ // keys for the four live bearer credentials on `User`. Deliberately one
12
+ // key per field rather than one JSON blob: expo-secure-store historically
13
+ // caps a single value's size on Android, and four short JWTs each stay
14
+ // comfortably under that ceiling where one combined blob might not.
15
+ const SECRET_KEYS = {
16
+ token: 'ethora_auth_token',
17
+ refreshToken: 'ethora_auth_refresh_token',
18
+ xmppPassword: 'ethora_auth_xmpp_password',
19
+ fileToken: 'ethora_auth_file_token'
20
+ };
21
+ const SECRET_FIELDS = Object.keys(SECRET_KEYS);
22
+
23
+ /**
24
+ * Persisted-user storage, split across two backends behind the exact
25
+ * same `{ get, set, remove }` shape `asyncLocalStorage<User>(...)`
26
+ * already exposed — every existing call site swaps in by changing only
27
+ * the constructor call, `get()`/`set()`/`remove()` keep returning/taking
28
+ * a complete `User`.
29
+ *
30
+ * The four live credentials (REST access + refresh token, XMPP
31
+ * password, secure-media fileToken) never touch plain AsyncStorage:
32
+ * they go through `secureGet`/`secureSet`/`secureRemove` (platform
33
+ * Keychain/Keystore, falling back to namespaced AsyncStorage only when
34
+ * the host hasn't installed the optional `expo-secure-store` peer dep).
35
+ * Everything else on `User` — name, avatar, ids, xmppUsername, wallet
36
+ * address, none of it a bearer credential — keeps living under the
37
+ * existing `ETHORA_USER` AsyncStorage key, unchanged.
38
+ */
39
+ function secureUserStorage() {
40
+ const get = async () => {
41
+ const profile = await (0, _useLocalStorage.asyncLocalStorage)(_LOCAL_STORAGE.localStorageConstants.ETHORA_USER).get();
42
+ if (!profile) {
43
+ return null;
44
+ }
45
+ const secretValues = await Promise.all(SECRET_FIELDS.map(field => (0, _secureKeyValue.secureGet)(SECRET_KEYS[field])));
46
+ const merged = {
47
+ ...profile
48
+ };
49
+ SECRET_FIELDS.forEach((field, i) => {
50
+ merged[field] = secretValues[i] || '';
51
+ });
52
+ return merged;
53
+ };
54
+ const set = async user => {
55
+ const profile = {
56
+ ...user
57
+ };
58
+ for (const field of SECRET_FIELDS) {
59
+ profile[field] = '';
60
+ }
61
+ await Promise.all([(0, _useLocalStorage.asyncLocalStorage)(_LOCAL_STORAGE.localStorageConstants.ETHORA_USER).set(profile), ...SECRET_FIELDS.map(field => {
62
+ const value = user?.[field];
63
+ return value ? (0, _secureKeyValue.secureSet)(SECRET_KEYS[field], value) : (0, _secureKeyValue.secureRemove)(SECRET_KEYS[field]);
64
+ })]);
65
+ };
66
+ const remove = async () => {
67
+ await Promise.all([(0, _useLocalStorage.asyncLocalStorage)(_LOCAL_STORAGE.localStorageConstants.ETHORA_USER).remove(), ...SECRET_FIELDS.map(field => (0, _secureKeyValue.secureRemove)(SECRET_KEYS[field]))]);
68
+ };
69
+ return {
70
+ get,
71
+ set,
72
+ remove
73
+ };
74
+ }
75
+ //# sourceMappingURL=secureUserStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_useLocalStorage","require","_LOCAL_STORAGE","_secureKeyValue","SECRET_KEYS","token","refreshToken","xmppPassword","fileToken","SECRET_FIELDS","Object","keys","secureUserStorage","get","profile","asyncLocalStorage","localStorageConstants","ETHORA_USER","secretValues","Promise","all","map","field","secureGet","merged","forEach","i","set","user","value","secureSet","secureRemove","remove"],"sourceRoot":"../../../src","sources":["helpers/secureUserStorage.ts"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMG,WAAW,GAAG;EAClBC,KAAK,EAAE,mBAAmB;EAC1BC,YAAY,EAAE,2BAA2B;EACzCC,YAAY,EAAE,2BAA2B;EACzCC,SAAS,EAAE;AACb,CAAU;AAGV,MAAMC,aAAa,GAAGC,MAAM,CAACC,IAAI,CAACP,WAAW,CAAkB;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,iBAAiBA,CAAA,EAAG;EAClC,MAAMC,GAAG,GAAG,MAAAA,CAAA,KAAkC;IAC5C,MAAMC,OAAO,GAAG,MAAM,IAAAC,kCAAiB,EACrCC,oCAAqB,CAACC,WACxB,CAAC,CAACJ,GAAG,CAAC,CAAC;IACP,IAAI,CAACC,OAAO,EAAE;MAAC,OAAO,IAAI;IAAC;IAE3B,MAAMI,YAAY,GAAG,MAAMC,OAAO,CAACC,GAAG,CACpCX,aAAa,CAACY,GAAG,CAAEC,KAAK,IAAK,IAAAC,yBAAS,EAACnB,WAAW,CAACkB,KAAK,CAAC,CAAC,CAC5D,CAAC;IAED,MAAME,MAAY,GAAG;MAAE,GAAGV;IAAQ,CAAC;IACnCL,aAAa,CAACgB,OAAO,CAAC,CAACH,KAAK,EAAEI,CAAC,KAAK;MACjCF,MAAM,CAASF,KAAK,CAAC,GAAGJ,YAAY,CAACQ,CAAC,CAAC,IAAI,EAAE;IAChD,CAAC,CAAC;IACF,OAAOF,MAAM;E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