stream-chat-react 11.2.1 → 11.4.0

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 (149) hide show
  1. package/dist/browser.full-bundle.js +805 -708
  2. package/dist/browser.full-bundle.js.map +1 -1
  3. package/dist/browser.full-bundle.min.js +4 -4
  4. package/dist/browser.full-bundle.min.js.map +1 -1
  5. package/dist/components/Attachment/Attachment.d.ts.map +1 -1
  6. package/dist/components/Attachment/Attachment.js +1 -0
  7. package/dist/components/Attachment/AttachmentContainer.d.ts.map +1 -1
  8. package/dist/components/Attachment/AttachmentContainer.js +1 -0
  9. package/dist/components/Attachment/hooks/useAudioController.d.ts.map +1 -1
  10. package/dist/components/Attachment/hooks/useAudioController.js +1 -0
  11. package/dist/components/Channel/Channel.d.ts +2 -0
  12. package/dist/components/Channel/Channel.d.ts.map +1 -1
  13. package/dist/components/Channel/Channel.js +35 -24
  14. package/dist/components/Channel/hooks/useCreateChannelStateContext.d.ts.map +1 -1
  15. package/dist/components/Channel/hooks/useCreateChannelStateContext.js +3 -1
  16. package/dist/components/Channel/hooks/useCreateTypingContext.d.ts.map +1 -1
  17. package/dist/components/Channel/hooks/useCreateTypingContext.js +3 -1
  18. package/dist/components/ChannelList/ChannelList.d.ts.map +1 -1
  19. package/dist/components/ChannelList/ChannelList.js +3 -0
  20. package/dist/components/ChannelList/hooks/useChannelDeletedListener.d.ts.map +1 -1
  21. package/dist/components/ChannelList/hooks/useChannelDeletedListener.js +1 -0
  22. package/dist/components/ChannelList/hooks/useChannelHiddenListener.d.ts.map +1 -1
  23. package/dist/components/ChannelList/hooks/useChannelHiddenListener.js +1 -0
  24. package/dist/components/ChannelList/hooks/useChannelTruncatedListener.d.ts.map +1 -1
  25. package/dist/components/ChannelList/hooks/useChannelTruncatedListener.js +1 -0
  26. package/dist/components/ChannelList/hooks/useChannelUpdatedListener.d.ts.map +1 -1
  27. package/dist/components/ChannelList/hooks/useChannelUpdatedListener.js +1 -0
  28. package/dist/components/ChannelList/hooks/useChannelVisibleListener.d.ts.map +1 -1
  29. package/dist/components/ChannelList/hooks/useChannelVisibleListener.js +1 -0
  30. package/dist/components/ChannelList/hooks/useConnectionRecoveredListener.d.ts.map +1 -1
  31. package/dist/components/ChannelList/hooks/useConnectionRecoveredListener.js +1 -0
  32. package/dist/components/ChannelList/hooks/useMessageNewListener.d.ts.map +1 -1
  33. package/dist/components/ChannelList/hooks/useMessageNewListener.js +1 -0
  34. package/dist/components/ChannelList/hooks/useNotificationAddedToChannelListener.d.ts.map +1 -1
  35. package/dist/components/ChannelList/hooks/useNotificationAddedToChannelListener.js +1 -0
  36. package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.d.ts.map +1 -1
  37. package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.js +1 -0
  38. package/dist/components/ChannelList/hooks/useNotificationRemovedFromChannelListener.d.ts.map +1 -1
  39. package/dist/components/ChannelList/hooks/useNotificationRemovedFromChannelListener.js +1 -0
  40. package/dist/components/ChannelList/hooks/usePaginatedChannels.d.ts.map +1 -1
  41. package/dist/components/ChannelList/hooks/usePaginatedChannels.js +2 -0
  42. package/dist/components/ChannelList/hooks/useUserPresenceChangedListener.d.ts.map +1 -1
  43. package/dist/components/ChannelList/hooks/useUserPresenceChangedListener.js +1 -0
  44. package/dist/components/ChannelPreview/ChannelPreview.d.ts.map +1 -1
  45. package/dist/components/ChannelPreview/ChannelPreview.js +2 -0
  46. package/dist/components/ChannelPreview/hooks/useChannelPreviewInfo.d.ts.map +1 -1
  47. package/dist/components/ChannelPreview/hooks/useChannelPreviewInfo.js +1 -0
  48. package/dist/components/ChannelPreview/hooks/useIsChannelMuted.d.ts.map +1 -1
  49. package/dist/components/ChannelPreview/hooks/useIsChannelMuted.js +1 -0
  50. package/dist/components/ChannelSearch/SearchBar.d.ts.map +1 -1
  51. package/dist/components/ChannelSearch/SearchBar.js +2 -0
  52. package/dist/components/ChannelSearch/SearchResults.d.ts.map +1 -1
  53. package/dist/components/ChannelSearch/SearchResults.js +3 -1
  54. package/dist/components/ChannelSearch/hooks/useChannelSearch.d.ts.map +1 -1
  55. package/dist/components/ChannelSearch/hooks/useChannelSearch.js +7 -1
  56. package/dist/components/Chat/hooks/useChat.d.ts.map +1 -1
  57. package/dist/components/Chat/hooks/useChat.js +2 -0
  58. package/dist/components/Chat/hooks/useCreateChatContext.d.ts.map +1 -1
  59. package/dist/components/Chat/hooks/useCreateChatContext.js +3 -1
  60. package/dist/components/Gallery/ModalGallery.d.ts.map +1 -1
  61. package/dist/components/Gallery/ModalGallery.js +3 -1
  62. package/dist/components/InfiniteScrollPaginator/InfiniteScroll.d.ts.map +1 -1
  63. package/dist/components/InfiniteScrollPaginator/InfiniteScroll.js +1 -0
  64. package/dist/components/LoadMore/LoadMoreButton.d.ts.map +1 -1
  65. package/dist/components/LoadMore/LoadMoreButton.js +1 -0
  66. package/dist/components/LoadMore/LoadMorePaginator.d.ts.map +1 -1
  67. package/dist/components/LoadMore/LoadMorePaginator.js +1 -0
  68. package/dist/components/Message/MessageText.d.ts.map +1 -1
  69. package/dist/components/Message/MessageText.js +1 -0
  70. package/dist/components/Message/hooks/useReactionHandler.d.ts.map +1 -1
  71. package/dist/components/Message/hooks/useReactionHandler.js +6 -2
  72. package/dist/components/MessageActions/CustomMessageActionsList.d.ts +13 -0
  73. package/dist/components/MessageActions/CustomMessageActionsList.d.ts.map +1 -0
  74. package/dist/components/MessageActions/CustomMessageActionsList.js +11 -0
  75. package/dist/components/MessageActions/MessageActions.d.ts.map +1 -1
  76. package/dist/components/MessageActions/MessageActions.js +11 -3
  77. package/dist/components/MessageActions/MessageActionsBox.d.ts +4 -8
  78. package/dist/components/MessageActions/MessageActionsBox.d.ts.map +1 -1
  79. package/dist/components/MessageActions/MessageActionsBox.js +13 -36
  80. package/dist/components/MessageActions/hooks/index.d.ts +2 -0
  81. package/dist/components/MessageActions/hooks/index.d.ts.map +1 -0
  82. package/dist/components/MessageActions/hooks/index.js +1 -0
  83. package/dist/components/MessageActions/hooks/useMessageActionsBoxPopper.d.ts +18 -0
  84. package/dist/components/MessageActions/hooks/useMessageActionsBoxPopper.d.ts.map +1 -0
  85. package/dist/components/MessageActions/hooks/useMessageActionsBoxPopper.js +32 -0
  86. package/dist/components/MessageActions/index.d.ts +1 -0
  87. package/dist/components/MessageActions/index.d.ts.map +1 -1
  88. package/dist/components/MessageActions/index.js +1 -0
  89. package/dist/components/MessageInput/MessageInputFlat.d.ts.map +1 -1
  90. package/dist/components/MessageInput/MessageInputFlat.js +1 -0
  91. package/dist/components/MessageInput/MessageInputSmall.d.ts.map +1 -1
  92. package/dist/components/MessageInput/MessageInputSmall.js +1 -0
  93. package/dist/components/MessageInput/hooks/useAttachments.d.ts.map +1 -1
  94. package/dist/components/MessageInput/hooks/useAttachments.js +3 -1
  95. package/dist/components/MessageInput/hooks/useCreateMessageInputContext.d.ts.map +1 -1
  96. package/dist/components/MessageInput/hooks/useCreateMessageInputContext.js +3 -1
  97. package/dist/components/MessageInput/hooks/useFileUploads.d.ts.map +1 -1
  98. package/dist/components/MessageInput/hooks/useFileUploads.js +3 -0
  99. package/dist/components/MessageInput/hooks/useImageUploads.d.ts.map +1 -1
  100. package/dist/components/MessageInput/hooks/useImageUploads.js +4 -1
  101. package/dist/components/MessageInput/hooks/useLinkPreviews.d.ts.map +1 -1
  102. package/dist/components/MessageInput/hooks/useLinkPreviews.js +5 -1
  103. package/dist/components/MessageInput/hooks/useMessageInputText.d.ts.map +1 -1
  104. package/dist/components/MessageInput/hooks/useMessageInputText.js +6 -2
  105. package/dist/components/MessageInput/hooks/usePasteHandler.d.ts.map +1 -1
  106. package/dist/components/MessageInput/hooks/usePasteHandler.js +3 -1
  107. package/dist/components/MessageInput/hooks/useUserTrigger.d.ts.map +1 -1
  108. package/dist/components/MessageInput/hooks/useUserTrigger.js +1 -0
  109. package/dist/components/MessageList/MessageList.d.ts +3 -0
  110. package/dist/components/MessageList/MessageList.d.ts.map +1 -1
  111. package/dist/components/MessageList/MessageList.js +11 -8
  112. package/dist/components/MessageList/ScrollToBottomButton.d.ts.map +1 -1
  113. package/dist/components/MessageList/ScrollToBottomButton.js +1 -0
  114. package/dist/components/MessageList/VirtualizedMessageList.d.ts.map +1 -1
  115. package/dist/components/MessageList/VirtualizedMessageList.js +12 -14
  116. package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.d.ts.map +1 -1
  117. package/dist/components/MessageList/hooks/MessageList/useEnrichedMessages.js +3 -1
  118. package/dist/components/MessageList/hooks/MessageList/useMessageListElements.d.ts +3 -3
  119. package/dist/components/MessageList/hooks/MessageList/useMessageListElements.d.ts.map +1 -1
  120. package/dist/components/MessageList/hooks/MessageList/useMessageListElements.js +19 -30
  121. package/dist/components/MessageList/hooks/MessageList/useMessageListScrollManager.d.ts.map +1 -1
  122. package/dist/components/MessageList/hooks/MessageList/useMessageListScrollManager.js +1 -0
  123. package/dist/components/MessageList/hooks/MessageList/useScrollLocationLogic.d.ts.map +1 -1
  124. package/dist/components/MessageList/hooks/MessageList/useScrollLocationLogic.js +1 -0
  125. package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.d.ts.map +1 -1
  126. package/dist/components/MessageList/hooks/VirtualizedMessageList/useGiphyPreview.js +1 -0
  127. package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.d.ts.map +1 -1
  128. package/dist/components/MessageList/hooks/VirtualizedMessageList/usePrependMessagesCount.js +1 -0
  129. package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.d.ts.map +1 -1
  130. package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.js +1 -0
  131. package/dist/components/MessageList/hooks/VirtualizedMessageList/useShouldForceScrollToBottom.d.ts.map +1 -1
  132. package/dist/components/MessageList/hooks/VirtualizedMessageList/useShouldForceScrollToBottom.js +1 -0
  133. package/dist/components/MessageList/index.d.ts +1 -0
  134. package/dist/components/MessageList/index.d.ts.map +1 -1
  135. package/dist/components/MessageList/index.js +1 -0
  136. package/dist/components/MessageList/renderMessages.d.ts +22 -0
  137. package/dist/components/MessageList/renderMessages.d.ts.map +1 -0
  138. package/dist/components/MessageList/renderMessages.js +30 -0
  139. package/dist/components/MessageList/utils.d.ts.map +1 -1
  140. package/dist/components/MessageList/utils.js +1 -1
  141. package/dist/components/Reactions/hooks/useProcessReactions.d.ts.map +1 -1
  142. package/dist/components/Reactions/hooks/useProcessReactions.js +3 -0
  143. package/dist/components/Thread/Thread.js +1 -0
  144. package/dist/context/ComponentContext.d.ts +2 -1
  145. package/dist/context/ComponentContext.d.ts.map +1 -1
  146. package/dist/index.cjs.js +669 -575
  147. package/dist/version.d.ts +1 -1
  148. package/dist/version.js +1 -1
  149. package/package.json +3 -2
package/dist/index.cjs.js CHANGED
@@ -163,6 +163,7 @@ var useAudioController = function () {
163
163
  audioRef.current.play();
164
164
  return function () {
165
165
  var _a;
166
+ // eslint-disable-next-line react-hooks/exhaustive-deps
166
167
  (_a = audioRef.current) === null || _a === void 0 ? void 0 : _a.pause();
167
168
  window.clearInterval(interval);
168
169
  };
@@ -317,7 +318,9 @@ var ModalGallery = function (props) {
317
318
  source: imageSrc,
318
319
  };
319
320
  });
320
- }, [images]);
321
+ },
322
+ // eslint-disable-next-line react-hooks/exhaustive-deps
323
+ [images]);
321
324
  return (React__default["default"].createElement(ImageGallery__default["default"], { items: formattedArray, renderItem: renderItem, showIndex: true, showPlayButton: false, showThumbnails: false, startIndex: index }));
322
325
  };
323
326
 
@@ -3226,6 +3229,7 @@ var MediaContainer = function (props) {
3226
3229
  var config = videoAttachmentSizeHandler(attachment, videoElement.current, shouldGenerateVideoThumbnail);
3227
3230
  setAttachmentConfiguration(config);
3228
3231
  }
3232
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3229
3233
  }, [videoElement, videoAttachmentSizeHandler, attachment]);
3230
3234
  var content = (React__default["default"].createElement("div", { className: 'str-chat__player-wrapper', "data-testid": 'video-wrapper', ref: videoElement, style: getCssDimensionsVariables(attachment.thumb_url || '') },
3231
3235
  React__default["default"].createElement(Media, { className: 'react-player', config: { file: { attributes: { poster: attachmentConfiguration === null || attachmentConfiguration === void 0 ? void 0 : attachmentConfiguration.thumbUrl } } }, controls: true, height: '100%', url: attachmentConfiguration === null || attachmentConfiguration === void 0 ? void 0 : attachmentConfiguration.url, width: '100%' })));
@@ -3261,6 +3265,7 @@ var ATTACHMENT_GROUPS_ORDER = [
3261
3265
  */
3262
3266
  var Attachment = function (props) {
3263
3267
  var attachments = props.attachments;
3268
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3264
3269
  var groupedAttachments = React.useMemo(function () { return renderGroupedAttachments(props); }, [attachments]);
3265
3270
  return (React__default["default"].createElement("div", { className: 'str-chat__attachment-list' }, ATTACHMENT_GROUPS_ORDER.reduce(function (acc, groupName) { return icons.__spreadArray(icons.__spreadArray([], acc, true), groupedAttachments[groupName], true); }, [])));
3266
3271
  };
@@ -4651,7 +4656,7 @@ function mark(values, key, value) {
4651
4656
  * @property {Array<string>} [mustUseProperty]
4652
4657
  */
4653
4658
 
4654
- const own$6 = {}.hasOwnProperty;
4659
+ const own$5 = {}.hasOwnProperty;
4655
4660
 
4656
4661
  /**
4657
4662
  * @param {Definition} definition
@@ -4666,7 +4671,7 @@ function create(definition) {
4666
4671
  let prop;
4667
4672
 
4668
4673
  for (prop in definition.properties) {
4669
- if (own$6.call(definition.properties, prop)) {
4674
+ if (own$5.call(definition.properties, prop)) {
4670
4675
  const value = definition.properties[prop];
4671
4676
  const info = new DefinedInfo(
4672
4677
  prop,
@@ -6585,7 +6590,7 @@ VFileMessage.prototype.source = undefined;
6585
6590
  * @typedef {import('./components.js').Components} Components
6586
6591
  */
6587
6592
 
6588
- const own$5 = {}.hasOwnProperty;
6593
+ const own$4 = {}.hasOwnProperty;
6589
6594
 
6590
6595
  /** @type {Map<string, number>} */
6591
6596
  const emptyMap = new Map();
@@ -6722,7 +6727,7 @@ function one$1(state, node, key) {
6722
6727
  });
6723
6728
  }
6724
6729
 
