stream-chat-react 14.0.0-beta.3 → 14.0.0-beta.4

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 (144) hide show
  1. package/dist/cjs/WithAudioPlayback.236d404c.js +4670 -0
  2. package/dist/cjs/WithAudioPlayback.236d404c.js.map +1 -0
  3. package/dist/cjs/emojis.js +2 -2
  4. package/dist/cjs/emojis.js.map +1 -1
  5. package/dist/cjs/index.js +191 -264
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/css/emoji-replacement.css +34 -0
  8. package/dist/css/emoji-replacement.css.map +1 -0
  9. package/dist/css/index.css +9 -25
  10. package/dist/css/index.css.map +1 -1
  11. package/dist/es/WithAudioPlayback.89700cb5.mjs +4654 -0
  12. package/dist/es/WithAudioPlayback.89700cb5.mjs.map +1 -0
  13. package/dist/es/emojis.mjs +2 -2
  14. package/dist/es/emojis.mjs.map +1 -1
  15. package/dist/es/index.mjs +230 -303
  16. package/dist/es/index.mjs.map +1 -1
  17. package/dist/types/components/Form/TextInput.d.ts +2 -2
  18. package/dist/types/components/Form/TextInput.d.ts.map +1 -1
  19. package/dist/types/components/Icons/IconGiphy.d.ts.map +1 -1
  20. package/dist/types/components/Icons/icons.d.ts +56 -340
  21. package/dist/types/components/Icons/icons.d.ts.map +1 -1
  22. package/dist/types/components/Loading/LoadingIndicator.d.ts +2 -2
  23. package/dist/types/components/Loading/LoadingIndicator.d.ts.map +1 -1
  24. package/dist/types/components/MessageComposer/AttachmentPreviewList/MediaAttachmentPreview.d.ts.map +1 -1
  25. package/dist/types/components/Poll/PollCreationDialog/OptionFieldSet.d.ts.map +1 -1
  26. package/package.json +3 -4
  27. package/dist/assets/icons/stream-chat-icons.eot +0 -0
  28. package/dist/assets/icons/stream-chat-icons.svg +0 -50
  29. package/dist/assets/icons/stream-chat-icons.ttf +0 -0
  30. package/dist/assets/icons/stream-chat-icons.woff +0 -0
  31. package/dist/assets/icons/stream-chat-icons.woff2 +0 -0
  32. package/dist/cjs/WithAudioPlayback.4a84360f.js +0 -4727
  33. package/dist/cjs/WithAudioPlayback.4a84360f.js.map +0 -1
  34. package/dist/css/v2/emoji-mart.css +0 -1
  35. package/dist/css/v2/emoji-replacement.css +0 -1
  36. package/dist/css/v2/index.css +0 -1
  37. package/dist/css/v2/index.layout.css +0 -1
  38. package/dist/es/WithAudioPlayback.a3d5a2fc.mjs +0 -4711
  39. package/dist/es/WithAudioPlayback.a3d5a2fc.mjs.map +0 -1
  40. package/dist/scss/v2/AIStateIndicator/AIStateIndicator-layout.scss +0 -3
  41. package/dist/scss/v2/AIStateIndicator/AIStateIndicator-theme.scss +0 -7
  42. package/dist/scss/v2/AttachmentList/AttachmentList-layout.scss +0 -701
  43. package/dist/scss/v2/AttachmentList/AttachmentList-theme.scss +0 -605
  44. package/dist/scss/v2/AttachmentPreviewList/AttachmentPreviewList-layout.scss +0 -141
  45. package/dist/scss/v2/AttachmentPreviewList/AttachmentPreviewList-theme.scss +0 -190
  46. package/dist/scss/v2/AudioRecorder/AudioRecorder-layout.scss +0 -139
  47. package/dist/scss/v2/AudioRecorder/AudioRecorder-theme.scss +0 -61
  48. package/dist/scss/v2/Autocomplete/Autocomplete-layout.scss +0 -94
  49. package/dist/scss/v2/Autocomplete/Autocomplete-theme.scss +0 -220
  50. package/dist/scss/v2/Avatar/Avatar-layout.scss +0 -137
  51. package/dist/scss/v2/Avatar/Avatar-theme.scss +0 -64
  52. package/dist/scss/v2/BaseImage/BaseImage-layout.scss +0 -21
  53. package/dist/scss/v2/BaseImage/BaseImage-theme.scss +0 -35
  54. package/dist/scss/v2/BaseImage/index.scss +0 -2
  55. package/dist/scss/v2/Channel/Channel-layout.scss +0 -141
  56. package/dist/scss/v2/Channel/Channel-theme.scss +0 -100
  57. package/dist/scss/v2/ChannelHeader/ChannelHeader-layout.scss +0 -27
  58. package/dist/scss/v2/ChannelHeader/ChannelHeader-theme.scss +0 -43
  59. package/dist/scss/v2/ChannelList/ChannelList-layout.scss +0 -65
  60. package/dist/scss/v2/ChannelList/ChannelList-theme.scss +0 -89
  61. package/dist/scss/v2/ChannelPreview/ChannelPreview-layout.scss +0 -126
  62. package/dist/scss/v2/ChannelPreview/ChannelPreview-theme.scss +0 -148
  63. package/dist/scss/v2/ChannelSearch/ChannelSearch-layout.scss +0 -122
  64. package/dist/scss/v2/ChannelSearch/ChannelSearch-theme.scss +0 -238
  65. package/dist/scss/v2/ChatView/ChatView-layout.scss +0 -43
  66. package/dist/scss/v2/ChatView/ChatView-theme.scss +0 -32
  67. package/dist/scss/v2/Dialog/Dialog-layout.scss +0 -70
  68. package/dist/scss/v2/Dialog/Dialog-theme.scss +0 -103
  69. package/dist/scss/v2/DragAndDropContainer/DragAndDropContainer-layout.scss +0 -5
  70. package/dist/scss/v2/DragAndDropContainer/DragAndDropContainer-theme.scss +0 -47
  71. package/dist/scss/v2/DropzoneContainer/DropzoneContainer-layout.scss +0 -14
  72. package/dist/scss/v2/DropzoneContainer/DropzoneContainer-theme.scss +0 -17
  73. package/dist/scss/v2/EditMessageForm/EditMessageForm-layout.scss +0 -51
  74. package/dist/scss/v2/EditMessageForm/EditMessageForm-theme.scss +0 -50
  75. package/dist/scss/v2/Form/Form-layout.scss +0 -49
  76. package/dist/scss/v2/Form/Form-theme.scss +0 -82
  77. package/dist/scss/v2/Icon/Icon-layout.scss +0 -98
  78. package/dist/scss/v2/Icon/Icon-theme.scss +0 -17
  79. package/dist/scss/v2/ImageCarousel/ImageCarousel-layout.scss +0 -51
  80. package/dist/scss/v2/ImageCarousel/ImageCarousel-theme.scss +0 -30
  81. package/dist/scss/v2/InfiniteScrollPaginator/InfiniteScrollPaginator-layout.scss +0 -4
  82. package/dist/scss/v2/LinkPreview/LinkPreview-layout.scss +0 -67
  83. package/dist/scss/v2/LinkPreview/LinkPreview-theme.scss +0 -32
  84. package/dist/scss/v2/LinkPreview/index.scss +0 -2
  85. package/dist/scss/v2/LoadingIndicator/LoadingIndicator-layout.scss +0 -64
  86. package/dist/scss/v2/LoadingIndicator/LoadingIndicator-theme.scss +0 -14
  87. package/dist/scss/v2/Location/Location-layout.scss +0 -52
  88. package/dist/scss/v2/Location/Location-theme.scss +0 -32
  89. package/dist/scss/v2/Message/Message-layout.scss +0 -619
  90. package/dist/scss/v2/Message/Message-theme.scss +0 -483
  91. package/dist/scss/v2/MessageActionsBox/MessageActionsBox-layout.scss +0 -21
  92. package/dist/scss/v2/MessageActionsBox/MessageActionsBox-theme.scss +0 -85
  93. package/dist/scss/v2/MessageBouncePrompt/MessageBouncePrompt-layout.scss +0 -19
  94. package/dist/scss/v2/MessageBouncePrompt/MessageBouncePrompt-theme.scss +0 -51
  95. package/dist/scss/v2/MessageInput/MessageInput-layout.scss +0 -268
  96. package/dist/scss/v2/MessageInput/MessageInput-theme.scss +0 -359
  97. package/dist/scss/v2/MessageList/MessageList-layout.scss +0 -65
  98. package/dist/scss/v2/MessageList/MessageList-theme.scss +0 -107
  99. package/dist/scss/v2/MessageList/VirtualizedMessageList-layout.scss +0 -57
  100. package/dist/scss/v2/MessageList/VirtualizedMessageList-theme.scss +0 -41
  101. package/dist/scss/v2/MessageReactions/MessageReactions-layout.scss +0 -143
  102. package/dist/scss/v2/MessageReactions/MessageReactions-theme.scss +0 -92
  103. package/dist/scss/v2/MessageReactions/MessageReactionsSelector-layout.scss +0 -86
  104. package/dist/scss/v2/MessageReactions/MessageReactionsSelector-theme.scss +0 -94
  105. package/dist/scss/v2/Modal/Modal-layout.scss +0 -74
  106. package/dist/scss/v2/Modal/Modal-theme.scss +0 -109
  107. package/dist/scss/v2/Notification/MessageNotification-layout.scss +0 -12
  108. package/dist/scss/v2/Notification/MessageNotification-theme.scss +0 -34
  109. package/dist/scss/v2/Notification/Notification-layout.scss +0 -7
  110. package/dist/scss/v2/Notification/Notification-theme.scss +0 -32
  111. package/dist/scss/v2/Notification/NotificationList-layout.scss +0 -11
  112. package/dist/scss/v2/Notification/NotificationList-theme.scss +0 -31
  113. package/dist/scss/v2/Poll/Poll-layout.scss +0 -493
  114. package/dist/scss/v2/Poll/Poll-theme.scss +0 -178
  115. package/dist/scss/v2/Search/Search-layout.scss +0 -148
  116. package/dist/scss/v2/Search/Search-theme.scss +0 -222
  117. package/dist/scss/v2/Thread/Thread-layout.scss +0 -65
  118. package/dist/scss/v2/Thread/Thread-theme.scss +0 -82
  119. package/dist/scss/v2/ThreadList/ThreadList-layout.scss +0 -152
  120. package/dist/scss/v2/ThreadList/ThreadList-theme.scss +0 -75
  121. package/dist/scss/v2/Tooltip/Tooltip-layout.scss +0 -10
  122. package/dist/scss/v2/Tooltip/Tooltip-theme.scss +0 -36
  123. package/dist/scss/v2/TypingIndicator/TypingIndicator-layout.scss +0 -31
  124. package/dist/scss/v2/TypingIndicator/TypingIndicator-theme.scss +0 -68
  125. package/dist/scss/v2/UnreadCountBadge/UnreadCountBadge-layout.scss +0 -49
  126. package/dist/scss/v2/UnreadCountBadge/UnreadCountBadge-theme.scss +0 -11
  127. package/dist/scss/v2/_base.scss +0 -65
  128. package/dist/scss/v2/_emoji-replacement.scss +0 -45
  129. package/dist/scss/v2/_global-layout-variables.scss +0 -65
  130. package/dist/scss/v2/_global-theme-variables.scss +0 -173
  131. package/dist/scss/v2/_icons.scss +0 -36
  132. package/dist/scss/v2/_palette-variables.scss +0 -55
  133. package/dist/scss/v2/_utils.scss +0 -212
  134. package/dist/scss/v2/_variables.scss +0 -2
  135. package/dist/scss/v2/common/CTAButton/CTAButton-layout.scss +0 -4
  136. package/dist/scss/v2/common/CTAButton/CTAButton-theme.scss +0 -42
  137. package/dist/scss/v2/common/CircleFAButton/CircleFAButton-layout.scss +0 -14
  138. package/dist/scss/v2/common/CircleFAButton/CircleFAButton-theme.scss +0 -35
  139. package/dist/scss/v2/index.layout.scss +0 -49
  140. package/dist/scss/v2/index.scss +0 -50
  141. package/dist/scss/v2/vendor/emoji-mart.scss +0 -514
  142. package/dist/scss/v2/vendor/react-image-gallery.scss +0 -258
  143. /package/dist/{assets → css/assets}/EmojiOneColor.woff2 +0 -0
  144. /package/dist/{assets → css/assets}/NotoColorEmoji-flags.woff2 +0 -0