6725
- if (own$5.call(state.components, node.tagName)) {
6730
+ if (own$4.call(state.components, node.tagName)) {
6726
6731
  const key = /** @type {keyof JSX.IntrinsicElements} */ (node.tagName);
6727
6732
  type = state.components[key];
6728
6733
 
@@ -6868,7 +6873,7 @@ function createProperties(state, ancestors) {
6868
6873
  let alignValue;
6869
6874
 
6870
6875
  for (prop in node.properties) {
6871
- if (prop !== 'children' && own$5.call(node.properties, prop)) {
6876
+ if (prop !== 'children' && own$4.call(node.properties, prop)) {
6872
6877
  const result = createProperty(
6873
6878
  state,
6874
6879
  ancestors,
@@ -7034,7 +7039,7 @@ function transformStylesToCssCasing(domCasing) {
7034
7039
  let from;
7035
7040
 
7036
7041
  for (from in domCasing) {
7037
- if (own$5.call(domCasing, from)) {
7042
+ if (own$4.call(domCasing, from)) {
7038
7043
  cssCasing[transformStyleToCssCasing(from)] = domCasing[from];
7039
7044
  }
7040
7045
  }
@@ -7113,395 +7118,6 @@ const urlAttributes = {
7113
7118
  ]
7114
7119
  };
7115
7120
 
7116
- /**
7117
- * @typedef {import('micromark-util-types').Code} Code
7118
- */
7119
-
7120
- const unicodePunctuationInternal = regexCheck(/\p{P}/u);
7121
-
7122
- /**
7123
- * Check whether the character code represents an ASCII alpha (`a` through `z`,
7124
- * case insensitive).
7125
- *
7126
- * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.
7127
- *
7128
- * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)
7129
- * to U+005A (`Z`).
7130
- *
7131
- * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)
7132
- * to U+007A (`z`).
7133
- *
7134
- * @param code
7135
- * Code.
7136
- * @returns {boolean}
7137
- * Whether it matches.
7138
- */
7139
- const asciiAlpha = regexCheck(/[A-Za-z]/);
7140
-
7141
- /**
7142
- * Check whether the character code represents an ASCII alphanumeric (`a`
7143
- * through `z`, case insensitive, or `0` through `9`).
7144
- *
7145
- * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha
7146
- * (see `asciiAlpha`).
7147
- *
7148
- * @param code
7149
- * Code.
7150
- * @returns {boolean}
7151
- * Whether it matches.
7152
- */
7153
- const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
7154
-
7155
- /**
7156
- * Check whether the character code represents an ASCII atext.
7157
- *
7158
- * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in
7159
- * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),
7160
- * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F
7161
- * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E
7162
- * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE
7163
- * (`{`) to U+007E TILDE (`~`).
7164
- *
7165
- * See:
7166
- * **\[RFC5322]**:
7167
- * [Internet Message Format](https://tools.ietf.org/html/rfc5322).
7168
- * P. Resnick.
7169
- * IETF.
7170
- *
7171
- * @param code
7172
- * Code.
7173
- * @returns {boolean}
7174
- * Whether it matches.
7175
- */
7176
- const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
7177
-
7178
- /**
7179
- * Check whether a character code is an ASCII control character.
7180
- *
7181
- * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)
7182
- * to U+001F (US), or U+007F (DEL).
7183
- *
7184
- * @param {Code} code
7185
- * Code.
7186
- * @returns {boolean}
7187
- * Whether it matches.
7188
- */
7189
- function asciiControl(code) {
7190
- return (
7191
- // Special whitespace codes (which have negative values), C0 and Control
7192
- // character DEL
7193
- code !== null && (code < 32 || code === 127)
7194
- )
7195
- }
7196
-
7197
- /**
7198
- * Check whether the character code represents an ASCII digit (`0` through `9`).
7199
- *
7200
- * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to
7201
- * U+0039 (`9`).
7202
- *
7203
- * @param code
7204
- * Code.
7205
- * @returns {boolean}
7206
- * Whether it matches.
7207
- */
7208
- const asciiDigit = regexCheck(/\d/);
7209
-
7210
- /**
7211
- * Check whether the character code represents an ASCII hex digit (`a` through
7212
- * `f`, case insensitive, or `0` through `9`).
7213
- *
7214
- * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex
7215
- * digit, or an ASCII lower hex digit.
7216
- *
7217
- * An **ASCII upper hex digit** is a character in the inclusive range U+0041
7218
- * (`A`) to U+0046 (`F`).
7219
- *
7220
- * An **ASCII lower hex digit** is a character in the inclusive range U+0061
7221
- * (`a`) to U+0066 (`f`).
7222
- *
7223
- * @param code
7224
- * Code.
7225
- * @returns {boolean}
7226
- * Whether it matches.
7227
- */
7228
- const asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
7229
-
7230
- /**
7231
- * Check whether the character code represents ASCII punctuation.
7232
- *
7233
- * An **ASCII punctuation** is a character in the inclusive ranges U+0021
7234
- * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT
7235
- * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT
7236
- * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).
7237
- *
7238
- * @param code
7239
- * Code.
7240
- * @returns {boolean}
7241
- * Whether it matches.
7242
- */
7243
- const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
7244
-
7245
- /**
7246
- * Check whether a character code is a markdown line ending.
7247
- *
7248
- * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN
7249
- * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).
7250
- *
7251
- * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE
7252
- * RETURN (CR) are replaced by these virtual characters depending on whether
7253
- * they occurred together.
7254
- *
7255
- * @param {Code} code
7256
- * Code.
7257
- * @returns {boolean}
7258
- * Whether it matches.
7259
- */
7260
- function markdownLineEnding(code) {
7261
- return code !== null && code < -2
7262
- }
7263
-
7264
- /**
7265
- * Check whether a character code is a markdown line ending (see
7266
- * `markdownLineEnding`) or markdown space (see `markdownSpace`).
7267
- *
7268
- * @param {Code} code
7269
- * Code.
7270
- * @returns {boolean}
7271
- * Whether it matches.
7272
- */
7273
- function markdownLineEndingOrSpace(code) {
7274
- return code !== null && (code < 0 || code === 32)
7275
- }
7276
-
7277
- /**
7278
- * Check whether a character code is a markdown space.
7279
- *
7280
- * A **markdown space** is the concrete character U+0020 SPACE (SP) and the
7281
- * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).
7282
- *
7283
- * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is
7284
- * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL
7285
- * SPACE (VS) characters, depending on the column at which the tab occurred.
7286
- *
7287
- * @param {Code} code
7288
- * Code.
7289
- * @returns {boolean}
7290
- * Whether it matches.
7291
- */
7292
- function markdownSpace(code) {
7293
- return code === -2 || code === -1 || code === 32
7294
- }
7295
-
7296
- // Size note: removing ASCII from the regex and using `asciiPunctuation` here
7297
- // In fact adds to the bundle size.
7298
- /**
7299
- * Check whether the character code represents Unicode punctuation.
7300
- *
7301
- * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,
7302
- * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`
7303
- * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`
7304
- * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII
7305
- * punctuation (see `asciiPunctuation`).
7306
- *
7307
- * See:
7308
- * **\[UNICODE]**:
7309
- * [The Unicode Standard](https://www.unicode.org/versions/).
7310
- * Unicode Consortium.
7311
- *
7312
- * @param {Code} code
7313
- * Code.
7314
- * @returns {boolean}
7315
- * Whether it matches.
7316
- */
7317
- function unicodePunctuation(code) {
7318
- return asciiPunctuation(code) || unicodePunctuationInternal(code)
7319
- }
7320
-
7321
- /**
7322
- * Check whether the character code represents Unicode whitespace.
7323
- *
7324
- * Note that this does handle micromark specific markdown whitespace characters.
7325
- * See `markdownLineEndingOrSpace` to check that.
7326
- *
7327
- * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,
7328
- * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),
7329
- * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**).
7330
- *
7331
- * See:
7332
- * **\[UNICODE]**:
7333
- * [The Unicode Standard](https://www.unicode.org/versions/).
7334
- * Unicode Consortium.
7335
- *
7336
- * @param code
7337
- * Code.
7338
- * @returns {boolean}
7339
- * Whether it matches.
7340
- */
7341
- const unicodeWhitespace = regexCheck(/\s/);
7342
-
7343
- /**
7344
- * Create a code check from a regex.
7345
- *
7346
- * @param {RegExp} regex
7347
- * @returns {(code: Code) => boolean}
7348
- */
7349
- function regexCheck(regex) {
7350
- return check
7351
-
7352
- /**
7353
- * Check whether a code matches the bound regex.
7354
- *
7355
- * @param {Code} code
7356
- * Character code.
7357
- * @returns {boolean}
7358
- * Whether the character code matches the bound regex.
7359
- */
7360
- function check(code) {
7361
- return code !== null && code > -1 && regex.test(String.fromCharCode(code))
7362
- }
7363
- }
7364
-
7365
- const characterReferences = {'"': 'quot', '&': 'amp', '<': 'lt', '>': 'gt'};
7366
-
7367
- /**
7368
- * Encode only the dangerous HTML characters.
7369
- *
7370
- * This ensures that certain characters which have special meaning in HTML are
7371
- * dealt with.
7372
- * Technically, we can skip `>` and `"` in many cases, but CM includes them.
7373
- *
7374
- * @param {string} value
7375
- * Value to encode.
7376
- * @returns {string}
7377
- * Encoded value.
7378
- */
7379
- function encode(value) {
7380
- return value.replace(/["&<>]/g, replace)
7381
-
7382
- /**
7383
- * @param {string} value
7384
- * @returns {string}
7385
- */
7386
- function replace(value) {
7387
- // @ts-expect-error Hush, it’s fine.
7388
- return '&' + characterReferences[value] + ';'
7389
- }
7390
- }
7391
-
7392
- /**
7393
- * Make a value safe for injection as a URL.
7394
- *
7395
- * This encodes unsafe characters with percent-encoding and skips already
7396
- * encoded sequences (see `normalizeUri`).
7397
- * Further unsafe characters are encoded as character references (see
7398
- * `micromark-util-encode`).
7399
- *
7400
- * A regex of allowed protocols can be given, in which case the URL is
7401
- * sanitized.
7402
- * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or
7403
- * `/^https?$/i` for `img[src]` (this is what `github.com` allows).
7404
- * If the URL includes an unknown protocol (one not matched by `protocol`, such
7405
- * as a dangerous example, `javascript:`), the value is ignored.
7406
- *
7407
- * @param {string | null | undefined} url
7408
- * URI to sanitize.
7409
- * @param {RegExp | null | undefined} [protocol]
7410
- * Allowed protocols.
7411
- * @returns {string}
7412
- * Sanitized URI.
7413
- */
7414
- function sanitizeUri(url, protocol) {
7415
- const value = encode(normalizeUri(url || ''));
7416
- if (!protocol) {
7417
- return value
7418
- }
7419
- const colon = value.indexOf(':');
7420
- const questionMark = value.indexOf('?');
7421
- const numberSign = value.indexOf('#');
7422
- const slash = value.indexOf('/');
7423
- if (
7424
- // If there is no protocol, it’s relative.
7425
- colon < 0 ||
7426
- // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
7427
- (slash > -1 && colon > slash) ||
7428
- (questionMark > -1 && colon > questionMark) ||
7429
- (numberSign > -1 && colon > numberSign) ||
7430
- // It is a protocol, it should be allowed.
7431
- protocol.test(value.slice(0, colon))
7432
- ) {
7433
- return value
7434
- }
7435
- return ''
7436
- }
7437
-
7438
- /**
7439
- * Normalize a URL.
7440
- *
7441
- * Encode unsafe characters with percent-encoding, skipping already encoded
7442
- * sequences.
7443
- *
7444
- * @param {string} value
7445
- * URI to normalize.
7446
- * @returns {string}
7447
- * Normalized URI.
7448
- */
7449
- function normalizeUri(value) {
7450
- /** @type {Array<string>} */
7451
- const result = [];
7452
- let index = -1;
7453
- let start = 0;
7454
- let skip = 0;
7455
- while (++index < value.length) {
7456
- const code = value.charCodeAt(index);
7457
- /** @type {string} */
7458
- let replace = '';
7459
-
7460
- // A correct percent encoded value.
7461
- if (
7462
- code === 37 &&
7463
- asciiAlphanumeric(value.charCodeAt(index + 1)) &&
7464
- asciiAlphanumeric(value.charCodeAt(index + 2))
7465
- ) {
7466
- skip = 2;
7467
- }
7468
- // ASCII.
7469
- else if (code < 128) {
7470
- if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {
7471
- replace = String.fromCharCode(code);
7472
- }
7473
- }
7474
- // Astral.
7475
- else if (code > 55_295 && code < 57_344) {
7476
- const next = value.charCodeAt(index + 1);
7477
-
7478
- // A correct surrogate pair.
7479
- if (code < 56_320 && next > 56_319 && next < 57_344) {
7480
- replace = String.fromCharCode(code, next);
7481
- skip = 1;
7482
- }
7483
- // Lone surrogate.
7484
- else {
7485
- replace = '\uFFFD';
7486
- }
7487
- }
7488
- // Unicode.
7489
- else {
7490
- replace = String.fromCharCode(code);
7491
- }
7492
- if (replace) {
7493
- result.push(value.slice(start, index), encodeURIComponent(replace));
7494
- start = index + skip + 1;
7495
- replace = '';
7496
- }
7497
- if (skip) {
7498
- index += skip;
7499
- skip = 0;
7500
- }
7501
- }
7502
- return result.join('') + value.slice(start)
7503
- }
7504
-
7505
7121
  /**
7506
7122
  * @typedef {import('mdast').Nodes} Nodes
7507
7123
  *
@@ -9744,7 +9360,7 @@ const characterEntities = {
9744
9360
  zwnj: '‌'
9745
9361
  };
9746
9362
 
9747
- const own$4 = {}.hasOwnProperty;
9363
+ const own$3 = {}.hasOwnProperty;
9748
9364
 
9749
9365
  /**
9750
9366
  * Decode a single character reference (without the `&` or `;`).
@@ -9758,7 +9374,7 @@ const own$4 = {}.hasOwnProperty;
9758
9374
  * Decoded reference.
9759
9375
  */
9760
9376
  function decodeNamedCharacterReference(value) {
9761
- return own$4.call(characterEntities, value) ? characterEntities[value] : false
9377
+ return own$3.call(characterEntities, value) ? characterEntities[value] : false
9762
9378
  }
9763
9379
 
9764
9380
  /**
@@ -9998,6 +9614,322 @@ function normalizeIdentifier(value) {
9998
9614
  )
9999
9615
  }
10000
9616
 
9617
+ /**
9618
+ * @typedef {import('micromark-util-types').Code} Code
9619
+ */
9620
+
9621
+ const unicodePunctuationInternal = regexCheck(/\p{P}/u);
9622
+
9623
+ /**
9624
+ * Check whether the character code represents an ASCII alpha (`a` through `z`,
9625
+ * case insensitive).
9626
+ *
9627
+ * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.
9628
+ *
9629
+ * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)
9630
+ * to U+005A (`Z`).
9631
+ *
9632
+ * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)
9633
+ * to U+007A (`z`).
9634
+ *
9635
+ * @param code
9636
+ * Code.
9637
+ * @returns {boolean}
9638
+ * Whether it matches.
9639
+ */
9640
+ const asciiAlpha = regexCheck(/[A-Za-z]/);
9641
+
9642
+ /**
9643
+ * Check whether the character code represents an ASCII alphanumeric (`a`
9644
+ * through `z`, case insensitive, or `0` through `9`).
9645
+ *
9646
+ * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha
9647
+ * (see `asciiAlpha`).
9648
+ *
9649
+ * @param code
9650
+ * Code.
9651
+ * @returns {boolean}
9652
+ * Whether it matches.
9653
+ */
9654
+ const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
9655
+
9656
+ /**
9657
+ * Check whether the character code represents an ASCII atext.
9658
+ *
9659
+ * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in
9660
+ * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),
9661
+ * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F
9662
+ * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E
9663
+ * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE
9664
+ * (`{`) to U+007E TILDE (`~`).
9665
+ *
9666
+ * See:
9667
+ * **\[RFC5322]**:
9668
+ * [Internet Message Format](https://tools.ietf.org/html/rfc5322).
9669
+ * P. Resnick.
9670
+ * IETF.
9671
+ *
9672
+ * @param code
9673
+ * Code.
9674
+ * @returns {boolean}
9675
+ * Whether it matches.
9676
+ */
9677
+ const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
9678
+
9679
+ /**
9680
+ * Check whether a character code is an ASCII control character.
9681
+ *
9682
+ * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)
9683
+ * to U+001F (US), or U+007F (DEL).
9684
+ *
9685
+ * @param {Code} code
9686
+ * Code.
9687
+ * @returns {boolean}
9688
+ * Whether it matches.
9689
+ */
9690
+ function asciiControl(code) {
9691
+ return (
9692
+ // Special whitespace codes (which have negative values), C0 and Control
9693
+ // character DEL
9694
+ code !== null && (code < 32 || code === 127)
9695
+ )
9696
+ }
9697
+
9698
+ /**
9699
+ * Check whether the character code represents an ASCII digit (`0` through `9`).
9700
+ *
9701
+ * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to
9702
+ * U+0039 (`9`).
9703
+ *
9704
+ * @param code
9705
+ * Code.
9706
+ * @returns {boolean}
9707
+ * Whether it matches.
9708
+ */
9709
+ const asciiDigit = regexCheck(/\d/);
9710
+
9711
+ /**
9712
+ * Check whether the character code represents an ASCII hex digit (`a` through
9713
+ * `f`, case insensitive, or `0` through `9`).
9714
+ *
9715
+ * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex
9716
+ * digit, or an ASCII lower hex digit.
9717
+ *
9718
+ * An **ASCII upper hex digit** is a character in the inclusive range U+0041
9719
+ * (`A`) to U+0046 (`F`).
9720
+ *
9721
+ * An **ASCII lower hex digit** is a character in the inclusive range U+0061
9722
+ * (`a`) to U+0066 (`f`).
9723
+ *
9724
+ * @param code
9725
+ * Code.
9726
+ * @returns {boolean}
9727
+ * Whether it matches.
9728
+ */
9729
+ const asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
9730
+
9731
+ /**
9732
+ * Check whether the character code represents ASCII punctuation.
9733
+ *
9734
+ * An **ASCII punctuation** is a character in the inclusive ranges U+0021
9735
+ * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT
9736
+ * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT
9737
+ * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).
9738
+ *
9739
+ * @param code
9740
+ * Code.
9741
+ * @returns {boolean}
9742
+ * Whether it matches.
9743
+ */
9744
+ const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
9745
+
9746
+ /**
9747
+ * Check whether a character code is a markdown line ending.
9748
+ *
9749
+ * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN
9750
+ * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).
9751
+ *
9752
+ * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE
9753
+ * RETURN (CR) are replaced by these virtual characters depending on whether
9754
+ * they occurred together.
9755
+ *
9756
+ * @param {Code} code
9757
+ * Code.
9758
+ * @returns {boolean}
9759
+ * Whether it matches.
9760
+ */
9761
+ function markdownLineEnding(code) {
9762
+ return code !== null && code < -2
9763
+ }
9764
+
9765
+ /**
9766
+ * Check whether a character code is a markdown line ending (see
9767
+ * `markdownLineEnding`) or markdown space (see `markdownSpace`).
9768
+ *
9769
+ * @param {Code} code
9770
+ * Code.
9771
+ * @returns {boolean}
9772
+ * Whether it matches.
9773
+ */
9774
+ function markdownLineEndingOrSpace(code) {
9775
+ return code !== null && (code < 0 || code === 32)
9776
+ }
9777
+
9778
+ /**
9779
+ * Check whether a character code is a markdown space.
9780
+ *
9781
+ * A **markdown space** is the concrete character U+0020 SPACE (SP) and the
9782
+ * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).
9783
+ *
9784
+ * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is
9785
+ * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL
9786
+ * SPACE (VS) characters, depending on the column at which the tab occurred.
9787
+ *
9788
+ * @param {Code} code
9789
+ * Code.
9790
+ * @returns {boolean}
9791
+ * Whether it matches.
9792
+ */
9793
+ function markdownSpace(code) {
9794
+ return code === -2 || code === -1 || code === 32
9795
+ }
9796
+
9797
+ // Size note: removing ASCII from the regex and using `asciiPunctuation` here
9798
+ // In fact adds to the bundle size.
9799
+ /**
9800
+ * Check whether the character code represents Unicode punctuation.
9801
+ *
9802
+ * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,
9803
+ * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`
9804
+ * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`
9805
+ * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII
9806
+ * punctuation (see `asciiPunctuation`).
9807
+ *
9808
+ * See:
9809
+ * **\[UNICODE]**:
9810
+ * [The Unicode Standard](https://www.unicode.org/versions/).
9811
+ * Unicode Consortium.
9812
+ *
9813
+ * @param {Code} code
9814
+ * Code.
9815
+ * @returns {boolean}
9816
+ * Whether it matches.
9817
+ */
9818
+ function unicodePunctuation(code) {
9819
+ return asciiPunctuation(code) || unicodePunctuationInternal(code)
9820
+ }
9821
+
9822
+ /**
9823
+ * Check whether the character code represents Unicode whitespace.
9824
+ *
9825
+ * Note that this does handle micromark specific markdown whitespace characters.
9826
+ * See `markdownLineEndingOrSpace` to check that.
9827
+ *
9828
+ * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,
9829
+ * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),
9830
+ * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**).
9831
+ *
9832
+ * See:
9833
+ * **\[UNICODE]**:
9834
+ * [The Unicode Standard](https://www.unicode.org/versions/).
9835
+ * Unicode Consortium.
9836
+ *
9837
+ * @param code
9838
+ * Code.
9839
+ * @returns {boolean}
9840
+ * Whether it matches.
9841
+ */
9842
+ const unicodeWhitespace = regexCheck(/\s/);
9843
+
9844
+ /**
9845
+ * Create a code check from a regex.
9846
+ *
9847
+ * @param {RegExp} regex
9848
+ * @returns {(code: Code) => boolean}
9849
+ */
9850
+ function regexCheck(regex) {
9851
+ return check
9852
+
9853
+ /**
9854
+ * Check whether a code matches the bound regex.
9855
+ *
9856
+ * @param {Code} code
9857
+ * Character code.
9858
+ * @returns {boolean}
9859
+ * Whether the character code matches the bound regex.
9860
+ */
9861
+ function check(code) {
9862
+ return code !== null && code > -1 && regex.test(String.fromCharCode(code))
9863
+ }
9864
+ }
9865
+
9866
+ /**
9867
+ * Normalize a URL.
9868
+ *
9869
+ * Encode unsafe characters with percent-encoding, skipping already encoded
9870
+ * sequences.
9871
+ *
9872
+ * @param {string} value
9873
+ * URI to normalize.
9874
+ * @returns {string}
9875
+ * Normalized URI.
9876
+ */
9877
+ function normalizeUri(value) {
9878
+ /** @type {Array<string>} */
9879
+ const result = [];
9880
+ let index = -1;
9881
+ let start = 0;
9882
+ let skip = 0;
9883
+ while (++index < value.length) {
9884
+ const code = value.charCodeAt(index);
9885
+ /** @type {string} */
9886
+ let replace = '';
9887
+
9888
+ // A correct percent encoded value.
9889
+ if (
9890
+ code === 37 &&
9891
+ asciiAlphanumeric(value.charCodeAt(index + 1)) &&
9892
+ asciiAlphanumeric(value.charCodeAt(index + 2))
9893
+ ) {
9894
+ skip = 2;
9895
+ }
9896
+ // ASCII.
9897
+ else if (code < 128) {
9898
+ if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {
9899
+ replace = String.fromCharCode(code);
9900
+ }
9901
+ }
9902
+ // Astral.
9903
+ else if (code > 55_295 && code < 57_344) {
9904
+ const next = value.charCodeAt(index + 1);
9905
+
9906
+ // A correct surrogate pair.
9907
+ if (code < 56_320 && next > 56_319 && next < 57_344) {
9908
+ replace = String.fromCharCode(code, next);
9909
+ skip = 1;
9910
+ }
9911
+ // Lone surrogate.
9912
+ else {
9913
+ replace = '\uFFFD';
9914
+ }
9915
+ }
9916
+ // Unicode.
9917
+ else {
9918
+ replace = String.fromCharCode(code);
9919
+ }
9920
+ if (replace) {
9921
+ result.push(value.slice(start, index), encodeURIComponent(replace));
9922
+ start = index + skip + 1;
9923
+ replace = '';
9924
+ }
9925
+ if (skip) {
9926
+ index += skip;
9927
+ skip = 0;
9928
+ }
9929
+ }
9930
+ return result.join('') + value.slice(start)
9931
+ }
9932
+
10001
9933
  /**
10002
9934
  * @typedef {import('micromark-util-types').Effects} Effects
10003
9935
  * @typedef {import('micromark-util-types').State} State
@@ -18161,7 +18093,7 @@ function index(value) {
18161
18093
  *
18162
18094
  * @typedef {import('../index.js').CompileData} CompileData
18163
18095
  */
18164
- const own$3 = {}.hasOwnProperty;
18096
+ const own$2 = {}.hasOwnProperty;
18165
18097
 
18166
18098
  /**
18167
18099
  * Turn markdown into a syntax tree.
@@ -18354,7 +18286,7 @@ function compiler(options) {
18354
18286
  index = -1;
18355
18287
  while (++index < events.length) {
18356
18288
  const handler = config[events[index][0]];
18357
- if (own$3.call(handler, events[index][1].type)) {
18289
+ if (own$2.call(handler, events[index][1].type)) {
18358
18290
  handler[events[index][1].type].call(
18359
18291
  Object.assign(
18360
18292
  {
@@ -19306,7 +19238,7 @@ function extension(combined, extension) {
19306
19238
  /** @type {keyof Extension} */
19307
19239
  let key;
19308
19240
  for (key in extension) {
19309
- if (own$3.call(extension, key)) {
19241
+ if (own$2.call(extension, key)) {
19310
19242
  switch (key) {
19311
19243
  case 'canContainEols': {
19312
19244
  const right = extension[key];
@@ -21011,7 +20943,7 @@ function footer(state) {
21011
20943
  * @typedef {import('./footer.js').FootnoteBackLabelTemplate} FootnoteBackLabelTemplate
21012
20944
  */
21013
20945
 
21014
- const own$2 = {}.hasOwnProperty;
20946
+ const own$1 = {}.hasOwnProperty;
21015
20947
 
21016
20948
  /** @type {Options} */
21017
20949
  const emptyOptions$1 = {};
@@ -21084,7 +21016,7 @@ function createState(tree, options) {
21084
21016
  const type = node.type;
21085
21017
  const handle = state.handlers[type];
21086
21018
 
21087
- if (own$2.call(state.handlers, type) && handle) {
21019
+ if (own$1.call(state.handlers, type) && handle) {
21088
21020
  return handle(state, node, parent)
21089
21021
  }
21090
21022
 
@@ -21240,7 +21172,7 @@ function defaultUnknownHandler(state, node) {
21240
21172
  /** @type {HastElement | HastText} */
21241
21173
  const result =
21242
21174
  'value' in node &&
21243
- !(own$2.call(data, 'hProperties') || own$2.call(data, 'hChildren'))
21175
+ !(own$1.call(data, 'hProperties') || own$1.call(data, 'hChildren'))
21244
21176
  ? {type: 'text', value: node.value}
21245
21177
  : {
21246
21178
  type: 'element',
@@ -23046,7 +22978,7 @@ const CallableInstance =
23046
22978
  // `parse` is called.
23047
22979
  // Currently, we allow directly setting `processor.parser`, which is untyped.
23048
22980
 
23049
- const own$1 = {}.hasOwnProperty;
22981
+ const own = {}.hasOwnProperty;
23050
22982
 
23051
22983
  /**
23052
22984
  * @template {Node | undefined} [ParseTree=undefined]
@@ -23267,7 +23199,7 @@ class Processor extends CallableInstance {
23267
23199
  }
23268
23200
 
23269
23201
  // Get `key`.
23270
- return (own$1.call(this.namespace, key) && this.namespace[key]) || undefined
23202
+ return (own.call(this.namespace, key) && this.namespace[key]) || undefined
23271
23203
  }
23272
23204
 
23273
23205
  // Set space.
@@ -23998,7 +23930,6 @@ function isUint8Array(value) {
23998
23930
 
23999
23931
  // Register `Raw` in tree:
24000
23932
 
24001
- const own = {}.hasOwnProperty;
24002
23933
  const changelog =
24003
23934
  'https://github.com/remarkjs/react-markdown/blob/main/changelog.md';
24004
23935
 
@@ -24144,7 +24075,10 @@ function Markdown(options) {
24144
24075
  let key;
24145
24076
 
24146
24077
  for (key in urlAttributes) {
24147
- if (own.call(urlAttributes, key) && own.call(node.properties, key)) {
24078
+ if (
24079
+ Object.hasOwn(urlAttributes, key) &&
24080
+ Object.hasOwn(node.properties, key)
24081
+ ) {
24148
24082
  const value = node.properties[key];
24149
24083
  const test = urlAttributes[key];
24150
24084
  if (test === null || test.includes(node.tagName)) {
@@ -24188,7 +24122,28 @@ function Markdown(options) {
24188
24122
  * Safe URL.
24189
24123
  */
24190
24124
  function defaultUrlTransform(value) {
24191
- return sanitizeUri(value, safeProtocol)
24125
+ // Same as:
24126
+ // <https://github.com/micromark/micromark/blob/929275e/packages/micromark-util-sanitize-uri/dev/index.js#L34>
24127
+ // But without the `encode` part.
24128
+ const colon = value.indexOf(':');
24129
+ const questionMark = value.indexOf('?');
24130
+ const numberSign = value.indexOf('#');
24131
+ const slash = value.indexOf('/');
24132
+
24133
+ if (
24134
+ // If there is no protocol, it’s relative.
24135
+ colon < 0 ||
24136
+ // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
24137
+ (slash > -1 && colon > slash) ||
24138
+ (questionMark > -1 && colon > questionMark) ||
24139
+ (numberSign > -1 && colon > numberSign) ||
24140
+ // It is a protocol, it should be allowed.
24141
+ safeProtocol.test(value.slice(0, colon))
24142
+ ) {
24143
+ return value
24144
+ }
24145
+
24146
+ return ''
24192
24147
  }
24193
24148
 
24194
24149
  /**
@@ -31672,7 +31627,9 @@ var useCreateChannelStateContext = function (value) {
31672
31627
  watcher_count: watcher_count,
31673
31628
  watcherCount: watcherCount,
31674
31629
  watchers: watchers,
31675
- }); }, [
31630
+ }); },
31631
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31632
+ [
31676
31633
  channelId,
31677
31634
  debounceURLEnrichmentMs,
31678
31635
  enrichURLForPreview,
@@ -31709,7 +31666,9 @@ var useCreateTypingContext = function (value) {
31709
31666
  var typingValue = Object.keys(typing || {}).join();
31710
31667
  var typingContext = React.useMemo(function () { return ({
31711
31668
  typing: typing,
31712
- }); }, [typingValue]);
31669
+ }); },
31670
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31671
+ [typingValue]);
31713
31672
  return typingContext;
31714
31673
  };
31715
31674
 
@@ -32216,34 +32175,24 @@ var isOnlyEmojis = function (text) {
32216
32175
 
32217
32176
  var CustomMessageActionsList = function (props) {
32218
32177
  var customMessageActions = props.customMessageActions, message = props.message;
32178
+ if (!customMessageActions)
32179
+ return null;
32219
32180
  var customActionsArray = Object.keys(customMessageActions);
32220
32181
  return (React__default["default"].createElement(React__default["default"].Fragment, null, customActionsArray.map(function (customAction) {
32221
32182
  var customHandler = customMessageActions[customAction];
32222
32183
  return (React__default["default"].createElement("button", { "aria-selected": 'false', className: 'str-chat__message-actions-list-item str-chat__message-actions-list-item-button', key: customAction, onClick: function (event) { return customHandler(message, event); }, role: 'option' }, customAction));
32223
32184
  })));
32224
32185
  };
32225
- var UnMemoizedMessageActionsBox = function (props) {
32226
- var getMessageActions = props.getMessageActions, handleDelete = props.handleDelete, handleEdit = props.handleEdit, handleFlag = props.handleFlag, handleMute = props.handleMute, handlePin = props.handlePin, isUserMuted = props.isUserMuted, mine = props.mine, _a = props.open, open = _a === void 0 ? false : _a;
32186
+
32187
+ var UnMemoizedMessageActionsBox = React__default["default"].forwardRef(function (props, ref) {
32188
+ var getMessageActions = props.getMessageActions, handleDelete = props.handleDelete, handleEdit = props.handleEdit, handleFlag = props.handleFlag, handleMute = props.handleMute, handlePin = props.handlePin, isUserMuted = props.isUserMuted;
32189
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
32190
+ props.mine; var _a = props.open, open = _a === void 0 ? false : _a, restDivProps = icons.__rest(props, ["getMessageActions", "handleDelete", "handleEdit", "handleFlag", "handleMute", "handlePin", "isUserMuted", "mine", "open"]);
32191
+ var _b = icons.useComponentContext('MessageActionsBox').CustomMessageActionsList, CustomMessageActionsList$1 = _b === void 0 ? CustomMessageActionsList : _b;
32227
32192
  var setQuotedMessage = icons.useChannelActionContext('MessageActionsBox').setQuotedMessage;
32228
- var _b = icons.useMessageContext('MessageActionsBox'), customMessageActions = _b.customMessageActions, message = _b.message, messageListRect = _b.messageListRect;
32193
+ var _c = icons.useMessageContext('MessageActionsBox'), customMessageActions = _c.customMessageActions, message = _c.message;
32229
32194
  var t = icons.useTranslationContext('MessageActionsBox').t;
32230
- var _c = React.useState(false), reverse = _c[0], setReverse = _c[1];
32231
32195
  var messageActions = getMessageActions();
32232
- var checkIfReverse = React.useCallback(function (containerElement) {
32233
- if (!containerElement) {
32234
- setReverse(false);
32235
- return;
32236
- }
32237
- if (open) {
32238
- var containerRect = containerElement.getBoundingClientRect();
32239
- if (mine) {
32240
- setReverse(!!messageListRect && containerRect.left < messageListRect.left);
32241
- }
32242
- else {
32243
- setReverse(!!messageListRect && containerRect.right + 5 > messageListRect.right);
32244
- }
32245
- }
32246
- }, [messageListRect, mine, open]);
32247
32196
  var handleQuote = function () {
32248
32197
  setQuotedMessage(message);
32249
32198
  var elements = message.parent_id
@@ -32255,26 +32204,55 @@ var UnMemoizedMessageActionsBox = function (props) {
32255
32204
  }
32256
32205
  };
32257
32206
  var rootClassName = clsx('str-chat__message-actions-box', {
32258
- 'str-chat__message-actions-box--mine': mine,
32259
32207
  'str-chat__message-actions-box--open': open,
32260
- 'str-chat__message-actions-box--reverse': reverse,
32261
32208
  });
32262
32209
  var buttonClassName = 'str-chat__message-actions-list-item str-chat__message-actions-list-item-button';
32263
- return (React__default["default"].createElement("div", { className: rootClassName, "data-testid": 'message-actions-box', ref: checkIfReverse },
32210
+ return (React__default["default"].createElement("div", icons.__assign({}, restDivProps, { className: rootClassName, "data-testid": 'message-actions-box', ref: ref }),
32264
32211
  React__default["default"].createElement("div", { "aria-label": 'Message Options', className: 'str-chat__message-actions-list', role: 'listbox' },
32265
- customMessageActions && (React__default["default"].createElement(CustomMessageActionsList, { customMessageActions: customMessageActions, message: message })),
32212
+ React__default["default"].createElement(CustomMessageActionsList$1, { customMessageActions: customMessageActions, message: message }),
32266
32213
  messageActions.indexOf(MESSAGE_ACTIONS.quote) > -1 && (React__default["default"].createElement("button", { "aria-selected": 'false', className: buttonClassName, onClick: handleQuote, role: 'option' }, t('Reply'))),
32267
32214
  messageActions.indexOf(MESSAGE_ACTIONS.pin) > -1 && !message.parent_id && (React__default["default"].createElement("button", { "aria-selected": 'false', className: buttonClassName, onClick: handlePin, role: 'option' }, !message.pinned ? t('Pin') : t('Unpin'))),
32268
32215
  messageActions.indexOf(MESSAGE_ACTIONS.flag) > -1 && (React__default["default"].createElement("button", { "aria-selected": 'false', className: buttonClassName, onClick: handleFlag, role: 'option' }, t('Flag'))),
32269
32216
  messageActions.indexOf(MESSAGE_ACTIONS.mute) > -1 && (React__default["default"].createElement("button", { "aria-selected": 'false', className: buttonClassName, onClick: handleMute, role: 'option' }, isUserMuted() ? t('Unmute') : t('Mute'))),
32270
32217
  messageActions.indexOf(MESSAGE_ACTIONS.edit) > -1 && (React__default["default"].createElement("button", { "aria-selected": 'false', className: buttonClassName, onClick: handleEdit, role: 'option' }, t('Edit Message'))),
32271
32218
  messageActions.indexOf(MESSAGE_ACTIONS.delete) > -1 && (React__default["default"].createElement("button", { "aria-selected": 'false', className: buttonClassName, onClick: handleDelete, role: 'option' }, t('Delete'))))));
32272
- };
32219
+ });
32273
32220
  /**
32274
32221
  * A popup box that displays the available actions on a message, such as edit, delete, pin, etc.
32275
32222
  */
32276
32223
  var MessageActionsBox = React__default["default"].memo(UnMemoizedMessageActionsBox);
32277
32224
 
32225
+ function useMessageActionsBoxPopper(_a) {
32226
+ var open = _a.open, placement = _a.placement, referenceElement = _a.referenceElement;
32227
+ var popperElementRef = React.useRef(null);
32228
+ var _b = icons.usePopper(referenceElement, popperElementRef.current, {
32229
+ modifiers: [
32230
+ {
32231
+ name: 'eventListeners',
32232
+ options: {
32233
+ // It's not safe to update popper position on resize and scroll, since popper's
32234
+ // reference element might not be visible at the time.
32235
+ resize: false,
32236
+ scroll: false,
32237
+ },
32238
+ },
32239
+ ],
32240
+ placement: placement,
32241
+ }), attributes = _b.attributes, styles = _b.styles, update = _b.update;
32242
+ React.useEffect(function () {
32243
+ if (open) {
32244
+ // Since the popper's reference element might not be (and usually is not) visible
32245
+ // all the time, it's safer to force popper update before showing it.
32246
+ update === null || update === void 0 ? void 0 : update();
32247
+ }
32248
+ }, [open, update]);
32249
+ return {
32250
+ attributes: attributes,
32251
+ popperElementRef: popperElementRef,
32252
+ styles: styles,
32253
+ };
32254
+ }
32255
+
32278
32256
  var MessageActions = function (props) {
32279
32257
  var _a = props.ActionsIcon, ActionsIcon$1 = _a === void 0 ? ActionsIcon : _a, _b = props.customWrapperClass, customWrapperClass = _b === void 0 ? '' : _b, propGetMessageActions = props.getMessageActions, propHandleDelete = props.handleDelete, propHandleFlag = props.handleFlag, propHandleMute = props.handleMute, propHandlePin = props.handlePin, inline = props.inline, propMessage = props.message, messageWrapperRef = props.messageWrapperRef, mine = props.mine;
32280
32258
  var mutes = icons.useChatContext('MessageActions').mutes;
@@ -32285,6 +32263,7 @@ var MessageActions = function (props) {
32285
32263
  var handleMute = propHandleMute || contextHandleMute;
32286
32264
  var handlePin = propHandlePin || contextHandlePin;
32287
32265
  var message = propMessage || contextMessage;
32266
+ var isMine = mine ? mine() : isMyMessage();
32288
32267
  var _d = React.useState(false), actionsBoxOpen = _d[0], setActionsBoxOpen = _d[1];
32289
32268
  var isMuted = React.useCallback(function () { return isUserMuted(message, mutes); }, [message, mutes]);
32290
32269
  var hideOptions = React.useCallback(function (event) {
@@ -32315,11 +32294,17 @@ var MessageActions = function (props) {
32315
32294
  document.removeEventListener('keyup', hideOptions);
32316
32295
  };
32317
32296
  }, [actionsBoxOpen, hideOptions]);
32297
+ var actionsBoxButtonRef = React.useRef(null);
32298
+ var _e = useMessageActionsBoxPopper({
32299
+ open: actionsBoxOpen,
32300
+ placement: isMine ? 'top-end' : 'top-start',
32301
+ referenceElement: actionsBoxButtonRef.current,
32302
+ }), attributes = _e.attributes, popperElementRef = _e.popperElementRef, styles = _e.styles;
32318
32303
  if (!messageActions.length && !customMessageActions)
32319
32304
  return null;
32320
32305
  return (React__default["default"].createElement(MessageActionsWrapper, { customWrapperClass: customWrapperClass, inline: inline, setActionsBoxOpen: setActionsBoxOpen },
32321
- React__default["default"].createElement(MessageActionsBox, { getMessageActions: getMessageActions, handleDelete: handleDelete, handleEdit: setEditingState, handleFlag: handleFlag, handleMute: handleMute, handlePin: handlePin, isUserMuted: isMuted, mine: mine ? mine() : isMyMessage(), open: actionsBoxOpen }),
32322
- React__default["default"].createElement("button", { "aria-expanded": actionsBoxOpen, "aria-haspopup": 'true', "aria-label": 'Open Message Actions Menu', className: 'str-chat__message-actions-box-button' },
32306
+ React__default["default"].createElement(MessageActionsBox, icons.__assign({}, attributes.popper, { getMessageActions: getMessageActions, handleDelete: handleDelete, handleEdit: setEditingState, handleFlag: handleFlag, handleMute: handleMute, handlePin: handlePin, isUserMuted: isMuted, mine: isMine, open: actionsBoxOpen, ref: popperElementRef, style: styles.popper })),
32307
+ React__default["default"].createElement("button", { "aria-expanded": actionsBoxOpen, "aria-haspopup": 'true', "aria-label": 'Open Message Actions Menu', className: 'str-chat__message-actions-box-button', ref: actionsBoxButtonRef },
32323
32308
  React__default["default"].createElement(ActionsIcon$1, { className: 'str-chat__message-action-icon' }))));
32324
32309
  };
32325
32310
  var MessageActionsWrapper = function (props) {
@@ -32486,6 +32471,7 @@ var UnMemoizedMessageTextComponent = function (props) {
32486
32471
  var message = propMessage || contextMessage;
32487
32472
  var hasAttachment = messageHasAttachments(message);
32488
32473
  var messageTextToRender = ((_b = message.i18n) === null || _b === void 0 ? void 0 : _b["".concat(userLanguage, "_text")]) || message.text;
32474
+ // eslint-disable-next-line react-hooks/exhaustive-deps
32489
32475
  var messageText = React.useMemo(function () { return renderText$1(messageTextToRender, message.mentioned_users); }, [
32490
32476
  message.mentioned_users,
32491
32477
  messageTextToRender,
@@ -32931,6 +32917,7 @@ var useUserTrigger = function (params) {
32931
32917
  });
32932
32918
  return Object.values(uniqueUsers);
32933
32919
  }, [members, watchers]);
32920
+ // eslint-disable-next-line react-hooks/exhaustive-deps
32934
32921
  var queryMembersThrottled = React.useCallback(throttle__default["default"](function (query, onReady) { return icons.__awaiter(void 0, void 0, void 0, function () {
32935
32922
  var response, users, error_1;
32936
32923
  return icons.__generator(this, function (_a) {
@@ -33240,6 +33227,7 @@ var MessageInputFlat = function () {
33240
33227
  channel === null || channel === void 0 ? void 0 : channel.off('message.deleted', handleQuotedMessageUpdate);
33241
33228
  channel === null || channel === void 0 ? void 0 : channel.off('message.updated', handleQuotedMessageUpdate);
33242
33229
  };
33230
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33243
33231
  }, [channel, quotedMessage]);
33244
33232
  return themeVersion === '2' ? (React__default["default"].createElement(MessageInputV2, null)) : (React__default["default"].createElement(MessageInputV1, null));
33245
33233
  };
@@ -33407,6 +33395,7 @@ var useImageUploads = function (props, state, dispatch) {
33407
33395
  var removeImage = React.useCallback(function (id) {
33408
33396
  dispatch({ id: id, type: 'removeImageUpload' });
33409
33397
  // TODO: cancel upload if still uploading
33398
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33410
33399
  }, []);
33411
33400
  var uploadImage = React.useCallback(function (id) { return icons.__awaiter(void 0, void 0, void 0, function () {
33412
33401
  var img, file, canUpload, response, error_1, errorMessage, alreadyRemoved;
@@ -33482,7 +33471,9 @@ var useImageUploads = function (props, state, dispatch) {
33482
33471
  return [2 /*return*/];
33483
33472
  }
33484
33473
  });
33485
- }); }, [imageUploads, channel, doImageUploadRequest, errorHandler, removeImage]);
33474
+ }); },
33475
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33476
+ [imageUploads, channel, doImageUploadRequest, errorHandler, removeImage]);
33486
33477
  React.useEffect(function () {
33487
33478
  var upload = Object.values(imageUploads).find(function (imageUpload) { return imageUpload.state === 'uploading' && imageUpload.file; });
33488
33479
  if (!upload)
@@ -33504,10 +33495,12 @@ var useFileUploads = function (props, state, dispatch) {
33504
33495
  var t = icons.useTranslationContext('useFileUploads').t;
33505
33496
  var uploadFile = React.useCallback(function (id) {
33506
33497
  dispatch({ id: id, state: 'uploading', type: 'setFileUpload' });
33498
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33507
33499
  }, []);
33508
33500
  var removeFile = React.useCallback(function (id) {
33509
33501
  // TODO: cancel upload if still uploading
33510
33502
  dispatch({ id: id, type: 'removeFileUpload' });
33503
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33511
33504
  }, []);
33512
33505
  React.useEffect(function () {
33513
33506
  (function () { return icons.__awaiter(void 0, void 0, void 0, function () {
@@ -33579,6 +33572,7 @@ var useFileUploads = function (props, state, dispatch) {
33579
33572
  }
33580
33573
  });
33581
33574
  }); })();
33575
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33582
33576
  }, [fileUploads, channel, doFileUploadRequest, errorHandler, removeFile]);
33583
33577
  return {
33584
33578
  removeFile: removeFile,
@@ -33630,7 +33624,9 @@ var useAttachments = function (props, state, dispatch, textareaRef) {
33630
33624
  }
33631
33625
  });
33632
33626
  (_a = textareaRef === null || textareaRef === void 0 ? void 0 : textareaRef.current) === null || _a === void 0 ? void 0 : _a.focus();
33633
- }, [maxFilesLeft, noFiles]);
33627
+ },
33628
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33629
+ [maxFilesLeft, noFiles]);
33634
33630
  return {
33635
33631
  maxFilesLeft: maxFilesLeft,
33636
33632
  numberOfUploads: numberOfUploads,
@@ -33681,7 +33677,9 @@ var useMessageInputText = function (props, state, dispatch, findAndEnqueueURLsTo
33681
33677
  },
33682
33678
  type: 'setText',
33683
33679
  });
33684
- }, [additionalTextareaProps, newCursorPosition, textareaRef]);
33680
+ },
33681
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33682
+ [additionalTextareaProps, newCursorPosition, textareaRef]);
33685
33683
  React.useEffect(function () {
33686
33684
  var textareaElement = textareaRef.current;
33687
33685
  if (textareaElement && newCursorPosition.current !== undefined) {
@@ -33704,7 +33702,9 @@ var useMessageInputText = function (props, state, dispatch, findAndEnqueueURLsTo
33704
33702
  if (publishTypingEvent && newText && channel) {
33705
33703
  streamChat.logChatPromiseExecution(channel.keystroke(parent === null || parent === void 0 ? void 0 : parent.id), 'start typing event');
33706
33704
  }
33707
- }, [channel, findAndEnqueueURLsToEnrich, parent, publishTypingEvent]);
33705
+ },
33706
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33707
+ [channel, findAndEnqueueURLsToEnrich, parent, publishTypingEvent]);
33708
33708
  return {
33709
33709
  handleChange: handleChange,
33710
33710
  insertText: insertText,
@@ -33938,7 +33938,9 @@ var usePasteHandler = function (uploadNewFiles, insertText, isUploadEnabled, fin
33938
33938
  }
33939
33939
  });
33940
33940
  }); })(clipboardEvent);
33941
- }, [insertText, uploadNewFiles]);
33941
+ },
33942
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33943
+ [insertText, uploadNewFiles]);
33942
33944
  return { onPaste: onPaste };
33943
33945
  };
33944
33946
 
@@ -33962,7 +33964,10 @@ var useLinkPreviews = function (_a) {
33962
33964
  mode: exports.SetLinkPreviewMode.UPSERT,
33963
33965
  type: 'setLinkPreviews',
33964
33966
  });
33965
- }, [onLinkPreviewDismissed]);
33967
+ },
33968
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33969
+ [onLinkPreviewDismissed]);
33970
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33966
33971
  var findAndEnqueueURLsToEnrich = React.useCallback(debounce__default["default"](function (text, mode) {
33967
33972
  if (mode === void 0) { mode = exports.SetLinkPreviewMode.SET; }
33968
33973
  var urls = findURLFn
@@ -34028,6 +34033,7 @@ var useLinkPreviews = function (_a) {
34028
34033
  });
34029
34034
  });
34030
34035
  });
34036
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34031
34037
  }, [shouldDiscardEnrichQueries, linkPreviews]);
34032
34038
  return {
34033
34039
  cancelURLEnrichment: cancelURLEnrichment,
@@ -34319,7 +34325,9 @@ var useCreateMessageInputContext = function (value) {
34319
34325
  uploadImage: uploadImage,
34320
34326
  uploadNewFiles: uploadNewFiles,
34321
34327
  useMentionsTransliteration: useMentionsTransliteration,
34322
- }); }, [
34328
+ }); },
34329
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34330
+ [
34323
34331
  cancelURLEnrichment,
34324
34332
  cooldownInterval,
34325
34333
  cooldownRemaining,
@@ -34402,6 +34410,7 @@ var MessageInputSmall = function () {
34402
34410
  channel === null || channel === void 0 ? void 0 : channel.off('message.deleted', handleQuotedMessageUpdate);
34403
34411
  channel === null || channel === void 0 ? void 0 : channel.off('message.updated', handleQuotedMessageUpdate);
34404
34412
  };
34413
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34405
34414
  }, [channel, quotedMessage]);
34406
34415
  return (React__default["default"].createElement("div", { className: 'str-chat__small-message-input__wrapper' },
34407
34416
  React__default["default"].createElement(ImageDropzone, { accept: acceptedFiles, disabled: !isUploadEnabled || maxFilesLeft === 0 || !!cooldownRemaining, handleFiles: uploadNewFiles, maxNumberOfFiles: maxFilesLeft, multiple: multipleUploads },
@@ -34560,8 +34569,11 @@ var useProcessReactions = function (params) {
34560
34569
  var message = icons.useMessageContext('useProcessReactions').message;
34561
34570
  var contextReactionOptions = icons.useComponentContext('useProcessReactions').reactionOptions;
34562
34571
  var reactionOptions = propReactionOptions !== null && propReactionOptions !== void 0 ? propReactionOptions : contextReactionOptions;
34572
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34563
34573
  var latestReactions = propReactions || message.latest_reactions || [];
34574
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34564
34575
  var ownReactions = propOwnReactions || (message === null || message === void 0 ? void 0 : message.own_reactions) || [];
34576
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34565
34577
  var reactionCounts = propReactionCounts || message.reaction_counts || {};
34566
34578
  var iHaveReactedWithReaction = React.useCallback(function (reactionType) { return ownReactions.find(function (reaction) { return reaction.type === reactionType; }); }, [ownReactions]);
34567
34579
  var getEmojiByReactionType = React.useCallback(function (reactionType) { return reactionOptions.find(function (_a) {
@@ -35071,7 +35083,7 @@ var getGroupStyles = function (message, previousMessage, nextMessage, noGroupByU
35071
35083
  // The MessageList should have configurable the limit for performing the requests.
35072
35084
  // This parameter would then be used within these functions
35073
35085
  var hasMoreMessagesProbably = function (returnedCountMessages, limit) {
35074
- return returnedCountMessages === limit;
35086
+ return returnedCountMessages >= limit;
35075
35087
  };
35076
35088
  // @deprecated
35077
35089
  var hasNotMoreMessages = function (returnedCountMessages, limit) {
@@ -35245,6 +35257,60 @@ var addResizingParamsToUrl = function (resizeDimensions, url) {
35245
35257
  url.searchParams.set('w', resizeDimensions.width.toString());
35246
35258
  };
35247
35259
 
35260
+ /**
35261
+ * Component to display system and channel event messages
35262
+ */
35263
+ var UnMemoizedEventComponent = function (props) {
35264
+ var _a, _b, _c;
35265
+ var _d = props.Avatar, Avatar$1 = _d === void 0 ? Avatar : _d, message = props.message;
35266
+ var tDateTimeParser = icons.useTranslationContext('EventComponent').tDateTimeParser;
35267
+ var _e = message.created_at, created_at = _e === void 0 ? '' : _e, event = message.event, text = message.text, type = message.type;
35268
+ var getDateOptions = { messageCreatedAt: created_at.toString(), tDateTimeParser: tDateTimeParser };
35269
+ if (type === 'system')
35270
+ return (React__default["default"].createElement("div", { className: 'str-chat__message--system', "data-testid": 'message-system' },
35271
+ React__default["default"].createElement("div", { className: 'str-chat__message--system__text' },
35272
+ React__default["default"].createElement("div", { className: 'str-chat__message--system__line' }),
35273
+ React__default["default"].createElement("p", null, text),
35274
+ React__default["default"].createElement("div", { className: 'str-chat__message--system__line' })),
35275
+ React__default["default"].createElement("div", { className: 'str-chat__message--system__date' },
35276
+ React__default["default"].createElement("strong", null,
35277
+ getDateString(icons.__assign(icons.__assign({}, getDateOptions), { format: 'dddd' })),
35278
+ " "),
35279
+ "at ",
35280
+ getDateString(icons.__assign(icons.__assign({}, getDateOptions), { format: 'hh:mm A' })))));
35281
+ if ((event === null || event === void 0 ? void 0 : event.type) === 'member.removed' || (event === null || event === void 0 ? void 0 : event.type) === 'member.added') {
35282
+ var name_1 = ((_a = event.user) === null || _a === void 0 ? void 0 : _a.name) || ((_b = event.user) === null || _b === void 0 ? void 0 : _b.id);
35283
+ var sentence = "".concat(name_1, " ").concat(event.type === 'member.added' ? 'has joined the chat' : 'was removed from the chat');
35284
+ return (React__default["default"].createElement("div", { className: 'str-chat__event-component__channel-event' },
35285
+ React__default["default"].createElement(Avatar$1, { image: (_c = event.user) === null || _c === void 0 ? void 0 : _c.image, name: name_1, user: event.user }),
35286
+ React__default["default"].createElement("div", { className: 'str-chat__event-component__channel-event__content' },
35287
+ React__default["default"].createElement("em", { className: 'str-chat__event-component__channel-event__sentence' }, sentence),
35288
+ React__default["default"].createElement("div", { className: 'str-chat__event-component__channel-event__date' }, getDateString(icons.__assign(icons.__assign({}, getDateOptions), { format: 'LT' }))))));
35289
+ }
35290
+ return null;
35291
+ };
35292
+ var EventComponent = React__default["default"].memo(UnMemoizedEventComponent);
35293
+
35294
+ var UnMemoizedDateSeparator = function (props) {
35295
+ var messageCreatedAt = props.date, formatDate = props.formatDate, _a = props.position, position = _a === void 0 ? 'right' : _a, unread = props.unread;
35296
+ var _b = icons.useTranslationContext('DateSeparator'), t = _b.t, tDateTimeParser = _b.tDateTimeParser;
35297
+ var formattedDate = getDateString({
35298
+ calendar: true,
35299
+ formatDate: formatDate,
35300
+ messageCreatedAt: messageCreatedAt,
35301
+ tDateTimeParser: tDateTimeParser,
35302
+ });
35303
+ return (React__default["default"].createElement("div", { className: 'str-chat__date-separator', "data-testid": 'date-separator' },
35304
+ (position === 'right' || position === 'center') && (React__default["default"].createElement("hr", { className: 'str-chat__date-separator-line' })),
35305
+ React__default["default"].createElement("div", { className: 'str-chat__date-separator-date' }, unread ? "".concat(t('New'), " - ").concat(formattedDate) : formattedDate),
35306
+ (position === 'left' || position === 'center') && (React__default["default"].createElement("hr", { className: 'str-chat__date-separator-line' }))));
35307
+ };
35308
+ /**
35309
+ * A simple date separator between messages.
35310
+ */
35311
+ var DateSeparator = React__default["default"].memo(UnMemoizedDateSeparator);
35312
+
35313
+ var isUserResponseArray = function (output) { var _a; return ((_a = output[0]) === null || _a === void 0 ? void 0 : _a.id) != null; };
35248
35314
  var UnMemoizedChannel = function (props) {
35249
35315
  var propsChannel = props.channel, _a = props.EmptyPlaceholder, EmptyPlaceholder = _a === void 0 ? null : _a, LoadingErrorIndicator = props.LoadingErrorIndicator, _b = props.LoadingIndicator, LoadingIndicator = _b === void 0 ? LoadingChannel : _b;
35250
35316
  var _c = icons.useChatContext('Channel'), contextChannel = _c.channel, channelsQueryState = _c.channelsQueryState, customClasses = _c.customClasses, theme = _c.theme;
@@ -35466,6 +35532,7 @@ var ChannelInner = function (props) {
35466
35532
  client.off('user.deleted', handleEvent);
35467
35533
  notificationTimeouts.forEach(clearTimeout);
35468
35534
  };
35535
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35469
35536
  }, [
35470
35537
  channel.cid,
35471
35538
  channelQueryOptions,
@@ -35484,14 +35551,12 @@ var ChannelInner = function (props) {
35484
35551
  /** MESSAGE */
35485
35552
  // Adds a temporary notification to message list, will be removed after 5 seconds
35486
35553
  var addNotification = makeAddNotifications(setNotifications, notificationTimeouts);
35487
- var loadMoreFinished = debounce__default["default"](function (hasMore, messages) {
35554
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35555
+ var loadMoreFinished = React.useCallback(debounce__default["default"](function (hasMore, messages) {
35488
35556
  if (!isMounted.current)
35489
35557
  return;
35490
35558
  dispatch({ hasMore: hasMore, messages: messages, type: 'loadMoreFinished' });
35491
- }, 2000, {
35492
- leading: true,
35493
- trailing: true,
35494
- });
35559
+ }, 2000, { leading: true, trailing: true }), []);
35495
35560
  var loadMore = function (limit) {
35496
35561
  if (limit === void 0) { limit = DEFAULT_NEXT_CHANNEL_PAGE_SIZE; }
35497
35562
  return icons.__awaiter(void 0, void 0, void 0, function () {
@@ -35535,12 +35600,12 @@ var ChannelInner = function (props) {
35535
35600
  var loadMoreNewer = function (limit) {
35536
35601
  if (limit === void 0) { limit = 100; }
35537
35602
  return icons.__awaiter(void 0, void 0, void 0, function () {
35538
- var newestMessage, newestId, perPage, queryResponse, e_3, hasMoreNewer;
35603
+ var newestMessage, newestId, perPage, queryResponse, e_3, hasMoreNewerMessages;
35539
35604
  var _a, _b;
35540
35605
  return icons.__generator(this, function (_c) {
35541
35606
  switch (_c.label) {
35542
35607
  case 0:
35543
- if (!online.current || !window.navigator.onLine)
35608
+ if (!online.current || !window.navigator.onLine || !state.hasMoreNewer)
35544
35609
  return [2 /*return*/, 0];
35545
35610
  newestMessage = (_a = state === null || state === void 0 ? void 0 : state.messages) === null || _a === void 0 ? void 0 : _a[((_b = state === null || state === void 0 ? void 0 : state.messages) === null || _b === void 0 ? void 0 : _b.length) - 1];
35546
35611
  if (state.loadingMore || state.loadingMoreNewer)
@@ -35564,8 +35629,12 @@ var ChannelInner = function (props) {
35564
35629
  dispatch({ loadingMoreNewer: false, type: 'setLoadingMoreNewer' });
35565
35630
  return [2 /*return*/, 0];
35566
35631
  case 4:
35567
- hasMoreNewer = channel.state.messages !== channel.state.latestMessages;
35568
- dispatch({ hasMoreNewer: hasMoreNewer, messages: channel.state.messages, type: 'loadMoreNewerFinished' });
35632
+ hasMoreNewerMessages = channel.state.messages !== channel.state.latestMessages;
35633
+ dispatch({
35634
+ hasMoreNewer: hasMoreNewerMessages,
35635
+ messages: channel.state.messages,
35636
+ type: 'loadMoreNewerFinished',
35637
+ });
35569
35638
  return [2 /*return*/, queryResponse.messages.length];
35570
35639
  }
35571
35640
  });
@@ -35650,7 +35719,6 @@ var ChannelInner = function (props) {
35650
35719
  type: 'copyMessagesFromChannel',
35651
35720
  });
35652
35721
  };
35653
- var isUserResponseArray = function (output) { var _a; return ((_a = output[0]) === null || _a === void 0 ? void 0 : _a.id) != null; };
35654
35722
  var doSendMessage = function (message, customMessageData, options) { return icons.__awaiter(void 0, void 0, void 0, function () {
35655
35723
  var attachments, id, _a, mentioned_users, parent_id, text, mentions, messageData, messageResponse, existingMessage, i, msg, responseTimestamp, existingMessageTimestamp, responseIsTheNewest, error_1, stringError, parsedError;
35656
35724
  var _b, _c;
@@ -35770,17 +35838,18 @@ var ChannelInner = function (props) {
35770
35838
  event === null || event === void 0 ? void 0 : event.preventDefault();
35771
35839
  dispatch({ type: 'closeThread' });
35772
35840
  };
35773
- var loadMoreThreadFinished = debounce__default["default"](function (threadHasMore, threadMessages) {
35841
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35842
+ var loadMoreThreadFinished = React.useCallback(debounce__default["default"](function (threadHasMore, threadMessages) {
35774
35843
  dispatch({
35775
35844
  threadHasMore: threadHasMore,
35776
35845
  threadMessages: threadMessages,
35777
35846
  type: 'loadMoreThreadFinished',
35778
35847
  });
35779
- }, 2000, { leading: true, trailing: true });
35848
+ }, 2000, { leading: true, trailing: true }), []);
35780
35849
  var loadMoreThread = function (limit) {
35781
35850
  if (limit === void 0) { limit = DEFAULT_THREAD_PAGE_SIZE; }
35782
35851
  return icons.__awaiter(void 0, void 0, void 0, function () {
35783
- var parentID, oldMessages, oldestMessageID, queryResponse, threadHasMoreMessages, newThreadMessages;
35852
+ var parentId, oldMessages, oldestMessageId, queryResponse, threadHasMoreMessages, newThreadMessages;
35784
35853
  var _a;
35785
35854
  return icons.__generator(this, function (_b) {
35786
35855
  switch (_b.label) {
@@ -35789,23 +35858,23 @@ var ChannelInner = function (props) {
35789
35858
  if (state.threadLoadingMore || !state.thread)
35790
35859
  return [2 /*return*/];
35791
35860
  dispatch({ type: 'startLoadingThread' });
35792
- parentID = state.thread.id;
35793
- if (!parentID) {
35861
+ parentId = state.thread.id;
35862
+ if (!parentId) {
35794
35863
  return [2 /*return*/, dispatch({ type: 'closeThread' })];
35795
35864
  }
35796
- oldMessages = channel.state.threads[parentID] || [];
35797
- oldestMessageID = (_a = oldMessages[0]) === null || _a === void 0 ? void 0 : _a.id;
35865
+ oldMessages = channel.state.threads[parentId] || [];
35866
+ oldestMessageId = (_a = oldMessages[0]) === null || _a === void 0 ? void 0 : _a.id;
35798
35867
  _b.label = 1;
35799
35868
  case 1:
35800
35869
  _b.trys.push([1, 3, , 4]);
35801
- return [4 /*yield*/, channel.getReplies(parentID, {
35802
- id_lt: oldestMessageID,
35870
+ return [4 /*yield*/, channel.getReplies(parentId, {
35871
+ id_lt: oldestMessageId,
35803
35872
  limit: limit,
35804
35873
  })];
35805
35874
  case 2:
35806
35875
  queryResponse = _b.sent();
35807
35876
  threadHasMoreMessages = hasMoreMessagesProbably(queryResponse.messages.length, limit);
35808
- newThreadMessages = channel.state.threads[parentID] || [];
35877
+ newThreadMessages = channel.state.threads[parentId] || [];
35809
35878
  // next set loadingMore to false so we can start asking for more data
35810
35879
  loadMoreThreadFinished(threadHasMoreMessages, newThreadMessages);
35811
35880
  return [3 /*break*/, 4];
@@ -35842,7 +35911,9 @@ var ChannelInner = function (props) {
35842
35911
  setQuotedMessage: setQuotedMessage,
35843
35912
  skipMessageDataMemoization: skipMessageDataMemoization,
35844
35913
  updateMessage: updateMessage,
35845
- }); }, [
35914
+ }); },
35915
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35916
+ [
35846
35917
  channel.cid,
35847
35918
  deleteMessage,
35848
35919
  enrichURLForPreviewConfig === null || enrichURLForPreviewConfig === void 0 ? void 0 : enrichURLForPreviewConfig.findURLFn,
@@ -35864,7 +35935,8 @@ var ChannelInner = function (props) {
35864
35935
  Avatar: props.Avatar,
35865
35936
  BaseImage: props.BaseImage,
35866
35937
  CooldownTimer: props.CooldownTimer,
35867
- DateSeparator: props.DateSeparator,
35938
+ CustomMessageActionsList: props.CustomMessageActionsList,
35939
+ DateSeparator: props.DateSeparator || DateSeparator,
35868
35940
  EditMessageInput: props.EditMessageInput,
35869
35941
  EmojiPicker: props.EmojiPicker,
35870
35942
  emojiSearchIndex: props.emojiSearchIndex,
@@ -35882,7 +35954,7 @@ var ChannelInner = function (props) {
35882
35954
  MessageOptions: props.MessageOptions,
35883
35955
  MessageRepliesCountButton: props.MessageRepliesCountButton,
35884
35956
  MessageStatus: props.MessageStatus,
35885
- MessageSystem: props.MessageSystem,
35957
+ MessageSystem: props.MessageSystem || EventComponent,
35886
35958
  MessageTimestamp: props.MessageTimestamp,
35887
35959
  ModalGallery: props.ModalGallery,
35888
35960
  PinIndicator: props.PinIndicator,
@@ -35899,7 +35971,9 @@ var ChannelInner = function (props) {
35899
35971
  TypingIndicator: props.TypingIndicator,
35900
35972
  VirtualMessage: props.VirtualMessage,
35901
35973
  });
35902
- }, [props.reactionOptions]);
35974
+ },
35975
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35976
+ [props.reactionOptions]);
35903
35977
  var typingContextValue = useCreateTypingContext({
35904
35978
  typing: typing,
35905
35979
  });
@@ -36013,6 +36087,7 @@ var useChannelPreviewInfo = function (props) {
36013
36087
  return function () {
36014
36088
  client.off('user.updated', handleEvent);
36015
36089
  };
36090
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36016
36091
  }, []);
36017
36092
  return {
36018
36093
  displayImage: overrideImage || displayImage,
@@ -36113,6 +36188,7 @@ var useChannelDeletedListener = function (setChannels, customHandler) {
36113
36188
  return function () {
36114
36189
  client.off('channel.deleted', handleEvent);
36115
36190
  };
36191
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36116
36192
  }, [customHandler]);
36117
36193
  };
36118
36194
 
@@ -36138,6 +36214,7 @@ var useChannelHiddenListener = function (setChannels, customHandler) {
36138
36214
  return function () {
36139
36215
  client.off('channel.hidden', handleEvent);
36140
36216
  };
36217
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36141
36218
  }, [customHandler]);
36142
36219
  };
36143
36220
 
@@ -36157,6 +36234,7 @@ var useChannelTruncatedListener = function (setChannels, customHandler, forceUpd
36157
36234
  return function () {
36158
36235
  client.off('channel.truncated', handleEvent);
36159
36236
  };
36237
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36160
36238
  }, [customHandler]);
36161
36239
  };
36162
36240
 
@@ -36185,6 +36263,7 @@ var useChannelUpdatedListener = function (setChannels, customHandler, forceUpdat
36185
36263
  return function () {
36186
36264
  client.off('channel.updated', handleEvent);
36187
36265
  };
36266
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36188
36267
  }, [customHandler]);
36189
36268
  };
36190
36269
 
@@ -36218,6 +36297,7 @@ var useChannelVisibleListener = function (setChannels, customHandler) {
36218
36297
  return function () {
36219
36298
  client.off('channel.visible', handleEvent);
36220
36299
  };
36300
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36221
36301
  }, [customHandler]);
36222
36302
  };
36223
36303
 
@@ -36233,6 +36313,7 @@ var useConnectionRecoveredListener = function (forceUpdate) {
36233
36313
  return function () {
36234
36314
  client.off('connection.recovered', handleEvent);
36235
36315
  };
36316
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36236
36317
  }, []);
36237
36318
  };
36238
36319
 
@@ -36274,6 +36355,7 @@ var useMessageNewListener = function (setChannels, customHandler, lockChannelOrd
36274
36355
  return function () {
36275
36356
  client.off('message.new', handleEvent);
36276
36357
  };
36358
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36277
36359
  }, [lockChannelOrder]);
36278
36360
  };
36279
36361
 
@@ -36334,6 +36416,7 @@ var useNotificationAddedToChannelListener = function (setChannels, customHandler
36334
36416
  return function () {
36335
36417
  client.off('notification.added_to_channel', handleEvent);
36336
36418
  };
36419
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36337
36420
  }, [customHandler]);
36338
36421
  };
36339
36422
 
@@ -36369,6 +36452,7 @@ var useNotificationMessageNewListener = function (setChannels, customHandler, al
36369
36452
  return function () {
36370
36453
  client.off('notification.message_new', handleEvent);
36371
36454
  };
36455
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36372
36456
  }, [customHandler]);
36373
36457
  };
36374
36458
 
@@ -36387,6 +36471,7 @@ var useNotificationRemovedFromChannelListener = function (setChannels, customHan
36387
36471
  return function () {
36388
36472
  client.off('notification.removed_from_channel', handleEvent);
36389
36473
  };
36474
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36390
36475
  }, [customHandler]);
36391
36476
  };
36392
36477
 
@@ -36406,6 +36491,7 @@ var usePaginatedChannels = function (client, filters, sort, options, activeChann
36406
36491
  // memoize props
36407
36492
  var filterString = React.useMemo(function () { return JSON.stringify(filters); }, [filters]);
36408
36493
  var sortString = React.useMemo(function () { return JSON.stringify(sort); }, [sort]);
36494
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36409
36495
  var queryChannels = function (queryType) { return icons.__awaiter(void 0, void 0, void 0, function () {
36410
36496
  var offset, newOptions, channelQueryResponse, newChannels, err_1;
36411
36497
  var _a;
@@ -36474,6 +36560,7 @@ var usePaginatedChannels = function (client, filters, sort, options, activeChann
36474
36560
  }, [client, throttleRecover]);
36475
36561
  React.useEffect(function () {
36476
36562
  queryChannels('reload');
36563
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36477
36564
  }, [filterString, sortString]);
36478
36565
  return {
36479
36566
  channels: channels,
@@ -36504,6 +36591,7 @@ var useUserPresenceChangedListener = function (setChannels) {
36504
36591
  return function () {
36505
36592
  client.off('user.presence.changed', handleEvent);
36506
36593
  };
36594
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36507
36595
  }, []);
36508
36596
  };
36509
36597
 
@@ -36546,6 +36634,7 @@ var useIsChannelMuted = function (channel) {
36546
36634
  var handleEvent = function () { return setMuted(channel.muteStatus()); };
36547
36635
  client.on('notification.channel_mutes_updated', handleEvent);
36548
36636
  return function () { return client.off('notification.channel_mutes_updated', handleEvent); };
36637
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36549
36638
  }, [muted]);
36550
36639
  return muted;
36551
36640
  };
@@ -36629,6 +36718,7 @@ var ChannelPreview = function (props) {
36629
36718
  };
36630
36719
  client.on('notification.mark_read', handleEvent);
36631
36720
  return function () { return client.off('notification.mark_read', handleEvent); };
36721
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36632
36722
  }, []);
36633
36723
  var refreshUnreadCount = React.useCallback(function () {
36634
36724
  if (isActive || muted) {
@@ -36653,6 +36743,7 @@ var ChannelPreview = function (props) {
36653
36743
  channel.off('message.updated', handleEvent);
36654
36744
  channel.off('message.deleted', handleEvent);
36655
36745
  };
36746
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36656
36747
  }, [refreshUnreadCount, channelUpdateCount]);
36657
36748
  if (!Preview)
36658
36749
  return null;
@@ -36709,6 +36800,7 @@ var useChannelSearch = function (_a) {
36709
36800
  };
36710
36801
  document.addEventListener('click', clickListener);
36711
36802
  return function () { return document.removeEventListener('click', clickListener); };
36803
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36712
36804
  }, [disabled, inputIsFocused, query, exitSearch, clearSearchOnClickOutside]);
36713
36805
  React.useEffect(function () {
36714
36806
  if (!inputRef.current || disabled)
@@ -36720,8 +36812,10 @@ var useChannelSearch = function (_a) {
36720
36812
  inputRef.current.addEventListener('keydown', handleKeyDown);
36721
36813
  return function () {
36722
36814
  var _a;
36815
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36723
36816
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', handleKeyDown);
36724
36817
  };
36818
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36725
36819
  }, [disabled]);
36726
36820
  var selectResult = React.useCallback(function (result) { return icons.__awaiter(void 0, void 0, void 0, function () {
36727
36821
  var selectedChannel, newChannel;
@@ -36760,7 +36854,9 @@ var useChannelSearch = function (_a) {
36760
36854
  return [2 /*return*/];
36761
36855
  }
36762
36856
  });
36763
- }); }, [clearSearchOnClickOutside, client, exitSearch, onSelectResult, setActiveChannel, setChannels]);
36857
+ }); },
36858
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36859
+ [clearSearchOnClickOutside, client, exitSearch, onSelectResult, setActiveChannel, setChannels]);
36764
36860
  var getChannels = React.useCallback(function (text) { return icons.__awaiter(void 0, void 0, void 0, function () {
36765
36861
  var results, userQueryPromise, users, channelQueryPromise, _a, channels, users, error_1;
36766
36862
  var _b, _c, _d, _e, _f, _g;
@@ -36808,6 +36904,7 @@ var useChannelSearch = function (_a) {
36808
36904
  }
36809
36905
  });
36810
36906
  }); }, [client, searchForChannels, searchQueryParams]);