@@ -0,0 +1,4654 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import React, { useContext, createContext, useCallback, useMemo, forwardRef, useRef, useEffect, createElement, useState, useReducer, useLayoutEffect } from "react";
3
+ import { flip, shift, size, useFloating, autoUpdate, autoPlacement, offset } from "@floating-ui/react";
4
+ import { StateStore, MessageComposer, FixedSizeQueueCache, ErrorFromResponse, localMessageToNewMessagePayload } from "stream-chat";
5
+ import throttle from "lodash.throttle";
6
+ import { useSyncExternalStore } from "use-sync-external-store/shim";
7
+ import clsx from "clsx";
8
+ import debounce from "lodash.debounce";
9
+ import Dayjs from "dayjs";
10
+ import * as linkify from "linkifyjs";
11
+ import { nanoid } from "nanoid";
12
+ import deepequal from "react-fast-compare";
13
+ import emojiRegex from "emoji-regex";
14
+ const ChannelActionContext = React.createContext(void 0);
15
+ const ChannelActionProvider = ({
16
+ children,
17
+ value
18
+ }) => /* @__PURE__ */ jsx(ChannelActionContext.Provider, { value, children });
19
+ const useChannelActionContext = (componentName) => {
20
+ const contextValue = useContext(ChannelActionContext);
21
+ if (!contextValue) {
22
+ console.warn(
23
+ `The useChannelActionContext hook was called outside of the ChannelActionContext provider. Make sure this hook is called within a child of the Channel component. The errored call is located in the ${componentName} component.`
24
+ );
25
+ return {};
26
+ }
27
+ return contextValue;
28
+ };
29
+ const ChannelListContext = createContext(
30
+ void 0
31
+ );
32
+ const ChannelListContextProvider = ({
33
+ children,
34
+ value
35
+ }) => /* @__PURE__ */ jsx(ChannelListContext.Provider, { value, children });
36
+ const useChannelListContext = () => {
37
+ const contextValue = useContext(ChannelListContext);
38
+ if (!contextValue) {
39
+ return {};
40
+ }
41
+ return contextValue;
42
+ };
43
+ const ChannelStateContext = React.createContext(void 0);
44
+ const ChannelStateProvider = ({
45
+ children,
46
+ value
47
+ }) => /* @__PURE__ */ jsx(ChannelStateContext.Provider, { value, children });
48
+ let remainingWarningCount = 1;
49
+ const useChannelStateContext = (componentName) => {
50
+ const contextValue = useContext(ChannelStateContext);
51
+ if (!contextValue) {
52
+ if (componentName && remainingWarningCount > 0) {
53
+ console.warn(
54
+ `The useChannelStateContext hook was called outside of the ChannelStateContext provider. Make sure this hook is called within a child of the Channel component. The errored call is located in the ${componentName} component.`
55
+ );
56
+ remainingWarningCount -= 1;
57
+ }
58
+ return {};
59
+ }
60
+ return contextValue;
61
+ };
62
+ const ChatContext = React.createContext(void 0);
63
+ const ChatProvider = ({
64
+ children,
65
+ value
66
+ }) => /* @__PURE__ */ jsx(ChatContext.Provider, { value, children });
67
+ const useChatContext = (componentName) => {
68
+ const contextValue = useContext(ChatContext);
69
+ if (!contextValue) {
70
+ console.warn(
71
+ `The useChatContext hook was called outside of the ChatContext provider. Make sure this hook is called within a child of the Chat component. The errored call is located in the ${componentName} component.`
72
+ );
73
+ return {};
74
+ }
75
+ return contextValue;
76
+ };
77
+ const ComponentContext = React.createContext({});
78
+ const ComponentProvider = ({
79
+ children,
80
+ value
81
+ }) => /* @__PURE__ */ jsx(ComponentContext.Provider, { value, children });
82
+ const useComponentContext = (_componentName) => useContext(ComponentContext);
83
+ const noop = () => {
84
+ };
85
+ function useStateStore(store, selector) {
86
+ const wrappedSubscription = useCallback(
87
+ (onStoreChange) => {
88
+ const unsubscribe = store?.subscribeWithSelector(selector, onStoreChange);
89
+ return unsubscribe ?? noop;
90
+ },
91
+ [store, selector]
92
+ );
93
+ const wrappedSnapshot = useMemo(() => {
94
+ let cachedTuple;
95
+ return () => {
96
+ const currentValue = store?.getLatestValue();
97
+ if (!currentValue) return void 0;
98
+ if (cachedTuple && cachedTuple[0] === currentValue) {
99
+ return cachedTuple[1];
100
+ }
101
+ const newlySelected = selector(currentValue);
102
+ if (cachedTuple) {
103
+ let selectededAreEqualToCached = true;
104
+ for (const key in cachedTuple[1]) {
105
+ if (cachedTuple[1][key] === newlySelected[key]) continue;
106
+ selectededAreEqualToCached = false;
107
+ break;
108
+ }
109
+ if (selectededAreEqualToCached) return cachedTuple[1];
110
+ }
111
+ cachedTuple = [currentValue, newlySelected];
112
+ return cachedTuple[1];
113
+ };
114
+ }, [store, selector]);
115
+ const state = useSyncExternalStore(wrappedSubscription, wrappedSnapshot);
116
+ return state;
117
+ }
118
+ const MessageComposerContext = createContext(void 0);
119
+ const MessageComposerContextProvider = ({
120
+ children,
121
+ value
122
+ }) => /* @__PURE__ */ jsx(
123
+ MessageComposerContext.Provider,
124
+ {
125
+ value,
126
+ children
127
+ }
128
+ );
129
+ const useMessageComposerContext = (componentName) => {
130
+ const contextValue = useContext(MessageComposerContext);
131
+ if (!contextValue) {
132
+ return {};
133
+ }
134
+ return contextValue;
135
+ };
136
+ function getDefaultExportFromCjs(x) {
137
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
138
+ }
139
+ var calendar$2 = { exports: {} };
140
+ var calendar$1 = calendar$2.exports;
141
+ var hasRequiredCalendar;
142
+ function requireCalendar() {
143
+ if (hasRequiredCalendar) return calendar$2.exports;
144
+ hasRequiredCalendar = 1;
145
+ (function(module, exports$1) {
146
+ !(function(e, t) {
147
+ module.exports = t();
148
+ })(calendar$1, function() {
149
+ return function(e, t, a) {
150
+ var n = "h:mm A", d = { lastDay: "[Yesterday at] " + n, sameDay: "[Today at] " + n, nextDay: "[Tomorrow at] " + n, nextWeek: "dddd [at] " + n, lastWeek: "[Last] dddd [at] " + n, sameElse: "MM/DD/YYYY" };
151
+ t.prototype.calendar = function(e2, t2) {
152
+ var n2 = t2 || this.$locale().calendar || d, s = a(e2 || void 0).startOf("d"), o = this.diff(s, "d", true), i = o < -6 ? "sameElse" : o < -1 ? "lastWeek" : o < 0 ? "lastDay" : o < 1 ? "sameDay" : o < 2 ? "nextDay" : o < 7 ? "nextWeek" : "sameElse", f = n2[i] || d[i];
153
+ return "function" == typeof f ? f.call(this, a()) : this.format(f);
154
+ };
155
+ };
156
+ });
157
+ })(calendar$2);
158
+ return calendar$2.exports;
159
+ }
160
+ var calendarExports = requireCalendar();
161
+ const calendar = /* @__PURE__ */ getDefaultExportFromCjs(calendarExports);
162
+ var localizedFormat$1 = { exports: {} };
163
+ var localizedFormat = localizedFormat$1.exports;
164
+ var hasRequiredLocalizedFormat;
165
+ function requireLocalizedFormat() {
166
+ if (hasRequiredLocalizedFormat) return localizedFormat$1.exports;
167
+ hasRequiredLocalizedFormat = 1;
168
+ (function(module, exports$1) {
169
+ !(function(e, t) {
170
+ module.exports = t();
171
+ })(localizedFormat, function() {
172
+ var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" };
173
+ return function(t, n, o) {
174
+ var r = n.prototype, M = r.format;
175
+ o.en.formats = e, r.format = function(t2) {
176
+ void 0 === t2 && (t2 = "YYYY-MM-DDTHH:mm:ssZ");
177
+ var n2 = this.$locale().formats, o2 = (function(t3, n3) {
178
+ return t3.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t4, o3, r2) {
179
+ var M2 = r2 && r2.toUpperCase();
180
+ return o3 || n3[r2] || e[r2] || n3[M2].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t5, n4) {
181
+ return t5 || n4.slice(1);
182
+ });
183
+ });
184
+ })(t2, void 0 === n2 ? {} : n2);
185
+ return M.call(this, o2);
186
+ };
187
+ };
188
+ });
189
+ })(localizedFormat$1);
190
+ return localizedFormat$1.exports;
191
+ }
192
+ var localizedFormatExports = requireLocalizedFormat();
193
+ const LocalizedFormat = /* @__PURE__ */ getDefaultExportFromCjs(localizedFormatExports);
194
+ const isNumberOrString = (output) => typeof output === "string" || typeof output === "number";
195
+ const isDayOrMoment = (output) => !!output?.isSame;
196
+ const isDate = (output) => output !== null && typeof output === "object" && typeof output.getTime === "function";
197
+ const DEFAULT_RELATIVE_COMPACT_MAX_DAYS = 6;
198
+ const DEFAULT_RELATIVE_COMPACT_MAX_WEEKS = 3;
199
+ function getRelativeCompactDateString(messageCreatedAt, t, tDateTimeParser, maxDays = DEFAULT_RELATIVE_COMPACT_MAX_DAYS, maxWeeks = DEFAULT_RELATIVE_COMPACT_MAX_WEEKS) {
200
+ const then = tDateTimeParser(messageCreatedAt);
201
+ if (!isDayOrMoment(then)) return null;
202
+ const now = tDateTimeParser((/* @__PURE__ */ new Date()).toISOString());
203
+ if (!isDayOrMoment(now)) return null;
204
+ const diffDays = now.startOf("day").diff(then.startOf("day"), "day");
205
+ if (diffDays < 0) {
206
+ return then.format("DD/MM/YY");
207
+ }
208
+ if (diffDays === 0) return t("timestamp/relativeToday");
209
+ if (diffDays === 1) return t("timestamp/relativeYesterday");
210
+ if (diffDays >= 2 && diffDays <= maxDays)
211
+ return t("timestamp/relativeDaysAgo", { count: diffDays });
212
+ if (maxWeeks > 0) {
213
+ const maxDaysForWeeks = maxWeeks * 7;
214
+ if (diffDays >= 7 && diffDays <= maxDaysForWeeks) {
215
+ const weeks = Math.ceil(diffDays / 7);
216
+ return t("timestamp/relativeWeeksAgo", { count: weeks });
217
+ }
218
+ }
219
+ return then.format("DD/MM/YY");
220
+ }
221
+ function getDateString({
222
+ calendar: calendar2,
223
+ calendarFormats,
224
+ format,
225
+ formatDate,
226
+ messageCreatedAt,
227
+ relativeCompact,
228
+ relativeCompactMaxDays,
229
+ relativeCompactMaxWeeks,
230
+ t,
231
+ tDateTimeParser,
232
+ timestampTranslationKey
233
+ }) {
234
+ if (!messageCreatedAt || typeof messageCreatedAt === "string" && !Date.parse(messageCreatedAt)) {
235
+ return null;
236
+ }
237
+ if (typeof formatDate === "function") {
238
+ return formatDate(new Date(messageCreatedAt));
239
+ }
240
+ if (relativeCompact && t && tDateTimeParser) {
241
+ const maxDays = typeof relativeCompactMaxDays === "number" ? relativeCompactMaxDays : typeof relativeCompactMaxDays === "string" ? parseInt(relativeCompactMaxDays, 10) : DEFAULT_RELATIVE_COMPACT_MAX_DAYS;
242
+ const maxWeeks = typeof relativeCompactMaxWeeks === "number" ? relativeCompactMaxWeeks : typeof relativeCompactMaxWeeks === "string" ? parseInt(relativeCompactMaxWeeks, 10) : DEFAULT_RELATIVE_COMPACT_MAX_WEEKS;
243
+ const result = getRelativeCompactDateString(
244
+ messageCreatedAt,
245
+ t,
246
+ tDateTimeParser,
247
+ Number.isNaN(maxDays) ? DEFAULT_RELATIVE_COMPACT_MAX_DAYS : maxDays,
248
+ Number.isNaN(maxWeeks) ? DEFAULT_RELATIVE_COMPACT_MAX_WEEKS : maxWeeks
249
+ );
250
+ if (result) return result;
251
+ }
252
+ if (t && timestampTranslationKey) {
253
+ const options = {};
254
+ if (typeof calendar2 !== "undefined" && calendar2 !== null) options.calendar = calendar2;
255
+ if (typeof calendarFormats !== "undefined" && calendarFormats !== null)
256
+ options.calendarFormats = calendarFormats;
257
+ if (typeof format !== "undefined" && format !== null) options.format = format;
258
+ const translatedTimestamp = t(timestampTranslationKey, {
259
+ ...options,
260
+ timestamp: new Date(messageCreatedAt)
261
+ });
262
+ const translationKeyFound = timestampTranslationKey !== translatedTimestamp;
263
+ if (translationKeyFound) return translatedTimestamp;
264
+ }
265
+ if (!tDateTimeParser) {
266
+ return null;
267
+ }
268
+ const parsedTime = tDateTimeParser(messageCreatedAt);
269
+ if (isDayOrMoment(parsedTime)) {
270
+ return calendar2 && parsedTime.calendar ? parsedTime.calendar(void 0, calendarFormats || void 0) : parsedTime.format(format || void 0);
271
+ }
272
+ if (isDate(parsedTime)) {
273
+ return parsedTime.toDateString();
274
+ }
275
+ if (isNumberOrString(parsedTime)) {
276
+ return parsedTime;
277
+ }
278
+ return null;
279
+ }
280
+ const predefinedFormatters = {
281
+ durationFormatter: (streamI18n) => (value, _, { format, withSuffix }) => {
282
+ if (format && Dayjs.isDayjs(streamI18n.DateTimeParser)) {
283
+ return streamI18n.DateTimeParser.duration(value).format(
284
+ format
285
+ );
286
+ }
287
+ return streamI18n.DateTimeParser.duration(value).humanize(!!withSuffix);
288
+ },
289
+ timestampFormatter: (streamI18n) => (value, _, {
290
+ calendarFormats,
291
+ ...options
292
+ }) => {
293
+ let parsedCalendarFormats;
294
+ try {
295
+ if (!options.calendar) {
296
+ parsedCalendarFormats = {};
297
+ } else if (typeof calendarFormats === "string") {
298
+ parsedCalendarFormats = JSON.parse(calendarFormats);
299
+ } else if (typeof calendarFormats === "object") {
300
+ parsedCalendarFormats = calendarFormats;
301
+ }
302
+ } catch (e) {
303
+ console.error("[TIMESTAMP FORMATTER]", e);
304
+ }
305
+ const result = getDateString({
306
+ ...options,
307
+ calendarFormats: parsedCalendarFormats,
308
+ messageCreatedAt: value,
309
+ t: streamI18n.t,
310
+ tDateTimeParser: streamI18n.tDateTimeParser
311
+ });
312
+ if (!result || typeof result === "number") {
313
+ return JSON.stringify(value);
314
+ }
315
+ return result;
316
+ }
317
+ };
318
+ const defaultTranslatorFunction = ((key) => key);
319
+ const defaultDateTimeParser = (input) => Dayjs(input);
320
+ const isLanguageSupported = (language) => {
321
+ const translations = [
322
+ "de",
323
+ "en",
324
+ "es",
325
+ "fr",
326
+ "hi",
327
+ "it",
328
+ "ja",
329
+ "ko",
330
+ "nl",
331
+ "pt",
332
+ "ru",
333
+ "tr"
334
+ ];
335
+ return translations.some((translation) => language === translation);
336
+ };
337
+ Dayjs.extend(calendar);
338
+ Dayjs.extend(LocalizedFormat);
339
+ const TranslationContext = React.createContext({
340
+ t: defaultTranslatorFunction,
341
+ tDateTimeParser: defaultDateTimeParser,
342
+ userLanguage: "en"
343
+ });
344
+ const TranslationProvider = ({
345
+ children,
346
+ value
347
+ }) => /* @__PURE__ */ jsx(TranslationContext.Provider, { value, children });
348
+ const useTranslationContext = (componentName) => {
349
+ const contextValue = useContext(TranslationContext);
350
+ if (!contextValue) {
351
+ console.warn(
352
+ `The useTranslationContext hook was called outside of the TranslationContext provider. Make sure this hook is called within a child of the Chat component. The errored call is located in the ${componentName} component.`
353
+ );
354
+ return {};
355
+ }
356
+ return contextValue;
357
+ };
358
+ const TypingContext = React.createContext(
359
+ void 0
360
+ );
361
+ const TypingProvider = ({
362
+ children,
363
+ value
364
+ }) => /* @__PURE__ */ jsx(TypingContext.Provider, { value, children });
365
+ const useTypingContext = (componentName) => {
366
+ const contextValue = useContext(TypingContext);
367
+ if (!contextValue) {
368
+ console.warn(
369
+ `The useTypingContext hook was called outside of the TypingContext provider. Make sure this hook is called within a child of the Channel component. The errored call is located in the ${componentName} component.`
370
+ );
371
+ return {};
372
+ }
373
+ return contextValue;
374
+ };
375
+ const DEFAULT_PLAYBACK_RATES = [1, 1.5, 2];
376
+ const isSeekable = (audioElement) => !(audioElement.duration === Infinity || isNaN(audioElement.duration));
377
+ const defaultRegisterAudioPlayerError = ({
378
+ error
379
+ } = {}) => {
380
+ if (!error) return;
381
+ console.error("[AUDIO PLAYER]", error);
382
+ };
383
+ const elementIsPlaying = (audioElement) => audioElement && !(audioElement.paused || audioElement.ended);
384
+ class AudioPlayer {
385
+ constructor({
386
+ durationSeconds,
387
+ fileSize,
388
+ id,
389
+ mimeType,
390
+ playbackRates: customPlaybackRates,
391
+ plugins,
392
+ pool,
393
+ src,
394
+ title,
395
+ waveformData
396
+ }) {
397
+ this._plugins = /* @__PURE__ */ new Map();
398
+ this.playTimeout = void 0;
399
+ this.unsubscribeEventListeners = null;
400
+ this._disposed = false;
401
+ this._metadataProbe = null;
402
+ this._restoringPosition = false;
403
+ this._removalTimeout = void 0;
404
+ this.setDurationSeconds = (durationSeconds2) => {
405
+ this._data.durationSeconds = durationSeconds2;
406
+ this.state.partialNext({ durationSeconds: durationSeconds2 });
407
+ };
408
+ this.setPlaybackStartSafetyTimeout = () => {
409
+ clearTimeout(this.playTimeout);
410
+ this.playTimeout = setTimeout(() => {
411
+ if (!this.elementRef) return;
412
+ try {
413
+ this.elementRef.pause();
414
+ this.state.partialNext({ isPlaying: false });
415
+ } catch (e) {
416
+ this.registerError({ errCode: "failed-to-start" });
417
+ }
418
+ }, 2e3);
419
+ };
420
+ this.updateDurationFromElement = (element) => {
421
+ const duration = element.duration;
422
+ if (typeof duration !== "number" || isNaN(duration) || !isFinite(duration) || duration <= 0) {
423
+ return;
424
+ }
425
+ this.setDurationSeconds(duration);
426
+ };
427
+ this.clearMetadataProbe = () => {
428
+ const probe = this._metadataProbe;
429
+ this._metadataProbe = null;
430
+ this._metadataProbePromise = void 0;
431
+ if (!probe) return;
432
+ try {
433
+ probe.pause();
434
+ } catch {
435
+ }
436
+ probe.removeAttribute("src");
437
+ try {
438
+ probe.load();
439
+ } catch {
440
+ }
441
+ };
442
+ this.preloadMetadata = () => {
443
+ if (this._disposed || this.durationSeconds != null || !this.src || this._metadataProbePromise || typeof document === "undefined") {
444
+ return;
445
+ }
446
+ const probe = document.createElement("audio");
447
+ probe.preload = "metadata";
448
+ this._metadataProbe = probe;
449
+ this._metadataProbePromise = new Promise((resolve) => {
450
+ const cleanup = () => {
451
+ probe.removeEventListener("loadedmetadata", handleLoadedMetadata);
452
+ probe.removeEventListener("error", handleError);
453
+ if (this._metadataProbe === probe) {
454
+ this.clearMetadataProbe();
455
+ } else {
456
+ this._metadataProbePromise = void 0;
457
+ }
458
+ resolve();
459
+ };
460
+ const handleLoadedMetadata = () => {
461
+ this.updateDurationFromElement(probe);
462
+ cleanup();
463
+ };
464
+ const handleError = () => {
465
+ cleanup();
466
+ };
467
+ probe.addEventListener("loadedmetadata", handleLoadedMetadata, { once: true });
468
+ probe.addEventListener("error", handleError, { once: true });
469
+ probe.src = this.src;
470
+ try {
471
+ probe.load();
472
+ } catch {
473
+ cleanup();
474
+ }
475
+ });
476
+ };
477
+ this.clearPlaybackStartSafetyTimeout = () => {
478
+ if (!this.elementRef) return;
479
+ clearTimeout(this.playTimeout);
480
+ this.playTimeout = void 0;
481
+ };
482
+ this.clearPendingLoadedMeta = () => {
483
+ const pending = this._pendingLoadedMeta;
484
+ if (pending?.element && pending.onLoaded) {
485
+ pending.element.removeEventListener("loadedmetadata", pending.onLoaded);
486
+ }
487
+ this._pendingLoadedMeta = void 0;
488
+ };
489
+ this.restoreSavedPosition = (elementRef) => {
490
+ const saved = this.secondsElapsed;
491
+ if (!saved || saved <= 0) return;
492
+ const apply = () => {
493
+ const duration = elementRef.duration;
494
+ const clamped = typeof duration === "number" && !isNaN(duration) && isFinite(duration) ? Math.min(saved, duration) : saved;
495
+ try {
496
+ if (elementRef.currentTime === clamped) return;
497
+ elementRef.currentTime = clamped;
498
+ this.setSecondsElapsed(clamped);
499
+ } catch {
500
+ }
501
+ };
502
+ if (elementRef.readyState < 1) {
503
+ this.clearPendingLoadedMeta();
504
+ this._restoringPosition = true;
505
+ const onLoaded = () => {
506
+ if (this._pendingLoadedMeta?.onLoaded !== onLoaded) return;
507
+ this._pendingLoadedMeta = void 0;
508
+ if (this.elementRef !== elementRef) {
509
+ this._restoringPosition = false;
510
+ return;
511
+ }
512
+ apply();
513
+ this._restoringPosition = false;
514
+ };
515
+ elementRef.addEventListener("loadedmetadata", onLoaded, { once: true });
516
+ this._pendingLoadedMeta = { element: elementRef, onLoaded };
517
+ } else {
518
+ this._restoringPosition = true;
519
+ apply();
520
+ this._restoringPosition = false;
521
+ }
522
+ };
523
+ this.elementIsReady = () => {
524
+ if (this._elementIsReadyPromise) return this._elementIsReadyPromise;
525
+ this._elementIsReadyPromise = new Promise((resolve) => {
526
+ if (!this.elementRef) return resolve(false);
527
+ const element = this.elementRef;
528
+ const handleLoaded = () => {
529
+ element.removeEventListener("loadedmetadata", handleLoaded);
530
+ resolve(element.readyState > 0);
531
+ };
532
+ element.addEventListener("loadedmetadata", handleLoaded);
533
+ });
534
+ return this._elementIsReadyPromise;
535
+ };
536
+ this.setRef = (elementRef) => {
537
+ if (elementIsPlaying(this.elementRef)) {
538
+ this.releaseElement({ resetState: false });
539
+ }
540
+ this.clearPendingLoadedMeta();
541
+ this.clearMetadataProbe();
542
+ this._restoringPosition = false;
543
+ this._elementIsReadyPromise = void 0;
544
+ this.state.partialNext({ elementRef });
545
+ if (elementRef) {
546
+ this.registerSubscriptions();
547
+ }
548
+ };
549
+ this.setSecondsElapsed = (secondsElapsed) => {
550
+ const duration = this.elementRef?.duration ?? this.durationSeconds;
551
+ this.state.partialNext({
552
+ progressPercent: duration && secondsElapsed ? secondsElapsed / duration * 100 : 0,
553
+ secondsElapsed
554
+ });
555
+ };
556
+ this.canPlayMimeType = (mimeType2) => {
557
+ if (!mimeType2) return false;
558
+ if (this.elementRef) return !!this.elementRef.canPlayType(mimeType2);
559
+ return !!new Audio().canPlayType(mimeType2);
560
+ };
561
+ this.play = async (params) => {
562
+ if (this._disposed) return;
563
+ const elementRef = this.ensureElementRef();
564
+ if (elementIsPlaying(this.elementRef)) {
565
+ if (this.isPlaying) return;
566
+ this.state.partialNext({ isPlaying: true });
567
+ return;
568
+ }
569
+ const { currentPlaybackRate, playbackRates: playbackRates2 } = {
570
+ currentPlaybackRate: this.currentPlaybackRate,
571
+ playbackRates: this.playbackRates,
572
+ ...params
573
+ };
574
+ if (!this.canPlayRecord) {
575
+ this.registerError({ errCode: "not-playable" });
576
+ return;
577
+ }
578
+ this.restoreSavedPosition(elementRef);
579
+ elementRef.playbackRate = currentPlaybackRate ?? this.currentPlaybackRate;
580
+ this.setPlaybackStartSafetyTimeout();
581
+ try {
582
+ await elementRef.play();
583
+ this.state.partialNext({
584
+ currentPlaybackRate,
585
+ isPlaying: true,
586
+ playbackRates: playbackRates2
587
+ });
588
+ this._pool.setActiveAudioPlayer(this);
589
+ } catch (e) {
590
+ this.registerError({ error: e });
591
+ this.state.partialNext({ isPlaying: false });
592
+ } finally {
593
+ this.clearPlaybackStartSafetyTimeout();
594
+ }
595
+ };
596
+ this.pause = () => {
597
+ if (!elementIsPlaying(this.elementRef)) return;
598
+ this.clearPlaybackStartSafetyTimeout();
599
+ this.elementRef.pause();
600
+ this.state.partialNext({ isPlaying: false });
601
+ };
602
+ this.stop = () => {
603
+ this.pause();
604
+ this.state.partialNext({ isPlaying: false });
605
+ this.setSecondsElapsed(0);
606
+ if (this.elementRef) this.elementRef.currentTime = 0;
607
+ };
608
+ this.togglePlay = async () => this.isPlaying ? this.pause() : await this.play();
609
+ this.increasePlaybackRate = () => {
610
+ let currentPlaybackRateIndex = this.state.getLatestValue().playbackRates.findIndex((rate) => rate === this.currentPlaybackRate);
611
+ if (currentPlaybackRateIndex === -1) {
612
+ currentPlaybackRateIndex = 0;
613
+ }
614
+ const nextIndex = currentPlaybackRateIndex === this.playbackRates.length - 1 ? 0 : currentPlaybackRateIndex + 1;
615
+ const currentPlaybackRate = this.playbackRates[nextIndex];
616
+ this.state.partialNext({ currentPlaybackRate });
617
+ if (this.elementRef) {
618
+ this.elementRef.playbackRate = currentPlaybackRate;
619
+ }
620
+ };
621
+ this.seek = throttle(async ({ clientX, currentTarget }) => {
622
+ let element = this.elementRef;
623
+ if (!this.elementRef) {
624
+ element = this.ensureElementRef();
625
+ const isReady = await this.elementIsReady();
626
+ if (!isReady) return;
627
+ }
628
+ if (!currentTarget || !element) return;
629
+ if (!isSeekable(element)) {
630
+ this.registerError({ errCode: "seek-not-supported" });
631
+ return;
632
+ }
633
+ const { width, x } = currentTarget.getBoundingClientRect();
634
+ const ratio = (clientX - x) / width;
635
+ if (ratio > 1 || ratio < 0) return;
636
+ const currentTime = ratio * element.duration;
637
+ this.setSecondsElapsed(currentTime);
638
+ element.currentTime = currentTime;
639
+ }, 16);
640
+ this.registerError = (params) => {
641
+ defaultRegisterAudioPlayerError(params);
642
+ this.plugins.forEach(({ onError }) => onError?.({ player: this, ...params }));
643
+ };
644
+ this.requestRemoval = () => {
645
+ this._disposed = true;
646
+ this.cancelScheduledRemoval();
647
+ this.clearPendingLoadedMeta();
648
+ this.clearMetadataProbe();
649
+ this._restoringPosition = false;
650
+ this.releaseElement({ resetState: true });
651
+ this.unsubscribeEventListeners?.();
652
+ this.unsubscribeEventListeners = null;
653
+ this.plugins.forEach(({ onRemove }) => onRemove?.({ player: this }));
654
+ this._pool.deregister(this.id);
655
+ };
656
+ this.cancelScheduledRemoval = () => {
657
+ clearTimeout(this._removalTimeout);
658
+ this._removalTimeout = void 0;
659
+ };
660
+ this.scheduleRemoval = (ms = 0) => {
661
+ this.cancelScheduledRemoval();
662
+ this._removalTimeout = setTimeout(() => {
663
+ if (this.disposed) return;
664
+ this.requestRemoval();
665
+ }, ms);
666
+ };
667
+ this.releaseElementForHandoff = () => {
668
+ if (!this.elementRef) return;
669
+ this.releaseElement({ resetState: false });
670
+ this.unsubscribeEventListeners?.();
671
+ this.unsubscribeEventListeners = null;
672
+ };
673
+ this.registerSubscriptions = () => {
674
+ this.unsubscribeEventListeners?.();
675
+ const audioElement = this.elementRef;
676
+ if (!audioElement) return;
677
+ const handleEnded = () => {
678
+ if (audioElement) {
679
+ this.updateDurationFromElement(audioElement);
680
+ }
681
+ this.stop();
682
+ };
683
+ const handleError = (e) => {
684
+ const audio = e.currentTarget;
685
+ const state = { isPlaying: false };
686
+ if (!audio?.error?.code) {
687
+ this.state.partialNext(state);
688
+ return;
689
+ }
690
+ if (audio.error.code === 4) {
691
+ state.canPlayRecord = false;
692
+ this.state.partialNext(state);
693
+ }
694
+ const errorMsg = [
695
+ void 0,
696
+ "MEDIA_ERR_ABORTED: fetch aborted by user",
697
+ "MEDIA_ERR_NETWORK: network failed while fetching",
698
+ "MEDIA_ERR_DECODE: audio fetched but couldn’t decode",
699
+ "MEDIA_ERR_SRC_NOT_SUPPORTED: source not supported"
700
+ ][audio?.error?.code];
701
+ if (!errorMsg) return;
702
+ defaultRegisterAudioPlayerError({ error: new Error(errorMsg + ` (${audio.src})`) });
703
+ };
704
+ const handleTimeupdate = () => {
705
+ const t = audioElement?.currentTime ?? 0;
706
+ if (this._restoringPosition && t === 0) return;
707
+ if (!this.isPlaying && t === 0 && this.secondsElapsed > 0) return;
708
+ this.setSecondsElapsed(t);
709
+ };
710
+ const handleLoadedMetadata = () => {
711
+ if (audioElement) {
712
+ this.updateDurationFromElement(audioElement);
713
+ }
714
+ };
715
+ audioElement.addEventListener("ended", handleEnded);
716
+ audioElement.addEventListener("error", handleError);
717
+ audioElement.addEventListener("loadedmetadata", handleLoadedMetadata);
718
+ audioElement.addEventListener("timeupdate", handleTimeupdate);
719
+ this.unsubscribeEventListeners = () => {
720
+ audioElement.pause();
721
+ audioElement.removeEventListener("ended", handleEnded);
722
+ audioElement.removeEventListener("error", handleError);
723
+ audioElement.removeEventListener("loadedmetadata", handleLoadedMetadata);
724
+ audioElement.removeEventListener("timeupdate", handleTimeupdate);
725
+ };
726
+ };
727
+ this._data = {
728
+ durationSeconds,
729
+ fileSize,
730
+ id,
731
+ mimeType,
732
+ src,
733
+ title,
734
+ waveformData
735
+ };
736
+ this._pool = pool;
737
+ this.setPlugins(() => plugins ?? []);
738
+ const playbackRates = customPlaybackRates?.length ? customPlaybackRates : DEFAULT_PLAYBACK_RATES;
739
+ const canPlayRecord = mimeType ? !!new Audio().canPlayType(mimeType) : true;
740
+ this.state = new StateStore({
741
+ canPlayRecord,
742
+ currentPlaybackRate: playbackRates[0],
743
+ durationSeconds,
744
+ elementRef: null,
745
+ isPlaying: false,
746
+ playbackError: null,
747
+ playbackRates,
748
+ progressPercent: 0,
749
+ secondsElapsed: 0
750
+ });
751
+ this.plugins.forEach((p) => p.onInit?.({ player: this }));
752
+ this.preloadMetadata();
753
+ }
754
+ get plugins() {
755
+ return Array.from(this._plugins.values());
756
+ }
757
+ get canPlayRecord() {
758
+ return this.state.getLatestValue().canPlayRecord;
759
+ }
760
+ get elementRef() {
761
+ return this.state.getLatestValue().elementRef;
762
+ }
763
+ get isPlaying() {
764
+ return this.state.getLatestValue().isPlaying;
765
+ }
766
+ get currentPlaybackRate() {
767
+ return this.state.getLatestValue().currentPlaybackRate;
768
+ }
769
+ get playbackRates() {
770
+ return this.state.getLatestValue().playbackRates;
771
+ }
772
+ get durationSeconds() {
773
+ return this.state.getLatestValue().durationSeconds;
774
+ }
775
+ get fileSize() {
776
+ return this._data.fileSize;
777
+ }
778
+ get id() {
779
+ return this._data.id;
780
+ }
781
+ get src() {
782
+ return this._data.src;
783
+ }
784
+ get mimeType() {
785
+ return this._data.mimeType;
786
+ }
787
+ get title() {
788
+ return this._data.title;
789
+ }
790
+ get waveformData() {
791
+ return this._data.waveformData;
792
+ }
793
+ get secondsElapsed() {
794
+ return this.state.getLatestValue().secondsElapsed;
795
+ }
796
+ get progressPercent() {
797
+ return this.state.getLatestValue().progressPercent;
798
+ }
799
+ get disposed() {
800
+ return this._disposed;
801
+ }
802
+ ensureElementRef() {
803
+ if (this._disposed) {
804
+ throw new Error("AudioPlayer is disposed");
805
+ }
806
+ if (!this.elementRef) {
807
+ const el = this._pool.acquireElement({
808
+ ownerId: this.id,
809
+ src: this.src
810
+ });
811
+ this.setRef(el);
812
+ }
813
+ return this.elementRef;
814
+ }
815
+ setDescriptor(descriptor) {
816
+ const previousSrc = this.src;
817
+ this._data = { ...this._data, ...descriptor };
818
+ if (descriptor.src !== previousSrc && this.elementRef) {
819
+ this.elementRef.src = descriptor.src;
820
+ }
821
+ if (descriptor.src && descriptor.src !== previousSrc) {
822
+ this.clearMetadataProbe();
823
+ if (descriptor.durationSeconds == null) {
824
+ this.setDurationSeconds(void 0);
825
+ this.preloadMetadata();
826
+ } else {
827
+ this.setDurationSeconds(descriptor.durationSeconds);
828
+ }
829
+ return;
830
+ }
831
+ if (descriptor.durationSeconds != null) {
832
+ this.setDurationSeconds(descriptor.durationSeconds);
833
+ }
834
+ }
835
+ releaseElement({ resetState }) {
836
+ this.clearPendingLoadedMeta();
837
+ this.clearMetadataProbe();
838
+ this._restoringPosition = false;
839
+ if (resetState) {
840
+ this.stop();
841
+ } else {
842
+ this.state.partialNext({ isPlaying: false });
843
+ if (this.elementRef) {
844
+ try {
845
+ this.elementRef.pause();
846
+ } catch {
847
+ }
848
+ }
849
+ }
850
+ if (this.elementRef) {
851
+ this._pool.releaseElement(this.id);
852
+ this.setRef(null);
853
+ }
854
+ }
855
+ setPlugins(setter) {
856
+ this._plugins = setter(this.plugins).reduce((acc, plugin) => {
857
+ if (plugin.id) {
858
+ acc.set(plugin.id, plugin);
859
+ }
860
+ return acc;
861
+ }, /* @__PURE__ */ new Map());
862
+ }
863
+ }
864
+ class AudioPlayerPool {
865
+ constructor(config) {
866
+ this.state = new StateStore({
867
+ activeAudioPlayer: null
868
+ });
869
+ this.pool = /* @__PURE__ */ new Map();
870
+ this.audios = /* @__PURE__ */ new Map();
871
+ this.sharedAudio = null;
872
+ this.sharedOwnerId = null;
873
+ this.getOrAdd = (params) => {
874
+ const { playbackRates, plugins, ...descriptor } = params;
875
+ let player = this.pool.get(params.id);
876
+ if (player) {
877
+ if (!player.disposed) {
878
+ player.setDescriptor(descriptor);
879
+ return player;
880
+ }
881
+ this.deregister(params.id);
882
+ }
883
+ player = new AudioPlayer({
884
+ playbackRates,
885
+ plugins,
886
+ ...descriptor,
887
+ pool: this
888
+ });
889
+ this.pool.set(params.id, player);
890
+ return player;
891
+ };
892
+ this.acquireElement = ({ ownerId, src }) => {
893
+ if (!this.allowConcurrentPlayback) {
894
+ if (!this.sharedAudio) {
895
+ this.sharedAudio = new Audio();
896
+ }
897
+ if (this.sharedOwnerId && this.sharedOwnerId !== ownerId) {
898
+ const previous = this.pool.get(this.sharedOwnerId);
899
+ previous?.pause();
900
+ previous?.releaseElementForHandoff();
901
+ }
902
+ this.sharedOwnerId = ownerId;
903
+ if (this.sharedAudio.src !== src) {
904
+ this.sharedAudio.src = src;
905
+ }
906
+ return this.sharedAudio;
907
+ }
908
+ let audio = this.audios.get(ownerId);
909
+ if (!audio) {
910
+ audio = new Audio();
911
+ this.audios.set(ownerId, audio);
912
+ }
913
+ if (audio.src !== src) {
914
+ audio.src = src;
915
+ }
916
+ return audio;
917
+ };
918
+ this.releaseElement = (ownerId) => {
919
+ if (!this.allowConcurrentPlayback) {
920
+ if (this.sharedOwnerId !== ownerId) return;
921
+ const el2 = this.sharedAudio;
922
+ if (el2) {
923
+ try {
924
+ el2.pause();
925
+ } catch {
926
+ }
927
+ el2.removeAttribute("src");
928
+ el2.load();
929
+ }
930
+ this.sharedOwnerId = null;
931
+ return;
932
+ }
933
+ const el = this.audios.get(ownerId);
934
+ if (!el) return;
935
+ try {
936
+ el.pause();
937
+ } catch {
938
+ }
939
+ el.removeAttribute("src");
940
+ el.load();
941
+ this.audios.delete(ownerId);
942
+ };
943
+ this.setActiveAudioPlayer = (activeAudioPlayer) => {
944
+ if (this.allowConcurrentPlayback) return;
945
+ this.state.partialNext({ activeAudioPlayer });
946
+ };
947
+ this.remove = (id) => {
948
+ const player = this.pool.get(id);
949
+ if (!player) return;
950
+ player.requestRemoval();
951
+ };
952
+ this.clear = () => {
953
+ this.players.forEach((player) => {
954
+ this.remove(player.id);
955
+ });
956
+ };
957
+ this.registerSubscriptions = () => {
958
+ this.players.forEach((p) => {
959
+ if (p.elementRef) {
960
+ p.registerSubscriptions();
961
+ }
962
+ });
963
+ };
964
+ this.allowConcurrentPlayback = !!config?.allowConcurrentPlayback;
965
+ }
966
+ get players() {
967
+ return Array.from(this.pool.values());
968
+ }
969
+ get activeAudioPlayer() {
970
+ return this.state.getLatestValue().activeAudioPlayer;
971
+ }
972
+ /** Removes the AudioPlayer instance from the pool of players */
973
+ deregister(id) {
974
+ if (this.pool.has(id)) {
975
+ this.pool.delete(id);
976
+ }
977
+ if (this.activeAudioPlayer?.id === id) {
978
+ this.setActiveAudioPlayer(null);
979
+ }
980
+ }
981
+ }
982
+ const NOTIFICATION_TARGET_PANELS = [
983
+ "channel",
984
+ "thread",
985
+ "channel-list",
986
+ "thread-list"
987
+ ];
988
+ const isNotificationTargetPanel = (value) => typeof value === "string" && NOTIFICATION_TARGET_PANELS.includes(value);
989
+ const getNotificationTargetPanel = (notification) => {
990
+ const targetTag = notification.tags?.find((tag) => tag.startsWith("target:"));
991
+ if (targetTag) {
992
+ const candidate = targetTag.slice("target:".length);
993
+ if (isNotificationTargetPanel(candidate)) return candidate;
994
+ }
995
+ const panel = notification.origin.context?.panel;
996
+ return isNotificationTargetPanel(panel) ? panel : void 0;
997
+ };
998
+ const getNotificationTargetTag = (panel) => `target:${panel}`;
999
+ const addNotificationTargetTag = (panel, tags) => {
1000
+ if (!panel) return tags ?? [];
1001
+ return Array.from(/* @__PURE__ */ new Set([getNotificationTargetTag(panel), ...tags ?? []]));
1002
+ };
1003
+ const isNotificationForPanel = (notification, panel, options) => {
1004
+ const fallbackPanel = options?.fallbackPanel ?? "channel";
1005
+ const resolvedPanel = getNotificationTargetPanel(notification) ?? fallbackPanel;
1006
+ return resolvedPanel === panel;
1007
+ };
1008
+ const audioPlayerNotificationsPluginFactory = ({
1009
+ client,
1010
+ panel = "channel",
1011
+ t
1012
+ }) => {
1013
+ const errors = {
1014
+ "failed-to-start": new Error(t("Failed to play the recording")),
1015
+ "not-playable": new Error(
1016
+ t("Recording format is not supported and cannot be reproduced")
1017
+ ),
1018
+ "seek-not-supported": new Error(t("Cannot seek in the recording"))
1019
+ };
1020
+ return {
1021
+ id: "AudioPlayerNotificationsPlugin",
1022
+ onError: ({ errCode, error: e }) => {
1023
+ const error = (errCode && errors[errCode]) ?? e ?? new Error(t("Error reproducing the recording"));
1024
+ client?.notifications.addError({
1025
+ message: error.message,
1026
+ options: {
1027
+ originalError: error,
1028
+ tags: addNotificationTargetTag(panel),
1029
+ type: "browser:audio:playback:error"
1030
+ },
1031
+ origin: {
1032
+ emitter: "AudioPlayer"
1033
+ }
1034
+ });
1035
+ }
1036
+ };
1037
+ };
1038
+ const variantToClass = {
1039
+ danger: "str-chat__button--destructive",
1040
+ primary: "str-chat__button--primary",
1041
+ secondary: "str-chat__button--secondary"
1042
+ };
1043
+ const appearanceToClass = {
1044
+ ghost: "str-chat__button--ghost",
1045
+ outline: "str-chat__button--outline",
1046
+ solid: "str-chat__button--solid"
1047
+ };
1048
+ const sizeToClass = {
1049
+ lg: "str-chat__button--size-lg",
1050
+ md: "str-chat__button--size-md",
1051
+ sm: "str-chat__button--size-sm",
1052
+ xs: "str-chat__button--size-xs"
1053
+ };
1054
+ const Button = forwardRef(function Button2({ appearance, children, circular, className, inverseTheme, size: size2, variant, ...props }, ref) {
1055
+ return /* @__PURE__ */ jsx(
1056
+ "button",
1057
+ {
1058
+ ref,
1059
+ type: "button",
1060
+ ...props,
1061
+ className: clsx(
1062
+ "str-chat__button",
1063
+ variant != null && variantToClass[variant],
1064
+ appearance != null && appearanceToClass[appearance],
1065
+ circular && "str-chat__button--circular",
1066
+ inverseTheme && "str-chat__theme-inverse",
1067
+ size2 != null && sizeToClass[size2],
1068
+ className
1069
+ ),
1070
+ children: /* @__PURE__ */ jsx("div", { className: "str-chat__button__content", children })
1071
+ }
1072
+ );
1073
+ });
1074
+ const BaseIcon = ({ className, ...props }) => /* @__PURE__ */ jsx(
1075
+ "svg",
1076
+ {
1077
+ viewBox: "0 0 20 20",
1078
+ xmlns: "http://www.w3.org/2000/svg",
1079
+ ...props,
1080
+ className: clsx("str-chat__icon", className)
1081
+ }
1082
+ );
1083
+ function toIconClass(name) {
1084
+ return "str-chat__icon--" + name.replace(/^Icon/, "").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Za-z])(\d)/g, "$1-$2").replace(/(\d)([A-Za-z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
1085
+ }
1086
+ function createIcon(name, content, defaultProps) {
1087
+ const iconClass = toIconClass(name);
1088
+ const Icon = ({ className, ...props }) => /* @__PURE__ */ jsx(BaseIcon, { ...defaultProps, ...props, className: clsx(iconClass, className), children: content });
1089
+ Icon.displayName = name;
1090
+ return Icon;
1091
+ }
1092
+ const IconLeave = createIcon(
1093
+ "IconLeave",
1094
+ /* @__PURE__ */ jsx(
1095
+ "path",
1096
+ {
1097
+ d: "M8.75 3.125H3.75V16.875H8.75M8.75 10H17.5M17.5 10L14.375 6.875M17.5 10L14.375 13.125",
1098
+ fill: "none",
1099
+ stroke: "currentColor",
1100
+ strokeLinecap: "round",
1101
+ strokeLinejoin: "round",
1102
+ strokeWidth: "1.5"
1103
+ }
1104
+ )
1105
+ );
1106
+ const IconArrowDown = createIcon(
1107
+ "IconArrowDown",
1108
+ /* @__PURE__ */ jsx("path", { d: "M7.39973 2.5C7.39973 2.16863 7.66895 1.90039 8.00032 1.90039C8.33154 1.90057 8.59993 2.16874 8.59993 2.5V12.0518L11.7425 8.90918C11.9768 8.67487 12.3568 8.67487 12.5911 8.90918C12.8253 9.14351 12.8254 9.52355 12.5911 9.75781L8.42415 13.9238C8.3117 14.0363 8.15933 14.0995 8.00032 14.0996C7.84119 14.0996 7.68804 14.0363 7.57552 13.9238L3.4095 9.75781C3.17519 9.5235 3.17519 9.14349 3.4095 8.90918C3.64377 8.67508 4.02288 8.67508 4.25716 8.90918L7.39973 12.0518V2.5Z" }),
1109
+ { viewBox: "0 0 16 16" }
1110
+ );
1111
+ const IconArrowDownCircle = createIcon(
1112
+ "IconArrowDownCircle",
1113
+ /* @__PURE__ */ jsx(
1114
+ "path",
1115
+ {
1116
+ d: "M7.5 10.625L10 13.125M10 13.125L12.5 10.625M10 13.125V6.875M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",
1117
+ fill: "none",
1118
+ stroke: "currentColor",
1119
+ strokeLinecap: "round",
1120
+ strokeLinejoin: "round",
1121
+ strokeWidth: "1.5"
1122
+ }
1123
+ )
1124
+ );
1125
+ const IconArrowLeft = createIcon(
1126
+ "IconArrowLeft",
1127
+ /* @__PURE__ */ jsx(
1128
+ "path",
1129
+ {
1130
+ d: "M16.875 10H3.125M3.125 10L8.75 4.375M3.125 10L8.75 15.625",
1131
+ fill: "none",
1132
+ stroke: "currentColor",
1133
+ strokeLinecap: "round",
1134
+ strokeLinejoin: "round",
1135
+ strokeWidth: "1.5"
1136
+ }
1137
+ )
1138
+ );
1139
+ const IconArrowRight = createIcon(
1140
+ "IconArrowRight",
1141
+ /* @__PURE__ */ jsx("path", { d: "M8.90918 3.4095C9.14349 3.17519 9.5235 3.17519 9.75781 3.4095L13.9238 7.57552C14.0363 7.68804 14.0996 7.84119 14.0996 8.00032C14.0995 8.15933 14.0363 8.3117 13.9238 8.42415L9.75781 12.5911C9.52355 12.8254 9.14351 12.8253 8.90918 12.5911C8.67487 12.3568 8.67487 11.9768 8.90918 11.7425L12.0518 8.59993H2.5C2.16874 8.59993 1.90057 8.33154 1.90039 8.00032C1.90039 7.66895 2.16863 7.39973 2.5 7.39973H12.0518L8.90918 4.25716C8.67508 4.02288 8.67508 3.64377 8.90918 3.4095Z" }),
1142
+ { viewBox: "0 0 16 16" }
1143
+ );
1144
+ const IconArrowUpRight = createIcon(
1145
+ "IconArrowUpRight",
1146
+ /* @__PURE__ */ jsx(
1147
+ "path",
1148
+ {
1149
+ d: "M5 15L15 5M15 5H6.875M15 5V13.125",
1150
+ fill: "none",
1151
+ stroke: "currentColor",
1152
+ strokeLinecap: "round",
1153
+ strokeLinejoin: "round",
1154
+ strokeWidth: "1.5"
1155
+ }
1156
+ )
1157
+ );
1158
+ const IconRetry = createIcon(
1159
+ "IconRetry",
1160
+ /* @__PURE__ */ jsx(
1161
+ "path",
1162
+ {
1163
+ d: "M14.3751 8.12481H18.1251M18.1251 8.12481V4.37481M18.1251 8.12481L14.8618 5.13809C13.9063 4.18263 12.6904 3.52991 11.3661 3.26151C10.0418 2.9931 8.66771 3.12091 7.41561 3.62896C6.1635 4.137 5.08887 5.00276 4.32599 6.11806C3.5631 7.23336 3.1458 8.54875 3.12621 9.89986C3.10662 11.251 3.48562 12.5779 4.21585 13.7148C4.94609 14.8518 5.99517 15.7483 7.23202 16.2925C8.46887 16.8366 9.83865 17.0042 11.1702 16.7743C12.5018 16.5444 13.736 15.9272 14.7188 14.9998",
1164
+ fill: "none",
1165
+ stroke: "currentColor",
1166
+ strokeLinecap: "round",
1167
+ strokeLinejoin: "round",
1168
+ strokeWidth: "1.5"
1169
+ }
1170
+ )
1171
+ );
1172
+ const IconRefresh = createIcon(
1173
+ "IconRefresh",
1174
+ /* @__PURE__ */ jsx(
1175
+ "path",
1176
+ {
1177
+ d: "M13.125 7.49978H16.875M16.875 7.49978V3.74978M16.875 7.49978L14.6656 5.29041C13.3861 4.01095 11.6538 3.2875 9.84437 3.27697C8.03494 3.26644 6.29431 3.96968 5 5.23416M6.875 12.4998H3.125M3.125 12.4998V16.2498M3.125 12.4998L5.33437 14.7092C6.61388 15.9886 8.34621 16.7121 10.1556 16.7226C11.9651 16.7331 13.7057 16.0299 15 14.7654",
1178
+ fill: "none",
1179
+ stroke: "currentColor",
1180
+ strokeLinecap: "round",
1181
+ strokeLinejoin: "round",
1182
+ strokeWidth: "1.5"
1183
+ }
1184
+ )
1185
+ );
1186
+ const IconReply = createIcon(
1187
+ "IconReply",
1188
+ /* @__PURE__ */ jsx(
1189
+ "path",
1190
+ {
1191
+ d: "M17.5812 15.525C16.2953 14.1555 12.9195 11.25 8.12265 11.25V15L1.87265 8.75L8.12265 2.5V6.25C12.2476 6.25 17.5359 10.1914 18.1226 15.2766C18.1308 15.3424 18.1177 15.4091 18.0854 15.4671C18.0531 15.525 18.0031 15.5712 17.9428 15.5988C17.8825 15.6265 17.815 15.6343 17.75 15.621C17.685 15.6077 17.6259 15.5741 17.5812 15.525Z",
1192
+ fill: "none",
1193
+ stroke: "currentColor",
1194
+ strokeLinecap: "round",
1195
+ strokeLinejoin: "round",
1196
+ strokeWidth: "1.5"
1197
+ }
1198
+ )
1199
+ );
1200
+ const IconArrowUp = createIcon(
1201
+ "IconArrowUp",
1202
+ /* @__PURE__ */ jsx(
1203
+ "path",
1204
+ {
1205
+ d: "M10 16.875V3.125M10 3.125L4.375 8.75M10 3.125L15.625 8.75",
1206
+ fill: "none",
1207
+ stroke: "currentColor",
1208
+ strokeLinecap: "round",
1209
+ strokeLinejoin: "round",
1210
+ strokeWidth: "1.5"
1211
+ }
1212
+ )
1213
+ );
1214
+ const IconBell = createIcon(
1215
+ "IconBell",
1216
+ /* @__PURE__ */ jsx(
1217
+ "path",
1218
+ {
1219
+ d: "M7.50015 15C7.50015 15.663 7.76354 16.2989 8.23238 16.7678C8.70122 17.2366 9.33711 17.5 10.0001 17.5C10.6632 17.5 11.2991 17.2366 11.7679 16.7678C12.2368 16.2989 12.5001 15.663 12.5001 15M4.37515 8.125C4.37515 6.63316 4.96778 5.20242 6.02267 4.14752C7.07756 3.09263 8.5083 2.5 10.0001 2.5C11.492 2.5 12.9227 3.09263 13.9776 4.14752C15.0325 5.20242 15.6251 6.63316 15.6251 8.125C15.6251 10.9234 16.2736 13.1719 16.7892 14.0625C16.844 14.1574 16.8728 14.2649 16.8729 14.3745C16.873 14.484 16.8444 14.5916 16.7898 14.6865C16.7352 14.7815 16.6566 14.8604 16.5619 14.9154C16.4672 14.9705 16.3597 14.9996 16.2501 15H3.75015C3.64076 14.9993 3.53345 14.97 3.43896 14.9149C3.34448 14.8597 3.26611 14.7808 3.2117 14.6859C3.15729 14.591 3.12874 14.4835 3.12891 14.3741C3.12907 14.2647 3.15795 14.1572 3.21265 14.0625C3.72749 13.1719 4.37515 10.9227 4.37515 8.125Z",
1220
+ fill: "none",
1221
+ stroke: "currentColor",
1222
+ strokeLinecap: "round",
1223
+ strokeLinejoin: "round",
1224
+ strokeWidth: "1.5"
1225
+ }
1226
+ )
1227
+ );
1228
+ const IconBellOff = createIcon(
1229
+ "IconBellOff",
1230
+ /* @__PURE__ */ jsx(
1231
+ "path",
1232
+ {
1233
+ d: "M3.75015 3.12492L10.0001 9.99992C10.0001 9.99992 13.8094 14.1901 16.2501 16.8749M7.50015 14.9999C7.50015 15.663 7.76354 16.2988 8.23238 16.7677C8.70122 17.2365 9.33711 17.4999 10.0001 17.4999C10.6632 17.4999 11.2991 17.2365 11.7679 16.7677C12.2368 16.2988 12.5001 15.663 12.5001 14.9999M7.22515 3.23117C8.0809 2.74583 9.04899 2.49341 10.0328 2.49912C11.0166 2.50482 11.9817 2.76845 12.8317 3.26369C13.6818 3.75893 14.3871 4.46846 14.8773 5.32147C15.3674 6.17447 15.6253 7.14111 15.6251 8.12492C15.6251 10.3984 16.0533 12.3093 16.49 13.4218M14.5455 14.9999H3.75015C3.64076 14.9993 3.53345 14.9699 3.43896 14.9148C3.34448 14.8597 3.26611 14.7807 3.2117 14.6858C3.15729 14.5909 3.12874 14.4834 3.12891 14.374C3.12907 14.2646 3.15795 14.1572 3.21265 14.0624C3.72749 13.1718 4.37515 10.9226 4.37515 8.12492C4.37327 6.97806 4.72371 5.85829 5.37905 4.91711",
1234
+ fill: "none",
1235
+ stroke: "currentColor",
1236
+ strokeLinecap: "round",
1237
+ strokeLinejoin: "round",
1238
+ strokeWidth: "1.5"
1239
+ }
1240
+ )
1241
+ );
1242
+ const IconSave = createIcon(
1243
+ "IconSave",
1244
+ /* @__PURE__ */ jsx(
1245
+ "path",
1246
+ {
1247
+ d: "M15 17.5L10 14.375L5 17.5V3.75C5 3.58424 5.06585 3.42527 5.18306 3.30806C5.30027 3.19085 5.45924 3.125 5.625 3.125H14.375C14.5408 3.125 14.6997 3.19085 14.8169 3.30806C14.9342 3.42527 15 3.58424 15 3.75V17.5Z",
1248
+ fill: "none",
1249
+ stroke: "currentColor",
1250
+ strokeLinecap: "round",
1251
+ strokeLinejoin: "round",
1252
+ strokeWidth: "1.5"
1253
+ }
1254
+ )
1255
+ );
1256
+ const IconUnsave = createIcon(
1257
+ "IconUnsave",
1258
+ /* @__PURE__ */ jsx(
1259
+ "path",
1260
+ {
1261
+ d: "M5 6.49074V17.5L10 14.375L15 17.5V16M5.125 3.125H14.375C14.5408 3.125 14.6997 3.19085 14.8169 3.30806C14.9342 3.42527 15 3.58424 15 3.75V13M5.125 3.125L3.5 1.5M5.125 3.125L15 13M15 13L17.5 15.5",
1262
+ fill: "none",
1263
+ stroke: "currentColor",
1264
+ strokeLinecap: "round",
1265
+ strokeLinejoin: "round",
1266
+ strokeWidth: "1.5"
1267
+ }
1268
+ )
1269
+ );
1270
+ const IconMessageBubbles = createIcon(
1271
+ "IconMessageBubbles",
1272
+ /* @__PURE__ */ jsx(
1273
+ "path",
1274
+ {
1275
+ d: "M12.8076 6.25836C13.7525 6.30974 14.6692 6.59868 15.4728 7.09845C16.2764 7.59821 16.941 8.29265 17.4049 9.11746C17.8688 9.94227 18.1172 10.8708 18.1269 11.8171C18.1367 12.7634 17.9075 13.6968 17.4607 14.531L18.0982 16.6998C18.1298 16.8075 18.1319 16.9217 18.1041 17.0304C18.0764 17.1392 18.0198 17.2385 17.9405 17.3178C17.8611 17.3972 17.7618 17.4537 17.6531 17.4815C17.5443 17.5092 17.4301 17.5072 17.3224 17.4756L15.156 16.8357C14.4404 17.2184 13.6504 17.4419 12.8404 17.4907C12.0303 17.5396 11.2192 17.4127 10.4628 17.1188C9.70632 16.8249 9.02237 16.3708 8.45781 15.7878C7.89325 15.2049 7.46143 14.5067 7.19195 13.7412M2.53882 10.781C1.90215 9.59158 1.71418 8.21294 2.00918 6.89647C2.30419 5.58 3.06253 4.41341 4.14591 3.60942C5.22929 2.80543 6.56555 2.4176 7.91103 2.51665C9.2565 2.6157 10.5216 3.19503 11.4755 4.149C12.4295 5.10297 13.0088 6.36803 13.1079 7.7135C13.2069 9.05898 12.8191 10.3952 12.0151 11.4786C11.2111 12.562 10.0445 13.3203 8.72806 13.6153C7.41159 13.9104 6.03295 13.7224 4.84351 13.0857L2.67476 13.7232C2.56707 13.7548 2.45285 13.7569 2.3441 13.7291C2.23535 13.7014 2.13608 13.6448 2.05671 13.5655C1.97735 13.4861 1.92082 13.3868 1.89307 13.2781C1.86531 13.1693 1.86735 13.0551 1.89898 12.9474L2.53882 10.781Z",
1276
+ fill: "none",
1277
+ stroke: "currentColor",
1278
+ strokeLinecap: "round",
1279
+ strokeLinejoin: "round",
1280
+ strokeWidth: "1.5"
1281
+ }
1282
+ )
1283
+ );
1284
+ const IconMessageBubble = createIcon(
1285
+ "IconMessageBubble",
1286
+ /* @__PURE__ */ jsx(
1287
+ "path",
1288
+ {
1289
+ d: "M6.24431 16.4932C7.81972 17.405 9.67297 17.7127 11.4585 17.359C13.2441 17.0053 14.84 16.0143 15.9489 14.5708C17.0578 13.1273 17.6038 11.3298 17.4852 9.51341C17.3667 7.69704 16.5916 5.98577 15.3045 4.69866C14.0174 3.41156 12.3061 2.63646 10.4897 2.51789C8.67333 2.39932 6.87582 2.94537 5.43231 4.05422C3.9888 5.16308 2.99781 6.75906 2.64412 8.54461C2.29042 10.3302 2.59815 12.1834 3.50993 13.7588L2.53259 16.6768C2.49586 16.7869 2.49053 16.9051 2.5172 17.0181C2.54386 17.131 2.60146 17.2344 2.68355 17.3165C2.76563 17.3985 2.86895 17.4561 2.98194 17.4828C3.09492 17.5095 3.21309 17.5041 3.32321 17.4674L6.24431 16.4932Z",
1290
+ fill: "none",
1291
+ stroke: "currentColor",
1292
+ strokeLinecap: "round",
1293
+ strokeLinejoin: "round",
1294
+ strokeWidth: "1.5"
1295
+ }
1296
+ )
1297
+ );
1298
+ const IconMessageBubbleFill = createIcon(
1299
+ "IconMessageBubbleFill",
1300
+ /* @__PURE__ */ jsx("path", { d: "M18.125 10.0001C18.1253 11.4028 17.7624 12.7818 17.0717 14.0027C16.381 15.2236 15.3859 16.2449 14.1834 16.9671C12.9808 17.6894 11.6118 18.088 10.2095 18.1242C8.80719 18.1603 7.41942 17.8328 6.18125 17.1735L3.52109 18.0602C3.30085 18.1337 3.0645 18.1444 2.83854 18.091C2.61257 18.0377 2.40593 17.9225 2.24176 17.7583C2.07759 17.5942 1.96239 17.3875 1.90906 17.1615C1.85573 16.9356 1.86639 16.6992 1.93984 16.479L2.82656 13.8188C2.24699 12.7292 1.92328 11.5218 1.88 10.2883C1.83672 9.0549 2.075 7.8278 2.57677 6.70019C3.07854 5.57258 3.8306 4.57411 4.77587 3.78055C5.72114 2.98699 6.83478 2.41921 8.03224 2.1203C9.22971 1.82139 10.4795 1.79922 11.6868 2.05545C12.8942 2.31169 14.0272 2.8396 15.0001 3.59912C15.9729 4.35865 16.7599 5.32981 17.3014 6.43891C17.8428 7.548 18.1245 8.76588 18.125 10.0001Z" })
1301
+ );
1302
+ const IconBubble3ChatMessage = createIcon(
1303
+ "IconBubble3ChatMessage",
1304
+ /* @__PURE__ */ jsx("path", { d: "M13.5667 8.00031C13.5667 4.92603 11.0745 2.4331 8.00031 2.43292C4.92592 2.43292 2.43292 4.92592 2.43292 8.00031C2.43297 8.84133 2.61967 9.63756 2.95245 10.3509C3.07245 10.6082 3.11534 10.9117 3.0423 11.2122L2.50323 13.4319C2.49184 13.4799 2.53435 13.5227 2.58234 13.512L4.89679 12.9925C5.18423 12.9279 5.4722 12.9685 5.71906 13.0794C6.4143 13.3921 7.18646 13.5667 8.00031 13.5667C11.0744 13.5665 13.5665 11.0744 13.5667 8.00031ZM14.7669 8.00031C14.7667 11.7372 11.7372 14.7667 8.00031 14.7669C7.01349 14.7669 6.07389 14.5551 5.22687 14.1741C5.19459 14.1597 5.17067 14.1609 5.15948 14.1634L2.84601 14.6829C1.92949 14.889 1.11544 14.0605 1.33722 13.1478L1.87628 10.928C1.87907 10.9163 1.88025 10.8913 1.86456 10.8577C1.45928 9.9889 1.23375 9.02014 1.2337 8.00031C1.2337 4.26318 4.26318 1.2337 8.00031 1.2337C11.7373 1.23388 14.7669 4.26329 14.7669 8.00031Z" }),
1305
+ { viewBox: "0 0 16 16" }
1306
+ );
1307
+ const IconThread = createIcon(
1308
+ "IconThread",
1309
+ /* @__PURE__ */ jsx(
1310
+ "path",
1311
+ {
1312
+ d: "M7.49978 8.75022H12.4998M7.49978 11.2502H12.4998M6.24431 16.4932C7.81972 17.405 9.67297 17.7127 11.4585 17.359C13.2441 17.0053 14.84 16.0143 15.9489 14.5708C17.0578 13.1273 17.6038 11.3298 17.4852 9.51341C17.3667 7.69704 16.5916 5.98577 15.3045 4.69866C14.0174 3.41156 12.3061 2.63646 10.4897 2.51789C8.67333 2.39932 6.87582 2.94537 5.43231 4.05422C3.9888 5.16308 2.99781 6.75906 2.64412 8.54461C2.29042 10.3302 2.59815 12.1834 3.50993 13.7588L2.53259 16.6768C2.49586 16.7869 2.49053 16.9051 2.5172 17.0181C2.54386 17.131 2.60146 17.2344 2.68355 17.3165C2.76563 17.3985 2.86895 17.4561 2.98194 17.4828C3.09492 17.5095 3.21309 17.5041 3.32321 17.4674L6.24431 16.4932Z",
1313
+ fill: "none",
1314
+ stroke: "currentColor",
1315
+ strokeLinecap: "round",
1316
+ strokeLinejoin: "round",
1317
+ strokeWidth: "1.5"
1318
+ }
1319
+ )
1320
+ );
1321
+ const IconBubbleText6SolidChatMessage = createIcon(
1322
+ "IconBubbleText6SolidChatMessage",
1323
+ /* @__PURE__ */ jsx("path", { d: "M1.33337 5.83333C1.33337 3.71624 3.04961 2 5.16671 2H10.8334C12.9504 2 14.6667 3.71624 14.6667 5.83333V10.1667C14.6667 12.2837 12.9504 14 10.8334 14H1.83337C1.55723 14 1.33337 13.7761 1.33337 13.5V5.83333ZM5.83337 6C5.55723 6 5.33337 6.22386 5.33337 6.5C5.33337 6.77613 5.55723 7 5.83337 7H10.1667C10.4428 7 10.6667 6.77613 10.6667 6.5C10.6667 6.22386 10.4428 6 10.1667 6H5.83337ZM5.83337 9C5.55723 9 5.33337 9.22387 5.33337 9.5C5.33337 9.77613 5.55723 10 5.83337 10H8.16671C8.44284 10 8.66671 9.77613 8.66671 9.5C8.66671 9.22387 8.44284 9 8.16671 9H5.83337Z" }),
1324
+ { viewBox: "0 0 16 16" }
1325
+ );
1326
+ const IconThreadFill = createIcon(
1327
+ "IconThreadFill",
1328
+ /* @__PURE__ */ jsx("path", { d: "M10.3125 1.875C8.24119 1.87727 6.25538 2.70111 4.79074 4.16574C3.32611 5.63038 2.50227 7.61619 2.5 9.6875V16.25C2.5 16.5815 2.6317 16.8995 2.86612 17.1339C3.10054 17.3683 3.41848 17.5 3.75 17.5H10.3125C12.3845 17.5 14.3716 16.6769 15.8368 15.2118C17.3019 13.7466 18.125 11.7595 18.125 9.6875C18.125 7.6155 17.3019 5.62836 15.8368 4.16323C14.3716 2.6981 12.3845 1.875 10.3125 1.875ZM12.8125 11.875H7.5C7.33424 11.875 7.17527 11.8092 7.05806 11.6919C6.94085 11.5747 6.875 11.4158 6.875 11.25C6.875 11.0842 6.94085 10.9253 7.05806 10.8081C7.17527 10.6908 7.33424 10.625 7.5 10.625H12.8125C12.9783 10.625 13.1372 10.6908 13.2544 10.8081C13.3717 10.9253 13.4375 11.0842 13.4375 11.25C13.4375 11.4158 13.3717 11.5747 13.2544 11.6919C13.1372 11.8092 12.9783 11.875 12.8125 11.875ZM12.8125 9.375H7.5C7.33424 9.375 7.17527 9.30915 7.05806 9.19194C6.94085 9.07473 6.875 8.91576 6.875 8.75C6.875 8.58424 6.94085 8.42527 7.05806 8.30806C7.17527 8.19085 7.33424 8.125 7.5 8.125H12.8125C12.9783 8.125 13.1372 8.19085 13.2544 8.30806C13.3717 8.42527 13.4375 8.58424 13.4375 8.75C13.4375 8.91576 13.3717 9.07473 13.2544 9.19194C13.1372 9.30915 12.9783 9.375 12.8125 9.375Z" })
1329
+ );
1330
+ const IconNotification = createIcon(
1331
+ "IconNotification",
1332
+ /* @__PURE__ */ jsx(
1333
+ "path",
1334
+ {
1335
+ d: "M16.25 10V16.25C16.25 16.4158 16.1842 16.5747 16.0669 16.6919C15.9497 16.8092 15.7908 16.875 15.625 16.875H3.75C3.58424 16.875 3.42527 16.8092 3.30806 16.6919C3.19085 16.5747 3.125 16.4158 3.125 16.25V4.375C3.125 4.20924 3.19085 4.05027 3.30806 3.93306C3.42527 3.81585 3.58424 3.75 3.75 3.75H10M17.5 4.6875C17.5 5.89562 16.5206 6.875 15.3125 6.875C14.1044 6.875 13.125 5.89562 13.125 4.6875C13.125 3.47938 14.1044 2.5 15.3125 2.5C16.5206 2.5 17.5 3.47938 17.5 4.6875Z",
1336
+ fill: "none",
1337
+ stroke: "currentColor",
1338
+ strokeLinecap: "round",
1339
+ strokeLinejoin: "round",
1340
+ strokeWidth: "1.5"
1341
+ }
1342
+ )
1343
+ );
1344
+ const IconCamera = createIcon(
1345
+ "IconCamera",
1346
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1347
+ /* @__PURE__ */ jsx(
1348
+ "path",
1349
+ {
1350
+ d: "M16.25 16.25H3.75C3.41848 16.25 3.10054 16.1183 2.86612 15.8839C2.6317 15.6495 2.5 15.3315 2.5 15V6.25C2.5 5.91848 2.6317 5.60054 2.86612 5.36612C3.10054 5.1317 3.41848 5 3.75 5H6.25L7.5 3.125H12.5L13.75 5H16.25C16.5815 5 16.8995 5.1317 17.1339 5.36612C17.3683 5.60054 17.5 5.91848 17.5 6.25V15C17.5 15.3315 17.3683 15.6495 17.1339 15.8839C16.8995 16.1183 16.5815 16.25 16.25 16.25Z",
1351
+ fill: "none",
1352
+ stroke: "currentColor",
1353
+ strokeLinecap: "round",
1354
+ strokeLinejoin: "round",
1355
+ strokeWidth: "1.5"
1356
+ }
1357
+ ),
1358
+ /* @__PURE__ */ jsx(
1359
+ "path",
1360
+ {
1361
+ d: "M10 13.125C11.5533 13.125 12.8125 11.8658 12.8125 10.3125C12.8125 8.7592 11.5533 7.5 10 7.5C8.4467 7.5 7.1875 8.7592 7.1875 10.3125C7.1875 11.8658 8.4467 13.125 10 13.125Z",
1362
+ fill: "none",
1363
+ stroke: "currentColor",
1364
+ strokeLinecap: "round",
1365
+ strokeLinejoin: "round",
1366
+ strokeWidth: "1.5"
1367
+ }
1368
+ )
1369
+ ] })
1370
+ );
1371
+ const IconLink = createIcon(
1372
+ "IconLink",
1373
+ /* @__PURE__ */ jsx(
1374
+ "path",
1375
+ {
1376
+ d: "M7.49989 12.4999L12.4999 7.49989M8.74989 5.94598L11.0983 3.60223C11.8035 2.90843 12.7543 2.52139 13.7436 2.52542C14.7328 2.52945 15.6804 2.92422 16.3799 3.62374C17.0795 4.32326 17.4742 5.27086 17.4783 6.26012C17.4823 7.24938 17.0953 8.20016 16.4015 8.90536L14.053 11.2499M5.94598 8.74989L3.60223 11.0983C2.90843 11.8035 2.52139 12.7543 2.52542 13.7436C2.52945 14.7328 2.92422 15.6804 3.62374 16.3799C4.32326 17.0795 5.27086 17.4742 6.26012 17.4783C7.24938 17.4823 8.20016 17.0953 8.90536 16.4015L11.2499 14.053",
1377
+ fill: "none",
1378
+ stroke: "currentColor",
1379
+ strokeLinecap: "round",
1380
+ strokeLinejoin: "round",
1381
+ strokeWidth: "1.5"
1382
+ }
1383
+ )
1384
+ );
1385
+ const IconPoll = createIcon(
1386
+ "IconPoll",
1387
+ /* @__PURE__ */ jsx(
1388
+ "path",
1389
+ {
1390
+ d: "M3.75 16.25V10.625H7.5M17.5 16.25H2.5M7.5 16.25V6.875H11.875M11.875 16.25V3.125H16.25V16.25",
1391
+ fill: "none",
1392
+ stroke: "currentColor",
1393
+ strokeLinecap: "round",
1394
+ strokeLinejoin: "round",
1395
+ strokeWidth: "1.5"
1396
+ }
1397
+ )
1398
+ );
1399
+ const IconCheckmark1Small = createIcon(
1400
+ "IconCheckmark1Small",
1401
+ /* @__PURE__ */ jsx(
1402
+ "path",
1403
+ {
1404
+ d: "M3.125 11.25L7.5 15.625L17.5 5.625",
1405
+ fill: "none",
1406
+ stroke: "currentColor",
1407
+ strokeLinecap: "round",
1408
+ strokeLinejoin: "round",
1409
+ strokeWidth: "1.5"
1410
+ }
1411
+ )
1412
+ );
1413
+ const IconCheckmark = createIcon(
1414
+ "IconCheckmark",
1415
+ /* @__PURE__ */ jsx(
1416
+ "path",
1417
+ {
1418
+ d: "M3.125 11.25L7.5 15.625L17.5 5.625",
1419
+ fill: "none",
1420
+ stroke: "currentColor",
1421
+ strokeLinecap: "round",
1422
+ strokeLinejoin: "round",
1423
+ strokeWidth: "1.5"
1424
+ }
1425
+ )
1426
+ );
1427
+ const IconChevronDown = createIcon(
1428
+ "IconChevronDown",
1429
+ /* @__PURE__ */ jsx(
1430
+ "path",
1431
+ {
1432
+ d: "M16.25 7.5L10 13.75L3.75 7.5",
1433
+ fill: "none",
1434
+ stroke: "currentColor",
1435
+ strokeLinecap: "round",
1436
+ strokeLinejoin: "round",
1437
+ strokeWidth: "1.5"
1438
+ }
1439
+ )
1440
+ );
1441
+ const IconChevronLeft = createIcon(
1442
+ "IconChevronLeft",
1443
+ /* @__PURE__ */ jsx(
1444
+ "path",
1445
+ {
1446
+ d: "M12.5 16.25L6.25 10L12.5 3.75",
1447
+ fill: "none",
1448
+ stroke: "currentColor",
1449
+ strokeLinecap: "round",
1450
+ strokeLinejoin: "round",
1451
+ strokeWidth: "1.5"
1452
+ }
1453
+ )
1454
+ );
1455
+ const IconChevronRight = createIcon(
1456
+ "IconChevronRight",
1457
+ /* @__PURE__ */ jsx(
1458
+ "path",
1459
+ {
1460
+ d: "M7.5 3.75L13.75 10L7.5 16.25",
1461
+ fill: "none",
1462
+ stroke: "currentColor",
1463
+ strokeLinecap: "round",
1464
+ strokeLinejoin: "round",
1465
+ strokeWidth: "1.5"
1466
+ }
1467
+ )
1468
+ );
1469
+ const IconNoSign = createIcon(
1470
+ "IconNoSign",
1471
+ /* @__PURE__ */ jsx(
1472
+ "path",
1473
+ {
1474
+ d: "M15.3031 15.3031L4.69688 4.69688M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",
1475
+ fill: "none",
1476
+ stroke: "currentColor",
1477
+ strokeLinecap: "round",
1478
+ strokeMiterlimit: "10",
1479
+ strokeWidth: "1.5"
1480
+ }
1481
+ )
1482
+ );
1483
+ const IconInfo = createIcon(
1484
+ "IconInfo",
1485
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1486
+ /* @__PURE__ */ jsx("path", { d: "M16.75 10C16.75 6.27208 13.7279 3.25 10 3.25C6.27208 3.25 3.25 6.27208 3.25 10C3.25 13.7279 6.27208 16.75 10 16.75C13.7279 16.75 16.75 13.7279 16.75 10ZM18.25 10C18.25 14.5563 14.5563 18.25 10 18.25C5.44365 18.25 1.75 14.5563 1.75 10C1.75 5.44365 5.44365 1.75 10 1.75C14.5563 1.75 18.25 5.44365 18.25 10Z" }),
1487
+ /* @__PURE__ */ jsx("path", { d: "M10.75 13.0107C11.1047 13.0703 11.375 13.3784 11.375 13.75C11.375 14.1642 11.0392 14.5 10.625 14.5C10.2603 14.5 9.91021 14.3555 9.65234 14.0977C9.39448 13.8398 9.25 13.4897 9.25 13.125V10.1133C8.89539 10.0537 8.625 9.74655 8.625 9.375C8.625 8.96079 8.96079 8.625 9.375 8.625C9.69403 8.625 10.0014 8.73611 10.2461 8.93652L10.3477 9.02734L10.4385 9.12891C10.6389 9.37356 10.75 9.68097 10.75 10V13.0107Z" }),
1488
+ /* @__PURE__ */ jsx("path", { d: "M9.6875 7.5C10.2053 7.5 10.625 7.08027 10.625 6.5625C10.625 6.04473 10.2053 5.625 9.6875 5.625C9.16973 5.625 8.75 6.04473 8.75 6.5625C8.75 7.08027 9.16973 7.5 9.6875 7.5Z" })
1489
+ ] })
1490
+ );
1491
+ const IconMinusCircle = createIcon(
1492
+ "IconMinusCircle",
1493
+ /* @__PURE__ */ jsx(
1494
+ "path",
1495
+ {
1496
+ d: "M6.875 10H13.125M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",
1497
+ fill: "none",
1498
+ stroke: "currentColor",
1499
+ strokeLinecap: "round",
1500
+ strokeMiterlimit: "10",
1501
+ strokeWidth: "1.5"
1502
+ }
1503
+ )
1504
+ );
1505
+ const IconXCircle = createIcon(
1506
+ "IconXCircle",
1507
+ /* @__PURE__ */ jsx(
1508
+ "path",
1509
+ {
1510
+ d: "M12.5 7.5L7.5 12.5M7.5 7.5L12.5 12.5M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",
1511
+ fill: "none",
1512
+ stroke: "currentColor",
1513
+ strokeLinecap: "round",
1514
+ strokeLinejoin: "round",
1515
+ strokeWidth: "1.5"
1516
+ }
1517
+ )
1518
+ );
1519
+ const IconClock = createIcon(
1520
+ "IconClock",
1521
+ /* @__PURE__ */ jsx(
1522
+ "path",
1523
+ {
1524
+ d: "M10 5.625V10H14.375M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z",
1525
+ fill: "none",
1526
+ stroke: "currentColor",
1527
+ strokeLinecap: "round",
1528
+ strokeLinejoin: "round",
1529
+ strokeWidth: "1.5"
1530
+ }
1531
+ )
1532
+ );
1533
+ const IconQuote = createIcon(
1534
+ "IconQuote",
1535
+ /* @__PURE__ */ jsx(
1536
+ "path",
1537
+ {
1538
+ d: "M8.4375 11.25H3.125C2.95924 11.25 2.80027 11.1842 2.68306 11.0669C2.56585 10.9497 2.5 10.7908 2.5 10.625V5.625C2.5 5.45924 2.56585 5.30027 2.68306 5.18306C2.80027 5.06585 2.95924 5 3.125 5H7.8125C7.97826 5 8.13723 5.06585 8.25444 5.18306C8.37165 5.30027 8.4375 5.45924 8.4375 5.625V12.5C8.4375 13.3288 8.10826 14.1237 7.52221 14.7097C6.93616 15.2958 6.1413 15.625 5.3125 15.625M17.5 11.25H12.1875C12.0217 11.25 11.8628 11.1842 11.7456 11.0669C11.6283 10.9497 11.5625 10.7908 11.5625 10.625V5.625C11.5625 5.45924 11.6283 5.30027 11.7456 5.18306C11.8628 5.06585 12.0217 5 12.1875 5H16.875C17.0408 5 17.1997 5.06585 17.3169 5.18306C17.4342 5.30027 17.5 5.45924 17.5 5.625V12.5C17.5 13.3288 17.1708 14.1237 16.5847 14.7097C15.9987 15.2958 15.2038 15.625 14.375 15.625",
1539
+ fill: "none",
1540
+ stroke: "currentColor",
1541
+ strokeLinecap: "round",
1542
+ strokeLinejoin: "round",
1543
+ strokeWidth: "1.5"
1544
+ }
1545
+ )
1546
+ );
1547
+ const IconXmark = createIcon(
1548
+ "IconXmark",
1549
+ /* @__PURE__ */ jsx(
1550
+ "path",
1551
+ {
1552
+ d: "M15.625 4.375L4.375 15.625M15.625 15.625L4.375 4.375",
1553
+ fill: "none",
1554
+ stroke: "currentColor",
1555
+ strokeLinecap: "round",
1556
+ strokeLinejoin: "round",
1557
+ strokeWidth: "1.5"
1558
+ }
1559
+ )
1560
+ );
1561
+ const IconCrossSmall = createIcon(
1562
+ "IconCrossSmall",
1563
+ /* @__PURE__ */ jsx(
1564
+ "path",
1565
+ {
1566
+ d: "M15.625 4.375L4.375 15.625M15.625 15.625L4.375 4.375",
1567
+ fill: "none",
1568
+ stroke: "currentColor",
1569
+ strokeLinecap: "round",
1570
+ strokeLinejoin: "round",
1571
+ strokeWidth: "1.5"
1572
+ }
1573
+ )
1574
+ );
1575
+ const IconMore = createIcon(
1576
+ "IconMore",
1577
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1578
+ /* @__PURE__ */ jsx("path", { d: "M10 11.25C10.6904 11.25 11.25 10.6904 11.25 10C11.25 9.30964 10.6904 8.75 10 8.75C9.30964 8.75 8.75 9.30964 8.75 10C8.75 10.6904 9.30964 11.25 10 11.25Z" }),
1579
+ /* @__PURE__ */ jsx("path", { d: "M4.6875 11.25C5.37786 11.25 5.9375 10.6904 5.9375 10C5.9375 9.30964 5.37786 8.75 4.6875 8.75C3.99714 8.75 3.4375 9.30964 3.4375 10C3.4375 10.6904 3.99714 11.25 4.6875 11.25Z" }),
1580
+ /* @__PURE__ */ jsx("path", { d: "M15.3125 11.25C16.0029 11.25 16.5625 10.6904 16.5625 10C16.5625 9.30964 16.0029 8.75 15.3125 8.75C14.6221 8.75 14.0625 9.30964 14.0625 10C14.0625 10.6904 14.6221 11.25 15.3125 11.25Z" })
1581
+ ] })
1582
+ );
1583
+ const IconReorder = createIcon(
1584
+ "IconReorder",
1585
+ /* @__PURE__ */ jsx("path", { d: "M8.875 15.3125C8.875 16.2445 8.11948 17 7.1875 17C6.25552 17 5.5 16.2445 5.5 15.3125C5.5 14.3805 6.25552 13.625 7.1875 13.625C8.11948 13.625 8.875 14.3805 8.875 15.3125ZM14.5 15.3125C14.5 16.2445 13.7445 17 12.8125 17C11.8805 17 11.125 16.2445 11.125 15.3125C11.125 14.3805 11.8805 13.625 12.8125 13.625C13.7445 13.625 14.5 14.3805 14.5 15.3125ZM8.875 10C8.875 10.932 8.11948 11.6875 7.1875 11.6875C6.25552 11.6875 5.5 10.932 5.5 10C5.5 9.06802 6.25552 8.3125 7.1875 8.3125C8.11948 8.3125 8.875 9.06802 8.875 10ZM14.5 10C14.5 10.932 13.7445 11.6875 12.8125 11.6875C11.8805 11.6875 11.125 10.932 11.125 10C11.125 9.06802 11.8805 8.3125 12.8125 8.3125C13.7445 8.3125 14.5 9.06802 14.5 10ZM8.875 4.6875C8.875 5.61948 8.11948 6.375 7.1875 6.375C6.25552 6.375 5.5 5.61948 5.5 4.6875C5.5 3.75552 6.25552 3 7.1875 3C8.11948 3 8.875 3.75552 8.875 4.6875ZM14.5 4.6875C14.5 5.61948 13.7445 6.375 12.8125 6.375C11.8805 6.375 11.125 5.61948 11.125 4.6875C11.125 3.75552 11.8805 3 12.8125 3C13.7445 3 14.5 3.75552 14.5 4.6875Z" })
1586
+ );
1587
+ const IconChecks = createIcon(
1588
+ "IconChecks",
1589
+ /* @__PURE__ */ jsx(
1590
+ "path",
1591
+ {
1592
+ d: "M1.5 10.5724L4.98387 13.9936L13.1129 6.00977M10.371 13.9936L18.5 6.00977",
1593
+ fill: "none",
1594
+ stroke: "currentColor",
1595
+ strokeLinecap: "round",
1596
+ strokeLinejoin: "round",
1597
+ strokeWidth: "1.5"
1598
+ }
1599
+ )
1600
+ );
1601
+ const IconEdit = createIcon(
1602
+ "IconEdit",
1603
+ /* @__PURE__ */ jsx(
1604
+ "path",
1605
+ {
1606
+ d: "M10.625 5.0001L15 9.3751M7.24141 16.8751H3.75C3.58424 16.8751 3.42527 16.8093 3.30806 16.692C3.19085 16.5748 3.125 16.4159 3.125 16.2501V12.7587C3.12508 12.5932 3.19082 12.4344 3.30781 12.3173L12.9422 2.68291C13.0594 2.56579 13.2183 2.5 13.384 2.5C13.5497 2.5 13.7086 2.56579 13.8258 2.68291L17.3172 6.17198C17.4343 6.28917 17.5001 6.44808 17.5001 6.61377C17.5001 6.77946 17.4343 6.93837 17.3172 7.05557L7.68281 16.6923C7.56569 16.8093 7.40695 16.875 7.24141 16.8751Z",
1607
+ fill: "none",
1608
+ stroke: "currentColor",
1609
+ strokeLinecap: "round",
1610
+ strokeLinejoin: "round",
1611
+ strokeWidth: "1.5"
1612
+ }
1613
+ )
1614
+ );
1615
+ const IconEmoji = createIcon(
1616
+ "IconEmoji",
1617
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1618
+ /* @__PURE__ */ jsx("path", { d: "M16.75 10C16.75 6.27208 13.7279 3.25 10 3.25C6.27208 3.25 3.25 6.27208 3.25 10C3.25 13.7279 6.27208 16.75 10 16.75C13.7279 16.75 16.75 13.7279 16.75 10ZM18.25 10C18.25 14.5563 14.5563 18.25 10 18.25C5.44365 18.25 1.75 14.5563 1.75 10C1.75 5.44365 5.44365 1.75 10 1.75C14.5563 1.75 18.25 5.44365 18.25 10Z" }),
1619
+ /* @__PURE__ */ jsx("path", { d: "M7.1875 9.375C7.70527 9.375 8.125 8.95527 8.125 8.4375C8.125 7.91973 7.70527 7.5 7.1875 7.5C6.66973 7.5 6.25 7.91973 6.25 8.4375C6.25 8.95527 6.66973 9.375 7.1875 9.375Z" }),
1620
+ /* @__PURE__ */ jsx("path", { d: "M12.8125 9.375C13.3303 9.375 13.75 8.95527 13.75 8.4375C13.75 7.91973 13.3303 7.5 12.8125 7.5C12.2947 7.5 11.875 7.91973 11.875 8.4375C11.875 8.95527 12.2947 9.375 12.8125 9.375Z" }),
1621
+ /* @__PURE__ */ jsx("path", { d: "M12.4756 11.499C12.683 11.1407 13.1425 11.0182 13.501 11.2256C13.8593 11.433 13.9818 11.8925 13.7744 12.251C13.0125 13.568 11.6947 14.5 10 14.5C8.30531 14.5 6.98748 13.568 6.22559 12.251C6.01825 11.8925 6.14067 11.433 6.49902 11.2256C6.85749 11.0182 7.31695 11.1407 7.52441 11.499C8.05942 12.424 8.91824 13 10 13C11.0818 13 11.9406 12.424 12.4756 11.499Z" })
1622
+ ] })
1623
+ );
1624
+ const IconExclamationMarkFill = createIcon(
1625
+ "IconExclamationMarkFill",
1626
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1627
+ /* @__PURE__ */ jsx("path", { d: "M10 16.875C10.6904 16.875 11.25 16.3154 11.25 15.625C11.25 14.9346 10.6904 14.375 10 14.375C9.30964 14.375 8.75 14.9346 8.75 15.625C8.75 16.3154 9.30964 16.875 10 16.875Z" }),
1628
+ /* @__PURE__ */ jsx("path", { d: "M9 11.875V3.75C9 3.19772 9.44772 2.75 10 2.75C10.5523 2.75 11 3.19772 11 3.75V11.875C11 12.4273 10.5523 12.875 10 12.875C9.44772 12.875 9 12.4273 9 11.875Z" })
1629
+ ] })
1630
+ );
1631
+ const IconExclamationCircleFill = createIcon(
1632
+ "IconExclamationCircleFill",
1633
+ /* @__PURE__ */ jsx("path", { d: "M10 1.875C8.39303 1.875 6.82214 2.35152 5.486 3.24431C4.14985 4.1371 3.10844 5.40605 2.49348 6.8907C1.87852 8.37535 1.71762 10.009 2.03112 11.5851C2.34463 13.1612 3.11846 14.6089 4.25476 15.7452C5.39106 16.8815 6.8388 17.6554 8.41489 17.9689C9.99099 18.2824 11.6247 18.1215 13.1093 17.5065C14.594 16.8916 15.8629 15.8502 16.7557 14.514C17.6485 13.1779 18.125 11.607 18.125 10C18.1227 7.84581 17.266 5.78051 15.7427 4.25727C14.2195 2.73403 12.1542 1.87727 10 1.875ZM9.375 6.25C9.375 6.08424 9.44085 5.92527 9.55806 5.80806C9.67527 5.69085 9.83424 5.625 10 5.625C10.1658 5.625 10.3247 5.69085 10.4419 5.80806C10.5592 5.92527 10.625 6.08424 10.625 6.25V10.625C10.625 10.7908 10.5592 10.9497 10.4419 11.0669C10.3247 11.1842 10.1658 11.25 10 11.25C9.83424 11.25 9.67527 11.1842 9.55806 11.0669C9.44085 10.9497 9.375 10.7908 9.375 10.625V6.25ZM10 14.375C9.81458 14.375 9.63333 14.32 9.47916 14.217C9.32499 14.114 9.20482 13.9676 9.13387 13.7963C9.06291 13.625 9.04434 13.4365 9.08052 13.2546C9.11669 13.0727 9.20598 12.9057 9.33709 12.7746C9.4682 12.6435 9.63525 12.5542 9.81711 12.518C9.99896 12.4818 10.1875 12.5004 10.3588 12.5714C10.5301 12.6423 10.6765 12.7625 10.7795 12.9167C10.8825 13.0708 10.9375 13.2521 10.9375 13.4375C10.9375 13.6861 10.8387 13.9246 10.6629 14.1004C10.4871 14.2762 10.2486 14.375 10 14.375Z" })
1634
+ );
1635
+ const IconExclamationMark = createIcon(
1636
+ "IconExclamationMark",
1637
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1638
+ /* @__PURE__ */ jsx("path", { d: "M16.75 10C16.75 6.27208 13.7279 3.25 10 3.25C6.27208 3.25 3.25 6.27208 3.25 10C3.25 13.7279 6.27208 16.75 10 16.75C13.7279 16.75 16.75 13.7279 16.75 10ZM18.25 10C18.25 14.5563 14.5563 18.25 10 18.25C5.44365 18.25 1.75 14.5563 1.75 10C1.75 5.44365 5.44365 1.75 10 1.75C14.5563 1.75 18.25 5.44365 18.25 10Z" }),
1639
+ /* @__PURE__ */ jsx("path", { d: "M9.25 10.625V6.25C9.25 5.83579 9.58579 5.5 10 5.5C10.4142 5.5 10.75 5.83579 10.75 6.25V10.625C10.75 11.0392 10.4142 11.375 10 11.375C9.58579 11.375 9.25 11.0392 9.25 10.625Z" }),
1640
+ /* @__PURE__ */ jsx("path", { d: "M10 14.375C10.5178 14.375 10.9375 13.9553 10.9375 13.4375C10.9375 12.9197 10.5178 12.5 10 12.5C9.48223 12.5 9.0625 12.9197 9.0625 13.4375C9.0625 13.9553 9.48223 14.375 10 14.375Z" })
1641
+ ] })
1642
+ );
1643
+ const IconExclamationTriangle = createIcon(
1644
+ "IconExclamationTriangle",
1645
+ /* @__PURE__ */ jsx("path", { d: "M6.33838 2.1211C7.08775 0.860752 8.91225 0.860759 9.66162 2.1211L14.6509 10.5117C15.4171 11.8003 14.4889 13.4333 12.9897 13.4336H3.01026C1.51115 13.4333 0.582944 11.8003 1.34912 10.5117L6.33838 2.1211ZM8.63037 2.73438C8.34614 2.25634 7.65386 2.25634 7.36963 2.73438L2.38037 11.125C2.08977 11.6138 2.44181 12.2331 3.01026 12.2334H12.9897C13.5582 12.2331 13.9102 11.6138 13.6196 11.125L8.63037 2.73438ZM7.3999 8.50001V5.83302C7.40008 5.5018 7.66923 5.23341 8.00049 5.23341C8.33153 5.23367 8.59993 5.50196 8.6001 5.83302V8.50001C8.6001 8.83122 8.33164 9.09936 8.00049 9.09962C7.66912 9.09962 7.39991 8.83138 7.3999 8.50001ZM8.76709 10.333C8.76709 10.7563 8.4237 11.0994 8.00049 11.0996C7.57705 11.0996 7.23291 10.7565 7.23291 10.333C7.23309 9.90973 7.57716 9.56642 8.00049 9.56642L8.07862 9.57032C8.46503 9.60966 8.76693 9.93626 8.76709 10.333Z" }),
1646
+ { viewBox: "0 0 16 16" }
1647
+ );
1648
+ const IconEyeOpen = createIcon(
1649
+ "IconEyeOpen",
1650
+ /* @__PURE__ */ jsx("path", { d: "M8.00001 2.56708C10.6293 2.5671 13.1778 4.13929 14.874 7.11591C15.1862 7.66419 15.1864 8.33627 14.874 8.88446C13.1778 11.861 10.6292 13.4333 8.00001 13.4333C5.37079 13.4333 2.82216 11.861 1.12598 8.88446C0.813474 8.33611 0.813474 7.66328 1.12598 7.11493C2.82216 4.13867 5.37091 2.56707 8.00001 2.56708ZM8.00001 3.7663C5.88909 3.76629 3.69769 5.02518 2.16798 7.70966C2.06545 7.88967 2.0654 8.11071 2.16798 8.29071C3.69768 10.9751 5.88913 12.2331 8.00001 12.2331C10.1109 12.2331 12.3023 10.9751 13.832 8.29071C13.9346 8.11071 13.9346 7.8898 13.832 7.70966C12.3023 5.02517 10.1109 3.76631 8.00001 3.7663ZM9.56641 7.99969C9.56624 7.13461 8.86513 6.43329 8.00001 6.43329C7.13489 6.43329 6.43378 7.13461 6.4336 7.99969C6.4336 8.86492 7.13478 9.56708 8.00001 9.56708C8.86524 9.56708 9.56641 8.86492 9.56641 7.99969ZM10.7666 7.99969C10.7666 9.52767 9.52798 10.7663 8.00001 10.7663C6.47204 10.7663 5.23341 9.52767 5.23341 7.99969C5.23358 6.47187 6.47214 5.23309 8.00001 5.23309C9.52787 5.23309 10.7664 6.47187 10.7666 7.99969Z" }),
1651
+ { viewBox: "0 0 16 16" }
1652
+ );
1653
+ const IconUpload = createIcon(
1654
+ "IconUpload",
1655
+ /* @__PURE__ */ jsx(
1656
+ "path",
1657
+ {
1658
+ d: "M11.875 2.5H4.375C4.20924 2.5 4.05027 2.56585 3.93306 2.68306C3.81585 2.80027 3.75 2.95924 3.75 3.125V16.875C3.75 17.0408 3.81585 17.1997 3.93306 17.3169C4.05027 17.4342 4.20924 17.5 4.375 17.5H15.625C15.7908 17.5 15.9497 17.4342 16.0669 17.3169C16.1842 17.1997 16.25 17.0408 16.25 16.875V6.875M11.875 2.5L16.25 6.875M11.875 2.5V6.875H16.25M8.125 11.25L10 9.375M10 9.375L11.875 11.25M10 9.375V14.375",
1659
+ fill: "none",
1660
+ stroke: "currentColor",
1661
+ strokeLinecap: "round",
1662
+ strokeLinejoin: "round",
1663
+ strokeWidth: "1.5"
1664
+ }
1665
+ )
1666
+ );
1667
+ const IconFile = createIcon(
1668
+ "IconFile",
1669
+ /* @__PURE__ */ jsx(
1670
+ "path",
1671
+ {
1672
+ d: "M11.875 2.5H4.375C4.20924 2.5 4.05027 2.56585 3.93306 2.68306C3.81585 2.80027 3.75 2.95924 3.75 3.125V16.875C3.75 17.0408 3.81585 17.1997 3.93306 17.3169C4.05027 17.4342 4.20924 17.5 4.375 17.5H15.625C15.7908 17.5 15.9497 17.4342 16.0669 17.3169C16.1842 17.1997 16.25 17.0408 16.25 16.875V6.875M11.875 2.5L16.25 6.875M11.875 2.5V6.875H16.25",
1673
+ fill: "none",
1674
+ stroke: "currentColor",
1675
+ strokeLinecap: "round",
1676
+ strokeLinejoin: "round",
1677
+ strokeWidth: "1.5"
1678
+ }
1679
+ )
1680
+ );
1681
+ const IconFlag = createIcon(
1682
+ "IconFlag",
1683
+ /* @__PURE__ */ jsx(
1684
+ "path",
1685
+ {
1686
+ d: "M3.75 17.5001V4.3751C8.75 0.0446299 12.5 8.70557 17.5 4.3751V13.7501C12.5 18.0806 8.75 9.41963 3.75 13.7501",
1687
+ fill: "none",
1688
+ stroke: "currentColor",
1689
+ strokeLinecap: "round",
1690
+ strokeLinejoin: "round",
1691
+ strokeWidth: "1.5"
1692
+ }
1693
+ )
1694
+ );
1695
+ const IconImage = createIcon(
1696
+ "IconImage",
1697
+ /* @__PURE__ */ jsx(
1698
+ "path",
1699
+ {
1700
+ d: "M4.42891 16.875L12.9953 8.30781C13.0534 8.2497 13.1223 8.2036 13.1982 8.17215C13.274 8.1407 13.3554 8.12451 13.4375 8.12451C13.5196 8.12451 13.601 8.1407 13.6768 8.17215C13.7527 8.2036 13.8216 8.2497 13.8797 8.30781L16.875 11.3039M3.75 3.125H16.25C16.5952 3.125 16.875 3.40482 16.875 3.75V16.25C16.875 16.5952 16.5952 16.875 16.25 16.875H3.75C3.40482 16.875 3.125 16.5952 3.125 16.25V3.75C3.125 3.40482 3.40482 3.125 3.75 3.125ZM8.75 7.5C8.75 8.19036 8.19036 8.75 7.5 8.75C6.80964 8.75 6.25 8.19036 6.25 7.5C6.25 6.80964 6.80964 6.25 7.5 6.25C8.19036 6.25 8.75 6.80964 8.75 7.5Z",
1701
+ fill: "none",
1702
+ stroke: "currentColor",
1703
+ strokeLinecap: "round",
1704
+ strokeLinejoin: "round",
1705
+ strokeWidth: "1.5"
1706
+ }
1707
+ )
1708
+ );
1709
+ const IconLayoutAlignLeft = createIcon(
1710
+ "IconLayoutAlignLeft",
1711
+ /* @__PURE__ */ jsx(
1712
+ "path",
1713
+ {
1714
+ d: "M6.875 3.75V16.25M3.125 3.75H16.875C17.2202 3.75 17.5 4.02982 17.5 4.375V15.625C17.5 15.9702 17.2202 16.25 16.875 16.25H3.125C2.77982 16.25 2.5 15.9702 2.5 15.625V4.375C2.5 4.02982 2.77982 3.75 3.125 3.75Z",
1715
+ fill: "none",
1716
+ stroke: "currentColor",
1717
+ strokeLinecap: "round",
1718
+ strokeLinejoin: "round",
1719
+ strokeWidth: "1.5"
1720
+ }
1721
+ )
1722
+ );
1723
+ const IconLightBulbSimple = createIcon(
1724
+ "IconLightBulbSimple",
1725
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1726
+ /* @__PURE__ */ jsx("path", { d: "M12.2328 6.66736C12.2328 4.32904 10.3378 2.43302 7.99945 2.43298C5.66113 2.43298 3.76508 4.32901 3.76508 6.66736C3.76509 8.03465 4.4128 9.25078 5.42035 10.0258C5.44202 10.0425 5.46556 10.0594 5.48871 10.0765C6.00058 10.4543 6.43207 11.0657 6.43207 11.8119V12.6664C6.43232 13.5319 7.13392 14.2338 7.99945 14.2338C8.86496 14.2337 9.56658 13.5318 9.56683 12.6664V11.8119C9.56683 11.0657 9.99831 10.4543 10.5102 10.0765C10.5335 10.0593 10.556 10.0424 10.5776 10.0258L10.7631 9.87537C11.6644 9.09822 12.2328 7.94919 12.2328 6.66736ZM13.433 6.66736C13.433 8.42299 12.6002 9.98457 11.31 10.9769C11.2807 10.9995 11.2513 11.0205 11.2231 11.0414C10.9238 11.2623 10.767 11.55 10.767 11.8119V12.6664C10.7668 14.1946 9.5277 15.4329 7.99945 15.433C6.47116 15.433 5.23213 14.1946 5.23187 12.6664V11.8119C5.23187 11.5827 5.11171 11.3346 4.88129 11.1283L4.77582 11.0424L4.6889 10.9769C3.39867 9.98457 2.56587 8.42301 2.56586 6.66736C2.56586 3.66628 4.99838 1.23376 7.99945 1.23376C11.0005 1.2338 13.433 3.6663 13.433 6.66736Z" }),
1727
+ /* @__PURE__ */ jsx("path", { d: "M10.1669 11.2338C10.4982 11.2338 10.7665 11.502 10.7665 11.8334C10.7665 12.1647 10.4982 12.433 10.1669 12.433H5.83193C5.50056 12.433 5.23232 12.1647 5.23232 11.8334C5.23232 11.502 5.50056 11.2338 5.83193 11.2338H10.1669Z" })
1728
+ ] }),
1729
+ { viewBox: "0 0 16 16" }
1730
+ );
1731
+ const IconSearch = createIcon(
1732
+ "IconSearch",
1733
+ /* @__PURE__ */ jsx(
1734
+ "path",
1735
+ {
1736
+ d: "M13.1695 13.1695L17.5 17.5M15 8.75C15 12.2018 12.2018 15 8.75 15C5.29822 15 2.5 12.2018 2.5 8.75C2.5 5.29822 5.29822 2.5 8.75 2.5C12.2018 2.5 15 5.29822 15 8.75Z",
1737
+ fill: "none",
1738
+ stroke: "currentColor",
1739
+ strokeLinecap: "round",
1740
+ strokeLinejoin: "round",
1741
+ strokeWidth: "1.5"
1742
+ }
1743
+ )
1744
+ );
1745
+ const IconLocation = createIcon(
1746
+ "IconLocation",
1747
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1748
+ /* @__PURE__ */ jsx(
1749
+ "path",
1750
+ {
1751
+ d: "M10 10.625C11.3807 10.625 12.5 9.50571 12.5 8.125C12.5 6.74429 11.3807 5.625 10 5.625C8.61929 5.625 7.5 6.74429 7.5 8.125C7.5 9.50571 8.61929 10.625 10 10.625Z",
1752
+ fill: "none",
1753
+ stroke: "currentColor",
1754
+ strokeLinecap: "round",
1755
+ strokeLinejoin: "round",
1756
+ strokeWidth: "1.5"
1757
+ }
1758
+ ),
1759
+ /* @__PURE__ */ jsx(
1760
+ "path",
1761
+ {
1762
+ d: "M16.25 8.125C16.25 13.75 10 18.125 10 18.125C10 18.125 3.75 13.75 3.75 8.125C3.75 6.4674 4.40848 4.87769 5.58058 3.70558C6.75269 2.53348 8.3424 1.875 10 1.875C11.6576 1.875 13.2473 2.53348 14.4194 3.70558C15.5915 4.87769 16.25 6.4674 16.25 8.125Z",
1763
+ fill: "none",
1764
+ stroke: "currentColor",
1765
+ strokeLinecap: "round",
1766
+ strokeLinejoin: "round",
1767
+ strokeWidth: "1.5"
1768
+ }
1769
+ )
1770
+ ] })
1771
+ );
1772
+ const IconVoice = createIcon(
1773
+ "IconVoice",
1774
+ /* @__PURE__ */ jsx(
1775
+ "path",
1776
+ {
1777
+ d: "M10 15.625V18.75M10 15.625C11.4918 15.625 12.9226 15.0324 13.9775 13.9775C15.0324 12.9226 15.625 11.4918 15.625 10M10 15.625C8.50816 15.625 7.07742 15.0324 6.02252 13.9775C4.96763 12.9226 4.375 11.4918 4.375 10M10 1.875C11.7259 1.875 13.125 3.27411 13.125 5V10C13.125 11.7259 11.7259 13.125 10 13.125C8.27411 13.125 6.875 11.7259 6.875 10V5C6.875 3.27411 8.27411 1.875 10 1.875Z",
1778
+ fill: "none",
1779
+ stroke: "currentColor",
1780
+ strokeLinecap: "round",
1781
+ strokeLinejoin: "round",
1782
+ strokeWidth: "1.5"
1783
+ }
1784
+ )
1785
+ );
1786
+ const IconVoiceFill = createIcon(
1787
+ "IconVoiceFill",
1788
+ /* @__PURE__ */ jsx("path", { d: "M6.25 10V5C6.25 4.00544 6.64509 3.05161 7.34835 2.34835C8.05161 1.64509 9.00544 1.25 10 1.25C10.9946 1.25 11.9484 1.64509 12.6517 2.34835C13.3549 3.05161 13.75 4.00544 13.75 5V10C13.75 10.9946 13.3549 11.9484 12.6517 12.6517C11.9484 13.3549 10.9946 13.75 10 13.75C9.00544 13.75 8.05161 13.3549 7.34835 12.6517C6.64509 11.9484 6.25 10.9946 6.25 10ZM16.25 10C16.25 9.83424 16.1842 9.67527 16.0669 9.55806C15.9497 9.44085 15.7908 9.375 15.625 9.375C15.4592 9.375 15.3003 9.44085 15.1831 9.55806C15.0658 9.67527 15 9.83424 15 10C15 11.3261 14.4732 12.5979 13.5355 13.5355C12.5979 14.4732 11.3261 15 10 15C8.67392 15 7.40215 14.4732 6.46447 13.5355C5.52678 12.5979 5 11.3261 5 10C5 9.83424 4.93415 9.67527 4.81694 9.55806C4.69973 9.44085 4.54076 9.375 4.375 9.375C4.20924 9.375 4.05027 9.44085 3.93306 9.55806C3.81585 9.67527 3.75 9.83424 3.75 10C3.7519 11.5489 4.32806 13.042 5.36707 14.1907C6.40607 15.3393 7.8341 16.062 9.375 16.2188V18.75C9.375 18.9158 9.44085 19.0747 9.55806 19.1919C9.67527 19.3092 9.83424 19.375 10 19.375C10.1658 19.375 10.3247 19.3092 10.4419 19.1919C10.5592 19.0747 10.625 18.9158 10.625 18.75V16.2188C12.1659 16.062 13.5939 15.3393 14.6329 14.1907C15.6719 13.042 16.2481 11.5489 16.25 10Z" })
1789
+ );
1790
+ const IconMinus = createIcon(
1791
+ "IconMinus",
1792
+ /* @__PURE__ */ jsx(
1793
+ "path",
1794
+ {
1795
+ d: "M3.125 10H16.875",
1796
+ fill: "none",
1797
+ stroke: "currentColor",
1798
+ strokeLinecap: "round",
1799
+ strokeLinejoin: "round",
1800
+ strokeWidth: "1.5"
1801
+ }
1802
+ )
1803
+ );
1804
+ const IconMinusSmall = createIcon(
1805
+ "IconMinusSmall",
1806
+ /* @__PURE__ */ jsx(
1807
+ "path",
1808
+ {
1809
+ d: "M3.125 10H16.875",
1810
+ fill: "none",
1811
+ stroke: "currentColor",
1812
+ strokeLinecap: "round",
1813
+ strokeLinejoin: "round",
1814
+ strokeWidth: "1.5"
1815
+ }
1816
+ )
1817
+ );
1818
+ const IconMute = createIcon(
1819
+ "IconMute",
1820
+ /* @__PURE__ */ jsx(
1821
+ "path",
1822
+ {
1823
+ d: "M15.625 8.125V11.875M18.125 6.875V13.125M4.375 3.125L16.875 16.875M9.38672 4.92109L12.5 2.5V8.34609M12.5 12.0625V17.5L6.875 13.125H3.125C2.95924 13.125 2.80027 13.0592 2.68306 12.9419C2.56585 12.8247 2.5 12.6658 2.5 12.5V7.5C2.5 7.33424 2.56585 7.17527 2.68306 7.05806C2.80027 6.94085 2.95924 6.875 3.125 6.875H7.78437",
1824
+ fill: "none",
1825
+ stroke: "currentColor",
1826
+ strokeLinecap: "round",
1827
+ strokeLinejoin: "round",
1828
+ strokeWidth: "1.5"
1829
+ }
1830
+ )
1831
+ );
1832
+ const IconSend = createIcon(
1833
+ "IconSend",
1834
+ /* @__PURE__ */ jsx(
1835
+ "path",
1836
+ {
1837
+ d: "M11.2498 10H6.24982M6.24982 10L3.7881 2.71328C3.74537 2.59349 3.7402 2.4635 3.7733 2.34069C3.80639 2.21788 3.87616 2.10808 3.9733 2.02597C4.07044 1.94386 4.19032 1.89335 4.31693 1.88117C4.44353 1.86899 4.57084 1.89573 4.68185 1.95781L17.8069 9.4461C17.9045 9.50015 17.986 9.57937 18.0427 9.67555C18.0994 9.77172 18.1293 9.88133 18.1293 9.99297C18.1293 10.1046 18.0994 10.2142 18.0427 10.3104C17.986 10.4066 17.9045 10.4858 17.8069 10.5398L4.68185 18.0469C4.57051 18.1096 4.4426 18.1367 4.31537 18.1245C4.18815 18.1123 4.06772 18.0614 3.97032 17.9787C3.87292 17.8959 3.80323 17.7853 3.77065 17.6617C3.73807 17.5381 3.74416 17.4075 3.7881 17.2875L6.24982 10Z",
1838
+ fill: "none",
1839
+ stroke: "currentColor",
1840
+ strokeLinecap: "round",
1841
+ strokeLinejoin: "round",
1842
+ strokeWidth: "1.5"
1843
+ }
1844
+ )
1845
+ );
1846
+ const IconAttachment = createIcon(
1847
+ "IconAttachment",
1848
+ /* @__PURE__ */ jsx(
1849
+ "path",
1850
+ {
1851
+ d: "M12.4999 6.24998L5.9913 12.8664C5.76258 13.102 5.63576 13.4181 5.63823 13.7465C5.6407 14.0748 5.77227 14.389 6.00451 14.6211C6.23674 14.8533 6.55099 14.9847 6.87934 14.987C7.20769 14.9894 7.52376 14.8624 7.75927 14.6336L15.5179 6.76795C15.9868 6.29905 16.2502 5.6631 16.2502 4.99998C16.2502 4.33686 15.9868 3.70091 15.5179 3.23201C15.049 2.76312 14.413 2.49969 13.7499 2.49969C13.0868 2.49969 12.4508 2.76312 11.9819 3.23201L4.22333 11.0984C3.52953 11.8036 3.14249 12.7544 3.14652 13.7437C3.15054 14.7329 3.54531 15.6805 4.24483 16.38C4.94435 17.0796 5.89195 17.4743 6.88121 17.4784C7.87048 17.4824 8.82126 17.0953 9.52645 16.4015L15.9374 9.99998",
1852
+ fill: "none",
1853
+ stroke: "currentColor",
1854
+ strokeLinecap: "round",
1855
+ strokeLinejoin: "round",
1856
+ strokeWidth: "1.5"
1857
+ }
1858
+ )
1859
+ );
1860
+ const IconPauseFill = createIcon(
1861
+ "IconPauseFill",
1862
+ /* @__PURE__ */ jsx("path", { d: "M16.875 3.75V16.25C16.875 16.5815 16.7433 16.8995 16.5089 17.1339C16.2745 17.3683 15.9565 17.5 15.625 17.5H12.5C12.1685 17.5 11.8505 17.3683 11.6161 17.1339C11.3817 16.8995 11.25 16.5815 11.25 16.25V3.75C11.25 3.41848 11.3817 3.10054 11.6161 2.86612C11.8505 2.6317 12.1685 2.5 12.5 2.5H15.625C15.9565 2.5 16.2745 2.6317 16.5089 2.86612C16.7433 3.10054 16.875 3.41848 16.875 3.75ZM7.5 2.5H4.375C4.04348 2.5 3.72554 2.6317 3.49112 2.86612C3.2567 3.10054 3.125 3.41848 3.125 3.75V16.25C3.125 16.5815 3.2567 16.8995 3.49112 17.1339C3.72554 17.3683 4.04348 17.5 4.375 17.5H7.5C7.83152 17.5 8.14946 17.3683 8.38388 17.1339C8.6183 16.8995 8.75 16.5815 8.75 16.25V3.75C8.75 3.41848 8.6183 3.10054 8.38388 2.86612C8.14946 2.6317 7.83152 2.5 7.5 2.5Z" })
1863
+ );
1864
+ const IconUser = createIcon(
1865
+ "IconUser",
1866
+ /* @__PURE__ */ jsx(
1867
+ "path",
1868
+ {
1869
+ d: "M10 12.5C12.7614 12.5 15 10.2614 15 7.5C15 4.73858 12.7614 2.5 10 2.5C7.23858 2.5 5 4.73858 5 7.5C5 10.2614 7.23858 12.5 10 12.5ZM10 12.5C6.76172 12.5 4.01328 14.2602 2.5 16.875M10 12.5C13.2383 12.5 15.9867 14.2602 17.5 16.875",
1870
+ fill: "none",
1871
+ stroke: "currentColor",
1872
+ strokeLinecap: "round",
1873
+ strokeLinejoin: "round",
1874
+ strokeWidth: "1.5"
1875
+ }
1876
+ )
1877
+ );
1878
+ const IconUserAdd = createIcon(
1879
+ "IconUserAdd",
1880
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1881
+ /* @__PURE__ */ jsx("g", { clipPath: "url(#clip0_14246_498359)", children: /* @__PURE__ */ jsx(
1882
+ "path",
1883
+ {
1884
+ d: "M15.625 10.625H19.375M17.5 8.75V12.5M8.4375 12.5C11.0263 12.5 13.125 10.4013 13.125 7.8125C13.125 5.22367 11.0263 3.125 8.4375 3.125C5.84867 3.125 3.75 5.22367 3.75 7.8125C3.75 10.4013 5.84867 12.5 8.4375 12.5ZM8.4375 12.5C5.74688 12.5 3.48047 13.7148 1.875 15.625M8.4375 12.5C11.1281 12.5 13.3945 13.7148 15 15.625",
1885
+ fill: "none",
1886
+ stroke: "currentColor",
1887
+ strokeLinecap: "round",
1888
+ strokeLinejoin: "round",
1889
+ strokeWidth: "1.5"
1890
+ }
1891
+ ) }),
1892
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_14246_498359", children: /* @__PURE__ */ jsx("rect", { fill: "white", height: "20", width: "20" }) }) })
1893
+ ] })
1894
+ );
1895
+ const IconUserCheck = createIcon(
1896
+ "IconUserCheck",
1897
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1898
+ /* @__PURE__ */ jsx("g", { clipPath: "url(#clip0_14236_425131)", children: /* @__PURE__ */ jsx(
1899
+ "path",
1900
+ {
1901
+ d: "M8.4375 12.5C11.0263 12.5 13.125 10.4013 13.125 7.8125C13.125 5.22367 11.0263 3.125 8.4375 3.125C5.84867 3.125 3.75 5.22367 3.75 7.8125C3.75 10.4013 5.84867 12.5 8.4375 12.5ZM8.4375 12.5C5.74688 12.5 3.48047 13.7148 1.875 15.625M8.4375 12.5C11.1281 12.5 13.3945 13.7148 15 15.625M15.625 11.25L16.875 12.5L19.375 10",
1902
+ fill: "none",
1903
+ stroke: "currentColor",
1904
+ strokeLinecap: "round",
1905
+ strokeLinejoin: "round",
1906
+ strokeWidth: "1.5"
1907
+ }
1908
+ ) }),
1909
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_14236_425131", children: /* @__PURE__ */ jsx("rect", { fill: "white", height: "20", width: "20" }) }) })
1910
+ ] })
1911
+ );
1912
+ const IconUserRemove = createIcon(
1913
+ "IconUserRemove",
1914
+ /* @__PURE__ */ jsxs(Fragment, { children: [
1915
+ /* @__PURE__ */ jsx("g", { clipPath: "url(#clip0_14246_434209)", children: /* @__PURE__ */ jsx(
1916
+ "path",
1917
+ {
1918
+ d: "M15.625 10.625H19.375M8.4375 12.5C11.0263 12.5 13.125 10.4013 13.125 7.8125C13.125 5.22367 11.0263 3.125 8.4375 3.125C5.84867 3.125 3.75 5.22367 3.75 7.8125C3.75 10.4013 5.84867 12.5 8.4375 12.5ZM8.4375 12.5C5.74688 12.5 3.48047 13.7148 1.875 15.625M8.4375 12.5C11.1281 12.5 13.3945 13.7148 15 15.625",
1919
+ fill: "none",
1920
+ stroke: "currentColor",
1921
+ strokeLinecap: "round",
1922
+ strokeLinejoin: "round",
1923
+ strokeWidth: "1.5"
1924
+ }
1925
+ ) }),
1926
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_14246_434209", children: /* @__PURE__ */ jsx("rect", { fill: "white", height: "20", width: "20" }) }) })
1927
+ ] })
1928
+ );
1929
+ const IconPin = createIcon(
1930
+ "IconPin",
1931
+ /* @__PURE__ */ jsx(
1932
+ "path",
1933
+ {
1934
+ d: "M7.52271 12.4773L3.75006 16.25M17.9422 7.68279C18.0594 7.56559 18.1252 7.40668 18.1252 7.24099C18.1252 7.0753 18.0594 6.9164 17.9422 6.7992L13.2032 2.05779C13.086 1.94067 12.9271 1.87488 12.7614 1.87488C12.5957 1.87488 12.4368 1.94067 12.3196 2.05779L7.84303 6.54685C7.84303 6.54685 5.67506 5.46326 3.35943 7.33201C3.29077 7.38697 3.23447 7.45581 3.19424 7.53402C3.154 7.61224 3.13072 7.69806 3.12593 7.78589C3.12114 7.87371 3.13493 7.96156 3.16642 8.04369C3.19791 8.12581 3.24637 8.20037 3.30865 8.26248L11.7383 16.6914C11.8015 16.7541 11.8773 16.8025 11.9606 16.8336C12.044 16.8646 12.133 16.8775 12.2218 16.8713C12.3105 16.8652 12.3969 16.8402 12.4752 16.798C12.5535 16.7558 12.6219 16.6973 12.6758 16.6265C13.3313 15.7547 14.361 13.9633 13.4657 12.1734L17.9422 7.68279Z",
1935
+ fill: "none",
1936
+ stroke: "currentColor",
1937
+ strokeLinecap: "round",
1938
+ strokeLinejoin: "round",
1939
+ strokeWidth: "1.5"
1940
+ }
1941
+ )
1942
+ );
1943
+ const IconPlayFill = createIcon(
1944
+ "IconPlayFill",
1945
+ /* @__PURE__ */ jsx("path", { d: "M18.75 10C18.7505 10.2122 18.6961 10.4209 18.5921 10.6059C18.488 10.7908 18.3379 10.9457 18.1562 11.0555L6.9 17.9414C6.71022 18.0576 6.49287 18.1211 6.27037 18.1252C6.04788 18.1293 5.82832 18.0739 5.63438 17.9648C5.44227 17.8574 5.28225 17.7008 5.17075 17.511C5.05926 17.3213 5.00032 17.1052 5 16.8852V3.11484C5.00032 2.89475 5.05926 2.67872 5.17075 2.48896C5.28225 2.2992 5.44227 2.14257 5.63438 2.03516C5.82832 1.92605 6.04788 1.87071 6.27037 1.87483C6.49287 1.87895 6.71022 1.94239 6.9 2.05859L18.1562 8.94453C18.3379 9.05428 18.488 9.20916 18.5921 9.39411C18.6961 9.57906 18.7505 9.78779 18.75 10Z" })
1946
+ );
1947
+ const IconPlus = createIcon(
1948
+ "IconPlus",
1949
+ /* @__PURE__ */ jsx(
1950
+ "path",
1951
+ {
1952
+ d: "M3.125 10H16.875M10 3.125V16.875",
1953
+ fill: "none",
1954
+ stroke: "currentColor",
1955
+ strokeLinecap: "round",
1956
+ strokeLinejoin: "round",
1957
+ strokeWidth: "1.5"
1958
+ }
1959
+ )
1960
+ );
1961
+ const IconPlusSmall = createIcon(
1962
+ "IconPlusSmall",
1963
+ /* @__PURE__ */ jsx(
1964
+ "path",
1965
+ {
1966
+ d: "M3.125 10H16.875M10 3.125V16.875",
1967
+ fill: "none",
1968
+ stroke: "currentColor",
1969
+ strokeLinecap: "round",
1970
+ strokeLinejoin: "round",
1971
+ strokeWidth: "1.5"
1972
+ }
1973
+ )
1974
+ );
1975
+ const IconCommand = createIcon(
1976
+ "IconCommand",
1977
+ /* @__PURE__ */ jsx(
1978
+ "path",
1979
+ {
1980
+ d: "M6.25 7.5L9.375 10L6.25 12.5M10.625 12.5H13.75M3.125 3.75H16.875C17.2202 3.75 17.5 4.02982 17.5 4.375V15.625C17.5 15.9702 17.2202 16.25 16.875 16.25H3.125C2.77982 16.25 2.5 15.9702 2.5 15.625V4.375C2.5 4.02982 2.77982 3.75 3.125 3.75Z",
1981
+ fill: "none",
1982
+ stroke: "currentColor",
1983
+ strokeLinecap: "round",
1984
+ strokeLinejoin: "round",
1985
+ strokeWidth: "1.5"
1986
+ }
1987
+ )
1988
+ );
1989
+ const IconSettingsGear2 = createIcon(
1990
+ "IconSettingsGear2",
1991
+ /* @__PURE__ */ jsx("path", { d: "M13.5667 8.00031C13.5667 7.81566 13.4743 7.64281 13.3206 7.54034L12.7503 7.16046C12.0815 6.71442 11.7583 5.90079 11.9388 5.11749L12.0472 4.64777C12.092 4.45315 12.034 4.24906 11.8929 4.10773C11.7515 3.96629 11.5467 3.90753 11.3519 3.95245L10.8831 4.06085C10.0996 4.24168 9.28525 3.91849 8.8392 3.24933L8.45932 2.67902C8.35689 2.52558 8.18474 2.43303 8.00034 2.43292C7.81575 2.43292 7.64286 2.5254 7.54037 2.67902L7.16049 3.24933C6.7145 3.91832 5.90097 4.24146 5.11752 4.06085L4.6478 3.95245C4.45304 3.90767 4.24908 3.9664 4.10776 4.10773C3.96643 4.24905 3.9077 4.45301 3.95248 4.64777L4.06088 5.11749C4.24149 5.90094 3.91835 6.71447 3.24936 7.16046L2.67905 7.54034C2.52543 7.64282 2.43295 7.81572 2.43295 8.00031C2.43306 8.18471 2.52561 8.35686 2.67905 8.45929L3.24936 8.83917C3.91852 9.28522 4.24171 10.0995 4.06088 10.8831L3.95248 11.3519C3.90756 11.5467 3.96632 11.7514 4.10776 11.8929C4.24909 12.034 4.45317 12.092 4.6478 12.0472L5.11752 11.9388C5.90082 11.7583 6.71445 12.0814 7.16049 12.7503L7.54037 13.3206C7.64284 13.4743 7.81569 13.5667 8.00034 13.5667C8.18484 13.5666 8.35691 13.4742 8.45932 13.3206L8.8392 12.7503C9.2574 12.123 9.99909 11.8004 10.7357 11.9114L10.8831 11.9388L11.3519 12.0472C11.5467 12.0922 11.7505 12.0334 11.8919 11.8919C12.0334 11.7504 12.0922 11.5467 12.0472 11.3519L11.9388 10.8831C11.7581 10.0996 12.0812 9.28525 12.7503 8.83917L13.3206 8.45929C13.4742 8.35688 13.5666 8.18481 13.5667 8.00031ZM9.23373 8.00031C9.23373 7.31925 8.68135 6.76708 8.00034 6.76691C7.31917 6.76691 6.76694 7.31914 6.76694 8.00031C6.76711 8.68132 7.31928 9.2337 8.00034 9.2337C8.68124 9.23353 9.23356 8.68121 9.23373 8.00031ZM10.433 8.00031C10.4328 9.34395 9.34398 10.4327 8.00034 10.4329C6.65654 10.4329 5.56692 9.34406 5.56674 8.00031C5.56674 6.6564 6.65643 5.56671 8.00034 5.56671C9.34409 5.56689 10.433 6.65651 10.433 8.00031ZM14.7669 8.00031C14.7668 8.58607 14.474 9.13337 13.9867 9.45831L13.4164 9.8382C13.1627 10.0072 13.0404 10.3155 13.1087 10.6126L13.2171 11.0823C13.355 11.6803 13.1744 12.3067 12.7406 12.7405C12.3067 13.1744 11.6803 13.355 11.0824 13.2171L10.6126 13.1087C10.3155 13.0403 10.0073 13.1627 9.83823 13.4163L9.45834 13.9866C9.1334 14.4739 8.5861 14.7668 8.00034 14.7669C7.41454 14.7669 6.86735 14.4739 6.54233 13.9866L6.16245 13.4163C5.99328 13.1626 5.6843 13.0402 5.38705 13.1087L4.9183 13.2171C4.32022 13.3552 3.69313 13.1746 3.25912 12.7405C2.82535 12.3066 2.64568 11.6802 2.78354 11.0823L2.89194 10.6126C2.96027 10.3155 2.83695 10.0072 2.58334 9.8382L2.01401 9.45831C1.52667 9.13338 1.23384 8.58608 1.23373 8.00031C1.23373 7.4144 1.52657 6.86729 2.01401 6.5423L2.58334 6.16241C2.83709 5.99325 2.96042 5.68417 2.89194 5.38702L2.78354 4.91827C2.64553 4.32022 2.82513 3.69309 3.25912 3.25909C3.69312 2.8251 4.32025 2.6455 4.9183 2.78351L5.38705 2.89191C5.6842 2.96039 5.99328 2.83706 6.16245 2.58331L6.54233 2.01398C6.86732 1.52654 7.41443 1.2337 8.00034 1.2337C8.58611 1.23381 9.13341 1.52663 9.45834 2.01398L9.83823 2.58331C10.0073 2.83692 10.3156 2.96024 10.6126 2.89191L11.0824 2.78351C11.6803 2.64565 12.3067 2.82532 12.7406 3.25909C13.1746 3.6931 13.3552 4.3202 13.2171 4.91827L13.1087 5.38702C13.0402 5.68427 13.1626 5.99325 13.4164 6.16241L13.9867 6.5423C14.4739 6.86732 14.7669 7.41451 14.7669 8.00031Z" }),
1992
+ { viewBox: "0 0 16 16" }
1993
+ );
1994
+ const IconCopy = createIcon(
1995
+ "IconCopy",
1996
+ /* @__PURE__ */ jsx(
1997
+ "path",
1998
+ {
1999
+ d: "M13.125 13.125H16.875V3.125H6.875V6.875M3.125 6.875H13.125V16.875H3.125V6.875Z",
2000
+ fill: "none",
2001
+ stroke: "currentColor",
2002
+ strokeLinecap: "round",
2003
+ strokeLinejoin: "round",
2004
+ strokeWidth: "1.5"
2005
+ }
2006
+ )
2007
+ );
2008
+ const IconThunder = createIcon(
2009
+ "IconThunder",
2010
+ /* @__PURE__ */ jsx("path", { d: "M16.7071 9.80157L7.95711 19.1766C7.86438 19.2755 7.74198 19.3416 7.60839 19.3649C7.47479 19.3882 7.33724 19.3674 7.2165 19.3057C7.09576 19.244 6.99837 19.1446 6.93904 19.0227C6.8797 18.9007 6.86164 18.7628 6.88757 18.6297L8.03289 12.9008L3.53054 11.2102C3.43385 11.174 3.34762 11.1144 3.27956 11.0368C3.2115 10.9592 3.16373 10.8659 3.14052 10.7653C3.1173 10.6647 3.11937 10.5599 3.14653 10.4603C3.17369 10.3607 3.2251 10.2694 3.29617 10.1945L12.0462 0.819538C12.1389 0.720581 12.2613 0.654468 12.3949 0.631176C12.5285 0.607884 12.666 0.628675 12.7868 0.690414C12.9075 0.752152 13.0049 0.851488 13.0642 0.97343C13.1236 1.09537 13.1416 1.2333 13.1157 1.36641L11.9673 7.10157L16.4696 8.78985C16.5656 8.82626 16.6511 8.88576 16.7187 8.96307C16.7862 9.04039 16.8336 9.13315 16.8568 9.23316C16.88 9.33317 16.8781 9.43734 16.8515 9.53648C16.8248 9.63562 16.7742 9.72666 16.704 9.80157H16.7071Z" })
2011
+ );
2012
+ const IconTranslate = createIcon(
2013
+ "IconTranslate",
2014
+ /* @__PURE__ */ jsx(
2015
+ "path",
2016
+ {
2017
+ d: "M18.75 16.875L14.375 8.125L10 16.875M11.25 14.375H17.5M7.5 2.5V4.375M2.5 4.375H12.5M10 4.375C10 6.36412 9.20982 8.27178 7.8033 9.6783C6.39678 11.0848 4.48912 11.875 2.5 11.875M5.42734 6.875C5.94442 8.33751 6.90226 9.60371 8.16893 10.4992C9.4356 11.3947 10.9488 11.8753 12.5 11.875",
2018
+ fill: "none",
2019
+ stroke: "currentColor",
2020
+ strokeLinecap: "round",
2021
+ strokeLinejoin: "round",
2022
+ strokeWidth: "1.5"
2023
+ }
2024
+ )
2025
+ );
2026
+ const IconDelete = createIcon(
2027
+ "IconDelete",
2028
+ /* @__PURE__ */ jsx(
2029
+ "path",
2030
+ {
2031
+ d: "M16.875 4.375H3.125M8.125 8.125V13.125M11.875 8.125V13.125M15.625 4.375V16.25C15.625 16.4158 15.5592 16.5747 15.4419 16.6919C15.3247 16.8092 15.1658 16.875 15 16.875H5C4.83424 16.875 4.67527 16.8092 4.55806 16.6919C4.44085 16.5747 4.375 16.4158 4.375 16.25V4.375M13.125 4.375V3.125C13.125 2.79348 12.9933 2.47554 12.7589 2.24112C12.5245 2.0067 12.2065 1.875 11.875 1.875H8.125C7.79348 1.875 7.47554 2.0067 7.24112 2.24112C7.0067 2.47554 6.875 2.79348 6.875 3.125V4.375",
2032
+ fill: "none",
2033
+ stroke: "currentColor",
2034
+ strokeLinecap: "round",
2035
+ strokeLinejoin: "round",
2036
+ strokeWidth: "1.5"
2037
+ }
2038
+ )
2039
+ );
2040
+ const IconTrophy = createIcon(
2041
+ "IconTrophy",
2042
+ /* @__PURE__ */ jsx(
2043
+ "path",
2044
+ {
2045
+ d: "M7.5 17.5H12.5M10 14.375V17.5M4.53125 10H3.75C3.08696 10 2.45107 9.73661 1.98223 9.26777C1.51339 8.79893 1.25 8.16304 1.25 7.5V6.25C1.25 6.08424 1.31585 5.92527 1.43306 5.80806C1.55027 5.69085 1.70924 5.625 1.875 5.625H4.375M15.4688 10H16.25C16.913 10 17.5489 9.73661 18.0178 9.26777C18.4866 8.79893 18.75 8.16304 18.75 7.5V6.25C18.75 6.08424 18.6842 5.92527 18.5669 5.80806C18.4497 5.69085 18.2908 5.625 18.125 5.625H15.625M4.375 3.75H15.625V8.67969C15.625 11.7812 13.1445 14.3516 10.043 14.375C9.30068 14.3807 8.5646 14.2394 7.87718 13.9592C7.18975 13.6791 6.56458 13.2656 6.03769 12.7427C5.5108 12.2198 5.09262 11.5978 4.80725 10.9126C4.52188 10.2273 4.37498 9.49231 4.375 8.75V3.75Z",
2046
+ fill: "none",
2047
+ stroke: "currentColor",
2048
+ strokeLinecap: "round",
2049
+ strokeLinejoin: "round",
2050
+ strokeWidth: "1.5"
2051
+ }
2052
+ )
2053
+ );
2054
+ const IconUnpin = createIcon(
2055
+ "IconUnpin",
2056
+ /* @__PURE__ */ jsx(
2057
+ "path",
2058
+ {
2059
+ d: "M7.52271 12.4773L3.75006 16.25M3.75006 3.12498L16.2501 16.875M14.4532 11.1828L17.9415 7.68279C18.0586 7.56559 18.1244 7.40668 18.1244 7.24099C18.1244 7.0753 18.0586 6.9164 17.9415 6.7992L13.2032 2.05779C13.086 1.94067 12.9271 1.87488 12.7614 1.87488C12.5957 1.87488 12.4368 1.94067 12.3196 2.05779L9.09615 5.28904M6.58756 6.24998C5.74537 6.18435 4.57271 6.3531 3.35943 7.33201C3.29077 7.38697 3.23447 7.45581 3.19424 7.53402C3.154 7.61224 3.13072 7.69806 3.12593 7.78589C3.12114 7.87371 3.13493 7.96156 3.16642 8.04369C3.19791 8.12581 3.24637 8.20037 3.30865 8.26248L11.7383 16.6914C11.8015 16.7541 11.8773 16.8025 11.9606 16.8336C12.044 16.8646 12.133 16.8775 12.2218 16.8713C12.3105 16.8652 12.3969 16.8402 12.4752 16.798C12.5535 16.7558 12.6219 16.6973 12.6758 16.6265C13.0829 16.0851 13.6344 15.1898 13.779 14.1594",
2060
+ fill: "none",
2061
+ stroke: "currentColor",
2062
+ strokeLinecap: "round",
2063
+ strokeLinejoin: "round",
2064
+ strokeWidth: "1.5"
2065
+ }
2066
+ )
2067
+ );
2068
+ const IconVideo = createIcon(
2069
+ "IconVideo",
2070
+ /* @__PURE__ */ jsxs(Fragment, { children: [
2071
+ /* @__PURE__ */ jsx("g", { clipPath: "url(#clip0_14111_491476)", children: /* @__PURE__ */ jsx(
2072
+ "path",
2073
+ {
2074
+ d: "M15.625 8.75L19.375 6.25V13.75L15.625 11.25M2.5 5H15C15.3452 5 15.625 5.27982 15.625 5.625V14.375C15.625 14.7202 15.3452 15 15 15H2.5C2.15482 15 1.875 14.7202 1.875 14.375V5.625C1.875 5.27982 2.15482 5 2.5 5Z",
2075
+ fill: "none",
2076
+ stroke: "currentColor",
2077
+ strokeLinecap: "round",
2078
+ strokeLinejoin: "round",
2079
+ strokeWidth: "1.5"
2080
+ }
2081
+ ) }),
2082
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_14111_491476", children: /* @__PURE__ */ jsx("rect", { fill: "white", height: "20", width: "20" }) }) })
2083
+ ] })
2084
+ );
2085
+ const IconVideoFill = createIcon(
2086
+ "IconVideoFill",
2087
+ /* @__PURE__ */ jsxs(Fragment, { children: [
2088
+ /* @__PURE__ */ jsx("g", { clipPath: "url(#clip0_14064_467281)", children: /* @__PURE__ */ jsx("path", { d: "M15 5.625V14.375C15 14.7065 14.8683 15.0245 14.6339 15.2589C14.3995 15.4933 14.0815 15.625 13.75 15.625H2.5C2.16848 15.625 1.85054 15.4933 1.61612 15.2589C1.3817 15.0245 1.25 14.7065 1.25 14.375V5.625C1.25 5.29348 1.3817 4.97554 1.61612 4.74112C1.85054 4.5067 2.16848 4.375 2.5 4.375H13.75C14.0815 4.375 14.3995 4.5067 14.6339 4.74112C14.8683 4.97554 15 5.29348 15 5.625ZM19.5312 5.64453C19.4431 5.62295 19.3513 5.62029 19.2621 5.63672C19.1728 5.65315 19.088 5.68829 19.0133 5.73984L16.3891 7.48906C16.3463 7.51762 16.3112 7.55631 16.2869 7.6017C16.2626 7.64708 16.25 7.69776 16.25 7.74922V12.2508C16.25 12.3022 16.2626 12.3529 16.2869 12.3983C16.3112 12.4437 16.3463 12.4824 16.3891 12.5109L19.0281 14.2703C19.1269 14.3362 19.2424 14.3726 19.3611 14.3752C19.4798 14.3779 19.5968 14.3466 19.6984 14.2852C19.7924 14.2254 19.8695 14.1425 19.9223 14.0444C19.9751 13.9464 20.0019 13.8364 20 13.725V6.25C20.0001 6.11139 19.9541 5.97668 19.8692 5.86708C19.7843 5.75747 19.6655 5.67918 19.5312 5.64453Z" }) }),
2089
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_14064_467281", children: /* @__PURE__ */ jsx("rect", { fill: "white", height: "20", width: "20" }) }) })
2090
+ ] })
2091
+ );
2092
+ const IconAudio = createIcon(
2093
+ "IconAudio",
2094
+ /* @__PURE__ */ jsx(
2095
+ "path",
2096
+ {
2097
+ d: "M15.625 8.125V11.875M18.125 6.875V13.125M6.875 13.125H3.125C2.95924 13.125 2.80027 13.0592 2.68306 12.9419C2.56585 12.8247 2.5 12.6658 2.5 12.5V7.5C2.5 7.33424 2.56585 7.17527 2.68306 7.05806C2.80027 6.94085 2.95924 6.875 3.125 6.875H6.875L12.5 2.5V17.5L6.875 13.125Z",
2098
+ fill: "none",
2099
+ stroke: "currentColor",
2100
+ strokeLinecap: "round",
2101
+ strokeLinejoin: "round",
2102
+ strokeWidth: "1.5"
2103
+ }
2104
+ )
2105
+ );
2106
+ const IconArchive = createIcon(
2107
+ "IconArchive",
2108
+ /* @__PURE__ */ jsx(
2109
+ "path",
2110
+ {
2111
+ d: "M16.875 7.5V15C16.875 15.1658 16.8092 15.3247 16.6919 15.4419C16.5747 15.5592 16.4158 15.625 16.25 15.625H3.75C3.58424 15.625 3.42527 15.5592 3.30806 15.4419C3.19085 15.3247 3.125 15.1658 3.125 15V7.5M8.125 10.625H11.875M2.5 4.375H17.5C17.8452 4.375 18.125 4.65482 18.125 5V6.875C18.125 7.22018 17.8452 7.5 17.5 7.5H2.5C2.15482 7.5 1.875 7.22018 1.875 6.875V5C1.875 4.65482 2.15482 4.375 2.5 4.375Z",
2112
+ fill: "none",
2113
+ stroke: "currentColor",
2114
+ strokeLinecap: "round",
2115
+ strokeLinejoin: "round",
2116
+ strokeWidth: "1.5"
2117
+ }
2118
+ )
2119
+ );
2120
+ const IconLoading = createIcon(
2121
+ "IconLoading",
2122
+ /* @__PURE__ */ jsxs(Fragment, { children: [
2123
+ /* @__PURE__ */ jsx(
2124
+ "path",
2125
+ {
2126
+ d: "M17.5 10C17.5 14.1422 14.1422 17.5 10 17.5C5.85787 17.5 2.5 14.1422 2.5 10C2.5 5.85787 5.85787 2.5 10 2.5C14.1422 2.5 17.5 5.85787 17.5 10Z",
2127
+ fill: "none",
2128
+ stroke: "currentColor",
2129
+ strokeOpacity: "0.3",
2130
+ strokeWidth: "2"
2131
+ }
2132
+ ),
2133
+ /* @__PURE__ */ jsx(
2134
+ "path",
2135
+ {
2136
+ d: "M17.4544 10.8334C17.0701 14.3097 14.3098 17.07 10.8335 17.4543",
2137
+ fill: "none",
2138
+ stroke: "currentColor",
2139
+ strokeLinecap: "round",
2140
+ strokeWidth: "2"
2141
+ }
2142
+ )
2143
+ ] })
2144
+ );
2145
+ const UnMemoizedEmptyStateIndicator = (props) => {
2146
+ const { listType, messageText } = props;
2147
+ const { t } = useTranslationContext("EmptyStateIndicator");
2148
+ if (listType === "thread") return null;
2149
+ if (listType === "channel") {
2150
+ const text = t("No conversations yet");
2151
+ return /* @__PURE__ */ jsxs("div", { className: "str-chat__channel-list-empty", children: [
2152
+ /* @__PURE__ */ jsx(IconMessageBubbles, {}),
2153
+ /* @__PURE__ */ jsx("p", { role: "listitem", children: text })
2154
+ ] });
2155
+ }
2156
+ if (listType === "message") {
2157
+ const text = t(messageText || "Send a message to start the conversation");
2158
+ return /* @__PURE__ */ jsxs("div", { className: "str-chat__empty-channel", children: [
2159
+ /* @__PURE__ */ jsx(IconMessageBubble, {}),
2160
+ /* @__PURE__ */ jsx("p", { className: "str-chat__empty-channel-text", role: "listitem", children: text })
2161
+ ] });
2162
+ }
2163
+ return /* @__PURE__ */ jsx("p", { children: t("No items exist") });
2164
+ };
2165
+ const EmptyStateIndicator = React.memo(
2166
+ UnMemoizedEmptyStateIndicator
2167
+ );
2168
+ const makeChannelReducer = () => (state, action) => {
2169
+ switch (action.type) {
2170
+ case "closeThread": {
2171
+ return {
2172
+ ...state,
2173
+ thread: null,
2174
+ threadLoadingMore: false,
2175
+ threadMessages: []
2176
+ };
2177
+ }
2178
+ case "copyMessagesFromChannel": {
2179
+ const { channel, parentId } = action;
2180
+ return {
2181
+ ...state,
2182
+ messages: [...channel.state.messages],
2183
+ pinnedMessages: [...channel.state.pinnedMessages],
2184
+ // copying messages from channel happens with new message - this resets the suppressAutoscroll
2185
+ suppressAutoscroll: false,
2186
+ threadMessages: parentId ? { ...channel.state.threads }[parentId] || [] : state.threadMessages
2187
+ };
2188
+ }
2189
+ case "copyStateFromChannelOnEvent": {
2190
+ const { channel } = action;
2191
+ return {
2192
+ ...state,
2193
+ members: { ...channel.state.members },
2194
+ messages: [...channel.state.messages],
2195
+ pinnedMessages: [...channel.state.pinnedMessages],
2196
+ read: { ...channel.state.read },
2197
+ watcherCount: channel.state.watcher_count,
2198
+ watchers: { ...channel.state.watchers }
2199
+ };
2200
+ }
2201
+ case "initStateFromChannel": {
2202
+ const { channel, hasMore } = action;
2203
+ return {
2204
+ ...state,
2205
+ hasMore,
2206
+ loading: false,
2207
+ members: { ...channel.state.members },
2208
+ messages: [...channel.state.messages],
2209
+ pinnedMessages: [...channel.state.pinnedMessages],
2210
+ read: { ...channel.state.read },
2211
+ watcherCount: channel.state.watcher_count,
2212
+ watchers: { ...channel.state.watchers }
2213
+ };
2214
+ }
2215
+ case "jumpToLatestMessageFinished": {
2216
+ const { hasMore, hasMoreNewer, messages } = action;
2217
+ return {
2218
+ ...state,
2219
+ hasMore,
2220
+ hasMoreNewer,
2221
+ highlightedMessageId: void 0,
2222
+ loading: false,
2223
+ messages,
2224
+ suppressAutoscroll: false
2225
+ };
2226
+ }
2227
+ case "jumpToMessageFinished": {
2228
+ return {
2229
+ ...state,
2230
+ hasMore: action.channel.state.messagePagination.hasPrev,
2231
+ hasMoreNewer: action.channel.state.messagePagination.hasNext,
2232
+ highlightedMessageId: action.highlightedMessageId,
2233
+ loadingMore: false,
2234
+ loadingMoreForJumpToChannelMessage: false,
2235
+ messages: action.channel.state.messages,
2236
+ suppressAutoscroll: false
2237
+ };
2238
+ }
2239
+ case "clearHighlightedMessage": {
2240
+ return {
2241
+ ...state,
2242
+ highlightedMessageId: void 0
2243
+ };
2244
+ }
2245
+ case "loadMoreFinished": {
2246
+ const { hasMore, messages } = action;
2247
+ return {
2248
+ ...state,
2249
+ hasMore,
2250
+ loadingMore: false,
2251
+ messages,
2252
+ suppressAutoscroll: false
2253
+ };
2254
+ }
2255
+ case "loadMoreNewerFinished": {
2256
+ const { hasMoreNewer, messages } = action;
2257
+ return {
2258
+ ...state,
2259
+ hasMoreNewer,
2260
+ loadingMoreNewer: false,
2261
+ messages
2262
+ };
2263
+ }
2264
+ case "loadMoreThreadFinished": {
2265
+ const { threadHasMore, threadMessages } = action;
2266
+ return {
2267
+ ...state,
2268
+ threadHasMore,
2269
+ threadLoadingMore: false,
2270
+ threadMessages
2271
+ };
2272
+ }
2273
+ case "openThread": {
2274
+ const { channel, message } = action;
2275
+ return {
2276
+ ...state,
2277
+ thread: message,
2278
+ threadHasMore: true,
2279
+ threadMessages: message.id ? { ...channel.state.threads }[message.id] || [] : [],
2280
+ threadSuppressAutoscroll: false
2281
+ };
2282
+ }
2283
+ case "setError": {
2284
+ const { error } = action;
2285
+ return { ...state, error };
2286
+ }
2287
+ case "setLoadingMore": {
2288
+ const { loadingMore } = action;
2289
+ return { ...state, loadingMore, suppressAutoscroll: loadingMore };
2290
+ }
2291
+ case "setLoadingMoreForJumpToChannelMessage": {
2292
+ const { loadingMoreForJumpToChannelMessage } = action;
2293
+ return {
2294
+ ...state,
2295
+ loadingMoreForJumpToChannelMessage,
2296
+ suppressAutoscroll: loadingMoreForJumpToChannelMessage
2297
+ };
2298
+ }
2299
+ case "setLoadingMoreNewer": {
2300
+ const { loadingMoreNewer } = action;
2301
+ return { ...state, loadingMoreNewer };
2302
+ }
2303
+ case "setThread": {
2304
+ const { message } = action;
2305
+ return { ...state, thread: message };
2306
+ }
2307
+ case "setTyping": {
2308
+ const { channel } = action;
2309
+ return {
2310
+ ...state,
2311
+ typing: { ...channel.state.typing }
2312
+ };
2313
+ }
2314
+ case "startLoadingThread": {
2315
+ return {
2316
+ ...state,
2317
+ threadLoadingMore: true,
2318
+ threadSuppressAutoscroll: true
2319
+ };
2320
+ }
2321
+ case "updateThreadOnEvent": {
2322
+ const { channel, message } = action;
2323
+ if (!state.thread) return state;
2324
+ return {
2325
+ ...state,
2326
+ thread: message?.id === state.thread.id ? channel.state.formatMessage(message) : state.thread,
2327
+ threadMessages: state.thread?.id ? { ...channel.state.threads }[state.thread.id] || [] : []
2328
+ };
2329
+ }
2330
+ default:
2331
+ return state;
2332
+ }
2333
+ };
2334
+ const initialState = {
2335
+ error: null,
2336
+ hasMore: true,
2337
+ hasMoreNewer: false,
2338
+ loading: true,
2339
+ loadingMore: false,
2340
+ loadingMoreForJumpToChannelMessage: false,
2341
+ members: {},
2342
+ messages: [],
2343
+ pinnedMessages: [],
2344
+ read: {},
2345
+ suppressAutoscroll: false,
2346
+ thread: null,
2347
+ threadHasMore: true,
2348
+ threadLoadingMore: false,
2349
+ threadMessages: [],
2350
+ threadSuppressAutoscroll: false,
2351
+ typing: {},
2352
+ watcherCount: 0,
2353
+ watchers: {}
2354
+ };
2355
+ const useCreateChannelStateContext = (value) => {
2356
+ const {
2357
+ channel,
2358
+ channelCapabilitiesArray = [],
2359
+ channelConfig,
2360
+ channelUnreadUiState,
2361
+ error,
2362
+ giphyVersion,
2363
+ hasMore,
2364
+ hasMoreNewer,
2365
+ highlightedMessageId,
2366
+ imageAttachmentSizeHandler,
2367
+ loading,
2368
+ loadingMore,
2369
+ loadingMoreForJumpToChannelMessage,
2370
+ members,
2371
+ messages = [],
2372
+ mutes,
2373
+ notifications,
2374
+ pinnedMessages,
2375
+ read = {},
2376
+ shouldGenerateVideoThumbnail,
2377
+ skipMessageDataMemoization,
2378
+ suppressAutoscroll,
2379
+ thread,
2380
+ threadHasMore,
2381
+ threadLoadingMore,
2382
+ threadMessages = [],
2383
+ videoAttachmentSizeHandler,
2384
+ watcher_count,
2385
+ watcherCount,
2386
+ watchers
2387
+ } = value;
2388
+ const channelId = channel.cid;
2389
+ const lastRead = channel.initialized && channel.lastRead()?.getTime();
2390
+ const membersLength = Object.keys(members || []).length;
2391
+ const notificationsLength = notifications.length;
2392
+ const readUsers = Object.values(read);
2393
+ const readUsersLength = readUsers.length;
2394
+ const readUsersLastReadDateStrings = [];
2395
+ for (const { last_read } of readUsers) {
2396
+ if (!lastRead) continue;
2397
+ readUsersLastReadDateStrings.push(last_read?.toISOString());
2398
+ }
2399
+ const readUsersLastReads = readUsersLastReadDateStrings.join();
2400
+ const threadMessagesLength = threadMessages?.length;
2401
+ const channelCapabilities = {};
2402
+ channelCapabilitiesArray.forEach((capability) => {
2403
+ channelCapabilities[capability] = true;
2404
+ });
2405
+ const memoizedMessageData = skipMessageDataMemoization ? messages : messages.map(
2406
+ ({
2407
+ deleted_at,
2408
+ latest_reactions,
2409
+ pinned,
2410
+ reply_count,
2411
+ status,
2412
+ type,
2413
+ updated_at,
2414
+ user
2415
+ }) => `${type}${deleted_at}${latest_reactions ? latest_reactions.map(({ type: type2 }) => type2).join() : ""}${pinned}${reply_count}${status}${updated_at && (isDayOrMoment(updated_at) || isDate(updated_at)) ? updated_at.toISOString() : updated_at || ""}${user?.updated_at}`
2416
+ ).join();
2417
+ const memoizedThreadMessageData = threadMessages.map(
2418
+ ({ deleted_at, latest_reactions, pinned, status, updated_at, user }) => `${deleted_at}${latest_reactions ? latest_reactions.map(({ type }) => type).join() : ""}${pinned}${status}${updated_at && (isDayOrMoment(updated_at) || isDate(updated_at)) ? updated_at.toISOString() : updated_at || ""}${user?.updated_at}`
2419
+ ).join();
2420
+ const channelStateContext = useMemo(
2421
+ () => ({
2422
+ channel,
2423
+ channelCapabilities,
2424
+ channelConfig,
2425
+ channelUnreadUiState,
2426
+ error,
2427
+ giphyVersion,
2428
+ hasMore,
2429
+ hasMoreNewer,
2430
+ highlightedMessageId,
2431
+ imageAttachmentSizeHandler,
2432
+ loading,
2433
+ loadingMore,
2434
+ loadingMoreForJumpToChannelMessage,
2435
+ members,
2436
+ messages,
2437
+ mutes,
2438
+ notifications,
2439
+ pinnedMessages,
2440
+ read,
2441
+ shouldGenerateVideoThumbnail,
2442
+ suppressAutoscroll,
2443
+ thread,
2444
+ threadHasMore,
2445
+ threadLoadingMore,
2446
+ threadMessages,
2447
+ videoAttachmentSizeHandler,
2448
+ watcher_count,
2449
+ watcherCount,
2450
+ watchers
2451
+ }),
2452
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2453
+ [
2454
+ channel.data?.name,
2455
+ // otherwise ChannelHeader will not be updated
2456
+ channelId,
2457
+ channelUnreadUiState,
2458
+ error,
2459
+ hasMore,
2460
+ hasMoreNewer,
2461
+ highlightedMessageId,
2462
+ lastRead,
2463
+ loading,
2464
+ loadingMore,
2465
+ loadingMoreForJumpToChannelMessage,
2466
+ membersLength,
2467
+ memoizedMessageData,
2468
+ memoizedThreadMessageData,
2469
+ notificationsLength,
2470
+ readUsersLength,
2471
+ readUsersLastReads,
2472
+ shouldGenerateVideoThumbnail,
2473
+ skipMessageDataMemoization,
2474
+ suppressAutoscroll,
2475
+ thread,
2476
+ threadHasMore,
2477
+ threadLoadingMore,
2478
+ threadMessagesLength,
2479
+ watcherCount
2480
+ ]
2481
+ );
2482
+ return channelStateContext;
2483
+ };
2484
+ const useCreateTypingContext = (value) => {
2485
+ const { typing } = value;
2486
+ const typingValue = Object.keys(typing || {}).join();
2487
+ const typingContext = useMemo(
2488
+ () => ({
2489
+ typing
2490
+ }),
2491
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2492
+ [typingValue]
2493
+ );
2494
+ return typingContext;
2495
+ };
2496
+ const useEditMessageHandler = (doUpdateMessageRequest) => {
2497
+ const { channel, client } = useChatContext("useEditMessageHandler");
2498
+ return (updatedMessage, options) => {
2499
+ if (doUpdateMessageRequest && channel) {
2500
+ return Promise.resolve(
2501
+ doUpdateMessageRequest(channel.cid, updatedMessage, options)
2502
+ );
2503
+ }
2504
+ return client.updateMessage(updatedMessage, void 0, options);
2505
+ };
2506
+ };
2507
+ const useIsMounted = () => {
2508
+ const isMounted = useRef(false);
2509
+ useEffect(() => {
2510
+ isMounted.current = true;
2511
+ return () => {
2512
+ isMounted.current = false;
2513
+ };
2514
+ }, []);
2515
+ return isMounted;
2516
+ };
2517
+ const useMentionsHandlers = (onMentionsHover, onMentionsClick) => useCallback(
2518
+ (event, mentioned_users) => {
2519
+ if (!onMentionsHover && !onMentionsClick || !(event.target instanceof HTMLElement)) {
2520
+ return;
2521
+ }
2522
+ const target = event.target;
2523
+ const textContent = target.innerHTML.replace("*", "");
2524
+ if (textContent[0] === "@") {
2525
+ const userName = textContent.replace("@", "");
2526
+ const user = mentioned_users?.find(
2527
+ ({ id, name }) => name === userName || id === userName
2528
+ );
2529
+ if (onMentionsHover && typeof onMentionsHover === "function" && event.type === "mouseover") {
2530
+ onMentionsHover(event, user);
2531
+ }
2532
+ if (onMentionsClick && event.type === "click" && typeof onMentionsClick === "function") {
2533
+ onMentionsClick(event, user);
2534
+ }
2535
+ }
2536
+ },
2537
+ [onMentionsClick, onMentionsHover]
2538
+ );
2539
+ const LoadingMessage = ({
2540
+ bubbleSize,
2541
+ metadataSize,
2542
+ outgoing = false
2543
+ }) => /* @__PURE__ */ jsxs(
2544
+ "div",
2545
+ {
2546
+ className: `str-chat__loading-channel-message ${outgoing ? "str-chat__loading-channel-message--outgoing" : "str-chat__loading-channel-message--incoming"}`,
2547
+ children: [
2548
+ !outgoing ? /* @__PURE__ */ jsx("div", { className: "str-chat__loading-channel-message-avatar" }) : null,
2549
+ /* @__PURE__ */ jsxs("div", { className: "str-chat__loading-channel-message-content", children: [
2550
+ /* @__PURE__ */ jsx(
2551
+ "div",
2552
+ {
2553
+ className: `str-chat__loading-channel-message-bubble str-chat__loading-channel-message-bubble--${bubbleSize}`
2554
+ }
2555
+ ),
2556
+ /* @__PURE__ */ jsx(
2557
+ "div",
2558
+ {
2559
+ className: `str-chat__loading-channel-message-metadata str-chat__loading-channel-message-metadata--${metadataSize}`
2560
+ }
2561
+ )
2562
+ ] })
2563
+ ]
2564
+ }
2565
+ );
2566
+ const LoadingMessageInput = () => /* @__PURE__ */ jsx("div", { className: "str-chat__message-composer-container str-chat__message-composer-container--loading", children: /* @__PURE__ */ jsxs("div", { className: "str-chat__message-composer", children: [
2567
+ /* @__PURE__ */ jsx("div", { className: "str-chat__loading-channel-message-input-button" }),
2568
+ /* @__PURE__ */ jsx("div", { className: "str-chat__loading-channel-message-input-pill" })
2569
+ ] }) });
2570
+ const LoadingChannelHeader = () => /* @__PURE__ */ jsxs("div", { className: "str-chat__channel-header str-chat__channel-header--loading", children: [
2571
+ /* @__PURE__ */ jsx("div", { className: "str-chat__channel-header__data str-chat__channel-header__data--loading", children: /* @__PURE__ */ jsx("div", { className: "str-chat__loading-channel-header-name" }) }),
2572
+ /* @__PURE__ */ jsx("div", { className: "str-chat__loading-channel-header-avatar" })
2573
+ ] });
2574
+ const LoadingChannel = () => /* @__PURE__ */ jsxs("div", { className: "str-chat__loading-channel", children: [
2575
+ /* @__PURE__ */ jsx(LoadingChannelHeader, {}),
2576
+ /* @__PURE__ */ jsx("div", { className: "str-chat__message-list str-chat__message-list--loading", children: /* @__PURE__ */ jsx("div", { className: "str-chat__message-list-scroll", children: /* @__PURE__ */ jsxs("div", { className: "str-chat__loading-channel-message-list", children: [
2577
+ /* @__PURE__ */ jsx(LoadingMessage, { bubbleSize: "lg", metadataSize: "md" }),
2578
+ /* @__PURE__ */ jsx(LoadingMessage, { bubbleSize: "md", metadataSize: "sm", outgoing: true }),
2579
+ /* @__PURE__ */ jsx(LoadingMessage, { bubbleSize: "lg", metadataSize: "md" })
2580
+ ] }) }) }),
2581
+ /* @__PURE__ */ jsx(LoadingMessageInput, {})
2582
+ ] });
2583
+ const UnMemoizedLoadingErrorIndicator = ({ error }) => {
2584
+ const { t } = useTranslationContext("LoadingErrorIndicator");
2585
+ if (!error) return null;
2586
+ return /* @__PURE__ */ jsx("div", { children: t("Error: {{ errorMessage }}", { errorMessage: error.message }) });
2587
+ };
2588
+ const LoadingErrorIndicator = React.memo(
2589
+ UnMemoizedLoadingErrorIndicator,
2590
+ (prevProps, nextProps) => prevProps.error?.message === nextProps.error?.message
2591
+ );
2592
+ const CHANNEL_CONTAINER_ID = "str-chat__channel";
2593
+ const DEFAULT_NEXT_CHANNEL_PAGE_SIZE = 25;
2594
+ const DEFAULT_JUMP_TO_PAGE_SIZE = 25;
2595
+ const DEFAULT_THREAD_PAGE_SIZE = 25;
2596
+ const DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD = 250;
2597
+ const DEFAULT_HIGHLIGHT_DURATION = 500;
2598
+ const validateAndGetMessage = (func, args) => {
2599
+ if (!func || typeof func !== "function") return null;
2600
+ if (!Array.isArray(args)) {
2601
+ args = [args];
2602
+ }
2603
+ const returnValue = func(...args);
2604
+ if (typeof returnValue !== "string") return null;
2605
+ return returnValue;
2606
+ };
2607
+ const isUserMuted = (message, mutes) => {
2608
+ if (!mutes || !message) return false;
2609
+ const userMuted = mutes.filter((el) => el.target.id === message.user?.id);
2610
+ return !!userMuted.length;
2611
+ };
2612
+ const OPTIONAL_MESSAGE_ACTIONS = {
2613
+ deleteForMe: "deleteForMe"
2614
+ };
2615
+ const MESSAGE_ACTIONS = {
2616
+ delete: "delete",
2617
+ edit: "edit",
2618
+ flag: "flag",
2619
+ markUnread: "markUnread",
2620
+ mute: "mute",
2621
+ pin: "pin",
2622
+ quote: "quote",
2623
+ react: "react",
2624
+ remindMe: "remindMe",
2625
+ reply: "reply",
2626
+ saveForLater: "saveForLater"
2627
+ };
2628
+ const defaultPinPermissions = {
2629
+ commerce: {
2630
+ admin: true,
2631
+ anonymous: false,
2632
+ channel_member: false,
2633
+ channel_moderator: true,
2634
+ guest: false,
2635
+ member: false,
2636
+ moderator: true,
2637
+ owner: true,
2638
+ user: false
2639
+ },
2640
+ gaming: {
2641
+ admin: true,
2642
+ anonymous: false,
2643
+ channel_member: false,
2644
+ channel_moderator: true,
2645
+ guest: false,
2646
+ member: false,
2647
+ moderator: true,
2648
+ owner: false,
2649
+ user: false
2650
+ },
2651
+ livestream: {
2652
+ admin: true,
2653
+ anonymous: false,
2654
+ channel_member: false,
2655
+ channel_moderator: true,
2656
+ guest: false,
2657
+ member: false,
2658
+ moderator: true,
2659
+ owner: true,
2660
+ user: false
2661
+ },
2662
+ messaging: {
2663
+ admin: true,
2664
+ anonymous: false,
2665
+ channel_member: true,
2666
+ channel_moderator: true,
2667
+ guest: false,
2668
+ member: true,
2669
+ moderator: true,
2670
+ owner: true,
2671
+ user: false
2672
+ },
2673
+ team: {
2674
+ admin: true,
2675
+ anonymous: false,
2676
+ channel_member: true,
2677
+ channel_moderator: true,
2678
+ guest: false,
2679
+ member: true,
2680
+ moderator: true,
2681
+ owner: true,
2682
+ user: false
2683
+ }
2684
+ };
2685
+ const getMessageActions = (actions, {
2686
+ canDelete,
2687
+ canEdit,
2688
+ canFlag,
2689
+ canMarkUnread,
2690
+ canMute,
2691
+ canPin,
2692
+ canQuote,
2693
+ canReact,
2694
+ canReply
2695
+ }, channelConfig) => {
2696
+ const messageActionsAfterPermission = [];
2697
+ let messageActions = [];
2698
+ if (actions && typeof actions === "boolean") {
2699
+ messageActions = Object.keys(MESSAGE_ACTIONS);
2700
+ } else if (actions && actions.length > 0) {
2701
+ messageActions = [...actions];
2702
+ } else {
2703
+ return [];
2704
+ }
2705
+ if (canDelete && messageActions.indexOf(MESSAGE_ACTIONS.delete) > -1) {
2706
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.delete);
2707
+ }
2708
+ if (canDelete && messageActions.indexOf(OPTIONAL_MESSAGE_ACTIONS.deleteForMe) > -1) {
2709
+ messageActionsAfterPermission.push(OPTIONAL_MESSAGE_ACTIONS.deleteForMe);
2710
+ }
2711
+ if (canEdit && messageActions.indexOf(MESSAGE_ACTIONS.edit) > -1) {
2712
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.edit);
2713
+ }
2714
+ if (canFlag && messageActions.indexOf(MESSAGE_ACTIONS.flag) > -1) {
2715
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.flag);
2716
+ }
2717
+ if (canMarkUnread && messageActions.indexOf(MESSAGE_ACTIONS.markUnread) > -1) {
2718
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.markUnread);
2719
+ }
2720
+ if (canMute && messageActions.indexOf(MESSAGE_ACTIONS.mute) > -1) {
2721
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.mute);
2722
+ }
2723
+ if (canPin && messageActions.indexOf(MESSAGE_ACTIONS.pin) > -1) {
2724
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.pin);
2725
+ }
2726
+ if (canQuote && messageActions.indexOf(MESSAGE_ACTIONS.quote) > -1) {
2727
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.quote);
2728
+ }
2729
+ if (canReact && messageActions.indexOf(MESSAGE_ACTIONS.react) > -1) {
2730
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.react);
2731
+ }
2732
+ if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.remindMe) > -1) {
2733
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.remindMe);
2734
+ }
2735
+ if (canReply && messageActions.indexOf(MESSAGE_ACTIONS.reply) > -1) {
2736
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.reply);
2737
+ }
2738
+ if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.saveForLater) > -1) {
2739
+ messageActionsAfterPermission.push(MESSAGE_ACTIONS.saveForLater);
2740
+ }
2741
+ return messageActionsAfterPermission;
2742
+ };
2743
+ const ACTIONS_NOT_WORKING_IN_THREAD = [
2744
+ MESSAGE_ACTIONS.pin,
2745
+ MESSAGE_ACTIONS.reply,
2746
+ MESSAGE_ACTIONS.markUnread
2747
+ ];
2748
+ function areMessagesEqual(prevMessage, nextMessage) {
2749
+ const areBaseMessagesEqual = (prevMessage2, nextMessage2) => prevMessage2.deleted_at === nextMessage2.deleted_at && prevMessage2.latest_reactions?.length === nextMessage2.latest_reactions?.length && prevMessage2.own_reactions?.length === nextMessage2.own_reactions?.length && prevMessage2.pinned === nextMessage2.pinned && prevMessage2.reply_count === nextMessage2.reply_count && prevMessage2.show_in_channel === nextMessage2.show_in_channel && prevMessage2.status === nextMessage2.status && prevMessage2.text === nextMessage2.text && prevMessage2.type === nextMessage2.type && prevMessage2.updated_at === nextMessage2.updated_at && prevMessage2.user?.updated_at === nextMessage2.user?.updated_at;
2750
+ return areBaseMessagesEqual(prevMessage, nextMessage) && Boolean(prevMessage.quoted_message) === Boolean(nextMessage.quoted_message) && (!prevMessage.quoted_message && !nextMessage.quoted_message || areBaseMessagesEqual(
2751
+ prevMessage.quoted_message,
2752
+ nextMessage.quoted_message
2753
+ ));
2754
+ }
2755
+ const areMessagePropsEqual = (prevProps, nextProps) => {
2756
+ const { message: prevMessage, Message: prevMessageUI } = prevProps;
2757
+ const { message: nextMessage, Message: nextMessageUI } = nextProps;
2758
+ if (prevMessageUI !== nextMessageUI) return false;
2759
+ if (nextProps.showDetailedReactions !== prevProps.showDetailedReactions) {
2760
+ return false;
2761
+ }
2762
+ if (nextProps.closeReactionSelectorOnClick !== prevProps.closeReactionSelectorOnClick) {
2763
+ return false;
2764
+ }
2765
+ const messagesAreEqual = areMessagesEqual(prevMessage, nextMessage);
2766
+ if (!messagesAreEqual) return false;
2767
+ const deepEqualProps = deepequal(nextProps.messageActions, prevProps.messageActions) && deepequal(nextProps.readBy, prevProps.readBy) && deepequal(nextProps.deliveredTo, prevProps.deliveredTo) && deepequal(nextProps.highlighted, prevProps.highlighted) && deepequal(nextProps.groupStyles, prevProps.groupStyles) && // last 3 messages can have different group styles
2768
+ deepequal(nextProps.mutes, prevProps.mutes) && deepequal(nextProps.lastReceivedId, prevProps.lastReceivedId);
2769
+ if (!deepEqualProps) return false;
2770
+ return prevProps.messageListRect === nextProps.messageListRect;
2771
+ };
2772
+ const areMessageUIPropsEqual = (prevProps, nextProps) => {
2773
+ const { lastReceivedId: prevLastReceivedId, message: prevMessage } = prevProps;
2774
+ const { lastReceivedId: nextLastReceivedId, message: nextMessage } = nextProps;
2775
+ if (prevProps.highlighted !== nextProps.highlighted) return false;
2776
+ if (prevProps.threadList !== nextProps.threadList) return false;
2777
+ if (prevProps.endOfGroup !== nextProps.endOfGroup) return false;
2778
+ if (prevProps.mutes?.length !== nextProps.mutes?.length) return false;
2779
+ if (prevProps.readBy?.length !== nextProps.readBy?.length) return false;
2780
+ if (prevProps.deliveredTo?.length !== nextProps.deliveredTo?.length) return false;
2781
+ if (prevProps.groupStyles !== nextProps.groupStyles) return false;
2782
+ if (prevProps.showDetailedReactions !== nextProps.showDetailedReactions) {
2783
+ return false;
2784
+ }
2785
+ if ((prevMessage.id === prevLastReceivedId || prevMessage.id === nextLastReceivedId) && prevLastReceivedId !== nextLastReceivedId) {
2786
+ return false;
2787
+ }
2788
+ return areMessagesEqual(prevMessage, nextMessage);
2789
+ };
2790
+ const messageHasReactions = (message) => Object.values(message?.reaction_groups ?? {}).some(({ count }) => count > 0);
2791
+ const messageHasAttachments = (message) => !!message?.attachments && !!message.attachments.length;
2792
+ const messageHasSingleAttachment = (message) => message?.attachments?.length === 1;
2793
+ const messageHasGiphyAttachment = (message) => !!message?.attachments?.some((att) => att.type === "giphy");
2794
+ const getImages = (message) => {
2795
+ if (!message?.attachments) {
2796
+ return [];
2797
+ }
2798
+ return message.attachments.filter((item) => item.type === "image");
2799
+ };
2800
+ const getNonImageAttachments = (message) => {
2801
+ if (!message?.attachments) {
2802
+ return [];
2803
+ }
2804
+ return message.attachments.filter((item) => item.type !== "image");
2805
+ };
2806
+ const mapToUserNameOrId = (user) => user.name || user.id;
2807
+ const getReadByTooltipText = (users, t, client, tooltipUserNameMapper) => {
2808
+ let outStr = "";
2809
+ if (!t) {
2810
+ throw new Error(
2811
+ "getReadByTooltipText was called, but translation function is not available"
2812
+ );
2813
+ }
2814
+ if (!tooltipUserNameMapper) {
2815
+ throw new Error(
2816
+ "getReadByTooltipText was called, but tooltipUserNameMapper function is not available"
2817
+ );
2818
+ }
2819
+ const otherUsers = users.filter((item) => item && client?.user && item.id !== client.user.id).map(tooltipUserNameMapper);
2820
+ const slicedArr = otherUsers.slice(0, 5);
2821
+ const restLength = otherUsers.length - slicedArr.length;
2822
+ if (slicedArr.length === 1) {
2823
+ outStr = `${slicedArr[0]} `;
2824
+ } else if (slicedArr.length === 2) {
2825
+ outStr = t("{{ firstUser }} and {{ secondUser }}", {
2826
+ firstUser: slicedArr[0],
2827
+ secondUser: slicedArr[1]
2828
+ });
2829
+ } else if (slicedArr.length > 2) {
2830
+ if (restLength === 0) {
2831
+ const lastUser = slicedArr.splice(slicedArr.length - 1, 1);
2832
+ outStr = t("{{ commaSeparatedUsers }}, and {{ lastUser }}", {
2833
+ commaSeparatedUsers: slicedArr.join(", "),
2834
+ lastUser
2835
+ });
2836
+ } else {
2837
+ outStr = t("{{ commaSeparatedUsers }} and {{ moreCount }} more", {
2838
+ commaSeparatedUsers: slicedArr.join(", "),
2839
+ moreCount: restLength
2840
+ });
2841
+ }
2842
+ }
2843
+ return outStr;
2844
+ };
2845
+ const countEmojis = (text) => {
2846
+ const matches = text?.match(emojiRegex());
2847
+ return matches ? matches.length : 0;
2848
+ };
2849
+ const messageTextHasEmojisOnly = (message) => {
2850
+ if (!message.text) return false;
2851
+ const noEmojis = message.text.replace(emojiRegex(), "");
2852
+ const noSpace = noEmojis.replace(/[\s\n]/gm, "");
2853
+ return !noSpace;
2854
+ };
2855
+ const isMessageErrorRetryable = (message) => message.status === "failed" && message.error?.status !== 403;
2856
+ const isNetworkSendFailure = (message) => message.status === "failed" && message.error?.status === 0;
2857
+ const isMessageBounced = (message) => message.type === "error" && (message.moderation_details?.action === "MESSAGE_RESPONSE_ACTION_BOUNCE" || message.moderation?.action === "bounce");
2858
+ const isMessageBlocked = (message) => message.type === "error" && (message.moderation_details?.action === "MESSAGE_RESPONSE_ACTION_REMOVE" || message.moderation?.action === "remove");
2859
+ const isMessageEdited = (message) => !!message.message_text_updated_at;
2860
+ const hasResizeObserver = typeof window !== "undefined" && "ResizeObserver" in window;
2861
+ function autoMiddlewareFor(p) {
2862
+ if (!String(p).startsWith("auto")) return null;
2863
+ const alignment = p === "auto-start" ? "start" : p === "auto-end" ? "end" : void 0;
2864
+ return autoPlacement({ alignment });
2865
+ }
2866
+ function toOffsetMw(opt) {
2867
+ if (opt == null) return null;
2868
+ if (Array.isArray(opt)) {
2869
+ const [crossAxis, mainAxis] = opt;
2870
+ return offset({ crossAxis, mainAxis });
2871
+ }
2872
+ if (typeof opt === "number") return offset(opt);
2873
+ return offset(opt);
2874
+ }
2875
+ function usePopoverPosition({
2876
+ allowFlip = true,
2877
+ allowShift = true,
2878
+ autoUpdateOptions,
2879
+ fitAvailableSpace = false,
2880
+ freeze = false,
2881
+ offset: offset2,
2882
+ placement = "bottom-start",
2883
+ shiftOptions
2884
+ }) {
2885
+ const autoMw = autoMiddlewareFor(placement);
2886
+ const offsetMiddleware = toOffsetMw(offset2);
2887
+ const isSidePlacement = placement.startsWith("left") || placement.startsWith("right");
2888
+ const mergedShiftOptions = shiftOptions ? { padding: 8, ...shiftOptions } : { padding: 8 };
2889
+ const middleware = [
2890
+ // offset first (mirrors common Popper setups)
2891
+ ...offsetMiddleware ? [offsetMiddleware] : [],
2892
+ // choose between autoPlacement (Popper's "auto*") OR flip()
2893
+ // only allow flip when not explicitly 'left*' or 'right*'
2894
+ ...autoMw ? [autoMw] : allowFlip && !isSidePlacement ? [flip()] : [],
2895
+ // viewport collision adjustments
2896
+ ...allowShift ? [shift(mergedShiftOptions)] : [],
2897
+ // optional size constraining
2898
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2899
+ ...fitAvailableSpace ? [size({ apply: () => {
2900
+ } })] : []
2901
+ ];
2902
+ const seedPlacement = String(placement).startsWith("auto") ? "bottom" : placement;
2903
+ return useFloating({
2904
+ middleware,
2905
+ placement: seedPlacement,
2906
+ strategy: "fixed",
2907
+ whileElementsMounted: freeze ? void 0 : (reference, floating, update) => autoUpdate(reference, floating, update, {
2908
+ ancestorResize: true,
2909
+ ancestorScroll: true,
2910
+ animationFrame: false,
2911
+ elementResize: hasResizeObserver,
2912
+ ...autoUpdateOptions
2913
+ })
2914
+ });
2915
+ }
2916
+ const LegacyThreadContext = React.createContext({ legacyThread: void 0 });
2917
+ const useLegacyThreadContext = () => useContext(LegacyThreadContext);
2918
+ const cooldownTimerStateSelector = (state) => ({
2919
+ isCooldownActive: !!state.cooldownRemaining
2920
+ });
2921
+ const useIsCooldownActive = () => {
2922
+ const { channel } = useChannelStateContext();
2923
+ return useStateStore(channel.cooldownTimer.state, cooldownTimerStateSelector).isCooldownActive;
2924
+ };
2925
+ const queueCache = new FixedSizeQueueCache(64);
2926
+ const useMessageComposerController = () => {
2927
+ const { client } = useChatContext();
2928
+ const { channel } = useChannelStateContext();
2929
+ const { legacyThread: parentMessage } = useLegacyThreadContext();
2930
+ const threadInstance = useThreadContext();
2931
+ const cachedParentMessage = useMemo(() => {
2932
+ if (!parentMessage) return void 0;
2933
+ return parentMessage;
2934
+ }, [parentMessage?.id]);
2935
+ const messageComposer = useMemo(() => {
2936
+ if (threadInstance) {
2937
+ return threadInstance.messageComposer;
2938
+ } else if (cachedParentMessage) {
2939
+ const compositionContext = {
2940
+ ...cachedParentMessage,
2941
+ legacyThreadId: cachedParentMessage.id
2942
+ };
2943
+ const tag = MessageComposer.constructTag(compositionContext);
2944
+ const cachedComposer = queueCache.get(tag);
2945
+ if (cachedComposer) return cachedComposer;
2946
+ return new MessageComposer({
2947
+ client,
2948
+ compositionContext
2949
+ });
2950
+ } else {
2951
+ return channel.messageComposer;
2952
+ }
2953
+ }, [cachedParentMessage, channel, client, threadInstance]);
2954
+ if (["legacy_thread", "message"].includes(
2955
+ messageComposer.contextType
2956
+ ) && !queueCache.peek(messageComposer.tag)) {
2957
+ queueCache.add(messageComposer.tag, messageComposer);
2958
+ }
2959
+ useEffect(() => {
2960
+ const unsubscribe = messageComposer.registerSubscriptions();
2961
+ return () => {
2962
+ unsubscribe();
2963
+ };
2964
+ }, [messageComposer]);
2965
+ return messageComposer;
2966
+ };
2967
+ const CUSTOM_MESSAGE_TYPE = {
2968
+ date: "message.date",
2969
+ intro: "channel.intro"
2970
+ };
2971
+ const processMessages = (params) => {
2972
+ const { messages, reviewProcessedMessage, setGiphyPreviewMessage, ...context } = params;
2973
+ const {
2974
+ enableDateSeparator,
2975
+ hideDeletedMessages,
2976
+ hideNewMessageSeparator,
2977
+ lastRead,
2978
+ userId
2979
+ } = context;
2980
+ let unread = false;
2981
+ let ephemeralMessagePresent = false;
2982
+ let lastDateSeparator;
2983
+ const newMessages = [];
2984
+ for (let i = 0; i < messages.length; i += 1) {
2985
+ const message = messages[i];
2986
+ if (hideDeletedMessages && message.type === "deleted") {
2987
+ continue;
2988
+ }
2989
+ if (setGiphyPreviewMessage && message.type === "ephemeral" && message.command === "giphy") {
2990
+ ephemeralMessagePresent = true;
2991
+ setGiphyPreviewMessage(message);
2992
+ continue;
2993
+ }
2994
+ const changes = [];
2995
+ const messageDate = message.created_at && isDate(message.created_at) && message.created_at.toDateString() || "";
2996
+ const previousMessage = messages[i - 1];
2997
+ let prevMessageDate = messageDate;
2998
+ if (enableDateSeparator && previousMessage?.created_at && isDate(previousMessage.created_at)) {
2999
+ prevMessageDate = previousMessage.created_at.toDateString();
3000
+ }
3001
+ if (!unread && !hideNewMessageSeparator) {
3002
+ unread = lastRead && message.created_at && new Date(lastRead) < message.created_at || false;
3003
+ if (enableDateSeparator && unread && message.user?.id !== userId) {
3004
+ changes.push({
3005
+ customType: CUSTOM_MESSAGE_TYPE.date,
3006
+ date: message.created_at,
3007
+ id: makeDateMessageId(message.created_at),
3008
+ unread
3009
+ });
3010
+ }
3011
+ }
3012
+ if (enableDateSeparator && (i === 0 || // always put date separator before the first message
3013
+ messageDate !== prevMessageDate || // add date separator btw. 2 messages created on different date
3014
+ // if hiding deleted messages replace the previous deleted message(s) with A separator if the last rendered message was created on different date
3015
+ hideDeletedMessages && previousMessage?.type === "deleted" && lastDateSeparator !== messageDate) && !isDateSeparatorMessage(changes[changes.length - 1])) {
3016
+ lastDateSeparator = messageDate;
3017
+ changes.push(
3018
+ {
3019
+ customType: CUSTOM_MESSAGE_TYPE.date,
3020
+ date: message.created_at,
3021
+ id: makeDateMessageId(message.created_at)
3022
+ },
3023
+ message
3024
+ );
3025
+ } else {
3026
+ changes.push(message);
3027
+ }
3028
+ newMessages.push(
3029
+ ...reviewProcessedMessage?.({
3030
+ changes,
3031
+ context,
3032
+ index: i,
3033
+ messages,
3034
+ processedMessages: newMessages
3035
+ }) || changes
3036
+ );
3037
+ }
3038
+ if (setGiphyPreviewMessage && !ephemeralMessagePresent) {
3039
+ setGiphyPreviewMessage(void 0);
3040
+ }
3041
+ return newMessages;
3042
+ };
3043
+ const makeIntroMessage = () => ({
3044
+ customType: CUSTOM_MESSAGE_TYPE.intro,
3045
+ id: nanoid()
3046
+ });
3047
+ const makeDateMessageId = (date) => {
3048
+ let idSuffix;
3049
+ try {
3050
+ idSuffix = !date ? nanoid() : date instanceof Date ? date.toISOString() : date;
3051
+ } catch (e) {
3052
+ idSuffix = nanoid();
3053
+ }
3054
+ return `${CUSTOM_MESSAGE_TYPE.date}-${idSuffix}`;
3055
+ };
3056
+ const getLastReceived = (messages) => {
3057
+ for (let i = messages.length - 1; i > 0; i -= 1) {
3058
+ if (messages[i].status === "received") {
3059
+ return messages[i].id;
3060
+ }
3061
+ }
3062
+ return null;
3063
+ };
3064
+ const insertIntro = (messages, headerPosition) => {
3065
+ const newMessages = messages;
3066
+ const intro = makeIntroMessage();
3067
+ if (!headerPosition) {
3068
+ newMessages.unshift(intro);
3069
+ return newMessages;
3070
+ }
3071
+ if (!newMessages.length) {
3072
+ newMessages.unshift(intro);
3073
+ return newMessages;
3074
+ }
3075
+ for (let i = 0; i < messages.length; i += 1) {
3076
+ const messageTime = isDate(messages[i].created_at) ? messages[i].created_at.getTime() : null;
3077
+ const nextMessageTime = isDate(messages[i + 1].created_at) ? messages[i + 1].created_at.getTime() : null;
3078
+ if (messageTime && messageTime < headerPosition) {
3079
+ if (nextMessageTime && nextMessageTime < headerPosition) {
3080
+ if (messages[i + 1] && isDateSeparatorMessage(messages[i + 1])) continue;
3081
+ if (!nextMessageTime) {
3082
+ newMessages.push(intro);
3083
+ return newMessages;
3084
+ }
3085
+ } else {
3086
+ newMessages.splice(i + 1, 0, intro);
3087
+ return newMessages;
3088
+ }
3089
+ }
3090
+ }
3091
+ return newMessages;
3092
+ };
3093
+ const getGroupStyles = (message, previousMessage, nextMessage, noGroupByUser, maxTimeBetweenGroupedMessages) => {
3094
+ if (isDateSeparatorMessage(message) || isIntroMessage(message)) return "";
3095
+ if (noGroupByUser || message.attachments?.length !== 0) return "single";
3096
+ const isTopMessage = !previousMessage || isIntroMessage(previousMessage) || isDateSeparatorMessage(previousMessage) || previousMessage.type === "system" || previousMessage.type === "error" || previousMessage.attachments?.length !== 0 || message.user?.id !== previousMessage.user?.id || message.reaction_groups && Object.keys(message.reaction_groups).length > 0 || isMessageEdited(previousMessage) || maxTimeBetweenGroupedMessages !== void 0 && previousMessage.created_at && message.created_at && new Date(message.created_at).getTime() - new Date(previousMessage.created_at).getTime() > maxTimeBetweenGroupedMessages;
3097
+ const isBottomMessage = !nextMessage || isIntroMessage(nextMessage) || isDateSeparatorMessage(nextMessage) || nextMessage.type === "system" || nextMessage.type === "error" || nextMessage.attachments?.length !== 0 || message.user?.id !== nextMessage.user?.id || nextMessage.reaction_groups && Object.keys(nextMessage.reaction_groups).length > 0 || isMessageEdited(message) || maxTimeBetweenGroupedMessages !== void 0 && nextMessage.created_at && message.created_at && new Date(nextMessage.created_at).getTime() - new Date(message.created_at).getTime() > maxTimeBetweenGroupedMessages;
3098
+ if (!isTopMessage && !isBottomMessage) {
3099
+ if (message.type === "error") return "single";
3100
+ return "middle";
3101
+ }
3102
+ if (isBottomMessage) {
3103
+ if (isTopMessage || message.type === "error") return "single";
3104
+ return "bottom";
3105
+ }
3106
+ if (isTopMessage) return "top";
3107
+ return "";
3108
+ };
3109
+ const hasMoreMessagesProbably = (returnedCountMessages, limit) => returnedCountMessages >= limit;
3110
+ const hasNotMoreMessages = (returnedCountMessages, limit) => returnedCountMessages < limit;
3111
+ function isIntroMessage(message) {
3112
+ return message.customType === CUSTOM_MESSAGE_TYPE.intro;
3113
+ }
3114
+ function isDateSeparatorMessage(message) {
3115
+ return message !== null && typeof message === "object" && message.customType === CUSTOM_MESSAGE_TYPE.date && isDate(message.date);
3116
+ }
3117
+ function isLocalMessage(message) {
3118
+ return !isDateSeparatorMessage(message) && !isIntroMessage(message);
3119
+ }
3120
+ const getIsFirstUnreadMessage = ({
3121
+ firstUnreadMessageId,
3122
+ isFirstMessage,
3123
+ lastReadDate,
3124
+ lastReadMessageId,
3125
+ message,
3126
+ previousMessage,
3127
+ unreadMessageCount = 0
3128
+ }) => {
3129
+ if (message.parent_id) return false;
3130
+ const createdAtTimestamp = message.created_at && new Date(message.created_at).getTime();
3131
+ const lastReadTimestamp = lastReadDate?.getTime();
3132
+ const messageIsUnread = !!createdAtTimestamp && !!lastReadTimestamp && createdAtTimestamp > lastReadTimestamp;
3133
+ const previousMessageIsLastRead = !!lastReadMessageId && lastReadMessageId === previousMessage?.id;
3134
+ return firstUnreadMessageId === message.id || !!unreadMessageCount && messageIsUnread && (isFirstMessage || previousMessageIsLastRead);
3135
+ };
3136
+ const useImageFlagEmojisOnWindowsClass = () => {
3137
+ const { useImageFlagEmojisOnWindows } = useChatContext("Channel");
3138
+ return useImageFlagEmojisOnWindows && navigator.userAgent.match(/Win/) ? "str-chat--windows-flags" : "";
3139
+ };
3140
+ const getChatContainerClass = (customClass) => customClass ?? "str-chat__container";
3141
+ const useChannelContainerClasses = ({
3142
+ customClasses
3143
+ }) => {
3144
+ const windowsEmojiClass = useImageFlagEmojisOnWindowsClass();
3145
+ return {
3146
+ channelClass: customClasses?.channel ?? "str-chat__channel",
3147
+ chatClass: customClasses?.chat ?? "str-chat",
3148
+ chatContainerClass: getChatContainerClass(customClasses?.chatContainer),
3149
+ windowsEmojiClass
3150
+ };
3151
+ };
3152
+ const findInMsgSetById = (targetId, msgSet) => {
3153
+ for (let i = msgSet.length - 1; i >= 0; i--) {
3154
+ const item = msgSet[i];
3155
+ if (item.id === targetId) {
3156
+ return {
3157
+ index: i,
3158
+ target: item
3159
+ };
3160
+ }
3161
+ }
3162
+ return {
3163
+ index: -1
3164
+ };
3165
+ };
3166
+ const findInMsgSetByDate = (targetDate, msgSet, exact = false) => {
3167
+ const targetTimestamp = targetDate.getTime();
3168
+ let left = 0;
3169
+ let middle = 0;
3170
+ let right = msgSet.length - 1;
3171
+ while (left <= right) {
3172
+ middle = Math.floor((right + left) / 2);
3173
+ const middleTimestamp = new Date(
3174
+ msgSet[middle].created_at
3175
+ ).getTime();
3176
+ const middleLeftTimestamp = msgSet[middle - 1]?.created_at && new Date(msgSet[middle - 1].created_at).getTime();
3177
+ const middleRightTimestamp = msgSet[middle + 1]?.created_at && new Date(msgSet[middle + 1].created_at).getTime();
3178
+ if (middleTimestamp === targetTimestamp || middleLeftTimestamp && middleRightTimestamp && middleLeftTimestamp < targetTimestamp && targetTimestamp < middleRightTimestamp) {
3179
+ return { index: middle, target: msgSet[middle] };
3180
+ }
3181
+ if (middleTimestamp < targetTimestamp) left = middle + 1;
3182
+ else right = middle - 1;
3183
+ }
3184
+ if (!exact || new Date(msgSet[left].created_at).getTime() === targetTimestamp) {
3185
+ return { index: left, target: msgSet[left] };
3186
+ }
3187
+ return { index: -1 };
3188
+ };
3189
+ const adaptMessageSendErrorToErrorFromResponse = (error) => {
3190
+ if (error instanceof ErrorFromResponse) {
3191
+ return error;
3192
+ }
3193
+ const fallbackMessage = error instanceof Error ? error.message : "Message send failed";
3194
+ let message = fallbackMessage;
3195
+ let status = 0;
3196
+ let code = null;
3197
+ if (typeof error === "object" && error !== null) {
3198
+ const maybeAxiosError = error;
3199
+ if (maybeAxiosError.name === "AxiosError" && maybeAxiosError.code === "ERR_NETWORK") {
3200
+ message = typeof maybeAxiosError.message === "string" ? maybeAxiosError.message : "Network Error";
3201
+ status = maybeAxiosError.response?.status ?? 0;
3202
+ return new ErrorFromResponse(message, {
3203
+ code: null,
3204
+ response: maybeAxiosError.response ?? {
3205
+ // Compatibility shim: this is an intentionally incomplete AxiosResponse-like object.
3206
+ data: {
3207
+ duration: "",
3208
+ message,
3209
+ more_info: "",
3210
+ StatusCode: status
3211
+ },
3212
+ status
3213
+ },
3214
+ status
3215
+ });
3216
+ }
3217
+ try {
3218
+ const stringError = JSON.stringify(error);
3219
+ const parsedError = stringError ? JSON.parse(stringError) : {};
3220
+ if (typeof parsedError.message === "string") {
3221
+ message = parsedError.message;
3222
+ }
3223
+ if (typeof parsedError.status === "number") {
3224
+ status = parsedError.status;
3225
+ }
3226
+ if (typeof parsedError.code === "number") {
3227
+ code = parsedError.code;
3228
+ }
3229
+ } catch {
3230
+ }
3231
+ }
3232
+ return new ErrorFromResponse(message, {
3233
+ code,
3234
+ response: {
3235
+ // Compatibility shim: this is an intentionally incomplete AxiosResponse-like object.
3236
+ data: {
3237
+ duration: "",
3238
+ message,
3239
+ more_info: "",
3240
+ StatusCode: status
3241
+ },
3242
+ status
3243
+ },
3244
+ status
3245
+ });
3246
+ };
3247
+ const WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL = {};
3248
+ const getChannel = async ({
3249
+ channel,
3250
+ client,
3251
+ id,
3252
+ members,
3253
+ options,
3254
+ type
3255
+ }) => {
3256
+ if (!channel && !type) {
3257
+ throw new Error("Channel or channel type have to be provided to query a channel.");
3258
+ }
3259
+ const theChannel = channel || client.channel(type, id, { members });
3260
+ const originalCid = theChannel?.id ? theChannel.cid : members && members.length ? generateChannelTempCid(theChannel.type, members) : void 0;
3261
+ if (!originalCid) {
3262
+ throw new Error(
3263
+ "Channel ID or channel members array have to be provided to query a channel."
3264
+ );
3265
+ }
3266
+ const queryPromise = WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid];
3267
+ if (queryPromise) {
3268
+ await queryPromise;
3269
+ } else {
3270
+ try {
3271
+ WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid] = theChannel.watch(options);
3272
+ await WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid];
3273
+ } finally {
3274
+ delete WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid];
3275
+ }
3276
+ }
3277
+ return theChannel;
3278
+ };
3279
+ const generateChannelTempCid = (channelType, members) => {
3280
+ if (!members) return;
3281
+ const membersStr = [...members].sort().join(",");
3282
+ return `${channelType}:!members-${membersStr}`;
3283
+ };
3284
+ const getImageAttachmentConfiguration = (attachment, element) => {
3285
+ let newUrl = void 0;
3286
+ const urlToTest = attachment.image_url || attachment.thumb_url || "";
3287
+ if (linkify.test(urlToTest, "url")) {
3288
+ const url = new URL(urlToTest);
3289
+ const resizeDimensions = getSizingRestrictions(url, element);
3290
+ if (resizeDimensions) {
3291
+ resizeDimensions.height *= 2;
3292
+ resizeDimensions.width *= 2;
3293
+ addResizingParamsToUrl(resizeDimensions, url);
3294
+ }
3295
+ newUrl = url.href;
3296
+ }
3297
+ return {
3298
+ url: newUrl || ""
3299
+ };
3300
+ };
3301
+ const getVideoAttachmentConfiguration = (attachment, element, shouldGenerateVideoThumbnail) => {
3302
+ let thumbUrl = void 0;
3303
+ if (attachment.thumb_url && shouldGenerateVideoThumbnail && linkify.test(attachment.thumb_url, "url")) {
3304
+ const url = new URL(attachment.thumb_url);
3305
+ const resizeDimensions = getSizingRestrictions(url, element);
3306
+ if (resizeDimensions) {
3307
+ resizeDimensions.height *= 2;
3308
+ resizeDimensions.width *= 2;
3309
+ addResizingParamsToUrl(resizeDimensions, url);
3310
+ }
3311
+ thumbUrl = url.href;
3312
+ }
3313
+ return {
3314
+ thumbUrl,
3315
+ url: attachment.asset_url || ""
3316
+ };
3317
+ };
3318
+ const getSizingRestrictions = (url, htmlElement) => {
3319
+ const urlParams = url.searchParams;
3320
+ const originalHeight = Number(urlParams.get("oh")) || 1;
3321
+ const originalWidth = Number(urlParams.get("ow")) || 1;
3322
+ const cssSizeRestriction = getCSSSizeRestrictions(htmlElement);
3323
+ let resizeDimensions;
3324
+ if ((cssSizeRestriction.maxHeight || cssSizeRestriction.height) && cssSizeRestriction.maxWidth) {
3325
+ resizeDimensions = getResizeDimensions(
3326
+ originalHeight,
3327
+ originalWidth,
3328
+ /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
3329
+ cssSizeRestriction.maxHeight || cssSizeRestriction.height,
3330
+ cssSizeRestriction.maxWidth
3331
+ );
3332
+ } else {
3333
+ resizeDimensions = void 0;
3334
+ }
3335
+ return resizeDimensions;
3336
+ };
3337
+ const getResizeDimensions = (originalHeight, originalWidth, maxHeight, maxWidth) => ({
3338
+ height: Math.round(Math.max(maxHeight, maxWidth / originalWidth * originalHeight)),
3339
+ width: Math.round(Math.max(maxHeight, maxWidth / originalHeight * originalWidth))
3340
+ });
3341
+ const getCSSSizeRestrictions = (htmlElement) => {
3342
+ const computedStylesheet = getComputedStyle(htmlElement);
3343
+ const height = getValueRepresentationOfCSSProperty(
3344
+ computedStylesheet.getPropertyValue("height")
3345
+ );
3346
+ const maxHeight = getValueRepresentationOfCSSProperty(
3347
+ computedStylesheet.getPropertyValue("max-height")
3348
+ );
3349
+ const maxWidth = getValueRepresentationOfCSSProperty(
3350
+ computedStylesheet.getPropertyValue("max-width")
3351
+ );
3352
+ if (!((height || maxHeight) && maxWidth)) {
3353
+ console.warn(
3354
+ `Invalid value set for height/max-height and/or max-width for HTML element, this can cause scrolling issues inside the message list, more info https://getstream.io/chat/docs/sdk/react/message-components/attachment/#image-and-video-sizing`
3355
+ );
3356
+ }
3357
+ return { height, maxHeight, maxWidth };
3358
+ };
3359
+ const getValueRepresentationOfCSSProperty = (property) => {
3360
+ if (!property.endsWith("px")) {
3361
+ return void 0;
3362
+ }
3363
+ const number = parseFloat(property);
3364
+ return isNaN(number) ? void 0 : number;
3365
+ };
3366
+ const addResizingParamsToUrl = (resizeDimensions, url) => {
3367
+ url.searchParams.set("h", resizeDimensions.height.toString());
3368
+ url.searchParams.set("w", resizeDimensions.width.toString());
3369
+ };
3370
+ const searchControllerStateSelector = (nextValue) => ({
3371
+ focusedMessage: nextValue.focusedMessage
3372
+ });
3373
+ const useSearchFocusedMessage = () => {
3374
+ const { searchController } = useChatContext("Channel");
3375
+ const { focusedMessage } = useStateStore(
3376
+ searchController._internalState,
3377
+ searchControllerStateSelector
3378
+ );
3379
+ return focusedMessage;
3380
+ };
3381
+ const ChannelContainer = ({
3382
+ children,
3383
+ className: additionalClassName,
3384
+ ...props
3385
+ }) => {
3386
+ const { customClasses, theme } = useChatContext("Channel");
3387
+ const { channelClass, chatClass } = useChannelContainerClasses({
3388
+ customClasses
3389
+ });
3390
+ const className = clsx(chatClass, theme, channelClass, additionalClassName);
3391
+ return /* @__PURE__ */ jsx("div", { id: CHANNEL_CONTAINER_ID, ...props, className, children });
3392
+ };
3393
+ const UnMemoizedChannel = (props) => {
3394
+ const { channel: propsChannel, EmptyPlaceholder } = props;
3395
+ const {
3396
+ EmptyStateIndicator: EmptyStateIndicator$1 = EmptyStateIndicator,
3397
+ LoadingErrorIndicator: LoadingErrorIndicator2,
3398
+ LoadingIndicator = LoadingChannel
3399
+ } = useComponentContext();
3400
+ const { channel: contextChannel, channelsQueryState } = useChatContext("Channel");
3401
+ const channel = propsChannel || contextChannel;
3402
+ const emptyPlaceholder = "EmptyPlaceholder" in props ? EmptyPlaceholder : EmptyStateIndicator$1 && /* @__PURE__ */ jsx(EmptyStateIndicator$1, { listType: "message" });
3403
+ if (channelsQueryState.queryInProgress === "reload" && LoadingIndicator) {
3404
+ return /* @__PURE__ */ jsx(ChannelContainer, { children: /* @__PURE__ */ jsx(LoadingIndicator, {}) });
3405
+ }
3406
+ if (channelsQueryState.error && LoadingErrorIndicator2) {
3407
+ return /* @__PURE__ */ jsx(ChannelContainer, { children: /* @__PURE__ */ jsx(LoadingErrorIndicator2, { error: channelsQueryState.error }) });
3408
+ }
3409
+ if (channelsQueryState.error) {
3410
+ return /* @__PURE__ */ jsx(ChannelContainer, {});
3411
+ }
3412
+ if (!channel?.cid) {
3413
+ return /* @__PURE__ */ jsx(ChannelContainer, { children: emptyPlaceholder });
3414
+ }
3415
+ return /* @__PURE__ */ createElement(ChannelInner, { ...props, channel, key: channel.cid });
3416
+ };
3417
+ const ChannelInner = (props) => {
3418
+ const {
3419
+ activeUnreadHandler,
3420
+ allowConcurrentAudioPlayback,
3421
+ channel,
3422
+ channelQueryOptions,
3423
+ children,
3424
+ doDeleteMessageRequest,
3425
+ doMarkReadRequest,
3426
+ doSendMessageRequest,
3427
+ doUpdateMessageRequest,
3428
+ initializeOnMount = true,
3429
+ markReadOnMount = true,
3430
+ onMentionsClick,
3431
+ onMentionsHover,
3432
+ skipMessageDataMemoization
3433
+ } = props;
3434
+ const {
3435
+ LoadingErrorIndicator: LoadingErrorIndicator$1 = LoadingErrorIndicator,
3436
+ LoadingIndicator = LoadingChannel
3437
+ } = useComponentContext();
3438
+ const { client, customClasses, latestMessageDatesByChannels, mutes, searchController } = useChatContext("Channel");
3439
+ const { t } = useTranslationContext("Channel");
3440
+ const chatContainerClass = getChatContainerClass(customClasses?.chatContainer);
3441
+ const windowsEmojiClass = useImageFlagEmojisOnWindowsClass();
3442
+ const thread = useThreadContext();
3443
+ const [channelConfig, setChannelConfig] = useState(channel.getConfig());
3444
+ const [channelUnreadUiState, _setChannelUnreadUiState] = useState();
3445
+ const channelReducer = useMemo(() => makeChannelReducer(), []);
3446
+ const [state, dispatch] = useReducer(
3447
+ channelReducer,
3448
+ // channel.initialized === false if client.channel().query() was not called, e.g. ChannelList is not used
3449
+ // => Channel will call channel.watch() in useLayoutEffect => state.loading is used to signal the watch() call state
3450
+ {
3451
+ ...initialState,
3452
+ hasMore: channel.state.messagePagination.hasPrev,
3453
+ loading: !channel.initialized,
3454
+ messages: channel.state.messages
3455
+ }
3456
+ );
3457
+ const jumpToMessageFromSearch = useSearchFocusedMessage();
3458
+ const isMounted = useIsMounted();
3459
+ const originalTitle = useRef("");
3460
+ const lastRead = useRef(void 0);
3461
+ const online = useRef(true);
3462
+ const clearHighlightedMessageTimeoutId = useRef(
3463
+ null
3464
+ );
3465
+ const channelCapabilitiesArray = channel.data?.own_capabilities;
3466
+ const throttledCopyStateFromChannel = throttle(
3467
+ () => dispatch({ channel, type: "copyStateFromChannelOnEvent" }),
3468
+ 500,
3469
+ {
3470
+ leading: true,
3471
+ trailing: true
3472
+ }
3473
+ );
3474
+ const setChannelUnreadUiState = useMemo(
3475
+ () => throttle(_setChannelUnreadUiState, 200, {
3476
+ leading: true,
3477
+ trailing: false
3478
+ }),
3479
+ []
3480
+ );
3481
+ const markRead = useMemo(
3482
+ () => throttle(
3483
+ async (options) => {
3484
+ const { updateChannelUiUnreadState = true } = options ?? {};
3485
+ if (channel.disconnected || !channelConfig?.read_events) {
3486
+ return;
3487
+ }
3488
+ lastRead.current = /* @__PURE__ */ new Date();
3489
+ try {
3490
+ if (doMarkReadRequest) {
3491
+ doMarkReadRequest(
3492
+ channel,
3493
+ updateChannelUiUnreadState ? setChannelUnreadUiState : void 0
3494
+ );
3495
+ } else {
3496
+ const markReadResponse = await channel.markRead();
3497
+ if (updateChannelUiUnreadState && markReadResponse?.event) {
3498
+ _setChannelUnreadUiState({
3499
+ last_read: lastRead.current,
3500
+ last_read_message_id: markReadResponse.event.last_read_message_id,
3501
+ unread_messages: 0
3502
+ });
3503
+ }
3504
+ }
3505
+ if (activeUnreadHandler) {
3506
+ activeUnreadHandler(0, originalTitle.current);
3507
+ } else if (originalTitle.current) {
3508
+ document.title = originalTitle.current;
3509
+ }
3510
+ } catch (e) {
3511
+ console.error(t("Failed to mark channel as read"));
3512
+ }
3513
+ },
3514
+ 500,
3515
+ { leading: true, trailing: false }
3516
+ ),
3517
+ [
3518
+ activeUnreadHandler,
3519
+ channel,
3520
+ channelConfig,
3521
+ doMarkReadRequest,
3522
+ setChannelUnreadUiState,
3523
+ t
3524
+ ]
3525
+ );
3526
+ const handleEvent = async (event) => {
3527
+ if (event.message) {
3528
+ dispatch({
3529
+ channel,
3530
+ message: event.message,
3531
+ type: "updateThreadOnEvent"
3532
+ });
3533
+ }
3534
+ if (event.type === "user.messages.deleted" && event.cid && event.cid !== channel.cid)
3535
+ return;
3536
+ if (event.type === "user.watching.start" || event.type === "user.watching.stop")
3537
+ return;
3538
+ if (event.type === "typing.start" || event.type === "typing.stop") {
3539
+ return dispatch({ channel, type: "setTyping" });
3540
+ }
3541
+ if (event.type === "connection.changed" && typeof event.online === "boolean") {
3542
+ online.current = event.online;
3543
+ }
3544
+ if (event.type === "message.new") {
3545
+ const mainChannelUpdated = !event.message?.parent_id || event.message?.show_in_channel;
3546
+ if (mainChannelUpdated) {
3547
+ if (document.hidden && channelConfig?.read_events && !channel.muteStatus().muted) {
3548
+ const unread = channel.countUnread(lastRead.current);
3549
+ if (activeUnreadHandler) {
3550
+ activeUnreadHandler(unread, originalTitle.current);
3551
+ } else {
3552
+ document.title = `(${unread}) ${originalTitle.current}`;
3553
+ }
3554
+ }
3555
+ }
3556
+ if (event.message?.user?.id === client.userID && event?.message?.created_at && event?.message?.cid) {
3557
+ const messageDate = new Date(event.message.created_at);
3558
+ const cid = event.message.cid;
3559
+ if (!latestMessageDatesByChannels[cid] || latestMessageDatesByChannels[cid].getTime() < messageDate.getTime()) {
3560
+ latestMessageDatesByChannels[cid] = messageDate;
3561
+ }
3562
+ }
3563
+ }
3564
+ if (event.type === "user.deleted") {
3565
+ const oldestID = channel.state?.messages?.[0]?.id;
3566
+ await channel.query({
3567
+ messages: { id_lt: oldestID, limit: DEFAULT_NEXT_CHANNEL_PAGE_SIZE },
3568
+ watchers: { limit: DEFAULT_NEXT_CHANNEL_PAGE_SIZE }
3569
+ });
3570
+ }
3571
+ if (event.type === "notification.mark_unread")
3572
+ _setChannelUnreadUiState((prev) => {
3573
+ if (!(event.last_read_at && event.user)) return prev;
3574
+ return {
3575
+ first_unread_message_id: event.first_unread_message_id,
3576
+ last_read: new Date(event.last_read_at),
3577
+ last_read_message_id: event.last_read_message_id,
3578
+ unread_messages: event.unread_messages ?? 0
3579
+ };
3580
+ });
3581
+ if (event.type === "channel.truncated" && event.cid === channel.cid) {
3582
+ _setChannelUnreadUiState(void 0);
3583
+ }
3584
+ throttledCopyStateFromChannel();
3585
+ };
3586
+ useLayoutEffect(() => {
3587
+ let errored = false;
3588
+ let done = false;
3589
+ (async () => {
3590
+ if (!channel.initialized && initializeOnMount) {
3591
+ try {
3592
+ const members = [];
3593
+ if (!channel.id && channel.data?.members) {
3594
+ for (const member of channel.data.members) {
3595
+ let userId;
3596
+ if (typeof member === "string") {
3597
+ userId = member;
3598
+ } else if (typeof member === "object") {
3599
+ const { user, user_id } = member;
3600
+ userId = user_id || user?.id;
3601
+ }
3602
+ if (userId) {
3603
+ members.push(userId);
3604
+ }
3605
+ }
3606
+ }
3607
+ await getChannel({ channel, client, members, options: channelQueryOptions });
3608
+ const config = channel.getConfig();
3609
+ setChannelConfig(config);
3610
+ } catch (e) {
3611
+ dispatch({ error: e, type: "setError" });
3612
+ errored = true;
3613
+ }
3614
+ }
3615
+ done = true;
3616
+ originalTitle.current = document.title;
3617
+ if (!errored) {
3618
+ dispatch({
3619
+ channel,
3620
+ hasMore: channel.state.messagePagination.hasPrev,
3621
+ type: "initStateFromChannel"
3622
+ });
3623
+ if (client.user?.id && channel.state.read[client.user.id]) {
3624
+ const { user, ...ownReadState } = channel.state.read[client.user.id];
3625
+ _setChannelUnreadUiState(ownReadState);
3626
+ }
3627
+ if (channel.countUnread() > 0 && markReadOnMount)
3628
+ markRead({ updateChannelUiUnreadState: false });
3629
+ client.on("connection.changed", handleEvent);
3630
+ client.on("connection.recovered", handleEvent);
3631
+ client.on("user.updated", handleEvent);
3632
+ client.on("user.deleted", handleEvent);
3633
+ client.on("user.messages.deleted", handleEvent);
3634
+ channel.on(handleEvent);
3635
+ }
3636
+ })();
3637
+ return () => {
3638
+ if (errored || !done) return;
3639
+ channel?.off(handleEvent);
3640
+ client.off("connection.changed", handleEvent);
3641
+ client.off("connection.recovered", handleEvent);
3642
+ client.off("user.deleted", handleEvent);
3643
+ };
3644
+ }, [
3645
+ channel.cid,
3646
+ channelQueryOptions,
3647
+ doMarkReadRequest,
3648
+ channelConfig?.read_events,
3649
+ initializeOnMount
3650
+ ]);
3651
+ useEffect(() => {
3652
+ if (!state.thread) return;
3653
+ const message = state.messages?.find((m) => m.id === state.thread?.id);
3654
+ if (message) dispatch({ message, type: "setThread" });
3655
+ }, [state.messages, state.thread]);
3656
+ const handleHighlightedMessageChange = useCallback(
3657
+ ({
3658
+ highlightDuration,
3659
+ highlightedMessageId
3660
+ }) => {
3661
+ dispatch({
3662
+ channel,
3663
+ highlightedMessageId,
3664
+ type: "jumpToMessageFinished"
3665
+ });
3666
+ if (clearHighlightedMessageTimeoutId.current) {
3667
+ clearTimeout(clearHighlightedMessageTimeoutId.current);
3668
+ }
3669
+ clearHighlightedMessageTimeoutId.current = setTimeout(() => {
3670
+ if (searchController._internalState.getLatestValue().focusedMessage) {
3671
+ searchController._internalState.partialNext({ focusedMessage: void 0 });
3672
+ }
3673
+ clearHighlightedMessageTimeoutId.current = null;
3674
+ dispatch({ type: "clearHighlightedMessage" });
3675
+ }, highlightDuration ?? DEFAULT_HIGHLIGHT_DURATION);
3676
+ },
3677
+ [channel, searchController]
3678
+ );
3679
+ useEffect(() => {
3680
+ if (!jumpToMessageFromSearch?.id) return;
3681
+ handleHighlightedMessageChange({ highlightedMessageId: jumpToMessageFromSearch.id });
3682
+ }, [jumpToMessageFromSearch, handleHighlightedMessageChange]);
3683
+ const notifyJumpToFirstUnreadError = useCallback(() => {
3684
+ client.notifications.addError({
3685
+ message: t("Failed to jump to the first unread message"),
3686
+ options: {
3687
+ tags: addNotificationTargetTag("channel"),
3688
+ type: "channel:jumpToFirstUnread:failed"
3689
+ },
3690
+ origin: {
3691
+ context: { feature: "jumpToFirstUnread" },
3692
+ emitter: "Channel"
3693
+ }
3694
+ });
3695
+ }, [client, t]);
3696
+ const loadMoreFinished = useCallback(
3697
+ debounce(
3698
+ (hasMore, messages) => {
3699
+ if (!isMounted.current) return;
3700
+ dispatch({ hasMore, messages, type: "loadMoreFinished" });
3701
+ },
3702
+ 2e3,
3703
+ { leading: true, trailing: true }
3704
+ ),
3705
+ []
3706
+ );
3707
+ const finishLoadMore = useCallback(
3708
+ (hasMore, messages) => {
3709
+ if (!isMounted.current) return;
3710
+ dispatch({ hasMore, messages, type: "loadMoreFinished" });
3711
+ },
3712
+ [isMounted]
3713
+ );
3714
+ const loadMore = async (limit = DEFAULT_NEXT_CHANNEL_PAGE_SIZE) => {
3715
+ if (!online.current || !window.navigator.onLine || !channel.state.messagePagination.hasPrev)
3716
+ return 0;
3717
+ const oldestMessage = state?.messages?.[0];
3718
+ if (state.loadingMore || state.loadingMoreNewer || oldestMessage?.status !== "received") {
3719
+ return 0;
3720
+ }
3721
+ dispatch({ loadingMore: true, type: "setLoadingMore" });
3722
+ const oldestID = oldestMessage?.id;
3723
+ const perPage = limit;
3724
+ let queryResponse;
3725
+ try {
3726
+ queryResponse = await channel.query({
3727
+ messages: { id_lt: oldestID, limit: perPage },
3728
+ watchers: { limit: perPage }
3729
+ });
3730
+ } catch (e) {
3731
+ console.warn("message pagination request failed with error", e);
3732
+ dispatch({ loadingMore: false, type: "setLoadingMore" });
3733
+ return 0;
3734
+ }
3735
+ loadMoreFinished.cancel();
3736
+ finishLoadMore(channel.state.messagePagination.hasPrev, channel.state.messages);
3737
+ return queryResponse.messages.length;
3738
+ };
3739
+ const loadMoreNewer = async (limit = DEFAULT_NEXT_CHANNEL_PAGE_SIZE) => {
3740
+ if (!online.current || !window.navigator.onLine || !channel.state.messagePagination.hasNext)
3741
+ return 0;
3742
+ const newestMessage = state?.messages?.[state?.messages?.length - 1];
3743
+ if (state.loadingMore || state.loadingMoreNewer) return 0;
3744
+ dispatch({ loadingMoreNewer: true, type: "setLoadingMoreNewer" });
3745
+ const newestId = newestMessage?.id;
3746
+ const perPage = limit;
3747
+ let queryResponse;
3748
+ try {
3749
+ queryResponse = await channel.query({
3750
+ messages: { id_gt: newestId, limit: perPage },
3751
+ watchers: { limit: perPage }
3752
+ });
3753
+ } catch (e) {
3754
+ console.warn("message pagination request failed with error", e);
3755
+ dispatch({ loadingMoreNewer: false, type: "setLoadingMoreNewer" });
3756
+ return 0;
3757
+ }
3758
+ dispatch({
3759
+ hasMoreNewer: channel.state.messagePagination.hasNext,
3760
+ messages: channel.state.messages,
3761
+ type: "loadMoreNewerFinished"
3762
+ });
3763
+ return queryResponse.messages.length;
3764
+ };
3765
+ const jumpToMessage = useCallback(
3766
+ async (messageId, messageLimit = DEFAULT_JUMP_TO_PAGE_SIZE, highlightDuration = DEFAULT_HIGHLIGHT_DURATION) => {
3767
+ dispatch({
3768
+ loadingMoreForJumpToChannelMessage: true,
3769
+ type: "setLoadingMoreForJumpToChannelMessage"
3770
+ });
3771
+ loadMoreFinished.cancel();
3772
+ try {
3773
+ await channel.state.loadMessageIntoState(messageId, void 0, messageLimit);
3774
+ handleHighlightedMessageChange({
3775
+ highlightDuration,
3776
+ highlightedMessageId: messageId
3777
+ });
3778
+ } catch (error) {
3779
+ dispatch({
3780
+ loadingMoreForJumpToChannelMessage: false,
3781
+ type: "setLoadingMoreForJumpToChannelMessage"
3782
+ });
3783
+ throw error;
3784
+ }
3785
+ },
3786
+ [channel, handleHighlightedMessageChange, loadMoreFinished]
3787
+ );
3788
+ const jumpToLatestMessage = useCallback(async () => {
3789
+ loadMoreFinished.cancel();
3790
+ await channel.state.loadMessageIntoState("latest");
3791
+ dispatch({
3792
+ hasMore: channel.state.messagePagination.hasPrev,
3793
+ hasMoreNewer: channel.state.messagePagination.hasNext,
3794
+ messages: channel.state.messages,
3795
+ type: "jumpToLatestMessageFinished"
3796
+ });
3797
+ }, [channel, loadMoreFinished]);
3798
+ const jumpToFirstUnreadMessage = useCallback(
3799
+ async (queryMessageLimit = DEFAULT_JUMP_TO_PAGE_SIZE, highlightDuration = DEFAULT_HIGHLIGHT_DURATION) => {
3800
+ if (!channelUnreadUiState?.unread_messages) return;
3801
+ let lastReadMessageId = channelUnreadUiState?.last_read_message_id;
3802
+ let firstUnreadMessageId = channelUnreadUiState?.first_unread_message_id;
3803
+ let isInCurrentMessageSet = false;
3804
+ if (firstUnreadMessageId) {
3805
+ const result = findInMsgSetById(firstUnreadMessageId, channel.state.messages);
3806
+ isInCurrentMessageSet = result.index !== -1;
3807
+ } else if (lastReadMessageId) {
3808
+ const result = findInMsgSetById(lastReadMessageId, channel.state.messages);
3809
+ isInCurrentMessageSet = !!result.target;
3810
+ firstUnreadMessageId = result.index > -1 ? channel.state.messages[result.index + 1]?.id : void 0;
3811
+ } else {
3812
+ const lastReadTimestamp = channelUnreadUiState.last_read.getTime();
3813
+ const { index: lastReadMessageIndex, target: lastReadMessage } = findInMsgSetByDate(
3814
+ channelUnreadUiState.last_read,
3815
+ channel.state.messages,
3816
+ true
3817
+ );
3818
+ if (lastReadMessage) {
3819
+ firstUnreadMessageId = channel.state.messages[lastReadMessageIndex + 1]?.id;
3820
+ isInCurrentMessageSet = !!firstUnreadMessageId;
3821
+ lastReadMessageId = lastReadMessage.id;
3822
+ } else {
3823
+ dispatch({ loadingMore: true, type: "setLoadingMore" });
3824
+ let messages;
3825
+ try {
3826
+ messages = (await channel.query(
3827
+ {
3828
+ messages: {
3829
+ created_at_around: channelUnreadUiState.last_read.toISOString(),
3830
+ limit: queryMessageLimit
3831
+ }
3832
+ },
3833
+ "new"
3834
+ )).messages;
3835
+ } catch (e) {
3836
+ notifyJumpToFirstUnreadError();
3837
+ finishLoadMore(
3838
+ channel.state.messagePagination.hasPrev,
3839
+ channel.state.messages
3840
+ );
3841
+ return;
3842
+ }
3843
+ const firstMessageWithCreationDate = messages.find((msg) => msg.created_at);
3844
+ if (!firstMessageWithCreationDate) {
3845
+ notifyJumpToFirstUnreadError();
3846
+ finishLoadMore(
3847
+ channel.state.messagePagination.hasPrev,
3848
+ channel.state.messages
3849
+ );
3850
+ return;
3851
+ }
3852
+ const firstMessageTimestamp = new Date(
3853
+ firstMessageWithCreationDate.created_at
3854
+ ).getTime();
3855
+ if (lastReadTimestamp < firstMessageTimestamp) {
3856
+ firstUnreadMessageId = firstMessageWithCreationDate.id;
3857
+ } else {
3858
+ const result = findInMsgSetByDate(channelUnreadUiState.last_read, messages);
3859
+ lastReadMessageId = result.target?.id;
3860
+ }
3861
+ finishLoadMore(
3862
+ channel.state.messagePagination.hasPrev,
3863
+ channel.state.messages
3864
+ );
3865
+ }
3866
+ }
3867
+ if (!firstUnreadMessageId && !lastReadMessageId) {
3868
+ notifyJumpToFirstUnreadError();
3869
+ return;
3870
+ }
3871
+ if (!isInCurrentMessageSet) {
3872
+ dispatch({ loadingMore: true, type: "setLoadingMore" });
3873
+ try {
3874
+ const targetId = firstUnreadMessageId ?? lastReadMessageId;
3875
+ await channel.state.loadMessageIntoState(
3876
+ targetId,
3877
+ void 0,
3878
+ queryMessageLimit
3879
+ );
3880
+ const indexOfTarget = channel.state.messages.findIndex(
3881
+ (message) => message.id === targetId
3882
+ );
3883
+ finishLoadMore(
3884
+ channel.state.messagePagination.hasPrev,
3885
+ channel.state.messages
3886
+ );
3887
+ firstUnreadMessageId = firstUnreadMessageId ?? channel.state.messages[indexOfTarget + 1]?.id;
3888
+ } catch (e) {
3889
+ notifyJumpToFirstUnreadError();
3890
+ finishLoadMore(
3891
+ channel.state.messagePagination.hasPrev,
3892
+ channel.state.messages
3893
+ );
3894
+ return;
3895
+ }
3896
+ }
3897
+ if (!firstUnreadMessageId) {
3898
+ notifyJumpToFirstUnreadError();
3899
+ return;
3900
+ }
3901
+ if (!channelUnreadUiState.first_unread_message_id)
3902
+ _setChannelUnreadUiState({
3903
+ ...channelUnreadUiState,
3904
+ first_unread_message_id: firstUnreadMessageId,
3905
+ last_read_message_id: lastReadMessageId
3906
+ });
3907
+ handleHighlightedMessageChange({
3908
+ highlightDuration,
3909
+ highlightedMessageId: firstUnreadMessageId
3910
+ });
3911
+ },
3912
+ [
3913
+ channel,
3914
+ finishLoadMore,
3915
+ handleHighlightedMessageChange,
3916
+ notifyJumpToFirstUnreadError,
3917
+ channelUnreadUiState
3918
+ ]
3919
+ );
3920
+ const deleteMessage = useCallback(
3921
+ async (message, options) => {
3922
+ if (!message?.id) {
3923
+ throw new Error("Cannot delete a message - missing message ID.");
3924
+ }
3925
+ let deletedMessage;
3926
+ if (doDeleteMessageRequest) {
3927
+ deletedMessage = await doDeleteMessageRequest(message, options);
3928
+ } else {
3929
+ const result = await client.deleteMessage(message.id, options);
3930
+ deletedMessage = result.message;
3931
+ }
3932
+ return deletedMessage;
3933
+ },
3934
+ [client, doDeleteMessageRequest]
3935
+ );
3936
+ const updateMessage = (updatedMessage) => {
3937
+ channel.state.addMessageSorted(updatedMessage, true);
3938
+ dispatch({
3939
+ channel,
3940
+ parentId: state.thread && updatedMessage.parent_id,
3941
+ type: "copyMessagesFromChannel"
3942
+ });
3943
+ };
3944
+ const doSendMessage = async ({
3945
+ localMessage,
3946
+ message,
3947
+ options
3948
+ }) => {
3949
+ try {
3950
+ let messageResponse;
3951
+ if (doSendMessageRequest) {
3952
+ messageResponse = await doSendMessageRequest(channel, message, options);
3953
+ } else {
3954
+ messageResponse = await channel.sendMessage(message, options);
3955
+ }
3956
+ let existingMessage = void 0;
3957
+ for (let i = channel.state.messages.length - 1; i >= 0; i--) {
3958
+ const msg = channel.state.messages[i];
3959
+ if (msg.id && msg.id === message.id) {
3960
+ existingMessage = msg;
3961
+ break;
3962
+ }
3963
+ }
3964
+ const responseTimestamp = new Date(
3965
+ messageResponse?.message?.updated_at || 0
3966
+ ).getTime();
3967
+ const existingMessageTimestamp = existingMessage?.updated_at?.getTime() || 0;
3968
+ const responseIsTheNewest = responseTimestamp > existingMessageTimestamp;
3969
+ if (messageResponse?.message && (responseIsTheNewest || existingMessage?.status === "sending")) {
3970
+ updateMessage({
3971
+ ...messageResponse.message,
3972
+ status: "received"
3973
+ });
3974
+ }
3975
+ } catch (error) {
3976
+ const parsedError = adaptMessageSendErrorToErrorFromResponse(error);
3977
+ if (parsedError.code === 4 && error instanceof Error && error.message.includes("already exists")) {
3978
+ updateMessage({
3979
+ ...localMessage,
3980
+ status: "received"
3981
+ });
3982
+ } else {
3983
+ updateMessage({
3984
+ ...localMessage,
3985
+ error: parsedError,
3986
+ status: "failed"
3987
+ });
3988
+ thread?.upsertReplyLocally({
3989
+ message: {
3990
+ ...localMessage,
3991
+ error: parsedError,
3992
+ status: "failed"
3993
+ }
3994
+ });
3995
+ }
3996
+ }
3997
+ };
3998
+ const sendMessage = async ({
3999
+ localMessage,
4000
+ message,
4001
+ options
4002
+ }) => {
4003
+ channel.state.filterErrorMessages();
4004
+ thread?.upsertReplyLocally({
4005
+ message: localMessage
4006
+ });
4007
+ updateMessage(localMessage);
4008
+ await doSendMessage({ localMessage, message, options });
4009
+ };
4010
+ const retrySendMessage = async (localMessage) => {
4011
+ const type = localMessage.type === "error" ? "regular" : localMessage.type;
4012
+ updateMessage({
4013
+ ...localMessage,
4014
+ error: void 0,
4015
+ status: "sending",
4016
+ type
4017
+ });
4018
+ await doSendMessage({
4019
+ localMessage,
4020
+ message: localMessageToNewMessagePayload({ ...localMessage, type })
4021
+ });
4022
+ };
4023
+ const removeMessage = (message) => {
4024
+ channel.state.removeMessage(message);
4025
+ dispatch({
4026
+ channel,
4027
+ parentId: state.thread && message.parent_id,
4028
+ type: "copyMessagesFromChannel"
4029
+ });
4030
+ };
4031
+ const openThread = (message, event) => {
4032
+ event?.preventDefault();
4033
+ dispatch({ channel, message, type: "openThread" });
4034
+ };
4035
+ const closeThread = (event) => {
4036
+ event?.preventDefault();
4037
+ dispatch({ type: "closeThread" });
4038
+ };
4039
+ const loadMoreThreadFinished = useCallback(
4040
+ debounce(
4041
+ (threadHasMore, threadMessages) => {
4042
+ dispatch({
4043
+ threadHasMore,
4044
+ threadMessages,
4045
+ type: "loadMoreThreadFinished"
4046
+ });
4047
+ },
4048
+ 2e3,
4049
+ { leading: true, trailing: true }
4050
+ ),
4051
+ []
4052
+ );
4053
+ const loadMoreThread = async (limit = DEFAULT_THREAD_PAGE_SIZE) => {
4054
+ if (state.threadLoadingMore || !state.thread || !state.threadHasMore) return;
4055
+ dispatch({ type: "startLoadingThread" });
4056
+ const parentId = state.thread.id;
4057
+ if (!parentId) {
4058
+ return dispatch({ type: "closeThread" });
4059
+ }
4060
+ const oldMessages = channel.state.threads[parentId] || [];
4061
+ const oldestMessageId = oldMessages[0]?.id;
4062
+ try {
4063
+ const queryResponse = await channel.getReplies(parentId, {
4064
+ id_lt: oldestMessageId,
4065
+ limit
4066
+ });
4067
+ const threadHasMoreMessages = hasMoreMessagesProbably(
4068
+ queryResponse.messages.length,
4069
+ limit
4070
+ );
4071
+ const newThreadMessages = channel.state.threads[parentId] || [];
4072
+ loadMoreThreadFinished(threadHasMoreMessages, newThreadMessages);
4073
+ } catch (e) {
4074
+ loadMoreThreadFinished(false, oldMessages);
4075
+ }
4076
+ };
4077
+ const onMentionsHoverOrClick = useMentionsHandlers(onMentionsHover, onMentionsClick);
4078
+ const editMessage = useEditMessageHandler(doUpdateMessageRequest);
4079
+ const { typing, ...restState } = state;
4080
+ const channelStateContextValue = useCreateChannelStateContext({
4081
+ ...restState,
4082
+ channel,
4083
+ channelCapabilitiesArray,
4084
+ channelConfig,
4085
+ channelUnreadUiState,
4086
+ giphyVersion: props.giphyVersion || "fixed_height",
4087
+ imageAttachmentSizeHandler: props.imageAttachmentSizeHandler || getImageAttachmentConfiguration,
4088
+ mutes,
4089
+ notifications: [],
4090
+ shouldGenerateVideoThumbnail: props.shouldGenerateVideoThumbnail || true,
4091
+ videoAttachmentSizeHandler: props.videoAttachmentSizeHandler || getVideoAttachmentConfiguration,
4092
+ watcher_count: state.watcherCount
4093
+ });
4094
+ const channelActionContextValue = useMemo(
4095
+ () => ({
4096
+ closeThread,
4097
+ deleteMessage,
4098
+ dispatch,
4099
+ editMessage,
4100
+ jumpToFirstUnreadMessage,
4101
+ jumpToLatestMessage,
4102
+ jumpToMessage,
4103
+ loadMore,
4104
+ loadMoreNewer,
4105
+ loadMoreThread,
4106
+ markRead,
4107
+ onMentionsClick: onMentionsHoverOrClick,
4108
+ onMentionsHover: onMentionsHoverOrClick,
4109
+ openThread,
4110
+ removeMessage,
4111
+ retrySendMessage,
4112
+ sendMessage,
4113
+ setChannelUnreadUiState,
4114
+ skipMessageDataMemoization,
4115
+ updateMessage
4116
+ }),
4117
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4118
+ [
4119
+ channel.cid,
4120
+ deleteMessage,
4121
+ loadMore,
4122
+ loadMoreNewer,
4123
+ markRead,
4124
+ jumpToFirstUnreadMessage,
4125
+ jumpToMessage,
4126
+ jumpToLatestMessage,
4127
+ setChannelUnreadUiState
4128
+ ]
4129
+ );
4130
+ const typingContextValue = useCreateTypingContext({
4131
+ typing
4132
+ });
4133
+ if (state.error) {
4134
+ return /* @__PURE__ */ jsx(ChannelContainer, { children: /* @__PURE__ */ jsx(LoadingErrorIndicator$1, { error: state.error }) });
4135
+ }
4136
+ if (state.loading) {
4137
+ return /* @__PURE__ */ jsx(ChannelContainer, { children: /* @__PURE__ */ jsx(LoadingIndicator, {}) });
4138
+ }
4139
+ if (!channel.watch) {
4140
+ return /* @__PURE__ */ jsx(ChannelContainer, { children: /* @__PURE__ */ jsx("div", { children: t("Channel Missing") }) });
4141
+ }
4142
+ return /* @__PURE__ */ jsx(ChannelContainer, { className: windowsEmojiClass, children: /* @__PURE__ */ jsx(ChannelStateProvider, { value: channelStateContextValue, children: /* @__PURE__ */ jsx(ChannelActionProvider, { value: channelActionContextValue, children: /* @__PURE__ */ jsx(TypingProvider, { value: typingContextValue, children: /* @__PURE__ */ jsx(WithAudioPlayback, { allowConcurrentPlayback: allowConcurrentAudioPlayback, children: /* @__PURE__ */ jsx("div", { className: clsx(chatContainerClass), children }) }) }) }) }) });
4143
+ };
4144
+ const Channel = React.memo(UnMemoizedChannel);
4145
+ const ThreadContext = createContext(void 0);
4146
+ const useThreadContext = () => useContext(ThreadContext);
4147
+ const ThreadProvider = ({
4148
+ children,
4149
+ thread
4150
+ }) => /* @__PURE__ */ jsx(ThreadContext.Provider, { value: thread, children: /* @__PURE__ */ jsx(Channel, { channel: thread?.channel, children }) });
4151
+ const UnreadCountBadge = ({
4152
+ children,
4153
+ count,
4154
+ position
4155
+ }) => /* @__PURE__ */ jsxs("div", { className: "str-chat__unread-count-badge-container", children: [
4156
+ children,
4157
+ count > 0 && /* @__PURE__ */ jsx(
4158
+ "div",
4159
+ {
4160
+ className: clsx(
4161
+ "str-chat__unread-count-badge",
4162
+ position && `str-chat__unread-count-badge--${position}`
4163
+ ),
4164
+ children: count
4165
+ }
4166
+ )
4167
+ ] });
4168
+ const ChatViewContext = createContext(void 0);
4169
+ const useChatViewContext = () => {
4170
+ const value = useContext(ChatViewContext);
4171
+ if (!value) {
4172
+ console.warn(
4173
+ "The useChatViewContext hook was called outside of the ChatView provider."
4174
+ );
4175
+ return {};
4176
+ }
4177
+ return value;
4178
+ };
4179
+ const ChatView = ({ children }) => {
4180
+ const [activeChatView, setActiveChatView] = useState("channels");
4181
+ const { theme } = useChatContext();
4182
+ const value = useMemo(() => ({ activeChatView, setActiveChatView }), [activeChatView]);
4183
+ return /* @__PURE__ */ jsx(ChatViewContext.Provider, { value, children: /* @__PURE__ */ jsx("div", { className: clsx("str-chat", theme, "str-chat__chat-view"), children }) });
4184
+ };
4185
+ const ChannelsView = ({ children }) => {
4186
+ const { activeChatView } = useChatViewContext();
4187
+ if (activeChatView !== "channels") return null;
4188
+ return /* @__PURE__ */ jsx("div", { className: "str-chat__chat-view__channels", children });
4189
+ };
4190
+ const ThreadsViewContext = createContext({
4191
+ activeThread: void 0,
4192
+ setActiveThread: () => void 0
4193
+ });
4194
+ const useThreadsViewContext = () => useContext(ThreadsViewContext);
4195
+ const ThreadsView = ({ children }) => {
4196
+ const { activeChatView } = useChatViewContext();
4197
+ const [activeThread, setActiveThread] = useState(void 0);
4198
+ const value = useMemo(() => ({ activeThread, setActiveThread }), [activeThread]);
4199
+ if (activeChatView !== "threads") return null;
4200
+ return /* @__PURE__ */ jsx(ThreadsViewContext.Provider, { value, children: /* @__PURE__ */ jsx("div", { className: "str-chat__chat-view__threads", children }) });
4201
+ };
4202
+ const useActiveThread = ({ activeThread }) => {
4203
+ useEffect(() => {
4204
+ if (!activeThread) return;
4205
+ const handleVisibilityChange = () => {
4206
+ if (document.visibilityState === "visible" && document.hasFocus()) {
4207
+ activeThread.activate();
4208
+ }
4209
+ if (document.visibilityState === "hidden" || !document.hasFocus()) {
4210
+ activeThread.deactivate();
4211
+ }
4212
+ };
4213
+ handleVisibilityChange();
4214
+ window.addEventListener("focus", handleVisibilityChange);
4215
+ window.addEventListener("blur", handleVisibilityChange);
4216
+ return () => {
4217
+ activeThread.deactivate();
4218
+ window.addEventListener("blur", handleVisibilityChange);
4219
+ window.removeEventListener("focus", handleVisibilityChange);
4220
+ };
4221
+ }, [activeThread]);
4222
+ };
4223
+ const ThreadAdapter = ({ children }) => {
4224
+ const { client } = useChatContext("ThreadAdapter");
4225
+ const { EmptyStateIndicator: EmptyStateIndicator$1 = EmptyStateIndicator } = useComponentContext();
4226
+ const { activeThread } = useThreadsViewContext();
4227
+ const { t } = useTranslationContext("ThreadAdapter");
4228
+ const { isLoading, ready } = useStateStore(
4229
+ client.threads.state,
4230
+ threadAdapterSelector
4231
+ ) ?? {
4232
+ isLoading: false,
4233
+ ready: false
4234
+ };
4235
+ useActiveThread({ activeThread });
4236
+ if (!activeThread && ready && !isLoading && EmptyStateIndicator$1) {
4237
+ return /* @__PURE__ */ jsx("div", { className: "str-chat__thread-container str-chat__thread", children: /* @__PURE__ */ jsx(
4238
+ EmptyStateIndicator$1,
4239
+ {
4240
+ listType: "message",
4241
+ messageText: t("Select a thread to continue the conversation")
4242
+ }
4243
+ ) });
4244
+ }
4245
+ return /* @__PURE__ */ jsx(ThreadProvider, { thread: activeThread, children });
4246
+ };
4247
+ const ChatViewSelectorButton = ({
4248
+ ActiveIcon,
4249
+ children,
4250
+ className,
4251
+ Icon,
4252
+ iconOnly = true,
4253
+ isActive,
4254
+ text,
4255
+ ...props
4256
+ }) => {
4257
+ const SelectorIcon = isActive && ActiveIcon ? ActiveIcon : Icon;
4258
+ const shouldShowTooltip = !!text && iconOnly;
4259
+ return /* @__PURE__ */ jsxs("div", { className: "str-chat__chat-view__selector-button-container", children: [
4260
+ /* @__PURE__ */ jsxs(
4261
+ Button,
4262
+ {
4263
+ appearance: "ghost",
4264
+ "aria-label": props["aria-label"] ?? (shouldShowTooltip ? text : void 0),
4265
+ className: clsx("str-chat__chat-view__selector-button", className),
4266
+ role: "tab",
4267
+ variant: "secondary",
4268
+ ...props,
4269
+ children: [
4270
+ children ?? (SelectorIcon && /* @__PURE__ */ jsx(SelectorIcon, {})),
4271
+ !iconOnly && text && /* @__PURE__ */ jsx("div", { className: "str-chat__chat-view__selector-button-text", children: text })
4272
+ ]
4273
+ }
4274
+ ),
4275
+ shouldShowTooltip && /* @__PURE__ */ jsx(
4276
+ "div",
4277
+ {
4278
+ "aria-hidden": "true",
4279
+ className: "str-chat__chat-view__selector-button-tooltip str-chat__tooltip",
4280
+ children: text
4281
+ }
4282
+ )
4283
+ ] });
4284
+ };
4285
+ const threadAdapterSelector = ({ pagination, ready }) => ({
4286
+ isLoading: pagination.isLoading,
4287
+ ready
4288
+ });
4289
+ const unreadThreadCountSelector = ({ unreadThreadCount }) => ({
4290
+ unreadThreadCount
4291
+ });
4292
+ const ChatViewChannelsSelectorButton = ({
4293
+ iconOnly = true
4294
+ }) => {
4295
+ const { activeChatView, setActiveChatView } = useChatViewContext();
4296
+ const { openMobileNav } = useChatContext("ChatViewChannelsSelectorButton");
4297
+ const { t } = useTranslationContext();
4298
+ const isActive = activeChatView === "channels";
4299
+ return /* @__PURE__ */ jsx(
4300
+ ChatViewSelectorButton,
4301
+ {
4302
+ ActiveIcon: IconMessageBubbleFill,
4303
+ "aria-selected": isActive,
4304
+ Icon: IconMessageBubble,
4305
+ iconOnly,
4306
+ isActive,
4307
+ onPointerDown: () => {
4308
+ openMobileNav();
4309
+ setActiveChatView("channels");
4310
+ },
4311
+ text: t("Channels")
4312
+ }
4313
+ );
4314
+ };
4315
+ const ChatViewThreadsSelectorButton = ({
4316
+ iconOnly = true
4317
+ }) => {
4318
+ const { client, openMobileNav } = useChatContext();
4319
+ const { unreadThreadCount } = useStateStore(
4320
+ client.threads.state,
4321
+ unreadThreadCountSelector
4322
+ ) ?? {
4323
+ unreadThreadCount: 0
4324
+ };
4325
+ const { activeChatView, setActiveChatView } = useChatViewContext();
4326
+ const { t } = useTranslationContext();
4327
+ const isActive = activeChatView === "threads";
4328
+ return /* @__PURE__ */ jsx(
4329
+ ChatViewSelectorButton,
4330
+ {
4331
+ ActiveIcon: IconBubbleText6SolidChatMessage,
4332
+ "aria-selected": isActive,
4333
+ Icon: IconThread,
4334
+ iconOnly,
4335
+ isActive,
4336
+ onPointerDown: () => {
4337
+ openMobileNav();
4338
+ setActiveChatView("threads");
4339
+ },
4340
+ text: t("Threads"),
4341
+ children: /* @__PURE__ */ jsx(UnreadCountBadge, { count: unreadThreadCount, position: "top-right", children: isActive ? /* @__PURE__ */ jsx(IconBubbleText6SolidChatMessage, {}) : /* @__PURE__ */ jsx(IconThread, {}) })
4342
+ }
4343
+ );
4344
+ };
4345
+ const defaultChatViewSelectorItemSet = [
4346
+ {
4347
+ Component: ChatViewChannelsSelectorButton,
4348
+ type: "channels"
4349
+ },
4350
+ {
4351
+ Component: ChatViewThreadsSelectorButton,
4352
+ type: "threads"
4353
+ }
4354
+ ];
4355
+ const ChatViewSelector = ({
4356
+ iconOnly = true,
4357
+ itemSet = defaultChatViewSelectorItemSet
4358
+ }) => {
4359
+ const { navOpen } = useChatContext("ChatView.Selector");
4360
+ return /* @__PURE__ */ jsx(
4361
+ "div",
4362
+ {
4363
+ className: clsx("str-chat__chat-view__selector", {
4364
+ "str-chat__chat-view__selector--nav-closed": navOpen === false,
4365
+ "str-chat__chat-view__selector--nav-open": navOpen === true
4366
+ }),
4367
+ children: itemSet.map(({ Component, type }) => /* @__PURE__ */ jsx(Component, { iconOnly }, type))
4368
+ }
4369
+ );
4370
+ };
4371
+ ChatView.Channels = ChannelsView;
4372
+ ChatView.Threads = ThreadsView;
4373
+ ChatView.ThreadAdapter = ThreadAdapter;
4374
+ ChatView.Selector = ChatViewSelector;
4375
+ const useNotificationTarget = () => {
4376
+ const chatViewContext = useContext(ChatViewContext);
4377
+ const { channels } = useChannelListContext();
4378
+ const { channel } = useChannelStateContext();
4379
+ const threadInstance = useThreadContext();
4380
+ const { legacyThread } = useLegacyThreadContext();
4381
+ if (threadInstance || legacyThread) return "thread";
4382
+ if (channel) return "channel";
4383
+ if (chatViewContext?.activeChatView === "threads") return "thread-list";
4384
+ if (channels) return "channel-list";
4385
+ return void 0;
4386
+ };
4387
+ const AudioPlayerContext = React.createContext({
4388
+ audioPlayers: null
4389
+ });
4390
+ const WithAudioPlayback = ({
4391
+ allowConcurrentPlayback,
4392
+ children
4393
+ }) => {
4394
+ const [audioPlayers] = useState(() => new AudioPlayerPool({ allowConcurrentPlayback }));
4395
+ useEffect(
4396
+ () => () => {
4397
+ audioPlayers.clear();
4398
+ },
4399
+ [audioPlayers]
4400
+ );
4401
+ return /* @__PURE__ */ jsx(AudioPlayerContext.Provider, { value: { audioPlayers }, children });
4402
+ };
4403
+ const makeAudioPlayerId = ({ requester, src }) => `${requester ?? "requester-unknown"}:${src}`;
4404
+ const useAudioPlayer = ({
4405
+ durationSeconds,
4406
+ fileSize,
4407
+ mimeType,
4408
+ playbackRates,
4409
+ plugins,
4410
+ requester = "",
4411
+ src,
4412
+ title,
4413
+ waveformData
4414
+ }) => {
4415
+ const { client } = useChatContext();
4416
+ const panel = useNotificationTarget();
4417
+ const { t } = useTranslationContext();
4418
+ const { audioPlayers } = useContext(AudioPlayerContext);
4419
+ const audioPlayer = src && audioPlayers ? audioPlayers.getOrAdd({
4420
+ durationSeconds,
4421
+ fileSize,
4422
+ id: makeAudioPlayerId({ requester, src }),
4423
+ mimeType,
4424
+ playbackRates,
4425
+ plugins,
4426
+ src,
4427
+ title,
4428
+ waveformData
4429
+ }) : void 0;
4430
+ useEffect(() => {
4431
+ if (!audioPlayer) return;
4432
+ const notificationsPlugin = audioPlayerNotificationsPluginFactory({
4433
+ client,
4434
+ panel,
4435
+ t
4436
+ });
4437
+ audioPlayer.setPlugins((currentPlugins) => [
4438
+ ...currentPlugins.filter((plugin) => plugin.id !== notificationsPlugin.id),
4439
+ notificationsPlugin
4440
+ ]);
4441
+ }, [audioPlayer, client, panel, t]);
4442
+ return audioPlayer;
4443
+ };
4444
+ const activeAudioPlayerSelector = ({ activeAudioPlayer }) => ({
4445
+ activeAudioPlayer
4446
+ });
4447
+ const useActiveAudioPlayer = () => {
4448
+ const { audioPlayers } = useContext(AudioPlayerContext);
4449
+ const { activeAudioPlayer } = useStateStore(audioPlayers?.state, activeAudioPlayerSelector) ?? {};
4450
+ return activeAudioPlayer;
4451
+ };
4452
+ export {
4453
+ IconImage as $,
4454
+ IconChevronLeft as A,
4455
+ BaseIcon as B,
4456
+ ComponentContext as C,
4457
+ IconArrowLeft as D,
4458
+ IconExclamationMark as E,
4459
+ IconNoSign as F,
4460
+ isMessageErrorRetryable as G,
4461
+ ACTIONS_NOT_WORKING_IN_THREAD as H,
4462
+ IconPauseFill as I,
4463
+ useNotificationTarget as J,
4464
+ IconArrowUpRight as K,
4465
+ LocalizedFormat as L,
4466
+ addNotificationTargetTag as M,
4467
+ IconPin as N,
4468
+ mapToUserNameOrId as O,
4469
+ IconClock as P,
4470
+ IconCheckmark1Small as Q,
4471
+ IconChecks as R,
4472
+ getReadByTooltipText as S,
4473
+ messageHasAttachments as T,
4474
+ messageTextHasEmojisOnly as U,
4475
+ isDate as V,
4476
+ getDateString as W,
4477
+ IconTranslate as X,
4478
+ useMessageComposerContext as Y,
4479
+ useIsCooldownActive as Z,
4480
+ IconCrossSmall as _,
4481
+ useMessageComposerController as a,
4482
+ processMessages as a$,
4483
+ IconPoll as a0,
4484
+ IconLocation as a1,
4485
+ IconFile as a2,
4486
+ IconLink as a3,
4487
+ IconVideo as a4,
4488
+ IconVideoFill as a5,
4489
+ IconVoice as a6,
4490
+ IconSave as a7,
4491
+ IconBell as a8,
4492
+ IconChevronDown as a9,
4493
+ isLanguageSupported as aA,
4494
+ IconLayoutAlignLeft as aB,
4495
+ useChatViewContext as aC,
4496
+ MESSAGE_ACTIONS as aD,
4497
+ LegacyThreadContext as aE,
4498
+ IconReply as aF,
4499
+ IconEmoji as aG,
4500
+ IconMore as aH,
4501
+ IconUserCheck as aI,
4502
+ IconUnsave as aJ,
4503
+ IconBellOff as aK,
4504
+ IconNotification as aL,
4505
+ IconEdit as aM,
4506
+ IconCopy as aN,
4507
+ IconUnpin as aO,
4508
+ IconQuote as aP,
4509
+ IconThread as aQ,
4510
+ areMessageUIPropsEqual as aR,
4511
+ isDateSeparatorMessage as aS,
4512
+ isMessageBlocked as aT,
4513
+ messageHasSingleAttachment as aU,
4514
+ messageHasGiphyAttachment as aV,
4515
+ messageHasReactions as aW,
4516
+ isMessageEdited as aX,
4517
+ countEmojis as aY,
4518
+ areMessagePropsEqual as aZ,
4519
+ getMessageActions as a_,
4520
+ IconPlusSmall as aa,
4521
+ IconCheckmark as ab,
4522
+ DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD as ac,
4523
+ IconTrophy as ad,
4524
+ IconReorder as ae,
4525
+ IconMinusCircle as af,
4526
+ IconSend as ag,
4527
+ IconAudio as ah,
4528
+ IconUserAdd as ai,
4529
+ IconMute as aj,
4530
+ IconFlag as ak,
4531
+ IconUserRemove as al,
4532
+ IconAttachment as am,
4533
+ IconCommand as an,
4534
+ CHANNEL_CONTAINER_ID as ao,
4535
+ IconPlus as ap,
4536
+ IconExclamationTriangle as aq,
4537
+ useAudioPlayer as ar,
4538
+ IconRetry as as,
4539
+ IconArrowDownCircle as at,
4540
+ IconThunder as au,
4541
+ IconDelete as av,
4542
+ IconUpload as aw,
4543
+ MessageComposerContextProvider as ax,
4544
+ useTypingContext as ay,
4545
+ defaultDateTimeParser as az,
4546
+ useChannelActionContext as b,
4547
+ isNotificationTargetPanel as b$,
4548
+ insertIntro as b0,
4549
+ getGroupStyles as b1,
4550
+ getLastReceived as b2,
4551
+ IconArrowUp as b3,
4552
+ isIntroMessage as b4,
4553
+ isLocalMessage as b5,
4554
+ getIsFirstUnreadMessage as b6,
4555
+ IconArrowDown as b7,
4556
+ DEFAULT_NEXT_CHANNEL_PAGE_SIZE as b8,
4557
+ EmptyStateIndicator as b9,
4558
+ useActiveThread as bA,
4559
+ ChatViewSelectorButton as bB,
4560
+ ChatViewChannelsSelectorButton as bC,
4561
+ ChatViewThreadsSelectorButton as bD,
4562
+ defaultChatViewSelectorItemSet as bE,
4563
+ createIcon as bF,
4564
+ IconArrowRight as bG,
4565
+ IconMessageBubble as bH,
4566
+ IconMessageBubbleFill as bI,
4567
+ IconBubble3ChatMessage as bJ,
4568
+ IconBubbleText6SolidChatMessage as bK,
4569
+ IconThreadFill as bL,
4570
+ IconInfo as bM,
4571
+ IconLightBulbSimple as bN,
4572
+ IconVoiceFill as bO,
4573
+ IconMinus as bP,
4574
+ IconMinusSmall as bQ,
4575
+ IconSettingsGear2 as bR,
4576
+ LoadingChannel as bS,
4577
+ LoadingErrorIndicator as bT,
4578
+ OPTIONAL_MESSAGE_ACTIONS as bU,
4579
+ getImages as bV,
4580
+ getNonImageAttachments as bW,
4581
+ makeIntroMessage as bX,
4582
+ makeDateMessageId as bY,
4583
+ hasMoreMessagesProbably as bZ,
4584
+ hasNotMoreMessages as b_,
4585
+ getChannel as ba,
4586
+ IconSearch as bb,
4587
+ IconXCircle as bc,
4588
+ useChannelListContext as bd,
4589
+ DEFAULT_JUMP_TO_PAGE_SIZE as be,
4590
+ ChannelListContextProvider as bf,
4591
+ IconArchive as bg,
4592
+ IconLeave as bh,
4593
+ IconCamera as bi,
4594
+ IconExclamationCircleFill as bj,
4595
+ ChatProvider as bk,
4596
+ TranslationProvider as bl,
4597
+ useThreadsViewContext as bm,
4598
+ IconMessageBubbles as bn,
4599
+ IconRefresh as bo,
4600
+ IconEyeOpen as bp,
4601
+ useActiveAudioPlayer as bq,
4602
+ WithAudioPlayback as br,
4603
+ defaultRegisterAudioPlayerError as bs,
4604
+ elementIsPlaying as bt,
4605
+ AudioPlayer as bu,
4606
+ useEditMessageHandler as bv,
4607
+ useMentionsHandlers as bw,
4608
+ Channel as bx,
4609
+ ChatViewContext as by,
4610
+ ChatView as bz,
4611
+ useTranslationContext as c,
4612
+ getNotificationTargetPanel as c0,
4613
+ getNotificationTargetTag as c1,
4614
+ useLegacyThreadContext as c2,
4615
+ ThreadContext as c3,
4616
+ ThreadProvider as c4,
4617
+ ChannelActionContext as c5,
4618
+ ChannelActionProvider as c6,
4619
+ ChannelListContext as c7,
4620
+ ChannelStateContext as c8,
4621
+ ChannelStateProvider as c9,
4622
+ ChatContext as ca,
4623
+ ComponentProvider as cb,
4624
+ MessageComposerContext as cc,
4625
+ TranslationContext as cd,
4626
+ TypingContext as ce,
4627
+ TypingProvider as cf,
4628
+ isDayOrMoment as cg,
4629
+ isNumberOrString as ch,
4630
+ useChannelStateContext as d,
4631
+ useChatContext as e,
4632
+ isNotificationForPanel as f,
4633
+ Button as g,
4634
+ IconPlayFill as h,
4635
+ isMessageBounced as i,
4636
+ getDefaultExportFromCjs as j,
4637
+ defaultTranslatorFunction as k,
4638
+ calendar as l,
4639
+ IconLoading as m,
4640
+ isNetworkSendFailure as n,
4641
+ isUserMuted as o,
4642
+ predefinedFormatters as p,
4643
+ defaultPinPermissions as q,
4644
+ useThreadContext as r,
4645
+ usePopoverPosition as s,
4646
+ useComponentContext as t,
4647
+ useStateStore as u,
4648
+ validateAndGetMessage as v,
4649
+ IconXmark as w,
4650
+ IconUser as x,
4651
+ IconExclamationMarkFill as y,
4652
+ IconChevronRight as z
4653
+ };
4654
+ //# sourceMappingURL=WithAudioPlayback.89700cb5.mjs.map