36907
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36811
36908
  var scheduleGetChannels = React.useCallback(debounce__default["default"](getChannels, searchDebounceIntervalMs), [
36812
36909
  getChannels,
36813
36910
  searchDebounceIntervalMs,
@@ -36915,11 +37012,13 @@ var SearchBar = function (props) {
36915
37012
  (_a = props.inputRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('focus', handleFocus);
36916
37013
  (_b = props.inputRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('blur', handleBlur);
36917
37014
  };
37015
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36918
37016
  }, []);
36919
37017
  var handleClearClick = React.useCallback(function () {
36920
37018
  var _a;
36921
37019
  exitSearch();
36922
37020
  (_a = inputProps.inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
37021
+ // eslint-disable-next-line react-hooks/exhaustive-deps
36923
37022
  }, []);
36924
37023
  var closeAppMenu = React.useCallback(function () { return setMenuIsOpen(false); }, []);
36925
37024
  return (React__default["default"].createElement("div", { className: 'str-chat__channel-search-bar', "data-testid": 'search-bar', ref: searchBarRef },
@@ -37001,7 +37100,9 @@ var SearchResults = function (props) {
37001
37100
  return setFocusedResult(undefined);
37002
37101
  }
37003
37102
  }
37004
- }, [focusedResult]);
37103
+ },
37104
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37105
+ [focusedResult]);
37005
37106
  React.useEffect(function () {
37006
37107
  document.addEventListener('keydown', handleKeyDown, false);
37007
37108
  return function () { return document.removeEventListener('keydown', handleKeyDown); };
@@ -37082,6 +37183,7 @@ var UnMemoizedLoadMoreButton = function (_a) {
37082
37183
  var loading = typeof isLoading !== 'undefined' ? isLoading : refreshing;
37083
37184
  React.useEffect(function () {
37084
37185
  deprecationAndReplacementWarning([[{ refreshing: refreshing }, { isLoading: isLoading }]], 'LoadMoreButton');
37186
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37085
37187
  }, []);
37086
37188
  return (React__default["default"].createElement("div", { className: 'str-chat__load-more-button' },
37087
37189
  React__default["default"].createElement("button", { "aria-label": 'Load More Channels', className: 'str-chat__load-more-button__button str-chat__cta-button', "data-testid": 'load-more-button', disabled: loading, onClick: onClick }, loading ? React__default["default"].createElement(LoadingIndicator, null) : childrenOrDefaultString)));
@@ -37093,6 +37195,7 @@ var UnMemoizedLoadMorePaginator = function (props) {
37093
37195
  var loadingState = typeof isLoading !== 'undefined' ? isLoading : refreshing;
37094
37196
  React.useEffect(function () {
37095
37197
  deprecationAndReplacementWarning([[{ refreshing: refreshing }, { isLoading: isLoading }]], 'LoadMorePaginator');
37198
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37096
37199
  }, []);
37097
37200
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
37098
37201
  !reverse && children,
@@ -37164,11 +37267,13 @@ var UnMemoizedChannelList = function (props) {
37164
37267
  setSearchActive(true);
37165
37268
  }
37166
37269
  (_a = additionalChannelSearchProps === null || additionalChannelSearchProps === void 0 ? void 0 : additionalChannelSearchProps.onSearch) === null || _a === void 0 ? void 0 : _a.call(additionalChannelSearchProps, event);
37270
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37167
37271
  }, []);
37168
37272
  var onSearchExit = React.useCallback(function () {
37169
37273
  var _a;
37170
37274
  setSearchActive(false);
37171
37275
  (_a = additionalChannelSearchProps === null || additionalChannelSearchProps === void 0 ? void 0 : additionalChannelSearchProps.onSearchExit) === null || _a === void 0 ? void 0 : _a.call(additionalChannelSearchProps);
37276
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37172
37277
  }, []);
37173
37278
  var _u = usePaginatedChannels(client, filters || DEFAULT_FILTERS, sort || DEFAULT_SORT, options || DEFAULT_OPTIONS, activeChannelHandler, recoveryThrottleIntervalMs), channels = _u.channels, hasNextPage = _u.hasNextPage, loadNextPage = _u.loadNextPage, setChannels = _u.setChannels;
37174
37279
  var loadedChannels = channelRenderFilterFn ? channelRenderFilterFn(channels) : channels;
@@ -37196,6 +37301,7 @@ var UnMemoizedChannelList = function (props) {
37196
37301
  client.off('channel.deleted', handleEvent);
37197
37302
  client.off('channel.hidden', handleEvent);
37198
37303
  };
37304
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37199
37305
  }, [channel === null || channel === void 0 ? void 0 : channel.cid]);
37200
37306
  var renderChannel = function (item) {
37201
37307
  var previewProps = {
@@ -37229,7 +37335,7 @@ var UnMemoizedChannelList = function (props) {
37229
37335
  */
37230
37336
  var ChannelList = React__default["default"].memo(UnMemoizedChannelList);
37231
37337
 
37232
- var version = '11.2.1';
37338
+ var version = '11.4.0';
37233
37339
 
37234
37340
  var useChat = function (_a) {
37235
37341
  var _b, _c;
@@ -37271,6 +37377,7 @@ var useChat = function (_a) {
37271
37377
  };
37272
37378
  client.on('notification.mutes_updated', handleEvent);
37273
37379
  return function () { return client.off('notification.mutes_updated', handleEvent); };
37380
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37274
37381
  }, [clientMutes === null || clientMutes === void 0 ? void 0 : clientMutes.length]);
37275
37382
  React.useEffect(function () {
37276
37383
  var _a;
@@ -37286,6 +37393,7 @@ var useChat = function (_a) {
37286
37393
  streami18n.getTranslators().then(function (translator) {
37287
37394
  setTranslators(icons.__assign(icons.__assign({}, translator), { userLanguage: userLanguage || defaultLanguage }));
37288
37395
  });
37396
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37289
37397
  }, [i18nInstance]);
37290
37398
  var setActiveChannel = React.useCallback(function (activeChannel, watchers, event) {
37291
37399
  if (watchers === void 0) { watchers = {}; }
@@ -37347,7 +37455,9 @@ var useCreateChatContext = function (value) {
37347
37455
  theme: theme,
37348
37456
  themeVersion: themeVersion,
37349
37457
  useImageFlagEmojisOnWindows: useImageFlagEmojisOnWindows,
37350
- }); }, [
37458
+ }); },
37459
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37460
+ [
37351
37461
  channelCid,
37352
37462
  channelsQueryError,
37353
37463
  channelsQueryInProgress,
@@ -37444,59 +37554,6 @@ var Chat = function (props) {
37444
37554
  React__default["default"].createElement(icons.TranslationProvider, { value: translators }, children)));
37445
37555
  };
37446
37556
 
37447
- var UnMemoizedDateSeparator = function (props) {
37448
- var messageCreatedAt = props.date, formatDate = props.formatDate, _a = props.position, position = _a === void 0 ? 'right' : _a, unread = props.unread;
37449
- var _b = icons.useTranslationContext('DateSeparator'), t = _b.t, tDateTimeParser = _b.tDateTimeParser;
37450
- var formattedDate = getDateString({
37451
- calendar: true,
37452
- formatDate: formatDate,
37453
- messageCreatedAt: messageCreatedAt,
37454
- tDateTimeParser: tDateTimeParser,
37455
- });
37456
- return (React__default["default"].createElement("div", { className: 'str-chat__date-separator', "data-testid": 'date-separator' },
37457
- (position === 'right' || position === 'center') && (React__default["default"].createElement("hr", { className: 'str-chat__date-separator-line' })),
37458
- React__default["default"].createElement("div", { className: 'str-chat__date-separator-date' }, unread ? "".concat(t('New'), " - ").concat(formattedDate) : formattedDate),
37459
- (position === 'left' || position === 'center') && (React__default["default"].createElement("hr", { className: 'str-chat__date-separator-line' }))));
37460
- };
37461
- /**
37462
- * A simple date separator between messages.
37463
- */
37464
- var DateSeparator = React__default["default"].memo(UnMemoizedDateSeparator);
37465
-
37466
- /**
37467
- * Component to display system and channel event messages
37468
- */
37469
- var UnMemoizedEventComponent = function (props) {
37470
- var _a, _b, _c;
37471
- var _d = props.Avatar, Avatar$1 = _d === void 0 ? Avatar : _d, message = props.message;
37472
- var tDateTimeParser = icons.useTranslationContext('EventComponent').tDateTimeParser;
37473
- var _e = message.created_at, created_at = _e === void 0 ? '' : _e, event = message.event, text = message.text, type = message.type;
37474
- var getDateOptions = { messageCreatedAt: created_at.toString(), tDateTimeParser: tDateTimeParser };
37475
- if (type === 'system')
37476
- return (React__default["default"].createElement("div", { className: 'str-chat__message--system', "data-testid": 'message-system' },
37477
- React__default["default"].createElement("div", { className: 'str-chat__message--system__text' },
37478
- React__default["default"].createElement("div", { className: 'str-chat__message--system__line' }),
37479
- React__default["default"].createElement("p", null, text),
37480
- React__default["default"].createElement("div", { className: 'str-chat__message--system__line' })),
37481
- React__default["default"].createElement("div", { className: 'str-chat__message--system__date' },
37482
- React__default["default"].createElement("strong", null,
37483
- getDateString(icons.__assign(icons.__assign({}, getDateOptions), { format: 'dddd' })),
37484
- " "),
37485
- "at ",
37486
- getDateString(icons.__assign(icons.__assign({}, getDateOptions), { format: 'hh:mm A' })))));
37487
- if ((event === null || event === void 0 ? void 0 : event.type) === 'member.removed' || (event === null || event === void 0 ? void 0 : event.type) === 'member.added') {
37488
- var name_1 = ((_a = event.user) === null || _a === void 0 ? void 0 : _a.name) || ((_b = event.user) === null || _b === void 0 ? void 0 : _b.id);
37489
- var sentence = "".concat(name_1, " ").concat(event.type === 'member.added' ? 'has joined the chat' : 'was removed from the chat');
37490
- return (React__default["default"].createElement("div", { className: 'str-chat__event-component__channel-event' },
37491
- React__default["default"].createElement(Avatar$1, { image: (_c = event.user) === null || _c === void 0 ? void 0 : _c.image, name: name_1, user: event.user }),
37492
- React__default["default"].createElement("div", { className: 'str-chat__event-component__channel-event__content' },
37493
- React__default["default"].createElement("em", { className: 'str-chat__event-component__channel-event__sentence' }, sentence),
37494
- React__default["default"].createElement("div", { className: 'str-chat__event-component__channel-event__date' }, getDateString(icons.__assign(icons.__assign({}, getDateOptions), { format: 'LT' }))))));
37495
- }
37496
- return null;
37497
- };
37498
- var EventComponent = React__default["default"].memo(UnMemoizedEventComponent);
37499
-
37500
37557
  /**
37501
37558
  * Prevents Chrome hangups
37502
37559
  * See: https://stackoverflow.com/questions/47524205/random-high-content-download-time-in-chrome/47684257#47684257
@@ -37552,6 +37609,7 @@ var InfiniteScroll = function (props) {
37552
37609
  [{ hasMore: hasMore }, { hasPreviousPage: hasPreviousPage }],
37553
37610
  [{ loadMore: loadMore }, { loadPreviousPage: loadPreviousPage }],
37554
37611
  ], 'InfiniteScroll');
37612
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37555
37613
  }, []);
37556
37614
  React.useLayoutEffect(function () {
37557
37615
  var _a;
@@ -37905,7 +37963,9 @@ var useReactionHandler = function (message) {
37905
37963
  var newOwnReactions = add
37906
37964
  ? icons.__spreadArray([reaction], ((message === null || message === void 0 ? void 0 : message.own_reactions) || []), true) : (_b = message === null || message === void 0 ? void 0 : message.own_reactions) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return item.type !== reaction.type; });
37907
37965
  return icons.__assign(icons.__assign({}, message), { latest_reactions: newReactions || message.latest_reactions, own_reactions: newOwnReactions, reaction_counts: newReactionCounts, reaction_scores: newReactionCounts });
37908
- }, [client.user, client.userID]);
37966
+ },
37967
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37968
+ [client.user, client.userID]);
37909
37969
  var createReactionPreview = function (type) {
37910
37970
  var _a;
37911
37971
  return ({
@@ -38011,7 +38071,9 @@ var useReactionClick = function (message, reactionSelectorRef, messageWrapperRef
38011
38071
  return;
38012
38072
  }
38013
38073
  setShowDetailedReactions(false);
38014
- }, [setShowDetailedReactions, reactionSelectorRef]);
38074
+ },
38075
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38076
+ [setShowDetailedReactions, reactionSelectorRef]);
38015
38077
  React.useEffect(function () {
38016
38078
  var messageWrapper = messageWrapperRef === null || messageWrapperRef === void 0 ? void 0 : messageWrapperRef.current;
38017
38079
  if (showDetailedReactions && !hasListener.current) {
@@ -38290,7 +38352,9 @@ var useEnrichedMessages = function (args) {
38290
38352
  acc[message.id] = style;
38291
38353
  return acc;
38292
38354
  }, {});
38293
- }, [messagesWithDates, noGroupByUser]);
38355
+ },
38356
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38357
+ [messagesWithDates, noGroupByUser]);
38294
38358
  return { messageGroupStyles: messageGroupStyles, messages: messagesWithDates };
38295
38359
  };
38296
38360
 
@@ -38305,9 +38369,9 @@ var useLastReadData = function (props) {
38305
38369
  };
38306
38370
 
38307
38371
  var useMessageListElements = function (props) {
38308
- var enrichedMessages = props.enrichedMessages, internalMessageProps = props.internalMessageProps, messageGroupStyles = props.messageGroupStyles, read = props.read, returnAllReadData = props.returnAllReadData, threadList = props.threadList;
38372
+ var enrichedMessages = props.enrichedMessages, internalMessageProps = props.internalMessageProps, messageGroupStyles = props.messageGroupStyles, read = props.read, renderMessages = props.renderMessages, returnAllReadData = props.returnAllReadData, threadList = props.threadList;
38309
38373
  var _a = icons.useChatContext('useMessageListElements'), client = _a.client, customClasses = _a.customClasses;
38310
- var _b = icons.useComponentContext('useMessageListElements'), _c = _b.DateSeparator, DateSeparator$1 = _c === void 0 ? DateSeparator : _c, HeaderComponent = _b.HeaderComponent, _d = _b.MessageSystem, MessageSystem = _d === void 0 ? EventComponent : _d;
38374
+ var components = icons.useComponentContext('useMessageListElements');
38311
38375
  // get the readData, but only for messages submitted by the user themselves
38312
38376
  var readData = useLastReadData({
38313
38377
  messages: enrichedMessages,
@@ -38315,34 +38379,28 @@ var useMessageListElements = function (props) {
38315
38379
  returnAllReadData: returnAllReadData,
38316
38380
  userID: client.userID,
38317
38381
  });
38318
- var lastReceivedId = React.useMemo(function () { return getLastReceived(enrichedMessages); }, [enrichedMessages]);
38382
+ var lastReceivedMessageId = React.useMemo(function () { return getLastReceived(enrichedMessages); }, [
38383
+ enrichedMessages,
38384
+ ]);
38319
38385
  var elements = React.useMemo(function () {
38320
- return enrichedMessages.map(function (message) {
38321
- if (message.customType === CUSTOM_MESSAGE_TYPE.date &&
38322
- message.date &&
38323
- icons.isDate(message.date)) {
38324
- return (React__default["default"].createElement("li", { key: "".concat(message.date.toISOString(), "-i") },
38325
- React__default["default"].createElement(DateSeparator$1, { date: message.date, formatDate: internalMessageProps.formatDate, unread: message.unread })));
38326
- }
38327
- if (message.customType === CUSTOM_MESSAGE_TYPE.intro && HeaderComponent) {
38328
- return (React__default["default"].createElement("li", { key: 'intro' },
38329
- React__default["default"].createElement(HeaderComponent, null)));
38330
- }
38331
- if (message.type === 'system') {
38332
- return (React__default["default"].createElement("li", { key: message.id || message.created_at },
38333
- React__default["default"].createElement(MessageSystem, { message: message })));
38334
- }
38335
- var groupStyles = messageGroupStyles[message.id] || '';
38336
- var messageClass = (customClasses === null || customClasses === void 0 ? void 0 : customClasses.message) || "str-chat__li str-chat__li--".concat(groupStyles);
38337
- return (React__default["default"].createElement("li", { className: messageClass, "data-message-id": message.id, "data-testid": messageClass, key: message.id || message.created_at },
38338
- React__default["default"].createElement(Message, icons.__assign({ groupStyles: [groupStyles], lastReceivedId: lastReceivedId, message: message, readBy: readData[message.id] || [], threadList: threadList }, internalMessageProps))));
38386
+ return renderMessages({
38387
+ components: components,
38388
+ customClasses: customClasses,
38389
+ lastReceivedMessageId: lastReceivedMessageId,
38390
+ messageGroupStyles: messageGroupStyles,
38391
+ messages: enrichedMessages,
38392
+ readData: readData,
38393
+ sharedMessageProps: icons.__assign(icons.__assign({}, internalMessageProps), { threadList: threadList }),
38339
38394
  });
38340
- }, [
38395
+ },
38396
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38397
+ [
38341
38398
  enrichedMessages,
38342
38399
  internalMessageProps,
38343
- lastReceivedId,
38400
+ lastReceivedMessageId,
38344
38401
  messageGroupStyles,
38345
38402
  readData,
38403
+ renderMessages,
38346
38404
  threadList,
38347
38405
  ]);
38348
38406
  return elements;
@@ -38399,6 +38457,7 @@ function useMessageListScrollManager(params) {
38399
38457
  }
38400
38458
  messages.current = newMessages;
38401
38459
  measures.current = newMeasures;
38460
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38402
38461
  }, [measures, messages, params.messages]);
38403
38462
  return function (scrollTopValue) {
38404
38463
  scrollTop.current = scrollTopValue;
@@ -38428,6 +38487,7 @@ var useScrollLocationLogic = function (params) {
38428
38487
  setWrapperRect(listElement.getBoundingClientRect());
38429
38488
  scrollToBottom();
38430
38489
  }
38490
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38431
38491
  }, [listElement, hasMoreNewer]);
38432
38492
  var updateScrollTop = useMessageListScrollManager({
38433
38493
  loadMoreScrollThreshold: loadMoreScrollThreshold,
@@ -38578,24 +38638,50 @@ var MessageListMainPanel = function (_a) {
38578
38638
  return React__default["default"].createElement(React__default["default"].Fragment, null, children);
38579
38639
  };
38580
38640
 
38641
+ function defaultRenderMessages(_a) {
38642
+ var components = _a.components, customClasses = _a.customClasses, lastReceivedId = _a.lastReceivedMessageId, messageGroupStyles = _a.messageGroupStyles, messages = _a.messages, readData = _a.readData, messageProps = _a.sharedMessageProps;
38643
+ var DateSeparator = components.DateSeparator, HeaderComponent = components.HeaderComponent, MessageSystem = components.MessageSystem;
38644
+ return messages.map(function (message) {
38645
+ if (message.customType === CUSTOM_MESSAGE_TYPE.date &&
38646
+ message.date &&
38647
+ icons.isDate(message.date) &&
38648
+ DateSeparator) {
38649
+ return (React__default["default"].createElement("li", { key: "".concat(message.date.toISOString(), "-i") },
38650
+ React__default["default"].createElement(DateSeparator, { date: message.date, formatDate: messageProps.formatDate, unread: message.unread })));
38651
+ }
38652
+ if (message.customType === CUSTOM_MESSAGE_TYPE.intro && HeaderComponent) {
38653
+ return (React__default["default"].createElement("li", { key: 'intro' },
38654
+ React__default["default"].createElement(HeaderComponent, null)));
38655
+ }
38656
+ if (message.type === 'system' && MessageSystem) {
38657
+ return (React__default["default"].createElement("li", { key: message.id || message.created_at },
38658
+ React__default["default"].createElement(MessageSystem, { message: message })));
38659
+ }
38660
+ var groupStyles = messageGroupStyles[message.id] || '';
38661
+ var messageClass = (customClasses === null || customClasses === void 0 ? void 0 : customClasses.message) || "str-chat__li str-chat__li--".concat(groupStyles);
38662
+ return (React__default["default"].createElement("li", { className: messageClass, "data-message-id": message.id, "data-testid": messageClass, key: message.id || message.created_at },
38663
+ React__default["default"].createElement(Message, icons.__assign({ groupStyles: [groupStyles], lastReceivedId: lastReceivedId, message: message, readBy: readData[message.id] || [] }, messageProps))));
38664
+ });
38665
+ }
38666
+
38581
38667
  var MessageListWithContext = function (props) {
38582
38668
  var channel = props.channel, _a = props.disableDateSeparator, disableDateSeparator = _a === void 0 ? false : _a, groupStyles = props.groupStyles, _b = props.hideDeletedMessages, hideDeletedMessages = _b === void 0 ? false : _b, _c = props.hideNewMessageSeparator, hideNewMessageSeparator = _c === void 0 ? false : _c, internalInfiniteScrollProps = props.internalInfiniteScrollProps, _d = props.messageActions, messageActions = _d === void 0 ? Object.keys(MESSAGE_ACTIONS) : _d, _e = props.messages, messages = _e === void 0 ? [] : _e, notifications = props.notifications, _f = props.noGroupByUser, noGroupByUser = _f === void 0 ? false : _f, _g = props.pinPermissions, pinPermissions = _g === void 0 ? defaultPinPermissions : _g, // @deprecated in favor of `channelCapabilities` - TODO: remove in next major release
38583
38669
  _h = props.returnAllReadData, // @deprecated in favor of `channelCapabilities` - TODO: remove in next major release
38584
- returnAllReadData = _h === void 0 ? false : _h, _j = props.threadList, threadList = _j === void 0 ? false : _j, _k = props.unsafeHTML, unsafeHTML = _k === void 0 ? false : _k, headerPosition = props.headerPosition, read = props.read, _l = props.messageLimit, messageLimit = _l === void 0 ? 100 : _l, loadMoreCallback = props.loadMore, loadMoreNewerCallback = props.loadMoreNewer, _m = props.hasMoreNewer, hasMoreNewer = _m === void 0 ? false : _m, suppressAutoscroll = props.suppressAutoscroll, highlightedMessageId = props.highlightedMessageId, _o = props.jumpToLatestMessage, jumpToLatestMessage = _o === void 0 ? function () { return Promise.resolve(); } : _o;
38585
- var _p = React__default["default"].useState(null), listElement = _p[0], setListElement = _p[1];
38586
- var _q = React__default["default"].useState(null), ulElement = _q[0], setUlElement = _q[1];
38670
+ returnAllReadData = _h === void 0 ? false : _h, _j = props.threadList, threadList = _j === void 0 ? false : _j, _k = props.unsafeHTML, unsafeHTML = _k === void 0 ? false : _k, headerPosition = props.headerPosition, read = props.read, _l = props.renderMessages, renderMessages = _l === void 0 ? defaultRenderMessages : _l, _m = props.messageLimit, messageLimit = _m === void 0 ? 100 : _m, loadMoreCallback = props.loadMore, loadMoreNewerCallback = props.loadMoreNewer, _o = props.hasMoreNewer, hasMoreNewer = _o === void 0 ? false : _o, suppressAutoscroll = props.suppressAutoscroll, highlightedMessageId = props.highlightedMessageId, _p = props.jumpToLatestMessage, jumpToLatestMessage = _p === void 0 ? function () { return Promise.resolve(); } : _p;
38671
+ var _q = React__default["default"].useState(null), listElement = _q[0], setListElement = _q[1];
38672
+ var _r = React__default["default"].useState(null), ulElement = _r[0], setUlElement = _r[1];
38587
38673
  var customClasses = icons.useChatContext('MessageList').customClasses;
38588
- var _r = icons.useComponentContext('MessageList'), _s = _r.EmptyStateIndicator, EmptyStateIndicator$1 = _s === void 0 ? EmptyStateIndicator : _s, _t = _r.LoadingIndicator, LoadingIndicator$1 = _t === void 0 ? LoadingIndicator : _t, _u = _r.MessageListNotifications, MessageListNotifications$1 = _u === void 0 ? MessageListNotifications : _u, _v = _r.MessageNotification, MessageNotification$1 = _v === void 0 ? MessageNotification : _v, _w = _r.TypingIndicator, TypingIndicator$1 = _w === void 0 ? TypingIndicator : _w;
38674
+ var _s = icons.useComponentContext('MessageList'), _t = _s.EmptyStateIndicator, EmptyStateIndicator$1 = _t === void 0 ? EmptyStateIndicator : _t, _u = _s.LoadingIndicator, LoadingIndicator$1 = _u === void 0 ? LoadingIndicator : _u, _v = _s.MessageListNotifications, MessageListNotifications$1 = _v === void 0 ? MessageListNotifications : _v, _w = _s.MessageNotification, MessageNotification$1 = _w === void 0 ? MessageNotification : _w, _x = _s.TypingIndicator, TypingIndicator$1 = _x === void 0 ? TypingIndicator : _x;
38589
38675
  var loadMoreScrollThreshold = (internalInfiniteScrollProps === null || internalInfiniteScrollProps === void 0 ? void 0 : internalInfiniteScrollProps.threshold) || 250;
38590
- var _x = useScrollLocationLogic({
38676
+ var _y = useScrollLocationLogic({
38591
38677
  hasMoreNewer: hasMoreNewer,
38592
38678
  listElement: listElement,
38593
38679
  loadMoreScrollThreshold: loadMoreScrollThreshold,
38594
38680
  messages: messages,
38595
38681
  scrolledUpThreshold: props.scrolledUpThreshold,
38596
38682
  suppressAutoscroll: suppressAutoscroll,
38597
- }), hasNewMessages = _x.hasNewMessages, isMessageListScrolledToBottom = _x.isMessageListScrolledToBottom, onScroll = _x.onScroll, scrollToBottom = _x.scrollToBottom, wrapperRect = _x.wrapperRect;
38598
- var _y = useEnrichedMessages({
38683
+ }), hasNewMessages = _y.hasNewMessages, isMessageListScrolledToBottom = _y.isMessageListScrolledToBottom, onScroll = _y.onScroll, scrollToBottom = _y.scrollToBottom, wrapperRect = _y.wrapperRect;
38684
+ var _z = useEnrichedMessages({
38599
38685
  channel: channel,
38600
38686
  disableDateSeparator: disableDateSeparator,
38601
38687
  groupStyles: groupStyles,
@@ -38604,7 +38690,7 @@ var MessageListWithContext = function (props) {
38604
38690
  hideNewMessageSeparator: hideNewMessageSeparator,
38605
38691
  messages: messages,
38606
38692
  noGroupByUser: noGroupByUser,
38607
- }), messageGroupStyles = _y.messageGroupStyles, enrichedMessages = _y.messages;
38693
+ }), messageGroupStyles = _z.messageGroupStyles, enrichedMessages = _z.messages;
38608
38694
  var elements = useMessageListElements({
38609
38695
  enrichedMessages: enrichedMessages,
38610
38696
  internalMessageProps: {
@@ -38635,6 +38721,7 @@ var MessageListWithContext = function (props) {
38635
38721
  },
38636
38722
  messageGroupStyles: messageGroupStyles,
38637
38723
  read: read,
38724
+ renderMessages: renderMessages,
38638
38725
  returnAllReadData: returnAllReadData,
38639
38726
  threadList: threadList,
38640
38727
  });
@@ -38673,6 +38760,7 @@ var MessageListWithContext = function (props) {
38673
38760
  var element = ulElement === null || ulElement === void 0 ? void 0 : ulElement.querySelector("[data-message-id='".concat(highlightedMessageId, "']"));
38674
38761
  element === null || element === void 0 ? void 0 : element.scrollIntoView({ block: 'center' });
38675
38762
  }
38763
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38676
38764
  }, [highlightedMessageId]);
38677
38765
  var showEmptyStateIndicator = elements.length === 0 && !threadList;
38678
38766
  return (React__default["default"].createElement(icons.MessageListContextProvider, { value: { listElement: listElement, scrollToBottom: scrollToBottom } },
@@ -38740,6 +38828,7 @@ var UnMemoizedScrollToBottomButton = function (props) {
38740
38828
  return function () {
38741
38829
  client.off(observedEvent, handleEvent);
38742
38830
  };
38831
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38743
38832
  }, [activeChannel, isMessageListScrolledToBottom, observedEvent, replyCount, thread]);
38744
38833
  React.useEffect(function () {
38745
38834
  if (isMessageListScrolledToBottom) {
@@ -38850,6 +38939,7 @@ function usePrependedMessagesCount(messages, hasDateSeparator) {
38850
38939
  return 0;
38851
38940
  // TODO: there's a bug here, the messages prop is the same array instance (something mutates it)
38852
38941
  // that's why the second dependency is necessary
38942
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38853
38943
  }, [firstRealMessageIndex, messages, messages === null || messages === void 0 ? void 0 : messages.length]);
38854
38944
  return numItemsPrepended;
38855
38945
  }
@@ -38874,6 +38964,7 @@ function useShouldForceScrollToBottom(messages, currentUserId) {
38874
38964
  initialFocusRegistered.current = true;
38875
38965
  recheckForNewOwnMessage();
38876
38966
  }
38967
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38877
38968
  }, [messages, messages === null || messages === void 0 ? void 0 : messages.length]);
38878
38969
  return recheckForNewOwnMessage;
38879
38970
  }
@@ -38891,6 +38982,7 @@ var useGiphyPreview = function (separateGiphyPreview) {
38891
38982
  if (separateGiphyPreview)
38892
38983
  client.on('message.new', handleEvent);
38893
38984
  return function () { return client.off('message.new', handleEvent); };
38985
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38894
38986
  }, [separateGiphyPreview]);
38895
38987
  return { giphyPreviewMessage: giphyPreviewMessage, setGiphyPreviewMessage: setGiphyPreviewMessage };
38896
38988
  };
@@ -38940,6 +39032,7 @@ var useScrollToBottomOnNewMessage = function (_a) {
38940
39032
  window.removeEventListener('focus', scrollToBottomIfConfigured);
38941
39033
  window.removeEventListener('blur', resetNewMessagesReceivedInBackground);
38942
39034
  };
39035
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38943
39036
  }, [scrollToBottomIfConfigured]);
38944
39037
  };
38945
39038
 
@@ -39036,7 +39129,7 @@ function calculateInitialTopMostItemIndex(messages, highlightedMessageId) {
39036
39129
  return messages.length - 1;
39037
39130
  }
39038
39131
  var VirtualizedMessageListWithContext = function (props) {
39039
- var additionalMessageInputProps = props.additionalMessageInputProps, _a = props.additionalVirtuosoProps, additionalVirtuosoProps = _a === void 0 ? {} : _a, channel = props.channel, closeReactionSelectorOnClick = props.closeReactionSelectorOnClick, customMessageActions = props.customMessageActions, customMessageRenderer = props.customMessageRenderer, defaultItemHeight = props.defaultItemHeight, _b = props.disableDateSeparator, disableDateSeparator = _b === void 0 ? true : _b, groupStyles = props.groupStyles, hasMore = props.hasMore, hasMoreNewer = props.hasMoreNewer, head = props.head, _c = props.hideDeletedMessages, hideDeletedMessages = _c === void 0 ? false : _c, _d = props.hideNewMessageSeparator, hideNewMessageSeparator = _d === void 0 ? false : _d, highlightedMessageId = props.highlightedMessageId, jumpToLatestMessage = props.jumpToLatestMessage, loadingMore = props.loadingMore, loadMore = props.loadMore, loadMoreNewer = props.loadMoreNewer, MessageUIComponentFromProps = props.Message, messageActions = props.messageActions, _e = props.messageLimit, messageLimit = _e === void 0 ? 100 : _e, messages = props.messages, notifications = props.notifications,
39132
+ var additionalMessageInputProps = props.additionalMessageInputProps, _a = props.additionalVirtuosoProps, additionalVirtuosoProps = _a === void 0 ? {} : _a, channel = props.channel, closeReactionSelectorOnClick = props.closeReactionSelectorOnClick, customMessageActions = props.customMessageActions, customMessageRenderer = props.customMessageRenderer, defaultItemHeight = props.defaultItemHeight, _b = props.disableDateSeparator, disableDateSeparator = _b === void 0 ? true : _b, groupStyles = props.groupStyles, hasMoreNewer = props.hasMoreNewer, head = props.head, _c = props.hideDeletedMessages, hideDeletedMessages = _c === void 0 ? false : _c, _d = props.hideNewMessageSeparator, hideNewMessageSeparator = _d === void 0 ? false : _d, highlightedMessageId = props.highlightedMessageId, jumpToLatestMessage = props.jumpToLatestMessage, loadingMore = props.loadingMore, loadMore = props.loadMore, loadMoreNewer = props.loadMoreNewer, MessageUIComponentFromProps = props.Message, messageActions = props.messageActions, _e = props.messageLimit, messageLimit = _e === void 0 ? 100 : _e, messages = props.messages, notifications = props.notifications,
39040
39133
  // TODO: refactor to scrollSeekPlaceHolderConfiguration and components.ScrollSeekPlaceholder, like the Virtuoso Component
39041
39134
  _f = props.overscan,
39042
39135
  // TODO: refactor to scrollSeekPlaceHolderConfiguration and components.ScrollSeekPlaceholder, like the Virtuoso Component
@@ -39070,6 +39163,7 @@ var VirtualizedMessageListWithContext = function (props) {
39070
39163
  setGiphyPreviewMessage: setGiphyPreviewMessage,
39071
39164
  userId: client.userID || '',
39072
39165
  });
39166
+ // eslint-disable-next-line react-hooks/exhaustive-deps
39073
39167
  }, [
39074
39168
  disableDateSeparator,
39075
39169
  hideDeletedMessages,
@@ -39099,6 +39193,7 @@ var VirtualizedMessageListWithContext = function (props) {
39099
39193
  }, {});
39100
39194
  },
39101
39195
  // processedMessages were incorrectly rebuilt with a new object identity at some point, hence the .length usage
39196
+ // eslint-disable-next-line react-hooks/exhaustive-deps
39102
39197
  [processedMessages.length, shouldGroupByUser, groupStylesFn]);
39103
39198
  var _w = useNewMessageNotification(processedMessages, client.userID, hasMoreNewer), atBottom = _w.atBottom, isMessageListScrolledToBottom = _w.isMessageListScrolledToBottom, newMessagesNotification = _w.newMessagesNotification, setIsMessageListScrolledToBottom = _w.setIsMessageListScrolledToBottom, setNewMessagesNotification = _w.setNewMessagesNotification;
39104
39199
  var scrollToBottom = React.useCallback(function () { return icons.__awaiter(void 0, void 0, void 0, function () {
@@ -39148,19 +39243,14 @@ var VirtualizedMessageListWithContext = function (props) {
39148
39243
  var atBottomStateChange = function (isAtBottom) {
39149
39244
  atBottom.current = isAtBottom;
39150
39245
  setIsMessageListScrolledToBottom(isAtBottom);
39151
- if (isAtBottom && newMessagesNotification) {
39152
- setNewMessagesNotification(false);
39153
- }
39154
- };
39155
- var startReached = function () {
39156
- if (hasMore && loadMore) {
39157
- loadMore(messageLimit);
39246
+ if (isAtBottom) {
39247
+ loadMoreNewer === null || loadMoreNewer === void 0 ? void 0 : loadMoreNewer(messageLimit);
39248
+ setNewMessagesNotification === null || setNewMessagesNotification === void 0 ? void 0 : setNewMessagesNotification(false);
39158
39249
  }
39159
39250
  };
39160
- var endReached = function () {
39161
- if (hasMoreNewer && loadMoreNewer) {
39162
- loadMoreNewer(messageLimit);
39163
- }
39251
+ var atTopStateChange = function (isAtTop) {
39252
+ if (isAtTop)
39253
+ loadMore === null || loadMore === void 0 ? void 0 : loadMore(messageLimit);
39164
39254
  };
39165
39255
  React.useEffect(function () {
39166
39256
  var _a;
@@ -39170,13 +39260,14 @@ var VirtualizedMessageListWithContext = function (props) {
39170
39260
  (_a = virtuoso.current) === null || _a === void 0 ? void 0 : _a.scrollToIndex({ align: 'center', index: index });
39171
39261
  }
39172
39262
  }
39263
+ // eslint-disable-next-line react-hooks/exhaustive-deps
39173
39264
  }, [highlightedMessageId]);
39174
39265
  if (!processedMessages)
39175
39266
  return null;
39176
39267
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
39177
39268
  React__default["default"].createElement(MessageListMainPanel, null,
39178
39269
  React__default["default"].createElement("div", { className: (customClasses === null || customClasses === void 0 ? void 0 : customClasses.virtualizedMessageList) || 'str-chat__virtual-list' },
39179
- React__default["default"].createElement(reactVirtuoso.Virtuoso, icons.__assign({ atBottomStateChange: atBottomStateChange, atBottomThreshold: 200, className: 'str-chat__message-list-scroll', components: icons.__assign({ EmptyPlaceholder: EmptyPlaceholder, Footer: Footer, Header: Header, Item: Item }, virtuosoComponentsFromProps), computeItemKey: computeItemKey, context: {
39270
+ React__default["default"].createElement(reactVirtuoso.Virtuoso, icons.__assign({ atBottomStateChange: atBottomStateChange, atBottomThreshold: 100, atTopStateChange: atTopStateChange, atTopThreshold: 100, className: 'str-chat__message-list-scroll', components: icons.__assign({ EmptyPlaceholder: EmptyPlaceholder, Footer: Footer, Header: Header, Item: Item }, virtuosoComponentsFromProps), computeItemKey: computeItemKey, context: {
39180
39271
  additionalMessageInputProps: additionalMessageInputProps,
39181
39272
  closeReactionSelectorOnClick: closeReactionSelectorOnClick,
39182
39273
  customClasses: customClasses,
@@ -39196,7 +39287,7 @@ var VirtualizedMessageListWithContext = function (props) {
39196
39287
  shouldGroupByUser: shouldGroupByUser,
39197
39288
  threadList: threadList,
39198
39289
  virtuosoRef: virtuoso,
39199
- }, endReached: endReached, firstItemIndex: calculateFirstItemIndex(numItemsPrepended), followOutput: followOutput, increaseViewportBy: { bottom: 200, top: 0 }, initialTopMostItemIndex: calculateInitialTopMostItemIndex(processedMessages, highlightedMessageId), itemContent: messageRenderer, itemSize: fractionalItemSize, key: messageSetKey, overscan: overscan, ref: virtuoso, startReached: startReached, style: { overflowX: 'hidden' }, totalCount: processedMessages.length }, overridingVirtuosoProps, (scrollSeekPlaceHolder ? { scrollSeek: scrollSeekPlaceHolder } : {}), (defaultItemHeight ? { defaultItemHeight: defaultItemHeight } : {}))))),
39290
+ }, firstItemIndex: calculateFirstItemIndex(numItemsPrepended), followOutput: followOutput, increaseViewportBy: { bottom: 200, top: 0 }, initialTopMostItemIndex: calculateInitialTopMostItemIndex(processedMessages, highlightedMessageId), itemContent: messageRenderer, itemSize: fractionalItemSize, key: messageSetKey, overscan: overscan, ref: virtuoso, style: { overflowX: 'hidden' }, totalCount: processedMessages.length }, overridingVirtuosoProps, (scrollSeekPlaceHolder ? { scrollSeek: scrollSeekPlaceHolder } : {}), (defaultItemHeight ? { defaultItemHeight: defaultItemHeight } : {}))))),
39200
39291
  React__default["default"].createElement(MessageListNotifications$1, { hasNewMessages: newMessagesNotification, isMessageListScrolledToBottom: isMessageListScrolledToBottom, isNotAtLatestMessageSet: hasMoreNewer, MessageNotification: MessageNotification$1, notifications: notifications, scrollToBottom: scrollToBottom, threadList: threadList }),
39201
39292
  giphyPreviewMessage && React__default["default"].createElement(GiphyPreviewMessage$1, { message: giphyPreviewMessage })));
39202
39293
  };
@@ -39278,6 +39369,7 @@ var ThreadInner = function (props) {
39278
39369
  // FIXME: integrators can customize channel query options but cannot customize channel.getReplies() options
39279
39370
  loadMoreThread();
39280
39371
  }
39372
+ // eslint-disable-next-line react-hooks/exhaustive-deps
39281
39373
  }, []);
39282
39374
  if (!thread)
39283
39375
  return null;
@@ -39410,6 +39502,7 @@ exports.ChatDown = ChatDown;
39410
39502
  exports.CommandItem = CommandItem;
39411
39503
  exports.ConnectionStatus = ConnectionStatus;
39412
39504
  exports.CooldownTimer = CooldownTimer;
39505
+ exports.CustomMessageActionsList = CustomMessageActionsList;
39413
39506
  exports.DateSeparator = DateSeparator;
39414
39507
  exports.DefaultSuggestionList = List;
39415
39508
  exports.DefaultSuggestionListHeader = DefaultSuggestionListHeader;
@@ -39500,6 +39593,7 @@ exports.darkModeTheme = darkModeTheme;
39500
39593
  exports.defaultAllowedTagNames = defaultAllowedTagNames;
39501
39594
  exports.defaultPinPermissions = defaultPinPermissions;
39502
39595
  exports.defaultReactionOptions = defaultReactionOptions;
39596
+ exports.defaultRenderMessages = defaultRenderMessages;
39503
39597
  exports.defaultScrollToItem = defaultScrollToItem;
39504
39598
  exports.defaultTimestampFormat = defaultTimestampFormat;
39505
39599
  exports.emojiMarkdownPlugin = emojiMarkdownPlugin;